@go-mondo/identity-sdk 0.0.2-beta.3 → 0.0.2-beta.5

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 (45) 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/activity/schema/base.d.ts +16 -0
  6. package/dist/cjs/activity/schema/base.d.ts.map +1 -1
  7. package/dist/cjs/activity/schema/base.js +16 -3
  8. package/dist/cjs/activity/schema/schema.d.ts +1 -16
  9. package/dist/cjs/activity/schema/schema.d.ts.map +1 -1
  10. package/dist/cjs/activity/schema/schema.js +8 -19
  11. package/dist/cjs/association/schema/association.d.ts +3 -3
  12. package/dist/cjs/authorization/permissions/schema.d.ts +4 -4
  13. package/dist/cjs/authorization/permissions/schema.d.ts.map +1 -1
  14. package/dist/cjs/authorization/permissions/schema.js +4 -2
  15. package/dist/cjs/common/schema/schema.d.ts +4 -0
  16. package/dist/cjs/common/schema/schema.d.ts.map +1 -1
  17. package/dist/cjs/common/schema/schema.js +10 -0
  18. package/dist/cjs/common/schema/sets.d.ts +1 -1
  19. package/dist/cjs/common/schema/sets.d.ts.map +1 -1
  20. package/dist/cjs/common/schema/sets.js +2 -2
  21. package/dist/cjs/customer/users/schema.d.ts +7 -8
  22. package/dist/cjs/customer/users/schema.d.ts.map +1 -1
  23. package/dist/cjs/customer/users/schema.js +25 -24
  24. package/dist/cjs/customer/users/schema.test.js +49 -0
  25. package/dist/esm/activity/schema/base.d.ts +16 -0
  26. package/dist/esm/activity/schema/base.d.ts.map +1 -1
  27. package/dist/esm/activity/schema/base.js +14 -1
  28. package/dist/esm/activity/schema/schema.d.ts +1 -16
  29. package/dist/esm/activity/schema/schema.d.ts.map +1 -1
  30. package/dist/esm/activity/schema/schema.js +1 -14
  31. package/dist/esm/association/schema/association.d.ts +3 -3
  32. package/dist/esm/authorization/permissions/schema.d.ts +4 -4
  33. package/dist/esm/authorization/permissions/schema.d.ts.map +1 -1
  34. package/dist/esm/authorization/permissions/schema.js +4 -2
  35. package/dist/esm/common/schema/schema.d.ts +4 -0
  36. package/dist/esm/common/schema/schema.d.ts.map +1 -1
  37. package/dist/esm/common/schema/schema.js +6 -0
  38. package/dist/esm/common/schema/sets.d.ts +1 -1
  39. package/dist/esm/common/schema/sets.d.ts.map +1 -1
  40. package/dist/esm/common/schema/sets.js +1 -1
  41. package/dist/esm/customer/users/schema.d.ts +7 -8
  42. package/dist/esm/customer/users/schema.d.ts.map +1 -1
  43. package/dist/esm/customer/users/schema.js +24 -23
  44. package/dist/esm/customer/users/schema.test.js +49 -0
  45. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/activity/schema/schema.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,YAAY;;;;;;CAMf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE/E,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAC1B,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAErD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAKC,CAAC;AACpC,MAAM,MAAM,eAAe,GAAG,OAAO,qBAAqB,CAAC,QAAQ,CAAC;AAEpE,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;MAAkC,CAAC;AAC3E,MAAM,MAAM,qBAAqB,GAAG,OAAO,2BAA2B,CAAC,QAAQ,CAAC;AAEhF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;MAAkC,CAAC;AAC3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AC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,YAAY,CAAC"}
@@ -3,20 +3,7 @@ import { AuthorizationActivityPayloadSchema } from './types/authorization.js';
3
3
  import { InsertNoteActivityPayloadSchema, NoteActivityPayloadSchema, UpdateNoteActivityPayloadSchema, } from './types/note.js';
4
4
  import { OperationActivityPayloadSchema } from './types/operation.js';
5
5
  import { UnknownActivityPayloadSchema } from './types/unknown.js';
6
- export const ActivityType = {
7
- UNKNOWN: 'unknown',
8
- NOTE: 'note',
9
- OPERATION: 'operation',
10
- AUTHORIZATION: 'authorization',
11
- AUTHENTICATION: 'authentication',
12
- };
13
- export const PerformerType = {
14
- SYSTEM: 'system',
15
- GUEST: 'guest',
16
- IDENTITY: 'identity',
17
- AUTOMATION: 'automation',
18
- INTEGRATION: 'integration',
19
- };
6
+ export { ActivityType, PerformerType, } from './base.js';
20
7
  export const ActivityPayloadSchema = NoteActivityPayloadSchema.or(AuthenticationActivityPayloadSchema)
21
8
  .or(AuthorizationActivityPayloadSchema)
22
9
  .or(OperationActivityPayloadSchema)
@@ -15,7 +15,7 @@ export declare const AssociationObjectSchema: import("arktype/internal/methods/o
15
15
  familyName?: string | undefined;
16
16
  honorificPrefix?: string | undefined;
17
17
  honorificSuffix?: string | undefined;
18
- email?: ((In: string | undefined) => import("arktype/internal/attributes.ts").Out<string | undefined>) | undefined;
18
+ email?: string | undefined;
19
19
  phoneNumber?: string | undefined;
20
20
  status: "active" | "suspended" | "unverified";
21
21
  model: "User";
@@ -33,7 +33,7 @@ export declare const ObjectPropertySchema: import("arktype/internal/methods/obje
33
33
  familyName?: string | undefined;
34
34
  honorificPrefix?: string | undefined;
35
35
  honorificSuffix?: string | undefined;
36
- email?: ((In: string | undefined) => import("arktype/internal/attributes.ts").Out<string | undefined>) | undefined;
36
+ email?: string | undefined;
37
37
  phoneNumber?: string | undefined;
38
38
  status: "active" | "suspended" | "unverified";
39
39
  model: "User";
@@ -54,7 +54,7 @@ export declare const AssociationPayloadSchema: import("arktype/internal/methods/
54
54
  familyName?: string | undefined;
55
55
  honorificPrefix?: string | undefined;
56
56
  honorificSuffix?: string | undefined;
57
- email?: ((In: string | undefined) => import("arktype/internal/attributes.ts").Out<string | undefined>) | undefined;
57
+ email?: string | undefined;
58
58
  phoneNumber?: string | undefined;
59
59
  status: "active" | "suspended" | "unverified";
60
60
  model: "User";
@@ -18,6 +18,8 @@ export declare const PermissionSchema: import("arktype/internal/methods/object.t
18
18
  name: string;
19
19
  status: "enabled" | "disabled";
20
20
  description?: string | undefined;
21
+ createdAt: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
22
+ updatedAt: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
21
23
  apps?: {
22
24
  ids?: string[] | undefined;
23
25
  count?: number | undefined;
@@ -26,8 +28,6 @@ export declare const PermissionSchema: import("arktype/internal/methods/object.t
26
28
  ids?: string[] | undefined;
27
29
  count?: number | undefined;
28
30
  } | undefined;
29
- createdAt: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
30
- updatedAt: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
31
31
  deletedAt?: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>) | undefined;
32
32
  deactivatedAt?: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>) | undefined;
33
33
  metadata: (In: import("arktype/internal/attributes.ts").Default<unknown, Map<string, string | number | boolean>>) => import("arktype/internal/attributes.ts").Out<Map<string, string | number | boolean> | Map<string, any>>;
@@ -39,6 +39,8 @@ export declare const PermissionPayloadSchema: import("arktype/internal/methods/o
39
39
  name: string;
40
40
  status: "enabled" | "disabled";
41
41
  description?: string | undefined;
42
+ createdAt: (In: string | Date) => import("arktype/internal/attributes.ts").Out<string>;
43
+ updatedAt: (In: string | Date) => import("arktype/internal/attributes.ts").Out<string>;
42
44
  apps?: {
43
45
  ids?: string[] | undefined;
44
46
  count?: number | undefined;
@@ -47,8 +49,6 @@ export declare const PermissionPayloadSchema: import("arktype/internal/methods/o
47
49
  ids?: string[] | undefined;
48
50
  count?: number | undefined;
49
51
  } | undefined;
50
- createdAt: (In: string | Date) => import("arktype/internal/attributes.ts").Out<string>;
51
- updatedAt: (In: string | Date) => import("arktype/internal/attributes.ts").Out<string>;
52
52
  deletedAt?: ((In: string | Date | undefined) => import("arktype/internal/attributes.ts").Out<string | undefined>) | undefined;
53
53
  deactivatedAt?: ((In: string | Date | undefined) => import("arktype/internal/attributes.ts").Out<string | undefined>) | undefined;
54
54
  metadata?: ((In: {
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/authorization/permissions/schema.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAC7B,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAE3D,eAAO,MAAM,kBAAkB,qEAAc,CAAC;AAE9C,eAAO,MAAM,0BAA0B;;MAErC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,0BAA0B,CAAC,QAAQ,CAAC;AAS9E,eAAO,MAAM,4BAA4B;;;MAGvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAChC,OAAO,4BAA4B,CAAC,QAAQ,CAAC;AAU/C,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;MAKI,CAAC;AAClC,MAAM,MAAM,oBAAoB,GAAG,OAAO,gBAAgB,CAAC,OAAO,CAAC;AACnE,MAAM,MAAM,UAAU,GAAG,OAAO,gBAAgB,CAAC,QAAQ,CAAC;AAE1D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;MAKC,CAAC;AACtC,MAAM,MAAM,iBAAiB,GAAG,OAAO,uBAAuB,CAAC,QAAQ,CAAC;AAExE;;G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AOC,CAAC;AACtC,MAAM,MAAM,iBAAiB,GAAG,OAAO,uBAAuB,CAAC,QAAQ,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;MAOC,CAAC;AAC5C,MAAM,MAAM,qBAAqB,GAC/B,OAAO,6BAA6B,CAAC,OAAO,CAAC;AAC/C,MAAM,MAAM,uBAAuB,GACjC,OAAO,6BAA6B,CAAC,QAAQ,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;MAIC,CAAC;AAC5C,MAAM,MAAM,qBAAqB,GAC/B,OAAO,6BAA6B,CAAC,OAAO,CAAC;AAC/C,MAAM,MAAM,uBAAuB,GACjC,OAAO,6BAA6B,CAAC,QAAQ,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,oCAAoC;;;;;MAG7C,CAAC;AACL,MAAM,MAAM,8BAA8B,GACxC,OAAO,oCAAoC,CAAC,QAAQ,CAAC"}
@@ -21,16 +21,18 @@ const BaseSchema = PermissionIdPropertySchema.and({
21
21
  name: type('string'),
22
22
  status: PermissionStatusSchema,
23
23
  description: type('string').optional(),
24
- apps: AggregateSchema.optional(),
25
- roles: AggregateSchema.optional(),
26
24
  });
27
25
  export const PermissionSchema = BaseSchema.and({
26
+ apps: AggregateSchema.optional(),
27
+ roles: AggregateSchema.optional(),
28
28
  createdAt: RequiredDateSchema,
29
29
  updatedAt: RequiredDateSchema,
30
30
  'deletedAt?': OptionalDateSchema,
31
31
  'deactivatedAt?': OptionalDateSchema,
32
32
  }).and(MetadataMapPropertySchema);
33
33
  export const PermissionPayloadSchema = BaseSchema.and({
34
+ apps: AggregateSchema.optional(),
35
+ roles: AggregateSchema.optional(),
34
36
  createdAt: RequiredDatePayloadSchema,
35
37
  updatedAt: RequiredDatePayloadSchema,
36
38
  'deletedAt?': OptionalDatePayloadSchema,
@@ -1,3 +1,4 @@
1
+ import type { type } from 'arktype';
1
2
  export * from './aggregate.js';
2
3
  export * from './collection.js';
3
4
  export * from './dates.js';
@@ -5,4 +6,7 @@ export * from './jwt.js';
5
6
  export * from './metadata.js';
6
7
  export * from './pagination.js';
7
8
  export * from './sets.js';
9
+ export declare const optionallyNullishToUndefined: <t extends type.Any>(t: t) => [type<t["t"] | undefined>, "?"];
10
+ export declare const optionallyNullish: <t extends type.Any>(t: t) => [type<t["t"] | null | undefined>, "?"];
11
+ export declare const optionallyUndefined: <t extends type.Any>(t: t) => [type<t["t"] | undefined>, "?"];
8
12
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/common/schema/schema.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/common/schema/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,IAAI,EAAE,MAAM,SAAS,CAAC;AAE1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAE1B,eAAO,MAAM,4BAA4B,GAAI,CAAC,SAAS,IAAI,CAAC,GAAG,EAC7D,GAAG,CAAC,KACH,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,EAAE,GAAG,CAIT,CAAC;AAEzB,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,IAAI,CAAC,GAAG,EAClD,GAAG,CAAC,KACH,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,GAAG,CACgB,CAAC;AAEzD,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,IAAI,CAAC,GAAG,EACpD,GAAG,CAAC,KACH,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,EAAE,GAAG,CACgB,CAAC"}
@@ -5,3 +5,9 @@ export * from './jwt.js';
5
5
  export * from './metadata.js';
6
6
  export * from './pagination.js';
7
7
  export * from './sets.js';
8
+ export const optionallyNullishToUndefined = (t) => t
9
+ .or('null | undefined')
10
+ .pipe((v) => (v == null ? v : undefined))
11
+ .optional();
12
+ export const optionallyNullish = (t) => t.or('null | undefined').optional();
13
+ export const optionallyUndefined = (t) => t.or('undefined').optional();
@@ -1,3 +1,3 @@
1
1
  export declare const UniqueStringSetPayloadSchema: import("arktype/internal/methods/object.ts").ObjectType<Set<string> | ((In: string[]) => import("arktype/internal/attributes.ts").Out<Set<string>>), {}>;
2
- export declare const UniqueStringSetPayload: import("arktype/internal/methods/object.ts").ObjectType<(In: Set<string> | string[]) => import("arktype/internal/attributes.ts").Out<string[]>, {}>;
2
+ export declare const UniqueStringPayloadSchema: import("arktype/internal/methods/object.ts").ObjectType<(In: Set<string> | string[]) => import("arktype/internal/attributes.ts").Out<string[]>, {}>;
3
3
  //# sourceMappingURL=sets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sets.d.ts","sourceRoot":"","sources":["../../../../src/common/schema/sets.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,4BAA4B,0JAAiC,CAAC;AAC3E,eAAO,MAAM,sBAAsB,qJAElC,CAAC"}
1
+ {"version":3,"file":"sets.d.ts","sourceRoot":"","sources":["../../../../src/common/schema/sets.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,4BAA4B,0JAAiC,CAAC;AAC3E,eAAO,MAAM,yBAAyB,qJAErC,CAAC"}
@@ -3,4 +3,4 @@ const StringArraySchema = type('string[]');
3
3
  const StringArrayToSet = StringArraySchema.pipe((s) => new Set(s));
4
4
  const StringSet = type.instanceOf((Set));
5
5
  export const UniqueStringSetPayloadSchema = StringSet.or(StringArrayToSet);
6
- export const UniqueStringSetPayload = UniqueStringSetPayloadSchema.pipe((s) => Array.from(s.values()));
6
+ export const UniqueStringPayloadSchema = UniqueStringSetPayloadSchema.pipe((s) => Array.from(s.values()));
@@ -16,8 +16,7 @@ export declare const UserNamePropertiesSchema: import("arktype/internal/methods/
16
16
  honorificPrefix?: string | undefined;
17
17
  honorificSuffix?: string | undefined;
18
18
  }, {}>;
19
- export type UserNameProperties = typeof UserNamePropertiesSchema.inferOut;
20
- export declare const UpsertUserNamePropertiesSchema: import("arktype/internal/methods/object.ts").ObjectType<{
19
+ export declare const UpdateUserNamePropertiesSchema: import("arktype/internal/methods/object.ts").ObjectType<{
21
20
  givenName?: string | null | undefined;
22
21
  middleName?: string | null | undefined;
23
22
  familyName?: string | null | undefined;
@@ -33,13 +32,13 @@ export type UserIdProperty = typeof UserIdPropertySchema.inferOut;
33
32
  export declare const RequiredEmailSchema: import("arktype/internal/methods/string.ts").StringType<string, {}>;
34
33
  export declare const RequiredPhoneNumberSchema: import("arktype/internal/methods/string.ts").StringType<string, {}>;
35
34
  export declare const VerifiedEmailOrPhonePropertiesSchema: import("arktype/internal/methods/object.ts").ObjectType<{
36
- email?: ((In: string | undefined) => import("arktype/internal/attributes.ts").Out<string | undefined>) | undefined;
35
+ email?: string | undefined;
37
36
  verifiedEmail?: boolean | undefined;
38
37
  phoneNumber?: string | undefined;
39
38
  verifiedPhoneNumber?: boolean | undefined;
40
39
  }, {}>;
41
40
  export declare const EmailOrPhonePropertiesSchema: import("arktype/internal/methods/object.ts").ObjectType<{
42
- email?: ((In: string | undefined) => import("arktype/internal/attributes.ts").Out<string | undefined>) | undefined;
41
+ email?: string | undefined;
43
42
  phoneNumber?: string | undefined;
44
43
  }, {}>;
45
44
  export declare const UserAssociationsSchema: import("arktype/internal/methods/object.ts").ObjectType<{
@@ -53,7 +52,7 @@ export declare const UserSchema: import("arktype/internal/methods/object.ts").Ob
53
52
  familyName?: string | undefined;
54
53
  honorificPrefix?: string | undefined;
55
54
  honorificSuffix?: string | undefined;
56
- email?: ((In: string | undefined) => import("arktype/internal/attributes.ts").Out<string | undefined>) | undefined;
55
+ email?: string | undefined;
57
56
  verifiedEmail?: boolean | undefined;
58
57
  phoneNumber?: string | undefined;
59
58
  verifiedPhoneNumber?: boolean | undefined;
@@ -78,7 +77,7 @@ export declare const UserPayloadSchema: import("arktype/internal/methods/object.
78
77
  familyName?: string | undefined;
79
78
  honorificPrefix?: string | undefined;
80
79
  honorificSuffix?: string | undefined;
81
- email?: ((In: string | undefined) => import("arktype/internal/attributes.ts").Out<string | undefined>) | undefined;
80
+ email?: string | undefined;
82
81
  verifiedEmail?: boolean | undefined;
83
82
  phoneNumber?: string | undefined;
84
83
  verifiedPhoneNumber?: boolean | undefined;
@@ -107,7 +106,7 @@ export declare const InsertUserPayloadSchema: import("arktype/internal/methods/o
107
106
  familyName?: string | undefined;
108
107
  honorificPrefix?: string | undefined;
109
108
  honorificSuffix?: string | undefined;
110
- email?: ((In: string | undefined) => import("arktype/internal/attributes.ts").Out<string | undefined>) | undefined;
109
+ email?: string | undefined;
111
110
  verifiedEmail?: boolean | undefined;
112
111
  phoneNumber?: string | undefined;
113
112
  verifiedPhoneNumber?: boolean | undefined;
@@ -142,7 +141,7 @@ export declare const UserAssociationReferenceSchema: import("arktype/internal/me
142
141
  familyName?: string | undefined;
143
142
  honorificPrefix?: string | undefined;
144
143
  honorificSuffix?: string | undefined;
145
- email?: ((In: string | undefined) => import("arktype/internal/attributes.ts").Out<string | undefined>) | undefined;
144
+ email?: string | undefined;
146
145
  phoneNumber?: string | undefined;
147
146
  status: "active" | "suspended" | "unverified";
148
147
  model: "User";
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/customer/users/schema.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,mBAAmB;;;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,MAAM,4BAA4B;;;MAGvC,CAAC;AAIH,eAAO,MAAM,sBAAsB;;MAEjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,sBAAsB,CAAC,QAAQ,CAAC;AAStE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;MAMU,CAAC;AAClC,MAAM,MAAM,cAAc,GAAG,OAAO,UAAU,CAAC,OAAO,CAAC;AACvD,MAAM,MAAM,IAAI,GAAG,OAAO,UAAU,CAAC,QAAQ,CAAC;AAE9C,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;MAMO,CAAC;AACtC,MAAM,MAAM,WAAW,GAAG,OAAO,iBAAiB,CAAC,QAAQ,CAAC;AAE5D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;MAOO,CAAC;AAC5C,MAAM,MAAM,eAAe,GAAG,OAAO,uBAAuB,CAAC,OAAO,CAAC;AACrE,MAAM,MAAM,iBAAiB,GAAG,OAAO,uBAAuB,CAAC,QAAQ,CAAC;AAExE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;MAIO,CAAC;AAC5C,MAAM,MAAM,eAAe,GAAG,OAAO,uBAAuB,CAAC,OAAO,CAAC;AACrE,MAAM,MAAM,iBAAiB,GAAG,OAAO,uBAAuB,CAAC,QAAQ,CAAC;AAExE,eAAO,MAAM,8BAA8B;;;;;;;;;;;MAS1C,CAAC;AACF,MAAM,MAAM,wBAAwB,GAClC,OAAO,8BAA8B,CAAC,QAAQ,CAAC"}
@@ -2,6 +2,7 @@ import { type } from 'arktype';
2
2
  import { AggregateSchema } from '../../common/schema/aggregate.js';
3
3
  import { OptionalDatePayloadSchema, OptionalDateSchema, RequiredDatePayloadSchema, RequiredDateSchema, } from '../../common/schema/dates.js';
4
4
  import { MetadataMapPropertySchema, MetadataPayloadPropertySchema, UpsertMetadataPayloadPropertySchema, } from '../../common/schema/metadata.js';
5
+ import { optionallyNullish, optionallyNullishToUndefined, optionallyUndefined, } from '../../common/schema/schema.js';
5
6
  import { generateUserId } from '../schema/utils.js';
6
7
  export const VerifiableAttribute = {
7
8
  EMAIL: 'email',
@@ -14,36 +15,36 @@ export const UserStatus = {
14
15
  };
15
16
  const UserStatusSchema = type.enumerated(UserStatus.ACTIVE, UserStatus.SUSPENDED, UserStatus.UNVERIFIED);
16
17
  export const UserNamePropertiesSchema = type({
17
- givenName: type('string | undefined').or('undefined').optional(),
18
- middleName: type('string | undefined').optional(),
19
- familyName: type('string | undefined').optional(),
20
- honorificPrefix: type('string | undefined').optional(),
21
- honorificSuffix: type('string | undefined').optional(),
18
+ givenName: optionallyNullishToUndefined(type('string')),
19
+ middleName: optionallyNullishToUndefined(type('string')),
20
+ familyName: optionallyNullishToUndefined(type('string')),
21
+ honorificPrefix: optionallyNullishToUndefined(type('string')),
22
+ honorificSuffix: optionallyNullishToUndefined(type('string')),
22
23
  });
23
- export const UpsertUserNamePropertiesSchema = type({
24
- givenName: type('string | undefined | null').optional(),
25
- middleName: type('string | undefined | null').optional(),
26
- familyName: type('string | undefined | null').optional(),
27
- honorificPrefix: type('string | undefined | null').optional(),
28
- honorificSuffix: type('string | undefined | null').optional(),
24
+ // export type UserNameProperties = typeof UserNamePropertiesSchema.inferOut;
25
+ export const UpdateUserNamePropertiesSchema = type({
26
+ givenName: optionallyNullish(type('string')),
27
+ middleName: optionallyNullish(type('string')),
28
+ familyName: optionallyNullish(type('string')),
29
+ honorificPrefix: optionallyNullish(type('string')),
30
+ honorificSuffix: optionallyNullish(type('string')),
29
31
  });
32
+ // type UpsertUserNameProperties = typeof UpdateUserNamePropertiesSchema.inferOut;
30
33
  export const UserIdSchema = type.string;
31
34
  export const UserIdPropertySchema = type({
32
35
  id: UserIdSchema,
33
36
  });
34
37
  export const RequiredEmailSchema = type('string.email');
35
38
  export const RequiredPhoneNumberSchema = type('string');
36
- const EmailSchema = RequiredEmailSchema.or('undefined').pipe((v) => v != null ? v : undefined);
37
- const PhoneNumberSchema = RequiredPhoneNumberSchema.or('undefined');
38
39
  export const VerifiedEmailOrPhonePropertiesSchema = type({
39
- email: EmailSchema.optional(),
40
- verifiedEmail: type('boolean').or('undefined').optional(),
41
- phoneNumber: PhoneNumberSchema.optional(),
42
- verifiedPhoneNumber: type('boolean').or('undefined').optional(),
40
+ email: optionallyNullishToUndefined(RequiredEmailSchema),
41
+ verifiedEmail: optionallyNullishToUndefined(type('boolean')),
42
+ phoneNumber: optionallyNullishToUndefined(RequiredPhoneNumberSchema),
43
+ verifiedPhoneNumber: optionallyNullishToUndefined(type('boolean')),
43
44
  });
44
45
  export const EmailOrPhonePropertiesSchema = type({
45
- email: EmailSchema.optional(),
46
- phoneNumber: PhoneNumberSchema.optional(),
46
+ email: optionallyNullishToUndefined(RequiredEmailSchema),
47
+ phoneNumber: optionallyNullishToUndefined(RequiredPhoneNumberSchema),
47
48
  });
48
49
  const UserRoleAssociationSchema = type('string[] | undefined');
49
50
  export const UserAssociationsSchema = type({
@@ -53,14 +54,14 @@ const BaseSchema = UserIdPropertySchema.and(UserNamePropertiesSchema)
53
54
  .and(VerifiedEmailOrPhonePropertiesSchema)
54
55
  .and({
55
56
  status: UserStatusSchema,
56
- roles: AggregateSchema.or(type.undefined).optional(),
57
+ roles: optionallyUndefined(AggregateSchema),
57
58
  });
58
59
  export const UserSchema = BaseSchema.and({
59
60
  lastLogin: OptionalDateSchema.optional(),
60
61
  createdAt: RequiredDateSchema,
61
62
  updatedAt: RequiredDateSchema,
62
- 'deletedAt?': OptionalDateSchema,
63
- 'deactivatedAt?': OptionalDateSchema,
63
+ deletedAt: OptionalDateSchema.optional(),
64
+ deactivatedAt: OptionalDateSchema.optional(),
64
65
  }).and(MetadataMapPropertySchema);
65
66
  export const UserPayloadSchema = BaseSchema.and({
66
67
  lastLogin: OptionalDatePayloadSchema.optional(),
@@ -80,7 +81,7 @@ export const InsertUserPayloadSchema = type({
80
81
  export const UpdateUserPayloadSchema = type({
81
82
  suspended: type.boolean.optional(),
82
83
  })
83
- .and(UpsertUserNamePropertiesSchema)
84
+ .and(UpdateUserNamePropertiesSchema)
84
85
  .and(UpsertMetadataPayloadPropertySchema);
85
86
  export const UserAssociationReferenceSchema = UserIdPropertySchema.and(UserNamePropertiesSchema).and(EmailOrPhonePropertiesSchema.and(type({
86
87
  status: UserStatusSchema,
@@ -51,5 +51,54 @@ describe('Customer - User', () => {
51
51
  expect(result).not.toBeInstanceOf(type.errors);
52
52
  expect(result?.metadata).to.null;
53
53
  });
54
+ test('should serialize nulls successfully', async () => {
55
+ const payload = {
56
+ id: '123',
57
+ status: 'unverified',
58
+ givenName: null,
59
+ middleName: null,
60
+ familyName: null,
61
+ honorificPrefix: null,
62
+ honorificSuffix: null,
63
+ email: null,
64
+ verifiedEmail: null,
65
+ phoneNumber: null,
66
+ verifiedPhoneNumber: null,
67
+ createdAt: '2025-04-02T03:50:40.812Z',
68
+ updatedAt: '2025-04-02T03:50:40.812Z',
69
+ };
70
+ const result = UserPayloadSchema(payload);
71
+ if (result instanceof type.errors) {
72
+ console.log(result.summary);
73
+ }
74
+ expect(result).not.toBeInstanceOf(type.errors);
75
+ });
76
+ test('should serialize nulls successfully', async () => {
77
+ const payload = {
78
+ id: '123',
79
+ status: 'unverified',
80
+ givenName: null,
81
+ middleName: null,
82
+ familyName: null,
83
+ honorificPrefix: null,
84
+ honorificSuffix: null,
85
+ email: null,
86
+ verifiedEmail: null,
87
+ phoneNumber: null,
88
+ verifiedPhoneNumber: null,
89
+ createdAt: '2025-04-02T03:50:40.812Z',
90
+ updatedAt: '2025-04-02T03:50:40.812Z',
91
+ };
92
+ const test = type({
93
+ foo: 'string.numeric.parse',
94
+ bar: 'number',
95
+ baz: 'string.date.iso.parse',
96
+ });
97
+ const result = UserPayloadSchema(payload);
98
+ if (result instanceof type.errors) {
99
+ console.log(result.summary);
100
+ }
101
+ expect(result).not.toBeInstanceOf(type.errors);
102
+ });
54
103
  });
55
104
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-mondo/identity-sdk",
3
- "version": "0.0.2-beta.3",
3
+ "version": "0.0.2-beta.5",
4
4
  "type": "module",
5
5
  "description": "A node SDK for Mondo Identity",
6
6
  "license": "MIT",