@osdk/client 0.20.0-beta.3 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +90 -5
  2. package/build/{esm/chunk-JRG5V55N.js → browser/chunk-T5DZREKX.js} +557 -112
  3. package/build/browser/chunk-T5DZREKX.js.map +1 -0
  4. package/build/browser/index.js +4 -8
  5. package/build/browser/index.js.map +1 -1
  6. package/build/browser/public/unstable-do-not-use.js +2 -2
  7. package/build/browser/public/unstable-do-not-use.js.map +1 -1
  8. package/build/cjs/{chunk-EP4KLU3N.cjs → chunk-VW7XYOFL.cjs} +556 -110
  9. package/build/cjs/chunk-VW7XYOFL.cjs.map +1 -0
  10. package/build/cjs/index.cjs +14 -11
  11. package/build/cjs/index.cjs.map +1 -1
  12. package/build/cjs/public/unstable-do-not-use.cjs +8 -8
  13. package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
  14. package/build/esm/Client.d.ts +3 -2
  15. package/build/esm/Client.d.ts.map +1 -1
  16. package/build/esm/MinimalClientContext.d.ts +4 -0
  17. package/build/esm/MinimalClientContext.d.ts.map +1 -1
  18. package/build/esm/__unstable/UnstableClient.d.ts +1 -1
  19. package/build/esm/__unstable/UnstableClient.d.ts.map +1 -1
  20. package/build/esm/actions/applyAction.d.ts.map +1 -1
  21. package/build/{browser/chunk-M3BF5ESV.js → esm/chunk-T5DZREKX.js} +557 -109
  22. package/build/esm/chunk-T5DZREKX.js.map +1 -0
  23. package/build/esm/createClient.d.ts.map +1 -1
  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 +4 -8
  32. package/build/esm/index.js.map +1 -1
  33. package/build/esm/object/Cache.d.ts +1 -1
  34. package/build/esm/object/SimpleCache.d.ts +1 -1
  35. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.d.ts.map +1 -1
  36. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.d.ts.map +1 -1
  37. package/build/esm/object/convertWireToOsdkObjects.d.ts.map +1 -1
  38. package/build/esm/object/fetchPage.d.ts.map +1 -1
  39. package/build/esm/object/timeseries.test.d.ts +2 -0
  40. package/build/esm/object/timeseries.test.d.ts.map +1 -0
  41. package/build/esm/objectSet/createObjectSet.d.ts.map +1 -1
  42. package/build/esm/ontology/OntologyProvider.d.ts +1 -1
  43. package/build/esm/ontology/OntologyProvider.d.ts.map +1 -1
  44. package/build/esm/ontology/loadFullObjectMetadata.d.ts +1 -1
  45. package/build/esm/ontology/loadFullObjectMetadata.d.ts.map +1 -1
  46. package/build/esm/ontology/loadInterfaceDefinition.d.ts +1 -1
  47. package/build/esm/ontology/loadInterfaceDefinition.d.ts.map +1 -1
  48. package/build/esm/public/unstable-do-not-use.js +2 -2
  49. package/build/esm/public/unstable-do-not-use.js.map +1 -1
  50. package/build/esm/queries/applyQuery.d.ts +6 -0
  51. package/build/esm/queries/applyQuery.d.ts.map +1 -0
  52. package/build/esm/queries/createQueryInvoker.d.ts +5 -0
  53. package/build/esm/queries/createQueryInvoker.d.ts.map +1 -0
  54. package/build/esm/queries/queries.test.d.ts +2 -0
  55. package/build/esm/queries/queries.test.d.ts.map +1 -0
  56. package/build/esm/util/addUserAgentAndRequestContextHeaders.d.ts +4 -0
  57. package/build/esm/util/addUserAgentAndRequestContextHeaders.d.ts.map +1 -0
  58. package/build/esm/util/augmentRequestContext.d.ts +32 -0
  59. package/build/esm/util/augmentRequestContext.d.ts.map +1 -0
  60. package/build/esm/util/isOsdkBaseObject.d.ts +3 -0
  61. package/build/esm/util/isOsdkBaseObject.d.ts.map +1 -0
  62. package/build/esm/util/isOsdkObject.d.ts +3 -0
  63. package/build/esm/util/isOsdkObject.d.ts.map +1 -0
  64. package/build/esm/util/streamutils.d.ts +3 -0
  65. package/build/esm/util/streamutils.d.ts.map +1 -0
  66. package/build/esm/util/toDataValue.d.ts.map +1 -1
  67. package/build/esm/util/toDataValueQueries.d.ts +10 -0
  68. package/build/esm/util/toDataValueQueries.d.ts.map +1 -0
  69. package/package.json +22 -15
  70. package/build/browser/chunk-M3BF5ESV.js.map +0 -1
  71. package/build/cjs/chunk-EP4KLU3N.cjs.map +0 -1
  72. package/build/esm/chunk-JRG5V55N.js.map +0 -1
  73. package/build/esm/util/addUserAgent.d.ts +0 -4
  74. 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) {
@@ -1124,7 +1273,7 @@ async function aggregate(clientCtx, objectType, objectSet = {
1124
1273
  if (req.$where) {
1125
1274
  body.where = modernToLegacyWhereClause(req.$where);
1126
1275
  }
1127
- const result = await esm_exports2.OntologyObjectSets.aggregateObjectSetV2(addUserAgent(clientCtx, objectType), await clientCtx.ontologyRid, {
1276
+ const result = await esm_exports2.OntologyObjectSets.aggregateObjectSetV2(addUserAgentAndRequestContextHeaders(clientCtx, objectType), await clientCtx.ontologyRid, {
1128
1277
  objectSet,
1129
1278
  groupBy: body.groupBy,
1130
1279
  aggregation: body.aggregation
@@ -1182,6 +1331,15 @@ async function fetchSingleWithErrors(client, objectType, args, objectSet) {
1182
1331
  }
1183
1332
  }
1184
1333
 
1334
+ // src/util/augmentRequestContext.ts
1335
+ var augmentRequestContext = (client, augment2) => ({
1336
+ ...client,
1337
+ requestContext: {
1338
+ ...client.requestContext,
1339
+ ...augment2(client.requestContext)
1340
+ }
1341
+ });
1342
+
1185
1343
  // src/util/WireObjectSet.ts
1186
1344
  var WIRE_OBJECT_SET_TYPES = /* @__PURE__ */ new Set(["base", "filter", "intersect", "reference", "searchAround", "static", "subtract", "union"]);
1187
1345
  function isWireObjectSet(o) {
@@ -1204,9 +1362,15 @@ function createObjectSet(objectType, clientCtx, objectSet = {
1204
1362
  objectType: objectType["apiName"]
1205
1363
  }) {
1206
1364
  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),
1365
+ aggregate: aggregate.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
1366
+ finalMethodCall: "aggregate"
1367
+ })), objectType, objectSet),
1368
+ fetchPage: fetchPageInternal.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
1369
+ finalMethodCall: "fetchPage"
1370
+ })), objectType, objectSet),
1371
+ fetchPageWithErrors: fetchPageWithErrorsInternal.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
1372
+ finalMethodCall: "fetchPageWithErrors"
1373
+ })), objectType, objectSet),
1210
1374
  where: (clause) => {
1211
1375
  return clientCtx.objectSetFactory(objectType, clientCtx, {
1212
1376
  type: "filter",
@@ -1238,9 +1402,12 @@ function createObjectSet(objectType, clientCtx, objectSet = {
1238
1402
  asyncIter: async function* () {
1239
1403
  let $nextPageToken = void 0;
1240
1404
  do {
1241
- const result = await base.fetchPage({
1405
+ const result = await fetchPageInternal(augmentRequestContext(clientCtx, (_) => ({
1406
+ finalMethodCall: "asyncIter"
1407
+ })), objectType, objectSet, {
1242
1408
  $nextPageToken
1243
1409
  });
1410
+ $nextPageToken = result.nextPageToken;
1244
1411
  for (const obj of result.data) {
1245
1412
  yield obj;
1246
1413
  }
@@ -1256,7 +1423,9 @@ function createObjectSet(objectType, clientCtx, objectSet = {
1256
1423
  value: primaryKey
1257
1424
  }
1258
1425
  };
1259
- return await fetchSingle(clientCtx, objectType, options, withPk);
1426
+ return await fetchSingle(augmentRequestContext(clientCtx, (_) => ({
1427
+ finalMethodCall: "fetchOne"
1428
+ })), objectType, options, withPk);
1260
1429
  } : void 0,
1261
1430
  fetchOneWithErrors: isObjectTypeDefinition(objectType) ? async (primaryKey, options) => {
1262
1431
  const withPk = {
@@ -1268,7 +1437,9 @@ function createObjectSet(objectType, clientCtx, objectSet = {
1268
1437
  value: primaryKey
1269
1438
  }
1270
1439
  };
1271
- return await fetchSingleWithErrors(clientCtx, objectType, options, withPk);
1440
+ return await fetchSingleWithErrors(augmentRequestContext(clientCtx, (_) => ({
1441
+ finalMethodCall: "fetchOneWithErrors"
1442
+ })), objectType, options, withPk);
1272
1443
  } : void 0
1273
1444
  };
1274
1445
  function createSearchAround(link) {
@@ -1328,7 +1499,7 @@ var DollarLinkProxyHandler = {
1328
1499
 
1329
1500
  // src/object/convertWireToOsdkObjects/createOsdkObject.ts
1330
1501
  var objectPrototypeCache = createClientCache(function(client, objectDef) {
1331
- return Object.create(process.env.target !== "browser" ? OsdkCustomInspectPrototype : null, {
1502
+ return Object.create(null, {
1332
1503
  [ObjectDefRef]: {
1333
1504
  value: objectDef
1334
1505
  },
@@ -1379,6 +1550,9 @@ function createOsdkObject(client, objectDef, rawObj) {
1379
1550
  }
1380
1551
  return createAttachmentFromRid(client, rawValue.rid);
1381
1552
  }
1553
+ if (propDef.type === "numericTimeseries" || propDef.type === "stringTimeseries") {
1554
+ return createTimeseriesProperty(client, objectDef.apiName, target[RawObject][objectDef.primaryKeyApiName], p);
1555
+ }
1382
1556
  }
1383
1557
  return rawValue;
1384
1558
  }
@@ -1528,7 +1702,7 @@ function objectSetToSearchJsonV2(objectSet, expectedApiName, existingWhere = voi
1528
1702
  throw new Error(`Unsupported objectSet type: ${objectSet.type}`);
1529
1703
  }
1530
1704
  async function fetchInterfacePage(client, interfaceType, args, objectSet) {
1531
- const result = await esm_exports2.OntologyObjectsV2.searchObjectsForInterface(addUserAgent(client, interfaceType), await client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {
1705
+ const result = await esm_exports2.OntologyObjectsV2.searchObjectsForInterface(addUserAgentAndRequestContextHeaders(client, interfaceType), await client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {
1532
1706
  augmentedProperties: args.$augment ?? {},
1533
1707
  augmentedSharedPropertyTypes: {},
1534
1708
  otherInterfaceTypes: [],
@@ -1595,9 +1769,9 @@ function applyFetchArgs(args, body) {
1595
1769
  return body;
1596
1770
  }
1597
1771
  async function fetchObjectPage(client, objectType, args, objectSet) {
1598
- const r = await esm_exports2.OntologyObjectSets.loadObjectSetV2(addUserAgent(client, objectType), await client.ontologyRid, applyFetchArgs(args, {
1772
+ const r = await esm_exports2.OntologyObjectSets.loadObjectSetV2(addUserAgentAndRequestContextHeaders(client, objectType), await client.ontologyRid, applyFetchArgs(args, {
1599
1773
  objectSet,
1600
- // We have to do the following case because LoadObjectSetRequestV2 isnt readonly
1774
+ // We have to do the following case because LoadObjectSetRequestV2 isn't readonly
1601
1775
  select: args?.$select ?? [],
1602
1776
  // FIXME?
1603
1777
  excludeRid: !args?.$includeRid
@@ -1608,24 +1782,16 @@ async function fetchObjectPage(client, objectType, args, objectSet) {
1608
1782
  });
1609
1783
  }
1610
1784
 
1611
- // src/actions/ActionValidationError.ts
1612
- var ActionValidationError = class extends Error {
1613
- constructor(validation) {
1614
- super("Validation Error");
1615
- this.validation = validation;
1616
- }
1617
- };
1618
-
1619
- // src/object/AttachmentUpload.ts
1620
- function isAttachmentUpload(o) {
1621
- return o instanceof Blob && "name" in o;
1622
- }
1623
-
1624
1785
  // src/util/isOntologyObjectV2.ts
1625
1786
  function isOntologyObjectV2(o) {
1626
1787
  return o && typeof o === "object" && typeof o.__apiName === "string" && o.__primaryKey != null;
1627
1788
  }
1628
1789
 
1790
+ // src/util/isOsdkObject.ts
1791
+ function isOsdkBaseObject(o) {
1792
+ return o && typeof o === "object" && typeof o.$apiName === "string" && o.$primaryKey != null;
1793
+ }
1794
+
1629
1795
  // src/util/toDataValue.ts
1630
1796
  async function toDataValue(value, client) {
1631
1797
  if (value == null) {
@@ -1647,6 +1813,9 @@ async function toDataValue(value, client) {
1647
1813
  if (isOntologyObjectV2(value)) {
1648
1814
  return await toDataValue(value.__primaryKey, client);
1649
1815
  }
1816
+ if (isOsdkBaseObject(value)) {
1817
+ return await toDataValue(value.$primaryKey, client);
1818
+ }
1650
1819
  if (isWireObjectSet(value)) {
1651
1820
  return value;
1652
1821
  }
@@ -1665,8 +1834,11 @@ async function toDataValue(value, client) {
1665
1834
 
1666
1835
  // src/actions/applyAction.ts
1667
1836
  async function applyAction2(client, action, parameters, options = {}) {
1837
+ const clientWithHeaders = addUserAgentAndRequestContextHeaders(augmentRequestContext(client, (_) => ({
1838
+ finalMethodCall: "applyAction"
1839
+ })), action);
1668
1840
  if (Array.isArray(parameters)) {
1669
- const response = await esm_exports2.Actions.applyActionBatchV2(addUserAgent(client, action), await client.ontologyRid, action.apiName, {
1841
+ const response = await esm_exports2.Actions.applyActionBatchV2(clientWithHeaders, await client.ontologyRid, action.apiName, {
1670
1842
  requests: parameters ? await remapBatchActionParams(parameters, client) : [],
1671
1843
  options: {
1672
1844
  returnEdits: options?.$returnEdits ? "ALL" : "NONE"
@@ -1674,7 +1846,7 @@ async function applyAction2(client, action, parameters, options = {}) {
1674
1846
  });
1675
1847
  return options?.$returnEdits ? response.edits : void 0;
1676
1848
  } else {
1677
- const response = await esm_exports2.Actions.applyActionV2(addUserAgent(client, action), await client.ontologyRid, action.apiName, {
1849
+ const response = await esm_exports2.Actions.applyActionV2(clientWithHeaders, await client.ontologyRid, action.apiName, {
1678
1850
  parameters: await remapActionParams(parameters, client),
1679
1851
  options: {
1680
1852
  mode: options?.$validateOnly ? "VALIDATE_ONLY" : "VALIDATE_AND_EXECUTE",
@@ -1708,19 +1880,19 @@ async function remapBatchActionParams(params, client) {
1708
1880
  }));
1709
1881
  return remappedParams;
1710
1882
  }
1711
- async function loadFullObjectMetadata(client, objtype) {
1712
- const full = await esm_exports2.OntologyObjectsV2.getObjectTypeFullMetadata(client, await client.ontologyRid, objtype, {
1883
+ async function loadFullObjectMetadata(client, objectType) {
1884
+ const full = await esm_exports2.OntologyObjectsV2.getObjectTypeFullMetadata(client, await client.ontologyRid, objectType, {
1713
1885
  preview: true
1714
1886
  });
1715
1887
  const ret = wireObjectTypeFullMetadataToSdkObjectTypeDefinition(full, true);
1716
- client.logger?.debug(`END loadFullObjectMetadata(${objtype})`);
1888
+ client.logger?.debug(`END loadFullObjectMetadata(${objectType})`);
1717
1889
  return {
1718
1890
  ...ret,
1719
1891
  rid: full.objectType.rid
1720
1892
  };
1721
1893
  }
1722
- async function loadInterfaceDefinition(client, objtype) {
1723
- const r = await esm_exports2.OntologyObjectsV2.getInterfaceType(client, await client.ontologyRid, objtype, {
1894
+ async function loadInterfaceDefinition(client, objectType) {
1895
+ const r = await esm_exports2.OntologyObjectsV2.getInterfaceType(client, await client.ontologyRid, objectType, {
1724
1896
  preview: true
1725
1897
  });
1726
1898
  return __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(r, true);
@@ -1761,7 +1933,7 @@ var createStandardOntologyProviderFactory = (client) => {
1761
1933
  };
1762
1934
 
1763
1935
  // src/util/UserAgent.ts
1764
- var USER_AGENT = `osdk-client/${"0.20.0-beta.3"}`;
1936
+ var USER_AGENT = `osdk-client/${"0.20.0"}`;
1765
1937
 
1766
1938
  // src/createMinimalClient.ts
1767
1939
  function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {
@@ -1778,13 +1950,287 @@ function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fet
1778
1950
  objectSetFactory,
1779
1951
  ontologyRid: metadata.ontologyRid,
1780
1952
  logger: options.logger,
1781
- clientCacheKey: {}
1953
+ clientCacheKey: {},
1954
+ requestContext: {}
1782
1955
  };
1783
1956
  return Object.assign(minimalClient, {
1784
1957
  ontologyProvider: createStandardOntologyProviderFactory()(minimalClient)
1785
1958
  });
1786
1959
  }
1787
1960
 
1961
+ // src/util/isOsdkBaseObject.ts
1962
+ function isOsdkBaseObject2(o) {
1963
+ return o && typeof o === "object" && typeof o.$apiName === "string" && o.$primaryKey != null;
1964
+ }
1965
+
1966
+ // src/util/toDataValueQueries.ts
1967
+ async function toDataValueQueries(value, client, desiredType) {
1968
+ if (value == null) {
1969
+ return value;
1970
+ }
1971
+ if (Array.isArray(value) && desiredType.multiplicity) {
1972
+ const promiseArray = Array.from(value, async (innerValue) => await toDataValueQueries(innerValue, client, desiredType));
1973
+ return Promise.all(promiseArray);
1974
+ }
1975
+ switch (desiredType.type) {
1976
+ case "attachment": {
1977
+ if (isAttachmentUpload(value)) {
1978
+ const attachment = await esm_exports.Attachments.uploadAttachment(client, value, {
1979
+ filename: value.name
1980
+ }, {
1981
+ "Content-Length": value.size.toString(),
1982
+ "Content-Type": value.type
1983
+ });
1984
+ return attachment.rid;
1985
+ }
1986
+ return value;
1987
+ }
1988
+ case "twoDimensionalAggregation": {
1989
+ return {
1990
+ groups: value
1991
+ };
1992
+ }
1993
+ case "threeDimensionalAggregation": {
1994
+ return {
1995
+ groups: value
1996
+ };
1997
+ }
1998
+ case "set": {
1999
+ if (value instanceof Set) {
2000
+ const promiseArray = Array.from(value, async (innerValue) => await toDataValueQueries(innerValue, client, desiredType["set"]));
2001
+ return Promise.all(promiseArray);
2002
+ }
2003
+ break;
2004
+ }
2005
+ case "object": {
2006
+ if (isOsdkBaseObject2(value)) {
2007
+ return value.$primaryKey;
2008
+ }
2009
+ break;
2010
+ }
2011
+ case "objectSet": {
2012
+ if (isWireObjectSet(value)) {
2013
+ return value;
2014
+ }
2015
+ if (isObjectSet(value)) {
2016
+ return getWireObjectSet(value);
2017
+ }
2018
+ break;
2019
+ }
2020
+ case "struct": {
2021
+ if (typeof value === "object") {
2022
+ const structMap = {};
2023
+ for (const [key, structValue] of Object.entries(value)) {
2024
+ structMap[key] = await toDataValueQueries(structValue, client, desiredType["struct"][key]);
2025
+ }
2026
+ return structMap;
2027
+ }
2028
+ }
2029
+ case "boolean":
2030
+ case "date":
2031
+ case "double":
2032
+ case "float":
2033
+ case "integer":
2034
+ case "long":
2035
+ case "string":
2036
+ case "timestamp":
2037
+ return value;
2038
+ }
2039
+ return value;
2040
+ }
2041
+
2042
+ // src/queries/applyQuery.ts
2043
+ async function applyQuery(client, query, params) {
2044
+ const response = await esm_exports2.QueryTypes.executeQueryV2(addUserAgentAndRequestContextHeaders(augmentRequestContext(client, (_) => ({
2045
+ finalMethodCall: "applyQuery"
2046
+ })), query), await client.ontologyRid, query.apiName, {
2047
+ parameters: params ? await remapQueryParams(params, client, query.parameters) : {}
2048
+ });
2049
+ const objectOutputDefs = await getRequiredDefinitions(query.output, client);
2050
+ const remappedResponse = await remapQueryResponse(client, query.output, response.value, objectOutputDefs);
2051
+ return remappedResponse;
2052
+ }
2053
+ async function remapQueryParams(params, client, paramTypes) {
2054
+ const parameterMap = {};
2055
+ for (const [key, value] of Object.entries(params)) {
2056
+ parameterMap[key] = await toDataValueQueries(value, client, paramTypes[key]);
2057
+ }
2058
+ return parameterMap;
2059
+ }
2060
+ async function remapQueryResponse(client, responseDataType, responseValue, definitions) {
2061
+ if (responseValue == null) {
2062
+ if (responseDataType.nullable) {
2063
+ return void 0;
2064
+ } else {
2065
+ throw new Error("Got null response when nullable was not allowed");
2066
+ }
2067
+ }
2068
+ if (responseDataType.multiplicity != null && responseDataType.multiplicity !== false) {
2069
+ const withoutMultiplicity = {
2070
+ ...responseDataType,
2071
+ multiplicity: false
2072
+ };
2073
+ for (let i = 0; i < responseValue.length; i++) {
2074
+ responseValue[i] = await remapQueryResponse(responseValue[i], withoutMultiplicity, client, definitions);
2075
+ }
2076
+ return responseValue;
2077
+ }
2078
+ switch (responseDataType.type) {
2079
+ case "union": {
2080
+ throw new Error("Union return types are not yet supported");
2081
+ }
2082
+ case "set": {
2083
+ for (let i = 0; i < responseValue.length; i++) {
2084
+ responseValue[i] = await remapQueryResponse(responseValue[i], responseDataType.set, client, definitions);
2085
+ }
2086
+ return responseValue;
2087
+ }
2088
+ case "attachment": {
2089
+ return createAttachmentFromRid(client, responseValue);
2090
+ }
2091
+ case "object": {
2092
+ const def = definitions.get(responseDataType.object);
2093
+ if (!def) {
2094
+ throw new Error(`Missing definition for ${responseDataType.object}`);
2095
+ }
2096
+ return createQueryObjectResponse(responseValue, def);
2097
+ }
2098
+ case "objectSet": {
2099
+ const def = definitions.get(responseDataType.objectSet);
2100
+ if (!def) {
2101
+ throw new Error(`Missing definition for ${responseDataType.objectSet}`);
2102
+ }
2103
+ if (typeof responseValue === "string") {
2104
+ return createObjectSet(def, client, {
2105
+ type: "intersect",
2106
+ objectSets: [{
2107
+ type: "base",
2108
+ objectType: responseDataType.objectSet
2109
+ }, {
2110
+ type: "reference",
2111
+ reference: responseValue
2112
+ }]
2113
+ });
2114
+ }
2115
+ return createObjectSet(def, client, responseValue);
2116
+ }
2117
+ case "struct": {
2118
+ for (const [key, subtype] of Object.entries(responseDataType.struct)) {
2119
+ if (requiresConversion(subtype)) {
2120
+ responseValue[key] = await remapQueryResponse(responseValue[key], subtype, client, definitions);
2121
+ }
2122
+ }
2123
+ return responseValue;
2124
+ }
2125
+ case "twoDimensionalAggregation": {
2126
+ const result = [];
2127
+ for (const {
2128
+ key,
2129
+ value
2130
+ } of responseValue.groups) {
2131
+ result.push({
2132
+ key,
2133
+ value
2134
+ });
2135
+ }
2136
+ return result;
2137
+ }
2138
+ case "threeDimensionalAggregation": {
2139
+ const result = [];
2140
+ for (const {
2141
+ key,
2142
+ groups
2143
+ } of responseValue.groups) {
2144
+ const subResult = [];
2145
+ for (const {
2146
+ key: subKey,
2147
+ value
2148
+ } of groups) {
2149
+ subResult.push({
2150
+ key: subKey,
2151
+ value
2152
+ });
2153
+ }
2154
+ result.push({
2155
+ key,
2156
+ groups: subResult
2157
+ });
2158
+ }
2159
+ return result;
2160
+ }
2161
+ }
2162
+ return responseValue;
2163
+ }
2164
+ async function getRequiredDefinitions(dataType, client) {
2165
+ const result = /* @__PURE__ */ new Map();
2166
+ switch (dataType.type) {
2167
+ case "objectSet": {
2168
+ const objectDef = await client.ontologyProvider.getObjectDefinition(dataType.objectSet);
2169
+ result.set(dataType.objectSet, objectDef);
2170
+ break;
2171
+ }
2172
+ case "object": {
2173
+ const objectDef = await client.ontologyProvider.getObjectDefinition(dataType.object);
2174
+ result.set(dataType.object, objectDef);
2175
+ break;
2176
+ }
2177
+ case "set": {
2178
+ return getRequiredDefinitions(dataType.set, client);
2179
+ }
2180
+ case "struct": {
2181
+ for (const value of Object.values(dataType.struct)) {
2182
+ for (const [type, objectDef] of await getRequiredDefinitions(value, client)) {
2183
+ result.set(type, objectDef);
2184
+ }
2185
+ }
2186
+ break;
2187
+ }
2188
+ }
2189
+ return result;
2190
+ }
2191
+ function requiresConversion(dataType) {
2192
+ switch (dataType.type) {
2193
+ case "boolean":
2194
+ case "date":
2195
+ case "double":
2196
+ case "float":
2197
+ case "integer":
2198
+ case "long":
2199
+ case "object":
2200
+ case "string":
2201
+ case "timestamp":
2202
+ return false;
2203
+ case "union":
2204
+ return true;
2205
+ case "struct":
2206
+ return Object.values(dataType.struct).some(requiresConversion);
2207
+ case "set":
2208
+ return requiresConversion(dataType.set);
2209
+ case "attachment":
2210
+ case "objectSet":
2211
+ case "twoDimensionalAggregation":
2212
+ case "threeDimensionalAggregation":
2213
+ return true;
2214
+ default:
2215
+ return false;
2216
+ }
2217
+ }
2218
+ function createQueryObjectResponse(primaryKey, objectDef) {
2219
+ return {
2220
+ $apiName: objectDef.apiName,
2221
+ $title: void 0,
2222
+ $objectType: objectDef.apiName,
2223
+ $primaryKey: primaryKey
2224
+ };
2225
+ }
2226
+
2227
+ // src/queries/createQueryInvoker.ts
2228
+ function createQueryInvoker(client, query) {
2229
+ return function(...args) {
2230
+ return applyQuery(client, query, ...args);
2231
+ };
2232
+ }
2233
+
1788
2234
  // src/createClient.ts
1789
2235
  var ActionInvoker = class {
1790
2236
  constructor(clientCtx, actionDef) {
@@ -1802,6 +2248,8 @@ function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvi
1802
2248
  } else if (o.type === "action") {
1803
2249
  clientCtx.ontologyProvider.maybeSeed(o);
1804
2250
  return new ActionInvoker(clientCtx, o);
2251
+ } else if (o.type === "query") {
2252
+ return createQueryInvoker(clientCtx, o);
1805
2253
  } else {
1806
2254
  throw new Error("not implemented");
1807
2255
  }
@@ -1815,6 +2263,6 @@ function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvi
1815
2263
  }
1816
2264
  var createClient = createClientInternal.bind(void 0, createObjectSet);
1817
2265
 
1818
- export { ActionValidationError, USER_AGENT, augment, convertWireToOsdkObjects, createAttachmentFromRid, createClient, createClientInternal, createObjectSet, createSimpleAsyncCache, esm_exports2 as esm_exports };
2266
+ export { ActionValidationError, USER_AGENT, augment, convertWireToOsdkObjects, createAttachmentFromRid, createAttachmentUpload, createClient, createClientInternal, createObjectSet, createSimpleAsyncCache, esm_exports2 as esm_exports };
1819
2267
  //# sourceMappingURL=out.js.map
1820
- //# sourceMappingURL=chunk-M3BF5ESV.js.map
2268
+ //# sourceMappingURL=chunk-T5DZREKX.js.map