@contember/engine-content-api 1.3.0-alpha.1 → 1.3.0-alpha.2
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/src/ExecutionContainer.d.ts +141 -0
- package/dist/src/ExecutionContainer.d.ts.map +1 -0
- package/dist/src/ExecutionContainer.js +84 -0
- package/dist/src/ExecutionContainer.js.map +1 -0
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +18 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/mapper/ColumnValue.d.ts +2 -2
- package/dist/src/mapper/ColumnValue.d.ts.map +1 -1
- package/dist/src/mapper/EventManager.d.ts +86 -0
- package/dist/src/mapper/EventManager.d.ts.map +1 -0
- package/dist/src/mapper/EventManager.js +118 -0
- package/dist/src/mapper/EventManager.js.map +1 -0
- package/dist/src/mapper/JunctionTableManager.d.ts +12 -11
- package/dist/src/mapper/JunctionTableManager.d.ts.map +1 -1
- package/dist/src/mapper/JunctionTableManager.js +20 -8
- package/dist/src/mapper/JunctionTableManager.js.map +1 -1
- package/dist/src/mapper/Mapper.d.ts +11 -6
- package/dist/src/mapper/Mapper.d.ts.map +1 -1
- package/dist/src/mapper/Mapper.js +34 -17
- package/dist/src/mapper/Mapper.js.map +1 -1
- package/dist/src/mapper/MapperFactory.d.ts +33 -0
- package/dist/src/mapper/MapperFactory.d.ts.map +1 -0
- package/dist/src/mapper/MapperFactory.js +40 -0
- package/dist/src/mapper/MapperFactory.js.map +1 -0
- package/dist/src/mapper/Result.d.ts +3 -2
- package/dist/src/mapper/Result.d.ts.map +1 -1
- package/dist/src/mapper/Result.js +2 -1
- package/dist/src/mapper/Result.js.map +1 -1
- package/dist/src/mapper/delete/DeleteExecutor.d.ts.map +1 -1
- package/dist/src/mapper/delete/DeleteExecutor.js +41 -1
- package/dist/src/mapper/delete/DeleteExecutor.js.map +1 -1
- package/dist/src/mapper/index.d.ts +3 -1
- package/dist/src/mapper/index.d.ts.map +1 -1
- package/dist/src/mapper/index.js +3 -1
- package/dist/src/mapper/index.js.map +1 -1
- package/dist/src/mapper/insert/InsertBuilder.d.ts +2 -2
- package/dist/src/mapper/insert/InsertBuilder.d.ts.map +1 -1
- package/dist/src/mapper/insert/InsertBuilder.js +8 -2
- package/dist/src/mapper/insert/InsertBuilder.js.map +1 -1
- package/dist/src/mapper/insert/Inserter.js +3 -3
- package/dist/src/mapper/insert/Inserter.js.map +1 -1
- package/dist/src/mapper/select/OrderByHelper.d.ts +1 -1
- package/dist/src/mapper/select/OrderByHelper.d.ts.map +1 -1
- package/dist/src/mapper/select/OrderByHelper.js +3 -1
- package/dist/src/mapper/select/OrderByHelper.js.map +1 -1
- package/dist/src/mapper/select/RelationFetcher.js +2 -2
- package/dist/src/mapper/select/RelationFetcher.js.map +1 -1
- package/dist/src/mapper/update/UpdateBuilder.d.ts +4 -4
- package/dist/src/mapper/update/UpdateBuilder.d.ts.map +1 -1
- package/dist/src/mapper/update/UpdateBuilder.js +26 -8
- package/dist/src/mapper/update/UpdateBuilder.js.map +1 -1
- package/dist/src/mapper/update/UpdateBuilderFactory.d.ts +1 -1
- package/dist/src/mapper/update/UpdateBuilderFactory.d.ts.map +1 -1
- package/dist/src/mapper/update/UpdateBuilderFactory.js +2 -2
- package/dist/src/mapper/update/UpdateBuilderFactory.js.map +1 -1
- package/dist/src/mapper/update/Updater.d.ts.map +1 -1
- package/dist/src/mapper/update/Updater.js +6 -10
- package/dist/src/mapper/update/Updater.js.map +1 -1
- package/dist/src/resolvers/GraphQlQueryAstFactory.d.ts +1 -3
- package/dist/src/resolvers/GraphQlQueryAstFactory.d.ts.map +1 -1
- package/dist/src/resolvers/GraphQlQueryAstFactory.js +1 -4
- package/dist/src/resolvers/GraphQlQueryAstFactory.js.map +1 -1
- package/dist/src/resolvers/MutationResolver.d.ts +1 -4
- package/dist/src/resolvers/MutationResolver.d.ts.map +1 -1
- package/dist/src/resolvers/MutationResolver.js +9 -11
- package/dist/src/resolvers/MutationResolver.js.map +1 -1
- package/dist/src/resolvers/ReadResolver.d.ts +1 -3
- package/dist/src/resolvers/ReadResolver.d.ts.map +1 -1
- package/dist/src/resolvers/ReadResolver.js +6 -10
- package/dist/src/resolvers/ReadResolver.js.map +1 -1
- package/dist/src/resolvers/ValidationResolver.d.ts +1 -3
- package/dist/src/resolvers/ValidationResolver.d.ts.map +1 -1
- package/dist/src/resolvers/ValidationResolver.js +3 -4
- package/dist/src/resolvers/ValidationResolver.js.map +1 -1
- package/dist/src/resolvers/index.d.ts +0 -1
- package/dist/src/resolvers/index.d.ts.map +1 -1
- package/dist/src/resolvers/index.js +0 -1
- package/dist/src/resolvers/index.js.map +1 -1
- package/dist/src/schema/CustomTypesProvider.d.ts.map +1 -1
- package/dist/src/schema/CustomTypesProvider.js +1 -23
- package/dist/src/schema/CustomTypesProvider.js.map +1 -1
- package/dist/src/schema/MutationProvider.js +4 -4
- package/dist/src/schema/MutationProvider.js.map +1 -1
- package/dist/src/schema/QueryProvider.js +3 -3
- package/dist/src/schema/QueryProvider.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/src/types.d.ts +2 -3
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tests/cases/bugs/bug-update-by-nested-unique.test.js +3 -5
- package/dist/tests/cases/bugs/bug-update-by-nested-unique.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlDb/insert/insertSequence.test.js +2 -2
- package/dist/tests/cases/integration/graphQlDb/insert/insertSequence.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlDb/update/bug-freeze-connect-missing-one.test.js +1 -1
- package/dist/tests/cases/integration/graphQlDb/update/bug-freeze-connect-missing-one.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlDb/update/deferedConstraints.test.js +45 -45
- package/dist/tests/cases/integration/graphQlDb/update/deferedConstraints.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlDb/update/failedDelete.test.js +5 -5
- package/dist/tests/cases/integration/graphQlDb/update/failedDelete.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlDb/update/invalidInput.test.js +2 -2
- package/dist/tests/cases/integration/graphQlDb/update/invalidInput.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlDb/update/nullChecksNotNull.test.js +7 -7
- package/dist/tests/cases/integration/graphQlDb/update/nullChecksNotNull.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlDb/update/nullChecksNullable.test.js +7 -7
- package/dist/tests/cases/integration/graphQlDb/update/nullChecksNullable.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlDb/update/uniqueConstraint.test.js +2 -2
- package/dist/tests/cases/integration/graphQlDb/update/uniqueConstraint.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/insert/oneHasMany/connect.test.js +3 -3
- package/dist/tests/cases/integration/graphQlRequests/insert/oneHasMany/connect.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/query/sorting/orderBy.test.d.ts +2 -0
- package/dist/tests/cases/integration/graphQlRequests/query/sorting/orderBy.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/graphQlRequests/query/sorting/orderBy.test.js +67 -0
- package/dist/tests/cases/integration/graphQlRequests/query/sorting/orderBy.test.js.map +1 -0
- package/dist/tests/cases/integration/graphQlRequests/update/acl/aclUpdate.test.js +6 -18
- package/dist/tests/cases/integration/graphQlRequests/update/acl/aclUpdate.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/additionalFilter.test.js +3 -4
- package/dist/tests/cases/integration/graphQlRequests/update/additionalFilter.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/basic/columnUpdate.test.js +3 -8
- package/dist/tests/cases/integration/graphQlRequests/update/basic/columnUpdate.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/update.test.js +3 -9
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/update.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/upsert.test.js +3 -9
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/upsert.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/update.test.js +3 -9
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/update.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/upsert.test.js +3 -9
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/upsert.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasOne/connect.test.js +3 -10
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasOne/connect.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasOne/create.test.js +3 -10
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasOne/create.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasOne/disconnect.test.js +3 -9
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasOne/disconnect.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasOne/update.test.js +3 -9
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasOne/update.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasOne/upsert.test.js +6 -18
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasOne/upsert.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasMany/connect.test.js +3 -11
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasMany/connect.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasMany/disconnect.test.js +3 -8
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasMany/disconnect.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasMany/update.test.js +3 -6
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasMany/update.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasMany/upsert.test.js +3 -6
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasMany/upsert.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/connect.test.js +15 -50
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/connect.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/create.test.js +3 -10
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/create.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/disconnect.test.js +3 -10
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/disconnect.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/update.test.js +3 -6
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/update.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/upsert.test.js +3 -7
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/upsert.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/connect.test.js +12 -32
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/connect.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/connectOrCreate.test.js +3 -3
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/connectOrCreate.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/create.test.js +6 -20
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/create.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/disconnect.test.js +3 -10
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/disconnect.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/update.test.js +3 -9
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/update.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/upsert.test.js +6 -19
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/upsert.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/queryPortal.test.js +6 -8
- package/dist/tests/cases/integration/graphQlRequests/update/queryPortal.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/transaction.test.js +9 -24
- package/dist/tests/cases/integration/graphQlRequests/update/transaction.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/upsert/basicUpsert.test.js +3 -7
- package/dist/tests/cases/integration/graphQlRequests/upsert/basicUpsert.test.js.map +1 -1
- package/dist/tests/cases/unit/orderbyHelper.test.js +11 -0
- package/dist/tests/cases/unit/orderbyHelper.test.js.map +1 -1
- package/dist/tests/src/test.d.ts +1 -0
- package/dist/tests/src/test.d.ts.map +1 -1
- package/dist/tests/src/test.js +34 -6
- package/dist/tests/src/test.js.map +1 -1
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -11
- package/src/ExecutionContainer.ts +204 -0
- package/src/index.ts +24 -1
- package/src/mapper/ColumnValue.ts +2 -2
- package/src/mapper/EventManager.ts +158 -0
- package/src/mapper/JunctionTableManager.ts +50 -32
- package/src/mapper/Mapper.ts +39 -21
- package/src/mapper/MapperFactory.ts +67 -0
- package/src/mapper/Result.ts +2 -1
- package/src/mapper/delete/DeleteExecutor.ts +42 -1
- package/src/mapper/index.ts +3 -1
- package/src/mapper/insert/InsertBuilder.ts +12 -2
- package/src/mapper/insert/Inserter.ts +3 -3
- package/src/mapper/select/OrderByHelper.ts +2 -1
- package/src/mapper/select/RelationFetcher.ts +2 -2
- package/src/mapper/update/UpdateBuilder.ts +30 -7
- package/src/mapper/update/UpdateBuilderFactory.ts +2 -2
- package/src/mapper/update/Updater.ts +6 -11
- package/src/resolvers/GraphQlQueryAstFactory.ts +1 -2
- package/src/resolvers/MutationResolver.ts +12 -13
- package/src/resolvers/ReadResolver.ts +5 -9
- package/src/resolvers/ValidationResolver.ts +2 -4
- package/src/resolvers/index.ts +0 -1
- package/src/schema/CustomTypesProvider.ts +2 -27
- package/src/schema/MutationProvider.ts +4 -4
- package/src/schema/QueryProvider.ts +3 -3
- package/src/tsconfig.json +7 -21
- package/src/types.ts +2 -3
- package/tests/cases/bugs/bug-update-by-nested-unique.test.ts +3 -5
- package/tests/cases/integration/graphQlDb/insert/insertSequence.test.ts +2 -2
- package/tests/cases/integration/graphQlDb/update/bug-freeze-connect-missing-one.test.ts +1 -1
- package/tests/cases/integration/graphQlDb/update/deferedConstraints.test.ts +9 -9
- package/tests/cases/integration/graphQlDb/update/failedDelete.test.ts +3 -3
- package/tests/cases/integration/graphQlDb/update/invalidInput.test.ts +2 -2
- package/tests/cases/integration/graphQlDb/update/nullChecksNotNull.test.ts +7 -7
- package/tests/cases/integration/graphQlDb/update/nullChecksNullable.test.ts +7 -7
- package/tests/cases/integration/graphQlDb/update/uniqueConstraint.test.ts +2 -2
- package/tests/cases/integration/graphQlRequests/insert/oneHasMany/connect.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/sorting/orderBy.test.ts +67 -0
- package/tests/cases/integration/graphQlRequests/update/acl/aclUpdate.test.ts +6 -18
- package/tests/cases/integration/graphQlRequests/update/additionalFilter.test.ts +3 -4
- package/tests/cases/integration/graphQlRequests/update/basic/columnUpdate.test.ts +3 -8
- package/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/update.test.ts +3 -9
- package/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/upsert.test.ts +3 -9
- package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/update.test.ts +3 -9
- package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/upsert.test.ts +3 -9
- package/tests/cases/integration/graphQlRequests/update/manyHasOne/connect.test.ts +3 -10
- package/tests/cases/integration/graphQlRequests/update/manyHasOne/create.test.ts +3 -10
- package/tests/cases/integration/graphQlRequests/update/manyHasOne/disconnect.test.ts +3 -9
- package/tests/cases/integration/graphQlRequests/update/manyHasOne/update.test.ts +3 -9
- package/tests/cases/integration/graphQlRequests/update/manyHasOne/upsert.test.ts +6 -18
- package/tests/cases/integration/graphQlRequests/update/oneHasMany/connect.test.ts +3 -11
- package/tests/cases/integration/graphQlRequests/update/oneHasMany/disconnect.test.ts +3 -8
- package/tests/cases/integration/graphQlRequests/update/oneHasMany/update.test.ts +3 -6
- package/tests/cases/integration/graphQlRequests/update/oneHasMany/upsert.test.ts +3 -6
- package/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/connect.test.ts +15 -50
- package/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/create.test.ts +3 -10
- package/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/disconnect.test.ts +3 -10
- package/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/update.test.ts +3 -6
- package/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/upsert.test.ts +3 -7
- package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/connect.test.ts +12 -32
- package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/connectOrCreate.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/create.test.ts +6 -20
- package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/disconnect.test.ts +3 -10
- package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/update.test.ts +3 -9
- package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/upsert.test.ts +6 -19
- package/tests/cases/integration/graphQlRequests/update/queryPortal.test.ts +6 -8
- package/tests/cases/integration/graphQlRequests/update/transaction.test.ts +9 -24
- package/tests/cases/integration/graphQlRequests/upsert/basicUpsert.test.ts +3 -7
- package/tests/cases/unit/orderbyHelper.test.ts +13 -0
- package/tests/src/test.ts +38 -15
- package/tests/tsconfig.json +3 -9
- package/dist/src/mapper/MapperContainer.d.ts +0 -18
- package/dist/src/mapper/MapperContainer.d.ts.map +0 -1
- package/dist/src/mapper/MapperContainer.js +0 -55
- package/dist/src/mapper/MapperContainer.js.map +0 -1
- package/dist/src/resolvers/ExecutionContainerFactory.d.ts +0 -24
- package/dist/src/resolvers/ExecutionContainerFactory.d.ts.map +0 -1
- package/dist/src/resolvers/ExecutionContainerFactory.js +0 -45
- package/dist/src/resolvers/ExecutionContainerFactory.js.map +0 -1
- package/src/mapper/MapperContainer.ts +0 -142
- package/src/resolvers/ExecutionContainerFactory.ts +0 -74
|
@@ -30,11 +30,10 @@ test('applies a filter', async () => {
|
|
|
30
30
|
response: { rows: [{ id: testUuid(1) }] },
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
|
-
sql: SQL`with "
|
|
34
|
-
|
|
35
|
-
update "public"."author" set "name" = "newdata_"."name" from "newdata_" where "author"."id" = "newdata_"."id"`,
|
|
33
|
+
sql: SQL`with "newData_" as (select ? :: text as "name", "root_"."name" as "name_old__", "root_"."id" from "public"."author" as "root_" where "root_"."id" = ? and "root_"."name" = ?)
|
|
34
|
+
update "public"."author" set "name" = "newData_"."name" from "newData_" where "author"."id" = "newData_"."id" returning "name_old__"`,
|
|
36
35
|
parameters: ['John', testUuid(1), 'Jack'],
|
|
37
|
-
response: {
|
|
36
|
+
response: { rows: [{ name_old__: 'Jack' }] },
|
|
38
37
|
},
|
|
39
38
|
{
|
|
40
39
|
sql: SQL`select "root_"."id" as "root_id"
|
|
@@ -29,15 +29,10 @@ test('update name', async () => {
|
|
|
29
29
|
response: { rows: [{ id: testUuid(1) }] },
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
|
-
sql: SQL`with "newData_" as (select
|
|
33
|
-
|
|
34
|
-
"root_"."id"
|
|
35
|
-
from "public"."author" as "root_"
|
|
36
|
-
where "root_"."id" = ?) update "public"."author"
|
|
37
|
-
set "name" = "newData_"."name" from "newData_"
|
|
38
|
-
where "author"."id" = "newData_"."id"`,
|
|
32
|
+
sql: SQL`with "newData_" as (select ? :: text as "name", "root_"."name" as "name_old__", "root_"."id" from "public"."author" as "root_" where "root_"."id" = ?)
|
|
33
|
+
update "public"."author" set "name" = "newData_"."name" from "newData_" where "author"."id" = "newData_"."id" returning "name_old__"`,
|
|
39
34
|
parameters: ['John', testUuid(1)],
|
|
40
|
-
response: {
|
|
35
|
+
response: { rows: [{ name_old__: 'John' }] },
|
|
41
36
|
},
|
|
42
37
|
{
|
|
43
38
|
sql: SQL`select "root_"."id" as "root_id"
|
|
@@ -28,16 +28,10 @@ test('update', async () => {
|
|
|
28
28
|
response: { rows: [{ id: testUuid(1) }] },
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
sql: SQL`with "newData_" as
|
|
32
|
-
|
|
33
|
-
? :: text as "title",
|
|
34
|
-
"root_"."id"
|
|
35
|
-
from "public"."post" as "root_"
|
|
36
|
-
where "root_"."id" = ?) update "public"."post"
|
|
37
|
-
set "title" = "newData_"."title" from "newData_"
|
|
38
|
-
where "post"."id" = "newData_"."id"`,
|
|
31
|
+
sql: SQL`with "newData_" as (select ? :: text as "title", "root_"."title" as "title_old__", "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?)
|
|
32
|
+
update "public"."post" set "title" = "newData_"."title" from "newData_" where "post"."id" = "newData_"."id" returning "title_old__"`,
|
|
39
33
|
parameters: ['Lorem', testUuid(1)],
|
|
40
|
-
response: {
|
|
34
|
+
response: { rows: [{ title_old__: 'Foo bar' }] },
|
|
41
35
|
},
|
|
42
36
|
{
|
|
43
37
|
sql: SQL`insert into "public"."post_categories" ("post_id", "category_id")
|
|
@@ -28,16 +28,10 @@ test('upsert - exists', async () => {
|
|
|
28
28
|
response: { rows: [{ id: testUuid(1) }] },
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
sql: SQL`with "newData_" as
|
|
32
|
-
|
|
33
|
-
? :: text as "title",
|
|
34
|
-
"root_"."id"
|
|
35
|
-
from "public"."post" as "root_"
|
|
36
|
-
where "root_"."id" = ?) update "public"."post"
|
|
37
|
-
set "title" = "newData_"."title" from "newData_"
|
|
38
|
-
where "post"."id" = "newData_"."id"`,
|
|
31
|
+
sql: SQL`with "newData_" as (select ? :: text as "title", "root_"."title" as "title_old__", "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?)
|
|
32
|
+
update "public"."post" set "title" = "newData_"."title" from "newData_" where "post"."id" = "newData_"."id" returning "title_old__"`,
|
|
39
33
|
parameters: ['Lorem', testUuid(1)],
|
|
40
|
-
response: {
|
|
34
|
+
response: { rows: [{ title_old__: 'Foo' }] },
|
|
41
35
|
},
|
|
42
36
|
{
|
|
43
37
|
sql: SQL`insert into "public"."post_categories" ("post_id", "category_id")
|
|
@@ -28,16 +28,10 @@ test('update', async () => {
|
|
|
28
28
|
response: { rows: [{ id: testUuid(1) }] },
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
sql: SQL`with "newData_" as
|
|
32
|
-
|
|
33
|
-
? :: text as "name",
|
|
34
|
-
"root_"."id"
|
|
35
|
-
from "public"."category" as "root_"
|
|
36
|
-
where "root_"."id" = ?) update "public"."category"
|
|
37
|
-
set "name" = "newData_"."name" from "newData_"
|
|
38
|
-
where "category"."id" = "newData_"."id"`,
|
|
31
|
+
sql: SQL`with "newData_" as (select ? :: text as "name", "root_"."name" as "name_old__", "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?)
|
|
32
|
+
update "public"."category" set "name" = "newData_"."name" from "newData_" where "category"."id" = "newData_"."id" returning "name_old__"`,
|
|
39
33
|
parameters: ['Lorem', testUuid(1)],
|
|
40
|
-
response: {
|
|
34
|
+
response: { rows: [{ name_old__: 'Foo' }] },
|
|
41
35
|
},
|
|
42
36
|
{
|
|
43
37
|
sql: SQL`insert into "public"."post_categories" ("post_id", "category_id")
|
|
@@ -28,16 +28,10 @@ test('upsert - exists', async () => {
|
|
|
28
28
|
response: { rows: [{ id: testUuid(1) }] },
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
sql: SQL`with "newData_" as
|
|
32
|
-
|
|
33
|
-
? :: text as "name",
|
|
34
|
-
"root_"."id"
|
|
35
|
-
from "public"."category" as "root_"
|
|
36
|
-
where "root_"."id" = ?) update "public"."category"
|
|
37
|
-
set "name" = "newData_"."name" from "newData_"
|
|
38
|
-
where "category"."id" = "newData_"."id"`,
|
|
31
|
+
sql: SQL`with "newData_" as (select ? :: text as "name", "root_"."name" as "name_old__", "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?)
|
|
32
|
+
update "public"."category" set "name" = "newData_"."name" from "newData_" where "category"."id" = "newData_"."id" returning "name_old__"`,
|
|
39
33
|
parameters: ['Lorem', testUuid(1)],
|
|
40
|
-
response: {
|
|
34
|
+
response: { rows: [{ name_old__: 'Foo' }] },
|
|
41
35
|
},
|
|
42
36
|
{
|
|
43
37
|
sql: SQL`insert into "public"."post_categories" ("post_id", "category_id")
|
|
@@ -28,17 +28,10 @@ test('connect', async () => {
|
|
|
28
28
|
response: { rows: [{ id: testUuid(1) }] },
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
sql: SQL`with "newData_" as
|
|
32
|
-
|
|
33
|
-
? :: uuid as "author_id",
|
|
34
|
-
"root_"."id",
|
|
35
|
-
"root_"."title"
|
|
36
|
-
from "public"."post" as "root_"
|
|
37
|
-
where "root_"."id" = ?) update "public"."post"
|
|
38
|
-
set "author_id" = "newData_"."author_id" from "newData_"
|
|
39
|
-
where "post"."id" = "newData_"."id"`,
|
|
31
|
+
sql: SQL`with "newData_" as (select ? :: uuid as "author_id", "root_"."author_id" as "author_id_old__", "root_"."id", "root_"."title" from "public"."post" as "root_" where "root_"."id" = ?)
|
|
32
|
+
update "public"."post" set "author_id" = "newData_"."author_id" from "newData_" where "post"."id" = "newData_"."id" returning "author_id_old__"`,
|
|
40
33
|
parameters: [testUuid(1), testUuid(2)],
|
|
41
|
-
response: {
|
|
34
|
+
response: { rows: [{ author_id_old__: testUuid(99) }] },
|
|
42
35
|
},
|
|
43
36
|
]),
|
|
44
37
|
],
|
|
@@ -39,17 +39,10 @@ test('create', async () => {
|
|
|
39
39
|
},
|
|
40
40
|
|
|
41
41
|
{
|
|
42
|
-
sql: SQL`with "newData_" as
|
|
43
|
-
|
|
44
|
-
? :: uuid as "author_id",
|
|
45
|
-
"root_"."id",
|
|
46
|
-
"root_"."title"
|
|
47
|
-
from "public"."post" as "root_"
|
|
48
|
-
where "root_"."id" = ?) update "public"."post"
|
|
49
|
-
set "author_id" = "newData_"."author_id" from "newData_"
|
|
50
|
-
where "post"."id" = "newData_"."id"`,
|
|
42
|
+
sql: SQL`with "newData_" as (select ? :: uuid as "author_id", "root_"."author_id" as "author_id_old__", "root_"."id", "root_"."title" from "public"."post" as "root_" where "root_"."id" = ?)
|
|
43
|
+
update "public"."post" set "author_id" = "newData_"."author_id" from "newData_" where "post"."id" = "newData_"."id" returning "author_id_old__"`,
|
|
51
44
|
parameters: [testUuid(1), testUuid(2)],
|
|
52
|
-
response: {
|
|
45
|
+
response: { rows: [{ author_id_old__: testUuid(99) }] },
|
|
53
46
|
},
|
|
54
47
|
]),
|
|
55
48
|
],
|
|
@@ -23,16 +23,10 @@ test('disconnect', async () => {
|
|
|
23
23
|
response: { rows: [{ id: testUuid(2) }] },
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
sql: SQL`with "newData_" as
|
|
27
|
-
|
|
28
|
-
? :: uuid as "author_id",
|
|
29
|
-
"root_"."id"
|
|
30
|
-
from "public"."post" as "root_"
|
|
31
|
-
where "root_"."id" = ?) update "public"."post"
|
|
32
|
-
set "author_id" = "newData_"."author_id" from "newData_"
|
|
33
|
-
where "post"."id" = "newData_"."id"`,
|
|
26
|
+
sql: SQL`with "newData_" as (select ? :: uuid as "author_id", "root_"."author_id" as "author_id_old__", "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?)
|
|
27
|
+
update "public"."post" set "author_id" = "newData_"."author_id" from "newData_" where "post"."id" = "newData_"."id" returning "author_id_old__"`,
|
|
34
28
|
parameters: [null, testUuid(2)],
|
|
35
|
-
response: {
|
|
29
|
+
response: { rows: [{ author_id_old__: testUuid(99) }] },
|
|
36
30
|
},
|
|
37
31
|
]),
|
|
38
32
|
],
|
|
@@ -37,16 +37,10 @@ test('update', async () => {
|
|
|
37
37
|
response: { rows: [{ id: testUuid(1) }] },
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
|
-
sql: SQL`with "newData_" as
|
|
41
|
-
|
|
42
|
-
? :: text as "name",
|
|
43
|
-
"root_"."id"
|
|
44
|
-
from "public"."author" as "root_"
|
|
45
|
-
where "root_"."id" = ?) update "public"."author"
|
|
46
|
-
set "name" = "newData_"."name" from "newData_"
|
|
47
|
-
where "author"."id" = "newData_"."id"`,
|
|
40
|
+
sql: SQL`with "newData_" as (select ? :: text as "name", "root_"."name" as "name_old__", "root_"."id" from "public"."author" as "root_" where "root_"."id" = ?)
|
|
41
|
+
update "public"."author" set "name" = "newData_"."name" from "newData_" where "author"."id" = "newData_"."id" returning "name_old__"`,
|
|
48
42
|
parameters: ['John', testUuid(1)],
|
|
49
|
-
response: {
|
|
43
|
+
response: { rows: [{ name_old__: 'Jack' }] },
|
|
50
44
|
},
|
|
51
45
|
]),
|
|
52
46
|
],
|
|
@@ -37,15 +37,10 @@ test('upsert - exists', async () => {
|
|
|
37
37
|
response: { rows: [{ id: testUuid(1) }] },
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
|
-
sql: SQL`with "newData_" as (select
|
|
41
|
-
|
|
42
|
-
"root_"."id"
|
|
43
|
-
from "public"."author" as "root_"
|
|
44
|
-
where "root_"."id" = ?) update "public"."author"
|
|
45
|
-
set "name" = "newData_"."name" from "newData_"
|
|
46
|
-
where "author"."id" = "newData_"."id"`,
|
|
40
|
+
sql: SQL`with "newData_" as (select ? :: text as "name", "root_"."name" as "name_old__", "root_"."id" from "public"."author" as "root_" where "root_"."id" = ?)
|
|
41
|
+
update "public"."author" set "name" = "newData_"."name" from "newData_" where "author"."id" = "newData_"."id" returning "name_old__"`,
|
|
47
42
|
parameters: ['Jack', testUuid(1)],
|
|
48
|
-
response: {
|
|
43
|
+
response: { rows: [{ name_old__: 'John' }] },
|
|
49
44
|
},
|
|
50
45
|
]),
|
|
51
46
|
],
|
|
@@ -97,17 +92,10 @@ test('upsert - not exists', async () => {
|
|
|
97
92
|
response: { rows: [{ id: testUuid(1) }] },
|
|
98
93
|
},
|
|
99
94
|
{
|
|
100
|
-
sql: SQL`with "newData_" as
|
|
101
|
-
|
|
102
|
-
? :: uuid as "author_id",
|
|
103
|
-
"root_"."id",
|
|
104
|
-
"root_"."title"
|
|
105
|
-
from "public"."post" as "root_"
|
|
106
|
-
where "root_"."id" = ?) update "public"."post"
|
|
107
|
-
set "author_id" = "newData_"."author_id" from "newData_"
|
|
108
|
-
where "post"."id" = "newData_"."id"`,
|
|
95
|
+
sql: SQL`with "newData_" as (select ? :: uuid as "author_id", "root_"."author_id" as "author_id_old__", "root_"."id", "root_"."title" from "public"."post" as "root_" where "root_"."id" = ?)
|
|
96
|
+
update "public"."post" set "author_id" = "newData_"."author_id" from "newData_" where "post"."id" = "newData_"."id" returning "author_id_old__"`,
|
|
109
97
|
parameters: [testUuid(1), testUuid(2)],
|
|
110
|
-
response: {
|
|
98
|
+
response: { rows: [{ author_id_old__: null }] },
|
|
111
99
|
},
|
|
112
100
|
]),
|
|
113
101
|
],
|
|
@@ -28,18 +28,10 @@ test('connect', async () => {
|
|
|
28
28
|
response: { rows: [{ id: testUuid(1) }] },
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
sql: SQL`with "newData_" as
|
|
32
|
-
|
|
33
|
-
? :: uuid as "post_id",
|
|
34
|
-
"root_"."id",
|
|
35
|
-
"root_"."title",
|
|
36
|
-
"root_"."locale"
|
|
37
|
-
from "public"."post_locale" as "root_"
|
|
38
|
-
where "root_"."id" = ?) update "public"."post_locale"
|
|
39
|
-
set "post_id" = "newData_"."post_id" from "newData_"
|
|
40
|
-
where "post_locale"."id" = "newData_"."id"`,
|
|
31
|
+
sql: SQL`with "newData_" as (select ? :: uuid as "post_id", "root_"."post_id" as "post_id_old__", "root_"."id", "root_"."title", "root_"."locale" from "public"."post_locale" as "root_" where "root_"."id" = ?)
|
|
32
|
+
update "public"."post_locale" set "post_id" = "newData_"."post_id" from "newData_" where "post_locale"."id" = "newData_"."id" returning "post_id_old__"`,
|
|
41
33
|
parameters: [testUuid(2), testUuid(1)],
|
|
42
|
-
response: {
|
|
34
|
+
response: { rows: [{ post_id__old: testUuid(99) }] },
|
|
43
35
|
},
|
|
44
36
|
]),
|
|
45
37
|
],
|
|
@@ -28,15 +28,10 @@ test('disconnect', async () => {
|
|
|
28
28
|
response: { rows: [{ id: testUuid(1) }] },
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
sql: SQL`
|
|
32
|
-
|
|
33
|
-
(select ? :: uuid as "post_id", "root_"."id", "root_"."title", "root_"."locale" from "public"."post_locale" as "root_" where "root_"."id" = ?)
|
|
34
|
-
update "public"."post_locale"
|
|
35
|
-
set "post_id" = "newData_"."post_id"
|
|
36
|
-
from "newData_" where "post_locale"."id" = "newData_"."id"
|
|
37
|
-
`,
|
|
31
|
+
sql: SQL`with "newData_" as (select ? :: uuid as "post_id", "root_"."post_id" as "post_id_old__", "root_"."id", "root_"."title", "root_"."locale" from "public"."post_locale" as "root_" where "root_"."id" = ?)
|
|
32
|
+
update "public"."post_locale" set "post_id" = "newData_"."post_id" from "newData_" where "post_locale"."id" = "newData_"."id" returning "post_id_old__"`,
|
|
38
33
|
parameters: [null, testUuid(1)],
|
|
39
|
-
response: {
|
|
34
|
+
response: { rows: [{ post_id_old__: testUuid(99) }] },
|
|
40
35
|
},
|
|
41
36
|
]),
|
|
42
37
|
],
|
|
@@ -32,13 +32,10 @@ test('update (composed unique)', async () => {
|
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
|
-
sql: SQL`
|
|
36
|
-
|
|
37
|
-
(select ? :: text as "title", "root_"."id", "root_"."locale", "root_"."post_id" from "public"."post_locale" as "root_" where "root_"."id" = ?)
|
|
38
|
-
update "public"."post_locale" set "title" = "newData_"."title"
|
|
39
|
-
from "newData_" where "post_locale"."id" = "newData_"."id"`,
|
|
35
|
+
sql: SQL`with "newData_" as (select ? :: text as "title", "root_"."title" as "title_old__", "root_"."id", "root_"."locale", "root_"."post_id" from "public"."post_locale" as "root_" where "root_"."id" = ?)
|
|
36
|
+
update "public"."post_locale" set "title" = "newData_"."title" from "newData_" where "post_locale"."id" = "newData_"."id" returning "title_old__"`,
|
|
40
37
|
parameters: ['Hello', testUuid(1)],
|
|
41
|
-
response: {
|
|
38
|
+
response: { rows: [{ title_old__: 'Hi' }] },
|
|
42
39
|
},
|
|
43
40
|
]),
|
|
44
41
|
],
|
|
@@ -32,13 +32,10 @@ test('upsert - exists (composed unique)', async () => {
|
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
|
-
sql: SQL`
|
|
36
|
-
|
|
37
|
-
(select ? :: text as "title", "root_"."id", "root_"."locale", "root_"."post_id" from "public"."post_locale" as "root_" where "root_"."id" = ?)
|
|
38
|
-
update "public"."post_locale" set "title" = "newData_"."title"
|
|
39
|
-
from "newData_" where "post_locale"."id" = "newData_"."id"`,
|
|
35
|
+
sql: SQL`with "newData_" as (select ? :: text as "title", "root_"."title" as "title_old__", "root_"."id", "root_"."locale", "root_"."post_id" from "public"."post_locale" as "root_" where "root_"."id" = ?)
|
|
36
|
+
update "public"."post_locale" set "title" = "newData_"."title" from "newData_" where "post_locale"."id" = "newData_"."id" returning "title_old__"`,
|
|
40
37
|
parameters: ['Hello', testUuid(1)],
|
|
41
|
-
response: {
|
|
38
|
+
response: { rows: [{ title_old__: 'Foo' }] },
|
|
42
39
|
},
|
|
43
40
|
]),
|
|
44
41
|
],
|
|
@@ -84,17 +84,10 @@ test('connect - no owner', async () => {
|
|
|
84
84
|
},
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
|
-
sql: SQL`with "newData_" as
|
|
88
|
-
|
|
89
|
-
? :: uuid as "setting_id",
|
|
90
|
-
"root_"."id",
|
|
91
|
-
"root_"."name"
|
|
92
|
-
from "public"."site" as "root_"
|
|
93
|
-
where "root_"."id" = ?) update "public"."site"
|
|
94
|
-
set "setting_id" = "newData_"."setting_id" from "newData_"
|
|
95
|
-
where "site"."id" = "newData_"."id"`,
|
|
87
|
+
sql: SQL`with "newData_" as (select ? :: uuid as "setting_id", "root_"."setting_id" as "setting_id_old__", "root_"."id", "root_"."name" from "public"."site" as "root_" where "root_"."id" = ?)
|
|
88
|
+
update "public"."site" set "setting_id" = "newData_"."setting_id" from "newData_" where "site"."id" = "newData_"."id" returning "setting_id_old__"`,
|
|
96
89
|
parameters: [testUuid(2), testUuid(1)],
|
|
97
|
-
response: {
|
|
90
|
+
response: { rows: [{}] },
|
|
98
91
|
},
|
|
99
92
|
]),
|
|
100
93
|
],
|
|
@@ -143,30 +136,16 @@ test('connect - different owner', async () => {
|
|
|
143
136
|
},
|
|
144
137
|
},
|
|
145
138
|
{
|
|
146
|
-
sql: SQL`with "newData_" as
|
|
147
|
-
|
|
148
|
-
? :: uuid as "setting_id",
|
|
149
|
-
"root_"."id",
|
|
150
|
-
"root_"."name"
|
|
151
|
-
from "public"."site" as "root_"
|
|
152
|
-
where "root_"."id" = ?) update "public"."site"
|
|
153
|
-
set "setting_id" = "newData_"."setting_id" from "newData_"
|
|
154
|
-
where "site"."id" = "newData_"."id"`,
|
|
139
|
+
sql: SQL`with "newData_" as (select ? :: uuid as "setting_id", "root_"."setting_id" as "setting_id_old__", "root_"."id", "root_"."name" from "public"."site" as "root_" where "root_"."id" = ?)
|
|
140
|
+
update "public"."site" set "setting_id" = "newData_"."setting_id" from "newData_" where "site"."id" = "newData_"."id" returning "setting_id_old__"`,
|
|
155
141
|
parameters: [null, testUuid(3)],
|
|
156
|
-
response: {
|
|
142
|
+
response: { rows: [{}] },
|
|
157
143
|
},
|
|
158
144
|
{
|
|
159
|
-
sql: SQL`with "newData_" as
|
|
160
|
-
|
|
161
|
-
? :: uuid as "setting_id",
|
|
162
|
-
"root_"."id",
|
|
163
|
-
"root_"."name"
|
|
164
|
-
from "public"."site" as "root_"
|
|
165
|
-
where "root_"."id" = ?) update "public"."site"
|
|
166
|
-
set "setting_id" = "newData_"."setting_id" from "newData_"
|
|
167
|
-
where "site"."id" = "newData_"."id"`,
|
|
145
|
+
sql: SQL`with "newData_" as (select ? :: uuid as "setting_id", "root_"."setting_id" as "setting_id_old__", "root_"."id", "root_"."name" from "public"."site" as "root_" where "root_"."id" = ?)
|
|
146
|
+
update "public"."site" set "setting_id" = "newData_"."setting_id" from "newData_" where "site"."id" = "newData_"."id" returning "setting_id_old__"`,
|
|
168
147
|
parameters: [testUuid(2), testUuid(1)],
|
|
169
|
-
response: {
|
|
148
|
+
response: { rows: [{}] },
|
|
170
149
|
},
|
|
171
150
|
]),
|
|
172
151
|
],
|
|
@@ -219,17 +198,10 @@ test('connect - different owner & orphan removal enabled', async () => {
|
|
|
219
198
|
},
|
|
220
199
|
// set current owner to null
|
|
221
200
|
{
|
|
222
|
-
sql: SQL`with "newData_" as
|
|
223
|
-
|
|
224
|
-
? :: uuid as "setting_id",
|
|
225
|
-
"root_"."id",
|
|
226
|
-
"root_"."name"
|
|
227
|
-
from "public"."site" as "root_"
|
|
228
|
-
where "root_"."id" = ?) update "public"."site"
|
|
229
|
-
set "setting_id" = "newData_"."setting_id" from "newData_"
|
|
230
|
-
where "site"."id" = "newData_"."id"`,
|
|
201
|
+
sql: SQL`with "newData_" as (select ? :: uuid as "setting_id", "root_"."setting_id" as "setting_id_old__", "root_"."id", "root_"."name" from "public"."site" as "root_" where "root_"."id" = ?)
|
|
202
|
+
update "public"."site" set "setting_id" = "newData_"."setting_id" from "newData_" where "site"."id" = "newData_"."id" returning "setting_id_old__"`,
|
|
231
203
|
parameters: [null, testUuid(3)],
|
|
232
|
-
response: {
|
|
204
|
+
response: { rows: [{}] },
|
|
233
205
|
},
|
|
234
206
|
// current inverse of new owner
|
|
235
207
|
{
|
|
@@ -239,17 +211,10 @@ test('connect - different owner & orphan removal enabled', async () => {
|
|
|
239
211
|
},
|
|
240
212
|
// update inverse of new owner
|
|
241
213
|
{
|
|
242
|
-
sql: SQL`with "newData_" as
|
|
243
|
-
|
|
244
|
-
? :: uuid as "setting_id",
|
|
245
|
-
"root_"."id",
|
|
246
|
-
"root_"."name"
|
|
247
|
-
from "public"."site" as "root_"
|
|
248
|
-
where "root_"."id" = ?) update "public"."site"
|
|
249
|
-
set "setting_id" = "newData_"."setting_id" from "newData_"
|
|
250
|
-
where "site"."id" = "newData_"."id"`,
|
|
214
|
+
sql: SQL`with "newData_" as (select ? :: uuid as "setting_id", "root_"."setting_id" as "setting_id_old__", "root_"."id", "root_"."name" from "public"."site" as "root_" where "root_"."id" = ?)
|
|
215
|
+
update "public"."site" set "setting_id" = "newData_"."setting_id" from "newData_" where "site"."id" = "newData_"."id" returning "setting_id_old__"`,
|
|
251
216
|
parameters: [testUuid(2), testUuid(1)],
|
|
252
|
-
response: {
|
|
217
|
+
response: { rows: [{}] },
|
|
253
218
|
},
|
|
254
219
|
{
|
|
255
220
|
sql: 'select "root_"."id" from "public"."site_setting" as "root_" where "root_"."id" = ?',
|
|
@@ -49,17 +49,10 @@ test('create', async () => {
|
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
|
-
sql: SQL`with "newData_" as
|
|
53
|
-
|
|
54
|
-
? :: uuid as "setting_id",
|
|
55
|
-
"root_"."id",
|
|
56
|
-
"root_"."name"
|
|
57
|
-
from "public"."site" as "root_"
|
|
58
|
-
where "root_"."id" = ?) update "public"."site"
|
|
59
|
-
set "setting_id" = "newData_"."setting_id" from "newData_"
|
|
60
|
-
where "site"."id" = "newData_"."id"`,
|
|
52
|
+
sql: SQL`with "newData_" as (select ? :: uuid as "setting_id", "root_"."setting_id" as "setting_id_old__", "root_"."id", "root_"."name" from "public"."site" as "root_" where "root_"."id" = ?)
|
|
53
|
+
update "public"."site" set "setting_id" = "newData_"."setting_id" from "newData_" where "site"."id" = "newData_"."id" returning "setting_id_old__"`,
|
|
61
54
|
parameters: [null, oldSiteId],
|
|
62
|
-
response: {
|
|
55
|
+
response: { rows: [{ setting_id_old__: testUuid(99) }] },
|
|
63
56
|
},
|
|
64
57
|
{
|
|
65
58
|
sql: SQL`with "root_" as
|
|
@@ -34,17 +34,10 @@ test('disconnect', async () => {
|
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
|
-
sql: SQL`with "newData_" as
|
|
38
|
-
|
|
39
|
-
? :: uuid as "setting_id",
|
|
40
|
-
"root_"."id",
|
|
41
|
-
"root_"."name"
|
|
42
|
-
from "public"."site" as "root_"
|
|
43
|
-
where "root_"."id" = ?) update "public"."site"
|
|
44
|
-
set "setting_id" = "newData_"."setting_id" from "newData_"
|
|
45
|
-
where "site"."id" = "newData_"."id"`,
|
|
37
|
+
sql: SQL`with "newData_" as (select ? :: uuid as "setting_id", "root_"."setting_id" as "setting_id_old__", "root_"."id", "root_"."name" from "public"."site" as "root_" where "root_"."id" = ?)
|
|
38
|
+
update "public"."site" set "setting_id" = "newData_"."setting_id" from "newData_" where "site"."id" = "newData_"."id" returning "setting_id_old__"`,
|
|
46
39
|
parameters: [null, siteId],
|
|
47
|
-
response: {
|
|
40
|
+
response: { rows: [{ setting_id_old__: testUuid(99) }] },
|
|
48
41
|
},
|
|
49
42
|
]),
|
|
50
43
|
],
|
|
@@ -32,13 +32,10 @@ test('update', async () => {
|
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
|
-
sql: SQL`
|
|
36
|
-
|
|
37
|
-
(select ? :: text as "name", "root_"."id", "root_"."setting_id" from "public"."site" as "root_" where "root_"."id" = ?)
|
|
38
|
-
update "public"."site" set "name" = "newData_"."name"
|
|
39
|
-
from "newData_" where "site"."id" = "newData_"."id"`,
|
|
35
|
+
sql: SQL`with "newData_" as (select ? :: text as "name", "root_"."name" as "name_old__", "root_"."id", "root_"."setting_id" from "public"."site" as "root_" where "root_"."id" = ?)
|
|
36
|
+
update "public"."site" set "name" = "newData_"."name" from "newData_" where "site"."id" = "newData_"."id" returning "name_old__"`,
|
|
40
37
|
parameters: ['Mangoweb', testUuid(1)],
|
|
41
|
-
response: {
|
|
38
|
+
response: { rows: [{ name_old__: 'Foo' }] },
|
|
42
39
|
},
|
|
43
40
|
]),
|
|
44
41
|
],
|
|
@@ -32,14 +32,10 @@ test('upsert - exists', async () => {
|
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
|
-
sql: SQL`
|
|
36
|
-
|
|
37
|
-
(select ? :: text as "name", "root_"."id", "root_"."setting_id" from "public"."site" as "root_" where "root_"."id" = ?)
|
|
38
|
-
update "public"."site" set "name" = "newData_"."name"
|
|
39
|
-
from "newData_" where "site"."id" = "newData_"."id"
|
|
40
|
-
`,
|
|
35
|
+
sql: SQL`with "newData_" as (select ? :: text as "name", "root_"."name" as "name_old__", "root_"."id", "root_"."setting_id" from "public"."site" as "root_" where "root_"."id" = ?)
|
|
36
|
+
update "public"."site" set "name" = "newData_"."name" from "newData_" where "site"."id" = "newData_"."id" returning "name_old__"`,
|
|
41
37
|
parameters: ['Mangoweb', testUuid(1)],
|
|
42
|
-
response: {
|
|
38
|
+
response: { rows: [{ name_old__: 'XX' }] },
|
|
43
39
|
},
|
|
44
40
|
]),
|
|
45
41
|
],
|
|
@@ -81,17 +81,10 @@ test('connect - no owner', async () => {
|
|
|
81
81
|
},
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
|
-
sql: SQL`with "newData_" as
|
|
85
|
-
|
|
86
|
-
? :: uuid as "setting_id",
|
|
87
|
-
"root_"."id",
|
|
88
|
-
"root_"."name"
|
|
89
|
-
from "public"."site" as "root_"
|
|
90
|
-
where "root_"."id" = ?) update "public"."site"
|
|
91
|
-
set "setting_id" = "newData_"."setting_id" from "newData_"
|
|
92
|
-
where "site"."id" = "newData_"."id"`,
|
|
84
|
+
sql: SQL`with "newData_" as (select ? :: uuid as "setting_id", "root_"."setting_id" as "setting_id_old__", "root_"."id", "root_"."name" from "public"."site" as "root_" where "root_"."id" = ?)
|
|
85
|
+
update "public"."site" set "setting_id" = "newData_"."setting_id" from "newData_" where "site"."id" = "newData_"."id" returning "setting_id_old__"`,
|
|
93
86
|
parameters: [testUuid(1), testUuid(2)],
|
|
94
|
-
response: {
|
|
87
|
+
response: { rows: [{}] },
|
|
95
88
|
},
|
|
96
89
|
]),
|
|
97
90
|
],
|
|
@@ -138,30 +131,16 @@ test('connect - different owner', async () => {
|
|
|
138
131
|
},
|
|
139
132
|
},
|
|
140
133
|
{
|
|
141
|
-
sql: SQL`with "newData_" as
|
|
142
|
-
|
|
143
|
-
? :: uuid as "setting_id",
|
|
144
|
-
"root_"."id",
|
|
145
|
-
"root_"."name"
|
|
146
|
-
from "public"."site" as "root_"
|
|
147
|
-
where "root_"."id" = ?) update "public"."site"
|
|
148
|
-
set "setting_id" = "newData_"."setting_id" from "newData_"
|
|
149
|
-
where "site"."id" = "newData_"."id"`,
|
|
134
|
+
sql: SQL`with "newData_" as (select ? :: uuid as "setting_id", "root_"."setting_id" as "setting_id_old__", "root_"."id", "root_"."name" from "public"."site" as "root_" where "root_"."id" = ?)
|
|
135
|
+
update "public"."site" set "setting_id" = "newData_"."setting_id" from "newData_" where "site"."id" = "newData_"."id" returning "setting_id_old__"`,
|
|
150
136
|
parameters: [null, testUuid(3)],
|
|
151
|
-
response: {
|
|
137
|
+
response: { rows: [{}] },
|
|
152
138
|
},
|
|
153
139
|
{
|
|
154
|
-
sql: SQL`with "newData_" as
|
|
155
|
-
|
|
156
|
-
? :: uuid as "setting_id",
|
|
157
|
-
"root_"."id",
|
|
158
|
-
"root_"."name"
|
|
159
|
-
from "public"."site" as "root_"
|
|
160
|
-
where "root_"."id" = ?) update "public"."site"
|
|
161
|
-
set "setting_id" = "newData_"."setting_id" from "newData_"
|
|
162
|
-
where "site"."id" = "newData_"."id"`,
|
|
140
|
+
sql: SQL`with "newData_" as (select ? :: uuid as "setting_id", "root_"."setting_id" as "setting_id_old__", "root_"."id", "root_"."name" from "public"."site" as "root_" where "root_"."id" = ?)
|
|
141
|
+
update "public"."site" set "setting_id" = "newData_"."setting_id" from "newData_" where "site"."id" = "newData_"."id" returning "setting_id_old__"`,
|
|
163
142
|
parameters: [testUuid(1), testUuid(2)],
|
|
164
|
-
response: {
|
|
143
|
+
response: { rows: [{}] },
|
|
165
144
|
},
|
|
166
145
|
]),
|
|
167
146
|
],
|
|
@@ -216,9 +195,10 @@ test('connect - orphan removal', async () => {
|
|
|
216
195
|
response: { rows: [] },
|
|
217
196
|
},
|
|
218
197
|
{
|
|
219
|
-
sql:
|
|
198
|
+
sql: `with "newData_" as (select ? :: uuid as "setting_id", "root_"."setting_id" as "setting_id_old__", "root_"."id", "root_"."name" from "public"."site" as "root_" where "root_"."id" = ?)
|
|
199
|
+
update "public"."site" set "setting_id" = "newData_"."setting_id" from "newData_" where "site"."id" = "newData_"."id" returning "setting_id_old__"`,
|
|
220
200
|
parameters: [settingId, siteId],
|
|
221
|
-
response: {
|
|
201
|
+
response: { rows: [{ settng_id_old__: testUuid(99) }] },
|
|
222
202
|
},
|
|
223
203
|
{
|
|
224
204
|
sql: 'select "root_"."id" from "public"."site_setting" as "root_" where "root_"."id" = ?',
|
package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/connectOrCreate.test.ts
CHANGED
|
@@ -33,10 +33,10 @@ test('connect or create', async () => {
|
|
|
33
33
|
response: { rows: [] },
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
|
-
sql: `with "newData_" as (select ? :: uuid as "setting_id", "root_"."id", "root_"."name" from "public"."site" as "root_" where "root_"."id" = ?)
|
|
37
|
-
update "public"."site" set "setting_id" = "newData_"."setting_id" from "newData_" where "site"."id" = "newData_"."id"`,
|
|
36
|
+
sql: `with "newData_" as (select ? :: uuid as "setting_id", "root_"."setting_id" as "setting_id_old__", "root_"."id", "root_"."name" from "public"."site" as "root_" where "root_"."id" = ?)
|
|
37
|
+
update "public"."site" set "setting_id" = "newData_"."setting_id" from "newData_" where "site"."id" = "newData_"."id" returning "setting_id_old__"`,
|
|
38
38
|
parameters: [testUuid(3), testUuid(2)],
|
|
39
|
-
response: {
|
|
39
|
+
response: { rows: [{ setting_id_old__: testUuid(99) }] },
|
|
40
40
|
},
|
|
41
41
|
]),
|
|
42
42
|
],
|