@osdk/client 0.20.0-beta.4 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -0
- package/build/{esm/chunk-MD6R46EZ.js → browser/chunk-T5DZREKX.js} +270 -107
- package/build/browser/chunk-T5DZREKX.js.map +1 -0
- package/build/browser/index.js +4 -8
- package/build/browser/index.js.map +1 -1
- package/build/browser/public/unstable-do-not-use.js +2 -2
- package/build/cjs/{chunk-4FXEPHWC.cjs → chunk-VW7XYOFL.cjs} +269 -105
- package/build/cjs/chunk-VW7XYOFL.cjs.map +1 -0
- package/build/cjs/index.cjs +14 -11
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.cjs +8 -8
- package/build/esm/MinimalClientContext.d.ts +4 -0
- package/build/esm/MinimalClientContext.d.ts.map +1 -1
- package/build/esm/__unstable/UnstableClient.d.ts +1 -1
- package/build/esm/__unstable/UnstableClient.d.ts.map +1 -1
- package/build/esm/actions/applyAction.d.ts.map +1 -1
- package/build/{browser/chunk-3ZYIZQ7V.js → esm/chunk-T5DZREKX.js} +270 -104
- package/build/esm/chunk-T5DZREKX.js.map +1 -0
- package/build/esm/createMinimalClient.d.ts.map +1 -1
- package/build/esm/createPlatformClient.d.ts +4 -1
- package/build/esm/createPlatformClient.d.ts.map +1 -1
- package/build/esm/createTimeseriesProperty.d.ts +4 -0
- package/build/esm/createTimeseriesProperty.d.ts.map +1 -0
- package/build/esm/index.d.ts +6 -4
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +4 -8
- package/build/esm/index.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.d.ts.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.d.ts.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.d.ts.map +1 -1
- package/build/esm/object/fetchPage.d.ts.map +1 -1
- package/build/esm/object/timeseries.test.d.ts +2 -0
- package/build/esm/object/timeseries.test.d.ts.map +1 -0
- package/build/esm/objectSet/createObjectSet.d.ts.map +1 -1
- package/build/esm/ontology/OntologyProvider.d.ts +1 -1
- package/build/esm/ontology/OntologyProvider.d.ts.map +1 -1
- package/build/esm/public/unstable-do-not-use.js +2 -2
- package/build/esm/queries/applyQuery.d.ts.map +1 -1
- package/build/esm/util/addUserAgentAndRequestContextHeaders.d.ts +4 -0
- package/build/esm/util/addUserAgentAndRequestContextHeaders.d.ts.map +1 -0
- package/build/esm/util/augmentRequestContext.d.ts +32 -0
- package/build/esm/util/augmentRequestContext.d.ts.map +1 -0
- package/build/esm/util/streamutils.d.ts +3 -0
- package/build/esm/util/streamutils.d.ts.map +1 -0
- package/package.json +13 -13
- package/build/browser/chunk-3ZYIZQ7V.js.map +0 -1
- package/build/cjs/chunk-4FXEPHWC.cjs.map +0 -1
- package/build/esm/chunk-MD6R46EZ.js.map +0 -1
- package/build/esm/util/addUserAgent.d.ts +0 -4
- package/build/esm/util/addUserAgent.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,67 @@
|
|
|
1
1
|
# @osdk/client
|
|
2
2
|
|
|
3
|
+
## 0.20.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7505880: Fix exports from client
|
|
8
|
+
- 02c65c5: Rework $select syntax in aggregations to add support for ordering by metrics
|
|
9
|
+
- 564adbf: Fixing attachment creation when converting objects from the wire
|
|
10
|
+
- 141953f: Expose $title property in OsdkBase
|
|
11
|
+
- 505b993: Experimental subscription no longer fires outOfDate when first subscribing
|
|
12
|
+
- a6119bd: Attachments reworked so that you can now fetch directly from object properties. Also added a helper to create an attachment object directly from a rid.
|
|
13
|
+
- bfdb123: WARNING: Breaking: change action invocation to require `.applyAction`
|
|
14
|
+
- 62bae76: Upgrades 'ws' to avoid false flag CVE
|
|
15
|
+
- 034f7ea: Add support for no query time series pulls.
|
|
16
|
+
- f6d8850: Removed get, which is now replaced by fetchOne(). This has the exact same functionality and is essentially just a rename.
|
|
17
|
+
- 388dba9: Change all internal dependencies to be tilde not caret
|
|
18
|
+
- 527e8ab: Objects that are $as are now linked directly to changes from source object
|
|
19
|
+
- a519655: Fixed issue accessing $rid when requested on an object.
|
|
20
|
+
- 7afa226: Fix action params that take objects to correctly parse out primary key.
|
|
21
|
+
- 57b68db: It is possible to pass a Promise<string> for ontologyRid on client creation
|
|
22
|
+
- 5378312: Added batch action support for 2.0 client
|
|
23
|
+
- 3ec7c38: Add support for queries in 2.0
|
|
24
|
+
- b3563e0: OSDK learns \_\_EXPERIMENTAL_strictNonNull to throw, drop objects, or return `| undefined` for properties, allowing for correct typesafety.
|
|
25
|
+
- 7adf5c7: Refactoring packages
|
|
26
|
+
- 4824449: Fix asyncIter to fetch subsequent pages
|
|
27
|
+
- dd6033a: Adds a createPlatformClient if you only need platform apis
|
|
28
|
+
- bc89b62: Spelling fixes and spell check in CI
|
|
29
|
+
- 4dbac7e: Fixes link direction for experimental bulk loads
|
|
30
|
+
- 489d13f: Add support for timeseries in 2.0 syntax.
|
|
31
|
+
- 8cff4f0: Adding more package exports
|
|
32
|
+
- dec005b: Add final method call to request context header
|
|
33
|
+
- 5e9d7d2: Refactored packages to move types over to client.api
|
|
34
|
+
- 413e511: Added attachment uploading, reading, and metadata fetching support to 2.0.
|
|
35
|
+
- 44add10: Standardize the use of dollar signs as prefixes for object properties that are specific to the OSDK.
|
|
36
|
+
- a92e032: ClientCache now uses a key field as the cache key instead of the entire client
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- Updated dependencies [b5ac8a8]
|
|
41
|
+
- Updated dependencies [141953f]
|
|
42
|
+
- Updated dependencies [a6119bd]
|
|
43
|
+
- Updated dependencies [034f7ea]
|
|
44
|
+
- Updated dependencies [388dba9]
|
|
45
|
+
- Updated dependencies [d8edf10]
|
|
46
|
+
- Updated dependencies [3ec7c38]
|
|
47
|
+
- Updated dependencies [7adf5c7]
|
|
48
|
+
- Updated dependencies [700c894]
|
|
49
|
+
- Updated dependencies [bc89b62]
|
|
50
|
+
- Updated dependencies [3615522]
|
|
51
|
+
- Updated dependencies [489d13f]
|
|
52
|
+
- Updated dependencies [dec005b]
|
|
53
|
+
- Updated dependencies [5e9d7d2]
|
|
54
|
+
- Updated dependencies [413e511]
|
|
55
|
+
- Updated dependencies [67c1fd6]
|
|
56
|
+
- @osdk/client.api@0.20.0
|
|
57
|
+
- @osdk/generator-converters@0.7.0
|
|
58
|
+
- @osdk/shared.client.impl@0.1.0
|
|
59
|
+
- @osdk/shared.net.fetch@0.1.0
|
|
60
|
+
- @osdk/api@1.9.0
|
|
61
|
+
- @osdk/client.unstable.osw@0.1.0
|
|
62
|
+
- @osdk/shared.net.errors@1.1.0
|
|
63
|
+
- @osdk/client.unstable@0.1.0
|
|
64
|
+
|
|
3
65
|
## 0.20.0-beta.4
|
|
4
66
|
|
|
5
67
|
### Minor Changes
|
|
@@ -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-
|
|
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
|
-
|
|
509
|
-
|
|
510
|
-
|
|
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
|
|
570
|
-
function
|
|
571
|
-
return foundryPlatformFetch($ctx,
|
|
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
|
|
574
|
-
function
|
|
575
|
-
return foundryPlatformFetch($ctx,
|
|
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
|
|
578
|
-
function
|
|
579
|
-
return foundryPlatformFetch($ctx,
|
|
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
|
|
582
|
-
function
|
|
583
|
-
return foundryPlatformFetch($ctx,
|
|
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
|
-
|
|
655
|
-
|
|
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
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
return headers;
|
|
661
|
-
})
|
|
822
|
+
type: "absolute",
|
|
823
|
+
startTime: body.$startTime,
|
|
824
|
+
endTime: body.$endTime
|
|
662
825
|
};
|
|
663
826
|
}
|
|
664
|
-
return
|
|
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) {
|
|
@@ -813,9 +962,6 @@ function createOsdkInterface(underlying, interfaceDef) {
|
|
|
813
962
|
[UnderlyingOsdkObject]: underlying,
|
|
814
963
|
[InterfaceDefRef]: interfaceDef
|
|
815
964
|
};
|
|
816
|
-
{
|
|
817
|
-
Object.setPrototypeOf(interfaceHolder, OsdkCustomInspectPrototype);
|
|
818
|
-
}
|
|
819
965
|
const handler = handlerCache.get(interfaceDef);
|
|
820
966
|
const proxy = new Proxy(
|
|
821
967
|
interfaceHolder,
|
|
@@ -1127,7 +1273,7 @@ async function aggregate(clientCtx, objectType, objectSet = {
|
|
|
1127
1273
|
if (req.$where) {
|
|
1128
1274
|
body.where = modernToLegacyWhereClause(req.$where);
|
|
1129
1275
|
}
|
|
1130
|
-
const result = await esm_exports2.OntologyObjectSets.aggregateObjectSetV2(
|
|
1276
|
+
const result = await esm_exports2.OntologyObjectSets.aggregateObjectSetV2(addUserAgentAndRequestContextHeaders(clientCtx, objectType), await clientCtx.ontologyRid, {
|
|
1131
1277
|
objectSet,
|
|
1132
1278
|
groupBy: body.groupBy,
|
|
1133
1279
|
aggregation: body.aggregation
|
|
@@ -1185,6 +1331,15 @@ async function fetchSingleWithErrors(client, objectType, args, objectSet) {
|
|
|
1185
1331
|
}
|
|
1186
1332
|
}
|
|
1187
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
|
+
|
|
1188
1343
|
// src/util/WireObjectSet.ts
|
|
1189
1344
|
var WIRE_OBJECT_SET_TYPES = /* @__PURE__ */ new Set(["base", "filter", "intersect", "reference", "searchAround", "static", "subtract", "union"]);
|
|
1190
1345
|
function isWireObjectSet(o) {
|
|
@@ -1207,9 +1362,15 @@ function createObjectSet(objectType, clientCtx, objectSet = {
|
|
|
1207
1362
|
objectType: objectType["apiName"]
|
|
1208
1363
|
}) {
|
|
1209
1364
|
const base = {
|
|
1210
|
-
aggregate: aggregate.bind(globalThis, clientCtx,
|
|
1211
|
-
|
|
1212
|
-
|
|
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),
|
|
1213
1374
|
where: (clause) => {
|
|
1214
1375
|
return clientCtx.objectSetFactory(objectType, clientCtx, {
|
|
1215
1376
|
type: "filter",
|
|
@@ -1241,7 +1402,9 @@ function createObjectSet(objectType, clientCtx, objectSet = {
|
|
|
1241
1402
|
asyncIter: async function* () {
|
|
1242
1403
|
let $nextPageToken = void 0;
|
|
1243
1404
|
do {
|
|
1244
|
-
const result = await
|
|
1405
|
+
const result = await fetchPageInternal(augmentRequestContext(clientCtx, (_) => ({
|
|
1406
|
+
finalMethodCall: "asyncIter"
|
|
1407
|
+
})), objectType, objectSet, {
|
|
1245
1408
|
$nextPageToken
|
|
1246
1409
|
});
|
|
1247
1410
|
$nextPageToken = result.nextPageToken;
|
|
@@ -1260,7 +1423,9 @@ function createObjectSet(objectType, clientCtx, objectSet = {
|
|
|
1260
1423
|
value: primaryKey
|
|
1261
1424
|
}
|
|
1262
1425
|
};
|
|
1263
|
-
return await fetchSingle(clientCtx,
|
|
1426
|
+
return await fetchSingle(augmentRequestContext(clientCtx, (_) => ({
|
|
1427
|
+
finalMethodCall: "fetchOne"
|
|
1428
|
+
})), objectType, options, withPk);
|
|
1264
1429
|
} : void 0,
|
|
1265
1430
|
fetchOneWithErrors: isObjectTypeDefinition(objectType) ? async (primaryKey, options) => {
|
|
1266
1431
|
const withPk = {
|
|
@@ -1272,7 +1437,9 @@ function createObjectSet(objectType, clientCtx, objectSet = {
|
|
|
1272
1437
|
value: primaryKey
|
|
1273
1438
|
}
|
|
1274
1439
|
};
|
|
1275
|
-
return await fetchSingleWithErrors(clientCtx,
|
|
1440
|
+
return await fetchSingleWithErrors(augmentRequestContext(clientCtx, (_) => ({
|
|
1441
|
+
finalMethodCall: "fetchOneWithErrors"
|
|
1442
|
+
})), objectType, options, withPk);
|
|
1276
1443
|
} : void 0
|
|
1277
1444
|
};
|
|
1278
1445
|
function createSearchAround(link) {
|
|
@@ -1332,7 +1499,7 @@ var DollarLinkProxyHandler = {
|
|
|
1332
1499
|
|
|
1333
1500
|
// src/object/convertWireToOsdkObjects/createOsdkObject.ts
|
|
1334
1501
|
var objectPrototypeCache = createClientCache(function(client, objectDef) {
|
|
1335
|
-
return Object.create(
|
|
1502
|
+
return Object.create(null, {
|
|
1336
1503
|
[ObjectDefRef]: {
|
|
1337
1504
|
value: objectDef
|
|
1338
1505
|
},
|
|
@@ -1383,6 +1550,9 @@ function createOsdkObject(client, objectDef, rawObj) {
|
|
|
1383
1550
|
}
|
|
1384
1551
|
return createAttachmentFromRid(client, rawValue.rid);
|
|
1385
1552
|
}
|
|
1553
|
+
if (propDef.type === "numericTimeseries" || propDef.type === "stringTimeseries") {
|
|
1554
|
+
return createTimeseriesProperty(client, objectDef.apiName, target[RawObject][objectDef.primaryKeyApiName], p);
|
|
1555
|
+
}
|
|
1386
1556
|
}
|
|
1387
1557
|
return rawValue;
|
|
1388
1558
|
}
|
|
@@ -1532,7 +1702,7 @@ function objectSetToSearchJsonV2(objectSet, expectedApiName, existingWhere = voi
|
|
|
1532
1702
|
throw new Error(`Unsupported objectSet type: ${objectSet.type}`);
|
|
1533
1703
|
}
|
|
1534
1704
|
async function fetchInterfacePage(client, interfaceType, args, objectSet) {
|
|
1535
|
-
const result = await esm_exports2.OntologyObjectsV2.searchObjectsForInterface(
|
|
1705
|
+
const result = await esm_exports2.OntologyObjectsV2.searchObjectsForInterface(addUserAgentAndRequestContextHeaders(client, interfaceType), await client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {
|
|
1536
1706
|
augmentedProperties: args.$augment ?? {},
|
|
1537
1707
|
augmentedSharedPropertyTypes: {},
|
|
1538
1708
|
otherInterfaceTypes: [],
|
|
@@ -1599,7 +1769,7 @@ function applyFetchArgs(args, body) {
|
|
|
1599
1769
|
return body;
|
|
1600
1770
|
}
|
|
1601
1771
|
async function fetchObjectPage(client, objectType, args, objectSet) {
|
|
1602
|
-
const r = await esm_exports2.OntologyObjectSets.loadObjectSetV2(
|
|
1772
|
+
const r = await esm_exports2.OntologyObjectSets.loadObjectSetV2(addUserAgentAndRequestContextHeaders(client, objectType), await client.ontologyRid, applyFetchArgs(args, {
|
|
1603
1773
|
objectSet,
|
|
1604
1774
|
// We have to do the following case because LoadObjectSetRequestV2 isn't readonly
|
|
1605
1775
|
select: args?.$select ?? [],
|
|
@@ -1612,19 +1782,6 @@ async function fetchObjectPage(client, objectType, args, objectSet) {
|
|
|
1612
1782
|
});
|
|
1613
1783
|
}
|
|
1614
1784
|
|
|
1615
|
-
// src/actions/ActionValidationError.ts
|
|
1616
|
-
var ActionValidationError = class extends Error {
|
|
1617
|
-
constructor(validation) {
|
|
1618
|
-
super("Validation Error");
|
|
1619
|
-
this.validation = validation;
|
|
1620
|
-
}
|
|
1621
|
-
};
|
|
1622
|
-
|
|
1623
|
-
// src/object/AttachmentUpload.ts
|
|
1624
|
-
function isAttachmentUpload(o) {
|
|
1625
|
-
return o instanceof Blob && "name" in o;
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
1785
|
// src/util/isOntologyObjectV2.ts
|
|
1629
1786
|
function isOntologyObjectV2(o) {
|
|
1630
1787
|
return o && typeof o === "object" && typeof o.__apiName === "string" && o.__primaryKey != null;
|
|
@@ -1677,8 +1834,11 @@ async function toDataValue(value, client) {
|
|
|
1677
1834
|
|
|
1678
1835
|
// src/actions/applyAction.ts
|
|
1679
1836
|
async function applyAction2(client, action, parameters, options = {}) {
|
|
1837
|
+
const clientWithHeaders = addUserAgentAndRequestContextHeaders(augmentRequestContext(client, (_) => ({
|
|
1838
|
+
finalMethodCall: "applyAction"
|
|
1839
|
+
})), action);
|
|
1680
1840
|
if (Array.isArray(parameters)) {
|
|
1681
|
-
const response = await esm_exports2.Actions.applyActionBatchV2(
|
|
1841
|
+
const response = await esm_exports2.Actions.applyActionBatchV2(clientWithHeaders, await client.ontologyRid, action.apiName, {
|
|
1682
1842
|
requests: parameters ? await remapBatchActionParams(parameters, client) : [],
|
|
1683
1843
|
options: {
|
|
1684
1844
|
returnEdits: options?.$returnEdits ? "ALL" : "NONE"
|
|
@@ -1686,7 +1846,7 @@ async function applyAction2(client, action, parameters, options = {}) {
|
|
|
1686
1846
|
});
|
|
1687
1847
|
return options?.$returnEdits ? response.edits : void 0;
|
|
1688
1848
|
} else {
|
|
1689
|
-
const response = await esm_exports2.Actions.applyActionV2(
|
|
1849
|
+
const response = await esm_exports2.Actions.applyActionV2(clientWithHeaders, await client.ontologyRid, action.apiName, {
|
|
1690
1850
|
parameters: await remapActionParams(parameters, client),
|
|
1691
1851
|
options: {
|
|
1692
1852
|
mode: options?.$validateOnly ? "VALIDATE_ONLY" : "VALIDATE_AND_EXECUTE",
|
|
@@ -1773,7 +1933,7 @@ var createStandardOntologyProviderFactory = (client) => {
|
|
|
1773
1933
|
};
|
|
1774
1934
|
|
|
1775
1935
|
// src/util/UserAgent.ts
|
|
1776
|
-
var USER_AGENT = `osdk-client/${"0.20.0
|
|
1936
|
+
var USER_AGENT = `osdk-client/${"0.20.0"}`;
|
|
1777
1937
|
|
|
1778
1938
|
// src/createMinimalClient.ts
|
|
1779
1939
|
function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {
|
|
@@ -1790,7 +1950,8 @@ function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fet
|
|
|
1790
1950
|
objectSetFactory,
|
|
1791
1951
|
ontologyRid: metadata.ontologyRid,
|
|
1792
1952
|
logger: options.logger,
|
|
1793
|
-
clientCacheKey: {}
|
|
1953
|
+
clientCacheKey: {},
|
|
1954
|
+
requestContext: {}
|
|
1794
1955
|
};
|
|
1795
1956
|
return Object.assign(minimalClient, {
|
|
1796
1957
|
ontologyProvider: createStandardOntologyProviderFactory()(minimalClient)
|
|
@@ -1880,7 +2041,9 @@ async function toDataValueQueries(value, client, desiredType) {
|
|
|
1880
2041
|
|
|
1881
2042
|
// src/queries/applyQuery.ts
|
|
1882
2043
|
async function applyQuery(client, query, params) {
|
|
1883
|
-
const response = await esm_exports2.QueryTypes.executeQueryV2(
|
|
2044
|
+
const response = await esm_exports2.QueryTypes.executeQueryV2(addUserAgentAndRequestContextHeaders(augmentRequestContext(client, (_) => ({
|
|
2045
|
+
finalMethodCall: "applyQuery"
|
|
2046
|
+
})), query), await client.ontologyRid, query.apiName, {
|
|
1884
2047
|
parameters: params ? await remapQueryParams(params, client, query.parameters) : {}
|
|
1885
2048
|
});
|
|
1886
2049
|
const objectOutputDefs = await getRequiredDefinitions(query.output, client);
|
|
@@ -2100,6 +2263,6 @@ function createClientInternal(objectSetFactory, baseUrl, ontologyRid, tokenProvi
|
|
|
2100
2263
|
}
|
|
2101
2264
|
var createClient = createClientInternal.bind(void 0, createObjectSet);
|
|
2102
2265
|
|
|
2103
|
-
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 };
|
|
2104
2267
|
//# sourceMappingURL=out.js.map
|
|
2105
|
-
//# sourceMappingURL=chunk-
|
|
2268
|
+
//# sourceMappingURL=chunk-T5DZREKX.js.map
|