@osdk/client 2.63.0 → 2.63.1-main-6adfde43e644202bc153746619b184259bbb874b
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 +9 -0
- package/build/browser/Client.js +1 -1
- package/build/browser/Client.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js +1 -0
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/util/UserAgent.js +2 -2
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/cjs/ObjectSetListenerWebsocket-2IFZTCZH.cjs +14 -0
- package/build/cjs/{ObjectSetListenerWebsocket-F7SQAZQF.cjs.map → ObjectSetListenerWebsocket-2IFZTCZH.cjs.map} +1 -1
- package/build/cjs/{applyStreamingQuery-Y36LKEC3.cjs → applyStreamingQuery-DKQ42L3G.cjs} +8 -8
- package/build/cjs/{applyStreamingQuery-Y36LKEC3.cjs.map → applyStreamingQuery-DKQ42L3G.cjs.map} +1 -1
- package/build/cjs/{chunk-4OLZQEBM.cjs → chunk-CG6DKOHH.cjs} +80 -80
- package/build/cjs/{chunk-4OLZQEBM.cjs.map → chunk-CG6DKOHH.cjs.map} +1 -1
- package/build/cjs/{chunk-WJMJDOZQ.cjs → chunk-G2EJPP5V.cjs} +3 -2
- package/build/cjs/chunk-G2EJPP5V.cjs.map +1 -0
- package/build/cjs/{chunk-JLSFAQ4I.cjs → chunk-IQTLVTFK.cjs} +3 -3
- package/build/cjs/{chunk-JLSFAQ4I.cjs.map → chunk-IQTLVTFK.cjs.map} +1 -1
- package/build/cjs/{chunk-BQZHY3BW.cjs → chunk-IZVMT4FN.cjs} +13 -13
- package/build/cjs/{chunk-BQZHY3BW.cjs.map → chunk-IZVMT4FN.cjs.map} +1 -1
- package/build/cjs/{chunk-PJOP642S.cjs → chunk-KSK5OG4K.cjs} +48 -48
- package/build/cjs/chunk-KSK5OG4K.cjs.map +1 -0
- package/build/cjs/{chunk-JMVVIOBL.cjs → chunk-MTKYTYQC.cjs} +8 -8
- package/build/cjs/{chunk-JMVVIOBL.cjs.map → chunk-MTKYTYQC.cjs.map} +1 -1
- package/build/cjs/index.cjs +12 -12
- package/build/cjs/public/experimental.cjs +10 -10
- package/build/cjs/public/internal.cjs +7 -7
- package/build/cjs/public/observable.cjs +6 -6
- package/build/cjs/public/unstable-do-not-use.cjs +17 -17
- package/build/esm/Client.js +1 -1
- package/build/esm/Client.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js +1 -0
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/util/UserAgent.js +2 -2
- package/build/esm/util/UserAgent.js.map +1 -1
- package/build/types/Client.d.ts +1 -1
- package/package.json +7 -7
- package/build/cjs/ObjectSetListenerWebsocket-F7SQAZQF.cjs +0 -14
- package/build/cjs/chunk-PJOP642S.cjs.map +0 -1
- package/build/cjs/chunk-WJMJDOZQ.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @osdk/client
|
|
2
2
|
|
|
3
|
+
## 2.63.1-main-6adfde43e644202bc153746619b184259bbb874b
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6adfde4: Support object set subscriptions through clients scoped to ontology scenarios.
|
|
8
|
+
- @osdk/api@2.63.1-main-6adfde43e644202bc153746619b184259bbb874b
|
|
9
|
+
- @osdk/client.unstable@2.63.1-main-6adfde43e644202bc153746619b184259bbb874b
|
|
10
|
+
- @osdk/generator-converters@2.63.1-main-6adfde43e644202bc153746619b184259bbb874b
|
|
11
|
+
|
|
3
12
|
## 2.63.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
package/build/browser/Client.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
export const additionalContext = Symbol("additionalContext");
|
|
22
22
|
|
|
23
23
|
// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.
|
|
24
|
-
const MaxOsdkVersion = "2.63.
|
|
24
|
+
const MaxOsdkVersion = "2.63.1";
|
|
25
25
|
// END: THIS IS GENERATED CODE. DO NOT EDIT.
|
|
26
26
|
|
|
27
27
|
const ErrorMessage = Symbol("ErrorMessage");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Client.js","names":["additionalContext","Symbol","MaxOsdkVersion","ErrorMessage"],"sources":["Client.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionMetadata,\n CompileTimeMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n VersionBound,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\n\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\nimport type { SatisfiesSemver } from \"./SatisfiesSemver.js\";\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype OldSharedClient = import(\"@osdk/shared.client\").SharedClient;\n\nexport type CheckVersionBound<Q> =\n Q extends VersionBound<infer V>\n ? SatisfiesSemver<V, MaxOsdkVersion> extends true\n ? Q\n : Q & {\n [ErrorMessage]: `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\n : Q;\n\nexport interface Client extends SharedClient, OldSharedClient {\n /**\n * Returns the operation surface for the given ontology definition. The shape of the\n * returned value is dispatched on what kind of definition is passed:\n * - object type → the object set type for that ontology object (typically a generated extension of {@link ObjectSet})\n * - interface → a {@link MinimalObjectSet} for the interface\n * - action → a callable with `applyAction` / `batchApplyAction`\n * - query → a callable with `executeFunction`\n * - experiment → the unstable feature surface for that experiment\n *\n * @param o - The object type definition to wrap.\n * @example\n * ```ts\n * const employees = await client(Employee).fetchPage({ $pageSize: 30 });\n * const employee = await client(Employee).fetchOne(12345);\n * ```\n * @returns an object set scoped to all objects of this type.\n */\n <Q extends ObjectTypeDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"]\n ? ObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The interface definition to wrap.\n * @example\n * ```ts\n * const page = await client(MyInterface).fetchPage({ $pageSize: 30 });\n * ```\n * @returns a minimal object set over all objects implementing the interface.\n */\n <Q extends InterfaceDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"]\n ? MinimalObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The action definition to invoke.\n * @example\n * ```ts\n * const result = await client(createEmployee).applyAction(\n * { name: \"Jane\", department: \"Engineering\" },\n * { $returnEdits: true },\n * );\n * ```\n * @returns a callable for applying (or batch-applying) the action.\n */\n <Q extends ActionDefinition<any>>(o: Q): ActionSignatureFromDef<Q>;\n\n /**\n * @param o - The query definition to invoke.\n * @example\n * ```ts\n * const result = await client(getEmployeeCount).executeFunction({ department: \"Engineering\" });\n * ```\n * @returns a callable for executing the query function.\n */\n <Q extends QueryDefinition<any>>(o: Q): QuerySignatureFromDef<Q>;\n\n /**\n * @param experiment - The experiment marker that gates an unstable feature.\n * @example\n * ```ts\n * const employee = await client(__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid)\n * .fetchOneByRid(Employee, \"ri.phonograph2-objects.main.object.1234\");\n * ```\n * @returns the experiment-specific function surface.\n */\n <\n Q extends\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">\n | Experiment<\"2.59.0\">\n | Experiment<\"2.2.0\">\n | Experiment<\"2.8.0\">\n | Experiment<\"2.19.0\">,\n >(\n experiment: Q,\n ): ExperimentFns<Q>;\n\n /**\n * Fetches runtime metadata for the given ontology definition. The returned shape\n * is dispatched on the kind of definition passed: {@link ObjectMetadata},\n * {@link InterfaceMetadata}, {@link ActionMetadata}, or {@link QueryMetadata}.\n * @param o - The object type, interface, action, or query definition to look up.\n * @example\n * ```ts\n * const meta = await client.fetchMetadata(Employee);\n * console.log(meta.displayName, meta.description);\n * ```\n * @returns a promise resolving to the metadata for the given definition.\n */\n fetchMetadata<\n Q extends\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>,\n >(\n o: Q,\n ): Promise<\n Q extends ObjectTypeDefinition\n ? ObjectMetadata\n : Q extends InterfaceDefinition\n ? InterfaceMetadata\n : Q extends ActionDefinition<any>\n ? ActionMetadata\n : Q extends QueryDefinition<any>\n ? QueryMetadata\n : never\n >;\n\n /** @internal */\n [additionalContext]: MinimalClient;\n}\n\n// DO NOT EXPORT FROM PACKAGE\n/** @internal */\nexport const additionalContext: unique symbol = Symbol(\"additionalContext\");\n\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.63.
|
|
1
|
+
{"version":3,"file":"Client.js","names":["additionalContext","Symbol","MaxOsdkVersion","ErrorMessage"],"sources":["Client.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionMetadata,\n CompileTimeMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n VersionBound,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\n\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\nimport type { SatisfiesSemver } from \"./SatisfiesSemver.js\";\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype OldSharedClient = import(\"@osdk/shared.client\").SharedClient;\n\nexport type CheckVersionBound<Q> =\n Q extends VersionBound<infer V>\n ? SatisfiesSemver<V, MaxOsdkVersion> extends true\n ? Q\n : Q & {\n [ErrorMessage]: `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\n : Q;\n\nexport interface Client extends SharedClient, OldSharedClient {\n /**\n * Returns the operation surface for the given ontology definition. The shape of the\n * returned value is dispatched on what kind of definition is passed:\n * - object type → the object set type for that ontology object (typically a generated extension of {@link ObjectSet})\n * - interface → a {@link MinimalObjectSet} for the interface\n * - action → a callable with `applyAction` / `batchApplyAction`\n * - query → a callable with `executeFunction`\n * - experiment → the unstable feature surface for that experiment\n *\n * @param o - The object type definition to wrap.\n * @example\n * ```ts\n * const employees = await client(Employee).fetchPage({ $pageSize: 30 });\n * const employee = await client(Employee).fetchOne(12345);\n * ```\n * @returns an object set scoped to all objects of this type.\n */\n <Q extends ObjectTypeDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"]\n ? ObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The interface definition to wrap.\n * @example\n * ```ts\n * const page = await client(MyInterface).fetchPage({ $pageSize: 30 });\n * ```\n * @returns a minimal object set over all objects implementing the interface.\n */\n <Q extends InterfaceDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"]\n ? MinimalObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The action definition to invoke.\n * @example\n * ```ts\n * const result = await client(createEmployee).applyAction(\n * { name: \"Jane\", department: \"Engineering\" },\n * { $returnEdits: true },\n * );\n * ```\n * @returns a callable for applying (or batch-applying) the action.\n */\n <Q extends ActionDefinition<any>>(o: Q): ActionSignatureFromDef<Q>;\n\n /**\n * @param o - The query definition to invoke.\n * @example\n * ```ts\n * const result = await client(getEmployeeCount).executeFunction({ department: \"Engineering\" });\n * ```\n * @returns a callable for executing the query function.\n */\n <Q extends QueryDefinition<any>>(o: Q): QuerySignatureFromDef<Q>;\n\n /**\n * @param experiment - The experiment marker that gates an unstable feature.\n * @example\n * ```ts\n * const employee = await client(__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid)\n * .fetchOneByRid(Employee, \"ri.phonograph2-objects.main.object.1234\");\n * ```\n * @returns the experiment-specific function surface.\n */\n <\n Q extends\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">\n | Experiment<\"2.59.0\">\n | Experiment<\"2.2.0\">\n | Experiment<\"2.8.0\">\n | Experiment<\"2.19.0\">,\n >(\n experiment: Q,\n ): ExperimentFns<Q>;\n\n /**\n * Fetches runtime metadata for the given ontology definition. The returned shape\n * is dispatched on the kind of definition passed: {@link ObjectMetadata},\n * {@link InterfaceMetadata}, {@link ActionMetadata}, or {@link QueryMetadata}.\n * @param o - The object type, interface, action, or query definition to look up.\n * @example\n * ```ts\n * const meta = await client.fetchMetadata(Employee);\n * console.log(meta.displayName, meta.description);\n * ```\n * @returns a promise resolving to the metadata for the given definition.\n */\n fetchMetadata<\n Q extends\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>,\n >(\n o: Q,\n ): Promise<\n Q extends ObjectTypeDefinition\n ? ObjectMetadata\n : Q extends InterfaceDefinition\n ? InterfaceMetadata\n : Q extends ActionDefinition<any>\n ? ActionMetadata\n : Q extends QueryDefinition<any>\n ? QueryMetadata\n : never\n >;\n\n /** @internal */\n [additionalContext]: MinimalClient;\n}\n\n// DO NOT EXPORT FROM PACKAGE\n/** @internal */\nexport const additionalContext: unique symbol = Symbol(\"additionalContext\");\n\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.63.1\";\n// END: THIS IS GENERATED CODE. DO NOT EDIT.\nexport type MaxOsdkVersion = typeof MaxOsdkVersion;\nconst ErrorMessage: unique symbol = Symbol(\"ErrorMessage\");\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA2BA;;AAkIA;AACA;AACA,OAAO,MAAMA,iBAAgC,GAAGC,MAAM,CAAC,mBAAmB,CAAC;;AAE3E;AACA,MAAMC,cAAc,GAAG,QAAQ;AAC/B;;AAEA,MAAMC,YAA2B,GAAGF,MAAM,CAAC,cAAc,CAAC","ignoreList":[]}
|
|
@@ -83,6 +83,7 @@ export class ObjectSetListenerWebsocket extends SubscriptionWebsocket {
|
|
|
83
83
|
requestedReferenceProperties
|
|
84
84
|
}) => ({
|
|
85
85
|
objectSet,
|
|
86
|
+
scenarioRid: this.client.scenarioRid,
|
|
86
87
|
propertySet: requestedProperties,
|
|
87
88
|
referenceSet: requestedReferenceProperties,
|
|
88
89
|
objectLoadingResponseOptions: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectSetListenerWebsocket.js","names":["WebSocket","invariant","isSubscriptionDone","SubscriptionWebsocket","constructWebsocketUrl","nextUuid","MINIMUM_RECONNECT_DELAY_MS","doNothing","fillOutListener","onChange","onError","onOutOfDate","onSuccessfulSubscription","ObjectSetListenerWebsocket","instances","WeakMap","getInstance","client","instance","get","clientCacheKey","set","endedSubscriptions","Set","constructor","minimumReconnectDelayMs","createConnection","factory","createSubscriptionConnection","url","baseUrl","ontologyRid","token","tokenProvider","createSubscribeRequests","requestId","readySubscriptions","id","requests","map","objectSet","requestedProperties","requestedReferenceProperties","propertySet","referenceSet","objectLoadingResponseOptions","shouldLoadObjectRids","isSubscriptionReady","sub","isReady","clearListener","listener","onSubscriptionEnded","add","subscriptionId","subscribe","objectType","properties","shouldLoadRids","objOrInterfaceDef","type","ontologyProvider","getObjectDefinition","apiName","getInterfaceDefinition","objectProperties","referenceProperties","length","Object","keys","filter","p","primaryKeyPropertyName","undefined","primaryKeyApiName","status","interfaceApiName","loadRids","subscriptions","initiateSubscribe","endSubscription","subscribeWithoutType","#initiateSubscribe","process","env","NODE_ENV","logger","debug","ensureWebsocket","ws","readyState","OPEN","sendSubscribeMessage","error","tryCatchOnError","handleWebsocketMessage","data","handleMessage_objectSetChanged","handleMessage_refreshObjectSet","handleMessage_subscribeResponses","handleMessage_subscriptionClosed","payload","objectUpdates","updates","update","referenceUpdates","osdkObjectsWithReferenceUpdates","Promise","all","o","osdkObjectArray","objectFactory","__apiName","__primaryKey","primaryKey","property","value","fetchInterfaceMapping","singleOsdkObject","object","state","osdkObjects","keysToDelete","key","includes","rid","$rid","osdkObject","#fetchInterfaceMapping","objectTypeApiName","interfaceMap","responses","subs","pendingSubscriptions","delete","i","response","errors","cycleWebsocket","shouldFireOutOfDate","#handleMessage_subscriptionClosed","has","cause","#tryCatchOnError","subscriptionClosed","onErrorError","console"],"sources":["ObjectSetListenerWebsocket.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ObjectOrInterfaceDefinition,\n ObjectSetSubscription,\n Osdk,\n PropertyKeys,\n} from \"@osdk/api\";\nimport type {\n ObjectSet,\n ObjectSetStreamSubscribeRequest,\n ObjectSetStreamSubscribeRequests,\n ObjectSetSubscribeResponses,\n ObjectSetUpdates,\n ObjectState,\n RefreshObjectSet,\n StreamMessage,\n SubscriptionClosed,\n} from \"@osdk/foundry.ontologies\";\nimport WebSocket from \"isomorphic-ws\";\nimport invariant from \"tiny-invariant\";\n\nimport type { ClientCacheKey, MinimalClient } from \"../MinimalClientContext.js\";\nimport type { SubscriptionConnection } from \"../SubscriptionConnection.js\";\nimport type { BaseSubscription } from \"./SubscriptionWebsocket.js\";\nimport {\n isSubscriptionDone,\n SubscriptionWebsocket,\n} from \"./SubscriptionWebsocket.js\";\nimport { constructWebsocketUrl, nextUuid } from \"./websocketUtils.js\";\n\nconst MINIMUM_RECONNECT_DELAY_MS = 5 * 1000;\n\n/** Noop function to reduce conditional checks */\nfunction doNothing() {}\n\n/**\n * Converts an ObjectSetListener to one where all the functions are defined.\n */\nfunction fillOutListener<\n Q extends ObjectOrInterfaceDefinition,\n P extends PropertyKeys<Q>,\n R extends boolean = false,\n>({\n onChange = doNothing,\n onError = doNothing,\n onOutOfDate = doNothing,\n onSuccessfulSubscription = doNothing,\n}: ObjectSetSubscription.Listener<Q, P, R>): Required<\n ObjectSetSubscription.Listener<Q, P, R>\n> {\n return { onChange, onError, onOutOfDate, onSuccessfulSubscription };\n}\n\ninterface Subscription<\n Q extends ObjectOrInterfaceDefinition,\n P extends PropertyKeys<Q>,\n> extends BaseSubscription {\n listener: Required<ObjectSetSubscription.Listener<Q, P>>;\n requestedProperties: Array<P>;\n requestedReferenceProperties: Array<P>;\n objectSet: ObjectSet;\n\n isReady?: boolean;\n\n interfaceApiName?: string;\n primaryKeyPropertyName?: string;\n loadRids: boolean;\n}\n\n/** @internal */\nexport class ObjectSetListenerWebsocket extends SubscriptionWebsocket<\n Subscription<any, any>,\n StreamMessage\n> {\n static #instances = new WeakMap<ClientCacheKey, ObjectSetListenerWebsocket>();\n readonly MINIMUM_RECONNECT_DELAY_MS: number;\n\n // FIXME\n static getInstance(client: MinimalClient): ObjectSetListenerWebsocket {\n let instance = ObjectSetListenerWebsocket.#instances.get(\n client.clientCacheKey,\n );\n if (instance == null) {\n instance = new ObjectSetListenerWebsocket(client);\n ObjectSetListenerWebsocket.#instances.set(\n client.clientCacheKey,\n instance,\n );\n }\n return instance;\n }\n\n #endedSubscriptions = new Set<string>();\n\n // DO NOT CONSTRUCT DIRECTLY. ONLY EXPOSED AS A TESTING SEAM\n constructor(\n client: MinimalClient,\n { minimumReconnectDelayMs = MINIMUM_RECONNECT_DELAY_MS } = {},\n ) {\n super(client, \"<OSW> \");\n this.MINIMUM_RECONNECT_DELAY_MS = minimumReconnectDelayMs;\n }\n\n /**\n * Default connection factory: constructs a real `WebSocket`, resolving the URL and bearer\n * token from the client. Used when the client provides no `createSubscriptionConnection`.\n */\n protected override async createConnection(): Promise<SubscriptionConnection> {\n const factory = this.client.createSubscriptionConnection;\n if (factory != null) {\n return factory();\n }\n const url = constructWebsocketUrl(\n this.client.baseUrl,\n await this.client.ontologyRid,\n );\n const token = await this.client.tokenProvider();\n return new WebSocket(url, [`Bearer-${token}`]);\n }\n\n protected override createSubscribeRequests(\n requestId: string,\n readySubscriptions: ReadonlyArray<Subscription<any, any>>,\n ): ObjectSetStreamSubscribeRequests {\n return {\n id: requestId,\n requests: readySubscriptions.map<ObjectSetStreamSubscribeRequest>(\n ({ objectSet, requestedProperties, requestedReferenceProperties }) => ({\n objectSet,\n propertySet: requestedProperties,\n referenceSet: requestedReferenceProperties,\n objectLoadingResponseOptions: { shouldLoadObjectRids: true },\n }),\n ),\n };\n }\n\n protected override isSubscriptionReady(sub: Subscription<any, any>): boolean {\n return sub.isReady != null;\n }\n\n protected override clearListener(sub: Subscription<any, any>): void {\n sub.listener = fillOutListener({});\n }\n\n protected override onSubscriptionEnded(sub: Subscription<any, any>): void {\n this.#endedSubscriptions.add(sub.subscriptionId);\n }\n\n async subscribe<\n Q extends ObjectOrInterfaceDefinition,\n P extends PropertyKeys<Q>,\n >(\n objectType: ObjectOrInterfaceDefinition,\n objectSet: ObjectSet,\n listener: ObjectSetSubscription.Listener<Q, P>,\n properties: Array<P> = [],\n shouldLoadRids: boolean = false,\n ): Promise<() => void> {\n const objOrInterfaceDef =\n objectType.type === \"object\"\n ? await this.client.ontologyProvider.getObjectDefinition(\n objectType.apiName,\n )\n : await this.client.ontologyProvider.getInterfaceDefinition(\n objectType.apiName,\n );\n\n let objectProperties: Array<P> = [];\n let referenceProperties: Array<P> = [];\n\n if (properties.length === 0) {\n properties = Object.keys(objOrInterfaceDef.properties) as Array<P>;\n }\n\n objectProperties = properties.filter(\n (p) =>\n p in objOrInterfaceDef.properties &&\n objOrInterfaceDef.properties[p].type !== \"geotimeSeriesReference\",\n );\n\n referenceProperties = properties.filter(\n (p) =>\n p in objOrInterfaceDef.properties &&\n objOrInterfaceDef.properties[p].type === \"geotimeSeriesReference\",\n );\n\n const sub: Subscription<Q, P> = {\n listener: fillOutListener<Q, P>(listener),\n objectSet,\n primaryKeyPropertyName:\n objOrInterfaceDef.type === \"interface\"\n ? undefined\n : objOrInterfaceDef.primaryKeyApiName,\n requestedProperties: objectProperties,\n requestedReferenceProperties: referenceProperties,\n status: \"preparing\",\n // Since we don't have a real subscription id yet but we need to keep\n // track of this reference, we can just use a random uuid.\n subscriptionId: `TMP-${nextUuid()}}`,\n interfaceApiName:\n objOrInterfaceDef.type === \"object\"\n ? undefined\n : objOrInterfaceDef.apiName,\n loadRids: shouldLoadRids,\n };\n\n this.subscriptions.set(sub.subscriptionId, sub);\n\n // actually prepares the subscription, ensures the ws is ready, and sends\n // a subscribe message. We don't want to block on this.\n void this.#initiateSubscribe(sub);\n\n return () => {\n this.endSubscription(sub);\n };\n }\n\n /**\n * Subscribes to a wire object set without an ontology type lookup.\n *\n * Used when the caller has only an object set RID and does not know (or care\n * about) the underlying object/interface type. No properties are requested,\n * so emitted `object` payloads carry only `$apiName` (and `$rid` when\n * `shouldLoadRids` is true). `$primaryKey` will be `undefined`.\n */\n subscribeWithoutType(\n objectSet: ObjectSet,\n listener: ObjectSetSubscription.Listener<\n ObjectOrInterfaceDefinition,\n never\n >,\n shouldLoadRids: boolean = false,\n ): () => void {\n const sub: Subscription<ObjectOrInterfaceDefinition, never> = {\n listener: fillOutListener(listener),\n objectSet,\n primaryKeyPropertyName: undefined,\n requestedProperties: [],\n requestedReferenceProperties: [],\n status: \"preparing\",\n subscriptionId: `TMP-${nextUuid()}}`,\n interfaceApiName: undefined,\n loadRids: shouldLoadRids,\n };\n\n this.subscriptions.set(sub.subscriptionId, sub);\n\n void this.#initiateSubscribe(sub);\n\n return () => {\n this.endSubscription(sub);\n };\n }\n\n /**\n * Called at least once for every subscription.\n *\n * - Resets pending expiry\n * - Recreates temporary object set\n * - Triggers a full subscribe message\n *\n * @returns\n */\n async #initiateSubscribe(sub: Subscription<any, any>) {\n if (process.env.NODE_ENV !== \"production\") {\n this.logger?.debug(\"#initiateSubscribe()\");\n }\n\n try {\n await this.ensureWebsocket();\n\n // the consumer may have already unsubscribed before we are ready to request a subscription\n // so we have to acquire the pendingSubscription after the await.\n if (isSubscriptionDone(sub)) {\n return;\n }\n sub.isReady = true;\n // if we aren't open, then this happens after we #onConnect\n if (this.ws?.readyState === WebSocket.OPEN) {\n this.sendSubscribeMessage();\n }\n } catch (error) {\n this.logger?.error(error, \"Error in #initiateSubscribe\");\n this.#tryCatchOnError(sub, true, error);\n }\n }\n\n protected override async handleWebsocketMessage(\n data: StreamMessage,\n ): Promise<void> {\n switch (data.type) {\n case \"objectSetChanged\":\n await this.#handleMessage_objectSetChanged(data);\n return;\n\n case \"refreshObjectSet\":\n this.#handleMessage_refreshObjectSet(data);\n return;\n\n case \"subscribeResponses\":\n this.#handleMessage_subscribeResponses(data);\n return;\n\n case \"subscriptionClosed\": {\n this.#handleMessage_subscriptionClosed(data);\n return;\n }\n\n default:\n const _: never = data;\n invariant(false, \"Unexpected message type\");\n }\n }\n\n #handleMessage_objectSetChanged = async (payload: ObjectSetUpdates) => {\n const sub = this.subscriptions.get(payload.id);\n if (sub == null) return;\n\n const objectUpdates = payload.updates.filter(\n (update) => update.type === \"object\",\n );\n const referenceUpdates = payload.updates.filter(\n (update) => update.type === \"reference\",\n );\n const osdkObjectsWithReferenceUpdates = await Promise.all(\n referenceUpdates.map(async (o) => {\n const osdkObjectArray = await this.client.objectFactory(\n this.client,\n [\n {\n __apiName: o.objectType,\n __primaryKey:\n sub.primaryKeyPropertyName != null\n ? o.primaryKey[sub.primaryKeyPropertyName]\n : undefined,\n ...o.primaryKey,\n [o.property]: o.value,\n },\n ],\n sub.interfaceApiName,\n {},\n undefined,\n false,\n undefined,\n false,\n await this.#fetchInterfaceMapping(o.objectType, sub.interfaceApiName),\n );\n const singleOsdkObject = osdkObjectArray[0] ?? undefined;\n return singleOsdkObject != null\n ? {\n object: singleOsdkObject as Osdk.Instance<any, never, any>,\n state: \"ADDED_OR_UPDATED\" as ObjectState,\n }\n : undefined;\n }),\n );\n\n for (const update of osdkObjectsWithReferenceUpdates) {\n if (update != null) {\n try {\n sub.listener.onChange?.(update);\n } catch (error) {\n this.logger?.error(error, \"Error in onChange callback\");\n this.#tryCatchOnError(sub, false, error);\n }\n }\n }\n\n const osdkObjects = await Promise.all(\n objectUpdates.map(async (o) => {\n const keysToDelete = Object.keys(o.object).filter((key) =>\n sub.requestedReferenceProperties.includes(key),\n );\n for (const key of keysToDelete) {\n delete o.object[key];\n }\n\n const osdkObjectArray = (await this.client.objectFactory(\n this.client,\n [o.object],\n sub.interfaceApiName,\n {},\n undefined,\n false,\n undefined,\n false,\n await this.#fetchInterfaceMapping(\n o.object.__apiName,\n sub.interfaceApiName,\n ),\n )) as Array<Osdk.Instance<any>>;\n const singleOsdkObject = osdkObjectArray[0] ?? undefined;\n\n const rid = singleOsdkObject.$rid as string | undefined;\n\n return singleOsdkObject != null\n ? rid === undefined\n ? {\n object: singleOsdkObject,\n state: o.state,\n }\n : {\n object: singleOsdkObject,\n state: o.state,\n rid,\n }\n : undefined;\n }),\n );\n\n for (const osdkObject of osdkObjects) {\n if (osdkObject != null) {\n try {\n sub.listener.onChange?.(osdkObject);\n } catch (error) {\n this.logger?.error(error, \"Error in onChange callback\");\n this.#tryCatchOnError(sub, false, error);\n }\n }\n }\n };\n\n async #fetchInterfaceMapping(\n objectTypeApiName: string,\n interfaceApiName: string | undefined,\n ): Promise<Record<string, Record<string, Record<string, string>>>> {\n if (interfaceApiName == null) return {};\n const interfaceMap = (\n await this.client.ontologyProvider.getObjectDefinition(objectTypeApiName)\n ).interfaceMap;\n return {\n [interfaceApiName]: {\n [objectTypeApiName]: interfaceMap[interfaceApiName],\n },\n };\n }\n\n #handleMessage_refreshObjectSet = (payload: RefreshObjectSet) => {\n const sub = this.subscriptions.get(payload.id);\n invariant(sub, `Expected subscription id ${payload.id}`);\n try {\n sub.listener.onOutOfDate();\n } catch (error) {\n this.logger?.error(error, \"Error in onOutOfDate callback\");\n this.#tryCatchOnError(sub, false, error);\n }\n };\n\n #handleMessage_subscribeResponses = (\n payload: ObjectSetSubscribeResponses,\n ) => {\n const { id, responses } = payload;\n\n const subs = this.pendingSubscriptions.get(id);\n invariant(subs, `should have a pending subscription for ${id}`);\n this.pendingSubscriptions.delete(id);\n\n for (let i = 0; i < responses.length; i++) {\n const sub = subs[i];\n const response = responses[i];\n\n switch (response.type) {\n case \"error\":\n this.#tryCatchOnError(sub, true, response.errors);\n this.endSubscription(sub, \"error\");\n break;\n\n case \"qos\":\n // the server has requested that we tear down our websocket and reconnect to help load balance\n this.cycleWebsocket();\n break;\n\n case \"success\":\n // `\"preparing\"` should only be the status on an initial subscribe.\n const shouldFireOutOfDate =\n sub.status === \"expired\" || sub.status === \"reconnecting\";\n\n if (process.env.NODE_ENV !== \"production\") {\n this.logger?.debug({ shouldFireOutOfDate }, \"success\");\n }\n sub.status = \"subscribed\";\n if (sub.subscriptionId !== response.id) {\n // might be the temporary one\n this.subscriptions.delete(sub.subscriptionId);\n sub.subscriptionId = response.id;\n this.subscriptions.set(sub.subscriptionId, sub); // future messages come by this subId\n }\n try {\n if (shouldFireOutOfDate) sub.listener.onOutOfDate();\n else sub.listener.onSuccessfulSubscription();\n } catch (error) {\n this.logger?.error(\n error,\n \"Error in onOutOfDate or onSuccessfulSubscription callback\",\n );\n this.#tryCatchOnError(sub, false, error);\n }\n break;\n default:\n this.#tryCatchOnError(sub, true, response);\n }\n }\n };\n\n #handleMessage_subscriptionClosed(payload: SubscriptionClosed) {\n const sub = this.subscriptions.get(payload.id);\n if (sub == null && this.#endedSubscriptions.has(payload.id)) return;\n invariant(sub, `Expected subscription id ${payload.id}`);\n this.#tryCatchOnError(sub, true, payload.cause);\n this.endSubscription(sub, \"error\");\n }\n\n #tryCatchOnError = (\n sub: Subscription<any, any>,\n subscriptionClosed: boolean,\n error: any,\n ) => {\n try {\n sub.listener.onError({ subscriptionClosed, error });\n } catch (onErrorError) {\n // eslint-disable-next-line no-console\n console.error(\n `Error encountered in an onError callback for an OSDK subscription`,\n onErrorError,\n );\n // eslint-disable-next-line no-console\n console.error(\n `This onError call was triggered by an error in another callback`,\n error,\n );\n // eslint-disable-next-line no-console\n console.error(`The subscription has been closed.`, error);\n\n if (!subscriptionClosed) {\n this.logger?.error(error, \"Error in onError callback\");\n this.endSubscription(sub, \"error\");\n this.#tryCatchOnError(sub, true, onErrorError);\n }\n }\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA,OAAOA,SAAS,MAAM,e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AAE,OAAO,CAAC;EACpC;EAEA,CAAC8C,eAAe,GAAGiD,CACjB/F,GAA2B,EAC3BgG,kBAA2B,EAC3BnD,KAAU,KACP;IACH,IAAI;MACF7C,GAAG,CAACG,QAAQ,CAACzC,OAAO,CAAC;QAAEsI,kBAAkB;QAAEnD;MAAM,CAAC,CAAC;IACrD,CAAC,CAAC,OAAOoD,YAAY,EAAE;MACrB;MACAC,OAAO,CAACrD,KAAK,CACX,mEAAmE,EACnEoD,YACF,CAAC;MACD;MACAC,OAAO,CAACrD,KAAK,CACX,iEAAiE,EACjEA,KACF,CAAC;MACD;MACAqD,OAAO,CAACrD,KAAK,CAAC,mCAAmC,EAAEA,KAAK,CAAC;MAEzD,IAAI,CAACmD,kBAAkB,EAAE;QACvB,IAAI,CAAC1D,MAAM,EAAEO,KAAK,CAACA,KAAK,EAAE,2BAA2B,CAAC;QACtD,IAAI,CAACb,eAAe,CAAChC,GAAG,EAAE,OAAO,CAAC;QAClC,IAAI,CAAC,CAAC8C,eAAe,CAAC9C,GAAG,EAAE,IAAI,EAAEiG,YAAY,CAAC;MAChD;IACF;EACF,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ObjectSetListenerWebsocket.js","names":["WebSocket","invariant","isSubscriptionDone","SubscriptionWebsocket","constructWebsocketUrl","nextUuid","MINIMUM_RECONNECT_DELAY_MS","doNothing","fillOutListener","onChange","onError","onOutOfDate","onSuccessfulSubscription","ObjectSetListenerWebsocket","instances","WeakMap","getInstance","client","instance","get","clientCacheKey","set","endedSubscriptions","Set","constructor","minimumReconnectDelayMs","createConnection","factory","createSubscriptionConnection","url","baseUrl","ontologyRid","token","tokenProvider","createSubscribeRequests","requestId","readySubscriptions","id","requests","map","objectSet","requestedProperties","requestedReferenceProperties","scenarioRid","propertySet","referenceSet","objectLoadingResponseOptions","shouldLoadObjectRids","isSubscriptionReady","sub","isReady","clearListener","listener","onSubscriptionEnded","add","subscriptionId","subscribe","objectType","properties","shouldLoadRids","objOrInterfaceDef","type","ontologyProvider","getObjectDefinition","apiName","getInterfaceDefinition","objectProperties","referenceProperties","length","Object","keys","filter","p","primaryKeyPropertyName","undefined","primaryKeyApiName","status","interfaceApiName","loadRids","subscriptions","initiateSubscribe","endSubscription","subscribeWithoutType","#initiateSubscribe","process","env","NODE_ENV","logger","debug","ensureWebsocket","ws","readyState","OPEN","sendSubscribeMessage","error","tryCatchOnError","handleWebsocketMessage","data","handleMessage_objectSetChanged","handleMessage_refreshObjectSet","handleMessage_subscribeResponses","handleMessage_subscriptionClosed","payload","objectUpdates","updates","update","referenceUpdates","osdkObjectsWithReferenceUpdates","Promise","all","o","osdkObjectArray","objectFactory","__apiName","__primaryKey","primaryKey","property","value","fetchInterfaceMapping","singleOsdkObject","object","state","osdkObjects","keysToDelete","key","includes","rid","$rid","osdkObject","#fetchInterfaceMapping","objectTypeApiName","interfaceMap","responses","subs","pendingSubscriptions","delete","i","response","errors","cycleWebsocket","shouldFireOutOfDate","#handleMessage_subscriptionClosed","has","cause","#tryCatchOnError","subscriptionClosed","onErrorError","console"],"sources":["ObjectSetListenerWebsocket.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ObjectOrInterfaceDefinition,\n ObjectSetSubscription,\n Osdk,\n PropertyKeys,\n} from \"@osdk/api\";\nimport type {\n ObjectSet,\n ObjectSetStreamSubscribeRequest,\n ObjectSetStreamSubscribeRequests,\n ObjectSetSubscribeResponses,\n ObjectSetUpdates,\n ObjectState,\n RefreshObjectSet,\n StreamMessage,\n SubscriptionClosed,\n} from \"@osdk/foundry.ontologies\";\nimport WebSocket from \"isomorphic-ws\";\nimport invariant from \"tiny-invariant\";\n\nimport type { ClientCacheKey, MinimalClient } from \"../MinimalClientContext.js\";\nimport type { SubscriptionConnection } from \"../SubscriptionConnection.js\";\nimport type { BaseSubscription } from \"./SubscriptionWebsocket.js\";\nimport {\n isSubscriptionDone,\n SubscriptionWebsocket,\n} from \"./SubscriptionWebsocket.js\";\nimport { constructWebsocketUrl, nextUuid } from \"./websocketUtils.js\";\n\nconst MINIMUM_RECONNECT_DELAY_MS = 5 * 1000;\n\n/** Noop function to reduce conditional checks */\nfunction doNothing() {}\n\n/**\n * Converts an ObjectSetListener to one where all the functions are defined.\n */\nfunction fillOutListener<\n Q extends ObjectOrInterfaceDefinition,\n P extends PropertyKeys<Q>,\n R extends boolean = false,\n>({\n onChange = doNothing,\n onError = doNothing,\n onOutOfDate = doNothing,\n onSuccessfulSubscription = doNothing,\n}: ObjectSetSubscription.Listener<Q, P, R>): Required<\n ObjectSetSubscription.Listener<Q, P, R>\n> {\n return { onChange, onError, onOutOfDate, onSuccessfulSubscription };\n}\n\ninterface Subscription<\n Q extends ObjectOrInterfaceDefinition,\n P extends PropertyKeys<Q>,\n> extends BaseSubscription {\n listener: Required<ObjectSetSubscription.Listener<Q, P>>;\n requestedProperties: Array<P>;\n requestedReferenceProperties: Array<P>;\n objectSet: ObjectSet;\n\n isReady?: boolean;\n\n interfaceApiName?: string;\n primaryKeyPropertyName?: string;\n loadRids: boolean;\n}\n\n/** @internal */\nexport class ObjectSetListenerWebsocket extends SubscriptionWebsocket<\n Subscription<any, any>,\n StreamMessage\n> {\n static #instances = new WeakMap<ClientCacheKey, ObjectSetListenerWebsocket>();\n readonly MINIMUM_RECONNECT_DELAY_MS: number;\n\n // FIXME\n static getInstance(client: MinimalClient): ObjectSetListenerWebsocket {\n let instance = ObjectSetListenerWebsocket.#instances.get(\n client.clientCacheKey,\n );\n if (instance == null) {\n instance = new ObjectSetListenerWebsocket(client);\n ObjectSetListenerWebsocket.#instances.set(\n client.clientCacheKey,\n instance,\n );\n }\n return instance;\n }\n\n #endedSubscriptions = new Set<string>();\n\n // DO NOT CONSTRUCT DIRECTLY. ONLY EXPOSED AS A TESTING SEAM\n constructor(\n client: MinimalClient,\n { minimumReconnectDelayMs = MINIMUM_RECONNECT_DELAY_MS } = {},\n ) {\n super(client, \"<OSW> \");\n this.MINIMUM_RECONNECT_DELAY_MS = minimumReconnectDelayMs;\n }\n\n /**\n * Default connection factory: constructs a real `WebSocket`, resolving the URL and bearer\n * token from the client. Used when the client provides no `createSubscriptionConnection`.\n */\n protected override async createConnection(): Promise<SubscriptionConnection> {\n const factory = this.client.createSubscriptionConnection;\n if (factory != null) {\n return factory();\n }\n const url = constructWebsocketUrl(\n this.client.baseUrl,\n await this.client.ontologyRid,\n );\n const token = await this.client.tokenProvider();\n return new WebSocket(url, [`Bearer-${token}`]);\n }\n\n protected override createSubscribeRequests(\n requestId: string,\n readySubscriptions: ReadonlyArray<Subscription<any, any>>,\n ): ObjectSetStreamSubscribeRequests {\n return {\n id: requestId,\n requests: readySubscriptions.map<ObjectSetStreamSubscribeRequest>(\n ({ objectSet, requestedProperties, requestedReferenceProperties }) => ({\n objectSet,\n scenarioRid: this.client.scenarioRid,\n propertySet: requestedProperties,\n referenceSet: requestedReferenceProperties,\n objectLoadingResponseOptions: { shouldLoadObjectRids: true },\n }),\n ),\n };\n }\n\n protected override isSubscriptionReady(sub: Subscription<any, any>): boolean {\n return sub.isReady != null;\n }\n\n protected override clearListener(sub: Subscription<any, any>): void {\n sub.listener = fillOutListener({});\n }\n\n protected override onSubscriptionEnded(sub: Subscription<any, any>): void {\n this.#endedSubscriptions.add(sub.subscriptionId);\n }\n\n async subscribe<\n Q extends ObjectOrInterfaceDefinition,\n P extends PropertyKeys<Q>,\n >(\n objectType: ObjectOrInterfaceDefinition,\n objectSet: ObjectSet,\n listener: ObjectSetSubscription.Listener<Q, P>,\n properties: Array<P> = [],\n shouldLoadRids: boolean = false,\n ): Promise<() => void> {\n const objOrInterfaceDef =\n objectType.type === \"object\"\n ? await this.client.ontologyProvider.getObjectDefinition(\n objectType.apiName,\n )\n : await this.client.ontologyProvider.getInterfaceDefinition(\n objectType.apiName,\n );\n\n let objectProperties: Array<P> = [];\n let referenceProperties: Array<P> = [];\n\n if (properties.length === 0) {\n properties = Object.keys(objOrInterfaceDef.properties) as Array<P>;\n }\n\n objectProperties = properties.filter(\n (p) =>\n p in objOrInterfaceDef.properties &&\n objOrInterfaceDef.properties[p].type !== \"geotimeSeriesReference\",\n );\n\n referenceProperties = properties.filter(\n (p) =>\n p in objOrInterfaceDef.properties &&\n objOrInterfaceDef.properties[p].type === \"geotimeSeriesReference\",\n );\n\n const sub: Subscription<Q, P> = {\n listener: fillOutListener<Q, P>(listener),\n objectSet,\n primaryKeyPropertyName:\n objOrInterfaceDef.type === \"interface\"\n ? undefined\n : objOrInterfaceDef.primaryKeyApiName,\n requestedProperties: objectProperties,\n requestedReferenceProperties: referenceProperties,\n status: \"preparing\",\n // Since we don't have a real subscription id yet but we need to keep\n // track of this reference, we can just use a random uuid.\n subscriptionId: `TMP-${nextUuid()}}`,\n interfaceApiName:\n objOrInterfaceDef.type === \"object\"\n ? undefined\n : objOrInterfaceDef.apiName,\n loadRids: shouldLoadRids,\n };\n\n this.subscriptions.set(sub.subscriptionId, sub);\n\n // actually prepares the subscription, ensures the ws is ready, and sends\n // a subscribe message. We don't want to block on this.\n void this.#initiateSubscribe(sub);\n\n return () => {\n this.endSubscription(sub);\n };\n }\n\n /**\n * Subscribes to a wire object set without an ontology type lookup.\n *\n * Used when the caller has only an object set RID and does not know (or care\n * about) the underlying object/interface type. No properties are requested,\n * so emitted `object` payloads carry only `$apiName` (and `$rid` when\n * `shouldLoadRids` is true). `$primaryKey` will be `undefined`.\n */\n subscribeWithoutType(\n objectSet: ObjectSet,\n listener: ObjectSetSubscription.Listener<\n ObjectOrInterfaceDefinition,\n never\n >,\n shouldLoadRids: boolean = false,\n ): () => void {\n const sub: Subscription<ObjectOrInterfaceDefinition, never> = {\n listener: fillOutListener(listener),\n objectSet,\n primaryKeyPropertyName: undefined,\n requestedProperties: [],\n requestedReferenceProperties: [],\n status: \"preparing\",\n subscriptionId: `TMP-${nextUuid()}}`,\n interfaceApiName: undefined,\n loadRids: shouldLoadRids,\n };\n\n this.subscriptions.set(sub.subscriptionId, sub);\n\n void this.#initiateSubscribe(sub);\n\n return () => {\n this.endSubscription(sub);\n };\n }\n\n /**\n * Called at least once for every subscription.\n *\n * - Resets pending expiry\n * - Recreates temporary object set\n * - Triggers a full subscribe message\n *\n * @returns\n */\n async #initiateSubscribe(sub: Subscription<any, any>) {\n if (process.env.NODE_ENV !== \"production\") {\n this.logger?.debug(\"#initiateSubscribe()\");\n }\n\n try {\n await this.ensureWebsocket();\n\n // the consumer may have already unsubscribed before we are ready to request a subscription\n // so we have to acquire the pendingSubscription after the await.\n if (isSubscriptionDone(sub)) {\n return;\n }\n sub.isReady = true;\n // if we aren't open, then this happens after we #onConnect\n if (this.ws?.readyState === WebSocket.OPEN) {\n this.sendSubscribeMessage();\n }\n } catch (error) {\n this.logger?.error(error, \"Error in #initiateSubscribe\");\n this.#tryCatchOnError(sub, true, error);\n }\n }\n\n protected override async handleWebsocketMessage(\n data: StreamMessage,\n ): Promise<void> {\n switch (data.type) {\n case \"objectSetChanged\":\n await this.#handleMessage_objectSetChanged(data);\n return;\n\n case \"refreshObjectSet\":\n this.#handleMessage_refreshObjectSet(data);\n return;\n\n case \"subscribeResponses\":\n this.#handleMessage_subscribeResponses(data);\n return;\n\n case \"subscriptionClosed\": {\n this.#handleMessage_subscriptionClosed(data);\n return;\n }\n\n default:\n const _: never = data;\n invariant(false, \"Unexpected message type\");\n }\n }\n\n #handleMessage_objectSetChanged = async (payload: ObjectSetUpdates) => {\n const sub = this.subscriptions.get(payload.id);\n if (sub == null) return;\n\n const objectUpdates = payload.updates.filter(\n (update) => update.type === \"object\",\n );\n const referenceUpdates = payload.updates.filter(\n (update) => update.type === \"reference\",\n );\n const osdkObjectsWithReferenceUpdates = await Promise.all(\n referenceUpdates.map(async (o) => {\n const osdkObjectArray = await this.client.objectFactory(\n this.client,\n [\n {\n __apiName: o.objectType,\n __primaryKey:\n sub.primaryKeyPropertyName != null\n ? o.primaryKey[sub.primaryKeyPropertyName]\n : undefined,\n ...o.primaryKey,\n [o.property]: o.value,\n },\n ],\n sub.interfaceApiName,\n {},\n undefined,\n false,\n undefined,\n false,\n await this.#fetchInterfaceMapping(o.objectType, sub.interfaceApiName),\n );\n const singleOsdkObject = osdkObjectArray[0] ?? undefined;\n return singleOsdkObject != null\n ? {\n object: singleOsdkObject as Osdk.Instance<any, never, any>,\n state: \"ADDED_OR_UPDATED\" as ObjectState,\n }\n : undefined;\n }),\n );\n\n for (const update of osdkObjectsWithReferenceUpdates) {\n if (update != null) {\n try {\n sub.listener.onChange?.(update);\n } catch (error) {\n this.logger?.error(error, \"Error in onChange callback\");\n this.#tryCatchOnError(sub, false, error);\n }\n }\n }\n\n const osdkObjects = await Promise.all(\n objectUpdates.map(async (o) => {\n const keysToDelete = Object.keys(o.object).filter((key) =>\n sub.requestedReferenceProperties.includes(key),\n );\n for (const key of keysToDelete) {\n delete o.object[key];\n }\n\n const osdkObjectArray = (await this.client.objectFactory(\n this.client,\n [o.object],\n sub.interfaceApiName,\n {},\n undefined,\n false,\n undefined,\n false,\n await this.#fetchInterfaceMapping(\n o.object.__apiName,\n sub.interfaceApiName,\n ),\n )) as Array<Osdk.Instance<any>>;\n const singleOsdkObject = osdkObjectArray[0] ?? undefined;\n\n const rid = singleOsdkObject.$rid as string | undefined;\n\n return singleOsdkObject != null\n ? rid === undefined\n ? {\n object: singleOsdkObject,\n state: o.state,\n }\n : {\n object: singleOsdkObject,\n state: o.state,\n rid,\n }\n : undefined;\n }),\n );\n\n for (const osdkObject of osdkObjects) {\n if (osdkObject != null) {\n try {\n sub.listener.onChange?.(osdkObject);\n } catch (error) {\n this.logger?.error(error, \"Error in onChange callback\");\n this.#tryCatchOnError(sub, false, error);\n }\n }\n }\n };\n\n async #fetchInterfaceMapping(\n objectTypeApiName: string,\n interfaceApiName: string | undefined,\n ): Promise<Record<string, Record<string, Record<string, string>>>> {\n if (interfaceApiName == null) return {};\n const interfaceMap = (\n await this.client.ontologyProvider.getObjectDefinition(objectTypeApiName)\n ).interfaceMap;\n return {\n [interfaceApiName]: {\n [objectTypeApiName]: interfaceMap[interfaceApiName],\n },\n };\n }\n\n #handleMessage_refreshObjectSet = (payload: RefreshObjectSet) => {\n const sub = this.subscriptions.get(payload.id);\n invariant(sub, `Expected subscription id ${payload.id}`);\n try {\n sub.listener.onOutOfDate();\n } catch (error) {\n this.logger?.error(error, \"Error in onOutOfDate callback\");\n this.#tryCatchOnError(sub, false, error);\n }\n };\n\n #handleMessage_subscribeResponses = (\n payload: ObjectSetSubscribeResponses,\n ) => {\n const { id, responses } = payload;\n\n const subs = this.pendingSubscriptions.get(id);\n invariant(subs, `should have a pending subscription for ${id}`);\n this.pendingSubscriptions.delete(id);\n\n for (let i = 0; i < responses.length; i++) {\n const sub = subs[i];\n const response = responses[i];\n\n switch (response.type) {\n case \"error\":\n this.#tryCatchOnError(sub, true, response.errors);\n this.endSubscription(sub, \"error\");\n break;\n\n case \"qos\":\n // the server has requested that we tear down our websocket and reconnect to help load balance\n this.cycleWebsocket();\n break;\n\n case \"success\":\n // `\"preparing\"` should only be the status on an initial subscribe.\n const shouldFireOutOfDate =\n sub.status === \"expired\" || sub.status === \"reconnecting\";\n\n if (process.env.NODE_ENV !== \"production\") {\n this.logger?.debug({ shouldFireOutOfDate }, \"success\");\n }\n sub.status = \"subscribed\";\n if (sub.subscriptionId !== response.id) {\n // might be the temporary one\n this.subscriptions.delete(sub.subscriptionId);\n sub.subscriptionId = response.id;\n this.subscriptions.set(sub.subscriptionId, sub); // future messages come by this subId\n }\n try {\n if (shouldFireOutOfDate) sub.listener.onOutOfDate();\n else sub.listener.onSuccessfulSubscription();\n } catch (error) {\n this.logger?.error(\n error,\n \"Error in onOutOfDate or onSuccessfulSubscription callback\",\n );\n this.#tryCatchOnError(sub, false, error);\n }\n break;\n default:\n this.#tryCatchOnError(sub, true, response);\n }\n }\n };\n\n #handleMessage_subscriptionClosed(payload: SubscriptionClosed) {\n const sub = this.subscriptions.get(payload.id);\n if (sub == null && this.#endedSubscriptions.has(payload.id)) return;\n invariant(sub, `Expected subscription id ${payload.id}`);\n this.#tryCatchOnError(sub, true, payload.cause);\n this.endSubscription(sub, \"error\");\n }\n\n #tryCatchOnError = (\n sub: Subscription<any, any>,\n subscriptionClosed: boolean,\n error: any,\n ) => {\n try {\n sub.listener.onError({ subscriptionClosed, error });\n } catch (onErrorError) {\n // eslint-disable-next-line no-console\n console.error(\n `Error encountered in an onError callback for an OSDK subscription`,\n onErrorError,\n );\n // eslint-disable-next-line no-console\n console.error(\n `This onError call was triggered by an error in another callback`,\n error,\n );\n // eslint-disable-next-line no-console\n console.error(`The subscription has been closed.`, error);\n\n if (!subscriptionClosed) {\n this.logger?.error(error, \"Error in onError callback\");\n this.endSubscription(sub, \"error\");\n this.#tryCatchOnError(sub, true, onErrorError);\n }\n }\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA,OAAOA,SAAS,MAAM,eAAe;AACrC,OAAOC,SAAS,MAAM,gBAAgB;AAKtC,SACEC,kBAAkB,EAClBC,qBAAqB,QAChB,4BAA4B;AACnC,SAASC,qBAAqB,EAAEC,QAAQ,QAAQ,qBAAqB;AAErE,MAAMC,0BAA0B,GAAG,CAAC,GAAG,IAAI;;AAE3C;AACA,SAASC,SAASA,CAAA,EAAG,CAAC;;AAEtB;AACA;AACA;AACA,SAASC,eAAeA,CAItB;EACAC,QAAQ,GAAGF,SAAS;EACpBG,OAAO,GAAGH,SAAS;EACnBI,WAAW,GAAGJ,SAAS;EACvBK,wBAAwB,GAAGL;AACY,CAA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AO,CAACrD,KAAK,CACX,iEAAiE,EACjEA,KACF,CAAC;MACD;MACAqD,OAAO,CAACrD,KAAK,CAAC,mCAAmC,EAAEA,KAAK,CAAC;MAEzD,IAAI,CAACmD,kBAAkB,EAAE;QACvB,IAAI,CAAC1D,MAAM,EAAEO,KAAK,CAACA,KAAK,EAAE,2BAA2B,CAAC;QACtD,IAAI,CAACb,eAAe,CAAChC,GAAG,EAAE,OAAO,CAAC;QAClC,IAAI,CAAC,CAAC8C,eAAe,CAAC9C,GAAG,EAAE,IAAI,EAAEiG,YAAY,CAAC;MAChD;IACF;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
export const USER_AGENT = `osdk-client/${"2.63.
|
|
18
|
-
export const OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.63.
|
|
17
|
+
export const USER_AGENT = `osdk-client/${"2.63.1-main-6adfde43e644202bc153746619b184259bbb874b"}`;
|
|
18
|
+
export const OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.63.1-main-6adfde43e644202bc153746619b184259bbb874b"}`;
|
|
19
19
|
//# sourceMappingURL=UserAgent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserAgent.js","names":["USER_AGENT","OBSERVABLE_USER_AGENT"],"sources":["UserAgent.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const USER_AGENT: string = `osdk-client/${process.env.PACKAGE_VERSION}`;\nexport const OBSERVABLE_USER_AGENT: string = `osdk-observable-client/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,UAAkB,GAAG,
|
|
1
|
+
{"version":3,"file":"UserAgent.js","names":["USER_AGENT","OBSERVABLE_USER_AGENT"],"sources":["UserAgent.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const USER_AGENT: string = `osdk-client/${process.env.PACKAGE_VERSION}`;\nexport const OBSERVABLE_USER_AGENT: string = `osdk-observable-client/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,UAAkB,GAAG,uEAA4C;AAC9E,OAAO,MAAMC,qBAA6B,GAAG,kFAAuD","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkG2EJPP5V_cjs = require('./chunk-G2EJPP5V.cjs');
|
|
4
|
+
require('./chunk-KTZGY72C.cjs');
|
|
5
|
+
require('./chunk-Q7SFCCGT.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "ObjectSetListenerWebsocket", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunkG2EJPP5V_cjs.ObjectSetListenerWebsocket; }
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=ObjectSetListenerWebsocket-2IFZTCZH.cjs.map
|
|
14
|
+
//# sourceMappingURL=ObjectSetListenerWebsocket-2IFZTCZH.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"ObjectSetListenerWebsocket-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"ObjectSetListenerWebsocket-2IFZTCZH.cjs"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkIZVMT4FN_cjs = require('./chunk-IZVMT4FN.cjs');
|
|
4
|
+
var chunkIQTLVTFK_cjs = require('./chunk-IQTLVTFK.cjs');
|
|
5
5
|
var chunkQ7QYW5NE_cjs = require('./chunk-Q7QYW5NE.cjs');
|
|
6
6
|
require('./chunk-Q7SFCCGT.cjs');
|
|
7
7
|
|
|
@@ -17,21 +17,21 @@ async function* applyStreamingQuery(client, query, params) {
|
|
|
17
17
|
if (client.flushEdits != null) {
|
|
18
18
|
await client.flushEdits();
|
|
19
19
|
}
|
|
20
|
-
const response = await streamingExecute(
|
|
20
|
+
const response = await streamingExecute(chunkIQTLVTFK_cjs.addUserAgentAndRequestContextHeaders(chunkIQTLVTFK_cjs.augmentRequestContext(client, (_) => ({
|
|
21
21
|
finalMethodCall: "applyStreamingQuery"
|
|
22
22
|
})), query), query.apiName, {
|
|
23
23
|
ontology: await client.ontologyRid,
|
|
24
|
-
parameters: params ? await
|
|
24
|
+
parameters: params ? await chunkIZVMT4FN_cjs.remapQueryParams(params, client, qd.parameters) : {},
|
|
25
25
|
version: query.isFixedVersion ? query.version : void 0,
|
|
26
26
|
branch: client.branch
|
|
27
27
|
}, {
|
|
28
28
|
transactionId: client.transactionId,
|
|
29
29
|
preview: true
|
|
30
30
|
});
|
|
31
|
-
const definitions = await
|
|
31
|
+
const definitions = await chunkIZVMT4FN_cjs.getRequiredDefinitions(qd.output, client);
|
|
32
32
|
for await (const event of response) {
|
|
33
33
|
if (event.type !== "data") continue;
|
|
34
|
-
const remapped = await
|
|
34
|
+
const remapped = await chunkIZVMT4FN_cjs.remapQueryResponse(client, qd.output, event.value, definitions);
|
|
35
35
|
if (qd.output.type === "array" && Array.isArray(remapped)) {
|
|
36
36
|
for (const item of remapped) {
|
|
37
37
|
yield item;
|
|
@@ -43,5 +43,5 @@ async function* applyStreamingQuery(client, query, params) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
exports.applyStreamingQuery = applyStreamingQuery;
|
|
46
|
-
//# sourceMappingURL=applyStreamingQuery-
|
|
47
|
-
//# sourceMappingURL=applyStreamingQuery-
|
|
46
|
+
//# sourceMappingURL=applyStreamingQuery-DKQ42L3G.cjs.map
|
|
47
|
+
//# sourceMappingURL=applyStreamingQuery-DKQ42L3G.cjs.map
|
package/build/cjs/{applyStreamingQuery-Y36LKEC3.cjs.map → applyStreamingQuery-DKQ42L3G.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../node_modules/.pnpm/@osdk+foundry.functions@2.75.0/node_modules/@osdk/foundry.functions/build/esm/public/Query.js","../../src/queries/applyStreamingQuery.ts"],"names":["foundryPlatformFetch","addUserAgentAndRequestContextHeaders","augmentRequestContext","remapQueryParams","getRequiredDefinitions","remapQueryResponse"],"mappings":";;;;;;;;AAgFA,IAAM,oBAAoB,CAAC,CAAA,EAAG,4CAAA,EAA8C,CAAA,IAAI,mBAAmB,CAAA;AA2B5F,SAAS,gBAAA,CAAiB,SAAS,IAAA,EAAM;AAC9C,EAAA,OAAOA,sCAAA,CAAsB,IAAA,EAAM,iBAAA,EAAmB,GAAG,IAAI,CAAA;AAC/D;;;ACzFA,gBAAuB,mBAAA,CAAoB,MAAA,EAAQ,KAAA,EAAO,MAAA,EAAQ;AAChE,EAAA,MAAM,EAAA,GAAK,MAAM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M,IAAA;AAAA,MACR;AAAA,IACF,CAAA,MAAO;AACL,MAAA,MAAM,QAAA;AAAA,IACR;AAAA,EACF;AACF","file":"applyStreamingQuery-Y36LKEC3.cjs","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 { foundryPlatformFetch as $foundryPlatformFetch } from \"@osdk/shared.net.platformapi\";\n//\nconst _get = [0, \"/v2/functions/queries/{0}\", 2];\n/**\n * Gets a specific query type with the given API name. By default, this returns the highest semantic\n * version of the query, excluding pre-release versions. To resolve the most recently published version\n * instead, including pre-release versions, set `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * @beta\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/{queryApiName}\n */\nexport function get($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _get, ...args);\n}\nconst _getByRid = [0, \"/v2/functions/queries/getByRid\", 2];\n/**\n * Gets a specific query type with the given RID. By default, this gets the latest version of the query.\n *\n * @beta\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/getByRid\n */\nexport function getByRid($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getByRid, ...args);\n}\nconst _getByRidBatch = [1, \"/v2/functions/queries/getByRidBatch\", 3];\n/**\n * Gets a list of query types by RID in bulk. By default, this gets the latest version of each query.\n *\n * Queries are filtered from the response if they don't exist or the requesting token lacks the required\n * permissions.\n *\n * The maximum batch size for this endpoint is 100.\n *\n * @beta\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/getByRidBatch\n */\nexport function getByRidBatch($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getByRidBatch, ...args);\n}\nconst _execute = [1, \"/v2/functions/queries/{0}/execute\", 7];\n/**\n * Executes a Query and returns the result as a single JSON object. By default, this executes\n * the highest semantic version of the query, excluding pre-release versions. To resolve the\n * most recently published version instead, including pre-release versions, set\n * `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * This endpoint executes global (non-ontology-scoped) query functions. For ontology-scoped\n * functions, use the equivalent endpoint under\n * `/v2/ontologies/{ontology}/queries/{queryApiName}/execute`. For streaming or incremental\n * result delivery, use `streamingExecute`.\n *\n * @beta\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/execute\n */\nexport function execute($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _execute, ...args);\n}\nconst _streamingExecute = [1, \"/v2/functions/queries/{0}/streamingExecute\", 7,, \"text/event-stream\"];\n/**\n * Executes a Query and returns results as a Server-Sent Events (`text/event-stream`) stream.\n * By default, this executes the highest semantic version of the query, excluding pre-release\n * versions. To resolve the most recently published version instead, including pre-release\n * versions, set `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * This endpoint supports all Query functions. Each SSE event's `data` field is a JSON-encoded\n * `StreamingExecuteQueryResponse` – either a data batch (`type: data`) carrying one or more\n * result values, or an error (`type: error`) emitted before stream termination if execution\n * fails. Non-streaming functions emit a single data event containing the entire result;\n * streaming functions emit a data event per batch as results become available.\n *\n * Per the Server-Sent Events specification, each event is terminated by a blank line:\n *\n * ```\n * data: {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-001\",\"price\":29.99}]}\n *\n * data: {\"type\":\"error\",\"errorCode\":\"INVALID_ARGUMENT\",\"errorName\":\"QueryRuntimeError\",\"errorInstanceId\":\"3f8a9c7b-2e4d-4a1f-9b8c-7d6e5f4a3b2c\",\"errorDescription\":\"Division by zero\",\"parameters\":{}}\n *\n * ```\n *\n * @beta\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/streamingExecute\n */\nexport function streamingExecute($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _streamingExecute, ...args);\n}\nconst _streamingExecuteEvents = [1, \"/v2/functions/queries/{0}/streamingExecuteEvents\", 7,, \"text/event-stream\"];\n/**\n * Executes a Query and returns results as a Server-Sent Events (`text/event-stream`) stream.\n * By default, this executes the highest semantic version of the query, excluding pre-release\n * versions. To resolve the most recently published version instead, including pre-release\n * versions, set `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * This endpoint supports all Query functions. Each SSE event's `data` field is a JSON-encoded\n * `StreamingExecuteQueryResponse` – either a data batch (`type: data`) carrying one or more\n * result values, or an error (`type: error`) emitted before stream termination if execution\n * fails. Non-streaming functions emit a single data event containing the entire result;\n * streaming functions emit a data event per batch as results become available.\n *\n * Per the Server-Sent Events specification, each event is terminated by a blank line:\n *\n * ```\n * data: {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-001\",\"price\":29.99}]}\n *\n * data: {\"type\":\"error\",\"errorCode\":\"INVALID_ARGUMENT\",\"errorName\":\"QueryRuntimeError\",\"errorInstanceId\":\"3f8a9c7b-2e4d-4a1f-9b8c-7d6e5f4a3b2c\",\"errorDescription\":\"Division by zero\",\"parameters\":{}}\n *\n * ```\n *\n * @alpha\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/streamingExecuteEvents\n */\nexport function streamingExecuteEvents($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _streamingExecuteEvents, ...args);\n}\nconst _executeAsync = [1, \"/v2/functions/queries/{0}/executeAsync\", 7];\n/**\n * Submits a Query for asynchronous execution. Returns either an execution ID\n * for polling, or the complete result if execution finished immediately.\n *\n * Use the Execution resource's getResult endpoint to poll for the\n * result of a submitted execution.\n *\n * @alpha\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/executeAsync\n */\nexport function executeAsync($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _executeAsync, ...args);\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as Functions from \"@osdk/foundry.functions/Query\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport { getRequiredDefinitions, remapQueryParams, remapQueryResponse } from \"./applyQuery.js\";\nexport async function* applyStreamingQuery(client, query, params) {\n const qd = await client.ontologyProvider.getQueryDefinition(query.apiName, query.isFixedVersion ? query.version : undefined);\n if (client.flushEdits != null) {\n await client.flushEdits();\n }\n const response = await Functions.streamingExecute(addUserAgentAndRequestContextHeaders(augmentRequestContext(client, _ => ({\n finalMethodCall: \"applyStreamingQuery\"\n })), query), query.apiName, {\n ontology: await client.ontologyRid,\n parameters: params ? await remapQueryParams(params, client, qd.parameters) : {},\n version: query.isFixedVersion ? query.version : undefined,\n branch: client.branch\n }, {\n transactionId: client.transactionId,\n preview: true\n });\n const definitions = await getRequiredDefinitions(qd.output, client);\n for await (const event of response) {\n if (event.type !== \"data\") continue;\n const remapped = await remapQueryResponse(client, qd.output, event.value, definitions);\n if (qd.output.type === \"array\" && Array.isArray(remapped)) {\n for (const item of remapped) {\n yield item;\n }\n } else {\n yield remapped;\n }\n }\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../../../node_modules/.pnpm/@osdk+foundry.functions@2.75.0/node_modules/@osdk/foundry.functions/build/esm/public/Query.js","../../src/queries/applyStreamingQuery.ts"],"names":["foundryPlatformFetch","addUserAgentAndRequestContextHeaders","augmentRequestContext","remapQueryParams","getRequi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,WAAA,MAAiB,SAAS,QAAA,EAAU;AAClC,IAAA,IAAI,KAAA,CAAM,SAAS,MAAA,EAAQ;AAC3B,IAAA,MAAM,QAAA,GAAW,MAAMC,oCAAA,CAAmB,MAAA,EAAQ,GAAG,MAAA,EAAQ,KAAA,CAAM,OAAO,WAAW,CAAA;AACrF,IAAA,IAAI,GAAG,MAAA,CAAO,IAAA,KAAS,WAAW,KAAA,CAAM,OAAA,CAAQ,QAAQ,CAAA,EAAG;AACzD,MAAA,KAAA,MAAW,QAAQ,QAAA,EAAU;AAC3B,QAAA,MAAM,IAAA;AAAA,MACR;AAAA,IACF,CAAA,MAAO;AACL,MAAA,MAAM,QAAA;AAAA,IACR;AAAA,EACF;AACF","file":"applyStreamingQuery-DKQ42L3G.cjs","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 { foundryPlatformFetch as $foundryPlatformFetch } from \"@osdk/shared.net.platformapi\";\n//\nconst _get = [0, \"/v2/functions/queries/{0}\", 2];\n/**\n * Gets a specific query type with the given API name. By default, this returns the highest semantic\n * version of the query, excluding pre-release versions. To resolve the most recently published version\n * instead, including pre-release versions, set `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * @beta\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/{queryApiName}\n */\nexport function get($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _get, ...args);\n}\nconst _getByRid = [0, \"/v2/functions/queries/getByRid\", 2];\n/**\n * Gets a specific query type with the given RID. By default, this gets the latest version of the query.\n *\n * @beta\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/getByRid\n */\nexport function getByRid($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getByRid, ...args);\n}\nconst _getByRidBatch = [1, \"/v2/functions/queries/getByRidBatch\", 3];\n/**\n * Gets a list of query types by RID in bulk. By default, this gets the latest version of each query.\n *\n * Queries are filtered from the response if they don't exist or the requesting token lacks the required\n * permissions.\n *\n * The maximum batch size for this endpoint is 100.\n *\n * @beta\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/getByRidBatch\n */\nexport function getByRidBatch($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getByRidBatch, ...args);\n}\nconst _execute = [1, \"/v2/functions/queries/{0}/execute\", 7];\n/**\n * Executes a Query and returns the result as a single JSON object. By default, this executes\n * the highest semantic version of the query, excluding pre-release versions. To resolve the\n * most recently published version instead, including pre-release versions, set\n * `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * This endpoint executes global (non-ontology-scoped) query functions. For ontology-scoped\n * functions, use the equivalent endpoint under\n * `/v2/ontologies/{ontology}/queries/{queryApiName}/execute`. For streaming or incremental\n * result delivery, use `streamingExecute`.\n *\n * @beta\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/execute\n */\nexport function execute($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _execute, ...args);\n}\nconst _streamingExecute = [1, \"/v2/functions/queries/{0}/streamingExecute\", 7,, \"text/event-stream\"];\n/**\n * Executes a Query and returns results as a Server-Sent Events (`text/event-stream`) stream.\n * By default, this executes the highest semantic version of the query, excluding pre-release\n * versions. To resolve the most recently published version instead, including pre-release\n * versions, set `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * This endpoint supports all Query functions. Each SSE event's `data` field is a JSON-encoded\n * `StreamingExecuteQueryResponse` – either a data batch (`type: data`) carrying one or more\n * result values, or an error (`type: error`) emitted before stream termination if execution\n * fails. Non-streaming functions emit a single data event containing the entire result;\n * streaming functions emit a data event per batch as results become available.\n *\n * Per the Server-Sent Events specification, each event is terminated by a blank line:\n *\n * ```\n * data: {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-001\",\"price\":29.99}]}\n *\n * data: {\"type\":\"error\",\"errorCode\":\"INVALID_ARGUMENT\",\"errorName\":\"QueryRuntimeError\",\"errorInstanceId\":\"3f8a9c7b-2e4d-4a1f-9b8c-7d6e5f4a3b2c\",\"errorDescription\":\"Division by zero\",\"parameters\":{}}\n *\n * ```\n *\n * @beta\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/streamingExecute\n */\nexport function streamingExecute($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _streamingExecute, ...args);\n}\nconst _streamingExecuteEvents = [1, \"/v2/functions/queries/{0}/streamingExecuteEvents\", 7,, \"text/event-stream\"];\n/**\n * Executes a Query and returns results as a Server-Sent Events (`text/event-stream`) stream.\n * By default, this executes the highest semantic version of the query, excluding pre-release\n * versions. To resolve the most recently published version instead, including pre-release\n * versions, set `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * This endpoint supports all Query functions. Each SSE event's `data` field is a JSON-encoded\n * `StreamingExecuteQueryResponse` – either a data batch (`type: data`) carrying one or more\n * result values, or an error (`type: error`) emitted before stream termination if execution\n * fails. Non-streaming functions emit a single data event containing the entire result;\n * streaming functions emit a data event per batch as results become available.\n *\n * Per the Server-Sent Events specification, each event is terminated by a blank line:\n *\n * ```\n * data: {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-001\",\"price\":29.99}]}\n *\n * data: {\"type\":\"error\",\"errorCode\":\"INVALID_ARGUMENT\",\"errorName\":\"QueryRuntimeError\",\"errorInstanceId\":\"3f8a9c7b-2e4d-4a1f-9b8c-7d6e5f4a3b2c\",\"errorDescription\":\"Division by zero\",\"parameters\":{}}\n *\n * ```\n *\n * @alpha\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/streamingExecuteEvents\n */\nexport function streamingExecuteEvents($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _streamingExecuteEvents, ...args);\n}\nconst _executeAsync = [1, \"/v2/functions/queries/{0}/executeAsync\", 7];\n/**\n * Submits a Query for asynchronous execution. Returns either an execution ID\n * for polling, or the complete result if execution finished immediately.\n *\n * Use the Execution resource's getResult endpoint to poll for the\n * result of a submitted execution.\n *\n * @alpha\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/executeAsync\n */\nexport function executeAsync($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _executeAsync, ...args);\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as Functions from \"@osdk/foundry.functions/Query\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport { getRequiredDefinitions, remapQueryParams, remapQueryResponse } from \"./applyQuery.js\";\nexport async function* applyStreamingQuery(client, query, params) {\n const qd = await client.ontologyProvider.getQueryDefinition(query.apiName, query.isFixedVersion ? query.version : undefined);\n if (client.flushEdits != null) {\n await client.flushEdits();\n }\n const response = await Functions.streamingExecute(addUserAgentAndRequestContextHeaders(augmentRequestContext(client, _ => ({\n finalMethodCall: \"applyStreamingQuery\"\n })), query), query.apiName, {\n ontology: await client.ontologyRid,\n parameters: params ? await remapQueryParams(params, client, qd.parameters) : {},\n version: query.isFixedVersion ? query.version : undefined,\n branch: client.branch\n }, {\n transactionId: client.transactionId,\n preview: true\n });\n const definitions = await getRequiredDefinitions(qd.output, client);\n for await (const event of response) {\n if (event.type !== \"data\") continue;\n const remapped = await remapQueryResponse(client, qd.output, event.value, definitions);\n if (qd.output.type === \"array\" && Array.isArray(remapped)) {\n for (const item of remapped) {\n yield item;\n }\n } else {\n yield remapped;\n }\n }\n}"]}
|