@osdk/client 2.2.0-beta.4 → 2.2.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/build/browser/internal/conversions/modernToLegacyGroupByClause.js +7 -0
- package/build/browser/internal/conversions/modernToLegacyGroupByClause.js.map +1 -1
- package/build/browser/object/AttachmentUpload.js +3 -0
- package/build/browser/object/AttachmentUpload.js.map +1 -1
- package/build/browser/object/aggregate.test.js +12 -2
- package/build/browser/object/aggregate.test.js.map +1 -1
- package/build/browser/observable/OptimisticBuilder.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/Store.test.js +2 -2
- package/build/browser/observable/internal/Store.test.js.map +1 -1
- package/build/browser/observable/internal/objectMatchesWhereClause.js +0 -2
- package/build/browser/observable/internal/objectMatchesWhereClause.js.map +1 -1
- package/build/browser/util/UserAgent.js +1 -1
- package/build/browser/util/toDataValue.js +10 -2
- package/build/browser/util/toDataValue.js.map +1 -1
- package/build/browser/util/toDataValueQueries.js +10 -2
- package/build/browser/util/toDataValueQueries.js.map +1 -1
- package/build/cjs/{chunk-T5UE6BI7.cjs → chunk-2FVV5A63.cjs} +41 -34
- package/build/cjs/chunk-2FVV5A63.cjs.map +1 -0
- package/build/cjs/chunk-X7WGNFZ4.cjs +5 -5
- package/build/cjs/chunk-X7WGNFZ4.cjs.map +1 -1
- package/build/cjs/graphql-JJX5MZPQ.cjs +263 -263
- package/build/cjs/graphql-JJX5MZPQ.cjs.map +1 -1
- package/build/cjs/index.cjs +85 -66
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/public/internal.cjs +4 -4
- package/build/cjs/public/internal.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.cjs +64 -35
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +1 -1
- package/build/esm/internal/conversions/modernToLegacyGroupByClause.js +7 -0
- package/build/esm/internal/conversions/modernToLegacyGroupByClause.js.map +1 -1
- package/build/esm/object/AttachmentUpload.js +3 -0
- package/build/esm/object/AttachmentUpload.js.map +1 -1
- package/build/esm/object/aggregate.test.js +12 -2
- package/build/esm/object/aggregate.test.js.map +1 -1
- package/build/esm/observable/OptimisticBuilder.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/Store.test.js +2 -2
- package/build/esm/observable/internal/Store.test.js.map +1 -1
- package/build/esm/observable/internal/objectMatchesWhereClause.js +0 -2
- package/build/esm/observable/internal/objectMatchesWhereClause.js.map +1 -1
- package/build/esm/util/UserAgent.js +1 -1
- package/build/esm/util/toDataValue.js +10 -2
- package/build/esm/util/toDataValue.js.map +1 -1
- package/build/esm/util/toDataValueQueries.js +10 -2
- package/build/esm/util/toDataValueQueries.js.map +1 -1
- package/build/types/object/AttachmentUpload.d.ts +3 -0
- package/build/types/object/AttachmentUpload.d.ts.map +1 -1
- package/build/types/observable/OptimisticBuilder.d.ts +1 -1
- package/build/types/observable/OptimisticBuilder.d.ts.map +1 -1
- package/package.json +7 -7
- package/build/cjs/chunk-T5UE6BI7.cjs.map +0 -1
package/build/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk2FVV5A63_cjs = require('./chunk-2FVV5A63.cjs');
|
|
4
4
|
var chunkX7WGNFZ4_cjs = require('./chunk-X7WGNFZ4.cjs');
|
|
5
5
|
require('./chunk-Q7SFCCGT.cjs');
|
|
6
6
|
var api = require('@osdk/api');
|
|
@@ -55,7 +55,7 @@ function applyPageToken(payload, {
|
|
|
55
55
|
return pageToken ? {
|
|
56
56
|
...payload,
|
|
57
57
|
pageToken
|
|
58
|
-
} :
|
|
58
|
+
} : void 0;
|
|
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 === void 0 && fn !== void 0) {
|
|
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) : void 0;
|
|
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) : void 0;
|
|
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: void 0,
|
|
236
236
|
includeObjectTypesWithoutSearchableDatasources: true,
|
|
237
|
-
includeEntityMetadata:
|
|
237
|
+
includeEntityMetadata: void 0,
|
|
238
238
|
actionTypes: [],
|
|
239
|
-
includeTypeGroupEntitiesCount:
|
|
240
|
-
entityMetadata:
|
|
239
|
+
includeTypeGroupEntitiesCount: void 0,
|
|
240
|
+
entityMetadata: void 0
|
|
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, void 0, body);
|
|
243
|
+
!entities.objectTypes[0]?.objectType ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "object type should be loaded") : invariant__default.default(false) : void 0;
|
|
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) : void 0;
|
|
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) : void 0;
|
|
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: void 0,
|
|
295
295
|
objectSetFilterContext: {
|
|
296
296
|
parameterOverrides: {}
|
|
297
297
|
},
|
|
298
|
-
ontologyBranchRid:
|
|
299
|
-
owningRid:
|
|
300
|
-
reportUsage:
|
|
301
|
-
workstateRid:
|
|
298
|
+
ontologyBranchRid: void 0,
|
|
299
|
+
owningRid: void 0,
|
|
300
|
+
reportUsage: void 0,
|
|
301
|
+
workstateRid: void 0
|
|
302
302
|
},
|
|
303
303
|
responseOptions: {
|
|
304
304
|
includeObjectSetEntities: true,
|
|
305
305
|
includeUsageCost: false
|
|
306
306
|
},
|
|
307
307
|
pageSize: 1e3,
|
|
308
|
-
pageToken:
|
|
308
|
+
pageToken: void 0,
|
|
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(void 0, makeConjureContext(ctx, "object-set-service/api")), getResults, applyPageToken, req);
|
|
322
322
|
for await (const item of bulkLinksIter) {
|
|
323
323
|
const {
|
|
324
324
|
objectIdentifier
|
|
@@ -368,6 +368,9 @@ function getPrimaryKeyOrThrow(ref) {
|
|
|
368
368
|
function isAttachmentUpload(o) {
|
|
369
369
|
return typeof o === `object` && "name" in o && "data" in o && o.data instanceof Blob;
|
|
370
370
|
}
|
|
371
|
+
function isAttachmentFile(o) {
|
|
372
|
+
return typeof o === "object" && o instanceof Blob && "name" in o;
|
|
373
|
+
}
|
|
371
374
|
function createAttachmentUpload(data, name) {
|
|
372
375
|
return {
|
|
373
376
|
data,
|
|
@@ -401,6 +404,14 @@ async function toDataValue(value, client) {
|
|
|
401
404
|
return value;
|
|
402
405
|
}
|
|
403
406
|
if (Array.isArray(value) || value instanceof Set) {
|
|
407
|
+
const values = Array.from(value);
|
|
408
|
+
if (values.some((dataValue) => isAttachmentUpload(dataValue) || isAttachmentFile(dataValue))) {
|
|
409
|
+
const converted = [];
|
|
410
|
+
for (const value2 of values) {
|
|
411
|
+
converted.push(await toDataValue(value2, client));
|
|
412
|
+
}
|
|
413
|
+
return converted;
|
|
414
|
+
}
|
|
404
415
|
const promiseArray = Array.from(value, async (innerValue) => await toDataValue(innerValue, client));
|
|
405
416
|
return Promise.all(promiseArray);
|
|
406
417
|
}
|
|
@@ -410,7 +421,7 @@ async function toDataValue(value, client) {
|
|
|
410
421
|
});
|
|
411
422
|
return await toDataValue(attachment.rid, client);
|
|
412
423
|
}
|
|
413
|
-
if (
|
|
424
|
+
if (isAttachmentFile(value)) {
|
|
414
425
|
const attachment = await chunkX7WGNFZ4_cjs.Attachment_exports.upload(client, value, {
|
|
415
426
|
filename: value.name
|
|
416
427
|
});
|
|
@@ -422,11 +433,11 @@ async function toDataValue(value, client) {
|
|
|
422
433
|
if (isOsdkBaseObject(value)) {
|
|
423
434
|
return await toDataValue(value.$primaryKey, client);
|
|
424
435
|
}
|
|
425
|
-
if (
|
|
436
|
+
if (chunk2FVV5A63_cjs.isWireObjectSet(value)) {
|
|
426
437
|
return value;
|
|
427
438
|
}
|
|
428
|
-
if (
|
|
429
|
-
return
|
|
439
|
+
if (chunk2FVV5A63_cjs.isObjectSet(value)) {
|
|
440
|
+
return chunk2FVV5A63_cjs.getWireObjectSet(value);
|
|
430
441
|
}
|
|
431
442
|
if (isMediaReference(value)) {
|
|
432
443
|
return value;
|
|
@@ -449,7 +460,7 @@ async function toDataValue(value, client) {
|
|
|
449
460
|
|
|
450
461
|
// src/actions/applyAction.ts
|
|
451
462
|
async function applyAction(client, action, parameters, options = {}) {
|
|
452
|
-
const clientWithHeaders = chunkX7WGNFZ4_cjs.addUserAgentAndRequestContextHeaders(
|
|
463
|
+
const clientWithHeaders = chunkX7WGNFZ4_cjs.addUserAgentAndRequestContextHeaders(chunk2FVV5A63_cjs.augmentRequestContext(client, (_) => ({
|
|
453
464
|
finalMethodCall: "applyAction"
|
|
454
465
|
})), action);
|
|
455
466
|
if (Array.isArray(parameters)) {
|
|
@@ -460,7 +471,7 @@ async function applyAction(client, action, parameters, options = {}) {
|
|
|
460
471
|
}
|
|
461
472
|
});
|
|
462
473
|
const edits = response.edits;
|
|
463
|
-
return options?.$returnEdits ? edits?.type === "edits" ? remapActionResponse(response) : edits :
|
|
474
|
+
return options?.$returnEdits ? edits?.type === "edits" ? remapActionResponse(response) : edits : void 0;
|
|
464
475
|
} else {
|
|
465
476
|
const response = await chunkX7WGNFZ4_cjs.Action_exports.apply(clientWithHeaders, await client.ontologyRid, action.apiName, {
|
|
466
477
|
parameters: await remapActionParams(parameters, client),
|
|
@@ -476,7 +487,7 @@ async function applyAction(client, action, parameters, options = {}) {
|
|
|
476
487
|
throw new ActionValidationError(response.validation);
|
|
477
488
|
}
|
|
478
489
|
const edits = response.edits;
|
|
479
|
-
return options?.$returnEdits ? edits?.type === "edits" ? remapActionResponse(response) : edits :
|
|
490
|
+
return options?.$returnEdits ? edits?.type === "edits" ? remapActionResponse(response) : edits : void 0;
|
|
480
491
|
}
|
|
481
492
|
}
|
|
482
493
|
async function remapActionParams(params, client) {
|
|
@@ -760,7 +771,7 @@ var ClientRef = Symbol("ClientRef" );
|
|
|
760
771
|
|
|
761
772
|
// src/object/convertWireToOsdkObjects/createOsdkInterface.ts
|
|
762
773
|
function createOsdkInterface(underlying, interfaceDef) {
|
|
763
|
-
const [objApiNamespace] =
|
|
774
|
+
const [objApiNamespace] = chunk2FVV5A63_cjs.extractNamespace(interfaceDef.apiName);
|
|
764
775
|
return Object.freeze(Object.defineProperties({}, {
|
|
765
776
|
// first to minimize hidden classes
|
|
766
777
|
[UnderlyingOsdkObject]: {
|
|
@@ -795,7 +806,7 @@ function createOsdkInterface(underlying, interfaceDef) {
|
|
|
795
806
|
},
|
|
796
807
|
...Object.fromEntries(Object.keys(interfaceDef.properties).map((p) => {
|
|
797
808
|
const objDef = underlying[ObjectDefRef];
|
|
798
|
-
const [apiNamespace, apiName] =
|
|
809
|
+
const [apiNamespace, apiName] = chunk2FVV5A63_cjs.extractNamespace(p);
|
|
799
810
|
const targetPropName = objDef.interfaceMap[interfaceDef.apiName][p];
|
|
800
811
|
return [apiNamespace === objApiNamespace ? apiName : p, {
|
|
801
812
|
enumerable: targetPropName in underlying,
|
|
@@ -851,8 +862,8 @@ function get$link(holder) {
|
|
|
851
862
|
[objDef.primaryKeyApiName]: rawObj.$primaryKey
|
|
852
863
|
}).pivotTo(linkName);
|
|
853
864
|
const value = !linkDef.multiplicity ? {
|
|
854
|
-
fetchOne: (options) =>
|
|
855
|
-
fetchOneWithErrors: (options) =>
|
|
865
|
+
fetchOne: (options) => chunk2FVV5A63_cjs.fetchSingle(client, objDef, options ?? {}, chunk2FVV5A63_cjs.getWireObjectSet(objectSet)),
|
|
866
|
+
fetchOneWithErrors: (options) => chunk2FVV5A63_cjs.fetchSingleWithErrors(client, objDef, options ?? {}, chunk2FVV5A63_cjs.getWireObjectSet(objectSet))
|
|
856
867
|
} : objectSet;
|
|
857
868
|
return [linkName, value];
|
|
858
869
|
})));
|
|
@@ -921,7 +932,7 @@ function createSpecialProperty(client, objectDef, rawObject, p) {
|
|
|
921
932
|
const rawValue = rawObject[p];
|
|
922
933
|
const propDef = objectDef.properties[p];
|
|
923
934
|
if (process.env.NODE_ENV !== "production") {
|
|
924
|
-
!(propDef != null && typeof propDef.type === "string" && specialPropertyTypes.has(propDef.type)) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false) : invariant__default.default(false) :
|
|
935
|
+
!(propDef != null && typeof propDef.type === "string" && specialPropertyTypes.has(propDef.type)) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false) : invariant__default.default(false) : void 0;
|
|
925
936
|
}
|
|
926
937
|
{
|
|
927
938
|
{
|
|
@@ -929,9 +940,9 @@ function createSpecialProperty(client, objectDef, rawObject, p) {
|
|
|
929
940
|
{
|
|
930
941
|
if (propDef.type === "attachment") {
|
|
931
942
|
if (Array.isArray(rawValue)) {
|
|
932
|
-
return rawValue.map((a) =>
|
|
943
|
+
return rawValue.map((a) => chunk2FVV5A63_cjs.hydrateAttachmentFromRidInternal(client, a.rid));
|
|
933
944
|
}
|
|
934
|
-
return
|
|
945
|
+
return chunk2FVV5A63_cjs.hydrateAttachmentFromRidInternal(client, rawValue.rid);
|
|
935
946
|
}
|
|
936
947
|
if (propDef.type === "numericTimeseries" || propDef.type === "stringTimeseries" || propDef.type === "sensorTimeseries") {
|
|
937
948
|
return new TimeSeriesPropertyImpl(client, objectDef.apiName, rawObject[objectDef.primaryKeyApiName], p);
|
|
@@ -943,7 +954,7 @@ function createSpecialProperty(client, objectDef, rawObject, p) {
|
|
|
943
954
|
type: "Point",
|
|
944
955
|
coordinates: rawValue.position
|
|
945
956
|
}
|
|
946
|
-
} :
|
|
957
|
+
} : void 0);
|
|
947
958
|
}
|
|
948
959
|
if (propDef.type === "mediaReference") {
|
|
949
960
|
return new MediaReferencePropertyImpl({
|
|
@@ -963,12 +974,12 @@ function createSpecialProperty(client, objectDef, rawObject, p) {
|
|
|
963
974
|
async function convertWireToOsdkObjects(client, objects, interfaceApiName, forceRemoveRid = false, selectedProps, strictNonNull = false) {
|
|
964
975
|
client.logger?.debug(`START convertWireToOsdkObjects()`);
|
|
965
976
|
fixObjectPropertiesInPlace(objects, forceRemoveRid);
|
|
966
|
-
const ifaceDef = interfaceApiName ? await client.ontologyProvider.getInterfaceDefinition(interfaceApiName) :
|
|
967
|
-
const ifaceSelected = ifaceDef ? selectedProps ?? Object.keys(ifaceDef.properties) :
|
|
977
|
+
const ifaceDef = interfaceApiName ? await client.ontologyProvider.getInterfaceDefinition(interfaceApiName) : void 0;
|
|
978
|
+
const ifaceSelected = ifaceDef ? selectedProps ?? Object.keys(ifaceDef.properties) : void 0;
|
|
968
979
|
const ret = [];
|
|
969
980
|
for (const rawObj of objects) {
|
|
970
981
|
const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);
|
|
971
|
-
!objectDef ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Missing definition for '${rawObj.$apiName}'`) : invariant__default.default(false) :
|
|
982
|
+
!objectDef ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Missing definition for '${rawObj.$apiName}'`) : invariant__default.default(false) : void 0;
|
|
972
983
|
let objProps;
|
|
973
984
|
let conforming = true;
|
|
974
985
|
if (ifaceDef && ifaceSelected) {
|
|
@@ -998,11 +1009,11 @@ async function convertWireToOsdkObjects2(client, objects, interfaceApiName, forc
|
|
|
998
1009
|
const ret = [];
|
|
999
1010
|
for (const rawObj of objects) {
|
|
1000
1011
|
const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);
|
|
1001
|
-
!objectDef ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Missing definition for '${rawObj.$apiName}'`) : invariant__default.default(false) :
|
|
1002
|
-
const interfaceToObjMapping = interfaceApiName ? interfaceToObjectTypeMappings[interfaceApiName][rawObj.$apiName] :
|
|
1012
|
+
!objectDef ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Missing definition for '${rawObj.$apiName}'`) : invariant__default.default(false) : void 0;
|
|
1013
|
+
const interfaceToObjMapping = interfaceApiName ? interfaceToObjectTypeMappings[interfaceApiName][rawObj.$apiName] : void 0;
|
|
1003
1014
|
const ifaceSelected = interfaceApiName && interfaceToObjMapping ? selectedProps ? Object.keys(interfaceToObjMapping).filter((val) => {
|
|
1004
1015
|
selectedProps?.includes(interfaceToObjMapping[val]);
|
|
1005
|
-
}) : [...Object.values(interfaceToObjMapping), objectDef.primaryKeyApiName] :
|
|
1016
|
+
}) : [...Object.values(interfaceToObjMapping), objectDef.primaryKeyApiName] : void 0;
|
|
1006
1017
|
let objProps;
|
|
1007
1018
|
let conforming = true;
|
|
1008
1019
|
if (interfaceApiName && ifaceSelected) {
|
|
@@ -1033,7 +1044,7 @@ function reframeAsObjectInPlace(objectDef, interfaceApiName, rawObj) {
|
|
|
1033
1044
|
if (sptProp in rawObj) {
|
|
1034
1045
|
const value = rawObj[sptProp];
|
|
1035
1046
|
delete rawObj[sptProp];
|
|
1036
|
-
if (value !==
|
|
1047
|
+
if (value !== void 0) {
|
|
1037
1048
|
newProps[regularProp] = value;
|
|
1038
1049
|
}
|
|
1039
1050
|
}
|
|
@@ -1097,7 +1108,7 @@ function createClientCache(fn) {
|
|
|
1097
1108
|
cache.set(client.clientCacheKey, /* @__PURE__ */ new Map());
|
|
1098
1109
|
}
|
|
1099
1110
|
let r = cache.get(client.clientCacheKey).get(key);
|
|
1100
|
-
if (r ===
|
|
1111
|
+
if (r === void 0 && fn !== void 0) {
|
|
1101
1112
|
return set(client, key, fn(client, key));
|
|
1102
1113
|
} else {
|
|
1103
1114
|
return r;
|
|
@@ -1176,7 +1187,7 @@ var createStandardOntologyProviderFactory = (client) => {
|
|
|
1176
1187
|
let objectDef = await loadFullObjectMetadata(client3, key);
|
|
1177
1188
|
const interfaceDefs = Object.fromEntries((await Promise.all(objectDef.implements?.map((i) => ret.getInterfaceDefinition(i)) ?? [])).map((i) => [i.apiName, {
|
|
1178
1189
|
def: i,
|
|
1179
|
-
handler:
|
|
1190
|
+
handler: void 0
|
|
1180
1191
|
}]));
|
|
1181
1192
|
const fullObjectDef = {
|
|
1182
1193
|
...objectDef,
|
|
@@ -1212,10 +1223,10 @@ var createStandardOntologyProviderFactory = (client) => {
|
|
|
1212
1223
|
};
|
|
1213
1224
|
|
|
1214
1225
|
// src/util/UserAgent.ts
|
|
1215
|
-
var USER_AGENT = `osdk-client/${"2.2.0-beta.
|
|
1226
|
+
var USER_AGENT = `osdk-client/${"2.2.0-beta.6"}`;
|
|
1216
1227
|
|
|
1217
1228
|
// src/createMinimalClient.ts
|
|
1218
|
-
function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory =
|
|
1229
|
+
function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = chunk2FVV5A63_cjs.createObjectSet) {
|
|
1219
1230
|
if (process.env.NODE_ENV !== "production") {
|
|
1220
1231
|
try {
|
|
1221
1232
|
new URL(baseUrl);
|
|
@@ -1271,6 +1282,14 @@ async function toDataValueQueries(value, client, desiredType) {
|
|
|
1271
1282
|
return value;
|
|
1272
1283
|
}
|
|
1273
1284
|
if (Array.isArray(value) && desiredType.multiplicity) {
|
|
1285
|
+
const values = Array.from(value);
|
|
1286
|
+
if (values.some((dataValue) => isAttachmentUpload(dataValue) || isAttachmentFile(dataValue))) {
|
|
1287
|
+
const converted = [];
|
|
1288
|
+
for (const value2 of values) {
|
|
1289
|
+
converted.push(await toDataValueQueries(value2, client, desiredType));
|
|
1290
|
+
}
|
|
1291
|
+
return converted;
|
|
1292
|
+
}
|
|
1274
1293
|
const promiseArray = Array.from(value, async (innerValue) => await toDataValueQueries(innerValue, client, desiredType));
|
|
1275
1294
|
return Promise.all(promiseArray);
|
|
1276
1295
|
}
|
|
@@ -1282,7 +1301,7 @@ async function toDataValueQueries(value, client, desiredType) {
|
|
|
1282
1301
|
});
|
|
1283
1302
|
return attachment.rid;
|
|
1284
1303
|
}
|
|
1285
|
-
if (
|
|
1304
|
+
if (isAttachmentFile(value)) {
|
|
1286
1305
|
const attachment = await chunkX7WGNFZ4_cjs.Attachment_exports.upload(client, value, {
|
|
1287
1306
|
filename: value.name
|
|
1288
1307
|
});
|
|
@@ -1314,11 +1333,11 @@ async function toDataValueQueries(value, client, desiredType) {
|
|
|
1314
1333
|
break;
|
|
1315
1334
|
}
|
|
1316
1335
|
case "objectSet": {
|
|
1317
|
-
if (
|
|
1336
|
+
if (chunk2FVV5A63_cjs.isWireObjectSet(value)) {
|
|
1318
1337
|
return value;
|
|
1319
1338
|
}
|
|
1320
|
-
if (
|
|
1321
|
-
return
|
|
1339
|
+
if (chunk2FVV5A63_cjs.isObjectSet(value)) {
|
|
1340
|
+
return chunk2FVV5A63_cjs.getWireObjectSet(value);
|
|
1322
1341
|
}
|
|
1323
1342
|
break;
|
|
1324
1343
|
}
|
|
@@ -1347,7 +1366,7 @@ async function toDataValueQueries(value, client, desiredType) {
|
|
|
1347
1366
|
// src/queries/applyQuery.ts
|
|
1348
1367
|
async function applyQuery(client, query, params) {
|
|
1349
1368
|
const qd = await client.ontologyProvider.getQueryDefinition(query.apiName);
|
|
1350
|
-
const response = await chunkX7WGNFZ4_cjs.Query_exports.execute(chunkX7WGNFZ4_cjs.addUserAgentAndRequestContextHeaders(
|
|
1369
|
+
const response = await chunkX7WGNFZ4_cjs.Query_exports.execute(chunkX7WGNFZ4_cjs.addUserAgentAndRequestContextHeaders(chunk2FVV5A63_cjs.augmentRequestContext(client, (_) => ({
|
|
1351
1370
|
finalMethodCall: "applyQuery"
|
|
1352
1371
|
})), query), await client.ontologyRid, query.apiName, {
|
|
1353
1372
|
parameters: params ? await remapQueryParams(params, client, qd.parameters) : {}
|
|
@@ -1366,7 +1385,7 @@ async function remapQueryParams(params, client, paramTypes) {
|
|
|
1366
1385
|
async function remapQueryResponse(client, responseDataType, responseValue, definitions) {
|
|
1367
1386
|
if (responseValue == null) {
|
|
1368
1387
|
if (responseDataType.nullable) {
|
|
1369
|
-
return
|
|
1388
|
+
return void 0;
|
|
1370
1389
|
} else {
|
|
1371
1390
|
throw new Error("Got null response when nullable was not allowed");
|
|
1372
1391
|
}
|
|
@@ -1392,7 +1411,7 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
|
|
|
1392
1411
|
return responseValue;
|
|
1393
1412
|
}
|
|
1394
1413
|
case "attachment": {
|
|
1395
|
-
return
|
|
1414
|
+
return chunk2FVV5A63_cjs.hydrateAttachmentFromRidInternal(client, responseValue);
|
|
1396
1415
|
}
|
|
1397
1416
|
case "object": {
|
|
1398
1417
|
const def = definitions.get(responseDataType.object);
|
|
@@ -1407,7 +1426,7 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
|
|
|
1407
1426
|
throw new Error(`Missing definition for ${responseDataType.objectSet}`);
|
|
1408
1427
|
}
|
|
1409
1428
|
if (typeof responseValue === "string") {
|
|
1410
|
-
return
|
|
1429
|
+
return chunk2FVV5A63_cjs.createObjectSet(def, client, {
|
|
1411
1430
|
type: "intersect",
|
|
1412
1431
|
objectSets: [{
|
|
1413
1432
|
type: "base",
|
|
@@ -1418,7 +1437,7 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
|
|
|
1418
1437
|
}]
|
|
1419
1438
|
});
|
|
1420
1439
|
}
|
|
1421
|
-
return
|
|
1440
|
+
return chunk2FVV5A63_cjs.createObjectSet(def, client, responseValue);
|
|
1422
1441
|
}
|
|
1423
1442
|
case "struct": {
|
|
1424
1443
|
for (const [key, subtype] of Object.entries(responseDataType.struct)) {
|
|
@@ -1524,7 +1543,7 @@ function requiresConversion(dataType) {
|
|
|
1524
1543
|
function createQueryObjectResponse(primaryKey, objectDef) {
|
|
1525
1544
|
return {
|
|
1526
1545
|
$apiName: objectDef.apiName,
|
|
1527
|
-
$title:
|
|
1546
|
+
$title: void 0,
|
|
1528
1547
|
$objectType: objectDef.apiName,
|
|
1529
1548
|
$primaryKey: primaryKey
|
|
1530
1549
|
};
|
|
@@ -1533,16 +1552,16 @@ function createQueryObjectResponse(primaryKey, objectDef) {
|
|
|
1533
1552
|
// src/createClient.ts
|
|
1534
1553
|
var ActionInvoker = class {
|
|
1535
1554
|
constructor(clientCtx, actionDef) {
|
|
1536
|
-
this.applyAction = applyAction.bind(
|
|
1537
|
-
this.batchApplyAction = applyAction.bind(
|
|
1555
|
+
this.applyAction = applyAction.bind(void 0, clientCtx, actionDef);
|
|
1556
|
+
this.batchApplyAction = applyAction.bind(void 0, clientCtx, actionDef);
|
|
1538
1557
|
}
|
|
1539
1558
|
};
|
|
1540
1559
|
var QueryInvoker = class {
|
|
1541
1560
|
constructor(clientCtx, queryDef) {
|
|
1542
|
-
this.executeFunction = applyQuery.bind(
|
|
1561
|
+
this.executeFunction = applyQuery.bind(void 0, clientCtx, queryDef);
|
|
1543
1562
|
}
|
|
1544
1563
|
};
|
|
1545
|
-
function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvider, options =
|
|
1564
|
+
function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvider, options = void 0, fetchFn = fetch) {
|
|
1546
1565
|
if (typeof ontologyRid === "string") {
|
|
1547
1566
|
if (!ontologyRid.startsWith("ri.")) {
|
|
1548
1567
|
throw new Error("Invalid ontology RID");
|
|
@@ -1573,7 +1592,7 @@ function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvi
|
|
|
1573
1592
|
case unstable.__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid.name:
|
|
1574
1593
|
return {
|
|
1575
1594
|
fetchOneByRid: async (objectType, rid, options2) => {
|
|
1576
|
-
return await
|
|
1595
|
+
return await chunk2FVV5A63_cjs.fetchSingle(clientCtx, objectType, options2, createWithRid(rid));
|
|
1577
1596
|
}
|
|
1578
1597
|
};
|
|
1579
1598
|
case unstable.__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference.name:
|
|
@@ -1597,7 +1616,7 @@ function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvi
|
|
|
1597
1616
|
throw new Error("not implemented");
|
|
1598
1617
|
}
|
|
1599
1618
|
}
|
|
1600
|
-
const fetchMetadata = fetchMetadataInternal.bind(
|
|
1619
|
+
const fetchMetadata = fetchMetadataInternal.bind(void 0, clientCtx);
|
|
1601
1620
|
const symbolClientContext2 = "__osdkClientContext";
|
|
1602
1621
|
const client = Object.defineProperties(clientFn, {
|
|
1603
1622
|
[chunkX7WGNFZ4_cjs.symbolClientContext]: {
|
|
@@ -1615,7 +1634,7 @@ function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvi
|
|
|
1615
1634
|
});
|
|
1616
1635
|
return client;
|
|
1617
1636
|
}
|
|
1618
|
-
var createClient = createClientInternal.bind(
|
|
1637
|
+
var createClient = createClientInternal.bind(void 0, chunk2FVV5A63_cjs.createObjectSet);
|
|
1619
1638
|
function createWithRid(rid) {
|
|
1620
1639
|
const withRid = {
|
|
1621
1640
|
type: "static",
|
|
@@ -1623,13 +1642,13 @@ function createWithRid(rid) {
|
|
|
1623
1642
|
};
|
|
1624
1643
|
return withRid;
|
|
1625
1644
|
}
|
|
1626
|
-
function createPlatformClient(baseUrl, tokenProvider, options =
|
|
1645
|
+
function createPlatformClient(baseUrl, tokenProvider, options = void 0, fetchFn = fetch) {
|
|
1627
1646
|
return shared_client_impl.createSharedClientContext(baseUrl, tokenProvider, USER_AGENT, fetchFn);
|
|
1628
1647
|
}
|
|
1629
1648
|
var isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$/;
|
|
1630
1649
|
var extractDate = (dateTime) => {
|
|
1631
|
-
!(dateTime.length < 33) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "Invalid date format. Provided input is too long.") : invariant__default.default(false) :
|
|
1632
|
-
!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) :
|
|
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) : void 0;
|
|
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) : void 0;
|
|
1633
1652
|
return extractDateFromIsoString(dateTime);
|
|
1634
1653
|
};
|
|
1635
1654
|
var extractDateInUTC = (date) => {
|