@assemble-dev/shared-utils 0.4.0 → 0.4.1

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.
@@ -58,7 +58,8 @@ var import_zod = require("zod");
58
58
  var SUPABASE_AUTHENTICATED_AUDIENCE = "authenticated";
59
59
  var SupabaseJwtUserMetadataSchema = import_zod.z.object({
60
60
  name: import_zod.z.string().optional(),
61
- full_name: import_zod.z.string().optional()
61
+ full_name: import_zod.z.string().optional(),
62
+ email_verified: import_zod.z.boolean().optional()
62
63
  });
63
64
  var SupabaseJwtClaimsSchema = import_zod.z.object({
64
65
  sub: import_zod.z.string().min(1),
@@ -66,6 +67,7 @@ var SupabaseJwtClaimsSchema = import_zod.z.object({
66
67
  iss: import_zod.z.string().min(1),
67
68
  aud: import_zod.z.union([import_zod.z.string(), import_zod.z.array(import_zod.z.string())]),
68
69
  email: import_zod.z.string().email().optional(),
70
+ email_verified: import_zod.z.boolean().optional(),
69
71
  user_metadata: SupabaseJwtUserMetadataSchema.optional()
70
72
  });
71
73
  function createSupabaseRemoteKeySet(jwksUrl) {
@@ -145,7 +147,8 @@ function buildAuthSubjectFromClaims(claims) {
145
147
  return {
146
148
  id: claims.sub,
147
149
  email: claims.email,
148
- name: claims.user_metadata?.name ?? claims.user_metadata?.full_name ?? null
150
+ name: claims.user_metadata?.name ?? claims.user_metadata?.full_name ?? null,
151
+ emailVerified: claims.email_verified ?? claims.user_metadata?.email_verified ?? false
149
152
  };
150
153
  }
151
154
  function createAuthMiddleware(config) {
@@ -9,9 +9,11 @@ declare const SupabaseJwtClaimsSchema: z.ZodObject<{
9
9
  iss: z.ZodString;
10
10
  aud: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
11
11
  email: z.ZodOptional<z.ZodString>;
12
+ email_verified: z.ZodOptional<z.ZodBoolean>;
12
13
  user_metadata: z.ZodOptional<z.ZodObject<{
13
14
  name: z.ZodOptional<z.ZodString>;
14
15
  full_name: z.ZodOptional<z.ZodString>;
16
+ email_verified: z.ZodOptional<z.ZodBoolean>;
15
17
  }, z.core.$strip>>;
16
18
  }, z.core.$strip>;
17
19
  type SupabaseJwtClaims = z.infer<typeof SupabaseJwtClaimsSchema>;
@@ -36,6 +38,7 @@ type AuthSubject = {
36
38
  id: string;
37
39
  email: string;
38
40
  name: string | null;
41
+ emailVerified: boolean;
39
42
  };
40
43
  type ResolvedAuthUser = {
41
44
  id: string;
@@ -9,9 +9,11 @@ declare const SupabaseJwtClaimsSchema: z.ZodObject<{
9
9
  iss: z.ZodString;
10
10
  aud: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
11
11
  email: z.ZodOptional<z.ZodString>;
12
+ email_verified: z.ZodOptional<z.ZodBoolean>;
12
13
  user_metadata: z.ZodOptional<z.ZodObject<{
13
14
  name: z.ZodOptional<z.ZodString>;
14
15
  full_name: z.ZodOptional<z.ZodString>;
16
+ email_verified: z.ZodOptional<z.ZodBoolean>;
15
17
  }, z.core.$strip>>;
16
18
  }, z.core.$strip>;
17
19
  type SupabaseJwtClaims = z.infer<typeof SupabaseJwtClaimsSchema>;
@@ -36,6 +38,7 @@ type AuthSubject = {
36
38
  id: string;
37
39
  email: string;
38
40
  name: string | null;
41
+ emailVerified: boolean;
39
42
  };
40
43
  type ResolvedAuthUser = {
41
44
  id: string;
@@ -12,7 +12,8 @@ import { z } from "zod";
12
12
  var SUPABASE_AUTHENTICATED_AUDIENCE = "authenticated";
13
13
  var SupabaseJwtUserMetadataSchema = z.object({
14
14
  name: z.string().optional(),
15
- full_name: z.string().optional()
15
+ full_name: z.string().optional(),
16
+ email_verified: z.boolean().optional()
16
17
  });
17
18
  var SupabaseJwtClaimsSchema = z.object({
18
19
  sub: z.string().min(1),
@@ -20,6 +21,7 @@ var SupabaseJwtClaimsSchema = z.object({
20
21
  iss: z.string().min(1),
21
22
  aud: z.union([z.string(), z.array(z.string())]),
22
23
  email: z.string().email().optional(),
24
+ email_verified: z.boolean().optional(),
23
25
  user_metadata: SupabaseJwtUserMetadataSchema.optional()
24
26
  });
25
27
  function createSupabaseRemoteKeySet(jwksUrl) {
@@ -99,7 +101,8 @@ function buildAuthSubjectFromClaims(claims) {
99
101
  return {
100
102
  id: claims.sub,
101
103
  email: claims.email,
102
- name: claims.user_metadata?.name ?? claims.user_metadata?.full_name ?? null
104
+ name: claims.user_metadata?.name ?? claims.user_metadata?.full_name ?? null,
105
+ emailVerified: claims.email_verified ?? claims.user_metadata?.email_verified ?? false
103
106
  };
104
107
  }
105
108
  function createAuthMiddleware(config) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assemble-dev/shared-utils",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "license": "Elastic-2.0",
5
5
  "description": "Shared utilities for Assemble including errors, ids, auth, and redaction",
6
6
  "repository": {
@@ -59,7 +59,7 @@
59
59
  "hono": "^4.12.27",
60
60
  "jose": "^6.2.3",
61
61
  "zod": "^4.1.13",
62
- "@assemble-dev/shared-types": "0.4.0"
62
+ "@assemble-dev/shared-types": "0.4.1"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@types/node": "^20.19.0",