@go-mondo/identity-sdk 0.0.2-beta.74 → 0.0.2-beta.76

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 (56) 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 +14 -23
  6. package/dist/cjs/app/authorization/schema.d.ts.map +1 -1
  7. package/dist/cjs/app/authorization/schema.js +5 -3
  8. package/dist/cjs/app/authorization/schema.test.js +26 -0
  9. package/dist/cjs/common/schema/jwt.d.ts +0 -6
  10. package/dist/cjs/common/schema/jwt.d.ts.map +1 -1
  11. package/dist/cjs/common/schema/jwt.js +0 -3
  12. package/dist/cjs/common/schema/jwt.test.js +0 -8
  13. package/dist/cjs/workspace/authorization/schema.d.ts +0 -9
  14. package/dist/cjs/workspace/authorization/schema.d.ts.map +1 -1
  15. package/dist/esm/app/authorization/schema.d.ts +14 -23
  16. package/dist/esm/app/authorization/schema.d.ts.map +1 -1
  17. package/dist/esm/app/authorization/schema.js +5 -3
  18. package/dist/esm/app/authorization/schema.test.js +26 -0
  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/workspace/authorization/schema.d.ts +0 -9
  24. package/dist/esm/workspace/authorization/schema.d.ts.map +1 -1
  25. package/package.json +1 -1
  26. package/src/action/schema/operations/sign-up-verification.test.ts.bak +0 -163
  27. package/src/action/schema/operations/sign-up.test.ts.bak +0 -203
  28. package/src/action/schema/operations/user-attribute-verification.test.ts.bak +0 -148
  29. package/src/activity/schema/base.test.ts.bak +0 -291
  30. package/src/activity/schema/schema.test.ts.bak +0 -392
  31. package/src/activity/schema/types/authentication.test.ts.bak +0 -337
  32. package/src/activity/schema/types/authorization.test.ts.bak +0 -379
  33. package/src/activity/schema/types/note.test.ts.bak +0 -367
  34. package/src/activity/schema/types/operation.test.ts.bak +0 -379
  35. package/src/activity/schema/types/unknown.test.ts.bak +0 -304
  36. package/src/app/authorization/schema.test.ts.bak +0 -412
  37. package/src/app/oidc/schema.test.ts.bak +0 -117
  38. package/src/app/registration/schema.test.ts.bak +0 -308
  39. package/src/app/schema.test.ts.bak +0 -221
  40. package/src/association/schema.test.ts.bak +0 -148
  41. package/src/authentication/factors/schema.test.ts.bak +0 -174
  42. package/src/authentication/settings/schema.test.ts.bak +0 -91
  43. package/src/authorization/permissions/schema.test.ts.bak +0 -267
  44. package/src/authorization/roles/schema.test.ts.bak +0 -283
  45. package/src/common/schema/aggregate.test.ts.bak +0 -89
  46. package/src/common/schema/collection.test.ts.bak +0 -116
  47. package/src/common/schema/dates.test.ts.bak +0 -49
  48. package/src/common/schema/id.test.ts.bak +0 -149
  49. package/src/common/schema/jwt.test.ts.bak +0 -61
  50. package/src/common/schema/metadata.test.ts.bak +0 -141
  51. package/src/common/schema/pagination.test.ts.bak +0 -80
  52. package/src/common/schema/schema.test.ts.bak +0 -41
  53. package/src/customer/users/schema.test.ts.bak +0 -138
  54. package/src/identity/schema.test.ts.bak +0 -48
  55. package/src/oauth/token/schema/schema.test.ts.bak +0 -142
  56. package/src/workspace/settings/schema.test.ts.bak +0 -88
@@ -1,379 +0,0 @@
1
- import { type } from 'arktype';
2
- import { describe, expect, test } from 'vitest';
3
- import {
4
- OperationType,
5
- OperationActivitySchema,
6
- OperationActivityPayloadSchema,
7
- } from './operation.js';
8
- import { generateActivityId } from '../utils.js';
9
-
10
- describe('Activity Schema - Operation', () => {
11
- describe('OperationType', () => {
12
- test('should contain expected operation values', () => {
13
- expect(OperationType.CREATE).toBe('create');
14
- expect(OperationType.UPDATE).toBe('update');
15
- expect(OperationType.DELETE).toBe('delete');
16
- expect(OperationType.AUTOMATION).toBe('automation');
17
- });
18
- });
19
-
20
- describe('OperationActivitySchema', () => {
21
- test('should accept complete operation activity with create', () => {
22
- const activity = {
23
- id: generateActivityId(),
24
- type: 'operation' as const,
25
- operation: 'create' as const,
26
- message: 'User account created successfully',
27
- target: 'user:123',
28
- performedBy: {
29
- type: 'identity' as const,
30
- identifier: 'admin@example.com',
31
- },
32
- source: 'admin-panel',
33
- isMutateable: true,
34
- createdAt: new Date(),
35
- updatedAt: new Date(),
36
- metadata: { entity: 'user', action: 'create' },
37
- };
38
-
39
- const result = OperationActivitySchema(activity);
40
- expect(result).not.toBeInstanceOf(type.errors);
41
- });
42
-
43
- test('should accept operation activity with update', () => {
44
- const activity = {
45
- id: generateActivityId(),
46
- type: 'operation' as const,
47
- operation: 'update' as const,
48
- message: 'User profile updated',
49
- target: 'profile:456',
50
- performedBy: {
51
- type: 'identity' as const,
52
- identifier: 'user@example.com',
53
- },
54
- source: 'user-dashboard',
55
- isMutateable: true,
56
- createdAt: new Date(),
57
- updatedAt: new Date(),
58
- metadata: { fields_updated: ['name', 'email'] },
59
- };
60
-
61
- const result = OperationActivitySchema(activity);
62
- expect(result).not.toBeInstanceOf(type.errors);
63
- });
64
-
65
- test('should accept operation activity with delete', () => {
66
- const activity = {
67
- id: generateActivityId(),
68
- type: 'operation' as const,
69
- operation: 'delete' as const,
70
- message: 'Resource deleted permanently',
71
- target: 'resource:789',
72
- performedBy: {
73
- type: 'system' as const,
74
- identifier: 'cleanup-service',
75
- },
76
- source: 'garbage-collector',
77
- isMutateable: false,
78
- createdAt: new Date(),
79
- updatedAt: new Date(),
80
- metadata: { cascade: true, reason: 'retention_policy' },
81
- };
82
-
83
- const result = OperationActivitySchema(activity);
84
- expect(result).not.toBeInstanceOf(type.errors);
85
- });
86
-
87
- test('should accept operation activity with automation', () => {
88
- const activity = {
89
- id: generateActivityId(),
90
- type: 'operation' as const,
91
- operation: 'automation' as const,
92
- message: 'Automated backup completed',
93
- target: 'database:primary',
94
- performedBy: {
95
- type: 'automation' as const,
96
- identifier: 'backup-cron',
97
- },
98
- source: 'scheduler',
99
- isMutateable: false,
100
- createdAt: new Date(),
101
- updatedAt: new Date(),
102
- metadata: { backup_size: '2.5GB', duration: '45min' },
103
- };
104
-
105
- const result = OperationActivitySchema(activity);
106
- expect(result).not.toBeInstanceOf(type.errors);
107
- });
108
-
109
- test('should accept operation activity with optional fields', () => {
110
- const activity = {
111
- id: generateActivityId(),
112
- type: 'operation' as const,
113
- operation: 'create' as const,
114
- message: 'New workspace created',
115
- target: 'workspace:new-team',
116
- performedBy: {
117
- type: 'integration' as const,
118
- identifier: 'provisioning-api',
119
- },
120
- source: 'external-system',
121
- isMutateable: true,
122
- createdAt: new Date(),
123
- updatedAt: new Date(),
124
- deletedAt: new Date(),
125
- deactivatedAt: new Date(),
126
- metadata: { template: 'standard', auto_provision: true },
127
- };
128
-
129
- const result = OperationActivitySchema(activity);
130
- expect(result).not.toBeInstanceOf(type.errors);
131
- });
132
-
133
- test('should reject operation activity with wrong type', () => {
134
- const activity = {
135
- id: generateActivityId(),
136
- type: 'note',
137
- operation: 'create' as const,
138
- message: 'Wrong type',
139
- target: 'test:123',
140
- performedBy: {
141
- type: 'identity' as const,
142
- identifier: 'user@example.com',
143
- },
144
- source: 'api',
145
- isMutateable: true,
146
- createdAt: new Date(),
147
- updatedAt: new Date(),
148
- metadata: {},
149
- };
150
-
151
- const result = OperationActivitySchema(activity);
152
- expect(result).toBeInstanceOf(type.errors);
153
- });
154
-
155
- test('should reject operation activity with invalid operation', () => {
156
- const activity = {
157
- id: generateActivityId(),
158
- type: 'operation' as const,
159
- operation: 'invalid_operation',
160
- message: 'Test message',
161
- target: 'test:123',
162
- performedBy: {
163
- type: 'identity' as const,
164
- identifier: 'user@example.com',
165
- },
166
- source: 'api',
167
- isMutateable: true,
168
- createdAt: new Date(),
169
- updatedAt: new Date(),
170
- metadata: {},
171
- };
172
-
173
- const result = OperationActivitySchema(activity);
174
- expect(result).toBeInstanceOf(type.errors);
175
- });
176
-
177
- test('should reject operation activity missing required fields', () => {
178
- const activity = {
179
- id: generateActivityId(),
180
- type: 'operation' as const,
181
- operation: 'create' as const,
182
- // missing message, target
183
- performedBy: {
184
- type: 'identity' as const,
185
- identifier: 'user@example.com',
186
- },
187
- source: 'api',
188
- isMutateable: true,
189
- createdAt: new Date(),
190
- updatedAt: new Date(),
191
- metadata: {},
192
- };
193
-
194
- const result = OperationActivitySchema(activity);
195
- expect(result).toBeInstanceOf(type.errors);
196
- });
197
- });
198
-
199
- describe('OperationActivityPayloadSchema', () => {
200
- test('should accept complete operation payload with create', () => {
201
- const payload = {
202
- id: generateActivityId(),
203
- type: 'operation' as const,
204
- operation: 'create' as const,
205
- message: 'New entity created',
206
- target: 'entity:123',
207
- performedBy: {
208
- type: 'identity' as const,
209
- identifier: 'creator@example.com',
210
- },
211
- source: 'web-interface',
212
- isMutateable: true,
213
- createdAt: new Date().toISOString(),
214
- updatedAt: new Date().toISOString(),
215
- metadata: { entity_type: 'project', owner: 'team-alpha' },
216
- };
217
-
218
- const result = OperationActivityPayloadSchema(payload);
219
- expect(result).not.toBeInstanceOf(type.errors);
220
- expect(result).toEqual(payload);
221
- });
222
-
223
- test('should accept operation payload with update', () => {
224
- const payload = {
225
- id: generateActivityId(),
226
- type: 'operation' as const,
227
- operation: 'update' as const,
228
- message: 'Configuration updated',
229
- target: 'config:app-settings',
230
- performedBy: {
231
- type: 'automation' as const,
232
- identifier: 'config-sync',
233
- },
234
- source: 'config-service',
235
- isMutateable: true,
236
- createdAt: new Date().toISOString(),
237
- updatedAt: new Date().toISOString(),
238
- metadata: { version: '2.1.0', changes: 3 },
239
- };
240
-
241
- const result = OperationActivityPayloadSchema(payload);
242
- expect(result).not.toBeInstanceOf(type.errors);
243
- });
244
-
245
- test('should accept operation payload with delete', () => {
246
- const payload = {
247
- id: generateActivityId(),
248
- type: 'operation' as const,
249
- operation: 'delete' as const,
250
- message: 'Expired token removed',
251
- target: 'token:abc123',
252
- performedBy: {
253
- type: 'system' as const,
254
- identifier: 'token-cleanup',
255
- },
256
- source: 'maintenance-job',
257
- isMutateable: false,
258
- createdAt: new Date().toISOString(),
259
- updatedAt: new Date().toISOString(),
260
- metadata: { expired_at: '2024-01-01T00:00:00Z' },
261
- };
262
-
263
- const result = OperationActivityPayloadSchema(payload);
264
- expect(result).not.toBeInstanceOf(type.errors);
265
- });
266
-
267
- test('should accept operation payload with automation', () => {
268
- const payload = {
269
- id: generateActivityId(),
270
- type: 'operation' as const,
271
- operation: 'automation' as const,
272
- message: 'Data synchronization completed',
273
- target: 'sync:daily-reports',
274
- performedBy: {
275
- type: 'automation' as const,
276
- identifier: 'data-sync-service',
277
- },
278
- source: 'scheduled-task',
279
- isMutateable: false,
280
- createdAt: new Date().toISOString(),
281
- updatedAt: new Date().toISOString(),
282
- metadata: { records_synced: 1500, status: 'success' },
283
- };
284
-
285
- const result = OperationActivityPayloadSchema(payload);
286
- expect(result).not.toBeInstanceOf(type.errors);
287
- });
288
-
289
- test('should accept payload with optional date fields', () => {
290
- const payload = {
291
- id: generateActivityId(),
292
- type: 'operation' as const,
293
- operation: 'create' as const,
294
- message: 'Temporary resource created',
295
- target: 'temp:resource-456',
296
- performedBy: {
297
- type: 'guest' as const,
298
- identifier: 'anonymous-session',
299
- },
300
- source: 'demo-environment',
301
- isMutateable: true,
302
- createdAt: new Date().toISOString(),
303
- updatedAt: new Date().toISOString(),
304
- deletedAt: new Date().toISOString(),
305
- deactivatedAt: new Date().toISOString(),
306
- metadata: { temporary: true, ttl: 3600 },
307
- };
308
-
309
- const result = OperationActivityPayloadSchema(payload);
310
- expect(result).not.toBeInstanceOf(type.errors);
311
- });
312
-
313
- test('should reject payload with invalid date format', () => {
314
- const payload = {
315
- id: generateActivityId(),
316
- type: 'operation' as const,
317
- operation: 'create' as const,
318
- message: 'Test operation',
319
- target: 'test:123',
320
- performedBy: {
321
- type: 'identity' as const,
322
- identifier: 'user@example.com',
323
- },
324
- source: 'api',
325
- isMutateable: true,
326
- createdAt: 'invalid-date-format',
327
- updatedAt: new Date().toISOString(),
328
- metadata: {},
329
- };
330
-
331
- const result = OperationActivityPayloadSchema(payload);
332
- expect(result).toBeInstanceOf(type.errors);
333
- });
334
-
335
- test('should reject payload with wrong type', () => {
336
- const payload = {
337
- id: generateActivityId(),
338
- type: 'authorization',
339
- operation: 'create' as const,
340
- message: 'Wrong type',
341
- target: 'test:123',
342
- performedBy: {
343
- type: 'identity' as const,
344
- identifier: 'user@example.com',
345
- },
346
- source: 'api',
347
- isMutateable: true,
348
- createdAt: new Date().toISOString(),
349
- updatedAt: new Date().toISOString(),
350
- metadata: {},
351
- };
352
-
353
- const result = OperationActivityPayloadSchema(payload);
354
- expect(result).toBeInstanceOf(type.errors);
355
- });
356
-
357
- test('should reject payload with invalid operation', () => {
358
- const payload = {
359
- id: generateActivityId(),
360
- type: 'operation' as const,
361
- operation: 'invalid_op',
362
- message: 'Invalid operation',
363
- target: 'test:123',
364
- performedBy: {
365
- type: 'identity' as const,
366
- identifier: 'user@example.com',
367
- },
368
- source: 'api',
369
- isMutateable: true,
370
- createdAt: new Date().toISOString(),
371
- updatedAt: new Date().toISOString(),
372
- metadata: {},
373
- };
374
-
375
- const result = OperationActivityPayloadSchema(payload);
376
- expect(result).toBeInstanceOf(type.errors);
377
- });
378
- });
379
- });
@@ -1,304 +0,0 @@
1
- import { type } from 'arktype';
2
- import { describe, expect, test } from 'vitest';
3
- import { generateActivityId } from '../utils.js';
4
- import {
5
- UnknownActivityPayloadSchema,
6
- UnknownActivitySchema,
7
- } from './unknown.js';
8
-
9
- describe('Activity Schema - Unknown', () => {
10
- describe('UnknownActivitySchema', () => {
11
- test('should accept complete unknown activity', () => {
12
- const activity = {
13
- id: generateActivityId(),
14
- type: 'unknown' as const,
15
- message: 'Unrecognized activity detected',
16
- performedBy: {
17
- type: 'guest' as const,
18
- identifier: 'anonymous-user',
19
- },
20
- source: 'external-webhook',
21
- isMutateable: true,
22
- createdAt: new Date(),
23
- updatedAt: new Date(),
24
- metadata: { webhook_source: 'third-party', event_type: 'custom' },
25
- };
26
-
27
- const result = UnknownActivitySchema(activity);
28
- expect(result).not.toBeInstanceOf(type.errors);
29
- });
30
-
31
- test('should accept unknown activity with system performer', () => {
32
- const activity = {
33
- id: generateActivityId(),
34
- type: 'unknown' as const,
35
- message: 'System detected unexpected behavior',
36
- performedBy: {
37
- type: 'system' as const,
38
- identifier: 'anomaly-detector',
39
- },
40
- source: 'monitoring-service',
41
- isMutateable: false,
42
- createdAt: new Date(),
43
- updatedAt: new Date(),
44
- metadata: { severity: 'low', category: 'anomaly' },
45
- };
46
-
47
- const result = UnknownActivitySchema(activity);
48
- expect(result).not.toBeInstanceOf(type.errors);
49
- });
50
-
51
- test('should accept unknown activity with integration performer', () => {
52
- const activity = {
53
- id: generateActivityId(),
54
- type: 'unknown' as const,
55
- message: 'Received unknown event from integration',
56
- performedBy: {
57
- type: 'integration' as const,
58
- identifier: 'webhook-handler',
59
- },
60
- source: 'api-gateway',
61
- isMutateable: true,
62
- createdAt: new Date(),
63
- updatedAt: new Date(),
64
- metadata: {
65
- integration: 'external-crm',
66
- event: 'unknown_event_type',
67
- raw_data: '{"type":"unknown","data":{}}',
68
- },
69
- };
70
-
71
- const result = UnknownActivitySchema(activity);
72
- expect(result).not.toBeInstanceOf(type.errors);
73
- });
74
-
75
- test('should accept unknown activity with optional fields', () => {
76
- const activity = {
77
- id: generateActivityId(),
78
- type: 'unknown' as const,
79
- message: 'Legacy system activity logged',
80
- performedBy: {
81
- type: 'automation' as const,
82
- identifier: 'legacy-bridge',
83
- },
84
- source: 'legacy-system',
85
- isMutateable: true,
86
- createdAt: new Date(),
87
- updatedAt: new Date(),
88
- deletedAt: new Date(),
89
- deactivatedAt: new Date(),
90
- metadata: {
91
- legacy_id: 'old_system_123',
92
- migrated: false,
93
- },
94
- };
95
-
96
- const result = UnknownActivitySchema(activity);
97
- expect(result).not.toBeInstanceOf(type.errors);
98
- });
99
-
100
- test('should reject unknown activity with wrong type', () => {
101
- const activity = {
102
- id: generateActivityId(),
103
- type: 'note',
104
- message: 'Wrong type activity',
105
- performedBy: {
106
- type: 'guest' as const,
107
- identifier: 'anonymous',
108
- },
109
- source: 'test',
110
- isMutateable: true,
111
- createdAt: new Date(),
112
- updatedAt: new Date(),
113
- metadata: {},
114
- };
115
-
116
- const result = UnknownActivitySchema(activity);
117
- expect(result).toBeInstanceOf(type.errors);
118
- });
119
-
120
- test('should reject unknown activity missing message', () => {
121
- const activity = {
122
- id: generateActivityId(),
123
- type: 'unknown' as const,
124
- // missing message
125
- performedBy: {
126
- type: 'guest' as const,
127
- identifier: 'anonymous',
128
- },
129
- source: 'test',
130
- isMutateable: true,
131
- createdAt: new Date(),
132
- updatedAt: new Date(),
133
- metadata: {},
134
- };
135
-
136
- const result = UnknownActivitySchema(activity);
137
- expect(result).toBeInstanceOf(type.errors);
138
- });
139
-
140
- test('should reject unknown activity with non-string message', () => {
141
- const activity = {
142
- id: generateActivityId(),
143
- type: 'unknown' as const,
144
- message: 123,
145
- performedBy: {
146
- type: 'guest' as const,
147
- identifier: 'anonymous',
148
- },
149
- source: 'test',
150
- isMutateable: true,
151
- createdAt: new Date(),
152
- updatedAt: new Date(),
153
- metadata: {},
154
- };
155
-
156
- const result = UnknownActivitySchema(activity);
157
- expect(result).toBeInstanceOf(type.errors);
158
- });
159
-
160
- test('should reject unknown activity missing required base fields', () => {
161
- const activity = {
162
- id: generateActivityId(),
163
- type: 'unknown' as const,
164
- message: 'Test message',
165
- // missing performedBy, source, isMutateable, dates, metadata
166
- };
167
-
168
- const result = UnknownActivitySchema(activity);
169
- expect(result).toBeInstanceOf(type.errors);
170
- });
171
- });
172
-
173
- describe('UnknownActivityPayloadSchema', () => {
174
- test('should accept complete unknown activity payload', () => {
175
- const payload = {
176
- id: generateActivityId(),
177
- type: 'unknown' as const,
178
- message: 'Unknown event from external source',
179
- performedBy: {
180
- type: 'integration' as const,
181
- identifier: 'webhook-processor',
182
- },
183
- source: 'external-api',
184
- isMutateable: true,
185
- createdAt: new Date().toISOString(),
186
- updatedAt: new Date().toISOString(),
187
- metadata: {
188
- source_system: 'partner-api',
189
- event_id: 'evt_123456',
190
- processed: false,
191
- },
192
- };
193
-
194
- const result = UnknownActivityPayloadSchema(payload);
195
- expect(result).not.toBeInstanceOf(type.errors);
196
- expect(result).toEqual(payload);
197
- });
198
-
199
- test('should accept minimal unknown activity payload', () => {
200
- const payload = {
201
- id: generateActivityId(),
202
- type: 'unknown' as const,
203
- message: 'Simple unknown event',
204
- performedBy: {
205
- type: 'guest' as const,
206
- identifier: 'anonymous',
207
- },
208
- source: 'unknown-source',
209
- isMutateable: false,
210
- createdAt: new Date().toISOString(),
211
- updatedAt: new Date().toISOString(),
212
- metadata: {},
213
- };
214
-
215
- const result = UnknownActivityPayloadSchema(payload);
216
- expect(result).not.toBeInstanceOf(type.errors);
217
- });
218
-
219
- test('should accept payload with optional date fields', () => {
220
- const payload = {
221
- id: generateActivityId(),
222
- type: 'unknown' as const,
223
- message: 'Archived unknown activity',
224
- performedBy: {
225
- type: 'system' as const,
226
- identifier: 'archival-service',
227
- },
228
- source: 'data-cleanup',
229
- isMutateable: false,
230
- createdAt: new Date().toISOString(),
231
- updatedAt: new Date().toISOString(),
232
- deletedAt: new Date().toISOString(),
233
- deactivatedAt: new Date().toISOString(),
234
- metadata: {
235
- archived: true,
236
- retention_policy: 'long_term',
237
- },
238
- };
239
-
240
- const result = UnknownActivityPayloadSchema(payload);
241
- expect(result).not.toBeInstanceOf(type.errors);
242
- });
243
-
244
- test('should reject payload with invalid date format', () => {
245
- const payload = {
246
- id: generateActivityId(),
247
- type: 'unknown' as const,
248
- message: 'Test unknown activity',
249
- performedBy: {
250
- type: 'guest' as const,
251
- identifier: 'anonymous',
252
- },
253
- source: 'test',
254
- isMutateable: true,
255
- createdAt: 'invalid-date-format',
256
- updatedAt: new Date().toISOString(),
257
- metadata: {},
258
- };
259
-
260
- const result = UnknownActivityPayloadSchema(payload);
261
- expect(result).toBeInstanceOf(type.errors);
262
- });
263
-
264
- test('should reject payload with wrong type', () => {
265
- const payload = {
266
- id: generateActivityId(),
267
- type: 'operation',
268
- message: 'Wrong type payload',
269
- performedBy: {
270
- type: 'guest' as const,
271
- identifier: 'anonymous',
272
- },
273
- source: 'test',
274
- isMutateable: true,
275
- createdAt: new Date().toISOString(),
276
- updatedAt: new Date().toISOString(),
277
- metadata: {},
278
- };
279
-
280
- const result = UnknownActivityPayloadSchema(payload);
281
- expect(result).toBeInstanceOf(type.errors);
282
- });
283
-
284
- test('should reject payload missing message', () => {
285
- const payload = {
286
- id: generateActivityId(),
287
- type: 'unknown' as const,
288
- // missing message
289
- performedBy: {
290
- type: 'guest' as const,
291
- identifier: 'anonymous',
292
- },
293
- source: 'test',
294
- isMutateable: true,
295
- createdAt: new Date().toISOString(),
296
- updatedAt: new Date().toISOString(),
297
- metadata: {},
298
- };
299
-
300
- const result = UnknownActivityPayloadSchema(payload);
301
- expect(result).toBeInstanceOf(type.errors);
302
- });
303
- });
304
- });