@osdk/client 2.1.0-beta.27 → 2.1.0-beta.29
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 +27 -0
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js +106 -0
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js.map +1 -0
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js +100 -0
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -0
- package/build/browser/object/Cache.test.js +1 -3
- package/build/browser/object/Cache.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSet.test.js +199 -0
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js +19 -15
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/objectSet/createObjectSet.js +16 -0
- package/build/browser/objectSet/createObjectSet.js.map +1 -1
- package/build/browser/util/UserAgent.js +1 -1
- package/build/cjs/{chunk-AMEMEGJZ.cjs → chunk-JIK7S65P.cjs} +160 -54
- package/build/cjs/chunk-JIK7S65P.cjs.map +1 -0
- package/build/cjs/{chunk-HDBAHEBE.cjs → chunk-TCHGLBKJ.cjs} +11 -9
- package/build/cjs/chunk-TCHGLBKJ.cjs.map +1 -0
- package/build/cjs/index.cjs +86 -86
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/public/internal.cjs +6 -6
- package/build/cjs/public/internal.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.cjs +2 -2
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js +106 -0
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -0
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js +100 -0
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -0
- package/build/esm/object/Cache.test.js +1 -3
- package/build/esm/object/Cache.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSet.test.js +199 -0
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js +19 -15
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/objectSet/createObjectSet.js +16 -0
- package/build/esm/objectSet/createObjectSet.js.map +1 -1
- package/build/esm/util/UserAgent.js +1 -1
- package/build/types/derivedProperties/createWithPropertiesObjectSet.d.ts +1 -0
- package/build/types/derivedProperties/createWithPropertiesObjectSet.test.d.ts +1 -0
- package/build/types/object/Cache.test.d.ts +1 -8
- package/package.json +9 -10
- package/build/cjs/chunk-AMEMEGJZ.cjs.map +0 -1
- package/build/cjs/chunk-HDBAHEBE.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 chunkJIK7S65P_cjs = require('./chunk-JIK7S65P.cjs');
|
|
4
|
+
var chunkTCHGLBKJ_cjs = require('./chunk-TCHGLBKJ.cjs');
|
|
5
5
|
var api = require('@osdk/api');
|
|
6
6
|
var shared_net_errors = require('@osdk/shared.net.errors');
|
|
7
7
|
var unstable = require('@osdk/api/unstable');
|
|
@@ -54,7 +54,7 @@ function applyPageToken(payload, {
|
|
|
54
54
|
return pageToken ? {
|
|
55
55
|
...payload,
|
|
56
56
|
pageToken
|
|
57
|
-
} :
|
|
57
|
+
} : undefined;
|
|
58
58
|
}
|
|
59
59
|
async function* pageRequestAsAsyncIter(call, values, nextArgs, initialPayload) {
|
|
60
60
|
let payload = initialPayload;
|
|
@@ -71,7 +71,7 @@ async function* pageRequestAsAsyncIter(call, values, nextArgs, initialPayload) {
|
|
|
71
71
|
function createSimpleCache(map = /* @__PURE__ */ new Map(), fn) {
|
|
72
72
|
function get(key) {
|
|
73
73
|
let r = map.get(key);
|
|
74
|
-
if (r ===
|
|
74
|
+
if (r === undefined && fn !== undefined) {
|
|
75
75
|
return set(key, fn(key));
|
|
76
76
|
} else {
|
|
77
77
|
return r;
|
|
@@ -119,7 +119,7 @@ function createSimpleAsyncCache(type, fn, createCacheLocal = createSimpleCache)
|
|
|
119
119
|
var cachedAllOntologies;
|
|
120
120
|
async function getOntologyVersionForRid(ctx, ontologyRid) {
|
|
121
121
|
cachedAllOntologies ??= await client_unstable.loadAllOntologies(ctx, {});
|
|
122
|
-
!cachedAllOntologies.ontologies[ontologyRid] ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "ontology should be loaded") : invariant__default.default(false) :
|
|
122
|
+
!cachedAllOntologies.ontologies[ontologyRid] ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "ontology should be loaded") : invariant__default.default(false) : undefined;
|
|
123
123
|
return cachedAllOntologies.ontologies[ontologyRid].currentOntologyVersion;
|
|
124
124
|
}
|
|
125
125
|
var strongMemoAsync = (fn) => createSimpleAsyncCache("strong", fn).get;
|
|
@@ -161,7 +161,7 @@ var MetadataClient = class {
|
|
|
161
161
|
[objectTypeRid]: await this.ontologyVersion("")
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
|
-
!linkTypes.linkTypes[objectTypeRid] ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "link type should be loaded") : invariant__default.default(false) :
|
|
164
|
+
!linkTypes.linkTypes[objectTypeRid] ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "link type should be loaded") : invariant__default.default(false) : undefined;
|
|
165
165
|
const ret = {};
|
|
166
166
|
for (const l of linkTypes.linkTypes[objectTypeRid]) {
|
|
167
167
|
const helper = ({
|
|
@@ -231,22 +231,22 @@ var MetadataClient = class {
|
|
|
231
231
|
interfaceTypes: [],
|
|
232
232
|
typeGroups: [],
|
|
233
233
|
loadRedacted: false,
|
|
234
|
-
includeObjectTypeCount:
|
|
234
|
+
includeObjectTypeCount: undefined,
|
|
235
235
|
includeObjectTypesWithoutSearchableDatasources: true,
|
|
236
|
-
includeEntityMetadata:
|
|
236
|
+
includeEntityMetadata: undefined,
|
|
237
237
|
actionTypes: [],
|
|
238
|
-
includeTypeGroupEntitiesCount:
|
|
239
|
-
entityMetadata:
|
|
238
|
+
includeTypeGroupEntitiesCount: undefined,
|
|
239
|
+
entityMetadata: undefined
|
|
240
240
|
};
|
|
241
|
-
const entities = await client_unstable.bulkLoadOntologyEntities(this.#ctx,
|
|
242
|
-
!entities.objectTypes[0]?.objectType ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "object type should be loaded") : invariant__default.default(false) :
|
|
241
|
+
const entities = await client_unstable.bulkLoadOntologyEntities(this.#ctx, undefined, body);
|
|
242
|
+
!entities.objectTypes[0]?.objectType ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "object type should be loaded") : invariant__default.default(false) : undefined;
|
|
243
243
|
return entities.objectTypes[0].objectType;
|
|
244
244
|
});
|
|
245
245
|
ontologyVersion = strongMemoAsync(async (_) => getOntologyVersionForRid(this.#ctx, await this.#client.ontologyRid));
|
|
246
246
|
};
|
|
247
247
|
var metadataCacheClient = weakMemoAsync((client) => Promise.resolve(new MetadataClient(client)));
|
|
248
248
|
function createObjectPropertyMapping(conjureOT) {
|
|
249
|
-
!(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) :
|
|
249
|
+
!(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;
|
|
250
250
|
const pkRid = conjureOT.primaryKeys[0];
|
|
251
251
|
const pkProperty = Object.values(conjureOT.propertyTypes).find((a) => a.rid === pkRid);
|
|
252
252
|
if (!pkProperty) {
|
|
@@ -278,7 +278,7 @@ function createBulkLinksAsyncIterFactory(ctx) {
|
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
280
280
|
ctx.logger?.debug("Preparing to fetch bulk links");
|
|
281
|
-
!objs.every((a) => a.$objectType === objs[0].$objectType) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false) : invariant__default.default(false) :
|
|
281
|
+
!objs.every((a) => a.$objectType === objs[0].$objectType) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false) : invariant__default.default(false) : undefined;
|
|
282
282
|
const mcc = await metadataCacheClient(ctx);
|
|
283
283
|
const helper = await mcc.forObjectByApiName(objs[0].$objectType);
|
|
284
284
|
const [objectTypeRid, propertyMapping, fullLinkMapping] = await Promise.all([helper.getRid(), helper.getPropertyMapping(), helper.getLinkMapping()]);
|
|
@@ -290,21 +290,21 @@ function createBulkLinksAsyncIterFactory(ctx) {
|
|
|
290
290
|
}
|
|
291
291
|
const req = {
|
|
292
292
|
objectSetContext: {
|
|
293
|
-
forkRid:
|
|
293
|
+
forkRid: undefined,
|
|
294
294
|
objectSetFilterContext: {
|
|
295
295
|
parameterOverrides: {}
|
|
296
296
|
},
|
|
297
|
-
ontologyBranchRid:
|
|
298
|
-
owningRid:
|
|
299
|
-
reportUsage:
|
|
300
|
-
workstateRid:
|
|
297
|
+
ontologyBranchRid: undefined,
|
|
298
|
+
owningRid: undefined,
|
|
299
|
+
reportUsage: undefined,
|
|
300
|
+
workstateRid: undefined
|
|
301
301
|
},
|
|
302
302
|
responseOptions: {
|
|
303
303
|
includeObjectSetEntities: true,
|
|
304
304
|
includeUsageCost: false
|
|
305
305
|
},
|
|
306
306
|
pageSize: 1e3,
|
|
307
|
-
pageToken:
|
|
307
|
+
pageToken: undefined,
|
|
308
308
|
linksRequests: [{
|
|
309
309
|
directedLinkTypes: Object.values(linkMapping).map(({
|
|
310
310
|
directedLinkTypeRid
|
|
@@ -317,7 +317,7 @@ function createBulkLinksAsyncIterFactory(ctx) {
|
|
|
317
317
|
})))
|
|
318
318
|
}]
|
|
319
319
|
};
|
|
320
|
-
const bulkLinksIter = pageRequestAsAsyncIter(client_unstable.getBulkLinksPage.bind(
|
|
320
|
+
const bulkLinksIter = pageRequestAsAsyncIter(client_unstable.getBulkLinksPage.bind(undefined, makeConjureContext(ctx, "object-set-service/api")), getResults, applyPageToken, req);
|
|
321
321
|
for await (const item of bulkLinksIter) {
|
|
322
322
|
const {
|
|
323
323
|
objectIdentifier
|
|
@@ -404,13 +404,13 @@ async function toDataValue(value, client) {
|
|
|
404
404
|
return Promise.all(promiseArray);
|
|
405
405
|
}
|
|
406
406
|
if (isAttachmentUpload(value)) {
|
|
407
|
-
const attachment = await
|
|
407
|
+
const attachment = await chunkTCHGLBKJ_cjs.Attachment_exports.upload(client, value.data, {
|
|
408
408
|
filename: value.name
|
|
409
409
|
});
|
|
410
410
|
return await toDataValue(attachment.rid, client);
|
|
411
411
|
}
|
|
412
412
|
if (typeof value === "object" && value instanceof Blob && "name" in value) {
|
|
413
|
-
const attachment = await
|
|
413
|
+
const attachment = await chunkTCHGLBKJ_cjs.Attachment_exports.upload(client, value, {
|
|
414
414
|
filename: value.name
|
|
415
415
|
});
|
|
416
416
|
return await toDataValue(attachment.rid, client);
|
|
@@ -421,11 +421,11 @@ async function toDataValue(value, client) {
|
|
|
421
421
|
if (isOsdkBaseObject(value)) {
|
|
422
422
|
return await toDataValue(value.$primaryKey, client);
|
|
423
423
|
}
|
|
424
|
-
if (
|
|
424
|
+
if (chunkJIK7S65P_cjs.isWireObjectSet(value)) {
|
|
425
425
|
return value;
|
|
426
426
|
}
|
|
427
|
-
if (
|
|
428
|
-
return
|
|
427
|
+
if (chunkJIK7S65P_cjs.isObjectSet(value)) {
|
|
428
|
+
return chunkJIK7S65P_cjs.getWireObjectSet(value);
|
|
429
429
|
}
|
|
430
430
|
if (isMediaReference(value)) {
|
|
431
431
|
return value;
|
|
@@ -448,20 +448,20 @@ async function toDataValue(value, client) {
|
|
|
448
448
|
|
|
449
449
|
// src/actions/applyAction.ts
|
|
450
450
|
async function applyAction(client, action, parameters, options = {}) {
|
|
451
|
-
const clientWithHeaders =
|
|
451
|
+
const clientWithHeaders = chunkTCHGLBKJ_cjs.addUserAgentAndRequestContextHeaders(chunkJIK7S65P_cjs.augmentRequestContext(client, (_) => ({
|
|
452
452
|
finalMethodCall: "applyAction"
|
|
453
453
|
})), action);
|
|
454
454
|
if (Array.isArray(parameters)) {
|
|
455
|
-
const response = await
|
|
455
|
+
const response = await chunkTCHGLBKJ_cjs.Action_exports.applyBatch(clientWithHeaders, await client.ontologyRid, action.apiName, {
|
|
456
456
|
requests: parameters ? await remapBatchActionParams(parameters, client) : [],
|
|
457
457
|
options: {
|
|
458
458
|
returnEdits: options?.$returnEdits ? "ALL" : "NONE"
|
|
459
459
|
}
|
|
460
460
|
});
|
|
461
461
|
const edits = response.edits;
|
|
462
|
-
return options?.$returnEdits ? edits?.type === "edits" ? remapActionResponse(response) : edits :
|
|
462
|
+
return options?.$returnEdits ? edits?.type === "edits" ? remapActionResponse(response) : edits : undefined;
|
|
463
463
|
} else {
|
|
464
|
-
const response = await
|
|
464
|
+
const response = await chunkTCHGLBKJ_cjs.Action_exports.apply(clientWithHeaders, await client.ontologyRid, action.apiName, {
|
|
465
465
|
parameters: await remapActionParams(parameters, client),
|
|
466
466
|
options: {
|
|
467
467
|
mode: options?.$validateOnly ? "VALIDATE_ONLY" : "VALIDATE_AND_EXECUTE",
|
|
@@ -475,7 +475,7 @@ async function applyAction(client, action, parameters, options = {}) {
|
|
|
475
475
|
throw new ActionValidationError(response.validation);
|
|
476
476
|
}
|
|
477
477
|
const edits = response.edits;
|
|
478
|
-
return options?.$returnEdits ? edits?.type === "edits" ? remapActionResponse(response) : edits :
|
|
478
|
+
return options?.$returnEdits ? edits?.type === "edits" ? remapActionResponse(response) : edits : undefined;
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
481
|
async function remapActionParams(params, client) {
|
|
@@ -659,7 +659,7 @@ var GeotimeSeriesPropertyImpl = class {
|
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
661
|
async getLatestValue() {
|
|
662
|
-
const latestPointPromise =
|
|
662
|
+
const latestPointPromise = chunkTCHGLBKJ_cjs.TimeSeriesValueBankProperty_exports.getLatestValue(this.#client, await this.#client.ontologyRid, ...this.#triplet);
|
|
663
663
|
latestPointPromise.then(
|
|
664
664
|
(latestPoint) => this.lastFetchedValue = latestPoint,
|
|
665
665
|
// eslint-disable-next-line no-console
|
|
@@ -675,7 +675,7 @@ var GeotimeSeriesPropertyImpl = class {
|
|
|
675
675
|
return allPoints;
|
|
676
676
|
}
|
|
677
677
|
async *asyncIterValues(query) {
|
|
678
|
-
const streamPointsIterator = await
|
|
678
|
+
const streamPointsIterator = await chunkTCHGLBKJ_cjs.TimeSeriesValueBankProperty_exports.streamValues(this.#client, await this.#client.ontologyRid, ...this.#triplet, query ? {
|
|
679
679
|
range: getTimeRange(query)
|
|
680
680
|
} : {});
|
|
681
681
|
for await (const timeseriesPoint of asyncIterPointsHelper(streamPointsIterator)) {
|
|
@@ -699,13 +699,13 @@ var MediaReferencePropertyImpl = class {
|
|
|
699
699
|
this.#triplet = [objectApiName, primaryKey, propertyName];
|
|
700
700
|
}
|
|
701
701
|
async fetchContents() {
|
|
702
|
-
return
|
|
702
|
+
return chunkTCHGLBKJ_cjs.MediaReferenceProperty_exports.getMediaContent(this.#client, await this.#client.ontologyRid, ...this.#triplet, {
|
|
703
703
|
preview: true
|
|
704
704
|
// TODO: Can turn this back off when backend is no longer in beta.
|
|
705
705
|
});
|
|
706
706
|
}
|
|
707
707
|
async fetchMetadata() {
|
|
708
|
-
const r = await
|
|
708
|
+
const r = await chunkTCHGLBKJ_cjs.MediaReferenceProperty_exports.getMediaMetadata(this.#client, await this.#client.ontologyRid, ...this.#triplet, {
|
|
709
709
|
preview: true
|
|
710
710
|
// TODO: Can turn this back off when backend is no longer in beta.
|
|
711
711
|
});
|
|
@@ -726,10 +726,10 @@ var TimeSeriesPropertyImpl = class {
|
|
|
726
726
|
this.#triplet = [objectApiName, primaryKey, propertyName];
|
|
727
727
|
}
|
|
728
728
|
async getFirstPoint() {
|
|
729
|
-
return
|
|
729
|
+
return chunkTCHGLBKJ_cjs.TimeSeriesPropertyV2_exports.getFirstPoint(this.#client, await this.#client.ontologyRid, ...this.#triplet);
|
|
730
730
|
}
|
|
731
731
|
async getLastPoint() {
|
|
732
|
-
return
|
|
732
|
+
return chunkTCHGLBKJ_cjs.TimeSeriesPropertyV2_exports.getLastPoint(this.#client, await this.#client.ontologyRid, ...this.#triplet);
|
|
733
733
|
}
|
|
734
734
|
async getAllPoints(query) {
|
|
735
735
|
const allPoints = [];
|
|
@@ -739,7 +739,7 @@ var TimeSeriesPropertyImpl = class {
|
|
|
739
739
|
return allPoints;
|
|
740
740
|
}
|
|
741
741
|
async *asyncIterPoints(query) {
|
|
742
|
-
const streamPointsIterator = await
|
|
742
|
+
const streamPointsIterator = await chunkTCHGLBKJ_cjs.TimeSeriesPropertyV2_exports.streamPoints(this.#client, await this.#client.ontologyRid, ...this.#triplet, query ? {
|
|
743
743
|
range: getTimeRange(query)
|
|
744
744
|
} : {});
|
|
745
745
|
for await (const timeseriesPoint of asyncIterPointsHelper(streamPointsIterator)) {
|
|
@@ -759,7 +759,7 @@ var ClientRef = Symbol("ClientRef" );
|
|
|
759
759
|
|
|
760
760
|
// src/object/convertWireToOsdkObjects/createOsdkInterface.ts
|
|
761
761
|
function createOsdkInterface(underlying, interfaceDef) {
|
|
762
|
-
const [objApiNamespace] =
|
|
762
|
+
const [objApiNamespace] = chunkJIK7S65P_cjs.extractNamespace(interfaceDef.apiName);
|
|
763
763
|
return Object.freeze(Object.defineProperties({}, {
|
|
764
764
|
// first to minimize hidden classes
|
|
765
765
|
[UnderlyingOsdkObject]: {
|
|
@@ -794,7 +794,7 @@ function createOsdkInterface(underlying, interfaceDef) {
|
|
|
794
794
|
},
|
|
795
795
|
...Object.fromEntries(Object.keys(interfaceDef.properties).map((p) => {
|
|
796
796
|
const objDef = underlying[ObjectDefRef];
|
|
797
|
-
const [apiNamespace, apiName] =
|
|
797
|
+
const [apiNamespace, apiName] = chunkJIK7S65P_cjs.extractNamespace(p);
|
|
798
798
|
const targetPropName = objDef.interfaceMap[interfaceDef.apiName][p];
|
|
799
799
|
return [apiNamespace === objApiNamespace ? apiName : p, {
|
|
800
800
|
enumerable: targetPropName in underlying,
|
|
@@ -850,8 +850,8 @@ function get$link(holder) {
|
|
|
850
850
|
[objDef.primaryKeyApiName]: rawObj.$primaryKey
|
|
851
851
|
}).pivotTo(linkName);
|
|
852
852
|
const value = !linkDef.multiplicity ? {
|
|
853
|
-
fetchOne: (options) =>
|
|
854
|
-
fetchOneWithErrors: (options) =>
|
|
853
|
+
fetchOne: (options) => chunkJIK7S65P_cjs.fetchSingle(client, objDef, options ?? {}, chunkJIK7S65P_cjs.getWireObjectSet(objectSet)),
|
|
854
|
+
fetchOneWithErrors: (options) => chunkJIK7S65P_cjs.fetchSingleWithErrors(client, objDef, options ?? {}, chunkJIK7S65P_cjs.getWireObjectSet(objectSet))
|
|
855
855
|
} : objectSet;
|
|
856
856
|
return [linkName, value];
|
|
857
857
|
})));
|
|
@@ -920,7 +920,7 @@ function createSpecialProperty(client, objectDef, rawObject, p) {
|
|
|
920
920
|
const rawValue = rawObject[p];
|
|
921
921
|
const propDef = objectDef.properties[p];
|
|
922
922
|
if (process.env.NODE_ENV !== "production") {
|
|
923
|
-
!(propDef != null && typeof propDef.type === "string" && specialPropertyTypes.has(propDef.type)) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false) : invariant__default.default(false) :
|
|
923
|
+
!(propDef != null && typeof propDef.type === "string" && specialPropertyTypes.has(propDef.type)) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false) : invariant__default.default(false) : undefined;
|
|
924
924
|
}
|
|
925
925
|
{
|
|
926
926
|
{
|
|
@@ -928,9 +928,9 @@ function createSpecialProperty(client, objectDef, rawObject, p) {
|
|
|
928
928
|
{
|
|
929
929
|
if (propDef.type === "attachment") {
|
|
930
930
|
if (Array.isArray(rawValue)) {
|
|
931
|
-
return rawValue.map((a) =>
|
|
931
|
+
return rawValue.map((a) => chunkJIK7S65P_cjs.hydrateAttachmentFromRidInternal(client, a.rid));
|
|
932
932
|
}
|
|
933
|
-
return
|
|
933
|
+
return chunkJIK7S65P_cjs.hydrateAttachmentFromRidInternal(client, rawValue.rid);
|
|
934
934
|
}
|
|
935
935
|
if (propDef.type === "numericTimeseries" || propDef.type === "stringTimeseries" || propDef.type === "sensorTimeseries") {
|
|
936
936
|
return new TimeSeriesPropertyImpl(client, objectDef.apiName, rawObject[objectDef.primaryKeyApiName], p);
|
|
@@ -942,7 +942,7 @@ function createSpecialProperty(client, objectDef, rawObject, p) {
|
|
|
942
942
|
type: "Point",
|
|
943
943
|
coordinates: rawValue.position
|
|
944
944
|
}
|
|
945
|
-
} :
|
|
945
|
+
} : undefined);
|
|
946
946
|
}
|
|
947
947
|
if (propDef.type === "mediaReference") {
|
|
948
948
|
return new MediaReferencePropertyImpl({
|
|
@@ -962,12 +962,12 @@ function createSpecialProperty(client, objectDef, rawObject, p) {
|
|
|
962
962
|
async function convertWireToOsdkObjects(client, objects, interfaceApiName, forceRemoveRid = false, selectedProps, strictNonNull = false) {
|
|
963
963
|
client.logger?.debug(`START convertWireToOsdkObjects()`);
|
|
964
964
|
fixObjectPropertiesInPlace(objects, forceRemoveRid);
|
|
965
|
-
const ifaceDef = interfaceApiName ? await client.ontologyProvider.getInterfaceDefinition(interfaceApiName) :
|
|
966
|
-
const ifaceSelected = ifaceDef ? selectedProps ?? Object.keys(ifaceDef.properties) :
|
|
965
|
+
const ifaceDef = interfaceApiName ? await client.ontologyProvider.getInterfaceDefinition(interfaceApiName) : undefined;
|
|
966
|
+
const ifaceSelected = ifaceDef ? selectedProps ?? Object.keys(ifaceDef.properties) : undefined;
|
|
967
967
|
const ret = [];
|
|
968
968
|
for (const rawObj of objects) {
|
|
969
969
|
const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);
|
|
970
|
-
!objectDef ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Missing definition for '${rawObj.$apiName}'`) : invariant__default.default(false) :
|
|
970
|
+
!objectDef ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Missing definition for '${rawObj.$apiName}'`) : invariant__default.default(false) : undefined;
|
|
971
971
|
let objProps;
|
|
972
972
|
let conforming = true;
|
|
973
973
|
if (ifaceDef && ifaceSelected) {
|
|
@@ -997,11 +997,11 @@ async function convertWireToOsdkObjects2(client, objects, interfaceApiName, forc
|
|
|
997
997
|
const ret = [];
|
|
998
998
|
for (const rawObj of objects) {
|
|
999
999
|
const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);
|
|
1000
|
-
!objectDef ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Missing definition for '${rawObj.$apiName}'`) : invariant__default.default(false) :
|
|
1001
|
-
const interfaceToObjMapping = interfaceApiName ? interfaceToObjectTypeMappings[interfaceApiName][rawObj.$apiName] :
|
|
1000
|
+
!objectDef ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Missing definition for '${rawObj.$apiName}'`) : invariant__default.default(false) : undefined;
|
|
1001
|
+
const interfaceToObjMapping = interfaceApiName ? interfaceToObjectTypeMappings[interfaceApiName][rawObj.$apiName] : undefined;
|
|
1002
1002
|
const ifaceSelected = interfaceApiName && interfaceToObjMapping ? selectedProps ? Object.keys(interfaceToObjMapping).filter((val) => {
|
|
1003
1003
|
selectedProps?.includes(interfaceToObjMapping[val]);
|
|
1004
|
-
}) : [...Object.values(interfaceToObjMapping), objectDef.primaryKeyApiName] :
|
|
1004
|
+
}) : [...Object.values(interfaceToObjMapping), objectDef.primaryKeyApiName] : undefined;
|
|
1005
1005
|
let objProps;
|
|
1006
1006
|
let conforming = true;
|
|
1007
1007
|
if (interfaceApiName && ifaceSelected) {
|
|
@@ -1032,7 +1032,7 @@ function reframeAsObjectInPlace(objectDef, interfaceApiName, rawObj) {
|
|
|
1032
1032
|
if (sptProp in rawObj) {
|
|
1033
1033
|
const value = rawObj[sptProp];
|
|
1034
1034
|
delete rawObj[sptProp];
|
|
1035
|
-
if (value !==
|
|
1035
|
+
if (value !== undefined) {
|
|
1036
1036
|
newProps[regularProp] = value;
|
|
1037
1037
|
}
|
|
1038
1038
|
}
|
|
@@ -1096,7 +1096,7 @@ function createClientCache(fn) {
|
|
|
1096
1096
|
cache.set(client.clientCacheKey, /* @__PURE__ */ new Map());
|
|
1097
1097
|
}
|
|
1098
1098
|
let r = cache.get(client.clientCacheKey).get(key);
|
|
1099
|
-
if (r ===
|
|
1099
|
+
if (r === undefined && fn !== undefined) {
|
|
1100
1100
|
return set(client, key, fn(client, key));
|
|
1101
1101
|
} else {
|
|
1102
1102
|
return r;
|
|
@@ -1144,11 +1144,11 @@ function createAsyncClientCache(fn, createCacheLocal = createClientCache) {
|
|
|
1144
1144
|
return ret;
|
|
1145
1145
|
}
|
|
1146
1146
|
async function loadActionMetadata(client, actionType) {
|
|
1147
|
-
const r = await
|
|
1147
|
+
const r = await chunkTCHGLBKJ_cjs.ActionTypeV2_exports.get(client, await client.ontologyRid, actionType);
|
|
1148
1148
|
return generatorConverters.wireActionTypeV2ToSdkActionMetadata(r);
|
|
1149
1149
|
}
|
|
1150
1150
|
async function loadFullObjectMetadata(client, objectType) {
|
|
1151
|
-
const full = await
|
|
1151
|
+
const full = await chunkTCHGLBKJ_cjs.ObjectTypeV2_exports.getFullMetadata(client, await client.ontologyRid, objectType, {
|
|
1152
1152
|
preview: true
|
|
1153
1153
|
});
|
|
1154
1154
|
const ret = generatorConverters.wireObjectTypeFullMetadataToSdkObjectMetadata(full, true);
|
|
@@ -1158,13 +1158,13 @@ async function loadFullObjectMetadata(client, objectType) {
|
|
|
1158
1158
|
};
|
|
1159
1159
|
}
|
|
1160
1160
|
async function loadInterfaceMetadata(client, objectType) {
|
|
1161
|
-
const r = await
|
|
1161
|
+
const r = await chunkTCHGLBKJ_cjs.OntologyInterface_exports.get(client, await client.ontologyRid, objectType, {
|
|
1162
1162
|
preview: true
|
|
1163
1163
|
});
|
|
1164
1164
|
return generatorConverters.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(r, true);
|
|
1165
1165
|
}
|
|
1166
1166
|
async function loadQueryMetadata(client, queryType) {
|
|
1167
|
-
const r = await
|
|
1167
|
+
const r = await chunkTCHGLBKJ_cjs.QueryType_exports.get(client, await client.ontologyRid, queryType);
|
|
1168
1168
|
return generatorConverters.wireQueryTypeV2ToSdkQueryMetadata(r);
|
|
1169
1169
|
}
|
|
1170
1170
|
|
|
@@ -1175,7 +1175,7 @@ var createStandardOntologyProviderFactory = (client) => {
|
|
|
1175
1175
|
let objectDef = await loadFullObjectMetadata(client3, key);
|
|
1176
1176
|
const interfaceDefs = Object.fromEntries((await Promise.all(objectDef.implements?.map((i) => ret.getInterfaceDefinition(i)) ?? [])).map((i) => [i.apiName, {
|
|
1177
1177
|
def: i,
|
|
1178
|
-
handler:
|
|
1178
|
+
handler: undefined
|
|
1179
1179
|
}]));
|
|
1180
1180
|
const fullObjectDef = {
|
|
1181
1181
|
...objectDef,
|
|
@@ -1211,10 +1211,10 @@ var createStandardOntologyProviderFactory = (client) => {
|
|
|
1211
1211
|
};
|
|
1212
1212
|
|
|
1213
1213
|
// src/util/UserAgent.ts
|
|
1214
|
-
var USER_AGENT = `osdk-client/${"2.1.0-beta.
|
|
1214
|
+
var USER_AGENT = `osdk-client/${"2.1.0-beta.29"}`;
|
|
1215
1215
|
|
|
1216
1216
|
// src/createMinimalClient.ts
|
|
1217
|
-
function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory =
|
|
1217
|
+
function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = chunkJIK7S65P_cjs.createObjectSet) {
|
|
1218
1218
|
if (process.env.NODE_ENV !== "production") {
|
|
1219
1219
|
try {
|
|
1220
1220
|
new URL(baseUrl);
|
|
@@ -1276,13 +1276,13 @@ async function toDataValueQueries(value, client, desiredType) {
|
|
|
1276
1276
|
switch (desiredType.type) {
|
|
1277
1277
|
case "attachment": {
|
|
1278
1278
|
if (isAttachmentUpload(value)) {
|
|
1279
|
-
const attachment = await
|
|
1279
|
+
const attachment = await chunkTCHGLBKJ_cjs.Attachment_exports.upload(client, value.data, {
|
|
1280
1280
|
filename: value.name
|
|
1281
1281
|
});
|
|
1282
1282
|
return attachment.rid;
|
|
1283
1283
|
}
|
|
1284
1284
|
if (typeof value === "object" && value instanceof Blob && "name" in value) {
|
|
1285
|
-
const attachment = await
|
|
1285
|
+
const attachment = await chunkTCHGLBKJ_cjs.Attachment_exports.upload(client, value, {
|
|
1286
1286
|
filename: value.name
|
|
1287
1287
|
});
|
|
1288
1288
|
return attachment.rid;
|
|
@@ -1313,11 +1313,11 @@ async function toDataValueQueries(value, client, desiredType) {
|
|
|
1313
1313
|
break;
|
|
1314
1314
|
}
|
|
1315
1315
|
case "objectSet": {
|
|
1316
|
-
if (
|
|
1316
|
+
if (chunkJIK7S65P_cjs.isWireObjectSet(value)) {
|
|
1317
1317
|
return value;
|
|
1318
1318
|
}
|
|
1319
|
-
if (
|
|
1320
|
-
return
|
|
1319
|
+
if (chunkJIK7S65P_cjs.isObjectSet(value)) {
|
|
1320
|
+
return chunkJIK7S65P_cjs.getWireObjectSet(value);
|
|
1321
1321
|
}
|
|
1322
1322
|
break;
|
|
1323
1323
|
}
|
|
@@ -1346,7 +1346,7 @@ async function toDataValueQueries(value, client, desiredType) {
|
|
|
1346
1346
|
// src/queries/applyQuery.ts
|
|
1347
1347
|
async function applyQuery(client, query, params) {
|
|
1348
1348
|
const qd = await client.ontologyProvider.getQueryDefinition(query.apiName);
|
|
1349
|
-
const response = await
|
|
1349
|
+
const response = await chunkTCHGLBKJ_cjs.Query_exports.execute(chunkTCHGLBKJ_cjs.addUserAgentAndRequestContextHeaders(chunkJIK7S65P_cjs.augmentRequestContext(client, (_) => ({
|
|
1350
1350
|
finalMethodCall: "applyQuery"
|
|
1351
1351
|
})), query), await client.ontologyRid, query.apiName, {
|
|
1352
1352
|
parameters: params ? await remapQueryParams(params, client, qd.parameters) : {}
|
|
@@ -1365,7 +1365,7 @@ async function remapQueryParams(params, client, paramTypes) {
|
|
|
1365
1365
|
async function remapQueryResponse(client, responseDataType, responseValue, definitions) {
|
|
1366
1366
|
if (responseValue == null) {
|
|
1367
1367
|
if (responseDataType.nullable) {
|
|
1368
|
-
return
|
|
1368
|
+
return undefined;
|
|
1369
1369
|
} else {
|
|
1370
1370
|
throw new Error("Got null response when nullable was not allowed");
|
|
1371
1371
|
}
|
|
@@ -1391,7 +1391,7 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
|
|
|
1391
1391
|
return responseValue;
|
|
1392
1392
|
}
|
|
1393
1393
|
case "attachment": {
|
|
1394
|
-
return
|
|
1394
|
+
return chunkJIK7S65P_cjs.hydrateAttachmentFromRidInternal(client, responseValue);
|
|
1395
1395
|
}
|
|
1396
1396
|
case "object": {
|
|
1397
1397
|
const def = definitions.get(responseDataType.object);
|
|
@@ -1406,7 +1406,7 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
|
|
|
1406
1406
|
throw new Error(`Missing definition for ${responseDataType.objectSet}`);
|
|
1407
1407
|
}
|
|
1408
1408
|
if (typeof responseValue === "string") {
|
|
1409
|
-
return
|
|
1409
|
+
return chunkJIK7S65P_cjs.createObjectSet(def, client, {
|
|
1410
1410
|
type: "intersect",
|
|
1411
1411
|
objectSets: [{
|
|
1412
1412
|
type: "base",
|
|
@@ -1417,7 +1417,7 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
|
|
|
1417
1417
|
}]
|
|
1418
1418
|
});
|
|
1419
1419
|
}
|
|
1420
|
-
return
|
|
1420
|
+
return chunkJIK7S65P_cjs.createObjectSet(def, client, responseValue);
|
|
1421
1421
|
}
|
|
1422
1422
|
case "struct": {
|
|
1423
1423
|
for (const [key, subtype] of Object.entries(responseDataType.struct)) {
|
|
@@ -1523,7 +1523,7 @@ function requiresConversion(dataType) {
|
|
|
1523
1523
|
function createQueryObjectResponse(primaryKey, objectDef) {
|
|
1524
1524
|
return {
|
|
1525
1525
|
$apiName: objectDef.apiName,
|
|
1526
|
-
$title:
|
|
1526
|
+
$title: undefined,
|
|
1527
1527
|
$objectType: objectDef.apiName,
|
|
1528
1528
|
$primaryKey: primaryKey
|
|
1529
1529
|
};
|
|
@@ -1532,16 +1532,16 @@ function createQueryObjectResponse(primaryKey, objectDef) {
|
|
|
1532
1532
|
// src/createClient.ts
|
|
1533
1533
|
var ActionInvoker = class {
|
|
1534
1534
|
constructor(clientCtx, actionDef) {
|
|
1535
|
-
this.applyAction = applyAction.bind(
|
|
1536
|
-
this.batchApplyAction = applyAction.bind(
|
|
1535
|
+
this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);
|
|
1536
|
+
this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);
|
|
1537
1537
|
}
|
|
1538
1538
|
};
|
|
1539
1539
|
var QueryInvoker = class {
|
|
1540
1540
|
constructor(clientCtx, queryDef) {
|
|
1541
|
-
this.executeFunction = applyQuery.bind(
|
|
1541
|
+
this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);
|
|
1542
1542
|
}
|
|
1543
1543
|
};
|
|
1544
|
-
function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvider, options =
|
|
1544
|
+
function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {
|
|
1545
1545
|
if (typeof ontologyRid === "string") {
|
|
1546
1546
|
if (!ontologyRid.startsWith("ri.")) {
|
|
1547
1547
|
throw new Error("Invalid ontology RID");
|
|
@@ -1572,7 +1572,7 @@ function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvi
|
|
|
1572
1572
|
case unstable.__EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe.name:
|
|
1573
1573
|
return {
|
|
1574
1574
|
subscribe: (objectSet, listener, opts) => {
|
|
1575
|
-
const pendingSubscribe =
|
|
1575
|
+
const pendingSubscribe = chunkJIK7S65P_cjs.ObjectSetListenerWebsocket.getInstance(clientCtx).subscribe(objectSet.$objectSetInternals?.def, chunkJIK7S65P_cjs.getWireObjectSet(objectSet), listener, opts?.properties);
|
|
1576
1576
|
return {
|
|
1577
1577
|
unsubscribe: async () => (await pendingSubscribe)()
|
|
1578
1578
|
};
|
|
@@ -1581,7 +1581,7 @@ function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvi
|
|
|
1581
1581
|
case unstable.__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid.name:
|
|
1582
1582
|
return {
|
|
1583
1583
|
fetchOneByRid: async (objectType, rid, options2) => {
|
|
1584
|
-
return await
|
|
1584
|
+
return await chunkJIK7S65P_cjs.fetchSingle(clientCtx, objectType, options2, createWithRid(rid));
|
|
1585
1585
|
}
|
|
1586
1586
|
};
|
|
1587
1587
|
case unstable.__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference.name:
|
|
@@ -1593,7 +1593,7 @@ function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvi
|
|
|
1593
1593
|
objectTypeApi,
|
|
1594
1594
|
propertyTypeApi
|
|
1595
1595
|
} = args;
|
|
1596
|
-
return await
|
|
1596
|
+
return await chunkTCHGLBKJ_cjs.MediaReferenceProperty_exports.upload(clientCtx, await clientCtx.ontologyRid, objectTypeApi, propertyTypeApi, data, {
|
|
1597
1597
|
mediaItemPath: fileName,
|
|
1598
1598
|
preview: true
|
|
1599
1599
|
});
|
|
@@ -1605,16 +1605,16 @@ function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvi
|
|
|
1605
1605
|
throw new Error("not implemented");
|
|
1606
1606
|
}
|
|
1607
1607
|
}
|
|
1608
|
-
const fetchMetadata = fetchMetadataInternal.bind(
|
|
1608
|
+
const fetchMetadata = fetchMetadataInternal.bind(undefined, clientCtx);
|
|
1609
1609
|
const symbolClientContext2 = "__osdkClientContext";
|
|
1610
1610
|
const client = Object.defineProperties(clientFn, {
|
|
1611
|
-
[
|
|
1611
|
+
[chunkTCHGLBKJ_cjs.symbolClientContext]: {
|
|
1612
1612
|
value: clientCtx
|
|
1613
1613
|
},
|
|
1614
1614
|
[symbolClientContext2]: {
|
|
1615
1615
|
value: clientCtx
|
|
1616
1616
|
},
|
|
1617
|
-
[
|
|
1617
|
+
[chunkJIK7S65P_cjs.additionalContext]: {
|
|
1618
1618
|
value: clientCtx
|
|
1619
1619
|
},
|
|
1620
1620
|
fetchMetadata: {
|
|
@@ -1623,7 +1623,7 @@ function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvi
|
|
|
1623
1623
|
});
|
|
1624
1624
|
return client;
|
|
1625
1625
|
}
|
|
1626
|
-
var createClient = createClientInternal.bind(
|
|
1626
|
+
var createClient = createClientInternal.bind(undefined, chunkJIK7S65P_cjs.createObjectSet);
|
|
1627
1627
|
function createWithRid(rid) {
|
|
1628
1628
|
const withRid = {
|
|
1629
1629
|
type: "static",
|
|
@@ -1631,13 +1631,13 @@ function createWithRid(rid) {
|
|
|
1631
1631
|
};
|
|
1632
1632
|
return withRid;
|
|
1633
1633
|
}
|
|
1634
|
-
function createPlatformClient(baseUrl, tokenProvider, options =
|
|
1634
|
+
function createPlatformClient(baseUrl, tokenProvider, options = undefined, fetchFn = fetch) {
|
|
1635
1635
|
return shared_client_impl.createSharedClientContext(baseUrl, tokenProvider, USER_AGENT, fetchFn);
|
|
1636
1636
|
}
|
|
1637
1637
|
var isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$/;
|
|
1638
1638
|
var extractDate = (dateTime) => {
|
|
1639
|
-
!(dateTime.length < 33) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "Invalid date format. Provided input is too long.") : invariant__default.default(false) :
|
|
1640
|
-
!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) :
|
|
1639
|
+
!(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;
|
|
1640
|
+
!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;
|
|
1641
1641
|
return extractDateFromIsoString(dateTime);
|
|
1642
1642
|
};
|
|
1643
1643
|
var extractDateInUTC = (date) => {
|