@osdk/client 2.2.0-beta.6 → 2.2.0-beta.8
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 +43 -0
- package/build/browser/Client.js.map +1 -1
- package/build/browser/actions/actions.test.js +52 -4
- package/build/browser/actions/actions.test.js.map +1 -1
- package/build/browser/actions/applyAction.js +21 -15
- package/build/browser/actions/applyAction.js.map +1 -1
- package/build/browser/createClient.js +11 -4
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/index.js +1 -0
- package/build/browser/index.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +25 -0
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.js +8 -1
- package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js +7 -3
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/browser/object/createObjectSpecifierFromPrimaryKey.js +20 -0
- package/build/browser/object/createObjectSpecifierFromPrimaryKey.js.map +1 -0
- package/build/browser/object/object.test.js +109 -0
- package/build/browser/object/object.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSet.test.js +15 -1
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +2 -0
- package/build/browser/objectSet/ObjectSetListenerWebsocket.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/observable/internal/testUtils.js +2 -0
- package/build/browser/observable/internal/testUtils.js.map +1 -1
- package/build/browser/queries/applyQuery.js +33 -1
- package/build/browser/queries/applyQuery.js.map +1 -1
- package/build/browser/queries/queries.test.js +26 -5
- package/build/browser/queries/queries.test.js.map +1 -1
- package/build/browser/util/UserAgent.js +1 -1
- package/build/browser/util/toDataValueQueries.js +17 -0
- package/build/browser/util/toDataValueQueries.js.map +1 -1
- package/build/cjs/{Client-C8K3E1vH.d.cts → Client-DBTcM9gB.d.cts} +1 -1
- package/build/cjs/{chunk-2FVV5A63.cjs → chunk-IU47QMYO.cjs} +48 -48
- package/build/cjs/chunk-IU47QMYO.cjs.map +1 -0
- package/build/cjs/{chunk-X7WGNFZ4.cjs → chunk-JPENHIJB.cjs} +19 -19
- package/build/cjs/chunk-JPENHIJB.cjs.map +1 -0
- package/build/cjs/{graphql-JJX5MZPQ.cjs → graphql-RGM5SRWV.cjs} +306 -265
- package/build/cjs/graphql-RGM5SRWV.cjs.map +1 -0
- package/build/cjs/index.cjs +192 -102
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +6 -4
- package/build/cjs/public/internal.cjs +6 -6
- package/build/cjs/public/internal.cjs.map +1 -1
- package/build/cjs/public/internal.d.cts +1 -1
- package/build/cjs/public/unstable-do-not-use.cjs +41 -70
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +1 -1
- package/build/esm/Client.js.map +1 -1
- package/build/esm/actions/actions.test.js +52 -4
- package/build/esm/actions/actions.test.js.map +1 -1
- package/build/esm/actions/applyAction.js +21 -15
- package/build/esm/actions/applyAction.js.map +1 -1
- package/build/esm/createClient.js +11 -4
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +25 -0
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.js +8 -1
- package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js +7 -3
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/esm/object/createObjectSpecifierFromPrimaryKey.js +20 -0
- package/build/esm/object/createObjectSpecifierFromPrimaryKey.js.map +1 -0
- package/build/esm/object/object.test.js +109 -0
- package/build/esm/object/object.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSet.test.js +15 -1
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +2 -0
- package/build/esm/objectSet/ObjectSetListenerWebsocket.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/observable/internal/testUtils.js +2 -0
- package/build/esm/observable/internal/testUtils.js.map +1 -1
- package/build/esm/queries/applyQuery.js +33 -1
- package/build/esm/queries/applyQuery.js.map +1 -1
- package/build/esm/queries/queries.test.js +26 -5
- package/build/esm/queries/queries.test.js.map +1 -1
- package/build/esm/util/UserAgent.js +1 -1
- package/build/esm/util/toDataValueQueries.js +17 -0
- package/build/esm/util/toDataValueQueries.js.map +1 -1
- package/build/types/Client.d.ts +1 -1
- package/build/types/Client.d.ts.map +1 -1
- package/build/types/actions/applyAction.d.ts.map +1 -1
- package/build/types/createClient.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/object/createObjectSpecifierFromPrimaryKey.d.ts +2 -0
- package/build/types/object/createObjectSpecifierFromPrimaryKey.d.ts.map +1 -0
- package/build/types/object/object.test.d.ts.map +1 -1
- package/build/types/objectSet/ObjectSet.test.d.ts.map +1 -1
- package/build/types/observable/internal/testUtils.d.ts.map +1 -1
- package/build/types/queries/applyQuery.d.ts.map +1 -1
- package/package.json +12 -12
- package/build/cjs/chunk-2FVV5A63.cjs.map +0 -1
- package/build/cjs/chunk-X7WGNFZ4.cjs.map +0 -1
- package/build/cjs/graphql-JJX5MZPQ.cjs.map +0 -1
package/build/cjs/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkIU47QMYO_cjs = require('./chunk-IU47QMYO.cjs');
|
|
4
|
+
var chunkJPENHIJB_cjs = require('./chunk-JPENHIJB.cjs');
|
|
5
5
|
require('./chunk-Q7SFCCGT.cjs');
|
|
6
6
|
var api = require('@osdk/api');
|
|
7
7
|
var shared_net_errors = require('@osdk/shared.net.errors');
|
|
@@ -55,7 +55,7 @@ function applyPageToken(payload, {
|
|
|
55
55
|
return pageToken ? {
|
|
56
56
|
...payload,
|
|
57
57
|
pageToken
|
|
58
|
-
} :
|
|
58
|
+
} : undefined;
|
|
59
59
|
}
|
|
60
60
|
async function* pageRequestAsAsyncIter(call, values, nextArgs, initialPayload) {
|
|
61
61
|
let payload = initialPayload;
|
|
@@ -72,7 +72,7 @@ async function* pageRequestAsAsyncIter(call, values, nextArgs, initialPayload) {
|
|
|
72
72
|
function createSimpleCache(map = /* @__PURE__ */ new Map(), fn) {
|
|
73
73
|
function get(key) {
|
|
74
74
|
let r = map.get(key);
|
|
75
|
-
if (r ===
|
|
75
|
+
if (r === undefined && fn !== undefined) {
|
|
76
76
|
return set(key, fn(key));
|
|
77
77
|
} else {
|
|
78
78
|
return r;
|
|
@@ -120,7 +120,7 @@ function createSimpleAsyncCache(type, fn, createCacheLocal = createSimpleCache)
|
|
|
120
120
|
var cachedAllOntologies;
|
|
121
121
|
async function getOntologyVersionForRid(ctx, ontologyRid) {
|
|
122
122
|
cachedAllOntologies ??= await client_unstable.loadAllOntologies(ctx, {});
|
|
123
|
-
!cachedAllOntologies.ontologies[ontologyRid] ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "ontology should be loaded") : invariant__default.default(false) :
|
|
123
|
+
!cachedAllOntologies.ontologies[ontologyRid] ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "ontology should be loaded") : invariant__default.default(false) : undefined;
|
|
124
124
|
return cachedAllOntologies.ontologies[ontologyRid].currentOntologyVersion;
|
|
125
125
|
}
|
|
126
126
|
var strongMemoAsync = (fn) => createSimpleAsyncCache("strong", fn).get;
|
|
@@ -162,7 +162,7 @@ var MetadataClient = class {
|
|
|
162
162
|
[objectTypeRid]: await this.ontologyVersion("")
|
|
163
163
|
}
|
|
164
164
|
});
|
|
165
|
-
!linkTypes.linkTypes[objectTypeRid] ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "link type should be loaded") : invariant__default.default(false) :
|
|
165
|
+
!linkTypes.linkTypes[objectTypeRid] ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "link type should be loaded") : invariant__default.default(false) : undefined;
|
|
166
166
|
const ret = {};
|
|
167
167
|
for (const l of linkTypes.linkTypes[objectTypeRid]) {
|
|
168
168
|
const helper = ({
|
|
@@ -232,22 +232,22 @@ var MetadataClient = class {
|
|
|
232
232
|
interfaceTypes: [],
|
|
233
233
|
typeGroups: [],
|
|
234
234
|
loadRedacted: false,
|
|
235
|
-
includeObjectTypeCount:
|
|
235
|
+
includeObjectTypeCount: undefined,
|
|
236
236
|
includeObjectTypesWithoutSearchableDatasources: true,
|
|
237
|
-
includeEntityMetadata:
|
|
237
|
+
includeEntityMetadata: undefined,
|
|
238
238
|
actionTypes: [],
|
|
239
|
-
includeTypeGroupEntitiesCount:
|
|
240
|
-
entityMetadata:
|
|
239
|
+
includeTypeGroupEntitiesCount: undefined,
|
|
240
|
+
entityMetadata: undefined
|
|
241
241
|
};
|
|
242
|
-
const entities = await client_unstable.bulkLoadOntologyEntities(this.#ctx,
|
|
243
|
-
!entities.objectTypes[0]?.objectType ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "object type should be loaded") : invariant__default.default(false) :
|
|
242
|
+
const entities = await client_unstable.bulkLoadOntologyEntities(this.#ctx, undefined, body);
|
|
243
|
+
!entities.objectTypes[0]?.objectType ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "object type should be loaded") : invariant__default.default(false) : undefined;
|
|
244
244
|
return entities.objectTypes[0].objectType;
|
|
245
245
|
});
|
|
246
246
|
ontologyVersion = strongMemoAsync(async (_) => getOntologyVersionForRid(this.#ctx, await this.#client.ontologyRid));
|
|
247
247
|
};
|
|
248
248
|
var metadataCacheClient = weakMemoAsync((client) => Promise.resolve(new MetadataClient(client)));
|
|
249
249
|
function createObjectPropertyMapping(conjureOT) {
|
|
250
|
-
!(conjureOT.primaryKeys.length === 1) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `only one primary key supported, got ${conjureOT.primaryKeys.length}`) : invariant__default.default(false) :
|
|
250
|
+
!(conjureOT.primaryKeys.length === 1) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `only one primary key supported, got ${conjureOT.primaryKeys.length}`) : invariant__default.default(false) : undefined;
|
|
251
251
|
const pkRid = conjureOT.primaryKeys[0];
|
|
252
252
|
const pkProperty = Object.values(conjureOT.propertyTypes).find((a) => a.rid === pkRid);
|
|
253
253
|
if (!pkProperty) {
|
|
@@ -279,7 +279,7 @@ function createBulkLinksAsyncIterFactory(ctx) {
|
|
|
279
279
|
return;
|
|
280
280
|
}
|
|
281
281
|
ctx.logger?.debug("Preparing to fetch bulk links");
|
|
282
|
-
!objs.every((a) => a.$objectType === objs[0].$objectType) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false) : invariant__default.default(false) :
|
|
282
|
+
!objs.every((a) => a.$objectType === objs[0].$objectType) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false) : invariant__default.default(false) : undefined;
|
|
283
283
|
const mcc = await metadataCacheClient(ctx);
|
|
284
284
|
const helper = await mcc.forObjectByApiName(objs[0].$objectType);
|
|
285
285
|
const [objectTypeRid, propertyMapping, fullLinkMapping] = await Promise.all([helper.getRid(), helper.getPropertyMapping(), helper.getLinkMapping()]);
|
|
@@ -291,21 +291,21 @@ function createBulkLinksAsyncIterFactory(ctx) {
|
|
|
291
291
|
}
|
|
292
292
|
const req = {
|
|
293
293
|
objectSetContext: {
|
|
294
|
-
forkRid:
|
|
294
|
+
forkRid: undefined,
|
|
295
295
|
objectSetFilterContext: {
|
|
296
296
|
parameterOverrides: {}
|
|
297
297
|
},
|
|
298
|
-
ontologyBranchRid:
|
|
299
|
-
owningRid:
|
|
300
|
-
reportUsage:
|
|
301
|
-
workstateRid:
|
|
298
|
+
ontologyBranchRid: undefined,
|
|
299
|
+
owningRid: undefined,
|
|
300
|
+
reportUsage: undefined,
|
|
301
|
+
workstateRid: undefined
|
|
302
302
|
},
|
|
303
303
|
responseOptions: {
|
|
304
304
|
includeObjectSetEntities: true,
|
|
305
305
|
includeUsageCost: false
|
|
306
306
|
},
|
|
307
307
|
pageSize: 1e3,
|
|
308
|
-
pageToken:
|
|
308
|
+
pageToken: undefined,
|
|
309
309
|
linksRequests: [{
|
|
310
310
|
directedLinkTypes: Object.values(linkMapping).map(({
|
|
311
311
|
directedLinkTypeRid
|
|
@@ -318,7 +318,7 @@ function createBulkLinksAsyncIterFactory(ctx) {
|
|
|
318
318
|
})))
|
|
319
319
|
}]
|
|
320
320
|
};
|
|
321
|
-
const bulkLinksIter = pageRequestAsAsyncIter(client_unstable.getBulkLinksPage.bind(
|
|
321
|
+
const bulkLinksIter = pageRequestAsAsyncIter(client_unstable.getBulkLinksPage.bind(undefined, makeConjureContext(ctx, "object-set-service/api")), getResults, applyPageToken, req);
|
|
322
322
|
for await (const item of bulkLinksIter) {
|
|
323
323
|
const {
|
|
324
324
|
objectIdentifier
|
|
@@ -416,13 +416,13 @@ async function toDataValue(value, client) {
|
|
|
416
416
|
return Promise.all(promiseArray);
|
|
417
417
|
}
|
|
418
418
|
if (isAttachmentUpload(value)) {
|
|
419
|
-
const attachment = await
|
|
419
|
+
const attachment = await chunkJPENHIJB_cjs.Attachment_exports.upload(client, value.data, {
|
|
420
420
|
filename: value.name
|
|
421
421
|
});
|
|
422
422
|
return await toDataValue(attachment.rid, client);
|
|
423
423
|
}
|
|
424
424
|
if (isAttachmentFile(value)) {
|
|
425
|
-
const attachment = await
|
|
425
|
+
const attachment = await chunkJPENHIJB_cjs.Attachment_exports.upload(client, value, {
|
|
426
426
|
filename: value.name
|
|
427
427
|
});
|
|
428
428
|
return await toDataValue(attachment.rid, client);
|
|
@@ -433,11 +433,11 @@ async function toDataValue(value, client) {
|
|
|
433
433
|
if (isOsdkBaseObject(value)) {
|
|
434
434
|
return await toDataValue(value.$primaryKey, client);
|
|
435
435
|
}
|
|
436
|
-
if (
|
|
436
|
+
if (chunkIU47QMYO_cjs.isWireObjectSet(value)) {
|
|
437
437
|
return value;
|
|
438
438
|
}
|
|
439
|
-
if (
|
|
440
|
-
return
|
|
439
|
+
if (chunkIU47QMYO_cjs.isObjectSet(value)) {
|
|
440
|
+
return chunkIU47QMYO_cjs.getWireObjectSet(value);
|
|
441
441
|
}
|
|
442
442
|
if (isMediaReference(value)) {
|
|
443
443
|
return value;
|
|
@@ -460,24 +460,24 @@ async function toDataValue(value, client) {
|
|
|
460
460
|
|
|
461
461
|
// src/actions/applyAction.ts
|
|
462
462
|
async function applyAction(client, action, parameters, options = {}) {
|
|
463
|
-
const clientWithHeaders =
|
|
463
|
+
const clientWithHeaders = chunkJPENHIJB_cjs.addUserAgentAndRequestContextHeaders(chunkIU47QMYO_cjs.augmentRequestContext(client, (_) => ({
|
|
464
464
|
finalMethodCall: "applyAction"
|
|
465
465
|
})), action);
|
|
466
466
|
if (Array.isArray(parameters)) {
|
|
467
|
-
const response = await
|
|
467
|
+
const response = await chunkJPENHIJB_cjs.Action_exports.applyBatch(clientWithHeaders, await client.ontologyRid, action.apiName, {
|
|
468
468
|
requests: parameters ? await remapBatchActionParams(parameters, client) : [],
|
|
469
469
|
options: {
|
|
470
470
|
returnEdits: options?.$returnEdits ? "ALL" : "NONE"
|
|
471
471
|
}
|
|
472
472
|
});
|
|
473
473
|
const edits = response.edits;
|
|
474
|
-
return options?.$returnEdits ? edits?.type === "edits" ? remapActionResponse(response) : edits :
|
|
474
|
+
return options?.$returnEdits ? edits?.type === "edits" ? remapActionResponse(response) : edits : undefined;
|
|
475
475
|
} else {
|
|
476
|
-
const response = await
|
|
476
|
+
const response = await chunkJPENHIJB_cjs.Action_exports.apply(clientWithHeaders, await client.ontologyRid, action.apiName, {
|
|
477
477
|
parameters: await remapActionParams(parameters, client),
|
|
478
478
|
options: {
|
|
479
479
|
mode: options?.$validateOnly ? "VALIDATE_ONLY" : "VALIDATE_AND_EXECUTE",
|
|
480
|
-
returnEdits: options?.$returnEdits ? "
|
|
480
|
+
returnEdits: options?.$returnEdits ? "ALL_V2_WITH_DELETIONS" : "NONE"
|
|
481
481
|
}
|
|
482
482
|
});
|
|
483
483
|
if (options?.$validateOnly) {
|
|
@@ -487,7 +487,7 @@ async function applyAction(client, action, parameters, options = {}) {
|
|
|
487
487
|
throw new ActionValidationError(response.validation);
|
|
488
488
|
}
|
|
489
489
|
const edits = response.edits;
|
|
490
|
-
return options?.$returnEdits ? edits?.type === "edits" ? remapActionResponse(response) : edits :
|
|
490
|
+
return options?.$returnEdits ? edits?.type === "edits" ? remapActionResponse(response) : edits : undefined;
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
async function remapActionParams(params, client) {
|
|
@@ -516,35 +516,41 @@ function remapActionResponse(response) {
|
|
|
516
516
|
deletedLinksCount: editResponses.deletedLinksCount,
|
|
517
517
|
deletedObjectsCount: editResponses.deletedObjectsCount,
|
|
518
518
|
addedLinks: [],
|
|
519
|
+
deletedLinks: [],
|
|
519
520
|
addedObjects: [],
|
|
521
|
+
deletedObjects: [],
|
|
520
522
|
modifiedObjects: [],
|
|
521
523
|
editedObjectTypes: []
|
|
522
524
|
};
|
|
523
525
|
const editedObjectTypesSet = /* @__PURE__ */ new Set();
|
|
524
526
|
for (const edit of editResponses.edits) {
|
|
525
|
-
if (edit.type === "addLink") {
|
|
526
|
-
|
|
527
|
+
if (edit.type === "addLink" || edit.type === "deleteLink") {
|
|
528
|
+
const osdkEdit = {
|
|
527
529
|
linkTypeApiNameAtoB: edit.linkTypeApiNameAtoB,
|
|
528
530
|
linkTypeApiNameBtoA: edit.linkTypeApiNameBtoA,
|
|
529
531
|
aSideObject: edit.aSideObject,
|
|
530
532
|
bSideObject: edit.bSideObject
|
|
531
|
-
}
|
|
533
|
+
};
|
|
534
|
+
edit.type === "addLink" ? remappedActionResponse.addedLinks.push(osdkEdit) : remappedActionResponse.deletedLinks?.push(osdkEdit);
|
|
532
535
|
editedObjectTypesSet.add(edit.aSideObject.objectType);
|
|
533
536
|
editedObjectTypesSet.add(edit.bSideObject.objectType);
|
|
534
|
-
} else if (edit.type === "addObject") {
|
|
535
|
-
|
|
537
|
+
} else if (edit.type === "addObject" || edit.type === "deleteObject" || edit.type === "modifyObject") {
|
|
538
|
+
const osdkEdit = {
|
|
536
539
|
objectType: edit.objectType,
|
|
537
540
|
primaryKey: edit.primaryKey
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
541
|
+
};
|
|
542
|
+
if (edit.type === "addObject") {
|
|
543
|
+
remappedActionResponse.addedObjects.push(osdkEdit);
|
|
544
|
+
} else if (edit.type === "deleteObject") {
|
|
545
|
+
remappedActionResponse.deletedObjects?.push(osdkEdit);
|
|
546
|
+
} else if (edit.type === "modifyObject") {
|
|
547
|
+
remappedActionResponse.modifiedObjects.push(osdkEdit);
|
|
548
|
+
}
|
|
545
549
|
editedObjectTypesSet.add(edit.objectType);
|
|
546
550
|
} else {
|
|
547
|
-
process.env.NODE_ENV !== "production"
|
|
551
|
+
if (process.env.NODE_ENV !== "production") {
|
|
552
|
+
console.warn(`Unexpected edit type: ${JSON.stringify(edit)}`);
|
|
553
|
+
}
|
|
548
554
|
}
|
|
549
555
|
}
|
|
550
556
|
remappedActionResponse.editedObjectTypes = [...editedObjectTypesSet];
|
|
@@ -671,7 +677,7 @@ var GeotimeSeriesPropertyImpl = class {
|
|
|
671
677
|
}
|
|
672
678
|
}
|
|
673
679
|
async getLatestValue() {
|
|
674
|
-
const latestPointPromise =
|
|
680
|
+
const latestPointPromise = chunkJPENHIJB_cjs.TimeSeriesValueBankProperty_exports.getLatestValue(this.#client, await this.#client.ontologyRid, ...this.#triplet);
|
|
675
681
|
latestPointPromise.then(
|
|
676
682
|
(latestPoint) => this.lastFetchedValue = latestPoint,
|
|
677
683
|
// eslint-disable-next-line no-console
|
|
@@ -687,7 +693,7 @@ var GeotimeSeriesPropertyImpl = class {
|
|
|
687
693
|
return allPoints;
|
|
688
694
|
}
|
|
689
695
|
async *asyncIterValues(query) {
|
|
690
|
-
const streamPointsIterator = await
|
|
696
|
+
const streamPointsIterator = await chunkJPENHIJB_cjs.TimeSeriesValueBankProperty_exports.streamValues(this.#client, await this.#client.ontologyRid, ...this.#triplet, query ? {
|
|
691
697
|
range: getTimeRange(query)
|
|
692
698
|
} : {});
|
|
693
699
|
for await (const timeseriesPoint of asyncIterPointsHelper(streamPointsIterator)) {
|
|
@@ -711,13 +717,13 @@ var MediaReferencePropertyImpl = class {
|
|
|
711
717
|
this.#triplet = [objectApiName, primaryKey, propertyName];
|
|
712
718
|
}
|
|
713
719
|
async fetchContents() {
|
|
714
|
-
return
|
|
720
|
+
return chunkJPENHIJB_cjs.MediaReferenceProperty_exports.getMediaContent(this.#client, await this.#client.ontologyRid, ...this.#triplet, {
|
|
715
721
|
preview: true
|
|
716
722
|
// TODO: Can turn this back off when backend is no longer in beta.
|
|
717
723
|
});
|
|
718
724
|
}
|
|
719
725
|
async fetchMetadata() {
|
|
720
|
-
const r = await
|
|
726
|
+
const r = await chunkJPENHIJB_cjs.MediaReferenceProperty_exports.getMediaMetadata(this.#client, await this.#client.ontologyRid, ...this.#triplet, {
|
|
721
727
|
preview: true
|
|
722
728
|
// TODO: Can turn this back off when backend is no longer in beta.
|
|
723
729
|
});
|
|
@@ -738,10 +744,10 @@ var TimeSeriesPropertyImpl = class {
|
|
|
738
744
|
this.#triplet = [objectApiName, primaryKey, propertyName];
|
|
739
745
|
}
|
|
740
746
|
async getFirstPoint() {
|
|
741
|
-
return
|
|
747
|
+
return chunkJPENHIJB_cjs.TimeSeriesPropertyV2_exports.getFirstPoint(this.#client, await this.#client.ontologyRid, ...this.#triplet);
|
|
742
748
|
}
|
|
743
749
|
async getLastPoint() {
|
|
744
|
-
return
|
|
750
|
+
return chunkJPENHIJB_cjs.TimeSeriesPropertyV2_exports.getLastPoint(this.#client, await this.#client.ontologyRid, ...this.#triplet);
|
|
745
751
|
}
|
|
746
752
|
async getAllPoints(query) {
|
|
747
753
|
const allPoints = [];
|
|
@@ -751,7 +757,7 @@ var TimeSeriesPropertyImpl = class {
|
|
|
751
757
|
return allPoints;
|
|
752
758
|
}
|
|
753
759
|
async *asyncIterPoints(query) {
|
|
754
|
-
const streamPointsIterator = await
|
|
760
|
+
const streamPointsIterator = await chunkJPENHIJB_cjs.TimeSeriesPropertyV2_exports.streamPoints(this.#client, await this.#client.ontologyRid, ...this.#triplet, query ? {
|
|
755
761
|
range: getTimeRange(query)
|
|
756
762
|
} : {});
|
|
757
763
|
for await (const timeseriesPoint of asyncIterPointsHelper(streamPointsIterator)) {
|
|
@@ -771,7 +777,7 @@ var ClientRef = Symbol("ClientRef" );
|
|
|
771
777
|
|
|
772
778
|
// src/object/convertWireToOsdkObjects/createOsdkInterface.ts
|
|
773
779
|
function createOsdkInterface(underlying, interfaceDef) {
|
|
774
|
-
const [objApiNamespace] =
|
|
780
|
+
const [objApiNamespace] = chunkIU47QMYO_cjs.extractNamespace(interfaceDef.apiName);
|
|
775
781
|
return Object.freeze(Object.defineProperties({}, {
|
|
776
782
|
// first to minimize hidden classes
|
|
777
783
|
[UnderlyingOsdkObject]: {
|
|
@@ -801,12 +807,16 @@ function createOsdkInterface(underlying, interfaceDef) {
|
|
|
801
807
|
value: underlying.$rid,
|
|
802
808
|
enumerable: "$rid" in underlying
|
|
803
809
|
},
|
|
810
|
+
"$clone": {
|
|
811
|
+
value: clone,
|
|
812
|
+
enumerable: false
|
|
813
|
+
},
|
|
804
814
|
[InterfaceDefRef]: {
|
|
805
815
|
value: interfaceDef
|
|
806
816
|
},
|
|
807
817
|
...Object.fromEntries(Object.keys(interfaceDef.properties).map((p) => {
|
|
808
818
|
const objDef = underlying[ObjectDefRef];
|
|
809
|
-
const [apiNamespace, apiName] =
|
|
819
|
+
const [apiNamespace, apiName] = chunkIU47QMYO_cjs.extractNamespace(p);
|
|
810
820
|
const targetPropName = objDef.interfaceMap[interfaceDef.apiName][p];
|
|
811
821
|
return [apiNamespace === objApiNamespace ? apiName : p, {
|
|
812
822
|
enumerable: targetPropName in underlying,
|
|
@@ -814,6 +824,26 @@ function createOsdkInterface(underlying, interfaceDef) {
|
|
|
814
824
|
}];
|
|
815
825
|
}))
|
|
816
826
|
}));
|
|
827
|
+
function clone(update) {
|
|
828
|
+
if (update == null) {
|
|
829
|
+
return underlying.$clone().$as(interfaceDef);
|
|
830
|
+
}
|
|
831
|
+
for (const key of Object.keys(update)) {
|
|
832
|
+
if (!(key in interfaceDef.properties)) {
|
|
833
|
+
throw new Error(`Invalid property ${key} for interface ${interfaceDef.apiName}`);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
const remappedProps = Object.fromEntries(Object.keys(update).map((p) => mapProperty(p, update[p])).filter((x) => x != null));
|
|
837
|
+
return underlying.$clone(remappedProps).$as(interfaceDef);
|
|
838
|
+
}
|
|
839
|
+
function mapProperty(propertyName, value) {
|
|
840
|
+
const objDef = underlying[ObjectDefRef];
|
|
841
|
+
const targetPropName = objDef.interfaceMap[interfaceDef.apiName][propertyName];
|
|
842
|
+
if (targetPropName == null) {
|
|
843
|
+
throw new Error(`Cannot clone interface with ${propertyName} as property is not implemented by the underlying object type ${objDef.apiName}`);
|
|
844
|
+
}
|
|
845
|
+
return [targetPropName, value];
|
|
846
|
+
}
|
|
817
847
|
}
|
|
818
848
|
|
|
819
849
|
// src/object/convertWireToOsdkObjects/getDollarAs.ts
|
|
@@ -862,8 +892,8 @@ function get$link(holder) {
|
|
|
862
892
|
[objDef.primaryKeyApiName]: rawObj.$primaryKey
|
|
863
893
|
}).pivotTo(linkName);
|
|
864
894
|
const value = !linkDef.multiplicity ? {
|
|
865
|
-
fetchOne: (options) =>
|
|
866
|
-
fetchOneWithErrors: (options) =>
|
|
895
|
+
fetchOne: (options) => chunkIU47QMYO_cjs.fetchSingle(client, objDef, options ?? {}, chunkIU47QMYO_cjs.getWireObjectSet(objectSet)),
|
|
896
|
+
fetchOneWithErrors: (options) => chunkIU47QMYO_cjs.fetchSingleWithErrors(client, objDef, options ?? {}, chunkIU47QMYO_cjs.getWireObjectSet(objectSet))
|
|
867
897
|
} : objectSet;
|
|
868
898
|
return [linkName, value];
|
|
869
899
|
})));
|
|
@@ -932,7 +962,7 @@ function createSpecialProperty(client, objectDef, rawObject, p) {
|
|
|
932
962
|
const rawValue = rawObject[p];
|
|
933
963
|
const propDef = objectDef.properties[p];
|
|
934
964
|
if (process.env.NODE_ENV !== "production") {
|
|
935
|
-
!(propDef != null && typeof propDef.type === "string" && specialPropertyTypes.has(propDef.type)) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false) : invariant__default.default(false) :
|
|
965
|
+
!(propDef != null && typeof propDef.type === "string" && specialPropertyTypes.has(propDef.type)) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false) : invariant__default.default(false) : undefined;
|
|
936
966
|
}
|
|
937
967
|
{
|
|
938
968
|
{
|
|
@@ -940,9 +970,9 @@ function createSpecialProperty(client, objectDef, rawObject, p) {
|
|
|
940
970
|
{
|
|
941
971
|
if (propDef.type === "attachment") {
|
|
942
972
|
if (Array.isArray(rawValue)) {
|
|
943
|
-
return rawValue.map((a) =>
|
|
973
|
+
return rawValue.map((a) => chunkIU47QMYO_cjs.hydrateAttachmentFromRidInternal(client, a.rid));
|
|
944
974
|
}
|
|
945
|
-
return
|
|
975
|
+
return chunkIU47QMYO_cjs.hydrateAttachmentFromRidInternal(client, rawValue.rid);
|
|
946
976
|
}
|
|
947
977
|
if (propDef.type === "numericTimeseries" || propDef.type === "stringTimeseries" || propDef.type === "sensorTimeseries") {
|
|
948
978
|
return new TimeSeriesPropertyImpl(client, objectDef.apiName, rawObject[objectDef.primaryKeyApiName], p);
|
|
@@ -954,7 +984,7 @@ function createSpecialProperty(client, objectDef, rawObject, p) {
|
|
|
954
984
|
type: "Point",
|
|
955
985
|
coordinates: rawValue.position
|
|
956
986
|
}
|
|
957
|
-
} :
|
|
987
|
+
} : undefined);
|
|
958
988
|
}
|
|
959
989
|
if (propDef.type === "mediaReference") {
|
|
960
990
|
return new MediaReferencePropertyImpl({
|
|
@@ -970,16 +1000,21 @@ function createSpecialProperty(client, objectDef, rawObject, p) {
|
|
|
970
1000
|
}
|
|
971
1001
|
}
|
|
972
1002
|
|
|
1003
|
+
// src/object/createObjectSpecifierFromPrimaryKey.ts
|
|
1004
|
+
function createObjectSpecifierFromPrimaryKey(def, primaryKey) {
|
|
1005
|
+
return `${def.apiName}:${primaryKey}`;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
973
1008
|
// src/object/convertWireToOsdkObjects.ts
|
|
974
1009
|
async function convertWireToOsdkObjects(client, objects, interfaceApiName, forceRemoveRid = false, selectedProps, strictNonNull = false) {
|
|
975
1010
|
client.logger?.debug(`START convertWireToOsdkObjects()`);
|
|
976
1011
|
fixObjectPropertiesInPlace(objects, forceRemoveRid);
|
|
977
|
-
const ifaceDef = interfaceApiName ? await client.ontologyProvider.getInterfaceDefinition(interfaceApiName) :
|
|
978
|
-
const ifaceSelected = ifaceDef ? selectedProps ?? Object.keys(ifaceDef.properties) :
|
|
1012
|
+
const ifaceDef = interfaceApiName ? await client.ontologyProvider.getInterfaceDefinition(interfaceApiName) : undefined;
|
|
1013
|
+
const ifaceSelected = ifaceDef ? selectedProps ?? Object.keys(ifaceDef.properties) : undefined;
|
|
979
1014
|
const ret = [];
|
|
980
1015
|
for (const rawObj of objects) {
|
|
981
1016
|
const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);
|
|
982
|
-
!objectDef ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Missing definition for '${rawObj.$apiName}'`) : invariant__default.default(false) :
|
|
1017
|
+
!objectDef ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Missing definition for '${rawObj.$apiName}'`) : invariant__default.default(false) : undefined;
|
|
983
1018
|
let objProps;
|
|
984
1019
|
let conforming = true;
|
|
985
1020
|
if (ifaceDef && ifaceSelected) {
|
|
@@ -1009,11 +1044,11 @@ async function convertWireToOsdkObjects2(client, objects, interfaceApiName, forc
|
|
|
1009
1044
|
const ret = [];
|
|
1010
1045
|
for (const rawObj of objects) {
|
|
1011
1046
|
const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);
|
|
1012
|
-
!objectDef ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Missing definition for '${rawObj.$apiName}'`) : invariant__default.default(false) :
|
|
1013
|
-
const interfaceToObjMapping = interfaceApiName ? interfaceToObjectTypeMappings[interfaceApiName][rawObj.$apiName] :
|
|
1047
|
+
!objectDef ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Missing definition for '${rawObj.$apiName}'`) : invariant__default.default(false) : undefined;
|
|
1048
|
+
const interfaceToObjMapping = interfaceApiName ? interfaceToObjectTypeMappings[interfaceApiName][rawObj.$apiName] : undefined;
|
|
1014
1049
|
const ifaceSelected = interfaceApiName && interfaceToObjMapping ? selectedProps ? Object.keys(interfaceToObjMapping).filter((val) => {
|
|
1015
1050
|
selectedProps?.includes(interfaceToObjMapping[val]);
|
|
1016
|
-
}) : [...Object.values(interfaceToObjMapping), objectDef.primaryKeyApiName] :
|
|
1051
|
+
}) : [...Object.values(interfaceToObjMapping), objectDef.primaryKeyApiName] : undefined;
|
|
1017
1052
|
let objProps;
|
|
1018
1053
|
let conforming = true;
|
|
1019
1054
|
if (interfaceApiName && ifaceSelected) {
|
|
@@ -1044,7 +1079,7 @@ function reframeAsObjectInPlace(objectDef, interfaceApiName, rawObj) {
|
|
|
1044
1079
|
if (sptProp in rawObj) {
|
|
1045
1080
|
const value = rawObj[sptProp];
|
|
1046
1081
|
delete rawObj[sptProp];
|
|
1047
|
-
if (value !==
|
|
1082
|
+
if (value !== undefined) {
|
|
1048
1083
|
newProps[regularProp] = value;
|
|
1049
1084
|
}
|
|
1050
1085
|
}
|
|
@@ -1094,6 +1129,10 @@ function fixObjectPropertiesInPlace(objs, forceRemoveRid) {
|
|
|
1094
1129
|
obj.$objectType = obj.$apiName;
|
|
1095
1130
|
obj.$primaryKey ??= obj.__primaryKey;
|
|
1096
1131
|
obj.$title ??= obj.__title;
|
|
1132
|
+
obj.$objectSpecifier = createObjectSpecifierFromPrimaryKey({
|
|
1133
|
+
apiName: obj.$apiName,
|
|
1134
|
+
type: "object"
|
|
1135
|
+
}, obj.$primaryKey);
|
|
1097
1136
|
delete obj.__apiName;
|
|
1098
1137
|
delete obj.__primaryKey;
|
|
1099
1138
|
delete obj.__title;
|
|
@@ -1108,7 +1147,7 @@ function createClientCache(fn) {
|
|
|
1108
1147
|
cache.set(client.clientCacheKey, /* @__PURE__ */ new Map());
|
|
1109
1148
|
}
|
|
1110
1149
|
let r = cache.get(client.clientCacheKey).get(key);
|
|
1111
|
-
if (r ===
|
|
1150
|
+
if (r === undefined && fn !== undefined) {
|
|
1112
1151
|
return set(client, key, fn(client, key));
|
|
1113
1152
|
} else {
|
|
1114
1153
|
return r;
|
|
@@ -1156,11 +1195,11 @@ function createAsyncClientCache(fn, createCacheLocal = createClientCache) {
|
|
|
1156
1195
|
return ret;
|
|
1157
1196
|
}
|
|
1158
1197
|
async function loadActionMetadata(client, actionType) {
|
|
1159
|
-
const r = await
|
|
1198
|
+
const r = await chunkJPENHIJB_cjs.ActionTypeV2_exports.get(client, await client.ontologyRid, actionType);
|
|
1160
1199
|
return generatorConverters.wireActionTypeV2ToSdkActionMetadata(r);
|
|
1161
1200
|
}
|
|
1162
1201
|
async function loadFullObjectMetadata(client, objectType) {
|
|
1163
|
-
const full = await
|
|
1202
|
+
const full = await chunkJPENHIJB_cjs.ObjectTypeV2_exports.getFullMetadata(client, await client.ontologyRid, objectType, {
|
|
1164
1203
|
preview: true
|
|
1165
1204
|
});
|
|
1166
1205
|
const ret = generatorConverters.wireObjectTypeFullMetadataToSdkObjectMetadata(full, true);
|
|
@@ -1170,13 +1209,13 @@ async function loadFullObjectMetadata(client, objectType) {
|
|
|
1170
1209
|
};
|
|
1171
1210
|
}
|
|
1172
1211
|
async function loadInterfaceMetadata(client, objectType) {
|
|
1173
|
-
const r = await
|
|
1212
|
+
const r = await chunkJPENHIJB_cjs.OntologyInterface_exports.get(client, await client.ontologyRid, objectType, {
|
|
1174
1213
|
preview: true
|
|
1175
1214
|
});
|
|
1176
1215
|
return generatorConverters.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(r, true);
|
|
1177
1216
|
}
|
|
1178
1217
|
async function loadQueryMetadata(client, queryType) {
|
|
1179
|
-
const r = await
|
|
1218
|
+
const r = await chunkJPENHIJB_cjs.QueryType_exports.get(client, await client.ontologyRid, queryType);
|
|
1180
1219
|
return generatorConverters.wireQueryTypeV2ToSdkQueryMetadata(r);
|
|
1181
1220
|
}
|
|
1182
1221
|
|
|
@@ -1187,7 +1226,7 @@ var createStandardOntologyProviderFactory = (client) => {
|
|
|
1187
1226
|
let objectDef = await loadFullObjectMetadata(client3, key);
|
|
1188
1227
|
const interfaceDefs = Object.fromEntries((await Promise.all(objectDef.implements?.map((i) => ret.getInterfaceDefinition(i)) ?? [])).map((i) => [i.apiName, {
|
|
1189
1228
|
def: i,
|
|
1190
|
-
handler:
|
|
1229
|
+
handler: undefined
|
|
1191
1230
|
}]));
|
|
1192
1231
|
const fullObjectDef = {
|
|
1193
1232
|
...objectDef,
|
|
@@ -1223,10 +1262,10 @@ var createStandardOntologyProviderFactory = (client) => {
|
|
|
1223
1262
|
};
|
|
1224
1263
|
|
|
1225
1264
|
// src/util/UserAgent.ts
|
|
1226
|
-
var USER_AGENT = `osdk-client/${"2.2.0-beta.
|
|
1265
|
+
var USER_AGENT = `osdk-client/${"2.2.0-beta.8"}`;
|
|
1227
1266
|
|
|
1228
1267
|
// src/createMinimalClient.ts
|
|
1229
|
-
function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory =
|
|
1268
|
+
function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = chunkIU47QMYO_cjs.createObjectSet) {
|
|
1230
1269
|
if (process.env.NODE_ENV !== "production") {
|
|
1231
1270
|
try {
|
|
1232
1271
|
new URL(baseUrl);
|
|
@@ -1296,13 +1335,13 @@ async function toDataValueQueries(value, client, desiredType) {
|
|
|
1296
1335
|
switch (desiredType.type) {
|
|
1297
1336
|
case "attachment": {
|
|
1298
1337
|
if (isAttachmentUpload(value)) {
|
|
1299
|
-
const attachment = await
|
|
1338
|
+
const attachment = await chunkJPENHIJB_cjs.Attachment_exports.upload(client, value.data, {
|
|
1300
1339
|
filename: value.name
|
|
1301
1340
|
});
|
|
1302
1341
|
return attachment.rid;
|
|
1303
1342
|
}
|
|
1304
1343
|
if (isAttachmentFile(value)) {
|
|
1305
|
-
const attachment = await
|
|
1344
|
+
const attachment = await chunkJPENHIJB_cjs.Attachment_exports.upload(client, value, {
|
|
1306
1345
|
filename: value.name
|
|
1307
1346
|
});
|
|
1308
1347
|
return attachment.rid;
|
|
@@ -1333,11 +1372,24 @@ async function toDataValueQueries(value, client, desiredType) {
|
|
|
1333
1372
|
break;
|
|
1334
1373
|
}
|
|
1335
1374
|
case "objectSet": {
|
|
1336
|
-
if (
|
|
1375
|
+
if (chunkIU47QMYO_cjs.isWireObjectSet(value)) {
|
|
1337
1376
|
return value;
|
|
1338
1377
|
}
|
|
1339
|
-
if (
|
|
1340
|
-
return
|
|
1378
|
+
if (chunkIU47QMYO_cjs.isObjectSet(value)) {
|
|
1379
|
+
return chunkIU47QMYO_cjs.getWireObjectSet(value);
|
|
1380
|
+
}
|
|
1381
|
+
break;
|
|
1382
|
+
}
|
|
1383
|
+
case "map": {
|
|
1384
|
+
if (typeof value === "object") {
|
|
1385
|
+
const entrySet = [];
|
|
1386
|
+
for (const [key, mapValue] of Object.entries(value)) {
|
|
1387
|
+
entrySet.push({
|
|
1388
|
+
key: desiredType.keyType.type === "object" ? extractPrimaryKeyFromObjectIdentifier(key) : await toDataValueQueries(key, client, desiredType.keyType),
|
|
1389
|
+
value: await toDataValueQueries(mapValue, client, desiredType.valueType)
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1392
|
+
return entrySet;
|
|
1341
1393
|
}
|
|
1342
1394
|
break;
|
|
1343
1395
|
}
|
|
@@ -1362,11 +1414,14 @@ async function toDataValueQueries(value, client, desiredType) {
|
|
|
1362
1414
|
}
|
|
1363
1415
|
return value;
|
|
1364
1416
|
}
|
|
1417
|
+
function extractPrimaryKeyFromObjectIdentifier(a) {
|
|
1418
|
+
return a.substring(a.indexOf(":") + 1);
|
|
1419
|
+
}
|
|
1365
1420
|
|
|
1366
1421
|
// src/queries/applyQuery.ts
|
|
1367
1422
|
async function applyQuery(client, query, params) {
|
|
1368
1423
|
const qd = await client.ontologyProvider.getQueryDefinition(query.apiName);
|
|
1369
|
-
const response = await
|
|
1424
|
+
const response = await chunkJPENHIJB_cjs.Query_exports.execute(chunkJPENHIJB_cjs.addUserAgentAndRequestContextHeaders(chunkIU47QMYO_cjs.augmentRequestContext(client, (_) => ({
|
|
1370
1425
|
finalMethodCall: "applyQuery"
|
|
1371
1426
|
})), query), await client.ontologyRid, query.apiName, {
|
|
1372
1427
|
parameters: params ? await remapQueryParams(params, client, qd.parameters) : {}
|
|
@@ -1385,7 +1440,7 @@ async function remapQueryParams(params, client, paramTypes) {
|
|
|
1385
1440
|
async function remapQueryResponse(client, responseDataType, responseValue, definitions) {
|
|
1386
1441
|
if (responseValue == null) {
|
|
1387
1442
|
if (responseDataType.nullable) {
|
|
1388
|
-
return
|
|
1443
|
+
return undefined;
|
|
1389
1444
|
} else {
|
|
1390
1445
|
throw new Error("Got null response when nullable was not allowed");
|
|
1391
1446
|
}
|
|
@@ -1411,7 +1466,7 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
|
|
|
1411
1466
|
return responseValue;
|
|
1412
1467
|
}
|
|
1413
1468
|
case "attachment": {
|
|
1414
|
-
return
|
|
1469
|
+
return chunkIU47QMYO_cjs.hydrateAttachmentFromRidInternal(client, responseValue);
|
|
1415
1470
|
}
|
|
1416
1471
|
case "object": {
|
|
1417
1472
|
const def = definitions.get(responseDataType.object);
|
|
@@ -1426,7 +1481,7 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
|
|
|
1426
1481
|
throw new Error(`Missing definition for ${responseDataType.objectSet}`);
|
|
1427
1482
|
}
|
|
1428
1483
|
if (typeof responseValue === "string") {
|
|
1429
|
-
return
|
|
1484
|
+
return chunkIU47QMYO_cjs.createObjectSet(def, client, {
|
|
1430
1485
|
type: "intersect",
|
|
1431
1486
|
objectSets: [{
|
|
1432
1487
|
type: "base",
|
|
@@ -1437,7 +1492,7 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
|
|
|
1437
1492
|
}]
|
|
1438
1493
|
});
|
|
1439
1494
|
}
|
|
1440
|
-
return
|
|
1495
|
+
return chunkIU47QMYO_cjs.createObjectSet(def, client, responseValue);
|
|
1441
1496
|
}
|
|
1442
1497
|
case "struct": {
|
|
1443
1498
|
for (const [key, subtype] of Object.entries(responseDataType.struct)) {
|
|
@@ -1447,6 +1502,18 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
|
|
|
1447
1502
|
}
|
|
1448
1503
|
return responseValue;
|
|
1449
1504
|
}
|
|
1505
|
+
case "map": {
|
|
1506
|
+
const map = {};
|
|
1507
|
+
!Array.isArray(responseValue) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "Expected array entry") : invariant__default.default(false) : undefined;
|
|
1508
|
+
for (const entry of responseValue) {
|
|
1509
|
+
!entry.key ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "Expected key") : invariant__default.default(false) : undefined;
|
|
1510
|
+
!entry.value ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "Expected value") : invariant__default.default(false) : undefined;
|
|
1511
|
+
const key = responseDataType.keyType.type === "object" ? getObjectSpecifier(entry.key, responseDataType.keyType.object, definitions) : entry.key;
|
|
1512
|
+
const value = await remapQueryResponse(client, responseDataType.valueType, entry.value, definitions);
|
|
1513
|
+
map[key] = value;
|
|
1514
|
+
}
|
|
1515
|
+
return map;
|
|
1516
|
+
}
|
|
1450
1517
|
case "twoDimensionalAggregation": {
|
|
1451
1518
|
const result = [];
|
|
1452
1519
|
for (const {
|
|
@@ -1502,6 +1569,14 @@ async function getRequiredDefinitions(dataType, client) {
|
|
|
1502
1569
|
case "set": {
|
|
1503
1570
|
return getRequiredDefinitions(dataType.set, client);
|
|
1504
1571
|
}
|
|
1572
|
+
case "map": {
|
|
1573
|
+
for (const value of [dataType.keyType, dataType.valueType]) {
|
|
1574
|
+
for (const [type, objectDef] of await getRequiredDefinitions(value, client)) {
|
|
1575
|
+
result.set(type, objectDef);
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
break;
|
|
1579
|
+
}
|
|
1505
1580
|
case "struct": {
|
|
1506
1581
|
for (const value of Object.values(dataType.struct)) {
|
|
1507
1582
|
for (const [type, objectDef] of await getRequiredDefinitions(value, client)) {
|
|
@@ -1540,28 +1615,36 @@ function requiresConversion(dataType) {
|
|
|
1540
1615
|
return false;
|
|
1541
1616
|
}
|
|
1542
1617
|
}
|
|
1618
|
+
function getObjectSpecifier(primaryKey, objectTypeApiName, definitions) {
|
|
1619
|
+
const def = definitions.get(objectTypeApiName);
|
|
1620
|
+
if (!def) {
|
|
1621
|
+
throw new Error(`Missing definition for ${objectTypeApiName}`);
|
|
1622
|
+
}
|
|
1623
|
+
return createObjectSpecifierFromPrimaryKey(def, primaryKey);
|
|
1624
|
+
}
|
|
1543
1625
|
function createQueryObjectResponse(primaryKey, objectDef) {
|
|
1544
1626
|
return {
|
|
1545
1627
|
$apiName: objectDef.apiName,
|
|
1546
|
-
$title:
|
|
1628
|
+
$title: undefined,
|
|
1547
1629
|
$objectType: objectDef.apiName,
|
|
1548
|
-
$primaryKey: primaryKey
|
|
1630
|
+
$primaryKey: primaryKey,
|
|
1631
|
+
$objectSpecifier: createObjectSpecifierFromPrimaryKey(objectDef, primaryKey)
|
|
1549
1632
|
};
|
|
1550
1633
|
}
|
|
1551
1634
|
|
|
1552
1635
|
// src/createClient.ts
|
|
1553
1636
|
var ActionInvoker = class {
|
|
1554
1637
|
constructor(clientCtx, actionDef) {
|
|
1555
|
-
this.applyAction = applyAction.bind(
|
|
1556
|
-
this.batchApplyAction = applyAction.bind(
|
|
1638
|
+
this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);
|
|
1639
|
+
this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);
|
|
1557
1640
|
}
|
|
1558
1641
|
};
|
|
1559
1642
|
var QueryInvoker = class {
|
|
1560
1643
|
constructor(clientCtx, queryDef) {
|
|
1561
|
-
this.executeFunction = applyQuery.bind(
|
|
1644
|
+
this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);
|
|
1562
1645
|
}
|
|
1563
1646
|
};
|
|
1564
|
-
function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvider, options =
|
|
1647
|
+
function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {
|
|
1565
1648
|
if (typeof ontologyRid === "string") {
|
|
1566
1649
|
if (!ontologyRid.startsWith("ri.")) {
|
|
1567
1650
|
throw new Error("Invalid ontology RID");
|
|
@@ -1592,7 +1675,7 @@ function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvi
|
|
|
1592
1675
|
case unstable.__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid.name:
|
|
1593
1676
|
return {
|
|
1594
1677
|
fetchOneByRid: async (objectType, rid, options2) => {
|
|
1595
|
-
return await
|
|
1678
|
+
return await chunkIU47QMYO_cjs.fetchSingle(clientCtx, objectType, options2, createWithRid([rid]));
|
|
1596
1679
|
}
|
|
1597
1680
|
};
|
|
1598
1681
|
case unstable.__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference.name:
|
|
@@ -1604,28 +1687,34 @@ function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvi
|
|
|
1604
1687
|
objectType,
|
|
1605
1688
|
propertyType
|
|
1606
1689
|
} = args;
|
|
1607
|
-
return await
|
|
1690
|
+
return await chunkJPENHIJB_cjs.MediaReferenceProperty_exports.upload(clientCtx, await clientCtx.ontologyRid, objectType.apiName, propertyType, data, {
|
|
1608
1691
|
mediaItemPath: fileName,
|
|
1609
1692
|
preview: true
|
|
1610
1693
|
});
|
|
1611
1694
|
}
|
|
1612
1695
|
};
|
|
1696
|
+
case unstable.__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid.name:
|
|
1697
|
+
return {
|
|
1698
|
+
fetchPageByRid: async (objectOrInterfaceType, rids, options2 = {}) => {
|
|
1699
|
+
return await chunkJPENHIJB_cjs.fetchPage(clientCtx, objectOrInterfaceType, options2, createWithRid(rids));
|
|
1700
|
+
}
|
|
1701
|
+
};
|
|
1613
1702
|
}
|
|
1614
1703
|
throw new Error("not implemented");
|
|
1615
1704
|
} else {
|
|
1616
1705
|
throw new Error("not implemented");
|
|
1617
1706
|
}
|
|
1618
1707
|
}
|
|
1619
|
-
const fetchMetadata = fetchMetadataInternal.bind(
|
|
1708
|
+
const fetchMetadata = fetchMetadataInternal.bind(undefined, clientCtx);
|
|
1620
1709
|
const symbolClientContext2 = "__osdkClientContext";
|
|
1621
1710
|
const client = Object.defineProperties(clientFn, {
|
|
1622
|
-
[
|
|
1711
|
+
[chunkJPENHIJB_cjs.symbolClientContext]: {
|
|
1623
1712
|
value: clientCtx
|
|
1624
1713
|
},
|
|
1625
1714
|
[symbolClientContext2]: {
|
|
1626
1715
|
value: clientCtx
|
|
1627
1716
|
},
|
|
1628
|
-
[
|
|
1717
|
+
[chunkJPENHIJB_cjs.additionalContext]: {
|
|
1629
1718
|
value: clientCtx
|
|
1630
1719
|
},
|
|
1631
1720
|
fetchMetadata: {
|
|
@@ -1634,21 +1723,21 @@ function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvi
|
|
|
1634
1723
|
});
|
|
1635
1724
|
return client;
|
|
1636
1725
|
}
|
|
1637
|
-
var createClient = createClientInternal.bind(
|
|
1638
|
-
function createWithRid(
|
|
1726
|
+
var createClient = createClientInternal.bind(undefined, chunkIU47QMYO_cjs.createObjectSet);
|
|
1727
|
+
function createWithRid(rids) {
|
|
1639
1728
|
const withRid = {
|
|
1640
1729
|
type: "static",
|
|
1641
|
-
"objects":
|
|
1730
|
+
"objects": rids
|
|
1642
1731
|
};
|
|
1643
1732
|
return withRid;
|
|
1644
1733
|
}
|
|
1645
|
-
function createPlatformClient(baseUrl, tokenProvider, options =
|
|
1734
|
+
function createPlatformClient(baseUrl, tokenProvider, options = undefined, fetchFn = fetch) {
|
|
1646
1735
|
return shared_client_impl.createSharedClientContext(baseUrl, tokenProvider, USER_AGENT, fetchFn);
|
|
1647
1736
|
}
|
|
1648
1737
|
var isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$/;
|
|
1649
1738
|
var extractDate = (dateTime) => {
|
|
1650
|
-
!(dateTime.length < 33) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "Invalid date format. Provided input is too long.") : invariant__default.default(false) :
|
|
1651
|
-
!isoRegex.test(dateTime) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Invalid date format. Expected ISO 8601 format, but received ${dateTime}`) : invariant__default.default(false) :
|
|
1739
|
+
!(dateTime.length < 33) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "Invalid date format. Provided input is too long.") : invariant__default.default(false) : undefined;
|
|
1740
|
+
!isoRegex.test(dateTime) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Invalid date format. Expected ISO 8601 format, but received ${dateTime}`) : invariant__default.default(false) : undefined;
|
|
1652
1741
|
return extractDateFromIsoString(dateTime);
|
|
1653
1742
|
};
|
|
1654
1743
|
var extractDateInUTC = (date) => {
|
|
@@ -1676,6 +1765,7 @@ Object.defineProperty(exports, "PalantirApiError", {
|
|
|
1676
1765
|
exports.ActionValidationError = ActionValidationError;
|
|
1677
1766
|
exports.createAttachmentUpload = createAttachmentUpload;
|
|
1678
1767
|
exports.createClient = createClient;
|
|
1768
|
+
exports.createObjectSpecifierFromPrimaryKey = createObjectSpecifierFromPrimaryKey;
|
|
1679
1769
|
exports.createPlatformClient = createPlatformClient;
|
|
1680
1770
|
exports.extractDate = extractDate;
|
|
1681
1771
|
exports.extractDateInLocalTime = extractDateInLocalTime;
|