@osdk/client 0.20.0-beta.4 → 0.20.1

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.
Files changed (95) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/build/{esm/chunk-MD6R46EZ.js → browser/chunk-CBENBC5L.js} +279 -114
  3. package/build/browser/chunk-CBENBC5L.js.map +1 -0
  4. package/build/browser/index.js +5 -9
  5. package/build/browser/index.js.map +1 -1
  6. package/build/browser/public/unstable-do-not-use.js +13 -13
  7. package/build/browser/public/unstable-do-not-use.js.map +1 -1
  8. package/build/cjs/{chunk-4FXEPHWC.cjs → chunk-JVA3MVZE.cjs} +278 -112
  9. package/build/cjs/chunk-JVA3MVZE.cjs.map +1 -0
  10. package/build/cjs/index.cjs +15 -12
  11. package/build/cjs/index.cjs.map +1 -1
  12. package/build/cjs/public/unstable-do-not-use.cjs +19 -19
  13. package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
  14. package/build/esm/MinimalClientContext.d.ts +4 -2
  15. package/build/esm/MinimalClientContext.d.ts.map +1 -1
  16. package/build/esm/__unstable/UnstableClient.d.ts +1 -1
  17. package/build/esm/__unstable/UnstableClient.d.ts.map +1 -1
  18. package/build/esm/actions/applyAction.d.ts.map +1 -1
  19. package/build/{browser/chunk-3ZYIZQ7V.js → esm/chunk-CBENBC5L.js} +279 -111
  20. package/build/esm/chunk-CBENBC5L.js.map +1 -0
  21. package/build/esm/createClient.d.ts +0 -5
  22. package/build/esm/createClient.d.ts.map +1 -1
  23. package/build/esm/createMinimalClient.d.ts +1 -9
  24. package/build/esm/createMinimalClient.d.ts.map +1 -1
  25. package/build/esm/createPlatformClient.d.ts +4 -1
  26. package/build/esm/createPlatformClient.d.ts.map +1 -1
  27. package/build/esm/createTimeseriesProperty.d.ts +4 -0
  28. package/build/esm/createTimeseriesProperty.d.ts.map +1 -0
  29. package/build/esm/index.d.ts +6 -4
  30. package/build/esm/index.d.ts.map +1 -1
  31. package/build/esm/index.js +5 -9
  32. package/build/esm/index.js.map +1 -1
  33. package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.d.ts +1 -5
  34. package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.d.ts.map +1 -1
  35. package/build/esm/internal/conversions/modernToLegacyAggregationClause.d.ts +1 -3
  36. package/build/esm/internal/conversions/modernToLegacyAggregationClause.d.ts.map +1 -1
  37. package/build/esm/internal/conversions/modernToLegacyGroupByClause.d.ts +1 -3
  38. package/build/esm/internal/conversions/modernToLegacyGroupByClause.d.ts.map +1 -1
  39. package/build/esm/internal/conversions/modernToLegacyWhereClause.d.ts +1 -4
  40. package/build/esm/internal/conversions/modernToLegacyWhereClause.d.ts.map +1 -1
  41. package/build/esm/object/aggregate.d.ts +1 -7
  42. package/build/esm/object/aggregate.d.ts.map +1 -1
  43. package/build/esm/object/convertWireToOsdkObjects/ObjectHolder.d.ts +1 -20
  44. package/build/esm/object/convertWireToOsdkObjects/ObjectHolder.d.ts.map +1 -1
  45. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.d.ts +1 -5
  46. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.d.ts.map +1 -1
  47. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.d.ts +1 -5
  48. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.d.ts.map +1 -1
  49. package/build/esm/object/convertWireToOsdkObjects/getDollarAs.d.ts +0 -5
  50. package/build/esm/object/convertWireToOsdkObjects/getDollarAs.d.ts.map +1 -1
  51. package/build/esm/object/convertWireToOsdkObjects/getDollarLink.d.ts +1 -3
  52. package/build/esm/object/convertWireToOsdkObjects/getDollarLink.d.ts.map +1 -1
  53. package/build/esm/object/convertWireToOsdkObjects.d.ts +1 -21
  54. package/build/esm/object/convertWireToOsdkObjects.d.ts.map +1 -1
  55. package/build/esm/object/fetchPage.d.ts +2 -13
  56. package/build/esm/object/fetchPage.d.ts.map +1 -1
  57. package/build/esm/object/fetchSingle.d.ts +1 -6
  58. package/build/esm/object/fetchSingle.d.ts.map +1 -1
  59. package/build/esm/object/timeseries.test.d.ts +2 -0
  60. package/build/esm/object/timeseries.test.d.ts.map +1 -0
  61. package/build/esm/objectSet/ObjectSetFactory.d.ts +1 -5
  62. package/build/esm/objectSet/ObjectSetFactory.d.ts.map +1 -1
  63. package/build/esm/objectSet/ObjectSetListenerWebsocket.d.ts +0 -15
  64. package/build/esm/objectSet/ObjectSetListenerWebsocket.d.ts.map +1 -1
  65. package/build/esm/objectSet/createObjectSet.d.ts +1 -8
  66. package/build/esm/objectSet/createObjectSet.d.ts.map +1 -1
  67. package/build/esm/objectSet/createUnstableObjectSet.d.ts +0 -3
  68. package/build/esm/objectSet/createUnstableObjectSet.d.ts.map +1 -1
  69. package/build/esm/objectSet/toConjureObjectSet.d.ts +1 -6
  70. package/build/esm/objectSet/toConjureObjectSet.d.ts.map +1 -1
  71. package/build/esm/ontology/OntologyProvider.d.ts +1 -1
  72. package/build/esm/ontology/OntologyProvider.d.ts.map +1 -1
  73. package/build/esm/public/unstable-do-not-use.js +13 -13
  74. package/build/esm/public/unstable-do-not-use.js.map +1 -1
  75. package/build/esm/queries/applyQuery.d.ts.map +1 -1
  76. package/build/esm/util/WireObjectSet.d.ts +1 -2
  77. package/build/esm/util/WireObjectSet.d.ts.map +1 -1
  78. package/build/esm/util/addUserAgentAndRequestContextHeaders.d.ts +4 -0
  79. package/build/esm/util/addUserAgentAndRequestContextHeaders.d.ts.map +1 -0
  80. package/build/esm/util/augmentRequestContext.d.ts +32 -0
  81. package/build/esm/util/augmentRequestContext.d.ts.map +1 -0
  82. package/build/esm/util/isOntologyObjectV2.d.ts +1 -2
  83. package/build/esm/util/isOntologyObjectV2.d.ts.map +1 -1
  84. package/build/esm/util/streamutils.d.ts +3 -0
  85. package/build/esm/util/streamutils.d.ts.map +1 -0
  86. package/build/esm/util/toDataValue.d.ts +1 -8
  87. package/build/esm/util/toDataValue.d.ts.map +1 -1
  88. package/build/esm/util/toDataValueQueries.d.ts +1 -9
  89. package/build/esm/util/toDataValueQueries.d.ts.map +1 -1
  90. package/package.json +17 -17
  91. package/build/browser/chunk-3ZYIZQ7V.js.map +0 -1
  92. package/build/cjs/chunk-4FXEPHWC.cjs.map +0 -1
  93. package/build/esm/chunk-MD6R46EZ.js.map +0 -1
  94. package/build/esm/util/addUserAgent.d.ts +0 -4
  95. 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-U2YDEYVP.js
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
- getAttachmentByRidV2: () => getAttachmentByRidV2,
515
- getAttachmentContentByRidV2: () => getAttachmentContentByRidV2,
516
- getAttachmentContentV2: () => getAttachmentContentV2,
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 _getAttachmentsV2 = [0, "/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}", 2];
576
- function getAttachmentsV2($ctx, ...args) {
577
- return foundryPlatformFetch($ctx, _getAttachmentsV2, ...args);
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 _getAttachmentByRidV2 = [0, "/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}/{4}", 2];
580
- function getAttachmentByRidV2($ctx, ...args) {
581
- return foundryPlatformFetch($ctx, _getAttachmentByRidV2, ...args);
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 _getAttachmentContentV2 = [0, "/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}/content", 2, , "*/*"];
584
- function getAttachmentContentV2($ctx, ...args) {
585
- return foundryPlatformFetch($ctx, _getAttachmentContentV2, ...args);
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 _getAttachmentContentByRidV2 = [0, "/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}/{4}/content", 2, , "*/*"];
588
- function getAttachmentContentByRidV2($ctx, ...args) {
589
- return foundryPlatformFetch($ctx, _getAttachmentContentByRidV2, ...args);
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,164 @@ function createAttachmentFromRid(client, rid) {
657
686
  }
658
687
  };
659
688
  }
660
- function addUserAgent(client, withMetadata) {
661
- if (withMetadata.osdkMetadata) {
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
+ if (withMetadata.osdkMetadata) {
706
+ headers.set("Fetch-User-Agent", withMetadata.osdkMetadata.extraUserAgent);
707
+ }
708
+ return headers;
709
+ })
710
+ });
711
+
712
+ // src/util/streamutils.ts
713
+ var START_TOKEN = new Uint8Array([123, 34, 100, 97, 116, 97, 34, 58, 91]);
714
+ var OBJECT_OPEN_CHAR_CODE = 123;
715
+ var OBJECT_CLOSE_CHAR_CODE = 125;
716
+ async function* parseStreamedResponse(asyncIterable) {
717
+ const utf8decoder = new TextDecoder("utf-8");
718
+ let parsedStart = false;
719
+ let prevChunks = [];
720
+ let openBracesCount = 0;
721
+ for await (let chunk of asyncIterable) {
722
+ let i = 0;
723
+ if (!parsedStart) {
724
+ parsedStart = true;
725
+ if (startsWith(chunk, START_TOKEN)) {
726
+ i = START_TOKEN.length;
727
+ }
728
+ }
729
+ for (; i < chunk.length; i++) {
730
+ while (openBracesCount === 0 && chunk[i] !== OBJECT_OPEN_CHAR_CODE && i < chunk.length) {
731
+ i++;
732
+ }
733
+ let j = i;
734
+ for (; j < chunk.length; j++) {
735
+ const c = chunk[j];
736
+ if (c === OBJECT_OPEN_CHAR_CODE) {
737
+ openBracesCount++;
738
+ } else if (c === OBJECT_CLOSE_CHAR_CODE) {
739
+ openBracesCount--;
740
+ if (0 === openBracesCount) {
741
+ yield combineAndParse(utf8decoder, prevChunks, chunk.subarray(i, j + 1));
742
+ prevChunks = [];
743
+ i = j;
744
+ break;
745
+ }
746
+ }
747
+ }
748
+ if (j === chunk.length) {
749
+ prevChunks.push(chunk.subarray(i));
750
+ break;
751
+ }
752
+ }
753
+ }
754
+ }
755
+ function startsWith(a, b) {
756
+ if (a.length < b.length) {
757
+ return false;
758
+ }
759
+ for (let i = 0; i < b.length; i++) {
760
+ if (a[i] !== b[i]) {
761
+ return false;
762
+ }
763
+ }
764
+ return true;
765
+ }
766
+ function combineAndParse(utf8decoder, prev, curr) {
767
+ let str = "";
768
+ for (const chunk of prev) {
769
+ str += utf8decoder.decode(chunk, {
770
+ stream: true
771
+ });
772
+ }
773
+ str += utf8decoder.decode(curr);
774
+ return JSON.parse(str);
775
+ }
776
+ async function* iterateReadableStream(readableStream) {
777
+ let res = await readableStream.read();
778
+ while (!res.done) {
779
+ yield res.value;
780
+ res = await readableStream.read();
781
+ }
782
+ }
783
+
784
+ // src/createTimeseriesProperty.ts
785
+ function createTimeseriesProperty(client, objectApiName, primaryKey, propertyName) {
786
+ return {
787
+ async getFirstPoint() {
788
+ return esm_exports2.OntologyObjectsV2.getFirstPoint(client, await client.ontologyRid, objectApiName, primaryKey, propertyName);
789
+ },
790
+ async getLastPoint() {
791
+ return esm_exports2.OntologyObjectsV2.getLastPoint(client, await client.ontologyRid, objectApiName, primaryKey, propertyName);
792
+ },
793
+ async getAllPoints(query) {
794
+ return getAllTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, query);
795
+ },
796
+ asyncIterPoints(query) {
797
+ return iterateTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, query);
798
+ }
799
+ };
800
+ }
801
+ async function getAllTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, body) {
802
+ const allPoints = [];
803
+ for await (const point of iterateTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, body)) {
804
+ allPoints.push({
805
+ time: point.time,
806
+ value: point.value
807
+ });
808
+ }
809
+ return allPoints;
810
+ }
811
+ async function* iterateTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, body) {
812
+ new TextDecoder("utf-8");
813
+ const streamPointsIterator = await esm_exports2.OntologyObjectsV2.streamPoints(client, await client.ontologyRid, objectApiName, primaryKey, propertyName, body ? {
814
+ range: getTimeRange(body)
815
+ } : {});
816
+ const reader = streamPointsIterator.stream().getReader();
817
+ for await (const point of parseStreamedResponse(iterateReadableStream(reader))) {
818
+ yield {
819
+ time: point.time,
820
+ value: point.value
821
+ };
822
+ }
823
+ }
824
+ function getTimeRange(body) {
825
+ if ("$startTime" in body || "$endTime" in body) {
662
826
  return {
663
- ...client,
664
- fetch: shared_net_fetch.createFetchHeaderMutator(client.fetch, (headers) => {
665
- headers.set("Fetch-User-Agent", withMetadata.osdkMetadata.extraUserAgent);
666
- return headers;
667
- })
827
+ type: "absolute",
828
+ startTime: body.$startTime,
829
+ endTime: body.$endTime
668
830
  };
669
831
  }
670
- return client;
832
+ return body.$before ? {
833
+ type: "relative",
834
+ startTime: {
835
+ when: "BEFORE",
836
+ value: body.$before,
837
+ unit: client_api.TimeseriesDurationMapping[body.$unit]
838
+ }
839
+ } : {
840
+ type: "relative",
841
+ endTime: {
842
+ when: "AFTER",
843
+ value: body.$after,
844
+ unit: client_api.TimeseriesDurationMapping[body.$unit]
845
+ }
846
+ };
671
847
  }
672
848
 
673
849
  // src/object/Cache.ts
@@ -784,34 +960,6 @@ var InterfaceDefRef = Symbol(process.env.MODE !== "production" ? "InterfaceDefin
784
960
  var RawObject = Symbol(process.env.MODE !== "production" ? "RawObject" : void 0);
785
961
  var ClientRef = Symbol(process.env.MODE !== "production" ? "ClientRef" : void 0);
786
962
 
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
963
  // src/object/convertWireToOsdkObjects/createOsdkInterface.ts
816
964
  var handlerCache = createSimpleCache(/* @__PURE__ */ new WeakMap(), createInterfaceProxyHandler);
817
965
  function createOsdkInterface(underlying, interfaceDef) {
@@ -819,9 +967,6 @@ function createOsdkInterface(underlying, interfaceDef) {
819
967
  [UnderlyingOsdkObject]: underlying,
820
968
  [InterfaceDefRef]: interfaceDef
821
969
  };
822
- {
823
- Object.setPrototypeOf(interfaceHolder, OsdkCustomInspectPrototype);
824
- }
825
970
  const handler = handlerCache.get(interfaceDef);
826
971
  const proxy = new Proxy(
827
972
  interfaceHolder,
@@ -839,7 +984,8 @@ function createInterfaceProxyHandler(newDef) {
839
984
  case "$primaryKey":
840
985
  case "$title":
841
986
  case "$objectType":
842
- return Reflect.getOwnPropertyDescriptor(underlying, p);
987
+ case "$rid":
988
+ return underlying[p] != null ? Reflect.getOwnPropertyDescriptor(underlying, p) : void 0;
843
989
  case "$apiName":
844
990
  return {
845
991
  enumerable: true,
@@ -856,7 +1002,8 @@ function createInterfaceProxyHandler(newDef) {
856
1002
  }
857
1003
  },
858
1004
  ownKeys(target) {
859
- return ["$apiName", "$objectType", "$primaryKey", "$title", ...Object.keys(newDef.properties)];
1005
+ const underlying = target[UnderlyingOsdkObject];
1006
+ return ["$apiName", "$objectType", "$primaryKey", ...underlying["$rid"] ? ["$rid"] : [], "$title", ...Object.keys(newDef.properties)];
860
1007
  },
861
1008
  get(target, p) {
862
1009
  const underlying = target[UnderlyingOsdkObject];
@@ -870,6 +1017,7 @@ function createInterfaceProxyHandler(newDef) {
870
1017
  case "$primaryKey":
871
1018
  case "$title":
872
1019
  case "$objectType":
1020
+ case "$rid":
873
1021
  return underlying[p];
874
1022
  }
875
1023
  if (newDef.properties[p] != null) {
@@ -994,9 +1142,9 @@ function handleWherePair([field, filter]) {
994
1142
  const withinBody = filter[firstKey];
995
1143
  if (Array.isArray(withinBody)) {
996
1144
  return makeGeoFilterBbox(field, withinBody, firstKey);
997
- } else if ("$bbox" in withinBody) {
1145
+ } else if ("$bbox" in withinBody && withinBody.$bbox != null) {
998
1146
  return makeGeoFilterBbox(field, withinBody.$bbox, firstKey);
999
- } else if ("$distance" in withinBody && "$of" in withinBody) {
1147
+ } else if ("$distance" in withinBody && "$of" in withinBody && withinBody.$distance != null && withinBody.$of != null) {
1000
1148
  return {
1001
1149
  type: "withinDistanceOf",
1002
1150
  field,
@@ -1020,7 +1168,7 @@ function handleWherePair([field, filter]) {
1020
1168
  const intersectsBody = filter[firstKey];
1021
1169
  if (Array.isArray(intersectsBody)) {
1022
1170
  return makeGeoFilterBbox(field, intersectsBody, firstKey);
1023
- } else if ("$bbox" in intersectsBody) {
1171
+ } else if ("$bbox" in intersectsBody && intersectsBody.$bbox != null) {
1024
1172
  return makeGeoFilterBbox(field, intersectsBody.$bbox, firstKey);
1025
1173
  } else {
1026
1174
  const coordinates = "$polygon" in intersectsBody ? intersectsBody.$polygon : intersectsBody.coordinates;
@@ -1133,7 +1281,7 @@ async function aggregate(clientCtx, objectType, objectSet = {
1133
1281
  if (req.$where) {
1134
1282
  body.where = modernToLegacyWhereClause(req.$where);
1135
1283
  }
1136
- const result = await esm_exports2.OntologyObjectSets.aggregateObjectSetV2(addUserAgent(clientCtx, objectType), await clientCtx.ontologyRid, {
1284
+ const result = await esm_exports2.OntologyObjectSets.aggregateObjectSetV2(addUserAgentAndRequestContextHeaders(clientCtx, objectType), await clientCtx.ontologyRid, {
1137
1285
  objectSet,
1138
1286
  groupBy: body.groupBy,
1139
1287
  aggregation: body.aggregation
@@ -1191,6 +1339,15 @@ async function fetchSingleWithErrors(client, objectType, args, objectSet) {
1191
1339
  }
1192
1340
  }
1193
1341
 
1342
+ // src/util/augmentRequestContext.ts
1343
+ var augmentRequestContext = (client, augment2) => ({
1344
+ ...client,
1345
+ requestContext: {
1346
+ ...client.requestContext,
1347
+ ...augment2(client.requestContext)
1348
+ }
1349
+ });
1350
+
1194
1351
  // src/util/WireObjectSet.ts
1195
1352
  var WIRE_OBJECT_SET_TYPES = /* @__PURE__ */ new Set(["base", "filter", "intersect", "reference", "searchAround", "static", "subtract", "union"]);
1196
1353
  function isWireObjectSet(o) {
@@ -1213,9 +1370,15 @@ function createObjectSet(objectType, clientCtx, objectSet = {
1213
1370
  objectType: objectType["apiName"]
1214
1371
  }) {
1215
1372
  const base = {
1216
- aggregate: aggregate.bind(globalThis, clientCtx, objectType, objectSet),
1217
- fetchPage: fetchPageInternal.bind(globalThis, clientCtx, objectType, objectSet),
1218
- fetchPageWithErrors: fetchPageWithErrorsInternal.bind(globalThis, clientCtx, objectType, objectSet),
1373
+ aggregate: aggregate.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
1374
+ finalMethodCall: "aggregate"
1375
+ })), objectType, objectSet),
1376
+ fetchPage: fetchPageInternal.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
1377
+ finalMethodCall: "fetchPage"
1378
+ })), objectType, objectSet),
1379
+ fetchPageWithErrors: fetchPageWithErrorsInternal.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
1380
+ finalMethodCall: "fetchPageWithErrors"
1381
+ })), objectType, objectSet),
1219
1382
  where: (clause) => {
1220
1383
  return clientCtx.objectSetFactory(objectType, clientCtx, {
1221
1384
  type: "filter",
@@ -1247,7 +1410,9 @@ function createObjectSet(objectType, clientCtx, objectSet = {
1247
1410
  asyncIter: async function* () {
1248
1411
  let $nextPageToken = void 0;
1249
1412
  do {
1250
- const result = await base.fetchPage({
1413
+ const result = await fetchPageInternal(augmentRequestContext(clientCtx, (_) => ({
1414
+ finalMethodCall: "asyncIter"
1415
+ })), objectType, objectSet, {
1251
1416
  $nextPageToken
1252
1417
  });
1253
1418
  $nextPageToken = result.nextPageToken;
@@ -1266,7 +1431,9 @@ function createObjectSet(objectType, clientCtx, objectSet = {
1266
1431
  value: primaryKey
1267
1432
  }
1268
1433
  };
1269
- return await fetchSingle(clientCtx, objectType, options, withPk);
1434
+ return await fetchSingle(augmentRequestContext(clientCtx, (_) => ({
1435
+ finalMethodCall: "fetchOne"
1436
+ })), objectType, options, withPk);
1270
1437
  } : void 0,
1271
1438
  fetchOneWithErrors: isObjectTypeDefinition(objectType) ? async (primaryKey, options) => {
1272
1439
  const withPk = {
@@ -1278,7 +1445,9 @@ function createObjectSet(objectType, clientCtx, objectSet = {
1278
1445
  value: primaryKey
1279
1446
  }
1280
1447
  };
1281
- return await fetchSingleWithErrors(clientCtx, objectType, options, withPk);
1448
+ return await fetchSingleWithErrors(augmentRequestContext(clientCtx, (_) => ({
1449
+ finalMethodCall: "fetchOneWithErrors"
1450
+ })), objectType, options, withPk);
1282
1451
  } : void 0
1283
1452
  };
1284
1453
  function createSearchAround(link) {
@@ -1338,7 +1507,7 @@ var DollarLinkProxyHandler = {
1338
1507
 
1339
1508
  // src/object/convertWireToOsdkObjects/createOsdkObject.ts
1340
1509
  var objectPrototypeCache = createClientCache(function(client, objectDef) {
1341
- return Object.create(process.env.target !== "browser" ? OsdkCustomInspectPrototype : null, {
1510
+ return Object.create(null, {
1342
1511
  [ObjectDefRef]: {
1343
1512
  value: objectDef
1344
1513
  },
@@ -1389,6 +1558,9 @@ function createOsdkObject(client, objectDef, rawObj) {
1389
1558
  }
1390
1559
  return createAttachmentFromRid(client, rawValue.rid);
1391
1560
  }
1561
+ if (propDef.type === "numericTimeseries" || propDef.type === "stringTimeseries") {
1562
+ return createTimeseriesProperty(client, objectDef.apiName, target[RawObject][objectDef.primaryKeyApiName], p);
1563
+ }
1392
1564
  }
1393
1565
  return rawValue;
1394
1566
  }
@@ -1473,7 +1645,7 @@ function reframeAsObjectInPlace(objectDef, interfaceApiName, rawObj) {
1473
1645
  function isConforming(client, def, obj, propsToCheck) {
1474
1646
  for (const propName of propsToCheck) {
1475
1647
  if (def.properties[propName].nullable === false && obj[propName] == null) {
1476
- if (process.env.NODE_ENV !== "production") {
1648
+ if (process?.env?.NODE_ENV !== "production") {
1477
1649
  client.logger?.debug({
1478
1650
  obj: {
1479
1651
  $objectType: obj["$objectType"],
@@ -1538,7 +1710,7 @@ function objectSetToSearchJsonV2(objectSet, expectedApiName, existingWhere = voi
1538
1710
  throw new Error(`Unsupported objectSet type: ${objectSet.type}`);
1539
1711
  }
1540
1712
  async function fetchInterfacePage(client, interfaceType, args, objectSet) {
1541
- const result = await esm_exports2.OntologyObjectsV2.searchObjectsForInterface(addUserAgent(client, interfaceType), await client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {
1713
+ const result = await esm_exports2.OntologyObjectsV2.searchObjectsForInterface(addUserAgentAndRequestContextHeaders(client, interfaceType), await client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {
1542
1714
  augmentedProperties: args.$augment ?? {},
1543
1715
  augmentedSharedPropertyTypes: {},
1544
1716
  otherInterfaceTypes: [],
@@ -1605,7 +1777,7 @@ function applyFetchArgs(args, body) {
1605
1777
  return body;
1606
1778
  }
1607
1779
  async function fetchObjectPage(client, objectType, args, objectSet) {
1608
- const r = await esm_exports2.OntologyObjectSets.loadObjectSetV2(addUserAgent(client, objectType), await client.ontologyRid, applyFetchArgs(args, {
1780
+ const r = await esm_exports2.OntologyObjectSets.loadObjectSetV2(addUserAgentAndRequestContextHeaders(client, objectType), await client.ontologyRid, applyFetchArgs(args, {
1609
1781
  objectSet,
1610
1782
  // We have to do the following case because LoadObjectSetRequestV2 isn't readonly
1611
1783
  select: args?.$select ?? [],
@@ -1618,19 +1790,6 @@ async function fetchObjectPage(client, objectType, args, objectSet) {
1618
1790
  });
1619
1791
  }
1620
1792
 
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
1793
  // src/util/isOntologyObjectV2.ts
1635
1794
  function isOntologyObjectV2(o) {
1636
1795
  return o && typeof o === "object" && typeof o.__apiName === "string" && o.__primaryKey != null;
@@ -1683,8 +1842,11 @@ async function toDataValue(value, client) {
1683
1842
 
1684
1843
  // src/actions/applyAction.ts
1685
1844
  async function applyAction2(client, action, parameters, options = {}) {
1845
+ const clientWithHeaders = addUserAgentAndRequestContextHeaders(augmentRequestContext(client, (_) => ({
1846
+ finalMethodCall: "applyAction"
1847
+ })), action);
1686
1848
  if (Array.isArray(parameters)) {
1687
- const response = await esm_exports2.Actions.applyActionBatchV2(addUserAgent(client, action), await client.ontologyRid, action.apiName, {
1849
+ const response = await esm_exports2.Actions.applyActionBatchV2(clientWithHeaders, await client.ontologyRid, action.apiName, {
1688
1850
  requests: parameters ? await remapBatchActionParams(parameters, client) : [],
1689
1851
  options: {
1690
1852
  returnEdits: options?.$returnEdits ? "ALL" : "NONE"
@@ -1692,7 +1854,7 @@ async function applyAction2(client, action, parameters, options = {}) {
1692
1854
  });
1693
1855
  return options?.$returnEdits ? response.edits : void 0;
1694
1856
  } else {
1695
- const response = await esm_exports2.Actions.applyActionV2(addUserAgent(client, action), await client.ontologyRid, action.apiName, {
1857
+ const response = await esm_exports2.Actions.applyActionV2(clientWithHeaders, await client.ontologyRid, action.apiName, {
1696
1858
  parameters: await remapActionParams(parameters, client),
1697
1859
  options: {
1698
1860
  mode: options?.$validateOnly ? "VALIDATE_ONLY" : "VALIDATE_AND_EXECUTE",
@@ -1779,7 +1941,7 @@ var createStandardOntologyProviderFactory = (client) => {
1779
1941
  };
1780
1942
 
1781
1943
  // src/util/UserAgent.ts
1782
- var USER_AGENT = `osdk-client/${"0.20.0-beta.4"}`;
1944
+ var USER_AGENT = `osdk-client/${"0.20.1"}`;
1783
1945
 
1784
1946
  // src/createMinimalClient.ts
1785
1947
  function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {
@@ -1796,7 +1958,8 @@ function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fet
1796
1958
  objectSetFactory,
1797
1959
  ontologyRid: metadata.ontologyRid,
1798
1960
  logger: options.logger,
1799
- clientCacheKey: {}
1961
+ clientCacheKey: {},
1962
+ requestContext: {}
1800
1963
  };
1801
1964
  return Object.assign(minimalClient, {
1802
1965
  ontologyProvider: createStandardOntologyProviderFactory()(minimalClient)
@@ -1886,7 +2049,9 @@ async function toDataValueQueries(value, client, desiredType) {
1886
2049
 
1887
2050
  // src/queries/applyQuery.ts
1888
2051
  async function applyQuery(client, query, params) {
1889
- const response = await esm_exports2.QueryTypes.executeQueryV2(addUserAgent(client, query), await client.ontologyRid, query.apiName, {
2052
+ const response = await esm_exports2.QueryTypes.executeQueryV2(addUserAgentAndRequestContextHeaders(augmentRequestContext(client, (_) => ({
2053
+ finalMethodCall: "applyQuery"
2054
+ })), query), await client.ontologyRid, query.apiName, {
1890
2055
  parameters: params ? await remapQueryParams(params, client, query.parameters) : {}
1891
2056
  });
1892
2057
  const objectOutputDefs = await getRequiredDefinitions(query.output, client);
@@ -2111,10 +2276,11 @@ exports.USER_AGENT = USER_AGENT;
2111
2276
  exports.augment = augment;
2112
2277
  exports.convertWireToOsdkObjects = convertWireToOsdkObjects;
2113
2278
  exports.createAttachmentFromRid = createAttachmentFromRid;
2279
+ exports.createAttachmentUpload = createAttachmentUpload;
2114
2280
  exports.createClient = createClient;
2115
2281
  exports.createClientInternal = createClientInternal;
2116
2282
  exports.createObjectSet = createObjectSet;
2117
2283
  exports.createSimpleAsyncCache = createSimpleAsyncCache;
2118
2284
  exports.esm_exports = esm_exports2;
2119
- //# sourceMappingURL=out.js.map
2120
- //# sourceMappingURL=chunk-4FXEPHWC.cjs.map
2285
+ //# sourceMappingURL=chunk-JVA3MVZE.cjs.map
2286
+ //# sourceMappingURL=chunk-JVA3MVZE.cjs.map