@osdk/generator-converters 2.6.1 → 2.7.0-beta.10
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 +37 -46
- package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js +3 -1
- package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js.map +1 -1
- 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/wireObjectTypeFullMetadataToSdkObjectMetadata.js +14 -1
- package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.js.map +1 -1
- 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/cjs/index.cjs +253 -4
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +2 -2
- package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js +3 -1
- package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js.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/wireObjectTypeFullMetadataToSdkObjectMetadata.js +14 -1
- package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.js.map +1 -1
- 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/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/wireObjectTypeFullMetadataToSdkObjectMetadata.d.ts.map +1 -1
- 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 +2 -2
- package/build/types/wirePropertyV2ToSdkPropertyDefinition.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,80 +1,71 @@
|
|
|
1
1
|
# @osdk/generator-converters
|
|
2
2
|
|
|
3
|
-
## 2.
|
|
3
|
+
## 2.7.0-beta.10
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
|
|
7
|
+
- Updated dependencies [db44f6b]
|
|
8
|
+
- Updated dependencies [24a1e29]
|
|
9
|
+
- @osdk/api@2.7.0-beta.10
|
|
9
10
|
|
|
10
|
-
## 2.
|
|
11
|
+
## 2.7.0-beta.9
|
|
11
12
|
|
|
12
13
|
### Patch Changes
|
|
13
14
|
|
|
14
|
-
-
|
|
15
|
-
- b313525: bump osdk
|
|
16
|
-
- 3fbb596: Pipe through transactionId to endpoints that load data via object sets
|
|
17
|
-
- 486ef7e: Deprecate multiplicity in query params/outputs
|
|
18
|
-
- a1ffb20: Use new ephemeral media upload endpoint.
|
|
19
|
-
- b959085: Fix nested array query param type handling
|
|
20
|
-
- af4f3bf: Remove the following features for RC:
|
|
21
|
-
- Property formatting
|
|
22
|
-
- Branching
|
|
23
|
-
- Constant RDPs
|
|
15
|
+
- @osdk/api@2.7.0-beta.9
|
|
24
16
|
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
- Updated dependencies [2556c64]
|
|
31
|
-
- Updated dependencies [5a9cd8f]
|
|
32
|
-
- Updated dependencies [b307201]
|
|
33
|
-
- Updated dependencies [e7bf02a]
|
|
34
|
-
- Updated dependencies [a1ffb20]
|
|
35
|
-
- Updated dependencies [b959085]
|
|
36
|
-
- Updated dependencies [af4f3bf]
|
|
37
|
-
- Updated dependencies [e62c692]
|
|
38
|
-
- @osdk/api@2.6.0
|
|
17
|
+
## 2.7.0-beta.8
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- @osdk/api@2.7.0-beta.8
|
|
39
22
|
|
|
40
|
-
## 2.
|
|
23
|
+
## 2.7.0-beta.7
|
|
41
24
|
|
|
42
25
|
### Patch Changes
|
|
43
26
|
|
|
44
|
-
- @osdk/api@2.
|
|
27
|
+
- @osdk/api@2.7.0-beta.7
|
|
45
28
|
|
|
46
|
-
## 2.
|
|
29
|
+
## 2.7.0-beta.6
|
|
47
30
|
|
|
48
31
|
### Patch Changes
|
|
49
32
|
|
|
50
|
-
- Updated dependencies [
|
|
51
|
-
- @osdk/api@2.
|
|
33
|
+
- Updated dependencies [c9ca08d]
|
|
34
|
+
- @osdk/api@2.7.0-beta.6
|
|
35
|
+
|
|
36
|
+
## 2.7.0-beta.5
|
|
37
|
+
|
|
38
|
+
### Minor Changes
|
|
52
39
|
|
|
53
|
-
|
|
40
|
+
- dc33f68: Add Transaction ID to Queries
|
|
54
41
|
|
|
55
42
|
### Patch Changes
|
|
56
43
|
|
|
57
|
-
- @osdk/api@2.
|
|
44
|
+
- @osdk/api@2.7.0-beta.5
|
|
58
45
|
|
|
59
|
-
## 2.
|
|
46
|
+
## 2.7.0-beta.4
|
|
60
47
|
|
|
61
48
|
### Patch Changes
|
|
62
49
|
|
|
63
|
-
- Updated dependencies [
|
|
64
|
-
- @osdk/api@2.
|
|
50
|
+
- Updated dependencies [1e3c147]
|
|
51
|
+
- @osdk/api@2.7.0-beta.4
|
|
65
52
|
|
|
66
|
-
## 2.
|
|
53
|
+
## 2.7.0-beta.3
|
|
54
|
+
|
|
55
|
+
### Minor Changes
|
|
56
|
+
|
|
57
|
+
- f0a57a5: Use new interface property fields to include interface property types in codegen
|
|
67
58
|
|
|
68
59
|
### Patch Changes
|
|
69
60
|
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
61
|
+
- Updated dependencies [448763f]
|
|
62
|
+
- @osdk/api@2.7.0-beta.3
|
|
63
|
+
|
|
64
|
+
## 2.7.0-beta.2
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
75
67
|
|
|
76
|
-
-
|
|
77
|
-
- @osdk/api@2.6.0-rc.14
|
|
68
|
+
- @osdk/api@2.7.0-beta.2
|
|
78
69
|
|
|
79
70
|
## 2.6.0-beta.13
|
|
80
71
|
|
|
@@ -23,7 +23,9 @@ export function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceTyp
|
|
|
23
23
|
displayName: interfaceType.displayName,
|
|
24
24
|
description: interfaceType.description,
|
|
25
25
|
implements: interfaceType.allExtendsInterfaces ? [...interfaceType.allExtendsInterfaces].sort((a, b) => a.localeCompare(b)) : interfaceType.extendsInterfaces ? [...interfaceType.extendsInterfaces].sort((a, b) => a.localeCompare(b)) : undefined,
|
|
26
|
-
properties: Object.fromEntries(Object.entries(
|
|
26
|
+
properties: Object.fromEntries(Object.entries(
|
|
27
|
+
// prefer V2 if available and non-empty, otherwise fall back to V1
|
|
28
|
+
interfaceType.allPropertiesV2 && Object.keys(interfaceType.allPropertiesV2).length > 0 ? interfaceType.allPropertiesV2 : interfaceType.allProperties ?? interfaceType.properties).map(([key, value]) => {
|
|
27
29
|
return [key, wirePropertyV2ToSdkPropertyDefinition(value, true, log)];
|
|
28
30
|
}).filter(([_, value]) => value != null)),
|
|
29
31
|
links: Object.fromEntries(Object.entries(interfaceType.allLinks ?? interfaceType.links ?? {}).map(([linkApiName, linkType]) => [linkApiName, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js","names":["wirePropertyV2ToSdkPropertyDefinition","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","interfaceType","v2","log","type","rid","apiName","displayName","description","implements","allExtendsInterfaces","sort","a","b","localeCompare","extendsInterfaces","undefined","properties","Object","fromEntries","entries","allProperties","map","key","value","filter","_","links","allLinks","linkApiName","linkType","multiplicity","cardinality","targetTypeApiName","linkedEntityApiName","targetType","implementedBy","implementedByObjectTypes"],"sources":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { InterfaceMetadata } from \"@osdk/api\";\nimport type { InterfaceType } from \"@osdk/foundry.ontologies\";\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition.js\";\n\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n interfaceType: InterfaceType,\n v2: boolean,\n log?: { info: (msg: string) => void },\n): InterfaceMetadata {\n return {\n type: \"interface\",\n rid: interfaceType.rid,\n apiName: interfaceType.apiName,\n displayName: interfaceType.displayName,\n description: interfaceType.description,\n implements: interfaceType.allExtendsInterfaces\n ? [...interfaceType.allExtendsInterfaces].sort((a, b) =>\n a.localeCompare(b)\n )\n : interfaceType.extendsInterfaces\n ? [...interfaceType.extendsInterfaces].sort((a, b) => a.localeCompare(b))\n : undefined,\n properties: Object.fromEntries(\n Object.entries(interfaceType.allProperties ?? interfaceType.properties)\n .map((\n [key, value],\n ) => {\n return [\n key,\n wirePropertyV2ToSdkPropertyDefinition(\n value,\n true,\n log,\n ),\n ];\n }).filter(([_, value]) => value != null),\n ),\n links: Object.fromEntries(\n Object.entries(interfaceType.allLinks ?? interfaceType.links ?? {}).map(\n (\n [linkApiName, linkType],\n ) => [linkApiName, {\n multiplicity: linkType.cardinality === \"MANY\",\n targetTypeApiName: linkType.linkedEntityApiName.apiName,\n targetType: linkType.linkedEntityApiName.type === \"objectTypeApiName\"\n ? \"object\"\n : \"interface\",\n }],\n ),\n ),\n implementedBy: interfaceType.implementedByObjectTypes\n ? [...interfaceType.implementedByObjectTypes].sort((a, b) =>\n a.localeCompare(b)\n )\n : interfaceType.implementedByObjectTypes,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,qCAAqC,QAAQ,4CAA4C;AAElG,OAAO,SAASC,mDAAmDA,CACjEC,aAA4B,EAC5BC,EAAW,EACXC,GAAqC,EAClB;EACnB,OAAO;IACLC,IAAI,EAAE,WAAW;IACjBC,GAAG,EAAEJ,aAAa,CAACI,GAAG;IACtBC,OAAO,EAAEL,aAAa,CAACK,OAAO;IAC9BC,WAAW,EAAEN,aAAa,CAACM,WAAW;IACtCC,WAAW,EAAEP,aAAa,CAACO,WAAW;IACtCC,UAAU,EAAER,aAAa,CAACS,oBAAoB,GAC1C,CAAC,GAAGT,aAAa,CAACS,oBAAoB,CAAC,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAClDD,CAAC,CAACE,aAAa,CAACD,CAAC,CACnB,CAAC,GACCZ,aAAa,CAACc,iBAAiB,GAC/B,CAAC,GAAGd,aAAa,CAACc,iBAAiB,CAAC,CAACJ,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACE,aAAa,CAACD,CAAC,CAAC,CAAC,GACvEG,SAAS;IACbC,UAAU,EAAEC,MAAM,CAACC,WAAW,CAC5BD,MAAM,CAACE,OAAO,
|
|
1
|
+
{"version":3,"file":"__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js","names":["wirePropertyV2ToSdkPropertyDefinition","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","interfaceType","v2","log","type","rid","apiName","displayName","description","implements","allExtendsInterfaces","sort","a","b","localeCompare","extendsInterfaces","undefined","properties","Object","fromEntries","entries","allPropertiesV2","keys","length","allProperties","map","key","value","filter","_","links","allLinks","linkApiName","linkType","multiplicity","cardinality","targetTypeApiName","linkedEntityApiName","targetType","implementedBy","implementedByObjectTypes"],"sources":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { InterfaceMetadata } from \"@osdk/api\";\nimport type { InterfaceType } from \"@osdk/foundry.ontologies\";\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition.js\";\n\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n interfaceType: InterfaceType,\n v2: boolean,\n log?: { info: (msg: string) => void },\n): InterfaceMetadata {\n return {\n type: \"interface\",\n rid: interfaceType.rid,\n apiName: interfaceType.apiName,\n displayName: interfaceType.displayName,\n description: interfaceType.description,\n implements: interfaceType.allExtendsInterfaces\n ? [...interfaceType.allExtendsInterfaces].sort((a, b) =>\n a.localeCompare(b)\n )\n : interfaceType.extendsInterfaces\n ? [...interfaceType.extendsInterfaces].sort((a, b) => a.localeCompare(b))\n : undefined,\n properties: Object.fromEntries(\n Object.entries(\n // prefer V2 if available and non-empty, otherwise fall back to V1\n (interfaceType.allPropertiesV2\n && Object.keys(interfaceType.allPropertiesV2).length > 0)\n ? interfaceType.allPropertiesV2\n : (interfaceType.allProperties ?? interfaceType.properties),\n )\n .map((\n [key, value],\n ) => {\n return [\n key,\n wirePropertyV2ToSdkPropertyDefinition(\n value,\n true,\n log,\n ),\n ];\n }).filter(([_, value]) => value != null),\n ),\n links: Object.fromEntries(\n Object.entries(interfaceType.allLinks ?? interfaceType.links ?? {}).map(\n (\n [linkApiName, linkType],\n ) => [linkApiName, {\n multiplicity: linkType.cardinality === \"MANY\",\n targetTypeApiName: linkType.linkedEntityApiName.apiName,\n targetType: linkType.linkedEntityApiName.type === \"objectTypeApiName\"\n ? \"object\"\n : \"interface\",\n }],\n ),\n ),\n implementedBy: interfaceType.implementedByObjectTypes\n ? [...interfaceType.implementedByObjectTypes].sort((a, b) =>\n a.localeCompare(b)\n )\n : interfaceType.implementedByObjectTypes,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,qCAAqC,QAAQ,4CAA4C;AAElG,OAAO,SAASC,mDAAmDA,CACjEC,aAA4B,EAC5BC,EAAW,EACXC,GAAqC,EAClB;EACnB,OAAO;IACLC,IAAI,EAAE,WAAW;IACjBC,GAAG,EAAEJ,aAAa,CAACI,GAAG;IACtBC,OAAO,EAAEL,aAAa,CAACK,OAAO;IAC9BC,WAAW,EAAEN,aAAa,CAACM,WAAW;IACtCC,WAAW,EAAEP,aAAa,CAACO,WAAW;IACtCC,UAAU,EAAER,aAAa,CAACS,oBAAoB,GAC1C,CAAC,GAAGT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mB,GACjE,QAAQ,GACR;IACN,CAAC,CACH,CACF,CAAC;IACDmC,aAAa,EAAEtC,aAAa,CAACuC,wBAAwB,GACjD,CAAC,GAAGvC,aAAa,CAACuC,wBAAwB,CAAC,CAAC7B,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KACtDD,CAAC,CAACE,aAAa,CAACD,CAAC,CACnB,CAAC,GACCZ,aAAa,CAACuC;EACpB,CAAC;AACH","ignoreList":[]}
|
|
@@ -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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@
|
|
|
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,wBAAw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7 +25,20 @@ export function wireObjectTypeFullMetadataToSdkObjectMetadata(objectTypeWithLink
|
|
|
25
25
|
if (objectTypeWithLink.implementsInterfaces2 == null && objectTypeWithLink.implementsInterfaces != null) {
|
|
26
26
|
throw new Error("Your ontology.json file is missing the implementsInterfaces2 field. Please regenerate it.");
|
|
27
27
|
}
|
|
28
|
-
const interfaceMap = objectTypeWithLink.implementsInterfaces2 ? Object.fromEntries(Object.entries(objectTypeWithLink.implementsInterfaces2).map(([interfaceApiName, impl]) =>
|
|
28
|
+
const interfaceMap = objectTypeWithLink.implementsInterfaces2 ? Object.fromEntries(Object.entries(objectTypeWithLink.implementsInterfaces2).map(([interfaceApiName, impl]) => {
|
|
29
|
+
// prefer V2 if available and non-empty
|
|
30
|
+
if (impl.propertiesV2 && Object.keys(impl.propertiesV2).length > 0) {
|
|
31
|
+
const propMap = {};
|
|
32
|
+
for (const [iptApiName, implementation] of Object.entries(impl.propertiesV2)) {
|
|
33
|
+
if (implementation.type === "localPropertyImplementation") {
|
|
34
|
+
propMap[iptApiName] = implementation.propertyApiName;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return [interfaceApiName, propMap];
|
|
38
|
+
}
|
|
39
|
+
// fall back to V1
|
|
40
|
+
return [interfaceApiName, impl.properties];
|
|
41
|
+
})) : {};
|
|
29
42
|
return {
|
|
30
43
|
type: "object",
|
|
31
44
|
apiName: objectTypeWithLink.objectType.apiName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wireObjectTypeFullMetadataToSdkObjectMetadata.js","names":["wirePropertyV2ToSdkPrimaryKeyTypeDefinition","wirePropertyV2ToSdkPropertyDefinition","wireObjectTypeFullMetadataToSdkObjectMetadata","objectTypeWithLink","v2","log","objectType","properties","primaryKey","undefined","Error","apiName","implementsInterfaces2","implementsInterfaces","interfaceMap","Object","fromEntries","entries","map","interfaceApiName","impl","type","description","primaryKeyApiName","primaryKeyType","links","linkTypes","sort","a","b","localeCompare","linkType","multiplicity","cardinality","targetType","objectTypeApiName","key","value","filter","_","implements","inverseInterfaceMap","props","invertProps","icon","supportedIconTypes","includes","titleProperty","displayName","pluralDisplayName","status","ensureStringEnumSupportedOrUndefined","supportedReleaseStatus","rid","visibility","supportedObjectTypeVisibility","k","v","supportedValues"],"sources":["wireObjectTypeFullMetadataToSdkObjectMetadata.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { ObjectMetadata } from \"@osdk/api\";\nimport type {\n ObjectTypeFullMetadata,\n PropertyApiName,\n PropertyV2,\n} from \"@osdk/foundry.ontologies\";\nimport { wirePropertyV2ToSdkPrimaryKeyTypeDefinition } from \"./wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js\";\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition.js\";\n\nexport function wireObjectTypeFullMetadataToSdkObjectMetadata(\n objectTypeWithLink: ObjectTypeFullMetadata & {\n objectType: {\n properties: Record<PropertyApiName, PropertyV2 & { nullable?: boolean }>;\n };\n },\n v2: boolean,\n log?: { info: (msg: string) => void },\n): ObjectMetadata {\n if (\n objectTypeWithLink.objectType\n .properties[objectTypeWithLink.objectType.primaryKey] === undefined\n ) {\n throw new Error(\n `Primary key ${objectTypeWithLink.objectType.primaryKey} not found in ${objectTypeWithLink.objectType.apiName}`,\n );\n }\n\n // saved ontology.json files may not have this implementsInterfaces2 so we need to handle\n if (\n objectTypeWithLink.implementsInterfaces2 == null\n && objectTypeWithLink.implementsInterfaces != null\n ) {\n throw new Error(\n \"Your ontology.json file is missing the implementsInterfaces2 field. Please regenerate it.\",\n );\n }\n\n const interfaceMap = objectTypeWithLink.implementsInterfaces2\n ? Object.fromEntries(\n Object.entries(objectTypeWithLink.implementsInterfaces2).map(\n ([interfaceApiName, impl]) => [interfaceApiName, impl.properties],\n ),\n )\n : {};\n\n return {\n type: \"object\",\n apiName: objectTypeWithLink.objectType.apiName,\n description: objectTypeWithLink.objectType.description,\n primaryKeyApiName: objectTypeWithLink.objectType.primaryKey,\n primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(\n objectTypeWithLink.objectType\n .properties[objectTypeWithLink.objectType.primaryKey],\n ),\n links: Object.fromEntries(\n [...objectTypeWithLink.linkTypes].sort((a, b) =>\n a.apiName.localeCompare(b.apiName)\n ).map(linkType => {\n return [linkType.apiName, {\n multiplicity: linkType.cardinality === \"MANY\",\n targetType: linkType.objectTypeApiName,\n }];\n }),\n ),\n properties: Object.fromEntries(\n Object.entries(objectTypeWithLink.objectType.properties).map((\n [key, value],\n ) => [\n key,\n wirePropertyV2ToSdkPropertyDefinition(\n value,\n !(v2 && objectTypeWithLink.objectType.primaryKey === key),\n log,\n ),\n ]).filter(([_, value]) => value != null),\n ),\n implements: objectTypeWithLink.implementsInterfaces\n ? [...objectTypeWithLink.implementsInterfaces].sort((a, b) =>\n a.localeCompare(b)\n )\n : objectTypeWithLink.implementsInterfaces,\n interfaceMap,\n inverseInterfaceMap: Object.fromEntries(\n Object.entries(interfaceMap).map((\n [interfaceApiName, props],\n ) => [interfaceApiName, invertProps(props)]),\n ),\n icon: supportedIconTypes.includes(objectTypeWithLink.objectType.icon.type)\n ? objectTypeWithLink.objectType.icon\n : undefined,\n titleProperty: objectTypeWithLink.objectType.titleProperty,\n displayName: objectTypeWithLink.objectType.displayName,\n pluralDisplayName: objectTypeWithLink.objectType.pluralDisplayName,\n status: ensureStringEnumSupportedOrUndefined(\n objectTypeWithLink.objectType.status,\n supportedReleaseStatus,\n ),\n rid: objectTypeWithLink.objectType.rid,\n visibility: ensureStringEnumSupportedOrUndefined(\n objectTypeWithLink.objectType.visibility,\n supportedObjectTypeVisibility,\n ),\n };\n}\n\nfunction invertProps(\n a?: Record<string, string>,\n): typeof a extends undefined ? typeof a : Record<string, string> {\n return (a\n ? Object.fromEntries(Object.entries(a).map(([k, v]) => [v, k]))\n : undefined) as typeof a extends undefined ? typeof a\n : Record<string, string>;\n}\n\nexport const supportedIconTypes = [\"blueprint\"] as const;\n\nexport const supportedReleaseStatus = [\n \"ACTIVE\",\n \"EXPERIMENTAL\",\n \"DEPRECATED\",\n \"ENDORSED\",\n] as const;\n\nexport const supportedObjectTypeVisibility = [\n \"NORMAL\",\n \"PROMINENT\",\n \"HIDDEN\",\n] as const;\n\nexport function ensureStringEnumSupportedOrUndefined<T extends string>(\n value: T | undefined,\n supportedValues: readonly string[],\n): T | undefined {\n return value && supportedValues.includes(value) ? value : undefined;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,2CAA2C,QAAQ,kDAAkD;AAC9G,SAASC,qCAAqC,QAAQ,4CAA4C;AAElG,OAAO,SAASC,6CAA6CA,CAC3DC,kBAIC,EACDC,EAAW,EACXC,GAAqC,EACrB;EAChB,IACEF,kBAAkB,CAACG,UAAU,CAC1BC,UAAU,CAACJ,kBAAkB,CAACG,UAAU,CAACE,UAAU,CAAC,KAAKC,SAAS,EACrE;IACA,MAAM,IAAIC,KAAK,CACb,eAAeP,kBAAkB,CAACG,UAAU,CAACE,UAAU,iBAAiBL,kBAAkB,CAACG,UAAU,CAACK,OAAO,EAC/G,CAAC;EACH;;EAEA;EACA,IACER,kBAAkB,CAACS,qBAAqB,IAAI,IAAI,IAC7CT,kBAAkB,CAACU,oBAAoB,IAAI,IAAI,EAClD;IACA,MAAM,IAAIH,KAAK,CACb,2FACF,CAAC;EACH;EAEA,MAAMI,YAAY,GAAGX,kBAAkB,CAACS,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AQA,CAAC,GACLb,MAAM,CAACC,WAAW,CAACD,MAAM,CAACE,OAAO,CAACW,CAAC,CAAC,CAACV,GAAG,CAAC,CAAC,CAACsC,CAAC,EAAEC,CAAC,CAAC,KAAK,CAACA,CAAC,EAAED,CAAC,CAAC,CAAC,CAAC,GAC7D/C,SAAS;AAEf;AAEA,OAAO,MAAMoC,kBAAkB,GAAG,CAAC,WAAW,CAAU;AAExD,OAAO,MAAMO,sBAAsB,GAAG,CACpC,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,CACF;AAEV,OAAO,MAAMG,6BAA6B,GAAG,CAC3C,QAAQ,EACR,WAAW,EACX,QAAQ,CACA;AAEV,OAAO,SAASJ,oCAAoCA,CAClDd,KAAoB,EACpBqB,eAAkC,EACnB;EACf,OAAOrB,KAAK,IAAIqB,eAAe,CAACZ,QAAQ,CAACT,KAAK,CAAC,GAAGA,KAAK,GAAG5B,SAAS;AACrE","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"wireObjectTypeFullMetadataToSdkObjectMetadata.js","names":["wirePropertyV2ToSdkPrimaryKeyTypeDefinition","wirePropertyV2ToSdkPropertyDefinition","wireObjectTypeFullMetadataToSdkObjectMetadata","objectTypeWithLink","v2","log","objectType","properties","primaryKey","undefined","Error","apiName","implementsInterfaces2","implementsInterfaces","interfaceMap","Object","fromEntries","entries","map","interfaceApiName","impl","propertiesV2","keys","length","propMap","iptApiName","implementation","type","propertyApiName","description","primaryKeyApiName","primaryKeyType","links","linkTypes","sort","a","b","localeCompare","linkType","multiplicity","cardinality","targetType","objectTypeApiName","key","value","filter","_","implements","inverseInterfaceMap","props","invertProps","icon","supportedIconTypes","includes","titleProperty","displayName","pluralDisplayName","status","ensureStringEnumSupportedOrUndefined","supportedReleaseStatus","rid","visibility","supportedObjectTypeVisibility","k","v","supportedValues"],"sources":["wireObjectTypeFullMetadataToSdkObjectMetadata.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { ObjectMetadata } from \"@osdk/api\";\nimport type {\n ObjectTypeFullMetadata,\n PropertyApiName,\n PropertyV2,\n} from \"@osdk/foundry.ontologies\";\nimport { wirePropertyV2ToSdkPrimaryKeyTypeDefinition } from \"./wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js\";\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition.js\";\n\nexport function wireObjectTypeFullMetadataToSdkObjectMetadata(\n objectTypeWithLink: ObjectTypeFullMetadata & {\n objectType: {\n properties: Record<PropertyApiName, PropertyV2 & { nullable?: boolean }>;\n };\n },\n v2: boolean,\n log?: { info: (msg: string) => void },\n): ObjectMetadata {\n if (\n objectTypeWithLink.objectType\n .properties[objectTypeWithLink.objectType.primaryKey] === undefined\n ) {\n throw new Error(\n `Primary key ${objectTypeWithLink.objectType.primaryKey} not found in ${objectTypeWithLink.objectType.apiName}`,\n );\n }\n\n // saved ontology.json files may not have this implementsInterfaces2 so we need to handle\n if (\n objectTypeWithLink.implementsInterfaces2 == null\n && objectTypeWithLink.implementsInterfaces != null\n ) {\n throw new Error(\n \"Your ontology.json file is missing the implementsInterfaces2 field. Please regenerate it.\",\n );\n }\n\n const interfaceMap = objectTypeWithLink.implementsInterfaces2\n ? Object.fromEntries(\n Object.entries(objectTypeWithLink.implementsInterfaces2).map(\n ([interfaceApiName, impl]) => {\n // prefer V2 if available and non-empty\n if (\n impl.propertiesV2\n && Object.keys(impl.propertiesV2).length > 0\n ) {\n const propMap: Record<string, string> = {};\n for (\n const [iptApiName, implementation] of Object.entries(\n impl.propertiesV2,\n )\n ) {\n if (implementation.type === \"localPropertyImplementation\") {\n propMap[iptApiName] = implementation.propertyApiName;\n }\n }\n return [interfaceApiName, propMap];\n }\n // fall back to V1\n return [interfaceApiName, impl.properties];\n },\n ),\n )\n : {};\n\n return {\n type: \"object\",\n apiName: objectTypeWithLink.objectType.apiName,\n description: objectTypeWithLink.objectType.description,\n primaryKeyApiName: objectTypeWithLink.objectType.primaryKey,\n primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(\n objectTypeWithLink.objectType\n .properties[objectTypeWithLink.objectType.primaryKey],\n ),\n links: Object.fromEntries(\n [...objectTypeWithLink.linkTypes].sort((a, b) =>\n a.apiName.localeCompare(b.apiName)\n ).map(linkType => {\n return [linkType.apiName, {\n multiplicity: linkType.cardinality === \"MANY\",\n targetType: linkType.objectTypeApiName,\n }];\n }),\n ),\n properties: Object.fromEntries(\n Object.entries(objectTypeWithLink.objectType.properties).map((\n [key, value],\n ) => [\n key,\n wirePropertyV2ToSdkPropertyDefinition(\n value,\n !(v2 && objectTypeWithLink.objectType.primaryKey === key),\n log,\n ),\n ]).filter(([_, value]) => value != null),\n ),\n implements: objectTypeWithLink.implementsInterfaces\n ? [...objectTypeWithLink.implementsInterfaces].sort((a, b) =>\n a.localeCompare(b)\n )\n : objectTypeWithLink.implementsInterfaces,\n interfaceMap,\n inverseInterfaceMap: Object.fromEntries(\n Object.entries(interfaceMap).map((\n [interfaceApiName, props],\n ) => [interfaceApiName, invertProps(props)]),\n ),\n icon: supportedIconTypes.includes(objectTypeWithLink.objectType.icon.type)\n ? objectTypeWithLink.objectType.icon\n : undefined,\n titleProperty: objectTypeWithLink.objectType.titleProperty,\n displayName: objectTypeWithLink.objectType.displayName,\n pluralDisplayName: objectTypeWithLink.objectType.pluralDisplayName,\n status: ensureStringEnumSupportedOrUndefined(\n objectTypeWithLink.objectType.status,\n supportedReleaseStatus,\n ),\n rid: objectTypeWithLink.objectType.rid,\n visibility: ensureStringEnumSupportedOrUndefined(\n objectTypeWithLink.objectType.visibility,\n supportedObjectTypeVisibility,\n ),\n };\n}\n\nfunction invertProps(\n a?: Record<string, string>,\n): typeof a extends undefined ? typeof a : Record<string, string> {\n return (a\n ? Object.fromEntries(Object.entries(a).map(([k, v]) => [v, k]))\n : undefined) as typeof a extends undefined ? typeof a\n : Record<string, string>;\n}\n\nexport const supportedIconTypes = [\"blueprint\"] as const;\n\nexport const supportedReleaseStatus = [\n \"ACTIVE\",\n \"EXPERIMENTAL\",\n \"DEPRECATED\",\n \"ENDORSED\",\n] as const;\n\nexport const supportedObjectTypeVisibility = [\n \"NORMAL\",\n \"PROMINENT\",\n \"HIDDEN\",\n] as const;\n\nexport function ensureStringEnumSupportedOrUndefined<T extends string>(\n value: T | undefined,\n supportedValues: readonly string[],\n): T | undefined {\n return value && supportedValues.includes(value) ? value : undefined;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,2CAA2C,QAAQ,kDAAkD;AAC9G,SAASC,qCAAqC,QAAQ,4CAA4C;AAElG,OAAO,SAASC,6CAA6CA,CAC3DC,kBAIC,EACDC,EAAW,EACXC,GAAqC,EACrB;EAChB,IACEF,kBAAkB,CAACG,UAAU,CAC1BC,UAAU,CAACJ,kBAAkB,CAACG,UAAU,CAACE,UAAU,CAAC,KAAKC,SAAS,EACrE;IACA,MAAM,IAAIC,KAAK,CACb,eAAeP,kBAAkB,CAACG,UAAU,CAACE,UAAU,iBAAiBL,kBAAkB,CAACG,UAAU,CAACK,OAAO,EAC/G,CAAC;EACH;;EAEA;EACA,IACER,kBAAkB,CAACS,qBAAqB,IAAI,IAAI,IAC7CT,kBAAkB,CAACU,oBAAoB,IAAI,IAAI,EAClD;IACA,MAAM,IAAIH,KAAK,CACb,2FACF,CAAC;EACH;EAEA,MAAMI,YAAY,GAAGX,kBAAkB,CAACS,qBAAqB,GACzDG,MAAM,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AEnD,kBAAkB,CAACG,UAAU,CAACgD,aAAa;IAC1DC,WAAW,EAAEpD,kBAAkB,CAACG,UAAU,CAACiD,WAAW;IACtDC,iBAAiB,EAAErD,kBAAkB,CAACG,UAAU,CAACkD,iBAAiB;IAClEC,MAAM,EAAEC,oCAAoC,CAC1CvD,kBAAkB,CAACG,UAAU,CAACmD,MAAM,EACpCE,sBACF,CAAC;IACDC,GAAG,EAAEzD,kBAAkB,CAACG,UAAU,CAACsD,GAAG;IACtCC,UAAU,EAAEH,oCAAoC,CAC9CvD,kBAAkB,CAACG,UAAU,CAACuD,UAAU,EACxCC,6BACF;EACF,CAAC;AACH;AAEA,SAASZ,WAAWA,CAClBf,CAA0B,EACsC;EAChE,OAAQA,CAAC,GACLpB,MAAM,CAACC,WAAW,CAACD,MAAM,CAACE,OAAO,CAACkB,CAAC,CAAC,CAACjB,GAAG,CAAC,CAAC,CAAC6C,CAAC,EAAEC,CAAC,CAAC,KAAK,CAACA,CAAC,EAAED,CAAC,CAAC,CAAC,CAAC,GAC7DtD,SAAS;AAEf;AAEA,OAAO,MAAM2C,kBAAkB,GAAG,CAAC,WAAW,CAAU;AAExD,OAAO,MAAMO,sBAAsB,GAAG,CACpC,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,CACF;AAEV,OAAO,MAAMG,6BAA6B,GAAG,CAC3C,QAAQ,EACR,WAAW,EACX,QAAQ,CACA;AAEV,OAAO,SAASJ,oCAAoCA,CAClDd,KAAoB,EACpBqB,eAAkC,EACnB;EACf,OAAOrB,KAAK,IAAIqB,eAAe,CAACZ,QAAQ,CAACT,KAAK,CAAC,GAAGA,KAAK,GAAGnC,SAAS;AACrE","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
|