@contember/schema-utils 2.1.0-alpha.30 → 2.1.0-alpha.35
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/package.json +11 -6
- package/src/acl/AllowAllPermissionFactory.ts +1 -1
- package/src/acl/PredicateDefinitionProcessor.ts +5 -7
- package/src/dataUtils.ts +1 -1
- package/src/definition-generator/AclDefinitionCodeGenerator.ts +7 -8
- package/src/definition-generator/DefinitionCodeGenerator.ts +8 -14
- package/src/definition-generator/DefinitionNamingConventions.ts +50 -1
- package/src/index.ts +2 -2
- package/src/lax/LaxSchemaConverter.ts +0 -4
- package/src/lax/schema.ts +4 -1
- package/src/model/modelUtils.ts +2 -4
- package/src/schemaChecksum.ts +0 -1
- package/src/schemaFilter.ts +1 -1
- package/src/type-schema/acl.ts +16 -13
- package/src/type-schema/actions.ts +0 -2
- package/src/type-schema/condition.ts +25 -23
- package/src/type-schema/model.ts +10 -8
- package/src/type-schema/validation.ts +5 -4
- package/src/type-schema/where.ts +11 -9
- package/src/utils/deepCompare.ts +1 -1
- package/src/utils/printJsValue.ts +23 -25
- package/src/validation/AclValidator.ts +0 -2
- package/src/validation/ActionsValidator.ts +7 -7
- package/src/validation/MembershipResolver.ts +0 -3
- package/src/validation/ModelValidator.ts +43 -32
- package/src/validation/SchemaValidator.ts +7 -6
- package/src/validation/ValidationValidator.ts +1 -3
- package/src/validation/errors.ts +0 -3
- package/tests/cases/unit/conditionSchema.test.ts +1 -2
- package/tests/cases/unit/deepCompare.test.ts +2 -3
- package/tests/cases/unit/laxSchemaConverter.test.ts +0 -4
- package/tests/cases/unit/membershipResolver.test.ts +88 -60
- package/tests/cases/unit/modelSchema.test.ts +4 -4
- package/tests/cases/unit/modelValidator.test.ts +0 -1
- package/tests/cases/unit/printJsvalue.test.ts +11 -7
- package/tests/cases/unit/whereSchema.test.ts +19 -18
- package/dist/development/index.cjs +0 -110
- package/dist/development/index.cjs.map +0 -1
- package/dist/development/index.js +0 -94
- package/dist/development/index.js.map +0 -1
- package/dist/development/src/acl/AllowAllPermissionFactory.cjs +0 -42
- package/dist/development/src/acl/AllowAllPermissionFactory.cjs.map +0 -1
- package/dist/development/src/acl/AllowAllPermissionFactory.js +0 -42
- package/dist/development/src/acl/AllowAllPermissionFactory.js.map +0 -1
- package/dist/development/src/acl/PredicateDefinitionProcessor.cjs +0 -71
- package/dist/development/src/acl/PredicateDefinitionProcessor.cjs.map +0 -1
- package/dist/development/src/acl/PredicateDefinitionProcessor.js +0 -71
- package/dist/development/src/acl/PredicateDefinitionProcessor.js.map +0 -1
- package/dist/development/src/acl/schemaUtils.cjs +0 -11
- package/dist/development/src/acl/schemaUtils.cjs.map +0 -1
- package/dist/development/src/acl/schemaUtils.js +0 -11
- package/dist/development/src/acl/schemaUtils.js.map +0 -1
- package/dist/development/src/dataUtils.cjs +0 -59
- package/dist/development/src/dataUtils.cjs.map +0 -1
- package/dist/development/src/dataUtils.js +0 -59
- package/dist/development/src/dataUtils.js.map +0 -1
- package/dist/development/src/definition-generator/AclDefinitionCodeGenerator.cjs +0 -117
- package/dist/development/src/definition-generator/AclDefinitionCodeGenerator.cjs.map +0 -1
- package/dist/development/src/definition-generator/AclDefinitionCodeGenerator.js +0 -117
- package/dist/development/src/definition-generator/AclDefinitionCodeGenerator.js.map +0 -1
- package/dist/development/src/definition-generator/DefinitionCodeGenerator.cjs +0 -218
- package/dist/development/src/definition-generator/DefinitionCodeGenerator.cjs.map +0 -1
- package/dist/development/src/definition-generator/DefinitionCodeGenerator.js +0 -218
- package/dist/development/src/definition-generator/DefinitionCodeGenerator.js.map +0 -1
- package/dist/development/src/definition-generator/DefinitionNamingConventions.cjs +0 -19
- package/dist/development/src/definition-generator/DefinitionNamingConventions.cjs.map +0 -1
- package/dist/development/src/definition-generator/DefinitionNamingConventions.js +0 -19
- package/dist/development/src/definition-generator/DefinitionNamingConventions.js.map +0 -1
- package/dist/development/src/definition-generator/TsDefinitionGenerator.cjs +0 -17
- package/dist/development/src/definition-generator/TsDefinitionGenerator.cjs.map +0 -1
- package/dist/development/src/definition-generator/TsDefinitionGenerator.js +0 -17
- package/dist/development/src/definition-generator/TsDefinitionGenerator.js.map +0 -1
- package/dist/development/src/lax/LaxSchemaConverter.cjs +0 -202
- package/dist/development/src/lax/LaxSchemaConverter.cjs.map +0 -1
- package/dist/development/src/lax/LaxSchemaConverter.js +0 -202
- package/dist/development/src/lax/LaxSchemaConverter.js.map +0 -1
- package/dist/development/src/lax/schema.cjs +0 -70
- package/dist/development/src/lax/schema.cjs.map +0 -1
- package/dist/development/src/lax/schema.js +0 -53
- package/dist/development/src/lax/schema.js.map +0 -1
- package/dist/development/src/model/NamingConventions.cjs +0 -28
- package/dist/development/src/model/NamingConventions.cjs.map +0 -1
- package/dist/development/src/model/NamingConventions.js +0 -28
- package/dist/development/src/model/NamingConventions.js.map +0 -1
- package/dist/development/src/model/modelUtils.cjs +0 -231
- package/dist/development/src/model/modelUtils.cjs.map +0 -1
- package/dist/development/src/model/modelUtils.js +0 -231
- package/dist/development/src/model/modelUtils.js.map +0 -1
- package/dist/development/src/model/resolveDefaultColumnType.cjs +0 -30
- package/dist/development/src/model/resolveDefaultColumnType.cjs.map +0 -1
- package/dist/development/src/model/resolveDefaultColumnType.js +0 -30
- package/dist/development/src/model/resolveDefaultColumnType.js.map +0 -1
- package/dist/development/src/schemaChecksum.cjs +0 -9
- package/dist/development/src/schemaChecksum.cjs.map +0 -1
- package/dist/development/src/schemaChecksum.js +0 -9
- package/dist/development/src/schemaChecksum.js.map +0 -1
- package/dist/development/src/schemaFilter.cjs +0 -24
- package/dist/development/src/schemaFilter.cjs.map +0 -1
- package/dist/development/src/schemaFilter.js +0 -24
- package/dist/development/src/schemaFilter.js.map +0 -1
- package/dist/development/src/schemaNormalizer.cjs +0 -72
- package/dist/development/src/schemaNormalizer.cjs.map +0 -1
- package/dist/development/src/schemaNormalizer.js +0 -72
- package/dist/development/src/schemaNormalizer.js.map +0 -1
- package/dist/development/src/type-schema/acl.cjs +0 -146
- package/dist/development/src/type-schema/acl.cjs.map +0 -1
- package/dist/development/src/type-schema/acl.js +0 -129
- package/dist/development/src/type-schema/acl.js.map +0 -1
- package/dist/development/src/type-schema/actions.cjs +0 -88
- package/dist/development/src/type-schema/actions.cjs.map +0 -1
- package/dist/development/src/type-schema/actions.js +0 -71
- package/dist/development/src/type-schema/actions.js.map +0 -1
- package/dist/development/src/type-schema/condition.cjs +0 -92
- package/dist/development/src/type-schema/condition.cjs.map +0 -1
- package/dist/development/src/type-schema/condition.js +0 -75
- package/dist/development/src/type-schema/condition.js.map +0 -1
- package/dist/development/src/type-schema/model.cjs +0 -219
- package/dist/development/src/type-schema/model.cjs.map +0 -1
- package/dist/development/src/type-schema/model.js +0 -203
- package/dist/development/src/type-schema/model.js.map +0 -1
- package/dist/development/src/type-schema/settings.cjs +0 -34
- package/dist/development/src/type-schema/settings.cjs.map +0 -1
- package/dist/development/src/type-schema/settings.js +0 -17
- package/dist/development/src/type-schema/settings.js.map +0 -1
- package/dist/development/src/type-schema/validation.cjs +0 -115
- package/dist/development/src/type-schema/validation.cjs.map +0 -1
- package/dist/development/src/type-schema/validation.js +0 -98
- package/dist/development/src/type-schema/validation.js.map +0 -1
- package/dist/development/src/type-schema/where.cjs +0 -44
- package/dist/development/src/type-schema/where.cjs.map +0 -1
- package/dist/development/src/type-schema/where.js +0 -27
- package/dist/development/src/type-schema/where.js.map +0 -1
- package/dist/development/src/utils/assertNever.cjs +0 -7
- package/dist/development/src/utils/assertNever.cjs.map +0 -1
- package/dist/development/src/utils/assertNever.js +0 -7
- package/dist/development/src/utils/assertNever.js.map +0 -1
- package/dist/development/src/utils/deepCompare.cjs +0 -134
- package/dist/development/src/utils/deepCompare.cjs.map +0 -1
- package/dist/development/src/utils/deepCompare.js +0 -134
- package/dist/development/src/utils/deepCompare.js.map +0 -1
- package/dist/development/src/utils/isIt.cjs +0 -7
- package/dist/development/src/utils/isIt.cjs.map +0 -1
- package/dist/development/src/utils/isIt.js +0 -7
- package/dist/development/src/utils/isIt.js.map +0 -1
- package/dist/development/src/utils/printJsValue.cjs +0 -42
- package/dist/development/src/utils/printJsValue.cjs.map +0 -1
- package/dist/development/src/utils/printJsValue.js +0 -42
- package/dist/development/src/utils/printJsValue.js.map +0 -1
- package/dist/development/src/validation/AclValidator.cjs +0 -168
- package/dist/development/src/validation/AclValidator.cjs.map +0 -1
- package/dist/development/src/validation/AclValidator.js +0 -168
- package/dist/development/src/validation/AclValidator.js.map +0 -1
- package/dist/development/src/validation/ActionsValidator.cjs +0 -127
- package/dist/development/src/validation/ActionsValidator.cjs.map +0 -1
- package/dist/development/src/validation/ActionsValidator.js +0 -110
- package/dist/development/src/validation/ActionsValidator.js.map +0 -1
- package/dist/development/src/validation/MembershipResolver.cjs +0 -129
- package/dist/development/src/validation/MembershipResolver.cjs.map +0 -1
- package/dist/development/src/validation/MembershipResolver.js +0 -129
- package/dist/development/src/validation/MembershipResolver.js.map +0 -1
- package/dist/development/src/validation/ModelValidator.cjs +0 -310
- package/dist/development/src/validation/ModelValidator.cjs.map +0 -1
- package/dist/development/src/validation/ModelValidator.js +0 -310
- package/dist/development/src/validation/ModelValidator.js.map +0 -1
- package/dist/development/src/validation/SchemaValidator.cjs +0 -29
- package/dist/development/src/validation/SchemaValidator.cjs.map +0 -1
- package/dist/development/src/validation/SchemaValidator.js +0 -29
- package/dist/development/src/validation/SchemaValidator.js.map +0 -1
- package/dist/development/src/validation/ValidationValidator.cjs +0 -121
- package/dist/development/src/validation/ValidationValidator.cjs.map +0 -1
- package/dist/development/src/validation/ValidationValidator.js +0 -121
- package/dist/development/src/validation/ValidationValidator.js.map +0 -1
- package/dist/development/src/validation/errors.cjs +0 -16
- package/dist/development/src/validation/errors.cjs.map +0 -1
- package/dist/development/src/validation/errors.js +0 -16
- package/dist/development/src/validation/errors.js.map +0 -1
- package/dist/production/index.cjs +0 -110
- package/dist/production/index.cjs.map +0 -1
- package/dist/production/index.js +0 -94
- package/dist/production/index.js.map +0 -1
- package/dist/production/src/acl/AllowAllPermissionFactory.cjs +0 -42
- package/dist/production/src/acl/AllowAllPermissionFactory.cjs.map +0 -1
- package/dist/production/src/acl/AllowAllPermissionFactory.js +0 -42
- package/dist/production/src/acl/AllowAllPermissionFactory.js.map +0 -1
- package/dist/production/src/acl/PredicateDefinitionProcessor.cjs +0 -71
- package/dist/production/src/acl/PredicateDefinitionProcessor.cjs.map +0 -1
- package/dist/production/src/acl/PredicateDefinitionProcessor.js +0 -71
- package/dist/production/src/acl/PredicateDefinitionProcessor.js.map +0 -1
- package/dist/production/src/acl/schemaUtils.cjs +0 -11
- package/dist/production/src/acl/schemaUtils.cjs.map +0 -1
- package/dist/production/src/acl/schemaUtils.js +0 -11
- package/dist/production/src/acl/schemaUtils.js.map +0 -1
- package/dist/production/src/dataUtils.cjs +0 -59
- package/dist/production/src/dataUtils.cjs.map +0 -1
- package/dist/production/src/dataUtils.js +0 -59
- package/dist/production/src/dataUtils.js.map +0 -1
- package/dist/production/src/definition-generator/AclDefinitionCodeGenerator.cjs +0 -117
- package/dist/production/src/definition-generator/AclDefinitionCodeGenerator.cjs.map +0 -1
- package/dist/production/src/definition-generator/AclDefinitionCodeGenerator.js +0 -117
- package/dist/production/src/definition-generator/AclDefinitionCodeGenerator.js.map +0 -1
- package/dist/production/src/definition-generator/DefinitionCodeGenerator.cjs +0 -218
- package/dist/production/src/definition-generator/DefinitionCodeGenerator.cjs.map +0 -1
- package/dist/production/src/definition-generator/DefinitionCodeGenerator.js +0 -218
- package/dist/production/src/definition-generator/DefinitionCodeGenerator.js.map +0 -1
- package/dist/production/src/definition-generator/DefinitionNamingConventions.cjs +0 -19
- package/dist/production/src/definition-generator/DefinitionNamingConventions.cjs.map +0 -1
- package/dist/production/src/definition-generator/DefinitionNamingConventions.js +0 -19
- package/dist/production/src/definition-generator/DefinitionNamingConventions.js.map +0 -1
- package/dist/production/src/definition-generator/TsDefinitionGenerator.cjs +0 -17
- package/dist/production/src/definition-generator/TsDefinitionGenerator.cjs.map +0 -1
- package/dist/production/src/definition-generator/TsDefinitionGenerator.js +0 -17
- package/dist/production/src/definition-generator/TsDefinitionGenerator.js.map +0 -1
- package/dist/production/src/lax/LaxSchemaConverter.cjs +0 -202
- package/dist/production/src/lax/LaxSchemaConverter.cjs.map +0 -1
- package/dist/production/src/lax/LaxSchemaConverter.js +0 -202
- package/dist/production/src/lax/LaxSchemaConverter.js.map +0 -1
- package/dist/production/src/lax/schema.cjs +0 -70
- package/dist/production/src/lax/schema.cjs.map +0 -1
- package/dist/production/src/lax/schema.js +0 -53
- package/dist/production/src/lax/schema.js.map +0 -1
- package/dist/production/src/model/NamingConventions.cjs +0 -28
- package/dist/production/src/model/NamingConventions.cjs.map +0 -1
- package/dist/production/src/model/NamingConventions.js +0 -28
- package/dist/production/src/model/NamingConventions.js.map +0 -1
- package/dist/production/src/model/modelUtils.cjs +0 -231
- package/dist/production/src/model/modelUtils.cjs.map +0 -1
- package/dist/production/src/model/modelUtils.js +0 -231
- package/dist/production/src/model/modelUtils.js.map +0 -1
- package/dist/production/src/model/resolveDefaultColumnType.cjs +0 -30
- package/dist/production/src/model/resolveDefaultColumnType.cjs.map +0 -1
- package/dist/production/src/model/resolveDefaultColumnType.js +0 -30
- package/dist/production/src/model/resolveDefaultColumnType.js.map +0 -1
- package/dist/production/src/schemaChecksum.cjs +0 -9
- package/dist/production/src/schemaChecksum.cjs.map +0 -1
- package/dist/production/src/schemaChecksum.js +0 -9
- package/dist/production/src/schemaChecksum.js.map +0 -1
- package/dist/production/src/schemaFilter.cjs +0 -24
- package/dist/production/src/schemaFilter.cjs.map +0 -1
- package/dist/production/src/schemaFilter.js +0 -24
- package/dist/production/src/schemaFilter.js.map +0 -1
- package/dist/production/src/schemaNormalizer.cjs +0 -72
- package/dist/production/src/schemaNormalizer.cjs.map +0 -1
- package/dist/production/src/schemaNormalizer.js +0 -72
- package/dist/production/src/schemaNormalizer.js.map +0 -1
- package/dist/production/src/type-schema/acl.cjs +0 -146
- package/dist/production/src/type-schema/acl.cjs.map +0 -1
- package/dist/production/src/type-schema/acl.js +0 -129
- package/dist/production/src/type-schema/acl.js.map +0 -1
- package/dist/production/src/type-schema/actions.cjs +0 -88
- package/dist/production/src/type-schema/actions.cjs.map +0 -1
- package/dist/production/src/type-schema/actions.js +0 -71
- package/dist/production/src/type-schema/actions.js.map +0 -1
- package/dist/production/src/type-schema/condition.cjs +0 -92
- package/dist/production/src/type-schema/condition.cjs.map +0 -1
- package/dist/production/src/type-schema/condition.js +0 -75
- package/dist/production/src/type-schema/condition.js.map +0 -1
- package/dist/production/src/type-schema/model.cjs +0 -219
- package/dist/production/src/type-schema/model.cjs.map +0 -1
- package/dist/production/src/type-schema/model.js +0 -203
- package/dist/production/src/type-schema/model.js.map +0 -1
- package/dist/production/src/type-schema/settings.cjs +0 -34
- package/dist/production/src/type-schema/settings.cjs.map +0 -1
- package/dist/production/src/type-schema/settings.js +0 -17
- package/dist/production/src/type-schema/settings.js.map +0 -1
- package/dist/production/src/type-schema/validation.cjs +0 -115
- package/dist/production/src/type-schema/validation.cjs.map +0 -1
- package/dist/production/src/type-schema/validation.js +0 -98
- package/dist/production/src/type-schema/validation.js.map +0 -1
- package/dist/production/src/type-schema/where.cjs +0 -44
- package/dist/production/src/type-schema/where.cjs.map +0 -1
- package/dist/production/src/type-schema/where.js +0 -27
- package/dist/production/src/type-schema/where.js.map +0 -1
- package/dist/production/src/utils/assertNever.cjs +0 -7
- package/dist/production/src/utils/assertNever.cjs.map +0 -1
- package/dist/production/src/utils/assertNever.js +0 -7
- package/dist/production/src/utils/assertNever.js.map +0 -1
- package/dist/production/src/utils/deepCompare.cjs +0 -134
- package/dist/production/src/utils/deepCompare.cjs.map +0 -1
- package/dist/production/src/utils/deepCompare.js +0 -134
- package/dist/production/src/utils/deepCompare.js.map +0 -1
- package/dist/production/src/utils/isIt.cjs +0 -7
- package/dist/production/src/utils/isIt.cjs.map +0 -1
- package/dist/production/src/utils/isIt.js +0 -7
- package/dist/production/src/utils/isIt.js.map +0 -1
- package/dist/production/src/utils/printJsValue.cjs +0 -42
- package/dist/production/src/utils/printJsValue.cjs.map +0 -1
- package/dist/production/src/utils/printJsValue.js +0 -42
- package/dist/production/src/utils/printJsValue.js.map +0 -1
- package/dist/production/src/validation/AclValidator.cjs +0 -168
- package/dist/production/src/validation/AclValidator.cjs.map +0 -1
- package/dist/production/src/validation/AclValidator.js +0 -168
- package/dist/production/src/validation/AclValidator.js.map +0 -1
- package/dist/production/src/validation/ActionsValidator.cjs +0 -127
- package/dist/production/src/validation/ActionsValidator.cjs.map +0 -1
- package/dist/production/src/validation/ActionsValidator.js +0 -110
- package/dist/production/src/validation/ActionsValidator.js.map +0 -1
- package/dist/production/src/validation/MembershipResolver.cjs +0 -129
- package/dist/production/src/validation/MembershipResolver.cjs.map +0 -1
- package/dist/production/src/validation/MembershipResolver.js +0 -129
- package/dist/production/src/validation/MembershipResolver.js.map +0 -1
- package/dist/production/src/validation/ModelValidator.cjs +0 -310
- package/dist/production/src/validation/ModelValidator.cjs.map +0 -1
- package/dist/production/src/validation/ModelValidator.js +0 -310
- package/dist/production/src/validation/ModelValidator.js.map +0 -1
- package/dist/production/src/validation/SchemaValidator.cjs +0 -29
- package/dist/production/src/validation/SchemaValidator.cjs.map +0 -1
- package/dist/production/src/validation/SchemaValidator.js +0 -29
- package/dist/production/src/validation/SchemaValidator.js.map +0 -1
- package/dist/production/src/validation/ValidationValidator.cjs +0 -121
- package/dist/production/src/validation/ValidationValidator.cjs.map +0 -1
- package/dist/production/src/validation/ValidationValidator.js +0 -121
- package/dist/production/src/validation/ValidationValidator.js.map +0 -1
- package/dist/production/src/validation/errors.cjs +0 -16
- package/dist/production/src/validation/errors.cjs.map +0 -1
- package/dist/production/src/validation/errors.js +0 -16
- package/dist/production/src/validation/errors.js.map +0 -1
- package/dist/tests/cases/unit/conditionSchema.test.d.ts +0 -2
- package/dist/tests/cases/unit/conditionSchema.test.d.ts.map +0 -1
- package/dist/tests/cases/unit/deepCompare.test.d.ts +0 -2
- package/dist/tests/cases/unit/deepCompare.test.d.ts.map +0 -1
- package/dist/tests/cases/unit/laxSchemaConverter.test.d.ts +0 -2
- package/dist/tests/cases/unit/laxSchemaConverter.test.d.ts.map +0 -1
- package/dist/tests/cases/unit/membershipResolver.test.d.ts +0 -2
- package/dist/tests/cases/unit/membershipResolver.test.d.ts.map +0 -1
- package/dist/tests/cases/unit/modelSchema.test.d.ts +0 -2
- package/dist/tests/cases/unit/modelSchema.test.d.ts.map +0 -1
- package/dist/tests/cases/unit/modelValidator.test.d.ts +0 -2
- package/dist/tests/cases/unit/modelValidator.test.d.ts.map +0 -1
- package/dist/tests/cases/unit/printJsvalue.test.d.ts +0 -2
- package/dist/tests/cases/unit/printJsvalue.test.d.ts.map +0 -1
- package/dist/tests/cases/unit/schemas/acl.d.ts +0 -12
- package/dist/tests/cases/unit/schemas/acl.d.ts.map +0 -1
- package/dist/tests/cases/unit/schemas/basic.d.ts +0 -4
- package/dist/tests/cases/unit/schemas/basic.d.ts.map +0 -1
- package/dist/tests/cases/unit/schemas/complex.d.ts +0 -12
- package/dist/tests/cases/unit/schemas/complex.d.ts.map +0 -1
- package/dist/tests/cases/unit/schemas/enum.d.ts +0 -6
- package/dist/tests/cases/unit/schemas/enum.d.ts.map +0 -1
- package/dist/tests/cases/unit/schemas/relations.d.ts +0 -14
- package/dist/tests/cases/unit/schemas/relations.d.ts.map +0 -1
- package/dist/tests/cases/unit/schemas/unique.d.ts +0 -4
- package/dist/tests/cases/unit/schemas/unique.d.ts.map +0 -1
- package/dist/tests/cases/unit/schemas/view.d.ts +0 -4
- package/dist/tests/cases/unit/schemas/view.d.ts.map +0 -1
- package/dist/tests/cases/unit/tsDefinitionGenerator.test.d.ts +0 -2
- package/dist/tests/cases/unit/tsDefinitionGenerator.test.d.ts.map +0 -1
- package/dist/tests/cases/unit/whereSchema.test.d.ts +0 -2
- package/dist/tests/cases/unit/whereSchema.test.d.ts.map +0 -1
- package/dist/tests/tsconfig.tsbuildinfo +0 -1
- package/dist/types/acl/AllowAllPermissionFactory.d.ts +0 -7
- package/dist/types/acl/AllowAllPermissionFactory.d.ts.map +0 -1
- package/dist/types/acl/PredicateDefinitionProcessor.d.ts +0 -32
- package/dist/types/acl/PredicateDefinitionProcessor.d.ts.map +0 -1
- package/dist/types/acl/index.d.ts +0 -4
- package/dist/types/acl/index.d.ts.map +0 -1
- package/dist/types/acl/schemaUtils.d.ts +0 -3
- package/dist/types/acl/schemaUtils.d.ts.map +0 -1
- package/dist/types/dataUtils.d.ts +0 -18
- package/dist/types/dataUtils.d.ts.map +0 -1
- package/dist/types/definition-generator/AclDefinitionCodeGenerator.d.ts +0 -19
- package/dist/types/definition-generator/AclDefinitionCodeGenerator.d.ts.map +0 -1
- package/dist/types/definition-generator/DefinitionCodeGenerator.d.ts +0 -27
- package/dist/types/definition-generator/DefinitionCodeGenerator.d.ts.map +0 -1
- package/dist/types/definition-generator/DefinitionNamingConventions.d.ts +0 -7
- package/dist/types/definition-generator/DefinitionNamingConventions.d.ts.map +0 -1
- package/dist/types/definition-generator/TsDefinitionGenerator.d.ts +0 -12
- package/dist/types/definition-generator/TsDefinitionGenerator.d.ts.map +0 -1
- package/dist/types/definition-generator/index.d.ts +0 -5
- package/dist/types/definition-generator/index.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -15
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/lax/LaxSchemaConverter.d.ts +0 -10
- package/dist/types/lax/LaxSchemaConverter.d.ts.map +0 -1
- package/dist/types/lax/index.d.ts +0 -3
- package/dist/types/lax/index.d.ts.map +0 -1
- package/dist/types/lax/schema.d.ts +0 -285
- package/dist/types/lax/schema.d.ts.map +0 -1
- package/dist/types/model/NamingConventions.d.ts +0 -17
- package/dist/types/model/NamingConventions.d.ts.map +0 -1
- package/dist/types/model/index.d.ts +0 -4
- package/dist/types/model/index.d.ts.map +0 -1
- package/dist/types/model/modelUtils.d.ts +0 -28
- package/dist/types/model/modelUtils.d.ts.map +0 -1
- package/dist/types/model/resolveDefaultColumnType.d.ts +0 -3
- package/dist/types/model/resolveDefaultColumnType.d.ts.map +0 -1
- package/dist/types/schemaChecksum.d.ts +0 -3
- package/dist/types/schemaChecksum.d.ts.map +0 -1
- package/dist/types/schemaFilter.d.ts +0 -3
- package/dist/types/schemaFilter.d.ts.map +0 -1
- package/dist/types/schemaNormalizer.d.ts +0 -3
- package/dist/types/schemaNormalizer.d.ts.map +0 -1
- package/dist/types/tsconfig.tsbuildinfo +0 -1
- package/dist/types/type-schema/acl.d.ts +0 -10
- package/dist/types/type-schema/acl.d.ts.map +0 -1
- package/dist/types/type-schema/actions.d.ts +0 -32
- package/dist/types/type-schema/actions.d.ts.map +0 -1
- package/dist/types/type-schema/condition.d.ts +0 -4
- package/dist/types/type-schema/condition.d.ts.map +0 -1
- package/dist/types/type-schema/index.d.ts +0 -6
- package/dist/types/type-schema/index.d.ts.map +0 -1
- package/dist/types/type-schema/model.d.ts +0 -30
- package/dist/types/type-schema/model.d.ts.map +0 -1
- package/dist/types/type-schema/settings.d.ts +0 -41
- package/dist/types/type-schema/settings.d.ts.map +0 -1
- package/dist/types/type-schema/validation.d.ts +0 -15
- package/dist/types/type-schema/validation.d.ts.map +0 -1
- package/dist/types/type-schema/where.d.ts +0 -7
- package/dist/types/type-schema/where.d.ts.map +0 -1
- package/dist/types/utils/assertNever.d.ts +0 -2
- package/dist/types/utils/assertNever.d.ts.map +0 -1
- package/dist/types/utils/deepCompare.d.ts +0 -13
- package/dist/types/utils/deepCompare.d.ts.map +0 -1
- package/dist/types/utils/index.d.ts +0 -4
- package/dist/types/utils/index.d.ts.map +0 -1
- package/dist/types/utils/isIt.d.ts +0 -2
- package/dist/types/utils/isIt.d.ts.map +0 -1
- package/dist/types/utils/printJsValue.d.ts +0 -13
- package/dist/types/utils/printJsValue.d.ts.map +0 -1
- package/dist/types/validation/AclValidator.d.ts +0 -20
- package/dist/types/validation/AclValidator.d.ts.map +0 -1
- package/dist/types/validation/ActionsValidator.d.ts +0 -13
- package/dist/types/validation/ActionsValidator.d.ts.map +0 -1
- package/dist/types/validation/MembershipResolver.d.ts +0 -37
- package/dist/types/validation/MembershipResolver.d.ts.map +0 -1
- package/dist/types/validation/ModelValidator.d.ts +0 -20
- package/dist/types/validation/ModelValidator.d.ts.map +0 -1
- package/dist/types/validation/SchemaValidator.d.ts +0 -11
- package/dist/types/validation/SchemaValidator.d.ts.map +0 -1
- package/dist/types/validation/ValidationValidator.d.ts +0 -14
- package/dist/types/validation/ValidationValidator.d.ts.map +0 -1
- package/dist/types/validation/errors.d.ts +0 -14
- package/dist/types/validation/errors.d.ts.map +0 -1
- package/dist/types/validation/index.d.ts +0 -7
- package/dist/types/validation/index.d.ts.map +0 -1
- package/tests/cases/unit/schemas/.eslintignore +0 -1
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const schema = require("@contember/schema");
|
|
4
|
-
const Typesafe = require("@contember/typesafe");
|
|
5
|
-
const condition = require("./condition.cjs");
|
|
6
|
-
function _interopNamespaceDefault(e) {
|
|
7
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
|
-
if (e) {
|
|
9
|
-
for (const k in e) {
|
|
10
|
-
if (k !== "default") {
|
|
11
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: () => e[k]
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
n.default = e;
|
|
20
|
-
return Object.freeze(n);
|
|
21
|
-
}
|
|
22
|
-
const Typesafe__namespace = /* @__PURE__ */ _interopNamespaceDefault(Typesafe);
|
|
23
|
-
const membershipMatchRuleSchema = Typesafe__namespace.union(Typesafe__namespace.boolean, Typesafe__namespace.record(
|
|
24
|
-
Typesafe__namespace.string,
|
|
25
|
-
Typesafe__namespace.union(
|
|
26
|
-
Typesafe__namespace.literal(true),
|
|
27
|
-
Typesafe__namespace.partial({
|
|
28
|
-
variables: Typesafe__namespace.union(
|
|
29
|
-
Typesafe__namespace.literal(true),
|
|
30
|
-
Typesafe__namespace.record(
|
|
31
|
-
Typesafe__namespace.string,
|
|
32
|
-
Typesafe__namespace.union(Typesafe__namespace.literal(true), Typesafe__namespace.string)
|
|
33
|
-
)
|
|
34
|
-
)
|
|
35
|
-
})
|
|
36
|
-
)
|
|
37
|
-
));
|
|
38
|
-
const tenantPermissionsSchema = Typesafe__namespace.partial({
|
|
39
|
-
invite: Typesafe__namespace.union(Typesafe__namespace.boolean, membershipMatchRuleSchema),
|
|
40
|
-
unmanagedInvite: Typesafe__namespace.union(Typesafe__namespace.boolean, membershipMatchRuleSchema),
|
|
41
|
-
manage: membershipMatchRuleSchema,
|
|
42
|
-
view: membershipMatchRuleSchema
|
|
43
|
-
});
|
|
44
|
-
const systemPermissionsSchema = Typesafe__namespace.partial({
|
|
45
|
-
history: Typesafe__namespace.union(Typesafe__namespace.boolean, Typesafe__namespace.enumeration("any", "none")),
|
|
46
|
-
migrate: Typesafe__namespace.boolean,
|
|
47
|
-
assumeIdentity: Typesafe__namespace.boolean,
|
|
48
|
-
export: Typesafe__namespace.boolean,
|
|
49
|
-
import: Typesafe__namespace.boolean
|
|
50
|
-
});
|
|
51
|
-
const contentPermissionsSchema = Typesafe__namespace.partial({
|
|
52
|
-
assumeMembership: membershipMatchRuleSchema,
|
|
53
|
-
export: Typesafe__namespace.boolean,
|
|
54
|
-
import: Typesafe__namespace.boolean,
|
|
55
|
-
refreshMaterializedView: Typesafe__namespace.boolean
|
|
56
|
-
});
|
|
57
|
-
const entityVariableSchema = Typesafe__namespace.intersection(
|
|
58
|
-
Typesafe__namespace.object({
|
|
59
|
-
type: Typesafe__namespace.literal(schema.Acl.VariableType.entity),
|
|
60
|
-
entityName: Typesafe__namespace.string
|
|
61
|
-
}),
|
|
62
|
-
Typesafe__namespace.partial({
|
|
63
|
-
fallback: condition.conditionSchema()
|
|
64
|
-
})
|
|
65
|
-
);
|
|
66
|
-
const predefinedVariableSchema = Typesafe__namespace.object({
|
|
67
|
-
type: Typesafe__namespace.literal(schema.Acl.VariableType.predefined),
|
|
68
|
-
value: Typesafe__namespace.enumeration("identityID", "personID")
|
|
69
|
-
});
|
|
70
|
-
const conditionVariableSchema = Typesafe__namespace.intersection(
|
|
71
|
-
Typesafe__namespace.object({
|
|
72
|
-
type: Typesafe__namespace.literal(schema.Acl.VariableType.condition)
|
|
73
|
-
}),
|
|
74
|
-
Typesafe__namespace.partial({
|
|
75
|
-
fallback: condition.conditionSchema()
|
|
76
|
-
})
|
|
77
|
-
);
|
|
78
|
-
const variablesSchema = Typesafe__namespace.record(
|
|
79
|
-
Typesafe__namespace.string,
|
|
80
|
-
Typesafe__namespace.union(
|
|
81
|
-
entityVariableSchema,
|
|
82
|
-
predefinedVariableSchema,
|
|
83
|
-
conditionVariableSchema
|
|
84
|
-
)
|
|
85
|
-
);
|
|
86
|
-
const fieldPermissionsSchema = Typesafe__namespace.record(
|
|
87
|
-
Typesafe__namespace.string,
|
|
88
|
-
Typesafe__namespace.union(Typesafe__namespace.string, Typesafe__namespace.boolean)
|
|
89
|
-
);
|
|
90
|
-
const predicatesSchema = Typesafe__namespace.record(
|
|
91
|
-
Typesafe__namespace.string,
|
|
92
|
-
(v, p) => Typesafe__namespace.anyJsonObject(v, p)
|
|
93
|
-
);
|
|
94
|
-
const entityOperationsSchema = Typesafe__namespace.partial({
|
|
95
|
-
read: fieldPermissionsSchema,
|
|
96
|
-
create: fieldPermissionsSchema,
|
|
97
|
-
update: fieldPermissionsSchema,
|
|
98
|
-
delete: Typesafe__namespace.union(Typesafe__namespace.string, Typesafe__namespace.boolean),
|
|
99
|
-
customPrimary: Typesafe__namespace.boolean,
|
|
100
|
-
refreshMaterializedView: Typesafe__namespace.boolean,
|
|
101
|
-
noRoot: Typesafe__namespace.array(Typesafe__namespace.enumeration("create", "read", "update", "delete"))
|
|
102
|
-
});
|
|
103
|
-
const entitiesSchema = Typesafe__namespace.record(
|
|
104
|
-
Typesafe__namespace.string,
|
|
105
|
-
Typesafe__namespace.object({
|
|
106
|
-
predicates: predicatesSchema,
|
|
107
|
-
operations: entityOperationsSchema
|
|
108
|
-
})
|
|
109
|
-
);
|
|
110
|
-
const baseRolePermissionsSchema = Typesafe__namespace.intersection(
|
|
111
|
-
Typesafe__namespace.object({
|
|
112
|
-
variables: variablesSchema,
|
|
113
|
-
entities: entitiesSchema
|
|
114
|
-
}),
|
|
115
|
-
Typesafe__namespace.partial({
|
|
116
|
-
inherits: Typesafe__namespace.array(Typesafe__namespace.string),
|
|
117
|
-
implicit: Typesafe__namespace.boolean,
|
|
118
|
-
stages: Typesafe__namespace.union(
|
|
119
|
-
Typesafe__namespace.literal("*"),
|
|
120
|
-
Typesafe__namespace.array(Typesafe__namespace.string)
|
|
121
|
-
),
|
|
122
|
-
tenant: tenantPermissionsSchema,
|
|
123
|
-
system: systemPermissionsSchema,
|
|
124
|
-
content: contentPermissionsSchema,
|
|
125
|
-
debug: Typesafe__namespace.boolean
|
|
126
|
-
})
|
|
127
|
-
);
|
|
128
|
-
const aclSchema = Typesafe__namespace.intersection(
|
|
129
|
-
Typesafe__namespace.object({
|
|
130
|
-
roles: Typesafe__namespace.record(
|
|
131
|
-
Typesafe__namespace.string,
|
|
132
|
-
(v, p) => {
|
|
133
|
-
const main = baseRolePermissionsSchema(v, p);
|
|
134
|
-
return {
|
|
135
|
-
...v,
|
|
136
|
-
...main
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
)
|
|
140
|
-
}),
|
|
141
|
-
Typesafe__namespace.partial({
|
|
142
|
-
customPrimary: Typesafe__namespace.boolean
|
|
143
|
-
})
|
|
144
|
-
);
|
|
145
|
-
exports.aclSchema = aclSchema;
|
|
146
|
-
//# sourceMappingURL=acl.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acl.cjs","sources":["../../../../../packages/schema-utils/src/type-schema/acl.ts"],"sourcesContent":["import { Acl, Model } from '@contember/schema'\nimport * as Typesafe from '@contember/typesafe'\nimport { conditionSchema } from './condition'\n\nconst membershipMatchRuleSchema = Typesafe.union(Typesafe.boolean, Typesafe.record(\n\tTypesafe.string,\n\tTypesafe.union(\n\t\tTypesafe.literal(true),\n\t\tTypesafe.partial({\n\t\t\tvariables: Typesafe.union(\n\t\t\t\tTypesafe.literal(true),\n\t\t\t\tTypesafe.record(\n\t\t\t\t\tTypesafe.string,\n\t\t\t\t\tTypesafe.union(Typesafe.literal(true), Typesafe.string),\n\t\t\t\t),\n\t\t\t),\n\t\t}),\n\t),\n))\n\nconst tenantPermissionsSchema = Typesafe.partial({\n\tinvite: Typesafe.union(Typesafe.boolean, membershipMatchRuleSchema),\n\tunmanagedInvite: Typesafe.union(Typesafe.boolean, membershipMatchRuleSchema),\n\tmanage: membershipMatchRuleSchema,\n\tview: membershipMatchRuleSchema,\n})\nconst tenantSchemaCheck: Typesafe.Equals<Acl.TenantPermissions, ReturnType<typeof tenantPermissionsSchema>> = true\n\nconst systemPermissionsSchema = Typesafe.partial({\n\thistory: Typesafe.union(Typesafe.boolean, Typesafe.enumeration('any', 'none')),\n\tmigrate: Typesafe.boolean,\n\tassumeIdentity: Typesafe.boolean,\n\texport: Typesafe.boolean,\n\timport: Typesafe.boolean,\n})\nconst systemSchemaCheck: Typesafe.Equals<Acl.SystemPermissions, ReturnType<typeof systemPermissionsSchema>> = true\n\nconst contentPermissionsSchema = Typesafe.partial({\n\tassumeMembership: membershipMatchRuleSchema,\n\texport: Typesafe.boolean,\n\timport: Typesafe.boolean,\n\trefreshMaterializedView: Typesafe.boolean,\n})\nconst contentSchemaCheck: Typesafe.Equals<Acl.ContentPermissions, ReturnType<typeof contentPermissionsSchema>> = true\n\nconst entityVariableSchema = Typesafe.intersection(\n\tTypesafe.object({\n\t\ttype: Typesafe.literal(Acl.VariableType.entity),\n\t\tentityName: Typesafe.string,\n\t}),\n\tTypesafe.partial({\n\t\tfallback: conditionSchema(),\n\t}),\n)\nconst entityVariableSchemaCheck: Typesafe.Equals<Acl.EntityVariable, ReturnType<typeof entityVariableSchema>> = true\n\nconst predefinedVariableSchema = Typesafe.object({\n\ttype: Typesafe.literal(Acl.VariableType.predefined),\n\tvalue: Typesafe.enumeration('identityID', 'personID'),\n})\nconst conditionVariableSchema = Typesafe.intersection(\n\tTypesafe.object({\n\t\ttype: Typesafe.literal(Acl.VariableType.condition),\n\t}),\n\tTypesafe.partial({\n\t\tfallback: conditionSchema(),\n\t}),\n)\nconst conditionVariableSchemaCheck: Typesafe.Equals<Acl.ConditionVariable, ReturnType<typeof conditionVariableSchema>> = true\n\nconst variablesSchema = Typesafe.record(\n\tTypesafe.string,\n\tTypesafe.union(\n\t\tentityVariableSchema as Typesafe.Type<Acl.EntityVariable>,\n\t\tpredefinedVariableSchema,\n\t\tconditionVariableSchema as Typesafe.Type<Acl.ConditionVariable>,\n\t),\n)\n\nconst variableSchemaCheck: Typesafe.Equals<Acl.Variables, ReturnType<typeof variablesSchema>> = true\n\nconst fieldPermissionsSchema = Typesafe.record(\n\tTypesafe.string,\n\tTypesafe.union(Typesafe.string, Typesafe.boolean),\n)\nconst predicatesSchema = Typesafe.record(\n\tTypesafe.string,\n\t(v, p): Acl.PredicateDefinition => Typesafe.anyJsonObject(v, p) as Acl.PredicateDefinition,\n)\n\nconst predicatesSchemaCheck: Typesafe.Equals<Acl.PredicateMap, ReturnType<typeof predicatesSchema>> = true\n\nconst entityOperationsSchema = Typesafe.partial({\n\tread: fieldPermissionsSchema,\n\tcreate: fieldPermissionsSchema,\n\tupdate: fieldPermissionsSchema,\n\tdelete: Typesafe.union(Typesafe.string, Typesafe.boolean),\n\tcustomPrimary: Typesafe.boolean,\n\trefreshMaterializedView: Typesafe.boolean,\n\tnoRoot: Typesafe.array(Typesafe.enumeration('create', 'read', 'update', 'delete')),\n})\n\nconst opSchemaCheck: Typesafe.Equals<Acl.EntityOperations, ReturnType<typeof entityOperationsSchema>> = true\nconst entitiesSchema = Typesafe.record(\n\tTypesafe.string,\n\tTypesafe.object({\n\t\tpredicates: predicatesSchema,\n\t\toperations: entityOperationsSchema,\n\t}),\n)\nconst entitiesSchemaCheck: Typesafe.Equals<Acl.Permissions, ReturnType<typeof entitiesSchema>> = true\n\nconst baseRolePermissionsSchema = Typesafe.intersection(\n\tTypesafe.object({\n\t\tvariables: variablesSchema,\n\t\tentities: entitiesSchema,\n\t}),\n\tTypesafe.partial({\n\t\tinherits: Typesafe.array(Typesafe.string),\n\t\timplicit: Typesafe.boolean,\n\t\tstages: Typesafe.union(\n\t\t\tTypesafe.literal('*'),\n\t\t\tTypesafe.array(Typesafe.string),\n\t\t),\n\t\ttenant: tenantPermissionsSchema,\n\t\tsystem: systemPermissionsSchema,\n\t\tcontent: contentPermissionsSchema,\n\t\tdebug: Typesafe.boolean,\n\t}),\n)\nconst baseRolePermissionsCheck: Typesafe.Equals<Acl.BaseRolePermissions, ReturnType<typeof baseRolePermissionsSchema>> = true\n\nexport const aclSchema = Typesafe.intersection(\n\tTypesafe.object({\n\t\troles: Typesafe.record(\n\t\t\tTypesafe.string,\n\t\t\t(v, p): Acl.RolePermissions => {\n\t\t\t\tconst main: Acl.BaseRolePermissions = baseRolePermissionsSchema(v, p)\n\t\t\t\treturn {\n\t\t\t\t\t...(v as any),\n\t\t\t\t\t...main,\n\t\t\t\t}\n\t\t\t},\n\t\t),\n\t}),\n\tTypesafe.partial({\n\t\tcustomPrimary: Typesafe.boolean,\n\t}),\n)\nconst aclSchemaCheck: Typesafe.Equals<Acl.Schema, ReturnType<typeof aclSchema>> = true\n"],"names":["Typesafe","Acl","conditionSchema"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAIA,MAAM,4BAA4BA,oBAAS,MAAMA,oBAAS,SAASA,oBAAS;AAAA,EAC3EA,oBAAS;AAAA,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oBAAS;AAAA,IACnB,QAAQA,oBAAS;AAAA,MAChBA,oBAAS,QAAQ,GAAG;AAAA,MACpBA,oBAAS,MAAMA,oBAAS,MAAM;AAAA,IAC/B;AAAA,IACA,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,OAAOA,oBAAS;AAAA,EAChB,CAAA;AACF;AAGO,MAAM,YAAYA,oBAAS;AAAA,EACjCA,oBAAS,OAAO;AAAA,IACf,OAAOA,oBAAS;AAAA,MACfA,oBAAS;AAAA,MACT,CAAC,GAAG,MAA2B;AACxB,cAAA,OAAgC,0BAA0B,GAAG,CAAC;AAC7D,eAAA;AAAA,UACN,GAAI;AAAA,UACJ,GAAG;AAAA,QACJ;AAAA,MAAA;AAAA,IACD;AAAA,EACD,CACA;AAAA,EACDA,oBAAS,QAAQ;AAAA,IAChB,eAAeA,oBAAS;AAAA,EACxB,CAAA;AACF;;"}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { Acl } from "@contember/schema";
|
|
2
|
-
import * as Typesafe from "@contember/typesafe";
|
|
3
|
-
import { conditionSchema } from "./condition.js";
|
|
4
|
-
const membershipMatchRuleSchema = Typesafe.union(Typesafe.boolean, Typesafe.record(
|
|
5
|
-
Typesafe.string,
|
|
6
|
-
Typesafe.union(
|
|
7
|
-
Typesafe.literal(true),
|
|
8
|
-
Typesafe.partial({
|
|
9
|
-
variables: Typesafe.union(
|
|
10
|
-
Typesafe.literal(true),
|
|
11
|
-
Typesafe.record(
|
|
12
|
-
Typesafe.string,
|
|
13
|
-
Typesafe.union(Typesafe.literal(true), Typesafe.string)
|
|
14
|
-
)
|
|
15
|
-
)
|
|
16
|
-
})
|
|
17
|
-
)
|
|
18
|
-
));
|
|
19
|
-
const tenantPermissionsSchema = Typesafe.partial({
|
|
20
|
-
invite: Typesafe.union(Typesafe.boolean, membershipMatchRuleSchema),
|
|
21
|
-
unmanagedInvite: Typesafe.union(Typesafe.boolean, membershipMatchRuleSchema),
|
|
22
|
-
manage: membershipMatchRuleSchema,
|
|
23
|
-
view: membershipMatchRuleSchema
|
|
24
|
-
});
|
|
25
|
-
const systemPermissionsSchema = Typesafe.partial({
|
|
26
|
-
history: Typesafe.union(Typesafe.boolean, Typesafe.enumeration("any", "none")),
|
|
27
|
-
migrate: Typesafe.boolean,
|
|
28
|
-
assumeIdentity: Typesafe.boolean,
|
|
29
|
-
export: Typesafe.boolean,
|
|
30
|
-
import: Typesafe.boolean
|
|
31
|
-
});
|
|
32
|
-
const contentPermissionsSchema = Typesafe.partial({
|
|
33
|
-
assumeMembership: membershipMatchRuleSchema,
|
|
34
|
-
export: Typesafe.boolean,
|
|
35
|
-
import: Typesafe.boolean,
|
|
36
|
-
refreshMaterializedView: Typesafe.boolean
|
|
37
|
-
});
|
|
38
|
-
const entityVariableSchema = Typesafe.intersection(
|
|
39
|
-
Typesafe.object({
|
|
40
|
-
type: Typesafe.literal(Acl.VariableType.entity),
|
|
41
|
-
entityName: Typesafe.string
|
|
42
|
-
}),
|
|
43
|
-
Typesafe.partial({
|
|
44
|
-
fallback: conditionSchema()
|
|
45
|
-
})
|
|
46
|
-
);
|
|
47
|
-
const predefinedVariableSchema = Typesafe.object({
|
|
48
|
-
type: Typesafe.literal(Acl.VariableType.predefined),
|
|
49
|
-
value: Typesafe.enumeration("identityID", "personID")
|
|
50
|
-
});
|
|
51
|
-
const conditionVariableSchema = Typesafe.intersection(
|
|
52
|
-
Typesafe.object({
|
|
53
|
-
type: Typesafe.literal(Acl.VariableType.condition)
|
|
54
|
-
}),
|
|
55
|
-
Typesafe.partial({
|
|
56
|
-
fallback: conditionSchema()
|
|
57
|
-
})
|
|
58
|
-
);
|
|
59
|
-
const variablesSchema = Typesafe.record(
|
|
60
|
-
Typesafe.string,
|
|
61
|
-
Typesafe.union(
|
|
62
|
-
entityVariableSchema,
|
|
63
|
-
predefinedVariableSchema,
|
|
64
|
-
conditionVariableSchema
|
|
65
|
-
)
|
|
66
|
-
);
|
|
67
|
-
const fieldPermissionsSchema = Typesafe.record(
|
|
68
|
-
Typesafe.string,
|
|
69
|
-
Typesafe.union(Typesafe.string, Typesafe.boolean)
|
|
70
|
-
);
|
|
71
|
-
const predicatesSchema = Typesafe.record(
|
|
72
|
-
Typesafe.string,
|
|
73
|
-
(v, p) => Typesafe.anyJsonObject(v, p)
|
|
74
|
-
);
|
|
75
|
-
const entityOperationsSchema = Typesafe.partial({
|
|
76
|
-
read: fieldPermissionsSchema,
|
|
77
|
-
create: fieldPermissionsSchema,
|
|
78
|
-
update: fieldPermissionsSchema,
|
|
79
|
-
delete: Typesafe.union(Typesafe.string, Typesafe.boolean),
|
|
80
|
-
customPrimary: Typesafe.boolean,
|
|
81
|
-
refreshMaterializedView: Typesafe.boolean,
|
|
82
|
-
noRoot: Typesafe.array(Typesafe.enumeration("create", "read", "update", "delete"))
|
|
83
|
-
});
|
|
84
|
-
const entitiesSchema = Typesafe.record(
|
|
85
|
-
Typesafe.string,
|
|
86
|
-
Typesafe.object({
|
|
87
|
-
predicates: predicatesSchema,
|
|
88
|
-
operations: entityOperationsSchema
|
|
89
|
-
})
|
|
90
|
-
);
|
|
91
|
-
const baseRolePermissionsSchema = Typesafe.intersection(
|
|
92
|
-
Typesafe.object({
|
|
93
|
-
variables: variablesSchema,
|
|
94
|
-
entities: entitiesSchema
|
|
95
|
-
}),
|
|
96
|
-
Typesafe.partial({
|
|
97
|
-
inherits: Typesafe.array(Typesafe.string),
|
|
98
|
-
implicit: Typesafe.boolean,
|
|
99
|
-
stages: Typesafe.union(
|
|
100
|
-
Typesafe.literal("*"),
|
|
101
|
-
Typesafe.array(Typesafe.string)
|
|
102
|
-
),
|
|
103
|
-
tenant: tenantPermissionsSchema,
|
|
104
|
-
system: systemPermissionsSchema,
|
|
105
|
-
content: contentPermissionsSchema,
|
|
106
|
-
debug: Typesafe.boolean
|
|
107
|
-
})
|
|
108
|
-
);
|
|
109
|
-
const aclSchema = Typesafe.intersection(
|
|
110
|
-
Typesafe.object({
|
|
111
|
-
roles: Typesafe.record(
|
|
112
|
-
Typesafe.string,
|
|
113
|
-
(v, p) => {
|
|
114
|
-
const main = baseRolePermissionsSchema(v, p);
|
|
115
|
-
return {
|
|
116
|
-
...v,
|
|
117
|
-
...main
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
)
|
|
121
|
-
}),
|
|
122
|
-
Typesafe.partial({
|
|
123
|
-
customPrimary: Typesafe.boolean
|
|
124
|
-
})
|
|
125
|
-
);
|
|
126
|
-
export {
|
|
127
|
-
aclSchema
|
|
128
|
-
};
|
|
129
|
-
//# sourceMappingURL=acl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acl.js","sources":["../../../../../packages/schema-utils/src/type-schema/acl.ts"],"sourcesContent":["import { Acl, Model } from '@contember/schema'\nimport * as Typesafe from '@contember/typesafe'\nimport { conditionSchema } from './condition'\n\nconst membershipMatchRuleSchema = Typesafe.union(Typesafe.boolean, Typesafe.record(\n\tTypesafe.string,\n\tTypesafe.union(\n\t\tTypesafe.literal(true),\n\t\tTypesafe.partial({\n\t\t\tvariables: Typesafe.union(\n\t\t\t\tTypesafe.literal(true),\n\t\t\t\tTypesafe.record(\n\t\t\t\t\tTypesafe.string,\n\t\t\t\t\tTypesafe.union(Typesafe.literal(true), Typesafe.string),\n\t\t\t\t),\n\t\t\t),\n\t\t}),\n\t),\n))\n\nconst tenantPermissionsSchema = Typesafe.partial({\n\tinvite: Typesafe.union(Typesafe.boolean, membershipMatchRuleSchema),\n\tunmanagedInvite: Typesafe.union(Typesafe.boolean, membershipMatchRuleSchema),\n\tmanage: membershipMatchRuleSchema,\n\tview: membershipMatchRuleSchema,\n})\nconst tenantSchemaCheck: Typesafe.Equals<Acl.TenantPermissions, ReturnType<typeof tenantPermissionsSchema>> = true\n\nconst systemPermissionsSchema = Typesafe.partial({\n\thistory: Typesafe.union(Typesafe.boolean, Typesafe.enumeration('any', 'none')),\n\tmigrate: Typesafe.boolean,\n\tassumeIdentity: Typesafe.boolean,\n\texport: Typesafe.boolean,\n\timport: Typesafe.boolean,\n})\nconst systemSchemaCheck: Typesafe.Equals<Acl.SystemPermissions, ReturnType<typeof systemPermissionsSchema>> = true\n\nconst contentPermissionsSchema = Typesafe.partial({\n\tassumeMembership: membershipMatchRuleSchema,\n\texport: Typesafe.boolean,\n\timport: Typesafe.boolean,\n\trefreshMaterializedView: Typesafe.boolean,\n})\nconst contentSchemaCheck: Typesafe.Equals<Acl.ContentPermissions, ReturnType<typeof contentPermissionsSchema>> = true\n\nconst entityVariableSchema = Typesafe.intersection(\n\tTypesafe.object({\n\t\ttype: Typesafe.literal(Acl.VariableType.entity),\n\t\tentityName: Typesafe.string,\n\t}),\n\tTypesafe.partial({\n\t\tfallback: conditionSchema(),\n\t}),\n)\nconst entityVariableSchemaCheck: Typesafe.Equals<Acl.EntityVariable, ReturnType<typeof entityVariableSchema>> = true\n\nconst predefinedVariableSchema = Typesafe.object({\n\ttype: Typesafe.literal(Acl.VariableType.predefined),\n\tvalue: Typesafe.enumeration('identityID', 'personID'),\n})\nconst conditionVariableSchema = Typesafe.intersection(\n\tTypesafe.object({\n\t\ttype: Typesafe.literal(Acl.VariableType.condition),\n\t}),\n\tTypesafe.partial({\n\t\tfallback: conditionSchema(),\n\t}),\n)\nconst conditionVariableSchemaCheck: Typesafe.Equals<Acl.ConditionVariable, ReturnType<typeof conditionVariableSchema>> = true\n\nconst variablesSchema = Typesafe.record(\n\tTypesafe.string,\n\tTypesafe.union(\n\t\tentityVariableSchema as Typesafe.Type<Acl.EntityVariable>,\n\t\tpredefinedVariableSchema,\n\t\tconditionVariableSchema as Typesafe.Type<Acl.ConditionVariable>,\n\t),\n)\n\nconst variableSchemaCheck: Typesafe.Equals<Acl.Variables, ReturnType<typeof variablesSchema>> = true\n\nconst fieldPermissionsSchema = Typesafe.record(\n\tTypesafe.string,\n\tTypesafe.union(Typesafe.string, Typesafe.boolean),\n)\nconst predicatesSchema = Typesafe.record(\n\tTypesafe.string,\n\t(v, p): Acl.PredicateDefinition => Typesafe.anyJsonObject(v, p) as Acl.PredicateDefinition,\n)\n\nconst predicatesSchemaCheck: Typesafe.Equals<Acl.PredicateMap, ReturnType<typeof predicatesSchema>> = true\n\nconst entityOperationsSchema = Typesafe.partial({\n\tread: fieldPermissionsSchema,\n\tcreate: fieldPermissionsSchema,\n\tupdate: fieldPermissionsSchema,\n\tdelete: Typesafe.union(Typesafe.string, Typesafe.boolean),\n\tcustomPrimary: Typesafe.boolean,\n\trefreshMaterializedView: Typesafe.boolean,\n\tnoRoot: Typesafe.array(Typesafe.enumeration('create', 'read', 'update', 'delete')),\n})\n\nconst opSchemaCheck: Typesafe.Equals<Acl.EntityOperations, ReturnType<typeof entityOperationsSchema>> = true\nconst entitiesSchema = Typesafe.record(\n\tTypesafe.string,\n\tTypesafe.object({\n\t\tpredicates: predicatesSchema,\n\t\toperations: entityOperationsSchema,\n\t}),\n)\nconst entitiesSchemaCheck: Typesafe.Equals<Acl.Permissions, ReturnType<typeof entitiesSchema>> = true\n\nconst baseRolePermissionsSchema = Typesafe.intersection(\n\tTypesafe.object({\n\t\tvariables: variablesSchema,\n\t\tentities: entitiesSchema,\n\t}),\n\tTypesafe.partial({\n\t\tinherits: Typesafe.array(Typesafe.string),\n\t\timplicit: Typesafe.boolean,\n\t\tstages: Typesafe.union(\n\t\t\tTypesafe.literal('*'),\n\t\t\tTypesafe.array(Typesafe.string),\n\t\t),\n\t\ttenant: tenantPermissionsSchema,\n\t\tsystem: systemPermissionsSchema,\n\t\tcontent: contentPermissionsSchema,\n\t\tdebug: Typesafe.boolean,\n\t}),\n)\nconst baseRolePermissionsCheck: Typesafe.Equals<Acl.BaseRolePermissions, ReturnType<typeof baseRolePermissionsSchema>> = true\n\nexport const aclSchema = Typesafe.intersection(\n\tTypesafe.object({\n\t\troles: Typesafe.record(\n\t\t\tTypesafe.string,\n\t\t\t(v, p): Acl.RolePermissions => {\n\t\t\t\tconst main: Acl.BaseRolePermissions = baseRolePermissionsSchema(v, p)\n\t\t\t\treturn {\n\t\t\t\t\t...(v as any),\n\t\t\t\t\t...main,\n\t\t\t\t}\n\t\t\t},\n\t\t),\n\t}),\n\tTypesafe.partial({\n\t\tcustomPrimary: Typesafe.boolean,\n\t}),\n)\nconst aclSchemaCheck: Typesafe.Equals<Acl.Schema, ReturnType<typeof aclSchema>> = true\n"],"names":[],"mappings":";;;AAIA,MAAM,4BAA4B,SAAS,MAAM,SAAS,SAAS,SAAS;AAAA,EAC3E,SAAS;AAAA,EACT,SAAS;AAAA,IACR,SAAS,QAAQ,IAAI;AAAA,IACrB,SAAS,QAAQ;AAAA,MAChB,WAAW,SAAS;AAAA,QACnB,SAAS,QAAQ,IAAI;AAAA,QACrB,SAAS;AAAA,UACR,SAAS;AAAA,UACT,SAAS,MAAM,SAAS,QAAQ,IAAI,GAAG,SAAS,MAAM;AAAA,QAAA;AAAA,MACvD;AAAA,IAED,CAAA;AAAA,EAAA;AAEH,CAAC;AAED,MAAM,0BAA0B,SAAS,QAAQ;AAAA,EAChD,QAAQ,SAAS,MAAM,SAAS,SAAS,yBAAyB;AAAA,EAClE,iBAAiB,SAAS,MAAM,SAAS,SAAS,yBAAyB;AAAA,EAC3E,QAAQ;AAAA,EACR,MAAM;AACP,CAAC;AAGD,MAAM,0BAA0B,SAAS,QAAQ;AAAA,EAChD,SAAS,SAAS,MAAM,SAAS,SAAS,SAAS,YAAY,OAAO,MAAM,CAAC;AAAA,EAC7E,SAAS,SAAS;AAAA,EAClB,gBAAgB,SAAS;AAAA,EACzB,QAAQ,SAAS;AAAA,EACjB,QAAQ,SAAS;AAClB,CAAC;AAGD,MAAM,2BAA2B,SAAS,QAAQ;AAAA,EACjD,kBAAkB;AAAA,EAClB,QAAQ,SAAS;AAAA,EACjB,QAAQ,SAAS;AAAA,EACjB,yBAAyB,SAAS;AACnC,CAAC;AAGD,MAAM,uBAAuB,SAAS;AAAA,EACrC,SAAS,OAAO;AAAA,IACf,MAAM,SAAS,QAAQ,I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AAO;AAAA,IACf,WAAW;AAAA,IACX,UAAU;AAAA,EAAA,CACV;AAAA,EACD,SAAS,QAAQ;AAAA,IAChB,UAAU,SAAS,MAAM,SAAS,MAAM;AAAA,IACxC,UAAU,SAAS;AAAA,IACnB,QAAQ,SAAS;AAAA,MAChB,SAAS,QAAQ,GAAG;AAAA,MACpB,SAAS,MAAM,SAAS,MAAM;AAAA,IAC/B;AAAA,IACA,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,OAAO,SAAS;AAAA,EAChB,CAAA;AACF;AAGO,MAAM,YAAY,SAAS;AAAA,EACjC,SAAS,OAAO;AAAA,IACf,OAAO,SAAS;AAAA,MACf,SAAS;AAAA,MACT,CAAC,GAAG,MAA2B;AACxB,cAAA,OAAgC,0BAA0B,GAAG,CAAC;AAC7D,eAAA;AAAA,UACN,GAAI;AAAA,UACJ,GAAG;AAAA,QACJ;AAAA,MAAA;AAAA,IACD;AAAA,EACD,CACA;AAAA,EACD,SAAS,QAAQ;AAAA,IAChB,eAAe,SAAS;AAAA,EACxB,CAAA;AACF;"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const Typesafe = require("@contember/typesafe");
|
|
4
|
-
function _interopNamespaceDefault(e) {
|
|
5
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
6
|
-
if (e) {
|
|
7
|
-
for (const k in e) {
|
|
8
|
-
if (k !== "default") {
|
|
9
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
10
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: () => e[k]
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
n.default = e;
|
|
18
|
-
return Object.freeze(n);
|
|
19
|
-
}
|
|
20
|
-
const Typesafe__namespace = /* @__PURE__ */ _interopNamespaceDefault(Typesafe);
|
|
21
|
-
const selectionNodeSchemaFactory = () => {
|
|
22
|
-
return (input, path = []) => {
|
|
23
|
-
return Typesafe__namespace.array(Typesafe__namespace.union(
|
|
24
|
-
Typesafe__namespace.string,
|
|
25
|
-
Typesafe__namespace.tuple(
|
|
26
|
-
Typesafe__namespace.string,
|
|
27
|
-
Typesafe__namespace.anyJsonObject,
|
|
28
|
-
selectionNodeSchemaFactory()
|
|
29
|
-
)
|
|
30
|
-
))(input, path);
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
const webhookTargetSchema = Typesafe__namespace.intersection(
|
|
34
|
-
Typesafe__namespace.object({
|
|
35
|
-
type: Typesafe__namespace.literal("webhook"),
|
|
36
|
-
name: Typesafe__namespace.string,
|
|
37
|
-
url: Typesafe__namespace.string
|
|
38
|
-
}),
|
|
39
|
-
Typesafe__namespace.partial({
|
|
40
|
-
headers: Typesafe__namespace.record(Typesafe__namespace.string, Typesafe__namespace.string),
|
|
41
|
-
timeoutMs: Typesafe__namespace.integer,
|
|
42
|
-
maxAttempts: Typesafe__namespace.integer,
|
|
43
|
-
initialRepeatIntervalMs: Typesafe__namespace.integer,
|
|
44
|
-
batchSize: Typesafe__namespace.integer,
|
|
45
|
-
body: Typesafe__namespace.anyJsonObject,
|
|
46
|
-
payloadPath: Typesafe__namespace.array(Typesafe__namespace.string)
|
|
47
|
-
})
|
|
48
|
-
);
|
|
49
|
-
const anyTargetSchema = Typesafe__namespace.union(webhookTargetSchema);
|
|
50
|
-
const watchTriggerSchema = Typesafe__namespace.intersection(
|
|
51
|
-
Typesafe__namespace.object({
|
|
52
|
-
type: Typesafe__namespace.literal("watch"),
|
|
53
|
-
name: Typesafe__namespace.string,
|
|
54
|
-
entity: Typesafe__namespace.string,
|
|
55
|
-
watch: selectionNodeSchemaFactory(),
|
|
56
|
-
target: Typesafe__namespace.string
|
|
57
|
-
}),
|
|
58
|
-
Typesafe__namespace.partial({
|
|
59
|
-
selection: selectionNodeSchemaFactory(),
|
|
60
|
-
priority: Typesafe__namespace.integer,
|
|
61
|
-
withNodes: Typesafe__namespace.boolean
|
|
62
|
-
})
|
|
63
|
-
);
|
|
64
|
-
const basicTriggerSchema = Typesafe__namespace.intersection(
|
|
65
|
-
Typesafe__namespace.object({
|
|
66
|
-
type: Typesafe__namespace.literal("basic"),
|
|
67
|
-
name: Typesafe__namespace.string,
|
|
68
|
-
entity: Typesafe__namespace.string,
|
|
69
|
-
create: Typesafe__namespace.boolean,
|
|
70
|
-
delete: Typesafe__namespace.boolean,
|
|
71
|
-
update: Typesafe__namespace.union(Typesafe__namespace.boolean, Typesafe__namespace.array(Typesafe__namespace.string)),
|
|
72
|
-
target: Typesafe__namespace.string
|
|
73
|
-
}),
|
|
74
|
-
Typesafe__namespace.partial({
|
|
75
|
-
selection: selectionNodeSchemaFactory(),
|
|
76
|
-
priority: Typesafe__namespace.integer
|
|
77
|
-
})
|
|
78
|
-
);
|
|
79
|
-
const anyTriggerSchema = Typesafe__namespace.union(
|
|
80
|
-
watchTriggerSchema,
|
|
81
|
-
basicTriggerSchema
|
|
82
|
-
);
|
|
83
|
-
const actionsSchema = Typesafe__namespace.object({
|
|
84
|
-
triggers: Typesafe__namespace.record(Typesafe__namespace.string, anyTriggerSchema),
|
|
85
|
-
targets: Typesafe__namespace.record(Typesafe__namespace.string, anyTargetSchema)
|
|
86
|
-
});
|
|
87
|
-
exports.actionsSchema = actionsSchema;
|
|
88
|
-
//# sourceMappingURL=actions.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actions.cjs","sources":["../../../../../packages/schema-utils/src/type-schema/actions.ts"],"sourcesContent":["import * as Typesafe from '@contember/typesafe'\nimport { Actions } from '@contember/schema'\n\nconst selectionNodeSchemaFactory = (): Typesafe.Type<Actions.SelectionNode> => {\n\treturn (input: unknown, path: PropertyKey[] = []): Actions.SelectionNode => {\n\t\treturn Typesafe.array(Typesafe.union(\n\t\t\tTypesafe.string,\n\t\t\tTypesafe.tuple(\n\t\t\t\tTypesafe.string,\n\t\t\t\tTypesafe.anyJsonObject,\n\t\t\t\tselectionNodeSchemaFactory(),\n\t\t\t),\n\t\t))(input, path)\n\t}\n}\n\nconst webhookTargetSchema = Typesafe.intersection(\n\tTypesafe.object({\n\t\ttype: Typesafe.literal('webhook'),\n\t\tname: Typesafe.string,\n\t\turl: Typesafe.string,\n\t}),\n\tTypesafe.partial({\n\t\theaders: Typesafe.record(Typesafe.string, Typesafe.string),\n\t\ttimeoutMs: Typesafe.integer,\n\t\tmaxAttempts: Typesafe.integer,\n\t\tinitialRepeatIntervalMs: Typesafe.integer,\n\t\tbatchSize: Typesafe.integer,\n\t\tbody: Typesafe.anyJsonObject,\n\t\tpayloadPath: Typesafe.array(Typesafe.string),\n\t}),\n)\nconst webhookTargetSchemaCheck: Typesafe.Equals<Actions.WebhookTarget, ReturnType<typeof webhookTargetSchema>> = true\n\nconst anyTargetSchema: Typesafe.Type<Actions.AnyTarget> = Typesafe.union(webhookTargetSchema)\n\nconst watchTriggerSchema = Typesafe.intersection(\n\tTypesafe.object({\n\t\ttype: Typesafe.literal('watch'),\n\t\tname: Typesafe.string,\n\t\tentity: Typesafe.string,\n\t\twatch: selectionNodeSchemaFactory(),\n\t\ttarget: Typesafe.string,\n\t}),\n\tTypesafe.partial({\n\t\tselection: selectionNodeSchemaFactory(),\n\t\tpriority: Typesafe.integer,\n\t\twithNodes: Typesafe.boolean,\n\t}),\n)\n\nconst watchTriggerSchemaCheck: Typesafe.Equals<Actions.WatchTrigger, ReturnType<typeof watchTriggerSchema>> = true\n\n\nconst basicTriggerSchema = Typesafe.intersection(\n\tTypesafe.object({\n\t\ttype: Typesafe.literal('basic'),\n\t\tname: Typesafe.string,\n\t\tentity: Typesafe.string,\n\t\tcreate: Typesafe.boolean,\n\t\tdelete: Typesafe.boolean,\n\t\tupdate: Typesafe.union(Typesafe.boolean, Typesafe.array(Typesafe.string)),\n\t\ttarget: Typesafe.string,\n\t}),\n\tTypesafe.partial({\n\t\tselection: selectionNodeSchemaFactory(),\n\t\tpriority: Typesafe.integer,\n\t}),\n)\n\nconst basicTriggerSchemaCheck: Typesafe.Equals<Actions.BasicTrigger, ReturnType<typeof basicTriggerSchema>> = true\n\n\nconst anyTriggerSchema = Typesafe.union(\n\twatchTriggerSchema,\n\tbasicTriggerSchema,\n)\n\nexport const actionsSchema = Typesafe.object({\n\ttriggers: Typesafe.record(Typesafe.string, anyTriggerSchema),\n\ttargets: Typesafe.record(Typesafe.string, anyTargetSchema),\n})\n"],"names":["Typesafe"],"mappings":";;;;;;;;;;;;;;;;;;;;AAGA,MAAM,6BAA6B,MAA4C;AAC9E,SAAO,CAAC,OAAgB,OAAsB,OAA8B;AACpE,WAAAA,oBAAS,MAAMA,oBAAS;AAAA,MAC9BA,oBAAS;AAAA,MACTA,oBAAS;AAAA,QACRA,oBAAS;AAAA,QACTA,oBAAS;AAAA,QACT,2BAA2B;AAAA,MAAA;AAAA,IAC5B,CACA,EAAE,OAAO,IAAI;AAAA,EACf;AACD;AAEA,MAAM,sBAAsBA,oBAAS;AAAA,EACpCA,oBAAS,OAAO;AAAA,IACf,MAAMA,oBAAS,QAAQ,SAAS;AAAA,IAChC,MAAMA,oBAAS;AAAA,IACf,KAAKA,oBAAS;AAAA,EAAA,CACd;AAAA,EACDA,oBAAS,QAAQ;AAAA,IAChB,SAASA,oBAAS,OAAOA,oBAAS,QAAQA,oBAAS,MAAM;AAAA,IACzD,WAAWA,oBAAS;AAAA,IACpB,aAAaA,oBAAS;AAAA,IACtB,yBAAyBA,oBAAS;AAAA,IAClC,WAAWA,oBAAS;AAAA,IACpB,MAAMA,oBAAS;AAAA,IACf,aAAaA,oBAAS,MAAMA,oBAAS,MAAM;AAAA,EAC3C,CAAA;AACF;AAGA,MAAM,kBAAoDA,oBAAS,MAAM,mBAAmB;AAE5F,MAAM,qBAAqBA,oBAAS;AAAA,EACnCA,oBAAS,OAAO;AAAA,IACf,MAAMA,oBAAS,QAAQ,OAAO;AAAA,IAC9B,MAAMA,oBAAS;AAAA,IACf,QAAQA,oBAAS;AAAA,IACjB,OAAO,2BAA2B;AAAA,IAClC,QAAQA,oBAAS;AAAA,EAAA,CACjB;AAAA,EACDA,oBAAS,QAAQ;AAAA,IAChB,WAAW,2BAA2B;AAAA,IACtC,UAAUA,oBAAS;AAAA,IACnB,WAAWA,oBAAS;AAAA,EACpB,CAAA;AACF;AAKA,MAAM,qBAAqBA,oBAAS;AAAA,EACnCA,oBAAS,OAAO;AAAA,IACf,MAAMA,oBAAS,QAAQ,OAAO;AAAA,IAC9B,MAAMA,oBAAS;AAAA,IACf,QAAQA,oBAAS;AAAA,IACjB,QAAQA,oBAAS;AAAA,IACjB,QAAQA,oBAAS;AAAA,IACjB,QAAQA,oBAAS,MAAMA,oBAAS,SAASA,oBAAS,MAAMA,oBAAS,MAAM,CAAC;AAAA,IACxE,QAAQA,oBAAS;AAAA,EAAA,CACjB;AAAA,EACDA,oBAAS,QAAQ;AAAA,IAChB,WAAW,2BAA2B;AAAA,IACtC,UAAUA,oBAAS;AAAA,EACnB,CAAA;AACF;AAKA,MAAM,mBAAmBA,oBAAS;AAAA,EACjC;AAAA,EACA;AACD;AAEa,MAAA,gBAAgBA,oBAAS,OAAO;AAAA,EAC5C,UAAUA,oBAAS,OAAOA,oBAAS,QAAQ,gBAAgB;AAAA,EAC3D,SAASA,oBAAS,OAAOA,oBAAS,QAAQ,eAAe;AAC1D,CAAC;;"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import * as Typesafe from "@contember/typesafe";
|
|
2
|
-
const selectionNodeSchemaFactory = () => {
|
|
3
|
-
return (input, path = []) => {
|
|
4
|
-
return Typesafe.array(Typesafe.union(
|
|
5
|
-
Typesafe.string,
|
|
6
|
-
Typesafe.tuple(
|
|
7
|
-
Typesafe.string,
|
|
8
|
-
Typesafe.anyJsonObject,
|
|
9
|
-
selectionNodeSchemaFactory()
|
|
10
|
-
)
|
|
11
|
-
))(input, path);
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
const webhookTargetSchema = Typesafe.intersection(
|
|
15
|
-
Typesafe.object({
|
|
16
|
-
type: Typesafe.literal("webhook"),
|
|
17
|
-
name: Typesafe.string,
|
|
18
|
-
url: Typesafe.string
|
|
19
|
-
}),
|
|
20
|
-
Typesafe.partial({
|
|
21
|
-
headers: Typesafe.record(Typesafe.string, Typesafe.string),
|
|
22
|
-
timeoutMs: Typesafe.integer,
|
|
23
|
-
maxAttempts: Typesafe.integer,
|
|
24
|
-
initialRepeatIntervalMs: Typesafe.integer,
|
|
25
|
-
batchSize: Typesafe.integer,
|
|
26
|
-
body: Typesafe.anyJsonObject,
|
|
27
|
-
payloadPath: Typesafe.array(Typesafe.string)
|
|
28
|
-
})
|
|
29
|
-
);
|
|
30
|
-
const anyTargetSchema = Typesafe.union(webhookTargetSchema);
|
|
31
|
-
const watchTriggerSchema = Typesafe.intersection(
|
|
32
|
-
Typesafe.object({
|
|
33
|
-
type: Typesafe.literal("watch"),
|
|
34
|
-
name: Typesafe.string,
|
|
35
|
-
entity: Typesafe.string,
|
|
36
|
-
watch: selectionNodeSchemaFactory(),
|
|
37
|
-
target: Typesafe.string
|
|
38
|
-
}),
|
|
39
|
-
Typesafe.partial({
|
|
40
|
-
selection: selectionNodeSchemaFactory(),
|
|
41
|
-
priority: Typesafe.integer,
|
|
42
|
-
withNodes: Typesafe.boolean
|
|
43
|
-
})
|
|
44
|
-
);
|
|
45
|
-
const basicTriggerSchema = Typesafe.intersection(
|
|
46
|
-
Typesafe.object({
|
|
47
|
-
type: Typesafe.literal("basic"),
|
|
48
|
-
name: Typesafe.string,
|
|
49
|
-
entity: Typesafe.string,
|
|
50
|
-
create: Typesafe.boolean,
|
|
51
|
-
delete: Typesafe.boolean,
|
|
52
|
-
update: Typesafe.union(Typesafe.boolean, Typesafe.array(Typesafe.string)),
|
|
53
|
-
target: Typesafe.string
|
|
54
|
-
}),
|
|
55
|
-
Typesafe.partial({
|
|
56
|
-
selection: selectionNodeSchemaFactory(),
|
|
57
|
-
priority: Typesafe.integer
|
|
58
|
-
})
|
|
59
|
-
);
|
|
60
|
-
const anyTriggerSchema = Typesafe.union(
|
|
61
|
-
watchTriggerSchema,
|
|
62
|
-
basicTriggerSchema
|
|
63
|
-
);
|
|
64
|
-
const actionsSchema = Typesafe.object({
|
|
65
|
-
triggers: Typesafe.record(Typesafe.string, anyTriggerSchema),
|
|
66
|
-
targets: Typesafe.record(Typesafe.string, anyTargetSchema)
|
|
67
|
-
});
|
|
68
|
-
export {
|
|
69
|
-
actionsSchema
|
|
70
|
-
};
|
|
71
|
-
//# sourceMappingURL=actions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sources":["../../../../../packages/schema-utils/src/type-schema/actions.ts"],"sourcesContent":["import * as Typesafe from '@contember/typesafe'\nimport { Actions } from '@contember/schema'\n\nconst selectionNodeSchemaFactory = (): Typesafe.Type<Actions.SelectionNode> => {\n\treturn (input: unknown, path: PropertyKey[] = []): Actions.SelectionNode => {\n\t\treturn Typesafe.array(Typesafe.union(\n\t\t\tTypesafe.string,\n\t\t\tTypesafe.tuple(\n\t\t\t\tTypesafe.string,\n\t\t\t\tTypesafe.anyJsonObject,\n\t\t\t\tselectionNodeSchemaFactory(),\n\t\t\t),\n\t\t))(input, path)\n\t}\n}\n\nconst webhookTargetSchema = Typesafe.intersection(\n\tTypesafe.object({\n\t\ttype: Typesafe.literal('webhook'),\n\t\tname: Typesafe.string,\n\t\turl: Typesafe.string,\n\t}),\n\tTypesafe.partial({\n\t\theaders: Typesafe.record(Typesafe.string, Typesafe.string),\n\t\ttimeoutMs: Typesafe.integer,\n\t\tmaxAttempts: Typesafe.integer,\n\t\tinitialRepeatIntervalMs: Typesafe.integer,\n\t\tbatchSize: Typesafe.integer,\n\t\tbody: Typesafe.anyJsonObject,\n\t\tpayloadPath: Typesafe.array(Typesafe.string),\n\t}),\n)\nconst webhookTargetSchemaCheck: Typesafe.Equals<Actions.WebhookTarget, ReturnType<typeof webhookTargetSchema>> = true\n\nconst anyTargetSchema: Typesafe.Type<Actions.AnyTarget> = Typesafe.union(webhookTargetSchema)\n\nconst watchTriggerSchema = Typesafe.intersection(\n\tTypesafe.object({\n\t\ttype: Typesafe.literal('watch'),\n\t\tname: Typesafe.string,\n\t\tentity: Typesafe.string,\n\t\twatch: selectionNodeSchemaFactory(),\n\t\ttarget: Typesafe.string,\n\t}),\n\tTypesafe.partial({\n\t\tselection: selectionNodeSchemaFactory(),\n\t\tpriority: Typesafe.integer,\n\t\twithNodes: Typesafe.boolean,\n\t}),\n)\n\nconst watchTriggerSchemaCheck: Typesafe.Equals<Actions.WatchTrigger, ReturnType<typeof watchTriggerSchema>> = true\n\n\nconst basicTriggerSchema = Typesafe.intersection(\n\tTypesafe.object({\n\t\ttype: Typesafe.literal('basic'),\n\t\tname: Typesafe.string,\n\t\tentity: Typesafe.string,\n\t\tcreate: Typesafe.boolean,\n\t\tdelete: Typesafe.boolean,\n\t\tupdate: Typesafe.union(Typesafe.boolean, Typesafe.array(Typesafe.string)),\n\t\ttarget: Typesafe.string,\n\t}),\n\tTypesafe.partial({\n\t\tselection: selectionNodeSchemaFactory(),\n\t\tpriority: Typesafe.integer,\n\t}),\n)\n\nconst basicTriggerSchemaCheck: Typesafe.Equals<Actions.BasicTrigger, ReturnType<typeof basicTriggerSchema>> = true\n\n\nconst anyTriggerSchema = Typesafe.union(\n\twatchTriggerSchema,\n\tbasicTriggerSchema,\n)\n\nexport const actionsSchema = Typesafe.object({\n\ttriggers: Typesafe.record(Typesafe.string, anyTriggerSchema),\n\ttargets: Typesafe.record(Typesafe.string, anyTargetSchema),\n})\n"],"names":[],"mappings":";AAGA,MAAM,6BAA6B,MAA4C;AAC9E,SAAO,CAAC,OAAgB,OAAsB,OAA8B;AACpE,WAAA,SAAS,MAAM,SAAS;AAAA,MAC9B,SAAS;AAAA,MACT,SAAS;AAAA,QACR,SAAS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,2BAA2B;AAAA,IACtC,UAAU,SAAS;AAAA,EACnB,CAAA;AACF;AAKA,MAAM,mBAAmB,SAAS;AAAA,EACjC;AAAA,EACA;AACD;AAEa,MAAA,gBAAgB,SAAS,OAAO;AAAA,EAC5C,UAAU,SAAS,OAAO,SAAS,QAAQ,gBAAgB;AAAA,EAC3D,SAAS,SAAS,OAAO,SAAS,QAAQ,eAAe;AAC1D,CAAC;"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const Typesafe = require("@contember/typesafe");
|
|
4
|
-
const schema = require("@contember/schema");
|
|
5
|
-
function _interopNamespaceDefault(e) {
|
|
6
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
|
-
if (e) {
|
|
8
|
-
for (const k in e) {
|
|
9
|
-
if (k !== "default") {
|
|
10
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: () => e[k]
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
n.default = e;
|
|
19
|
-
return Object.freeze(n);
|
|
20
|
-
}
|
|
21
|
-
const Typesafe__namespace = /* @__PURE__ */ _interopNamespaceDefault(Typesafe);
|
|
22
|
-
const conditionSchema = (type) => {
|
|
23
|
-
const metadata = type ? resolveColumnMetadata(type) : { type: Typesafe__namespace.scalar };
|
|
24
|
-
return conditionSchemaInner(metadata);
|
|
25
|
-
};
|
|
26
|
-
const conditionSchemaInner = (metadata) => {
|
|
27
|
-
return (input, path = []) => {
|
|
28
|
-
const self = conditionSchemaInner(metadata);
|
|
29
|
-
const inner = metadata.type;
|
|
30
|
-
const objectSchema = Typesafe__namespace.noExtraProps(Typesafe__namespace.partial({
|
|
31
|
-
and: Typesafe__namespace.array(self),
|
|
32
|
-
or: Typesafe__namespace.array(self),
|
|
33
|
-
not: self,
|
|
34
|
-
null: Typesafe__namespace.boolean,
|
|
35
|
-
isNull: Typesafe__namespace.boolean,
|
|
36
|
-
never: Typesafe__namespace.true_,
|
|
37
|
-
always: Typesafe__namespace.true_,
|
|
38
|
-
...metadata.isJson !== true ? {
|
|
39
|
-
eq: inner,
|
|
40
|
-
notEq: inner,
|
|
41
|
-
in: Typesafe__namespace.array(inner),
|
|
42
|
-
notIn: Typesafe__namespace.array(inner),
|
|
43
|
-
lt: inner,
|
|
44
|
-
lte: inner,
|
|
45
|
-
gt: inner,
|
|
46
|
-
gte: inner
|
|
47
|
-
} : {
|
|
48
|
-
// For JSON columns, allow includes operator
|
|
49
|
-
includes: inner
|
|
50
|
-
},
|
|
51
|
-
...metadata.isString !== false ? {
|
|
52
|
-
contains: Typesafe__namespace.string,
|
|
53
|
-
startsWith: Typesafe__namespace.string,
|
|
54
|
-
endsWith: Typesafe__namespace.string,
|
|
55
|
-
containsCI: Typesafe__namespace.string,
|
|
56
|
-
startsWithCI: Typesafe__namespace.string,
|
|
57
|
-
endsWithCI: Typesafe__namespace.string
|
|
58
|
-
} : {}
|
|
59
|
-
}));
|
|
60
|
-
return objectSchema(input, path);
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
const resolveColumnMetadata = (type) => {
|
|
64
|
-
const resolvedType = Typesafe__namespace.nullable(resolveColumnTypeSchema(type));
|
|
65
|
-
return {
|
|
66
|
-
type: resolvedType,
|
|
67
|
-
isJson: type === schema.Model.ColumnType.Json,
|
|
68
|
-
isString: type === schema.Model.ColumnType.String
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
const resolveColumnTypeSchema = (type) => {
|
|
72
|
-
switch (type) {
|
|
73
|
-
case schema.Model.ColumnType.Bool:
|
|
74
|
-
return Typesafe__namespace.boolean;
|
|
75
|
-
// todo: validate format of string-like inputs uuid, date, enum
|
|
76
|
-
case schema.Model.ColumnType.Date:
|
|
77
|
-
case schema.Model.ColumnType.DateTime:
|
|
78
|
-
case schema.Model.ColumnType.Time:
|
|
79
|
-
case schema.Model.ColumnType.Uuid:
|
|
80
|
-
case schema.Model.ColumnType.Enum:
|
|
81
|
-
case schema.Model.ColumnType.String:
|
|
82
|
-
return Typesafe__namespace.string;
|
|
83
|
-
case schema.Model.ColumnType.Double:
|
|
84
|
-
return Typesafe__namespace.number;
|
|
85
|
-
case schema.Model.ColumnType.Int:
|
|
86
|
-
return Typesafe__namespace.integer;
|
|
87
|
-
case schema.Model.ColumnType.Json:
|
|
88
|
-
return Typesafe__namespace.anyJson;
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
exports.conditionSchema = conditionSchema;
|
|
92
|
-
//# sourceMappingURL=condition.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"condition.cjs","sources":["../../../../../packages/schema-utils/src/type-schema/condition.ts"],"sourcesContent":["import * as Typesafe from '@contember/typesafe'\nimport { Json, Type } from '@contember/typesafe'\nimport { Input, Model, Value } from '@contember/schema'\n\nexport const conditionSchema = <T extends Value.FieldValue>(type?: Model.ColumnType): Type<Input.Condition<T>> => {\n\tconst metadata = type ? resolveColumnMetadata(type) : { type: Typesafe.scalar }\n\treturn conditionSchemaInner(metadata)\n}\n\ninterface ResolvedColumnMetadata<T extends Json> {\n\ttype: Typesafe.Type<T>\n\tisJson?: boolean\n\tisString?: boolean\n}\n\nconst conditionSchemaInner = <T extends Json>(metadata: ResolvedColumnMetadata<T>): Type<Input.Condition<T>> => {\n\treturn (input: unknown, path: PropertyKey[] = []): Input.Condition<T> => {\n\t\tconst self = conditionSchemaInner(metadata)\n\t\tconst inner = metadata.type\n\t\tconst objectSchema = Typesafe.noExtraProps(Typesafe.partial({\n\t\t\tand: Typesafe.array(self),\n\t\t\tor: Typesafe.array(self),\n\t\t\tnot: self,\n\t\t\tnull: Typesafe.boolean,\n\t\t\tisNull: Typesafe.boolean,\n\t\t\tnever: Typesafe.true_,\n\t\t\talways: Typesafe.true_,\n\t\t\t...(metadata.isJson !== true ? {\n\t\t\t\teq: inner,\n\t\t\t\tnotEq: inner,\n\t\t\t\tin: Typesafe.array(inner),\n\t\t\t\tnotIn: Typesafe.array(inner),\n\t\t\t\tlt: inner,\n\t\t\t\tlte: inner,\n\t\t\t\tgt: inner,\n\t\t\t\tgte: inner,\n\t\t\t} : {\n\t\t\t\t// For JSON columns, allow includes operator\n\t\t\t\tincludes: inner,\n\t\t\t}),\n\t\t\t...(metadata.isString !== false ? {\n\t\t\t\tcontains: Typesafe.string,\n\t\t\t\tstartsWith: Typesafe.string,\n\t\t\t\tendsWith: Typesafe.string,\n\t\t\t\tcontainsCI: Typesafe.string,\n\t\t\t\tstartsWithCI: Typesafe.string,\n\t\t\t\tendsWithCI: Typesafe.string,\n\t\t\t} : {}),\n\t\t}))\n\t\treturn objectSchema(input, path) as Input.Condition<T>\n\t}\n}\n\nconst resolveColumnMetadata = (type: Model.ColumnType): ResolvedColumnMetadata<any> => {\n\tconst resolvedType = Typesafe.nullable(resolveColumnTypeSchema(type))\n\treturn {\n\t\ttype: resolvedType,\n\t\tisJson: type === Model.ColumnType.Json,\n\t\tisString: type === Model.ColumnType.String,\n\n\t}\n}\n\n\nconst resolveColumnTypeSchema = (type: Model.ColumnType) => {\n\tswitch (type) {\n\t\tcase Model.ColumnType.Bool:\n\t\t\treturn Typesafe.boolean\n\n\t\t// todo: validate format of string-like inputs uuid, date, enum\n\t\tcase Model.ColumnType.Date:\n\t\tcase Model.ColumnType.DateTime:\n\t\tcase Model.ColumnType.Time:\n\t\tcase Model.ColumnType.Uuid:\n\t\tcase Model.ColumnType.Enum:\n\t\tcase Model.ColumnType.String:\n\t\t\treturn Typesafe.string\n\t\tcase Model.ColumnType.Double:\n\t\t\treturn Typesafe.number\n\t\tcase Model.ColumnType.Int:\n\t\t\treturn Typesafe.integer\n\t\tcase Model.ColumnType.Json:\n\t\t\treturn Typesafe.anyJson\n\t}\n}\n"],"names":["Types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IACN,MAAM;AAAA,IACN,QAAQ,SAASC,aAAM,WAAW;AAAA,IAClC,UAAU,SAASA,OAAA,MAAM,WAAW;AAAA,EAErC;AACD;AAGA,MAAM,0BAA0B,CAAC,SAA2B;AAC3D,UAAQ,MAAM;AAAA,IACb,KAAKA,OAAAA,MAAM,WAAW;AACrB,aAAOD,oBAAS;AAAA;AAAA,IAGjB,KAAKC,OAAAA,MAAM,WAAW;AAAA,IACtB,KAAKA,OAAAA,MAAM,WAAW;AAAA,IACtB,KAAKA,OAAAA,MAAM,WAAW;AAAA,IACtB,KAAKA,OAAAA,MAAM,WAAW;AAAA,IACtB,KAAKA,OAAAA,MAAM,WAAW;AAAA,IACtB,KAAKA,OAAAA,MAAM,WAAW;AACrB,aAAOD,oBAAS;AAAA,IACjB,KAAKC,OAAAA,MAAM,WAAW;AACrB,aAAOD,oBAAS;AAAA,IACjB,KAAKC,OAAAA,MAAM,WAAW;AACrB,aAAOD,oBAAS;AAAA,IACjB,KAAKC,OAAAA,MAAM,WAAW;AACrB,aAAOD,oBAAS;AAAA,EAAA;AAEnB;;"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import * as Typesafe from "@contember/typesafe";
|
|
2
|
-
import { Model } from "@contember/schema";
|
|
3
|
-
const conditionSchema = (type) => {
|
|
4
|
-
const metadata = type ? resolveColumnMetadata(type) : { type: Typesafe.scalar };
|
|
5
|
-
return conditionSchemaInner(metadata);
|
|
6
|
-
};
|
|
7
|
-
const conditionSchemaInner = (metadata) => {
|
|
8
|
-
return (input, path = []) => {
|
|
9
|
-
const self = conditionSchemaInner(metadata);
|
|
10
|
-
const inner = metadata.type;
|
|
11
|
-
const objectSchema = Typesafe.noExtraProps(Typesafe.partial({
|
|
12
|
-
and: Typesafe.array(self),
|
|
13
|
-
or: Typesafe.array(self),
|
|
14
|
-
not: self,
|
|
15
|
-
null: Typesafe.boolean,
|
|
16
|
-
isNull: Typesafe.boolean,
|
|
17
|
-
never: Typesafe.true_,
|
|
18
|
-
always: Typesafe.true_,
|
|
19
|
-
...metadata.isJson !== true ? {
|
|
20
|
-
eq: inner,
|
|
21
|
-
notEq: inner,
|
|
22
|
-
in: Typesafe.array(inner),
|
|
23
|
-
notIn: Typesafe.array(inner),
|
|
24
|
-
lt: inner,
|
|
25
|
-
lte: inner,
|
|
26
|
-
gt: inner,
|
|
27
|
-
gte: inner
|
|
28
|
-
} : {
|
|
29
|
-
// For JSON columns, allow includes operator
|
|
30
|
-
includes: inner
|
|
31
|
-
},
|
|
32
|
-
...metadata.isString !== false ? {
|
|
33
|
-
contains: Typesafe.string,
|
|
34
|
-
startsWith: Typesafe.string,
|
|
35
|
-
endsWith: Typesafe.string,
|
|
36
|
-
containsCI: Typesafe.string,
|
|
37
|
-
startsWithCI: Typesafe.string,
|
|
38
|
-
endsWithCI: Typesafe.string
|
|
39
|
-
} : {}
|
|
40
|
-
}));
|
|
41
|
-
return objectSchema(input, path);
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
const resolveColumnMetadata = (type) => {
|
|
45
|
-
const resolvedType = Typesafe.nullable(resolveColumnTypeSchema(type));
|
|
46
|
-
return {
|
|
47
|
-
type: resolvedType,
|
|
48
|
-
isJson: type === Model.ColumnType.Json,
|
|
49
|
-
isString: type === Model.ColumnType.String
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
const resolveColumnTypeSchema = (type) => {
|
|
53
|
-
switch (type) {
|
|
54
|
-
case Model.ColumnType.Bool:
|
|
55
|
-
return Typesafe.boolean;
|
|
56
|
-
// todo: validate format of string-like inputs uuid, date, enum
|
|
57
|
-
case Model.ColumnType.Date:
|
|
58
|
-
case Model.ColumnType.DateTime:
|
|
59
|
-
case Model.ColumnType.Time:
|
|
60
|
-
case Model.ColumnType.Uuid:
|
|
61
|
-
case Model.ColumnType.Enum:
|
|
62
|
-
case Model.ColumnType.String:
|
|
63
|
-
return Typesafe.string;
|
|
64
|
-
case Model.ColumnType.Double:
|
|
65
|
-
return Typesafe.number;
|
|
66
|
-
case Model.ColumnType.Int:
|
|
67
|
-
return Typesafe.integer;
|
|
68
|
-
case Model.ColumnType.Json:
|
|
69
|
-
return Typesafe.anyJson;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
export {
|
|
73
|
-
conditionSchema
|
|
74
|
-
};
|
|
75
|
-
//# sourceMappingURL=condition.js.map
|