@osdk/maker 0.11.0-beta.9 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +168 -0
- package/build/browser/api/addDependency.js +20 -4
- package/build/browser/api/addDependency.js.map +1 -1
- package/build/browser/api/defineAction.js +7 -6
- package/build/browser/api/defineAction.js.map +1 -1
- package/build/browser/api/defineInterface.js +6 -5
- package/build/browser/api/defineInterface.js.map +1 -1
- package/build/browser/api/defineObject.js +20 -14
- package/build/browser/api/defineObject.js.map +1 -1
- package/build/browser/api/defineOntology.js +19 -13
- package/build/browser/api/defineOntology.js.map +1 -1
- package/build/browser/api/overall.test.js +1342 -718
- package/build/browser/api/overall.test.js.map +1 -1
- package/build/browser/api/types.js.map +1 -1
- package/build/browser/cli/main.js +1 -1
- package/build/browser/cli/main.js.map +1 -1
- package/build/cjs/index.cjs +81 -62
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +3 -2
- package/build/esm/api/addDependency.js +20 -4
- package/build/esm/api/addDependency.js.map +1 -1
- package/build/esm/api/defineAction.js +7 -6
- package/build/esm/api/defineAction.js.map +1 -1
- package/build/esm/api/defineInterface.js +6 -5
- package/build/esm/api/defineInterface.js.map +1 -1
- package/build/esm/api/defineObject.js +20 -14
- package/build/esm/api/defineObject.js.map +1 -1
- package/build/esm/api/defineOntology.js +19 -13
- package/build/esm/api/defineOntology.js.map +1 -1
- package/build/esm/api/overall.test.js +1342 -718
- package/build/esm/api/overall.test.js.map +1 -1
- package/build/esm/api/types.js.map +1 -1
- package/build/esm/cli/main.js +1 -1
- package/build/esm/cli/main.js.map +1 -1
- package/build/types/api/addDependency.d.ts +1 -1
- package/build/types/api/addDependency.d.ts.map +1 -1
- package/build/types/api/defineAction.d.ts.map +1 -1
- package/build/types/api/defineInterface.d.ts +1 -0
- package/build/types/api/defineInterface.d.ts.map +1 -1
- package/build/types/api/defineObject.d.ts +2 -1
- package/build/types/api/defineObject.d.ts.map +1 -1
- package/build/types/api/defineOntology.d.ts +1 -0
- package/build/types/api/defineOntology.d.ts.map +1 -1
- package/build/types/api/types.d.ts +1 -1
- package/build/types/api/types.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["OntologyEntityTypeEnum"],"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 ApiNameValueTypeReference,\n BaseType,\n DataConstraint,\n ExampleValue,\n FailureMessage,\n ImportedTypes,\n InterfaceTypeApiName,\n InterfaceTypeStatus,\n LinkTypeDisplayMetadata,\n LinkTypeMetadata,\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 OntologyIrConditionValue,\n OntologyIrFormContent,\n OntologyIrInterfaceType,\n OntologyIrLabelledValue,\n OntologyIrLinkTypeStatus,\n OntologyIrLogicRule,\n OntologyIrObjectType,\n OntologyIrParameterDateRangeValue,\n OntologyIrPropertyType,\n OntologyIrValidationRule,\n ParameterId,\n SectionId,\n SharedPropertyTypeGothamMapping,\n StructFieldType,\n ValueTypeApiName,\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 >\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 interface ActionParameter {\n id: ParameterId;\n displayName: string;\n type: ActionParameterType;\n validation: ActionParameterValidation;\n description?: string;\n typeClasses?: Array<TypeClass>;\n}\n\nexport interface ActionParameterValidation {\n allowedValues: ActionParameterAllowedValues;\n required: ActionParameterRequirementConstraint;\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 }\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, Array<ParameterId>>;\n status: ActionStatus;\n formContentOrdering: Array<OntologyIrFormContent>;\n validation: Array<OntologyIrValidationRule>;\n typeClasses: Array<TypeClass>;\n}\n\nexport type ActionValidationRule = OntologyIrValidationRule;\n\nexport type ActionValidationDefinition =\n | GroupValidationRule\n | OntologyIrValidationRule;\n\nexport type GroupValidationRule = {\n type: \"group\";\n name: string;\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 };\nexport type ObjectTypeDefinition = Omit<ObjectType, \"__type\">;\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 interface InterfacePropertyType {\n sharedPropertyType: SharedPropertyType;\n required: boolean;\n}\nexport interface InterfaceType extends\n OntologyEntityBase,\n Omit<\n OntologyIrInterfaceType,\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 >\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?: ApiNameValueTypeReference;\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};\n\ntype 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}\n\nexport interface OneToManyObjectLinkReferenceUserDefinition {\n object: ObjectType;\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: ObjectType;\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 | \"objectReference\"\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;;AA4EA,WAAYA,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;;AA6DlC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"types.js","names":["OntologyEntityTypeEnum"],"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 ApiNameValueTypeReference,\n BaseType,\n DataConstraint,\n ExampleValue,\n FailureMessage,\n ImportedTypes,\n InterfaceTypeApiName,\n InterfaceTypeStatus,\n LinkTypeDisplayMetadata,\n LinkTypeMetadata,\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 OntologyIrConditionValue,\n OntologyIrFormContent,\n OntologyIrInterfaceType,\n OntologyIrLabelledValue,\n OntologyIrLinkTypeStatus,\n OntologyIrLogicRule,\n OntologyIrObjectType,\n OntologyIrParameterDateRangeValue,\n OntologyIrPropertyType,\n OntologyIrValidationRule,\n ParameterId,\n SectionId,\n SharedPropertyTypeGothamMapping,\n StructFieldType,\n ValueTypeApiName,\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 >\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 interface ActionParameter {\n id: ParameterId;\n displayName: string;\n type: ActionParameterType;\n validation: ActionParameterValidation;\n description?: string;\n typeClasses?: Array<TypeClass>;\n}\n\nexport interface ActionParameterValidation {\n allowedValues: ActionParameterAllowedValues;\n required: ActionParameterRequirementConstraint;\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 }\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, Array<ParameterId>>;\n status: ActionStatus;\n formContentOrdering: Array<OntologyIrFormContent>;\n validation: Array<OntologyIrValidationRule>;\n typeClasses: Array<TypeClass>;\n}\n\nexport type ActionValidationRule = OntologyIrValidationRule;\n\nexport type ActionValidationDefinition =\n | GroupValidationRule\n | OntologyIrValidationRule;\n\nexport type GroupValidationRule = {\n type: \"group\";\n name: string;\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 };\nexport type ObjectTypeDefinition = Omit<ObjectType, \"__type\">;\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 interface InterfacePropertyType {\n sharedPropertyType: SharedPropertyType;\n required: boolean;\n}\nexport interface InterfaceType extends\n OntologyEntityBase,\n Omit<\n OntologyIrInterfaceType,\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?: ApiNameValueTypeReference;\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};\n\ntype 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}\n\nexport interface OneToManyObjectLinkReferenceUserDefinition {\n object: ObjectType;\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: ObjectType;\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 | \"objectReference\"\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;;AA4EA,WAAYA,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;;AA6DlC","ignoreList":[]}
|
|
@@ -24,7 +24,7 @@ import { hideBin } from "yargs/helpers";
|
|
|
24
24
|
import { defineOntology } from "../api/defineOntology.js";
|
|
25
25
|
const apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
|
|
26
26
|
export default async function main(args = process.argv) {
|
|
27
|
-
const commandLineOpts = await yargs(hideBin(args)).version("0.11.0
|
|
27
|
+
const commandLineOpts = await yargs(hideBin(args)).version("0.11.0" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
|
|
28
28
|
input: {
|
|
29
29
|
alias: "i",
|
|
30
30
|
describe: "Input file",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","names":["consola","createJiti","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","ontology","loadOntology","writeFile","JSON","stringify","valueType","valueTypes","dependencyFile","q","jiti","import","meta","filename","moduleCache","debug","importMeta"],"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 { createJiti } from \"jiti\";\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 ontology = 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(ontology.ontology, null, 2),\n );\n // No point in generating block if there aren't any value types\n if (ontology.valueType.valueTypes.length > 0) {\n await fs.writeFile(\n commandLineOpts.valueTypesOutput,\n JSON.stringify(ontology.valueType, null, 2),\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 () => {\n const jiti = createJiti(import.meta.filename, {\n moduleCache: false,\n debug: false,\n importMeta: import.meta,\n });\n const module = await jiti.import(input);\n\n // await import(input);\n },\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,SAASC,UAAU,QAAQ,MAAM;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,IAAc,GAAGC,OAAO,CAACC,IAAI,EACd;EACf,MAAMC,eAQL,GAAG,MAAMR,KAAK,CAACC,OAAO,CAACI,IAAI,CAAC,CAAC,CAC3BI,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"main.js","names":["consola","createJiti","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","ontology","loadOntology","writeFile","JSON","stringify","valueType","valueTypes","dependencyFile","q","jiti","import","meta","filename","moduleCache","debug","importMeta"],"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 { createJiti } from \"jiti\";\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 ontology = 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(ontology.ontology, null, 2),\n );\n // No point in generating block if there aren't any value types\n if (ontology.valueType.valueTypes.length > 0) {\n await fs.writeFile(\n commandLineOpts.valueTypesOutput,\n JSON.stringify(ontology.valueType, null, 2),\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 () => {\n const jiti = createJiti(import.meta.filename, {\n moduleCache: false,\n debug: false,\n importMeta: import.meta,\n });\n const module = await jiti.import(input);\n\n // await import(input);\n },\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,SAASC,UAAU,QAAQ,MAAM;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,IAAc,GAAGC,OAAO,CAACC,IAAI,EACd;EACf,MAAMC,eAQL,GAAG,MAAMR,KAAK,CAACC,OAAO,CAACI,IAAI,CAAC,CAAC,CAC3BI,OAAO,CAAC,YAA+B,EAAE,CAAC,CAC1CC,IAAI,CAACC,IAAI,CAACC,GAAG,CAAC,GAAG,EAAEZ,KAAK,CAAC,CAAC,CAACa,aAAa,CAAC,CAAC,CAAC,CAAC,CAC5CC,MAAM,CAAC,CAAC,CACRC,IAAI,CAAC,CAAC,CACNC,OAAO,CAAC;IACPC,KAAK,EAAE;MACLC,KAAK,EAAE,GAAG;MACVC,QAAQ,EAAE,YAAY;MACtBC,IAAI,EAAE,QAAQ;MACdC,OAAO,EAAE,uBAAuB;MAChCC,MAAM,EAAExB,IAAI,CAACyB;IACf,CAAC;IACDC,MAAM,EAAE;MACNN,KAAK,EAAE,GAAG;MACVC,QAAQ,EAAE,aAAa;MACvBC,IAAI,EAAE,QAAQ;MACdC,OAAO,EAAE,eAAe;MACxBC,MAAM,EAAExB,IAAI,CAACyB;IACf,CAAC;IACDE,YAAY,EAAE;MACZN,QAAQ,EAAE,+CAA+C;MACzDC,IAAI,EAAE,QAAQ;MACdC,OAAO,EAAE;IACX,CAAC;IACDK,WAAW,EAAE;MACXR,KAAK,EAAE,GAAG;MACVC,QAAQ,EAAE,oBAAoB;MAC9BC,IAAI,EAAE,QAAQ;MACdC,OAAO,EAAE,WAAW;MACpBC,MAAM,EAAExB,IAAI,CAACyB;IACf,CAAC;IACDI,SAAS,EAAE;MACTT,KAAK,EAAE,GAAG;MACVC,QAAQ,EAAE,2CAA2C;MACrDC,IAAI,EAAE,QAAQ;MACdE,MAAM,EAAExB,IAAI,CAACyB;IACf,CAAC;IACDK,gBAAgB,EAAE;MAChBT,QAAQ,EAAE,wBAAwB;MAClCC,IAAI,EAAE,QAAQ;MACdC,OAAO,EAAE,kBAAkB;MAC3BC,MAAM,EAAExB,IAAI,CAACyB;IACf,CAAC;IACDM,YAAY,EAAE;MACZV,QAAQ,EAAE,+BAA+B;MACzCC,IAAI,EAAE,QAAQ;MACdE,MAAM,EAAExB,IAAI,CAACyB;IACf;EACF,CAAC,CAAC,CACDO,UAAU,CAAC,CAAC;EACf,IAAIL,YAAY,GAAG,EAAE;EACrB,IAAIjB,eAAe,CAACiB,YAAY,CAACM,MAAM,KAAK,CAAC,EAAE;IAC7CN,YAAY,GAAIjB,eAAe,CAACiB,YAAY,CAACO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,GAC1DxB,eAAe,CAACiB,YAAY,GAAG,GAAG,GAClCjB,eAAe,CAACiB,YAAY;IAChC,EAAUA,YAAY,CAACM,MAAM,GAAG,IAAI,IAAAzB,OAAA,CAAA2B,GAAA,CAAAC,QAAA,oBAApCnC,SAAS,QAA6B,4BAA4B,IAAlEA,SAAS;IACT,CACEI,iBAAiB,CAACgC,IAAI,CAACV,YAAY,CAAC,GAAAnB,OAAA,CAAA2B,GAAA,CAAAC,QAAA,oBADtCnC,SAAS,QAEP,sFAAsF,IAFxFA,SAAS;EAIX;EACAJ,OAAO,CAACyC,IAAI,CAAC,yBAAyB5B,eAAe,CAACS,KAAK,EAAE,CAAC;EAE9D,MAAMoB,QAAQ,GAAG,MAAMC,YAAY,CACjC9B,eAAe,CAACS,KAAK,EACrBQ,YAAY,EACZjB,eAAe,CAACmB,SAAS,EACzBnB,eAAe,CAACqB,YAClB,CAAC;EAEDlC,OAAO,CAACyC,IAAI,CAAC,sBAAsB5B,eAAe,CAACgB,MAAM,EAAE,CAAC;EAC5D,MAAM3B,EAAE,CAAC0C,SAAS,CAChB/B,eAAe,CAACgB,MAAM,EACtBgB,IAAI,CAACC,SAAS,CAACJ,QAAQ,CAACA,QAAQ,EAAE,IAAI,EAAE,CAAC,CAC3C,CAAC;EACD;EACA,IAAIA,QAAQ,CAACK,SAAS,CAACC,UAAU,CAACZ,MAAM,GAAG,CAAC,EAAE;IAC5C,MAAMlC,EAAE,CAAC0C,SAAS,CAChB/B,eAAe,CAACoB,gBAAgB,EAChCY,IAAI,CAACC,SAAS,CAACJ,QAAQ,CAACK,SAAS,EAAE,IAAI,EAAE,CAAC,CAC5C,CAAC;EACH;AACF;AAEA,eAAeJ,YAAYA,CACzBrB,KAAa,EACbQ,YAAoB,EACpBE,SAA6B,EAC7BiB,cAAkC,EAClC;EACA,MAAMC,CAAC,GAAG,MAAM3C,cAAc,CAC5BuB,YAAY,EACZ,YAAY;IACV,MAAMqB,IAAI,GAAGlD,UAAU,CAACmD,MAAM,CAACC,IAAI,CAACC,QAAQ,EAAE;MAC5CC,WAAW,EAAE,KAAK;MAClBC,KAAK,EAAE,KAAK;MACZC,UAAU,EAAEL,MAAM,CAACC;IACrB,CAAC,CAAC;IACa,MAAMF,IAAI,CAACC,MAAM,CAAC9B,KAAK,CAAC,EAEvC;EACF,CAAC,EACDU,SAAS,EACTiB,cACF,CAAC;EACD,OAAOC,CAAC;AACV","ignoreList":[]}
|
package/build/cjs/index.cjs
CHANGED
|
@@ -5,13 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var consola = require('consola');
|
|
6
6
|
var jiti = require('jiti');
|
|
7
7
|
var fs2 = require('fs/promises');
|
|
8
|
-
var
|
|
8
|
+
var path2 = require('path');
|
|
9
9
|
var invariant = require('tiny-invariant');
|
|
10
10
|
var yargs = require('yargs');
|
|
11
11
|
var helpers = require('yargs/helpers');
|
|
12
12
|
var fs = require('fs');
|
|
13
|
-
var url = require('url');
|
|
14
|
-
var semverTs = require('semver-ts');
|
|
15
13
|
|
|
16
14
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
17
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -35,14 +33,12 @@ function _interopNamespace(e) {
|
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
var fs2__namespace = /*#__PURE__*/_interopNamespace(fs2);
|
|
38
|
-
var
|
|
36
|
+
var path2__namespace = /*#__PURE__*/_interopNamespace(path2);
|
|
39
37
|
var invariant__default = /*#__PURE__*/_interopDefault(invariant);
|
|
40
38
|
var yargs__default = /*#__PURE__*/_interopDefault(yargs);
|
|
41
39
|
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
42
40
|
|
|
43
|
-
//
|
|
44
|
-
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
45
|
-
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
41
|
+
// src/cli/main.ts
|
|
46
42
|
|
|
47
43
|
// src/api/types.ts
|
|
48
44
|
var OntologyEntityTypeEnum = /* @__PURE__ */ function(OntologyEntityTypeEnum2) {
|
|
@@ -80,28 +76,24 @@ function defineObject(objectDef) {
|
|
|
80
76
|
!(objectDef.properties ?? []).filter((p) => p.apiName === objectDef.titlePropertyApiName).every((p) => !isExotic(p.type)) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Title property ${objectDef.titlePropertyApiName} must be a primitive type`) : invariant__default.default(false) : void 0;
|
|
81
77
|
!(objectDef.properties ?? []).filter((p) => p.apiName === objectDef.primaryKeyPropertyApiName).every((p) => !isExotic(p.type)) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Primary key properties ${objectDef.primaryKeyPropertyApiName} can only be primitive types`) : invariant__default.default(false) : void 0;
|
|
82
78
|
objectDef.implementsInterfaces?.forEach((interfaceImpl) => {
|
|
83
|
-
const
|
|
79
|
+
const allInterfaceProperties = getAllInterfaceProperties(interfaceImpl.implements);
|
|
80
|
+
const nonExistentInterfaceProperties = interfaceImpl.propertyMapping.map((val) => val.interfaceProperty).filter((interfaceProperty) => allInterfaceProperties[addNamespaceIfNone(interfaceProperty)] === void 0).map((interfaceProp) => ({
|
|
84
81
|
type: "invalid",
|
|
85
|
-
reason: `Interface property ${
|
|
82
|
+
reason: `Interface property ${interfaceProp} referenced in ${objectDef.apiName} object does not exist`
|
|
86
83
|
}));
|
|
87
|
-
const interfaceToObjectProperties = Object.fromEntries(interfaceImpl.propertyMapping.map((mapping) => [mapping.interfaceProperty, mapping.mapsTo]));
|
|
84
|
+
const interfaceToObjectProperties = Object.fromEntries(interfaceImpl.propertyMapping.map((mapping) => [addNamespaceIfNone(mapping.interfaceProperty), mapping.mapsTo]));
|
|
88
85
|
const validateProperty = (interfaceProp) => {
|
|
89
|
-
if (interfaceProp[1].sharedPropertyType.
|
|
86
|
+
if (interfaceProp[1].sharedPropertyType.apiName in interfaceToObjectProperties) {
|
|
90
87
|
return validateInterfaceImplProperty(interfaceProp[1].sharedPropertyType, interfaceToObjectProperties[interfaceProp[0]], objectDef);
|
|
91
88
|
}
|
|
92
89
|
return {
|
|
93
90
|
type: "invalid",
|
|
94
|
-
reason: `Interface property ${
|
|
91
|
+
reason: `Interface property ${interfaceProp[1].sharedPropertyType.apiName} not implemented by ${objectDef.apiName} object definition`
|
|
95
92
|
};
|
|
96
93
|
};
|
|
97
|
-
const
|
|
98
|
-
const
|
|
99
|
-
const allFailedValidations = baseValidations.concat(extendsValidations, nonExistentInterfaceProperties).filter((val) => val.type === "invalid");
|
|
94
|
+
const validations = Object.entries(getAllInterfaceProperties(interfaceImpl.implements)).map(validateProperty);
|
|
95
|
+
const allFailedValidations = validations.concat(nonExistentInterfaceProperties).filter((val) => val.type === "invalid");
|
|
100
96
|
!(allFailedValidations.length === 0) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "\n" + allFailedValidations.map(formatValidationErrors).join("\n")) : invariant__default.default(false) : void 0;
|
|
101
|
-
interfaceImpl.propertyMapping = interfaceImpl.propertyMapping.map((mapping) => ({
|
|
102
|
-
interfaceProperty: extractNamespace(interfaceImpl.implements.apiName) + mapping.interfaceProperty,
|
|
103
|
-
mapsTo: mapping.mapsTo
|
|
104
|
-
}));
|
|
105
97
|
});
|
|
106
98
|
const finalObject = {
|
|
107
99
|
...objectDef,
|
|
@@ -131,7 +123,7 @@ function validateInterfaceImplProperty(spt, mappedObjectProp, object) {
|
|
|
131
123
|
reason: `Object property mapped to interface does not exist. Object Property Mapped: ${mappedObjectProp}`
|
|
132
124
|
};
|
|
133
125
|
}
|
|
134
|
-
if (spt.type !== objProp?.type) {
|
|
126
|
+
if (JSON.stringify(spt.type) !== JSON.stringify(objProp?.type)) {
|
|
135
127
|
return {
|
|
136
128
|
type: "invalid",
|
|
137
129
|
reason: `Object property type does not match the interface property it is mapped to. Interface Property: ${spt.apiName}, objectProperty: ${mappedObjectProp}`
|
|
@@ -147,6 +139,16 @@ function convertToDisplayName(s) {
|
|
|
147
139
|
function convertToPluralDisplayName(s) {
|
|
148
140
|
return s === void 0 || s == null ? "" : s.endsWith("s") ? convertToDisplayName(s) : convertToDisplayName(s) + "s";
|
|
149
141
|
}
|
|
142
|
+
function getAllInterfaceProperties(interfaceType) {
|
|
143
|
+
let properties = interfaceType.propertiesV2;
|
|
144
|
+
interfaceType.extendsInterfaces.forEach((ext) => {
|
|
145
|
+
properties = {
|
|
146
|
+
...properties,
|
|
147
|
+
...getAllInterfaceProperties(ext)
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
return properties;
|
|
151
|
+
}
|
|
150
152
|
var defaultTypeClasses = [{
|
|
151
153
|
kind: "render_hint",
|
|
152
154
|
name: "SELECTABLE"
|
|
@@ -442,7 +444,7 @@ async function defineOntology(ns, body, outputDir, dependencyFile) {
|
|
|
442
444
|
};
|
|
443
445
|
}
|
|
444
446
|
function writeStaticObjects(outputDir) {
|
|
445
|
-
const codegenDir =
|
|
447
|
+
const codegenDir = path2__namespace.resolve(outputDir, "codegen");
|
|
446
448
|
const typeDirs = {
|
|
447
449
|
[OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: "shared-property-types",
|
|
448
450
|
[OntologyEntityTypeEnum.ACTION_TYPE]: "action-types",
|
|
@@ -457,7 +459,7 @@ function writeStaticObjects(outputDir) {
|
|
|
457
459
|
});
|
|
458
460
|
}
|
|
459
461
|
Object.values(typeDirs).forEach((typeDirNameFromMap) => {
|
|
460
|
-
const currentTypeDirPath =
|
|
462
|
+
const currentTypeDirPath = path2__namespace.join(codegenDir, typeDirNameFromMap);
|
|
461
463
|
if (fs__namespace.existsSync(currentTypeDirPath)) {
|
|
462
464
|
fs__namespace.rmSync(currentTypeDirPath, {
|
|
463
465
|
recursive: true,
|
|
@@ -471,11 +473,11 @@ function writeStaticObjects(outputDir) {
|
|
|
471
473
|
const topLevelExportStatements = [];
|
|
472
474
|
Object.entries(ontologyDefinition).forEach(([ontologyTypeEnumKey, entities]) => {
|
|
473
475
|
const typeDirName = typeDirs[ontologyTypeEnumKey];
|
|
474
|
-
const typeDirPath =
|
|
476
|
+
const typeDirPath = path2__namespace.join(codegenDir, typeDirName);
|
|
475
477
|
const entityModuleNames = [];
|
|
476
478
|
Object.entries(entities).forEach(([apiName, entity]) => {
|
|
477
479
|
const entityFileNameBase = camel(withoutNamespace(apiName)) + (ontologyTypeEnumKey === OntologyEntityTypeEnum.VALUE_TYPE ? "ValueType" : "");
|
|
478
|
-
const filePath =
|
|
480
|
+
const filePath = path2__namespace.join(typeDirPath, `${entityFileNameBase}.ts`);
|
|
479
481
|
const entityTypeName = getEntityTypeName(ontologyTypeEnumKey);
|
|
480
482
|
const entityJSON = JSON.stringify(entity, null, 2).replace(/("__type"\s*:\s*)"([^"]*)"/g, (_, prefix, value) => `${prefix}OntologyEntityTypeEnum.${value}`);
|
|
481
483
|
const content = `
|
|
@@ -497,7 +499,7 @@ export const ${entityFileNameBase}: ${entityTypeName} = wrapWithProxy(${entityFi
|
|
|
497
499
|
});
|
|
498
500
|
if (topLevelExportStatements.length > 0) {
|
|
499
501
|
const mainIndexContent = dependencyInjectionString() + topLevelExportStatements.join("\n") + "\n";
|
|
500
|
-
const mainIndexFilePath =
|
|
502
|
+
const mainIndexFilePath = path2__namespace.join(outputDir, "index.ts");
|
|
501
503
|
fs__namespace.writeFileSync(mainIndexFilePath, mainIndexContent, {
|
|
502
504
|
flag: "w"
|
|
503
505
|
});
|
|
@@ -551,7 +553,7 @@ function convertToWireImportedTypes(importedTypes2) {
|
|
|
551
553
|
apiName: i.interfaceType.apiName,
|
|
552
554
|
displayName: i.interfaceType.displayMetadata.displayName,
|
|
553
555
|
description: i.interfaceType.displayMetadata.description,
|
|
554
|
-
properties: Object.values(i.interfaceType.
|
|
556
|
+
properties: Object.values(i.interfaceType.propertiesV2).map((p) => ({
|
|
555
557
|
apiName: p.sharedPropertyType.apiName,
|
|
556
558
|
displayName: p.sharedPropertyType.displayMetadata.displayName,
|
|
557
559
|
description: p.sharedPropertyType.displayMetadata.description,
|
|
@@ -670,7 +672,7 @@ function convertObject(objectType) {
|
|
|
670
672
|
redacted: false,
|
|
671
673
|
implementsInterfaces2: implementations.map((impl) => ({
|
|
672
674
|
interfaceTypeApiName: impl.implements.apiName,
|
|
673
|
-
properties: Object.fromEntries(impl.propertyMapping.map((mapping) => [mapping.interfaceProperty, {
|
|
675
|
+
properties: Object.fromEntries(impl.propertyMapping.map((mapping) => [addNamespaceIfNone(mapping.interfaceProperty), {
|
|
674
676
|
propertyTypeRid: mapping.mapsTo
|
|
675
677
|
}]))
|
|
676
678
|
})),
|
|
@@ -803,7 +805,12 @@ function convertProperty(property) {
|
|
|
803
805
|
indexedForSearch: property.indexedForSearch ?? true,
|
|
804
806
|
ruleSetBinding: void 0,
|
|
805
807
|
baseFormatter: property.baseFormatter,
|
|
806
|
-
type:
|
|
808
|
+
type: property.array ? {
|
|
809
|
+
type: "array",
|
|
810
|
+
array: {
|
|
811
|
+
subtype: convertType(property.type)
|
|
812
|
+
}
|
|
813
|
+
} : convertType(property.type),
|
|
807
814
|
typeClasses: property.typeClasses ?? (shouldNotHaveRenderHints(property.type) ? [] : defaultTypeClasses),
|
|
808
815
|
status: convertObjectStatus(property.status),
|
|
809
816
|
inlineAction: void 0,
|
|
@@ -939,6 +946,9 @@ function convertInterface(interfaceType) {
|
|
|
939
946
|
allLinks: [],
|
|
940
947
|
allProperties: [],
|
|
941
948
|
allPropertiesV2: {},
|
|
949
|
+
// TODO(mwalther): Support propertiesV3
|
|
950
|
+
propertiesV3: {},
|
|
951
|
+
allPropertiesV3: {},
|
|
942
952
|
properties: []
|
|
943
953
|
};
|
|
944
954
|
}
|
|
@@ -1079,6 +1089,7 @@ function convertActionValidation(action) {
|
|
|
1079
1089
|
},
|
|
1080
1090
|
parameterValidations: Object.fromEntries((action.parameters ?? []).map((p) => {
|
|
1081
1091
|
return [p.id, {
|
|
1092
|
+
conditionalOverrides: [],
|
|
1082
1093
|
defaultValidation: {
|
|
1083
1094
|
display: {
|
|
1084
1095
|
renderHint: renderHintFromBaseType(p),
|
|
@@ -1348,9 +1359,6 @@ function convertParameterRequirementConstraint(required) {
|
|
|
1348
1359
|
function sanitize(namespace2, s) {
|
|
1349
1360
|
return s.includes(".") ? s : namespace2 + s;
|
|
1350
1361
|
}
|
|
1351
|
-
function extractNamespace(apiName) {
|
|
1352
|
-
return apiName.substring(0, apiName.lastIndexOf(".") + 1);
|
|
1353
|
-
}
|
|
1354
1362
|
function withoutNamespace(apiName) {
|
|
1355
1363
|
const lastDot = apiName.lastIndexOf(".");
|
|
1356
1364
|
if (lastDot === -1) {
|
|
@@ -1381,37 +1389,32 @@ function writeDependencyFile(dependencyFile) {
|
|
|
1381
1389
|
}
|
|
1382
1390
|
function dependencyInjectionString() {
|
|
1383
1391
|
const namespaceNoDot = namespace.endsWith(".") ? namespace.slice(0, -1) : namespace;
|
|
1384
|
-
|
|
1385
|
-
let packageJsonDirPath = path__namespace.join(currentFilePath, "..", "..", "..");
|
|
1386
|
-
if (!currentFilePath.endsWith(".ts")) {
|
|
1387
|
-
packageJsonDirPath = path__namespace.join(packageJsonDirPath, "..");
|
|
1388
|
-
}
|
|
1389
|
-
const packageJsonFilePath = path__namespace.join(packageJsonDirPath, "package.json");
|
|
1390
|
-
const packageJson = JSON.parse(fs__namespace.readFileSync(packageJsonFilePath, "utf-8"));
|
|
1391
|
-
const currentPackageVersion = packageJson.version ?? "";
|
|
1392
|
-
return `import { addDependency } from '@osdk/maker';
|
|
1392
|
+
return `import { addDependency } from "@osdk/maker";
|
|
1393
1393
|
|
|
1394
|
-
addDependency("${namespaceNoDot}",
|
|
1394
|
+
addDependency("${namespaceNoDot}", new URL(import.meta.url).pathname);
|
|
1395
1395
|
`;
|
|
1396
1396
|
}
|
|
1397
|
+
function addNamespaceIfNone(apiName) {
|
|
1398
|
+
return apiName.includes(".") ? apiName : namespace + apiName;
|
|
1399
|
+
}
|
|
1397
1400
|
|
|
1398
1401
|
// src/cli/main.ts
|
|
1399
1402
|
var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
|
|
1400
1403
|
async function main(args = process.argv) {
|
|
1401
|
-
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.11.0
|
|
1404
|
+
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.11.0").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
|
|
1402
1405
|
input: {
|
|
1403
1406
|
alias: "i",
|
|
1404
1407
|
describe: "Input file",
|
|
1405
1408
|
type: "string",
|
|
1406
1409
|
default: ".ontology/ontology.ts",
|
|
1407
|
-
coerce:
|
|
1410
|
+
coerce: path2__namespace.resolve
|
|
1408
1411
|
},
|
|
1409
1412
|
output: {
|
|
1410
1413
|
alias: "o",
|
|
1411
1414
|
describe: "Output file",
|
|
1412
1415
|
type: "string",
|
|
1413
1416
|
default: "ontology.json",
|
|
1414
|
-
coerce:
|
|
1417
|
+
coerce: path2__namespace.resolve
|
|
1415
1418
|
},
|
|
1416
1419
|
apiNamespace: {
|
|
1417
1420
|
describe: "Api name prefix for namespaced ontology types",
|
|
@@ -1423,24 +1426,24 @@ async function main(args = process.argv) {
|
|
|
1423
1426
|
describe: "Snapshot directory",
|
|
1424
1427
|
type: "string",
|
|
1425
1428
|
default: "snapshots",
|
|
1426
|
-
coerce:
|
|
1429
|
+
coerce: path2__namespace.resolve
|
|
1427
1430
|
},
|
|
1428
1431
|
outputDir: {
|
|
1429
1432
|
alias: "d",
|
|
1430
1433
|
describe: "Directory for generated ontology entities",
|
|
1431
1434
|
type: "string",
|
|
1432
|
-
coerce:
|
|
1435
|
+
coerce: path2__namespace.resolve
|
|
1433
1436
|
},
|
|
1434
1437
|
valueTypesOutput: {
|
|
1435
1438
|
describe: "Value Type Output File",
|
|
1436
1439
|
type: "string",
|
|
1437
1440
|
default: "value-types.json",
|
|
1438
|
-
coerce:
|
|
1441
|
+
coerce: path2__namespace.resolve
|
|
1439
1442
|
},
|
|
1440
1443
|
dependencies: {
|
|
1441
1444
|
describe: "File to write dependencies to",
|
|
1442
1445
|
type: "string",
|
|
1443
|
-
coerce:
|
|
1446
|
+
coerce: path2__namespace.resolve
|
|
1444
1447
|
}
|
|
1445
1448
|
}).parseAsync();
|
|
1446
1449
|
let apiNamespace = "";
|
|
@@ -1468,10 +1471,25 @@ async function loadOntology(input, apiNamespace, outputDir, dependencyFile) {
|
|
|
1468
1471
|
}, outputDir, dependencyFile);
|
|
1469
1472
|
return q;
|
|
1470
1473
|
}
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
+
var MAX_SEARCH_DEPTH = 5;
|
|
1475
|
+
function addDependency(namespaceNoDot, fileInPackage) {
|
|
1476
|
+
let dir = path2__namespace.dirname(fileInPackage);
|
|
1477
|
+
let packageJsonPath = null;
|
|
1478
|
+
for (let i = 0; i < MAX_SEARCH_DEPTH; i++) {
|
|
1479
|
+
const candidate = path2__namespace.join(dir, "package.json");
|
|
1480
|
+
if (fs__namespace.existsSync(candidate)) {
|
|
1481
|
+
packageJsonPath = candidate;
|
|
1482
|
+
break;
|
|
1483
|
+
}
|
|
1484
|
+
const parentDir = path2__namespace.dirname(dir);
|
|
1485
|
+
if (parentDir === dir) break;
|
|
1486
|
+
dir = parentDir;
|
|
1487
|
+
}
|
|
1488
|
+
if (!packageJsonPath) {
|
|
1489
|
+
throw new Error(`Could not find a package.json within ${MAX_SEARCH_DEPTH} parent directories of ${fileInPackage}`);
|
|
1474
1490
|
}
|
|
1491
|
+
const packageJson = JSON.parse(fs__namespace.readFileSync(packageJsonPath, "utf-8"));
|
|
1492
|
+
dependencies[namespaceNoDot] = packageJson.version ?? "";
|
|
1475
1493
|
}
|
|
1476
1494
|
function defineCreateInterfaceObjectAction(interfaceType, objectType, validation) {
|
|
1477
1495
|
return defineAction({
|
|
@@ -1504,7 +1522,7 @@ function defineCreateInterfaceObjectAction(interfaceType, objectType, validation
|
|
|
1504
1522
|
}]
|
|
1505
1523
|
}
|
|
1506
1524
|
}
|
|
1507
|
-
}, ...Object.entries(interfaceType
|
|
1525
|
+
}, ...Object.entries(getAllInterfaceProperties(interfaceType)).map(([id, prop]) => ({
|
|
1508
1526
|
id,
|
|
1509
1527
|
displayName: prop.sharedPropertyType.displayName ?? prop.sharedPropertyType.nonNameSpacedApiName,
|
|
1510
1528
|
type: extractActionParameterType(prop.sharedPropertyType),
|
|
@@ -1522,7 +1540,7 @@ function defineCreateInterfaceObjectAction(interfaceType, objectType, validation
|
|
|
1522
1540
|
addInterfaceRule: {
|
|
1523
1541
|
interfaceApiName: interfaceType.apiName,
|
|
1524
1542
|
objectTypeParameter: "objectTypeParameter",
|
|
1525
|
-
sharedPropertyValues: Object.fromEntries(Object.entries(interfaceType
|
|
1543
|
+
sharedPropertyValues: Object.fromEntries(Object.entries(getAllInterfaceProperties(interfaceType)).map(([id, prop]) => [id, {
|
|
1526
1544
|
type: "parameterId",
|
|
1527
1545
|
parameterId: id
|
|
1528
1546
|
}]))
|
|
@@ -1593,7 +1611,7 @@ function defineModifyInterfaceObjectAction(interfaceType, objectType, validation
|
|
|
1593
1611
|
}]
|
|
1594
1612
|
}
|
|
1595
1613
|
}
|
|
1596
|
-
}, ...Object.entries(interfaceType
|
|
1614
|
+
}, ...Object.entries(getAllInterfaceProperties(interfaceType)).map(([id, prop]) => ({
|
|
1597
1615
|
id,
|
|
1598
1616
|
displayName: prop.sharedPropertyType.displayName ?? prop.sharedPropertyType.nonNameSpacedApiName,
|
|
1599
1617
|
type: extractActionParameterType(prop.sharedPropertyType),
|
|
@@ -1610,7 +1628,7 @@ function defineModifyInterfaceObjectAction(interfaceType, objectType, validation
|
|
|
1610
1628
|
type: "modifyInterfaceRule",
|
|
1611
1629
|
modifyInterfaceRule: {
|
|
1612
1630
|
interfaceObjectToModifyParameter: "interfaceObjectToModifyParameter",
|
|
1613
|
-
sharedPropertyValues: Object.fromEntries(Object.entries(interfaceType
|
|
1631
|
+
sharedPropertyValues: Object.fromEntries(Object.entries(getAllInterfaceProperties(interfaceType)).map(([id, prop]) => [id, {
|
|
1614
1632
|
type: "parameterId",
|
|
1615
1633
|
parameterId: id
|
|
1616
1634
|
}]))
|
|
@@ -1746,8 +1764,8 @@ function referencedParameterIds(actionDef) {
|
|
|
1746
1764
|
if (v.type === "parameterId") {
|
|
1747
1765
|
parameterIds.add(v.parameterId);
|
|
1748
1766
|
}
|
|
1749
|
-
rule.addInterfaceRule.sharedPropertyValues[sanitize2(k)] = v;
|
|
1750
1767
|
delete rule.addInterfaceRule.sharedPropertyValues[k];
|
|
1768
|
+
rule.addInterfaceRule.sharedPropertyValues[sanitize2(k)] = v;
|
|
1751
1769
|
});
|
|
1752
1770
|
break;
|
|
1753
1771
|
case "modifyInterfaceRule":
|
|
@@ -1756,8 +1774,8 @@ function referencedParameterIds(actionDef) {
|
|
|
1756
1774
|
if (v.type === "parameterId") {
|
|
1757
1775
|
parameterIds.add(v.parameterId);
|
|
1758
1776
|
}
|
|
1759
|
-
rule.modifyInterfaceRule.sharedPropertyValues[sanitize2(k)] = v;
|
|
1760
1777
|
delete rule.modifyInterfaceRule.sharedPropertyValues[k];
|
|
1778
|
+
rule.modifyInterfaceRule.sharedPropertyValues[sanitize2(k)] = v;
|
|
1761
1779
|
});
|
|
1762
1780
|
break;
|
|
1763
1781
|
case "addObjectRule":
|
|
@@ -2017,16 +2035,16 @@ function defineSharedPropertyType(sptDef) {
|
|
|
2017
2035
|
function defineInterface(interfaceDef) {
|
|
2018
2036
|
const apiName = namespace + interfaceDef.apiName;
|
|
2019
2037
|
!(ontologyDefinition[OntologyEntityTypeEnum.INTERFACE_TYPE][apiName] === void 0) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Interface ${apiName} already exists`) : invariant__default.default(false) : void 0;
|
|
2020
|
-
const properties = Object.fromEntries(Object.entries(interfaceDef.properties ?? {}).map(([
|
|
2038
|
+
const properties = Object.fromEntries(Object.entries(interfaceDef.properties ?? {}).map(([propApiName, type]) => {
|
|
2021
2039
|
if (typeof type === "object" && "propertyDefinition" in type) {
|
|
2022
|
-
return [
|
|
2040
|
+
return [namespace + propApiName, {
|
|
2023
2041
|
required: type.required,
|
|
2024
|
-
sharedPropertyType: unifyBasePropertyDefinition(namespace,
|
|
2042
|
+
sharedPropertyType: unifyBasePropertyDefinition(namespace, propApiName, type.propertyDefinition)
|
|
2025
2043
|
}];
|
|
2026
2044
|
}
|
|
2027
|
-
return [
|
|
2045
|
+
return [namespace + propApiName, {
|
|
2028
2046
|
required: true,
|
|
2029
|
-
sharedPropertyType: unifyBasePropertyDefinition(namespace,
|
|
2047
|
+
sharedPropertyType: unifyBasePropertyDefinition(namespace, propApiName, type)
|
|
2030
2048
|
}];
|
|
2031
2049
|
}));
|
|
2032
2050
|
const extendsInterfaces = interfaceDef.extends ? Array.isArray(interfaceDef.extends) ? interfaceDef.extends : [interfaceDef.extends] : [];
|
|
@@ -2051,6 +2069,7 @@ function defineInterface(interfaceDef) {
|
|
|
2051
2069
|
links: [],
|
|
2052
2070
|
status,
|
|
2053
2071
|
propertiesV2: properties,
|
|
2072
|
+
searchable: interfaceDef.searchable ?? true,
|
|
2054
2073
|
__type: OntologyEntityTypeEnum.INTERFACE_TYPE
|
|
2055
2074
|
};
|
|
2056
2075
|
updateOntology(fullInterface);
|