@osdk/generator-converters 2.6.0-beta.1 → 2.6.0-beta.11
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 +85 -0
- package/build/browser/valueFormatting/commonValueFormattingUtils.js +33 -0
- package/build/browser/valueFormatting/commonValueFormattingUtils.js.map +1 -0
- package/build/browser/valueFormatting/convertBooleanValueFormattingRule.js +24 -0
- package/build/browser/valueFormatting/convertBooleanValueFormattingRule.js.map +1 -0
- package/build/browser/valueFormatting/convertDateAndTimestampValueFormattingRule.js +62 -0
- package/build/browser/valueFormatting/convertDateAndTimestampValueFormattingRule.js.map +1 -0
- package/build/browser/valueFormatting/convertKnownTypeValueFormattingRule.js +39 -0
- package/build/browser/valueFormatting/convertKnownTypeValueFormattingRule.js.map +1 -0
- package/build/browser/valueFormatting/convertNumberValueFormattingRule.js +133 -0
- package/build/browser/valueFormatting/convertNumberValueFormattingRule.js.map +1 -0
- package/build/browser/wirePropertyFormattingToSdkFormatting.js +49 -0
- package/build/browser/wirePropertyFormattingToSdkFormatting.js.map +1 -0
- package/build/browser/wirePropertyFormattingToSdkFormatting.test.js +344 -0
- package/build/browser/wirePropertyFormattingToSdkFormatting.test.js.map +1 -0
- package/build/browser/wirePropertyV2ToSdkPropertyDefinition.js +5 -2
- package/build/browser/wirePropertyV2ToSdkPropertyDefinition.js.map +1 -1
- package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.js +4 -2
- package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.js.map +1 -1
- package/build/cjs/index.cjs +241 -4
- package/build/cjs/index.cjs.map +1 -1
- package/build/esm/valueFormatting/commonValueFormattingUtils.js +33 -0
- package/build/esm/valueFormatting/commonValueFormattingUtils.js.map +1 -0
- package/build/esm/valueFormatting/convertBooleanValueFormattingRule.js +24 -0
- package/build/esm/valueFormatting/convertBooleanValueFormattingRule.js.map +1 -0
- package/build/esm/valueFormatting/convertDateAndTimestampValueFormattingRule.js +62 -0
- package/build/esm/valueFormatting/convertDateAndTimestampValueFormattingRule.js.map +1 -0
- package/build/esm/valueFormatting/convertKnownTypeValueFormattingRule.js +39 -0
- package/build/esm/valueFormatting/convertKnownTypeValueFormattingRule.js.map +1 -0
- package/build/esm/valueFormatting/convertNumberValueFormattingRule.js +133 -0
- package/build/esm/valueFormatting/convertNumberValueFormattingRule.js.map +1 -0
- package/build/esm/wirePropertyFormattingToSdkFormatting.js +49 -0
- package/build/esm/wirePropertyFormattingToSdkFormatting.js.map +1 -0
- package/build/esm/wirePropertyFormattingToSdkFormatting.test.js +344 -0
- package/build/esm/wirePropertyFormattingToSdkFormatting.test.js.map +1 -0
- package/build/esm/wirePropertyV2ToSdkPropertyDefinition.js +5 -2
- package/build/esm/wirePropertyV2ToSdkPropertyDefinition.js.map +1 -1
- package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.js +4 -2
- package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.js.map +1 -1
- package/build/types/valueFormatting/commonValueFormattingUtils.d.ts +3 -0
- package/build/types/valueFormatting/commonValueFormattingUtils.d.ts.map +1 -0
- package/build/types/valueFormatting/convertBooleanValueFormattingRule.d.ts +3 -0
- package/build/types/valueFormatting/convertBooleanValueFormattingRule.d.ts.map +1 -0
- package/build/types/valueFormatting/convertDateAndTimestampValueFormattingRule.d.ts +4 -0
- package/build/types/valueFormatting/convertDateAndTimestampValueFormattingRule.d.ts.map +1 -0
- package/build/types/valueFormatting/convertKnownTypeValueFormattingRule.d.ts +3 -0
- package/build/types/valueFormatting/convertKnownTypeValueFormattingRule.d.ts.map +1 -0
- package/build/types/valueFormatting/convertNumberValueFormattingRule.d.ts +3 -0
- package/build/types/valueFormatting/convertNumberValueFormattingRule.d.ts.map +1 -0
- package/build/types/wirePropertyFormattingToSdkFormatting.d.ts +8 -0
- package/build/types/wirePropertyFormattingToSdkFormatting.d.ts.map +1 -0
- package/build/types/wirePropertyFormattingToSdkFormatting.test.d.ts +1 -0
- package/build/types/wirePropertyFormattingToSdkFormatting.test.d.ts.map +1 -0
- package/build/types/wirePropertyV2ToSdkPropertyDefinition.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,90 @@
|
|
|
1
1
|
# @osdk/generator-converters
|
|
2
2
|
|
|
3
|
+
## 2.6.0-beta.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @osdk/api@2.6.0-beta.11
|
|
8
|
+
|
|
9
|
+
## 2.6.0-beta.10
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 3fbb596: Pipe through transactionId to endpoints that load data via object sets
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- @osdk/api@2.6.0-beta.10
|
|
18
|
+
|
|
19
|
+
## 2.6.0-beta.9
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [b307201]
|
|
24
|
+
- @osdk/api@2.6.0-beta.9
|
|
25
|
+
|
|
26
|
+
## 2.6.0-beta.8
|
|
27
|
+
|
|
28
|
+
### Minor Changes
|
|
29
|
+
|
|
30
|
+
- a1ffb20: Use new ephemeral media upload endpoint.
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- Updated dependencies [a1ffb20]
|
|
35
|
+
- Updated dependencies [e62c692]
|
|
36
|
+
- @osdk/api@2.6.0-beta.8
|
|
37
|
+
|
|
38
|
+
## 2.6.0-beta.7
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- @osdk/api@2.6.0-beta.7
|
|
43
|
+
|
|
44
|
+
## 2.6.0-beta.6
|
|
45
|
+
|
|
46
|
+
### Minor Changes
|
|
47
|
+
|
|
48
|
+
- b959085: Fix nested array query param type handling
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- Updated dependencies [b959085]
|
|
53
|
+
- @osdk/api@2.6.0-beta.6
|
|
54
|
+
|
|
55
|
+
## 2.6.0-beta.5
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- Updated dependencies [2556c64]
|
|
60
|
+
- @osdk/api@2.6.0-beta.5
|
|
61
|
+
|
|
62
|
+
## 2.6.0-beta.4
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- Updated dependencies [e7bf02a]
|
|
67
|
+
- @osdk/api@2.6.0-beta.4
|
|
68
|
+
|
|
69
|
+
## 2.6.0-beta.3
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- @osdk/api@2.6.0-beta.3
|
|
74
|
+
|
|
75
|
+
## 2.6.0-beta.2
|
|
76
|
+
|
|
77
|
+
### Minor Changes
|
|
78
|
+
|
|
79
|
+
- 84e61fc: Add propertyValueFormatting type to property metadata
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- Updated dependencies [84e61fc]
|
|
84
|
+
- Updated dependencies [c4f8529]
|
|
85
|
+
- Updated dependencies [f7ae38a]
|
|
86
|
+
- @osdk/api@2.6.0-beta.2
|
|
87
|
+
|
|
3
88
|
## 2.5.0-beta.15
|
|
4
89
|
|
|
5
90
|
### Patch Changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export function convertPropertyTypeReferenceOrStringConstant(value) {
|
|
18
|
+
switch (value.type) {
|
|
19
|
+
case "constant":
|
|
20
|
+
return {
|
|
21
|
+
type: "constant",
|
|
22
|
+
value: value.value
|
|
23
|
+
};
|
|
24
|
+
case "propertyType":
|
|
25
|
+
return {
|
|
26
|
+
type: "propertyType",
|
|
27
|
+
propertyApiName: value.propertyApiName
|
|
28
|
+
};
|
|
29
|
+
default:
|
|
30
|
+
throw new Error(`Unknown property reference type: ${value.type}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=commonValueFormattingUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonValueFormattingUtils.js","names":["convertPropertyTypeReferenceOrStringConstant","value","type","propertyApiName","Error"],"sources":["commonValueFormattingUtils.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { PropertyTypeReferenceOrStringConstant } from \"@osdk/api\";\nimport type * as Ontologies from \"@osdk/foundry.ontologies\";\n\nexport function convertPropertyTypeReferenceOrStringConstant(\n value: Ontologies.PropertyTypeReferenceOrStringConstant,\n): PropertyTypeReferenceOrStringConstant {\n switch (value.type) {\n case \"constant\":\n return {\n type: \"constant\",\n value: value.value,\n };\n case \"propertyType\":\n return {\n type: \"propertyType\",\n propertyApiName: value.propertyApiName,\n };\n default:\n value satisfies never;\n throw new Error(\n `Unknown property reference type: ${(value as any).type}`,\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,OAAO,SAASA,4CAA4CA,CAC1DC,KAAuD,EAChB;EACvC,QAAQA,KAAK,CAACC,IAAI;IAChB,KAAK,UAAU;MACb,OAAO;QACLA,IAAI,EAAE,UAAU;QAChBD,KAAK,EAAEA,KAAK,CAACA;MACf,CAAC;IACH,KAAK,cAAc;MACjB,OAAO;QACLC,IAAI,EAAE,cAAc;QACpBC,eAAe,EAAEF,KAAK,CAACE;MACzB,CAAC;IACH;MAEE,MAAM,IAAIC,KAAK,CACb,oCAAqCH,KAAK,CAASC,IAAI,EACzD,CAAC;EACL;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export function convertBooleanFormattingRule(wireFormatting) {
|
|
18
|
+
return {
|
|
19
|
+
type: "boolean",
|
|
20
|
+
valueIfTrue: wireFormatting.valueIfTrue,
|
|
21
|
+
valueIfFalse: wireFormatting.valueIfFalse
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=convertBooleanValueFormattingRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertBooleanValueFormattingRule.js","names":["convertBooleanFormattingRule","wireFormatting","type","valueIfTrue","valueIfFalse"],"sources":["convertBooleanValueFormattingRule.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { PropertyBooleanFormattingRule } from \"@osdk/api\";\nimport type * as Ontologies from \"@osdk/foundry.ontologies\";\n\nexport function convertBooleanFormattingRule(\n wireFormatting: Ontologies.PropertyBooleanFormattingRule,\n): PropertyBooleanFormattingRule {\n return {\n type: \"boolean\",\n valueIfTrue: wireFormatting.valueIfTrue,\n valueIfFalse: wireFormatting.valueIfFalse,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,OAAO,SAASA,4BAA4BA,CAC1CC,cAAwD,EACzB;EAC/B,OAAO;IACLC,IAAI,EAAE,SAAS;IACfC,WAAW,EAAEF,cAAc,CAACE,WAAW;IACvCC,YAAY,EAAEH,cAAc,CAACG;EAC/B,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { convertPropertyTypeReferenceOrStringConstant } from "./commonValueFormattingUtils.js";
|
|
18
|
+
export function convertDateFormattingRule(wireFormatting) {
|
|
19
|
+
return {
|
|
20
|
+
type: "date",
|
|
21
|
+
format: convertDatetimeFormat(wireFormatting.format)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export function convertTimestampFormattingRule(wireFormatting) {
|
|
25
|
+
return {
|
|
26
|
+
type: "timestamp",
|
|
27
|
+
format: convertDatetimeFormat(wireFormatting.format),
|
|
28
|
+
displayTimezone: convertDatetimeTimezone(wireFormatting.displayTimezone)
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function convertDatetimeFormat(wireFormat) {
|
|
32
|
+
switch (wireFormat.type) {
|
|
33
|
+
case "stringFormat":
|
|
34
|
+
return {
|
|
35
|
+
type: "stringFormat",
|
|
36
|
+
pattern: wireFormat.pattern
|
|
37
|
+
};
|
|
38
|
+
case "localizedFormat":
|
|
39
|
+
return {
|
|
40
|
+
type: "localizedFormat",
|
|
41
|
+
format: wireFormat.format
|
|
42
|
+
};
|
|
43
|
+
default:
|
|
44
|
+
throw new Error(`Unknown datetime format type: ${wireFormat.type}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function convertDatetimeTimezone(wireTimezone) {
|
|
48
|
+
switch (wireTimezone.type) {
|
|
49
|
+
case "static":
|
|
50
|
+
return {
|
|
51
|
+
type: "static",
|
|
52
|
+
zoneId: convertPropertyTypeReferenceOrStringConstant(wireTimezone.zoneId)
|
|
53
|
+
};
|
|
54
|
+
case "user":
|
|
55
|
+
return {
|
|
56
|
+
type: "user"
|
|
57
|
+
};
|
|
58
|
+
default:
|
|
59
|
+
throw new Error(`Unknown timezone type: ${wireTimezone.type}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=convertDateAndTimestampValueFormattingRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertDateAndTimestampValueFormattingRule.js","names":["convertPropertyTypeReferenceOrStringConstant","convertDateFormattingRule","wireFormatting","type","format","convertDatetimeFormat","convertTimestampFormattingRule","displayTimezone","convertDatetimeTimezone","wireFormat","pattern","Error","wireTimezone","zoneId"],"sources":["convertDateAndTimestampValueFormattingRule.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n DatetimeFormat,\n DatetimeTimezone,\n PropertyDateFormattingRule,\n PropertyTimestampFormattingRule,\n} from \"@osdk/api\";\nimport type * as Ontologies from \"@osdk/foundry.ontologies\";\nimport { convertPropertyTypeReferenceOrStringConstant } from \"./commonValueFormattingUtils.js\";\n\nexport function convertDateFormattingRule(\n wireFormatting: Ontologies.PropertyDateFormattingRule,\n): PropertyDateFormattingRule {\n return {\n type: \"date\",\n format: convertDatetimeFormat(wireFormatting.format),\n };\n}\n\nexport function convertTimestampFormattingRule(\n wireFormatting: Ontologies.PropertyTimestampFormattingRule,\n): PropertyTimestampFormattingRule {\n return {\n type: \"timestamp\",\n format: convertDatetimeFormat(wireFormatting.format),\n displayTimezone: convertDatetimeTimezone(\n wireFormatting.displayTimezone,\n ),\n };\n}\n\nfunction convertDatetimeFormat(\n wireFormat: Ontologies.DatetimeFormat,\n): DatetimeFormat {\n switch (wireFormat.type) {\n case \"stringFormat\":\n return {\n type: \"stringFormat\",\n pattern: wireFormat.pattern,\n };\n case \"localizedFormat\":\n return {\n type: \"localizedFormat\",\n format: wireFormat.format,\n };\n default:\n wireFormat satisfies never;\n throw new Error(\n `Unknown datetime format type: ${(wireFormat as any).type}`,\n );\n }\n}\n\nfunction convertDatetimeTimezone(\n wireTimezone: Ontologies.DatetimeTimezone,\n): DatetimeTimezone {\n switch (wireTimezone.type) {\n case \"static\":\n return {\n type: \"static\",\n zoneId: convertPropertyTypeReferenceOrStringConstant(\n wireTimezone.zoneId,\n ),\n };\n case \"user\":\n return { type: \"user\" };\n default:\n wireTimezone satisfies never;\n throw new Error(`Unknown timezone type: ${(wireTimezone as any).type}`);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,4CAA4C,QAAQ,iCAAiC;AAE9F,OAAO,SAASC,yBAAyBA,CACvCC,cAAqD,EACzB;EAC5B,OAAO;IACLC,IAAI,EAAE,MAAM;IACZC,MAAM,EAAEC,qBAAqB,CAACH,cAAc,CAACE,MAAM;EACrD,CAAC;AACH;AAEA,OAAO,SAASE,8BAA8BA,CAC5CJ,cAA0D,EACzB;EACjC,OAAO;IACLC,IAAI,EAAE,WAAW;IACjBC,MAAM,EAAEC,qBAAqB,CAACH,cAAc,CAACE,MAAM,CAAC;IACpDG,eAAe,EAAEC,uBAAuB,CACtCN,cAAc,CAACK,eACjB;EACF,CAAC;AACH;AAEA,SAASF,qBAAqBA,CAC5BI,UAAqC,EACrB;EAChB,QAAQA,UAAU,CAACN,IAAI;IACrB,KAAK,cAAc;MACjB,OAAO;QACLA,IAAI,EAAE,cAAc;QACpBO,OAAO,EAAED,UAAU,CAACC;MACtB,CAAC;IACH,KAAK,iBAAiB;MACpB,OAAO;QACLP,IAAI,EAAE,iBAAiB;QACvBC,MAAM,EAAEK,UAAU,CAACL;MACrB,CAAC;IACH;MAEE,MAAM,IAAIO,KAAK,CACb,iCAAkCF,UAAU,CAASN,IAAI,EAC3D,CAAC;EACL;AACF;AAEA,SAASK,uBAAuBA,CAC9BI,YAAyC,EACvB;EAClB,QAAQA,YAAY,CAACT,IAAI;IACvB,KAAK,QAAQ;MACX,OAAO;QACLA,IAAI,EAAE,QAAQ;QACdU,MAAM,EAAEb,4CAA4C,CAClDY,YAAY,CAACC,MACf;MACF,CAAC;IACH,KAAK,MAAM;MACT,OAAO;QAAEV,IAAI,EAAE;MAAO,CAAC;IACzB;MAEE,MAAM,IAAIQ,KAAK,CAAC,0BAA2BC,YAAY,CAAST,IAAI,EAAE,CAAC;EAC3E;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export function convertKnownTypeFormattingRule(wireFormatting) {
|
|
18
|
+
switch (wireFormatting.knownType) {
|
|
19
|
+
case "ARTIFACT_GID":
|
|
20
|
+
return {
|
|
21
|
+
type: "knownType",
|
|
22
|
+
knownType: "ARTIFACT_GID"
|
|
23
|
+
};
|
|
24
|
+
case "RESOURCE_RID":
|
|
25
|
+
return {
|
|
26
|
+
type: "knownType",
|
|
27
|
+
knownType: "RESOURCE_RID"
|
|
28
|
+
};
|
|
29
|
+
case "USER_OR_GROUP_ID":
|
|
30
|
+
return {
|
|
31
|
+
type: "knownType",
|
|
32
|
+
knownType: "USER_OR_GROUP_ID"
|
|
33
|
+
};
|
|
34
|
+
default:
|
|
35
|
+
wireFormatting.knownType;
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=convertKnownTypeValueFormattingRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertKnownTypeValueFormattingRule.js","names":["convertKnownTypeFormattingRule","wireFormatting","knownType","type","undefined"],"sources":["convertKnownTypeValueFormattingRule.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { PropertyKnownTypeFormattingRule } from \"@osdk/api\";\nimport type * as Ontologies from \"@osdk/foundry.ontologies\";\n\nexport function convertKnownTypeFormattingRule(\n wireFormatting: Ontologies.PropertyKnownTypeFormattingRule,\n): PropertyKnownTypeFormattingRule | undefined {\n switch (wireFormatting.knownType) {\n case \"ARTIFACT_GID\":\n return {\n type: \"knownType\",\n knownType: \"ARTIFACT_GID\",\n };\n case \"RESOURCE_RID\":\n return {\n type: \"knownType\",\n knownType: \"RESOURCE_RID\",\n };\n case \"USER_OR_GROUP_ID\":\n return {\n type: \"knownType\",\n knownType: \"USER_OR_GROUP_ID\",\n };\n default:\n wireFormatting.knownType satisfies never;\n return undefined;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,OAAO,SAASA,8BAA8BA,CAC5CC,cAA0D,EACb;EAC7C,QAAQA,cAAc,CAACC,SAAS;IAC9B,KAAK,cAAc;MACjB,OAAO;QACLC,IAAI,EAAE,WAAW;QACjBD,SAAS,EAAE;MACb,CAAC;IACH,KAAK,cAAc;MACjB,OAAO;QACLC,IAAI,EAAE,WAAW;QACjBD,SAAS,EAAE;MACb,CAAC;IACH,KAAK,kBAAkB;MACrB,OAAO;QACLC,IAAI,EAAE,WAAW;QACjBD,SAAS,EAAE;MACb,CAAC;IACH;MACED,cAAc,CAACC,SAAS;MACxB,OAAOE,SAAS;EACpB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { convertPropertyTypeReferenceOrStringConstant } from "./commonValueFormattingUtils.js";
|
|
18
|
+
export function convertNumberFormattingRule(wireFormatting) {
|
|
19
|
+
const numberType = convertNumberFormattingType(wireFormatting.numberType);
|
|
20
|
+
if (!numberType) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
type: "number",
|
|
25
|
+
numberType
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function convertNumberFormatOptions(wireOptions) {
|
|
29
|
+
return {
|
|
30
|
+
useGrouping: wireOptions.useGrouping,
|
|
31
|
+
convertNegativeToParenthesis: wireOptions.convertNegativeToParenthesis,
|
|
32
|
+
minimumIntegerDigits: wireOptions.minimumIntegerDigits,
|
|
33
|
+
minimumFractionDigits: wireOptions.minimumFractionDigits,
|
|
34
|
+
maximumFractionDigits: wireOptions.maximumFractionDigits,
|
|
35
|
+
minimumSignificantDigits: wireOptions.minimumSignificantDigits,
|
|
36
|
+
maximumSignificantDigits: wireOptions.maximumSignificantDigits,
|
|
37
|
+
notation: wireOptions.notation,
|
|
38
|
+
roundingMode: wireOptions.roundingMode
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function convertDurationFormatStyle(formatStyle) {
|
|
42
|
+
switch (formatStyle.type) {
|
|
43
|
+
case "humanReadable":
|
|
44
|
+
return {
|
|
45
|
+
type: "humanReadable",
|
|
46
|
+
showFullUnits: formatStyle.showFullUnits
|
|
47
|
+
};
|
|
48
|
+
case "timecode":
|
|
49
|
+
return {
|
|
50
|
+
type: "timecode"
|
|
51
|
+
};
|
|
52
|
+
default:
|
|
53
|
+
throw new Error(`Unknown duration format style: ${formatStyle.type}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function convertNumberFormattingType(wireNumberType) {
|
|
57
|
+
switch (wireNumberType.type) {
|
|
58
|
+
case "standard":
|
|
59
|
+
return {
|
|
60
|
+
type: "standard",
|
|
61
|
+
baseFormatOptions: convertNumberFormatOptions(wireNumberType.baseFormatOptions)
|
|
62
|
+
};
|
|
63
|
+
case "fixedValues":
|
|
64
|
+
return {
|
|
65
|
+
type: "fixedValues",
|
|
66
|
+
values: wireNumberType.values
|
|
67
|
+
};
|
|
68
|
+
case "currency":
|
|
69
|
+
{
|
|
70
|
+
return {
|
|
71
|
+
type: "currency",
|
|
72
|
+
baseFormatOptions: convertNumberFormatOptions(wireNumberType.baseFormatOptions),
|
|
73
|
+
style: wireNumberType.style,
|
|
74
|
+
currencyCode: convertPropertyTypeReferenceOrStringConstant(wireNumberType.currencyCode)
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
case "standardUnit":
|
|
78
|
+
{
|
|
79
|
+
return {
|
|
80
|
+
type: "standardUnit",
|
|
81
|
+
baseFormatOptions: convertNumberFormatOptions(wireNumberType.baseFormatOptions),
|
|
82
|
+
unit: convertPropertyTypeReferenceOrStringConstant(wireNumberType.unit)
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
case "customUnit":
|
|
86
|
+
{
|
|
87
|
+
return {
|
|
88
|
+
type: "customUnit",
|
|
89
|
+
baseFormatOptions: convertNumberFormatOptions(wireNumberType.baseFormatOptions),
|
|
90
|
+
unit: convertPropertyTypeReferenceOrStringConstant(wireNumberType.unit)
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
case "affix":
|
|
94
|
+
{
|
|
95
|
+
return {
|
|
96
|
+
type: "affix",
|
|
97
|
+
baseFormatOptions: convertNumberFormatOptions(wireNumberType.baseFormatOptions),
|
|
98
|
+
affix: {
|
|
99
|
+
prefix: wireNumberType.affix?.prefix != null ? convertPropertyTypeReferenceOrStringConstant(wireNumberType.affix.prefix) : undefined,
|
|
100
|
+
postfix: wireNumberType.affix?.postfix != null ? convertPropertyTypeReferenceOrStringConstant(wireNumberType.affix.postfix) : undefined
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
case "duration":
|
|
105
|
+
{
|
|
106
|
+
return {
|
|
107
|
+
type: "duration",
|
|
108
|
+
formatStyle: convertDurationFormatStyle(wireNumberType.formatStyle),
|
|
109
|
+
precision: wireNumberType.precision,
|
|
110
|
+
baseValue: wireNumberType.baseValue
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
case "scale":
|
|
114
|
+
{
|
|
115
|
+
return {
|
|
116
|
+
type: "scale",
|
|
117
|
+
scaleType: wireNumberType.scaleType,
|
|
118
|
+
baseFormatOptions: convertNumberFormatOptions(wireNumberType.baseFormatOptions)
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
case "ratio":
|
|
122
|
+
{
|
|
123
|
+
return {
|
|
124
|
+
type: "ratio",
|
|
125
|
+
ratioType: wireNumberType.ratioType,
|
|
126
|
+
baseFormatOptions: convertNumberFormatOptions(wireNumberType.baseFormatOptions)
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
default:
|
|
130
|
+
throw new Error(`Unknown number format type: ${wireNumberType.type}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=convertNumberValueFormattingRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertNumberValueFormattingRule.js","names":["convertPropertyTypeReferenceOrStringConstant","convertNumberFormattingRule","wireFormatting","numberType","convertNumberFormattingType","undefined","type","convertNumberFormatOptions","wireOptions","useGrouping","convertNegativeToParenthesis","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","notation","roundingMode","convertDurationFormatStyle","formatStyle","showFullUnits","Error","wireNumberType","baseFormatOptions","values","style","currencyCode","unit","affix","prefix","postfix","precision","baseValue","scaleType","ratioType"],"sources":["convertNumberValueFormattingRule.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n DurationFormatStyle,\n NumberFormatOptions,\n PropertyNumberFormattingRule,\n PropertyNumberFormattingRuleType,\n} from \"@osdk/api\";\nimport type * as Ontologies from \"@osdk/foundry.ontologies\";\nimport { convertPropertyTypeReferenceOrStringConstant } from \"./commonValueFormattingUtils.js\";\n\nexport function convertNumberFormattingRule(\n wireFormatting: Ontologies.PropertyNumberFormattingRule,\n): PropertyNumberFormattingRule | undefined {\n const numberType = convertNumberFormattingType(wireFormatting.numberType);\n if (!numberType) {\n return undefined;\n }\n return {\n type: \"number\",\n numberType,\n };\n}\n\nfunction convertNumberFormatOptions(\n wireOptions: Ontologies.NumberFormatOptions,\n): NumberFormatOptions {\n return {\n useGrouping: wireOptions.useGrouping,\n convertNegativeToParenthesis: wireOptions.convertNegativeToParenthesis,\n minimumIntegerDigits: wireOptions.minimumIntegerDigits,\n minimumFractionDigits: wireOptions.minimumFractionDigits,\n maximumFractionDigits: wireOptions.maximumFractionDigits,\n minimumSignificantDigits: wireOptions.minimumSignificantDigits,\n maximumSignificantDigits: wireOptions.maximumSignificantDigits,\n notation: wireOptions.notation,\n roundingMode: wireOptions.roundingMode,\n };\n}\n\nfunction convertDurationFormatStyle(\n formatStyle: Ontologies.DurationFormatStyle,\n): DurationFormatStyle {\n switch (formatStyle.type) {\n case \"humanReadable\":\n return {\n type: \"humanReadable\",\n showFullUnits: formatStyle.showFullUnits,\n };\n case \"timecode\":\n return {\n type: \"timecode\",\n };\n default:\n formatStyle satisfies never;\n throw new Error(\n `Unknown duration format style: ${(formatStyle as any).type}`,\n );\n }\n}\n\nfunction convertNumberFormattingType(\n wireNumberType: Ontologies.PropertyNumberFormattingRuleType,\n): PropertyNumberFormattingRuleType | undefined {\n switch (wireNumberType.type) {\n case \"standard\":\n return {\n type: \"standard\",\n baseFormatOptions: convertNumberFormatOptions(\n wireNumberType.baseFormatOptions,\n ),\n };\n\n case \"fixedValues\":\n return {\n type: \"fixedValues\",\n values: wireNumberType.values,\n };\n\n case \"currency\": {\n return {\n type: \"currency\",\n baseFormatOptions: convertNumberFormatOptions(\n wireNumberType.baseFormatOptions,\n ),\n style: wireNumberType.style,\n currencyCode: convertPropertyTypeReferenceOrStringConstant(\n wireNumberType.currencyCode,\n ),\n };\n }\n\n case \"standardUnit\": {\n return {\n type: \"standardUnit\",\n baseFormatOptions: convertNumberFormatOptions(\n wireNumberType.baseFormatOptions,\n ),\n unit: convertPropertyTypeReferenceOrStringConstant(wireNumberType.unit),\n };\n }\n\n case \"customUnit\": {\n return {\n type: \"customUnit\",\n baseFormatOptions: convertNumberFormatOptions(\n wireNumberType.baseFormatOptions,\n ),\n unit: convertPropertyTypeReferenceOrStringConstant(wireNumberType.unit),\n };\n }\n\n case \"affix\": {\n return {\n type: \"affix\",\n baseFormatOptions: convertNumberFormatOptions(\n wireNumberType.baseFormatOptions,\n ),\n affix: {\n prefix: wireNumberType.affix?.prefix != null\n ? convertPropertyTypeReferenceOrStringConstant(\n wireNumberType.affix.prefix,\n )\n : undefined,\n postfix: wireNumberType.affix?.postfix != null\n ? convertPropertyTypeReferenceOrStringConstant(\n wireNumberType.affix.postfix,\n )\n : undefined,\n },\n };\n }\n\n case \"duration\": {\n return {\n type: \"duration\",\n formatStyle: convertDurationFormatStyle(wireNumberType.formatStyle),\n precision: wireNumberType.precision,\n baseValue: wireNumberType.baseValue,\n };\n }\n\n case \"scale\": {\n return {\n type: \"scale\",\n scaleType: wireNumberType.scaleType,\n baseFormatOptions: convertNumberFormatOptions(\n wireNumberType.baseFormatOptions,\n ),\n };\n }\n\n case \"ratio\": {\n return {\n type: \"ratio\",\n ratioType: wireNumberType.ratioType,\n baseFormatOptions: convertNumberFormatOptions(\n wireNumberType.baseFormatOptions,\n ),\n };\n }\n\n default:\n wireNumberType satisfies never;\n throw new Error(\n `Unknown number format type: ${(wireNumberType as any).type}`,\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,4CAA4C,QAAQ,iCAAiC;AAE9F,OAAO,SAASC,2BAA2BA,CACzCC,cAAuD,EACb;EAC1C,MAAMC,UAAU,GAAGC,2BAA2B,CAACF,cAAc,CAACC,UAAU,CAAC;EACzE,IAAI,CAACA,UAAU,EAAE;IACf,OAAOE,SAAS;EAClB;EACA,OAAO;IACLC,IAAI,EAAE,QAAQ;IACdH;EACF,CAAC;AACH;AAEA,SAASI,0BAA0BA,CACjCC,WAA2C,EACtB;EACrB,OAAO;IACLC,WAAW,EAAED,WAAW,CAACC,WAAW;IACpCC,4BAA4B,EAAEF,WAAW,CAACE,4BAA4B;IACtEC,oBAAoB,EAAEH,WAAW,CAACG,oBAAoB;IACtDC,qBAAqB,EAAEJ,WAAW,CAACI,qBAAqB;IACxDC,qBAAqB,EAAEL,WAAW,CAACK,qBAAqB;IACxDC,wBAAwB,EAAEN,WAAW,CAACM,wBAAwB;IAC9DC,wBAAwB,EAAEP,WAAW,CAACO,wBAAwB;IAC9DC,QAAQ,EAAER,WAAW,CAACQ,QAAQ;IAC9BC,YAAY,EAAET,WAAW,CAACS;EAC5B,CAAC;AACH;AAEA,SAASC,0BAA0BA,CACjCC,WAA2C,EACtB;EACrB,QAAQA,WAAW,CAACb,IAAI;IACtB,KAAK,eAAe;MAClB,OAAO;QACLA,IAAI,EAAE,eAAe;QACrBc,aAAa,EAAED,WAAW,CAACC;MAC7B,CAAC;IACH,KAAK,UAAU;MACb,OAAO;QACLd,IAAI,EAAE;MACR,CAAC;IACH;MAEE,MAAM,IAAIe,KAAK,CACb,kCAAmCF,WAAW,CAASb,IAAI,EAC7D,CAAC;EACL;AACF;AAEA,SAASF,2BAA2BA,CAClCkB,cAA2D,EACb;EAC9C,QAAQA,cAAc,CAAChB,IAAI;IACzB,KAAK,UAAU;MACb,OAAO;QACLA,IAAI,EAAE,UAAU;QAChBiB,iBAAiB,EAAEhB,0BAA0B,CAC3Ce,cAAc,CAACC,iBACjB;MACF,CAAC;IAEH,KAAK,aAAa;MAChB,OAAO;QACLjB,IAAI,EAAE,aAAa;QACnBkB,MAAM,EAAEF,cAAc,CAACE;MACzB,CAAC;IAEH,KAAK,UAAU;MAAE;QACf,OAAO;UACLlB,IAAI,EAAE,UAAU;UAChBiB,iBAAiB,EAAEhB,0BAA0B,CAC3Ce,cAAc,CAACC,iBACjB,CAAC;UACDE,KAAK,EAAEH,cAAc,CAACG,KAAK;UAC3BC,YAAY,EAAE1B,4CAA4C,CACxDsB,cAAc,CAACI,YACjB;QACF,CAAC;MACH;IAEA,KAAK,cAAc;MAAE;QACnB,OAAO;UACLpB,IAAI,EAAE,cAAc;UACpBiB,iBAAiB,EAAEhB,0BAA0B,CAC3Ce,cAAc,CAACC,iBACjB,CAAC;UACDI,IAAI,EAAE3B,4CAA4C,CAACsB,cAAc,CAACK,IAAI;QACxE,CAAC;MACH;IAEA,KAAK,YAAY;MAAE;QACjB,OAAO;UACLrB,IAAI,EAAE,YAAY;UAClBiB,iBAAiB,EAAEhB,0BAA0B,CAC3Ce,cAAc,CAACC,iBACjB,CAAC;UACDI,IAAI,EAAE3B,4CAA4C,CAACsB,cAAc,CAACK,IAAI;QACxE,CAAC;MACH;IAEA,KAAK,OAAO;MAAE;QACZ,OAAO;UACLrB,IAAI,EAAE,OAAO;UACbiB,iBAAiB,EAAEhB,0BAA0B,CAC3Ce,cAAc,CAACC,iBACjB,CAAC;UACDK,KAAK,EAAE;YACLC,MAAM,EAAEP,cAAc,CAACM,KAAK,EAAEC,MAAM,IAAI,IAAI,GACxC7B,4CAA4C,CAC5CsB,cAAc,CAACM,KAAK,CAACC,MACvB,CAAC,GACCxB,SAAS;YACbyB,OAAO,EAAER,cAAc,CAACM,KAAK,EAAEE,OAAO,IAAI,IAAI,GAC1C9B,4CAA4C,CAC5CsB,cAAc,CAACM,KAAK,CAACE,OACvB,CAAC,GACCzB;UACN;QACF,CAAC;MACH;IAEA,KAAK,UAAU;MAAE;QACf,OAAO;UACLC,IAAI,EAAE,UAAU;UAChBa,WAAW,EAAED,0BAA0B,CAACI,cAAc,CAACH,WAAW,CAAC;UACnEY,SAAS,EAAET,cAAc,CAACS,SAAS;UACnCC,SAAS,EAAEV,cAAc,CAACU;QAC5B,CAAC;MACH;IAEA,KAAK,OAAO;MAAE;QACZ,OAAO;UACL1B,IAAI,EAAE,OAAO;UACb2B,SAAS,EAAEX,cAAc,CAACW,SAAS;UACnCV,iBAAiB,EAAEhB,0BAA0B,CAC3Ce,cAAc,CAACC,iBACjB;QACF,CAAC;MACH;IAEA,KAAK,OAAO;MAAE;QACZ,OAAO;UACLjB,IAAI,EAAE,OAAO;UACb4B,SAAS,EAAEZ,cAAc,CAACY,SAAS;UACnCX,iBAAiB,EAAEhB,0BAA0B,CAC3Ce,cAAc,CAACC,iBACjB;QACF,CAAC;MACH;IAEA;MAEE,MAAM,IAAIF,KAAK,CACb,+BAAgCC,cAAc,CAAShB,IAAI,EAC7D,CAAC;EACL;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { convertBooleanFormattingRule } from "./valueFormatting/convertBooleanValueFormattingRule.js";
|
|
18
|
+
import { convertDateFormattingRule, convertTimestampFormattingRule } from "./valueFormatting/convertDateAndTimestampValueFormattingRule.js";
|
|
19
|
+
import { convertKnownTypeFormattingRule } from "./valueFormatting/convertKnownTypeValueFormattingRule.js";
|
|
20
|
+
import { convertNumberFormattingRule } from "./valueFormatting/convertNumberValueFormattingRule.js";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Converts a PropertyValueFormattingRule from the ontologies format to the SDK format
|
|
24
|
+
*/
|
|
25
|
+
export function wirePropertyFormattingToSdkFormatting(wireFormatting, log) {
|
|
26
|
+
try {
|
|
27
|
+
return convertPropertyFormattingInternal(wireFormatting);
|
|
28
|
+
} catch (error) {
|
|
29
|
+
log?.info(`Failed to convert property formatting rule: ${error}`);
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function convertPropertyFormattingInternal(wireFormatting) {
|
|
34
|
+
switch (wireFormatting.type) {
|
|
35
|
+
case "date":
|
|
36
|
+
return convertDateFormattingRule(wireFormatting);
|
|
37
|
+
case "timestamp":
|
|
38
|
+
return convertTimestampFormattingRule(wireFormatting);
|
|
39
|
+
case "boolean":
|
|
40
|
+
return convertBooleanFormattingRule(wireFormatting);
|
|
41
|
+
case "knownType":
|
|
42
|
+
return convertKnownTypeFormattingRule(wireFormatting);
|
|
43
|
+
case "number":
|
|
44
|
+
return convertNumberFormattingRule(wireFormatting);
|
|
45
|
+
default:
|
|
46
|
+
throw new Error(`Unknown formatting type: ${wireFormatting.type}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=wirePropertyFormattingToSdkFormatting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wirePropertyFormattingToSdkFormatting.js","names":["convertBooleanFormattingRule","convertDateFormattingRule","convertTimestampFormattingRule","convertKnownTypeFormattingRule","convertNumberFormattingRule","wirePropertyFormattingToSdkFormatting","wireFormatting","log","convertPropertyFormattingInternal","error","info","undefined","type","Error"],"sources":["wirePropertyFormattingToSdkFormatting.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { PropertyValueFormattingRule } from \"@osdk/api\";\nimport type * as Ontologies from \"@osdk/foundry.ontologies\";\nimport { convertBooleanFormattingRule } from \"./valueFormatting/convertBooleanValueFormattingRule.js\";\nimport {\n convertDateFormattingRule,\n convertTimestampFormattingRule,\n} from \"./valueFormatting/convertDateAndTimestampValueFormattingRule.js\";\nimport { convertKnownTypeFormattingRule } from \"./valueFormatting/convertKnownTypeValueFormattingRule.js\";\nimport { convertNumberFormattingRule } from \"./valueFormatting/convertNumberValueFormattingRule.js\";\n\n/**\n * Converts a PropertyValueFormattingRule from the ontologies format to the SDK format\n */\nexport function wirePropertyFormattingToSdkFormatting(\n wireFormatting: Ontologies.PropertyValueFormattingRule,\n log?: { info: (msg: string) => void },\n): PropertyValueFormattingRule | undefined {\n try {\n return convertPropertyFormattingInternal(wireFormatting);\n } catch (error) {\n log?.info(`Failed to convert property formatting rule: ${error}`);\n return undefined;\n }\n}\n\nfunction convertPropertyFormattingInternal(\n wireFormatting: Ontologies.PropertyValueFormattingRule,\n): PropertyValueFormattingRule | undefined {\n switch (wireFormatting.type) {\n case \"date\":\n return convertDateFormattingRule(wireFormatting);\n\n case \"timestamp\":\n return convertTimestampFormattingRule(wireFormatting);\n\n case \"boolean\":\n return convertBooleanFormattingRule(wireFormatting);\n\n case \"knownType\":\n return convertKnownTypeFormattingRule(wireFormatting);\n\n case \"number\":\n return convertNumberFormattingRule(wireFormatting);\n\n default:\n wireFormatting satisfies never;\n throw new Error(\n `Unknown formatting type: ${(wireFormatting as any).type}`,\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,4BAA4B,QAAQ,wDAAwD;AACrG,SACEC,yBAAyB,EACzBC,8BAA8B,QACzB,iEAAiE;AACxE,SAASC,8BAA8B,QAAQ,0DAA0D;AACzG,SAASC,2BAA2B,QAAQ,uDAAuD;;AAEnG;AACA;AACA;AACA,OAAO,SAASC,qCAAqCA,CACnDC,cAAsD,EACtDC,GAAqC,EACI;EACzC,IAAI;IACF,OAAOC,iCAAiC,CAACF,cAAc,CAAC;EAC1D,CAAC,CAAC,OAAOG,KAAK,EAAE;IACdF,GAAG,EAAEG,IAAI,CAAC,+CAA+CD,KAAK,EAAE,CAAC;IACjE,OAAOE,SAAS;EAClB;AACF;AAEA,SAASH,iCAAiCA,CACxCF,cAAsD,EACb;EACzC,QAAQA,cAAc,CAACM,IAAI;IACzB,KAAK,MAAM;MACT,OAAOX,yBAAyB,CAACK,cAAc,CAAC;IAElD,KAAK,WAAW;MACd,OAAOJ,8BAA8B,CAACI,cAAc,CAAC;IAEvD,KAAK,SAAS;MACZ,OAAON,4BAA4B,CAACM,cAAc,CAAC;IAErD,KAAK,WAAW;MACd,OAAOH,8BAA8B,CAACG,cAAc,CAAC;IAEvD,KAAK,QAAQ;MACX,OAAOF,2BAA2B,CAACE,cAAc,CAAC;IAEpD;MAEE,MAAM,IAAIO,KAAK,CACb,4BAA6BP,cAAc,CAASM,IAAI,EAC1D,CAAC;EACL;AACF","ignoreList":[]}
|