@osdk/client 2.7.0-beta.10 → 2.7.0-beta.11
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 +16 -0
- package/build/browser/observable/FunctionPayload.js +2 -0
- package/build/browser/observable/FunctionPayload.js.map +1 -0
- package/build/browser/observable/ObservableClient.js.map +1 -1
- package/build/browser/observable/internal/Changes.js +3 -0
- package/build/browser/observable/internal/Changes.js.map +1 -1
- package/build/browser/observable/internal/KnownCacheKey.js.map +1 -1
- package/build/browser/observable/internal/ObservableClientImpl.js +20 -0
- package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/browser/observable/internal/Store.js +8 -0
- package/build/browser/observable/internal/Store.js.map +1 -1
- package/build/browser/observable/internal/actions/ActionApplication.js +11 -7
- package/build/browser/observable/internal/actions/ActionApplication.js.map +1 -1
- package/build/browser/observable/internal/function/FunctionCacheKey.js +26 -0
- package/build/browser/observable/internal/function/FunctionCacheKey.js.map +1 -0
- package/build/browser/observable/internal/function/FunctionParamsCanonicalizer.js +150 -0
- package/build/browser/observable/internal/function/FunctionParamsCanonicalizer.js.map +1 -0
- package/build/browser/observable/internal/function/FunctionParamsCanonicalizer.test.js +186 -0
- package/build/browser/observable/internal/function/FunctionParamsCanonicalizer.test.js.map +1 -0
- package/build/browser/observable/internal/function/FunctionQuery.js +137 -0
- package/build/browser/observable/internal/function/FunctionQuery.js.map +1 -0
- package/build/browser/observable/internal/function/FunctionQuery.test.js +278 -0
- package/build/browser/observable/internal/function/FunctionQuery.test.js.map +1 -0
- package/build/browser/observable/internal/function/FunctionsHelper.js +92 -0
- package/build/browser/observable/internal/function/FunctionsHelper.js.map +1 -0
- package/build/browser/public/unstable-do-not-use.js.map +1 -1
- package/build/browser/util/UserAgent.js +2 -2
- package/build/cjs/{Client-DaUJl7jZ.d.cts → Client-Cmx6x_V1.d.cts} +1 -1
- package/build/cjs/{chunk-MZZAHBN6.cjs → chunk-666JN2DO.cjs} +6 -4
- package/build/cjs/{chunk-MZZAHBN6.cjs.map → chunk-666JN2DO.cjs.map} +1 -1
- package/build/cjs/{createClient-D5G3qzAO.d.cts → createClient-BPK4om7e.d.cts} +1 -1
- package/build/cjs/index.cjs +7 -7
- package/build/cjs/index.d.cts +2 -2
- package/build/cjs/public/internal.d.cts +1 -1
- package/build/cjs/public/unstable-do-not-use.cjs +375 -23
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +55 -4
- package/build/esm/observable/FunctionPayload.js +2 -0
- package/build/esm/observable/FunctionPayload.js.map +1 -0
- package/build/esm/observable/ObservableClient.js.map +1 -1
- package/build/esm/observable/internal/Changes.js +3 -0
- package/build/esm/observable/internal/Changes.js.map +1 -1
- package/build/esm/observable/internal/KnownCacheKey.js.map +1 -1
- package/build/esm/observable/internal/ObservableClientImpl.js +20 -0
- package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/esm/observable/internal/Store.js +8 -0
- package/build/esm/observable/internal/Store.js.map +1 -1
- package/build/esm/observable/internal/actions/ActionApplication.js +11 -7
- package/build/esm/observable/internal/actions/ActionApplication.js.map +1 -1
- package/build/esm/observable/internal/function/FunctionCacheKey.js +26 -0
- package/build/esm/observable/internal/function/FunctionCacheKey.js.map +1 -0
- package/build/esm/observable/internal/function/FunctionParamsCanonicalizer.js +150 -0
- package/build/esm/observable/internal/function/FunctionParamsCanonicalizer.js.map +1 -0
- package/build/esm/observable/internal/function/FunctionParamsCanonicalizer.test.js +186 -0
- package/build/esm/observable/internal/function/FunctionParamsCanonicalizer.test.js.map +1 -0
- package/build/esm/observable/internal/function/FunctionQuery.js +137 -0
- package/build/esm/observable/internal/function/FunctionQuery.js.map +1 -0
- package/build/esm/observable/internal/function/FunctionQuery.test.js +278 -0
- package/build/esm/observable/internal/function/FunctionQuery.test.js.map +1 -0
- package/build/esm/observable/internal/function/FunctionsHelper.js +92 -0
- package/build/esm/observable/internal/function/FunctionsHelper.js.map +1 -0
- package/build/esm/public/unstable-do-not-use.js.map +1 -1
- package/build/esm/util/UserAgent.js +2 -2
- package/build/types/observable/FunctionPayload.d.ts +10 -0
- package/build/types/observable/FunctionPayload.d.ts.map +1 -0
- package/build/types/observable/ObservableClient.d.ts +52 -1
- package/build/types/observable/ObservableClient.d.ts.map +1 -1
- package/build/types/observable/internal/Changes.d.ts +5 -3
- package/build/types/observable/internal/Changes.d.ts.map +1 -1
- package/build/types/observable/internal/KnownCacheKey.d.ts +2 -1
- package/build/types/observable/internal/KnownCacheKey.d.ts.map +1 -1
- package/build/types/observable/internal/Store.d.ts +5 -1
- package/build/types/observable/internal/Store.d.ts.map +1 -1
- package/build/types/observable/internal/actions/ActionApplication.d.ts.map +1 -1
- package/build/types/observable/internal/function/FunctionCacheKey.d.ts +17 -0
- package/build/types/observable/internal/function/FunctionCacheKey.d.ts.map +1 -0
- package/build/types/observable/internal/function/FunctionParamsCanonicalizer.d.ts +16 -0
- package/build/types/observable/internal/function/FunctionParamsCanonicalizer.d.ts.map +1 -0
- package/build/types/observable/internal/function/FunctionParamsCanonicalizer.test.d.ts +1 -0
- package/build/types/observable/internal/function/FunctionParamsCanonicalizer.test.d.ts.map +1 -0
- package/build/types/observable/internal/function/FunctionQuery.d.ts +40 -0
- package/build/types/observable/internal/function/FunctionQuery.d.ts.map +1 -0
- package/build/types/observable/internal/function/FunctionQuery.test.d.ts +1 -0
- package/build/types/observable/internal/function/FunctionQuery.test.d.ts.map +1 -0
- package/build/types/observable/internal/function/FunctionsHelper.d.ts +25 -0
- package/build/types/observable/internal/function/FunctionsHelper.d.ts.map +1 -0
- package/build/types/public/unstable-do-not-use.d.ts +2 -1
- package/build/types/public/unstable-do-not-use.d.ts.map +1 -1
- package/package.json +8 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Logger } from '@osdk/api';
|
|
2
|
-
import { C as Client } from './Client-
|
|
2
|
+
import { C as Client } from './Client-Cmx6x_V1.cjs';
|
|
3
3
|
|
|
4
4
|
declare const createClient: (baseUrl: string, ontologyRid: string | Promise<string>, tokenProvider: () => Promise<string>, options?: {
|
|
5
5
|
logger?: Logger;
|
package/build/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk666JN2DO_cjs = require('./chunk-666JN2DO.cjs');
|
|
4
4
|
require('./chunk-RDZ5NKAI.cjs');
|
|
5
5
|
var chunkLDTMSHUZ_cjs = require('./chunk-LDTMSHUZ.cjs');
|
|
6
6
|
var api = require('@osdk/api');
|
|
@@ -18,7 +18,7 @@ chunkLDTMSHUZ_cjs.init_cjs_shims();
|
|
|
18
18
|
// src/createPlatformClient.ts
|
|
19
19
|
chunkLDTMSHUZ_cjs.init_cjs_shims();
|
|
20
20
|
function createPlatformClient(baseUrl, tokenProvider, options = void 0, fetchFn = fetch) {
|
|
21
|
-
return shared_client_impl.createSharedClientContext(baseUrl, tokenProvider,
|
|
21
|
+
return shared_client_impl.createSharedClientContext(baseUrl, tokenProvider, chunk666JN2DO_cjs.USER_AGENT, fetchFn);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// src/util/datetimeConverters.ts
|
|
@@ -45,23 +45,23 @@ var extractDateFromIsoString = (dateTime) => {
|
|
|
45
45
|
|
|
46
46
|
Object.defineProperty(exports, "ActionValidationError", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunk666JN2DO_cjs.ActionValidationError; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "createAttachmentUpload", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunk666JN2DO_cjs.createAttachmentUpload; }
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "createClient", {
|
|
55
55
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunk666JN2DO_cjs.createClient; }
|
|
57
57
|
});
|
|
58
58
|
Object.defineProperty(exports, "createObjectSpecifierFromPrimaryKey", {
|
|
59
59
|
enumerable: true,
|
|
60
|
-
get: function () { return
|
|
60
|
+
get: function () { return chunk666JN2DO_cjs.createObjectSpecifierFromPrimaryKey; }
|
|
61
61
|
});
|
|
62
62
|
Object.defineProperty(exports, "extractPrimaryKeyFromObjectSpecifier", {
|
|
63
63
|
enumerable: true,
|
|
64
|
-
get: function () { return
|
|
64
|
+
get: function () { return chunk666JN2DO_cjs.extractPrimaryKeyFromObjectSpecifier; }
|
|
65
65
|
});
|
|
66
66
|
Object.defineProperty(exports, "isOk", {
|
|
67
67
|
enumerable: true,
|
package/build/cjs/index.d.cts
CHANGED
|
@@ -2,8 +2,8 @@ import { AttachmentUpload, ObjectTypeDefinition, PrimaryKeyType, ObjectSpecifier
|
|
|
2
2
|
export { ActionDefinition, ActionEditResponse, ActionMetadata, ActionParam, ActionReturnTypeForOptions, ActionValidationResponse, ApplyActionOptions, ApplyBatchActionOptions, Attachment, CompileTimeMetadata, DerivedProperty, InterfaceDefinition, InterfaceMetadata, Logger, MediaReference, MediaUpload, ObjectMetadata, ObjectSet, ObjectSpecifier, ObjectTypeDefinition, Osdk, OsdkObject, OsdkObjectCreatePropertyType, OsdkObjectPropertyType, PageResult, PropertyDef, PropertyKeys, PropertyValueWireToClient, QueryDefinition, QueryParam, QueryResult, Range, Result, SingleLinkAccessor, ThreeDimensionalAggregation, TwoDimensionalAggregation, VersionBound, WhereClause, isOk } from '@osdk/api';
|
|
3
3
|
export { PalantirApiError } from '@osdk/shared.net.errors';
|
|
4
4
|
import { ValidateActionResponseV2 } from '@osdk/foundry.ontologies';
|
|
5
|
-
export { C as Client } from './Client-
|
|
6
|
-
export { c as createClient } from './createClient-
|
|
5
|
+
export { C as Client } from './Client-Cmx6x_V1.cjs';
|
|
6
|
+
export { c as createClient } from './createClient-BPK4om7e.cjs';
|
|
7
7
|
import { SharedClientContext } from '@osdk/shared.client2';
|
|
8
8
|
import '@osdk/shared.client';
|
|
9
9
|
import '@osdk/api/unstable';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ObjectOrInterfaceDefinition, CompileTimeMetadata, ObjectSet, Attachment, Logger } from '@osdk/api';
|
|
2
|
-
import { C as Client } from '../Client-
|
|
2
|
+
import { C as Client } from '../Client-Cmx6x_V1.cjs';
|
|
3
3
|
import '@osdk/shared.client';
|
|
4
4
|
import '@osdk/api/unstable';
|
|
5
5
|
import '@osdk/shared.client2';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk666JN2DO_cjs = require('../chunk-666JN2DO.cjs');
|
|
4
4
|
var chunkRDZ5NKAI_cjs = require('../chunk-RDZ5NKAI.cjs');
|
|
5
5
|
var chunkLDTMSHUZ_cjs = require('../chunk-LDTMSHUZ.cjs');
|
|
6
6
|
var trie = require('@wry/trie');
|
|
@@ -231,6 +231,20 @@ var ObservableClientImpl = class {
|
|
|
231
231
|
observeAggregation = (options, subFn) => {
|
|
232
232
|
return this.__experimentalStore.aggregations.observe(options, subFn);
|
|
233
233
|
};
|
|
234
|
+
observeFunction = (queryDef, params, options, subFn) => {
|
|
235
|
+
const dependsOn = options.dependsOn?.map((dep) => typeof dep === "string" ? dep : dep.apiName);
|
|
236
|
+
const dependsOnObjects = options.dependsOnObjects?.map((obj) => ({
|
|
237
|
+
$apiName: obj.$apiName,
|
|
238
|
+
$primaryKey: obj.$primaryKey
|
|
239
|
+
}));
|
|
240
|
+
return this.__experimentalStore.functions.observe({
|
|
241
|
+
...options,
|
|
242
|
+
queryDef,
|
|
243
|
+
params,
|
|
244
|
+
dependsOn,
|
|
245
|
+
dependsOnObjects
|
|
246
|
+
}, subFn);
|
|
247
|
+
};
|
|
234
248
|
observeLinks = (objects, linkName, options, subFn) => {
|
|
235
249
|
const objectsArray = Array.isArray(objects) ? objects : [objects];
|
|
236
250
|
const parentSub = new rxjs.Subscription();
|
|
@@ -271,6 +285,12 @@ var ObservableClientImpl = class {
|
|
|
271
285
|
invalidateObjectType(type) {
|
|
272
286
|
return this.__experimentalStore.invalidateObjectType(type, void 0);
|
|
273
287
|
}
|
|
288
|
+
invalidateFunction(apiName, params) {
|
|
289
|
+
return this.__experimentalStore.invalidateFunction(apiName, params);
|
|
290
|
+
}
|
|
291
|
+
invalidateFunctionsByObject(apiName, primaryKey) {
|
|
292
|
+
return this.__experimentalStore.invalidateFunctionsByObject(apiName, primaryKey);
|
|
293
|
+
}
|
|
274
294
|
canonicalizeWhereClause(where) {
|
|
275
295
|
return this.__experimentalStore.whereCanonicalizer.canonicalize(where);
|
|
276
296
|
}
|
|
@@ -433,13 +453,17 @@ var ActionApplication = class {
|
|
|
433
453
|
}
|
|
434
454
|
})();
|
|
435
455
|
};
|
|
436
|
-
#invalidateActionEditResponse = async ({
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
456
|
+
#invalidateActionEditResponse = async (actionEditResponse) => {
|
|
457
|
+
if (actionEditResponse == null) {
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
const {
|
|
461
|
+
deletedObjects,
|
|
462
|
+
modifiedObjects,
|
|
463
|
+
addedObjects,
|
|
464
|
+
editedObjectTypes,
|
|
465
|
+
type
|
|
466
|
+
} = actionEditResponse;
|
|
443
467
|
let changes;
|
|
444
468
|
if (type === "edits") {
|
|
445
469
|
const promisesToWait = [];
|
|
@@ -992,6 +1016,9 @@ var Changes = class {
|
|
|
992
1016
|
registerObjectSet = (key) => {
|
|
993
1017
|
this.modified.add(key);
|
|
994
1018
|
};
|
|
1019
|
+
registerFunction = (key) => {
|
|
1020
|
+
this.modified.add(key);
|
|
1021
|
+
};
|
|
995
1022
|
isEmpty() {
|
|
996
1023
|
return this.modifiedObjects.size === 0 && this.addedObjects.size === 0 && this.added.size === 0 && this.modified.size === 0 && this.deleted.size === 0;
|
|
997
1024
|
}
|
|
@@ -1020,6 +1047,324 @@ function multimapHelper(multimap) {
|
|
|
1020
1047
|
}));
|
|
1021
1048
|
}
|
|
1022
1049
|
|
|
1050
|
+
// src/observable/internal/function/FunctionsHelper.ts
|
|
1051
|
+
chunkLDTMSHUZ_cjs.init_cjs_shims();
|
|
1052
|
+
|
|
1053
|
+
// src/observable/internal/function/FunctionCacheKey.ts
|
|
1054
|
+
chunkLDTMSHUZ_cjs.init_cjs_shims();
|
|
1055
|
+
var PARAMS_IDX = 2;
|
|
1056
|
+
|
|
1057
|
+
// src/observable/internal/function/FunctionParamsCanonicalizer.ts
|
|
1058
|
+
chunkLDTMSHUZ_cjs.init_cjs_shims();
|
|
1059
|
+
function isPrimitiveValue(value) {
|
|
1060
|
+
if (value == null) return true;
|
|
1061
|
+
const t = typeof value;
|
|
1062
|
+
return t === "string" || t === "number" || t === "boolean" || t === "bigint";
|
|
1063
|
+
}
|
|
1064
|
+
var FunctionParamsCanonicalizer = class {
|
|
1065
|
+
#inputCache = /* @__PURE__ */ new WeakMap();
|
|
1066
|
+
#trie = new trie.Trie(false);
|
|
1067
|
+
#canonicalByMarker = /* @__PURE__ */ new WeakMap();
|
|
1068
|
+
canonicalize(params) {
|
|
1069
|
+
if (params == null) {
|
|
1070
|
+
return void 0;
|
|
1071
|
+
}
|
|
1072
|
+
if (this.#inputCache.has(params)) {
|
|
1073
|
+
return this.#inputCache.get(params);
|
|
1074
|
+
}
|
|
1075
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
1076
|
+
const path = [];
|
|
1077
|
+
const canonicalValue = this.#encodeAndBuild(params, path, seen);
|
|
1078
|
+
const marker = this.#trie.lookupArray(path);
|
|
1079
|
+
let canonical = this.#canonicalByMarker.get(marker);
|
|
1080
|
+
if (canonical === void 0) {
|
|
1081
|
+
canonical = canonicalValue;
|
|
1082
|
+
this.#canonicalByMarker.set(marker, canonical);
|
|
1083
|
+
}
|
|
1084
|
+
this.#inputCache.set(params, canonical);
|
|
1085
|
+
return canonical;
|
|
1086
|
+
}
|
|
1087
|
+
#encodeAndBuild(value, path, seen) {
|
|
1088
|
+
if (value == null) {
|
|
1089
|
+
path.push(value);
|
|
1090
|
+
return value;
|
|
1091
|
+
}
|
|
1092
|
+
if (isPrimitiveValue(value)) {
|
|
1093
|
+
path.push(value);
|
|
1094
|
+
return value;
|
|
1095
|
+
}
|
|
1096
|
+
if (seen.has(value)) {
|
|
1097
|
+
throw new Error("Circular reference in function parameters");
|
|
1098
|
+
}
|
|
1099
|
+
seen.add(value);
|
|
1100
|
+
if (value instanceof Date) {
|
|
1101
|
+
const iso = value.toISOString();
|
|
1102
|
+
path.push("$:date", iso);
|
|
1103
|
+
return iso;
|
|
1104
|
+
}
|
|
1105
|
+
if (Array.isArray(value)) {
|
|
1106
|
+
path.push("$:array");
|
|
1107
|
+
const arr = value.map((item) => this.#encodeAndBuild(item, path, seen));
|
|
1108
|
+
path.push("$:array_end");
|
|
1109
|
+
return arr;
|
|
1110
|
+
}
|
|
1111
|
+
if (value instanceof Set) {
|
|
1112
|
+
path.push("$:set");
|
|
1113
|
+
const sorted = this.#sortSetValues(Array.from(value));
|
|
1114
|
+
const arr = sorted.map((item) => this.#encodeAndBuild(item, path, seen));
|
|
1115
|
+
path.push("$:set_end");
|
|
1116
|
+
return arr;
|
|
1117
|
+
}
|
|
1118
|
+
if (value instanceof Map) {
|
|
1119
|
+
path.push("$:map");
|
|
1120
|
+
const sorted = this.#sortMapEntries(Array.from(value.entries()));
|
|
1121
|
+
const arr = sorted.map(([k, v]) => [this.#encodeAndBuild(k, path, seen), this.#encodeAndBuild(v, path, seen)]);
|
|
1122
|
+
path.push("$:map_end");
|
|
1123
|
+
return arr;
|
|
1124
|
+
}
|
|
1125
|
+
if (chunk666JN2DO_cjs.isObjectSpecifiersObject(value)) {
|
|
1126
|
+
path.push("$:osdk", value.$apiName, value.$primaryKey);
|
|
1127
|
+
return {
|
|
1128
|
+
$apiName: value.$apiName,
|
|
1129
|
+
$primaryKey: value.$primaryKey
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
1132
|
+
if (chunkRDZ5NKAI_cjs.isObjectSet(value)) {
|
|
1133
|
+
const wire = chunkRDZ5NKAI_cjs.getWireObjectSet(value);
|
|
1134
|
+
path.push("$:objectset", wire);
|
|
1135
|
+
return wire;
|
|
1136
|
+
}
|
|
1137
|
+
const obj = value;
|
|
1138
|
+
path.push("$:object");
|
|
1139
|
+
const canonical = {};
|
|
1140
|
+
for (const key of Object.keys(obj).sort()) {
|
|
1141
|
+
path.push(key);
|
|
1142
|
+
canonical[key] = this.#encodeAndBuild(obj[key], path, seen);
|
|
1143
|
+
}
|
|
1144
|
+
path.push("$:object_end");
|
|
1145
|
+
return canonical;
|
|
1146
|
+
}
|
|
1147
|
+
#comparePrimitives(a, b) {
|
|
1148
|
+
const ta = typeof a;
|
|
1149
|
+
const tb = typeof b;
|
|
1150
|
+
if (ta !== tb) return ta.localeCompare(tb);
|
|
1151
|
+
if (ta === "string") return a.localeCompare(b);
|
|
1152
|
+
if (ta === "number") {
|
|
1153
|
+
const an = a;
|
|
1154
|
+
const bn = b;
|
|
1155
|
+
if (Number.isNaN(an) && Number.isNaN(bn)) return 0;
|
|
1156
|
+
if (Number.isNaN(an)) return 1;
|
|
1157
|
+
if (Number.isNaN(bn)) return -1;
|
|
1158
|
+
return an - bn;
|
|
1159
|
+
}
|
|
1160
|
+
if (ta === "boolean") return (a ? 1 : 0) - (b ? 1 : 0);
|
|
1161
|
+
if (ta === "bigint") {
|
|
1162
|
+
const ab = a;
|
|
1163
|
+
const bb = b;
|
|
1164
|
+
return ab < bb ? -1 : ab > bb ? 1 : 0;
|
|
1165
|
+
}
|
|
1166
|
+
return 0;
|
|
1167
|
+
}
|
|
1168
|
+
#sortSetValues(items) {
|
|
1169
|
+
return items.slice().sort((a, b) => {
|
|
1170
|
+
if (isPrimitiveValue(a) && isPrimitiveValue(b)) {
|
|
1171
|
+
return this.#comparePrimitives(a, b);
|
|
1172
|
+
}
|
|
1173
|
+
return JSON.stringify(a).localeCompare(JSON.stringify(b));
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
#sortMapEntries(entries) {
|
|
1177
|
+
return entries.slice().sort(([a], [b]) => {
|
|
1178
|
+
if (isPrimitiveValue(a) && isPrimitiveValue(b)) {
|
|
1179
|
+
return this.#comparePrimitives(a, b);
|
|
1180
|
+
}
|
|
1181
|
+
return JSON.stringify(a).localeCompare(JSON.stringify(b));
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1184
|
+
};
|
|
1185
|
+
|
|
1186
|
+
// src/observable/internal/function/FunctionQuery.ts
|
|
1187
|
+
chunkLDTMSHUZ_cjs.init_cjs_shims();
|
|
1188
|
+
var FunctionQuery = class extends Query {
|
|
1189
|
+
#apiName;
|
|
1190
|
+
#version;
|
|
1191
|
+
#params;
|
|
1192
|
+
#dependsOn;
|
|
1193
|
+
#dependsOnObjects;
|
|
1194
|
+
#queryDef;
|
|
1195
|
+
constructor(store, subject, queryDef, params, cacheKey, opts) {
|
|
1196
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkRDZ5NKAI_cjs.additionalContext].logger?.child({}, {
|
|
1197
|
+
msgPrefix: `FunctionQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
1198
|
+
}) : void 0);
|
|
1199
|
+
this.#apiName = queryDef.apiName;
|
|
1200
|
+
this.#version = queryDef.isFixedVersion ? queryDef.version : void 0;
|
|
1201
|
+
this.#params = params;
|
|
1202
|
+
this.#dependsOn = opts.dependsOn;
|
|
1203
|
+
this.#dependsOnObjects = opts.dependsOnObjects;
|
|
1204
|
+
this.#queryDef = queryDef;
|
|
1205
|
+
}
|
|
1206
|
+
_createConnectable(subject) {
|
|
1207
|
+
return rxjs.connectable(subject.pipe(rxjs.map((x) => {
|
|
1208
|
+
const value = x.value;
|
|
1209
|
+
return {
|
|
1210
|
+
status: x.status,
|
|
1211
|
+
result: value?.result,
|
|
1212
|
+
lastUpdated: value?.executedAt ?? 0,
|
|
1213
|
+
error: value?.error
|
|
1214
|
+
};
|
|
1215
|
+
})), {
|
|
1216
|
+
connector: () => new rxjs.BehaviorSubject({
|
|
1217
|
+
status: "init",
|
|
1218
|
+
result: void 0,
|
|
1219
|
+
lastUpdated: 0
|
|
1220
|
+
})
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
async _fetchAndStore() {
|
|
1224
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1225
|
+
this.logger?.child({
|
|
1226
|
+
methodName: "_fetchAndStore"
|
|
1227
|
+
}).debug("calling _fetchAndStore");
|
|
1228
|
+
}
|
|
1229
|
+
try {
|
|
1230
|
+
const result = await chunk666JN2DO_cjs.applyQuery(this.store.client[chunkRDZ5NKAI_cjs.additionalContext], this.#queryDef, this.#params);
|
|
1231
|
+
const executedAt = Date.now();
|
|
1232
|
+
this.store.batch({}, (batch) => {
|
|
1233
|
+
this.writeToStore({
|
|
1234
|
+
result,
|
|
1235
|
+
executedAt
|
|
1236
|
+
}, "loaded", batch);
|
|
1237
|
+
});
|
|
1238
|
+
} catch (e) {
|
|
1239
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1240
|
+
this.logger?.child({
|
|
1241
|
+
methodName: "_fetchAndStore"
|
|
1242
|
+
}).error("Error executing function", e);
|
|
1243
|
+
}
|
|
1244
|
+
const error = e instanceof Error ? e : new Error(String(e));
|
|
1245
|
+
this.store.batch({}, (batch) => {
|
|
1246
|
+
this.writeToStore({
|
|
1247
|
+
result: void 0,
|
|
1248
|
+
executedAt: 0,
|
|
1249
|
+
error
|
|
1250
|
+
}, "error", batch);
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
writeToStore(data, status, batch) {
|
|
1255
|
+
batch.write(this.cacheKey, data, status);
|
|
1256
|
+
return batch.read(this.cacheKey);
|
|
1257
|
+
}
|
|
1258
|
+
invalidateObjectType = (objectType, changes) => {
|
|
1259
|
+
if (this.#dependsOn?.includes(objectType)) {
|
|
1260
|
+
changes?.registerFunction(this.cacheKey);
|
|
1261
|
+
return this.revalidate(true);
|
|
1262
|
+
}
|
|
1263
|
+
return Promise.resolve();
|
|
1264
|
+
};
|
|
1265
|
+
dependsOnObject(apiName, primaryKey) {
|
|
1266
|
+
if (!this.#dependsOnObjects) {
|
|
1267
|
+
return false;
|
|
1268
|
+
}
|
|
1269
|
+
return this.#dependsOnObjects.some((obj) => obj.$apiName === apiName && obj.$primaryKey === primaryKey);
|
|
1270
|
+
}
|
|
1271
|
+
/**
|
|
1272
|
+
* Called during batch operations when objects change.
|
|
1273
|
+
* Checks if any objects in dependsOnObjects were modified/added
|
|
1274
|
+
* and triggers revalidation if so.
|
|
1275
|
+
*/
|
|
1276
|
+
maybeUpdateAndRevalidate = (changes, _optimisticId) => {
|
|
1277
|
+
if (!this.#dependsOnObjects?.length) {
|
|
1278
|
+
return void 0;
|
|
1279
|
+
}
|
|
1280
|
+
for (const dep of this.#dependsOnObjects) {
|
|
1281
|
+
const modifiedObjects = changes.modifiedObjects.get(dep.$apiName);
|
|
1282
|
+
if (modifiedObjects?.some((obj) => obj.$primaryKey === dep.$primaryKey)) {
|
|
1283
|
+
return this.revalidate(true);
|
|
1284
|
+
}
|
|
1285
|
+
const addedObjects = changes.addedObjects.get(dep.$apiName);
|
|
1286
|
+
if (addedObjects?.some((obj) => obj.$primaryKey === dep.$primaryKey)) {
|
|
1287
|
+
return this.revalidate(true);
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
return void 0;
|
|
1291
|
+
};
|
|
1292
|
+
get apiName() {
|
|
1293
|
+
return this.#apiName;
|
|
1294
|
+
}
|
|
1295
|
+
get version() {
|
|
1296
|
+
return this.#version;
|
|
1297
|
+
}
|
|
1298
|
+
};
|
|
1299
|
+
|
|
1300
|
+
// src/observable/internal/function/FunctionsHelper.ts
|
|
1301
|
+
var FunctionsHelper = class extends AbstractHelper {
|
|
1302
|
+
paramsCanonicalizer = new FunctionParamsCanonicalizer();
|
|
1303
|
+
constructor(store, cacheKeys) {
|
|
1304
|
+
super(store, cacheKeys);
|
|
1305
|
+
}
|
|
1306
|
+
observe(options, subFn) {
|
|
1307
|
+
return super.observe(options, subFn);
|
|
1308
|
+
}
|
|
1309
|
+
getQuery(options) {
|
|
1310
|
+
const {
|
|
1311
|
+
queryDef,
|
|
1312
|
+
params,
|
|
1313
|
+
...observeOpts
|
|
1314
|
+
} = options;
|
|
1315
|
+
const apiName = queryDef.apiName;
|
|
1316
|
+
const version = queryDef.isFixedVersion ? queryDef.version : void 0;
|
|
1317
|
+
const canonicalParams = this.paramsCanonicalizer.canonicalize(params);
|
|
1318
|
+
const functionCacheKey = this.cacheKeys.get("function", apiName, version, canonicalParams);
|
|
1319
|
+
return this.store.queries.get(functionCacheKey, () => new FunctionQuery(this.store, this.store.subjects.get(functionCacheKey), queryDef, params, functionCacheKey, observeOpts));
|
|
1320
|
+
}
|
|
1321
|
+
async invalidateFunction(apiName, params) {
|
|
1322
|
+
const functionApiName = typeof apiName === "string" ? apiName : apiName.apiName;
|
|
1323
|
+
let canonicalParams;
|
|
1324
|
+
if (params !== void 0) {
|
|
1325
|
+
canonicalParams = this.paramsCanonicalizer.canonicalize(params);
|
|
1326
|
+
}
|
|
1327
|
+
const promises = [];
|
|
1328
|
+
for (const cacheKey of this.store.queries.keys()) {
|
|
1329
|
+
if (cacheKey.type !== "function") {
|
|
1330
|
+
continue;
|
|
1331
|
+
}
|
|
1332
|
+
const query = this.store.queries.peek(cacheKey);
|
|
1333
|
+
if (!query) {
|
|
1334
|
+
continue;
|
|
1335
|
+
}
|
|
1336
|
+
if (query.apiName !== functionApiName) {
|
|
1337
|
+
continue;
|
|
1338
|
+
}
|
|
1339
|
+
if (canonicalParams !== void 0) {
|
|
1340
|
+
const queryCacheKey = cacheKey;
|
|
1341
|
+
const queryParams = queryCacheKey.otherKeys[PARAMS_IDX];
|
|
1342
|
+
if (queryParams !== canonicalParams) {
|
|
1343
|
+
continue;
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
promises.push(query.revalidate(true));
|
|
1347
|
+
}
|
|
1348
|
+
await Promise.allSettled(promises);
|
|
1349
|
+
}
|
|
1350
|
+
async invalidateFunctionsByObject(apiName, primaryKey) {
|
|
1351
|
+
const promises = [];
|
|
1352
|
+
for (const cacheKey of this.store.queries.keys()) {
|
|
1353
|
+
if (cacheKey.type !== "function") {
|
|
1354
|
+
continue;
|
|
1355
|
+
}
|
|
1356
|
+
const query = this.store.queries.peek(cacheKey);
|
|
1357
|
+
if (!query) {
|
|
1358
|
+
continue;
|
|
1359
|
+
}
|
|
1360
|
+
if (query.dependsOnObject(apiName, primaryKey)) {
|
|
1361
|
+
promises.push(query.revalidate(true));
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
await Promise.allSettled(promises);
|
|
1365
|
+
}
|
|
1366
|
+
};
|
|
1367
|
+
|
|
1023
1368
|
// src/observable/internal/IntersectCanonicalizer.ts
|
|
1024
1369
|
chunkLDTMSHUZ_cjs.init_cjs_shims();
|
|
1025
1370
|
|
|
@@ -2662,7 +3007,7 @@ var InterfaceListQuery = class extends ListQuery {
|
|
|
2662
3007
|
}
|
|
2663
3008
|
extractRelevantObjects(changes) {
|
|
2664
3009
|
const matchesApiName = ([, object]) => {
|
|
2665
|
-
return this.apiName in object[
|
|
3010
|
+
return this.apiName in object[chunk666JN2DO_cjs.ObjectDefRef].interfaceMap;
|
|
2666
3011
|
};
|
|
2667
3012
|
const added = Array.from(changes.addedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
|
|
2668
3013
|
const modified = Array.from(changes.modifiedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
|
|
@@ -2683,7 +3028,7 @@ var InterfaceListQuery = class extends ListQuery {
|
|
|
2683
3028
|
async function reloadDataAsFullObjects(client, data) {
|
|
2684
3029
|
const groups = groupBy__default.default(data, (x) => x.$objectType);
|
|
2685
3030
|
const objectTypeToPrimaryKeyToObject = Object.fromEntries(await Promise.all(Object.entries(groups).map(async ([apiName, objects]) => {
|
|
2686
|
-
const objectDef = objects[0][
|
|
3031
|
+
const objectDef = objects[0][chunk666JN2DO_cjs.UnderlyingOsdkObject][chunk666JN2DO_cjs.ObjectDefRef];
|
|
2687
3032
|
const where = {
|
|
2688
3033
|
[objectDef.primaryKeyApiName]: {
|
|
2689
3034
|
$in: objects.map((x) => x.$primaryKey)
|
|
@@ -2844,8 +3189,8 @@ function stripRdpFields(value, rdpFields) {
|
|
|
2844
3189
|
if (rdpFields.size === 0) {
|
|
2845
3190
|
return value;
|
|
2846
3191
|
}
|
|
2847
|
-
const underlying = value[
|
|
2848
|
-
const objectDef = value[
|
|
3192
|
+
const underlying = value[chunk666JN2DO_cjs.UnderlyingOsdkObject];
|
|
3193
|
+
const objectDef = value[chunk666JN2DO_cjs.ObjectDefRef];
|
|
2849
3194
|
const newProps = {
|
|
2850
3195
|
$apiName: underlying.$apiName,
|
|
2851
3196
|
$objectType: underlying.$objectType,
|
|
@@ -2857,7 +3202,7 @@ function stripRdpFields(value, rdpFields) {
|
|
|
2857
3202
|
newProps[key] = underlying[key];
|
|
2858
3203
|
}
|
|
2859
3204
|
}
|
|
2860
|
-
return
|
|
3205
|
+
return chunk666JN2DO_cjs.createOsdkObject(value[chunk666JN2DO_cjs.ClientRef], objectDef, newProps);
|
|
2861
3206
|
}
|
|
2862
3207
|
function isSuperset(superset, subset) {
|
|
2863
3208
|
for (const field of subset) {
|
|
@@ -2868,8 +3213,8 @@ function isSuperset(superset, subset) {
|
|
|
2868
3213
|
return true;
|
|
2869
3214
|
}
|
|
2870
3215
|
function filterToRdpFields(value, rdpFieldsToKeep, sourceRdpFields) {
|
|
2871
|
-
const underlying = value[
|
|
2872
|
-
const objectDef = value[
|
|
3216
|
+
const underlying = value[chunk666JN2DO_cjs.UnderlyingOsdkObject];
|
|
3217
|
+
const objectDef = value[chunk666JN2DO_cjs.ObjectDefRef];
|
|
2873
3218
|
const newProps = {
|
|
2874
3219
|
$apiName: underlying.$apiName,
|
|
2875
3220
|
$objectType: underlying.$objectType,
|
|
@@ -2884,7 +3229,7 @@ function filterToRdpFields(value, rdpFieldsToKeep, sourceRdpFields) {
|
|
|
2884
3229
|
}
|
|
2885
3230
|
}
|
|
2886
3231
|
}
|
|
2887
|
-
return
|
|
3232
|
+
return chunk666JN2DO_cjs.createOsdkObject(value[chunk666JN2DO_cjs.ClientRef], objectDef, newProps);
|
|
2888
3233
|
}
|
|
2889
3234
|
function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, targetCurrentValue) {
|
|
2890
3235
|
if (targetRdpFields.size === 0) {
|
|
@@ -2896,8 +3241,8 @@ function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, target
|
|
|
2896
3241
|
}
|
|
2897
3242
|
return filterToRdpFields(sourceValue, targetRdpFields, sourceRdpFields);
|
|
2898
3243
|
}
|
|
2899
|
-
const sourceUnderlying = sourceValue[
|
|
2900
|
-
const objectDef = sourceValue[
|
|
3244
|
+
const sourceUnderlying = sourceValue[chunk666JN2DO_cjs.UnderlyingOsdkObject];
|
|
3245
|
+
const objectDef = sourceValue[chunk666JN2DO_cjs.ObjectDefRef];
|
|
2901
3246
|
const newProps = {
|
|
2902
3247
|
$apiName: sourceUnderlying.$apiName,
|
|
2903
3248
|
$objectType: sourceUnderlying.$objectType,
|
|
@@ -2910,14 +3255,14 @@ function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, target
|
|
|
2910
3255
|
}
|
|
2911
3256
|
}
|
|
2912
3257
|
if (targetCurrentValue) {
|
|
2913
|
-
const targetUnderlying = targetCurrentValue[
|
|
3258
|
+
const targetUnderlying = targetCurrentValue[chunk666JN2DO_cjs.UnderlyingOsdkObject];
|
|
2914
3259
|
for (const field of targetRdpFields) {
|
|
2915
3260
|
if (!sourceRdpFields.has(field) && field in targetUnderlying) {
|
|
2916
3261
|
newProps[field] = targetUnderlying[field];
|
|
2917
3262
|
}
|
|
2918
3263
|
}
|
|
2919
3264
|
}
|
|
2920
|
-
return
|
|
3265
|
+
return chunk666JN2DO_cjs.createOsdkObject(sourceValue[chunk666JN2DO_cjs.ClientRef], objectDef, newProps);
|
|
2921
3266
|
}
|
|
2922
3267
|
|
|
2923
3268
|
// src/observable/internal/object/ObjectCacheKeyRegistry.ts
|
|
@@ -3570,6 +3915,7 @@ var Store = class {
|
|
|
3570
3915
|
onDestroy: this.#cleanupCacheKey
|
|
3571
3916
|
});
|
|
3572
3917
|
this.aggregations = new AggregationsHelper(this, this.cacheKeys, this.whereCanonicalizer, this.rdpCanonicalizer);
|
|
3918
|
+
this.functions = new FunctionsHelper(this, this.cacheKeys);
|
|
3573
3919
|
this.lists = new ListsHelper(this, this.cacheKeys, this.whereCanonicalizer, this.orderByCanonicalizer, this.rdpCanonicalizer, this.intersectCanonicalizer, this.pivotCanonicalizer);
|
|
3574
3920
|
this.objects = new ObjectsHelper(this, this.cacheKeys);
|
|
3575
3921
|
this.links = new LinksHelper(this, this.cacheKeys, this.whereCanonicalizer, this.orderByCanonicalizer);
|
|
@@ -3824,14 +4170,20 @@ var Store = class {
|
|
|
3824
4170
|
}
|
|
3825
4171
|
return Promise.allSettled(promises).then(() => void 0);
|
|
3826
4172
|
}
|
|
4173
|
+
async invalidateFunction(apiName, params) {
|
|
4174
|
+
return this.functions.invalidateFunction(apiName, params);
|
|
4175
|
+
}
|
|
4176
|
+
async invalidateFunctionsByObject(apiName, primaryKey) {
|
|
4177
|
+
return this.functions.invalidateFunctionsByObject(apiName, primaryKey);
|
|
4178
|
+
}
|
|
3827
4179
|
};
|
|
3828
4180
|
|
|
3829
4181
|
// src/observable/ObservableClient.ts
|
|
3830
4182
|
function createObservableClient(client) {
|
|
3831
|
-
const tweakedClient =
|
|
4183
|
+
const tweakedClient = chunk666JN2DO_cjs.createClientFromContext({
|
|
3832
4184
|
...client[chunkRDZ5NKAI_cjs.additionalContext],
|
|
3833
4185
|
fetch: shared_net_fetch.createFetchHeaderMutator(client[chunkRDZ5NKAI_cjs.additionalContext].fetch, (headers) => {
|
|
3834
|
-
headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"),
|
|
4186
|
+
headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"), chunk666JN2DO_cjs.OBSERVABLE_USER_AGENT].filter((x) => x && x?.length > 0).join(" "));
|
|
3835
4187
|
return headers;
|
|
3836
4188
|
})
|
|
3837
4189
|
});
|
|
@@ -3875,7 +4227,7 @@ function getOsdkConfig(ontologyRid) {
|
|
|
3875
4227
|
|
|
3876
4228
|
Object.defineProperty(exports, "createClientWithTransaction", {
|
|
3877
4229
|
enumerable: true,
|
|
3878
|
-
get: function () { return
|
|
4230
|
+
get: function () { return chunk666JN2DO_cjs.createClientWithTransaction; }
|
|
3879
4231
|
});
|
|
3880
4232
|
Object.defineProperty(exports, "augment", {
|
|
3881
4233
|
enumerable: true,
|