@osdk/client 2.2.0-beta.5 → 2.2.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/build/browser/internal/conversions/modernToLegacyGroupByClause.js +7 -0
- package/build/browser/internal/conversions/modernToLegacyGroupByClause.js.map +1 -1
- package/build/browser/object/AttachmentUpload.js +3 -0
- package/build/browser/object/AttachmentUpload.js.map +1 -1
- package/build/browser/object/aggregate.test.js +12 -2
- package/build/browser/object/aggregate.test.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/util/UserAgent.js +1 -1
- package/build/browser/util/toDataValue.js +10 -2
- package/build/browser/util/toDataValue.js.map +1 -1
- package/build/browser/util/toDataValueQueries.js +10 -2
- package/build/browser/util/toDataValueQueries.js.map +1 -1
- package/build/cjs/{chunk-T5UE6BI7.cjs → chunk-2FVV5A63.cjs} +41 -34
- package/build/cjs/chunk-2FVV5A63.cjs.map +1 -0
- package/build/cjs/chunk-X7WGNFZ4.cjs +5 -5
- package/build/cjs/chunk-X7WGNFZ4.cjs.map +1 -1
- package/build/cjs/graphql-JJX5MZPQ.cjs +263 -263
- package/build/cjs/graphql-JJX5MZPQ.cjs.map +1 -1
- package/build/cjs/index.cjs +85 -66
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/public/internal.cjs +4 -4
- package/build/cjs/public/internal.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.cjs +64 -35
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyGroupByClause.js +7 -0
- package/build/esm/internal/conversions/modernToLegacyGroupByClause.js.map +1 -1
- package/build/esm/object/AttachmentUpload.js +3 -0
- package/build/esm/object/AttachmentUpload.js.map +1 -1
- package/build/esm/object/aggregate.test.js +12 -2
- package/build/esm/object/aggregate.test.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/util/UserAgent.js +1 -1
- package/build/esm/util/toDataValue.js +10 -2
- package/build/esm/util/toDataValue.js.map +1 -1
- package/build/esm/util/toDataValueQueries.js +10 -2
- package/build/esm/util/toDataValueQueries.js.map +1 -1
- package/build/types/object/AttachmentUpload.d.ts +3 -0
- package/build/types/object/AttachmentUpload.d.ts.map +1 -1
- package/package.json +8 -8
- package/build/cjs/chunk-T5UE6BI7.cjs.map +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk2FVV5A63_cjs = require('../chunk-2FVV5A63.cjs');
|
|
4
4
|
var chunkX7WGNFZ4_cjs = require('../chunk-X7WGNFZ4.cjs');
|
|
5
5
|
require('../chunk-Q7SFCCGT.cjs');
|
|
6
6
|
|
|
7
7
|
// src/public-utils/createAndFetchTempObjectSetRid.ts
|
|
8
8
|
async function createAndFetchTempObjectSetRid(client, objectSet) {
|
|
9
9
|
const response = await chunkX7WGNFZ4_cjs.OntologyObjectSet_exports.createTemporary(client, await client[chunkX7WGNFZ4_cjs.additionalContext].ontologyRid, {
|
|
10
|
-
objectSet:
|
|
10
|
+
objectSet: chunk2FVV5A63_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 chunk2FVV5A63_cjs.createObjectSet(definition, client[chunkX7WGNFZ4_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 chunk2FVV5A63_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;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
|
+
{"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,CAAA;AAAA,GACtC,CAAA,CAAA;AACD,EAAA,OAAO,QAAS,CAAA,YAAA,CAAA;AAClB,CAAA;;;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,OAAA;AAAA,KACtB,EAAA;AAAA,MACD,IAAM,EAAA,WAAA;AAAA,MACN,SAAW,EAAA,GAAA;AAAA,KACZ,CAAA;AAAA,GACF,CAAA,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}"]}
|
|
@@ -34,7 +34,7 @@ var ObservableClientImpl = class {
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
// src/observable/DebugFlags.ts
|
|
37
|
-
process.env.NODE_ENV !== "production" && false;
|
|
37
|
+
var DEBUG_REFCOUNTS = 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
|
|
@@ -52,7 +52,7 @@ function isNodeProcess() {
|
|
|
52
52
|
return false;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@22.13.
|
|
55
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@22.13.0_typescript@5.5.4/node_modules/msw/lib/core/delay.mjs
|
|
56
56
|
var SET_TIMEOUT_MAX_ALLOWED_INT = 2147483647;
|
|
57
57
|
var MIN_SERVER_RESPONSE_TIME = 100;
|
|
58
58
|
var MAX_SERVER_RESPONSE_TIME = 400;
|
|
@@ -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 === void 0) {
|
|
143
143
|
createOptimisticId.counter = 0;
|
|
144
144
|
}
|
|
145
145
|
return {
|
|
@@ -188,7 +188,7 @@ var OptimisticJob = class {
|
|
|
188
188
|
$apiName: type.apiName,
|
|
189
189
|
$objectType: type.apiName,
|
|
190
190
|
...properties
|
|
191
|
-
}],
|
|
191
|
+
}], void 0).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
|
+
() => void 0
|
|
212
212
|
).finally(() => {
|
|
213
213
|
store.removeLayer(optimisticId);
|
|
214
214
|
});
|
|
@@ -298,11 +298,15 @@ 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)
|
|
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
|
+
}
|
|
302
304
|
return this.#cacheKeys.lookupArray(["object", apiName, pk]);
|
|
303
305
|
});
|
|
304
306
|
this.#registerCacheKeyFactory("list", (apiName, where, orderBy) => {
|
|
305
|
-
if (process.env.NODE_ENV !== "production" && DEBUG_CACHE_KEYS)
|
|
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
|
+
}
|
|
306
310
|
return this.#cacheKeys.lookupArray(["list", apiName, whereCanonicalizer.canonicalize(where), orderByCanonicalizer.canonicalize(orderBy)]);
|
|
307
311
|
});
|
|
308
312
|
}
|
|
@@ -311,7 +315,7 @@ var CacheKeys = class {
|
|
|
311
315
|
}
|
|
312
316
|
get(type, ...args) {
|
|
313
317
|
const factory = this.#cacheKeyFactories.get(type);
|
|
314
|
-
!factory ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, `no cache key factory for type "${type}"`) : invariant2__default.default(false) :
|
|
318
|
+
!factory ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, `no cache key factory for type "${type}"`) : invariant2__default.default(false) : void 0;
|
|
315
319
|
return factory(...args);
|
|
316
320
|
}
|
|
317
321
|
remove(cacheKey) {
|
|
@@ -343,7 +347,7 @@ var WeakMapWithEntries = class {
|
|
|
343
347
|
}, 1e3);
|
|
344
348
|
}
|
|
345
349
|
#clean() {
|
|
346
|
-
this.#list = this.#list.filter((ref) => ref.deref() !==
|
|
350
|
+
this.#list = this.#list.filter((ref) => ref.deref() !== void 0);
|
|
347
351
|
}
|
|
348
352
|
// functions for WeakMap
|
|
349
353
|
delete(key) {
|
|
@@ -383,7 +387,7 @@ var WeakMapWithEntries = class {
|
|
|
383
387
|
function* iter() {
|
|
384
388
|
for (const ref of self.#list) {
|
|
385
389
|
const key = ref.deref();
|
|
386
|
-
if (key !==
|
|
390
|
+
if (key !== void 0) {
|
|
387
391
|
yield [key, self.#map.get(key)];
|
|
388
392
|
}
|
|
389
393
|
}
|
|
@@ -398,7 +402,7 @@ var WeakMapWithEntries = class {
|
|
|
398
402
|
function* iter() {
|
|
399
403
|
for (const ref of self.#list) {
|
|
400
404
|
const key = ref.deref();
|
|
401
|
-
if (key !==
|
|
405
|
+
if (key !== void 0) {
|
|
402
406
|
yield key;
|
|
403
407
|
}
|
|
404
408
|
}
|
|
@@ -413,9 +417,9 @@ var WeakMapWithEntries = class {
|
|
|
413
417
|
function* iter() {
|
|
414
418
|
for (const ref of self.#list) {
|
|
415
419
|
const key = ref.deref();
|
|
416
|
-
if (key !==
|
|
420
|
+
if (key !== void 0) {
|
|
417
421
|
const value = self.#map.get(key);
|
|
418
|
-
if (value !==
|
|
422
|
+
if (value !== void 0) {
|
|
419
423
|
yield value;
|
|
420
424
|
}
|
|
421
425
|
}
|
|
@@ -474,8 +478,8 @@ var Entry = class {
|
|
|
474
478
|
function is$and(whereClause) {
|
|
475
479
|
if (process.env.NODE_ENV !== "production") {
|
|
476
480
|
if ("$and" in whereClause) {
|
|
477
|
-
!Array.isArray(whereClause.$and) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected $and to be an array") : invariant2__default.default(false) :
|
|
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) :
|
|
481
|
+
!Array.isArray(whereClause.$and) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected $and to be an array") : invariant2__default.default(false) : void 0;
|
|
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) : void 0;
|
|
479
483
|
}
|
|
480
484
|
}
|
|
481
485
|
return "$and" in whereClause;
|
|
@@ -483,8 +487,8 @@ function is$and(whereClause) {
|
|
|
483
487
|
function is$or(whereClause) {
|
|
484
488
|
if (process.env.NODE_ENV !== "production") {
|
|
485
489
|
if ("$or" in whereClause) {
|
|
486
|
-
!Array.isArray(whereClause.$or) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected $or to be an array") : invariant2__default.default(false) :
|
|
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) :
|
|
490
|
+
!Array.isArray(whereClause.$or) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected $or to be an array") : invariant2__default.default(false) : void 0;
|
|
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) : void 0;
|
|
488
492
|
}
|
|
489
493
|
}
|
|
490
494
|
return "$or" in whereClause;
|
|
@@ -492,7 +496,7 @@ function is$or(whereClause) {
|
|
|
492
496
|
function is$not(whereClause) {
|
|
493
497
|
if (process.env.NODE_ENV !== "production") {
|
|
494
498
|
if ("$not" in whereClause) {
|
|
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) :
|
|
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) : void 0;
|
|
496
500
|
}
|
|
497
501
|
}
|
|
498
502
|
return "$not" in whereClause;
|
|
@@ -617,7 +621,7 @@ var Query = class {
|
|
|
617
621
|
this.logger?.info({
|
|
618
622
|
methodName: "revalidate"
|
|
619
623
|
}, "finally _fetch()");
|
|
620
|
-
this.pendingFetch =
|
|
624
|
+
this.pendingFetch = void 0;
|
|
621
625
|
});
|
|
622
626
|
if (process.env.NODE_ENV !== "production") {
|
|
623
627
|
this.logger?.info({
|
|
@@ -664,7 +668,7 @@ var ListQuery = class extends Query {
|
|
|
664
668
|
constructor(store, subject, objectType, whereClause, orderBy, cacheKey, opts) {
|
|
665
669
|
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkX7WGNFZ4_cjs.additionalContext].logger?.child({}, {
|
|
666
670
|
msgPrefix: `ListQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
667
|
-
}) :
|
|
671
|
+
}) : void 0);
|
|
668
672
|
this.#client = store.client;
|
|
669
673
|
this.#type = objectType;
|
|
670
674
|
this.#whereClause = whereClause;
|
|
@@ -694,7 +698,7 @@ var ListQuery = class extends Query {
|
|
|
694
698
|
});
|
|
695
699
|
}
|
|
696
700
|
_preFetch() {
|
|
697
|
-
this.#nextPageToken =
|
|
701
|
+
this.#nextPageToken = void 0;
|
|
698
702
|
}
|
|
699
703
|
async _fetch() {
|
|
700
704
|
const objectSet = this.#client({
|
|
@@ -706,7 +710,7 @@ var ListQuery = class extends Query {
|
|
|
706
710
|
if (!entry) {
|
|
707
711
|
return;
|
|
708
712
|
}
|
|
709
|
-
!entry.value?.data ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false) : invariant2__default.default(false) :
|
|
713
|
+
!entry.value?.data ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false) : invariant2__default.default(false) : void 0;
|
|
710
714
|
const count = entry.value.data.length;
|
|
711
715
|
if (count > this.#minNumResults || this.#nextPageToken == null) {
|
|
712
716
|
break;
|
|
@@ -739,7 +743,7 @@ var ListQuery = class extends Query {
|
|
|
739
743
|
apiName: this.#type
|
|
740
744
|
}).where(this.#whereClause);
|
|
741
745
|
this.pendingFetch = this.#fetchPageAndUpdate(objectSet, "loaded", this.abortController?.signal).finally(() => {
|
|
742
|
-
this.#pendingPageFetch =
|
|
746
|
+
this.#pendingPageFetch = void 0;
|
|
743
747
|
});
|
|
744
748
|
return this.pendingFetch;
|
|
745
749
|
};
|
|
@@ -979,7 +983,7 @@ var ObjectQuery = class extends Query {
|
|
|
979
983
|
constructor(store, subject, type, pk, cacheKey, opts) {
|
|
980
984
|
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkX7WGNFZ4_cjs.additionalContext].logger?.child({}, {
|
|
981
985
|
msgPrefix: `ObjectQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
982
|
-
}) :
|
|
986
|
+
}) : void 0);
|
|
983
987
|
this.#apiName = type;
|
|
984
988
|
this.#pk = pk;
|
|
985
989
|
}
|
|
@@ -994,7 +998,7 @@ var ObjectQuery = class extends Query {
|
|
|
994
998
|
})), {
|
|
995
999
|
connector: () => new rxjs.BehaviorSubject({
|
|
996
1000
|
status: "init",
|
|
997
|
-
object:
|
|
1001
|
+
object: void 0,
|
|
998
1002
|
lastUpdated: 0,
|
|
999
1003
|
isOptimistic: false
|
|
1000
1004
|
})
|
|
@@ -1072,8 +1076,19 @@ var RefCounts = class {
|
|
|
1072
1076
|
}
|
|
1073
1077
|
gc() {
|
|
1074
1078
|
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
|
+
}
|
|
1075
1084
|
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
|
+
}
|
|
1076
1088
|
if (deathTime < now) {
|
|
1089
|
+
if (DEBUG_REFCOUNTS) {
|
|
1090
|
+
console.debug("RefCounts.gc() - registering cleaning up", JSON.stringify(key));
|
|
1091
|
+
}
|
|
1077
1092
|
this.gcMap.delete(key);
|
|
1078
1093
|
this.cleanup(key);
|
|
1079
1094
|
}
|
|
@@ -1114,8 +1129,8 @@ var WhereClauseCanonicalizer = class {
|
|
|
1114
1129
|
#toCanon = (where, set = /* @__PURE__ */ new Set()) => {
|
|
1115
1130
|
if ("$and" in where) {
|
|
1116
1131
|
if (process.env.NODE_ENV !== "production") {
|
|
1117
|
-
!Array.isArray(where.$and) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected $and to be an array") : invariant2__default.default(false) :
|
|
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) :
|
|
1132
|
+
!Array.isArray(where.$and) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "expected $and to be an array") : invariant2__default.default(false) : void 0;
|
|
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) : void 0;
|
|
1119
1134
|
}
|
|
1120
1135
|
if (where.$and.length === 0) {
|
|
1121
1136
|
return {};
|
|
@@ -1142,7 +1157,7 @@ function createInitEntry(cacheKey) {
|
|
|
1142
1157
|
return {
|
|
1143
1158
|
cacheKey,
|
|
1144
1159
|
status: "init",
|
|
1145
|
-
value:
|
|
1160
|
+
value: void 0,
|
|
1146
1161
|
lastUpdated: 0
|
|
1147
1162
|
};
|
|
1148
1163
|
}
|
|
@@ -1161,13 +1176,13 @@ var OrderByCanonicalizer = class {
|
|
|
1161
1176
|
var Store = class {
|
|
1162
1177
|
whereCanonicalizer = new WhereClauseCanonicalizer();
|
|
1163
1178
|
orderByCanonicalizer = new OrderByCanonicalizer();
|
|
1164
|
-
#truthLayer = new Layer(
|
|
1179
|
+
#truthLayer = new Layer(void 0, void 0);
|
|
1165
1180
|
#topLayer;
|
|
1166
1181
|
/** @internal */
|
|
1167
1182
|
#queries = new WeakMapWithEntries();
|
|
1168
1183
|
#cacheKeyToSubject = /* @__PURE__ */ new WeakMap();
|
|
1169
1184
|
#cacheKeys;
|
|
1170
|
-
#refCounts = new RefCounts(6e4, (k) => this.#cleanupCacheKey(k));
|
|
1185
|
+
#refCounts = new RefCounts(DEBUG_REFCOUNTS ? 15e3 : 6e4, (k) => this.#cleanupCacheKey(k));
|
|
1171
1186
|
#finalizationRegistry;
|
|
1172
1187
|
constructor(client) {
|
|
1173
1188
|
this.client = client;
|
|
@@ -1176,6 +1191,14 @@ var Store = class {
|
|
|
1176
1191
|
});
|
|
1177
1192
|
this.#topLayer = this.#truthLayer;
|
|
1178
1193
|
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
|
+
}
|
|
1179
1202
|
this.#refCounts.register(k);
|
|
1180
1203
|
});
|
|
1181
1204
|
setInterval(() => {
|
|
@@ -1195,9 +1218,15 @@ var Store = class {
|
|
|
1195
1218
|
*/
|
|
1196
1219
|
#cleanupCacheKey = (key) => {
|
|
1197
1220
|
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
|
+
}
|
|
1198
1227
|
this.#cacheKeys.remove(key);
|
|
1199
1228
|
if (process.env.NODE_ENV !== "production") {
|
|
1200
|
-
!subject ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false) : invariant2__default.default(false) :
|
|
1229
|
+
!subject ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false) : invariant2__default.default(false) : void 0;
|
|
1201
1230
|
}
|
|
1202
1231
|
if (subject) {
|
|
1203
1232
|
subject.complete();
|
|
@@ -1210,7 +1239,7 @@ var Store = class {
|
|
|
1210
1239
|
return new ActionApplication(this).applyAction(action, args, opts);
|
|
1211
1240
|
};
|
|
1212
1241
|
removeLayer(layerId) {
|
|
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) :
|
|
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) : void 0;
|
|
1214
1243
|
let currentLayer = this.#topLayer;
|
|
1215
1244
|
const cacheKeys = /* @__PURE__ */ new Map();
|
|
1216
1245
|
while (currentLayer != null && currentLayer.parentLayer != null) {
|
|
@@ -1430,8 +1459,8 @@ var Store = class {
|
|
|
1430
1459
|
optimisticId,
|
|
1431
1460
|
changes = createChangedObjects()
|
|
1432
1461
|
}, batchFn) => {
|
|
1433
|
-
!(optimisticId ===
|
|
1434
|
-
let needsLayer = optimisticId !==
|
|
1462
|
+
!(optimisticId === void 0 || !!optimisticId) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "optimistic must be undefined or not falsy") : invariant2__default.default(false) : void 0;
|
|
1463
|
+
let needsLayer = optimisticId !== void 0;
|
|
1435
1464
|
const batchContext = {
|
|
1436
1465
|
changes,
|
|
1437
1466
|
createLayerIfNeeded: () => {
|
|
@@ -1532,7 +1561,7 @@ var Store = class {
|
|
|
1532
1561
|
if (process.env.NODE_ENV !== "production") {
|
|
1533
1562
|
this.logger?.info({
|
|
1534
1563
|
methodName: "invalidateObjectType"
|
|
1535
|
-
}, changes ? DEBUG_ONLY__changesToString(changes) :
|
|
1564
|
+
}, changes ? DEBUG_ONLY__changesToString(changes) : void 0);
|
|
1536
1565
|
}
|
|
1537
1566
|
const promises = [];
|
|
1538
1567
|
for (const [cacheKey, v] of this.#truthLayer.entries()) {
|