@osdk/maker 0.13.0-beta.10 → 0.13.0-beta.12
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 +24 -0
- package/build/browser/api/action/ActionLevelValidationDefinition.js +2 -0
- package/build/browser/api/action/ActionLevelValidationDefinition.js.map +1 -0
- package/build/browser/api/action/ActionParameter.js +2 -0
- package/build/browser/api/action/ActionParameter.js.map +1 -0
- package/build/browser/api/action/ActionParameterAllowedValues.js +2 -0
- package/build/browser/api/action/ActionParameterAllowedValues.js.map +1 -0
- package/build/browser/api/action/ActionParameterConditionalOverride.js +2 -0
- package/build/browser/api/action/ActionParameterConditionalOverride.js.map +1 -0
- package/build/browser/api/action/ActionParameterConfiguration.js +2 -0
- package/build/browser/api/action/ActionParameterConfiguration.js.map +1 -0
- package/build/browser/api/action/ActionParameterType.js +22 -0
- package/build/browser/api/action/ActionParameterType.js.map +1 -0
- package/build/browser/api/action/ActionSection.js +2 -0
- package/build/browser/api/action/ActionSection.js.map +1 -0
- package/build/browser/api/action/ActionStatus.js +2 -0
- package/build/browser/api/action/ActionStatus.js.map +1 -0
- package/build/browser/api/action/ActionType.js +2 -0
- package/build/browser/api/action/ActionType.js.map +1 -0
- package/build/browser/api/action/ActionValidationRule.js +2 -0
- package/build/browser/api/action/ActionValidationRule.js.map +1 -0
- package/build/browser/api/action/ConditionDefinition.js +2 -0
- package/build/browser/api/action/ConditionDefinition.js.map +1 -0
- package/build/browser/api/action/MappingValue.js +2 -0
- package/build/browser/api/action/MappingValue.js.map +1 -0
- package/build/browser/api/action/SectionConditionalOverride.js +2 -0
- package/build/browser/api/action/SectionConditionalOverride.js.map +1 -0
- package/build/browser/api/action/SubmissionMetadata.js +2 -0
- package/build/browser/api/action/SubmissionMetadata.js.map +1 -0
- package/build/browser/api/common/BlueprintIcons.js +2 -0
- package/build/browser/api/common/BlueprintIcons.js.map +1 -0
- package/build/browser/api/common/OntologyDefinition.js +2 -0
- package/build/browser/api/common/OntologyDefinition.js.map +1 -0
- package/build/browser/api/common/OntologyEntityBase.js +2 -0
- package/build/browser/api/common/OntologyEntityBase.js.map +1 -0
- package/build/browser/api/{types.js → common/OntologyEntityTypeEnum.js} +2 -8
- package/build/browser/api/common/OntologyEntityTypeEnum.js.map +1 -0
- package/build/browser/api/common/OntologyEntityTypeMapping.js +2 -0
- package/build/browser/api/common/OntologyEntityTypeMapping.js.map +1 -0
- package/build/browser/api/common/TypeClass.js +2 -0
- package/build/browser/api/common/TypeClass.js.map +1 -0
- package/build/browser/api/defineAction.js +38 -15
- package/build/browser/api/defineAction.js.map +1 -1
- package/build/browser/api/defineInterface.js +14 -34
- package/build/browser/api/defineInterface.js.map +1 -1
- package/build/browser/api/defineInterfaceLinkConstraint.js +3 -2
- package/build/browser/api/defineInterfaceLinkConstraint.js.map +1 -1
- package/build/browser/api/defineLink.js +3 -3
- package/build/browser/api/defineLink.js.map +1 -1
- package/build/browser/api/defineObject.js +9 -29
- package/build/browser/api/defineObject.js.map +1 -1
- package/build/browser/api/defineOntology.js +14 -550
- package/build/browser/api/defineOntology.js.map +1 -1
- package/build/browser/api/defineSpt.js +1 -1
- package/build/browser/api/defineSpt.js.map +1 -1
- package/build/browser/api/defineValueType.js +1 -1
- package/build/browser/api/defineValueType.js.map +1 -1
- package/build/browser/api/importOntologyEntity.js +1 -1
- package/build/browser/api/importOntologyEntity.js.map +1 -1
- package/build/browser/api/{defineImportSpt.js → importSharedPropertyType.js} +2 -3
- package/build/browser/api/importSharedPropertyType.js.map +1 -0
- package/build/browser/api/interface/InterfacePropertyType.js +2 -0
- package/build/browser/api/interface/InterfacePropertyType.js.map +1 -0
- package/build/browser/api/interface/InterfaceType.js +2 -0
- package/build/browser/api/interface/InterfaceType.js.map +1 -0
- package/build/browser/api/interface/getFlattenedInterfaceProperties.js +27 -0
- package/build/browser/api/interface/getFlattenedInterfaceProperties.js.map +1 -0
- package/build/browser/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js +42 -0
- package/build/browser/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js.map +1 -0
- package/build/browser/api/links/LinkType.js +2 -0
- package/build/browser/api/links/LinkType.js.map +1 -0
- package/build/browser/api/namespace/combineApiNamespaceIfMissing.js +20 -0
- package/build/browser/api/namespace/combineApiNamespaceIfMissing.js.map +1 -0
- package/build/browser/api/object/InterfaceImplementation.js +2 -0
- package/build/browser/api/object/InterfaceImplementation.js.map +1 -0
- package/build/browser/api/object/ObjectPropertyType.js +2 -0
- package/build/browser/api/object/ObjectPropertyType.js.map +1 -0
- package/build/browser/api/object/ObjectPropertyTypeUserDefinition.js +2 -0
- package/build/browser/api/object/ObjectPropertyTypeUserDefinition.js.map +1 -0
- package/build/browser/api/object/ObjectType.js +2 -0
- package/build/browser/api/object/ObjectType.js.map +1 -0
- package/build/browser/api/object/ObjectTypeDatasourceDefinition.js +2 -0
- package/build/browser/api/object/ObjectTypeDatasourceDefinition.js.map +1 -0
- package/build/browser/api/object/ObjectTypeDefinition.js +2 -0
- package/build/browser/api/object/ObjectTypeDefinition.js.map +1 -0
- package/build/browser/api/object/ObjectTypeStatus.js +2 -0
- package/build/browser/api/object/ObjectTypeStatus.js.map +1 -0
- package/build/browser/api/objectStatus.test.js.map +1 -1
- package/build/browser/api/overall.test.js +172 -5
- package/build/browser/api/overall.test.js.map +1 -1
- package/build/browser/api/properties/Nullability.js +2 -0
- package/build/browser/api/properties/Nullability.js.map +1 -0
- package/build/browser/api/properties/PropertyTypeType.js +34 -0
- package/build/browser/api/properties/PropertyTypeType.js.map +1 -0
- package/build/browser/api/properties/SharedPropertyType.js +2 -0
- package/build/browser/api/properties/SharedPropertyType.js.map +1 -0
- package/build/browser/api/propertyConversionUtils.js +0 -238
- package/build/browser/api/propertyConversionUtils.js.map +1 -1
- package/build/browser/api/values/ValueTypeDefinitionVersion.js +2 -0
- package/build/browser/api/values/ValueTypeDefinitionVersion.js.map +1 -0
- package/build/browser/api/values/ValueTypeType.js +2 -0
- package/build/browser/api/values/ValueTypeType.js.map +1 -0
- package/build/browser/api/wrapWithProxy.js +1 -0
- package/build/browser/api/wrapWithProxy.js.map +1 -1
- package/build/browser/cli/main.js +1 -1
- package/build/browser/conversion/toConjure/distributeTypeHelper.js +23 -0
- package/build/browser/conversion/toConjure/distributeTypeHelper.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertActionParameterConditionalOverride.js +88 -0
- package/build/browser/conversion/toMarketplace/convertActionParameterConditionalOverride.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertActionParameters.js +31 -0
- package/build/browser/conversion/toMarketplace/convertActionParameters.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertActionSections.js +43 -0
- package/build/browser/conversion/toMarketplace/convertActionSections.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertActionValidation.js +93 -0
- package/build/browser/conversion/toMarketplace/convertActionValidation.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertActionVisibility.js +41 -0
- package/build/browser/conversion/toMarketplace/convertActionVisibility.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertCardinality.js +23 -0
- package/build/browser/conversion/toMarketplace/convertCardinality.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertConditionDefinition.js +86 -0
- package/build/browser/conversion/toMarketplace/convertConditionDefinition.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertDataConstraintToDataConstraints.js +26 -0
- package/build/browser/conversion/toMarketplace/convertDataConstraintToDataConstraints.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertDatasourceDefinition.js +89 -0
- package/build/browser/conversion/toMarketplace/convertDatasourceDefinition.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertInterface.js +47 -0
- package/build/browser/conversion/toMarketplace/convertInterface.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertLink.js +119 -0
- package/build/browser/conversion/toMarketplace/convertLink.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertMappingValue.js +41 -0
- package/build/browser/conversion/toMarketplace/convertMappingValue.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertNullabilityToDataConstraint.js +43 -0
- package/build/browser/conversion/toMarketplace/convertNullabilityToDataConstraint.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertObject.js +108 -0
- package/build/browser/conversion/toMarketplace/convertObject.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertObjectPropertyType.js +53 -0
- package/build/browser/conversion/toMarketplace/convertObjectPropertyType.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertOntologyDefinition.js +28 -0
- package/build/browser/conversion/toMarketplace/convertOntologyDefinition.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.js +57 -0
- package/build/browser/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertOntologyToValueTypeIr.js +24 -0
- package/build/browser/conversion/toMarketplace/convertOntologyToValueTypeIr.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertSectionConditionalOverride.js +35 -0
- package/build/browser/conversion/toMarketplace/convertSectionConditionalOverride.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertSpt.js +62 -0
- package/build/browser/conversion/toMarketplace/convertSpt.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertValueType.js +25 -0
- package/build/browser/conversion/toMarketplace/convertValueType.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertValueTypeDataConstraints.js +30 -0
- package/build/browser/conversion/toMarketplace/convertValueTypeDataConstraints.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertValueTypesToIr.js +34 -0
- package/build/browser/conversion/toMarketplace/convertValueTypesToIr.js.map +1 -0
- package/build/browser/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.js +83 -0
- package/build/browser/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.js.map +1 -0
- package/build/browser/conversion/toMarketplace/getFormContentOrdering.js +39 -0
- package/build/browser/conversion/toMarketplace/getFormContentOrdering.js.map +1 -0
- package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +124 -0
- package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -0
- package/build/browser/index.js +5 -5
- package/build/browser/index.js.map +1 -1
- package/build/browser/util/OptionalFields.js +2 -0
- package/build/browser/util/OptionalFields.js.map +1 -0
- package/build/browser/util/RequiredFields.js +2 -0
- package/build/browser/util/RequiredFields.js.map +1 -0
- package/build/cjs/index.cjs +1054 -966
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +382 -346
- package/build/esm/api/action/ActionLevelValidationDefinition.js +2 -0
- package/build/esm/api/action/ActionLevelValidationDefinition.js.map +1 -0
- package/build/esm/api/action/ActionParameter.js +2 -0
- package/build/esm/api/action/ActionParameter.js.map +1 -0
- package/build/esm/api/action/ActionParameterAllowedValues.js +2 -0
- package/build/esm/api/action/ActionParameterAllowedValues.js.map +1 -0
- package/build/esm/api/action/ActionParameterConditionalOverride.js +2 -0
- package/build/esm/api/action/ActionParameterConditionalOverride.js.map +1 -0
- package/build/esm/api/action/ActionParameterConfiguration.js +2 -0
- package/build/esm/api/action/ActionParameterConfiguration.js.map +1 -0
- package/build/esm/api/action/ActionParameterType.js +22 -0
- package/build/esm/api/action/ActionParameterType.js.map +1 -0
- package/build/esm/api/action/ActionSection.js +2 -0
- package/build/esm/api/action/ActionSection.js.map +1 -0
- package/build/esm/api/action/ActionStatus.js +2 -0
- package/build/esm/api/action/ActionStatus.js.map +1 -0
- package/build/esm/api/action/ActionType.js +2 -0
- package/build/esm/api/action/ActionType.js.map +1 -0
- package/build/esm/api/action/ActionValidationRule.js +2 -0
- package/build/esm/api/action/ActionValidationRule.js.map +1 -0
- package/build/esm/api/action/ConditionDefinition.js +2 -0
- package/build/esm/api/action/ConditionDefinition.js.map +1 -0
- package/build/esm/api/action/MappingValue.js +2 -0
- package/build/esm/api/action/MappingValue.js.map +1 -0
- package/build/esm/api/action/SectionConditionalOverride.js +2 -0
- package/build/esm/api/action/SectionConditionalOverride.js.map +1 -0
- package/build/esm/api/action/SubmissionMetadata.js +2 -0
- package/build/esm/api/action/SubmissionMetadata.js.map +1 -0
- package/build/esm/api/common/BlueprintIcons.js +2 -0
- package/build/esm/api/common/BlueprintIcons.js.map +1 -0
- package/build/esm/api/common/OntologyDefinition.js +2 -0
- package/build/esm/api/common/OntologyDefinition.js.map +1 -0
- package/build/esm/api/common/OntologyEntityBase.js +2 -0
- package/build/esm/api/common/OntologyEntityBase.js.map +1 -0
- package/build/esm/api/{types.js → common/OntologyEntityTypeEnum.js} +2 -8
- package/build/esm/api/common/OntologyEntityTypeEnum.js.map +1 -0
- package/build/esm/api/common/OntologyEntityTypeMapping.js +2 -0
- package/build/esm/api/common/OntologyEntityTypeMapping.js.map +1 -0
- package/build/esm/api/common/TypeClass.js +2 -0
- package/build/esm/api/common/TypeClass.js.map +1 -0
- package/build/esm/api/defineAction.js +38 -15
- package/build/esm/api/defineAction.js.map +1 -1
- package/build/esm/api/defineInterface.js +14 -34
- package/build/esm/api/defineInterface.js.map +1 -1
- package/build/esm/api/defineInterfaceLinkConstraint.js +3 -2
- package/build/esm/api/defineInterfaceLinkConstraint.js.map +1 -1
- package/build/esm/api/defineLink.js +3 -3
- package/build/esm/api/defineLink.js.map +1 -1
- package/build/esm/api/defineObject.js +9 -29
- package/build/esm/api/defineObject.js.map +1 -1
- package/build/esm/api/defineOntology.js +14 -550
- package/build/esm/api/defineOntology.js.map +1 -1
- package/build/esm/api/defineSpt.js +1 -1
- package/build/esm/api/defineSpt.js.map +1 -1
- package/build/esm/api/defineValueType.js +1 -1
- package/build/esm/api/defineValueType.js.map +1 -1
- package/build/esm/api/importOntologyEntity.js +1 -1
- package/build/esm/api/importOntologyEntity.js.map +1 -1
- package/build/esm/api/{defineImportSpt.js → importSharedPropertyType.js} +2 -3
- package/build/esm/api/importSharedPropertyType.js.map +1 -0
- package/build/esm/api/interface/InterfacePropertyType.js +2 -0
- package/build/esm/api/interface/InterfacePropertyType.js.map +1 -0
- package/build/esm/api/interface/InterfaceType.js +2 -0
- package/build/esm/api/interface/InterfaceType.js.map +1 -0
- package/build/esm/api/interface/getFlattenedInterfaceProperties.js +27 -0
- package/build/esm/api/interface/getFlattenedInterfaceProperties.js.map +1 -0
- package/build/esm/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js +42 -0
- package/build/esm/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js.map +1 -0
- package/build/esm/api/links/LinkType.js +2 -0
- package/build/esm/api/links/LinkType.js.map +1 -0
- package/build/esm/api/namespace/combineApiNamespaceIfMissing.js +20 -0
- package/build/esm/api/namespace/combineApiNamespaceIfMissing.js.map +1 -0
- package/build/esm/api/object/InterfaceImplementation.js +2 -0
- package/build/esm/api/object/InterfaceImplementation.js.map +1 -0
- package/build/esm/api/object/ObjectPropertyType.js +2 -0
- package/build/esm/api/object/ObjectPropertyType.js.map +1 -0
- package/build/esm/api/object/ObjectPropertyTypeUserDefinition.js +2 -0
- package/build/esm/api/object/ObjectPropertyTypeUserDefinition.js.map +1 -0
- package/build/esm/api/object/ObjectType.js +2 -0
- package/build/esm/api/object/ObjectType.js.map +1 -0
- package/build/esm/api/object/ObjectTypeDatasourceDefinition.js +2 -0
- package/build/esm/api/object/ObjectTypeDatasourceDefinition.js.map +1 -0
- package/build/esm/api/object/ObjectTypeDefinition.js +2 -0
- package/build/esm/api/object/ObjectTypeDefinition.js.map +1 -0
- package/build/esm/api/object/ObjectTypeStatus.js +2 -0
- package/build/esm/api/object/ObjectTypeStatus.js.map +1 -0
- package/build/esm/api/objectStatus.test.js.map +1 -1
- package/build/esm/api/overall.test.js +172 -5
- package/build/esm/api/overall.test.js.map +1 -1
- package/build/esm/api/properties/Nullability.js +2 -0
- package/build/esm/api/properties/Nullability.js.map +1 -0
- package/build/esm/api/properties/PropertyTypeType.js +34 -0
- package/build/esm/api/properties/PropertyTypeType.js.map +1 -0
- package/build/esm/api/properties/SharedPropertyType.js +2 -0
- package/build/esm/api/properties/SharedPropertyType.js.map +1 -0
- package/build/esm/api/propertyConversionUtils.js +0 -238
- package/build/esm/api/propertyConversionUtils.js.map +1 -1
- package/build/esm/api/values/ValueTypeDefinitionVersion.js +2 -0
- package/build/esm/api/values/ValueTypeDefinitionVersion.js.map +1 -0
- package/build/esm/api/values/ValueTypeType.js +2 -0
- package/build/esm/api/values/ValueTypeType.js.map +1 -0
- package/build/esm/api/wrapWithProxy.js +1 -0
- package/build/esm/api/wrapWithProxy.js.map +1 -1
- package/build/esm/cli/main.js +1 -1
- package/build/esm/conversion/toConjure/distributeTypeHelper.js +23 -0
- package/build/esm/conversion/toConjure/distributeTypeHelper.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertActionParameterConditionalOverride.js +88 -0
- package/build/esm/conversion/toMarketplace/convertActionParameterConditionalOverride.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertActionParameters.js +31 -0
- package/build/esm/conversion/toMarketplace/convertActionParameters.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertActionSections.js +43 -0
- package/build/esm/conversion/toMarketplace/convertActionSections.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertActionValidation.js +93 -0
- package/build/esm/conversion/toMarketplace/convertActionValidation.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertActionVisibility.js +41 -0
- package/build/esm/conversion/toMarketplace/convertActionVisibility.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertCardinality.js +23 -0
- package/build/esm/conversion/toMarketplace/convertCardinality.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertConditionDefinition.js +86 -0
- package/build/esm/conversion/toMarketplace/convertConditionDefinition.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertDataConstraintToDataConstraints.js +26 -0
- package/build/esm/conversion/toMarketplace/convertDataConstraintToDataConstraints.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertDatasourceDefinition.js +89 -0
- package/build/esm/conversion/toMarketplace/convertDatasourceDefinition.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertInterface.js +47 -0
- package/build/esm/conversion/toMarketplace/convertInterface.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertLink.js +119 -0
- package/build/esm/conversion/toMarketplace/convertLink.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertMappingValue.js +41 -0
- package/build/esm/conversion/toMarketplace/convertMappingValue.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertNullabilityToDataConstraint.js +43 -0
- package/build/esm/conversion/toMarketplace/convertNullabilityToDataConstraint.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertObject.js +108 -0
- package/build/esm/conversion/toMarketplace/convertObject.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertObjectPropertyType.js +53 -0
- package/build/esm/conversion/toMarketplace/convertObjectPropertyType.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertOntologyDefinition.js +28 -0
- package/build/esm/conversion/toMarketplace/convertOntologyDefinition.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.js +57 -0
- package/build/esm/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertOntologyToValueTypeIr.js +24 -0
- package/build/esm/conversion/toMarketplace/convertOntologyToValueTypeIr.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertSectionConditionalOverride.js +35 -0
- package/build/esm/conversion/toMarketplace/convertSectionConditionalOverride.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertSpt.js +62 -0
- package/build/esm/conversion/toMarketplace/convertSpt.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertValueType.js +25 -0
- package/build/esm/conversion/toMarketplace/convertValueType.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertValueTypeDataConstraints.js +30 -0
- package/build/esm/conversion/toMarketplace/convertValueTypeDataConstraints.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertValueTypesToIr.js +34 -0
- package/build/esm/conversion/toMarketplace/convertValueTypesToIr.js.map +1 -0
- package/build/esm/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.js +83 -0
- package/build/esm/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.js.map +1 -0
- package/build/esm/conversion/toMarketplace/getFormContentOrdering.js +39 -0
- package/build/esm/conversion/toMarketplace/getFormContentOrdering.js.map +1 -0
- package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +124 -0
- package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -0
- package/build/esm/index.js +5 -5
- package/build/esm/index.js.map +1 -1
- package/build/esm/util/OptionalFields.js +2 -0
- package/build/esm/util/OptionalFields.js.map +1 -0
- package/build/esm/util/RequiredFields.js +2 -0
- package/build/esm/util/RequiredFields.js.map +1 -0
- package/build/types/api/action/ActionLevelValidationDefinition.d.ts +7 -0
- package/build/types/api/action/ActionLevelValidationDefinition.d.ts.map +1 -0
- package/build/types/api/action/ActionParameter.d.ts +14 -0
- package/build/types/api/action/ActionParameter.d.ts.map +1 -0
- package/build/types/api/action/ActionParameterAllowedValues.d.ts +50 -0
- package/build/types/api/action/ActionParameterAllowedValues.d.ts.map +1 -0
- package/build/types/api/action/ActionParameterConditionalOverride.d.ts +26 -0
- package/build/types/api/action/ActionParameterConditionalOverride.d.ts.map +1 -0
- package/build/types/api/action/ActionParameterConfiguration.d.ts +20 -0
- package/build/types/api/action/ActionParameterConfiguration.d.ts.map +1 -0
- package/build/types/api/action/ActionParameterType.d.ts +6 -0
- package/build/types/api/action/ActionParameterType.d.ts.map +1 -0
- package/build/types/api/action/ActionSection.d.ts +13 -0
- package/build/types/api/action/ActionSection.d.ts.map +1 -0
- package/build/types/api/action/ActionStatus.d.ts +2 -0
- package/build/types/api/action/ActionStatus.d.ts.map +1 -0
- package/build/types/api/action/ActionType.d.ts +36 -0
- package/build/types/api/action/ActionType.d.ts.map +1 -0
- package/build/types/api/action/ActionValidationRule.d.ts +2 -0
- package/build/types/api/action/ActionValidationRule.d.ts.map +1 -0
- package/build/types/api/action/ConditionDefinition.d.ts +15 -0
- package/build/types/api/action/ConditionDefinition.d.ts.map +1 -0
- package/build/types/api/action/MappingValue.d.ts +13 -0
- package/build/types/api/action/MappingValue.d.ts.map +1 -0
- package/build/types/api/action/SectionConditionalOverride.d.ts +2 -0
- package/build/types/api/action/SectionConditionalOverride.d.ts.map +1 -0
- package/build/types/api/action/SubmissionMetadata.d.ts +6 -0
- package/build/types/api/action/SubmissionMetadata.d.ts.map +1 -0
- package/build/types/api/{iconNames.d.ts.map → common/BlueprintIcons.d.ts.map} +1 -1
- package/build/types/api/common/OntologyDefinition.d.ts +6 -0
- package/build/types/api/common/OntologyDefinition.d.ts.map +1 -0
- package/build/types/api/common/OntologyEntityBase.d.ts +5 -0
- package/build/types/api/common/OntologyEntityBase.d.ts.map +1 -0
- package/build/types/api/common/OntologyEntityTypeEnum.d.ts +8 -0
- package/build/types/api/common/OntologyEntityTypeEnum.d.ts.map +1 -0
- package/build/types/api/common/OntologyEntityTypeMapping.d.ts +16 -0
- package/build/types/api/common/OntologyEntityTypeMapping.d.ts.map +1 -0
- package/build/types/api/common/TypeClass.d.ts +4 -0
- package/build/types/api/common/TypeClass.d.ts.map +1 -0
- package/build/types/api/defineAction.d.ts +30 -1
- package/build/types/api/defineAction.d.ts.map +1 -1
- package/build/types/api/defineInterface.d.ts +5 -3
- package/build/types/api/defineInterface.d.ts.map +1 -1
- package/build/types/api/defineInterfaceLinkConstraint.d.ts +1 -1
- package/build/types/api/defineInterfaceLinkConstraint.d.ts.map +1 -1
- package/build/types/api/defineLink.d.ts +1 -1
- package/build/types/api/defineLink.d.ts.map +1 -1
- package/build/types/api/defineObject.d.ts +2 -4
- package/build/types/api/defineObject.d.ts.map +1 -1
- package/build/types/api/defineOntology.d.ts +10 -3
- package/build/types/api/defineOntology.d.ts.map +1 -1
- package/build/types/api/defineSpt.d.ts +2 -1
- package/build/types/api/defineSpt.d.ts.map +1 -1
- package/build/types/api/defineValueType.d.ts +2 -1
- package/build/types/api/defineValueType.d.ts.map +1 -1
- package/build/types/api/importOntologyEntity.d.ts +1 -1
- package/build/types/api/importOntologyEntity.d.ts.map +1 -1
- package/build/types/api/{defineImportSpt.d.ts → importSharedPropertyType.d.ts} +2 -1
- package/build/types/api/importSharedPropertyType.d.ts.map +1 -0
- package/build/types/api/interface/InterfacePropertyType.d.ts +5 -0
- package/build/types/api/interface/InterfacePropertyType.d.ts.map +1 -0
- package/build/types/api/interface/InterfaceType.d.ts +10 -0
- package/build/types/api/interface/InterfaceType.d.ts.map +1 -0
- package/build/types/api/interface/getFlattenedInterfaceProperties.d.ts +3 -0
- package/build/types/api/interface/getFlattenedInterfaceProperties.d.ts.map +1 -0
- package/build/types/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.d.ts +3 -0
- package/build/types/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.d.ts.map +1 -0
- package/build/types/api/links/LinkType.d.ts +71 -0
- package/build/types/api/links/LinkType.d.ts.map +1 -0
- package/build/types/api/namespace/combineApiNamespaceIfMissing.d.ts +1 -0
- package/build/types/api/namespace/combineApiNamespaceIfMissing.d.ts.map +1 -0
- package/build/types/api/object/InterfaceImplementation.d.ts +8 -0
- package/build/types/api/object/InterfaceImplementation.d.ts.map +1 -0
- package/build/types/api/object/ObjectPropertyType.d.ts +27 -0
- package/build/types/api/object/ObjectPropertyType.d.ts.map +1 -0
- package/build/types/api/object/ObjectPropertyTypeUserDefinition.d.ts +3 -0
- package/build/types/api/object/ObjectPropertyTypeUserDefinition.d.ts.map +1 -0
- package/build/types/api/object/ObjectType.d.ts +29 -0
- package/build/types/api/object/ObjectType.d.ts.map +1 -0
- package/build/types/api/object/ObjectTypeDatasourceDefinition.d.ts +11 -0
- package/build/types/api/object/ObjectTypeDatasourceDefinition.d.ts.map +1 -0
- package/build/types/api/object/ObjectTypeDefinition.d.ts +26 -0
- package/build/types/api/object/ObjectTypeDefinition.d.ts.map +1 -0
- package/build/types/api/object/ObjectTypeStatus.d.ts +5 -0
- package/build/types/api/object/ObjectTypeStatus.d.ts.map +1 -0
- package/build/types/api/properties/Nullability.d.ts +4 -0
- package/build/types/api/properties/Nullability.d.ts.map +1 -0
- package/build/types/api/properties/PropertyTypeType.d.ts +33 -0
- package/build/types/api/properties/PropertyTypeType.d.ts.map +1 -0
- package/build/types/api/properties/SharedPropertyType.d.ts +22 -0
- package/build/types/api/properties/SharedPropertyType.d.ts.map +1 -0
- package/build/types/api/propertyConversionUtils.d.ts +2 -20
- package/build/types/api/propertyConversionUtils.d.ts.map +1 -1
- package/build/types/api/values/ValueTypeDefinitionVersion.d.ts +14 -0
- package/build/types/api/values/ValueTypeDefinitionVersion.d.ts.map +1 -0
- package/build/types/api/values/ValueTypeType.d.ts +178 -0
- package/build/types/api/values/ValueTypeType.d.ts.map +1 -0
- package/build/types/api/wrapWithProxy.d.ts +1 -1
- package/build/types/api/wrapWithProxy.d.ts.map +1 -1
- package/build/types/conversion/toConjure/distributeTypeHelper.d.ts +3 -0
- package/build/types/conversion/toConjure/distributeTypeHelper.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertActionParameterConditionalOverride.d.ts +4 -0
- package/build/types/conversion/toMarketplace/convertActionParameterConditionalOverride.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertActionParameters.d.ts +3 -0
- package/build/types/conversion/toMarketplace/convertActionParameters.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertActionSections.d.ts +3 -0
- package/build/types/conversion/toMarketplace/convertActionSections.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertActionValidation.d.ts +3 -0
- package/build/types/conversion/toMarketplace/convertActionValidation.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertActionVisibility.d.ts +2 -0
- package/build/types/conversion/toMarketplace/convertActionVisibility.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertCardinality.d.ts +3 -0
- package/build/types/conversion/toMarketplace/convertCardinality.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertConditionDefinition.d.ts +3 -0
- package/build/types/conversion/toMarketplace/convertConditionDefinition.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertDataConstraintToDataConstraints.d.ts +2 -0
- package/build/types/conversion/toMarketplace/convertDataConstraintToDataConstraints.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertDatasourceDefinition.d.ts +4 -0
- package/build/types/conversion/toMarketplace/convertDatasourceDefinition.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertInterface.d.ts +3 -0
- package/build/types/conversion/toMarketplace/convertInterface.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertLink.d.ts +3 -0
- package/build/types/conversion/toMarketplace/convertLink.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertMappingValue.d.ts +3 -0
- package/build/types/conversion/toMarketplace/convertMappingValue.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertNullabilityToDataConstraint.d.ts +7 -0
- package/build/types/conversion/toMarketplace/convertNullabilityToDataConstraint.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertObject.d.ts +9 -0
- package/build/types/conversion/toMarketplace/convertObject.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertObjectPropertyType.d.ts +3 -0
- package/build/types/conversion/toMarketplace/convertObjectPropertyType.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertOntologyDefinition.d.ts +3 -0
- package/build/types/conversion/toMarketplace/convertOntologyDefinition.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.d.ts +3 -0
- package/build/types/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertOntologyToValueTypeIr.d.ts +3 -0
- package/build/types/conversion/toMarketplace/convertOntologyToValueTypeIr.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertSectionConditionalOverride.d.ts +3 -0
- package/build/types/conversion/toMarketplace/convertSectionConditionalOverride.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertSpt.d.ts +3 -0
- package/build/types/conversion/toMarketplace/convertSpt.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertValueType.d.ts +3 -0
- package/build/types/conversion/toMarketplace/convertValueType.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertValueTypeDataConstraints.d.ts +2 -0
- package/build/types/conversion/toMarketplace/convertValueTypeDataConstraints.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertValueTypesToIr.d.ts +3 -0
- package/build/types/conversion/toMarketplace/convertValueTypesToIr.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.d.ts +2 -0
- package/build/types/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/getFormContentOrdering.d.ts +3 -0
- package/build/types/conversion/toMarketplace/getFormContentOrdering.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.d.ts +3 -0
- package/build/types/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.d.ts.map +1 -0
- package/build/types/index.d.ts +22 -6
- package/build/types/index.d.ts.map +1 -1
- package/build/types/util/OptionalFields.d.ts +4 -0
- package/build/types/util/OptionalFields.d.ts.map +1 -0
- package/build/types/util/RequiredFields.d.ts +4 -0
- package/build/types/util/RequiredFields.d.ts.map +1 -0
- package/package.json +5 -5
- package/build/browser/api/defineImportSpt.js.map +0 -1
- package/build/browser/api/iconNames.js +0 -2
- package/build/browser/api/iconNames.js.map +0 -1
- package/build/browser/api/ontologyUtils.js +0 -243
- package/build/browser/api/ontologyUtils.js.map +0 -1
- package/build/browser/api/types.js.map +0 -1
- package/build/esm/api/defineImportSpt.js.map +0 -1
- package/build/esm/api/iconNames.js +0 -2
- package/build/esm/api/iconNames.js.map +0 -1
- package/build/esm/api/ontologyUtils.js +0 -243
- package/build/esm/api/ontologyUtils.js.map +0 -1
- package/build/esm/api/types.js.map +0 -1
- package/build/types/api/defineImportSpt.d.ts.map +0 -1
- package/build/types/api/ontologyUtils.d.ts +0 -8
- package/build/types/api/ontologyUtils.d.ts.map +0 -1
- package/build/types/api/types.d.ts +0 -625
- package/build/types/api/types.d.ts.map +0 -1
- /package/build/types/api/{iconNames.d.ts → common/BlueprintIcons.d.ts} +0 -0
package/build/cjs/index.cjs
CHANGED
|
@@ -39,7 +39,23 @@ var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
|
39
39
|
|
|
40
40
|
// src/cli/main.ts
|
|
41
41
|
|
|
42
|
-
// src/
|
|
42
|
+
// src/conversion/toMarketplace/convertActionParameters.ts
|
|
43
|
+
function convertActionParameters(action) {
|
|
44
|
+
return Object.fromEntries((action.parameters ?? []).map((p) => [p.id, {
|
|
45
|
+
id: p.id,
|
|
46
|
+
type: typeof p.type === "string" ? {
|
|
47
|
+
type: p.type,
|
|
48
|
+
[p.type]: {}
|
|
49
|
+
} : p.type,
|
|
50
|
+
displayMetadata: {
|
|
51
|
+
displayName: p.displayName,
|
|
52
|
+
description: p.description ?? "",
|
|
53
|
+
typeClasses: []
|
|
54
|
+
}
|
|
55
|
+
}]));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/api/common/OntologyEntityTypeEnum.ts
|
|
43
59
|
var OntologyEntityTypeEnum = /* @__PURE__ */ (function(OntologyEntityTypeEnum2) {
|
|
44
60
|
OntologyEntityTypeEnum2["OBJECT_TYPE"] = "OBJECT_TYPE";
|
|
45
61
|
OntologyEntityTypeEnum2["LINK_TYPE"] = "LINK_TYPE";
|
|
@@ -49,8 +65,37 @@ var OntologyEntityTypeEnum = /* @__PURE__ */ (function(OntologyEntityTypeEnum2)
|
|
|
49
65
|
OntologyEntityTypeEnum2["VALUE_TYPE"] = "VALUE_TYPE";
|
|
50
66
|
return OntologyEntityTypeEnum2;
|
|
51
67
|
})({});
|
|
52
|
-
|
|
53
|
-
|
|
68
|
+
|
|
69
|
+
// src/api/interface/getFlattenedInterfaceProperties.ts
|
|
70
|
+
function getFlattenedInterfaceProperties(interfaceType) {
|
|
71
|
+
let properties = interfaceType.propertiesV2;
|
|
72
|
+
interfaceType.extendsInterfaces.forEach((ext) => {
|
|
73
|
+
properties = {
|
|
74
|
+
...properties,
|
|
75
|
+
...getFlattenedInterfaceProperties(ext)
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
return properties;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// src/api/properties/PropertyTypeType.ts
|
|
82
|
+
function isPropertyTypeType(v) {
|
|
83
|
+
return v === "boolean" || v === "byte" || v === "date" || v === "decimal" || v === "double" || v === "float" || v === "geopoint" || v === "geoshape" || v === "integer" || v === "long" || typeof v === "object" && v.type === "marking" || v === "short" || v === "string" || v === "timestamp";
|
|
84
|
+
}
|
|
85
|
+
function isExotic(type) {
|
|
86
|
+
if (type === void 0) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
if (typeof type === "string") {
|
|
90
|
+
return ["geopoint", "geoshape", "mediaReference", "geotimeSeries"].includes(type);
|
|
91
|
+
} else if (typeof type === "object" && type != null) {
|
|
92
|
+
return type.type === "marking" || type.type === "struct";
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
function isStruct(type) {
|
|
97
|
+
return typeof type === "object" && type.type === "struct";
|
|
98
|
+
}
|
|
54
99
|
|
|
55
100
|
// src/api/defineObject.ts
|
|
56
101
|
var ISO_8601_DURATION = /^P(?!$)(?:(?:((?:\d+Y)|(?:\d+(?:\.|,)\d+Y$))?((?:\d+M)|(?:\d+(?:\.|,)\d+M$))?((?:\d+D)|(?:\d+(?:\.|,)\d+D$))?(T((?:\d+H)|(?:\d+(?:\.|,)\d+H$))?((?:\d+M)|(?:\d+(?:\.|,)\d+M$))?((?:\d+S)|(?:\d+(?:\.|,)\d+S$))?)?)|(?:\d+(?:(?:\.|,)\d+)?W))$/;
|
|
@@ -84,7 +129,7 @@ function defineObject(objectDef) {
|
|
|
84
129
|
!!isExotic(objectDef.properties?.[objectDef.titlePropertyApiName]?.type) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Title property ${objectDef.titlePropertyApiName} must be a primitive type`) : invariant5__default.default(false) : void 0;
|
|
85
130
|
!!isExotic(objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.type) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Primary key property ${objectDef.primaryKeyPropertyApiName} can only be primitive types`) : invariant5__default.default(false) : void 0;
|
|
86
131
|
objectDef.implementsInterfaces?.forEach((interfaceImpl) => {
|
|
87
|
-
const allInterfaceProperties =
|
|
132
|
+
const allInterfaceProperties = getFlattenedInterfaceProperties(interfaceImpl.implements);
|
|
88
133
|
const nonExistentInterfaceProperties = interfaceImpl.propertyMapping.map((val) => val.interfaceProperty).filter((interfaceProperty) => allInterfaceProperties[addNamespaceIfNone(interfaceProperty)] === void 0).map((interfaceProp) => ({
|
|
89
134
|
type: "invalid",
|
|
90
135
|
reason: `Interface property ${interfaceProp} referenced in ${objectDef.apiName} object does not exist`
|
|
@@ -99,7 +144,7 @@ function defineObject(objectDef) {
|
|
|
99
144
|
reason: `Interface property ${interfaceProp[1].sharedPropertyType.apiName} not implemented by ${objectDef.apiName} object definition`
|
|
100
145
|
};
|
|
101
146
|
};
|
|
102
|
-
const validations = Object.entries(
|
|
147
|
+
const validations = Object.entries(getFlattenedInterfaceProperties(interfaceImpl.implements)).map(validateProperty);
|
|
103
148
|
const allFailedValidations = validations.concat(nonExistentInterfaceProperties).filter((val) => val.type === "invalid");
|
|
104
149
|
!(allFailedValidations.length === 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "\n" + allFailedValidations.map(formatValidationErrors).join("\n")) : invariant5__default.default(false) : void 0;
|
|
105
150
|
});
|
|
@@ -114,17 +159,6 @@ function defineObject(objectDef) {
|
|
|
114
159
|
objectDef.apiName = apiName;
|
|
115
160
|
return objectDef;
|
|
116
161
|
}
|
|
117
|
-
function isExotic(type) {
|
|
118
|
-
if (type === void 0) {
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
if (typeof type === "string") {
|
|
122
|
-
return ["geopoint", "geoshape", "mediaReference", "geotimeSeries"].includes(type);
|
|
123
|
-
} else if (typeof type === "object" && type != null) {
|
|
124
|
-
return type.type === "marking" || type.type === "struct";
|
|
125
|
-
}
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
162
|
function formatValidationErrors(error) {
|
|
129
163
|
return `Ontology Definition Error: ${error.reason}
|
|
130
164
|
`;
|
|
@@ -147,56 +181,122 @@ function validateInterfaceImplProperty(spt, mappedObjectProp, object) {
|
|
|
147
181
|
type: "valid"
|
|
148
182
|
};
|
|
149
183
|
}
|
|
150
|
-
function
|
|
184
|
+
function uppercaseFirstLetter(s) {
|
|
151
185
|
return s === void 0 || s == null ? "" : s.charAt(0).toUpperCase() + s.slice(1);
|
|
152
186
|
}
|
|
153
187
|
function convertToPluralDisplayName(s) {
|
|
154
|
-
return s === void 0 || s == null ? "" : s.endsWith("s") ?
|
|
155
|
-
}
|
|
156
|
-
function getAllInterfaceProperties(interfaceType) {
|
|
157
|
-
let properties = interfaceType.propertiesV2;
|
|
158
|
-
interfaceType.extendsInterfaces.forEach((ext) => {
|
|
159
|
-
properties = {
|
|
160
|
-
...properties,
|
|
161
|
-
...getAllInterfaceProperties(ext)
|
|
162
|
-
};
|
|
163
|
-
});
|
|
164
|
-
return properties;
|
|
188
|
+
return s === void 0 || s == null ? "" : s.endsWith("s") ? uppercaseFirstLetter(s) : uppercaseFirstLetter(s) + "s";
|
|
165
189
|
}
|
|
166
190
|
function convertUserObjectPropertyType(apiName, property) {
|
|
167
191
|
property.apiName = apiName;
|
|
168
|
-
property.displayName = property.displayName ??
|
|
192
|
+
property.displayName = property.displayName ?? uppercaseFirstLetter(apiName);
|
|
169
193
|
return {
|
|
170
194
|
...property,
|
|
171
195
|
apiName,
|
|
172
|
-
displayName: property.displayName ??
|
|
196
|
+
displayName: property.displayName ?? uppercaseFirstLetter(apiName),
|
|
173
197
|
type: property.type
|
|
174
198
|
};
|
|
175
199
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
200
|
+
|
|
201
|
+
// src/conversion/toMarketplace/convertActionSections.ts
|
|
202
|
+
function convertActionSections(action) {
|
|
203
|
+
return Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId, section]) => [sectionId, {
|
|
204
|
+
id: sectionId,
|
|
205
|
+
content: section.parameters.map((p) => ({
|
|
206
|
+
type: "parameterId",
|
|
207
|
+
parameterId: p
|
|
208
|
+
})),
|
|
209
|
+
displayMetadata: {
|
|
210
|
+
collapsedByDefault: section.collapsedByDefault ?? false,
|
|
211
|
+
columnCount: section.columnCount ?? 1,
|
|
212
|
+
description: section.description ?? "",
|
|
213
|
+
displayName: section.displayName ?? uppercaseFirstLetter(sectionId),
|
|
214
|
+
showTitleBar: section.showTitleBar ?? true,
|
|
215
|
+
...section.style && {
|
|
216
|
+
style: section.style === "box" ? {
|
|
217
|
+
type: "box",
|
|
218
|
+
box: {}
|
|
219
|
+
} : {
|
|
220
|
+
type: "minimal",
|
|
221
|
+
minimal: {}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}]));
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// src/conversion/toMarketplace/convertConditionDefinition.ts
|
|
229
|
+
function convertConditionDefinition(condition) {
|
|
230
|
+
switch (condition.type) {
|
|
231
|
+
case "and":
|
|
232
|
+
if ("conditions" in condition) {
|
|
233
|
+
return {
|
|
234
|
+
type: "and",
|
|
235
|
+
and: {
|
|
236
|
+
conditions: condition.conditions.map((c) => convertConditionDefinition(c))
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
} else {
|
|
240
|
+
return condition;
|
|
241
|
+
}
|
|
242
|
+
case "or":
|
|
243
|
+
if ("conditions" in condition) {
|
|
244
|
+
return {
|
|
245
|
+
type: "or",
|
|
246
|
+
or: {
|
|
247
|
+
conditions: condition.conditions.map((c) => convertConditionDefinition(c))
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
} else {
|
|
251
|
+
return condition;
|
|
252
|
+
}
|
|
253
|
+
case "group":
|
|
184
254
|
return {
|
|
185
|
-
type: "
|
|
186
|
-
|
|
255
|
+
type: "comparison",
|
|
256
|
+
comparison: {
|
|
257
|
+
operator: "INTERSECTS",
|
|
258
|
+
left: {
|
|
259
|
+
type: "userProperty",
|
|
260
|
+
userProperty: {
|
|
261
|
+
userId: {
|
|
262
|
+
type: "currentUser",
|
|
263
|
+
currentUser: {}
|
|
264
|
+
},
|
|
265
|
+
propertyValue: {
|
|
266
|
+
type: "groupIds",
|
|
267
|
+
groupIds: {}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
right: {
|
|
272
|
+
type: "staticValue",
|
|
273
|
+
staticValue: {
|
|
274
|
+
type: "stringList",
|
|
275
|
+
stringList: {
|
|
276
|
+
strings: [condition.name]
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
187
281
|
};
|
|
188
|
-
case "
|
|
282
|
+
case "parameter":
|
|
189
283
|
return {
|
|
190
|
-
type: "
|
|
191
|
-
|
|
284
|
+
type: "comparison",
|
|
285
|
+
comparison: {
|
|
286
|
+
operator: "EQUALS",
|
|
287
|
+
left: {
|
|
288
|
+
type: "parameterId",
|
|
289
|
+
parameterId: condition.parameterId
|
|
290
|
+
},
|
|
291
|
+
right: condition.matches
|
|
292
|
+
}
|
|
192
293
|
};
|
|
193
294
|
default:
|
|
194
|
-
return
|
|
195
|
-
type: "editable",
|
|
196
|
-
editable: {}
|
|
197
|
-
};
|
|
295
|
+
return condition;
|
|
198
296
|
}
|
|
199
297
|
}
|
|
298
|
+
|
|
299
|
+
// src/conversion/toMarketplace/convertActionParameterConditionalOverride.ts
|
|
200
300
|
function convertActionParameterConditionalOverride(override, validation) {
|
|
201
301
|
let parameterBlockOverride;
|
|
202
302
|
switch (override.type) {
|
|
@@ -266,6 +366,34 @@ function convertActionParameterConditionalOverride(override, validation) {
|
|
|
266
366
|
parameterBlockOverrides: [parameterBlockOverride]
|
|
267
367
|
};
|
|
268
368
|
}
|
|
369
|
+
|
|
370
|
+
// src/conversion/toMarketplace/convertActionVisibility.ts
|
|
371
|
+
function convertActionVisibility(visibility) {
|
|
372
|
+
switch (visibility) {
|
|
373
|
+
case "editable":
|
|
374
|
+
return {
|
|
375
|
+
type: "editable",
|
|
376
|
+
editable: {}
|
|
377
|
+
};
|
|
378
|
+
case "disabled":
|
|
379
|
+
return {
|
|
380
|
+
type: "disabled",
|
|
381
|
+
disabled: {}
|
|
382
|
+
};
|
|
383
|
+
case "hidden":
|
|
384
|
+
return {
|
|
385
|
+
type: "hidden",
|
|
386
|
+
hidden: {}
|
|
387
|
+
};
|
|
388
|
+
default:
|
|
389
|
+
return {
|
|
390
|
+
type: "editable",
|
|
391
|
+
editable: {}
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// src/conversion/toMarketplace/convertSectionConditionalOverride.ts
|
|
269
397
|
function convertSectionConditionalOverride(override, defaultVisibility) {
|
|
270
398
|
return {
|
|
271
399
|
condition: convertConditionDefinition(override.condition),
|
|
@@ -283,227 +411,78 @@ function convertSectionConditionalOverride(override, defaultVisibility) {
|
|
|
283
411
|
}]
|
|
284
412
|
};
|
|
285
413
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
414
|
+
|
|
415
|
+
// src/conversion/toMarketplace/convertActionValidation.ts
|
|
416
|
+
function convertActionValidation(action) {
|
|
417
|
+
return {
|
|
418
|
+
actionTypeLevelValidation: {
|
|
419
|
+
rules: Object.fromEntries((action.validation ?? [{
|
|
420
|
+
condition: {
|
|
421
|
+
type: "true",
|
|
422
|
+
true: {}
|
|
423
|
+
},
|
|
424
|
+
displayMetadata: {
|
|
425
|
+
failureMessage: "",
|
|
426
|
+
typeClasses: []
|
|
427
|
+
}
|
|
428
|
+
}]).map((rule, idx) => [idx, rule]))
|
|
429
|
+
},
|
|
430
|
+
parameterValidations: Object.fromEntries((action.parameters ?? []).map((p) => {
|
|
431
|
+
return [p.id, {
|
|
432
|
+
defaultValidation: {
|
|
433
|
+
display: {
|
|
434
|
+
renderHint: renderHintFromBaseType(p),
|
|
435
|
+
visibility: convertActionVisibility(p.validation.defaultVisibility),
|
|
436
|
+
...p.defaultValue && {
|
|
437
|
+
prefill: p.defaultValue
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
validation: {
|
|
441
|
+
allowedValues: extractAllowedValues(p.validation.allowedValues),
|
|
442
|
+
required: convertParameterRequirementConstraint(p.validation.required)
|
|
294
443
|
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
444
|
+
},
|
|
445
|
+
conditionalOverrides: p.validation.conditionalOverrides?.map((override) => convertActionParameterConditionalOverride(override, p.validation)) ?? []
|
|
446
|
+
}];
|
|
447
|
+
})),
|
|
448
|
+
sectionValidations: {
|
|
449
|
+
...Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId, section]) => [section.id, {
|
|
450
|
+
defaultDisplayMetadata: section.defaultVisibility === "hidden" ? {
|
|
451
|
+
visibility: {
|
|
452
|
+
type: "hidden",
|
|
453
|
+
hidden: {}
|
|
305
454
|
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
case "group":
|
|
311
|
-
return {
|
|
312
|
-
type: "comparison",
|
|
313
|
-
comparison: {
|
|
314
|
-
operator: "INTERSECTS",
|
|
315
|
-
left: {
|
|
316
|
-
type: "userProperty",
|
|
317
|
-
userProperty: {
|
|
318
|
-
userId: {
|
|
319
|
-
type: "currentUser",
|
|
320
|
-
currentUser: {}
|
|
321
|
-
},
|
|
322
|
-
propertyValue: {
|
|
323
|
-
type: "groupIds",
|
|
324
|
-
groupIds: {}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
},
|
|
328
|
-
right: {
|
|
329
|
-
type: "staticValue",
|
|
330
|
-
staticValue: {
|
|
331
|
-
type: "stringList",
|
|
332
|
-
stringList: {
|
|
333
|
-
strings: [condition.name]
|
|
334
|
-
}
|
|
335
|
-
}
|
|
455
|
+
} : {
|
|
456
|
+
visibility: {
|
|
457
|
+
type: "visible",
|
|
458
|
+
visible: {}
|
|
336
459
|
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
return {
|
|
341
|
-
type: "comparison",
|
|
342
|
-
comparison: {
|
|
343
|
-
operator: "EQUALS",
|
|
344
|
-
left: {
|
|
345
|
-
type: "parameterId",
|
|
346
|
-
parameterId: condition.parameterId
|
|
347
|
-
},
|
|
348
|
-
right: condition.matches
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
default:
|
|
352
|
-
return condition;
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
function getFormContentOrdering(action, parameterOrdering) {
|
|
356
|
-
if (!action.sections) return [];
|
|
357
|
-
const parametersToSection = Object.fromEntries(Object.entries(action.sections).flatMap(([sectionId, section]) => section.parameters.map((param) => [param, sectionId])));
|
|
358
|
-
const seenIds = /* @__PURE__ */ new Set();
|
|
359
|
-
const formContentOrdering = [];
|
|
360
|
-
parameterOrdering.forEach((param) => {
|
|
361
|
-
if (param in parametersToSection && !seenIds.has(parametersToSection[param])) {
|
|
362
|
-
formContentOrdering.push({
|
|
363
|
-
type: "sectionId",
|
|
364
|
-
sectionId: parametersToSection[param]
|
|
365
|
-
});
|
|
366
|
-
seenIds.add(parametersToSection[param]);
|
|
367
|
-
} else if (!(param in parametersToSection)) {
|
|
368
|
-
formContentOrdering.push({
|
|
369
|
-
type: "parameterId",
|
|
370
|
-
parameterId: param
|
|
371
|
-
});
|
|
372
|
-
seenIds.add(param);
|
|
460
|
+
},
|
|
461
|
+
conditionalOverrides: section.conditionalOverrides?.map((override) => convertSectionConditionalOverride(override, section.defaultVisibility ?? "visible")) ?? []
|
|
462
|
+
}]))
|
|
373
463
|
}
|
|
374
|
-
});
|
|
375
|
-
return formContentOrdering;
|
|
376
|
-
}
|
|
377
|
-
function convertMappingValue(value) {
|
|
378
|
-
switch (value.type) {
|
|
379
|
-
case "uuid":
|
|
380
|
-
return {
|
|
381
|
-
type: "uniqueIdentifier",
|
|
382
|
-
uniqueIdentifier: {
|
|
383
|
-
linkId: value.linkId ?? crypto.randomUUID()
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
-
case "currentTime":
|
|
387
|
-
return {
|
|
388
|
-
type: "currentTime",
|
|
389
|
-
currentTime: {}
|
|
390
|
-
};
|
|
391
|
-
case "currentUser":
|
|
392
|
-
return {
|
|
393
|
-
type: "currentUser",
|
|
394
|
-
currentUser: {}
|
|
395
|
-
};
|
|
396
|
-
default:
|
|
397
|
-
return value;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
var defaultTypeClasses = [{
|
|
401
|
-
kind: "render_hint",
|
|
402
|
-
name: "SELECTABLE"
|
|
403
|
-
}, {
|
|
404
|
-
kind: "render_hint",
|
|
405
|
-
name: "SORTABLE"
|
|
406
|
-
}];
|
|
407
|
-
function shouldNotHaveRenderHints(type) {
|
|
408
|
-
return ["struct", "mediaReference", "geotimeSeries"].includes(getPropertyTypeName(type));
|
|
409
|
-
}
|
|
410
|
-
function hasRenderHints(typeClasses) {
|
|
411
|
-
return (typeClasses ?? []).some((tc) => tc.kind.toLowerCase() === "render_hint");
|
|
412
|
-
}
|
|
413
|
-
function getPropertyTypeName(type) {
|
|
414
|
-
return typeof type === "object" ? type.type : type;
|
|
415
|
-
}
|
|
416
|
-
function convertValueType(valueType) {
|
|
417
|
-
return {
|
|
418
|
-
apiName: valueType.apiName,
|
|
419
|
-
version: valueType.version,
|
|
420
|
-
packageNamespace: valueType.packageNamespace,
|
|
421
|
-
displayMetadata: valueType.displayMetadata
|
|
422
|
-
};
|
|
423
|
-
}
|
|
424
|
-
function convertValueTypeDataConstraints(dataConstraints) {
|
|
425
|
-
if (dataConstraints.length === 0) {
|
|
426
|
-
return void 0;
|
|
427
|
-
}
|
|
428
|
-
const propertyTypeConstraints = dataConstraints.map((constraint) => ({
|
|
429
|
-
constraints: dataConstraintToPropertyTypeDataConstraint(constraint.constraint.constraint),
|
|
430
|
-
failureMessage: constraint.constraint.failureMessage
|
|
431
|
-
}));
|
|
432
|
-
return {
|
|
433
|
-
propertyTypeConstraints
|
|
434
464
|
};
|
|
435
465
|
}
|
|
436
|
-
function
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
};
|
|
446
|
-
case "binary":
|
|
447
|
-
throw new Error("Binary type constraints are not supported");
|
|
448
|
-
case "date":
|
|
449
|
-
return {
|
|
450
|
-
...dc
|
|
451
|
-
};
|
|
452
|
-
case "decimal":
|
|
453
|
-
return {
|
|
454
|
-
...dc
|
|
455
|
-
};
|
|
456
|
-
case "double":
|
|
457
|
-
return {
|
|
458
|
-
...dc
|
|
459
|
-
};
|
|
460
|
-
case "float":
|
|
461
|
-
return {
|
|
462
|
-
...dc
|
|
463
|
-
};
|
|
464
|
-
case "integer":
|
|
465
|
-
return {
|
|
466
|
-
...dc
|
|
467
|
-
};
|
|
468
|
-
case "long":
|
|
469
|
-
return {
|
|
470
|
-
...dc
|
|
471
|
-
};
|
|
472
|
-
case "map":
|
|
473
|
-
throw new Error("Map type constraints are not supported");
|
|
474
|
-
case "nullable":
|
|
475
|
-
throw new Error("Nullable constraints are not supported");
|
|
476
|
-
case "short":
|
|
477
|
-
return {
|
|
478
|
-
...dc
|
|
479
|
-
};
|
|
480
|
-
case "string":
|
|
481
|
-
return {
|
|
482
|
-
...dc
|
|
483
|
-
};
|
|
484
|
-
case "struct":
|
|
485
|
-
return {
|
|
486
|
-
type: "struct",
|
|
487
|
-
struct: {
|
|
488
|
-
elementConstraints: Object.fromEntries(Object.entries(dc.struct.elementConstraints).map(([field, constraint]) => [field, convertDataConstraintToDataConstraints(constraint)]))
|
|
489
|
-
}
|
|
490
|
-
};
|
|
491
|
-
case "structV2":
|
|
492
|
-
throw new Error("StructV2 constraints are not supported");
|
|
493
|
-
case "timestamp":
|
|
494
|
-
return {
|
|
495
|
-
...dc
|
|
496
|
-
};
|
|
497
|
-
default:
|
|
498
|
-
throw new Error(`Unknown DataConstraint type: ${dc.type}`);
|
|
466
|
+
function convertParameterRequirementConstraint(required) {
|
|
467
|
+
if (typeof required === "boolean") {
|
|
468
|
+
return required ? {
|
|
469
|
+
type: "required",
|
|
470
|
+
required: {}
|
|
471
|
+
} : {
|
|
472
|
+
type: "notRequired",
|
|
473
|
+
notRequired: {}
|
|
474
|
+
};
|
|
499
475
|
}
|
|
500
|
-
|
|
501
|
-
|
|
476
|
+
const {
|
|
477
|
+
min,
|
|
478
|
+
max
|
|
479
|
+
} = required.listLength;
|
|
502
480
|
return {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
481
|
+
type: "listLengthValidation",
|
|
482
|
+
listLengthValidation: {
|
|
483
|
+
minLength: min,
|
|
484
|
+
maxLength: max
|
|
485
|
+
}
|
|
507
486
|
};
|
|
508
487
|
}
|
|
509
488
|
function convertNullabilityToDataConstraint(prop) {
|
|
@@ -531,7 +510,17 @@ function convertNullabilityToDataConstraint(prop) {
|
|
|
531
510
|
nullabilityV2: prop.nullability
|
|
532
511
|
};
|
|
533
512
|
}
|
|
534
|
-
|
|
513
|
+
|
|
514
|
+
// src/conversion/toConjure/distributeTypeHelper.ts
|
|
515
|
+
function distributeTypeHelper(type) {
|
|
516
|
+
return {
|
|
517
|
+
type,
|
|
518
|
+
[type]: {}
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// src/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.ts
|
|
523
|
+
function propertyTypeTypeToOntologyIrType(type) {
|
|
535
524
|
switch (true) {
|
|
536
525
|
case (typeof type === "object" && "markingType" in type):
|
|
537
526
|
return {
|
|
@@ -554,14 +543,14 @@ function convertType(type) {
|
|
|
554
543
|
},
|
|
555
544
|
typeClasses: [],
|
|
556
545
|
aliases: [],
|
|
557
|
-
fieldType:
|
|
546
|
+
fieldType: propertyTypeTypeToOntologyIrType(fieldTypeDefinition)
|
|
558
547
|
};
|
|
559
548
|
} else {
|
|
560
549
|
if ("fieldType" in fieldTypeDefinition) {
|
|
561
550
|
field = {
|
|
562
551
|
...fieldTypeDefinition,
|
|
563
552
|
apiName: key,
|
|
564
|
-
fieldType:
|
|
553
|
+
fieldType: propertyTypeTypeToOntologyIrType(fieldTypeDefinition.fieldType),
|
|
565
554
|
typeClasses: fieldTypeDefinition.typeClasses ?? [],
|
|
566
555
|
aliases: fieldTypeDefinition.aliases ?? []
|
|
567
556
|
};
|
|
@@ -574,7 +563,7 @@ function convertType(type) {
|
|
|
574
563
|
},
|
|
575
564
|
typeClasses: [],
|
|
576
565
|
aliases: [],
|
|
577
|
-
fieldType:
|
|
566
|
+
fieldType: propertyTypeTypeToOntologyIrType(fieldTypeDefinition)
|
|
578
567
|
};
|
|
579
568
|
}
|
|
580
569
|
}
|
|
@@ -635,187 +624,415 @@ function convertType(type) {
|
|
|
635
624
|
return distributeTypeHelper(type);
|
|
636
625
|
}
|
|
637
626
|
}
|
|
638
|
-
function distributeTypeHelper(type) {
|
|
639
|
-
return {
|
|
640
|
-
type,
|
|
641
|
-
[type]: {}
|
|
642
|
-
};
|
|
643
|
-
}
|
|
644
627
|
|
|
645
|
-
// src/
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
628
|
+
// src/conversion/toMarketplace/convertSpt.ts
|
|
629
|
+
function convertSpt({
|
|
630
|
+
type,
|
|
631
|
+
array,
|
|
632
|
+
description,
|
|
633
|
+
apiName,
|
|
634
|
+
displayName,
|
|
635
|
+
visibility,
|
|
636
|
+
gothamMapping,
|
|
637
|
+
typeClasses,
|
|
638
|
+
valueType,
|
|
639
|
+
nullability
|
|
640
|
+
}) {
|
|
641
|
+
const dataConstraint = convertNullabilityToDataConstraint({
|
|
642
|
+
type,
|
|
643
|
+
nullability
|
|
644
|
+
});
|
|
645
|
+
return {
|
|
646
|
+
apiName,
|
|
647
|
+
displayMetadata: {
|
|
648
|
+
displayName: displayName ?? apiName,
|
|
649
|
+
visibility: visibility ?? "NORMAL",
|
|
650
|
+
description
|
|
651
|
+
},
|
|
652
|
+
type: array ? {
|
|
653
|
+
type: "array",
|
|
654
|
+
array: {
|
|
655
|
+
subtype: propertyTypeTypeToOntologyIrType(type)
|
|
656
|
+
}
|
|
657
|
+
} : propertyTypeTypeToOntologyIrType(type),
|
|
658
|
+
aliases: [],
|
|
659
|
+
baseFormatter: void 0,
|
|
660
|
+
dataConstraints: dataConstraint,
|
|
661
|
+
gothamMapping,
|
|
662
|
+
indexedForSearch: true,
|
|
663
|
+
typeClasses: typeClasses ?? [],
|
|
664
|
+
valueType: valueType === void 0 ? void 0 : {
|
|
665
|
+
apiName: valueType.apiName,
|
|
666
|
+
version: valueType.version,
|
|
667
|
+
packageNamespace: valueType.packageNamespace,
|
|
668
|
+
displayMetadata: valueType.displayMetadata
|
|
669
|
+
}
|
|
678
670
|
};
|
|
679
|
-
try {
|
|
680
|
-
await body();
|
|
681
|
-
} catch (e) {
|
|
682
|
-
console.error("Unexpected error while processing the body of the ontology", e);
|
|
683
|
-
throw e;
|
|
684
|
-
}
|
|
685
|
-
if (outputDir) {
|
|
686
|
-
writeStaticObjects(outputDir);
|
|
687
|
-
}
|
|
688
|
-
if (dependencyFile) {
|
|
689
|
-
writeDependencyFile(dependencyFile);
|
|
690
|
-
}
|
|
691
|
-
return convertToWireOntologyIr(ontologyDefinition);
|
|
692
671
|
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
672
|
+
|
|
673
|
+
// src/conversion/toMarketplace/convertInterface.ts
|
|
674
|
+
function convertInterface(interfaceType) {
|
|
675
|
+
const {
|
|
676
|
+
__type,
|
|
677
|
+
...other
|
|
678
|
+
} = interfaceType;
|
|
679
|
+
return {
|
|
680
|
+
...other,
|
|
681
|
+
propertiesV2: Object.fromEntries(Object.values(interfaceType.propertiesV2).map((spt) => [spt.sharedPropertyType.apiName, {
|
|
682
|
+
required: spt.required,
|
|
683
|
+
sharedPropertyType: convertSpt(spt.sharedPropertyType)
|
|
684
|
+
}])),
|
|
685
|
+
displayMetadata: {
|
|
686
|
+
displayName: interfaceType.displayMetadata.displayName,
|
|
687
|
+
description: interfaceType.displayMetadata.description,
|
|
688
|
+
icon: interfaceType.displayMetadata.icon ?? {
|
|
689
|
+
type: "blueprint",
|
|
690
|
+
blueprint: {
|
|
691
|
+
color: "#4C90F0",
|
|
692
|
+
locator: "layout-hierarchy"
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
},
|
|
696
|
+
extendsInterfaces: interfaceType.extendsInterfaces.map((i) => i.apiName),
|
|
697
|
+
// these are omitted from our internal types but we need to re-add them for the final json
|
|
698
|
+
properties: [],
|
|
699
|
+
// TODO(mwalther): Support propertiesV3
|
|
700
|
+
propertiesV3: {}
|
|
702
701
|
};
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
// src/conversion/toMarketplace/convertCardinality.ts
|
|
705
|
+
function convertCardinality(cardinality) {
|
|
706
|
+
if (cardinality === "OneToMany" || cardinality === void 0) {
|
|
707
|
+
return "ONE_TO_MANY";
|
|
707
708
|
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
if (fs__namespace.existsSync(currentTypeDirPath)) {
|
|
711
|
-
fs__namespace.rmSync(currentTypeDirPath, {
|
|
712
|
-
recursive: true,
|
|
713
|
-
force: true
|
|
714
|
-
});
|
|
715
|
-
}
|
|
716
|
-
fs__namespace.mkdirSync(currentTypeDirPath, {
|
|
717
|
-
recursive: true
|
|
718
|
-
});
|
|
719
|
-
});
|
|
720
|
-
const topLevelExportStatements = [];
|
|
721
|
-
Object.entries(ontologyDefinition).forEach(([ontologyTypeEnumKey, entities]) => {
|
|
722
|
-
const typeDirName = typeDirs[ontologyTypeEnumKey];
|
|
723
|
-
const typeDirPath = path2__namespace.join(codegenDir, typeDirName);
|
|
724
|
-
const entityModuleNames = [];
|
|
725
|
-
Object.entries(entities).forEach(([apiName, entity]) => {
|
|
726
|
-
const entityFileNameBase = camel(withoutNamespace(apiName)) + (ontologyTypeEnumKey === OntologyEntityTypeEnum.VALUE_TYPE ? "ValueType" : "");
|
|
727
|
-
const filePath = path2__namespace.join(typeDirPath, `${entityFileNameBase}.ts`);
|
|
728
|
-
const entityTypeName = getEntityTypeName(ontologyTypeEnumKey);
|
|
729
|
-
const entityJSON = JSON.stringify(entity, null, 2).replace(/("__type"\s*:\s*)"([^"]*)"/g, (_, prefix, value) => `${prefix}OntologyEntityTypeEnum.${value}`);
|
|
730
|
-
const content = `
|
|
731
|
-
import { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';
|
|
732
|
-
import type { ${entityTypeName} } from '@osdk/maker';
|
|
709
|
+
return "ONE_TO_ONE";
|
|
710
|
+
}
|
|
733
711
|
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
712
|
+
// src/conversion/toMarketplace/convertLink.ts
|
|
713
|
+
function convertLink(linkType) {
|
|
714
|
+
let definition;
|
|
715
|
+
let datasource = void 0;
|
|
716
|
+
if ("one" in linkType) {
|
|
717
|
+
definition = {
|
|
718
|
+
type: "oneToMany",
|
|
719
|
+
oneToMany: {
|
|
720
|
+
cardinalityHint: convertCardinality(linkType.cardinality),
|
|
721
|
+
manyToOneLinkMetadata: linkType.toMany.metadata,
|
|
722
|
+
objectTypeRidManySide: linkType.toMany.object.apiName,
|
|
723
|
+
objectTypeRidOneSide: linkType.one.object.apiName,
|
|
724
|
+
oneToManyLinkMetadata: linkType.one.metadata,
|
|
725
|
+
oneSidePrimaryKeyToManySidePropertyMapping: [{
|
|
726
|
+
from: {
|
|
727
|
+
apiName: linkType.one.object.primaryKeyPropertyApiName,
|
|
728
|
+
object: linkType.one.object.apiName
|
|
729
|
+
},
|
|
730
|
+
to: {
|
|
731
|
+
apiName: linkType.manyForeignKeyProperty,
|
|
732
|
+
object: linkType.toMany.object.apiName
|
|
733
|
+
}
|
|
734
|
+
}]
|
|
735
|
+
}
|
|
736
|
+
};
|
|
737
|
+
} else {
|
|
738
|
+
definition = {
|
|
739
|
+
type: "manyToMany",
|
|
740
|
+
manyToMany: {
|
|
741
|
+
objectTypeAToBLinkMetadata: linkType.many.metadata,
|
|
742
|
+
objectTypeBToALinkMetadata: linkType.toMany.metadata,
|
|
743
|
+
objectTypeRidA: linkType.many.object.apiName,
|
|
744
|
+
objectTypeRidB: linkType.toMany.object.apiName,
|
|
745
|
+
peeringMetadata: void 0,
|
|
746
|
+
objectTypeAPrimaryKeyPropertyMapping: [{
|
|
747
|
+
from: {
|
|
748
|
+
apiName: linkType.many.object.primaryKeyPropertyApiName,
|
|
749
|
+
object: linkType.many.object.apiName
|
|
750
|
+
},
|
|
751
|
+
to: {
|
|
752
|
+
apiName: linkType.many.object.primaryKeyPropertyApiName,
|
|
753
|
+
object: linkType.many.object.apiName
|
|
754
|
+
}
|
|
755
|
+
}],
|
|
756
|
+
objectTypeBPrimaryKeyPropertyMapping: [{
|
|
757
|
+
from: {
|
|
758
|
+
apiName: linkType.toMany.object.primaryKeyPropertyApiName,
|
|
759
|
+
object: linkType.toMany.object.apiName
|
|
760
|
+
},
|
|
761
|
+
to: {
|
|
762
|
+
apiName: linkType.toMany.object.primaryKeyPropertyApiName,
|
|
763
|
+
object: linkType.toMany.object.apiName
|
|
764
|
+
}
|
|
765
|
+
}]
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
datasource = {
|
|
769
|
+
rid: "ri.ontology.main.datasource.link-".concat(linkType.apiName),
|
|
770
|
+
datasource: {
|
|
771
|
+
type: "dataset",
|
|
772
|
+
dataset: {
|
|
773
|
+
datasetRid: "link-".concat(linkType.apiName),
|
|
774
|
+
writebackDatasetRid: void 0,
|
|
775
|
+
objectTypeAPrimaryKeyMapping: [{
|
|
776
|
+
property: {
|
|
777
|
+
apiName: linkType.many.object.primaryKeyPropertyApiName,
|
|
778
|
+
object: linkType.many.object.apiName
|
|
779
|
+
},
|
|
780
|
+
column: linkType.many.object.primaryKeyPropertyApiName
|
|
781
|
+
}],
|
|
782
|
+
objectTypeBPrimaryKeyMapping: [{
|
|
783
|
+
property: {
|
|
784
|
+
apiName: linkType.toMany.object.primaryKeyPropertyApiName,
|
|
785
|
+
object: linkType.toMany.object.apiName
|
|
786
|
+
},
|
|
787
|
+
column: linkType.toMany.object.primaryKeyPropertyApiName
|
|
788
|
+
}]
|
|
789
|
+
}
|
|
790
|
+
},
|
|
791
|
+
editsConfiguration: {
|
|
792
|
+
onlyAllowPrivilegedEdits: false
|
|
793
|
+
},
|
|
794
|
+
redacted: linkType.redacted
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
return {
|
|
798
|
+
linkType: {
|
|
799
|
+
definition,
|
|
800
|
+
id: cleanAndValidateLinkTypeId(linkType.apiName),
|
|
801
|
+
status: linkType.status ?? {
|
|
802
|
+
type: "active",
|
|
803
|
+
active: {}
|
|
804
|
+
},
|
|
805
|
+
redacted: linkType.redacted ?? false
|
|
806
|
+
},
|
|
807
|
+
datasources: datasource !== void 0 ? [datasource] : [],
|
|
808
|
+
entityMetadata: {
|
|
809
|
+
arePatchesEnabled: linkType.editsEnabled ?? false
|
|
745
810
|
}
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
// src/conversion/toMarketplace/convertDatasourceDefinition.ts
|
|
815
|
+
function convertDatasourceDefinition(objectType, properties) {
|
|
816
|
+
switch (objectType.datasource?.type) {
|
|
817
|
+
case "stream":
|
|
818
|
+
const window = objectType.datasource.retentionPeriod;
|
|
819
|
+
const retentionPolicy = window ? {
|
|
820
|
+
type: "time",
|
|
821
|
+
time: {
|
|
822
|
+
window
|
|
823
|
+
}
|
|
824
|
+
} : {
|
|
825
|
+
type: "none",
|
|
826
|
+
none: {}
|
|
827
|
+
};
|
|
828
|
+
const propertyMapping = Object.fromEntries(properties.map((prop) => [prop.apiName, prop.apiName]));
|
|
829
|
+
return {
|
|
830
|
+
type: "streamV2",
|
|
831
|
+
streamV2: {
|
|
832
|
+
streamLocator: objectType.apiName,
|
|
833
|
+
propertyMapping,
|
|
834
|
+
retentionPolicy,
|
|
835
|
+
propertySecurityGroups: void 0
|
|
836
|
+
}
|
|
837
|
+
};
|
|
838
|
+
case "restrictedView":
|
|
839
|
+
return {
|
|
840
|
+
type: "restrictedViewV2",
|
|
841
|
+
restrictedViewV2: {
|
|
842
|
+
restrictedViewRid: objectType.apiName,
|
|
843
|
+
propertyMapping: buildPropertyMapping(properties)
|
|
844
|
+
}
|
|
845
|
+
};
|
|
846
|
+
case "dataset":
|
|
847
|
+
default:
|
|
848
|
+
return {
|
|
849
|
+
type: "datasetV2",
|
|
850
|
+
datasetV2: {
|
|
851
|
+
datasetRid: objectType.apiName,
|
|
852
|
+
propertyMapping: buildPropertyMapping(properties)
|
|
853
|
+
}
|
|
854
|
+
};
|
|
753
855
|
}
|
|
754
856
|
}
|
|
755
|
-
function
|
|
857
|
+
function buildPropertyMapping(properties) {
|
|
858
|
+
return Object.fromEntries(properties.map((prop) => {
|
|
859
|
+
if (prop.editOnly) {
|
|
860
|
+
return [prop.apiName, {
|
|
861
|
+
type: "editOnly",
|
|
862
|
+
editOnly: {}
|
|
863
|
+
}];
|
|
864
|
+
}
|
|
865
|
+
if (typeof prop.type === "object" && prop.type?.type === "struct") {
|
|
866
|
+
const structMapping = {
|
|
867
|
+
type: "struct",
|
|
868
|
+
struct: {
|
|
869
|
+
column: prop.apiName,
|
|
870
|
+
mapping: Object.fromEntries(Object.keys(prop.type.structDefinition).map((fieldName) => [fieldName, {
|
|
871
|
+
apiName: fieldName,
|
|
872
|
+
mappings: {}
|
|
873
|
+
}]))
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
return [prop.apiName, structMapping];
|
|
877
|
+
}
|
|
878
|
+
return [prop.apiName, {
|
|
879
|
+
type: "column",
|
|
880
|
+
column: prop.apiName
|
|
881
|
+
}];
|
|
882
|
+
}));
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
// src/api/propertyConversionUtils.ts
|
|
886
|
+
var defaultTypeClasses = [{
|
|
887
|
+
kind: "render_hint",
|
|
888
|
+
name: "SELECTABLE"
|
|
889
|
+
}, {
|
|
890
|
+
kind: "render_hint",
|
|
891
|
+
name: "SORTABLE"
|
|
892
|
+
}];
|
|
893
|
+
function shouldNotHaveRenderHints(type) {
|
|
894
|
+
return ["struct", "mediaReference", "geotimeSeries"].includes(getPropertyTypeName(type));
|
|
895
|
+
}
|
|
896
|
+
function hasRenderHints(typeClasses) {
|
|
897
|
+
return (typeClasses ?? []).some((tc) => tc.kind.toLowerCase() === "render_hint");
|
|
898
|
+
}
|
|
899
|
+
function getPropertyTypeName(type) {
|
|
900
|
+
return typeof type === "object" ? type.type : type;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
// src/conversion/toMarketplace/convertValueType.ts
|
|
904
|
+
function convertValueType(valueType) {
|
|
905
|
+
return {
|
|
906
|
+
apiName: valueType.apiName,
|
|
907
|
+
version: valueType.version,
|
|
908
|
+
packageNamespace: valueType.packageNamespace,
|
|
909
|
+
displayMetadata: valueType.displayMetadata
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
// src/conversion/toMarketplace/convertDataConstraintToDataConstraints.ts
|
|
914
|
+
function convertDataConstraintToDataConstraints(dc) {
|
|
756
915
|
return {
|
|
757
|
-
|
|
916
|
+
propertyTypeConstraints: [{
|
|
917
|
+
constraints: dataConstraintToPropertyTypeDataConstraint(dc)
|
|
918
|
+
// known limitation: structs don't carry field-level data constraint failure messages
|
|
919
|
+
}]
|
|
758
920
|
};
|
|
759
921
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
922
|
+
|
|
923
|
+
// src/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.ts
|
|
924
|
+
function dataConstraintToPropertyTypeDataConstraint(dc) {
|
|
925
|
+
switch (dc.type) {
|
|
926
|
+
case "array":
|
|
927
|
+
return {
|
|
928
|
+
...dc
|
|
929
|
+
};
|
|
930
|
+
case "boolean":
|
|
931
|
+
return {
|
|
932
|
+
...dc
|
|
933
|
+
};
|
|
934
|
+
case "binary":
|
|
935
|
+
throw new Error("Binary type constraints are not supported");
|
|
936
|
+
case "date":
|
|
937
|
+
return {
|
|
938
|
+
...dc
|
|
939
|
+
};
|
|
940
|
+
case "decimal":
|
|
941
|
+
return {
|
|
942
|
+
...dc
|
|
943
|
+
};
|
|
944
|
+
case "double":
|
|
945
|
+
return {
|
|
946
|
+
...dc
|
|
947
|
+
};
|
|
948
|
+
case "float":
|
|
949
|
+
return {
|
|
950
|
+
...dc
|
|
951
|
+
};
|
|
952
|
+
case "integer":
|
|
953
|
+
return {
|
|
954
|
+
...dc
|
|
955
|
+
};
|
|
956
|
+
case "long":
|
|
957
|
+
return {
|
|
958
|
+
...dc
|
|
959
|
+
};
|
|
960
|
+
case "map":
|
|
961
|
+
throw new Error("Map type constraints are not supported");
|
|
962
|
+
case "nullable":
|
|
963
|
+
throw new Error("Nullable constraints are not supported");
|
|
964
|
+
case "short":
|
|
965
|
+
return {
|
|
966
|
+
...dc
|
|
967
|
+
};
|
|
968
|
+
case "string":
|
|
969
|
+
return {
|
|
970
|
+
...dc
|
|
971
|
+
};
|
|
972
|
+
case "struct":
|
|
973
|
+
return {
|
|
974
|
+
type: "struct",
|
|
975
|
+
struct: {
|
|
976
|
+
elementConstraints: Object.fromEntries(Object.entries(dc.struct.elementConstraints).map(([field, constraint]) => [field, convertDataConstraintToDataConstraints(constraint)]))
|
|
977
|
+
}
|
|
978
|
+
};
|
|
979
|
+
case "structV2":
|
|
980
|
+
throw new Error("StructV2 constraints are not supported");
|
|
981
|
+
case "timestamp":
|
|
982
|
+
return {
|
|
983
|
+
...dc
|
|
984
|
+
};
|
|
985
|
+
default:
|
|
986
|
+
throw new Error(`Unknown DataConstraint type: ${dc.type}`);
|
|
987
|
+
}
|
|
776
988
|
}
|
|
777
|
-
|
|
989
|
+
|
|
990
|
+
// src/conversion/toMarketplace/convertValueTypeDataConstraints.ts
|
|
991
|
+
function convertValueTypeDataConstraints(dataConstraints) {
|
|
992
|
+
if (dataConstraints.length === 0) {
|
|
993
|
+
return void 0;
|
|
994
|
+
}
|
|
995
|
+
const propertyTypeConstraints = dataConstraints.map((constraint) => ({
|
|
996
|
+
constraints: dataConstraintToPropertyTypeDataConstraint(constraint.constraint.constraint),
|
|
997
|
+
failureMessage: constraint.constraint.failureMessage
|
|
998
|
+
}));
|
|
778
999
|
return {
|
|
779
|
-
|
|
780
|
-
importedOntology: convertToWireBlockData(importedTypes),
|
|
781
|
-
valueTypes: convertOntologyToValueTypeIr(ontology),
|
|
782
|
-
importedValueTypes: convertOntologyToValueTypeIr(importedTypes)
|
|
1000
|
+
propertyTypeConstraints
|
|
783
1001
|
};
|
|
784
1002
|
}
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
})),
|
|
814
|
-
linkTypes: {},
|
|
815
|
-
objectTypes: {}
|
|
816
|
-
}
|
|
1003
|
+
|
|
1004
|
+
// src/conversion/toMarketplace/convertObjectPropertyType.ts
|
|
1005
|
+
function convertObjectPropertyType(property) {
|
|
1006
|
+
const apiName = namespace + property.apiName;
|
|
1007
|
+
!(!shouldNotHaveRenderHints(property.type) || !hasRenderHints(property.typeClasses)) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Property type ${apiName} of type '${getPropertyTypeName(property.type)}' should not have render hints`) : invariant5__default.default(false) : void 0;
|
|
1008
|
+
const output = {
|
|
1009
|
+
apiName: property.apiName,
|
|
1010
|
+
sharedPropertyTypeApiName: property.sharedPropertyType?.apiName,
|
|
1011
|
+
displayMetadata: {
|
|
1012
|
+
displayName: property.displayName,
|
|
1013
|
+
description: property.description,
|
|
1014
|
+
visibility: property.visibility ?? "NORMAL"
|
|
1015
|
+
},
|
|
1016
|
+
indexedForSearch: property.indexedForSearch ?? true,
|
|
1017
|
+
ruleSetBinding: void 0,
|
|
1018
|
+
baseFormatter: property.baseFormatter,
|
|
1019
|
+
type: property.array ? {
|
|
1020
|
+
type: "array",
|
|
1021
|
+
array: {
|
|
1022
|
+
subtype: propertyTypeTypeToOntologyIrType(property.type)
|
|
1023
|
+
}
|
|
1024
|
+
} : propertyTypeTypeToOntologyIrType(property.type),
|
|
1025
|
+
typeClasses: property.typeClasses ?? (shouldNotHaveRenderHints(property.type) ? [] : defaultTypeClasses),
|
|
1026
|
+
status: convertObjectStatus(property.status),
|
|
1027
|
+
inlineAction: void 0,
|
|
1028
|
+
dataConstraints: property.valueType ? convertValueTypeDataConstraints(property.valueType.constraints) : convertNullabilityToDataConstraint(property),
|
|
1029
|
+
sharedPropertyTypeRid: property.sharedPropertyType?.apiName,
|
|
1030
|
+
valueType: property.valueType ? convertValueType(property.valueType) : void 0
|
|
817
1031
|
};
|
|
1032
|
+
return output;
|
|
818
1033
|
}
|
|
1034
|
+
|
|
1035
|
+
// src/conversion/toMarketplace/convertObject.ts
|
|
819
1036
|
function convertObject(objectType) {
|
|
820
1037
|
const propertyDatasources = (objectType.properties ?? []).flatMap((prop) => extractPropertyDatasource(prop, objectType.apiName));
|
|
821
1038
|
const classificationGroupMarkingNames = extractMarkingGroups(objectType.properties ?? [], "CBAC");
|
|
@@ -841,7 +1058,7 @@ function convertObject(objectType) {
|
|
|
841
1058
|
visibility: objectType.visibility ?? "NORMAL"
|
|
842
1059
|
},
|
|
843
1060
|
primaryKeys: [objectType.primaryKeyPropertyApiName],
|
|
844
|
-
propertyTypes: Object.fromEntries(objectType.properties?.map((val) => [val.apiName,
|
|
1061
|
+
propertyTypes: Object.fromEntries(objectType.properties?.map((val) => [val.apiName, convertObjectPropertyType(val)]) ?? []),
|
|
845
1062
|
titlePropertyTypeRid: objectType.titlePropertyApiName,
|
|
846
1063
|
apiName: objectType.apiName,
|
|
847
1064
|
status: convertObjectStatus(objectType.status),
|
|
@@ -856,104 +1073,11 @@ function convertObject(objectType) {
|
|
|
856
1073
|
})),
|
|
857
1074
|
allImplementsInterfaces: {}
|
|
858
1075
|
},
|
|
859
|
-
datasources: [...propertyDatasources, objectDatasource],
|
|
860
|
-
entityMetadata: {
|
|
861
|
-
arePatchesEnabled: objectType.editsEnabled ?? false
|
|
862
|
-
}
|
|
863
|
-
};
|
|
864
|
-
}
|
|
865
|
-
function extractPropertyDatasource(property, objectTypeApiName) {
|
|
866
|
-
if (!isExotic(property.type)) {
|
|
867
|
-
return [];
|
|
868
|
-
}
|
|
869
|
-
const identifier = objectTypeApiName + "." + property.apiName;
|
|
870
|
-
switch (property.type) {
|
|
871
|
-
case "geotimeSeries":
|
|
872
|
-
const geotimeDefinition = {
|
|
873
|
-
type: "geotimeSeries",
|
|
874
|
-
geotimeSeries: {
|
|
875
|
-
geotimeSeriesIntegrationRid: identifier,
|
|
876
|
-
properties: [property.apiName]
|
|
877
|
-
}
|
|
878
|
-
};
|
|
879
|
-
return [buildDatasource(property.apiName, geotimeDefinition)];
|
|
880
|
-
case "mediaReference":
|
|
881
|
-
const mediaSetDefinition = {
|
|
882
|
-
type: "mediaSetView",
|
|
883
|
-
mediaSetView: {
|
|
884
|
-
assumedMarkings: [],
|
|
885
|
-
mediaSetViewLocator: identifier,
|
|
886
|
-
properties: [property.apiName]
|
|
887
|
-
}
|
|
888
|
-
};
|
|
889
|
-
return [buildDatasource(property.apiName, mediaSetDefinition)];
|
|
890
|
-
default:
|
|
891
|
-
return [];
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
function buildDatasource(apiName, definition, classificationMarkingGroupName, mandatoryMarkingGroupName) {
|
|
895
|
-
const needsSecurity = classificationMarkingGroupName !== void 0 || mandatoryMarkingGroupName !== void 0;
|
|
896
|
-
const securityConfig = needsSecurity ? {
|
|
897
|
-
classificationConstraint: classificationMarkingGroupName ? {
|
|
898
|
-
markingGroupName: classificationMarkingGroupName
|
|
899
|
-
} : void 0,
|
|
900
|
-
markingConstraint: mandatoryMarkingGroupName ? {
|
|
901
|
-
markingGroupName: mandatoryMarkingGroupName
|
|
902
|
-
} : void 0
|
|
903
|
-
} : void 0;
|
|
904
|
-
return {
|
|
905
|
-
rid: "ri.ontology.main.datasource.".concat(apiName),
|
|
906
|
-
datasource: definition,
|
|
907
|
-
editsConfiguration: {
|
|
908
|
-
onlyAllowPrivilegedEdits: false
|
|
909
|
-
},
|
|
910
|
-
redacted: false,
|
|
911
|
-
...securityConfig !== void 0 && {
|
|
912
|
-
dataSecurity: securityConfig
|
|
913
|
-
}
|
|
914
|
-
};
|
|
915
|
-
}
|
|
916
|
-
function convertDatasourceDefinition(objectType, properties) {
|
|
917
|
-
switch (objectType.datasource?.type) {
|
|
918
|
-
case "stream":
|
|
919
|
-
const window = objectType.datasource.retentionPeriod;
|
|
920
|
-
const retentionPolicy = window ? {
|
|
921
|
-
type: "time",
|
|
922
|
-
time: {
|
|
923
|
-
window
|
|
924
|
-
}
|
|
925
|
-
} : {
|
|
926
|
-
type: "none",
|
|
927
|
-
none: {}
|
|
928
|
-
};
|
|
929
|
-
const propertyMapping = Object.fromEntries(properties.map((prop) => [prop.apiName, prop.apiName]));
|
|
930
|
-
return {
|
|
931
|
-
type: "streamV2",
|
|
932
|
-
streamV2: {
|
|
933
|
-
streamLocator: objectType.apiName,
|
|
934
|
-
propertyMapping,
|
|
935
|
-
retentionPolicy,
|
|
936
|
-
propertySecurityGroups: void 0
|
|
937
|
-
}
|
|
938
|
-
};
|
|
939
|
-
case "restrictedView":
|
|
940
|
-
return {
|
|
941
|
-
type: "restrictedViewV2",
|
|
942
|
-
restrictedViewV2: {
|
|
943
|
-
restrictedViewRid: objectType.apiName,
|
|
944
|
-
propertyMapping: buildPropertyMapping(properties)
|
|
945
|
-
}
|
|
946
|
-
};
|
|
947
|
-
case "dataset":
|
|
948
|
-
default:
|
|
949
|
-
return {
|
|
950
|
-
type: "datasetV2",
|
|
951
|
-
datasetV2: {
|
|
952
|
-
datasetRid: objectType.apiName,
|
|
953
|
-
propertyMapping: buildPropertyMapping(properties)
|
|
954
|
-
}
|
|
955
|
-
};
|
|
956
|
-
}
|
|
1076
|
+
datasources: [...propertyDatasources, objectDatasource],
|
|
1077
|
+
entityMetadata: {
|
|
1078
|
+
arePatchesEnabled: objectType.editsEnabled ?? false
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
957
1081
|
}
|
|
958
1082
|
function extractMarkingGroups(properties, markingType) {
|
|
959
1083
|
return properties.map((prop) => {
|
|
@@ -963,159 +1087,261 @@ function extractMarkingGroups(properties, markingType) {
|
|
|
963
1087
|
return void 0;
|
|
964
1088
|
}).filter((val) => val !== void 0);
|
|
965
1089
|
}
|
|
966
|
-
function
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
column: prop.apiName,
|
|
979
|
-
mapping: Object.fromEntries(Object.keys(prop.type.structDefinition).map((fieldName) => [fieldName, {
|
|
980
|
-
apiName: fieldName,
|
|
981
|
-
mappings: {}
|
|
982
|
-
}]))
|
|
1090
|
+
function extractPropertyDatasource(property, objectTypeApiName) {
|
|
1091
|
+
if (!isExotic(property.type)) {
|
|
1092
|
+
return [];
|
|
1093
|
+
}
|
|
1094
|
+
const identifier = objectTypeApiName + "." + property.apiName;
|
|
1095
|
+
switch (property.type) {
|
|
1096
|
+
case "geotimeSeries":
|
|
1097
|
+
const geotimeDefinition = {
|
|
1098
|
+
type: "geotimeSeries",
|
|
1099
|
+
geotimeSeries: {
|
|
1100
|
+
geotimeSeriesIntegrationRid: identifier,
|
|
1101
|
+
properties: [property.apiName]
|
|
983
1102
|
}
|
|
984
1103
|
};
|
|
985
|
-
return [
|
|
1104
|
+
return [buildDatasource(property.apiName, geotimeDefinition)];
|
|
1105
|
+
case "mediaReference":
|
|
1106
|
+
const mediaSetDefinition = {
|
|
1107
|
+
type: "mediaSetView",
|
|
1108
|
+
mediaSetView: {
|
|
1109
|
+
assumedMarkings: [],
|
|
1110
|
+
mediaSetViewLocator: identifier,
|
|
1111
|
+
properties: [property.apiName]
|
|
1112
|
+
}
|
|
1113
|
+
};
|
|
1114
|
+
return [buildDatasource(property.apiName, mediaSetDefinition)];
|
|
1115
|
+
default:
|
|
1116
|
+
return [];
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
// src/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.ts
|
|
1121
|
+
function convertOntologyDefinitionToWireBlockData(ontology) {
|
|
1122
|
+
return {
|
|
1123
|
+
objectTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.OBJECT_TYPE]).map(([apiName, objectType]) => {
|
|
1124
|
+
return [apiName, convertObject(objectType)];
|
|
1125
|
+
})),
|
|
1126
|
+
sharedPropertyTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]).map(([apiName, spt]) => [apiName, {
|
|
1127
|
+
sharedPropertyType: convertSpt(spt)
|
|
1128
|
+
}])),
|
|
1129
|
+
interfaceTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.INTERFACE_TYPE]).map(([apiName, interfaceType]) => {
|
|
1130
|
+
return [apiName, {
|
|
1131
|
+
interfaceType: convertInterface(interfaceType)
|
|
1132
|
+
}];
|
|
1133
|
+
})),
|
|
1134
|
+
linkTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.LINK_TYPE]).map(([id, link]) => {
|
|
1135
|
+
return [id, convertLink(link)];
|
|
1136
|
+
})),
|
|
1137
|
+
actionTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.ACTION_TYPE]).map(([apiName, action]) => {
|
|
1138
|
+
return [apiName, convertAction(action)];
|
|
1139
|
+
})),
|
|
1140
|
+
blockPermissionInformation: {
|
|
1141
|
+
actionTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.ACTION_TYPE]).filter(([apiName, action]) => action.validation).map(([apiName, action]) => {
|
|
1142
|
+
return [apiName, {
|
|
1143
|
+
restrictionStatus: {
|
|
1144
|
+
hasRolesApplied: true,
|
|
1145
|
+
ontologyPackageRid: null,
|
|
1146
|
+
publicProject: false
|
|
1147
|
+
}
|
|
1148
|
+
}];
|
|
1149
|
+
})),
|
|
1150
|
+
linkTypes: {},
|
|
1151
|
+
objectTypes: {}
|
|
986
1152
|
}
|
|
987
|
-
|
|
988
|
-
type: "column",
|
|
989
|
-
column: prop.apiName
|
|
990
|
-
}];
|
|
991
|
-
}));
|
|
1153
|
+
};
|
|
992
1154
|
}
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
visibility: property.visibility ?? "NORMAL"
|
|
1155
|
+
|
|
1156
|
+
// src/conversion/toMarketplace/convertValueTypesToIr.ts
|
|
1157
|
+
function convertValueTypesToIr(valueTypes) {
|
|
1158
|
+
return Object.values(valueTypes).map((definitions) => ({
|
|
1159
|
+
metadata: {
|
|
1160
|
+
apiName: definitions[0].apiName,
|
|
1161
|
+
packageNamespace: definitions[0].packageNamespace,
|
|
1162
|
+
displayMetadata: definitions[0].displayMetadata,
|
|
1163
|
+
status: definitions[0].status
|
|
1003
1164
|
},
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
valueType: property.valueType ? convertValueType(property.valueType) : void 0
|
|
1165
|
+
// TODO(dpaquin): instead of deduping here, we should refactor the value type types from arrays to maps
|
|
1166
|
+
versions: Array.from(new Map(definitions.map((definition) => [definition.version, definition])).values()).map((definition) => ({
|
|
1167
|
+
version: definition.version,
|
|
1168
|
+
baseType: definition.baseType,
|
|
1169
|
+
constraints: definition.constraints,
|
|
1170
|
+
exampleValues: definition.exampleValues
|
|
1171
|
+
}))
|
|
1172
|
+
}));
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
// src/conversion/toMarketplace/convertOntologyToValueTypeIr.ts
|
|
1176
|
+
function convertOntologyToValueTypeIr(ontology) {
|
|
1177
|
+
return {
|
|
1178
|
+
valueTypes: convertValueTypesToIr(ontology[OntologyEntityTypeEnum.VALUE_TYPE])
|
|
1019
1179
|
};
|
|
1020
|
-
return output;
|
|
1021
1180
|
}
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
},
|
|
1070
|
-
to: {
|
|
1071
|
-
apiName: linkType.toMany.object.primaryKeyPropertyApiName,
|
|
1072
|
-
object: linkType.toMany.object.apiName
|
|
1073
|
-
}
|
|
1074
|
-
}]
|
|
1075
|
-
}
|
|
1076
|
-
};
|
|
1077
|
-
datasource = {
|
|
1078
|
-
rid: "ri.ontology.main.datasource.link-".concat(linkType.apiName),
|
|
1079
|
-
datasource: {
|
|
1080
|
-
type: "dataset",
|
|
1081
|
-
dataset: {
|
|
1082
|
-
datasetRid: "link-".concat(linkType.apiName),
|
|
1083
|
-
writebackDatasetRid: void 0,
|
|
1084
|
-
objectTypeAPrimaryKeyMapping: [{
|
|
1085
|
-
property: {
|
|
1086
|
-
apiName: linkType.many.object.primaryKeyPropertyApiName,
|
|
1087
|
-
object: linkType.many.object.apiName
|
|
1088
|
-
},
|
|
1089
|
-
column: linkType.many.object.primaryKeyPropertyApiName
|
|
1090
|
-
}],
|
|
1091
|
-
objectTypeBPrimaryKeyMapping: [{
|
|
1092
|
-
property: {
|
|
1093
|
-
apiName: linkType.toMany.object.primaryKeyPropertyApiName,
|
|
1094
|
-
object: linkType.toMany.object.apiName
|
|
1095
|
-
},
|
|
1096
|
-
column: linkType.toMany.object.primaryKeyPropertyApiName
|
|
1097
|
-
}]
|
|
1098
|
-
}
|
|
1099
|
-
},
|
|
1100
|
-
editsConfiguration: {
|
|
1101
|
-
onlyAllowPrivilegedEdits: false
|
|
1102
|
-
},
|
|
1103
|
-
redacted: linkType.redacted
|
|
1104
|
-
};
|
|
1181
|
+
|
|
1182
|
+
// src/conversion/toMarketplace/convertOntologyDefinition.ts
|
|
1183
|
+
function convertOntologyDefinition(ontology) {
|
|
1184
|
+
return {
|
|
1185
|
+
ontology: convertOntologyDefinitionToWireBlockData(ontology),
|
|
1186
|
+
importedOntology: convertOntologyDefinitionToWireBlockData(importedTypes),
|
|
1187
|
+
valueTypes: convertOntologyToValueTypeIr(ontology),
|
|
1188
|
+
importedValueTypes: convertOntologyToValueTypeIr(importedTypes)
|
|
1189
|
+
};
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
// src/conversion/toMarketplace/getFormContentOrdering.ts
|
|
1193
|
+
function getFormContentOrdering(action, parameterOrdering) {
|
|
1194
|
+
if (!action.sections) return [];
|
|
1195
|
+
const parametersToSection = Object.fromEntries(Object.entries(action.sections).flatMap(([sectionId, section]) => section.parameters.map((param) => [param, sectionId])));
|
|
1196
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
1197
|
+
const formContentOrdering = [];
|
|
1198
|
+
parameterOrdering.forEach((param) => {
|
|
1199
|
+
if (param in parametersToSection && !seenIds.has(parametersToSection[param])) {
|
|
1200
|
+
formContentOrdering.push({
|
|
1201
|
+
type: "sectionId",
|
|
1202
|
+
sectionId: parametersToSection[param]
|
|
1203
|
+
});
|
|
1204
|
+
seenIds.add(parametersToSection[param]);
|
|
1205
|
+
} else if (!(param in parametersToSection)) {
|
|
1206
|
+
formContentOrdering.push({
|
|
1207
|
+
type: "parameterId",
|
|
1208
|
+
parameterId: param
|
|
1209
|
+
});
|
|
1210
|
+
seenIds.add(param);
|
|
1211
|
+
}
|
|
1212
|
+
});
|
|
1213
|
+
return formContentOrdering;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
// src/api/defineOntology.ts
|
|
1217
|
+
var ontologyDefinition;
|
|
1218
|
+
var importedTypes;
|
|
1219
|
+
var dependencies;
|
|
1220
|
+
var namespace;
|
|
1221
|
+
function updateOntology(entity) {
|
|
1222
|
+
if (entity.__type !== OntologyEntityTypeEnum.VALUE_TYPE) {
|
|
1223
|
+
ontologyDefinition[entity.__type][entity.apiName] = entity;
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1226
|
+
if (ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName] === void 0) {
|
|
1227
|
+
ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName] = [];
|
|
1105
1228
|
}
|
|
1229
|
+
ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName].push(entity);
|
|
1230
|
+
}
|
|
1231
|
+
async function defineOntology(ns, body, outputDir, dependencyFile) {
|
|
1232
|
+
namespace = ns;
|
|
1233
|
+
dependencies = {};
|
|
1234
|
+
ontologyDefinition = {
|
|
1235
|
+
OBJECT_TYPE: {},
|
|
1236
|
+
ACTION_TYPE: {},
|
|
1237
|
+
LINK_TYPE: {},
|
|
1238
|
+
INTERFACE_TYPE: {},
|
|
1239
|
+
SHARED_PROPERTY_TYPE: {},
|
|
1240
|
+
VALUE_TYPE: {}
|
|
1241
|
+
};
|
|
1242
|
+
importedTypes = {
|
|
1243
|
+
SHARED_PROPERTY_TYPE: {},
|
|
1244
|
+
OBJECT_TYPE: {},
|
|
1245
|
+
ACTION_TYPE: {},
|
|
1246
|
+
LINK_TYPE: {},
|
|
1247
|
+
INTERFACE_TYPE: {},
|
|
1248
|
+
VALUE_TYPE: {}
|
|
1249
|
+
};
|
|
1250
|
+
try {
|
|
1251
|
+
await body();
|
|
1252
|
+
} catch (e) {
|
|
1253
|
+
console.error("Unexpected error while processing the body of the ontology", e);
|
|
1254
|
+
throw e;
|
|
1255
|
+
}
|
|
1256
|
+
if (outputDir) {
|
|
1257
|
+
writeStaticObjects(outputDir);
|
|
1258
|
+
}
|
|
1259
|
+
if (dependencyFile) {
|
|
1260
|
+
writeDependencyFile(dependencyFile);
|
|
1261
|
+
}
|
|
1262
|
+
return convertOntologyDefinition(ontologyDefinition);
|
|
1263
|
+
}
|
|
1264
|
+
function writeStaticObjects(outputDir) {
|
|
1265
|
+
const codegenDir = path2__namespace.resolve(outputDir, "codegen");
|
|
1266
|
+
const typeDirs = {
|
|
1267
|
+
[OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: "shared-property-types",
|
|
1268
|
+
[OntologyEntityTypeEnum.ACTION_TYPE]: "action-types",
|
|
1269
|
+
[OntologyEntityTypeEnum.OBJECT_TYPE]: "object-types",
|
|
1270
|
+
[OntologyEntityTypeEnum.LINK_TYPE]: "link-types",
|
|
1271
|
+
[OntologyEntityTypeEnum.INTERFACE_TYPE]: "interface-types",
|
|
1272
|
+
[OntologyEntityTypeEnum.VALUE_TYPE]: "value-types"
|
|
1273
|
+
};
|
|
1274
|
+
if (!fs__namespace.existsSync(codegenDir)) {
|
|
1275
|
+
fs__namespace.mkdirSync(codegenDir, {
|
|
1276
|
+
recursive: true
|
|
1277
|
+
});
|
|
1278
|
+
}
|
|
1279
|
+
Object.values(typeDirs).forEach((typeDirNameFromMap) => {
|
|
1280
|
+
const currentTypeDirPath = path2__namespace.join(codegenDir, typeDirNameFromMap);
|
|
1281
|
+
if (fs__namespace.existsSync(currentTypeDirPath)) {
|
|
1282
|
+
fs__namespace.rmSync(currentTypeDirPath, {
|
|
1283
|
+
recursive: true,
|
|
1284
|
+
force: true
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
fs__namespace.mkdirSync(currentTypeDirPath, {
|
|
1288
|
+
recursive: true
|
|
1289
|
+
});
|
|
1290
|
+
});
|
|
1291
|
+
const topLevelExportStatements = [];
|
|
1292
|
+
Object.entries(ontologyDefinition).forEach(([ontologyTypeEnumKey, entities]) => {
|
|
1293
|
+
const typeDirName = typeDirs[ontologyTypeEnumKey];
|
|
1294
|
+
const typeDirPath = path2__namespace.join(codegenDir, typeDirName);
|
|
1295
|
+
const entityModuleNames = [];
|
|
1296
|
+
Object.entries(entities).forEach(([apiName, entity]) => {
|
|
1297
|
+
const entityFileNameBase = camel(withoutNamespace(apiName)) + (ontologyTypeEnumKey === OntologyEntityTypeEnum.VALUE_TYPE ? "ValueType" : "");
|
|
1298
|
+
const filePath = path2__namespace.join(typeDirPath, `${entityFileNameBase}.ts`);
|
|
1299
|
+
const entityTypeName = getEntityTypeName(ontologyTypeEnumKey);
|
|
1300
|
+
const entityJSON = JSON.stringify(entity, null, 2).replace(/("__type"\s*:\s*)"([^"]*)"/g, (_, prefix, value) => `${prefix}OntologyEntityTypeEnum.${value}`);
|
|
1301
|
+
const content = `
|
|
1302
|
+
import { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';
|
|
1303
|
+
import type { ${entityTypeName} } from '@osdk/maker';
|
|
1304
|
+
|
|
1305
|
+
const ${entityFileNameBase}_base: ${entityTypeName} = ${ontologyTypeEnumKey === "VALUE_TYPE" ? entityJSON.slice(1, -2) : entityJSON} as unknown as ${entityTypeName};
|
|
1306
|
+
|
|
1307
|
+
export const ${entityFileNameBase}: ${entityTypeName} = wrapWithProxy(${entityFileNameBase}_base);
|
|
1308
|
+
`;
|
|
1309
|
+
fs__namespace.writeFileSync(filePath, content, {
|
|
1310
|
+
flag: "w"
|
|
1311
|
+
});
|
|
1312
|
+
entityModuleNames.push(entityFileNameBase);
|
|
1313
|
+
});
|
|
1314
|
+
for (const entityModuleName of entityModuleNames) {
|
|
1315
|
+
topLevelExportStatements.push(`export { ${entityModuleName} } from "./codegen/${typeDirName}/${entityModuleName}.js";`);
|
|
1316
|
+
}
|
|
1317
|
+
});
|
|
1318
|
+
if (topLevelExportStatements.length > 0) {
|
|
1319
|
+
const mainIndexContent = dependencyInjectionString() + topLevelExportStatements.join("\n") + "\n";
|
|
1320
|
+
const mainIndexFilePath = path2__namespace.join(outputDir, "index.ts");
|
|
1321
|
+
fs__namespace.writeFileSync(mainIndexFilePath, mainIndexContent, {
|
|
1322
|
+
flag: "w"
|
|
1323
|
+
});
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
function buildDatasource(apiName, definition, classificationMarkingGroupName, mandatoryMarkingGroupName) {
|
|
1327
|
+
const needsSecurity = classificationMarkingGroupName !== void 0 || mandatoryMarkingGroupName !== void 0;
|
|
1328
|
+
const securityConfig = needsSecurity ? {
|
|
1329
|
+
classificationConstraint: classificationMarkingGroupName ? {
|
|
1330
|
+
markingGroupName: classificationMarkingGroupName
|
|
1331
|
+
} : void 0,
|
|
1332
|
+
markingConstraint: mandatoryMarkingGroupName ? {
|
|
1333
|
+
markingGroupName: mandatoryMarkingGroupName
|
|
1334
|
+
} : void 0
|
|
1335
|
+
} : void 0;
|
|
1106
1336
|
return {
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
type: "active",
|
|
1112
|
-
active: {}
|
|
1113
|
-
},
|
|
1114
|
-
redacted: linkType.redacted ?? false
|
|
1337
|
+
rid: "ri.ontology.main.datasource.".concat(apiName),
|
|
1338
|
+
datasource: definition,
|
|
1339
|
+
editsConfiguration: {
|
|
1340
|
+
onlyAllowPrivilegedEdits: false
|
|
1115
1341
|
},
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1342
|
+
redacted: false,
|
|
1343
|
+
...securityConfig !== void 0 && {
|
|
1344
|
+
dataSecurity: securityConfig
|
|
1119
1345
|
}
|
|
1120
1346
|
};
|
|
1121
1347
|
}
|
|
@@ -1128,73 +1354,8 @@ function cleanAndValidateLinkTypeId(apiName) {
|
|
|
1128
1354
|
}
|
|
1129
1355
|
return linkTypeId;
|
|
1130
1356
|
}
|
|
1131
|
-
function convertInterface(interfaceType) {
|
|
1132
|
-
const {
|
|
1133
|
-
__type,
|
|
1134
|
-
...other
|
|
1135
|
-
} = interfaceType;
|
|
1136
|
-
return {
|
|
1137
|
-
...other,
|
|
1138
|
-
propertiesV2: Object.fromEntries(Object.values(interfaceType.propertiesV2).map((spt) => [spt.sharedPropertyType.apiName, {
|
|
1139
|
-
required: spt.required,
|
|
1140
|
-
sharedPropertyType: convertSpt(spt.sharedPropertyType)
|
|
1141
|
-
}])),
|
|
1142
|
-
displayMetadata: {
|
|
1143
|
-
displayName: interfaceType.displayMetadata.displayName,
|
|
1144
|
-
description: interfaceType.displayMetadata.description
|
|
1145
|
-
},
|
|
1146
|
-
extendsInterfaces: interfaceType.extendsInterfaces.map((i) => i.apiName),
|
|
1147
|
-
// these are omitted from our internal types but we need to re-add them for the final json
|
|
1148
|
-
properties: [],
|
|
1149
|
-
// TODO(mwalther): Support propertiesV3
|
|
1150
|
-
propertiesV3: {}
|
|
1151
|
-
};
|
|
1152
|
-
}
|
|
1153
1357
|
function dumpOntologyFullMetadata() {
|
|
1154
|
-
return
|
|
1155
|
-
}
|
|
1156
|
-
function convertSpt({
|
|
1157
|
-
type,
|
|
1158
|
-
array,
|
|
1159
|
-
description,
|
|
1160
|
-
apiName,
|
|
1161
|
-
displayName,
|
|
1162
|
-
visibility,
|
|
1163
|
-
gothamMapping,
|
|
1164
|
-
typeClasses,
|
|
1165
|
-
valueType,
|
|
1166
|
-
nullability
|
|
1167
|
-
}) {
|
|
1168
|
-
const dataConstraint = convertNullabilityToDataConstraint({
|
|
1169
|
-
type,
|
|
1170
|
-
nullability
|
|
1171
|
-
});
|
|
1172
|
-
return {
|
|
1173
|
-
apiName,
|
|
1174
|
-
displayMetadata: {
|
|
1175
|
-
displayName: displayName ?? apiName,
|
|
1176
|
-
visibility: visibility ?? "NORMAL",
|
|
1177
|
-
description
|
|
1178
|
-
},
|
|
1179
|
-
type: array ? {
|
|
1180
|
-
type: "array",
|
|
1181
|
-
array: {
|
|
1182
|
-
subtype: convertType(type)
|
|
1183
|
-
}
|
|
1184
|
-
} : convertType(type),
|
|
1185
|
-
aliases: [],
|
|
1186
|
-
baseFormatter: void 0,
|
|
1187
|
-
dataConstraints: dataConstraint,
|
|
1188
|
-
gothamMapping,
|
|
1189
|
-
indexedForSearch: true,
|
|
1190
|
-
typeClasses: typeClasses ?? [],
|
|
1191
|
-
valueType: valueType === void 0 ? void 0 : {
|
|
1192
|
-
apiName: valueType.apiName,
|
|
1193
|
-
version: valueType.version,
|
|
1194
|
-
packageNamespace: valueType.packageNamespace,
|
|
1195
|
-
displayMetadata: valueType.displayMetadata
|
|
1196
|
-
}
|
|
1197
|
-
};
|
|
1358
|
+
return convertOntologyDefinition(ontologyDefinition);
|
|
1198
1359
|
}
|
|
1199
1360
|
function convertObjectStatus(status) {
|
|
1200
1361
|
if (status === void 0) {
|
|
@@ -1263,121 +1424,32 @@ function convertAction(action) {
|
|
|
1263
1424
|
blueprint: action.icon ?? {
|
|
1264
1425
|
locator: "edit",
|
|
1265
1426
|
color: "#000000"
|
|
1266
|
-
}
|
|
1267
|
-
},
|
|
1268
|
-
successMessage: action.submissionMetadata?.successMessage ? [{
|
|
1269
|
-
type: "message",
|
|
1270
|
-
message: action.submissionMetadata.successMessage
|
|
1271
|
-
}] : [],
|
|
1272
|
-
typeClasses: action.typeClasses ?? [],
|
|
1273
|
-
...action.submissionMetadata?.submitButtonDisplayMetadata && {
|
|
1274
|
-
submitButtonDisplayMetadata: action.submissionMetadata.submitButtonDisplayMetadata
|
|
1275
|
-
},
|
|
1276
|
-
...action.submissionMetadata?.undoButtonConfiguration && {
|
|
1277
|
-
undoButtonConfiguration: action.submissionMetadata.undoButtonConfiguration
|
|
1278
|
-
}
|
|
1279
|
-
},
|
|
1280
|
-
parameterOrdering,
|
|
1281
|
-
formContentOrdering: getFormContentOrdering(action, parameterOrdering),
|
|
1282
|
-
parameters: actionParameters,
|
|
1283
|
-
sections: actionSections,
|
|
1284
|
-
status: typeof action.status === "string" ? {
|
|
1285
|
-
type: action.status,
|
|
1286
|
-
[action.status]: {}
|
|
1287
|
-
} : action.status,
|
|
1288
|
-
entities: action.entities
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
};
|
|
1292
|
-
}
|
|
1293
|
-
function convertActionValidation(action) {
|
|
1294
|
-
return {
|
|
1295
|
-
actionTypeLevelValidation: {
|
|
1296
|
-
rules: Object.fromEntries((action.validation ?? [{
|
|
1297
|
-
condition: {
|
|
1298
|
-
type: "true",
|
|
1299
|
-
true: {}
|
|
1300
|
-
},
|
|
1301
|
-
displayMetadata: {
|
|
1302
|
-
failureMessage: "",
|
|
1303
|
-
typeClasses: []
|
|
1304
|
-
}
|
|
1305
|
-
}]).map((rule, idx) => [idx, rule]))
|
|
1306
|
-
},
|
|
1307
|
-
parameterValidations: Object.fromEntries((action.parameters ?? []).map((p) => {
|
|
1308
|
-
return [p.id, {
|
|
1309
|
-
defaultValidation: {
|
|
1310
|
-
display: {
|
|
1311
|
-
renderHint: renderHintFromBaseType(p),
|
|
1312
|
-
visibility: convertActionVisibility(p.validation.defaultVisibility),
|
|
1313
|
-
...p.defaultValue && {
|
|
1314
|
-
prefill: p.defaultValue
|
|
1315
|
-
}
|
|
1316
|
-
},
|
|
1317
|
-
validation: {
|
|
1318
|
-
allowedValues: extractAllowedValues(p.validation.allowedValues),
|
|
1319
|
-
required: convertParameterRequirementConstraint(p.validation.required)
|
|
1320
|
-
}
|
|
1321
|
-
},
|
|
1322
|
-
conditionalOverrides: p.validation.conditionalOverrides?.map((override) => convertActionParameterConditionalOverride(override, p.validation)) ?? []
|
|
1323
|
-
}];
|
|
1324
|
-
})),
|
|
1325
|
-
sectionValidations: {
|
|
1326
|
-
...Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId, section]) => [section.id, {
|
|
1327
|
-
defaultDisplayMetadata: section.defaultVisibility === "hidden" ? {
|
|
1328
|
-
visibility: {
|
|
1329
|
-
type: "hidden",
|
|
1330
|
-
hidden: {}
|
|
1331
|
-
}
|
|
1332
|
-
} : {
|
|
1333
|
-
visibility: {
|
|
1334
|
-
type: "visible",
|
|
1335
|
-
visible: {}
|
|
1427
|
+
}
|
|
1428
|
+
},
|
|
1429
|
+
successMessage: action.submissionMetadata?.successMessage ? [{
|
|
1430
|
+
type: "message",
|
|
1431
|
+
message: action.submissionMetadata.successMessage
|
|
1432
|
+
}] : [],
|
|
1433
|
+
typeClasses: action.typeClasses ?? [],
|
|
1434
|
+
...action.submissionMetadata?.submitButtonDisplayMetadata && {
|
|
1435
|
+
submitButtonDisplayMetadata: action.submissionMetadata.submitButtonDisplayMetadata
|
|
1436
|
+
},
|
|
1437
|
+
...action.submissionMetadata?.undoButtonConfiguration && {
|
|
1438
|
+
undoButtonConfiguration: action.submissionMetadata.undoButtonConfiguration
|
|
1336
1439
|
}
|
|
1337
1440
|
},
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
type: p.type,
|
|
1348
|
-
[p.type]: {}
|
|
1349
|
-
} : p.type,
|
|
1350
|
-
displayMetadata: {
|
|
1351
|
-
displayName: p.displayName,
|
|
1352
|
-
description: p.description ?? "",
|
|
1353
|
-
typeClasses: []
|
|
1354
|
-
}
|
|
1355
|
-
}]));
|
|
1356
|
-
}
|
|
1357
|
-
function convertActionSections(action) {
|
|
1358
|
-
return Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId, section]) => [sectionId, {
|
|
1359
|
-
id: sectionId,
|
|
1360
|
-
content: section.parameters.map((p) => ({
|
|
1361
|
-
type: "parameterId",
|
|
1362
|
-
parameterId: p
|
|
1363
|
-
})),
|
|
1364
|
-
displayMetadata: {
|
|
1365
|
-
collapsedByDefault: section.collapsedByDefault ?? false,
|
|
1366
|
-
columnCount: section.columnCount ?? 1,
|
|
1367
|
-
description: section.description ?? "",
|
|
1368
|
-
displayName: section.displayName ?? convertToDisplayName(sectionId),
|
|
1369
|
-
showTitleBar: section.showTitleBar ?? true,
|
|
1370
|
-
...section.style && {
|
|
1371
|
-
style: section.style === "box" ? {
|
|
1372
|
-
type: "box",
|
|
1373
|
-
box: {}
|
|
1374
|
-
} : {
|
|
1375
|
-
type: "minimal",
|
|
1376
|
-
minimal: {}
|
|
1377
|
-
}
|
|
1441
|
+
parameterOrdering,
|
|
1442
|
+
formContentOrdering: getFormContentOrdering(action, parameterOrdering),
|
|
1443
|
+
parameters: actionParameters,
|
|
1444
|
+
sections: actionSections,
|
|
1445
|
+
status: typeof action.status === "string" ? {
|
|
1446
|
+
type: action.status,
|
|
1447
|
+
[action.status]: {}
|
|
1448
|
+
} : action.status,
|
|
1449
|
+
entities: action.entities
|
|
1378
1450
|
}
|
|
1379
1451
|
}
|
|
1380
|
-
}
|
|
1452
|
+
};
|
|
1381
1453
|
}
|
|
1382
1454
|
function extractAllowedValues(allowedValues) {
|
|
1383
1455
|
switch (allowedValues.type) {
|
|
@@ -1576,31 +1648,6 @@ function renderHintFromBaseType(parameter) {
|
|
|
1576
1648
|
throw new Error(`Unknown type ${type}`);
|
|
1577
1649
|
}
|
|
1578
1650
|
}
|
|
1579
|
-
function convertParameterRequirementConstraint(required) {
|
|
1580
|
-
if (typeof required === "boolean") {
|
|
1581
|
-
return required ? {
|
|
1582
|
-
type: "required",
|
|
1583
|
-
required: {}
|
|
1584
|
-
} : {
|
|
1585
|
-
type: "notRequired",
|
|
1586
|
-
notRequired: {}
|
|
1587
|
-
};
|
|
1588
|
-
}
|
|
1589
|
-
const {
|
|
1590
|
-
min,
|
|
1591
|
-
max
|
|
1592
|
-
} = required.listLength;
|
|
1593
|
-
return {
|
|
1594
|
-
type: "listLengthValidation",
|
|
1595
|
-
listLengthValidation: {
|
|
1596
|
-
minLength: min,
|
|
1597
|
-
maxLength: max
|
|
1598
|
-
}
|
|
1599
|
-
};
|
|
1600
|
-
}
|
|
1601
|
-
function sanitize(namespace2, s) {
|
|
1602
|
-
return s.includes(".") ? s : namespace2 + s;
|
|
1603
|
-
}
|
|
1604
1651
|
function withoutNamespace(apiName) {
|
|
1605
1652
|
const lastDot = apiName.lastIndexOf(".");
|
|
1606
1653
|
if (lastDot === -1) {
|
|
@@ -1639,17 +1686,11 @@ addDependency("${namespaceNoDot}", new URL(import.meta.url).pathname);
|
|
|
1639
1686
|
function addNamespaceIfNone(apiName) {
|
|
1640
1687
|
return apiName.includes(".") ? apiName : namespace + apiName;
|
|
1641
1688
|
}
|
|
1642
|
-
function convertCardinality(cardinality) {
|
|
1643
|
-
if (cardinality === "OneToMany" || cardinality === void 0) {
|
|
1644
|
-
return "ONE_TO_MANY";
|
|
1645
|
-
}
|
|
1646
|
-
return "ONE_TO_ONE";
|
|
1647
|
-
}
|
|
1648
1689
|
|
|
1649
1690
|
// src/cli/main.ts
|
|
1650
1691
|
var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
|
|
1651
1692
|
async function main(args = process.argv) {
|
|
1652
|
-
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.13.0-beta.
|
|
1693
|
+
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.13.0-beta.12").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
|
|
1653
1694
|
input: {
|
|
1654
1695
|
alias: "i",
|
|
1655
1696
|
describe: "Input file",
|
|
@@ -1732,9 +1773,41 @@ function addDependency(namespaceNoDot, fileInPackage) {
|
|
|
1732
1773
|
const packageJson = JSON.parse(fs__namespace.readFileSync(packageJsonPath, "utf-8"));
|
|
1733
1774
|
dependencies[namespaceNoDot] = packageJson.version ?? "";
|
|
1734
1775
|
}
|
|
1776
|
+
function convertMappingValue(value) {
|
|
1777
|
+
switch (value.type) {
|
|
1778
|
+
case "uuid":
|
|
1779
|
+
return {
|
|
1780
|
+
type: "uniqueIdentifier",
|
|
1781
|
+
uniqueIdentifier: {
|
|
1782
|
+
linkId: value.linkId ?? crypto.randomUUID()
|
|
1783
|
+
}
|
|
1784
|
+
};
|
|
1785
|
+
case "currentTime":
|
|
1786
|
+
return {
|
|
1787
|
+
type: "currentTime",
|
|
1788
|
+
currentTime: {}
|
|
1789
|
+
};
|
|
1790
|
+
case "currentUser":
|
|
1791
|
+
return {
|
|
1792
|
+
type: "currentUser",
|
|
1793
|
+
currentUser: {}
|
|
1794
|
+
};
|
|
1795
|
+
default:
|
|
1796
|
+
return value;
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
// src/api/action/ActionParameterType.ts
|
|
1801
|
+
function isActionParameterTypePrimitive(type) {
|
|
1802
|
+
return ["boolean", "booleanList", "integer", "integerList", "long", "longList", "double", "doubleList", "string", "stringList", "decimal", "decimalList", "timestamp", "timestampList", "geohash", "geohashList", "geoshape", "geoshapeList", "timeSeriesReference", "date", "dateList", "objectTypeReference", "objectReference", "attachment", "attachmentList", "marking", "markingList", "mediaReference", "mediaReferenceList", "geotimeSeriesReference", "geotimeSeriesReferenceList"].includes(type);
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
// src/api/defineAction.ts
|
|
1806
|
+
var MODIFY_OBJECT_PARAMETER = "objectToModifyParameter";
|
|
1807
|
+
var CREATE_OR_MODIFY_OBJECT_PARAMETER = "objectToCreateOrModifyParameter";
|
|
1735
1808
|
function defineCreateInterfaceObjectAction(interfaceType, objectType, validation) {
|
|
1736
|
-
const allProperties = Object.entries(
|
|
1737
|
-
if (allProperties.length !== Object.entries(
|
|
1809
|
+
const allProperties = Object.entries(getFlattenedInterfaceProperties(interfaceType)).filter(([_, prop]) => !isStruct(prop.sharedPropertyType.type));
|
|
1810
|
+
if (allProperties.length !== Object.entries(getFlattenedInterfaceProperties(interfaceType)).length) {
|
|
1738
1811
|
consola.consola.info(`Some properties on ${interfaceType.apiName} were skipped in the create action because they are structs`);
|
|
1739
1812
|
}
|
|
1740
1813
|
return defineAction({
|
|
@@ -1860,8 +1933,8 @@ function defineCreateObjectAction(def) {
|
|
|
1860
1933
|
});
|
|
1861
1934
|
}
|
|
1862
1935
|
function defineModifyInterfaceObjectAction(interfaceType, objectType, validation) {
|
|
1863
|
-
const allProperties = Object.entries(
|
|
1864
|
-
if (allProperties.length !== Object.entries(
|
|
1936
|
+
const allProperties = Object.entries(getFlattenedInterfaceProperties(interfaceType)).filter(([_, prop]) => !isStruct(prop.sharedPropertyType.type));
|
|
1937
|
+
if (allProperties.length !== Object.entries(getFlattenedInterfaceProperties(interfaceType)).length) {
|
|
1865
1938
|
consola.consola.info(`Some properties on ${interfaceType.apiName} were skipped in the modify action because they are structs`);
|
|
1866
1939
|
}
|
|
1867
1940
|
return defineAction({
|
|
@@ -2131,6 +2204,23 @@ function defineAction(actionDef) {
|
|
|
2131
2204
|
if (rule.type === "deleteObjectRule") {
|
|
2132
2205
|
!parameterIds.some((id) => id === rule.deleteObjectRule.objectToDelete) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Object to delete parameter must be defined in parameters`) : invariant5__default.default(false) : void 0;
|
|
2133
2206
|
}
|
|
2207
|
+
if (rule.type === "modifyInterfaceRule") {
|
|
2208
|
+
const interfaceParam = actionDef.parameters.find((p) => p.id === rule.modifyInterfaceRule.interfaceObjectToModifyParameter);
|
|
2209
|
+
!(interfaceParam !== void 0 && typeof interfaceParam.type === "object" && (interfaceParam.type.type === "interfaceReference" || interfaceParam.type.type === "interfaceReferenceList")) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Interface object to modify parameter must be an interface reference`) : invariant5__default.default(false) : void 0;
|
|
2210
|
+
const interfaceReference = interfaceParam.type.type === "interfaceReference" ? interfaceParam.type.interfaceReference.interfaceTypeRid : interfaceParam.type.interfaceReferenceList.interfaceTypeRid;
|
|
2211
|
+
!(ontologyDefinition.INTERFACE_TYPE[interfaceReference] !== void 0 || importedTypes.INTERFACE_TYPE[interfaceReference] !== void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Interface type ${interfaceReference} does not exist`) : invariant5__default.default(false) : void 0;
|
|
2212
|
+
const interfaceType = ontologyDefinition.INTERFACE_TYPE[interfaceReference];
|
|
2213
|
+
Object.keys(rule.modifyInterfaceRule.sharedPropertyValues).forEach((spt) => {
|
|
2214
|
+
!Object.keys(getFlattenedInterfaceProperties(interfaceType)).includes(spt) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Shared property type ${spt} does not exist in interface type ${interfaceReference}`) : invariant5__default.default(false) : void 0;
|
|
2215
|
+
});
|
|
2216
|
+
}
|
|
2217
|
+
if (rule.type === "addInterfaceRule") {
|
|
2218
|
+
const interfaceType = ontologyDefinition.INTERFACE_TYPE[rule.addInterfaceRule.interfaceApiName] ?? importedTypes.INTERFACE_TYPE[rule.addInterfaceRule.interfaceApiName];
|
|
2219
|
+
!(interfaceType !== void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Interface type ${rule.addInterfaceRule.interfaceApiName} does not exist`) : invariant5__default.default(false) : void 0;
|
|
2220
|
+
Object.keys(rule.addInterfaceRule.sharedPropertyValues).forEach((spt) => {
|
|
2221
|
+
!Object.keys(getFlattenedInterfaceProperties(interfaceType)).includes(spt) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Shared property type ${spt} does not exist in interface type ${interfaceType.apiName}`) : invariant5__default.default(false) : void 0;
|
|
2222
|
+
});
|
|
2223
|
+
}
|
|
2134
2224
|
});
|
|
2135
2225
|
const fullAction = {
|
|
2136
2226
|
...actionDef,
|
|
@@ -2204,7 +2294,7 @@ function createParameters(def, parameterSet) {
|
|
|
2204
2294
|
});
|
|
2205
2295
|
return [...targetParam, ...Array.from(parameterSet).map((id) => ({
|
|
2206
2296
|
id,
|
|
2207
|
-
displayName: def.parameterConfiguration?.[id]?.displayName ?? def.objectType.properties?.[id]?.displayName ??
|
|
2297
|
+
displayName: def.parameterConfiguration?.[id]?.displayName ?? def.objectType.properties?.[id]?.displayName ?? uppercaseFirstLetter(id),
|
|
2208
2298
|
type: def.parameterConfiguration?.[id]?.customParameterType ?? extractActionParameterType(def.objectType.properties?.[id]),
|
|
2209
2299
|
validation: def.parameterConfiguration?.[id] !== void 0 ? {
|
|
2210
2300
|
...def.parameterConfiguration?.[id],
|
|
@@ -2233,14 +2323,14 @@ function referencedParameterIds(actionDef) {
|
|
|
2233
2323
|
actionDef.rules.forEach((rule) => {
|
|
2234
2324
|
switch (rule.type) {
|
|
2235
2325
|
case "addInterfaceRule":
|
|
2236
|
-
rule.addInterfaceRule.interfaceApiName =
|
|
2326
|
+
rule.addInterfaceRule.interfaceApiName = sanitize(rule.addInterfaceRule.interfaceApiName);
|
|
2237
2327
|
parameterIds.add(rule.addInterfaceRule.objectTypeParameter);
|
|
2238
2328
|
Object.entries(rule.addInterfaceRule.sharedPropertyValues).forEach(([k, v]) => {
|
|
2239
2329
|
if (v.type === "parameterId") {
|
|
2240
2330
|
parameterIds.add(v.parameterId);
|
|
2241
2331
|
}
|
|
2242
2332
|
delete rule.addInterfaceRule.sharedPropertyValues[k];
|
|
2243
|
-
rule.addInterfaceRule.sharedPropertyValues[
|
|
2333
|
+
rule.addInterfaceRule.sharedPropertyValues[sanitize(k)] = v;
|
|
2244
2334
|
});
|
|
2245
2335
|
break;
|
|
2246
2336
|
case "modifyInterfaceRule":
|
|
@@ -2250,7 +2340,7 @@ function referencedParameterIds(actionDef) {
|
|
|
2250
2340
|
parameterIds.add(v.parameterId);
|
|
2251
2341
|
}
|
|
2252
2342
|
delete rule.modifyInterfaceRule.sharedPropertyValues[k];
|
|
2253
|
-
rule.modifyInterfaceRule.sharedPropertyValues[
|
|
2343
|
+
rule.modifyInterfaceRule.sharedPropertyValues[sanitize(k)] = v;
|
|
2254
2344
|
});
|
|
2255
2345
|
break;
|
|
2256
2346
|
case "addObjectRule":
|
|
@@ -2479,16 +2569,10 @@ function extractActionParameterType(pt) {
|
|
|
2479
2569
|
function maybeAddList(type, pt) {
|
|
2480
2570
|
return pt.array ?? false ? type + "List" : type;
|
|
2481
2571
|
}
|
|
2482
|
-
function isActionParameterTypePrimitive(type) {
|
|
2483
|
-
return ["boolean", "booleanList", "integer", "integerList", "long", "longList", "double", "doubleList", "string", "stringList", "decimal", "decimalList", "timestamp", "timestampList", "geohash", "geohashList", "geoshape", "geoshapeList", "timeSeriesReference", "date", "dateList", "objectTypeReference", "objectReference", "attachment", "attachmentList", "marking", "markingList", "mediaReference", "mediaReferenceList", "geotimeSeriesReference", "geotimeSeriesReferenceList"].includes(type);
|
|
2484
|
-
}
|
|
2485
|
-
function isStruct(type) {
|
|
2486
|
-
return typeof type === "object" && type.type === "struct";
|
|
2487
|
-
}
|
|
2488
2572
|
function kebab(s) {
|
|
2489
2573
|
return s.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").replace(/\./g, "-").toLowerCase();
|
|
2490
2574
|
}
|
|
2491
|
-
function
|
|
2575
|
+
function sanitize(s) {
|
|
2492
2576
|
return s.includes(".") ? s : namespace + s;
|
|
2493
2577
|
}
|
|
2494
2578
|
function convertValidationRule(actionValidation) {
|
|
@@ -2585,42 +2669,6 @@ function validateParameterOrdering(parameterOrdering, parameterSet, actionApiNam
|
|
|
2585
2669
|
const extraneousParameters = parameterOrdering.filter((param) => !parameterSet.has(param));
|
|
2586
2670
|
!(extraneousParameters.length === 0 && missingParameters.length === 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Action parameter ordering for ${actionApiName} does not match expected parameters. Extraneous parameters in ordering: {${extraneousParameters}}, Missing parameters in ordering: {${missingParameters}}`) : invariant5__default.default(false) : void 0;
|
|
2587
2671
|
}
|
|
2588
|
-
|
|
2589
|
-
// src/api/importOntologyEntity.ts
|
|
2590
|
-
function importOntologyEntity(e) {
|
|
2591
|
-
if (e.__type !== OntologyEntityTypeEnum.VALUE_TYPE) {
|
|
2592
|
-
importedTypes[e.__type][e.apiName] = e;
|
|
2593
|
-
return;
|
|
2594
|
-
}
|
|
2595
|
-
if (importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName] === void 0) {
|
|
2596
|
-
importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName] = [];
|
|
2597
|
-
}
|
|
2598
|
-
importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName].push(e);
|
|
2599
|
-
}
|
|
2600
|
-
|
|
2601
|
-
// src/api/defineImportSpt.ts
|
|
2602
|
-
function importSharedPropertyType(opts) {
|
|
2603
|
-
const {
|
|
2604
|
-
apiName,
|
|
2605
|
-
packageName,
|
|
2606
|
-
typeHint,
|
|
2607
|
-
array
|
|
2608
|
-
} = opts;
|
|
2609
|
-
const fullApiName = packageName === void 0 ? apiName : `${packageName}.${apiName}`;
|
|
2610
|
-
if (packageName !== void 0) {
|
|
2611
|
-
!!packageName.endsWith(".") ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "Package name format invalid ends with period") : invariant5__default.default(false) : void 0;
|
|
2612
|
-
!(packageName.match("[A-Z]") == null) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "Package name includes upper case characters") : invariant5__default.default(false) : void 0;
|
|
2613
|
-
}
|
|
2614
|
-
const spt = {
|
|
2615
|
-
apiName: fullApiName,
|
|
2616
|
-
type: typeHint,
|
|
2617
|
-
nonNameSpacedApiName: apiName,
|
|
2618
|
-
array: array ?? false,
|
|
2619
|
-
__type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE
|
|
2620
|
-
};
|
|
2621
|
-
importOntologyEntity(spt);
|
|
2622
|
-
return spt;
|
|
2623
|
-
}
|
|
2624
2672
|
function defineSharedPropertyType(sptDef) {
|
|
2625
2673
|
const apiName = namespace + sptDef.apiName;
|
|
2626
2674
|
!(ontologyDefinition[OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE][apiName] === void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Shared property type ${apiName} already exists`) : invariant5__default.default(false) : void 0;
|
|
@@ -2638,20 +2686,54 @@ function defineSharedPropertyType(sptDef) {
|
|
|
2638
2686
|
return fullSpt;
|
|
2639
2687
|
}
|
|
2640
2688
|
|
|
2689
|
+
// src/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.ts
|
|
2690
|
+
function mapSimplifiedStatusToInterfaceTypeStatus(status) {
|
|
2691
|
+
switch (status.type) {
|
|
2692
|
+
case "deprecated":
|
|
2693
|
+
return {
|
|
2694
|
+
type: "deprecated",
|
|
2695
|
+
deprecated: {
|
|
2696
|
+
message: status.message,
|
|
2697
|
+
deadline: status.deadline,
|
|
2698
|
+
replacedBy: void 0
|
|
2699
|
+
}
|
|
2700
|
+
};
|
|
2701
|
+
case "active":
|
|
2702
|
+
return {
|
|
2703
|
+
type: "active",
|
|
2704
|
+
active: {}
|
|
2705
|
+
};
|
|
2706
|
+
case "experimental":
|
|
2707
|
+
return {
|
|
2708
|
+
type: "experimental",
|
|
2709
|
+
experimental: {}
|
|
2710
|
+
};
|
|
2711
|
+
default:
|
|
2712
|
+
throw new Error(`Invalid status type: ${status.type}`);
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2716
|
+
// src/api/namespace/combineApiNamespaceIfMissing.ts
|
|
2717
|
+
function combineApiNamespaceIfMissing(namespace2, apiName) {
|
|
2718
|
+
return apiName.includes(".") ? apiName : namespace2 + apiName;
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2641
2721
|
// src/api/defineInterface.ts
|
|
2642
2722
|
function defineInterface(interfaceDef) {
|
|
2643
2723
|
const apiName = namespace + interfaceDef.apiName;
|
|
2644
2724
|
!(ontologyDefinition[OntologyEntityTypeEnum.INTERFACE_TYPE][apiName] === void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Interface ${apiName} already exists`) : invariant5__default.default(false) : void 0;
|
|
2645
|
-
const properties = Object.fromEntries(Object.entries(interfaceDef.properties ?? {}).map(([
|
|
2725
|
+
const properties = Object.fromEntries(Object.entries(interfaceDef.properties ?? {}).map(([unNamespacedPropApiName, type]) => {
|
|
2646
2726
|
if (typeof type === "object" && "propertyDefinition" in type) {
|
|
2647
|
-
|
|
2727
|
+
const apiName3 = combineApiNamespaceIfMissing(namespace, typeof type.propertyDefinition === "object" && "apiName" in type.propertyDefinition ? type.propertyDefinition.apiName : unNamespacedPropApiName);
|
|
2728
|
+
return [apiName3, {
|
|
2648
2729
|
required: type.required,
|
|
2649
|
-
sharedPropertyType: unifyBasePropertyDefinition(namespace,
|
|
2730
|
+
sharedPropertyType: unifyBasePropertyDefinition(namespace, unNamespacedPropApiName, type.propertyDefinition)
|
|
2650
2731
|
}];
|
|
2651
2732
|
}
|
|
2652
|
-
|
|
2733
|
+
const apiName2 = combineApiNamespaceIfMissing(namespace, typeof type === "object" && "apiName" in type ? type.apiName : unNamespacedPropApiName);
|
|
2734
|
+
return [apiName2, {
|
|
2653
2735
|
required: true,
|
|
2654
|
-
sharedPropertyType: unifyBasePropertyDefinition(namespace,
|
|
2736
|
+
sharedPropertyType: unifyBasePropertyDefinition(namespace, unNamespacedPropApiName, type)
|
|
2655
2737
|
}];
|
|
2656
2738
|
}));
|
|
2657
2739
|
const extendsInterfaces = interfaceDef.extends ? Array.isArray(interfaceDef.extends) ? interfaceDef.extends : [interfaceDef.extends] : [];
|
|
@@ -2682,34 +2764,6 @@ function defineInterface(interfaceDef) {
|
|
|
2682
2764
|
updateOntology(fullInterface);
|
|
2683
2765
|
return fullInterface;
|
|
2684
2766
|
}
|
|
2685
|
-
function isPropertyTypeType(v) {
|
|
2686
|
-
return v === "boolean" || v === "byte" || v === "date" || v === "decimal" || v === "double" || v === "float" || v === "geopoint" || v === "geoshape" || v === "integer" || v === "long" || typeof v === "object" && v.type === "marking" || v === "short" || v === "string" || v === "timestamp";
|
|
2687
|
-
}
|
|
2688
|
-
function mapSimplifiedStatusToInterfaceTypeStatus(status) {
|
|
2689
|
-
switch (status.type) {
|
|
2690
|
-
case "deprecated":
|
|
2691
|
-
return {
|
|
2692
|
-
type: "deprecated",
|
|
2693
|
-
deprecated: {
|
|
2694
|
-
message: status.message,
|
|
2695
|
-
deadline: status.deadline,
|
|
2696
|
-
replacedBy: void 0
|
|
2697
|
-
}
|
|
2698
|
-
};
|
|
2699
|
-
case "active":
|
|
2700
|
-
return {
|
|
2701
|
-
type: "active",
|
|
2702
|
-
active: {}
|
|
2703
|
-
};
|
|
2704
|
-
case "experimental":
|
|
2705
|
-
return {
|
|
2706
|
-
type: "experimental",
|
|
2707
|
-
experimental: {}
|
|
2708
|
-
};
|
|
2709
|
-
default:
|
|
2710
|
-
throw new Error(`Invalid status type: ${status.type}`);
|
|
2711
|
-
}
|
|
2712
|
-
}
|
|
2713
2767
|
function unifyBasePropertyDefinition(namespace2, apiName, type) {
|
|
2714
2768
|
if (typeof type === "string" || typeof type === "object" && !("apiName" in type)) {
|
|
2715
2769
|
!isPropertyTypeType(type) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Invalid data type ${JSON.stringify(type)} for property ${apiName} on InterfaceType ${apiName}`) : invariant5__default.default(false) : void 0;
|
|
@@ -2751,7 +2805,7 @@ function getLinkMeta(meta) {
|
|
|
2751
2805
|
displayName,
|
|
2752
2806
|
description
|
|
2753
2807
|
} = meta;
|
|
2754
|
-
const apiNameWithNamespace =
|
|
2808
|
+
const apiNameWithNamespace = combineApiNamespaceIfMissing(namespace, apiName);
|
|
2755
2809
|
const apiNameWithoutNamespace = withoutNamespace(apiNameWithNamespace);
|
|
2756
2810
|
return {
|
|
2757
2811
|
apiName: apiNameWithNamespace,
|
|
@@ -2801,7 +2855,7 @@ function convertLinkTypeMetadata(metadata) {
|
|
|
2801
2855
|
return {
|
|
2802
2856
|
apiName: metadata.apiName,
|
|
2803
2857
|
displayMetadata: {
|
|
2804
|
-
displayName: metadata.displayName ??
|
|
2858
|
+
displayName: metadata.displayName ?? uppercaseFirstLetter(metadata.apiName),
|
|
2805
2859
|
pluralDisplayName: metadata.pluralDisplayName ?? convertToPluralDisplayName(metadata.apiName),
|
|
2806
2860
|
visibility: metadata.visibility ?? "NORMAL",
|
|
2807
2861
|
groupDisplayName: metadata.groupDisplayName ?? ""
|
|
@@ -2897,6 +2951,40 @@ function defineValueType(valueTypeDef) {
|
|
|
2897
2951
|
return vt;
|
|
2898
2952
|
}
|
|
2899
2953
|
|
|
2954
|
+
// src/api/importOntologyEntity.ts
|
|
2955
|
+
function importOntologyEntity(e) {
|
|
2956
|
+
if (e.__type !== OntologyEntityTypeEnum.VALUE_TYPE) {
|
|
2957
|
+
importedTypes[e.__type][e.apiName] = e;
|
|
2958
|
+
return;
|
|
2959
|
+
}
|
|
2960
|
+
if (importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName] === void 0) {
|
|
2961
|
+
importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName] = [];
|
|
2962
|
+
}
|
|
2963
|
+
importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName].push(e);
|
|
2964
|
+
}
|
|
2965
|
+
function importSharedPropertyType(opts) {
|
|
2966
|
+
const {
|
|
2967
|
+
apiName,
|
|
2968
|
+
packageName,
|
|
2969
|
+
typeHint,
|
|
2970
|
+
array
|
|
2971
|
+
} = opts;
|
|
2972
|
+
const fullApiName = packageName === void 0 ? apiName : `${packageName}.${apiName}`;
|
|
2973
|
+
if (packageName !== void 0) {
|
|
2974
|
+
!!packageName.endsWith(".") ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "Package name format invalid ends with period") : invariant5__default.default(false) : void 0;
|
|
2975
|
+
!(packageName.match("[A-Z]") == null) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "Package name includes upper case characters") : invariant5__default.default(false) : void 0;
|
|
2976
|
+
}
|
|
2977
|
+
const spt = {
|
|
2978
|
+
apiName: fullApiName,
|
|
2979
|
+
type: typeHint,
|
|
2980
|
+
nonNameSpacedApiName: apiName,
|
|
2981
|
+
array: array ?? false,
|
|
2982
|
+
__type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE
|
|
2983
|
+
};
|
|
2984
|
+
importOntologyEntity(spt);
|
|
2985
|
+
return spt;
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2900
2988
|
// src/api/wrapWithProxy.ts
|
|
2901
2989
|
function wrapWithProxy(entity) {
|
|
2902
2990
|
return new Proxy(entity, {
|
|
@@ -2912,9 +3000,9 @@ exports.MODIFY_OBJECT_PARAMETER = MODIFY_OBJECT_PARAMETER;
|
|
|
2912
3000
|
exports.OntologyEntityTypeEnum = OntologyEntityTypeEnum;
|
|
2913
3001
|
exports.addDependency = addDependency;
|
|
2914
3002
|
exports.addNamespaceIfNone = addNamespaceIfNone;
|
|
2915
|
-
exports.convertToDisplayName =
|
|
3003
|
+
exports.convertToDisplayName = uppercaseFirstLetter;
|
|
2916
3004
|
exports.convertToPluralDisplayName = convertToPluralDisplayName;
|
|
2917
|
-
exports.convertType =
|
|
3005
|
+
exports.convertType = propertyTypeTypeToOntologyIrType;
|
|
2918
3006
|
exports.default = main;
|
|
2919
3007
|
exports.defineAction = defineAction;
|
|
2920
3008
|
exports.defineCreateInterfaceObjectAction = defineCreateInterfaceObjectAction;
|