@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
@@ -2,7 +2,7 @@ import { symbolClientContext } from '@osdk/shared.client';
2
2
  import { PalantirApiError, UnknownError } from '@osdk/shared.net.errors';
3
3
  import { createFetchHeaderMutator } from '@osdk/shared.net.fetch';
4
4
  import invariant from 'tiny-invariant';
5
- import { DistanceUnitMapping, DurationMapping } from '@osdk/client.api';
5
+ import { DistanceUnitMapping, TimeseriesDurationMapping, DurationMapping } from '@osdk/client.api';
6
6
  import { createSharedClientContext } from '@osdk/shared.client.impl';
7
7
  import { wireObjectTypeFullMetadataToSdkObjectTypeDefinition, __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from '@osdk/generator-converters';
8
8
 
@@ -12,6 +12,14 @@ var __export = (target, all) => {
12
12
  __defProp(target, name, { get: all[name], enumerable: true });
13
13
  };
14
14
 
15
+ // src/actions/ActionValidationError.ts
16
+ var ActionValidationError = class extends Error {
17
+ constructor(validation) {
18
+ super("Validation Error");
19
+ this.validation = validation;
20
+ }
21
+ };
22
+
15
23
  // ../internal.foundry.datasets/build/esm/chunk-PZ5AY32C.js
16
24
  var __defProp2 = Object.defineProperty;
17
25
  var __export2 = (target, all) => {
@@ -398,6 +406,7 @@ var esm_exports2 = {};
398
406
  __export(esm_exports2, {
399
407
  ActionTypesV2: () => ActionTypeV2_exports,
400
408
  Actions: () => Action_exports,
409
+ Attachments: () => Attachment_exports2,
401
410
  ObjectTypesV2: () => ObjectTypeV2_exports,
402
411
  OntologiesV2: () => OntologyV2_exports,
403
412
  OntologyObjectSets: () => OntologyObjectSet_exports,
@@ -414,6 +423,26 @@ var __export5 = (target, all) => {
414
423
  });
415
424
  };
416
425
 
426
+ // ../internal.foundry.ontologiesv2/build/esm/chunk-ASYINYCV.js
427
+ var QueryType_exports2 = {};
428
+ __export5(QueryType_exports2, {
429
+ executeQueryV2: () => executeQueryV2,
430
+ getQueryTypeV2: () => getQueryTypeV2,
431
+ listQueryTypesV2: () => listQueryTypesV2
432
+ });
433
+ var _listQueryTypesV2 = [0, "/v2/ontologies/{0}/queryTypes", 2];
434
+ function listQueryTypesV2($ctx, ...args) {
435
+ return foundryPlatformFetch($ctx, _listQueryTypesV2, ...args);
436
+ }
437
+ var _getQueryTypeV2 = [0, "/v2/ontologies/{0}/queryTypes/{1}"];
438
+ function getQueryTypeV2($ctx, ...args) {
439
+ return foundryPlatformFetch($ctx, _getQueryTypeV2, ...args);
440
+ }
441
+ var _executeQueryV2 = [1, "/v2/ontologies/{0}/queries/{1}/execute", 3];
442
+ function executeQueryV2($ctx, ...args) {
443
+ return foundryPlatformFetch($ctx, _executeQueryV2, ...args);
444
+ }
445
+
417
446
  // ../internal.foundry.ontologiesv2/build/esm/chunk-B5JRDCDE.js
418
447
  var Action_exports = {};
419
448
  __export5(Action_exports, {
@@ -449,6 +478,26 @@ function getActionTypeV2($ctx, ...args) {
449
478
  return foundryPlatformFetch($ctx, _getActionTypeV2, ...args);
450
479
  }
451
480
 
481
+ // ../internal.foundry.ontologiesv2/build/esm/chunk-YGTQQ5D7.js
482
+ var Attachment_exports2 = {};
483
+ __export5(Attachment_exports2, {
484
+ getAttachmentContentV2: () => getAttachmentContentV2,
485
+ getAttachmentV2: () => getAttachmentV2,
486
+ uploadAttachmentV2: () => uploadAttachmentV2
487
+ });
488
+ var _uploadAttachmentV2 = [1, "/v2/ontologies/attachments/upload", 7, "*/*"];
489
+ function uploadAttachmentV2($ctx, ...args) {
490
+ return foundryPlatformFetch($ctx, _uploadAttachmentV2, ...args);
491
+ }
492
+ var _getAttachmentContentV2 = [0, "/v2/ontologies/attachments/{0}/content", , , "*/*"];
493
+ function getAttachmentContentV2($ctx, ...args) {
494
+ return foundryPlatformFetch($ctx, _getAttachmentContentV2, ...args);
495
+ }
496
+ var _getAttachmentV2 = [0, "/v2/ontologies/attachments/{0}"];
497
+ function getAttachmentV2($ctx, ...args) {
498
+ return foundryPlatformFetch($ctx, _getAttachmentV2, ...args);
499
+ }
500
+
452
501
  // ../internal.foundry.ontologiesv2/build/esm/chunk-6LZM4EP4.js
453
502
  var ObjectTypeV2_exports = {};
454
503
  __export5(ObjectTypeV2_exports, {
@@ -499,16 +548,15 @@ function aggregateObjectSetV2($ctx, ...args) {
499
548
  return foundryPlatformFetch($ctx, _aggregateObjectSetV2, ...args);
500
549
  }
501
550
 
502
- // ../internal.foundry.ontologiesv2/build/esm/chunk-U2YDEYVP.js
551
+ // ../internal.foundry.ontologiesv2/build/esm/chunk-KYMDEQ65.js
503
552
  var OntologyObjectV2_exports = {};
504
553
  __export5(OntologyObjectV2_exports, {
505
554
  aggregateObjectsForInterface: () => aggregateObjectsForInterface,
506
555
  aggregateObjectsV2: () => aggregateObjectsV2,
507
556
  countObjects: () => countObjects,
508
- getAttachmentByRidV2: () => getAttachmentByRidV2,
509
- getAttachmentContentByRidV2: () => getAttachmentContentByRidV2,
510
- getAttachmentContentV2: () => getAttachmentContentV2,
511
- getAttachmentsV2: () => getAttachmentsV2,
557
+ getAttachmentPropertyByRidV2: () => getAttachmentPropertyByRidV2,
558
+ getAttachmentPropertyContentByRidV2: () => getAttachmentPropertyContentByRidV2,
559
+ getAttachmentPropertyContentV2: () => getAttachmentPropertyContentV2,
512
560
  getFirstPoint: () => getFirstPoint,
513
561
  getInterfaceType: () => getInterfaceType,
514
562
  getLastPoint: () => getLastPoint,
@@ -518,6 +566,7 @@ __export5(OntologyObjectV2_exports, {
518
566
  listInterfaceTypes: () => listInterfaceTypes,
519
567
  listLinkedObjectsV2: () => listLinkedObjectsV2,
520
568
  listObjectsV2: () => listObjectsV2,
569
+ listPropertyAttachments: () => listPropertyAttachments,
521
570
  searchObjectsForInterface: () => searchObjectsForInterface,
522
571
  searchObjectsV2: () => searchObjectsV2,
523
572
  streamPoints: () => streamPoints
@@ -566,21 +615,21 @@ var _getLinkedObjectV2 = [0, "/v2/ontologies/{0}/objects/{1}/{2}/links/{3}/{4}",
566
615
  function getLinkedObjectV2($ctx, ...args) {
567
616
  return foundryPlatformFetch($ctx, _getLinkedObjectV2, ...args);
568
617
  }
569
- var _getAttachmentsV2 = [0, "/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}", 2];
570
- function getAttachmentsV2($ctx, ...args) {
571
- return foundryPlatformFetch($ctx, _getAttachmentsV2, ...args);
618
+ var _listPropertyAttachments = [0, "/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}", 2];
619
+ function listPropertyAttachments($ctx, ...args) {
620
+ return foundryPlatformFetch($ctx, _listPropertyAttachments, ...args);
572
621
  }
573
- var _getAttachmentByRidV2 = [0, "/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}/{4}", 2];
574
- function getAttachmentByRidV2($ctx, ...args) {
575
- return foundryPlatformFetch($ctx, _getAttachmentByRidV2, ...args);
622
+ var _getAttachmentPropertyByRidV2 = [0, "/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}/{4}", 2];
623
+ function getAttachmentPropertyByRidV2($ctx, ...args) {
624
+ return foundryPlatformFetch($ctx, _getAttachmentPropertyByRidV2, ...args);
576
625
  }
577
- var _getAttachmentContentV2 = [0, "/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}/content", 2, , "*/*"];
578
- function getAttachmentContentV2($ctx, ...args) {
579
- return foundryPlatformFetch($ctx, _getAttachmentContentV2, ...args);
626
+ var _getAttachmentPropertyContentV2 = [0, "/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}/content", 2, , "*/*"];
627
+ function getAttachmentPropertyContentV2($ctx, ...args) {
628
+ return foundryPlatformFetch($ctx, _getAttachmentPropertyContentV2, ...args);
580
629
  }
581
- var _getAttachmentContentByRidV2 = [0, "/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}/{4}/content", 2, , "*/*"];
582
- function getAttachmentContentByRidV2($ctx, ...args) {
583
- return foundryPlatformFetch($ctx, _getAttachmentContentByRidV2, ...args);
630
+ var _getAttachmentPropertyContentByRidV2 = [0, "/v2/ontologies/{0}/objects/{1}/{2}/attachments/{3}/{4}/content", 2, , "*/*"];
631
+ function getAttachmentPropertyContentByRidV2($ctx, ...args) {
632
+ return foundryPlatformFetch($ctx, _getAttachmentPropertyContentByRidV2, ...args);
584
633
  }
585
634
  var _getFirstPoint = [0, "/v2/ontologies/{0}/objects/{1}/{2}/timeseries/{3}/firstPoint", 2];
586
635
  function getFirstPoint($ctx, ...args) {
@@ -619,26 +668,6 @@ function getOntologyFullMetadata($ctx, ...args) {
619
668
  return foundryPlatformFetch($ctx, _getOntologyFullMetadata, ...args);
620
669
  }
621
670
 
622
- // ../internal.foundry.ontologiesv2/build/esm/chunk-ASYINYCV.js
623
- var QueryType_exports2 = {};
624
- __export5(QueryType_exports2, {
625
- executeQueryV2: () => executeQueryV2,
626
- getQueryTypeV2: () => getQueryTypeV2,
627
- listQueryTypesV2: () => listQueryTypesV2
628
- });
629
- var _listQueryTypesV2 = [0, "/v2/ontologies/{0}/queryTypes", 2];
630
- function listQueryTypesV2($ctx, ...args) {
631
- return foundryPlatformFetch($ctx, _listQueryTypesV2, ...args);
632
- }
633
- var _getQueryTypeV2 = [0, "/v2/ontologies/{0}/queryTypes/{1}"];
634
- function getQueryTypeV2($ctx, ...args) {
635
- return foundryPlatformFetch($ctx, _getQueryTypeV2, ...args);
636
- }
637
- var _executeQueryV2 = [1, "/v2/ontologies/{0}/queries/{1}/execute", 3];
638
- function executeQueryV2($ctx, ...args) {
639
- return foundryPlatformFetch($ctx, _executeQueryV2, ...args);
640
- }
641
-
642
671
  // src/createAttachmentFromRid.ts
643
672
  function createAttachmentFromRid(client, rid) {
644
673
  return {
@@ -651,17 +680,164 @@ function createAttachmentFromRid(client, rid) {
651
680
  }
652
681
  };
653
682
  }
654
- function addUserAgent(client, withMetadata) {
655
- if (withMetadata.osdkMetadata) {
683
+
684
+ // src/object/AttachmentUpload.ts
685
+ function isAttachmentUpload(o) {
686
+ return o instanceof Blob && "name" in o;
687
+ }
688
+ function createAttachmentUpload(data, name) {
689
+ const attachmentUpload = Object.create(data, {
690
+ name: {
691
+ value: name
692
+ }
693
+ });
694
+ return attachmentUpload;
695
+ }
696
+ var addUserAgentAndRequestContextHeaders = (client, withMetadata) => ({
697
+ ...client,
698
+ fetch: createFetchHeaderMutator(client.fetch, (headers) => {
699
+ if (withMetadata.osdkMetadata) {
700
+ headers.set("Fetch-User-Agent", withMetadata.osdkMetadata.extraUserAgent);
701
+ }
702
+ return headers;
703
+ })
704
+ });
705
+
706
+ // src/util/streamutils.ts
707
+ var START_TOKEN = new Uint8Array([123, 34, 100, 97, 116, 97, 34, 58, 91]);
708
+ var OBJECT_OPEN_CHAR_CODE = 123;
709
+ var OBJECT_CLOSE_CHAR_CODE = 125;
710
+ async function* parseStreamedResponse(asyncIterable) {
711
+ const utf8decoder = new TextDecoder("utf-8");
712
+ let parsedStart = false;
713
+ let prevChunks = [];
714
+ let openBracesCount = 0;
715
+ for await (let chunk of asyncIterable) {
716
+ let i = 0;
717
+ if (!parsedStart) {
718
+ parsedStart = true;
719
+ if (startsWith(chunk, START_TOKEN)) {
720
+ i = START_TOKEN.length;
721
+ }
722
+ }
723
+ for (; i < chunk.length; i++) {
724
+ while (openBracesCount === 0 && chunk[i] !== OBJECT_OPEN_CHAR_CODE && i < chunk.length) {
725
+ i++;
726
+ }
727
+ let j = i;
728
+ for (; j < chunk.length; j++) {
729
+ const c = chunk[j];
730
+ if (c === OBJECT_OPEN_CHAR_CODE) {
731
+ openBracesCount++;
732
+ } else if (c === OBJECT_CLOSE_CHAR_CODE) {
733
+ openBracesCount--;
734
+ if (0 === openBracesCount) {
735
+ yield combineAndParse(utf8decoder, prevChunks, chunk.subarray(i, j + 1));
736
+ prevChunks = [];
737
+ i = j;
738
+ break;
739
+ }
740
+ }
741
+ }
742
+ if (j === chunk.length) {
743
+ prevChunks.push(chunk.subarray(i));
744
+ break;
745
+ }
746
+ }
747
+ }
748
+ }
749
+ function startsWith(a, b) {
750
+ if (a.length < b.length) {
751
+ return false;
752
+ }
753
+ for (let i = 0; i < b.length; i++) {
754
+ if (a[i] !== b[i]) {
755
+ return false;
756
+ }
757
+ }
758
+ return true;
759
+ }
760
+ function combineAndParse(utf8decoder, prev, curr) {
761
+ let str = "";
762
+ for (const chunk of prev) {
763
+ str += utf8decoder.decode(chunk, {
764
+ stream: true
765
+ });
766
+ }
767
+ str += utf8decoder.decode(curr);
768
+ return JSON.parse(str);
769
+ }
770
+ async function* iterateReadableStream(readableStream) {
771
+ let res = await readableStream.read();
772
+ while (!res.done) {
773
+ yield res.value;
774
+ res = await readableStream.read();
775
+ }
776
+ }
777
+
778
+ // src/createTimeseriesProperty.ts
779
+ function createTimeseriesProperty(client, objectApiName, primaryKey, propertyName) {
780
+ return {
781
+ async getFirstPoint() {
782
+ return esm_exports2.OntologyObjectsV2.getFirstPoint(client, await client.ontologyRid, objectApiName, primaryKey, propertyName);
783
+ },
784
+ async getLastPoint() {
785
+ return esm_exports2.OntologyObjectsV2.getLastPoint(client, await client.ontologyRid, objectApiName, primaryKey, propertyName);
786
+ },
787
+ async getAllPoints(query) {
788
+ return getAllTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, query);
789
+ },
790
+ asyncIterPoints(query) {
791
+ return iterateTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, query);
792
+ }
793
+ };
794
+ }
795
+ async function getAllTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, body) {
796
+ const allPoints = [];
797
+ for await (const point of iterateTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, body)) {
798
+ allPoints.push({
799
+ time: point.time,
800
+ value: point.value
801
+ });
802
+ }
803
+ return allPoints;
804
+ }
805
+ async function* iterateTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, body) {
806
+ new TextDecoder("utf-8");
807
+ const streamPointsIterator = await esm_exports2.OntologyObjectsV2.streamPoints(client, await client.ontologyRid, objectApiName, primaryKey, propertyName, body ? {
808
+ range: getTimeRange(body)
809
+ } : {});
810
+ const reader = streamPointsIterator.stream().getReader();
811
+ for await (const point of parseStreamedResponse(iterateReadableStream(reader))) {
812
+ yield {
813
+ time: point.time,
814
+ value: point.value
815
+ };
816
+ }
817
+ }
818
+ function getTimeRange(body) {
819
+ if ("$startTime" in body || "$endTime" in body) {
656
820
  return {
657
- ...client,
658
- fetch: createFetchHeaderMutator(client.fetch, (headers) => {
659
- headers.set("Fetch-User-Agent", withMetadata.osdkMetadata.extraUserAgent);
660
- return headers;
661
- })
821
+ type: "absolute",
822
+ startTime: body.$startTime,
823
+ endTime: body.$endTime
662
824
  };
663
825
  }
664
- return client;
826
+ return body.$before ? {
827
+ type: "relative",
828
+ startTime: {
829
+ when: "BEFORE",
830
+ value: body.$before,
831
+ unit: TimeseriesDurationMapping[body.$unit]
832
+ }
833
+ } : {
834
+ type: "relative",
835
+ endTime: {
836
+ when: "AFTER",
837
+ value: body.$after,
838
+ unit: TimeseriesDurationMapping[body.$unit]
839
+ }
840
+ };
665
841
  }
666
842
 
667
843
  // src/object/Cache.ts
@@ -778,34 +954,6 @@ var InterfaceDefRef = Symbol(process.env.MODE !== "production" ? "InterfaceDefin
778
954
  var RawObject = Symbol(process.env.MODE !== "production" ? "RawObject" : void 0);
779
955
  var ClientRef = Symbol(process.env.MODE !== "production" ? "ClientRef" : void 0);
780
956
 
781
- // src/object/convertWireToOsdkObjects/OsdkCustomInspectPrototype.ts
782
- var OsdkCustomInspectPrototype = Object.create(null, {
783
- [Symbol.for("nodejs.util.inspect.custom")]: {
784
- value: customInspect
785
- }
786
- });
787
- function customInspect(_depth, options, localInspect) {
788
- const newOptions = {
789
- ...options,
790
- depth: options.depth == null ? null : options.depth - 1
791
- };
792
- let ret = `Osdk<${options.stylize(this[ObjectDefRef]?.apiName ?? this[InterfaceDefRef]?.apiName, "special")}> {
793
- `;
794
- for (const k of /* @__PURE__ */ new Set(["$apiName", "$objectType", "$primaryKey", ...Reflect.ownKeys(this)])) {
795
- if (typeof k === "symbol") continue;
796
- ret += ` ${options.stylize(k.toString(), "undefined")}: ${localInspect(this[k], newOptions)}
797
- `;
798
- }
799
- if (this[UnderlyingOsdkObject] !== this) {
800
- ret += "\n";
801
- ret += ` ${options.stylize("$as", "special")}: ${localInspect(this[UnderlyingOsdkObject], newOptions).replace(/\n/g, `
802
- `)}`;
803
- ret += "\n";
804
- }
805
- ret += "}";
806
- return ret;
807
- }
808
-
809
957
  // src/object/convertWireToOsdkObjects/createOsdkInterface.ts
810
958
  var handlerCache = createSimpleCache(/* @__PURE__ */ new WeakMap(), createInterfaceProxyHandler);
811
959
  function createOsdkInterface(underlying, interfaceDef) {
@@ -830,7 +978,8 @@ function createInterfaceProxyHandler(newDef) {
830
978
  case "$primaryKey":
831
979
  case "$title":
832
980
  case "$objectType":
833
- return Reflect.getOwnPropertyDescriptor(underlying, p);
981
+ case "$rid":
982
+ return underlying[p] != null ? Reflect.getOwnPropertyDescriptor(underlying, p) : void 0;
834
983
  case "$apiName":
835
984
  return {
836
985
  enumerable: true,
@@ -847,7 +996,8 @@ function createInterfaceProxyHandler(newDef) {
847
996
  }
848
997
  },
849
998
  ownKeys(target) {
850
- return ["$apiName", "$objectType", "$primaryKey", "$title", ...Object.keys(newDef.properties)];
999
+ const underlying = target[UnderlyingOsdkObject];
1000
+ return ["$apiName", "$objectType", "$primaryKey", ...underlying["$rid"] ? ["$rid"] : [], "$title", ...Object.keys(newDef.properties)];
851
1001
  },
852
1002
  get(target, p) {
853
1003
  const underlying = target[UnderlyingOsdkObject];
@@ -861,6 +1011,7 @@ function createInterfaceProxyHandler(newDef) {
861
1011
  case "$primaryKey":
862
1012
  case "$title":
863
1013
  case "$objectType":
1014
+ case "$rid":
864
1015
  return underlying[p];
865
1016
  }
866
1017
  if (newDef.properties[p] != null) {
@@ -985,9 +1136,9 @@ function handleWherePair([field, filter]) {
985
1136
  const withinBody = filter[firstKey];
986
1137
  if (Array.isArray(withinBody)) {
987
1138
  return makeGeoFilterBbox(field, withinBody, firstKey);
988
- } else if ("$bbox" in withinBody) {
1139
+ } else if ("$bbox" in withinBody && withinBody.$bbox != null) {
989
1140
  return makeGeoFilterBbox(field, withinBody.$bbox, firstKey);
990
- } else if ("$distance" in withinBody && "$of" in withinBody) {
1141
+ } else if ("$distance" in withinBody && "$of" in withinBody && withinBody.$distance != null && withinBody.$of != null) {
991
1142
  return {
992
1143
  type: "withinDistanceOf",
993
1144
  field,
@@ -1011,7 +1162,7 @@ function handleWherePair([field, filter]) {
1011
1162
  const intersectsBody = filter[firstKey];
1012
1163
  if (Array.isArray(intersectsBody)) {
1013
1164
  return makeGeoFilterBbox(field, intersectsBody, firstKey);
1014
- } else if ("$bbox" in intersectsBody) {
1165
+ } else if ("$bbox" in intersectsBody && intersectsBody.$bbox != null) {
1015
1166
  return makeGeoFilterBbox(field, intersectsBody.$bbox, firstKey);
1016
1167
  } else {
1017
1168
  const coordinates = "$polygon" in intersectsBody ? intersectsBody.$polygon : intersectsBody.coordinates;
@@ -1124,7 +1275,7 @@ async function aggregate(clientCtx, objectType, objectSet = {
1124
1275
  if (req.$where) {
1125
1276
  body.where = modernToLegacyWhereClause(req.$where);
1126
1277
  }
1127
- const result = await esm_exports2.OntologyObjectSets.aggregateObjectSetV2(addUserAgent(clientCtx, objectType), await clientCtx.ontologyRid, {
1278
+ const result = await esm_exports2.OntologyObjectSets.aggregateObjectSetV2(addUserAgentAndRequestContextHeaders(clientCtx, objectType), await clientCtx.ontologyRid, {
1128
1279
  objectSet,
1129
1280
  groupBy: body.groupBy,
1130
1281
  aggregation: body.aggregation
@@ -1182,6 +1333,15 @@ async function fetchSingleWithErrors(client, objectType, args, objectSet) {
1182
1333
  }
1183
1334
  }
1184
1335
 
1336
+ // src/util/augmentRequestContext.ts
1337
+ var augmentRequestContext = (client, augment2) => ({
1338
+ ...client,
1339
+ requestContext: {
1340
+ ...client.requestContext,
1341
+ ...augment2(client.requestContext)
1342
+ }
1343
+ });
1344
+
1185
1345
  // src/util/WireObjectSet.ts
1186
1346
  var WIRE_OBJECT_SET_TYPES = /* @__PURE__ */ new Set(["base", "filter", "intersect", "reference", "searchAround", "static", "subtract", "union"]);
1187
1347
  function isWireObjectSet(o) {
@@ -1204,9 +1364,15 @@ function createObjectSet(objectType, clientCtx, objectSet = {
1204
1364
  objectType: objectType["apiName"]
1205
1365
  }) {
1206
1366
  const base = {
1207
- aggregate: aggregate.bind(globalThis, clientCtx, objectType, objectSet),
1208
- fetchPage: fetchPageInternal.bind(globalThis, clientCtx, objectType, objectSet),
1209
- fetchPageWithErrors: fetchPageWithErrorsInternal.bind(globalThis, clientCtx, objectType, objectSet),
1367
+ aggregate: aggregate.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
1368
+ finalMethodCall: "aggregate"
1369
+ })), objectType, objectSet),
1370
+ fetchPage: fetchPageInternal.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
1371
+ finalMethodCall: "fetchPage"
1372
+ })), objectType, objectSet),
1373
+ fetchPageWithErrors: fetchPageWithErrorsInternal.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
1374
+ finalMethodCall: "fetchPageWithErrors"
1375
+ })), objectType, objectSet),
1210
1376
  where: (clause) => {
1211
1377
  return clientCtx.objectSetFactory(objectType, clientCtx, {
1212
1378
  type: "filter",
@@ -1238,7 +1404,9 @@ function createObjectSet(objectType, clientCtx, objectSet = {
1238
1404
  asyncIter: async function* () {
1239
1405
  let $nextPageToken = void 0;
1240
1406
  do {
1241
- const result = await base.fetchPage({
1407
+ const result = await fetchPageInternal(augmentRequestContext(clientCtx, (_) => ({
1408
+ finalMethodCall: "asyncIter"
1409
+ })), objectType, objectSet, {
1242
1410
  $nextPageToken
1243
1411
  });
1244
1412
  $nextPageToken = result.nextPageToken;
@@ -1257,7 +1425,9 @@ function createObjectSet(objectType, clientCtx, objectSet = {
1257
1425
  value: primaryKey
1258
1426
  }
1259
1427
  };
1260
- return await fetchSingle(clientCtx, objectType, options, withPk);
1428
+ return await fetchSingle(augmentRequestContext(clientCtx, (_) => ({
1429
+ finalMethodCall: "fetchOne"
1430
+ })), objectType, options, withPk);
1261
1431
  } : void 0,
1262
1432
  fetchOneWithErrors: isObjectTypeDefinition(objectType) ? async (primaryKey, options) => {
1263
1433
  const withPk = {
@@ -1269,7 +1439,9 @@ function createObjectSet(objectType, clientCtx, objectSet = {
1269
1439
  value: primaryKey
1270
1440
  }
1271
1441
  };
1272
- return await fetchSingleWithErrors(clientCtx, objectType, options, withPk);
1442
+ return await fetchSingleWithErrors(augmentRequestContext(clientCtx, (_) => ({
1443
+ finalMethodCall: "fetchOneWithErrors"
1444
+ })), objectType, options, withPk);
1273
1445
  } : void 0
1274
1446
  };
1275
1447
  function createSearchAround(link) {
@@ -1329,7 +1501,7 @@ var DollarLinkProxyHandler = {
1329
1501
 
1330
1502
  // src/object/convertWireToOsdkObjects/createOsdkObject.ts
1331
1503
  var objectPrototypeCache = createClientCache(function(client, objectDef) {
1332
- return Object.create(process.env.target !== "browser" ? OsdkCustomInspectPrototype : null, {
1504
+ return Object.create(null, {
1333
1505
  [ObjectDefRef]: {
1334
1506
  value: objectDef
1335
1507
  },
@@ -1380,6 +1552,9 @@ function createOsdkObject(client, objectDef, rawObj) {
1380
1552
  }
1381
1553
  return createAttachmentFromRid(client, rawValue.rid);
1382
1554
  }
1555
+ if (propDef.type === "numericTimeseries" || propDef.type === "stringTimeseries") {
1556
+ return createTimeseriesProperty(client, objectDef.apiName, target[RawObject][objectDef.primaryKeyApiName], p);
1557
+ }
1383
1558
  }
1384
1559
  return rawValue;
1385
1560
  }
@@ -1464,7 +1639,7 @@ function reframeAsObjectInPlace(objectDef, interfaceApiName, rawObj) {
1464
1639
  function isConforming(client, def, obj, propsToCheck) {
1465
1640
  for (const propName of propsToCheck) {
1466
1641
  if (def.properties[propName].nullable === false && obj[propName] == null) {
1467
- if (process.env.NODE_ENV !== "production") {
1642
+ if (process?.env?.NODE_ENV !== "production") {
1468
1643
  client.logger?.debug({
1469
1644
  obj: {
1470
1645
  $objectType: obj["$objectType"],
@@ -1529,7 +1704,7 @@ function objectSetToSearchJsonV2(objectSet, expectedApiName, existingWhere = voi
1529
1704
  throw new Error(`Unsupported objectSet type: ${objectSet.type}`);
1530
1705
  }
1531
1706
  async function fetchInterfacePage(client, interfaceType, args, objectSet) {
1532
- const result = await esm_exports2.OntologyObjectsV2.searchObjectsForInterface(addUserAgent(client, interfaceType), await client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {
1707
+ const result = await esm_exports2.OntologyObjectsV2.searchObjectsForInterface(addUserAgentAndRequestContextHeaders(client, interfaceType), await client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {
1533
1708
  augmentedProperties: args.$augment ?? {},
1534
1709
  augmentedSharedPropertyTypes: {},
1535
1710
  otherInterfaceTypes: [],
@@ -1596,7 +1771,7 @@ function applyFetchArgs(args, body) {
1596
1771
  return body;
1597
1772
  }
1598
1773
  async function fetchObjectPage(client, objectType, args, objectSet) {
1599
- const r = await esm_exports2.OntologyObjectSets.loadObjectSetV2(addUserAgent(client, objectType), await client.ontologyRid, applyFetchArgs(args, {
1774
+ const r = await esm_exports2.OntologyObjectSets.loadObjectSetV2(addUserAgentAndRequestContextHeaders(client, objectType), await client.ontologyRid, applyFetchArgs(args, {
1600
1775
  objectSet,
1601
1776
  // We have to do the following case because LoadObjectSetRequestV2 isn't readonly
1602
1777
  select: args?.$select ?? [],
@@ -1609,19 +1784,6 @@ async function fetchObjectPage(client, objectType, args, objectSet) {
1609
1784
  });
1610
1785
  }
1611
1786
 
1612
- // src/actions/ActionValidationError.ts
1613
- var ActionValidationError = class extends Error {
1614
- constructor(validation) {
1615
- super("Validation Error");
1616
- this.validation = validation;
1617
- }
1618
- };
1619
-
1620
- // src/object/AttachmentUpload.ts
1621
- function isAttachmentUpload(o) {
1622
- return o instanceof Blob && "name" in o;
1623
- }
1624
-
1625
1787
  // src/util/isOntologyObjectV2.ts
1626
1788
  function isOntologyObjectV2(o) {
1627
1789
  return o && typeof o === "object" && typeof o.__apiName === "string" && o.__primaryKey != null;
@@ -1674,8 +1836,11 @@ async function toDataValue(value, client) {
1674
1836
 
1675
1837
  // src/actions/applyAction.ts
1676
1838
  async function applyAction2(client, action, parameters, options = {}) {
1839
+ const clientWithHeaders = addUserAgentAndRequestContextHeaders(augmentRequestContext(client, (_) => ({
1840
+ finalMethodCall: "applyAction"
1841
+ })), action);
1677
1842
  if (Array.isArray(parameters)) {
1678
- const response = await esm_exports2.Actions.applyActionBatchV2(addUserAgent(client, action), await client.ontologyRid, action.apiName, {
1843
+ const response = await esm_exports2.Actions.applyActionBatchV2(clientWithHeaders, await client.ontologyRid, action.apiName, {
1679
1844
  requests: parameters ? await remapBatchActionParams(parameters, client) : [],
1680
1845
  options: {
1681
1846
  returnEdits: options?.$returnEdits ? "ALL" : "NONE"
@@ -1683,7 +1848,7 @@ async function applyAction2(client, action, parameters, options = {}) {
1683
1848
  });
1684
1849
  return options?.$returnEdits ? response.edits : void 0;
1685
1850
  } else {
1686
- const response = await esm_exports2.Actions.applyActionV2(addUserAgent(client, action), await client.ontologyRid, action.apiName, {
1851
+ const response = await esm_exports2.Actions.applyActionV2(clientWithHeaders, await client.ontologyRid, action.apiName, {
1687
1852
  parameters: await remapActionParams(parameters, client),
1688
1853
  options: {
1689
1854
  mode: options?.$validateOnly ? "VALIDATE_ONLY" : "VALIDATE_AND_EXECUTE",
@@ -1770,7 +1935,7 @@ var createStandardOntologyProviderFactory = (client) => {
1770
1935
  };
1771
1936
 
1772
1937
  // src/util/UserAgent.ts
1773
- var USER_AGENT = `osdk-client/${"0.20.0-beta.4"}`;
1938
+ var USER_AGENT = `osdk-client/${"0.20.1"}`;
1774
1939
 
1775
1940
  // src/createMinimalClient.ts
1776
1941
  function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {
@@ -1787,7 +1952,8 @@ function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fet
1787
1952
  objectSetFactory,
1788
1953
  ontologyRid: metadata.ontologyRid,
1789
1954
  logger: options.logger,
1790
- clientCacheKey: {}
1955
+ clientCacheKey: {},
1956
+ requestContext: {}
1791
1957
  };
1792
1958
  return Object.assign(minimalClient, {
1793
1959
  ontologyProvider: createStandardOntologyProviderFactory()(minimalClient)
@@ -1877,7 +2043,9 @@ async function toDataValueQueries(value, client, desiredType) {
1877
2043
 
1878
2044
  // src/queries/applyQuery.ts
1879
2045
  async function applyQuery(client, query, params) {
1880
- const response = await esm_exports2.QueryTypes.executeQueryV2(addUserAgent(client, query), await client.ontologyRid, query.apiName, {
2046
+ const response = await esm_exports2.QueryTypes.executeQueryV2(addUserAgentAndRequestContextHeaders(augmentRequestContext(client, (_) => ({
2047
+ finalMethodCall: "applyQuery"
2048
+ })), query), await client.ontologyRid, query.apiName, {
1881
2049
  parameters: params ? await remapQueryParams(params, client, query.parameters) : {}
1882
2050
  });
1883
2051
  const objectOutputDefs = await getRequiredDefinitions(query.output, client);
@@ -2097,6 +2265,6 @@ function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvi
2097
2265
  }
2098
2266
  var createClient = createClientInternal.bind(void 0, createObjectSet);
2099
2267
 
2100
- export { ActionValidationError, USER_AGENT, augment, convertWireToOsdkObjects, createAttachmentFromRid, createClient, createClientInternal, createObjectSet, createSimpleAsyncCache, esm_exports2 as esm_exports };
2101
- //# sourceMappingURL=out.js.map
2102
- //# sourceMappingURL=chunk-3ZYIZQ7V.js.map
2268
+ export { ActionValidationError, USER_AGENT, augment, convertWireToOsdkObjects, createAttachmentFromRid, createAttachmentUpload, createClient, createClientInternal, createObjectSet, createSimpleAsyncCache, esm_exports2 as esm_exports };
2269
+ //# sourceMappingURL=chunk-CBENBC5L.js.map
2270
+ //# sourceMappingURL=chunk-CBENBC5L.js.map