@squiz/job-runner-lib 1.66.1
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/.env.example +1 -0
- package/CHANGELOG.md +726 -0
- package/build.js +17 -0
- package/jest.config.ts +24 -0
- package/jest.integration.config.ts +27 -0
- package/lib/TestHelpers.d.ts +18 -0
- package/lib/TestHelpers.js +97 -0
- package/lib/TestHelpers.js.map +1 -0
- package/lib/domains/__test__/createPackage.d.ts +3 -0
- package/lib/domains/__test__/createPackage.js +45 -0
- package/lib/domains/__test__/createPackage.js.map +1 -0
- package/lib/domains/__test__/loadAllUnitTestComponents.d.ts +3 -0
- package/lib/domains/__test__/loadAllUnitTestComponents.js +63 -0
- package/lib/domains/__test__/loadAllUnitTestComponents.js.map +1 -0
- package/lib/domains/component/component-context/__mocks__/mockedManifestModel.d.ts +3 -0
- package/lib/domains/component/component-context/__mocks__/mockedManifestModel.js +33 -0
- package/lib/domains/component/component-context/__mocks__/mockedManifestModel.js.map +1 -0
- package/lib/domains/component/component-context/__mocks__/mockedUriObj.d.ts +3 -0
- package/lib/domains/component/component-context/__mocks__/mockedUriObj.js +38 -0
- package/lib/domains/component/component-context/__mocks__/mockedUriObj.js.map +1 -0
- package/lib/domains/component/component-context/__mocks__/mockedUriObjPreview.d.ts +3 -0
- package/lib/domains/component/component-context/__mocks__/mockedUriObjPreview.js +38 -0
- package/lib/domains/component/component-context/__mocks__/mockedUriObjPreview.js.map +1 -0
- package/lib/domains/component/component-context/createComponentContextualFunctions.d.ts +23 -0
- package/lib/domains/component/component-context/createComponentContextualFunctions.js +75 -0
- package/lib/domains/component/component-context/createComponentContextualFunctions.js.map +1 -0
- package/lib/domains/component/component-context/createComponentContextualFunctions.spec.d.ts +1 -0
- package/lib/domains/component/component-context/createComponentContextualFunctions.spec.js +248 -0
- package/lib/domains/component/component-context/createComponentContextualFunctions.spec.js.map +1 -0
- package/lib/domains/component/errors/ComponentError.d.ts +12 -0
- package/lib/domains/component/errors/ComponentError.js +20 -0
- package/lib/domains/component/errors/ComponentError.js.map +1 -0
- package/lib/domains/component/errors/JobError.d.ts +10 -0
- package/lib/domains/component/errors/JobError.js +18 -0
- package/lib/domains/component/errors/JobError.js.map +1 -0
- package/lib/domains/component/index.d.ts +13 -0
- package/lib/domains/component/index.js +30 -0
- package/lib/domains/component/index.js.map +1 -0
- package/lib/domains/component/models/Component.d.ts +7 -0
- package/lib/domains/component/models/Component.js +13 -0
- package/lib/domains/component/models/Component.js.map +1 -0
- package/lib/domains/component/models/Component.spec.d.ts +1 -0
- package/lib/domains/component/models/Component.spec.js +18 -0
- package/lib/domains/component/models/Component.spec.js.map +1 -0
- package/lib/domains/component/models/ComponentVersion.d.ts +18 -0
- package/lib/domains/component/models/ComponentVersion.js +35 -0
- package/lib/domains/component/models/ComponentVersion.js.map +1 -0
- package/lib/domains/component/models/ComponentVersion.spec.d.ts +1 -0
- package/lib/domains/component/models/ComponentVersion.spec.js +55 -0
- package/lib/domains/component/models/ComponentVersion.spec.js.map +1 -0
- package/lib/domains/component/repositories/ComponentRepository.d.ts +12 -0
- package/lib/domains/component/repositories/ComponentRepository.integration.spec.d.ts +1 -0
- package/lib/domains/component/repositories/ComponentRepository.integration.spec.js +111 -0
- package/lib/domains/component/repositories/ComponentRepository.integration.spec.js.map +1 -0
- package/lib/domains/component/repositories/ComponentRepository.js +28 -0
- package/lib/domains/component/repositories/ComponentRepository.js.map +1 -0
- package/lib/domains/component/repositories/ComponentVersionRepository.d.ts +21 -0
- package/lib/domains/component/repositories/ComponentVersionRepository.integration.spec.d.ts +1 -0
- package/lib/domains/component/repositories/ComponentVersionRepository.integration.spec.js +378 -0
- package/lib/domains/component/repositories/ComponentVersionRepository.integration.spec.js.map +1 -0
- package/lib/domains/component/repositories/ComponentVersionRepository.js +83 -0
- package/lib/domains/component/repositories/ComponentVersionRepository.js.map +1 -0
- package/lib/domains/component/services/ComponentService.d.ts +40 -0
- package/lib/domains/component/services/ComponentService.integration.spec.d.ts +1 -0
- package/lib/domains/component/services/ComponentService.integration.spec.js +614 -0
- package/lib/domains/component/services/ComponentService.integration.spec.js.map +1 -0
- package/lib/domains/component/services/ComponentService.js +254 -0
- package/lib/domains/component/services/ComponentService.js.map +1 -0
- package/lib/domains/component/services/content-item-uri-resolver/ComponentContentUriResolverForPreview.d.ts +12 -0
- package/lib/domains/component/services/content-item-uri-resolver/ComponentContentUriResolverForPreview.js +15 -0
- package/lib/domains/component/services/content-item-uri-resolver/ComponentContentUriResolverForPreview.js.map +1 -0
- package/lib/domains/component/services/content-item-uri-resolver/ComponentContentUriResolverForPreview.spec.d.ts +1 -0
- package/lib/domains/component/services/content-item-uri-resolver/ComponentContentUriResolverForPreview.spec.js +75 -0
- package/lib/domains/component/services/content-item-uri-resolver/ComponentContentUriResolverForPreview.spec.js.map +1 -0
- package/lib/domains/component/utils/getComponentFileSystemFolder.d.ts +1 -0
- package/lib/domains/component/utils/getComponentFileSystemFolder.js +12 -0
- package/lib/domains/component/utils/getComponentFileSystemFolder.js.map +1 -0
- package/lib/domains/component/utils/getComponentFileSystemFolder.spec.d.ts +1 -0
- package/lib/domains/component/utils/getComponentFileSystemFolder.spec.js +13 -0
- package/lib/domains/component/utils/getComponentFileSystemFolder.spec.js.map +1 -0
- package/lib/domains/component/utils/getComponentName.d.ts +1 -0
- package/lib/domains/component/utils/getComponentName.js +8 -0
- package/lib/domains/component/utils/getComponentName.js.map +1 -0
- package/lib/domains/component/utils/getComponentName.spec.d.ts +1 -0
- package/lib/domains/component/utils/getComponentName.spec.js +9 -0
- package/lib/domains/component/utils/getComponentName.spec.js.map +1 -0
- package/lib/domains/component/utils/moveFilesAndDirectories.d.ts +1 -0
- package/lib/domains/component/utils/moveFilesAndDirectories.js +33 -0
- package/lib/domains/component/utils/moveFilesAndDirectories.js.map +1 -0
- package/lib/domains/component/utils/moveFilesAndDirectories.spec.d.ts +1 -0
- package/lib/domains/component/utils/moveFilesAndDirectories.spec.js +52 -0
- package/lib/domains/component/utils/moveFilesAndDirectories.spec.js.map +1 -0
- package/lib/domains/component/web-models/ComponentForWeb.d.ts +11 -0
- package/lib/domains/component/web-models/ComponentForWeb.js +3 -0
- package/lib/domains/component/web-models/ComponentForWeb.js.map +1 -0
- package/lib/domains/component/web-models/ComponentVersionWebModel.d.ts +15 -0
- package/lib/domains/component/web-models/ComponentVersionWebModel.js +3 -0
- package/lib/domains/component/web-models/ComponentVersionWebModel.js.map +1 -0
- package/lib/domains/component/web-models/ComponentsForWeb.d.ts +17 -0
- package/lib/domains/component/web-models/ComponentsForWeb.js +3 -0
- package/lib/domains/component/web-models/ComponentsForWeb.js.map +1 -0
- package/lib/domains/component-set/errors/InvalidEnvironmentVariablesError.d.ts +5 -0
- package/lib/domains/component-set/errors/InvalidEnvironmentVariablesError.js +14 -0
- package/lib/domains/component-set/errors/InvalidEnvironmentVariablesError.js.map +1 -0
- package/lib/domains/component-set/index.d.ts +13 -0
- package/lib/domains/component-set/index.js +30 -0
- package/lib/domains/component-set/index.js.map +1 -0
- package/lib/domains/component-set/models/ComponentSet.d.ts +20 -0
- package/lib/domains/component-set/models/ComponentSet.js +28 -0
- package/lib/domains/component-set/models/ComponentSet.js.map +1 -0
- package/lib/domains/component-set/models/ComponentSet.spec.d.ts +1 -0
- package/lib/domains/component-set/models/ComponentSet.spec.js +45 -0
- package/lib/domains/component-set/models/ComponentSet.spec.js.map +1 -0
- package/lib/domains/component-set/models/ComponentSetComponentVersion.d.ts +23 -0
- package/lib/domains/component-set/models/ComponentSetComponentVersion.js +29 -0
- package/lib/domains/component-set/models/ComponentSetComponentVersion.js.map +1 -0
- package/lib/domains/component-set/models/ComponentSetComponentVersion.spec.d.ts +1 -0
- package/lib/domains/component-set/models/ComponentSetComponentVersion.spec.js +83 -0
- package/lib/domains/component-set/models/ComponentSetComponentVersion.spec.js.map +1 -0
- package/lib/domains/component-set/models/ComponentSetComponentVersionEditable.d.ts +12 -0
- package/lib/domains/component-set/models/ComponentSetComponentVersionEditable.js +57 -0
- package/lib/domains/component-set/models/ComponentSetComponentVersionEditable.js.map +1 -0
- package/lib/domains/component-set/models/ComponentSetComponentVersionEditable.spec.d.ts +1 -0
- package/lib/domains/component-set/models/ComponentSetComponentVersionEditable.spec.js +60 -0
- package/lib/domains/component-set/models/ComponentSetComponentVersionEditable.spec.js.map +1 -0
- package/lib/domains/component-set/models/ComponentSetComponentVersionExcluded.d.ts +11 -0
- package/lib/domains/component-set/models/ComponentSetComponentVersionExcluded.js +17 -0
- package/lib/domains/component-set/models/ComponentSetComponentVersionExcluded.js.map +1 -0
- package/lib/domains/component-set/models/ComponentSetComponentVersionExcluded.spec.d.ts +1 -0
- package/lib/domains/component-set/models/ComponentSetComponentVersionExcluded.spec.js +34 -0
- package/lib/domains/component-set/models/ComponentSetComponentVersionExcluded.spec.js.map +1 -0
- package/lib/domains/component-set/models/ComponentSetRule.d.ts +12 -0
- package/lib/domains/component-set/models/ComponentSetRule.js +50 -0
- package/lib/domains/component-set/models/ComponentSetRule.js.map +1 -0
- package/lib/domains/component-set/models/ComponentSetRule.spec.d.ts +1 -0
- package/lib/domains/component-set/models/ComponentSetRule.spec.js +29 -0
- package/lib/domains/component-set/models/ComponentSetRule.spec.js.map +1 -0
- package/lib/domains/component-set/repositories/ComponentSetComponentVersionEditableRepository.d.ts +10 -0
- package/lib/domains/component-set/repositories/ComponentSetComponentVersionEditableRepository.integration.spec.d.ts +1 -0
- package/lib/domains/component-set/repositories/ComponentSetComponentVersionEditableRepository.integration.spec.js +127 -0
- package/lib/domains/component-set/repositories/ComponentSetComponentVersionEditableRepository.integration.spec.js.map +1 -0
- package/lib/domains/component-set/repositories/ComponentSetComponentVersionEditableRepository.js +37 -0
- package/lib/domains/component-set/repositories/ComponentSetComponentVersionEditableRepository.js.map +1 -0
- package/lib/domains/component-set/repositories/ComponentSetComponentVersionExcludedRepository.d.ts +10 -0
- package/lib/domains/component-set/repositories/ComponentSetComponentVersionExcludedRepository.integration.spec.d.ts +1 -0
- package/lib/domains/component-set/repositories/ComponentSetComponentVersionExcludedRepository.integration.spec.js +127 -0
- package/lib/domains/component-set/repositories/ComponentSetComponentVersionExcludedRepository.integration.spec.js.map +1 -0
- package/lib/domains/component-set/repositories/ComponentSetComponentVersionExcludedRepository.js +37 -0
- package/lib/domains/component-set/repositories/ComponentSetComponentVersionExcludedRepository.js.map +1 -0
- package/lib/domains/component-set/repositories/ComponentSetComponentVersionRepository.d.ts +10 -0
- package/lib/domains/component-set/repositories/ComponentSetComponentVersionRepository.integration.spec.d.ts +1 -0
- package/lib/domains/component-set/repositories/ComponentSetComponentVersionRepository.integration.spec.js +163 -0
- package/lib/domains/component-set/repositories/ComponentSetComponentVersionRepository.integration.spec.js.map +1 -0
- package/lib/domains/component-set/repositories/ComponentSetComponentVersionRepository.js +22 -0
- package/lib/domains/component-set/repositories/ComponentSetComponentVersionRepository.js.map +1 -0
- package/lib/domains/component-set/repositories/ComponentSetRepository.d.ts +13 -0
- package/lib/domains/component-set/repositories/ComponentSetRepository.integration.spec.d.ts +1 -0
- package/lib/domains/component-set/repositories/ComponentSetRepository.integration.spec.js +161 -0
- package/lib/domains/component-set/repositories/ComponentSetRepository.integration.spec.js.map +1 -0
- package/lib/domains/component-set/repositories/ComponentSetRepository.js +48 -0
- package/lib/domains/component-set/repositories/ComponentSetRepository.js.map +1 -0
- package/lib/domains/component-set/repositories/ComponentSetRuleRepository.d.ts +13 -0
- package/lib/domains/component-set/repositories/ComponentSetRuleRepository.integration.spec.d.ts +1 -0
- package/lib/domains/component-set/repositories/ComponentSetRuleRepository.integration.spec.js +88 -0
- package/lib/domains/component-set/repositories/ComponentSetRuleRepository.integration.spec.js.map +1 -0
- package/lib/domains/component-set/repositories/ComponentSetRuleRepository.js +55 -0
- package/lib/domains/component-set/repositories/ComponentSetRuleRepository.js.map +1 -0
- package/lib/domains/component-set/services/ComponentSetRuleService.d.ts +10 -0
- package/lib/domains/component-set/services/ComponentSetRuleService.integration.spec.d.ts +1 -0
- package/lib/domains/component-set/services/ComponentSetRuleService.integration.spec.js +107 -0
- package/lib/domains/component-set/services/ComponentSetRuleService.integration.spec.js.map +1 -0
- package/lib/domains/component-set/services/ComponentSetRuleService.js +23 -0
- package/lib/domains/component-set/services/ComponentSetRuleService.js.map +1 -0
- package/lib/domains/component-set/services/ComponentSetService.d.ts +37 -0
- package/lib/domains/component-set/services/ComponentSetService.js +13 -0
- package/lib/domains/component-set/services/ComponentSetService.js.map +1 -0
- package/lib/domains/component-set/services/ComponentSetService.spec.d.ts +1 -0
- package/lib/domains/component-set/services/ComponentSetService.spec.js +120 -0
- package/lib/domains/component-set/services/ComponentSetService.spec.js.map +1 -0
- package/lib/domains/component-set/services/ComponentSetServiceForLocalDev.d.ts +24 -0
- package/lib/domains/component-set/services/ComponentSetServiceForLocalDev.js +85 -0
- package/lib/domains/component-set/services/ComponentSetServiceForLocalDev.js.map +1 -0
- package/lib/domains/component-set/services/ComponentSetServiceForLocalDev.spec.d.ts +1 -0
- package/lib/domains/component-set/services/ComponentSetServiceForLocalDev.spec.js +141 -0
- package/lib/domains/component-set/services/ComponentSetServiceForLocalDev.spec.js.map +1 -0
- package/lib/domains/component-set/services/ComponentSetServiceForProduction.d.ts +53 -0
- package/lib/domains/component-set/services/ComponentSetServiceForProduction.integration.spec.d.ts +1 -0
- package/lib/domains/component-set/services/ComponentSetServiceForProduction.integration.spec.js +2565 -0
- package/lib/domains/component-set/services/ComponentSetServiceForProduction.integration.spec.js.map +1 -0
- package/lib/domains/component-set/services/ComponentSetServiceForProduction.js +601 -0
- package/lib/domains/component-set/services/ComponentSetServiceForProduction.js.map +1 -0
- package/lib/domains/component-set/services/EnvironmentVariables.d.ts +1 -0
- package/lib/domains/component-set/services/EnvironmentVariables.js +3 -0
- package/lib/domains/component-set/services/EnvironmentVariables.js.map +1 -0
- package/lib/domains/component-set/services/Headers.d.ts +1 -0
- package/lib/domains/component-set/services/Headers.js +3 -0
- package/lib/domains/component-set/services/Headers.js.map +1 -0
- package/lib/domains/component-set/services/RuntimeComponentSet.d.ts +6 -0
- package/lib/domains/component-set/services/RuntimeComponentSet.js +3 -0
- package/lib/domains/component-set/services/RuntimeComponentSet.js.map +1 -0
- package/lib/domains/component-set/web-models/ComponentSetComponentVersionForWeb.d.ts +5 -0
- package/lib/domains/component-set/web-models/ComponentSetComponentVersionForWeb.js +3 -0
- package/lib/domains/component-set/web-models/ComponentSetComponentVersionForWeb.js.map +1 -0
- package/lib/domains/component-set/web-models/ComponentSetForWeb.d.ts +64 -0
- package/lib/domains/component-set/web-models/ComponentSetForWeb.js +22 -0
- package/lib/domains/component-set/web-models/ComponentSetForWeb.js.map +1 -0
- package/lib/domains/content/index.d.ts +4 -0
- package/lib/domains/content/index.js +21 -0
- package/lib/domains/content/index.js.map +1 -0
- package/lib/domains/content/services/ComponentContentSchemaService.d.ts +9 -0
- package/lib/domains/content/services/ComponentContentSchemaService.js +45 -0
- package/lib/domains/content/services/ComponentContentSchemaService.js.map +1 -0
- package/lib/domains/content/services/ComponentContentSchemaService.spec.d.ts +1 -0
- package/lib/domains/content/services/ComponentContentSchemaService.spec.js +240 -0
- package/lib/domains/content/services/ComponentContentSchemaService.spec.js.map +1 -0
- package/lib/domains/content/services/ContentItemService.d.ts +7 -0
- package/lib/domains/content/services/ContentItemService.js +36 -0
- package/lib/domains/content/services/ContentItemService.js.map +1 -0
- package/lib/domains/content/services/ContentItemService.spec.d.ts +1 -0
- package/lib/domains/content/services/ContentItemService.spec.js +95 -0
- package/lib/domains/content/services/ContentItemService.spec.js.map +1 -0
- package/lib/domains/content/services/DynamicContentItemService.d.ts +8 -0
- package/lib/domains/content/services/DynamicContentItemService.js +31 -0
- package/lib/domains/content/services/DynamicContentItemService.js.map +1 -0
- package/lib/domains/content/services/DynamicContentItemService.spec.d.ts +1 -0
- package/lib/domains/content/services/DynamicContentItemService.spec.js +81 -0
- package/lib/domains/content/services/DynamicContentItemService.spec.js.map +1 -0
- package/lib/domains/content/utils/getContentSchemaName.d.ts +1 -0
- package/lib/domains/content/utils/getContentSchemaName.js +8 -0
- package/lib/domains/content/utils/getContentSchemaName.js.map +1 -0
- package/lib/domains/content/utils/getContentSchemaName.spec.d.ts +1 -0
- package/lib/domains/content/utils/getContentSchemaName.spec.js +9 -0
- package/lib/domains/content/utils/getContentSchemaName.spec.js.map +1 -0
- package/lib/domains/db/ComponentConnectionManager.d.ts +3 -0
- package/lib/domains/db/ComponentConnectionManager.js +3 -0
- package/lib/domains/db/ComponentConnectionManager.js.map +1 -0
- package/lib/domains/db/ComponentRepositories.d.ts +19 -0
- package/lib/domains/db/ComponentRepositories.js +23 -0
- package/lib/domains/db/ComponentRepositories.js.map +1 -0
- package/lib/domains/db/createConnectionManager.d.ts +5 -0
- package/lib/domains/db/createConnectionManager.js +16 -0
- package/lib/domains/db/createConnectionManager.js.map +1 -0
- package/lib/domains/db/index.d.ts +3 -0
- package/lib/domains/db/index.js +20 -0
- package/lib/domains/db/index.js.map +1 -0
- package/lib/domains/db/migration-list.d.ts +2 -0
- package/lib/domains/db/migration-list.js +19 -0
- package/lib/domains/db/migration-list.js.map +1 -0
- package/lib/domains/job/ParsePartitionKey/ParsePartitionKey.d.ts +2 -0
- package/lib/domains/job/ParsePartitionKey/ParsePartitionKey.js +24 -0
- package/lib/domains/job/ParsePartitionKey/ParsePartitionKey.js.map +1 -0
- package/lib/domains/job/ParsePartitionKey/ParsePartitionKey.spec.d.ts +5 -0
- package/lib/domains/job/ParsePartitionKey/ParsePartitionKey.spec.js +24 -0
- package/lib/domains/job/ParsePartitionKey/ParsePartitionKey.spec.js.map +1 -0
- package/lib/domains/job/ParsePartitionKey/index.d.ts +1 -0
- package/lib/domains/job/ParsePartitionKey/index.js +18 -0
- package/lib/domains/job/ParsePartitionKey/index.js.map +1 -0
- package/lib/domains/job/constants/JobExecutionStatus.constants.d.ts +8 -0
- package/lib/domains/job/constants/JobExecutionStatus.constants.js +12 -0
- package/lib/domains/job/constants/JobExecutionStatus.constants.js.map +1 -0
- package/lib/domains/job/constants/QueryParams.d.ts +14 -0
- package/lib/domains/job/constants/QueryParams.js +19 -0
- package/lib/domains/job/constants/QueryParams.js.map +1 -0
- package/lib/domains/job/constants/Repository.constants.d.ts +12 -0
- package/lib/domains/job/constants/Repository.constants.js +15 -0
- package/lib/domains/job/constants/Repository.constants.js.map +1 -0
- package/lib/domains/job/core/dynamoClient.mock.d.ts +8 -0
- package/lib/domains/job/core/dynamoClient.mock.js +32 -0
- package/lib/domains/job/core/dynamoClient.mock.js.map +1 -0
- package/lib/domains/job/core/pagination/index.d.ts +3 -0
- package/lib/domains/job/core/pagination/index.js +20 -0
- package/lib/domains/job/core/pagination/index.js.map +1 -0
- package/lib/domains/job/core/pagination/model/PageQuery.d.ts +28 -0
- package/lib/domains/job/core/pagination/model/PageQuery.js +7 -0
- package/lib/domains/job/core/pagination/model/PageQuery.js.map +1 -0
- package/lib/domains/job/core/pagination/model/PaginationInfo.d.ts +35 -0
- package/lib/domains/job/core/pagination/model/PaginationInfo.js +7 -0
- package/lib/domains/job/core/pagination/model/PaginationInfo.js.map +1 -0
- package/lib/domains/job/core/pagination/model/PaginationKey.d.ts +2 -0
- package/lib/domains/job/core/pagination/model/PaginationKey.js +3 -0
- package/lib/domains/job/core/pagination/model/PaginationKey.js.map +1 -0
- package/lib/domains/job/core/pagination/model/PaginationLinks.d.ts +27 -0
- package/lib/domains/job/core/pagination/model/PaginationLinks.js +7 -0
- package/lib/domains/job/core/pagination/model/PaginationLinks.js.map +1 -0
- package/lib/domains/job/core/pagination/model/PaginationQueryParams.d.ts +14 -0
- package/lib/domains/job/core/pagination/model/PaginationQueryParams.js +3 -0
- package/lib/domains/job/core/pagination/model/PaginationQueryParams.js.map +1 -0
- package/lib/domains/job/core/pagination/model/PaginationQueryResponse.d.ts +24 -0
- package/lib/domains/job/core/pagination/model/PaginationQueryResponse.js +7 -0
- package/lib/domains/job/core/pagination/model/PaginationQueryResponse.js.map +1 -0
- package/lib/domains/job/core/pagination/model/PaginationResponse.d.ts +43 -0
- package/lib/domains/job/core/pagination/model/PaginationResponse.js +7 -0
- package/lib/domains/job/core/pagination/model/PaginationResponse.js.map +1 -0
- package/lib/domains/job/core/pagination/model/PaginationTypes.d.ts +39 -0
- package/lib/domains/job/core/pagination/model/PaginationTypes.js +29 -0
- package/lib/domains/job/core/pagination/model/PaginationTypes.js.map +1 -0
- package/lib/domains/job/core/pagination/model/index.d.ts +8 -0
- package/lib/domains/job/core/pagination/model/index.js +25 -0
- package/lib/domains/job/core/pagination/model/index.js.map +1 -0
- package/lib/domains/job/core/pagination/services/PaginationService.d.ts +41 -0
- package/lib/domains/job/core/pagination/services/PaginationService.js +129 -0
- package/lib/domains/job/core/pagination/services/PaginationService.js.map +1 -0
- package/lib/domains/job/core/pagination/services/PaginationService.spec.d.ts +5 -0
- package/lib/domains/job/core/pagination/services/PaginationService.spec.js +179 -0
- package/lib/domains/job/core/pagination/services/PaginationService.spec.js.map +1 -0
- package/lib/domains/job/core/pagination/services/index.d.ts +1 -0
- package/lib/domains/job/core/pagination/services/index.js +18 -0
- package/lib/domains/job/core/pagination/services/index.js.map +1 -0
- package/lib/domains/job/core/pagination/utils/PaginationUtils.d.ts +48 -0
- package/lib/domains/job/core/pagination/utils/PaginationUtils.js +139 -0
- package/lib/domains/job/core/pagination/utils/PaginationUtils.js.map +1 -0
- package/lib/domains/job/core/pagination/utils/PaginationUtils.spec.d.ts +5 -0
- package/lib/domains/job/core/pagination/utils/PaginationUtils.spec.js +212 -0
- package/lib/domains/job/core/pagination/utils/PaginationUtils.spec.js.map +1 -0
- package/lib/domains/job/core/pagination/utils/index.d.ts +1 -0
- package/lib/domains/job/core/pagination/utils/index.js +18 -0
- package/lib/domains/job/core/pagination/utils/index.js.map +1 -0
- package/lib/domains/job/errors/BadRequestError.d.ts +15 -0
- package/lib/domains/job/errors/BadRequestError.js +23 -0
- package/lib/domains/job/errors/BadRequestError.js.map +1 -0
- package/lib/domains/job/errors/Error.constants.d.ts +32 -0
- package/lib/domains/job/errors/Error.constants.js +36 -0
- package/lib/domains/job/errors/Error.constants.js.map +1 -0
- package/lib/domains/job/errors/ErrorWithHttpStatusCode.d.ts +16 -0
- package/lib/domains/job/errors/ErrorWithHttpStatusCode.js +23 -0
- package/lib/domains/job/errors/ErrorWithHttpStatusCode.js.map +1 -0
- package/lib/domains/job/errors/ExecutionStatusError.d.ts +3 -0
- package/lib/domains/job/errors/ExecutionStatusError.js +11 -0
- package/lib/domains/job/errors/ExecutionStatusError.js.map +1 -0
- package/lib/domains/job/errors/InternalServerError.d.ts +15 -0
- package/lib/domains/job/errors/InternalServerError.js +23 -0
- package/lib/domains/job/errors/InternalServerError.js.map +1 -0
- package/lib/domains/job/errors/NotFoundError.d.ts +14 -0
- package/lib/domains/job/errors/NotFoundError.js +22 -0
- package/lib/domains/job/errors/NotFoundError.js.map +1 -0
- package/lib/domains/job/errors/NotImplementedError.d.ts +15 -0
- package/lib/domains/job/errors/NotImplementedError.js +23 -0
- package/lib/domains/job/errors/NotImplementedError.js.map +1 -0
- package/lib/domains/job/errors/UnprocessableContent.d.ts +15 -0
- package/lib/domains/job/errors/UnprocessableContent.js +23 -0
- package/lib/domains/job/errors/UnprocessableContent.js.map +1 -0
- package/lib/domains/job/errors/index.d.ts +8 -0
- package/lib/domains/job/errors/index.js +25 -0
- package/lib/domains/job/errors/index.js.map +1 -0
- package/lib/domains/job/index.d.ts +16 -0
- package/lib/domains/job/index.js +33 -0
- package/lib/domains/job/index.js.map +1 -0
- package/lib/domains/job/manifest/JobManifestTypes.d.ts +126 -0
- package/lib/domains/job/manifest/JobManifestTypes.js +7 -0
- package/lib/domains/job/manifest/JobManifestTypes.js.map +1 -0
- package/lib/domains/job/manifest/JobManifestV1.d.ts +17 -0
- package/lib/domains/job/manifest/JobManifestV1.js +58 -0
- package/lib/domains/job/manifest/JobManifestV1.js.map +1 -0
- package/lib/domains/job/manifest/JobManifestV1.spec.d.ts +1 -0
- package/lib/domains/job/manifest/JobManifestV1.spec.js +136 -0
- package/lib/domains/job/manifest/JobManifestV1.spec.js.map +1 -0
- package/lib/domains/job/manifest/index.d.ts +5 -0
- package/lib/domains/job/manifest/index.js +22 -0
- package/lib/domains/job/manifest/index.js.map +1 -0
- package/lib/domains/job/manifest/mocks/JobManifest.mock.d.ts +7 -0
- package/lib/domains/job/manifest/mocks/JobManifest.mock.js +36 -0
- package/lib/domains/job/manifest/mocks/JobManifest.mock.js.map +1 -0
- package/lib/domains/job/manifest/mocks/JobManifestDto.mock.d.ts +7 -0
- package/lib/domains/job/manifest/mocks/JobManifestDto.mock.js +48 -0
- package/lib/domains/job/manifest/mocks/JobManifestDto.mock.js.map +1 -0
- package/lib/domains/job/manifest/mocks/JobManifestRecord.mock.d.ts +7 -0
- package/lib/domains/job/manifest/mocks/JobManifestRecord.mock.js +38 -0
- package/lib/domains/job/manifest/mocks/JobManifestRecord.mock.js.map +1 -0
- package/lib/domains/job/manifest/mocks/JobManifestRequest.mock.d.ts +6 -0
- package/lib/domains/job/manifest/mocks/JobManifestRequest.mock.js +29 -0
- package/lib/domains/job/manifest/mocks/JobManifestRequest.mock.js.map +1 -0
- package/lib/domains/job/model/Base/Base.d.ts +40 -0
- package/lib/domains/job/model/Base/Base.js +3 -0
- package/lib/domains/job/model/Base/Base.js.map +1 -0
- package/lib/domains/job/model/Base/index.d.ts +1 -0
- package/lib/domains/job/model/Base/index.js +18 -0
- package/lib/domains/job/model/Base/index.js.map +1 -0
- package/lib/domains/job/model/Job/Job.d.ts +85 -0
- package/lib/domains/job/model/Job/Job.js +7 -0
- package/lib/domains/job/model/Job/Job.js.map +1 -0
- package/lib/domains/job/model/Job/index.d.ts +5 -0
- package/lib/domains/job/model/Job/index.js +22 -0
- package/lib/domains/job/model/Job/index.js.map +1 -0
- package/lib/domains/job/model/Job/mocks/Job.mock.d.ts +7 -0
- package/lib/domains/job/model/Job/mocks/Job.mock.js +28 -0
- package/lib/domains/job/model/Job/mocks/Job.mock.js.map +1 -0
- package/lib/domains/job/model/Job/mocks/JobDto.mock.d.ts +7 -0
- package/lib/domains/job/model/Job/mocks/JobDto.mock.js +39 -0
- package/lib/domains/job/model/Job/mocks/JobDto.mock.js.map +1 -0
- package/lib/domains/job/model/Job/mocks/JobRecord.mock.d.ts +7 -0
- package/lib/domains/job/model/Job/mocks/JobRecord.mock.js +29 -0
- package/lib/domains/job/model/Job/mocks/JobRecord.mock.js.map +1 -0
- package/lib/domains/job/model/Job/mocks/JobRequest.mock.d.ts +6 -0
- package/lib/domains/job/model/Job/mocks/JobRequest.mock.js +21 -0
- package/lib/domains/job/model/Job/mocks/JobRequest.mock.js.map +1 -0
- package/lib/domains/job/model/JobContext/JobContext.d.ts +87 -0
- package/lib/domains/job/model/JobContext/JobContext.js +7 -0
- package/lib/domains/job/model/JobContext/JobContext.js.map +1 -0
- package/lib/domains/job/model/JobContext/index.d.ts +5 -0
- package/lib/domains/job/model/JobContext/index.js +22 -0
- package/lib/domains/job/model/JobContext/index.js.map +1 -0
- package/lib/domains/job/model/JobContext/mocks/JobContext.mock.d.ts +7 -0
- package/lib/domains/job/model/JobContext/mocks/JobContext.mock.js +35 -0
- package/lib/domains/job/model/JobContext/mocks/JobContext.mock.js.map +1 -0
- package/lib/domains/job/model/JobContext/mocks/JobContextDto.mock.d.ts +7 -0
- package/lib/domains/job/model/JobContext/mocks/JobContextDto.mock.js +46 -0
- package/lib/domains/job/model/JobContext/mocks/JobContextDto.mock.js.map +1 -0
- package/lib/domains/job/model/JobContext/mocks/JobContextRecord.mock.d.ts +7 -0
- package/lib/domains/job/model/JobContext/mocks/JobContextRecord.mock.js +34 -0
- package/lib/domains/job/model/JobContext/mocks/JobContextRecord.mock.js.map +1 -0
- package/lib/domains/job/model/JobContext/mocks/JobContextRequest.mock.d.ts +6 -0
- package/lib/domains/job/model/JobContext/mocks/JobContextRequest.mock.js +25 -0
- package/lib/domains/job/model/JobContext/mocks/JobContextRequest.mock.js.map +1 -0
- package/lib/domains/job/model/JobExecution/JobExecution.d.ts +189 -0
- package/lib/domains/job/model/JobExecution/JobExecution.js +7 -0
- package/lib/domains/job/model/JobExecution/JobExecution.js.map +1 -0
- package/lib/domains/job/model/JobExecution/index.d.ts +5 -0
- package/lib/domains/job/model/JobExecution/index.js +22 -0
- package/lib/domains/job/model/JobExecution/index.js.map +1 -0
- package/lib/domains/job/model/JobExecution/mocks/JobExecution.mock.d.ts +7 -0
- package/lib/domains/job/model/JobExecution/mocks/JobExecution.mock.js +45 -0
- package/lib/domains/job/model/JobExecution/mocks/JobExecution.mock.js.map +1 -0
- package/lib/domains/job/model/JobExecution/mocks/JobExecutionDto.mock.d.ts +7 -0
- package/lib/domains/job/model/JobExecution/mocks/JobExecutionDto.mock.js +64 -0
- package/lib/domains/job/model/JobExecution/mocks/JobExecutionDto.mock.js.map +1 -0
- package/lib/domains/job/model/JobExecution/mocks/JobExecutionRecord.mock.d.ts +7 -0
- package/lib/domains/job/model/JobExecution/mocks/JobExecutionRecord.mock.js +48 -0
- package/lib/domains/job/model/JobExecution/mocks/JobExecutionRecord.mock.js.map +1 -0
- package/lib/domains/job/model/JobExecution/mocks/JobExecutionRequest.mock.d.ts +6 -0
- package/lib/domains/job/model/JobExecution/mocks/JobExecutionRequest.mock.js +25 -0
- package/lib/domains/job/model/JobExecution/mocks/JobExecutionRequest.mock.js.map +1 -0
- package/lib/domains/job/repository/AbstractRepository.d.ts +73 -0
- package/lib/domains/job/repository/AbstractRepository.js +174 -0
- package/lib/domains/job/repository/AbstractRepository.js.map +1 -0
- package/lib/domains/job/repository/JobContextRepository/JobContextRepository.d.ts +24 -0
- package/lib/domains/job/repository/JobContextRepository/JobContextRepository.js +169 -0
- package/lib/domains/job/repository/JobContextRepository/JobContextRepository.js.map +1 -0
- package/lib/domains/job/repository/JobContextRepository/JobContextRepository.spec.d.ts +5 -0
- package/lib/domains/job/repository/JobContextRepository/JobContextRepository.spec.js +246 -0
- package/lib/domains/job/repository/JobContextRepository/JobContextRepository.spec.js.map +1 -0
- package/lib/domains/job/repository/JobExecutionRepository/JobExecutionRepository.d.ts +47 -0
- package/lib/domains/job/repository/JobExecutionRepository/JobExecutionRepository.js +276 -0
- package/lib/domains/job/repository/JobExecutionRepository/JobExecutionRepository.js.map +1 -0
- package/lib/domains/job/repository/JobExecutionRepository/JobExecutionRepository.spec.d.ts +5 -0
- package/lib/domains/job/repository/JobExecutionRepository/JobExecutionRepository.spec.js +296 -0
- package/lib/domains/job/repository/JobExecutionRepository/JobExecutionRepository.spec.js.map +1 -0
- package/lib/domains/job/repository/JobManifestRepository/JobManifestRepository.d.ts +16 -0
- package/lib/domains/job/repository/JobManifestRepository/JobManifestRepository.js +133 -0
- package/lib/domains/job/repository/JobManifestRepository/JobManifestRepository.js.map +1 -0
- package/lib/domains/job/repository/JobManifestRepository/JobManifestRepository.spec.d.ts +5 -0
- package/lib/domains/job/repository/JobManifestRepository/JobManifestRepository.spec.js +162 -0
- package/lib/domains/job/repository/JobManifestRepository/JobManifestRepository.spec.js.map +1 -0
- package/lib/domains/job/repository/JobRepository/JobRepository.d.ts +30 -0
- package/lib/domains/job/repository/JobRepository/JobRepository.js +189 -0
- package/lib/domains/job/repository/JobRepository/JobRepository.js.map +1 -0
- package/lib/domains/job/repository/JobRepository/JobRepository.spec.d.ts +5 -0
- package/lib/domains/job/repository/JobRepository/JobRepository.spec.js +270 -0
- package/lib/domains/job/repository/JobRepository/JobRepository.spec.js.map +1 -0
- package/lib/domains/job/repository/index.d.ts +5 -0
- package/lib/domains/job/repository/index.js +22 -0
- package/lib/domains/job/repository/index.js.map +1 -0
- package/lib/domains/job/repository/mocks/mockIoc.d.ts +5 -0
- package/lib/domains/job/repository/mocks/mockIoc.js +40 -0
- package/lib/domains/job/repository/mocks/mockIoc.js.map +1 -0
- package/lib/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.d.ts +13 -0
- package/lib/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.defs.d.ts +39 -0
- package/lib/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.defs.js +3 -0
- package/lib/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.defs.js.map +1 -0
- package/lib/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.js +139 -0
- package/lib/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.js.map +1 -0
- package/lib/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.spec.d.ts +1 -0
- package/lib/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.spec.js +78 -0
- package/lib/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.spec.js.map +1 -0
- package/lib/domains/job/services/index.d.ts +1 -0
- package/lib/domains/job/services/index.js +18 -0
- package/lib/domains/job/services/index.js.map +1 -0
- package/lib/domains/job/singletonProvider.d.ts +6 -0
- package/lib/domains/job/singletonProvider.js +14 -0
- package/lib/domains/job/singletonProvider.js.map +1 -0
- package/lib/domains/job/transientProvider.d.ts +6 -0
- package/lib/domains/job/transientProvider.js +14 -0
- package/lib/domains/job/transientProvider.js.map +1 -0
- package/lib/domains/job/utils/SlackClient/SlackClient.d.ts +44 -0
- package/lib/domains/job/utils/SlackClient/SlackClient.js +113 -0
- package/lib/domains/job/utils/SlackClient/SlackClient.js.map +1 -0
- package/lib/domains/job/utils/SlackClient/SlackClient.spec.d.ts +5 -0
- package/lib/domains/job/utils/SlackClient/SlackClient.spec.js +116 -0
- package/lib/domains/job/utils/SlackClient/SlackClient.spec.js.map +1 -0
- package/lib/domains/job/utils/SlackClient/types/SlackClient.types.d.ts +56 -0
- package/lib/domains/job/utils/SlackClient/types/SlackClient.types.js +28 -0
- package/lib/domains/job/utils/SlackClient/types/SlackClient.types.js.map +1 -0
- package/lib/domains/job/utils/SortByTimeQueued/SortByTimeQueued.d.ts +9 -0
- package/lib/domains/job/utils/SortByTimeQueued/SortByTimeQueued.js +21 -0
- package/lib/domains/job/utils/SortByTimeQueued/SortByTimeQueued.js.map +1 -0
- package/lib/domains/job/utils/SortByTimeQueued/SortByTimeQueued.spec.d.ts +5 -0
- package/lib/domains/job/utils/SortByTimeQueued/SortByTimeQueued.spec.js +26 -0
- package/lib/domains/job/utils/SortByTimeQueued/SortByTimeQueued.spec.js.map +1 -0
- package/lib/domains/job/utils/index.d.ts +3 -0
- package/lib/domains/job/utils/index.js +20 -0
- package/lib/domains/job/utils/index.js.map +1 -0
- package/lib/domains/manifest/AbstractManifest.d.ts +38 -0
- package/lib/domains/manifest/AbstractManifest.js +45 -0
- package/lib/domains/manifest/AbstractManifest.js.map +1 -0
- package/lib/domains/manifest/ManifestModel.d.ts +7 -0
- package/lib/domains/manifest/ManifestModel.js +3 -0
- package/lib/domains/manifest/ManifestModel.js.map +1 -0
- package/lib/domains/manifest/ManifestV1.d.ts +18 -0
- package/lib/domains/manifest/ManifestV1.js +124 -0
- package/lib/domains/manifest/ManifestV1.js.map +1 -0
- package/lib/domains/manifest/ManifestV1.spec.d.ts +1 -0
- package/lib/domains/manifest/ManifestV1.spec.js +347 -0
- package/lib/domains/manifest/ManifestV1.spec.js.map +1 -0
- package/lib/domains/manifest/errors/ManifestLocationError.d.ts +5 -0
- package/lib/domains/manifest/errors/ManifestLocationError.js +13 -0
- package/lib/domains/manifest/errors/ManifestLocationError.js.map +1 -0
- package/lib/domains/manifest/errors/ManifestValidationError.d.ts +3 -0
- package/lib/domains/manifest/errors/ManifestValidationError.js +12 -0
- package/lib/domains/manifest/errors/ManifestValidationError.js.map +1 -0
- package/lib/domains/manifest/index.d.ts +16 -0
- package/lib/domains/manifest/index.js +33 -0
- package/lib/domains/manifest/index.js.map +1 -0
- package/lib/domains/manifest/services/AbstractManifestService.d.ts +49 -0
- package/lib/domains/manifest/services/AbstractManifestService.js +235 -0
- package/lib/domains/manifest/services/AbstractManifestService.js.map +1 -0
- package/lib/domains/manifest/services/AbstractManifestService.spec.d.ts +1 -0
- package/lib/domains/manifest/services/AbstractManifestService.spec.js +301 -0
- package/lib/domains/manifest/services/AbstractManifestService.spec.js.map +1 -0
- package/lib/domains/manifest/services/ComponentFunctionService.d.ts +35 -0
- package/lib/domains/manifest/services/ComponentFunctionService.js +129 -0
- package/lib/domains/manifest/services/ComponentFunctionService.js.map +1 -0
- package/lib/domains/manifest/services/ComponentFunctionService.spec.d.ts +1 -0
- package/lib/domains/manifest/services/ComponentFunctionService.spec.js +567 -0
- package/lib/domains/manifest/services/ComponentFunctionService.spec.js.map +1 -0
- package/lib/domains/manifest/services/ComponentInputValidationService.d.ts +5 -0
- package/lib/domains/manifest/services/ComponentInputValidationService.js +11 -0
- package/lib/domains/manifest/services/ComponentInputValidationService.js.map +1 -0
- package/lib/domains/manifest/services/ComponentSchemaValidationService.d.ts +5 -0
- package/lib/domains/manifest/services/ComponentSchemaValidationService.js +11 -0
- package/lib/domains/manifest/services/ComponentSchemaValidationService.js.map +1 -0
- package/lib/domains/manifest/services/JobFunctionService.d.ts +12 -0
- package/lib/domains/manifest/services/JobFunctionService.js +23 -0
- package/lib/domains/manifest/services/JobFunctionService.js.map +1 -0
- package/lib/domains/manifest/services/JobFunctionService.spec.d.ts +1 -0
- package/lib/domains/manifest/services/JobFunctionService.spec.js +132 -0
- package/lib/domains/manifest/services/JobFunctionService.spec.js.map +1 -0
- package/lib/domains/manifest/services/ManifestServiceForDev.d.ts +18 -0
- package/lib/domains/manifest/services/ManifestServiceForDev.js +83 -0
- package/lib/domains/manifest/services/ManifestServiceForDev.js.map +1 -0
- package/lib/domains/manifest/services/ManifestServiceForDev.spec.d.ts +1 -0
- package/lib/domains/manifest/services/ManifestServiceForDev.spec.js +184 -0
- package/lib/domains/manifest/services/ManifestServiceForDev.spec.js.map +1 -0
- package/lib/domains/manifest/services/ManifestServiceForProduction.d.ts +12 -0
- package/lib/domains/manifest/services/ManifestServiceForProduction.js +81 -0
- package/lib/domains/manifest/services/ManifestServiceForProduction.js.map +1 -0
- package/lib/domains/manifest/services/ManifestServiceForProduction.spec.d.ts +1 -0
- package/lib/domains/manifest/services/ManifestServiceForProduction.spec.js +81 -0
- package/lib/domains/manifest/services/ManifestServiceForProduction.spec.js.map +1 -0
- package/lib/domains/manifest/utils/assertFuncEntryFilesAreValid.d.ts +3 -0
- package/lib/domains/manifest/utils/assertFuncEntryFilesAreValid.js +14 -0
- package/lib/domains/manifest/utils/assertFuncEntryFilesAreValid.js.map +1 -0
- package/lib/domains/manifest/utils/assertStaticFilesAreValid.d.ts +3 -0
- package/lib/domains/manifest/utils/assertStaticFilesAreValid.js +27 -0
- package/lib/domains/manifest/utils/assertStaticFilesAreValid.js.map +1 -0
- package/lib/domains/manifest/utils/assertStaticFilesHaveAbsolutePath.d.ts +2 -0
- package/lib/domains/manifest/utils/assertStaticFilesHaveAbsolutePath.js +16 -0
- package/lib/domains/manifest/utils/assertStaticFilesHaveAbsolutePath.js.map +1 -0
- package/lib/domains/manifest/utils/assertStaticFilesHaveAbsolutePath.spec.d.ts +1 -0
- package/lib/domains/manifest/utils/assertStaticFilesHaveAbsolutePath.spec.js +111 -0
- package/lib/domains/manifest/utils/assertStaticFilesHaveAbsolutePath.spec.js.map +1 -0
- package/lib/domains/manifest/utils/getAndAssertJobManifestVersion.d.ts +3 -0
- package/lib/domains/manifest/utils/getAndAssertJobManifestVersion.js +28 -0
- package/lib/domains/manifest/utils/getAndAssertJobManifestVersion.js.map +1 -0
- package/lib/domains/manifest/utils/getAndAssertJobManifestVersion.spec.d.ts +1 -0
- package/lib/domains/manifest/utils/getAndAssertJobManifestVersion.spec.js +115 -0
- package/lib/domains/manifest/utils/getAndAssertJobManifestVersion.spec.js.map +1 -0
- package/lib/domains/manifest/utils/getAndAssertManifestVersion.d.ts +3 -0
- package/lib/domains/manifest/utils/getAndAssertManifestVersion.js +23 -0
- package/lib/domains/manifest/utils/getAndAssertManifestVersion.js.map +1 -0
- package/lib/domains/manifest/utils/getAndAssertManifestVersion.spec.d.ts +1 -0
- package/lib/domains/manifest/utils/getAndAssertManifestVersion.spec.js +109 -0
- package/lib/domains/manifest/utils/getAndAssertManifestVersion.spec.js.map +1 -0
- package/lib/domains/manifest/utils/isValidManifestVersion.d.ts +2 -0
- package/lib/domains/manifest/utils/isValidManifestVersion.js +12 -0
- package/lib/domains/manifest/utils/isValidManifestVersion.js.map +1 -0
- package/lib/domains/manifest/utils/isValidManifestVersion.spec.d.ts +1 -0
- package/lib/domains/manifest/utils/isValidManifestVersion.spec.js +19 -0
- package/lib/domains/manifest/utils/isValidManifestVersion.spec.js.map +1 -0
- package/lib/domains/url/convertFunctionStaticFilesToFqdn.d.ts +1 -0
- package/lib/domains/url/convertFunctionStaticFilesToFqdn.js +22 -0
- package/lib/domains/url/convertFunctionStaticFilesToFqdn.js.map +1 -0
- package/lib/domains/url/convertFunctionStaticFilesToFqdn.spec.d.ts +1 -0
- package/lib/domains/url/convertFunctionStaticFilesToFqdn.spec.js +16 -0
- package/lib/domains/url/convertFunctionStaticFilesToFqdn.spec.js.map +1 -0
- package/lib/domains/url/convertFunctionStaticFilesToFqdnForPreview.d.ts +1 -0
- package/lib/domains/url/convertFunctionStaticFilesToFqdnForPreview.js +22 -0
- package/lib/domains/url/convertFunctionStaticFilesToFqdnForPreview.js.map +1 -0
- package/lib/domains/url/convertFunctionStaticFilesToFqdnForPreview.spec.d.ts +1 -0
- package/lib/domains/url/convertFunctionStaticFilesToFqdnForPreview.spec.js +16 -0
- package/lib/domains/url/convertFunctionStaticFilesToFqdnForPreview.spec.js.map +1 -0
- package/lib/domains/url/index.d.ts +1 -0
- package/lib/domains/url/index.js +18 -0
- package/lib/domains/url/index.js.map +1 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +39 -0
- package/lib/index.js.map +1 -0
- package/lib/jest-global-setup.d.ts +3 -0
- package/lib/jest-global-setup.js +22 -0
- package/lib/jest-global-setup.js.map +1 -0
- package/package.json +59 -0
- package/src/TestHelpers.ts +111 -0
- package/src/custom-types.d.ts +7 -0
- package/src/domains/__test__/createPackage.ts +48 -0
- package/src/domains/__test__/loadAllUnitTestComponents.ts +73 -0
- package/src/domains/component/component-context/__mocks__/mockedManifestModel.ts +30 -0
- package/src/domains/component/component-context/__mocks__/mockedUriObj.ts +38 -0
- package/src/domains/component/component-context/__mocks__/mockedUriObjPreview.ts +38 -0
- package/src/domains/component/component-context/createComponentContextualFunctions.spec.ts +299 -0
- package/src/domains/component/component-context/createComponentContextualFunctions.ts +108 -0
- package/src/domains/component/errors/ComponentError.ts +22 -0
- package/src/domains/component/errors/JobError.ts +20 -0
- package/src/domains/component/index.ts +17 -0
- package/src/domains/component/models/Component.spec.ts +21 -0
- package/src/domains/component/models/Component.ts +16 -0
- package/src/domains/component/models/ComponentVersion.spec.ts +77 -0
- package/src/domains/component/models/ComponentVersion.ts +55 -0
- package/src/domains/component/repositories/ComponentRepository.integration.spec.ts +148 -0
- package/src/domains/component/repositories/ComponentRepository.ts +37 -0
- package/src/domains/component/repositories/ComponentVersionRepository.integration.spec.ts +523 -0
- package/src/domains/component/repositories/ComponentVersionRepository.ts +138 -0
- package/src/domains/component/services/ComponentService.integration.spec.ts +721 -0
- package/src/domains/component/services/ComponentService.ts +350 -0
- package/src/domains/component/services/content-item-uri-resolver/ComponentContentUriResolverForPreview.spec.ts +78 -0
- package/src/domains/component/services/content-item-uri-resolver/ComponentContentUriResolverForPreview.ts +18 -0
- package/src/domains/component/utils/getComponentFileSystemFolder.spec.ts +8 -0
- package/src/domains/component/utils/getComponentFileSystemFolder.ts +5 -0
- package/src/domains/component/utils/getComponentName.spec.ts +7 -0
- package/src/domains/component/utils/getComponentName.ts +3 -0
- package/src/domains/component/utils/moveFilesAndDirectories.spec.ts +62 -0
- package/src/domains/component/utils/moveFilesAndDirectories.ts +27 -0
- package/src/domains/component/web-models/ComponentForWeb.ts +11 -0
- package/src/domains/component/web-models/ComponentVersionWebModel.ts +16 -0
- package/src/domains/component/web-models/ComponentsForWeb.ts +17 -0
- package/src/domains/component-set/errors/InvalidEnvironmentVariablesError.ts +11 -0
- package/src/domains/component-set/index.ts +18 -0
- package/src/domains/component-set/models/ComponentSet.spec.ts +66 -0
- package/src/domains/component-set/models/ComponentSet.ts +67 -0
- package/src/domains/component-set/models/ComponentSetComponentVersion.spec.ts +106 -0
- package/src/domains/component-set/models/ComponentSetComponentVersion.ts +54 -0
- package/src/domains/component-set/models/ComponentSetComponentVersionEditable.spec.ts +82 -0
- package/src/domains/component-set/models/ComponentSetComponentVersionEditable.ts +46 -0
- package/src/domains/component-set/models/ComponentSetComponentVersionExcluded.spec.ts +46 -0
- package/src/domains/component-set/models/ComponentSetComponentVersionExcluded.ts +26 -0
- package/src/domains/component-set/models/ComponentSetRule.spec.ts +39 -0
- package/src/domains/component-set/models/ComponentSetRule.ts +37 -0
- package/src/domains/component-set/repositories/ComponentSetComponentVersionEditableRepository.integration.spec.ts +172 -0
- package/src/domains/component-set/repositories/ComponentSetComponentVersionEditableRepository.ts +47 -0
- package/src/domains/component-set/repositories/ComponentSetComponentVersionExcludedRepository.integration.spec.ts +172 -0
- package/src/domains/component-set/repositories/ComponentSetComponentVersionExcludedRepository.ts +47 -0
- package/src/domains/component-set/repositories/ComponentSetComponentVersionRepository.integration.spec.ts +229 -0
- package/src/domains/component-set/repositories/ComponentSetComponentVersionRepository.ts +37 -0
- package/src/domains/component-set/repositories/ComponentSetRepository.integration.spec.ts +199 -0
- package/src/domains/component-set/repositories/ComponentSetRepository.ts +68 -0
- package/src/domains/component-set/repositories/ComponentSetRuleRepository.integration.spec.ts +107 -0
- package/src/domains/component-set/repositories/ComponentSetRuleRepository.ts +40 -0
- package/src/domains/component-set/services/ComponentSetRuleService.integration.spec.ts +137 -0
- package/src/domains/component-set/services/ComponentSetRuleService.ts +34 -0
- package/src/domains/component-set/services/ComponentSetService.spec.ts +144 -0
- package/src/domains/component-set/services/ComponentSetService.ts +82 -0
- package/src/domains/component-set/services/ComponentSetServiceForLocalDev.spec.ts +209 -0
- package/src/domains/component-set/services/ComponentSetServiceForLocalDev.ts +111 -0
- package/src/domains/component-set/services/ComponentSetServiceForProduction.integration.spec.ts +2898 -0
- package/src/domains/component-set/services/ComponentSetServiceForProduction.ts +839 -0
- package/src/domains/component-set/services/EnvironmentVariables.ts +1 -0
- package/src/domains/component-set/services/Headers.ts +1 -0
- package/src/domains/component-set/services/RuntimeComponentSet.ts +7 -0
- package/src/domains/component-set/web-models/ComponentSetComponentVersionForWeb.ts +7 -0
- package/src/domains/component-set/web-models/ComponentSetForWeb.ts +83 -0
- package/src/domains/content/index.ts +4 -0
- package/src/domains/content/services/ComponentContentSchemaService.spec.ts +264 -0
- package/src/domains/content/services/ComponentContentSchemaService.ts +53 -0
- package/src/domains/content/services/ContentItemService.spec.ts +108 -0
- package/src/domains/content/services/ContentItemService.ts +34 -0
- package/src/domains/content/services/DynamicContentItemService.spec.ts +97 -0
- package/src/domains/content/services/DynamicContentItemService.ts +30 -0
- package/src/domains/content/utils/getContentSchemaName.spec.ts +7 -0
- package/src/domains/content/utils/getContentSchemaName.ts +7 -0
- package/src/domains/db/ComponentConnectionManager.ts +4 -0
- package/src/domains/db/ComponentRepositories.ts +31 -0
- package/src/domains/db/createConnectionManager.ts +24 -0
- package/src/domains/db/index.ts +3 -0
- package/src/domains/db/migration-list.ts +16 -0
- package/src/domains/job/ParsePartitionKey/ParsePartitionKey.spec.ts +27 -0
- package/src/domains/job/ParsePartitionKey/ParsePartitionKey.ts +19 -0
- package/src/domains/job/ParsePartitionKey/index.ts +1 -0
- package/src/domains/job/constants/JobExecutionStatus.constants.ts +9 -0
- package/src/domains/job/constants/QueryParams.ts +16 -0
- package/src/domains/job/constants/Repository.constants.ts +18 -0
- package/src/domains/job/core/dynamoClient.mock.ts +34 -0
- package/src/domains/job/core/pagination/index.ts +3 -0
- package/src/domains/job/core/pagination/model/PageQuery.ts +31 -0
- package/src/domains/job/core/pagination/model/PaginationInfo.ts +40 -0
- package/src/domains/job/core/pagination/model/PaginationKey.ts +4 -0
- package/src/domains/job/core/pagination/model/PaginationLinks.ts +30 -0
- package/src/domains/job/core/pagination/model/PaginationQueryParams.ts +15 -0
- package/src/domains/job/core/pagination/model/PaginationQueryResponse.ts +27 -0
- package/src/domains/job/core/pagination/model/PaginationResponse.ts +48 -0
- package/src/domains/job/core/pagination/model/PaginationTypes.ts +45 -0
- package/src/domains/job/core/pagination/model/index.ts +8 -0
- package/src/domains/job/core/pagination/services/PaginationService.spec.ts +248 -0
- package/src/domains/job/core/pagination/services/PaginationService.ts +142 -0
- package/src/domains/job/core/pagination/services/index.ts +1 -0
- package/src/domains/job/core/pagination/utils/PaginationUtils.spec.ts +263 -0
- package/src/domains/job/core/pagination/utils/PaginationUtils.ts +156 -0
- package/src/domains/job/core/pagination/utils/index.ts +1 -0
- package/src/domains/job/errors/BadRequestError.ts +19 -0
- package/src/domains/job/errors/Error.constants.ts +34 -0
- package/src/domains/job/errors/ErrorWithHttpStatusCode.ts +16 -0
- package/src/domains/job/errors/ExecutionStatusError.ts +3 -0
- package/src/domains/job/errors/InternalServerError.ts +19 -0
- package/src/domains/job/errors/NotFoundError.ts +19 -0
- package/src/domains/job/errors/NotImplementedError.ts +19 -0
- package/src/domains/job/errors/UnprocessableContent.ts +19 -0
- package/src/domains/job/errors/index.ts +8 -0
- package/src/domains/job/index.ts +21 -0
- package/src/domains/job/manifest/JobManifestTypes.ts +145 -0
- package/src/domains/job/manifest/JobManifestV1.spec.ts +148 -0
- package/src/domains/job/manifest/JobManifestV1.ts +60 -0
- package/src/domains/job/manifest/index.ts +5 -0
- package/src/domains/job/manifest/mocks/JobManifest.mock.ts +35 -0
- package/src/domains/job/manifest/mocks/JobManifestDto.mock.ts +46 -0
- package/src/domains/job/manifest/mocks/JobManifestRecord.mock.ts +37 -0
- package/src/domains/job/manifest/mocks/JobManifestRequest.mock.ts +30 -0
- package/src/domains/job/model/Base/Base.ts +44 -0
- package/src/domains/job/model/Base/index.ts +1 -0
- package/src/domains/job/model/Job/Job.ts +98 -0
- package/src/domains/job/model/Job/index.ts +5 -0
- package/src/domains/job/model/Job/mocks/Job.mock.ts +26 -0
- package/src/domains/job/model/Job/mocks/JobDto.mock.ts +37 -0
- package/src/domains/job/model/Job/mocks/JobRecord.mock.ts +28 -0
- package/src/domains/job/model/Job/mocks/JobRequest.mock.ts +20 -0
- package/src/domains/job/model/JobContext/JobContext.ts +101 -0
- package/src/domains/job/model/JobContext/index.ts +5 -0
- package/src/domains/job/model/JobContext/mocks/JobContext.mock.ts +34 -0
- package/src/domains/job/model/JobContext/mocks/JobContextDto.mock.ts +46 -0
- package/src/domains/job/model/JobContext/mocks/JobContextRecord.mock.ts +32 -0
- package/src/domains/job/model/JobContext/mocks/JobContextRequest.mock.ts +26 -0
- package/src/domains/job/model/JobExecution/JobExecution.ts +220 -0
- package/src/domains/job/model/JobExecution/index.ts +5 -0
- package/src/domains/job/model/JobExecution/mocks/JobExecution.mock.ts +43 -0
- package/src/domains/job/model/JobExecution/mocks/JobExecutionDto.mock.ts +62 -0
- package/src/domains/job/model/JobExecution/mocks/JobExecutionRecord.mock.ts +47 -0
- package/src/domains/job/model/JobExecution/mocks/JobExecutionRequest.mock.ts +26 -0
- package/src/domains/job/repository/AbstractRepository.ts +219 -0
- package/src/domains/job/repository/JobContextRepository/JobContextRepository.spec.ts +301 -0
- package/src/domains/job/repository/JobContextRepository/JobContextRepository.ts +168 -0
- package/src/domains/job/repository/JobExecutionRepository/JobExecutionRepository.spec.ts +371 -0
- package/src/domains/job/repository/JobExecutionRepository/JobExecutionRepository.ts +293 -0
- package/src/domains/job/repository/JobManifestRepository/JobManifestRepository.spec.ts +222 -0
- package/src/domains/job/repository/JobManifestRepository/JobManifestRepository.ts +120 -0
- package/src/domains/job/repository/JobRepository/JobRepository.spec.ts +337 -0
- package/src/domains/job/repository/JobRepository/JobRepository.ts +188 -0
- package/src/domains/job/repository/index.ts +5 -0
- package/src/domains/job/repository/mocks/mockIoc.ts +42 -0
- package/src/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.defs.ts +40 -0
- package/src/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.spec.ts +95 -0
- package/src/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.ts +138 -0
- package/src/domains/job/services/index.ts +1 -0
- package/src/domains/job/singletonProvider.ts +12 -0
- package/src/domains/job/transientProvider.ts +12 -0
- package/src/domains/job/utils/SlackClient/SlackClient.spec.ts +176 -0
- package/src/domains/job/utils/SlackClient/SlackClient.ts +132 -0
- package/src/domains/job/utils/SlackClient/types/SlackClient.types.ts +70 -0
- package/src/domains/job/utils/SortByTimeQueued/SortByTimeQueued.spec.ts +28 -0
- package/src/domains/job/utils/SortByTimeQueued/SortByTimeQueued.ts +21 -0
- package/src/domains/job/utils/index.ts +3 -0
- package/src/domains/manifest/AbstractManifest.ts +57 -0
- package/src/domains/manifest/ManifestModel.ts +9 -0
- package/src/domains/manifest/ManifestV1.spec.ts +436 -0
- package/src/domains/manifest/ManifestV1.ts +146 -0
- package/src/domains/manifest/errors/ManifestLocationError.ts +9 -0
- package/src/domains/manifest/errors/ManifestValidationError.ts +7 -0
- package/src/domains/manifest/index.ts +18 -0
- package/src/domains/manifest/services/AbstractManifestService.spec.ts +427 -0
- package/src/domains/manifest/services/AbstractManifestService.ts +316 -0
- package/src/domains/manifest/services/ComponentFunctionService.spec.ts +683 -0
- package/src/domains/manifest/services/ComponentFunctionService.ts +178 -0
- package/src/domains/manifest/services/ComponentInputValidationService.ts +22 -0
- package/src/domains/manifest/services/ComponentSchemaValidationService.ts +22 -0
- package/src/domains/manifest/services/JobFunctionService.spec.ts +165 -0
- package/src/domains/manifest/services/JobFunctionService.ts +25 -0
- package/src/domains/manifest/services/ManifestServiceForDev.spec.ts +199 -0
- package/src/domains/manifest/services/ManifestServiceForDev.ts +96 -0
- package/src/domains/manifest/services/ManifestServiceForProduction.spec.ts +90 -0
- package/src/domains/manifest/services/ManifestServiceForProduction.ts +98 -0
- package/src/domains/manifest/utils/assertFuncEntryFilesAreValid.ts +19 -0
- package/src/domains/manifest/utils/assertStaticFilesAreValid.ts +37 -0
- package/src/domains/manifest/utils/assertStaticFilesHaveAbsolutePath.spec.ts +121 -0
- package/src/domains/manifest/utils/assertStaticFilesHaveAbsolutePath.ts +15 -0
- package/src/domains/manifest/utils/getAndAssertJobManifestVersion.spec.ts +145 -0
- package/src/domains/manifest/utils/getAndAssertJobManifestVersion.ts +31 -0
- package/src/domains/manifest/utils/getAndAssertManifestVersion.spec.ts +134 -0
- package/src/domains/manifest/utils/getAndAssertManifestVersion.ts +27 -0
- package/src/domains/manifest/utils/isValidManifestVersion.spec.ts +19 -0
- package/src/domains/manifest/utils/isValidManifestVersion.ts +9 -0
- package/src/domains/url/convertFunctionStaticFilesToFqdn.spec.ts +24 -0
- package/src/domains/url/convertFunctionStaticFilesToFqdn.ts +25 -0
- package/src/domains/url/convertFunctionStaticFilesToFqdnForPreview.spec.ts +48 -0
- package/src/domains/url/convertFunctionStaticFilesToFqdnForPreview.ts +25 -0
- package/src/domains/url/index.ts +1 -0
- package/src/index.ts +10 -0
- package/src/jest-global-setup.ts +20 -0
- package/src/migrations/20220704054051_initial.sql +19 -0
- package/src/migrations/20220718172237_adding_component_sets.sql +23 -0
- package/src/migrations/20220728113941_add_env_vars_field.sql +1 -0
- package/src/migrations/20220817113300_removing_null_props_from_jsonb.sql +41 -0
- package/src/migrations/20221027151225_dummy.sql +2 -0
- package/src/migrations/20221117151200_add_detail_columns_to_component_version.js +49 -0
- package/src/migrations/20221220151200_add_required_to_manifests.js +61 -0
- package/src/migrations/20221222151200_add_required_to_manifests.js +138 -0
- package/src/migrations/20223525103556_component_set_rule.sql +19 -0
- package/src/migrations/20230111095522_update_environment_property.js +72 -0
- package/src/migrations/20230203084900_ensure_static_root_exists.js +57 -0
- package/src/migrations/20230210143300_lowercase_all_uri_names.js +106 -0
- package/src/migrations/20230217151212_component_set_component_version_updates.sql +38 -0
- package/src/migrations/20230218121212_add_component_set_rules.js +31 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { UriResource } from '../../services/content-item-uri-resolver/ComponentContentUriResolverForPreview';
|
|
2
|
+
|
|
3
|
+
const mockedUriObjPreview: UriResource = {
|
|
4
|
+
id: '2',
|
|
5
|
+
type: 'root_folder',
|
|
6
|
+
type_name: 'Root Folder',
|
|
7
|
+
version: '0.0.1',
|
|
8
|
+
name: 'Root Folder',
|
|
9
|
+
short_name: '/',
|
|
10
|
+
status: {
|
|
11
|
+
id: 2,
|
|
12
|
+
code: 'under_construction',
|
|
13
|
+
},
|
|
14
|
+
created: {
|
|
15
|
+
date: '2020-02-27T09:47:27+11:00',
|
|
16
|
+
user_id: null,
|
|
17
|
+
},
|
|
18
|
+
updated: {
|
|
19
|
+
date: '2020-02-27T09:47:27+11:00',
|
|
20
|
+
user_id: '',
|
|
21
|
+
},
|
|
22
|
+
published: {
|
|
23
|
+
date: '2020-02-27T09:47:27+11:00',
|
|
24
|
+
user_id: 'null',
|
|
25
|
+
},
|
|
26
|
+
status_changed: {
|
|
27
|
+
date: '2020-02-27T09:47:27+11:00',
|
|
28
|
+
user_id: 'null',
|
|
29
|
+
},
|
|
30
|
+
url: 'xxx',
|
|
31
|
+
urls: [],
|
|
32
|
+
attributes: {
|
|
33
|
+
test: 'test',
|
|
34
|
+
},
|
|
35
|
+
additional: {},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default mockedUriObjPreview;
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { RuntimeComponentSet } from '../../component-set/services/RuntimeComponentSet';
|
|
2
|
+
import { createComponentContextualFunctions } from './createComponentContextualFunctions';
|
|
3
|
+
import { EventEmitter } from 'events';
|
|
4
|
+
import { randomUUID } from 'crypto';
|
|
5
|
+
import mockedManifest from './__mocks__/mockedManifestModel';
|
|
6
|
+
import mockedUriObj from './__mocks__/mockedUriObj';
|
|
7
|
+
import mockedUriObjPreview from './__mocks__/mockedUriObjPreview';
|
|
8
|
+
|
|
9
|
+
const manifest = mockedManifest;
|
|
10
|
+
const webRequestEvents: EventEmitter = new EventEmitter();
|
|
11
|
+
|
|
12
|
+
describe('createComponentContextualFunctions', () => {
|
|
13
|
+
const set: RuntimeComponentSet = { displayName: 'a name!!', webPath: 'my-set', environment: {} };
|
|
14
|
+
let requestId = randomUUID();
|
|
15
|
+
|
|
16
|
+
describe('getStaticResourceUrl', () => {
|
|
17
|
+
it('should have a function which returns urls to static resources', () => {
|
|
18
|
+
const ctx = createComponentContextualFunctions({
|
|
19
|
+
componentName: 'my-comp',
|
|
20
|
+
manifest,
|
|
21
|
+
rootUrl: 'http://example.com/',
|
|
22
|
+
set,
|
|
23
|
+
webRequestEvents,
|
|
24
|
+
requestId,
|
|
25
|
+
});
|
|
26
|
+
const url = ctx.getStaticResourceUrl('path/to/resource.png');
|
|
27
|
+
expect(url).toEqual(
|
|
28
|
+
`http://example.com/s/${manifest.namespace}/${manifest.name}/1.0.0/path/to/resource.png?_componentSet=my-set`,
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should handle leading and trailing slashes', () => {
|
|
33
|
+
const ctx = createComponentContextualFunctions({
|
|
34
|
+
componentName: 'my-comp',
|
|
35
|
+
manifest,
|
|
36
|
+
rootUrl: 'http://example.com/',
|
|
37
|
+
set,
|
|
38
|
+
webRequestEvents,
|
|
39
|
+
requestId,
|
|
40
|
+
});
|
|
41
|
+
const url = ctx.getStaticResourceUrl('/path/to/resource.png'); // leading with slash
|
|
42
|
+
const url2 = ctx.getStaticResourceUrl('path/to/resource.png'); // without leading slash
|
|
43
|
+
|
|
44
|
+
expect(url).toEqual(
|
|
45
|
+
`http://example.com/s/${manifest.namespace}/${manifest.name}/1.0.0/path/to/resource.png?_componentSet=my-set`,
|
|
46
|
+
);
|
|
47
|
+
expect(url2).toEqual(
|
|
48
|
+
`http://example.com/s/${manifest.namespace}/${manifest.name}/1.0.0/path/to/resource.png?_componentSet=my-set`,
|
|
49
|
+
);
|
|
50
|
+
expect(url).toEqual(url2);
|
|
51
|
+
|
|
52
|
+
const ctx2 = createComponentContextualFunctions({
|
|
53
|
+
componentName: 'my-comp',
|
|
54
|
+
manifest,
|
|
55
|
+
rootUrl: 'http://example.com',
|
|
56
|
+
set,
|
|
57
|
+
webRequestEvents,
|
|
58
|
+
requestId,
|
|
59
|
+
}); // without trailing slash
|
|
60
|
+
const url3 = ctx2.getStaticResourceUrl('/path/to/resource.png'); // leading with slash
|
|
61
|
+
const url4 = ctx2.getStaticResourceUrl('path/to/resource.png'); // without leading slash
|
|
62
|
+
|
|
63
|
+
expect(url3).toEqual(
|
|
64
|
+
`http://example.com/s/${manifest.namespace}/${manifest.name}/1.0.0/path/to/resource.png?_componentSet=my-set`,
|
|
65
|
+
);
|
|
66
|
+
expect(url4).toEqual(
|
|
67
|
+
`http://example.com/s/${manifest.namespace}/${manifest.name}/1.0.0/path/to/resource.png?_componentSet=my-set`,
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('should drop extra query parameters', () => {
|
|
72
|
+
const ctx = createComponentContextualFunctions({
|
|
73
|
+
componentName: 'my-comp',
|
|
74
|
+
manifest,
|
|
75
|
+
rootUrl: 'http://example.com/',
|
|
76
|
+
set,
|
|
77
|
+
webRequestEvents,
|
|
78
|
+
requestId,
|
|
79
|
+
});
|
|
80
|
+
const url = ctx.getStaticResourceUrl('/path/to/resource.png?param=123');
|
|
81
|
+
|
|
82
|
+
expect(url).toEqual(
|
|
83
|
+
`http://example.com/s/${manifest.namespace}/${manifest.name}/1.0.0/path/to/resource.png?_componentSet=my-set`,
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('should error when non-string is provided', () => {
|
|
88
|
+
const ctx = createComponentContextualFunctions({
|
|
89
|
+
componentName: 'my-comp',
|
|
90
|
+
manifest,
|
|
91
|
+
rootUrl: 'http://example.com/',
|
|
92
|
+
set,
|
|
93
|
+
webRequestEvents,
|
|
94
|
+
requestId,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
/* @ts-expect-error requires string */
|
|
98
|
+
expect(() => ctx.getStaticResourceUrl(123)).toThrowError('getStaticResourceUrl: first argument must be a string');
|
|
99
|
+
/* @ts-expect-error requires string */
|
|
100
|
+
expect(() => ctx.getStaticResourceUrl({})).toThrowError('getStaticResourceUrl: first argument must be a string');
|
|
101
|
+
/* @ts-expect-error requires string */
|
|
102
|
+
expect(() => ctx.getStaticResourceUrl(undefined)).toThrowError(
|
|
103
|
+
'getStaticResourceUrl: first argument must be a string',
|
|
104
|
+
);
|
|
105
|
+
/* @ts-expect-error requires string */
|
|
106
|
+
expect(() => ctx.getStaticResourceUrl()).toThrowError('getStaticResourceUrl: first argument must be a string');
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
describe('getFunctionUrl', () => {
|
|
111
|
+
it('should return a fully qualified url for a function url', () => {
|
|
112
|
+
const ctx = createComponentContextualFunctions({
|
|
113
|
+
componentName: 'my-comp',
|
|
114
|
+
manifest,
|
|
115
|
+
rootUrl: 'http://example.com/',
|
|
116
|
+
set: set,
|
|
117
|
+
webRequestEvents,
|
|
118
|
+
requestId,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
expect(ctx.getFunctionUrl('my-func')).toEqual('http://example.com/r/my-comp/1.0.0/my-func?_componentSet=my-set');
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('should convert a simple input object into query string', () => {
|
|
125
|
+
const ctx = createComponentContextualFunctions({
|
|
126
|
+
componentName: 'my-comp',
|
|
127
|
+
manifest,
|
|
128
|
+
rootUrl: 'http://example.com/',
|
|
129
|
+
set: set,
|
|
130
|
+
webRequestEvents,
|
|
131
|
+
requestId,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
expect(
|
|
135
|
+
ctx.getFunctionUrl('my-func', {
|
|
136
|
+
myNum: 123,
|
|
137
|
+
myArray: ['1', '2'],
|
|
138
|
+
}),
|
|
139
|
+
).toEqual('http://example.com/r/my-comp/1.0.0/my-func?_componentSet=my-set&myArray[]=1&myArray[]=2&myNum=123');
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('should use the preview route when a previewKey is provided', () => {
|
|
143
|
+
const ctx = createComponentContextualFunctions({
|
|
144
|
+
componentName: 'my-comp',
|
|
145
|
+
manifest,
|
|
146
|
+
rootUrl: 'http://example.com/',
|
|
147
|
+
set: set,
|
|
148
|
+
withPreviewKey: 'a-preview',
|
|
149
|
+
webRequestEvents,
|
|
150
|
+
requestId,
|
|
151
|
+
});
|
|
152
|
+
expect(ctx.getFunctionUrl('another-function')).toEqual(
|
|
153
|
+
'http://example.com/r/my-comp/1.0.0/another-function?_previewKey=a-preview',
|
|
154
|
+
);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('should convert a simple input object into query string with preview', () => {
|
|
158
|
+
const ctx = createComponentContextualFunctions({
|
|
159
|
+
componentName: 'my-comp',
|
|
160
|
+
manifest,
|
|
161
|
+
rootUrl: 'http://example.com/',
|
|
162
|
+
set: set,
|
|
163
|
+
withPreviewKey: 'a-preview',
|
|
164
|
+
webRequestEvents,
|
|
165
|
+
requestId,
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
expect(
|
|
169
|
+
ctx.getFunctionUrl('my-func', {
|
|
170
|
+
myNum: 123,
|
|
171
|
+
myArray: ['1', '2'],
|
|
172
|
+
}),
|
|
173
|
+
).toEqual('http://example.com/r/my-comp/1.0.0/my-func?_previewKey=a-preview&myArray[]=1&myArray[]=2&myNum=123');
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it('should use the static file preview route when a previewKey is provided', () => {
|
|
177
|
+
const previewKey = 'some-preview-key';
|
|
178
|
+
const ctx = createComponentContextualFunctions({
|
|
179
|
+
componentName: 'my-comp',
|
|
180
|
+
manifest,
|
|
181
|
+
rootUrl: 'http://example.com/',
|
|
182
|
+
set: set,
|
|
183
|
+
withPreviewKey: previewKey,
|
|
184
|
+
webRequestEvents,
|
|
185
|
+
requestId,
|
|
186
|
+
});
|
|
187
|
+
const url = ctx.getStaticResourceUrl('path/to/resource.png');
|
|
188
|
+
expect(url).toEqual(
|
|
189
|
+
`http://example.com/s/${manifest.namespace}/${manifest.name}/1.0.0/path/to/resource.png?_previewKey=some-preview-key`,
|
|
190
|
+
);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it('should error when non-string is provided', () => {
|
|
194
|
+
const ctx = createComponentContextualFunctions({
|
|
195
|
+
componentName: 'my-comp',
|
|
196
|
+
manifest,
|
|
197
|
+
rootUrl: 'http://example.com/',
|
|
198
|
+
set: set,
|
|
199
|
+
webRequestEvents,
|
|
200
|
+
requestId,
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
/* @ts-expect-error requires string */
|
|
204
|
+
expect(() => ctx.getFunctionUrl(123)).toThrowError('getFunctionUrl: first argument must be a string');
|
|
205
|
+
/* @ts-expect-error requires string */
|
|
206
|
+
expect(() => ctx.getFunctionUrl({})).toThrowError('getFunctionUrl: first argument must be a string');
|
|
207
|
+
/* @ts-expect-error requires string */
|
|
208
|
+
expect(() => ctx.getFunctionUrl(undefined)).toThrowError('getFunctionUrl: first argument must be a string');
|
|
209
|
+
/* @ts-expect-error requires string */
|
|
210
|
+
expect(() => ctx.getFunctionUrl()).toThrowError('getFunctionUrl: first argument must be a string');
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
it('should ensure the function name is transformed to lowercase', () => {
|
|
214
|
+
const ctx = createComponentContextualFunctions({
|
|
215
|
+
componentName: 'my-comp',
|
|
216
|
+
manifest,
|
|
217
|
+
rootUrl: 'http://example.com/',
|
|
218
|
+
set: set,
|
|
219
|
+
webRequestEvents,
|
|
220
|
+
requestId,
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
expect(ctx.getFunctionUrl('MY-FUNC')).toEqual('http://example.com/r/my-comp/1.0.0/my-func?_componentSet=my-set');
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
describe('resolveUri', () => {
|
|
228
|
+
const validRequestId = randomUUID();
|
|
229
|
+
requestId = validRequestId;
|
|
230
|
+
//mock the worker-root.ts
|
|
231
|
+
const workerMock = () => {
|
|
232
|
+
const handleUriRequest = async (uri: string, requestId: string, id: string): Promise<void> => {
|
|
233
|
+
if (uri === 'some-preview-uri') {
|
|
234
|
+
const [result] = await Promise.allSettled([Promise.resolve(mockedUriObjPreview)]);
|
|
235
|
+
webRequestEvents.emit('uri-response', result, requestId, id);
|
|
236
|
+
}
|
|
237
|
+
if (requestId === validRequestId) {
|
|
238
|
+
const [result] = await Promise.allSettled([Promise.resolve(mockedUriObj)]);
|
|
239
|
+
webRequestEvents.emit('uri-response', result, requestId, id);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
webRequestEvents.on('uri-request', handleUriRequest);
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
workerMock();
|
|
246
|
+
|
|
247
|
+
it('should throw error when uri is not of type string', async () => {
|
|
248
|
+
const ctx = createComponentContextualFunctions({
|
|
249
|
+
componentName: 'my-comp',
|
|
250
|
+
manifest,
|
|
251
|
+
rootUrl: 'http://example.com/',
|
|
252
|
+
set: set,
|
|
253
|
+
withPreviewKey: 'a-preview',
|
|
254
|
+
webRequestEvents,
|
|
255
|
+
requestId,
|
|
256
|
+
});
|
|
257
|
+
/* @ts-expect-error requires string */
|
|
258
|
+
await expect(async () => await ctx.resolveUri(123)).rejects.toThrowError(
|
|
259
|
+
'resolveUri: first argument must be a string',
|
|
260
|
+
);
|
|
261
|
+
/* @ts-expect-error requires string */
|
|
262
|
+
await expect(async () => await ctx.resolveUri(undefined)).rejects.toThrowError(
|
|
263
|
+
'resolveUri: first argument must be a string',
|
|
264
|
+
);
|
|
265
|
+
/* @ts-expect-error requires string */
|
|
266
|
+
await expect(async () => await ctx.resolveUri({})).rejects.toThrowError(
|
|
267
|
+
'resolveUri: first argument must be a string',
|
|
268
|
+
);
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
it('should return the mocked uri object for preview', async () => {
|
|
272
|
+
const ctx = createComponentContextualFunctions({
|
|
273
|
+
componentName: 'my-comp',
|
|
274
|
+
manifest,
|
|
275
|
+
rootUrl: 'http://example.com/',
|
|
276
|
+
set: set,
|
|
277
|
+
withPreviewKey: 'a-preview',
|
|
278
|
+
webRequestEvents,
|
|
279
|
+
requestId,
|
|
280
|
+
});
|
|
281
|
+
const result = await ctx.resolveUri('some-preview-uri');
|
|
282
|
+
expect(result).toEqual(mockedUriObjPreview);
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
it('should return the mocked uri object for production', async () => {
|
|
286
|
+
const ctx = createComponentContextualFunctions({
|
|
287
|
+
componentName: 'my-comp',
|
|
288
|
+
manifest,
|
|
289
|
+
rootUrl: 'http://example.com/',
|
|
290
|
+
set: set,
|
|
291
|
+
withPreviewKey: 'a-preview',
|
|
292
|
+
webRequestEvents,
|
|
293
|
+
requestId,
|
|
294
|
+
});
|
|
295
|
+
const result = await ctx.resolveUri('some-uri-x');
|
|
296
|
+
expect(result).toEqual(mockedUriObj);
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import queryString from 'query-string';
|
|
2
|
+
import { joinAbsoluteUrlPath } from '@squiz/dx-common-lib';
|
|
3
|
+
import { RuntimeComponentSet } from '../../component-set/services/RuntimeComponentSet';
|
|
4
|
+
import { ManifestModel } from '../../manifest/ManifestModel';
|
|
5
|
+
import { EventEmitter } from 'stream';
|
|
6
|
+
import { randomUUID } from 'crypto';
|
|
7
|
+
import { UriResource } from '../services/content-item-uri-resolver/ComponentContentUriResolverForPreview';
|
|
8
|
+
import { ComponentFunctionService, ManifestV1 } from '../../manifest';
|
|
9
|
+
export interface ComponentContextualFunctions {
|
|
10
|
+
getStaticResourceUrl: (path: string) => string;
|
|
11
|
+
getFunctionUrl: (name: string, input?: { [key: string]: any } | undefined) => string;
|
|
12
|
+
resolveUri: (uri: string) => Promise<UriResource | undefined>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type CreateComponentContextualFunctionsInput = {
|
|
16
|
+
componentName: string;
|
|
17
|
+
manifest: ManifestModel;
|
|
18
|
+
rootUrl: string;
|
|
19
|
+
set: RuntimeComponentSet;
|
|
20
|
+
withPreviewKey?: string;
|
|
21
|
+
manifestPath?: string;
|
|
22
|
+
requestId: string;
|
|
23
|
+
webRequestEvents: EventEmitter;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export function createComponentContextualFunctions(
|
|
27
|
+
ctxInput: CreateComponentContextualFunctionsInput,
|
|
28
|
+
): ComponentContextualFunctions {
|
|
29
|
+
const baseRenderUrl: string = joinAbsoluteUrlPath(
|
|
30
|
+
ctxInput.rootUrl,
|
|
31
|
+
'r',
|
|
32
|
+
ctxInput.componentName,
|
|
33
|
+
ctxInput.manifest.version,
|
|
34
|
+
);
|
|
35
|
+
const manifest = new ManifestV1(ctxInput.manifest, ctxInput.manifestPath || '');
|
|
36
|
+
return {
|
|
37
|
+
getStaticResourceUrl: (path: string) => {
|
|
38
|
+
if (typeof path !== 'string') {
|
|
39
|
+
throw new Error('getStaticResourceUrl: first argument must be a string');
|
|
40
|
+
}
|
|
41
|
+
const params = ctxInput.withPreviewKey
|
|
42
|
+
? { _previewKey: ctxInput.withPreviewKey }
|
|
43
|
+
: { _componentSet: ctxInput.set.webPath };
|
|
44
|
+
const url = ComponentFunctionService.buildFileUrl(path, manifest, params, ctxInput.rootUrl);
|
|
45
|
+
return url;
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
getFunctionUrl: (name: string, input: { [key: string]: any } = {}) => {
|
|
49
|
+
if (typeof name !== 'string') {
|
|
50
|
+
throw new Error('getFunctionUrl: first argument must be a string');
|
|
51
|
+
}
|
|
52
|
+
name = name.toLowerCase();
|
|
53
|
+
if (ctxInput.withPreviewKey) {
|
|
54
|
+
return queryString.stringifyUrl(
|
|
55
|
+
{
|
|
56
|
+
url: joinAbsoluteUrlPath(baseRenderUrl, name),
|
|
57
|
+
query: {
|
|
58
|
+
...input,
|
|
59
|
+
_previewKey: ctxInput.withPreviewKey,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{ skipNull: true, encode: true, arrayFormat: 'bracket' },
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return queryString.stringifyUrl(
|
|
66
|
+
{
|
|
67
|
+
url: joinAbsoluteUrlPath(baseRenderUrl, name),
|
|
68
|
+
query: {
|
|
69
|
+
...input,
|
|
70
|
+
_componentSet: ctxInput.set.webPath,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{ skipNull: true, encode: true, arrayFormat: 'bracket' },
|
|
74
|
+
);
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
resolveUri: async (uri: string): Promise<UriResource | undefined> => {
|
|
78
|
+
if (typeof uri !== 'string') {
|
|
79
|
+
throw new Error('resolveUri: first argument must be a string');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (ctxInput.requestId === undefined) {
|
|
83
|
+
throw new Error('resolveUri: request id is undefined');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const id = randomUUID();
|
|
87
|
+
|
|
88
|
+
ctxInput.webRequestEvents.emit('uri-request', uri, ctxInput.requestId, id);
|
|
89
|
+
|
|
90
|
+
const resource = new Promise((resolve, reject) => {
|
|
91
|
+
const handleUriResponse = (data: PromiseSettledResult<UriResource>, requestId: string, uuid: string) => {
|
|
92
|
+
if (id == uuid) {
|
|
93
|
+
ctxInput.webRequestEvents.removeListener('uri-response', handleUriResponse);
|
|
94
|
+
if (data.status === 'fulfilled') {
|
|
95
|
+
resolve(data.value as UriResource);
|
|
96
|
+
}
|
|
97
|
+
if (data.status === 'rejected') {
|
|
98
|
+
reject(data.reason);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
ctxInput.webRequestEvents.on('uri-response', handleUriResponse);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
return (await resource) as UriResource | undefined;
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ErrorWithHttpStatusCode } from '@squiz/dx-common-lib';
|
|
2
|
+
|
|
3
|
+
export class ComponentError extends ErrorWithHttpStatusCode {
|
|
4
|
+
name = 'ComponentError';
|
|
5
|
+
|
|
6
|
+
constructor(
|
|
7
|
+
public requestId: string,
|
|
8
|
+
public error: Error | any,
|
|
9
|
+
|
|
10
|
+
public functionName: string,
|
|
11
|
+
public componentName: string,
|
|
12
|
+
public componentVersion: string,
|
|
13
|
+
public setWebPath: string,
|
|
14
|
+
public responseType: 'json' | 'html',
|
|
15
|
+
|
|
16
|
+
statusCode: number = 500,
|
|
17
|
+
) {
|
|
18
|
+
super(statusCode, error?.message || 'An error occurred with no additional information available');
|
|
19
|
+
|
|
20
|
+
this.stack = error?.stack;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ErrorWithHttpStatusCode } from '@squiz/dx-common-lib';
|
|
2
|
+
|
|
3
|
+
export class JobError extends ErrorWithHttpStatusCode {
|
|
4
|
+
name = 'JobError';
|
|
5
|
+
|
|
6
|
+
constructor(
|
|
7
|
+
public requestId: string,
|
|
8
|
+
public error: Error | any,
|
|
9
|
+
|
|
10
|
+
public functionName: string,
|
|
11
|
+
public jobName: string,
|
|
12
|
+
public jobVersion: string,
|
|
13
|
+
|
|
14
|
+
statusCode: number = 500,
|
|
15
|
+
) {
|
|
16
|
+
super(statusCode, error?.message || 'An error occurred with no additional information available');
|
|
17
|
+
|
|
18
|
+
this.stack = error?.stack;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './models/Component';
|
|
2
|
+
export * from './models/ComponentVersion';
|
|
3
|
+
|
|
4
|
+
export * from './repositories/ComponentRepository';
|
|
5
|
+
export * from './repositories/ComponentVersionRepository';
|
|
6
|
+
|
|
7
|
+
export * from './services/ComponentService';
|
|
8
|
+
export * from './services/content-item-uri-resolver/ComponentContentUriResolverForPreview';
|
|
9
|
+
|
|
10
|
+
export * from './web-models/ComponentForWeb';
|
|
11
|
+
export * from './web-models/ComponentsForWeb';
|
|
12
|
+
export * from './web-models/ComponentVersionWebModel';
|
|
13
|
+
|
|
14
|
+
export * from './component-context/createComponentContextualFunctions';
|
|
15
|
+
export * from './errors/ComponentError';
|
|
16
|
+
export * from './errors/JobError';
|
|
17
|
+
export * from './utils/getComponentFileSystemFolder';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Component } from './Component';
|
|
2
|
+
|
|
3
|
+
describe('Component', () => {
|
|
4
|
+
it('should not allow creation without name', () => {
|
|
5
|
+
expect(() => new Component({})).toThrowErrorMatchingInlineSnapshot('"value is not a string"');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
it('should create if name is provided', () => {
|
|
9
|
+
expect(new Component({ name: 'component' })).toEqual(new Component({ name: 'component' }));
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('should throw if name is not a string', () => {
|
|
13
|
+
expect(() => new Component({ name: 123 })).toThrowErrorMatchingInlineSnapshot('"value is not a string"');
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('should throw if no data provided', () => {
|
|
17
|
+
expect(() => new Component()).toThrowErrorMatchingInlineSnapshot(
|
|
18
|
+
`"Expected 'val' to be defined, but received undefined"`,
|
|
19
|
+
);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { assertIsDefined, assertIsString } from '@squiz/dx-common-lib';
|
|
2
|
+
|
|
3
|
+
export interface ComponentInterface {
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export class Component implements ComponentInterface {
|
|
8
|
+
public name: string;
|
|
9
|
+
|
|
10
|
+
constructor(data?: Record<string, unknown>) {
|
|
11
|
+
assertIsDefined(data);
|
|
12
|
+
assertIsString(data.name);
|
|
13
|
+
|
|
14
|
+
this.name = data.name;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ComponentVersion } from './ComponentVersion';
|
|
2
|
+
|
|
3
|
+
describe('ComponentVersion', () => {
|
|
4
|
+
it('should allow creation with required fields', () => {
|
|
5
|
+
const model = new ComponentVersion({
|
|
6
|
+
componentName: 'name',
|
|
7
|
+
version: '1.0.0',
|
|
8
|
+
displayName: 'display name',
|
|
9
|
+
description: 'description',
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
expect(model.componentName).toEqual('name');
|
|
13
|
+
expect(model.version).toEqual('1.0.0');
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('should allow creation with optional icon', () => {
|
|
17
|
+
const model = new ComponentVersion({
|
|
18
|
+
componentName: 'name',
|
|
19
|
+
version: '1.0.0',
|
|
20
|
+
displayName: 'display name',
|
|
21
|
+
description: 'description',
|
|
22
|
+
|
|
23
|
+
icon: { id: '', color: { type: '', value: '' } },
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
expect(model.componentName).toEqual('name');
|
|
27
|
+
expect(model.version).toEqual('1.0.0');
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should throw if componentName not provided', () => {
|
|
31
|
+
expect(
|
|
32
|
+
() =>
|
|
33
|
+
new ComponentVersion({
|
|
34
|
+
version: '0.0.0',
|
|
35
|
+
}),
|
|
36
|
+
).toThrowErrorMatchingInlineSnapshot(`"componentName must be a string"`);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should throw if version not provided', () => {
|
|
40
|
+
expect(
|
|
41
|
+
() =>
|
|
42
|
+
new ComponentVersion({
|
|
43
|
+
componentName: 'name',
|
|
44
|
+
}),
|
|
45
|
+
).toThrowErrorMatchingInlineSnapshot(`"version must be a string"`);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('should throw if version is not in semver format', () => {
|
|
49
|
+
expect(
|
|
50
|
+
() =>
|
|
51
|
+
new ComponentVersion({
|
|
52
|
+
componentName: 'name',
|
|
53
|
+
version: 'version',
|
|
54
|
+
}),
|
|
55
|
+
).toThrowErrorMatchingInlineSnapshot(`"ComponentVersion.version must be in the form of semver 0.0.0"`);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should throw if version is not in semver format, must have 3 parts', () => {
|
|
59
|
+
expect(
|
|
60
|
+
() =>
|
|
61
|
+
new ComponentVersion({
|
|
62
|
+
componentName: 'name',
|
|
63
|
+
version: '1.0',
|
|
64
|
+
}),
|
|
65
|
+
).toThrowErrorMatchingInlineSnapshot(`"ComponentVersion.version must be in the form of semver 0.0.0"`);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('should throw if version is not in semver format, must not contain letters', () => {
|
|
69
|
+
expect(
|
|
70
|
+
() =>
|
|
71
|
+
new ComponentVersion({
|
|
72
|
+
componentName: 'name',
|
|
73
|
+
version: '1.0.zzz',
|
|
74
|
+
}),
|
|
75
|
+
).toThrowErrorMatchingInlineSnapshot(`"ComponentVersion.version must be in the form of semver 0.0.0"`);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { assertIsString, assertIsDefined, assertAssign } from '@squiz/dx-common-lib';
|
|
2
|
+
import { MANIFEST_MODELS } from '@squiz/dx-json-schema-lib';
|
|
3
|
+
|
|
4
|
+
type Icon = MANIFEST_MODELS.v1.DxComponentIconsJson;
|
|
5
|
+
type ColorHex = MANIFEST_MODELS.v1.ColorHex;
|
|
6
|
+
type ColorEnum = MANIFEST_MODELS.v1.ColorEnum;
|
|
7
|
+
|
|
8
|
+
export interface ComponentVersionInterface {
|
|
9
|
+
componentName: string;
|
|
10
|
+
version: string;
|
|
11
|
+
|
|
12
|
+
displayName: string;
|
|
13
|
+
description: string;
|
|
14
|
+
icon: Icon | undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const SEMVER_REGEX = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/;
|
|
18
|
+
|
|
19
|
+
export class ComponentVersion implements ComponentVersionInterface {
|
|
20
|
+
public componentName: string = '';
|
|
21
|
+
public version: string = '';
|
|
22
|
+
public displayName: string = '';
|
|
23
|
+
public description: string = '';
|
|
24
|
+
public icon: Icon | undefined;
|
|
25
|
+
|
|
26
|
+
constructor(data?: Record<string, unknown>) {
|
|
27
|
+
assertIsDefined(data);
|
|
28
|
+
|
|
29
|
+
this.componentName = assertAssign(data.componentName, assertIsString, 'componentName must be a string');
|
|
30
|
+
this.version = assertAssign(data.version, assertIsString, 'version must be a string');
|
|
31
|
+
|
|
32
|
+
this.displayName = assertAssign(data.displayName || '', assertIsString, 'displayName must be a string');
|
|
33
|
+
this.description = assertAssign(data.description || '', assertIsString, 'description must be a string');
|
|
34
|
+
|
|
35
|
+
if (data.icon && isIcon(data.icon)) {
|
|
36
|
+
this.icon = data.icon;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (SEMVER_REGEX.test(this.version) == false) {
|
|
40
|
+
throw new Error(`ComponentVersion.version must be in the form of semver 0.0.0`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function isIcon(value: unknown): value is Icon {
|
|
46
|
+
if (!!value && typeof value === 'object' && 'id' in value && 'color' in value && isColor((value as any).color)) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function isColor(value: unknown): value is ColorHex | ColorEnum {
|
|
54
|
+
return !!value && typeof value === 'object' && 'type' in value && 'value' in value;
|
|
55
|
+
}
|