@go-mondo/identity-sdk 0.0.2-beta.77 → 0.0.2-beta.78

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.2-beta.78](https://github.com/go-mondo/identity-node-sdk/compare/identity-sdk-v0.0.2-beta.77...identity-sdk-v0.0.2-beta.78) (2026-05-07)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * reverting incorrect user schema changes ([4c25013](https://github.com/go-mondo/identity-node-sdk/commit/4c25013fb3b62bbb7fcc70466c92d957877f07dc))
9
+
3
10
  ## [0.0.2-beta.77](https://github.com/go-mondo/identity-node-sdk/compare/identity-sdk-v0.0.2-beta.76...identity-sdk-v0.0.2-beta.77) (2026-05-06)
4
11
 
5
12
 
@@ -203,10 +203,10 @@ export type UserPayload = z.output<typeof UserPayloadSchema>;
203
203
  export declare const InsertUserPayloadSchema: z.ZodObject<{
204
204
  metadata: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodUndefined, z.ZodNull, z.ZodCustom<Map<string, string | number | boolean>, Map<string, string | number | boolean>>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>, z.ZodTransform<Record<string, string | number | boolean> | null | undefined, Record<string, string | number | boolean> | Map<string, string | number | boolean> | null | undefined>>>;
205
205
  roles: z.ZodOptional<z.ZodUnion<readonly [z.ZodUndefined, z.ZodArray<z.ZodString>]>>;
206
+ verifiedEmail: z.ZodOptional<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>>;
207
+ verifiedPhoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodE164, z.ZodNull, z.ZodUndefined]>>;
206
208
  unverifiedEmail: z.ZodOptional<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>>;
207
209
  unverifiedPhoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodE164, z.ZodNull, z.ZodUndefined]>>;
208
- verifiedEmail: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<boolean | undefined, boolean | null | undefined>>>;
209
- verifiedPhoneNumber: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<boolean | undefined, boolean | null | undefined>>>;
210
210
  givenName: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
211
211
  middleName: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
212
212
  familyName: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
@@ -223,10 +223,10 @@ export type InsertUserInput = z.input<typeof InsertUserPayloadSchema>;
223
223
  export type InsertUserPayload = z.output<typeof InsertUserPayloadSchema>;
224
224
  export declare const UpdateUserPayloadSchema: z.ZodObject<{
225
225
  metadata: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodUndefined, z.ZodNull, z.ZodCustom<Map<string, string | number | boolean>, Map<string, string | number | boolean>>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>, z.ZodTransform<Record<string, string | number | boolean> | null | undefined, Record<string, string | number | boolean> | Map<string, string | number | boolean> | null | undefined>>>;
226
+ verifiedEmail: z.ZodOptional<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>>;
227
+ verifiedPhoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodE164, z.ZodNull, z.ZodUndefined]>>;
226
228
  unverifiedEmail: z.ZodOptional<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>>;
227
229
  unverifiedPhoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodE164, z.ZodNull, z.ZodUndefined]>>;
228
- verifiedEmail: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
229
- verifiedPhoneNumber: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodE164, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
230
230
  givenName: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull, z.ZodUndefined]>>;
231
231
  middleName: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull, z.ZodUndefined]>>;
232
232
  familyName: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull, z.ZodUndefined]>>;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/customer/users/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AA2B5B,eAAO,MAAM,mBAAmB;;;CAGtB,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjE,eAAO,MAAM,UAAU;;;;CAIb,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEzE,eAAO,MAAM,gBAAgB;;;;EAAoC,CAAC;AAElE,eAAO,MAAM,wBAAwB;;;;;;iBAMnC,CAAC;AAGH,eAAO,MAAM,8BAA8B;;;;;;iBAMzC,CAAC;AAGH,eAAO,MAAM,oBAAoB;;iBAE/B,CAAC;AACH,MAAM,MAAM,cAAc,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(0, schema_js_2.optionallyNullishToUndefined)(exports.RequiredPhoneNumberSchema),
82
82
  });
83
- const UpsertUnverifiedEmailOrPhonePropertiesSchema = z.object({
83
+ const UpsertEmailOrPhonePropertiesSchema = z.object({
84
+ verifiedEmail: (0, schema_js_2.optionallyNullish)(exports.RequiredEmailSchema),
85
+ verifiedPhoneNumber: (0, schema_js_2.optionallyNullish)(exports.RequiredPhoneNumberSchema),
84
86
  unverifiedEmail: (0, schema_js_2.optionallyNullish)(exports.RequiredEmailSchema),
85
87
  unverifiedPhoneNumber: (0, schema_js_2.optionallyNullish)(exports.RequiredPhoneNumberSchema),
86
88
  });
@@ -128,8 +130,8 @@ exports.UserPayloadSchema = UserPayloadSchemaBase.transform((user) => ({
128
130
  phoneNumber: user.verifiedPhoneNumber,
129
131
  }));
130
132
  const requiredEmailOrPhoneMessage = 'At least one of verifiedEmail, verifiedPhoneNumber, unverifiedEmail, or unverifiedPhoneNumber is required';
131
- const hasEmailOrPhone = (data) => data.verifiedEmail !== undefined ||
132
- data.verifiedPhoneNumber !== undefined ||
133
+ const hasEmailOrPhone = (data) => data.verifiedEmail != null ||
134
+ data.verifiedPhoneNumber != null ||
133
135
  data.unverifiedEmail != null ||
134
136
  data.unverifiedPhoneNumber != null;
135
137
  exports.InsertUserPayloadSchema = z
@@ -137,9 +139,7 @@ exports.InsertUserPayloadSchema = z
137
139
  id: schema_js_3.UserIdSchema.optional(),
138
140
  status: exports.UserStatusSchema.optional(),
139
141
  ...exports.UserNamePropertiesSchema.shape,
140
- verifiedEmail: (0, schema_js_2.optionallyNullishToUndefined)(z.boolean()),
141
- verifiedPhoneNumber: (0, schema_js_2.optionallyNullishToUndefined)(z.boolean()),
142
- ...UpsertUnverifiedEmailOrPhonePropertiesSchema.shape,
142
+ ...UpsertEmailOrPhonePropertiesSchema.shape,
143
143
  ...exports.UserAssociationsSchema.shape,
144
144
  ...metadata_js_1.UpsertMetadataPropertyPayloadSchema.shape,
145
145
  })
@@ -163,7 +163,7 @@ exports.UpdateUserPayloadSchema = z.object({
163
163
  suspended: z.boolean().optional(),
164
164
  ...exports.UpdateUserNamePropertiesSchema.shape,
165
165
  ...exports.VerifiedEmailOrPhonePropertiesSchema.shape,
166
- ...UpsertUnverifiedEmailOrPhonePropertiesSchema.shape,
166
+ ...UpsertEmailOrPhonePropertiesSchema.shape,
167
167
  ...metadata_js_1.UpsertMetadataPropertyPayloadSchema.shape,
168
168
  });
169
169
  /**
@@ -410,7 +410,7 @@ const schema_js_2 = require("./schema.js");
410
410
  foo: 'bar',
411
411
  id: (0, schema_js_1.generateUserId)(),
412
412
  familyName: 'Foo',
413
- verifiedPhoneNumber: true,
413
+ verifiedPhoneNumber: '+12025551234',
414
414
  };
415
415
  const result = schema_js_2.InsertUserPayloadSchema.safeParse(item);
416
416
  (0, vitest_1.expect)(result.success).toBe(true);
@@ -422,17 +422,17 @@ const schema_js_2 = require("./schema.js");
422
422
  (0, vitest_1.test)('should parse with all verified and unverified email/phone properties', async () => {
423
423
  const item = {
424
424
  id: (0, schema_js_1.generateUserId)(),
425
- verifiedEmail: true,
425
+ verifiedEmail: 'verified@example.com',
426
426
  unverifiedEmail: 'pending@example.com',
427
- verifiedPhoneNumber: true,
427
+ verifiedPhoneNumber: '+1234567890',
428
428
  unverifiedPhoneNumber: '+0987654321',
429
429
  };
430
430
  const result = schema_js_2.InsertUserPayloadSchema.safeParse(item);
431
431
  (0, vitest_1.expect)(result.success).toBe(true);
432
432
  if (result.success) {
433
- (0, vitest_1.expect)(result.data.verifiedEmail).toBe(true);
433
+ (0, vitest_1.expect)(result.data.verifiedEmail).toBe('verified@example.com');
434
434
  (0, vitest_1.expect)(result.data.unverifiedEmail).toBe('pending@example.com');
435
- (0, vitest_1.expect)(result.data.verifiedPhoneNumber).toBe(true);
435
+ (0, vitest_1.expect)(result.data.verifiedPhoneNumber).toBe('+1234567890');
436
436
  (0, vitest_1.expect)(result.data.unverifiedPhoneNumber).toBe('+0987654321');
437
437
  }
438
438
  });
@@ -440,7 +440,7 @@ const schema_js_2 = require("./schema.js");
440
440
  const item = {
441
441
  foo: 'bar',
442
442
  id: (0, schema_js_1.generateUserId)(),
443
- verifiedPhoneNumber: true,
443
+ verifiedPhoneNumber: '+12025551234',
444
444
  metadata: new Map(),
445
445
  };
446
446
  const result = schema_js_2.InsertUserPayloadSchema.safeParse(item);
@@ -451,7 +451,7 @@ const schema_js_2 = require("./schema.js");
451
451
  });
452
452
  (0, vitest_1.test)('should allow optional id and status', async () => {
453
453
  const item = {
454
- verifiedEmail: true,
454
+ verifiedEmail: 'test@example.com',
455
455
  };
456
456
  const result = schema_js_2.InsertUserPayloadSchema.safeParse(item);
457
457
  (0, vitest_1.expect)(result.success).toBe(true);
@@ -463,7 +463,7 @@ const schema_js_2 = require("./schema.js");
463
463
  (0, vitest_1.test)('should parse with roles association', async () => {
464
464
  const item = {
465
465
  id: (0, schema_js_1.generateUserId)(),
466
- verifiedEmail: true,
466
+ verifiedEmail: 'test@example.com',
467
467
  roles: [
468
468
  'rol_2NfYOTzVqhCHgWFzUL0WPfRRuhH',
469
469
  'rol_2NfYOTzVqhCHgWFzUL0WPfRRuhI',
@@ -495,28 +495,27 @@ const schema_js_2 = require("./schema.js");
495
495
  });
496
496
  (0, vitest_1.test)('should accept with only verifiedEmail', async () => {
497
497
  const item = {
498
- verifiedEmail: true,
498
+ verifiedEmail: 'test@example.com',
499
499
  };
500
500
  const result = schema_js_2.InsertUserPayloadSchema.safeParse(item);
501
501
  (0, vitest_1.expect)(result.success).toBe(true);
502
502
  if (result.success) {
503
- (0, vitest_1.expect)(result.data.verifiedEmail).toBe(true);
503
+ (0, vitest_1.expect)(result.data.verifiedEmail).toBe('test@example.com');
504
504
  }
505
505
  });
506
506
  (0, vitest_1.test)('should accept with only verifiedPhoneNumber', async () => {
507
507
  const item = {
508
- verifiedPhoneNumber: true,
508
+ verifiedPhoneNumber: '+12025551234',
509
509
  };
510
510
  const result = schema_js_2.InsertUserPayloadSchema.safeParse(item);
511
511
  (0, vitest_1.expect)(result.success).toBe(true);
512
512
  if (result.success) {
513
- (0, vitest_1.expect)(result.data.verifiedPhoneNumber).toBe(true);
513
+ (0, vitest_1.expect)(result.data.verifiedPhoneNumber).toBe('+12025551234');
514
514
  }
515
515
  });
516
516
  (0, vitest_1.test)('should succeed with only unverifiedEmail', async () => {
517
517
  const item = {
518
518
  unverifiedEmail: 'test@example.com',
519
- verifiedEmail: true,
520
519
  unverifiedPhoneNumber: null,
521
520
  };
522
521
  const result = schema_js_2.InsertUserPayloadSchema.safeParse(item);
@@ -524,7 +523,7 @@ const schema_js_2 = require("./schema.js");
524
523
  if (result.success) {
525
524
  (0, vitest_1.expect)(result.data.unverifiedEmail).toBe('test@example.com');
526
525
  (0, vitest_1.expect)(result.data.unverifiedPhoneNumber).toBeNull();
527
- (0, vitest_1.expect)(result.data.verifiedEmail).toBe(true);
526
+ (0, vitest_1.expect)(result.data.verifiedEmail).toBeUndefined();
528
527
  (0, vitest_1.expect)(result.data.verifiedPhoneNumber).toBeUndefined();
529
528
  }
530
529
  });
@@ -532,7 +531,6 @@ const schema_js_2 = require("./schema.js");
532
531
  const item = {
533
532
  unverifiedEmail: null,
534
533
  unverifiedPhoneNumber: '+12025551234',
535
- verifiedPhoneNumber: true,
536
534
  };
537
535
  const result = schema_js_2.InsertUserPayloadSchema.safeParse(item);
538
536
  (0, vitest_1.expect)(result.success).toBe(true);
@@ -540,7 +538,7 @@ const schema_js_2 = require("./schema.js");
540
538
  (0, vitest_1.expect)(result.data.unverifiedPhoneNumber).toBe('+12025551234');
541
539
  (0, vitest_1.expect)(result.data.unverifiedEmail).toBeNull();
542
540
  (0, vitest_1.expect)(result.data.verifiedEmail).toBeUndefined();
543
- (0, vitest_1.expect)(result.data.verifiedPhoneNumber).toBe(true);
541
+ (0, vitest_1.expect)(result.data.verifiedPhoneNumber).toBeUndefined();
544
542
  }
545
543
  });
546
544
  });
@@ -203,10 +203,10 @@ export type UserPayload = z.output<typeof UserPayloadSchema>;
203
203
  export declare const InsertUserPayloadSchema: z.ZodObject<{
204
204
  metadata: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodUndefined, z.ZodNull, z.ZodCustom<Map<string, string | number | boolean>, Map<string, string | number | boolean>>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>, z.ZodTransform<Record<string, string | number | boolean> | null | undefined, Record<string, string | number | boolean> | Map<string, string | number | boolean> | null | undefined>>>;
205
205
  roles: z.ZodOptional<z.ZodUnion<readonly [z.ZodUndefined, z.ZodArray<z.ZodString>]>>;
206
+ verifiedEmail: z.ZodOptional<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>>;
207
+ verifiedPhoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodE164, z.ZodNull, z.ZodUndefined]>>;
206
208
  unverifiedEmail: z.ZodOptional<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>>;
207
209
  unverifiedPhoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodE164, z.ZodNull, z.ZodUndefined]>>;
208
- verifiedEmail: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<boolean | undefined, boolean | null | undefined>>>;
209
- verifiedPhoneNumber: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<boolean | undefined, boolean | null | undefined>>>;
210
210
  givenName: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
211
211
  middleName: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
212
212
  familyName: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
@@ -223,10 +223,10 @@ export type InsertUserInput = z.input<typeof InsertUserPayloadSchema>;
223
223
  export type InsertUserPayload = z.output<typeof InsertUserPayloadSchema>;
224
224
  export declare const UpdateUserPayloadSchema: z.ZodObject<{
225
225
  metadata: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodUndefined, z.ZodNull, z.ZodCustom<Map<string, string | number | boolean>, Map<string, string | number | boolean>>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>, z.ZodTransform<Record<string, string | number | boolean> | null | undefined, Record<string, string | number | boolean> | Map<string, string | number | boolean> | null | undefined>>>;
226
+ verifiedEmail: z.ZodOptional<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>>;
227
+ verifiedPhoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodE164, z.ZodNull, z.ZodUndefined]>>;
226
228
  unverifiedEmail: z.ZodOptional<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>>;
227
229
  unverifiedPhoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodE164, z.ZodNull, z.ZodUndefined]>>;
228
- verifiedEmail: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
229
- verifiedPhoneNumber: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodE164, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
230
230
  givenName: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull, z.ZodUndefined]>>;
231
231
  middleName: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull, z.ZodUndefined]>>;
232
232
  familyName: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.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CAAC,OAAO,uBAAuB,CAAC,CAAC;AACtE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAEzE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;iBAMlC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACtE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAEzE;;GAEG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;iBAMzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAC7C,OAAO,8BAA8B,CACtC,CAAC"}
@@ -44,7 +44,9 @@ export const UnverifiedEmailOrPhonePropertiesSchema = z.object({
44
44
  unverifiedEmail: optionallyNullishToUndefined(RequiredEmailSchema),
45
45
  unverifiedPhoneNumber: optionallyNullishToUndefined(RequiredPhoneNumberSchema),
46
46
  });
47
- const UpsertUnverifiedEmailOrPhonePropertiesSchema = z.object({
47
+ const UpsertEmailOrPhonePropertiesSchema = z.object({
48
+ verifiedEmail: optionallyNullish(RequiredEmailSchema),
49
+ verifiedPhoneNumber: optionallyNullish(RequiredPhoneNumberSchema),
48
50
  unverifiedEmail: optionallyNullish(RequiredEmailSchema),
49
51
  unverifiedPhoneNumber: optionallyNullish(RequiredPhoneNumberSchema),
50
52
  });
@@ -92,8 +94,8 @@ export const UserPayloadSchema = UserPayloadSchemaBase.transform((user) => ({
92
94
  phoneNumber: user.verifiedPhoneNumber,
93
95
  }));
94
96
  const requiredEmailOrPhoneMessage = 'At least one of verifiedEmail, verifiedPhoneNumber, unverifiedEmail, or unverifiedPhoneNumber is required';
95
- const hasEmailOrPhone = (data) => data.verifiedEmail !== undefined ||
96
- data.verifiedPhoneNumber !== undefined ||
97
+ const hasEmailOrPhone = (data) => data.verifiedEmail != null ||
98
+ data.verifiedPhoneNumber != null ||
97
99
  data.unverifiedEmail != null ||
98
100
  data.unverifiedPhoneNumber != null;
99
101
  export const InsertUserPayloadSchema = z
@@ -101,9 +103,7 @@ export const InsertUserPayloadSchema = z
101
103
  id: UserIdSchema.optional(),
102
104
  status: UserStatusSchema.optional(),
103
105
  ...UserNamePropertiesSchema.shape,
104
- verifiedEmail: optionallyNullishToUndefined(z.boolean()),
105
- verifiedPhoneNumber: optionallyNullishToUndefined(z.boolean()),
106
- ...UpsertUnverifiedEmailOrPhonePropertiesSchema.shape,
106
+ ...UpsertEmailOrPhonePropertiesSchema.shape,
107
107
  ...UserAssociationsSchema.shape,
108
108
  ...UpsertMetadataPropertyPayloadSchema.shape,
109
109
  })
@@ -127,7 +127,7 @@ export const UpdateUserPayloadSchema = z.object({
127
127
  suspended: z.boolean().optional(),
128
128
  ...UpdateUserNamePropertiesSchema.shape,
129
129
  ...VerifiedEmailOrPhonePropertiesSchema.shape,
130
- ...UpsertUnverifiedEmailOrPhonePropertiesSchema.shape,
130
+ ...UpsertEmailOrPhonePropertiesSchema.shape,
131
131
  ...UpsertMetadataPropertyPayloadSchema.shape,
132
132
  });
133
133
  /**
@@ -408,7 +408,7 @@ describe('Customer - User', () => {
408
408
  foo: 'bar',
409
409
  id: generateUserId(),
410
410
  familyName: 'Foo',
411
- verifiedPhoneNumber: true,
411
+ verifiedPhoneNumber: '+12025551234',
412
412
  };
413
413
  const result = InsertUserPayloadSchema.safeParse(item);
414
414
  expect(result.success).toBe(true);
@@ -420,17 +420,17 @@ describe('Customer - User', () => {
420
420
  test('should parse with all verified and unverified email/phone properties', async () => {
421
421
  const item = {
422
422
  id: generateUserId(),
423
- verifiedEmail: true,
423
+ verifiedEmail: 'verified@example.com',
424
424
  unverifiedEmail: 'pending@example.com',
425
- verifiedPhoneNumber: true,
425
+ verifiedPhoneNumber: '+1234567890',
426
426
  unverifiedPhoneNumber: '+0987654321',
427
427
  };
428
428
  const result = InsertUserPayloadSchema.safeParse(item);
429
429
  expect(result.success).toBe(true);
430
430
  if (result.success) {
431
- expect(result.data.verifiedEmail).toBe(true);
431
+ expect(result.data.verifiedEmail).toBe('verified@example.com');
432
432
  expect(result.data.unverifiedEmail).toBe('pending@example.com');
433
- expect(result.data.verifiedPhoneNumber).toBe(true);
433
+ expect(result.data.verifiedPhoneNumber).toBe('+1234567890');
434
434
  expect(result.data.unverifiedPhoneNumber).toBe('+0987654321');
435
435
  }
436
436
  });
@@ -438,7 +438,7 @@ describe('Customer - User', () => {
438
438
  const item = {
439
439
  foo: 'bar',
440
440
  id: generateUserId(),
441
- verifiedPhoneNumber: true,
441
+ verifiedPhoneNumber: '+12025551234',
442
442
  metadata: new Map(),
443
443
  };
444
444
  const result = InsertUserPayloadSchema.safeParse(item);
@@ -449,7 +449,7 @@ describe('Customer - User', () => {
449
449
  });
450
450
  test('should allow optional id and status', async () => {
451
451
  const item = {
452
- verifiedEmail: true,
452
+ verifiedEmail: 'test@example.com',
453
453
  };
454
454
  const result = InsertUserPayloadSchema.safeParse(item);
455
455
  expect(result.success).toBe(true);
@@ -461,7 +461,7 @@ describe('Customer - User', () => {
461
461
  test('should parse with roles association', async () => {
462
462
  const item = {
463
463
  id: generateUserId(),
464
- verifiedEmail: true,
464
+ verifiedEmail: 'test@example.com',
465
465
  roles: [
466
466
  'rol_2NfYOTzVqhCHgWFzUL0WPfRRuhH',
467
467
  'rol_2NfYOTzVqhCHgWFzUL0WPfRRuhI',
@@ -493,28 +493,27 @@ describe('Customer - User', () => {
493
493
  });
494
494
  test('should accept with only verifiedEmail', async () => {
495
495
  const item = {
496
- verifiedEmail: true,
496
+ verifiedEmail: 'test@example.com',
497
497
  };
498
498
  const result = InsertUserPayloadSchema.safeParse(item);
499
499
  expect(result.success).toBe(true);
500
500
  if (result.success) {
501
- expect(result.data.verifiedEmail).toBe(true);
501
+ expect(result.data.verifiedEmail).toBe('test@example.com');
502
502
  }
503
503
  });
504
504
  test('should accept with only verifiedPhoneNumber', async () => {
505
505
  const item = {
506
- verifiedPhoneNumber: true,
506
+ verifiedPhoneNumber: '+12025551234',
507
507
  };
508
508
  const result = InsertUserPayloadSchema.safeParse(item);
509
509
  expect(result.success).toBe(true);
510
510
  if (result.success) {
511
- expect(result.data.verifiedPhoneNumber).toBe(true);
511
+ expect(result.data.verifiedPhoneNumber).toBe('+12025551234');
512
512
  }
513
513
  });
514
514
  test('should succeed with only unverifiedEmail', async () => {
515
515
  const item = {
516
516
  unverifiedEmail: 'test@example.com',
517
- verifiedEmail: true,
518
517
  unverifiedPhoneNumber: null,
519
518
  };
520
519
  const result = InsertUserPayloadSchema.safeParse(item);
@@ -522,7 +521,7 @@ describe('Customer - User', () => {
522
521
  if (result.success) {
523
522
  expect(result.data.unverifiedEmail).toBe('test@example.com');
524
523
  expect(result.data.unverifiedPhoneNumber).toBeNull();
525
- expect(result.data.verifiedEmail).toBe(true);
524
+ expect(result.data.verifiedEmail).toBeUndefined();
526
525
  expect(result.data.verifiedPhoneNumber).toBeUndefined();
527
526
  }
528
527
  });
@@ -530,7 +529,6 @@ describe('Customer - User', () => {
530
529
  const item = {
531
530
  unverifiedEmail: null,
532
531
  unverifiedPhoneNumber: '+12025551234',
533
- verifiedPhoneNumber: true,
534
532
  };
535
533
  const result = InsertUserPayloadSchema.safeParse(item);
536
534
  expect(result.success).toBe(true);
@@ -538,7 +536,7 @@ describe('Customer - User', () => {
538
536
  expect(result.data.unverifiedPhoneNumber).toBe('+12025551234');
539
537
  expect(result.data.unverifiedEmail).toBeNull();
540
538
  expect(result.data.verifiedEmail).toBeUndefined();
541
- expect(result.data.verifiedPhoneNumber).toBe(true);
539
+ expect(result.data.verifiedPhoneNumber).toBeUndefined();
542
540
  }
543
541
  });
544
542
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-mondo/identity-sdk",
3
- "version": "0.0.2-beta.77",
3
+ "version": "0.0.2-beta.78",
4
4
  "type": "module",
5
5
  "description": "A node SDK for Mondo Identity",
6
6
  "license": "MIT",