@c9up/ream 0.2.7 → 0.2.9
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/HttpKernel.d.ts.map +1 -1
- package/dist/HttpKernel.js +10 -0
- package/dist/HttpKernel.js.map +1 -1
- package/dist/Ignitor.d.ts.map +1 -1
- package/dist/Ignitor.js +51 -3
- package/dist/Ignitor.js.map +1 -1
- package/dist/commands/Migrate.d.ts +9 -0
- package/dist/commands/Migrate.d.ts.map +1 -0
- package/dist/commands/Migrate.js +16 -0
- package/dist/commands/Migrate.js.map +1 -0
- package/dist/commands/MigrateBase.d.ts +27 -0
- package/dist/commands/MigrateBase.d.ts.map +1 -0
- package/dist/commands/MigrateBase.js +77 -0
- package/dist/commands/MigrateBase.js.map +1 -0
- package/dist/commands/MigrateRollback.d.ts +9 -0
- package/dist/commands/MigrateRollback.d.ts.map +1 -0
- package/dist/commands/MigrateRollback.js +16 -0
- package/dist/commands/MigrateRollback.js.map +1 -0
- package/dist/commands/MigrateStatus.d.ts +9 -0
- package/dist/commands/MigrateStatus.d.ts.map +1 -0
- package/dist/commands/MigrateStatus.js +19 -0
- package/dist/commands/MigrateStatus.js.map +1 -0
- package/dist/commands/ScheduleList.d.ts +18 -0
- package/dist/commands/ScheduleList.d.ts.map +1 -0
- package/dist/commands/ScheduleList.js +55 -0
- package/dist/commands/ScheduleList.js.map +1 -0
- package/dist/commands/ScheduleRun.d.ts +19 -0
- package/dist/commands/ScheduleRun.d.ts.map +1 -0
- package/dist/commands/ScheduleRun.js +61 -0
- package/dist/commands/ScheduleRun.js.map +1 -0
- package/dist/commands/index.d.ts +15 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +63 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/scheduler_resolver.d.ts +12 -0
- package/dist/commands/scheduler_resolver.d.ts.map +1 -0
- package/dist/commands/scheduler_resolver.js +19 -0
- package/dist/commands/scheduler_resolver.js.map +1 -0
- package/dist/debug.d.ts +22 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +23 -0
- package/dist/debug.js.map +1 -0
- package/dist/dumper/Dumper.d.ts +80 -0
- package/dist/dumper/Dumper.d.ts.map +1 -0
- package/dist/dumper/Dumper.js +129 -0
- package/dist/dumper/Dumper.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/middleware/Pipeline.d.ts.map +1 -1
- package/dist/middleware/Pipeline.js +7 -0
- package/dist/middleware/Pipeline.js.map +1 -1
- package/dist/repl/Repl.d.ts +88 -0
- package/dist/repl/Repl.d.ts.map +1 -0
- package/dist/repl/Repl.js +123 -0
- package/dist/repl/Repl.js.map +1 -0
- package/dist/services/dumper.d.ts +25 -0
- package/dist/services/dumper.d.ts.map +1 -0
- package/dist/services/dumper.js +27 -0
- package/dist/services/dumper.js.map +1 -0
- package/dist/services/repl.d.ts +19 -0
- package/dist/services/repl.d.ts.map +1 -0
- package/dist/services/repl.js +19 -0
- package/dist/services/repl.js.map +1 -0
- package/events.win32-x64-msvc.node +0 -0
- package/index.win32-x64-msvc.node +0 -0
- package/package.json +21 -1
- package/scheduler.win32-x64-msvc.node +0 -0
- package/src/HttpKernel.ts +27 -0
- package/src/Ignitor.ts +51 -3
- package/src/commands/Migrate.ts +18 -0
- package/src/commands/MigrateBase.ts +81 -0
- package/src/commands/MigrateRollback.ts +18 -0
- package/src/commands/MigrateStatus.ts +22 -0
- package/src/commands/ScheduleList.ts +66 -0
- package/src/commands/ScheduleRun.ts +65 -0
- package/src/commands/index.ts +73 -0
- package/src/commands/scheduler_resolver.ts +23 -0
- package/src/debug.ts +25 -0
- package/src/dumper/Dumper.ts +164 -0
- package/src/index.ts +1 -1
- package/src/middleware/Pipeline.ts +7 -0
- package/src/repl/Repl.ts +162 -0
- package/src/services/dumper.ts +30 -0
- package/src/services/repl.ts +21 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pipeline.js","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,MAAM,GAAG,MAAM,YAAY,CAAC,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;YAChE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;gBAClB,MAAM,IAAI,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;YAC7C,CAAC;YACD,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;gBAC9B,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;YACvC,CAAC;QACH,CAAC;QACD,MAAM,IAAI,EAAE,CAAA;IACd,CAAC,CAAA;AACH,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The application REPL — AdonisJS's `Repl`, in shape and in method names.
|
|
3
|
+
*
|
|
4
|
+
* import repl from '@c9up/ream/services/repl'
|
|
5
|
+
* repl.addMethod('loadModels', async () => { … }, {
|
|
6
|
+
* description: 'Load every entity onto the prompt',
|
|
7
|
+
* })
|
|
8
|
+
* repl.start({ app, router })
|
|
9
|
+
*
|
|
10
|
+
* Built on `node:repl`, which is the REPL — this adds what makes it an
|
|
11
|
+
* APPLICATION repl: a context seeded with the booted services, helpers a
|
|
12
|
+
* project registers itself, and `.ls` to list them, because a prompt full of
|
|
13
|
+
* undiscoverable helpers is a prompt nobody uses.
|
|
14
|
+
*/
|
|
15
|
+
import type { REPLServer } from 'node:repl';
|
|
16
|
+
/** What a registered helper receives — the repl itself, then its arguments. */
|
|
17
|
+
export type MethodCallback = (repl: Repl, ...args: unknown[]) => unknown;
|
|
18
|
+
/** How a helper describes itself in `.ls`. */
|
|
19
|
+
export interface MethodOptions {
|
|
20
|
+
description?: string;
|
|
21
|
+
usage?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A TypeScript compiler for the prompt, when the host has one.
|
|
25
|
+
*
|
|
26
|
+
* `node:repl` evaluates JavaScript. A project whose code is TypeScript wants
|
|
27
|
+
* to paste TypeScript, so the host supplies the compiler it already runs
|
|
28
|
+
* rather than ream carrying one.
|
|
29
|
+
*/
|
|
30
|
+
export interface Compiler {
|
|
31
|
+
compile(code: string, fileName: string): string;
|
|
32
|
+
supportsTypescript: boolean;
|
|
33
|
+
}
|
|
34
|
+
interface RegisteredMethod {
|
|
35
|
+
handler: MethodCallback;
|
|
36
|
+
options: MethodOptions & {
|
|
37
|
+
width: number;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export declare class Repl {
|
|
41
|
+
#private;
|
|
42
|
+
constructor(options?: {
|
|
43
|
+
prompt?: string;
|
|
44
|
+
write?: (message: string) => void;
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* Print a message around the prompt.
|
|
48
|
+
*
|
|
49
|
+
* Newline-wrapped: written mid-session the text would otherwise land on the
|
|
50
|
+
* line the user is typing.
|
|
51
|
+
*/
|
|
52
|
+
notify(message: string): void;
|
|
53
|
+
/** Run `callback` once the prompt is up. Chainable. */
|
|
54
|
+
ready(callback: (repl: Repl) => void): this;
|
|
55
|
+
/**
|
|
56
|
+
* Register a helper, available at the prompt by name. Chainable.
|
|
57
|
+
*
|
|
58
|
+
* `width` is the name's display width, recorded here so `.ls` can align a
|
|
59
|
+
* column without measuring the set twice.
|
|
60
|
+
*/
|
|
61
|
+
addMethod(name: string, handler: MethodCallback, options?: MethodOptions): this;
|
|
62
|
+
/** Every registered helper, keyed by name — AdonisJS `getMethods`. */
|
|
63
|
+
getMethods(): Record<string, RegisteredMethod>;
|
|
64
|
+
/** Use `compiler` for the code typed at the prompt. Chainable. */
|
|
65
|
+
useCompiler(compiler: Compiler): this;
|
|
66
|
+
/** The compiler in use, if any. */
|
|
67
|
+
get compiler(): Compiler | undefined;
|
|
68
|
+
/** The underlying `node:repl` server, once started. */
|
|
69
|
+
get server(): REPLServer | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* List the registered helpers, one per line, names aligned.
|
|
72
|
+
*
|
|
73
|
+
* Exposed rather than private because it IS the `.ls` command, and a caller
|
|
74
|
+
* driving the repl programmatically (a test, a custom command) needs the
|
|
75
|
+
* same listing without a live prompt.
|
|
76
|
+
*/
|
|
77
|
+
describeMethods(): string;
|
|
78
|
+
/**
|
|
79
|
+
* Start the prompt, seeding it with `context`.
|
|
80
|
+
*
|
|
81
|
+
* Registered helpers are bound to this repl before the prompt appears — a
|
|
82
|
+
* helper that only exists after the first keystroke is a helper the user
|
|
83
|
+
* finds missing.
|
|
84
|
+
*/
|
|
85
|
+
start(context?: Record<string, unknown>): this;
|
|
86
|
+
}
|
|
87
|
+
export {};
|
|
88
|
+
//# sourceMappingURL=Repl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Repl.d.ts","sourceRoot":"","sources":["../../src/repl/Repl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAG3C,+EAA+E;AAC/E,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAA;AAExE,8CAA8C;AAC9C,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACvB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;IAC/C,kBAAkB,EAAE,OAAO,CAAA;CAC5B;AAED,UAAU,gBAAgB;IACxB,OAAO,EAAE,cAAc,CAAA;IACvB,OAAO,EAAE,aAAa,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CAC3C;AAED,qBAAa,IAAI;;gBAQH,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;KAAO;IAShF;;;;;OAKG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI7B,uDAAuD;IACvD,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,GAAG,IAAI;IAK3C;;;;;OAKG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,GAAE,aAAkB,GAAG,IAAI;IAKnF,sEAAsE;IACtE,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAI9C,kEAAkE;IAClE,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAKrC,mCAAmC;IACnC,IAAI,QAAQ,IAAI,QAAQ,GAAG,SAAS,CAEnC;IAED,uDAAuD;IACvD,IAAI,MAAM,IAAI,UAAU,GAAG,SAAS,CAEnC;IAED;;;;;;OAMG;IACH,eAAe,IAAI,MAAM;IAYzB;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI;CA0BnD"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The application REPL — AdonisJS's `Repl`, in shape and in method names.
|
|
3
|
+
*
|
|
4
|
+
* import repl from '@c9up/ream/services/repl'
|
|
5
|
+
* repl.addMethod('loadModels', async () => { … }, {
|
|
6
|
+
* description: 'Load every entity onto the prompt',
|
|
7
|
+
* })
|
|
8
|
+
* repl.start({ app, router })
|
|
9
|
+
*
|
|
10
|
+
* Built on `node:repl`, which is the REPL — this adds what makes it an
|
|
11
|
+
* APPLICATION repl: a context seeded with the booted services, helpers a
|
|
12
|
+
* project registers itself, and `.ls` to list them, because a prompt full of
|
|
13
|
+
* undiscoverable helpers is a prompt nobody uses.
|
|
14
|
+
*/
|
|
15
|
+
import { start as startNodeRepl } from 'node:repl';
|
|
16
|
+
export class Repl {
|
|
17
|
+
#methods = new Map();
|
|
18
|
+
#readyCallbacks = [];
|
|
19
|
+
#compiler;
|
|
20
|
+
#server;
|
|
21
|
+
#prompt;
|
|
22
|
+
#write;
|
|
23
|
+
constructor(options = {}) {
|
|
24
|
+
this.#prompt = options.prompt ?? '> ';
|
|
25
|
+
this.#write =
|
|
26
|
+
options.write ??
|
|
27
|
+
((message) => {
|
|
28
|
+
process.stdout.write(message);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Print a message around the prompt.
|
|
33
|
+
*
|
|
34
|
+
* Newline-wrapped: written mid-session the text would otherwise land on the
|
|
35
|
+
* line the user is typing.
|
|
36
|
+
*/
|
|
37
|
+
notify(message) {
|
|
38
|
+
this.#write(`\n${message}\n`);
|
|
39
|
+
}
|
|
40
|
+
/** Run `callback` once the prompt is up. Chainable. */
|
|
41
|
+
ready(callback) {
|
|
42
|
+
this.#readyCallbacks.push(callback);
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Register a helper, available at the prompt by name. Chainable.
|
|
47
|
+
*
|
|
48
|
+
* `width` is the name's display width, recorded here so `.ls` can align a
|
|
49
|
+
* column without measuring the set twice.
|
|
50
|
+
*/
|
|
51
|
+
addMethod(name, handler, options = {}) {
|
|
52
|
+
this.#methods.set(name, { handler, options: { ...options, width: name.length } });
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
/** Every registered helper, keyed by name — AdonisJS `getMethods`. */
|
|
56
|
+
getMethods() {
|
|
57
|
+
return Object.fromEntries(this.#methods);
|
|
58
|
+
}
|
|
59
|
+
/** Use `compiler` for the code typed at the prompt. Chainable. */
|
|
60
|
+
useCompiler(compiler) {
|
|
61
|
+
this.#compiler = compiler;
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
/** The compiler in use, if any. */
|
|
65
|
+
get compiler() {
|
|
66
|
+
return this.#compiler;
|
|
67
|
+
}
|
|
68
|
+
/** The underlying `node:repl` server, once started. */
|
|
69
|
+
get server() {
|
|
70
|
+
return this.#server;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* List the registered helpers, one per line, names aligned.
|
|
74
|
+
*
|
|
75
|
+
* Exposed rather than private because it IS the `.ls` command, and a caller
|
|
76
|
+
* driving the repl programmatically (a test, a custom command) needs the
|
|
77
|
+
* same listing without a live prompt.
|
|
78
|
+
*/
|
|
79
|
+
describeMethods() {
|
|
80
|
+
if (this.#methods.size === 0)
|
|
81
|
+
return 'No methods registered';
|
|
82
|
+
const widest = Math.max(...[...this.#methods.values()].map((m) => m.options.width));
|
|
83
|
+
return [...this.#methods]
|
|
84
|
+
.map(([name, method]) => {
|
|
85
|
+
const description = method.options.description ?? '';
|
|
86
|
+
const usage = method.options.usage ? ` (${method.options.usage})` : '';
|
|
87
|
+
return `${name.padEnd(widest)} ${description}${usage}`.trimEnd();
|
|
88
|
+
})
|
|
89
|
+
.join('\n');
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Start the prompt, seeding it with `context`.
|
|
93
|
+
*
|
|
94
|
+
* Registered helpers are bound to this repl before the prompt appears — a
|
|
95
|
+
* helper that only exists after the first keystroke is a helper the user
|
|
96
|
+
* finds missing.
|
|
97
|
+
*/
|
|
98
|
+
start(context = {}) {
|
|
99
|
+
const server = startNodeRepl({ prompt: this.#prompt, useGlobal: false });
|
|
100
|
+
this.#server = server;
|
|
101
|
+
for (const [key, value] of Object.entries(context)) {
|
|
102
|
+
Object.defineProperty(server.context, key, { value, configurable: true, enumerable: true });
|
|
103
|
+
}
|
|
104
|
+
for (const [name, method] of this.#methods) {
|
|
105
|
+
Object.defineProperty(server.context, name, {
|
|
106
|
+
value: (...args) => method.handler(this, ...args),
|
|
107
|
+
configurable: true,
|
|
108
|
+
enumerable: true,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
server.defineCommand('ls', {
|
|
112
|
+
help: 'List the helpers available at this prompt',
|
|
113
|
+
action: () => {
|
|
114
|
+
this.notify(this.describeMethods());
|
|
115
|
+
server.displayPrompt();
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
for (const callback of this.#readyCallbacks)
|
|
119
|
+
callback(this);
|
|
120
|
+
return this;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=Repl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Repl.js","sourceRoot":"","sources":["../../src/repl/Repl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,WAAW,CAAA;AA4BlD,MAAM,OAAO,IAAI;IACN,QAAQ,GAAG,IAAI,GAAG,EAA4B,CAAA;IAC9C,eAAe,GAAgC,EAAE,CAAA;IAC1D,SAAS,CAAsB;IAC/B,OAAO,CAAwB;IACtB,OAAO,CAAQ;IACf,MAAM,CAA2B;IAE1C,YAAY,UAAkE,EAAE;QAC9E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,CAAA;QACrC,IAAI,CAAC,MAAM;YACT,OAAO,CAAC,KAAK;gBACb,CAAC,CAAC,OAAO,EAAE,EAAE;oBACX,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;gBAC/B,CAAC,CAAC,CAAA;IACN,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,OAAe;QACpB,IAAI,CAAC,MAAM,CAAC,KAAK,OAAO,IAAI,CAAC,CAAA;IAC/B,CAAC;IAED,uDAAuD;IACvD,KAAK,CAAC,QAA8B;QAClC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACnC,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;;OAKG;IACH,SAAS,CAAC,IAAY,EAAE,OA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F,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,eAAe;YAAE,QAAQ,CAAC,IAAI,CAAC,CAAA;QAC3D,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dumper singleton service.
|
|
3
|
+
*
|
|
4
|
+
* import { dd } from '@c9up/ream/services/dumper'
|
|
5
|
+
* dd(user)
|
|
6
|
+
*
|
|
7
|
+
* import dumper from '@c9up/ream/services/dumper'
|
|
8
|
+
* dumper.configureAnsiOutput({ depth: 8 })
|
|
9
|
+
*
|
|
10
|
+
* Unlike the other accessors this one holds a real instance rather than a
|
|
11
|
+
* proxy: the dumper depends on nothing the boot phase builds, and something
|
|
12
|
+
* you reach for mid-debug should not require a booted application.
|
|
13
|
+
*/
|
|
14
|
+
import { Dumper } from '../dumper/Dumper.js';
|
|
15
|
+
declare const dumper: Dumper;
|
|
16
|
+
/**
|
|
17
|
+
* Dump and die — AdonisJS's `dd`.
|
|
18
|
+
*
|
|
19
|
+
* The trace index is 2, not the default 1: the frame above is this function,
|
|
20
|
+
* so the caller of `dd` is one further out. Without it, every dump would
|
|
21
|
+
* report this file as its source.
|
|
22
|
+
*/
|
|
23
|
+
export declare const dd: (value: unknown) => void;
|
|
24
|
+
export default dumper;
|
|
25
|
+
//# sourceMappingURL=dumper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dumper.d.ts","sourceRoot":"","sources":["../../src/services/dumper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAE5C,QAAA,MAAM,MAAM,QAAe,CAAA;AAE3B;;;;;;GAMG;AACH,eAAO,MAAM,EAAE,GAAI,OAAO,OAAO,KAAG,IAEnC,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dumper singleton service.
|
|
3
|
+
*
|
|
4
|
+
* import { dd } from '@c9up/ream/services/dumper'
|
|
5
|
+
* dd(user)
|
|
6
|
+
*
|
|
7
|
+
* import dumper from '@c9up/ream/services/dumper'
|
|
8
|
+
* dumper.configureAnsiOutput({ depth: 8 })
|
|
9
|
+
*
|
|
10
|
+
* Unlike the other accessors this one holds a real instance rather than a
|
|
11
|
+
* proxy: the dumper depends on nothing the boot phase builds, and something
|
|
12
|
+
* you reach for mid-debug should not require a booted application.
|
|
13
|
+
*/
|
|
14
|
+
import { Dumper } from '../dumper/Dumper.js';
|
|
15
|
+
const dumper = new Dumper();
|
|
16
|
+
/**
|
|
17
|
+
* Dump and die — AdonisJS's `dd`.
|
|
18
|
+
*
|
|
19
|
+
* The trace index is 2, not the default 1: the frame above is this function,
|
|
20
|
+
* so the caller of `dd` is one further out. Without it, every dump would
|
|
21
|
+
* report this file as its source.
|
|
22
|
+
*/
|
|
23
|
+
export const dd = (value) => {
|
|
24
|
+
dumper.dd(value, 2);
|
|
25
|
+
};
|
|
26
|
+
export default dumper;
|
|
27
|
+
//# sourceMappingURL=dumper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dumper.js","sourceRoot":"","sources":["../../src/services/dumper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAE5C,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAA;AAE3B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAc,EAAQ,EAAE;IACzC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;AACrB,CAAC,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* REPL singleton service.
|
|
3
|
+
*
|
|
4
|
+
* // start/repl.ts, imported as a preload for the `repl` environment
|
|
5
|
+
* import repl from '@c9up/ream/services/repl'
|
|
6
|
+
* import { UserEntity } from '#app/entities/user'
|
|
7
|
+
*
|
|
8
|
+
* repl.addMethod('users', () => UserEntity, {
|
|
9
|
+
* description: 'The user entity, for querying at the prompt',
|
|
10
|
+
* })
|
|
11
|
+
*
|
|
12
|
+
* Holds a real instance rather than a proxy: helpers are registered BEFORE the
|
|
13
|
+
* prompt starts — that is the point of registering them — so the object has to
|
|
14
|
+
* exist before anything boots it.
|
|
15
|
+
*/
|
|
16
|
+
import { Repl } from '../repl/Repl.js';
|
|
17
|
+
declare const repl: Repl;
|
|
18
|
+
export default repl;
|
|
19
|
+
//# sourceMappingURL=repl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repl.d.ts","sourceRoot":"","sources":["../../src/services/repl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAEtC,QAAA,MAAM,IAAI,MAAa,CAAA;AAEvB,eAAe,IAAI,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* REPL singleton service.
|
|
3
|
+
*
|
|
4
|
+
* // start/repl.ts, imported as a preload for the `repl` environment
|
|
5
|
+
* import repl from '@c9up/ream/services/repl'
|
|
6
|
+
* import { UserEntity } from '#app/entities/user'
|
|
7
|
+
*
|
|
8
|
+
* repl.addMethod('users', () => UserEntity, {
|
|
9
|
+
* description: 'The user entity, for querying at the prompt',
|
|
10
|
+
* })
|
|
11
|
+
*
|
|
12
|
+
* Holds a real instance rather than a proxy: helpers are registered BEFORE the
|
|
13
|
+
* prompt starts — that is the point of registering them — so the object has to
|
|
14
|
+
* exist before anything boots it.
|
|
15
|
+
*/
|
|
16
|
+
import { Repl } from '../repl/Repl.js';
|
|
17
|
+
const repl = new Repl();
|
|
18
|
+
export default repl;
|
|
19
|
+
//# sourceMappingURL=repl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repl.js","sourceRoot":"","sources":["../../src/services/repl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAEtC,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAA;AAEvB,eAAe,IAAI,CAAA"}
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c9up/ream",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "Ream — Rust-powered Node.js application framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
"types": "./dist/http/Exception.d.ts",
|
|
20
20
|
"import": "./dist/http/Exception.js"
|
|
21
21
|
},
|
|
22
|
+
"./commands": {
|
|
23
|
+
"types": "./dist/commands/index.d.ts",
|
|
24
|
+
"import": "./dist/commands/index.js"
|
|
25
|
+
},
|
|
22
26
|
"./console": {
|
|
23
27
|
"types": "./dist/console/index.d.ts",
|
|
24
28
|
"import": "./dist/console/index.js"
|
|
@@ -39,6 +43,22 @@
|
|
|
39
43
|
"types": "./dist/services/config.d.ts",
|
|
40
44
|
"import": "./dist/services/config.js"
|
|
41
45
|
},
|
|
46
|
+
"./services/dumper": {
|
|
47
|
+
"types": "./dist/services/dumper.d.ts",
|
|
48
|
+
"import": "./dist/services/dumper.js"
|
|
49
|
+
},
|
|
50
|
+
"./dumper": {
|
|
51
|
+
"types": "./dist/dumper/Dumper.d.ts",
|
|
52
|
+
"import": "./dist/dumper/Dumper.js"
|
|
53
|
+
},
|
|
54
|
+
"./services/repl": {
|
|
55
|
+
"types": "./dist/services/repl.d.ts",
|
|
56
|
+
"import": "./dist/services/repl.js"
|
|
57
|
+
},
|
|
58
|
+
"./repl": {
|
|
59
|
+
"types": "./dist/repl/Repl.d.ts",
|
|
60
|
+
"import": "./dist/repl/Repl.js"
|
|
61
|
+
},
|
|
42
62
|
"./services/encryption": {
|
|
43
63
|
"types": "./dist/services/encryption.d.ts",
|
|
44
64
|
"import": "./dist/services/encryption.js"
|
|
Binary file
|
package/src/HttpKernel.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import type { Container } from './container/Container.js'
|
|
14
|
+
import { debugHttp } from './debug.js'
|
|
14
15
|
import type { Emitter } from './events/Emitter.js'
|
|
15
16
|
import { E_ROUTE_NOT_FOUND, ExceptionHandler } from './http/Exception.js'
|
|
16
17
|
import { type ChildLoggerSource, HttpContext } from './http/HttpContext.js'
|
|
@@ -157,6 +158,14 @@ export function createHttpKernel(
|
|
|
157
158
|
// only correct key; the previous PascalCase fallback was dead code.
|
|
158
159
|
const host = reqData.headers.host
|
|
159
160
|
const match = config.router.match(reqData.method, reqData.path, host)
|
|
161
|
+
if (debugHttp.enabled) {
|
|
162
|
+
debugHttp(
|
|
163
|
+
'%s %s -> %s',
|
|
164
|
+
reqData.method,
|
|
165
|
+
reqData.path,
|
|
166
|
+
match ? (match.route.name ?? match.route.path) : 'no match',
|
|
167
|
+
)
|
|
168
|
+
}
|
|
160
169
|
const routeInfo = match
|
|
161
170
|
? {
|
|
162
171
|
pattern: match.route.path,
|
|
@@ -327,6 +336,15 @@ export function createHttpKernel(
|
|
|
327
336
|
path: reqData.path,
|
|
328
337
|
status: ctx.response.getStatus(),
|
|
329
338
|
})
|
|
339
|
+
if (debugHttp.enabled) {
|
|
340
|
+
debugHttp(
|
|
341
|
+
'%s %s <- %d (%s)',
|
|
342
|
+
reqData.method,
|
|
343
|
+
reqData.path,
|
|
344
|
+
ctx.response.getStatus(),
|
|
345
|
+
correlationId,
|
|
346
|
+
)
|
|
347
|
+
}
|
|
330
348
|
const serialized = await serializeResponse(ctx)
|
|
331
349
|
// The body is built; anything registered with `response.onFinish()` runs
|
|
332
350
|
// now — after the answer is ready, before we hand it back.
|
|
@@ -374,6 +392,15 @@ export function createHttpKernel(
|
|
|
374
392
|
path: reqData.path,
|
|
375
393
|
status: ctx.response.getStatus(),
|
|
376
394
|
})
|
|
395
|
+
if (debugHttp.enabled) {
|
|
396
|
+
debugHttp(
|
|
397
|
+
'%s %s <- %d (%s)',
|
|
398
|
+
reqData.method,
|
|
399
|
+
reqData.path,
|
|
400
|
+
ctx.response.getStatus(),
|
|
401
|
+
correlationId,
|
|
402
|
+
)
|
|
403
|
+
}
|
|
377
404
|
const serialized = await serializeResponse(ctx)
|
|
378
405
|
// The body is built; anything registered with `response.onFinish()` runs
|
|
379
406
|
// now — after the answer is ready, before we hand it back.
|
package/src/Ignitor.ts
CHANGED
|
@@ -1137,6 +1137,7 @@ export class ConsoleKernel {
|
|
|
1137
1137
|
|
|
1138
1138
|
return {
|
|
1139
1139
|
getMetaData: async () => {
|
|
1140
|
+
await this.#loadFrameworkCommands(found)
|
|
1140
1141
|
await this.#discoverAppCommands(kernel, found)
|
|
1141
1142
|
await this.#loadPackageCommands(found)
|
|
1142
1143
|
// Imported here, not at the top of the file: the console stack is only
|
|
@@ -1149,6 +1150,24 @@ export class ConsoleKernel {
|
|
|
1149
1150
|
}
|
|
1150
1151
|
}
|
|
1151
1152
|
|
|
1153
|
+
/**
|
|
1154
|
+
* Register the framework's own commands (`@c9up/ream/commands`).
|
|
1155
|
+
*
|
|
1156
|
+
* AdonisJS lists its equivalent in the rc file, which its starter kit writes.
|
|
1157
|
+
* Ream registers them here instead, and first: these were subcommands of the
|
|
1158
|
+
* `ream` binary before they were classes, so an application that upgrades
|
|
1159
|
+
* would otherwise lose them without ever having asked for them. Loading them
|
|
1160
|
+
* first also means an application that ships a command of the same name wins
|
|
1161
|
+
* — the later registration replaces this one.
|
|
1162
|
+
*/
|
|
1163
|
+
async #loadFrameworkCommands(found: Map<string, CommandClass>): Promise<void> {
|
|
1164
|
+
const loader = await import('./commands/index.js')
|
|
1165
|
+
for (const metadata of await loader.getMetaData()) {
|
|
1166
|
+
const command = await loader.getCommand(metadata)
|
|
1167
|
+
if (command !== null) found.set(command.commandName, command)
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1152
1171
|
/**
|
|
1153
1172
|
* Load every command in the app's `commands/` directory.
|
|
1154
1173
|
*
|
|
@@ -1200,13 +1219,30 @@ export class ConsoleKernel {
|
|
|
1200
1219
|
if (!declared) return
|
|
1201
1220
|
|
|
1202
1221
|
for (const entry of declared) {
|
|
1203
|
-
const
|
|
1222
|
+
const module = await entry()
|
|
1223
|
+
|
|
1224
|
+
// A package with several commands ships ONE loader — `getMetaData()` +
|
|
1225
|
+
// `getCommand()` — so its rc entry is one line and `ream list` reads
|
|
1226
|
+
// metadata without importing a single command class. That is what makes
|
|
1227
|
+
// this channel usable for a package that has six of them, and why
|
|
1228
|
+
// requiring a default export per command pushed packages to wire
|
|
1229
|
+
// themselves into the CLI binary instead.
|
|
1230
|
+
const loader = loaderOf(module)
|
|
1231
|
+
if (loader) {
|
|
1232
|
+
for (const metadata of await loader.getMetaData()) {
|
|
1233
|
+
const loaded = await loader.getCommand(metadata)
|
|
1234
|
+
if (loaded !== null) found.set(loaded.commandName, loaded)
|
|
1235
|
+
}
|
|
1236
|
+
continue
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
const command = commandOf(module)
|
|
1204
1240
|
if (command === undefined) {
|
|
1205
1241
|
throw new ReamError(
|
|
1206
1242
|
'E_CONSOLE_INVALID_COMMAND',
|
|
1207
|
-
'An entry of reamrc.ts `commands`
|
|
1243
|
+
'An entry of reamrc.ts `commands` is neither a command loader nor a default-exported command class.',
|
|
1208
1244
|
{
|
|
1209
|
-
hint: '
|
|
1245
|
+
hint: 'Ship `export function getMetaData()` + `export function getCommand(metadata)` for a package with several commands, or `export default class X { static commandName = "..."; static description = "..."; run() {} }` for one.',
|
|
1210
1246
|
},
|
|
1211
1247
|
)
|
|
1212
1248
|
}
|
|
@@ -1246,6 +1282,18 @@ interface ConsoleCommandKernel {
|
|
|
1246
1282
|
}
|
|
1247
1283
|
|
|
1248
1284
|
/** The command a module default-exports, or undefined when it exports none. */
|
|
1285
|
+
/**
|
|
1286
|
+
* A module that enumerates its own commands — the shape AdonisJS packages ship
|
|
1287
|
+
* and the one `CommandLoader` already describes.
|
|
1288
|
+
*/
|
|
1289
|
+
function loaderOf(mod: unknown): CommandLoader | undefined {
|
|
1290
|
+
if (typeof mod !== 'object' || mod === null) return undefined
|
|
1291
|
+
const getMetaData = Reflect.get(mod, 'getMetaData')
|
|
1292
|
+
const getCommand = Reflect.get(mod, 'getCommand')
|
|
1293
|
+
if (typeof getMetaData !== 'function' || typeof getCommand !== 'function') return undefined
|
|
1294
|
+
return mod as CommandLoader
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1249
1297
|
function commandOf(mod: unknown): CommandClass | undefined {
|
|
1250
1298
|
if (typeof mod !== 'object' || mod === null) return undefined
|
|
1251
1299
|
const value = Reflect.get(mod, 'default')
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** `migrate` — apply every pending migration, in every registered store. */
|
|
2
|
+
|
|
3
|
+
import type { RegisteredMigrationSource } from '../migrations/types.js'
|
|
4
|
+
import { MigrateBase } from './MigrateBase.js'
|
|
5
|
+
|
|
6
|
+
export default class Migrate extends MigrateBase {
|
|
7
|
+
static override commandName = 'migrate'
|
|
8
|
+
static override description = 'Run pending migrations for every registered migration source'
|
|
9
|
+
|
|
10
|
+
protected async migrateSource(source: RegisteredMigrationSource): Promise<void> {
|
|
11
|
+
const executed = await source.runner.migrate()
|
|
12
|
+
if (executed.length === 0) {
|
|
13
|
+
this.report(source, 'nothing to migrate.')
|
|
14
|
+
return
|
|
15
|
+
}
|
|
16
|
+
for (const name of executed) this.report(source, `migrated: ${name}`)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `migrate`, `migrate:rollback` and `migrate:status` share.
|
|
3
|
+
*
|
|
4
|
+
* All three drive the SAME thing — the `migrations` registry, where each data
|
|
5
|
+
* package puts its runner — and differ only in which method they call and how
|
|
6
|
+
* they print the result. A ream particularity, deliberate: AdonisJS has one
|
|
7
|
+
* store and can name it, while an application here may hold a relational store
|
|
8
|
+
* and a time-series one at once, so the command names none of them.
|
|
9
|
+
*
|
|
10
|
+
* Sequentially, never in parallel: two stores on one database server would
|
|
11
|
+
* contend on locks, and interleaved output makes a failure impossible to
|
|
12
|
+
* attribute to the store that caused it.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { BaseCommand } from '../console/BaseCommand.js'
|
|
16
|
+
import { flags } from '../console/decorators.js'
|
|
17
|
+
import type { CommandOptions } from '../console/types.js'
|
|
18
|
+
import type { MigrationRegistry } from '../migrations/MigrationRegistry.js'
|
|
19
|
+
import type { RegisteredMigrationSource } from '../migrations/types.js'
|
|
20
|
+
|
|
21
|
+
export abstract class MigrateBase extends BaseCommand {
|
|
22
|
+
static override options: CommandOptions = { startApp: true }
|
|
23
|
+
|
|
24
|
+
@flags.string({
|
|
25
|
+
description: 'Only this migration source, by the name its package registered',
|
|
26
|
+
})
|
|
27
|
+
declare only?: string
|
|
28
|
+
|
|
29
|
+
/** What to do with one store. Implemented by each command. */
|
|
30
|
+
protected abstract migrateSource(source: RegisteredMigrationSource): Promise<void>
|
|
31
|
+
|
|
32
|
+
async run(): Promise<void> {
|
|
33
|
+
const sources = await this.#resolveSources()
|
|
34
|
+
if (sources === undefined) return
|
|
35
|
+
|
|
36
|
+
for (const source of sources) {
|
|
37
|
+
await this.migrateSource(source)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** The line every message is prefixed with, so multi-store output stays legible. */
|
|
42
|
+
protected report(source: RegisteredMigrationSource, message: string): void {
|
|
43
|
+
this.logger.log(` [${source.name}] ${message}`)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The sources this run covers, or `undefined` when the run should stop —
|
|
48
|
+
* having said why.
|
|
49
|
+
*
|
|
50
|
+
* An empty registry is NOT a failure: an application may legitimately have no
|
|
51
|
+
* data package yet. Naming which thing is missing beats exiting non-zero on a
|
|
52
|
+
* state the user may have chosen.
|
|
53
|
+
*/
|
|
54
|
+
async #resolveSources(): Promise<RegisteredMigrationSource[] | undefined> {
|
|
55
|
+
const registry = await this.app.container.resolve<MigrationRegistry>('migrations')
|
|
56
|
+
|
|
57
|
+
if (this.only !== undefined) {
|
|
58
|
+
const picked = registry.get(this.only)
|
|
59
|
+
if (picked === undefined) {
|
|
60
|
+
const names = registry.names()
|
|
61
|
+
this.logger.error(`No migration source named "${this.only}".`)
|
|
62
|
+
this.logger.error(
|
|
63
|
+
names.length > 0
|
|
64
|
+
? ` Registered: ${names.join(', ')}`
|
|
65
|
+
: ' No data package registered one. Is its provider in reamrc.ts?',
|
|
66
|
+
)
|
|
67
|
+
this.exitCode = 1
|
|
68
|
+
return undefined
|
|
69
|
+
}
|
|
70
|
+
return [picked]
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const sources = registry.all()
|
|
74
|
+
if (sources.length === 0) {
|
|
75
|
+
this.logger.info('No migration source registered.')
|
|
76
|
+
this.logger.info(' A data package registers one from its provider — check reamrc.ts.')
|
|
77
|
+
return undefined
|
|
78
|
+
}
|
|
79
|
+
return sources
|
|
80
|
+
}
|
|
81
|
+
}
|