@go-mondo/identity-sdk 0.0.2-beta.68 → 0.0.2-beta.71

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 (66) 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 +21 -0
  5. package/README.md +2 -0
  6. package/dist/cjs/action/schema/base.d.ts +0 -2
  7. package/dist/cjs/action/schema/base.d.ts.map +1 -1
  8. package/dist/cjs/action/schema/base.js +0 -2
  9. package/dist/cjs/action/schema/base.test.js +0 -1
  10. package/dist/cjs/action/schema/schema.d.ts +5 -28
  11. package/dist/cjs/action/schema/schema.d.ts.map +1 -1
  12. package/dist/cjs/action/schema/schema.js +6 -5
  13. package/dist/cjs/action/schema/schema.test.js +20 -46
  14. package/dist/cjs/association/schema.d.ts +8 -8
  15. package/dist/cjs/authentication/sessions/schema.d.ts +2 -5
  16. package/dist/cjs/authentication/sessions/schema.d.ts.map +1 -1
  17. package/dist/cjs/authentication/strategies/schema/base.d.ts +0 -2
  18. package/dist/cjs/authentication/strategies/schema/base.d.ts.map +1 -1
  19. package/dist/cjs/authentication/strategies/schema/base.js +0 -2
  20. package/dist/cjs/authentication/strategies/schema/schema.d.ts +0 -84
  21. package/dist/cjs/authentication/strategies/schema/schema.d.ts.map +1 -1
  22. package/dist/cjs/authentication/strategies/schema/schema.js +0 -6
  23. package/dist/cjs/oauth/authorize/schema/grants/implicit.d.ts +1 -1
  24. package/dist/cjs/oauth/authorize/schema/schema.d.ts +1 -1
  25. package/dist/esm/action/schema/base.d.ts +0 -2
  26. package/dist/esm/action/schema/base.d.ts.map +1 -1
  27. package/dist/esm/action/schema/base.js +0 -2
  28. package/dist/esm/action/schema/base.test.js +1 -2
  29. package/dist/esm/action/schema/schema.d.ts +5 -28
  30. package/dist/esm/action/schema/schema.d.ts.map +1 -1
  31. package/dist/esm/action/schema/schema.js +6 -5
  32. package/dist/esm/action/schema/schema.test.js +2 -28
  33. package/dist/esm/association/schema.d.ts +8 -8
  34. package/dist/esm/authentication/sessions/schema.d.ts +2 -5
  35. package/dist/esm/authentication/sessions/schema.d.ts.map +1 -1
  36. package/dist/esm/authentication/strategies/schema/base.d.ts +0 -2
  37. package/dist/esm/authentication/strategies/schema/base.d.ts.map +1 -1
  38. package/dist/esm/authentication/strategies/schema/base.js +0 -2
  39. package/dist/esm/authentication/strategies/schema/schema.d.ts +0 -84
  40. package/dist/esm/authentication/strategies/schema/schema.d.ts.map +1 -1
  41. package/dist/esm/authentication/strategies/schema/schema.js +0 -6
  42. package/dist/esm/oauth/authorize/schema/grants/implicit.d.ts +1 -1
  43. package/dist/esm/oauth/authorize/schema/schema.d.ts +1 -1
  44. package/package.json +1 -1
  45. package/dist/cjs/action/schema/operations/set-password.d.ts +0 -31
  46. package/dist/cjs/action/schema/operations/set-password.d.ts.map +0 -1
  47. package/dist/cjs/action/schema/operations/set-password.js +0 -52
  48. package/dist/cjs/action/schema/operations/set-password.test.d.ts +0 -2
  49. package/dist/cjs/action/schema/operations/set-password.test.d.ts.map +0 -1
  50. package/dist/cjs/action/schema/operations/set-password.test.js +0 -168
  51. package/dist/cjs/authentication/strategies/schema/types/password.d.ts +0 -139
  52. package/dist/cjs/authentication/strategies/schema/types/password.d.ts.map +0 -1
  53. package/dist/cjs/authentication/strategies/schema/types/password.js +0 -93
  54. package/dist/esm/action/schema/operations/set-password.d.ts +0 -31
  55. package/dist/esm/action/schema/operations/set-password.d.ts.map +0 -1
  56. package/dist/esm/action/schema/operations/set-password.js +0 -16
  57. package/dist/esm/action/schema/operations/set-password.test.d.ts +0 -2
  58. package/dist/esm/action/schema/operations/set-password.test.d.ts.map +0 -1
  59. package/dist/esm/action/schema/operations/set-password.test.js +0 -166
  60. package/dist/esm/authentication/strategies/schema/types/password.d.ts +0 -139
  61. package/dist/esm/authentication/strategies/schema/types/password.d.ts.map +0 -1
  62. package/dist/esm/authentication/strategies/schema/types/password.js +0 -57
  63. package/src/action/schema/base.test.ts.bak +0 -152
  64. package/src/action/schema/operations/set-password.test.ts.bak +0 -197
  65. package/src/action/schema/schema.test.ts.bak +0 -218
  66. package/src/authentication/strategies/schema/types/email.test.ts.bak +0 -252
@@ -1,252 +0,0 @@
1
- import { type } from 'arktype';
2
- import { describe, expect, test } from 'vitest';
3
- import { generateStrategyId } from '../../../../authentication/utils.js';
4
- import {
5
- EmailStrategyPayloadSchema,
6
- EmailStrategySchema,
7
- InsertEmailStrategyPayloadSchema,
8
- SendEmailVerificationCodeSchema,
9
- UpdateEmailStrategyPayloadSchema,
10
- VerifyEmailSchema,
11
- } from './email.js';
12
-
13
- describe('Authentication Strategies - Email', () => {
14
- describe('EmailStrategySchema', () => {
15
- test('should accept complete email strategy', () => {
16
- const strategy = {
17
- id: generateStrategyId(),
18
- type: 'email',
19
- label: 'Test',
20
- status: 'enabled',
21
- createdAt: new Date(),
22
- updatedAt: new Date(),
23
- metadata: { provider: 'sendgrid' },
24
- };
25
-
26
- const result = EmailStrategySchema(strategy);
27
- expect(result).not.toBeInstanceOf(type.errors);
28
- });
29
-
30
- test('should reject invalid type', () => {
31
- const strategy = {
32
- id: generateStrategyId(),
33
- type: 'password',
34
- status: 'enabled',
35
- createdAt: new Date(),
36
- updatedAt: new Date(),
37
- metadata: {},
38
- };
39
-
40
- const result = EmailStrategySchema(strategy);
41
- expect(result).toBeInstanceOf(type.errors);
42
- });
43
-
44
- test('should reject missing required fields', () => {
45
- const strategy = {
46
- type: 'email',
47
- // missing id, enabled, dates, metadata
48
- };
49
-
50
- const result = EmailStrategySchema(strategy);
51
- expect(result).toBeInstanceOf(type.errors);
52
- });
53
- });
54
-
55
- describe('EmailStrategyPayloadSchema', () => {
56
- test('should accept complete payload', () => {
57
- const payload = {
58
- id: generateStrategyId(),
59
- type: 'email',
60
- label: 'Test',
61
- status: 'enabled',
62
- createdAt: new Date().toISOString(),
63
- updatedAt: new Date().toISOString(),
64
- metadata: { configured: true },
65
- };
66
-
67
- const result = EmailStrategyPayloadSchema(payload);
68
- expect(result).not.toBeInstanceOf(type.errors);
69
- expect(result).toEqual(payload);
70
- });
71
-
72
- test('should reject invalid type', () => {
73
- const payload = {
74
- id: generateStrategyId(),
75
- type: 'sms',
76
- label: 'Test',
77
- status: 'enabled',
78
- createdAt: new Date().toISOString(),
79
- updatedAt: new Date().toISOString(),
80
- metadata: {},
81
- };
82
-
83
- const result = EmailStrategyPayloadSchema(payload);
84
- expect(result).toBeInstanceOf(type.errors);
85
- });
86
- });
87
-
88
- describe('InsertEmailStrategyPayloadSchema', () => {
89
- test('should accept complete insert payload', () => {
90
- const payload = {
91
- id: generateStrategyId(),
92
- type: 'email',
93
- label: 'Test',
94
- status: 'enabled',
95
- metadata: { setup: 'manual' },
96
- };
97
-
98
- const result = InsertEmailStrategyPayloadSchema(payload);
99
- expect(result).not.toBeInstanceOf(type.errors);
100
- });
101
-
102
- test('should accept minimal insert payload', () => {
103
- const payload = {
104
- type: 'email',
105
- label: 'Test',
106
- };
107
-
108
- const result = InsertEmailStrategyPayloadSchema(payload);
109
- expect(result).not.toBeInstanceOf(type.errors);
110
- });
111
-
112
- test('should reject missing type', () => {
113
- const payload = {
114
- status: 'enabled',
115
- };
116
-
117
- const result = InsertEmailStrategyPayloadSchema(payload);
118
- expect(result).toBeInstanceOf(type.errors);
119
- });
120
-
121
- test('should reject invalid type', () => {
122
- const payload = {
123
- type: 'password',
124
- };
125
-
126
- const result = InsertEmailStrategyPayloadSchema(payload);
127
- expect(result).toBeInstanceOf(type.errors);
128
- });
129
- });
130
-
131
- describe('UpdateEmailStrategyPayloadSchema', () => {
132
- test('should accept update with type and enabled', () => {
133
- const payload = {
134
- type: 'email',
135
- enabled: false,
136
- metadata: { updated: true },
137
- };
138
-
139
- const result = UpdateEmailStrategyPayloadSchema(payload);
140
- expect(result).not.toBeInstanceOf(type.errors);
141
- expect(result).toEqual(payload);
142
- });
143
-
144
- test('should accept minimal update', () => {
145
- const payload = {
146
- type: 'email',
147
- };
148
-
149
- const result = UpdateEmailStrategyPayloadSchema(payload);
150
- expect(result).not.toBeInstanceOf(type.errors);
151
- });
152
-
153
- test('should reject invalid type', () => {
154
- const payload = {
155
- type: 'totp',
156
- };
157
-
158
- const result = UpdateEmailStrategyPayloadSchema(payload);
159
- expect(result).toBeInstanceOf(type.errors);
160
- });
161
- });
162
-
163
- describe('VerifyEmailSchema', () => {
164
- test('should accept verification with email and code', () => {
165
- const verification = {
166
- email: 'user@example.com',
167
- code: '123456',
168
- };
169
-
170
- const result = VerifyEmailSchema(verification);
171
- expect(result).not.toBeInstanceOf(type.errors);
172
- expect(result).toEqual(verification);
173
- });
174
-
175
- test('should accept verification with only code', () => {
176
- const verification = {
177
- code: 'ABC123',
178
- };
179
-
180
- const result = VerifyEmailSchema(verification);
181
- expect(result).not.toBeInstanceOf(type.errors);
182
- expect(result).toEqual(verification);
183
- });
184
-
185
- test('should reject missing code', () => {
186
- const verification = {
187
- email: 'user@example.com',
188
- };
189
-
190
- const result = VerifyEmailSchema(verification);
191
- expect(result).toBeInstanceOf(type.errors);
192
- });
193
-
194
- test('should reject invalid email format', () => {
195
- const verification = {
196
- email: 'invalid-email',
197
- code: '123456',
198
- };
199
-
200
- const result = VerifyEmailSchema(verification);
201
- expect(result).toBeInstanceOf(type.errors);
202
- });
203
-
204
- test('should reject non-string code', () => {
205
- const verification = {
206
- email: 'user@example.com',
207
- code: 123456,
208
- };
209
-
210
- const result = VerifyEmailSchema(verification);
211
- expect(result).toBeInstanceOf(type.errors);
212
- });
213
- });
214
-
215
- describe('SendEmailVerificationCodeSchema', () => {
216
- test('should accept valid email', () => {
217
- const request = {
218
- email: 'test@example.com',
219
- };
220
-
221
- const result = SendEmailVerificationCodeSchema(request);
222
- expect(result).not.toBeInstanceOf(type.errors);
223
- expect(result).toEqual(request);
224
- });
225
-
226
- test('should accept empty request', () => {
227
- const request = {};
228
-
229
- const result = SendEmailVerificationCodeSchema(request);
230
- expect(result).not.toBeInstanceOf(type.errors);
231
- expect(result).toEqual(request);
232
- });
233
-
234
- test('should reject invalid email format', () => {
235
- const request = {
236
- email: 'not-an-email',
237
- };
238
-
239
- const result = SendEmailVerificationCodeSchema(request);
240
- expect(result).toBeInstanceOf(type.errors);
241
- });
242
-
243
- test('should reject non-string email', () => {
244
- const request = {
245
- email: 123,
246
- };
247
-
248
- const result = SendEmailVerificationCodeSchema(request);
249
- expect(result).toBeInstanceOf(type.errors);
250
- });
251
- });
252
- });