@osdk/client 2.1.0-beta.2 → 2.1.0-beta.3
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 +21 -0
- package/build/browser/Client.d.ts +5 -2
- package/build/browser/Client.d.ts.map +1 -1
- package/build/browser/Client.js +2 -1
- package/build/browser/Client.js.map +1 -1
- package/build/browser/MinimalClientContext.d.ts +1 -1
- package/build/browser/MinimalClientContext.d.ts.map +1 -1
- package/build/browser/createClient.d.ts +1 -1
- package/build/browser/createClient.d.ts.map +1 -1
- package/build/browser/createClient.js +10 -2
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/createGeotimeSeriesProperty.d.ts +1 -1
- package/build/browser/createGeotimeSeriesProperty.d.ts.map +1 -1
- package/build/browser/createGeotimeSeriesProperty.js +4 -1
- package/build/browser/createGeotimeSeriesProperty.js.map +1 -1
- package/build/browser/createMinimalClient.js +2 -2
- package/build/browser/createMinimalClient.js.map +1 -1
- package/build/browser/createPlatformClient.d.ts +1 -1
- package/build/browser/createPlatformClient.d.ts.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +7 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js +10 -10
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js +40 -12
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +104 -19
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/browser/objectSet/createObjectSet.js +1 -1
- package/build/browser/objectSet/createObjectSet.js.map +1 -1
- package/build/browser/ontology/makeConjureContext.d.ts +1 -1
- package/build/browser/ontology/makeConjureContext.d.ts.map +1 -1
- package/build/browser/queries/applyQuery.js +1 -1
- package/build/browser/queries/applyQuery.js.map +1 -1
- package/build/browser/queries/queries.test.js +30 -2
- package/build/browser/queries/queries.test.js.map +1 -1
- package/build/browser/util/UserAgent.js +1 -1
- package/build/esm/Client.d.ts +5 -2
- package/build/esm/Client.d.ts.map +1 -1
- package/build/esm/Client.js +2 -1
- package/build/esm/Client.js.map +1 -1
- package/build/esm/MinimalClientContext.d.ts +1 -1
- package/build/esm/MinimalClientContext.d.ts.map +1 -1
- package/build/esm/createClient.d.ts +1 -1
- package/build/esm/createClient.d.ts.map +1 -1
- package/build/esm/createClient.js +10 -2
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/createGeotimeSeriesProperty.d.ts +1 -1
- package/build/esm/createGeotimeSeriesProperty.d.ts.map +1 -1
- package/build/esm/createGeotimeSeriesProperty.js +4 -1
- package/build/esm/createGeotimeSeriesProperty.js.map +1 -1
- package/build/esm/createMinimalClient.js +2 -2
- package/build/esm/createMinimalClient.js.map +1 -1
- package/build/esm/createPlatformClient.d.ts +1 -1
- package/build/esm/createPlatformClient.d.ts.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +7 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js +10 -10
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js +40 -12
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +104 -19
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/esm/objectSet/createObjectSet.js +1 -1
- package/build/esm/objectSet/createObjectSet.js.map +1 -1
- package/build/esm/ontology/makeConjureContext.d.ts +1 -1
- package/build/esm/ontology/makeConjureContext.d.ts.map +1 -1
- package/build/esm/queries/applyQuery.js +1 -1
- package/build/esm/queries/applyQuery.js.map +1 -1
- package/build/esm/queries/queries.test.js +30 -2
- package/build/esm/queries/queries.test.js.map +1 -1
- package/build/esm/util/UserAgent.js +1 -1
- package/package.json +11 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createObjectSet.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe","modernToLegacyWhereClause","aggregate","fetchPageInternal","fetchPageWithErrorsInternal","fetchSingle","fetchSingleWithErrors","augmentRequestContext","isWireObjectSet","ObjectSetListenerWebsocket","isObjectTypeDefinition","def","type","isObjectSet","o","objectSetDefinitions","get","getWireObjectSet","objectSet","WeakMap","createObjectSet","objectType","clientCtx","base","bind","globalThis","finalMethodCall","fetchPage","fetchPageWithErrors","where","clause","objectSetFactory","pivotTo","createSearchAround","union","objectSets","map","os","intersect","subtract","asyncIter","args","$nextPageToken","undefined","result","nextPageToken","obj","data","fetchOne","primaryKey","options","createWithPk","fetchOneWithErrors","properties","listener","pendingSubscribe","getInstance","subscribe","link","set","objDef","ontologyProvider","getObjectDefinition","apiName","withPk","field","primaryKeyApiName","value"],"sources":["createObjectSet.js"],"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 */\nimport { __EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe } from \"@osdk/api/unstable\";\nimport { modernToLegacyWhereClause } from \"../internal/conversions/modernToLegacyWhereClause.js\";\nimport { aggregate } from \"../object/aggregate.js\";\nimport { fetchPageInternal, fetchPageWithErrorsInternal, } from \"../object/fetchPage.js\";\nimport { fetchSingle, fetchSingleWithErrors } from \"../object/fetchSingle.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport { isWireObjectSet } from \"../util/WireObjectSet.js\";\nimport { ObjectSetListenerWebsocket } from \"./ObjectSetListenerWebsocket.js\";\nfunction isObjectTypeDefinition(def) {\n return def.type === \"object\";\n}\n/* @internal */\nexport function isObjectSet(o) {\n return o != null && typeof o === \"object\"\n && isWireObjectSet(objectSetDefinitions.get(o));\n}\n/** @internal */\nexport function getWireObjectSet(objectSet) {\n return objectSetDefinitions.get(objectSet);\n}\nconst objectSetDefinitions = new WeakMap();\n/** @internal */\nexport function createObjectSet(objectType, clientCtx, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"],\n}) {\n const base = {\n aggregate: (aggregate).bind(globalThis, augmentRequestContext(clientCtx, _ => ({ finalMethodCall: \"aggregate\" })), objectType, objectSet),\n fetchPage: fetchPageInternal.bind(globalThis, augmentRequestContext(clientCtx, _ => ({ finalMethodCall: \"fetchPage\" })), objectType, objectSet),\n fetchPageWithErrors: fetchPageWithErrorsInternal.bind(globalThis, augmentRequestContext(clientCtx, _ => ({ finalMethodCall: \"fetchPageWithErrors\" })), objectType, objectSet),\n where: (clause) => {\n return clientCtx.objectSetFactory(objectType, clientCtx, {\n type: \"filter\",\n objectSet: objectSet,\n where: modernToLegacyWhereClause(clause, objectType),\n });\n },\n pivotTo: function (type) {\n return createSearchAround(type)();\n },\n union: (...objectSets) => {\n return clientCtx.objectSetFactory(objectType, clientCtx, {\n type: \"union\",\n objectSets: [\n objectSet,\n ...objectSets.map(os => objectSetDefinitions.get(os)),\n ],\n });\n },\n intersect: (...objectSets) => {\n return clientCtx.objectSetFactory(objectType, clientCtx, {\n type: \"intersect\",\n objectSets: [\n objectSet,\n ...objectSets.map(os => objectSetDefinitions.get(os)),\n ],\n });\n },\n subtract: (...objectSets) => {\n return clientCtx.objectSetFactory(objectType, clientCtx, {\n type: \"subtract\",\n objectSets: [\n objectSet,\n ...objectSets.map(os => objectSetDefinitions.get(os)),\n ],\n });\n },\n asyncIter: async function* (args) {\n let $nextPageToken = undefined;\n do {\n const result = await fetchPageInternal(augmentRequestContext(clientCtx, _ => ({ finalMethodCall: \"asyncIter\" })), objectType, objectSet, { ...args, $nextPageToken });\n $nextPageToken = result.nextPageToken;\n for (const obj of result.data) {\n yield obj;\n }\n } while ($nextPageToken != null);\n },\n fetchOne: (isObjectTypeDefinition(objectType)\n ? async (primaryKey, options) => {\n return await fetchSingle(augmentRequestContext(clientCtx, _ => ({ finalMethodCall: \"fetchOne\" })), objectType, options, await createWithPk(clientCtx, objectType, objectSet, primaryKey));\n }\n : undefined),\n fetchOneWithErrors: (isObjectTypeDefinition(objectType)\n ? async (primaryKey, options) => {\n return await fetchSingleWithErrors(augmentRequestContext(clientCtx, _ => ({ finalMethodCall: \"fetchOneWithErrors\" })), objectType, options, await createWithPk(clientCtx, objectType, objectSet, primaryKey));\n }\n : undefined),\n [__EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe]: (properties, listener) => {\n const pendingSubscribe = ObjectSetListenerWebsocket.getInstance(clientCtx).subscribe(objectSet, listener, properties);\n return async () => (await pendingSubscribe)();\n },\n };\n function createSearchAround(link) {\n return () => {\n return clientCtx.objectSetFactory(objectType, clientCtx, {\n type: \"searchAround\",\n objectSet,\n link,\n });\n };\n }\n objectSetDefinitions.set(base, objectSet);\n // we are using a type assertion because the marker symbol defined in BaseObjectSet isn't actually used\n // at runtime.\n return base;\n}\nasync function createWithPk(clientCtx, objectType, objectSet, primaryKey) {\n const objDef = await clientCtx.ontologyProvider.getObjectDefinition(objectType.apiName);\n const withPk = {\n type: \"filter\",\n objectSet: objectSet,\n where: {\n type: \"eq\",\n field: objDef.primaryKeyApiName,\n value: primaryKey,\n },\n };\n return withPk;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,2CAA2C,QAAQ,oBAAoB;AAChF,SAASC,yBAAyB,QAAQ,sDAAsD;AAChG,SAASC,SAAS,QAAQ,wBAAwB;AAClD,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N,SAAU;IAChB,CAAC3C,2CAA2C,GAAG,CAACqD,UAAU,EAAEC,QAAQ,KAAK;MACrE,MAAMC,gBAAgB,GAAG9C,0BAA0B,CAAC+C,WAAW,CAAClC,SAAS,CAAC,CAACmC,SAAS,CAACvC,SAAS,EAAEoC,QAAQ,EAAED,UAAU,CAAC;MACrH,OAAO,YAAY,CAAC,MAAME,gBAAgB,EAAE,CAAC;IACjD;EACJ,CAAC;EACD,SAAStB,kBAAkBA,CAACyB,IAAI,EAAE;IAC9B,OAAO,MAAM;MACT,OAAOpC,SAAS,CAACS,gBAAgB,CAACV,UAAU,EAAEC,SAAS,EAAE;QACrDV,IAAI,EAAE,cAAc;QACpBM,SAAS;QACTwC;MACJ,CAAC,CAAC;IACN,CAAC;EACL;EACA3C,oBAAoB,CAAC4C,GAAG,CAACpC,IAAI,EAAEL,SAAS,CAAC;EACzC;EACA;EACA,OAAOK,IAAI;AACf;AACA,eAAe4B,YAAYA,CAAC7B,SAAS,EAAED,UAAU,EAAEH,SAAS,EAAE+B,UAAU,EAAE;EACtE,MAAMW,MAAM,GAAG,MAAMtC,SAAS,CAACuC,gBAAgB,CAACC,mBAAmB,CAACzC,UAAU,CAAC0C,OAAO,CAAC;EACvF,MAAMC,MAAM,GAAG;IACXpD,IAAI,EAAE,QAAQ;IACdM,SAAS,EAAEA,SAAS;IACpBW,KAAK,EAAE;MACHjB,IAAI,EAAE,IAAI;MACVqD,KAAK,EAAEL,MAAM,CAACM,iBAAiB;MAC/BC,KAAK,EAAElB;IACX;EACJ,CAAC;EACD,OAAOe,MAAM;AACjB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"createObjectSet.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe","modernToLegacyWhereClause","aggregate","fetchPageInternal","fetchPageWithErrorsInternal","fetchSingle","fetchSingleWithErrors","augmentRequestContext","isWireObjectSet","ObjectSetListenerWebsocket","isObjectTypeDefinition","def","type","isObjectSet","o","objectSetDefinitions","get","getWireObjectSet","objectSet","WeakMap","createObjectSet","objectType","clientCtx","base","bind","globalThis","finalMethodCall","fetchPage","fetchPageWithErrors","where","clause","objectSetFactory","pivotTo","createSearchAround","union","objectSets","map","os","intersect","subtract","asyncIter","args","$nextPageToken","undefined","result","nextPageToken","obj","data","fetchOne","primaryKey","options","createWithPk","fetchOneWithErrors","properties","listener","pendingSubscribe","getInstance","subscribe","link","set","objDef","ontologyProvider","getObjectDefinition","apiName","withPk","field","primaryKeyApiName","value"],"sources":["createObjectSet.js"],"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 */\nimport { __EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe } from \"@osdk/api/unstable\";\nimport { modernToLegacyWhereClause } from \"../internal/conversions/modernToLegacyWhereClause.js\";\nimport { aggregate } from \"../object/aggregate.js\";\nimport { fetchPageInternal, fetchPageWithErrorsInternal, } from \"../object/fetchPage.js\";\nimport { fetchSingle, fetchSingleWithErrors } from \"../object/fetchSingle.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport { isWireObjectSet } from \"../util/WireObjectSet.js\";\nimport { ObjectSetListenerWebsocket } from \"./ObjectSetListenerWebsocket.js\";\nfunction isObjectTypeDefinition(def) {\n return def.type === \"object\";\n}\n/* @internal */\nexport function isObjectSet(o) {\n return o != null && typeof o === \"object\"\n && isWireObjectSet(objectSetDefinitions.get(o));\n}\n/** @internal */\nexport function getWireObjectSet(objectSet) {\n return objectSetDefinitions.get(objectSet);\n}\nconst objectSetDefinitions = new WeakMap();\n/** @internal */\nexport function createObjectSet(objectType, clientCtx, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"],\n}) {\n const base = {\n aggregate: (aggregate).bind(globalThis, augmentRequestContext(clientCtx, _ => ({ finalMethodCall: \"aggregate\" })), objectType, objectSet),\n fetchPage: fetchPageInternal.bind(globalThis, augmentRequestContext(clientCtx, _ => ({ finalMethodCall: \"fetchPage\" })), objectType, objectSet),\n fetchPageWithErrors: fetchPageWithErrorsInternal.bind(globalThis, augmentRequestContext(clientCtx, _ => ({ finalMethodCall: \"fetchPageWithErrors\" })), objectType, objectSet),\n where: (clause) => {\n return clientCtx.objectSetFactory(objectType, clientCtx, {\n type: \"filter\",\n objectSet: objectSet,\n where: modernToLegacyWhereClause(clause, objectType),\n });\n },\n pivotTo: function (type) {\n return createSearchAround(type)();\n },\n union: (...objectSets) => {\n return clientCtx.objectSetFactory(objectType, clientCtx, {\n type: \"union\",\n objectSets: [\n objectSet,\n ...objectSets.map(os => objectSetDefinitions.get(os)),\n ],\n });\n },\n intersect: (...objectSets) => {\n return clientCtx.objectSetFactory(objectType, clientCtx, {\n type: \"intersect\",\n objectSets: [\n objectSet,\n ...objectSets.map(os => objectSetDefinitions.get(os)),\n ],\n });\n },\n subtract: (...objectSets) => {\n return clientCtx.objectSetFactory(objectType, clientCtx, {\n type: \"subtract\",\n objectSets: [\n objectSet,\n ...objectSets.map(os => objectSetDefinitions.get(os)),\n ],\n });\n },\n asyncIter: async function* (args) {\n let $nextPageToken = undefined;\n do {\n const result = await fetchPageInternal(augmentRequestContext(clientCtx, _ => ({ finalMethodCall: \"asyncIter\" })), objectType, objectSet, { ...args, $nextPageToken });\n $nextPageToken = result.nextPageToken;\n for (const obj of result.data) {\n yield obj;\n }\n } while ($nextPageToken != null);\n },\n fetchOne: (isObjectTypeDefinition(objectType)\n ? async (primaryKey, options) => {\n return await fetchSingle(augmentRequestContext(clientCtx, _ => ({ finalMethodCall: \"fetchOne\" })), objectType, options, await createWithPk(clientCtx, objectType, objectSet, primaryKey));\n }\n : undefined),\n fetchOneWithErrors: (isObjectTypeDefinition(objectType)\n ? async (primaryKey, options) => {\n return await fetchSingleWithErrors(augmentRequestContext(clientCtx, _ => ({ finalMethodCall: \"fetchOneWithErrors\" })), objectType, options, await createWithPk(clientCtx, objectType, objectSet, primaryKey));\n }\n : undefined),\n [__EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe]: (properties, listener) => {\n const pendingSubscribe = ObjectSetListenerWebsocket.getInstance(clientCtx).subscribe(objectType, objectSet, listener, properties);\n return async () => (await pendingSubscribe)();\n },\n };\n function createSearchAround(link) {\n return () => {\n return clientCtx.objectSetFactory(objectType, clientCtx, {\n type: \"searchAround\",\n objectSet,\n link,\n });\n };\n }\n objectSetDefinitions.set(base, objectSet);\n // we are using a type assertion because the marker symbol defined in BaseObjectSet isn't actually used\n // at runtime.\n return base;\n}\nasync function createWithPk(clientCtx, objectType, objectSet, primaryKey) {\n const objDef = await clientCtx.ontologyProvider.getObjectDefinition(objectType.apiName);\n const withPk = {\n type: \"filter\",\n objectSet: objectSet,\n where: {\n type: \"eq\",\n field: objDef.primaryKeyApiName,\n value: primaryKey,\n },\n };\n return withPk;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,2CAA2C,QAAQ,oBAAoB;AAChF,SAASC,yBAAyB,QAAQ,sDAAsD;AAChG,SAASC,SAAS,QAAQ,wBAAwB;AAClD,SAASC,iBAAiB,EAAEC,2BAA2B,QAAS,wBAAwB;AACxF,SAASC,WAAW,EAAEC,qBAAqB,QAAQ,0BAA0B;AAC7E,SAASC,qBAAqB,QAAQ,kCAAkC;AACxE,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,0BAA0B,QAAQ,iCAAiC;AAC5E,SAASC,sBAAsBA,CAACC,GAAG,EAAE;EACjC,OAAOA,GAAG,CAACC,IAAI,KAAK,QAAQ;AAChC;AACA;AACA,OAAO,S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yB,IAAI,EAAE;IAC9B,OAAO,MAAM;MACT,OAAOpC,SAAS,CAACS,gBAAgB,CAACV,UAAU,EAAEC,SAAS,EAAE;QACrDV,IAAI,EAAE,cAAc;QACpBM,SAAS;QACTwC;MACJ,CAAC,CAAC;IACN,CAAC;EACL;EACA3C,oBAAoB,CAAC4C,GAAG,CAACpC,IAAI,EAAEL,SAAS,CAAC;EACzC;EACA;EACA,OAAOK,IAAI;AACf;AACA,eAAe4B,YAAYA,CAAC7B,SAAS,EAAED,UAAU,EAAEH,SAAS,EAAE+B,UAAU,EAAE;EACtE,MAAMW,MAAM,GAAG,MAAMtC,SAAS,CAACuC,gBAAgB,CAACC,mBAAmB,CAACzC,UAAU,CAAC0C,OAAO,CAAC;EACvF,MAAMC,MAAM,GAAG;IACXpD,IAAI,EAAE,QAAQ;IACdM,SAAS,EAAEA,SAAS;IACpBW,KAAK,EAAE;MACHjB,IAAI,EAAE,IAAI;MACVqD,KAAK,EAAEL,MAAM,CAACM,iBAAiB;MAC/BC,KAAK,EAAElB;IACX;EACJ,CAAC;EACD,OAAOe,MAAM;AACjB","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SharedClientContext } from "@osdk/shared.
|
|
1
|
+
import type { SharedClientContext } from "@osdk/shared.client2";
|
|
2
2
|
import type { ConjureContext } from "conjure-lite";
|
|
3
3
|
export declare function makeConjureContext({ baseUrl, fetch: fetchFn, tokenProvider }: SharedClientContext, servicePath: string): ConjureContext;
|
|
4
4
|
//# sourceMappingURL=makeConjureContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeConjureContext.d.ts","sourceRoot":"","sources":["../../../src/ontology/makeConjureContext.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"makeConjureContext.d.ts","sourceRoot":"","sources":["../../../src/ontology/makeConjureContext.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,wBAAgB,kBAAkB,CAChC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,EAAE,mBAAmB,EAC/D,WAAW,EAAE,MAAM,GAClB,cAAc,CAOhB"}
|
|
@@ -204,7 +204,6 @@ function requiresConversion(dataType) {
|
|
|
204
204
|
case "float":
|
|
205
205
|
case "integer":
|
|
206
206
|
case "long":
|
|
207
|
-
case "object": // JSON encoded primary key
|
|
208
207
|
case "string":
|
|
209
208
|
case "timestamp":
|
|
210
209
|
return false;
|
|
@@ -218,6 +217,7 @@ function requiresConversion(dataType) {
|
|
|
218
217
|
case "objectSet":
|
|
219
218
|
case "twoDimensionalAggregation":
|
|
220
219
|
case "threeDimensionalAggregation":
|
|
220
|
+
case "object":
|
|
221
221
|
return true;
|
|
222
222
|
default:
|
|
223
223
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyQuery.js","names":["OntologiesV2","createAttachmentFromRid","createObjectSet","addUserAgentAndRequestContextHeaders","augmentRequestContext","toDataValueQueries","applyQuery","client","query","params","qd","ontologyProvider","getQueryDefinition","apiName","response","Queries","execute","finalMethodCall","ontologyRid","parameters","remapQueryParams","objectOutputDefs","getRequiredDefinitions","output","remappedResponse","remapQueryResponse","value","paramTypes","parameterMap","key","Object","entries","responseDataType","responseValue","definitions","nullable","undefined","Error","multiplicity","withoutMultiplicity","i","length","type","set","def","get","object","createQueryObjectResponse","objectSet","objectSets","objectType","reference","subtype","struct","requiresConversion","result","groups","push","subResult","subKey","dataType","Map","objectDef","getObjectDefinition","values","some","primaryKey","$apiName","$title","$objectType","$primaryKey"],"sources":["applyQuery.js"],"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 */\nimport * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport { createAttachmentFromRid } from \"../createAttachmentFromRid.js\";\nimport { createObjectSet } from \"../objectSet/createObjectSet.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport { toDataValueQueries } from \"../util/toDataValueQueries.js\";\nexport async function applyQuery(client, query, params) {\n const qd = await client.ontologyProvider.getQueryDefinition(query.apiName);\n const response = await OntologiesV2.Queries.execute(addUserAgentAndRequestContextHeaders(augmentRequestContext(client, _ => ({ finalMethodCall: \"applyQuery\" })), query), await client.ontologyRid, query.apiName, {\n parameters: params\n ? await remapQueryParams(params, client, qd.parameters)\n : {},\n });\n const objectOutputDefs = await getRequiredDefinitions(qd.output, client);\n const remappedResponse = await remapQueryResponse(client, qd.output, response.value, objectOutputDefs);\n return remappedResponse;\n}\nasync function remapQueryParams(params, client, paramTypes) {\n const parameterMap = {};\n for (const [key, value] of Object.entries(params)) {\n parameterMap[key] = await toDataValueQueries(value, client, paramTypes[key]);\n }\n return parameterMap;\n}\nasync function remapQueryResponse(client, responseDataType, responseValue, definitions) {\n // handle null responses\n if (responseValue == null) {\n if (responseDataType.nullable) {\n return undefined;\n }\n else {\n throw new Error(\"Got null response when nullable was not allowed\");\n }\n }\n if (responseDataType.multiplicity != null\n && responseDataType.multiplicity !== false) {\n const withoutMultiplicity = { ...responseDataType, multiplicity: false };\n for (let i = 0; i < responseValue.length; i++) {\n responseValue[i] = await remapQueryResponse(client, withoutMultiplicity, responseValue[i], definitions);\n }\n return responseValue;\n }\n switch (responseDataType.type) {\n case \"union\": {\n throw new Error(\"Union return types are not yet supported\");\n }\n case \"set\": {\n for (let i = 0; i < responseValue.length; i++) {\n responseValue[i] = await remapQueryResponse(client, responseDataType.set, responseValue[i], definitions);\n }\n return responseValue;\n }\n case \"attachment\": {\n return createAttachmentFromRid(client, responseValue);\n }\n case \"object\": {\n const def = definitions.get(responseDataType.object);\n if (!def) {\n throw new Error(`Missing definition for ${responseDataType.object}`);\n }\n return createQueryObjectResponse(responseValue, def);\n }\n case \"objectSet\": {\n const def = definitions.get(responseDataType.objectSet);\n if (!def) {\n throw new Error(`Missing definition for ${responseDataType.objectSet}`);\n }\n if (typeof responseValue === \"string\") {\n return createObjectSet(def, client, {\n type: \"intersect\",\n objectSets: [\n { type: \"base\", objectType: responseDataType.objectSet },\n { type: \"reference\", reference: responseValue },\n ],\n });\n }\n return createObjectSet(def, client, responseValue);\n }\n case \"struct\": {\n // figure out what keys need to be fixed up\n for (const [key, subtype] of Object.entries(responseDataType.struct)) {\n if (requiresConversion(subtype)) {\n responseValue[key] = await remapQueryResponse(client, subtype, responseValue[key], definitions);\n }\n }\n return responseValue;\n }\n case \"twoDimensionalAggregation\": {\n const result = [];\n for (const { key, value } of responseValue.groups) {\n result.push({ key, value });\n }\n return result;\n }\n case \"threeDimensionalAggregation\": {\n const result = [];\n for (const { key, groups } of responseValue.groups) {\n const subResult = [];\n for (const { key: subKey, value } of groups) {\n subResult.push({ key: subKey, value });\n }\n result.push({ key, groups: subResult });\n }\n return result;\n }\n }\n return responseValue;\n}\nasync function getRequiredDefinitions(dataType, client) {\n const result = new Map();\n switch (dataType.type) {\n case \"objectSet\": {\n const objectDef = await client.ontologyProvider.getObjectDefinition(dataType.objectSet);\n result.set(dataType.objectSet, objectDef);\n break;\n }\n case \"object\": {\n const objectDef = await client.ontologyProvider.getObjectDefinition(dataType.object);\n result.set(dataType.object, objectDef);\n break;\n }\n case \"set\": {\n return getRequiredDefinitions(dataType.set, client);\n }\n case \"struct\": {\n for (const value of Object.values(dataType.struct)) {\n for (const [type, objectDef] of await getRequiredDefinitions(value, client)) {\n result.set(type, objectDef);\n }\n }\n break;\n }\n case \"attachment\":\n case \"boolean\":\n case \"date\":\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"object\":\n case \"string\":\n case \"threeDimensionalAggregation\":\n case \"timestamp\":\n case \"twoDimensionalAggregation\":\n case \"union\":\n break;\n }\n return result;\n}\nfunction requiresConversion(dataType) {\n switch (dataType.type) {\n case \"boolean\":\n case \"date\":\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"object\": // JSON encoded primary key\n case \"string\":\n case \"timestamp\":\n return false;\n case \"union\":\n return true;\n case \"struct\":\n return Object.values(dataType.struct).some(requiresConversion);\n case \"set\":\n return requiresConversion(dataType.set);\n case \"attachment\":\n case \"objectSet\":\n case \"twoDimensionalAggregation\":\n case \"threeDimensionalAggregation\":\n return true;\n default:\n return false;\n }\n}\nexport function createQueryObjectResponse(primaryKey, objectDef) {\n return {\n $apiName: objectDef.apiName,\n $title: undefined,\n $objectType: objectDef.apiName,\n $primaryKey: primaryKey,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,qCAAqC;AACnE,SAASC,uBAAuB,QAAQ,+BAA+B;AACvE,SAASC,eAAe,QAAQ,iCAAiC;AACjE,SAASC,oCAAoC,QAAQ,iDAAiD;AACtG,SAASC,qBAAqB,QAAQ,kCAAkC;AACxE,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,OAAO,eAAeC,UAAUA,CAACC,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAE;EACpD,MAAMC,EAAE,GAAG,MAAMH,MAAM,CAACI,gBAAgB,CAACC,kBAAkB,CAACJ,KAAK,CAACK,OAAO,CAAC;EAC1E,MAAMC,QAAQ,GAAG,MAAMd,YAAY,CAACe,O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,CAAC;AACL","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"applyQuery.js","names":["OntologiesV2","createAttachmentFromRid","createObjectSet","addUserAgentAndRequestContextHeaders","augmentRequestContext","toDataValueQueries","applyQuery","client","query","params","qd","ontologyProvider","getQueryDefinition","apiName","response","Queries","execute","finalMethodCall","ontologyRid","parameters","remapQueryParams","objectOutputDefs","getRequiredDefinitions","output","remappedResponse","remapQueryResponse","value","paramTypes","parameterMap","key","Object","entries","responseDataType","responseValue","definitions","nullable","undefined","Error","multiplicity","withoutMultiplicity","i","length","type","set","def","get","object","createQueryObjectResponse","objectSet","objectSets","objectType","reference","subtype","struct","requiresConversion","result","groups","push","subResult","subKey","dataType","Map","objectDef","getObjectDefinition","values","some","primaryKey","$apiName","$title","$objectType","$primaryKey"],"sources":["applyQuery.js"],"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 */\nimport * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport { createAttachmentFromRid } from \"../createAttachmentFromRid.js\";\nimport { createObjectSet } from \"../objectSet/createObjectSet.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport { toDataValueQueries } from \"../util/toDataValueQueries.js\";\nexport async function applyQuery(client, query, params) {\n const qd = await client.ontologyProvider.getQueryDefinition(query.apiName);\n const response = await OntologiesV2.Queries.execute(addUserAgentAndRequestContextHeaders(augmentRequestContext(client, _ => ({ finalMethodCall: \"applyQuery\" })), query), await client.ontologyRid, query.apiName, {\n parameters: params\n ? await remapQueryParams(params, client, qd.parameters)\n : {},\n });\n const objectOutputDefs = await getRequiredDefinitions(qd.output, client);\n const remappedResponse = await remapQueryResponse(client, qd.output, response.value, objectOutputDefs);\n return remappedResponse;\n}\nasync function remapQueryParams(params, client, paramTypes) {\n const parameterMap = {};\n for (const [key, value] of Object.entries(params)) {\n parameterMap[key] = await toDataValueQueries(value, client, paramTypes[key]);\n }\n return parameterMap;\n}\nasync function remapQueryResponse(client, responseDataType, responseValue, definitions) {\n // handle null responses\n if (responseValue == null) {\n if (responseDataType.nullable) {\n return undefined;\n }\n else {\n throw new Error(\"Got null response when nullable was not allowed\");\n }\n }\n if (responseDataType.multiplicity != null\n && responseDataType.multiplicity !== false) {\n const withoutMultiplicity = { ...responseDataType, multiplicity: false };\n for (let i = 0; i < responseValue.length; i++) {\n responseValue[i] = await remapQueryResponse(client, withoutMultiplicity, responseValue[i], definitions);\n }\n return responseValue;\n }\n switch (responseDataType.type) {\n case \"union\": {\n throw new Error(\"Union return types are not yet supported\");\n }\n case \"set\": {\n for (let i = 0; i < responseValue.length; i++) {\n responseValue[i] = await remapQueryResponse(client, responseDataType.set, responseValue[i], definitions);\n }\n return responseValue;\n }\n case \"attachment\": {\n return createAttachmentFromRid(client, responseValue);\n }\n case \"object\": {\n const def = definitions.get(responseDataType.object);\n if (!def) {\n throw new Error(`Missing definition for ${responseDataType.object}`);\n }\n return createQueryObjectResponse(responseValue, def);\n }\n case \"objectSet\": {\n const def = definitions.get(responseDataType.objectSet);\n if (!def) {\n throw new Error(`Missing definition for ${responseDataType.objectSet}`);\n }\n if (typeof responseValue === \"string\") {\n return createObjectSet(def, client, {\n type: \"intersect\",\n objectSets: [\n { type: \"base\", objectType: responseDataType.objectSet },\n { type: \"reference\", reference: responseValue },\n ],\n });\n }\n return createObjectSet(def, client, responseValue);\n }\n case \"struct\": {\n // figure out what keys need to be fixed up\n for (const [key, subtype] of Object.entries(responseDataType.struct)) {\n if (requiresConversion(subtype)) {\n responseValue[key] = await remapQueryResponse(client, subtype, responseValue[key], definitions);\n }\n }\n return responseValue;\n }\n case \"twoDimensionalAggregation\": {\n const result = [];\n for (const { key, value } of responseValue.groups) {\n result.push({ key, value });\n }\n return result;\n }\n case \"threeDimensionalAggregation\": {\n const result = [];\n for (const { key, groups } of responseValue.groups) {\n const subResult = [];\n for (const { key: subKey, value } of groups) {\n subResult.push({ key: subKey, value });\n }\n result.push({ key, groups: subResult });\n }\n return result;\n }\n }\n return responseValue;\n}\nasync function getRequiredDefinitions(dataType, client) {\n const result = new Map();\n switch (dataType.type) {\n case \"objectSet\": {\n const objectDef = await client.ontologyProvider.getObjectDefinition(dataType.objectSet);\n result.set(dataType.objectSet, objectDef);\n break;\n }\n case \"object\": {\n const objectDef = await client.ontologyProvider.getObjectDefinition(dataType.object);\n result.set(dataType.object, objectDef);\n break;\n }\n case \"set\": {\n return getRequiredDefinitions(dataType.set, client);\n }\n case \"struct\": {\n for (const value of Object.values(dataType.struct)) {\n for (const [type, objectDef] of await getRequiredDefinitions(value, client)) {\n result.set(type, objectDef);\n }\n }\n break;\n }\n case \"attachment\":\n case \"boolean\":\n case \"date\":\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"object\":\n case \"string\":\n case \"threeDimensionalAggregation\":\n case \"timestamp\":\n case \"twoDimensionalAggregation\":\n case \"union\":\n break;\n }\n return result;\n}\nfunction requiresConversion(dataType) {\n switch (dataType.type) {\n case \"boolean\":\n case \"date\":\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"string\":\n case \"timestamp\":\n return false;\n case \"union\":\n return true;\n case \"struct\":\n return Object.values(dataType.struct).some(requiresConversion);\n case \"set\":\n return requiresConversion(dataType.set);\n case \"attachment\":\n case \"objectSet\":\n case \"twoDimensionalAggregation\":\n case \"threeDimensionalAggregation\":\n case \"object\":\n return true;\n default:\n return false;\n }\n}\nexport function createQueryObjectResponse(primaryKey, objectDef) {\n return {\n $apiName: objectDef.apiName,\n $title: undefined,\n $objectType: objectDef.apiName,\n $primaryKey: primaryKey,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,qCAAqC;AACnE,SAASC,uBAAuB,QAAQ,+BAA+B;AACvE,SAASC,eAAe,QAAQ,iCAAiC;AACjE,SAASC,oCAAoC,QAAQ,iDAAiD;AACtG,SAASC,qBAAqB,QAAQ,kCAAkC;AACxE,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,OAAO,eAAeC,UAAUA,CAACC,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAE;EACpD,MAAMC,EAAE,GAAG,MAAMH,MAAM,CAACI,gBAAgB,CAACC,kBAAkB,CAACJ,KAAK,CAACK,OAAO,CAAC;EAC1E,MAAMC,QAAQ,GAAG,MAAMd,YAAY,CAACe,OAAO,CAACC,OAAO,CAACb,oCAAoC,CAACC,qBAAqB,CAACG,MAAM,EAAE,OAAM;IAAEU,eAAe,EAAE;EAAa,CAAC,CAAC,CAAC,EAAET,KAAK,CAAC,EAAE,MAAMD,MAAM,CAACW,WAAW,EAAEV,KAAK,CAACK,OAAO,EAAE;IAC/MM,UAAU,EAAEV,MAAM,GACZ,MAAMW,gBAAgB,CAACX,MAAM,EAAEF,MAAM,EAAEG,EAAE,CAACS,UAAU,CAAC,GACrD,CAAC;EACX,CAAC,CAAC;EACF,MAAME,gBAAgB,GAAG,MAAMC,sBAAsB,CAACZ,EAAE,CAACa,MAAM,EAAEhB,MAAM,CAAC;EACxE,MAAMiB,gBAAgB,GAAG,MAAMC,kBAAkB,CAAClB,MAAM,EAAEG,EAAE,CAACa,MAAM,EAAET,QAAQ,CAACY,KAAK,EAAEL,gBAAgB,CAAC;EACtG,OAAOG,gBAAgB;AAC3B;AACA,eAAeJ,gBAAgBA,CAACX,MAAM,EAAEF,MAAM,EAAEoB,UAAU,EA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ChB,KAAK,OAAO;MACR,OAAO,IAAI;IACf,KAAK,QAAQ;MACT,OAAOZ,MAAM,CAACkC,MAAM,CAACJ,QAAQ,CAACP,MAAM,CAAC,CAACY,IAAI,CAACX,kBAAkB,CAAC;IAClE,KAAK,KAAK;MACN,OAAOA,kBAAkB,CAACM,QAAQ,CAACjB,GAAG,CAAC;IAC3C,KAAK,YAAY;IACjB,KAAK,WAAW;IAChB,KAAK,2BAA2B;IAChC,KAAK,6BAA6B;IAClC,KAAK,QAAQ;MACT,OAAO,IAAI;IACf;MACI,OAAO,KAAK;EACpB;AACJ;AACA,OAAO,SAASI,yBAAyBA,CAACmB,UAAU,EAAEJ,SAAS,EAAE;EAC7D,OAAO;IACHK,QAAQ,EAAEL,SAAS,CAACjD,OAAO;IAC3BuD,MAAM,EAAEhC,SAAS;IACjBiC,WAAW,EAAEP,SAAS,CAACjD,OAAO;IAC9ByD,WAAW,EAAEJ;EACjB,CAAC;AACL","ignoreList":[]}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { $ontologyRid, $Queries, acceptsThreeDimensionalAggregationFunction, acceptsTwoDimensionalAggregationFunction, addOne, Employee, incrementPersonAge, queryAcceptsObject, queryAcceptsObjectSets, returnsDate, returnsTimestamp, threeDimensionalAggregationFunction, twoDimensionalAggregationFunction } from "@osdk/client.test.ontology";
|
|
16
|
+
import { $ontologyRid, $Queries, acceptsThreeDimensionalAggregationFunction, acceptsTwoDimensionalAggregationFunction, addOne, Employee, incrementPersonAge, incrementPersonAgeComplex, queryAcceptsObject, queryAcceptsObjectSets, returnsDate, returnsTimestamp, threeDimensionalAggregationFunction, twoDimensionalAggregationFunction } from "@osdk/client.test.ontology";
|
|
17
17
|
import { apiServer } from "@osdk/shared.test";
|
|
18
18
|
import { afterAll, beforeAll, describe, expect, expectTypeOf, it } from "vitest";
|
|
19
19
|
import { createClient } from "../createClient.js";
|
|
@@ -79,6 +79,27 @@ describe("queries", () => {
|
|
|
79
79
|
age: 43
|
|
80
80
|
});
|
|
81
81
|
});
|
|
82
|
+
it("returns and accepts complex structs property", async () => {
|
|
83
|
+
const employee = await client(Employee).fetchOne(50030);
|
|
84
|
+
const result = await client(incrementPersonAgeComplex).executeFunction({
|
|
85
|
+
person: {
|
|
86
|
+
firstName: "John",
|
|
87
|
+
lastName: "Doe",
|
|
88
|
+
age: 42,
|
|
89
|
+
object: employee
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
expect(result).toEqual({
|
|
93
|
+
firstName: "John",
|
|
94
|
+
lastName: "Doe",
|
|
95
|
+
age: 43,
|
|
96
|
+
object: {
|
|
97
|
+
$apiName: "Employee",
|
|
98
|
+
$objectType: "Employee",
|
|
99
|
+
$primaryKey: 50031
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
82
103
|
it("two dimensional aggregation response works", async () => {
|
|
83
104
|
const result = await client(twoDimensionalAggregationFunction).executeFunction();
|
|
84
105
|
expect(result).toEqual([{
|
|
@@ -163,9 +184,16 @@ describe("queries", () => {
|
|
|
163
184
|
groups: []
|
|
164
185
|
}]);
|
|
165
186
|
});
|
|
187
|
+
it("accepts and returns objects", async () => {
|
|
188
|
+
const employeeObjectSet = client(Employee);
|
|
189
|
+
await client(queryAcceptsObjectSets).executeFunction({
|
|
190
|
+
objectSet: employeeObjectSet
|
|
191
|
+
});
|
|
192
|
+
expectTypeOf().toMatchTypeOf();
|
|
193
|
+
});
|
|
166
194
|
it("queries are enumerable", async () => {
|
|
167
195
|
const queries = Object.keys($Queries);
|
|
168
|
-
expect(queries).toStrictEqual(["acceptsThreeDimensionalAggregationFunction", "acceptsTwoDimensionalAggregationFunction", "addOne", "incrementPersonAge", "queryAcceptsObject", "queryAcceptsObjectSets", "queryTypeReturnsArray", "returnsDate", "returnsObject", "returnsTimestamp", "threeDimensionalAggregationFunction", "twoDimensionalAggregationFunction"]);
|
|
196
|
+
expect(queries).toStrictEqual(["acceptsThreeDimensionalAggregationFunction", "acceptsTwoDimensionalAggregationFunction", "addOne", "incrementPersonAge", "incrementPersonAgeComplex", "queryAcceptsObject", "queryAcceptsObjectSets", "queryTypeReturnsArray", "returnsDate", "returnsObject", "returnsTimestamp", "threeDimensionalAggregationFunction", "twoDimensionalAggregationFunction"]);
|
|
169
197
|
});
|
|
170
198
|
it("queries work with arrays", async () => {
|
|
171
199
|
const result = await client($Queries.queryTypeReturnsArray).executeFunction({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.test.js","names":["$ontologyRid","$Queries","acceptsThreeDimensionalAggregationFunction","acceptsTwoDimensionalAggregationFunction","addOne","Employee","incrementPersonAge","queryAcceptsObject","queryAcceptsObjectSets","returnsDate","returnsTimestamp","threeDimensionalAggregationFunction","twoDimensionalAggregationFunction","apiServer","afterAll","beforeAll","describe","expect","expectTypeOf","it","createClient","client","listen","close","result","executeFunction","n","toBe","employee","fetchOne","object","toEqual","$apiName","$objectType","$primaryKey","result2","employeeObjectSet","objectSet","toMatchTypeOf","resultWithTimestamp","resultWithDate","person","firstName","lastName","age","key","value","aggFunction","groups","startValue","endValue","fail","e","message","toMatch","queries","Object","keys","toStrictEqual","queryTypeReturnsArray","people"],"sources":["queries.test.js"],"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 */\nimport { $ontologyRid, $Queries, acceptsThreeDimensionalAggregationFunction, acceptsTwoDimensionalAggregationFunction, addOne, Employee, incrementPersonAge, queryAcceptsObject, queryAcceptsObjectSets, returnsDate, returnsTimestamp, threeDimensionalAggregationFunction, twoDimensionalAggregationFunction, } from \"@osdk/client.test.ontology\";\nimport { apiServer } from \"@osdk/shared.test\";\nimport { afterAll, beforeAll, describe, expect, expectTypeOf, it, } from \"vitest\";\nimport { createClient } from \"../createClient.js\";\ndescribe(\"queries\", () => {\n let client;\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\"https://stack.palantir.com\", $ontologyRid, async () => \"myAccessToken\");\n });\n afterAll(() => {\n apiServer.close();\n });\n it(\"simple query works\", async () => {\n const result = await client(addOne).executeFunction({ n: 2 });\n expect(result).toBe(3);\n });\n it(\"accepts objects\", async () => {\n const employee = await client(Employee).fetchOne(50030);\n const result = await client(queryAcceptsObject).executeFunction({\n object: employee,\n });\n expect(result).toEqual({\n $apiName: \"Employee\",\n $objectType: \"Employee\",\n $primaryKey: 50031,\n });\n // Should also accept primary keys\n const result2 = await client(queryAcceptsObject).executeFunction({\n object: 50030,\n });\n expect(result2).toEqual({\n $apiName: \"Employee\",\n $objectType: \"Employee\",\n $primaryKey: 50031,\n });\n });\n it(\"accepts objectSets\", async () => {\n const employeeObjectSet = client(Employee);\n const result = await client(queryAcceptsObjectSets).executeFunction({\n objectSet: employeeObjectSet,\n });\n expectTypeOf().toMatchTypeOf();\n });\n it(\"no params work\", async () => {\n const resultWithTimestamp = await client(returnsTimestamp)\n .executeFunction();\n expect(resultWithTimestamp).toBe(\"2019-01-01T00:00:00.000Z\");\n const resultWithDate = await client(returnsDate).executeFunction();\n expect(resultWithDate).toBe(\"2019-01-01\");\n });\n it(\"returns and accepts structs property\", async () => {\n const result = await client(incrementPersonAge).executeFunction({\n person: { firstName: \"John\", lastName: \"Doe\", age: 42 },\n });\n expect(result).toEqual({\n firstName: \"John\",\n lastName: \"Doe\",\n age: 43,\n });\n });\n it(\"two dimensional aggregation response works\", async () => {\n const result = await client(twoDimensionalAggregationFunction)\n .executeFunction();\n expect(result).toEqual([{ key: \"Q-AFN\", value: 1 }, {\n key: \"Q-AFO\",\n value: 2,\n }]);\n });\n it(\"two dimensional aggregation request/response works\", async () => {\n const result = await client(acceptsTwoDimensionalAggregationFunction)\n .executeFunction({\n aggFunction: [\n {\n key: \"testKey1\",\n value: 1,\n },\n {\n key: \"testKey2\",\n value: 2,\n },\n ],\n });\n expect(result).toEqual([{ key: \"responseKey1\", value: 3 }, {\n key: \"responseKey2\",\n value: 4,\n }]);\n });\n it(\"three dimensional aggregation response works\", async () => {\n const result = await client(threeDimensionalAggregationFunction)\n .executeFunction();\n expect(result).toEqual([{\n key: \"Q-AFN\",\n groups: [{\n key: {\n startValue: \"2010-10-01T00:00:00Z\",\n endValue: \"2010-10-02T00:00:00Z\",\n },\n value: 65.0,\n }],\n }, { key: \"Q-AFO\", groups: [] }]);\n });\n it(\"throws when response is null and response is non-nullable\", async () => {\n try {\n const result = await client(addOne).executeFunction({ n: 3 });\n expect.fail(\"Should not reach here\");\n }\n catch (e) {\n expect(e.message).toMatch(`Got null response when nullable was not allowed`);\n }\n });\n it(\"three dimensional aggregation request/response works\", async () => {\n const result = await client(acceptsThreeDimensionalAggregationFunction)\n .executeFunction({\n aggFunction: [\n {\n key: \"testKey1\",\n groups: [\n {\n key: {\n startValue: \"2010-10-01T00:00:00Z\",\n endValue: \"2010-10-02T00:00:00Z\",\n },\n value: 65.0,\n },\n ],\n },\n {\n key: \"testKey2\",\n groups: [],\n },\n ],\n });\n expect(result).toEqual([\n {\n key: \"Q-AFN\",\n groups: [\n {\n key: {\n startValue: \"2010-10-01T00:00:00Z\",\n endValue: \"2010-10-02T00:00:00Z\",\n },\n value: 65.0,\n },\n ],\n },\n {\n key: \"Q-AFO\",\n groups: [],\n },\n ]);\n });\n it(\"queries are enumerable\", async () => {\n const queries = Object.keys($Queries);\n expect(queries).toStrictEqual([\n \"acceptsThreeDimensionalAggregationFunction\",\n \"acceptsTwoDimensionalAggregationFunction\",\n \"addOne\",\n \"incrementPersonAge\",\n \"queryAcceptsObject\",\n \"queryAcceptsObjectSets\",\n \"queryTypeReturnsArray\",\n \"returnsDate\",\n \"returnsObject\",\n \"returnsTimestamp\",\n \"threeDimensionalAggregationFunction\",\n \"twoDimensionalAggregationFunction\",\n ]);\n });\n it(\"queries work with arrays\", async () => {\n const result = await client($Queries.queryTypeReturnsArray).executeFunction({ people: [\"Brad\", \"George\", \"Ryan\"] });\n expect(result).toEqual([\"Pitt\", \"Clooney\", \"Reynolds\"]);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,QAAQ,EAAEC,0CAA0C,EAAEC,wCAAwC,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,kBAAkB,EAAEC,kBAAkB,EAAEC,sBAAsB,EAAEC,WAAW,EAAEC,gBAAgB,EAAEC,mCAAmC,EAAEC,iCAAiC,QAAS,4BAA4B;AACnV,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAS,QAAQ;AACjF,SAASC,YAAY,QAAQ,oBAAoB;AACjDJ,QAAQ,CAAC,SAAS,EAAE,MAAM;EACtB,IAAIK,MAAM;EACVN,SAAS,CAAC,YAAY;IAClBF,SAAS,CAACS,MAAM,CAAC,CAAC;IAClBD,MAAM,GAAGD,YAAY,CAAC,4BAA4B,EAAEpB,YAAY,EAAE,YAAY,eAAe,CAAC;EAClG,CAAC,CAAC;EACFc,QAAQ,CAAC,MAAM;IACXD,SAAS,CAACU,KAAK,CAAC,CAAC;EACrB,CAAC,CAAC;EACFJ,EAAE,CAAC,oBAAoB,EAAE,YAAY;IACjC,MAAMK,MAAM,GAAG,MAAMH,MAAM,CAACjB,MAAM,CAAC,CAACqB,eAAe,CAAC;MAAEC,CAAC,EAAE;IAAE,CAAC,CAAC;IAC7DT,MAAM,CAACO,MAAM,CAAC,CAACG,IAA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CAAC,CAACO,OAAO,CAAC,CACnB;MACIc,GAAG,EAAE,OAAO;MACZG,MAAM,EAAE,CACJ;QACIH,GAAG,EAAE;UACDI,UAAU,EAAE,sBAAsB;UAClCC,QAAQ,EAAE;QACd,CAAC;QACDJ,KAAK,EAAE;MACX,CAAC;IAET,CAAC,EACD;MACID,GAAG,EAAE,OAAO;MACZG,MAAM,EAAE;IACZ,CAAC,CACJ,CAAC;EACN,CAAC,CAAC;EACF7B,EAAE,CAAC,wBAAwB,EAAE,YAAY;IACrC,MAAMoC,OAAO,GAAGC,MAAM,CAACC,IAAI,CAACxD,QAAQ,CAAC;IACrCgB,MAAM,CAACsC,OAAO,CAAC,CAACG,aAAa,CAAC,CAC1B,4CAA4C,EAC5C,0CAA0C,EAC1C,QAAQ,EACR,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,qCAAqC,EACrC,mCAAmC,CACtC,CAAC;EACN,CAAC,CAAC;EACFvC,EAAE,CAAC,0BAA0B,EAAE,YAAY;IACvC,MAAMK,MAAM,GAAG,MAAMH,MAAM,CAACpB,QAAQ,CAAC0D,qBAAqB,CAAC,CAAClC,eAAe,CAAC;MAAEmC,MAAM,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM;IAAE,CAAC,CAAC;IACnH3C,MAAM,CAACO,MAAM,CAAC,CAACO,OAAO,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;EAC3D,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"queries.test.js","names":["$ontologyRid","$Queries","acceptsThreeDimensionalAggregationFunction","acceptsTwoDimensionalAggregationFunction","addOne","Employee","incrementPersonAge","incrementPersonAgeComplex","queryAcceptsObject","queryAcceptsObjectSets","returnsDate","returnsTimestamp","threeDimensionalAggregationFunction","twoDimensionalAggregationFunction","apiServer","afterAll","beforeAll","describe","expect","expectTypeOf","it","createClient","client","listen","close","result","executeFunction","n","toBe","employee","fetchOne","object","toEqual","$apiName","$objectType","$primaryKey","result2","employeeObjectSet","objectSet","toMatchTypeOf","resultWithTimestamp","resultWithDate","person","firstName","lastName","age","key","value","aggFunction","groups","startValue","endValue","fail","e","message","toMatch","queries","Object","keys","toStrictEqual","queryTypeReturnsArray","people"],"sources":["queries.test.js"],"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 */\nimport { $ontologyRid, $Queries, acceptsThreeDimensionalAggregationFunction, acceptsTwoDimensionalAggregationFunction, addOne, Employee, incrementPersonAge, incrementPersonAgeComplex, queryAcceptsObject, queryAcceptsObjectSets, returnsDate, returnsTimestamp, threeDimensionalAggregationFunction, twoDimensionalAggregationFunction, } from \"@osdk/client.test.ontology\";\nimport { apiServer } from \"@osdk/shared.test\";\nimport { afterAll, beforeAll, describe, expect, expectTypeOf, it, } from \"vitest\";\nimport { createClient } from \"../createClient.js\";\ndescribe(\"queries\", () => {\n let client;\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\"https://stack.palantir.com\", $ontologyRid, async () => \"myAccessToken\");\n });\n afterAll(() => {\n apiServer.close();\n });\n it(\"simple query works\", async () => {\n const result = await client(addOne).executeFunction({ n: 2 });\n expect(result).toBe(3);\n });\n it(\"accepts objects\", async () => {\n const employee = await client(Employee).fetchOne(50030);\n const result = await client(queryAcceptsObject).executeFunction({\n object: employee,\n });\n expect(result).toEqual({\n $apiName: \"Employee\",\n $objectType: \"Employee\",\n $primaryKey: 50031,\n });\n // Should also accept primary keys\n const result2 = await client(queryAcceptsObject).executeFunction({\n object: 50030,\n });\n expect(result2).toEqual({\n $apiName: \"Employee\",\n $objectType: \"Employee\",\n $primaryKey: 50031,\n });\n });\n it(\"accepts objectSets\", async () => {\n const employeeObjectSet = client(Employee);\n const result = await client(queryAcceptsObjectSets).executeFunction({\n objectSet: employeeObjectSet,\n });\n expectTypeOf().toMatchTypeOf();\n });\n it(\"no params work\", async () => {\n const resultWithTimestamp = await client(returnsTimestamp)\n .executeFunction();\n expect(resultWithTimestamp).toBe(\"2019-01-01T00:00:00.000Z\");\n const resultWithDate = await client(returnsDate).executeFunction();\n expect(resultWithDate).toBe(\"2019-01-01\");\n });\n it(\"returns and accepts structs property\", async () => {\n const result = await client(incrementPersonAge).executeFunction({\n person: { firstName: \"John\", lastName: \"Doe\", age: 42 },\n });\n expect(result).toEqual({\n firstName: \"John\",\n lastName: \"Doe\",\n age: 43,\n });\n });\n it(\"returns and accepts complex structs property\", async () => {\n const employee = await client(Employee).fetchOne(50030);\n const result = await client(incrementPersonAgeComplex).executeFunction({\n person: { firstName: \"John\", lastName: \"Doe\", age: 42, object: employee },\n });\n expect(result).toEqual({\n firstName: \"John\",\n lastName: \"Doe\",\n age: 43,\n object: {\n $apiName: \"Employee\",\n $objectType: \"Employee\",\n $primaryKey: 50031,\n },\n });\n });\n it(\"two dimensional aggregation response works\", async () => {\n const result = await client(twoDimensionalAggregationFunction)\n .executeFunction();\n expect(result).toEqual([{ key: \"Q-AFN\", value: 1 }, {\n key: \"Q-AFO\",\n value: 2,\n }]);\n });\n it(\"two dimensional aggregation request/response works\", async () => {\n const result = await client(acceptsTwoDimensionalAggregationFunction)\n .executeFunction({\n aggFunction: [\n {\n key: \"testKey1\",\n value: 1,\n },\n {\n key: \"testKey2\",\n value: 2,\n },\n ],\n });\n expect(result).toEqual([{ key: \"responseKey1\", value: 3 }, {\n key: \"responseKey2\",\n value: 4,\n }]);\n });\n it(\"three dimensional aggregation response works\", async () => {\n const result = await client(threeDimensionalAggregationFunction)\n .executeFunction();\n expect(result).toEqual([{\n key: \"Q-AFN\",\n groups: [{\n key: {\n startValue: \"2010-10-01T00:00:00Z\",\n endValue: \"2010-10-02T00:00:00Z\",\n },\n value: 65.0,\n }],\n }, { key: \"Q-AFO\", groups: [] }]);\n });\n it(\"throws when response is null and response is non-nullable\", async () => {\n try {\n const result = await client(addOne).executeFunction({ n: 3 });\n expect.fail(\"Should not reach here\");\n }\n catch (e) {\n expect(e.message).toMatch(`Got null response when nullable was not allowed`);\n }\n });\n it(\"three dimensional aggregation request/response works\", async () => {\n const result = await client(acceptsThreeDimensionalAggregationFunction)\n .executeFunction({\n aggFunction: [\n {\n key: \"testKey1\",\n groups: [\n {\n key: {\n startValue: \"2010-10-01T00:00:00Z\",\n endValue: \"2010-10-02T00:00:00Z\",\n },\n value: 65.0,\n },\n ],\n },\n {\n key: \"testKey2\",\n groups: [],\n },\n ],\n });\n expect(result).toEqual([\n {\n key: \"Q-AFN\",\n groups: [\n {\n key: {\n startValue: \"2010-10-01T00:00:00Z\",\n endValue: \"2010-10-02T00:00:00Z\",\n },\n value: 65.0,\n },\n ],\n },\n {\n key: \"Q-AFO\",\n groups: [],\n },\n ]);\n });\n it(\"accepts and returns objects\", async () => {\n const employeeObjectSet = client(Employee);\n const result = await client(queryAcceptsObjectSets).executeFunction({\n objectSet: employeeObjectSet,\n });\n expectTypeOf().toMatchTypeOf();\n });\n it(\"queries are enumerable\", async () => {\n const queries = Object.keys($Queries);\n expect(queries).toStrictEqual([\n \"acceptsThreeDimensionalAggregationFunction\",\n \"acceptsTwoDimensionalAggregationFunction\",\n \"addOne\",\n \"incrementPersonAge\",\n \"incrementPersonAgeComplex\",\n \"queryAcceptsObject\",\n \"queryAcceptsObjectSets\",\n \"queryTypeReturnsArray\",\n \"returnsDate\",\n \"returnsObject\",\n \"returnsTimestamp\",\n \"threeDimensionalAggregationFunction\",\n \"twoDimensionalAggregationFunction\",\n ]);\n });\n it(\"queries work with arrays\", async () => {\n const result = await client($Queries.queryTypeReturnsArray).executeFunction({ people: [\"Brad\", \"George\", \"Ryan\"] });\n expect(result).toEqual([\"Pitt\", \"Clooney\", \"Reynolds\"]);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,QAAQ,EAAEC,0CAA0C,EAAEC,wCAAwC,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,kBAAkB,EAAEC,yBAAyB,EAAEC,kBAAkB,EAAEC,sBAAsB,EAAEC,WAAW,EAAEC,gBAAgB,EAAEC,mCAAmC,EAAEC,iCAAiC,QAAS,4BAA4B;AAC9W,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAS,QAAQ;AACjF,SAASC,YAAY,QAAQ,oBAAoB;AACjDJ,QAAQ,CAAC,SAAS,EAAE,MAAM;EACtB,IAAIK,MAAM;EACVN,SAAS,CAAC,YAAY;IAClBF,SAAS,CAACS,MAAM,CAAC,CAAC;IAClBD,MAAM,GAAGD,YAAY,CAAC,4BAA4B,EAAErB,YAAY,EAAE,YAAY,eAAe,CAAC;EAClG,CAAC,CAAC;EACFe,QAAQ,CAAC,MAAM;IACXD,SAAS,CAACU,KAAK,CAAC,CAAC;EACrB,CAAC,CAAC;EACFJ,EAAE,CAAC,oBAAoB,EAAE,YAAY;IACjC,MAAMK,MAAM,GAAG,MAAMH,MAAM,CAAClB,MAAM,CAAC,CAACsB,eAAe,CAAC;MAAEC,CAAC,EAAE;IAAE,CAAC,CAAC;IAC7DT,MAAM,CAACO,MAAM,CAAC,CAACG,IAAI,CAAC,CAAC,CAAC;EAC1B,CAAC,CAAC;EACFR,EAAE,CAAC,iBAAiB,EAAE,YAAY;IAC9B,MAAMS,QAAQ,GAAG,MAAMP,MAAM,CAACjB,QAAQ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AoB,EACpB,2BAA2B,EAC3B,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,qCAAqC,EACrC,mCAAmC,CACtC,CAAC;EACN,CAAC,CAAC;EACFvC,EAAE,CAAC,0BAA0B,EAAE,YAAY;IACvC,MAAMK,MAAM,GAAG,MAAMH,MAAM,CAACrB,QAAQ,CAAC2D,qBAAqB,CAAC,CAAClC,eAAe,CAAC;MAAEmC,MAAM,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM;IAAE,CAAC,CAAC;IACnH3C,MAAM,CAACO,MAAM,CAAC,CAACO,OAAO,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;EAC3D,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export const USER_AGENT = `osdk-client/${"2.1.0-beta.
|
|
16
|
+
export const USER_AGENT = `osdk-client/${"2.1.0-beta.3"}`;
|
|
17
17
|
//# sourceMappingURL=UserAgent.js.map
|
package/build/esm/Client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ActionDefinition, ActionMetadata, CompileTimeMetadata, InterfaceDefinition, InterfaceMetadata, ObjectMetadata, ObjectOrInterfaceDefinition, ObjectSet, ObjectTypeDefinition, Osdk, QueryDefinition, QueryMetadata, VersionBound } from "@osdk/api";
|
|
2
2
|
import type { __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks, __EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet, MinimalObjectSet } from "@osdk/api/unstable";
|
|
3
|
-
import type { SharedClient } from "@osdk/shared.client";
|
|
3
|
+
import type { SharedClient as OldSharedClient } from "@osdk/shared.client";
|
|
4
|
+
import type { SharedClient } from "@osdk/shared.client2";
|
|
4
5
|
import type { BulkLinkResult } from "./__unstable/createBulkLinksAsyncIterFactory.js";
|
|
5
6
|
import type { ActionSignatureFromDef } from "./actions/applyAction.js";
|
|
6
7
|
import type { MinimalClient } from "./MinimalClientContext.js";
|
|
@@ -9,7 +10,7 @@ import type { SatisfiesSemver } from "./SatisfiesSemver.js";
|
|
|
9
10
|
export type CheckVersionBound<Q> = Q extends VersionBound<infer V> ? (SatisfiesSemver<V, MaxOsdkVersion> extends true ? Q : Q & {
|
|
10
11
|
[ErrorMessage]: `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;
|
|
11
12
|
}) : Q;
|
|
12
|
-
export interface Client extends SharedClient
|
|
13
|
+
export interface Client extends SharedClient, OldSharedClient {
|
|
13
14
|
<Q extends ObjectTypeDefinition>(o: Q): unknown extends CompileTimeMetadata<Q>["objectSet"] ? ObjectSet<Q> : CompileTimeMetadata<Q>["objectSet"];
|
|
14
15
|
<Q extends (InterfaceDefinition)>(o: Q): unknown extends CompileTimeMetadata<Q>["objectSet"] ? MinimalObjectSet<Q> : CompileTimeMetadata<Q>["objectSet"];
|
|
15
16
|
<Q extends ActionDefinition<any>>(o: Q): ActionSignatureFromDef<Q>;
|
|
@@ -31,7 +32,9 @@ export interface Client extends SharedClient<MinimalClient> {
|
|
|
31
32
|
* @alpha
|
|
32
33
|
*/
|
|
33
34
|
readonly [__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks]: <T extends ObjectOrInterfaceDefinition>(objs: Osdk<T>[], links: string[]) => AsyncGenerator<BulkLinkResult, void, undefined>;
|
|
35
|
+
[additionalContext]: MinimalClient;
|
|
34
36
|
}
|
|
37
|
+
export declare const additionalContext: unique symbol;
|
|
35
38
|
declare const MaxOsdkVersion = "2.1.0";
|
|
36
39
|
export type MaxOsdkVersion = typeof MaxOsdkVersion;
|
|
37
40
|
declare const ErrorMessage: unique symbol;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Client.d.ts","sourceRoot":"","sources":["../../src/Client.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,2BAA2B,EAC3B,SAAS,EACT,oBAAoB,EACpB,IAAI,EACJ,eAAe,EACf,aAAa,EACb,YAAY,EACb,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EACV,+CAA+C,EAC/C,uDAAuD,EACvD,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"Client.d.ts","sourceRoot":"","sources":["../../src/Client.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,2BAA2B,EAC3B,SAAS,EACT,oBAAoB,EACpB,IAAI,EACJ,eAAe,EACf,aAAa,EACb,YAAY,EACb,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EACV,+CAA+C,EAC/C,uDAAuD,EACvD,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,IAAI,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,CA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ChD,CAAC,SAAS,eAAe,CAAC,GAAG,CAAC,GAAG,aAAa,GAC9C,KAAK,CACV,CAAC;IAEF;;;;;;OAMG;IACH,QAAQ,CAAC,CAAC,uDAAuD,CAAC,EAAE,CAClE,CAAC,SAAS,2BAA2B,EAErC,IAAI,EAAE,CAAC,EACP,GAAG,EAAE,MAAM,KACR,SAAS,CAAC,CAAC,CAAC,CAAC;IAElB;;;;;;OAMG;IACH,QAAQ,CAAC,CAAC,+CAA+C,CAAC,EAAE,CAC1D,CAAC,SAAS,2BAA2B,EAErC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EACf,KAAK,EAAE,MAAM,EAAE,KACZ,cAAc,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IAErD,CAAC,iBAAiB,CAAC,EAAE,aAAa,CAAC;CACpC;AAGD,eAAO,MAAM,iBAAiB,eAA8B,CAAC;AAG7D,QAAA,MAAM,cAAc,UAAU,CAAC;AAE/B,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC;AACnD,QAAA,MAAM,YAAY,eAAyB,CAAC"}
|
package/build/esm/Client.js
CHANGED
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
// DO NOT EXPORT FROM PACKAGE
|
|
17
|
+
export const additionalContext = Symbol("additionalContext");
|
|
16
18
|
// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.
|
|
17
19
|
const MaxOsdkVersion = "2.1.0";
|
|
18
20
|
const ErrorMessage = Symbol("ErrorMessage");
|
|
19
|
-
export {};
|
|
20
21
|
//# sourceMappingURL=Client.js.map
|
package/build/esm/Client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Client.js","names":["
|
|
1
|
+
{"version":3,"file":"Client.js","names":["additionalContext","Symbol","MaxOsdkVersion","ErrorMessage"],"sources":["Client.js"],"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// DO NOT EXPORT FROM PACKAGE\nexport const additionalContext = Symbol(\"additionalContext\");\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.1.0\";\nconst ErrorMessage = Symbol(\"ErrorMessage\");\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,iBAAiB,GAAGC,MAAM,CAAC,mBAAmB,CAAC;AAC5D;AACA,MAAMC,cAAc,GAAG,OAAO;AAC9B,MAAMC,YAAY,GAAGF,MAAM,CAAC,cAAc,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SharedClientContext } from "@osdk/shared.
|
|
1
|
+
import type { SharedClientContext } from "@osdk/shared.client2";
|
|
2
2
|
import type { Logger } from "./Logger.js";
|
|
3
3
|
import type { OntologyProvider } from "./ontology/OntologyProvider.js";
|
|
4
4
|
declare const tag: unique symbol;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MinimalClientContext.d.ts","sourceRoot":"","sources":["../../src/MinimalClientContext.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"MinimalClientContext.d.ts","sourceRoot":"","sources":["../../src/MinimalClientContext.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,OAAO,CAAC,MAAM,GAAG,EAAE,OAAO,MAAM,CAAC;AAEjC,MAAM,MAAM,cAAc,GAAG,EAAE,GAAG;IAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAE3D,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,WAAW,aAAc,SAAQ,mBAAmB;IACxD,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACtC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,cAAc,EAAE,cAAc,CAAC;IAC/B,cAAc,EAAE,cAAc,CAAC;CAChC;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,qBAAqB,CAAC;IAChC,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACvC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Client } from "./Client.js";
|
|
2
2
|
import type { Logger } from "./Logger.js";
|
|
3
3
|
export declare const createClient: (baseUrl: string, ontologyRid: string | Promise<string>, tokenProvider: () => Promise<string>, options?: {
|
|
4
4
|
logger?: Logger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClient.d.ts","sourceRoot":"","sources":["../../src/createClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createClient.d.ts","sourceRoot":"","sources":["../../src/createClient.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAqB,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAG7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA2J1C,eAAO,MAAM,YAAY,gFA/GF,OAAO,CAAC,MAAM,CAAC;aAChB,MAAM;4DAiH3B,CAAC"}
|
|
@@ -14,9 +14,11 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks, __EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet } from "@osdk/api/unstable";
|
|
17
|
-
import { symbolClientContext } from "@osdk/shared.client";
|
|
17
|
+
import { symbolClientContext as oldSymbolClientContext } from "@osdk/shared.client";
|
|
18
|
+
import { symbolClientContext } from "@osdk/shared.client2";
|
|
18
19
|
import { createBulkLinksAsyncIterFactory } from "./__unstable/createBulkLinksAsyncIterFactory.js";
|
|
19
20
|
import { applyAction } from "./actions/applyAction.js";
|
|
21
|
+
import { additionalContext } from "./Client.js";
|
|
20
22
|
import { createMinimalClient } from "./createMinimalClient.js";
|
|
21
23
|
import { fetchMetadataInternal } from "./fetchMetadata.js";
|
|
22
24
|
import { createObjectSet } from "./objectSet/createObjectSet.js";
|
|
@@ -69,15 +71,21 @@ baseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {
|
|
|
69
71
|
throw new Error("not implemented");
|
|
70
72
|
}
|
|
71
73
|
}, {
|
|
74
|
+
[oldSymbolClientContext]: {
|
|
75
|
+
value: clientCtx
|
|
76
|
+
},
|
|
72
77
|
[symbolClientContext]: {
|
|
73
78
|
value: clientCtx
|
|
74
79
|
},
|
|
80
|
+
[additionalContext]: {
|
|
81
|
+
value: clientCtx
|
|
82
|
+
},
|
|
75
83
|
[__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks]: {
|
|
76
84
|
get: () => createBulkLinksAsyncIterFactory(clientCtx)
|
|
77
85
|
},
|
|
78
86
|
[__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet]: {
|
|
79
87
|
get: () => (definition, rid) => {
|
|
80
|
-
return createObjectSet(definition, client[
|
|
88
|
+
return createObjectSet(definition, client[additionalContext], {
|
|
81
89
|
type: "intersect",
|
|
82
90
|
objectSets: [{
|
|
83
91
|
type: "base",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClient.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet","symbolClientContext","createBulkLinksAsyncIterFactory","applyAction","createMinimalClient","fetchMetadataInternal","createObjectSet","applyQuery","ActionInvoker","constructor","clientCtx","actionDef","bind","undefined","batchApplyAction","QueryInvoker","queryDef","executeFunction","createClientInternal","objectSetFactory","baseUrl","ontologyRid","tokenProvider","options","fetchFn","fetch","startsWith","Error","then","fetchMetadata","client","Object","defineProperties","o","type","value","get","definition","rid","objectSets","objectType","apiName","reference","createClient"],"sources":["createClient.js"],"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 */\nimport { __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks, __EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet, } from \"@osdk/api/unstable\";\nimport { symbolClientContext } from \"@osdk/shared.client\";\nimport { createBulkLinksAsyncIterFactory } from \"./__unstable/createBulkLinksAsyncIterFactory.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { applyQuery } from \"./queries/applyQuery.js\";\nclass ActionInvoker {\n constructor(clientCtx, actionDef) {\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 applyAction;\n batchApplyAction;\n}\nclass QueryInvoker {\n constructor(clientCtx, queryDef) {\n this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);\n }\n executeFunction;\n}\n/** @internal */\nexport function createClientInternal(objectSetFactory, // first so i can bind\nbaseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {\n if (typeof ontologyRid === \"string\") {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n }\n else {\n ontologyRid.then((ontologyRid) => {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n });\n }\n const clientCtx = createMinimalClient({ ontologyRid }, baseUrl, tokenProvider, options, fetchFn, objectSetFactory);\n function clientFn(o) {\n if (o.type === \"object\" || o.type === \"interface\") {\n return objectSetFactory(o, clientCtx);\n }\n else if (o.type === \"action\") {\n return new ActionInvoker(clientCtx, o); // then as any for dealing with the conditional return value\n }\n else if (o.type === \"query\") {\n return new QueryInvoker(clientCtx, o);\n }\n else {\n throw new Error(\"not implemented\");\n }\n }\n const fetchMetadata = fetchMetadataInternal.bind(undefined, clientCtx);\n const client = Object.defineProperties(clientFn, {\n [symbolClientContext]: {\n value: clientCtx,\n },\n [__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks]: {\n get: () => createBulkLinksAsyncIterFactory(clientCtx),\n },\n [__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet]: {\n get: () => (definition, rid) => {\n return createObjectSet(definition, client[
|
|
1
|
+
{"version":3,"file":"createClient.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet","symbolClientContext","oldSymbolClientContext","createBulkLinksAsyncIterFactory","applyAction","additionalContext","createMinimalClient","fetchMetadataInternal","createObjectSet","applyQuery","ActionInvoker","constructor","clientCtx","actionDef","bind","undefined","batchApplyAction","QueryInvoker","queryDef","executeFunction","createClientInternal","objectSetFactory","baseUrl","ontologyRid","tokenProvider","options","fetchFn","fetch","startsWith","Error","then","fetchMetadata","client","Object","defineProperties","o","type","value","get","definition","rid","objectSets","objectType","apiName","reference","createClient"],"sources":["createClient.js"],"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 */\nimport { __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks, __EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet, } from \"@osdk/api/unstable\";\nimport { symbolClientContext as oldSymbolClientContext } from \"@osdk/shared.client\";\nimport { symbolClientContext } from \"@osdk/shared.client2\";\nimport { createBulkLinksAsyncIterFactory } from \"./__unstable/createBulkLinksAsyncIterFactory.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { additionalContext } from \"./Client.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { applyQuery } from \"./queries/applyQuery.js\";\nclass ActionInvoker {\n constructor(clientCtx, actionDef) {\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 applyAction;\n batchApplyAction;\n}\nclass QueryInvoker {\n constructor(clientCtx, queryDef) {\n this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);\n }\n executeFunction;\n}\n/** @internal */\nexport function createClientInternal(objectSetFactory, // first so i can bind\nbaseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {\n if (typeof ontologyRid === \"string\") {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n }\n else {\n ontologyRid.then((ontologyRid) => {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n });\n }\n const clientCtx = createMinimalClient({ ontologyRid }, baseUrl, tokenProvider, options, fetchFn, objectSetFactory);\n function clientFn(o) {\n if (o.type === \"object\" || o.type === \"interface\") {\n return objectSetFactory(o, clientCtx);\n }\n else if (o.type === \"action\") {\n return new ActionInvoker(clientCtx, o); // then as any for dealing with the conditional return value\n }\n else if (o.type === \"query\") {\n return new QueryInvoker(clientCtx, o);\n }\n else {\n throw new Error(\"not implemented\");\n }\n }\n const fetchMetadata = fetchMetadataInternal.bind(undefined, clientCtx);\n const client = Object.defineProperties(clientFn, {\n [oldSymbolClientContext]: {\n value: clientCtx,\n },\n [symbolClientContext]: {\n value: clientCtx,\n },\n [additionalContext]: {\n value: clientCtx,\n },\n [__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks]: {\n get: () => createBulkLinksAsyncIterFactory(clientCtx),\n },\n [__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet]: {\n get: () => (definition, rid) => {\n return createObjectSet(definition, client[additionalContext], {\n type: \"intersect\",\n objectSets: [\n {\n type: \"base\",\n objectType: definition.apiName,\n },\n {\n type: \"reference\",\n reference: rid,\n },\n ],\n });\n },\n },\n fetchMetadata: {\n value: fetchMetadata,\n },\n });\n return client;\n}\nexport const createClient = createClientInternal.bind(undefined, createObjectSet);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,+CAA+C,EAAEC,uDAAuD,QAAS,oBAAoB;AAC9I,SAASC,mBAAmB,IAAIC,sBAAsB,QAAQ,qBAAqB;AACnF,SAASD,mBAAmB,QAAQ,sBAAsB;AAC1D,SAASE,+BAA+B,QAAQ,iDAAiD;AACjG,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,qBAAqB,QAAQ,oBAAoB;AAC1D,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,UAAU,QAAQ,yBAAyB;AACpD,MAAMC,aAAa,CAAC;EAChBC,WAAWA,CAACC,SAAS,EAAEC,SAAS,EAAE;IAC9B;IACA;IACA;IACA;IACA,IAAI,CAACT,WAAW,GAAGA,WAAW,CAACU,IAAI,CAACC,SAAS,EAAEH,SAAS,EAAEC,SAAS,CAAC;IACpE,IAAI,CAACG,gBAAgB,GAAGZ,WAAW,CAACU,IAAI,CAACC,SAAS,EAAEH,SAAS,EAAEC,SAAS,CAAC;EAC7E;EACAT,WAAW;EACXY,gBAAgB;AACpB;AACA,MAAMC,YAAY,CAAC;EACfN,WAAWA,CAACC,SAAS,EAAEM,QAAQ,EAAE;IAC7B,IAAI,CAACC,eAAe,GAAGV,UAAU,CAACK,IAAI,CAACC,SAAS,EAAEH,SAAS,EAAEM,QAAQ,CAAC;EAC1E;EACAC,eAAe;AACnB;AACA;AACA,OAAO,SAASC,oBAAoBA,CAACC,gBAAgB;AAAE;AACvDC,OAAO,EAAEC,WAAW,EAAEC,aAAa,EAAEC,OAAO,GAAGV,SAAS,EAAEW,OAAO,GAAGC,KAAK,EA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K,EAAEzB;IACX,CAAC;IACD,CAACP,iBAAiB,GAAG;MACjBgC,KAAK,EAAEzB;IACX,CAAC;IACD,CAACb,+CAA+C,GAAG;MAC/CuC,GAAG,EAAEA,CAAA,KAAMnC,+BAA+B,CAACS,SAAS;IACxD,CAAC;IACD,CAACZ,uDAAuD,GAAG;MACvDsC,GAAG,EAAEA,CAAA,KAAM,CAACC,UAAU,EAAEC,GAAG,KAAK;QAC5B,OAAOhC,eAAe,CAAC+B,UAAU,EAAEP,MAAM,CAAC3B,iBAAiB,CAAC,EAAE;UAC1D+B,IAAI,EAAE,WAAW;UACjBK,UAAU,EAAE,CACR;YACIL,IAAI,EAAE,MAAM;YACZM,UAAU,EAAEH,UAAU,CAACI;UAC3B,CAAC,EACD;YACIP,IAAI,EAAE,WAAW;YACjBQ,SAAS,EAAEJ;UACf,CAAC;QAET,CAAC,CAAC;MACN;IACJ,CAAC;IACDT,aAAa,EAAE;MACXM,KAAK,EAAEN;IACX;EACJ,CAAC,CAAC;EACF,OAAOC,MAAM;AACjB;AACA,OAAO,MAAMa,YAAY,GAAGzB,oBAAoB,CAACN,IAAI,CAACC,SAAS,EAAEP,eAAe,CAAC","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@ import type { MinimalClient } from "./MinimalClientContext.js";
|
|
|
3
3
|
export declare class GeotimeSeriesPropertyImpl<T extends GeoJSON.Point> implements GeotimeSeriesProperty<T> {
|
|
4
4
|
#private;
|
|
5
5
|
lastFetchedValue: TimeSeriesPoint<T> | undefined;
|
|
6
|
-
constructor(client: MinimalClient, objectApiName: string, primaryKey: any, propertyName: string);
|
|
6
|
+
constructor(client: MinimalClient, objectApiName: string, primaryKey: any, propertyName: string, initialValue?: TimeSeriesPoint<T>);
|
|
7
7
|
getLatestValue(): Promise<TimeSeriesPoint<T> | undefined>;
|
|
8
8
|
getAllValues(query?: TimeSeriesQuery): Promise<TimeSeriesPoint<T>[]>;
|
|
9
9
|
asyncIterValues(query?: TimeSeriesQuery): AsyncGenerator<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGeotimeSeriesProperty.d.ts","sourceRoot":"","sources":["../../src/createGeotimeSeriesProperty.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EAEf,eAAe,EAChB,MAAM,WAAW,CAAC;AAInB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAO/D,qBAAa,yBAAyB,CAAC,CAAC,SAAS,OAAO,CAAC,KAAK,CAC5D,YAAW,qBAAqB,CAAC,CAAC,CAAC;;IAInC,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;gBAG/C,MAAM,EAAE,aAAa,EACrB,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,GAAG,EACf,YAAY,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"createGeotimeSeriesProperty.d.ts","sourceRoot":"","sources":["../../src/createGeotimeSeriesProperty.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EAEf,eAAe,EAChB,MAAM,WAAW,CAAC;AAInB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAO/D,qBAAa,yBAAyB,CAAC,CAAC,SAAS,OAAO,CAAC,KAAK,CAC5D,YAAW,qBAAqB,CAAC,CAAC,CAAC;;IAInC,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;gBAG/C,MAAM,EAAE,aAAa,EACrB,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,GAAG,EACf,YAAY,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC;IAStB,cAAc,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAWzD,YAAY,CAAC,KAAK,CAAC,EAAE,eAAe;IASnC,eAAe,CAC3B,KAAK,CAAC,EAAE,eAAe;;;;CAgB1B"}
|
|
@@ -19,9 +19,12 @@ export class GeotimeSeriesPropertyImpl {
|
|
|
19
19
|
#triplet;
|
|
20
20
|
#client;
|
|
21
21
|
lastFetchedValue;
|
|
22
|
-
constructor(client, objectApiName, primaryKey, propertyName) {
|
|
22
|
+
constructor(client, objectApiName, primaryKey, propertyName, initialValue) {
|
|
23
23
|
this.#client = client;
|
|
24
24
|
this.#triplet = [objectApiName, primaryKey, propertyName];
|
|
25
|
+
if (initialValue != null) {
|
|
26
|
+
this.lastFetchedValue = initialValue;
|
|
27
|
+
}
|
|
25
28
|
}
|
|
26
29
|
async getLatestValue() {
|
|
27
30
|
const latestPointPromise = OntologiesV2.TimeSeriesValueBankProperties.getLatestValue(this.#client, await this.#client.ontologyRid, ...this.#triplet);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGeotimeSeriesProperty.js","names":["OntologiesV2","asyncIterPointsHelper","getTimeRange","GeotimeSeriesPropertyImpl","triplet","client","lastFetchedValue","constructor","objectApiName","primaryKey","propertyName","getLatestValue","latestPointPromise","TimeSeriesValueBankProperties","ontologyRid","then","latestPoint","getAllValues","query","allPoints","point","asyncIterValues","push","streamPointsIterator","streamValues","range","timeseriesPoint"],"sources":["createGeotimeSeriesProperty.js"],"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 */\nimport * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport { asyncIterPointsHelper, getTimeRange } from \"./util/timeseriesUtils.js\";\nexport class GeotimeSeriesPropertyImpl {\n #triplet;\n #client;\n lastFetchedValue;\n constructor(client, objectApiName, primaryKey, propertyName) {\n this.#client = client;\n this.#triplet = [objectApiName, primaryKey, propertyName];\n }\n async getLatestValue() {\n const latestPointPromise = OntologiesV2.TimeSeriesValueBankProperties\n .getLatestValue(this.#client, await this.#client.ontologyRid, ...this.#triplet);\n latestPointPromise.then(latestPoint => this.lastFetchedValue = latestPoint);\n return latestPointPromise;\n }\n async getAllValues(query) {\n const allPoints = [];\n for await (const point of this.asyncIterValues(query)) {\n allPoints.push(point);\n }\n return allPoints;\n }\n async *asyncIterValues(query) {\n const streamPointsIterator = await OntologiesV2\n .TimeSeriesValueBankProperties.streamValues(this.#client, await this.#client.ontologyRid, ...this.#triplet, query ? { range: getTimeRange(query) } : {});\n for await (const timeseriesPoint of asyncIterPointsHelper(streamPointsIterator)) {\n yield timeseriesPoint;\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,qCAAqC;AACnE,SAASC,qBAAqB,EAAEC,YAAY,QAAQ,2BAA2B;AAC/E,OAAO,MAAMC,yBAAyB,CAAC;EACnC,CAACC,OAAO;EACR,CAACC,MAAM;EACPC,gBAAgB;EAChBC,WAAWA,CAACF,MAAM,EAAEG,aAAa,EAAEC,UAAU,EAAEC,YAAY,EAAE;
|
|
1
|
+
{"version":3,"file":"createGeotimeSeriesProperty.js","names":["OntologiesV2","asyncIterPointsHelper","getTimeRange","GeotimeSeriesPropertyImpl","triplet","client","lastFetchedValue","constructor","objectApiName","primaryKey","propertyName","initialValue","getLatestValue","latestPointPromise","TimeSeriesValueBankProperties","ontologyRid","then","latestPoint","getAllValues","query","allPoints","point","asyncIterValues","push","streamPointsIterator","streamValues","range","timeseriesPoint"],"sources":["createGeotimeSeriesProperty.js"],"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 */\nimport * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport { asyncIterPointsHelper, getTimeRange } from \"./util/timeseriesUtils.js\";\nexport class GeotimeSeriesPropertyImpl {\n #triplet;\n #client;\n lastFetchedValue;\n constructor(client, objectApiName, primaryKey, propertyName, initialValue) {\n this.#client = client;\n this.#triplet = [objectApiName, primaryKey, propertyName];\n if (initialValue != null) {\n this.lastFetchedValue = initialValue;\n }\n }\n async getLatestValue() {\n const latestPointPromise = OntologiesV2.TimeSeriesValueBankProperties\n .getLatestValue(this.#client, await this.#client.ontologyRid, ...this.#triplet);\n latestPointPromise.then(latestPoint => this.lastFetchedValue = latestPoint);\n return latestPointPromise;\n }\n async getAllValues(query) {\n const allPoints = [];\n for await (const point of this.asyncIterValues(query)) {\n allPoints.push(point);\n }\n return allPoints;\n }\n async *asyncIterValues(query) {\n const streamPointsIterator = await OntologiesV2\n .TimeSeriesValueBankProperties.streamValues(this.#client, await this.#client.ontologyRid, ...this.#triplet, query ? { range: getTimeRange(query) } : {});\n for await (const timeseriesPoint of asyncIterPointsHelper(streamPointsIterator)) {\n yield timeseriesPoint;\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,qCAAqC;AACnE,SAASC,qBAAqB,EAAEC,YAAY,QAAQ,2BAA2B;AAC/E,OAAO,MAAMC,yBAAyB,CAAC;EACnC,CAACC,OAAO;EACR,CAACC,MAAM;EACPC,gBAAgB;EAChBC,WAAWA,CAACF,MAAM,E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ACzB;EACJ;AACJ","ignoreList":[]}
|
|
@@ -35,8 +35,8 @@ export function createMinimalClient(metadata, baseUrl, tokenProvider, options =
|
|
|
35
35
|
clientCacheKey: {},
|
|
36
36
|
requestContext: {}
|
|
37
37
|
};
|
|
38
|
-
return Object.assign(minimalClient, {
|
|
38
|
+
return Object.freeze(Object.assign(minimalClient, {
|
|
39
39
|
ontologyProvider: createStandardOntologyProviderFactory(options)(minimalClient)
|
|
40
|
-
});
|
|
40
|
+
}));
|
|
41
41
|
}
|
|
42
42
|
//# sourceMappingURL=createMinimalClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMinimalClient.js","names":["createSharedClientContext","createObjectSet","createStandardOntologyProviderFactory","USER_AGENT","createMinimalClient","metadata","baseUrl","tokenProvider","options","fetchFn","global","fetch","objectSetFactory","process","env","NODE_ENV","URL","e","hint","startsWith","Error","minimalClient","ontologyRid","logger","clientCacheKey","requestContext","Object","assign","ontologyProvider"],"sources":["createMinimalClient.js"],"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 */\nimport { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { createStandardOntologyProviderFactory, } from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n/** @internal */\nexport function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {\n if (process?.env?.NODE_ENV !== \"production\") {\n try {\n new URL(baseUrl);\n }\n catch (e) {\n const hint = !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 minimalClient = {\n ...createSharedClientContext(baseUrl, tokenProvider, USER_AGENT, fetchFn),\n objectSetFactory,\n ontologyRid: metadata.ontologyRid,\n logger: options.logger,\n clientCacheKey: {},\n requestContext: {},\n };\n return Object.assign(minimalClient, {\n ontologyProvider: createStandardOntologyProviderFactory(options)(minimalClient),\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,yBAAyB,QAAQ,0BAA0B;AACpE,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,qCAAqC,QAAS,wCAAwC;AAC/F,SAASC,UAAU,QAAQ,qBAAqB;AAChD;AACA,OAAO,SAASC,mBAAmBA,CAACC,QAAQ,EAAEC,OAAO,EAAEC,aAAa,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAEC,OAAO,GAAGC,MAAM,CAACC,KAAK,EAAEC,gBAAgB,GAAGX,eAAe,EAAE;EAC5I,IAAIY,OAAO,EAAEC,GAAG,EAAEC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAI;MACA,IAAIC,GAAG,CAACV,OAAO,CAAC;IACpB,CAAC,CACD,OAAOW,CAAC,EAAE;MACN,MAAMC,IAAI,GAAG,CAACZ,OAAO,CAACa,UAAU,CAAC,SAAS,CAAC,IAAI,CAACb,OAAO,CAACa,UAAU,CAAC,UAAU,CAAC,GACxE,kDAAkD,GAClD,EAAE;MACR,MAAM,IAAIC,KAAK,CAAC,sBAAsBd,OAAO,GAAGY,IAAI,EAAE,CAAC;IAC3D;EACJ;EACA,MAAMG,aAAa,GAAG;IAClB,GAAGrB,yBAAyB,CAACM,OAAO,EAAEC,aAAa,EAAEJ,UAAU,EAAEM,OAAO,CAAC;IACzEG,gBAAgB;IAChBU,WAAW,EAAEjB,QAAQ,CAACiB,WAAW;IACjCC,MAAM,EAAEf,OAAO,CAACe,MAAM;IACtBC,cAAc,EAAE,CAAC,CAAC;IAClBC,cAAc,EAAE,CAAC;EACrB,CAAC;EACD,OAAOC,MAAM,CAACC,MAAM,
|
|
1
|
+
{"version":3,"file":"createMinimalClient.js","names":["createSharedClientContext","createObjectSet","createStandardOntologyProviderFactory","USER_AGENT","createMinimalClient","metadata","baseUrl","tokenProvider","options","fetchFn","global","fetch","objectSetFactory","process","env","NODE_ENV","URL","e","hint","startsWith","Error","minimalClient","ontologyRid","logger","clientCacheKey","requestContext","Object","freeze","assign","ontologyProvider"],"sources":["createMinimalClient.js"],"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 */\nimport { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { createStandardOntologyProviderFactory, } from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n/** @internal */\nexport function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {\n if (process?.env?.NODE_ENV !== \"production\") {\n try {\n new URL(baseUrl);\n }\n catch (e) {\n const hint = !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 minimalClient = {\n ...createSharedClientContext(baseUrl, tokenProvider, USER_AGENT, fetchFn),\n objectSetFactory,\n ontologyRid: metadata.ontologyRid,\n logger: options.logger,\n clientCacheKey: {},\n requestContext: {},\n };\n return Object.freeze(Object.assign(minimalClient, {\n ontologyProvider: createStandardOntologyProviderFactory(options)(minimalClient),\n }));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,yBAAyB,QAAQ,0BAA0B;AACpE,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,qCAAqC,QAAS,wCAAwC;AAC/F,SAASC,UAAU,QAAQ,qBAAqB;AAChD;AACA,OAAO,SAASC,mBAAmBA,CAACC,QAAQ,EAAEC,OAAO,EAAEC,aAAa,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAEC,OAAO,GAAGC,MAAM,CAACC,KAAK,EAAEC,gBAAgB,GAAGX,eAAe,EAAE;EAC5I,IAAIY,OAAO,EAAEC,GAAG,EAAEC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAI;MACA,IAAIC,GAAG,CAACV,OAAO,CAAC;IACpB,CAAC,CACD,OAAOW,CAAC,EAAE;MACN,MAAMC,IAAI,GAAG,CAACZ,OAAO,CAACa,UAAU,CAAC,SAAS,CAAC,IAAI,CAACb,OAAO,CAACa,UAAU,CAAC,UAAU,CAAC,GACxE,kDAAkD,GAClD,EAAE;MACR,MAAM,IAAIC,KAAK,CAAC,sBAAsBd,OAAO,GAAGY,IAAI,EAAE,CAAC;IAC3D;EACJ;EACA,MAAMG,aAAa,GAAG;IAClB,GAAGrB,yBAAyB,CAACM,OAAO,EAAEC,aAAa,EAAEJ,UAAU,EAAEM,OAAO,CAAC;IACzEG,gBAAgB;IAChBU,WAAW,EAAEjB,QAAQ,CAACiB,WAAW;IACjCC,MAAM,EAAEf,OAAO,CAACe,MAAM;IACtBC,cAAc,EAAE,CAAC,CAAC;IAClBC,cAAc,EAAE,CAAC;EACrB,CAAC;EACD,OAAOC,MAAM,CAACC,MAAM,CAACD,MAAM,CAACE,MAAM,CAACP,aAAa,EAAE;IAC9CQ,gBAAgB,EAAE3B,qCAAqC,CAACM,OAAO,CAAC,CAACa,aAAa;EAClF,CAAC,CAAC,CAAC;AACP","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPlatformClient.d.ts","sourceRoot":"","sources":["../../src/createPlatformClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createPlatformClient.d.ts","sourceRoot":"","sources":["../../src/createPlatformClient.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAGhE,MAAM,WAAW,cAAe,SAAQ,mBAAmB;CAAG;AAE9D;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EACpC,OAAO,GAAE,SAAqB,EAC9B,OAAO,GAAE,OAAO,UAAU,CAAC,KAAa,GACvC,cAAc,CAOhB"}
|