runlify 0.0.71 → 0.0.76
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/build/commands/start.js +7 -11
- package/build/documentation/algorithm.js +3 -0
- package/build/documentation/algoritmToDoc.js +24 -0
- package/build/documentation/algoritmToDoc.spec.js +56 -0
- package/build/documentation/curlExampleToText.js +36 -0
- package/build/documentation/curlExampleToText.spec.js +59 -0
- package/build/documentation/doc.js +4 -0
- package/build/documentation/docToFlatDoc.js +54 -0
- package/build/documentation/docToFlatDoc.spec.js +219 -0
- package/build/documentation/flatDoc.js +4 -0
- package/build/documentation/flatDocToText.js +17 -0
- package/build/documentation/flatDocToText.spec.js +69 -0
- package/build/documentation/templateDoc.js +4 -0
- package/build/documentation/templateDocToDoc.js +9 -0
- package/build/extensions/localConfig.js +2 -2
- package/build/log.js +15 -0
- package/build/projectsGeneration/args.js +79 -0
- package/build/projectsGeneration/builders/BaseBuilder.js +49 -0
- package/build/projectsGeneration/builders/BaseSavableEntityBuilder.js +251 -0
- package/build/projectsGeneration/builders/CatalogBuilder.js +88 -0
- package/build/projectsGeneration/builders/DocumentBuilder.js +108 -0
- package/build/projectsGeneration/builders/InfoRegistryBuilder.js +226 -0
- package/build/projectsGeneration/builders/ReportBuilder.js +40 -0
- package/build/projectsGeneration/builders/RestApiBuilder.js +53 -0
- package/build/projectsGeneration/builders/RestApiMethodBuilder.js +70 -0
- package/build/projectsGeneration/builders/RoleBuilder.js +38 -0
- package/build/projectsGeneration/builders/SumRegistryBuilder.js +216 -0
- package/build/projectsGeneration/builders/SystemMetaBuilder.js +338 -0
- package/build/projectsGeneration/builders/TelegramBotBuilder.js +36 -0
- package/build/projectsGeneration/builders/WorkerBuilder.js +60 -0
- package/build/projectsGeneration/builders/buildedTypes.js +12 -0
- package/build/projectsGeneration/builders/curlTypes.js +3 -0
- package/build/projectsGeneration/builders/docs/DocumentationOfDocument.js +3 -0
- package/build/projectsGeneration/builders/docs/DocumentationOfDocumentBuilder.js +20 -0
- package/build/projectsGeneration/builders/fields/BaseFieldBuilder.js +179 -0
- package/build/projectsGeneration/builders/fields/IdFieldBuilder.js +96 -0
- package/build/projectsGeneration/builders/fields/LinkFieldBuilder.js +92 -0
- package/build/projectsGeneration/builders/fields/ScalarFieldBuilder.js +65 -0
- package/build/projectsGeneration/builders/fields/ViewLinkFieldBuilder.js +91 -0
- package/build/projectsGeneration/builders/materialUiIcons.js +8882 -0
- package/build/projectsGeneration/builders/postponed/AccumulationRegisterMetaBuilder.js +34 -0
- package/build/projectsGeneration/builders/postponed/DictionaryMetaBuilder.js +28 -0
- package/build/projectsGeneration/builders/postponed/DocumentMetaBuilder.js +28 -0
- package/build/projectsGeneration/builders/postponed/EntityFormMetaBuilder.js +28 -0
- package/build/projectsGeneration/builders/postponed/InformationRegisterMetaBuilder.js +33 -0
- package/build/projectsGeneration/builders/postponed/ListFormMetaBuilder.js +28 -0
- package/build/projectsGeneration/builders/postponed/PeriodicInformationRegisterMetaBuilder.js +37 -0
- package/build/projectsGeneration/builders/postponed/ReportMetaBuilder.js +28 -0
- package/build/projectsGeneration/builders/postponed/RoleMetaBuilder.js +28 -0
- package/build/projectsGeneration/builders/tsFilterFields.js +39 -0
- package/build/projectsGeneration/builders/tsFilterFields.spec.js +26 -0
- package/build/projectsGeneration/builders/types.js +3 -0
- package/build/projectsGeneration/builders/ui/Forms.js +3 -0
- package/build/projectsGeneration/builders/ui/FormsBuilder.js +21 -0
- package/build/projectsGeneration/builders/ui/ListFormBuilder.js +21 -0
- package/build/projectsGeneration/builders/ui/ListFormFilterBuilder.js +28 -0
- package/build/projectsGeneration/builders/ui/ListFormFilterFieldBuilder.js +24 -0
- package/build/projectsGeneration/builders/utils/accessFunctions.js +12 -0
- package/build/projectsGeneration/defaultCatalogs/files.js +24 -0
- package/build/projectsGeneration/genGraphSchemesByLocalGenerator.js +78 -0
- package/build/projectsGeneration/generateEntity.js +342 -0
- package/build/projectsGeneration/generateEnvironment.js +238 -0
- package/build/projectsGeneration/generateProject.js +787 -0
- package/build/projectsGeneration/generators/fieldTypeToTsType.js +26 -0
- package/build/projectsGeneration/generators/fileTemplates/back/Entities.js +18 -0
- package/build/projectsGeneration/generators/fileTemplates/back/devEnum.js +17 -0
- package/build/projectsGeneration/generators/fileTemplates/back/enum.js +17 -0
- package/build/projectsGeneration/generators/fileTemplates/back/environment/chart/Chart.js +12 -0
- package/build/projectsGeneration/generators/fileTemplates/back/environment/chart/templates/back.js +16 -0
- package/build/projectsGeneration/generators/fileTemplates/back/environment/chart/templates/ingress.js +12 -0
- package/build/projectsGeneration/generators/fileTemplates/back/environment/chart/values.js +20 -0
- package/build/projectsGeneration/generators/fileTemplates/back/environment/defaultEnv.js +13 -0
- package/build/projectsGeneration/generators/fileTemplates/back/environment/docs/backDocsConfiguration.js +24 -0
- package/build/projectsGeneration/generators/fileTemplates/back/environment/docs/backDocsEntity.js +9 -0
- package/build/projectsGeneration/generators/fileTemplates/back/environment/docs/backDocsRestApi.js +33 -0
- package/build/projectsGeneration/generators/fileTemplates/back/environment/gitlabCi.js +46 -0
- package/build/projectsGeneration/generators/fileTemplates/back/environment/src/clients/getPrisma.js +13 -0
- package/build/projectsGeneration/generators/fileTemplates/back/environment/src/clients/knex.js +13 -0
- package/build/projectsGeneration/generators/fileTemplates/back/environment/src/clients/queue/getQueue.js +13 -0
- package/build/projectsGeneration/generators/fileTemplates/back/environment/src/index.js +13 -0
- package/build/projectsGeneration/generators/fileTemplates/back/graph/additionalResolvers.js +6 -0
- package/build/projectsGeneration/generators/fileTemplates/back/graph/additionalTypes.js +6 -0
- package/build/projectsGeneration/generators/fileTemplates/back/graph/entityAdditionalPermissionToGraphqlTmpl.js +13 -0
- package/build/projectsGeneration/generators/fileTemplates/back/graph/entityBasePermissionToGraphql.js +14 -0
- package/build/projectsGeneration/generators/fileTemplates/back/graph/entityPermissionToGraphqlTmpl.js +13 -0
- package/build/projectsGeneration/generators/fileTemplates/back/graph/help/baseResolvers.js +5 -0
- package/build/projectsGeneration/generators/fileTemplates/back/graph/help/baseTypeDefs.js +8 -0
- package/build/projectsGeneration/generators/fileTemplates/back/graph/help/permissionsToGraphql.js +5 -0
- package/build/projectsGeneration/generators/fileTemplates/back/graph/meta/resolvers.js +6 -0
- package/build/projectsGeneration/generators/fileTemplates/back/graph/meta/typeDefs.js +6 -0
- package/build/projectsGeneration/generators/fileTemplates/back/graph/permissionsToGraphql.js +17 -0
- package/build/projectsGeneration/generators/fileTemplates/back/graph/resolvers.js +17 -0
- package/build/projectsGeneration/generators/fileTemplates/back/graph/types.js +13 -0
- package/build/projectsGeneration/generators/fileTemplates/back/initCommon.js +31 -0
- package/build/projectsGeneration/generators/fileTemplates/back/initDev.js +23 -0
- package/build/projectsGeneration/generators/fileTemplates/back/initEntities.js +17 -0
- package/build/projectsGeneration/generators/fileTemplates/back/root/config.js +15 -0
- package/build/projectsGeneration/generators/fileTemplates/back/root/restRouter.js +6 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/AdditionalServices.js +6 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/BaseServices.js +15 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/HelpService/HelpService.js +10 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/additionalMethods.js +10 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/additionalOperationsOnCreate.js +10 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/additionalOperationsOnDelete.js +11 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/additionalOperationsOnUpdate.js +11 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/afterCreate.js +11 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/afterDelete.js +11 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/afterUpdate.js +11 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/beforeCreate.js +11 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/beforeDelete.js +11 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/beforeUpdate.js +11 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/beforeUpsert.js +12 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/changeListFilter.js +11 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/getPostOperations.js +51 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/getRegistryEntries.js +11 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/getUnPostOperations.js +17 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/tenantIdRequiredHooks.js +18 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/initBuiltInHooks.js +17 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/initUserHooks.js +10 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/entity/service.js +144 -0
- package/build/projectsGeneration/generators/fileTemplates/back/services/serviceConstrictors.js +15 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/Dashboard.js +5 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/MetaPage.js +8 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/ResourcesPage.js +17 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/additionalRoutes.js +6 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/entityMapping.js +16 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/environment/chart/Chart.js +12 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/environment/chart/templates/front.js +17 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/environment/chart/templates/ingress.js +12 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/environment/chart/values.js +12 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/environment/docs/adminAppDocsConfiguration.js +26 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/environment/gitlabCi.js +33 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/environment/src/App.js +14 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/environment/src/contexts/SpacesContext.js +13 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/environment/src/dataProvider/index.js +17 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/environment/src/layout/AppBar.js +13 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/environment/src/layout/Menu.js +13 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/environment/src/routes.js +11 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/functions/Functions.js +13 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/getAdditionalMenu.js +6 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/getDefaultMenu.js +23 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/i18n/lang/uiLangCatalogsTmpl.js +9 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/i18n/lang/uiLangDocsTmpl.js +9 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/i18n/lang/uiLangInfoRegistriesTmpl.js +9 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/i18n/lang/uiLangReportsTmpl.js +7 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/i18n/lang/uiLangSumRegistriesTmpl.js +9 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/i18n/lang/uiTranslationsForServicesOfSavablesTmpl.js +23 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/i18n/lang/uiTranslationsLangTmpl.js +17 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/pages/EntityCreate/DefaultEntityCreate.js +80 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/pages/EntityCreate/index.js +10 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/pages/EntityEdit/DefaultEntityEdit.js +141 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/pages/EntityEdit/index.js +10 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/pages/EntityList/DefaultEntityFilter.js +52 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/pages/EntityList/DefaultEntityList.js +63 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/pages/EntityList/EntityFilter.js +10 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/pages/EntityList/index.js +10 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/pages/EntityShow/DefaultActions.js +23 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/pages/EntityShow/DefaultEntityShow.js +39 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/pages/EntityShow/DefaultMainTab.js +39 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/pages/EntityShow/DependencyTab.js +55 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/pages/EntityShow/MainTab.js +6 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/pages/EntityShow/additionalTabs.js +8 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/pages/EntityShow/index.js +10 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/pages/Icon.js +12 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/pages/getEntityValidation.js +57 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/resources.js +11 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/widgets/count/CountWidget.js +13 -0
- package/build/projectsGeneration/generators/fileTemplates/ui/widgets/list/ListWidget.js +18 -0
- package/build/projectsGeneration/generators/graph/fieldTypeToGraphScalar.js +27 -0
- package/build/projectsGeneration/generators/graph/fields/genGraphField.js +21 -0
- package/build/projectsGeneration/generators/graph/fields/genGraphIdField.js +16 -0
- package/build/projectsGeneration/generators/graph/fields/genGraphIdFieldType.js +20 -0
- package/build/projectsGeneration/generators/graph/fields/genGraphLinkField.js +35 -0
- package/build/projectsGeneration/generators/graph/fields/genGraphScalarField.js +28 -0
- package/build/projectsGeneration/generators/graph/filters/genGraphField.js +21 -0
- package/build/projectsGeneration/generators/graph/filters/genGraphIdFilter.js +25 -0
- package/build/projectsGeneration/generators/graph/filters/genGraphLinkFilter.js +18 -0
- package/build/projectsGeneration/generators/graph/filters/genGraphScalarFilter.js +42 -0
- package/build/projectsGeneration/generators/graph/genGraphCrudSchema.js +103 -0
- package/build/projectsGeneration/generators/graph/genGraphCrudSchema.spec.js +84 -0
- package/build/projectsGeneration/generators/graph/genGraphFilterType.js +29 -0
- package/build/projectsGeneration/generators/graph/genGraphFilterType.spec.js +32 -0
- package/build/projectsGeneration/generators/graph/genGraphType.js +27 -0
- package/build/projectsGeneration/generators/graph/genGraphType.spec.js +25 -0
- package/build/projectsGeneration/generators/graph/printGraphType.js +11 -0
- package/build/projectsGeneration/generators/graph/printGraphType.spec.js +18 -0
- package/build/projectsGeneration/generators/prisma/fieldIdTypeToPrismaType.js +17 -0
- package/build/projectsGeneration/generators/prisma/fieldTypeToPrismaType.js +25 -0
- package/build/projectsGeneration/generators/prisma/scheme/fields/genPrismaDefault.js +11 -0
- package/build/projectsGeneration/generators/prisma/scheme/fields/genPrismaDefault.spec.js +57 -0
- package/build/projectsGeneration/generators/prisma/scheme/fields/genPrismaField.js +21 -0
- package/build/projectsGeneration/generators/prisma/scheme/fields/genPrismaFieldFromExternalEntity.js +12 -0
- package/build/projectsGeneration/generators/prisma/scheme/fields/genPrismaFieldFromExternalEntity.spec.js +34 -0
- package/build/projectsGeneration/generators/prisma/scheme/fields/genPrismaIdField.js +19 -0
- package/build/projectsGeneration/generators/prisma/scheme/fields/genPrismaIdField.spec.js +45 -0
- package/build/projectsGeneration/generators/prisma/scheme/fields/genPrismaLinkFields.js +32 -0
- package/build/projectsGeneration/generators/prisma/scheme/fields/genPrismaLinkFields.spec.js +83 -0
- package/build/projectsGeneration/generators/prisma/scheme/fields/genPrismaScalarField.js +24 -0
- package/build/projectsGeneration/generators/prisma/scheme/fields/genPrismaScalarField.spec.js +117 -0
- package/build/projectsGeneration/generators/prisma/scheme/genPrismaEntity.js +32 -0
- package/build/projectsGeneration/generators/prisma/scheme/genPrismaEntity.spec.js +93 -0
- package/build/projectsGeneration/generators/prisma/scheme/genPrismaSchemaForEntities.js +14 -0
- package/build/projectsGeneration/generators/prisma/scheme/genPrismaSchemaForEntitiesWithClientAdnDb.js +11 -0
- package/build/projectsGeneration/generators/ui/componentNames/edit/getCompNameToEditScalar.js +25 -0
- package/build/projectsGeneration/generators/ui/componentNames/edit/getCompNamesToEditField.js +21 -0
- package/build/projectsGeneration/generators/ui/componentNames/edit/getCompNamesToEditIdField.js +9 -0
- package/build/projectsGeneration/generators/ui/componentNames/edit/getCompNamesToEditLinkField.js +15 -0
- package/build/projectsGeneration/generators/ui/componentNames/edit/getCompNamesToEditLinkField.spec.js +21 -0
- package/build/projectsGeneration/generators/ui/componentNames/edit/getCompNamesToEditScalarField.js +9 -0
- package/build/projectsGeneration/generators/ui/componentNames/show/getCompNameToShowScalar.js +25 -0
- package/build/projectsGeneration/generators/ui/componentNames/show/getCompNamesToShowField.js +21 -0
- package/build/projectsGeneration/generators/ui/componentNames/show/getCompNamesToShowIdField.js +9 -0
- package/build/projectsGeneration/generators/ui/componentNames/show/getCompNamesToShowLinkField.js +17 -0
- package/build/projectsGeneration/generators/ui/componentNames/show/getCompNamesToShowLinkField.spec.js +152 -0
- package/build/projectsGeneration/generators/ui/componentNames/show/getCompNamesToShowScalarField.js +9 -0
- package/build/projectsGeneration/generators/ui/componentNames/types.js +3 -0
- package/build/projectsGeneration/generators/ui/getLinkShowComponent.spec.js +39 -0
- package/build/projectsGeneration/generators/ui/getScalarShowComponent.spec.js +24 -0
- package/build/projectsGeneration/generators/ui/getShowComponent.js +45 -0
- package/build/projectsGeneration/links/getLinksFromExternalEntities.js +8 -0
- package/build/projectsGeneration/links/getLinksFromExternalEntities.spec.js +83 -0
- package/build/projectsGeneration/links/getLinksOfEntities.js +22 -0
- package/build/projectsGeneration/links/getLinksOfEntities.spec.js +188 -0
- package/build/projectsGeneration/links/getLinksToExternalEntities.js +8 -0
- package/build/projectsGeneration/links/getLinksToExternalEntities.spec.js +83 -0
- package/build/projectsGeneration/metaUtils.js +36 -0
- package/build/projectsGeneration/modelsGeneration.serialization.spec.js +93 -0
- package/build/projectsGeneration/types.js +80 -0
- package/build/projectsGeneration/utils.js +85 -0
- package/build/types/documentation/algorithm.d.ts +8 -0
- package/build/types/documentation/algoritmToDoc.d.ts +4 -0
- package/build/types/documentation/algoritmToDoc.spec.d.ts +1 -0
- package/build/types/documentation/curlExampleToText.d.ts +3 -0
- package/build/types/documentation/curlExampleToText.spec.d.ts +1 -0
- package/build/types/documentation/doc.d.ts +21 -0
- package/build/types/documentation/docToFlatDoc.d.ts +4 -0
- package/build/types/documentation/docToFlatDoc.spec.d.ts +1 -0
- package/build/types/documentation/flatDoc.d.ts +20 -0
- package/build/types/documentation/flatDocToText.d.ts +3 -0
- package/build/types/documentation/flatDocToText.spec.d.ts +1 -0
- package/build/types/documentation/templateDoc.d.ts +9 -0
- package/build/types/documentation/templateDocToDoc.d.ts +4 -0
- package/build/types/log.d.ts +3 -0
- package/build/types/projectsGeneration/args.d.ts +20 -0
- package/build/types/projectsGeneration/builders/BaseBuilder.d.ts +14 -0
- package/build/types/projectsGeneration/builders/BaseSavableEntityBuilder.d.ts +58 -0
- package/build/types/projectsGeneration/builders/CatalogBuilder.d.ts +8 -0
- package/build/types/projectsGeneration/builders/DocumentBuilder.d.ts +12 -0
- package/build/types/projectsGeneration/builders/InfoRegistryBuilder.d.ts +34 -0
- package/build/types/projectsGeneration/builders/ReportBuilder.d.ts +8 -0
- package/build/types/projectsGeneration/builders/RestApiBuilder.d.ts +12 -0
- package/build/types/projectsGeneration/builders/RestApiMethodBuilder.d.ts +20 -0
- package/build/types/projectsGeneration/builders/RoleBuilder.d.ts +8 -0
- package/build/types/projectsGeneration/builders/SumRegistryBuilder.d.ts +32 -0
- package/build/types/projectsGeneration/builders/SystemMetaBuilder.d.ts +64 -0
- package/build/types/projectsGeneration/builders/TelegramBotBuilder.d.ts +7 -0
- package/build/types/projectsGeneration/builders/WorkerBuilder.d.ts +11 -0
- package/build/types/projectsGeneration/builders/buildedTypes.d.ts +255 -0
- package/build/types/projectsGeneration/builders/curlTypes.d.ts +24 -0
- package/build/types/projectsGeneration/builders/docs/DocumentationOfDocument.d.ts +10 -0
- package/build/types/projectsGeneration/builders/docs/DocumentationOfDocumentBuilder.d.ts +9 -0
- package/build/types/projectsGeneration/builders/fields/BaseFieldBuilder.d.ts +48 -0
- package/build/types/projectsGeneration/builders/fields/IdFieldBuilder.d.ts +12 -0
- package/build/types/projectsGeneration/builders/fields/LinkFieldBuilder.d.ts +13 -0
- package/build/types/projectsGeneration/builders/fields/ScalarFieldBuilder.d.ts +5 -0
- package/build/types/projectsGeneration/builders/fields/ViewLinkFieldBuilder.d.ts +13 -0
- package/build/types/projectsGeneration/builders/materialUiIcons.d.ts +2 -0
- package/build/types/projectsGeneration/builders/postponed/AccumulationRegisterMetaBuilder.d.ts +3 -0
- package/build/types/projectsGeneration/builders/postponed/DictionaryMetaBuilder.d.ts +3 -0
- package/build/types/projectsGeneration/builders/postponed/DocumentMetaBuilder.d.ts +3 -0
- package/build/types/projectsGeneration/builders/postponed/EntityFormMetaBuilder.d.ts +3 -0
- package/build/types/projectsGeneration/builders/postponed/InformationRegisterMetaBuilder.d.ts +3 -0
- package/build/types/projectsGeneration/builders/postponed/ListFormMetaBuilder.d.ts +3 -0
- package/build/types/projectsGeneration/builders/postponed/PeriodicInformationRegisterMetaBuilder.d.ts +3 -0
- package/build/types/projectsGeneration/builders/postponed/ReportMetaBuilder.d.ts +3 -0
- package/build/types/projectsGeneration/builders/postponed/RoleMetaBuilder.d.ts +3 -0
- package/build/types/projectsGeneration/builders/tsFilterFields.d.ts +2 -0
- package/build/types/projectsGeneration/builders/tsFilterFields.spec.d.ts +1 -0
- package/build/types/projectsGeneration/builders/types.d.ts +5 -0
- package/build/types/projectsGeneration/builders/ui/Forms.d.ts +14 -0
- package/build/types/projectsGeneration/builders/ui/FormsBuilder.d.ts +10 -0
- package/build/types/projectsGeneration/builders/ui/ListFormBuilder.d.ts +10 -0
- package/build/types/projectsGeneration/builders/ui/ListFormFilterBuilder.d.ts +10 -0
- package/build/types/projectsGeneration/builders/ui/ListFormFilterFieldBuilder.d.ts +11 -0
- package/build/types/projectsGeneration/builders/utils/accessFunctions.d.ts +2 -0
- package/build/types/projectsGeneration/defaultCatalogs/files.d.ts +4 -0
- package/build/types/projectsGeneration/genGraphSchemesByLocalGenerator.d.ts +2 -0
- package/build/types/projectsGeneration/generateEntity.d.ts +2 -0
- package/build/types/projectsGeneration/generateEnvironment.d.ts +2 -0
- package/build/types/projectsGeneration/generateProject.d.ts +33 -0
- package/build/types/projectsGeneration/generators/fieldTypeToTsType.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/Entities.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/devEnum.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/enum.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/environment/chart/Chart.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/environment/chart/templates/back.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/environment/chart/templates/ingress.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/environment/chart/values.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/environment/defaultEnv.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/environment/docs/backDocsConfiguration.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/environment/docs/backDocsEntity.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/environment/docs/backDocsRestApi.d.ts +3 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/environment/gitlabCi.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/environment/src/clients/getPrisma.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/environment/src/clients/knex.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/environment/src/clients/queue/getQueue.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/environment/src/index.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/graph/additionalResolvers.d.ts +1 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/graph/additionalTypes.d.ts +1 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/graph/entityAdditionalPermissionToGraphqlTmpl.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/graph/entityBasePermissionToGraphql.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/graph/entityPermissionToGraphqlTmpl.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/graph/help/baseResolvers.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/graph/help/baseTypeDefs.d.ts +3 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/graph/help/permissionsToGraphql.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/graph/meta/resolvers.d.ts +1 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/graph/meta/typeDefs.d.ts +1 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/graph/permissionsToGraphql.d.ts +3 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/graph/resolvers.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/graph/types.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/initCommon.d.ts +3 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/initDev.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/initEntities.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/root/config.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/root/restRouter.d.ts +1 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/AdditionalServices.d.ts +1 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/BaseServices.d.ts +3 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/HelpService/HelpService.d.ts +3 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/additionalMethods.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/additionalOperationsOnCreate.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/additionalOperationsOnDelete.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/additionalOperationsOnUpdate.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/afterCreate.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/afterDelete.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/afterUpdate.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/beforeCreate.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/beforeDelete.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/beforeUpdate.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/beforeUpsert.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/changeListFilter.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/getPostOperations.d.ts +3 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/getRegistryEntries.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/getUnPostOperations.d.ts +3 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/hooks/tenantIdRequiredHooks.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/initBuiltInHooks.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/initUserHooks.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/entity/service.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/back/services/serviceConstrictors.d.ts +3 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/Dashboard.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/MetaPage.d.ts +1 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/ResourcesPage.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/additionalRoutes.d.ts +1 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/entityMapping.d.ts +3 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/environment/chart/Chart.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/environment/chart/templates/front.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/environment/chart/templates/ingress.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/environment/chart/values.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/environment/docs/adminAppDocsConfiguration.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/environment/gitlabCi.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/environment/src/App.d.ts +3 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/environment/src/contexts/SpacesContext.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/environment/src/dataProvider/index.d.ts +3 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/environment/src/layout/AppBar.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/environment/src/layout/Menu.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/environment/src/routes.d.ts +3 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/functions/Functions.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/getAdditionalMenu.d.ts +1 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/getDefaultMenu.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/i18n/lang/uiLangCatalogsTmpl.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/i18n/lang/uiLangDocsTmpl.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/i18n/lang/uiLangInfoRegistriesTmpl.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/i18n/lang/uiLangReportsTmpl.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/i18n/lang/uiLangSumRegistriesTmpl.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/i18n/lang/uiTranslationsForServicesOfSavablesTmpl.d.ts +4 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/i18n/lang/uiTranslationsLangTmpl.d.ts +6 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/pages/EntityCreate/DefaultEntityCreate.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/pages/EntityCreate/index.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/pages/EntityEdit/DefaultEntityEdit.d.ts +6 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/pages/EntityEdit/index.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/pages/EntityList/DefaultEntityFilter.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/pages/EntityList/DefaultEntityList.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/pages/EntityList/EntityFilter.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/pages/EntityList/index.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/pages/EntityShow/DefaultActions.d.ts +3 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/pages/EntityShow/DefaultEntityShow.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/pages/EntityShow/DefaultMainTab.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/pages/EntityShow/DependencyTab.d.ts +3 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/pages/EntityShow/MainTab.d.ts +1 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/pages/EntityShow/additionalTabs.d.ts +1 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/pages/EntityShow/index.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/pages/Icon.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/pages/getEntityValidation.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/resources.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/widgets/count/CountWidget.d.ts +2 -0
- package/build/types/projectsGeneration/generators/fileTemplates/ui/widgets/list/ListWidget.d.ts +2 -0
- package/build/types/projectsGeneration/generators/graph/fieldTypeToGraphScalar.d.ts +2 -0
- package/build/types/projectsGeneration/generators/graph/fields/genGraphField.d.ts +7 -0
- package/build/types/projectsGeneration/generators/graph/fields/genGraphIdField.d.ts +8 -0
- package/build/types/projectsGeneration/generators/graph/fields/genGraphIdFieldType.d.ts +2 -0
- package/build/types/projectsGeneration/generators/graph/fields/genGraphLinkField.d.ts +8 -0
- package/build/types/projectsGeneration/generators/graph/fields/genGraphScalarField.d.ts +8 -0
- package/build/types/projectsGeneration/generators/graph/filters/genGraphField.d.ts +4 -0
- package/build/types/projectsGeneration/generators/graph/filters/genGraphIdFilter.d.ts +8 -0
- package/build/types/projectsGeneration/generators/graph/filters/genGraphLinkFilter.d.ts +5 -0
- package/build/types/projectsGeneration/generators/graph/filters/genGraphScalarFilter.d.ts +5 -0
- package/build/types/projectsGeneration/generators/graph/genGraphCrudSchema.d.ts +3 -0
- package/build/types/projectsGeneration/generators/graph/genGraphCrudSchema.spec.d.ts +1 -0
- package/build/types/projectsGeneration/generators/graph/genGraphFilterType.d.ts +3 -0
- package/build/types/projectsGeneration/generators/graph/genGraphFilterType.spec.d.ts +1 -0
- package/build/types/projectsGeneration/generators/graph/genGraphType.d.ts +3 -0
- package/build/types/projectsGeneration/generators/graph/genGraphType.spec.d.ts +1 -0
- package/build/types/projectsGeneration/generators/graph/printGraphType.d.ts +2 -0
- package/build/types/projectsGeneration/generators/graph/printGraphType.spec.d.ts +1 -0
- package/build/types/projectsGeneration/generators/prisma/fieldIdTypeToPrismaType.d.ts +2 -0
- package/build/types/projectsGeneration/generators/prisma/fieldTypeToPrismaType.d.ts +2 -0
- package/build/types/projectsGeneration/generators/prisma/scheme/fields/genPrismaDefault.d.ts +2 -0
- package/build/types/projectsGeneration/generators/prisma/scheme/fields/genPrismaDefault.spec.d.ts +1 -0
- package/build/types/projectsGeneration/generators/prisma/scheme/fields/genPrismaField.d.ts +2 -0
- package/build/types/projectsGeneration/generators/prisma/scheme/fields/genPrismaFieldFromExternalEntity.d.ts +2 -0
- package/build/types/projectsGeneration/generators/prisma/scheme/fields/genPrismaFieldFromExternalEntity.spec.d.ts +1 -0
- package/build/types/projectsGeneration/generators/prisma/scheme/fields/genPrismaIdField.d.ts +2 -0
- package/build/types/projectsGeneration/generators/prisma/scheme/fields/genPrismaIdField.spec.d.ts +1 -0
- package/build/types/projectsGeneration/generators/prisma/scheme/fields/genPrismaLinkFields.d.ts +2 -0
- package/build/types/projectsGeneration/generators/prisma/scheme/fields/genPrismaLinkFields.spec.d.ts +1 -0
- package/build/types/projectsGeneration/generators/prisma/scheme/fields/genPrismaScalarField.d.ts +3 -0
- package/build/types/projectsGeneration/generators/prisma/scheme/fields/genPrismaScalarField.spec.d.ts +1 -0
- package/build/types/projectsGeneration/generators/prisma/scheme/genPrismaEntity.d.ts +3 -0
- package/build/types/projectsGeneration/generators/prisma/scheme/genPrismaEntity.spec.d.ts +1 -0
- package/build/types/projectsGeneration/generators/prisma/scheme/genPrismaSchemaForEntities.d.ts +3 -0
- package/build/types/projectsGeneration/generators/prisma/scheme/genPrismaSchemaForEntitiesWithClientAdnDb.d.ts +2 -0
- package/build/types/projectsGeneration/generators/ui/componentNames/edit/getCompNameToEditScalar.d.ts +3 -0
- package/build/types/projectsGeneration/generators/ui/componentNames/edit/getCompNamesToEditField.d.ts +3 -0
- package/build/types/projectsGeneration/generators/ui/componentNames/edit/getCompNamesToEditIdField.d.ts +3 -0
- package/build/types/projectsGeneration/generators/ui/componentNames/edit/getCompNamesToEditLinkField.d.ts +3 -0
- package/build/types/projectsGeneration/generators/ui/componentNames/edit/getCompNamesToEditLinkField.spec.d.ts +1 -0
- package/build/types/projectsGeneration/generators/ui/componentNames/edit/getCompNamesToEditScalarField.d.ts +3 -0
- package/build/types/projectsGeneration/generators/ui/componentNames/show/getCompNameToShowScalar.d.ts +3 -0
- package/build/types/projectsGeneration/generators/ui/componentNames/show/getCompNamesToShowField.d.ts +3 -0
- package/build/types/projectsGeneration/generators/ui/componentNames/show/getCompNamesToShowIdField.d.ts +3 -0
- package/build/types/projectsGeneration/generators/ui/componentNames/show/getCompNamesToShowLinkField.d.ts +3 -0
- package/build/types/projectsGeneration/generators/ui/componentNames/show/getCompNamesToShowLinkField.spec.d.ts +1 -0
- package/build/types/projectsGeneration/generators/ui/componentNames/show/getCompNamesToShowScalarField.d.ts +3 -0
- package/build/types/projectsGeneration/generators/ui/componentNames/types.d.ts +4 -0
- package/build/types/projectsGeneration/generators/ui/getLinkShowComponent.spec.d.ts +1 -0
- package/build/types/projectsGeneration/generators/ui/getScalarShowComponent.spec.d.ts +1 -0
- package/build/types/projectsGeneration/generators/ui/getShowComponent.d.ts +6 -0
- package/build/types/projectsGeneration/links/getLinksFromExternalEntities.d.ts +3 -0
- package/build/types/projectsGeneration/links/getLinksFromExternalEntities.spec.d.ts +1 -0
- package/build/types/projectsGeneration/links/getLinksOfEntities.d.ts +3 -0
- package/build/types/projectsGeneration/links/getLinksOfEntities.spec.d.ts +1 -0
- package/build/types/projectsGeneration/links/getLinksToExternalEntities.d.ts +3 -0
- package/build/types/projectsGeneration/links/getLinksToExternalEntities.spec.d.ts +1 -0
- package/build/types/projectsGeneration/metaUtils.d.ts +6 -0
- package/build/types/projectsGeneration/modelsGeneration.serialization.spec.d.ts +1 -0
- package/build/types/projectsGeneration/types.d.ts +92 -0
- package/build/types/projectsGeneration/utils.d.ts +14 -0
- package/build/types/types.d.ts +4 -0
- package/build/types/utils/TermSignals.d.ts +1 -0
- package/build/types/utils/cases.d.ts +9 -0
- package/build/types.js +3 -2
- package/build/utils/cases.js +30 -0
- package/package.json +11 -3
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var jest_without_globals_1 = require("jest-without-globals");
|
|
4
|
+
var IdFieldBuilder_1 = require("../../../../builders/fields/IdFieldBuilder");
|
|
5
|
+
var ScalarFieldBuilder_1 = require("../../../../builders/fields/ScalarFieldBuilder");
|
|
6
|
+
var genPrismaDefault_1 = require("./genPrismaDefault");
|
|
7
|
+
// yarn test --testPathPattern genPrismaDefault
|
|
8
|
+
describe('genPrismaDefault', function () {
|
|
9
|
+
test('int not autoGenerated', function () {
|
|
10
|
+
var someField = new IdFieldBuilder_1.IdFieldBuilder('someField', 'ru')
|
|
11
|
+
.setType('bigint')
|
|
12
|
+
.setAutoGenerated(false)
|
|
13
|
+
.build();
|
|
14
|
+
(0, jest_without_globals_1.expect)((0, genPrismaDefault_1.genPrismaDefault)(someField)).toBe('');
|
|
15
|
+
});
|
|
16
|
+
test('string not autoGenerated', function () {
|
|
17
|
+
var someField = new IdFieldBuilder_1.IdFieldBuilder('someField', 'ru')
|
|
18
|
+
.setType('string')
|
|
19
|
+
.setAutoGenerated(false)
|
|
20
|
+
.build();
|
|
21
|
+
(0, jest_without_globals_1.expect)((0, genPrismaDefault_1.genPrismaDefault)(someField)).toBe('');
|
|
22
|
+
});
|
|
23
|
+
test('int autoGenerated', function () {
|
|
24
|
+
var someField = new IdFieldBuilder_1.IdFieldBuilder('someField', 'ru')
|
|
25
|
+
.setType('bigint')
|
|
26
|
+
.setAutoGenerated(true)
|
|
27
|
+
.build();
|
|
28
|
+
(0, jest_without_globals_1.expect)((0, genPrismaDefault_1.genPrismaDefault)(someField)).toBe('@default(autoincrement())');
|
|
29
|
+
});
|
|
30
|
+
test('string autoGenerated', function () {
|
|
31
|
+
var someField = new IdFieldBuilder_1.IdFieldBuilder('someField', 'ru')
|
|
32
|
+
.setType('string')
|
|
33
|
+
.setAutoGenerated(true)
|
|
34
|
+
.build();
|
|
35
|
+
(0, jest_without_globals_1.expect)((0, genPrismaDefault_1.genPrismaDefault)(someField)).toBe('@default(cuid())');
|
|
36
|
+
});
|
|
37
|
+
test('bool with true default value', function () {
|
|
38
|
+
var someField = new ScalarFieldBuilder_1.ScalarFieldBuilder('someField', 'ru')
|
|
39
|
+
.setType('bool')
|
|
40
|
+
.setDefaultDbValue(true)
|
|
41
|
+
.build();
|
|
42
|
+
(0, jest_without_globals_1.expect)((0, genPrismaDefault_1.genPrismaDefault)(someField)).toBe('@default(true)');
|
|
43
|
+
});
|
|
44
|
+
test('int without changing autoGeneration', function () {
|
|
45
|
+
var someField = new IdFieldBuilder_1.IdFieldBuilder('someField', 'ru')
|
|
46
|
+
.setType('bigint')
|
|
47
|
+
.build();
|
|
48
|
+
(0, jest_without_globals_1.expect)((0, genPrismaDefault_1.genPrismaDefault)(someField)).toBe('@default(autoincrement())');
|
|
49
|
+
});
|
|
50
|
+
test('string without changing autoGeneration', function () {
|
|
51
|
+
var someField = new IdFieldBuilder_1.IdFieldBuilder('someField', 'ru')
|
|
52
|
+
.setType('string')
|
|
53
|
+
.build();
|
|
54
|
+
(0, jest_without_globals_1.expect)((0, genPrismaDefault_1.genPrismaDefault)(someField)).toBe('');
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuUHJpc21hRGVmYXV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yxDQUFDLENBQUE7SUFFRixJQUFJLENBQUMscUNBQXFDLEVBQUU7UUFDMUMsSUFBTSxTQUFTLEdBQUcsSUFBSSwrQkFBYyxDQUFDLFdBQVcsRUFBRSxJQUFJLENBQUM7YUFDcEQsT0FBTyxDQUFDLFFBQVEsQ0FBQzthQUNqQixLQUFLLEVBQUUsQ0FBQTtRQUNWLElBQUEsNkJBQU0sRUFBQyxJQUFBLG1DQUFnQixFQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLDJCQUEyQixDQUFDLENBQUE7SUFDdkUsQ0FBQyxDQUFDLENBQUE7SUFFRixJQUFJLENBQUMsd0NBQXdDLEVBQUU7UUFDN0MsSUFBTSxTQUFTLEdBQUcsSUFBSSwrQkFBYyxDQUFDLFdBQVcsRUFBRSxJQUFJLENBQUM7YUFDcEQsT0FBTyxDQUFDLFFBQVEsQ0FBQzthQUNqQixLQUFLLEVBQUUsQ0FBQTtRQUNWLElBQUEsNkJBQU0sRUFBQyxJQUFBLG1DQUFnQixFQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQyxDQUFBO0lBQzlDLENBQUMsQ0FBQyxDQUFBO0FBQ0osQ0FBQyxDQUFDLENBQUEifQ==
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genPrismaField = void 0;
|
|
4
|
+
var genPrismaIdField_1 = require("./genPrismaIdField");
|
|
5
|
+
var genPrismaLinkFields_1 = require("./genPrismaLinkFields");
|
|
6
|
+
var genPrismaScalarField_1 = require("./genPrismaScalarField");
|
|
7
|
+
var genPrismaField = function (entity, field) {
|
|
8
|
+
var category = field.category;
|
|
9
|
+
switch (category) {
|
|
10
|
+
case 'scalar':
|
|
11
|
+
return (0, genPrismaScalarField_1.genPrismaScalarField)(field);
|
|
12
|
+
case 'id':
|
|
13
|
+
return (0, genPrismaIdField_1.genPrismaIdField)(field);
|
|
14
|
+
case 'link':
|
|
15
|
+
return (0, genPrismaLinkFields_1.genPrismaLinkFields)(entity, field);
|
|
16
|
+
default:
|
|
17
|
+
throw new Error("Unexpected \"".concat(category, "\" category"));
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.genPrismaField = genPrismaField;
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuUHJpc21hRmllbGQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvcHJvamVjdHNHZW5lcmF0aW9uL2dlbmVyYXRvcnMvcHJpc21hL3NjaGVtZS9maWVsZHMvZ2VuUHJpc21hRmllbGQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBTUEsdURBQXFEO0FBQ3JELDZEQUEyRDtBQUMzRCwrREFBNkQ7QUFFdEQsSUFBTSxjQUFjLEdBQUcsVUFDNUIsTUFBYyxFQUNkLEtBQXdDO0lBRWhDLElBQUEsUUFBUSxHQUFLLEtBQUssU0FBVixDQUFVO0lBQzFCLFFBQVEsUUFBUSxFQUFFO1FBQ2hCLEtBQUssUUFBUTtZQUNYLE9BQU8sSUFBQSwyQ0FBb0IsRUFBQyxLQUFLLENBQUMsQ0FBQTtRQUNwQyxLQUFLLElBQUk7WUFDUCxPQUFPLElBQUEsbUNBQWdCLEVBQUMsS0FBSyxDQUFDLENBQUE7UUFDaEMsS0FBSyxNQUFNO1lBQ1QsT0FBTyxJQUFBLHlDQUFtQixFQUFDLE1BQU0sRUFBRSxLQUFLLENBQUMsQ0FBQTtRQUMzQztZQUNFLE1BQU0sSUFBSSxLQUFLLENBQUMsdUJBQWUsUUFBUSxnQkFBWSxDQUFDLENBQUE7S0FDdkQ7QUFDSCxDQUFDLENBQUE7QUFmWSxRQUFBLGNBQWMsa0JBZTFCIn0=
|
package/build/projectsGeneration/generators/prisma/scheme/fields/genPrismaFieldFromExternalEntity.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genPrismaFieldFromExternalEntity = void 0;
|
|
4
|
+
/* eslint-disable max-len */
|
|
5
|
+
var cases_1 = require("../../../../../utils/cases");
|
|
6
|
+
var genPrismaFieldFromExternalEntity = function (link) {
|
|
7
|
+
var fromFieldName = link.fromField.name.replace(/Id$/gu, '');
|
|
8
|
+
var withoutPadding = "".concat((0, cases_1.camelSingular)(link.entityOwnerName)).concat((0, cases_1.pascalPlural)(fromFieldName), " ").concat((0, cases_1.pascalSingular)(link.entityOwnerName), "[] @relation(\"From-").concat((0, cases_1.pascalSingular)(link.entityOwnerName), ".").concat(fromFieldName, "\")").trim();
|
|
9
|
+
return " ".concat(withoutPadding).replace(/\s+/gu, '\t');
|
|
10
|
+
};
|
|
11
|
+
exports.genPrismaFieldFromExternalEntity = genPrismaFieldFromExternalEntity;
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuUHJpc21hRmllbGRGcm9tRXh0ZXJuYWxFbnRpdHkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvcHJvamVjdHNHZW5lcmF0aW9uL2dlbmVyYXRvcnMvcHJpc21hL3NjaGVtZS9maWVsZHMvZ2VuUHJpc21hRmllbGRGcm9tRXh0ZXJuYWxFbnRpdHkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsNEJBQTRCO0FBQzVCLG9EQUltQztBQUc1QixJQUFNLGdDQUFnQyxHQUFHLFVBQzlDLElBQW9CO0lBRXBCLElBQU0sYUFBYSxHQUFHLElBQUksQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxPQUFPLEVBQUUsRUFBRSxDQUFDLENBQUE7SUFDOUQsSUFBTSxjQUFjLEdBQUcsVUFBRyxJQUFBLHFCQUFhLEVBQUMsSUFBSSxDQUFDLGVBQWUsQ0FBQyxTQUFHLElBQUEsb0JBQVksRUFDMUUsYUFBYSxDQUNkLGVBQUssSUFBQSxzQkFBYyxFQUNsQixJQUFJLENBQUMsZUFBZSxDQUNyQixpQ0FBc0IsSUFBQSxzQkFBYyxFQUNuQyxJQUFJLENBQUMsZUFBZSxDQUNyQixjQUFJLGFBQWEsUUFBSSxDQUFDLElBQUksRUFBRSxDQUFBO0lBRTdCLE9BQU8sWUFBSyxjQUFjLENBQUUsQ0FBQyxPQUFPLENBQUMsT0FBTyxFQUFFLElBQUksQ0FBQyxDQUFBO0FBQ3JELENBQUMsQ0FBQTtBQWJZLFFBQUEsZ0NBQWdDLG9DQWE1QyJ9
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/* eslint-disable no-tabs */
|
|
4
|
+
var jest_without_globals_1 = require("jest-without-globals");
|
|
5
|
+
var genPrismaFieldFromExternalEntity_1 = require("./genPrismaFieldFromExternalEntity");
|
|
6
|
+
// yarn test --testPathPattern genPrismaFieldFromExternalEntity
|
|
7
|
+
describe('genPrismaFieldFromExternalEntity', function () {
|
|
8
|
+
test('requiered', function () {
|
|
9
|
+
(0, jest_without_globals_1.expect)((0, genPrismaFieldFromExternalEntity_1.genPrismaFieldFromExternalEntity)({
|
|
10
|
+
type: 'oneToMany',
|
|
11
|
+
entityOwnerName: 'cards',
|
|
12
|
+
fromField: {
|
|
13
|
+
name: 'userId',
|
|
14
|
+
title: { ru: '' },
|
|
15
|
+
needFor: '',
|
|
16
|
+
updatable: true,
|
|
17
|
+
required: false,
|
|
18
|
+
requiredOnInput: true,
|
|
19
|
+
updatableByUser: true,
|
|
20
|
+
showInList: true,
|
|
21
|
+
showInCreate: true,
|
|
22
|
+
showInEdit: true,
|
|
23
|
+
externalEntity: '',
|
|
24
|
+
category: 'link',
|
|
25
|
+
type: 'string',
|
|
26
|
+
linkCategory: 'entity',
|
|
27
|
+
defaultDbValue: undefined,
|
|
28
|
+
predefinedLinkedEntity: 'none',
|
|
29
|
+
},
|
|
30
|
+
externalEntityName: 'users',
|
|
31
|
+
})).toEqual(' cardUsers Card[] @relation("From-Card.user")'.replace(/\s+/gu, '\t'));
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuUHJpc21hRmllbGRGcm9tRXh0ZXJuYWxFbnRpdHkuc3BlYy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9wcm9qZWN0c0dlbmVyYXRpb24vZ2VuZXJhdG9ycy9wcmlzbWEvc2NoZW1lL2ZpZWxkcy9nZW5QcmlzbWFGaWVsZEZyb21FeHRlcm5hbEVudGl0eS5zcGVjLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNEJBQTRCO0FBQzVCLDZEQUE2QztBQUM3Qyx1RkFBcUY7QUFFckYsK0RBQStEO0FBRS9ELFFBQVEsQ0FBQyxrQ0FBa0MsRUFBRTtJQUMzQyxJQUFJLENBQUMsV0FBVyxFQUFFO1FBQ2hCLElBQUEsNkJBQU0sRUFDSixJQUFBLG1FQUFnQyxFQUFDO1lBQy9CLElBQUksRUFBRSxXQUFXO1lBQ2pCLGVBQWUsRUFBRSxPQUFPO1lBQ3hCLFNBQVMsRUFBRTtnQkFDVCxJQUFJLEVBQUUsUUFBUTtnQkFDZCxLQUFLLEVBQUUsRUFBRSxFQUFFLEVBQUUsRUFBRSxFQUFFO2dCQUNqQixPQUFPLEVBQUUsRUFBRTtnQkFDWCxTQUFTLEVBQUUsSUFBSTtnQkFDZixRQUFRLEVBQUUsS0FBSztnQkFDZixlQUFlLEVBQUUsSUFBSTtnQkFDckIsZUFBZSxFQUFFLElBQUk7Z0JBQ3JCLFVBQVUsRUFBRSxJQUFJO2dCQUNoQixZQUFZLEVBQUUsSUFBSTtnQkFDbEIsVUFBVSxFQUFFLElBQUk7Z0JBQ2hCLGNBQWMsRUFBRSxFQUFFO2dCQUNsQixRQUFRLEVBQUUsTUFBTTtnQkFDaEIsSUFBSSxFQUFFLFFBQVE7Z0JBQ2QsWUFBWSxFQUFFLFFBQVE7Z0JBQ3RCLGNBQWMsRUFBRSxTQUFTO2dCQUN6QixzQkFBc0IsRUFBRSxNQUFNO2FBQy9CO1lBQ0Qsa0JBQWtCLEVBQUUsT0FBTztTQUM1QixDQUFDLENBQ0gsQ0FBQyxPQUFPLENBQ1AsZ0RBQWdELENBQUMsT0FBTyxDQUFDLE9BQU8sRUFBRSxJQUFJLENBQUMsQ0FDeEUsQ0FBQTtJQUNILENBQUMsQ0FBQyxDQUFBO0FBQ0osQ0FBQyxDQUFDLENBQUEifQ==
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genPrismaIdField = void 0;
|
|
4
|
+
var fieldIdTypeToPrismaType_1 = require("../../fieldIdTypeToPrismaType");
|
|
5
|
+
var genPrismaDefault_1 = require("./genPrismaDefault");
|
|
6
|
+
var genPrismaScalarField_1 = require("./genPrismaScalarField");
|
|
7
|
+
var genPrismaIdField = function (field) {
|
|
8
|
+
// const withoutPadding = `${field.name} ${fieldIdTypeToPrismaType(field.type)}${field.required ? '' : '?'} ${genPrismaDefault(field)} @id`
|
|
9
|
+
// .trim();
|
|
10
|
+
var withoutPadding = (0, genPrismaScalarField_1.joinPrismaFieldParts)([
|
|
11
|
+
field.name,
|
|
12
|
+
"".concat((0, fieldIdTypeToPrismaType_1.fieldIdTypeToPrismaType)(field.type)).concat(field.required ? '' : '?'),
|
|
13
|
+
(0, genPrismaDefault_1.genPrismaDefault)(field),
|
|
14
|
+
'@id',
|
|
15
|
+
]);
|
|
16
|
+
return [" ".concat(withoutPadding).replace(/\s+/gu, '\t')];
|
|
17
|
+
};
|
|
18
|
+
exports.genPrismaIdField = genPrismaIdField;
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuUHJpc21hSWRGaWVsZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9wcm9qZWN0c0dlbmVyYXRpb24vZ2VuZXJhdG9ycy9wcmlzbWEvc2NoZW1lL2ZpZWxkcy9nZW5QcmlzbWFJZEZpZWxkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUVBLHlFQUF1RTtBQUN2RSx1REFBcUQ7QUFDckQsK0RBQTZEO0FBRXRELElBQU0sZ0JBQWdCLEdBQUcsVUFBQyxLQUFjO0lBQzdDLDRJQUE0STtJQUM1SSxhQUFhO0lBRWIsSUFBTSxjQUFjLEdBQUcsSUFBQSwyQ0FBb0IsRUFBQztRQUMxQyxLQUFLLENBQUMsSUFBSTtRQUNWLFVBQUcsSUFBQSxpREFBdUIsRUFBQyxLQUFLLENBQUMsSUFBSSxDQUFDLFNBQUcsS0FBSyxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxHQUFHLENBQUU7UUFDcEUsSUFBQSxtQ0FBZ0IsRUFBQyxLQUFLLENBQUM7UUFDdkIsS0FBSztLQUNOLENBQUMsQ0FBQTtJQUVGLE9BQU8sQ0FBQyxZQUFLLGNBQWMsQ0FBRSxDQUFDLE9BQU8sQ0FBQyxPQUFPLEVBQUUsSUFBSSxDQUFDLENBQUMsQ0FBQTtBQUN2RCxDQUFDLENBQUE7QUFaWSxRQUFBLGdCQUFnQixvQkFZNUIifQ==
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var jest_without_globals_1 = require("jest-without-globals");
|
|
4
|
+
var IdFieldBuilder_1 = require("../../../../builders/fields/IdFieldBuilder");
|
|
5
|
+
var genPrismaIdField_1 = require("./genPrismaIdField");
|
|
6
|
+
// yarn test --testPathPattern genPrismaIdField
|
|
7
|
+
describe('genPrismaIdField', function () {
|
|
8
|
+
test('int autogenerated', function () {
|
|
9
|
+
var someField = new IdFieldBuilder_1.IdFieldBuilder('someField', 'ru')
|
|
10
|
+
.setType('bigint')
|
|
11
|
+
.setAutoGenerated(true)
|
|
12
|
+
.build();
|
|
13
|
+
(0, jest_without_globals_1.expect)((0, genPrismaIdField_1.genPrismaIdField)(someField)).toEqual([
|
|
14
|
+
' someField BigInt @default(autoincrement()) @id'.replace(/\s+/gu, '\t'),
|
|
15
|
+
]);
|
|
16
|
+
});
|
|
17
|
+
test('int not autogenerated', function () {
|
|
18
|
+
var someField = new IdFieldBuilder_1.IdFieldBuilder('someField', 'ru')
|
|
19
|
+
.setType('bigint')
|
|
20
|
+
.setAutoGenerated(false)
|
|
21
|
+
.build();
|
|
22
|
+
(0, jest_without_globals_1.expect)((0, genPrismaIdField_1.genPrismaIdField)(someField)).toEqual([
|
|
23
|
+
' someField BigInt @id'.replace(/\s+/gu, '\t'),
|
|
24
|
+
]);
|
|
25
|
+
});
|
|
26
|
+
test('string autogenerated', function () {
|
|
27
|
+
var someField = new IdFieldBuilder_1.IdFieldBuilder('someField', 'ru')
|
|
28
|
+
.setType('string')
|
|
29
|
+
.setAutoGenerated(true)
|
|
30
|
+
.build();
|
|
31
|
+
(0, jest_without_globals_1.expect)((0, genPrismaIdField_1.genPrismaIdField)(someField)).toEqual([
|
|
32
|
+
' someField String @default(cuid()) @id'.replace(/\s+/gu, '\t'),
|
|
33
|
+
]);
|
|
34
|
+
});
|
|
35
|
+
test('string not autogenerated', function () {
|
|
36
|
+
var someField = new IdFieldBuilder_1.IdFieldBuilder('someField', 'ru')
|
|
37
|
+
.setType('string')
|
|
38
|
+
.setAutoGenerated(false)
|
|
39
|
+
.build();
|
|
40
|
+
(0, jest_without_globals_1.expect)((0, genPrismaIdField_1.genPrismaIdField)(someField)).toEqual([
|
|
41
|
+
' someField String @id'.replace(/\s+/gu, '\t'),
|
|
42
|
+
]);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuUHJpc21hSWRGaWVsZC5zcGVjLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL3Byb2plY3RzR2VuZXJhdGlvbi9nZW5lcmF0b3JzL3ByaXNtYS9zY2hlbWUvZmllbGRzL2dlblByaXNtYUlkRmllbGQuc3BlYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZEQUE2QztBQUM3Qyw2RUFBMkU7QUFDM0UsdURBQXFEO0FBRXJELCtDQUErQztBQUUvQyxRQUFRLENBQUMsa0JBQWtCLEVBQUU7SUFDM0IsSUFBSSxDQUFDLG1CQUFtQixFQUFFO1FBQ3hCLElBQU0sU0FBUyxHQUFHLElBQUksK0JBQWMsQ0FBQyxXQUFXLEVBQUUsSUFBSSxDQUFDO2FBQ3BELE9BQU8sQ0FBQyxRQUFRLENBQUM7YUFDakIsZ0JBQWdCLENBQUMsSUFBSSxDQUFDO2FBQ3RCLEtBQUssRUFBRSxDQUFBO1FBQ1YsSUFBQSw2QkFBTSxFQUFDLElBQUEsbUNBQWdCLEVBQUMsU0FBUyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUM7WUFDMUMscURBQXFELENBQUMsT0FBTyxDQUMzRCxPQUFPLEVBQ1AsSUFBSSxDQUNMO1NBQ0YsQ0FBQyxDQUFBO0lBQ0osQ0FBQyxDQUFDLENBQUE7SUFDRixJQUFJLENBQUMsdUJBQXVC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DLElBQUEsbUNBQWdCLEVBQUMsU0FBUyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUM7WUFDMUMsMEJBQTBCLENBQUMsT0FBTyxDQUFDLE9BQU8sRUFBRSxJQUFJLENBQUM7U0FDbEQsQ0FBQyxDQUFBO0lBQ0osQ0FBQyxDQUFDLENBQUE7QUFDSixDQUFDLENBQUMsQ0FBQSJ9
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genPrismaLinkFields = void 0;
|
|
4
|
+
/* eslint-disable max-len */
|
|
5
|
+
/* eslint-disable no-tabs */
|
|
6
|
+
var cases_1 = require("../../../../../utils/cases");
|
|
7
|
+
var fieldIdTypeToPrismaType_1 = require("../../fieldIdTypeToPrismaType");
|
|
8
|
+
var genPrismaDefault_1 = require("./genPrismaDefault");
|
|
9
|
+
var genPrismaScalarField_1 = require("./genPrismaScalarField");
|
|
10
|
+
var genPrismaLinkFields = function (entity, field) {
|
|
11
|
+
var trivialFieldName = field.name.endsWith('Id')
|
|
12
|
+
? field.name
|
|
13
|
+
: "".concat(field.name, "Id");
|
|
14
|
+
var linkFieldName = field.name.endsWith('Id')
|
|
15
|
+
? field.name.replace(/Id$/gu, '')
|
|
16
|
+
: field.name;
|
|
17
|
+
// const trivialField = `${trivialFieldName} ${fieldIdTypeToPrismaType(field.type)}${field.required ? '' : '?'}`
|
|
18
|
+
// .trim();
|
|
19
|
+
var trivialField = (0, genPrismaScalarField_1.joinPrismaFieldParts)([
|
|
20
|
+
trivialFieldName,
|
|
21
|
+
"".concat((0, fieldIdTypeToPrismaType_1.fieldIdTypeToPrismaType)(field.type)).concat(field.required ? '' : '?'),
|
|
22
|
+
(0, genPrismaDefault_1.genPrismaDefault)(field),
|
|
23
|
+
]);
|
|
24
|
+
var linkField = "".concat(linkFieldName, "\t").concat((0, cases_1.pascalSingular)(field.externalEntity)).concat(field.required ? '' : '?', "\t@relation(\"From-").concat((0, cases_1.pascalSingular)(entity.name), ".").concat(linkFieldName, "\", fields: [").concat(trivialFieldName, "], references: [id])").trim();
|
|
25
|
+
var result = ["\t".concat(trivialField)];
|
|
26
|
+
if (field.linkCategory === 'entity') {
|
|
27
|
+
result.push("\t".concat(linkField));
|
|
28
|
+
}
|
|
29
|
+
return result.map(function (el) { return el; });
|
|
30
|
+
};
|
|
31
|
+
exports.genPrismaLinkFields = genPrismaLinkFields;
|
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuUHJpc21hTGlua0ZpZWxkcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9wcm9qZWN0c0dlbmVyYXRpb24vZ2VuZXJhdG9ycy9wcmlzbWEvc2NoZW1lL2ZpZWxkcy9nZW5QcmlzbWFMaW5rRmllbGRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLDRCQUE0QjtBQUM1Qiw0QkFBNEI7QUFDNUIsb0RBQTJEO0FBRTNELHlFQUF1RTtBQUN2RSx1REFBcUQ7QUFDckQsK0RBQTZEO0FBRXRELElBQU0sbUJBQW1CLEdBQUcsVUFDakMsTUFBYyxFQUNkLEtBQWdCO0lBRWhCLElBQU0sZ0JBQWdCLEdBQUcsS0FBSyxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsSUFBSSxDQUFDO1FBQ2hELENBQUMsQ0FBQyxLQUFLLENBQUMsSUFBSTtRQUNaLENBQUMsQ0FBQyxVQUFHLEtBQUssQ0FBQyxJQUFJLE9BQUksQ0FBQTtJQUNyQixJQUFNLGFBQWEsR0FBRyxLQUFLLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxJQUFJLENBQUM7UUFDN0MsQ0FBQyxDQUFDLEtBQUssQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLE9BQU8sRUF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
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/* eslint-disable no-tabs */
|
|
4
|
+
var jest_without_globals_1 = require("jest-without-globals");
|
|
5
|
+
var LinkFieldBuilder_1 = require("../../../../builders/fields/LinkFieldBuilder");
|
|
6
|
+
var CatalogBuilder_1 = require("../../../../builders/CatalogBuilder");
|
|
7
|
+
var genPrismaLinkFields_1 = require("./genPrismaLinkFields");
|
|
8
|
+
// yarn test --testPathPattern genPrismaLinkFields
|
|
9
|
+
describe('genPrismaLinkFields', function () {
|
|
10
|
+
describe('by type', function () {
|
|
11
|
+
test('int', function () {
|
|
12
|
+
var cards = new CatalogBuilder_1.default('cards', 'ru');
|
|
13
|
+
var someField = new LinkFieldBuilder_1.LinkFieldBuilder('user', 'userId', 'ru')
|
|
14
|
+
.setType('bigint')
|
|
15
|
+
.setRequired(true)
|
|
16
|
+
.build();
|
|
17
|
+
(0, jest_without_globals_1.expect)((0, genPrismaLinkFields_1.genPrismaLinkFields)(cards.build(), someField)).toEqual([
|
|
18
|
+
' userId BigInt',
|
|
19
|
+
' user User @relation("From-Card.user", fields: [userId], references: [id])',
|
|
20
|
+
]);
|
|
21
|
+
});
|
|
22
|
+
test('string', function () {
|
|
23
|
+
var cards = new CatalogBuilder_1.default('cards', 'ru');
|
|
24
|
+
var someField = new LinkFieldBuilder_1.LinkFieldBuilder('user', 'userId', 'ru')
|
|
25
|
+
.setType('string')
|
|
26
|
+
.setRequired(true)
|
|
27
|
+
.build();
|
|
28
|
+
(0, jest_without_globals_1.expect)((0, genPrismaLinkFields_1.genPrismaLinkFields)(cards.build(), someField)).toEqual([
|
|
29
|
+
' userId String',
|
|
30
|
+
' user User @relation("From-Card.user", fields: [userId], references: [id])',
|
|
31
|
+
]);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
describe('by requirement', function () {
|
|
35
|
+
test('requiered', function () {
|
|
36
|
+
var cards = new CatalogBuilder_1.default('cards', 'ru');
|
|
37
|
+
var someField = new LinkFieldBuilder_1.LinkFieldBuilder('user', 'userId', 'ru')
|
|
38
|
+
.setType('bigint')
|
|
39
|
+
.setRequired(true)
|
|
40
|
+
.build();
|
|
41
|
+
(0, jest_without_globals_1.expect)((0, genPrismaLinkFields_1.genPrismaLinkFields)(cards.build(), someField)).toEqual([
|
|
42
|
+
' userId BigInt',
|
|
43
|
+
' user User @relation("From-Card.user", fields: [userId], references: [id])',
|
|
44
|
+
]);
|
|
45
|
+
});
|
|
46
|
+
test('not requiered', function () {
|
|
47
|
+
var cards = new CatalogBuilder_1.default('cards', 'ru');
|
|
48
|
+
var someField = new LinkFieldBuilder_1.LinkFieldBuilder('user', 'userId', 'ru')
|
|
49
|
+
.setType('bigint')
|
|
50
|
+
.setRequired(false)
|
|
51
|
+
.build();
|
|
52
|
+
(0, jest_without_globals_1.expect)((0, genPrismaLinkFields_1.genPrismaLinkFields)(cards.build(), someField)).toEqual([
|
|
53
|
+
' userId BigInt?',
|
|
54
|
+
' user User? @relation("From-Card.user", fields: [userId], references: [id])',
|
|
55
|
+
]);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
describe('by field postfix', function () {
|
|
59
|
+
test('with postfix', function () {
|
|
60
|
+
var cards = new CatalogBuilder_1.default('cards', 'ru');
|
|
61
|
+
var someField = new LinkFieldBuilder_1.LinkFieldBuilder('user', 'userId', 'ru')
|
|
62
|
+
.setType('bigint')
|
|
63
|
+
.setRequired(true)
|
|
64
|
+
.build();
|
|
65
|
+
(0, jest_without_globals_1.expect)((0, genPrismaLinkFields_1.genPrismaLinkFields)(cards.build(), someField)).toEqual([
|
|
66
|
+
' userId BigInt',
|
|
67
|
+
' user User @relation("From-Card.user", fields: [userId], references: [id])',
|
|
68
|
+
]);
|
|
69
|
+
});
|
|
70
|
+
test('without postfix', function () {
|
|
71
|
+
var cards = new CatalogBuilder_1.default('cards', 'ru');
|
|
72
|
+
var someField = new LinkFieldBuilder_1.LinkFieldBuilder('user', 'userId', 'ru')
|
|
73
|
+
.setType('bigint')
|
|
74
|
+
.setRequired(true)
|
|
75
|
+
.build();
|
|
76
|
+
(0, jest_without_globals_1.expect)((0, genPrismaLinkFields_1.genPrismaLinkFields)(cards.build(), someField)).toEqual([
|
|
77
|
+
' userId BigInt',
|
|
78
|
+
' user User @relation("From-Card.user", fields: [userId], references: [id])',
|
|
79
|
+
]);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuUHJpc21hTGlua0ZpZWxkcy5zcGVjLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL3Byb2plY3RzR2VuZXJhdGlvbi9nZW5lcmF0b3JzL3ByaXNtYS9zY2hlbWUvZmllbGRzL2dlblByaXNtYUxpbmtGaWVsZHMuc3BlYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDRCQUE0QjtBQUM1Qiw2REFBNkM7QUFDN0MsaUZBQStFO0FBQy9FLHNFQUFnRTtBQUNoRSw2REFBMkQ7QUFFM0Qsa0RBQWtEO0FBRWxELFFBQVEsQ0FBQyxxQkFBcUIsRUFBRTtJQUM5QixRQUFRLENBQUMsU0FBUyxFQUFFO1FBQ2xCLElBQUksQ0FBQyxLQUFLLEVBQUU7WUFDVixJQUFNLEtBQUssR0FBRyxJQUFJLHdCQUFjLENBQUMsT0FBTyxFQUFFLElBQUksQ0FBQyxDQUFBO1lBQy9DLElBQU0sU0FBUyxHQUFHLElBQUksbUNBQWdCLENBQUMsTUFBTSxFQUFFLFFBQVEsRUFBRSxJQUFJLENBQUM7aUJBQzNELE9BQU8sQ0FBQyxRQUFRLENBQUM7aUJBQ2pCLFdBQVcsQ0FBQyxJQUFJLENBQUM7aUJBQ2pCLEtBQUssRUFBRSxDQUFBO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JLENBQUM7aUJBQzNELE9BQU8sQ0FBQyxRQUFRLENBQUM7aUJBQ2pCLFdBQVcsQ0FBQyxJQUFJLENBQUM7aUJBQ2pCLEtBQUssRUFBRSxDQUFBO1lBQ1YsSUFBQSw2QkFBTSxFQUFDLElBQUEseUNBQW1CLEVBQUMsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLFNBQVMsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDO2dCQUM1RCxnQkFBZ0I7Z0JBQ2hCLDRFQUE0RTthQUM3RSxDQUFDLENBQUE7UUFDSixDQUFDLENBQUMsQ0FBQTtRQUVGLElBQUksQ0FBQyxpQkFBaUIsRUFBRTtZQUN0QixJQUFNLEtBQUssR0FBRyxJQUFJLHdCQUFjLENBQUMsT0FBTyxFQUFFLElBQUksQ0FBQyxDQUFBO1lBQy9DLElBQU0sU0FBUyxHQUFHLElBQUksbUNBQWdCLENBQUMsTUFBTSxFQUFFLFFBQVEsRUFBRSxJQUFJLENBQUM7aUJBQzNELE9BQU8sQ0FBQyxRQUFRLENBQUM7aUJBQ2pCLFdBQVcsQ0FBQyxJQUFJLENBQUM7aUJBQ2pCLEtBQUssRUFBRSxDQUFBO1lBQ1YsSUFBQSw2QkFBTSxFQUFDLElBQUEseUNBQW1CLEVBQUMsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLFNBQVMsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDO2dCQUM1RCxnQkFBZ0I7Z0JBQ2hCLDRFQUE0RTthQUM3RSxDQUFDLENBQUE7UUFDSixDQUFDLENBQUMsQ0FBQTtJQUNKLENBQUMsQ0FBQyxDQUFBO0FBQ0osQ0FBQyxDQUFDLENBQUEifQ==
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genPrismaScalarField = exports.joinPrismaFieldParts = void 0;
|
|
4
|
+
var fieldTypeToPrismaType_1 = require("../../fieldTypeToPrismaType");
|
|
5
|
+
var genPrismaDefault_1 = require("./genPrismaDefault");
|
|
6
|
+
var joinPrismaFieldParts = function (parts) {
|
|
7
|
+
return parts
|
|
8
|
+
.filter(function (p) { return p; })
|
|
9
|
+
.map(function (p) { return p.trim(); })
|
|
10
|
+
.filter(function (p) { return p; })
|
|
11
|
+
.join('\t');
|
|
12
|
+
};
|
|
13
|
+
exports.joinPrismaFieldParts = joinPrismaFieldParts;
|
|
14
|
+
var genPrismaScalarField = function (field) {
|
|
15
|
+
var withoutPadding = (0, exports.joinPrismaFieldParts)([
|
|
16
|
+
field.name,
|
|
17
|
+
"".concat((0, fieldTypeToPrismaType_1.fieldTypeToPrismaType)(field.type)).concat(field.required ? '' : '?'),
|
|
18
|
+
field.type === 'date' ? ' @db.Date' : '',
|
|
19
|
+
(0, genPrismaDefault_1.genPrismaDefault)(field),
|
|
20
|
+
]);
|
|
21
|
+
return [" ".concat(withoutPadding).replace(/\s+/gu, '\t')];
|
|
22
|
+
};
|
|
23
|
+
exports.genPrismaScalarField = genPrismaScalarField;
|
|
24
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuUHJpc21hU2NhbGFyRmllbGQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvcHJvamVjdHNHZW5lcmF0aW9uL2dlbmVyYXRvcnMvcHJpc21hL3NjaGVtZS9maWVsZHMvZ2VuUHJpc21hU2NhbGFyRmllbGQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBR0EscUVBQW1FO0FBQ25FLHVEQUFxRDtBQUU5QyxJQUFNLG9CQUFvQixHQUFHLFVBQUMsS0FBZ0M7SUFDbkUsT0FBQSxLQUFLO1NBQ0YsTUFBTSxDQUFDLFVBQUMsQ0FBQyxJQUFLLE9BQUEsQ0FBQyxFQUFELENBQUMsQ0FBQztTQUNoQixHQUFHLENBQUMsVUFBQyxDQUFDLElBQUssT0FBQyxDQUFZLENBQUMsSUFBSSxFQUFFLEVBQXBCLENBQW9CLENBQUM7U0FDaEMsTUFBTSxDQUFDLFVBQUMsQ0FBQyxJQUFLLE9BQUEsQ0FBQyxFQUFELENBQUMsQ0FBQztTQUNoQixJQUFJLENBQUMsSUFBSSxDQUFDO0FBSmIsQ0FJYSxDQUFBO0FBTEYsUUFBQSxvQkFBb0Isd0JBS2xCO0FBRVIsSUFBTSxvQkFBb0IsR0FBRyxVQUFDLEtBQWtCO0lBQ3JELElBQU0sY0FBYyxHQUFHLElBQUEsNEJBQW9CLEVBQUM7UUFDMUMsS0FBSyxDQUFDLElBQUk7UUFDVixVQUFHLElBQUEsNkNBQXFCLEVBQUMsS0FBSyxDQUFDLElBQUksQ0FBQyxTQUFHLEtBQUssQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsR0FBRyxDQUFFO1FBQ2xFLEtBQUssQ0FBQyxJQUFJLEtBQUssTUFBTSxDQUFDLENBQUMsQ0FBQyxXQUFXLENBQUMsQ0FBQyxDQUFDLEVBQUU7UUFDeEMsSUFBQSxtQ0FBZ0IsRUFBQyxLQUFLLENBQUM7S0FDeEIsQ0FBQyxDQUFBO0lBRUYsT0FBTyxDQUFDLFlBQUssY0FBYyxDQUFFLENBQUMsT0FBTyxDQUFDLE9BQU8sRUFBRSxJQUFJLENBQUMsQ0FBQyxDQUFBO0FBQ3ZELENBQUMsQ0FBQTtBQVRZLFFBQUEsb0JBQW9CLHdCQVNoQyJ9
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/* eslint-disable no-tabs */
|
|
4
|
+
var jest_without_globals_1 = require("jest-without-globals");
|
|
5
|
+
var ScalarFieldBuilder_1 = require("../../../../builders/fields/ScalarFieldBuilder");
|
|
6
|
+
var genPrismaScalarField_1 = require("./genPrismaScalarField");
|
|
7
|
+
// yarn test --testPathPattern genPrismaScalarField
|
|
8
|
+
describe('genPrismaScalarField', function () {
|
|
9
|
+
test('int optional', function () {
|
|
10
|
+
var someField = new ScalarFieldBuilder_1.ScalarFieldBuilder('someField', 'ru')
|
|
11
|
+
.setType('int')
|
|
12
|
+
.build();
|
|
13
|
+
(0, jest_without_globals_1.expect)((0, genPrismaScalarField_1.genPrismaScalarField)(someField)).toEqual([
|
|
14
|
+
' someField Int?'.replace(/\s+/gu, '\t'),
|
|
15
|
+
]);
|
|
16
|
+
});
|
|
17
|
+
test('int required', function () {
|
|
18
|
+
var someField = new ScalarFieldBuilder_1.ScalarFieldBuilder('someField', 'ru')
|
|
19
|
+
.setType('int')
|
|
20
|
+
.setRequired()
|
|
21
|
+
.build();
|
|
22
|
+
(0, jest_without_globals_1.expect)((0, genPrismaScalarField_1.genPrismaScalarField)(someField)).toEqual([
|
|
23
|
+
' someField Int'.replace(/\s+/gu, '\t'),
|
|
24
|
+
]);
|
|
25
|
+
});
|
|
26
|
+
// string
|
|
27
|
+
test('string optional', function () {
|
|
28
|
+
var someField = new ScalarFieldBuilder_1.ScalarFieldBuilder('someField', 'ru')
|
|
29
|
+
.setType('string')
|
|
30
|
+
.build();
|
|
31
|
+
(0, jest_without_globals_1.expect)((0, genPrismaScalarField_1.genPrismaScalarField)(someField)).toEqual([
|
|
32
|
+
' someField String?'.replace(/\s+/gu, '\t'),
|
|
33
|
+
]);
|
|
34
|
+
});
|
|
35
|
+
test('string required', function () {
|
|
36
|
+
var someField = new ScalarFieldBuilder_1.ScalarFieldBuilder('someField', 'ru')
|
|
37
|
+
.setType('string')
|
|
38
|
+
.setRequired()
|
|
39
|
+
.build();
|
|
40
|
+
(0, jest_without_globals_1.expect)((0, genPrismaScalarField_1.genPrismaScalarField)(someField)).toEqual([
|
|
41
|
+
' someField String'.replace(/\s+/gu, '\t'),
|
|
42
|
+
]);
|
|
43
|
+
});
|
|
44
|
+
// float
|
|
45
|
+
test('float optional', function () {
|
|
46
|
+
var someField = new ScalarFieldBuilder_1.ScalarFieldBuilder('someField', 'ru')
|
|
47
|
+
.setType('float')
|
|
48
|
+
.build();
|
|
49
|
+
(0, jest_without_globals_1.expect)((0, genPrismaScalarField_1.genPrismaScalarField)(someField)).toEqual([
|
|
50
|
+
' someField Float?'.replace(/\s+/gu, '\t'),
|
|
51
|
+
]);
|
|
52
|
+
});
|
|
53
|
+
test('float required', function () {
|
|
54
|
+
var someField = new ScalarFieldBuilder_1.ScalarFieldBuilder('someField', 'ru')
|
|
55
|
+
.setType('float')
|
|
56
|
+
.setRequired()
|
|
57
|
+
.build();
|
|
58
|
+
(0, jest_without_globals_1.expect)((0, genPrismaScalarField_1.genPrismaScalarField)(someField)).toEqual([
|
|
59
|
+
' someField Float'.replace(/\s+/gu, '\t'),
|
|
60
|
+
]);
|
|
61
|
+
});
|
|
62
|
+
// bool
|
|
63
|
+
test('bool optional', function () {
|
|
64
|
+
var someField = new ScalarFieldBuilder_1.ScalarFieldBuilder('someField', 'ru')
|
|
65
|
+
.setType('bool')
|
|
66
|
+
.build();
|
|
67
|
+
(0, jest_without_globals_1.expect)((0, genPrismaScalarField_1.genPrismaScalarField)(someField)).toEqual([
|
|
68
|
+
' someField Boolean?'.replace(/\s+/gu, '\t'),
|
|
69
|
+
]);
|
|
70
|
+
});
|
|
71
|
+
test('bool required', function () {
|
|
72
|
+
var someField = new ScalarFieldBuilder_1.ScalarFieldBuilder('someField', 'ru')
|
|
73
|
+
.setType('bool')
|
|
74
|
+
.setRequired()
|
|
75
|
+
.build();
|
|
76
|
+
(0, jest_without_globals_1.expect)((0, genPrismaScalarField_1.genPrismaScalarField)(someField)).toEqual([
|
|
77
|
+
' someField Boolean'.replace(/\s+/gu, '\t'),
|
|
78
|
+
]);
|
|
79
|
+
});
|
|
80
|
+
// datetime
|
|
81
|
+
test('datetime optional', function () {
|
|
82
|
+
var someField = new ScalarFieldBuilder_1.ScalarFieldBuilder('someField', 'ru')
|
|
83
|
+
.setType('datetime')
|
|
84
|
+
.build();
|
|
85
|
+
(0, jest_without_globals_1.expect)((0, genPrismaScalarField_1.genPrismaScalarField)(someField)).toEqual([
|
|
86
|
+
' someField DateTime?'.replace(/\s+/gu, '\t'),
|
|
87
|
+
]);
|
|
88
|
+
});
|
|
89
|
+
test('datetime required', function () {
|
|
90
|
+
var someField = new ScalarFieldBuilder_1.ScalarFieldBuilder('someField', 'ru')
|
|
91
|
+
.setType('datetime')
|
|
92
|
+
.setRequired()
|
|
93
|
+
.build();
|
|
94
|
+
(0, jest_without_globals_1.expect)((0, genPrismaScalarField_1.genPrismaScalarField)(someField)).toEqual([
|
|
95
|
+
' someField DateTime'.replace(/\s+/gu, '\t'),
|
|
96
|
+
]);
|
|
97
|
+
});
|
|
98
|
+
// date
|
|
99
|
+
test('date optional', function () {
|
|
100
|
+
var someField = new ScalarFieldBuilder_1.ScalarFieldBuilder('someField', 'ru')
|
|
101
|
+
.setType('date')
|
|
102
|
+
.build();
|
|
103
|
+
(0, jest_without_globals_1.expect)((0, genPrismaScalarField_1.genPrismaScalarField)(someField)).toEqual([
|
|
104
|
+
' someField DateTime? @db.Date'.replace(/\s+/gu, '\t'),
|
|
105
|
+
]);
|
|
106
|
+
});
|
|
107
|
+
test('date required', function () {
|
|
108
|
+
var someField = new ScalarFieldBuilder_1.ScalarFieldBuilder('someField', 'ru')
|
|
109
|
+
.setType('date')
|
|
110
|
+
.setRequired()
|
|
111
|
+
.build();
|
|
112
|
+
(0, jest_without_globals_1.expect)((0, genPrismaScalarField_1.genPrismaScalarField)(someField)).toEqual([
|
|
113
|
+
' someField DateTime @db.Date'.replace(/\s+/gu, '\t'),
|
|
114
|
+
]);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuUHJpc21hU2NhbGFyRmllbGQuc3BlYy5qcyIsInNvdXJjZVJvb3QiOiI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VBQUUsSUFBSSxDQUFDO1NBQzlDLENBQUMsQ0FBQTtJQUNKLENBQUMsQ0FBQyxDQUFBO0lBRUYsT0FBTztJQUNQLElBQUksQ0FBQyxlQUFlLEVBQUU7UUFDcEIsSUFBTSxTQUFTLEdBQUcsSUFBSSx1Q0FBa0IsQ0FBQyxXQUFXLEVBQUUsSUFBSSxDQUFDO2FBQ3hELE9BQU8sQ0FBQyxNQUFNLENBQUM7YUFDZixLQUFLLEVBQUUsQ0FBQTtRQUNWLElBQUEsNkJBQU0sRUFBQyxJQUFBLDJDQUFvQixFQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDO1lBQzlDLGdDQUFnQyxDQUFDLE9BQU8sQ0FBQyxPQUFPLEVBQUUsSUFBSSxDQUFDO1NBQ3hELENBQUMsQ0FBQTtJQUNKLENBQUMsQ0FBQyxDQUFBO0lBQ0YsSUFBSSxDQUFDLGVBQWUsRUFBRTtRQUNwQixJQUFNLFNBQVMsR0FBRyxJQUFJLHVDQUFrQixDQUFDLFdBQVcsRUFBRSxJQUFJLENBQUM7YUFDeEQsT0FBTyxDQUFDLE1BQU0sQ0FBQzthQUNmLFdBQVcsRUFBRTthQUNiLEtBQUssRUFBRSxDQUFBO1FBQ1YsSUFBQSw2QkFBTSxFQUFDLElBQUEsMkNBQW9CLEVBQUMsU0FBUyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUM7WUFDOUMsK0JBQStCLENBQUMsT0FBTyxDQUFDLE9BQU8sRUFBRSxJQUFJLENBQUM7U0FDdkQsQ0FBQyxDQUFBO0lBQ0osQ0FBQyxDQUFDLENBQUE7QUFDSixDQUFDLENBQUMsQ0FBQSJ9
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.genPrismaEntity = void 0;
|
|
13
|
+
/* eslint-disable max-len */
|
|
14
|
+
/* eslint-disable no-tabs */
|
|
15
|
+
var R = require("ramda");
|
|
16
|
+
var cases_1 = require("../../../../utils/cases");
|
|
17
|
+
var getLinksFromExternalEntities_1 = require("../../../links/getLinksFromExternalEntities");
|
|
18
|
+
var genPrismaField_1 = require("./fields/genPrismaField");
|
|
19
|
+
var genPrismaFieldFromExternalEntity_1 = require("./fields/genPrismaFieldFromExternalEntity");
|
|
20
|
+
var genPrismaEntity = function (entity, links) {
|
|
21
|
+
var fields = __spreadArray(__spreadArray([], R.flatten(entity.fields.map(function (field) { return (0, genPrismaField_1.genPrismaField)(entity, field); })), true), (0, getLinksFromExternalEntities_1.getLinksFromExternalEntities)(entity, links)
|
|
22
|
+
.filter(function (el) { return el.fromField.linkCategory === 'entity'; })
|
|
23
|
+
.map(function (link) { return (0, genPrismaFieldFromExternalEntity_1.genPrismaFieldFromExternalEntity)(link); }), true);
|
|
24
|
+
return "model ".concat((0, cases_1.pascalSingular)(entity.name), " {\n").concat(fields.join('\n')).concat(entity.uniqueConstraints.length > 0
|
|
25
|
+
? '\n' +
|
|
26
|
+
entity.uniqueConstraints
|
|
27
|
+
.map(function (fields) { return "\t@@unique([".concat(fields.join(', '), "])"); })
|
|
28
|
+
.join('\n')
|
|
29
|
+
: '', "\n}\n");
|
|
30
|
+
};
|
|
31
|
+
exports.genPrismaEntity = genPrismaEntity;
|
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuUHJpc21hRW50aXR5LmpzIiwic291cmNlUm9vdCI6IiIs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