@osdk/client 2.7.0-beta.8 → 2.7.0-beta.9
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 +14 -0
- package/build/browser/observable/internal/Store.test.js +49 -1
- package/build/browser/observable/internal/Store.test.js.map +1 -1
- package/build/browser/observable/internal/list/ListQuery.js +17 -2
- package/build/browser/observable/internal/list/ListQuery.js.map +1 -1
- package/build/browser/observable/internal/objectset/ObjectSetQuery.js +9 -7
- package/build/browser/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
- package/build/browser/observable/internal/utils/rdpFieldOperations.test.js +172 -0
- package/build/browser/observable/internal/utils/rdpFieldOperations.test.js.map +1 -0
- package/build/browser/util/UserAgent.js +2 -2
- package/build/cjs/{chunk-FL7QZC57.cjs → chunk-IQJTM3KW.cjs} +4 -4
- package/build/cjs/{chunk-FL7QZC57.cjs.map → chunk-IQJTM3KW.cjs.map} +1 -1
- package/build/cjs/index.cjs +7 -7
- package/build/cjs/public/unstable-do-not-use.cjs +204 -36
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/esm/observable/internal/Store.test.js +49 -1
- package/build/esm/observable/internal/Store.test.js.map +1 -1
- package/build/esm/observable/internal/list/ListQuery.js +17 -2
- package/build/esm/observable/internal/list/ListQuery.js.map +1 -1
- package/build/esm/observable/internal/objectset/ObjectSetQuery.js +9 -7
- package/build/esm/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
- package/build/esm/observable/internal/utils/rdpFieldOperations.test.js +172 -0
- package/build/esm/observable/internal/utils/rdpFieldOperations.test.js.map +1 -0
- package/build/esm/util/UserAgent.js +2 -2
- package/build/types/observable/internal/Store.test.d.ts.map +1 -1
- package/build/types/observable/internal/list/ListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/objectset/ObjectSetQuery.d.ts.map +1 -1
- package/build/types/observable/internal/utils/rdpFieldOperations.test.d.ts +1 -0
- package/build/types/observable/internal/utils/rdpFieldOperations.test.d.ts.map +1 -0
- package/package.json +6 -6
package/build/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkIQJTM3KW_cjs = require('./chunk-IQJTM3KW.cjs');
|
|
4
4
|
require('./chunk-PARVKNVB.cjs');
|
|
5
5
|
var chunkLDTMSHUZ_cjs = require('./chunk-LDTMSHUZ.cjs');
|
|
6
6
|
var api = require('@osdk/api');
|
|
@@ -18,7 +18,7 @@ chunkLDTMSHUZ_cjs.init_cjs_shims();
|
|
|
18
18
|
// src/createPlatformClient.ts
|
|
19
19
|
chunkLDTMSHUZ_cjs.init_cjs_shims();
|
|
20
20
|
function createPlatformClient(baseUrl, tokenProvider, options = void 0, fetchFn = fetch) {
|
|
21
|
-
return shared_client_impl.createSharedClientContext(baseUrl, tokenProvider,
|
|
21
|
+
return shared_client_impl.createSharedClientContext(baseUrl, tokenProvider, chunkIQJTM3KW_cjs.USER_AGENT, fetchFn);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// src/util/datetimeConverters.ts
|
|
@@ -45,23 +45,23 @@ var extractDateFromIsoString = (dateTime) => {
|
|
|
45
45
|
|
|
46
46
|
Object.defineProperty(exports, "ActionValidationError", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunkIQJTM3KW_cjs.ActionValidationError; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "createAttachmentUpload", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunkIQJTM3KW_cjs.createAttachmentUpload; }
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "createClient", {
|
|
55
55
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunkIQJTM3KW_cjs.createClient; }
|
|
57
57
|
});
|
|
58
58
|
Object.defineProperty(exports, "createObjectSpecifierFromPrimaryKey", {
|
|
59
59
|
enumerable: true,
|
|
60
|
-
get: function () { return
|
|
60
|
+
get: function () { return chunkIQJTM3KW_cjs.createObjectSpecifierFromPrimaryKey; }
|
|
61
61
|
});
|
|
62
62
|
Object.defineProperty(exports, "extractPrimaryKeyFromObjectSpecifier", {
|
|
63
63
|
enumerable: true,
|
|
64
|
-
get: function () { return
|
|
64
|
+
get: function () { return chunkIQJTM3KW_cjs.extractPrimaryKeyFromObjectSpecifier; }
|
|
65
65
|
});
|
|
66
66
|
Object.defineProperty(exports, "NULL_VALUE", {
|
|
67
67
|
enumerable: true,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkIQJTM3KW_cjs = require('../chunk-IQJTM3KW.cjs');
|
|
4
4
|
var chunkPARVKNVB_cjs = require('../chunk-PARVKNVB.cjs');
|
|
5
5
|
var chunkLDTMSHUZ_cjs = require('../chunk-LDTMSHUZ.cjs');
|
|
6
6
|
var trie = require('@wry/trie');
|
|
7
7
|
var deepEqual = require('fast-deep-equal');
|
|
8
|
-
var
|
|
8
|
+
var invariant5 = require('tiny-invariant');
|
|
9
9
|
var shared_net_fetch = require('@osdk/shared.net.fetch');
|
|
10
10
|
var rxjs = require('rxjs');
|
|
11
11
|
var mnemonist = require('mnemonist');
|
|
@@ -15,7 +15,7 @@ var shared_net_errors = require('@osdk/shared.net.errors');
|
|
|
15
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
|
|
17
17
|
var deepEqual__default = /*#__PURE__*/_interopDefault(deepEqual);
|
|
18
|
-
var
|
|
18
|
+
var invariant5__default = /*#__PURE__*/_interopDefault(invariant5);
|
|
19
19
|
var groupBy__default = /*#__PURE__*/_interopDefault(groupBy);
|
|
20
20
|
|
|
21
21
|
// src/public/unstable-do-not-use.ts
|
|
@@ -126,8 +126,8 @@ var WhereClauseCanonicalizer = class {
|
|
|
126
126
|
#toCanon = (where, set = /* @__PURE__ */ new Set()) => {
|
|
127
127
|
if ("$and" in where) {
|
|
128
128
|
if (process.env.NODE_ENV !== "production") {
|
|
129
|
-
!Array.isArray(where.$and) ? process.env.NODE_ENV !== "production" ?
|
|
130
|
-
!(Object.keys(where).length === 1) ? process.env.NODE_ENV !== "production" ?
|
|
129
|
+
!Array.isArray(where.$and) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "expected $and to be an array") : invariant5__default.default(false) : void 0;
|
|
130
|
+
!(Object.keys(where).length === 1) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "expected only $and to be present") : invariant5__default.default(false) : void 0;
|
|
131
131
|
}
|
|
132
132
|
if (where.$and.length === 0) {
|
|
133
133
|
return {};
|
|
@@ -1301,7 +1301,7 @@ var Layers = class {
|
|
|
1301
1301
|
return this.#truthLayer;
|
|
1302
1302
|
}
|
|
1303
1303
|
remove(layerId) {
|
|
1304
|
-
!(layerId != null) ? process.env.NODE_ENV !== "production" ?
|
|
1304
|
+
!(layerId != null) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "undefined is the reserved layerId for the truth layer") : invariant5__default.default(false) : void 0;
|
|
1305
1305
|
let currentLayer = this.#topLayer;
|
|
1306
1306
|
const cacheKeys = /* @__PURE__ */ new Map();
|
|
1307
1307
|
while (currentLayer != null && currentLayer.parentLayer != null) {
|
|
@@ -1329,7 +1329,7 @@ var Layers = class {
|
|
|
1329
1329
|
optimisticId,
|
|
1330
1330
|
changes
|
|
1331
1331
|
}, batchFn) {
|
|
1332
|
-
!(optimisticId === void 0 || !!optimisticId) ? process.env.NODE_ENV !== "production" ?
|
|
1332
|
+
!(optimisticId === void 0 || !!optimisticId) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "optimistic must be undefined or not falsy") : invariant5__default.default(false) : void 0;
|
|
1333
1333
|
const batchContext = this.#createBatchContext({
|
|
1334
1334
|
optimisticId,
|
|
1335
1335
|
changes
|
|
@@ -2105,6 +2105,162 @@ chunkLDTMSHUZ_cjs.init_cjs_shims();
|
|
|
2105
2105
|
// src/observable/internal/list/ListQuery.ts
|
|
2106
2106
|
chunkLDTMSHUZ_cjs.init_cjs_shims();
|
|
2107
2107
|
|
|
2108
|
+
// src/observable/internal/getObjectTypesThatInvalidate.ts
|
|
2109
|
+
chunkLDTMSHUZ_cjs.init_cjs_shims();
|
|
2110
|
+
async function getObjectTypesThatInvalidate(mc, objectSet) {
|
|
2111
|
+
const counts = {};
|
|
2112
|
+
const resultType = await calcObjectSet(objectSet, {
|
|
2113
|
+
counts,
|
|
2114
|
+
methodInput: void 0,
|
|
2115
|
+
ontologyProvider: mc.ontologyProvider
|
|
2116
|
+
});
|
|
2117
|
+
const tweaked = {
|
|
2118
|
+
...counts,
|
|
2119
|
+
[resultType.apiName]: counts[resultType.apiName] - 1
|
|
2120
|
+
};
|
|
2121
|
+
return {
|
|
2122
|
+
resultType,
|
|
2123
|
+
counts,
|
|
2124
|
+
invalidationSet: new Set(Object.entries(tweaked).filter(([, v]) => v > 0).map(([k]) => k))
|
|
2125
|
+
};
|
|
2126
|
+
}
|
|
2127
|
+
async function calcObjectSet(os, ctx) {
|
|
2128
|
+
const op = ctx.ontologyProvider;
|
|
2129
|
+
async function bumpObject(apiName) {
|
|
2130
|
+
const objectType = await op.getObjectDefinition(apiName);
|
|
2131
|
+
ctx.counts[apiName] = (ctx.counts[apiName] ?? 0) + 1;
|
|
2132
|
+
return objectType;
|
|
2133
|
+
}
|
|
2134
|
+
async function bumpInterface(apiName) {
|
|
2135
|
+
const interfaceDef = await op.getInterfaceDefinition(apiName);
|
|
2136
|
+
for (const s of interfaceDef.implementedBy ?? []) {
|
|
2137
|
+
ctx.counts[s] = (ctx.counts[s] ?? 0) + 1;
|
|
2138
|
+
}
|
|
2139
|
+
return interfaceDef;
|
|
2140
|
+
}
|
|
2141
|
+
switch (os.type) {
|
|
2142
|
+
case "base":
|
|
2143
|
+
return await bumpObject(os.objectType);
|
|
2144
|
+
case "interfaceBase":
|
|
2145
|
+
return await bumpInterface(os.interfaceType);
|
|
2146
|
+
case "interfaceLinkSearchAround": {
|
|
2147
|
+
const srcDef = await calcObjectSet(os.objectSet, ctx);
|
|
2148
|
+
!(srcDef.type === "interface") ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false) : invariant5__default.default(false) : void 0;
|
|
2149
|
+
for (const [k, v] of Object.entries(srcDef.links)) {
|
|
2150
|
+
if (k === os.interfaceLink) {
|
|
2151
|
+
if (v.targetType === "object") {
|
|
2152
|
+
return await bumpObject(v.targetType);
|
|
2153
|
+
}
|
|
2154
|
+
return await bumpInterface(v.targetType);
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
throw new Error(`Could not find link ${os.interfaceLink} in object set ${JSON.stringify(os.objectSet)}`);
|
|
2158
|
+
}
|
|
2159
|
+
case "searchAround": {
|
|
2160
|
+
const contextDef = await calcObjectSet(os.objectSet, ctx);
|
|
2161
|
+
!(contextDef.type === "object") ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false) : invariant5__default.default(false) : void 0;
|
|
2162
|
+
for (const [k, v] of Object.entries(contextDef.links)) {
|
|
2163
|
+
if (k === os.link) {
|
|
2164
|
+
return await bumpObject(v.targetType);
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
throw new Error(`Could not find link ${os.link} in object set ${JSON.stringify(os.objectSet)}`);
|
|
2168
|
+
}
|
|
2169
|
+
case "filter":
|
|
2170
|
+
return calcObjectSet(os.objectSet, ctx);
|
|
2171
|
+
case "union":
|
|
2172
|
+
case "subtract":
|
|
2173
|
+
case "intersect":
|
|
2174
|
+
const returnTypes = await Promise.all(os.objectSets.map(async (os2) => {
|
|
2175
|
+
const counts = {};
|
|
2176
|
+
const r = await calcObjectSet(os2, {
|
|
2177
|
+
...ctx,
|
|
2178
|
+
counts
|
|
2179
|
+
});
|
|
2180
|
+
return {
|
|
2181
|
+
r,
|
|
2182
|
+
counts
|
|
2183
|
+
};
|
|
2184
|
+
}));
|
|
2185
|
+
for (const {
|
|
2186
|
+
counts
|
|
2187
|
+
} of returnTypes) {
|
|
2188
|
+
for (const [k, v] of Object.entries(counts)) {
|
|
2189
|
+
ctx.counts[k] = Math.max(ctx.counts[k] ?? 0, v);
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
if (returnTypes.length === 0) {
|
|
2193
|
+
throw new Error(`Could not find any context types for set operation`);
|
|
2194
|
+
}
|
|
2195
|
+
const allMatch = returnTypes.every(({
|
|
2196
|
+
r
|
|
2197
|
+
}) => r.apiName === returnTypes[0].r.apiName);
|
|
2198
|
+
if (!allMatch) {
|
|
2199
|
+
throw new Error(`Incompatible context types found for set operation`);
|
|
2200
|
+
}
|
|
2201
|
+
return returnTypes[0].r;
|
|
2202
|
+
case "withProperties":
|
|
2203
|
+
for (const [, v] of Object.entries(os.derivedProperties)) {
|
|
2204
|
+
await calcRdp(v, {
|
|
2205
|
+
...ctx,
|
|
2206
|
+
methodInput: os.objectSet
|
|
2207
|
+
});
|
|
2208
|
+
}
|
|
2209
|
+
return calcObjectSet(os.objectSet, {
|
|
2210
|
+
...ctx,
|
|
2211
|
+
methodInput: os.objectSet
|
|
2212
|
+
});
|
|
2213
|
+
// used by rdps
|
|
2214
|
+
case "methodInput":
|
|
2215
|
+
!ctx.methodInput ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "methodInput must be provided") : invariant5__default.default(false) : void 0;
|
|
2216
|
+
return await calcObjectSet(ctx.methodInput, {
|
|
2217
|
+
...ctx,
|
|
2218
|
+
counts: {}
|
|
2219
|
+
});
|
|
2220
|
+
case "asType":
|
|
2221
|
+
// we don't currently support this anywhere.
|
|
2222
|
+
case "asBaseObjectTypes":
|
|
2223
|
+
// We don't currently support this because it could return multiple object types conceptually
|
|
2224
|
+
// internally, we actually use it this way but we shouldn't be finding that object sets.
|
|
2225
|
+
case "reference":
|
|
2226
|
+
// reference is particularly problematic because we cannot answer the question about
|
|
2227
|
+
// which types without loading the object set definition (and it can change).
|
|
2228
|
+
case "static":
|
|
2229
|
+
throw new Error(`Unsupported ObjectSet type ${os.type}`);
|
|
2230
|
+
case "nearestNeighbors":
|
|
2231
|
+
return calcObjectSet(os.objectSet, ctx);
|
|
2232
|
+
default:
|
|
2233
|
+
throw new Error(`Unhandled ObjectSet type ${os.type}`);
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
async function calcRdp(dpd, ctx) {
|
|
2237
|
+
switch (dpd.type) {
|
|
2238
|
+
// Operates on object sets
|
|
2239
|
+
case "selection":
|
|
2240
|
+
return await calcObjectSet(dpd.objectSet, ctx);
|
|
2241
|
+
// Operates on single property
|
|
2242
|
+
case "negate":
|
|
2243
|
+
case "extract":
|
|
2244
|
+
case "absoluteValue":
|
|
2245
|
+
return await calcRdp(dpd.property, ctx);
|
|
2246
|
+
// Operates on many (unordered) properties
|
|
2247
|
+
case "least":
|
|
2248
|
+
case "greatest":
|
|
2249
|
+
case "add":
|
|
2250
|
+
case "multiply":
|
|
2251
|
+
return await Promise.all(dpd.properties.map((innerDpd) => calcRdp(innerDpd, ctx)));
|
|
2252
|
+
// Operates on 2 ordered properties
|
|
2253
|
+
case "subtract":
|
|
2254
|
+
case "divide":
|
|
2255
|
+
return await Promise.all([calcRdp(dpd.left, ctx), calcRdp(dpd.right, ctx)]);
|
|
2256
|
+
// Operates on a single property name
|
|
2257
|
+
case "property":
|
|
2258
|
+
return;
|
|
2259
|
+
default:
|
|
2260
|
+
throw new Error(`Unhandled DerivedPropertyDefinition type ${dpd.type}`);
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2108
2264
|
// src/observable/internal/objectMatchesWhereClause.ts
|
|
2109
2265
|
chunkLDTMSHUZ_cjs.init_cjs_shims();
|
|
2110
2266
|
|
|
@@ -2139,7 +2295,7 @@ function evaluateFilter(f, realValue, expected, strict) {
|
|
|
2139
2295
|
return !strict;
|
|
2140
2296
|
default:
|
|
2141
2297
|
if (process.env.NODE_ENV !== "production") {
|
|
2142
|
-
process.env.NODE_ENV !== "production" ?
|
|
2298
|
+
process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Unknown where filter ${f}`) : invariant5__default.default(false) ;
|
|
2143
2299
|
}
|
|
2144
2300
|
return !strict;
|
|
2145
2301
|
}
|
|
@@ -2149,8 +2305,8 @@ function evaluateFilter(f, realValue, expected, strict) {
|
|
|
2149
2305
|
function is$and(whereClause) {
|
|
2150
2306
|
if (process.env.NODE_ENV !== "production") {
|
|
2151
2307
|
if ("$and" in whereClause) {
|
|
2152
|
-
!Array.isArray(whereClause.$and) ? process.env.NODE_ENV !== "production" ?
|
|
2153
|
-
!(Object.keys(whereClause).length === 1) ? process.env.NODE_ENV !== "production" ?
|
|
2308
|
+
!Array.isArray(whereClause.$and) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "expected $and to be an array") : invariant5__default.default(false) : void 0;
|
|
2309
|
+
!(Object.keys(whereClause).length === 1) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "expected only $and to be present") : invariant5__default.default(false) : void 0;
|
|
2154
2310
|
}
|
|
2155
2311
|
}
|
|
2156
2312
|
return "$and" in whereClause;
|
|
@@ -2158,8 +2314,8 @@ function is$and(whereClause) {
|
|
|
2158
2314
|
function is$or(whereClause) {
|
|
2159
2315
|
if (process.env.NODE_ENV !== "production") {
|
|
2160
2316
|
if ("$or" in whereClause) {
|
|
2161
|
-
!Array.isArray(whereClause.$or) ? process.env.NODE_ENV !== "production" ?
|
|
2162
|
-
!(Object.keys(whereClause).length === 1) ? process.env.NODE_ENV !== "production" ?
|
|
2317
|
+
!Array.isArray(whereClause.$or) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "expected $or to be an array") : invariant5__default.default(false) : void 0;
|
|
2318
|
+
!(Object.keys(whereClause).length === 1) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "expected only $or to be present") : invariant5__default.default(false) : void 0;
|
|
2163
2319
|
}
|
|
2164
2320
|
}
|
|
2165
2321
|
return "$or" in whereClause;
|
|
@@ -2167,7 +2323,7 @@ function is$or(whereClause) {
|
|
|
2167
2323
|
function is$not(whereClause) {
|
|
2168
2324
|
if (process.env.NODE_ENV !== "production") {
|
|
2169
2325
|
if ("$not" in whereClause) {
|
|
2170
|
-
!(Object.keys(whereClause).length === 1) ? process.env.NODE_ENV !== "production" ?
|
|
2326
|
+
!(Object.keys(whereClause).length === 1) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "expected only $not to be present") : invariant5__default.default(false) : void 0;
|
|
2171
2327
|
}
|
|
2172
2328
|
}
|
|
2173
2329
|
return "$not" in whereClause;
|
|
@@ -2226,7 +2382,9 @@ var ListQuery = class extends BaseListQuery {
|
|
|
2226
2382
|
this.#intersectWith = cacheKey.otherKeys[INTERSECT_IDX];
|
|
2227
2383
|
this.#pivotInfo = cacheKey.otherKeys[PIVOT_IDX];
|
|
2228
2384
|
this.#objectSet = this.createObjectSet(store);
|
|
2229
|
-
|
|
2385
|
+
if (!this.#pivotInfo) {
|
|
2386
|
+
this.sortingStrategy = new OrderBySortingStrategy(this.apiName, this.#orderBy);
|
|
2387
|
+
}
|
|
2230
2388
|
if (opts.autoFetchMore === true) {
|
|
2231
2389
|
this.minResultsToLoad = Number.MAX_SAFE_INTEGER;
|
|
2232
2390
|
} else if (typeof opts.autoFetchMore === "number") {
|
|
@@ -2252,6 +2410,13 @@ var ListQuery = class extends BaseListQuery {
|
|
|
2252
2410
|
* Fetches a page of data
|
|
2253
2411
|
*/
|
|
2254
2412
|
async fetchPageData(signal) {
|
|
2413
|
+
if (Object.keys(this.#orderBy).length > 0 && !(this.sortingStrategy instanceof OrderBySortingStrategy)) {
|
|
2414
|
+
const wireObjectSet = chunkPARVKNVB_cjs.getWireObjectSet(this.#objectSet);
|
|
2415
|
+
const {
|
|
2416
|
+
resultType
|
|
2417
|
+
} = await getObjectTypesThatInvalidate(this.store.client[chunkPARVKNVB_cjs.additionalContext], wireObjectSet);
|
|
2418
|
+
this.sortingStrategy = new OrderBySortingStrategy(resultType.apiName, this.#orderBy);
|
|
2419
|
+
}
|
|
2255
2420
|
const resp = await this.#objectSet.fetchPage({
|
|
2256
2421
|
$nextPageToken: this.nextPageToken,
|
|
2257
2422
|
$pageSize: this.options.pageSize,
|
|
@@ -2430,7 +2595,7 @@ var ListQuery = class extends BaseListQuery {
|
|
|
2430
2595
|
}) : this.logger;
|
|
2431
2596
|
this.store.batch({}, (batch) => {
|
|
2432
2597
|
const existing = batch.read(this.cacheKey);
|
|
2433
|
-
!existing ? process.env.NODE_ENV !== "production" ?
|
|
2598
|
+
!existing ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "the truth value for our list should exist as we already subscribed") : invariant5__default.default(false) : void 0;
|
|
2434
2599
|
if (existing.status === "loaded") {
|
|
2435
2600
|
const objectCacheKey = this.getObjectCacheKey(objOrIface);
|
|
2436
2601
|
const newObjects = existing.value?.data.filter((o) => o !== objectCacheKey);
|
|
@@ -2497,7 +2662,7 @@ var InterfaceListQuery = class extends ListQuery {
|
|
|
2497
2662
|
}
|
|
2498
2663
|
extractRelevantObjects(changes) {
|
|
2499
2664
|
const matchesApiName = ([, object]) => {
|
|
2500
|
-
return this.apiName in object[
|
|
2665
|
+
return this.apiName in object[chunkIQJTM3KW_cjs.ObjectDefRef].interfaceMap;
|
|
2501
2666
|
};
|
|
2502
2667
|
const added = Array.from(changes.addedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
|
|
2503
2668
|
const modified = Array.from(changes.modifiedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
|
|
@@ -2518,7 +2683,7 @@ var InterfaceListQuery = class extends ListQuery {
|
|
|
2518
2683
|
async function reloadDataAsFullObjects(client, data) {
|
|
2519
2684
|
const groups = groupBy__default.default(data, (x) => x.$objectType);
|
|
2520
2685
|
const objectTypeToPrimaryKeyToObject = Object.fromEntries(await Promise.all(Object.entries(groups).map(async ([apiName, objects]) => {
|
|
2521
|
-
const objectDef = objects[0][
|
|
2686
|
+
const objectDef = objects[0][chunkIQJTM3KW_cjs.UnderlyingOsdkObject][chunkIQJTM3KW_cjs.ObjectDefRef];
|
|
2522
2687
|
const where = {
|
|
2523
2688
|
[objectDef.primaryKeyApiName]: {
|
|
2524
2689
|
$in: objects.map((x) => x.$primaryKey)
|
|
@@ -2528,7 +2693,7 @@ async function reloadDataAsFullObjects(client, data) {
|
|
|
2528
2693
|
return [apiName, Object.fromEntries(result.data.map((x) => [x.$primaryKey, x]))];
|
|
2529
2694
|
})));
|
|
2530
2695
|
data = data.map((obj) => {
|
|
2531
|
-
!objectTypeToPrimaryKeyToObject[obj.$objectType][obj.$primaryKey] ? process.env.NODE_ENV !== "production" ?
|
|
2696
|
+
!objectTypeToPrimaryKeyToObject[obj.$objectType][obj.$primaryKey] ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Could not find object ${obj.$objectType} ${obj.$primaryKey}`) : invariant5__default.default(false) : void 0;
|
|
2532
2697
|
return objectTypeToPrimaryKeyToObject[obj.$objectType][obj.$primaryKey];
|
|
2533
2698
|
});
|
|
2534
2699
|
return data;
|
|
@@ -2679,8 +2844,8 @@ function stripRdpFields(value, rdpFields) {
|
|
|
2679
2844
|
if (rdpFields.size === 0) {
|
|
2680
2845
|
return value;
|
|
2681
2846
|
}
|
|
2682
|
-
const underlying = value[
|
|
2683
|
-
const objectDef = value[
|
|
2847
|
+
const underlying = value[chunkIQJTM3KW_cjs.UnderlyingOsdkObject];
|
|
2848
|
+
const objectDef = value[chunkIQJTM3KW_cjs.ObjectDefRef];
|
|
2684
2849
|
const newProps = {
|
|
2685
2850
|
$apiName: underlying.$apiName,
|
|
2686
2851
|
$objectType: underlying.$objectType,
|
|
@@ -2692,7 +2857,7 @@ function stripRdpFields(value, rdpFields) {
|
|
|
2692
2857
|
newProps[key] = underlying[key];
|
|
2693
2858
|
}
|
|
2694
2859
|
}
|
|
2695
|
-
return
|
|
2860
|
+
return chunkIQJTM3KW_cjs.createOsdkObject(value[chunkIQJTM3KW_cjs.ClientRef], objectDef, newProps);
|
|
2696
2861
|
}
|
|
2697
2862
|
function isSuperset(superset, subset) {
|
|
2698
2863
|
for (const field of subset) {
|
|
@@ -2703,8 +2868,8 @@ function isSuperset(superset, subset) {
|
|
|
2703
2868
|
return true;
|
|
2704
2869
|
}
|
|
2705
2870
|
function filterToRdpFields(value, rdpFieldsToKeep, sourceRdpFields) {
|
|
2706
|
-
const underlying = value[
|
|
2707
|
-
const objectDef = value[
|
|
2871
|
+
const underlying = value[chunkIQJTM3KW_cjs.UnderlyingOsdkObject];
|
|
2872
|
+
const objectDef = value[chunkIQJTM3KW_cjs.ObjectDefRef];
|
|
2708
2873
|
const newProps = {
|
|
2709
2874
|
$apiName: underlying.$apiName,
|
|
2710
2875
|
$objectType: underlying.$objectType,
|
|
@@ -2719,7 +2884,7 @@ function filterToRdpFields(value, rdpFieldsToKeep, sourceRdpFields) {
|
|
|
2719
2884
|
}
|
|
2720
2885
|
}
|
|
2721
2886
|
}
|
|
2722
|
-
return
|
|
2887
|
+
return chunkIQJTM3KW_cjs.createOsdkObject(value[chunkIQJTM3KW_cjs.ClientRef], objectDef, newProps);
|
|
2723
2888
|
}
|
|
2724
2889
|
function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, targetCurrentValue) {
|
|
2725
2890
|
if (targetRdpFields.size === 0) {
|
|
@@ -2731,8 +2896,8 @@ function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, target
|
|
|
2731
2896
|
}
|
|
2732
2897
|
return filterToRdpFields(sourceValue, targetRdpFields, sourceRdpFields);
|
|
2733
2898
|
}
|
|
2734
|
-
const sourceUnderlying = sourceValue[
|
|
2735
|
-
const objectDef = sourceValue[
|
|
2899
|
+
const sourceUnderlying = sourceValue[chunkIQJTM3KW_cjs.UnderlyingOsdkObject];
|
|
2900
|
+
const objectDef = sourceValue[chunkIQJTM3KW_cjs.ObjectDefRef];
|
|
2736
2901
|
const newProps = {
|
|
2737
2902
|
$apiName: sourceUnderlying.$apiName,
|
|
2738
2903
|
$objectType: sourceUnderlying.$objectType,
|
|
@@ -2745,14 +2910,14 @@ function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, target
|
|
|
2745
2910
|
}
|
|
2746
2911
|
}
|
|
2747
2912
|
if (targetCurrentValue) {
|
|
2748
|
-
const targetUnderlying = targetCurrentValue[
|
|
2913
|
+
const targetUnderlying = targetCurrentValue[chunkIQJTM3KW_cjs.UnderlyingOsdkObject];
|
|
2749
2914
|
for (const field of targetRdpFields) {
|
|
2750
2915
|
if (!sourceRdpFields.has(field) && field in targetUnderlying) {
|
|
2751
2916
|
newProps[field] = targetUnderlying[field];
|
|
2752
2917
|
}
|
|
2753
2918
|
}
|
|
2754
2919
|
}
|
|
2755
|
-
return
|
|
2920
|
+
return chunkIQJTM3KW_cjs.createOsdkObject(sourceValue[chunkIQJTM3KW_cjs.ClientRef], objectDef, newProps);
|
|
2756
2921
|
}
|
|
2757
2922
|
|
|
2758
2923
|
// src/observable/internal/object/ObjectCacheKeyRegistry.ts
|
|
@@ -3110,10 +3275,6 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
3110
3275
|
this.#operations = operations;
|
|
3111
3276
|
this.#composedObjectSet = this.#composeObjectSet(opts);
|
|
3112
3277
|
this.#objectTypes = this.#extractObjectTypes(opts);
|
|
3113
|
-
if (operations.orderBy && Object.keys(operations.orderBy).length > 0) {
|
|
3114
|
-
const firstType = Array.from(this.#objectTypes)[0];
|
|
3115
|
-
this.sortingStrategy = new OrderBySortingStrategy(firstType, operations.orderBy);
|
|
3116
|
-
}
|
|
3117
3278
|
if (opts.autoFetchMore === true) {
|
|
3118
3279
|
this.minResultsToLoad = Number.MAX_SAFE_INTEGER;
|
|
3119
3280
|
} else if (typeof opts.autoFetchMore === "number") {
|
|
@@ -3187,6 +3348,13 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
3187
3348
|
* Fetches a page of data from the composed ObjectSet
|
|
3188
3349
|
*/
|
|
3189
3350
|
async fetchPageData(signal) {
|
|
3351
|
+
if (this.#operations.orderBy && Object.keys(this.#operations.orderBy).length > 0 && !(this.sortingStrategy instanceof OrderBySortingStrategy)) {
|
|
3352
|
+
const wireObjectSet = chunkPARVKNVB_cjs.getWireObjectSet(this.#composedObjectSet);
|
|
3353
|
+
const {
|
|
3354
|
+
resultType
|
|
3355
|
+
} = await getObjectTypesThatInvalidate(this.store.client[chunkPARVKNVB_cjs.additionalContext], wireObjectSet);
|
|
3356
|
+
this.sortingStrategy = new OrderBySortingStrategy(resultType.apiName, this.#operations.orderBy);
|
|
3357
|
+
}
|
|
3190
3358
|
const resp = await this.#composedObjectSet.fetchPage({
|
|
3191
3359
|
$nextPageToken: this.nextPageToken,
|
|
3192
3360
|
$pageSize: this.options.pageSize,
|
|
@@ -3414,7 +3582,7 @@ var Store = class {
|
|
|
3414
3582
|
#cleanupCacheKey = (key) => {
|
|
3415
3583
|
const subject = this.subjects.peek(key);
|
|
3416
3584
|
if (process.env.NODE_ENV !== "production") {
|
|
3417
|
-
!subject ? process.env.NODE_ENV !== "production" ?
|
|
3585
|
+
!subject ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false) : invariant5__default.default(false) : void 0;
|
|
3418
3586
|
}
|
|
3419
3587
|
this.subjects.delete(key);
|
|
3420
3588
|
this.queries.delete(key);
|
|
@@ -3660,10 +3828,10 @@ var Store = class {
|
|
|
3660
3828
|
|
|
3661
3829
|
// src/observable/ObservableClient.ts
|
|
3662
3830
|
function createObservableClient(client) {
|
|
3663
|
-
const tweakedClient =
|
|
3831
|
+
const tweakedClient = chunkIQJTM3KW_cjs.createClientFromContext({
|
|
3664
3832
|
...client[chunkPARVKNVB_cjs.additionalContext],
|
|
3665
3833
|
fetch: shared_net_fetch.createFetchHeaderMutator(client[chunkPARVKNVB_cjs.additionalContext].fetch, (headers) => {
|
|
3666
|
-
headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"),
|
|
3834
|
+
headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"), chunkIQJTM3KW_cjs.OBSERVABLE_USER_AGENT].filter((x) => x && x?.length > 0).join(" "));
|
|
3667
3835
|
return headers;
|
|
3668
3836
|
})
|
|
3669
3837
|
});
|
|
@@ -3707,7 +3875,7 @@ function getOsdkConfig(ontologyRid) {
|
|
|
3707
3875
|
|
|
3708
3876
|
Object.defineProperty(exports, "createClientWithTransaction", {
|
|
3709
3877
|
enumerable: true,
|
|
3710
|
-
get: function () { return
|
|
3878
|
+
get: function () { return chunkIQJTM3KW_cjs.createClientWithTransaction; }
|
|
3711
3879
|
});
|
|
3712
3880
|
Object.defineProperty(exports, "augment", {
|
|
3713
3881
|
enumerable: true,
|