@osdk/unit-testing 0.0.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +237 -0
- package/build/browser/api/MockClient.js +2 -0
- package/build/browser/api/MockClient.js.map +1 -0
- package/build/browser/api/MockOsdkObjectOptions.js +2 -0
- package/build/browser/api/MockOsdkObjectOptions.js.map +1 -0
- package/build/browser/api/StubBuilders.js +2 -0
- package/build/browser/api/StubBuilders.js.map +1 -0
- package/build/browser/api/StubClient.js +2 -0
- package/build/browser/api/StubClient.js.map +1 -0
- package/build/browser/api/index.js +2 -0
- package/build/browser/api/index.js.map +1 -0
- package/build/browser/example-function-tests/basicAggregate/basicAggregate.js +49 -0
- package/build/browser/example-function-tests/basicAggregate/basicAggregate.js.map +1 -0
- package/build/browser/example-function-tests/basicFetchPage/basicFetchPage.js +29 -0
- package/build/browser/example-function-tests/basicFetchPage/basicFetchPage.js.map +1 -0
- package/build/browser/example-function-tests/basicQuery/basicQuery.js +27 -0
- package/build/browser/example-function-tests/basicQuery/basicQuery.js.map +1 -0
- package/build/browser/example-function-tests/objectAsInput/objectAsInput.js +26 -0
- package/build/browser/example-function-tests/objectAsInput/objectAsInput.js.map +1 -0
- package/build/browser/example-function-tests/objectSetAsInput/objectSetAsInput.js +29 -0
- package/build/browser/example-function-tests/objectSetAsInput/objectSetAsInput.js.map +1 -0
- package/build/browser/example-function-tests/objectWithLinks/objectWithLinks.js +43 -0
- package/build/browser/example-function-tests/objectWithLinks/objectWithLinks.js.map +1 -0
- package/build/browser/example-function-tests/ontologyEdits/ontologyEdits.js +37 -0
- package/build/browser/example-function-tests/ontologyEdits/ontologyEdits.js.map +1 -0
- package/build/browser/example-function-tests/platformApiWithMsw/platformApiWithMsw.js +25 -0
- package/build/browser/example-function-tests/platformApiWithMsw/platformApiWithMsw.js.map +1 -0
- package/build/browser/example-function-tests/queryWithArrayParams/queryWithArrayParams.js +27 -0
- package/build/browser/example-function-tests/queryWithArrayParams/queryWithArrayParams.js.map +1 -0
- package/build/browser/index.js +21 -0
- package/build/browser/index.js.map +1 -0
- package/build/browser/mock/createMockAttachment.js +31 -0
- package/build/browser/mock/createMockAttachment.js.map +1 -0
- package/build/browser/mock/createMockClient.js +142 -0
- package/build/browser/mock/createMockClient.js.map +1 -0
- package/build/browser/mock/createMockObjectSet.js +36 -0
- package/build/browser/mock/createMockObjectSet.js.map +1 -0
- package/build/browser/mock/createMockObjectSetWithResolver.js +122 -0
- package/build/browser/mock/createMockObjectSetWithResolver.js.map +1 -0
- package/build/browser/mock/createMockOsdkObject.js +235 -0
- package/build/browser/mock/createMockOsdkObject.js.map +1 -0
- package/build/browser/public/experimental.js +21 -0
- package/build/browser/public/experimental.js.map +1 -0
- package/build/cjs/chunk-SEUQK2F4.cjs +445 -0
- package/build/cjs/chunk-SEUQK2F4.cjs.map +1 -0
- package/build/cjs/index.cjs +24 -0
- package/build/cjs/index.cjs.map +1 -0
- package/build/cjs/index.d.cts +99 -0
- package/build/cjs/public/experimental.cjs +24 -0
- package/build/cjs/public/experimental.cjs.map +1 -0
- package/build/cjs/public/experimental.d.cts +3 -0
- package/build/esm/api/MockClient.js +2 -0
- package/build/esm/api/MockClient.js.map +1 -0
- package/build/esm/api/MockOsdkObjectOptions.js +2 -0
- package/build/esm/api/MockOsdkObjectOptions.js.map +1 -0
- package/build/esm/api/StubBuilders.js +2 -0
- package/build/esm/api/StubBuilders.js.map +1 -0
- package/build/esm/api/StubClient.js +2 -0
- package/build/esm/api/StubClient.js.map +1 -0
- package/build/esm/api/index.js +2 -0
- package/build/esm/api/index.js.map +1 -0
- package/build/esm/example-function-tests/basicAggregate/basicAggregate.js +49 -0
- package/build/esm/example-function-tests/basicAggregate/basicAggregate.js.map +1 -0
- package/build/esm/example-function-tests/basicFetchPage/basicFetchPage.js +29 -0
- package/build/esm/example-function-tests/basicFetchPage/basicFetchPage.js.map +1 -0
- package/build/esm/example-function-tests/basicQuery/basicQuery.js +27 -0
- package/build/esm/example-function-tests/basicQuery/basicQuery.js.map +1 -0
- package/build/esm/example-function-tests/objectAsInput/objectAsInput.js +26 -0
- package/build/esm/example-function-tests/objectAsInput/objectAsInput.js.map +1 -0
- package/build/esm/example-function-tests/objectSetAsInput/objectSetAsInput.js +29 -0
- package/build/esm/example-function-tests/objectSetAsInput/objectSetAsInput.js.map +1 -0
- package/build/esm/example-function-tests/objectWithLinks/objectWithLinks.js +43 -0
- package/build/esm/example-function-tests/objectWithLinks/objectWithLinks.js.map +1 -0
- package/build/esm/example-function-tests/ontologyEdits/ontologyEdits.js +37 -0
- package/build/esm/example-function-tests/ontologyEdits/ontologyEdits.js.map +1 -0
- package/build/esm/example-function-tests/platformApiWithMsw/platformApiWithMsw.js +25 -0
- package/build/esm/example-function-tests/platformApiWithMsw/platformApiWithMsw.js.map +1 -0
- package/build/esm/example-function-tests/queryWithArrayParams/queryWithArrayParams.js +27 -0
- package/build/esm/example-function-tests/queryWithArrayParams/queryWithArrayParams.js.map +1 -0
- package/build/esm/index.js +21 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/mock/createMockAttachment.js +31 -0
- package/build/esm/mock/createMockAttachment.js.map +1 -0
- package/build/esm/mock/createMockClient.js +142 -0
- package/build/esm/mock/createMockClient.js.map +1 -0
- package/build/esm/mock/createMockObjectSet.js +36 -0
- package/build/esm/mock/createMockObjectSet.js.map +1 -0
- package/build/esm/mock/createMockObjectSetWithResolver.js +122 -0
- package/build/esm/mock/createMockObjectSetWithResolver.js.map +1 -0
- package/build/esm/mock/createMockOsdkObject.js +235 -0
- package/build/esm/mock/createMockOsdkObject.js.map +1 -0
- package/build/esm/public/experimental.js +21 -0
- package/build/esm/public/experimental.js.map +1 -0
- package/build/types/api/MockClient.d.ts +21 -0
- package/build/types/api/MockClient.d.ts.map +1 -0
- package/build/types/api/MockOsdkObjectOptions.d.ts +14 -0
- package/build/types/api/MockOsdkObjectOptions.d.ts.map +1 -0
- package/build/types/api/StubBuilders.d.ts +28 -0
- package/build/types/api/StubBuilders.d.ts.map +1 -0
- package/build/types/api/StubClient.d.ts +5 -0
- package/build/types/api/StubClient.d.ts.map +1 -0
- package/build/types/api/index.d.ts +4 -0
- package/build/types/api/index.d.ts.map +1 -0
- package/build/types/example-function-tests/basicAggregate/basicAggregate.d.ts +3 -0
- package/build/types/example-function-tests/basicAggregate/basicAggregate.d.ts.map +1 -0
- package/build/types/example-function-tests/basicFetchPage/basicFetchPage.d.ts +4 -0
- package/build/types/example-function-tests/basicFetchPage/basicFetchPage.d.ts.map +1 -0
- package/build/types/example-function-tests/basicQuery/basicQuery.d.ts +3 -0
- package/build/types/example-function-tests/basicQuery/basicQuery.d.ts.map +1 -0
- package/build/types/example-function-tests/objectAsInput/objectAsInput.d.ts +3 -0
- package/build/types/example-function-tests/objectAsInput/objectAsInput.d.ts.map +1 -0
- package/build/types/example-function-tests/objectSetAsInput/objectSetAsInput.d.ts +4 -0
- package/build/types/example-function-tests/objectSetAsInput/objectSetAsInput.d.ts.map +1 -0
- package/build/types/example-function-tests/objectWithLinks/objectWithLinks.d.ts +7 -0
- package/build/types/example-function-tests/objectWithLinks/objectWithLinks.d.ts.map +1 -0
- package/build/types/example-function-tests/ontologyEdits/ontologyEdits.d.ts +7 -0
- package/build/types/example-function-tests/ontologyEdits/ontologyEdits.d.ts.map +1 -0
- package/build/types/example-function-tests/platformApiWithMsw/platformApiWithMsw.d.ts +2 -0
- package/build/types/example-function-tests/platformApiWithMsw/platformApiWithMsw.d.ts.map +1 -0
- package/build/types/example-function-tests/queryWithArrayParams/queryWithArrayParams.d.ts +2 -0
- package/build/types/example-function-tests/queryWithArrayParams/queryWithArrayParams.d.ts.map +1 -0
- package/build/types/index.d.ts +5 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/mock/createMockAttachment.d.ts +2 -0
- package/build/types/mock/createMockAttachment.d.ts.map +1 -0
- package/build/types/mock/createMockClient.d.ts +2 -0
- package/build/types/mock/createMockClient.d.ts.map +1 -0
- package/build/types/mock/createMockObjectSet.d.ts +9 -0
- package/build/types/mock/createMockObjectSet.d.ts.map +1 -0
- package/build/types/mock/createMockObjectSetWithResolver.d.ts +10 -0
- package/build/types/mock/createMockObjectSetWithResolver.d.ts.map +1 -0
- package/build/types/mock/createMockOsdkObject.d.ts +32 -0
- package/build/types/mock/createMockOsdkObject.d.ts.map +1 -0
- package/build/types/public/experimental.d.ts +5 -0
- package/build/types/public/experimental.d.ts.map +1 -0
- package/experimental.d.ts +17 -0
- package/package.json +92 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkSEUQK2F4_cjs = require('../chunk-SEUQK2F4.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "createMockAttachment", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkSEUQK2F4_cjs.createMockAttachment; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "createMockClient", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkSEUQK2F4_cjs.createMockClient; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "createMockObjectSet", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkSEUQK2F4_cjs.createMockObjectSet; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "createMockOsdkObject", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkSEUQK2F4_cjs.createMockOsdkObject; }
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=experimental.cjs.map
|
|
24
|
+
//# sourceMappingURL=experimental.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"experimental.cjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockClient.js","names":[],"sources":["MockClient.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n CompileTimeMetadata,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n QueryDefinition,\n} from \"@osdk/api\";\nimport type { Client } from \"@osdk/client\";\nimport type { QueryStubBuilder, StubBuilderFor } from \"./StubBuilders.js\";\nimport type { StubClient } from \"./StubClient.js\";\n\ntype QueryReturnTypeFromDef<Q extends QueryDefinition> = ReturnType<\n CompileTimeMetadata<Q>[\"signature\"]\n> extends Promise<infer R> ? R : never;\n\ntype QueryParamsFromDef<Q extends QueryDefinition> =\n Parameters<CompileTimeMetadata<Q>[\"signature\"]> extends [infer P] ? P\n : undefined;\n\nexport type StubPatternCallback<T> = (client: StubClient) => T;\n\nexport type ObjectSetStubCallback<Q extends ObjectOrInterfaceDefinition, T> = (\n os: ObjectSet<Q>,\n) => T;\n\nexport interface MockClient extends Client {\n when<T>(callback: StubPatternCallback<T>): StubBuilderFor<T>;\n whenObjectSet<Q extends ObjectOrInterfaceDefinition, T>(\n objectSet: ObjectSet<Q>,\n callback: ObjectSetStubCallback<Q, T>,\n ): StubBuilderFor<T>;\n whenQuery<Q extends QueryDefinition>(\n query: Q,\n params?: QueryParamsFromDef<Q>,\n ): QueryStubBuilder<QueryReturnTypeFromDef<Q>>;\n clearStubs(): void;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockOsdkObjectOptions.js","names":[],"sources":["MockOsdkObjectOptions.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n CompileTimeMetadata,\n LinkedType,\n LinkNames,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n} from \"@osdk/api\";\n\ntype LinkStubs<Q extends ObjectTypeDefinition> = {\n [LINK_NAME in LinkNames<Q>]?:\n CompileTimeMetadata<Q>[\"links\"][LINK_NAME][\"multiplicity\"] extends true ?\n | Array<Osdk.Instance<LinkedType<Q, LINK_NAME>>>\n | ObjectSet<LinkedType<Q, LINK_NAME>>\n : Osdk.Instance<LinkedType<Q, LINK_NAME>> | Error;\n};\n\n/**\n * Options for customizing mock object creation.\n */\nexport interface MockOsdkObjectOptions<\n Q extends ObjectTypeDefinition = ObjectTypeDefinition,\n> {\n /** Objects linked to this object by API name */\n links?: LinkStubs<Q>;\n /** The API name of the title property (optional, required for $title) */\n titlePropertyApiName?: string;\n /** Override the generated $rid */\n $rid?: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StubBuilders.js","names":[],"sources":["StubBuilders.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { PageResult } from \"@osdk/api\";\n\nexport interface FetchPageStubBuilder<T> {\n thenReturnObjects(objects: T[]): void;\n}\n\nexport interface FetchOneStubBuilder<T> {\n thenReturnObject(object: T): void;\n}\n\nexport interface AggregateStubBuilder<T> {\n thenReturnAggregation(result: T): void;\n}\n\nexport interface QueryStubBuilder<T> {\n thenReturn(result: T): void;\n thenThrow(error: Error): void;\n}\n\ntype IsOsdkObject<T> = T extends { $apiName: string } ? true : false;\n\nexport type StubBuilderFor<T> = T extends Promise<infer R> ? StubBuilderFor<R>\n : T extends AsyncIterableIterator<infer U> ? FetchPageStubBuilder<U>\n : T extends PageResult<infer U> ? FetchPageStubBuilder<U>\n : T extends { value: PageResult<infer U>; error?: never }\n ? FetchPageStubBuilder<U>\n : T extends { value: infer U; error?: never }\n ? (IsOsdkObject<U> extends true ? FetchOneStubBuilder<U>\n : AggregateStubBuilder<U>)\n : T extends { error: Error; value?: never } ? never\n : IsOsdkObject<T> extends true ? FetchOneStubBuilder<T>\n : AggregateStubBuilder<T>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StubClient.js","names":[],"sources":["StubClient.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n InterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n} from \"@osdk/api\";\n\nexport type StubClient = {\n <Q extends ObjectTypeDefinition>(o: Q): ObjectSet<Q>;\n <Q extends InterfaceDefinition>(o: Q): ObjectSet<Q>;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type { MockClient } from \"./MockClient.js\";\nexport type { MockOsdkObjectOptions } from \"./MockOsdkObjectOptions.js\";\nexport type {\n AggregateStubBuilder,\n FetchOneStubBuilder,\n FetchPageStubBuilder,\n QueryStubBuilder,\n StubBuilderFor,\n} from \"./StubBuilders.js\";\nexport type { StubClient } from \"./StubClient.js\";\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { Employee } from "@osdk/client.test.ontology";
|
|
18
|
+
export async function basicAggregate(client) {
|
|
19
|
+
const aggregation = await client(Employee).where({
|
|
20
|
+
employeeId: {
|
|
21
|
+
"$eq": 5
|
|
22
|
+
}
|
|
23
|
+
}).aggregate({
|
|
24
|
+
$select: {
|
|
25
|
+
"employeeLocation:exactDistinct": "asc"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
if (aggregation.employeeLocation.exactDistinct !== 3) {
|
|
29
|
+
throw new Error(`Unexpected aggregation result: ${JSON.stringify(aggregation)}`);
|
|
30
|
+
}
|
|
31
|
+
const aggregation2 = await client(Employee).where({
|
|
32
|
+
employeeId: {
|
|
33
|
+
"$eq": 5
|
|
34
|
+
}
|
|
35
|
+
}).aggregate({
|
|
36
|
+
$select: {
|
|
37
|
+
"employeeId:max": "unordered",
|
|
38
|
+
"fullName:approximateDistinct": "unordered"
|
|
39
|
+
},
|
|
40
|
+
$groupBy: {
|
|
41
|
+
employeeId: "exact"
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
if (aggregation2[0].$group.employeeId !== 5 || aggregation2[0].employeeId.max !== 5 || aggregation2[0].fullName.approximateDistinct !== 1) {
|
|
45
|
+
throw new Error(`Unexpected aggregation result: ${JSON.stringify(aggregation2)}`);
|
|
46
|
+
}
|
|
47
|
+
return 1;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=basicAggregate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basicAggregate.js","names":["Employee","basicAggregate","client","aggregation","where","employeeId","aggregate","$select","employeeLocation","exactDistinct","Error","JSON","stringify","aggregation2","$groupBy","$group","max","fullName","approximateDistinct"],"sources":["basicAggregate.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Client } from \"@osdk/client\";\nimport { Employee } from \"@osdk/client.test.ontology\";\nimport type { Integer } from \"@osdk/functions\";\n\nexport async function basicAggregate(\n client: Client,\n): Promise<Integer> {\n const aggregation = await client(Employee).where({ employeeId: { \"$eq\": 5 } })\n .aggregate({ $select: { \"employeeLocation:exactDistinct\": \"asc\" } });\n if (aggregation.employeeLocation.exactDistinct !== 3) {\n throw new Error(\n `Unexpected aggregation result: ${JSON.stringify(aggregation)}`,\n );\n }\n\n const aggregation2 = await client(Employee).where({\n employeeId: { \"$eq\": 5 },\n })\n .aggregate({\n $select: {\n \"employeeId:max\": \"unordered\",\n \"fullName:approximateDistinct\": \"unordered\",\n },\n $groupBy: { employeeId: \"exact\" },\n });\n\n if (\n aggregation2[0].$group.employeeId !== 5\n || aggregation2[0].employeeId.max !== 5\n || aggregation2[0].fullName.approximateDistinct !== 1\n ) {\n throw new Error(\n `Unexpected aggregation result: ${JSON.stringify(aggregation2)}`,\n );\n }\n\n return 1;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,QAAQ,QAAQ,4BAA4B;AAGrD,OAAO,eAAeC,cAAcA,CAClCC,MAAc,EACI;EAClB,MAAMC,WAAW,GAAG,MAAMD,MAAM,CAACF,QAAQ,CAAC,CAACI,KAAK,CAAC;IAAEC,UAAU,EAAE;MAAE,KAAK,EAAE;IAAE;EAAE,CAAC,CAAC,CAC3EC,SAAS,CAAC;IAAEC,OAAO,EAAE;MAAE,gCAAgC,EAAE;IAAM;EAAE,CAAC,CAAC;EACtE,IAAIJ,WAAW,CAACK,gBAAgB,CAACC,aAAa,KAAK,CAAC,EAAE;IACpD,MAAM,IAAIC,KAAK,CACb,kCAAkCC,IAAI,CAACC,SAAS,CAACT,WAAW,CAAC,EAC/D,CAAC;EACH;EAEA,MAAMU,YAAY,GAAG,MAAMX,MAAM,CAACF,QAAQ,CAAC,CAACI,KAAK,CAAC;IAChDC,UAAU,EAAE;MAAE,KAAK,EAAE;IAAE;EACzB,CAAC,CAAC,CACCC,SAAS,CAAC;IACTC,OAAO,EAAE;MACP,gBAAgB,EAAE,WAAW;MAC7B,8BAA8B,EAAE;IAClC,CAAC;IACDO,QAAQ,EAAE;MAAET,UAAU,EAAE;IAAQ;EAClC,CAAC,CAAC;EAEJ,IACEQ,YAAY,CAAC,CAAC,CAAC,CAACE,MAAM,CAACV,UAAU,KAAK,CAAC,IACpCQ,YAAY,CAAC,CAAC,CAAC,CAACR,UAAU,CAACW,GAAG,KAAK,CAAC,IACpCH,YAAY,CAAC,CAAC,CAAC,CAACI,QAAQ,CAACC,mBAAmB,KAAK,CAAC,EACrD;IACA,MAAM,IAAIR,KAAK,CACb,kCAAkCC,IAAI,CAACC,SAAS,CAACC,YAAY,CAAC,EAChE,CAAC;EACH;EAEA,OAAO,CAAC;AACV","ignoreList":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { Employee } from "@osdk/client.test.ontology";
|
|
18
|
+
export async function basicFetchPage(client) {
|
|
19
|
+
const objects = await client(Employee).fetchPage();
|
|
20
|
+
const object = objects.data[0];
|
|
21
|
+
if (object == null) {
|
|
22
|
+
throw new Error("No objects returned");
|
|
23
|
+
}
|
|
24
|
+
if (object.employeeId !== 1 || object.fullName !== "John") {
|
|
25
|
+
throw new Error(`Unexpected object returned: ${JSON.stringify(object)}`);
|
|
26
|
+
}
|
|
27
|
+
return object;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=basicFetchPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basicFetchPage.js","names":["Employee","basicFetchPage","client","objects","fetchPage","object","data","Error","employeeId","fullName","JSON","stringify"],"sources":["basicFetchPage.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Osdk } from \"@osdk/api\";\nimport type { Client } from \"@osdk/client\";\nimport { Employee } from \"@osdk/client.test.ontology\";\n\nexport async function basicFetchPage(\n client: Client,\n): Promise<Osdk.Instance<Employee>> {\n const objects = await client(Employee).fetchPage();\n const object = objects.data[0];\n if (object == null) {\n throw new Error(\"No objects returned\");\n }\n if (object.employeeId !== 1 || object.fullName !== \"John\") {\n throw new Error(`Unexpected object returned: ${JSON.stringify(object)}`);\n }\n return object;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,QAAQ,QAAQ,4BAA4B;AAErD,OAAO,eAAeC,cAAcA,CAClCC,MAAc,EACoB;EAClC,MAAMC,OAAO,GAAG,MAAMD,MAAM,CAACF,QAAQ,CAAC,CAACI,SAAS,CAAC,CAAC;EAClD,MAAMC,MAAM,GAAGF,OAAO,CAACG,IAAI,CAAC,CAAC,CAAC;EAC9B,IAAID,MAAM,IAAI,IAAI,EAAE;IAClB,MAAM,IAAIE,KAAK,CAAC,qBAAqB,CAAC;EACxC;EACA,IAAIF,MAAM,CAACG,UAAU,KAAK,CAAC,IAAIH,MAAM,CAACI,QAAQ,KAAK,MAAM,EAAE;IACzD,MAAM,IAAIF,KAAK,CAAC,+BAA+BG,IAAI,CAACC,SAAS,CAACN,MAAM,CAAC,EAAE,CAAC;EAC1E;EACA,OAAOA,MAAM;AACf","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { addOne } from "@osdk/client.test.ontology";
|
|
18
|
+
export async function basicQuery(client, n) {
|
|
19
|
+
const result = await client(addOne).executeFunction({
|
|
20
|
+
n
|
|
21
|
+
});
|
|
22
|
+
if (result !== n + 1) {
|
|
23
|
+
throw new Error(`Expected ${n + 1}, but got ${result}`);
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=basicQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basicQuery.js","names":["addOne","basicQuery","client","n","result","executeFunction","Error"],"sources":["basicQuery.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Client } from \"@osdk/client\";\nimport { addOne } from \"@osdk/client.test.ontology\";\nimport type { Integer } from \"@osdk/functions\";\n\nexport async function basicQuery(\n client: Client,\n n: Integer,\n): Promise<Integer> {\n const result = await client(addOne).executeFunction({ n });\n if (result !== n + 1) {\n throw new Error(`Expected ${n + 1}, but got ${result}`);\n }\n return result;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,MAAM,QAAQ,4BAA4B;AAGnD,OAAO,eAAeC,UAAUA,CAC9BC,MAAc,EACdC,CAAU,EACQ;EAClB,MAAMC,MAAM,GAAG,MAAMF,MAAM,CAACF,MAAM,CAAC,CAACK,eAAe,CAAC;IAAEF;EAAE,CAAC,CAAC;EAC1D,IAAIC,MAAM,KAAKD,CAAC,GAAG,CAAC,EAAE;IACpB,MAAM,IAAIG,KAAK,CAAC,YAAYH,CAAC,GAAG,CAAC,aAAaC,MAAM,EAAE,CAAC;EACzD;EACA,OAAOA,MAAM;AACf","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export function objectAsInput(object) {
|
|
18
|
+
if (object.$apiName !== "Employee") {
|
|
19
|
+
throw new Error(`Expected object of type Employee, but got ${object.$apiName}`);
|
|
20
|
+
}
|
|
21
|
+
if (object.employeeId == null) {
|
|
22
|
+
throw new Error(`Expected object to have employeeId property, but it was missing`);
|
|
23
|
+
}
|
|
24
|
+
return object;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=objectAsInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectAsInput.js","names":["objectAsInput","object","$apiName","Error","employeeId"],"sources":["objectAsInput.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Osdk } from \"@osdk/api\";\nimport type { Employee } from \"@osdk/client.test.ontology\";\n\nexport function objectAsInput(\n object: Osdk.Instance<Employee>,\n): Osdk.Instance<Employee> {\n if (object.$apiName !== \"Employee\") {\n throw new Error(\n `Expected object of type Employee, but got ${object.$apiName}`,\n );\n }\n if (object.employeeId == null) {\n throw new Error(\n `Expected object to have employeeId property, but it was missing`,\n );\n }\n return object;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,OAAO,SAASA,aAAaA,CAC3BC,MAA+B,EACN;EACzB,IAAIA,MAAM,CAACC,QAAQ,KAAK,UAAU,EAAE;IAClC,MAAM,IAAIC,KAAK,CACb,6CAA6CF,MAAM,CAACC,QAAQ,EAC9D,CAAC;EACH;EACA,IAAID,MAAM,CAACG,UAAU,IAAI,IAAI,EAAE;IAC7B,MAAM,IAAID,KAAK,CACb,iEACF,CAAC;EACH;EACA,OAAOF,MAAM;AACf","ignoreList":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export async function getEmployeeNames(employees) {
|
|
18
|
+
const page = await employees.fetchPage();
|
|
19
|
+
return page.data.map(emp => emp.fullName ?? "Unknown");
|
|
20
|
+
}
|
|
21
|
+
export async function countEmployees(employees) {
|
|
22
|
+
const result = await employees.aggregate({
|
|
23
|
+
$select: {
|
|
24
|
+
$count: "unordered"
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return result.$count;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=objectSetAsInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectSetAsInput.js","names":["getEmployeeNames","employees","page","fetchPage","data","map","emp","fullName","countEmployees","result","aggregate","$select","$count"],"sources":["objectSetAsInput.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectSet } from \"@osdk/api\";\nimport type { Employee } from \"@osdk/client.test.ontology\";\n\nexport async function getEmployeeNames(\n employees: ObjectSet<Employee>,\n): Promise<string[]> {\n const page = await employees.fetchPage();\n return page.data.map((emp) => emp.fullName ?? \"Unknown\");\n}\n\nexport async function countEmployees(\n employees: ObjectSet<Employee>,\n): Promise<number> {\n const result = await employees.aggregate({\n $select: { $count: \"unordered\" },\n });\n return result.$count;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,OAAO,eAAeA,gBAAgBA,CACpCC,SAA8B,EACX;EACnB,MAAMC,IAAI,GAAG,MAAMD,SAAS,CAACE,SAAS,CAAC,CAAC;EACxC,OAAOD,IAAI,CAACE,IAAI,CAACC,GAAG,CAAEC,GAAG,IAAKA,GAAG,CAACC,QAAQ,IAAI,SAAS,CAAC;AAC1D;AAEA,OAAO,eAAeC,cAAcA,CAClCP,SAA8B,EACb;EACjB,MAAMQ,MAAM,GAAG,MAAMR,SAAS,CAACS,SAAS,CAAC;IACvCC,OAAO,EAAE;MAAEC,MAAM,EAAE;IAAY;EACjC,CAAC,CAAC;EACF,OAAOH,MAAM,CAACG,MAAM;AACtB","ignoreList":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export async function getEmployeeOfficeName(employee) {
|
|
18
|
+
const office = await employee.$link.officeLink.fetchOne();
|
|
19
|
+
return office.name;
|
|
20
|
+
}
|
|
21
|
+
export async function getEmployeePeepNames(employee) {
|
|
22
|
+
const page = await employee.$link.peeps.fetchPage();
|
|
23
|
+
return page.data.map(peep => peep.fullName ?? "Unknown");
|
|
24
|
+
}
|
|
25
|
+
export async function countEmployeePeeps(employee) {
|
|
26
|
+
let count = 0;
|
|
27
|
+
for await (const _peep of employee.$link.peeps.asyncIter()) {
|
|
28
|
+
count++;
|
|
29
|
+
}
|
|
30
|
+
return count;
|
|
31
|
+
}
|
|
32
|
+
export async function getSpecificPeep(employee, peepId) {
|
|
33
|
+
return employee.$link.peeps.fetchOne(peepId);
|
|
34
|
+
}
|
|
35
|
+
export async function countPeepsViaAggregate(employee) {
|
|
36
|
+
const result = await employee.$link.peeps.aggregate({
|
|
37
|
+
$select: {
|
|
38
|
+
$count: "unordered"
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return result.$count;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=objectWithLinks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectWithLinks.js","names":["getEmployeeOfficeName","employee","office","$link","officeLink","fetchOne","name","getEmployeePeepNames","page","peeps","fetchPage","data","map","peep","fullName","countEmployeePeeps","count","_peep","asyncIter","getSpecificPeep","peepId","countPeepsViaAggregate","result","aggregate","$select","$count"],"sources":["objectWithLinks.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Osdk } from \"@osdk/api\";\nimport type { Employee } from \"@osdk/client.test.ontology\";\n\nexport async function getEmployeeOfficeName(\n employee: Osdk.Instance<Employee>,\n): Promise<string | undefined> {\n const office = await employee.$link.officeLink.fetchOne();\n return office.name;\n}\n\nexport async function getEmployeePeepNames(\n employee: Osdk.Instance<Employee>,\n): Promise<string[]> {\n const page = await employee.$link.peeps.fetchPage();\n return page.data.map((peep) => peep.fullName ?? \"Unknown\");\n}\n\nexport async function countEmployeePeeps(\n employee: Osdk.Instance<Employee>,\n): Promise<number> {\n let count = 0;\n for await (const _peep of employee.$link.peeps.asyncIter()) {\n count++;\n }\n return count;\n}\n\nexport async function getSpecificPeep(\n employee: Osdk.Instance<Employee>,\n peepId: number,\n): Promise<Osdk.Instance<Employee>> {\n return employee.$link.peeps.fetchOne(peepId);\n}\n\nexport async function countPeepsViaAggregate(\n employee: Osdk.Instance<Employee>,\n): Promise<number> {\n const result = await employee.$link.peeps.aggregate({\n $select: { $count: \"unordered\" },\n });\n return result.$count;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,OAAO,eAAeA,qBAAqBA,CACzCC,QAAiC,EACJ;EAC7B,MAAMC,MAAM,GAAG,MAAMD,QAAQ,CAACE,KAAK,CAACC,UAAU,CAACC,QAAQ,CAAC,CAAC;EACzD,OAAOH,MAAM,CAACI,IAAI;AACpB;AAEA,OAAO,eAAeC,oBAAoBA,CACxCN,QAAiC,EACd;EACnB,MAAMO,IAAI,GAAG,MAAMP,QAAQ,CAACE,KAAK,CAACM,KAAK,CAACC,SAAS,CAAC,CAAC;EACnD,OAAOF,IAAI,CAACG,IAAI,CAACC,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACC,QAAQ,IAAI,SAAS,CAAC;AAC5D;AAEA,OAAO,eAAeC,kBAAkBA,CACtCd,QAAiC,EAChB;EACjB,IAAIe,KAAK,GAAG,CAAC;EACb,WAAW,MAAMC,KAAK,IAAIhB,QAAQ,CAACE,KAAK,CAACM,KAAK,CAACS,SAAS,CAAC,CAAC,EAAE;IAC1DF,KAAK,EAAE;EACT;EACA,OAAOA,KAAK;AACd;AAEA,OAAO,eAAeG,eAAeA,CACnClB,QAAiC,EACjCmB,MAAc,EACoB;EAClC,OAAOnB,QAAQ,CAACE,KAAK,CAACM,KAAK,CAACJ,QAAQ,CAACe,MAAM,CAAC;AAC9C;AAEA,OAAO,eAAeC,sBAAsBA,CAC1CpB,QAAiC,EAChB;EACjB,MAAMqB,MAAM,GAAG,MAAMrB,QAAQ,CAACE,KAAK,CAACM,KAAK,CAACc,SAAS,CAAC;IAClDC,OAAO,EAAE;MAAEC,MAAM,EAAE;IAAY;EACjC,CAAC,CAAC;EACF,OAAOH,MAAM,CAACG,MAAM;AACtB","ignoreList":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { Employee, FooInterface } from "@osdk/client.test.ontology";
|
|
18
|
+
import { createEditBatch } from "@osdk/functions";
|
|
19
|
+
export function ontologyEdits(client, object) {
|
|
20
|
+
const editBatch = createEditBatch(client);
|
|
21
|
+
editBatch.create(Employee, {
|
|
22
|
+
employeeId: 1,
|
|
23
|
+
fullName: "John Doe"
|
|
24
|
+
});
|
|
25
|
+
editBatch.update(object, {
|
|
26
|
+
favoriteRestaurants: ["McDonald's"]
|
|
27
|
+
});
|
|
28
|
+
editBatch.delete(object);
|
|
29
|
+
editBatch.link(object, "peeps", object);
|
|
30
|
+
editBatch.unlink(object, "peeps", object);
|
|
31
|
+
editBatch.create(FooInterface, {
|
|
32
|
+
$objectType: "Employee",
|
|
33
|
+
fooIdp: "bar"
|
|
34
|
+
});
|
|
35
|
+
return editBatch.getEdits();
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=ontologyEdits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ontologyEdits.js","names":["Employee","FooInterface","createEditBatch","ontologyEdits","client","object","editBatch","create","employeeId","fullName","update","favoriteRestaurants","delete","link","unlink","$objectType","fooIdp","getEdits"],"sources":["ontologyEdits.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Client, Osdk } from \"@osdk/client\";\nimport type { $Interfaces } from \"@osdk/client.test.ontology\";\nimport { Employee, FooInterface } from \"@osdk/client.test.ontology\";\nimport { createEditBatch, type Edits } from \"@osdk/functions\";\n\ntype edits =\n | Edits.Object<Employee>\n | Edits.Link<Employee, \"peeps\">\n | Edits.Interface<$Interfaces.FooInterface>;\nexport function ontologyEdits(\n client: Client,\n object: Osdk.Instance<Employee>,\n): edits[] {\n const editBatch = createEditBatch<edits>(client);\n editBatch.create(Employee, { employeeId: 1, fullName: \"John Doe\" });\n\n editBatch.update(object, { favoriteRestaurants: [\"McDonald's\"] });\n\n editBatch.delete(object);\n\n editBatch.link(object, \"peeps\", object);\n editBatch.unlink(object, \"peeps\", object);\n\n editBatch.create(FooInterface, { $objectType: \"Employee\", fooIdp: \"bar\" });\n return editBatch.getEdits();\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,QAAQ,EAAEC,YAAY,QAAQ,4BAA4B;AACnE,SAASC,eAAe,QAAoB,iBAAiB;AAM7D,OAAO,SAASC,aAAaA,CAC3BC,MAAc,EACdC,MAA+B,EACtB;EACT,MAAMC,SAAS,GAAGJ,eAAe,CAAQE,MAAM,CAAC;EAChDE,SAAS,CAACC,MAAM,CAACP,QAAQ,EAAE;IAAEQ,UAAU,EAAE,CAAC;IAAEC,QAAQ,EAAE;EAAW,CAAC,CAAC;EAEnEH,SAAS,CAACI,MAAM,CAACL,MAAM,EAAE;IAAEM,mBAAmB,EAAE,CAAC,YAAY;EAAE,CAAC,CAAC;EAEjEL,SAAS,CAACM,MAAM,CAACP,MAAM,CAAC;EAExBC,SAAS,CAACO,IAAI,CAACR,MAAM,EAAE,OAAO,EAAEA,MAAM,CAAC;EACvCC,SAAS,CAACQ,MAAM,CAACT,MAAM,EAAE,OAAO,EAAEA,MAAM,CAAC;EAEzCC,SAAS,CAACC,MAAM,CAACN,YAAY,EAAE;IAAEc,WAAW,EAAE,UAAU;IAAEC,MAAM,EAAE;EAAM,CAAC,CAAC;EAC1E,OAAOV,SAAS,CAACW,QAAQ,CAAC,CAAC;AAC7B","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { Users } from "@osdk/foundry.admin";
|
|
18
|
+
export async function requireAdminUser(client) {
|
|
19
|
+
const user = await Users.getCurrent(client);
|
|
20
|
+
if (!user.username.endsWith("@admin")) {
|
|
21
|
+
throw new Error(`User ${user.username} is not an admin`);
|
|
22
|
+
}
|
|
23
|
+
return user.username;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=platformApiWithMsw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platformApiWithMsw.js","names":["Users","requireAdminUser","client","user","getCurrent","username","endsWith","Error"],"sources":["platformApiWithMsw.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Client } from \"@osdk/client\";\nimport { Users } from \"@osdk/foundry.admin\";\n\nexport async function requireAdminUser(\n client: Client,\n): Promise<string> {\n const user = await Users.getCurrent(client);\n if (!user.username.endsWith(\"@admin\")) {\n throw new Error(`User ${user.username} is not an admin`);\n }\n return user.username;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,KAAK,QAAQ,qBAAqB;AAE3C,OAAO,eAAeC,gBAAgBA,CACpCC,MAAc,EACG;EACjB,MAAMC,IAAI,GAAG,MAAMH,KAAK,CAACI,UAAU,CAACF,MAAM,CAAC;EAC3C,IAAI,CAACC,IAAI,CAACE,QAAQ,CAACC,QAAQ,CAAC,QAAQ,CAAC,EAAE;IACrC,MAAM,IAAIC,KAAK,CAAC,QAAQJ,IAAI,CAACE,QAAQ,kBAAkB,CAAC;EAC1D;EACA,OAAOF,IAAI,CAACE,QAAQ;AACtB","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { queryTypeReturnsArray } from "@osdk/client.test.ontology";
|
|
18
|
+
export async function queryWithArrayParams(client, people) {
|
|
19
|
+
const result = await client(queryTypeReturnsArray).executeFunction({
|
|
20
|
+
people
|
|
21
|
+
});
|
|
22
|
+
if (!Array.isArray(result)) {
|
|
23
|
+
throw new Error("Expected array result");
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=queryWithArrayParams.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryWithArrayParams.js","names":["queryTypeReturnsArray","queryWithArrayParams","client","people","result","executeFunction","Array","isArray","Error"],"sources":["queryWithArrayParams.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Client } from \"@osdk/client\";\nimport { queryTypeReturnsArray } from \"@osdk/client.test.ontology\";\n\nexport async function queryWithArrayParams(\n client: Client,\n people: readonly string[],\n): Promise<string[]> {\n const result = await client(queryTypeReturnsArray).executeFunction({\n people,\n });\n\n if (!Array.isArray(result)) {\n throw new Error(\"Expected array result\");\n }\n\n return result;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,qBAAqB,QAAQ,4BAA4B;AAElE,OAAO,eAAeC,oBAAoBA,CACxCC,MAAc,EACdC,MAAyB,EACN;EACnB,MAAMC,MAAM,GAAG,MAAMF,MAAM,CAACF,qBAAqB,CAAC,CAACK,eAAe,CAAC;IACjEF;EACF,CAAC,CAAC;EAEF,IAAI,CAACG,KAAK,CAACC,OAAO,CAACH,MAAM,CAAC,EAAE;IAC1B,MAAM,IAAII,KAAK,CAAC,uBAAuB,CAAC;EAC1C;EAEA,OAAOJ,MAAM;AACf","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export { createMockAttachment } from "./mock/createMockAttachment.js";
|
|
18
|
+
export { createMockClient } from "./mock/createMockClient.js";
|
|
19
|
+
export { createMockObjectSet } from "./mock/createMockObjectSet.js";
|
|
20
|
+
export { createMockOsdkObject } from "./mock/createMockOsdkObject.js";
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["createMockAttachment","createMockClient","createMockObjectSet","createMockOsdkObject"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type {\n AggregateStubBuilder,\n FetchOneStubBuilder,\n FetchPageStubBuilder,\n MockClient,\n MockOsdkObjectOptions,\n QueryStubBuilder,\n StubBuilderFor,\n StubClient,\n} from \"./api/index.js\";\n\nexport { createMockAttachment } from \"./mock/createMockAttachment.js\";\nexport { createMockClient } from \"./mock/createMockClient.js\";\nexport { createMockObjectSet } from \"./mock/createMockObjectSet.js\";\nexport { createMockOsdkObject } from \"./mock/createMockOsdkObject.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,SAASA,oBAAoB,QAAQ,gCAAgC;AACrE,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,mBAAmB,QAAQ,+BAA+B;AACnE,SAASC,oBAAoB,QAAQ,gCAAgC","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import invariant from "tiny-invariant";
|
|
18
|
+
export function createMockAttachment(rid, blob, metadata) {
|
|
19
|
+
return {
|
|
20
|
+
rid,
|
|
21
|
+
fetchContents() {
|
|
22
|
+
!(blob != null) ? process.env.NODE_ENV !== "production" ? invariant(false, `fetchContents was called on mock attachment "${rid}" but no blob was provided. ` + `Pass a Blob as the second argument to createMockAttachment to stub fetchContents.`) : invariant(false) : void 0;
|
|
23
|
+
return Promise.resolve(new Response(blob));
|
|
24
|
+
},
|
|
25
|
+
fetchMetadata() {
|
|
26
|
+
!(metadata != null) ? process.env.NODE_ENV !== "production" ? invariant(false, `fetchMetadata was called on mock attachment "${rid}" but no metadata was provided. ` + `Pass AttachmentMetadata as the third argument to createMockAttachment to stub fetchMetadata.`) : invariant(false) : void 0;
|
|
27
|
+
return Promise.resolve(metadata);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=createMockAttachment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMockAttachment.js","names":["invariant","createMockAttachment","rid","blob","metadata","fetchContents","process","env","NODE_ENV","Promise","resolve","Response","fetchMetadata"],"sources":["createMockAttachment.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Attachment, AttachmentMetadata } from \"@osdk/api\";\nimport invariant from \"tiny-invariant\";\n\nexport function createMockAttachment(\n rid: string,\n blob?: Blob,\n metadata?: AttachmentMetadata,\n): Attachment {\n return {\n rid,\n fetchContents() {\n invariant(\n blob != null,\n `fetchContents was called on mock attachment \"${rid}\" but no blob was provided. `\n + `Pass a Blob as the second argument to createMockAttachment to stub fetchContents.`,\n );\n return Promise.resolve(new Response(blob));\n },\n fetchMetadata() {\n invariant(\n metadata != null,\n `fetchMetadata was called on mock attachment \"${rid}\" but no metadata was provided. `\n + `Pass AttachmentMetadata as the third argument to createMockAttachment to stub fetchMetadata.`,\n );\n return Promise.resolve(metadata);\n },\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,SAAS,MAAM,gBAAgB;AAEtC,OAAO,SAASC,oBAAoBA,CAClCC,GAAW,EACXC,IAAW,EACXC,QAA6B,EACjB;EACZ,OAAO;IACLF,GAAG;IACHG,aAAaA,CAAA,EAAG;MACd,EACEF,IAAI,IAAI,IAAI,IAAAG,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBADdR,SAAS,QAEP,gDAAgDE,GAAG,8BAA8B,GAC7E,mFAAmF,IAHzFF,SAAS;MAKT,OAAOS,OAAO,CAACC,OAAO,CAAC,IAAIC,QAAQ,CAACR,IAAI,CAAC,CAAC;IAC5C,CAAC;IACDS,aAAaA,CAAA,EAAG;MACd,EACER,QAAQ,IAAI,IAAI,IAAAE,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBADlBR,SAAS,QAEP,gDAAgDE,GAAG,kCAAkC,GACjF,8FAA8F,IAHpGF,SAAS;MAKT,OAAOS,OAAO,CAACC,OAAO,CAACN,QAAQ,CAAC;IAClC;EACF,CAAC;AACH","ignoreList":[]}
|