@osdk/client 2.6.0-beta.1 → 2.6.0-beta.2
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 +19 -0
- package/build/browser/Client.js +1 -1
- package/build/browser/Client.js.map +1 -1
- package/build/browser/fetchMetadata.test.js +11 -0
- package/build/browser/fetchMetadata.test.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js +15 -0
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +4 -0
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +10 -0
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js +12 -0
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/browser/object/formatting/applyPropertyFormatter.js +52 -0
- package/build/browser/object/formatting/applyPropertyFormatter.js.map +1 -0
- package/build/browser/object/formatting/applyPropertyFormatter.test.js +423 -0
- package/build/browser/object/formatting/applyPropertyFormatter.test.js.map +1 -0
- package/build/browser/object/formatting/formatBoolean.js +23 -0
- package/build/browser/object/formatting/formatBoolean.js.map +1 -0
- package/build/browser/object/formatting/formatNumber.js +242 -0
- package/build/browser/object/formatting/formatNumber.js.map +1 -0
- package/build/browser/object/formatting/propertyFormattingUtils.js +39 -0
- package/build/browser/object/formatting/propertyFormattingUtils.js.map +1 -0
- package/build/browser/util/UserAgent.js +2 -2
- package/build/cjs/{chunk-DCEFUXFS.cjs → chunk-6L3MX4LH.cjs} +35 -15
- package/build/cjs/chunk-6L3MX4LH.cjs.map +1 -0
- package/build/cjs/{chunk-BP7BR5FZ.cjs → chunk-X7WMWKLM.cjs} +298 -54
- package/build/cjs/chunk-X7WMWKLM.cjs.map +1 -0
- package/build/cjs/index.cjs +8 -8
- package/build/cjs/public/internal.cjs +8 -8
- package/build/cjs/public/unstable-do-not-use.cjs +31 -31
- package/build/esm/Client.js +1 -1
- package/build/esm/Client.js.map +1 -1
- package/build/esm/fetchMetadata.test.js +11 -0
- package/build/esm/fetchMetadata.test.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js +15 -0
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +4 -0
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +10 -0
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js +12 -0
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/esm/object/formatting/applyPropertyFormatter.js +52 -0
- package/build/esm/object/formatting/applyPropertyFormatter.js.map +1 -0
- package/build/esm/object/formatting/applyPropertyFormatter.test.js +423 -0
- package/build/esm/object/formatting/applyPropertyFormatter.test.js.map +1 -0
- package/build/esm/object/formatting/formatBoolean.js +23 -0
- package/build/esm/object/formatting/formatBoolean.js.map +1 -0
- package/build/esm/object/formatting/formatNumber.js +242 -0
- package/build/esm/object/formatting/formatNumber.js.map +1 -0
- package/build/esm/object/formatting/propertyFormattingUtils.js +39 -0
- package/build/esm/object/formatting/propertyFormattingUtils.js.map +1 -0
- package/build/esm/util/UserAgent.js +2 -2
- package/build/types/Client.d.ts +1 -1
- package/build/types/object/formatting/applyPropertyFormatter.d.ts +18 -0
- package/build/types/object/formatting/applyPropertyFormatter.d.ts.map +1 -0
- package/build/types/object/formatting/applyPropertyFormatter.test.d.ts +1 -0
- package/build/types/object/formatting/applyPropertyFormatter.test.d.ts.map +1 -0
- package/build/types/object/formatting/formatBoolean.d.ts +5 -0
- package/build/types/object/formatting/formatBoolean.d.ts.map +1 -0
- package/build/types/object/formatting/formatNumber.d.ts +15 -0
- package/build/types/object/formatting/formatNumber.d.ts.map +1 -0
- package/build/types/object/formatting/propertyFormattingUtils.d.ts +10 -0
- package/build/types/object/formatting/propertyFormattingUtils.d.ts.map +1 -0
- package/package.json +7 -7
- package/build/cjs/chunk-BP7BR5FZ.cjs.map +0 -1
- package/build/cjs/chunk-DCEFUXFS.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk6L3MX4LH_cjs = require('./chunk-6L3MX4LH.cjs');
|
|
4
4
|
var unstable = require('@osdk/api/unstable');
|
|
5
5
|
var client_unstable = require('@osdk/client.unstable');
|
|
6
6
|
var invariant = require('tiny-invariant');
|
|
@@ -446,19 +446,19 @@ async function toDataValue(value, client, actionMetadata) {
|
|
|
446
446
|
return Promise.all(promiseArray);
|
|
447
447
|
}
|
|
448
448
|
if (isAttachmentUpload(value)) {
|
|
449
|
-
const attachment = await
|
|
449
|
+
const attachment = await chunk6L3MX4LH_cjs.Attachment_exports.upload(client, value.data, {
|
|
450
450
|
filename: value.name
|
|
451
451
|
});
|
|
452
452
|
return await toDataValue(attachment.rid, client, actionMetadata);
|
|
453
453
|
}
|
|
454
454
|
if (isAttachmentFile(value)) {
|
|
455
|
-
const attachment = await
|
|
455
|
+
const attachment = await chunk6L3MX4LH_cjs.Attachment_exports.upload(client, value, {
|
|
456
456
|
filename: value.name
|
|
457
457
|
});
|
|
458
458
|
return await toDataValue(attachment.rid, client, actionMetadata);
|
|
459
459
|
}
|
|
460
460
|
if (isMediaUpload(value)) {
|
|
461
|
-
const mediaRef = await
|
|
461
|
+
const mediaRef = await chunk6L3MX4LH_cjs.MediaReferenceProperty_exports.uploadMedia(client, await client.ontologyRid, actionMetadata.apiName, value.data, {
|
|
462
462
|
mediaItemPath: value.path,
|
|
463
463
|
preview: true
|
|
464
464
|
});
|
|
@@ -473,11 +473,11 @@ async function toDataValue(value, client, actionMetadata) {
|
|
|
473
473
|
if (isPoint(value)) {
|
|
474
474
|
return await toDataValue(`${value.coordinates[1]},${value.coordinates[0]}`, client, actionMetadata);
|
|
475
475
|
}
|
|
476
|
-
if (
|
|
476
|
+
if (chunk6L3MX4LH_cjs.isWireObjectSet(value)) {
|
|
477
477
|
return value;
|
|
478
478
|
}
|
|
479
|
-
if (
|
|
480
|
-
return
|
|
479
|
+
if (chunk6L3MX4LH_cjs.isObjectSet(value)) {
|
|
480
|
+
return chunk6L3MX4LH_cjs.getWireObjectSet(value);
|
|
481
481
|
}
|
|
482
482
|
if (isMediaReference(value)) {
|
|
483
483
|
return value;
|
|
@@ -500,11 +500,11 @@ async function toDataValue(value, client, actionMetadata) {
|
|
|
500
500
|
|
|
501
501
|
// src/actions/applyAction.ts
|
|
502
502
|
async function applyAction(client, action, parameters, options = {}) {
|
|
503
|
-
const clientWithHeaders =
|
|
503
|
+
const clientWithHeaders = chunk6L3MX4LH_cjs.addUserAgentAndRequestContextHeaders(chunk6L3MX4LH_cjs.augmentRequestContext(client, (_) => ({
|
|
504
504
|
finalMethodCall: "applyAction"
|
|
505
505
|
})), action);
|
|
506
506
|
if (Array.isArray(parameters)) {
|
|
507
|
-
const response = await
|
|
507
|
+
const response = await chunk6L3MX4LH_cjs.Action_exports.applyBatch(clientWithHeaders, await client.ontologyRid, action.apiName, {
|
|
508
508
|
requests: parameters ? await remapBatchActionParams(parameters, client, await client.ontologyProvider.getActionDefinition(action.apiName)) : [],
|
|
509
509
|
options: {
|
|
510
510
|
returnEdits: options?.$returnEdits ? "ALL" : "NONE"
|
|
@@ -515,7 +515,7 @@ async function applyAction(client, action, parameters, options = {}) {
|
|
|
515
515
|
const edits = response.edits;
|
|
516
516
|
return options?.$returnEdits ? edits?.type === "edits" ? remapActionResponse(response) : edits : void 0;
|
|
517
517
|
} else {
|
|
518
|
-
const response = await
|
|
518
|
+
const response = await chunk6L3MX4LH_cjs.Action_exports.apply(clientWithHeaders, await client.ontologyRid, action.apiName, {
|
|
519
519
|
parameters: await remapActionParams(parameters, client, await client.ontologyProvider.getActionDefinition(action.apiName)),
|
|
520
520
|
options: {
|
|
521
521
|
mode: options?.$validateOnly ? "VALIDATE_ONLY" : "VALIDATE_AND_EXECUTE",
|
|
@@ -722,7 +722,7 @@ var GeotimeSeriesPropertyImpl = class {
|
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
724
|
async getLatestValue() {
|
|
725
|
-
const latestPointPromise =
|
|
725
|
+
const latestPointPromise = chunk6L3MX4LH_cjs.TimeSeriesValueBankProperty_exports.getLatestValue(this.#client, await this.#client.ontologyRid, ...this.#triplet);
|
|
726
726
|
latestPointPromise.then(
|
|
727
727
|
(latestPoint) => this.lastFetchedValue = latestPoint,
|
|
728
728
|
// eslint-disable-next-line no-console
|
|
@@ -738,7 +738,7 @@ var GeotimeSeriesPropertyImpl = class {
|
|
|
738
738
|
return allPoints;
|
|
739
739
|
}
|
|
740
740
|
async *asyncIterValues(query) {
|
|
741
|
-
const streamPointsIterator = await
|
|
741
|
+
const streamPointsIterator = await chunk6L3MX4LH_cjs.TimeSeriesValueBankProperty_exports.streamValues(this.#client, await this.#client.ontologyRid, ...this.#triplet, query ? {
|
|
742
742
|
range: getTimeRange(query)
|
|
743
743
|
} : {});
|
|
744
744
|
for await (const timeseriesPoint of asyncIterPointsHelper(streamPointsIterator)) {
|
|
@@ -765,13 +765,13 @@ var MediaReferencePropertyImpl = class {
|
|
|
765
765
|
this.#mediaReference = mediaReference;
|
|
766
766
|
}
|
|
767
767
|
async fetchContents() {
|
|
768
|
-
return
|
|
768
|
+
return chunk6L3MX4LH_cjs.MediaReferenceProperty_exports.getMediaContent(this.#client, await this.#client.ontologyRid, ...this.#triplet, {
|
|
769
769
|
preview: true
|
|
770
770
|
// TODO: Can turn this back off when backend is no longer in beta.
|
|
771
771
|
});
|
|
772
772
|
}
|
|
773
773
|
async fetchMetadata() {
|
|
774
|
-
const r = await
|
|
774
|
+
const r = await chunk6L3MX4LH_cjs.MediaReferenceProperty_exports.getMediaMetadata(this.#client, await this.#client.ontologyRid, ...this.#triplet, {
|
|
775
775
|
preview: true
|
|
776
776
|
// TODO: Can turn this back off when backend is no longer in beta.
|
|
777
777
|
});
|
|
@@ -795,10 +795,10 @@ var TimeSeriesPropertyImpl = class {
|
|
|
795
795
|
this.#triplet = [objectApiName, primaryKey, propertyName];
|
|
796
796
|
}
|
|
797
797
|
async getFirstPoint() {
|
|
798
|
-
return
|
|
798
|
+
return chunk6L3MX4LH_cjs.TimeSeriesPropertyV2_exports.getFirstPoint(this.#client, await this.#client.ontologyRid, ...this.#triplet);
|
|
799
799
|
}
|
|
800
800
|
async getLastPoint() {
|
|
801
|
-
return
|
|
801
|
+
return chunk6L3MX4LH_cjs.TimeSeriesPropertyV2_exports.getLastPoint(this.#client, await this.#client.ontologyRid, ...this.#triplet);
|
|
802
802
|
}
|
|
803
803
|
async getAllPoints(query) {
|
|
804
804
|
const allPoints = [];
|
|
@@ -808,7 +808,7 @@ var TimeSeriesPropertyImpl = class {
|
|
|
808
808
|
return allPoints;
|
|
809
809
|
}
|
|
810
810
|
async *asyncIterPoints(query) {
|
|
811
|
-
const streamPointsIterator = await
|
|
811
|
+
const streamPointsIterator = await chunk6L3MX4LH_cjs.TimeSeriesPropertyV2_exports.streamPoints(this.#client, await this.#client.ontologyRid, ...this.#triplet, query ? {
|
|
812
812
|
range: getTimeRange(query)
|
|
813
813
|
} : {});
|
|
814
814
|
for await (const timeseriesPoint of asyncIterPointsHelper(streamPointsIterator)) {
|
|
@@ -817,6 +817,237 @@ var TimeSeriesPropertyImpl = class {
|
|
|
817
817
|
}
|
|
818
818
|
};
|
|
819
819
|
|
|
820
|
+
// src/object/formatting/formatBoolean.ts
|
|
821
|
+
function formatBoolean(value, rule) {
|
|
822
|
+
return value ? rule.valueIfTrue : rule.valueIfFalse;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
// src/object/formatting/propertyFormattingUtils.ts
|
|
826
|
+
function resolvePropertyReference(ref, objectData) {
|
|
827
|
+
if (ref.type === "constant") {
|
|
828
|
+
return ref.value;
|
|
829
|
+
} else if (ref.type === "propertyType") {
|
|
830
|
+
const value = objectData[ref.propertyApiName];
|
|
831
|
+
return value != null ? String(value) : void 0;
|
|
832
|
+
}
|
|
833
|
+
return void 0;
|
|
834
|
+
}
|
|
835
|
+
function getBrowserLocale() {
|
|
836
|
+
if (typeof navigator !== "undefined" && navigator.language != null) {
|
|
837
|
+
return navigator.language;
|
|
838
|
+
}
|
|
839
|
+
return "en-US";
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
// src/object/formatting/formatNumber.ts
|
|
843
|
+
function formatNumber(value, numberType, objectData, locale) {
|
|
844
|
+
switch (numberType.type) {
|
|
845
|
+
case "standard":
|
|
846
|
+
return formatStandardNumber(value, numberType.baseFormatOptions, locale);
|
|
847
|
+
case "fixedValues":
|
|
848
|
+
return numberType.values[value];
|
|
849
|
+
case "currency":
|
|
850
|
+
return formatCurrency(value, numberType, objectData, locale);
|
|
851
|
+
case "standardUnit":
|
|
852
|
+
return formatStandardUnit(value, numberType, objectData, locale);
|
|
853
|
+
case "customUnit":
|
|
854
|
+
return formatCustomUnit(value, numberType, objectData, locale);
|
|
855
|
+
case "affix":
|
|
856
|
+
return formatAffix(value, numberType, objectData, locale);
|
|
857
|
+
case "duration":
|
|
858
|
+
return void 0;
|
|
859
|
+
case "scale":
|
|
860
|
+
return formatScale(value, numberType, locale);
|
|
861
|
+
case "ratio":
|
|
862
|
+
return formatRatio(value, numberType, locale);
|
|
863
|
+
default:
|
|
864
|
+
return void 0;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
function formatStandardNumber(value, options, locale) {
|
|
868
|
+
return formatNumberWithAffixes(value, options, locale);
|
|
869
|
+
}
|
|
870
|
+
function formatCurrency(value, rule, objectData, locale) {
|
|
871
|
+
const currencyCode = resolvePropertyReference(rule.currencyCode, objectData);
|
|
872
|
+
if (currencyCode == null) {
|
|
873
|
+
return formatStandardNumber(value, rule.baseFormatOptions, locale);
|
|
874
|
+
}
|
|
875
|
+
const options = {
|
|
876
|
+
...convertToIntlOptions(rule.baseFormatOptions),
|
|
877
|
+
style: "currency",
|
|
878
|
+
currency: currencyCode,
|
|
879
|
+
currencyDisplay: rule.style === "COMPACT" ? "narrowSymbol" : "symbol"
|
|
880
|
+
};
|
|
881
|
+
return formatWithIntl(value, options, locale);
|
|
882
|
+
}
|
|
883
|
+
function formatStandardUnit(value, rule, objectData, locale) {
|
|
884
|
+
const unit = resolvePropertyReference(rule.unit, objectData);
|
|
885
|
+
if (unit == null) {
|
|
886
|
+
return formatStandardNumber(value, rule.baseFormatOptions, locale);
|
|
887
|
+
}
|
|
888
|
+
const options = {
|
|
889
|
+
...convertToIntlOptions(rule.baseFormatOptions),
|
|
890
|
+
style: "unit",
|
|
891
|
+
unit
|
|
892
|
+
};
|
|
893
|
+
try {
|
|
894
|
+
return formatWithIntl(value, options, locale);
|
|
895
|
+
} catch (error) {
|
|
896
|
+
const suffix = ` ${unit}`;
|
|
897
|
+
return formatNumberWithAffixes(value, rule.baseFormatOptions, locale, "", suffix);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
function formatCustomUnit(value, rule, objectData, locale) {
|
|
901
|
+
const unit = resolvePropertyReference(rule.unit, objectData);
|
|
902
|
+
const suffix = unit != null ? ` ${unit}` : "";
|
|
903
|
+
return formatNumberWithAffixes(value, rule.baseFormatOptions, locale, "", suffix);
|
|
904
|
+
}
|
|
905
|
+
function formatAffix(value, rule, objectData, locale) {
|
|
906
|
+
const prefix = rule.affix.prefix != null ? resolvePropertyReference(rule.affix.prefix, objectData) ?? "" : "";
|
|
907
|
+
const suffix = rule.affix.postfix != null ? resolvePropertyReference(rule.affix.postfix, objectData) ?? "" : "";
|
|
908
|
+
return formatNumberWithAffixes(value, rule.baseFormatOptions, locale, prefix, suffix);
|
|
909
|
+
}
|
|
910
|
+
function getScaleDivisor(scaleType) {
|
|
911
|
+
switch (scaleType) {
|
|
912
|
+
case "THOUSANDS":
|
|
913
|
+
return 1e3;
|
|
914
|
+
case "MILLIONS":
|
|
915
|
+
return 1e6;
|
|
916
|
+
case "BILLIONS":
|
|
917
|
+
return 1e9;
|
|
918
|
+
default:
|
|
919
|
+
throw new Error(`Unknown scale type: ${scaleType}`);
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
function getLocalizedCompactSuffix(scaleDivisor, locale) {
|
|
923
|
+
const compactFormatter = new Intl.NumberFormat(locale, {
|
|
924
|
+
notation: "compact",
|
|
925
|
+
compactDisplay: "short"
|
|
926
|
+
});
|
|
927
|
+
const parts = compactFormatter.formatToParts(scaleDivisor);
|
|
928
|
+
const compactPart = parts.find((p) => p.type === "compact");
|
|
929
|
+
return compactPart?.value ?? "";
|
|
930
|
+
}
|
|
931
|
+
function formatScale(value, rule, locale) {
|
|
932
|
+
const scaleDivisor = getScaleDivisor(rule.scaleType);
|
|
933
|
+
const scaledValue = value / scaleDivisor;
|
|
934
|
+
const suffix = getLocalizedCompactSuffix(scaleDivisor, locale);
|
|
935
|
+
return formatNumberWithAffixes(scaledValue, rule.baseFormatOptions, locale, "", suffix);
|
|
936
|
+
}
|
|
937
|
+
function getRatioScaledValue(value, ratioType) {
|
|
938
|
+
switch (ratioType) {
|
|
939
|
+
case "PERCENTAGE":
|
|
940
|
+
return value * 100;
|
|
941
|
+
case "PER_MILLE":
|
|
942
|
+
return value * 1e3;
|
|
943
|
+
case "BASIS_POINTS":
|
|
944
|
+
return value * 1e4;
|
|
945
|
+
default:
|
|
946
|
+
throw new Error(`Unknown ratio type: ${ratioType}`);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
function formatRatio(value, rule, locale) {
|
|
950
|
+
if (rule.ratioType === "PERCENTAGE") {
|
|
951
|
+
const options = {
|
|
952
|
+
...convertToIntlOptions(rule.baseFormatOptions),
|
|
953
|
+
style: "percent"
|
|
954
|
+
};
|
|
955
|
+
return formatWithIntl(value, options, locale);
|
|
956
|
+
}
|
|
957
|
+
const scaledValue = getRatioScaledValue(value, rule.ratioType);
|
|
958
|
+
let suffix;
|
|
959
|
+
switch (rule.ratioType) {
|
|
960
|
+
case "PER_MILLE":
|
|
961
|
+
suffix = "\u2030";
|
|
962
|
+
break;
|
|
963
|
+
case "BASIS_POINTS":
|
|
964
|
+
suffix = " bps";
|
|
965
|
+
break;
|
|
966
|
+
default:
|
|
967
|
+
rule.ratioType;
|
|
968
|
+
throw new Error(`Unknown ratio type: ${rule.ratioType}`);
|
|
969
|
+
}
|
|
970
|
+
return formatNumberWithAffixes(scaledValue, rule.baseFormatOptions, locale, "", suffix);
|
|
971
|
+
}
|
|
972
|
+
function mapNotation(notation) {
|
|
973
|
+
switch (notation) {
|
|
974
|
+
case "STANDARD":
|
|
975
|
+
return "standard";
|
|
976
|
+
case "SCIENTIFIC":
|
|
977
|
+
return "scientific";
|
|
978
|
+
case "ENGINEERING":
|
|
979
|
+
return "engineering";
|
|
980
|
+
case "COMPACT":
|
|
981
|
+
return "compact";
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
function mapRoundingMode(mode) {
|
|
985
|
+
switch (mode) {
|
|
986
|
+
case "CEIL":
|
|
987
|
+
return "ceil";
|
|
988
|
+
case "FLOOR":
|
|
989
|
+
return "floor";
|
|
990
|
+
case "ROUND_CLOSEST":
|
|
991
|
+
return "halfExpand";
|
|
992
|
+
default:
|
|
993
|
+
return void 0;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
function convertToIntlOptions(options) {
|
|
997
|
+
return {
|
|
998
|
+
useGrouping: options.useGrouping,
|
|
999
|
+
minimumIntegerDigits: options.minimumIntegerDigits,
|
|
1000
|
+
minimumFractionDigits: options.minimumFractionDigits,
|
|
1001
|
+
maximumFractionDigits: options.maximumFractionDigits,
|
|
1002
|
+
minimumSignificantDigits: options.minimumSignificantDigits,
|
|
1003
|
+
maximumSignificantDigits: options.maximumSignificantDigits,
|
|
1004
|
+
notation: options.notation ? mapNotation(options.notation) : void 0,
|
|
1005
|
+
roundingMode: options.roundingMode ? mapRoundingMode(options.roundingMode) : void 0,
|
|
1006
|
+
convertNegativeToParenthesis: options.convertNegativeToParenthesis
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
1009
|
+
function maybeConvertNegativeToParenthesis(formatted, value, shouldConvert) {
|
|
1010
|
+
if (shouldConvert && value < 0) {
|
|
1011
|
+
return formatted.replace(/^-/, "(") + ")";
|
|
1012
|
+
}
|
|
1013
|
+
return formatted;
|
|
1014
|
+
}
|
|
1015
|
+
function formatWithIntl(value, options, locale) {
|
|
1016
|
+
const formatter = new Intl.NumberFormat(locale, options);
|
|
1017
|
+
const formatted = formatter.format(value);
|
|
1018
|
+
return maybeConvertNegativeToParenthesis(formatted, value, options.convertNegativeToParenthesis ?? false);
|
|
1019
|
+
}
|
|
1020
|
+
function formatNumberWithAffixes(value, baseOptions, locale, prefix, suffix) {
|
|
1021
|
+
const intlOptions = convertToIntlOptions(baseOptions);
|
|
1022
|
+
const formatted = formatWithIntl(value, intlOptions, locale);
|
|
1023
|
+
return `${prefix || ""}${formatted}${suffix || ""}`;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
// src/object/formatting/applyPropertyFormatter.ts
|
|
1027
|
+
function applyPropertyFormatter(propertyValue, propertyDefinition, objectData, options = {}) {
|
|
1028
|
+
if (propertyDefinition?.valueFormatting == null || propertyValue == null) {
|
|
1029
|
+
return void 0;
|
|
1030
|
+
}
|
|
1031
|
+
return formatPropertyValue(propertyValue, propertyDefinition.valueFormatting, objectData, options);
|
|
1032
|
+
}
|
|
1033
|
+
function formatPropertyValue(value, rule, objectData, options) {
|
|
1034
|
+
switch (rule.type) {
|
|
1035
|
+
case "boolean":
|
|
1036
|
+
if (typeof value !== "boolean") {
|
|
1037
|
+
return void 0;
|
|
1038
|
+
}
|
|
1039
|
+
return formatBoolean(value, rule);
|
|
1040
|
+
case "number":
|
|
1041
|
+
if (typeof value !== "number") {
|
|
1042
|
+
return void 0;
|
|
1043
|
+
}
|
|
1044
|
+
return formatNumber(value, rule.numberType, objectData, options.locale ?? getBrowserLocale());
|
|
1045
|
+
// TODO - implement rest of formatters
|
|
1046
|
+
default:
|
|
1047
|
+
return void 0;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
|
|
820
1051
|
// src/ontology/OntologyProvider.ts
|
|
821
1052
|
var InterfaceDefinitions = Symbol("InterfaceDefinitions" );
|
|
822
1053
|
|
|
@@ -837,8 +1068,8 @@ function get$link(holder) {
|
|
|
837
1068
|
[objDef.primaryKeyApiName]: rawObj.$primaryKey
|
|
838
1069
|
}).pivotTo(linkName);
|
|
839
1070
|
const value = !linkDef.multiplicity ? {
|
|
840
|
-
fetchOne: (options) =>
|
|
841
|
-
fetchOneWithErrors: (options) =>
|
|
1071
|
+
fetchOne: (options) => chunk6L3MX4LH_cjs.fetchSingle(client, objDef, options ?? {}, chunk6L3MX4LH_cjs.getWireObjectSet(objectSet)),
|
|
1072
|
+
fetchOneWithErrors: (options) => chunk6L3MX4LH_cjs.fetchSingleWithErrors(client, objDef, options ?? {}, chunk6L3MX4LH_cjs.getWireObjectSet(objectSet))
|
|
842
1073
|
} : objectSet;
|
|
843
1074
|
return [linkName, value];
|
|
844
1075
|
})));
|
|
@@ -854,8 +1085,8 @@ function get$linkForInterface(holder) {
|
|
|
854
1085
|
[objDef.primaryKeyApiName]: rawObj.$primaryKey
|
|
855
1086
|
})).pivotTo(linkName);
|
|
856
1087
|
const value = !linkDef.multiplicity ? {
|
|
857
|
-
fetchOne: (options) =>
|
|
858
|
-
fetchOneWithErrors: (options) =>
|
|
1088
|
+
fetchOne: (options) => chunk6L3MX4LH_cjs.fetchSingle(client, objDef, options ?? {}, chunk6L3MX4LH_cjs.getWireObjectSet(objectSet)),
|
|
1089
|
+
fetchOneWithErrors: (options) => chunk6L3MX4LH_cjs.fetchSingleWithErrors(client, objDef, options ?? {}, chunk6L3MX4LH_cjs.getWireObjectSet(objectSet))
|
|
859
1090
|
} : objectSet;
|
|
860
1091
|
return [linkName, value];
|
|
861
1092
|
})));
|
|
@@ -863,7 +1094,7 @@ function get$linkForInterface(holder) {
|
|
|
863
1094
|
|
|
864
1095
|
// src/object/convertWireToOsdkObjects/createOsdkInterface.ts
|
|
865
1096
|
function createOsdkInterface(underlying, interfaceDef) {
|
|
866
|
-
const [objApiNamespace] =
|
|
1097
|
+
const [objApiNamespace] = chunk6L3MX4LH_cjs.extractNamespace(interfaceDef.apiName);
|
|
867
1098
|
return Object.freeze(Object.defineProperties({}, {
|
|
868
1099
|
// first to minimize hidden classes
|
|
869
1100
|
[UnderlyingOsdkObject]: {
|
|
@@ -908,6 +1139,10 @@ function createOsdkInterface(underlying, interfaceDef) {
|
|
|
908
1139
|
},
|
|
909
1140
|
enumerable: false
|
|
910
1141
|
},
|
|
1142
|
+
"$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue": {
|
|
1143
|
+
value: underlying.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue,
|
|
1144
|
+
enumerable: false
|
|
1145
|
+
},
|
|
911
1146
|
"$link": {
|
|
912
1147
|
get: function() {
|
|
913
1148
|
return get$linkForInterface(this);
|
|
@@ -918,7 +1153,7 @@ function createOsdkInterface(underlying, interfaceDef) {
|
|
|
918
1153
|
},
|
|
919
1154
|
...Object.fromEntries(Object.keys(interfaceDef.properties).map((p) => {
|
|
920
1155
|
const objDef = underlying[ObjectDefRef];
|
|
921
|
-
const [apiNamespace, apiName] =
|
|
1156
|
+
const [apiNamespace, apiName] = chunk6L3MX4LH_cjs.extractNamespace(p);
|
|
922
1157
|
const targetPropName = objDef.interfaceMap[interfaceDef.apiName][p];
|
|
923
1158
|
return [apiNamespace === objApiNamespace ? apiName : p, {
|
|
924
1159
|
enumerable: targetPropName in underlying,
|
|
@@ -1032,6 +1267,15 @@ var basePropDefs = {
|
|
|
1032
1267
|
};
|
|
1033
1268
|
},
|
|
1034
1269
|
enumerable: false
|
|
1270
|
+
},
|
|
1271
|
+
"$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue": {
|
|
1272
|
+
value: function(propertyApiName, options) {
|
|
1273
|
+
const rawObj = this[UnderlyingOsdkObject];
|
|
1274
|
+
const def = this[ObjectDefRef];
|
|
1275
|
+
const propertyValue = rawObj[propertyApiName];
|
|
1276
|
+
return applyPropertyFormatter(propertyValue, def.properties[propertyApiName], rawObj, options);
|
|
1277
|
+
},
|
|
1278
|
+
enumerable: false
|
|
1035
1279
|
}
|
|
1036
1280
|
};
|
|
1037
1281
|
function createOsdkObject(client, objectDef, simpleOsdkProperties, derivedPropertyTypeByName = {}) {
|
|
@@ -1070,9 +1314,9 @@ function modifyRdpProperties(client, derivedPropertyTypeByName, rawValue, propKe
|
|
|
1070
1314
|
switch (derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType?.type) {
|
|
1071
1315
|
case "attachment":
|
|
1072
1316
|
if (Array.isArray(rawValue)) {
|
|
1073
|
-
return rawValue.map((a) =>
|
|
1317
|
+
return rawValue.map((a) => chunk6L3MX4LH_cjs.hydrateAttachmentFromRidInternal(client, a.rid));
|
|
1074
1318
|
} else {
|
|
1075
|
-
return
|
|
1319
|
+
return chunk6L3MX4LH_cjs.hydrateAttachmentFromRidInternal(client, rawValue.rid);
|
|
1076
1320
|
}
|
|
1077
1321
|
default:
|
|
1078
1322
|
process.env.NODE_ENV !== "production" ? invariant__default.default(false, "Derived property aggregations for Timeseries and Media are not supported") : invariant__default.default(false) ;
|
|
@@ -1088,9 +1332,9 @@ function createSpecialProperty(client, objectDef, rawObject, p) {
|
|
|
1088
1332
|
}
|
|
1089
1333
|
if (propDef.type === "attachment") {
|
|
1090
1334
|
if (Array.isArray(rawValue)) {
|
|
1091
|
-
return rawValue.map((a) =>
|
|
1335
|
+
return rawValue.map((a) => chunk6L3MX4LH_cjs.hydrateAttachmentFromRidInternal(client, a.rid));
|
|
1092
1336
|
}
|
|
1093
|
-
return
|
|
1337
|
+
return chunk6L3MX4LH_cjs.hydrateAttachmentFromRidInternal(client, rawValue.rid);
|
|
1094
1338
|
}
|
|
1095
1339
|
if (propDef.type === "numericTimeseries" || propDef.type === "stringTimeseries" || propDef.type === "sensorTimeseries") {
|
|
1096
1340
|
return new TimeSeriesPropertyImpl(client, objectDef.apiName, rawObject[objectDef.primaryKeyApiName], p);
|
|
@@ -1314,13 +1558,13 @@ function deepFreeze(obj) {
|
|
|
1314
1558
|
return Object.freeze(obj);
|
|
1315
1559
|
}
|
|
1316
1560
|
async function loadActionMetadata(client, actionType) {
|
|
1317
|
-
const r = await
|
|
1561
|
+
const r = await chunk6L3MX4LH_cjs.ActionTypeV2_exports.get(client, await client.ontologyRid, actionType, {
|
|
1318
1562
|
branch: client.branch
|
|
1319
1563
|
});
|
|
1320
1564
|
return generatorConverters.wireActionTypeV2ToSdkActionMetadata(r);
|
|
1321
1565
|
}
|
|
1322
1566
|
async function loadFullObjectMetadata(client, objectType) {
|
|
1323
|
-
const full = await
|
|
1567
|
+
const full = await chunk6L3MX4LH_cjs.ObjectTypeV2_exports.getFullMetadata(client, await client.ontologyRid, objectType, {
|
|
1324
1568
|
preview: true,
|
|
1325
1569
|
branch: client.branch
|
|
1326
1570
|
});
|
|
@@ -1330,7 +1574,7 @@ async function loadFullObjectMetadata(client, objectType) {
|
|
|
1330
1574
|
};
|
|
1331
1575
|
}
|
|
1332
1576
|
async function loadInterfaceMetadata(client, objectType) {
|
|
1333
|
-
const r = await
|
|
1577
|
+
const r = await chunk6L3MX4LH_cjs.OntologyInterface_exports.get(client, await client.ontologyRid, objectType, {
|
|
1334
1578
|
preview: true,
|
|
1335
1579
|
branch: client.branch
|
|
1336
1580
|
});
|
|
@@ -1338,7 +1582,7 @@ async function loadInterfaceMetadata(client, objectType) {
|
|
|
1338
1582
|
}
|
|
1339
1583
|
async function loadQueryMetadata(client, queryTypeApiNameAndVersion) {
|
|
1340
1584
|
const [apiName, version] = queryTypeApiNameAndVersion.split(":");
|
|
1341
|
-
const r = await
|
|
1585
|
+
const r = await chunk6L3MX4LH_cjs.QueryType_exports.get(client, await client.ontologyRid, apiName, {
|
|
1342
1586
|
version
|
|
1343
1587
|
});
|
|
1344
1588
|
return generatorConverters.wireQueryTypeV2ToSdkQueryMetadata(r);
|
|
@@ -1395,11 +1639,11 @@ var createStandardOntologyProviderFactory = (client) => {
|
|
|
1395
1639
|
};
|
|
1396
1640
|
|
|
1397
1641
|
// src/util/UserAgent.ts
|
|
1398
|
-
var USER_AGENT = `osdk-client/${"2.6.0-beta.
|
|
1399
|
-
var OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.6.0-beta.
|
|
1642
|
+
var USER_AGENT = `osdk-client/${"2.6.0-beta.2"}`;
|
|
1643
|
+
var OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.6.0-beta.2"}`;
|
|
1400
1644
|
|
|
1401
1645
|
// src/createMinimalClient.ts
|
|
1402
|
-
function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory =
|
|
1646
|
+
function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = chunk6L3MX4LH_cjs.createObjectSet, createOntologyProviderFactory = createStandardOntologyProviderFactory) {
|
|
1403
1647
|
if (process.env.NODE_ENV !== "production") {
|
|
1404
1648
|
try {
|
|
1405
1649
|
new URL(baseUrl);
|
|
@@ -1467,13 +1711,13 @@ async function toDataValueQueries(value, client, desiredType) {
|
|
|
1467
1711
|
switch (desiredType.type) {
|
|
1468
1712
|
case "attachment": {
|
|
1469
1713
|
if (isAttachmentUpload(value)) {
|
|
1470
|
-
const attachment = await
|
|
1714
|
+
const attachment = await chunk6L3MX4LH_cjs.Attachment_exports.upload(client, value.data, {
|
|
1471
1715
|
filename: value.name
|
|
1472
1716
|
});
|
|
1473
1717
|
return attachment.rid;
|
|
1474
1718
|
}
|
|
1475
1719
|
if (isAttachmentFile(value)) {
|
|
1476
|
-
const attachment = await
|
|
1720
|
+
const attachment = await chunk6L3MX4LH_cjs.Attachment_exports.upload(client, value, {
|
|
1477
1721
|
filename: value.name
|
|
1478
1722
|
});
|
|
1479
1723
|
return attachment.rid;
|
|
@@ -1513,11 +1757,11 @@ async function toDataValueQueries(value, client, desiredType) {
|
|
|
1513
1757
|
}
|
|
1514
1758
|
case "objectSet":
|
|
1515
1759
|
case "interfaceObjectSet": {
|
|
1516
|
-
if (
|
|
1760
|
+
if (chunk6L3MX4LH_cjs.isWireObjectSet(value)) {
|
|
1517
1761
|
return value;
|
|
1518
1762
|
}
|
|
1519
|
-
if (
|
|
1520
|
-
return
|
|
1763
|
+
if (chunk6L3MX4LH_cjs.isObjectSet(value)) {
|
|
1764
|
+
return chunk6L3MX4LH_cjs.getWireObjectSet(value);
|
|
1521
1765
|
}
|
|
1522
1766
|
break;
|
|
1523
1767
|
}
|
|
@@ -1559,7 +1803,7 @@ async function toDataValueQueries(value, client, desiredType) {
|
|
|
1559
1803
|
// src/queries/applyQuery.ts
|
|
1560
1804
|
async function applyQuery(client, query, params) {
|
|
1561
1805
|
const qd = client.ontologyProvider.getQueryDefinition(query.apiName, query.isFixedVersion ? query.version : void 0);
|
|
1562
|
-
const response = await
|
|
1806
|
+
const response = await chunk6L3MX4LH_cjs.Query_exports.execute(chunk6L3MX4LH_cjs.addUserAgentAndRequestContextHeaders(chunk6L3MX4LH_cjs.augmentRequestContext(client, (_) => ({
|
|
1563
1807
|
finalMethodCall: "applyQuery"
|
|
1564
1808
|
})), query), await client.ontologyRid, query.apiName, {
|
|
1565
1809
|
parameters: params ? await remapQueryParams(params, client, (await qd).parameters) : {}
|
|
@@ -1606,7 +1850,7 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
|
|
|
1606
1850
|
return responseValue;
|
|
1607
1851
|
}
|
|
1608
1852
|
case "attachment": {
|
|
1609
|
-
return
|
|
1853
|
+
return chunk6L3MX4LH_cjs.hydrateAttachmentFromRidInternal(client, responseValue);
|
|
1610
1854
|
}
|
|
1611
1855
|
case "object": {
|
|
1612
1856
|
const def = definitions.get(responseDataType.object);
|
|
@@ -1628,7 +1872,7 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
|
|
|
1628
1872
|
throw new Error(`Missing definition for ${responseDataType.objectSet}`);
|
|
1629
1873
|
}
|
|
1630
1874
|
if (typeof responseValue === "string") {
|
|
1631
|
-
return
|
|
1875
|
+
return chunk6L3MX4LH_cjs.createObjectSet(def, client, {
|
|
1632
1876
|
type: "intersect",
|
|
1633
1877
|
objectSets: [{
|
|
1634
1878
|
type: "base",
|
|
@@ -1639,7 +1883,7 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
|
|
|
1639
1883
|
}]
|
|
1640
1884
|
});
|
|
1641
1885
|
}
|
|
1642
|
-
return
|
|
1886
|
+
return chunk6L3MX4LH_cjs.createObjectSet(def, client, responseValue);
|
|
1643
1887
|
}
|
|
1644
1888
|
case "struct": {
|
|
1645
1889
|
for (const [key, subtype] of Object.entries(responseDataType.struct)) {
|
|
@@ -1825,7 +2069,7 @@ function createClientInternal(objectSetFactory, transactionRid, baseUrl, ontolog
|
|
|
1825
2069
|
ontologyRid
|
|
1826
2070
|
}, baseUrl, tokenProvider, {
|
|
1827
2071
|
...options,
|
|
1828
|
-
logger: options?.logger ?? new
|
|
2072
|
+
logger: options?.logger ?? new chunk6L3MX4LH_cjs.MinimalLogger(),
|
|
1829
2073
|
transactionRid,
|
|
1830
2074
|
branch: options?.branch
|
|
1831
2075
|
}, fetchFn, objectSetFactory);
|
|
@@ -1848,7 +2092,7 @@ function createClientFromContext(clientCtx) {
|
|
|
1848
2092
|
case unstable.__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid.name:
|
|
1849
2093
|
return {
|
|
1850
2094
|
fetchOneByRid: async (objectType, rid, options) => {
|
|
1851
|
-
return await
|
|
2095
|
+
return await chunk6L3MX4LH_cjs.fetchSingle(clientCtx, objectType, options, createWithRid([rid]));
|
|
1852
2096
|
}
|
|
1853
2097
|
};
|
|
1854
2098
|
case unstable.__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference.name:
|
|
@@ -1860,7 +2104,7 @@ function createClientFromContext(clientCtx) {
|
|
|
1860
2104
|
objectType,
|
|
1861
2105
|
propertyType
|
|
1862
2106
|
} = args;
|
|
1863
|
-
return await
|
|
2107
|
+
return await chunk6L3MX4LH_cjs.MediaReferenceProperty_exports.upload(clientCtx, await clientCtx.ontologyRid, objectType.apiName, propertyType, data, {
|
|
1864
2108
|
mediaItemPath: fileName,
|
|
1865
2109
|
preview: true
|
|
1866
2110
|
});
|
|
@@ -1869,10 +2113,10 @@ function createClientFromContext(clientCtx) {
|
|
|
1869
2113
|
case unstable.__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid.name:
|
|
1870
2114
|
return {
|
|
1871
2115
|
fetchPageByRid: async (objectOrInterfaceType, rids, options = {}) => {
|
|
1872
|
-
return await
|
|
2116
|
+
return await chunk6L3MX4LH_cjs.fetchPage(clientCtx, objectOrInterfaceType, options, createWithRid(rids));
|
|
1873
2117
|
},
|
|
1874
2118
|
fetchPageByRidNoType: async (rids, options) => {
|
|
1875
|
-
return await
|
|
2119
|
+
return await chunk6L3MX4LH_cjs.fetchStaticRidPage(clientCtx, rids, options ?? {});
|
|
1876
2120
|
}
|
|
1877
2121
|
};
|
|
1878
2122
|
}
|
|
@@ -1884,13 +2128,13 @@ function createClientFromContext(clientCtx) {
|
|
|
1884
2128
|
const fetchMetadata = fetchMetadataInternal.bind(void 0, clientCtx);
|
|
1885
2129
|
const symbolClientContext2 = "__osdkClientContext";
|
|
1886
2130
|
const client = Object.defineProperties(clientFn, {
|
|
1887
|
-
[
|
|
2131
|
+
[chunk6L3MX4LH_cjs.symbolClientContext]: {
|
|
1888
2132
|
value: clientCtx
|
|
1889
2133
|
},
|
|
1890
2134
|
[symbolClientContext2]: {
|
|
1891
2135
|
value: clientCtx
|
|
1892
2136
|
},
|
|
1893
|
-
[
|
|
2137
|
+
[chunk6L3MX4LH_cjs.additionalContext]: {
|
|
1894
2138
|
value: clientCtx
|
|
1895
2139
|
},
|
|
1896
2140
|
fetchMetadata: {
|
|
@@ -1899,8 +2143,8 @@ function createClientFromContext(clientCtx) {
|
|
|
1899
2143
|
});
|
|
1900
2144
|
return client;
|
|
1901
2145
|
}
|
|
1902
|
-
var createClient = createClientInternal.bind(void 0,
|
|
1903
|
-
var createClientWithTransaction = (transactionRid, ...args) => createClientInternal(
|
|
2146
|
+
var createClient = createClientInternal.bind(void 0, chunk6L3MX4LH_cjs.createObjectSet, void 0);
|
|
2147
|
+
var createClientWithTransaction = (transactionRid, ...args) => createClientInternal(chunk6L3MX4LH_cjs.createObjectSet, transactionRid, ...args);
|
|
1904
2148
|
function createWithRid(rids) {
|
|
1905
2149
|
const withRid = {
|
|
1906
2150
|
type: "static",
|
|
@@ -1920,5 +2164,5 @@ exports.createClientFromContext = createClientFromContext;
|
|
|
1920
2164
|
exports.createClientWithTransaction = createClientWithTransaction;
|
|
1921
2165
|
exports.createObjectSpecifierFromPrimaryKey = createObjectSpecifierFromPrimaryKey;
|
|
1922
2166
|
exports.extractPrimaryKeyFromObjectSpecifier = extractPrimaryKeyFromObjectSpecifier;
|
|
1923
|
-
//# sourceMappingURL=chunk-
|
|
1924
|
-
//# sourceMappingURL=chunk-
|
|
2167
|
+
//# sourceMappingURL=chunk-X7WMWKLM.cjs.map
|
|
2168
|
+
//# sourceMappingURL=chunk-X7WMWKLM.cjs.map
|