@osdk/maker 0.13.0-beta.4 → 0.13.0-beta.6
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 +21 -0
- package/build/browser/api/defineAction.js +15 -13
- package/build/browser/api/defineAction.js.map +1 -1
- package/build/browser/api/defineOntology.js +32 -108
- package/build/browser/api/defineOntology.js.map +1 -1
- package/build/browser/api/defineSpt.js.map +1 -1
- package/build/browser/api/defineValueType.js +2 -1
- package/build/browser/api/defineValueType.js.map +1 -1
- package/build/browser/api/markingconstraint.test.js +3 -3
- package/build/browser/api/markingconstraint.test.js.map +1 -1
- package/build/browser/api/objectStatus.test.js +4 -4
- package/build/browser/api/objectStatus.test.js.map +1 -1
- package/build/browser/api/overall.test.js +607 -271
- package/build/browser/api/overall.test.js.map +1 -1
- package/build/browser/api/propertyConversionUtils.js +3 -1
- package/build/browser/api/propertyConversionUtils.js.map +1 -1
- package/build/browser/api/types.js.map +1 -1
- package/build/browser/cli/main.js +11 -5
- package/build/browser/cli/main.js.map +1 -1
- package/build/cjs/index.cjs +64 -129
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +8 -10
- package/build/esm/api/defineAction.js +15 -13
- package/build/esm/api/defineAction.js.map +1 -1
- package/build/esm/api/defineOntology.js +32 -108
- package/build/esm/api/defineOntology.js.map +1 -1
- package/build/esm/api/defineSpt.js.map +1 -1
- package/build/esm/api/defineValueType.js +2 -1
- package/build/esm/api/defineValueType.js.map +1 -1
- package/build/esm/api/markingconstraint.test.js +3 -3
- package/build/esm/api/markingconstraint.test.js.map +1 -1
- package/build/esm/api/objectStatus.test.js +4 -4
- package/build/esm/api/objectStatus.test.js.map +1 -1
- package/build/esm/api/overall.test.js +607 -271
- package/build/esm/api/overall.test.js.map +1 -1
- package/build/esm/api/propertyConversionUtils.js +3 -1
- package/build/esm/api/propertyConversionUtils.js.map +1 -1
- package/build/esm/api/types.js.map +1 -1
- package/build/esm/cli/main.js +11 -5
- package/build/esm/cli/main.js.map +1 -1
- package/build/types/api/defineAction.d.ts.map +1 -1
- package/build/types/api/defineOntology.d.ts +1 -6
- package/build/types/api/defineOntology.d.ts.map +1 -1
- package/build/types/api/defineSpt.d.ts +2 -2
- package/build/types/api/defineSpt.d.ts.map +1 -1
- package/build/types/api/propertyConversionUtils.d.ts +2 -2
- package/build/types/api/propertyConversionUtils.d.ts.map +1 -1
- package/build/types/api/types.d.ts +6 -14
- package/build/types/api/types.d.ts.map +1 -1
- package/package.json +9 -9
|
@@ -36,7 +36,9 @@ export function getPropertyTypeName(type) {
|
|
|
36
36
|
export function convertValueType(valueType) {
|
|
37
37
|
return {
|
|
38
38
|
apiName: valueType.apiName,
|
|
39
|
-
version: valueType.version
|
|
39
|
+
version: valueType.version,
|
|
40
|
+
packageNamespace: valueType.packageNamespace,
|
|
41
|
+
displayMetadata: valueType.displayMetadata
|
|
40
42
|
};
|
|
41
43
|
}
|
|
42
44
|
export function convertValueTypeDataConstraints(dataConstraints) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyConversionUtils.js","names":["invariant","defaultTypeClasses","kind","name","shouldNotHaveRenderHints","type","includes","getPropertyTypeName","hasRenderHints","typeClasses","some","tc","toLowerCase","convertValueType","valueType","apiName","version","convertValueTypeDataConstraints","dataConstraints","length","undefined","propertyTypeConstraints","map","constraint","constraints","dataConstraintToPropertyTypeDataConstraint","failureMessage","dc","Error","struct","elementConstraints","Object","fromEntries","entries","field","convertDataConstraintToDataConstraints","convertNullabilityToDataConstraint","prop","nullability","nullabilityV2","noEmptyCollections","noNulls","process","env","NODE_ENV","convertType","marking","markingType","structFields","Array","key","structDefinition","fieldTypeDefinition","displayMetadata","displayName","description","aliases","fieldType","push","analyzerOverride","enableAsciiFolding","isLongText","supportsEfficientLeadingWildcard","supportsExactMatching","geohash","precision","scale","mediaReference","geotimeSeriesReference","distributeTypeHelper"],"sources":["propertyConversionUtils.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 {\n DataConstraint,\n DataConstraints,\n OntologyIrStructFieldType,\n OntologyIrType,\n PropertyTypeDataConstraints,\n PropertyTypeDataConstraints_array,\n PropertyTypeDataConstraints_boolean,\n PropertyTypeDataConstraints_date,\n PropertyTypeDataConstraints_decimal,\n PropertyTypeDataConstraints_double,\n PropertyTypeDataConstraints_float,\n PropertyTypeDataConstraints_integer,\n PropertyTypeDataConstraints_long,\n PropertyTypeDataConstraints_short,\n PropertyTypeDataConstraints_string,\n PropertyTypeDataConstraints_struct,\n PropertyTypeDataConstraints_timestamp,\n PropertyTypeDataConstraintsWrapper,\n ValueTypeApiNameReference,\n ValueTypeDataConstraint,\n} from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport type {\n Nullability,\n PropertyTypeType,\n TypeClass,\n ValueTypeDefinitionVersion,\n} from \"./types.js\";\n\nexport const defaultTypeClasses: TypeClass[] = [{\n kind: \"render_hint\",\n name: \"SELECTABLE\",\n}, { kind: \"render_hint\", name: \"SORTABLE\" }];\n\n// ExperimentalTimeDependentV1 and Attachment types should be included here once supported\nexport function shouldNotHaveRenderHints(type: PropertyTypeType): boolean {\n return [\"struct\", \"mediaReference\", \"geotimeSeries\"].includes(\n getPropertyTypeName(type),\n );\n}\n\nexport function hasRenderHints(typeClasses: TypeClass[] | undefined): boolean {\n return (typeClasses ?? []).some(tc =>\n tc.kind.toLowerCase() === \"render_hint\"\n );\n}\n\nexport function getPropertyTypeName(type: PropertyTypeType): string {\n return typeof type === \"object\" ? type.type : type;\n}\n\nexport function convertValueType(\n valueType: ValueTypeDefinitionVersion,\n): ValueTypeApiNameReference {\n return {\n apiName: valueType.apiName,\n version: valueType.version,\n };\n}\n\nexport function convertValueTypeDataConstraints(\n dataConstraints: ValueTypeDataConstraint[],\n): DataConstraints | undefined {\n if (dataConstraints.length === 0) {\n return undefined;\n }\n\n const propertyTypeConstraints: PropertyTypeDataConstraintsWrapper[] =\n dataConstraints.map(\n (constraint): PropertyTypeDataConstraintsWrapper => ({\n constraints: dataConstraintToPropertyTypeDataConstraint(\n constraint.constraint.constraint,\n ),\n failureMessage: constraint.constraint.failureMessage,\n }),\n );\n\n return {\n propertyTypeConstraints,\n };\n}\n\nexport function dataConstraintToPropertyTypeDataConstraint(\n dc: DataConstraint,\n): PropertyTypeDataConstraints {\n switch (dc.type) {\n case \"array\":\n return { ...dc } as PropertyTypeDataConstraints_array;\n\n case \"boolean\":\n return { ...dc } as PropertyTypeDataConstraints_boolean;\n\n case \"binary\":\n throw new Error(\"Binary type constraints are not supported\");\n\n case \"date\":\n return { ...dc } as PropertyTypeDataConstraints_date;\n\n case \"decimal\":\n return { ...dc } as PropertyTypeDataConstraints_decimal;\n\n case \"double\":\n return { ...dc } as PropertyTypeDataConstraints_double;\n\n case \"float\":\n return { ...dc } as PropertyTypeDataConstraints_float;\n\n case \"integer\":\n return { ...dc } as PropertyTypeDataConstraints_integer;\n\n case \"long\":\n return { ...dc } as PropertyTypeDataConstraints_long;\n\n case \"map\":\n throw new Error(\"Map type constraints are not supported\");\n\n case \"nullable\":\n throw new Error(\"Nullable constraints are not supported\");\n\n case \"short\":\n return { ...dc } as PropertyTypeDataConstraints_short;\n\n case \"string\":\n return { ...dc } as PropertyTypeDataConstraints_string;\n\n case \"struct\":\n return {\n type: \"struct\",\n struct: {\n elementConstraints: Object.fromEntries(\n Object.entries(dc.struct.elementConstraints).map((\n [field, constraint],\n ) => [\n field,\n convertDataConstraintToDataConstraints(constraint),\n ]),\n ),\n },\n } as PropertyTypeDataConstraints_struct;\n\n case \"structV2\":\n throw new Error(\"StructV2 constraints are not supported\");\n\n case \"timestamp\":\n return { ...dc } as PropertyTypeDataConstraints_timestamp;\n\n default:\n throw new Error(`Unknown DataConstraint type: ${(dc as any).type}`);\n }\n}\n\nexport function convertDataConstraintToDataConstraints(\n dc: DataConstraint,\n): DataConstraints {\n return {\n propertyTypeConstraints: [\n {\n constraints: dataConstraintToPropertyTypeDataConstraint(dc),\n // known limitation: structs don't carry field-level data constraint failure messages\n },\n ],\n };\n}\n\nexport function convertNullabilityToDataConstraint(\n prop: { type: PropertyTypeType; nullability?: Nullability },\n): DataConstraints | undefined {\n if (typeof prop.type === \"object\" && prop.type.type === \"marking\") {\n if (prop.nullability === undefined) {\n return {\n propertyTypeConstraints: [],\n nullability: undefined,\n nullabilityV2: { noEmptyCollections: true, noNulls: true },\n };\n }\n invariant(\n prop.nullability?.noNulls,\n \"Marking property type has noNulls set to false, marking properties must not be nullable\",\n );\n return {\n propertyTypeConstraints: [],\n nullability: undefined,\n nullabilityV2: prop.nullability,\n };\n }\n return prop.nullability === undefined ? undefined : {\n propertyTypeConstraints: [],\n nullability: undefined,\n nullabilityV2: prop.nullability,\n };\n}\n\nexport function convertType(\n type: PropertyTypeType,\n): OntologyIrType {\n switch (true) {\n case (typeof type === \"object\" && \"markingType\" in type):\n return {\n \"type\": \"marking\",\n marking: { markingType: type.markingType },\n };\n\n case (typeof type === \"object\" && \"structDefinition\" in type):\n const structFields: Array<OntologyIrStructFieldType> = new Array();\n for (const key in type.structDefinition) {\n const fieldTypeDefinition = type.structDefinition[key];\n let field: OntologyIrStructFieldType;\n if (typeof fieldTypeDefinition === \"string\") {\n field = {\n apiName: key,\n displayMetadata: { displayName: key, description: undefined },\n typeClasses: [],\n aliases: [],\n fieldType: convertType(fieldTypeDefinition),\n };\n } else {\n // If it is a full form type definition then process it as such\n if (\"fieldType\" in fieldTypeDefinition) {\n field = {\n ...fieldTypeDefinition,\n apiName: key,\n fieldType: convertType(fieldTypeDefinition.fieldType),\n typeClasses: fieldTypeDefinition.typeClasses ?? [],\n aliases: fieldTypeDefinition.aliases ?? [],\n };\n } else {\n field = {\n apiName: key,\n displayMetadata: { displayName: key, description: undefined },\n typeClasses: [],\n aliases: [],\n fieldType: convertType(fieldTypeDefinition),\n };\n }\n }\n\n structFields.push(field);\n }\n\n return {\n type: \"struct\",\n struct: { structFields },\n };\n\n case (typeof type === \"object\" && \"isLongText\" in type):\n return {\n \"type\": \"string\",\n \"string\": {\n analyzerOverride: undefined,\n enableAsciiFolding: undefined,\n isLongText: type.isLongText,\n supportsEfficientLeadingWildcard:\n type.supportsEfficientLeadingWildcard,\n supportsExactMatching: type.supportsExactMatching,\n },\n };\n\n case (type === \"geopoint\"):\n return { type: \"geohash\", geohash: {} };\n\n case (type === \"decimal\"):\n return { type, [type]: { precision: undefined, scale: undefined } };\n\n case (type === \"string\"):\n return {\n type,\n [type]: {\n analyzerOverride: undefined,\n enableAsciiFolding: undefined,\n isLongText: false,\n supportsEfficientLeadingWildcard: false,\n supportsExactMatching: true,\n },\n };\n\n case (type === \"mediaReference\"):\n return {\n type: type,\n mediaReference: {},\n };\n\n case (type === \"geotimeSeries\"):\n return {\n type: \"geotimeSeriesReference\",\n geotimeSeriesReference: {},\n };\n\n default:\n // use helper function to distribute `type` properly\n return distributeTypeHelper(type);\n }\n}\n\n/**\n * Helper function to avoid duplication. Makes the types match properly with the correct\n * behavior without needing to switch on type.\n * @param type\n * @returns\n */\nexport function distributeTypeHelper<T extends string>(\n type: T,\n): T extends any ? { type: T } & { [K in T]: {} } : never {\n return { type, [type]: {} } as any; // any cast to match conditional return type\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwBA,OAAOA,SAAS,MAAM,gBAAgB;AAQtC,OAAO,MAAMC,kBAA+B,GAAG,CAAC;EAC9CC,IAAI,EAAE,aAAa;EACnBC,IAAI,EAAE;A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[]}
|
|
1
|
+
{"version":3,"file":"propertyConversionUtils.js","names":["invariant","defaultTypeClasses","kind","name","shouldNotHaveRenderHints","type","includes","getPropertyTypeName","hasRenderHints","typeClasses","some","tc","toLowerCase","convertValueType","valueType","apiName","version","packageNamespace","displayMetadata","convertValueTypeDataConstraints","dataConstraints","length","undefined","propertyTypeConstraints","map","constraint","constraints","dataConstraintToPropertyTypeDataConstraint","failureMessage","dc","Error","struct","elementConstraints","Object","fromEntries","entries","field","convertDataConstraintToDataConstraints","convertNullabilityToDataConstraint","prop","nullability","nullabilityV2","noEmptyCollections","noNulls","process","env","NODE_ENV","convertType","marking","markingType","structFields","Array","key","structDefinition","fieldTypeDefinition","displayName","description","aliases","fieldType","push","analyzerOverride","enableAsciiFolding","isLongText","supportsEfficientLeadingWildcard","supportsExactMatching","geohash","precision","scale","mediaReference","geotimeSeriesReference","distributeTypeHelper"],"sources":["propertyConversionUtils.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 {\n DataConstraint,\n DataConstraints,\n OntologyIrStructFieldType,\n OntologyIrType,\n OntologyIrValueTypeReferenceWithMetadata,\n PropertyTypeDataConstraints,\n PropertyTypeDataConstraints_array,\n PropertyTypeDataConstraints_boolean,\n PropertyTypeDataConstraints_date,\n PropertyTypeDataConstraints_decimal,\n PropertyTypeDataConstraints_double,\n PropertyTypeDataConstraints_float,\n PropertyTypeDataConstraints_integer,\n PropertyTypeDataConstraints_long,\n PropertyTypeDataConstraints_short,\n PropertyTypeDataConstraints_string,\n PropertyTypeDataConstraints_struct,\n PropertyTypeDataConstraints_timestamp,\n PropertyTypeDataConstraintsWrapper,\n ValueTypeDataConstraint,\n} from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport type {\n Nullability,\n PropertyTypeType,\n TypeClass,\n ValueTypeDefinitionVersion,\n} from \"./types.js\";\n\nexport const defaultTypeClasses: TypeClass[] = [{\n kind: \"render_hint\",\n name: \"SELECTABLE\",\n}, { kind: \"render_hint\", name: \"SORTABLE\" }];\n\n// ExperimentalTimeDependentV1 and Attachment types should be included here once supported\nexport function shouldNotHaveRenderHints(type: PropertyTypeType): boolean {\n return [\"struct\", \"mediaReference\", \"geotimeSeries\"].includes(\n getPropertyTypeName(type),\n );\n}\n\nexport function hasRenderHints(typeClasses: TypeClass[] | undefined): boolean {\n return (typeClasses ?? []).some(tc =>\n tc.kind.toLowerCase() === \"render_hint\"\n );\n}\n\nexport function getPropertyTypeName(type: PropertyTypeType): string {\n return typeof type === \"object\" ? type.type : type;\n}\n\nexport function convertValueType(\n valueType: ValueTypeDefinitionVersion,\n): OntologyIrValueTypeReferenceWithMetadata {\n return {\n apiName: valueType.apiName,\n version: valueType.version,\n packageNamespace: valueType.packageNamespace,\n displayMetadata: valueType.displayMetadata,\n };\n}\n\nexport function convertValueTypeDataConstraints(\n dataConstraints: ValueTypeDataConstraint[],\n): DataConstraints | undefined {\n if (dataConstraints.length === 0) {\n return undefined;\n }\n\n const propertyTypeConstraints: PropertyTypeDataConstraintsWrapper[] =\n dataConstraints.map(\n (constraint): PropertyTypeDataConstraintsWrapper => ({\n constraints: dataConstraintToPropertyTypeDataConstraint(\n constraint.constraint.constraint,\n ),\n failureMessage: constraint.constraint.failureMessage,\n }),\n );\n\n return {\n propertyTypeConstraints,\n };\n}\n\nexport function dataConstraintToPropertyTypeDataConstraint(\n dc: DataConstraint,\n): PropertyTypeDataConstraints {\n switch (dc.type) {\n case \"array\":\n return { ...dc } as PropertyTypeDataConstraints_array;\n\n case \"boolean\":\n return { ...dc } as PropertyTypeDataConstraints_boolean;\n\n case \"binary\":\n throw new Error(\"Binary type constraints are not supported\");\n\n case \"date\":\n return { ...dc } as PropertyTypeDataConstraints_date;\n\n case \"decimal\":\n return { ...dc } as PropertyTypeDataConstraints_decimal;\n\n case \"double\":\n return { ...dc } as PropertyTypeDataConstraints_double;\n\n case \"float\":\n return { ...dc } as PropertyTypeDataConstraints_float;\n\n case \"integer\":\n return { ...dc } as PropertyTypeDataConstraints_integer;\n\n case \"long\":\n return { ...dc } as PropertyTypeDataConstraints_long;\n\n case \"map\":\n throw new Error(\"Map type constraints are not supported\");\n\n case \"nullable\":\n throw new Error(\"Nullable constraints are not supported\");\n\n case \"short\":\n return { ...dc } as PropertyTypeDataConstraints_short;\n\n case \"string\":\n return { ...dc } as PropertyTypeDataConstraints_string;\n\n case \"struct\":\n return {\n type: \"struct\",\n struct: {\n elementConstraints: Object.fromEntries(\n Object.entries(dc.struct.elementConstraints).map((\n [field, constraint],\n ) => [\n field,\n convertDataConstraintToDataConstraints(constraint),\n ]),\n ),\n },\n } as PropertyTypeDataConstraints_struct;\n\n case \"structV2\":\n throw new Error(\"StructV2 constraints are not supported\");\n\n case \"timestamp\":\n return { ...dc } as PropertyTypeDataConstraints_timestamp;\n\n default:\n throw new Error(`Unknown DataConstraint type: ${(dc as any).type}`);\n }\n}\n\nexport function convertDataConstraintToDataConstraints(\n dc: DataConstraint,\n): DataConstraints {\n return {\n propertyTypeConstraints: [\n {\n constraints: dataConstraintToPropertyTypeDataConstraint(dc),\n // known limitation: structs don't carry field-level data constraint failure messages\n },\n ],\n };\n}\n\nexport function convertNullabilityToDataConstraint(\n prop: { type: PropertyTypeType; nullability?: Nullability },\n): DataConstraints | undefined {\n if (typeof prop.type === \"object\" && prop.type.type === \"marking\") {\n if (prop.nullability === undefined) {\n return {\n propertyTypeConstraints: [],\n nullability: undefined,\n nullabilityV2: { noEmptyCollections: true, noNulls: true },\n };\n }\n invariant(\n prop.nullability?.noNulls,\n \"Marking property type has noNulls set to false, marking properties must not be nullable\",\n );\n return {\n propertyTypeConstraints: [],\n nullability: undefined,\n nullabilityV2: prop.nullability,\n };\n }\n return prop.nullability === undefined ? undefined : {\n propertyTypeConstraints: [],\n nullability: undefined,\n nullabilityV2: prop.nullability,\n };\n}\n\nexport function convertType(\n type: PropertyTypeType,\n): OntologyIrType {\n switch (true) {\n case (typeof type === \"object\" && \"markingType\" in type):\n return {\n \"type\": \"marking\",\n marking: { markingType: type.markingType },\n };\n\n case (typeof type === \"object\" && \"structDefinition\" in type):\n const structFields: Array<OntologyIrStructFieldType> = new Array();\n for (const key in type.structDefinition) {\n const fieldTypeDefinition = type.structDefinition[key];\n let field: OntologyIrStructFieldType;\n if (typeof fieldTypeDefinition === \"string\") {\n field = {\n apiName: key,\n displayMetadata: { displayName: key, description: undefined },\n typeClasses: [],\n aliases: [],\n fieldType: convertType(fieldTypeDefinition),\n };\n } else {\n // If it is a full form type definition then process it as such\n if (\"fieldType\" in fieldTypeDefinition) {\n field = {\n ...fieldTypeDefinition,\n apiName: key,\n fieldType: convertType(fieldTypeDefinition.fieldType),\n typeClasses: fieldTypeDefinition.typeClasses ?? [],\n aliases: fieldTypeDefinition.aliases ?? [],\n };\n } else {\n field = {\n apiName: key,\n displayMetadata: { displayName: key, description: undefined },\n typeClasses: [],\n aliases: [],\n fieldType: convertType(fieldTypeDefinition),\n };\n }\n }\n\n structFields.push(field);\n }\n\n return {\n type: \"struct\",\n struct: { structFields },\n };\n\n case (typeof type === \"object\" && \"isLongText\" in type):\n return {\n \"type\": \"string\",\n \"string\": {\n analyzerOverride: undefined,\n enableAsciiFolding: undefined,\n isLongText: type.isLongText,\n supportsEfficientLeadingWildcard:\n type.supportsEfficientLeadingWildcard,\n supportsExactMatching: type.supportsExactMatching,\n },\n };\n\n case (type === \"geopoint\"):\n return { type: \"geohash\", geohash: {} };\n\n case (type === \"decimal\"):\n return { type, [type]: { precision: undefined, scale: undefined } };\n\n case (type === \"string\"):\n return {\n type,\n [type]: {\n analyzerOverride: undefined,\n enableAsciiFolding: undefined,\n isLongText: false,\n supportsEfficientLeadingWildcard: false,\n supportsExactMatching: true,\n },\n };\n\n case (type === \"mediaReference\"):\n return {\n type: type,\n mediaReference: {},\n };\n\n case (type === \"geotimeSeries\"):\n return {\n type: \"geotimeSeriesReference\",\n geotimeSeriesReference: {},\n };\n\n default:\n // use helper function to distribute `type` properly\n return distributeTypeHelper(type);\n }\n}\n\n/**\n * Helper function to avoid duplication. Makes the types match properly with the correct\n * behavior without needing to switch on type.\n * @param type\n * @returns\n */\nexport function distributeTypeHelper<T extends string>(\n type: T,\n): T extends any ? { type: T } & { [K in T]: {} } : never {\n return { type, [type]: {} } as any; // any cast to match conditional return type\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwBA,OAAOA,SAAS,MAAM,gBAAgB;AAQtC,OAAO,MAAMC,kBAA+B,GAAG,CAAC;EAC9CC,IAAI,EAAE,aAAa;EACnBC,IAAI,EAAE;AACR,CAAC,EAAE;EAAED,IAAI,EAAE,aAAa;EAAEC,IAAI,EAAE;AAAW,CAAC,CAAC;;AAE7C;AACA,OAAO,SAASC,wBAAwBA,CAACC,IAAsB,EAAW;EACxE,OAAO,CAAC,QAAQ,EAAE,gBAAgB,EAAE,eAAe,CAAC,CAACC,QAAQ,CAC3DC,mBAAmB,CAACF,IAAI,CAC1B,CAAC;AACH;AAEA,OAAO,SAASG,cAAcA,CAACC,WAAoC,EAAW;EAC5E,OAAO,CAACA,WAAW,IAAI,EAAE,EAAEC,IAAI,CAACC,EAAE,IAChCA,EAAE,CAACT,IAAI,CAACU,WAAW,CAAC,CAAC,KAAK,aAC5B,CAAC;AACH;AAEA,OAAO,SAASL,mBAAmBA,CAACF,IAAsB,EAAU;EAClE,OAAO,OAAOA,IAAI,KAAK,QAAQ,GAAGA,IAAI,CAACA,IAAI,GAAGA,IAAI;AACpD;AAEA,OAAO,SAAS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AS;UAAE6C,KAAK,EAAE7C;QAAU;MAAE,CAAC;IAErE,KAAMjB,IAAI,KAAK,QAAQ;MACrB,OAAO;QACLA,IAAI;QACJ,CAACA,IAAI,GAAG;UACNuD,gBAAgB,EAAEtC,SAAS;UAC3BuC,kBAAkB,EAAEvC,SAAS;UAC7BwC,UAAU,EAAE,KAAK;UACjBC,gCAAgC,EAAE,KAAK;UACvCC,qBAAqB,EAAE;QACzB;MACF,CAAC;IAEH,KAAM3D,IAAI,KAAK,gBAAgB;MAC7B,OAAO;QACLA,IAAI,EAAEA,IAAI;QACV+D,cAAc,EAAE,CAAC;MACnB,CAAC;IAEH,KAAM/D,IAAI,KAAK,eAAe;MAC5B,OAAO;QACLA,IAAI,EAAE,wBAAwB;QAC9BgE,sBAAsB,EAAE,CAAC;MAC3B,CAAC;IAEH;MACE;MACA,OAAOC,oBAAoB,CAACjE,IAAI,CAAC;EACrC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASiE,oBAAoBA,CAClCjE,IAAO,EACiD;EACxD,OAAO;IAAEA,IAAI;IAAE,CAACA,IAAI,GAAG,CAAC;EAAE,CAAC,CAAQ,CAAC;AACtC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["OntologyEntityTypeEnum","MODIFY_OBJECT_PARAMETER","CREATE_OR_MODIFY_OBJECT_PARAMETER"],"sources":["types.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 {\n ActionTypeApiName,\n ActionTypeStatus_deprecated,\n BaseType,\n ButtonDisplayMetadata,\n DataConstraint,\n DisplayMetadataConfigurationDefaultLayout,\n DisplayMetadataConfigurationDisplayAndFormat,\n ExampleValue,\n FailureMessage,\n ImportedTypes,\n InterfaceTypeApiName,\n InterfaceTypeStatus,\n LinkTypeDisplayMetadata,\n LinkTypeMetadata,\n OntologyIrActionTypeEntities,\n OntologyIrBaseParameterType_decimal,\n OntologyIrBaseParameterType_decimalList,\n OntologyIrBaseParameterType_interfaceReference,\n OntologyIrBaseParameterType_interfaceReferenceList,\n OntologyIrBaseParameterType_objectReference,\n OntologyIrBaseParameterType_objectReferenceList,\n OntologyIrBaseParameterType_objectSetRid,\n OntologyIrBaseParameterType_objectTypeReference,\n OntologyIrBaseParameterType_struct,\n OntologyIrBaseParameterType_structList,\n OntologyIrBaseParameterType_timestamp,\n OntologyIrBaseParameterType_timestampList,\n OntologyIrCondition,\n OntologyIrConditionValue,\n OntologyIrFormContent,\n OntologyIrLabelledValue,\n OntologyIrLinkTypeStatus,\n OntologyIrLogicRule,\n OntologyIrLogicRuleValue_interfaceParameterPropertyValue,\n OntologyIrLogicRuleValue_objectParameterPropertyValue,\n OntologyIrLogicRuleValue_parameterId,\n OntologyIrLogicRuleValue_staticValue,\n OntologyIrLogicRuleValue_synchronousWebhookOutput,\n OntologyIrMarketplaceInterfaceType,\n OntologyIrObjectType,\n OntologyIrParameterDateRangeValue,\n OntologyIrParameterPrefill,\n OntologyIrPropertyType,\n OntologyIrValidationRule,\n ParameterId,\n SectionId,\n SharedPropertyTypeGothamMapping,\n StructFieldType,\n ValidationRuleDisplayMetadata,\n ValueTypeApiName,\n ValueTypeApiNameReference,\n ValueTypeDataConstraint,\n ValueTypeDisplayMetadata,\n ValueTypeStatus,\n ValueTypeVersion,\n Visibility,\n} from \"@osdk/client.unstable\";\n\nimport type { OntologyFullMetadata } from \"@osdk/foundry.ontologies\";\nimport type { BlueprintIcon } from \"./iconNames.js\";\n\nexport interface Ontology extends\n Omit<\n OntologyFullMetadata,\n | \"ontology\"\n | \"sharedPropertyTypes\"\n | \"interfaceTypes\"\n | \"objectTypes\"\n | \"actionTypes\"\n | \"valueTypes\"\n >\n{\n interfaceTypes: Record<string, InterfaceType>;\n sharedPropertyTypes: Record<string, SharedPropertyType>;\n objectTypes: Record<string, ObjectType>;\n valueTypes: Record<string, ValueTypeDefinitionVersion[]>;\n linkTypes: Record<string, LinkType>;\n actionTypes: Record<string, ActionType>;\n importedTypes: ImportedTypes;\n}\n\nexport interface OntologyEntityBase {\n __type: OntologyEntityTypeEnum;\n apiName: string;\n}\n\nexport enum OntologyEntityTypeEnum {\n OBJECT_TYPE = \"OBJECT_TYPE\",\n LINK_TYPE = \"LINK_TYPE\",\n INTERFACE_TYPE = \"INTERFACE_TYPE\",\n SHARED_PROPERTY_TYPE = \"SHARED_PROPERTY_TYPE\",\n ACTION_TYPE = \"ACTION_TYPE\",\n VALUE_TYPE = \"VALUE_TYPE\",\n}\nexport interface OntologyEntityTypeMapping {\n [OntologyEntityTypeEnum.OBJECT_TYPE]: ObjectType;\n [OntologyEntityTypeEnum.ACTION_TYPE]: ActionType;\n [OntologyEntityTypeEnum.LINK_TYPE]: LinkType;\n [OntologyEntityTypeEnum.INTERFACE_TYPE]: InterfaceType;\n [OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: SharedPropertyType;\n [OntologyEntityTypeEnum.VALUE_TYPE]: ValueTypeDefinitionVersion;\n}\n\nexport type OntologyDefinition =\n & {\n [K in Exclude<OntologyEntityTypeEnum, \"VALUE_TYPE\">]: Record<\n string,\n OntologyEntityTypeMapping[K]\n >;\n }\n & {\n VALUE_TYPE: Record<string, ValueTypeDefinitionVersion[]>;\n };\n\nexport type OntologyEntityType =\n OntologyEntityTypeMapping[keyof OntologyEntityTypeMapping];\n\nexport type ActionType =\n & OntologyEntityBase\n & RequiredFields<\n Partial<ActionTypeInner>,\n \"apiName\" | \"displayName\" | \"rules\" | \"status\"\n >\n & {\n __type: OntologyEntityTypeEnum.ACTION_TYPE;\n };\n\nexport type ActionTypeDefinition = Omit<ActionType, \"__type\">;\n\nexport type ActionTypeUserDefinition = {\n objectType: ObjectTypeDefinition;\n apiName?: string;\n displayName?: string;\n status?: ActionStatus;\n parameterConfiguration?: Record<string, ActionParameterConfiguration>;\n nonParameterMappings?: Record<string, MappingValue>;\n actionLevelValidation?: ActionLevelValidationDefinition;\n excludedProperties?: Array<ParameterId>;\n sections?: Array<ActionSection>;\n defaultFormat?: DisplayMetadataConfigurationDefaultLayout;\n enableLayoutSwitch?: boolean;\n displayAndFormat?: DisplayMetadataConfigurationDisplayAndFormat;\n parameterOrdering?: Array<string>;\n submissionMetadata?: SubmissionMetadata;\n // Used for Create or Modify actions\n primaryKeyOption?: \"autoGenerated\" | \"userInput\";\n};\n\nexport const MODIFY_OBJECT_PARAMETER: string = \"objectToModifyParameter\";\n\nexport const CREATE_OR_MODIFY_OBJECT_PARAMETER: string =\n \"objectToCreateOrModifyParameter\";\n\nexport interface ActionParameter {\n id: ParameterId;\n displayName: string;\n type: ActionParameterType;\n validation: ActionParameterValidation;\n description?: string;\n typeClasses?: Array<TypeClass>;\n defaultValue?: OntologyIrParameterPrefill;\n}\n\nexport type ActionParameterValidation = Omit<\n ActionParameterConfiguration,\n \"displayName\" | \"defaultValue\"\n>;\n\nexport interface ActionParameterConfiguration {\n allowedValues?: ActionParameterAllowedValues;\n required?: ActionParameterRequirementConstraint;\n defaultVisibility?: \"editable\" | \"disabled\" | \"hidden\";\n conditionalOverrides?: Array<ActionParameterConditionalOverride>;\n defaultValue?: OntologyIrParameterPrefill;\n displayName?: string;\n description?: string;\n // should only be used on non-property parameters\n customParameterType?: ActionParameterType;\n}\n\nexport type ActionSection = {\n id: string;\n displayName: string;\n parameters: Array<string>;\n defaultVisibility?: \"visible\" | \"hidden\";\n description?: string;\n columnCount?: 1 | 2;\n showTitleBar?: boolean;\n collapsedByDefault?: boolean;\n style?: \"box\" | \"minimal\";\n conditionalOverrides?: Array<SectionConditionalOverride>;\n};\n\nexport type SubmissionMetadata = {\n submitButtonDisplayMetadata?: ButtonDisplayMetadata;\n successMessage: string;\n undoButtonConfiguration?: boolean;\n};\n\nexport type MappingValue =\n | CustomMapping\n | UuidMappingValue\n | CurrentTimeMappingValue\n | CurrentUserMappingValue;\n\nexport type UuidMappingValue = {\n type: \"uuid\";\n linkId?: string;\n};\n\nexport type CurrentTimeMappingValue = {\n type: \"currentTime\";\n};\n\nexport type CurrentUserMappingValue = {\n type: \"currentUser\";\n};\n\nexport type CustomMapping =\n | OntologyIrLogicRuleValue_parameterId\n | OntologyIrLogicRuleValue_staticValue\n | OntologyIrLogicRuleValue_objectParameterPropertyValue\n | OntologyIrLogicRuleValue_interfaceParameterPropertyValue\n | OntologyIrLogicRuleValue_synchronousWebhookOutput;\n\n// TODO(ethana): add more commonly used conditions - parameter matching, organizations, etc.\nexport type ConditionDefinition =\n | UnionCondition\n | OntologyIrCondition\n | GroupValidationRule\n | ParameterValidationRule;\n\nexport type UnionCondition = {\n type: \"and\" | \"or\";\n conditions: Array<ConditionDefinition>;\n};\n\nexport type ActionParameterConditionalOverride =\n | VisibilityOverride\n | DisabledOverride\n | RequiredOverride\n | DefaultValueOverride\n | ConstraintOverride;\n\nexport type SectionConditionalOverride = VisibilityOverride;\n\nexport type VisibilityOverride = {\n type: \"visibility\";\n condition: ConditionDefinition;\n};\n\nexport type DisabledOverride = {\n type: \"disabled\";\n condition: ConditionDefinition;\n};\n\nexport type RequiredOverride = {\n type: \"required\";\n condition: ConditionDefinition;\n};\n\nexport type DefaultValueOverride = {\n type: \"defaultValue\";\n condition: ConditionDefinition;\n defaultValue: OntologyIrParameterPrefill;\n};\n\nexport type ConstraintOverride = {\n type: \"constraint\";\n condition: ConditionDefinition;\n constraint: ActionParameterAllowedValues;\n};\n\nexport type ActionParameterRequirementConstraint =\n | boolean\n | { listLength: { min?: number; max?: number } };\n\n// TODO(dpaquin): cleanup? or does \"type: foo\" actually make sense here\nexport type ActionParameterAllowedValues =\n | {\n type: \"oneOf\";\n oneOf: Array<OntologyIrLabelledValue>;\n otherValueAllowed?: boolean;\n }\n | {\n type: \"range\";\n min?: OntologyIrConditionValue;\n max?: OntologyIrConditionValue;\n }\n | { type: \"text\"; minLength?: number; maxLength?: number; regex?: string }\n | {\n type: \"datetime\";\n maximum?: OntologyIrParameterDateRangeValue;\n minimum?: OntologyIrParameterDateRangeValue;\n }\n | { type: \"objectTypeReference\"; interfaceTypes: Array<InterfaceTypeApiName> }\n | { type: \"objectQuery\" }\n | { type: \"attachment\" }\n | { type: \"boolean\" }\n | { type: \"objectSetRid\" }\n | { type: \"cbacMarking\" }\n | { type: \"mandatoryMarking\" }\n | { type: \"objectList\" }\n | { type: \"mediaReference\" }\n | { type: \"timeSeriesReference\" }\n | { type: \"geohash\" }\n | { type: \"geoshape\" }\n | { type: \"geotimeSeriesReference\" }\n | { type: \"interfaceObjectQuery\" }\n | { type: \"redacted\" };\n\nexport interface ActionTypeInner {\n apiName: ActionTypeApiName;\n displayName: string;\n description: string;\n icon: { locator: BlueprintIcon; color: string };\n parameters: Array<ActionParameter>;\n rules: Array<OntologyIrLogicRule>;\n sections: Record<SectionId, ActionSection>;\n status: ActionStatus;\n entities: OntologyIrActionTypeEntities;\n parameterOrdering: Array<string>;\n formContentOrdering: Array<OntologyIrFormContent>;\n validation: Array<OntologyIrValidationRule>;\n typeClasses: Array<TypeClass>;\n defaultFormat: DisplayMetadataConfigurationDefaultLayout;\n enableLayoutSwitch: boolean;\n displayAndFormat: DisplayMetadataConfigurationDisplayAndFormat;\n submissionMetadata: SubmissionMetadata;\n}\n\nexport type ActionValidationRule = OntologyIrValidationRule;\n\nexport type ActionLevelValidationDefinition = {\n condition: ConditionDefinition;\n displayMetadata?: ValidationRuleDisplayMetadata;\n};\n\nexport type GroupValidationRule = {\n type: \"group\";\n name: string;\n};\n\nexport type ParameterValidationRule = {\n type: \"parameter\";\n parameterId: string;\n matches: OntologyIrConditionValue;\n};\n\nexport type ActionStatus =\n | \"active\"\n | \"experimental\"\n | \"example\"\n | ActionTypeStatus_deprecated;\n\nexport type { InterfaceTypeStatus };\n\nexport type ObjectTypeStatus =\n | \"active\"\n | \"experimental\"\n | {\n type: \"deprecated\";\n message: string;\n deadline: string;\n };\n\nexport type RequiredFields<T, K extends keyof T> = T & Required<Pick<T, K>>;\nexport type OptionalFields<T, K extends keyof T> =\n & Pick<Partial<T>, K>\n & Omit<T, K>;\n\nexport interface ObjectTypeInner extends\n Omit<\n OntologyIrObjectType,\n | \"titlePropertyTypeRid\"\n | \"propertyTypes\"\n | \"allImplementsInterfaces\"\n | \"implementsInterfaces2\"\n | \"displayMetadata\"\n | \"primaryKeys\"\n | \"status\"\n >\n{\n primaryKeyPropertyApiName: string;\n properties: Array<ObjectPropertyType>;\n titlePropertyApiName: string;\n implementsInterfaces: Array<InterfaceImplementation>;\n description: string | undefined;\n icon: { locator: BlueprintIcon; color: string } | undefined;\n displayName: string;\n pluralDisplayName: string;\n visibility: Visibility;\n editsEnabled: boolean;\n status?: ObjectTypeStatus;\n}\n\nexport type InterfaceImplementation = {\n implements: InterfaceType;\n propertyMapping: { interfaceProperty: string; mapsTo: string }[];\n};\n\nexport type ObjectType =\n & OntologyEntityBase\n & RequiredFields<\n Partial<ObjectTypeInner>,\n | \"apiName\"\n | \"primaryKeyPropertyApiName\"\n | \"displayName\"\n | \"pluralDisplayName\"\n | \"titlePropertyApiName\"\n >\n & {\n datasource?: ObjectTypeDatasourceDefinition;\n __type: OntologyEntityTypeEnum.OBJECT_TYPE;\n };\n\nexport type ObjectTypeDefinition = {\n apiName: string;\n primaryKeyPropertyApiName: string;\n displayName: string;\n pluralDisplayName: string;\n titlePropertyApiName: string;\n properties?: { [key: string]: ObjectPropertyTypeUserDefinition };\n implementsInterfaces?: Array<InterfaceImplementation>;\n description?: string;\n icon?: { locator: BlueprintIcon; color: string };\n visibility?: Visibility;\n editsEnabled?: boolean;\n status?: ObjectTypeStatus;\n datasource?: ObjectTypeDatasourceDefinition;\n};\n\nexport interface ObjectPropertyTypeInner extends\n Omit<\n OntologyIrPropertyType,\n | \"sharedPropertyTypeApiName\"\n | \"type\"\n | \"inlineAction\"\n | \"sharedPropertyTypeRid\"\n | \"valueType\"\n | \"ruleSetBinding\"\n | \"displayMetadata\"\n | \"dataConstraints\"\n | \"status\"\n >\n{\n type: PropertyTypeType;\n array?: boolean;\n valueType: ValueTypeDefinitionVersion;\n sharedPropertyType: SharedPropertyType;\n description: string | undefined;\n displayName: string;\n visibility: Visibility;\n nullability?: Nullability;\n status?: ObjectTypeStatus;\n editOnly?: boolean;\n}\n\nexport type ObjectPropertyType = RequiredFields<\n Partial<ObjectPropertyTypeInner>,\n \"apiName\" | \"type\" | \"displayName\"\n>;\n\nexport type ObjectPropertyTypeUserDefinition = RequiredFields<\n Partial<ObjectPropertyTypeInner>,\n \"type\"\n>;\n\nexport interface InterfacePropertyType {\n sharedPropertyType: SharedPropertyType;\n required: boolean;\n}\nexport interface InterfaceType extends\n OntologyEntityBase,\n Omit<\n OntologyIrMarketplaceInterfaceType,\n // we want our simplified representation\n | \"properties\"\n // these things don't need to exist as the system works fine without them (I'm told)\n | \"allProperties\"\n | \"allLinks\"\n | \"extendsInterfaces\"\n | \"allExtendsInterfaces\"\n | \"propertiesV2\"\n | \"allPropertiesV2\"\n | \"propertiesV3\"\n | \"allPropertiesV3\"\n >\n{\n propertiesV2: Record<string, InterfacePropertyType>;\n extendsInterfaces: Array<InterfaceType>;\n status: InterfaceTypeStatus;\n __type: OntologyEntityTypeEnum.INTERFACE_TYPE;\n}\n\nexport interface PropertyType {\n type: PropertyTypeType;\n array?: boolean;\n description?: string;\n displayName?: string;\n valueType?: ValueTypeApiNameReference;\n visibility?: Visibility;\n typeClasses?: TypeClass[];\n nullability?: Nullability;\n}\n\nexport interface Nullability {\n noEmptyCollections: boolean;\n noNulls: boolean;\n}\n\nexport type TypeClass = { kind: string; name: string };\n\nexport interface SharedPropertyType extends OntologyEntityBase, PropertyType {\n apiName: string;\n nonNameSpacedApiName: string;\n gothamMapping?: SharedPropertyTypeGothamMapping;\n __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE;\n}\n\nexport type PropertyTypeType =\n | PropertyTypeTypePrimitive\n | PropertyTypeTypeExotic;\n\nexport type PropertyTypeTypePrimitive =\n | \"boolean\"\n | \"byte\"\n | \"date\"\n | \"decimal\"\n | \"double\"\n | \"float\"\n | \"integer\"\n | \"long\"\n | \"short\"\n | \"string\"\n | \"timestamp\";\n\nexport type PropertyTypeTypeExotic =\n | \"geopoint\"\n | \"geoshape\"\n | \"mediaReference\"\n | \"geotimeSeries\"\n | PropertyTypeTypeMarking\n | PropertyTypeTypeStruct\n | PropertyTypeTypeString;\n\ntype PropertyTypeTypeMarking = {\n type: \"marking\";\n markingType: \"MANDATORY\" | \"CBAC\";\n markingInputGroupName: string;\n};\n\nexport type PropertyTypeTypeStruct = {\n type: \"struct\";\n structDefinition: {\n [api_name: string]:\n | StructPropertyType\n | Exclude<PropertyTypeTypesWithoutStruct, PropertyTypeTypeMarking>;\n };\n};\n\ntype PropertyTypeTypeString = {\n type: \"string\";\n isLongText: boolean;\n supportsEfficientLeadingWildcard: boolean;\n supportsExactMatching: boolean;\n};\n\nexport type PropertyTypeTypesWithoutStruct = Exclude<\n PropertyTypeType,\n PropertyTypeTypeStruct\n>;\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport interface StructPropertyType extends\n Optional<\n Omit<\n StructFieldType,\n \"fieldType\" | \"structFieldRid\" | \"apiName\"\n >,\n \"typeClasses\" | \"aliases\"\n >\n{\n fieldType: PropertyTypeTypesWithoutStruct;\n}\n\nexport type ObjectTypePropertyApiName = string;\nexport type LinkTypeId = string;\n\nexport type LinkType =\n | (OntologyEntityBase & OneToManyLinkTypeDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n })\n | (OntologyEntityBase & ManyToManyLinkTypeDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n });\n\nexport type LinkTypeDefinition =\n | Omit<\n OntologyEntityBase & OneToManyLinkTypeUserDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n },\n \"__type\"\n >\n | Omit<\n OntologyEntityBase & ManyToManyLinkTypeUserDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n },\n \"__type\"\n >;\n\nexport interface OneToManyLinkTypeDefinition {\n apiName: LinkTypeId;\n one: OneToManyObjectLinkReference;\n toMany: OneToManyObjectLinkReference;\n manyForeignKeyProperty: ObjectTypePropertyApiName;\n cardinality: \"OneToMany\" | \"OneToOne\" | undefined;\n editsEnabled?: boolean;\n status?: OntologyIrLinkTypeStatus;\n redacted?: boolean;\n}\n\nexport interface OneToManyObjectLinkReference {\n object: ObjectTypeDefinition;\n metadata: LinkTypeMetadata;\n}\n\nexport interface OneToManyLinkTypeUserDefinition {\n apiName: LinkTypeId;\n one: OneToManyObjectLinkReferenceUserDefinition;\n toMany: OneToManyObjectLinkReferenceUserDefinition;\n manyForeignKeyProperty: ObjectTypePropertyApiName;\n cardinality?: \"OneToMany\" | \"OneToOne\" | undefined;\n}\n\nexport interface OneToManyObjectLinkReferenceUserDefinition {\n object: ObjectTypeDefinition;\n metadata: LinkTypeMetadataUserDefinition;\n}\n\nexport interface ManyToManyLinkTypeDefinition {\n apiName: LinkTypeId;\n many: ManyToManyObjectLinkReference;\n toMany: ManyToManyObjectLinkReference;\n editsEnabled?: boolean;\n status?: OntologyIrLinkTypeStatus;\n redacted?: boolean;\n}\n\nexport interface ManyToManyObjectLinkReference {\n object: ObjectTypeDefinition;\n metadata: LinkTypeMetadata;\n}\n\nexport interface ManyToManyLinkTypeUserDefinition {\n apiName: LinkTypeId;\n many: ManyToManyObjectLinkReferenceUserDefinition;\n toMany: ManyToManyObjectLinkReferenceUserDefinition;\n}\n\nexport interface ManyToManyObjectLinkReferenceUserDefinition {\n object: ObjectTypeDefinition;\n metadata: LinkTypeMetadataUserDefinition;\n}\n\nexport interface LinkTypeMetadataUserDefinition {\n apiName: string;\n displayName?: string;\n pluralDisplayName?: string;\n visibility?: Visibility;\n groupDisplayName?: string;\n}\n\nexport type LinkSideMetadata = OptionalFields<\n RequiredFields<\n Omit<LinkTypeMetadata, \"displayMetadata\"> & LinkTypeDisplayMetadata,\n \"apiName\"\n >,\n \"visibility\" | \"typeClasses\"\n>;\nexport interface ValueTypeType_array {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"array\" }>[\"array\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"array\";\n value: {\n type: \"array\";\n elementType: ValueTypeType[\"value\"];\n };\n}\n\nexport interface ValueTypeType_boolean {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"boolean\" }>[\"boolean\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"boolean\";\n value: \"boolean\";\n}\n\nexport interface ValueTypeType_binary {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"binary\" }>[\"binary\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"binary\";\n value: \"binary\";\n}\n\nexport interface ValueTypeType_byte {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"byte\" }>[\"byte\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"byte\";\n value: \"byte\";\n}\n\nexport interface ValueTypeType_date {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"date\" }>[\"date\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"date\";\n value: \"date\";\n}\n\nexport interface ValueTypeType_decimal {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"decimal\" }>[\"decimal\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"decimal\";\n value: \"decimal\";\n}\n\nexport interface ValueTypeType_double {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"double\" }>[\"double\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"double\";\n value: \"double\";\n}\n\nexport interface ValueTypeType_float {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"float\" }>[\"float\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"float\";\n value: \"float\";\n}\n\nexport interface ValueTypeType_integer {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"integer\" }>[\"integer\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"integer\";\n value: \"integer\";\n}\n\nexport interface ValueTypeType_long {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"long\" }>[\"long\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"long\";\n value: \"long\";\n}\n\nexport interface ValueTypeType_map {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"map\" }>[\"map\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"map\";\n value: {\n type: \"map\";\n keyType: ValueTypeType[\"value\"];\n valueType: ValueTypeType[\"value\"];\n };\n}\n\nexport interface ValueTypeType_optional {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"optional\" }>[\"optional\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"optional\";\n value: {\n type: \"optional\";\n wrappedType: ValueTypeType[\"value\"];\n };\n}\n\nexport interface ValueTypeType_short {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"short\" }>[\"short\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"short\";\n value: \"short\";\n}\n\nexport interface ValueTypeType_string {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"string\" }>[\"string\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"string\";\n value: \"string\";\n}\n\nexport interface ValueTypeType_structV2 {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"structV2\" }>[\"structV2\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"structV2\";\n value: {\n type: \"struct\";\n fields: Array<{\n identifier: string;\n baseType: ValueTypeType[\"value\"];\n }>;\n };\n}\nexport interface ValueTypeType_timestamp {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"timestamp\" }>[\"timestamp\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"timestamp\";\n value: \"timestamp\";\n}\n\nexport type ValueTypeType =\n | ValueTypeType_array\n | ValueTypeType_boolean\n | ValueTypeType_binary\n | ValueTypeType_byte\n | ValueTypeType_date\n | ValueTypeType_decimal\n | ValueTypeType_double\n | ValueTypeType_float\n | ValueTypeType_integer\n | ValueTypeType_long\n | ValueTypeType_map\n | ValueTypeType_optional\n | ValueTypeType_short\n | ValueTypeType_string\n | ValueTypeType_structV2\n | ValueTypeType_timestamp;\n\nexport type ValueTypeDefinitionVersion = OntologyEntityBase & {\n apiName: ValueTypeApiName;\n displayMetadata: ValueTypeDisplayMetadata;\n status: ValueTypeStatus;\n version: ValueTypeVersion;\n baseType: BaseType;\n constraints: ValueTypeDataConstraint[];\n exampleValues: ExampleValue[];\n __type: OntologyEntityTypeEnum.VALUE_TYPE;\n};\n\nexport interface ObjectTypeDatasourceDefinition_dataset {\n type: \"dataset\";\n}\n\nexport interface ObjectTypeDatasourceDefinition_stream {\n type: \"stream\";\n // Retention period must be in ISO 8601 duration format\n retentionPeriod?: string;\n}\n\nexport interface ObjectTypeDatasourceDefinition_restrictedView {\n type: \"restrictedView\";\n}\n\nexport type ObjectTypeDatasourceDefinition =\n | ObjectTypeDatasourceDefinition_stream\n | ObjectTypeDatasourceDefinition_dataset\n | ObjectTypeDatasourceDefinition_restrictedView;\n\nexport type ActionParameterTypePrimitive =\n | \"boolean\"\n | \"booleanList\"\n | \"integer\"\n | \"integerList\"\n | \"long\"\n | \"longList\"\n | \"double\"\n | \"doubleList\"\n | \"string\"\n | \"stringList\"\n | \"decimal\"\n | \"decimalList\"\n | \"timestamp\"\n | \"timestampList\"\n | \"geohash\"\n | \"geohashList\"\n | \"geoshape\"\n | \"geoshapeList\"\n | \"timeSeriesReference\"\n | \"date\"\n | \"dateList\"\n | \"objectTypeReference\"\n | \"attachment\"\n | \"attachmentList\"\n | \"marking\"\n | \"markingList\"\n | \"mediaReference\"\n | \"mediaReferenceList\"\n | \"geotimeSeriesReference\"\n | \"geotimeSeriesReferenceList\";\n\nexport type ActionParameterTypeComplex =\n | OntologyIrBaseParameterType_decimal\n | OntologyIrBaseParameterType_decimalList\n | OntologyIrBaseParameterType_timestamp\n | OntologyIrBaseParameterType_timestampList\n | OntologyIrBaseParameterType_objectReference\n | OntologyIrBaseParameterType_objectReferenceList\n | OntologyIrBaseParameterType_objectSetRid\n | OntologyIrBaseParameterType_objectTypeReference\n | OntologyIrBaseParameterType_objectReference\n | OntologyIrBaseParameterType_interfaceReference\n | OntologyIrBaseParameterType_interfaceReferenceList\n | OntologyIrBaseParameterType_struct\n | OntologyIrBaseParameterType_structList;\n\nexport type ActionParameterType =\n | ActionParameterTypePrimitive\n | ActionParameterTypeComplex;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyFA,WAAYA,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AA8DlC,OAAO,MAAMC,uBAA+B,GAAG,yBAAyB;AAExE,OAAO,MAAMC,iCAAyC,GACpD,iCAAiC;;AA0EnC;;AAoDA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"types.js","names":["OntologyEntityTypeEnum","MODIFY_OBJECT_PARAMETER","CREATE_OR_MODIFY_OBJECT_PARAMETER"],"sources":["types.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 {\n ActionTypeApiName,\n ActionTypeStatus_deprecated,\n BaseType,\n ButtonDisplayMetadata,\n DataConstraint,\n DisplayMetadataConfigurationDefaultLayout,\n DisplayMetadataConfigurationDisplayAndFormat,\n ExampleValue,\n FailureMessage,\n InterfaceTypeApiName,\n InterfaceTypeStatus,\n LinkTypeDisplayMetadata,\n LinkTypeMetadata,\n OntologyIrActionTypeEntities,\n OntologyIrBaseParameterType_decimal,\n OntologyIrBaseParameterType_decimalList,\n OntologyIrBaseParameterType_interfaceReference,\n OntologyIrBaseParameterType_interfaceReferenceList,\n OntologyIrBaseParameterType_objectReference,\n OntologyIrBaseParameterType_objectReferenceList,\n OntologyIrBaseParameterType_objectSetRid,\n OntologyIrBaseParameterType_objectTypeReference,\n OntologyIrBaseParameterType_struct,\n OntologyIrBaseParameterType_structList,\n OntologyIrBaseParameterType_timestamp,\n OntologyIrBaseParameterType_timestampList,\n OntologyIrCondition,\n OntologyIrConditionValue,\n OntologyIrFormContent,\n OntologyIrLabelledValue,\n OntologyIrLinkTypeStatus,\n OntologyIrLogicRule,\n OntologyIrLogicRuleValue_interfaceParameterPropertyValue,\n OntologyIrLogicRuleValue_objectParameterPropertyValue,\n OntologyIrLogicRuleValue_parameterId,\n OntologyIrLogicRuleValue_staticValue,\n OntologyIrLogicRuleValue_synchronousWebhookOutput,\n OntologyIrMarketplaceInterfaceType,\n OntologyIrObjectType,\n OntologyIrParameterDateRangeValue,\n OntologyIrParameterPrefill,\n OntologyIrPropertyType,\n OntologyIrValidationRule,\n OntologyIrValueTypeReferenceWithMetadata,\n ParameterId,\n SectionId,\n SharedPropertyTypeGothamMapping,\n StructFieldType,\n ValidationRuleDisplayMetadata,\n ValueTypeApiName,\n ValueTypeDataConstraint,\n ValueTypeDisplayMetadata,\n ValueTypeStatus,\n ValueTypeVersion,\n Visibility,\n} from \"@osdk/client.unstable\";\n\nimport type { BlueprintIcon } from \"./iconNames.js\";\n\nexport interface OntologyEntityBase {\n __type: OntologyEntityTypeEnum;\n apiName: string;\n}\n\nexport enum OntologyEntityTypeEnum {\n OBJECT_TYPE = \"OBJECT_TYPE\",\n LINK_TYPE = \"LINK_TYPE\",\n INTERFACE_TYPE = \"INTERFACE_TYPE\",\n SHARED_PROPERTY_TYPE = \"SHARED_PROPERTY_TYPE\",\n ACTION_TYPE = \"ACTION_TYPE\",\n VALUE_TYPE = \"VALUE_TYPE\",\n}\nexport interface OntologyEntityTypeMapping {\n [OntologyEntityTypeEnum.OBJECT_TYPE]: ObjectType;\n [OntologyEntityTypeEnum.ACTION_TYPE]: ActionType;\n [OntologyEntityTypeEnum.LINK_TYPE]: LinkType;\n [OntologyEntityTypeEnum.INTERFACE_TYPE]: InterfaceType;\n [OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: SharedPropertyType;\n [OntologyEntityTypeEnum.VALUE_TYPE]: ValueTypeDefinitionVersion;\n}\n\nexport type OntologyDefinition =\n & {\n [K in Exclude<OntologyEntityTypeEnum, \"VALUE_TYPE\">]: Record<\n string,\n OntologyEntityTypeMapping[K]\n >;\n }\n & {\n VALUE_TYPE: Record<string, ValueTypeDefinitionVersion[]>;\n };\n\nexport type OntologyEntityType =\n OntologyEntityTypeMapping[keyof OntologyEntityTypeMapping];\n\nexport type ActionType =\n & OntologyEntityBase\n & RequiredFields<\n Partial<ActionTypeInner>,\n \"apiName\" | \"displayName\" | \"rules\" | \"status\"\n >\n & {\n __type: OntologyEntityTypeEnum.ACTION_TYPE;\n };\n\nexport type ActionTypeDefinition = Omit<ActionType, \"__type\">;\n\nexport type ActionTypeUserDefinition = {\n objectType: ObjectTypeDefinition;\n apiName?: string;\n displayName?: string;\n status?: ActionStatus;\n parameterConfiguration?: Record<string, ActionParameterConfiguration>;\n nonParameterMappings?: Record<string, MappingValue>;\n actionLevelValidation?: ActionLevelValidationDefinition;\n excludedProperties?: Array<ParameterId>;\n sections?: Array<ActionSection>;\n defaultFormat?: DisplayMetadataConfigurationDefaultLayout;\n enableLayoutSwitch?: boolean;\n displayAndFormat?: DisplayMetadataConfigurationDisplayAndFormat;\n parameterOrdering?: Array<string>;\n submissionMetadata?: SubmissionMetadata;\n // Used for Create or Modify actions\n primaryKeyOption?: \"autoGenerated\" | \"userInput\";\n};\n\nexport const MODIFY_OBJECT_PARAMETER: string = \"objectToModifyParameter\";\n\nexport const CREATE_OR_MODIFY_OBJECT_PARAMETER: string =\n \"objectToCreateOrModifyParameter\";\n\nexport interface ActionParameter {\n id: ParameterId;\n displayName: string;\n type: ActionParameterType;\n validation: ActionParameterValidation;\n description?: string;\n typeClasses?: Array<TypeClass>;\n defaultValue?: OntologyIrParameterPrefill;\n}\n\nexport type ActionParameterValidation = Omit<\n ActionParameterConfiguration,\n \"displayName\" | \"defaultValue\"\n>;\n\nexport interface ActionParameterConfiguration {\n allowedValues?: ActionParameterAllowedValues;\n required?: ActionParameterRequirementConstraint;\n defaultVisibility?: \"editable\" | \"disabled\" | \"hidden\";\n conditionalOverrides?: Array<ActionParameterConditionalOverride>;\n defaultValue?: OntologyIrParameterPrefill;\n displayName?: string;\n description?: string;\n // should only be used on non-property parameters\n customParameterType?: ActionParameterType;\n}\n\nexport type ActionSection = {\n id: string;\n displayName: string;\n parameters: Array<string>;\n defaultVisibility?: \"visible\" | \"hidden\";\n description?: string;\n columnCount?: 1 | 2;\n showTitleBar?: boolean;\n collapsedByDefault?: boolean;\n style?: \"box\" | \"minimal\";\n conditionalOverrides?: Array<SectionConditionalOverride>;\n};\n\nexport type SubmissionMetadata = {\n submitButtonDisplayMetadata?: ButtonDisplayMetadata;\n successMessage: string;\n undoButtonConfiguration?: boolean;\n};\n\nexport type MappingValue =\n | CustomMapping\n | UuidMappingValue\n | CurrentTimeMappingValue\n | CurrentUserMappingValue;\n\nexport type UuidMappingValue = {\n type: \"uuid\";\n linkId?: string;\n};\n\nexport type CurrentTimeMappingValue = {\n type: \"currentTime\";\n};\n\nexport type CurrentUserMappingValue = {\n type: \"currentUser\";\n};\n\nexport type CustomMapping =\n | OntologyIrLogicRuleValue_parameterId\n | OntologyIrLogicRuleValue_staticValue\n | OntologyIrLogicRuleValue_objectParameterPropertyValue\n | OntologyIrLogicRuleValue_interfaceParameterPropertyValue\n | OntologyIrLogicRuleValue_synchronousWebhookOutput;\n\n// TODO(ethana): add more commonly used conditions - parameter matching, organizations, etc.\nexport type ConditionDefinition =\n | UnionCondition\n | OntologyIrCondition\n | GroupValidationRule\n | ParameterValidationRule;\n\nexport type UnionCondition = {\n type: \"and\" | \"or\";\n conditions: Array<ConditionDefinition>;\n};\n\nexport type ActionParameterConditionalOverride =\n | VisibilityOverride\n | DisabledOverride\n | RequiredOverride\n | DefaultValueOverride\n | ConstraintOverride;\n\nexport type SectionConditionalOverride = VisibilityOverride;\n\nexport type VisibilityOverride = {\n type: \"visibility\";\n condition: ConditionDefinition;\n};\n\nexport type DisabledOverride = {\n type: \"disabled\";\n condition: ConditionDefinition;\n};\n\nexport type RequiredOverride = {\n type: \"required\";\n condition: ConditionDefinition;\n};\n\nexport type DefaultValueOverride = {\n type: \"defaultValue\";\n condition: ConditionDefinition;\n defaultValue: OntologyIrParameterPrefill;\n};\n\nexport type ConstraintOverride = {\n type: \"constraint\";\n condition: ConditionDefinition;\n constraint: ActionParameterAllowedValues;\n};\n\nexport type ActionParameterRequirementConstraint =\n | boolean\n | { listLength: { min?: number; max?: number } };\n\n// TODO(dpaquin): cleanup? or does \"type: foo\" actually make sense here\nexport type ActionParameterAllowedValues =\n | {\n type: \"oneOf\";\n oneOf: Array<OntologyIrLabelledValue>;\n otherValueAllowed?: boolean;\n }\n | {\n type: \"range\";\n min?: OntologyIrConditionValue;\n max?: OntologyIrConditionValue;\n }\n | { type: \"text\"; minLength?: number; maxLength?: number; regex?: string }\n | {\n type: \"datetime\";\n maximum?: OntologyIrParameterDateRangeValue;\n minimum?: OntologyIrParameterDateRangeValue;\n }\n | { type: \"objectTypeReference\"; interfaceTypes: Array<InterfaceTypeApiName> }\n | { type: \"objectQuery\" }\n | { type: \"attachment\" }\n | { type: \"boolean\" }\n | { type: \"objectSetRid\" }\n | { type: \"cbacMarking\" }\n | { type: \"mandatoryMarking\" }\n | { type: \"objectList\" }\n | { type: \"mediaReference\" }\n | { type: \"timeSeriesReference\" }\n | { type: \"geohash\" }\n | { type: \"geoshape\" }\n | { type: \"geotimeSeriesReference\" }\n | { type: \"interfaceObjectQuery\" }\n | { type: \"redacted\" };\n\nexport interface ActionTypeInner {\n apiName: ActionTypeApiName;\n displayName: string;\n description: string;\n icon: { locator: BlueprintIcon; color: string };\n parameters: Array<ActionParameter>;\n rules: Array<OntologyIrLogicRule>;\n sections: Record<SectionId, ActionSection>;\n status: ActionStatus;\n entities: OntologyIrActionTypeEntities;\n parameterOrdering: Array<string>;\n formContentOrdering: Array<OntologyIrFormContent>;\n validation: Array<OntologyIrValidationRule>;\n typeClasses: Array<TypeClass>;\n defaultFormat: DisplayMetadataConfigurationDefaultLayout;\n enableLayoutSwitch: boolean;\n displayAndFormat: DisplayMetadataConfigurationDisplayAndFormat;\n submissionMetadata: SubmissionMetadata;\n}\n\nexport type ActionValidationRule = OntologyIrValidationRule;\n\nexport type ActionLevelValidationDefinition = Array<ActionLevelValidationRule>;\n\nexport type ActionLevelValidationRule = {\n condition: ConditionDefinition;\n displayMetadata?: ValidationRuleDisplayMetadata;\n};\n\nexport type GroupValidationRule = {\n type: \"group\";\n name: string;\n};\n\nexport type ParameterValidationRule = {\n type: \"parameter\";\n parameterId: string;\n matches: OntologyIrConditionValue;\n};\n\nexport type ActionStatus =\n | \"active\"\n | \"experimental\"\n | \"example\"\n | ActionTypeStatus_deprecated;\n\nexport type { InterfaceTypeStatus };\n\nexport type ObjectTypeStatus =\n | \"active\"\n | \"experimental\"\n | {\n type: \"deprecated\";\n message: string;\n deadline: string;\n };\n\nexport type RequiredFields<T, K extends keyof T> = T & Required<Pick<T, K>>;\nexport type OptionalFields<T, K extends keyof T> =\n & Pick<Partial<T>, K>\n & Omit<T, K>;\n\nexport interface ObjectTypeInner extends\n Omit<\n OntologyIrObjectType,\n | \"titlePropertyTypeRid\"\n | \"propertyTypes\"\n | \"allImplementsInterfaces\"\n | \"implementsInterfaces2\"\n | \"displayMetadata\"\n | \"primaryKeys\"\n | \"status\"\n >\n{\n primaryKeyPropertyApiName: string;\n properties: Array<ObjectPropertyType>;\n titlePropertyApiName: string;\n implementsInterfaces: Array<InterfaceImplementation>;\n description: string | undefined;\n icon: { locator: BlueprintIcon; color: string } | undefined;\n displayName: string;\n pluralDisplayName: string;\n visibility: Visibility;\n editsEnabled: boolean;\n status?: ObjectTypeStatus;\n}\n\nexport type InterfaceImplementation = {\n implements: InterfaceType;\n propertyMapping: { interfaceProperty: string; mapsTo: string }[];\n};\n\nexport type ObjectType =\n & OntologyEntityBase\n & RequiredFields<\n Partial<ObjectTypeInner>,\n | \"apiName\"\n | \"primaryKeyPropertyApiName\"\n | \"displayName\"\n | \"pluralDisplayName\"\n | \"titlePropertyApiName\"\n >\n & {\n datasource?: ObjectTypeDatasourceDefinition;\n __type: OntologyEntityTypeEnum.OBJECT_TYPE;\n };\n\nexport type ObjectTypeDefinition = {\n apiName: string;\n primaryKeyPropertyApiName: string;\n displayName: string;\n pluralDisplayName: string;\n titlePropertyApiName: string;\n properties?: { [key: string]: ObjectPropertyTypeUserDefinition };\n implementsInterfaces?: Array<InterfaceImplementation>;\n description?: string;\n icon?: { locator: BlueprintIcon; color: string };\n visibility?: Visibility;\n editsEnabled?: boolean;\n status?: ObjectTypeStatus;\n datasource?: ObjectTypeDatasourceDefinition;\n};\n\nexport interface ObjectPropertyTypeInner extends\n Omit<\n OntologyIrPropertyType,\n | \"sharedPropertyTypeApiName\"\n | \"type\"\n | \"inlineAction\"\n | \"sharedPropertyTypeRid\"\n | \"valueType\"\n | \"ruleSetBinding\"\n | \"displayMetadata\"\n | \"dataConstraints\"\n | \"status\"\n >\n{\n type: PropertyTypeType;\n array?: boolean;\n valueType: ValueTypeDefinitionVersion;\n sharedPropertyType: SharedPropertyType;\n description: string | undefined;\n displayName: string;\n visibility: Visibility;\n nullability?: Nullability;\n status?: ObjectTypeStatus;\n editOnly?: boolean;\n}\n\nexport type ObjectPropertyType = RequiredFields<\n Partial<ObjectPropertyTypeInner>,\n \"apiName\" | \"type\" | \"displayName\"\n>;\n\nexport type ObjectPropertyTypeUserDefinition = RequiredFields<\n Partial<ObjectPropertyTypeInner>,\n \"type\"\n>;\n\nexport interface InterfacePropertyType {\n sharedPropertyType: SharedPropertyType;\n required: boolean;\n}\nexport interface InterfaceType extends\n OntologyEntityBase,\n Omit<\n OntologyIrMarketplaceInterfaceType,\n // we want our simplified representation\n | \"properties\"\n // these things don't need to exist as the system works fine without them (I'm told)\n | \"propertiesV2\"\n | \"propertiesV3\"\n | \"extendsInterfaces\"\n >\n{\n propertiesV2: Record<string, InterfacePropertyType>;\n extendsInterfaces: Array<InterfaceType>;\n status: InterfaceTypeStatus;\n __type: OntologyEntityTypeEnum.INTERFACE_TYPE;\n}\n\nexport interface PropertyType {\n type: PropertyTypeType;\n array?: boolean;\n description?: string;\n displayName?: string;\n valueType?: OntologyIrValueTypeReferenceWithMetadata;\n visibility?: Visibility;\n typeClasses?: TypeClass[];\n nullability?: Nullability;\n}\n\nexport interface Nullability {\n noEmptyCollections: boolean;\n noNulls: boolean;\n}\n\nexport type TypeClass = { kind: string; name: string };\n\nexport interface SharedPropertyType extends OntologyEntityBase, PropertyType {\n apiName: string;\n nonNameSpacedApiName: string;\n gothamMapping?: SharedPropertyTypeGothamMapping;\n __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE;\n}\n\nexport type PropertyTypeType =\n | PropertyTypeTypePrimitive\n | PropertyTypeTypeExotic;\n\nexport type PropertyTypeTypePrimitive =\n | \"boolean\"\n | \"byte\"\n | \"date\"\n | \"decimal\"\n | \"double\"\n | \"float\"\n | \"integer\"\n | \"long\"\n | \"short\"\n | \"string\"\n | \"timestamp\";\n\nexport type PropertyTypeTypeExotic =\n | \"geopoint\"\n | \"geoshape\"\n | \"mediaReference\"\n | \"geotimeSeries\"\n | PropertyTypeTypeMarking\n | PropertyTypeTypeStruct\n | PropertyTypeTypeString;\n\ntype PropertyTypeTypeMarking = {\n type: \"marking\";\n markingType: \"MANDATORY\" | \"CBAC\";\n markingInputGroupName: string;\n};\n\nexport type PropertyTypeTypeStruct = {\n type: \"struct\";\n structDefinition: {\n [api_name: string]:\n | StructPropertyType\n | Exclude<PropertyTypeTypesWithoutStruct, PropertyTypeTypeMarking>;\n };\n};\n\ntype PropertyTypeTypeString = {\n type: \"string\";\n isLongText: boolean;\n supportsEfficientLeadingWildcard: boolean;\n supportsExactMatching: boolean;\n};\n\nexport type PropertyTypeTypesWithoutStruct = Exclude<\n PropertyTypeType,\n PropertyTypeTypeStruct\n>;\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport interface StructPropertyType extends\n Optional<\n Omit<\n StructFieldType,\n \"fieldType\" | \"structFieldRid\" | \"apiName\"\n >,\n \"typeClasses\" | \"aliases\"\n >\n{\n fieldType: PropertyTypeTypesWithoutStruct;\n}\n\nexport type ObjectTypePropertyApiName = string;\nexport type LinkTypeId = string;\n\nexport type LinkType =\n | (OntologyEntityBase & OneToManyLinkTypeDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n })\n | (OntologyEntityBase & ManyToManyLinkTypeDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n });\n\nexport type LinkTypeDefinition =\n | Omit<\n OntologyEntityBase & OneToManyLinkTypeUserDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n },\n \"__type\"\n >\n | Omit<\n OntologyEntityBase & ManyToManyLinkTypeUserDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n },\n \"__type\"\n >;\n\nexport interface OneToManyLinkTypeDefinition {\n apiName: LinkTypeId;\n one: OneToManyObjectLinkReference;\n toMany: OneToManyObjectLinkReference;\n manyForeignKeyProperty: ObjectTypePropertyApiName;\n cardinality: \"OneToMany\" | \"OneToOne\" | undefined;\n editsEnabled?: boolean;\n status?: OntologyIrLinkTypeStatus;\n redacted?: boolean;\n}\n\nexport interface OneToManyObjectLinkReference {\n object: ObjectTypeDefinition;\n metadata: LinkTypeMetadata;\n}\n\nexport interface OneToManyLinkTypeUserDefinition {\n apiName: LinkTypeId;\n one: OneToManyObjectLinkReferenceUserDefinition;\n toMany: OneToManyObjectLinkReferenceUserDefinition;\n manyForeignKeyProperty: ObjectTypePropertyApiName;\n cardinality?: \"OneToMany\" | \"OneToOne\" | undefined;\n}\n\nexport interface OneToManyObjectLinkReferenceUserDefinition {\n object: ObjectTypeDefinition;\n metadata: LinkTypeMetadataUserDefinition;\n}\n\nexport interface ManyToManyLinkTypeDefinition {\n apiName: LinkTypeId;\n many: ManyToManyObjectLinkReference;\n toMany: ManyToManyObjectLinkReference;\n editsEnabled?: boolean;\n status?: OntologyIrLinkTypeStatus;\n redacted?: boolean;\n}\n\nexport interface ManyToManyObjectLinkReference {\n object: ObjectTypeDefinition;\n metadata: LinkTypeMetadata;\n}\n\nexport interface ManyToManyLinkTypeUserDefinition {\n apiName: LinkTypeId;\n many: ManyToManyObjectLinkReferenceUserDefinition;\n toMany: ManyToManyObjectLinkReferenceUserDefinition;\n}\n\nexport interface ManyToManyObjectLinkReferenceUserDefinition {\n object: ObjectTypeDefinition;\n metadata: LinkTypeMetadataUserDefinition;\n}\n\nexport interface LinkTypeMetadataUserDefinition {\n apiName: string;\n displayName?: string;\n pluralDisplayName?: string;\n visibility?: Visibility;\n groupDisplayName?: string;\n}\n\nexport type LinkSideMetadata = OptionalFields<\n RequiredFields<\n Omit<LinkTypeMetadata, \"displayMetadata\"> & LinkTypeDisplayMetadata,\n \"apiName\"\n >,\n \"visibility\" | \"typeClasses\"\n>;\nexport interface ValueTypeType_array {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"array\" }>[\"array\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"array\";\n value: {\n type: \"array\";\n elementType: ValueTypeType[\"value\"];\n };\n}\n\nexport interface ValueTypeType_boolean {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"boolean\" }>[\"boolean\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"boolean\";\n value: \"boolean\";\n}\n\nexport interface ValueTypeType_binary {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"binary\" }>[\"binary\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"binary\";\n value: \"binary\";\n}\n\nexport interface ValueTypeType_byte {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"byte\" }>[\"byte\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"byte\";\n value: \"byte\";\n}\n\nexport interface ValueTypeType_date {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"date\" }>[\"date\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"date\";\n value: \"date\";\n}\n\nexport interface ValueTypeType_decimal {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"decimal\" }>[\"decimal\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"decimal\";\n value: \"decimal\";\n}\n\nexport interface ValueTypeType_double {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"double\" }>[\"double\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"double\";\n value: \"double\";\n}\n\nexport interface ValueTypeType_float {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"float\" }>[\"float\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"float\";\n value: \"float\";\n}\n\nexport interface ValueTypeType_integer {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"integer\" }>[\"integer\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"integer\";\n value: \"integer\";\n}\n\nexport interface ValueTypeType_long {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"long\" }>[\"long\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"long\";\n value: \"long\";\n}\n\nexport interface ValueTypeType_map {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"map\" }>[\"map\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"map\";\n value: {\n type: \"map\";\n keyType: ValueTypeType[\"value\"];\n valueType: ValueTypeType[\"value\"];\n };\n}\n\nexport interface ValueTypeType_optional {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"optional\" }>[\"optional\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"optional\";\n value: {\n type: \"optional\";\n wrappedType: ValueTypeType[\"value\"];\n };\n}\n\nexport interface ValueTypeType_short {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"short\" }>[\"short\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"short\";\n value: \"short\";\n}\n\nexport interface ValueTypeType_string {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"string\" }>[\"string\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"string\";\n value: \"string\";\n}\n\nexport interface ValueTypeType_structV2 {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"structV2\" }>[\"structV2\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"structV2\";\n value: {\n type: \"struct\";\n fields: Array<{\n identifier: string;\n baseType: ValueTypeType[\"value\"];\n }>;\n };\n}\nexport interface ValueTypeType_timestamp {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"timestamp\" }>[\"timestamp\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"timestamp\";\n value: \"timestamp\";\n}\n\nexport type ValueTypeType =\n | ValueTypeType_array\n | ValueTypeType_boolean\n | ValueTypeType_binary\n | ValueTypeType_byte\n | ValueTypeType_date\n | ValueTypeType_decimal\n | ValueTypeType_double\n | ValueTypeType_float\n | ValueTypeType_integer\n | ValueTypeType_long\n | ValueTypeType_map\n | ValueTypeType_optional\n | ValueTypeType_short\n | ValueTypeType_string\n | ValueTypeType_structV2\n | ValueTypeType_timestamp;\n\nexport type ValueTypeDefinitionVersion = OntologyEntityBase & {\n apiName: ValueTypeApiName;\n packageNamespace: string;\n displayMetadata: ValueTypeDisplayMetadata;\n status: ValueTypeStatus;\n version: ValueTypeVersion;\n baseType: BaseType;\n constraints: ValueTypeDataConstraint[];\n exampleValues: ExampleValue[];\n __type: OntologyEntityTypeEnum.VALUE_TYPE;\n};\n\nexport interface ObjectTypeDatasourceDefinition_dataset {\n type: \"dataset\";\n}\n\nexport interface ObjectTypeDatasourceDefinition_stream {\n type: \"stream\";\n // Retention period must be in ISO 8601 duration format\n retentionPeriod?: string;\n}\n\nexport interface ObjectTypeDatasourceDefinition_restrictedView {\n type: \"restrictedView\";\n}\n\nexport type ObjectTypeDatasourceDefinition =\n | ObjectTypeDatasourceDefinition_stream\n | ObjectTypeDatasourceDefinition_dataset\n | ObjectTypeDatasourceDefinition_restrictedView;\n\nexport type ActionParameterTypePrimitive =\n | \"boolean\"\n | \"booleanList\"\n | \"integer\"\n | \"integerList\"\n | \"long\"\n | \"longList\"\n | \"double\"\n | \"doubleList\"\n | \"string\"\n | \"stringList\"\n | \"decimal\"\n | \"decimalList\"\n | \"timestamp\"\n | \"timestampList\"\n | \"geohash\"\n | \"geohashList\"\n | \"geoshape\"\n | \"geoshapeList\"\n | \"timeSeriesReference\"\n | \"date\"\n | \"dateList\"\n | \"objectTypeReference\"\n | \"attachment\"\n | \"attachmentList\"\n | \"marking\"\n | \"markingList\"\n | \"mediaReference\"\n | \"mediaReferenceList\"\n | \"geotimeSeriesReference\"\n | \"geotimeSeriesReferenceList\";\n\nexport type ActionParameterTypeComplex =\n | OntologyIrBaseParameterType_decimal\n | OntologyIrBaseParameterType_decimalList\n | OntologyIrBaseParameterType_timestamp\n | OntologyIrBaseParameterType_timestampList\n | OntologyIrBaseParameterType_objectReference\n | OntologyIrBaseParameterType_objectReferenceList\n | OntologyIrBaseParameterType_objectSetRid\n | OntologyIrBaseParameterType_objectTypeReference\n | OntologyIrBaseParameterType_objectReference\n | OntologyIrBaseParameterType_interfaceReference\n | OntologyIrBaseParameterType_interfaceReferenceList\n | OntologyIrBaseParameterType_struct\n | OntologyIrBaseParameterType_structList;\n\nexport type ActionParameterType =\n | ActionParameterTypePrimitive\n | ActionParameterTypeComplex;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmEA,WAAYA,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AA8DlC,OAAO,MAAMC,uBAA+B,GAAG,yBAAyB;AAExE,OAAO,MAAMC,iCAAyC,GACpD,iCAAiC;;AA0EnC;;AAoDA","ignoreList":[]}
|
|
@@ -23,7 +23,7 @@ import { hideBin } from "yargs/helpers";
|
|
|
23
23
|
import { defineOntology } from "../api/defineOntology.js";
|
|
24
24
|
const apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
|
|
25
25
|
export default async function main(args = process.argv) {
|
|
26
|
-
const commandLineOpts = await yargs(hideBin(args)).version("0.13.0-beta.
|
|
26
|
+
const commandLineOpts = await yargs(hideBin(args)).version("0.13.0-beta.6" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
|
|
27
27
|
input: {
|
|
28
28
|
alias: "i",
|
|
29
29
|
describe: "Input file",
|
|
@@ -75,12 +75,18 @@ export default async function main(args = process.argv) {
|
|
|
75
75
|
!apiNamespaceRegex.test(apiNamespace) ? process.env.NODE_ENV !== "production" ? invariant(false, "API namespace is invalid! It is expected to conform to ^[a-z0-9-]+(\.[a-z0-9-]+)*\.$") : invariant(false) : void 0;
|
|
76
76
|
}
|
|
77
77
|
consola.info(`Loading ontology from ${commandLineOpts.input}`);
|
|
78
|
-
const
|
|
78
|
+
const ontologyIr = await loadOntology(commandLineOpts.input, apiNamespace, commandLineOpts.outputDir, commandLineOpts.dependencies);
|
|
79
79
|
consola.info(`Saving ontology to ${commandLineOpts.output}`);
|
|
80
|
-
await fs.writeFile(commandLineOpts.output, JSON.stringify(
|
|
80
|
+
await fs.writeFile(commandLineOpts.output, JSON.stringify({
|
|
81
|
+
ontology: ontologyIr.ontology,
|
|
82
|
+
importedOntology: ontologyIr.importedOntology
|
|
83
|
+
}, null, 2));
|
|
81
84
|
// No point in generating block if there aren't any value types
|
|
82
|
-
if (
|
|
83
|
-
await fs.writeFile(commandLineOpts.valueTypesOutput, JSON.stringify(
|
|
85
|
+
if (ontologyIr.valueTypes.valueTypes.length > 0 || ontologyIr.importedValueTypes.valueTypes.length > 0) {
|
|
86
|
+
await fs.writeFile(commandLineOpts.valueTypesOutput, JSON.stringify({
|
|
87
|
+
valueTypes: ontologyIr.valueTypes,
|
|
88
|
+
importedValueTypes: ontologyIr.importedValueTypes
|
|
89
|
+
}, null, 2));
|
|
84
90
|
}
|
|
85
91
|
}
|
|
86
92
|
async function loadOntology(input, apiNamespace, outputDir, dependencyFile) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","names":["consola","fs","path","invariant","yargs","hideBin","defineOntology","apiNamespaceRegex","main","args","process","argv","commandLineOpts","version","wrap","Math","min","terminalWidth","strict","help","options","input","alias","describe","type","default","coerce","resolve","output","apiNamespace","snapshotDir","outputDir","valueTypesOutput","dependencies","parseAsync","length","slice","env","NODE_ENV","test","info","
|
|
1
|
+
{"version":3,"file":"main.js","names":["consola","fs","path","invariant","yargs","hideBin","defineOntology","apiNamespaceRegex","main","args","process","argv","commandLineOpts","version","wrap","Math","min","terminalWidth","strict","help","options","input","alias","describe","type","default","coerce","resolve","output","apiNamespace","snapshotDir","outputDir","valueTypesOutput","dependencies","parseAsync","length","slice","env","NODE_ENV","test","info","ontologyIr","loadOntology","writeFile","JSON","stringify","ontology","importedOntology","valueTypes","importedValueTypes","dependencyFile","q"],"sources":["main.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 { consola } from \"consola\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { defineOntology } from \"../api/defineOntology.js\";\n\nconst apiNamespaceRegex = /^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.$/;\n\nexport default async function main(\n args: string[] = process.argv,\n): Promise<void> {\n const commandLineOpts: {\n input: string;\n output: string;\n apiNamespace: string;\n snapshotDir: string;\n valueTypesOutput: string;\n outputDir?: string;\n dependencies?: string;\n } = 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: \"Input file\",\n type: \"string\",\n default: \".ontology/ontology.ts\",\n coerce: path.resolve,\n },\n output: {\n alias: \"o\",\n describe: \"Output file\",\n type: \"string\",\n default: \"ontology.json\",\n coerce: path.resolve,\n },\n apiNamespace: {\n describe: \"Api name prefix for namespaced ontology types\",\n type: \"string\",\n default: \"\",\n },\n snapshotDir: {\n alias: \"s\",\n describe: \"Snapshot directory\",\n type: \"string\",\n default: \"snapshots\",\n coerce: path.resolve,\n },\n outputDir: {\n alias: \"d\",\n describe: \"Directory for generated ontology entities\",\n type: \"string\",\n coerce: path.resolve,\n },\n valueTypesOutput: {\n describe: \"Value Type Output File\",\n type: \"string\",\n default: \"value-types.json\",\n coerce: path.resolve,\n },\n dependencies: {\n describe: \"File to write dependencies to\",\n type: \"string\",\n coerce: path.resolve,\n },\n })\n .parseAsync();\n let apiNamespace = \"\";\n if (commandLineOpts.apiNamespace.length !== 0) {\n apiNamespace = (commandLineOpts.apiNamespace.slice(-1) !== \".\")\n ? commandLineOpts.apiNamespace + \".\"\n : commandLineOpts.apiNamespace;\n invariant(apiNamespace.length < 1024, \"API namespace is too long.\");\n invariant(\n apiNamespaceRegex.test(apiNamespace),\n \"API namespace is invalid! It is expected to conform to ^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.$\",\n );\n }\n consola.info(`Loading ontology from ${commandLineOpts.input}`);\n\n const ontologyIr = await loadOntology(\n commandLineOpts.input,\n apiNamespace,\n commandLineOpts.outputDir,\n commandLineOpts.dependencies,\n );\n\n consola.info(`Saving ontology to ${commandLineOpts.output}`);\n await fs.writeFile(\n commandLineOpts.output,\n JSON.stringify(\n {\n ontology: ontologyIr.ontology,\n importedOntology: ontologyIr.importedOntology,\n },\n null,\n 2,\n ),\n );\n // No point in generating block if there aren't any value types\n if (\n ontologyIr.valueTypes.valueTypes.length > 0\n || ontologyIr.importedValueTypes.valueTypes.length > 0\n ) {\n await fs.writeFile(\n commandLineOpts.valueTypesOutput,\n JSON.stringify(\n {\n valueTypes: ontologyIr.valueTypes,\n importedValueTypes: ontologyIr.importedValueTypes,\n },\n null,\n 2,\n ),\n );\n }\n}\n\nasync function loadOntology(\n input: string,\n apiNamespace: string,\n outputDir: string | undefined,\n dependencyFile: string | undefined,\n) {\n const q = await defineOntology(\n apiNamespace,\n async () => await import(input),\n outputDir,\n dependencyFile,\n );\n return q;\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,SAAS,MAAM,gBAAgB;AACtC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,MAAMC,iBAAiB,GAAG,+BAA+B;AAEzD,eAAe,eAAeC,IAAIA,CAChCC,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AAC,IACxCM,UAAU,CAACQ,kBAAkB,CAACD,UAAU,CAACb,MAAM,GAAG,CAAC,EACtD;IACA,MAAMlC,EAAE,CAAC0C,SAAS,CAChB/B,eAAe,CAACoB,gBAAgB,EAChCY,IAAI,CAACC,SAAS,CACZ;MACEG,UAAU,EAAEP,UAAU,CAACO,UAAU;MACjCC,kBAAkB,EAAER,UAAU,CAACQ;IACjC,CAAC,EACD,IAAI,EACJ,CACF,CACF,CAAC;EACH;AACF;AAEA,eAAeP,YAAYA,CACzBrB,KAAa,EACbQ,YAAoB,EACpBE,SAA6B,EAC7BmB,cAAkC,EAClC;EACA,MAAMC,CAAC,GAAG,MAAM7C,cAAc,CAC5BuB,YAAY,EACZ,YAAY,MAAM,MAAM,CAACR,KAAK,CAAC,EAC/BU,SAAS,EACTmB,cACF,CAAC;EACD,OAAOC,CAAC;AACV","ignoreList":[]}
|
package/build/cjs/index.cjs
CHANGED
|
@@ -40,7 +40,7 @@ var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
|
40
40
|
// src/cli/main.ts
|
|
41
41
|
|
|
42
42
|
// src/api/types.ts
|
|
43
|
-
var OntologyEntityTypeEnum = /* @__PURE__ */ function(OntologyEntityTypeEnum2) {
|
|
43
|
+
var OntologyEntityTypeEnum = /* @__PURE__ */ (function(OntologyEntityTypeEnum2) {
|
|
44
44
|
OntologyEntityTypeEnum2["OBJECT_TYPE"] = "OBJECT_TYPE";
|
|
45
45
|
OntologyEntityTypeEnum2["LINK_TYPE"] = "LINK_TYPE";
|
|
46
46
|
OntologyEntityTypeEnum2["INTERFACE_TYPE"] = "INTERFACE_TYPE";
|
|
@@ -48,7 +48,7 @@ var OntologyEntityTypeEnum = /* @__PURE__ */ function(OntologyEntityTypeEnum2) {
|
|
|
48
48
|
OntologyEntityTypeEnum2["ACTION_TYPE"] = "ACTION_TYPE";
|
|
49
49
|
OntologyEntityTypeEnum2["VALUE_TYPE"] = "VALUE_TYPE";
|
|
50
50
|
return OntologyEntityTypeEnum2;
|
|
51
|
-
}({});
|
|
51
|
+
})({});
|
|
52
52
|
var MODIFY_OBJECT_PARAMETER = "objectToModifyParameter";
|
|
53
53
|
var CREATE_OR_MODIFY_OBJECT_PARAMETER = "objectToCreateOrModifyParameter";
|
|
54
54
|
|
|
@@ -414,7 +414,9 @@ function getPropertyTypeName(type) {
|
|
|
414
414
|
function convertValueType(valueType) {
|
|
415
415
|
return {
|
|
416
416
|
apiName: valueType.apiName,
|
|
417
|
-
version: valueType.version
|
|
417
|
+
version: valueType.version,
|
|
418
|
+
packageNamespace: valueType.packageNamespace,
|
|
419
|
+
displayMetadata: valueType.displayMetadata
|
|
418
420
|
};
|
|
419
421
|
}
|
|
420
422
|
function convertValueTypeDataConstraints(dataConstraints) {
|
|
@@ -684,10 +686,7 @@ async function defineOntology(ns, body, outputDir, dependencyFile) {
|
|
|
684
686
|
if (dependencyFile) {
|
|
685
687
|
writeDependencyFile(dependencyFile);
|
|
686
688
|
}
|
|
687
|
-
return
|
|
688
|
-
ontology: convertToWireOntologyIr(ontologyDefinition),
|
|
689
|
-
valueType: convertOntologyToValueTypeIr(ontologyDefinition)
|
|
690
|
-
};
|
|
689
|
+
return convertToWireOntologyIr(ontologyDefinition);
|
|
691
690
|
}
|
|
692
691
|
function writeStaticObjects(outputDir) {
|
|
693
692
|
const codegenDir = path2__namespace.resolve(outputDir, "codegen");
|
|
@@ -753,111 +752,32 @@ export const ${entityFileNameBase}: ${entityTypeName} = wrapWithProxy(${entityFi
|
|
|
753
752
|
}
|
|
754
753
|
function convertOntologyToValueTypeIr(ontology) {
|
|
755
754
|
return {
|
|
756
|
-
valueTypes:
|
|
757
|
-
metadata: {
|
|
758
|
-
apiName: definitions[0].apiName,
|
|
759
|
-
displayMetadata: definitions[0].displayMetadata,
|
|
760
|
-
status: definitions[0].status
|
|
761
|
-
},
|
|
762
|
-
versions: definitions.map((definition) => ({
|
|
763
|
-
version: definition.version,
|
|
764
|
-
baseType: definition.baseType,
|
|
765
|
-
constraints: definition.constraints,
|
|
766
|
-
exampleValues: definition.exampleValues
|
|
767
|
-
}))
|
|
768
|
-
}))
|
|
755
|
+
valueTypes: convertValueTypesToIr(ontology[OntologyEntityTypeEnum.VALUE_TYPE])
|
|
769
756
|
};
|
|
770
757
|
}
|
|
758
|
+
function convertValueTypesToIr(valueTypes) {
|
|
759
|
+
return Object.values(valueTypes).map((definitions) => ({
|
|
760
|
+
metadata: {
|
|
761
|
+
apiName: definitions[0].apiName,
|
|
762
|
+
packageNamespace: definitions[0].packageNamespace,
|
|
763
|
+
displayMetadata: definitions[0].displayMetadata,
|
|
764
|
+
status: definitions[0].status
|
|
765
|
+
},
|
|
766
|
+
// TODO(dpaquin): instead of deduping here, we should refactor the value type types from arrays to maps
|
|
767
|
+
versions: Array.from(new Map(definitions.map((definition) => [definition.version, definition])).values()).map((definition) => ({
|
|
768
|
+
version: definition.version,
|
|
769
|
+
baseType: definition.baseType,
|
|
770
|
+
constraints: definition.constraints,
|
|
771
|
+
exampleValues: definition.exampleValues
|
|
772
|
+
}))
|
|
773
|
+
}));
|
|
774
|
+
}
|
|
771
775
|
function convertToWireOntologyIr(ontology) {
|
|
772
776
|
return {
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
function convertToWireImportedTypes(importedTypes2) {
|
|
778
|
-
const asBlockData = convertToWireBlockData(importedTypes2);
|
|
779
|
-
return {
|
|
780
|
-
sharedPropertyTypes: Object.values(asBlockData.sharedPropertyTypes).map((spt) => ({
|
|
781
|
-
apiName: spt.sharedPropertyType.apiName,
|
|
782
|
-
displayName: spt.sharedPropertyType.displayMetadata.displayName,
|
|
783
|
-
description: spt.sharedPropertyType.displayMetadata.description,
|
|
784
|
-
type: spt.sharedPropertyType.type,
|
|
785
|
-
valueType: spt.sharedPropertyType.valueType === void 0 ? void 0 : {
|
|
786
|
-
apiName: spt.sharedPropertyType.valueType.apiName,
|
|
787
|
-
version: spt.sharedPropertyType.valueType.version
|
|
788
|
-
}
|
|
789
|
-
})),
|
|
790
|
-
objectTypes: Object.values(asBlockData.objectTypes).map((ot) => ({
|
|
791
|
-
apiName: ot.objectType.apiName,
|
|
792
|
-
displayName: ot.objectType.displayMetadata.displayName,
|
|
793
|
-
description: ot.objectType.displayMetadata.description,
|
|
794
|
-
propertyTypes: Object.values(ot.objectType.propertyTypes).map((p) => ({
|
|
795
|
-
apiName: p.apiName,
|
|
796
|
-
displayName: p.displayMetadata.displayName,
|
|
797
|
-
description: p.displayMetadata.description,
|
|
798
|
-
type: p.type,
|
|
799
|
-
sharedPropertyType: p.sharedPropertyTypeApiName
|
|
800
|
-
}))
|
|
801
|
-
})),
|
|
802
|
-
interfaceTypes: Object.values(asBlockData.interfaceTypes).map((i) => ({
|
|
803
|
-
apiName: i.interfaceType.apiName,
|
|
804
|
-
displayName: i.interfaceType.displayMetadata.displayName,
|
|
805
|
-
description: i.interfaceType.displayMetadata.description,
|
|
806
|
-
properties: Object.values(i.interfaceType.propertiesV2).map((p) => ({
|
|
807
|
-
apiName: p.sharedPropertyType.apiName,
|
|
808
|
-
displayName: p.sharedPropertyType.displayMetadata.displayName,
|
|
809
|
-
description: p.sharedPropertyType.displayMetadata.description,
|
|
810
|
-
type: p.sharedPropertyType.type
|
|
811
|
-
})),
|
|
812
|
-
links: i.interfaceType.links.map((l) => ({
|
|
813
|
-
apiName: l.metadata.apiName,
|
|
814
|
-
displayName: l.metadata.displayName,
|
|
815
|
-
description: l.metadata.description,
|
|
816
|
-
cardinality: l.cardinality,
|
|
817
|
-
required: l.required
|
|
818
|
-
}))
|
|
819
|
-
})),
|
|
820
|
-
actionTypes: Object.values(asBlockData.actionTypes).map((a) => ({
|
|
821
|
-
apiName: a.actionType.metadata.apiName,
|
|
822
|
-
displayName: a.actionType.metadata.displayMetadata.displayName,
|
|
823
|
-
description: a.actionType.metadata.displayMetadata.description,
|
|
824
|
-
parameters: Object.values(a.actionType.metadata.parameters).map((p) => ({
|
|
825
|
-
id: p.id,
|
|
826
|
-
displayName: p.displayMetadata.displayName,
|
|
827
|
-
description: p.displayMetadata.description,
|
|
828
|
-
type: p.type
|
|
829
|
-
}))
|
|
830
|
-
})),
|
|
831
|
-
linkTypes: Object.values(asBlockData.linkTypes).map((l) => {
|
|
832
|
-
if (l.linkType.definition.type === "oneToMany") {
|
|
833
|
-
return {
|
|
834
|
-
id: l.linkType.id,
|
|
835
|
-
definition: {
|
|
836
|
-
type: "oneToMany",
|
|
837
|
-
"oneToMany": {
|
|
838
|
-
objectTypeApiNameOneSide: l.linkType.definition.oneToMany.objectTypeRidOneSide,
|
|
839
|
-
objectTypeApiNameManySide: l.linkType.definition.oneToMany.objectTypeRidManySide,
|
|
840
|
-
manyToOneLinkDisplayName: l.linkType.definition.oneToMany.manyToOneLinkMetadata.displayMetadata.displayName,
|
|
841
|
-
oneToManyLinkDisplayName: l.linkType.definition.oneToMany.oneToManyLinkMetadata.displayMetadata.displayName,
|
|
842
|
-
cardinality: l.linkType.definition.oneToMany.cardinalityHint
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
};
|
|
846
|
-
} else {
|
|
847
|
-
return {
|
|
848
|
-
id: l.linkType.id,
|
|
849
|
-
definition: {
|
|
850
|
-
type: "manyToMany",
|
|
851
|
-
"manyToMany": {
|
|
852
|
-
objectTypeApiNameA: l.linkType.definition.manyToMany.objectTypeRidA,
|
|
853
|
-
objectTypeApiNameB: l.linkType.definition.manyToMany.objectTypeRidB,
|
|
854
|
-
objectTypeAToBLinkDisplayName: l.linkType.definition.manyToMany.objectTypeAToBLinkMetadata.displayMetadata.displayName,
|
|
855
|
-
objectTypeBToALinkDisplayName: l.linkType.definition.manyToMany.objectTypeBToALinkMetadata.displayMetadata.displayName
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
};
|
|
859
|
-
}
|
|
860
|
-
})
|
|
777
|
+
ontology: convertToWireBlockData(ontology),
|
|
778
|
+
importedOntology: convertToWireBlockData(importedTypes),
|
|
779
|
+
valueTypes: convertOntologyToValueTypeIr(ontology),
|
|
780
|
+
importedValueTypes: convertOntologyToValueTypeIr(importedTypes)
|
|
861
781
|
};
|
|
862
782
|
}
|
|
863
783
|
function convertToWireBlockData(ontology) {
|
|
@@ -1217,11 +1137,15 @@ function convertInterface(interfaceType) {
|
|
|
1217
1137
|
required: spt.required,
|
|
1218
1138
|
sharedPropertyType: convertSpt(spt.sharedPropertyType)
|
|
1219
1139
|
}])),
|
|
1140
|
+
displayMetadata: {
|
|
1141
|
+
displayName: interfaceType.displayMetadata.displayName,
|
|
1142
|
+
description: interfaceType.displayMetadata.description
|
|
1143
|
+
},
|
|
1220
1144
|
extendsInterfaces: interfaceType.extendsInterfaces.map((i) => i.apiName),
|
|
1221
1145
|
// these are omitted from our internal types but we need to re-add them for the final json
|
|
1146
|
+
properties: [],
|
|
1222
1147
|
// TODO(mwalther): Support propertiesV3
|
|
1223
|
-
propertiesV3: {}
|
|
1224
|
-
properties: []
|
|
1148
|
+
propertiesV3: {}
|
|
1225
1149
|
};
|
|
1226
1150
|
}
|
|
1227
1151
|
function dumpOntologyFullMetadata() {
|
|
@@ -1264,7 +1188,9 @@ function convertSpt({
|
|
|
1264
1188
|
typeClasses: typeClasses ?? [],
|
|
1265
1189
|
valueType: valueType === void 0 ? void 0 : {
|
|
1266
1190
|
apiName: valueType.apiName,
|
|
1267
|
-
version: valueType.version
|
|
1191
|
+
version: valueType.version,
|
|
1192
|
+
packageNamespace: valueType.packageNamespace,
|
|
1193
|
+
displayMetadata: valueType.displayMetadata
|
|
1268
1194
|
}
|
|
1269
1195
|
};
|
|
1270
1196
|
}
|
|
@@ -1721,7 +1647,7 @@ function convertCardinality(cardinality) {
|
|
|
1721
1647
|
// src/cli/main.ts
|
|
1722
1648
|
var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
|
|
1723
1649
|
async function main(args = process.argv) {
|
|
1724
|
-
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.13.0-beta.
|
|
1650
|
+
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.13.0-beta.6").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
|
|
1725
1651
|
input: {
|
|
1726
1652
|
alias: "i",
|
|
1727
1653
|
describe: "Input file",
|
|
@@ -1773,11 +1699,17 @@ async function main(args = process.argv) {
|
|
|
1773
1699
|
!apiNamespaceRegex.test(apiNamespace) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "API namespace is invalid! It is expected to conform to ^[a-z0-9-]+(.[a-z0-9-]+)*.$") : invariant5__default.default(false) : void 0;
|
|
1774
1700
|
}
|
|
1775
1701
|
consola.consola.info(`Loading ontology from ${commandLineOpts.input}`);
|
|
1776
|
-
const
|
|
1702
|
+
const ontologyIr = await loadOntology(commandLineOpts.input, apiNamespace, commandLineOpts.outputDir, commandLineOpts.dependencies);
|
|
1777
1703
|
consola.consola.info(`Saving ontology to ${commandLineOpts.output}`);
|
|
1778
|
-
await fs2__namespace.writeFile(commandLineOpts.output, JSON.stringify(
|
|
1779
|
-
|
|
1780
|
-
|
|
1704
|
+
await fs2__namespace.writeFile(commandLineOpts.output, JSON.stringify({
|
|
1705
|
+
ontology: ontologyIr.ontology,
|
|
1706
|
+
importedOntology: ontologyIr.importedOntology
|
|
1707
|
+
}, null, 2));
|
|
1708
|
+
if (ontologyIr.valueTypes.valueTypes.length > 0 || ontologyIr.importedValueTypes.valueTypes.length > 0) {
|
|
1709
|
+
await fs2__namespace.writeFile(commandLineOpts.valueTypesOutput, JSON.stringify({
|
|
1710
|
+
valueTypes: ontologyIr.valueTypes,
|
|
1711
|
+
importedValueTypes: ontologyIr.importedValueTypes
|
|
1712
|
+
}, null, 2));
|
|
1781
1713
|
}
|
|
1782
1714
|
}
|
|
1783
1715
|
async function loadOntology(input, apiNamespace, outputDir, dependencyFile) {
|
|
@@ -1870,7 +1802,7 @@ function defineCreateInterfaceObjectAction(interfaceType, objectType, validation
|
|
|
1870
1802
|
}
|
|
1871
1803
|
}],
|
|
1872
1804
|
...validation ? {
|
|
1873
|
-
validation:
|
|
1805
|
+
validation: convertValidationRule(validation)
|
|
1874
1806
|
} : {}
|
|
1875
1807
|
});
|
|
1876
1808
|
}
|
|
@@ -1912,7 +1844,7 @@ function defineCreateObjectAction(def) {
|
|
|
1912
1844
|
}],
|
|
1913
1845
|
parameterOrdering: def.parameterOrdering ?? createDefaultParameterOrdering(def, parameters),
|
|
1914
1846
|
...def.actionLevelValidation ? {
|
|
1915
|
-
validation:
|
|
1847
|
+
validation: convertValidationRule(def.actionLevelValidation)
|
|
1916
1848
|
} : {},
|
|
1917
1849
|
...def.defaultFormat && {
|
|
1918
1850
|
defaultFormat: def.defaultFormat
|
|
@@ -1995,7 +1927,7 @@ function defineModifyInterfaceObjectAction(interfaceType, objectType, validation
|
|
|
1995
1927
|
}
|
|
1996
1928
|
}],
|
|
1997
1929
|
...validation ? {
|
|
1998
|
-
validation:
|
|
1930
|
+
validation: convertValidationRule(validation)
|
|
1999
1931
|
} : {}
|
|
2000
1932
|
});
|
|
2001
1933
|
}
|
|
@@ -2052,7 +1984,7 @@ function defineModifyObjectAction(def) {
|
|
|
2052
1984
|
},
|
|
2053
1985
|
parameterOrdering: def.parameterOrdering ?? createDefaultParameterOrdering(def, parameters, MODIFY_OBJECT_PARAMETER),
|
|
2054
1986
|
...def.actionLevelValidation ? {
|
|
2055
|
-
validation:
|
|
1987
|
+
validation: convertValidationRule(def.actionLevelValidation)
|
|
2056
1988
|
} : {},
|
|
2057
1989
|
...def.defaultFormat && {
|
|
2058
1990
|
defaultFormat: def.defaultFormat
|
|
@@ -2105,7 +2037,7 @@ function defineDeleteObjectAction(def) {
|
|
|
2105
2037
|
typeGroups: []
|
|
2106
2038
|
},
|
|
2107
2039
|
...def.actionLevelValidation ? {
|
|
2108
|
-
validation:
|
|
2040
|
+
validation: convertValidationRule(def.actionLevelValidation)
|
|
2109
2041
|
} : {}
|
|
2110
2042
|
});
|
|
2111
2043
|
}
|
|
@@ -2162,7 +2094,7 @@ function defineCreateOrModifyObjectAction(def) {
|
|
|
2162
2094
|
},
|
|
2163
2095
|
parameterOrdering: def.parameterOrdering ?? createDefaultParameterOrdering(def, parameters, CREATE_OR_MODIFY_OBJECT_PARAMETER),
|
|
2164
2096
|
...def.actionLevelValidation ? {
|
|
2165
|
-
validation:
|
|
2097
|
+
validation: convertValidationRule(def.actionLevelValidation)
|
|
2166
2098
|
} : {},
|
|
2167
2099
|
...def.defaultFormat && {
|
|
2168
2100
|
defaultFormat: def.defaultFormat
|
|
@@ -2564,13 +2496,15 @@ function sanitize2(s) {
|
|
|
2564
2496
|
return s.includes(".") ? s : namespace + s;
|
|
2565
2497
|
}
|
|
2566
2498
|
function convertValidationRule(actionValidation) {
|
|
2567
|
-
return {
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2499
|
+
return actionValidation.map((rule) => {
|
|
2500
|
+
return {
|
|
2501
|
+
condition: convertConditionDefinition(rule.condition),
|
|
2502
|
+
displayMetadata: rule.displayMetadata ?? {
|
|
2503
|
+
failureMessage: "Did not satisfy validation",
|
|
2504
|
+
typeClasses: []
|
|
2505
|
+
}
|
|
2506
|
+
};
|
|
2507
|
+
});
|
|
2574
2508
|
}
|
|
2575
2509
|
function validateActionConfiguration(action) {
|
|
2576
2510
|
const seenParameterIds = /* @__PURE__ */ new Set();
|
|
@@ -2948,6 +2882,7 @@ function defineValueType(valueTypeDef) {
|
|
|
2948
2882
|
const baseType = convertValueTypeTypeToBaseType(type.type);
|
|
2949
2883
|
const vt = {
|
|
2950
2884
|
apiName,
|
|
2885
|
+
packageNamespace: namespace.substring(0, namespace.length - 1),
|
|
2951
2886
|
displayMetadata: {
|
|
2952
2887
|
displayName,
|
|
2953
2888
|
description: description ?? ""
|