@contember/engine-content-api 2.0.0-alpha.20 → 2.0.0-alpha.21
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/dist/development/index.cjs +1 -1
- package/dist/development/index.js +1 -1
- package/dist/development/src/input-validation/preValidation/InputPreValidator.cjs +1 -1
- package/dist/development/src/input-validation/preValidation/InputPreValidator.cjs.map +1 -1
- package/dist/development/src/input-validation/preValidation/InputPreValidator.js +1 -1
- package/dist/development/src/input-validation/preValidation/InputPreValidator.js.map +1 -1
- package/dist/development/src/inputProcessing/CreateInputVisitor.cjs +10 -10
- package/dist/development/src/inputProcessing/CreateInputVisitor.cjs.map +1 -1
- package/dist/development/src/inputProcessing/CreateInputVisitor.js +10 -10
- package/dist/development/src/inputProcessing/CreateInputVisitor.js.map +1 -1
- package/dist/development/src/inputProcessing/UpdateInputVisitor.cjs +13 -13
- package/dist/development/src/inputProcessing/UpdateInputVisitor.cjs.map +1 -1
- package/dist/development/src/inputProcessing/UpdateInputVisitor.js +13 -13
- package/dist/development/src/inputProcessing/UpdateInputVisitor.js.map +1 -1
- package/dist/development/src/mapper/MutationProcessorHelper.cjs +10 -2
- package/dist/development/src/mapper/MutationProcessorHelper.cjs.map +1 -1
- package/dist/development/src/mapper/MutationProcessorHelper.js +10 -2
- package/dist/development/src/mapper/MutationProcessorHelper.js.map +1 -1
- package/dist/development/src/mapper/Result.cjs +10 -27
- package/dist/development/src/mapper/Result.cjs.map +1 -1
- package/dist/development/src/mapper/Result.js +10 -27
- package/dist/development/src/mapper/Result.js.map +1 -1
- package/dist/development/src/mapper/insert/InsertBuilder.cjs +1 -13
- package/dist/development/src/mapper/insert/InsertBuilder.cjs.map +1 -1
- package/dist/development/src/mapper/insert/InsertBuilder.js +1 -13
- package/dist/development/src/mapper/insert/InsertBuilder.js.map +1 -1
- package/dist/development/src/mapper/insert/Inserter.cjs +43 -21
- package/dist/development/src/mapper/insert/Inserter.cjs.map +1 -1
- package/dist/development/src/mapper/insert/Inserter.js +45 -23
- package/dist/development/src/mapper/insert/Inserter.js.map +1 -1
- package/dist/development/src/mapper/insert/SqlCreateInputProcessor.cjs +22 -76
- package/dist/development/src/mapper/insert/SqlCreateInputProcessor.cjs.map +1 -1
- package/dist/development/src/mapper/insert/SqlCreateInputProcessor.js +22 -76
- package/dist/development/src/mapper/insert/SqlCreateInputProcessor.js.map +1 -1
- package/dist/development/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.cjs +45 -0
- package/dist/development/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.cjs.map +1 -0
- package/dist/development/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.js +45 -0
- package/dist/development/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.js.map +1 -0
- package/dist/development/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.cjs +42 -0
- package/dist/development/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.cjs.map +1 -0
- package/dist/development/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.js +42 -0
- package/dist/development/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.js.map +1 -0
- package/dist/development/src/mapper/insert/relations/OneHasManyCreateInputProcessor.cjs +37 -0
- package/dist/development/src/mapper/insert/relations/OneHasManyCreateInputProcessor.cjs.map +1 -0
- package/dist/development/src/mapper/insert/relations/OneHasManyCreateInputProcessor.js +37 -0
- package/dist/development/src/mapper/insert/relations/OneHasManyCreateInputProcessor.js.map +1 -0
- package/dist/development/src/mapper/{relations → insert/relations}/OneHasOneInverseCreateInputProcessor.cjs +25 -32
- package/dist/development/src/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.cjs.map +1 -0
- package/dist/development/src/mapper/{relations → insert/relations}/OneHasOneInverseCreateInputProcessor.js +25 -32
- package/dist/development/src/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.js.map +1 -0
- package/dist/development/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.cjs +67 -0
- package/dist/development/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.cjs.map +1 -0
- package/dist/development/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.js +67 -0
- package/dist/development/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.js.map +1 -0
- package/dist/development/src/mapper/update/SqlUpdateInputProcessor.cjs +36 -36
- package/dist/development/src/mapper/update/SqlUpdateInputProcessor.cjs.map +1 -1
- package/dist/development/src/mapper/update/SqlUpdateInputProcessor.js +36 -36
- package/dist/development/src/mapper/update/SqlUpdateInputProcessor.js.map +1 -1
- package/dist/development/src/mapper/update/UpdateBuilder.cjs +2 -14
- package/dist/development/src/mapper/update/UpdateBuilder.cjs.map +1 -1
- package/dist/development/src/mapper/update/UpdateBuilder.js +2 -14
- package/dist/development/src/mapper/update/UpdateBuilder.js.map +1 -1
- package/dist/development/src/mapper/update/Updater.cjs +45 -17
- package/dist/development/src/mapper/update/Updater.cjs.map +1 -1
- package/dist/development/src/mapper/update/Updater.js +47 -19
- package/dist/development/src/mapper/update/Updater.js.map +1 -1
- package/dist/development/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.cjs +89 -0
- package/dist/development/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.cjs.map +1 -0
- package/dist/development/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.js +89 -0
- package/dist/development/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.js.map +1 -0
- package/dist/development/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.cjs +89 -0
- package/dist/development/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.cjs.map +1 -0
- package/dist/development/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.js +89 -0
- package/dist/development/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.js.map +1 -0
- package/dist/development/src/mapper/update/relations/OneHasManyUpdateInputProcessor.cjs +86 -0
- package/dist/development/src/mapper/update/relations/OneHasManyUpdateInputProcessor.cjs.map +1 -0
- package/dist/development/src/mapper/update/relations/OneHasManyUpdateInputProcessor.js +86 -0
- package/dist/development/src/mapper/update/relations/OneHasManyUpdateInputProcessor.js.map +1 -0
- package/dist/development/src/mapper/{relations → update/relations}/OneHasOneInverseUpdateInputProcessor.cjs +83 -66
- package/dist/development/src/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.cjs.map +1 -0
- package/dist/development/src/mapper/{relations → update/relations}/OneHasOneInverseUpdateInputProcessor.js +83 -66
- package/dist/development/src/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.js.map +1 -0
- package/dist/development/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.cjs +187 -0
- package/dist/development/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.cjs.map +1 -0
- package/dist/development/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.js +187 -0
- package/dist/development/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.js.map +1 -0
- package/dist/development/src/resolvers/MutationResolver.cjs +1 -1
- package/dist/development/src/resolvers/MutationResolver.js +1 -1
- package/dist/production/index.cjs +1 -1
- package/dist/production/index.js +1 -1
- package/dist/production/src/input-validation/preValidation/InputPreValidator.cjs +1 -1
- package/dist/production/src/input-validation/preValidation/InputPreValidator.cjs.map +1 -1
- package/dist/production/src/input-validation/preValidation/InputPreValidator.js +1 -1
- package/dist/production/src/input-validation/preValidation/InputPreValidator.js.map +1 -1
- package/dist/production/src/inputProcessing/CreateInputVisitor.cjs +10 -10
- package/dist/production/src/inputProcessing/CreateInputVisitor.cjs.map +1 -1
- package/dist/production/src/inputProcessing/CreateInputVisitor.js +10 -10
- package/dist/production/src/inputProcessing/CreateInputVisitor.js.map +1 -1
- package/dist/production/src/inputProcessing/UpdateInputVisitor.cjs +13 -13
- package/dist/production/src/inputProcessing/UpdateInputVisitor.cjs.map +1 -1
- package/dist/production/src/inputProcessing/UpdateInputVisitor.js +13 -13
- package/dist/production/src/inputProcessing/UpdateInputVisitor.js.map +1 -1
- package/dist/production/src/mapper/MutationProcessorHelper.cjs +10 -2
- package/dist/production/src/mapper/MutationProcessorHelper.cjs.map +1 -1
- package/dist/production/src/mapper/MutationProcessorHelper.js +10 -2
- package/dist/production/src/mapper/MutationProcessorHelper.js.map +1 -1
- package/dist/production/src/mapper/Result.cjs +10 -27
- package/dist/production/src/mapper/Result.cjs.map +1 -1
- package/dist/production/src/mapper/Result.js +10 -27
- package/dist/production/src/mapper/Result.js.map +1 -1
- package/dist/production/src/mapper/insert/InsertBuilder.cjs +1 -13
- package/dist/production/src/mapper/insert/InsertBuilder.cjs.map +1 -1
- package/dist/production/src/mapper/insert/InsertBuilder.js +1 -13
- package/dist/production/src/mapper/insert/InsertBuilder.js.map +1 -1
- package/dist/production/src/mapper/insert/Inserter.cjs +43 -21
- package/dist/production/src/mapper/insert/Inserter.cjs.map +1 -1
- package/dist/production/src/mapper/insert/Inserter.js +45 -23
- package/dist/production/src/mapper/insert/Inserter.js.map +1 -1
- package/dist/production/src/mapper/insert/SqlCreateInputProcessor.cjs +22 -76
- package/dist/production/src/mapper/insert/SqlCreateInputProcessor.cjs.map +1 -1
- package/dist/production/src/mapper/insert/SqlCreateInputProcessor.js +22 -76
- package/dist/production/src/mapper/insert/SqlCreateInputProcessor.js.map +1 -1
- package/dist/production/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.cjs +45 -0
- package/dist/production/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.cjs.map +1 -0
- package/dist/production/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.js +45 -0
- package/dist/production/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.js.map +1 -0
- package/dist/production/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.cjs +42 -0
- package/dist/production/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.cjs.map +1 -0
- package/dist/production/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.js +42 -0
- package/dist/production/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.js.map +1 -0
- package/dist/production/src/mapper/insert/relations/OneHasManyCreateInputProcessor.cjs +37 -0
- package/dist/production/src/mapper/insert/relations/OneHasManyCreateInputProcessor.cjs.map +1 -0
- package/dist/production/src/mapper/insert/relations/OneHasManyCreateInputProcessor.js +37 -0
- package/dist/production/src/mapper/insert/relations/OneHasManyCreateInputProcessor.js.map +1 -0
- package/dist/production/src/mapper/{relations → insert/relations}/OneHasOneInverseCreateInputProcessor.cjs +25 -32
- package/dist/production/src/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.cjs.map +1 -0
- package/dist/production/src/mapper/{relations → insert/relations}/OneHasOneInverseCreateInputProcessor.js +25 -32
- package/dist/production/src/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.js.map +1 -0
- package/dist/production/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.cjs +67 -0
- package/dist/production/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.cjs.map +1 -0
- package/dist/production/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.js +67 -0
- package/dist/production/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.js.map +1 -0
- package/dist/production/src/mapper/update/SqlUpdateInputProcessor.cjs +36 -36
- package/dist/production/src/mapper/update/SqlUpdateInputProcessor.cjs.map +1 -1
- package/dist/production/src/mapper/update/SqlUpdateInputProcessor.js +36 -36
- package/dist/production/src/mapper/update/SqlUpdateInputProcessor.js.map +1 -1
- package/dist/production/src/mapper/update/UpdateBuilder.cjs +2 -14
- package/dist/production/src/mapper/update/UpdateBuilder.cjs.map +1 -1
- package/dist/production/src/mapper/update/UpdateBuilder.js +2 -14
- package/dist/production/src/mapper/update/UpdateBuilder.js.map +1 -1
- package/dist/production/src/mapper/update/Updater.cjs +45 -17
- package/dist/production/src/mapper/update/Updater.cjs.map +1 -1
- package/dist/production/src/mapper/update/Updater.js +47 -19
- package/dist/production/src/mapper/update/Updater.js.map +1 -1
- package/dist/production/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.cjs +89 -0
- package/dist/production/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.cjs.map +1 -0
- package/dist/production/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.js +89 -0
- package/dist/production/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.js.map +1 -0
- package/dist/production/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.cjs +89 -0
- package/dist/production/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.cjs.map +1 -0
- package/dist/production/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.js +89 -0
- package/dist/production/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.js.map +1 -0
- package/dist/production/src/mapper/update/relations/OneHasManyUpdateInputProcessor.cjs +86 -0
- package/dist/production/src/mapper/update/relations/OneHasManyUpdateInputProcessor.cjs.map +1 -0
- package/dist/production/src/mapper/update/relations/OneHasManyUpdateInputProcessor.js +86 -0
- package/dist/production/src/mapper/update/relations/OneHasManyUpdateInputProcessor.js.map +1 -0
- package/dist/production/src/mapper/{relations → update/relations}/OneHasOneInverseUpdateInputProcessor.cjs +83 -66
- package/dist/production/src/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.cjs.map +1 -0
- package/dist/production/src/mapper/{relations → update/relations}/OneHasOneInverseUpdateInputProcessor.js +83 -66
- package/dist/production/src/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.js.map +1 -0
- package/dist/production/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.cjs +187 -0
- package/dist/production/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.cjs.map +1 -0
- package/dist/production/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.js +187 -0
- package/dist/production/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.js.map +1 -0
- package/dist/production/src/resolvers/MutationResolver.cjs +1 -1
- package/dist/production/src/resolvers/MutationResolver.js +1 -1
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/dist/types/input-validation/preValidation/InputPreValidator.d.ts.map +1 -1
- package/dist/types/inputProcessing/CreateInputVisitor.d.ts +8 -8
- package/dist/types/inputProcessing/CreateInputVisitor.d.ts.map +1 -1
- package/dist/types/inputProcessing/UpdateInputVisitor.d.ts +8 -8
- package/dist/types/inputProcessing/UpdateInputVisitor.d.ts.map +1 -1
- package/dist/types/mapper/MutationProcessorHelper.d.ts +2 -2
- package/dist/types/mapper/MutationProcessorHelper.d.ts.map +1 -1
- package/dist/types/mapper/Result.d.ts +11 -5
- package/dist/types/mapper/Result.d.ts.map +1 -1
- package/dist/types/mapper/insert/InsertBuilder.d.ts +3 -7
- package/dist/types/mapper/insert/InsertBuilder.d.ts.map +1 -1
- package/dist/types/mapper/insert/Inserter.d.ts +0 -1
- package/dist/types/mapper/insert/Inserter.d.ts.map +1 -1
- package/dist/types/mapper/insert/SqlCreateInputProcessor.d.ts +11 -8
- package/dist/types/mapper/insert/SqlCreateInputProcessor.d.ts.map +1 -1
- package/dist/types/mapper/insert/relations/ManyHasManyCreateInputProcessor.d.ts +24 -0
- package/dist/types/mapper/insert/relations/ManyHasManyCreateInputProcessor.d.ts.map +1 -0
- package/dist/types/mapper/insert/relations/ManyHasOneCreateInputProcessor.d.ts +23 -0
- package/dist/types/mapper/insert/relations/ManyHasOneCreateInputProcessor.d.ts.map +1 -0
- package/dist/types/mapper/insert/relations/OneHasManyCreateInputProcessor.d.ts +26 -0
- package/dist/types/mapper/insert/relations/OneHasManyCreateInputProcessor.d.ts.map +1 -0
- package/dist/types/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.d.ts +29 -0
- package/dist/types/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.d.ts.map +1 -0
- package/dist/types/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.d.ts +24 -0
- package/dist/types/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.d.ts.map +1 -0
- package/dist/types/mapper/update/SqlUpdateInputProcessor.d.ts +10 -7
- package/dist/types/mapper/update/SqlUpdateInputProcessor.d.ts.map +1 -1
- package/dist/types/mapper/update/UpdateBuilder.d.ts +2 -6
- package/dist/types/mapper/update/UpdateBuilder.d.ts.map +1 -1
- package/dist/types/mapper/update/Updater.d.ts +0 -1
- package/dist/types/mapper/update/Updater.d.ts.map +1 -1
- package/dist/types/mapper/update/relations/ManyHasManyUpdateInputProcessor.d.ts +46 -0
- package/dist/types/mapper/update/relations/ManyHasManyUpdateInputProcessor.d.ts.map +1 -0
- package/dist/types/mapper/update/relations/ManyHasOneUpdateInputProcessor.d.ts +40 -0
- package/dist/types/mapper/update/relations/ManyHasOneUpdateInputProcessor.d.ts.map +1 -0
- package/dist/types/mapper/update/relations/OneHasManyUpdateInputProcessor.d.ts +46 -0
- package/dist/types/mapper/update/relations/OneHasManyUpdateInputProcessor.d.ts.map +1 -0
- package/dist/types/mapper/{relations → update/relations}/OneHasOneInverseUpdateInputProcessor.d.ts +17 -13
- package/dist/types/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.d.ts.map +1 -0
- package/dist/types/mapper/{relations → update/relations}/OneHasOneOwningUpdateInputProcessor.d.ts +19 -16
- package/dist/types/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/src/input-validation/preValidation/InputPreValidator.ts +3 -5
- package/src/inputProcessing/CreateInputVisitor.ts +14 -14
- package/src/inputProcessing/UpdateInputVisitor.ts +17 -17
- package/src/mapper/MutationProcessorHelper.ts +16 -8
- package/src/mapper/Result.ts +11 -47
- package/src/mapper/insert/InsertBuilder.ts +8 -22
- package/src/mapper/insert/Inserter.ts +53 -40
- package/src/mapper/insert/SqlCreateInputProcessor.ts +35 -88
- package/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.ts +59 -0
- package/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.ts +57 -0
- package/src/mapper/insert/relations/OneHasManyCreateInputProcessor.ts +50 -0
- package/src/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.ts +91 -0
- package/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.ts +87 -0
- package/src/mapper/update/SqlUpdateInputProcessor.ts +48 -46
- package/src/mapper/update/UpdateBuilder.ts +9 -23
- package/src/mapper/update/Updater.ts +53 -34
- package/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.ts +116 -0
- package/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.ts +125 -0
- package/src/mapper/update/relations/OneHasManyUpdateInputProcessor.ts +111 -0
- package/src/mapper/{relations → update/relations}/OneHasOneInverseUpdateInputProcessor.ts +93 -73
- package/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.ts +243 -0
- package/tests/cases/integration/graphQlRequests/insert/oneHasMany/create.test.ts +8 -8
- package/tests/cases/integration/graphQlRequests/update/oneHasMany/connectOrCreate.test.ts +4 -4
- package/dist/development/src/mapper/DataManipulationBuilder.cjs +0 -5
- package/dist/development/src/mapper/DataManipulationBuilder.cjs.map +0 -1
- package/dist/development/src/mapper/DataManipulationBuilder.js +0 -5
- package/dist/development/src/mapper/DataManipulationBuilder.js.map +0 -1
- package/dist/development/src/mapper/relations/ManyHasManyInputProcessor.cjs +0 -75
- package/dist/development/src/mapper/relations/ManyHasManyInputProcessor.cjs.map +0 -1
- package/dist/development/src/mapper/relations/ManyHasManyInputProcessor.js +0 -75
- package/dist/development/src/mapper/relations/ManyHasManyInputProcessor.js.map +0 -1
- package/dist/development/src/mapper/relations/ManyHasOneInputProcessor.cjs +0 -114
- package/dist/development/src/mapper/relations/ManyHasOneInputProcessor.cjs.map +0 -1
- package/dist/development/src/mapper/relations/ManyHasOneInputProcessor.js +0 -114
- package/dist/development/src/mapper/relations/ManyHasOneInputProcessor.js.map +0 -1
- package/dist/development/src/mapper/relations/OneHasManyInputProcessor.cjs +0 -72
- package/dist/development/src/mapper/relations/OneHasManyInputProcessor.cjs.map +0 -1
- package/dist/development/src/mapper/relations/OneHasManyInputProcessor.js +0 -72
- package/dist/development/src/mapper/relations/OneHasManyInputProcessor.js.map +0 -1
- package/dist/development/src/mapper/relations/OneHasOneInverseCreateInputProcessor.cjs.map +0 -1
- package/dist/development/src/mapper/relations/OneHasOneInverseCreateInputProcessor.js.map +0 -1
- package/dist/development/src/mapper/relations/OneHasOneInverseUpdateInputProcessor.cjs.map +0 -1
- package/dist/development/src/mapper/relations/OneHasOneInverseUpdateInputProcessor.js.map +0 -1
- package/dist/development/src/mapper/relations/OneHasOneOwningCreateInputProcessor.cjs +0 -71
- package/dist/development/src/mapper/relations/OneHasOneOwningCreateInputProcessor.cjs.map +0 -1
- package/dist/development/src/mapper/relations/OneHasOneOwningCreateInputProcessor.js +0 -71
- package/dist/development/src/mapper/relations/OneHasOneOwningCreateInputProcessor.js.map +0 -1
- package/dist/development/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.cjs +0 -200
- package/dist/development/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.cjs.map +0 -1
- package/dist/development/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.js +0 -200
- package/dist/development/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.js.map +0 -1
- package/dist/production/src/mapper/DataManipulationBuilder.cjs +0 -5
- package/dist/production/src/mapper/DataManipulationBuilder.cjs.map +0 -1
- package/dist/production/src/mapper/DataManipulationBuilder.js +0 -5
- package/dist/production/src/mapper/DataManipulationBuilder.js.map +0 -1
- package/dist/production/src/mapper/relations/ManyHasManyInputProcessor.cjs +0 -75
- package/dist/production/src/mapper/relations/ManyHasManyInputProcessor.cjs.map +0 -1
- package/dist/production/src/mapper/relations/ManyHasManyInputProcessor.js +0 -75
- package/dist/production/src/mapper/relations/ManyHasManyInputProcessor.js.map +0 -1
- package/dist/production/src/mapper/relations/ManyHasOneInputProcessor.cjs +0 -114
- package/dist/production/src/mapper/relations/ManyHasOneInputProcessor.cjs.map +0 -1
- package/dist/production/src/mapper/relations/ManyHasOneInputProcessor.js +0 -114
- package/dist/production/src/mapper/relations/ManyHasOneInputProcessor.js.map +0 -1
- package/dist/production/src/mapper/relations/OneHasManyInputProcessor.cjs +0 -72
- package/dist/production/src/mapper/relations/OneHasManyInputProcessor.cjs.map +0 -1
- package/dist/production/src/mapper/relations/OneHasManyInputProcessor.js +0 -72
- package/dist/production/src/mapper/relations/OneHasManyInputProcessor.js.map +0 -1
- package/dist/production/src/mapper/relations/OneHasOneInverseCreateInputProcessor.cjs.map +0 -1
- package/dist/production/src/mapper/relations/OneHasOneInverseCreateInputProcessor.js.map +0 -1
- package/dist/production/src/mapper/relations/OneHasOneInverseUpdateInputProcessor.cjs.map +0 -1
- package/dist/production/src/mapper/relations/OneHasOneInverseUpdateInputProcessor.js.map +0 -1
- package/dist/production/src/mapper/relations/OneHasOneOwningCreateInputProcessor.cjs +0 -71
- package/dist/production/src/mapper/relations/OneHasOneOwningCreateInputProcessor.cjs.map +0 -1
- package/dist/production/src/mapper/relations/OneHasOneOwningCreateInputProcessor.js +0 -71
- package/dist/production/src/mapper/relations/OneHasOneOwningCreateInputProcessor.js.map +0 -1
- package/dist/production/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.cjs +0 -200
- package/dist/production/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.cjs.map +0 -1
- package/dist/production/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.js +0 -200
- package/dist/production/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.js.map +0 -1
- package/dist/types/mapper/DataManipulationBuilder.d.ts +0 -7
- package/dist/types/mapper/DataManipulationBuilder.d.ts.map +0 -1
- package/dist/types/mapper/relations/ManyHasManyInputProcessor.d.ts +0 -32
- package/dist/types/mapper/relations/ManyHasManyInputProcessor.d.ts.map +0 -1
- package/dist/types/mapper/relations/ManyHasOneInputProcessor.d.ts +0 -32
- package/dist/types/mapper/relations/ManyHasOneInputProcessor.d.ts.map +0 -1
- package/dist/types/mapper/relations/OneHasManyInputProcessor.d.ts +0 -29
- package/dist/types/mapper/relations/OneHasManyInputProcessor.d.ts.map +0 -1
- package/dist/types/mapper/relations/OneHasOneInverseCreateInputProcessor.d.ts +0 -21
- package/dist/types/mapper/relations/OneHasOneInverseCreateInputProcessor.d.ts.map +0 -1
- package/dist/types/mapper/relations/OneHasOneInverseUpdateInputProcessor.d.ts.map +0 -1
- package/dist/types/mapper/relations/OneHasOneOwningCreateInputProcessor.d.ts +0 -21
- package/dist/types/mapper/relations/OneHasOneOwningCreateInputProcessor.d.ts.map +0 -1
- package/dist/types/mapper/relations/OneHasOneOwningUpdateInputProcessor.d.ts.map +0 -1
- package/src/mapper/DataManipulationBuilder.ts +0 -12
- package/src/mapper/relations/ManyHasManyInputProcessor.ts +0 -108
- package/src/mapper/relations/ManyHasOneInputProcessor.ts +0 -158
- package/src/mapper/relations/OneHasManyInputProcessor.ts +0 -101
- package/src/mapper/relations/OneHasOneInverseCreateInputProcessor.ts +0 -99
- package/src/mapper/relations/OneHasOneOwningCreateInputProcessor.ts +0 -92
- package/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.ts +0 -253
|
@@ -5,14 +5,22 @@ const hasManyProcessor = (innerProcessor) => {
|
|
|
5
5
|
return async (context) => {
|
|
6
6
|
const { relation, index, alias } = context;
|
|
7
7
|
const path = [{ field: relation.name }, { index, alias }];
|
|
8
|
-
|
|
8
|
+
const innerResult = await innerProcessor(context);
|
|
9
|
+
if (typeof innerResult === "function") {
|
|
10
|
+
return async (it) => Result.prependPath(path, await innerResult(it));
|
|
11
|
+
}
|
|
12
|
+
return Result.prependPath(path, innerResult);
|
|
9
13
|
};
|
|
10
14
|
};
|
|
11
15
|
const hasOneProcessor = (innerProcessor) => {
|
|
12
16
|
return async (context) => {
|
|
13
17
|
const { relation } = context;
|
|
14
18
|
const path = [{ field: relation.name }];
|
|
15
|
-
|
|
19
|
+
const innerResult = await innerProcessor(context);
|
|
20
|
+
if (typeof innerResult === "function") {
|
|
21
|
+
return async (it) => Result.prependPath(path, await innerResult(it));
|
|
22
|
+
}
|
|
23
|
+
return Result.prependPath(path, innerResult);
|
|
16
24
|
};
|
|
17
25
|
};
|
|
18
26
|
exports.hasManyProcessor = hasManyProcessor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutationProcessorHelper.cjs","sources":["../../../../../packages/engine-content-api/src/mapper/MutationProcessorHelper.ts"],"sourcesContent":["import { MutationResultList, prependPath } from './Result'\nimport { Model } from '@contember/schema'\n\nexport const hasManyProcessor = <Context extends { relation: Model.AnyRelation; index: number; alias?: string }>(\n\tinnerProcessor: (context: Context) => Promise<MutationResultList>,\n) => {\n\treturn async (context: Context): Promise<MutationResultList> => {\n\t\tconst { relation, index, alias } = context\n\t\tconst path = [{ field: relation.name }, { index, alias }]\n\t\treturn prependPath(path, await
|
|
1
|
+
{"version":3,"file":"MutationProcessorHelper.cjs","sources":["../../../../../packages/engine-content-api/src/mapper/MutationProcessorHelper.ts"],"sourcesContent":["import { MutationResultList, prependPath } from './Result'\nimport { Model } from '@contember/schema'\n\nexport const hasManyProcessor = <Context extends { relation: Model.AnyRelation; index: number; alias?: string }, Args>(\n\tinnerProcessor: (context: Context) => Promise<MutationResultList | ((args: Args) => Promise<MutationResultList>)>,\n) => {\n\treturn async (context: Context): Promise<MutationResultList | ((args: Args) => Promise<MutationResultList>)> => {\n\t\tconst { relation, index, alias } = context\n\t\tconst path = [{ field: relation.name }, { index, alias }]\n\t\tconst innerResult = await innerProcessor(context)\n\t\tif (typeof innerResult === 'function') {\n\t\t\treturn async (it: Args) => prependPath(path, await innerResult(it))\n\t\t}\n\t\treturn prependPath(path, innerResult)\n\t}\n}\n\nexport const hasOneProcessor = <Context extends { relation: Model.AnyRelation }, Args>(\n\tinnerProcessor: (context: Context) => Promise<MutationResultList | ((args: Args) => Promise<MutationResultList>)>,\n) => {\n\treturn async (context: Context): Promise<MutationResultList | ((args: Args) => Promise<MutationResultList>)> => {\n\t\tconst { relation } = context\n\t\tconst path = [{ field: relation.name }]\n\t\tconst innerResult = await innerProcessor(context)\n\t\tif (typeof innerResult === 'function') {\n\t\t\treturn async (it: Args) => prependPath(path, await innerResult(it))\n\t\t}\n\t\treturn prependPath(path, innerResult)\n\t}\n}\n"],"names":["prependPath"],"mappings":";;;AAGa,MAAA,mBAAmB,CAC/B,mBACI;AACJ,SAAO,OAAO,YAAkG;AAC/G,UAAM,EAAE,UAAU,OAAO,MAAA,IAAU;AAC7B,UAAA,OAAO,CAAC,EAAE,OAAO,SAAS,QAAQ,EAAE,OAAO,MAAA,CAAO;AAClD,UAAA,cAAc,MAAM,eAAe,OAAO;AAC5C,QAAA,OAAO,gBAAgB,YAAY;AACtC,aAAO,OAAO,OAAaA,mBAAY,MAAM,MAAM,YAAY,EAAE,CAAC;AAAA,IACnE;AACO,WAAAA,OAAA,YAAY,MAAM,WAAW;AAAA,EAAA;AAEtC;AAEa,MAAA,kBAAkB,CAC9B,mBACI;AACJ,SAAO,OAAO,YAAkG;AACzG,UAAA,EAAE,SAAa,IAAA;AACrB,UAAM,OAAO,CAAC,EAAE,OAAO,SAAS,KAAM,CAAA;AAChC,UAAA,cAAc,MAAM,eAAe,OAAO;AAC5C,QAAA,OAAO,gBAAgB,YAAY;AACtC,aAAO,OAAO,OAAaA,mBAAY,MAAM,MAAM,YAAY,EAAE,CAAC;AAAA,IACnE;AACO,WAAAA,OAAA,YAAY,MAAM,WAAW;AAAA,EAAA;AAEtC;;;"}
|
|
@@ -3,14 +3,22 @@ const hasManyProcessor = (innerProcessor) => {
|
|
|
3
3
|
return async (context) => {
|
|
4
4
|
const { relation, index, alias } = context;
|
|
5
5
|
const path = [{ field: relation.name }, { index, alias }];
|
|
6
|
-
|
|
6
|
+
const innerResult = await innerProcessor(context);
|
|
7
|
+
if (typeof innerResult === "function") {
|
|
8
|
+
return async (it) => prependPath(path, await innerResult(it));
|
|
9
|
+
}
|
|
10
|
+
return prependPath(path, innerResult);
|
|
7
11
|
};
|
|
8
12
|
};
|
|
9
13
|
const hasOneProcessor = (innerProcessor) => {
|
|
10
14
|
return async (context) => {
|
|
11
15
|
const { relation } = context;
|
|
12
16
|
const path = [{ field: relation.name }];
|
|
13
|
-
|
|
17
|
+
const innerResult = await innerProcessor(context);
|
|
18
|
+
if (typeof innerResult === "function") {
|
|
19
|
+
return async (it) => prependPath(path, await innerResult(it));
|
|
20
|
+
}
|
|
21
|
+
return prependPath(path, innerResult);
|
|
14
22
|
};
|
|
15
23
|
};
|
|
16
24
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutationProcessorHelper.js","sources":["../../../../../packages/engine-content-api/src/mapper/MutationProcessorHelper.ts"],"sourcesContent":["import { MutationResultList, prependPath } from './Result'\nimport { Model } from '@contember/schema'\n\nexport const hasManyProcessor = <Context extends { relation: Model.AnyRelation; index: number; alias?: string }>(\n\tinnerProcessor: (context: Context) => Promise<MutationResultList>,\n) => {\n\treturn async (context: Context): Promise<MutationResultList> => {\n\t\tconst { relation, index, alias } = context\n\t\tconst path = [{ field: relation.name }, { index, alias }]\n\t\treturn prependPath(path, await
|
|
1
|
+
{"version":3,"file":"MutationProcessorHelper.js","sources":["../../../../../packages/engine-content-api/src/mapper/MutationProcessorHelper.ts"],"sourcesContent":["import { MutationResultList, prependPath } from './Result'\nimport { Model } from '@contember/schema'\n\nexport const hasManyProcessor = <Context extends { relation: Model.AnyRelation; index: number; alias?: string }, Args>(\n\tinnerProcessor: (context: Context) => Promise<MutationResultList | ((args: Args) => Promise<MutationResultList>)>,\n) => {\n\treturn async (context: Context): Promise<MutationResultList | ((args: Args) => Promise<MutationResultList>)> => {\n\t\tconst { relation, index, alias } = context\n\t\tconst path = [{ field: relation.name }, { index, alias }]\n\t\tconst innerResult = await innerProcessor(context)\n\t\tif (typeof innerResult === 'function') {\n\t\t\treturn async (it: Args) => prependPath(path, await innerResult(it))\n\t\t}\n\t\treturn prependPath(path, innerResult)\n\t}\n}\n\nexport const hasOneProcessor = <Context extends { relation: Model.AnyRelation }, Args>(\n\tinnerProcessor: (context: Context) => Promise<MutationResultList | ((args: Args) => Promise<MutationResultList>)>,\n) => {\n\treturn async (context: Context): Promise<MutationResultList | ((args: Args) => Promise<MutationResultList>)> => {\n\t\tconst { relation } = context\n\t\tconst path = [{ field: relation.name }]\n\t\tconst innerResult = await innerProcessor(context)\n\t\tif (typeof innerResult === 'function') {\n\t\t\treturn async (it: Args) => prependPath(path, await innerResult(it))\n\t\t}\n\t\treturn prependPath(path, innerResult)\n\t}\n}\n"],"names":[],"mappings":";AAGa,MAAA,mBAAmB,CAC/B,mBACI;AACJ,SAAO,OAAO,YAAkG;AAC/G,UAAM,EAAE,UAAU,OAAO,MAAA,IAAU;AAC7B,UAAA,OAAO,CAAC,EAAE,OAAO,SAAS,QAAQ,EAAE,OAAO,MAAA,CAAO;AAClD,UAAA,cAAc,MAAM,eAAe,OAAO;AAC5C,QAAA,OAAO,gBAAgB,YAAY;AACtC,aAAO,OAAO,OAAa,YAAY,MAAM,MAAM,YAAY,EAAE,CAAC;AAAA,IACnE;AACO,WAAA,YAAY,MAAM,WAAW;AAAA,EAAA;AAEtC;AAEa,MAAA,kBAAkB,CAC9B,mBACI;AACJ,SAAO,OAAO,YAAkG;AACzG,UAAA,EAAE,SAAa,IAAA;AACrB,UAAM,OAAO,CAAC,EAAE,OAAO,SAAS,KAAM,CAAA;AAChC,UAAA,cAAc,MAAM,eAAe,OAAO;AAC5C,QAAA,OAAO,gBAAgB,YAAY;AACtC,aAAO,OAAO,OAAa,YAAY,MAAM,MAAM,YAAY,EAAE,CAAC;AAAA,IACnE;AACO,WAAA,YAAY,MAAM,WAAW;AAAA,EAAA;AAEtC;"}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const ErrorUtils = require("./ErrorUtils.cjs");
|
|
4
|
-
const promises = require("../utils/promises.cjs");
|
|
5
|
-
require("@contember/schema-utils");
|
|
6
|
-
const Database = require("@contember/database");
|
|
7
|
-
const logger = require("@contember/logger");
|
|
8
3
|
var __defProp = Object.defineProperty;
|
|
9
4
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
5
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -32,6 +27,7 @@ class MutationUpdateOk {
|
|
|
32
27
|
this.input = input;
|
|
33
28
|
this.values = values;
|
|
34
29
|
this.oldValues = oldValues;
|
|
30
|
+
__publicField(this, "error", false);
|
|
35
31
|
__publicField(
|
|
36
32
|
this,
|
|
37
33
|
"result",
|
|
@@ -54,6 +50,7 @@ class MutationCreateOk {
|
|
|
54
50
|
this.primary = primary;
|
|
55
51
|
this.input = input;
|
|
56
52
|
this.values = values;
|
|
53
|
+
__publicField(this, "error", false);
|
|
57
54
|
__publicField(
|
|
58
55
|
this,
|
|
59
56
|
"result",
|
|
@@ -74,6 +71,7 @@ class MutationDeleteOk {
|
|
|
74
71
|
this.paths = paths;
|
|
75
72
|
this.entity = entity;
|
|
76
73
|
this.primary = primary;
|
|
74
|
+
__publicField(this, "error", false);
|
|
77
75
|
__publicField(
|
|
78
76
|
this,
|
|
79
77
|
"result",
|
|
@@ -96,6 +94,7 @@ class MutationJunctionUpdateOk {
|
|
|
96
94
|
this.relation = relation;
|
|
97
95
|
this.owningUnique = owningUnique;
|
|
98
96
|
this.inverseUnique = inverseUnique;
|
|
97
|
+
__publicField(this, "error", false);
|
|
99
98
|
__publicField(
|
|
100
99
|
this,
|
|
101
100
|
"result",
|
|
@@ -123,6 +122,7 @@ class MutationNothingToDo {
|
|
|
123
122
|
constructor(paths, reason) {
|
|
124
123
|
this.paths = paths;
|
|
125
124
|
this.reason = reason;
|
|
125
|
+
__publicField(this, "error", false);
|
|
126
126
|
__publicField(
|
|
127
127
|
this,
|
|
128
128
|
"result",
|
|
@@ -143,6 +143,7 @@ class MutationInputError {
|
|
|
143
143
|
this.kind = kind;
|
|
144
144
|
this.message = message;
|
|
145
145
|
this.hints = hints;
|
|
146
|
+
__publicField(this, "error", true);
|
|
146
147
|
__publicField(
|
|
147
148
|
this,
|
|
148
149
|
"result",
|
|
@@ -156,6 +157,7 @@ class MutationSqlError {
|
|
|
156
157
|
this.paths = paths;
|
|
157
158
|
this.message = message;
|
|
158
159
|
this.hints = hints;
|
|
160
|
+
__publicField(this, "error", true);
|
|
159
161
|
__publicField(
|
|
160
162
|
this,
|
|
161
163
|
"result",
|
|
@@ -176,6 +178,7 @@ class MutationConstraintViolationError {
|
|
|
176
178
|
this.constraint = constraint;
|
|
177
179
|
this.message = message;
|
|
178
180
|
this.hints = hints;
|
|
181
|
+
__publicField(this, "error", true);
|
|
179
182
|
__publicField(
|
|
180
183
|
this,
|
|
181
184
|
"result",
|
|
@@ -188,6 +191,7 @@ class MutationEntryNotFoundError {
|
|
|
188
191
|
constructor(paths, where) {
|
|
189
192
|
this.paths = paths;
|
|
190
193
|
this.where = where;
|
|
194
|
+
__publicField(this, "error", true);
|
|
191
195
|
__publicField(
|
|
192
196
|
this,
|
|
193
197
|
"result",
|
|
@@ -204,6 +208,7 @@ class MutationNoResultError {
|
|
|
204
208
|
this.paths = paths;
|
|
205
209
|
this.message = message;
|
|
206
210
|
this.hints = hints;
|
|
211
|
+
__publicField(this, "error", true);
|
|
207
212
|
__publicField(
|
|
208
213
|
this,
|
|
209
214
|
"result",
|
|
@@ -217,26 +222,6 @@ const prependPath = (path, results) => results.map((it) => ({
|
|
|
217
222
|
paths: (it.paths.length === 0 ? [[]] : it.paths).map((it2) => [...path, ...it2])
|
|
218
223
|
}));
|
|
219
224
|
const getInsertPrimary = (result) => result[0] && result[0].result === "ok" && result[0].type === "create" ? result[0].primary : void 0;
|
|
220
|
-
const flattenResult = (result) => result.reduce((acc, it) => [...acc, ...it], []).reduce((acc, it) => Array.isArray(it) ? [...acc, ...it] : [...acc, it], []);
|
|
221
|
-
const collectResults = async (schema, schemaDatabaseMetadata, mainPromise, otherPromises) => {
|
|
222
|
-
let index = 0;
|
|
223
|
-
const allPromises = [mainPromise, ...otherPromises].filter((it) => !!it).map(
|
|
224
|
-
(it) => it.catch((e) => [ErrorUtils.convertError(schema, schemaDatabaseMetadata, e)]).then((value) => ({ value, index: index++ }))
|
|
225
|
-
);
|
|
226
|
-
const results = await Promise.allSettled(allPromises);
|
|
227
|
-
const failures = promises.getRejections(results);
|
|
228
|
-
if (failures.length > 0) {
|
|
229
|
-
if (failures.length > 1 && !failures.every((it) => it instanceof Database.SerializationFailureError)) {
|
|
230
|
-
failures.slice(1).map((e) => logger.logger.error(e));
|
|
231
|
-
}
|
|
232
|
-
throw failures[0];
|
|
233
|
-
}
|
|
234
|
-
const values = promises.getFulfilledValues(results);
|
|
235
|
-
const sortedValues = [values[0], ...values.slice(1).sort((a, b) => a.index - b.index)];
|
|
236
|
-
return flattenResult(
|
|
237
|
-
sortedValues.map((it) => it.value).filter((it) => !!it)
|
|
238
|
-
);
|
|
239
|
-
};
|
|
240
225
|
exports.ConstraintType = ConstraintType;
|
|
241
226
|
exports.InputErrorKind = InputErrorKind;
|
|
242
227
|
exports.MutationConstraintViolationError = MutationConstraintViolationError;
|
|
@@ -252,8 +237,6 @@ exports.MutationResultType = MutationResultType;
|
|
|
252
237
|
exports.MutationSqlError = MutationSqlError;
|
|
253
238
|
exports.MutationUpdateOk = MutationUpdateOk;
|
|
254
239
|
exports.NothingToDoReason = NothingToDoReason;
|
|
255
|
-
exports.collectResults = collectResults;
|
|
256
|
-
exports.flattenResult = flattenResult;
|
|
257
240
|
exports.getInsertPrimary = getInsertPrimary;
|
|
258
241
|
exports.prependPath = prependPath;
|
|
259
242
|
//# sourceMappingURL=Result.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Result.cjs","sources":["../../../../../packages/engine-content-api/src/mapper/Result.ts"],"sourcesContent":["import { Input, Model, Value } from '@contember/schema'\nimport { convertError } from './ErrorUtils'\nimport { getFulfilledValues, getRejections } from '../utils'\nimport { DatabaseMetadata, SerializationFailureError } from '@contember/database'\nimport { logger } from '@contember/logger'\n\nexport enum MutationResultType {\n\tok = 'ok',\n\tnothingToDo = 'nothingToDo',\n\tnotFoundError = 'notFoundError',\n\tconstraintViolationError = 'constraintViolationError',\n\tnoResultError = 'noResultError',\n\tvalidationError = 'validationError',\n\tinputError = 'inputError',\n\tsqlError = 'sqlError',\n}\n\nexport enum MutationResultHint {\n\tsqlError = 'sqlError',\n\tsubSequentSqlError = 'subsequentSqlError',\n}\n\nexport enum ModificationType {\n\tcreate = 'create',\n\tupdate = 'update',\n\tdelete = 'delete',\n\tjunctionUpdate = 'junctionUpdate',\n}\n\nexport type MutationResult =\n\t| MutationUpdateOk\n\t| MutationCreateOk\n\t| MutationDeleteOk\n\t| MutationJunctionUpdateOk\n\t| MutationEntryNotFoundError\n\t| MutationNothingToDo\n\t| MutationConstraintViolationError\n\t| MutationNoResultError\n\t| MutationInputError\n\t| MutationSqlError\n\nexport type MutationResultList = MutationResult[]\n\ntype Path = ({ field: string } | { index: number; alias?: string })[]\n\ninterface MutationResultInterface {\n\tresult: MutationResultType\n\tpaths: Path[]\n\tmessage?: string\n\thints: MutationResultHint[]\n}\n\nexport type RowValues = { [fieldName: string]: Value.FieldValue }\n\nexport class MutationUpdateOk implements MutationResultInterface {\n\tresult = MutationResultType.ok as const\n\ttype = ModificationType.update as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly entity: Model.Entity,\n\t\tpublic readonly primary: Value.PrimaryValue,\n\t\tpublic readonly input: Input.UpdateDataInput,\n\t\tpublic readonly values: RowValues,\n\t\tpublic readonly oldValues?: RowValues,\n\t) {}\n}\n\nexport class MutationCreateOk implements MutationResultInterface {\n\tresult = MutationResultType.ok as const\n\ttype = ModificationType.create as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly entity: Model.Entity,\n\t\tpublic readonly primary: Value.PrimaryValue,\n\t\tpublic readonly input: Input.CreateDataInput,\n\t\tpublic readonly values: RowValues,\n\t) {}\n}\n\nexport class MutationDeleteOk implements MutationResultInterface {\n\tresult = MutationResultType.ok as const\n\ttype = ModificationType.delete as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly entity: Model.Entity,\n\t\tpublic readonly primary: Value.PrimaryValue,\n\t) {}\n}\n\nexport class MutationJunctionUpdateOk implements MutationResultInterface {\n\tresult = MutationResultType.ok as const\n\ttype = ModificationType.junctionUpdate as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly entity: Model.Entity,\n\t\tpublic readonly relation: Model.ManyHasManyOwningRelation,\n\t\tpublic readonly owningUnique: Input.PrimaryValue,\n\t\tpublic readonly inverseUnique: Input.PrimaryValue,\n\t) {}\n}\n\nexport enum NothingToDoReason {\n\tnoData = 'noData',\n\temptyRelation = 'emptyRelation',\n\talreadyExists = 'alreadyExists',\n\taborted = 'aborted',\n\talreadyDeleted = 'alreadyDeleted',\n}\n\nexport class MutationNothingToDo implements MutationResultInterface {\n\tresult = MutationResultType.nothingToDo as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(public readonly paths: Path[], public readonly reason: NothingToDoReason) {}\n}\n\nexport enum InputErrorKind {\n\tnonUniqueWhere = 'nonUniqueWhere',\n\tinvalidData = 'invalidData',\n}\n\nexport class MutationInputError implements MutationResultInterface {\n\tresult = MutationResultType.inputError as const\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly kind: InputErrorKind,\n\t\tpublic readonly message?: string,\n\t\tpublic readonly hints: MutationResultHint[] = [],\n\t) {}\n}\n\nexport class MutationSqlError implements MutationResultInterface {\n\tresult = MutationResultType.sqlError as const\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly message?: string,\n\t\tpublic readonly hints: MutationResultHint[] = [],\n\t) {}\n}\n\nexport enum ConstraintType {\n\tnotNull = 'notNull',\n\tuniqueKey = 'uniqueKey',\n\tforeignKey = 'foreignKey',\n}\n\nexport class MutationConstraintViolationError implements MutationResultInterface {\n\tresult = MutationResultType.constraintViolationError as const\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly constraint: ConstraintType,\n\t\tpublic readonly message?: string,\n\t\tpublic readonly hints: MutationResultHint[] = [],\n\t) {}\n}\n\n// maybe denied by acl\nexport class MutationEntryNotFoundError implements MutationResultInterface {\n\tresult = MutationResultType.notFoundError as const\n\thints: MutationResultHint[] = []\n\tmessage: string\n\n\tconstructor(public readonly paths: Path[], public readonly where: Input.UniqueWhere | Input.Where) {\n\t\tthis.message = 'for input ' + JSON.stringify(where)\n\t}\n}\n\n// possibly denied by acl\nexport class MutationNoResultError implements MutationResultInterface {\n\tresult = MutationResultType.noResultError as const\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly message?: string,\n\t\tpublic readonly hints: MutationResultHint[] = [],\n\t) {}\n}\n\nexport const prependPath = (path: Path, results: MutationResultList): MutationResultList =>\n\tresults.map(it => ({\n\t\t...it,\n\t\tpaths: (it.paths.length === 0 ? [[]] : it.paths).map(it => [...path, ...it]),\n\t}))\n\nexport const getInsertPrimary = (result: MutationResultList) =>\n\tresult[0] && result[0].result === MutationResultType.ok && result[0].type === ModificationType.create\n\t\t? result[0].primary\n\t\t: undefined\n\nexport const getUpdatePrimary = (result: MutationResultList) =>\n\tresult[0] && result[0].result === MutationResultType.ok && result[0].type === ModificationType.update\n\t\t? result[0].primary\n\t\t: undefined\n\nexport const flattenResult = (result: (MutationResultList | MutationResultList[])[]): MutationResultList =>\n\tresult\n\t\t.reduce<(MutationResult | MutationResult[])[]>((acc, it) => [...acc, ...it], [])\n\t\t.reduce<MutationResultList>((acc, it) => (Array.isArray(it) ? [...acc, ...it] : [...acc, it]), [])\n\nexport type ResultListNotFlatten = MutationResultList | MutationResultList[]\n\nexport const collectResults = async (\n\tschema: Model.Schema,\n\tschemaDatabaseMetadata: DatabaseMetadata,\n\tmainPromise: Promise<ResultListNotFlatten | undefined> | undefined,\n\totherPromises: (Promise<ResultListNotFlatten | undefined> | undefined)[],\n): Promise<MutationResultList> => {\n\tlet index = 0\n\tconst allPromises: Promise<{ index: number; value: ResultListNotFlatten }>[] = [mainPromise, ...otherPromises]\n\t\t.filter((it): it is Promise<ResultListNotFlatten> => !!it)\n\t\t.map(it =>\n\t\t\tit //\n\t\t\t\t.catch(e => [convertError(schema, schemaDatabaseMetadata, e)])\n\t\t\t\t.then(value => ({ value, index: index++ })),\n\t\t)\n\tconst results = await Promise.allSettled(allPromises)\n\tconst failures = getRejections(results)\n\tif (failures.length > 0) {\n\t\tif (failures.length > 1 && !failures.every(it => it instanceof SerializationFailureError)) {\n\t\t\tfailures.slice(1).map(e => logger.error(e))\n\t\t}\n\t\tthrow failures[0]\n\t}\n\n\tconst values = getFulfilledValues(results)\n\tconst sortedValues = [values[0], ...values.slice(1).sort((a, b) => a.index - b.index)]\n\n\treturn flattenResult(\n\t\tsortedValues.map(it => it.value).filter((it): it is MutationResultList | MutationResultList[] => !!it),\n\t)\n}\n"],"names":["MutationResultType","MutationResultHint","NothingToDoReason","InputErrorKind","ConstraintType","it","convertError","getRejections","SerializationFailureError","logger","getFulfilledValues"],"mappings":";;;;;;;;;;AAMY,IAAA,uCAAAA,wBAAL;AACNA,sBAAA,IAAK,IAAA;AACLA,sBAAA,aAAc,IAAA;AACdA,sBAAA,eAAgB,IAAA;AAChBA,sBAAA,0BAA2B,IAAA;AAC3BA,sBAAA,eAAgB,IAAA;AAChBA,sBAAA,iBAAkB,IAAA;AAClBA,sBAAA,YAAa,IAAA;AACbA,sBAAA,UAAW,IAAA;AARAA,SAAAA;AAAA,GAAA,sBAAA,CAAA,CAAA;AAWA,IAAA,uCAAAC,wBAAL;AACNA,sBAAA,UAAW,IAAA;AACXA,sBAAA,oBAAqB,IAAA;AAFVA,SAAAA;AAAA,GAAA,sBAAA,CAAA,CAAA;AAqCL,MAAM,iBAAoD;AAAA,EAKh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AC,EAAE,EACxD;AAAA,IAAI,QACJ,GACE,MAAM,OAAK,CAACC,WAAA,aAAa,QAAQ,wBAAwB,CAAC,CAAC,CAAC,EAC5D,KAAK,CAAA,WAAU,EAAE,OAAO,OAAO,UAAU;AAAA,EAAA;AAE7C,QAAM,UAAU,MAAM,QAAQ,WAAW,WAAW;AAC9C,QAAA,WAAWC,uBAAc,OAAO;AAClC,MAAA,SAAS,SAAS,GAAG;AACpB,QAAA,SAAS,SAAS,KAAK,CAAC,SAAS,MAAM,CAAA,OAAM,cAAcC,SAAAA,yBAAyB,GAAG;AACjF,eAAA,MAAM,CAAC,EAAE,IAAI,OAAKC,cAAO,MAAM,CAAC,CAAC;AAAA,IAC3C;AACA,UAAM,SAAS,CAAC;AAAA,EACjB;AAEM,QAAA,SAASC,4BAAmB,OAAO;AACzC,QAAM,eAAe,CAAC,OAAO,CAAC,GAAG,GAAG,OAAO,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC;AAE9E,SAAA;AAAA,IACN,aAAa,IAAI,CAAA,OAAM,GAAG,KAAK,EAAE,OAAO,CAAC,OAAwD,CAAC,CAAC,EAAE;AAAA,EAAA;AAEvG;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Result.cjs","sources":["../../../../../packages/engine-content-api/src/mapper/Result.ts"],"sourcesContent":["import { Input, Model, Value } from '@contember/schema'\n\nexport enum MutationResultType {\n\tok = 'ok',\n\tnothingToDo = 'nothingToDo',\n\tnotFoundError = 'notFoundError',\n\tconstraintViolationError = 'constraintViolationError',\n\tnoResultError = 'noResultError',\n\tvalidationError = 'validationError',\n\tinputError = 'inputError',\n\tsqlError = 'sqlError',\n}\n\nexport enum MutationResultHint {\n\tsqlError = 'sqlError',\n\tsubSequentSqlError = 'subsequentSqlError',\n}\n\nexport enum ModificationType {\n\tcreate = 'create',\n\tupdate = 'update',\n\tdelete = 'delete',\n\tjunctionUpdate = 'junctionUpdate',\n}\n\nexport type MutationResult =\n\t| MutationUpdateOk\n\t| MutationCreateOk\n\t| MutationDeleteOk\n\t| MutationJunctionUpdateOk\n\t| MutationEntryNotFoundError\n\t| MutationNothingToDo\n\t| MutationConstraintViolationError\n\t| MutationNoResultError\n\t| MutationInputError\n\t| MutationSqlError\n\nexport type MutationResultList = MutationResult[]\n\ntype Path = ({ field: string } | { index: number; alias?: string })[]\n\ninterface MutationResultInterface {\n\terror: boolean\n\tresult: MutationResultType\n\tpaths: Path[]\n\tmessage?: string\n\thints: MutationResultHint[]\n}\n\nexport type RowValues = { [fieldName: string]: Value.FieldValue }\n\nexport class MutationUpdateOk implements MutationResultInterface {\n\terror = false\n\tresult = MutationResultType.ok as const\n\ttype = ModificationType.update as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly entity: Model.Entity,\n\t\tpublic readonly primary: Value.PrimaryValue,\n\t\tpublic readonly input: Input.UpdateDataInput,\n\t\tpublic readonly values: RowValues,\n\t\tpublic readonly oldValues?: RowValues,\n\t) {}\n}\n\nexport class MutationCreateOk implements MutationResultInterface {\n\terror = false\n\tresult = MutationResultType.ok as const\n\ttype = ModificationType.create as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly entity: Model.Entity,\n\t\tpublic readonly primary: Value.PrimaryValue,\n\t\tpublic readonly input: Input.CreateDataInput,\n\t\tpublic readonly values: RowValues,\n\t) {}\n}\n\nexport class MutationDeleteOk implements MutationResultInterface {\n\terror = false\n\tresult = MutationResultType.ok as const\n\ttype = ModificationType.delete as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly entity: Model.Entity,\n\t\tpublic readonly primary: Value.PrimaryValue,\n\t) {}\n}\n\nexport class MutationJunctionUpdateOk implements MutationResultInterface {\n\terror = false\n\tresult = MutationResultType.ok as const\n\ttype = ModificationType.junctionUpdate as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly entity: Model.Entity,\n\t\tpublic readonly relation: Model.ManyHasManyOwningRelation,\n\t\tpublic readonly owningUnique: Input.PrimaryValue,\n\t\tpublic readonly inverseUnique: Input.PrimaryValue,\n\t) {}\n}\n\nexport enum NothingToDoReason {\n\tnoData = 'noData',\n\temptyRelation = 'emptyRelation',\n\talreadyExists = 'alreadyExists',\n\taborted = 'aborted',\n\talreadyDeleted = 'alreadyDeleted',\n}\n\nexport class MutationNothingToDo implements MutationResultInterface {\n\terror = false\n\tresult = MutationResultType.nothingToDo as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(public readonly paths: Path[], public readonly reason: NothingToDoReason) {}\n}\n\nexport enum InputErrorKind {\n\tnonUniqueWhere = 'nonUniqueWhere',\n\tinvalidData = 'invalidData',\n}\n\nexport class MutationInputError implements MutationResultInterface {\n\terror = true\n\tresult = MutationResultType.inputError as const\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly kind: InputErrorKind,\n\t\tpublic readonly message?: string,\n\t\tpublic readonly hints: MutationResultHint[] = [],\n\t) {}\n}\n\nexport class MutationSqlError implements MutationResultInterface {\n\terror = true\n\tresult = MutationResultType.sqlError as const\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly message?: string,\n\t\tpublic readonly hints: MutationResultHint[] = [],\n\t) {}\n}\n\nexport enum ConstraintType {\n\tnotNull = 'notNull',\n\tuniqueKey = 'uniqueKey',\n\tforeignKey = 'foreignKey',\n}\n\nexport class MutationConstraintViolationError implements MutationResultInterface {\n\terror = true\n\tresult = MutationResultType.constraintViolationError as const\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly constraint: ConstraintType,\n\t\tpublic readonly message?: string,\n\t\tpublic readonly hints: MutationResultHint[] = [],\n\t) {}\n}\n\n// maybe denied by acl\nexport class MutationEntryNotFoundError implements MutationResultInterface {\n\terror = true\n\tresult = MutationResultType.notFoundError as const\n\thints: MutationResultHint[] = []\n\tmessage: string\n\n\tconstructor(public readonly paths: Path[], public readonly where: Input.UniqueWhere | Input.Where) {\n\t\tthis.message = 'for input ' + JSON.stringify(where)\n\t}\n}\n\n// possibly denied by acl\nexport class MutationNoResultError implements MutationResultInterface {\n\terror = true\n\tresult = MutationResultType.noResultError as const\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly message?: string,\n\t\tpublic readonly hints: MutationResultHint[] = [],\n\t) {}\n}\n\nexport const prependPath = (path: Path, results: MutationResultList): MutationResultList =>\n\tresults.map(it => ({\n\t\t...it,\n\t\tpaths: (it.paths.length === 0 ? [[]] : it.paths).map(it => [...path, ...it]),\n\t}))\n\nexport const getInsertPrimary = (result: MutationResultList) =>\n\tresult[0] && result[0].result === MutationResultType.ok && result[0].type === ModificationType.create\n\t\t? result[0].primary\n\t\t: undefined\n"],"names":["MutationResultType","MutationResultHint","NothingToDoReason","InputErrorKind","ConstraintType","it"],"mappings":";;;;;AAEY,IAAA,uCAAAA,wBAAL;AACNA,sBAAA,IAAK,IAAA;AACLA,sBAAA,aAAc,IAAA;AACdA,sBAAA,eAAgB,IAAA;AAChBA,sBAAA,0BAA2B,IAAA;AAC3BA,sBAAA,eAAgB,IAAA;AAChBA,sBAAA,iBAAkB,IAAA;AAClBA,sBAAA,YAAa,IAAA;AACbA,sBAAA,UAAW,IAAA;AARAA,SAAAA;AAAA,GAAA,sBAAA,CAAA,CAAA;AAWA,IAAA,uCAAAC,wBAAL;AACNA,sBAAA,UAAW,IAAA;AACXA,sBAAA,oBAAqB,IAAA;AAFVA,SAAAA;AAAA,GAAA,sBAAA,CAAA,CAAA;AAsCL,MAAM,iBAAoD;AAAA,EAMhE,YACiB,OACA,QACA,SACA,OACA,QACA,WACf;AANe,SAAA,QAAA;AACA,SAAA,SAAA;AACA,SAAA,UAAA;AACA,SAAA,QAAA;AACA,SAAA,SAAA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,SAAA,aAAA;AACA,SAAA,UAAA;AACA,SAAA,QAAA;AAPT,kBAAA,MAAA,SAAA,IAAA;AACC;AAAA,MAAA;AAAA,MAAA;AAAA,MAAA;AAAA;AAAA;EAON;AACJ;AAGO,MAAM,2BAA8D;AAAA,EAM1E,YAA4B,OAA+B,OAAwC;AAAvE,SAAA,QAAA;AAA+B,SAAA,QAAA;AALnD,kBAAA,MAAA,SAAA,IAAA;AACC;AAAA,MAAA;AAAA,MAAA;AAAA,MAAA;AAAA;AAAA;AACT,kBAAA,MAAA,SAA8B,CAAA,CAAC;AAC/B,kBAAA,MAAA,SAAA;AAGC,SAAK,UAAU,eAAe,KAAK,UAAU,KAAK;AAAA,EACnD;AACD;AAGO,MAAM,sBAAyD;AAAA,EAIrE,YACiB,OACA,SACA,QAA8B,CAAA,GAC7C;AAHe,SAAA,QAAA;AACA,SAAA,UAAA;AACA,SAAA,QAAA;AANT,kBAAA,MAAA,SAAA,IAAA;AACC;AAAA,MAAA;AAAA,MAAA;AAAA,MAAA;AAAA;AAAA;EAMN;AACJ;AAEO,MAAM,cAAc,CAAC,MAAY,YACvC,QAAQ,IAAI,CAAO,QAAA;AAAA,EAClB,GAAG;AAAA,EACH,QAAQ,GAAG,MAAM,WAAW,IAAI,CAAC,EAAE,IAAI,GAAG,OAAO,IAAI,CAAAC,QAAM,CAAC,GAAG,MAAM,GAAGA,GAAE,CAAC;AAC5E,EAAE;AAEI,MAAM,mBAAmB,CAAC,WAChC,OAAO,CAAC,KAAK,OAAO,CAAC,EAAE,WAAW,QAAyB,OAAO,CAAC,EAAE,SAAS,WAC3E,OAAO,CAAC,EAAE,UACV;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import { convertError } from "./ErrorUtils.js";
|
|
2
|
-
import { getRejections, getFulfilledValues } from "../utils/promises.js";
|
|
3
|
-
import "@contember/schema-utils";
|
|
4
|
-
import { SerializationFailureError } from "@contember/database";
|
|
5
|
-
import { logger } from "@contember/logger";
|
|
6
1
|
var __defProp = Object.defineProperty;
|
|
7
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -30,6 +25,7 @@ class MutationUpdateOk {
|
|
|
30
25
|
this.input = input;
|
|
31
26
|
this.values = values;
|
|
32
27
|
this.oldValues = oldValues;
|
|
28
|
+
__publicField(this, "error", false);
|
|
33
29
|
__publicField(
|
|
34
30
|
this,
|
|
35
31
|
"result",
|
|
@@ -52,6 +48,7 @@ class MutationCreateOk {
|
|
|
52
48
|
this.primary = primary;
|
|
53
49
|
this.input = input;
|
|
54
50
|
this.values = values;
|
|
51
|
+
__publicField(this, "error", false);
|
|
55
52
|
__publicField(
|
|
56
53
|
this,
|
|
57
54
|
"result",
|
|
@@ -72,6 +69,7 @@ class MutationDeleteOk {
|
|
|
72
69
|
this.paths = paths;
|
|
73
70
|
this.entity = entity;
|
|
74
71
|
this.primary = primary;
|
|
72
|
+
__publicField(this, "error", false);
|
|
75
73
|
__publicField(
|
|
76
74
|
this,
|
|
77
75
|
"result",
|
|
@@ -94,6 +92,7 @@ class MutationJunctionUpdateOk {
|
|
|
94
92
|
this.relation = relation;
|
|
95
93
|
this.owningUnique = owningUnique;
|
|
96
94
|
this.inverseUnique = inverseUnique;
|
|
95
|
+
__publicField(this, "error", false);
|
|
97
96
|
__publicField(
|
|
98
97
|
this,
|
|
99
98
|
"result",
|
|
@@ -121,6 +120,7 @@ class MutationNothingToDo {
|
|
|
121
120
|
constructor(paths, reason) {
|
|
122
121
|
this.paths = paths;
|
|
123
122
|
this.reason = reason;
|
|
123
|
+
__publicField(this, "error", false);
|
|
124
124
|
__publicField(
|
|
125
125
|
this,
|
|
126
126
|
"result",
|
|
@@ -141,6 +141,7 @@ class MutationInputError {
|
|
|
141
141
|
this.kind = kind;
|
|
142
142
|
this.message = message;
|
|
143
143
|
this.hints = hints;
|
|
144
|
+
__publicField(this, "error", true);
|
|
144
145
|
__publicField(
|
|
145
146
|
this,
|
|
146
147
|
"result",
|
|
@@ -154,6 +155,7 @@ class MutationSqlError {
|
|
|
154
155
|
this.paths = paths;
|
|
155
156
|
this.message = message;
|
|
156
157
|
this.hints = hints;
|
|
158
|
+
__publicField(this, "error", true);
|
|
157
159
|
__publicField(
|
|
158
160
|
this,
|
|
159
161
|
"result",
|
|
@@ -174,6 +176,7 @@ class MutationConstraintViolationError {
|
|
|
174
176
|
this.constraint = constraint;
|
|
175
177
|
this.message = message;
|
|
176
178
|
this.hints = hints;
|
|
179
|
+
__publicField(this, "error", true);
|
|
177
180
|
__publicField(
|
|
178
181
|
this,
|
|
179
182
|
"result",
|
|
@@ -186,6 +189,7 @@ class MutationEntryNotFoundError {
|
|
|
186
189
|
constructor(paths, where) {
|
|
187
190
|
this.paths = paths;
|
|
188
191
|
this.where = where;
|
|
192
|
+
__publicField(this, "error", true);
|
|
189
193
|
__publicField(
|
|
190
194
|
this,
|
|
191
195
|
"result",
|
|
@@ -202,6 +206,7 @@ class MutationNoResultError {
|
|
|
202
206
|
this.paths = paths;
|
|
203
207
|
this.message = message;
|
|
204
208
|
this.hints = hints;
|
|
209
|
+
__publicField(this, "error", true);
|
|
205
210
|
__publicField(
|
|
206
211
|
this,
|
|
207
212
|
"result",
|
|
@@ -215,26 +220,6 @@ const prependPath = (path, results) => results.map((it) => ({
|
|
|
215
220
|
paths: (it.paths.length === 0 ? [[]] : it.paths).map((it2) => [...path, ...it2])
|
|
216
221
|
}));
|
|
217
222
|
const getInsertPrimary = (result) => result[0] && result[0].result === "ok" && result[0].type === "create" ? result[0].primary : void 0;
|
|
218
|
-
const flattenResult = (result) => result.reduce((acc, it) => [...acc, ...it], []).reduce((acc, it) => Array.isArray(it) ? [...acc, ...it] : [...acc, it], []);
|
|
219
|
-
const collectResults = async (schema, schemaDatabaseMetadata, mainPromise, otherPromises) => {
|
|
220
|
-
let index = 0;
|
|
221
|
-
const allPromises = [mainPromise, ...otherPromises].filter((it) => !!it).map(
|
|
222
|
-
(it) => it.catch((e) => [convertError(schema, schemaDatabaseMetadata, e)]).then((value) => ({ value, index: index++ }))
|
|
223
|
-
);
|
|
224
|
-
const results = await Promise.allSettled(allPromises);
|
|
225
|
-
const failures = getRejections(results);
|
|
226
|
-
if (failures.length > 0) {
|
|
227
|
-
if (failures.length > 1 && !failures.every((it) => it instanceof SerializationFailureError)) {
|
|
228
|
-
failures.slice(1).map((e) => logger.error(e));
|
|
229
|
-
}
|
|
230
|
-
throw failures[0];
|
|
231
|
-
}
|
|
232
|
-
const values = getFulfilledValues(results);
|
|
233
|
-
const sortedValues = [values[0], ...values.slice(1).sort((a, b) => a.index - b.index)];
|
|
234
|
-
return flattenResult(
|
|
235
|
-
sortedValues.map((it) => it.value).filter((it) => !!it)
|
|
236
|
-
);
|
|
237
|
-
};
|
|
238
223
|
export {
|
|
239
224
|
ConstraintType,
|
|
240
225
|
InputErrorKind,
|
|
@@ -251,8 +236,6 @@ export {
|
|
|
251
236
|
MutationSqlError,
|
|
252
237
|
MutationUpdateOk,
|
|
253
238
|
NothingToDoReason,
|
|
254
|
-
collectResults,
|
|
255
|
-
flattenResult,
|
|
256
239
|
getInsertPrimary,
|
|
257
240
|
prependPath
|
|
258
241
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Result.js","sources":["../../../../../packages/engine-content-api/src/mapper/Result.ts"],"sourcesContent":["import { Input, Model, Value } from '@contember/schema'\nimport { convertError } from './ErrorUtils'\nimport { getFulfilledValues, getRejections } from '../utils'\nimport { DatabaseMetadata, SerializationFailureError } from '@contember/database'\nimport { logger } from '@contember/logger'\n\nexport enum MutationResultType {\n\tok = 'ok',\n\tnothingToDo = 'nothingToDo',\n\tnotFoundError = 'notFoundError',\n\tconstraintViolationError = 'constraintViolationError',\n\tnoResultError = 'noResultError',\n\tvalidationError = 'validationError',\n\tinputError = 'inputError',\n\tsqlError = 'sqlError',\n}\n\nexport enum MutationResultHint {\n\tsqlError = 'sqlError',\n\tsubSequentSqlError = 'subsequentSqlError',\n}\n\nexport enum ModificationType {\n\tcreate = 'create',\n\tupdate = 'update',\n\tdelete = 'delete',\n\tjunctionUpdate = 'junctionUpdate',\n}\n\nexport type MutationResult =\n\t| MutationUpdateOk\n\t| MutationCreateOk\n\t| MutationDeleteOk\n\t| MutationJunctionUpdateOk\n\t| MutationEntryNotFoundError\n\t| MutationNothingToDo\n\t| MutationConstraintViolationError\n\t| MutationNoResultError\n\t| MutationInputError\n\t| MutationSqlError\n\nexport type MutationResultList = MutationResult[]\n\ntype Path = ({ field: string } | { index: number; alias?: string })[]\n\ninterface MutationResultInterface {\n\tresult: MutationResultType\n\tpaths: Path[]\n\tmessage?: string\n\thints: MutationResultHint[]\n}\n\nexport type RowValues = { [fieldName: string]: Value.FieldValue }\n\nexport class MutationUpdateOk implements MutationResultInterface {\n\tresult = MutationResultType.ok as const\n\ttype = ModificationType.update as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly entity: Model.Entity,\n\t\tpublic readonly primary: Value.PrimaryValue,\n\t\tpublic readonly input: Input.UpdateDataInput,\n\t\tpublic readonly values: RowValues,\n\t\tpublic readonly oldValues?: RowValues,\n\t) {}\n}\n\nexport class MutationCreateOk implements MutationResultInterface {\n\tresult = MutationResultType.ok as const\n\ttype = ModificationType.create as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly entity: Model.Entity,\n\t\tpublic readonly primary: Value.PrimaryValue,\n\t\tpublic readonly input: Input.CreateDataInput,\n\t\tpublic readonly values: RowValues,\n\t) {}\n}\n\nexport class MutationDeleteOk implements MutationResultInterface {\n\tresult = MutationResultType.ok as const\n\ttype = ModificationType.delete as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly entity: Model.Entity,\n\t\tpublic readonly primary: Value.PrimaryValue,\n\t) {}\n}\n\nexport class MutationJunctionUpdateOk implements MutationResultInterface {\n\tresult = MutationResultType.ok as const\n\ttype = ModificationType.junctionUpdate as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly entity: Model.Entity,\n\t\tpublic readonly relation: Model.ManyHasManyOwningRelation,\n\t\tpublic readonly owningUnique: Input.PrimaryValue,\n\t\tpublic readonly inverseUnique: Input.PrimaryValue,\n\t) {}\n}\n\nexport enum NothingToDoReason {\n\tnoData = 'noData',\n\temptyRelation = 'emptyRelation',\n\talreadyExists = 'alreadyExists',\n\taborted = 'aborted',\n\talreadyDeleted = 'alreadyDeleted',\n}\n\nexport class MutationNothingToDo implements MutationResultInterface {\n\tresult = MutationResultType.nothingToDo as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(public readonly paths: Path[], public readonly reason: NothingToDoReason) {}\n}\n\nexport enum InputErrorKind {\n\tnonUniqueWhere = 'nonUniqueWhere',\n\tinvalidData = 'invalidData',\n}\n\nexport class MutationInputError implements MutationResultInterface {\n\tresult = MutationResultType.inputError as const\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly kind: InputErrorKind,\n\t\tpublic readonly message?: string,\n\t\tpublic readonly hints: MutationResultHint[] = [],\n\t) {}\n}\n\nexport class MutationSqlError implements MutationResultInterface {\n\tresult = MutationResultType.sqlError as const\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly message?: string,\n\t\tpublic readonly hints: MutationResultHint[] = [],\n\t) {}\n}\n\nexport enum ConstraintType {\n\tnotNull = 'notNull',\n\tuniqueKey = 'uniqueKey',\n\tforeignKey = 'foreignKey',\n}\n\nexport class MutationConstraintViolationError implements MutationResultInterface {\n\tresult = MutationResultType.constraintViolationError as const\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly constraint: ConstraintType,\n\t\tpublic readonly message?: string,\n\t\tpublic readonly hints: MutationResultHint[] = [],\n\t) {}\n}\n\n// maybe denied by acl\nexport class MutationEntryNotFoundError implements MutationResultInterface {\n\tresult = MutationResultType.notFoundError as const\n\thints: MutationResultHint[] = []\n\tmessage: string\n\n\tconstructor(public readonly paths: Path[], public readonly where: Input.UniqueWhere | Input.Where) {\n\t\tthis.message = 'for input ' + JSON.stringify(where)\n\t}\n}\n\n// possibly denied by acl\nexport class MutationNoResultError implements MutationResultInterface {\n\tresult = MutationResultType.noResultError as const\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly message?: string,\n\t\tpublic readonly hints: MutationResultHint[] = [],\n\t) {}\n}\n\nexport const prependPath = (path: Path, results: MutationResultList): MutationResultList =>\n\tresults.map(it => ({\n\t\t...it,\n\t\tpaths: (it.paths.length === 0 ? [[]] : it.paths).map(it => [...path, ...it]),\n\t}))\n\nexport const getInsertPrimary = (result: MutationResultList) =>\n\tresult[0] && result[0].result === MutationResultType.ok && result[0].type === ModificationType.create\n\t\t? result[0].primary\n\t\t: undefined\n\nexport const getUpdatePrimary = (result: MutationResultList) =>\n\tresult[0] && result[0].result === MutationResultType.ok && result[0].type === ModificationType.update\n\t\t? result[0].primary\n\t\t: undefined\n\nexport const flattenResult = (result: (MutationResultList | MutationResultList[])[]): MutationResultList =>\n\tresult\n\t\t.reduce<(MutationResult | MutationResult[])[]>((acc, it) => [...acc, ...it], [])\n\t\t.reduce<MutationResultList>((acc, it) => (Array.isArray(it) ? [...acc, ...it] : [...acc, it]), [])\n\nexport type ResultListNotFlatten = MutationResultList | MutationResultList[]\n\nexport const collectResults = async (\n\tschema: Model.Schema,\n\tschemaDatabaseMetadata: DatabaseMetadata,\n\tmainPromise: Promise<ResultListNotFlatten | undefined> | undefined,\n\totherPromises: (Promise<ResultListNotFlatten | undefined> | undefined)[],\n): Promise<MutationResultList> => {\n\tlet index = 0\n\tconst allPromises: Promise<{ index: number; value: ResultListNotFlatten }>[] = [mainPromise, ...otherPromises]\n\t\t.filter((it): it is Promise<ResultListNotFlatten> => !!it)\n\t\t.map(it =>\n\t\t\tit //\n\t\t\t\t.catch(e => [convertError(schema, schemaDatabaseMetadata, e)])\n\t\t\t\t.then(value => ({ value, index: index++ })),\n\t\t)\n\tconst results = await Promise.allSettled(allPromises)\n\tconst failures = getRejections(results)\n\tif (failures.length > 0) {\n\t\tif (failures.length > 1 && !failures.every(it => it instanceof SerializationFailureError)) {\n\t\t\tfailures.slice(1).map(e => logger.error(e))\n\t\t}\n\t\tthrow failures[0]\n\t}\n\n\tconst values = getFulfilledValues(results)\n\tconst sortedValues = [values[0], ...values.slice(1).sort((a, b) => a.index - b.index)]\n\n\treturn flattenResult(\n\t\tsortedValues.map(it => it.value).filter((it): it is MutationResultList | MutationResultList[] => !!it),\n\t)\n}\n"],"names":["MutationResultType","MutationResultHint","NothingToDoReason","InputErrorKind","ConstraintType","it"],"mappings":";;;;;;;;AAMY,IAAA,uCAAAA,wBAAL;AACNA,sBAAA,IAAK,IAAA;AACLA,sBAAA,aAAc,IAAA;AACdA,sBAAA,eAAgB,IAAA;AAChBA,sBAAA,0BAA2B,IAAA;AAC3BA,sBAAA,eAAgB,IAAA;AAChBA,sBAAA,iBAAkB,IAAA;AAClBA,sBAAA,YAAa,IAAA;AACbA,sBAAA,UAAW,IAAA;AARAA,SAAAA;AAAA,GAAA,sBAAA,CAAA,CAAA;AAWA,IAAA,uCAAAC,wBAAL;AACNA,sBAAA,UAAW,IAAA;AACXA,sBAAA,oBAAqB,IAAA;AAFVA,SAAAA;AAAA,GAAA,sBAAA,CAAA,CAAA;AAqCL,MAAM,iBAAoD;AAAA,EAKhE,YACiB,OACA,QACA,SACA,OACA,QACA,WACf;AANe,SAAA,QAAA;AACA,SAAA,SAAA;AACA,SAAA,UAAA;AACA,SAAA,QAAA;AACA,SAAA,SAAA;AACA,SAAA,YAAA;AAVR;AAAA,MAAA;AAAA,MAAA;AAAA,MA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MAAM,QAAQ,WAAW,WAAW;AAC9C,QAAA,WAAW,cAAc,OAAO;AAClC,MAAA,SAAS,SAAS,GAAG;AACpB,QAAA,SAAS,SAAS,KAAK,CAAC,SAAS,MAAM,CAAA,OAAM,cAAc,yBAAyB,GAAG;AACjF,eAAA,MAAM,CAAC,EAAE,IAAI,OAAK,OAAO,MAAM,CAAC,CAAC;AAAA,IAC3C;AACA,UAAM,SAAS,CAAC;AAAA,EACjB;AAEM,QAAA,SAAS,mBAAmB,OAAO;AACzC,QAAM,eAAe,CAAC,OAAO,CAAC,GAAG,GAAG,OAAO,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC;AAE9E,SAAA;AAAA,IACN,aAAa,IAAI,CAAA,OAAM,GAAG,KAAK,EAAE,OAAO,CAAC,OAAwD,CAAC,CAAC,EAAE;AAAA,EAAA;AAEvG;"}
|
|
1
|
+
{"version":3,"file":"Result.js","sources":["../../../../../packages/engine-content-api/src/mapper/Result.ts"],"sourcesContent":["import { Input, Model, Value } from '@contember/schema'\n\nexport enum MutationResultType {\n\tok = 'ok',\n\tnothingToDo = 'nothingToDo',\n\tnotFoundError = 'notFoundError',\n\tconstraintViolationError = 'constraintViolationError',\n\tnoResultError = 'noResultError',\n\tvalidationError = 'validationError',\n\tinputError = 'inputError',\n\tsqlError = 'sqlError',\n}\n\nexport enum MutationResultHint {\n\tsqlError = 'sqlError',\n\tsubSequentSqlError = 'subsequentSqlError',\n}\n\nexport enum ModificationType {\n\tcreate = 'create',\n\tupdate = 'update',\n\tdelete = 'delete',\n\tjunctionUpdate = 'junctionUpdate',\n}\n\nexport type MutationResult =\n\t| MutationUpdateOk\n\t| MutationCreateOk\n\t| MutationDeleteOk\n\t| MutationJunctionUpdateOk\n\t| MutationEntryNotFoundError\n\t| MutationNothingToDo\n\t| MutationConstraintViolationError\n\t| MutationNoResultError\n\t| MutationInputError\n\t| MutationSqlError\n\nexport type MutationResultList = MutationResult[]\n\ntype Path = ({ field: string } | { index: number; alias?: string })[]\n\ninterface MutationResultInterface {\n\terror: boolean\n\tresult: MutationResultType\n\tpaths: Path[]\n\tmessage?: string\n\thints: MutationResultHint[]\n}\n\nexport type RowValues = { [fieldName: string]: Value.FieldValue }\n\nexport class MutationUpdateOk implements MutationResultInterface {\n\terror = false\n\tresult = MutationResultType.ok as const\n\ttype = ModificationType.update as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly entity: Model.Entity,\n\t\tpublic readonly primary: Value.PrimaryValue,\n\t\tpublic readonly input: Input.UpdateDataInput,\n\t\tpublic readonly values: RowValues,\n\t\tpublic readonly oldValues?: RowValues,\n\t) {}\n}\n\nexport class MutationCreateOk implements MutationResultInterface {\n\terror = false\n\tresult = MutationResultType.ok as const\n\ttype = ModificationType.create as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly entity: Model.Entity,\n\t\tpublic readonly primary: Value.PrimaryValue,\n\t\tpublic readonly input: Input.CreateDataInput,\n\t\tpublic readonly values: RowValues,\n\t) {}\n}\n\nexport class MutationDeleteOk implements MutationResultInterface {\n\terror = false\n\tresult = MutationResultType.ok as const\n\ttype = ModificationType.delete as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly entity: Model.Entity,\n\t\tpublic readonly primary: Value.PrimaryValue,\n\t) {}\n}\n\nexport class MutationJunctionUpdateOk implements MutationResultInterface {\n\terror = false\n\tresult = MutationResultType.ok as const\n\ttype = ModificationType.junctionUpdate as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly entity: Model.Entity,\n\t\tpublic readonly relation: Model.ManyHasManyOwningRelation,\n\t\tpublic readonly owningUnique: Input.PrimaryValue,\n\t\tpublic readonly inverseUnique: Input.PrimaryValue,\n\t) {}\n}\n\nexport enum NothingToDoReason {\n\tnoData = 'noData',\n\temptyRelation = 'emptyRelation',\n\talreadyExists = 'alreadyExists',\n\taborted = 'aborted',\n\talreadyDeleted = 'alreadyDeleted',\n}\n\nexport class MutationNothingToDo implements MutationResultInterface {\n\terror = false\n\tresult = MutationResultType.nothingToDo as const\n\thints: MutationResultHint[] = []\n\n\tconstructor(public readonly paths: Path[], public readonly reason: NothingToDoReason) {}\n}\n\nexport enum InputErrorKind {\n\tnonUniqueWhere = 'nonUniqueWhere',\n\tinvalidData = 'invalidData',\n}\n\nexport class MutationInputError implements MutationResultInterface {\n\terror = true\n\tresult = MutationResultType.inputError as const\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly kind: InputErrorKind,\n\t\tpublic readonly message?: string,\n\t\tpublic readonly hints: MutationResultHint[] = [],\n\t) {}\n}\n\nexport class MutationSqlError implements MutationResultInterface {\n\terror = true\n\tresult = MutationResultType.sqlError as const\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly message?: string,\n\t\tpublic readonly hints: MutationResultHint[] = [],\n\t) {}\n}\n\nexport enum ConstraintType {\n\tnotNull = 'notNull',\n\tuniqueKey = 'uniqueKey',\n\tforeignKey = 'foreignKey',\n}\n\nexport class MutationConstraintViolationError implements MutationResultInterface {\n\terror = true\n\tresult = MutationResultType.constraintViolationError as const\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly constraint: ConstraintType,\n\t\tpublic readonly message?: string,\n\t\tpublic readonly hints: MutationResultHint[] = [],\n\t) {}\n}\n\n// maybe denied by acl\nexport class MutationEntryNotFoundError implements MutationResultInterface {\n\terror = true\n\tresult = MutationResultType.notFoundError as const\n\thints: MutationResultHint[] = []\n\tmessage: string\n\n\tconstructor(public readonly paths: Path[], public readonly where: Input.UniqueWhere | Input.Where) {\n\t\tthis.message = 'for input ' + JSON.stringify(where)\n\t}\n}\n\n// possibly denied by acl\nexport class MutationNoResultError implements MutationResultInterface {\n\terror = true\n\tresult = MutationResultType.noResultError as const\n\n\tconstructor(\n\t\tpublic readonly paths: Path[],\n\t\tpublic readonly message?: string,\n\t\tpublic readonly hints: MutationResultHint[] = [],\n\t) {}\n}\n\nexport const prependPath = (path: Path, results: MutationResultList): MutationResultList =>\n\tresults.map(it => ({\n\t\t...it,\n\t\tpaths: (it.paths.length === 0 ? [[]] : it.paths).map(it => [...path, ...it]),\n\t}))\n\nexport const getInsertPrimary = (result: MutationResultList) =>\n\tresult[0] && result[0].result === MutationResultType.ok && result[0].type === ModificationType.create\n\t\t? result[0].primary\n\t\t: undefined\n"],"names":["MutationResultType","MutationResultHint","NothingToDoReason","InputErrorKind","ConstraintType","it"],"mappings":";;;AAEY,IAAA,uCAAAA,wBAAL;AACNA,sBAAA,IAAK,IAAA;AACLA,sBAAA,aAAc,IAAA;AACdA,sBAAA,eAAgB,IAAA;AAChBA,sBAAA,0BAA2B,IAAA;AAC3BA,sBAAA,eAAgB,IAAA;AAChBA,sBAAA,iBAAkB,IAAA;AAClBA,sBAAA,YAAa,IAAA;AACbA,sBAAA,UAAW,IAAA;AARAA,SAAAA;AAAA,GAAA,sBAAA,CAAA,CAAA;AAWA,IAAA,uCAAAC,wBAAL;AACNA,sBAAA,UAAW,IAAA;AACXA,sBAAA,oBAAqB,IAAA;AAFVA,SAAAA;AAAA,GAAA,sBAAA,CAAA,CAAA;AAsCL,MAAM,iBAAoD;AAAA,EAMhE,YACiB,OACA,QACA,SACA,OACA,QACA,WACf;AANe,SAAA,QAAA;AACA,SAAA,SAAA;AACA,SAAA,UAAA;AACA,SAAA,QAAA;AACA,SAAA,SAAA;AACA,SAAA,YAAA;AAXT,kBAAA,MAAA,SAAA,KAAA;AACC;AAAA,MAAA;AAAA,MAAA;AAAA,MAAA;AAAA;AAAA;AACF;AAAA,MAAA;AAAA,MAAA;AAAA,MAAA;AAAA;AAAA;AACP,kBAAA,MAAA,SAA8B,CAAA,CAAC;AAAA,EAS5B;AACJ;AAEO,MAAM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,SAAA,QAAA;AALnD,kBAAA,MAAA,SAAA,IAAA;AACC;AAAA,MAAA;AAAA,MAAA;AAAA,MAAA;AAAA;AAAA;AACT,kBAAA,MAAA,SAA8B,CAAA,CAAC;AAC/B,kBAAA,MAAA,SAAA;AAGC,SAAK,UAAU,eAAe,KAAK,UAAU,KAAK;AAAA,EACnD;AACD;AAGO,MAAM,sBAAyD;AAAA,EAIrE,YACiB,OACA,SACA,QAA8B,CAAA,GAC7C;AAHe,SAAA,QAAA;AACA,SAAA,UAAA;AACA,SAAA,QAAA;AANT,kBAAA,MAAA,SAAA,IAAA;AACC;AAAA,MAAA;AAAA,MAAA;AAAA,MAAA;AAAA;AAAA;EAMN;AACJ;AAEO,MAAM,cAAc,CAAC,MAAY,YACvC,QAAQ,IAAI,CAAO,QAAA;AAAA,EAClB,GAAG;AAAA,EACH,QAAQ,GAAG,MAAM,WAAW,IAAI,CAAC,EAAE,IAAI,GAAG,OAAO,IAAI,CAAAC,QAAM,CAAC,GAAG,MAAM,GAAGA,GAAE,CAAC;AAC5E,EAAE;AAEI,MAAM,mBAAmB,CAAC,WAChC,OAAO,CAAC,KAAK,OAAO,CAAC,EAAE,WAAW,QAAyB,OAAO,CAAC,EAAE,SAAS,WAC3E,OAAO,CAAC,EAAE,UACV;"}
|
|
@@ -4,8 +4,6 @@ const schema = require("@contember/schema");
|
|
|
4
4
|
const Database = require("@contember/database");
|
|
5
5
|
const schemaUtils = require("@contember/schema-utils");
|
|
6
6
|
const ColumnValue = require("../ColumnValue.cjs");
|
|
7
|
-
const exception = require("../../exception.cjs");
|
|
8
|
-
const DataManipulationBuilder = require("../DataManipulationBuilder.cjs");
|
|
9
7
|
const EventManager = require("../EventManager.cjs");
|
|
10
8
|
var __defProp = Object.defineProperty;
|
|
11
9
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -17,10 +15,6 @@ class InsertBuilder {
|
|
|
17
15
|
this.whereBuilder = whereBuilder;
|
|
18
16
|
this.pathFactory = pathFactory;
|
|
19
17
|
this.predicateFactory = predicateFactory;
|
|
20
|
-
__publicField(this, "resolver", () => {
|
|
21
|
-
throw new exception.ImplementationException("InsertBuilder: Resolver called too soon");
|
|
22
|
-
});
|
|
23
|
-
__publicField(this, "insert", new Promise((resolve) => this.resolver = resolve));
|
|
24
18
|
__publicField(this, "rowData", /* @__PURE__ */ new Map());
|
|
25
19
|
__publicField(this, "where", { and: [] });
|
|
26
20
|
}
|
|
@@ -44,10 +38,6 @@ class InsertBuilder {
|
|
|
44
38
|
async execute(mapper) {
|
|
45
39
|
try {
|
|
46
40
|
const resolvedData = await this.getResolvedData();
|
|
47
|
-
if (resolvedData.find((it) => it.resolvedValue === DataManipulationBuilder.AbortDataManipulation)) {
|
|
48
|
-
this.resolver(null);
|
|
49
|
-
return { aborted: true, executed: false, primaryValue: null, values: [] };
|
|
50
|
-
}
|
|
51
41
|
const insertData = resolvedData.reduce(
|
|
52
42
|
(result2, item) => ({ ...result2, [item.columnName]: (expr) => expr.select(["root_", item.columnName]) }),
|
|
53
43
|
{}
|
|
@@ -68,10 +58,8 @@ class InsertBuilder {
|
|
|
68
58
|
const afterInsertEvent = new EventManager.AfterInsertEvent(this.entity, resolvedData, result);
|
|
69
59
|
beforeInsertEvent.afterEvent = afterInsertEvent;
|
|
70
60
|
await mapper.eventManager.fire(afterInsertEvent);
|
|
71
|
-
|
|
72
|
-
return { values: resolvedData, executed: true, primaryValue: result, aborted: false };
|
|
61
|
+
return { values: resolvedData, executed: true, primaryValue: result };
|
|
73
62
|
} catch (e) {
|
|
74
|
-
this.resolver(null);
|
|
75
63
|
throw e;
|
|
76
64
|
}
|
|
77
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InsertBuilder.cjs","sources":["../../../../../../packages/engine-content-api/src/mapper/insert/InsertBuilder.ts"],"sourcesContent":["import { Acl, Input, Model, Value } from '@contember/schema'\nimport {
|
|
1
|
+
{"version":3,"file":"InsertBuilder.cjs","sources":["../../../../../../packages/engine-content-api/src/mapper/insert/InsertBuilder.ts"],"sourcesContent":["import { Acl, Input, Model, Value } from '@contember/schema'\nimport { InsertBuilder as DbInsertBuilder, QueryBuilder, Value as DbValue } from '@contember/database'\nimport { PathFactory, WhereBuilder } from '../select'\nimport { getColumnName, getColumnType } from '@contember/schema-utils'\nimport { ColumnValue, ResolvedColumnValue, resolveGenericValue, resolveRowData } from '../ColumnValue'\nimport { PredicateFactory } from '../../acl'\nimport { AfterInsertEvent, BeforeInsertEvent } from '../EventManager'\nimport { Mapper } from '../Mapper'\n\nexport interface InsertResult {\n\tvalues: ResolvedColumnValue[]\n\texecuted: boolean\n\tprimaryValue: Value.PrimaryValue | null\n}\n\nexport class InsertBuilder {\n\tprivate rowData: Map<string, ColumnValue<undefined>> = new Map()\n\tprivate where: { and: Input.OptionalWhere[] } = { and: [] }\n\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly entity: Model.Entity,\n\t\tprivate readonly whereBuilder: WhereBuilder,\n\t\tprivate readonly pathFactory: PathFactory,\n\t\tprivate readonly predicateFactory: PredicateFactory,\n\t) {}\n\n\tpublic addFieldValue(\n\t\tfieldName: string,\n\t\tvalue: Value.GenericValueLike<Value.AtomicValue<undefined>>,\n\t): Promise<Value.AtomicValue<undefined>> {\n\t\tconst columnName = getColumnName(this.schema, this.entity, fieldName)\n\t\tconst columnType = getColumnType(this.schema, this.entity, fieldName)\n\t\tconst resolvedValue = resolveGenericValue(value)\n\t\tthis.rowData.set(columnName, { columnName, value: resolvedValue, columnType, fieldName })\n\t\treturn resolvedValue\n\t}\n\n\tpublic addPredicates(fields: string[]): void {\n\t\tconst where = this.predicateFactory.create(this.entity, Acl.Operation.create, fields)\n\t\tthis.addWhere(where)\n\t}\n\n\tpublic addWhere(where: Input.OptionalWhere): void {\n\t\tthis.where.and.push(where)\n\t}\n\n\tpublic async getResolvedData(): Promise<ResolvedColumnValue[]> {\n\t\treturn resolveRowData([...this.rowData.values()])\n\t}\n\n\tpublic async execute(mapper: Mapper): Promise<InsertResult> {\n\t\ttry {\n\t\t\tconst resolvedData = await this.getResolvedData()\n\n\t\t\tconst insertData = resolvedData.reduce<QueryBuilder.ColumnExpressionMap>(\n\t\t\t\t(result, item) => ({ ...result, [item.columnName]: expr => expr.select(['root_', item.columnName]) }),\n\t\t\t\t{},\n\t\t\t)\n\t\t\tconst qb = DbInsertBuilder.create()\n\t\t\t\t.with('root_', qb => {\n\t\t\t\t\treturn resolvedData.reduce(\n\t\t\t\t\t\t(qb, value) =>\n\t\t\t\t\t\t\tqb.select(expr => expr.selectValue(value.resolvedValue as DbValue, value.columnType), value.columnName),\n\t\t\t\t\t\tqb,\n\t\t\t\t\t)\n\t\t\t\t})\n\t\t\t\t.into(this.entity.tableName)\n\t\t\t\t.values(insertData)\n\t\t\t\t.from(qb => {\n\t\t\t\t\tqb = qb.from('root_')\n\t\t\t\t\treturn this.whereBuilder.build(qb, this.entity, this.pathFactory.create([]), this.where)\n\t\t\t\t})\n\t\t\t\t.returning(this.entity.primaryColumn)\n\n\t\t\tconst beforeInsertEvent = new BeforeInsertEvent(this.entity, resolvedData as ResolvedColumnValue[])\n\t\t\tawait mapper.eventManager.fire(beforeInsertEvent)\n\n\t\t\tconst returning = (await qb.execute(mapper.db)).map(it => it[this.entity.primaryColumn])\n\t\t\tconst result = returning.length === 1 ? returning[0] : null\n\n\t\t\tconst afterInsertEvent = new AfterInsertEvent(this.entity, resolvedData as ResolvedColumnValue[], result)\n\t\t\tbeforeInsertEvent.afterEvent = afterInsertEvent\n\t\t\tawait mapper.eventManager.fire(afterInsertEvent)\n\n\t\t\treturn { values: resolvedData as ResolvedColumnValue[], executed: true, primaryValue: result }\n\t\t} catch (e) {\n\t\t\tthrow e\n\t\t}\n\t}\n}\n"],"names":["schema","getColumnName","getColumnType","resolveGenericValue","Acl","resolveRowData","result","DbInsertBuilder","qb","BeforeInsertEvent","Af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AAM;AACpB,eAAO,aAAa;AAAA,UACnB,CAACA,KAAI,UACJA,IAAG,OAAO,CAAQ,SAAA,KAAK,YAAY,MAAM,eAA0B,MAAM,UAAU,GAAG,MAAM,UAAU;AAAA,UACvGA;AAAAA,QAAA;AAAA,MAED,CAAA,EACA,KAAK,KAAK,OAAO,SAAS,EAC1B,OAAO,UAAU,EACjB,KAAK,CAAAA,QAAM;AACXA,cAAKA,IAAG,KAAK,OAAO;AACpB,eAAO,KAAK,aAAa,MAAMA,KAAI,KAAK,QAAQ,KAAK,YAAY,OAAO,CAAA,CAAE,GAAG,KAAK,KAAK;AAAA,MACvF,CAAA,EACA,UAAU,KAAK,OAAO,aAAa;AAErC,YAAM,oBAAoB,IAAIC,aAAkB,kBAAA,KAAK,QAAQ,YAAqC;AAC5F,YAAA,OAAO,aAAa,KAAK,iBAAiB;AAEhD,YAAM,aAAa,MAAM,GAAG,QAAQ,OAAO,EAAE,GAAG,IAAI,CAAM,OAAA,GAAG,KAAK,OAAO,aAAa,CAAC;AACvF,YAAM,SAAS,UAAU,WAAW,IAAI,UAAU,CAAC,IAAI;AAEvD,YAAM,mBAAmB,IAAIC,8BAAiB,KAAK,QAAQ,cAAuC,MAAM;AACxG,wBAAkB,aAAa;AACzB,YAAA,OAAO,aAAa,KAAK,gBAAgB;AAE/C,aAAO,EAAE,QAAQ,cAAuC,UAAU,MAAM,cAAc;aAC9E,GAAG;AACL,YAAA;AAAA,IACP;AAAA,EACD;AACD;;"}
|
|
@@ -2,8 +2,6 @@ import { Acl } from "@contember/schema";
|
|
|
2
2
|
import { InsertBuilder as InsertBuilder$1 } from "@contember/database";
|
|
3
3
|
import { getColumnName, getColumnType } from "@contember/schema-utils";
|
|
4
4
|
import { resolveGenericValue, resolveRowData } from "../ColumnValue.js";
|
|
5
|
-
import { ImplementationException } from "../../exception.js";
|
|
6
|
-
import { AbortDataManipulation } from "../DataManipulationBuilder.js";
|
|
7
5
|
import { BeforeInsertEvent, AfterInsertEvent } from "../EventManager.js";
|
|
8
6
|
var __defProp = Object.defineProperty;
|
|
9
7
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -15,10 +13,6 @@ class InsertBuilder {
|
|
|
15
13
|
this.whereBuilder = whereBuilder;
|
|
16
14
|
this.pathFactory = pathFactory;
|
|
17
15
|
this.predicateFactory = predicateFactory;
|
|
18
|
-
__publicField(this, "resolver", () => {
|
|
19
|
-
throw new ImplementationException("InsertBuilder: Resolver called too soon");
|
|
20
|
-
});
|
|
21
|
-
__publicField(this, "insert", new Promise((resolve) => this.resolver = resolve));
|
|
22
16
|
__publicField(this, "rowData", /* @__PURE__ */ new Map());
|
|
23
17
|
__publicField(this, "where", { and: [] });
|
|
24
18
|
}
|
|
@@ -42,10 +36,6 @@ class InsertBuilder {
|
|
|
42
36
|
async execute(mapper) {
|
|
43
37
|
try {
|
|
44
38
|
const resolvedData = await this.getResolvedData();
|
|
45
|
-
if (resolvedData.find((it) => it.resolvedValue === AbortDataManipulation)) {
|
|
46
|
-
this.resolver(null);
|
|
47
|
-
return { aborted: true, executed: false, primaryValue: null, values: [] };
|
|
48
|
-
}
|
|
49
39
|
const insertData = resolvedData.reduce(
|
|
50
40
|
(result2, item) => ({ ...result2, [item.columnName]: (expr) => expr.select(["root_", item.columnName]) }),
|
|
51
41
|
{}
|
|
@@ -66,10 +56,8 @@ class InsertBuilder {
|
|
|
66
56
|
const afterInsertEvent = new AfterInsertEvent(this.entity, resolvedData, result);
|
|
67
57
|
beforeInsertEvent.afterEvent = afterInsertEvent;
|
|
68
58
|
await mapper.eventManager.fire(afterInsertEvent);
|
|
69
|
-
|
|
70
|
-
return { values: resolvedData, executed: true, primaryValue: result, aborted: false };
|
|
59
|
+
return { values: resolvedData, executed: true, primaryValue: result };
|
|
71
60
|
} catch (e) {
|
|
72
|
-
this.resolver(null);
|
|
73
61
|
throw e;
|
|
74
62
|
}
|
|
75
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InsertBuilder.js","sources":["../../../../../../packages/engine-content-api/src/mapper/insert/InsertBuilder.ts"],"sourcesContent":["import { Acl, Input, Model, Value } from '@contember/schema'\nimport {
|
|
1
|
+
{"version":3,"file":"InsertBuilder.js","sources":["../../../../../../packages/engine-content-api/src/mapper/insert/InsertBuilder.ts"],"sourcesContent":["import { Acl, Input, Model, Value } from '@contember/schema'\nimport { InsertBuilder as DbInsertBuilder, QueryBuilder, Value as DbValue } from '@contember/database'\nimport { PathFactory, WhereBuilder } from '../select'\nimport { getColumnName, getColumnType } from '@contember/schema-utils'\nimport { ColumnValue, ResolvedColumnValue, resolveGenericValue, resolveRowData } from '../ColumnValue'\nimport { PredicateFactory } from '../../acl'\nimport { AfterInsertEvent, BeforeInsertEvent } from '../EventManager'\nimport { Mapper } from '../Mapper'\n\nexport interface InsertResult {\n\tvalues: ResolvedColumnValue[]\n\texecuted: boolean\n\tprimaryValue: Value.PrimaryValue | null\n}\n\nexport class InsertBuilder {\n\tprivate rowData: Map<string, ColumnValue<undefined>> = new Map()\n\tprivate where: { and: Input.OptionalWhere[] } = { and: [] }\n\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly entity: Model.Entity,\n\t\tprivate readonly whereBuilder: WhereBuilder,\n\t\tprivate readonly pathFactory: PathFactory,\n\t\tprivate readonly predicateFactory: PredicateFactory,\n\t) {}\n\n\tpublic addFieldValue(\n\t\tfieldName: string,\n\t\tvalue: Value.GenericValueLike<Value.AtomicValue<undefined>>,\n\t): Promise<Value.AtomicValue<undefined>> {\n\t\tconst columnName = getColumnName(this.schema, this.entity, fieldName)\n\t\tconst columnType = getColumnType(this.schema, this.entity, fieldName)\n\t\tconst resolvedValue = resolveGenericValue(value)\n\t\tthis.rowData.set(columnName, { columnName, value: resolvedValue, columnType, fieldName })\n\t\treturn resolvedValue\n\t}\n\n\tpublic addPredicates(fields: string[]): void {\n\t\tconst where = this.predicateFactory.create(this.entity, Acl.Operation.create, fields)\n\t\tthis.addWhere(where)\n\t}\n\n\tpublic addWhere(where: Input.OptionalWhere): void {\n\t\tthis.where.and.push(where)\n\t}\n\n\tpublic async getResolvedData(): Promise<ResolvedColumnValue[]> {\n\t\treturn resolveRowData([...this.rowData.values()])\n\t}\n\n\tpublic async execute(mapper: Mapper): Promise<InsertResult> {\n\t\ttry {\n\t\t\tconst resolvedData = await this.getResolvedData()\n\n\t\t\tconst insertData = resolvedData.reduce<QueryBuilder.ColumnExpressionMap>(\n\t\t\t\t(result, item) => ({ ...result, [item.columnName]: expr => expr.select(['root_', item.columnName]) }),\n\t\t\t\t{},\n\t\t\t)\n\t\t\tconst qb = DbInsertBuilder.create()\n\t\t\t\t.with('root_', qb => {\n\t\t\t\t\treturn resolvedData.reduce(\n\t\t\t\t\t\t(qb, value) =>\n\t\t\t\t\t\t\tqb.select(expr => expr.selectValue(value.resolvedValue as DbValue, value.columnType), value.columnName),\n\t\t\t\t\t\tqb,\n\t\t\t\t\t)\n\t\t\t\t})\n\t\t\t\t.into(this.entity.tableName)\n\t\t\t\t.values(insertData)\n\t\t\t\t.from(qb => {\n\t\t\t\t\tqb = qb.from('root_')\n\t\t\t\t\treturn this.whereBuilder.build(qb, this.entity, this.pathFactory.create([]), this.where)\n\t\t\t\t})\n\t\t\t\t.returning(this.entity.primaryColumn)\n\n\t\t\tconst beforeInsertEvent = new BeforeInsertEvent(this.entity, resolvedData as ResolvedColumnValue[])\n\t\t\tawait mapper.eventManager.fire(beforeInsertEvent)\n\n\t\t\tconst returning = (await qb.execute(mapper.db)).map(it => it[this.entity.primaryColumn])\n\t\t\tconst result = returning.length === 1 ? returning[0] : null\n\n\t\t\tconst afterInsertEvent = new AfterInsertEvent(this.entity, resolvedData as ResolvedColumnValue[], result)\n\t\t\tbeforeInsertEvent.afterEvent = afterInsertEvent\n\t\t\tawait mapper.eventManager.fire(afterInsertEvent)\n\n\t\t\treturn { values: resolvedData as ResolvedColumnValue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