@osdk/generator-converters 2.1.0-beta.30 → 2.1.0-beta.31
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 +16 -0
- package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js +2 -2
- package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js.map +1 -1
- package/build/browser/getEditedEntities.js.map +1 -1
- package/build/browser/isNullableQueryDataType.js.map +1 -1
- package/build/browser/wireActionTypeV2ToSdkActionMetadata.js.map +1 -1
- package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.js +2 -2
- package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.js.map +1 -1
- package/build/browser/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js +1 -1
- package/build/browser/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js.map +1 -1
- package/build/browser/wirePropertyV2ToSdkPropertyDefinition.js +9 -9
- package/build/browser/wirePropertyV2ToSdkPropertyDefinition.js.map +1 -1
- package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.js.map +1 -1
- package/build/browser/wireQueryTypeV2ToSdkQueryMetadata.js.map +1 -1
- package/build/cjs/index.cjs +16 -17
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +10 -4
- package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js +2 -2
- package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js.map +1 -1
- package/build/esm/getEditedEntities.js.map +1 -1
- package/build/esm/isNullableQueryDataType.js.map +1 -1
- package/build/esm/wireActionTypeV2ToSdkActionMetadata.js.map +1 -1
- package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.js +2 -2
- package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.js.map +1 -1
- package/build/esm/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js +1 -1
- package/build/esm/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js.map +1 -1
- package/build/esm/wirePropertyV2ToSdkPropertyDefinition.js +9 -9
- package/build/esm/wirePropertyV2ToSdkPropertyDefinition.js.map +1 -1
- package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.js.map +1 -1
- package/build/esm/wireQueryTypeV2ToSdkQueryMetadata.js.map +1 -1
- package/build/types/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts +2 -2
- package/build/types/getEditedEntities.d.ts +1 -1
- package/build/types/isNullableQueryDataType.d.ts +1 -1
- package/build/types/wireActionTypeV2ToSdkActionMetadata.d.ts +1 -1
- package/build/types/wireObjectTypeFullMetadataToSdkObjectMetadata.d.ts +2 -2
- package/build/types/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts +1 -1
- package/build/types/wirePropertyV2ToSdkPropertyDefinition.d.ts +2 -2
- package/build/types/wireQueryDataTypeToQueryDataTypeDefinition.d.ts +1 -1
- package/build/types/wireQueryTypeV2ToSdkQueryMetadata.d.ts +1 -1
- package/package.json +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @osdk/generator-converters
|
|
2
2
|
|
|
3
|
+
## 2.1.0-beta.31
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- bb8b219: Use new external packages instead of the internal ones.
|
|
8
|
+
- 81b2fb2: Remove duplicate types in case statement.
|
|
9
|
+
- ecd4aee: Fixing use of logging from client for unknown property types.
|
|
10
|
+
- ee6224b: Explicitly type aggregation types in queries.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [bb8b219]
|
|
15
|
+
- Updated dependencies [ee6224b]
|
|
16
|
+
- Updated dependencies [5fe2c8d]
|
|
17
|
+
- @osdk/api@2.1.0-beta.31
|
|
18
|
+
|
|
3
19
|
## 2.1.0-beta.30
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { wirePropertyV2ToSdkPropertyDefinition } from "./wirePropertyV2ToSdkPropertyDefinition.js";
|
|
18
|
-
export function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType) {
|
|
18
|
+
export function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType, v2, log) {
|
|
19
19
|
return {
|
|
20
20
|
type: "interface",
|
|
21
21
|
rid: interfaceType.rid,
|
|
@@ -24,7 +24,7 @@ export function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceTyp
|
|
|
24
24
|
description: interfaceType.description,
|
|
25
25
|
implements: interfaceType.extendsInterfaces,
|
|
26
26
|
properties: Object.fromEntries(Object.entries(interfaceType.properties).map(([key, value]) => {
|
|
27
|
-
return [key, wirePropertyV2ToSdkPropertyDefinition(value, true)];
|
|
27
|
+
return [key, wirePropertyV2ToSdkPropertyDefinition(value, true, log)];
|
|
28
28
|
}).filter(([key, value]) => value != null)),
|
|
29
29
|
links: {},
|
|
30
30
|
implementedBy: interfaceType.implementedByObjectTypes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js","names":["wirePropertyV2ToSdkPropertyDefinition","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","interfaceType","type","rid","apiName","displayName","description","implements","extendsInterfaces","properties","Object","fromEntries","entries","map","key","value","filter","links","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/
|
|
1
|
+
{"version":3,"file":"__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js","names":["wirePropertyV2ToSdkPropertyDefinition","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","interfaceType","v2","log","type","rid","apiName","displayName","description","implements","extendsInterfaces","properties","Object","fromEntries","entries","map","key","value","filter","links","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.extendsInterfaces,\n properties: Object.fromEntries(\n Object.entries(interfaceType.properties).map((\n [key, value],\n ) => {\n return [\n key,\n wirePropertyV2ToSdkPropertyDefinition(\n value,\n true,\n log,\n ),\n ];\n }).filter(([key, value]) => value != null),\n ),\n links: {},\n implementedBy: 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,iBAAiB;IAC3CC,UAAU,EAAEC,MAAM,CAACC,WAAW,CAC5BD,MAAM,CAACE,OAAO,CAACb,aAAa,CAACU,UAAU,CAAC,CAACI,GAAG,CAAC,CAC3C,CAACC,GAAG,EAAEC,KAAK,CAAC,KACT;MACH,OAAO,CACLD,GAAG,EACHjB,qCAAqC,CACnCkB,KAAK,EACL,IAAI,EACJd,GACF,CAAC,CACF;IACH,CAAC,CAAC,CAACe,MAAM,CAAC,CAAC,CAACF,GAAG,EAAEC,KAAK,CAAC,KAAKA,KAAK,IAAI,IAAI,CAC3C,CAAC;IACDE,KAAK,EAAE,CAAC,CAAC;IACTC,aAAa,EAAEnB,aAAa,CAACoB;EAC/B,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEditedEntities.js","names":["getModifiedEntityTypes","action","addedObjects","Set","modifiedObjects","operation","operations","type","add","objectTypeApiName"],"sources":["getEditedEntities.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 { ActionTypeV2 } from \"@osdk/
|
|
1
|
+
{"version":3,"file":"getEditedEntities.js","names":["getModifiedEntityTypes","action","addedObjects","Set","modifiedObjects","operation","operations","type","add","objectTypeApiName"],"sources":["getEditedEntities.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 { ActionTypeV2 } from \"@osdk/foundry.ontologies\";\n\nexport type ModifiedEntityTypes = {\n addedObjects: Set<string>;\n modifiedObjects: Set<string>;\n};\n\nexport function getModifiedEntityTypes(\n action: ActionTypeV2,\n): ModifiedEntityTypes {\n const addedObjects = new Set<string>();\n const modifiedObjects = new Set<string>();\n for (const operation of action.operations) {\n switch (operation.type) {\n case \"createObject\":\n addedObjects.add(operation.objectTypeApiName);\n break;\n case \"modifyObject\":\n modifiedObjects.add(operation.objectTypeApiName);\n break;\n case \"deleteObject\":\n case \"createLink\":\n case \"deleteLink\":\n case \"createInterfaceObject\":\n case \"modifyInterfaceObject\":\n case \"deleteInterfaceObject\":\n break;\n default:\n const _: never = operation;\n }\n }\n return { addedObjects, modifiedObjects };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,OAAO,SAASA,sBAAsBA,CACpCC,MAAoB,EACC;EACrB,MAAMC,YAAY,GAAG,IAAIC,GAAG,CAAS,CAAC;EACtC,MAAMC,eAAe,GAAG,IAAID,GAAG,CAAS,CAAC;EACzC,KAAK,MAAME,SAAS,IAAIJ,MAAM,CAACK,UAAU,EAAE;IACzC,QAAQD,SAAS,CAACE,IAAI;MACpB,KAAK,cAAc;QACjBL,YAAY,CAACM,GAAG,CAACH,SAAS,CAACI,iBAAiB,CAAC;QAC7C;MACF,KAAK,cAAc;QACjBL,eAAe,CAACI,GAAG,CAACH,SAAS,CAACI,iBAAiB,CAAC;QAChD;MACF,KAAK,cAAc;MACnB,KAAK,YAAY;MACjB,KAAK,YAAY;MACjB,KAAK,uBAAuB;MAC5B,KAAK,uBAAuB;MAC5B,KAAK,uBAAuB;QAC1B;MACF;IAEF;EACF;EACA,OAAO;IAAEP,YAAY;IAAEE;EAAgB,CAAC;AAC1C","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isNullableQueryDataType.js","names":["isNullableQueryDataType","input","type","unionTypes","some","t"],"sources":["isNullableQueryDataType.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 { QueryDataType } from \"@osdk/
|
|
1
|
+
{"version":3,"file":"isNullableQueryDataType.js","names":["isNullableQueryDataType","input","type","unionTypes","some","t"],"sources":["isNullableQueryDataType.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 { QueryDataType } from \"@osdk/foundry.ontologies\";\n\nexport function isNullableQueryDataType(input: QueryDataType): boolean {\n if (input.type === \"null\") {\n return true;\n }\n if (input.type === \"union\") {\n return input.unionTypes.some(t => isNullableQueryDataType(t));\n }\n return false;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,SAASA,uBAAuBA,CAACC,KAAoB,EAAW;EACrE,IAAIA,KAAK,CAACC,IAAI,KAAK,MAAM,EAAE;IACzB,OAAO,IAAI;EACb;EACA,IAAID,KAAK,CAACC,IAAI,KAAK,OAAO,EAAE;IAC1B,OAAOD,KAAK,CAACE,UAAU,CAACC,IAAI,CAACC,CAAC,IAAIL,uBAAuB,CAACK,CAAC,CAAC,CAAC;EAC/D;EACA,OAAO,KAAK;AACd","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wireActionTypeV2ToSdkActionMetadata.js","names":["getModifiedEntityTypes","wireActionTypeV2ToSdkActionMetadata","input","modifiedEntityTypes","type","apiName","parameters","Object","fromEntries","entries","map","key","value","wireActionParameterV2ToSdkParameterDefinition","displayName","description","modifiedEntities","createModifiedEntities","addedObjects","modifiedObjects","rid","status","multiplicity","dataType","actionPropertyToSdkPropertyDefinition","subType","nullable","required","parameterType","objectSet","objectTypeApiName","object","interface","interfaceTypeApiName","struct","fields","reduce","structMap","structField","name","fieldType","Error","JSON","stringify","entities","created","modified"],"sources":["wireActionTypeV2ToSdkActionMetadata.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 { ActionMetadata } from \"@osdk/api\";\nimport type {\n ActionParameterType,\n ActionParameterV2,\n ActionTypeV2,\n} from \"@osdk/
|
|
1
|
+
{"version":3,"file":"wireActionTypeV2ToSdkActionMetadata.js","names":["getModifiedEntityTypes","wireActionTypeV2ToSdkActionMetadata","input","modifiedEntityTypes","type","apiName","parameters","Object","fromEntries","entries","map","key","value","wireActionParameterV2ToSdkParameterDefinition","displayName","description","modifiedEntities","createModifiedEntities","addedObjects","modifiedObjects","rid","status","multiplicity","dataType","actionPropertyToSdkPropertyDefinition","subType","nullable","required","parameterType","objectSet","objectTypeApiName","object","interface","interfaceTypeApiName","struct","fields","reduce","structMap","structField","name","fieldType","Error","JSON","stringify","entities","created","modified"],"sources":["wireActionTypeV2ToSdkActionMetadata.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 { ActionMetadata } from \"@osdk/api\";\nimport type {\n ActionParameterType,\n ActionParameterV2,\n ActionTypeV2,\n} from \"@osdk/foundry.ontologies\";\nimport { getModifiedEntityTypes } from \"./getEditedEntities.js\";\n\nexport function wireActionTypeV2ToSdkActionMetadata(\n input: ActionTypeV2,\n): ActionMetadata {\n const modifiedEntityTypes = getModifiedEntityTypes(input);\n return {\n type: \"action\",\n apiName: input.apiName,\n parameters: Object.fromEntries(\n Object.entries(input.parameters).map((\n [key, value],\n ) => [key, wireActionParameterV2ToSdkParameterDefinition(value)]),\n ),\n displayName: input.displayName,\n description: input.description,\n modifiedEntities: createModifiedEntities(\n modifiedEntityTypes.addedObjects,\n modifiedEntityTypes.modifiedObjects,\n ),\n rid: input.rid,\n status: input.status,\n };\n}\n\nfunction wireActionParameterV2ToSdkParameterDefinition(\n value: ActionParameterV2,\n): ActionMetadata.Parameter<any> {\n return {\n multiplicity: value.dataType.type === \"array\",\n type: actionPropertyToSdkPropertyDefinition(\n value.dataType.type === \"array\" ? value.dataType.subType : value.dataType,\n ),\n nullable: !value.required,\n description: value.description,\n };\n}\n\nfunction actionPropertyToSdkPropertyDefinition(\n parameterType: ActionParameterType,\n): ActionMetadata.Parameter[\"type\"] {\n switch (parameterType.type) {\n case \"string\":\n case \"boolean\":\n case \"attachment\":\n case \"double\":\n case \"integer\":\n case \"long\":\n case \"timestamp\":\n case \"mediaReference\":\n case \"marking\":\n case \"objectType\":\n return parameterType.type;\n case \"date\":\n return \"datetime\";\n case \"objectSet\":\n return { type: \"objectSet\", objectSet: parameterType.objectTypeApiName! };\n case \"object\":\n return { type: \"object\", object: parameterType.objectTypeApiName };\n case \"array\":\n return actionPropertyToSdkPropertyDefinition(parameterType.subType);\n case \"interfaceObject\":\n return {\n type: \"interface\",\n interface: parameterType.interfaceTypeApiName,\n };\n case \"struct\":\n return {\n type: \"struct\",\n struct: parameterType.fields.reduce(\n (\n structMap: Record<\n string,\n ActionMetadata.DataType.BaseActionParameterTypes\n >,\n structField,\n ) => {\n structMap[structField.name] = actionPropertyToSdkPropertyDefinition(\n structField.fieldType as ActionParameterType,\n ) as ActionMetadata.DataType.BaseActionParameterTypes;\n return structMap;\n },\n {},\n ),\n };\n default:\n throw new Error(\n `Unsupported action parameter type: ${JSON.stringify(parameterType)}`,\n );\n }\n}\n\nfunction createModifiedEntities<K extends string>(\n addedObjects: Set<K>,\n modifiedObjects: Set<K>,\n): ActionMetadata[\"modifiedEntities\"] {\n const entities = {} as Record<\n K,\n {\n created: boolean;\n modified: boolean;\n }\n >;\n\n for (const key of addedObjects) {\n entities[key] = { created: true, modified: false };\n }\n\n for (const key of modifiedObjects) {\n if (entities[key]) {\n entities[key].modified = true;\n } else {\n entities[key] = { created: false, modified: true };\n }\n }\n\n return entities;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,sBAAsB,QAAQ,wBAAwB;AAE/D,OAAO,SAASC,mCAAmCA,CACjDC,KAAmB,EACH;EAChB,MAAMC,mBAAmB,GAAGH,sBAAsB,CAACE,KAAK,CAAC;EACzD,OAAO;IACLE,IAAI,EAAE,QAAQ;IACdC,OAAO,EAAEH,KAAK,CAACG,OAAO;IACtBC,UAAU,EAAEC,MAAM,CAACC,WAAW,CAC5BD,MAAM,CAACE,OAAO,CAACP,KAAK,CAACI,UAAU,CAAC,CAACI,GAAG,CAAC,CACnC,CAACC,GAAG,EAAEC,KAAK,CAAC,KACT,CAACD,GAAG,EAAEE,6CAA6C,CAACD,KAAK,CAAC,CAAC,CAClE,CAAC;IACDE,WAAW,EAAEZ,KAAK,CAACY,WAAW;IAC9BC,WAAW,EAAEb,KAAK,CAACa,WAAW;IAC9BC,gBAAgB,EAAEC,sBAAsB,CACtCd,mBAAmB,CAACe,YAAY,EAChCf,mBAAmB,CAACgB,eACtB,CAAC;IACDC,GAAG,EAAElB,KAAK,CAACkB,GAAG;IACdC,MAAM,EAAEnB,KAAK,CAACmB;EAChB,CAAC;AACH;AAEA,SAASR,6CAA6CA,CACpDD,KAAwB,EACO;EAC/B,OAAO;IACLU,YAAY,EAAEV,KAAK,CAACW,QAAQ,CAACnB,IAA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AAC,CACH;MACF,CAAC;IACH;MACE,MAAM,IAAII,KAAK,CACb,sCAAsCC,IAAI,CAACC,SAAS,CAACf,aAAa,CAAC,EACrE,CAAC;EACL;AACF;AAEA,SAASX,sBAAsBA,CAC7BC,YAAoB,EACpBC,eAAuB,EACa;EACpC,MAAMyB,QAAQ,GAAG,CAAC,CAMjB;EAED,KAAK,MAAMjC,GAAG,IAAIO,YAAY,EAAE;IAC9B0B,QAAQ,CAACjC,GAAG,CAAC,GAAG;MAAEkC,OAAO,EAAE,IAAI;MAAEC,QAAQ,EAAE;IAAM,CAAC;EACpD;EAEA,KAAK,MAAMnC,GAAG,IAAIQ,eAAe,EAAE;IACjC,IAAIyB,QAAQ,CAACjC,GAAG,CAAC,EAAE;MACjBiC,QAAQ,CAACjC,GAAG,CAAC,CAACmC,QAAQ,GAAG,IAAI;IAC/B,CAAC,MAAM;MACLF,QAAQ,CAACjC,GAAG,CAAC,GAAG;QAAEkC,OAAO,EAAE,KAAK;QAAEC,QAAQ,EAAE;MAAK,CAAC;IACpD;EACF;EAEA,OAAOF,QAAQ;AACjB","ignoreList":[]}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { wirePropertyV2ToSdkPrimaryKeyTypeDefinition } from "./wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js";
|
|
18
18
|
import { wirePropertyV2ToSdkPropertyDefinition } from "./wirePropertyV2ToSdkPropertyDefinition.js";
|
|
19
|
-
export function wireObjectTypeFullMetadataToSdkObjectMetadata(objectTypeWithLink, v2) {
|
|
19
|
+
export function wireObjectTypeFullMetadataToSdkObjectMetadata(objectTypeWithLink, v2, log) {
|
|
20
20
|
if (objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey] === undefined) {
|
|
21
21
|
throw new Error(`Primary key ${objectTypeWithLink.objectType.primaryKey} not found in ${objectTypeWithLink.objectType.apiName}`);
|
|
22
22
|
}
|
|
@@ -38,7 +38,7 @@ export function wireObjectTypeFullMetadataToSdkObjectMetadata(objectTypeWithLink
|
|
|
38
38
|
targetType: linkType.objectTypeApiName
|
|
39
39
|
}];
|
|
40
40
|
})),
|
|
41
|
-
properties: Object.fromEntries(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key))]).filter(([key, value]) => value != null)),
|
|
41
|
+
properties: Object.fromEntries(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key), log)]).filter(([key, value]) => value != null)),
|
|
42
42
|
implements: objectTypeWithLink.implementsInterfaces,
|
|
43
43
|
interfaceMap,
|
|
44
44
|
inverseInterfaceMap: Object.fromEntries(Object.entries(interfaceMap).map(([interfaceApiName, props]) => [interfaceApiName, invertProps(props)])),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wireObjectTypeFullMetadataToSdkObjectMetadata.js","names":["wirePropertyV2ToSdkPrimaryKeyTypeDefinition","wirePropertyV2ToSdkPropertyDefinition","wireObjectTypeFullMetadataToSdkObjectMetadata","objectTypeWithLink","v2","objectType","properties","primaryKey","undefined","Error","apiName","implementsInterfaces2","implementsInterfaces","interfaceMap","Object","fromEntries","entries","map","interfaceApiName","impl","type","description","primaryKeyApiName","primaryKeyType","links","linkTypes","linkType","multiplicity","cardinality","targetType","objectTypeApiName","key","value","filter","implements","inverseInterfaceMap","props","invertProps","icon","supportedIconTypes","includes","titleProperty","displayName","pluralDisplayName","status","rid","visibility","a","k","v"],"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/
|
|
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","linkType","multiplicity","cardinality","targetType","objectTypeApiName","key","value","filter","implements","inverseInterfaceMap","props","invertProps","icon","supportedIconTypes","includes","titleProperty","displayName","pluralDisplayName","status","rid","visibility","a","k","v"],"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(objectTypeWithLink.linkTypes.map(linkType => {\n return [linkType.apiName, {\n multiplicity: linkType.cardinality === \"MANY\",\n targetType: linkType.objectTypeApiName,\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(([key, value]) => value != null),\n ),\n implements: objectTypeWithLink.implementsInterfaces as string[],\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: objectTypeWithLink.objectType.status,\n rid: objectTypeWithLink.objectType.rid,\n visibility: objectTypeWithLink.objectType.visibility,\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\nconst supportedIconTypes = [\"blueprint\"];\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,CAACC,WAAW,CAClBD,MAA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CAACU,oBAAgC;IAC/DC,YAAY;IACZsB,mBAAmB,EAAErB,MAAM,CAACC,WAAW,CACrCD,MAAM,CAACE,OAAO,CAACH,YAAY,CAAC,CAACI,GAAG,CAAC,CAC/B,CAACC,gBAAgB,EAAEkB,KAAK,CAAC,KACtB,CAAClB,gBAAgB,EAAEmB,WAAW,CAACD,KAAK,CAAC,CAAC,CAC7C,CAAC;IACDE,IAAI,EAAEC,kBAAkB,CAACC,QAAQ,CAACtC,kBAAkB,CAACG,UAAU,CAACiC,IAAI,CAAClB,IAAI,CAAC,GACtElB,kBAAkB,CAACG,UAAU,CAACiC,IAAI,GAClC9B,SAAS;IACbiC,aAAa,EAAEvC,kBAAkB,CAACG,UAAU,CAACoC,aAAa;IAC1DC,WAAW,EAAExC,kBAAkB,CAACG,UAAU,CAACqC,WAAW;IACtDC,iBAAiB,EAAEzC,kBAAkB,CAACG,UAAU,CAACsC,iBAAiB;IAClEC,MAAM,EAAE1C,kBAAkB,CAACG,UAAU,CAACuC,MAAM;IAC5CC,GAAG,EAAE3C,kBAAkB,CAACG,UAAU,CAACwC,GAAG;IACtCC,UAAU,EAAE5C,kBAAkB,CAACG,UAAU,CAACyC;EAC5C,CAAC;AACH;AAEA,SAAST,WAAWA,CAClBU,CAA0B,EACsC;EAChE,OAAQA,CAAC,GACLjC,MAAM,CAACC,WAAW,CAACD,MAAM,CAACE,OAAO,CAAC+B,CAAC,CAAC,CAAC9B,GAAG,CAAC,CAAC,CAAC+B,CAAC,EAAEC,CAAC,CAAC,KAAK,CAACA,CAAC,EAAED,CAAC,CAAC,CAAC,CAAC,GAC7DxC,SAAS;AAEf;AAEA,MAAM+B,kBAAkB,GAAG,CAAC,WAAW,CAAC","ignoreList":[]}
|
|
@@ -43,10 +43,10 @@ export function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {
|
|
|
43
43
|
case "marking":
|
|
44
44
|
case "float":
|
|
45
45
|
case "geotimeSeriesReference":
|
|
46
|
-
case "cipherText":
|
|
47
46
|
case "mediaReference":
|
|
48
47
|
case "struct":
|
|
49
48
|
case "cipherText":
|
|
49
|
+
case "vector":
|
|
50
50
|
throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);
|
|
51
51
|
default:
|
|
52
52
|
input.dataType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js","names":["wirePropertyV2ToSdkPrimaryKeyTypeDefinition","input","dataType","type","Error"],"sources":["wirePropertyV2ToSdkPrimaryKeyTypeDefinition.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 { PrimaryKeyTypes } from \"@osdk/api\";\nimport type { PropertyV2 } from \"@osdk/
|
|
1
|
+
{"version":3,"file":"wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js","names":["wirePropertyV2ToSdkPrimaryKeyTypeDefinition","input","dataType","type","Error"],"sources":["wirePropertyV2ToSdkPrimaryKeyTypeDefinition.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 { PrimaryKeyTypes } from \"@osdk/api\";\nimport type { PropertyV2 } from \"@osdk/foundry.ontologies\";\n\nexport function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(\n input: PropertyV2,\n): PrimaryKeyTypes {\n switch (input.dataType.type) {\n case \"integer\":\n case \"double\":\n case \"string\":\n case \"boolean\":\n case \"byte\":\n case \"long\":\n case \"short\": {\n return input.dataType.type;\n }\n case \"date\": {\n return \"datetime\";\n }\n case \"timestamp\": {\n return \"timestamp\";\n }\n case \"geopoint\":\n case \"geoshape\":\n case \"decimal\":\n case \"attachment\":\n case \"timeseries\":\n case \"array\":\n case \"marking\":\n case \"float\":\n case \"geotimeSeriesReference\":\n case \"mediaReference\":\n case \"struct\":\n case \"cipherText\":\n case \"vector\":\n throw new Error(\n `Type not supported for primaryKey: ${input.dataType.type}`,\n );\n default:\n const _: never = input.dataType;\n throw new Error(\n `Unknown type encountered for primaryKey: ${input.dataType}`,\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,OAAO,SAASA,2CAA2CA,CACzDC,KAAiB,EACA;EACjB,QAAQA,KAAK,CAACC,QAAQ,CAACC,IAAI;IACzB,KAAK,SAAS;IACd,KAAK,QAAQ;IACb,KAAK,QAAQ;IACb,KAAK,SAAS;IACd,KAAK,MAAM;IACX,KAAK,MAAM;IACX,KAAK,OAAO;MAAE;QACZ,OAAOF,KAAK,CAACC,QAAQ,CAACC,IAAI;MAC5B;IACA,KAAK,MAAM;MAAE;QACX,OAAO,UAAU;MACnB;IACA,KAAK,WAAW;MAAE;QAChB,OAAO,WAAW;MACpB;IACA,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,SAAS;IACd,KAAK,YAAY;IACjB,KAAK,YAAY;IACjB,KAAK,OAAO;IACZ,KAAK,SAAS;IACd,KAAK,OAAO;IACZ,KAAK,wBAAwB;IAC7B,KAAK,gBAAgB;IACrB,KAAK,QAAQ;IACb,KAAK,YAAY;IACjB,KAAK,QAAQ;MACX,MAAM,IAAIC,KAAK,CACb,sCAAsCH,KAAK,CAACC,QAAQ,CAACC,IAAI,EAC3D,CAAC;IACH;MACmBF,KAAK,CAACC,QAAQ;MAC/B,MAAM,IAAIE,KAAK,CACb,4CAA4CH,KAAK,CAACC,QAAQ,EAC5D,CAAC;EACL;AACF","ignoreList":[]}
|
|
@@ -14,9 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const sdkPropDefinition = objectPropertyTypeToSdkPropertyDefinition(input.dataType);
|
|
17
|
+
export function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true, log) {
|
|
18
|
+
const sdkPropDefinition = objectPropertyTypeToSdkPropertyDefinition(input.dataType, log);
|
|
20
19
|
if (sdkPropDefinition == null) {
|
|
21
20
|
return undefined;
|
|
22
21
|
}
|
|
@@ -24,7 +23,6 @@ export function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true)
|
|
|
24
23
|
case "integer":
|
|
25
24
|
case "string":
|
|
26
25
|
case "byte":
|
|
27
|
-
case "cipherText":
|
|
28
26
|
case "decimal":
|
|
29
27
|
case "double":
|
|
30
28
|
case "float":
|
|
@@ -59,17 +57,18 @@ export function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true)
|
|
|
59
57
|
};
|
|
60
58
|
}
|
|
61
59
|
case "cipherText":
|
|
60
|
+
case "vector":
|
|
62
61
|
{
|
|
63
|
-
|
|
62
|
+
log?.info(`${JSON.stringify(input.dataType.type)} is not a supported dataType`);
|
|
64
63
|
return undefined;
|
|
65
64
|
}
|
|
66
65
|
default:
|
|
67
66
|
input.dataType;
|
|
68
|
-
|
|
67
|
+
log?.info(`${JSON.stringify(input.dataType)} is not a supported dataType`);
|
|
69
68
|
return undefined;
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
|
-
function objectPropertyTypeToSdkPropertyDefinition(propertyType) {
|
|
71
|
+
function objectPropertyTypeToSdkPropertyDefinition(propertyType, log) {
|
|
73
72
|
switch (propertyType.type) {
|
|
74
73
|
case "integer":
|
|
75
74
|
case "string":
|
|
@@ -106,13 +105,14 @@ function objectPropertyTypeToSdkPropertyDefinition(propertyType) {
|
|
|
106
105
|
}, {});
|
|
107
106
|
}
|
|
108
107
|
case "cipherText":
|
|
108
|
+
case "vector":
|
|
109
109
|
{
|
|
110
|
-
|
|
110
|
+
log?.info(`${JSON.stringify(propertyType.type)} is not a supported propertyType`);
|
|
111
111
|
return undefined;
|
|
112
112
|
}
|
|
113
113
|
default:
|
|
114
114
|
{
|
|
115
|
-
|
|
115
|
+
log?.info(`${JSON.stringify(propertyType)} is not a supported propertyType`);
|
|
116
116
|
return undefined;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wirePropertyV2ToSdkPropertyDefinition.js","names":["
|
|
1
|
+
{"version":3,"file":"wirePropertyV2ToSdkPropertyDefinition.js","names":["wirePropertyV2ToSdkPropertyDefinition","input","isNullable","log","sdkPropDefinition","objectPropertyTypeToSdkPropertyDefinition","dataType","undefined","type","displayName","multiplicity","description","nullable","info","JSON","stringify","propertyType","subType","itemType","structFieldTypes","reduce","structMap","structField","apiName"],"sources":["wirePropertyV2ToSdkPropertyDefinition.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 {\n BaseWirePropertyTypes,\n ObjectMetadata,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport type {\n ObjectPropertyType,\n PropertyV2,\n SharedPropertyType,\n} from \"@osdk/foundry.ontologies\";\n\nexport function wirePropertyV2ToSdkPropertyDefinition(\n input: (PropertyV2 | SharedPropertyType) & { nullable?: boolean },\n isNullable: boolean = true,\n log?: { info: (msg: string) => void },\n): ObjectMetadata.Property | undefined {\n const sdkPropDefinition = objectPropertyTypeToSdkPropertyDefinition(\n input.dataType,\n log,\n );\n if (sdkPropDefinition == null) {\n return undefined;\n }\n switch (input.dataType.type) {\n case \"integer\":\n case \"string\":\n case \"byte\":\n case \"decimal\":\n case \"double\":\n case \"float\":\n case \"long\":\n case \"short\":\n case \"boolean\":\n case \"date\":\n case \"attachment\":\n case \"mediaReference\":\n case \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n case \"timeseries\":\n case \"marking\":\n case \"geotimeSeriesReference\":\n case \"struct\":\n return {\n displayName: input.displayName,\n multiplicity: false,\n description: input.description,\n type: sdkPropDefinition,\n nullable: input.nullable == null ? isNullable : input.nullable,\n };\n case \"array\": {\n return {\n displayName: input.displayName,\n multiplicity: true,\n description: input.description,\n type: sdkPropDefinition,\n nullable: true,\n };\n }\n case \"cipherText\":\n case \"vector\": {\n log?.info(\n `${JSON.stringify(input.dataType.type)} is not a supported dataType`,\n );\n\n return undefined;\n }\n default:\n const _: never = input.dataType;\n log?.info(\n `${JSON.stringify(input.dataType)} is not a supported dataType`,\n );\n\n return undefined;\n }\n}\n\nfunction objectPropertyTypeToSdkPropertyDefinition(\n propertyType: ObjectPropertyType,\n log?: { info: (msg: string) => void },\n): WirePropertyTypes | undefined {\n switch (propertyType.type) {\n case \"integer\":\n case \"string\":\n case \"byte\":\n case \"decimal\":\n case \"double\":\n case \"float\":\n case \"long\":\n case \"short\":\n case \"boolean\":\n case \"attachment\":\n case \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n case \"marking\":\n case \"geotimeSeriesReference\":\n case \"mediaReference\":\n return propertyType.type;\n case \"date\":\n return \"datetime\";\n case \"array\":\n return objectPropertyTypeToSdkPropertyDefinition(propertyType.subType);\n case \"timeseries\":\n if (propertyType.itemType?.type === \"string\") {\n return \"stringTimeseries\";\n } else if (propertyType.itemType?.type === \"double\") {\n return \"numericTimeseries\";\n } else return \"sensorTimeseries\";\n case \"struct\": {\n return propertyType.structFieldTypes.reduce(\n (structMap: Record<string, BaseWirePropertyTypes>, structField) => {\n structMap[structField.apiName] =\n objectPropertyTypeToSdkPropertyDefinition(\n structField.dataType,\n ) as BaseWirePropertyTypes;\n return structMap;\n },\n {},\n );\n }\n case \"cipherText\":\n case \"vector\": {\n log?.info(\n `${JSON.stringify(propertyType.type)} is not a supported propertyType`,\n );\n\n return undefined;\n }\n default: {\n const _: never = propertyType;\n log?.info(\n `${JSON.stringify(propertyType)} is not a supported propertyType`,\n );\n\n return undefined;\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,OAAO,SAASA,qCAAqCA,CACnDC,KAAiE,EACjEC,UAAmB,GAAG,IAAI,EAC1BC,GAAqC,EACA;EACrC,MAAMC,iBAAiB,GAAGC,yCAAyC,CACjEJ,KAAK,CAACK,QAAQ,EACdH,GACF,CAAC;EACD,IAAIC,iBAAiB,IAAI,IAAI,EAAE;IAC7B,OAAOG,SAAS;EAClB;EACA,QAAQN,KAAK,CAACK,QAAQ,CAACE,IAAI;IACzB,KAAK,SAAS;IACd,KAAK,QAAQ;IACb,KAAK,MAAM;IACX,KAAK,SAAS;IACd,KAAK,QAAQ;IACb,KAAK,OAAO;IACZ,KAAK,MAAM;IACX,KAAK,OAAO;IACZ,KAAK,SAAS;IACd,KAAK,MAAM;IACX,KAAK,YAAY;IACjB,KAAK,gBAAgB;IACrB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,WAAW;IAChB,KAAK,YAAY;IACjB,KAAK,SAAS;IACd,KAAK,wBAAwB;IAC7B,KAAK,QAAQ;MACX,OAAO;QACLC,WAAW,EAAER,K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yCAAyC,CAACW,YAAY,CAACC,OAAO,CAAC;IACxE,KAAK,YAAY;MACf,IAAID,YAAY,CAACE,QAAQ,EAAEV,IAAI,KAAK,QAAQ,EAAE;QAC5C,OAAO,kBAAkB;MAC3B,CAAC,MAAM,IAAIQ,YAAY,CAACE,QAAQ,EAAEV,IAAI,KAAK,QAAQ,EAAE;QACnD,OAAO,mBAAmB;MAC5B,CAAC,MAAM,OAAO,kBAAkB;IAClC,KAAK,QAAQ;MAAE;QACb,OAAOQ,YAAY,CAACG,gBAAgB,CAACC,MAAM,CACzC,CAACC,SAAgD,EAAEC,WAAW,KAAK;UACjED,SAAS,CAACC,WAAW,CAACC,OAAO,CAAC,GAC5BlB,yCAAyC,CACvCiB,WAAW,CAAChB,QACd,CAA0B;UAC5B,OAAOe,SAAS;QAClB,CAAC,EACD,CAAC,CACH,CAAC;MACH;IACA,KAAK,YAAY;IACjB,KAAK,QAAQ;MAAE;QACblB,GAAG,EAAEU,IAAI,CACP,GAAGC,IAAI,CAACC,SAAS,CAACC,YAAY,CAACR,IAAI,CAAC,kCACtC,CAAC;QAED,OAAOD,SAAS;MAClB;IACA;MAAS;QAEPJ,GAAG,EAAEU,IAAI,CACP,GAAGC,IAAI,CAACC,SAAS,CAACC,YAAY,CAAC,kCACjC,CAAC;QAED,OAAOT,SAAS;MAClB;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wireQueryDataTypeToQueryDataTypeDefinition.js","names":["isNullableQueryDataType","wireQueryDataTypeToQueryDataTypeDefinition","input","type","nullable","object","objectTypeApiName","objectSet","subType","multiplicity","set","allowNulls","unionTypes","length","nonNull","find","t","union","reduce","acc","push","struct","Object","fromEntries","fields","map","f","name","fieldType","twoDimensionalAggregation","get2DQueryAggregationProps","threeDimensionalAggregation","get3DQueryAggregationProps","Error","keyType","keySubtype","valueType","guardInvalidKeyTypes","key"],"sources":["wireQueryDataTypeToQueryDataTypeDefinition.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 {\n QueryDataTypeDefinition,\n ThreeDimensionalQueryAggregationDefinition,\n TwoDimensionalQueryAggregationDefinition,\n} from \"@osdk/api\";\nimport type {\n QueryAggregationKeyType,\n QueryDataType,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n} from \"@osdk/
|
|
1
|
+
{"version":3,"file":"wireQueryDataTypeToQueryDataTypeDefinition.js","names":["isNullableQueryDataType","wireQueryDataTypeToQueryDataTypeDefinition","input","type","nullable","object","objectTypeApiName","objectSet","subType","multiplicity","set","allowNulls","unionTypes","length","nonNull","find","t","union","reduce","acc","push","struct","Object","fromEntries","fields","map","f","name","fieldType","twoDimensionalAggregation","get2DQueryAggregationProps","threeDimensionalAggregation","get3DQueryAggregationProps","Error","keyType","keySubtype","valueType","guardInvalidKeyTypes","key"],"sources":["wireQueryDataTypeToQueryDataTypeDefinition.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 {\n QueryDataTypeDefinition,\n ThreeDimensionalQueryAggregationDefinition,\n TwoDimensionalQueryAggregationDefinition,\n} from \"@osdk/api\";\nimport type {\n QueryAggregationKeyType,\n QueryDataType,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n} from \"@osdk/foundry.ontologies\";\nimport { isNullableQueryDataType } from \"./isNullableQueryDataType.js\";\n\nexport function wireQueryDataTypeToQueryDataTypeDefinition<\n K extends string,\n>(\n input: QueryDataType,\n): QueryDataTypeDefinition {\n switch (input.type) {\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"attachment\":\n case \"boolean\":\n case \"date\":\n case \"string\":\n case \"timestamp\":\n return {\n type: input.type,\n nullable: false,\n };\n\n case \"object\":\n return {\n type: \"object\",\n object: input.objectTypeApiName as K,\n nullable: false,\n };\n\n case \"objectSet\":\n return {\n type: \"objectSet\",\n objectSet: input.objectTypeApiName as K,\n nullable: false,\n };\n\n case \"array\":\n return {\n ...wireQueryDataTypeToQueryDataTypeDefinition(input.subType),\n multiplicity: true,\n };\n\n case \"set\":\n return {\n type: \"set\",\n set: wireQueryDataTypeToQueryDataTypeDefinition(input.subType),\n nullable: false,\n };\n\n case \"union\":\n const allowNulls = isNullableQueryDataType(input);\n\n // special case for a union where one half is nullable to skip the union step and just allow nulls directly\n if (allowNulls && input.unionTypes.length === 2) {\n const nonNull = input.unionTypes.find(t => t.type != null);\n if (nonNull) {\n return {\n ...wireQueryDataTypeToQueryDataTypeDefinition(nonNull),\n nullable: true,\n };\n }\n }\n\n return {\n type: \"union\",\n union: input.unionTypes.reduce<QueryDataTypeDefinition[]>((acc, t) => {\n if (t.type === \"null\") {\n return acc;\n }\n acc.push(wireQueryDataTypeToQueryDataTypeDefinition(t));\n return acc;\n }, []),\n nullable: allowNulls,\n };\n\n case \"struct\":\n return {\n type: \"struct\",\n struct: Object.fromEntries(input.fields.map(f => [\n f.name,\n wireQueryDataTypeToQueryDataTypeDefinition(f.fieldType),\n ])),\n nullable: false,\n };\n\n case \"twoDimensionalAggregation\":\n return {\n type: \"twoDimensionalAggregation\",\n twoDimensionalAggregation: get2DQueryAggregationProps(input),\n nullable: false,\n };\n\n case \"threeDimensionalAggregation\":\n return {\n type: \"threeDimensionalAggregation\",\n threeDimensionalAggregation: get3DQueryAggregationProps(input),\n nullable: false,\n };\n\n case \"null\":\n case \"unsupported\":\n throw new Error(\n `Unable to process query because the server indicated an unsupported QueryDataType.type: ${input.type}. Please check that your query is using supported types.`,\n );\n\n default:\n const _: never = input;\n throw new Error(`Unsupported QueryDataType.type ${(input as any).type}`);\n }\n}\n\nfunction get2DQueryAggregationProps(\n input: TwoDimensionalAggregation,\n): TwoDimensionalQueryAggregationDefinition {\n if (input.keyType.type === \"range\") {\n return {\n keyType: input.keyType.type,\n keySubtype: input.keyType.subType.type,\n valueType: input.valueType.type,\n };\n } else {\n if (guardInvalidKeyTypes(input.keyType)) {\n return {\n keyType: input.keyType.type,\n valueType: input.valueType.type,\n };\n }\n throw new Error(\n `Cannot create 2D aggregation with ${input.keyType.type} as its type`,\n );\n }\n}\n\nfunction get3DQueryAggregationProps(\n input: ThreeDimensionalAggregation,\n): ThreeDimensionalQueryAggregationDefinition {\n if (input.keyType.type === \"range\") {\n return {\n keyType: input.keyType.type,\n keySubtype: input.keyType.subType.type,\n valueType: get2DQueryAggregationProps(input.valueType),\n };\n } else {\n if (guardInvalidKeyTypes(input.keyType)) {\n return {\n keyType: input.keyType.type,\n valueType: get2DQueryAggregationProps(input.valueType),\n };\n }\n throw new Error(\n `Cannot create 3D aggregation with ${input.keyType.type} as its type`,\n );\n }\n}\n\n/**\n * Guard against aggregation key types that are allowed by the backend types but are illegal to actually use\n */\nfunction guardInvalidKeyTypes(\n key: QueryAggregationKeyType,\n): key is QueryAggregationKeyType & ({ type: \"string\" | \"boolean\" }) {\n return key.type === \"string\" || key.type === \"boolean\";\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,SAASA,uBAAuB,QAAQ,8BAA8B;AAEtE,OAAO,SAASC,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ACxD","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wireQueryTypeV2ToSdkQueryMetadata.js","names":["wireQueryDataTypeToQueryDataTypeDefinition","wireQueryTypeV2ToSdkQueryMetadata","input","type","apiName","description","displayName","version","parameters","Object","fromEntries","entries","map","name","parameter","wireQueryParameterV2ToQueryParameterDefinition","output","rid","wireQueryTypeV2ToSdkQueryDefinitionNoParams","dataType"],"sources":["wireQueryTypeV2ToSdkQueryMetadata.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 { QueryMetadata, QueryParameterDefinition } from \"@osdk/api\";\nimport type {
|
|
1
|
+
{"version":3,"file":"wireQueryTypeV2ToSdkQueryMetadata.js","names":["wireQueryDataTypeToQueryDataTypeDefinition","wireQueryTypeV2ToSdkQueryMetadata","input","type","apiName","description","displayName","version","parameters","Object","fromEntries","entries","map","name","parameter","wireQueryParameterV2ToQueryParameterDefinition","output","rid","wireQueryTypeV2ToSdkQueryDefinitionNoParams","dataType"],"sources":["wireQueryTypeV2ToSdkQueryMetadata.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 { QueryMetadata, QueryParameterDefinition } from \"@osdk/api\";\nimport type { QueryParameterV2, QueryTypeV2 } from \"@osdk/foundry.ontologies\";\nimport {\n wireQueryDataTypeToQueryDataTypeDefinition,\n} from \"./wireQueryDataTypeToQueryDataTypeDefinition.js\";\n\nexport function wireQueryTypeV2ToSdkQueryMetadata(\n input: QueryTypeV2,\n): QueryMetadata {\n return {\n type: \"query\",\n apiName: input.apiName,\n description: input.description,\n displayName: input.displayName,\n version: input.version,\n parameters: Object.fromEntries(\n Object.entries(input.parameters).map((\n [name, parameter],\n ) => [name, wireQueryParameterV2ToQueryParameterDefinition(parameter)]),\n ),\n output: wireQueryDataTypeToQueryDataTypeDefinition(input.output),\n rid: input.rid,\n };\n}\n\nexport function wireQueryTypeV2ToSdkQueryDefinitionNoParams(\n input: QueryTypeV2,\n): {\n type: string;\n apiName: string;\n description: string | undefined;\n displayName: string | undefined;\n version: string;\n rid: string;\n} {\n return {\n type: \"query\",\n apiName: input.apiName,\n description: input.description,\n displayName: input.displayName,\n version: input.version,\n rid: input.rid,\n };\n}\n\nexport function wireQueryParameterV2ToQueryParameterDefinition(\n parameter: QueryParameterV2,\n): QueryParameterDefinition<any> {\n return {\n description: parameter.description,\n ...wireQueryDataTypeToQueryDataTypeDefinition(parameter.dataType),\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SACEA,0CAA0C,QACrC,iDAAiD;AAExD,OAAO,SAASC,iCAAiCA,CAC/CC,KAAkB,EACH;EACf,OAAO;IACLC,IAAI,EAAE,OAAO;IACbC,OAAO,EAAEF,KAAK,CAACE,OAAO;IACtBC,WAAW,EAAEH,KAAK,CAACG,WAAW;IAC9BC,WAAW,EAAEJ,KAAK,CAACI,WAAW;IAC9BC,OAAO,EAAEL,KAAK,CAACK,OAAO;IACtBC,UAAU,EAAEC,MAAM,CAACC,WAAW,CAC5BD,MAAM,CAACE,OAAO,CAACT,KAAK,CAACM,UAAU,CAAC,CAACI,GAAG,CAAC,CACnC,CAACC,IAAI,EAAEC,SAAS,CAAC,KACd,CAACD,IAAI,EAAEE,8CAA8C,CAACD,SAAS,CAAC,CAAC,CACxE,CAAC;IACDE,MAAM,EAAEhB,0CAA0C,CAACE,KAAK,CAACc,MAAM,CAAC;IAChEC,GAAG,EAAEf,KAAK,CAACe;EACb,CAAC;AACH;AAEA,OAAO,SAASC,2CAA2CA,CACzDhB,KAAkB,EAQlB;EACA,OAAO;IACLC,IAAI,EAAE,OAAO;IACbC,OAAO,EAAEF,KAAK,CAACE,OAAO;IACtBC,WAAW,EAAEH,KAAK,CAACG,WAAW;IAC9BC,WAAW,EAAEJ,KAAK,CAACI,WAAW;IAC9BC,OAAO,EAAEL,KAAK,CAACK,OAAO;IACtBU,GAAG,EAAEf,KAAK,CAACe;EACb,CAAC;AACH;AAEA,OAAO,SAASF,8CAA8CA,CAC5DD,SAA2B,EACI;EAC/B,OAAO;IACLT,WAAW,EAAES,SAAS,CAACT,WAAW;IAClC,GAAGL,0CAA0C,CAACc,SAAS,CAACK,QAAQ;EAClE,CAAC;AACH","ignoreList":[]}
|
package/build/cjs/index.cjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var consola = require('consola');
|
|
4
|
-
|
|
5
3
|
// src/wirePropertyV2ToSdkPropertyDefinition.ts
|
|
6
|
-
function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true) {
|
|
7
|
-
const sdkPropDefinition = objectPropertyTypeToSdkPropertyDefinition(input.dataType);
|
|
4
|
+
function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true, log) {
|
|
5
|
+
const sdkPropDefinition = objectPropertyTypeToSdkPropertyDefinition(input.dataType, log);
|
|
8
6
|
if (sdkPropDefinition == null) {
|
|
9
7
|
return undefined;
|
|
10
8
|
}
|
|
@@ -12,7 +10,6 @@ function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true) {
|
|
|
12
10
|
case "integer":
|
|
13
11
|
case "string":
|
|
14
12
|
case "byte":
|
|
15
|
-
case "cipherText":
|
|
16
13
|
case "decimal":
|
|
17
14
|
case "double":
|
|
18
15
|
case "float":
|
|
@@ -45,17 +42,18 @@ function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true) {
|
|
|
45
42
|
nullable: true
|
|
46
43
|
};
|
|
47
44
|
}
|
|
48
|
-
case "cipherText":
|
|
49
|
-
|
|
45
|
+
case "cipherText":
|
|
46
|
+
case "vector": {
|
|
47
|
+
log?.info(`${JSON.stringify(input.dataType.type)} is not a supported dataType`);
|
|
50
48
|
return undefined;
|
|
51
49
|
}
|
|
52
50
|
default:
|
|
53
51
|
input.dataType;
|
|
54
|
-
|
|
52
|
+
log?.info(`${JSON.stringify(input.dataType)} is not a supported dataType`);
|
|
55
53
|
return undefined;
|
|
56
54
|
}
|
|
57
55
|
}
|
|
58
|
-
function objectPropertyTypeToSdkPropertyDefinition(propertyType) {
|
|
56
|
+
function objectPropertyTypeToSdkPropertyDefinition(propertyType, log) {
|
|
59
57
|
switch (propertyType.type) {
|
|
60
58
|
case "integer":
|
|
61
59
|
case "string":
|
|
@@ -90,19 +88,20 @@ function objectPropertyTypeToSdkPropertyDefinition(propertyType) {
|
|
|
90
88
|
return structMap;
|
|
91
89
|
}, {});
|
|
92
90
|
}
|
|
93
|
-
case "cipherText":
|
|
94
|
-
|
|
91
|
+
case "cipherText":
|
|
92
|
+
case "vector": {
|
|
93
|
+
log?.info(`${JSON.stringify(propertyType.type)} is not a supported propertyType`);
|
|
95
94
|
return undefined;
|
|
96
95
|
}
|
|
97
96
|
default: {
|
|
98
|
-
|
|
97
|
+
log?.info(`${JSON.stringify(propertyType)} is not a supported propertyType`);
|
|
99
98
|
return undefined;
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
101
|
}
|
|
103
102
|
|
|
104
103
|
// src/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.ts
|
|
105
|
-
function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType, v2) {
|
|
104
|
+
function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType, v2, log) {
|
|
106
105
|
return {
|
|
107
106
|
type: "interface",
|
|
108
107
|
rid: interfaceType.rid,
|
|
@@ -111,7 +110,7 @@ function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType, v2)
|
|
|
111
110
|
description: interfaceType.description,
|
|
112
111
|
implements: interfaceType.extendsInterfaces,
|
|
113
112
|
properties: Object.fromEntries(Object.entries(interfaceType.properties).map(([key, value]) => {
|
|
114
|
-
return [key, wirePropertyV2ToSdkPropertyDefinition(value, true)];
|
|
113
|
+
return [key, wirePropertyV2ToSdkPropertyDefinition(value, true, log)];
|
|
115
114
|
}).filter(([key, value]) => value != null)),
|
|
116
115
|
links: {},
|
|
117
116
|
implementedBy: interfaceType.implementedByObjectTypes
|
|
@@ -252,10 +251,10 @@ function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {
|
|
|
252
251
|
case "marking":
|
|
253
252
|
case "float":
|
|
254
253
|
case "geotimeSeriesReference":
|
|
255
|
-
case "cipherText":
|
|
256
254
|
case "mediaReference":
|
|
257
255
|
case "struct":
|
|
258
256
|
case "cipherText":
|
|
257
|
+
case "vector":
|
|
259
258
|
throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);
|
|
260
259
|
default:
|
|
261
260
|
input.dataType;
|
|
@@ -264,7 +263,7 @@ function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {
|
|
|
264
263
|
}
|
|
265
264
|
|
|
266
265
|
// src/wireObjectTypeFullMetadataToSdkObjectMetadata.ts
|
|
267
|
-
function wireObjectTypeFullMetadataToSdkObjectMetadata(objectTypeWithLink, v2) {
|
|
266
|
+
function wireObjectTypeFullMetadataToSdkObjectMetadata(objectTypeWithLink, v2, log) {
|
|
268
267
|
if (objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey] === undefined) {
|
|
269
268
|
throw new Error(`Primary key ${objectTypeWithLink.objectType.primaryKey} not found in ${objectTypeWithLink.objectType.apiName}`);
|
|
270
269
|
}
|
|
@@ -284,7 +283,7 @@ function wireObjectTypeFullMetadataToSdkObjectMetadata(objectTypeWithLink, v2) {
|
|
|
284
283
|
targetType: linkType.objectTypeApiName
|
|
285
284
|
}];
|
|
286
285
|
})),
|
|
287
|
-
properties: Object.fromEntries(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key))]).filter(([key, value]) => value != null)),
|
|
286
|
+
properties: Object.fromEntries(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key), log)]).filter(([key, value]) => value != null)),
|
|
288
287
|
implements: objectTypeWithLink.implementsInterfaces,
|
|
289
288
|
interfaceMap,
|
|
290
289
|
inverseInterfaceMap: Object.fromEntries(Object.entries(interfaceMap).map(([interfaceApiName, props]) => [interfaceApiName, invertProps(props)])),
|