@atlasauth/emulator 0.0.0-stage → 0.1.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 +9 -0
- package/Dockerfile +9 -0
- package/README.md +18 -2
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +20 -0
- package/dist/bin.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +36 -0
- package/dist/server.js +142 -0
- package/dist/server.js.map +1 -0
- package/package.json +38 -3
package/CHANGELOG.md
ADDED
package/Dockerfile
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# docker build -t atlas-emulator -f packages/emulator/Dockerfile packages/emulator
|
|
2
|
+
# (after `pnpm --filter @atlasauth/emulator build`). Mount a seed file and pass --seed.
|
|
3
|
+
FROM node:22-alpine
|
|
4
|
+
WORKDIR /app
|
|
5
|
+
COPY dist ./dist
|
|
6
|
+
COPY package.json ./
|
|
7
|
+
RUN npm install --omit=dev --ignore-scripts
|
|
8
|
+
EXPOSE 4400
|
|
9
|
+
ENTRYPOINT ["node", "dist/bin.js", "--host", "0.0.0.0"]
|
package/README.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @atlasauth/emulator
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A local, in-memory Atlas for development and CI. No account, no network.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npx @atlasauth/emulator --port 4400 --seed seed.json # or: atlas dev
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
- **FAPI + minimal BAPI** (users, orgs, sessions, sign-in/up) backed by [`@atlasauth/msw`](../msw) state; point `NEXT_PUBLIC_ATLAS_FAPI_URL` / your SDK base URL at the printed origin.
|
|
10
|
+
- **Deterministic codes**: every email/SMS code is `424242` (`seed.instance.testOtp` overrides).
|
|
11
|
+
- **Mail and SMS catcher**: `/__emulator/mail` (UI) and `/__emulator/mail.json`.
|
|
12
|
+
- **OIDC discovery** at `/.well-known/openid-configuration`, JWKS at `/.well-known/jwks.json`.
|
|
13
|
+
- **One origin**: `--app http://localhost:3000` forwards everything the emulator does not own to your app. `atlas dev proxy --app <url> --api <fapi url>` does the same against a real instance.
|
|
14
|
+
- `POST /__emulator/reset` clears state.
|
|
15
|
+
- Docker: see `Dockerfile`.
|
|
16
|
+
|
|
17
|
+
`seed.json` is `{ "users": [{ "email": "ada@example.com", "password": "pw" }], "organizations": [] }`.
|
|
18
|
+
|
|
19
|
+
Limits: the emulator does not sign real tokens, run social/SAML flows or proxy WebSocket upgrades.
|
package/dist/bin.d.ts
ADDED
package/dist/bin.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_util_1 = require("node:util");
|
|
6
|
+
const server_1 = require("./server");
|
|
7
|
+
const { values } = (0, node_util_1.parseArgs)({ options: { port: { type: 'string' }, host: { type: 'string' }, seed: { type: 'string' }, app: { type: 'string' } } });
|
|
8
|
+
async function main() {
|
|
9
|
+
const emulator = await (0, server_1.startEmulator)({
|
|
10
|
+
port: values.port ? Number(values.port) : 4400,
|
|
11
|
+
host: values.host,
|
|
12
|
+
app: values.app,
|
|
13
|
+
seed: values.seed ? JSON.parse((0, node_fs_1.readFileSync)(values.seed, 'utf8')) : undefined,
|
|
14
|
+
});
|
|
15
|
+
console.log(`Atlas emulator on ${emulator.url} (mail catcher: ${emulator.url}/__emulator/mail)`);
|
|
16
|
+
process.once('SIGINT', () => void emulator.close().then(() => process.exit(0)));
|
|
17
|
+
process.once('SIGTERM', () => void emulator.close().then(() => process.exit(0)));
|
|
18
|
+
}
|
|
19
|
+
void main();
|
|
20
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADD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K,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACnF,CAAC;AAED,KAAK,IAAI,EAAE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { startEmulator, startProxy, type CaughtMessage, type Emulator, type EmulatorOptions, type ProxyOptions } from './server';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startProxy = exports.startEmulator = void 0;
|
|
4
|
+
var server_1 = require("./server");
|
|
5
|
+
Object.defineProperty(exports, "startEmulator", { enumerable: true, get: function () { return server_1.startEmulator; } });
|
|
6
|
+
Object.defineProperty(exports, "startProxy", { enumerable: true, get: function () { return server_1.startProxy; } });
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAAiI;AAAxH,uGAAA,aAAa,OAAA;AAAE,oGAAA,UAAU,OAAA"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type AtlasMock, type AtlasMockSeed } from '@atlasauth/msw';
|
|
2
|
+
export interface CaughtMessage {
|
|
3
|
+
id: number;
|
|
4
|
+
at: string;
|
|
5
|
+
channel: 'email' | 'sms';
|
|
6
|
+
to: string;
|
|
7
|
+
strategy: string;
|
|
8
|
+
code: string;
|
|
9
|
+
}
|
|
10
|
+
export interface EmulatorOptions {
|
|
11
|
+
port?: number;
|
|
12
|
+
host?: string;
|
|
13
|
+
seed?: AtlasMockSeed;
|
|
14
|
+
/** Proxy every path the emulator does not own to this app URL (one origin). */
|
|
15
|
+
app?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface Emulator {
|
|
18
|
+
url: string;
|
|
19
|
+
mock: AtlasMock;
|
|
20
|
+
mail: CaughtMessage[];
|
|
21
|
+
close(): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
export declare function startEmulator(options?: EmulatorOptions): Promise<Emulator>;
|
|
24
|
+
export interface ProxyOptions {
|
|
25
|
+
port?: number;
|
|
26
|
+
host?: string;
|
|
27
|
+
/** Your app (e.g. http://localhost:3000). */
|
|
28
|
+
app: string;
|
|
29
|
+
/** The Atlas Frontend API to forward `/v1/*` and `/.well-known/*` to. */
|
|
30
|
+
api: string;
|
|
31
|
+
}
|
|
32
|
+
/** `atlas dev proxy`: one origin for the app and FAPI, so session cookies are first-party. */
|
|
33
|
+
export declare function startProxy(options: ProxyOptions): Promise<{
|
|
34
|
+
url: string;
|
|
35
|
+
close(): Promise<void>;
|
|
36
|
+
}>;
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startEmulator = startEmulator;
|
|
4
|
+
exports.startProxy = startProxy;
|
|
5
|
+
/**
|
|
6
|
+
* The emulator: `@atlasauth/msw`'s in-memory FAPI/BAPI behind a real HTTP
|
|
7
|
+
* listener, plus OIDC discovery, a mail/SMS catcher and an optional one-origin
|
|
8
|
+
* proxy to your app (`app`), so cookies and CORS behave like production.
|
|
9
|
+
*/
|
|
10
|
+
const node_http_1 = require("node:http");
|
|
11
|
+
const msw_1 = require("msw");
|
|
12
|
+
const msw_2 = require("@atlasauth/msw");
|
|
13
|
+
const HOP = new Set(['connection', 'keep-alive', 'transfer-encoding', 'upgrade', 'host', 'content-length']);
|
|
14
|
+
const esc = (s) => s.replace(/[&<>"]/g, (c) => `&#${c.charCodeAt(0)};`);
|
|
15
|
+
async function toRequest(req, origin) {
|
|
16
|
+
const chunks = [];
|
|
17
|
+
for await (const c of req)
|
|
18
|
+
chunks.push(c);
|
|
19
|
+
const body = chunks.length ? Buffer.concat(chunks) : undefined;
|
|
20
|
+
const headers = new Headers();
|
|
21
|
+
for (const [k, v] of Object.entries(req.headers))
|
|
22
|
+
if (v !== undefined)
|
|
23
|
+
headers.set(k, Array.isArray(v) ? v.join(', ') : v);
|
|
24
|
+
const method = req.method ?? 'GET';
|
|
25
|
+
return new Request(new URL(req.url ?? '/', origin), { method, headers, body: method === 'GET' || method === 'HEAD' ? undefined : body });
|
|
26
|
+
}
|
|
27
|
+
async function send(res, r) {
|
|
28
|
+
const headers = {};
|
|
29
|
+
r.headers.forEach((v, k) => {
|
|
30
|
+
if (!HOP.has(k) && k !== 'set-cookie')
|
|
31
|
+
headers[k] = v;
|
|
32
|
+
});
|
|
33
|
+
const cookies = r.headers.getSetCookie();
|
|
34
|
+
if (cookies.length)
|
|
35
|
+
headers['set-cookie'] = cookies;
|
|
36
|
+
res.writeHead(r.status, headers);
|
|
37
|
+
res.end(Buffer.from(await r.arrayBuffer()));
|
|
38
|
+
}
|
|
39
|
+
/** shortcut: no WebSocket upgrade proxying (framework HMR sockets), add when a dev server needs it. */
|
|
40
|
+
async function proxy(app, request) {
|
|
41
|
+
const url = new URL(request.url);
|
|
42
|
+
const target = new URL(url.pathname + url.search, app);
|
|
43
|
+
const headers = new Headers(request.headers);
|
|
44
|
+
headers.set('x-forwarded-host', url.host);
|
|
45
|
+
headers.delete('host');
|
|
46
|
+
try {
|
|
47
|
+
return await fetch(target, { method: request.method, headers, body: request.body, redirect: 'manual', duplex: 'half' });
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
return new Response(`Atlas emulator could not reach ${app}: ${err.message}`, { status: 502 });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async function startEmulator(options = {}) {
|
|
54
|
+
const host = options.host ?? '127.0.0.1';
|
|
55
|
+
const mail = [];
|
|
56
|
+
const seen = new Set();
|
|
57
|
+
let origin = '';
|
|
58
|
+
// eslint-disable-next-line prefer-const -- assigned once below, but `harvest` closes over it before that point
|
|
59
|
+
let mock;
|
|
60
|
+
let handlers = [];
|
|
61
|
+
// The handlers mount on absolute URLs, so they are built once the port is known.
|
|
62
|
+
const harvest = () => {
|
|
63
|
+
for (const a of mock.attempts) {
|
|
64
|
+
if (!a.pendingCode || !a.identifier)
|
|
65
|
+
continue;
|
|
66
|
+
const key = `${a.id}:${a.strategy}:${a.pendingCode}`;
|
|
67
|
+
if (seen.has(key))
|
|
68
|
+
continue;
|
|
69
|
+
seen.add(key);
|
|
70
|
+
const sms = a.strategy === 'phone_code';
|
|
71
|
+
mail.push({ id: mail.length + 1, at: new Date().toISOString(), channel: sms ? 'sms' : 'email', to: a.identifier, strategy: a.strategy ?? 'verification', code: a.pendingCode });
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const own = async (request) => {
|
|
75
|
+
const { pathname } = new URL(request.url);
|
|
76
|
+
if (pathname === '/.well-known/openid-configuration') {
|
|
77
|
+
return Response.json({
|
|
78
|
+
issuer: origin,
|
|
79
|
+
jwks_uri: `${origin}/.well-known/jwks.json`,
|
|
80
|
+
authorization_endpoint: `${origin}/oauth2/authorize`,
|
|
81
|
+
token_endpoint: `${origin}/oauth2/token`,
|
|
82
|
+
userinfo_endpoint: `${origin}/oauth2/userinfo`,
|
|
83
|
+
response_types_supported: ['code'],
|
|
84
|
+
subject_types_supported: ['public'],
|
|
85
|
+
id_token_signing_alg_values_supported: ['RS256'],
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (pathname === '/__emulator/mail.json')
|
|
89
|
+
return Response.json({ data: mail });
|
|
90
|
+
if (pathname === '/__emulator/mail') {
|
|
91
|
+
const rows = [...mail].reverse().map((m) => `<tr><td>${esc(m.at)}</td><td>${m.channel}</td><td>${esc(m.to)}</td><td>${esc(m.strategy)}</td><td><code>${esc(m.code)}</code></td></tr>`).join('');
|
|
92
|
+
return new Response(`<!doctype html><meta charset="utf-8"><title>Atlas emulator mail</title><h1>Caught messages</h1><table border="1" cellpadding="6"><tr><th>time</th><th>channel</th><th>to</th><th>strategy</th><th>code</th></tr>${rows || '<tr><td colspan="5">Nothing yet.</td></tr>'}</table>`, { headers: { 'content-type': 'text/html; charset=utf-8' } });
|
|
93
|
+
}
|
|
94
|
+
if (pathname === '/__emulator/reset' && request.method === 'POST') {
|
|
95
|
+
mock.reset();
|
|
96
|
+
mail.length = 0;
|
|
97
|
+
seen.clear();
|
|
98
|
+
return Response.json({ ok: true });
|
|
99
|
+
}
|
|
100
|
+
const res = await (0, msw_1.getResponse)(handlers, request);
|
|
101
|
+
if (res)
|
|
102
|
+
harvest();
|
|
103
|
+
return res ?? null;
|
|
104
|
+
};
|
|
105
|
+
const server = (0, node_http_1.createServer)((req, res) => {
|
|
106
|
+
void (async () => {
|
|
107
|
+
const request = await toRequest(req, origin);
|
|
108
|
+
const r = (await own(request)) ?? (options.app ? await proxy(options.app, request) : Response.json({ error: { code: 'NOT_FOUND', message: 'Not served by the emulator.' } }, { status: 404 }));
|
|
109
|
+
await send(res, r);
|
|
110
|
+
})().catch((err) => {
|
|
111
|
+
res.writeHead(500, { 'content-type': 'application/json' });
|
|
112
|
+
res.end(JSON.stringify({ error: { code: 'EMULATOR_ERROR', message: String(err.message) } }));
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
await new Promise((ok) => server.listen(options.port ?? 0, host, ok));
|
|
116
|
+
const addr = server.address();
|
|
117
|
+
const port = typeof addr === 'object' && addr ? addr.port : (options.port ?? 0);
|
|
118
|
+
origin = `http://${host === '0.0.0.0' ? 'localhost' : host}:${port}`;
|
|
119
|
+
const seed = options.seed ?? {};
|
|
120
|
+
mock = (0, msw_2.createAtlasMock)({ ...seed, instance: { ...seed.instance, fapiBaseUrl: origin, bapiBaseUrl: origin } });
|
|
121
|
+
handlers = (0, msw_2.atlasHandlers)(mock);
|
|
122
|
+
return { url: origin, mock, mail, close: () => new Promise((ok) => (server.closeAllConnections(), server.close(() => ok()))) };
|
|
123
|
+
}
|
|
124
|
+
/** `atlas dev proxy`: one origin for the app and FAPI, so session cookies are first-party. */
|
|
125
|
+
async function startProxy(options) {
|
|
126
|
+
const host = options.host ?? '127.0.0.1';
|
|
127
|
+
const server = (0, node_http_1.createServer)((req, res) => {
|
|
128
|
+
void (async () => {
|
|
129
|
+
const request = await toRequest(req, `http://${host}`);
|
|
130
|
+
const p = new URL(request.url).pathname;
|
|
131
|
+
const toApi = p.startsWith('/v1/') || p.startsWith('/.well-known/') || p.startsWith('/oauth2/');
|
|
132
|
+
await send(res, await proxy(toApi ? options.api : options.app, request));
|
|
133
|
+
})().catch(() => {
|
|
134
|
+
res.writeHead(502);
|
|
135
|
+
res.end('proxy error');
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
await new Promise((ok) => server.listen(options.port ?? 0, host, ok));
|
|
139
|
+
const addr = server.address();
|
|
140
|
+
return { url: `http://${host}:${typeof addr === 'object' && addr ? addr.port : 0}`, close: () => new Promise((ok) => (server.closeAllConnections(), server.close(() => ok()))) };
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;AAwEA,sCAwEC;AAYD,gCAgBC;AA5KD;;;;GAIG;AACH,yCAAiG;AACjG,6BAAkC;AAClC,wCAAoG;AA0BpG,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAE5G,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAEhF,KAAK,UAAU,SAAS,CAAC,GAAoB,EAAE,MAAc;IAC3D,MAAM,MAAM,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AAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,mBAAmB,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACnL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlasauth/emulator",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A local, in-memory Atlas for development: FAPI, a minimal BAPI, OIDC discovery, a mail/SMS catcher and a one-origin dev proxy.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"atlas-emulator": "dist/bin.js"
|
|
7
|
+
},
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"msw": "^2.4.9",
|
|
19
|
+
"@atlasauth/msw": "0.2.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "^22.9.0",
|
|
23
|
+
"typescript": "^5.6.3",
|
|
24
|
+
"vitest": "^2.1.4"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"!dist/*.tsbuildinfo",
|
|
32
|
+
"Dockerfile",
|
|
33
|
+
"README.md",
|
|
34
|
+
"CHANGELOG.md"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc -p tsconfig.build.json",
|
|
38
|
+
"typecheck": "tsgo -p tsconfig.json --noEmit --module preserve --moduleResolution bundler --incremental --tsBuildInfoFile node_modules/.cache/typecheck.tsbuildinfo",
|
|
39
|
+
"test": "vitest run"
|
|
40
|
+
}
|
|
6
41
|
}
|