@osdk/client 2.8.0-beta.26 → 2.8.0-beta.27
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/object/SimpleOsdkProperties.js.map +1 -1
- package/build/browser/observable/internal/GenericCanonicalizer.js +72 -0
- package/build/browser/observable/internal/GenericCanonicalizer.js.map +1 -0
- package/build/browser/observable/internal/IntersectCanonicalizer.js +1 -1
- package/build/browser/observable/internal/IntersectCanonicalizer.js.map +1 -1
- package/build/browser/observable/internal/ObjectSetArrayCanonicalizer.js +34 -0
- package/build/browser/observable/internal/ObjectSetArrayCanonicalizer.js.map +1 -0
- package/build/browser/observable/internal/Store.js +21 -1
- package/build/browser/observable/internal/Store.js.map +1 -1
- package/build/browser/observable/internal/list/ListQuery.js.map +1 -1
- package/build/browser/observable/internal/object/ObjectsHelper.js.map +1 -1
- package/build/browser/observable/internal/objectset/ObjectSetHelper.js +5 -4
- package/build/browser/observable/internal/objectset/ObjectSetHelper.js.map +1 -1
- package/build/browser/observable/internal/objectset/ObjectSetQuery.js +180 -27
- package/build/browser/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
- package/build/browser/util/UserAgent.js +2 -2
- package/build/cjs/{chunk-YKQ5QTEF.cjs → chunk-ZPGIIKEZ.cjs} +4 -4
- package/build/cjs/{chunk-YKQ5QTEF.cjs.map → chunk-ZPGIIKEZ.cjs.map} +1 -1
- package/build/cjs/index.cjs +7 -7
- package/build/cjs/public/unstable-do-not-use.cjs +294 -57
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/esm/object/SimpleOsdkProperties.js.map +1 -1
- package/build/esm/observable/internal/GenericCanonicalizer.js +72 -0
- package/build/esm/observable/internal/GenericCanonicalizer.js.map +1 -0
- package/build/esm/observable/internal/IntersectCanonicalizer.js +1 -1
- package/build/esm/observable/internal/IntersectCanonicalizer.js.map +1 -1
- package/build/esm/observable/internal/ObjectSetArrayCanonicalizer.js +34 -0
- package/build/esm/observable/internal/ObjectSetArrayCanonicalizer.js.map +1 -0
- package/build/esm/observable/internal/Store.js +21 -1
- package/build/esm/observable/internal/Store.js.map +1 -1
- package/build/esm/observable/internal/list/ListQuery.js.map +1 -1
- package/build/esm/observable/internal/object/ObjectsHelper.js.map +1 -1
- package/build/esm/observable/internal/objectset/ObjectSetHelper.js +5 -4
- package/build/esm/observable/internal/objectset/ObjectSetHelper.js.map +1 -1
- package/build/esm/observable/internal/objectset/ObjectSetQuery.js +180 -27
- package/build/esm/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
- package/build/esm/util/UserAgent.js +2 -2
- package/build/types/observable/internal/GenericCanonicalizer.d.ts +8 -0
- package/build/types/observable/internal/GenericCanonicalizer.d.ts.map +1 -0
- package/build/types/observable/internal/IntersectCanonicalizer.d.ts.map +1 -1
- package/build/types/observable/internal/ObjectSetArrayCanonicalizer.d.ts +7 -0
- package/build/types/observable/internal/ObjectSetArrayCanonicalizer.d.ts.map +1 -0
- package/build/types/observable/internal/Store.d.ts +4 -0
- package/build/types/observable/internal/Store.d.ts.map +1 -1
- package/build/types/observable/internal/objectset/ObjectSetHelper.d.ts +3 -1
- package/build/types/observable/internal/objectset/ObjectSetHelper.d.ts.map +1 -1
- package/build/types/observable/internal/objectset/ObjectSetQuery.d.ts +4 -1
- package/build/types/observable/internal/objectset/ObjectSetQuery.d.ts.map +1 -1
- package/package.json +5 -5
package/build/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkZPGIIKEZ_cjs = require('./chunk-ZPGIIKEZ.cjs');
|
|
4
4
|
var chunkBWOPPEUP_cjs = require('./chunk-BWOPPEUP.cjs');
|
|
5
5
|
require('./chunk-GSVXEVM4.cjs');
|
|
6
6
|
require('./chunk-D26YLHTV.cjs');
|
|
@@ -16,7 +16,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
16
16
|
var invariant__default = /*#__PURE__*/_interopDefault(invariant);
|
|
17
17
|
|
|
18
18
|
function createPlatformClient(baseUrl, tokenProvider, options = void 0, fetchFn = fetch) {
|
|
19
|
-
return shared_client_impl.createSharedClientContext(baseUrl, tokenProvider,
|
|
19
|
+
return shared_client_impl.createSharedClientContext(baseUrl, tokenProvider, chunkZPGIIKEZ_cjs.USER_AGENT, fetchFn);
|
|
20
20
|
}
|
|
21
21
|
var isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$/;
|
|
22
22
|
var extractDate = (dateTime) => {
|
|
@@ -40,23 +40,23 @@ var extractDateFromIsoString = (dateTime) => {
|
|
|
40
40
|
|
|
41
41
|
Object.defineProperty(exports, "ActionValidationError", {
|
|
42
42
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkZPGIIKEZ_cjs.ActionValidationError; }
|
|
44
44
|
});
|
|
45
45
|
Object.defineProperty(exports, "createAttachmentUpload", {
|
|
46
46
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkZPGIIKEZ_cjs.createAttachmentUpload; }
|
|
48
48
|
});
|
|
49
49
|
Object.defineProperty(exports, "createClient", {
|
|
50
50
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkZPGIIKEZ_cjs.createClient; }
|
|
52
52
|
});
|
|
53
53
|
Object.defineProperty(exports, "createObjectSpecifierFromPrimaryKey", {
|
|
54
54
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkZPGIIKEZ_cjs.createObjectSpecifierFromPrimaryKey; }
|
|
56
56
|
});
|
|
57
57
|
Object.defineProperty(exports, "extractPrimaryKeyFromObjectSpecifier", {
|
|
58
58
|
enumerable: true,
|
|
59
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkZPGIIKEZ_cjs.extractPrimaryKeyFromObjectSpecifier; }
|
|
60
60
|
});
|
|
61
61
|
Object.defineProperty(exports, "getWireObjectSet", {
|
|
62
62
|
enumerable: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkZPGIIKEZ_cjs = require('../chunk-ZPGIIKEZ.cjs');
|
|
4
4
|
var chunkBWOPPEUP_cjs = require('../chunk-BWOPPEUP.cjs');
|
|
5
5
|
require('../chunk-GSVXEVM4.cjs');
|
|
6
6
|
require('../chunk-D26YLHTV.cjs');
|
|
@@ -1533,7 +1533,7 @@ var FunctionParamsCanonicalizer = class {
|
|
|
1533
1533
|
path.push("$:map_end");
|
|
1534
1534
|
return arr;
|
|
1535
1535
|
}
|
|
1536
|
-
if (
|
|
1536
|
+
if (chunkZPGIIKEZ_cjs.isObjectSpecifiersObject(value)) {
|
|
1537
1537
|
const objectType = value.$objectType ?? value.$apiName;
|
|
1538
1538
|
path.push("$:osdk", objectType, value.$primaryKey);
|
|
1539
1539
|
return {
|
|
@@ -1659,7 +1659,7 @@ var FunctionQuery = class extends Query {
|
|
|
1659
1659
|
}).debug("calling _fetchAndStore");
|
|
1660
1660
|
}
|
|
1661
1661
|
try {
|
|
1662
|
-
const result = await
|
|
1662
|
+
const result = await chunkZPGIIKEZ_cjs.applyQuery(this.store.client[chunkBWOPPEUP_cjs.additionalContext], this.#queryDef, this.#params);
|
|
1663
1663
|
const executedAt = Date.now();
|
|
1664
1664
|
this.store.batch({}, (batch) => {
|
|
1665
1665
|
this.writeToStore({
|
|
@@ -1824,6 +1824,56 @@ var CachingCanonicalizer = class {
|
|
|
1824
1824
|
}
|
|
1825
1825
|
};
|
|
1826
1826
|
|
|
1827
|
+
// src/observable/internal/GenericCanonicalizer.ts
|
|
1828
|
+
var MAX_FINGERPRINT_DEPTH = 5;
|
|
1829
|
+
var GenericCanonicalizer = class extends CachingCanonicalizer {
|
|
1830
|
+
#trie = new trie.Trie();
|
|
1831
|
+
#existingValues = /* @__PURE__ */ new Map();
|
|
1832
|
+
canonicalize(input) {
|
|
1833
|
+
return super.canonicalize(input);
|
|
1834
|
+
}
|
|
1835
|
+
lookupOrCreate(input) {
|
|
1836
|
+
const structuralKey = this.#collectSortedKeys(input);
|
|
1837
|
+
const cacheKey = this.#trie.lookupArray(structuralKey);
|
|
1838
|
+
const entry = this.#existingValues.get(cacheKey) ?? {
|
|
1839
|
+
values: []
|
|
1840
|
+
};
|
|
1841
|
+
this.#existingValues.set(cacheKey, entry);
|
|
1842
|
+
for (let i = entry.values.length - 1; i >= 0; i--) {
|
|
1843
|
+
const existing = entry.values[i].deref();
|
|
1844
|
+
if (!existing) {
|
|
1845
|
+
entry.values.splice(i, 1);
|
|
1846
|
+
continue;
|
|
1847
|
+
}
|
|
1848
|
+
if (deepEqual__default.default(existing, input)) {
|
|
1849
|
+
return existing;
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
const canonical = input;
|
|
1853
|
+
entry.values.push(new WeakRef(canonical));
|
|
1854
|
+
return canonical;
|
|
1855
|
+
}
|
|
1856
|
+
#collectSortedKeys(obj, depth = 0) {
|
|
1857
|
+
if (depth > MAX_FINGERPRINT_DEPTH || !obj || typeof obj !== "object") {
|
|
1858
|
+
return [];
|
|
1859
|
+
}
|
|
1860
|
+
if (Array.isArray(obj)) {
|
|
1861
|
+
const result2 = ["[]", String(obj.length)];
|
|
1862
|
+
for (const item of obj) {
|
|
1863
|
+
result2.push(...this.#collectSortedKeys(item, depth + 1));
|
|
1864
|
+
}
|
|
1865
|
+
return result2;
|
|
1866
|
+
}
|
|
1867
|
+
const record = obj;
|
|
1868
|
+
const result = [];
|
|
1869
|
+
for (const key of Object.keys(record).sort()) {
|
|
1870
|
+
result.push(key);
|
|
1871
|
+
result.push(...this.#collectSortedKeys(record[key], depth + 1));
|
|
1872
|
+
}
|
|
1873
|
+
return result;
|
|
1874
|
+
}
|
|
1875
|
+
};
|
|
1876
|
+
|
|
1827
1877
|
// src/observable/internal/IntersectCanonicalizer.ts
|
|
1828
1878
|
var IntersectCanonicalizer = class extends CachingCanonicalizer {
|
|
1829
1879
|
structuralCache = /* @__PURE__ */ new Map();
|
|
@@ -1833,7 +1883,7 @@ var IntersectCanonicalizer = class extends CachingCanonicalizer {
|
|
|
1833
1883
|
}
|
|
1834
1884
|
lookupOrCreate(intersectWith) {
|
|
1835
1885
|
const canonicalClauses = intersectWith.map((item) => this.whereCanonicalizer.canonicalize(item.where ?? {}));
|
|
1836
|
-
const structuralKey = canonicalClauses.map((clause) => JSON.stringify(clause)).join("||");
|
|
1886
|
+
const structuralKey = canonicalClauses.map((clause) => JSON.stringify(clause)).sort().join("||");
|
|
1837
1887
|
let canonical = this.structuralCache.get(structuralKey);
|
|
1838
1888
|
if (!canonical) {
|
|
1839
1889
|
canonical = canonicalClauses;
|
|
@@ -3488,7 +3538,7 @@ var InterfaceListQuery = class extends ListQuery {
|
|
|
3488
3538
|
}
|
|
3489
3539
|
extractRelevantObjects(changes) {
|
|
3490
3540
|
const matchesApiName = ([, object]) => {
|
|
3491
|
-
return this.apiName in object[
|
|
3541
|
+
return this.apiName in object[chunkZPGIIKEZ_cjs.ObjectDefRef].interfaceMap;
|
|
3492
3542
|
};
|
|
3493
3543
|
const added = Array.from(changes.addedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
|
|
3494
3544
|
const modified = Array.from(changes.modifiedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
|
|
@@ -3708,8 +3758,8 @@ function stripRdpFields(value, rdpFields) {
|
|
|
3708
3758
|
if (rdpFields.size === 0) {
|
|
3709
3759
|
return value;
|
|
3710
3760
|
}
|
|
3711
|
-
const underlying = value[
|
|
3712
|
-
const objectDef = value[
|
|
3761
|
+
const underlying = value[chunkZPGIIKEZ_cjs.UnderlyingOsdkObject];
|
|
3762
|
+
const objectDef = value[chunkZPGIIKEZ_cjs.ObjectDefRef];
|
|
3713
3763
|
const newProps = {
|
|
3714
3764
|
$apiName: underlying.$apiName,
|
|
3715
3765
|
$objectType: underlying.$objectType,
|
|
@@ -3722,7 +3772,7 @@ function stripRdpFields(value, rdpFields) {
|
|
|
3722
3772
|
newProps[key] = underlying[key];
|
|
3723
3773
|
}
|
|
3724
3774
|
}
|
|
3725
|
-
return
|
|
3775
|
+
return chunkZPGIIKEZ_cjs.createOsdkObject(value[chunkZPGIIKEZ_cjs.ClientRef], objectDef, newProps);
|
|
3726
3776
|
}
|
|
3727
3777
|
function isSuperset(superset, subset) {
|
|
3728
3778
|
for (const field of subset) {
|
|
@@ -3733,8 +3783,8 @@ function isSuperset(superset, subset) {
|
|
|
3733
3783
|
return true;
|
|
3734
3784
|
}
|
|
3735
3785
|
function filterToRdpFields(value, rdpFieldsToKeep, sourceRdpFields) {
|
|
3736
|
-
const underlying = value[
|
|
3737
|
-
const objectDef = value[
|
|
3786
|
+
const underlying = value[chunkZPGIIKEZ_cjs.UnderlyingOsdkObject];
|
|
3787
|
+
const objectDef = value[chunkZPGIIKEZ_cjs.ObjectDefRef];
|
|
3738
3788
|
const newProps = {
|
|
3739
3789
|
$apiName: underlying.$apiName,
|
|
3740
3790
|
$objectType: underlying.$objectType,
|
|
@@ -3750,12 +3800,12 @@ function filterToRdpFields(value, rdpFieldsToKeep, sourceRdpFields) {
|
|
|
3750
3800
|
}
|
|
3751
3801
|
}
|
|
3752
3802
|
}
|
|
3753
|
-
return
|
|
3803
|
+
return chunkZPGIIKEZ_cjs.createOsdkObject(value[chunkZPGIIKEZ_cjs.ClientRef], objectDef, newProps);
|
|
3754
3804
|
}
|
|
3755
3805
|
function mergeSelectFields(sourceValue, selectFields, existingValue) {
|
|
3756
|
-
const sourceUnderlying = sourceValue[
|
|
3757
|
-
const existingUnderlying = existingValue[
|
|
3758
|
-
const objectDef = sourceValue[
|
|
3806
|
+
const sourceUnderlying = sourceValue[chunkZPGIIKEZ_cjs.UnderlyingOsdkObject];
|
|
3807
|
+
const existingUnderlying = existingValue[chunkZPGIIKEZ_cjs.UnderlyingOsdkObject];
|
|
3808
|
+
const objectDef = sourceValue[chunkZPGIIKEZ_cjs.ObjectDefRef];
|
|
3759
3809
|
const newProps = {
|
|
3760
3810
|
$apiName: sourceUnderlying.$apiName,
|
|
3761
3811
|
$objectType: sourceUnderlying.$objectType,
|
|
@@ -3773,7 +3823,7 @@ function mergeSelectFields(sourceValue, selectFields, existingValue) {
|
|
|
3773
3823
|
newProps[key] = sourceUnderlying[key];
|
|
3774
3824
|
}
|
|
3775
3825
|
}
|
|
3776
|
-
return
|
|
3826
|
+
return chunkZPGIIKEZ_cjs.createOsdkObject(sourceValue[chunkZPGIIKEZ_cjs.ClientRef], objectDef, newProps);
|
|
3777
3827
|
}
|
|
3778
3828
|
function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, targetCurrentValue) {
|
|
3779
3829
|
if (targetRdpFields.size === 0) {
|
|
@@ -3785,8 +3835,8 @@ function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, target
|
|
|
3785
3835
|
}
|
|
3786
3836
|
return filterToRdpFields(sourceValue, targetRdpFields, sourceRdpFields);
|
|
3787
3837
|
}
|
|
3788
|
-
const sourceUnderlying = sourceValue[
|
|
3789
|
-
const objectDef = sourceValue[
|
|
3838
|
+
const sourceUnderlying = sourceValue[chunkZPGIIKEZ_cjs.UnderlyingOsdkObject];
|
|
3839
|
+
const objectDef = sourceValue[chunkZPGIIKEZ_cjs.ObjectDefRef];
|
|
3790
3840
|
const newProps = {
|
|
3791
3841
|
$apiName: sourceUnderlying.$apiName,
|
|
3792
3842
|
$objectType: sourceUnderlying.$objectType,
|
|
@@ -3800,7 +3850,7 @@ function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, target
|
|
|
3800
3850
|
}
|
|
3801
3851
|
}
|
|
3802
3852
|
if (targetCurrentValue) {
|
|
3803
|
-
const targetUnderlying = targetCurrentValue[
|
|
3853
|
+
const targetUnderlying = targetCurrentValue[chunkZPGIIKEZ_cjs.UnderlyingOsdkObject];
|
|
3804
3854
|
for (const field of targetRdpFields) {
|
|
3805
3855
|
if (field in targetUnderlying) {
|
|
3806
3856
|
if (!sourceRdpFields.has(field) || newProps[field] === void 0) {
|
|
@@ -3809,7 +3859,7 @@ function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, target
|
|
|
3809
3859
|
}
|
|
3810
3860
|
}
|
|
3811
3861
|
}
|
|
3812
|
-
return
|
|
3862
|
+
return chunkZPGIIKEZ_cjs.createOsdkObject(sourceValue[chunkZPGIIKEZ_cjs.ClientRef], objectDef, newProps);
|
|
3813
3863
|
}
|
|
3814
3864
|
|
|
3815
3865
|
// src/observable/internal/object/ObjectCacheKeyRegistry.ts
|
|
@@ -4216,7 +4266,7 @@ var ObjectsHelper = class extends AbstractHelper {
|
|
|
4216
4266
|
select,
|
|
4217
4267
|
$loadPropertySecurityMetadata
|
|
4218
4268
|
} = options;
|
|
4219
|
-
const defType =
|
|
4269
|
+
const defType = chunkZPGIIKEZ_cjs.getDefType(options.apiName);
|
|
4220
4270
|
const objectCacheKey = this.cacheKeys.get("object", apiName, pk, rdpConfig ?? void 0);
|
|
4221
4271
|
return this.store.queries.get(objectCacheKey, () => new ObjectQuery(this.store, this.store.subjects.get(objectCacheKey), apiName, pk, objectCacheKey, {
|
|
4222
4272
|
dedupeInterval: 0
|
|
@@ -4254,7 +4304,7 @@ var ObjectsHelper = class extends AbstractHelper {
|
|
|
4254
4304
|
if (valueToWrite !== tombstone && existing?.value && this.isObjectHolder(existing.value)) {
|
|
4255
4305
|
const expectedRdpFields = this.store.objectCacheKeyRegistry.getRdpFieldSet(sourceCacheKey);
|
|
4256
4306
|
if (expectedRdpFields.size > 0) {
|
|
4257
|
-
const underlying = valueToWrite[
|
|
4307
|
+
const underlying = valueToWrite[chunkZPGIIKEZ_cjs.UnderlyingOsdkObject];
|
|
4258
4308
|
const actualRdpFields = /* @__PURE__ */ new Set();
|
|
4259
4309
|
for (const field of expectedRdpFields) {
|
|
4260
4310
|
if (underlying && field in underlying) {
|
|
@@ -4316,11 +4366,13 @@ var ObjectsHelper = class extends AbstractHelper {
|
|
|
4316
4366
|
};
|
|
4317
4367
|
|
|
4318
4368
|
// src/observable/internal/objectset/ObjectSetQuery.ts
|
|
4319
|
-
var ObjectSetQuery = class extends BaseListQuery {
|
|
4369
|
+
var ObjectSetQuery = class _ObjectSetQuery extends BaseListQuery {
|
|
4320
4370
|
#baseObjectSetWire;
|
|
4321
4371
|
#operations;
|
|
4322
4372
|
#composedObjectSet;
|
|
4323
4373
|
#objectTypes;
|
|
4374
|
+
#requiresServerEvaluation;
|
|
4375
|
+
#resultTypeApiName;
|
|
4324
4376
|
constructor(store, subject, baseObjectSetWire, operations, cacheKey, opts) {
|
|
4325
4377
|
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkBWOPPEUP_cjs.additionalContext].logger?.child({}, {
|
|
4326
4378
|
msgPrefix: `ObjectSetQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
@@ -4328,7 +4380,10 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
4328
4380
|
this.#baseObjectSetWire = baseObjectSetWire;
|
|
4329
4381
|
this.#operations = operations;
|
|
4330
4382
|
this.#composedObjectSet = this.#composeObjectSet(opts);
|
|
4331
|
-
|
|
4383
|
+
const baseWire = JSON.parse(baseObjectSetWire);
|
|
4384
|
+
this.#objectTypes = this.#extractObjectTypes(baseWire, opts);
|
|
4385
|
+
this.#requiresServerEvaluation = !!(operations.pivotTo || operations.union && operations.union.length > 0 || operations.intersect && operations.intersect.length > 0 || operations.subtract && operations.subtract.length > 0);
|
|
4386
|
+
this.#resultTypeApiName = _ObjectSetQuery.#extractTypeFromWireObjectSet(baseWire) ?? "";
|
|
4332
4387
|
if (opts.autoFetchMore === true) {
|
|
4333
4388
|
this.minResultsToLoad = Number.MAX_SAFE_INTEGER;
|
|
4334
4389
|
} else if (typeof opts.autoFetchMore === "number") {
|
|
@@ -4337,6 +4392,9 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
4337
4392
|
this.minResultsToLoad = opts.pageSize || 0;
|
|
4338
4393
|
}
|
|
4339
4394
|
}
|
|
4395
|
+
get objectTypes() {
|
|
4396
|
+
return this.#objectTypes;
|
|
4397
|
+
}
|
|
4340
4398
|
get rdpConfig() {
|
|
4341
4399
|
return this.#operations.withProperties ?? null;
|
|
4342
4400
|
}
|
|
@@ -4368,37 +4426,36 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
4368
4426
|
}
|
|
4369
4427
|
return result;
|
|
4370
4428
|
}
|
|
4371
|
-
#extractObjectTypes(opts) {
|
|
4429
|
+
#extractObjectTypes(baseWire, opts) {
|
|
4372
4430
|
const types = /* @__PURE__ */ new Set();
|
|
4373
|
-
const
|
|
4374
|
-
if (
|
|
4375
|
-
types.add(
|
|
4376
|
-
}
|
|
4377
|
-
if (opts.union) {
|
|
4378
|
-
for (const os of opts.union) {
|
|
4379
|
-
const wire = chunkBWOPPEUP_cjs.getWireObjectSet(os);
|
|
4380
|
-
if (wire.type) {
|
|
4381
|
-
types.add(wire.type);
|
|
4382
|
-
}
|
|
4383
|
-
}
|
|
4431
|
+
const baseTypeName = _ObjectSetQuery.#extractTypeFromWireObjectSet(baseWire);
|
|
4432
|
+
if (baseTypeName) {
|
|
4433
|
+
types.add(baseTypeName);
|
|
4384
4434
|
}
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4435
|
+
_ObjectSetQuery.#addTypesFromObjectSets(opts.union, types);
|
|
4436
|
+
_ObjectSetQuery.#addTypesFromObjectSets(opts.intersect, types);
|
|
4437
|
+
_ObjectSetQuery.#addTypesFromObjectSets(opts.subtract, types);
|
|
4438
|
+
return types;
|
|
4439
|
+
}
|
|
4440
|
+
static #addTypesFromObjectSets(sets, types) {
|
|
4441
|
+
if (!sets) {
|
|
4442
|
+
return;
|
|
4392
4443
|
}
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
types.add(wire.type);
|
|
4398
|
-
}
|
|
4444
|
+
for (const os of sets) {
|
|
4445
|
+
const typeName = _ObjectSetQuery.#extractTypeFromWireObjectSet(chunkBWOPPEUP_cjs.getWireObjectSet(os));
|
|
4446
|
+
if (typeName) {
|
|
4447
|
+
types.add(typeName);
|
|
4399
4448
|
}
|
|
4400
4449
|
}
|
|
4401
|
-
|
|
4450
|
+
}
|
|
4451
|
+
static #extractTypeFromWireObjectSet(wire) {
|
|
4452
|
+
if (wire.type === "base") {
|
|
4453
|
+
return wire.objectType;
|
|
4454
|
+
}
|
|
4455
|
+
if (wire.type === "interfaceBase") {
|
|
4456
|
+
return wire.interfaceType;
|
|
4457
|
+
}
|
|
4458
|
+
return void 0;
|
|
4402
4459
|
}
|
|
4403
4460
|
/**
|
|
4404
4461
|
* Register changes to the cache specific to ObjectSetQuery
|
|
@@ -4451,6 +4508,119 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
4451
4508
|
registerStreamUpdates(sub) {
|
|
4452
4509
|
this.createWebsocketSubscription(this.#composedObjectSet, sub, "observeObjectSet");
|
|
4453
4510
|
}
|
|
4511
|
+
maybeUpdateAndRevalidate = (changes, optimisticId) => {
|
|
4512
|
+
if (process.env.NODE_ENV !== "production") {
|
|
4513
|
+
this.logger?.child({
|
|
4514
|
+
methodName: "maybeUpdateAndRevalidate"
|
|
4515
|
+
}).debug(DEBUG_ONLY__changesToString(changes));
|
|
4516
|
+
this.logger?.child({
|
|
4517
|
+
methodName: "maybeUpdateAndRevalidate"
|
|
4518
|
+
}).debug(`Already in changes? ${changes.modified.has(this.cacheKey)}`);
|
|
4519
|
+
}
|
|
4520
|
+
if (changes.modified.has(this.cacheKey)) {
|
|
4521
|
+
return;
|
|
4522
|
+
}
|
|
4523
|
+
changes.modified.add(this.cacheKey);
|
|
4524
|
+
try {
|
|
4525
|
+
if (this.#requiresServerEvaluation) {
|
|
4526
|
+
return this.#handleServerRevalidation(changes);
|
|
4527
|
+
}
|
|
4528
|
+
return this.#handleLocalUpdate(changes, optimisticId);
|
|
4529
|
+
} finally {
|
|
4530
|
+
if (process.env.NODE_ENV !== "production") {
|
|
4531
|
+
this.logger?.child({
|
|
4532
|
+
methodName: "maybeUpdateAndRevalidate"
|
|
4533
|
+
}).debug("in finally");
|
|
4534
|
+
}
|
|
4535
|
+
}
|
|
4536
|
+
};
|
|
4537
|
+
#handleServerRevalidation(changes) {
|
|
4538
|
+
for (const objectType of this.#objectTypes) {
|
|
4539
|
+
const added = changes.addedObjects.get(objectType);
|
|
4540
|
+
const modified = changes.modifiedObjects.get(objectType);
|
|
4541
|
+
if (added && added.length > 0 || modified && modified.length > 0) {
|
|
4542
|
+
return this.revalidate(true);
|
|
4543
|
+
}
|
|
4544
|
+
}
|
|
4545
|
+
for (const deletedKey of changes.deleted) {
|
|
4546
|
+
if (deletedKey.type === "object" && this.#objectTypes.has(deletedKey.otherKeys[API_NAME_IDX3])) {
|
|
4547
|
+
return this.revalidate(true);
|
|
4548
|
+
}
|
|
4549
|
+
}
|
|
4550
|
+
return void 0;
|
|
4551
|
+
}
|
|
4552
|
+
#getRelevantChanges(changes) {
|
|
4553
|
+
const resultApiName = this.#resultTypeApiName;
|
|
4554
|
+
const addedObjects = changes.addedObjects.get(resultApiName) ?? [];
|
|
4555
|
+
const modifiedObjects = changes.modifiedObjects.get(resultApiName) ?? [];
|
|
4556
|
+
let hasRelevantDeletions = false;
|
|
4557
|
+
for (const key of changes.deleted) {
|
|
4558
|
+
if (key.type === "object" && key.otherKeys[API_NAME_IDX3] === resultApiName) {
|
|
4559
|
+
hasRelevantDeletions = true;
|
|
4560
|
+
break;
|
|
4561
|
+
}
|
|
4562
|
+
}
|
|
4563
|
+
if (addedObjects.length === 0 && modifiedObjects.length === 0 && !hasRelevantDeletions) {
|
|
4564
|
+
return void 0;
|
|
4565
|
+
}
|
|
4566
|
+
return {
|
|
4567
|
+
addedObjects,
|
|
4568
|
+
modifiedObjects
|
|
4569
|
+
};
|
|
4570
|
+
}
|
|
4571
|
+
#handleLocalUpdate(changes, optimisticId) {
|
|
4572
|
+
const whereClause = this.#operations.where;
|
|
4573
|
+
const effectiveWhere = whereClause ?? this.store.whereCanonicalizer.canonicalize({
|
|
4574
|
+
$and: []
|
|
4575
|
+
});
|
|
4576
|
+
const relevant = this.#getRelevantChanges(changes);
|
|
4577
|
+
if (!relevant) {
|
|
4578
|
+
return void 0;
|
|
4579
|
+
}
|
|
4580
|
+
const addedMatches = this.#classifyByWhereMatch(relevant.addedObjects, effectiveWhere);
|
|
4581
|
+
const modifiedMatches = this.#classifyByWhereMatch(relevant.modifiedObjects, effectiveWhere);
|
|
4582
|
+
const status = optimisticId || addedMatches.uncertain.size > 0 || modifiedMatches.uncertain.size > 0 ? "loading" : "loaded";
|
|
4583
|
+
const {
|
|
4584
|
+
retVal: needsRevalidation
|
|
4585
|
+
} = this.store.batch({
|
|
4586
|
+
optimisticId,
|
|
4587
|
+
changes
|
|
4588
|
+
}, (batch) => {
|
|
4589
|
+
const existingKeys = new Set(batch.read(this.cacheKey)?.value?.data);
|
|
4590
|
+
const {
|
|
4591
|
+
newList,
|
|
4592
|
+
needsRevalidation: needsRevalidation2
|
|
4593
|
+
} = reconcileListChanges(existingKeys, addedMatches.definite, relevant.modifiedObjects, modifiedMatches, changes.deleted, batch.optimisticWrite, (obj) => this.#getObjectCacheKey(obj));
|
|
4594
|
+
const existingTotalCount = batch.read(this.cacheKey)?.value?.totalCount;
|
|
4595
|
+
this._updateList(newList, status, batch, {
|
|
4596
|
+
type: "clientOrdered"
|
|
4597
|
+
}, existingTotalCount);
|
|
4598
|
+
return needsRevalidation2;
|
|
4599
|
+
});
|
|
4600
|
+
if (needsRevalidation) {
|
|
4601
|
+
return this.revalidate(true);
|
|
4602
|
+
}
|
|
4603
|
+
return void 0;
|
|
4604
|
+
}
|
|
4605
|
+
#classifyByWhereMatch(objects, whereClause) {
|
|
4606
|
+
const definite = /* @__PURE__ */ new Set();
|
|
4607
|
+
const uncertain = /* @__PURE__ */ new Set();
|
|
4608
|
+
for (const obj of objects) {
|
|
4609
|
+
if (objectSortaMatchesWhereClause(obj, whereClause, true)) {
|
|
4610
|
+
definite.add(obj);
|
|
4611
|
+
} else if (objectSortaMatchesWhereClause(obj, whereClause, false)) {
|
|
4612
|
+
uncertain.add(obj);
|
|
4613
|
+
}
|
|
4614
|
+
}
|
|
4615
|
+
return {
|
|
4616
|
+
definite,
|
|
4617
|
+
uncertain
|
|
4618
|
+
};
|
|
4619
|
+
}
|
|
4620
|
+
#getObjectCacheKey(obj) {
|
|
4621
|
+
const pk = obj.$primaryKey;
|
|
4622
|
+
return this.cacheKeys.get("object", obj.$objectType, pk, this.rdpConfig ?? void 0);
|
|
4623
|
+
}
|
|
4454
4624
|
invalidateObjectType = async (objectType, changes) => {
|
|
4455
4625
|
if (this.#objectTypes.has(objectType)) {
|
|
4456
4626
|
changes?.modified.add(this.cacheKey);
|
|
@@ -4471,15 +4641,46 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
4471
4641
|
};
|
|
4472
4642
|
}
|
|
4473
4643
|
};
|
|
4644
|
+
function reconcileListChanges(existingKeys, addedDefiniteMatches, modifiedObjects, modifiedMatches, deleted, isOptimistic, getObjectCacheKey) {
|
|
4645
|
+
const objectsToInsert = new Set(addedDefiniteMatches);
|
|
4646
|
+
const keysToRemove = new Set(deleted);
|
|
4647
|
+
let needsRevalidation = false;
|
|
4648
|
+
for (const obj of modifiedObjects) {
|
|
4649
|
+
if (modifiedMatches.definite.has(obj)) {
|
|
4650
|
+
if (!existingKeys.has(getObjectCacheKey(obj))) {
|
|
4651
|
+
objectsToInsert.add(obj);
|
|
4652
|
+
}
|
|
4653
|
+
} else if (!isOptimistic) {
|
|
4654
|
+
keysToRemove.add(getObjectCacheKey(obj));
|
|
4655
|
+
if (modifiedMatches.uncertain.has(obj)) {
|
|
4656
|
+
needsRevalidation = true;
|
|
4657
|
+
}
|
|
4658
|
+
}
|
|
4659
|
+
}
|
|
4660
|
+
const newList = [];
|
|
4661
|
+
for (const key of existingKeys) {
|
|
4662
|
+
if (!keysToRemove.has(key)) {
|
|
4663
|
+
newList.push(key);
|
|
4664
|
+
}
|
|
4665
|
+
}
|
|
4666
|
+
for (const obj of objectsToInsert) {
|
|
4667
|
+
newList.push(getObjectCacheKey(obj));
|
|
4668
|
+
}
|
|
4669
|
+
return {
|
|
4670
|
+
newList,
|
|
4671
|
+
needsRevalidation
|
|
4672
|
+
};
|
|
4673
|
+
}
|
|
4474
4674
|
|
|
4475
4675
|
// src/observable/internal/objectset/ObjectSetHelper.ts
|
|
4476
4676
|
var ObjectSetHelper = class extends AbstractHelper {
|
|
4477
|
-
constructor(store, cacheKeys, whereCanonicalizer2, orderByCanonicalizer2, rdpCanonicalizer, selectCanonicalizer) {
|
|
4677
|
+
constructor(store, cacheKeys, whereCanonicalizer2, orderByCanonicalizer2, rdpCanonicalizer, selectCanonicalizer, objectSetArrayCanonicalizer) {
|
|
4478
4678
|
super(store, cacheKeys);
|
|
4479
4679
|
this.whereCanonicalizer = whereCanonicalizer2;
|
|
4480
4680
|
this.orderByCanonicalizer = orderByCanonicalizer2;
|
|
4481
4681
|
this.rdpCanonicalizer = rdpCanonicalizer;
|
|
4482
4682
|
this.selectCanonicalizer = selectCanonicalizer;
|
|
4683
|
+
this.objectSetArrayCanonicalizer = objectSetArrayCanonicalizer;
|
|
4483
4684
|
}
|
|
4484
4685
|
observe(options, subFn) {
|
|
4485
4686
|
const ret = super.observe(options, subFn);
|
|
@@ -4508,13 +4709,13 @@ var ObjectSetHelper = class extends AbstractHelper {
|
|
|
4508
4709
|
operations.withProperties = this.rdpCanonicalizer.canonicalize(options.withProperties);
|
|
4509
4710
|
}
|
|
4510
4711
|
if (options.union && options.union.length > 0) {
|
|
4511
|
-
operations.union = options.union.map((os) => JSON.stringify(chunkBWOPPEUP_cjs.getWireObjectSet(os)));
|
|
4712
|
+
operations.union = this.objectSetArrayCanonicalizer.canonicalizeUnion(options.union.map((os) => JSON.stringify(chunkBWOPPEUP_cjs.getWireObjectSet(os))));
|
|
4512
4713
|
}
|
|
4513
4714
|
if (options.intersect && options.intersect.length > 0) {
|
|
4514
|
-
operations.intersect = options.intersect.map((os) => JSON.stringify(chunkBWOPPEUP_cjs.getWireObjectSet(os)));
|
|
4715
|
+
operations.intersect = this.objectSetArrayCanonicalizer.canonicalizeIntersect(options.intersect.map((os) => JSON.stringify(chunkBWOPPEUP_cjs.getWireObjectSet(os))));
|
|
4515
4716
|
}
|
|
4516
4717
|
if (options.subtract && options.subtract.length > 0) {
|
|
4517
|
-
operations.subtract = options.subtract.map((os) => JSON.stringify(chunkBWOPPEUP_cjs.getWireObjectSet(os)));
|
|
4718
|
+
operations.subtract = this.objectSetArrayCanonicalizer.canonicalizeSubtract(options.subtract.map((os) => JSON.stringify(chunkBWOPPEUP_cjs.getWireObjectSet(os))));
|
|
4518
4719
|
}
|
|
4519
4720
|
if (options.pivotTo) {
|
|
4520
4721
|
operations.pivotTo = options.pivotTo;
|
|
@@ -4535,6 +4736,24 @@ var ObjectSetHelper = class extends AbstractHelper {
|
|
|
4535
4736
|
}
|
|
4536
4737
|
};
|
|
4537
4738
|
|
|
4739
|
+
// src/observable/internal/ObjectSetArrayCanonicalizer.ts
|
|
4740
|
+
var ObjectSetArrayCanonicalizer = class {
|
|
4741
|
+
#unionTrie = new WeakRefTrie();
|
|
4742
|
+
#intersectTrie = new WeakRefTrie();
|
|
4743
|
+
#subtractTrie = new WeakRefTrie();
|
|
4744
|
+
canonicalizeUnion(items) {
|
|
4745
|
+
const sorted = [...items].sort();
|
|
4746
|
+
return this.#unionTrie.lookupArray(sorted);
|
|
4747
|
+
}
|
|
4748
|
+
canonicalizeIntersect(items) {
|
|
4749
|
+
const sorted = [...items].sort();
|
|
4750
|
+
return this.#intersectTrie.lookupArray(sorted);
|
|
4751
|
+
}
|
|
4752
|
+
canonicalizeSubtract(items) {
|
|
4753
|
+
return this.#subtractTrie.lookupArray(items);
|
|
4754
|
+
}
|
|
4755
|
+
};
|
|
4756
|
+
|
|
4538
4757
|
// src/observable/internal/PivotCanonicalizer.ts
|
|
4539
4758
|
var PivotCanonicalizer = class {
|
|
4540
4759
|
#cache = /* @__PURE__ */ new Map();
|
|
@@ -4662,6 +4881,8 @@ var Store = class {
|
|
|
4662
4881
|
pivotCanonicalizer = new PivotCanonicalizer();
|
|
4663
4882
|
ridListCanonicalizer = new RidListCanonicalizer();
|
|
4664
4883
|
selectCanonicalizer = new SelectCanonicalizer();
|
|
4884
|
+
objectSetArrayCanonicalizer = new ObjectSetArrayCanonicalizer();
|
|
4885
|
+
genericCanonicalizer = new GenericCanonicalizer();
|
|
4665
4886
|
/** @internal */
|
|
4666
4887
|
queries = new Queries();
|
|
4667
4888
|
/**
|
|
@@ -4695,7 +4916,7 @@ var Store = class {
|
|
|
4695
4916
|
this.lists = new ListsHelper(this, this.cacheKeys, this.whereCanonicalizer, this.orderByCanonicalizer, this.rdpCanonicalizer, this.intersectCanonicalizer, this.pivotCanonicalizer, this.ridListCanonicalizer, this.selectCanonicalizer);
|
|
4696
4917
|
this.objects = new ObjectsHelper(this, this.cacheKeys);
|
|
4697
4918
|
this.links = new LinksHelper(this, this.cacheKeys, this.whereCanonicalizer, this.orderByCanonicalizer, this.selectCanonicalizer);
|
|
4698
|
-
this.objectSets = new ObjectSetHelper(this, this.cacheKeys, this.whereCanonicalizer, this.orderByCanonicalizer, this.rdpCanonicalizer, this.selectCanonicalizer);
|
|
4919
|
+
this.objectSets = new ObjectSetHelper(this, this.cacheKeys, this.whereCanonicalizer, this.orderByCanonicalizer, this.rdpCanonicalizer, this.selectCanonicalizer, this.objectSetArrayCanonicalizer);
|
|
4699
4920
|
}
|
|
4700
4921
|
/**
|
|
4701
4922
|
* Called after a key is no longer retained and the timeout has elapsed
|
|
@@ -4827,6 +5048,17 @@ var Store = class {
|
|
|
4827
5048
|
* @returns true if the query should be notified based on object type changes
|
|
4828
5049
|
*/
|
|
4829
5050
|
#shouldPropagateForObjectTypeChanges(cacheKey, changes) {
|
|
5051
|
+
if (cacheKey.type === "objectSet") {
|
|
5052
|
+
const query = this.queries.peek(cacheKey);
|
|
5053
|
+
if (query) {
|
|
5054
|
+
for (const objectType of query.objectTypes) {
|
|
5055
|
+
if (this.#changesAffectObjectType(changes, objectType)) {
|
|
5056
|
+
return true;
|
|
5057
|
+
}
|
|
5058
|
+
}
|
|
5059
|
+
}
|
|
5060
|
+
return false;
|
|
5061
|
+
}
|
|
4830
5062
|
const queryObjectType = this.#getQueryObjectType(cacheKey);
|
|
4831
5063
|
if (!queryObjectType) {
|
|
4832
5064
|
return false;
|
|
@@ -4900,6 +5132,11 @@ var Store = class {
|
|
|
4900
5132
|
if (modifiedForType && modifiedForType.length > 0) {
|
|
4901
5133
|
return true;
|
|
4902
5134
|
}
|
|
5135
|
+
for (const deletedKey of changes.deleted) {
|
|
5136
|
+
if (deletedKey.type === "object" && deletedKey.otherKeys[API_NAME_IDX3] === objectType) {
|
|
5137
|
+
return true;
|
|
5138
|
+
}
|
|
5139
|
+
}
|
|
4903
5140
|
return false;
|
|
4904
5141
|
}
|
|
4905
5142
|
/**
|
|
@@ -4961,10 +5198,10 @@ var Store = class {
|
|
|
4961
5198
|
|
|
4962
5199
|
// src/observable/ObservableClient.ts
|
|
4963
5200
|
function createObservableClient(client) {
|
|
4964
|
-
const tweakedClient =
|
|
5201
|
+
const tweakedClient = chunkZPGIIKEZ_cjs.createClientFromContext({
|
|
4965
5202
|
...client[chunkBWOPPEUP_cjs.additionalContext],
|
|
4966
5203
|
fetch: shared_net_fetch.createFetchHeaderMutator(client[chunkBWOPPEUP_cjs.additionalContext].fetch, (headers) => {
|
|
4967
|
-
headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"),
|
|
5204
|
+
headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"), chunkZPGIIKEZ_cjs.OBSERVABLE_USER_AGENT].filter((x) => x && x?.length > 0).join(" "));
|
|
4968
5205
|
return headers;
|
|
4969
5206
|
})
|
|
4970
5207
|
});
|
|
@@ -5007,7 +5244,7 @@ function getOsdkConfig(ontologyRid) {
|
|
|
5007
5244
|
|
|
5008
5245
|
Object.defineProperty(exports, "createClientWithTransaction", {
|
|
5009
5246
|
enumerable: true,
|
|
5010
|
-
get: function () { return
|
|
5247
|
+
get: function () { return chunkZPGIIKEZ_cjs.createClientWithTransaction; }
|
|
5011
5248
|
});
|
|
5012
5249
|
Object.defineProperty(exports, "augment", {
|
|
5013
5250
|
enumerable: true,
|