@osdk/client 2.4.0-beta.9 → 2.5.0-beta.1
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 +91 -0
- package/build/browser/MinimalClientContext.js.map +1 -1
- package/build/browser/createClient.js +5 -5
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/createClient.test.js +3 -3
- package/build/browser/createClient.test.js.map +1 -1
- package/build/browser/createMinimalClient.js +1 -0
- package/build/browser/createMinimalClient.js.map +1 -1
- package/build/browser/fetchMetadata.test.js +7 -1
- package/build/browser/fetchMetadata.test.js.map +1 -1
- package/build/browser/index.js +1 -0
- package/build/browser/index.js.map +1 -1
- package/build/browser/object/aggregate.test.js +30 -0
- package/build/browser/object/aggregate.test.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.js +3 -2
- package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js +36 -24
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/browser/object/fetchPage.js +9 -2
- package/build/browser/object/fetchPage.js.map +1 -1
- package/build/browser/objectSet/InterfaceObjectSet.test.js +5 -1
- package/build/browser/objectSet/InterfaceObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/createObjectSet.js +5 -1
- package/build/browser/objectSet/createObjectSet.js.map +1 -1
- package/build/browser/observable/internal/ActionApplication.js +1 -1
- package/build/browser/observable/internal/ActionApplication.js.map +1 -1
- package/build/browser/observable/internal/Store.test.js +3 -0
- package/build/browser/observable/internal/Store.test.js.map +1 -1
- package/build/browser/ontology/StandardOntologyProvider.test.js +1 -1
- package/build/browser/ontology/StandardOntologyProvider.test.js.map +1 -1
- package/build/browser/public/unstable-do-not-use.js +1 -0
- package/build/browser/public/unstable-do-not-use.js.map +1 -1
- package/build/browser/public-utils/hydrateObjectSetFromObjectRids.js +4 -1
- package/build/browser/public-utils/hydrateObjectSetFromObjectRids.js.map +1 -1
- package/build/browser/public-utils/hydrateObjectSetFromRid.js +4 -1
- package/build/browser/public-utils/hydrateObjectSetFromRid.js.map +1 -1
- package/build/browser/queries/applyQuery.js +24 -1
- package/build/browser/queries/applyQuery.js.map +1 -1
- package/build/browser/queries/queries.test.js +27 -2
- package/build/browser/queries/queries.test.js.map +1 -1
- package/build/browser/queries/types.js.map +1 -1
- package/build/browser/util/UserAgent.js +2 -2
- package/build/browser/util/WireObjectSet.js +1 -1
- package/build/browser/util/WireObjectSet.js.map +1 -1
- package/build/browser/util/extractObjectOrInterfaceType.js +96 -0
- package/build/browser/util/extractObjectOrInterfaceType.js.map +1 -0
- package/build/browser/util/extractObjectOrInterfaceType.test.js +135 -0
- package/build/browser/util/extractObjectOrInterfaceType.test.js.map +1 -0
- package/build/browser/util/interfaceUtils.js +10 -0
- package/build/browser/util/interfaceUtils.js.map +1 -1
- package/build/browser/util/objectSpecifierUtils.js +12 -0
- package/build/browser/util/objectSpecifierUtils.js.map +1 -1
- package/build/browser/util/toDataValueQueries.js +11 -0
- package/build/browser/util/toDataValueQueries.js.map +1 -1
- package/build/cjs/{Client-CgL2LKN9.d.cts → Client-CF85LpFu.d.cts} +2 -2
- package/build/cjs/{chunk-E5BQ7757.cjs → chunk-BJYCRD5Y.cjs} +125 -52
- package/build/cjs/chunk-BJYCRD5Y.cjs.map +1 -0
- package/build/cjs/chunk-Q7SFCCGT.cjs +11 -0
- package/build/cjs/chunk-Q7SFCCGT.cjs.map +1 -0
- package/build/cjs/{chunk-YZHCDIYC.cjs → chunk-URDXPIRU.cjs} +107 -62
- package/build/cjs/chunk-URDXPIRU.cjs.map +1 -0
- package/build/cjs/createClient-BJo8T7Js.d.cts +9 -0
- package/build/cjs/delay-QK4T7RVX.cjs +74 -0
- package/build/cjs/delay-QK4T7RVX.cjs.map +1 -0
- package/build/cjs/index.cjs +11 -6
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +15 -8
- package/build/cjs/public/internal.cjs +17 -10
- package/build/cjs/public/internal.cjs.map +1 -1
- package/build/cjs/public/internal.d.cts +1 -1
- package/build/cjs/public/unstable-do-not-use.cjs +22 -71
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +2 -1
- package/build/esm/MinimalClientContext.js.map +1 -1
- package/build/esm/createClient.js +5 -5
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/createClient.test.js +3 -3
- package/build/esm/createClient.test.js.map +1 -1
- package/build/esm/createMinimalClient.js +1 -0
- package/build/esm/createMinimalClient.js.map +1 -1
- package/build/esm/fetchMetadata.test.js +7 -1
- package/build/esm/fetchMetadata.test.js.map +1 -1
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/object/aggregate.test.js +30 -0
- package/build/esm/object/aggregate.test.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.js +3 -2
- package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js +36 -24
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/esm/object/fetchPage.js +9 -2
- package/build/esm/object/fetchPage.js.map +1 -1
- package/build/esm/objectSet/InterfaceObjectSet.test.js +5 -1
- package/build/esm/objectSet/InterfaceObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/createObjectSet.js +5 -1
- package/build/esm/objectSet/createObjectSet.js.map +1 -1
- package/build/esm/observable/internal/ActionApplication.js +1 -1
- package/build/esm/observable/internal/ActionApplication.js.map +1 -1
- package/build/esm/observable/internal/Store.test.js +3 -0
- package/build/esm/observable/internal/Store.test.js.map +1 -1
- package/build/esm/ontology/StandardOntologyProvider.test.js +1 -1
- package/build/esm/ontology/StandardOntologyProvider.test.js.map +1 -1
- package/build/esm/public/unstable-do-not-use.js +1 -0
- package/build/esm/public/unstable-do-not-use.js.map +1 -1
- package/build/esm/public-utils/hydrateObjectSetFromObjectRids.js +4 -1
- package/build/esm/public-utils/hydrateObjectSetFromObjectRids.js.map +1 -1
- package/build/esm/public-utils/hydrateObjectSetFromRid.js +4 -1
- package/build/esm/public-utils/hydrateObjectSetFromRid.js.map +1 -1
- package/build/esm/queries/applyQuery.js +24 -1
- package/build/esm/queries/applyQuery.js.map +1 -1
- package/build/esm/queries/queries.test.js +27 -2
- package/build/esm/queries/queries.test.js.map +1 -1
- package/build/esm/queries/types.js.map +1 -1
- package/build/esm/util/UserAgent.js +2 -2
- package/build/esm/util/WireObjectSet.js +1 -1
- package/build/esm/util/WireObjectSet.js.map +1 -1
- package/build/esm/util/extractObjectOrInterfaceType.js +96 -0
- package/build/esm/util/extractObjectOrInterfaceType.js.map +1 -0
- package/build/esm/util/extractObjectOrInterfaceType.test.js +135 -0
- package/build/esm/util/extractObjectOrInterfaceType.test.js.map +1 -0
- package/build/esm/util/interfaceUtils.js +10 -0
- package/build/esm/util/interfaceUtils.js.map +1 -1
- package/build/esm/util/objectSpecifierUtils.js +12 -0
- package/build/esm/util/objectSpecifierUtils.js.map +1 -1
- package/build/esm/util/toDataValueQueries.js +11 -0
- package/build/esm/util/toDataValueQueries.js.map +1 -1
- package/build/types/MinimalClientContext.d.ts +1 -0
- package/build/types/MinimalClientContext.d.ts.map +1 -1
- package/build/types/createClient.d.ts +1 -0
- package/build/types/createClient.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/object/fetchPage.d.ts.map +1 -1
- package/build/types/observable/internal/ActionApplication.d.ts.map +1 -1
- package/build/types/public/unstable-do-not-use.d.ts +1 -0
- package/build/types/public/unstable-do-not-use.d.ts.map +1 -1
- package/build/types/queries/applyQuery.d.ts +5 -1
- package/build/types/queries/applyQuery.d.ts.map +1 -1
- package/build/types/queries/types.d.ts +2 -2
- package/build/types/queries/types.d.ts.map +1 -1
- package/build/types/util/extractObjectOrInterfaceType.d.ts +1 -0
- package/build/types/util/extractObjectOrInterfaceType.d.ts.map +1 -0
- package/build/types/util/extractObjectOrInterfaceType.test.d.ts +1 -0
- package/build/types/util/extractObjectOrInterfaceType.test.d.ts.map +1 -0
- package/build/types/util/objectSpecifierUtils.d.ts +13 -1
- package/build/types/util/objectSpecifierUtils.d.ts.map +1 -1
- package/package.json +11 -11
- package/build/cjs/chunk-E5BQ7757.cjs.map +0 -1
- package/build/cjs/chunk-YZHCDIYC.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,96 @@
|
|
|
1
1
|
# @osdk/client
|
|
2
2
|
|
|
3
|
+
## 2.4.0-beta.17
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 06fd45a: Export createObjectSpecifierFromPrimaryKey
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- @osdk/api@2.4.0-beta.17
|
|
12
|
+
- @osdk/client.unstable@2.4.0-beta.17
|
|
13
|
+
- @osdk/generator-converters@2.4.0-beta.17
|
|
14
|
+
|
|
15
|
+
## 2.4.0-beta.16
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- c763807: Fix hydrate method for object rids to work with interfaces.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- @osdk/api@2.4.0-beta.16
|
|
24
|
+
- @osdk/client.unstable@2.4.0-beta.16
|
|
25
|
+
- @osdk/generator-converters@2.4.0-beta.16
|
|
26
|
+
|
|
27
|
+
## 2.4.0-beta.15
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- d2d36e1: Fix module resolution for node when importing unstable code
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- @osdk/api@2.4.0-beta.15
|
|
36
|
+
- @osdk/client.unstable@2.4.0-beta.15
|
|
37
|
+
- @osdk/generator-converters@2.4.0-beta.15
|
|
38
|
+
|
|
39
|
+
## 2.4.0-beta.14
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Updated dependencies [5c76e33]
|
|
44
|
+
- @osdk/client.unstable@2.4.0-beta.14
|
|
45
|
+
- @osdk/api@2.4.0-beta.14
|
|
46
|
+
- @osdk/generator-converters@2.4.0-beta.14
|
|
47
|
+
|
|
48
|
+
## 2.4.0-beta.13
|
|
49
|
+
|
|
50
|
+
### Minor Changes
|
|
51
|
+
|
|
52
|
+
- 4bc848b: Add interface link support.
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- Updated dependencies [4bc848b]
|
|
57
|
+
- @osdk/generator-converters@2.4.0-beta.13
|
|
58
|
+
- @osdk/api@2.4.0-beta.13
|
|
59
|
+
- @osdk/client.unstable@2.4.0-beta.13
|
|
60
|
+
|
|
61
|
+
## 2.4.0-beta.12
|
|
62
|
+
|
|
63
|
+
### Minor Changes
|
|
64
|
+
|
|
65
|
+
- 402eb67: Fix hydrate to support interface object sets.
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- @osdk/api@2.4.0-beta.12
|
|
70
|
+
- @osdk/client.unstable@2.4.0-beta.12
|
|
71
|
+
- @osdk/generator-converters@2.4.0-beta.12
|
|
72
|
+
|
|
73
|
+
## 2.4.0-beta.11
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- Updated dependencies [f277b30]
|
|
78
|
+
- @osdk/generator-converters@2.4.0-beta.11
|
|
79
|
+
- @osdk/api@2.4.0-beta.11
|
|
80
|
+
- @osdk/client.unstable@2.4.0-beta.11
|
|
81
|
+
|
|
82
|
+
## 2.4.0-beta.10
|
|
83
|
+
|
|
84
|
+
### Minor Changes
|
|
85
|
+
|
|
86
|
+
- f022ffe: Add experimental transactions shape
|
|
87
|
+
|
|
88
|
+
### Patch Changes
|
|
89
|
+
|
|
90
|
+
- @osdk/api@2.4.0-beta.10
|
|
91
|
+
- @osdk/client.unstable@2.4.0-beta.10
|
|
92
|
+
- @osdk/generator-converters@2.4.0-beta.10
|
|
93
|
+
|
|
3
94
|
## 2.4.0-beta.9
|
|
4
95
|
|
|
5
96
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MinimalClientContext.js","names":[],"sources":["MinimalClientContext.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { Logger } from \"@osdk/api\";\nimport type { SharedClientContext } from \"@osdk/shared.client2\";\nimport type {\n convertWireToOsdkObjects,\n convertWireToOsdkObjects2,\n} from \"./object/convertWireToOsdkObjects.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport type { OntologyProvider } from \"./ontology/OntologyProvider.js\";\n\ndeclare const tag: unique symbol;\n\nexport type ClientCacheKey = {} & { readonly [tag]: void };\n\nexport type RequestContext = {\n finalMethodCall?: string;\n};\n\nexport interface MinimalClient extends SharedClientContext {\n ontologyRid: string | Promise<string>;\n ontologyProvider: OntologyProvider;\n logger?: Logger;\n /** @internal */\n objectSetFactory: ObjectSetFactory<any, any>;\n /** @internal */\n objectFactory: typeof convertWireToOsdkObjects;\n /** @internal */\n objectFactory2: typeof convertWireToOsdkObjects2;\n\n clientCacheKey: ClientCacheKey;\n requestContext: RequestContext;\n}\n\nexport type MinimalClientParams = {\n metadata: MinimalClientMetadata;\n provider: OntologyProvider;\n};\n\nexport interface MinimalClientMetadata {\n ontologyRid: string | Promise<string>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"MinimalClientContext.js","names":[],"sources":["MinimalClientContext.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { Logger } from \"@osdk/api\";\nimport type { SharedClientContext } from \"@osdk/shared.client2\";\nimport type {\n convertWireToOsdkObjects,\n convertWireToOsdkObjects2,\n} from \"./object/convertWireToOsdkObjects.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport type { OntologyProvider } from \"./ontology/OntologyProvider.js\";\n\ndeclare const tag: unique symbol;\n\nexport type ClientCacheKey = {} & { readonly [tag]: void };\n\nexport type RequestContext = {\n finalMethodCall?: string;\n};\n\nexport interface MinimalClient extends SharedClientContext {\n ontologyRid: string | Promise<string>;\n ontologyProvider: OntologyProvider;\n logger?: Logger;\n transactionRid?: string;\n /** @internal */\n objectSetFactory: ObjectSetFactory<any, any>;\n /** @internal */\n objectFactory: typeof convertWireToOsdkObjects;\n /** @internal */\n objectFactory2: typeof convertWireToOsdkObjects2;\n\n clientCacheKey: ClientCacheKey;\n requestContext: RequestContext;\n}\n\nexport type MinimalClientParams = {\n metadata: MinimalClientMetadata;\n provider: OntologyProvider;\n};\n\nexport interface MinimalClientMetadata {\n ontologyRid: string | Promise<string>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -51,9 +51,7 @@ class QueryInvoker {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/** @internal */
|
|
54
|
-
export function createClientInternal(objectSetFactory,
|
|
55
|
-
// first so i can bind
|
|
56
|
-
baseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {
|
|
54
|
+
export function createClientInternal(objectSetFactory, transactionRid, baseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {
|
|
57
55
|
if (typeof ontologyRid === "string") {
|
|
58
56
|
if (!ontologyRid.startsWith("ri.")) {
|
|
59
57
|
throw new Error("Invalid ontology RID");
|
|
@@ -71,7 +69,8 @@ baseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {
|
|
|
71
69
|
ontologyRid
|
|
72
70
|
}, baseUrl, tokenProvider, {
|
|
73
71
|
...options,
|
|
74
|
-
logger: options?.logger ?? new MinimalLogger()
|
|
72
|
+
logger: options?.logger ?? new MinimalLogger(),
|
|
73
|
+
transactionRid: transactionRid
|
|
75
74
|
}, fetchFn, objectSetFactory);
|
|
76
75
|
return createClientFromContext(clientCtx);
|
|
77
76
|
}
|
|
@@ -142,7 +141,8 @@ export function createClientFromContext(clientCtx) {
|
|
|
142
141
|
});
|
|
143
142
|
return client;
|
|
144
143
|
}
|
|
145
|
-
export const createClient = createClientInternal.bind(undefined, createObjectSet);
|
|
144
|
+
export const createClient = createClientInternal.bind(undefined, createObjectSet, undefined);
|
|
145
|
+
export const createClientWithTransaction = (transactionRid, ...args) => createClientInternal(createObjectSet, transactionRid, ...args);
|
|
146
146
|
function createWithRid(rids) {
|
|
147
147
|
return {
|
|
148
148
|
type: "static",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClient.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","OntologiesV2","symbolClientContext","oldSymbolClientContext","createBulkLinksAsyncIterFactory","applyAction","additionalContext","createMinimalClient","fetchMetadataInternal","MinimalLogger","fetchPage","fetchSingle","createObjectSet","applyQuery","ActionInvoker","constructor","clientCtx","actionDef","bind","undefined","batchApplyAction","QueryInvoker","queryDef","executeFunction","createClientInternal","objectSetFactory","baseUrl","ontologyRid","tokenProvider","options","fetchFn","fetch","startsWith","Error","then","logger","createClientFromContext","fetchMetadata","client","Object","defineProperties","o","type","name","getBulkLinks","fetchOneByRid","objectType","rid","createWithRid","createMediaReference","args","data","fileName","propertyType","MediaReferenceProperties","upload","apiName","mediaItemPath","preview","fetchPageByRid","objectOrInterfaceType","rids","value","createClient"],"sources":["createClient.ts"],"sourcesContent":["/*\n * Copyright 2024 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 ActionDefinition,\n FetchPageArgs,\n InterfaceDefinition,\n Logger,\n NullabilityAdherence,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SelectArg,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport {\n __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks,\n} from \"@osdk/api/unstable\";\nimport type { ObjectSet as WireObjectSet } from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport { symbolClientContext as oldSymbolClientContext } from \"@osdk/shared.client\";\nimport { createBulkLinksAsyncIterFactory } from \"./__unstable/createBulkLinksAsyncIterFactory.js\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { additionalContext, type Client } from \"./Client.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport { MinimalLogger } from \"./logger/MinimalLogger.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport { fetchPage } from \"./object/fetchPage.js\";\nimport { fetchSingle } from \"./object/fetchSingle.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport { applyQuery } from \"./queries/applyQuery.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\n\n// We import it this way to keep compatible with CJS. If we referenced the\n// value of `symbolClientContext` directly, then we would have to a dynamic import\n// in `createClientInternal` which would make it async and a break.\n// Since this is just a string in `@osdk/shared.client2` instead of a symbol,\n// we can safely perform this trick.\ntype newSymbolClientContext =\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n typeof import(\"@osdk/shared.client2\").symbolClientContext;\n\nclass ActionInvoker<Q extends ActionDefinition<any>>\n implements ActionSignatureFromDef<Q>\n{\n constructor(\n clientCtx: MinimalClient,\n actionDef: ActionDefinition<any>,\n ) {\n // We type the property as a generic function as binding `applyAction`\n // doesn't return a type thats all that useful anyway\n // The implements covers us for the most part here as this exact type doesn't\n // escape this file\n this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);\n this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);\n }\n\n applyAction: (...args: any[]) => any;\n batchApplyAction: (...args: any[]) => any;\n}\n\nclass QueryInvoker<Q extends QueryDefinition<any>>\n implements QuerySignatureFromDef<Q>\n{\n constructor(\n clientCtx: MinimalClient,\n queryDef: QueryDefinition<any>,\n ) {\n this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);\n }\n\n executeFunction: (...args: any[]) => any;\n}\n\n/** @internal */\nexport function createClientInternal(\n objectSetFactory: ObjectSetFactory<any, any>, // first so i can bind\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options: { logger?: Logger } | undefined = undefined,\n fetchFn: typeof globalThis.fetch = fetch,\n): Client {\n if (typeof ontologyRid === \"string\") {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ontologyRid.then((ontologyRid) => {\n if (!ontologyRid.startsWith(\"ri.\")) {\n // FIXME this promise is not await so this just shows up as an unhandled promise rejection\n throw new Error(\"Invalid ontology RID\");\n }\n });\n }\n\n const clientCtx: MinimalClient = createMinimalClient(\n { ontologyRid },\n baseUrl,\n tokenProvider,\n { ...options, logger: options?.logger ?? new MinimalLogger() },\n fetchFn,\n objectSetFactory,\n );\n\n return createClientFromContext(clientCtx);\n}\n\n/**\n * @internal\n */\nexport function createClientFromContext(clientCtx: MinimalClient) {\n function clientFn<\n T extends\n | ObjectOrInterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">,\n >(o: T): T extends ObjectTypeDefinition ? ObjectSet<T>\n : T extends InterfaceDefinition ? MinimalObjectSet<T>\n : T extends ActionDefinition<any> ? ActionSignatureFromDef<T>\n : T extends QueryDefinition<any> ? QuerySignatureFromDef<T>\n : T extends Experiment<\"2.0.8\"> | Experiment<\"2.1.0\">\n ? { invoke: ExperimentFns<T> }\n : never\n {\n if (o.type === \"object\" || o.type === \"interface\") {\n return clientCtx.objectSetFactory(o, clientCtx) as any;\n } else if (o.type === \"action\") {\n return new ActionInvoker(\n clientCtx,\n o,\n ) as (T extends ActionDefinition<any>\n // first `as` to the action definition for our \"real\" typecheck\n ? ActionSignatureFromDef<T>\n : never) as any; // then as any for dealing with the conditional return value\n } else if (o.type === \"query\") {\n return new QueryInvoker(\n clientCtx,\n o,\n ) as (T extends QueryDefinition<any> ? QuerySignatureFromDef<T>\n : never) as any;\n } else if (o.type === \"experiment\") {\n switch (o.name) {\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks.name:\n return {\n getBulkLinks: createBulkLinksAsyncIterFactory(\n clientCtx,\n ),\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid.name:\n return {\n fetchOneByRid: async <\n Q extends ObjectTypeDefinition,\n const L extends PropertyKeys<Q>,\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n objectType: Q,\n rid: string,\n options: SelectArg<Q, L, R, S>,\n ) => {\n return await fetchSingle(\n clientCtx,\n objectType,\n options,\n createWithRid(\n [rid],\n ),\n ) as Osdk<Q>;\n },\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference.name:\n return {\n createMediaReference: async <\n Q extends ObjectTypeDefinition,\n const L extends PropertyKeys.Filtered<Q, \"mediaReference\">,\n >(args: {\n data: Blob;\n fileName: string;\n objectType: Q;\n propertyType: L;\n }) => {\n const { data, fileName, objectType, propertyType } = args;\n return await OntologiesV2.MediaReferenceProperties.upload(\n clientCtx,\n await clientCtx.ontologyRid,\n objectType.apiName,\n propertyType as string,\n data,\n {\n mediaItemPath: fileName,\n preview: true,\n },\n );\n },\n } as any;\n\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid.name:\n return {\n fetchPageByRid: async <\n Q extends ObjectOrInterfaceDefinition,\n const L extends PropertyKeys<Q>,\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n objectOrInterfaceType: Q,\n rids: string[],\n options: FetchPageArgs<Q, L, R, any, S> = {},\n ) => {\n return await fetchPage(\n clientCtx,\n objectOrInterfaceType,\n options,\n createWithRid(rids),\n );\n },\n } as any;\n }\n\n throw new Error(\"not implemented\");\n } else {\n throw new Error(\"not implemented\");\n }\n }\n\n const fetchMetadata = fetchMetadataInternal.bind(\n undefined,\n clientCtx,\n );\n\n const symbolClientContext: newSymbolClientContext = \"__osdkClientContext\";\n\n const client: Client = Object.defineProperties<Client>(\n clientFn as Client,\n {\n [oldSymbolClientContext]: {\n value: clientCtx,\n },\n [symbolClientContext]: {\n value: clientCtx,\n },\n [additionalContext]: {\n value: clientCtx,\n },\n fetchMetadata: {\n value: fetchMetadata,\n },\n } satisfies Record<keyof Client, PropertyDescriptor>,\n );\n\n return client;\n}\n\nexport const createClient: (\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options?: {\n logger?: Logger;\n } | undefined,\n fetchFn?: typeof fetch | undefined,\n) => Client = createClientInternal.bind(\n undefined,\n createObjectSet,\n);\n\nfunction createWithRid(\n rids: string[],\n) {\n const withRid: WireObjectSet = {\n type: \"static\",\n \"objects\": rids,\n };\n\n return withRid;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqBA,SACEA,uDAAuD,EACvDC,gDAAgD,EAChDC,iDAAiD,EACjDC,+CAA+C,QAC1C,oBAAoB;AAE3B,OAAO,KAAKC,YAAY,MAAM,0BAA0B;AACxD,SAASC,mBAAmB,IAAIC,sBAAsB,QAAQ,qBAAqB;AACnF,SAASC,+BAA+B,QAAQ,iDAAiD;AAEjG,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,iBAAiB,QAAqB,aAAa;AAC5D,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,qBAAqB,QAAQ,oBAAoB;AAC1D,SAASC,aAAa,QAAQ,2BAA2B;AAEzD,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,eAAe,QAAQ,gCAAgC;AAEhE,SAASC,UAAU,QAAQ,yBAAyB;;AAGpD;AACA;AACA;AACA;AACA;;AAKA,MAAMC,aAAa,CAEnB;EACEC,WAAWA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C,GAAGH,IAAI;cACzD,OAAO,MAAMjD,YAAY,CAACqD,wBAAwB,CAACC,MAAM,CACvDvC,SAAS,EACT,MAAMA,SAAS,CAACW,WAAW,EAC3BmB,UAAU,CAACU,OAAO,EAClBH,YAAY,EACZF,IAAI,EACJ;gBACEM,aAAa,EAAEL,QAAQ;gBACvBM,OAAO,EAAE;cACX,CACF,CAAC;YACH;UACF,CAAC;QAEH,KAAK3D,iDAAiD,CAAC4C,IAAI;UACzD,OAAO;YACLgB,cAAc,EAAE,MAAAA,CAMdC,qBAAwB,EACxBC,IAAc,EACdhC,OAAuC,GAAG,CAAC,CAAC,KACzC;cACH,OAAO,MAAMnB,SAAS,CACpBM,SAAS,EACT4C,qBAAqB,EACrB/B,OAAO,EACPmB,aAAa,CAACa,IAAI,CACpB,CAAC;YACH;UACF,CAAC;MACL;MAEA,MAAM,IAAI5B,KAAK,CAAC,iBAAiB,CAAC;IACpC,CAAC,MAAM;MACL,MAAM,IAAIA,KAAK,CAAC,iBAAiB,CAAC;IACpC;EACF,CAAC,EAWC;IACE,CAAC9B,sBAAsB,GAAG;MACxB2D,KAAK,EAAE9C;IACT,CAAC;IACD,CARgD,qBAAqB,GAQ9C;MACrB8C,KAAK,EAAE9C;IACT,CAAC;IACD,CAACV,iBAAiB,GAAG;MACnBwD,KAAK,EAAE9C;IACT,CAAC;IACDqB,aAAa,EAAE;MACbyB,KAAK,EAAEzB;IACT;EACF,CACF,CAAC;EAED,OAAOC,MAAM;AACf;AAEA,OAAO,MAAMyB,YAQF,GAAGvC,oBAAoB,CAACN,IAAI,CACrCC,SAAS,EACTP,eACF,CAAC;AAED,SAASoC,aAAaA,CACpBa,IAAc,EACd;EAMA,OAL+B;IAC7BnB,IAAI,EAAE,QAAQ;IACd,SAAS,EAAEmB;EACb,CAAC;AAGH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"createClient.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","OntologiesV2","symbolClientContext","oldSymbolClientContext","createBulkLinksAsyncIterFactory","applyAction","additionalContext","createMinimalClient","fetchMetadataInternal","MinimalLogger","fetchPage","fetchSingle","createObjectSet","applyQuery","ActionInvoker","constructor","clientCtx","actionDef","bind","undefined","batchApplyAction","QueryInvoker","queryDef","executeFunction","createClientInternal","objectSetFactory","transactionRid","baseUrl","ontologyRid","tokenProvider","options","fetchFn","fetch","startsWith","Error","then","logger","createClientFromContext","fetchMetadata","client","Object","defineProperties","o","type","name","getBulkLinks","fetchOneByRid","objectType","rid","createWithRid","createMediaReference","args","data","fileName","propertyType","MediaReferenceProperties","upload","apiName","mediaItemPath","preview","fetchPageByRid","objectOrInterfaceType","rids","value","createClient","createClientWithTransaction"],"sources":["createClient.ts"],"sourcesContent":["/*\n * Copyright 2024 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 ActionDefinition,\n FetchPageArgs,\n InterfaceDefinition,\n Logger,\n NullabilityAdherence,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SelectArg,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport {\n __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks,\n} from \"@osdk/api/unstable\";\nimport type { ObjectSet as WireObjectSet } from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport { symbolClientContext as oldSymbolClientContext } from \"@osdk/shared.client\";\nimport { createBulkLinksAsyncIterFactory } from \"./__unstable/createBulkLinksAsyncIterFactory.js\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { additionalContext, type Client } from \"./Client.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport { MinimalLogger } from \"./logger/MinimalLogger.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport { fetchPage } from \"./object/fetchPage.js\";\nimport { fetchSingle } from \"./object/fetchSingle.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport { applyQuery } from \"./queries/applyQuery.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\n\n// We import it this way to keep compatible with CJS. If we referenced the\n// value of `symbolClientContext` directly, then we would have to a dynamic import\n// in `createClientInternal` which would make it async and a break.\n// Since this is just a string in `@osdk/shared.client2` instead of a symbol,\n// we can safely perform this trick.\ntype newSymbolClientContext =\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n typeof import(\"@osdk/shared.client2\").symbolClientContext;\n\nclass ActionInvoker<Q extends ActionDefinition<any>>\n implements ActionSignatureFromDef<Q>\n{\n constructor(\n clientCtx: MinimalClient,\n actionDef: ActionDefinition<any>,\n ) {\n // We type the property as a generic function as binding `applyAction`\n // doesn't return a type thats all that useful anyway\n // The implements covers us for the most part here as this exact type doesn't\n // escape this file\n this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);\n this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);\n }\n\n applyAction: (...args: any[]) => any;\n batchApplyAction: (...args: any[]) => any;\n}\n\nclass QueryInvoker<Q extends QueryDefinition<any>>\n implements QuerySignatureFromDef<Q>\n{\n constructor(\n clientCtx: MinimalClient,\n queryDef: QueryDefinition<any>,\n ) {\n this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);\n }\n\n executeFunction: (...args: any[]) => any;\n}\n\n/** @internal */\nexport function createClientInternal(\n objectSetFactory: ObjectSetFactory<any, any>,\n transactionRid: string | undefined,\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options: { logger?: Logger } | undefined = undefined,\n fetchFn: typeof globalThis.fetch = fetch,\n): Client {\n if (typeof ontologyRid === \"string\") {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ontologyRid.then((ontologyRid) => {\n if (!ontologyRid.startsWith(\"ri.\")) {\n // FIXME this promise is not await so this just shows up as an unhandled promise rejection\n throw new Error(\"Invalid ontology RID\");\n }\n });\n }\n\n const clientCtx: MinimalClient = createMinimalClient(\n { ontologyRid },\n baseUrl,\n tokenProvider,\n {\n ...options,\n logger: options?.logger ?? new MinimalLogger(),\n transactionRid: transactionRid,\n },\n fetchFn,\n objectSetFactory,\n );\n\n return createClientFromContext(clientCtx);\n}\n\n/**\n * @internal\n */\nexport function createClientFromContext(clientCtx: MinimalClient) {\n function clientFn<\n T extends\n | ObjectOrInterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">,\n >(o: T): T extends ObjectTypeDefinition ? ObjectSet<T>\n : T extends InterfaceDefinition ? MinimalObjectSet<T>\n : T extends ActionDefinition<any> ? ActionSignatureFromDef<T>\n : T extends QueryDefinition<any> ? QuerySignatureFromDef<T>\n : T extends Experiment<\"2.0.8\"> | Experiment<\"2.1.0\">\n ? { invoke: ExperimentFns<T> }\n : never\n {\n if (o.type === \"object\" || o.type === \"interface\") {\n return clientCtx.objectSetFactory(o, clientCtx) as any;\n } else if (o.type === \"action\") {\n return new ActionInvoker(\n clientCtx,\n o,\n ) as (T extends ActionDefinition<any>\n // first `as` to the action definition for our \"real\" typecheck\n ? ActionSignatureFromDef<T>\n : never) as any; // then as any for dealing with the conditional return value\n } else if (o.type === \"query\") {\n return new QueryInvoker(\n clientCtx,\n o,\n ) as (T extends QueryDefinition<any> ? QuerySignatureFromDef<T>\n : never) as any;\n } else if (o.type === \"experiment\") {\n switch (o.name) {\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks.name:\n return {\n getBulkLinks: createBulkLinksAsyncIterFactory(\n clientCtx,\n ),\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid.name:\n return {\n fetchOneByRid: async <\n Q extends ObjectTypeDefinition,\n const L extends PropertyKeys<Q>,\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n objectType: Q,\n rid: string,\n options: SelectArg<Q, L, R, S>,\n ) => {\n return await fetchSingle(\n clientCtx,\n objectType,\n options,\n createWithRid(\n [rid],\n ),\n ) as Osdk<Q>;\n },\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference.name:\n return {\n createMediaReference: async <\n Q extends ObjectTypeDefinition,\n const L extends PropertyKeys.Filtered<Q, \"mediaReference\">,\n >(args: {\n data: Blob;\n fileName: string;\n objectType: Q;\n propertyType: L;\n }) => {\n const { data, fileName, objectType, propertyType } = args;\n return await OntologiesV2.MediaReferenceProperties.upload(\n clientCtx,\n await clientCtx.ontologyRid,\n objectType.apiName,\n propertyType as string,\n data,\n {\n mediaItemPath: fileName,\n preview: true,\n },\n );\n },\n } as any;\n\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid.name:\n return {\n fetchPageByRid: async <\n Q extends ObjectOrInterfaceDefinition,\n const L extends PropertyKeys<Q>,\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n objectOrInterfaceType: Q,\n rids: string[],\n options: FetchPageArgs<Q, L, R, any, S> = {},\n ) => {\n return await fetchPage(\n clientCtx,\n objectOrInterfaceType,\n options,\n createWithRid(rids),\n );\n },\n } as any;\n }\n\n throw new Error(\"not implemented\");\n } else {\n throw new Error(\"not implemented\");\n }\n }\n\n const fetchMetadata = fetchMetadataInternal.bind(\n undefined,\n clientCtx,\n );\n\n const symbolClientContext: newSymbolClientContext = \"__osdkClientContext\";\n\n const client: Client = Object.defineProperties<Client>(\n clientFn as Client,\n {\n [oldSymbolClientContext]: {\n value: clientCtx,\n },\n [symbolClientContext]: {\n value: clientCtx,\n },\n [additionalContext]: {\n value: clientCtx,\n },\n fetchMetadata: {\n value: fetchMetadata,\n },\n } satisfies Record<keyof Client, PropertyDescriptor>,\n );\n\n return client;\n}\n\nexport const createClient: (\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options?: {\n logger?: Logger;\n } | undefined,\n fetchFn?: typeof fetch | undefined,\n) => Client = createClientInternal.bind(\n undefined,\n createObjectSet,\n undefined,\n);\n\nexport const createClientWithTransaction: (\n transactionRid: string,\n ...args: Parameters<typeof createClient>\n) => Client = (transactionRid, ...args) =>\n createClientInternal(\n createObjectSet,\n transactionRid,\n ...args,\n ) as Client;\n\nfunction createWithRid(\n rids: string[],\n) {\n const withRid: WireObjectSet = {\n type: \"static\",\n \"objects\": rids,\n };\n\n return withRid;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqBA,SACEA,uDAAuD,EACvDC,gDAAgD,EAChDC,iDAAiD,EACjDC,+CAA+C,QAC1C,oBAAoB;AAE3B,OAAO,KAAKC,YAAY,MAAM,0BAA0B;AACxD,SAASC,mBAAmB,IAAIC,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EAAE/C;IACT,CAAC;IACD,CAACV,iBAAiB,GAAG;MACnByD,KAAK,EAAE/C;IACT,CAAC;IACDsB,aAAa,EAAE;MACbyB,KAAK,EAAEzB;IACT;EACF,CACF,CAAC;EAED,OAAOC,MAAM;AACf;AAEA,OAAO,MAAMyB,YAQF,GAAGxC,oBAAoB,CAACN,IAAI,CACrCC,SAAS,EACTP,eAAe,EACfO,SACF,CAAC;AAED,OAAO,MAAM8C,2BAGF,GAAGA,CAACvC,cAAc,EAAE,GAAGyB,IAAI,KACpC3B,oBAAoB,CAClBZ,eAAe,EACfc,cAAc,EACd,GAAGyB,IACL,CAAW;AAEb,SAASF,aAAaA,CACpBa,IAAc,EACd;EAMA,OAL+B;IAC7BnB,IAAI,EAAE,QAAQ;IACd,SAAS,EAAEmB;EACb,CAAC;AAGH","ignoreList":[]}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { BarInterface } from "@osdk/client.test.ontology";
|
|
18
18
|
import * as SharedClientContext from "@osdk/shared.client.impl";
|
|
19
19
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
20
20
|
import { metadataCacheClient } from "./__unstable/ConjureSupport.js";
|
|
@@ -47,10 +47,10 @@ describe(createClient, () => {
|
|
|
47
47
|
return parts;
|
|
48
48
|
}
|
|
49
49
|
it("works for objects", async () => {
|
|
50
|
-
await client(
|
|
50
|
+
await client(BarInterface).fetchPage();
|
|
51
51
|
expect(fetchFunction).toHaveBeenCalledTimes(1);
|
|
52
52
|
const parts = getUserAgentPartsFromMockedFetch();
|
|
53
|
-
expect(parts).toEqual([...
|
|
53
|
+
expect(parts).toEqual([...BarInterface.osdkMetadata.extraUserAgent.split(" "), USER_AGENT]);
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
56
|
describe("check url formatting", () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClient.test.js","names":["
|
|
1
|
+
{"version":3,"file":"createClient.test.js","names":["BarInterface","SharedClientContext","beforeEach","describe","expect","it","vi","metadataCacheClient","createClient","MakeConjureContext","USER_AGENT","mockFetchResponse","fetch","response","mockResolvedValueOnce","json","Promise","resolve","blob","status","ok","fetchFunction","client","ontologyRid","fn","undefined","data","getUserAgentPartsFromMockedFetch","userAgent","mock","calls","headers","get","parts","split","fetchPage","toHaveBeenCalledTimes","toEqual","osdkMetadata","extraUserAgent","spy","spyOn","toBe","conjureContextSpy","baseUrl","ontologyProvider","getObjectDefinition","results","value"],"sources":["createClient.test.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { BarInterface } from \"@osdk/client.test.ontology\";\nimport * as SharedClientContext from \"@osdk/shared.client.impl\";\nimport type { MockedFunction } from \"vitest\";\nimport { beforeEach, describe, expect, it, vi } from \"vitest\";\nimport { metadataCacheClient } from \"./__unstable/ConjureSupport.js\";\nimport type { Client } from \"./Client.js\";\nimport { createClient } from \"./createClient.js\";\nimport * as MakeConjureContext from \"./ontology/makeConjureContext.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n\nexport function mockFetchResponse(\n fetch: MockedFunction<typeof globalThis.fetch>,\n response: any,\n): void {\n fetch.mockResolvedValueOnce({\n json: () => Promise.resolve(response),\n blob: () => Promise.resolve(response),\n status: 200,\n ok: true,\n } as any);\n}\n\ndescribe(createClient, () => {\n const validOlderVersion = \"0.13.0\" as const;\n const validCurrentVersion = \"0.14.0\" as const;\n const invalidFutureVersion = \"100.100.100\" as const;\n\n let fetchFunction: MockedFunction<typeof globalThis.fetch>;\n let client: Client;\n\n const ontologyRid = \"ri.not.important\";\n\n beforeEach(() => {\n fetchFunction = vi.fn();\n\n client = createClient(\n \"https://mock.com\",\n ontologyRid,\n async () => \"Token\",\n undefined,\n fetchFunction,\n );\n\n mockFetchResponse(fetchFunction, { data: [] });\n });\n\n describe(\"user agent passing\", () => {\n function getUserAgentPartsFromMockedFetch() {\n const userAgent = (fetchFunction.mock.calls[0][1]?.headers as Headers)\n .get(\n \"Fetch-User-Agent\",\n );\n const parts = userAgent?.split(\" \") ?? [];\n return parts;\n }\n\n it(\"works for objects\", async () => {\n await client(BarInterface).fetchPage();\n expect(fetchFunction).toHaveBeenCalledTimes(1);\n\n const parts = getUserAgentPartsFromMockedFetch();\n expect(parts).toEqual([\n ...BarInterface.osdkMetadata!\n .extraUserAgent\n .split(\" \"),\n USER_AGENT,\n ]);\n });\n });\n\n describe(\"check url formatting\", () => {\n it(\"urls are correctly formatted\", async () => {\n const spy = vi.spyOn(SharedClientContext, \"createSharedClientContext\");\n const client = createClient(\n \"https://mock.com\",\n ontologyRid,\n async () => \"Token\",\n undefined,\n fetchFunction,\n );\n expect(spy.mock.calls[0][0]).toBe(\"https://mock.com/\");\n\n createClient(\n \"https://mock1.com/\",\n ontologyRid,\n async () => \"Token\",\n undefined,\n fetchFunction,\n );\n expect(spy.mock.calls[1][0]).toBe(\"https://mock1.com/\");\n\n createClient(\n \"https://mock2.com/stuff/first/foo\",\n ontologyRid,\n async () => \"Token\",\n undefined,\n fetchFunction,\n );\n expect(spy.mock.calls[2][0]).toBe(\"https://mock2.com/stuff/first/foo/\");\n\n createClient(\n \"https://mock3.com/stuff/first/foo/\",\n ontologyRid,\n async () => \"Token\",\n undefined,\n fetchFunction,\n );\n expect(spy.mock.calls[3][0]).toBe(\"https://mock3.com/stuff/first/foo/\");\n\n const conjureContextSpy = vi.spyOn(\n MakeConjureContext,\n \"makeConjureContext\",\n );\n\n void metadataCacheClient(\n {\n baseUrl: \"https://mock4.com/\",\n ontologyProvider: { getObjectDefinition: async () => ({}) },\n } as any,\n );\n\n expect(\n conjureContextSpy.mock.results[0].value[\"baseUrl\"]\n + conjureContextSpy.mock.results[0].value[\"servicePath\"],\n ).toBe(\"https://mock4.com/ontology-metadata/api\");\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,YAAY,QAAQ,4BAA4B;AACzD,OAAO,KAAKC,mBAAmB,MAAM,0BAA0B;AAE/D,SAASC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AAC7D,SAASC,mBAAmB,QAAQ,gCAAgC;AAEpE,SAASC,YAAY,QAAQ,mBAAmB;AAChD,OAAO,KAAKC,kBAAkB,MAAM,kCAAkC;AACtE,SAASC,UAAU,QAAQ,qBAAqB;AAEhD,OAAO,SAASC,iBAAiBA,CAC/BC,KAA8C,EAC9CC,QAAa,EACP;EACND,KAAK,CAACE,qBAAqB,CAAC;IAC1BC,IAAI,EAAEA,CAAA,KAAMC,OAAO,CAACC,OAAO,CAACJ,QAAQ,CAAC;IACrCK,IAAI,EAAEA,CAAA,KAAMF,OAAO,CAACC,OAAO,CAACJ,QAAQ,CAAC;IACrCM,MAAM,EAAE,GAAG;IACXC,EAAE,EAAE;EACN,CAAQ,CAAC;AACX;AAEAjB,QAAQ,CAACK,YAAY,EAAE,MAAM;EAK3B,IAAIa,aAAsD;EAC1D,IAAIC,MAAc;EAElB,MAAMC,WAAW,GAAG,kBAAkB;EAEtCrB,UAAU,CAAC,MAAM;IACfmB,aAAa,GAAGf,EAAE,CAACkB,EAAE,CAAC,CAAC;IAEvBF,MAAM,GAAGd,YAAY,CACnB,kBAAkB,EAClBe,WAAW,EACX,YAAY,OAAO,EACnBE,SAAS,EACTJ,aACF,CAAC;IAEDV,iBAAiB,CAACU,aAAa,EA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ACX,YAAY,OAAO,EACnBE,SAAS,EACTJ,aACF,CAAC;MACDjB,MAAM,CAACoC,GAAG,CAACX,IAAI,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAACY,IAAI,CAAC,oBAAoB,CAAC;MAEvDlC,YAAY,CACV,mCAAmC,EACnCe,WAAW,EACX,YAAY,OAAO,EACnBE,SAAS,EACTJ,aACF,CAAC;MACDjB,MAAM,CAACoC,GAAG,CAACX,IAAI,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAACY,IAAI,CAAC,oCAAoC,CAAC;MAEvElC,YAAY,CACV,oCAAoC,EACpCe,WAAW,EACX,YAAY,OAAO,EACnBE,SAAS,EACTJ,aACF,CAAC;MACDjB,MAAM,CAACoC,GAAG,CAACX,IAAI,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAACY,IAAI,CAAC,oCAAoC,CAAC;MAEvE,MAAMC,iBAAiB,GAAGrC,EAAE,CAACmC,KAAK,CAChChC,kBAAkB,EAClB,oBACF,CAAC;MAED,KAAKF,mBAAmB,CACtB;QACEqC,OAAO,EAAE,oBAAoB;QAC7BC,gBAAgB,EAAE;UAAEC,mBAAmB,EAAE,MAAAA,CAAA,MAAa,CAAC,CAAC;QAAE;MAC5D,CACF,CAAC;MAED1C,MAAM,CACJuC,iBAAiB,CAACd,IAAI,CAACkB,OAAO,CAAC,CAAC,CAAC,CAACC,KAAK,CAAC,SAAS,CAAC,GAC9CL,iBAAiB,CAACd,IAAI,CAACkB,OAAO,CAAC,CAAC,CAAC,CAACC,KAAK,CAAC,aAAa,CAC3D,CAAC,CAACN,IAAI,CAAC,yCAAyC,CAAC;IACnD,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -39,6 +39,7 @@ export function createMinimalClient(metadata, baseUrl, tokenProvider, options =
|
|
|
39
39
|
objectFactory2: convertWireToOsdkObjects2,
|
|
40
40
|
ontologyRid: metadata.ontologyRid,
|
|
41
41
|
logger: options.logger,
|
|
42
|
+
transactionRid: options.transactionRid,
|
|
42
43
|
clientCacheKey: {},
|
|
43
44
|
requestContext: {}
|
|
44
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMinimalClient.js","names":["createSharedClientContext","convertWireToOsdkObjects","convertWireToOsdkObjects2","createObjectSet","createStandardOntologyProviderFactory","USER_AGENT","createMinimalClient","metadata","baseUrl","tokenProvider","options","fetchFn","global","fetch","objectSetFactory","createOntologyProviderFactory","process","env","NODE_ENV","URL","e","hint","startsWith","Error","processedBaseUrl","pathname","endsWith","minimalClient","toString","objectFactory","objectFactory2","ontologyRid","logger","clientCacheKey","requestContext","Object","freeze","assign","ontologyProvider"],"sources":["createMinimalClient.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { Logger } from \"@osdk/api\";\nimport { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport type {\n ClientCacheKey,\n MinimalClient,\n MinimalClientParams,\n} from \"./MinimalClientContext.js\";\nimport {\n convertWireToOsdkObjects,\n convertWireToOsdkObjects2,\n} from \"./object/convertWireToOsdkObjects.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport type { OntologyProvider } from \"./ontology/OntologyProvider.js\";\nimport {\n createStandardOntologyProviderFactory,\n type OntologyCachingOptions,\n} from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n\n/** @internal */\nexport function createMinimalClient(\n metadata: MinimalClientParams[\"metadata\"],\n baseUrl: string,\n tokenProvider: () => Promise<string>,\n options: OntologyCachingOptions & {
|
|
1
|
+
{"version":3,"file":"createMinimalClient.js","names":["createSharedClientContext","convertWireToOsdkObjects","convertWireToOsdkObjects2","createObjectSet","createStandardOntologyProviderFactory","USER_AGENT","createMinimalClient","metadata","baseUrl","tokenProvider","options","fetchFn","global","fetch","objectSetFactory","createOntologyProviderFactory","process","env","NODE_ENV","URL","e","hint","startsWith","Error","processedBaseUrl","pathname","endsWith","minimalClient","toString","objectFactory","objectFactory2","ontologyRid","logger","transactionRid","clientCacheKey","requestContext","Object","freeze","assign","ontologyProvider"],"sources":["createMinimalClient.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { Logger } from \"@osdk/api\";\nimport { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport type {\n ClientCacheKey,\n MinimalClient,\n MinimalClientParams,\n} from \"./MinimalClientContext.js\";\nimport {\n convertWireToOsdkObjects,\n convertWireToOsdkObjects2,\n} from \"./object/convertWireToOsdkObjects.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport type { OntologyProvider } from \"./ontology/OntologyProvider.js\";\nimport {\n createStandardOntologyProviderFactory,\n type OntologyCachingOptions,\n} from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n\n/** @internal */\nexport function createMinimalClient(\n metadata: MinimalClientParams[\"metadata\"],\n baseUrl: string,\n tokenProvider: () => Promise<string>,\n options: OntologyCachingOptions & {\n logger?: Logger;\n transactionRid?: string;\n } = {},\n fetchFn: (\n input: Request | URL | string,\n init?: RequestInit | undefined,\n ) => Promise<Response> = global.fetch,\n objectSetFactory: ObjectSetFactory<any, any> = createObjectSet,\n createOntologyProviderFactory: (\n a: OntologyCachingOptions & { logger?: Logger },\n ) => (minimalClient: MinimalClient) => OntologyProvider =\n createStandardOntologyProviderFactory,\n) {\n if (process.env.NODE_ENV !== \"production\") {\n try {\n new URL(baseUrl);\n } catch (e) {\n const hint =\n !baseUrl.startsWith(\"http://\") || !baseUrl.startsWith(\"https://\")\n ? \". Did you forget to add 'http://' or 'https://'?\"\n : \"\";\n throw new Error(`Invalid stack URL: ${baseUrl}${hint}`);\n }\n }\n const processedBaseUrl = new URL(baseUrl);\n processedBaseUrl.pathname += processedBaseUrl.pathname.endsWith(\"/\")\n ? \"\"\n : \"/\";\n const minimalClient: MinimalClient = {\n ...createSharedClientContext(\n processedBaseUrl.toString(),\n tokenProvider,\n USER_AGENT,\n fetchFn,\n ),\n objectSetFactory,\n objectFactory: convertWireToOsdkObjects,\n objectFactory2: convertWireToOsdkObjects2,\n ontologyRid: metadata.ontologyRid,\n logger: options.logger,\n transactionRid: options.transactionRid,\n clientCacheKey: {} as ClientCacheKey,\n requestContext: {},\n } satisfies Omit<\n MinimalClient,\n \"ontologyProvider\"\n > as any;\n\n return Object.freeze(Object.assign(minimalClient, {\n ontologyProvider: createOntologyProviderFactory(\n options,\n )(minimalClient),\n }));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,yBAAyB,QAAQ,0BAA0B;AAMpE,SACEC,wBAAwB,EACxBC,yBAAyB,QACpB,sCAAsC;AAC7C,SAASC,eAAe,QAAQ,gCAAg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;EAER,OAAOC,MAAM,CAACC,MAAM,CAACD,MAAM,CAACE,MAAM,CAACX,aAAa,EAAE;IAChDY,gBAAgB,EAAExB,6BAA6B,CAC7CL,OACF,CAAC,CAACiB,aAAa;EACjB,CAAC,CAAC,CAAC;AACL","ignoreList":[]}
|
|
@@ -168,7 +168,13 @@ describe("FetchMetadata", () => {
|
|
|
168
168
|
"Person",
|
|
169
169
|
],
|
|
170
170
|
"implements": [],
|
|
171
|
-
"links": {
|
|
171
|
+
"links": {
|
|
172
|
+
"toBar": {
|
|
173
|
+
"multiplicity": true,
|
|
174
|
+
"targetType": "interface",
|
|
175
|
+
"targetTypeApiName": "BarInterface",
|
|
176
|
+
},
|
|
177
|
+
},
|
|
172
178
|
"properties": {
|
|
173
179
|
"fooSpt": {
|
|
174
180
|
"description": "A foo",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchMetadata.test.js","names":["$Actions","$Interfaces","$Objects","$Queries","LegacyFauxFoundry","startNodeApiServer","beforeAll","describe","expect","expectTypeOf","it","createClient","client","testSetup","apiServer","close","objectMetadata","fetchMetadata","Employee","toEqualTypeOf","toMatchInlineSnapshot","interfaceMetadata","FooInterface","actionMetadata","moveOffice","queryMetadata","queryAcceptsObject"],"sources":["fetchMetadata.test.ts"],"sourcesContent":["/*\n * Copyright 2024 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 ActionMetadata,\n InterfaceMetadata,\n ObjectMetadata,\n QueryMetadata,\n} from \"@osdk/api\";\nimport {\n $Actions,\n $Interfaces,\n $Objects,\n $Queries,\n} from \"@osdk/client.test.ontology\";\nimport { LegacyFauxFoundry, startNodeApiServer } from \"@osdk/shared.test\";\nimport { beforeAll, describe, expect, expectTypeOf, it } from \"vitest\";\nimport type { Client } from \"./Client.js\";\nimport { createClient } from \"./createClient.js\";\n\ndescribe(\"FetchMetadata\", () => {\n let client: Client;\n\n beforeAll(() => {\n const testSetup = startNodeApiServer(new LegacyFauxFoundry(), createClient);\n ({ client } = testSetup);\n return () => {\n testSetup.apiServer.close();\n };\n });\n\n it(\"fetches object metadata correctly\", async () => {\n const objectMetadata = await client.fetchMetadata($Objects.Employee);\n\n expectTypeOf(objectMetadata).toEqualTypeOf<\n ObjectMetadata\n >();\n\n expect(objectMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"Employee\",\n \"description\": \"A full-time or part-time \n\n employee of our firm\",\n \"displayName\": \"Employee\",\n \"icon\": {\n \"color\": \"blue\",\n \"name\": \"person\",\n \"type\": \"blueprint\",\n },\n \"implements\": [\n \"FooInterface\",\n ],\n \"interfaceMap\": {\n \"FooInterface\": {\n \"fooSpt\": \"fullName\",\n },\n },\n \"inverseInterfaceMap\": {\n \"FooInterface\": {\n \"fullName\": \"fooSpt\",\n },\n },\n \"links\": {\n \"lead\": {\n \"multiplicity\": false,\n \"targetType\": \"Employee\",\n },\n \"officeLink\": {\n \"multiplicity\": false,\n \"targetType\": \"Office\",\n },\n \"peeps\": {\n \"multiplicity\": true,\n \"targetType\": \"Employee\",\n },\n },\n \"pluralDisplayName\": \"Employees\",\n \"primaryKeyApiName\": \"employeeId\",\n \"primaryKeyType\": \"integer\",\n \"properties\": {\n \"class\": {\n \"description\": \"\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"employeeId\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"integer\",\n },\n \"employeeLocation\": {\n \"description\": \"Geotime series reference of the location of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"geotimeSeriesReference\",\n },\n \"employeeSensor\": {\n \"description\": \"TimeSeries sensor of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"sensorTimeseries\",\n },\n \"employeeStatus\": {\n \"description\": \"TimeSeries of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"stringTimeseries\",\n },\n \"fullName\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"office\": {\n \"description\": \"The unique \"ID\" of the employee's \\\\\"primary\\\\\" assigned office.\n This is some more text.\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"skillSet\": {\n \"description\": \"The skills of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"skillSetEmbedding\": {\n \"description\": \"Vectorized skill set\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"vector\",\n },\n \"startDate\": {\n \"description\": \"The date the employee was hired (most recently, if they were re-hired)\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"datetime\",\n },\n },\n \"rid\": \"ri.ontology.main.object-type.401ac022-89eb-4591-8b7e-0a912b9efb44\",\n \"status\": \"ACTIVE\",\n \"titleProperty\": \"fullName\",\n \"type\": \"object\",\n \"visibility\": \"NORMAL\",\n }\n `);\n });\n\n it(\"fetches interface metadata correctly\", async () => {\n const interfaceMetadata = await client.fetchMetadata(\n $Interfaces.FooInterface,\n );\n\n expectTypeOf(interfaceMetadata).toEqualTypeOf<\n InterfaceMetadata\n >();\n\n expect(interfaceMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"FooInterface\",\n \"description\": \"Interface for Foo\",\n \"displayName\": \"Foo Interface\",\n \"implementedBy\": [\n \"Employee\",\n \"Person\",\n ],\n \"implements\": [],\n \"links\": {},\n \"properties\": {\n \"fooSpt\": {\n \"description\": \"A foo\",\n \"displayName\": \"Foo\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n },\n \"rid\": \"ri.interface.main.interface.1\",\n \"type\": \"interface\",\n }\n `);\n });\n\n it(\"fetches action metadata correctly\", async () => {\n const actionMetadata = await client.fetchMetadata(\n $Actions.moveOffice,\n );\n\n expectTypeOf(actionMetadata).toEqualTypeOf<ActionMetadata>();\n\n expect(actionMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"moveOffice\",\n \"description\": \"Update an office's physical location\",\n \"displayName\": \"move-office\",\n \"modifiedEntities\": {\n \"Office\": {\n \"created\": false,\n \"modified\": true,\n },\n },\n \"parameters\": {\n \"newAddress\": {\n \"description\": \"The office's new physical address (not necessarily shipping address)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"newCapacity\": {\n \"description\": \"The maximum seated-at-desk capacity of the new office (maximum fire-safe capacity may be higher)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n \"officeId\": {\n \"description\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"string\",\n },\n \"officeNames\": {\n \"description\": \"A list of all office names\",\n \"multiplicity\": true,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n },\n \"rid\": \"ri.ontology.main.action-type.9f84017d-cf17-4fa8-84c3-8e01e5d594f2\",\n \"status\": \"ACTIVE\",\n \"type\": \"action\",\n }\n `);\n });\n\n it(\"fetches query metadata correctly\", async () => {\n const queryMetadata = await client.fetchMetadata(\n $Queries.queryAcceptsObject,\n );\n\n expectTypeOf(queryMetadata).toEqualTypeOf<QueryMetadata>();\n\n expect(queryMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"queryAcceptsObject\",\n \"description\": \"description of the query that takes object types\",\n \"displayName\": \"QueryAcceptsObject\",\n \"output\": {\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n \"parameters\": {\n \"object\": {\n \"description\": undefined,\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n },\n \"rid\": \"ri.function-registry.main.function.9b55870a-63c7-4d48-8f06-9627c0805968\",\n \"type\": \"query\",\n \"version\": \"0.11.0\",\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SACEA,QAAQ,EACRC,WAAW,EACXC,QAAQ,EACRC,QAAQ,QACH,4BAA4B;AACnC,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,mBAAmB;AACzE,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAQ,QAAQ;AAEtE,SAASC,YAAY,QAAQ,mBAAmB;AAEhDJ,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC9B,IAAIK,MAAc;EAElBN,SAAS,CAAC,MAAM;IACd,MAAMO,SAAS,GAAGR,kBAAkB,CAAC,IAAID,iBAAiB,CAAC,CAAC,EAAEO,YAAY,CAAC;IAC3E,CAAC;MAAEC;IAAO,CAAC,GAAGC,SAAS;IACvB,OAAO,MAAM;MACXA,SAAS,CAACC,SAAS,CAACC,KAAK,CAAC,CAAC;IAC7B,CAAC;EACH,CAAC,CAAC;EAEFL,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMM,cAAc,GAAG,MAAMJ,MAAM,CAACK,aAAa,CAACf,QAAQ,CAACgB,QAAQ,CAAC;IAEpET,YAAY,CAACO,cAAc,CAAC,CAACG,aAAa,CAExC,CAAC;IAEHX,MAAM,CAACQ,cAAc,CAAC,CAACI,qBAAqB,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,sCAAsC,EAAE,YAAY;IACrD,MAAMW,iBAAiB,GAAG,MAAMT,MAAM,CAACK,aAAa,CAClDhB,WAAW,CAACqB,YACd,CAAC;IAEDb,YAAY,CAACY,iBAAiB,CAAC,CAACF,aAAa,CAE3C,CAAC;IAEHX,MAAM,CAACa,iBAAiB,CAAC,CAACD,qBAAqB,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMa,cAAc,GAAG,MAAMX,MAAM,CAACK,aAAa,CAC/CjB,QAAQ,CAACwB,UACX,CAAC;IAEDf,YAAY,CAACc,cAAc,CAAC,CAACJ,aAAa,CAAiB,CAAC;IAE5DX,MAAM,CAACe,cAAc,CAAC,CAACH,qBAAqB,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,kCAAkC,EAAE,YAAY;IACjD,MAAMe,aAAa,GAAG,MAAMb,MAAM,CAACK,aAAa,CAC9Cd,QAAQ,CAACuB,kBACX,CAAC;IAEDjB,YAAY,CAACgB,aAAa,CAAC,CAACN,aAAa,CAAgB,CAAC;IAE1DX,MAAM,CAACiB,aAAa,CAAC,CAACL,qBAAqB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"fetchMetadata.test.js","names":["$Actions","$Interfaces","$Objects","$Queries","LegacyFauxFoundry","startNodeApiServer","beforeAll","describe","expect","expectTypeOf","it","createClient","client","testSetup","apiServer","close","objectMetadata","fetchMetadata","Employee","toEqualTypeOf","toMatchInlineSnapshot","interfaceMetadata","FooInterface","actionMetadata","moveOffice","queryMetadata","queryAcceptsObject"],"sources":["fetchMetadata.test.ts"],"sourcesContent":["/*\n * Copyright 2024 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 ActionMetadata,\n InterfaceMetadata,\n ObjectMetadata,\n QueryMetadata,\n} from \"@osdk/api\";\nimport {\n $Actions,\n $Interfaces,\n $Objects,\n $Queries,\n} from \"@osdk/client.test.ontology\";\nimport { LegacyFauxFoundry, startNodeApiServer } from \"@osdk/shared.test\";\nimport { beforeAll, describe, expect, expectTypeOf, it } from \"vitest\";\nimport type { Client } from \"./Client.js\";\nimport { createClient } from \"./createClient.js\";\n\ndescribe(\"FetchMetadata\", () => {\n let client: Client;\n\n beforeAll(() => {\n const testSetup = startNodeApiServer(new LegacyFauxFoundry(), createClient);\n ({ client } = testSetup);\n return () => {\n testSetup.apiServer.close();\n };\n });\n\n it(\"fetches object metadata correctly\", async () => {\n const objectMetadata = await client.fetchMetadata($Objects.Employee);\n\n expectTypeOf(objectMetadata).toEqualTypeOf<\n ObjectMetadata\n >();\n\n expect(objectMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"Employee\",\n \"description\": \"A full-time or part-time \n\n employee of our firm\",\n \"displayName\": \"Employee\",\n \"icon\": {\n \"color\": \"blue\",\n \"name\": \"person\",\n \"type\": \"blueprint\",\n },\n \"implements\": [\n \"FooInterface\",\n ],\n \"interfaceMap\": {\n \"FooInterface\": {\n \"fooSpt\": \"fullName\",\n },\n },\n \"inverseInterfaceMap\": {\n \"FooInterface\": {\n \"fullName\": \"fooSpt\",\n },\n },\n \"links\": {\n \"lead\": {\n \"multiplicity\": false,\n \"targetType\": \"Employee\",\n },\n \"officeLink\": {\n \"multiplicity\": false,\n \"targetType\": \"Office\",\n },\n \"peeps\": {\n \"multiplicity\": true,\n \"targetType\": \"Employee\",\n },\n },\n \"pluralDisplayName\": \"Employees\",\n \"primaryKeyApiName\": \"employeeId\",\n \"primaryKeyType\": \"integer\",\n \"properties\": {\n \"class\": {\n \"description\": \"\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"employeeId\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"integer\",\n },\n \"employeeLocation\": {\n \"description\": \"Geotime series reference of the location of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"geotimeSeriesReference\",\n },\n \"employeeSensor\": {\n \"description\": \"TimeSeries sensor of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"sensorTimeseries\",\n },\n \"employeeStatus\": {\n \"description\": \"TimeSeries of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"stringTimeseries\",\n },\n \"fullName\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"office\": {\n \"description\": \"The unique \"ID\" of the employee's \\\\\"primary\\\\\" assigned office.\n This is some more text.\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"skillSet\": {\n \"description\": \"The skills of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"skillSetEmbedding\": {\n \"description\": \"Vectorized skill set\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"vector\",\n },\n \"startDate\": {\n \"description\": \"The date the employee was hired (most recently, if they were re-hired)\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"datetime\",\n },\n },\n \"rid\": \"ri.ontology.main.object-type.401ac022-89eb-4591-8b7e-0a912b9efb44\",\n \"status\": \"ACTIVE\",\n \"titleProperty\": \"fullName\",\n \"type\": \"object\",\n \"visibility\": \"NORMAL\",\n }\n `);\n });\n\n it(\"fetches interface metadata correctly\", async () => {\n const interfaceMetadata = await client.fetchMetadata(\n $Interfaces.FooInterface,\n );\n\n expectTypeOf(interfaceMetadata).toEqualTypeOf<\n InterfaceMetadata\n >();\n\n expect(interfaceMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"FooInterface\",\n \"description\": \"Interface for Foo\",\n \"displayName\": \"Foo Interface\",\n \"implementedBy\": [\n \"Employee\",\n \"Person\",\n ],\n \"implements\": [],\n \"links\": {\n \"toBar\": {\n \"multiplicity\": true,\n \"targetType\": \"interface\",\n \"targetTypeApiName\": \"BarInterface\",\n },\n },\n \"properties\": {\n \"fooSpt\": {\n \"description\": \"A foo\",\n \"displayName\": \"Foo\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n },\n \"rid\": \"ri.interface.main.interface.1\",\n \"type\": \"interface\",\n }\n `);\n });\n\n it(\"fetches action metadata correctly\", async () => {\n const actionMetadata = await client.fetchMetadata(\n $Actions.moveOffice,\n );\n\n expectTypeOf(actionMetadata).toEqualTypeOf<ActionMetadata>();\n\n expect(actionMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"moveOffice\",\n \"description\": \"Update an office's physical location\",\n \"displayName\": \"move-office\",\n \"modifiedEntities\": {\n \"Office\": {\n \"created\": false,\n \"modified\": true,\n },\n },\n \"parameters\": {\n \"newAddress\": {\n \"description\": \"The office's new physical address (not necessarily shipping address)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"newCapacity\": {\n \"description\": \"The maximum seated-at-desk capacity of the new office (maximum fire-safe capacity may be higher)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n \"officeId\": {\n \"description\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"string\",\n },\n \"officeNames\": {\n \"description\": \"A list of all office names\",\n \"multiplicity\": true,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n },\n \"rid\": \"ri.ontology.main.action-type.9f84017d-cf17-4fa8-84c3-8e01e5d594f2\",\n \"status\": \"ACTIVE\",\n \"type\": \"action\",\n }\n `);\n });\n\n it(\"fetches query metadata correctly\", async () => {\n const queryMetadata = await client.fetchMetadata(\n $Queries.queryAcceptsObject,\n );\n\n expectTypeOf(queryMetadata).toEqualTypeOf<QueryMetadata>();\n\n expect(queryMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"queryAcceptsObject\",\n \"description\": \"description of the query that takes object types\",\n \"displayName\": \"QueryAcceptsObject\",\n \"output\": {\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n \"parameters\": {\n \"object\": {\n \"description\": undefined,\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n },\n \"rid\": \"ri.function-registry.main.function.9b55870a-63c7-4d48-8f06-9627c0805968\",\n \"type\": \"query\",\n \"version\": \"0.11.0\",\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SACEA,QAAQ,EACRC,WAAW,EACXC,QAAQ,EACRC,QAAQ,QACH,4BAA4B;AACnC,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,mBAAmB;AACzE,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAQ,QAAQ;AAEtE,SAASC,YAAY,QAAQ,mBAAmB;AAEhDJ,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC9B,IAAIK,MAAc;EAElBN,SAAS,CAAC,MAAM;IACd,MAAMO,SAAS,GAAGR,kBAAkB,CAAC,IAAID,iBAAiB,CAAC,CAAC,EAAEO,YAAY,CAAC;IAC3E,CAAC;MAAEC;IAAO,CAAC,GAAGC,SAAS;IACvB,OAAO,MAAM;MACXA,SAAS,CAACC,SAAS,CAACC,KAAK,CAAC,CAAC;IAC7B,CAAC;EACH,CAAC,CAAC;EAEFL,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMM,cAAc,GAAG,MAAMJ,MAAM,CAACK,aAAa,CAACf,QAAQ,CAACgB,QAAQ,CAAC;IAEpET,YAAY,CAACO,cAAc,CAAC,CAACG,aAAa,CAExC,CAAC;IAEHX,MAAM,CAACQ,cAAc,CAAC,CAACI,qBAAqB,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,sCAAsC,EAAE,YAAY;IACrD,MAAMW,iBAAiB,GAAG,MAAMT,MAAM,CAACK,aAAa,CAClDhB,WAAW,CAACqB,YACd,CAAC;IAEDb,YAAY,CAACY,iBAAiB,CAAC,CAACF,aAAa,CAE3C,CAAC;IAEHX,MAAM,CAACa,iBAAiB,CAAC,CAACD,qBAAqB,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMa,cAAc,GAAG,MAAMX,MAAM,CAACK,aAAa,CAC/CjB,QAAQ,CAACwB,UACX,CAAC;IAEDf,YAAY,CAACc,cAAc,CAAC,CAACJ,aAAa,CAAiB,CAAC;IAE5DX,MAAM,CAACe,cAAc,CAAC,CAACH,qBAAqB,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,kCAAkC,EAAE,YAAY;IACjD,MAAMe,aAAa,GAAG,MAAMb,MAAM,CAACK,aAAa,CAC9Cd,QAAQ,CAACuB,kBACX,CAAC;IAEDjB,YAAY,CAACgB,aAAa,CAAC,CAACN,aAAa,CAAgB,CAAC;IAE1DX,MAAM,CAACiB,aAAa,CAAC,CAACL,qBAAqB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/build/browser/index.js
CHANGED
|
@@ -21,4 +21,5 @@ export { createClient } from "./createClient.js";
|
|
|
21
21
|
export { createPlatformClient } from "./createPlatformClient.js";
|
|
22
22
|
export { createAttachmentUpload } from "./object/AttachmentUpload.js";
|
|
23
23
|
export { extractDate, extractDateInLocalTime, extractDateInUTC } from "./util/datetimeConverters.js";
|
|
24
|
+
export { createObjectSpecifierFromPrimaryKey } from "./util/objectSpecifierUtils.js";
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["isOk","NULL_VALUE","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","extractDate","extractDateInLocalTime","extractDateInUTC"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2023 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 ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n Attachment,\n CompileTimeMetadata,\n InterfaceDefinition,\n Logger,\n ObjectMetadata,\n ObjectSet,\n ObjectSpecifier,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n OsdkObjectCreatePropertyType,\n OsdkObjectPropertyType,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Range,\n Result,\n SingleLinkAccessor,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { isOk, NULL_VALUE } from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport type { ResultOrError } from \"./ResultOrError.js\";\n\nexport {\n extractDate,\n extractDateInLocalTime,\n extractDateInUTC,\n} from \"./util/datetimeConverters.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"file":"index.js","names":["isOk","NULL_VALUE","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","extractDate","extractDateInLocalTime","extractDateInUTC","createObjectSpecifierFromPrimaryKey"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2023 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 ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n Attachment,\n CompileTimeMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n Logger,\n ObjectMetadata,\n ObjectSet,\n ObjectSpecifier,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n OsdkObjectCreatePropertyType,\n OsdkObjectPropertyType,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Range,\n Result,\n SingleLinkAccessor,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { isOk, NULL_VALUE } from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport type { ResultOrError } from \"./ResultOrError.js\";\n\nexport {\n extractDate,\n extractDateInLocalTime,\n extractDateInUTC,\n} from \"./util/datetimeConverters.js\";\n\nexport { createObjectSpecifierFromPrimaryKey } from \"./util/objectSpecifierUtils.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuCA,SAASA,IAAI,EAAEC,UAAU,QAAQ,WAAW;AAC5C,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAE1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,SAASC,sBAAsB,QAAQ,8BAA8B;AAGrE,SACEC,WAAW,EACXC,sBAAsB,EACtBC,gBAAgB,QACX,8BAA8B;AAErC,SAASC,mCAAmC,QAAQ,gCAAgC","ignoreList":[]}
|
|
@@ -421,6 +421,36 @@ describe("aggregate", () => {
|
|
|
421
421
|
});
|
|
422
422
|
expectTypeOf(result[0].$group.text).toEqualTypeOf();
|
|
423
423
|
});
|
|
424
|
+
it("correctly does not null bucket type when $includeNullValue is not included", async () => {
|
|
425
|
+
const result = await client(Todo).aggregate({
|
|
426
|
+
$select: {
|
|
427
|
+
"id:avg": "unordered"
|
|
428
|
+
},
|
|
429
|
+
$groupBy: {
|
|
430
|
+
text: {
|
|
431
|
+
$exact: {
|
|
432
|
+
$limit: 10
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
expectTypeOf(result[0].$group.text).toEqualTypeOf();
|
|
438
|
+
});
|
|
439
|
+
it("correctly does not null bucket type when $defaultValue is specified", async () => {
|
|
440
|
+
const result = await client(Todo).aggregate({
|
|
441
|
+
$select: {
|
|
442
|
+
"id:avg": "unordered"
|
|
443
|
+
},
|
|
444
|
+
$groupBy: {
|
|
445
|
+
text: {
|
|
446
|
+
$exact: {
|
|
447
|
+
$defaultValue: "null"
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
expectTypeOf(result[0].$group.text).toEqualTypeOf();
|
|
453
|
+
});
|
|
424
454
|
it("disallows null values with ordering", () => {
|
|
425
455
|
void client(Todo).aggregate({
|
|
426
456
|
$select: {
|