@osdk/maker 0.12.0-beta.8 → 0.12.0-beta.9

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +88 -62
  3. package/build/browser/api/defineAction.js +91 -78
  4. package/build/browser/api/defineAction.js.map +1 -1
  5. package/build/browser/api/defineLink.js +2 -2
  6. package/build/browser/api/defineLink.js.map +1 -1
  7. package/build/browser/api/defineObject.js +6 -2
  8. package/build/browser/api/defineObject.js.map +1 -1
  9. package/build/browser/api/defineOntology.js +2 -2
  10. package/build/browser/api/defineOntology.js.map +1 -1
  11. package/build/browser/api/overall.test.js +1123 -452
  12. package/build/browser/api/overall.test.js.map +1 -1
  13. package/build/browser/api/types.js.map +1 -1
  14. package/build/browser/cli/main.js +1 -1
  15. package/build/browser/index.js.map +1 -1
  16. package/build/cjs/index.cjs +100 -84
  17. package/build/cjs/index.cjs.map +1 -1
  18. package/build/cjs/index.d.cts +23 -14
  19. package/build/esm/api/defineAction.js +91 -78
  20. package/build/esm/api/defineAction.js.map +1 -1
  21. package/build/esm/api/defineLink.js +2 -2
  22. package/build/esm/api/defineLink.js.map +1 -1
  23. package/build/esm/api/defineObject.js +6 -2
  24. package/build/esm/api/defineObject.js.map +1 -1
  25. package/build/esm/api/defineOntology.js +2 -2
  26. package/build/esm/api/defineOntology.js.map +1 -1
  27. package/build/esm/api/overall.test.js +1123 -452
  28. package/build/esm/api/overall.test.js.map +1 -1
  29. package/build/esm/api/types.js.map +1 -1
  30. package/build/esm/cli/main.js +1 -1
  31. package/build/esm/index.js.map +1 -1
  32. package/build/types/api/defineAction.d.ts +6 -6
  33. package/build/types/api/defineAction.d.ts.map +1 -1
  34. package/build/types/api/defineObject.d.ts +2 -2
  35. package/build/types/api/defineObject.d.ts.map +1 -1
  36. package/build/types/api/types.d.ts +15 -6
  37. package/build/types/api/types.d.ts.map +1 -1
  38. package/build/types/index.d.ts +1 -1
  39. package/build/types/index.d.ts.map +1 -1
  40. 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 OntologyIrActionTypeEntities,\n OntologyIrBaseParameterType_decimal,\n OntologyIrBaseParameterType_decimalList,\n OntologyIrBaseParameterType_interfaceReference,\n OntologyIrBaseParameterType_interfaceReferenceList,\n OntologyIrBaseParameterType_objectReference,\n OntologyIrBaseParameterType_objectReferenceList,\n OntologyIrBaseParameterType_objectSetRid,\n OntologyIrBaseParameterType_objectTypeReference,\n OntologyIrBaseParameterType_struct,\n OntologyIrBaseParameterType_structList,\n OntologyIrBaseParameterType_timestamp,\n OntologyIrBaseParameterType_timestampList,\n OntologyIrCondition,\n OntologyIrConditionValue,\n OntologyIrFormContent,\n OntologyIrLabelledValue,\n OntologyIrLinkTypeStatus,\n OntologyIrLogicRule,\n OntologyIrMarketplaceInterfaceType,\n OntologyIrObjectType,\n OntologyIrParameterDateRangeValue,\n OntologyIrPropertyType,\n OntologyIrValidationRule,\n ParameterId,\n SectionId,\n SharedPropertyTypeGothamMapping,\n StructFieldType,\n ValidationRuleDisplayMetadata,\n ValueTypeApiName,\n ValueTypeDataConstraint,\n ValueTypeDisplayMetadata,\n ValueTypeStatus,\n ValueTypeVersion,\n Visibility,\n} from \"@osdk/client.unstable\";\n\nimport type { 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 defaultVisibility?: \"editable\" | \"disabled\" | \"hidden\";\n conditionalOverrides?: Array<ActionParameterConditionalOverride>;\n}\n\n// TODO(ethana): add more commonly used conditions - parameter matching, organizations, etc.\nexport type ConditionDefinition =\n | UnionCondition\n | OntologyIrCondition\n | GroupValidationRule\n | ParameterValidationRule;\n\nexport type UnionCondition = {\n type: \"and\" | \"or\";\n conditions: Array<ConditionDefinition>;\n};\n\nexport type ActionParameterConditionalOverride =\n | VisibilityOverride\n | DisabledOverride\n | RequiredOverride;\n\nexport type VisibilityOverride = {\n type: \"visibility\";\n condition: ConditionDefinition;\n};\n\nexport type DisabledOverride = {\n type: \"disabled\";\n condition: ConditionDefinition;\n};\n\nexport type RequiredOverride = {\n type: \"required\";\n condition: ConditionDefinition;\n};\n\nexport type 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 entities: OntologyIrActionTypeEntities;\n formContentOrdering: Array<OntologyIrFormContent>;\n validation: Array<OntologyIrValidationRule>;\n typeClasses: Array<TypeClass>;\n}\n\nexport type ActionValidationRule = OntologyIrValidationRule;\n\nexport type ActionLevelValidationDefinition = {\n condition: ConditionDefinition;\n displayMetadata?: ValidationRuleDisplayMetadata;\n};\n\nexport type GroupValidationRule = {\n type: \"group\";\n name: string;\n};\n\nexport type ParameterValidationRule = {\n type: \"parameter\";\n parameterId: string;\n matches: OntologyIrConditionValue;\n};\n\nexport type ActionStatus =\n | \"active\"\n | \"experimental\"\n | \"example\"\n | ActionTypeStatus_deprecated;\n\nexport type { InterfaceTypeStatus };\n\nexport type ObjectTypeStatus =\n | \"active\"\n | \"experimental\"\n | {\n type: \"deprecated\";\n message: string;\n deadline: string;\n };\n\nexport type RequiredFields<T, K extends keyof T> = T & Required<Pick<T, K>>;\nexport type OptionalFields<T, K extends keyof T> =\n & Pick<Partial<T>, K>\n & Omit<T, K>;\n\nexport interface ObjectTypeInner extends\n Omit<\n OntologyIrObjectType,\n | \"titlePropertyTypeRid\"\n | \"propertyTypes\"\n | \"allImplementsInterfaces\"\n | \"implementsInterfaces2\"\n | \"displayMetadata\"\n | \"primaryKeys\"\n | \"status\"\n >\n{\n primaryKeyPropertyApiName: string;\n properties: Array<ObjectPropertyType>;\n titlePropertyApiName: string;\n implementsInterfaces: Array<InterfaceImplementation>;\n description: string | undefined;\n icon: { locator: BlueprintIcon; color: string } | undefined;\n displayName: string;\n pluralDisplayName: string;\n visibility: Visibility;\n editsEnabled: boolean;\n status?: ObjectTypeStatus;\n}\n\nexport type InterfaceImplementation = {\n implements: InterfaceType;\n propertyMapping: { interfaceProperty: string; mapsTo: string }[];\n};\n\nexport type ObjectType =\n & OntologyEntityBase\n & RequiredFields<\n Partial<ObjectTypeInner>,\n | \"apiName\"\n | \"primaryKeyPropertyApiName\"\n | \"displayName\"\n | \"pluralDisplayName\"\n | \"titlePropertyApiName\"\n >\n & {\n datasource?: ObjectTypeDatasourceDefinition;\n __type: OntologyEntityTypeEnum.OBJECT_TYPE;\n };\n\nexport type ObjectTypeDefinition = {\n apiName: string;\n primaryKeyPropertyApiName: string;\n displayName: string;\n pluralDisplayName: string;\n titlePropertyApiName: string;\n properties?: { [key: string]: ObjectPropertyTypeUserDefinition };\n implementsInterfaces?: Array<InterfaceImplementation>;\n description?: string;\n icon?: { locator: BlueprintIcon; color: string };\n visibility?: Visibility;\n editsEnabled?: boolean;\n status?: ObjectTypeStatus;\n datasource?: ObjectTypeDatasourceDefinition;\n};\n\nexport interface ObjectPropertyTypeInner extends\n Omit<\n OntologyIrPropertyType,\n | \"sharedPropertyTypeApiName\"\n | \"type\"\n | \"inlineAction\"\n | \"sharedPropertyTypeRid\"\n | \"valueType\"\n | \"ruleSetBinding\"\n | \"displayMetadata\"\n | \"dataConstraints\"\n | \"status\"\n >\n{\n type: PropertyTypeType;\n array?: boolean;\n valueType: ValueTypeDefinitionVersion;\n sharedPropertyType: SharedPropertyType;\n description: string | undefined;\n displayName: string;\n visibility: Visibility;\n nullability?: Nullability;\n status?: ObjectTypeStatus;\n editOnly?: boolean;\n}\n\nexport type ObjectPropertyType = RequiredFields<\n Partial<ObjectPropertyTypeInner>,\n \"apiName\" | \"type\" | \"displayName\"\n>;\n\nexport type ObjectPropertyTypeUserDefinition = RequiredFields<\n Partial<ObjectPropertyTypeInner>,\n \"type\"\n>;\n\nexport interface InterfacePropertyType {\n sharedPropertyType: SharedPropertyType;\n required: boolean;\n}\nexport interface InterfaceType extends\n OntologyEntityBase,\n Omit<\n OntologyIrMarketplaceInterfaceType,\n // we want our simplified representation\n | \"properties\"\n // these things don't need to exist as the system works fine without them (I'm told)\n | \"allProperties\"\n | \"allLinks\"\n | \"extendsInterfaces\"\n | \"allExtendsInterfaces\"\n | \"propertiesV2\"\n | \"allPropertiesV2\"\n | \"propertiesV3\"\n | \"allPropertiesV3\"\n >\n{\n propertiesV2: Record<string, InterfacePropertyType>;\n extendsInterfaces: Array<InterfaceType>;\n status: InterfaceTypeStatus;\n __type: OntologyEntityTypeEnum.INTERFACE_TYPE;\n}\n\nexport interface PropertyType {\n type: PropertyTypeType;\n array?: boolean;\n description?: string;\n displayName?: string;\n valueType?: 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 markingInputGroupName: string;\n};\n\nexport type PropertyTypeTypeStruct = {\n type: \"struct\";\n structDefinition: {\n [api_name: string]:\n | StructPropertyType\n | Exclude<PropertyTypeTypesWithoutStruct, PropertyTypeTypeMarking>;\n };\n};\n\ntype PropertyTypeTypeString = {\n type: \"string\";\n isLongText: boolean;\n supportsEfficientLeadingWildcard: boolean;\n supportsExactMatching: boolean;\n};\n\nexport type PropertyTypeTypesWithoutStruct = Exclude<\n PropertyTypeType,\n PropertyTypeTypeStruct\n>;\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport interface StructPropertyType extends\n Optional<\n Omit<\n StructFieldType,\n \"fieldType\" | \"structFieldRid\" | \"apiName\"\n >,\n \"typeClasses\" | \"aliases\"\n >\n{\n fieldType: PropertyTypeTypesWithoutStruct;\n}\n\nexport type ObjectTypePropertyApiName = string;\nexport type LinkTypeId = string;\n\nexport type LinkType =\n | (OntologyEntityBase & OneToManyLinkTypeDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n })\n | (OntologyEntityBase & ManyToManyLinkTypeDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n });\n\nexport type LinkTypeDefinition =\n | Omit<\n OntologyEntityBase & OneToManyLinkTypeUserDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n },\n \"__type\"\n >\n | Omit<\n OntologyEntityBase & ManyToManyLinkTypeUserDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n },\n \"__type\"\n >;\n\nexport interface OneToManyLinkTypeDefinition {\n apiName: LinkTypeId;\n one: OneToManyObjectLinkReference;\n toMany: OneToManyObjectLinkReference;\n manyForeignKeyProperty: ObjectTypePropertyApiName;\n cardinality: \"OneToMany\" | \"OneToOne\" | undefined;\n editsEnabled?: boolean;\n status?: OntologyIrLinkTypeStatus;\n redacted?: boolean;\n}\n\nexport interface OneToManyObjectLinkReference {\n object: ObjectType;\n metadata: LinkTypeMetadata;\n}\n\nexport interface OneToManyLinkTypeUserDefinition {\n apiName: LinkTypeId;\n one: OneToManyObjectLinkReferenceUserDefinition;\n toMany: OneToManyObjectLinkReferenceUserDefinition;\n manyForeignKeyProperty: ObjectTypePropertyApiName;\n cardinality?: \"OneToMany\" | \"OneToOne\" | undefined;\n}\n\nexport interface OneToManyObjectLinkReferenceUserDefinition {\n object: 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: ObjectType;\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;;AA+EA,WAAYA,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;;AA2DlC;;AAoCA","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 OntologyIrActionTypeEntities,\n OntologyIrBaseParameterType_decimal,\n OntologyIrBaseParameterType_decimalList,\n OntologyIrBaseParameterType_interfaceReference,\n OntologyIrBaseParameterType_interfaceReferenceList,\n OntologyIrBaseParameterType_objectReference,\n OntologyIrBaseParameterType_objectReferenceList,\n OntologyIrBaseParameterType_objectSetRid,\n OntologyIrBaseParameterType_objectTypeReference,\n OntologyIrBaseParameterType_struct,\n OntologyIrBaseParameterType_structList,\n OntologyIrBaseParameterType_timestamp,\n OntologyIrBaseParameterType_timestampList,\n OntologyIrCondition,\n OntologyIrConditionValue,\n OntologyIrFormContent,\n OntologyIrLabelledValue,\n OntologyIrLinkTypeStatus,\n OntologyIrLogicRule,\n OntologyIrMarketplaceInterfaceType,\n OntologyIrObjectType,\n OntologyIrParameterDateRangeValue,\n OntologyIrPropertyType,\n OntologyIrValidationRule,\n ParameterId,\n SectionId,\n SharedPropertyTypeGothamMapping,\n StructFieldType,\n ValidationRuleDisplayMetadata,\n ValueTypeApiName,\n ValueTypeDataConstraint,\n ValueTypeDisplayMetadata,\n ValueTypeStatus,\n ValueTypeVersion,\n Visibility,\n} from \"@osdk/client.unstable\";\n\nimport type { 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 type ActionTypeUserDefinition = {\n objectType: ObjectTypeDefinition;\n apiName?: string;\n displayName?: string;\n status?: ActionStatus;\n parameterLevelValidations?: Record<string, ActionParameterValidation>;\n actionLevelValidation?: ActionLevelValidationDefinition;\n excludedProperties?: Array<ParameterId>;\n};\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 defaultVisibility?: \"editable\" | \"disabled\" | \"hidden\";\n conditionalOverrides?: Array<ActionParameterConditionalOverride>;\n}\n\n// TODO(ethana): add more commonly used conditions - parameter matching, organizations, etc.\nexport type ConditionDefinition =\n | UnionCondition\n | OntologyIrCondition\n | GroupValidationRule\n | ParameterValidationRule;\n\nexport type UnionCondition = {\n type: \"and\" | \"or\";\n conditions: Array<ConditionDefinition>;\n};\n\nexport type ActionParameterConditionalOverride =\n | VisibilityOverride\n | DisabledOverride\n | RequiredOverride;\n\nexport type VisibilityOverride = {\n type: \"visibility\";\n condition: ConditionDefinition;\n};\n\nexport type DisabledOverride = {\n type: \"disabled\";\n condition: ConditionDefinition;\n};\n\nexport type RequiredOverride = {\n type: \"required\";\n condition: ConditionDefinition;\n};\n\nexport type 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 entities: OntologyIrActionTypeEntities;\n formContentOrdering: Array<OntologyIrFormContent>;\n validation: Array<OntologyIrValidationRule>;\n typeClasses: Array<TypeClass>;\n}\n\nexport type ActionValidationRule = OntologyIrValidationRule;\n\nexport type ActionLevelValidationDefinition = {\n condition: ConditionDefinition;\n displayMetadata?: ValidationRuleDisplayMetadata;\n};\n\nexport type GroupValidationRule = {\n type: \"group\";\n name: string;\n};\n\nexport type ParameterValidationRule = {\n type: \"parameter\";\n parameterId: string;\n matches: OntologyIrConditionValue;\n};\n\nexport type ActionStatus =\n | \"active\"\n | \"experimental\"\n | \"example\"\n | ActionTypeStatus_deprecated;\n\nexport type { InterfaceTypeStatus };\n\nexport type ObjectTypeStatus =\n | \"active\"\n | \"experimental\"\n | {\n type: \"deprecated\";\n message: string;\n deadline: string;\n };\n\nexport type RequiredFields<T, K extends keyof T> = T & Required<Pick<T, K>>;\nexport type OptionalFields<T, K extends keyof T> =\n & Pick<Partial<T>, K>\n & Omit<T, K>;\n\nexport interface ObjectTypeInner extends\n Omit<\n OntologyIrObjectType,\n | \"titlePropertyTypeRid\"\n | \"propertyTypes\"\n | \"allImplementsInterfaces\"\n | \"implementsInterfaces2\"\n | \"displayMetadata\"\n | \"primaryKeys\"\n | \"status\"\n >\n{\n primaryKeyPropertyApiName: string;\n properties: Array<ObjectPropertyType>;\n titlePropertyApiName: string;\n implementsInterfaces: Array<InterfaceImplementation>;\n description: string | undefined;\n icon: { locator: BlueprintIcon; color: string } | undefined;\n displayName: string;\n pluralDisplayName: string;\n visibility: Visibility;\n editsEnabled: boolean;\n status?: ObjectTypeStatus;\n}\n\nexport type InterfaceImplementation = {\n implements: InterfaceType;\n propertyMapping: { interfaceProperty: string; mapsTo: string }[];\n};\n\nexport type ObjectType =\n & OntologyEntityBase\n & RequiredFields<\n Partial<ObjectTypeInner>,\n | \"apiName\"\n | \"primaryKeyPropertyApiName\"\n | \"displayName\"\n | \"pluralDisplayName\"\n | \"titlePropertyApiName\"\n >\n & {\n datasource?: ObjectTypeDatasourceDefinition;\n __type: OntologyEntityTypeEnum.OBJECT_TYPE;\n };\n\nexport type ObjectTypeDefinition = {\n apiName: string;\n primaryKeyPropertyApiName: string;\n displayName: string;\n pluralDisplayName: string;\n titlePropertyApiName: string;\n properties?: { [key: string]: ObjectPropertyTypeUserDefinition };\n implementsInterfaces?: Array<InterfaceImplementation>;\n description?: string;\n icon?: { locator: BlueprintIcon; color: string };\n visibility?: Visibility;\n editsEnabled?: boolean;\n status?: ObjectTypeStatus;\n datasource?: ObjectTypeDatasourceDefinition;\n};\n\nexport interface ObjectPropertyTypeInner extends\n Omit<\n OntologyIrPropertyType,\n | \"sharedPropertyTypeApiName\"\n | \"type\"\n | \"inlineAction\"\n | \"sharedPropertyTypeRid\"\n | \"valueType\"\n | \"ruleSetBinding\"\n | \"displayMetadata\"\n | \"dataConstraints\"\n | \"status\"\n >\n{\n type: PropertyTypeType;\n array?: boolean;\n valueType: ValueTypeDefinitionVersion;\n sharedPropertyType: SharedPropertyType;\n description: string | undefined;\n displayName: string;\n visibility: Visibility;\n nullability?: Nullability;\n status?: ObjectTypeStatus;\n editOnly?: boolean;\n}\n\nexport type ObjectPropertyType = RequiredFields<\n Partial<ObjectPropertyTypeInner>,\n \"apiName\" | \"type\" | \"displayName\"\n>;\n\nexport type ObjectPropertyTypeUserDefinition = RequiredFields<\n Partial<ObjectPropertyTypeInner>,\n \"type\"\n>;\n\nexport interface InterfacePropertyType {\n sharedPropertyType: SharedPropertyType;\n required: boolean;\n}\nexport interface InterfaceType extends\n OntologyEntityBase,\n Omit<\n OntologyIrMarketplaceInterfaceType,\n // we want our simplified representation\n | \"properties\"\n // these things don't need to exist as the system works fine without them (I'm told)\n | \"allProperties\"\n | \"allLinks\"\n | \"extendsInterfaces\"\n | \"allExtendsInterfaces\"\n | \"propertiesV2\"\n | \"allPropertiesV2\"\n | \"propertiesV3\"\n | \"allPropertiesV3\"\n >\n{\n propertiesV2: Record<string, InterfacePropertyType>;\n extendsInterfaces: Array<InterfaceType>;\n status: InterfaceTypeStatus;\n __type: OntologyEntityTypeEnum.INTERFACE_TYPE;\n}\n\nexport interface PropertyType {\n type: PropertyTypeType;\n array?: boolean;\n description?: string;\n displayName?: string;\n valueType?: 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 markingInputGroupName: string;\n};\n\nexport type PropertyTypeTypeStruct = {\n type: \"struct\";\n structDefinition: {\n [api_name: string]:\n | StructPropertyType\n | Exclude<PropertyTypeTypesWithoutStruct, PropertyTypeTypeMarking>;\n };\n};\n\ntype PropertyTypeTypeString = {\n type: \"string\";\n isLongText: boolean;\n supportsEfficientLeadingWildcard: boolean;\n supportsExactMatching: boolean;\n};\n\nexport type PropertyTypeTypesWithoutStruct = Exclude<\n PropertyTypeType,\n PropertyTypeTypeStruct\n>;\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport interface StructPropertyType extends\n Optional<\n Omit<\n StructFieldType,\n \"fieldType\" | \"structFieldRid\" | \"apiName\"\n >,\n \"typeClasses\" | \"aliases\"\n >\n{\n fieldType: PropertyTypeTypesWithoutStruct;\n}\n\nexport type ObjectTypePropertyApiName = string;\nexport type LinkTypeId = string;\n\nexport type LinkType =\n | (OntologyEntityBase & OneToManyLinkTypeDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n })\n | (OntologyEntityBase & ManyToManyLinkTypeDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n });\n\nexport type LinkTypeDefinition =\n | Omit<\n OntologyEntityBase & OneToManyLinkTypeUserDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n },\n \"__type\"\n >\n | Omit<\n OntologyEntityBase & ManyToManyLinkTypeUserDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n },\n \"__type\"\n >;\n\nexport interface OneToManyLinkTypeDefinition {\n apiName: LinkTypeId;\n one: OneToManyObjectLinkReference;\n toMany: OneToManyObjectLinkReference;\n manyForeignKeyProperty: ObjectTypePropertyApiName;\n cardinality: \"OneToMany\" | \"OneToOne\" | undefined;\n editsEnabled?: boolean;\n status?: OntologyIrLinkTypeStatus;\n redacted?: boolean;\n}\n\nexport interface OneToManyObjectLinkReference {\n object: ObjectTypeDefinition;\n metadata: LinkTypeMetadata;\n}\n\nexport interface OneToManyLinkTypeUserDefinition {\n apiName: LinkTypeId;\n one: OneToManyObjectLinkReferenceUserDefinition;\n toMany: OneToManyObjectLinkReferenceUserDefinition;\n manyForeignKeyProperty: ObjectTypePropertyApiName;\n cardinality?: \"OneToMany\" | \"OneToOne\" | undefined;\n}\n\nexport interface OneToManyObjectLinkReferenceUserDefinition {\n object: ObjectTypeDefinition;\n metadata: LinkTypeMetadataUserDefinition;\n}\n\nexport interface ManyToManyLinkTypeDefinition {\n apiName: LinkTypeId;\n many: ManyToManyObjectLinkReference;\n toMany: ManyToManyObjectLinkReference;\n editsEnabled?: boolean;\n status?: OntologyIrLinkTypeStatus;\n redacted?: boolean;\n}\n\nexport interface ManyToManyObjectLinkReference {\n object: ObjectTypeDefinition;\n metadata: LinkTypeMetadata;\n}\n\nexport interface ManyToManyLinkTypeUserDefinition {\n apiName: LinkTypeId;\n many: ManyToManyObjectLinkReferenceUserDefinition;\n toMany: ManyToManyObjectLinkReferenceUserDefinition;\n}\n\nexport interface ManyToManyObjectLinkReferenceUserDefinition {\n object: ObjectTypeDefinition;\n metadata: LinkTypeMetadataUserDefinition;\n}\n\nexport interface LinkTypeMetadataUserDefinition {\n apiName: string;\n displayName?: string;\n pluralDisplayName?: string;\n visibility?: Visibility;\n groupDisplayName?: string;\n}\n\nexport type LinkSideMetadata = OptionalFields<\n RequiredFields<\n Omit<LinkTypeMetadata, \"displayMetadata\"> & LinkTypeDisplayMetadata,\n \"apiName\"\n >,\n \"visibility\" | \"typeClasses\"\n>;\nexport interface ValueTypeType_array {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"array\" }>[\"array\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"array\";\n value: {\n type: \"array\";\n elementType: ValueTypeType[\"value\"];\n };\n}\n\nexport interface ValueTypeType_boolean {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"boolean\" }>[\"boolean\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"boolean\";\n value: \"boolean\";\n}\n\nexport interface ValueTypeType_binary {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"binary\" }>[\"binary\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"binary\";\n value: \"binary\";\n}\n\nexport interface ValueTypeType_byte {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"byte\" }>[\"byte\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"byte\";\n value: \"byte\";\n}\n\nexport interface ValueTypeType_date {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"date\" }>[\"date\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"date\";\n value: \"date\";\n}\n\nexport interface ValueTypeType_decimal {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"decimal\" }>[\"decimal\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"decimal\";\n value: \"decimal\";\n}\n\nexport interface ValueTypeType_double {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"double\" }>[\"double\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"double\";\n value: \"double\";\n}\n\nexport interface ValueTypeType_float {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"float\" }>[\"float\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"float\";\n value: \"float\";\n}\n\nexport interface ValueTypeType_integer {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"integer\" }>[\"integer\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"integer\";\n value: \"integer\";\n}\n\nexport interface ValueTypeType_long {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"long\" }>[\"long\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"long\";\n value: \"long\";\n}\n\nexport interface ValueTypeType_map {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"map\" }>[\"map\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"map\";\n value: {\n type: \"map\";\n keyType: ValueTypeType[\"value\"];\n valueType: ValueTypeType[\"value\"];\n };\n}\n\nexport interface ValueTypeType_optional {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"optional\" }>[\"optional\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"optional\";\n value: {\n type: \"optional\";\n wrappedType: ValueTypeType[\"value\"];\n };\n}\n\nexport interface ValueTypeType_short {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"short\" }>[\"short\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"short\";\n value: \"short\";\n}\n\nexport interface ValueTypeType_string {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"string\" }>[\"string\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"string\";\n value: \"string\";\n}\n\nexport interface ValueTypeType_structV2 {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"structV2\" }>[\"structV2\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"structV2\";\n value: {\n type: \"struct\";\n fields: Array<{\n identifier: string;\n baseType: ValueTypeType[\"value\"];\n }>;\n };\n}\nexport interface ValueTypeType_timestamp {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"timestamp\" }>[\"timestamp\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"timestamp\";\n value: \"timestamp\";\n}\n\nexport type ValueTypeType =\n | ValueTypeType_array\n | ValueTypeType_boolean\n | ValueTypeType_binary\n | ValueTypeType_byte\n | ValueTypeType_date\n | ValueTypeType_decimal\n | ValueTypeType_double\n | ValueTypeType_float\n | ValueTypeType_integer\n | ValueTypeType_long\n | ValueTypeType_map\n | ValueTypeType_optional\n | ValueTypeType_short\n | ValueTypeType_string\n | ValueTypeType_structV2\n | ValueTypeType_timestamp;\n\nexport type ValueTypeDefinitionVersion = OntologyEntityBase & {\n apiName: ValueTypeApiName;\n displayMetadata: ValueTypeDisplayMetadata;\n status: ValueTypeStatus;\n version: ValueTypeVersion;\n baseType: BaseType;\n constraints: ValueTypeDataConstraint[];\n exampleValues: ExampleValue[];\n __type: OntologyEntityTypeEnum.VALUE_TYPE;\n};\n\nexport interface ObjectTypeDatasourceDefinition_dataset {\n type: \"dataset\";\n}\n\nexport interface ObjectTypeDatasourceDefinition_stream {\n type: \"stream\";\n // Retention period must be in ISO 8601 duration format\n retentionPeriod?: string;\n}\n\nexport interface ObjectTypeDatasourceDefinition_restrictedView {\n type: \"restrictedView\";\n}\n\nexport type ObjectTypeDatasourceDefinition =\n | ObjectTypeDatasourceDefinition_stream\n | ObjectTypeDatasourceDefinition_dataset\n | ObjectTypeDatasourceDefinition_restrictedView;\n\nexport type ActionParameterTypePrimitive =\n | \"boolean\"\n | \"booleanList\"\n | \"integer\"\n | \"integerList\"\n | \"long\"\n | \"longList\"\n | \"double\"\n | \"doubleList\"\n | \"string\"\n | \"stringList\"\n | \"decimal\"\n | \"decimalList\"\n | \"timestamp\"\n | \"timestampList\"\n | \"geohash\"\n | \"geohashList\"\n | \"geoshape\"\n | \"geoshapeList\"\n | \"timeSeriesReference\"\n | \"date\"\n | \"dateList\"\n | \"objectTypeReference\"\n | \"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;;AA+EA,WAAYA,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;;AAqElC;;AAoCA","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.12.0-beta.8" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
27
+ const commandLineOpts = await yargs(hideBin(args)).version("0.12.0-beta.9" ?? "").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":"index.js","names":["default","addDependency","defineAction","defineCreateInterfaceObjectAction","defineCreateObjectAction","defineDeleteObjectAction","defineModifyInterfaceObjectAction","defineModifyObjectAction","importSharedPropertyType","defineInterface","defineInterfaceLinkConstraint","defineLink","defineObject","defineOntology","defineSharedPropertyType","defineValueType","importOntologyEntity","OntologyEntityTypeEnum","wrapWithProxy"],"sources":["index.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\nexport { default as default } from \"./cli/main.js\";\n\nexport { addDependency } from \"./api/addDependency.js\";\nexport {\n defineAction,\n defineCreateInterfaceObjectAction,\n defineCreateObjectAction,\n defineDeleteObjectAction,\n defineModifyInterfaceObjectAction,\n defineModifyObjectAction,\n} from \"./api/defineAction.js\";\nexport { importSharedPropertyType } from \"./api/defineImportSpt.js\";\nexport { defineInterface } from \"./api/defineInterface.js\";\nexport { defineInterfaceLinkConstraint } from \"./api/defineInterfaceLinkConstraint.js\";\nexport { defineLink } from \"./api/defineLink.js\";\nexport { defineObject } from \"./api/defineObject.js\";\nexport { defineOntology } from \"./api/defineOntology.js\";\nexport { defineSharedPropertyType } from \"./api/defineSpt.js\";\nexport { defineValueType } from \"./api/defineValueType.js\";\nexport { importOntologyEntity } from \"./api/importOntologyEntity.js\";\nexport type {\n ActionType,\n ConditionDefinition,\n InterfaceType,\n LinkType,\n ObjectType,\n SharedPropertyType,\n ValueTypeDefinitionVersion,\n} from \"./api/types.js\";\nexport { OntologyEntityTypeEnum } from \"./api/types.js\";\nexport { wrapWithProxy } from \"./api/wrapWithProxy.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAkB,QAAQ,eAAe;AAElD,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SACEC,YAAY,EACZC,iCAAiC,EACjCC,wBAAwB,EACxBC,wBAAwB,EACxBC,iCAAiC,EACjCC,wBAAwB,QACnB,uBAAuB;AAC9B,SAASC,wBAAwB,QAAQ,0BAA0B;AACnE,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,6BAA6B,QAAQ,wCAAwC;AACtF,SAASC,UAAU,QAAQ,qBAAqB;AAChD,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,oBAAoB,QAAQ,+BAA+B;AAUpE,SAASC,sBAAsB,QAAQ,gBAAgB;AACvD,SAASC,aAAa,QAAQ,wBAAwB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["default","addDependency","defineAction","defineCreateInterfaceObjectAction","defineCreateObjectAction","defineDeleteObjectAction","defineModifyInterfaceObjectAction","defineModifyObjectAction","importSharedPropertyType","defineInterface","defineInterfaceLinkConstraint","defineLink","defineObject","defineOntology","defineSharedPropertyType","defineValueType","importOntologyEntity","OntologyEntityTypeEnum","wrapWithProxy"],"sources":["index.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\nexport { default as default } from \"./cli/main.js\";\n\nexport { addDependency } from \"./api/addDependency.js\";\nexport {\n defineAction,\n defineCreateInterfaceObjectAction,\n defineCreateObjectAction,\n defineDeleteObjectAction,\n defineModifyInterfaceObjectAction,\n defineModifyObjectAction,\n} from \"./api/defineAction.js\";\nexport { importSharedPropertyType } from \"./api/defineImportSpt.js\";\nexport { defineInterface } from \"./api/defineInterface.js\";\nexport { defineInterfaceLinkConstraint } from \"./api/defineInterfaceLinkConstraint.js\";\nexport { defineLink } from \"./api/defineLink.js\";\nexport { defineObject } from \"./api/defineObject.js\";\nexport { defineOntology } from \"./api/defineOntology.js\";\nexport { defineSharedPropertyType } from \"./api/defineSpt.js\";\nexport { defineValueType } from \"./api/defineValueType.js\";\nexport { importOntologyEntity } from \"./api/importOntologyEntity.js\";\nexport type {\n ActionParameterConditionalOverride,\n ActionParameterValidation,\n ActionType,\n ConditionDefinition,\n InterfaceType,\n LinkType,\n ObjectType,\n SharedPropertyType,\n ValueTypeDefinitionVersion,\n} from \"./api/types.js\";\nexport { OntologyEntityTypeEnum } from \"./api/types.js\";\nexport { wrapWithProxy } from \"./api/wrapWithProxy.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAkB,QAAQ,eAAe;AAElD,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SACEC,YAAY,EACZC,iCAAiC,EACjCC,wBAAwB,EACxBC,wBAAwB,EACxBC,iCAAiC,EACjCC,wBAAwB,QACnB,uBAAuB;AAC9B,SAASC,wBAAwB,QAAQ,0BAA0B;AACnE,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,6BAA6B,QAAQ,wCAAwC;AACtF,SAASC,UAAU,QAAQ,qBAAqB;AAChD,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,oBAAoB,QAAQ,+BAA+B;AAYpE,SAASC,sBAAsB,QAAQ,gBAAgB;AACvD,SAASC,aAAa,QAAQ,wBAAwB","ignoreList":[]}
@@ -100,7 +100,7 @@ function defineObject(objectDef) {
100
100
  const allFailedValidations = validations.concat(nonExistentInterfaceProperties).filter((val) => val.type === "invalid");
101
101
  !(allFailedValidations.length === 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "\n" + allFailedValidations.map(formatValidationErrors).join("\n")) : invariant5__default.default(false) : void 0;
102
102
  });
103
- const flattenedProperties = Object.entries(objectDef.properties ?? {}).map(([apiName2, property]) => convertUserObjectPropertyType(apiName2, property));
103
+ const flattenedProperties = Object.entries(objectDef.properties ?? {}).map(([apiName2, property]) => convertUserObjectPropertyType(property.apiName ?? apiName2, property));
104
104
  const finalObject = {
105
105
  ...objectDef,
106
106
  apiName,
@@ -108,7 +108,8 @@ function defineObject(objectDef) {
108
108
  properties: flattenedProperties
109
109
  };
110
110
  updateOntology(finalObject);
111
- return finalObject;
111
+ objectDef.apiName = apiName;
112
+ return objectDef;
112
113
  }
113
114
  function isExotic(type) {
114
115
  if (type === void 0) {
@@ -160,6 +161,8 @@ function getAllInterfaceProperties(interfaceType) {
160
161
  return properties;
161
162
  }
162
163
  function convertUserObjectPropertyType(apiName, property) {
164
+ property.apiName = apiName;
165
+ property.displayName = property.displayName ?? convertToDisplayName(apiName);
163
166
  return {
164
167
  ...property,
165
168
  apiName,
@@ -1486,12 +1489,12 @@ function renderHintFromBaseType(parameter) {
1486
1489
  };
1487
1490
  case "marking":
1488
1491
  case "markingList":
1489
- if (parameter.validation.allowedValues.type === "mandatoryMarking") {
1492
+ if (parameter.validation.allowedValues?.type === "mandatoryMarking") {
1490
1493
  return {
1491
1494
  type: "mandatoryMarkingPicker",
1492
1495
  mandatoryMarkingPicker: {}
1493
1496
  };
1494
- } else if (parameter.validation.allowedValues.type === "cbacMarking") {
1497
+ } else if (parameter.validation.allowedValues?.type === "cbacMarking") {
1495
1498
  return {
1496
1499
  type: "cbacMarkingPicker",
1497
1500
  cbacMarkingPicker: {}
@@ -1593,7 +1596,7 @@ function convertCardinality(cardinality) {
1593
1596
  // src/cli/main.ts
1594
1597
  var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
1595
1598
  async function main(args = process.argv) {
1596
- const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.12.0-beta.8").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
1599
+ const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.12.0-beta.9").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
1597
1600
  input: {
1598
1601
  alias: "i",
1599
1602
  describe: "Input file",
@@ -1753,48 +1756,55 @@ function defineCreateInterfaceObjectAction(interfaceType, objectType, validation
1753
1756
  } : {}
1754
1757
  });
1755
1758
  }
1756
- function defineCreateObjectAction(objectType, validation) {
1757
- const filteredProperties = objectType.properties?.filter((prop) => !isStruct(prop.type)) ?? [];
1758
- if (filteredProperties.length !== (objectType.properties?.length ?? 0)) {
1759
- consola.consola.info(`Some properties on ${objectType.apiName} were skipped in the create action because they are structs`);
1760
- }
1759
+ function defineCreateObjectAction(def) {
1760
+ Object.keys(def.parameterLevelValidations ?? {}).forEach((id) => {
1761
+ !(def.objectType.properties?.[id] !== void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Property ${id} does not exist on ${def.objectType.apiName}`) : invariant5__default.default(false) : void 0;
1762
+ });
1763
+ (def.excludedProperties ?? []).forEach((id) => {
1764
+ !(def.objectType.properties?.[id] !== void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Property ${id} does not exist on ${def.objectType.apiName}`) : invariant5__default.default(false) : void 0;
1765
+ });
1766
+ const parameterNames = Object.keys(def.objectType.properties ?? {}).filter((id) => !def.excludedProperties?.includes(id) && !isStruct(def.objectType.properties?.[id].type));
1767
+ const parameters = Array.from(parameterNames).map((id) => ({
1768
+ id,
1769
+ displayName: def.objectType.properties?.[id].displayName ?? convertToDisplayName(id),
1770
+ type: extractActionParameterType(def.objectType.properties?.[id]),
1771
+ validation: def.parameterLevelValidations?.[id] !== void 0 ? {
1772
+ ...def.parameterLevelValidations?.[id],
1773
+ allowedValues: def.parameterLevelValidations?.[id].allowedValues ?? extractAllowedValuesFromType(def.objectType.properties?.[id].type),
1774
+ required: def.parameterLevelValidations?.[id].required ?? true
1775
+ } : {
1776
+ required: def.objectType.properties?.[id].array ?? false ? {
1777
+ listLength: def.objectType.properties?.[id].nullability?.noEmptyCollections ? {
1778
+ min: 1
1779
+ } : {}
1780
+ } : def.objectType.properties?.[id].nullability?.noNulls ?? true,
1781
+ allowedValues: extractAllowedValuesFromType(def.objectType.properties?.[id].type)
1782
+ }
1783
+ }));
1761
1784
  return defineAction({
1762
- apiName: `create-object-${kebab(objectType.apiName.split(".").pop() ?? objectType.apiName)}`,
1763
- displayName: `Create ${objectType.displayName}`,
1764
- parameters: [...filteredProperties.map((prop) => ({
1765
- id: prop.apiName,
1766
- displayName: prop.displayName,
1767
- type: extractActionParameterType(prop),
1768
- typeClasses: prop.typeClasses ?? [],
1769
- validation: {
1770
- required: prop.array ?? false ? {
1771
- listLength: prop.nullability?.noEmptyCollections ? {
1772
- min: 1
1773
- } : {}
1774
- } : prop.nullability?.noNulls ?? true,
1775
- allowedValues: extractAllowedValuesFromType(prop.type)
1776
- }
1777
- }))],
1778
- status: "active",
1785
+ apiName: def.apiName ?? `create-object-${kebab(def.objectType.apiName.split(".").pop() ?? def.objectType.apiName)}`,
1786
+ displayName: def.displayName ?? `Create ${def.objectType.displayName}`,
1787
+ parameters,
1788
+ status: def.status ?? "active",
1779
1789
  entities: {
1780
1790
  affectedInterfaceTypes: [],
1781
- affectedObjectTypes: [objectType.apiName],
1791
+ affectedObjectTypes: [def.objectType.apiName],
1782
1792
  affectedLinkTypes: [],
1783
1793
  typeGroups: []
1784
1794
  },
1785
1795
  rules: [{
1786
1796
  type: "addObjectRule",
1787
1797
  addObjectRule: {
1788
- objectTypeId: objectType.apiName,
1789
- propertyValues: filteredProperties.length > 0 ? Object.fromEntries(filteredProperties.map((p) => [p.apiName, {
1798
+ objectTypeId: def.objectType.apiName,
1799
+ propertyValues: Object.fromEntries(parameters.map((p) => [p.id, {
1790
1800
  type: "parameterId",
1791
- parameterId: p.apiName
1792
- }])) : {},
1801
+ parameterId: p.id
1802
+ }])),
1793
1803
  structFieldValues: {}
1794
1804
  }
1795
1805
  }],
1796
- ...validation ? {
1797
- validation: [convertValidationRule(validation)]
1806
+ ...def.actionLevelValidation ? {
1807
+ validation: [convertValidationRule(def.actionLevelValidation)]
1798
1808
  } : {}
1799
1809
  });
1800
1810
  }
@@ -1866,22 +1876,41 @@ function defineModifyInterfaceObjectAction(interfaceType, objectType, validation
1866
1876
  } : {}
1867
1877
  });
1868
1878
  }
1869
- function defineModifyObjectAction(objectType, validation) {
1870
- const properties = objectType.properties ?? [];
1871
- const filteredProperties = properties.filter((prop) => !isStruct(prop.type) && prop.apiName !== objectType.primaryKeyPropertyApiName);
1872
- if (filteredProperties.length < properties.length) {
1873
- consola.consola.warn(`Some properties on ${objectType.apiName} were skipped in the modify action because they were structs, or were the object's primary key which cannot be edited.`);
1874
- }
1879
+ function defineModifyObjectAction(def) {
1880
+ Object.keys(def.parameterLevelValidations ?? {}).forEach((id) => {
1881
+ !(def.objectType.properties?.[id] !== void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Property ${id} does not exist on ${def.objectType.apiName}`) : invariant5__default.default(false) : void 0;
1882
+ });
1883
+ (def.excludedProperties ?? []).forEach((id) => {
1884
+ !(def.objectType.properties?.[id] !== void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Property ${id} does not exist on ${def.objectType.apiName}`) : invariant5__default.default(false) : void 0;
1885
+ });
1886
+ const parameterNames = Object.keys(def.objectType.properties ?? {}).filter((id) => !def.excludedProperties?.includes(id) && !isStruct(def.objectType.properties?.[id].type) && id !== def.objectType.primaryKeyPropertyApiName);
1887
+ const parameters = Array.from(parameterNames).map((id) => ({
1888
+ id,
1889
+ displayName: def.objectType.properties?.[id].displayName ?? convertToDisplayName(id),
1890
+ type: extractActionParameterType(def.objectType.properties?.[id]),
1891
+ validation: def.parameterLevelValidations?.[id] !== void 0 ? {
1892
+ ...def.parameterLevelValidations?.[id],
1893
+ allowedValues: def.parameterLevelValidations?.[id].allowedValues ?? extractAllowedValuesFromType(def.objectType.properties?.[id].type),
1894
+ required: def.parameterLevelValidations?.[id].required ?? false
1895
+ } : {
1896
+ required: def.objectType.properties?.[id].array ?? false ? {
1897
+ listLength: def.objectType.properties?.[id].nullability?.noEmptyCollections ? {
1898
+ min: 1
1899
+ } : {}
1900
+ } : def.objectType.properties?.[id].nullability?.noNulls ?? false,
1901
+ allowedValues: extractAllowedValuesFromType(def.objectType.properties?.[id].type)
1902
+ }
1903
+ }));
1875
1904
  return defineAction({
1876
- apiName: `modify-object-${kebab(objectType.apiName.split(".").pop() ?? objectType.apiName)}`,
1877
- displayName: `Modify ${objectType.displayName}`,
1905
+ apiName: def.apiName ?? `modify-object-${kebab(def.objectType.apiName.split(".").pop() ?? def.objectType.apiName)}`,
1906
+ displayName: def.displayName ?? `Modify ${def.objectType.displayName}`,
1878
1907
  parameters: [{
1879
1908
  id: "objectToModifyParameter",
1880
1909
  displayName: "Modify object",
1881
1910
  type: {
1882
1911
  type: "objectReference",
1883
1912
  objectReference: {
1884
- objectTypeId: objectType.apiName
1913
+ objectTypeId: def.objectType.apiName
1885
1914
  }
1886
1915
  },
1887
1916
  validation: {
@@ -1890,54 +1919,41 @@ function defineModifyObjectAction(objectType, validation) {
1890
1919
  },
1891
1920
  required: true
1892
1921
  }
1893
- }, ...filteredProperties.map((prop) => ({
1894
- id: prop.apiName,
1895
- displayName: prop.displayName,
1896
- type: extractActionParameterType(prop),
1897
- typeClasses: prop.typeClasses ?? [],
1898
- validation: {
1899
- required: prop.array ?? false ? {
1900
- listLength: prop.nullability?.noEmptyCollections ? {
1901
- min: 1
1902
- } : {}
1903
- } : prop.nullability?.noNulls ?? false,
1904
- allowedValues: extractAllowedValuesFromType(prop.type)
1905
- }
1906
- }))],
1907
- status: "active",
1908
- entities: {
1909
- affectedInterfaceTypes: [],
1910
- affectedObjectTypes: [objectType.apiName],
1911
- affectedLinkTypes: [],
1912
- typeGroups: []
1913
- },
1922
+ }, ...parameters],
1923
+ status: def.status ?? "active",
1914
1924
  rules: [{
1915
1925
  type: "modifyObjectRule",
1916
1926
  modifyObjectRule: {
1917
1927
  objectToModify: "objectToModifyParameter",
1918
- propertyValues: filteredProperties.length > 0 ? Object.fromEntries(filteredProperties.map((p) => [p.apiName, {
1928
+ propertyValues: Object.fromEntries(parameters.map((p) => [p.id, {
1919
1929
  type: "parameterId",
1920
- parameterId: p.apiName
1921
- }])) : {},
1930
+ parameterId: p.id
1931
+ }])),
1922
1932
  structFieldValues: {}
1923
1933
  }
1924
1934
  }],
1925
- ...validation ? {
1926
- validation: [convertValidationRule(validation)]
1935
+ entities: {
1936
+ affectedInterfaceTypes: [],
1937
+ affectedObjectTypes: [def.objectType.apiName],
1938
+ affectedLinkTypes: [],
1939
+ typeGroups: []
1940
+ },
1941
+ ...def.actionLevelValidation ? {
1942
+ validation: [convertValidationRule(def.actionLevelValidation)]
1927
1943
  } : {}
1928
1944
  });
1929
1945
  }
1930
- function defineDeleteObjectAction(objectType, validation) {
1946
+ function defineDeleteObjectAction(def) {
1931
1947
  return defineAction({
1932
- apiName: `delete-object-${kebab(objectType.apiName.split(".").pop() ?? objectType.apiName)}`,
1933
- displayName: `Delete ${objectType.displayName}`,
1948
+ apiName: def.apiName ?? `delete-object-${kebab(def.objectType.apiName.split(".").pop() ?? def.objectType.apiName)}`,
1949
+ displayName: def.displayName ?? `Delete ${def.objectType.displayName}`,
1934
1950
  parameters: [{
1935
1951
  id: "objectToDeleteParameter",
1936
1952
  displayName: "Delete object",
1937
1953
  type: {
1938
1954
  type: "objectReference",
1939
1955
  objectReference: {
1940
- objectTypeId: objectType.apiName
1956
+ objectTypeId: def.objectType.apiName
1941
1957
  }
1942
1958
  },
1943
1959
  validation: {
@@ -1947,21 +1963,21 @@ function defineDeleteObjectAction(objectType, validation) {
1947
1963
  }
1948
1964
  }
1949
1965
  }],
1950
- status: "active",
1951
- entities: {
1952
- affectedInterfaceTypes: [],
1953
- affectedObjectTypes: [objectType.apiName],
1954
- affectedLinkTypes: [],
1955
- typeGroups: []
1956
- },
1966
+ status: def.status ?? "active",
1957
1967
  rules: [{
1958
1968
  type: "deleteObjectRule",
1959
1969
  deleteObjectRule: {
1960
1970
  objectToDelete: "objectToDeleteParameter"
1961
1971
  }
1962
1972
  }],
1963
- ...validation ? {
1964
- validation: [convertValidationRule(validation)]
1973
+ entities: {
1974
+ affectedInterfaceTypes: [],
1975
+ affectedObjectTypes: [def.objectType.apiName],
1976
+ affectedLinkTypes: [],
1977
+ typeGroups: []
1978
+ },
1979
+ ...def.actionLevelValidation ? {
1980
+ validation: [convertValidationRule(def.actionLevelValidation)]
1965
1981
  } : {}
1966
1982
  });
1967
1983
  }
@@ -2418,10 +2434,10 @@ function getLinkMeta(meta) {
2418
2434
  var typeIdPattern = /([a-z][a-z0-9\\-]*)/;
2419
2435
  function defineLink(linkDefinition) {
2420
2436
  if ("one" in linkDefinition) {
2421
- const foreignKey = linkDefinition.toMany.object.properties?.find((prop) => prop.apiName === linkDefinition.manyForeignKeyProperty);
2437
+ const foreignKey = linkDefinition.toMany.object.properties?.[linkDefinition.manyForeignKeyProperty];
2422
2438
  !(foreignKey !== void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Foreign key ${linkDefinition.manyForeignKeyProperty} on link ${linkDefinition.apiName} does not exist on object ${linkDefinition.toMany.object.apiName}}`) : invariant5__default.default(false) : void 0;
2423
2439
  !typeIdPattern.test(linkDefinition.apiName) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Top level link api names are expected to match the regex pattern ([a-z][a-z0-9\\-]*) ${linkDefinition.apiName} does not match`) : invariant5__default.default(false) : void 0;
2424
- const typesMatch = foreignKey.type === linkDefinition.one.object.properties?.find((prop) => prop.apiName === linkDefinition.one.object.primaryKeyPropertyApiName)?.type;
2440
+ const typesMatch = foreignKey.type === linkDefinition.one.object.properties?.[linkDefinition.one.object.primaryKeyPropertyApiName].type;
2425
2441
  !typesMatch ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Link ${linkDefinition.apiName} has type mismatch between the one side's primary key and the foreign key on the many side`) : invariant5__default.default(false) : void 0;
2426
2442
  }
2427
2443
  const fullLinkDefinition = "one" in linkDefinition ? {