@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,367 +0,0 @@
1
- import { type } from 'arktype';
2
- import { describe, expect, test } from 'vitest';
3
- import { generateActivityId } from '../utils.js';
4
- import {
5
- type InsertNoteActivityPayload,
6
- InsertNoteActivityPayloadSchema,
7
- NoteActivityPayloadSchema,
8
- NoteActivitySchema,
9
- UpdateNoteActivityPayloadSchema,
10
- } from './note.js';
11
-
12
- describe('Activity Schema - Note', () => {
13
- describe('NoteActivitySchema', () => {
14
- test('should accept complete note activity', () => {
15
- const activity = {
16
- id: generateActivityId(),
17
- type: 'note' as const,
18
- message: 'This is a test note',
19
- performedBy: {
20
- type: 'identity' as const,
21
- identifier: 'user@example.com',
22
- },
23
- source: 'web-app',
24
- isMutateable: true,
25
- createdAt: new Date(),
26
- updatedAt: new Date(),
27
- metadata: { priority: 'high' },
28
- };
29
-
30
- const result = NoteActivitySchema(activity);
31
- expect(result).not.toBeInstanceOf(type.errors);
32
- });
33
-
34
- test('should accept note activity with optional fields', () => {
35
- const activity = {
36
- id: generateActivityId(),
37
- type: 'note' as const,
38
- message: 'Note with optional fields',
39
- performedBy: {
40
- type: 'system' as const,
41
- identifier: 'automated-process',
42
- },
43
- source: 'background-job',
44
- isMutateable: false,
45
- createdAt: new Date(),
46
- updatedAt: new Date(),
47
- deletedAt: new Date(),
48
- deactivatedAt: new Date(),
49
- metadata: { category: 'system' },
50
- };
51
-
52
- const result = NoteActivitySchema(activity);
53
- expect(result).not.toBeInstanceOf(type.errors);
54
- });
55
-
56
- test('should reject note activity with wrong type', () => {
57
- const activity = {
58
- id: generateActivityId(),
59
- type: 'operation',
60
- message: 'This should fail',
61
- performedBy: {
62
- type: 'identity' as const,
63
- identifier: 'user@example.com',
64
- },
65
- source: 'web-app',
66
- isMutateable: true,
67
- createdAt: new Date(),
68
- updatedAt: new Date(),
69
- metadata: {},
70
- };
71
-
72
- const result = NoteActivitySchema(activity);
73
- expect(result).toBeInstanceOf(type.errors);
74
- });
75
-
76
- test('should reject note activity missing message', () => {
77
- const activity = {
78
- id: generateActivityId(),
79
- type: 'note' as const,
80
- // missing message
81
- performedBy: {
82
- type: 'identity' as const,
83
- identifier: 'user@example.com',
84
- },
85
- source: 'web-app',
86
- isMutateable: true,
87
- createdAt: new Date(),
88
- updatedAt: new Date(),
89
- metadata: {},
90
- };
91
-
92
- const result = NoteActivitySchema(activity);
93
- expect(result).toBeInstanceOf(type.errors);
94
- });
95
-
96
- test('should reject note activity with non-string message', () => {
97
- const activity = {
98
- id: generateActivityId(),
99
- type: 'note' as const,
100
- message: 123,
101
- performedBy: {
102
- type: 'identity' as const,
103
- identifier: 'user@example.com',
104
- },
105
- source: 'web-app',
106
- isMutateable: true,
107
- createdAt: new Date(),
108
- updatedAt: new Date(),
109
- metadata: {},
110
- };
111
-
112
- const result = NoteActivitySchema(activity);
113
- expect(result).toBeInstanceOf(type.errors);
114
- });
115
- });
116
-
117
- describe('NoteActivityPayloadSchema', () => {
118
- test('should accept complete note activity payload', () => {
119
- const payload = {
120
- id: generateActivityId(),
121
- type: 'note' as const,
122
- message: 'Test note payload',
123
- performedBy: {
124
- type: 'identity' as const,
125
- identifier: 'user@example.com',
126
- },
127
- source: 'mobile-app',
128
- isMutateable: true,
129
- createdAt: new Date().toISOString(),
130
- updatedAt: new Date().toISOString(),
131
- metadata: { urgent: true },
132
- };
133
-
134
- const result = NoteActivityPayloadSchema(payload);
135
- expect(result).not.toBeInstanceOf(type.errors);
136
- expect(result).toEqual(payload);
137
- });
138
-
139
- test('should accept minimal note activity payload', () => {
140
- const payload = {
141
- id: generateActivityId(),
142
- type: 'note' as const,
143
- message: 'Simple note',
144
- performedBy: {
145
- type: 'system' as const,
146
- identifier: 'auto-note',
147
- },
148
- source: 'scheduler',
149
- isMutateable: false,
150
- createdAt: new Date().toISOString(),
151
- updatedAt: new Date().toISOString(),
152
- metadata: {},
153
- };
154
-
155
- const result = NoteActivityPayloadSchema(payload);
156
- expect(result).not.toBeInstanceOf(type.errors);
157
- });
158
-
159
- test('should accept payload with optional date fields', () => {
160
- const payload = {
161
- id: generateActivityId(),
162
- type: 'note' as const,
163
- message: 'Note with dates',
164
- performedBy: {
165
- type: 'guest' as const,
166
- identifier: 'anonymous',
167
- },
168
- source: 'public-form',
169
- isMutateable: true,
170
- createdAt: new Date().toISOString(),
171
- updatedAt: new Date().toISOString(),
172
- deletedAt: new Date().toISOString(),
173
- deactivatedAt: new Date().toISOString(),
174
- metadata: { public: true },
175
- };
176
-
177
- const result = NoteActivityPayloadSchema(payload);
178
- expect(result).not.toBeInstanceOf(type.errors);
179
- });
180
-
181
- test('should reject payload with invalid date format', () => {
182
- const payload = {
183
- id: generateActivityId(),
184
- type: 'note' as const,
185
- message: 'Test note',
186
- performedBy: {
187
- type: 'identity' as const,
188
- identifier: 'user@example.com',
189
- },
190
- source: 'web-app',
191
- isMutateable: true,
192
- createdAt: 'invalid-date-format',
193
- updatedAt: new Date().toISOString(),
194
- metadata: {},
195
- };
196
-
197
- const result = NoteActivityPayloadSchema(payload);
198
- expect(result).toBeInstanceOf(type.errors);
199
- });
200
-
201
- test('should reject payload with wrong type', () => {
202
- const payload = {
203
- id: generateActivityId(),
204
- type: 'authentication',
205
- message: 'Wrong type',
206
- performedBy: {
207
- type: 'identity' as const,
208
- identifier: 'user@example.com',
209
- },
210
- source: 'web-app',
211
- isMutateable: true,
212
- createdAt: new Date().toISOString(),
213
- updatedAt: new Date().toISOString(),
214
- metadata: {},
215
- };
216
-
217
- const result = NoteActivityPayloadSchema(payload);
218
- expect(result).toBeInstanceOf(type.errors);
219
- });
220
- });
221
-
222
- describe('InsertNoteActivityPayloadSchema', () => {
223
- test('should accept complete insert payload', () => {
224
- const payload = {
225
- id: generateActivityId(),
226
- type: 'note' as const,
227
- message: 'New note to insert',
228
- performedBy: {
229
- type: 'identity' as const,
230
- identifier: 'user@example.com',
231
- },
232
- metadata: { source: 'manual' },
233
- };
234
-
235
- const result = InsertNoteActivityPayloadSchema(payload);
236
- expect(result).not.toBeInstanceOf(type.errors);
237
- expect(result).toEqual(payload);
238
- });
239
-
240
- test('should accept minimal insert payload', () => {
241
- const payload = {
242
- type: 'note' as const,
243
- message: 'Basic note',
244
- };
245
-
246
- const result = InsertNoteActivityPayloadSchema(payload);
247
- expect(result).not.toBeInstanceOf(type.errors);
248
- // Should generate ID automatically
249
- expect((result as InsertNoteActivityPayload).id).toMatch(/^act_/);
250
- });
251
-
252
- test('should accept insert payload without performer', () => {
253
- const payload = {
254
- type: 'note' as const,
255
- message: 'Auto-generated note',
256
- metadata: { automated: true },
257
- };
258
-
259
- const result = InsertNoteActivityPayloadSchema(payload);
260
- expect(result).not.toBeInstanceOf(type.errors);
261
- });
262
-
263
- test('should reject insert payload missing type', () => {
264
- const payload = {
265
- message: 'Note without type',
266
- };
267
-
268
- const result = InsertNoteActivityPayloadSchema(payload);
269
- expect(result).toBeInstanceOf(type.errors);
270
- });
271
-
272
- test('should reject insert payload missing message', () => {
273
- const payload = {
274
- type: 'note' as const,
275
- // missing message
276
- };
277
-
278
- const result = InsertNoteActivityPayloadSchema(payload);
279
- expect(result).toBeInstanceOf(type.errors);
280
- });
281
-
282
- test('should reject insert payload with wrong type', () => {
283
- const payload = {
284
- type: 'operation',
285
- message: 'Wrong type note',
286
- };
287
-
288
- const result = InsertNoteActivityPayloadSchema(payload);
289
- expect(result).toBeInstanceOf(type.errors);
290
- });
291
- });
292
-
293
- describe('UpdateNoteActivityPayloadSchema', () => {
294
- test('should accept update payload with message', () => {
295
- const payload = {
296
- type: 'note' as const,
297
- message: 'Updated note message',
298
- performedBy: {
299
- type: 'identity' as const,
300
- identifier: 'user@example.com',
301
- },
302
- metadata: { updated: true },
303
- };
304
-
305
- const result = UpdateNoteActivityPayloadSchema(payload);
306
- expect(result).not.toBeInstanceOf(type.errors);
307
- expect(result).toEqual(payload);
308
- });
309
-
310
- test('should accept update payload without message', () => {
311
- const payload = {
312
- type: 'note' as const,
313
- performedBy: {
314
- type: 'automation' as const,
315
- identifier: 'note-updater',
316
- },
317
- metadata: { last_modified: new Date().toISOString() },
318
- };
319
-
320
- const result = UpdateNoteActivityPayloadSchema(payload);
321
- expect(result).not.toBeInstanceOf(type.errors);
322
- });
323
-
324
- test('should accept minimal update payload', () => {
325
- const payload = {
326
- type: 'note' as const,
327
- };
328
-
329
- const result = UpdateNoteActivityPayloadSchema(payload);
330
- expect(result).not.toBeInstanceOf(type.errors);
331
- });
332
-
333
- test('should accept update with only metadata', () => {
334
- const payload = {
335
- type: 'note' as const,
336
- metadata: { priority: 'low' },
337
- };
338
-
339
- const result = UpdateNoteActivityPayloadSchema(payload);
340
- expect(result).not.toBeInstanceOf(type.errors);
341
- });
342
-
343
- test('should reject update payload with wrong type', () => {
344
- const payload = {
345
- type: 'unknown',
346
- message: 'Updated message',
347
- };
348
-
349
- const result = UpdateNoteActivityPayloadSchema(payload);
350
- expect(result).toBeInstanceOf(type.errors);
351
- });
352
-
353
- test('should reject update payload with invalid performer', () => {
354
- const payload = {
355
- type: 'note' as const,
356
- message: 'Updated note',
357
- performedBy: {
358
- type: 'invalid_performer_type',
359
- identifier: 'test',
360
- },
361
- };
362
-
363
- const result = UpdateNoteActivityPayloadSchema(payload);
364
- expect(result).toBeInstanceOf(type.errors);
365
- });
366
- });
367
- });