@meistrari/data-token 1.2.5 → 1.3.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.
- package/dist/adapters/elysia.d.mts +1 -0
- package/dist/adapters/elysia.d.ts +1 -0
- package/dist/adapters/hono.d.mts +1 -1
- package/dist/adapters/hono.d.ts +1 -1
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +5 -1
- package/dist/shared/{data-token.f2fe9a18.d.mts → data-token.38e0d8e6.d.mts} +5 -0
- package/dist/shared/{data-token.f2fe9a18.d.ts → data-token.38e0d8e6.d.ts} +5 -0
- package/package.json +2 -2
package/dist/adapters/hono.d.mts
CHANGED
package/dist/adapters/hono.d.ts
CHANGED
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.
|
|
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.
|
|
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.
|
|
4
|
+
"version": "1.3.1",
|
|
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",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"prepack": "bun run build"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@meistrari/logger": "2.
|
|
44
|
+
"@meistrari/logger": "^2.2.1",
|
|
45
45
|
"cockatiel": "^3.2.1",
|
|
46
46
|
"jose": "^5.8.0",
|
|
47
47
|
"zod": "^3.23.8"
|