@duraxis/cli 0.3.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +20 -71
  3. package/dist/admin.command-Dt5MnwJw.js +299 -0
  4. package/dist/admin.command-Dt5MnwJw.js.map +1 -0
  5. package/dist/cli.d.ts +7 -0
  6. package/dist/commands/admin.command.d.ts +3 -0
  7. package/dist/commands/doctor.command.d.ts +9 -0
  8. package/dist/commands/init.command.d.ts +3 -0
  9. package/dist/commands/migration.command.d.ts +3 -0
  10. package/dist/commands/minimal-admin.d.ts +4 -0
  11. package/dist/config-BKscNXeW.js +204 -0
  12. package/dist/config-BKscNXeW.js.map +1 -0
  13. package/dist/config.d.ts +10 -8
  14. package/dist/dependencies/configured-registry.d.ts +3 -0
  15. package/dist/dependencies/dependency-resolver.d.ts +2 -0
  16. package/dist/dependencies/installed-package.d.ts +1 -0
  17. package/dist/dependencies/package-manager.d.ts +10 -0
  18. package/dist/dependencies/registry-client.d.ts +21 -0
  19. package/dist/dependencies/version-compatibility.d.ts +9 -0
  20. package/dist/file-plan-D-Sj3yv0.js +130 -0
  21. package/dist/file-plan-D-Sj3yv0.js.map +1 -0
  22. package/dist/filesystem/file-plan.d.ts +32 -0
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +366 -551
  25. package/dist/index.js.map +1 -1
  26. package/dist/init/initialization-options.d.ts +32 -0
  27. package/dist/init/initialization-planner.d.ts +10 -0
  28. package/dist/init/nest-integration.d.ts +2 -0
  29. package/dist/init/project-detector.d.ts +27 -0
  30. package/dist/init/static-config.d.ts +16 -0
  31. package/dist/init.command-DrO29773.js +167 -0
  32. package/dist/init.command-DrO29773.js.map +1 -0
  33. package/dist/initialization-planner-B41PNGWc.js +315 -0
  34. package/dist/initialization-planner-B41PNGWc.js.map +1 -0
  35. package/dist/migration.command-dhRbN4UI.js +361 -0
  36. package/dist/migration.command-dhRbN4UI.js.map +1 -0
  37. package/dist/minimal-admin-B4ur_cON.js +232 -0
  38. package/dist/minimal-admin-B4ur_cON.js.map +1 -0
  39. package/dist/nest-integration-KCc7ZaG6.js +93 -0
  40. package/dist/nest-integration-KCc7ZaG6.js.map +1 -0
  41. package/dist/package-manager-Ca5ArUf-.js +269 -0
  42. package/dist/package-manager-Ca5ArUf-.js.map +1 -0
  43. package/dist/project-detector-BQWeQZ8Q.js +174 -0
  44. package/dist/project-detector-BQWeQZ8Q.js.map +1 -0
  45. package/dist/registry/argument-parser.d.ts +65 -0
  46. package/dist/registry/command-registry.d.ts +198 -0
  47. package/dist/rolldown-runtime-D8jQpDG7.js +12 -0
  48. package/dist/static-config-g_7qN12_.js +109 -0
  49. package/dist/static-config-g_7qN12_.js.map +1 -0
  50. package/dist/templates/project.d.ts +10 -0
  51. package/dist/terminal/prompts.d.ts +2 -0
  52. package/package.json +13 -8
@@ -0,0 +1,198 @@
1
+ export declare const options: {
2
+ readonly config: {
3
+ readonly type: "string";
4
+ };
5
+ readonly database: {
6
+ readonly type: "string";
7
+ };
8
+ readonly json: {
9
+ readonly type: "boolean";
10
+ };
11
+ readonly help: {
12
+ readonly type: "boolean";
13
+ readonly short: "h";
14
+ };
15
+ readonly version: {
16
+ readonly type: "boolean";
17
+ };
18
+ readonly framework: {
19
+ readonly type: "string";
20
+ };
21
+ readonly driver: {
22
+ readonly type: "string";
23
+ };
24
+ readonly orm: {
25
+ readonly type: "boolean";
26
+ };
27
+ readonly "no-orm": {
28
+ readonly type: "boolean";
29
+ };
30
+ readonly migrations: {
31
+ readonly type: "boolean";
32
+ };
33
+ readonly "no-migrations": {
34
+ readonly type: "boolean";
35
+ };
36
+ readonly "package-manager": {
37
+ readonly type: "string";
38
+ };
39
+ readonly language: {
40
+ readonly type: "string";
41
+ };
42
+ readonly "module-format": {
43
+ readonly type: "string";
44
+ };
45
+ readonly namespace: {
46
+ readonly type: "string";
47
+ };
48
+ readonly directory: {
49
+ readonly type: "string";
50
+ };
51
+ readonly "source-dir": {
52
+ readonly type: "string";
53
+ };
54
+ readonly "storage-directory": {
55
+ readonly type: "string";
56
+ };
57
+ readonly bucket: {
58
+ readonly type: "string";
59
+ };
60
+ readonly prefix: {
61
+ readonly type: "string";
62
+ };
63
+ readonly region: {
64
+ readonly type: "string";
65
+ };
66
+ readonly endpoint: {
67
+ readonly type: "string";
68
+ };
69
+ readonly "force-path-style": {
70
+ readonly type: "boolean";
71
+ };
72
+ readonly "schema-mode": {
73
+ readonly type: "string";
74
+ };
75
+ readonly example: {
76
+ readonly type: "boolean";
77
+ };
78
+ readonly "no-example": {
79
+ readonly type: "boolean";
80
+ };
81
+ readonly install: {
82
+ readonly type: "boolean";
83
+ };
84
+ readonly "no-install": {
85
+ readonly type: "boolean";
86
+ };
87
+ readonly "dry-run": {
88
+ readonly type: "boolean";
89
+ };
90
+ readonly yes: {
91
+ readonly type: "boolean";
92
+ };
93
+ readonly steps: {
94
+ readonly type: "string";
95
+ };
96
+ readonly to: {
97
+ readonly type: "string";
98
+ };
99
+ readonly "allow-destructive": {
100
+ readonly type: "boolean";
101
+ };
102
+ readonly offline: {
103
+ readonly type: "boolean";
104
+ };
105
+ readonly persisted: {
106
+ readonly type: "boolean";
107
+ };
108
+ readonly schema: {
109
+ readonly type: "string";
110
+ };
111
+ readonly live: {
112
+ readonly type: "boolean";
113
+ };
114
+ readonly evaluate: {
115
+ readonly type: "boolean";
116
+ };
117
+ readonly check: {
118
+ readonly type: "boolean";
119
+ };
120
+ readonly apply: {
121
+ readonly type: "boolean";
122
+ };
123
+ readonly registry: {
124
+ readonly type: "string";
125
+ };
126
+ readonly prerelease: {
127
+ readonly type: "boolean";
128
+ };
129
+ readonly "custom-module": {
130
+ readonly type: "string";
131
+ };
132
+ readonly "custom-export": {
133
+ readonly type: "string";
134
+ };
135
+ readonly "custom-constructor": {
136
+ readonly type: "boolean";
137
+ };
138
+ readonly "custom-options": {
139
+ readonly type: "string";
140
+ };
141
+ readonly "max-stored-bytes": {
142
+ readonly type: "string";
143
+ };
144
+ readonly "max-object-bytes": {
145
+ readonly type: "string";
146
+ };
147
+ readonly "max-entries": {
148
+ readonly type: "string";
149
+ };
150
+ readonly "max-metadata-bytes": {
151
+ readonly type: "string";
152
+ };
153
+ readonly "max-journal-bytes": {
154
+ readonly type: "string";
155
+ };
156
+ readonly "max-queued-operations": {
157
+ readonly type: "string";
158
+ };
159
+ readonly "max-pending-operations": {
160
+ readonly type: "string";
161
+ };
162
+ readonly "max-attempts": {
163
+ readonly type: "string";
164
+ };
165
+ readonly "ownership-recovery": {
166
+ readonly type: "string";
167
+ };
168
+ readonly "application-id": {
169
+ readonly type: "string";
170
+ };
171
+ readonly "resources-file": {
172
+ readonly type: "string";
173
+ };
174
+ readonly "cursor-key-env": {
175
+ readonly type: "string";
176
+ };
177
+ };
178
+ export type OptionName = keyof typeof options;
179
+ export interface CommandDefinition {
180
+ readonly name: string;
181
+ readonly aliases: readonly string[];
182
+ readonly category: string;
183
+ readonly description: string;
184
+ readonly positional: readonly string[];
185
+ readonly optionalPositionals?: boolean;
186
+ readonly options: readonly OptionName[];
187
+ readonly required: readonly OptionName[];
188
+ readonly defaults: Readonly<Record<string, string | boolean>>;
189
+ readonly exclusive: readonly (readonly OptionName[])[];
190
+ readonly examples: readonly string[];
191
+ readonly configuration: "none" | "static" | "migration";
192
+ readonly database: boolean | "conditional";
193
+ readonly interactive: boolean;
194
+ readonly handler: "init" | "admin" | "migration" | "help" | "version";
195
+ }
196
+ export declare const commands: readonly CommandDefinition[];
197
+ export declare function findCommand(name: string): CommandDefinition;
198
+ export declare function helpText(definition?: CommandDefinition): string;
@@ -0,0 +1,12 @@
1
+ // \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ export { __exportAll as t };
@@ -0,0 +1,109 @@
1
+ import ts from "typescript";
2
+ // src/init/static-config.ts
3
+ function value(node) {
4
+ if (ts.isStringLiteralLike(node)) return node.text;
5
+ if (ts.isNumericLiteral(node)) return Number(node.text);
6
+ if (node.kind === ts.SyntaxKind.TrueKeyword) return true;
7
+ if (node.kind === ts.SyntaxKind.FalseKeyword) return false;
8
+ if (node.kind === ts.SyntaxKind.NullKeyword) return null;
9
+ if (ts.isArrayLiteralExpression(node)) return node.elements.map((item) => value(item));
10
+ if (ts.isObjectLiteralExpression(node)) return Object.fromEntries(node.properties.map((property) => ts.isPropertyAssignment(property) && property.name && (ts.isIdentifier(property.name) || ts.isStringLiteral(property.name)) ? [property.name.text, value(property.initializer)] : ["[dynamic property]", "[not evaluated]"]));
11
+ return "[executable expression; not evaluated]";
12
+ }
13
+ function property(object, name) {
14
+ const matches = object.properties.filter((item) => item.name && (ts.isIdentifier(item.name) || ts.isStringLiteral(item.name)) && item.name.text === name);
15
+ if (matches.length > 1) throw new Error(`Duplicate configuration property: ${name}`);
16
+ const item = matches[0];
17
+ if (item && !ts.isPropertyAssignment(item)) throw new Error(`Cannot safely inspect dynamic property: ${name}`);
18
+ return item;
19
+ }
20
+ function inspectStaticConfig(source, filename) {
21
+ const ast = ts.createSourceFile(filename, source, ts.ScriptTarget.Latest, true);
22
+ if (ast.parseDiagnostics.length) throw new Error("Invalid configuration syntax; no executable code was evaluated");
23
+ const helpers = /* @__PURE__ */ new Set();
24
+ for (const statement of ast.statements) {
25
+ if (ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier) && statement.moduleSpecifier.text === "@duraxis/core") {
26
+ const bindings = statement.importClause?.namedBindings;
27
+ if (bindings && ts.isNamedImports(bindings)) {
28
+ for (const item of bindings.elements) if ((item.propertyName ?? item.name).text === "defineDuraxisConfig") helpers.add(item.name.text);
29
+ }
30
+ }
31
+ if (ts.isVariableStatement(statement)) {
32
+ for (const item of statement.declarationList.declarations) if (ts.isObjectBindingPattern(item.name) && item.initializer && ts.isCallExpression(item.initializer) && item.initializer.expression.getText(ast) === "require" && item.initializer.arguments[0] && ts.isStringLiteral(item.initializer.arguments[0]) && item.initializer.arguments[0].text === "@duraxis/core") {
33
+ for (const binding of item.name.elements) if ((binding.propertyName ?? binding.name).getText(ast) === "defineDuraxisConfig") helpers.add(binding.name.getText(ast));
34
+ }
35
+ }
36
+ }
37
+ let expression;
38
+ for (const statement of ast.statements) {
39
+ if (ts.isExportAssignment(statement)) expression = statement.expression;
40
+ if (ts.isExpressionStatement(statement) && ts.isBinaryExpression(statement.expression) && statement.expression.operatorToken.kind === ts.SyntaxKind.EqualsToken && statement.expression.left.getText(ast) === "module.exports") expression = statement.expression.right;
41
+ }
42
+ if (!expression || !ts.isCallExpression(expression) || !ts.isIdentifier(expression.expression) || !helpers.has(expression.expression.text) || expression.arguments.length !== 1 || !ts.isObjectLiteralExpression(expression.arguments[0])) throw new Error("Configuration is user-authored or dynamic; cannot inspect or modify it safely. Use --evaluate for trusted read operations, or edit it manually. No files were written.");
43
+ const object = expression.arguments[0];
44
+ if (object.properties.some(ts.isSpreadAssignment)) throw new Error("Dynamic configuration spreads require manual editing");
45
+ const connections = /* @__PURE__ */ new Map();
46
+ const named = property(object, "connections");
47
+ let defaultConnection = "default";
48
+ if (named) {
49
+ if (!ts.isObjectLiteralExpression(named.initializer)) throw new Error("Dynamic connections require manual editing");
50
+ for (const item of named.initializer.properties) {
51
+ if (!ts.isPropertyAssignment(item) || !ts.isObjectLiteralExpression(item.initializer) || !(ts.isIdentifier(item.name) || ts.isStringLiteral(item.name))) throw new Error("Dynamic connections require manual editing");
52
+ if (connections.has(item.name.text)) throw new Error("Duplicate named connection");
53
+ connections.set(item.name.text, item.initializer);
54
+ }
55
+ const selected = property(object, "defaultConnection");
56
+ if (selected && !ts.isStringLiteral(selected.initializer)) throw new Error("Dynamic defaultConnection requires manual editing");
57
+ defaultConnection = selected ? selected.initializer.text : [...connections.keys()].sort()[0];
58
+ if (!connections.has(defaultConnection)) throw new Error("Unknown default connection");
59
+ } else connections.set("default", object);
60
+ return {
61
+ ast,
62
+ object,
63
+ connections,
64
+ defaultConnection,
65
+ value: value(object)
66
+ };
67
+ }
68
+ function replaceExpression(source, node, replacement, ast) {
69
+ return source.slice(0, node.getStart(ast)) + replacement + source.slice(node.end);
70
+ }
71
+ function setLiteralProperty(source, object, key, literal, ast) {
72
+ if (object.properties.some(ts.isSpreadAssignment)) throw new Error("Cannot safely modify configuration spreads");
73
+ const existing = property(object, key);
74
+ if (existing) return replaceExpression(source, existing.initializer, literal, ast);
75
+ const offset = object.properties.end;
76
+ return source.slice(0, offset) + `${object.properties.length && !object.properties.hasTrailingComma ? "," : ""}\n ${key}: ${literal},` + source.slice(offset);
77
+ }
78
+ function staticDriverInfo(config, connection) {
79
+ const driver = property(connection, "driver")?.initializer;
80
+ if (!driver || !ts.isArrowFunction(driver)) return {};
81
+ const body = driver.body;
82
+ if (!ts.isNewExpression(body) && !ts.isCallExpression(body)) return {};
83
+ const expression = body.expression;
84
+ const name = ts.isIdentifier(expression) ? expression.text : ts.isPropertyAccessExpression(expression) && ts.isIdentifier(expression.expression) ? expression.expression.text : void 0;
85
+ let kind;
86
+ for (const statement of config.ast.statements) {
87
+ if (ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier)) {
88
+ const bindings = statement.importClause?.namedBindings;
89
+ if (bindings && ts.isNamedImports(bindings) && bindings.elements.some((item) => item.name.text === name)) kind = statement.moduleSpecifier.text.replace("@duraxis/storage-", "");
90
+ }
91
+ if (ts.isVariableStatement(statement)) {
92
+ for (const declaration of statement.declarationList.declarations) if (ts.isObjectBindingPattern(declaration.name) && declaration.name.elements.some((item) => item.name.getText(config.ast) === name) && declaration.initializer && ts.isCallExpression(declaration.initializer) && declaration.initializer.expression.getText(config.ast) === "require") {
93
+ const module = declaration.initializer.arguments[0];
94
+ if (module && ts.isStringLiteral(module)) kind = module.text.replace("@duraxis/storage-", "");
95
+ }
96
+ }
97
+ }
98
+ const options = body.arguments?.[0];
99
+ let directory = options && ts.isObjectLiteralExpression(options) ? property(options, "directory")?.initializer : void 0;
100
+ if (directory && ts.isCallExpression(directory) && directory.arguments.length === 1 && directory.expression.getText(config.ast) === "resolvePath") directory = directory.arguments[0];
101
+ if (directory && ts.isBinaryExpression(directory) && directory.operatorToken.kind === ts.SyntaxKind.QuestionQuestionToken) directory = directory.right;
102
+ return {
103
+ driver: kind,
104
+ directory: directory && ts.isStringLiteral(directory) ? directory.text : void 0
105
+ };
106
+ }
107
+ export { inspectStaticConfig, property, replaceExpression, setLiteralProperty, staticDriverInfo };
108
+
109
+ //# sourceMappingURL=static-config-g_7qN12_.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static-config-g_7qN12_.js","names":[],"sources":["../src/init/static-config.ts"],"sourcesContent":["import ts from \"typescript\";\n\nexport interface StaticConfig {\n ast: ts.SourceFile;\n object: ts.ObjectLiteralExpression;\n connections: Map<string, ts.ObjectLiteralExpression>;\n defaultConnection: string;\n value: unknown;\n}\nfunction value(node: ts.Expression): unknown {\n if (ts.isStringLiteralLike(node)) return node.text;\n if (ts.isNumericLiteral(node)) return Number(node.text);\n if (node.kind === ts.SyntaxKind.TrueKeyword) return true;\n if (node.kind === ts.SyntaxKind.FalseKeyword) return false;\n if (node.kind === ts.SyntaxKind.NullKeyword) return null;\n if (ts.isArrayLiteralExpression(node)) return node.elements.map((item) => value(item));\n if (ts.isObjectLiteralExpression(node))\n return Object.fromEntries(\n node.properties.map((property) =>\n ts.isPropertyAssignment(property) &&\n property.name &&\n (ts.isIdentifier(property.name) || ts.isStringLiteral(property.name))\n ? [property.name.text, value(property.initializer)]\n : [\"[dynamic property]\", \"[not evaluated]\"],\n ),\n );\n return \"[executable expression; not evaluated]\";\n}\nexport function property(\n object: ts.ObjectLiteralExpression,\n name: string,\n): ts.PropertyAssignment | undefined {\n const matches = object.properties.filter(\n (item) =>\n item.name &&\n (ts.isIdentifier(item.name) || ts.isStringLiteral(item.name)) &&\n item.name.text === name,\n );\n if (matches.length > 1) throw new Error(`Duplicate configuration property: ${name}`);\n const item = matches[0];\n if (item && !ts.isPropertyAssignment(item))\n throw new Error(`Cannot safely inspect dynamic property: ${name}`);\n return item as ts.PropertyAssignment | undefined;\n}\nexport function inspectStaticConfig(source: string, filename: string): StaticConfig {\n const ast = ts.createSourceFile(filename, source, ts.ScriptTarget.Latest, true);\n if ((ast as unknown as { parseDiagnostics: readonly unknown[] }).parseDiagnostics.length)\n throw new Error(\"Invalid configuration syntax; no executable code was evaluated\");\n const helpers = new Set<string>();\n for (const statement of ast.statements) {\n if (\n ts.isImportDeclaration(statement) &&\n ts.isStringLiteral(statement.moduleSpecifier) &&\n statement.moduleSpecifier.text === \"@duraxis/core\"\n ) {\n const bindings = statement.importClause?.namedBindings;\n if (bindings && ts.isNamedImports(bindings))\n for (const item of bindings.elements)\n if ((item.propertyName ?? item.name).text === \"defineDuraxisConfig\")\n helpers.add(item.name.text);\n }\n if (ts.isVariableStatement(statement))\n for (const item of statement.declarationList.declarations) {\n if (\n ts.isObjectBindingPattern(item.name) &&\n item.initializer &&\n ts.isCallExpression(item.initializer) &&\n item.initializer.expression.getText(ast) === \"require\" &&\n item.initializer.arguments[0] &&\n ts.isStringLiteral(item.initializer.arguments[0]) &&\n item.initializer.arguments[0].text === \"@duraxis/core\"\n )\n for (const binding of item.name.elements)\n if ((binding.propertyName ?? binding.name).getText(ast) === \"defineDuraxisConfig\")\n helpers.add(binding.name.getText(ast));\n }\n }\n let expression: ts.Expression | undefined;\n for (const statement of ast.statements) {\n if (ts.isExportAssignment(statement)) expression = statement.expression;\n if (\n ts.isExpressionStatement(statement) &&\n ts.isBinaryExpression(statement.expression) &&\n statement.expression.operatorToken.kind === ts.SyntaxKind.EqualsToken &&\n statement.expression.left.getText(ast) === \"module.exports\"\n )\n expression = statement.expression.right;\n }\n if (\n !expression ||\n !ts.isCallExpression(expression) ||\n !ts.isIdentifier(expression.expression) ||\n !helpers.has(expression.expression.text) ||\n expression.arguments.length !== 1 ||\n !ts.isObjectLiteralExpression(expression.arguments[0]!)\n )\n throw new Error(\n \"Configuration is user-authored or dynamic; cannot inspect or modify it safely. Use --evaluate for trusted read operations, or edit it manually. No files were written.\",\n );\n const object = expression.arguments[0] as ts.ObjectLiteralExpression;\n if (object.properties.some(ts.isSpreadAssignment))\n throw new Error(\"Dynamic configuration spreads require manual editing\");\n const connections = new Map<string, ts.ObjectLiteralExpression>();\n const named = property(object, \"connections\");\n let defaultConnection = \"default\";\n if (named) {\n if (!ts.isObjectLiteralExpression(named.initializer))\n throw new Error(\"Dynamic connections require manual editing\");\n for (const item of named.initializer.properties) {\n if (\n !ts.isPropertyAssignment(item) ||\n !ts.isObjectLiteralExpression(item.initializer) ||\n !(ts.isIdentifier(item.name) || ts.isStringLiteral(item.name))\n )\n throw new Error(\"Dynamic connections require manual editing\");\n if (connections.has(item.name.text)) throw new Error(\"Duplicate named connection\");\n connections.set(item.name.text, item.initializer);\n }\n const selected = property(object, \"defaultConnection\");\n if (selected && !ts.isStringLiteral(selected.initializer))\n throw new Error(\"Dynamic defaultConnection requires manual editing\");\n defaultConnection = selected\n ? (selected.initializer as ts.StringLiteral).text\n : [...connections.keys()].sort()[0]!;\n if (!connections.has(defaultConnection)) throw new Error(\"Unknown default connection\");\n } else connections.set(\"default\", object);\n return { ast, object, connections, defaultConnection, value: value(object) };\n}\nexport function replaceExpression(\n source: string,\n node: ts.Node,\n replacement: string,\n ast: ts.SourceFile,\n): string {\n return source.slice(0, node.getStart(ast)) + replacement + source.slice(node.end);\n}\nexport function setLiteralProperty(\n source: string,\n object: ts.ObjectLiteralExpression,\n key: string,\n literal: string,\n ast: ts.SourceFile,\n): string {\n if (object.properties.some(ts.isSpreadAssignment))\n throw new Error(\"Cannot safely modify configuration spreads\");\n const existing = property(object, key);\n if (existing) return replaceExpression(source, existing.initializer, literal, ast);\n const offset = object.properties.end;\n return (\n source.slice(0, offset) +\n `${object.properties.length && !object.properties.hasTrailingComma ? \",\" : \"\"}\\n ${key}: ${literal},` +\n source.slice(offset)\n );\n}\n\nexport function staticDriverInfo(\n config: StaticConfig,\n connection: ts.ObjectLiteralExpression,\n): { driver?: string; directory?: string } {\n const driver = property(connection, \"driver\")?.initializer;\n if (!driver || !ts.isArrowFunction(driver)) return {};\n const body = driver.body;\n if (!ts.isNewExpression(body) && !ts.isCallExpression(body)) return {};\n const expression = body.expression;\n const name = ts.isIdentifier(expression)\n ? expression.text\n : ts.isPropertyAccessExpression(expression) && ts.isIdentifier(expression.expression)\n ? expression.expression.text\n : undefined;\n let kind: string | undefined;\n for (const statement of config.ast.statements) {\n if (ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier)) {\n const bindings = statement.importClause?.namedBindings;\n if (\n bindings &&\n ts.isNamedImports(bindings) &&\n bindings.elements.some((item) => item.name.text === name)\n )\n kind = statement.moduleSpecifier.text.replace(\"@duraxis/storage-\", \"\");\n }\n if (ts.isVariableStatement(statement))\n for (const declaration of statement.declarationList.declarations) {\n if (\n ts.isObjectBindingPattern(declaration.name) &&\n declaration.name.elements.some((item) => item.name.getText(config.ast) === name) &&\n declaration.initializer &&\n ts.isCallExpression(declaration.initializer) &&\n declaration.initializer.expression.getText(config.ast) === \"require\"\n ) {\n const module = declaration.initializer.arguments[0];\n if (module && ts.isStringLiteral(module))\n kind = module.text.replace(\"@duraxis/storage-\", \"\");\n }\n }\n }\n const options = body.arguments?.[0];\n let directory =\n options && ts.isObjectLiteralExpression(options)\n ? property(options, \"directory\")?.initializer\n : undefined;\n if (\n directory &&\n ts.isCallExpression(directory) &&\n directory.arguments.length === 1 &&\n directory.expression.getText(config.ast) === \"resolvePath\"\n )\n directory = directory.arguments[0];\n if (\n directory &&\n ts.isBinaryExpression(directory) &&\n directory.operatorToken.kind === ts.SyntaxKind.QuestionQuestionToken\n )\n directory = directory.right;\n return {\n driver: kind,\n directory: directory && ts.isStringL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AAG,oBAAoB,SAAS,GAC7B;QAAA,MAAM,eAAe,UAAU,gBAAgB,cAClD,IACE,GAAG,uBAAuB,YAAY,IAAI,KAC1C,YAAY,KAAK,SAAS,MAAM,SAAS,KAAK,KAAK,QAAQ,OAAO,GAAG,MAAM,IAAI,KAC/E,YAAY,eACZ,GAAG,iBAAiB,YAAY,WAAW,KAC3C,YAAY,YAAY,WAAW,QAAQ,OAAO,GAAG,MAAM,WAC3D;IACA,MAAM,SAAS,YAAY,YAAY,UAAU;IACjD,IAAI,UAAU,GAAG,gBAAgB,MAAM,GACrC,OAAO,OAAO,KAAK,QAAQ,qBAAqB,EAAE;GACtD;;CAEN;CACA,MAAM,UAAU,KAAK,YAAY;CACjC,IAAI,YACF,WAAW,GAAG,0BAA0B,OAAO,IAC3C,SAAS,SAAS,WAAW,CAAC,EAAE,cAChC,KAAA;CACN,IACE,aACA,GAAG,iBAAiB,SAAS,KAC7B,UAAU,UAAU,WAAW,KAC/B,UAAU,WAAW,QAAQ,OAAO,GAAG,MAAM,eAE7C,YAAY,UAAU,UAAU;CAClC,IACE,aACA,GAAG,mBAAmB,SAAS,KAC/B,UAAU,cAAc,SAAS,GAAG,WAAW,uBAE/C,YAAY,UAAU;CACxB,OAAO;EACL,QAAQ;EACR,WAAW,aAAa,GAAG,gBAAgB,SAAS,IAAI,UAAU,OAAO,KAAA;CAC3E;AACF"}
@@ -0,0 +1,10 @@
1
+ import type { InitializationOptions } from "../init/initialization-options.js";
2
+ import type { ProjectConfiguration } from "../init/initialization-planner.js";
3
+ export declare function extensions(options: Pick<InitializationOptions, "language" | "moduleFormat">): {
4
+ source: string;
5
+ runtime: string;
6
+ };
7
+ export declare function entitySource(name: string, collection: string, language: string, format: string): string;
8
+ export declare function connectionSource(options: InitializationOptions, name: string, alias: string): string;
9
+ export declare function configurationSource(managed: ProjectConfiguration, storageAlias?: string): string;
10
+ export declare function projectSources(options: InitializationOptions, connection?: string): Record<string, string>;
@@ -0,0 +1,2 @@
1
+ export type Prompt = (question: string, fallback: string, choices?: readonly string[]) => Promise<string>;
2
+ export declare function withPrompts<T>(run: (ask: Prompt) => Promise<T>, signal?: AbortSignal): Promise<T>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@duraxis/cli",
3
- "version": "0.3.0",
4
- "description": "Standalone migration CLI for Duraxis.",
3
+ "version": "0.5.1",
4
+ "description": "Project setup, configuration, migrations and administration tooling for Duraxis.",
5
5
  "license": "ISC",
6
6
  "author": "João Paulo Dias <joaopdias.dev@gmail.com>",
7
7
  "keywords": [
@@ -9,7 +9,12 @@
9
9
  "database",
10
10
  "embedded",
11
11
  "transactions",
12
- "typescript"
12
+ "typescript",
13
+ "cli",
14
+ "configuration",
15
+ "migrations",
16
+ "nestjs",
17
+ "administration"
13
18
  ],
14
19
  "repository": {
15
20
  "type": "git",
@@ -46,14 +51,14 @@
46
51
  ],
47
52
  "sideEffects": false,
48
53
  "dependencies": {
49
- "@duraxis/core": "0.4.0",
50
- "@duraxis/migrations": "0.3.0",
51
- "@duraxis/orm": "0.4.0",
54
+ "@duraxis/core": "0.5.0",
55
+ "@duraxis/migrations": "0.3.1",
56
+ "@duraxis/orm": "0.5.0",
52
57
  "typescript": "5.9.3"
53
58
  },
54
59
  "devDependencies": {
55
- "@duraxis/storage-memory": "0.2.0",
56
- "@duraxis/storage-disk": "0.2.0",
60
+ "@duraxis/storage-memory": "0.2.1",
61
+ "@duraxis/storage-disk": "0.2.1",
57
62
  "reflect-metadata": "^0.2.2"
58
63
  },
59
64
  "bin": {