@simulacrum/auth0-simulator 0.11.2 → 0.11.4
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/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/_virtual/rolldown_runtime.mjs +7 -0
- package/dist/auth/constants.cjs +15 -0
- package/dist/auth/constants.mjs +14 -0
- package/dist/auth/constants.mjs.map +1 -0
- package/dist/auth/date.cjs +8 -0
- package/dist/auth/date.mjs +7 -0
- package/dist/auth/date.mjs.map +1 -0
- package/dist/auth/jwt.cjs +16 -0
- package/dist/auth/jwt.mjs +15 -0
- package/dist/auth/jwt.mjs.map +1 -0
- package/dist/auth/refresh-token.cjs +24 -0
- package/dist/auth/refresh-token.mjs +23 -0
- package/dist/auth/refresh-token.mjs.map +1 -0
- package/dist/config/get-config.cjs +39 -0
- package/dist/config/get-config.mjs +39 -0
- package/dist/config/get-config.mjs.map +1 -0
- package/dist/handlers/auth0-handlers.cjs +207 -0
- package/dist/handlers/auth0-handlers.mjs +207 -0
- package/dist/handlers/auth0-handlers.mjs.map +1 -0
- package/dist/handlers/index.cjs +29 -0
- package/dist/handlers/index.mjs +27 -0
- package/dist/handlers/index.mjs.map +1 -0
- package/dist/handlers/login-redirect.cjs +24 -0
- package/dist/handlers/login-redirect.mjs +24 -0
- package/dist/handlers/login-redirect.mjs.map +1 -0
- package/dist/handlers/oauth-handlers.cjs +144 -0
- package/dist/handlers/oauth-handlers.mjs +144 -0
- package/dist/handlers/oauth-handlers.mjs.map +1 -0
- package/dist/handlers/openid-handlers.cjs +32 -0
- package/dist/handlers/openid-handlers.mjs +33 -0
- package/dist/handlers/openid-handlers.mjs.map +1 -0
- package/dist/handlers/url.cjs +6 -0
- package/dist/handlers/url.mjs +6 -0
- package/dist/handlers/url.mjs.map +1 -0
- package/dist/handlers/utils.cjs +25 -0
- package/dist/handlers/utils.mjs +24 -0
- package/dist/handlers/utils.mjs.map +1 -0
- package/dist/handlers/web-message.cjs +23 -0
- package/dist/handlers/web-message.mjs +23 -0
- package/dist/handlers/web-message.mjs.map +1 -0
- package/dist/index.cjs +14 -38722
- package/dist/index.d.cts +4 -176
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +21 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +22 -0
- package/dist/index.mjs.map +1 -0
- package/dist/middleware/create-cors.cjs +15 -0
- package/dist/middleware/create-cors.mjs +14 -0
- package/dist/middleware/create-cors.mjs.map +1 -0
- package/dist/middleware/error-handling.cjs +25 -0
- package/dist/middleware/error-handling.mjs +25 -0
- package/dist/middleware/error-handling.mjs.map +1 -0
- package/dist/middleware/no-cache.cjs +10 -0
- package/dist/middleware/no-cache.mjs +10 -0
- package/dist/middleware/no-cache.mjs.map +1 -0
- package/dist/middleware/session.cjs +19 -0
- package/dist/middleware/session.mjs +18 -0
- package/dist/middleware/session.mjs.map +1 -0
- package/dist/rules/extensionless-file-name.cjs +6 -0
- package/dist/rules/extensionless-file-name.mjs +6 -0
- package/dist/rules/extensionless-file-name.mjs.map +1 -0
- package/dist/rules/parse-rules-files.cjs +28 -0
- package/dist/rules/parse-rules-files.mjs +26 -0
- package/dist/rules/parse-rules-files.mjs.map +1 -0
- package/dist/rules/rules-runner.cjs +67 -0
- package/dist/rules/rules-runner.mjs +65 -0
- package/dist/rules/rules-runner.mjs.map +1 -0
- package/dist/store/entities.cjs +36 -0
- package/dist/store/entities.d.cts +99 -0
- package/dist/store/entities.d.cts.map +1 -0
- package/dist/store/entities.d.mts +100 -0
- package/dist/store/entities.d.mts.map +1 -0
- package/dist/store/entities.mjs +33 -0
- package/dist/store/entities.mjs.map +1 -0
- package/dist/store/index.cjs +44 -0
- package/dist/store/index.d.cts +22 -0
- package/dist/store/index.d.cts.map +1 -0
- package/dist/store/index.d.mts +22 -0
- package/dist/store/index.d.mts.map +1 -0
- package/dist/store/index.mjs +45 -0
- package/dist/store/index.mjs.map +1 -0
- package/dist/types.cjs +24 -0
- package/dist/types.d.cts +66 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +66 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +24 -0
- package/dist/types.mjs.map +1 -0
- package/dist/views/login.cjs +145 -0
- package/dist/views/login.mjs +146 -0
- package/dist/views/login.mjs.map +1 -0
- package/dist/views/username-password.cjs +39 -0
- package/dist/views/username-password.mjs +39 -0
- package/dist/views/username-password.mjs.map +1 -0
- package/dist/views/web-message.cjs +66 -0
- package/dist/views/web-message.mjs +65 -0
- package/dist/views/web-message.mjs.map +1 -0
- package/package.json +7 -7
- package/dist/index.d.ts +0 -193
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -38720
- package/dist/index.js.map +0 -1
- /package/dist/{public → views/public}/img/frontside-logo.png +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let _simulacrum_foundation_simulator = require("@simulacrum/foundation-simulator");
|
|
3
|
+
let zod = require("zod");
|
|
4
|
+
let _faker_js_faker = require("@faker-js/faker");
|
|
5
|
+
|
|
6
|
+
//#region src/store/entities.ts
|
|
7
|
+
const auth0UserSchema = zod.z.object({
|
|
8
|
+
id: zod.z.string().default(() => _faker_js_faker.faker.database.mongodbObjectId()),
|
|
9
|
+
name: zod.z.string(),
|
|
10
|
+
password: zod.z.string().optional().default("12345"),
|
|
11
|
+
email: zod.z.string().email().optional(),
|
|
12
|
+
picture: zod.z.string().url().optional()
|
|
13
|
+
}).transform((user) => {
|
|
14
|
+
if (!user.email) user.email = _faker_js_faker.faker.internet.email({ firstName: user.name });
|
|
15
|
+
if (!user.picture) user.picture = _faker_js_faker.faker.image.avatar();
|
|
16
|
+
return user;
|
|
17
|
+
});
|
|
18
|
+
const defaultUser = auth0UserSchema.parse({
|
|
19
|
+
name: "default",
|
|
20
|
+
email: "default@example.com"
|
|
21
|
+
});
|
|
22
|
+
const auth0InitialStoreSchema = zod.z.object({ users: zod.z.array(auth0UserSchema) });
|
|
23
|
+
const convertToObj = (arrayOfObjects, key = "id") => arrayOfObjects.reduce((final, obj) => {
|
|
24
|
+
final[obj[key]] = obj;
|
|
25
|
+
return final;
|
|
26
|
+
}, {});
|
|
27
|
+
const convertInitialStateToStoreState = (initialState) => {
|
|
28
|
+
if (!initialState) return void 0;
|
|
29
|
+
return { users: convertToObj(initialState.users, "id") };
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
exports.auth0InitialStoreSchema = auth0InitialStoreSchema;
|
|
34
|
+
exports.auth0UserSchema = auth0UserSchema;
|
|
35
|
+
exports.convertInitialStateToStoreState = convertInitialStateToStoreState;
|
|
36
|
+
exports.defaultUser = defaultUser;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/store/entities.d.ts
|
|
4
|
+
declare const auth0UserSchema: z.ZodEffects<z.ZodObject<{
|
|
5
|
+
id: z.ZodDefault<z.ZodString>;
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
password: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
8
|
+
email: z.ZodOptional<z.ZodString>;
|
|
9
|
+
picture: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
password: string;
|
|
14
|
+
email?: string | undefined;
|
|
15
|
+
picture?: string | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
name: string;
|
|
18
|
+
id?: string | undefined;
|
|
19
|
+
password?: string | undefined;
|
|
20
|
+
email?: string | undefined;
|
|
21
|
+
picture?: string | undefined;
|
|
22
|
+
}>, {
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
password: string;
|
|
26
|
+
email?: string | undefined;
|
|
27
|
+
picture?: string | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
name: string;
|
|
30
|
+
id?: string | undefined;
|
|
31
|
+
password?: string | undefined;
|
|
32
|
+
email?: string | undefined;
|
|
33
|
+
picture?: string | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
type Auth0User = z.infer<typeof auth0UserSchema>;
|
|
36
|
+
declare const defaultUser: {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
password: string;
|
|
40
|
+
email?: string | undefined;
|
|
41
|
+
picture?: string | undefined;
|
|
42
|
+
};
|
|
43
|
+
declare const auth0InitialStoreSchema: z.ZodObject<{
|
|
44
|
+
users: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
45
|
+
id: z.ZodDefault<z.ZodString>;
|
|
46
|
+
name: z.ZodString;
|
|
47
|
+
password: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
48
|
+
email: z.ZodOptional<z.ZodString>;
|
|
49
|
+
picture: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
password: string;
|
|
54
|
+
email?: string | undefined;
|
|
55
|
+
picture?: string | undefined;
|
|
56
|
+
}, {
|
|
57
|
+
name: string;
|
|
58
|
+
id?: string | undefined;
|
|
59
|
+
password?: string | undefined;
|
|
60
|
+
email?: string | undefined;
|
|
61
|
+
picture?: string | undefined;
|
|
62
|
+
}>, {
|
|
63
|
+
id: string;
|
|
64
|
+
name: string;
|
|
65
|
+
password: string;
|
|
66
|
+
email?: string | undefined;
|
|
67
|
+
picture?: string | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
name: string;
|
|
70
|
+
id?: string | undefined;
|
|
71
|
+
password?: string | undefined;
|
|
72
|
+
email?: string | undefined;
|
|
73
|
+
picture?: string | undefined;
|
|
74
|
+
}>, "many">;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
users: {
|
|
77
|
+
id: string;
|
|
78
|
+
name: string;
|
|
79
|
+
password: string;
|
|
80
|
+
email?: string | undefined;
|
|
81
|
+
picture?: string | undefined;
|
|
82
|
+
}[];
|
|
83
|
+
}, {
|
|
84
|
+
users: {
|
|
85
|
+
name: string;
|
|
86
|
+
id?: string | undefined;
|
|
87
|
+
password?: string | undefined;
|
|
88
|
+
email?: string | undefined;
|
|
89
|
+
picture?: string | undefined;
|
|
90
|
+
}[];
|
|
91
|
+
}>;
|
|
92
|
+
type AuthSession = {
|
|
93
|
+
username: string;
|
|
94
|
+
nonce: string;
|
|
95
|
+
};
|
|
96
|
+
type Auth0InitialStore = z.input<typeof auth0InitialStoreSchema>;
|
|
97
|
+
//#endregion
|
|
98
|
+
export { Auth0InitialStore, Auth0User, AuthSession, auth0UserSchema, defaultUser };
|
|
99
|
+
//# sourceMappingURL=entities.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.d.cts","names":[],"sources":["../../src/store/entities.ts"],"sourcesContent":[],"mappings":";;;cAIa,iBAAe,CAAA,CAAA,WAAA,CAAA,CAAA;EAAf,EAAA,cAAA,YAaT,CAAA;;;;;;;;;;;;EAbwB,IAAA,EAAA,MAAA;EAAA,EAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAAA,QAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAchB,KAAA,CAAA,EAAA,MAAS,GAAA,SAAkB;EAC1B,OAAA,CAAA,EAAA,MAGX,GAAA,SAAA;AAEF,CAAA,CAAA,EAAa;;;;;;;;;;;;;KAND,SAAA,GAAY,CAAA,CAAE,aAAa;cAC1B;;EAKuB,IAAA,EAAA,MAAA;EAAA,QAAA,EAAA,MAAA;EAGxB,KAAA,CAAA,EAAA,MAAW,GAAA,SAAA;EAIX,OAAA,CAAA,EAAA,MAAA,GAAA,SAAiB;;cAPhB,yBAAuB,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAGxB,WAAA;;;;KAIA,iBAAA,GAAoB,CAAA,CAAE,aAAa"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import "@simulacrum/foundation-simulator";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/store/entities.d.ts
|
|
5
|
+
declare const auth0UserSchema: z.ZodEffects<z.ZodObject<{
|
|
6
|
+
id: z.ZodDefault<z.ZodString>;
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
password: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
9
|
+
email: z.ZodOptional<z.ZodString>;
|
|
10
|
+
picture: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
password: string;
|
|
15
|
+
email?: string | undefined;
|
|
16
|
+
picture?: string | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
name: string;
|
|
19
|
+
id?: string | undefined;
|
|
20
|
+
password?: string | undefined;
|
|
21
|
+
email?: string | undefined;
|
|
22
|
+
picture?: string | undefined;
|
|
23
|
+
}>, {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
password: string;
|
|
27
|
+
email?: string | undefined;
|
|
28
|
+
picture?: string | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
name: string;
|
|
31
|
+
id?: string | undefined;
|
|
32
|
+
password?: string | undefined;
|
|
33
|
+
email?: string | undefined;
|
|
34
|
+
picture?: string | undefined;
|
|
35
|
+
}>;
|
|
36
|
+
type Auth0User = z.infer<typeof auth0UserSchema>;
|
|
37
|
+
declare const defaultUser: {
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
password: string;
|
|
41
|
+
email?: string | undefined;
|
|
42
|
+
picture?: string | undefined;
|
|
43
|
+
};
|
|
44
|
+
declare const auth0InitialStoreSchema: z.ZodObject<{
|
|
45
|
+
users: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
46
|
+
id: z.ZodDefault<z.ZodString>;
|
|
47
|
+
name: z.ZodString;
|
|
48
|
+
password: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
49
|
+
email: z.ZodOptional<z.ZodString>;
|
|
50
|
+
picture: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
password: string;
|
|
55
|
+
email?: string | undefined;
|
|
56
|
+
picture?: string | undefined;
|
|
57
|
+
}, {
|
|
58
|
+
name: string;
|
|
59
|
+
id?: string | undefined;
|
|
60
|
+
password?: string | undefined;
|
|
61
|
+
email?: string | undefined;
|
|
62
|
+
picture?: string | undefined;
|
|
63
|
+
}>, {
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
password: string;
|
|
67
|
+
email?: string | undefined;
|
|
68
|
+
picture?: string | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
name: string;
|
|
71
|
+
id?: string | undefined;
|
|
72
|
+
password?: string | undefined;
|
|
73
|
+
email?: string | undefined;
|
|
74
|
+
picture?: string | undefined;
|
|
75
|
+
}>, "many">;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
users: {
|
|
78
|
+
id: string;
|
|
79
|
+
name: string;
|
|
80
|
+
password: string;
|
|
81
|
+
email?: string | undefined;
|
|
82
|
+
picture?: string | undefined;
|
|
83
|
+
}[];
|
|
84
|
+
}, {
|
|
85
|
+
users: {
|
|
86
|
+
name: string;
|
|
87
|
+
id?: string | undefined;
|
|
88
|
+
password?: string | undefined;
|
|
89
|
+
email?: string | undefined;
|
|
90
|
+
picture?: string | undefined;
|
|
91
|
+
}[];
|
|
92
|
+
}>;
|
|
93
|
+
type AuthSession = {
|
|
94
|
+
username: string;
|
|
95
|
+
nonce: string;
|
|
96
|
+
};
|
|
97
|
+
type Auth0InitialStore = z.input<typeof auth0InitialStoreSchema>;
|
|
98
|
+
//#endregion
|
|
99
|
+
export { Auth0InitialStore, Auth0User, AuthSession, auth0UserSchema, defaultUser };
|
|
100
|
+
//# sourceMappingURL=entities.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.d.mts","names":[],"sources":["../../src/store/entities.ts"],"sourcesContent":[],"mappings":";;;;cAIa,iBAAe,CAAA,CAAA,WAAA,CAAA,CAAA;;EAAf,IAAA,aAAA;;;;;;;;;;;;EAAe,EAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAAA,QAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAAA,KAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAchB,OAAA,CAAA,EAAA,MAAS,GAAA,SAAkB;AACvC,CAAA,CAAA,EAAa;EAKA,EAAA,EAAA,MAAA;;;;;;;;;;;;KAND,SAAA,GAAY,CAAA,CAAE,aAAa;cAC1B;;;EAKuB,QAAA,EAAA,MAAA;EAAA,KAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAGxB,OAAA,CAAA,EAAA,MAAW,GAAA,SAAA;AAIvB,CAAA;cAPa,yBAAuB,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAGxB,WAAA;;;;KAIA,iBAAA,GAAoB,CAAA,CAAE,aAAa"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import "@simulacrum/foundation-simulator";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { faker } from "@faker-js/faker";
|
|
4
|
+
|
|
5
|
+
//#region src/store/entities.ts
|
|
6
|
+
const auth0UserSchema = z.object({
|
|
7
|
+
id: z.string().default(() => faker.database.mongodbObjectId()),
|
|
8
|
+
name: z.string(),
|
|
9
|
+
password: z.string().optional().default("12345"),
|
|
10
|
+
email: z.string().email().optional(),
|
|
11
|
+
picture: z.string().url().optional()
|
|
12
|
+
}).transform((user) => {
|
|
13
|
+
if (!user.email) user.email = faker.internet.email({ firstName: user.name });
|
|
14
|
+
if (!user.picture) user.picture = faker.image.avatar();
|
|
15
|
+
return user;
|
|
16
|
+
});
|
|
17
|
+
const defaultUser = auth0UserSchema.parse({
|
|
18
|
+
name: "default",
|
|
19
|
+
email: "default@example.com"
|
|
20
|
+
});
|
|
21
|
+
const auth0InitialStoreSchema = z.object({ users: z.array(auth0UserSchema) });
|
|
22
|
+
const convertToObj = (arrayOfObjects, key = "id") => arrayOfObjects.reduce((final, obj) => {
|
|
23
|
+
final[obj[key]] = obj;
|
|
24
|
+
return final;
|
|
25
|
+
}, {});
|
|
26
|
+
const convertInitialStateToStoreState = (initialState) => {
|
|
27
|
+
if (!initialState) return void 0;
|
|
28
|
+
return { users: convertToObj(initialState.users, "id") };
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { auth0InitialStoreSchema, auth0UserSchema, convertInitialStateToStoreState, defaultUser };
|
|
33
|
+
//# sourceMappingURL=entities.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.mjs","names":[],"sources":["../../src/store/entities.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { type IdProp } from \"@simulacrum/foundation-simulator\";\nimport { faker } from \"@faker-js/faker\";\n\nexport const auth0UserSchema = z\n .object({\n id: z.string().default(() => faker.database.mongodbObjectId()),\n name: z.string(),\n password: z.string().optional().default(\"12345\"),\n email: z.string().email().optional(),\n picture: z.string().url().optional(),\n })\n .transform((user) => {\n if (!user.email)\n user.email = faker.internet.email({ firstName: user.name });\n if (!user.picture) user.picture = faker.image.avatar();\n return user;\n });\nexport type Auth0User = z.infer<typeof auth0UserSchema>;\nexport const defaultUser = auth0UserSchema.parse({\n name: \"default\",\n email: \"default@example.com\",\n});\n\nexport const auth0InitialStoreSchema = z.object({\n users: z.array(auth0UserSchema),\n});\nexport type AuthSession = { username: string; nonce: string };\nexport type Auth0Store = z.output<typeof auth0InitialStoreSchema> & {\n sessions: AuthSession[];\n};\nexport type Auth0InitialStore = z.input<typeof auth0InitialStoreSchema>;\n\nexport const convertToObj = <T extends { [k: string]: any }>(\n arrayOfObjects: T[],\n key: IdProp = \"id\"\n): Record<IdProp, T> =>\n arrayOfObjects.reduce((final, obj: T) => {\n final[obj[key]] = obj;\n return final;\n }, {} as Record<IdProp, T>);\n\nexport const convertInitialStateToStoreState = (\n initialState: Auth0InitialStore | undefined\n) => {\n if (!initialState) return undefined;\n const storeObject = {\n users: convertToObj(initialState.users as Auth0Store[\"users\"], \"id\"),\n };\n\n return storeObject;\n};\n"],"mappings":";;;;;AAIA,MAAa,kBAAkB,EAC5B,OAAO;CACN,IAAI,EAAE,QAAQ,CAAC,cAAc,MAAM,SAAS,iBAAiB,CAAC;CAC9D,MAAM,EAAE,QAAQ;CAChB,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,QAAQ;CAChD,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU;CACpC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU;CACrC,CAAC,CACD,WAAW,SAAS;AACnB,KAAI,CAAC,KAAK,MACR,MAAK,QAAQ,MAAM,SAAS,MAAM,EAAE,WAAW,KAAK,MAAM,CAAC;AAC7D,KAAI,CAAC,KAAK,QAAS,MAAK,UAAU,MAAM,MAAM,QAAQ;AACtD,QAAO;EACP;AAEJ,MAAa,cAAc,gBAAgB,MAAM;CAC/C,MAAM;CACN,OAAO;CACR,CAAC;AAEF,MAAa,0BAA0B,EAAE,OAAO,EAC9C,OAAO,EAAE,MAAM,gBAAgB,EAChC,CAAC;AAOF,MAAa,gBACX,gBACA,MAAc,SAEd,eAAe,QAAQ,OAAO,QAAW;AACvC,OAAM,IAAI,QAAQ;AAClB,QAAO;GACN,EAAE,CAAsB;AAE7B,MAAa,mCACX,iBACG;AACH,KAAI,CAAC,aAAc,QAAO;AAK1B,QAJoB,EAClB,OAAO,aAAa,aAAa,OAA8B,KAAK,EACrE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const require_entities = require('./entities.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/store/index.ts
|
|
4
|
+
const inputSchema = (initialState, extendedSchema) => ({ slice }) => {
|
|
5
|
+
const storeInitialState = require_entities.convertInitialStateToStoreState(initialState);
|
|
6
|
+
const extended = extendedSchema ? extendedSchema({ slice }) : {};
|
|
7
|
+
return {
|
|
8
|
+
sessions: slice.table(),
|
|
9
|
+
users: slice.table({ ...!storeInitialState ? { initialState: { [require_entities.defaultUser.id]: require_entities.defaultUser } } : { initialState: storeInitialState.users } }),
|
|
10
|
+
...extended
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
const inputActions = (_args) => {
|
|
14
|
+
return {};
|
|
15
|
+
};
|
|
16
|
+
const extendActions = (extendedActions) => (args) => {
|
|
17
|
+
const base = inputActions(args);
|
|
18
|
+
if (!extendedActions) return base;
|
|
19
|
+
const extResult = extendedActions(args);
|
|
20
|
+
return {
|
|
21
|
+
...base,
|
|
22
|
+
...extResult
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
const inputSelectors = (_args) => {
|
|
26
|
+
return {};
|
|
27
|
+
};
|
|
28
|
+
const extendSelectors = (extendedSelectors) => (args) => {
|
|
29
|
+
const base = inputSelectors(args);
|
|
30
|
+
if (!extendedSelectors) return base;
|
|
31
|
+
const extResult = extendedSelectors(args);
|
|
32
|
+
return {
|
|
33
|
+
...base,
|
|
34
|
+
...extResult
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const extendStore = (initialState, extended) => ({
|
|
38
|
+
actions: extendActions(extended?.actions),
|
|
39
|
+
selectors: extendSelectors(extended?.selectors),
|
|
40
|
+
schema: inputSchema(initialState, extended?.schema)
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
exports.extendStore = extendStore;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Auth0User, AuthSession } from "./entities.cjs";
|
|
2
|
+
import { AnyState, ExtendSimulationActions, ExtendSimulationSchema, ExtendSimulationSelectors, ExtendStoreConfig, SimulationStore, TableOutput } from "@simulacrum/foundation-simulator";
|
|
3
|
+
|
|
4
|
+
//#region src/store/index.d.ts
|
|
5
|
+
type ExtendedSchema = ({
|
|
6
|
+
slice
|
|
7
|
+
}: ExtendSimulationSchema) => {
|
|
8
|
+
sessions: (n: string) => TableOutput<AuthSession, AnyState, AuthSession | undefined>;
|
|
9
|
+
users: (n: string) => TableOutput<Auth0User, AnyState, Auth0User | undefined>;
|
|
10
|
+
};
|
|
11
|
+
type ExtendActions = typeof inputActions;
|
|
12
|
+
type ExtendSelectors = typeof inputSelectors;
|
|
13
|
+
type Auth0Schema = ReturnType<ExtendedSchema>;
|
|
14
|
+
type Auth0Actions = ReturnType<ExtendActions>;
|
|
15
|
+
type Auth0Selectors = ReturnType<ExtendSelectors>;
|
|
16
|
+
type ExtendedSimulationStore = SimulationStore<Auth0Schema, Auth0Actions, Auth0Selectors>;
|
|
17
|
+
declare const inputActions: (_args: ExtendSimulationActions<ExtendedSchema>) => ExtendSimulationActions<ExtendedSchema>;
|
|
18
|
+
declare const inputSelectors: (_args: ExtendSimulationSelectors<ExtendedSchema>) => ExtendSimulationSelectors<ExtendedSchema>;
|
|
19
|
+
type Auth0ExtendStoreInput = ExtendStoreConfig<Auth0Schema, Auth0Actions, Auth0Selectors>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Auth0ExtendStoreInput, ExtendedSimulationStore };
|
|
22
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/store/index.ts"],"sourcesContent":[],"mappings":";;;;KAsBY,cAAA;;GAA6B;2BAGlC,YAAY,aAAa,UAAU;EAH9B,KAAA,EAAA,CAAA,CAAA,EAAA,MAAc,EAAA,GAIF,WAJE,CAIU,SAJV,EAIqB,QAJrB,EAI+B,SAJ/B,GAAA,SAAA,CAAA;CAAM;KAM3B,aAAA,GANoC,OAMb,YANa;KAOpC,eAAA,GAJc,OAIW,cAJX;AAAa,KAKpB,WAAA,GAAc,UALM,CAKK,cALL,CAAA;AAAU,KAM9B,YAAA,GAAe,UANe,CAMJ,aANI,CAAA;AAAnC,KAOK,cAAA,GAAiB,UAPtB,CAOiC,eAPjC,CAAA;AAC6B,KAQxB,uBAAA,GAA0B,eARF,CASlC,WATkC,EAUlC,YAVkC,EAWlC,cAXkC,CAAA;cAuC9B,YAvCyC,EAAA,CAAA,KAAA,EAuClB,uBAvCkB,CAuCM,cAvCN,CAAA,EAAA,GAwChC,uBAxCgC,CAwCR,cAxCQ,CAAA;cA4DzC,cA5DmD,EAAA,CAAA,KAAA,EA4D1B,yBA5D0B,CA4DA,cA5DA,CAAA,EAAA,GA6D1C,yBA7D0C,CA6DhB,cA7DgB,CAAA;AAAjC,KAiFZ,qBAAA,GAAwB,iBAjFZ,CAkFtB,WAlFsB,EAmFtB,YAnFsB,EAoFtB,cApFsB,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Auth0User, AuthSession } from "./entities.mjs";
|
|
2
|
+
import { AnyState, ExtendSimulationActions, ExtendSimulationSchema, ExtendSimulationSelectors, ExtendStoreConfig, SimulationStore, TableOutput } from "@simulacrum/foundation-simulator";
|
|
3
|
+
|
|
4
|
+
//#region src/store/index.d.ts
|
|
5
|
+
type ExtendedSchema = ({
|
|
6
|
+
slice
|
|
7
|
+
}: ExtendSimulationSchema) => {
|
|
8
|
+
sessions: (n: string) => TableOutput<AuthSession, AnyState, AuthSession | undefined>;
|
|
9
|
+
users: (n: string) => TableOutput<Auth0User, AnyState, Auth0User | undefined>;
|
|
10
|
+
};
|
|
11
|
+
type ExtendActions = typeof inputActions;
|
|
12
|
+
type ExtendSelectors = typeof inputSelectors;
|
|
13
|
+
type Auth0Schema = ReturnType<ExtendedSchema>;
|
|
14
|
+
type Auth0Actions = ReturnType<ExtendActions>;
|
|
15
|
+
type Auth0Selectors = ReturnType<ExtendSelectors>;
|
|
16
|
+
type ExtendedSimulationStore = SimulationStore<Auth0Schema, Auth0Actions, Auth0Selectors>;
|
|
17
|
+
declare const inputActions: (_args: ExtendSimulationActions<ExtendedSchema>) => ExtendSimulationActions<ExtendedSchema>;
|
|
18
|
+
declare const inputSelectors: (_args: ExtendSimulationSelectors<ExtendedSchema>) => ExtendSimulationSelectors<ExtendedSchema>;
|
|
19
|
+
type Auth0ExtendStoreInput = ExtendStoreConfig<Auth0Schema, Auth0Actions, Auth0Selectors>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Auth0ExtendStoreInput, ExtendedSimulationStore };
|
|
22
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/store/index.ts"],"sourcesContent":[],"mappings":";;;;KAsBY,cAAA;;GAA6B;2BAGlC,YAAY,aAAa,UAAU;EAH9B,KAAA,EAAA,CAAA,CAAA,EAAA,MAAc,EAAA,GAIF,WAJE,CAIU,SAJV,EAIqB,QAJrB,EAI+B,SAJ/B,GAAA,SAAA,CAAA;CAAM;KAM3B,aAAA,GANoC,OAMb,YANa;KAOpC,eAAA,GAJc,OAIW,cAJX;AAAa,KAKpB,WAAA,GAAc,UALM,CAKK,cALL,CAAA;AAAU,KAM9B,YAAA,GAAe,UANe,CAMJ,aANI,CAAA;AAAnC,KAOK,cAAA,GAAiB,UAPtB,CAOiC,eAPjC,CAAA;AAC6B,KAQxB,uBAAA,GAA0B,eARF,CASlC,WATkC,EAUlC,YAVkC,EAWlC,cAXkC,CAAA;cAuC9B,YAvCyC,EAAA,CAAA,KAAA,EAuClB,uBAvCkB,CAuCM,cAvCN,CAAA,EAAA,GAwChC,uBAxCgC,CAwCR,cAxCQ,CAAA;cA4DzC,cA5DmD,EAAA,CAAA,KAAA,EA4D1B,yBA5D0B,CA4DA,cA5DA,CAAA,EAAA,GA6D1C,yBA7D0C,CA6DhB,cA7DgB,CAAA;AAAjC,KAiFZ,qBAAA,GAAwB,iBAjFZ,CAkFtB,WAlFsB,EAmFtB,YAnFsB,EAoFtB,cApFsB,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { convertInitialStateToStoreState, defaultUser } from "./entities.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/store/index.ts
|
|
4
|
+
const inputSchema = (initialState, extendedSchema) => ({ slice }) => {
|
|
5
|
+
const storeInitialState = convertInitialStateToStoreState(initialState);
|
|
6
|
+
const extended = extendedSchema ? extendedSchema({ slice }) : {};
|
|
7
|
+
return {
|
|
8
|
+
sessions: slice.table(),
|
|
9
|
+
users: slice.table({ ...!storeInitialState ? { initialState: { [defaultUser.id]: defaultUser } } : { initialState: storeInitialState.users } }),
|
|
10
|
+
...extended
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
const inputActions = (_args) => {
|
|
14
|
+
return {};
|
|
15
|
+
};
|
|
16
|
+
const extendActions = (extendedActions) => (args) => {
|
|
17
|
+
const base = inputActions(args);
|
|
18
|
+
if (!extendedActions) return base;
|
|
19
|
+
const extResult = extendedActions(args);
|
|
20
|
+
return {
|
|
21
|
+
...base,
|
|
22
|
+
...extResult
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
const inputSelectors = (_args) => {
|
|
26
|
+
return {};
|
|
27
|
+
};
|
|
28
|
+
const extendSelectors = (extendedSelectors) => (args) => {
|
|
29
|
+
const base = inputSelectors(args);
|
|
30
|
+
if (!extendedSelectors) return base;
|
|
31
|
+
const extResult = extendedSelectors(args);
|
|
32
|
+
return {
|
|
33
|
+
...base,
|
|
34
|
+
...extResult
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const extendStore = (initialState, extended) => ({
|
|
38
|
+
actions: extendActions(extended?.actions),
|
|
39
|
+
selectors: extendSelectors(extended?.selectors),
|
|
40
|
+
schema: inputSchema(initialState, extended?.schema)
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { extendStore };
|
|
45
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/store/index.ts"],"sourcesContent":["import type {\n SimulationStore,\n ExtendSimulationSchema,\n ExtendSimulationSchemaInput,\n ExtendSimulationActions,\n ExtendSimulationActionsInput,\n ExtendSimulationSelectors,\n ExtendSimulationSelectorsInput,\n TableOutput,\n AnyState,\n ExtendSimulationActionsInputLoose,\n ExtendSimulationSelectorsInputLoose,\n ExtendStoreConfig,\n} from \"@simulacrum/foundation-simulator\";\nimport {\n convertInitialStateToStoreState,\n defaultUser,\n type Auth0User,\n type AuthSession,\n type Auth0InitialStore,\n} from \"./entities.ts\";\n\nexport type ExtendedSchema = ({ slice }: ExtendSimulationSchema) => {\n sessions: (\n n: string\n ) => TableOutput<AuthSession, AnyState, AuthSession | undefined>;\n users: (n: string) => TableOutput<Auth0User, AnyState, Auth0User | undefined>;\n};\ntype ExtendActions = typeof inputActions;\ntype ExtendSelectors = typeof inputSelectors;\nexport type Auth0Schema = ReturnType<ExtendedSchema>;\nexport type Auth0Actions = ReturnType<ExtendActions>;\nexport type Auth0Selectors = ReturnType<ExtendSelectors>;\n\nexport type ExtendedSimulationStore = SimulationStore<\n Auth0Schema,\n Auth0Actions,\n Auth0Selectors\n>;\n\nconst inputSchema =\n <T>(\n initialState?: Auth0InitialStore,\n extendedSchema?: ExtendSimulationSchemaInput<T>\n ) =>\n ({ slice }: ExtendSimulationSchema) => {\n const storeInitialState = convertInitialStateToStoreState(initialState);\n\n const extended = extendedSchema ? extendedSchema({ slice }) : {};\n let slices = {\n sessions: slice.table<AuthSession>(),\n users: slice.table<Auth0User>({\n ...(!storeInitialState\n ? {\n initialState: {\n [defaultUser.id]: defaultUser,\n },\n }\n : { initialState: storeInitialState.users }),\n }),\n ...extended,\n };\n return slices;\n };\n\nconst inputActions = (_args: ExtendSimulationActions<ExtendedSchema>) => {\n return {} as ExtendSimulationActions<ExtendedSchema>;\n};\n\nconst extendActions =\n (\n extendedActions?: ExtendSimulationActionsInputLoose<\n Auth0Actions,\n Auth0Schema\n >\n ) =>\n (args: ExtendSimulationActions<ExtendedSchema>) => {\n const base = inputActions(args);\n if (!extendedActions) return base;\n const extResult = extendedActions(args);\n return {\n ...(base as object),\n ...(extResult as object),\n } as Auth0Actions;\n };\n\nconst inputSelectors = (_args: ExtendSimulationSelectors<ExtendedSchema>) => {\n return {} as ExtendSimulationSelectors<ExtendedSchema>;\n};\n\nconst extendSelectors =\n (\n extendedSelectors?: ExtendSimulationSelectorsInputLoose<\n Auth0Selectors,\n Auth0Schema\n >\n ) =>\n (args: ExtendSimulationSelectors<ExtendedSchema>) => {\n const base = inputSelectors(args);\n if (!extendedSelectors) return base;\n const extResult = extendedSelectors(args);\n return {\n ...(base as object),\n ...(extResult as object),\n } as Auth0Selectors;\n };\n\nexport type Auth0ExtendStoreInput = ExtendStoreConfig<\n Auth0Schema,\n Auth0Actions,\n Auth0Selectors\n>;\n\nexport const extendStore = (\n initialState: Auth0InitialStore | undefined,\n extended?: Auth0ExtendStoreInput\n): {\n schema: ExtendSimulationSchemaInput<Auth0Schema>;\n actions?: ExtendSimulationActionsInput<Auth0Actions, Auth0Schema>;\n selectors?: ExtendSimulationSelectorsInput<Auth0Selectors, Auth0Schema>;\n logs?: boolean;\n} => ({\n actions: extendActions(extended?.actions),\n selectors: extendSelectors(extended?.selectors),\n schema: inputSchema(initialState, extended?.schema),\n});\n"],"mappings":";;;AAwCA,MAAM,eAEF,cACA,oBAED,EAAE,YAAoC;CACrC,MAAM,oBAAoB,gCAAgC,aAAa;CAEvE,MAAM,WAAW,iBAAiB,eAAe,EAAE,OAAO,CAAC,GAAG,EAAE;AAchE,QAba;EACX,UAAU,MAAM,OAAoB;EACpC,OAAO,MAAM,MAAiB,EAC5B,GAAI,CAAC,oBACD,EACE,cAAc,GACX,YAAY,KAAK,aACnB,EACF,GACD,EAAE,cAAc,kBAAkB,OAAO,EAC9C,CAAC;EACF,GAAG;EACJ;;AAIL,MAAM,gBAAgB,UAAmD;AACvE,QAAO,EAAE;;AAGX,MAAM,iBAEF,qBAKD,SAAkD;CACjD,MAAM,OAAO,aAAa,KAAK;AAC/B,KAAI,CAAC,gBAAiB,QAAO;CAC7B,MAAM,YAAY,gBAAgB,KAAK;AACvC,QAAO;EACL,GAAI;EACJ,GAAI;EACL;;AAGL,MAAM,kBAAkB,UAAqD;AAC3E,QAAO,EAAE;;AAGX,MAAM,mBAEF,uBAKD,SAAoD;CACnD,MAAM,OAAO,eAAe,KAAK;AACjC,KAAI,CAAC,kBAAmB,QAAO;CAC/B,MAAM,YAAY,kBAAkB,KAAK;AACzC,QAAO;EACL,GAAI;EACJ,GAAI;EACL;;AASL,MAAa,eACX,cACA,cAMI;CACJ,SAAS,cAAc,UAAU,QAAQ;CACzC,WAAW,gBAAgB,UAAU,UAAU;CAC/C,QAAQ,YAAY,cAAc,UAAU,OAAO;CACpD"}
|
package/dist/types.cjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let zod = require("zod");
|
|
3
|
+
|
|
4
|
+
//#region src/types.ts
|
|
5
|
+
const configurationSchema = zod.z.object({
|
|
6
|
+
port: zod.z.optional(zod.z.number().gt(2999, "port must be greater than 2999").lt(1e4, "must be less than 10000")),
|
|
7
|
+
domain: zod.z.optional(zod.z.string().min(1, "domain is required")),
|
|
8
|
+
audience: zod.z.optional(zod.z.string().min(1, "audience is required")),
|
|
9
|
+
clientID: zod.z.optional(zod.z.string().max(32, "must be 32 characters long")),
|
|
10
|
+
scope: zod.z.union([zod.z.string().min(1, "scope is required"), zod.z.array(zod.z.object({
|
|
11
|
+
clientID: zod.z.string().max(32, "must be 32 characters long"),
|
|
12
|
+
audience: zod.z.optional(zod.z.string().min(1, "audience is required")),
|
|
13
|
+
scope: zod.z.string().min(1, "scope is required")
|
|
14
|
+
}))]),
|
|
15
|
+
clientSecret: zod.z.optional(zod.z.string()),
|
|
16
|
+
rulesDirectory: zod.z.optional(zod.z.string()),
|
|
17
|
+
auth0SessionCookieName: zod.z.optional(zod.z.string()),
|
|
18
|
+
auth0CookieSecret: zod.z.optional(zod.z.string()),
|
|
19
|
+
connection: zod.z.optional(zod.z.string()),
|
|
20
|
+
cookieSecret: zod.z.optional(zod.z.string())
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
exports.configurationSchema = configurationSchema;
|
package/dist/types.d.cts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
declare const configurationSchema: z.ZodObject<{
|
|
5
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
7
|
+
audience: z.ZodOptional<z.ZodString>;
|
|
8
|
+
clientID: z.ZodOptional<z.ZodString>;
|
|
9
|
+
scope: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodObject<{
|
|
10
|
+
clientID: z.ZodString;
|
|
11
|
+
audience: z.ZodOptional<z.ZodString>;
|
|
12
|
+
scope: z.ZodString;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
clientID: string;
|
|
15
|
+
scope: string;
|
|
16
|
+
audience?: string | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
clientID: string;
|
|
19
|
+
scope: string;
|
|
20
|
+
audience?: string | undefined;
|
|
21
|
+
}>, "many">]>;
|
|
22
|
+
clientSecret: z.ZodOptional<z.ZodString>;
|
|
23
|
+
rulesDirectory: z.ZodOptional<z.ZodString>;
|
|
24
|
+
auth0SessionCookieName: z.ZodOptional<z.ZodString>;
|
|
25
|
+
auth0CookieSecret: z.ZodOptional<z.ZodString>;
|
|
26
|
+
connection: z.ZodOptional<z.ZodString>;
|
|
27
|
+
cookieSecret: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
scope: string | {
|
|
30
|
+
clientID: string;
|
|
31
|
+
scope: string;
|
|
32
|
+
audience?: string | undefined;
|
|
33
|
+
}[];
|
|
34
|
+
port?: number | undefined;
|
|
35
|
+
domain?: string | undefined;
|
|
36
|
+
audience?: string | undefined;
|
|
37
|
+
clientID?: string | undefined;
|
|
38
|
+
clientSecret?: string | undefined;
|
|
39
|
+
rulesDirectory?: string | undefined;
|
|
40
|
+
auth0SessionCookieName?: string | undefined;
|
|
41
|
+
auth0CookieSecret?: string | undefined;
|
|
42
|
+
connection?: string | undefined;
|
|
43
|
+
cookieSecret?: string | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
scope: string | {
|
|
46
|
+
clientID: string;
|
|
47
|
+
scope: string;
|
|
48
|
+
audience?: string | undefined;
|
|
49
|
+
}[];
|
|
50
|
+
port?: number | undefined;
|
|
51
|
+
domain?: string | undefined;
|
|
52
|
+
audience?: string | undefined;
|
|
53
|
+
clientID?: string | undefined;
|
|
54
|
+
clientSecret?: string | undefined;
|
|
55
|
+
rulesDirectory?: string | undefined;
|
|
56
|
+
auth0SessionCookieName?: string | undefined;
|
|
57
|
+
auth0CookieSecret?: string | undefined;
|
|
58
|
+
connection?: string | undefined;
|
|
59
|
+
cookieSecret?: string | undefined;
|
|
60
|
+
}>;
|
|
61
|
+
type ConfigSchema = z.infer<typeof configurationSchema>;
|
|
62
|
+
type ReadonlyFields = "audience" | "clientID" | "scope" | "port";
|
|
63
|
+
type Auth0Configuration = Required<Pick<ConfigSchema, ReadonlyFields>> & Omit<ConfigSchema, ReadonlyFields>;
|
|
64
|
+
//#endregion
|
|
65
|
+
export { Auth0Configuration };
|
|
66
|
+
//# sourceMappingURL=types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;cAEa,qBAAmB,CAAA,CAAA;;EAAnB,MAAA,eAAA,YA0BX,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA1B8B,QAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAAA,YAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EA4BpB,cAAA,CAAY,EAAA,MAAA,GAAkB,SAAA;EAErC,sBAAc,CAAA,EAAA,MAAA,GAAA,SAAA;EAeP,iBAAA,CAAA,EAAA,MAAkB,GAAA,SAAA;EAAiB,UAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAAc,YAAA,CAAA,EAAA,MAAA,GAAA,SAAA;CAAnB,EAAA;EAAT,KAAA,EAAA,MAAA,GAAA;IAC1B,QAAA,EAAA,MAAA;IAAc,KAAA,EAAA,MAAA;IAAnB,QAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAAI,CAAA,EAAA;;;;;;;;;;;;KAlBM,YAAA,GAAe,CAAA,CAAE,aAAa;KAErC,cAAA;KAeO,kBAAA,GAAqB,SAAS,KAAK,cAAc,mBAC3D,KAAK,cAAc"}
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
declare const configurationSchema: z.ZodObject<{
|
|
5
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
7
|
+
audience: z.ZodOptional<z.ZodString>;
|
|
8
|
+
clientID: z.ZodOptional<z.ZodString>;
|
|
9
|
+
scope: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodObject<{
|
|
10
|
+
clientID: z.ZodString;
|
|
11
|
+
audience: z.ZodOptional<z.ZodString>;
|
|
12
|
+
scope: z.ZodString;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
clientID: string;
|
|
15
|
+
scope: string;
|
|
16
|
+
audience?: string | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
clientID: string;
|
|
19
|
+
scope: string;
|
|
20
|
+
audience?: string | undefined;
|
|
21
|
+
}>, "many">]>;
|
|
22
|
+
clientSecret: z.ZodOptional<z.ZodString>;
|
|
23
|
+
rulesDirectory: z.ZodOptional<z.ZodString>;
|
|
24
|
+
auth0SessionCookieName: z.ZodOptional<z.ZodString>;
|
|
25
|
+
auth0CookieSecret: z.ZodOptional<z.ZodString>;
|
|
26
|
+
connection: z.ZodOptional<z.ZodString>;
|
|
27
|
+
cookieSecret: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
scope: string | {
|
|
30
|
+
clientID: string;
|
|
31
|
+
scope: string;
|
|
32
|
+
audience?: string | undefined;
|
|
33
|
+
}[];
|
|
34
|
+
port?: number | undefined;
|
|
35
|
+
domain?: string | undefined;
|
|
36
|
+
audience?: string | undefined;
|
|
37
|
+
clientID?: string | undefined;
|
|
38
|
+
clientSecret?: string | undefined;
|
|
39
|
+
rulesDirectory?: string | undefined;
|
|
40
|
+
auth0SessionCookieName?: string | undefined;
|
|
41
|
+
auth0CookieSecret?: string | undefined;
|
|
42
|
+
connection?: string | undefined;
|
|
43
|
+
cookieSecret?: string | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
scope: string | {
|
|
46
|
+
clientID: string;
|
|
47
|
+
scope: string;
|
|
48
|
+
audience?: string | undefined;
|
|
49
|
+
}[];
|
|
50
|
+
port?: number | undefined;
|
|
51
|
+
domain?: string | undefined;
|
|
52
|
+
audience?: string | undefined;
|
|
53
|
+
clientID?: string | undefined;
|
|
54
|
+
clientSecret?: string | undefined;
|
|
55
|
+
rulesDirectory?: string | undefined;
|
|
56
|
+
auth0SessionCookieName?: string | undefined;
|
|
57
|
+
auth0CookieSecret?: string | undefined;
|
|
58
|
+
connection?: string | undefined;
|
|
59
|
+
cookieSecret?: string | undefined;
|
|
60
|
+
}>;
|
|
61
|
+
type ConfigSchema = z.infer<typeof configurationSchema>;
|
|
62
|
+
type ReadonlyFields = "audience" | "clientID" | "scope" | "port";
|
|
63
|
+
type Auth0Configuration = Required<Pick<ConfigSchema, ReadonlyFields>> & Omit<ConfigSchema, ReadonlyFields>;
|
|
64
|
+
//#endregion
|
|
65
|
+
export { Auth0Configuration };
|
|
66
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;cAEa,qBAAmB,CAAA,CAAA;;EAAnB,MAAA,eAAA,YA0BX,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA1B8B,QAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAAA,YAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EA4BpB,cAAA,CAAY,EAAA,MAAA,GAAkB,SAAA;EAErC,sBAAc,CAAA,EAAA,MAAA,GAAA,SAAA;EAeP,iBAAA,CAAA,EAAA,MAAkB,GAAA,SAAA;EAAiB,UAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAAc,YAAA,CAAA,EAAA,MAAA,GAAA,SAAA;CAAnB,EAAA;EAAT,KAAA,EAAA,MAAA,GAAA;IAC1B,QAAA,EAAA,MAAA;IAAc,KAAA,EAAA,MAAA;IAAnB,QAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAAI,CAAA,EAAA;;;;;;;;;;;;KAlBM,YAAA,GAAe,CAAA,CAAE,aAAa;KAErC,cAAA;KAeO,kBAAA,GAAqB,SAAS,KAAK,cAAc,mBAC3D,KAAK,cAAc"}
|
package/dist/types.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/types.ts
|
|
4
|
+
const configurationSchema = z.object({
|
|
5
|
+
port: z.optional(z.number().gt(2999, "port must be greater than 2999").lt(1e4, "must be less than 10000")),
|
|
6
|
+
domain: z.optional(z.string().min(1, "domain is required")),
|
|
7
|
+
audience: z.optional(z.string().min(1, "audience is required")),
|
|
8
|
+
clientID: z.optional(z.string().max(32, "must be 32 characters long")),
|
|
9
|
+
scope: z.union([z.string().min(1, "scope is required"), z.array(z.object({
|
|
10
|
+
clientID: z.string().max(32, "must be 32 characters long"),
|
|
11
|
+
audience: z.optional(z.string().min(1, "audience is required")),
|
|
12
|
+
scope: z.string().min(1, "scope is required")
|
|
13
|
+
}))]),
|
|
14
|
+
clientSecret: z.optional(z.string()),
|
|
15
|
+
rulesDirectory: z.optional(z.string()),
|
|
16
|
+
auth0SessionCookieName: z.optional(z.string()),
|
|
17
|
+
auth0CookieSecret: z.optional(z.string()),
|
|
18
|
+
connection: z.optional(z.string()),
|
|
19
|
+
cookieSecret: z.optional(z.string())
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { configurationSchema };
|
|
24
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const configurationSchema = z.object({\n port: z.optional(\n z\n .number()\n .gt(2999, \"port must be greater than 2999\")\n .lt(10000, \"must be less than 10000\")\n ),\n domain: z.optional(z.string().min(1, \"domain is required\")),\n audience: z.optional(z.string().min(1, \"audience is required\")),\n clientID: z.optional(z.string().max(32, \"must be 32 characters long\")),\n scope: z.union([\n z.string().min(1, \"scope is required\"),\n z.array(\n z.object({\n clientID: z.string().max(32, \"must be 32 characters long\"),\n audience: z.optional(z.string().min(1, \"audience is required\")),\n scope: z.string().min(1, \"scope is required\"),\n })\n ),\n ]),\n clientSecret: z.optional(z.string()),\n rulesDirectory: z.optional(z.string()),\n auth0SessionCookieName: z.optional(z.string()),\n auth0CookieSecret: z.optional(z.string()),\n connection: z.optional(z.string()),\n cookieSecret: z.optional(z.string()),\n});\n\nexport type ConfigSchema = z.infer<typeof configurationSchema>;\n\ntype ReadonlyFields = \"audience\" | \"clientID\" | \"scope\" | \"port\";\n\n// grant_type list as defined by auth0\n// https://auth0.com/docs/get-started/applications/application-grant-types#spec-conforming-grants\nexport type GrantType =\n | \"password\"\n | \"client_credentials\"\n | \"authorization_code\"\n | \"refresh_token\"\n | \"http://auth0.com/oauth/grant-type/passwordless/otp\";\n\nexport type ScopeConfig =\n | string\n | { audience?: string | undefined; clientID: string; scope: string }[];\n\nexport type Auth0Configuration = Required<Pick<ConfigSchema, ReadonlyFields>> &\n Omit<ConfigSchema, ReadonlyFields>;\nexport type ResponseModes = \"query\" | \"web_message\";\n\nexport type QueryParams = {\n state: string;\n code: string;\n redirect_uri: string;\n code_challenge: string;\n scope: string;\n client_id: string;\n nonce: string;\n code_challenge_method: string;\n response_type: string;\n response_mode: ResponseModes;\n auth0Client: string;\n audience: string;\n};\n\nexport interface TokenSet {\n access_token?: string;\n token_type?: string;\n id_token?: string;\n refresh_token?: string;\n scope?: string;\n\n expires_at?: number;\n session_state?: string;\n\n [key: string]: unknown;\n}\n\nexport interface IdTokenData {\n alg: string;\n typ: string;\n iss: string;\n exp: number;\n iat: number;\n email: string;\n aud: string;\n sub: string;\n nonce?: string;\n}\n\nexport interface AccessTokenPayload {\n iss: string;\n sub: string;\n aud: string;\n iat: number;\n exp: number;\n scope: string;\n\n [key: string]: string | number | string[];\n}\n\nexport interface RefreshToken {\n iat: number;\n exp: number;\n rotations?: number;\n scope: string;\n sessionUid?: string;\n user: { id: string };\n nonce?: string | undefined;\n}\n\ntype Token<P> = {\n payload: P;\n};\n\nexport type IdToken = Token<IdTokenData>;\n\nexport type AccessToken = Token<AccessTokenPayload>;\n"],"mappings":";;;AAEA,MAAa,sBAAsB,EAAE,OAAO;CAC1C,MAAM,EAAE,SACN,EACG,QAAQ,CACR,GAAG,MAAM,iCAAiC,CAC1C,GAAG,KAAO,0BAA0B,CACxC;CACD,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,IAAI,GAAG,qBAAqB,CAAC;CAC3D,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,IAAI,GAAG,uBAAuB,CAAC;CAC/D,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,IAAI,IAAI,6BAA6B,CAAC;CACtE,OAAO,EAAE,MAAM,CACb,EAAE,QAAQ,CAAC,IAAI,GAAG,oBAAoB,EACtC,EAAE,MACA,EAAE,OAAO;EACP,UAAU,EAAE,QAAQ,CAAC,IAAI,IAAI,6BAA6B;EAC1D,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,IAAI,GAAG,uBAAuB,CAAC;EAC/D,OAAO,EAAE,QAAQ,CAAC,IAAI,GAAG,oBAAoB;EAC9C,CAAC,CACH,CACF,CAAC;CACF,cAAc,EAAE,SAAS,EAAE,QAAQ,CAAC;CACpC,gBAAgB,EAAE,SAAS,EAAE,QAAQ,CAAC;CACtC,wBAAwB,EAAE,SAAS,EAAE,QAAQ,CAAC;CAC9C,mBAAmB,EAAE,SAAS,EAAE,QAAQ,CAAC;CACzC,YAAY,EAAE,SAAS,EAAE,QAAQ,CAAC;CAClC,cAAc,EAAE,SAAS,EAAE,QAAQ,CAAC;CACrC,CAAC"}
|