@osdk/maker 0.13.0-beta.11 → 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 +11 -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 +16 -28
- package/build/browser/api/defineAction.js.map +1 -1
- package/build/browser/api/defineInterface.js +7 -32
- 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 -557
- 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 +2 -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 +1017 -963
- 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 +16 -28
- package/build/esm/api/defineAction.js.map +1 -1
- package/build/esm/api/defineInterface.js +7 -32
- 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 -557
- 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 +2 -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 +3 -3
- 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) {
|
|
756
905
|
return {
|
|
757
|
-
|
|
906
|
+
apiName: valueType.apiName,
|
|
907
|
+
version: valueType.version,
|
|
908
|
+
packageNamespace: valueType.packageNamespace,
|
|
909
|
+
displayMetadata: valueType.displayMetadata
|
|
758
910
|
};
|
|
759
911
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
apiName: definitions[0].apiName,
|
|
764
|
-
packageNamespace: definitions[0].packageNamespace,
|
|
765
|
-
displayMetadata: definitions[0].displayMetadata,
|
|
766
|
-
status: definitions[0].status
|
|
767
|
-
},
|
|
768
|
-
// TODO(dpaquin): instead of deduping here, we should refactor the value type types from arrays to maps
|
|
769
|
-
versions: Array.from(new Map(definitions.map((definition) => [definition.version, definition])).values()).map((definition) => ({
|
|
770
|
-
version: definition.version,
|
|
771
|
-
baseType: definition.baseType,
|
|
772
|
-
constraints: definition.constraints,
|
|
773
|
-
exampleValues: definition.exampleValues
|
|
774
|
-
}))
|
|
775
|
-
}));
|
|
776
|
-
}
|
|
777
|
-
function convertToWireOntologyIr(ontology) {
|
|
912
|
+
|
|
913
|
+
// src/conversion/toMarketplace/convertDataConstraintToDataConstraints.ts
|
|
914
|
+
function convertDataConstraintToDataConstraints(dc) {
|
|
778
915
|
return {
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
916
|
+
propertyTypeConstraints: [{
|
|
917
|
+
constraints: dataConstraintToPropertyTypeDataConstraint(dc)
|
|
918
|
+
// known limitation: structs don't carry field-level data constraint failure messages
|
|
919
|
+
}]
|
|
783
920
|
};
|
|
784
921
|
}
|
|
785
|
-
|
|
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
|
+
}
|
|
988
|
+
}
|
|
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
|
+
}));
|
|
786
999
|
return {
|
|
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
|
-
|
|
815
|
-
|
|
816
|
-
|
|
1000
|
+
propertyTypeConstraints
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
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),
|
|
@@ -862,6 +1079,14 @@ function convertObject(objectType) {
|
|
|
862
1079
|
}
|
|
863
1080
|
};
|
|
864
1081
|
}
|
|
1082
|
+
function extractMarkingGroups(properties, markingType) {
|
|
1083
|
+
return properties.map((prop) => {
|
|
1084
|
+
if (typeof prop.type === "object" && prop.type.type === "marking" && prop.type.markingType === markingType) {
|
|
1085
|
+
return prop.type.markingInputGroupName;
|
|
1086
|
+
}
|
|
1087
|
+
return void 0;
|
|
1088
|
+
}).filter((val) => val !== void 0);
|
|
1089
|
+
}
|
|
865
1090
|
function extractPropertyDatasource(property, objectTypeApiName) {
|
|
866
1091
|
if (!isExotic(property.type)) {
|
|
867
1092
|
return [];
|
|
@@ -878,244 +1103,245 @@ function extractPropertyDatasource(property, objectTypeApiName) {
|
|
|
878
1103
|
};
|
|
879
1104
|
return [buildDatasource(property.apiName, geotimeDefinition)];
|
|
880
1105
|
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)
|
|
1106
|
+
const mediaSetDefinition = {
|
|
1107
|
+
type: "mediaSetView",
|
|
1108
|
+
mediaSetView: {
|
|
1109
|
+
assumedMarkings: [],
|
|
1110
|
+
mediaSetViewLocator: identifier,
|
|
1111
|
+
properties: [property.apiName]
|
|
945
1112
|
}
|
|
946
1113
|
};
|
|
947
|
-
|
|
1114
|
+
return [buildDatasource(property.apiName, mediaSetDefinition)];
|
|
948
1115
|
default:
|
|
949
|
-
return
|
|
950
|
-
type: "datasetV2",
|
|
951
|
-
datasetV2: {
|
|
952
|
-
datasetRid: objectType.apiName,
|
|
953
|
-
propertyMapping: buildPropertyMapping(properties)
|
|
954
|
-
}
|
|
955
|
-
};
|
|
1116
|
+
return [];
|
|
956
1117
|
}
|
|
957
1118
|
}
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
return [
|
|
970
|
-
|
|
971
|
-
editOnly: {}
|
|
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)
|
|
972
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: {}
|
|
973
1152
|
}
|
|
974
|
-
|
|
975
|
-
const structMapping = {
|
|
976
|
-
type: "struct",
|
|
977
|
-
struct: {
|
|
978
|
-
column: prop.apiName,
|
|
979
|
-
mapping: Object.fromEntries(Object.keys(prop.type.structDefinition).map((fieldName) => [fieldName, {
|
|
980
|
-
apiName: fieldName,
|
|
981
|
-
mappings: {}
|
|
982
|
-
}]))
|
|
983
|
-
}
|
|
984
|
-
};
|
|
985
|
-
return [prop.apiName, structMapping];
|
|
986
|
-
}
|
|
987
|
-
return [prop.apiName, {
|
|
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
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
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] = [];
|
|
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
|
+
});
|
|
1105
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,80 +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
|
-
icon: interfaceType.displayMetadata.icon ?? {
|
|
1146
|
-
type: "blueprint",
|
|
1147
|
-
blueprint: {
|
|
1148
|
-
color: "#4C90F0",
|
|
1149
|
-
locator: "layout-hierarchy"
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
},
|
|
1153
|
-
extendsInterfaces: interfaceType.extendsInterfaces.map((i) => i.apiName),
|
|
1154
|
-
// these are omitted from our internal types but we need to re-add them for the final json
|
|
1155
|
-
properties: [],
|
|
1156
|
-
// TODO(mwalther): Support propertiesV3
|
|
1157
|
-
propertiesV3: {}
|
|
1158
|
-
};
|
|
1159
|
-
}
|
|
1160
1357
|
function dumpOntologyFullMetadata() {
|
|
1161
|
-
return
|
|
1162
|
-
}
|
|
1163
|
-
function convertSpt({
|
|
1164
|
-
type,
|
|
1165
|
-
array,
|
|
1166
|
-
description,
|
|
1167
|
-
apiName,
|
|
1168
|
-
displayName,
|
|
1169
|
-
visibility,
|
|
1170
|
-
gothamMapping,
|
|
1171
|
-
typeClasses,
|
|
1172
|
-
valueType,
|
|
1173
|
-
nullability
|
|
1174
|
-
}) {
|
|
1175
|
-
const dataConstraint = convertNullabilityToDataConstraint({
|
|
1176
|
-
type,
|
|
1177
|
-
nullability
|
|
1178
|
-
});
|
|
1179
|
-
return {
|
|
1180
|
-
apiName,
|
|
1181
|
-
displayMetadata: {
|
|
1182
|
-
displayName: displayName ?? apiName,
|
|
1183
|
-
visibility: visibility ?? "NORMAL",
|
|
1184
|
-
description
|
|
1185
|
-
},
|
|
1186
|
-
type: array ? {
|
|
1187
|
-
type: "array",
|
|
1188
|
-
array: {
|
|
1189
|
-
subtype: convertType(type)
|
|
1190
|
-
}
|
|
1191
|
-
} : convertType(type),
|
|
1192
|
-
aliases: [],
|
|
1193
|
-
baseFormatter: void 0,
|
|
1194
|
-
dataConstraints: dataConstraint,
|
|
1195
|
-
gothamMapping,
|
|
1196
|
-
indexedForSearch: true,
|
|
1197
|
-
typeClasses: typeClasses ?? [],
|
|
1198
|
-
valueType: valueType === void 0 ? void 0 : {
|
|
1199
|
-
apiName: valueType.apiName,
|
|
1200
|
-
version: valueType.version,
|
|
1201
|
-
packageNamespace: valueType.packageNamespace,
|
|
1202
|
-
displayMetadata: valueType.displayMetadata
|
|
1203
|
-
}
|
|
1204
|
-
};
|
|
1358
|
+
return convertOntologyDefinition(ontologyDefinition);
|
|
1205
1359
|
}
|
|
1206
1360
|
function convertObjectStatus(status) {
|
|
1207
1361
|
if (status === void 0) {
|
|
@@ -1270,121 +1424,32 @@ function convertAction(action) {
|
|
|
1270
1424
|
blueprint: action.icon ?? {
|
|
1271
1425
|
locator: "edit",
|
|
1272
1426
|
color: "#000000"
|
|
1273
|
-
}
|
|
1274
|
-
},
|
|
1275
|
-
successMessage: action.submissionMetadata?.successMessage ? [{
|
|
1276
|
-
type: "message",
|
|
1277
|
-
message: action.submissionMetadata.successMessage
|
|
1278
|
-
}] : [],
|
|
1279
|
-
typeClasses: action.typeClasses ?? [],
|
|
1280
|
-
...action.submissionMetadata?.submitButtonDisplayMetadata && {
|
|
1281
|
-
submitButtonDisplayMetadata: action.submissionMetadata.submitButtonDisplayMetadata
|
|
1282
|
-
},
|
|
1283
|
-
...action.submissionMetadata?.undoButtonConfiguration && {
|
|
1284
|
-
undoButtonConfiguration: action.submissionMetadata.undoButtonConfiguration
|
|
1285
|
-
}
|
|
1286
|
-
},
|
|
1287
|
-
parameterOrdering,
|
|
1288
|
-
formContentOrdering: getFormContentOrdering(action, parameterOrdering),
|
|
1289
|
-
parameters: actionParameters,
|
|
1290
|
-
sections: actionSections,
|
|
1291
|
-
status: typeof action.status === "string" ? {
|
|
1292
|
-
type: action.status,
|
|
1293
|
-
[action.status]: {}
|
|
1294
|
-
} : action.status,
|
|
1295
|
-
entities: action.entities
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
};
|
|
1299
|
-
}
|
|
1300
|
-
function convertActionValidation(action) {
|
|
1301
|
-
return {
|
|
1302
|
-
actionTypeLevelValidation: {
|
|
1303
|
-
rules: Object.fromEntries((action.validation ?? [{
|
|
1304
|
-
condition: {
|
|
1305
|
-
type: "true",
|
|
1306
|
-
true: {}
|
|
1307
|
-
},
|
|
1308
|
-
displayMetadata: {
|
|
1309
|
-
failureMessage: "",
|
|
1310
|
-
typeClasses: []
|
|
1311
|
-
}
|
|
1312
|
-
}]).map((rule, idx) => [idx, rule]))
|
|
1313
|
-
},
|
|
1314
|
-
parameterValidations: Object.fromEntries((action.parameters ?? []).map((p) => {
|
|
1315
|
-
return [p.id, {
|
|
1316
|
-
defaultValidation: {
|
|
1317
|
-
display: {
|
|
1318
|
-
renderHint: renderHintFromBaseType(p),
|
|
1319
|
-
visibility: convertActionVisibility(p.validation.defaultVisibility),
|
|
1320
|
-
...p.defaultValue && {
|
|
1321
|
-
prefill: p.defaultValue
|
|
1322
|
-
}
|
|
1323
|
-
},
|
|
1324
|
-
validation: {
|
|
1325
|
-
allowedValues: extractAllowedValues(p.validation.allowedValues),
|
|
1326
|
-
required: convertParameterRequirementConstraint(p.validation.required)
|
|
1327
|
-
}
|
|
1328
|
-
},
|
|
1329
|
-
conditionalOverrides: p.validation.conditionalOverrides?.map((override) => convertActionParameterConditionalOverride(override, p.validation)) ?? []
|
|
1330
|
-
}];
|
|
1331
|
-
})),
|
|
1332
|
-
sectionValidations: {
|
|
1333
|
-
...Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId, section]) => [section.id, {
|
|
1334
|
-
defaultDisplayMetadata: section.defaultVisibility === "hidden" ? {
|
|
1335
|
-
visibility: {
|
|
1336
|
-
type: "hidden",
|
|
1337
|
-
hidden: {}
|
|
1338
|
-
}
|
|
1339
|
-
} : {
|
|
1340
|
-
visibility: {
|
|
1341
|
-
type: "visible",
|
|
1342
|
-
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
|
|
1343
1439
|
}
|
|
1344
1440
|
},
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
type: p.type,
|
|
1355
|
-
[p.type]: {}
|
|
1356
|
-
} : p.type,
|
|
1357
|
-
displayMetadata: {
|
|
1358
|
-
displayName: p.displayName,
|
|
1359
|
-
description: p.description ?? "",
|
|
1360
|
-
typeClasses: []
|
|
1361
|
-
}
|
|
1362
|
-
}]));
|
|
1363
|
-
}
|
|
1364
|
-
function convertActionSections(action) {
|
|
1365
|
-
return Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId, section]) => [sectionId, {
|
|
1366
|
-
id: sectionId,
|
|
1367
|
-
content: section.parameters.map((p) => ({
|
|
1368
|
-
type: "parameterId",
|
|
1369
|
-
parameterId: p
|
|
1370
|
-
})),
|
|
1371
|
-
displayMetadata: {
|
|
1372
|
-
collapsedByDefault: section.collapsedByDefault ?? false,
|
|
1373
|
-
columnCount: section.columnCount ?? 1,
|
|
1374
|
-
description: section.description ?? "",
|
|
1375
|
-
displayName: section.displayName ?? convertToDisplayName(sectionId),
|
|
1376
|
-
showTitleBar: section.showTitleBar ?? true,
|
|
1377
|
-
...section.style && {
|
|
1378
|
-
style: section.style === "box" ? {
|
|
1379
|
-
type: "box",
|
|
1380
|
-
box: {}
|
|
1381
|
-
} : {
|
|
1382
|
-
type: "minimal",
|
|
1383
|
-
minimal: {}
|
|
1384
|
-
}
|
|
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
|
|
1385
1450
|
}
|
|
1386
1451
|
}
|
|
1387
|
-
}
|
|
1452
|
+
};
|
|
1388
1453
|
}
|
|
1389
1454
|
function extractAllowedValues(allowedValues) {
|
|
1390
1455
|
switch (allowedValues.type) {
|
|
@@ -1583,31 +1648,6 @@ function renderHintFromBaseType(parameter) {
|
|
|
1583
1648
|
throw new Error(`Unknown type ${type}`);
|
|
1584
1649
|
}
|
|
1585
1650
|
}
|
|
1586
|
-
function convertParameterRequirementConstraint(required) {
|
|
1587
|
-
if (typeof required === "boolean") {
|
|
1588
|
-
return required ? {
|
|
1589
|
-
type: "required",
|
|
1590
|
-
required: {}
|
|
1591
|
-
} : {
|
|
1592
|
-
type: "notRequired",
|
|
1593
|
-
notRequired: {}
|
|
1594
|
-
};
|
|
1595
|
-
}
|
|
1596
|
-
const {
|
|
1597
|
-
min,
|
|
1598
|
-
max
|
|
1599
|
-
} = required.listLength;
|
|
1600
|
-
return {
|
|
1601
|
-
type: "listLengthValidation",
|
|
1602
|
-
listLengthValidation: {
|
|
1603
|
-
minLength: min,
|
|
1604
|
-
maxLength: max
|
|
1605
|
-
}
|
|
1606
|
-
};
|
|
1607
|
-
}
|
|
1608
|
-
function sanitize(namespace2, s) {
|
|
1609
|
-
return s.includes(".") ? s : namespace2 + s;
|
|
1610
|
-
}
|
|
1611
1651
|
function withoutNamespace(apiName) {
|
|
1612
1652
|
const lastDot = apiName.lastIndexOf(".");
|
|
1613
1653
|
if (lastDot === -1) {
|
|
@@ -1646,17 +1686,11 @@ addDependency("${namespaceNoDot}", new URL(import.meta.url).pathname);
|
|
|
1646
1686
|
function addNamespaceIfNone(apiName) {
|
|
1647
1687
|
return apiName.includes(".") ? apiName : namespace + apiName;
|
|
1648
1688
|
}
|
|
1649
|
-
function convertCardinality(cardinality) {
|
|
1650
|
-
if (cardinality === "OneToMany" || cardinality === void 0) {
|
|
1651
|
-
return "ONE_TO_MANY";
|
|
1652
|
-
}
|
|
1653
|
-
return "ONE_TO_ONE";
|
|
1654
|
-
}
|
|
1655
1689
|
|
|
1656
1690
|
// src/cli/main.ts
|
|
1657
1691
|
var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
|
|
1658
1692
|
async function main(args = process.argv) {
|
|
1659
|
-
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({
|
|
1660
1694
|
input: {
|
|
1661
1695
|
alias: "i",
|
|
1662
1696
|
describe: "Input file",
|
|
@@ -1739,9 +1773,41 @@ function addDependency(namespaceNoDot, fileInPackage) {
|
|
|
1739
1773
|
const packageJson = JSON.parse(fs__namespace.readFileSync(packageJsonPath, "utf-8"));
|
|
1740
1774
|
dependencies[namespaceNoDot] = packageJson.version ?? "";
|
|
1741
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";
|
|
1742
1808
|
function defineCreateInterfaceObjectAction(interfaceType, objectType, validation) {
|
|
1743
|
-
const allProperties = Object.entries(
|
|
1744
|
-
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) {
|
|
1745
1811
|
consola.consola.info(`Some properties on ${interfaceType.apiName} were skipped in the create action because they are structs`);
|
|
1746
1812
|
}
|
|
1747
1813
|
return defineAction({
|
|
@@ -1867,8 +1933,8 @@ function defineCreateObjectAction(def) {
|
|
|
1867
1933
|
});
|
|
1868
1934
|
}
|
|
1869
1935
|
function defineModifyInterfaceObjectAction(interfaceType, objectType, validation) {
|
|
1870
|
-
const allProperties = Object.entries(
|
|
1871
|
-
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) {
|
|
1872
1938
|
consola.consola.info(`Some properties on ${interfaceType.apiName} were skipped in the modify action because they are structs`);
|
|
1873
1939
|
}
|
|
1874
1940
|
return defineAction({
|
|
@@ -2139,28 +2205,20 @@ function defineAction(actionDef) {
|
|
|
2139
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;
|
|
2140
2206
|
}
|
|
2141
2207
|
if (rule.type === "modifyInterfaceRule") {
|
|
2142
|
-
Object.keys(rule.modifyInterfaceRule.sharedPropertyValues).forEach((spt) => {
|
|
2143
|
-
!(ontologyDefinition.SHARED_PROPERTY_TYPE[spt] !== void 0 || importedTypes.SHARED_PROPERTY_TYPE[spt] !== void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Shared property type ${spt} does not exist.
|
|
2144
|
-
If this SPT was imported, you may need to use [spt.apiName] as the key so that it is qualified with the right namespace`) : invariant5__default.default(false) : void 0;
|
|
2145
|
-
});
|
|
2146
2208
|
const interfaceParam = actionDef.parameters.find((p) => p.id === rule.modifyInterfaceRule.interfaceObjectToModifyParameter);
|
|
2147
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;
|
|
2148
2210
|
const interfaceReference = interfaceParam.type.type === "interfaceReference" ? interfaceParam.type.interfaceReference.interfaceTypeRid : interfaceParam.type.interfaceReferenceList.interfaceTypeRid;
|
|
2149
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;
|
|
2150
2212
|
const interfaceType = ontologyDefinition.INTERFACE_TYPE[interfaceReference];
|
|
2151
2213
|
Object.keys(rule.modifyInterfaceRule.sharedPropertyValues).forEach((spt) => {
|
|
2152
|
-
!(interfaceType.
|
|
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;
|
|
2153
2215
|
});
|
|
2154
2216
|
}
|
|
2155
2217
|
if (rule.type === "addInterfaceRule") {
|
|
2156
|
-
Object.keys(rule.addInterfaceRule.sharedPropertyValues).forEach((spt) => {
|
|
2157
|
-
!(ontologyDefinition.SHARED_PROPERTY_TYPE[spt] !== void 0 || importedTypes.SHARED_PROPERTY_TYPE[spt] !== void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Shared property type ${spt} does not exist.
|
|
2158
|
-
If this SPT was imported, you may need to use [spt.apiName] as the key so that it is qualified with the right namespace`) : invariant5__default.default(false) : void 0;
|
|
2159
|
-
});
|
|
2160
2218
|
const interfaceType = ontologyDefinition.INTERFACE_TYPE[rule.addInterfaceRule.interfaceApiName] ?? importedTypes.INTERFACE_TYPE[rule.addInterfaceRule.interfaceApiName];
|
|
2161
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;
|
|
2162
2220
|
Object.keys(rule.addInterfaceRule.sharedPropertyValues).forEach((spt) => {
|
|
2163
|
-
!(interfaceType.
|
|
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;
|
|
2164
2222
|
});
|
|
2165
2223
|
}
|
|
2166
2224
|
});
|
|
@@ -2236,7 +2294,7 @@ function createParameters(def, parameterSet) {
|
|
|
2236
2294
|
});
|
|
2237
2295
|
return [...targetParam, ...Array.from(parameterSet).map((id) => ({
|
|
2238
2296
|
id,
|
|
2239
|
-
displayName: def.parameterConfiguration?.[id]?.displayName ?? def.objectType.properties?.[id]?.displayName ??
|
|
2297
|
+
displayName: def.parameterConfiguration?.[id]?.displayName ?? def.objectType.properties?.[id]?.displayName ?? uppercaseFirstLetter(id),
|
|
2240
2298
|
type: def.parameterConfiguration?.[id]?.customParameterType ?? extractActionParameterType(def.objectType.properties?.[id]),
|
|
2241
2299
|
validation: def.parameterConfiguration?.[id] !== void 0 ? {
|
|
2242
2300
|
...def.parameterConfiguration?.[id],
|
|
@@ -2265,14 +2323,14 @@ function referencedParameterIds(actionDef) {
|
|
|
2265
2323
|
actionDef.rules.forEach((rule) => {
|
|
2266
2324
|
switch (rule.type) {
|
|
2267
2325
|
case "addInterfaceRule":
|
|
2268
|
-
rule.addInterfaceRule.interfaceApiName =
|
|
2326
|
+
rule.addInterfaceRule.interfaceApiName = sanitize(rule.addInterfaceRule.interfaceApiName);
|
|
2269
2327
|
parameterIds.add(rule.addInterfaceRule.objectTypeParameter);
|
|
2270
2328
|
Object.entries(rule.addInterfaceRule.sharedPropertyValues).forEach(([k, v]) => {
|
|
2271
2329
|
if (v.type === "parameterId") {
|
|
2272
2330
|
parameterIds.add(v.parameterId);
|
|
2273
2331
|
}
|
|
2274
2332
|
delete rule.addInterfaceRule.sharedPropertyValues[k];
|
|
2275
|
-
rule.addInterfaceRule.sharedPropertyValues[
|
|
2333
|
+
rule.addInterfaceRule.sharedPropertyValues[sanitize(k)] = v;
|
|
2276
2334
|
});
|
|
2277
2335
|
break;
|
|
2278
2336
|
case "modifyInterfaceRule":
|
|
@@ -2282,7 +2340,7 @@ function referencedParameterIds(actionDef) {
|
|
|
2282
2340
|
parameterIds.add(v.parameterId);
|
|
2283
2341
|
}
|
|
2284
2342
|
delete rule.modifyInterfaceRule.sharedPropertyValues[k];
|
|
2285
|
-
rule.modifyInterfaceRule.sharedPropertyValues[
|
|
2343
|
+
rule.modifyInterfaceRule.sharedPropertyValues[sanitize(k)] = v;
|
|
2286
2344
|
});
|
|
2287
2345
|
break;
|
|
2288
2346
|
case "addObjectRule":
|
|
@@ -2511,16 +2569,10 @@ function extractActionParameterType(pt) {
|
|
|
2511
2569
|
function maybeAddList(type, pt) {
|
|
2512
2570
|
return pt.array ?? false ? type + "List" : type;
|
|
2513
2571
|
}
|
|
2514
|
-
function isActionParameterTypePrimitive(type) {
|
|
2515
|
-
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);
|
|
2516
|
-
}
|
|
2517
|
-
function isStruct(type) {
|
|
2518
|
-
return typeof type === "object" && type.type === "struct";
|
|
2519
|
-
}
|
|
2520
2572
|
function kebab(s) {
|
|
2521
2573
|
return s.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").replace(/\./g, "-").toLowerCase();
|
|
2522
2574
|
}
|
|
2523
|
-
function
|
|
2575
|
+
function sanitize(s) {
|
|
2524
2576
|
return s.includes(".") ? s : namespace + s;
|
|
2525
2577
|
}
|
|
2526
2578
|
function convertValidationRule(actionValidation) {
|
|
@@ -2617,42 +2669,6 @@ function validateParameterOrdering(parameterOrdering, parameterSet, actionApiNam
|
|
|
2617
2669
|
const extraneousParameters = parameterOrdering.filter((param) => !parameterSet.has(param));
|
|
2618
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;
|
|
2619
2671
|
}
|
|
2620
|
-
|
|
2621
|
-
// src/api/importOntologyEntity.ts
|
|
2622
|
-
function importOntologyEntity(e) {
|
|
2623
|
-
if (e.__type !== OntologyEntityTypeEnum.VALUE_TYPE) {
|
|
2624
|
-
importedTypes[e.__type][e.apiName] = e;
|
|
2625
|
-
return;
|
|
2626
|
-
}
|
|
2627
|
-
if (importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName] === void 0) {
|
|
2628
|
-
importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName] = [];
|
|
2629
|
-
}
|
|
2630
|
-
importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName].push(e);
|
|
2631
|
-
}
|
|
2632
|
-
|
|
2633
|
-
// src/api/defineImportSpt.ts
|
|
2634
|
-
function importSharedPropertyType(opts) {
|
|
2635
|
-
const {
|
|
2636
|
-
apiName,
|
|
2637
|
-
packageName,
|
|
2638
|
-
typeHint,
|
|
2639
|
-
array
|
|
2640
|
-
} = opts;
|
|
2641
|
-
const fullApiName = packageName === void 0 ? apiName : `${packageName}.${apiName}`;
|
|
2642
|
-
if (packageName !== void 0) {
|
|
2643
|
-
!!packageName.endsWith(".") ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "Package name format invalid ends with period") : invariant5__default.default(false) : void 0;
|
|
2644
|
-
!(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;
|
|
2645
|
-
}
|
|
2646
|
-
const spt = {
|
|
2647
|
-
apiName: fullApiName,
|
|
2648
|
-
type: typeHint,
|
|
2649
|
-
nonNameSpacedApiName: apiName,
|
|
2650
|
-
array: array ?? false,
|
|
2651
|
-
__type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE
|
|
2652
|
-
};
|
|
2653
|
-
importOntologyEntity(spt);
|
|
2654
|
-
return spt;
|
|
2655
|
-
}
|
|
2656
2672
|
function defineSharedPropertyType(sptDef) {
|
|
2657
2673
|
const apiName = namespace + sptDef.apiName;
|
|
2658
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;
|
|
@@ -2670,19 +2686,51 @@ function defineSharedPropertyType(sptDef) {
|
|
|
2670
2686
|
return fullSpt;
|
|
2671
2687
|
}
|
|
2672
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
|
+
|
|
2673
2721
|
// src/api/defineInterface.ts
|
|
2674
2722
|
function defineInterface(interfaceDef) {
|
|
2675
2723
|
const apiName = namespace + interfaceDef.apiName;
|
|
2676
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;
|
|
2677
2725
|
const properties = Object.fromEntries(Object.entries(interfaceDef.properties ?? {}).map(([unNamespacedPropApiName, type]) => {
|
|
2678
2726
|
if (typeof type === "object" && "propertyDefinition" in type) {
|
|
2679
|
-
const apiName3 =
|
|
2727
|
+
const apiName3 = combineApiNamespaceIfMissing(namespace, typeof type.propertyDefinition === "object" && "apiName" in type.propertyDefinition ? type.propertyDefinition.apiName : unNamespacedPropApiName);
|
|
2680
2728
|
return [apiName3, {
|
|
2681
2729
|
required: type.required,
|
|
2682
2730
|
sharedPropertyType: unifyBasePropertyDefinition(namespace, unNamespacedPropApiName, type.propertyDefinition)
|
|
2683
2731
|
}];
|
|
2684
2732
|
}
|
|
2685
|
-
const apiName2 =
|
|
2733
|
+
const apiName2 = combineApiNamespaceIfMissing(namespace, typeof type === "object" && "apiName" in type ? type.apiName : unNamespacedPropApiName);
|
|
2686
2734
|
return [apiName2, {
|
|
2687
2735
|
required: true,
|
|
2688
2736
|
sharedPropertyType: unifyBasePropertyDefinition(namespace, unNamespacedPropApiName, type)
|
|
@@ -2716,34 +2764,6 @@ function defineInterface(interfaceDef) {
|
|
|
2716
2764
|
updateOntology(fullInterface);
|
|
2717
2765
|
return fullInterface;
|
|
2718
2766
|
}
|
|
2719
|
-
function isPropertyTypeType(v) {
|
|
2720
|
-
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";
|
|
2721
|
-
}
|
|
2722
|
-
function mapSimplifiedStatusToInterfaceTypeStatus(status) {
|
|
2723
|
-
switch (status.type) {
|
|
2724
|
-
case "deprecated":
|
|
2725
|
-
return {
|
|
2726
|
-
type: "deprecated",
|
|
2727
|
-
deprecated: {
|
|
2728
|
-
message: status.message,
|
|
2729
|
-
deadline: status.deadline,
|
|
2730
|
-
replacedBy: void 0
|
|
2731
|
-
}
|
|
2732
|
-
};
|
|
2733
|
-
case "active":
|
|
2734
|
-
return {
|
|
2735
|
-
type: "active",
|
|
2736
|
-
active: {}
|
|
2737
|
-
};
|
|
2738
|
-
case "experimental":
|
|
2739
|
-
return {
|
|
2740
|
-
type: "experimental",
|
|
2741
|
-
experimental: {}
|
|
2742
|
-
};
|
|
2743
|
-
default:
|
|
2744
|
-
throw new Error(`Invalid status type: ${status.type}`);
|
|
2745
|
-
}
|
|
2746
|
-
}
|
|
2747
2767
|
function unifyBasePropertyDefinition(namespace2, apiName, type) {
|
|
2748
2768
|
if (typeof type === "string" || typeof type === "object" && !("apiName" in type)) {
|
|
2749
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;
|
|
@@ -2785,7 +2805,7 @@ function getLinkMeta(meta) {
|
|
|
2785
2805
|
displayName,
|
|
2786
2806
|
description
|
|
2787
2807
|
} = meta;
|
|
2788
|
-
const apiNameWithNamespace =
|
|
2808
|
+
const apiNameWithNamespace = combineApiNamespaceIfMissing(namespace, apiName);
|
|
2789
2809
|
const apiNameWithoutNamespace = withoutNamespace(apiNameWithNamespace);
|
|
2790
2810
|
return {
|
|
2791
2811
|
apiName: apiNameWithNamespace,
|
|
@@ -2835,7 +2855,7 @@ function convertLinkTypeMetadata(metadata) {
|
|
|
2835
2855
|
return {
|
|
2836
2856
|
apiName: metadata.apiName,
|
|
2837
2857
|
displayMetadata: {
|
|
2838
|
-
displayName: metadata.displayName ??
|
|
2858
|
+
displayName: metadata.displayName ?? uppercaseFirstLetter(metadata.apiName),
|
|
2839
2859
|
pluralDisplayName: metadata.pluralDisplayName ?? convertToPluralDisplayName(metadata.apiName),
|
|
2840
2860
|
visibility: metadata.visibility ?? "NORMAL",
|
|
2841
2861
|
groupDisplayName: metadata.groupDisplayName ?? ""
|
|
@@ -2931,6 +2951,40 @@ function defineValueType(valueTypeDef) {
|
|
|
2931
2951
|
return vt;
|
|
2932
2952
|
}
|
|
2933
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
|
+
|
|
2934
2988
|
// src/api/wrapWithProxy.ts
|
|
2935
2989
|
function wrapWithProxy(entity) {
|
|
2936
2990
|
return new Proxy(entity, {
|
|
@@ -2946,9 +3000,9 @@ exports.MODIFY_OBJECT_PARAMETER = MODIFY_OBJECT_PARAMETER;
|
|
|
2946
3000
|
exports.OntologyEntityTypeEnum = OntologyEntityTypeEnum;
|
|
2947
3001
|
exports.addDependency = addDependency;
|
|
2948
3002
|
exports.addNamespaceIfNone = addNamespaceIfNone;
|
|
2949
|
-
exports.convertToDisplayName =
|
|
3003
|
+
exports.convertToDisplayName = uppercaseFirstLetter;
|
|
2950
3004
|
exports.convertToPluralDisplayName = convertToPluralDisplayName;
|
|
2951
|
-
exports.convertType =
|
|
3005
|
+
exports.convertType = propertyTypeTypeToOntologyIrType;
|
|
2952
3006
|
exports.default = main;
|
|
2953
3007
|
exports.defineAction = defineAction;
|
|
2954
3008
|
exports.defineCreateInterfaceObjectAction = defineCreateInterfaceObjectAction;
|