@osdk/client 0.17.0 → 0.17.1-main-20240503171106
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 +6 -0
- package/build/js/{chunk-K7HWC7BJ.cjs → chunk-7XXPD5VV.cjs} +253 -24
- package/build/js/chunk-7XXPD5VV.cjs.map +1 -0
- package/build/js/{chunk-JRMNN5VM.mjs → chunk-GIAEB6N4.mjs} +251 -17
- package/build/js/chunk-GIAEB6N4.mjs.map +1 -0
- package/build/js/{chunk-CMSW5WNH.browser.mjs → chunk-KBPJCGTE.browser.mjs} +251 -17
- package/build/js/chunk-KBPJCGTE.browser.mjs.map +1 -0
- package/build/js/index.browser.mjs +1 -256
- package/build/js/index.browser.mjs.map +1 -1
- package/build/js/index.cjs +7 -259
- package/build/js/index.cjs.map +1 -1
- package/build/js/index.mjs +1 -256
- package/build/js/index.mjs.map +1 -1
- package/build/js/{ObjectSetListenerWebsocket-SJQZYVQI.browser.mjs → public/unstable-do-not-use.browser.mjs} +122 -122
- package/build/js/public/unstable-do-not-use.browser.mjs.map +1 -0
- package/build/js/{ObjectSetListenerWebsocket-Q2PZKFQL.cjs → public/unstable-do-not-use.cjs} +130 -127
- package/build/js/public/unstable-do-not-use.cjs.map +1 -0
- package/build/js/{ObjectSetListenerWebsocket-YQBSLGBD.mjs → public/unstable-do-not-use.mjs} +122 -122
- package/build/js/public/unstable-do-not-use.mjs.map +1 -0
- package/build/types/Client.d.ts +8 -7
- package/build/types/Client.d.ts.map +1 -1
- package/build/types/MinimalClientContext.d.ts +2 -1
- package/build/types/MinimalClientContext.d.ts.map +1 -1
- package/build/types/UNSTABLE_createClient.d.ts +4 -0
- package/build/types/UNSTABLE_createClient.d.ts.map +1 -0
- package/build/types/UnstableClient.d.ts +11 -0
- package/build/types/UnstableClient.d.ts.map +1 -0
- package/build/types/createClient.d.ts +6 -1
- package/build/types/createClient.d.ts.map +1 -1
- package/build/types/createMinimalClient.d.ts +2 -1
- package/build/types/createMinimalClient.d.ts.map +1 -1
- package/build/types/generatedNoCheck/OntologyMetadata.d.ts +1 -1
- package/build/types/index.d.ts +2 -4
- package/build/types/index.d.ts.map +1 -1
- package/build/types/object/convertWireToOsdkObjects.d.ts.map +1 -1
- package/build/types/objectSet/ObjectSet.d.ts +1 -8
- package/build/types/objectSet/ObjectSet.d.ts.map +1 -1
- package/build/types/objectSet/ObjectSetFactory.d.ts +6 -0
- package/build/types/objectSet/ObjectSetFactory.d.ts.map +1 -0
- package/build/types/objectSet/conjureUnionType.d.ts +13 -0
- package/build/types/objectSet/conjureUnionType.d.ts.map +1 -0
- package/build/types/objectSet/createObjectSet.d.ts.map +1 -1
- package/build/types/objectSet/createUnstableObjectSet.d.ts +17 -0
- package/build/types/objectSet/createUnstableObjectSet.d.ts.map +1 -0
- package/build/types/objectSet/toConjureObjectSet.d.ts.map +1 -1
- package/build/types/public/unstable-do-not-use.d.ts +6 -0
- package/build/types/public/unstable-do-not-use.d.ts.map +1 -0
- package/package.json +3 -3
- package/build/js/ObjectSetListenerWebsocket-Q2PZKFQL.cjs.map +0 -1
- package/build/js/ObjectSetListenerWebsocket-SJQZYVQI.browser.mjs.map +0 -1
- package/build/js/ObjectSetListenerWebsocket-YQBSLGBD.mjs.map +0 -1
- package/build/js/chunk-CMSW5WNH.browser.mjs.map +0 -1
- package/build/js/chunk-JRMNN5VM.mjs.map +0 -1
- package/build/js/chunk-K7HWC7BJ.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var shared_net = require('@osdk/shared.net');
|
|
4
4
|
var invariant2 = require('tiny-invariant');
|
|
5
|
+
var generatorConverters = require('@osdk/generator-converters');
|
|
6
|
+
var deepEqual = require('fast-deep-equal');
|
|
5
7
|
var conjureLite = require('conjure-lite');
|
|
6
8
|
|
|
7
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
10
|
|
|
9
11
|
var invariant2__default = /*#__PURE__*/_interopDefault(invariant2);
|
|
12
|
+
var deepEqual__default = /*#__PURE__*/_interopDefault(deepEqual);
|
|
10
13
|
|
|
11
14
|
// ../foundry/build/js/public/OntologiesV2_OntologyObjectSet.mjs
|
|
12
15
|
var _loadObjectSetV2 = [1, "/v2/ontologies/{0}/objectSets/loadObjects", 3];
|
|
@@ -385,12 +388,10 @@ function createObjectSet(objectType, clientCtx, objectSet = {
|
|
|
385
388
|
}) {
|
|
386
389
|
const base = {
|
|
387
390
|
aggregate: aggregate.bind(globalThis, clientCtx, objectType, objectSet),
|
|
388
|
-
aggregateOrThrow: aggregate.bind(globalThis, clientCtx, objectType, objectSet),
|
|
389
391
|
fetchPage: fetchPageInternal.bind(globalThis, clientCtx, objectType, objectSet),
|
|
390
392
|
fetchPageWithErrors: fetchPageWithErrorsInternal.bind(globalThis, clientCtx, objectType, objectSet),
|
|
391
|
-
fetchPageOrThrow: fetchPageInternal.bind(globalThis, clientCtx, objectType, objectSet),
|
|
392
393
|
where: (clause) => {
|
|
393
|
-
return
|
|
394
|
+
return clientCtx.objectSetFactory(objectType, clientCtx, {
|
|
394
395
|
type: "filter",
|
|
395
396
|
objectSet,
|
|
396
397
|
where: modernToLegacyWhereClause(clause)
|
|
@@ -400,29 +401,23 @@ function createObjectSet(objectType, clientCtx, objectSet = {
|
|
|
400
401
|
return createSearchAround(type)();
|
|
401
402
|
},
|
|
402
403
|
union: (...objectSets) => {
|
|
403
|
-
return
|
|
404
|
+
return clientCtx.objectSetFactory(objectType, clientCtx, {
|
|
404
405
|
type: "union",
|
|
405
406
|
objectSets: [objectSet, ...objectSets.map((os) => objectSetDefinitions.get(os))]
|
|
406
407
|
});
|
|
407
408
|
},
|
|
408
409
|
intersect: (...objectSets) => {
|
|
409
|
-
return
|
|
410
|
+
return clientCtx.objectSetFactory(objectType, clientCtx, {
|
|
410
411
|
type: "intersect",
|
|
411
412
|
objectSets: [objectSet, ...objectSets.map((os) => objectSetDefinitions.get(os))]
|
|
412
413
|
});
|
|
413
414
|
},
|
|
414
415
|
subtract: (...objectSets) => {
|
|
415
|
-
return
|
|
416
|
+
return clientCtx.objectSetFactory(objectType, clientCtx, {
|
|
416
417
|
type: "subtract",
|
|
417
418
|
objectSets: [objectSet, ...objectSets.map((os) => objectSetDefinitions.get(os))]
|
|
418
419
|
});
|
|
419
420
|
},
|
|
420
|
-
subscribe(listener) {
|
|
421
|
-
const pendingSubscribe = import('./ObjectSetListenerWebsocket-Q2PZKFQL.cjs').then((mod) => mod.ObjectSetListenerWebsocket.getInstance(clientCtx).subscribe(objectSet, listener));
|
|
422
|
-
return () => {
|
|
423
|
-
pendingSubscribe.then((subscribe) => subscribe());
|
|
424
|
-
};
|
|
425
|
-
},
|
|
426
421
|
asyncIter: async function* () {
|
|
427
422
|
let nextPageToken = void 0;
|
|
428
423
|
do {
|
|
@@ -449,7 +444,7 @@ function createObjectSet(objectType, clientCtx, objectSet = {
|
|
|
449
444
|
};
|
|
450
445
|
function createSearchAround(link) {
|
|
451
446
|
return () => {
|
|
452
|
-
return
|
|
447
|
+
return clientCtx.objectSetFactory(objectType, clientCtx, {
|
|
453
448
|
type: "searchAround",
|
|
454
449
|
objectSet,
|
|
455
450
|
link
|
|
@@ -542,7 +537,7 @@ var LinkFetcherProxyHandler = class {
|
|
|
542
537
|
if (linkDef == null) {
|
|
543
538
|
return;
|
|
544
539
|
}
|
|
545
|
-
const objectSet =
|
|
540
|
+
const objectSet = this.client.objectSetFactory(this.objDef, this.client).where({
|
|
546
541
|
[this.objDef.primaryKeyApiName]: this.primaryKey
|
|
547
542
|
}).pivotTo(p);
|
|
548
543
|
if (!linkDef.multiplicity) {
|
|
@@ -854,6 +849,88 @@ async function fetchObjectPage(client, objectType, args, objectSet) {
|
|
|
854
849
|
nextPageToken: r.nextPageToken
|
|
855
850
|
});
|
|
856
851
|
}
|
|
852
|
+
|
|
853
|
+
// src/actions/ActionValidationError.ts
|
|
854
|
+
var ActionValidationError = class extends Error {
|
|
855
|
+
constructor(validation) {
|
|
856
|
+
super("Validation Error");
|
|
857
|
+
this.validation = validation;
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
var _applyActionV2 = [1, "/v2/ontologies/{0}/actions/{1}/apply", 3];
|
|
861
|
+
function applyActionV2($ctx, ...args) {
|
|
862
|
+
return shared_net.omniFetch($ctx, _applyActionV2, ...args);
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
// src/util/isOntologyObjectV2.ts
|
|
866
|
+
function isOntologyObjectV2(o) {
|
|
867
|
+
return o && typeof o === "object" && typeof o.__apiName === "string" && o.__primaryKey != null;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
// src/util/toDataValue.ts
|
|
871
|
+
function toDataValue(value) {
|
|
872
|
+
if (value == null) {
|
|
873
|
+
return value;
|
|
874
|
+
}
|
|
875
|
+
if (Array.isArray(value) || value instanceof Set) {
|
|
876
|
+
return Array.from(value, toDataValue);
|
|
877
|
+
}
|
|
878
|
+
if (isAttachment(value)) {
|
|
879
|
+
return value.rid;
|
|
880
|
+
}
|
|
881
|
+
if (isOntologyObjectV2(value)) {
|
|
882
|
+
return toDataValue(value.__primaryKey);
|
|
883
|
+
}
|
|
884
|
+
if (isWireObjectSet(value)) {
|
|
885
|
+
return value;
|
|
886
|
+
}
|
|
887
|
+
if (isObjectSet(value)) {
|
|
888
|
+
return getWireObjectSet(value);
|
|
889
|
+
}
|
|
890
|
+
if (typeof value === "object") {
|
|
891
|
+
return Object.entries(value).reduce((acc, [key, structValue]) => {
|
|
892
|
+
acc[key] = toDataValue(structValue);
|
|
893
|
+
return acc;
|
|
894
|
+
}, {});
|
|
895
|
+
}
|
|
896
|
+
return value;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
// src/actions/applyAction.ts
|
|
900
|
+
async function applyAction(client, action, parameters, options = {}) {
|
|
901
|
+
const response = await applyActionV2(addUserAgent(client, action), client.ontologyRid, action.apiName, {
|
|
902
|
+
parameters: remapActionParams(parameters),
|
|
903
|
+
options: {
|
|
904
|
+
mode: options?.validateOnly ? "VALIDATE_ONLY" : "VALIDATE_AND_EXECUTE",
|
|
905
|
+
returnEdits: options?.returnEdits ? "ALL" : "NONE"
|
|
906
|
+
}
|
|
907
|
+
});
|
|
908
|
+
if (options?.validateOnly) {
|
|
909
|
+
return response.validation;
|
|
910
|
+
}
|
|
911
|
+
if (response.validation?.result === "INVALID") {
|
|
912
|
+
throw new ActionValidationError(response.validation);
|
|
913
|
+
}
|
|
914
|
+
return options?.returnEdits ? response.edits : void 0;
|
|
915
|
+
}
|
|
916
|
+
function remapActionParams(params) {
|
|
917
|
+
if (params == null) {
|
|
918
|
+
return {};
|
|
919
|
+
}
|
|
920
|
+
const parameterMap = {};
|
|
921
|
+
const remappedParams = Object.entries(params).reduce((acc, [key, value]) => {
|
|
922
|
+
acc[key] = toDataValue(value);
|
|
923
|
+
return acc;
|
|
924
|
+
}, parameterMap);
|
|
925
|
+
return remappedParams;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
// src/actions/createActionInvoker.ts
|
|
929
|
+
function createActionInvoker(client, action) {
|
|
930
|
+
return function(...args) {
|
|
931
|
+
return applyAction(client, action, ...args);
|
|
932
|
+
};
|
|
933
|
+
}
|
|
857
934
|
var _getObjectTypeV2 = [0, "/v2/ontologies/{0}/objectTypes/{1}"];
|
|
858
935
|
function getObjectTypeV2($ctx, ...args) {
|
|
859
936
|
return shared_net.omniFetch($ctx, _getObjectTypeV2, ...args);
|
|
@@ -869,20 +946,172 @@ async function loadOntologyEntities(ctx, request) {
|
|
|
869
946
|
return conjureLite.conjureFetch(ctx, `/ontology/ontology/loadEntities`, "POST", request);
|
|
870
947
|
}
|
|
871
948
|
|
|
872
|
-
|
|
949
|
+
// src/ontology/loadFullObjectMetadata.ts
|
|
950
|
+
async function loadAllOutgoingLinkTypes(client, objtype) {
|
|
951
|
+
const linkTypes = [];
|
|
952
|
+
let pageToken;
|
|
953
|
+
do {
|
|
954
|
+
const result = await listOutgoingLinkTypesV2(client, client.ontologyRid, objtype, {
|
|
955
|
+
pageToken
|
|
956
|
+
});
|
|
957
|
+
pageToken = result.nextPageToken;
|
|
958
|
+
linkTypes.push(...result.data);
|
|
959
|
+
} while (pageToken != null);
|
|
960
|
+
return linkTypes;
|
|
961
|
+
}
|
|
962
|
+
function makeConjureContext(client, servicePath) {
|
|
963
|
+
return {
|
|
964
|
+
baseUrl: client.stack,
|
|
965
|
+
servicePath,
|
|
966
|
+
fetchFn: client.fetch,
|
|
967
|
+
tokenProvider: async () => await client.tokenProvider()
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
async function loadFullObjectMetadata(client, objtype) {
|
|
971
|
+
const conjureCtx = makeConjureContext(client, "/ontology-metadata/api");
|
|
972
|
+
const [objectType, linkTypes, interfaceTypes, metadata] = await Promise.all([getObjectTypeV2(client, client.ontologyRid, objtype), loadAllOutgoingLinkTypes(client, objtype), listInterfaceTypes(client, client.ontologyRid, {
|
|
973
|
+
pageSize: 200,
|
|
974
|
+
preview: true
|
|
975
|
+
}), await loadAllOntologies(conjureCtx, {})]);
|
|
976
|
+
const sharedPropertyTypeMapping = await loadSptMap(conjureCtx, metadata, client.ontologyRid, objectType.rid);
|
|
977
|
+
const full = {
|
|
978
|
+
implementsInterfaces: interfaceTypes.data.map((i) => i.apiName),
|
|
979
|
+
linkTypes,
|
|
980
|
+
objectType,
|
|
981
|
+
sharedPropertyTypeMapping
|
|
982
|
+
};
|
|
983
|
+
return generatorConverters.wireObjectTypeFullMetadataToSdkObjectTypeDefinition(full, true);
|
|
984
|
+
}
|
|
985
|
+
async function loadSptMap(ctx, ontologyMetadata, ontologyRid, objectRid) {
|
|
986
|
+
const ontologyVersion = ontologyMetadata.ontologies[ontologyRid].currentOntologyVersion;
|
|
987
|
+
const body = {
|
|
988
|
+
objectTypeVersions: {
|
|
989
|
+
[objectRid]: ontologyVersion
|
|
990
|
+
},
|
|
991
|
+
linkTypeVersions: {},
|
|
992
|
+
loadRedacted: false,
|
|
993
|
+
includeObjectTypesWithoutSearchableDatasources: true
|
|
994
|
+
};
|
|
995
|
+
const entities = await loadOntologyEntities(ctx, body);
|
|
996
|
+
const objectType = entities.objectTypes[objectRid];
|
|
997
|
+
!objectType ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "object type should be loaded") : invariant2__default.default(false) : void 0;
|
|
998
|
+
const sptMap = {};
|
|
999
|
+
for (const property of Object.values(objectType.propertyTypes)) {
|
|
1000
|
+
if (property.sharedPropertyTypeApiName && property.apiName) {
|
|
1001
|
+
sptMap[property.sharedPropertyTypeApiName] = property.apiName;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
return sptMap;
|
|
1005
|
+
}
|
|
1006
|
+
async function loadInterfaceDefinition(client, objtype) {
|
|
1007
|
+
const r = await getInterfaceType(client, client.ontologyRid, objtype, {
|
|
1008
|
+
preview: true
|
|
1009
|
+
});
|
|
1010
|
+
return generatorConverters.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(r, true);
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
// src/ontology/StandardOntologyProvider.ts
|
|
1014
|
+
var alwaysRevalidateDefault = false;
|
|
1015
|
+
var createStandardOntologyProviderFactory = (client) => {
|
|
1016
|
+
const alwaysRevalidate = client.alwaysRevalidate ?? alwaysRevalidateDefault;
|
|
1017
|
+
return (client2) => {
|
|
1018
|
+
async function loadObject(client3, key, skipCache = false) {
|
|
1019
|
+
{
|
|
1020
|
+
return await loadFullObjectMetadata(client3, key);
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
async function loadInterface(client3, key, skipCache = false) {
|
|
1024
|
+
{
|
|
1025
|
+
return loadInterfaceDefinition(client3, key);
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
function makeGetter(fn) {
|
|
1029
|
+
const cache = createAsyncCache((client3, key) => fn(client3, key, false));
|
|
1030
|
+
return async (apiName) => {
|
|
1031
|
+
const n = alwaysRevalidate ? await fn(client2, apiName, true) : await cache.get(client2, apiName);
|
|
1032
|
+
if (alwaysRevalidate) {
|
|
1033
|
+
const og = cache.getOrUndefined(client2, apiName);
|
|
1034
|
+
if (deepEqual__default.default(og, n)) {
|
|
1035
|
+
return og;
|
|
1036
|
+
} else {
|
|
1037
|
+
return cache.set(client2, apiName, n);
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
return n;
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
return {
|
|
1044
|
+
getObjectDefinition: makeGetter(loadObject),
|
|
1045
|
+
getInterfaceDefinition: makeGetter(loadInterface),
|
|
1046
|
+
maybeSeed(definition) {
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
};
|
|
1050
|
+
};
|
|
1051
|
+
|
|
1052
|
+
// src/util/UserAgent.ts
|
|
1053
|
+
var USER_AGENT = `osdk-client/${"0.17.1-main-20240503171106"}`;
|
|
1054
|
+
|
|
1055
|
+
// src/createMinimalClient.ts
|
|
1056
|
+
function createMinimalClient(metadata, stack, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {
|
|
1057
|
+
if (process?.env?.NODE_ENV !== "production") {
|
|
1058
|
+
try {
|
|
1059
|
+
new URL(stack);
|
|
1060
|
+
} catch (e) {
|
|
1061
|
+
const hint = !stack.startsWith("http://") || !stack.startsWith("https://") ? ". Did you forget to add 'http://' or 'https://'?" : "";
|
|
1062
|
+
throw new Error(`Invalid stack URL: ${stack}${hint}`);
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
const clientCtx = {
|
|
1066
|
+
...shared_net.createClientContext({
|
|
1067
|
+
metadata: {
|
|
1068
|
+
...metadata,
|
|
1069
|
+
userAgent: ""
|
|
1070
|
+
// ontology specific user agent injected elsewhere
|
|
1071
|
+
}
|
|
1072
|
+
}, stack, tokenProvider, USER_AGENT, fetchFn),
|
|
1073
|
+
objectSetFactory,
|
|
1074
|
+
ontologyRid: metadata.ontologyRid,
|
|
1075
|
+
ontologyProvider: void 0,
|
|
1076
|
+
logger: options.logger
|
|
1077
|
+
};
|
|
1078
|
+
clientCtx.ontologyProvider = createStandardOntologyProviderFactory(options)(clientCtx);
|
|
1079
|
+
return clientCtx;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
// src/createClient.ts
|
|
1083
|
+
function createClientInternal(objectSetFactory, stack, ontologyRid, tokenProvider, options = void 0, fetchFn = fetch) {
|
|
1084
|
+
const clientCtx = createMinimalClient({
|
|
1085
|
+
ontologyRid
|
|
1086
|
+
}, stack, tokenProvider, options, fetchFn, objectSetFactory);
|
|
1087
|
+
function clientFn(o) {
|
|
1088
|
+
if (o.type === "object" || o.type === "interface") {
|
|
1089
|
+
clientCtx.ontologyProvider.maybeSeed(o);
|
|
1090
|
+
return objectSetFactory(o, clientCtx);
|
|
1091
|
+
} else if (o.type === "action") {
|
|
1092
|
+
clientCtx.ontologyProvider.maybeSeed(o);
|
|
1093
|
+
return createActionInvoker(clientCtx, o);
|
|
1094
|
+
} else {
|
|
1095
|
+
throw new Error("not implemented");
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
const client = Object.defineProperties(clientFn, {
|
|
1099
|
+
ctx: {
|
|
1100
|
+
value: clientCtx
|
|
1101
|
+
}
|
|
1102
|
+
});
|
|
1103
|
+
return client;
|
|
1104
|
+
}
|
|
1105
|
+
var createClient = createClientInternal.bind(void 0, createObjectSet);
|
|
1106
|
+
|
|
1107
|
+
exports.ActionValidationError = ActionValidationError;
|
|
873
1108
|
exports.augment = augment;
|
|
874
1109
|
exports.convertWireToOsdkObjects = convertWireToOsdkObjects;
|
|
875
|
-
exports.
|
|
1110
|
+
exports.createClient = createClient;
|
|
1111
|
+
exports.createClientInternal = createClientInternal;
|
|
876
1112
|
exports.createObjectSet = createObjectSet;
|
|
877
|
-
exports.getInterfaceType = getInterfaceType;
|
|
878
1113
|
exports.getObjectTypeV2 = getObjectTypeV2;
|
|
879
|
-
exports.getWireObjectSet = getWireObjectSet;
|
|
880
|
-
exports.isAttachment = isAttachment;
|
|
881
|
-
exports.isObjectSet = isObjectSet;
|
|
882
|
-
exports.isWireObjectSet = isWireObjectSet;
|
|
883
|
-
exports.listInterfaceTypes = listInterfaceTypes;
|
|
884
|
-
exports.listOutgoingLinkTypesV2 = listOutgoingLinkTypesV2;
|
|
885
1114
|
exports.loadAllOntologies = loadAllOntologies;
|
|
886
1115
|
exports.loadOntologyEntities = loadOntologyEntities;
|
|
887
1116
|
//# sourceMappingURL=out.js.map
|
|
888
|
-
//# sourceMappingURL=chunk-
|
|
1117
|
+
//# sourceMappingURL=chunk-7XXPD5VV.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../foundry/build/js/public/OntologiesV2_OntologyObjectSet.mjs","../../../foundry/build/js/public/OntologiesV2_OntologyObjectV2.mjs","../../src/util/addUserAgent.ts","../../src/object/convertWireToOsdkObjects.ts","../../src/internal/conversions/legacyToModernSingleAggregationResult.ts","../../src/internal/conversions/modernToLegacyAggregationClause.ts","../../src/query/aggregations/GroupByClause.ts","../../src/internal/conversions/modernToLegacyGroupByClause.ts","../../src/internal/conversions/modernToLegacyWhereClause.ts","../../src/query/WhereClause.ts","../../src/object/fetchSingle.ts","../../src/object/aggregate.ts","../../src/util/WireObjectSet.ts","../../src/objectSet/createObjectSet.ts","../../src/object/Attachment.ts","../../src/object/Cache.ts","../../src/object/fetchPage.ts","../../src/actions/ActionValidationError.ts","../../../foundry/build/js/public/OntologiesV2_Action.mjs","../../src/util/isOntologyObjectV2.ts","../../src/util/toDataValue.ts","../../src/actions/applyAction.ts","../../src/actions/createActionInvoker.ts","../../src/createMinimalClient.ts","../../../foundry/build/js/public/OntologiesV2_OntologyV2.mjs","../../src/ontology/StandardOntologyProvider.ts","../../../foundry/build/js/public/OntologiesV2_ObjectTypeV2.mjs","../../src/ontology/loadFullObjectMetadata.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadAllOntologies.ts","../../src/generated/ontology-metadata/api/OntologyMetadataService/loadOntologyEntities.ts","../../src/ontology/loadInterfaceDefinition.ts","../../src/util/UserAgent.ts","../../src/createClient.ts"],"names":["omniFetch","invariant","client","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","wireObjectTypeFullMetadataToSdkObjectTypeDefinition","conjureFetch"],"mappings":";AAAA,SAAS,iBAAiB;AAO1B,IAAI,mBAAmB,CAAC,GAAG,6CAA6C,CAAC;AACzE,SAAS,gBAAgB,SAAS,MAAM;AACtC,SAAO,UAAU,MAAM,kBAAkB,GAAG,IAAI;AAClD;AACA,IAAI,wBAAwB,CAAC,GAAG,2CAA2C,CAAC;AAC5E,SAAS,qBAAqB,SAAS,MAAM;AAC3C,SAAO,UAAU,MAAM,uBAAuB,GAAG,IAAI;AACvD;;;ACdA,SAAS,aAAAA,kBAAiB;AAuB1B,IAAI,sBAAsB,CAAC,GAAG,qCAAqC,CAAC;AACpE,SAAS,mBAAmB,SAAS,MAAM;AACzC,SAAOA,WAAU,MAAM,qBAAqB,GAAG,IAAI;AACrD;AACA,IAAI,oBAAoB,CAAC,GAAG,yCAAyC,CAAC;AACtE,SAAS,iBAAiB,SAAS,MAAM;AACvC,SAAOA,WAAU,MAAM,mBAAmB,GAAG,IAAI;AACnD;AACA,IAAI,6BAA6B,CAAC,GAAG,4CAA4C,CAAC;AAClF,SAAS,0BAA0B,SAAS,MAAM;AAChD,SAAOA,WAAU,MAAM,4BAA4B,GAAG,IAAI;AAC5D;;;AClBA,SAAS,gCAAgC;AAClC,SAAS,aAAa,QAAQ,cAAc;AACjD,MAAI,aAAa,cAAc;AAC7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,OAAO,yBAAyB,OAAO,OAAO,aAAW;AACvD,gBAAQ,IAAI,oBAAoB,aAAa,aAAa,cAAc;AACxE,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO;AACT;;;ACZA,OAAO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aAAO,iBAAiB,GAAG,SAAS;AAAA,IACtC,WAAW,EAAE,SAAS,UAAU;AAC9B,gBAAU,iBAAiB,UAAU,CAAC;AACtC,aAAO,oBAAoB,WAAW,CAAC;AAAA,IACzC,OAAO;AACL,YAAM,IAAI,MAAM,iBAAiB;AAAA,IACnC;AAAA,EACF;AACA,QAAM,SAAS,OAAO,iBAAiB,UAAU;AAAA,IAC/C,KAAK;AAAA,MACH,OAAO;AAAA,IACT;AAAA,EACF,CAAC;AACD,SAAO;AACT;AACO,IAAM,eAAe,qBAAqB,KAAK,QAAW,eAAe","sourcesContent":["import { omniFetch } from '@osdk/shared.net';\n\n// src/public/OntologiesV2_OntologyObjectSet.ts\nvar _getObjectSetV2 = [0, \"/v2/ontologies/{0}/objectSets/{1}\"];\nfunction getObjectSetV2($ctx, ...args) {\n return omniFetch($ctx, _getObjectSetV2, ...args);\n}\nvar _loadObjectSetV2 = [1, \"/v2/ontologies/{0}/objectSets/loadObjects\", 3];\nfunction loadObjectSetV2($ctx, ...args) {\n return omniFetch($ctx, _loadObjectSetV2, ...args);\n}\nvar _aggregateObjectSetV2 = [1, \"/v2/ontologies/{0}/objectSets/aggregate\", 3];\nfunction aggregateObjectSetV2($ctx, ...args) {\n return omniFetch($ctx, _aggregateObjectSetV2, ...args);\n}\nexport { aggregateObjectSetV2, getObjectSetV2, loadObjectSetV2 };","import { omniFetch } from '@osdk/shared.net';\n\n// src/public/OntologiesV2_OntologyObjectV2.ts\nvar _listObjectsV2 = [0, \"/v2/ontologies/{0}/objects/{1}\", 2];\nfunction listObjectsV2($ctx, ...args) {\n return omniFetch($ctx, _listObjectsV2, ...args);\n}\nvar _getObjectV2 = [0, \"/v2/ontologies/{0}/objects/{1}/{2}\", 2];\nfunction getObjectV2($ctx, ...args) {\n return omniFetch($ctx, _getObjectV2, ...args);\n}\nvar _countObjects = [1, \"/v2/ontologies/{0}/objects/{1}/count\", 2];\nfunction countObjects($ctx, ...args) {\n return omniFetch($ctx, _countObjects, ...args);\n}\nvar _searchObjectsV2 = [1, \"/v2/ontologies/{0}/objects/{1}/search\", 3];\nfunction searchObjectsV2($ctx, ...args) {\n return omniFetch($ctx, _searchObjectsV2, ...args);\n}\nvar _aggregateObjectsV2 = [1, \"/v2/ontologies/{0}/objects/{1}/aggregate\", 3];\nfunction aggregateObjectsV2($ctx, ...args) {\n return omniFetch($ctx, _aggregateObjectsV2, ...args);\n}\nvar _listInterfaceTypes = [0, \"/v2/ontologies/{0}/interfaceTypes\", 2];\nfunction listInterfaceTypes($ctx, ...args) {\n return omniFetch($ctx, _listInterfaceTypes, ...args);\n}\nvar _getInterfaceType = [0, \"/v2/ontologies/{0}/interfaceTypes/{1}\", 2];\nfunction getInterfaceType($ctx, ...args) {\n return omniFetch($ctx, _getInterfaceType, ...args);\n}\nvar _searchObjectsForInterface = [1, \"/v2/ontologies/{0}/interfaces/{1}/search\", 3];\nfunction searchObjectsForInterface($ctx, ...args) {\n return omniFetch($ctx, _searchObjectsForInterface, ...args);\n}\nvar _aggregateObjectsForInterface = [1, \"/v2/ontologies/{0}/interfaces/{1}/aggregate\", 3];\nfunction aggregateObjectsForInterface($ctx, ...args) {\n return omniFetch($ctx, _aggregateObjectsForInterface, ...args);\n}\nvar _listLinkedObjectsV2 = [0, \"/v2/ontologies/{0}/objects/{1}/{2}/links/{3}\", 2];\nfunction listLinkedObjectsV2($ctx, ...args) {\n return omniFetch($ctx, _listLinkedObjectsV2, ...args);\n}\nvar _getLinkedObjectV2 = [0, \"/v2/ontologies/{0}/objects/{1}/{2}/links/{3}/{4}\", 2];\nfunction getLinkedObjectV2($ctx, ...args) {\n return omniFetch($ctx, _getLinkedObjectV2, ...args);\n}\nvar _getAttachmentsV2 = [0, \"/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}\", 2];\nfunction getAttachmentsV2($ctx, ...args) {\n return omniFetch($ctx, _getAttachmentsV2, ...args);\n}\nvar _getAttachmentByRidV2 = [0, \"/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}/{4}\", 2];\nfunction getAttachmentByRidV2($ctx, ...args) {\n return omniFetch($ctx, _getAttachmentByRidV2, ...args);\n}\nvar _getAttachmentContentV2 = [0, \"/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}/content\", 2,, \"*/*\"];\nfunction getAttachmentContentV2($ctx, ...args) {\n return omniFetch($ctx, _getAttachmentContentV2, ...args);\n}\nvar _getAttachmentContentByRidV2 = [0, \"/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}/{4}/content\", 2,, \"*/*\"];\nfunction getAttachmentContentByRidV2($ctx, ...args) {\n return omniFetch($ctx, _getAttachmentContentByRidV2, ...args);\n}\nvar _getFirstPoint = [0, \"/v2/ontologies/{0}/objects/{1}/{2}/timeseries/{3}/firstPoint\", 2];\nfunction getFirstPoint($ctx, ...args) {\n return omniFetch($ctx, _getFirstPoint, ...args);\n}\nvar _getLastPoint = [0, \"/v2/ontologies/{0}/objects/{1}/{2}/timeseries/{3}/lastPoint\", 2];\nfunction getLastPoint($ctx, ...args) {\n return omniFetch($ctx, _getLastPoint, ...args);\n}\nvar _streamPoints = [1, \"/v2/ontologies/{0}/objects/{1}/{2}/timeseries/{3}/streamPoints\", 3,, \"*/*\"];\nfunction streamPoints($ctx, ...args) {\n return omniFetch($ctx, _streamPoints, ...args);\n}\nexport { aggregateObjectsForInterface, aggregateObjectsV2, countObjects, getAttachmentByRidV2, getAttachmentContentByRidV2, getAttachmentContentV2, getAttachmentsV2, getFirstPoint, getInterfaceType, getLastPoint, getLinkedObjectV2, getObjectV2, listInterfaceTypes, listLinkedObjectsV2, listObjectsV2, searchObjectsForInterface, searchObjectsV2, streamPoints };","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createFetchHeaderMutator } from \"@osdk/shared.net\";\nexport function addUserAgent(client, withMetadata) {\n if (withMetadata.osdkMetadata) {\n return {\n ...client,\n fetch: createFetchHeaderMutator(client.fetch, headers => {\n headers.set(\"Fetch-User-Agent\", withMetadata.osdkMetadata.extraUserAgent);\n return headers;\n })\n };\n }\n return client;\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 invariant from \"tiny-invariant\";\nimport { getWireObjectSet } from \"../objectSet/createObjectSet.js\";\nimport { Attachment } from \"./Attachment.js\";\nimport { createAsyncCache, createCache } from \"./Cache.js\";\nimport { fetchSingle } from \"./fetchSingle.js\";\nconst OriginClient = Symbol();\nconst UnderlyingObject = Symbol();\nconst InterfaceDefinitions = Symbol();\nclass LinkFetcherProxyHandler {\n constructor(objDef, primaryKey, client) {\n this.objDef = objDef;\n this.primaryKey = primaryKey;\n this.client = client;\n }\n get(_target, p) {\n const linkDef = this.objDef.links[p];\n if (linkDef == null) {\n return;\n }\n const objectSet = this.client.objectSetFactory(this.objDef, this.client).where({\n [this.objDef.primaryKeyApiName]: this.primaryKey\n }).pivotTo(p);\n if (!linkDef.multiplicity) {\n return {\n get: options => fetchSingle(this.client, this.objDef, options ?? {}, getWireObjectSet(objectSet))\n };\n } else {\n return objectSet;\n }\n }\n ownKeys() {\n return Object.keys(this.objDef.links);\n }\n getOwnPropertyDescriptor(target, p) {\n return {\n enumerable: true,\n configurable: true,\n get: () => {\n return this.get(target, p);\n }\n };\n }\n}\nfunction createPrototype(objDef, client) {\n if (process.env.NODE_ENV !== \"production\") {\n !(objDef.type === \"object\") ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Expected object definition\") : invariant(false) : void 0;\n }\n const sharedPropertyDefs = {\n $as: {\n value: $as\n }\n };\n // we can get away with a single interface proto\n const interfaceProto = Object.defineProperties({}, sharedPropertyDefs);\n const objectProto = Object.defineProperties({}, {\n $link: {\n get: function () {\n return new Proxy({}, new LinkFetcherProxyHandler(objDef, this[\"$primaryKey\"], client));\n }\n },\n ...sharedPropertyDefs\n });\n\n // We use the exact same logic for both the interface rep and the underlying rep\n function $as(newDef) {\n if (typeof newDef === \"string\") {\n if (newDef === objDef.apiName) {\n return this[UnderlyingObject];\n }\n const def = objDef[InterfaceDefinitions][newDef];\n if (!def) {\n throw new Error(`Object does not implement interface '${newDef}'.`);\n }\n newDef = def;\n } else if (newDef.apiName === objDef.apiName) {\n return this[UnderlyingObject];\n }\n if (newDef.type !== \"interface\" && newDef.apiName !== this.$apiName) {\n throw new Error(`'${newDef.apiName}' is not an interface of '${this.$objectType}'.`);\n }\n const underlying = this[UnderlyingObject];\n const common = {\n enumerable: true,\n configurable: true\n };\n\n // if we use a proxy here instead we can probably pull off interfaces reflecting the underlying object even if its updated\n\n // we are defining every time because it creates properties in the exact same order\n // keeping the meta classes down to one per interface/objecttype pair\n return Object.create(interfaceProto, {\n $apiName: {\n value: newDef.apiName,\n ...common\n },\n $objectType: {\n value: objDef.apiName,\n ...common\n },\n $primaryKey: {\n value: this[\"$primaryKey\"],\n ...common\n },\n ...Object.fromEntries(Object.keys(newDef.properties).map(p => {\n const value = underlying[objDef.spts[p]];\n return [p, {\n value,\n enumerable: value !== undefined\n }];\n })),\n [UnderlyingObject]: {\n value: underlying\n }\n });\n }\n return objectProto;\n}\n\n// preprocess the ontology definition to more quickly apply object conversions when needed\nfunction createConverter(objDef) {\n const steps = [];\n for (const [key, value] of Object.entries(objDef.properties)) {\n // attachments need a wrapper to provide functionality and to identify them at serialization time\n if (value.type === \"attachment\") {\n steps.push(o => {\n if (o[key] != null) {\n if (Array.isArray(o[key])) {\n o[key] = o[key].map(a => new Attachment(a.rid));\n } else {\n o[key] = new Attachment(o[key].rid);\n }\n }\n });\n }\n }\n return steps.length > 0 ? o => {\n for (const step of steps) {\n step(o);\n }\n } : undefined;\n}\nconst protoConverterCache = createCache((client, objectDef) => {\n const proto = createPrototype(objectDef, client);\n const converter = createConverter(objectDef);\n return [proto, converter];\n});\nconst isAfterFeb2024OrNewApis = false;\n\n/**\n * If interfaceApiName is not undefined, converts the instances of the\n * interface into their respective\n * underlying concrete types and then returns the $as() representation\n * for the consumers.\n *\n * Otherwise just does the conversion\n *\n * May mutate in place for performance reasons. If you need a clean copy,\n * keep it first.\n *\n * However, you must use the returned value, which will be whatever is correct.\n *\n * @internal\n * @param interfaceApiName - if undefined\n */\nexport async function convertWireToOsdkObjects(client, objects, interfaceApiName, forceRemoveRid = false) {\n if (forceRemoveRid) {\n for (const obj of objects) {\n delete obj.__rid;\n }\n }\n fixObjectPropertiesInline(objects);\n\n /*\n We need to create a local cache for the life of this function.\n Because the user may have their global cache set to \"alwaysRevalidate\",\n we want to be able to avoid making N calls to load object/interface information.\n Our local cache will delegate to the global one but since it also caches,\n we can short circuit the `alwaysRevalidate` logic.\n This tradeoff is slightly less accurate than `alwaysRevalidate` but is close\n enough given we got back objects at T-3 and if the types are inconsistent for\n T-2 and T-1, then they are guarenteed wrong for T-3. No matter what\n the user will get a failure case here. So we avoid the extra work.\n */\n const localObjectCache = createLocalObjectCacheAndInitiatePreseed(objects, client);\n for (const obj of objects) {\n const objectDef = await localObjectCache.get(client, obj.$apiName);\n if (objectDef == null) {\n throw new Error(`Failed to find ontology definition for '${obj.$apiName}'`);\n }\n if (interfaceApiName !== undefined) {\n // API returns interface spt names but we cache by real values\n for (const [sptProp, regularProp] of Object.entries(objectDef.spts)) {\n if (sptProp in obj) {\n const value = obj[sptProp];\n delete obj[sptProp];\n if (value !== undefined) {\n obj[regularProp] = value;\n }\n }\n }\n }\n internalConvertObjectInPlace(objectDef, client, obj);\n }\n if (interfaceApiName) {\n return objects.map(o => o.$as(interfaceApiName));\n } else {\n // we did the conversion so we can cast\n return objects;\n }\n}\nfunction createLocalObjectCacheAndInitiatePreseed(objects, client) {\n // local cache delegates to the global one\n const localInterfaceCache = createAsyncCache((client, apiName) => client.ontologyProvider.getInterfaceDefinition(apiName));\n const localObjectCache = createAsyncCache(async (client, apiName) => {\n // first delegate to the global cache\n const objectDef = await client.ontologyProvider.getObjectDefinition(apiName);\n\n // ensure we have all of the interfaces loaded\n const interfaceDefs = Object.fromEntries((await Promise.all(objectDef.implements?.map(i => localInterfaceCache.get(client, i)) ?? [])).map(i => [i.apiName, i]));\n\n // save interfaces for later if not the first time\n if (objectDef[InterfaceDefinitions] == null) {\n Object.defineProperty(objectDef, InterfaceDefinitions, {\n value: interfaceDefs,\n enumerable: false,\n configurable: false,\n writable: false\n });\n }\n return objectDef;\n });\n const uniqueApiNames = new Set();\n for (const {\n $apiName\n } of objects) {\n if (uniqueApiNames.has($apiName)) continue;\n uniqueApiNames.add($apiName);\n // preseed the object cache without blocking\n // N.B localObjectCache will preseed the interface cache\n localObjectCache.get(client, $apiName);\n }\n return localObjectCache;\n}\nfunction fixObjectPropertiesInline(objs) {\n for (const obj of objs) {\n if (obj.__rid) {\n obj.$rid = obj.__rid;\n delete obj.__rid;\n }\n\n // Backend returns as __apiName but we want to stick to $ structure\n obj.$apiName = obj.__apiName;\n\n // for now these are the same but when we start doing interface projections the $objectType will always be underlying and\n // the $apiName will be for the current view (in current designs)\n obj.$objectType = obj.__apiName;\n\n // copying over for now as its always returned. In the future, this should just be inferred from underlying\n obj.$primaryKey = obj.__primaryKey;\n\n // After Feb 2024 (unless we have new apis):\n if (isAfterFeb2024OrNewApis) {\n delete obj.__apiName;\n delete obj.__primaryKey;\n } else {\n // Hide these from things like `console.log` so that people\n // don't think to use them.\n Object.defineProperties(obj, {\n \"__apiName\": {\n enumerable: false\n },\n \"__primaryKey\": {\n enumerable: false\n }\n });\n }\n }\n}\nfunction internalConvertObjectInPlace(objectDef, client, obj) {\n const [proto, converter] = protoConverterCache.get(client, objectDef);\n Object.setPrototypeOf(obj, proto);\n Object.defineProperties(obj, {\n [OriginClient]: {\n value: client\n },\n [UnderlyingObject]: {\n value: obj\n }\n });\n if (converter) {\n converter(obj);\n }\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 invariant from \"tiny-invariant\";\nexport function legacyToModernSingleAggregationResult(entry) {\n return entry.metrics.reduce((accumulator, curValue) => {\n const parts = curValue.name.split(\".\");\n if (parts[0] === \"count\") {\n return accumulator;\n }\n !(parts.length === 2) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"assumed we were getting a `${key}.${type}`\") : invariant(false) : void 0;\n if (!(parts[0] in accumulator)) {\n accumulator[parts[0]] = {};\n }\n accumulator[parts[0]][parts[1]] = curValue.value;\n return accumulator;\n }, {});\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 modernToLegacyAggregationClause(select) {\n return Object.entries(select).flatMap(([k, v]) => {\n if (k === \"$count\") {\n if (v) return {\n type: \"count\",\n name: \"count\"\n };\n return [];\n } else if (Array.isArray(v)) {\n return v.map(v2 => {\n return {\n type: v2,\n name: `${k}.${v2}`,\n field: k\n };\n });\n } else {\n return [{\n type: v,\n // FIXME v has additional possible values\n name: `${k}.${v}`,\n field: k\n }];\n }\n });\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 const DurationMapping = {\n \"sec\": \"SECONDS\",\n \"seconds\": \"SECONDS\",\n \"min\": \"MINUTES\",\n \"minute\": \"MINUTES\",\n \"minutes\": \"MINUTES\",\n \"hr\": \"HOURS\",\n \"hrs\": \"HOURS\",\n \"hour\": \"HOURS\",\n \"hours\": \"HOURS\",\n \"day\": \"DAYS\",\n \"days\": \"DAYS\",\n \"wk\": \"WEEKS\",\n \"week\": \"WEEKS\",\n \"weeks\": \"WEEKS\",\n \"mos\": \"MONTHS\",\n \"month\": \"MONTHS\",\n \"months\": \"MONTHS\",\n \"yr\": \"YEARS\",\n \"year\": \"YEARS\",\n \"years\": \"YEARS\",\n \"quarter\": \"QUARTERS\",\n \"quarters\": \"QUARTERS\"\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 { DurationMapping } from \"../../query/aggregations/GroupByClause.js\";\nexport function modernToLegacyGroupByClause(groupByClause) {\n if (!groupByClause) return [];\n return Object.entries(groupByClause).flatMap(([field, type]) => {\n if (type === \"exact\") {\n return [{\n type,\n field\n }];\n } else if (\"exactWithLimit\" in type) {\n {\n return [{\n type: \"exact\",\n field,\n maxGroupCount: type.exactWithLimit\n }];\n }\n } else if (\"fixedWidth\" in type) {\n return [{\n type: \"fixedWidth\",\n field,\n fixedWidth: type.fixedWidth\n }];\n } else if (\"ranges\" in type) {\n return [{\n type: \"ranges\",\n field,\n ranges: type.ranges.map(range => convertRange(range))\n }];\n } else if (\"duration\" in type) {\n return [{\n type: \"duration\",\n field,\n value: type.duration[0],\n unit: DurationMapping[type.duration[1]]\n }];\n } else return [];\n });\n}\nfunction convertRange(range) {\n return {\n startValue: range[0],\n endValue: range[1]\n };\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 invariant from \"tiny-invariant\";\nimport { DistanceUnitMapping } from \"../../query/WhereClause.js\";\nexport function modernToLegacyWhereClause(whereClause) {\n if (\"$and\" in whereClause) {\n return {\n type: \"and\",\n value: whereClause.$and.map(modernToLegacyWhereClause)\n };\n } else if (\"$or\" in whereClause) {\n return {\n type: \"or\",\n value: whereClause.$or.map(modernToLegacyWhereClause)\n };\n } else if (\"$not\" in whereClause) {\n return {\n type: \"not\",\n value: modernToLegacyWhereClause(whereClause.$not)\n };\n }\n const parts = Object.entries(whereClause);\n if (parts.length === 1) {\n return handleWherePair(parts[0]);\n }\n return {\n type: \"and\",\n value: parts.map(handleWherePair)\n };\n}\nfunction makeGeoFilterBbox(field, bbox, filterType) {\n return {\n type: filterType === \"$within\" ? \"withinBoundingBox\" : \"intersectsBoundingBox\",\n field,\n value: {\n topLeft: {\n type: \"Point\",\n coordinates: [bbox[0], bbox[3]]\n },\n bottomRight: {\n type: \"Point\",\n coordinates: [bbox[2], bbox[1]]\n }\n }\n };\n}\nfunction makeGeoFilterPolygon(field, coordinates, filterType) {\n return {\n type: filterType,\n field,\n value: {\n type: \"Polygon\",\n coordinates\n }\n };\n}\nfunction handleWherePair([field, filter]) {\n !(filter != null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Defined key values are only allowed when they are not undefined.\") : invariant(false) : void 0;\n if (typeof filter === \"string\" || typeof filter === \"number\" || typeof filter === \"boolean\") {\n return {\n type: \"eq\",\n field,\n value: filter\n };\n }\n const keysOfFilter = Object.keys(filter);\n\n // If any of the keys start with `$` then they must be the only one.\n // e.g. `where({ name: { $eq: \"foo\", $ne: \"bar\" } })` is invalid currently\n const hasDollarSign = keysOfFilter.some(key => key.startsWith(\"$\"));\n !(!hasDollarSign || keysOfFilter.length === 1) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"WhereClause Filter with multiple clauses isn't allowed\") : invariant(false) : void 0;\n if (!hasDollarSign) {\n // Future case for structs\n throw new Error(`Unsupported filter. Did you forget to use a $-prefixed filter? (${JSON.stringify(filter)})`);\n }\n const firstKey = keysOfFilter[0];\n !(filter[firstKey] != null) ? process.env.NODE_ENV !== \"production\" ? invariant(false) : invariant(false) : void 0;\n if (firstKey === \"$ne\") {\n return {\n type: \"not\",\n value: {\n type: \"eq\",\n field,\n value: filter[firstKey]\n }\n };\n }\n if (firstKey === \"$within\") {\n const withinBody = filter[firstKey];\n if (Array.isArray(withinBody)) {\n return makeGeoFilterBbox(field, withinBody, firstKey);\n } else if (\"bbox\" in withinBody && !(\"type\" in withinBody)) {\n return makeGeoFilterBbox(field, withinBody.bbox, firstKey);\n } else if (\"distance\" in withinBody && \"of\" in withinBody) {\n return {\n type: \"withinDistanceOf\",\n field,\n value: {\n center: Array.isArray(withinBody.of) ? {\n type: \"Point\",\n coordinates: withinBody.of\n } : withinBody.of,\n distance: {\n value: withinBody.distance[0],\n unit: DistanceUnitMapping[withinBody.distance[1]]\n }\n }\n };\n } else {\n const coordinates = \"polygon\" in withinBody ? withinBody.polygon : withinBody.coordinates;\n return makeGeoFilterPolygon(field, coordinates, \"withinPolygon\");\n }\n }\n if (firstKey === \"$intersects\") {\n const intersectsBody = filter[firstKey];\n if (Array.isArray(intersectsBody)) {\n return makeGeoFilterBbox(field, intersectsBody, firstKey);\n } else if (\"bbox\" in intersectsBody && !(\"type\" in intersectsBody)) {\n return makeGeoFilterBbox(field, intersectsBody.bbox, firstKey);\n } else {\n const coordinates = \"polygon\" in intersectsBody ? intersectsBody.polygon : intersectsBody.coordinates;\n return makeGeoFilterPolygon(field, coordinates, \"intersectsPolygon\");\n }\n }\n return {\n type: firstKey.substring(1),\n field,\n value: filter[firstKey]\n };\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\n// We need to conditional here to force the union to be distributed\n\nexport const DistanceUnitMapping = {\n \"centimeter\": \"CENTIMETERS\",\n \"centimeters\": \"CENTIMETERS\",\n \"cm\": \"CENTIMETERS\",\n \"meter\": \"METERS\",\n \"meters\": \"METERS\",\n \"m\": \"METERS\",\n \"kilometer\": \"KILOMETERS\",\n \"kilometers\": \"KILOMETERS\",\n \"km\": \"KILOMETERS\",\n \"inch\": \"INCHES\",\n \"inches\": \"INCHES\",\n \"foot\": \"FEET\",\n \"feet\": \"FEET\",\n \"yard\": \"YARDS\",\n \"yards\": \"YARDS\",\n \"mile\": \"MILES\",\n \"miles\": \"MILES\",\n \"nautical_mile\": \"NAUTICAL_MILES\",\n \"nauticalMile\": \"NAUTICAL_MILES\",\n \"nautical miles\": \"NAUTICAL_MILES\"\n};\n\n// FIXME we need to represent all types","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { PalantirApiError } from \"@osdk/shared.net\";\nimport { fetchPage } from \"./fetchPage.js\";\nexport async function fetchSingle(client, objectType, args, objectSet) {\n const result = await fetchPage(client, objectType, {\n ...args,\n pageSize: 1\n }, objectSet);\n if (result.data.length !== 1 || result.nextPageToken != null) {\n throw new PalantirApiError(`Expected a single result but got ${result.data.length} instead${result.nextPageToken != null ? \" with nextPageToken set\" : \"\"}`);\n }\n return result.data[0];\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 { aggregateObjectSetV2 } from \"@osdk/foundry/OntologiesV2_OntologyObjectSet\";\nimport invariant from \"tiny-invariant\";\nimport { legacyToModernSingleAggregationResult, modernToLegacyAggregationClause, modernToLegacyGroupByClause, modernToLegacyWhereClause } from \"../internal/conversions/index.js\";\nimport { addUserAgent } from \"../util/addUserAgent.js\";\n/** @deprecated use `aggregate` */\nexport async function aggregateOrThrow(clientCtx, objectType, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"]\n}, req) {\n return aggregate(clientCtx, objectType, objectSet, req);\n}\nexport async function aggregate(clientCtx, objectType, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"]\n}, req) {\n const body = {\n aggregation: modernToLegacyAggregationClause(req.select),\n groupBy: [],\n where: undefined\n };\n if (req.groupBy) {\n body.groupBy = modernToLegacyGroupByClause(req.groupBy);\n }\n if (req.where) {\n body.where = modernToLegacyWhereClause(req.where);\n }\n const result = await aggregateObjectSetV2(addUserAgent(clientCtx, objectType), clientCtx.ontologyRid, {\n objectSet,\n groupBy: body.groupBy,\n aggregation: body.aggregation\n });\n if (!req.groupBy) {\n !(result.data.length === 1) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"no group by clause should mean only one data result\") : invariant(false) : void 0;\n return {\n ...aggregationToCountResult(result.data[0]),\n ...legacyToModernSingleAggregationResult(result.data[0])\n };\n }\n const ret = result.data.map(entry => {\n return {\n $group: entry.group,\n ...aggregationToCountResult(entry),\n ...legacyToModernSingleAggregationResult(entry)\n };\n }); // fixme\n\n return ret; // FIXME\n}\nfunction aggregationToCountResult(entry) {\n for (const aggregateResult of entry.metrics) {\n if (aggregateResult.name === \"count\") {\n return {\n $count: aggregateResult.value\n };\n }\n }\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\nconst WIRE_OBJECT_SET_TYPES = new Set([\"base\", \"filter\", \"intersect\", \"reference\", \"searchAround\", \"static\", \"subtract\", \"union\"]);\nexport function isWireObjectSet(o) {\n return o != null && typeof o === \"object\" && WIRE_OBJECT_SET_TYPES.has(o.type);\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 { modernToLegacyWhereClause } from \"../internal/conversions/index.js\";\nimport { convertWireToOsdkObjects } from \"../object/convertWireToOsdkObjects.js\";\nimport { fetchPageInternal, fetchPageWithErrorsInternal } from \"../object/fetchPage.js\";\nimport { fetchSingle } from \"../object/fetchSingle.js\";\nimport { aggregate } from \"../object/index.js\";\nimport { isWireObjectSet } from \"../util/WireObjectSet.js\";\nfunction isObjectTypeDefinition(def) {\n return def.type === \"object\";\n}\nexport function isObjectSet(o) {\n return o != null && typeof o === \"object\" && isWireObjectSet(objectSetDefinitions.get(o));\n}\n\n/** @internal */\nexport function getWireObjectSet(objectSet) {\n return objectSetDefinitions.get(objectSet);\n}\nconst objectSetDefinitions = new WeakMap();\nexport function createObjectSet(objectType, clientCtx, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"]\n}) {\n const base = {\n aggregate: aggregate.bind(globalThis, clientCtx, objectType, objectSet),\n fetchPage: fetchPageInternal.bind(globalThis, clientCtx, objectType, objectSet),\n fetchPageWithErrors: fetchPageWithErrorsInternal.bind(globalThis, clientCtx, objectType, objectSet),\n where: clause => {\n return clientCtx.objectSetFactory(objectType, clientCtx, {\n type: \"filter\",\n objectSet: objectSet,\n where: modernToLegacyWhereClause(clause)\n });\n },\n pivotTo: function (type) {\n return createSearchAround(type)();\n },\n union: (...objectSets) => {\n return clientCtx.objectSetFactory(objectType, clientCtx, {\n type: \"union\",\n objectSets: [objectSet, ...objectSets.map(os => objectSetDefinitions.get(os))]\n });\n },\n intersect: (...objectSets) => {\n return clientCtx.objectSetFactory(objectType, clientCtx, {\n type: \"intersect\",\n objectSets: [objectSet, ...objectSets.map(os => objectSetDefinitions.get(os))]\n });\n },\n subtract: (...objectSets) => {\n return clientCtx.objectSetFactory(objectType, clientCtx, {\n type: \"subtract\",\n objectSets: [objectSet, ...objectSets.map(os => objectSetDefinitions.get(os))]\n });\n },\n asyncIter: async function* () {\n let nextPageToken = undefined;\n do {\n const result = await base.fetchPage({\n nextPageToken\n });\n for (const obj of await convertWireToOsdkObjects(clientCtx, result.data, undefined)) {\n yield obj;\n }\n } while (nextPageToken != null);\n },\n get: isObjectTypeDefinition(objectType) ? async (primaryKey, options) => {\n const withPk = {\n type: \"filter\",\n objectSet: objectSet,\n where: {\n type: \"eq\",\n field: objectType.primaryKeyApiName,\n value: primaryKey\n }\n };\n return await fetchSingle(clientCtx, objectType, options, withPk);\n } : undefined\n };\n function createSearchAround(link) {\n return () => {\n return clientCtx.objectSetFactory(objectType, clientCtx, {\n type: \"searchAround\",\n objectSet,\n link\n });\n };\n }\n objectSetDefinitions.set(base, objectSet);\n return base;\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 class Attachment {\n constructor(rid) {\n this.rid = rid;\n }\n}\nexport function isAttachment(o) {\n return o instanceof Attachment;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A simple cache that can be used to store values for a given client.\n */\n\n/**\n * A simple async cache that can be used to store values for a given client.\n */\n\n/**\n * Create a new cache without a factory function.\n */\n\n/**\n * Create a new cache with a factory function.\n * @param fn A factory function that will be used to create the value if it does not exist in the cache.\n */\n\nexport function createCache(fn) {\n // Given the way some consumers may use this, we may want to cache by\n // stack + ontologyApiName instead of the client object itself.\n const cache = new WeakMap();\n function get(client, key) {\n if (cache.get(client) == null) {\n cache.set(client, new Map());\n }\n let r = cache.get(client).get(key);\n if (r === undefined && fn !== undefined) {\n return set(client, key, fn(client, key));\n } else {\n return r;\n }\n }\n function set(client, key, value) {\n if (cache.get(client) == null) {\n cache.set(client, new Map());\n }\n cache.get(client).set(key, value);\n return value;\n }\n function remove(client, key) {\n if (cache.get(client) == null) return false;\n return cache.get(client).delete(key);\n }\n return {\n get,\n set,\n remove\n };\n}\n\n/**\n * Create a new cache with an async factory function.\n * @param fn A factory function that will be used to create the value if it does not exist in the cache.\n * @returns\n */\nexport function createAsyncCache(fn, createCacheLocal = createCache) {\n const cache = createCacheLocal();\n const inProgress = createCacheLocal();\n const ret = {\n getOrUndefined: function getOrUndefined(client, key) {\n return cache.get(client, key);\n },\n get: async function get(client, key) {\n return cache.get(client, key) ?? inProgress.get(client, key) ?? ret.set(client, key, fn(client, key));\n },\n set: async function set(client, k, v) {\n // the `.set` happens first to prevent races.\n try {\n const r = await inProgress.set(client, k, v); // returns v\n\n cache.set(client, k, r);\n inProgress.remove(client, k);\n return r;\n } catch (e) {\n // we don't want to cache failures\n inProgress.remove(client, k);\n throw e;\n }\n }\n };\n return ret;\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 { loadObjectSetV2 } from \"@osdk/foundry/OntologiesV2_OntologyObjectSet\";\nimport { searchObjectsForInterface } from \"@osdk/foundry/OntologiesV2_OntologyObjectV2\";\nimport { addUserAgent } from \"../util/addUserAgent.js\";\nimport { convertWireToOsdkObjects } from \"./convertWireToOsdkObjects.js\";\nexport function augment(type, ...properties) {\n return {\n [type.apiName]: properties\n };\n}\n/** @internal */\nexport function objectSetToSearchJsonV2(objectSet, expectedApiName, existingWhere = undefined) {\n if (objectSet.type === \"base\") {\n if (objectSet.objectType !== expectedApiName) {\n throw new Error(`Expected objectSet.objectType to be ${expectedApiName}, but got ${objectSet.objectType}`);\n }\n return existingWhere;\n }\n if (objectSet.type === \"filter\") {\n return objectSetToSearchJsonV2(objectSet.objectSet, expectedApiName, existingWhere == null ? objectSet.where : {\n type: \"and\",\n value: [existingWhere, objectSet.where]\n });\n }\n throw new Error(`Unsupported objectSet type: ${objectSet.type}`);\n}\nasync function fetchInterfacePage(client, interfaceType, args, objectSet) {\n const result = await searchObjectsForInterface(addUserAgent(client, interfaceType), client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {\n augmentedProperties: args.augment ?? {},\n augmentedSharedPropertyTypes: {},\n otherInterfaceTypes: [],\n selectedObjectTypes: [],\n selectedSharedPropertyTypes: args.select ?? [],\n where: objectSetToSearchJsonV2(objectSet, interfaceType.apiName)\n }), {\n preview: true\n });\n result.data = await convertWireToOsdkObjects(client, result.data,\n // drop readonly\n interfaceType.apiName, !args.includeRid);\n return result;\n}\n\n/** @internal */\nexport async function fetchPageInternal(client, objectType, objectSet, args = {}) {\n if (objectType.type === \"interface\") {\n return await fetchInterfacePage(client, objectType, args, objectSet); // fixme\n } else {\n return await fetchObjectPage(client, objectType, args, objectSet); // fixme\n }\n}\n\n/** @internal */\nexport async function fetchPageWithErrorsInternal(client, objectType, objectSet, args = {}) {\n try {\n const result = await fetchPageInternal(client, objectType, objectSet, args);\n return {\n value: result\n };\n } catch (e) {\n if (e instanceof Error) {\n return {\n error: e\n };\n }\n return {\n error: e\n };\n }\n}\nexport async function fetchPage(client, objectType, args, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"]\n}) {\n return fetchPageInternal(client, objectType, objectSet, args);\n}\nexport async function fetchPageWithErrors(client, objectType, args, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"]\n}) {\n return fetchPageWithErrorsInternal(client, objectType, objectSet, args);\n}\nfunction applyFetchArgs(args, body) {\n if (args?.nextPageToken) {\n body.pageToken = args.nextPageToken;\n }\n if (args?.pageSize != null) {\n body.pageSize = args.pageSize;\n }\n if (args?.orderBy != null) {\n body.orderBy = {\n fields: Object.entries(args.orderBy).map(([field, direction]) => ({\n field,\n direction\n }))\n };\n }\n return body;\n}\nexport async function fetchObjectPage(client, objectType, args, objectSet) {\n const r = await loadObjectSetV2(addUserAgent(client, objectType), client.ontologyRid, applyFetchArgs(args, {\n objectSet,\n // We have to do the following case because LoadObjectSetRequestV2 isnt readonly\n select: args?.select ?? [],\n // FIXME?\n excludeRid: !args?.includeRid\n }));\n return Promise.resolve({\n data: await convertWireToOsdkObjects(client, r.data, undefined),\n nextPageToken: r.nextPageToken\n });\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 class ActionValidationError extends Error {\n constructor(validation) {\n super(\"Validation Error\");\n this.validation = validation;\n }\n}","import { omniFetch } from '@osdk/shared.net';\n\n// src/public/OntologiesV2_Action.ts\nvar _applyActionV2 = [1, \"/v2/ontologies/{0}/actions/{1}/apply\", 3];\nfunction applyActionV2($ctx, ...args) {\n return omniFetch($ctx, _applyActionV2, ...args);\n}\nvar _applyActionBatchV2 = [1, \"/v2/ontologies/{0}/actions/{1}/applyBatch\", 3];\nfunction applyActionBatchV2($ctx, ...args) {\n return omniFetch($ctx, _applyActionBatchV2, ...args);\n}\nvar _applyActionAsyncV2 = [1, \"/v2/ontologies/{0}/actions/{1}/applyAsync\", 3];\nfunction applyActionAsyncV2($ctx, ...args) {\n return omniFetch($ctx, _applyActionAsyncV2, ...args);\n}\nexport { applyActionAsyncV2, applyActionBatchV2, applyActionV2 };","/*\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 isOntologyObjectV2(o) {\n return o && typeof o === \"object\" && typeof o.__apiName === \"string\" && o.__primaryKey != null;\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 { isAttachment } from \"../object/Attachment.js\";\nimport { getWireObjectSet, isObjectSet } from \"../objectSet/createObjectSet.js\";\nimport { isOntologyObjectV2 } from \"./isOntologyObjectV2.js\";\nimport { isWireObjectSet } from \"./WireObjectSet.js\";\n\n/**\n * Marshall user-facing data into the wire DataValue type\n *\n * @see DataValue for the expected payloads\n */\nexport function toDataValue(value) {\n if (value == null) {\n // typeof null is 'object' so do this first\n return value;\n }\n\n // arrays and sets are both sent over the wire as arrays\n if (Array.isArray(value) || value instanceof Set) {\n return Array.from(value, toDataValue);\n }\n\n // attachments just send the rid directly\n if (isAttachment(value)) {\n return value.rid;\n }\n\n // objects just send the JSON'd primaryKey\n if (isOntologyObjectV2(value)) {\n return toDataValue(value.__primaryKey);\n }\n\n // object set (the rid as a string (passes through the last return), or the ObjectSet definition directly)\n if (isWireObjectSet(value)) {\n return value;\n }\n if (isObjectSet(value)) {\n return getWireObjectSet(value);\n }\n\n // TODO (during queries implementation)\n // two dimensional aggregation\n // three dimensional aggregation\n\n // struct\n if (typeof value === \"object\") {\n return Object.entries(value).reduce((acc, [key, structValue]) => {\n acc[key] = toDataValue(structValue);\n return acc;\n }, {});\n }\n\n // expected to pass through - boolean, byte, date, decimal, float, double, integer, long, short, string, timestamp\n return value;\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 { applyActionV2 } from \"@osdk/foundry/OntologiesV2_Action\";\nimport { addUserAgent } from \"../util/addUserAgent.js\";\nimport { toDataValue } from \"../util/toDataValue.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\n\n// cannot specify both validateOnly and returnEdits as true\n\nexport async function applyAction(client, action, parameters, options = {}) {\n const response = await applyActionV2(addUserAgent(client, action), client.ontologyRid, action.apiName, {\n parameters: remapActionParams(parameters),\n options: {\n mode: options?.validateOnly ? \"VALIDATE_ONLY\" : \"VALIDATE_AND_EXECUTE\",\n returnEdits: options?.returnEdits ? \"ALL\" : \"NONE\"\n }\n });\n if (options?.validateOnly) {\n return response.validation;\n }\n if (response.validation?.result === \"INVALID\") {\n throw new ActionValidationError(response.validation);\n }\n return options?.returnEdits ? response.edits : undefined;\n}\nfunction remapActionParams(params) {\n if (params == null) {\n return {};\n }\n const parameterMap = {};\n const remappedParams = Object.entries(params).reduce((acc, [key, value]) => {\n acc[key] = toDataValue(value);\n return acc;\n }, parameterMap);\n return remappedParams;\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 { applyAction } from \"./applyAction.js\";\nexport function createActionInvoker(client, action) {\n return function (...args) {\n return applyAction(client, action, ...args);\n };\n}\nexport function createOldActionInvoker(client, ontology) {\n const proxy = new Proxy({}, {\n get: (_target, p, _receiver) => {\n if (typeof p === \"string\") {\n return createActionInvoker(client, ontology.actions[p]);\n }\n return undefined;\n },\n ownKeys(_target) {\n return Object.keys(ontology.actions);\n },\n getOwnPropertyDescriptor(_target, p) {\n if (typeof p === \"string\") {\n return {\n enumerable: ontology.actions[p] != null,\n configurable: true,\n value: proxy[p]\n };\n }\n }\n });\n return proxy;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createClientContext } from \"@osdk/shared.net\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { createStandardOntologyProviderFactory } from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\nexport function createMinimalClient(metadata, stack, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {\n if (process?.env?.NODE_ENV !== \"production\") {\n try {\n new URL(stack);\n } catch (e) {\n const hint = !stack.startsWith(\"http://\") || !stack.startsWith(\"https://\") ? \". Did you forget to add 'http://' or 'https://'?\" : \"\";\n throw new Error(`Invalid stack URL: ${stack}${hint}`);\n }\n }\n const clientCtx = {\n ...createClientContext({\n metadata: {\n ...metadata,\n userAgent: \"\" // ontology specific user agent injected elsewhere\n }\n }, stack, tokenProvider, USER_AGENT, fetchFn),\n objectSetFactory,\n ontologyRid: metadata.ontologyRid,\n ontologyProvider: undefined,\n logger: options.logger\n };\n clientCtx.ontologyProvider = createStandardOntologyProviderFactory(options)(clientCtx);\n return clientCtx;\n}","import { omniFetch } from '@osdk/shared.net';\n\n// src/public/OntologiesV2_OntologyV2.ts\nvar _listOntologiesV2 = [0, \"/v2/ontologies\"];\nfunction listOntologiesV2($ctx, ...args) {\n return omniFetch($ctx, _listOntologiesV2, ...args);\n}\nvar _getOntologyV2 = [0, \"/v2/ontologies/{0}\"];\nfunction getOntologyV2($ctx, ...args) {\n return omniFetch($ctx, _getOntologyV2, ...args);\n}\nvar _getOntologyFullMetadata = [0, \"/v2/ontologies/{0}/fullMetadata\"];\nfunction getOntologyFullMetadata($ctx, ...args) {\n return omniFetch($ctx, _getOntologyFullMetadata, ...args);\n}\nexport { getOntologyFullMetadata, getOntologyV2, listOntologiesV2 };","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { listInterfaceTypes } from \"@osdk/foundry/OntologiesV2_OntologyObjectV2\";\nimport { getOntologyFullMetadata } from \"@osdk/foundry/OntologiesV2_OntologyV2\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition, wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from \"@osdk/generator-converters\";\nimport deepEqual from \"fast-deep-equal\";\nimport { createAsyncCache } from \"../object/Cache.js\";\nimport { loadFullObjectMetadata } from \"./loadFullObjectMetadata.js\";\nimport { loadInterfaceDefinition } from \"./loadInterfaceDefinition.js\";\nconst alwaysRevalidateDefault = false;\n\n// SLLLLLLOOOOOOOWWWW\nasync function fullOntologyLoad(client) {\n return await Promise.all([listInterfaceTypes(client, client.ontologyRid, {\n pageSize: 200,\n preview: true\n }), getOntologyFullMetadata(client, client.ontologyRid)]);\n}\nexport const USE_FULL_ONTOLOGY = false;\nexport const createStandardOntologyProviderFactory = client => {\n const alwaysRevalidate = client.alwaysRevalidate ?? alwaysRevalidateDefault;\n return client => {\n let fullCache;\n async function initLocalCache(client, skipCache) {\n if (skipCache) {\n return await fullOntologyLoad(client);\n }\n if (!fullCache) {\n fullCache = fullOntologyLoad(client);\n }\n return await fullCache;\n }\n async function loadObject(client, key, skipCache = false) {\n if (USE_FULL_ONTOLOGY) {\n const fullCacheLocal = await initLocalCache(client, skipCache);\n return {\n ...wireObjectTypeFullMetadataToSdkObjectTypeDefinition(fullCacheLocal[1].objectTypes[key], true),\n implements: fullCacheLocal[0].data.map(i => i.apiName)\n };\n } else {\n return await loadFullObjectMetadata(client, key);\n }\n }\n async function loadInterface(client, key, skipCache = false) {\n if (USE_FULL_ONTOLOGY) {\n const fullCacheLocal = await initLocalCache(client, skipCache);\n return __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(fullCacheLocal[1].interfaceTypes[key], true);\n } else {\n return loadInterfaceDefinition(client, key);\n }\n }\n function makeGetter(fn) {\n const cache = createAsyncCache((client, key) => fn(client, key, false));\n return async apiName => {\n const n = alwaysRevalidate ? await fn(client, apiName, true) : await cache.get(client, apiName);\n if (alwaysRevalidate) {\n const og = cache.getOrUndefined(client, apiName);\n if (deepEqual(og, n)) {\n return og; // ! because we can be sure `n` would throw if it were undefined\n } else {\n return cache.set(client, apiName, n);\n }\n }\n return n;\n };\n }\n return {\n getObjectDefinition: makeGetter(loadObject),\n getInterfaceDefinition: makeGetter(loadInterface),\n maybeSeed(definition) {\n // not using this for now\n }\n };\n };\n};","import { omniFetch } from '@osdk/shared.net';\n\n// src/public/OntologiesV2_ObjectTypeV2.ts\nvar _listObjectTypesV2 = [0, \"/v2/ontologies/{0}/objectTypes\", 2];\nfunction listObjectTypesV2($ctx, ...args) {\n return omniFetch($ctx, _listObjectTypesV2, ...args);\n}\nvar _getObjectTypeV2 = [0, \"/v2/ontologies/{0}/objectTypes/{1}\"];\nfunction getObjectTypeV2($ctx, ...args) {\n return omniFetch($ctx, _getObjectTypeV2, ...args);\n}\nvar _listOutgoingLinkTypesV2 = [0, \"/v2/ontologies/{0}/objectTypes/{1}/outgoingLinkTypes\", 2];\nfunction listOutgoingLinkTypesV2($ctx, ...args) {\n return omniFetch($ctx, _listOutgoingLinkTypesV2, ...args);\n}\nvar _getOutgoingLinkTypeV2 = [0, \"/v2/ontologies/{0}/objectTypes/{1}/outgoingLinkTypes/{2}\"];\nfunction getOutgoingLinkTypeV2($ctx, ...args) {\n return omniFetch($ctx, _getOutgoingLinkTypeV2, ...args);\n}\nexport { getObjectTypeV2, getOutgoingLinkTypeV2, listObjectTypesV2, listOutgoingLinkTypesV2 };","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getObjectTypeV2, listOutgoingLinkTypesV2 } from \"@osdk/foundry/OntologiesV2_ObjectTypeV2\";\nimport { listInterfaceTypes } from \"@osdk/foundry/OntologiesV2_OntologyObjectV2\";\nimport { wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from \"@osdk/generator-converters\";\nimport invariant from \"tiny-invariant\";\nimport { loadAllOntologies } from \"../generated/ontology-metadata/api/OntologyMetadataService/loadAllOntologies.js\";\nimport { loadOntologyEntities } from \"../generated/ontology-metadata/api/OntologyMetadataService/loadOntologyEntities.js\";\nasync function loadAllOutgoingLinkTypes(client, objtype) {\n const linkTypes = [];\n let pageToken;\n do {\n const result = await listOutgoingLinkTypesV2(client, client.ontologyRid, objtype, {\n pageToken\n });\n pageToken = result.nextPageToken;\n linkTypes.push(...result.data);\n } while (pageToken != null);\n return linkTypes;\n}\nfunction makeConjureContext(client, servicePath) {\n return {\n baseUrl: client.stack,\n servicePath,\n fetchFn: client.fetch,\n tokenProvider: async () => await client.tokenProvider()\n };\n}\nexport async function loadFullObjectMetadata(client, objtype) {\n const conjureCtx = makeConjureContext(client, \"/ontology-metadata/api\");\n const [objectType, linkTypes, interfaceTypes, metadata] = await Promise.all([getObjectTypeV2(client, client.ontologyRid, objtype), loadAllOutgoingLinkTypes(client, objtype), listInterfaceTypes(client, client.ontologyRid, {\n pageSize: 200,\n preview: true\n }), await loadAllOntologies(conjureCtx, {})]);\n const sharedPropertyTypeMapping = await loadSptMap(conjureCtx, metadata, client.ontologyRid, objectType.rid);\n const full = {\n implementsInterfaces: interfaceTypes.data.map(i => i.apiName),\n linkTypes,\n objectType,\n sharedPropertyTypeMapping\n };\n\n // TODO: reuse the loaded interface data!\n return wireObjectTypeFullMetadataToSdkObjectTypeDefinition(full, true);\n}\nasync function loadSptMap(ctx, ontologyMetadata, ontologyRid, objectRid) {\n const ontologyVersion = ontologyMetadata.ontologies[ontologyRid].currentOntologyVersion;\n const body = {\n objectTypeVersions: {\n [objectRid]: ontologyVersion\n },\n linkTypeVersions: {},\n loadRedacted: false,\n includeObjectTypesWithoutSearchableDatasources: true\n };\n const entities = await loadOntologyEntities(ctx, body);\n const objectType = entities.objectTypes[objectRid];\n !objectType ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"object type should be loaded\") : invariant(false) : void 0;\n const sptMap = {};\n for (const property of Object.values(objectType.propertyTypes)) {\n if (property.sharedPropertyTypeApiName && property.apiName) {\n sptMap[property.sharedPropertyTypeApiName] = property.apiName;\n }\n }\n return sptMap;\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 metadata about the Ontologies a user has access to. The response will contain\n * only Ontologies on which the user has `ontology:view-ontology`. Note that the returned\n * LoadAllOntologiesResponse may be empty if there is no Ontology yet.\n */\nexport async function loadAllOntologies(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/ontologies/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 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 loadOntologyEntities(ctx, request) {\n return conjureFetch(ctx, `/ontology/ontology/loadEntities`, \"POST\", request);\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getInterfaceType } from \"@osdk/foundry/OntologiesV2_OntologyObjectV2\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nexport async function loadInterfaceDefinition(client, objtype) {\n const r = await getInterfaceType(client, client.ontologyRid, objtype, {\n preview: true\n });\n return __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(r, true);\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 const USER_AGENT = `osdk-client/${process.env.PACKAGE_VERSION}`;","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createActionInvoker } from \"./actions/createActionInvoker.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nexport function createClientInternal(objectSetFactory,\n// first so i can bind\nstack, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {\n const clientCtx = createMinimalClient({\n ontologyRid\n }, stack, tokenProvider, options, fetchFn, objectSetFactory);\n function clientFn(o) {\n if (o.type === \"object\" || o.type === \"interface\") {\n clientCtx.ontologyProvider.maybeSeed(o);\n return objectSetFactory(o, clientCtx);\n } else if (o.type === \"action\") {\n clientCtx.ontologyProvider.maybeSeed(o);\n return createActionInvoker(clientCtx, o);\n } else {\n throw new Error(\"not implemented\");\n }\n }\n const client = Object.defineProperties(clientFn, {\n ctx: {\n value: clientCtx\n }\n });\n return client;\n}\nexport const createClient = createClientInternal.bind(undefined, createObjectSet);"]}
|