@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
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { Model } from "@contember/schema";
|
|
2
|
-
import { MutationEntryNotFoundError, MutationConstraintViolationError, ConstraintType, getInsertPrimary, MutationNothingToDo, NothingToDoReason } from "../Result.js";
|
|
3
|
-
import { CheckedPrimary } from "../CheckedPrimary.js";
|
|
4
|
-
import { AbortDataManipulation } from "../DataManipulationBuilder.js";
|
|
5
|
-
class OneHasOneOwningUpdateInputProcessor {
|
|
6
|
-
constructor(primaryValue, mapper, updateBuilder) {
|
|
7
|
-
this.primaryValue = primaryValue;
|
|
8
|
-
this.mapper = mapper;
|
|
9
|
-
this.updateBuilder = updateBuilder;
|
|
10
|
-
}
|
|
11
|
-
async connect(context) {
|
|
12
|
-
const result = [];
|
|
13
|
-
let currentInverseSide;
|
|
14
|
-
const { entity, relation, targetEntity, targetRelation, input } = context;
|
|
15
|
-
const newInverseSide = await this.updateBuilder.addFieldValue(relation.name, async () => {
|
|
16
|
-
const newInverseSide2 = await this.mapper.getPrimaryValue(targetEntity, input);
|
|
17
|
-
if (!newInverseSide2) {
|
|
18
|
-
result.push(new MutationEntryNotFoundError([], input));
|
|
19
|
-
return AbortDataManipulation;
|
|
20
|
-
}
|
|
21
|
-
currentInverseSide = await this.getCurrentInverseSide(targetRelation, relation, entity);
|
|
22
|
-
return await this.connectInternal(context, currentInverseSide, newInverseSide2, result);
|
|
23
|
-
});
|
|
24
|
-
if (newInverseSide) {
|
|
25
|
-
result.push(...await this.cleanupOrphan(relation, targetEntity, currentInverseSide));
|
|
26
|
-
}
|
|
27
|
-
return result;
|
|
28
|
-
}
|
|
29
|
-
async create(context) {
|
|
30
|
-
const result = [];
|
|
31
|
-
let currentInverseSide;
|
|
32
|
-
const { entity, relation, targetEntity, targetRelation } = context;
|
|
33
|
-
await this.updateBuilder.addFieldValue(relation.name, async () => {
|
|
34
|
-
currentInverseSide = await this.getCurrentInverseSide(targetRelation, relation, entity);
|
|
35
|
-
return await this.createInternal(context, currentInverseSide, result);
|
|
36
|
-
});
|
|
37
|
-
result.push(...await this.cleanupOrphan(relation, targetEntity, currentInverseSide));
|
|
38
|
-
return result;
|
|
39
|
-
}
|
|
40
|
-
async connectOrCreate({ input: { connect, create }, ...context }) {
|
|
41
|
-
const result = [];
|
|
42
|
-
let currentInverseSide;
|
|
43
|
-
const { relation, targetRelation, targetEntity, entity } = context;
|
|
44
|
-
const newInverseSide = await this.updateBuilder.addFieldValue(relation.name, async () => {
|
|
45
|
-
const newInverseSide2 = await this.mapper.getPrimaryValue(targetEntity, connect);
|
|
46
|
-
currentInverseSide = await this.getCurrentInverseSide(targetRelation, relation, entity);
|
|
47
|
-
if (newInverseSide2) {
|
|
48
|
-
return await this.connectInternal(context, currentInverseSide, newInverseSide2, result);
|
|
49
|
-
}
|
|
50
|
-
return await this.createInternal({ ...context, input: create }, currentInverseSide, result);
|
|
51
|
-
});
|
|
52
|
-
if (newInverseSide) {
|
|
53
|
-
result.push(...await this.cleanupOrphan(relation, targetEntity, currentInverseSide));
|
|
54
|
-
}
|
|
55
|
-
return result;
|
|
56
|
-
}
|
|
57
|
-
async createInternal({ targetEntity, targetRelation, relation, input }, currentInverseSide, result) {
|
|
58
|
-
if (targetRelation && !targetRelation.nullable && !relation.orphanRemoval && currentInverseSide) {
|
|
59
|
-
result.push(new MutationConstraintViolationError([], ConstraintType.notNull));
|
|
60
|
-
return AbortDataManipulation;
|
|
61
|
-
}
|
|
62
|
-
const insertResult = await this.mapper.insert(targetEntity, input);
|
|
63
|
-
result.push(...insertResult);
|
|
64
|
-
const newInverseSide = getInsertPrimary(insertResult);
|
|
65
|
-
if (newInverseSide) {
|
|
66
|
-
return newInverseSide;
|
|
67
|
-
}
|
|
68
|
-
return AbortDataManipulation;
|
|
69
|
-
}
|
|
70
|
-
async connectInternal({ targetEntity, targetRelation, relation, entity }, currentInverseSide, newInverseSide, result) {
|
|
71
|
-
if (currentInverseSide === newInverseSide) {
|
|
72
|
-
result.push(new MutationNothingToDo([], NothingToDoReason.alreadyExists));
|
|
73
|
-
return void 0;
|
|
74
|
-
}
|
|
75
|
-
const currentOwnerOfNewInverseSide = await this.mapper.getPrimaryValue(entity, {
|
|
76
|
-
[relation.name]: { [targetEntity.primary]: newInverseSide }
|
|
77
|
-
});
|
|
78
|
-
if (currentOwnerOfNewInverseSide === this.primaryValue) {
|
|
79
|
-
result.push(new MutationNothingToDo([], NothingToDoReason.alreadyExists));
|
|
80
|
-
return void 0;
|
|
81
|
-
}
|
|
82
|
-
if (targetRelation && !targetRelation.nullable && !relation.orphanRemoval && currentInverseSide) {
|
|
83
|
-
result.push(new MutationConstraintViolationError([], ConstraintType.notNull));
|
|
84
|
-
return AbortDataManipulation;
|
|
85
|
-
}
|
|
86
|
-
if (currentOwnerOfNewInverseSide) {
|
|
87
|
-
if (!relation.nullable) {
|
|
88
|
-
result.push(new MutationConstraintViolationError([], ConstraintType.notNull));
|
|
89
|
-
return AbortDataManipulation;
|
|
90
|
-
}
|
|
91
|
-
const currentOwnerDisconnect = await this.mapper.updateInternal(
|
|
92
|
-
entity,
|
|
93
|
-
{
|
|
94
|
-
[entity.primary]: currentOwnerOfNewInverseSide
|
|
95
|
-
},
|
|
96
|
-
(builder) => {
|
|
97
|
-
builder.addPredicates([relation.name]);
|
|
98
|
-
builder.addFieldValue(relation.name, null);
|
|
99
|
-
}
|
|
100
|
-
);
|
|
101
|
-
result.push(...currentOwnerDisconnect);
|
|
102
|
-
}
|
|
103
|
-
return newInverseSide;
|
|
104
|
-
}
|
|
105
|
-
async getCurrentInverseSide(targetRelation, relation, entity) {
|
|
106
|
-
if (targetRelation && !targetRelation.nullable || relation.orphanRemoval) {
|
|
107
|
-
return this.mapper.selectField(entity, { [entity.primary]: this.primaryValue }, relation.name);
|
|
108
|
-
}
|
|
109
|
-
return void 0;
|
|
110
|
-
}
|
|
111
|
-
async cleanupOrphan(relation, targetEntity, currentInverseSide) {
|
|
112
|
-
if (relation.orphanRemoval && currentInverseSide) {
|
|
113
|
-
await this.updateBuilder.update;
|
|
114
|
-
return await this.mapper.delete(targetEntity, { [targetEntity.primary]: currentInverseSide });
|
|
115
|
-
}
|
|
116
|
-
return [];
|
|
117
|
-
}
|
|
118
|
-
async update({ entity, relation, targetEntity, input }) {
|
|
119
|
-
const inversePrimary = await this.mapper.selectField(
|
|
120
|
-
entity,
|
|
121
|
-
{ [entity.primary]: this.primaryValue },
|
|
122
|
-
relation.name
|
|
123
|
-
);
|
|
124
|
-
if (!inversePrimary) {
|
|
125
|
-
return [new MutationNothingToDo([], NothingToDoReason.emptyRelation)];
|
|
126
|
-
}
|
|
127
|
-
return await this.mapper.update(targetEntity, { [targetEntity.primary]: inversePrimary }, input);
|
|
128
|
-
}
|
|
129
|
-
async upsert({ entity, relation, targetEntity, input: { create, update } }) {
|
|
130
|
-
const select = this.mapper.selectField(entity, { [entity.primary]: this.primaryValue }, relation.name);
|
|
131
|
-
const result = [];
|
|
132
|
-
await this.updateBuilder.addFieldValue(relation.name, async () => {
|
|
133
|
-
const primary = await select;
|
|
134
|
-
if (primary) {
|
|
135
|
-
return void 0;
|
|
136
|
-
}
|
|
137
|
-
const insertResult = await this.mapper.insert(targetEntity, create);
|
|
138
|
-
const insertPrimary = getInsertPrimary(insertResult);
|
|
139
|
-
if (insertPrimary) {
|
|
140
|
-
return insertPrimary;
|
|
141
|
-
}
|
|
142
|
-
result.push(...insertResult);
|
|
143
|
-
return AbortDataManipulation;
|
|
144
|
-
});
|
|
145
|
-
const inversePrimary = await select;
|
|
146
|
-
if (inversePrimary) {
|
|
147
|
-
return await this.mapper.update(targetEntity, { [targetEntity.primary]: inversePrimary }, update);
|
|
148
|
-
}
|
|
149
|
-
return result;
|
|
150
|
-
}
|
|
151
|
-
async disconnect({ entity, targetEntity, relation, targetRelation }) {
|
|
152
|
-
if (!relation.nullable) {
|
|
153
|
-
return [new MutationConstraintViolationError([], ConstraintType.notNull)];
|
|
154
|
-
}
|
|
155
|
-
const result = [];
|
|
156
|
-
const currentInverseSide = targetRelation && !targetRelation.nullable || relation.orphanRemoval ? this.mapper.selectField(entity, { [entity.primary]: this.primaryValue }, relation.name) : Promise.resolve(void 0);
|
|
157
|
-
this.updateBuilder.addFieldValue(relation.name, async () => {
|
|
158
|
-
const inversePrimary = await currentInverseSide;
|
|
159
|
-
if (inversePrimary && targetRelation && !targetRelation.nullable && !relation.orphanRemoval) {
|
|
160
|
-
result.push(new MutationConstraintViolationError([], ConstraintType.notNull));
|
|
161
|
-
return AbortDataManipulation;
|
|
162
|
-
}
|
|
163
|
-
return null;
|
|
164
|
-
});
|
|
165
|
-
if (relation.orphanRemoval) {
|
|
166
|
-
const inversePrimary = await currentInverseSide;
|
|
167
|
-
if (inversePrimary) {
|
|
168
|
-
await this.updateBuilder.update;
|
|
169
|
-
const deleteOrphanedInverseSide = await this.mapper.delete(targetEntity, { [targetEntity.primary]: inversePrimary });
|
|
170
|
-
result.push(...deleteOrphanedInverseSide);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return result;
|
|
174
|
-
}
|
|
175
|
-
async delete({ entity, targetEntity, relation, targetRelation }) {
|
|
176
|
-
if (!relation.nullable && relation.joiningColumn.onDelete !== Model.OnDelete.cascade) {
|
|
177
|
-
return [new MutationConstraintViolationError([], ConstraintType.notNull)];
|
|
178
|
-
}
|
|
179
|
-
if (relation.joiningColumn.onDelete === Model.OnDelete.restrict) {
|
|
180
|
-
console.error(
|
|
181
|
-
"[DEPRECATED] You are deleting an entity over the relation where onDelete behaviour is set to restrict. This will fail in next version."
|
|
182
|
-
);
|
|
183
|
-
this.updateBuilder.addFieldValue(relation.name, null);
|
|
184
|
-
}
|
|
185
|
-
const targetPrimary = await this.mapper.selectField(
|
|
186
|
-
entity,
|
|
187
|
-
{ [entity.primary]: this.primaryValue },
|
|
188
|
-
relation.name
|
|
189
|
-
);
|
|
190
|
-
if (!targetPrimary) {
|
|
191
|
-
return [new MutationNothingToDo([], NothingToDoReason.emptyRelation)];
|
|
192
|
-
}
|
|
193
|
-
await this.updateBuilder.update;
|
|
194
|
-
return await this.mapper.delete(targetEntity, new CheckedPrimary(targetPrimary));
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
export {
|
|
198
|
-
OneHasOneOwningUpdateInputProcessor
|
|
199
|
-
};
|
|
200
|
-
//# sourceMappingURL=OneHasOneOwningUpdateInputProcessor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OneHasOneOwningUpdateInputProcessor.js","sources":["../../../../../../packages/engine-content-api/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.ts"],"sourcesContent":["import { UpdateInputProcessor } from '../../inputProcessing'\nimport { Input, Model } from '@contember/schema'\nimport {\n\tConstraintType,\n\tgetInsertPrimary,\n\tMutationConstraintViolationError,\n\tMutationEntryNotFoundError,\n\tMutationNothingToDo,\n\tMutationResultList,\n\tNothingToDoReason,\n} from '../Result'\nimport { Mapper } from '../Mapper'\nimport { UpdateBuilder } from '../update/UpdateBuilder'\nimport { CheckedPrimary } from '../CheckedPrimary'\nimport { AbortDataManipulation } from '../DataManipulationBuilder'\n\nexport class OneHasOneOwningUpdateInputProcessor {\n\tconstructor(\n\t\tprivate readonly primaryValue: Input.PrimaryValue,\n\t\tprivate readonly mapper: Mapper,\n\t\tprivate readonly updateBuilder: UpdateBuilder,\n\t) {\n\t}\n\n\tpublic async connect(context: Model.OneHasOneOwningContext & { input: Input.UniqueWhere }) {\n\t\tconst result: MutationResultList = []\n\t\tlet currentInverseSide: Input.PrimaryValue | undefined\n\n\t\tconst { entity, relation, targetEntity, targetRelation, input } = context\n\t\tconst newInverseSide = await this.updateBuilder.addFieldValue(relation.name, async () => {\n\t\t\tconst newInverseSide = await this.mapper.getPrimaryValue(targetEntity, input)\n\t\t\tif (!newInverseSide) {\n\t\t\t\tresult.push(new MutationEntryNotFoundError([], input))\n\t\t\t\treturn AbortDataManipulation\n\t\t\t}\n\t\t\tcurrentInverseSide = await this.getCurrentInverseSide(targetRelation, relation, entity)\n\t\t\treturn await this.connectInternal(context, currentInverseSide, newInverseSide, result)\n\t\t})\n\n\t\tif (newInverseSide) {\n\t\t\tresult.push(...(await this.cleanupOrphan(relation, targetEntity, currentInverseSide)))\n\t\t}\n\n\t\treturn result\n\t}\n\n\tpublic async create(context: Model.OneHasOneOwningContext & { input: Input.CreateDataInput }) {\n\t\tconst result: MutationResultList = []\n\t\tlet currentInverseSide: Input.PrimaryValue | undefined\n\t\tconst { entity, relation, targetEntity, targetRelation } = context\n\t\tawait this.updateBuilder.addFieldValue(relation.name, async () => {\n\t\t\tcurrentInverseSide = await this.getCurrentInverseSide(targetRelation, relation, entity)\n\t\t\t// orphan removal handled bellow\n\t\t\treturn await this.createInternal(context, currentInverseSide, result)\n\t\t})\n\n\t\tresult.push(...(await this.cleanupOrphan(relation, targetEntity, currentInverseSide)))\n\t\treturn result\n\t}\n\n\tpublic async connectOrCreate({ input: { connect, create }, ...context }: Model.OneHasOneOwningContext & { input: Input.ConnectOrCreateInput }) {\n\t\tconst result: MutationResultList = []\n\t\tlet currentInverseSide: Input.PrimaryValue | undefined\n\n\t\tconst { relation, targetRelation, targetEntity, entity } = context\n\t\tconst newInverseSide = await this.updateBuilder.addFieldValue(relation.name, async () => {\n\t\t\tconst newInverseSide = await this.mapper.getPrimaryValue(targetEntity, connect)\n\t\t\tcurrentInverseSide = await this.getCurrentInverseSide(targetRelation, relation, entity)\n\t\t\tif (newInverseSide) {\n\t\t\t\treturn await this.connectInternal(context, currentInverseSide, newInverseSide, result)\n\t\t\t}\n\t\t\treturn await this.createInternal({ ...context, input: create }, currentInverseSide, result)\n\t\t})\n\n\t\tif (newInverseSide) {\n\t\t\tresult.push(...(await this.cleanupOrphan(relation, targetEntity, currentInverseSide)))\n\t\t}\n\n\t\treturn result\n\t}\n\n\tprivate async createInternal(\n\t\t{ targetEntity, targetRelation, relation, input }: Model.OneHasOneOwningContext & { input: Input.CreateDataInput },\n\t\tcurrentInverseSide: Input.PrimaryValue | undefined,\n\t\tresult: MutationResultList,\n\t) {\n\t\tif (targetRelation && !targetRelation.nullable && !relation.orphanRemoval && currentInverseSide) {\n\t\t\tresult.push(new MutationConstraintViolationError([], ConstraintType.notNull))\n\t\t\treturn AbortDataManipulation\n\t\t}\n\n\t\tconst insertResult = await this.mapper.insert(targetEntity, input)\n\t\tresult.push(...insertResult)\n\t\tconst newInverseSide = getInsertPrimary(insertResult)\n\t\tif (newInverseSide) {\n\t\t\treturn newInverseSide\n\t\t}\n\t\treturn AbortDataManipulation\n\t}\n\n\tprivate async connectInternal(\n\t\t{ targetEntity, targetRelation, relation, entity }: Model.OneHasOneOwningContext,\n\t\tcurrentInverseSide: Input.PrimaryValue | undefined,\n\t\tnewInverseSide: Input.PrimaryValue,\n\t\tresult: MutationResultList,\n\t) {\n\n\t\tif (currentInverseSide === newInverseSide) {\n\t\t\tresult.push(new MutationNothingToDo([], NothingToDoReason.alreadyExists))\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst currentOwnerOfNewInverseSide = await this.mapper.getPrimaryValue(entity, {\n\t\t\t[relation.name]: { [targetEntity.primary]: newInverseSide },\n\t\t})\n\n\t\tif (currentOwnerOfNewInverseSide === this.primaryValue) {\n\t\t\tresult.push(new MutationNothingToDo([], NothingToDoReason.alreadyExists))\n\t\t\treturn undefined\n\t\t}\n\n\t\t// orphan removal handled bellow\n\t\tif (targetRelation && !targetRelation.nullable && !relation.orphanRemoval && currentInverseSide) {\n\t\t\tresult.push(new MutationConstraintViolationError([], ConstraintType.notNull))\n\t\t\treturn AbortDataManipulation\n\t\t}\n\n\t\tif (currentOwnerOfNewInverseSide) {\n\t\t\tif (!relation.nullable) {\n\t\t\t\tresult.push(new MutationConstraintViolationError([], ConstraintType.notNull))\n\t\t\t\treturn AbortDataManipulation\n\t\t\t}\n\n\t\t\tconst currentOwnerDisconnect = await this.mapper.updateInternal(\n\t\t\t\tentity,\n\t\t\t\t{\n\t\t\t\t\t[entity.primary]: currentOwnerOfNewInverseSide,\n\t\t\t\t},\n\t\t\t\tbuilder => {\n\t\t\t\t\tbuilder.addPredicates([relation.name])\n\t\t\t\t\tbuilder.addFieldValue(relation.name, null)\n\t\t\t\t},\n\t\t\t)\n\t\t\tresult.push(...currentOwnerDisconnect)\n\t\t}\n\t\treturn newInverseSide\n\t}\n\n\tprivate async getCurrentInverseSide(targetRelation: Model.OneHasOneInverseRelation | null, relation: Model.OneHasOneOwningRelation, entity: Model.Entity) {\n\t\tif ((targetRelation && !targetRelation.nullable) || relation.orphanRemoval) {\n\t\t\treturn this.mapper.selectField(entity, { [entity.primary]: this.primaryValue }, relation.name)\n\t\t}\n\t\treturn undefined\n\t}\n\n\tprivate async cleanupOrphan(relation: Model.OneHasOneOwningRelation, targetEntity: Model.Entity, currentInverseSide: Input.PrimaryValue | undefined) {\n\t\tif (relation.orphanRemoval && currentInverseSide) {\n\t\t\tawait this.updateBuilder.update\n\t\t\treturn await this.mapper.delete(targetEntity, { [targetEntity.primary]: currentInverseSide })\n\t\t}\n\t\treturn []\n\t}\n\n\tpublic async update({ entity, relation, targetEntity, input }: Model.OneHasOneOwningContext & { input: Input.UpdateDataInput }) {\n\t\tconst inversePrimary = await this.mapper.selectField(\n\t\t\tentity,\n\t\t\t{ [entity.primary]: this.primaryValue },\n\t\t\trelation.name,\n\t\t)\n\t\tif (!inversePrimary) {\n\t\t\treturn [new MutationNothingToDo([], NothingToDoReason.emptyRelation)]\n\t\t}\n\t\treturn await this.mapper.update(targetEntity, { [targetEntity.primary]: inversePrimary }, input)\n\t}\n\n\tpublic async upsert({ entity, relation, targetEntity, input: { create, update } }: Model.OneHasOneOwningContext & { input: UpdateInputProcessor.UpsertInput }) {\n\t\tconst select = this.mapper.selectField(entity, { [entity.primary]: this.primaryValue }, relation.name)\n\n\t\tconst result: MutationResultList = []\n\t\t//addColumnData has to be called synchronously\n\t\tawait this.updateBuilder.addFieldValue(relation.name, async () => {\n\t\t\tconst primary = await select\n\t\t\tif (primary) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tconst insertResult = await this.mapper.insert(targetEntity, create)\n\t\t\tconst insertPrimary = getInsertPrimary(insertResult)\n\t\t\tif (insertPrimary) {\n\t\t\t\treturn insertPrimary\n\t\t\t}\n\t\t\tresult.push(...insertResult)\n\t\t\treturn AbortDataManipulation\n\t\t})\n\n\t\tconst inversePrimary = await select\n\t\tif (inversePrimary) {\n\t\t\treturn await this.mapper.update(targetEntity, { [targetEntity.primary]: inversePrimary }, update)\n\t\t}\n\t\treturn result\n\t}\n\n\tpublic async disconnect({ entity, targetEntity, relation, targetRelation }: Model.OneHasOneOwningContext & { input: undefined }) {\n\t\tif (!relation.nullable) {\n\t\t\treturn [new MutationConstraintViolationError([], ConstraintType.notNull)]\n\t\t}\n\t\tconst result: MutationResultList = []\n\n\t\tconst currentInverseSide = (targetRelation && !targetRelation.nullable) || relation.orphanRemoval\n\t\t\t? this.mapper.selectField(entity, { [entity.primary]: this.primaryValue }, relation.name)\n\t\t\t: Promise.resolve(undefined)\n\n\t\tthis.updateBuilder.addFieldValue(relation.name, async () => {\n\t\t\tconst inversePrimary = await currentInverseSide\n\t\t\tif (inversePrimary && targetRelation && !targetRelation.nullable && !relation.orphanRemoval) {\n\t\t\t\tresult.push(new MutationConstraintViolationError([], ConstraintType.notNull))\n\t\t\t\treturn AbortDataManipulation\n\t\t\t}\n\t\t\treturn null\n\t\t})\n\t\tif (relation.orphanRemoval) {\n\t\t\tconst inversePrimary = await currentInverseSide\n\t\t\tif (inversePrimary) {\n\t\t\t\tawait this.updateBuilder.update\n\t\t\t\tconst deleteOrphanedInverseSide = await this.mapper.delete(targetEntity, { [targetEntity.primary]: inversePrimary })\n\t\t\t\tresult.push(...deleteOrphanedInverseSide)\n\t\t\t}\n\t\t}\n\t\treturn result\n\t}\n\n\tpublic async delete({ entity, targetEntity, relation, targetRelation }: Model.OneHasOneOwningContext & { input: undefined }) {\n\t\tif (!relation.nullable && relation.joiningColumn.onDelete !== Model.OnDelete.cascade) {\n\t\t\treturn [new MutationConstraintViolationError([], ConstraintType.notNull)]\n\t\t}\n\t\tif (relation.joiningColumn.onDelete === Model.OnDelete.restrict) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t'[DEPRECATED] You are deleting an entity over the relation where onDelete behaviour is set to restrict. This will fail in next version.',\n\t\t\t)\n\t\t\tthis.updateBuilder.addFieldValue(relation.name, null)\n\t\t}\n\t\tconst targetPrimary = await this.mapper.selectField(\n\t\t\tentity,\n\t\t\t{ [entity.primary]: this.primaryValue },\n\t\t\trelation.name,\n\t\t)\n\t\tif (!targetPrimary) {\n\t\t\treturn [new MutationNothingToDo([], NothingToDoReason.emptyRelation)]\n\t\t}\n\t\tawait this.updateBuilder.update\n\t\treturn await this.mapper.delete(targetEntity, new CheckedPrimary(targetPrimary))\n\t}\n}\n"],"names":["newInverseSide"],"mappings":";;;;AAgBO,MAAM,oCAAoC;AAAA,EAChD,YACkB,cACA,QACA,eAChB;AAHgB,SAAA,eAAA;AACA,SAAA,SAAA;AACA,SAAA,gBAAA;AAAA,EAElB;AAAA,EAEA,MAAa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Ae,aAAa,CAAC;AAAA,EAChF;AACD;"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Value } from '@contember/schema';
|
|
2
|
-
export interface DataManipulationBuilder {
|
|
3
|
-
addFieldValue(fieldName: string, value: Value.GenericValueLike<Value.AtomicValue<AbortDataManipulation | undefined>>): Promise<Value.AtomicValue<AbortDataManipulation | undefined>>;
|
|
4
|
-
}
|
|
5
|
-
export declare const AbortDataManipulation: unique symbol;
|
|
6
|
-
export type AbortDataManipulation = typeof AbortDataManipulation;
|
|
7
|
-
//# sourceMappingURL=DataManipulationBuilder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataManipulationBuilder.d.ts","sourceRoot":"","sources":["../../../src/mapper/DataManipulationBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzC,MAAM,WAAW,uBAAuB;IACvC,aAAa,CACZ,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,WAAW,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAAC,GACjF,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAAC,CAAA;CAChE;AAGD,eAAO,MAAM,qBAAqB,eAAkC,CAAA;AACpE,MAAM,MAAM,qBAAqB,GAAG,OAAO,qBAAqB,CAAA"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { UpdateInputProcessor } from '../../inputProcessing';
|
|
2
|
-
import { Input, Model } from '@contember/schema';
|
|
3
|
-
import { MutationResultList } from '../Result';
|
|
4
|
-
import { Mapper } from '../Mapper';
|
|
5
|
-
type RelationContext = Model.ManyHasManyOwningContext | Model.ManyHasManyInverseContext;
|
|
6
|
-
export declare class ManyHasManyInputProcessor {
|
|
7
|
-
private readonly mapper;
|
|
8
|
-
constructor(mapper: Mapper);
|
|
9
|
-
connect({ entity, targetEntity, relation, targetRelation, input }: RelationContext & {
|
|
10
|
-
input: Input.UniqueWhere;
|
|
11
|
-
}, primary: Input.PrimaryValue): Promise<MutationResultList>;
|
|
12
|
-
create({ entity, targetEntity, relation, input }: RelationContext & {
|
|
13
|
-
input: Input.CreateDataInput;
|
|
14
|
-
}, primary: Input.PrimaryValue): Promise<MutationResultList>;
|
|
15
|
-
connectOrCreate(context: RelationContext & {
|
|
16
|
-
input: Input.ConnectOrCreateInput;
|
|
17
|
-
}, primary: Input.PrimaryValue): Promise<MutationResultList>;
|
|
18
|
-
update({ entity, targetEntity, relation, input: { where, data } }: RelationContext & {
|
|
19
|
-
input: UpdateInputProcessor.UpdateManyInput;
|
|
20
|
-
}, primary: Input.PrimaryValue): Promise<import("../Result").MutationResult[]>;
|
|
21
|
-
upsert({ entity, relation, targetEntity, input: { create, update, where } }: RelationContext & {
|
|
22
|
-
input: UpdateInputProcessor.UpsertManyInput;
|
|
23
|
-
}, primary: Input.PrimaryValue): Promise<MutationResultList>;
|
|
24
|
-
disconnect({ entity, targetEntity, relation, input }: RelationContext & {
|
|
25
|
-
input: Input.UniqueWhere;
|
|
26
|
-
}, primary: Input.PrimaryValue): Promise<MutationResultList>;
|
|
27
|
-
delete({ entity, targetEntity, relation, targetRelation, input }: RelationContext & {
|
|
28
|
-
input: Input.UniqueWhere;
|
|
29
|
-
}, primary: Input.PrimaryValue): Promise<MutationResultList>;
|
|
30
|
-
}
|
|
31
|
-
export {};
|
|
32
|
-
//# sourceMappingURL=ManyHasManyInputProcessor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ManyHasManyInputProcessor.d.ts","sourceRoot":"","sources":["../../../../src/mapper/relations/ManyHasManyInputProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAgD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B,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,eAAe,GAAG;QAAE,KAAK,EAAE,KAAK,CAAC,WAAW,CAAA;KAAE,EACzF,OAAO,EAAE,KAAK,CAAC,YAAY;IAUf,MAAM,CAClB,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,eAAe,GAAG;QAAE,KAAK,EAAE,KAAK,CAAC,WAAW,CAAA;KAAE,EACzG,OAAO,EAAE,KAAK,CAAC,YAAY;CAI5B"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { UpdateInputProcessor } from '../../inputProcessing';
|
|
2
|
-
import { Input, Model } from '@contember/schema';
|
|
3
|
-
import { MutationConstraintViolationError, MutationResultList } from '../Result';
|
|
4
|
-
import { Mapper } from '../Mapper';
|
|
5
|
-
import { DataManipulationBuilder } from '../DataManipulationBuilder';
|
|
6
|
-
import { UpdateBuilder } from '../update';
|
|
7
|
-
export declare class ManyHasOneInputProcessor {
|
|
8
|
-
private readonly mapper;
|
|
9
|
-
constructor(mapper: Mapper);
|
|
10
|
-
connect({ targetEntity, relation, input }: Model.ManyHasOneContext & {
|
|
11
|
-
input: Input.UniqueWhere;
|
|
12
|
-
}, builder: DataManipulationBuilder): Promise<MutationResultList>;
|
|
13
|
-
create({ relation, targetEntity, input }: Model.ManyHasOneContext & {
|
|
14
|
-
input: Input.CreateDataInput;
|
|
15
|
-
}, builder: DataManipulationBuilder): Promise<MutationResultList>;
|
|
16
|
-
connectOrCreate({ input: { connect, create }, relation, targetEntity }: Model.ManyHasOneContext & {
|
|
17
|
-
input: Input.ConnectOrCreateInput;
|
|
18
|
-
}, builder: DataManipulationBuilder): Promise<MutationResultList>;
|
|
19
|
-
update({ entity, relation, targetEntity, targetRelation, input }: Model.ManyHasOneContext & {
|
|
20
|
-
input: Input.UpdateDataInput;
|
|
21
|
-
}, primary: Input.PrimaryValue): Promise<MutationResultList>;
|
|
22
|
-
upsert({ entity, relation, targetEntity, input: { create, update } }: Model.ManyHasOneContext & {
|
|
23
|
-
input: UpdateInputProcessor.UpsertInput;
|
|
24
|
-
}, builder: DataManipulationBuilder, primary: Input.PrimaryValue): Promise<MutationResultList>;
|
|
25
|
-
disconnect({ entity, targetEntity, relation, targetRelation }: Model.ManyHasOneContext & {
|
|
26
|
-
input: undefined;
|
|
27
|
-
}, builder: DataManipulationBuilder): Promise<MutationConstraintViolationError[]>;
|
|
28
|
-
delete({ entity, targetEntity, relation, targetRelation }: Model.ManyHasOneContext & {
|
|
29
|
-
input: undefined;
|
|
30
|
-
}, builder: UpdateBuilder, primary: Input.PrimaryValue): Promise<MutationResultList>;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=ManyHasOneInputProcessor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ManyHasOneInputProcessor.d.ts","sourceRoot":"","sources":["../../../../src/mapper/relations/ManyHasOneInputProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAGN,gCAAgC,EAGhC,kBAAkB,EAElB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAyB,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAEzC,qBAAa,wBAAwB;IAGnC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAInB,OAAO,CACnB,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,iBAAiB,GAAG;QAAE,KAAK,EAAE,KAAK,CAAC,WAAW,CAAA;KAAE,EACzF,OAAO,EAAE,uBAAuB;IAc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 +0,0 @@
|
|
|
1
|
-
import { UpdateInputProcessor } from '../../inputProcessing';
|
|
2
|
-
import { Input, Model } from '@contember/schema';
|
|
3
|
-
import { Mapper } from '../Mapper';
|
|
4
|
-
export declare class OneHasManyInputProcessor {
|
|
5
|
-
private readonly mapper;
|
|
6
|
-
constructor(mapper: Mapper);
|
|
7
|
-
connect({ entity, targetEntity, targetRelation, input }: Model.OneHasManyContext & {
|
|
8
|
-
input: Input.UniqueWhere;
|
|
9
|
-
}, primary: Input.PrimaryValue): Promise<import("../Result").MutationResultList>;
|
|
10
|
-
create({ entity, targetEntity, targetRelation, input }: Model.OneHasManyContext & {
|
|
11
|
-
input: Input.CreateDataInput;
|
|
12
|
-
}, primary: Input.PrimaryValue): Promise<import("../Result").MutationResultList>;
|
|
13
|
-
connectOrCreate({ entity, targetRelation, targetEntity, input: { connect, create } }: Model.OneHasManyContext & {
|
|
14
|
-
input: Input.ConnectOrCreateInput;
|
|
15
|
-
}, primary: Input.PrimaryValue): Promise<import("../Result").MutationResultList>;
|
|
16
|
-
update({ entity, targetEntity, targetRelation, input: { data, where } }: Model.OneHasManyContext & {
|
|
17
|
-
input: UpdateInputProcessor.UpdateManyInput;
|
|
18
|
-
}, primary: Input.PrimaryValue): Promise<import("../Result").MutationResultList>;
|
|
19
|
-
upsert({ entity, targetEntity, targetRelation, input: { create, update, where } }: Model.OneHasManyContext & {
|
|
20
|
-
input: UpdateInputProcessor.UpsertManyInput;
|
|
21
|
-
}, primary: Input.PrimaryValue): Promise<import("../Result").MutationResultList>;
|
|
22
|
-
disconnect({ entity, targetEntity, relation, targetRelation, input }: Model.OneHasManyContext & {
|
|
23
|
-
input: Input.UniqueWhere;
|
|
24
|
-
}, primary: Input.PrimaryValue): Promise<import("../Result").MutationResultList>;
|
|
25
|
-
delete({ entity, targetEntity, relation, targetRelation, input }: Model.OneHasManyContext & {
|
|
26
|
-
input: Input.UniqueWhere;
|
|
27
|
-
}, primary: Input.PrimaryValue): Promise<import("../Result").MutationResultList>;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=OneHasManyInputProcessor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OneHasManyInputProcessor.d.ts","sourceRoot":"","sources":["../../../../src/mapper/relations/OneHasManyInputProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGlC,qBAAa,wBAAwB;IAEnC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAInB,OAAO,CACnB,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,iBAAiB,GAAG;QAAE,KAAK,EAAE,KAAK,CAAC,WAAW,CAAA;KAAE,EACvG,OAAO,EAAE,KAAK,CAAC,YAAY;IAOf,MAAM,CAClB,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,iBAAiB,GAAG;QAAE,KAAK,EAAE,KAAK,CAAC,eAAe,CAAA;KAAE,EAC3G,OAAO,EAAE,KAAK,CAAC,YAAY;IAQf,eAAe,CAC3B,EAAE,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,CAAC,iBAAiB,GAAG;QAAE,KAAK,EAAE,KAAK,CAAC,oBAAoB,CAAA;KAAE,EACrI,OAAO,EAAE,KAAK,CAAC,YAAY;IAaf,MAAM,CAClB,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,CAAC,iBAAiB,GAAG;QAAE,KAAK,EAAE,oBAAoB,CAAC,eAAe,CAAA;KAAE,EAC3I,OAAO,EAAE,KAAK,CAAC,YAAY;IAYf,MAAM,CAClB,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,CAAC,iBAAiB,GAAG;QAAE,KAAK,EAAE,oBAAoB,CAAC,eAAe,CAAA;KAAE,EACrJ,OAAO,EAAE,KAAK,CAAC,YAAY;IAmBf,UAAU,CACtB,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,iBAAiB,GAAG;QAAE,KAAK,EAAE,KAAK,CAAC,WAAW,CAAA;KAAE,EACjH,OAAO,EAAE,KAAK,CAAC,YAAY;IASf,MAAM,CAClB,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,iBAAiB,GAAG;QAAE,KAAK,EAAE,KAAK,CAAC,WAAW,CAAA;KAAE,EACjH,OAAO,EAAE,KAAK,CAAC,YAAY;CAO5B"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { InsertBuilder } from '../insert';
|
|
2
|
-
import { Mapper } from '../Mapper';
|
|
3
|
-
import { MutationResultList } from '../Result';
|
|
4
|
-
import { Input, Model } from '@contember/schema';
|
|
5
|
-
export declare class OneHasOneInverseCreateInputProcessor {
|
|
6
|
-
private readonly insertBuilder;
|
|
7
|
-
private readonly mapper;
|
|
8
|
-
constructor(insertBuilder: InsertBuilder, mapper: Mapper);
|
|
9
|
-
connect(context: Model.OneHasOneInverseContext & {
|
|
10
|
-
input: Input.UniqueWhere;
|
|
11
|
-
}): Promise<import("../Result").MutationResult[]>;
|
|
12
|
-
create(context: Model.OneHasOneInverseContext & {
|
|
13
|
-
input: Input.CreateDataInput;
|
|
14
|
-
}): Promise<MutationResultList>;
|
|
15
|
-
connectOrCreate({ input, ...context }: Model.OneHasOneInverseContext & {
|
|
16
|
-
input: Input.ConnectOrCreateInput;
|
|
17
|
-
}): Promise<MutationResultList>;
|
|
18
|
-
private connectInternal;
|
|
19
|
-
private createInternal;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=OneHasOneInverseCreateInputProcessor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OneHasOneInverseCreateInputProcessor.d.ts","sourceRoot":"","sources":["../../../../src/mapper/relations/OneHasOneInverseCreateInputProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAIN,kBAAkB,EAClB,MAAM,WAAW,CAAA;AAElB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEhD,qBAAa,oCAAoC;IAE/C,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM;IAInB,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,uBAAuB,GAAG;QAAE,KAAK,EAAE,KAAK,CAAC,WAAW,CAAA;KAAE;IAe7E,MAAM,CAClB,OAAO,EAAE,KAAK,CAAC,uBAAuB,GAAG;QAAE,KAAK,EAAE,KAAK,CAAC,eAAe,CAAA;KAAE;IAY7D,eAAe,CAC3B,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,EAAE,KAAK,CAAC,uBAAuB,GAAG;QAAE,KAAK,EAAE,KAAK,CAAC,oBAAoB,CAAA;KAAE;YAc/E,eAAe;YA4Bf,cAAc;CAS5B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OneHasOneInverseUpdateInputProcessor.d.ts","sourceRoot":"","sources":["../../../../src/mapper/relations/OneHasOneInverseUpdateInputPro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AS,CAAA;KAAE;IA4BnH,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,KAAK,CAAC,uBAAuB,GAAG;QAAE,KAAK,EAAE,SAAS,CAAA;KAAE;CAO5H"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { MutationResultList } from '../Result';
|
|
2
|
-
import { InsertBuilder } from '../insert';
|
|
3
|
-
import { Mapper } from '../Mapper';
|
|
4
|
-
import { Input, Model } from '@contember/schema';
|
|
5
|
-
export declare class OneHasOneOwningCreateInputProcessor {
|
|
6
|
-
private readonly insertBuilder;
|
|
7
|
-
private readonly mapper;
|
|
8
|
-
constructor(insertBuilder: InsertBuilder, mapper: Mapper);
|
|
9
|
-
connect(context: Model.OneHasOneOwningContext & {
|
|
10
|
-
input: Input.UniqueWhere;
|
|
11
|
-
}): Promise<MutationResultList>;
|
|
12
|
-
create(context: Model.OneHasOneOwningContext & {
|
|
13
|
-
input: Input.CreateDataInput;
|
|
14
|
-
}): Promise<MutationResultList>;
|
|
15
|
-
connectOrCreate({ input, ...context }: Model.OneHasOneOwningContext & {
|
|
16
|
-
input: Input.ConnectOrCreateInput;
|
|
17
|
-
}): Promise<MutationResultList>;
|
|
18
|
-
private createInternal;
|
|
19
|
-
private connectInternal;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=OneHasOneOwningCreateInputProcessor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OneHasOneOwningCreateInputProcessor.d.ts","sourceRoot":"","sources":["../../../../src/mapper/relations/OneHasOneOwningCreateInputProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAKN,kBAAkB,EAClB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBA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Manipulation | undefined>>,
|
|
7
|
-
): Promise<Value.AtomicValue<AbortDataManipulation | undefined>>
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export const AbortDataManipulation = Symbol('AbortDataManipulation')
|
|
12
|
-
export type AbortDataManipulation = typeof AbortDataManipulation
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { UpdateInputProcessor } from '../../inputProcessing'
|
|
2
|
-
import { Input, Model } from '@contember/schema'
|
|
3
|
-
import { getInsertPrimary, MutationEntryNotFoundError, MutationResultList } from '../Result'
|
|
4
|
-
import { Mapper } from '../Mapper'
|
|
5
|
-
|
|
6
|
-
type RelationContext = Model.ManyHasManyOwningContext | Model.ManyHasManyInverseContext
|
|
7
|
-
|
|
8
|
-
export class ManyHasManyInputProcessor {
|
|
9
|
-
constructor(
|
|
10
|
-
private readonly mapper: Mapper,
|
|
11
|
-
) {
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public async connect(
|
|
15
|
-
{ entity, targetEntity, relation, targetRelation, input }: RelationContext & { input: Input.UniqueWhere },
|
|
16
|
-
primary: Input.PrimaryValue,
|
|
17
|
-
) {
|
|
18
|
-
const otherPrimary = await this.mapper.getPrimaryValue(targetEntity, input)
|
|
19
|
-
if (!otherPrimary) {
|
|
20
|
-
return [new MutationEntryNotFoundError([], input)]
|
|
21
|
-
}
|
|
22
|
-
return await this.mapper.connectJunction(entity, relation, primary, otherPrimary)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public async create(
|
|
26
|
-
{ entity, targetEntity, relation, input }: RelationContext & { input: Input.CreateDataInput },
|
|
27
|
-
primary: Input.PrimaryValue,
|
|
28
|
-
) {
|
|
29
|
-
const insertResult = await this.mapper.insert(targetEntity, input)
|
|
30
|
-
const insertPrimary = getInsertPrimary(insertResult)
|
|
31
|
-
if (!insertPrimary) {
|
|
32
|
-
return insertResult
|
|
33
|
-
}
|
|
34
|
-
return [
|
|
35
|
-
...insertResult,
|
|
36
|
-
...(await this.mapper.connectJunction(entity, relation, primary, insertPrimary)),
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
public async connectOrCreate(
|
|
41
|
-
context: RelationContext & { input: Input.ConnectOrCreateInput },
|
|
42
|
-
primary: Input.PrimaryValue,
|
|
43
|
-
): Promise<MutationResultList> {
|
|
44
|
-
let otherPrimary = await this.mapper.getPrimaryValue(context.targetEntity, context.input.connect)
|
|
45
|
-
if (!otherPrimary) {
|
|
46
|
-
const insertResult = await this.mapper.insert(context.targetEntity, context.input.create)
|
|
47
|
-
otherPrimary = getInsertPrimary(insertResult)
|
|
48
|
-
if (!otherPrimary) {
|
|
49
|
-
return insertResult
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return await this.mapper.connectJunction(context.entity, context.relation, primary, otherPrimary)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public async update(
|
|
56
|
-
{ entity, targetEntity, relation, input: { where, data } }: RelationContext & { input: UpdateInputProcessor.UpdateManyInput },
|
|
57
|
-
primary: Input.PrimaryValue,
|
|
58
|
-
) {
|
|
59
|
-
const otherPrimary = await this.mapper.getPrimaryValue(targetEntity, where)
|
|
60
|
-
if (!otherPrimary) {
|
|
61
|
-
return [new MutationEntryNotFoundError([], where)]
|
|
62
|
-
}
|
|
63
|
-
return [
|
|
64
|
-
...(await this.mapper.update(targetEntity, { [targetEntity.primary]: otherPrimary }, data)),
|
|
65
|
-
...(await this.mapper.connectJunction(entity, relation, primary, otherPrimary)),
|
|
66
|
-
]
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public async upsert(
|
|
70
|
-
{ entity, relation, targetEntity, input: { create, update, where } }: RelationContext & { input: UpdateInputProcessor.UpsertManyInput },
|
|
71
|
-
primary: Input.PrimaryValue,
|
|
72
|
-
) {
|
|
73
|
-
const otherPrimary = await this.mapper.getPrimaryValue(targetEntity, where)
|
|
74
|
-
if (otherPrimary) {
|
|
75
|
-
const updateResult = await this.mapper.update(targetEntity, { [targetEntity.primary]: otherPrimary }, update)
|
|
76
|
-
const connectResult = await this.mapper.connectJunction(entity, relation, primary, otherPrimary)
|
|
77
|
-
return [...updateResult, ...connectResult]
|
|
78
|
-
} else {
|
|
79
|
-
const insertResult = await this.mapper.insert(targetEntity, create)
|
|
80
|
-
|
|
81
|
-
const primaryValue = getInsertPrimary(insertResult)
|
|
82
|
-
if (!primaryValue) {
|
|
83
|
-
return insertResult
|
|
84
|
-
}
|
|
85
|
-
const connectResult = await this.mapper.connectJunction(entity, relation, primary, primaryValue)
|
|
86
|
-
return [...insertResult, ...connectResult]
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
public async disconnect(
|
|
91
|
-
{ entity, targetEntity, relation, input }: RelationContext & { input: Input.UniqueWhere },
|
|
92
|
-
primary: Input.PrimaryValue,
|
|
93
|
-
) {
|
|
94
|
-
const otherPrimary = await this.mapper.getPrimaryValue(targetEntity, input)
|
|
95
|
-
if (!otherPrimary) {
|
|
96
|
-
return [new MutationEntryNotFoundError([], input)]
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return await this.mapper.disconnectJunction(entity, relation, primary, otherPrimary)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
public async delete(
|
|
103
|
-
{ entity, targetEntity, relation, targetRelation, input }: RelationContext & { input: Input.UniqueWhere },
|
|
104
|
-
primary: Input.PrimaryValue,
|
|
105
|
-
) {
|
|
106
|
-
return await this.mapper.delete(targetEntity, input)
|
|
107
|
-
}
|
|
108
|
-
}
|