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

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.74](https://github.com/go-mondo/identity-node-sdk/compare/identity-sdk-v0.0.2-beta.73...identity-sdk-v0.0.2-beta.74) (2026-05-06)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * accept null values ([7c493d3](https://github.com/go-mondo/identity-node-sdk/commit/7c493d37979c106b619d67d962b3fc007af15287))
9
+
3
10
  ## [0.0.2-beta.73](https://github.com/go-mondo/identity-node-sdk/compare/identity-sdk-v0.0.2-beta.72...identity-sdk-v0.0.2-beta.73) (2026-05-06)
4
11
 
5
12
 
@@ -203,8 +203,8 @@ 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
- unverifiedEmail: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
207
- unverifiedPhoneNumber: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodE164, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
206
+ unverifiedEmail: z.ZodOptional<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>>;
207
+ unverifiedPhoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodE164, z.ZodNull, z.ZodUndefined]>>;
208
208
  verifiedEmail: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<boolean | undefined, boolean | null | undefined>>>;
209
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>>>;
@@ -223,8 +223,8 @@ 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
- unverifiedEmail: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
227
- unverifiedPhoneNumber: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodE164, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
226
+ unverifiedEmail: z.ZodOptional<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>>;
227
+ unverifiedPhoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodE164, z.ZodNull, z.ZodUndefined]>>;
228
228
  verifiedEmail: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
229
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]>>;
@@ -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,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEnE,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAC7C,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAElD,eAAO,MAAM,oCAAoC;;;iBAG/C,CAAC;AAEH,eAAO,MAAM,sCAAsC;;;iBAKjD,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MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAY/C,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAI3B,CAAC;AACJ,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAgB7D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;iBA0BhC,CAAC;AACL,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,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"}
@@ -80,6 +80,10 @@ exports.UnverifiedEmailOrPhonePropertiesSchema = z.object({
80
80
  unverifiedEmail: (0, schema_js_2.optionallyNullishToUndefined)(exports.RequiredEmailSchema),
81
81
  unverifiedPhoneNumber: (0, schema_js_2.optionallyNullishToUndefined)(exports.RequiredPhoneNumberSchema),
82
82
  });
83
+ const UpsertUnverifiedEmailOrPhonePropertiesSchema = z.object({
84
+ unverifiedEmail: (0, schema_js_2.optionallyNullish)(exports.RequiredEmailSchema),
85
+ unverifiedPhoneNumber: (0, schema_js_2.optionallyNullish)(exports.RequiredPhoneNumberSchema),
86
+ });
83
87
  exports.EmailOrPhonePropertiesSchema = z.object({
84
88
  email: (0, schema_js_2.optionallyNullishToUndefined)(exports.RequiredEmailSchema),
85
89
  phoneNumber: (0, schema_js_2.optionallyNullishToUndefined)(exports.RequiredPhoneNumberSchema),
@@ -126,8 +130,8 @@ exports.UserPayloadSchema = UserPayloadSchemaBase.transform((user) => ({
126
130
  const requiredEmailOrPhoneMessage = 'At least one of verifiedEmail, verifiedPhoneNumber, unverifiedEmail, or unverifiedPhoneNumber is required';
127
131
  const hasEmailOrPhone = (data) => data.verifiedEmail !== undefined ||
128
132
  data.verifiedPhoneNumber !== undefined ||
129
- data.unverifiedEmail !== undefined ||
130
- data.unverifiedPhoneNumber !== undefined;
133
+ data.unverifiedEmail != null ||
134
+ data.unverifiedPhoneNumber != null;
131
135
  exports.InsertUserPayloadSchema = z
132
136
  .object({
133
137
  id: schema_js_3.UserIdSchema.optional(),
@@ -135,7 +139,7 @@ exports.InsertUserPayloadSchema = z
135
139
  ...exports.UserNamePropertiesSchema.shape,
136
140
  verifiedEmail: (0, schema_js_2.optionallyNullishToUndefined)(z.boolean()),
137
141
  verifiedPhoneNumber: (0, schema_js_2.optionallyNullishToUndefined)(z.boolean()),
138
- ...exports.UnverifiedEmailOrPhonePropertiesSchema.shape,
142
+ ...UpsertUnverifiedEmailOrPhonePropertiesSchema.shape,
139
143
  ...exports.UserAssociationsSchema.shape,
140
144
  ...metadata_js_1.UpsertMetadataPropertyPayloadSchema.shape,
141
145
  })
@@ -159,7 +163,7 @@ exports.UpdateUserPayloadSchema = z.object({
159
163
  suspended: z.boolean().optional(),
160
164
  ...exports.UpdateUserNamePropertiesSchema.shape,
161
165
  ...exports.VerifiedEmailOrPhonePropertiesSchema.shape,
162
- ...exports.UnverifiedEmailOrPhonePropertiesSchema.shape,
166
+ ...UpsertUnverifiedEmailOrPhonePropertiesSchema.shape,
163
167
  ...metadata_js_1.UpsertMetadataPropertyPayloadSchema.shape,
164
168
  });
165
169
  /**
@@ -517,20 +517,20 @@ const schema_js_2 = require("./schema.js");
517
517
  const item = {
518
518
  unverifiedEmail: 'test@example.com',
519
519
  verifiedEmail: true,
520
- unverifiedPhoneNumber: undefined,
520
+ unverifiedPhoneNumber: null,
521
521
  };
522
522
  const result = schema_js_2.InsertUserPayloadSchema.safeParse(item);
523
523
  (0, vitest_1.expect)(result.success).toBe(true);
524
524
  if (result.success) {
525
525
  (0, vitest_1.expect)(result.data.unverifiedEmail).toBe('test@example.com');
526
- (0, vitest_1.expect)(result.data.unverifiedPhoneNumber).toBeUndefined();
526
+ (0, vitest_1.expect)(result.data.unverifiedPhoneNumber).toBeNull();
527
527
  (0, vitest_1.expect)(result.data.verifiedEmail).toBe(true);
528
528
  (0, vitest_1.expect)(result.data.verifiedPhoneNumber).toBeUndefined();
529
529
  }
530
530
  });
531
531
  (0, vitest_1.test)('should succeed with only unverifiedPhoneNumber', async () => {
532
532
  const item = {
533
- unverifiedEmail: undefined,
533
+ unverifiedEmail: null,
534
534
  unverifiedPhoneNumber: '+12025551234',
535
535
  verifiedPhoneNumber: true,
536
536
  };
@@ -538,7 +538,7 @@ const schema_js_2 = require("./schema.js");
538
538
  (0, vitest_1.expect)(result.success).toBe(true);
539
539
  if (result.success) {
540
540
  (0, vitest_1.expect)(result.data.unverifiedPhoneNumber).toBe('+12025551234');
541
- (0, vitest_1.expect)(result.data.unverifiedEmail).toBeUndefined();
541
+ (0, vitest_1.expect)(result.data.unverifiedEmail).toBeNull();
542
542
  (0, vitest_1.expect)(result.data.verifiedEmail).toBeUndefined();
543
543
  (0, vitest_1.expect)(result.data.verifiedPhoneNumber).toBe(true);
544
544
  }
@@ -203,8 +203,8 @@ 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
- unverifiedEmail: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
207
- unverifiedPhoneNumber: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodE164, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
206
+ unverifiedEmail: z.ZodOptional<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>>;
207
+ unverifiedPhoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodE164, z.ZodNull, z.ZodUndefined]>>;
208
208
  verifiedEmail: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<boolean | undefined, boolean | null | undefined>>>;
209
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>>>;
@@ -223,8 +223,8 @@ 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
- unverifiedEmail: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
227
- unverifiedPhoneNumber: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodE164, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
226
+ unverifiedEmail: z.ZodOptional<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>>;
227
+ unverifiedPhoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodE164, z.ZodNull, z.ZodUndefined]>>;
228
228
  verifiedEmail: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodEmail, z.ZodNull, z.ZodUndefined]>, z.ZodTransform<string | undefined, string | null | undefined>>>;
229
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]>>;
@@ -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,MA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,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;iBAMzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAC7C,OAAO,8BAA8B,CACtC,CAAC"}
@@ -44,6 +44,10 @@ export const UnverifiedEmailOrPhonePropertiesSchema = z.object({
44
44
  unverifiedEmail: optionallyNullishToUndefined(RequiredEmailSchema),
45
45
  unverifiedPhoneNumber: optionallyNullishToUndefined(RequiredPhoneNumberSchema),
46
46
  });
47
+ const UpsertUnverifiedEmailOrPhonePropertiesSchema = z.object({
48
+ unverifiedEmail: optionallyNullish(RequiredEmailSchema),
49
+ unverifiedPhoneNumber: optionallyNullish(RequiredPhoneNumberSchema),
50
+ });
47
51
  export const EmailOrPhonePropertiesSchema = z.object({
48
52
  email: optionallyNullishToUndefined(RequiredEmailSchema),
49
53
  phoneNumber: optionallyNullishToUndefined(RequiredPhoneNumberSchema),
@@ -90,8 +94,8 @@ export const UserPayloadSchema = UserPayloadSchemaBase.transform((user) => ({
90
94
  const requiredEmailOrPhoneMessage = 'At least one of verifiedEmail, verifiedPhoneNumber, unverifiedEmail, or unverifiedPhoneNumber is required';
91
95
  const hasEmailOrPhone = (data) => data.verifiedEmail !== undefined ||
92
96
  data.verifiedPhoneNumber !== undefined ||
93
- data.unverifiedEmail !== undefined ||
94
- data.unverifiedPhoneNumber !== undefined;
97
+ data.unverifiedEmail != null ||
98
+ data.unverifiedPhoneNumber != null;
95
99
  export const InsertUserPayloadSchema = z
96
100
  .object({
97
101
  id: UserIdSchema.optional(),
@@ -99,7 +103,7 @@ export const InsertUserPayloadSchema = z
99
103
  ...UserNamePropertiesSchema.shape,
100
104
  verifiedEmail: optionallyNullishToUndefined(z.boolean()),
101
105
  verifiedPhoneNumber: optionallyNullishToUndefined(z.boolean()),
102
- ...UnverifiedEmailOrPhonePropertiesSchema.shape,
106
+ ...UpsertUnverifiedEmailOrPhonePropertiesSchema.shape,
103
107
  ...UserAssociationsSchema.shape,
104
108
  ...UpsertMetadataPropertyPayloadSchema.shape,
105
109
  })
@@ -123,7 +127,7 @@ export const UpdateUserPayloadSchema = z.object({
123
127
  suspended: z.boolean().optional(),
124
128
  ...UpdateUserNamePropertiesSchema.shape,
125
129
  ...VerifiedEmailOrPhonePropertiesSchema.shape,
126
- ...UnverifiedEmailOrPhonePropertiesSchema.shape,
130
+ ...UpsertUnverifiedEmailOrPhonePropertiesSchema.shape,
127
131
  ...UpsertMetadataPropertyPayloadSchema.shape,
128
132
  });
129
133
  /**
@@ -515,20 +515,20 @@ describe('Customer - User', () => {
515
515
  const item = {
516
516
  unverifiedEmail: 'test@example.com',
517
517
  verifiedEmail: true,
518
- unverifiedPhoneNumber: undefined,
518
+ unverifiedPhoneNumber: null,
519
519
  };
520
520
  const result = InsertUserPayloadSchema.safeParse(item);
521
521
  expect(result.success).toBe(true);
522
522
  if (result.success) {
523
523
  expect(result.data.unverifiedEmail).toBe('test@example.com');
524
- expect(result.data.unverifiedPhoneNumber).toBeUndefined();
524
+ expect(result.data.unverifiedPhoneNumber).toBeNull();
525
525
  expect(result.data.verifiedEmail).toBe(true);
526
526
  expect(result.data.verifiedPhoneNumber).toBeUndefined();
527
527
  }
528
528
  });
529
529
  test('should succeed with only unverifiedPhoneNumber', async () => {
530
530
  const item = {
531
- unverifiedEmail: undefined,
531
+ unverifiedEmail: null,
532
532
  unverifiedPhoneNumber: '+12025551234',
533
533
  verifiedPhoneNumber: true,
534
534
  };
@@ -536,7 +536,7 @@ describe('Customer - User', () => {
536
536
  expect(result.success).toBe(true);
537
537
  if (result.success) {
538
538
  expect(result.data.unverifiedPhoneNumber).toBe('+12025551234');
539
- expect(result.data.unverifiedEmail).toBeUndefined();
539
+ expect(result.data.unverifiedEmail).toBeNull();
540
540
  expect(result.data.verifiedEmail).toBeUndefined();
541
541
  expect(result.data.verifiedPhoneNumber).toBe(true);
542
542
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-mondo/identity-sdk",
3
- "version": "0.0.2-beta.73",
3
+ "version": "0.0.2-beta.74",
4
4
  "type": "module",
5
5
  "description": "A node SDK for Mondo Identity",
6
6
  "license": "MIT",