@osdk/client 0.20.0-beta.4 → 0.20.0
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 +62 -0
- package/build/{esm/chunk-MD6R46EZ.js → browser/chunk-T5DZREKX.js} +270 -107
- package/build/browser/chunk-T5DZREKX.js.map +1 -0
- package/build/browser/index.js +4 -8
- package/build/browser/index.js.map +1 -1
- package/build/browser/public/unstable-do-not-use.js +2 -2
- package/build/cjs/{chunk-4FXEPHWC.cjs → chunk-VW7XYOFL.cjs} +269 -105
- package/build/cjs/chunk-VW7XYOFL.cjs.map +1 -0
- package/build/cjs/index.cjs +14 -11
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.cjs +8 -8
- package/build/esm/MinimalClientContext.d.ts +4 -0
- package/build/esm/MinimalClientContext.d.ts.map +1 -1
- package/build/esm/__unstable/UnstableClient.d.ts +1 -1
- package/build/esm/__unstable/UnstableClient.d.ts.map +1 -1
- package/build/esm/actions/applyAction.d.ts.map +1 -1
- package/build/{browser/chunk-3ZYIZQ7V.js → esm/chunk-T5DZREKX.js} +270 -104
- package/build/esm/chunk-T5DZREKX.js.map +1 -0
- package/build/esm/createMinimalClient.d.ts.map +1 -1
- package/build/esm/createPlatformClient.d.ts +4 -1
- package/build/esm/createPlatformClient.d.ts.map +1 -1
- package/build/esm/createTimeseriesProperty.d.ts +4 -0
- package/build/esm/createTimeseriesProperty.d.ts.map +1 -0
- package/build/esm/index.d.ts +6 -4
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +4 -8
- package/build/esm/index.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.d.ts.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.d.ts.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.d.ts.map +1 -1
- package/build/esm/object/fetchPage.d.ts.map +1 -1
- package/build/esm/object/timeseries.test.d.ts +2 -0
- package/build/esm/object/timeseries.test.d.ts.map +1 -0
- package/build/esm/objectSet/createObjectSet.d.ts.map +1 -1
- package/build/esm/ontology/OntologyProvider.d.ts +1 -1
- package/build/esm/ontology/OntologyProvider.d.ts.map +1 -1
- package/build/esm/public/unstable-do-not-use.js +2 -2
- package/build/esm/queries/applyQuery.d.ts.map +1 -1
- package/build/esm/util/addUserAgentAndRequestContextHeaders.d.ts +4 -0
- package/build/esm/util/addUserAgentAndRequestContextHeaders.d.ts.map +1 -0
- package/build/esm/util/augmentRequestContext.d.ts +32 -0
- package/build/esm/util/augmentRequestContext.d.ts.map +1 -0
- package/build/esm/util/streamutils.d.ts +3 -0
- package/build/esm/util/streamutils.d.ts.map +1 -0
- package/package.json +13 -13
- package/build/browser/chunk-3ZYIZQ7V.js.map +0 -1
- package/build/cjs/chunk-4FXEPHWC.cjs.map +0 -1
- package/build/esm/chunk-MD6R46EZ.js.map +0 -1
- package/build/esm/util/addUserAgent.d.ts +0 -4
- package/build/esm/util/addUserAgent.d.ts.map +0 -1
|
@@ -18,6 +18,14 @@ var __export = (target, all) => {
|
|
|
18
18
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
// src/actions/ActionValidationError.ts
|
|
22
|
+
var ActionValidationError = class extends Error {
|
|
23
|
+
constructor(validation) {
|
|
24
|
+
super("Validation Error");
|
|
25
|
+
this.validation = validation;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
21
29
|
// ../internal.foundry.datasets/build/esm/chunk-PZ5AY32C.js
|
|
22
30
|
var __defProp2 = Object.defineProperty;
|
|
23
31
|
var __export2 = (target, all) => {
|
|
@@ -404,6 +412,7 @@ var esm_exports2 = {};
|
|
|
404
412
|
__export(esm_exports2, {
|
|
405
413
|
ActionTypesV2: () => ActionTypeV2_exports,
|
|
406
414
|
Actions: () => Action_exports,
|
|
415
|
+
Attachments: () => Attachment_exports2,
|
|
407
416
|
ObjectTypesV2: () => ObjectTypeV2_exports,
|
|
408
417
|
OntologiesV2: () => OntologyV2_exports,
|
|
409
418
|
OntologyObjectSets: () => OntologyObjectSet_exports,
|
|
@@ -420,6 +429,26 @@ var __export5 = (target, all) => {
|
|
|
420
429
|
});
|
|
421
430
|
};
|
|
422
431
|
|
|
432
|
+
// ../internal.foundry.ontologiesv2/build/esm/chunk-ASYINYCV.js
|
|
433
|
+
var QueryType_exports2 = {};
|
|
434
|
+
__export5(QueryType_exports2, {
|
|
435
|
+
executeQueryV2: () => executeQueryV2,
|
|
436
|
+
getQueryTypeV2: () => getQueryTypeV2,
|
|
437
|
+
listQueryTypesV2: () => listQueryTypesV2
|
|
438
|
+
});
|
|
439
|
+
var _listQueryTypesV2 = [0, "/v2/ontologies/{0}/queryTypes", 2];
|
|
440
|
+
function listQueryTypesV2($ctx, ...args) {
|
|
441
|
+
return foundryPlatformFetch($ctx, _listQueryTypesV2, ...args);
|
|
442
|
+
}
|
|
443
|
+
var _getQueryTypeV2 = [0, "/v2/ontologies/{0}/queryTypes/{1}"];
|
|
444
|
+
function getQueryTypeV2($ctx, ...args) {
|
|
445
|
+
return foundryPlatformFetch($ctx, _getQueryTypeV2, ...args);
|
|
446
|
+
}
|
|
447
|
+
var _executeQueryV2 = [1, "/v2/ontologies/{0}/queries/{1}/execute", 3];
|
|
448
|
+
function executeQueryV2($ctx, ...args) {
|
|
449
|
+
return foundryPlatformFetch($ctx, _executeQueryV2, ...args);
|
|
450
|
+
}
|
|
451
|
+
|
|
423
452
|
// ../internal.foundry.ontologiesv2/build/esm/chunk-B5JRDCDE.js
|
|
424
453
|
var Action_exports = {};
|
|
425
454
|
__export5(Action_exports, {
|
|
@@ -455,6 +484,26 @@ function getActionTypeV2($ctx, ...args) {
|
|
|
455
484
|
return foundryPlatformFetch($ctx, _getActionTypeV2, ...args);
|
|
456
485
|
}
|
|
457
486
|
|
|
487
|
+
// ../internal.foundry.ontologiesv2/build/esm/chunk-YGTQQ5D7.js
|
|
488
|
+
var Attachment_exports2 = {};
|
|
489
|
+
__export5(Attachment_exports2, {
|
|
490
|
+
getAttachmentContentV2: () => getAttachmentContentV2,
|
|
491
|
+
getAttachmentV2: () => getAttachmentV2,
|
|
492
|
+
uploadAttachmentV2: () => uploadAttachmentV2
|
|
493
|
+
});
|
|
494
|
+
var _uploadAttachmentV2 = [1, "/v2/ontologies/attachments/upload", 7, "*/*"];
|
|
495
|
+
function uploadAttachmentV2($ctx, ...args) {
|
|
496
|
+
return foundryPlatformFetch($ctx, _uploadAttachmentV2, ...args);
|
|
497
|
+
}
|
|
498
|
+
var _getAttachmentContentV2 = [0, "/v2/ontologies/attachments/{0}/content", , , "*/*"];
|
|
499
|
+
function getAttachmentContentV2($ctx, ...args) {
|
|
500
|
+
return foundryPlatformFetch($ctx, _getAttachmentContentV2, ...args);
|
|
501
|
+
}
|
|
502
|
+
var _getAttachmentV2 = [0, "/v2/ontologies/attachments/{0}"];
|
|
503
|
+
function getAttachmentV2($ctx, ...args) {
|
|
504
|
+
return foundryPlatformFetch($ctx, _getAttachmentV2, ...args);
|
|
505
|
+
}
|
|
506
|
+
|
|
458
507
|
// ../internal.foundry.ontologiesv2/build/esm/chunk-6LZM4EP4.js
|
|
459
508
|
var ObjectTypeV2_exports = {};
|
|
460
509
|
__export5(ObjectTypeV2_exports, {
|
|
@@ -505,16 +554,15 @@ function aggregateObjectSetV2($ctx, ...args) {
|
|
|
505
554
|
return foundryPlatformFetch($ctx, _aggregateObjectSetV2, ...args);
|
|
506
555
|
}
|
|
507
556
|
|
|
508
|
-
// ../internal.foundry.ontologiesv2/build/esm/chunk-
|
|
557
|
+
// ../internal.foundry.ontologiesv2/build/esm/chunk-KYMDEQ65.js
|
|
509
558
|
var OntologyObjectV2_exports = {};
|
|
510
559
|
__export5(OntologyObjectV2_exports, {
|
|
511
560
|
aggregateObjectsForInterface: () => aggregateObjectsForInterface,
|
|
512
561
|
aggregateObjectsV2: () => aggregateObjectsV2,
|
|
513
562
|
countObjects: () => countObjects,
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
getAttachmentsV2: () => getAttachmentsV2,
|
|
563
|
+
getAttachmentPropertyByRidV2: () => getAttachmentPropertyByRidV2,
|
|
564
|
+
getAttachmentPropertyContentByRidV2: () => getAttachmentPropertyContentByRidV2,
|
|
565
|
+
getAttachmentPropertyContentV2: () => getAttachmentPropertyContentV2,
|
|
518
566
|
getFirstPoint: () => getFirstPoint,
|
|
519
567
|
getInterfaceType: () => getInterfaceType,
|
|
520
568
|
getLastPoint: () => getLastPoint,
|
|
@@ -524,6 +572,7 @@ __export5(OntologyObjectV2_exports, {
|
|
|
524
572
|
listInterfaceTypes: () => listInterfaceTypes,
|
|
525
573
|
listLinkedObjectsV2: () => listLinkedObjectsV2,
|
|
526
574
|
listObjectsV2: () => listObjectsV2,
|
|
575
|
+
listPropertyAttachments: () => listPropertyAttachments,
|
|
527
576
|
searchObjectsForInterface: () => searchObjectsForInterface,
|
|
528
577
|
searchObjectsV2: () => searchObjectsV2,
|
|
529
578
|
streamPoints: () => streamPoints
|
|
@@ -572,21 +621,21 @@ var _getLinkedObjectV2 = [0, "/v2/ontologies/{0}/objects/{1}/{2}/links/{3}/{4}",
|
|
|
572
621
|
function getLinkedObjectV2($ctx, ...args) {
|
|
573
622
|
return foundryPlatformFetch($ctx, _getLinkedObjectV2, ...args);
|
|
574
623
|
}
|
|
575
|
-
var
|
|
576
|
-
function
|
|
577
|
-
return foundryPlatformFetch($ctx,
|
|
624
|
+
var _listPropertyAttachments = [0, "/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}", 2];
|
|
625
|
+
function listPropertyAttachments($ctx, ...args) {
|
|
626
|
+
return foundryPlatformFetch($ctx, _listPropertyAttachments, ...args);
|
|
578
627
|
}
|
|
579
|
-
var
|
|
580
|
-
function
|
|
581
|
-
return foundryPlatformFetch($ctx,
|
|
628
|
+
var _getAttachmentPropertyByRidV2 = [0, "/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}/{4}", 2];
|
|
629
|
+
function getAttachmentPropertyByRidV2($ctx, ...args) {
|
|
630
|
+
return foundryPlatformFetch($ctx, _getAttachmentPropertyByRidV2, ...args);
|
|
582
631
|
}
|
|
583
|
-
var
|
|
584
|
-
function
|
|
585
|
-
return foundryPlatformFetch($ctx,
|
|
632
|
+
var _getAttachmentPropertyContentV2 = [0, "/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}/content", 2, , "*/*"];
|
|
633
|
+
function getAttachmentPropertyContentV2($ctx, ...args) {
|
|
634
|
+
return foundryPlatformFetch($ctx, _getAttachmentPropertyContentV2, ...args);
|
|
586
635
|
}
|
|
587
|
-
var
|
|
588
|
-
function
|
|
589
|
-
return foundryPlatformFetch($ctx,
|
|
636
|
+
var _getAttachmentPropertyContentByRidV2 = [0, "/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}/{4}/content", 2, , "*/*"];
|
|
637
|
+
function getAttachmentPropertyContentByRidV2($ctx, ...args) {
|
|
638
|
+
return foundryPlatformFetch($ctx, _getAttachmentPropertyContentByRidV2, ...args);
|
|
590
639
|
}
|
|
591
640
|
var _getFirstPoint = [0, "/v2/ontologies/{0}/objects/{1}/{2}/timeseries/{3}/firstPoint", 2];
|
|
592
641
|
function getFirstPoint($ctx, ...args) {
|
|
@@ -625,26 +674,6 @@ function getOntologyFullMetadata($ctx, ...args) {
|
|
|
625
674
|
return foundryPlatformFetch($ctx, _getOntologyFullMetadata, ...args);
|
|
626
675
|
}
|
|
627
676
|
|
|
628
|
-
// ../internal.foundry.ontologiesv2/build/esm/chunk-ASYINYCV.js
|
|
629
|
-
var QueryType_exports2 = {};
|
|
630
|
-
__export5(QueryType_exports2, {
|
|
631
|
-
executeQueryV2: () => executeQueryV2,
|
|
632
|
-
getQueryTypeV2: () => getQueryTypeV2,
|
|
633
|
-
listQueryTypesV2: () => listQueryTypesV2
|
|
634
|
-
});
|
|
635
|
-
var _listQueryTypesV2 = [0, "/v2/ontologies/{0}/queryTypes", 2];
|
|
636
|
-
function listQueryTypesV2($ctx, ...args) {
|
|
637
|
-
return foundryPlatformFetch($ctx, _listQueryTypesV2, ...args);
|
|
638
|
-
}
|
|
639
|
-
var _getQueryTypeV2 = [0, "/v2/ontologies/{0}/queryTypes/{1}"];
|
|
640
|
-
function getQueryTypeV2($ctx, ...args) {
|
|
641
|
-
return foundryPlatformFetch($ctx, _getQueryTypeV2, ...args);
|
|
642
|
-
}
|
|
643
|
-
var _executeQueryV2 = [1, "/v2/ontologies/{0}/queries/{1}/execute", 3];
|
|
644
|
-
function executeQueryV2($ctx, ...args) {
|
|
645
|
-
return foundryPlatformFetch($ctx, _executeQueryV2, ...args);
|
|
646
|
-
}
|
|
647
|
-
|
|
648
677
|
// src/createAttachmentFromRid.ts
|
|
649
678
|
function createAttachmentFromRid(client, rid) {
|
|
650
679
|
return {
|
|
@@ -657,17 +686,165 @@ function createAttachmentFromRid(client, rid) {
|
|
|
657
686
|
}
|
|
658
687
|
};
|
|
659
688
|
}
|
|
660
|
-
|
|
661
|
-
|
|
689
|
+
|
|
690
|
+
// src/object/AttachmentUpload.ts
|
|
691
|
+
function isAttachmentUpload(o) {
|
|
692
|
+
return o instanceof Blob && "name" in o;
|
|
693
|
+
}
|
|
694
|
+
function createAttachmentUpload(data, name) {
|
|
695
|
+
const attachmentUpload = Object.create(data, {
|
|
696
|
+
name: {
|
|
697
|
+
value: name
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
return attachmentUpload;
|
|
701
|
+
}
|
|
702
|
+
var addUserAgentAndRequestContextHeaders = (client, withMetadata) => ({
|
|
703
|
+
...client,
|
|
704
|
+
fetch: shared_net_fetch.createFetchHeaderMutator(client.fetch, (headers) => {
|
|
705
|
+
headers.set("X-OSDK-Request-Context", JSON.stringify(client.requestContext));
|
|
706
|
+
if (withMetadata.osdkMetadata) {
|
|
707
|
+
headers.set("Fetch-User-Agent", withMetadata.osdkMetadata.extraUserAgent);
|
|
708
|
+
}
|
|
709
|
+
return headers;
|
|
710
|
+
})
|
|
711
|
+
});
|
|
712
|
+
|
|
713
|
+
// src/util/streamutils.ts
|
|
714
|
+
var START_TOKEN = new Uint8Array([123, 34, 100, 97, 116, 97, 34, 58, 91]);
|
|
715
|
+
var OBJECT_OPEN_CHAR_CODE = 123;
|
|
716
|
+
var OBJECT_CLOSE_CHAR_CODE = 125;
|
|
717
|
+
async function* parseStreamedResponse(asyncIterable) {
|
|
718
|
+
const utf8decoder = new TextDecoder("utf-8");
|
|
719
|
+
let parsedStart = false;
|
|
720
|
+
let prevChunks = [];
|
|
721
|
+
let openBracesCount = 0;
|
|
722
|
+
for await (let chunk of asyncIterable) {
|
|
723
|
+
let i = 0;
|
|
724
|
+
if (!parsedStart) {
|
|
725
|
+
parsedStart = true;
|
|
726
|
+
if (startsWith(chunk, START_TOKEN)) {
|
|
727
|
+
i = START_TOKEN.length;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
for (; i < chunk.length; i++) {
|
|
731
|
+
while (openBracesCount === 0 && chunk[i] !== OBJECT_OPEN_CHAR_CODE && i < chunk.length) {
|
|
732
|
+
i++;
|
|
733
|
+
}
|
|
734
|
+
let j = i;
|
|
735
|
+
for (; j < chunk.length; j++) {
|
|
736
|
+
const c = chunk[j];
|
|
737
|
+
if (c === OBJECT_OPEN_CHAR_CODE) {
|
|
738
|
+
openBracesCount++;
|
|
739
|
+
} else if (c === OBJECT_CLOSE_CHAR_CODE) {
|
|
740
|
+
openBracesCount--;
|
|
741
|
+
if (0 === openBracesCount) {
|
|
742
|
+
yield combineAndParse(utf8decoder, prevChunks, chunk.subarray(i, j + 1));
|
|
743
|
+
prevChunks = [];
|
|
744
|
+
i = j;
|
|
745
|
+
break;
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
if (j === chunk.length) {
|
|
750
|
+
prevChunks.push(chunk.subarray(i));
|
|
751
|
+
break;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
function startsWith(a, b) {
|
|
757
|
+
if (a.length < b.length) {
|
|
758
|
+
return false;
|
|
759
|
+
}
|
|
760
|
+
for (let i = 0; i < b.length; i++) {
|
|
761
|
+
if (a[i] !== b[i]) {
|
|
762
|
+
return false;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
return true;
|
|
766
|
+
}
|
|
767
|
+
function combineAndParse(utf8decoder, prev, curr) {
|
|
768
|
+
let str = "";
|
|
769
|
+
for (const chunk of prev) {
|
|
770
|
+
str += utf8decoder.decode(chunk, {
|
|
771
|
+
stream: true
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
str += utf8decoder.decode(curr);
|
|
775
|
+
return JSON.parse(str);
|
|
776
|
+
}
|
|
777
|
+
async function* iterateReadableStream(readableStream) {
|
|
778
|
+
let res = await readableStream.read();
|
|
779
|
+
while (!res.done) {
|
|
780
|
+
yield res.value;
|
|
781
|
+
res = await readableStream.read();
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
// src/createTimeseriesProperty.ts
|
|
786
|
+
function createTimeseriesProperty(client, objectApiName, primaryKey, propertyName) {
|
|
787
|
+
return {
|
|
788
|
+
async getFirstPoint() {
|
|
789
|
+
return esm_exports2.OntologyObjectsV2.getFirstPoint(client, await client.ontologyRid, objectApiName, primaryKey, propertyName);
|
|
790
|
+
},
|
|
791
|
+
async getLastPoint() {
|
|
792
|
+
return esm_exports2.OntologyObjectsV2.getLastPoint(client, await client.ontologyRid, objectApiName, primaryKey, propertyName);
|
|
793
|
+
},
|
|
794
|
+
async getAllPoints(query) {
|
|
795
|
+
return getAllTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, query);
|
|
796
|
+
},
|
|
797
|
+
asyncIterPoints(query) {
|
|
798
|
+
return iterateTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, query);
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
async function getAllTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, body) {
|
|
803
|
+
const allPoints = [];
|
|
804
|
+
for await (const point of iterateTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, body)) {
|
|
805
|
+
allPoints.push({
|
|
806
|
+
time: point.time,
|
|
807
|
+
value: point.value
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
return allPoints;
|
|
811
|
+
}
|
|
812
|
+
async function* iterateTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, body) {
|
|
813
|
+
new TextDecoder("utf-8");
|
|
814
|
+
const streamPointsIterator = await esm_exports2.OntologyObjectsV2.streamPoints(client, await client.ontologyRid, objectApiName, primaryKey, propertyName, body ? {
|
|
815
|
+
range: getTimeRange(body)
|
|
816
|
+
} : {});
|
|
817
|
+
const reader = streamPointsIterator.stream().getReader();
|
|
818
|
+
for await (const point of parseStreamedResponse(iterateReadableStream(reader))) {
|
|
819
|
+
yield {
|
|
820
|
+
time: point.time,
|
|
821
|
+
value: point.value
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
function getTimeRange(body) {
|
|
826
|
+
if ("$startTime" in body || "$endTime" in body) {
|
|
662
827
|
return {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
return headers;
|
|
667
|
-
})
|
|
828
|
+
type: "absolute",
|
|
829
|
+
startTime: body.$startTime,
|
|
830
|
+
endTime: body.$endTime
|
|
668
831
|
};
|
|
669
832
|
}
|
|
670
|
-
return
|
|
833
|
+
return body.$before ? {
|
|
834
|
+
type: "relative",
|
|
835
|
+
startTime: {
|
|
836
|
+
when: "BEFORE",
|
|
837
|
+
value: body.$before,
|
|
838
|
+
unit: client_api.TimeseriesDurationMapping[body.$unit]
|
|
839
|
+
}
|
|
840
|
+
} : {
|
|
841
|
+
type: "relative",
|
|
842
|
+
endTime: {
|
|
843
|
+
when: "AFTER",
|
|
844
|
+
value: body.$after,
|
|
845
|
+
unit: client_api.TimeseriesDurationMapping[body.$unit]
|
|
846
|
+
}
|
|
847
|
+
};
|
|
671
848
|
}
|
|
672
849
|
|
|
673
850
|
// src/object/Cache.ts
|
|
@@ -784,34 +961,6 @@ var InterfaceDefRef = Symbol(process.env.MODE !== "production" ? "InterfaceDefin
|
|
|
784
961
|
var RawObject = Symbol(process.env.MODE !== "production" ? "RawObject" : void 0);
|
|
785
962
|
var ClientRef = Symbol(process.env.MODE !== "production" ? "ClientRef" : void 0);
|
|
786
963
|
|
|
787
|
-
// src/object/convertWireToOsdkObjects/OsdkCustomInspectPrototype.ts
|
|
788
|
-
var OsdkCustomInspectPrototype = Object.create(null, {
|
|
789
|
-
[Symbol.for("nodejs.util.inspect.custom")]: {
|
|
790
|
-
value: customInspect
|
|
791
|
-
}
|
|
792
|
-
});
|
|
793
|
-
function customInspect(_depth, options, localInspect) {
|
|
794
|
-
const newOptions = {
|
|
795
|
-
...options,
|
|
796
|
-
depth: options.depth == null ? null : options.depth - 1
|
|
797
|
-
};
|
|
798
|
-
let ret = `Osdk<${options.stylize(this[ObjectDefRef]?.apiName ?? this[InterfaceDefRef]?.apiName, "special")}> {
|
|
799
|
-
`;
|
|
800
|
-
for (const k of /* @__PURE__ */ new Set(["$apiName", "$objectType", "$primaryKey", ...Reflect.ownKeys(this)])) {
|
|
801
|
-
if (typeof k === "symbol") continue;
|
|
802
|
-
ret += ` ${options.stylize(k.toString(), "undefined")}: ${localInspect(this[k], newOptions)}
|
|
803
|
-
`;
|
|
804
|
-
}
|
|
805
|
-
if (this[UnderlyingOsdkObject] !== this) {
|
|
806
|
-
ret += "\n";
|
|
807
|
-
ret += ` ${options.stylize("$as", "special")}: ${localInspect(this[UnderlyingOsdkObject], newOptions).replace(/\n/g, `
|
|
808
|
-
`)}`;
|
|
809
|
-
ret += "\n";
|
|
810
|
-
}
|
|
811
|
-
ret += "}";
|
|
812
|
-
return ret;
|
|
813
|
-
}
|
|
814
|
-
|
|
815
964
|
// src/object/convertWireToOsdkObjects/createOsdkInterface.ts
|
|
816
965
|
var handlerCache = createSimpleCache(/* @__PURE__ */ new WeakMap(), createInterfaceProxyHandler);
|
|
817
966
|
function createOsdkInterface(underlying, interfaceDef) {
|
|
@@ -819,9 +968,6 @@ function createOsdkInterface(underlying, interfaceDef) {
|
|
|
819
968
|
[UnderlyingOsdkObject]: underlying,
|
|
820
969
|
[InterfaceDefRef]: interfaceDef
|
|
821
970
|
};
|
|
822
|
-
{
|
|
823
|
-
Object.setPrototypeOf(interfaceHolder, OsdkCustomInspectPrototype);
|
|
824
|
-
}
|
|
825
971
|
const handler = handlerCache.get(interfaceDef);
|
|
826
972
|
const proxy = new Proxy(
|
|
827
973
|
interfaceHolder,
|
|
@@ -1133,7 +1279,7 @@ async function aggregate(clientCtx, objectType, objectSet = {
|
|
|
1133
1279
|
if (req.$where) {
|
|
1134
1280
|
body.where = modernToLegacyWhereClause(req.$where);
|
|
1135
1281
|
}
|
|
1136
|
-
const result = await esm_exports2.OntologyObjectSets.aggregateObjectSetV2(
|
|
1282
|
+
const result = await esm_exports2.OntologyObjectSets.aggregateObjectSetV2(addUserAgentAndRequestContextHeaders(clientCtx, objectType), await clientCtx.ontologyRid, {
|
|
1137
1283
|
objectSet,
|
|
1138
1284
|
groupBy: body.groupBy,
|
|
1139
1285
|
aggregation: body.aggregation
|
|
@@ -1191,6 +1337,15 @@ async function fetchSingleWithErrors(client, objectType, args, objectSet) {
|
|
|
1191
1337
|
}
|
|
1192
1338
|
}
|
|
1193
1339
|
|
|
1340
|
+
// src/util/augmentRequestContext.ts
|
|
1341
|
+
var augmentRequestContext = (client, augment2) => ({
|
|
1342
|
+
...client,
|
|
1343
|
+
requestContext: {
|
|
1344
|
+
...client.requestContext,
|
|
1345
|
+
...augment2(client.requestContext)
|
|
1346
|
+
}
|
|
1347
|
+
});
|
|
1348
|
+
|
|
1194
1349
|
// src/util/WireObjectSet.ts
|
|
1195
1350
|
var WIRE_OBJECT_SET_TYPES = /* @__PURE__ */ new Set(["base", "filter", "intersect", "reference", "searchAround", "static", "subtract", "union"]);
|
|
1196
1351
|
function isWireObjectSet(o) {
|
|
@@ -1213,9 +1368,15 @@ function createObjectSet(objectType, clientCtx, objectSet = {
|
|
|
1213
1368
|
objectType: objectType["apiName"]
|
|
1214
1369
|
}) {
|
|
1215
1370
|
const base = {
|
|
1216
|
-
aggregate: aggregate.bind(globalThis, clientCtx,
|
|
1217
|
-
|
|
1218
|
-
|
|
1371
|
+
aggregate: aggregate.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
|
|
1372
|
+
finalMethodCall: "aggregate"
|
|
1373
|
+
})), objectType, objectSet),
|
|
1374
|
+
fetchPage: fetchPageInternal.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
|
|
1375
|
+
finalMethodCall: "fetchPage"
|
|
1376
|
+
})), objectType, objectSet),
|
|
1377
|
+
fetchPageWithErrors: fetchPageWithErrorsInternal.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
|
|
1378
|
+
finalMethodCall: "fetchPageWithErrors"
|
|
1379
|
+
})), objectType, objectSet),
|
|
1219
1380
|
where: (clause) => {
|
|
1220
1381
|
return clientCtx.objectSetFactory(objectType, clientCtx, {
|
|
1221
1382
|
type: "filter",
|
|
@@ -1247,7 +1408,9 @@ function createObjectSet(objectType, clientCtx, objectSet = {
|
|
|
1247
1408
|
asyncIter: async function* () {
|
|
1248
1409
|
let $nextPageToken = void 0;
|
|
1249
1410
|
do {
|
|
1250
|
-
const result = await
|
|
1411
|
+
const result = await fetchPageInternal(augmentRequestContext(clientCtx, (_) => ({
|
|
1412
|
+
finalMethodCall: "asyncIter"
|
|
1413
|
+
})), objectType, objectSet, {
|
|
1251
1414
|
$nextPageToken
|
|
1252
1415
|
});
|
|
1253
1416
|
$nextPageToken = result.nextPageToken;
|
|
@@ -1266,7 +1429,9 @@ function createObjectSet(objectType, clientCtx, objectSet = {
|
|
|
1266
1429
|
value: primaryKey
|
|
1267
1430
|
}
|
|
1268
1431
|
};
|
|
1269
|
-
return await fetchSingle(clientCtx,
|
|
1432
|
+
return await fetchSingle(augmentRequestContext(clientCtx, (_) => ({
|
|
1433
|
+
finalMethodCall: "fetchOne"
|
|
1434
|
+
})), objectType, options, withPk);
|
|
1270
1435
|
} : void 0,
|
|
1271
1436
|
fetchOneWithErrors: isObjectTypeDefinition(objectType) ? async (primaryKey, options) => {
|
|
1272
1437
|
const withPk = {
|
|
@@ -1278,7 +1443,9 @@ function createObjectSet(objectType, clientCtx, objectSet = {
|
|
|
1278
1443
|
value: primaryKey
|
|
1279
1444
|
}
|
|
1280
1445
|
};
|
|
1281
|
-
return await fetchSingleWithErrors(clientCtx,
|
|
1446
|
+
return await fetchSingleWithErrors(augmentRequestContext(clientCtx, (_) => ({
|
|
1447
|
+
finalMethodCall: "fetchOneWithErrors"
|
|
1448
|
+
})), objectType, options, withPk);
|
|
1282
1449
|
} : void 0
|
|
1283
1450
|
};
|
|
1284
1451
|
function createSearchAround(link) {
|
|
@@ -1338,7 +1505,7 @@ var DollarLinkProxyHandler = {
|
|
|
1338
1505
|
|
|
1339
1506
|
// src/object/convertWireToOsdkObjects/createOsdkObject.ts
|
|
1340
1507
|
var objectPrototypeCache = createClientCache(function(client, objectDef) {
|
|
1341
|
-
return Object.create(
|
|
1508
|
+
return Object.create(null, {
|
|
1342
1509
|
[ObjectDefRef]: {
|
|
1343
1510
|
value: objectDef
|
|
1344
1511
|
},
|
|
@@ -1389,6 +1556,9 @@ function createOsdkObject(client, objectDef, rawObj) {
|
|
|
1389
1556
|
}
|
|
1390
1557
|
return createAttachmentFromRid(client, rawValue.rid);
|
|
1391
1558
|
}
|
|
1559
|
+
if (propDef.type === "numericTimeseries" || propDef.type === "stringTimeseries") {
|
|
1560
|
+
return createTimeseriesProperty(client, objectDef.apiName, target[RawObject][objectDef.primaryKeyApiName], p);
|
|
1561
|
+
}
|
|
1392
1562
|
}
|
|
1393
1563
|
return rawValue;
|
|
1394
1564
|
}
|
|
@@ -1538,7 +1708,7 @@ function objectSetToSearchJsonV2(objectSet, expectedApiName, existingWhere = voi
|
|
|
1538
1708
|
throw new Error(`Unsupported objectSet type: ${objectSet.type}`);
|
|
1539
1709
|
}
|
|
1540
1710
|
async function fetchInterfacePage(client, interfaceType, args, objectSet) {
|
|
1541
|
-
const result = await esm_exports2.OntologyObjectsV2.searchObjectsForInterface(
|
|
1711
|
+
const result = await esm_exports2.OntologyObjectsV2.searchObjectsForInterface(addUserAgentAndRequestContextHeaders(client, interfaceType), await client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {
|
|
1542
1712
|
augmentedProperties: args.$augment ?? {},
|
|
1543
1713
|
augmentedSharedPropertyTypes: {},
|
|
1544
1714
|
otherInterfaceTypes: [],
|
|
@@ -1605,7 +1775,7 @@ function applyFetchArgs(args, body) {
|
|
|
1605
1775
|
return body;
|
|
1606
1776
|
}
|
|
1607
1777
|
async function fetchObjectPage(client, objectType, args, objectSet) {
|
|
1608
|
-
const r = await esm_exports2.OntologyObjectSets.loadObjectSetV2(
|
|
1778
|
+
const r = await esm_exports2.OntologyObjectSets.loadObjectSetV2(addUserAgentAndRequestContextHeaders(client, objectType), await client.ontologyRid, applyFetchArgs(args, {
|
|
1609
1779
|
objectSet,
|
|
1610
1780
|
// We have to do the following case because LoadObjectSetRequestV2 isn't readonly
|
|
1611
1781
|
select: args?.$select ?? [],
|
|
@@ -1618,19 +1788,6 @@ async function fetchObjectPage(client, objectType, args, objectSet) {
|
|
|
1618
1788
|
});
|
|
1619
1789
|
}
|
|
1620
1790
|
|
|
1621
|
-
// src/actions/ActionValidationError.ts
|
|
1622
|
-
var ActionValidationError = class extends Error {
|
|
1623
|
-
constructor(validation) {
|
|
1624
|
-
super("Validation Error");
|
|
1625
|
-
this.validation = validation;
|
|
1626
|
-
}
|
|
1627
|
-
};
|
|
1628
|
-
|
|
1629
|
-
// src/object/AttachmentUpload.ts
|
|
1630
|
-
function isAttachmentUpload(o) {
|
|
1631
|
-
return o instanceof Blob && "name" in o;
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
1791
|
// src/util/isOntologyObjectV2.ts
|
|
1635
1792
|
function isOntologyObjectV2(o) {
|
|
1636
1793
|
return o && typeof o === "object" && typeof o.__apiName === "string" && o.__primaryKey != null;
|
|
@@ -1683,8 +1840,11 @@ async function toDataValue(value, client) {
|
|
|
1683
1840
|
|
|
1684
1841
|
// src/actions/applyAction.ts
|
|
1685
1842
|
async function applyAction2(client, action, parameters, options = {}) {
|
|
1843
|
+
const clientWithHeaders = addUserAgentAndRequestContextHeaders(augmentRequestContext(client, (_) => ({
|
|
1844
|
+
finalMethodCall: "applyAction"
|
|
1845
|
+
})), action);
|
|
1686
1846
|
if (Array.isArray(parameters)) {
|
|
1687
|
-
const response = await esm_exports2.Actions.applyActionBatchV2(
|
|
1847
|
+
const response = await esm_exports2.Actions.applyActionBatchV2(clientWithHeaders, await client.ontologyRid, action.apiName, {
|
|
1688
1848
|
requests: parameters ? await remapBatchActionParams(parameters, client) : [],
|
|
1689
1849
|
options: {
|
|
1690
1850
|
returnEdits: options?.$returnEdits ? "ALL" : "NONE"
|
|
@@ -1692,7 +1852,7 @@ async function applyAction2(client, action, parameters, options = {}) {
|
|
|
1692
1852
|
});
|
|
1693
1853
|
return options?.$returnEdits ? response.edits : void 0;
|
|
1694
1854
|
} else {
|
|
1695
|
-
const response = await esm_exports2.Actions.applyActionV2(
|
|
1855
|
+
const response = await esm_exports2.Actions.applyActionV2(clientWithHeaders, await client.ontologyRid, action.apiName, {
|
|
1696
1856
|
parameters: await remapActionParams(parameters, client),
|
|
1697
1857
|
options: {
|
|
1698
1858
|
mode: options?.$validateOnly ? "VALIDATE_ONLY" : "VALIDATE_AND_EXECUTE",
|
|
@@ -1779,7 +1939,7 @@ var createStandardOntologyProviderFactory = (client) => {
|
|
|
1779
1939
|
};
|
|
1780
1940
|
|
|
1781
1941
|
// src/util/UserAgent.ts
|
|
1782
|
-
var USER_AGENT = `osdk-client/${"0.20.0
|
|
1942
|
+
var USER_AGENT = `osdk-client/${"0.20.0"}`;
|
|
1783
1943
|
|
|
1784
1944
|
// src/createMinimalClient.ts
|
|
1785
1945
|
function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {
|
|
@@ -1796,7 +1956,8 @@ function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fet
|
|
|
1796
1956
|
objectSetFactory,
|
|
1797
1957
|
ontologyRid: metadata.ontologyRid,
|
|
1798
1958
|
logger: options.logger,
|
|
1799
|
-
clientCacheKey: {}
|
|
1959
|
+
clientCacheKey: {},
|
|
1960
|
+
requestContext: {}
|
|
1800
1961
|
};
|
|
1801
1962
|
return Object.assign(minimalClient, {
|
|
1802
1963
|
ontologyProvider: createStandardOntologyProviderFactory()(minimalClient)
|
|
@@ -1886,7 +2047,9 @@ async function toDataValueQueries(value, client, desiredType) {
|
|
|
1886
2047
|
|
|
1887
2048
|
// src/queries/applyQuery.ts
|
|
1888
2049
|
async function applyQuery(client, query, params) {
|
|
1889
|
-
const response = await esm_exports2.QueryTypes.executeQueryV2(
|
|
2050
|
+
const response = await esm_exports2.QueryTypes.executeQueryV2(addUserAgentAndRequestContextHeaders(augmentRequestContext(client, (_) => ({
|
|
2051
|
+
finalMethodCall: "applyQuery"
|
|
2052
|
+
})), query), await client.ontologyRid, query.apiName, {
|
|
1890
2053
|
parameters: params ? await remapQueryParams(params, client, query.parameters) : {}
|
|
1891
2054
|
});
|
|
1892
2055
|
const objectOutputDefs = await getRequiredDefinitions(query.output, client);
|
|
@@ -2111,10 +2274,11 @@ exports.USER_AGENT = USER_AGENT;
|
|
|
2111
2274
|
exports.augment = augment;
|
|
2112
2275
|
exports.convertWireToOsdkObjects = convertWireToOsdkObjects;
|
|
2113
2276
|
exports.createAttachmentFromRid = createAttachmentFromRid;
|
|
2277
|
+
exports.createAttachmentUpload = createAttachmentUpload;
|
|
2114
2278
|
exports.createClient = createClient;
|
|
2115
2279
|
exports.createClientInternal = createClientInternal;
|
|
2116
2280
|
exports.createObjectSet = createObjectSet;
|
|
2117
2281
|
exports.createSimpleAsyncCache = createSimpleAsyncCache;
|
|
2118
2282
|
exports.esm_exports = esm_exports2;
|
|
2119
2283
|
//# sourceMappingURL=out.js.map
|
|
2120
|
-
//# sourceMappingURL=chunk-
|
|
2284
|
+
//# sourceMappingURL=chunk-VW7XYOFL.cjs.map
|