@osdk/client 0.20.0-beta.4 → 0.21.0-beta.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.
Files changed (96) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/build/{esm/chunk-MD6R46EZ.js → browser/chunk-H4YHNABD.js} +280 -114
  3. package/build/browser/chunk-H4YHNABD.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-HCYUJWEE.cjs} +279 -112
  9. package/build/cjs/chunk-HCYUJWEE.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/Client.d.ts +1 -1
  15. package/build/esm/MinimalClientContext.d.ts +4 -2
  16. package/build/esm/MinimalClientContext.d.ts.map +1 -1
  17. package/build/esm/__unstable/UnstableClient.d.ts +1 -1
  18. package/build/esm/__unstable/UnstableClient.d.ts.map +1 -1
  19. package/build/esm/actions/applyAction.d.ts.map +1 -1
  20. package/build/{browser/chunk-3ZYIZQ7V.js → esm/chunk-H4YHNABD.js} +280 -111
  21. package/build/esm/chunk-H4YHNABD.js.map +1 -0
  22. package/build/esm/createClient.d.ts +0 -5
  23. package/build/esm/createClient.d.ts.map +1 -1
  24. package/build/esm/createMinimalClient.d.ts +1 -9
  25. package/build/esm/createMinimalClient.d.ts.map +1 -1
  26. package/build/esm/createPlatformClient.d.ts +4 -1
  27. package/build/esm/createPlatformClient.d.ts.map +1 -1
  28. package/build/esm/createTimeseriesProperty.d.ts +4 -0
  29. package/build/esm/createTimeseriesProperty.d.ts.map +1 -0
  30. package/build/esm/index.d.ts +6 -4
  31. package/build/esm/index.d.ts.map +1 -1
  32. package/build/esm/index.js +5 -9
  33. package/build/esm/index.js.map +1 -1
  34. package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.d.ts +1 -5
  35. package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.d.ts.map +1 -1
  36. package/build/esm/internal/conversions/modernToLegacyAggregationClause.d.ts +1 -3
  37. package/build/esm/internal/conversions/modernToLegacyAggregationClause.d.ts.map +1 -1
  38. package/build/esm/internal/conversions/modernToLegacyGroupByClause.d.ts +1 -3
  39. package/build/esm/internal/conversions/modernToLegacyGroupByClause.d.ts.map +1 -1
  40. package/build/esm/internal/conversions/modernToLegacyWhereClause.d.ts +1 -4
  41. package/build/esm/internal/conversions/modernToLegacyWhereClause.d.ts.map +1 -1
  42. package/build/esm/object/aggregate.d.ts +1 -7
  43. package/build/esm/object/aggregate.d.ts.map +1 -1
  44. package/build/esm/object/convertWireToOsdkObjects/ObjectHolder.d.ts +1 -20
  45. package/build/esm/object/convertWireToOsdkObjects/ObjectHolder.d.ts.map +1 -1
  46. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.d.ts +1 -5
  47. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.d.ts.map +1 -1
  48. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.d.ts +1 -5
  49. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.d.ts.map +1 -1
  50. package/build/esm/object/convertWireToOsdkObjects/getDollarAs.d.ts +0 -5
  51. package/build/esm/object/convertWireToOsdkObjects/getDollarAs.d.ts.map +1 -1
  52. package/build/esm/object/convertWireToOsdkObjects/getDollarLink.d.ts +1 -3
  53. package/build/esm/object/convertWireToOsdkObjects/getDollarLink.d.ts.map +1 -1
  54. package/build/esm/object/convertWireToOsdkObjects.d.ts +1 -21
  55. package/build/esm/object/convertWireToOsdkObjects.d.ts.map +1 -1
  56. package/build/esm/object/fetchPage.d.ts +2 -13
  57. package/build/esm/object/fetchPage.d.ts.map +1 -1
  58. package/build/esm/object/fetchSingle.d.ts +1 -6
  59. package/build/esm/object/fetchSingle.d.ts.map +1 -1
  60. package/build/esm/object/timeseries.test.d.ts +2 -0
  61. package/build/esm/object/timeseries.test.d.ts.map +1 -0
  62. package/build/esm/objectSet/ObjectSetFactory.d.ts +1 -5
  63. package/build/esm/objectSet/ObjectSetFactory.d.ts.map +1 -1
  64. package/build/esm/objectSet/ObjectSetListenerWebsocket.d.ts +0 -15
  65. package/build/esm/objectSet/ObjectSetListenerWebsocket.d.ts.map +1 -1
  66. package/build/esm/objectSet/createObjectSet.d.ts +1 -8
  67. package/build/esm/objectSet/createObjectSet.d.ts.map +1 -1
  68. package/build/esm/objectSet/createUnstableObjectSet.d.ts +0 -3
  69. package/build/esm/objectSet/createUnstableObjectSet.d.ts.map +1 -1
  70. package/build/esm/objectSet/toConjureObjectSet.d.ts +1 -6
  71. package/build/esm/objectSet/toConjureObjectSet.d.ts.map +1 -1
  72. package/build/esm/ontology/OntologyProvider.d.ts +1 -1
  73. package/build/esm/ontology/OntologyProvider.d.ts.map +1 -1
  74. package/build/esm/public/unstable-do-not-use.js +13 -13
  75. package/build/esm/public/unstable-do-not-use.js.map +1 -1
  76. package/build/esm/queries/applyQuery.d.ts.map +1 -1
  77. package/build/esm/util/WireObjectSet.d.ts +1 -2
  78. package/build/esm/util/WireObjectSet.d.ts.map +1 -1
  79. package/build/esm/util/addUserAgentAndRequestContextHeaders.d.ts +4 -0
  80. package/build/esm/util/addUserAgentAndRequestContextHeaders.d.ts.map +1 -0
  81. package/build/esm/util/augmentRequestContext.d.ts +32 -0
  82. package/build/esm/util/augmentRequestContext.d.ts.map +1 -0
  83. package/build/esm/util/isOntologyObjectV2.d.ts +1 -2
  84. package/build/esm/util/isOntologyObjectV2.d.ts.map +1 -1
  85. package/build/esm/util/streamutils.d.ts +3 -0
  86. package/build/esm/util/streamutils.d.ts.map +1 -0
  87. package/build/esm/util/toDataValue.d.ts +1 -8
  88. package/build/esm/util/toDataValue.d.ts.map +1 -1
  89. package/build/esm/util/toDataValueQueries.d.ts +1 -9
  90. package/build/esm/util/toDataValueQueries.d.ts.map +1 -1
  91. package/package.json +18 -18
  92. package/build/browser/chunk-3ZYIZQ7V.js.map +0 -1
  93. package/build/cjs/chunk-4FXEPHWC.cjs.map +0 -1
  94. package/build/esm/chunk-MD6R46EZ.js.map +0 -1
  95. package/build/esm/util/addUserAgent.d.ts +0 -4
  96. 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,165 @@ 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
+ headers.set("X-OSDK-Request-Context", JSON.stringify(client.requestContext));
700
+ if (withMetadata.osdkMetadata) {
701
+ headers.set("Fetch-User-Agent", withMetadata.osdkMetadata.extraUserAgent);
702
+ }
703
+ return headers;
704
+ })
705
+ });
706
+
707
+ // src/util/streamutils.ts
708
+ var START_TOKEN = new Uint8Array([123, 34, 100, 97, 116, 97, 34, 58, 91]);
709
+ var OBJECT_OPEN_CHAR_CODE = 123;
710
+ var OBJECT_CLOSE_CHAR_CODE = 125;
711
+ async function* parseStreamedResponse(asyncIterable) {
712
+ const utf8decoder = new TextDecoder("utf-8");
713
+ let parsedStart = false;
714
+ let prevChunks = [];
715
+ let openBracesCount = 0;
716
+ for await (let chunk of asyncIterable) {
717
+ let i = 0;
718
+ if (!parsedStart) {
719
+ parsedStart = true;
720
+ if (startsWith(chunk, START_TOKEN)) {
721
+ i = START_TOKEN.length;
722
+ }
723
+ }
724
+ for (; i < chunk.length; i++) {
725
+ while (openBracesCount === 0 && chunk[i] !== OBJECT_OPEN_CHAR_CODE && i < chunk.length) {
726
+ i++;
727
+ }
728
+ let j = i;
729
+ for (; j < chunk.length; j++) {
730
+ const c = chunk[j];
731
+ if (c === OBJECT_OPEN_CHAR_CODE) {
732
+ openBracesCount++;
733
+ } else if (c === OBJECT_CLOSE_CHAR_CODE) {
734
+ openBracesCount--;
735
+ if (0 === openBracesCount) {
736
+ yield combineAndParse(utf8decoder, prevChunks, chunk.subarray(i, j + 1));
737
+ prevChunks = [];
738
+ i = j;
739
+ break;
740
+ }
741
+ }
742
+ }
743
+ if (j === chunk.length) {
744
+ prevChunks.push(chunk.subarray(i));
745
+ break;
746
+ }
747
+ }
748
+ }
749
+ }
750
+ function startsWith(a, b) {
751
+ if (a.length < b.length) {
752
+ return false;
753
+ }
754
+ for (let i = 0; i < b.length; i++) {
755
+ if (a[i] !== b[i]) {
756
+ return false;
757
+ }
758
+ }
759
+ return true;
760
+ }
761
+ function combineAndParse(utf8decoder, prev, curr) {
762
+ let str = "";
763
+ for (const chunk of prev) {
764
+ str += utf8decoder.decode(chunk, {
765
+ stream: true
766
+ });
767
+ }
768
+ str += utf8decoder.decode(curr);
769
+ return JSON.parse(str);
770
+ }
771
+ async function* iterateReadableStream(readableStream) {
772
+ let res = await readableStream.read();
773
+ while (!res.done) {
774
+ yield res.value;
775
+ res = await readableStream.read();
776
+ }
777
+ }
778
+
779
+ // src/createTimeseriesProperty.ts
780
+ function createTimeseriesProperty(client, objectApiName, primaryKey, propertyName) {
781
+ return {
782
+ async getFirstPoint() {
783
+ return esm_exports2.OntologyObjectsV2.getFirstPoint(client, await client.ontologyRid, objectApiName, primaryKey, propertyName);
784
+ },
785
+ async getLastPoint() {
786
+ return esm_exports2.OntologyObjectsV2.getLastPoint(client, await client.ontologyRid, objectApiName, primaryKey, propertyName);
787
+ },
788
+ async getAllPoints(query) {
789
+ return getAllTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, query);
790
+ },
791
+ asyncIterPoints(query) {
792
+ return iterateTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, query);
793
+ }
794
+ };
795
+ }
796
+ async function getAllTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, body) {
797
+ const allPoints = [];
798
+ for await (const point of iterateTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, body)) {
799
+ allPoints.push({
800
+ time: point.time,
801
+ value: point.value
802
+ });
803
+ }
804
+ return allPoints;
805
+ }
806
+ async function* iterateTimeSeriesPoints(client, objectApiName, primaryKey, propertyName, body) {
807
+ new TextDecoder("utf-8");
808
+ const streamPointsIterator = await esm_exports2.OntologyObjectsV2.streamPoints(client, await client.ontologyRid, objectApiName, primaryKey, propertyName, body ? {
809
+ range: getTimeRange(body)
810
+ } : {});
811
+ const reader = streamPointsIterator.stream().getReader();
812
+ for await (const point of parseStreamedResponse(iterateReadableStream(reader))) {
813
+ yield {
814
+ time: point.time,
815
+ value: point.value
816
+ };
817
+ }
818
+ }
819
+ function getTimeRange(body) {
820
+ if ("$startTime" in body || "$endTime" in body) {
656
821
  return {
657
- ...client,
658
- fetch: createFetchHeaderMutator(client.fetch, (headers) => {
659
- headers.set("Fetch-User-Agent", withMetadata.osdkMetadata.extraUserAgent);
660
- return headers;
661
- })
822
+ type: "absolute",
823
+ startTime: body.$startTime,
824
+ endTime: body.$endTime
662
825
  };
663
826
  }
664
- return client;
827
+ return body.$before ? {
828
+ type: "relative",
829
+ startTime: {
830
+ when: "BEFORE",
831
+ value: body.$before,
832
+ unit: TimeseriesDurationMapping[body.$unit]
833
+ }
834
+ } : {
835
+ type: "relative",
836
+ endTime: {
837
+ when: "AFTER",
838
+ value: body.$after,
839
+ unit: TimeseriesDurationMapping[body.$unit]
840
+ }
841
+ };
665
842
  }
666
843
 
667
844
  // src/object/Cache.ts
@@ -778,34 +955,6 @@ var InterfaceDefRef = Symbol(process.env.MODE !== "production" ? "InterfaceDefin
778
955
  var RawObject = Symbol(process.env.MODE !== "production" ? "RawObject" : void 0);
779
956
  var ClientRef = Symbol(process.env.MODE !== "production" ? "ClientRef" : void 0);
780
957
 
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
958
  // src/object/convertWireToOsdkObjects/createOsdkInterface.ts
810
959
  var handlerCache = createSimpleCache(/* @__PURE__ */ new WeakMap(), createInterfaceProxyHandler);
811
960
  function createOsdkInterface(underlying, interfaceDef) {
@@ -830,7 +979,8 @@ function createInterfaceProxyHandler(newDef) {
830
979
  case "$primaryKey":
831
980
  case "$title":
832
981
  case "$objectType":
833
- return Reflect.getOwnPropertyDescriptor(underlying, p);
982
+ case "$rid":
983
+ return underlying[p] != null ? Reflect.getOwnPropertyDescriptor(underlying, p) : void 0;
834
984
  case "$apiName":
835
985
  return {
836
986
  enumerable: true,
@@ -847,7 +997,8 @@ function createInterfaceProxyHandler(newDef) {
847
997
  }
848
998
  },
849
999
  ownKeys(target) {
850
- return ["$apiName", "$objectType", "$primaryKey", "$title", ...Object.keys(newDef.properties)];
1000
+ const underlying = target[UnderlyingOsdkObject];
1001
+ return ["$apiName", "$objectType", "$primaryKey", ...underlying["$rid"] ? ["$rid"] : [], "$title", ...Object.keys(newDef.properties)];
851
1002
  },
852
1003
  get(target, p) {
853
1004
  const underlying = target[UnderlyingOsdkObject];
@@ -861,6 +1012,7 @@ function createInterfaceProxyHandler(newDef) {
861
1012
  case "$primaryKey":
862
1013
  case "$title":
863
1014
  case "$objectType":
1015
+ case "$rid":
864
1016
  return underlying[p];
865
1017
  }
866
1018
  if (newDef.properties[p] != null) {
@@ -985,9 +1137,9 @@ function handleWherePair([field, filter]) {
985
1137
  const withinBody = filter[firstKey];
986
1138
  if (Array.isArray(withinBody)) {
987
1139
  return makeGeoFilterBbox(field, withinBody, firstKey);
988
- } else if ("$bbox" in withinBody) {
1140
+ } else if ("$bbox" in withinBody && withinBody.$bbox != null) {
989
1141
  return makeGeoFilterBbox(field, withinBody.$bbox, firstKey);
990
- } else if ("$distance" in withinBody && "$of" in withinBody) {
1142
+ } else if ("$distance" in withinBody && "$of" in withinBody && withinBody.$distance != null && withinBody.$of != null) {
991
1143
  return {
992
1144
  type: "withinDistanceOf",
993
1145
  field,
@@ -1011,7 +1163,7 @@ function handleWherePair([field, filter]) {
1011
1163
  const intersectsBody = filter[firstKey];
1012
1164
  if (Array.isArray(intersectsBody)) {
1013
1165
  return makeGeoFilterBbox(field, intersectsBody, firstKey);
1014
- } else if ("$bbox" in intersectsBody) {
1166
+ } else if ("$bbox" in intersectsBody && intersectsBody.$bbox != null) {
1015
1167
  return makeGeoFilterBbox(field, intersectsBody.$bbox, firstKey);
1016
1168
  } else {
1017
1169
  const coordinates = "$polygon" in intersectsBody ? intersectsBody.$polygon : intersectsBody.coordinates;
@@ -1124,7 +1276,7 @@ async function aggregate(clientCtx, objectType, objectSet = {
1124
1276
  if (req.$where) {
1125
1277
  body.where = modernToLegacyWhereClause(req.$where);
1126
1278
  }
1127
- const result = await esm_exports2.OntologyObjectSets.aggregateObjectSetV2(addUserAgent(clientCtx, objectType), await clientCtx.ontologyRid, {
1279
+ const result = await esm_exports2.OntologyObjectSets.aggregateObjectSetV2(addUserAgentAndRequestContextHeaders(clientCtx, objectType), await clientCtx.ontologyRid, {
1128
1280
  objectSet,
1129
1281
  groupBy: body.groupBy,
1130
1282
  aggregation: body.aggregation
@@ -1182,6 +1334,15 @@ async function fetchSingleWithErrors(client, objectType, args, objectSet) {
1182
1334
  }
1183
1335
  }
1184
1336
 
1337
+ // src/util/augmentRequestContext.ts
1338
+ var augmentRequestContext = (client, augment2) => ({
1339
+ ...client,
1340
+ requestContext: {
1341
+ ...client.requestContext,
1342
+ ...augment2(client.requestContext)
1343
+ }
1344
+ });
1345
+
1185
1346
  // src/util/WireObjectSet.ts
1186
1347
  var WIRE_OBJECT_SET_TYPES = /* @__PURE__ */ new Set(["base", "filter", "intersect", "reference", "searchAround", "static", "subtract", "union"]);
1187
1348
  function isWireObjectSet(o) {
@@ -1204,9 +1365,15 @@ function createObjectSet(objectType, clientCtx, objectSet = {
1204
1365
  objectType: objectType["apiName"]
1205
1366
  }) {
1206
1367
  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),
1368
+ aggregate: aggregate.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
1369
+ finalMethodCall: "aggregate"
1370
+ })), objectType, objectSet),
1371
+ fetchPage: fetchPageInternal.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
1372
+ finalMethodCall: "fetchPage"
1373
+ })), objectType, objectSet),
1374
+ fetchPageWithErrors: fetchPageWithErrorsInternal.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
1375
+ finalMethodCall: "fetchPageWithErrors"
1376
+ })), objectType, objectSet),
1210
1377
  where: (clause) => {
1211
1378
  return clientCtx.objectSetFactory(objectType, clientCtx, {
1212
1379
  type: "filter",
@@ -1238,7 +1405,9 @@ function createObjectSet(objectType, clientCtx, objectSet = {
1238
1405
  asyncIter: async function* () {
1239
1406
  let $nextPageToken = void 0;
1240
1407
  do {
1241
- const result = await base.fetchPage({
1408
+ const result = await fetchPageInternal(augmentRequestContext(clientCtx, (_) => ({
1409
+ finalMethodCall: "asyncIter"
1410
+ })), objectType, objectSet, {
1242
1411
  $nextPageToken
1243
1412
  });
1244
1413
  $nextPageToken = result.nextPageToken;
@@ -1257,7 +1426,9 @@ function createObjectSet(objectType, clientCtx, objectSet = {
1257
1426
  value: primaryKey
1258
1427
  }
1259
1428
  };
1260
- return await fetchSingle(clientCtx, objectType, options, withPk);
1429
+ return await fetchSingle(augmentRequestContext(clientCtx, (_) => ({
1430
+ finalMethodCall: "fetchOne"
1431
+ })), objectType, options, withPk);
1261
1432
  } : void 0,
1262
1433
  fetchOneWithErrors: isObjectTypeDefinition(objectType) ? async (primaryKey, options) => {
1263
1434
  const withPk = {
@@ -1269,7 +1440,9 @@ function createObjectSet(objectType, clientCtx, objectSet = {
1269
1440
  value: primaryKey
1270
1441
  }
1271
1442
  };
1272
- return await fetchSingleWithErrors(clientCtx, objectType, options, withPk);
1443
+ return await fetchSingleWithErrors(augmentRequestContext(clientCtx, (_) => ({
1444
+ finalMethodCall: "fetchOneWithErrors"
1445
+ })), objectType, options, withPk);
1273
1446
  } : void 0
1274
1447
  };
1275
1448
  function createSearchAround(link) {
@@ -1329,7 +1502,7 @@ var DollarLinkProxyHandler = {
1329
1502
 
1330
1503
  // src/object/convertWireToOsdkObjects/createOsdkObject.ts
1331
1504
  var objectPrototypeCache = createClientCache(function(client, objectDef) {
1332
- return Object.create(process.env.target !== "browser" ? OsdkCustomInspectPrototype : null, {
1505
+ return Object.create(null, {
1333
1506
  [ObjectDefRef]: {
1334
1507
  value: objectDef
1335
1508
  },
@@ -1380,6 +1553,9 @@ function createOsdkObject(client, objectDef, rawObj) {
1380
1553
  }
1381
1554
  return createAttachmentFromRid(client, rawValue.rid);
1382
1555
  }
1556
+ if (propDef.type === "numericTimeseries" || propDef.type === "stringTimeseries") {
1557
+ return createTimeseriesProperty(client, objectDef.apiName, target[RawObject][objectDef.primaryKeyApiName], p);
1558
+ }
1383
1559
  }
1384
1560
  return rawValue;
1385
1561
  }
@@ -1464,7 +1640,7 @@ function reframeAsObjectInPlace(objectDef, interfaceApiName, rawObj) {
1464
1640
  function isConforming(client, def, obj, propsToCheck) {
1465
1641
  for (const propName of propsToCheck) {
1466
1642
  if (def.properties[propName].nullable === false && obj[propName] == null) {
1467
- if (process.env.NODE_ENV !== "production") {
1643
+ if (process?.env?.NODE_ENV !== "production") {
1468
1644
  client.logger?.debug({
1469
1645
  obj: {
1470
1646
  $objectType: obj["$objectType"],
@@ -1529,7 +1705,7 @@ function objectSetToSearchJsonV2(objectSet, expectedApiName, existingWhere = voi
1529
1705
  throw new Error(`Unsupported objectSet type: ${objectSet.type}`);
1530
1706
  }
1531
1707
  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, {
1708
+ const result = await esm_exports2.OntologyObjectsV2.searchObjectsForInterface(addUserAgentAndRequestContextHeaders(client, interfaceType), await client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {
1533
1709
  augmentedProperties: args.$augment ?? {},
1534
1710
  augmentedSharedPropertyTypes: {},
1535
1711
  otherInterfaceTypes: [],
@@ -1596,7 +1772,7 @@ function applyFetchArgs(args, body) {
1596
1772
  return body;
1597
1773
  }
1598
1774
  async function fetchObjectPage(client, objectType, args, objectSet) {
1599
- const r = await esm_exports2.OntologyObjectSets.loadObjectSetV2(addUserAgent(client, objectType), await client.ontologyRid, applyFetchArgs(args, {
1775
+ const r = await esm_exports2.OntologyObjectSets.loadObjectSetV2(addUserAgentAndRequestContextHeaders(client, objectType), await client.ontologyRid, applyFetchArgs(args, {
1600
1776
  objectSet,
1601
1777
  // We have to do the following case because LoadObjectSetRequestV2 isn't readonly
1602
1778
  select: args?.$select ?? [],
@@ -1609,19 +1785,6 @@ async function fetchObjectPage(client, objectType, args, objectSet) {
1609
1785
  });
1610
1786
  }
1611
1787
 
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
1788
  // src/util/isOntologyObjectV2.ts
1626
1789
  function isOntologyObjectV2(o) {
1627
1790
  return o && typeof o === "object" && typeof o.__apiName === "string" && o.__primaryKey != null;
@@ -1674,8 +1837,11 @@ async function toDataValue(value, client) {
1674
1837
 
1675
1838
  // src/actions/applyAction.ts
1676
1839
  async function applyAction2(client, action, parameters, options = {}) {
1840
+ const clientWithHeaders = addUserAgentAndRequestContextHeaders(augmentRequestContext(client, (_) => ({
1841
+ finalMethodCall: "applyAction"
1842
+ })), action);
1677
1843
  if (Array.isArray(parameters)) {
1678
- const response = await esm_exports2.Actions.applyActionBatchV2(addUserAgent(client, action), await client.ontologyRid, action.apiName, {
1844
+ const response = await esm_exports2.Actions.applyActionBatchV2(clientWithHeaders, await client.ontologyRid, action.apiName, {
1679
1845
  requests: parameters ? await remapBatchActionParams(parameters, client) : [],
1680
1846
  options: {
1681
1847
  returnEdits: options?.$returnEdits ? "ALL" : "NONE"
@@ -1683,7 +1849,7 @@ async function applyAction2(client, action, parameters, options = {}) {
1683
1849
  });
1684
1850
  return options?.$returnEdits ? response.edits : void 0;
1685
1851
  } else {
1686
- const response = await esm_exports2.Actions.applyActionV2(addUserAgent(client, action), await client.ontologyRid, action.apiName, {
1852
+ const response = await esm_exports2.Actions.applyActionV2(clientWithHeaders, await client.ontologyRid, action.apiName, {
1687
1853
  parameters: await remapActionParams(parameters, client),
1688
1854
  options: {
1689
1855
  mode: options?.$validateOnly ? "VALIDATE_ONLY" : "VALIDATE_AND_EXECUTE",
@@ -1770,7 +1936,7 @@ var createStandardOntologyProviderFactory = (client) => {
1770
1936
  };
1771
1937
 
1772
1938
  // src/util/UserAgent.ts
1773
- var USER_AGENT = `osdk-client/${"0.20.0-beta.4"}`;
1939
+ var USER_AGENT = `osdk-client/${"0.21.0-beta.0"}`;
1774
1940
 
1775
1941
  // src/createMinimalClient.ts
1776
1942
  function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {
@@ -1787,7 +1953,8 @@ function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fet
1787
1953
  objectSetFactory,
1788
1954
  ontologyRid: metadata.ontologyRid,
1789
1955
  logger: options.logger,
1790
- clientCacheKey: {}
1956
+ clientCacheKey: {},
1957
+ requestContext: {}
1791
1958
  };
1792
1959
  return Object.assign(minimalClient, {
1793
1960
  ontologyProvider: createStandardOntologyProviderFactory()(minimalClient)
@@ -1877,7 +2044,9 @@ async function toDataValueQueries(value, client, desiredType) {
1877
2044
 
1878
2045
  // src/queries/applyQuery.ts
1879
2046
  async function applyQuery(client, query, params) {
1880
- const response = await esm_exports2.QueryTypes.executeQueryV2(addUserAgent(client, query), await client.ontologyRid, query.apiName, {
2047
+ const response = await esm_exports2.QueryTypes.executeQueryV2(addUserAgentAndRequestContextHeaders(augmentRequestContext(client, (_) => ({
2048
+ finalMethodCall: "applyQuery"
2049
+ })), query), await client.ontologyRid, query.apiName, {
1881
2050
  parameters: params ? await remapQueryParams(params, client, query.parameters) : {}
1882
2051
  });
1883
2052
  const objectOutputDefs = await getRequiredDefinitions(query.output, client);
@@ -2097,6 +2266,6 @@ function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvi
2097
2266
  }
2098
2267
  var createClient = createClientInternal.bind(void 0, createObjectSet);
2099
2268
 
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
2269
+ export { ActionValidationError, USER_AGENT, augment, convertWireToOsdkObjects, createAttachmentFromRid, createAttachmentUpload, createClient, createClientInternal, createObjectSet, createSimpleAsyncCache, esm_exports2 as esm_exports };
2270
+ //# sourceMappingURL=chunk-H4YHNABD.js.map
2271
+ //# sourceMappingURL=chunk-H4YHNABD.js.map