@meistrari/data-token 1.2.5 → 1.3.0

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.
@@ -34,6 +34,7 @@ declare function createDataTokenPlugin(url: string, skipOnError?: boolean, getTo
34
34
  email: string;
35
35
  uuid: string | null;
36
36
  roles?: string[] | null | undefined;
37
+ orgRole?: string | undefined;
37
38
  } | undefined;
38
39
  } | null;
39
40
  };
@@ -34,6 +34,7 @@ declare function createDataTokenPlugin(url: string, skipOnError?: boolean, getTo
34
34
  email: string;
35
35
  uuid: string | null;
36
36
  roles?: string[] | null | undefined;
37
+ orgRole?: string | undefined;
37
38
  } | undefined;
38
39
  } | null;
39
40
  };
@@ -1,6 +1,6 @@
1
1
  import * as hono from 'hono';
2
2
  import { Context } from 'hono';
3
- import { D as DataToken } from '../shared/data-token.f2fe9a18.mjs';
3
+ import { D as DataToken } from '../shared/data-token.38e0d8e6.mjs';
4
4
  import 'zod';
5
5
 
6
6
  type DataTokenContext = {
@@ -1,6 +1,6 @@
1
1
  import * as hono from 'hono';
2
2
  import { Context } from 'hono';
3
- import { D as DataToken } from '../shared/data-token.f2fe9a18.js';
3
+ import { D as DataToken } from '../shared/data-token.38e0d8e6.js';
4
4
  import 'zod';
5
5
 
6
6
  type DataTokenContext = {
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as jose from 'jose';
2
2
  import { RemoteJWKSetOptions, errors } from 'jose';
3
3
  import * as zod from 'zod';
4
- export { D as DataToken, V as ValidatorConfig } from './shared/data-token.f2fe9a18.mjs';
4
+ export { D as DataToken, V as ValidatorConfig } from './shared/data-token.38e0d8e6.mjs';
5
5
 
6
6
  /**
7
7
  * Get a validator function that can validate a data token.
@@ -27,6 +27,7 @@ declare function getValidator(jwksUrl: string, { algorithms, remoteJwksOptions,
27
27
  email: string;
28
28
  uuid: string | null;
29
29
  roles?: string[] | null | undefined;
30
+ orgRole?: string | undefined;
30
31
  } | undefined;
31
32
  }>;
32
33
  /**
@@ -55,6 +56,7 @@ declare function safeParse(jwt: string): zod.SafeParseReturnType<{
55
56
  email: string;
56
57
  uuid: string | null;
57
58
  roles?: string[] | null | undefined;
59
+ orgRole?: string | undefined;
58
60
  } | undefined;
59
61
  }, {
60
62
  requestId: string;
@@ -67,6 +69,7 @@ declare function safeParse(jwt: string): zod.SafeParseReturnType<{
67
69
  email: string;
68
70
  uuid: string | null;
69
71
  roles?: string[] | null | undefined;
72
+ orgRole?: string | undefined;
70
73
  } | undefined;
71
74
  }>;
72
75
  /**
@@ -88,6 +91,7 @@ declare function unsafeDecode(jwt: string): {
88
91
  email: string;
89
92
  uuid: string | null;
90
93
  roles?: string[] | null | undefined;
94
+ orgRole?: string | undefined;
91
95
  } | undefined;
92
96
  } & jose.JWTPayload;
93
97
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as jose from 'jose';
2
2
  import { RemoteJWKSetOptions, errors } from 'jose';
3
3
  import * as zod from 'zod';
4
- export { D as DataToken, V as ValidatorConfig } from './shared/data-token.f2fe9a18.js';
4
+ export { D as DataToken, V as ValidatorConfig } from './shared/data-token.38e0d8e6.js';
5
5
 
6
6
  /**
7
7
  * Get a validator function that can validate a data token.
@@ -27,6 +27,7 @@ declare function getValidator(jwksUrl: string, { algorithms, remoteJwksOptions,
27
27
  email: string;
28
28
  uuid: string | null;
29
29
  roles?: string[] | null | undefined;
30
+ orgRole?: string | undefined;
30
31
  } | undefined;
31
32
  }>;
32
33
  /**
@@ -55,6 +56,7 @@ declare function safeParse(jwt: string): zod.SafeParseReturnType<{
55
56
  email: string;
56
57
  uuid: string | null;
57
58
  roles?: string[] | null | undefined;
59
+ orgRole?: string | undefined;
58
60
  } | undefined;
59
61
  }, {
60
62
  requestId: string;
@@ -67,6 +69,7 @@ declare function safeParse(jwt: string): zod.SafeParseReturnType<{
67
69
  email: string;
68
70
  uuid: string | null;
69
71
  roles?: string[] | null | undefined;
72
+ orgRole?: string | undefined;
70
73
  } | undefined;
71
74
  }>;
72
75
  /**
@@ -88,6 +91,7 @@ declare function unsafeDecode(jwt: string): {
88
91
  email: string;
89
92
  uuid: string | null;
90
93
  roles?: string[] | null | undefined;
94
+ orgRole?: string | undefined;
91
95
  } | undefined;
92
96
  } & jose.JWTPayload;
93
97
 
package/dist/index.mjs CHANGED
@@ -56,7 +56,11 @@ const DataToken = z.object({
56
56
  id: z.string(),
57
57
  email: z.string(),
58
58
  uuid: z.string().nullable(),
59
- roles: z.array(z.string()).optional().nullable()
59
+ roles: z.array(z.string()).optional().nullable(),
60
+ // The user's organization member role (e.g. `org:admin`). Only set when the
61
+ // incoming credential was an application token, whose `roles` carry the
62
+ // application role instead.
63
+ orgRole: z.string().optional()
60
64
  }).optional()
61
65
  });
62
66
 
@@ -17,16 +17,19 @@ declare const DataToken: z.ZodObject<{
17
17
  email: z.ZodString;
18
18
  uuid: z.ZodNullable<z.ZodString>;
19
19
  roles: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
20
+ orgRole: z.ZodOptional<z.ZodString>;
20
21
  }, "strip", z.ZodTypeAny, {
21
22
  id: string;
22
23
  email: string;
23
24
  uuid: string | null;
24
25
  roles?: string[] | null | undefined;
26
+ orgRole?: string | undefined;
25
27
  }, {
26
28
  id: string;
27
29
  email: string;
28
30
  uuid: string | null;
29
31
  roles?: string[] | null | undefined;
32
+ orgRole?: string | undefined;
30
33
  }>>;
31
34
  }, "strip", z.ZodTypeAny, {
32
35
  requestId: string;
@@ -39,6 +42,7 @@ declare const DataToken: z.ZodObject<{
39
42
  email: string;
40
43
  uuid: string | null;
41
44
  roles?: string[] | null | undefined;
45
+ orgRole?: string | undefined;
42
46
  } | undefined;
43
47
  }, {
44
48
  requestId: string;
@@ -51,6 +55,7 @@ declare const DataToken: z.ZodObject<{
51
55
  email: string;
52
56
  uuid: string | null;
53
57
  roles?: string[] | null | undefined;
58
+ orgRole?: string | undefined;
54
59
  } | undefined;
55
60
  }>;
56
61
  type DataToken = z.infer<typeof DataToken>;
@@ -17,16 +17,19 @@ declare const DataToken: z.ZodObject<{
17
17
  email: z.ZodString;
18
18
  uuid: z.ZodNullable<z.ZodString>;
19
19
  roles: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
20
+ orgRole: z.ZodOptional<z.ZodString>;
20
21
  }, "strip", z.ZodTypeAny, {
21
22
  id: string;
22
23
  email: string;
23
24
  uuid: string | null;
24
25
  roles?: string[] | null | undefined;
26
+ orgRole?: string | undefined;
25
27
  }, {
26
28
  id: string;
27
29
  email: string;
28
30
  uuid: string | null;
29
31
  roles?: string[] | null | undefined;
32
+ orgRole?: string | undefined;
30
33
  }>>;
31
34
  }, "strip", z.ZodTypeAny, {
32
35
  requestId: string;
@@ -39,6 +42,7 @@ declare const DataToken: z.ZodObject<{
39
42
  email: string;
40
43
  uuid: string | null;
41
44
  roles?: string[] | null | undefined;
45
+ orgRole?: string | undefined;
42
46
  } | undefined;
43
47
  }, {
44
48
  requestId: string;
@@ -51,6 +55,7 @@ declare const DataToken: z.ZodObject<{
51
55
  email: string;
52
56
  uuid: string | null;
53
57
  roles?: string[] | null | undefined;
58
+ orgRole?: string | undefined;
54
59
  } | undefined;
55
60
  }>;
56
61
  type DataToken = z.infer<typeof DataToken>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meistrari/data-token",
3
3
  "type": "module",
4
- "version": "1.2.5",
4
+ "version": "1.3.0",
5
5
  "description": "Internal library to verify and decode the API Gateway data token",
6
6
  "author": "Roz <roz@meistrari.com>",
7
7
  "license": "UNLICENSED",