@osdk/maker-import 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/maker-import.mjs +6 -0
- package/build/browser/cli/main.js +47 -0
- package/build/browser/cli/main.js.map +1 -0
- package/build/browser/generate/convertActionType.js +63 -0
- package/build/browser/generate/convertActionType.js.map +1 -0
- package/build/browser/generate/convertInterfaceType.js +74 -0
- package/build/browser/generate/convertInterfaceType.js.map +1 -0
- package/build/browser/generate/convertObjectType.js +64 -0
- package/build/browser/generate/convertObjectType.js.map +1 -0
- package/build/browser/generate/convertSharedPropertyType.js +37 -0
- package/build/browser/generate/convertSharedPropertyType.js.map +1 -0
- package/build/browser/generate/mapActionParameterType.js +211 -0
- package/build/browser/generate/mapActionParameterType.js.map +1 -0
- package/build/browser/generate/mapPropertyType.js +117 -0
- package/build/browser/generate/mapPropertyType.js.map +1 -0
- package/build/browser/generate/utils.js +52 -0
- package/build/browser/generate/utils.js.map +1 -0
- package/build/browser/generate/writeImportedOntology.js +169 -0
- package/build/browser/generate/writeImportedOntology.js.map +1 -0
- package/build/browser/index.js +19 -0
- package/build/browser/index.js.map +1 -0
- package/build/cjs/index.cjs +601 -0
- package/build/cjs/index.cjs.map +1 -0
- package/build/cjs/index.d.cts +88 -0
- package/build/esm/cli/main.js +47 -0
- package/build/esm/cli/main.js.map +1 -0
- package/build/esm/generate/convertActionType.js +63 -0
- package/build/esm/generate/convertActionType.js.map +1 -0
- package/build/esm/generate/convertInterfaceType.js +74 -0
- package/build/esm/generate/convertInterfaceType.js.map +1 -0
- package/build/esm/generate/convertObjectType.js +64 -0
- package/build/esm/generate/convertObjectType.js.map +1 -0
- package/build/esm/generate/convertSharedPropertyType.js +37 -0
- package/build/esm/generate/convertSharedPropertyType.js.map +1 -0
- package/build/esm/generate/mapActionParameterType.js +211 -0
- package/build/esm/generate/mapActionParameterType.js.map +1 -0
- package/build/esm/generate/mapPropertyType.js +117 -0
- package/build/esm/generate/mapPropertyType.js.map +1 -0
- package/build/esm/generate/utils.js +52 -0
- package/build/esm/generate/utils.js.map +1 -0
- package/build/esm/generate/writeImportedOntology.js +169 -0
- package/build/esm/generate/writeImportedOntology.js.map +1 -0
- package/build/esm/index.js +19 -0
- package/build/esm/index.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/generate/mapActionParameterType.ts","../../src/generate/utils.ts","../../src/generate/convertActionType.ts","../../src/generate/mapPropertyType.ts","../../src/generate/convertSharedPropertyType.ts","../../src/generate/convertInterfaceType.ts","../../src/generate/convertObjectType.ts","../../src/generate/writeImportedOntology.ts","../../src/cli/main.ts"],"names":["consola","OntologyEntityTypeEnum","path","fs","yargs","hideBin","path2","fs2"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAM,kBAAA,GAAqB;AAAA,EACzB,MAAA,EAAQ,QAAA;AAAA,EACR,OAAA,EAAS,SAAA;AAAA,EACT,OAAA,EAAS,SAAA;AAAA,EACT,MAAA,EAAQ,QAAA;AAAA,EACR,IAAA,EAAM,MAAA;AAAA,EACN,IAAA,EAAM,MAAA;AAAA,EACN,SAAA,EAAW,WAAA;AAAA,EACX,UAAA,EAAY,YAAA;AAAA,EACZ,OAAA,EAAS,SAAA;AAAA,EACT,OAAA,EAAS,SAAA;AAAA,EACT,QAAA,EAAU,UAAA;AAAA,EACV,cAAA,EAAgB,gBAAA;AAAA,EAChB,OAAA,EAAS;AACX,CAAA;AACA,IAAM,gBAAA,GAAmB;AAAA,EACvB,MAAA,EAAQ,YAAA;AAAA,EACR,OAAA,EAAS,aAAA;AAAA,EACT,OAAA,EAAS,aAAA;AAAA,EACT,MAAA,EAAQ,YAAA;AAAA,EACR,IAAA,EAAM,UAAA;AAAA,EACN,IAAA,EAAM,UAAA;AAAA,EACN,SAAA,EAAW,eAAA;AAAA,EACX,UAAA,EAAY,gBAAA;AAAA,EACZ,OAA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A,EAAW;AACd,EAAAN,eAAAA,CAAQ,IAAA,CAAK,CAAA,kCAAA,EAAqC,eAAA,CAAgB,KAAK,CAAA,CAAE,CAAA;AACzE,EAAA,MAAM,WAAA,GAAc,MAASO,cAAA,CAAA,QAAA,CAAS,eAAA,CAAgB,OAAO,OAAO,CAAA;AACpE,EAAA,MAAM,QAAA,GAAW,IAAA,CAAK,KAAA,CAAM,WAAW,CAAA;AACvC,EAAAP,eAAAA,CAAQ,IAAA,CAAK,CAAA,6BAAA,EAAgC,eAAA,CAAgB,MAAM,CAAA,CAAE,CAAA;AACrE,EAAA,qBAAA,CAAsB,QAAA,EAAU,gBAAgB,MAAM,CAAA;AACtD,EAAAA,eAAAA,CAAQ,OAAA,CAAQ,CAAA,0BAAA,EAA6B,eAAA,CAAgB,MAAM,CAAA,CAAE,CAAA;AACvE","file":"index.cjs","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 { consola } from \"consola\";\n\n// ActionParameterType from maker is not exported, so we use structural typing.\n// The generated JSON will have the correct shape at runtime.\n\nconst SIMPLE_PARAM_TYPES = {\n string: \"string\",\n integer: \"integer\",\n boolean: \"boolean\",\n double: \"double\",\n long: \"long\",\n date: \"date\",\n timestamp: \"timestamp\",\n attachment: \"attachment\",\n marking: \"marking\",\n geohash: \"geohash\",\n geoshape: \"geoshape\",\n mediaReference: \"mediaReference\",\n decimal: \"decimal\"\n};\nconst LIST_VARIANT_MAP = {\n string: \"stringList\",\n integer: \"integerList\",\n boolean: \"booleanList\",\n double: \"doubleList\",\n long: \"longList\",\n date: \"dateList\",\n timestamp: \"timestampList\",\n attachment: \"attachmentList\",\n marking: \"markingList\",\n geohash: \"geohashList\",\n geoshape: \"geoshapeList\",\n mediaReference: \"mediaReferenceList\",\n decimal: \"decimalList\"\n};\n\n// Maps gateway struct field types to OntologyIrStructFieldBaseParameterType format\nconst STRUCT_FIELD_IR_TYPES = {\n boolean: \"boolean\",\n integer: \"integer\",\n long: \"long\",\n double: \"double\",\n string: \"string\",\n geohash: \"geohash\",\n geoshape: \"geoshape\",\n timestamp: \"timestamp\",\n date: \"date\"\n};\n\n/**\n * Converts gateway struct field types to the IR structFieldTypes record.\n * Returns undefined if structFieldTypes is missing.\n */\nfunction mapGatewayStructFieldsToIr(dataType) {\n const fields = dataType.structFieldTypes;\n if (!fields) {\n consola.warn(\"Struct parameter type missing structFieldTypes, skipping\");\n return undefined;\n }\n const structFieldTypes = {};\n for (const field of fields) {\n const fieldType = field.dataType.type;\n const irType = STRUCT_FIELD_IR_TYPES[fieldType];\n if (irType) {\n structFieldTypes[field.apiName] = {\n type: irType,\n [irType]: {}\n };\n } else if (fieldType === \"object\") {\n const objectTypeApiName = field.dataType.objectTypeApiName ?? \"\";\n structFieldTypes[field.apiName] = {\n type: \"objectReference\",\n objectReference: {\n objectTypeId: objectTypeApiName\n }\n };\n } else {\n consola.warn(`Skipping struct param field \"${field.apiName}\": unsupported type \"${fieldType}\"`);\n }\n }\n return structFieldTypes;\n}\n\n/**\n * Maps a gateway ActionParameterType (discriminated union from OntologyFullMetadata)\n * to a maker ActionParameterType (string primitives or complex objects).\n *\n * Returns undefined for unsupported types (with a warning).\n */\nexport function mapActionParameterType(dataType) {\n const simpleType = SIMPLE_PARAM_TYPES[dataType.type];\n if (simpleType !== undefined) {\n return simpleType;\n }\n switch (dataType.type) {\n case \"object\":\n {\n const objectTypeApiName = dataType.objectTypeApiName ?? \"\";\n return {\n type: \"objectReference\",\n objectReference: {\n objectTypeId: objectTypeApiName\n }\n };\n }\n case \"objectSet\":\n {\n const objectTypeApiName = dataType.objectTypeApiName ?? \"\";\n return {\n type: \"objectSetRid\",\n objectSetRid: {\n objectTypeId: objectTypeApiName\n }\n };\n }\n case \"interfaceObject\":\n {\n const interfaceApiName = dataType.interfaceApiName ?? \"\";\n return {\n type: \"interfaceReference\",\n interfaceReference: {\n interfaceTypeRid: interfaceApiName\n }\n };\n }\n case \"array\":\n {\n const subType = dataType.subType;\n if (!subType) {\n consola.warn(\"Array parameter type missing subType, skipping\");\n return undefined;\n }\n\n // For simple types, use the list variant\n const listVariant = LIST_VARIANT_MAP[subType.type];\n if (listVariant !== undefined) {\n return listVariant;\n }\n\n // For object references, use objectReferenceList\n if (subType.type === \"object\") {\n const objectTypeApiName = subType.objectTypeApiName ?? \"\";\n return {\n type: \"objectReferenceList\",\n objectReferenceList: {\n objectTypeId: objectTypeApiName\n }\n };\n }\n\n // For interface references, use interfaceReferenceList\n if (subType.type === \"interfaceObject\") {\n const interfaceApiName = subType.interfaceApiName ?? \"\";\n return {\n type: \"interfaceReferenceList\",\n interfaceReferenceList: {\n interfaceTypeRid: interfaceApiName\n }\n };\n }\n if (subType.type === \"struct\") {\n const structFields = mapGatewayStructFieldsToIr(subType);\n if (!structFields) return undefined;\n return {\n type: \"structList\",\n structList: {\n structFieldTypes: structFields\n }\n };\n }\n consola.warn(`Skipping array parameter with unsupported subType: ${subType.type}`);\n return undefined;\n }\n case \"struct\":\n {\n const structFields = mapGatewayStructFieldsToIr(dataType);\n if (!structFields) return undefined;\n return {\n type: \"struct\",\n struct: {\n structFieldTypes: structFields\n }\n };\n }\n case \"vector\":\n consola.warn(\"Skipping vector parameter type: no maker equivalent\");\n return undefined;\n case \"objectType\":\n return \"objectTypeReference\";\n default:\n consola.warn(`Skipping unknown parameter type: ${dataType.type}`);\n return undefined;\n }\n}","/*\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\n/**\n * Strips namespace prefix from an apiName.\n * \"com.example.Employee\" -> \"Employee\"\n * \"Employee\" -> \"Employee\"\n */\nexport function withoutNamespace(apiName) {\n const lastDot = apiName.lastIndexOf(\".\");\n if (lastDot === -1) {\n return apiName;\n }\n return apiName.substring(lastDot + 1);\n}\n\n/**\n * Converts a dot-separated apiName to camelCase, including namespace segments.\n * \"com.example.Employee\" -> \"comExampleEmployee\"\n * \"Employee\" -> \"employee\"\n */\nexport function fullCamel(apiName) {\n return camel(apiName.replace(/\\./g, \"-\"));\n}\n\n/**\n * Converts an apiName to camelCase variable name.\n * \"Employee\" -> \"employee\"\n * \"create-employee\" -> \"createEmployee\"\n */\nexport function camel(str) {\n if (!str) {\n return str;\n }\n let result = str.replace(/[-_]+(.)?/g, (_, c) => c ? c.toUpperCase() : \"\");\n result = result.charAt(0).toLowerCase() + result.slice(1);\n return result;\n}","/*\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 { OntologyEntityTypeEnum } from \"@osdk/maker\";\nimport { consola } from \"consola\";\nimport { mapActionParameterType } from \"./mapActionParameterType.js\";\nimport { withoutNamespace } from \"./utils.js\";\n\n// Structural type matching maker's ActionParameter (ActionParameterType is not exported)\n\n// Structural type matching maker's ActionType\n\nexport function convertActionType(action) {\n const parameters = [];\n for (const [paramId, paramV2] of Object.entries(action.parameters)) {\n const mappedType = mapActionParameterType(paramV2.dataType);\n if (!mappedType) {\n consola.warn(`Skipping parameter \"${paramId}\" on action \"${action.apiName}\": unsupported type \"${paramV2.dataType.type}\"`);\n continue;\n }\n parameters.push({\n id: paramId,\n displayName: paramV2.displayName ?? paramId,\n type: mappedType,\n validation: {\n required: paramV2.required\n }\n });\n }\n const shortName = withoutNamespace(action.apiName);\n return {\n __type: OntologyEntityTypeEnum.ACTION_TYPE,\n apiName: action.apiName,\n displayName: action.displayName ?? shortName,\n status: mapActionStatus(action.status),\n rules: [],\n parameters\n };\n}\nfunction mapActionStatus(status) {\n switch (status) {\n case \"ACTIVE\":\n return \"active\";\n case \"EXPERIMENTAL\":\n return \"experimental\";\n default:\n return \"active\";\n }\n}","/*\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 { consola } from \"consola\";\n\n/**\n * Result of mapping a gateway ObjectPropertyType to a maker PropertyTypeType.\n * `array` is true when the gateway type was {type: \"array\", subType: X}.\n */\n\n/**\n * Maps a gateway ObjectPropertyType (discriminated union with {type: string})\n * to a maker PropertyTypeType.\n *\n * Returns undefined for unsupported types (with a warning).\n */\nexport function mapPropertyType(dataType) {\n switch (dataType.type) {\n case \"string\":\n return {\n type: \"string\"\n };\n case \"integer\":\n return {\n type: \"integer\"\n };\n case \"boolean\":\n return {\n type: \"boolean\"\n };\n case \"double\":\n return {\n type: \"double\"\n };\n case \"float\":\n return {\n type: \"float\"\n };\n case \"long\":\n return {\n type: \"long\"\n };\n case \"short\":\n return {\n type: \"short\"\n };\n case \"byte\":\n return {\n type: \"byte\"\n };\n case \"date\":\n return {\n type: \"date\"\n };\n case \"timestamp\":\n return {\n type: \"timestamp\"\n };\n case \"decimal\":\n return {\n type: \"decimal\"\n };\n case \"attachment\":\n return {\n type: \"attachment\"\n };\n case \"geopoint\":\n return {\n type: \"geopoint\"\n };\n case \"geoshape\":\n return {\n type: \"geoshape\"\n };\n case \"mediaReference\":\n return {\n type: \"mediaReference\"\n };\n case \"geotimeSeriesReference\":\n return {\n type: \"geotimeSeries\"\n };\n case \"array\":\n {\n const subType = dataType.subType;\n if (!subType) {\n consola.warn(\"Array type missing subType, skipping\");\n return undefined;\n }\n const inner = mapPropertyType(subType);\n if (!inner) {\n return undefined;\n }\n return {\n type: inner.type,\n array: true\n };\n }\n // We don't support structs or markings here. It should have no influence on importing functionality\n default:\n return undefined;\n }\n}","/*\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 { OntologyEntityTypeEnum } from \"@osdk/maker\";\nimport { consola } from \"consola\";\nimport { mapPropertyType } from \"./mapPropertyType.js\";\nimport { withoutNamespace } from \"./utils.js\";\nexport function convertSharedPropertyType(spt) {\n const mapped = mapPropertyType(spt.dataType);\n if (!mapped) {\n consola.warn(`Skipping shared property type \"${spt.apiName}\": unsupported type \"${spt.dataType.type}\"`);\n return undefined;\n }\n return {\n __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE,\n apiName: spt.apiName,\n nonNameSpacedApiName: withoutNamespace(spt.apiName),\n displayName: spt.displayName ?? withoutNamespace(spt.apiName),\n type: mapped.type,\n array: mapped.array,\n description: spt.description\n };\n}","/*\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 { OntologyEntityTypeEnum } from \"@osdk/maker\";\nimport { convertSharedPropertyType } from \"./convertSharedPropertyType.js\";\nimport { withoutNamespace } from \"./utils.js\";\n/**\n * Converts a gateway InterfaceType to a maker InterfaceType.\n *\n * `allInterfaces` is the full map so we can resolve extendsInterfaces references.\n */\nexport function convertInterfaceType(iface, allInterfaces) {\n const shortName = withoutNamespace(iface.apiName);\n\n // Convert properties to propertiesV2 (SharedPropertyType-based)\n const propertiesV2 = {};\n const propertiesV3 = {};\n for (const [sptApiName, sptDef] of Object.entries(iface.properties)) {\n const converted = convertSharedPropertyType({\n apiName: sptApiName,\n displayName: sptDef.displayName,\n description: sptDef.description,\n dataType: sptDef.dataType\n });\n if (converted) {\n const entry = {\n sharedPropertyType: converted,\n required: true\n };\n propertiesV2[sptApiName] = entry;\n propertiesV3[withoutNamespace(sptApiName)] = entry;\n }\n }\n\n // Resolve extendsInterfaces — recursively convert referenced interfaces\n const extendsInterfaces = [];\n for (const extApiName of iface.extendsInterfaces) {\n const extIface = allInterfaces[extApiName];\n if (extIface) {\n extendsInterfaces.push(convertInterfaceType(extIface, allInterfaces));\n }\n }\n return {\n __type: OntologyEntityTypeEnum.INTERFACE_TYPE,\n apiName: iface.apiName,\n displayMetadata: {\n displayName: iface.displayName ?? shortName,\n description: iface.description ?? shortName\n },\n extendsInterfaces,\n links: [],\n status: {\n type: \"active\",\n active: {}\n },\n propertiesV2,\n propertiesV3,\n searchable: true\n };\n}","/*\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 { OntologyEntityTypeEnum } from \"@osdk/maker\";\nimport { consola } from \"consola\";\nimport { mapPropertyType } from \"./mapPropertyType.js\";\nimport { withoutNamespace } from \"./utils.js\";\nexport function convertObjectType(fullMetadata) {\n const obj = fullMetadata.objectType;\n const properties = [];\n for (const [propApiName, propV2] of Object.entries(obj.properties)) {\n const mapped = mapPropertyType(propV2.dataType);\n if (!mapped) {\n consola.warn(`Skipping property \"${propApiName}\" on object \"${obj.apiName}\": unsupported type \"${propV2.dataType.type}\"`);\n continue;\n }\n const prop = {\n apiName: propApiName,\n displayName: propV2.displayName ?? propApiName,\n type: mapped.type\n };\n if (mapped.array) {\n prop.array = true;\n }\n properties.push(prop);\n }\n const shortName = withoutNamespace(obj.apiName);\n return {\n __type: OntologyEntityTypeEnum.OBJECT_TYPE,\n apiName: obj.apiName,\n displayName: obj.displayName ?? shortName,\n pluralDisplayName: (obj.displayName ?? shortName) + \"s\",\n primaryKeyPropertyApiName: obj.primaryKey,\n titlePropertyApiName: obj.titleProperty,\n properties,\n description: obj.description,\n visibility: obj.visibility,\n status: mapObjectStatus(obj.status)\n };\n}\nfunction mapObjectStatus(status) {\n switch (status) {\n case \"ACTIVE\":\n return \"active\";\n case \"EXPERIMENTAL\":\n return \"experimental\";\n default:\n return \"active\";\n }\n}","/*\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 { OntologyEntityTypeEnum } from \"@osdk/maker\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { convertActionType } from \"./convertActionType.js\";\nimport { convertInterfaceType } from \"./convertInterfaceType.js\";\nimport { convertObjectType } from \"./convertObjectType.js\";\nimport { convertSharedPropertyType } from \"./convertSharedPropertyType.js\";\nimport { camel, fullCamel, withoutNamespace } from \"./utils.js\";\nconst TYPE_NAME_MAP = {\n [OntologyEntityTypeEnum.OBJECT_TYPE]: \"ObjectType\",\n [OntologyEntityTypeEnum.ACTION_TYPE]: \"ActionType\",\n [OntologyEntityTypeEnum.INTERFACE_TYPE]: \"InterfaceType\",\n [OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: \"SharedPropertyType\"\n};\nconst DIR_NAME_MAP = {\n [OntologyEntityTypeEnum.OBJECT_TYPE]: \"object-types\",\n [OntologyEntityTypeEnum.ACTION_TYPE]: \"action-types\",\n [OntologyEntityTypeEnum.INTERFACE_TYPE]: \"interface-types\",\n [OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: \"shared-property-types\"\n};\n/**\n * Resolves unique variable/file names for a list of apiNames.\n *\n * First tries the short name (namespace stripped, camelCase).\n * If that collides, all colliding entries are escalated to the full\n * camelCase name (namespace included). Any remaining duplicates get\n * a numeric suffix.\n */\nexport function resolveVarNames(apiNames) {\n const shortNames = apiNames.map(n => camel(withoutNamespace(n)));\n\n // Find which short names appear more than once\n const counts = new Map();\n for (const name of shortNames) {\n counts.set(name, (counts.get(name) ?? 0) + 1);\n }\n\n // Escalate conflicting names to fullCamel\n const resolved = apiNames.map((apiName, i) => {\n if (counts.get(shortNames[i]) > 1) {\n return fullCamel(apiName);\n }\n return shortNames[i];\n });\n\n // Handle any remaining duplicates with numeric suffixes\n const finalNames = [];\n const used = new Map();\n for (const name of resolved) {\n const count = used.get(name) ?? 0;\n finalNames.push(count === 0 ? name : `${name}${count}`);\n used.set(name, count + 1);\n }\n return finalNames;\n}\n\n/**\n * Generates TypeScript files from OntologyFullMetadata, replicating\n * the pattern from maker's writeStaticObjects().\n *\n * Each entity gets its own file with wrapWithProxy, plus an index.ts\n * that re-exports everything.\n */\nexport function writeImportedOntology(metadata, outputDir) {\n const codegenDir = path.resolve(outputDir, \"codegen\");\n\n // Clean and create directories\n for (const dirName of Object.values(DIR_NAME_MAP)) {\n const dirPath = path.join(codegenDir, dirName);\n if (fs.existsSync(dirPath)) {\n fs.rmSync(dirPath, {\n recursive: true,\n force: true\n });\n }\n fs.mkdirSync(dirPath, {\n recursive: true\n });\n }\n\n // Pass 1: Convert all entities\n const entries = [];\n for (const [_apiName, spt] of Object.entries(metadata.sharedPropertyTypes)) {\n const converted = convertSharedPropertyType(spt);\n if (converted) {\n entries.push({\n apiName: converted.apiName,\n entityType: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE,\n entity: converted\n });\n }\n }\n for (const [_apiName, iface] of Object.entries(metadata.interfaceTypes)) {\n const converted = convertInterfaceType(iface, metadata.interfaceTypes);\n entries.push({\n apiName: converted.apiName,\n entityType: OntologyEntityTypeEnum.INTERFACE_TYPE,\n entity: converted\n });\n }\n for (const [_apiName, objFull] of Object.entries(metadata.objectTypes)) {\n const converted = convertObjectType(objFull);\n entries.push({\n apiName: converted.apiName,\n entityType: OntologyEntityTypeEnum.OBJECT_TYPE,\n entity: converted\n });\n }\n for (const [_apiName, action] of Object.entries(metadata.actionTypes)) {\n const converted = convertActionType(action);\n entries.push({\n apiName: converted.apiName,\n entityType: OntologyEntityTypeEnum.ACTION_TYPE,\n entity: converted\n });\n }\n\n // Pass 2: Resolve unique variable names across all entities\n const varNames = resolveVarNames(entries.map(e => e.apiName));\n\n // Pass 3: Write files with resolved names\n const topLevelExports = [];\n for (let i = 0; i < entries.length; i++) {\n writeEntityFile(codegenDir, entries[i].entityType, entries[i].entity, varNames[i], topLevelExports);\n }\n\n // Write index.ts\n if (topLevelExports.length > 0) {\n const indexContent = topLevelExports.join(\"\\n\") + \"\\n\";\n const indexPath = path.join(outputDir, \"index.ts\");\n fs.writeFileSync(indexPath, indexContent, {\n flag: \"w\"\n });\n }\n}\nfunction writeEntityFile(codegenDir, entityType, entity, varName, topLevelExports) {\n const typeName = TYPE_NAME_MAP[entityType];\n const dirName = DIR_NAME_MAP[entityType];\n const entityJSON = JSON.stringify(entity, null, 2).replace(/(\"__type\"\\s*:\\s*)\"([^\"]*)\"/g, (_, prefix, value) => `${prefix}OntologyEntityTypeEnum.${value}`);\n const content = `import { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';\nimport type { ${typeName} } from '@osdk/maker';\n\n/** @type {import('@osdk/maker').${typeName}} */\nconst ${varName}_base: ${typeName} = ${entityJSON} as unknown as ${typeName};\n\nexport const ${varName}: ${typeName} = wrapWithProxy(${varName}_base);\n`;\n const filePath = path.join(codegenDir, dirName, `${varName}.ts`);\n fs.writeFileSync(filePath, content, {\n flag: \"w\"\n });\n topLevelExports.push(`export { ${varName} } from \"./codegen/${dirName}/${varName}.js\";`);\n}","/*\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 { consola } from \"consola\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { writeImportedOntology } from \"../generate/writeImportedOntology.js\";\nexport default async function main(args = process.argv) {\n const commandLineOpts = await yargs(hideBin(args)).version(process.env.PACKAGE_VERSION ?? \"\").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({\n input: {\n alias: \"i\",\n describe: \"Path to OntologyFullMetadata JSON file\",\n type: \"string\",\n demandOption: true,\n coerce: path.resolve\n },\n output: {\n alias: \"o\",\n describe: \"Output directory for generated TypeScript files\",\n type: \"string\",\n default: \"./generated-imports\",\n coerce: path.resolve\n }\n }).parseAsync();\n consola.info(`Reading OntologyFullMetadata from ${commandLineOpts.input}`);\n const jsonContent = await fs.readFile(commandLineOpts.input, \"utf-8\");\n const metadata = JSON.parse(jsonContent);\n consola.info(`Writing generated imports to ${commandLineOpts.output}`);\n writeImportedOntology(metadata, commandLineOpts.output);\n consola.success(`Generated import files in ${commandLineOpts.output}`);\n}"]}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
declare function main(args?: string[]): Promise<void>;
|
|
2
|
+
|
|
3
|
+
interface OntologyFullMetadata {
|
|
4
|
+
objectTypes: Record<string, {
|
|
5
|
+
objectType: {
|
|
6
|
+
apiName: string;
|
|
7
|
+
displayName?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
primaryKey: string;
|
|
10
|
+
titleProperty: string;
|
|
11
|
+
status: string;
|
|
12
|
+
visibility?: string;
|
|
13
|
+
properties: Record<string, {
|
|
14
|
+
displayName?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
dataType: {
|
|
17
|
+
type: string;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
22
|
+
sharedPropertyTypeMapping?: Record<string, string>;
|
|
23
|
+
}>;
|
|
24
|
+
actionTypes: Record<string, {
|
|
25
|
+
apiName: string;
|
|
26
|
+
displayName?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
status: string;
|
|
29
|
+
parameters: Record<string, {
|
|
30
|
+
displayName?: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
dataType: {
|
|
33
|
+
type: string;
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
};
|
|
36
|
+
required: boolean;
|
|
37
|
+
}>;
|
|
38
|
+
operations: Array<{
|
|
39
|
+
type: string;
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}>;
|
|
42
|
+
}>;
|
|
43
|
+
interfaceTypes: Record<string, {
|
|
44
|
+
apiName: string;
|
|
45
|
+
displayName?: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
extendsInterfaces: ReadonlyArray<string>;
|
|
48
|
+
properties: Record<string, {
|
|
49
|
+
apiName: string;
|
|
50
|
+
displayName?: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
dataType: {
|
|
53
|
+
type: string;
|
|
54
|
+
[key: string]: unknown;
|
|
55
|
+
};
|
|
56
|
+
}>;
|
|
57
|
+
links: Record<string, {
|
|
58
|
+
apiName: string;
|
|
59
|
+
displayName?: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
cardinality: string;
|
|
62
|
+
required: boolean;
|
|
63
|
+
linkedEntityApiName: {
|
|
64
|
+
type: string;
|
|
65
|
+
apiName?: string;
|
|
66
|
+
};
|
|
67
|
+
}>;
|
|
68
|
+
}>;
|
|
69
|
+
sharedPropertyTypes: Record<string, {
|
|
70
|
+
apiName: string;
|
|
71
|
+
displayName?: string;
|
|
72
|
+
description?: string;
|
|
73
|
+
dataType: {
|
|
74
|
+
type: string;
|
|
75
|
+
[key: string]: unknown;
|
|
76
|
+
};
|
|
77
|
+
}>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Generates TypeScript files from OntologyFullMetadata, replicating
|
|
81
|
+
* the pattern from maker's writeStaticObjects().
|
|
82
|
+
*
|
|
83
|
+
* Each entity gets its own file with wrapWithProxy, plus an index.ts
|
|
84
|
+
* that re-exports everything.
|
|
85
|
+
*/
|
|
86
|
+
declare function writeImportedOntology(metadata: OntologyFullMetadata, outputDir: string): void;
|
|
87
|
+
|
|
88
|
+
export { main as default, writeImportedOntology };
|
|
@@ -0,0 +1,47 @@
|
|
|
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 { consola } from "consola";
|
|
18
|
+
import * as fs from "node:fs/promises";
|
|
19
|
+
import * as path from "node:path";
|
|
20
|
+
import yargs from "yargs";
|
|
21
|
+
import { hideBin } from "yargs/helpers";
|
|
22
|
+
import { writeImportedOntology } from "../generate/writeImportedOntology.js";
|
|
23
|
+
export default async function main(args = process.argv) {
|
|
24
|
+
const commandLineOpts = await yargs(hideBin(args)).version("0.1.0" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
|
|
25
|
+
input: {
|
|
26
|
+
alias: "i",
|
|
27
|
+
describe: "Path to OntologyFullMetadata JSON file",
|
|
28
|
+
type: "string",
|
|
29
|
+
demandOption: true,
|
|
30
|
+
coerce: path.resolve
|
|
31
|
+
},
|
|
32
|
+
output: {
|
|
33
|
+
alias: "o",
|
|
34
|
+
describe: "Output directory for generated TypeScript files",
|
|
35
|
+
type: "string",
|
|
36
|
+
default: "./generated-imports",
|
|
37
|
+
coerce: path.resolve
|
|
38
|
+
}
|
|
39
|
+
}).parseAsync();
|
|
40
|
+
consola.info(`Reading OntologyFullMetadata from ${commandLineOpts.input}`);
|
|
41
|
+
const jsonContent = await fs.readFile(commandLineOpts.input, "utf-8");
|
|
42
|
+
const metadata = JSON.parse(jsonContent);
|
|
43
|
+
consola.info(`Writing generated imports to ${commandLineOpts.output}`);
|
|
44
|
+
writeImportedOntology(metadata, commandLineOpts.output);
|
|
45
|
+
consola.success(`Generated import files in ${commandLineOpts.output}`);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","names":["consola","fs","path","yargs","hideBin","writeImportedOntology","main","args","process","argv","commandLineOpts","version","wrap","Math","min","terminalWidth","strict","help","options","input","alias","describe","type","demandOption","coerce","resolve","output","default","parseAsync","info","jsonContent","readFile","metadata","JSON","parse","success"],"sources":["main.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 { consola } from \"consola\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { writeImportedOntology } from \"../generate/writeImportedOntology.js\";\n\nexport default async function main(\n args: string[] = process.argv,\n): Promise<void> {\n const commandLineOpts = await yargs(hideBin(args))\n .version(process.env.PACKAGE_VERSION ?? \"\")\n .wrap(Math.min(150, yargs().terminalWidth()))\n .strict()\n .help()\n .options({\n input: {\n alias: \"i\",\n describe: \"Path to OntologyFullMetadata JSON file\",\n type: \"string\",\n demandOption: true,\n coerce: path.resolve,\n },\n output: {\n alias: \"o\",\n describe: \"Output directory for generated TypeScript files\",\n type: \"string\",\n default: \"./generated-imports\",\n coerce: path.resolve,\n },\n })\n .parseAsync();\n\n consola.info(`Reading OntologyFullMetadata from ${commandLineOpts.input}`);\n\n const jsonContent = await fs.readFile(commandLineOpts.input, \"utf-8\");\n const metadata = JSON.parse(jsonContent);\n\n consola.info(`Writing generated imports to ${commandLineOpts.output}`);\n\n writeImportedOntology(metadata, commandLineOpts.output);\n\n consola.success(`Generated import files in ${commandLineOpts.output}`);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,SAAS;AACjC,OAAO,KAAKC,EAAE,MAAM,kBAAkB;AACtC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,qBAAqB,QAAQ,sCAAsC;AAE5E,eAAe,eAAeC,IAAIA,CAChCC,IAAc,GAAGC,OAAO,CAACC,IAAI,EACd;EACf,MAAMC,eAAe,GAAG,MAAMP,KAAK,CAACC,OAAO,CAACG,IAAI,CAAC,CAAC,CAC/CI,OAAO,CAAC,WAA+B,EAAE,CAAC,CAC1CC,IAAI,CAACC,IAAI,CAACC,GAAG,CAAC,GAAG,EAAEX,KAAK,CAAC,CAAC,CAACY,aAAa,CAAC,CAAC,CAAC,CAAC,CAC5CC,MAAM,CAAC,CAAC,CACRC,IAAI,CAAC,CAAC,CACNC,OAAO,CAAC;IACPC,KAAK,EAAE;MACLC,KAAK,EAAE,GAAG;MACVC,QAAQ,EAAE,wCAAwC;MAClDC,IAAI,EAAE,QAAQ;MACdC,YAAY,EAAE,IAAI;MAClBC,MAAM,EAAEtB,IAAI,CAACuB;IACf,CAAC;IACDC,MAAM,EAAE;MACNN,KAAK,EAAE,GAAG;MACVC,QAAQ,EAAE,iDAAiD;MAC3DC,IAAI,EAAE,QAAQ;MACdK,OAAO,EAAE,qBAAqB;MAC9BH,MAAM,EAAEtB,IAAI,CAACuB;IACf;EACF,CAAC,CAAC,CACDG,UAAU,CAAC,CAAC;EAEf5B,OAAO,CAAC6B,IAAI,CAAC,qCAAqCnB,eAAe,CAACS,KAAK,EAAE,CAAC;EAE1E,MAAMW,WAAW,GAAG,MAAM7B,EAAE,CAAC8B,QAAQ,CAACrB,eAAe,CAACS,KAAK,EAAE,OAAO,CAAC;EACrE,MAAMa,QAAQ,GAAGC,IAAI,CAACC,KAAK,CAACJ,WAAW,CAAC;EAExC9B,OAAO,CAAC6B,IAAI,CAAC,gCAAgCnB,eAAe,CAACgB,MAAM,EAAE,CAAC;EAEtErB,qBAAqB,CAAC2B,QAAQ,EAAEtB,eAAe,CAACgB,MAAM,CAAC;EAEvD1B,OAAO,CAACmC,OAAO,CAAC,6BAA6BzB,eAAe,CAACgB,MAAM,EAAE,CAAC;AACxE","ignoreList":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
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 { OntologyEntityTypeEnum } from "@osdk/maker";
|
|
18
|
+
import { consola } from "consola";
|
|
19
|
+
import { mapActionParameterType } from "./mapActionParameterType.js";
|
|
20
|
+
import { withoutNamespace } from "./utils.js";
|
|
21
|
+
|
|
22
|
+
// Structural type matching maker's ActionParameter (ActionParameterType is not exported)
|
|
23
|
+
|
|
24
|
+
// Structural type matching maker's ActionType
|
|
25
|
+
|
|
26
|
+
export function convertActionType(action) {
|
|
27
|
+
const parameters = [];
|
|
28
|
+
for (const [paramId, paramV2] of Object.entries(action.parameters)) {
|
|
29
|
+
const mappedType = mapActionParameterType(paramV2.dataType);
|
|
30
|
+
if (!mappedType) {
|
|
31
|
+
consola.warn(`Skipping parameter "${paramId}" on action "${action.apiName}": unsupported type "${paramV2.dataType.type}"`);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
parameters.push({
|
|
35
|
+
id: paramId,
|
|
36
|
+
displayName: paramV2.displayName ?? paramId,
|
|
37
|
+
type: mappedType,
|
|
38
|
+
validation: {
|
|
39
|
+
required: paramV2.required
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
const shortName = withoutNamespace(action.apiName);
|
|
44
|
+
return {
|
|
45
|
+
__type: OntologyEntityTypeEnum.ACTION_TYPE,
|
|
46
|
+
apiName: action.apiName,
|
|
47
|
+
displayName: action.displayName ?? shortName,
|
|
48
|
+
status: mapActionStatus(action.status),
|
|
49
|
+
rules: [],
|
|
50
|
+
parameters
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function mapActionStatus(status) {
|
|
54
|
+
switch (status) {
|
|
55
|
+
case "ACTIVE":
|
|
56
|
+
return "active";
|
|
57
|
+
case "EXPERIMENTAL":
|
|
58
|
+
return "experimental";
|
|
59
|
+
default:
|
|
60
|
+
return "active";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=convertActionType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertActionType.js","names":["OntologyEntityTypeEnum","consola","mapActionParameterType","withoutNamespace","convertActionType","action","parameters","paramId","paramV2","Object","entries","mappedType","dataType","warn","apiName","type","push","id","displayName","validation","required","shortName","__type","ACTION_TYPE","status","mapActionStatus","rules"],"sources":["convertActionType.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 { OntologyEntityTypeEnum } from \"@osdk/maker\";\nimport { consola } from \"consola\";\nimport { mapActionParameterType } from \"./mapActionParameterType.js\";\nimport { withoutNamespace } from \"./utils.js\";\n\ninterface GatewayActionTypeV2 {\n apiName: string;\n displayName?: string;\n description?: string;\n status: string;\n parameters: Record<\n string,\n {\n displayName?: string;\n description?: string;\n dataType: { type: string; [key: string]: unknown };\n required: boolean;\n }\n >;\n operations: Array<{ type: string; [key: string]: unknown }>;\n}\n\n// Structural type matching maker's ActionParameter (ActionParameterType is not exported)\ninterface ConvertedActionParameter {\n id: string;\n displayName: string;\n type: string | { type: string; [key: string]: unknown };\n validation: { required?: boolean };\n}\n\n// Structural type matching maker's ActionType\ninterface ConvertedActionType {\n __type: OntologyEntityTypeEnum.ACTION_TYPE;\n apiName: string;\n displayName: string;\n status: string;\n rules: Array<unknown>;\n parameters: Array<ConvertedActionParameter>;\n}\n\nexport function convertActionType(\n action: GatewayActionTypeV2,\n): ConvertedActionType {\n const parameters: Array<ConvertedActionParameter> = [];\n\n for (const [paramId, paramV2] of Object.entries(action.parameters)) {\n const mappedType = mapActionParameterType(paramV2.dataType);\n if (!mappedType) {\n consola.warn(\n `Skipping parameter \"${paramId}\" on action \"${action.apiName}\": unsupported type \"${paramV2.dataType.type}\"`,\n );\n continue;\n }\n\n parameters.push({\n id: paramId,\n displayName: paramV2.displayName ?? paramId,\n type: mappedType,\n validation: {\n required: paramV2.required,\n },\n });\n }\n\n const shortName = withoutNamespace(action.apiName);\n\n return {\n __type: OntologyEntityTypeEnum.ACTION_TYPE,\n apiName: action.apiName,\n displayName: action.displayName ?? shortName,\n status: mapActionStatus(action.status),\n rules: [],\n parameters,\n };\n}\n\nfunction mapActionStatus(\n status: string,\n): \"active\" | \"experimental\" | \"example\" {\n switch (status) {\n case \"ACTIVE\":\n return \"active\";\n case \"EXPERIMENTAL\":\n return \"experimental\";\n default:\n return \"active\";\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,sBAAsB,QAAQ,aAAa;AACpD,SAASC,OAAO,QAAQ,SAAS;AACjC,SAASC,sBAAsB,QAAQ,6BAA6B;AACpE,SAASC,gBAAgB,QAAQ,YAAY;;AAmB7C;;AAQA;;AAUA,OAAO,SAASC,iBAAiBA,CAC/BC,MAA2B,EACN;EACrB,MAAMC,UAA2C,GAAG,EAAE;EAEtD,KAAK,MAAM,CAACC,OAAO,EAAEC,OAAO,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACL,MAAM,CAACC,UAAU,CAAC,EAAE;IAClE,MAAMK,UAAU,GAAGT,sBAAsB,CAACM,OAAO,CAACI,QAAQ,CAAC;IAC3D,IAAI,CAACD,UAAU,EAAE;MACfV,OAAO,CAACY,IAAI,CACV,uBAAuBN,OAAO,gBAAgBF,MAAM,CAACS,OAAO,wBAAwBN,OAAO,CAACI,QAAQ,CAACG,IAAI,GAC3G,CAAC;MACD;IACF;IAEAT,UAAU,CAACU,IAAI,CAAC;MACdC,EAAE,EAAEV,OAAO;MACXW,WAAW,EAAEV,OAAO,CAACU,WAAW,IAAIX,OAAO;MAC3CQ,IAAI,EAAEJ,UAAU;MAChBQ,UAAU,EAAE;QACVC,QAAQ,EAAEZ,OAAO,CAACY;MACpB;IACF,CAAC,CAAC;EACJ;EAEA,MAAMC,SAAS,GAAGlB,gBAAgB,CAACE,MAAM,CAACS,OAAO,CAAC;EAElD,OAAO;IACLQ,MAAM,EAAEtB,sBAAsB,CAACuB,WAAW;IAC1CT,OAAO,EAAET,MAAM,CAACS,OAAO;IACvBI,WAAW,EAAEb,MAAM,CAACa,WAAW,IAAIG,SAAS;IAC5CG,MAAM,EAAEC,eAAe,CAACpB,MAAM,CAACmB,MAAM,CAAC;IACtCE,KAAK,EAAE,EAAE;IACTpB;EACF,CAAC;AACH;AAEA,SAASmB,eAAeA,CACtBD,MAAc,EACyB;EACvC,QAAQA,MAAM;IACZ,KAAK,QAAQ;MACX,OAAO,QAAQ;IACjB,KAAK,cAAc;MACjB,OAAO,cAAc;IACvB;MACE,OAAO,QAAQ;EACnB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,74 @@
|
|
|
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 { OntologyEntityTypeEnum } from "@osdk/maker";
|
|
18
|
+
import { convertSharedPropertyType } from "./convertSharedPropertyType.js";
|
|
19
|
+
import { withoutNamespace } from "./utils.js";
|
|
20
|
+
/**
|
|
21
|
+
* Converts a gateway InterfaceType to a maker InterfaceType.
|
|
22
|
+
*
|
|
23
|
+
* `allInterfaces` is the full map so we can resolve extendsInterfaces references.
|
|
24
|
+
*/
|
|
25
|
+
export function convertInterfaceType(iface, allInterfaces) {
|
|
26
|
+
const shortName = withoutNamespace(iface.apiName);
|
|
27
|
+
|
|
28
|
+
// Convert properties to propertiesV2 (SharedPropertyType-based)
|
|
29
|
+
const propertiesV2 = {};
|
|
30
|
+
const propertiesV3 = {};
|
|
31
|
+
for (const [sptApiName, sptDef] of Object.entries(iface.properties)) {
|
|
32
|
+
const converted = convertSharedPropertyType({
|
|
33
|
+
apiName: sptApiName,
|
|
34
|
+
displayName: sptDef.displayName,
|
|
35
|
+
description: sptDef.description,
|
|
36
|
+
dataType: sptDef.dataType
|
|
37
|
+
});
|
|
38
|
+
if (converted) {
|
|
39
|
+
const entry = {
|
|
40
|
+
sharedPropertyType: converted,
|
|
41
|
+
required: true
|
|
42
|
+
};
|
|
43
|
+
propertiesV2[sptApiName] = entry;
|
|
44
|
+
propertiesV3[withoutNamespace(sptApiName)] = entry;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Resolve extendsInterfaces — recursively convert referenced interfaces
|
|
49
|
+
const extendsInterfaces = [];
|
|
50
|
+
for (const extApiName of iface.extendsInterfaces) {
|
|
51
|
+
const extIface = allInterfaces[extApiName];
|
|
52
|
+
if (extIface) {
|
|
53
|
+
extendsInterfaces.push(convertInterfaceType(extIface, allInterfaces));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
__type: OntologyEntityTypeEnum.INTERFACE_TYPE,
|
|
58
|
+
apiName: iface.apiName,
|
|
59
|
+
displayMetadata: {
|
|
60
|
+
displayName: iface.displayName ?? shortName,
|
|
61
|
+
description: iface.description ?? shortName
|
|
62
|
+
},
|
|
63
|
+
extendsInterfaces,
|
|
64
|
+
links: [],
|
|
65
|
+
status: {
|
|
66
|
+
type: "active",
|
|
67
|
+
active: {}
|
|
68
|
+
},
|
|
69
|
+
propertiesV2,
|
|
70
|
+
propertiesV3,
|
|
71
|
+
searchable: true
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=convertInterfaceType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertInterfaceType.js","names":["OntologyEntityTypeEnum","convertSharedPropertyType","withoutNamespace","convertInterfaceType","iface","allInterfaces","shortName","apiName","propertiesV2","propertiesV3","sptApiName","sptDef","Object","entries","properties","converted","displayName","description","dataType","entry","sharedPropertyType","required","extendsInterfaces","extApiName","extIface","push","__type","INTERFACE_TYPE","displayMetadata","links","status","type","active","searchable"],"sources":["convertInterfaceType.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 { InterfaceType, SharedPropertyType } from \"@osdk/maker\";\nimport { OntologyEntityTypeEnum } from \"@osdk/maker\";\nimport { convertSharedPropertyType } from \"./convertSharedPropertyType.js\";\nimport { withoutNamespace } from \"./utils.js\";\n\ninterface GatewayInterfaceType {\n apiName: string;\n displayName?: string;\n description?: string;\n extendsInterfaces: ReadonlyArray<string>;\n properties: Record<\n string,\n {\n apiName: string;\n displayName?: string;\n description?: string;\n dataType: { type: string; [key: string]: unknown };\n }\n >;\n links: Record<\n string,\n {\n apiName: string;\n displayName?: string;\n description?: string;\n cardinality: string;\n required: boolean;\n linkedEntityApiName: { type: string; apiName?: string };\n }\n >;\n}\n\n/**\n * Converts a gateway InterfaceType to a maker InterfaceType.\n *\n * `allInterfaces` is the full map so we can resolve extendsInterfaces references.\n */\nexport function convertInterfaceType(\n iface: GatewayInterfaceType,\n allInterfaces: Record<string, GatewayInterfaceType>,\n): InterfaceType {\n const shortName = withoutNamespace(iface.apiName);\n\n // Convert properties to propertiesV2 (SharedPropertyType-based)\n const propertiesV2: Record<\n string,\n { sharedPropertyType: SharedPropertyType; required: boolean }\n > = {};\n const propertiesV3: Record<\n string,\n { sharedPropertyType: SharedPropertyType; required: boolean }\n > = {};\n\n for (const [sptApiName, sptDef] of Object.entries(iface.properties)) {\n const converted = convertSharedPropertyType({\n apiName: sptApiName,\n displayName: sptDef.displayName,\n description: sptDef.description,\n dataType: sptDef.dataType,\n });\n if (converted) {\n const entry = { sharedPropertyType: converted, required: true };\n propertiesV2[sptApiName] = entry;\n propertiesV3[withoutNamespace(sptApiName)] = entry;\n }\n }\n\n // Resolve extendsInterfaces — recursively convert referenced interfaces\n const extendsInterfaces: Array<InterfaceType> = [];\n for (const extApiName of iface.extendsInterfaces) {\n const extIface = allInterfaces[extApiName];\n if (extIface) {\n extendsInterfaces.push(convertInterfaceType(extIface, allInterfaces));\n }\n }\n\n return {\n __type: OntologyEntityTypeEnum.INTERFACE_TYPE,\n apiName: iface.apiName,\n displayMetadata: {\n displayName: iface.displayName ?? shortName,\n description: iface.description ?? shortName,\n },\n extendsInterfaces,\n links: [],\n status: { type: \"active\", active: {} },\n propertiesV2,\n propertiesV3,\n searchable: true,\n } as unknown as InterfaceType;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,sBAAsB,QAAQ,aAAa;AACpD,SAASC,yBAAyB,QAAQ,gCAAgC;AAC1E,SAASC,gBAAgB,QAAQ,YAAY;AA6B7C;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAClCC,KAA2B,EAC3BC,aAAmD,EACpC;EACf,MAAMC,SAAS,GAAGJ,gBAAgB,CAACE,KAAK,CAACG,OAAO,CAAC;;EAEjD;EACA,MAAMC,YAGL,GAAG,CAAC,CAAC;EACN,MAAMC,YAGL,GAAG,CAAC,CAAC;EAEN,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[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
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 { OntologyEntityTypeEnum } from "@osdk/maker";
|
|
18
|
+
import { consola } from "consola";
|
|
19
|
+
import { mapPropertyType } from "./mapPropertyType.js";
|
|
20
|
+
import { withoutNamespace } from "./utils.js";
|
|
21
|
+
export function convertObjectType(fullMetadata) {
|
|
22
|
+
const obj = fullMetadata.objectType;
|
|
23
|
+
const properties = [];
|
|
24
|
+
for (const [propApiName, propV2] of Object.entries(obj.properties)) {
|
|
25
|
+
const mapped = mapPropertyType(propV2.dataType);
|
|
26
|
+
if (!mapped) {
|
|
27
|
+
consola.warn(`Skipping property "${propApiName}" on object "${obj.apiName}": unsupported type "${propV2.dataType.type}"`);
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const prop = {
|
|
31
|
+
apiName: propApiName,
|
|
32
|
+
displayName: propV2.displayName ?? propApiName,
|
|
33
|
+
type: mapped.type
|
|
34
|
+
};
|
|
35
|
+
if (mapped.array) {
|
|
36
|
+
prop.array = true;
|
|
37
|
+
}
|
|
38
|
+
properties.push(prop);
|
|
39
|
+
}
|
|
40
|
+
const shortName = withoutNamespace(obj.apiName);
|
|
41
|
+
return {
|
|
42
|
+
__type: OntologyEntityTypeEnum.OBJECT_TYPE,
|
|
43
|
+
apiName: obj.apiName,
|
|
44
|
+
displayName: obj.displayName ?? shortName,
|
|
45
|
+
pluralDisplayName: (obj.displayName ?? shortName) + "s",
|
|
46
|
+
primaryKeyPropertyApiName: obj.primaryKey,
|
|
47
|
+
titlePropertyApiName: obj.titleProperty,
|
|
48
|
+
properties,
|
|
49
|
+
description: obj.description,
|
|
50
|
+
visibility: obj.visibility,
|
|
51
|
+
status: mapObjectStatus(obj.status)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function mapObjectStatus(status) {
|
|
55
|
+
switch (status) {
|
|
56
|
+
case "ACTIVE":
|
|
57
|
+
return "active";
|
|
58
|
+
case "EXPERIMENTAL":
|
|
59
|
+
return "experimental";
|
|
60
|
+
default:
|
|
61
|
+
return "active";
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=convertObjectType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertObjectType.js","names":["OntologyEntityTypeEnum","consola","mapPropertyType","withoutNamespace","convertObjectType","fullMetadata","obj","objectType","properties","propApiName","propV2","Object","entries","mapped","dataType","warn","apiName","type","prop","displayName","array","push","shortName","__type","OBJECT_TYPE","pluralDisplayName","primaryKeyPropertyApiName","primaryKey","titlePropertyApiName","titleProperty","description","visibility","status","mapObjectStatus"],"sources":["convertObjectType.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 { ObjectPropertyType, ObjectType } from \"@osdk/maker\";\nimport { OntologyEntityTypeEnum } from \"@osdk/maker\";\nimport { consola } from \"consola\";\nimport { mapPropertyType } from \"./mapPropertyType.js\";\nimport { withoutNamespace } from \"./utils.js\";\n\ninterface GatewayObjectTypeFullMetadata {\n objectType: {\n apiName: string;\n displayName?: string;\n description?: string;\n primaryKey: string;\n titleProperty: string;\n status: string;\n visibility?: string;\n properties: Record<\n string,\n {\n displayName?: string;\n description?: string;\n dataType: { type: string; [key: string]: unknown };\n }\n >;\n };\n sharedPropertyTypeMapping?: Record<string, string>;\n}\n\nexport function convertObjectType(\n fullMetadata: GatewayObjectTypeFullMetadata,\n): ObjectType {\n const obj = fullMetadata.objectType;\n const properties: Array<ObjectPropertyType> = [];\n\n for (const [propApiName, propV2] of Object.entries(obj.properties)) {\n const mapped = mapPropertyType(propV2.dataType);\n if (!mapped) {\n consola.warn(\n `Skipping property \"${propApiName}\" on object \"${obj.apiName}\": unsupported type \"${propV2.dataType.type}\"`,\n );\n continue;\n }\n\n const prop: ObjectPropertyType = {\n apiName: propApiName,\n displayName: propV2.displayName ?? propApiName,\n type: mapped.type,\n };\n if (mapped.array) {\n (prop as ObjectPropertyType & { array?: boolean }).array = true;\n }\n properties.push(prop);\n }\n\n const shortName = withoutNamespace(obj.apiName);\n\n return {\n __type: OntologyEntityTypeEnum.OBJECT_TYPE,\n apiName: obj.apiName,\n displayName: obj.displayName ?? shortName,\n pluralDisplayName: (obj.displayName ?? shortName) + \"s\",\n primaryKeyPropertyApiName: obj.primaryKey,\n titlePropertyApiName: obj.titleProperty,\n properties,\n description: obj.description,\n visibility: obj.visibility as \"NORMAL\" | \"PROMINENT\" | \"HIDDEN\" | undefined,\n status: mapObjectStatus(obj.status),\n };\n}\n\nfunction mapObjectStatus(\n status: string,\n): \"active\" | \"experimental\" | undefined {\n switch (status) {\n case \"ACTIVE\":\n return \"active\";\n case \"EXPERIMENTAL\":\n return \"experimental\";\n default:\n return \"active\";\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;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vDI,yBAAyB,EAAEpB,GAAG,CAACqB,UAAU;IACzCC,oBAAoB,EAAEtB,GAAG,CAACuB,aAAa;IACvCrB,UAAU;IACVsB,WAAW,EAAExB,GAAG,CAACwB,WAAW;IAC5BC,UAAU,EAAEzB,GAAG,CAACyB,UAA2D;IAC3EC,MAAM,EAAEC,eAAe,CAAC3B,GAAG,CAAC0B,MAAM;EACpC,CAAC;AACH;AAEA,SAASC,eAAeA,CACtBD,MAAc,EACyB;EACvC,QAAQA,MAAM;IACZ,KAAK,QAAQ;MACX,OAAO,QAAQ;IACjB,KAAK,cAAc;MACjB,OAAO,cAAc;IACvB;MACE,OAAO,QAAQ;EACnB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 { OntologyEntityTypeEnum } from "@osdk/maker";
|
|
18
|
+
import { consola } from "consola";
|
|
19
|
+
import { mapPropertyType } from "./mapPropertyType.js";
|
|
20
|
+
import { withoutNamespace } from "./utils.js";
|
|
21
|
+
export function convertSharedPropertyType(spt) {
|
|
22
|
+
const mapped = mapPropertyType(spt.dataType);
|
|
23
|
+
if (!mapped) {
|
|
24
|
+
consola.warn(`Skipping shared property type "${spt.apiName}": unsupported type "${spt.dataType.type}"`);
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
__type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE,
|
|
29
|
+
apiName: spt.apiName,
|
|
30
|
+
nonNameSpacedApiName: withoutNamespace(spt.apiName),
|
|
31
|
+
displayName: spt.displayName ?? withoutNamespace(spt.apiName),
|
|
32
|
+
type: mapped.type,
|
|
33
|
+
array: mapped.array,
|
|
34
|
+
description: spt.description
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=convertSharedPropertyType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertSharedPropertyType.js","names":["OntologyEntityTypeEnum","consola","mapPropertyType","withoutNamespace","convertSharedPropertyType","spt","mapped","dataType","warn","apiName","type","undefined","__type","SHARED_PROPERTY_TYPE","nonNameSpacedApiName","displayName","array","description"],"sources":["convertSharedPropertyType.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 { SharedPropertyType } from \"@osdk/maker\";\nimport { OntologyEntityTypeEnum } from \"@osdk/maker\";\nimport { consola } from \"consola\";\nimport { mapPropertyType } from \"./mapPropertyType.js\";\nimport { withoutNamespace } from \"./utils.js\";\n\ninterface GatewaySharedPropertyType {\n apiName: string;\n displayName?: string;\n description?: string;\n dataType: { type: string; [key: string]: unknown };\n}\n\nexport function convertSharedPropertyType(\n spt: GatewaySharedPropertyType,\n): SharedPropertyType | undefined {\n const mapped = mapPropertyType(spt.dataType);\n if (!mapped) {\n consola.warn(\n `Skipping shared property type \"${spt.apiName}\": unsupported type \"${spt.dataType.type}\"`,\n );\n return undefined;\n }\n\n return {\n __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE,\n apiName: spt.apiName,\n nonNameSpacedApiName: withoutNamespace(spt.apiName),\n displayName: spt.displayName ?? withoutNamespace(spt.apiName),\n type: mapped.type,\n array: mapped.array,\n description: spt.description,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,sBAAsB,QAAQ,aAAa;AACpD,SAASC,OAAO,QAAQ,SAAS;AACjC,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,gBAAgB,QAAQ,YAAY;AAS7C,OAAO,SAASC,yBAAyBA,CACvCC,GAA8B,EACE;EAChC,MAAMC,MAAM,GAAGJ,eAAe,CAACG,GAAG,CAACE,QAAQ,CAAC;EAC5C,IAAI,CAACD,MAAM,EAAE;IACXL,OAAO,CAACO,IAAI,CACV,kCAAkCH,GAAG,CAACI,OAAO,wBAAwBJ,GAAG,CAACE,QAAQ,CAACG,IAAI,GACxF,CAAC;IACD,OAAOC,SAAS;EAClB;EAEA,OAAO;IACLC,MAAM,EAAEZ,sBAAsB,CAACa,oBAAoB;IACnDJ,OAAO,EAAEJ,GAAG,CAACI,OAAO;IACpBK,oBAAoB,EAAEX,gBAAgB,CAACE,GAAG,CAACI,OAAO,CAAC;IACnDM,WAAW,EAAEV,GAAG,CAACU,WAAW,IAAIZ,gBAAgB,CAACE,GAAG,CAACI,OAAO,CAAC;IAC7DC,IAAI,EAAEJ,MAAM,CAACI,IAAI;IACjBM,KAAK,EAAEV,MAAM,CAACU,KAAK;IACnBC,WAAW,EAAEZ,GAAG,CAACY;EACnB,CAAC;AACH","ignoreList":[]}
|