@osdk/client 0.20.0-beta.2 → 0.20.0-beta.4
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 +47 -5
- package/build/browser/{chunk-Y6GMYWXB.js → chunk-3ZYIZQ7V.js} +348 -76
- package/build/browser/chunk-3ZYIZQ7V.js.map +1 -0
- package/build/browser/index.js +2 -2
- package/build/browser/public/unstable-do-not-use.js +10 -12
- package/build/browser/public/unstable-do-not-use.js.map +1 -1
- package/build/cjs/{chunk-VG5EKGOO.cjs → chunk-4FXEPHWC.cjs} +348 -76
- package/build/cjs/chunk-4FXEPHWC.cjs.map +1 -0
- package/build/cjs/index.cjs +5 -5
- package/build/cjs/public/unstable-do-not-use.cjs +15 -17
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/esm/Client.d.ts +3 -2
- package/build/esm/Client.d.ts.map +1 -1
- package/build/esm/MinimalClientContext.d.ts +8 -2
- package/build/esm/MinimalClientContext.d.ts.map +1 -1
- package/build/esm/{chunk-2XJ62QSF.js → chunk-MD6R46EZ.js} +348 -76
- package/build/esm/chunk-MD6R46EZ.js.map +1 -0
- package/build/esm/createClient.d.ts +2 -2
- package/build/esm/createClient.d.ts.map +1 -1
- package/build/esm/createMinimalClient.d.ts.map +1 -1
- package/build/esm/index.js +2 -2
- package/build/esm/object/Cache.d.ts +1 -1
- package/build/esm/object/Cache.d.ts.map +1 -1
- package/build/esm/object/SimpleCache.d.ts +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.d.ts.map +1 -1
- package/build/esm/objectSet/createObjectSet.d.ts.map +1 -1
- package/build/esm/ontology/loadFullObjectMetadata.d.ts +1 -1
- package/build/esm/ontology/loadFullObjectMetadata.d.ts.map +1 -1
- package/build/esm/ontology/loadInterfaceDefinition.d.ts +1 -1
- package/build/esm/ontology/loadInterfaceDefinition.d.ts.map +1 -1
- package/build/esm/public/unstable-do-not-use.js +10 -12
- package/build/esm/public/unstable-do-not-use.js.map +1 -1
- package/build/esm/queries/applyQuery.d.ts +6 -0
- package/build/esm/queries/applyQuery.d.ts.map +1 -0
- package/build/esm/queries/createQueryInvoker.d.ts +5 -0
- package/build/esm/queries/createQueryInvoker.d.ts.map +1 -0
- package/build/esm/queries/queries.test.d.ts +2 -0
- package/build/esm/queries/queries.test.d.ts.map +1 -0
- package/build/esm/util/isOsdkBaseObject.d.ts +3 -0
- package/build/esm/util/isOsdkBaseObject.d.ts.map +1 -0
- package/build/esm/util/isOsdkObject.d.ts +3 -0
- package/build/esm/util/isOsdkObject.d.ts.map +1 -0
- package/build/esm/util/toDataValue.d.ts.map +1 -1
- package/build/esm/util/toDataValueQueries.d.ts +10 -0
- package/build/esm/util/toDataValueQueries.d.ts.map +1 -0
- package/package.json +25 -18
- package/build/browser/chunk-Y6GMYWXB.js.map +0 -1
- package/build/cjs/chunk-VG5EKGOO.cjs.map +0 -1
- package/build/esm/chunk-2XJ62QSF.js.map +0 -1
|
@@ -18,14 +18,13 @@ var __export = (target, all) => {
|
|
|
18
18
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
// ../internal.foundry.datasets/build/esm/chunk-
|
|
21
|
+
// ../internal.foundry.datasets/build/esm/chunk-PZ5AY32C.js
|
|
22
22
|
var __defProp2 = Object.defineProperty;
|
|
23
23
|
var __export2 = (target, all) => {
|
|
24
|
-
for (var name in all)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
24
|
+
for (var name in all) __defProp2(target, name, {
|
|
25
|
+
get: all[name],
|
|
26
|
+
enumerable: true
|
|
27
|
+
});
|
|
29
28
|
};
|
|
30
29
|
async function foundryPlatformFetch(client, [httpMethodNum, origPath, flags, contentType, responseContentType], ...args) {
|
|
31
30
|
const path = origPath.replace(/\{([^}]+)\}/g, () => encodeURIComponent(args.shift()));
|
|
@@ -83,7 +82,7 @@ async function apiFetch(clientCtx, method, endpointPath, data, queryArguments, h
|
|
|
83
82
|
return response.blob();
|
|
84
83
|
}
|
|
85
84
|
|
|
86
|
-
// ../internal.foundry.datasets/build/esm/chunk-
|
|
85
|
+
// ../internal.foundry.datasets/build/esm/chunk-3STPFXHE.js
|
|
87
86
|
var Branch_exports = {};
|
|
88
87
|
__export2(Branch_exports, {
|
|
89
88
|
createBranch: () => createBranch,
|
|
@@ -108,7 +107,7 @@ function deleteBranch($ctx, ...args) {
|
|
|
108
107
|
return foundryPlatformFetch($ctx, _deleteBranch, ...args);
|
|
109
108
|
}
|
|
110
109
|
|
|
111
|
-
// ../internal.foundry.datasets/build/esm/chunk-
|
|
110
|
+
// ../internal.foundry.datasets/build/esm/chunk-5ZK5IVCS.js
|
|
112
111
|
var Dataset_exports = {};
|
|
113
112
|
__export2(Dataset_exports, {
|
|
114
113
|
createDataset: () => createDataset,
|
|
@@ -143,7 +142,7 @@ function deleteSchema($ctx, ...args) {
|
|
|
143
142
|
return foundryPlatformFetch($ctx, _deleteSchema, ...args);
|
|
144
143
|
}
|
|
145
144
|
|
|
146
|
-
// ../internal.foundry.datasets/build/esm/chunk-
|
|
145
|
+
// ../internal.foundry.datasets/build/esm/chunk-N55YZHZU.js
|
|
147
146
|
var File_exports = {};
|
|
148
147
|
__export2(File_exports, {
|
|
149
148
|
deleteFile: () => deleteFile,
|
|
@@ -173,7 +172,7 @@ function getFileContent($ctx, ...args) {
|
|
|
173
172
|
return foundryPlatformFetch($ctx, _getFileContent, ...args);
|
|
174
173
|
}
|
|
175
174
|
|
|
176
|
-
// ../internal.foundry.datasets/build/esm/chunk-
|
|
175
|
+
// ../internal.foundry.datasets/build/esm/chunk-267TDC7H.js
|
|
177
176
|
var Transaction_exports = {};
|
|
178
177
|
__export2(Transaction_exports, {
|
|
179
178
|
abortTransaction: () => abortTransaction,
|
|
@@ -198,14 +197,13 @@ function abortTransaction($ctx, ...args) {
|
|
|
198
197
|
return foundryPlatformFetch($ctx, _abortTransaction, ...args);
|
|
199
198
|
}
|
|
200
199
|
|
|
201
|
-
// ../internal.foundry.models/build/esm/chunk-
|
|
200
|
+
// ../internal.foundry.models/build/esm/chunk-IOTKXOZ6.js
|
|
202
201
|
var __defProp3 = Object.defineProperty;
|
|
203
202
|
var __export3 = (target, all) => {
|
|
204
|
-
for (var name in all)
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
});
|
|
203
|
+
for (var name in all) __defProp3(target, name, {
|
|
204
|
+
get: all[name],
|
|
205
|
+
enumerable: true
|
|
206
|
+
});
|
|
209
207
|
};
|
|
210
208
|
var LanguageModel_exports = {};
|
|
211
209
|
__export3(LanguageModel_exports, {
|
|
@@ -237,17 +235,16 @@ __export(esm_exports, {
|
|
|
237
235
|
QueryTypes: () => QueryType_exports
|
|
238
236
|
});
|
|
239
237
|
|
|
240
|
-
// ../internal.foundry.ontologies/build/esm/chunk-
|
|
238
|
+
// ../internal.foundry.ontologies/build/esm/chunk-PZ5AY32C.js
|
|
241
239
|
var __defProp4 = Object.defineProperty;
|
|
242
240
|
var __export4 = (target, all) => {
|
|
243
|
-
for (var name in all)
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
});
|
|
241
|
+
for (var name in all) __defProp4(target, name, {
|
|
242
|
+
get: all[name],
|
|
243
|
+
enumerable: true
|
|
244
|
+
});
|
|
248
245
|
};
|
|
249
246
|
|
|
250
|
-
// ../internal.foundry.ontologies/build/esm/chunk-
|
|
247
|
+
// ../internal.foundry.ontologies/build/esm/chunk-LTUKKONO.js
|
|
251
248
|
var ActionType_exports = {};
|
|
252
249
|
__export4(ActionType_exports, {
|
|
253
250
|
applyAction: () => applyAction,
|
|
@@ -287,7 +284,7 @@ function validateAction($ctx, ...args) {
|
|
|
287
284
|
return foundryPlatformFetch($ctx, _validateAction, ...args);
|
|
288
285
|
}
|
|
289
286
|
|
|
290
|
-
// ../internal.foundry.ontologies/build/esm/chunk-
|
|
287
|
+
// ../internal.foundry.ontologies/build/esm/chunk-67IRYQ4I.js
|
|
291
288
|
var Attachment_exports = {};
|
|
292
289
|
__export4(Attachment_exports, {
|
|
293
290
|
getAttachment: () => getAttachment,
|
|
@@ -307,7 +304,7 @@ function getAttachment($ctx, ...args) {
|
|
|
307
304
|
return foundryPlatformFetch($ctx, _getAttachment, ...args);
|
|
308
305
|
}
|
|
309
306
|
|
|
310
|
-
// ../internal.foundry.ontologies/build/esm/chunk-
|
|
307
|
+
// ../internal.foundry.ontologies/build/esm/chunk-JDBI2K4S.js
|
|
311
308
|
var ObjectType_exports = {};
|
|
312
309
|
__export4(ObjectType_exports, {
|
|
313
310
|
getObjectType: () => getObjectType,
|
|
@@ -332,7 +329,7 @@ function getOutgoingLinkType($ctx, ...args) {
|
|
|
332
329
|
return foundryPlatformFetch($ctx, _getOutgoingLinkType, ...args);
|
|
333
330
|
}
|
|
334
331
|
|
|
335
|
-
// ../internal.foundry.ontologies/build/esm/chunk-
|
|
332
|
+
// ../internal.foundry.ontologies/build/esm/chunk-6OWDPN5M.js
|
|
336
333
|
var Ontology_exports = {};
|
|
337
334
|
__export4(Ontology_exports, {
|
|
338
335
|
getOntology: () => getOntology,
|
|
@@ -347,7 +344,7 @@ function getOntology($ctx, ...args) {
|
|
|
347
344
|
return foundryPlatformFetch($ctx, _getOntology, ...args);
|
|
348
345
|
}
|
|
349
346
|
|
|
350
|
-
// ../internal.foundry.ontologies/build/esm/chunk-
|
|
347
|
+
// ../internal.foundry.ontologies/build/esm/chunk-M2AD7ARN.js
|
|
351
348
|
var OntologyObject_exports = {};
|
|
352
349
|
__export4(OntologyObject_exports, {
|
|
353
350
|
aggregateObjects: () => aggregateObjects,
|
|
@@ -382,7 +379,7 @@ function aggregateObjects($ctx, ...args) {
|
|
|
382
379
|
return foundryPlatformFetch($ctx, _aggregateObjects, ...args);
|
|
383
380
|
}
|
|
384
381
|
|
|
385
|
-
// ../internal.foundry.ontologies/build/esm/chunk-
|
|
382
|
+
// ../internal.foundry.ontologies/build/esm/chunk-CBKBUZ63.js
|
|
386
383
|
var QueryType_exports = {};
|
|
387
384
|
__export4(QueryType_exports, {
|
|
388
385
|
executeQuery: () => executeQuery,
|
|
@@ -414,17 +411,16 @@ __export(esm_exports2, {
|
|
|
414
411
|
QueryTypes: () => QueryType_exports2
|
|
415
412
|
});
|
|
416
413
|
|
|
417
|
-
// ../internal.foundry.ontologiesv2/build/esm/chunk-
|
|
414
|
+
// ../internal.foundry.ontologiesv2/build/esm/chunk-PZ5AY32C.js
|
|
418
415
|
var __defProp5 = Object.defineProperty;
|
|
419
416
|
var __export5 = (target, all) => {
|
|
420
|
-
for (var name in all)
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
});
|
|
417
|
+
for (var name in all) __defProp5(target, name, {
|
|
418
|
+
get: all[name],
|
|
419
|
+
enumerable: true
|
|
420
|
+
});
|
|
425
421
|
};
|
|
426
422
|
|
|
427
|
-
// ../internal.foundry.ontologiesv2/build/esm/chunk-
|
|
423
|
+
// ../internal.foundry.ontologiesv2/build/esm/chunk-B5JRDCDE.js
|
|
428
424
|
var Action_exports = {};
|
|
429
425
|
__export5(Action_exports, {
|
|
430
426
|
applyActionAsyncV2: () => applyActionAsyncV2,
|
|
@@ -444,7 +440,7 @@ function applyActionAsyncV2($ctx, ...args) {
|
|
|
444
440
|
return foundryPlatformFetch($ctx, _applyActionAsyncV2, ...args);
|
|
445
441
|
}
|
|
446
442
|
|
|
447
|
-
// ../internal.foundry.ontologiesv2/build/esm/chunk-
|
|
443
|
+
// ../internal.foundry.ontologiesv2/build/esm/chunk-G4A4IJCI.js
|
|
448
444
|
var ActionTypeV2_exports = {};
|
|
449
445
|
__export5(ActionTypeV2_exports, {
|
|
450
446
|
getActionTypeV2: () => getActionTypeV2,
|
|
@@ -459,7 +455,7 @@ function getActionTypeV2($ctx, ...args) {
|
|
|
459
455
|
return foundryPlatformFetch($ctx, _getActionTypeV2, ...args);
|
|
460
456
|
}
|
|
461
457
|
|
|
462
|
-
// ../internal.foundry.ontologiesv2/build/esm/chunk-
|
|
458
|
+
// ../internal.foundry.ontologiesv2/build/esm/chunk-6LZM4EP4.js
|
|
463
459
|
var ObjectTypeV2_exports = {};
|
|
464
460
|
__export5(ObjectTypeV2_exports, {
|
|
465
461
|
getObjectTypeV2: () => getObjectTypeV2,
|
|
@@ -484,7 +480,7 @@ function getOutgoingLinkTypeV2($ctx, ...args) {
|
|
|
484
480
|
return foundryPlatformFetch($ctx, _getOutgoingLinkTypeV2, ...args);
|
|
485
481
|
}
|
|
486
482
|
|
|
487
|
-
// ../internal.foundry.ontologiesv2/build/esm/chunk-
|
|
483
|
+
// ../internal.foundry.ontologiesv2/build/esm/chunk-TJX6RHXS.js
|
|
488
484
|
var OntologyObjectSet_exports = {};
|
|
489
485
|
__export5(OntologyObjectSet_exports, {
|
|
490
486
|
aggregateObjectSetV2: () => aggregateObjectSetV2,
|
|
@@ -509,7 +505,7 @@ function aggregateObjectSetV2($ctx, ...args) {
|
|
|
509
505
|
return foundryPlatformFetch($ctx, _aggregateObjectSetV2, ...args);
|
|
510
506
|
}
|
|
511
507
|
|
|
512
|
-
// ../internal.foundry.ontologiesv2/build/esm/chunk-
|
|
508
|
+
// ../internal.foundry.ontologiesv2/build/esm/chunk-U2YDEYVP.js
|
|
513
509
|
var OntologyObjectV2_exports = {};
|
|
514
510
|
__export5(OntologyObjectV2_exports, {
|
|
515
511
|
aggregateObjectsForInterface: () => aggregateObjectsForInterface,
|
|
@@ -609,7 +605,7 @@ function getObjectTypeFullMetadata($ctx, ...args) {
|
|
|
609
605
|
return foundryPlatformFetch($ctx, _getObjectTypeFullMetadata, ...args);
|
|
610
606
|
}
|
|
611
607
|
|
|
612
|
-
// ../internal.foundry.ontologiesv2/build/esm/chunk-
|
|
608
|
+
// ../internal.foundry.ontologiesv2/build/esm/chunk-5MBQRC34.js
|
|
613
609
|
var OntologyV2_exports = {};
|
|
614
610
|
__export5(OntologyV2_exports, {
|
|
615
611
|
getOntologyFullMetadata: () => getOntologyFullMetadata,
|
|
@@ -629,7 +625,7 @@ function getOntologyFullMetadata($ctx, ...args) {
|
|
|
629
625
|
return foundryPlatformFetch($ctx, _getOntologyFullMetadata, ...args);
|
|
630
626
|
}
|
|
631
627
|
|
|
632
|
-
// ../internal.foundry.ontologiesv2/build/esm/chunk-
|
|
628
|
+
// ../internal.foundry.ontologiesv2/build/esm/chunk-ASYINYCV.js
|
|
633
629
|
var QueryType_exports2 = {};
|
|
634
630
|
__export5(QueryType_exports2, {
|
|
635
631
|
executeQueryV2: () => executeQueryV2,
|
|
@@ -678,10 +674,10 @@ function addUserAgent(client, withMetadata) {
|
|
|
678
674
|
function createClientCache(fn) {
|
|
679
675
|
const cache = /* @__PURE__ */ new WeakMap();
|
|
680
676
|
function get(client, key) {
|
|
681
|
-
if (cache.get(client) == null) {
|
|
682
|
-
cache.set(client, /* @__PURE__ */ new Map());
|
|
677
|
+
if (cache.get(client.clientCacheKey) == null) {
|
|
678
|
+
cache.set(client.clientCacheKey, /* @__PURE__ */ new Map());
|
|
683
679
|
}
|
|
684
|
-
let r = cache.get(client).get(key);
|
|
680
|
+
let r = cache.get(client.clientCacheKey).get(key);
|
|
685
681
|
if (r === void 0 && fn !== void 0) {
|
|
686
682
|
return set(client, key, fn(client, key));
|
|
687
683
|
} else {
|
|
@@ -689,16 +685,15 @@ function createClientCache(fn) {
|
|
|
689
685
|
}
|
|
690
686
|
}
|
|
691
687
|
function set(client, key, value) {
|
|
692
|
-
if (cache.get(client) == null) {
|
|
693
|
-
cache.set(client, /* @__PURE__ */ new Map());
|
|
688
|
+
if (cache.get(client.clientCacheKey) == null) {
|
|
689
|
+
cache.set(client.clientCacheKey, /* @__PURE__ */ new Map());
|
|
694
690
|
}
|
|
695
|
-
cache.get(client).set(key, value);
|
|
691
|
+
cache.get(client.clientCacheKey).set(key, value);
|
|
696
692
|
return value;
|
|
697
693
|
}
|
|
698
694
|
function remove(client, key) {
|
|
699
|
-
if (cache.get(client) == null)
|
|
700
|
-
|
|
701
|
-
return cache.get(client).delete(key);
|
|
695
|
+
if (cache.get(client.clientCacheKey) == null) return false;
|
|
696
|
+
return cache.get(client.clientCacheKey).delete(key);
|
|
702
697
|
}
|
|
703
698
|
return {
|
|
704
699
|
get,
|
|
@@ -803,8 +798,7 @@ function customInspect(_depth, options, localInspect) {
|
|
|
803
798
|
let ret = `Osdk<${options.stylize(this[ObjectDefRef]?.apiName ?? this[InterfaceDefRef]?.apiName, "special")}> {
|
|
804
799
|
`;
|
|
805
800
|
for (const k of /* @__PURE__ */ new Set(["$apiName", "$objectType", "$primaryKey", ...Reflect.ownKeys(this)])) {
|
|
806
|
-
if (typeof k === "symbol")
|
|
807
|
-
continue;
|
|
801
|
+
if (typeof k === "symbol") continue;
|
|
808
802
|
ret += ` ${options.stylize(k.toString(), "undefined")}: ${localInspect(this[k], newOptions)}
|
|
809
803
|
`;
|
|
810
804
|
}
|
|
@@ -911,8 +905,7 @@ function $asFactory(objDef) {
|
|
|
911
905
|
}
|
|
912
906
|
const underlying = this[UnderlyingOsdkObject];
|
|
913
907
|
const existing = osdkObjectToInterfaceView.get(underlying).get(newDef.apiName);
|
|
914
|
-
if (existing)
|
|
915
|
-
return existing;
|
|
908
|
+
if (existing) return existing;
|
|
916
909
|
const osdkInterface = createOsdkInterface(underlying, newDef);
|
|
917
910
|
osdkObjectToInterfaceView.get(underlying).set(newDef.apiName, osdkInterface);
|
|
918
911
|
return osdkInterface;
|
|
@@ -1080,8 +1073,7 @@ function modernToLegacyAggregationClause(select) {
|
|
|
1080
1073
|
});
|
|
1081
1074
|
}
|
|
1082
1075
|
function modernToLegacyGroupByClause(groupByClause) {
|
|
1083
|
-
if (!groupByClause)
|
|
1084
|
-
return [];
|
|
1076
|
+
if (!groupByClause) return [];
|
|
1085
1077
|
return Object.entries(groupByClause).flatMap(([field, type]) => {
|
|
1086
1078
|
if (type === "exact") {
|
|
1087
1079
|
return [{
|
|
@@ -1115,8 +1107,7 @@ function modernToLegacyGroupByClause(groupByClause) {
|
|
|
1115
1107
|
value: type.$duration[0],
|
|
1116
1108
|
unit: client_api.DurationMapping[type.$duration[1]]
|
|
1117
1109
|
}];
|
|
1118
|
-
} else
|
|
1119
|
-
return [];
|
|
1110
|
+
} else return [];
|
|
1120
1111
|
});
|
|
1121
1112
|
}
|
|
1122
1113
|
function convertRange(range) {
|
|
@@ -1142,7 +1133,7 @@ async function aggregate(clientCtx, objectType, objectSet = {
|
|
|
1142
1133
|
if (req.$where) {
|
|
1143
1134
|
body.where = modernToLegacyWhereClause(req.$where);
|
|
1144
1135
|
}
|
|
1145
|
-
const result = await esm_exports2.OntologyObjectSets.aggregateObjectSetV2(addUserAgent(clientCtx, objectType), clientCtx.ontologyRid, {
|
|
1136
|
+
const result = await esm_exports2.OntologyObjectSets.aggregateObjectSetV2(addUserAgent(clientCtx, objectType), await clientCtx.ontologyRid, {
|
|
1146
1137
|
objectSet,
|
|
1147
1138
|
groupBy: body.groupBy,
|
|
1148
1139
|
aggregation: body.aggregation
|
|
@@ -1259,6 +1250,7 @@ function createObjectSet(objectType, clientCtx, objectSet = {
|
|
|
1259
1250
|
const result = await base.fetchPage({
|
|
1260
1251
|
$nextPageToken
|
|
1261
1252
|
});
|
|
1253
|
+
$nextPageToken = result.nextPageToken;
|
|
1262
1254
|
for (const obj of result.data) {
|
|
1263
1255
|
yield obj;
|
|
1264
1256
|
}
|
|
@@ -1386,8 +1378,7 @@ function createOsdkObject(client, objectDef, rawObj) {
|
|
|
1386
1378
|
case UnderlyingOsdkObject:
|
|
1387
1379
|
return receiver;
|
|
1388
1380
|
}
|
|
1389
|
-
if (p in target)
|
|
1390
|
-
return target[p];
|
|
1381
|
+
if (p in target) return target[p];
|
|
1391
1382
|
if (p in rawObj) {
|
|
1392
1383
|
const rawValue = target[RawObject][p];
|
|
1393
1384
|
const propDef = objectDef.properties[p];
|
|
@@ -1454,8 +1445,7 @@ async function convertWireToOsdkObjects(client, objects, interfaceApiName, force
|
|
|
1454
1445
|
continue;
|
|
1455
1446
|
}
|
|
1456
1447
|
let osdkObject = createOsdkObject(client, objectDef, rawObj);
|
|
1457
|
-
if (interfaceApiName)
|
|
1458
|
-
osdkObject = osdkObject.$as(interfaceApiName);
|
|
1448
|
+
if (interfaceApiName) osdkObject = osdkObject.$as(interfaceApiName);
|
|
1459
1449
|
ret.push(osdkObject);
|
|
1460
1450
|
}
|
|
1461
1451
|
client.logger?.debug(`END convertWireToOsdkObjects()`);
|
|
@@ -1548,7 +1538,7 @@ function objectSetToSearchJsonV2(objectSet, expectedApiName, existingWhere = voi
|
|
|
1548
1538
|
throw new Error(`Unsupported objectSet type: ${objectSet.type}`);
|
|
1549
1539
|
}
|
|
1550
1540
|
async function fetchInterfacePage(client, interfaceType, args, objectSet) {
|
|
1551
|
-
const result = await esm_exports2.OntologyObjectsV2.searchObjectsForInterface(addUserAgent(client, interfaceType), client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {
|
|
1541
|
+
const result = await esm_exports2.OntologyObjectsV2.searchObjectsForInterface(addUserAgent(client, interfaceType), await client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {
|
|
1552
1542
|
augmentedProperties: args.$augment ?? {},
|
|
1553
1543
|
augmentedSharedPropertyTypes: {},
|
|
1554
1544
|
otherInterfaceTypes: [],
|
|
@@ -1615,9 +1605,9 @@ function applyFetchArgs(args, body) {
|
|
|
1615
1605
|
return body;
|
|
1616
1606
|
}
|
|
1617
1607
|
async function fetchObjectPage(client, objectType, args, objectSet) {
|
|
1618
|
-
const r = await esm_exports2.OntologyObjectSets.loadObjectSetV2(addUserAgent(client, objectType), client.ontologyRid, applyFetchArgs(args, {
|
|
1608
|
+
const r = await esm_exports2.OntologyObjectSets.loadObjectSetV2(addUserAgent(client, objectType), await client.ontologyRid, applyFetchArgs(args, {
|
|
1619
1609
|
objectSet,
|
|
1620
|
-
// We have to do the following case because LoadObjectSetRequestV2
|
|
1610
|
+
// We have to do the following case because LoadObjectSetRequestV2 isn't readonly
|
|
1621
1611
|
select: args?.$select ?? [],
|
|
1622
1612
|
// FIXME?
|
|
1623
1613
|
excludeRid: !args?.$includeRid
|
|
@@ -1646,6 +1636,11 @@ function isOntologyObjectV2(o) {
|
|
|
1646
1636
|
return o && typeof o === "object" && typeof o.__apiName === "string" && o.__primaryKey != null;
|
|
1647
1637
|
}
|
|
1648
1638
|
|
|
1639
|
+
// src/util/isOsdkObject.ts
|
|
1640
|
+
function isOsdkBaseObject(o) {
|
|
1641
|
+
return o && typeof o === "object" && typeof o.$apiName === "string" && o.$primaryKey != null;
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1649
1644
|
// src/util/toDataValue.ts
|
|
1650
1645
|
async function toDataValue(value, client) {
|
|
1651
1646
|
if (value == null) {
|
|
@@ -1667,6 +1662,9 @@ async function toDataValue(value, client) {
|
|
|
1667
1662
|
if (isOntologyObjectV2(value)) {
|
|
1668
1663
|
return await toDataValue(value.__primaryKey, client);
|
|
1669
1664
|
}
|
|
1665
|
+
if (isOsdkBaseObject(value)) {
|
|
1666
|
+
return await toDataValue(value.$primaryKey, client);
|
|
1667
|
+
}
|
|
1670
1668
|
if (isWireObjectSet(value)) {
|
|
1671
1669
|
return value;
|
|
1672
1670
|
}
|
|
@@ -1686,7 +1684,7 @@ async function toDataValue(value, client) {
|
|
|
1686
1684
|
// src/actions/applyAction.ts
|
|
1687
1685
|
async function applyAction2(client, action, parameters, options = {}) {
|
|
1688
1686
|
if (Array.isArray(parameters)) {
|
|
1689
|
-
const response = await esm_exports2.Actions.applyActionBatchV2(addUserAgent(client, action), client.ontologyRid, action.apiName, {
|
|
1687
|
+
const response = await esm_exports2.Actions.applyActionBatchV2(addUserAgent(client, action), await client.ontologyRid, action.apiName, {
|
|
1690
1688
|
requests: parameters ? await remapBatchActionParams(parameters, client) : [],
|
|
1691
1689
|
options: {
|
|
1692
1690
|
returnEdits: options?.$returnEdits ? "ALL" : "NONE"
|
|
@@ -1694,7 +1692,7 @@ async function applyAction2(client, action, parameters, options = {}) {
|
|
|
1694
1692
|
});
|
|
1695
1693
|
return options?.$returnEdits ? response.edits : void 0;
|
|
1696
1694
|
} else {
|
|
1697
|
-
const response = await esm_exports2.Actions.applyActionV2(addUserAgent(client, action), client.ontologyRid, action.apiName, {
|
|
1695
|
+
const response = await esm_exports2.Actions.applyActionV2(addUserAgent(client, action), await client.ontologyRid, action.apiName, {
|
|
1698
1696
|
parameters: await remapActionParams(parameters, client),
|
|
1699
1697
|
options: {
|
|
1700
1698
|
mode: options?.$validateOnly ? "VALIDATE_ONLY" : "VALIDATE_AND_EXECUTE",
|
|
@@ -1728,19 +1726,19 @@ async function remapBatchActionParams(params, client) {
|
|
|
1728
1726
|
}));
|
|
1729
1727
|
return remappedParams;
|
|
1730
1728
|
}
|
|
1731
|
-
async function loadFullObjectMetadata(client,
|
|
1732
|
-
const full = await esm_exports2.OntologyObjectsV2.getObjectTypeFullMetadata(client, client.ontologyRid,
|
|
1729
|
+
async function loadFullObjectMetadata(client, objectType) {
|
|
1730
|
+
const full = await esm_exports2.OntologyObjectsV2.getObjectTypeFullMetadata(client, await client.ontologyRid, objectType, {
|
|
1733
1731
|
preview: true
|
|
1734
1732
|
});
|
|
1735
1733
|
const ret = generatorConverters.wireObjectTypeFullMetadataToSdkObjectTypeDefinition(full, true);
|
|
1736
|
-
client.logger?.debug(`END loadFullObjectMetadata(${
|
|
1734
|
+
client.logger?.debug(`END loadFullObjectMetadata(${objectType})`);
|
|
1737
1735
|
return {
|
|
1738
1736
|
...ret,
|
|
1739
1737
|
rid: full.objectType.rid
|
|
1740
1738
|
};
|
|
1741
1739
|
}
|
|
1742
|
-
async function loadInterfaceDefinition(client,
|
|
1743
|
-
const r = await esm_exports2.OntologyObjectsV2.getInterfaceType(client, client.ontologyRid,
|
|
1740
|
+
async function loadInterfaceDefinition(client, objectType) {
|
|
1741
|
+
const r = await esm_exports2.OntologyObjectsV2.getInterfaceType(client, await client.ontologyRid, objectType, {
|
|
1744
1742
|
preview: true
|
|
1745
1743
|
});
|
|
1746
1744
|
return generatorConverters.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(r, true);
|
|
@@ -1781,7 +1779,7 @@ var createStandardOntologyProviderFactory = (client) => {
|
|
|
1781
1779
|
};
|
|
1782
1780
|
|
|
1783
1781
|
// src/util/UserAgent.ts
|
|
1784
|
-
var USER_AGENT = `osdk-client/${"0.20.0-beta.
|
|
1782
|
+
var USER_AGENT = `osdk-client/${"0.20.0-beta.4"}`;
|
|
1785
1783
|
|
|
1786
1784
|
// src/createMinimalClient.ts
|
|
1787
1785
|
function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {
|
|
@@ -1797,13 +1795,285 @@ function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fet
|
|
|
1797
1795
|
...shared_client_impl.createSharedClientContext(baseUrl, tokenProvider, USER_AGENT, fetchFn),
|
|
1798
1796
|
objectSetFactory,
|
|
1799
1797
|
ontologyRid: metadata.ontologyRid,
|
|
1800
|
-
logger: options.logger
|
|
1798
|
+
logger: options.logger,
|
|
1799
|
+
clientCacheKey: {}
|
|
1801
1800
|
};
|
|
1802
1801
|
return Object.assign(minimalClient, {
|
|
1803
1802
|
ontologyProvider: createStandardOntologyProviderFactory()(minimalClient)
|
|
1804
1803
|
});
|
|
1805
1804
|
}
|
|
1806
1805
|
|
|
1806
|
+
// src/util/isOsdkBaseObject.ts
|
|
1807
|
+
function isOsdkBaseObject2(o) {
|
|
1808
|
+
return o && typeof o === "object" && typeof o.$apiName === "string" && o.$primaryKey != null;
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
// src/util/toDataValueQueries.ts
|
|
1812
|
+
async function toDataValueQueries(value, client, desiredType) {
|
|
1813
|
+
if (value == null) {
|
|
1814
|
+
return value;
|
|
1815
|
+
}
|
|
1816
|
+
if (Array.isArray(value) && desiredType.multiplicity) {
|
|
1817
|
+
const promiseArray = Array.from(value, async (innerValue) => await toDataValueQueries(innerValue, client, desiredType));
|
|
1818
|
+
return Promise.all(promiseArray);
|
|
1819
|
+
}
|
|
1820
|
+
switch (desiredType.type) {
|
|
1821
|
+
case "attachment": {
|
|
1822
|
+
if (isAttachmentUpload(value)) {
|
|
1823
|
+
const attachment = await esm_exports.Attachments.uploadAttachment(client, value, {
|
|
1824
|
+
filename: value.name
|
|
1825
|
+
}, {
|
|
1826
|
+
"Content-Length": value.size.toString(),
|
|
1827
|
+
"Content-Type": value.type
|
|
1828
|
+
});
|
|
1829
|
+
return attachment.rid;
|
|
1830
|
+
}
|
|
1831
|
+
return value;
|
|
1832
|
+
}
|
|
1833
|
+
case "twoDimensionalAggregation": {
|
|
1834
|
+
return {
|
|
1835
|
+
groups: value
|
|
1836
|
+
};
|
|
1837
|
+
}
|
|
1838
|
+
case "threeDimensionalAggregation": {
|
|
1839
|
+
return {
|
|
1840
|
+
groups: value
|
|
1841
|
+
};
|
|
1842
|
+
}
|
|
1843
|
+
case "set": {
|
|
1844
|
+
if (value instanceof Set) {
|
|
1845
|
+
const promiseArray = Array.from(value, async (innerValue) => await toDataValueQueries(innerValue, client, desiredType["set"]));
|
|
1846
|
+
return Promise.all(promiseArray);
|
|
1847
|
+
}
|
|
1848
|
+
break;
|
|
1849
|
+
}
|
|
1850
|
+
case "object": {
|
|
1851
|
+
if (isOsdkBaseObject2(value)) {
|
|
1852
|
+
return value.$primaryKey;
|
|
1853
|
+
}
|
|
1854
|
+
break;
|
|
1855
|
+
}
|
|
1856
|
+
case "objectSet": {
|
|
1857
|
+
if (isWireObjectSet(value)) {
|
|
1858
|
+
return value;
|
|
1859
|
+
}
|
|
1860
|
+
if (isObjectSet(value)) {
|
|
1861
|
+
return getWireObjectSet(value);
|
|
1862
|
+
}
|
|
1863
|
+
break;
|
|
1864
|
+
}
|
|
1865
|
+
case "struct": {
|
|
1866
|
+
if (typeof value === "object") {
|
|
1867
|
+
const structMap = {};
|
|
1868
|
+
for (const [key, structValue] of Object.entries(value)) {
|
|
1869
|
+
structMap[key] = await toDataValueQueries(structValue, client, desiredType["struct"][key]);
|
|
1870
|
+
}
|
|
1871
|
+
return structMap;
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
case "boolean":
|
|
1875
|
+
case "date":
|
|
1876
|
+
case "double":
|
|
1877
|
+
case "float":
|
|
1878
|
+
case "integer":
|
|
1879
|
+
case "long":
|
|
1880
|
+
case "string":
|
|
1881
|
+
case "timestamp":
|
|
1882
|
+
return value;
|
|
1883
|
+
}
|
|
1884
|
+
return value;
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
// src/queries/applyQuery.ts
|
|
1888
|
+
async function applyQuery(client, query, params) {
|
|
1889
|
+
const response = await esm_exports2.QueryTypes.executeQueryV2(addUserAgent(client, query), await client.ontologyRid, query.apiName, {
|
|
1890
|
+
parameters: params ? await remapQueryParams(params, client, query.parameters) : {}
|
|
1891
|
+
});
|
|
1892
|
+
const objectOutputDefs = await getRequiredDefinitions(query.output, client);
|
|
1893
|
+
const remappedResponse = await remapQueryResponse(client, query.output, response.value, objectOutputDefs);
|
|
1894
|
+
return remappedResponse;
|
|
1895
|
+
}
|
|
1896
|
+
async function remapQueryParams(params, client, paramTypes) {
|
|
1897
|
+
const parameterMap = {};
|
|
1898
|
+
for (const [key, value] of Object.entries(params)) {
|
|
1899
|
+
parameterMap[key] = await toDataValueQueries(value, client, paramTypes[key]);
|
|
1900
|
+
}
|
|
1901
|
+
return parameterMap;
|
|
1902
|
+
}
|
|
1903
|
+
async function remapQueryResponse(client, responseDataType, responseValue, definitions) {
|
|
1904
|
+
if (responseValue == null) {
|
|
1905
|
+
if (responseDataType.nullable) {
|
|
1906
|
+
return void 0;
|
|
1907
|
+
} else {
|
|
1908
|
+
throw new Error("Got null response when nullable was not allowed");
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
if (responseDataType.multiplicity != null && responseDataType.multiplicity !== false) {
|
|
1912
|
+
const withoutMultiplicity = {
|
|
1913
|
+
...responseDataType,
|
|
1914
|
+
multiplicity: false
|
|
1915
|
+
};
|
|
1916
|
+
for (let i = 0; i < responseValue.length; i++) {
|
|
1917
|
+
responseValue[i] = await remapQueryResponse(responseValue[i], withoutMultiplicity, client, definitions);
|
|
1918
|
+
}
|
|
1919
|
+
return responseValue;
|
|
1920
|
+
}
|
|
1921
|
+
switch (responseDataType.type) {
|
|
1922
|
+
case "union": {
|
|
1923
|
+
throw new Error("Union return types are not yet supported");
|
|
1924
|
+
}
|
|
1925
|
+
case "set": {
|
|
1926
|
+
for (let i = 0; i < responseValue.length; i++) {
|
|
1927
|
+
responseValue[i] = await remapQueryResponse(responseValue[i], responseDataType.set, client, definitions);
|
|
1928
|
+
}
|
|
1929
|
+
return responseValue;
|
|
1930
|
+
}
|
|
1931
|
+
case "attachment": {
|
|
1932
|
+
return createAttachmentFromRid(client, responseValue);
|
|
1933
|
+
}
|
|
1934
|
+
case "object": {
|
|
1935
|
+
const def = definitions.get(responseDataType.object);
|
|
1936
|
+
if (!def) {
|
|
1937
|
+
throw new Error(`Missing definition for ${responseDataType.object}`);
|
|
1938
|
+
}
|
|
1939
|
+
return createQueryObjectResponse(responseValue, def);
|
|
1940
|
+
}
|
|
1941
|
+
case "objectSet": {
|
|
1942
|
+
const def = definitions.get(responseDataType.objectSet);
|
|
1943
|
+
if (!def) {
|
|
1944
|
+
throw new Error(`Missing definition for ${responseDataType.objectSet}`);
|
|
1945
|
+
}
|
|
1946
|
+
if (typeof responseValue === "string") {
|
|
1947
|
+
return createObjectSet(def, client, {
|
|
1948
|
+
type: "intersect",
|
|
1949
|
+
objectSets: [{
|
|
1950
|
+
type: "base",
|
|
1951
|
+
objectType: responseDataType.objectSet
|
|
1952
|
+
}, {
|
|
1953
|
+
type: "reference",
|
|
1954
|
+
reference: responseValue
|
|
1955
|
+
}]
|
|
1956
|
+
});
|
|
1957
|
+
}
|
|
1958
|
+
return createObjectSet(def, client, responseValue);
|
|
1959
|
+
}
|
|
1960
|
+
case "struct": {
|
|
1961
|
+
for (const [key, subtype] of Object.entries(responseDataType.struct)) {
|
|
1962
|
+
if (requiresConversion(subtype)) {
|
|
1963
|
+
responseValue[key] = await remapQueryResponse(responseValue[key], subtype, client, definitions);
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
return responseValue;
|
|
1967
|
+
}
|
|
1968
|
+
case "twoDimensionalAggregation": {
|
|
1969
|
+
const result = [];
|
|
1970
|
+
for (const {
|
|
1971
|
+
key,
|
|
1972
|
+
value
|
|
1973
|
+
} of responseValue.groups) {
|
|
1974
|
+
result.push({
|
|
1975
|
+
key,
|
|
1976
|
+
value
|
|
1977
|
+
});
|
|
1978
|
+
}
|
|
1979
|
+
return result;
|
|
1980
|
+
}
|
|
1981
|
+
case "threeDimensionalAggregation": {
|
|
1982
|
+
const result = [];
|
|
1983
|
+
for (const {
|
|
1984
|
+
key,
|
|
1985
|
+
groups
|
|
1986
|
+
} of responseValue.groups) {
|
|
1987
|
+
const subResult = [];
|
|
1988
|
+
for (const {
|
|
1989
|
+
key: subKey,
|
|
1990
|
+
value
|
|
1991
|
+
} of groups) {
|
|
1992
|
+
subResult.push({
|
|
1993
|
+
key: subKey,
|
|
1994
|
+
value
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
1997
|
+
result.push({
|
|
1998
|
+
key,
|
|
1999
|
+
groups: subResult
|
|
2000
|
+
});
|
|
2001
|
+
}
|
|
2002
|
+
return result;
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
return responseValue;
|
|
2006
|
+
}
|
|
2007
|
+
async function getRequiredDefinitions(dataType, client) {
|
|
2008
|
+
const result = /* @__PURE__ */ new Map();
|
|
2009
|
+
switch (dataType.type) {
|
|
2010
|
+
case "objectSet": {
|
|
2011
|
+
const objectDef = await client.ontologyProvider.getObjectDefinition(dataType.objectSet);
|
|
2012
|
+
result.set(dataType.objectSet, objectDef);
|
|
2013
|
+
break;
|
|
2014
|
+
}
|
|
2015
|
+
case "object": {
|
|
2016
|
+
const objectDef = await client.ontologyProvider.getObjectDefinition(dataType.object);
|
|
2017
|
+
result.set(dataType.object, objectDef);
|
|
2018
|
+
break;
|
|
2019
|
+
}
|
|
2020
|
+
case "set": {
|
|
2021
|
+
return getRequiredDefinitions(dataType.set, client);
|
|
2022
|
+
}
|
|
2023
|
+
case "struct": {
|
|
2024
|
+
for (const value of Object.values(dataType.struct)) {
|
|
2025
|
+
for (const [type, objectDef] of await getRequiredDefinitions(value, client)) {
|
|
2026
|
+
result.set(type, objectDef);
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
break;
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
return result;
|
|
2033
|
+
}
|
|
2034
|
+
function requiresConversion(dataType) {
|
|
2035
|
+
switch (dataType.type) {
|
|
2036
|
+
case "boolean":
|
|
2037
|
+
case "date":
|
|
2038
|
+
case "double":
|
|
2039
|
+
case "float":
|
|
2040
|
+
case "integer":
|
|
2041
|
+
case "long":
|
|
2042
|
+
case "object":
|
|
2043
|
+
case "string":
|
|
2044
|
+
case "timestamp":
|
|
2045
|
+
return false;
|
|
2046
|
+
case "union":
|
|
2047
|
+
return true;
|
|
2048
|
+
case "struct":
|
|
2049
|
+
return Object.values(dataType.struct).some(requiresConversion);
|
|
2050
|
+
case "set":
|
|
2051
|
+
return requiresConversion(dataType.set);
|
|
2052
|
+
case "attachment":
|
|
2053
|
+
case "objectSet":
|
|
2054
|
+
case "twoDimensionalAggregation":
|
|
2055
|
+
case "threeDimensionalAggregation":
|
|
2056
|
+
return true;
|
|
2057
|
+
default:
|
|
2058
|
+
return false;
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2061
|
+
function createQueryObjectResponse(primaryKey, objectDef) {
|
|
2062
|
+
return {
|
|
2063
|
+
$apiName: objectDef.apiName,
|
|
2064
|
+
$title: void 0,
|
|
2065
|
+
$objectType: objectDef.apiName,
|
|
2066
|
+
$primaryKey: primaryKey
|
|
2067
|
+
};
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
// src/queries/createQueryInvoker.ts
|
|
2071
|
+
function createQueryInvoker(client, query) {
|
|
2072
|
+
return function(...args) {
|
|
2073
|
+
return applyQuery(client, query, ...args);
|
|
2074
|
+
};
|
|
2075
|
+
}
|
|
2076
|
+
|
|
1807
2077
|
// src/createClient.ts
|
|
1808
2078
|
var ActionInvoker = class {
|
|
1809
2079
|
constructor(clientCtx, actionDef) {
|
|
@@ -1821,6 +2091,8 @@ function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvi
|
|
|
1821
2091
|
} else if (o.type === "action") {
|
|
1822
2092
|
clientCtx.ontologyProvider.maybeSeed(o);
|
|
1823
2093
|
return new ActionInvoker(clientCtx, o);
|
|
2094
|
+
} else if (o.type === "query") {
|
|
2095
|
+
return createQueryInvoker(clientCtx, o);
|
|
1824
2096
|
} else {
|
|
1825
2097
|
throw new Error("not implemented");
|
|
1826
2098
|
}
|
|
@@ -1845,4 +2117,4 @@ exports.createObjectSet = createObjectSet;
|
|
|
1845
2117
|
exports.createSimpleAsyncCache = createSimpleAsyncCache;
|
|
1846
2118
|
exports.esm_exports = esm_exports2;
|
|
1847
2119
|
//# sourceMappingURL=out.js.map
|
|
1848
|
-
//# sourceMappingURL=chunk-
|
|
2120
|
+
//# sourceMappingURL=chunk-4FXEPHWC.cjs.map
|