Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functions package #1171

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .monorepolint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const archetypeRules = archetypes(
[
"@osdk/client",
"@osdk/api",
"@osdk/functions",
],
{
...LIBRARY_RULES,
Expand Down
21 changes: 21 additions & 0 deletions etc/functions.report.api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## API Report File for "@osdk/functions"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

// @public (undocumented)
export type Double<T extends number = number> = T & { __doubleBrand?: void };

// @public (undocumented)
export type Float<T extends number = number> = T & { __floatBrand?: void };

// @public (undocumented)
export type Integer<T extends number = number> = T & { __integerBrand?: void };

// @public (undocumented)
export type Long<T extends string = string> = T & { __longBrand?: void };

// (No @packageDocumentation comment for this package)

```
5 changes: 5 additions & 0 deletions packages/functions/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "@osdk/monorepo.api-extractor/base.json",
"mainEntryPointFilePath": "<projectFolder>/build/types/index.d.ts"
}
76 changes: 76 additions & 0 deletions packages/functions/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"name": "@osdk/functions",
"version": "0.0.0",
"description": "",
"access": "public",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/palantir/osdk-ts.git"
},
"exports": {
".": {
"browser": "./build/browser/index.js",
"import": {
"types": "./build/types/index.d.ts",
"default": "./build/esm/index.js"
},
"require": "./build/cjs/index.cjs",
"default": "./build/browser/index.js"
},
"./*": {
"browser": "./build/browser/public/*.js",
"import": {
"types": "./build/types/public/*.d.ts",
"default": "./build/esm/public/*.js"
},
"require": "./build/cjs/public/*.cjs",
"default": "./build/browser/public/*.js"
}
},
"scripts": {
"check-api": "api-extractor run --verbose --local",
"check-attw": "attw --pack .",
"check-spelling": "cspell --quiet .",
"clean": "rm -rf lib dist types build tsconfig.tsbuildinfo",
"fix-lint": "eslint . --fix && dprint fmt --config $(find-up dprint.json)",
"lint": "eslint . && dprint check --config $(find-up dprint.json)",
"transpileBrowser": "monorepo.tool.transpile -f esm -m normal -t browser",
"transpileCjs": "monorepo.tool.transpile -f cjs -m bundle -t node",
"transpileEsm": "monorepo.tool.transpile -f esm -m normal -t node",
"transpileTypes": "monorepo.tool.transpile -f esm -m types -t node",
"typecheck": "tsc --noEmit --emitDeclarationOnly false"
},
"dependencies": {
"@types/geojson": "^7946.0.13",
"fetch-retry": "^6.0.0",
"tiny-invariant": "^1.3.1",
"type-fest": "^4.18.2"
},
"devDependencies": {
"@microsoft/api-documenter": "^7.26.5",
"@microsoft/api-extractor": "^7.49.1",
"@osdk/monorepo.api-extractor": "workspace:~",
"@osdk/monorepo.tsconfig": "workspace:~",
"ts-expect": "^1.3.0",
"typescript": "~5.5.4"
},
"publishConfig": {
"access": "public"
},
"keywords": [],
"files": [
"build/cjs",
"build/esm",
"build/browser",
"build/types",
"CHANGELOG.md",
"package.json",
"templates",
"*.d.ts"
],
"main": "./build/cjs/index.cjs",
"module": "./build/esm/index.js",
"types": "./build/cjs/index.d.cts",
"type": "module"
}
25 changes: 25 additions & 0 deletions packages/functions/src/PrimitiveTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export type Integer<T extends number = number> = T & { __integerBrand?: void };
export type Float<T extends number = number> = T & { __floatBrand?: void };
export type Double<T extends number = number> = T & { __doubleBrand?: void };
export type Long<T extends string = string> = T & { __longBrand?: void };

export type DateISO<T extends string = string> = T & { __dateBrand?: void };

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also wouldn't be against calling this DateISOString for maximum clarity and deprecating the type /supporting it in addition to Temporal.PlainDate. Likewise with TimestampISOString below

export type TimestampISO<T extends string = string> = T & {
__timestampBrand?: void;
};
17 changes: 17 additions & 0 deletions packages/functions/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export type { Double, Float, Integer, Long } from "./PrimitiveTypes.js";
11 changes: 11 additions & 0 deletions packages/functions/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "@osdk/monorepo.tsconfig/base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build/esm"
},
"include": [
"./src/**/*"
],
"references": []
}
27 changes: 27 additions & 0 deletions packages/functions/vitest.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { configDefaults, defineConfig } from "vitest/config";

export default defineConfig({
test: {
pool: "forks",
exclude: [...configDefaults.exclude, "**/build/**/*"],
fakeTimers: {
toFake: ["setTimeout", "clearTimeout", "Date"],
},
},
});
Loading
Loading