@krak-stack/auth 0.2.1 → 0.2.3

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.
@@ -1,4 +1,5 @@
1
1
  import { Schema } from "effect";
2
+ import { User, UserMetadata } from "../schema.js";
2
3
  const JsonRecord = Schema.Record(Schema.String, Schema.Json);
3
4
  const StringArrayRecord = Schema.Record(Schema.String, Schema.Array(Schema.String));
4
5
  export const AuthUser = Schema.Struct({
@@ -7,6 +8,7 @@ export const AuthUser = Schema.Struct({
7
8
  email: Schema.String,
8
9
  emailVerified: Schema.Boolean,
9
10
  image: Schema.NullOr(Schema.String),
11
+ metadata: User.fields.metadata,
10
12
  role: Schema.NullOr(Schema.String),
11
13
  banned: Schema.NullOr(Schema.Boolean),
12
14
  banReason: Schema.optional(Schema.NullOr(Schema.String)),
@@ -127,6 +129,7 @@ export class AuthInternalServerError extends Schema.TaggedError()("AuthInternalS
127
129
  export const UpdateUserPayload = Schema.Struct({
128
130
  name: Schema.optional(Schema.String),
129
131
  image: Schema.optional(Schema.NullOr(Schema.String)),
132
+ metadata: Schema.optional(Schema.NullOr(UserMetadata)),
130
133
  }).annotate({ identifier: "UpdateUserPayload", title: "Update user payload" });
131
134
  export const SignInEmailPayload = Schema.Struct({
132
135
  email: Schema.String,
@@ -363,9 +366,19 @@ export const AuthMemberRecord = Schema.Struct({
363
366
  identifier: "AuthMemberRecord",
364
367
  title: "Organization member record",
365
368
  });
369
+ export const AuthMemberUser = Schema.Struct({
370
+ id: Schema.String,
371
+ name: Schema.String,
372
+ email: Schema.String,
373
+ image: Schema.optional(Schema.NullOr(Schema.String)),
374
+ metadata: User.fields.metadata,
375
+ }).annotate({
376
+ identifier: "AuthMemberUser",
377
+ title: "Organization member user",
378
+ });
366
379
  export const AuthMember = Schema.Struct({
367
380
  ...AuthMemberRecord.fields,
368
- user: AuthUser,
381
+ user: AuthMemberUser,
369
382
  }).annotate({ identifier: "AuthMember", title: "Organization member" });
370
383
  export const AuthInvitation = Schema.Struct({
371
384
  id: Schema.String,
@@ -20,6 +20,38 @@ export declare const authSessionAtom: (arg: string | undefined) => Atom.Writable
20
20
  readonly email: string;
21
21
  readonly emailVerified: boolean;
22
22
  readonly image: string | null;
23
+ readonly metadata?: {
24
+ readonly emails?: readonly {
25
+ readonly email: string;
26
+ readonly translations: readonly {
27
+ readonly locale: "en" | "fr";
28
+ readonly label: string;
29
+ }[];
30
+ }[] | undefined;
31
+ readonly phones?: readonly {
32
+ readonly number: string;
33
+ readonly extension?: string | undefined;
34
+ readonly translations: readonly {
35
+ readonly locale: "en" | "fr";
36
+ readonly label: string;
37
+ }[];
38
+ }[] | undefined;
39
+ readonly websites?: readonly {
40
+ readonly url: string;
41
+ readonly translations: readonly {
42
+ readonly locale: "en" | "fr";
43
+ readonly label: string;
44
+ }[];
45
+ }[] | undefined;
46
+ readonly socials?: readonly {
47
+ readonly platform: "facebook" | "github" | "instagram" | "linkedin" | "tiktok" | "x" | "youtube";
48
+ readonly url: string;
49
+ readonly translations: readonly {
50
+ readonly locale: "en" | "fr";
51
+ readonly label: string;
52
+ }[];
53
+ }[] | undefined;
54
+ } | null | undefined;
23
55
  readonly role: string | null;
24
56
  readonly banned: boolean | null;
25
57
  readonly banReason?: string | null | undefined;
@@ -49,6 +81,38 @@ export declare const authSessionAtom: (arg: string | undefined) => Atom.Writable
49
81
  readonly email: string;
50
82
  readonly emailVerified: boolean;
51
83
  readonly image: string | null;
84
+ readonly metadata?: {
85
+ readonly emails?: readonly {
86
+ readonly email: string;
87
+ readonly translations: readonly {
88
+ readonly locale: "en" | "fr";
89
+ readonly label: string;
90
+ }[];
91
+ }[] | undefined;
92
+ readonly phones?: readonly {
93
+ readonly number: string;
94
+ readonly extension?: string | undefined;
95
+ readonly translations: readonly {
96
+ readonly locale: "en" | "fr";
97
+ readonly label: string;
98
+ }[];
99
+ }[] | undefined;
100
+ readonly websites?: readonly {
101
+ readonly url: string;
102
+ readonly translations: readonly {
103
+ readonly locale: "en" | "fr";
104
+ readonly label: string;
105
+ }[];
106
+ }[] | undefined;
107
+ readonly socials?: readonly {
108
+ readonly platform: "facebook" | "github" | "instagram" | "linkedin" | "tiktok" | "x" | "youtube";
109
+ readonly url: string;
110
+ readonly translations: readonly {
111
+ readonly locale: "en" | "fr";
112
+ readonly label: string;
113
+ }[];
114
+ }[] | undefined;
115
+ } | null | undefined;
52
116
  readonly role: string | null;
53
117
  readonly banned: boolean | null;
54
118
  readonly banReason?: string | null | undefined;
@@ -103,16 +167,39 @@ export declare const activeAuthOrganizationAtom: (arg: string | undefined) => (a
103
167
  readonly id: string;
104
168
  readonly name: string;
105
169
  readonly email: string;
106
- readonly emailVerified: boolean;
107
- readonly image: string | null;
108
- readonly role: string | null;
109
- readonly banned: boolean | null;
110
- readonly banReason?: string | null | undefined;
111
- readonly banExpires?: Date | null | undefined;
112
- readonly twoFactorEnabled?: boolean | undefined;
113
- readonly lastLoginMethod?: string | null | undefined;
114
- readonly createdAt: Date;
115
- readonly updatedAt: Date;
170
+ readonly image?: string | null | undefined;
171
+ readonly metadata?: {
172
+ readonly emails?: readonly {
173
+ readonly email: string;
174
+ readonly translations: readonly {
175
+ readonly locale: "en" | "fr";
176
+ readonly label: string;
177
+ }[];
178
+ }[] | undefined;
179
+ readonly phones?: readonly {
180
+ readonly number: string;
181
+ readonly extension?: string | undefined;
182
+ readonly translations: readonly {
183
+ readonly locale: "en" | "fr";
184
+ readonly label: string;
185
+ }[];
186
+ }[] | undefined;
187
+ readonly websites?: readonly {
188
+ readonly url: string;
189
+ readonly translations: readonly {
190
+ readonly locale: "en" | "fr";
191
+ readonly label: string;
192
+ }[];
193
+ }[] | undefined;
194
+ readonly socials?: readonly {
195
+ readonly platform: "facebook" | "github" | "instagram" | "linkedin" | "tiktok" | "x" | "youtube";
196
+ readonly url: string;
197
+ readonly translations: readonly {
198
+ readonly locale: "en" | "fr";
199
+ readonly label: string;
200
+ }[];
201
+ }[] | undefined;
202
+ } | null | undefined;
116
203
  };
117
204
  }[];
118
205
  readonly invitations: readonly {
@@ -148,16 +235,39 @@ export declare const activeAuthOrganizationAtom: (arg: string | undefined) => (a
148
235
  readonly id: string;
149
236
  readonly name: string;
150
237
  readonly email: string;
151
- readonly emailVerified: boolean;
152
- readonly image: string | null;
153
- readonly role: string | null;
154
- readonly banned: boolean | null;
155
- readonly banReason?: string | null | undefined;
156
- readonly banExpires?: Date | null | undefined;
157
- readonly twoFactorEnabled?: boolean | undefined;
158
- readonly lastLoginMethod?: string | null | undefined;
159
- readonly createdAt: Date;
160
- readonly updatedAt: Date;
238
+ readonly image?: string | null | undefined;
239
+ readonly metadata?: {
240
+ readonly emails?: readonly {
241
+ readonly email: string;
242
+ readonly translations: readonly {
243
+ readonly locale: "en" | "fr";
244
+ readonly label: string;
245
+ }[];
246
+ }[] | undefined;
247
+ readonly phones?: readonly {
248
+ readonly number: string;
249
+ readonly extension?: string | undefined;
250
+ readonly translations: readonly {
251
+ readonly locale: "en" | "fr";
252
+ readonly label: string;
253
+ }[];
254
+ }[] | undefined;
255
+ readonly websites?: readonly {
256
+ readonly url: string;
257
+ readonly translations: readonly {
258
+ readonly locale: "en" | "fr";
259
+ readonly label: string;
260
+ }[];
261
+ }[] | undefined;
262
+ readonly socials?: readonly {
263
+ readonly platform: "facebook" | "github" | "instagram" | "linkedin" | "tiktok" | "x" | "youtube";
264
+ readonly url: string;
265
+ readonly translations: readonly {
266
+ readonly locale: "en" | "fr";
267
+ readonly label: string;
268
+ }[];
269
+ }[] | undefined;
270
+ } | null | undefined;
161
271
  };
162
272
  }[];
163
273
  readonly invitations: readonly {