@osdk/client 2.7.1 → 2.7.2
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 +12 -0
- package/build/browser/Client.js +1 -1
- package/build/browser/Client.js.map +1 -1
- package/build/browser/observable/ObservableClient.js.map +1 -1
- package/build/browser/observable/internal/BulkObjectLoader.js +71 -9
- package/build/browser/observable/internal/BulkObjectLoader.js.map +1 -1
- package/build/browser/observable/internal/BulkObjectLoader.test.js +79 -0
- package/build/browser/observable/internal/BulkObjectLoader.test.js.map +1 -1
- package/build/browser/observable/internal/ObservableClientImpl.js +104 -17
- package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/browser/observable/internal/PivotCanonicalizer.js +4 -4
- package/build/browser/observable/internal/PivotCanonicalizer.js.map +1 -1
- package/build/browser/observable/internal/Store.test.js +185 -1
- package/build/browser/observable/internal/Store.test.js.map +1 -1
- package/build/browser/observable/internal/list/InterfaceListQuery.js +49 -3
- package/build/browser/observable/internal/list/InterfaceListQuery.js.map +1 -1
- package/build/browser/observable/internal/list/ListQuery.test.js +154 -0
- package/build/browser/observable/internal/list/ListQuery.test.js.map +1 -1
- package/build/browser/observable/internal/list/ListsHelper.js +1 -1
- package/build/browser/observable/internal/list/ListsHelper.js.map +1 -1
- package/build/browser/observable/internal/list/ObjectListQuery.js +22 -21
- package/build/browser/observable/internal/list/ObjectListQuery.js.map +1 -1
- package/build/browser/observable/internal/object/ObjectQuery.js +23 -6
- package/build/browser/observable/internal/object/ObjectQuery.js.map +1 -1
- package/build/browser/observable/internal/object/ObjectsHelper.js +3 -1
- package/build/browser/observable/internal/object/ObjectsHelper.js.map +1 -1
- package/build/browser/util/UserAgent.js +2 -2
- package/build/browser/util/interfaceUtils.js +7 -0
- package/build/browser/util/interfaceUtils.js.map +1 -1
- package/build/cjs/{chunk-OZNDU7AU.cjs → chunk-R6UWEIUJ.cjs} +2 -2
- package/build/cjs/{chunk-OZNDU7AU.cjs.map → chunk-R6UWEIUJ.cjs.map} +1 -1
- package/build/cjs/{chunk-OVZCGOMG.cjs → chunk-YFQRCAZX.cjs} +69 -65
- package/build/cjs/chunk-YFQRCAZX.cjs.map +1 -0
- package/build/cjs/index.cjs +8 -8
- package/build/cjs/public/internal.cjs +8 -8
- package/build/cjs/public/unstable-do-not-use.cjs +323 -112
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +9 -9
- package/build/esm/Client.js +1 -1
- package/build/esm/Client.js.map +1 -1
- package/build/esm/observable/ObservableClient.js.map +1 -1
- package/build/esm/observable/internal/BulkObjectLoader.js +71 -9
- package/build/esm/observable/internal/BulkObjectLoader.js.map +1 -1
- package/build/esm/observable/internal/BulkObjectLoader.test.js +79 -0
- package/build/esm/observable/internal/BulkObjectLoader.test.js.map +1 -1
- package/build/esm/observable/internal/ObservableClientImpl.js +104 -17
- package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/esm/observable/internal/PivotCanonicalizer.js +4 -4
- package/build/esm/observable/internal/PivotCanonicalizer.js.map +1 -1
- package/build/esm/observable/internal/Store.test.js +185 -1
- package/build/esm/observable/internal/Store.test.js.map +1 -1
- package/build/esm/observable/internal/list/InterfaceListQuery.js +49 -3
- package/build/esm/observable/internal/list/InterfaceListQuery.js.map +1 -1
- package/build/esm/observable/internal/list/ListQuery.test.js +154 -0
- package/build/esm/observable/internal/list/ListQuery.test.js.map +1 -1
- package/build/esm/observable/internal/list/ListsHelper.js +1 -1
- package/build/esm/observable/internal/list/ListsHelper.js.map +1 -1
- package/build/esm/observable/internal/list/ObjectListQuery.js +22 -21
- package/build/esm/observable/internal/list/ObjectListQuery.js.map +1 -1
- package/build/esm/observable/internal/object/ObjectQuery.js +23 -6
- package/build/esm/observable/internal/object/ObjectQuery.js.map +1 -1
- package/build/esm/observable/internal/object/ObjectsHelper.js +3 -1
- package/build/esm/observable/internal/object/ObjectsHelper.js.map +1 -1
- package/build/esm/util/UserAgent.js +2 -2
- package/build/esm/util/interfaceUtils.js +7 -0
- package/build/esm/util/interfaceUtils.js.map +1 -1
- package/build/types/Client.d.ts +1 -1
- package/build/types/observable/ObservableClient.d.ts +12 -12
- package/build/types/observable/ObservableClient.d.ts.map +1 -1
- package/build/types/observable/internal/BulkObjectLoader.d.ts +2 -1
- package/build/types/observable/internal/BulkObjectLoader.d.ts.map +1 -1
- package/build/types/observable/internal/PivotCanonicalizer.d.ts +2 -2
- package/build/types/observable/internal/PivotCanonicalizer.d.ts.map +1 -1
- package/build/types/observable/internal/Store.test.d.ts.map +1 -1
- package/build/types/observable/internal/list/InterfaceListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/list/ObjectListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/object/ObjectQuery.d.ts +2 -1
- package/build/types/observable/internal/object/ObjectQuery.d.ts.map +1 -1
- package/build/types/observable/internal/object/ObjectsHelper.d.ts.map +1 -1
- package/build/types/util/interfaceUtils.d.ts +2 -1
- package/build/types/util/interfaceUtils.d.ts.map +1 -1
- package/package.json +5 -5
- package/build/cjs/chunk-OVZCGOMG.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkYFQRCAZX_cjs = require('../chunk-YFQRCAZX.cjs');
|
|
4
|
+
var chunkR6UWEIUJ_cjs = require('../chunk-R6UWEIUJ.cjs');
|
|
5
5
|
var chunkLDTMSHUZ_cjs = require('../chunk-LDTMSHUZ.cjs');
|
|
6
6
|
var trie = require('@wry/trie');
|
|
7
7
|
var deepEqual = require('fast-deep-equal');
|
|
@@ -153,7 +153,7 @@ var WhereClauseCanonicalizer = class {
|
|
|
153
153
|
var whereCanonicalizer = new WhereClauseCanonicalizer();
|
|
154
154
|
var orderByCanonicalizer = new OrderByCanonicalizer();
|
|
155
155
|
function computeObjectSetCacheKey(objectSet, options) {
|
|
156
|
-
const keyParts = ["objectSet",
|
|
156
|
+
const keyParts = ["objectSet", chunkR6UWEIUJ_cjs.getWireObjectSet(objectSet)];
|
|
157
157
|
if (!options) {
|
|
158
158
|
return JSON.stringify(keyParts);
|
|
159
159
|
}
|
|
@@ -165,13 +165,13 @@ function computeObjectSetCacheKey(objectSet, options) {
|
|
|
165
165
|
keyParts.push("props", propKeys);
|
|
166
166
|
}
|
|
167
167
|
if (options.union && options.union.length > 0) {
|
|
168
|
-
keyParts.push("union", options.union.map((os) =>
|
|
168
|
+
keyParts.push("union", options.union.map((os) => chunkR6UWEIUJ_cjs.getWireObjectSet(os)));
|
|
169
169
|
}
|
|
170
170
|
if (options.intersect && options.intersect.length > 0) {
|
|
171
|
-
keyParts.push("intersect", options.intersect.map((os) =>
|
|
171
|
+
keyParts.push("intersect", options.intersect.map((os) => chunkR6UWEIUJ_cjs.getWireObjectSet(os)));
|
|
172
172
|
}
|
|
173
173
|
if (options.subtract && options.subtract.length > 0) {
|
|
174
|
-
keyParts.push("subtract", options.subtract.map((os) =>
|
|
174
|
+
keyParts.push("subtract", options.subtract.map((os) => chunkR6UWEIUJ_cjs.getWireObjectSet(os)));
|
|
175
175
|
}
|
|
176
176
|
if (options.pivotTo) {
|
|
177
177
|
keyParts.push("pivotTo", options.pivotTo);
|
|
@@ -247,24 +247,8 @@ var ObservableClientImpl = class {
|
|
|
247
247
|
};
|
|
248
248
|
observeLinks = (objects, linkName, options, subFn) => {
|
|
249
249
|
const objectsArray = Array.isArray(objects) ? objects : [objects];
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
const querySubscription = this.__experimentalStore.links.observe(
|
|
253
|
-
{
|
|
254
|
-
...options,
|
|
255
|
-
srcType: {
|
|
256
|
-
type: "object",
|
|
257
|
-
apiName: obj.$objectType ?? obj.$apiName
|
|
258
|
-
},
|
|
259
|
-
linkName,
|
|
260
|
-
pk: obj.$primaryKey
|
|
261
|
-
},
|
|
262
|
-
// cast to cross typed to untyped barrier
|
|
263
|
-
subFn
|
|
264
|
-
);
|
|
265
|
-
parentSub.add(querySubscription);
|
|
266
|
-
}
|
|
267
|
-
return new UnsubscribableWrapper(parentSub);
|
|
250
|
+
const observer = subFn;
|
|
251
|
+
return objectsArray.length <= 1 ? observeSingleLink(this.__experimentalStore, objectsArray, linkName, options, observer) : observeMultiLinks(this.__experimentalStore, objectsArray, linkName, options, observer);
|
|
268
252
|
};
|
|
269
253
|
observeObjectSet(baseObjectSet, options, subFn) {
|
|
270
254
|
return this.__experimentalStore.objectSets.observe(
|
|
@@ -295,6 +279,110 @@ var ObservableClientImpl = class {
|
|
|
295
279
|
return this.__experimentalStore.whereCanonicalizer.canonicalize(where);
|
|
296
280
|
}
|
|
297
281
|
};
|
|
282
|
+
function observeSingleLink(store, objectsArray, linkName, options, observer) {
|
|
283
|
+
if (objectsArray.length === 0) {
|
|
284
|
+
observer.next({
|
|
285
|
+
resolvedList: [],
|
|
286
|
+
isOptimistic: false,
|
|
287
|
+
lastUpdated: 0,
|
|
288
|
+
fetchMore: () => Promise.resolve(),
|
|
289
|
+
hasMore: false,
|
|
290
|
+
status: "loaded",
|
|
291
|
+
totalCount: "0"
|
|
292
|
+
});
|
|
293
|
+
return new UnsubscribableWrapper(new rxjs.Subscription());
|
|
294
|
+
}
|
|
295
|
+
const parentSub = new rxjs.Subscription();
|
|
296
|
+
for (const obj of objectsArray) {
|
|
297
|
+
parentSub.add(store.links.observe({
|
|
298
|
+
...options,
|
|
299
|
+
srcType: {
|
|
300
|
+
type: "object",
|
|
301
|
+
apiName: obj.$objectType ?? obj.$apiName
|
|
302
|
+
},
|
|
303
|
+
linkName,
|
|
304
|
+
pk: obj.$primaryKey
|
|
305
|
+
}, observer));
|
|
306
|
+
}
|
|
307
|
+
return new UnsubscribableWrapper(parentSub);
|
|
308
|
+
}
|
|
309
|
+
function observeMultiLinks(store, objectsArray, linkName, options, observer) {
|
|
310
|
+
const parentSub = new rxjs.Subscription();
|
|
311
|
+
const totalExpected = objectsArray.length;
|
|
312
|
+
const perObjectResults = /* @__PURE__ */ new Map();
|
|
313
|
+
let errored = false;
|
|
314
|
+
function mergeAndEmit() {
|
|
315
|
+
if (errored) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
const seen = /* @__PURE__ */ new Map();
|
|
319
|
+
const fetchMores = [];
|
|
320
|
+
let latestUpdated = 0;
|
|
321
|
+
let hasMore = false;
|
|
322
|
+
let isOptimistic = false;
|
|
323
|
+
for (const payload of perObjectResults.values()) {
|
|
324
|
+
for (const obj of payload.resolvedList) {
|
|
325
|
+
seen.set(`${obj.$objectType}:${obj.$primaryKey}`, obj);
|
|
326
|
+
}
|
|
327
|
+
if (payload.lastUpdated > latestUpdated) {
|
|
328
|
+
latestUpdated = payload.lastUpdated;
|
|
329
|
+
}
|
|
330
|
+
if (payload.isOptimistic) {
|
|
331
|
+
isOptimistic = true;
|
|
332
|
+
}
|
|
333
|
+
if (payload.hasMore) {
|
|
334
|
+
hasMore = true;
|
|
335
|
+
fetchMores.push(payload.fetchMore);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
const payloads = [...perObjectResults.values()];
|
|
339
|
+
const loading = perObjectResults.size < totalExpected || payloads.some((p) => p.status === "init" || p.status === "loading");
|
|
340
|
+
observer.next({
|
|
341
|
+
resolvedList: Array.from(seen.values()),
|
|
342
|
+
isOptimistic,
|
|
343
|
+
lastUpdated: latestUpdated,
|
|
344
|
+
fetchMore: hasMore ? () => Promise.all(fetchMores.map((fn) => fn())).then(() => {
|
|
345
|
+
}) : () => Promise.resolve(),
|
|
346
|
+
hasMore,
|
|
347
|
+
status: loading ? "loading" : payloads.some((p) => p.status === "error") ? "error" : "loaded",
|
|
348
|
+
...!hasMore ? {
|
|
349
|
+
totalCount: String(seen.size)
|
|
350
|
+
} : {}
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
for (const obj of objectsArray) {
|
|
354
|
+
const objKey = `${obj.$objectType ?? obj.$apiName}:${obj.$primaryKey}`;
|
|
355
|
+
parentSub.add(store.links.observe({
|
|
356
|
+
...options,
|
|
357
|
+
srcType: {
|
|
358
|
+
type: "object",
|
|
359
|
+
apiName: obj.$objectType ?? obj.$apiName
|
|
360
|
+
},
|
|
361
|
+
linkName,
|
|
362
|
+
pk: obj.$primaryKey
|
|
363
|
+
}, {
|
|
364
|
+
next: (payload) => {
|
|
365
|
+
if (errored) {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
perObjectResults.set(objKey, payload);
|
|
369
|
+
mergeAndEmit();
|
|
370
|
+
},
|
|
371
|
+
error: (err) => {
|
|
372
|
+
if (errored) {
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
errored = true;
|
|
376
|
+
parentSub.unsubscribe();
|
|
377
|
+
observer.error(err);
|
|
378
|
+
},
|
|
379
|
+
// store link queries are long-lived and do not complete
|
|
380
|
+
complete: () => {
|
|
381
|
+
}
|
|
382
|
+
}));
|
|
383
|
+
}
|
|
384
|
+
return new UnsubscribableWrapper(parentSub);
|
|
385
|
+
}
|
|
298
386
|
|
|
299
387
|
// src/observable/internal/Store.ts
|
|
300
388
|
chunkLDTMSHUZ_cjs.init_cjs_shims();
|
|
@@ -371,7 +459,7 @@ var OptimisticJob = class {
|
|
|
371
459
|
return this;
|
|
372
460
|
},
|
|
373
461
|
createObject(type, pk, properties) {
|
|
374
|
-
const create = store.client[
|
|
462
|
+
const create = store.client[chunkR6UWEIUJ_cjs.additionalContext].objectFactory2(store.client[chunkR6UWEIUJ_cjs.additionalContext], [{
|
|
375
463
|
$primaryKey: pk,
|
|
376
464
|
$apiName: type.apiName,
|
|
377
465
|
$objectType: type.apiName,
|
|
@@ -592,7 +680,7 @@ var Query = class {
|
|
|
592
680
|
this.store = store;
|
|
593
681
|
this.cacheKeys = store.cacheKeys;
|
|
594
682
|
this.#subject = observable;
|
|
595
|
-
this.logger = logger ?? (process.env.NODE_ENV === "production" ? store.client[
|
|
683
|
+
this.logger = logger ?? (process.env.NODE_ENV === "production" ? store.client[chunkR6UWEIUJ_cjs.additionalContext].logger : store.client[chunkR6UWEIUJ_cjs.additionalContext].logger?.child({}, {
|
|
596
684
|
msgPrefix: process.env.NODE_ENV !== "production" ? `Query<${cacheKey.type}, ${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>` : "Query"
|
|
597
685
|
}));
|
|
598
686
|
}
|
|
@@ -750,7 +838,7 @@ var Query = class {
|
|
|
750
838
|
// src/observable/internal/aggregation/AggregationQuery.ts
|
|
751
839
|
var AggregationQuery = class extends Query {
|
|
752
840
|
constructor(store, subject, cacheKey, opts) {
|
|
753
|
-
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[
|
|
841
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkR6UWEIUJ_cjs.additionalContext].logger?.child({}, {
|
|
754
842
|
msgPrefix: `AggregationQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
755
843
|
}) : void 0);
|
|
756
844
|
this.apiName = cacheKey.otherKeys[API_NAME_IDX];
|
|
@@ -1121,7 +1209,7 @@ var FunctionParamsCanonicalizer = class {
|
|
|
1121
1209
|
path.push("$:map_end");
|
|
1122
1210
|
return arr;
|
|
1123
1211
|
}
|
|
1124
|
-
if (
|
|
1212
|
+
if (chunkYFQRCAZX_cjs.isObjectSpecifiersObject(value)) {
|
|
1125
1213
|
const objectType = value.$objectType ?? value.$apiName;
|
|
1126
1214
|
path.push("$:osdk", objectType, value.$primaryKey);
|
|
1127
1215
|
return {
|
|
@@ -1129,8 +1217,8 @@ var FunctionParamsCanonicalizer = class {
|
|
|
1129
1217
|
$primaryKey: value.$primaryKey
|
|
1130
1218
|
};
|
|
1131
1219
|
}
|
|
1132
|
-
if (
|
|
1133
|
-
const wire =
|
|
1220
|
+
if (chunkR6UWEIUJ_cjs.isObjectSet(value)) {
|
|
1221
|
+
const wire = chunkR6UWEIUJ_cjs.getWireObjectSet(value);
|
|
1134
1222
|
path.push("$:objectset", wire);
|
|
1135
1223
|
return wire;
|
|
1136
1224
|
}
|
|
@@ -1193,7 +1281,7 @@ var FunctionQuery = class extends Query {
|
|
|
1193
1281
|
#dependsOnObjects;
|
|
1194
1282
|
#queryDef;
|
|
1195
1283
|
constructor(store, subject, queryDef, params, cacheKey, opts) {
|
|
1196
|
-
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[
|
|
1284
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkR6UWEIUJ_cjs.additionalContext].logger?.child({}, {
|
|
1197
1285
|
msgPrefix: `FunctionQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
1198
1286
|
}) : void 0);
|
|
1199
1287
|
this.#apiName = queryDef.apiName;
|
|
@@ -1227,7 +1315,7 @@ var FunctionQuery = class extends Query {
|
|
|
1227
1315
|
}).debug("calling _fetchAndStore");
|
|
1228
1316
|
}
|
|
1229
1317
|
try {
|
|
1230
|
-
const result = await
|
|
1318
|
+
const result = await chunkYFQRCAZX_cjs.applyQuery(this.store.client[chunkR6UWEIUJ_cjs.additionalContext], this.#queryDef, this.#params);
|
|
1231
1319
|
const executedAt = Date.now();
|
|
1232
1320
|
this.store.batch({}, (batch) => {
|
|
1233
1321
|
this.writeToStore({
|
|
@@ -2334,7 +2422,7 @@ var SpecificLinkQuery = class extends BaseListQuery {
|
|
|
2334
2422
|
batch.changes.modified.add(this.cacheKey);
|
|
2335
2423
|
}
|
|
2336
2424
|
constructor(store, subject, cacheKey, opts) {
|
|
2337
|
-
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[
|
|
2425
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkR6UWEIUJ_cjs.additionalContext].logger?.child({}, {
|
|
2338
2426
|
msgPrefix: `SpecificLinkQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
2339
2427
|
}) : void 0);
|
|
2340
2428
|
[this.#sourceApiName, this.#sourcePk, this.#linkName, this.#whereClause, this.#orderBy] = cacheKey.otherKeys;
|
|
@@ -2350,7 +2438,7 @@ var SpecificLinkQuery = class extends BaseListQuery {
|
|
|
2350
2438
|
type: "object",
|
|
2351
2439
|
apiName: this.#sourceApiName
|
|
2352
2440
|
};
|
|
2353
|
-
const sourceMetadata = await client[
|
|
2441
|
+
const sourceMetadata = await client[chunkR6UWEIUJ_cjs.additionalContext].ontologyProvider.getObjectDefinition(this.#sourceApiName);
|
|
2354
2442
|
if (this.#orderBy && Object.keys(this.#orderBy).length > 0) {
|
|
2355
2443
|
const linkDef = sourceMetadata.links?.[this.#linkName];
|
|
2356
2444
|
if (!linkDef?.targetType) {
|
|
@@ -2422,7 +2510,7 @@ var SpecificLinkQuery = class extends BaseListQuery {
|
|
|
2422
2510
|
return this.revalidate(true);
|
|
2423
2511
|
} else {
|
|
2424
2512
|
return (async () => {
|
|
2425
|
-
const sourceMetadata = await this.store.client[
|
|
2513
|
+
const sourceMetadata = await this.store.client[chunkR6UWEIUJ_cjs.additionalContext].ontologyProvider.getObjectDefinition(this.#sourceApiName);
|
|
2426
2514
|
const linkDef = sourceMetadata.links?.[this.#linkName];
|
|
2427
2515
|
if (!linkDef || linkDef.targetType !== objectType) return;
|
|
2428
2516
|
const promise = this.revalidate(true);
|
|
@@ -2730,7 +2818,7 @@ var ListQuery = class extends BaseListQuery {
|
|
|
2730
2818
|
batch.changes.registerList(this.cacheKey);
|
|
2731
2819
|
}
|
|
2732
2820
|
constructor(store, subject, apiName, cacheKey, opts) {
|
|
2733
|
-
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[
|
|
2821
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkR6UWEIUJ_cjs.additionalContext].logger?.child({}, {
|
|
2734
2822
|
msgPrefix: `ListQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
2735
2823
|
}) : void 0);
|
|
2736
2824
|
this.apiName = apiName;
|
|
@@ -2768,10 +2856,10 @@ var ListQuery = class extends BaseListQuery {
|
|
|
2768
2856
|
*/
|
|
2769
2857
|
async fetchPageData(signal) {
|
|
2770
2858
|
if (Object.keys(this.#orderBy).length > 0 && !(this.sortingStrategy instanceof OrderBySortingStrategy)) {
|
|
2771
|
-
const wireObjectSet =
|
|
2859
|
+
const wireObjectSet = chunkR6UWEIUJ_cjs.getWireObjectSet(this.#objectSet);
|
|
2772
2860
|
const {
|
|
2773
2861
|
resultType
|
|
2774
|
-
} = await getObjectTypesThatInvalidate(this.store.client[
|
|
2862
|
+
} = await getObjectTypesThatInvalidate(this.store.client[chunkR6UWEIUJ_cjs.additionalContext], wireObjectSet);
|
|
2775
2863
|
this.sortingStrategy = new OrderBySortingStrategy(resultType.apiName, this.#orderBy);
|
|
2776
2864
|
}
|
|
2777
2865
|
const resp = await this.#objectSet.fetchPage({
|
|
@@ -2999,15 +3087,35 @@ var ListQuery = class extends BaseListQuery {
|
|
|
2999
3087
|
var InterfaceListQuery = class extends ListQuery {
|
|
3000
3088
|
createObjectSet(store) {
|
|
3001
3089
|
const rdpConfig = this.cacheKey.otherKeys[RDP_IDX2];
|
|
3090
|
+
const pivotInfo = this.cacheKey.otherKeys[PIVOT_IDX];
|
|
3091
|
+
const rids = this.cacheKey.otherKeys[RIDS_IDX];
|
|
3092
|
+
if (pivotInfo != null) {
|
|
3093
|
+
const sourceSet = createSourceSetForPivot(store, pivotInfo, rids);
|
|
3094
|
+
let objectSet2 = sourceSet.where(this.canonicalWhere).pivotTo(pivotInfo.linkName);
|
|
3095
|
+
if (rdpConfig != null) {
|
|
3096
|
+
objectSet2 = objectSet2.withProperties(rdpConfig);
|
|
3097
|
+
}
|
|
3098
|
+
return objectSet2;
|
|
3099
|
+
}
|
|
3002
3100
|
const type = "interface";
|
|
3003
3101
|
const objectTypeDef = {
|
|
3004
3102
|
type,
|
|
3005
3103
|
apiName: this.apiName
|
|
3006
3104
|
};
|
|
3105
|
+
const clientCtx = store.client[chunkR6UWEIUJ_cjs.additionalContext];
|
|
3106
|
+
let objectSet;
|
|
3107
|
+
if (rids != null) {
|
|
3108
|
+
objectSet = clientCtx.objectSetFactory(objectTypeDef, clientCtx, {
|
|
3109
|
+
type: "static",
|
|
3110
|
+
objects: [...rids]
|
|
3111
|
+
});
|
|
3112
|
+
} else {
|
|
3113
|
+
objectSet = store.client(objectTypeDef);
|
|
3114
|
+
}
|
|
3007
3115
|
if (rdpConfig != null) {
|
|
3008
|
-
|
|
3116
|
+
objectSet = objectSet.withProperties(rdpConfig);
|
|
3009
3117
|
}
|
|
3010
|
-
return
|
|
3118
|
+
return objectSet.where(this.canonicalWhere);
|
|
3011
3119
|
}
|
|
3012
3120
|
async revalidateObjectType(apiName) {
|
|
3013
3121
|
const objectMetadata = await this.store.client.fetchMetadata({
|
|
@@ -3037,7 +3145,7 @@ var InterfaceListQuery = class extends ListQuery {
|
|
|
3037
3145
|
}
|
|
3038
3146
|
extractRelevantObjects(changes) {
|
|
3039
3147
|
const matchesApiName = ([, object]) => {
|
|
3040
|
-
return this.apiName in object[
|
|
3148
|
+
return this.apiName in object[chunkYFQRCAZX_cjs.ObjectDefRef].interfaceMap;
|
|
3041
3149
|
};
|
|
3042
3150
|
const added = Array.from(changes.addedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
|
|
3043
3151
|
const modified = Array.from(changes.modifiedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
|
|
@@ -3055,6 +3163,28 @@ var InterfaceListQuery = class extends ListQuery {
|
|
|
3055
3163
|
};
|
|
3056
3164
|
}
|
|
3057
3165
|
};
|
|
3166
|
+
function createSourceSetForPivot(store, pivotInfo, rids) {
|
|
3167
|
+
const clientCtx = store.client[chunkR6UWEIUJ_cjs.additionalContext];
|
|
3168
|
+
if (rids != null) {
|
|
3169
|
+
return clientCtx.objectSetFactory({
|
|
3170
|
+
type: "object",
|
|
3171
|
+
apiName: pivotInfo.sourceType
|
|
3172
|
+
}, clientCtx, {
|
|
3173
|
+
type: "static",
|
|
3174
|
+
objects: [...rids]
|
|
3175
|
+
});
|
|
3176
|
+
}
|
|
3177
|
+
if (pivotInfo.sourceTypeKind === "interface") {
|
|
3178
|
+
return store.client({
|
|
3179
|
+
type: "interface",
|
|
3180
|
+
apiName: pivotInfo.sourceType
|
|
3181
|
+
});
|
|
3182
|
+
}
|
|
3183
|
+
return store.client({
|
|
3184
|
+
type: "object",
|
|
3185
|
+
apiName: pivotInfo.sourceType
|
|
3186
|
+
});
|
|
3187
|
+
}
|
|
3058
3188
|
async function reloadDataAsFullObjects(client, data) {
|
|
3059
3189
|
if (data.length === 0) {
|
|
3060
3190
|
return data;
|
|
@@ -3090,34 +3220,34 @@ var ObjectListQuery = class extends ListQuery {
|
|
|
3090
3220
|
const intersectWith = this.cacheKey.otherKeys[INTERSECT_IDX];
|
|
3091
3221
|
const pivotInfo = this.cacheKey.otherKeys[PIVOT_IDX];
|
|
3092
3222
|
const rids = this.cacheKey.otherKeys[RIDS_IDX];
|
|
3093
|
-
const clientCtx = store.client[
|
|
3223
|
+
const clientCtx = store.client[chunkR6UWEIUJ_cjs.additionalContext];
|
|
3094
3224
|
const typeDefinition = {
|
|
3095
3225
|
type: "object",
|
|
3096
3226
|
apiName: this.apiName
|
|
3097
3227
|
};
|
|
3098
3228
|
if (pivotInfo != null) {
|
|
3099
|
-
let sourceSet
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3229
|
+
let sourceSet;
|
|
3230
|
+
if (rids != null) {
|
|
3231
|
+
sourceSet = clientCtx.objectSetFactory({
|
|
3232
|
+
type: "object",
|
|
3233
|
+
apiName: pivotInfo.sourceType
|
|
3234
|
+
}, clientCtx, {
|
|
3235
|
+
type: "static",
|
|
3236
|
+
objects: [...rids]
|
|
3237
|
+
});
|
|
3238
|
+
} else {
|
|
3239
|
+
sourceSet = pivotInfo.sourceTypeKind === "interface" ? store.client({
|
|
3240
|
+
type: "interface",
|
|
3241
|
+
apiName: pivotInfo.sourceType
|
|
3242
|
+
}) : store.client({
|
|
3243
|
+
type: "object",
|
|
3244
|
+
apiName: pivotInfo.sourceType
|
|
3245
|
+
});
|
|
3246
|
+
}
|
|
3247
|
+
let objectSet2 = sourceSet.where(this.canonicalWhere).pivotTo(pivotInfo.linkName);
|
|
3105
3248
|
if (rdpConfig != null) {
|
|
3106
3249
|
objectSet2 = objectSet2.withProperties(rdpConfig);
|
|
3107
3250
|
}
|
|
3108
|
-
if (intersectWith != null && intersectWith.length > 0) {
|
|
3109
|
-
const intersectSets = intersectWith.map((whereClause) => {
|
|
3110
|
-
let intersectSet = store.client({
|
|
3111
|
-
type: "object",
|
|
3112
|
-
apiName: pivotInfo.targetType
|
|
3113
|
-
});
|
|
3114
|
-
if (rdpConfig != null) {
|
|
3115
|
-
intersectSet = intersectSet.withProperties(rdpConfig);
|
|
3116
|
-
}
|
|
3117
|
-
return intersectSet.where(whereClause);
|
|
3118
|
-
});
|
|
3119
|
-
objectSet2 = objectSet2.intersect(...intersectSets);
|
|
3120
|
-
}
|
|
3121
3251
|
return objectSet2;
|
|
3122
3252
|
}
|
|
3123
3253
|
let objectSet;
|
|
@@ -3211,7 +3341,7 @@ var ListsHelper = class extends AbstractHelper {
|
|
|
3211
3341
|
const canonOrderBy = this.orderByCanonicalizer.canonicalize(orderBy ?? {});
|
|
3212
3342
|
const canonRdp = withProperties ? this.rdpCanonicalizer.canonicalize(withProperties) : void 0;
|
|
3213
3343
|
const canonIntersect = intersectWith && intersectWith.length > 0 ? this.intersectCanonicalizer.canonicalize(intersectWith) : void 0;
|
|
3214
|
-
const canonPivot = pivotTo ? this.pivotCanonicalizer.canonicalize(apiName, pivotTo) : void 0;
|
|
3344
|
+
const canonPivot = pivotTo ? this.pivotCanonicalizer.canonicalize(apiName, type, pivotTo) : void 0;
|
|
3215
3345
|
const canonRids = rids != null ? this.ridListCanonicalizer.canonicalize(rids) : void 0;
|
|
3216
3346
|
const listCacheKey = this.cacheKeys.get("list", type, apiName, canonWhere, canonOrderBy, canonRdp, canonIntersect, canonPivot, canonRids);
|
|
3217
3347
|
return this.store.queries.get(listCacheKey, () => {
|
|
@@ -3241,8 +3371,8 @@ function stripRdpFields(value, rdpFields) {
|
|
|
3241
3371
|
if (rdpFields.size === 0) {
|
|
3242
3372
|
return value;
|
|
3243
3373
|
}
|
|
3244
|
-
const underlying = value[
|
|
3245
|
-
const objectDef = value[
|
|
3374
|
+
const underlying = value[chunkYFQRCAZX_cjs.UnderlyingOsdkObject];
|
|
3375
|
+
const objectDef = value[chunkYFQRCAZX_cjs.ObjectDefRef];
|
|
3246
3376
|
const newProps = {
|
|
3247
3377
|
$apiName: underlying.$apiName,
|
|
3248
3378
|
$objectType: underlying.$objectType,
|
|
@@ -3255,7 +3385,7 @@ function stripRdpFields(value, rdpFields) {
|
|
|
3255
3385
|
newProps[key] = underlying[key];
|
|
3256
3386
|
}
|
|
3257
3387
|
}
|
|
3258
|
-
return
|
|
3388
|
+
return chunkYFQRCAZX_cjs.createOsdkObject(value[chunkYFQRCAZX_cjs.ClientRef], objectDef, newProps);
|
|
3259
3389
|
}
|
|
3260
3390
|
function isSuperset(superset, subset) {
|
|
3261
3391
|
for (const field of subset) {
|
|
@@ -3266,8 +3396,8 @@ function isSuperset(superset, subset) {
|
|
|
3266
3396
|
return true;
|
|
3267
3397
|
}
|
|
3268
3398
|
function filterToRdpFields(value, rdpFieldsToKeep, sourceRdpFields) {
|
|
3269
|
-
const underlying = value[
|
|
3270
|
-
const objectDef = value[
|
|
3399
|
+
const underlying = value[chunkYFQRCAZX_cjs.UnderlyingOsdkObject];
|
|
3400
|
+
const objectDef = value[chunkYFQRCAZX_cjs.ObjectDefRef];
|
|
3271
3401
|
const newProps = {
|
|
3272
3402
|
$apiName: underlying.$apiName,
|
|
3273
3403
|
$objectType: underlying.$objectType,
|
|
@@ -3283,7 +3413,7 @@ function filterToRdpFields(value, rdpFieldsToKeep, sourceRdpFields) {
|
|
|
3283
3413
|
}
|
|
3284
3414
|
}
|
|
3285
3415
|
}
|
|
3286
|
-
return
|
|
3416
|
+
return chunkYFQRCAZX_cjs.createOsdkObject(value[chunkYFQRCAZX_cjs.ClientRef], objectDef, newProps);
|
|
3287
3417
|
}
|
|
3288
3418
|
function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, targetCurrentValue) {
|
|
3289
3419
|
if (targetRdpFields.size === 0) {
|
|
@@ -3295,8 +3425,8 @@ function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, target
|
|
|
3295
3425
|
}
|
|
3296
3426
|
return filterToRdpFields(sourceValue, targetRdpFields, sourceRdpFields);
|
|
3297
3427
|
}
|
|
3298
|
-
const sourceUnderlying = sourceValue[
|
|
3299
|
-
const objectDef = sourceValue[
|
|
3428
|
+
const sourceUnderlying = sourceValue[chunkYFQRCAZX_cjs.UnderlyingOsdkObject];
|
|
3429
|
+
const objectDef = sourceValue[chunkYFQRCAZX_cjs.ObjectDefRef];
|
|
3300
3430
|
const newProps = {
|
|
3301
3431
|
$apiName: sourceUnderlying.$apiName,
|
|
3302
3432
|
$objectType: sourceUnderlying.$objectType,
|
|
@@ -3310,14 +3440,14 @@ function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, target
|
|
|
3310
3440
|
}
|
|
3311
3441
|
}
|
|
3312
3442
|
if (targetCurrentValue) {
|
|
3313
|
-
const targetUnderlying = targetCurrentValue[
|
|
3443
|
+
const targetUnderlying = targetCurrentValue[chunkYFQRCAZX_cjs.UnderlyingOsdkObject];
|
|
3314
3444
|
for (const field of targetRdpFields) {
|
|
3315
3445
|
if (!sourceRdpFields.has(field) && field in targetUnderlying) {
|
|
3316
3446
|
newProps[field] = targetUnderlying[field];
|
|
3317
3447
|
}
|
|
3318
3448
|
}
|
|
3319
3449
|
}
|
|
3320
|
-
return
|
|
3450
|
+
return chunkYFQRCAZX_cjs.createOsdkObject(sourceValue[chunkYFQRCAZX_cjs.ClientRef], objectDef, newProps);
|
|
3321
3451
|
}
|
|
3322
3452
|
|
|
3323
3453
|
// src/observable/internal/object/ObjectCacheKeyRegistry.ts
|
|
@@ -3452,40 +3582,54 @@ var BulkObjectLoader = class {
|
|
|
3452
3582
|
#maxEntries;
|
|
3453
3583
|
constructor(client, maxWait = 25, maxEntries = 100) {
|
|
3454
3584
|
this.#client = client;
|
|
3455
|
-
this.#logger = client[
|
|
3585
|
+
this.#logger = client[chunkR6UWEIUJ_cjs.additionalContext].logger;
|
|
3456
3586
|
this.#maxWait = maxWait;
|
|
3457
3587
|
this.#maxEntries = maxEntries;
|
|
3458
3588
|
}
|
|
3459
|
-
async fetch(apiName, primaryKey) {
|
|
3589
|
+
async fetch(apiName, primaryKey, defType = "object") {
|
|
3460
3590
|
const deferred = pDefer();
|
|
3461
3591
|
const entry = this.#m.get(apiName);
|
|
3462
3592
|
entry.data.push({
|
|
3463
3593
|
primaryKey,
|
|
3464
3594
|
deferred
|
|
3465
3595
|
});
|
|
3596
|
+
if (entry.defType === void 0) {
|
|
3597
|
+
entry.defType = defType;
|
|
3598
|
+
} else if (entry.defType !== defType) {
|
|
3599
|
+
deferred.reject(new shared_net_errors.PalantirApiError(`Conflicting defType for ${apiName}: existing=${entry.defType}, new=${defType}`));
|
|
3600
|
+
return deferred.promise;
|
|
3601
|
+
}
|
|
3466
3602
|
if (!entry.timer) {
|
|
3467
3603
|
entry.timer = setTimeout(() => {
|
|
3468
|
-
this.#loadObjects(apiName, entry.data);
|
|
3604
|
+
this.#loadObjects(apiName, entry.data, entry.defType ?? "object");
|
|
3469
3605
|
}, this.#maxWait);
|
|
3470
3606
|
}
|
|
3471
3607
|
if (entry.data.length >= this.#maxEntries) {
|
|
3472
3608
|
clearTimeout(entry.timer);
|
|
3473
|
-
this.#loadObjects(apiName, entry.data);
|
|
3609
|
+
this.#loadObjects(apiName, entry.data, entry.defType ?? "object");
|
|
3474
3610
|
}
|
|
3475
3611
|
return await deferred.promise;
|
|
3476
3612
|
}
|
|
3477
|
-
#loadObjects(apiName, arr) {
|
|
3613
|
+
#loadObjects(apiName, arr, defType) {
|
|
3478
3614
|
this.#m.delete(apiName);
|
|
3479
|
-
this.#
|
|
3615
|
+
const loadFn = defType === "interface" ? this.#loadInterfaceObjects(apiName, arr) : this.#loadObjectTypeObjects(apiName, arr);
|
|
3616
|
+
loadFn.catch((e) => {
|
|
3480
3617
|
this.#logger?.error("Unhandled exception", e);
|
|
3618
|
+
for (const {
|
|
3619
|
+
primaryKey,
|
|
3620
|
+
deferred
|
|
3621
|
+
} of arr) {
|
|
3622
|
+
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
3623
|
+
deferred.reject(new shared_net_errors.PalantirApiError(`Failed to load ${apiName} with pk ${primaryKey}: ${errorMessage}`));
|
|
3624
|
+
}
|
|
3481
3625
|
});
|
|
3482
3626
|
}
|
|
3483
|
-
async #
|
|
3484
|
-
const
|
|
3627
|
+
async #loadObjectTypeObjects(apiName, arr) {
|
|
3628
|
+
const objectDef = {
|
|
3485
3629
|
type: "object",
|
|
3486
3630
|
apiName
|
|
3487
3631
|
};
|
|
3488
|
-
const objMetadata = await this.#client.fetchMetadata(
|
|
3632
|
+
const objMetadata = await this.#client.fetchMetadata(objectDef);
|
|
3489
3633
|
const pks = arr.map((x) => x.primaryKey);
|
|
3490
3634
|
const whereClause = pks.length === 1 ? {
|
|
3491
3635
|
[objMetadata.primaryKeyApiName]: {
|
|
@@ -3498,7 +3642,7 @@ var BulkObjectLoader = class {
|
|
|
3498
3642
|
};
|
|
3499
3643
|
const {
|
|
3500
3644
|
data
|
|
3501
|
-
} = await this.#client(
|
|
3645
|
+
} = await this.#client(objectDef).where(whereClause).fetchPage({
|
|
3502
3646
|
$pageSize: pks.length,
|
|
3503
3647
|
$includeRid: true
|
|
3504
3648
|
});
|
|
@@ -3514,18 +3658,70 @@ var BulkObjectLoader = class {
|
|
|
3514
3658
|
}
|
|
3515
3659
|
}
|
|
3516
3660
|
}
|
|
3661
|
+
async #loadInterfaceObjects(apiName, arr) {
|
|
3662
|
+
const pks = arr.map((x) => x.primaryKey);
|
|
3663
|
+
const interfaceDef = {
|
|
3664
|
+
type: "interface",
|
|
3665
|
+
apiName
|
|
3666
|
+
};
|
|
3667
|
+
const interfaceMetadata = await this.#client.fetchMetadata(interfaceDef);
|
|
3668
|
+
const implementingTypes = interfaceMetadata.implementedBy ?? [];
|
|
3669
|
+
const foundObjects = /* @__PURE__ */ new Map();
|
|
3670
|
+
for (const objectTypeName of implementingTypes) {
|
|
3671
|
+
const objectDef = {
|
|
3672
|
+
type: "object",
|
|
3673
|
+
apiName: objectTypeName
|
|
3674
|
+
};
|
|
3675
|
+
const objMetadata = await this.#client.fetchMetadata(objectDef);
|
|
3676
|
+
const remainingPks = pks.filter((pk) => !foundObjects.has(pk));
|
|
3677
|
+
if (remainingPks.length === 0) {
|
|
3678
|
+
break;
|
|
3679
|
+
}
|
|
3680
|
+
const whereClause = remainingPks.length === 1 ? {
|
|
3681
|
+
[objMetadata.primaryKeyApiName]: {
|
|
3682
|
+
$eq: remainingPks[0]
|
|
3683
|
+
}
|
|
3684
|
+
} : {
|
|
3685
|
+
[objMetadata.primaryKeyApiName]: {
|
|
3686
|
+
$in: remainingPks
|
|
3687
|
+
}
|
|
3688
|
+
};
|
|
3689
|
+
const {
|
|
3690
|
+
data
|
|
3691
|
+
} = await this.#client(objectDef).where(whereClause).fetchPage({
|
|
3692
|
+
$pageSize: remainingPks.length
|
|
3693
|
+
});
|
|
3694
|
+
for (const obj of data) {
|
|
3695
|
+
foundObjects.set(obj.$primaryKey, obj);
|
|
3696
|
+
}
|
|
3697
|
+
}
|
|
3698
|
+
for (const {
|
|
3699
|
+
primaryKey,
|
|
3700
|
+
deferred
|
|
3701
|
+
} of arr) {
|
|
3702
|
+
const object = foundObjects.get(primaryKey);
|
|
3703
|
+
if (object) {
|
|
3704
|
+
deferred.resolve(object);
|
|
3705
|
+
} else {
|
|
3706
|
+
deferred.reject(new shared_net_errors.PalantirApiError(`Interface ${apiName} object not found: ${primaryKey}`));
|
|
3707
|
+
}
|
|
3708
|
+
}
|
|
3709
|
+
}
|
|
3517
3710
|
};
|
|
3518
3711
|
|
|
3519
3712
|
// src/observable/internal/object/ObjectQuery.ts
|
|
3520
3713
|
var ObjectQuery = class extends Query {
|
|
3521
3714
|
#apiName;
|
|
3522
3715
|
#pk;
|
|
3523
|
-
|
|
3524
|
-
|
|
3716
|
+
#defType;
|
|
3717
|
+
#implementingTypes;
|
|
3718
|
+
constructor(store, subject, type, pk, cacheKey, opts, defType = "object") {
|
|
3719
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkR6UWEIUJ_cjs.additionalContext].logger?.child({}, {
|
|
3525
3720
|
msgPrefix: `ObjectQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
3526
3721
|
}) : void 0);
|
|
3527
3722
|
this.#apiName = type;
|
|
3528
3723
|
this.#pk = pk;
|
|
3724
|
+
this.#defType = defType;
|
|
3529
3725
|
}
|
|
3530
3726
|
_createConnectable(subject) {
|
|
3531
3727
|
return rxjs.connectable(subject.pipe(rxjs.map((x) => {
|
|
@@ -3554,7 +3750,7 @@ var ObjectQuery = class extends Query {
|
|
|
3554
3750
|
let obj;
|
|
3555
3751
|
if (rdpConfig) {
|
|
3556
3752
|
const miniDef = {
|
|
3557
|
-
type:
|
|
3753
|
+
type: this.#defType,
|
|
3558
3754
|
apiName: this.#apiName
|
|
3559
3755
|
};
|
|
3560
3756
|
const fetched = await this.store.client(miniDef).withProperties(rdpConfig).fetchOne(this.#pk, {
|
|
@@ -3562,7 +3758,7 @@ var ObjectQuery = class extends Query {
|
|
|
3562
3758
|
});
|
|
3563
3759
|
obj = fetched;
|
|
3564
3760
|
} else {
|
|
3565
|
-
obj = await getBulkObjectLoader(this.store.client).fetch(this.#apiName, this.#pk);
|
|
3761
|
+
obj = await getBulkObjectLoader(this.store.client).fetch(this.#apiName, this.#pk, this.#defType);
|
|
3566
3762
|
}
|
|
3567
3763
|
this.store.batch({}, (batch) => {
|
|
3568
3764
|
this.writeToStore(obj, "loaded", batch);
|
|
@@ -3581,12 +3777,26 @@ var ObjectQuery = class extends Query {
|
|
|
3581
3777
|
this.store.objects.propagateWrite(this.cacheKey, tombstone, status, batch);
|
|
3582
3778
|
return batch.read(this.cacheKey);
|
|
3583
3779
|
}
|
|
3584
|
-
invalidateObjectType = (objectType, changes) => {
|
|
3585
|
-
if (this.#
|
|
3780
|
+
invalidateObjectType = async (objectType, changes) => {
|
|
3781
|
+
if (this.#defType === "object") {
|
|
3782
|
+
if (this.#apiName === objectType) {
|
|
3783
|
+
changes?.modified.add(this.cacheKey);
|
|
3784
|
+
return this.revalidate(true);
|
|
3785
|
+
}
|
|
3786
|
+
return;
|
|
3787
|
+
}
|
|
3788
|
+
if (!this.#implementingTypes) {
|
|
3789
|
+
const interfaceDef = {
|
|
3790
|
+
type: "interface",
|
|
3791
|
+
apiName: this.#apiName
|
|
3792
|
+
};
|
|
3793
|
+
const metadata = await this.store.client.fetchMetadata(interfaceDef);
|
|
3794
|
+
this.#implementingTypes = new Set(metadata.implementedBy ?? []);
|
|
3795
|
+
}
|
|
3796
|
+
if (this.#implementingTypes.has(objectType)) {
|
|
3586
3797
|
changes?.modified.add(this.cacheKey);
|
|
3587
3798
|
return this.revalidate(true);
|
|
3588
3799
|
}
|
|
3589
|
-
return Promise.resolve();
|
|
3590
3800
|
};
|
|
3591
3801
|
};
|
|
3592
3802
|
|
|
@@ -3600,10 +3810,11 @@ var ObjectsHelper = class extends AbstractHelper {
|
|
|
3600
3810
|
const {
|
|
3601
3811
|
pk
|
|
3602
3812
|
} = options;
|
|
3813
|
+
const defType = chunkYFQRCAZX_cjs.getDefType(options.apiName);
|
|
3603
3814
|
const objectCacheKey = this.cacheKeys.get("object", apiName, pk, rdpConfig ?? void 0);
|
|
3604
3815
|
return this.store.queries.get(objectCacheKey, () => new ObjectQuery(this.store, this.store.subjects.get(objectCacheKey), apiName, pk, objectCacheKey, {
|
|
3605
3816
|
dedupeInterval: 0
|
|
3606
|
-
}));
|
|
3817
|
+
}, defType));
|
|
3607
3818
|
}
|
|
3608
3819
|
/**
|
|
3609
3820
|
* Internal helper method for writing objects to the store and returning their
|
|
@@ -3682,7 +3893,7 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
3682
3893
|
#composedObjectSet;
|
|
3683
3894
|
#objectTypes;
|
|
3684
3895
|
constructor(store, subject, baseObjectSetWire, operations, cacheKey, opts) {
|
|
3685
|
-
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[
|
|
3896
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkR6UWEIUJ_cjs.additionalContext].logger?.child({}, {
|
|
3686
3897
|
msgPrefix: `ObjectSetQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
3687
3898
|
}) : void 0);
|
|
3688
3899
|
this.#baseObjectSetWire = baseObjectSetWire;
|
|
@@ -3727,7 +3938,7 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
3727
3938
|
}
|
|
3728
3939
|
if (opts.union) {
|
|
3729
3940
|
for (const os of opts.union) {
|
|
3730
|
-
const wire =
|
|
3941
|
+
const wire = chunkR6UWEIUJ_cjs.getWireObjectSet(os);
|
|
3731
3942
|
if (wire.type) {
|
|
3732
3943
|
types.add(wire.type);
|
|
3733
3944
|
}
|
|
@@ -3735,7 +3946,7 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
3735
3946
|
}
|
|
3736
3947
|
if (opts.intersect) {
|
|
3737
3948
|
for (const os of opts.intersect) {
|
|
3738
|
-
const wire =
|
|
3949
|
+
const wire = chunkR6UWEIUJ_cjs.getWireObjectSet(os);
|
|
3739
3950
|
if (wire.type) {
|
|
3740
3951
|
types.add(wire.type);
|
|
3741
3952
|
}
|
|
@@ -3743,7 +3954,7 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
3743
3954
|
}
|
|
3744
3955
|
if (opts.subtract) {
|
|
3745
3956
|
for (const os of opts.subtract) {
|
|
3746
|
-
const wire =
|
|
3957
|
+
const wire = chunkR6UWEIUJ_cjs.getWireObjectSet(os);
|
|
3747
3958
|
if (wire.type) {
|
|
3748
3959
|
types.add(wire.type);
|
|
3749
3960
|
}
|
|
@@ -3763,10 +3974,10 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
3763
3974
|
*/
|
|
3764
3975
|
async fetchPageData(signal) {
|
|
3765
3976
|
if (this.#operations.orderBy && Object.keys(this.#operations.orderBy).length > 0 && !(this.sortingStrategy instanceof OrderBySortingStrategy)) {
|
|
3766
|
-
const wireObjectSet =
|
|
3977
|
+
const wireObjectSet = chunkR6UWEIUJ_cjs.getWireObjectSet(this.#composedObjectSet);
|
|
3767
3978
|
const {
|
|
3768
3979
|
resultType
|
|
3769
|
-
} = await getObjectTypesThatInvalidate(this.store.client[
|
|
3980
|
+
} = await getObjectTypesThatInvalidate(this.store.client[chunkR6UWEIUJ_cjs.additionalContext], wireObjectSet);
|
|
3770
3981
|
this.sortingStrategy = new OrderBySortingStrategy(resultType.apiName, this.#operations.orderBy);
|
|
3771
3982
|
}
|
|
3772
3983
|
const resp = await this.#composedObjectSet.fetchPage({
|
|
@@ -3835,7 +4046,7 @@ var ObjectSetHelper = class extends AbstractHelper {
|
|
|
3835
4046
|
const {
|
|
3836
4047
|
baseObjectSet
|
|
3837
4048
|
} = options;
|
|
3838
|
-
const baseObjectSetWire = JSON.stringify(
|
|
4049
|
+
const baseObjectSetWire = JSON.stringify(chunkR6UWEIUJ_cjs.getWireObjectSet(baseObjectSet));
|
|
3839
4050
|
const operations = this.buildCanonicalizedOperations(options);
|
|
3840
4051
|
const objectSetCacheKey = this.cacheKeys.get("objectSet", baseObjectSetWire, operations);
|
|
3841
4052
|
return this.store.queries.get(objectSetCacheKey, () => {
|
|
@@ -3851,13 +4062,13 @@ var ObjectSetHelper = class extends AbstractHelper {
|
|
|
3851
4062
|
operations.withProperties = Object.keys(options.withProperties).sort();
|
|
3852
4063
|
}
|
|
3853
4064
|
if (options.union && options.union.length > 0) {
|
|
3854
|
-
operations.union = options.union.map((os) => JSON.stringify(
|
|
4065
|
+
operations.union = options.union.map((os) => JSON.stringify(chunkR6UWEIUJ_cjs.getWireObjectSet(os)));
|
|
3855
4066
|
}
|
|
3856
4067
|
if (options.intersect && options.intersect.length > 0) {
|
|
3857
|
-
operations.intersect = options.intersect.map((os) => JSON.stringify(
|
|
4068
|
+
operations.intersect = options.intersect.map((os) => JSON.stringify(chunkR6UWEIUJ_cjs.getWireObjectSet(os)));
|
|
3858
4069
|
}
|
|
3859
4070
|
if (options.subtract && options.subtract.length > 0) {
|
|
3860
|
-
operations.subtract = options.subtract.map((os) => JSON.stringify(
|
|
4071
|
+
operations.subtract = options.subtract.map((os) => JSON.stringify(chunkR6UWEIUJ_cjs.getWireObjectSet(os)));
|
|
3861
4072
|
}
|
|
3862
4073
|
if (options.pivotTo) {
|
|
3863
4074
|
operations.pivotTo = options.pivotTo;
|
|
@@ -3876,14 +4087,14 @@ var ObjectSetHelper = class extends AbstractHelper {
|
|
|
3876
4087
|
chunkLDTMSHUZ_cjs.init_cjs_shims();
|
|
3877
4088
|
var PivotCanonicalizer = class {
|
|
3878
4089
|
#cache = /* @__PURE__ */ new Map();
|
|
3879
|
-
canonicalize(sourceType, linkName) {
|
|
3880
|
-
const key = `${sourceType}::${linkName}`;
|
|
4090
|
+
canonicalize(sourceType, sourceTypeKind, linkName) {
|
|
4091
|
+
const key = `${sourceTypeKind}:${sourceType}::${linkName}`;
|
|
3881
4092
|
let canonical = this.#cache.get(key);
|
|
3882
4093
|
if (!canonical) {
|
|
3883
4094
|
canonical = {
|
|
3884
4095
|
sourceType,
|
|
3885
|
-
|
|
3886
|
-
|
|
4096
|
+
sourceTypeKind,
|
|
4097
|
+
linkName
|
|
3887
4098
|
};
|
|
3888
4099
|
this.#cache.set(key, canonical);
|
|
3889
4100
|
}
|
|
@@ -3929,7 +4140,7 @@ var RdpCanonicalizer = class extends CachingCanonicalizer {
|
|
|
3929
4140
|
apiName: "__rdp_canonicalizer_holder__"
|
|
3930
4141
|
};
|
|
3931
4142
|
for (const [key, rdpFunction] of Object.entries(rdp)) {
|
|
3932
|
-
const builder =
|
|
4143
|
+
const builder = chunkR6UWEIUJ_cjs.createWithPropertiesObjectSet(
|
|
3933
4144
|
objectTypeHolder,
|
|
3934
4145
|
{
|
|
3935
4146
|
type: "methodInput"
|
|
@@ -3997,7 +4208,7 @@ var Store = class {
|
|
|
3997
4208
|
subjects = this.layers.subjects;
|
|
3998
4209
|
// these are hopefully temporary
|
|
3999
4210
|
constructor(client) {
|
|
4000
|
-
this.logger = client[
|
|
4211
|
+
this.logger = client[chunkR6UWEIUJ_cjs.additionalContext].logger?.child({}, {
|
|
4001
4212
|
msgPrefix: "Store"
|
|
4002
4213
|
});
|
|
4003
4214
|
this.client = client;
|
|
@@ -4270,10 +4481,10 @@ var Store = class {
|
|
|
4270
4481
|
|
|
4271
4482
|
// src/observable/ObservableClient.ts
|
|
4272
4483
|
function createObservableClient(client) {
|
|
4273
|
-
const tweakedClient =
|
|
4274
|
-
...client[
|
|
4275
|
-
fetch: shared_net_fetch.createFetchHeaderMutator(client[
|
|
4276
|
-
headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"),
|
|
4484
|
+
const tweakedClient = chunkYFQRCAZX_cjs.createClientFromContext({
|
|
4485
|
+
...client[chunkR6UWEIUJ_cjs.additionalContext],
|
|
4486
|
+
fetch: shared_net_fetch.createFetchHeaderMutator(client[chunkR6UWEIUJ_cjs.additionalContext].fetch, (headers) => {
|
|
4487
|
+
headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"), chunkYFQRCAZX_cjs.OBSERVABLE_USER_AGENT].filter((x) => x && x?.length > 0).join(" "));
|
|
4277
4488
|
return headers;
|
|
4278
4489
|
})
|
|
4279
4490
|
});
|
|
@@ -4317,11 +4528,11 @@ function getOsdkConfig(ontologyRid) {
|
|
|
4317
4528
|
|
|
4318
4529
|
Object.defineProperty(exports, "createClientWithTransaction", {
|
|
4319
4530
|
enumerable: true,
|
|
4320
|
-
get: function () { return
|
|
4531
|
+
get: function () { return chunkYFQRCAZX_cjs.createClientWithTransaction; }
|
|
4321
4532
|
});
|
|
4322
4533
|
Object.defineProperty(exports, "augment", {
|
|
4323
4534
|
enumerable: true,
|
|
4324
|
-
get: function () { return
|
|
4535
|
+
get: function () { return chunkR6UWEIUJ_cjs.augment; }
|
|
4325
4536
|
});
|
|
4326
4537
|
exports.computeObjectSetCacheKey = computeObjectSetCacheKey;
|
|
4327
4538
|
exports.createObservableClient = createObservableClient;
|