@osdk/client 2.6.0-beta.6 → 2.6.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 +12 -0
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js +18 -8
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js +171 -63
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
- package/build/browser/observable/internal/base-list/BaseListQuery.js +133 -2
- package/build/browser/observable/internal/base-list/BaseListQuery.js.map +1 -1
- package/build/browser/observable/internal/links/LinksHelper.js +3 -0
- package/build/browser/observable/internal/links/LinksHelper.js.map +1 -1
- package/build/browser/observable/internal/list/ListQuery.js +6 -58
- package/build/browser/observable/internal/list/ListQuery.js.map +1 -1
- package/build/browser/observable/internal/objectset/ObjectSetHelper.js +5 -1
- package/build/browser/observable/internal/objectset/ObjectSetHelper.js.map +1 -1
- package/build/browser/observable/internal/objectset/ObjectSetQuery.js +3 -0
- package/build/browser/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
- package/build/browser/observable/internal/objectset/ObjectSetQueryOptions.js.map +1 -1
- package/build/browser/observable/internal/types/ObjectUpdate.js +2 -0
- package/build/browser/observable/internal/types/ObjectUpdate.js.map +1 -0
- package/build/browser/util/UserAgent.js +2 -2
- package/build/cjs/{chunk-VNLY3YOJ.cjs → chunk-3LMKH6RS.cjs} +55 -47
- package/build/cjs/chunk-3LMKH6RS.cjs.map +1 -0
- package/build/cjs/{chunk-3ZJESPX6.cjs → chunk-4ZOXOCQX.cjs} +54 -54
- package/build/cjs/{chunk-3ZJESPX6.cjs.map → chunk-4ZOXOCQX.cjs.map} +1 -1
- package/build/cjs/index.cjs +8 -8
- package/build/cjs/public/internal.cjs +8 -8
- package/build/cjs/public/unstable-do-not-use.cjs +179 -92
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +1 -0
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js +18 -8
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js +171 -63
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
- package/build/esm/observable/internal/base-list/BaseListQuery.js +133 -2
- package/build/esm/observable/internal/base-list/BaseListQuery.js.map +1 -1
- package/build/esm/observable/internal/links/LinksHelper.js +3 -0
- package/build/esm/observable/internal/links/LinksHelper.js.map +1 -1
- package/build/esm/observable/internal/list/ListQuery.js +6 -58
- package/build/esm/observable/internal/list/ListQuery.js.map +1 -1
- package/build/esm/observable/internal/objectset/ObjectSetHelper.js +5 -1
- package/build/esm/observable/internal/objectset/ObjectSetHelper.js.map +1 -1
- package/build/esm/observable/internal/objectset/ObjectSetQuery.js +3 -0
- package/build/esm/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
- package/build/esm/observable/internal/objectset/ObjectSetQueryOptions.js.map +1 -1
- package/build/esm/observable/internal/types/ObjectUpdate.js +2 -0
- package/build/esm/observable/internal/types/ObjectUpdate.js.map +1 -0
- package/build/esm/util/UserAgent.js +2 -2
- package/build/types/observable/internal/base-list/BaseListQuery.d.ts +42 -2
- package/build/types/observable/internal/base-list/BaseListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/links/LinksHelper.d.ts +4 -0
- package/build/types/observable/internal/links/LinksHelper.d.ts.map +1 -1
- package/build/types/observable/internal/list/ListQuery.d.ts +2 -8
- package/build/types/observable/internal/list/ListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/objectset/ObjectSetHelper.d.ts.map +1 -1
- package/build/types/observable/internal/objectset/ObjectSetQuery.d.ts +2 -1
- package/build/types/observable/internal/objectset/ObjectSetQuery.d.ts.map +1 -1
- package/build/types/observable/internal/objectset/ObjectSetQueryOptions.d.ts +1 -0
- package/build/types/observable/internal/objectset/ObjectSetQueryOptions.d.ts.map +1 -1
- package/build/types/observable/internal/types/ObjectUpdate.d.ts +11 -0
- package/build/types/observable/internal/types/ObjectUpdate.d.ts.map +1 -0
- package/package.json +6 -6
- package/build/cjs/chunk-VNLY3YOJ.cjs.map +0 -1
package/build/cjs/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunk4ZOXOCQX_cjs = require('./chunk-4ZOXOCQX.cjs');
|
|
4
|
+
require('./chunk-3LMKH6RS.cjs');
|
|
5
5
|
require('./chunk-Q7SFCCGT.cjs');
|
|
6
6
|
var api = require('@osdk/api');
|
|
7
7
|
var shared_net_errors = require('@osdk/shared.net.errors');
|
|
@@ -13,7 +13,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
13
13
|
var invariant__default = /*#__PURE__*/_interopDefault(invariant);
|
|
14
14
|
|
|
15
15
|
function createPlatformClient(baseUrl, tokenProvider, options = void 0, fetchFn = fetch) {
|
|
16
|
-
return shared_client_impl.createSharedClientContext(baseUrl, tokenProvider,
|
|
16
|
+
return shared_client_impl.createSharedClientContext(baseUrl, tokenProvider, chunk4ZOXOCQX_cjs.USER_AGENT, fetchFn);
|
|
17
17
|
}
|
|
18
18
|
var isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$/;
|
|
19
19
|
var extractDate = (dateTime) => {
|
|
@@ -37,23 +37,23 @@ var extractDateFromIsoString = (dateTime) => {
|
|
|
37
37
|
|
|
38
38
|
Object.defineProperty(exports, "ActionValidationError", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunk4ZOXOCQX_cjs.ActionValidationError; }
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "createAttachmentUpload", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunk4ZOXOCQX_cjs.createAttachmentUpload; }
|
|
45
45
|
});
|
|
46
46
|
Object.defineProperty(exports, "createClient", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunk4ZOXOCQX_cjs.createClient; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "createObjectSpecifierFromPrimaryKey", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunk4ZOXOCQX_cjs.createObjectSpecifierFromPrimaryKey; }
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "extractPrimaryKeyFromObjectSpecifier", {
|
|
55
55
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunk4ZOXOCQX_cjs.extractPrimaryKeyFromObjectSpecifier; }
|
|
57
57
|
});
|
|
58
58
|
Object.defineProperty(exports, "NULL_VALUE", {
|
|
59
59
|
enumerable: true,
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk3LMKH6RS_cjs = require('../chunk-3LMKH6RS.cjs');
|
|
4
4
|
require('../chunk-Q7SFCCGT.cjs');
|
|
5
5
|
|
|
6
6
|
// src/public-utils/createAndFetchTempObjectSetRid.ts
|
|
7
7
|
async function createAndFetchTempObjectSetRid(client, objectSet) {
|
|
8
|
-
const response = await
|
|
9
|
-
objectSet:
|
|
8
|
+
const response = await chunk3LMKH6RS_cjs.OntologyObjectSet_exports.createTemporary(client, await client[chunk3LMKH6RS_cjs.additionalContext].ontologyRid, {
|
|
9
|
+
objectSet: chunk3LMKH6RS_cjs.getWireObjectSet(objectSet)
|
|
10
10
|
});
|
|
11
11
|
return response.objectSetRid;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
// src/public-utils/hydrateObjectSetFromObjectRids.ts
|
|
15
15
|
function hydrateObjectSetFromObjectRids(client, definition, rids) {
|
|
16
|
-
return
|
|
16
|
+
return chunk3LMKH6RS_cjs.createObjectSet(definition, client[chunk3LMKH6RS_cjs.additionalContext], {
|
|
17
17
|
type: "intersect",
|
|
18
18
|
objectSets: [definition.type === "interface" ? {
|
|
19
19
|
type: "interfaceBase",
|
|
@@ -33,7 +33,7 @@ function asMutableArray(array) {
|
|
|
33
33
|
|
|
34
34
|
// src/public-utils/hydrateObjectSetFromRid.ts
|
|
35
35
|
function hydrateObjectSetFromRid(client, definition, rid) {
|
|
36
|
-
return
|
|
36
|
+
return chunk3LMKH6RS_cjs.createObjectSet(definition, client[chunk3LMKH6RS_cjs.additionalContext], {
|
|
37
37
|
type: "intersect",
|
|
38
38
|
objectSets: [definition.type === "interface" ? {
|
|
39
39
|
type: "interfaceBase",
|
|
@@ -74,7 +74,7 @@ var levelStyles = {
|
|
|
74
74
|
color: "orange"
|
|
75
75
|
})
|
|
76
76
|
};
|
|
77
|
-
var BrowserLogger = class _BrowserLogger extends
|
|
77
|
+
var BrowserLogger = class _BrowserLogger extends chunk3LMKH6RS_cjs.BaseLogger {
|
|
78
78
|
constructor(bindings = {}, options = {}) {
|
|
79
79
|
super(bindings, {
|
|
80
80
|
...options,
|
|
@@ -100,11 +100,11 @@ var BrowserLogger = class _BrowserLogger extends chunkVNLY3YOJ_cjs.BaseLogger {
|
|
|
100
100
|
|
|
101
101
|
Object.defineProperty(exports, "MinimalLogger", {
|
|
102
102
|
enumerable: true,
|
|
103
|
-
get: function () { return
|
|
103
|
+
get: function () { return chunk3LMKH6RS_cjs.MinimalLogger; }
|
|
104
104
|
});
|
|
105
105
|
Object.defineProperty(exports, "hydrateAttachmentFromRid", {
|
|
106
106
|
enumerable: true,
|
|
107
|
-
get: function () { return
|
|
107
|
+
get: function () { return chunk3LMKH6RS_cjs.hydrateAttachmentFromRid; }
|
|
108
108
|
});
|
|
109
109
|
exports.BrowserLogger = BrowserLogger;
|
|
110
110
|
exports.createAndFetchTempObjectSetRid = createAndFetchTempObjectSetRid;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk4ZOXOCQX_cjs = require('../chunk-4ZOXOCQX.cjs');
|
|
4
|
+
var chunk3LMKH6RS_cjs = require('../chunk-3LMKH6RS.cjs');
|
|
5
5
|
require('../chunk-Q7SFCCGT.cjs');
|
|
6
6
|
var trie = require('@wry/trie');
|
|
7
7
|
var deepEqual = require('fast-deep-equal');
|
|
@@ -139,7 +139,7 @@ var WhereClauseCanonicalizer = class {
|
|
|
139
139
|
var whereCanonicalizer = new WhereClauseCanonicalizer();
|
|
140
140
|
var orderByCanonicalizer = new OrderByCanonicalizer();
|
|
141
141
|
function computeObjectSetCacheKey(objectSet, options) {
|
|
142
|
-
const keyParts = ["objectSet",
|
|
142
|
+
const keyParts = ["objectSet", chunk3LMKH6RS_cjs.getWireObjectSet(objectSet)];
|
|
143
143
|
if (!options) {
|
|
144
144
|
return JSON.stringify(keyParts);
|
|
145
145
|
}
|
|
@@ -151,13 +151,13 @@ function computeObjectSetCacheKey(objectSet, options) {
|
|
|
151
151
|
keyParts.push("props", propKeys);
|
|
152
152
|
}
|
|
153
153
|
if (options.union && options.union.length > 0) {
|
|
154
|
-
keyParts.push("union", options.union.map((os) =>
|
|
154
|
+
keyParts.push("union", options.union.map((os) => chunk3LMKH6RS_cjs.getWireObjectSet(os)));
|
|
155
155
|
}
|
|
156
156
|
if (options.intersect && options.intersect.length > 0) {
|
|
157
|
-
keyParts.push("intersect", options.intersect.map((os) =>
|
|
157
|
+
keyParts.push("intersect", options.intersect.map((os) => chunk3LMKH6RS_cjs.getWireObjectSet(os)));
|
|
158
158
|
}
|
|
159
159
|
if (options.subtract && options.subtract.length > 0) {
|
|
160
|
-
keyParts.push("subtract", options.subtract.map((os) =>
|
|
160
|
+
keyParts.push("subtract", options.subtract.map((os) => chunk3LMKH6RS_cjs.getWireObjectSet(os)));
|
|
161
161
|
}
|
|
162
162
|
if (options.pivotTo) {
|
|
163
163
|
keyParts.push("pivotTo", options.pivotTo);
|
|
@@ -316,7 +316,7 @@ var OptimisticJob = class {
|
|
|
316
316
|
return this;
|
|
317
317
|
},
|
|
318
318
|
createObject(type, pk, properties) {
|
|
319
|
-
const create = store.client[
|
|
319
|
+
const create = store.client[chunk3LMKH6RS_cjs.additionalContext].objectFactory2(store.client[chunk3LMKH6RS_cjs.additionalContext], [{
|
|
320
320
|
$primaryKey: pk,
|
|
321
321
|
$apiName: type.apiName,
|
|
322
322
|
$objectType: type.apiName,
|
|
@@ -1014,7 +1014,7 @@ var Query = class {
|
|
|
1014
1014
|
this.store = store;
|
|
1015
1015
|
this.cacheKeys = store.cacheKeys;
|
|
1016
1016
|
this.#subject = observable;
|
|
1017
|
-
this.logger = logger ?? (process.env.NODE_ENV === "production" ? store.client[
|
|
1017
|
+
this.logger = logger ?? (process.env.NODE_ENV === "production" ? store.client[chunk3LMKH6RS_cjs.additionalContext].logger : store.client[chunk3LMKH6RS_cjs.additionalContext].logger?.child({}, {
|
|
1018
1018
|
msgPrefix: process.env.NODE_ENV !== "production" ? `Query<${cacheKey.type}, ${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>` : "Query"
|
|
1019
1019
|
}));
|
|
1020
1020
|
}
|
|
@@ -1421,9 +1421,11 @@ var BaseListQuery = class extends Query {
|
|
|
1421
1421
|
return this.pendingPageFetch;
|
|
1422
1422
|
}
|
|
1423
1423
|
if (this.pendingFetch) {
|
|
1424
|
-
this.pendingPageFetch =
|
|
1424
|
+
this.pendingPageFetch = (async () => {
|
|
1425
1425
|
await this.pendingFetch;
|
|
1426
|
-
|
|
1426
|
+
await this.fetchMore();
|
|
1427
|
+
})().finally(() => {
|
|
1428
|
+
this.pendingPageFetch = void 0;
|
|
1427
1429
|
});
|
|
1428
1430
|
return this.pendingPageFetch;
|
|
1429
1431
|
}
|
|
@@ -1578,6 +1580,132 @@ var BaseListQuery = class extends Query {
|
|
|
1578
1580
|
data: objectCacheKeys
|
|
1579
1581
|
}, options.status, batch);
|
|
1580
1582
|
}
|
|
1583
|
+
//
|
|
1584
|
+
// Shared Websocket Subscription Methods
|
|
1585
|
+
//
|
|
1586
|
+
/**
|
|
1587
|
+
* Create standard websocket subscription handlers for an ObjectSet.
|
|
1588
|
+
* Subclasses can override individual handlers for custom behavior.
|
|
1589
|
+
*
|
|
1590
|
+
* @param objectSet The ObjectSet to subscribe to
|
|
1591
|
+
* @param sub The parent subscription to add cleanup to
|
|
1592
|
+
* @param methodName The method name for logging purposes
|
|
1593
|
+
*/
|
|
1594
|
+
createWebsocketSubscription(objectSet, sub, methodName = "registerStreamUpdates") {
|
|
1595
|
+
const logger = process.env.NODE_ENV !== "production" ? this.logger?.child({
|
|
1596
|
+
methodName
|
|
1597
|
+
}) : this.logger;
|
|
1598
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1599
|
+
logger?.child({
|
|
1600
|
+
methodName
|
|
1601
|
+
}).info("Subscribing from websocket");
|
|
1602
|
+
}
|
|
1603
|
+
try {
|
|
1604
|
+
const websocketSubscription = objectSet.subscribe({
|
|
1605
|
+
onChange: this.onOswChange.bind(this),
|
|
1606
|
+
onError: this.onOswError.bind(this),
|
|
1607
|
+
onOutOfDate: this.onOswOutOfDate.bind(this),
|
|
1608
|
+
onSuccessfulSubscription: this.onOswSuccessfulSubscription.bind(this)
|
|
1609
|
+
});
|
|
1610
|
+
sub.add(() => {
|
|
1611
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1612
|
+
logger?.child({
|
|
1613
|
+
methodName
|
|
1614
|
+
}).info("Unsubscribing from websocket");
|
|
1615
|
+
}
|
|
1616
|
+
websocketSubscription.unsubscribe();
|
|
1617
|
+
});
|
|
1618
|
+
} catch (error) {
|
|
1619
|
+
if (this.logger) {
|
|
1620
|
+
this.logger.child({
|
|
1621
|
+
methodName
|
|
1622
|
+
}).error("Failed to register stream updates", error);
|
|
1623
|
+
}
|
|
1624
|
+
this.onOswError({
|
|
1625
|
+
subscriptionClosed: true,
|
|
1626
|
+
error
|
|
1627
|
+
});
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
/**
|
|
1631
|
+
* Handler called when websocket subscription is successfully established.
|
|
1632
|
+
*/
|
|
1633
|
+
onOswSuccessfulSubscription() {
|
|
1634
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1635
|
+
this.logger?.child({
|
|
1636
|
+
methodName: "onSuccessfulSubscription"
|
|
1637
|
+
}).debug("");
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
/**
|
|
1641
|
+
* Handler called when subscribed data becomes out of date.
|
|
1642
|
+
*/
|
|
1643
|
+
onOswOutOfDate() {
|
|
1644
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1645
|
+
this.logger?.child({
|
|
1646
|
+
methodName: "onOutOfDate"
|
|
1647
|
+
}).debug("");
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
/**
|
|
1651
|
+
* Handler called when websocket subscription encounters an error.
|
|
1652
|
+
*/
|
|
1653
|
+
onOswError(errors) {
|
|
1654
|
+
if (this.logger) {
|
|
1655
|
+
this.logger?.child({
|
|
1656
|
+
methodName: "onError"
|
|
1657
|
+
}).error("subscription errors", errors);
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
/**
|
|
1661
|
+
* Handler called when an object in the subscribed set is added or updated.
|
|
1662
|
+
* Default implementation stores the object with RDP config if available.
|
|
1663
|
+
*
|
|
1664
|
+
* @param update The object update notification
|
|
1665
|
+
*/
|
|
1666
|
+
onOswChange({
|
|
1667
|
+
object,
|
|
1668
|
+
state
|
|
1669
|
+
}) {
|
|
1670
|
+
const logger = process.env.NODE_ENV !== "production" ? this.logger?.child({
|
|
1671
|
+
methodName: "registerStreamUpdates"
|
|
1672
|
+
}) : this.logger;
|
|
1673
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1674
|
+
logger?.child({
|
|
1675
|
+
methodName: "onChange"
|
|
1676
|
+
}).debug(`Got an update of type: ${state}`, object);
|
|
1677
|
+
}
|
|
1678
|
+
if (state === "ADDED_OR_UPDATED") {
|
|
1679
|
+
this.store.batch({}, (batch) => {
|
|
1680
|
+
this.store.objects.storeOsdkInstances(
|
|
1681
|
+
[object],
|
|
1682
|
+
batch,
|
|
1683
|
+
this.rdpConfig
|
|
1684
|
+
// Safe - null for queries without RDPs
|
|
1685
|
+
);
|
|
1686
|
+
});
|
|
1687
|
+
} else if (state === "REMOVED") {
|
|
1688
|
+
this.onOswRemoved(object);
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
/**
|
|
1692
|
+
* Handler called when an object is removed from the subscribed set.
|
|
1693
|
+
* Default implementation deletes the object from cache.
|
|
1694
|
+
* ListQuery overrides this for list-specific removal logic.
|
|
1695
|
+
*
|
|
1696
|
+
* @param object The removed object
|
|
1697
|
+
*/
|
|
1698
|
+
onOswRemoved(object) {
|
|
1699
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1700
|
+
this.logger?.child({
|
|
1701
|
+
methodName: "onRemoved"
|
|
1702
|
+
}).debug("Removing object", object);
|
|
1703
|
+
}
|
|
1704
|
+
this.store.batch({}, (batch) => {
|
|
1705
|
+
const objectCacheKey = this.store.cacheKeys.get("object", object.$apiName, object.$primaryKey);
|
|
1706
|
+
batch.delete(objectCacheKey, "loaded");
|
|
1707
|
+
});
|
|
1708
|
+
}
|
|
1581
1709
|
};
|
|
1582
1710
|
|
|
1583
1711
|
// src/observable/internal/links/SpecificLinkQuery.ts
|
|
@@ -1594,7 +1722,7 @@ var SpecificLinkQuery = class extends BaseListQuery {
|
|
|
1594
1722
|
batch.changes.modified.add(this.cacheKey);
|
|
1595
1723
|
}
|
|
1596
1724
|
constructor(store, subject, cacheKey, opts) {
|
|
1597
|
-
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[
|
|
1725
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunk3LMKH6RS_cjs.additionalContext].logger?.child({}, {
|
|
1598
1726
|
msgPrefix: `SpecificLinkQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
1599
1727
|
}) : void 0);
|
|
1600
1728
|
[this.#sourceApiName, this.#sourcePk, this.#linkName, this.#whereClause, this.#orderBy] = cacheKey.otherKeys;
|
|
@@ -1611,7 +1739,7 @@ var SpecificLinkQuery = class extends BaseListQuery {
|
|
|
1611
1739
|
type: "object",
|
|
1612
1740
|
apiName: this.#sourceApiName
|
|
1613
1741
|
};
|
|
1614
|
-
const sourceMetadata = await client[
|
|
1742
|
+
const sourceMetadata = await client[chunk3LMKH6RS_cjs.additionalContext].ontologyProvider.getObjectDefinition(this.#sourceApiName);
|
|
1615
1743
|
const sourceQuery = client(sourceObjectDef).where({
|
|
1616
1744
|
[sourceMetadata.primaryKeyApiName]: this.#sourcePk
|
|
1617
1745
|
});
|
|
@@ -1675,7 +1803,7 @@ var SpecificLinkQuery = class extends BaseListQuery {
|
|
|
1675
1803
|
return this.revalidate(true);
|
|
1676
1804
|
} else {
|
|
1677
1805
|
return (async () => {
|
|
1678
|
-
const sourceMetadata = await this.store.client[
|
|
1806
|
+
const sourceMetadata = await this.store.client[chunk3LMKH6RS_cjs.additionalContext].ontologyProvider.getObjectDefinition(this.#sourceApiName);
|
|
1679
1807
|
const linkDef = sourceMetadata.links?.[this.#linkName];
|
|
1680
1808
|
if (!linkDef || linkDef.targetType !== objectType) return;
|
|
1681
1809
|
const promise = this.revalidate(true);
|
|
@@ -1693,6 +1821,9 @@ var LinksHelper = class extends AbstractHelper {
|
|
|
1693
1821
|
this.whereCanonicalizer = whereCanonicalizer2;
|
|
1694
1822
|
this.orderByCanonicalizer = orderByCanonicalizer2;
|
|
1695
1823
|
}
|
|
1824
|
+
observe(options, subFn) {
|
|
1825
|
+
return super.observe(options, subFn);
|
|
1826
|
+
}
|
|
1696
1827
|
getQuery(options) {
|
|
1697
1828
|
const {
|
|
1698
1829
|
apiName
|
|
@@ -1803,13 +1934,6 @@ var ListQuery = class extends BaseListQuery {
|
|
|
1803
1934
|
// Using base class minResultsToLoad instead of a private property
|
|
1804
1935
|
#orderBy;
|
|
1805
1936
|
#objectSet;
|
|
1806
|
-
#websocketSubscription = null;
|
|
1807
|
-
#subscriptionRefCounts = new RefCounts(process.env.NODE_ENV !== "production" ? 2e3 : 5e3, () => {
|
|
1808
|
-
if (this.#websocketSubscription) {
|
|
1809
|
-
this.#websocketSubscription.unsubscribe();
|
|
1810
|
-
this.#websocketSubscription = null;
|
|
1811
|
-
}
|
|
1812
|
-
});
|
|
1813
1937
|
/**
|
|
1814
1938
|
* Register changes to the cache specific to ListQuery
|
|
1815
1939
|
*/
|
|
@@ -1817,7 +1941,7 @@ var ListQuery = class extends BaseListQuery {
|
|
|
1817
1941
|
batch.changes.registerList(this.cacheKey);
|
|
1818
1942
|
}
|
|
1819
1943
|
constructor(store, subject, apiName, cacheKey, opts) {
|
|
1820
|
-
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[
|
|
1944
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunk3LMKH6RS_cjs.additionalContext].logger?.child({}, {
|
|
1821
1945
|
msgPrefix: `ListQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
1822
1946
|
}) : void 0);
|
|
1823
1947
|
this.apiName = apiName;
|
|
@@ -1987,54 +2111,7 @@ var ListQuery = class extends BaseListQuery {
|
|
|
1987
2111
|
* Extract relevant objects for this query type.
|
|
1988
2112
|
*/
|
|
1989
2113
|
registerStreamUpdates(sub) {
|
|
1990
|
-
|
|
1991
|
-
methodName: "registerStreamUpdates"
|
|
1992
|
-
}) : this.logger;
|
|
1993
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1994
|
-
logger?.child({
|
|
1995
|
-
methodName: "observeList"
|
|
1996
|
-
}).info("Subscribing from websocket");
|
|
1997
|
-
}
|
|
1998
|
-
if (!this.#websocketSubscription) {
|
|
1999
|
-
this.#websocketSubscription = this.#objectSet.subscribe({
|
|
2000
|
-
onChange: this.onOswChange.bind(this),
|
|
2001
|
-
onError: this.onOswError.bind(this),
|
|
2002
|
-
onOutOfDate: this.onOswOutOfDate.bind(this),
|
|
2003
|
-
onSuccessfulSubscription: this.onOswSuccessfulSubscription.bind(this)
|
|
2004
|
-
});
|
|
2005
|
-
this.#subscriptionRefCounts.register("websocket");
|
|
2006
|
-
}
|
|
2007
|
-
this.#subscriptionRefCounts.retain("websocket");
|
|
2008
|
-
sub.add(() => {
|
|
2009
|
-
if (process.env.NODE_ENV !== "production") {
|
|
2010
|
-
logger?.child({
|
|
2011
|
-
methodName: "observeList"
|
|
2012
|
-
}).info("Unsubscribing from websocket");
|
|
2013
|
-
}
|
|
2014
|
-
this.#subscriptionRefCounts.release("websocket");
|
|
2015
|
-
this.#subscriptionRefCounts.gc();
|
|
2016
|
-
});
|
|
2017
|
-
}
|
|
2018
|
-
onOswSuccessfulSubscription() {
|
|
2019
|
-
if (process.env.NODE_ENV !== "production") {
|
|
2020
|
-
this.logger?.child({
|
|
2021
|
-
methodName: "onSuccessfulSubscription"
|
|
2022
|
-
}).debug("");
|
|
2023
|
-
}
|
|
2024
|
-
}
|
|
2025
|
-
onOswOutOfDate() {
|
|
2026
|
-
if (process.env.NODE_ENV !== "production") {
|
|
2027
|
-
this.logger?.child({
|
|
2028
|
-
methodName: "onOutOfDate"
|
|
2029
|
-
}).debug("");
|
|
2030
|
-
}
|
|
2031
|
-
}
|
|
2032
|
-
onOswError(errors) {
|
|
2033
|
-
if (this.logger) {
|
|
2034
|
-
this.logger?.child({
|
|
2035
|
-
methodName: "onError"
|
|
2036
|
-
}).error("subscription errors", errors);
|
|
2037
|
-
}
|
|
2114
|
+
this.createWebsocketSubscription(this.#objectSet, sub, "observeList");
|
|
2038
2115
|
}
|
|
2039
2116
|
onOswChange({
|
|
2040
2117
|
object: objOrIface,
|
|
@@ -2054,10 +2131,13 @@ var ListQuery = class extends BaseListQuery {
|
|
|
2054
2131
|
this.store.objects.storeOsdkInstances([object], batch, this.rdpConfig);
|
|
2055
2132
|
});
|
|
2056
2133
|
} else if (state === "REMOVED") {
|
|
2057
|
-
this.onOswRemoved(objOrIface
|
|
2134
|
+
this.onOswRemoved(objOrIface);
|
|
2058
2135
|
}
|
|
2059
2136
|
}
|
|
2060
|
-
onOswRemoved(objOrIface
|
|
2137
|
+
onOswRemoved(objOrIface) {
|
|
2138
|
+
const logger = process.env.NODE_ENV !== "production" ? this.logger?.child({
|
|
2139
|
+
methodName: "onOswRemoved"
|
|
2140
|
+
}) : this.logger;
|
|
2061
2141
|
this.store.batch({}, (batch) => {
|
|
2062
2142
|
const existing = batch.read(this.cacheKey);
|
|
2063
2143
|
!existing ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "the truth value for our list should exist as we already subscribed") : invariant4__default.default(false) : void 0;
|
|
@@ -2127,7 +2207,7 @@ var InterfaceListQuery = class extends ListQuery {
|
|
|
2127
2207
|
}
|
|
2128
2208
|
extractRelevantObjects(changes) {
|
|
2129
2209
|
const matchesApiName = ([, object]) => {
|
|
2130
|
-
return this.apiName in object[
|
|
2210
|
+
return this.apiName in object[chunk4ZOXOCQX_cjs.ObjectDefRef].interfaceMap;
|
|
2131
2211
|
};
|
|
2132
2212
|
const added = Array.from(changes.addedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
|
|
2133
2213
|
const modified = Array.from(changes.modifiedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
|
|
@@ -2148,7 +2228,7 @@ var InterfaceListQuery = class extends ListQuery {
|
|
|
2148
2228
|
async function reloadDataAsFullObjects(client, data) {
|
|
2149
2229
|
const groups = groupBy__default.default(data, (x) => x.$objectType);
|
|
2150
2230
|
const objectTypeToPrimaryKeyToObject = Object.fromEntries(await Promise.all(Object.entries(groups).map(async ([apiName, objects]) => {
|
|
2151
|
-
const objectDef = objects[0][
|
|
2231
|
+
const objectDef = objects[0][chunk4ZOXOCQX_cjs.UnderlyingOsdkObject][chunk4ZOXOCQX_cjs.ObjectDefRef];
|
|
2152
2232
|
const where = {
|
|
2153
2233
|
[objectDef.primaryKeyApiName]: {
|
|
2154
2234
|
$in: objects.map((x) => x.$primaryKey)
|
|
@@ -2440,7 +2520,7 @@ var BulkObjectLoader = class {
|
|
|
2440
2520
|
#maxEntries;
|
|
2441
2521
|
constructor(client, maxWait = 25, maxEntries = 100) {
|
|
2442
2522
|
this.#client = client;
|
|
2443
|
-
this.#logger = client[
|
|
2523
|
+
this.#logger = client[chunk3LMKH6RS_cjs.additionalContext].logger;
|
|
2444
2524
|
this.#maxWait = maxWait;
|
|
2445
2525
|
this.#maxEntries = maxEntries;
|
|
2446
2526
|
}
|
|
@@ -2508,7 +2588,7 @@ var ObjectQuery = class extends Query {
|
|
|
2508
2588
|
#apiName;
|
|
2509
2589
|
#pk;
|
|
2510
2590
|
constructor(store, subject, type, pk, cacheKey, opts) {
|
|
2511
|
-
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[
|
|
2591
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunk3LMKH6RS_cjs.additionalContext].logger?.child({}, {
|
|
2512
2592
|
msgPrefix: `ObjectQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
2513
2593
|
}) : void 0);
|
|
2514
2594
|
this.#apiName = type;
|
|
@@ -2652,7 +2732,7 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
2652
2732
|
#composedObjectSet;
|
|
2653
2733
|
#objectTypes;
|
|
2654
2734
|
constructor(store, subject, baseObjectSetWire, operations, cacheKey, opts) {
|
|
2655
|
-
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[
|
|
2735
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunk3LMKH6RS_cjs.additionalContext].logger?.child({}, {
|
|
2656
2736
|
msgPrefix: `ObjectSetQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
2657
2737
|
}) : void 0);
|
|
2658
2738
|
this.#baseObjectSetWire = baseObjectSetWire;
|
|
@@ -2695,7 +2775,7 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
2695
2775
|
}
|
|
2696
2776
|
if (opts.union) {
|
|
2697
2777
|
for (const os of opts.union) {
|
|
2698
|
-
const wire =
|
|
2778
|
+
const wire = chunk3LMKH6RS_cjs.getWireObjectSet(os);
|
|
2699
2779
|
if (wire.type) {
|
|
2700
2780
|
types.add(wire.type);
|
|
2701
2781
|
}
|
|
@@ -2703,7 +2783,7 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
2703
2783
|
}
|
|
2704
2784
|
if (opts.intersect) {
|
|
2705
2785
|
for (const os of opts.intersect) {
|
|
2706
|
-
const wire =
|
|
2786
|
+
const wire = chunk3LMKH6RS_cjs.getWireObjectSet(os);
|
|
2707
2787
|
if (wire.type) {
|
|
2708
2788
|
types.add(wire.type);
|
|
2709
2789
|
}
|
|
@@ -2711,7 +2791,7 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
2711
2791
|
}
|
|
2712
2792
|
if (opts.subtract) {
|
|
2713
2793
|
for (const os of opts.subtract) {
|
|
2714
|
-
const wire =
|
|
2794
|
+
const wire = chunk3LMKH6RS_cjs.getWireObjectSet(os);
|
|
2715
2795
|
if (wire.type) {
|
|
2716
2796
|
types.add(wire.type);
|
|
2717
2797
|
}
|
|
@@ -2751,6 +2831,9 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
2751
2831
|
data: []
|
|
2752
2832
|
}, "error", batch);
|
|
2753
2833
|
}
|
|
2834
|
+
registerStreamUpdates(sub) {
|
|
2835
|
+
this.createWebsocketSubscription(this.#composedObjectSet, sub, "observeObjectSet");
|
|
2836
|
+
}
|
|
2754
2837
|
invalidateObjectType = async (objectType, changes) => {
|
|
2755
2838
|
if (this.#objectTypes.has(objectType)) {
|
|
2756
2839
|
changes?.modified.add(this.cacheKey);
|
|
@@ -2779,13 +2862,17 @@ var ObjectSetHelper = class extends AbstractHelper {
|
|
|
2779
2862
|
this.orderByCanonicalizer = orderByCanonicalizer2;
|
|
2780
2863
|
}
|
|
2781
2864
|
observe(options, subFn) {
|
|
2782
|
-
|
|
2865
|
+
const ret = super.observe(options, subFn);
|
|
2866
|
+
if (options.streamUpdates) {
|
|
2867
|
+
ret.query.registerStreamUpdates(ret.subscription);
|
|
2868
|
+
}
|
|
2869
|
+
return ret;
|
|
2783
2870
|
}
|
|
2784
2871
|
getQuery(options) {
|
|
2785
2872
|
const {
|
|
2786
2873
|
baseObjectSet
|
|
2787
2874
|
} = options;
|
|
2788
|
-
const baseObjectSetWire = JSON.stringify(
|
|
2875
|
+
const baseObjectSetWire = JSON.stringify(chunk3LMKH6RS_cjs.getWireObjectSet(baseObjectSet));
|
|
2789
2876
|
const operations = this.buildCanonicalizedOperations(options);
|
|
2790
2877
|
const objectSetCacheKey = this.cacheKeys.get("objectSet", baseObjectSetWire, operations);
|
|
2791
2878
|
return this.store.queries.get(objectSetCacheKey, () => {
|
|
@@ -2801,13 +2888,13 @@ var ObjectSetHelper = class extends AbstractHelper {
|
|
|
2801
2888
|
operations.withProperties = Object.keys(options.withProperties).sort();
|
|
2802
2889
|
}
|
|
2803
2890
|
if (options.union && options.union.length > 0) {
|
|
2804
|
-
operations.union = options.union.map((os) => JSON.stringify(
|
|
2891
|
+
operations.union = options.union.map((os) => JSON.stringify(chunk3LMKH6RS_cjs.getWireObjectSet(os)));
|
|
2805
2892
|
}
|
|
2806
2893
|
if (options.intersect && options.intersect.length > 0) {
|
|
2807
|
-
operations.intersect = options.intersect.map((os) => JSON.stringify(
|
|
2894
|
+
operations.intersect = options.intersect.map((os) => JSON.stringify(chunk3LMKH6RS_cjs.getWireObjectSet(os)));
|
|
2808
2895
|
}
|
|
2809
2896
|
if (options.subtract && options.subtract.length > 0) {
|
|
2810
|
-
operations.subtract = options.subtract.map((os) => JSON.stringify(
|
|
2897
|
+
operations.subtract = options.subtract.map((os) => JSON.stringify(chunk3LMKH6RS_cjs.getWireObjectSet(os)));
|
|
2811
2898
|
}
|
|
2812
2899
|
if (options.pivotTo) {
|
|
2813
2900
|
operations.pivotTo = options.pivotTo;
|
|
@@ -2884,7 +2971,7 @@ var RdpCanonicalizer = class extends CachingCanonicalizer {
|
|
|
2884
2971
|
apiName: "__rdp_canonicalizer_holder__"
|
|
2885
2972
|
};
|
|
2886
2973
|
for (const [key, rdpFunction] of Object.entries(rdp)) {
|
|
2887
|
-
const builder =
|
|
2974
|
+
const builder = chunk3LMKH6RS_cjs.createWithPropertiesObjectSet(
|
|
2888
2975
|
objectTypeHolder,
|
|
2889
2976
|
{
|
|
2890
2977
|
type: "methodInput"
|
|
@@ -2933,7 +3020,7 @@ var Store = class {
|
|
|
2933
3020
|
subjects = this.layers.subjects;
|
|
2934
3021
|
// these are hopefully temporary
|
|
2935
3022
|
constructor(client) {
|
|
2936
|
-
this.logger = client[
|
|
3023
|
+
this.logger = client[chunk3LMKH6RS_cjs.additionalContext].logger?.child({}, {
|
|
2937
3024
|
msgPrefix: "Store"
|
|
2938
3025
|
});
|
|
2939
3026
|
this.client = client;
|
|
@@ -3194,10 +3281,10 @@ var Store = class {
|
|
|
3194
3281
|
|
|
3195
3282
|
// src/observable/ObservableClient.ts
|
|
3196
3283
|
function createObservableClient(client) {
|
|
3197
|
-
const tweakedClient =
|
|
3198
|
-
...client[
|
|
3199
|
-
fetch: shared_net_fetch.createFetchHeaderMutator(client[
|
|
3200
|
-
headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"),
|
|
3284
|
+
const tweakedClient = chunk4ZOXOCQX_cjs.createClientFromContext({
|
|
3285
|
+
...client[chunk3LMKH6RS_cjs.additionalContext],
|
|
3286
|
+
fetch: shared_net_fetch.createFetchHeaderMutator(client[chunk3LMKH6RS_cjs.additionalContext].fetch, (headers) => {
|
|
3287
|
+
headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"), chunk4ZOXOCQX_cjs.OBSERVABLE_USER_AGENT].filter((x) => x && x?.length > 0).join(" "));
|
|
3201
3288
|
return headers;
|
|
3202
3289
|
})
|
|
3203
3290
|
});
|
|
@@ -3240,11 +3327,11 @@ function getOsdkConfig(ontologyRid) {
|
|
|
3240
3327
|
|
|
3241
3328
|
Object.defineProperty(exports, "createClientWithTransaction", {
|
|
3242
3329
|
enumerable: true,
|
|
3243
|
-
get: function () { return
|
|
3330
|
+
get: function () { return chunk4ZOXOCQX_cjs.createClientWithTransaction; }
|
|
3244
3331
|
});
|
|
3245
3332
|
Object.defineProperty(exports, "augment", {
|
|
3246
3333
|
enumerable: true,
|
|
3247
|
-
get: function () { return
|
|
3334
|
+
get: function () { return chunk3LMKH6RS_cjs.augment; }
|
|
3248
3335
|
});
|
|
3249
3336
|
exports.computeObjectSetCacheKey = computeObjectSetCacheKey;
|
|
3250
3337
|
exports.createObservableClient = createObservableClient;
|