@osdk/maker 0.11.0-beta.2 → 0.11.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/build/browser/api/defineAction.js +69 -10
- package/build/browser/api/defineAction.js.map +1 -1
- package/build/browser/api/defineImportSpt.js +3 -1
- package/build/browser/api/defineImportSpt.js.map +1 -1
- package/build/browser/api/defineLink.js +0 -7
- package/build/browser/api/defineLink.js.map +1 -1
- package/build/browser/api/defineOntology.js +30 -2
- package/build/browser/api/defineOntology.js.map +1 -1
- package/build/browser/api/defineSpt.js +3 -17
- package/build/browser/api/defineSpt.js.map +1 -1
- package/build/browser/api/overall.test.js +3126 -2088
- 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/cjs/index.cjs +103 -28
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +11 -5
- package/build/esm/api/defineAction.js +69 -10
- package/build/esm/api/defineAction.js.map +1 -1
- package/build/esm/api/defineImportSpt.js +3 -1
- package/build/esm/api/defineImportSpt.js.map +1 -1
- package/build/esm/api/defineLink.js +0 -7
- package/build/esm/api/defineLink.js.map +1 -1
- package/build/esm/api/defineOntology.js +30 -2
- package/build/esm/api/defineOntology.js.map +1 -1
- package/build/esm/api/defineSpt.js +3 -17
- package/build/esm/api/defineSpt.js.map +1 -1
- package/build/esm/api/overall.test.js +3126 -2088
- 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/types/api/defineAction.d.ts +6 -6
- package/build/types/api/defineAction.d.ts.map +1 -1
- package/build/types/api/defineImportSpt.d.ts +1 -0
- package/build/types/api/defineImportSpt.d.ts.map +1 -1
- package/build/types/api/defineLink.d.ts.map +1 -1
- package/build/types/api/defineOntology.d.ts +5 -1
- package/build/types/api/defineOntology.d.ts.map +1 -1
- package/build/types/api/defineSpt.d.ts.map +1 -1
- package/build/types/api/types.d.ts +7 -1
- package/build/types/api/types.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -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 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: string | ValueTypeDefinitionVersion;\n sharedPropertyType: SharedPropertyType;\n description: string | undefined;\n displayName: string;\n visibility: Visibility;\n nullability?: Nullability;\n status?: ObjectTypeStatus;\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 | \"allExtendsInterfaces\"\n | \"propertiesV2\"\n | \"allPropertiesV2\"\n >\n{\n propertiesV2: Record<string, InterfacePropertyType>;\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\ntype 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 & OneToManyLinkTypeDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n },\n \"__type\"\n >\n | Omit<\n OntologyEntityBase & ManyToManyLinkTypeDefinition & {\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 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 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 type ObjectTypeDatasourceDefinition =\n | ObjectTypeDatasourceDefinition_stream\n | ObjectTypeDatasourceDefinition_dataset;\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: string | ValueTypeDefinitionVersion;\n sharedPropertyType: SharedPropertyType;\n description: string | undefined;\n displayName: string;\n visibility: Visibility;\n nullability?: Nullability;\n status?: ObjectTypeStatus;\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 | \"allExtendsInterfaces\"\n | \"propertiesV2\"\n | \"allPropertiesV2\"\n >\n{\n propertiesV2: Record<string, InterfacePropertyType>;\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 & OneToManyLinkTypeDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n },\n \"__type\"\n >\n | Omit<\n OntologyEntityBase & ManyToManyLinkTypeDefinition & {\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 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 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 type ObjectTypeDatasourceDefinition =\n | ObjectTypeDatasourceDefinition_stream\n | ObjectTypeDatasourceDefinition_dataset;\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":[]}
|
|
@@ -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.11.0-beta.
|
|
26
|
+
const commandLineOpts = await yargs(hideBin(args)).version("0.11.0-beta.4" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
|
|
27
27
|
input: {
|
|
28
28
|
alias: "i",
|
|
29
29
|
describe: "Input file",
|
package/build/cjs/index.cjs
CHANGED
|
@@ -366,7 +366,15 @@ function convertToWireBlockData(ontology) {
|
|
|
366
366
|
return [apiName, convertAction(action)];
|
|
367
367
|
})),
|
|
368
368
|
blockPermissionInformation: {
|
|
369
|
-
actionTypes: {
|
|
369
|
+
actionTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.ACTION_TYPE]).filter(([apiName, action]) => action.validation).map(([apiName, action]) => {
|
|
370
|
+
return [apiName, {
|
|
371
|
+
restrictionStatus: {
|
|
372
|
+
hasRolesApplied: true,
|
|
373
|
+
ontologyPackageRid: null,
|
|
374
|
+
publicProject: false
|
|
375
|
+
}
|
|
376
|
+
}];
|
|
377
|
+
})),
|
|
370
378
|
linkTypes: {},
|
|
371
379
|
objectTypes: {}
|
|
372
380
|
}
|
|
@@ -506,7 +514,25 @@ function convertDatasourceDefinition(objectType, properties) {
|
|
|
506
514
|
};
|
|
507
515
|
}
|
|
508
516
|
}
|
|
517
|
+
var defaultTypeClasses = [{
|
|
518
|
+
kind: "render_hint",
|
|
519
|
+
name: "SELECTABLE"
|
|
520
|
+
}, {
|
|
521
|
+
kind: "render_hint",
|
|
522
|
+
name: "SORTABLE"
|
|
523
|
+
}];
|
|
524
|
+
function shouldNotHaveRenderHints(type) {
|
|
525
|
+
return ["struct", "mediaReference", "geotimeSeries"].includes(getPropertyTypeName(type));
|
|
526
|
+
}
|
|
527
|
+
function hasRenderHints(typeClasses) {
|
|
528
|
+
return (typeClasses ?? []).some((tc) => tc.kind.toLowerCase() === "render_hint");
|
|
529
|
+
}
|
|
530
|
+
function getPropertyTypeName(type) {
|
|
531
|
+
return typeof type === "object" ? type.type : type;
|
|
532
|
+
}
|
|
509
533
|
function convertProperty(property) {
|
|
534
|
+
const apiName = namespace + property.apiName;
|
|
535
|
+
!(!shouldNotHaveRenderHints(property.type) || !hasRenderHints(property.typeClasses)) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Property type ${apiName} of type '${getPropertyTypeName(property.type)}' should not have render hints`) : invariant__default.default(false) : void 0;
|
|
510
536
|
const output = {
|
|
511
537
|
apiName: property.apiName,
|
|
512
538
|
sharedPropertyTypeApiName: property.sharedPropertyType?.apiName,
|
|
@@ -519,7 +545,7 @@ function convertProperty(property) {
|
|
|
519
545
|
ruleSetBinding: void 0,
|
|
520
546
|
baseFormatter: property.baseFormatter,
|
|
521
547
|
type: convertType(property.type),
|
|
522
|
-
typeClasses: property.typeClasses ?? [],
|
|
548
|
+
typeClasses: property.typeClasses ?? (shouldNotHaveRenderHints(property.type) ? [] : defaultTypeClasses),
|
|
523
549
|
status: convertObjectStatus(property.status),
|
|
524
550
|
inlineAction: void 0,
|
|
525
551
|
dataConstraints: convertNullabilityToDataConstraint(property),
|
|
@@ -1220,7 +1246,7 @@ function getEntityTypeName(type) {
|
|
|
1220
1246
|
// src/cli/main.ts
|
|
1221
1247
|
var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
|
|
1222
1248
|
async function main(args = process.argv) {
|
|
1223
|
-
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.11.0-beta.
|
|
1249
|
+
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.11.0-beta.4").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
|
|
1224
1250
|
input: {
|
|
1225
1251
|
alias: "i",
|
|
1226
1252
|
describe: "Input file",
|
|
@@ -1277,7 +1303,7 @@ async function loadOntology(input, apiNamespace, outputDir) {
|
|
|
1277
1303
|
const q = await defineOntology(apiNamespace, async () => await import(input), outputDir);
|
|
1278
1304
|
return q;
|
|
1279
1305
|
}
|
|
1280
|
-
function defineCreateInterfaceObjectAction(interfaceType, objectType) {
|
|
1306
|
+
function defineCreateInterfaceObjectAction(interfaceType, objectType, validation) {
|
|
1281
1307
|
return defineAction({
|
|
1282
1308
|
apiName: `create-${kebab(interfaceType.apiName.split(".").pop() ?? interfaceType.apiName)}${objectType === void 0 ? "" : `-${kebab(objectType.apiName.split(".").pop() ?? objectType.apiName)}`}`,
|
|
1283
1309
|
displayName: `Create ${interfaceType.displayMetadata.displayName}`,
|
|
@@ -1331,10 +1357,13 @@ function defineCreateInterfaceObjectAction(interfaceType, objectType) {
|
|
|
1331
1357
|
parameterId: id
|
|
1332
1358
|
}]))
|
|
1333
1359
|
}
|
|
1334
|
-
}]
|
|
1360
|
+
}],
|
|
1361
|
+
...validation ? {
|
|
1362
|
+
validation: [createValidationRule(validation)]
|
|
1363
|
+
} : {}
|
|
1335
1364
|
});
|
|
1336
1365
|
}
|
|
1337
|
-
function defineCreateObjectAction(objectType) {
|
|
1366
|
+
function defineCreateObjectAction(objectType, validation) {
|
|
1338
1367
|
return defineAction({
|
|
1339
1368
|
apiName: `create-object-${kebab(objectType.apiName.split(".").pop() ?? objectType.apiName)}`,
|
|
1340
1369
|
displayName: `Create ${objectType.displayName}`,
|
|
@@ -1358,10 +1387,13 @@ function defineCreateObjectAction(objectType) {
|
|
|
1358
1387
|
}])) : {},
|
|
1359
1388
|
structFieldValues: {}
|
|
1360
1389
|
}
|
|
1361
|
-
}]
|
|
1390
|
+
}],
|
|
1391
|
+
...validation ? {
|
|
1392
|
+
validation: [createValidationRule(validation)]
|
|
1393
|
+
} : {}
|
|
1362
1394
|
});
|
|
1363
1395
|
}
|
|
1364
|
-
function defineModifyInterfaceObjectAction(interfaceType, objectType) {
|
|
1396
|
+
function defineModifyInterfaceObjectAction(interfaceType, objectType, validation) {
|
|
1365
1397
|
return defineAction({
|
|
1366
1398
|
apiName: `modify-${kebab(interfaceType.apiName.split(".").pop() ?? interfaceType.apiName)}${objectType === void 0 ? "" : `-${kebab(objectType.apiName.split(".").pop() ?? objectType.apiName)}`}`,
|
|
1367
1399
|
displayName: `Modify ${interfaceType.displayMetadata.displayName}`,
|
|
@@ -1413,10 +1445,13 @@ function defineModifyInterfaceObjectAction(interfaceType, objectType) {
|
|
|
1413
1445
|
parameterId: id
|
|
1414
1446
|
}]))
|
|
1415
1447
|
}
|
|
1416
|
-
}]
|
|
1448
|
+
}],
|
|
1449
|
+
...validation ? {
|
|
1450
|
+
validation: [createValidationRule(validation)]
|
|
1451
|
+
} : {}
|
|
1417
1452
|
});
|
|
1418
1453
|
}
|
|
1419
|
-
function defineModifyObjectAction(objectType) {
|
|
1454
|
+
function defineModifyObjectAction(objectType, validation) {
|
|
1420
1455
|
return defineAction({
|
|
1421
1456
|
apiName: `modify-object-${kebab(objectType.apiName.split(".").pop() ?? objectType.apiName)}`,
|
|
1422
1457
|
displayName: `Modify ${objectType.displayName}`,
|
|
@@ -1455,10 +1490,13 @@ function defineModifyObjectAction(objectType) {
|
|
|
1455
1490
|
}])) : {},
|
|
1456
1491
|
structFieldValues: {}
|
|
1457
1492
|
}
|
|
1458
|
-
}]
|
|
1493
|
+
}],
|
|
1494
|
+
...validation ? {
|
|
1495
|
+
validation: [createValidationRule(validation)]
|
|
1496
|
+
} : {}
|
|
1459
1497
|
});
|
|
1460
1498
|
}
|
|
1461
|
-
function defineDeleteObjectAction(objectType) {
|
|
1499
|
+
function defineDeleteObjectAction(objectType, validation) {
|
|
1462
1500
|
return defineAction({
|
|
1463
1501
|
apiName: `delete-object-${kebab(objectType.apiName.split(".").pop() ?? objectType.apiName)}`,
|
|
1464
1502
|
displayName: `Delete ${objectType.displayName}`,
|
|
@@ -1484,7 +1522,10 @@ function defineDeleteObjectAction(objectType) {
|
|
|
1484
1522
|
deleteObjectRule: {
|
|
1485
1523
|
objectToDelete: "objectToDeleteParameter"
|
|
1486
1524
|
}
|
|
1487
|
-
}]
|
|
1525
|
+
}],
|
|
1526
|
+
...validation ? {
|
|
1527
|
+
validation: [createValidationRule(validation)]
|
|
1528
|
+
} : {}
|
|
1488
1529
|
});
|
|
1489
1530
|
}
|
|
1490
1531
|
function defineAction(actionDef) {
|
|
@@ -1702,6 +1743,50 @@ function kebab(s) {
|
|
|
1702
1743
|
function sanitize2(s) {
|
|
1703
1744
|
return s.includes(".") ? s : namespace + s;
|
|
1704
1745
|
}
|
|
1746
|
+
function createValidationRule(actionValidation) {
|
|
1747
|
+
if (!("type" in actionValidation)) {
|
|
1748
|
+
return actionValidation;
|
|
1749
|
+
}
|
|
1750
|
+
switch (actionValidation.type) {
|
|
1751
|
+
case "group":
|
|
1752
|
+
return {
|
|
1753
|
+
condition: {
|
|
1754
|
+
type: "comparison",
|
|
1755
|
+
comparison: {
|
|
1756
|
+
operator: "EQUALS",
|
|
1757
|
+
left: {
|
|
1758
|
+
type: "userProperty",
|
|
1759
|
+
userProperty: {
|
|
1760
|
+
userId: {
|
|
1761
|
+
type: "currentUser",
|
|
1762
|
+
currentUser: {}
|
|
1763
|
+
},
|
|
1764
|
+
propertyValue: {
|
|
1765
|
+
type: "groupIds",
|
|
1766
|
+
groupIds: {}
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
},
|
|
1770
|
+
right: {
|
|
1771
|
+
type: "staticValue",
|
|
1772
|
+
staticValue: {
|
|
1773
|
+
type: "stringList",
|
|
1774
|
+
stringList: {
|
|
1775
|
+
strings: [actionValidation.name]
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
},
|
|
1781
|
+
displayMetadata: {
|
|
1782
|
+
failureMessage: "Insufficient permissions. Missing organization membership required to submit action",
|
|
1783
|
+
typeClasses: []
|
|
1784
|
+
}
|
|
1785
|
+
};
|
|
1786
|
+
default:
|
|
1787
|
+
throw new Error(`Unknown action validation type: ${actionValidation.type}`);
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1705
1790
|
|
|
1706
1791
|
// src/api/importOntologyEntity.ts
|
|
1707
1792
|
function importOntologyEntity(e) {
|
|
@@ -1720,7 +1805,8 @@ function importSharedPropertyType(opts) {
|
|
|
1720
1805
|
const {
|
|
1721
1806
|
apiName,
|
|
1722
1807
|
packageName,
|
|
1723
|
-
typeHint
|
|
1808
|
+
typeHint,
|
|
1809
|
+
array
|
|
1724
1810
|
} = opts;
|
|
1725
1811
|
const fullApiName = packageName === void 0 ? apiName : `${packageName}.${apiName}`;
|
|
1726
1812
|
if (packageName !== void 0) {
|
|
@@ -1731,39 +1817,28 @@ function importSharedPropertyType(opts) {
|
|
|
1731
1817
|
apiName: fullApiName,
|
|
1732
1818
|
type: typeHint,
|
|
1733
1819
|
nonNameSpacedApiName: apiName,
|
|
1820
|
+
array: array ?? false,
|
|
1734
1821
|
__type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE
|
|
1735
1822
|
};
|
|
1736
1823
|
importOntologyEntity(spt);
|
|
1737
1824
|
return spt;
|
|
1738
1825
|
}
|
|
1739
|
-
var defaultTypeClasses = [{
|
|
1740
|
-
kind: "render_hint",
|
|
1741
|
-
name: "SELECTABLE"
|
|
1742
|
-
}, {
|
|
1743
|
-
kind: "render_hint",
|
|
1744
|
-
name: "SORTABLE"
|
|
1745
|
-
}];
|
|
1746
1826
|
function defineSharedPropertyType(sptDef) {
|
|
1747
1827
|
const apiName = namespace + sptDef.apiName;
|
|
1748
1828
|
!(ontologyDefinition[OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE][apiName] === void 0) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Shared property type ${apiName} already exists`) : invariant__default.default(false) : void 0;
|
|
1749
|
-
|
|
1750
|
-
const hasRenderHints = (sptDef.typeClasses ?? []).some((tc) => tc.kind.toLowerCase() === "render_hint");
|
|
1751
|
-
!(!shouldNotHaveRenderHints || !hasRenderHints) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Shared property type ${apiName} of type '${getPropertyTypeName(sptDef.type)}' should not have render hints`) : invariant__default.default(false) : void 0;
|
|
1829
|
+
!(!shouldNotHaveRenderHints(sptDef.type) || !hasRenderHints(sptDef.typeClasses)) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Shared property type ${apiName} of type '${getPropertyTypeName(sptDef.type)}' should not have render hints`) : invariant__default.default(false) : void 0;
|
|
1752
1830
|
const fullSpt = {
|
|
1753
1831
|
...sptDef,
|
|
1754
1832
|
apiName,
|
|
1755
1833
|
nonNameSpacedApiName: sptDef.apiName,
|
|
1756
1834
|
displayName: sptDef.displayName ?? sptDef.apiName,
|
|
1757
1835
|
// This way the non-namespaced api name is the display name (maybe not ideal)
|
|
1758
|
-
typeClasses: sptDef.typeClasses ?? (shouldNotHaveRenderHints ? [] : defaultTypeClasses),
|
|
1836
|
+
typeClasses: sptDef.typeClasses ?? (shouldNotHaveRenderHints(sptDef.type) ? [] : defaultTypeClasses),
|
|
1759
1837
|
__type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE
|
|
1760
1838
|
};
|
|
1761
1839
|
updateOntology(fullSpt);
|
|
1762
1840
|
return fullSpt;
|
|
1763
1841
|
}
|
|
1764
|
-
function getPropertyTypeName(type) {
|
|
1765
|
-
return typeof type === "object" ? type.type : type;
|
|
1766
|
-
}
|
|
1767
1842
|
|
|
1768
1843
|
// src/api/defineInterface.ts
|
|
1769
1844
|
function defineInterface(interfaceDef) {
|