@go-mondo/identity-sdk 0.0.2-beta.73 → 0.0.2-beta.75

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.
Files changed (60) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/.tsbuildinfo/cjs.json +1 -1
  3. package/.tsbuildinfo/esm.json +1 -1
  4. package/CHANGELOG.md +14 -0
  5. package/dist/cjs/app/authorization/schema.d.ts +0 -9
  6. package/dist/cjs/app/authorization/schema.d.ts.map +1 -1
  7. package/dist/cjs/common/schema/jwt.d.ts +0 -6
  8. package/dist/cjs/common/schema/jwt.d.ts.map +1 -1
  9. package/dist/cjs/common/schema/jwt.js +0 -3
  10. package/dist/cjs/common/schema/jwt.test.js +0 -8
  11. package/dist/cjs/customer/users/schema.d.ts +4 -4
  12. package/dist/cjs/customer/users/schema.d.ts.map +1 -1
  13. package/dist/cjs/customer/users/schema.js +8 -4
  14. package/dist/cjs/customer/users/schema.test.js +4 -4
  15. package/dist/cjs/workspace/authorization/schema.d.ts +0 -9
  16. package/dist/cjs/workspace/authorization/schema.d.ts.map +1 -1
  17. package/dist/esm/app/authorization/schema.d.ts +0 -9
  18. package/dist/esm/app/authorization/schema.d.ts.map +1 -1
  19. package/dist/esm/common/schema/jwt.d.ts +0 -6
  20. package/dist/esm/common/schema/jwt.d.ts.map +1 -1
  21. package/dist/esm/common/schema/jwt.js +0 -3
  22. package/dist/esm/common/schema/jwt.test.js +0 -8
  23. package/dist/esm/customer/users/schema.d.ts +4 -4
  24. package/dist/esm/customer/users/schema.d.ts.map +1 -1
  25. package/dist/esm/customer/users/schema.js +8 -4
  26. package/dist/esm/customer/users/schema.test.js +4 -4
  27. package/dist/esm/workspace/authorization/schema.d.ts +0 -9
  28. package/dist/esm/workspace/authorization/schema.d.ts.map +1 -1
  29. package/package.json +1 -1
  30. package/src/action/schema/operations/sign-up-verification.test.ts.bak +0 -163
  31. package/src/action/schema/operations/sign-up.test.ts.bak +0 -203
  32. package/src/action/schema/operations/user-attribute-verification.test.ts.bak +0 -148
  33. package/src/activity/schema/base.test.ts.bak +0 -291
  34. package/src/activity/schema/schema.test.ts.bak +0 -392
  35. package/src/activity/schema/types/authentication.test.ts.bak +0 -337
  36. package/src/activity/schema/types/authorization.test.ts.bak +0 -379
  37. package/src/activity/schema/types/note.test.ts.bak +0 -367
  38. package/src/activity/schema/types/operation.test.ts.bak +0 -379
  39. package/src/activity/schema/types/unknown.test.ts.bak +0 -304
  40. package/src/app/authorization/schema.test.ts.bak +0 -412
  41. package/src/app/oidc/schema.test.ts.bak +0 -117
  42. package/src/app/registration/schema.test.ts.bak +0 -308
  43. package/src/app/schema.test.ts.bak +0 -221
  44. package/src/association/schema.test.ts.bak +0 -148
  45. package/src/authentication/factors/schema.test.ts.bak +0 -174
  46. package/src/authentication/settings/schema.test.ts.bak +0 -91
  47. package/src/authorization/permissions/schema.test.ts.bak +0 -267
  48. package/src/authorization/roles/schema.test.ts.bak +0 -283
  49. package/src/common/schema/aggregate.test.ts.bak +0 -89
  50. package/src/common/schema/collection.test.ts.bak +0 -116
  51. package/src/common/schema/dates.test.ts.bak +0 -49
  52. package/src/common/schema/id.test.ts.bak +0 -149
  53. package/src/common/schema/jwt.test.ts.bak +0 -61
  54. package/src/common/schema/metadata.test.ts.bak +0 -141
  55. package/src/common/schema/pagination.test.ts.bak +0 -80
  56. package/src/common/schema/schema.test.ts.bak +0 -41
  57. package/src/customer/users/schema.test.ts.bak +0 -138
  58. package/src/identity/schema.test.ts.bak +0 -48
  59. package/src/oauth/token/schema/schema.test.ts.bak +0 -142
  60. package/src/workspace/settings/schema.test.ts.bak +0 -88
@@ -1,163 +0,0 @@
1
- import { type } from 'arktype';
2
- import { describe, expect, test } from 'vitest';
3
- import { generateUserId } from '../../../customer/schema.js';
4
- import { generateActionId } from '../utils.js';
5
- import {
6
- SignUpVerificationActionPayloadSchema,
7
- SignUpVerificationActionRequestSchema,
8
- } from './sign-up-verification.js';
9
-
10
- describe('Action Schema Operations - Sign Up Verification', () => {
11
- describe('SignUpVerificationActionPayloadSchema', () => {
12
- test('should accept complete payload', () => {
13
- const payload = {
14
- id: generateActionId(),
15
- operation: 'sign-up-verification' as const,
16
- user: generateUserId(),
17
- identifier: 'email' as const,
18
- attempt: 1,
19
- expiresAt: new Date().toISOString(),
20
- updatedAt: new Date().toISOString(),
21
- metadata: { key: 'value' },
22
- };
23
-
24
- const result = SignUpVerificationActionPayloadSchema(payload);
25
- expect(result).not.toBeInstanceOf(type.errors);
26
- expect(result).toEqual(payload);
27
- });
28
-
29
- test('should accept phoneNumber identifier', () => {
30
- const payload = {
31
- id: generateActionId(),
32
- operation: 'sign-up-verification' as const,
33
- user: generateUserId(),
34
- identifier: 'phoneNumber' as const,
35
- attempt: 1,
36
- expiresAt: new Date().toISOString(),
37
- updatedAt: new Date().toISOString(),
38
- metadata: {},
39
- };
40
-
41
- const result = SignUpVerificationActionPayloadSchema(payload);
42
- expect(result).not.toBeInstanceOf(type.errors);
43
- expect(result).toEqual(payload);
44
- });
45
-
46
- test('should accept payload with optional dates', () => {
47
- const payload = {
48
- id: generateActionId(),
49
- operation: 'sign-up-verification' as const,
50
- user: generateUserId(),
51
- identifier: 'email' as const,
52
- attempt: 2,
53
- expiresAt: new Date().toISOString(),
54
- updatedAt: new Date().toISOString(),
55
- deletedAt: new Date().toISOString(),
56
- deactivatedAt: new Date().toISOString(),
57
- metadata: {},
58
- };
59
-
60
- const result = SignUpVerificationActionPayloadSchema(payload);
61
- expect(result).not.toBeInstanceOf(type.errors);
62
- });
63
-
64
- test('should reject invalid operation', () => {
65
- const payload = {
66
- id: generateActionId(),
67
- operation: 'invalid-operation',
68
- user: generateUserId(),
69
- identifier: 'email' as const,
70
- attempt: 1,
71
- expiresAt: new Date().toISOString(),
72
- updatedAt: new Date().toISOString(),
73
- metadata: {},
74
- };
75
-
76
- const result = SignUpVerificationActionPayloadSchema(payload);
77
- expect(result).toBeInstanceOf(type.errors);
78
- });
79
-
80
- test('should reject invalid identifier', () => {
81
- const payload = {
82
- id: generateActionId(),
83
- operation: 'sign-up-verification' as const,
84
- user: generateUserId(),
85
- identifier: 'username',
86
- attempt: 1,
87
- expiresAt: new Date().toISOString(),
88
- updatedAt: new Date().toISOString(),
89
- metadata: {},
90
- };
91
-
92
- const result = SignUpVerificationActionPayloadSchema(payload);
93
- expect(result).toBeInstanceOf(type.errors);
94
- });
95
-
96
- test('should reject missing required fields', () => {
97
- const payload = {
98
- id: generateActionId(),
99
- operation: 'sign-up-verification' as const,
100
- // missing user, identifier, etc.
101
- };
102
-
103
- const result = SignUpVerificationActionPayloadSchema(payload);
104
- expect(result).toBeInstanceOf(type.errors);
105
- });
106
-
107
- test('should delete undeclared keys', () => {
108
- const payload = {
109
- id: generateActionId(),
110
- operation: 'sign-up-verification' as const,
111
- user: generateUserId(),
112
- identifier: 'email' as const,
113
- attempt: 1,
114
- expiresAt: new Date().toISOString(),
115
- updatedAt: new Date().toISOString(),
116
- metadata: {},
117
- extraField: 'should be removed',
118
- };
119
-
120
- const result = SignUpVerificationActionPayloadSchema(payload);
121
- expect(result).not.toBeInstanceOf(type.errors);
122
- expect(result).not.toHaveProperty('extraField');
123
- });
124
- });
125
-
126
- describe('SignUpVerificationActionRequestSchema', () => {
127
- test('should accept valid request', () => {
128
- const request = {
129
- code: 'verification_code_123',
130
- };
131
-
132
- const result = SignUpVerificationActionRequestSchema(request);
133
- expect(result).not.toBeInstanceOf(type.errors);
134
- expect(result).toEqual(request);
135
- });
136
-
137
- test('should reject missing code', () => {
138
- const result = SignUpVerificationActionRequestSchema({});
139
- expect(result).toBeInstanceOf(type.errors);
140
- });
141
-
142
- test('should reject non-string code', () => {
143
- const request = {
144
- code: 123456,
145
- };
146
-
147
- const result = SignUpVerificationActionRequestSchema(request);
148
- expect(result).toBeInstanceOf(type.errors);
149
- });
150
-
151
- test('should delete undeclared keys', () => {
152
- const request = {
153
- code: 'verification_code_123',
154
- extraField: 'should be removed',
155
- };
156
-
157
- const result = SignUpVerificationActionRequestSchema(request);
158
- expect(result).not.toBeInstanceOf(type.errors);
159
- expect(result).not.toHaveProperty('extraField');
160
- expect(result).toEqual({ code: 'verification_code_123' });
161
- });
162
- });
163
- });
@@ -1,203 +0,0 @@
1
- import { type } from 'arktype';
2
- import { describe, expect, test } from 'vitest';
3
- import { generateAppId } from '../../../app/utils.js';
4
- import { generateUserId } from '../../../customer/schema.js';
5
- import { generateActionId } from '../utils.js';
6
- import {
7
- SignUpActionPayloadSchema,
8
- SignUpActionRequestSchema,
9
- } from './sign-up.js';
10
-
11
- describe('Action Schema Operations - Sign Up', () => {
12
- describe('SignUpActionPayloadSchema', () => {
13
- test('should accept complete payload with app', () => {
14
- const payload = {
15
- id: generateActionId(),
16
- operation: 'sign-up' as const,
17
- app: generateAppId(),
18
- user: {
19
- givenName: 'John',
20
- familyName: 'Doe',
21
- },
22
- attempt: 1,
23
- expiresAt: new Date().toISOString(),
24
- updatedAt: new Date().toISOString(),
25
- metadata: { key: 'value' },
26
- };
27
-
28
- const result = SignUpActionPayloadSchema(payload);
29
- expect(result).not.toBeInstanceOf(type.errors);
30
- expect(result).toEqual(payload);
31
- });
32
-
33
- test('should accept payload without app', () => {
34
- const payload = {
35
- id: generateActionId(),
36
- operation: 'sign-up' as const,
37
- user: {
38
- givenName: 'Jane',
39
- familyName: 'Smith',
40
- },
41
- attempt: 1,
42
- expiresAt: new Date().toISOString(),
43
- updatedAt: new Date().toISOString(),
44
- metadata: {},
45
- };
46
-
47
- const result = SignUpActionPayloadSchema(payload);
48
- expect(result).not.toBeInstanceOf(type.errors);
49
- });
50
-
51
- test('should accept minimal user name properties', () => {
52
- const payload = {
53
- id: generateActionId(),
54
- operation: 'sign-up' as const,
55
- user: {},
56
- attempt: 1,
57
- expiresAt: new Date().toISOString(),
58
- updatedAt: new Date().toISOString(),
59
- metadata: {},
60
- };
61
-
62
- const result = SignUpActionPayloadSchema(payload);
63
- expect(result).not.toBeInstanceOf(type.errors);
64
- });
65
-
66
- test('should reject invalid operation', () => {
67
- const payload = {
68
- id: generateActionId(),
69
- operation: 'invalid-operation',
70
- user: { givenName: 'John' },
71
- attempt: 1,
72
- expiresAt: new Date().toISOString(),
73
- updatedAt: new Date().toISOString(),
74
- metadata: {},
75
- };
76
-
77
- const result = SignUpActionPayloadSchema(payload);
78
- expect(result).toBeInstanceOf(type.errors);
79
- });
80
-
81
- test('should reject missing required fields', () => {
82
- const payload = {
83
- id: generateActionId(),
84
- operation: 'sign-up' as const,
85
- // missing user, attempt, etc.
86
- };
87
-
88
- const result = SignUpActionPayloadSchema(payload);
89
- expect(result).toBeInstanceOf(type.errors);
90
- });
91
-
92
- test('should delete undeclared keys', () => {
93
- const payload = {
94
- id: generateActionId(),
95
- operation: 'sign-up' as const,
96
- user: { givenName: 'John' },
97
- attempt: 1,
98
- expiresAt: new Date().toISOString(),
99
- updatedAt: new Date().toISOString(),
100
- metadata: {},
101
- extraField: 'should be removed',
102
- };
103
-
104
- const result = SignUpActionPayloadSchema(payload);
105
- expect(result).not.toBeInstanceOf(type.errors);
106
- expect(result).not.toHaveProperty('extraField');
107
- });
108
- });
109
-
110
- describe('SignUpActionRequestSchema', () => {
111
- test('should accept email sign up request', () => {
112
- const request = {
113
- id: generateUserId(),
114
- email: 'john@example.com',
115
- givenName: 'John',
116
- familyName: 'Doe',
117
- };
118
-
119
- const result = SignUpActionRequestSchema(request);
120
- expect(result).not.toBeInstanceOf(type.errors);
121
- expect(result).toEqual(request);
122
- });
123
-
124
- test('should accept phone number sign up request', () => {
125
- const request = {
126
- id: generateUserId(),
127
- phoneNumber: '+1234567890',
128
- givenName: 'Jane',
129
- familyName: 'Smith',
130
- };
131
-
132
- const result = SignUpActionRequestSchema(request);
133
- expect(result).not.toBeInstanceOf(type.errors);
134
- expect(result).toEqual(request);
135
- });
136
-
137
- test('should accept request with both email and phone', () => {
138
- const request = {
139
- id: generateUserId(),
140
- email: 'john@example.com',
141
- phoneNumber: '+1234567890',
142
- givenName: 'John',
143
- familyName: 'Doe',
144
- };
145
-
146
- const result = SignUpActionRequestSchema(request);
147
- expect(result).not.toBeInstanceOf(type.errors);
148
- expect(result).toEqual(request);
149
- });
150
-
151
- test('should accept minimal request with just email', () => {
152
- const request = {
153
- email: 'minimal@example.com',
154
- };
155
-
156
- const result = SignUpActionRequestSchema(request);
157
- expect(result).not.toBeInstanceOf(type.errors);
158
- });
159
-
160
- test('should accept minimal request with just phone', () => {
161
- const request = {
162
- phoneNumber: '+1234567890',
163
- };
164
-
165
- const result = SignUpActionRequestSchema(request);
166
- expect(result).not.toBeInstanceOf(type.errors);
167
- });
168
-
169
- test('should reject request without email or phone', () => {
170
- const request = {
171
- givenName: 'John',
172
- familyName: 'Doe',
173
- };
174
-
175
- const result = SignUpActionRequestSchema(request);
176
- expect(result).toBeInstanceOf(type.errors);
177
- });
178
-
179
- test('should reject invalid email format', () => {
180
- const request = {
181
- email: 'invalid-email',
182
- givenName: 'John',
183
- };
184
-
185
- const result = SignUpActionRequestSchema(request);
186
- expect(result).toBeInstanceOf(type.errors);
187
- });
188
-
189
- test('should accept optional name properties', () => {
190
- const request = {
191
- email: 'john@example.com',
192
- givenName: 'John',
193
- familyName: 'Doe',
194
- middleName: 'Michael',
195
- honorificPrefix: 'Dr.',
196
- honorificSuffix: 'Jr.',
197
- };
198
-
199
- const result = SignUpActionRequestSchema(request);
200
- expect(result).not.toBeInstanceOf(type.errors);
201
- });
202
- });
203
- });
@@ -1,148 +0,0 @@
1
- import { type } from 'arktype';
2
- import { describe, expect, test } from 'vitest';
3
- import { generateUserId } from '../../../customer/schema.js';
4
- import { generateActionId } from '../utils.js';
5
- import {
6
- UserAttributeVerificationActionPayloadSchema,
7
- UserAttributeVerificationActionRequestSchema,
8
- } from './user-attribute-verification.js';
9
-
10
- describe('Action Schema Operations - User Attribute Verification', () => {
11
- describe('UserAttributeVerificationActionPayloadSchema', () => {
12
- test('should accept complete payload with email attribute', () => {
13
- const payload = {
14
- id: generateActionId(),
15
- operation: 'user-attribute-verification' as const,
16
- user: generateUserId(),
17
- attribute: 'email' as const,
18
- attempt: 1,
19
- expiresAt: new Date().toISOString(),
20
- updatedAt: new Date().toISOString(),
21
- metadata: { key: 'value' },
22
- };
23
-
24
- const result = UserAttributeVerificationActionPayloadSchema(payload);
25
- expect(result).not.toBeInstanceOf(type.errors);
26
- expect(result).toEqual(payload);
27
- });
28
-
29
- test('should accept payload with phoneNumber attribute', () => {
30
- const payload = {
31
- id: generateActionId(),
32
- operation: 'user-attribute-verification' as const,
33
- user: generateUserId(),
34
- attribute: 'phoneNumber' as const,
35
- attempt: 1,
36
- expiresAt: new Date().toISOString(),
37
- updatedAt: new Date().toISOString(),
38
- metadata: {},
39
- };
40
-
41
- const result = UserAttributeVerificationActionPayloadSchema(payload);
42
- expect(result).not.toBeInstanceOf(type.errors);
43
- expect(result).toEqual(payload);
44
- });
45
-
46
- test('should accept payload with optional dates', () => {
47
- const payload = {
48
- id: generateActionId(),
49
- operation: 'user-attribute-verification' as const,
50
- user: generateUserId(),
51
- attribute: 'email' as const,
52
- attempt: 2,
53
- expiresAt: new Date().toISOString(),
54
- updatedAt: new Date().toISOString(),
55
- deletedAt: new Date().toISOString(),
56
- deactivatedAt: new Date().toISOString(),
57
- metadata: {},
58
- };
59
-
60
- const result = UserAttributeVerificationActionPayloadSchema(payload);
61
- expect(result).not.toBeInstanceOf(type.errors);
62
- });
63
-
64
- test('should reject invalid operation', () => {
65
- const payload = {
66
- id: generateActionId(),
67
- operation: 'invalid-operation',
68
- user: generateUserId(),
69
- attribute: 'email' as const,
70
- attempt: 1,
71
- expiresAt: new Date().toISOString(),
72
- updatedAt: new Date().toISOString(),
73
- metadata: {},
74
- };
75
-
76
- const result = UserAttributeVerificationActionPayloadSchema(payload);
77
- expect(result).toBeInstanceOf(type.errors);
78
- });
79
-
80
- test('should reject invalid attribute', () => {
81
- const payload = {
82
- id: generateActionId(),
83
- operation: 'user-attribute-verification' as const,
84
- user: generateUserId(),
85
- attribute: 'username',
86
- attempt: 1,
87
- expiresAt: new Date().toISOString(),
88
- updatedAt: new Date().toISOString(),
89
- metadata: {},
90
- };
91
-
92
- const result = UserAttributeVerificationActionPayloadSchema(payload);
93
- expect(result).toBeInstanceOf(type.errors);
94
- });
95
-
96
- test('should reject missing required fields', () => {
97
- const payload = {
98
- id: generateActionId(),
99
- operation: 'user-attribute-verification' as const,
100
- // missing user, attribute, attempt, etc.
101
- };
102
-
103
- const result = UserAttributeVerificationActionPayloadSchema(payload);
104
- expect(result).toBeInstanceOf(type.errors);
105
- });
106
-
107
- test('should delete undeclared keys', () => {
108
- const payload = {
109
- id: generateActionId(),
110
- operation: 'user-attribute-verification' as const,
111
- user: generateUserId(),
112
- attribute: 'email' as const,
113
- attempt: 1,
114
- expiresAt: new Date().toISOString(),
115
- updatedAt: new Date().toISOString(),
116
- metadata: {},
117
- extraField: 'should be removed',
118
- };
119
-
120
- const result = UserAttributeVerificationActionPayloadSchema(payload);
121
- expect(result).not.toBeInstanceOf(type.errors);
122
- expect(result).not.toHaveProperty('extraField');
123
- });
124
- });
125
-
126
- describe('UserAttributeVerificationActionRequestSchema', () => {
127
- test('should accept empty request', () => {
128
- const request = {};
129
-
130
- const result = UserAttributeVerificationActionRequestSchema(request);
131
- expect(result).not.toBeInstanceOf(type.errors);
132
- expect(result).toEqual(request);
133
- });
134
-
135
- test('should delete undeclared keys', () => {
136
- const request = {
137
- extraField: 'should be removed',
138
- anotherField: 'also removed',
139
- };
140
-
141
- const result = UserAttributeVerificationActionRequestSchema(request);
142
- expect(result).not.toBeInstanceOf(type.errors);
143
- expect(result).not.toHaveProperty('extraField');
144
- expect(result).not.toHaveProperty('anotherField');
145
- expect(result).toEqual({});
146
- });
147
- });
148
- });