@osdk/client 2.2.0-beta.6 → 2.2.0-beta.7
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 +18 -0
- package/build/browser/actions/actions.test.js +52 -4
- package/build/browser/actions/actions.test.js.map +1 -1
- package/build/browser/actions/applyAction.js +21 -15
- package/build/browser/actions/applyAction.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/browser/observable/internal/Store.js +1 -1
- package/build/browser/observable/internal/Store.js.map +1 -1
- package/build/browser/observable/internal/testUtils.js +2 -0
- package/build/browser/observable/internal/testUtils.js.map +1 -1
- package/build/browser/util/UserAgent.js +1 -1
- package/build/cjs/{chunk-2FVV5A63.cjs → chunk-IU47QMYO.cjs} +48 -48
- package/build/cjs/chunk-IU47QMYO.cjs.map +1 -0
- package/build/cjs/{chunk-X7WGNFZ4.cjs → chunk-JPENHIJB.cjs} +19 -19
- package/build/cjs/chunk-JPENHIJB.cjs.map +1 -0
- package/build/cjs/{graphql-JJX5MZPQ.cjs → graphql-RGM5SRWV.cjs} +306 -265
- package/build/cjs/graphql-RGM5SRWV.cjs.map +1 -0
- package/build/cjs/index.cjs +105 -99
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/public/internal.cjs +6 -6
- package/build/cjs/public/internal.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.cjs +41 -70
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/esm/actions/actions.test.js +52 -4
- package/build/esm/actions/actions.test.js.map +1 -1
- package/build/esm/actions/applyAction.js +21 -15
- package/build/esm/actions/applyAction.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/esm/observable/internal/Store.js +1 -1
- package/build/esm/observable/internal/Store.js.map +1 -1
- package/build/esm/observable/internal/testUtils.js +2 -0
- package/build/esm/observable/internal/testUtils.js.map +1 -1
- package/build/esm/util/UserAgent.js +1 -1
- package/build/types/actions/applyAction.d.ts.map +1 -1
- package/build/types/observable/internal/testUtils.d.ts.map +1 -1
- package/package.json +9 -9
- package/build/cjs/chunk-2FVV5A63.cjs.map +0 -1
- package/build/cjs/chunk-X7WGNFZ4.cjs.map +0 -1
- package/build/cjs/graphql-JJX5MZPQ.cjs.map +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkIU47QMYO_cjs = require('../chunk-IU47QMYO.cjs');
|
|
4
|
+
var chunkJPENHIJB_cjs = require('../chunk-JPENHIJB.cjs');
|
|
5
5
|
require('../chunk-Q7SFCCGT.cjs');
|
|
6
6
|
|
|
7
7
|
// src/public-utils/createAndFetchTempObjectSetRid.ts
|
|
8
8
|
async function createAndFetchTempObjectSetRid(client, objectSet) {
|
|
9
|
-
const response = await
|
|
10
|
-
objectSet:
|
|
9
|
+
const response = await chunkJPENHIJB_cjs.OntologyObjectSet_exports.createTemporary(client, await client[chunkJPENHIJB_cjs.additionalContext].ontologyRid, {
|
|
10
|
+
objectSet: chunkIU47QMYO_cjs.getWireObjectSet(objectSet)
|
|
11
11
|
});
|
|
12
12
|
return response.objectSetRid;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
// src/public-utils/hydrateObjectSetFromRid.ts
|
|
16
16
|
function hydrateObjectSetFromRid(client, definition, rid) {
|
|
17
|
-
return
|
|
17
|
+
return chunkIU47QMYO_cjs.createObjectSet(definition, client[chunkJPENHIJB_cjs.additionalContext], {
|
|
18
18
|
type: "intersect",
|
|
19
19
|
objectSets: [{
|
|
20
20
|
type: "base",
|
|
@@ -28,7 +28,7 @@ function hydrateObjectSetFromRid(client, definition, rid) {
|
|
|
28
28
|
|
|
29
29
|
Object.defineProperty(exports, "hydrateAttachmentFromRid", {
|
|
30
30
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkIU47QMYO_cjs.hydrateAttachmentFromRid; }
|
|
32
32
|
});
|
|
33
33
|
exports.createAndFetchTempObjectSetRid = createAndFetchTempObjectSetRid;
|
|
34
34
|
exports.hydrateObjectSetFromRid = hydrateObjectSetFromRid;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/public-utils/createAndFetchTempObjectSetRid.ts","../../../src/public-utils/hydrateObjectSetFromRid.ts"],"names":["OntologyObjectSet_exports","additionalContext","getWireObjectSet","createObjectSet"],"mappings":";;;;;;;AA2BA,eAAsB,8BAAA,CAA+B,QAAQ,SAAW,EAAA;AACtE,EAAM,MAAA,QAAA,GAAW,MAAMA,2CAAmB,CAAA,eAAA,CAAgB,QAAQ,MAAM,MAAA,CAAOC,mCAAiB,CAAA,CAAE,WAAa,EAAA;AAAA,IAC7G,SAAA,EAAWC,mCAAiB,SAAS
|
|
1
|
+
{"version":3,"sources":["../../../src/public-utils/createAndFetchTempObjectSetRid.ts","../../../src/public-utils/hydrateObjectSetFromRid.ts"],"names":["OntologyObjectSet_exports","additionalContext","getWireObjectSet","createObjectSet"],"mappings":";;;;;;;AA2BA,eAAsB,8BAAA,CAA+B,QAAQ,SAAW,EAAA;AACtE,EAAM,MAAA,QAAA,GAAW,MAAMA,2CAAmB,CAAA,eAAA,CAAgB,QAAQ,MAAM,MAAA,CAAOC,mCAAiB,CAAA,CAAE,WAAa,EAAA;AAAA,IAC7G,SAAA,EAAWC,mCAAiB,SAAS;AAAA,GACtC,CAAA;AACD,EAAA,OAAO,QAAS,CAAA,YAAA;AAClB;;;ACNO,SAAS,uBAAA,CAAwB,MAAQ,EAAA,UAAA,EAAY,GAAK,EAAA;AAC/D,EAAA,OAAOC,iCAAgB,CAAA,UAAA,EAAY,MAAO,CAAAF,mCAAiB,CAAG,EAAA;AAAA,IAC5D,IAAM,EAAA,WAAA;AAAA,IACN,YAAY,CAAC;AAAA,MACX,IAAM,EAAA,MAAA;AAAA,MACN,YAAY,UAAW,CAAA;AAAA,KACtB,EAAA;AAAA,MACD,IAAM,EAAA,WAAA;AAAA,MACN,SAAW,EAAA;AAAA,KACZ;AAAA,GACF,CAAA;AACH","file":"internal.cjs","sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { OntologyObjectSets } from \"@osdk/foundry.ontologies\";\nimport { additionalContext } from \"../Client.js\";\nimport { getWireObjectSet } from \"../objectSet/createObjectSet.js\";\n\n/**\n * Fetches a temporary object set RID from the Foundry stack for the given object set.\n *\n * @param client - An OSDK client.\n * @param objectSet - The object set to fetch a RID for.\n * @returns A promise that resolves to the RID of the temporary object set.\n */\nexport async function createAndFetchTempObjectSetRid(client, objectSet) {\n const response = await OntologyObjectSets.createTemporary(client, await client[additionalContext].ontologyRid, {\n objectSet: getWireObjectSet(objectSet)\n });\n return response.objectSetRid;\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { additionalContext } from \"../Client.js\";\nimport { createObjectSet } from \"../objectSet/createObjectSet.js\";\n\n/**\n * Creates an OSDK object set from an object set RID.\n * @param client - An OSDK client.\n * @param definition - An OSDK object or interface definition.\n * @param rid - The RID of an object set.\n * @returns An OSDK object set.\n */\nexport function hydrateObjectSetFromRid(client, definition, rid) {\n return createObjectSet(definition, client[additionalContext], {\n type: \"intersect\",\n objectSets: [{\n type: \"base\",\n objectType: definition.apiName\n }, {\n type: \"reference\",\n reference: rid\n }]\n });\n}"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkJPENHIJB_cjs = require('../chunk-JPENHIJB.cjs');
|
|
4
4
|
require('../chunk-Q7SFCCGT.cjs');
|
|
5
5
|
var rxjs = require('rxjs');
|
|
6
6
|
var invariant2 = require('tiny-invariant');
|
|
@@ -34,7 +34,7 @@ var ObservableClientImpl = class {
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
// src/observable/DebugFlags.ts
|
|
37
|
-
|
|
37
|
+
process.env.NODE_ENV !== "production" && false;
|
|
38
38
|
var DEBUG_CACHE_KEYS = process.env.NODE_ENV !== "production" && false;
|
|
39
39
|
|
|
40
40
|
// ../../node_modules/.pnpm/is-node-process@1.2.0/node_modules/is-node-process/lib/index.mjs
|
|
@@ -139,7 +139,7 @@ function multimapHelper(multimap) {
|
|
|
139
139
|
// src/observable/internal/OptimisticId.ts
|
|
140
140
|
function createOptimisticId() {
|
|
141
141
|
if (process.env.NODE_ENV !== "production") {
|
|
142
|
-
if (createOptimisticId.counter ===
|
|
142
|
+
if (createOptimisticId.counter === undefined) {
|
|
143
143
|
createOptimisticId.counter = 0;
|
|
144
144
|
}
|
|
145
145
|
return {
|
|
@@ -183,12 +183,12 @@ var OptimisticJob = class {
|
|
|
183
183
|
return this;
|
|
184
184
|
},
|
|
185
185
|
createObject(type, pk, properties) {
|
|
186
|
-
const create = store.client[
|
|
186
|
+
const create = store.client[chunkJPENHIJB_cjs.additionalContext].objectFactory2(store.client[chunkJPENHIJB_cjs.additionalContext], [{
|
|
187
187
|
$primaryKey: pk,
|
|
188
188
|
$apiName: type.apiName,
|
|
189
189
|
$objectType: type.apiName,
|
|
190
190
|
...properties
|
|
191
|
-
}],
|
|
191
|
+
}], undefined).then((objs) => {
|
|
192
192
|
return objs[0];
|
|
193
193
|
});
|
|
194
194
|
addedObjectPromises.push(create);
|
|
@@ -208,7 +208,7 @@ function runOptimisticJob(store, optimisticUpdate) {
|
|
|
208
208
|
return () => {
|
|
209
209
|
return optimisticApplicationDone.then(
|
|
210
210
|
// we don't want to leak the result
|
|
211
|
-
() =>
|
|
211
|
+
() => undefined
|
|
212
212
|
).finally(() => {
|
|
213
213
|
store.removeLayer(optimisticId);
|
|
214
214
|
});
|
|
@@ -298,15 +298,11 @@ var CacheKeys = class {
|
|
|
298
298
|
constructor(whereCanonicalizer, orderByCanonicalizer, onCreate) {
|
|
299
299
|
this.#onCreate = onCreate;
|
|
300
300
|
this.#registerCacheKeyFactory("object", (apiName, pk) => {
|
|
301
|
-
if (process.env.NODE_ENV !== "production" && DEBUG_CACHE_KEYS)
|
|
302
|
-
console.debug(`CacheKeys.get([object, ${apiName}, ${pk}]) -- already exists? `, this.#cacheKeys.peekArray(["object", apiName, pk]) != null);
|
|
303
|
-
}
|
|
301
|
+
if (process.env.NODE_ENV !== "production" && DEBUG_CACHE_KEYS) ;
|
|
304
302
|
return this.#cacheKeys.lookupArray(["object", apiName, pk]);
|
|
305
303
|
});
|
|
306
304
|
this.#registerCacheKeyFactory("list", (apiName, where, orderBy) => {
|
|
307
|
-
if (process.env.NODE_ENV !== "production" && DEBUG_CACHE_KEYS)
|
|
308
|
-
console.debug(`CacheKeys.get([list, ${apiName}, ${JSON.stringify(where)}, ${JSON.stringify(orderBy)}]) -- already exists? `, this.#cacheKeys.peekArray(["list", apiName, whereCanonicalizer.canonicalize(where), orderByCanonicalizer.canonicalize(orderBy)]) != null);
|
|
309
|
-
}
|
|
305
|
+
if (process.env.NODE_ENV !== "production" && DEBUG_CACHE_KEYS) ;
|
|
310
306
|
return this.#cacheKeys.lookupArray(["list", apiName, whereCanonicalizer.canonicalize(where), orderByCanonicalizer.canonicalize(orderBy)]);
|
|
311
307
|
});
|
|
312
308
|
}
|
|
@@ -315,7 +311,7 @@ var CacheKeys = class {
|
|
|
315
311
|
}
|
|
316
312
|
get(type, ...args) {
|
|
317
313
|
const factory = this.#cacheKeyFactories.get(type);
|
|
318
|
-
!factory ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, `no cache key factory for type "${type}"`) : invariant2__default.default(false) :
|
|
314
|
+
!factory ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, `no cache key factory for type "${type}"`) : invariant2__default.default(false) : undefined;
|
|
319
315
|
return factory(...args);
|
|
320
316
|
}
|
|
321
317
|
remove(cacheKey) {
|
|
@@ -347,7 +343,7 @@ var WeakMapWithEntries = class {
|
|
|
347
343
|
}, 1e3);
|
|
348
344
|
}
|
|
349
345
|
#clean() {
|
|
350
|
-
this.#list = this.#list.filter((ref) => ref.deref() !==
|
|
346
|
+
this.#list = this.#list.filter((ref) => ref.deref() !== undefined);
|
|
351
347
|
}
|
|
352
348
|
// functions for WeakMap
|
|
353
349
|
delete(key) {
|
|
@@ -387,7 +383,7 @@ var WeakMapWithEntries = class {
|
|
|
387
383
|
function* iter() {
|
|
388
384
|
for (const ref of self.#list) {
|
|
389
385
|
const key = ref.deref();
|
|
390
|
-
if (key !==
|
|
386
|
+
if (key !== undefined) {
|
|
391
387
|
yield [key, self.#map.get(key)];
|
|
392
388
|
}
|
|
393
389
|
}
|
|
@@ -402,7 +398,7 @@ var WeakMapWithEntries = class {
|
|
|
402
398
|
function* iter() {
|
|
403
399
|
for (const ref of self.#list) {
|
|
404
400
|
const key = ref.deref();
|
|
405
|
-
if (key !==
|
|
401
|
+
if (key !== undefined) {
|
|
406
402
|
yield key;
|
|
407
403
|
}
|
|
408
404
|
}
|
|
@@ -417,9 +413,9 @@ var WeakMapWithEntries = class {
|
|
|
417
413
|
function* iter() {
|
|
418
414
|
for (const ref of self.#list) {
|
|
419
415
|
const key = ref.deref();
|
|
420
|
-
if (key !==
|
|
416
|
+
if (key !== undefined) {
|
|
421
417
|
const value = self.#map.get(key);
|
|
422
|
-
if (value !==
|
|
418
|
+
if (value !== undefined) {
|
|
423
419
|
yield value;
|
|
424
420
|
}
|
|
425
421
|
}
|
|
@@ -478,8 +474,8 @@ var Entry = class {
|
|
|
478
474
|
function is$and(whereClause) {
|
|
479
475
|
if (process.env.NODE_ENV !== "production") {
|
|
480
476
|
if ("$and" in whereClause) {
|
|
481
|
-
!Array.isArray(whereClause.$and) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected $and to be an array") : invariant2__default.default(false) :
|
|
482
|
-
!(Object.keys(whereClause).length === 1) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected only $and to be present") : invariant2__default.default(false) :
|
|
477
|
+
!Array.isArray(whereClause.$and) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected $and to be an array") : invariant2__default.default(false) : undefined;
|
|
478
|
+
!(Object.keys(whereClause).length === 1) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected only $and to be present") : invariant2__default.default(false) : undefined;
|
|
483
479
|
}
|
|
484
480
|
}
|
|
485
481
|
return "$and" in whereClause;
|
|
@@ -487,8 +483,8 @@ function is$and(whereClause) {
|
|
|
487
483
|
function is$or(whereClause) {
|
|
488
484
|
if (process.env.NODE_ENV !== "production") {
|
|
489
485
|
if ("$or" in whereClause) {
|
|
490
|
-
!Array.isArray(whereClause.$or) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected $or to be an array") : invariant2__default.default(false) :
|
|
491
|
-
!(Object.keys(whereClause).length === 1) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected only $or to be present") : invariant2__default.default(false) :
|
|
486
|
+
!Array.isArray(whereClause.$or) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected $or to be an array") : invariant2__default.default(false) : undefined;
|
|
487
|
+
!(Object.keys(whereClause).length === 1) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected only $or to be present") : invariant2__default.default(false) : undefined;
|
|
492
488
|
}
|
|
493
489
|
}
|
|
494
490
|
return "$or" in whereClause;
|
|
@@ -496,7 +492,7 @@ function is$or(whereClause) {
|
|
|
496
492
|
function is$not(whereClause) {
|
|
497
493
|
if (process.env.NODE_ENV !== "production") {
|
|
498
494
|
if ("$not" in whereClause) {
|
|
499
|
-
!(Object.keys(whereClause).length === 1) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected only $not to be present") : invariant2__default.default(false) :
|
|
495
|
+
!(Object.keys(whereClause).length === 1) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected only $not to be present") : invariant2__default.default(false) : undefined;
|
|
500
496
|
}
|
|
501
497
|
}
|
|
502
498
|
return "$not" in whereClause;
|
|
@@ -573,7 +569,7 @@ var Query = class {
|
|
|
573
569
|
this.cacheKey = cacheKey;
|
|
574
570
|
this.store = store;
|
|
575
571
|
this.#subject = observable;
|
|
576
|
-
this.logger = logger ?? (process.env.NODE_ENV === "production" ? store.client[
|
|
572
|
+
this.logger = logger ?? (process.env.NODE_ENV === "production" ? store.client[chunkJPENHIJB_cjs.additionalContext].logger : store.client[chunkJPENHIJB_cjs.additionalContext].logger?.child({}, {
|
|
577
573
|
msgPrefix: process.env.NODE_ENV !== "production" ? `Query<${cacheKey.type}, ${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>` : "Query"
|
|
578
574
|
}));
|
|
579
575
|
}
|
|
@@ -621,7 +617,7 @@ var Query = class {
|
|
|
621
617
|
this.logger?.info({
|
|
622
618
|
methodName: "revalidate"
|
|
623
619
|
}, "finally _fetch()");
|
|
624
|
-
this.pendingFetch =
|
|
620
|
+
this.pendingFetch = undefined;
|
|
625
621
|
});
|
|
626
622
|
if (process.env.NODE_ENV !== "production") {
|
|
627
623
|
this.logger?.info({
|
|
@@ -666,9 +662,9 @@ var ListQuery = class extends Query {
|
|
|
666
662
|
#toRelease = /* @__PURE__ */ new Set();
|
|
667
663
|
#orderBy;
|
|
668
664
|
constructor(store, subject, objectType, whereClause, orderBy, cacheKey, opts) {
|
|
669
|
-
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[
|
|
665
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkJPENHIJB_cjs.additionalContext].logger?.child({}, {
|
|
670
666
|
msgPrefix: `ListQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
671
|
-
}) :
|
|
667
|
+
}) : undefined);
|
|
672
668
|
this.#client = store.client;
|
|
673
669
|
this.#type = objectType;
|
|
674
670
|
this.#whereClause = whereClause;
|
|
@@ -698,7 +694,7 @@ var ListQuery = class extends Query {
|
|
|
698
694
|
});
|
|
699
695
|
}
|
|
700
696
|
_preFetch() {
|
|
701
|
-
this.#nextPageToken =
|
|
697
|
+
this.#nextPageToken = undefined;
|
|
702
698
|
}
|
|
703
699
|
async _fetch() {
|
|
704
700
|
const objectSet = this.#client({
|
|
@@ -710,7 +706,7 @@ var ListQuery = class extends Query {
|
|
|
710
706
|
if (!entry) {
|
|
711
707
|
return;
|
|
712
708
|
}
|
|
713
|
-
!entry.value?.data ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false) : invariant2__default.default(false) :
|
|
709
|
+
!entry.value?.data ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false) : invariant2__default.default(false) : undefined;
|
|
714
710
|
const count = entry.value.data.length;
|
|
715
711
|
if (count > this.#minNumResults || this.#nextPageToken == null) {
|
|
716
712
|
break;
|
|
@@ -743,7 +739,7 @@ var ListQuery = class extends Query {
|
|
|
743
739
|
apiName: this.#type
|
|
744
740
|
}).where(this.#whereClause);
|
|
745
741
|
this.pendingFetch = this.#fetchPageAndUpdate(objectSet, "loaded", this.abortController?.signal).finally(() => {
|
|
746
|
-
this.#pendingPageFetch =
|
|
742
|
+
this.#pendingPageFetch = undefined;
|
|
747
743
|
});
|
|
748
744
|
return this.pendingFetch;
|
|
749
745
|
};
|
|
@@ -981,9 +977,9 @@ var ObjectQuery = class extends Query {
|
|
|
981
977
|
#apiName;
|
|
982
978
|
#pk;
|
|
983
979
|
constructor(store, subject, type, pk, cacheKey, opts) {
|
|
984
|
-
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[
|
|
980
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkJPENHIJB_cjs.additionalContext].logger?.child({}, {
|
|
985
981
|
msgPrefix: `ObjectQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
986
|
-
}) :
|
|
982
|
+
}) : undefined);
|
|
987
983
|
this.#apiName = type;
|
|
988
984
|
this.#pk = pk;
|
|
989
985
|
}
|
|
@@ -998,7 +994,7 @@ var ObjectQuery = class extends Query {
|
|
|
998
994
|
})), {
|
|
999
995
|
connector: () => new rxjs.BehaviorSubject({
|
|
1000
996
|
status: "init",
|
|
1001
|
-
object:
|
|
997
|
+
object: undefined,
|
|
1002
998
|
lastUpdated: 0,
|
|
1003
999
|
isOptimistic: false
|
|
1004
1000
|
})
|
|
@@ -1076,19 +1072,8 @@ var RefCounts = class {
|
|
|
1076
1072
|
}
|
|
1077
1073
|
gc() {
|
|
1078
1074
|
const now = Date.now();
|
|
1079
|
-
if (DEBUG_REFCOUNTS) {
|
|
1080
|
-
for (const [key, count] of this.refCounts) {
|
|
1081
|
-
console.debug("RefCounts.gc() - counts: ", JSON.stringify(key), count);
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
1075
|
for (const [key, deathTime] of this.gcMap) {
|
|
1085
|
-
if (DEBUG_REFCOUNTS && deathTime >= now) {
|
|
1086
|
-
console.debug("RefCounts.gc() - ttl ", JSON.stringify(key), deathTime - now);
|
|
1087
|
-
}
|
|
1088
1076
|
if (deathTime < now) {
|
|
1089
|
-
if (DEBUG_REFCOUNTS) {
|
|
1090
|
-
console.debug("RefCounts.gc() - registering cleaning up", JSON.stringify(key));
|
|
1091
|
-
}
|
|
1092
1077
|
this.gcMap.delete(key);
|
|
1093
1078
|
this.cleanup(key);
|
|
1094
1079
|
}
|
|
@@ -1129,8 +1114,8 @@ var WhereClauseCanonicalizer = class {
|
|
|
1129
1114
|
#toCanon = (where, set = /* @__PURE__ */ new Set()) => {
|
|
1130
1115
|
if ("$and" in where) {
|
|
1131
1116
|
if (process.env.NODE_ENV !== "production") {
|
|
1132
|
-
!Array.isArray(where.$and) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected $and to be an array") : invariant2__default.default(false) :
|
|
1133
|
-
!(Object.keys(where).length === 1) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected only $and to be present") : invariant2__default.default(false) :
|
|
1117
|
+
!Array.isArray(where.$and) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected $and to be an array") : invariant2__default.default(false) : undefined;
|
|
1118
|
+
!(Object.keys(where).length === 1) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected only $and to be present") : invariant2__default.default(false) : undefined;
|
|
1134
1119
|
}
|
|
1135
1120
|
if (where.$and.length === 0) {
|
|
1136
1121
|
return {};
|
|
@@ -1157,7 +1142,7 @@ function createInitEntry(cacheKey) {
|
|
|
1157
1142
|
return {
|
|
1158
1143
|
cacheKey,
|
|
1159
1144
|
status: "init",
|
|
1160
|
-
value:
|
|
1145
|
+
value: undefined,
|
|
1161
1146
|
lastUpdated: 0
|
|
1162
1147
|
};
|
|
1163
1148
|
}
|
|
@@ -1176,29 +1161,21 @@ var OrderByCanonicalizer = class {
|
|
|
1176
1161
|
var Store = class {
|
|
1177
1162
|
whereCanonicalizer = new WhereClauseCanonicalizer();
|
|
1178
1163
|
orderByCanonicalizer = new OrderByCanonicalizer();
|
|
1179
|
-
#truthLayer = new Layer(
|
|
1164
|
+
#truthLayer = new Layer(undefined, undefined);
|
|
1180
1165
|
#topLayer;
|
|
1181
1166
|
/** @internal */
|
|
1182
1167
|
#queries = new WeakMapWithEntries();
|
|
1183
1168
|
#cacheKeyToSubject = /* @__PURE__ */ new WeakMap();
|
|
1184
1169
|
#cacheKeys;
|
|
1185
|
-
#refCounts = new RefCounts(
|
|
1170
|
+
#refCounts = new RefCounts(6e4, (k) => this.#cleanupCacheKey(k));
|
|
1186
1171
|
#finalizationRegistry;
|
|
1187
1172
|
constructor(client) {
|
|
1188
1173
|
this.client = client;
|
|
1189
|
-
this.logger = client[
|
|
1174
|
+
this.logger = client[chunkJPENHIJB_cjs.additionalContext].logger?.child({}, {
|
|
1190
1175
|
msgPrefix: "Store"
|
|
1191
1176
|
});
|
|
1192
1177
|
this.#topLayer = this.#truthLayer;
|
|
1193
1178
|
this.#cacheKeys = new CacheKeys(this.whereCanonicalizer, this.orderByCanonicalizer, (k) => {
|
|
1194
|
-
if (DEBUG_REFCOUNTS) {
|
|
1195
|
-
const cacheKeyType = k.type;
|
|
1196
|
-
const otherKeys = k.otherKeys;
|
|
1197
|
-
console.log(`CacheKeys.onCreate(${cacheKeyType}, ${JSON.stringify(otherKeys)})`);
|
|
1198
|
-
this.#finalizationRegistry.register(k, () => {
|
|
1199
|
-
console.log(`CacheKey Finalization(${cacheKeyType}, ${JSON.stringify(otherKeys)})`);
|
|
1200
|
-
});
|
|
1201
|
-
}
|
|
1202
1179
|
this.#refCounts.register(k);
|
|
1203
1180
|
});
|
|
1204
1181
|
setInterval(() => {
|
|
@@ -1218,15 +1195,9 @@ var Store = class {
|
|
|
1218
1195
|
*/
|
|
1219
1196
|
#cleanupCacheKey = (key) => {
|
|
1220
1197
|
const subject = this.peekSubject(key);
|
|
1221
|
-
if (DEBUG_REFCOUNTS) {
|
|
1222
|
-
console.log(`CacheKey cleaning up (${JSON.stringify({
|
|
1223
|
-
closed: subject?.closed,
|
|
1224
|
-
observed: subject?.observed
|
|
1225
|
-
})})`, JSON.stringify([key.type, ...key.otherKeys], null, 2));
|
|
1226
|
-
}
|
|
1227
1198
|
this.#cacheKeys.remove(key);
|
|
1228
1199
|
if (process.env.NODE_ENV !== "production") {
|
|
1229
|
-
!subject ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false) : invariant2__default.default(false) :
|
|
1200
|
+
!subject ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false) : invariant2__default.default(false) : undefined;
|
|
1230
1201
|
}
|
|
1231
1202
|
if (subject) {
|
|
1232
1203
|
subject.complete();
|
|
@@ -1239,7 +1210,7 @@ var Store = class {
|
|
|
1239
1210
|
return new ActionApplication(this).applyAction(action, args, opts);
|
|
1240
1211
|
};
|
|
1241
1212
|
removeLayer(layerId) {
|
|
1242
|
-
!(layerId != null) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "undefined is the reserved layerId for the truth layer") : invariant2__default.default(false) :
|
|
1213
|
+
!(layerId != null) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "undefined is the reserved layerId for the truth layer") : invariant2__default.default(false) : undefined;
|
|
1243
1214
|
let currentLayer = this.#topLayer;
|
|
1244
1215
|
const cacheKeys = /* @__PURE__ */ new Map();
|
|
1245
1216
|
while (currentLayer != null && currentLayer.parentLayer != null) {
|
|
@@ -1459,8 +1430,8 @@ var Store = class {
|
|
|
1459
1430
|
optimisticId,
|
|
1460
1431
|
changes = createChangedObjects()
|
|
1461
1432
|
}, batchFn) => {
|
|
1462
|
-
!(optimisticId ===
|
|
1463
|
-
let needsLayer = optimisticId !==
|
|
1433
|
+
!(optimisticId === undefined || !!optimisticId) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "optimistic must be undefined or not falsy") : invariant2__default.default(false) : undefined;
|
|
1434
|
+
let needsLayer = optimisticId !== undefined;
|
|
1464
1435
|
const batchContext = {
|
|
1465
1436
|
changes,
|
|
1466
1437
|
createLayerIfNeeded: () => {
|
|
@@ -1561,7 +1532,7 @@ var Store = class {
|
|
|
1561
1532
|
if (process.env.NODE_ENV !== "production") {
|
|
1562
1533
|
this.logger?.info({
|
|
1563
1534
|
methodName: "invalidateObjectType"
|
|
1564
|
-
}, changes ? DEBUG_ONLY__changesToString(changes) :
|
|
1535
|
+
}, changes ? DEBUG_ONLY__changesToString(changes) : undefined);
|
|
1565
1536
|
}
|
|
1566
1537
|
const promises = [];
|
|
1567
1538
|
for (const [cacheKey, v] of this.#truthLayer.entries()) {
|
|
@@ -1659,7 +1630,7 @@ function createObservableClient(client) {
|
|
|
1659
1630
|
|
|
1660
1631
|
Object.defineProperty(exports, "augment", {
|
|
1661
1632
|
enumerable: true,
|
|
1662
|
-
get: function () { return
|
|
1633
|
+
get: function () { return chunkJPENHIJB_cjs.augment; }
|
|
1663
1634
|
});
|
|
1664
1635
|
exports.createObservableClient = createObservableClient;
|
|
1665
1636
|
//# sourceMappingURL=unstable-do-not-use.cjs.map
|