@simulacrum/auth0-simulator 0.5.1 → 0.6.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.
- package/CHANGELOG.md +5 -0
- package/dist/config/get-config.d.ts +8 -0
- package/dist/config/get-config.d.ts.map +1 -0
- package/dist/config/get-config.js +48 -0
- package/dist/config/get-config.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/start.js +53 -25
- package/dist/start.js.map +1 -1
- package/dist/types.d.ts +43 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## \[0.6.0]
|
|
4
|
+
|
|
5
|
+
- Add cosmiconfig and zod to @simulacrum/auth0-simulator
|
|
6
|
+
- [3dfacdc](https://github.com/thefrontside/simulacrum/commit/3dfacdcf84ca55a7f965dd297675245efb794f69) Add Cosmiconfig and zod to @simulacrum/auth0-config ([#190](https://github.com/thefrontside/simulacrum/pull/190)) on 2022-04-01
|
|
7
|
+
|
|
3
8
|
## \[0.5.1]
|
|
4
9
|
|
|
5
10
|
- Make the iat field epoch time.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { cosmiconfigSync } from 'cosmiconfig';
|
|
2
|
+
import type { Auth0Configuration, Options, Schema } from '../types';
|
|
3
|
+
export declare const DefaultArgs: Schema;
|
|
4
|
+
declare type Explorer = ReturnType<typeof cosmiconfigSync>;
|
|
5
|
+
export declare function getConfigCreator(explorer: Explorer): (options?: Options | undefined) => Auth0Configuration;
|
|
6
|
+
export declare const getConfig: (options?: Options | undefined) => Auth0Configuration;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=get-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-config.d.ts","sourceRoot":"","sources":["../../src/config/get-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAkBpE,eAAO,MAAM,WAAW,EAAE,MAIzB,CAAC;AAEF,aAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAkBnD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,sCACH,kBAAkB,CAgBjE;AAID,eAAO,MAAM,SAAS,qCApB0B,kBAoBG,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getConfig = exports.getConfigCreator = exports.DefaultArgs = void 0;
|
|
4
|
+
const cosmiconfig_1 = require("cosmiconfig");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
function omit(obj, ...keys) {
|
|
7
|
+
let copy = {};
|
|
8
|
+
let remaining = Object.keys(obj)
|
|
9
|
+
.flatMap(c => keys.includes(c) === false ? [c] : []);
|
|
10
|
+
for (let k of remaining) {
|
|
11
|
+
copy[k] = obj[k];
|
|
12
|
+
}
|
|
13
|
+
return copy;
|
|
14
|
+
}
|
|
15
|
+
const DefaultAuth0Port = 4400;
|
|
16
|
+
exports.DefaultArgs = {
|
|
17
|
+
clientID: '00000000000000000000000000000000',
|
|
18
|
+
audience: 'https://thefrontside.auth0.com/api/v1/',
|
|
19
|
+
scope: "openid profile email offline_access",
|
|
20
|
+
};
|
|
21
|
+
function getPort({ domain, port }) {
|
|
22
|
+
if (typeof port === 'number') {
|
|
23
|
+
return port;
|
|
24
|
+
}
|
|
25
|
+
if (domain) {
|
|
26
|
+
if (domain.split(':').length === 2) {
|
|
27
|
+
return parseInt(domain.split(':')[1]);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return DefaultAuth0Port;
|
|
31
|
+
}
|
|
32
|
+
// This higher order function would only be used for testing and
|
|
33
|
+
// allows different cosmiconfig instances to be used for testing
|
|
34
|
+
function getConfigCreator(explorer) {
|
|
35
|
+
return function getConfig(options) {
|
|
36
|
+
let searchResult = explorer.search();
|
|
37
|
+
let config = searchResult === null ? exports.DefaultArgs : searchResult.config;
|
|
38
|
+
let strippedOptions = !!options ? omit(options, 'store', 'services') : {};
|
|
39
|
+
let configuration = { ...exports.DefaultArgs, ...config, ...strippedOptions };
|
|
40
|
+
configuration.port = getPort(configuration);
|
|
41
|
+
types_1.configurationSchema.parse(configuration);
|
|
42
|
+
return configuration;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
exports.getConfigCreator = getConfigCreator;
|
|
46
|
+
const explorer = (0, cosmiconfig_1.cosmiconfigSync)("auth0Simulator");
|
|
47
|
+
exports.getConfig = getConfigCreator(explorer);
|
|
48
|
+
//# sourceMappingURL=get-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-config.js","sourceRoot":"","sources":["../../src/config/get-config.ts"],"names":[],"mappings":";;;AAAA,6CAA8C;AAE9C,oCAA+C;AAE/C,SAAS,IAAI,CAAuB,GAAM,EAAE,GAAG,IAAS;IACtD,IAAI,IAAI,GAAG,EAAO,CAAC;IAEnB,IAAI,SAAS,GAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAS;SACpB,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAEzE,KAAI,IAAI,CAAC,IAAI,SAAS,EAAE;QACtB,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;KAClB;IAED,OAAO,IAAI,CAAC;AAC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Q,GAAG,IAAA,6BAAe,EAAC,gBAAgB,CAAC,CAAC;AAEtC,QAAA,SAAS,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAwB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAwB,MAAM,oBAAoB,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAcvC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAqChD,eAAO,MAAM,KAAK,EAAE,SAAS,CAAC,OAAO,CA0BpC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.auth0 = void 0;
|
|
6
|
+
exports.auth0 = exports.getConfig = void 0;
|
|
7
7
|
const server_1 = require("@simulacrum/server");
|
|
8
8
|
const server_2 = require("@simulacrum/server");
|
|
9
9
|
const express_1 = require("express");
|
|
@@ -15,13 +15,11 @@ const express_2 = __importDefault(require("express"));
|
|
|
15
15
|
const create_cors_1 = require("./middleware/create-cors");
|
|
16
16
|
const no_cache_1 = require("./middleware/no-cache");
|
|
17
17
|
const openid_handlers_1 = require("./handlers/openid-handlers");
|
|
18
|
+
const get_config_1 = require("./config/get-config");
|
|
19
|
+
var get_config_2 = require("./config/get-config");
|
|
20
|
+
Object.defineProperty(exports, "getConfig", { enumerable: true, get: function () { return get_config_2.getConfig; } });
|
|
18
21
|
const publicDir = path_1.default.join(__dirname, 'views', 'public');
|
|
19
|
-
const
|
|
20
|
-
clientID: '00000000000000000000000000000000',
|
|
21
|
-
audience: 'https://thefrontside.auth0.com/api/v1/',
|
|
22
|
-
scope: "openid profile email offline_access",
|
|
23
|
-
};
|
|
24
|
-
const createAuth0Service = (handlers, debug) => {
|
|
22
|
+
const createAuth0Service = (handlers, { port, debug }) => {
|
|
25
23
|
let app = (0, server_2.createHttpApp)()
|
|
26
24
|
.use(express_2.default.static(publicDir))
|
|
27
25
|
.use((0, session_1.createSession)())
|
|
@@ -45,18 +43,21 @@ const createAuth0Service = (handlers, debug) => {
|
|
|
45
43
|
}
|
|
46
44
|
return {
|
|
47
45
|
protocol: 'https',
|
|
48
|
-
app
|
|
46
|
+
app,
|
|
47
|
+
port
|
|
49
48
|
};
|
|
50
49
|
};
|
|
51
50
|
const auth0 = (slice, options) => {
|
|
52
51
|
let store = slice.slice('store');
|
|
53
52
|
let services = slice.slice('services');
|
|
54
53
|
let debug = !!slice.slice('debug').get();
|
|
55
|
-
let
|
|
54
|
+
let config = (0, get_config_1.getConfig)(options);
|
|
55
|
+
let handlersOptions = { ...config, store, services };
|
|
56
56
|
let auth0Handlers = (0, auth0_handlers_1.createAuth0Handlers)(handlersOptions);
|
|
57
57
|
let openIdHandlers = (0, openid_handlers_1.createOpenIdHandlers)(handlersOptions);
|
|
58
|
+
let serviceOptions = { debug, port: config.port };
|
|
58
59
|
return {
|
|
59
|
-
services: { auth0: createAuth0Service({ ...auth0Handlers, ...openIdHandlers },
|
|
60
|
+
services: { auth0: createAuth0Service({ ...auth0Handlers, ...openIdHandlers }, serviceOptions) },
|
|
60
61
|
scenarios: {
|
|
61
62
|
/**
|
|
62
63
|
* Here we just export the internal `person` scenario so that it can be
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";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cAAc,EAAE,EAAE,cAAc,CAAC,EAAE;QAChG,SAAS,EAAE;YACT;;;;;eAKG;YACH,MAAM,EAAN,eAAM;SACP;KACF,CAAC;AACJ,CAAC,CAAC;AA1BW,QAAA,KAAK,SA0BhB"}
|
package/dist/start.js
CHANGED
|
@@ -2,12 +2,33 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
+
var _a, _b;
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
7
|
const effection_1 = require("effection");
|
|
7
8
|
const server_1 = require("@simulacrum/server");
|
|
8
9
|
const _1 = require(".");
|
|
9
10
|
const dedent_1 = __importDefault(require("dedent"));
|
|
11
|
+
const client_1 = require("@simulacrum/client");
|
|
10
12
|
const port = process.env.PORT ? parseInt(process.env.PORT) : undefined;
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
const isStandAlone = args.indexOf('--standalone') >= 0;
|
|
15
|
+
const userName = (_a = args.find(arg => arg.startsWith('--username='))) === null || _a === void 0 ? void 0 : _a.split('=')[1];
|
|
16
|
+
const password = (_b = args.find(arg => arg.startsWith('--password='))) === null || _b === void 0 ? void 0 : _b.split('=')[1];
|
|
17
|
+
function* startInStandAloneMode(url) {
|
|
18
|
+
let client = (0, client_1.createClient)(url);
|
|
19
|
+
try {
|
|
20
|
+
let simulation = yield client.createSimulation("auth0");
|
|
21
|
+
let person = yield client.given(simulation, "person", {
|
|
22
|
+
email: userName,
|
|
23
|
+
password
|
|
24
|
+
});
|
|
25
|
+
console.log(`store populated with user`);
|
|
26
|
+
console.log(`username = ${person.data.email} password = ${person.data.password}`);
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
client.dispose();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
11
32
|
(0, effection_1.main)(function* () {
|
|
12
33
|
let server = yield (0, server_1.createSimulationServer)({
|
|
13
34
|
debug: true,
|
|
@@ -16,34 +37,41 @@ const port = process.env.PORT ? parseInt(process.env.PORT) : undefined;
|
|
|
16
37
|
simulators: { auth0: _1.auth0 }
|
|
17
38
|
});
|
|
18
39
|
let url = `http://localhost:${server.address.port}`;
|
|
19
|
-
console.log(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
console.log(`Started Simulacrum simulation server on ${url}.`);
|
|
41
|
+
if (isStandAlone) {
|
|
42
|
+
console.log('starting in standalone mode');
|
|
43
|
+
yield startInStandAloneMode(url);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
console.log((0, dedent_1.default) `
|
|
47
|
+
GraphiQL interface is running on ${url}/graphql.
|
|
48
|
+
|
|
49
|
+
To start auth0 simulator send the following mutation to GraphQL server.
|
|
50
|
+
|
|
51
|
+
mutation CreateSimulation {
|
|
52
|
+
createSimulation(simulator: "auth0",
|
|
53
|
+
options: {
|
|
54
|
+
options:{
|
|
55
|
+
audience: "[your audience]",
|
|
56
|
+
scope: "[your scope]",
|
|
57
|
+
clientID: "[your client-id]"
|
|
58
|
+
},
|
|
59
|
+
services:{
|
|
60
|
+
auth0:{
|
|
61
|
+
port: 4400
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}) {
|
|
65
|
+
id
|
|
66
|
+
status
|
|
67
|
+
services {
|
|
68
|
+
url
|
|
69
|
+
name
|
|
35
70
|
}
|
|
36
71
|
}
|
|
37
|
-
}) {
|
|
38
|
-
id
|
|
39
|
-
status
|
|
40
|
-
services {
|
|
41
|
-
url
|
|
42
|
-
name
|
|
43
|
-
}
|
|
44
72
|
}
|
|
45
|
-
|
|
46
|
-
|
|
73
|
+
`);
|
|
74
|
+
}
|
|
47
75
|
yield;
|
|
48
76
|
});
|
|
49
77
|
//# sourceMappingURL=start.js.map
|
package/dist/start.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAiC;AAEjC,+CAA4D;AAC5D,wBAA0B;AAC1B,oDAA4B;AAE5B,+CAAkD;AAElD,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAEvE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEnC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AACvD,MAAM,QAAQ,GAAG,MAAA,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,0CAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAChF,MAAM,QAAQ,GAAG,MAAA,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,0CAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAEhF,QAAS,CAAC,CAAC,qBAAqB,CAAC,GAAW;IAC1C,IAAI,MAAM,GAAG,IAAA,qBAAY,EAAC,GAAG,CAAC,CAAC;IAE/B,IAAI;QACF,IAAI,UAAU,GAAe,MAAM,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAEpE,IAAI,MAAM,GAAqB,MAAM,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,QAAQ,EAAE;YACtE,KAAK,EAAE,QAAQ;YACf,QAAQ;SACT,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;QACzC,OAAO,CAAC,GAAG,CAAC,cAAc,MAAM,CAAC,IAAI,CAAC,KAAK,eAAe,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;KACnF;YAAS;QACR,MAAM,CAAC,OAAO,EAAE,CAAC;KAClB;AACH,CAAC;AAED,IAAA,gBAAI,EAAC,QAAQ,CAAC;IACZ,IAAI,MAAM,GAAW,MAAM,IAAA,+BAAsB,EAAC;QAChD,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,CAAC;QACP,IAAI;QACJ,UAAU,EAAE,EAAE,KAAK,EAAL,QAAK,EAAE;KACtB,CAAC,CAAC;IAEH,IAAI,GAAG,GAAG,oBAAoB,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IAEpD,OAAO,CAAC,GAAG,CAAC,2CAA2C,GAAG,GAAG,CAAC,CAAC;IAE/D,IAAG,YAAY,EAAE;QACf,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;QAE3C,MAAM,qBAAqB,CAAC,GAAG,CAAC,CAAC;KAClC;SAAM;QACL,OAAO,CAAC,GAAG,CAAC,IAAA,gBAAM,EAAA;uCACiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;IA0BtC,CAAC,CAAC;KACH;IAED,KAAK,CAAC;AACR,CAAC,CAAC,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,14 +1,50 @@
|
|
|
1
1
|
import type { SimulationState, Store } from '@simulacrum/server';
|
|
2
2
|
import type { Slice } from '@effection/atom';
|
|
3
|
-
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export 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.ZodString;
|
|
10
|
+
clientSecret: z.ZodOptional<z.ZodString>;
|
|
11
|
+
rulesDirectory: z.ZodOptional<z.ZodString>;
|
|
12
|
+
auth0SessionCookieName: z.ZodOptional<z.ZodString>;
|
|
13
|
+
auth0CookieSecret: z.ZodOptional<z.ZodString>;
|
|
14
|
+
connection: z.ZodOptional<z.ZodString>;
|
|
15
|
+
cookieSecret: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
port?: number | undefined;
|
|
18
|
+
domain?: string | undefined;
|
|
19
|
+
audience?: string | undefined;
|
|
20
|
+
clientID?: string | undefined;
|
|
21
|
+
clientSecret?: string | undefined;
|
|
22
|
+
rulesDirectory?: string | undefined;
|
|
23
|
+
auth0SessionCookieName?: string | undefined;
|
|
24
|
+
auth0CookieSecret?: string | undefined;
|
|
25
|
+
connection?: string | undefined;
|
|
26
|
+
cookieSecret?: string | undefined;
|
|
4
27
|
scope: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
28
|
+
}, {
|
|
29
|
+
port?: number | undefined;
|
|
30
|
+
domain?: string | undefined;
|
|
31
|
+
audience?: string | undefined;
|
|
32
|
+
clientID?: string | undefined;
|
|
33
|
+
clientSecret?: string | undefined;
|
|
34
|
+
rulesDirectory?: string | undefined;
|
|
35
|
+
auth0SessionCookieName?: string | undefined;
|
|
36
|
+
auth0CookieSecret?: string | undefined;
|
|
37
|
+
connection?: string | undefined;
|
|
38
|
+
cookieSecret?: string | undefined;
|
|
39
|
+
scope: string;
|
|
40
|
+
}>;
|
|
41
|
+
export declare type Schema = z.infer<typeof configurationSchema>;
|
|
42
|
+
declare type ReadonlyFields = 'audience' | 'clientID' | 'scope' | 'port';
|
|
43
|
+
export declare type Auth0Configuration = Required<Pick<Schema, ReadonlyFields>> & Omit<Schema, ReadonlyFields>;
|
|
44
|
+
export declare type Options = Auth0Configuration & {
|
|
8
45
|
store: Store;
|
|
9
46
|
services: Slice<SimulationState['services']>;
|
|
10
|
-
|
|
11
|
-
}
|
|
47
|
+
};
|
|
12
48
|
export declare type ResponseModes = 'query' | 'web_message';
|
|
13
49
|
export declare type QueryParams = {
|
|
14
50
|
state: string;
|
|
@@ -60,4 +96,5 @@ export interface IdToken {
|
|
|
60
96
|
export interface AccessToken {
|
|
61
97
|
payload: AccessTokenPayload;
|
|
62
98
|
}
|
|
99
|
+
export {};
|
|
63
100
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY9B,CAAC;AAEH,oBAAY,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEzD,aAAK,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;AAEjE,oBAAY,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,GACpC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAEhE,oBAAY,OAAO,GA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,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IAEd,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,kBAAkB,CAAC;CAC7B"}
|
package/dist/types.js
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configurationSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// TODO: better validation
|
|
6
|
+
exports.configurationSchema = zod_1.z.object({
|
|
7
|
+
port: zod_1.z.optional(zod_1.z.number().gt(2999, "port must be greater than 2999").lt(10000, "must be less than 10000")),
|
|
8
|
+
domain: zod_1.z.optional(zod_1.z.string().min(1, 'domain is required')),
|
|
9
|
+
audience: zod_1.z.optional(zod_1.z.string().min(1, "audience is required")),
|
|
10
|
+
clientID: zod_1.z.optional(zod_1.z.string().max(32, "must be 32 characters long")),
|
|
11
|
+
scope: zod_1.z.string().min(1, "scope is required"),
|
|
12
|
+
clientSecret: zod_1.z.optional(zod_1.z.string()),
|
|
13
|
+
rulesDirectory: zod_1.z.optional(zod_1.z.string()),
|
|
14
|
+
auth0SessionCookieName: zod_1.z.optional(zod_1.z.string()),
|
|
15
|
+
auth0CookieSecret: zod_1.z.optional(zod_1.z.string()),
|
|
16
|
+
connection: zod_1.z.optional(zod_1.z.string()),
|
|
17
|
+
cookieSecret: zod_1.z.optional(zod_1.z.string()),
|
|
18
|
+
});
|
|
3
19
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAEA,6BAAwB;AAExB,0BAA0B;AACb,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,OAAC,CAAC,QAAQ,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,gCAAgC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,yBAAyB,CAAC,CAAC;IAC5G,MAAM,EAAE,OAAC,CAAC,QAAQ,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC;IAC3D,QAAQ,EAAG,OAAC,CAAC,QAAQ,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC;IAChE,QAAQ,EAAE,OAAC,CAAC,QAAQ,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,4BAA4B,CAAC,CAAC;IACtE,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC;IAC7C,YAAY,EAAE,OAAC,CAAC,QAAQ,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;IACpC,cAAc,EAAE,OAAC,CAAC,QAAQ,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;IACtC,sBAAsB,EAAE,OAAC,CAAC,QAAQ,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;IAC9C,iBAAiB,EAAE,OAAC,CAAC,QAAQ,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;IACzC,UAAU,EAAE,OAAC,CAAC,QAAQ,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;IAClC,YAAY,EAAE,OAAC,CAAC,QAAQ,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;CACrC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simulacrum/auth0-simulator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Run local instance of Auth0 API for local development and integration testing",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": "bin/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"homepage": "https://github.com/thefrontside/simulacrum#readme",
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@effection/process": "^2.0.1",
|
|
42
|
-
"@simulacrum/server": "0.
|
|
42
|
+
"@simulacrum/server": "0.6.0",
|
|
43
43
|
"@types/faker": "^5.1.7",
|
|
44
44
|
"assert-ts": "^0.3.2",
|
|
45
45
|
"base64-url": "^2.3.3",
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
"effection": "^2.0.1",
|
|
49
49
|
"html-entities": "^2.3.2",
|
|
50
50
|
"jsesc": "^3.0.2",
|
|
51
|
-
"jsonwebtoken": "^8.5.1"
|
|
51
|
+
"jsonwebtoken": "^8.5.1",
|
|
52
|
+
"zod": "^3.14.2"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@effection/atom": "^2.0.1",
|