@contember/engine-tenant-api 1.3.4 → 1.4.0-alpha.1
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/TenantContainer.d.ts +14 -5
- package/dist/src/TenantContainer.d.ts.map +1 -1
- package/dist/src/TenantContainer.js +10 -8
- package/dist/src/TenantContainer.js.map +1 -1
- package/dist/src/migrations/2023-09-01-165000-idp-return-config.d.ts +3 -0
- package/dist/src/migrations/2023-09-01-165000-idp-return-config.d.ts.map +1 -0
- package/dist/src/migrations/2023-09-01-165000-idp-return-config.js +11 -0
- package/dist/src/migrations/2023-09-01-165000-idp-return-config.js.map +1 -0
- package/dist/src/migrations/runner.d.ts.map +1 -1
- package/dist/src/migrations/runner.js +2 -0
- package/dist/src/migrations/runner.js.map +1 -1
- package/dist/src/migrations/snapshot.d.ts.map +1 -1
- package/dist/src/migrations/snapshot.js +2 -1
- package/dist/src/migrations/snapshot.js.map +1 -1
- package/dist/src/model/authorization/PermissionActions.d.ts +5 -0
- package/dist/src/model/authorization/PermissionActions.d.ts.map +1 -1
- package/dist/src/model/authorization/PermissionActions.js +1 -0
- package/dist/src/model/authorization/PermissionActions.js.map +1 -1
- package/dist/src/model/authorization/PermissionsFactory.d.ts.map +1 -1
- package/dist/src/model/authorization/PermissionsFactory.js +1 -0
- package/dist/src/model/authorization/PermissionsFactory.js.map +1 -1
- package/dist/src/model/commands/apiKey/ApiKeyHelper.d.ts +1 -1
- package/dist/src/model/commands/apiKey/ApiKeyHelper.d.ts.map +1 -1
- package/dist/src/model/commands/apiKey/ApiKeyHelper.js.map +1 -1
- package/dist/src/model/commands/apiKey/ProlongApiKeyCommand.d.ts +3 -2
- package/dist/src/model/commands/apiKey/ProlongApiKeyCommand.d.ts.map +1 -1
- package/dist/src/model/commands/apiKey/ProlongApiKeyCommand.js +10 -2
- package/dist/src/model/commands/apiKey/ProlongApiKeyCommand.js.map +1 -1
- package/dist/src/model/commands/idp/CreateIdpCommand.d.ts.map +1 -1
- package/dist/src/model/commands/idp/CreateIdpCommand.js +2 -1
- package/dist/src/model/commands/idp/CreateIdpCommand.js.map +1 -1
- package/dist/src/model/commands/idp/UpdateIdpCommand.d.ts +1 -1
- package/dist/src/model/commands/idp/UpdateIdpCommand.d.ts.map +1 -1
- package/dist/src/model/commands/idp/UpdateIdpCommand.js +3 -2
- package/dist/src/model/commands/idp/UpdateIdpCommand.js.map +1 -1
- package/dist/src/model/commands/person/ChangeProfileCommand.d.ts +12 -0
- package/dist/src/model/commands/person/ChangeProfileCommand.d.ts.map +1 -0
- package/dist/src/model/commands/person/ChangeProfileCommand.js +21 -0
- package/dist/src/model/commands/person/ChangeProfileCommand.js.map +1 -0
- package/dist/src/model/queries/idp/helpers.d.ts +1 -1
- package/dist/src/model/queries/idp/helpers.d.ts.map +1 -1
- package/dist/src/model/queries/idp/helpers.js +3 -2
- package/dist/src/model/queries/idp/helpers.js.map +1 -1
- package/dist/src/model/queries/idp/types.d.ts +1 -0
- package/dist/src/model/queries/idp/types.d.ts.map +1 -1
- package/dist/src/model/service/EmailValidator.d.ts +8 -0
- package/dist/src/model/service/EmailValidator.d.ts.map +1 -0
- package/dist/src/model/service/EmailValidator.js +23 -0
- package/dist/src/model/service/EmailValidator.js.map +1 -0
- package/dist/src/model/service/IDPSignInManager.d.ts +2 -6
- package/dist/src/model/service/IDPSignInManager.d.ts.map +1 -1
- package/dist/src/model/service/IDPSignInManager.js +7 -1
- package/dist/src/model/service/IDPSignInManager.js.map +1 -1
- package/dist/src/model/service/PersonManager.d.ts +10 -0
- package/dist/src/model/service/PersonManager.d.ts.map +1 -1
- package/dist/src/model/service/PersonManager.js +15 -0
- package/dist/src/model/service/PersonManager.js.map +1 -1
- package/dist/src/model/service/SignUpManager.d.ts +3 -1
- package/dist/src/model/service/SignUpManager.d.ts.map +1 -1
- package/dist/src/model/service/SignUpManager.js +6 -11
- package/dist/src/model/service/SignUpManager.js.map +1 -1
- package/dist/src/model/service/apiKey/ApiKeyManager.d.ts +1 -1
- package/dist/src/model/service/apiKey/ApiKeyManager.d.ts.map +1 -1
- package/dist/src/model/service/apiKey/ApiKeyManager.js +3 -3
- package/dist/src/model/service/apiKey/ApiKeyManager.js.map +1 -1
- package/dist/src/model/service/idp/IDPHandlerRegistry.d.ts +1 -0
- package/dist/src/model/service/idp/IDPHandlerRegistry.d.ts.map +1 -1
- package/dist/src/model/service/idp/IDPHandlerRegistry.js +4 -0
- package/dist/src/model/service/idp/IDPHandlerRegistry.js.map +1 -1
- package/dist/src/model/service/idp/IDPManager.d.ts +3 -1
- package/dist/src/model/service/idp/IDPManager.d.ts.map +1 -1
- package/dist/src/model/service/idp/IDPManager.js +35 -5
- package/dist/src/model/service/idp/IDPManager.js.map +1 -1
- package/dist/src/model/service/idp/IdentityProviderHandler.d.ts +1 -0
- package/dist/src/model/service/idp/IdentityProviderHandler.d.ts.map +1 -1
- package/dist/src/model/service/idp/index.d.ts +1 -0
- package/dist/src/model/service/idp/index.d.ts.map +1 -1
- package/dist/src/model/service/idp/index.js +1 -0
- package/dist/src/model/service/idp/index.js.map +1 -1
- package/dist/src/model/service/idp/providers/AppleProvider.d.ts +1 -0
- package/dist/src/model/service/idp/providers/AppleProvider.d.ts.map +1 -1
- package/dist/src/model/service/idp/providers/AppleProvider.js +3 -0
- package/dist/src/model/service/idp/providers/AppleProvider.js.map +1 -1
- package/dist/src/model/service/idp/providers/FacebookProvider.d.ts +1 -0
- package/dist/src/model/service/idp/providers/FacebookProvider.d.ts.map +1 -1
- package/dist/src/model/service/idp/providers/FacebookProvider.js +3 -0
- package/dist/src/model/service/idp/providers/FacebookProvider.js.map +1 -1
- package/dist/src/model/service/idp/providers/OIDCProvider.d.ts +1 -0
- package/dist/src/model/service/idp/providers/OIDCProvider.d.ts.map +1 -1
- package/dist/src/model/service/idp/providers/OIDCProvider.js +3 -0
- package/dist/src/model/service/idp/providers/OIDCProvider.js.map +1 -1
- package/dist/src/model/service/index.d.ts +7 -5
- package/dist/src/model/service/index.d.ts.map +1 -1
- package/dist/src/model/service/index.js +7 -5
- package/dist/src/model/service/index.js.map +1 -1
- package/dist/src/model/type/IdentityProvider.d.ts +1 -0
- package/dist/src/model/type/IdentityProvider.d.ts.map +1 -1
- package/dist/src/model/utils/DatabaseContext.d.ts +0 -6
- package/dist/src/model/utils/DatabaseContext.d.ts.map +1 -1
- package/dist/src/model/utils/DatabaseContext.js +1 -11
- package/dist/src/model/utils/DatabaseContext.js.map +1 -1
- package/dist/src/resolvers/ResolverFactory.d.ts +2 -1
- package/dist/src/resolvers/ResolverFactory.d.ts.map +1 -1
- package/dist/src/resolvers/ResolverFactory.js +1 -0
- package/dist/src/resolvers/ResolverFactory.js.map +1 -1
- package/dist/src/resolvers/mutation/idp/AddIDPMutationResolver.d.ts.map +1 -1
- package/dist/src/resolvers/mutation/idp/AddIDPMutationResolver.js +2 -1
- package/dist/src/resolvers/mutation/idp/AddIDPMutationResolver.js.map +1 -1
- package/dist/src/resolvers/mutation/idp/UpdateIDPMutationResolver.d.ts.map +1 -1
- package/dist/src/resolvers/mutation/idp/UpdateIDPMutationResolver.js +3 -2
- package/dist/src/resolvers/mutation/idp/UpdateIDPMutationResolver.js.map +1 -1
- package/dist/src/resolvers/mutation/person/ChangeProfileMutationResolver.d.ts +10 -0
- package/dist/src/resolvers/mutation/person/ChangeProfileMutationResolver.d.ts.map +1 -0
- package/dist/src/resolvers/mutation/person/ChangeProfileMutationResolver.js +33 -0
- package/dist/src/resolvers/mutation/person/ChangeProfileMutationResolver.js.map +1 -0
- package/dist/src/resolvers/mutation/person/index.d.ts +1 -0
- package/dist/src/resolvers/mutation/person/index.d.ts.map +1 -1
- package/dist/src/resolvers/mutation/person/index.js +1 -0
- package/dist/src/resolvers/mutation/person/index.js.map +1 -1
- package/dist/src/resolvers/query/IDPQueryResolver.d.ts +3 -0
- package/dist/src/resolvers/query/IDPQueryResolver.d.ts.map +1 -1
- package/dist/src/resolvers/query/IDPQueryResolver.js +4 -1
- package/dist/src/resolvers/query/IDPQueryResolver.js.map +1 -1
- package/dist/src/schema/index.d.ts +38 -0
- package/dist/src/schema/index.d.ts.map +1 -1
- package/dist/src/schema/tenant.graphql.d.ts.map +1 -1
- package/dist/src/schema/tenant.graphql.js +23 -1
- package/dist/src/schema/tenant.graphql.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/tests/cases/integration/mocked/changeMyProfileMutation.test.d.ts +2 -0
- package/dist/tests/cases/integration/mocked/changeMyProfileMutation.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/changeMyProfileMutation.test.js +182 -0
- package/dist/tests/cases/integration/mocked/changeMyProfileMutation.test.js.map +1 -0
- package/dist/tests/cases/integration/mocked/gql/changeMyProfile.d.ts +6 -0
- package/dist/tests/cases/integration/mocked/gql/changeMyProfile.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/gql/changeMyProfile.js +17 -0
- package/dist/tests/cases/integration/mocked/gql/changeMyProfile.js.map +1 -0
- package/dist/tests/cases/integration/mocked/signInIdpMutation.test.js +2 -0
- package/dist/tests/cases/integration/mocked/signInIdpMutation.test.js.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/getIdpBySlugSql.js +1 -1
- package/dist/tests/cases/integration/mocked/sql/getPersonByIdentity.d.ts +1 -0
- package/dist/tests/cases/integration/mocked/sql/getPersonByIdentity.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/getPersonByIdentity.js +1 -0
- package/dist/tests/cases/integration/mocked/sql/getPersonByIdentity.js.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/updatePesonNameSql.d.ts +15 -0
- package/dist/tests/cases/integration/mocked/sql/updatePesonNameSql.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/sql/updatePesonNameSql.js +29 -0
- package/dist/tests/cases/integration/mocked/sql/updatePesonNameSql.js.map +1 -0
- package/dist/tests/src/testTenant.d.ts.map +1 -1
- package/dist/tests/src/testTenant.js +1 -0
- package/dist/tests/src/testTenant.js.map +1 -1
- package/dist/tests/src/testTenantDb.d.ts.map +1 -1
- package/dist/tests/src/testTenantDb.js +1 -0
- package/dist/tests/src/testTenantDb.js.map +1 -1
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -14
- package/src/TenantContainer.ts +28 -14
- package/src/migrations/2023-09-01-165000-idp-return-config.ts +10 -0
- package/src/migrations/runner.ts +3 -0
- package/src/migrations/snapshot.ts +2 -1
- package/src/model/authorization/PermissionActions.ts +1 -0
- package/src/model/authorization/PermissionsFactory.ts +1 -0
- package/src/model/commands/apiKey/ApiKeyHelper.ts +1 -1
- package/src/model/commands/apiKey/ProlongApiKeyCommand.ts +17 -2
- package/src/model/commands/idp/CreateIdpCommand.ts +2 -1
- package/src/model/commands/idp/UpdateIdpCommand.ts +3 -2
- package/src/model/commands/person/ChangeProfileCommand.ts +21 -0
- package/src/model/queries/idp/helpers.ts +3 -2
- package/src/model/queries/idp/types.ts +1 -0
- package/src/model/service/EmailValidator.ts +26 -0
- package/src/model/service/IDPSignInManager.ts +11 -8
- package/src/model/service/PersonManager.ts +23 -0
- package/src/model/service/SignUpManager.ts +9 -11
- package/src/model/service/apiKey/ApiKeyManager.ts +8 -2
- package/src/model/service/idp/IDPHandlerRegistry.ts +4 -0
- package/src/model/service/idp/IDPManager.ts +43 -5
- package/src/model/service/idp/IdentityProviderHandler.ts +2 -0
- package/src/model/service/idp/index.ts +1 -0
- package/src/model/service/idp/providers/AppleProvider.ts +4 -1
- package/src/model/service/idp/providers/FacebookProvider.ts +5 -1
- package/src/model/service/idp/providers/OIDCProvider.ts +4 -0
- package/src/model/service/index.ts +8 -5
- package/src/model/type/IdentityProvider.ts +1 -0
- package/src/model/utils/DatabaseContext.ts +1 -12
- package/src/resolvers/ResolverFactory.ts +5 -1
- package/src/resolvers/mutation/idp/AddIDPMutationResolver.ts +1 -0
- package/src/resolvers/mutation/idp/UpdateIDPMutationResolver.ts +2 -1
- package/src/resolvers/mutation/person/ChangeProfileMutationResolver.ts +42 -0
- package/src/resolvers/mutation/person/index.ts +1 -0
- package/src/resolvers/query/IDPQueryResolver.ts +9 -2
- package/src/schema/index.ts +48 -0
- package/src/schema/tenant.graphql.ts +23 -1
- package/tests/cases/integration/mocked/changeMyProfileMutation.test.ts +187 -0
- package/tests/cases/integration/mocked/gql/changeMyProfile.ts +14 -0
- package/tests/cases/integration/mocked/signInIdpMutation.test.ts +2 -0
- package/tests/cases/integration/mocked/sql/getIdpBySlugSql.ts +1 -1
- package/tests/cases/integration/mocked/sql/getPersonByIdentity.ts +3 -2
- package/tests/cases/integration/mocked/sql/updatePesonNameSql.ts +26 -0
- package/tests/src/testTenant.ts +1 -0
- package/tests/src/testTenantDb.ts +1 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { executeTenantTest } from '../../../src/testTenant'
|
|
2
|
+
import { testUuid } from '../../../src/testUuid'
|
|
3
|
+
import { updatePersonProfileNameSql, updatePersonProfileEmailSql, updatePersonProfileNameAndEmailSql } from './sql/updatePesonNameSql'
|
|
4
|
+
import { test } from 'vitest'
|
|
5
|
+
import { changeMyProfileMutation } from './gql/changeMyProfile'
|
|
6
|
+
import { getPersonByIdentity } from './sql/getPersonByIdentity'
|
|
7
|
+
import { authenticatedIdentityId } from '../../../src/testTenantDb'
|
|
8
|
+
import { getPersonByEmailSql } from './sql/getPersonByEmailSql'
|
|
9
|
+
|
|
10
|
+
test('changes my name', async () => {
|
|
11
|
+
const personId = testUuid(1)
|
|
12
|
+
const identityId = authenticatedIdentityId
|
|
13
|
+
const name = 'Jane Doe'
|
|
14
|
+
await executeTenantTest({
|
|
15
|
+
query: changeMyProfileMutation({ name }),
|
|
16
|
+
executes: [
|
|
17
|
+
getPersonByIdentity({
|
|
18
|
+
identityId,
|
|
19
|
+
response: { personId, email: 'john.doe@example.com', name: 'John Doe', roles: [], password: '123456' },
|
|
20
|
+
}),
|
|
21
|
+
updatePersonProfileNameSql({ personId, name }),
|
|
22
|
+
],
|
|
23
|
+
return: {
|
|
24
|
+
data: {
|
|
25
|
+
changeMyProfile: {
|
|
26
|
+
ok: true,
|
|
27
|
+
error: null,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
test('unset my name', async () => {
|
|
36
|
+
const personId = testUuid(1)
|
|
37
|
+
const identityId = authenticatedIdentityId
|
|
38
|
+
const name = null
|
|
39
|
+
await executeTenantTest({
|
|
40
|
+
query: changeMyProfileMutation({ name }),
|
|
41
|
+
executes: [
|
|
42
|
+
getPersonByIdentity({
|
|
43
|
+
identityId,
|
|
44
|
+
response: { personId, email: 'john.doe@example.com', name: 'John Doe', roles: [], password: '123456' },
|
|
45
|
+
}),
|
|
46
|
+
updatePersonProfileNameSql({ personId, name }),
|
|
47
|
+
],
|
|
48
|
+
return: {
|
|
49
|
+
data: {
|
|
50
|
+
changeMyProfile: {
|
|
51
|
+
ok: true,
|
|
52
|
+
error: null,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
test('changes my email', async () => {
|
|
60
|
+
const personId = testUuid(1)
|
|
61
|
+
const identityId = authenticatedIdentityId
|
|
62
|
+
const email = 'jane@doe.com'
|
|
63
|
+
await executeTenantTest({
|
|
64
|
+
query: changeMyProfileMutation({ email }),
|
|
65
|
+
executes: [
|
|
66
|
+
getPersonByIdentity({
|
|
67
|
+
identityId,
|
|
68
|
+
response: { personId, email: 'john.doe@example.com', name: 'John Doe', roles: [], password: '123456' },
|
|
69
|
+
}),
|
|
70
|
+
getPersonByEmailSql({ email, response: null }),
|
|
71
|
+
updatePersonProfileEmailSql({ personId, email }),
|
|
72
|
+
],
|
|
73
|
+
return: {
|
|
74
|
+
data: {
|
|
75
|
+
changeMyProfile: {
|
|
76
|
+
ok: true,
|
|
77
|
+
error: null,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
test('changes my email - invalid', async () => {
|
|
85
|
+
const personId = testUuid(1)
|
|
86
|
+
const identityId = authenticatedIdentityId
|
|
87
|
+
const email = null
|
|
88
|
+
await executeTenantTest({
|
|
89
|
+
query: changeMyProfileMutation({ email }),
|
|
90
|
+
executes: [
|
|
91
|
+
getPersonByIdentity({
|
|
92
|
+
identityId,
|
|
93
|
+
response: { personId, email: 'john.doe@example.com', name: 'John Doe', roles: [], password: '123456' },
|
|
94
|
+
}),
|
|
95
|
+
updatePersonProfileEmailSql({ personId, email }),
|
|
96
|
+
],
|
|
97
|
+
return: {
|
|
98
|
+
data: {
|
|
99
|
+
changeMyProfile: {
|
|
100
|
+
ok: false,
|
|
101
|
+
error: {
|
|
102
|
+
code: 'INVALID_EMAIL_FORMAT',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
})
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
test('changes my email - invalid #2', async () => {
|
|
111
|
+
const personId = testUuid(1)
|
|
112
|
+
const identityId = authenticatedIdentityId
|
|
113
|
+
const email = 'foobar'
|
|
114
|
+
await executeTenantTest({
|
|
115
|
+
query: changeMyProfileMutation({ email }),
|
|
116
|
+
executes: [
|
|
117
|
+
getPersonByIdentity({
|
|
118
|
+
identityId,
|
|
119
|
+
response: { personId, email: 'john.doe@example.com', name: 'John Doe', roles: [], password: '123456' },
|
|
120
|
+
}),
|
|
121
|
+
updatePersonProfileEmailSql({ personId, email }),
|
|
122
|
+
],
|
|
123
|
+
return: {
|
|
124
|
+
data: {
|
|
125
|
+
changeMyProfile: {
|
|
126
|
+
ok: false,
|
|
127
|
+
error: {
|
|
128
|
+
code: 'INVALID_EMAIL_FORMAT',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
})
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
test('changes my email - exists', async () => {
|
|
137
|
+
const personId = testUuid(1)
|
|
138
|
+
const identityId = authenticatedIdentityId
|
|
139
|
+
const email = 'jane@doe.com'
|
|
140
|
+
await executeTenantTest({
|
|
141
|
+
query: changeMyProfileMutation({ email }),
|
|
142
|
+
executes: [
|
|
143
|
+
getPersonByIdentity({
|
|
144
|
+
identityId,
|
|
145
|
+
response: { personId, email: 'john.doe@example.com', name: 'John Doe', roles: [], password: '123456' },
|
|
146
|
+
}),
|
|
147
|
+
getPersonByEmailSql({ email, response: { personId: testUuid(4), identityId: testUuid(5), roles: [], password: '' } }),
|
|
148
|
+
updatePersonProfileEmailSql({ personId, email }),
|
|
149
|
+
],
|
|
150
|
+
return: {
|
|
151
|
+
data: {
|
|
152
|
+
changeMyProfile: {
|
|
153
|
+
ok: false,
|
|
154
|
+
error: {
|
|
155
|
+
code: 'EMAIL_ALREADY_EXISTS',
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
})
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
test('changes my name and email', async () => {
|
|
164
|
+
const personId = testUuid(1)
|
|
165
|
+
const identityId = authenticatedIdentityId
|
|
166
|
+
const email = 'jane@doe.com'
|
|
167
|
+
const name = 'Jane Doe'
|
|
168
|
+
await executeTenantTest({
|
|
169
|
+
query: changeMyProfileMutation({ email, name }),
|
|
170
|
+
executes: [
|
|
171
|
+
getPersonByIdentity({
|
|
172
|
+
identityId,
|
|
173
|
+
response: { personId, email: 'john.doe@example.com', name: 'John Doe', roles: [], password: '123456' },
|
|
174
|
+
}),
|
|
175
|
+
getPersonByEmailSql({ email, response: null }),
|
|
176
|
+
updatePersonProfileNameAndEmailSql({ personId, email, name }),
|
|
177
|
+
],
|
|
178
|
+
return: {
|
|
179
|
+
data: {
|
|
180
|
+
changeMyProfile: {
|
|
181
|
+
ok: true,
|
|
182
|
+
error: null,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
})
|
|
187
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GraphQLTestQuery } from './types'
|
|
2
|
+
import { GQL } from '../../../../src/tags'
|
|
3
|
+
|
|
4
|
+
export const changeMyProfileMutation = (variables: { email?: string | null; name?: string | null }): GraphQLTestQuery => ({
|
|
5
|
+
query: GQL`mutation($email: String, $name: String) {
|
|
6
|
+
changeMyProfile(email: $email, name: $name) {
|
|
7
|
+
ok
|
|
8
|
+
error {
|
|
9
|
+
code
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}`,
|
|
13
|
+
variables,
|
|
14
|
+
})
|
|
@@ -41,6 +41,7 @@ test('signs in idp with existing identity', async () => {
|
|
|
41
41
|
externalIdentifier: externalIdentifier,
|
|
42
42
|
},
|
|
43
43
|
disabledAt: null,
|
|
44
|
+
initReturnsConfig: false,
|
|
44
45
|
slug: 'mock',
|
|
45
46
|
type: 'mock',
|
|
46
47
|
},
|
|
@@ -108,6 +109,7 @@ test('signs in exclusive idp', async () => {
|
|
|
108
109
|
id: idpId,
|
|
109
110
|
autoSignUp: true,
|
|
110
111
|
exclusive: true,
|
|
112
|
+
initReturnsConfig: false,
|
|
111
113
|
configuration: {
|
|
112
114
|
externalIdentifier: externalIdentifier,
|
|
113
115
|
email,
|
|
@@ -6,7 +6,7 @@ export const getIdpBySlugSql = (args: {
|
|
|
6
6
|
slug: string
|
|
7
7
|
response: null | IdentityProviderRow
|
|
8
8
|
}): ExpectedQuery => ({
|
|
9
|
-
sql: SQL`select "id", "slug", "type", "configuration", "disabled_at" as "disabledAt", "auto_sign_up" as "autoSignUp", "exclusive"
|
|
9
|
+
sql: SQL`select "id", "slug", "type", "configuration", "disabled_at" as "disabledAt", "auto_sign_up" as "autoSignUp", "exclusive", "init_returns_config" as "initReturnsConfig"
|
|
10
10
|
from "tenant"."identity_provider"
|
|
11
11
|
where "slug" = ?`,
|
|
12
12
|
parameters: [args.slug],
|
|
@@ -3,7 +3,7 @@ import { SQL } from '../../../../src/tags'
|
|
|
3
3
|
|
|
4
4
|
export const getPersonByIdentity = (args: {
|
|
5
5
|
identityId: string
|
|
6
|
-
response: null | { personId: string; password: string; roles: string[]; email: string; otpUri?: string }
|
|
6
|
+
response: null | { personId: string; password: string; roles: string[]; email: string; name?: string; otpUri?: string }
|
|
7
7
|
}): ExpectedQuery => ({
|
|
8
8
|
sql: SQL`SELECT "person"."id", "person"."password_hash", "person"."otp_uri", "person"."otp_activated_at", "person"."identity_id", "person"."email", "person"."name", "person"."disabled_at", "identity"."roles"
|
|
9
9
|
FROM "tenant"."person"
|
|
@@ -19,9 +19,10 @@ export const getPersonByIdentity = (args: {
|
|
|
19
19
|
identity_id: args.identityId,
|
|
20
20
|
roles: args.response.roles,
|
|
21
21
|
email: args.response.email,
|
|
22
|
+
name: args.response.name,
|
|
22
23
|
otp_uri: args.response.otpUri,
|
|
23
24
|
},
|
|
24
|
-
|
|
25
|
+
]
|
|
25
26
|
: [],
|
|
26
27
|
},
|
|
27
28
|
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ExpectedQuery } from '@contember/database-tester'
|
|
2
|
+
import { SQL } from '../../../../src/tags'
|
|
3
|
+
|
|
4
|
+
export const updatePersonProfileNameSql = (args: { personId: string; name: string | null }): ExpectedQuery => ({
|
|
5
|
+
sql: SQL`UPDATE "tenant"."person"
|
|
6
|
+
SET "name" = ?
|
|
7
|
+
WHERE "id" = ?`,
|
|
8
|
+
parameters: [args.name, args.personId],
|
|
9
|
+
response: { rowCount: 1 },
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export const updatePersonProfileEmailSql = (args: { personId: string; email: string | null }): ExpectedQuery => ({
|
|
13
|
+
sql: SQL`UPDATE "tenant"."person"
|
|
14
|
+
SET "email" = ?
|
|
15
|
+
WHERE "id" = ?`,
|
|
16
|
+
parameters: [args.email, args.personId],
|
|
17
|
+
response: { rowCount: 1 },
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export const updatePersonProfileNameAndEmailSql = (args: { personId: string; email: string | null; name: string | null }): ExpectedQuery => ({
|
|
21
|
+
sql: SQL`UPDATE "tenant"."person"
|
|
22
|
+
SET "email" = ?, "name" = ?
|
|
23
|
+
WHERE "id" = ?`,
|
|
24
|
+
parameters: [args.email, args.name, args.personId],
|
|
25
|
+
response: { rowCount: 1 },
|
|
26
|
+
})
|
package/tests/src/testTenant.ts
CHANGED