@osdk/client 0.16.0 → 0.17.0-main-20240430161814
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 +7 -1
- package/build/js/{ObjectSetListenerWebsocket-ODRFQQMY.cjs → ObjectSetListenerWebsocket-QQ45K3YV.cjs} +7 -7
- package/build/js/{ObjectSetListenerWebsocket-ODRFQQMY.cjs.map → ObjectSetListenerWebsocket-QQ45K3YV.cjs.map} +1 -1
- package/build/js/{ObjectSetListenerWebsocket-XV5EGCT6.mjs → ObjectSetListenerWebsocket-TWQJWEX2.mjs} +2 -2
- package/build/js/{ObjectSetListenerWebsocket-XV5EGCT6.mjs.map → ObjectSetListenerWebsocket-TWQJWEX2.mjs.map} +1 -1
- package/build/js/{chunk-ZE5276TU.mjs → chunk-4MFLNKU3.mjs} +3 -3
- package/build/js/{chunk-FM5TB24T.cjs.map → chunk-4MFLNKU3.mjs.map} +1 -1
- package/build/js/{chunk-FM5TB24T.cjs → chunk-X5T2JBPJ.cjs} +3 -3
- package/build/js/{chunk-ZE5276TU.mjs.map → chunk-X5T2JBPJ.cjs.map} +1 -1
- package/build/js/index.cjs +16 -16
- package/build/js/index.cjs.map +1 -1
- package/build/js/index.mjs +3 -3
- package/build/js/index.mjs.map +1 -1
- package/build/types/Client.d.ts +1 -1
- package/build/types/actions/Actions.d.ts +1 -1
- package/build/types/generatedNoCheck/OntologyMetadata.d.ts +1 -1
- package/build/types/internal/conversions/legacyToModernSingleAggregationResult.d.ts +1 -1
- package/build/types/internal/conversions/modernToLegacyAggregationClause.d.ts +1 -1
- package/build/types/internal/conversions/modernToLegacyGroupByClause.d.ts +1 -1
- package/build/types/internal/conversions/modernToLegacyWhereClause.d.ts +1 -1
- package/build/types/object/aggregate.d.ts +1 -1
- package/build/types/object/convertWireToOsdkObjects.d.ts +1 -1
- package/build/types/object/fetchPage.d.ts +1 -1
- package/build/types/object/fetchSingle.d.ts +1 -1
- package/build/types/objectSet/ObjectSetListenerWebsocket.d.ts +1 -1
- package/build/types/objectSet/createObjectSet.d.ts +1 -1
- package/build/types/objectSet/toConjureObjectSet.d.ts +1 -1
- package/build/types/util/WireObjectSet.d.ts +1 -1
- package/build/types/util/isOntologyObjectV2.d.ts +1 -1
- package/build/types/util/toDataValue.d.ts +1 -1
- package/package.json +10 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @osdk/client
|
|
2
2
|
|
|
3
|
+
## 0.17.0-main-20240430161814
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 63ff4b2: Only producing ESM now
|
|
8
|
+
|
|
3
9
|
## 0.16.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -12,7 +18,7 @@
|
|
|
12
18
|
- Fixes issues with where clauses for equality in subscriptions
|
|
13
19
|
- Fixes issues with inconsistent idname and apiName's in the mapping data
|
|
14
20
|
|
|
15
|
-
- 9906a41:
|
|
21
|
+
- 9906a41: Foundry Platform API support
|
|
16
22
|
- 9906a41: Compatible version checks now use versions that are both embedded in the code and updated automatically as part of the release process.
|
|
17
23
|
|
|
18
24
|
### Patch Changes
|
package/build/js/{ObjectSetListenerWebsocket-ODRFQQMY.cjs → ObjectSetListenerWebsocket-QQ45K3YV.cjs}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkX5T2JBPJ_cjs = require('./chunk-X5T2JBPJ.cjs');
|
|
4
4
|
var WebSocket = require('isomorphic-ws');
|
|
5
5
|
var invariant = require('tiny-invariant');
|
|
6
6
|
var conjureLite = require('conjure-lite');
|
|
@@ -308,7 +308,7 @@ var ObjectSetListenerWebsocket = class _ObjectSetListenerWebsocket {
|
|
|
308
308
|
this.#ensureWebsocket(),
|
|
309
309
|
// look up the object type's rid and ensure that we have enabled object set watcher for that rid
|
|
310
310
|
// TODO ???
|
|
311
|
-
getObjectSetBaseType(sub.objectSet).then((baseType) =>
|
|
311
|
+
getObjectSetBaseType(sub.objectSet).then((baseType) => chunkX5T2JBPJ_cjs.getObjectTypeV2(this.#client, this.#client.ontologyRid, baseType)).then((objectType) => this.#enableObjectSetsWatcher([objectType.rid]))
|
|
312
312
|
]);
|
|
313
313
|
if (subscriptionIsDone(sub)) {
|
|
314
314
|
return;
|
|
@@ -526,7 +526,7 @@ async function convertFoundryToOsdkObjects(client, ctx, objects) {
|
|
|
526
526
|
}), [propertyMapping?.propertyIdToApiNameMapping[Object.entries(object.key)[0][0]], Object.entries(object.key)[0][1]], ["__apiName", propertyMapping?.apiName], ["$apiName", propertyMapping?.apiName]]);
|
|
527
527
|
return convertedObject;
|
|
528
528
|
}));
|
|
529
|
-
return await
|
|
529
|
+
return await chunkX5T2JBPJ_cjs.convertWireToOsdkObjects(client, osdkObjects, void 0);
|
|
530
530
|
}
|
|
531
531
|
var objectTypeMapping = /* @__PURE__ */ new WeakMap();
|
|
532
532
|
var objectApiNameToRid = /* @__PURE__ */ new Map();
|
|
@@ -534,12 +534,12 @@ async function getOntologyPropertyMappingForApiName(client, ctx, objectApiName)
|
|
|
534
534
|
if (objectApiNameToRid.has(objectApiName)) {
|
|
535
535
|
return objectTypeMapping.get(ctx)?.get(objectApiNameToRid.get(objectApiName));
|
|
536
536
|
}
|
|
537
|
-
const wireObjectType = await
|
|
537
|
+
const wireObjectType = await chunkX5T2JBPJ_cjs.getObjectTypeV2(client, client.ontologyRid, objectApiName);
|
|
538
538
|
return getOntologyPropertyMappingForRid(ctx, client.ontologyRid, wireObjectType.rid);
|
|
539
539
|
}
|
|
540
540
|
var cachedAllOntologies;
|
|
541
541
|
async function getOntologyVersionForRid(ctx, ontologyRid) {
|
|
542
|
-
cachedAllOntologies ??= await
|
|
542
|
+
cachedAllOntologies ??= await chunkX5T2JBPJ_cjs.loadAllOntologies(ctx, {});
|
|
543
543
|
!cachedAllOntologies.ontologies[ontologyRid] ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "ontology should be loaded") : invariant__default.default(false) : void 0;
|
|
544
544
|
return cachedAllOntologies.ontologies[ontologyRid].currentOntologyVersion;
|
|
545
545
|
}
|
|
@@ -558,7 +558,7 @@ async function getOntologyPropertyMappingForRid(ctx, ontologyRid, objectRid) {
|
|
|
558
558
|
loadRedacted: false,
|
|
559
559
|
includeObjectTypesWithoutSearchableDatasources: true
|
|
560
560
|
};
|
|
561
|
-
const entities = await
|
|
561
|
+
const entities = await chunkX5T2JBPJ_cjs.loadOntologyEntities(ctx, body);
|
|
562
562
|
!entities.objectTypes[objectRid] ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "object type should be loaded") : invariant__default.default(false) : void 0;
|
|
563
563
|
const propertyIdToApiNameMapping = Object.fromEntries(Object.values(entities.objectTypes[objectRid].propertyTypes).map((property) => {
|
|
564
564
|
return [property.id, property.apiName];
|
|
@@ -579,4 +579,4 @@ async function getOntologyPropertyMappingForRid(ctx, ontologyRid, objectRid) {
|
|
|
579
579
|
|
|
580
580
|
exports.ObjectSetListenerWebsocket = ObjectSetListenerWebsocket;
|
|
581
581
|
//# sourceMappingURL=out.js.map
|
|
582
|
-
//# sourceMappingURL=ObjectSetListenerWebsocket-
|
|
582
|
+
//# sourceMappingURL=ObjectSetListenerWebsocket-QQ45K3YV.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/objectSet/ObjectSetListenerWebsocket.ts","../../src/generated/object-set-service/api/ObjectSetService/createObjectSet.ts","../../src/generated/object-set-service/api/ObjectSetService/createTemporaryObjectSet.ts","../../src/generated/object-set-service/api/ObjectSetService/deleteObjectSet.ts","../../src/generated/object-set-service/api/ObjectSetService/getBulkObjectSet.ts","../../src/generated/object-set-service/api/ObjectSetService/getObjectSet.ts","../../src/generated/object-set-service/api/ObjectSetService/getObjectsPage.ts","../../src/generated/object-set-service/api/ObjectSetService/getObjectTypes.ts","../../src/generated/object-set-service/api/ObjectSetService/getReferencedEntities.ts","../../src/generated/object-set-service/api/ObjectSetService/materializeObjectSet.ts","../../src/generated/object-set-watcher/ObjectSetWatchService/batchEnableWatcher.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/bulkLoadOntologyEntities.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/bulkLoadOntologyEntitiesByDatasources.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getActionTypesForObjectType.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getFeatureConfigurations.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getLinkMetadataForObjectTypes.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getLinkTypesForObjectTypes.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getObjectTypesForInterfaceTypes.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getObjectTypesForSharedPropertyTypes.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getObjectTypesForTypeGroups.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getOntologyRidsForEntities.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getOntologySummary.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getOrganizationRidsForOntology.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getRelationsForObjectTypes.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadAllCustomObjectTypeTraitsFromOntology.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadAllInterfaceTypesFromOntology.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadAllObjectTypesFromOntology.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadAllObjectTypesFromOntologyPage.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadAllOntology.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadAllOntologyEntities.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadAllSharedPropertyTypesFromOntology.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadAllTypeGroupsFromOntology.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadOntology.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadOntologyDatasources.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/modifyOntology.ts","../../src/objectSet/toConjureObjectSet.ts"],"names":["conjureFetch"],"mappings":";;;;;;;;AAiBA,OAAO,eAAe;AACtB,OAAO,eAAe;;;ACFtB,SAAS,oBAAoB;;;ACA7B,SAAS,gBAAAA,qBAAoB;AAgB7B,eAAsB,yBAAyB,KAAK,SAAS;AAC3D,SAAOA,cAAa,KAAK,yBAAyB,QAAQ,OAAO;AACnE;;;AClBA,SAAS,gBAAAA,qBAAoB;;;ACA7B,SAAS,gBAAAA,qBAAoB;;;ACA7B,SAAS,gBAAAA,qBAAoB;;;ACA7B,SAAS,gBAAAA,qBAAoB;;;ACA7B,SAAS,gBAAAA,qBAAoB;;;ACA7B,SAAS,gBAAAA,qBAAoB;;;ACA7B,SAAS,gBAAAA,qBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;AAI7B,eAAsB,mBAAmB,KAAK,SAAS;AACrD,SAAOA,eAAa,KAAK,0CAA0C,QAAQ,OAAO;AACpF;;;ACNA,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;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AE,aAAa,EAAE,IAAI,cAAY;AACjI,aAAO,CAAC,SAAS,IAAI,SAAS,OAAO;AAAA,IACvC,CAAC,CAAC;AACF,UAAM,6BAA6B,OAAO,YAAY,OAAO,OAAO,SAAS,YAAY,SAAS,EAAE,aAAa,EAAE,IAAI,cAAY;AACjI,aAAO,CAAC,SAAS,SAAS,SAAS,EAAE;AAAA,IACvC,CAAC,CAAC;AACF,sBAAkB,IAAI,GAAG,GAAG,IAAI,WAAW;AAAA,MACzC,SAAS,SAAS,YAAY,SAAS,EAAE;AAAA,MACzC,IAAI,SAAS,YAAY,SAAS,EAAE;AAAA,MACpC;AAAA,MACA;AAAA,IACF,CAAC;AACD,uBAAmB,IAAI,SAAS,YAAY,SAAS,EAAE,SAAS,SAAS;AAAA,EAC3E;AACA,SAAO,kBAAkB,IAAI,GAAG,GAAG,IAAI,SAAS;AAClD","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 { getObjectTypeV2 } from \"@osdk/omniapi/OntologiesV2_ObjectTypeV2\";\nimport WebSocket from \"isomorphic-ws\";\nimport invariant from \"tiny-invariant\";\nimport { createTemporaryObjectSet } from \"../generated/object-set-service/api/ObjectSetService.js\";\nimport { batchEnableWatcher } from \"../generated/object-set-watcher/ObjectSetWatchService.js\";\nimport { loadAllOntologies, loadOntologyEntities } from \"../generated/ontology-metadata/api/OntologyMetadataService.js\";\nimport { convertWireToOsdkObjects } from \"../object/convertWireToOsdkObjects.js\";\nimport { getObjectSetBaseType, toConjureObjectSet } from \"./toConjureObjectSet.js\";\nconst ONE_DAY_MS = 24 * 60 * 60 * 1000;\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 onChange = doNothing,\n onError = doNothing,\n onOutOfDate = doNothing\n}) {\n return {\n onChange,\n onError,\n onOutOfDate\n };\n}\nfunction isReady(sub) {\n return sub.temporaryObjectSetId != null;\n}\nfunction subscriptionIsDone(sub) {\n return sub.status === \"done\" || sub.status === \"error\";\n}\nexport class ObjectSetListenerWebsocket {\n static #instances = new WeakMap();\n\n // FIXME\n static getInstance(client) {\n let instance = ObjectSetListenerWebsocket.#instances.get(client);\n if (instance == null) {\n instance = new ObjectSetListenerWebsocket(client);\n ObjectSetListenerWebsocket.#instances.set(client, instance);\n }\n return instance;\n }\n #ws;\n #lastWsConnect = 0;\n #client;\n #logger;\n\n /**\n * map of requestId to all active subscriptions at the time of the request\n */\n #pendingSubscriptions = new Map();\n\n /**\n * Map of subscriptionId to Subscription. Note: the subscriptionId may be\n * temporary and not the actual subscriptionId from the server.\n */\n #subscriptions = new Map();\n #oswContext;\n #metadataContext;\n #ossContext;\n #maybeDisconnectTimeout;\n constructor(client) {\n this.#client = client;\n this.#logger = client.logger?.child({}, {\n msgPrefix: \"<OSW> \"\n });\n !(client.stack.startsWith(\"https://\") || client.stack.startsWith(\"http://\")) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Stack must be a URL\") : invariant(false) : void 0;\n this.#oswContext = {\n baseUrl: client.stack,\n servicePath: \"/object-set-watcher/api\",\n fetchFn: client.fetch,\n tokenProvider: async () => await client.tokenProvider()\n };\n this.#ossContext = {\n ...this.#oswContext,\n servicePath: \"/object-set-service/api\"\n };\n this.#metadataContext = {\n ...this.#oswContext,\n servicePath: \"/ontology-metadata/api\"\n };\n }\n async subscribe(objectSet, listener) {\n // Node 18 does not expose 'crypto' on globalThis, so we need to do it ourselves. This\n // will not be needed after our minimum version is 19 or greater.\n globalThis.crypto ??= (await import(\"node:crypto\")).webcrypto;\n const sub = {\n listener: fillOutListener(listener),\n objectSet,\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-${crypto.randomUUID()}`\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 this.#initiateSubscribe(sub);\n return () => {\n this.#unsubscribe(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) {\n if (sub.expiry) {\n clearTimeout(sub.expiry);\n }\n // expiry is tied to the temporary object set, which is set to `timeToLive: \"ONE_DAY\"`\n // in `#createTemporaryObjectSet`. They should be in sync\n sub.expiry = setTimeout(() => this.#expire(sub), ONE_DAY_MS);\n try {\n const [temporaryObjectSet] = await Promise.all([\n // create a time-bounded object set representation for watching\n this.#createTemporaryObjectSet(sub.objectSet), this.#ensureWebsocket(),\n // look up the object type's rid and ensure that we have enabled object set watcher for that rid\n // TODO ???\n getObjectSetBaseType(sub.objectSet).then(baseType => getObjectTypeV2(this.#client, this.#client.ontologyRid, baseType)).then(objectType => this.#enableObjectSetsWatcher([objectType.rid]))]);\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 (subscriptionIsDone(sub)) {\n return;\n }\n\n // Use new temporary object set id\n sub.temporaryObjectSetId = temporaryObjectSet.objectSetRid;\n this.#sendSubscribeMessage();\n } catch (error) {\n sub.listener.onError(error);\n }\n }\n #sendSubscribeMessage() {\n // If two calls to `.subscribe()` happen at once (or if the connection is reset),\n // we may have multiple subscriptions that don't have a subscriptionId yet,\n // so we filter those out.\n const readySubs = [...this.#subscriptions.values()].filter(isReady);\n if (readySubs.length === 0) return;\n\n // Assumes the node 18 crypto fallback to globalThis in `subscribe` has happened.\n const id = crypto.randomUUID();\n // responses come back as an array of subIds, so we need to know the sources\n this.#pendingSubscriptions.set(id, readySubs);\n\n // every subscribe message \"overwrites\" the previous ones that are not\n // re-included, so we have to reconstitute the entire list of subscriptions\n const subscribe = {\n id,\n requests: readySubs.map(({\n temporaryObjectSetId\n }) => ({\n objectSet: temporaryObjectSetId,\n objectSetContext: {\n objectSetFilterContext: {\n parameterOverrides: {}\n }\n },\n watchAllLinks: false\n }))\n };\n if (process.env.NODE_ENV !== \"production\") {\n this.#logger?.debug({\n payload: subscribe\n }, \"sending subscribe message\");\n }\n this.#ws?.send(JSON.stringify(subscribe));\n }\n #expire(sub) {\n // the temporary ObjectSet has expired, we should re-subscribe which will cause the\n // listener to get an onOutOfDate message when it becomes subscribed again\n sub.status = \"expired\";\n this.#initiateSubscribe(sub);\n }\n #unsubscribe(sub, newStatus = \"done\") {\n if (subscriptionIsDone(sub)) {\n // if we are already done, we don't need to do anything\n return;\n }\n sub.status = newStatus;\n // make sure listeners do nothing now\n sub.listener = fillOutListener({});\n if (sub.expiry) {\n clearTimeout(sub.expiry);\n sub.expiry = undefined;\n }\n this.#subscriptions.delete(sub.subscriptionId);\n\n // If we have no more subscriptions, we can disconnect the websocket\n // however we should wait a bit to see if we get any more subscriptions.\n // For example, when switching between react views, you may unsubscribe\n // in the old view and subscribe in the new view. We don't need to re-establish\n // the websocket connection in that case.\n if (this.#maybeDisconnectTimeout) {\n // We reset the timeout on every unsubscribe so its always at least 15s from\n // the last time we are empty. E.g.:\n // - 0s: Sub(A)\n // - 10s: Unsub(A)\n // - 11s: Sub(B)\n // - 20s: Unsub(B)\n // If we do not clear out the timeout we would disconnect at 25s but that would only be\n // 5s after the last subscription was removed instead of at 35s for the desired 15s.\n clearTimeout(this.#maybeDisconnectTimeout);\n }\n this.#maybeDisconnectTimeout = setTimeout(() => {\n this.#maybeDisconnectTimeout = undefined;\n if (this.#subscriptions.size === 0) {\n this.#cycleWebsocket();\n }\n }, 15_000 /* ms */);\n }\n async #ensureWebsocket() {\n if (this.#ws == null) {\n const {\n stack,\n tokenProvider\n } = this.#client;\n const base = new URL(stack);\n // TODO: This should be a different endpoint\n const url = `wss://${base.host}/object-set-watcher/ws/subscriptions`;\n const token = await tokenProvider();\n\n // tokenProvider is async, there could potentially be a race to create the websocket.\n // Only the first call to reach here will find a null this.#ws, the rest will bail out\n if (this.#ws == null) {\n // TODO this can probably be exponential backoff with jitter\n // don't reconnect more quickly than MINIMUM_RECONNECT_DELAY\n const nextConnectTime = (this.#lastWsConnect ?? 0) + MINIMUM_RECONNECT_DELAY_MS;\n if (nextConnectTime > Date.now()) {\n await new Promise(resolve => {\n setTimeout(resolve, nextConnectTime - Date.now());\n });\n }\n this.#lastWsConnect = Date.now();\n\n // we again may have lost the race after our minimum backoff time\n if (this.#ws == null) {\n this.#ws = new WebSocket(url, [`Bearer-${token}`]);\n this.#ws.addEventListener(\"close\", this.#onClose);\n this.#ws.addEventListener(\"message\", this.#onMessage);\n this.#ws.addEventListener(\"open\", this.#onOpen);\n }\n }\n\n // Allow await-ing the websocket open event if it isn't open already.\n // This needs to happen even for callers that didn't just create this.#ws\n if (this.#ws.readyState === WebSocket.CONNECTING) {\n const ws = this.#ws;\n return new Promise((resolve, reject) => {\n ws.addEventListener(\"open\", () => {\n resolve();\n });\n ws.addEventListener(\"error\", event => {\n reject(new Error(event.toString()));\n });\n });\n }\n }\n }\n #onOpen = () => {\n // resubscribe all of the listeners\n this.#sendSubscribeMessage();\n };\n #onMessage = async message => {\n const data = JSON.parse(message.data.toString());\n if (process.env.NODE_ENV !== \"production\") {\n this.#logger?.debug({\n payload: data\n }, \"recieved message from ws\");\n }\n switch (data.type) {\n case \"objectSetChanged\":\n return this.#handleMessage_objectSetChanged(data.objectSetChanged);\n case \"refreshObjectSet\":\n return this.#handleMessage_refreshObjectSet(data.refreshObjectSet);\n case \"subscribeResponses\":\n return this.#handleMessage_subscribeResponses(data.subscribeResponses);\n default:\n const _ = data;\n !false ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Unexpected message type\") : invariant(false) : void 0;\n }\n };\n #handleMessage_objectSetChanged = async payload => {\n const sub = this.#subscriptions.get(payload.id);\n !sub ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Expected subscription id ${payload.id}`) : invariant(false) : void 0;\n if (\"confidenceValue\" in payload) {\n sub.listener.onOutOfDate();\n return;\n }\n sub.listener.onChange(await convertFoundryToOsdkObjects(this.#client, this.#metadataContext, payload.objects));\n };\n #handleMessage_refreshObjectSet = payload => {\n const sub = this.#subscriptions.get(payload.id);\n !sub ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Expected subscription id ${payload.id}`) : invariant(false) : void 0;\n sub.listener.onOutOfDate();\n };\n #handleMessage_subscribeResponses = payload => {\n const {\n id,\n responses\n } = payload;\n const subs = this.#pendingSubscriptions.get(id);\n !subs ? process.env.NODE_ENV !== \"production\" ? invariant(false, `should have a pending subscription for ${id}`) : invariant(false) : void 0;\n this.#pendingSubscriptions.delete(id);\n for (let i = 0; i < responses.length; i++) {\n const sub = subs[i];\n const response = responses[i];\n switch (response.type) {\n case \"error\":\n sub.listener.onError(response.error);\n this.#unsubscribe(sub, \"error\");\n break;\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 case \"success\":\n sub.status = \"subscribed\";\n if (sub.subscriptionId !== response.success.id) {\n // might be the temporary one\n this.#subscriptions.delete(sub.subscriptionId);\n sub.subscriptionId = response.success.id;\n this.#subscriptions.set(sub.subscriptionId, sub); // future messages come by this subId\n }\n sub.listener.onOutOfDate();\n break;\n default:\n const _ = response;\n sub.listener.onError(response);\n }\n }\n };\n #onClose = () => {\n // TODO we should probably throttle this so we don't abuse the backend\n this.#cycleWebsocket();\n };\n async #enableObjectSetsWatcher(objectTypeRids) {\n return batchEnableWatcher(this.#oswContext, {\n requests: objectTypeRids\n });\n }\n async #createTemporaryObjectSet(objectSet) {\n const objectSetBaseType = await getObjectSetBaseType(objectSet);\n const mapping = await getOntologyPropertyMappingForApiName(this.#client, this.#metadataContext, objectSetBaseType);\n const temporaryObjectSet = await createTemporaryObjectSet(this.#ossContext, {\n objectSet: toConjureObjectSet(objectSet, mapping),\n timeToLive: \"ONE_DAY\",\n // MUST keep in sync with the value for expiry in `#initiateSubscribe`.\n objectSetFilterContext: {\n parameterOverrides: {}\n }\n });\n return {\n objectSetRid: temporaryObjectSet.objectSetRid\n };\n }\n #cycleWebsocket = () => {\n if (this.#ws) {\n this.#ws.removeEventListener(\"open\", this.#onOpen);\n this.#ws.removeEventListener(\"message\", this.#onMessage);\n this.#ws.removeEventListener(\"close\", this.#onClose);\n if (this.#ws.readyState !== WebSocket.CLOSING && this.#ws.readyState !== WebSocket.CLOSED) {\n this.#ws.close();\n }\n this.#ws = undefined;\n }\n\n // if we have any listeners that are still depending on us, go ahead and reopen the websocket\n if (this.#subscriptions.size > 0) {\n this.#ensureWebsocket();\n }\n };\n}\nasync function convertFoundryToOsdkObjects(client, ctx, objects) {\n const osdkObjects = await Promise.all(objects.map(async object => {\n const propertyMapping = await getOntologyPropertyMappingForRid(ctx, client.ontologyRid, object.type);\n const convertedObject = Object.fromEntries([...Object.entries(object.properties).map(([key, value]) => {\n return [propertyMapping?.propertyIdToApiNameMapping[key], value];\n }), [propertyMapping?.propertyIdToApiNameMapping[Object.entries(object.key)[0][0]], Object.entries(object.key)[0][1]], [\"__apiName\", propertyMapping?.apiName], [\"$apiName\", propertyMapping?.apiName]]);\n return convertedObject;\n }));\n\n // doesnt care about interfaces\n return await convertWireToOsdkObjects(client, osdkObjects, undefined);\n}\n// Mapping of ObjectRid to Properties\nconst objectTypeMapping = new WeakMap();\nconst objectApiNameToRid = new Map();\nasync function getOntologyPropertyMappingForApiName(client, ctx, objectApiName) {\n if (objectApiNameToRid.has(objectApiName)) {\n return objectTypeMapping.get(ctx)?.get(objectApiNameToRid.get(objectApiName));\n }\n const wireObjectType = await getObjectTypeV2(client, client.ontologyRid, objectApiName);\n return getOntologyPropertyMappingForRid(ctx, client.ontologyRid, wireObjectType.rid);\n}\nlet cachedAllOntologies;\nasync function getOntologyVersionForRid(ctx, ontologyRid) {\n cachedAllOntologies ??= await loadAllOntologies(ctx, {});\n !cachedAllOntologies.ontologies[ontologyRid] ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"ontology should be loaded\") : invariant(false) : void 0;\n return cachedAllOntologies.ontologies[ontologyRid].currentOntologyVersion;\n}\nasync function getOntologyPropertyMappingForRid(ctx, ontologyRid, objectRid) {\n if (!objectTypeMapping.has(ctx)) {\n objectTypeMapping.set(ctx, new Map());\n }\n if (!objectTypeMapping.get(ctx).has(objectRid)) {\n const ontologyVersion = await getOntologyVersionForRid(ctx, ontologyRid);\n const body = {\n objectTypeVersions: {\n // TODO: Undefined drops this in the body\n [objectRid]: ontologyVersion\n },\n linkTypeVersions: {},\n loadRedacted: false,\n includeObjectTypesWithoutSearchableDatasources: true\n };\n const entities = await loadOntologyEntities(ctx, body);\n !entities.objectTypes[objectRid] ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"object type should be loaded\") : invariant(false) : void 0;\n const propertyIdToApiNameMapping = Object.fromEntries(Object.values(entities.objectTypes[objectRid].propertyTypes).map(property => {\n return [property.id, property.apiName];\n }));\n const propertyApiNameToIdMapping = Object.fromEntries(Object.values(entities.objectTypes[objectRid].propertyTypes).map(property => {\n return [property.apiName, property.id];\n }));\n objectTypeMapping.get(ctx)?.set(objectRid, {\n apiName: entities.objectTypes[objectRid].apiName,\n id: entities.objectTypes[objectRid].id,\n propertyIdToApiNameMapping,\n propertyApiNameToIdMapping\n });\n objectApiNameToRid.set(entities.objectTypes[objectRid].apiName, objectRid);\n }\n return objectTypeMapping.get(ctx)?.get(objectRid);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Creates an orphaned object set - i.e. not part of any versioned object set. This may be for temporary or internal application use. No gatekeeper resource is created - instead the given security rid is assumed to already exist and will be used to permission the created object set.\n */\nexport async function createObjectSet(ctx, request) {\n return conjureFetch(ctx, `/objectSets`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Creates a temporary object set that will live for at least as long as the provided TTL, and will get deleted\n * at some point after that.\n *\n * Temporary object sets can only be accessed by users who have created them; a gatekeeper resource is registered\n * for every temporary object set. NOTE: The same gatekeeper resource may be reused for the same userId across\n * different createTemporaryObjectSet requests.\n *\n * Whenever an object set (temporary, or otherwise) referencing a temporary object set gets saved or used in\n * versioned object sets, the reference gets replaced with a full definition of the previously saved temporary\n * object. This is to ensure that they do not inherit the TTL of temporary object sets they reference.\n *\n * Please consider using temporary object sets whenever there is a need to save an object set just to be able to\n * pass it to another service without a need to persist it indefinitely.\n */\nexport async function createTemporaryObjectSet(ctx, request) {\n return conjureFetch(ctx, `/objectSets/temporary`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Deletes this object set, causing future operations which access it to fail.\n */\nexport async function deleteObjectSet(ctx, objectSetRid) {\n return conjureFetch(ctx, `/objectSets/${objectSetRid}`, \"DELETE\");\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Returns the definitions of requested object sets.\n */\nexport async function getBulkObjectSet(ctx, request) {\n return conjureFetch(ctx, `/bulk/objectSets`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Returns the definition of this object set.\n */\nexport async function getObjectSet(ctx, objectSetRid) {\n return conjureFetch(ctx, `/objectSets/${objectSetRid}`, \"GET\");\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Fetches object rids on requested page of evaluated object set. If more objects are available, the returned pageToken can be used to fetch the subsequent page. Note that page tokens are *not* long-lived and *may* get invalidated (for example following updates to the underlying index or indices, or after a few minutes).\n * Note that the service currently does not provide guarantees around the consistency of returned results. In particular, any state changes to the underlying indices can cause duplicate results to be returned or some results to be skipped between subsequent page requests.\n */\nexport async function getObjectsPage(ctx, request, backend) {\n return conjureFetch(ctx, `/objectSets/objects`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Returns types of objects that can be present in the supplied object set based on its definition at the time\n * of the request.\n *\n * Note that this endpoint does not perform a full evaluation of the supplied object set - the guarantees provided\n * are that only the returned object types can be present in the supplied object set at the time of the request.\n * It is not however guaranteed that there in fact is at least one object of each returned object type - consider\n * using aggregations instead if false-positives are not desired.\n *\n * Note that object types belonging to an object set can change over time - this information should be treated as\n * dynamic and should not be persisted or treated as immutable.\n */\nexport async function getObjectTypes(ctx, request) {\n return conjureFetch(ctx, `/objectSets/objectTypes`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Returns the entities used within an object set. i.e. object type rids and link type rids\n *\n * Note that relations belonging to an object set can change over time - this information should be treated as\n * dynamic and should not be persisted or treated as immutable.\n */\nexport async function getReferencedEntities(ctx, request) {\n return conjureFetch(ctx, `/objectSets/entities`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Materialize an object set.\n */\nexport async function materializeObjectSet(ctx, request) {\n return conjureFetch(ctx, `/objectSets/materialize`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Allows user to enable watching object types. Requires permission to view the requested object types.\n */\nexport async function batchEnableWatcher(ctx, request) {\n return conjureFetch(ctx, `/object-set-watcher/batchEnableWatcher`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load Ontology entities in bulk. The returned OntologyBulkLoadEntitiesResponse will only\n * contain entities that actually exist and are visible to the user. If the user has requested entities at\n * invalid versions or entities that do not exist in the specified versions, those will not be present\n * in the response.\n *\n * There are limits on the number of entities that can be loaded in one request. Please refer to\n * documentation of OntologyBulkLoadEntitiesRequest for the values of these limits.\n */\nexport async function bulkLoadOntologyEntities(ctx, onBehalfOf, request) {\n return conjureFetch(ctx, `/ontology/ontology/bulkLoadEntities`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load Ontology entities by their backing datasources in bulk.\n * The returned OntologyBulkLoadEntitiesByDatasourcesResponse will only\n * contain entities that actually exist and are visible to the user.\n * If the user has requested entities that do not exist in any of the latest Ontology versions,\n * those will not be present in the response.\n *\n * There are limits on the number of entities that can be loaded in one request. Please refer to\n * documentation of OntologyBulkLoadEntitiesByDatasourcesRequest for the values of these limits.\n */\nexport async function bulkLoadOntologyEntitiesByDatasources(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/bulkLoadEntitiesByDatasources`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Gets all the action types that the object types are associated with. E.g. actions that create an object, edit\n * an object, or use the object as a parameter.\n */\nexport async function getActionTypesForObjectType(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/actionTypesForObjectType`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Please contact the OMS team before using this endpoint.\n *\n * Gets the current configuration of some OMS features. Note that these configurations are stack-wide, which\n * means they do not have granularity on org/enrollment/group level.\n */\nexport async function getFeatureConfigurations(ctx) {\n return conjureFetch(ctx, `/ontology/featureConfigurations`, \"GET\");\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to batch load links associated to given ObjectTypeRid(s). The GetLinkTypesForObjectTypesResponse\n * will only contain links that are visible to the user. If the user has requested to get links at for\n * ObjectTypeRid(s) that do not exist in the specified versions, those entries will include an empty set\n * of link types.\n */\nexport async function getLinkMetadataForObjectTypes(ctx, request) {\n return conjureFetch(ctx, `/ontology/getLinkMetadataForObjectTypes`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to batch load links associated to given ObjectTypeRid(s). The GetLinkTypesForObjectTypesResponse\n * will only contain links that are visible to the user. If the user has requested to get link types at\n * invalid ontology versions or for ObjectTypeRid(s) that do not exist in the specified versions, those entries\n * will include an empty set of link types.\n *\n * The includeObjectTypesWithoutSearchableDatasources flag is respected if present in the request,\n * else we set it to a default (false) unless the user-agent is blocklisted.\n * The flag is set to true for blocklisted user agents. Currently the blocklist\n * includes functions-typescript-gradle-plugin only.\n */\nexport async function getLinkTypesForObjectTypes(ctx, request) {\n return conjureFetch(ctx, `/ontology/linkTypesForObjectTypes`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Gets a map of interfaces to the set of object types that implement the interface. At most 50 interfaces can be\n * requested.\n */\nexport async function getObjectTypesForInterfaceTypes(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/objectTypesForInterfaceTypes`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Gets a map of SharedPropertyTypeRid to the set of ObjectTypeRids that use the SharedPropertyType. At most 50\n * SharedPropertyTypeRids can be requested.\n */\nexport async function getObjectTypesForSharedPropertyTypes(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/objectTypesForSharedPropertyTypes`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Gets a map of TypeGroupRids to the set of ObjectTypeRids that use the TypeGroup. At most 50 TypeGroupRids\n * can be requested.\n */\nexport async function getObjectTypesForTypeGroups(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/objectTypesForTypeGroups`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Gets the ontology rids to which the given ontology entities belong.\n * The returned OntologyRidsForOntologyEntitiesResponse will only\n * contain ontology rids for entities that actually exist and which belong to an Ontology that the user\n * has access to. If the user has requested entities that do not exist in any of the latest Ontology versions,\n * or which belong to an Ontology which the user does not have access to, those will not be present in the\n * response.\n */\nexport async function getOntologyRidsForEntities(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/getOntologyRidsForEntities`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load a summary of an Ontology including the number of entities of each type visible to the user.\n *\n * An entity is considered visible if the user has `view` or `discover` permissions. ObjectTypes and LinkTypes\n * migrated to roles are also considered visible regardless of the users permissions on the backing datasources\n * (i.e. the endpoint runs using `includeObjectTypesWithoutSearchableDatasources` set to true).\n *\n * The results in this endpoint are eventually consistent with the latest OntologyVersion and may lag slightly\n * behind the last Ontology modification.\n */\nexport async function getOntologySummary(ctx, ontologyRid, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/${ontologyRid}/summary`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Gets the organization rids to which the ontology entities in the given ontology rid belong. If the user has\n * requested an ontology they do not have access to, no organization rids will be present in the response.\n */\nexport async function getOrganizationRidsForOntology(ctx, ontologyRid) {\n return conjureFetch(ctx, `/ontology/ontology/${ontologyRid}/organizationRids`, \"GET\");\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to batch load relations associated to given objectTypeIds. The GetRelationsForObjectTypesResponse\n * will only contain relations that are visible to the user. If the user has requested to get relations at\n * invalid ontology versions or for objectTypeIds that do not exist in the specified versions, those entries\n * will include an empty set of relations.\n */\nexport async function getRelationsForObjectTypes(ctx, request) {\n return conjureFetch(ctx, `/ontology/relationsForObjectTypes`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to get all the CustomObjectTypeTraits a user has access to.\n */\nexport async function loadAllCustomObjectTypeTraitsFromOntology(ctx, ontologyRid, ontologyVersion, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/${ontologyRid}/${ontologyVersion}/loadAllCustomObjectTypeTraitsFromOntology`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load a paged collection of all interfaces visible to the user from the specified ontology and\n * ontology version. The maximum number of interfaces returned in a page is capped at 100.\n */\nexport async function loadAllInterfaceTypesFromOntology(ctx, ontologyRid, ontologyVersion, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/${ontologyRid}/${ontologyVersion}/loadAllInterfaceTypes`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load a paged collection of all ObjectTypes visible to the user from the specified Ontology and\n * OntologyVersion. The maximum number of ObjectTypes returned in a page is capped at 500.\n */\nexport async function loadAllObjectTypesFromOntology(ctx, ontologyRid, ontologyVersion, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/${ontologyRid}/${ontologyVersion}/loadAllObjectTypes`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load a paged collection of all ObjectTypes visible to the user from the specified Ontology and\n * OntologyVersion. The maximum number of ObjectTypes returned in a page is capped at 500.\n */\nexport async function loadAllObjectTypesFromOntologyPage(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/loadAllObjectTypes`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load the whole Ontology at a given OntologyVersion or at the latest OntologyVersion.\n * The returned OntologyLoadResponse will only contain entities that are visible to the user.\n * If the user has requested to load the Ontology at an invalid OntologyVersion,\n * an empty response will be returned.\n *\n * In the presence of multiple ontologies, this endpoint will implicitly choose which ontology the user\n * expects to load given the organization membership of the user. If the user is not a member of any organization,\n * the default Ontology will be chosen.\n */\nexport async function loadAllOntology(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/all`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load entity rids from the whole Ontology at a given OntologyVersion or at the latest\n * OntologyVersion. The returned OntologyLoadResponse will only contain entity rids that are visible\n * to the user. If the user has requested to load the Ontology at an invalid OntologyVersion,\n * an empty response will be returned.\n *\n * In the presence of multiple ontologies, this endpoint will implicitly choose which ontology the user\n * expects to load given the organization membership of the user. If the user is not a member of any organization,\n * the default Ontology will be chosen.\n *\n * The includeObjectTypesWithoutSearchableDatasources flag is respected if present in the request,\n * else we set it to a default (false) unless the user-agent is blocklisted.\n * The flag is set to true for blocklisted user agents. Currently the blocklist\n * includes functions-typescript-gradle-plugin only.\n */\nexport async function loadAllOntologyEntities(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/allEntities`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load a paged collection of all SharedPropertyTypes visible to the user from the specified Ontology and\n * OntologyVersion. The maximum number of SharedPropertyTypes returned in a page is capped at 100.\n */\nexport async function loadAllSharedPropertyTypesFromOntology(ctx, ontologyRid, ontologyVersion, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/${ontologyRid}/${ontologyVersion}/loadAllSharedPropertyTypes`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load a paged collection of all type groups visible to the user from the specified ontology and\n * ontology version. The maximum number of type groups returned in a page is capped at 100.\n */\nexport async function loadAllTypeGroupsFromOntology(ctx, ontologyRid, ontologyVersion, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/${ontologyRid}/${ontologyVersion}/loadAllTypeGroups`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to batch load Ontology entities. The returned OntologyLoadResponse will only contain\n * entities that actually exist and are visible to the user. If the user has requested entities at\n * invalid ontology versions or entities that do not exist in the specified versions,\n * those will not be present in the response. If the user tries to load entities across multiple ontologies, the\n * call will fail with an exception.\n */\nexport async function loadOntology(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/load`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load datasources for Ontology entities at a given OntologyVersion or at the latest\n * OntologyVersion. The returned OntologyDatasourcesLoadResponse will only contain datasources that are\n * visible to the user. If the user has requested to get datasources at invalid ontology versions\n * or for objectTypeIds that do not exist in the specified versions, those entries will include an\n * empty set of datasources.\n */\nexport async function loadOntologyDatasources(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/datasources`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to modify Ontology entities.\n */\nexport async function modifyOntology(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/modify`, \"POST\", request);\n}","/*\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 function toConjureObjectSet(objectSet, objectPropertyMapping) {\n switch (objectSet.type) {\n case \"base\":\n return {\n type: \"base\",\n base: {\n objectTypeId: objectPropertyMapping.id\n }\n };\n case \"static\":\n return {\n type: \"static\",\n static: {\n objectRids: objectSet.objects,\n provenance: undefined\n }\n };\n case \"reference\":\n return {\n type: \"referenced\",\n referenced: {\n objectSetRid: objectSet.reference\n }\n };\n case \"filter\":\n return {\n type: \"filtered\",\n filtered: {\n objectSet: toConjureObjectSet(objectSet.objectSet, objectPropertyMapping),\n runtimeDerivedProperties: undefined,\n filter: mapWhereClauseToObjectSetFilter(objectSet.where, objectPropertyMapping)\n }\n };\n case \"union\":\n return {\n type: \"unioned\",\n unioned: {\n objectSets: objectSet.objectSets.map(os => toConjureObjectSet(os, objectPropertyMapping))\n }\n };\n case \"intersect\":\n return {\n type: \"intersected\",\n intersected: {\n objectSets: objectSet.objectSets.map(os => toConjureObjectSet(os, objectPropertyMapping))\n }\n };\n case \"subtract\":\n return {\n type: \"subtracted\",\n subtracted: {\n objectSets: objectSet.objectSets.map(os => toConjureObjectSet(os, objectPropertyMapping))\n }\n };\n case \"searchAround\":\n throw new Error(\"not implemented\");\n }\n}\nexport async function getObjectSetBaseType(objectSet) {\n switch (objectSet.type) {\n case \"base\":\n return objectSet.objectType;\n case \"static\":\n // TODO: Get the object type from a wire call\n // This is not supported at the moment by the API anyway\n throw new Error(\"not implemented\");\n case \"reference\":\n // TODO: Get the object type from a wire call\n throw new Error(\"not implemented\");\n case \"filter\":\n return getObjectSetBaseType(objectSet.objectSet);\n case \"union\":\n // Technically you can have multiple ObjectTypes but at the moment we only support one\n return getObjectSetBaseType(objectSet.objectSets[0]);\n case \"intersect\":\n return getObjectSetBaseType(objectSet.objectSets[0]);\n case \"subtract\":\n return getObjectSetBaseType(objectSet.objectSets[0]);\n case \"searchAround\":\n // TODO: Get a mapping using the link\n throw new Error(\"not implemented\");\n }\n}\nfunction mapWhereClauseToObjectSetFilter(objectSetFilter, propertyMapping) {\n switch (objectSetFilter.type) {\n case \"lt\":\n return {\n type: \"range\",\n range: {\n propertyId: propertyMapping.propertyApiNameToIdMapping[objectSetFilter.field],\n lt: objectSetFilter.value,\n lte: undefined,\n gt: undefined,\n gte: undefined\n }\n };\n case \"gt\":\n return {\n type: \"range\",\n range: {\n propertyId: propertyMapping.propertyApiNameToIdMapping[objectSetFilter.field],\n gt: objectSetFilter.value,\n lte: undefined,\n lt: undefined,\n gte: undefined\n }\n };\n case \"lte\":\n return {\n type: \"range\",\n range: {\n propertyId: propertyMapping.propertyApiNameToIdMapping[objectSetFilter.field],\n lte: objectSetFilter.value,\n lt: undefined,\n gt: undefined,\n gte: undefined\n }\n };\n case \"gte\":\n return {\n type: \"range\",\n range: {\n propertyId: propertyMapping.propertyApiNameToIdMapping[objectSetFilter.field],\n gte: objectSetFilter.value,\n lt: undefined,\n lte: undefined,\n gt: undefined\n }\n };\n case \"eq\":\n return {\n type: \"exactMatch\",\n exactMatch: {\n propertyId: propertyMapping.propertyApiNameToIdMapping[objectSetFilter.field],\n terms: [objectSetFilter.value]\n }\n };\n case \"and\":\n return {\n type: \"and\",\n and: {\n filters: objectSetFilter.value.map(filter => mapWhereClauseToObjectSetFilter(filter, propertyMapping))\n }\n };\n case \"or\":\n return {\n type: \"or\",\n or: {\n filters: objectSetFilter.value.map(filter => mapWhereClauseToObjectSetFilter(filter, propertyMapping))\n }\n };\n case \"isNull\":\n return {\n type: \"not\",\n not: {\n filter: {\n type: \"hasProperty\",\n hasProperty: {\n propertyId: propertyMapping.propertyApiNameToIdMapping[objectSetFilter.field]\n }\n }\n }\n };\n case \"not\":\n return {\n type: \"not\",\n not: {\n filter: mapWhereClauseToObjectSetFilter(objectSetFilter.value, propertyMapping)\n }\n };\n case \"contains\":\n case \"startsWith\":\n case \"containsAllTermsInOrder\":\n case \"containsAnyTerm\":\n case \"containsAllTerms\":\n case \"withinDistanceOf\":\n case \"withinBoundingBox\":\n case \"intersectsBoundingBox\":\n case \"doesNotIntersectBoundingBox\":\n case \"withinPolygon\":\n case \"intersectsPolygon\":\n case \"doesNotIntersectPolygon\":\n case \"containsAllTermsInOrderPrefixLastTerm\":\n throw new Error(\"not implemented\");\n }\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/objectSet/ObjectSetListenerWebsocket.ts","../../src/generated/object-set-service/api/ObjectSetService/createObjectSet.ts","../../src/generated/object-set-service/api/ObjectSetService/createTemporaryObjectSet.ts","../../src/generated/object-set-service/api/ObjectSetService/deleteObjectSet.ts","../../src/generated/object-set-service/api/ObjectSetService/getBulkObjectSet.ts","../../src/generated/object-set-service/api/ObjectSetService/getObjectSet.ts","../../src/generated/object-set-service/api/ObjectSetService/getObjectsPage.ts","../../src/generated/object-set-service/api/ObjectSetService/getObjectTypes.ts","../../src/generated/object-set-service/api/ObjectSetService/getReferencedEntities.ts","../../src/generated/object-set-service/api/ObjectSetService/materializeObjectSet.ts","../../src/generated/object-set-watcher/ObjectSetWatchService/batchEnableWatcher.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/bulkLoadOntologyEntities.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/bulkLoadOntologyEntitiesByDatasources.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getActionTypesForObjectType.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getFeatureConfigurations.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getLinkMetadataForObjectTypes.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getLinkTypesForObjectTypes.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getObjectTypesForInterfaceTypes.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getObjectTypesForSharedPropertyTypes.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getObjectTypesForTypeGroups.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getOntologyRidsForEntities.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getOntologySummary.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getOrganizationRidsForOntology.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/getRelationsForObjectTypes.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadAllCustomObjectTypeTraitsFromOntology.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadAllInterfaceTypesFromOntology.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadAllObjectTypesFromOntology.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadAllObjectTypesFromOntologyPage.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadAllOntology.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadAllOntologyEntities.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadAllSharedPropertyTypesFromOntology.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadAllTypeGroupsFromOntology.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadOntology.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadOntologyDatasources.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/modifyOntology.ts","../../src/objectSet/toConjureObjectSet.ts"],"names":["conjureFetch"],"mappings":";;;;;;;;AAiBA,OAAO,eAAe;AACtB,OAAO,eAAe;;;ACFtB,SAAS,oBAAoB;;;ACA7B,SAAS,gBAAAA,qBAAoB;AAgB7B,eAAsB,yBAAyB,KAAK,SAAS;AAC3D,SAAOA,cAAa,KAAK,yBAAyB,QAAQ,OAAO;AACnE;;;AClBA,SAAS,gBAAAA,qBAAoB;;;ACA7B,SAAS,gBAAAA,qBAAoB;;;ACA7B,SAAS,gBAAAA,qBAAoB;;;ACA7B,SAAS,gBAAAA,qBAAoB;;;ACA7B,SAAS,gBAAAA,qBAAoB;;;ACA7B,SAAS,gBAAAA,qBAAoB;;;ACA7B,SAAS,gBAAAA,qBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;AAI7B,eAAsB,mBAAmB,KAAK,SAAS;AACrD,SAAOA,eAAa,KAAK,0CAA0C,QAAQ,OAAO;AACpF;;;ACNA,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7B,SAAS,gBAAAA,sBAAoB;;;ACA7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OAAO,SAAS,YAAY,SAAS,EAAE,aAAa,EAAE,IAAI,cAAY;AACjI,aAAO,CAAC,SAAS,IAAI,SAAS,OAAO;AAAA,IACvC,CAAC,CAAC;AACF,UAAM,6BAA6B,OAAO,YAAY,OAAO,OAAO,SAAS,YAAY,SAAS,EAAE,aAAa,EAAE,IAAI,cAAY;AACjI,aAAO,CAAC,SAAS,SAAS,SAAS,EAAE;AAAA,IACvC,CAAC,CAAC;AACF,sBAAkB,IAAI,GAAG,GAAG,IAAI,WAAW;AAAA,MACzC,SAAS,SAAS,YAAY,SAAS,EAAE;AAAA,MACzC,IAAI,SAAS,YAAY,SAAS,EAAE;AAAA,MACpC;AAAA,MACA;AAAA,IACF,CAAC;AACD,uBAAmB,IAAI,SAAS,YAAY,SAAS,EAAE,SAAS,SAAS;AAAA,EAC3E;AACA,SAAO,kBAAkB,IAAI,GAAG,GAAG,IAAI,SAAS;AAClD","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 { getObjectTypeV2 } from \"@osdk/foundry/OntologiesV2_ObjectTypeV2\";\nimport WebSocket from \"isomorphic-ws\";\nimport invariant from \"tiny-invariant\";\nimport { createTemporaryObjectSet } from \"../generated/object-set-service/api/ObjectSetService.js\";\nimport { batchEnableWatcher } from \"../generated/object-set-watcher/ObjectSetWatchService.js\";\nimport { loadAllOntologies, loadOntologyEntities } from \"../generated/ontology-metadata/api/OntologyMetadataService.js\";\nimport { convertWireToOsdkObjects } from \"../object/convertWireToOsdkObjects.js\";\nimport { getObjectSetBaseType, toConjureObjectSet } from \"./toConjureObjectSet.js\";\nconst ONE_DAY_MS = 24 * 60 * 60 * 1000;\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 onChange = doNothing,\n onError = doNothing,\n onOutOfDate = doNothing\n}) {\n return {\n onChange,\n onError,\n onOutOfDate\n };\n}\nfunction isReady(sub) {\n return sub.temporaryObjectSetId != null;\n}\nfunction subscriptionIsDone(sub) {\n return sub.status === \"done\" || sub.status === \"error\";\n}\nexport class ObjectSetListenerWebsocket {\n static #instances = new WeakMap();\n\n // FIXME\n static getInstance(client) {\n let instance = ObjectSetListenerWebsocket.#instances.get(client);\n if (instance == null) {\n instance = new ObjectSetListenerWebsocket(client);\n ObjectSetListenerWebsocket.#instances.set(client, instance);\n }\n return instance;\n }\n #ws;\n #lastWsConnect = 0;\n #client;\n #logger;\n\n /**\n * map of requestId to all active subscriptions at the time of the request\n */\n #pendingSubscriptions = new Map();\n\n /**\n * Map of subscriptionId to Subscription. Note: the subscriptionId may be\n * temporary and not the actual subscriptionId from the server.\n */\n #subscriptions = new Map();\n #oswContext;\n #metadataContext;\n #ossContext;\n #maybeDisconnectTimeout;\n constructor(client) {\n this.#client = client;\n this.#logger = client.logger?.child({}, {\n msgPrefix: \"<OSW> \"\n });\n !(client.stack.startsWith(\"https://\") || client.stack.startsWith(\"http://\")) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Stack must be a URL\") : invariant(false) : void 0;\n this.#oswContext = {\n baseUrl: client.stack,\n servicePath: \"/object-set-watcher/api\",\n fetchFn: client.fetch,\n tokenProvider: async () => await client.tokenProvider()\n };\n this.#ossContext = {\n ...this.#oswContext,\n servicePath: \"/object-set-service/api\"\n };\n this.#metadataContext = {\n ...this.#oswContext,\n servicePath: \"/ontology-metadata/api\"\n };\n }\n async subscribe(objectSet, listener) {\n // Node 18 does not expose 'crypto' on globalThis, so we need to do it ourselves. This\n // will not be needed after our minimum version is 19 or greater.\n globalThis.crypto ??= (await import(\"node:crypto\")).webcrypto;\n const sub = {\n listener: fillOutListener(listener),\n objectSet,\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-${crypto.randomUUID()}`\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 this.#initiateSubscribe(sub);\n return () => {\n this.#unsubscribe(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) {\n if (sub.expiry) {\n clearTimeout(sub.expiry);\n }\n // expiry is tied to the temporary object set, which is set to `timeToLive: \"ONE_DAY\"`\n // in `#createTemporaryObjectSet`. They should be in sync\n sub.expiry = setTimeout(() => this.#expire(sub), ONE_DAY_MS);\n try {\n const [temporaryObjectSet] = await Promise.all([\n // create a time-bounded object set representation for watching\n this.#createTemporaryObjectSet(sub.objectSet), this.#ensureWebsocket(),\n // look up the object type's rid and ensure that we have enabled object set watcher for that rid\n // TODO ???\n getObjectSetBaseType(sub.objectSet).then(baseType => getObjectTypeV2(this.#client, this.#client.ontologyRid, baseType)).then(objectType => this.#enableObjectSetsWatcher([objectType.rid]))]);\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 (subscriptionIsDone(sub)) {\n return;\n }\n\n // Use new temporary object set id\n sub.temporaryObjectSetId = temporaryObjectSet.objectSetRid;\n this.#sendSubscribeMessage();\n } catch (error) {\n sub.listener.onError(error);\n }\n }\n #sendSubscribeMessage() {\n // If two calls to `.subscribe()` happen at once (or if the connection is reset),\n // we may have multiple subscriptions that don't have a subscriptionId yet,\n // so we filter those out.\n const readySubs = [...this.#subscriptions.values()].filter(isReady);\n if (readySubs.length === 0) return;\n\n // Assumes the node 18 crypto fallback to globalThis in `subscribe` has happened.\n const id = crypto.randomUUID();\n // responses come back as an array of subIds, so we need to know the sources\n this.#pendingSubscriptions.set(id, readySubs);\n\n // every subscribe message \"overwrites\" the previous ones that are not\n // re-included, so we have to reconstitute the entire list of subscriptions\n const subscribe = {\n id,\n requests: readySubs.map(({\n temporaryObjectSetId\n }) => ({\n objectSet: temporaryObjectSetId,\n objectSetContext: {\n objectSetFilterContext: {\n parameterOverrides: {}\n }\n },\n watchAllLinks: false\n }))\n };\n if (process.env.NODE_ENV !== \"production\") {\n this.#logger?.debug({\n payload: subscribe\n }, \"sending subscribe message\");\n }\n this.#ws?.send(JSON.stringify(subscribe));\n }\n #expire(sub) {\n // the temporary ObjectSet has expired, we should re-subscribe which will cause the\n // listener to get an onOutOfDate message when it becomes subscribed again\n sub.status = \"expired\";\n this.#initiateSubscribe(sub);\n }\n #unsubscribe(sub, newStatus = \"done\") {\n if (subscriptionIsDone(sub)) {\n // if we are already done, we don't need to do anything\n return;\n }\n sub.status = newStatus;\n // make sure listeners do nothing now\n sub.listener = fillOutListener({});\n if (sub.expiry) {\n clearTimeout(sub.expiry);\n sub.expiry = undefined;\n }\n this.#subscriptions.delete(sub.subscriptionId);\n\n // If we have no more subscriptions, we can disconnect the websocket\n // however we should wait a bit to see if we get any more subscriptions.\n // For example, when switching between react views, you may unsubscribe\n // in the old view and subscribe in the new view. We don't need to re-establish\n // the websocket connection in that case.\n if (this.#maybeDisconnectTimeout) {\n // We reset the timeout on every unsubscribe so its always at least 15s from\n // the last time we are empty. E.g.:\n // - 0s: Sub(A)\n // - 10s: Unsub(A)\n // - 11s: Sub(B)\n // - 20s: Unsub(B)\n // If we do not clear out the timeout we would disconnect at 25s but that would only be\n // 5s after the last subscription was removed instead of at 35s for the desired 15s.\n clearTimeout(this.#maybeDisconnectTimeout);\n }\n this.#maybeDisconnectTimeout = setTimeout(() => {\n this.#maybeDisconnectTimeout = undefined;\n if (this.#subscriptions.size === 0) {\n this.#cycleWebsocket();\n }\n }, 15_000 /* ms */);\n }\n async #ensureWebsocket() {\n if (this.#ws == null) {\n const {\n stack,\n tokenProvider\n } = this.#client;\n const base = new URL(stack);\n // TODO: This should be a different endpoint\n const url = `wss://${base.host}/object-set-watcher/ws/subscriptions`;\n const token = await tokenProvider();\n\n // tokenProvider is async, there could potentially be a race to create the websocket.\n // Only the first call to reach here will find a null this.#ws, the rest will bail out\n if (this.#ws == null) {\n // TODO this can probably be exponential backoff with jitter\n // don't reconnect more quickly than MINIMUM_RECONNECT_DELAY\n const nextConnectTime = (this.#lastWsConnect ?? 0) + MINIMUM_RECONNECT_DELAY_MS;\n if (nextConnectTime > Date.now()) {\n await new Promise(resolve => {\n setTimeout(resolve, nextConnectTime - Date.now());\n });\n }\n this.#lastWsConnect = Date.now();\n\n // we again may have lost the race after our minimum backoff time\n if (this.#ws == null) {\n this.#ws = new WebSocket(url, [`Bearer-${token}`]);\n this.#ws.addEventListener(\"close\", this.#onClose);\n this.#ws.addEventListener(\"message\", this.#onMessage);\n this.#ws.addEventListener(\"open\", this.#onOpen);\n }\n }\n\n // Allow await-ing the websocket open event if it isn't open already.\n // This needs to happen even for callers that didn't just create this.#ws\n if (this.#ws.readyState === WebSocket.CONNECTING) {\n const ws = this.#ws;\n return new Promise((resolve, reject) => {\n ws.addEventListener(\"open\", () => {\n resolve();\n });\n ws.addEventListener(\"error\", event => {\n reject(new Error(event.toString()));\n });\n });\n }\n }\n }\n #onOpen = () => {\n // resubscribe all of the listeners\n this.#sendSubscribeMessage();\n };\n #onMessage = async message => {\n const data = JSON.parse(message.data.toString());\n if (process.env.NODE_ENV !== \"production\") {\n this.#logger?.debug({\n payload: data\n }, \"recieved message from ws\");\n }\n switch (data.type) {\n case \"objectSetChanged\":\n return this.#handleMessage_objectSetChanged(data.objectSetChanged);\n case \"refreshObjectSet\":\n return this.#handleMessage_refreshObjectSet(data.refreshObjectSet);\n case \"subscribeResponses\":\n return this.#handleMessage_subscribeResponses(data.subscribeResponses);\n default:\n const _ = data;\n !false ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Unexpected message type\") : invariant(false) : void 0;\n }\n };\n #handleMessage_objectSetChanged = async payload => {\n const sub = this.#subscriptions.get(payload.id);\n !sub ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Expected subscription id ${payload.id}`) : invariant(false) : void 0;\n if (\"confidenceValue\" in payload) {\n sub.listener.onOutOfDate();\n return;\n }\n sub.listener.onChange(await convertFoundryToOsdkObjects(this.#client, this.#metadataContext, payload.objects));\n };\n #handleMessage_refreshObjectSet = payload => {\n const sub = this.#subscriptions.get(payload.id);\n !sub ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Expected subscription id ${payload.id}`) : invariant(false) : void 0;\n sub.listener.onOutOfDate();\n };\n #handleMessage_subscribeResponses = payload => {\n const {\n id,\n responses\n } = payload;\n const subs = this.#pendingSubscriptions.get(id);\n !subs ? process.env.NODE_ENV !== \"production\" ? invariant(false, `should have a pending subscription for ${id}`) : invariant(false) : void 0;\n this.#pendingSubscriptions.delete(id);\n for (let i = 0; i < responses.length; i++) {\n const sub = subs[i];\n const response = responses[i];\n switch (response.type) {\n case \"error\":\n sub.listener.onError(response.error);\n this.#unsubscribe(sub, \"error\");\n break;\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 case \"success\":\n sub.status = \"subscribed\";\n if (sub.subscriptionId !== response.success.id) {\n // might be the temporary one\n this.#subscriptions.delete(sub.subscriptionId);\n sub.subscriptionId = response.success.id;\n this.#subscriptions.set(sub.subscriptionId, sub); // future messages come by this subId\n }\n sub.listener.onOutOfDate();\n break;\n default:\n const _ = response;\n sub.listener.onError(response);\n }\n }\n };\n #onClose = () => {\n // TODO we should probably throttle this so we don't abuse the backend\n this.#cycleWebsocket();\n };\n async #enableObjectSetsWatcher(objectTypeRids) {\n return batchEnableWatcher(this.#oswContext, {\n requests: objectTypeRids\n });\n }\n async #createTemporaryObjectSet(objectSet) {\n const objectSetBaseType = await getObjectSetBaseType(objectSet);\n const mapping = await getOntologyPropertyMappingForApiName(this.#client, this.#metadataContext, objectSetBaseType);\n const temporaryObjectSet = await createTemporaryObjectSet(this.#ossContext, {\n objectSet: toConjureObjectSet(objectSet, mapping),\n timeToLive: \"ONE_DAY\",\n // MUST keep in sync with the value for expiry in `#initiateSubscribe`.\n objectSetFilterContext: {\n parameterOverrides: {}\n }\n });\n return {\n objectSetRid: temporaryObjectSet.objectSetRid\n };\n }\n #cycleWebsocket = () => {\n if (this.#ws) {\n this.#ws.removeEventListener(\"open\", this.#onOpen);\n this.#ws.removeEventListener(\"message\", this.#onMessage);\n this.#ws.removeEventListener(\"close\", this.#onClose);\n if (this.#ws.readyState !== WebSocket.CLOSING && this.#ws.readyState !== WebSocket.CLOSED) {\n this.#ws.close();\n }\n this.#ws = undefined;\n }\n\n // if we have any listeners that are still depending on us, go ahead and reopen the websocket\n if (this.#subscriptions.size > 0) {\n this.#ensureWebsocket();\n }\n };\n}\nasync function convertFoundryToOsdkObjects(client, ctx, objects) {\n const osdkObjects = await Promise.all(objects.map(async object => {\n const propertyMapping = await getOntologyPropertyMappingForRid(ctx, client.ontologyRid, object.type);\n const convertedObject = Object.fromEntries([...Object.entries(object.properties).map(([key, value]) => {\n return [propertyMapping?.propertyIdToApiNameMapping[key], value];\n }), [propertyMapping?.propertyIdToApiNameMapping[Object.entries(object.key)[0][0]], Object.entries(object.key)[0][1]], [\"__apiName\", propertyMapping?.apiName], [\"$apiName\", propertyMapping?.apiName]]);\n return convertedObject;\n }));\n\n // doesnt care about interfaces\n return await convertWireToOsdkObjects(client, osdkObjects, undefined);\n}\n// Mapping of ObjectRid to Properties\nconst objectTypeMapping = new WeakMap();\nconst objectApiNameToRid = new Map();\nasync function getOntologyPropertyMappingForApiName(client, ctx, objectApiName) {\n if (objectApiNameToRid.has(objectApiName)) {\n return objectTypeMapping.get(ctx)?.get(objectApiNameToRid.get(objectApiName));\n }\n const wireObjectType = await getObjectTypeV2(client, client.ontologyRid, objectApiName);\n return getOntologyPropertyMappingForRid(ctx, client.ontologyRid, wireObjectType.rid);\n}\nlet cachedAllOntologies;\nasync function getOntologyVersionForRid(ctx, ontologyRid) {\n cachedAllOntologies ??= await loadAllOntologies(ctx, {});\n !cachedAllOntologies.ontologies[ontologyRid] ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"ontology should be loaded\") : invariant(false) : void 0;\n return cachedAllOntologies.ontologies[ontologyRid].currentOntologyVersion;\n}\nasync function getOntologyPropertyMappingForRid(ctx, ontologyRid, objectRid) {\n if (!objectTypeMapping.has(ctx)) {\n objectTypeMapping.set(ctx, new Map());\n }\n if (!objectTypeMapping.get(ctx).has(objectRid)) {\n const ontologyVersion = await getOntologyVersionForRid(ctx, ontologyRid);\n const body = {\n objectTypeVersions: {\n // TODO: Undefined drops this in the body\n [objectRid]: ontologyVersion\n },\n linkTypeVersions: {},\n loadRedacted: false,\n includeObjectTypesWithoutSearchableDatasources: true\n };\n const entities = await loadOntologyEntities(ctx, body);\n !entities.objectTypes[objectRid] ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"object type should be loaded\") : invariant(false) : void 0;\n const propertyIdToApiNameMapping = Object.fromEntries(Object.values(entities.objectTypes[objectRid].propertyTypes).map(property => {\n return [property.id, property.apiName];\n }));\n const propertyApiNameToIdMapping = Object.fromEntries(Object.values(entities.objectTypes[objectRid].propertyTypes).map(property => {\n return [property.apiName, property.id];\n }));\n objectTypeMapping.get(ctx)?.set(objectRid, {\n apiName: entities.objectTypes[objectRid].apiName,\n id: entities.objectTypes[objectRid].id,\n propertyIdToApiNameMapping,\n propertyApiNameToIdMapping\n });\n objectApiNameToRid.set(entities.objectTypes[objectRid].apiName, objectRid);\n }\n return objectTypeMapping.get(ctx)?.get(objectRid);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Creates an orphaned object set - i.e. not part of any versioned object set. This may be for temporary or internal application use. No gatekeeper resource is created - instead the given security rid is assumed to already exist and will be used to permission the created object set.\n */\nexport async function createObjectSet(ctx, request) {\n return conjureFetch(ctx, `/objectSets`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Creates a temporary object set that will live for at least as long as the provided TTL, and will get deleted\n * at some point after that.\n *\n * Temporary object sets can only be accessed by users who have created them; a gatekeeper resource is registered\n * for every temporary object set. NOTE: The same gatekeeper resource may be reused for the same userId across\n * different createTemporaryObjectSet requests.\n *\n * Whenever an object set (temporary, or otherwise) referencing a temporary object set gets saved or used in\n * versioned object sets, the reference gets replaced with a full definition of the previously saved temporary\n * object. This is to ensure that they do not inherit the TTL of temporary object sets they reference.\n *\n * Please consider using temporary object sets whenever there is a need to save an object set just to be able to\n * pass it to another service without a need to persist it indefinitely.\n */\nexport async function createTemporaryObjectSet(ctx, request) {\n return conjureFetch(ctx, `/objectSets/temporary`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Deletes this object set, causing future operations which access it to fail.\n */\nexport async function deleteObjectSet(ctx, objectSetRid) {\n return conjureFetch(ctx, `/objectSets/${objectSetRid}`, \"DELETE\");\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Returns the definitions of requested object sets.\n */\nexport async function getBulkObjectSet(ctx, request) {\n return conjureFetch(ctx, `/bulk/objectSets`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Returns the definition of this object set.\n */\nexport async function getObjectSet(ctx, objectSetRid) {\n return conjureFetch(ctx, `/objectSets/${objectSetRid}`, \"GET\");\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Fetches object rids on requested page of evaluated object set. If more objects are available, the returned pageToken can be used to fetch the subsequent page. Note that page tokens are *not* long-lived and *may* get invalidated (for example following updates to the underlying index or indices, or after a few minutes).\n * Note that the service currently does not provide guarantees around the consistency of returned results. In particular, any state changes to the underlying indices can cause duplicate results to be returned or some results to be skipped between subsequent page requests.\n */\nexport async function getObjectsPage(ctx, request, backend) {\n return conjureFetch(ctx, `/objectSets/objects`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Returns types of objects that can be present in the supplied object set based on its definition at the time\n * of the request.\n *\n * Note that this endpoint does not perform a full evaluation of the supplied object set - the guarantees provided\n * are that only the returned object types can be present in the supplied object set at the time of the request.\n * It is not however guaranteed that there in fact is at least one object of each returned object type - consider\n * using aggregations instead if false-positives are not desired.\n *\n * Note that object types belonging to an object set can change over time - this information should be treated as\n * dynamic and should not be persisted or treated as immutable.\n */\nexport async function getObjectTypes(ctx, request) {\n return conjureFetch(ctx, `/objectSets/objectTypes`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Returns the entities used within an object set. i.e. object type rids and link type rids\n *\n * Note that relations belonging to an object set can change over time - this information should be treated as\n * dynamic and should not be persisted or treated as immutable.\n */\nexport async function getReferencedEntities(ctx, request) {\n return conjureFetch(ctx, `/objectSets/entities`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Materialize an object set.\n */\nexport async function materializeObjectSet(ctx, request) {\n return conjureFetch(ctx, `/objectSets/materialize`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Allows user to enable watching object types. Requires permission to view the requested object types.\n */\nexport async function batchEnableWatcher(ctx, request) {\n return conjureFetch(ctx, `/object-set-watcher/batchEnableWatcher`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load Ontology entities in bulk. The returned OntologyBulkLoadEntitiesResponse will only\n * contain entities that actually exist and are visible to the user. If the user has requested entities at\n * invalid versions or entities that do not exist in the specified versions, those will not be present\n * in the response.\n *\n * There are limits on the number of entities that can be loaded in one request. Please refer to\n * documentation of OntologyBulkLoadEntitiesRequest for the values of these limits.\n */\nexport async function bulkLoadOntologyEntities(ctx, onBehalfOf, request) {\n return conjureFetch(ctx, `/ontology/ontology/bulkLoadEntities`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load Ontology entities by their backing datasources in bulk.\n * The returned OntologyBulkLoadEntitiesByDatasourcesResponse will only\n * contain entities that actually exist and are visible to the user.\n * If the user has requested entities that do not exist in any of the latest Ontology versions,\n * those will not be present in the response.\n *\n * There are limits on the number of entities that can be loaded in one request. Please refer to\n * documentation of OntologyBulkLoadEntitiesByDatasourcesRequest for the values of these limits.\n */\nexport async function bulkLoadOntologyEntitiesByDatasources(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/bulkLoadEntitiesByDatasources`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Gets all the action types that the object types are associated with. E.g. actions that create an object, edit\n * an object, or use the object as a parameter.\n */\nexport async function getActionTypesForObjectType(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/actionTypesForObjectType`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Please contact the OMS team before using this endpoint.\n *\n * Gets the current configuration of some OMS features. Note that these configurations are stack-wide, which\n * means they do not have granularity on org/enrollment/group level.\n */\nexport async function getFeatureConfigurations(ctx) {\n return conjureFetch(ctx, `/ontology/featureConfigurations`, \"GET\");\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to batch load links associated to given ObjectTypeRid(s). The GetLinkTypesForObjectTypesResponse\n * will only contain links that are visible to the user. If the user has requested to get links at for\n * ObjectTypeRid(s) that do not exist in the specified versions, those entries will include an empty set\n * of link types.\n */\nexport async function getLinkMetadataForObjectTypes(ctx, request) {\n return conjureFetch(ctx, `/ontology/getLinkMetadataForObjectTypes`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to batch load links associated to given ObjectTypeRid(s). The GetLinkTypesForObjectTypesResponse\n * will only contain links that are visible to the user. If the user has requested to get link types at\n * invalid ontology versions or for ObjectTypeRid(s) that do not exist in the specified versions, those entries\n * will include an empty set of link types.\n *\n * The includeObjectTypesWithoutSearchableDatasources flag is respected if present in the request,\n * else we set it to a default (false) unless the user-agent is blocklisted.\n * The flag is set to true for blocklisted user agents. Currently the blocklist\n * includes functions-typescript-gradle-plugin only.\n */\nexport async function getLinkTypesForObjectTypes(ctx, request) {\n return conjureFetch(ctx, `/ontology/linkTypesForObjectTypes`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Gets a map of interfaces to the set of object types that implement the interface. At most 50 interfaces can be\n * requested.\n */\nexport async function getObjectTypesForInterfaceTypes(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/objectTypesForInterfaceTypes`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Gets a map of SharedPropertyTypeRid to the set of ObjectTypeRids that use the SharedPropertyType. At most 50\n * SharedPropertyTypeRids can be requested.\n */\nexport async function getObjectTypesForSharedPropertyTypes(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/objectTypesForSharedPropertyTypes`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Gets a map of TypeGroupRids to the set of ObjectTypeRids that use the TypeGroup. At most 50 TypeGroupRids\n * can be requested.\n */\nexport async function getObjectTypesForTypeGroups(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/objectTypesForTypeGroups`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Gets the ontology rids to which the given ontology entities belong.\n * The returned OntologyRidsForOntologyEntitiesResponse will only\n * contain ontology rids for entities that actually exist and which belong to an Ontology that the user\n * has access to. If the user has requested entities that do not exist in any of the latest Ontology versions,\n * or which belong to an Ontology which the user does not have access to, those will not be present in the\n * response.\n */\nexport async function getOntologyRidsForEntities(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/getOntologyRidsForEntities`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load a summary of an Ontology including the number of entities of each type visible to the user.\n *\n * An entity is considered visible if the user has `view` or `discover` permissions. ObjectTypes and LinkTypes\n * migrated to roles are also considered visible regardless of the users permissions on the backing datasources\n * (i.e. the endpoint runs using `includeObjectTypesWithoutSearchableDatasources` set to true).\n *\n * The results in this endpoint are eventually consistent with the latest OntologyVersion and may lag slightly\n * behind the last Ontology modification.\n */\nexport async function getOntologySummary(ctx, ontologyRid, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/${ontologyRid}/summary`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Gets the organization rids to which the ontology entities in the given ontology rid belong. If the user has\n * requested an ontology they do not have access to, no organization rids will be present in the response.\n */\nexport async function getOrganizationRidsForOntology(ctx, ontologyRid) {\n return conjureFetch(ctx, `/ontology/ontology/${ontologyRid}/organizationRids`, \"GET\");\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to batch load relations associated to given objectTypeIds. The GetRelationsForObjectTypesResponse\n * will only contain relations that are visible to the user. If the user has requested to get relations at\n * invalid ontology versions or for objectTypeIds that do not exist in the specified versions, those entries\n * will include an empty set of relations.\n */\nexport async function getRelationsForObjectTypes(ctx, request) {\n return conjureFetch(ctx, `/ontology/relationsForObjectTypes`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to get all the CustomObjectTypeTraits a user has access to.\n */\nexport async function loadAllCustomObjectTypeTraitsFromOntology(ctx, ontologyRid, ontologyVersion, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/${ontologyRid}/${ontologyVersion}/loadAllCustomObjectTypeTraitsFromOntology`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load a paged collection of all interfaces visible to the user from the specified ontology and\n * ontology version. The maximum number of interfaces returned in a page is capped at 100.\n */\nexport async function loadAllInterfaceTypesFromOntology(ctx, ontologyRid, ontologyVersion, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/${ontologyRid}/${ontologyVersion}/loadAllInterfaceTypes`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load a paged collection of all ObjectTypes visible to the user from the specified Ontology and\n * OntologyVersion. The maximum number of ObjectTypes returned in a page is capped at 500.\n */\nexport async function loadAllObjectTypesFromOntology(ctx, ontologyRid, ontologyVersion, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/${ontologyRid}/${ontologyVersion}/loadAllObjectTypes`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load a paged collection of all ObjectTypes visible to the user from the specified Ontology and\n * OntologyVersion. The maximum number of ObjectTypes returned in a page is capped at 500.\n */\nexport async function loadAllObjectTypesFromOntologyPage(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/loadAllObjectTypes`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load the whole Ontology at a given OntologyVersion or at the latest OntologyVersion.\n * The returned OntologyLoadResponse will only contain entities that are visible to the user.\n * If the user has requested to load the Ontology at an invalid OntologyVersion,\n * an empty response will be returned.\n *\n * In the presence of multiple ontologies, this endpoint will implicitly choose which ontology the user\n * expects to load given the organization membership of the user. If the user is not a member of any organization,\n * the default Ontology will be chosen.\n */\nexport async function loadAllOntology(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/all`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load entity rids from the whole Ontology at a given OntologyVersion or at the latest\n * OntologyVersion. The returned OntologyLoadResponse will only contain entity rids that are visible\n * to the user. If the user has requested to load the Ontology at an invalid OntologyVersion,\n * an empty response will be returned.\n *\n * In the presence of multiple ontologies, this endpoint will implicitly choose which ontology the user\n * expects to load given the organization membership of the user. If the user is not a member of any organization,\n * the default Ontology will be chosen.\n *\n * The includeObjectTypesWithoutSearchableDatasources flag is respected if present in the request,\n * else we set it to a default (false) unless the user-agent is blocklisted.\n * The flag is set to true for blocklisted user agents. Currently the blocklist\n * includes functions-typescript-gradle-plugin only.\n */\nexport async function loadAllOntologyEntities(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/allEntities`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load a paged collection of all SharedPropertyTypes visible to the user from the specified Ontology and\n * OntologyVersion. The maximum number of SharedPropertyTypes returned in a page is capped at 100.\n */\nexport async function loadAllSharedPropertyTypesFromOntology(ctx, ontologyRid, ontologyVersion, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/${ontologyRid}/${ontologyVersion}/loadAllSharedPropertyTypes`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load a paged collection of all type groups visible to the user from the specified ontology and\n * ontology version. The maximum number of type groups returned in a page is capped at 100.\n */\nexport async function loadAllTypeGroupsFromOntology(ctx, ontologyRid, ontologyVersion, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/${ontologyRid}/${ontologyVersion}/loadAllTypeGroups`, \"PUT\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to batch load Ontology entities. The returned OntologyLoadResponse will only contain\n * entities that actually exist and are visible to the user. If the user has requested entities at\n * invalid ontology versions or entities that do not exist in the specified versions,\n * those will not be present in the response. If the user tries to load entities across multiple ontologies, the\n * call will fail with an exception.\n */\nexport async function loadOntology(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/load`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to load datasources for Ontology entities at a given OntologyVersion or at the latest\n * OntologyVersion. The returned OntologyDatasourcesLoadResponse will only contain datasources that are\n * visible to the user. If the user has requested to get datasources at invalid ontology versions\n * or for objectTypeIds that do not exist in the specified versions, those entries will include an\n * empty set of datasources.\n */\nexport async function loadOntologyDatasources(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/load/datasources`, \"POST\", request);\n}","/*\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Endpoint to modify Ontology entities.\n */\nexport async function modifyOntology(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/modify`, \"POST\", request);\n}","/*\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 function toConjureObjectSet(objectSet, objectPropertyMapping) {\n switch (objectSet.type) {\n case \"base\":\n return {\n type: \"base\",\n base: {\n objectTypeId: objectPropertyMapping.id\n }\n };\n case \"static\":\n return {\n type: \"static\",\n static: {\n objectRids: objectSet.objects,\n provenance: undefined\n }\n };\n case \"reference\":\n return {\n type: \"referenced\",\n referenced: {\n objectSetRid: objectSet.reference\n }\n };\n case \"filter\":\n return {\n type: \"filtered\",\n filtered: {\n objectSet: toConjureObjectSet(objectSet.objectSet, objectPropertyMapping),\n runtimeDerivedProperties: undefined,\n filter: mapWhereClauseToObjectSetFilter(objectSet.where, objectPropertyMapping)\n }\n };\n case \"union\":\n return {\n type: \"unioned\",\n unioned: {\n objectSets: objectSet.objectSets.map(os => toConjureObjectSet(os, objectPropertyMapping))\n }\n };\n case \"intersect\":\n return {\n type: \"intersected\",\n intersected: {\n objectSets: objectSet.objectSets.map(os => toConjureObjectSet(os, objectPropertyMapping))\n }\n };\n case \"subtract\":\n return {\n type: \"subtracted\",\n subtracted: {\n objectSets: objectSet.objectSets.map(os => toConjureObjectSet(os, objectPropertyMapping))\n }\n };\n case \"searchAround\":\n throw new Error(\"not implemented\");\n }\n}\nexport async function getObjectSetBaseType(objectSet) {\n switch (objectSet.type) {\n case \"base\":\n return objectSet.objectType;\n case \"static\":\n // TODO: Get the object type from a wire call\n // This is not supported at the moment by the API anyway\n throw new Error(\"not implemented\");\n case \"reference\":\n // TODO: Get the object type from a wire call\n throw new Error(\"not implemented\");\n case \"filter\":\n return getObjectSetBaseType(objectSet.objectSet);\n case \"union\":\n // Technically you can have multiple ObjectTypes but at the moment we only support one\n return getObjectSetBaseType(objectSet.objectSets[0]);\n case \"intersect\":\n return getObjectSetBaseType(objectSet.objectSets[0]);\n case \"subtract\":\n return getObjectSetBaseType(objectSet.objectSets[0]);\n case \"searchAround\":\n // TODO: Get a mapping using the link\n throw new Error(\"not implemented\");\n }\n}\nfunction mapWhereClauseToObjectSetFilter(objectSetFilter, propertyMapping) {\n switch (objectSetFilter.type) {\n case \"lt\":\n return {\n type: \"range\",\n range: {\n propertyId: propertyMapping.propertyApiNameToIdMapping[objectSetFilter.field],\n lt: objectSetFilter.value,\n lte: undefined,\n gt: undefined,\n gte: undefined\n }\n };\n case \"gt\":\n return {\n type: \"range\",\n range: {\n propertyId: propertyMapping.propertyApiNameToIdMapping[objectSetFilter.field],\n gt: objectSetFilter.value,\n lte: undefined,\n lt: undefined,\n gte: undefined\n }\n };\n case \"lte\":\n return {\n type: \"range\",\n range: {\n propertyId: propertyMapping.propertyApiNameToIdMapping[objectSetFilter.field],\n lte: objectSetFilter.value,\n lt: undefined,\n gt: undefined,\n gte: undefined\n }\n };\n case \"gte\":\n return {\n type: \"range\",\n range: {\n propertyId: propertyMapping.propertyApiNameToIdMapping[objectSetFilter.field],\n gte: objectSetFilter.value,\n lt: undefined,\n lte: undefined,\n gt: undefined\n }\n };\n case \"eq\":\n return {\n type: \"exactMatch\",\n exactMatch: {\n propertyId: propertyMapping.propertyApiNameToIdMapping[objectSetFilter.field],\n terms: [objectSetFilter.value]\n }\n };\n case \"and\":\n return {\n type: \"and\",\n and: {\n filters: objectSetFilter.value.map(filter => mapWhereClauseToObjectSetFilter(filter, propertyMapping))\n }\n };\n case \"or\":\n return {\n type: \"or\",\n or: {\n filters: objectSetFilter.value.map(filter => mapWhereClauseToObjectSetFilter(filter, propertyMapping))\n }\n };\n case \"isNull\":\n return {\n type: \"not\",\n not: {\n filter: {\n type: \"hasProperty\",\n hasProperty: {\n propertyId: propertyMapping.propertyApiNameToIdMapping[objectSetFilter.field]\n }\n }\n }\n };\n case \"not\":\n return {\n type: \"not\",\n not: {\n filter: mapWhereClauseToObjectSetFilter(objectSetFilter.value, propertyMapping)\n }\n };\n case \"contains\":\n case \"startsWith\":\n case \"containsAllTermsInOrder\":\n case \"containsAnyTerm\":\n case \"containsAllTerms\":\n case \"withinDistanceOf\":\n case \"withinBoundingBox\":\n case \"intersectsBoundingBox\":\n case \"doesNotIntersectBoundingBox\":\n case \"withinPolygon\":\n case \"intersectsPolygon\":\n case \"doesNotIntersectPolygon\":\n case \"containsAllTermsInOrderPrefixLastTerm\":\n throw new Error(\"not implemented\");\n }\n}"]}
|
package/build/js/{ObjectSetListenerWebsocket-XV5EGCT6.mjs → ObjectSetListenerWebsocket-TWQJWEX2.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getObjectTypeV2, convertWireToOsdkObjects, loadOntologyEntities, loadAllOntologies } from './chunk-
|
|
1
|
+
import { getObjectTypeV2, convertWireToOsdkObjects, loadOntologyEntities, loadAllOntologies } from './chunk-4MFLNKU3.mjs';
|
|
2
2
|
import WebSocket from 'isomorphic-ws';
|
|
3
3
|
import invariant from 'tiny-invariant';
|
|
4
4
|
import { conjureFetch } from 'conjure-lite';
|
|
@@ -572,4 +572,4 @@ async function getOntologyPropertyMappingForRid(ctx, ontologyRid, objectRid) {
|
|
|
572
572
|
|
|
573
573
|
export { ObjectSetListenerWebsocket };
|
|
574
574
|
//# sourceMappingURL=out.js.map
|
|
575
|
-
//# sourceMappingURL=ObjectSetListenerWebsocket-
|
|
575
|
+
//# sourceMappingURL=ObjectSetListenerWebsocket-TWQJWEX2.mjs.map
|