@apso/cli 0.15.0 → 0.15.2

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 (35) hide show
  1. package/dist/commands/config.js +3 -3
  2. package/dist/commands/dev.d.ts +1 -0
  3. package/dist/commands/dev.js +10 -9
  4. package/dist/commands/init.js +2 -12
  5. package/dist/commands/login.js +1 -1
  6. package/dist/commands/mcp/serve.js +8 -1
  7. package/dist/commands/migrate.js +1 -0
  8. package/dist/commands/schema/diff.js +3 -3
  9. package/dist/lib/doctor/checks.js +2 -2
  10. package/dist/lib/generators/go.js +1 -4
  11. package/dist/lib/generators/python.js +1 -1
  12. package/dist/lib/migrate/sandbox.js +8 -5
  13. package/dist/lib/migrate/snapshot.d.ts +0 -7
  14. package/dist/lib/migrate/snapshot.js +2 -1
  15. package/dist/lib/templates/entities/entity-col-bigint.eta +1 -1
  16. package/dist/lib/templates/entities/entity-col-boolean.eta +1 -1
  17. package/dist/lib/templates/entities/entity-col-bytea.eta +1 -1
  18. package/dist/lib/templates/entities/entity-col-decimal.eta +1 -1
  19. package/dist/lib/templates/entities/entity-col-double.eta +1 -1
  20. package/dist/lib/templates/entities/entity-col-enum.eta +1 -0
  21. package/dist/lib/templates/entities/entity-col-float.eta +1 -1
  22. package/dist/lib/templates/entities/entity-col-integer.eta +1 -1
  23. package/dist/lib/templates/entities/entity-col-interval.eta +1 -1
  24. package/dist/lib/templates/entities/entity-col-money.eta +1 -1
  25. package/dist/lib/templates/entities/entity-col-numeric.eta +1 -1
  26. package/dist/lib/templates/entities/entity-col-real.eta +1 -1
  27. package/dist/lib/templates/entities/entity-col-smallint.eta +1 -1
  28. package/dist/lib/templates/entities/entity-col-time.eta +1 -1
  29. package/dist/lib/templates/entities/entity-col-timetz.eta +1 -1
  30. package/dist/lib/templates/entities/entity-col-uuid.eta +1 -1
  31. package/dist/lib/utils/schema-convert.js +1 -1
  32. package/dist/lib/utils/spinner.js +2 -1
  33. package/npm-shrinkwrap.json +43 -17
  34. package/oclif.manifest.json +24 -1
  35. package/package.json +11 -3
@@ -13,11 +13,11 @@ const VALID_KEYS = [
13
13
  "telemetryDisabled",
14
14
  "defaultWorkspace",
15
15
  ];
16
- const BOOLEAN_KEYS = [
16
+ const BOOLEAN_KEYS = new Set([
17
17
  "verbose",
18
18
  "noColor",
19
19
  "telemetryDisabled",
20
- ];
20
+ ]);
21
21
  function parseBoolean(value) {
22
22
  const lower = value.toLowerCase();
23
23
  if (lower === "true" || lower === "1")
@@ -62,7 +62,7 @@ class Config extends base_command_1.default {
62
62
  if (!VALID_KEYS.includes(key)) {
63
63
  this.error(`Unknown key: ${key}\nValid keys: ${VALID_KEYS.join(", ")}`);
64
64
  }
65
- if (BOOLEAN_KEYS.includes(key)) {
65
+ if (BOOLEAN_KEYS.has(key)) {
66
66
  const boolVal = parseBoolean(value);
67
67
  if (boolVal === null) {
68
68
  this.error(`Invalid boolean value: ${value}. Use true/false or 1/0.`);
@@ -8,6 +8,7 @@ export default class Dev extends BaseCommand {
8
8
  build: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
9
  };
10
10
  private children;
11
+ private cleanup;
11
12
  run(): Promise<void>;
12
13
  /**
13
14
  * TypeScript: run `npm run dev` which reads DATABASE_TYPE from .env.
@@ -11,6 +11,11 @@ class Dev extends base_command_1.default {
11
11
  constructor() {
12
12
  super(...arguments);
13
13
  this.children = [];
14
+ this.cleanup = () => {
15
+ for (const child of this.children) {
16
+ child.kill("SIGTERM");
17
+ }
18
+ };
14
19
  }
15
20
  async run() {
16
21
  const { flags } = await this.parse(Dev);
@@ -22,13 +27,8 @@ class Dev extends base_command_1.default {
22
27
  this.log(`Detected language: ${language}`);
23
28
  this.log(`Database type: ${databaseType}`);
24
29
  // Set up signal forwarding for clean shutdown
25
- const cleanup = () => {
26
- for (const child of this.children) {
27
- child.kill("SIGTERM");
28
- }
29
- };
30
- process.on("SIGINT", cleanup);
31
- process.on("SIGTERM", cleanup);
30
+ process.on("SIGINT", this.cleanup);
31
+ process.on("SIGTERM", this.cleanup);
32
32
  try {
33
33
  switch (language) {
34
34
  case "typescript":
@@ -45,8 +45,8 @@ class Dev extends base_command_1.default {
45
45
  }
46
46
  }
47
47
  finally {
48
- process.removeListener("SIGINT", cleanup);
49
- process.removeListener("SIGTERM", cleanup);
48
+ process.removeListener("SIGINT", this.cleanup);
49
+ process.removeListener("SIGTERM", this.cleanup);
50
50
  }
51
51
  }
52
52
  /**
@@ -124,6 +124,7 @@ class Dev extends base_command_1.default {
124
124
  return "typescript";
125
125
  }
126
126
  try {
127
+ // eslint-disable-next-line unicorn/prefer-json-parse-buffer -- TS types JSON.parse as string-only
127
128
  const content = fs.readFileSync(apsorcPath, "utf-8");
128
129
  const config = JSON.parse(content);
129
130
  return config.language || "typescript";
@@ -24,12 +24,7 @@ class Init extends base_command_1.default {
24
24
  this.error("An Apso project already exists in this directory. Run commands from a different directory or remove .apsorc / .apso/link.json first.");
25
25
  }
26
26
  const isAuthenticated = !flags["skip-platform"] && config_1.credentials.isValid();
27
- if (isAuthenticated) {
28
- await this.runAuthenticated(flags);
29
- }
30
- else {
31
- await this.runOffline(flags);
32
- }
27
+ await (isAuthenticated ? this.runAuthenticated(flags) : this.runOffline(flags));
33
28
  }
34
29
  async runAuthenticated(flags) {
35
30
  // Ask: create new or clone existing
@@ -44,12 +39,7 @@ class Init extends base_command_1.default {
44
39
  ],
45
40
  },
46
41
  ]);
47
- if (action === "clone") {
48
- await this.cloneExisting();
49
- }
50
- else {
51
- await this.createNew(flags);
52
- }
42
+ await (action === "clone" ? this.cloneExisting() : this.createNew(flags));
53
43
  }
54
44
  async cloneExisting() {
55
45
  // Select workspace
@@ -154,7 +154,7 @@ class Login extends base_command_1.default {
154
154
  });
155
155
  this.log(`Logged in as ${profile.email}`);
156
156
  }
157
- catch (error) {
157
+ catch {
158
158
  config_1.credentials.clear();
159
159
  this.error("Invalid token. Please check your token and try again.");
160
160
  }
@@ -4,7 +4,9 @@ const tslib_1 = require("tslib");
4
4
  const core_1 = require("@oclif/core");
5
5
  const fs = tslib_1.__importStar(require("fs"));
6
6
  const path = tslib_1.__importStar(require("path"));
7
+ // eslint-disable-next-line node/no-missing-import -- eslint-plugin-node cannot resolve package "exports" subpaths
7
8
  const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
9
+ // eslint-disable-next-line node/no-missing-import -- eslint-plugin-node cannot resolve package "exports" subpaths
8
10
  const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
9
11
  const zod_1 = require("zod");
10
12
  const base_command_1 = tslib_1.__importDefault(require("../../lib/base-command"));
@@ -233,7 +235,7 @@ class McpServe extends base_command_1.default {
233
235
  .boolean()
234
236
  .optional()
235
237
  .describe("Skip code formatting after generation (default: false)"),
236
- }, async ({ language, skip_format }) => {
238
+ }, async ({ language }) => {
237
239
  try {
238
240
  const configPath = (0, apsorc_parser_1.findConfigPath)();
239
241
  if (!configPath) {
@@ -301,12 +303,14 @@ class McpServe extends base_command_1.default {
301
303
  const enumFiles = await generator.generateEnums(entities, lowerCaseApiType);
302
304
  for (const file of enumFiles) {
303
305
  const fullPath = path.join(autogenPath, file.path);
306
+ // eslint-disable-next-line no-await-in-loop
304
307
  await (0, file_system_1.createFile)(fullPath, file.content);
305
308
  filesGenerated.push(file.path);
306
309
  }
307
310
  // Generate per-entity files
308
311
  for (const entity of entities) {
309
312
  const entityRelationships = relationshipMap[entity.name] || [];
313
+ // eslint-disable-next-line no-await-in-loop
310
314
  const allFiles = await Promise.all([
311
315
  generator.generateEntity({
312
316
  entity,
@@ -344,6 +348,7 @@ class McpServe extends base_command_1.default {
344
348
  for (const files of allFiles) {
345
349
  for (const file of files) {
346
350
  const fullPath = path.join(autogenPath, file.path);
351
+ // eslint-disable-next-line no-await-in-loop
347
352
  await (0, file_system_1.createFile)(fullPath, file.content);
348
353
  filesGenerated.push(file.path);
349
354
  }
@@ -353,6 +358,7 @@ class McpServe extends base_command_1.default {
353
358
  const guardFiles = await generator.generateGuards(entities, auth);
354
359
  for (const file of guardFiles) {
355
360
  const fullPath = path.join(autogenPath, file.path);
361
+ // eslint-disable-next-line no-await-in-loop
356
362
  await (0, file_system_1.createFile)(fullPath, file.content);
357
363
  filesGenerated.push(file.path);
358
364
  }
@@ -360,6 +366,7 @@ class McpServe extends base_command_1.default {
360
366
  const indexFiles = await generator.generateIndexModule(entities, lowerCaseApiType);
361
367
  for (const file of indexFiles) {
362
368
  const fullPath = path.join(autogenPath, file.path);
369
+ // eslint-disable-next-line no-await-in-loop
363
370
  await (0, file_system_1.createFile)(fullPath, file.content);
364
371
  filesGenerated.push(file.path);
365
372
  }
@@ -75,6 +75,7 @@ class Migrate extends base_command_1.default {
75
75
  });
76
76
  for (const file of migrationFiles) {
77
77
  const fullPath = path.join(process.cwd(), file.path);
78
+ // eslint-disable-next-line no-await-in-loop
78
79
  await (0, file_system_1.createFile)(fullPath, file.content);
79
80
  this.log(`Generated migration file: ${file.path}`);
80
81
  }
@@ -8,9 +8,9 @@ const apsorc_parser_1 = require("../../lib/apsorc-parser");
8
8
  const schema_convert_1 = require("../../lib/utils/schema-convert");
9
9
  // Inline ANSI color helpers (no dependency needed)
10
10
  const useColor = () => !config_1.globalConfig.read().noColor;
11
- const green = (s) => useColor() ? `\x1b[32m${s}\x1b[0m` : s;
12
- const red = (s) => useColor() ? `\x1b[31m${s}\x1b[0m` : s;
13
- const yellow = (s) => useColor() ? `\x1b[33m${s}\x1b[0m` : s;
11
+ const green = (s) => useColor() ? `\u001B[32m${s}\u001B[0m` : s;
12
+ const red = (s) => useColor() ? `\u001B[31m${s}\u001B[0m` : s;
13
+ const yellow = (s) => useColor() ? `\u001B[33m${s}\u001B[0m` : s;
14
14
  class SchemaDiff extends base_command_1.default {
15
15
  async run() {
16
16
  // Auth guard
@@ -40,7 +40,7 @@ function checkPkStrategy(ctx) {
40
40
  }
41
41
  const content = fs.readFileSync(entityPath, "utf-8");
42
42
  // The correct pattern is @PrimaryGeneratedColumn('uuid')
43
- const hasPrimaryGenerated = /PrimaryGeneratedColumn\s*\(\s*['"]uuid['"]\s*\)/.test(content);
43
+ const hasPrimaryGenerated = /PrimaryGeneratedColumn\s*\(\s*["']uuid["']\s*\)/.test(content);
44
44
  // Wrong patterns: @PrimaryColumn() or @PrimaryColumn({ type: 'uuid' }) without generation
45
45
  const hasPrimaryColumnOnly = /PrimaryColumn\s*\(/.test(content) && !hasPrimaryGenerated;
46
46
  if (hasPrimaryColumnOnly) {
@@ -87,7 +87,7 @@ function checkUnusedImports(ctx) {
87
87
  const lines = content.split("\n");
88
88
  // Find import lines from typeorm
89
89
  for (const line of lines) {
90
- const importMatch = line.match(/import\s*\{([^}]+)\}\s*from\s*['"]typeorm['"]/);
90
+ const importMatch = line.match(/import\s*{([^}]+)}\s*from\s*["']typeorm["']/);
91
91
  if (!importMatch)
92
92
  continue;
93
93
  const imports = importMatch[1]
@@ -285,7 +285,7 @@ class GoGenerator extends base_1.BaseGenerator {
285
285
  }
286
286
  const timestamp = new Date()
287
287
  .toISOString()
288
- .replace(/[-:T]/g, "")
288
+ .replace(/[:T-]/g, "")
289
289
  .slice(0, 14);
290
290
  const name = migrationName || "auto";
291
291
  const filename = `${timestamp}_${name}.sql`;
@@ -346,9 +346,6 @@ ${downStatements}
346
346
  entities: entitiesData,
347
347
  });
348
348
  // Generate model registry for AutoMigrate support
349
- const modelImports = entities
350
- .map((e) => `\t// ${e.name} model`)
351
- .join("\n");
352
349
  const modelRefs = entities
353
350
  .map((e) => `\t\t&${(0, casing_1.pascalCase)(e.name)}{},`)
354
351
  .join("\n");
@@ -213,7 +213,7 @@ class PythonGenerator extends base_1.BaseGenerator {
213
213
  }
214
214
  const timestamp = new Date()
215
215
  .toISOString()
216
- .replace(/[-:T]/g, "")
216
+ .replace(/[:T-]/g, "")
217
217
  .slice(0, 14);
218
218
  const revision = timestamp;
219
219
  const name = migrationName || "auto";
@@ -12,6 +12,7 @@
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.resetSandbox = exports.applyMigration = exports.runMigrationSandbox = void 0;
14
14
  const tslib_1 = require("tslib");
15
+ /* eslint-disable new-cap -- TypeORM decorator factories (Entity, Column, ...) are applied programmatically */
15
16
  const fs = tslib_1.__importStar(require("fs"));
16
17
  const path = tslib_1.__importStar(require("path"));
17
18
  const paths_1 = require("../config/paths");
@@ -59,7 +60,7 @@ async function resetPGliteSingleton() {
59
60
  * between runs.
60
61
  */
61
62
  function buildEntityClasses(entities, relationshipMap = {}) {
62
- var _a, _b;
63
+ var _a, _b, _c;
63
64
  clearTypeOrmMetadata();
64
65
  const typeorm = require("typeorm");
65
66
  const classes = [];
@@ -110,7 +111,7 @@ function buildEntityClasses(entities, relationshipMap = {}) {
110
111
  if (field.type === "enum" && field.values) {
111
112
  colOpts.enum = field.values;
112
113
  }
113
- if (field.length)
114
+ if (((_c = field.length) !== null && _c !== void 0 ? _c : 0) > 0)
114
115
  colOpts.length = field.length;
115
116
  if (field.precision)
116
117
  colOpts.precision = field.precision;
@@ -253,10 +254,10 @@ async function createPGliteDataSource(entityClasses) {
253
254
  const pgliteModule = await Promise.resolve().then(() => tslib_1.__importStar(require("typeorm-pglite")));
254
255
  PGliteDriver = pgliteModule.PGliteDriver;
255
256
  }
256
- catch (e) {
257
+ catch (error) {
257
258
  throw new Error("Migration sandbox requires typeorm-pglite and @electric-sql/pglite.\n" +
258
259
  "Install them with: npm install typeorm @electric-sql/pglite typeorm-pglite\n" +
259
- `Original error: ${e instanceof Error ? e.message : e}`);
260
+ `Original error: ${error instanceof Error ? error.message : error}`);
260
261
  }
261
262
  // Create a driver. typeorm-pglite uses a singleton PGliteInstance
262
263
  // so multiple DataSources share the same in-process database.
@@ -394,7 +395,9 @@ async function runMigrationSandbox(current, projectDir) {
394
395
  try {
395
396
  await resetPGliteSingleton();
396
397
  }
397
- catch { /* ignore */ }
398
+ catch {
399
+ /* ignore */
400
+ }
398
401
  return {
399
402
  needed: true,
400
403
  success: false,
@@ -71,11 +71,4 @@ export declare function writeSnapshot(schema: ApsorcSnapshot, projectDir?: strin
71
71
  * Delete the snapshot and sandbox directory contents (for --reset).
72
72
  */
73
73
  export declare function resetSnapshot(projectDir?: string): void;
74
- /**
75
- * Detect whether the current schema differs from the stored snapshot.
76
- *
77
- * Compares entity names, field definitions, and relationships using
78
- * deterministic JSON serialization. Returns true if any change is detected,
79
- * or if no snapshot exists (first run).
80
- */
81
74
  export declare function hasChanges(current: ComparableSchema, snapshot: ApsorcSnapshot | null): boolean;
@@ -27,6 +27,7 @@ function readSnapshot(projectDir) {
27
27
  return null;
28
28
  }
29
29
  try {
30
+ // eslint-disable-next-line unicorn/prefer-json-parse-buffer -- TS types JSON.parse as string-only
30
31
  const content = fs.readFileSync(snapshotPath, "utf8");
31
32
  return JSON.parse(content);
32
33
  }
@@ -62,11 +63,11 @@ exports.resetSnapshot = resetSnapshot;
62
63
  * deterministic JSON serialization. Returns true if any change is detected,
63
64
  * or if no snapshot exists (first run).
64
65
  */
66
+ const normalize = (obj) => JSON.stringify(obj);
65
67
  function hasChanges(current, snapshot) {
66
68
  if (!snapshot) {
67
69
  return true;
68
70
  }
69
- const normalize = (obj) => JSON.stringify(obj);
70
71
  // Compare entity count
71
72
  if (current.entities.length !== snapshot.entities.length) {
72
73
  return true;
@@ -1,6 +1,6 @@
1
1
  <% const {field} = it; %>
2
2
 
3
- @Column({ "type": "bigint"<% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
3
+ @Column({ "type": "bigint", nullable: <%= Boolean(field.nullable) %><% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
4
4
  <% if (field.index ) {%>
5
5
  @Index()
6
6
  <% } %>
@@ -3,7 +3,7 @@
3
3
  @IsOptional({ groups: [CREATE, UPDATE] })
4
4
  @IsBoolean({ always: true })
5
5
 
6
- @Column({ type: 'boolean', default: <%= Boolean(field.default) || false %> })
6
+ @Column({ type: 'boolean', nullable: <%= Boolean(field.nullable) %>, default: <%= Boolean(field.default) || false %> })
7
7
  <% if (field.index ) {%>
8
8
  @Index()
9
9
  <% } %>
@@ -1,6 +1,6 @@
1
1
  <% const {field} = it; %>
2
2
 
3
- @Column({ "type": "bytea"<% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
3
+ @Column({ "type": "bytea", nullable: <%= Boolean(field.nullable) %><% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
4
4
  <% if (field.index ) {%>
5
5
  @Index()
6
6
  <% } %>
@@ -1,6 +1,6 @@
1
1
  <% const {field} = it; %>
2
2
 
3
- @Column({ "type": "decimal", precision: <%= field.precision || 10 %>, scale: <%= field.scale || 2 %><% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
3
+ @Column({ "type": "decimal", precision: <%= field.precision || 10 %>, scale: <%= field.scale || 2 %>, nullable: <%= Boolean(field.nullable) %><% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
4
4
  <% if (field.index ) {%>
5
5
  @Index()
6
6
  <% } %>
@@ -1,6 +1,6 @@
1
1
  <% const {field} = it; %>
2
2
 
3
- @Column({ "type": "float8"<% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
3
+ @Column({ "type": "float8", nullable: <%= Boolean(field.nullable) %><% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
4
4
  <% if (field.index ) {%>
5
5
  @Index()
6
6
  <% } %>
@@ -2,6 +2,7 @@
2
2
 
3
3
  @Column({
4
4
  type: 'enum',
5
+ nullable: <%= Boolean(field.nullable) %>,
5
6
  enum: enums.<%= field.dataType%>,
6
7
  default: enums.<%= field.dataType%>.<%= field.default.toLowerCase().replace(/[^a-z0-9]/g, '_').replace(/^(\d)/, '_$1').replace(/_+/g, '_').replace(/_$/, '') %>
7
8
  })
@@ -1,6 +1,6 @@
1
1
  <% const {field} = it; %>
2
2
 
3
- @Column({ "type": "decimal"<% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
3
+ @Column({ "type": "decimal", nullable: <%= Boolean(field.nullable) %><% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
4
4
  <% if (field.index ) {%>
5
5
  @Index()
6
6
  <% } %>
@@ -1,6 +1,6 @@
1
1
  <% const {field} = it; %>
2
2
 
3
- @Column({ "type": "int"<% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
3
+ @Column({ "type": "int", nullable: <%= Boolean(field.nullable) %><% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
4
4
  <% if (field.index ) {%>
5
5
  @Index()
6
6
  <% } %>
@@ -1,6 +1,6 @@
1
1
  <% const {field} = it; %>
2
2
 
3
- @Column({ "type": "interval"<% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
3
+ @Column({ "type": "interval", nullable: <%= Boolean(field.nullable) %><% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
4
4
  <% if (field.index ) {%>
5
5
  @Index()
6
6
  <% } %>
@@ -1,6 +1,6 @@
1
1
  <% const {field} = it; %>
2
2
 
3
- @Column({ "type": "money"<% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
3
+ @Column({ "type": "money", nullable: <%= Boolean(field.nullable) %><% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
4
4
  <% if (field.index ) {%>
5
5
  @Index()
6
6
  <% } %>
@@ -1,6 +1,6 @@
1
1
  <% const {field} = it; %>
2
2
 
3
- @Column({ "type": "numeric", precision: <%= field.precision || 10 %>, scale: <%= field.scale || 2 %><% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
3
+ @Column({ "type": "numeric", precision: <%= field.precision || 10 %>, scale: <%= field.scale || 2 %>, nullable: <%= Boolean(field.nullable) %><% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
4
4
  <% if (field.index ) {%>
5
5
  @Index()
6
6
  <% } %>
@@ -1,6 +1,6 @@
1
1
  <% const {field} = it; %>
2
2
 
3
- @Column({ "type": "real"<% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
3
+ @Column({ "type": "real", nullable: <%= Boolean(field.nullable) %><% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
4
4
  <% if (field.index ) {%>
5
5
  @Index()
6
6
  <% } %>
@@ -1,6 +1,6 @@
1
1
  <% const {field} = it; %>
2
2
 
3
- @Column({ "type": "smallint"<% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
3
+ @Column({ "type": "smallint", nullable: <%= Boolean(field.nullable) %><% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
4
4
  <% if (field.index ) {%>
5
5
  @Index()
6
6
  <% } %>
@@ -1,6 +1,6 @@
1
1
  <% const {field} = it; %>
2
2
 
3
- @Column({ "type": "time"<% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
3
+ @Column({ "type": "time", nullable: <%= Boolean(field.nullable) %><% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
4
4
  <% if (field.index ) {%>
5
5
  @Index()
6
6
  <% } %>
@@ -1,6 +1,6 @@
1
1
  <% const {field} = it; %>
2
2
 
3
- @Column({ "type": "timetz"<% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
3
+ @Column({ "type": "timetz", nullable: <%= Boolean(field.nullable) %><% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
4
4
  <% if (field.index ) {%>
5
5
  @Index()
6
6
  <% } %>
@@ -3,7 +3,7 @@
3
3
  <% if (field.primary ) {%>
4
4
  @PrimaryGeneratedColumn('uuid')
5
5
  <% } else { %>
6
- @Column({ "type": "uuid"<% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
6
+ @Column({ "type": "uuid", nullable: <%= Boolean(field.nullable) %><% if (field.default !== null) {%>, default: <%= field.default %><% } %> })
7
7
  <% if (field.index ) {%>
8
8
  @Index()
9
9
  <% } %>
@@ -147,7 +147,7 @@ exports.serviceSchemaToApsorc = serviceSchemaToApsorc;
147
147
  */
148
148
  function sortKeys(value) {
149
149
  if (Array.isArray(value)) {
150
- return value.map(sortKeys);
150
+ return value.map((item) => sortKeys(item));
151
151
  }
152
152
  if (value !== null && typeof value === "object") {
153
153
  const sorted = {};
@@ -39,7 +39,8 @@ async function createSpinner(text) {
39
39
  const config = config_1.globalConfig.read();
40
40
  try {
41
41
  // Dynamic import to keep ora optional at startup
42
- const ora = (await Promise.resolve().then(() => __importStar(require("ora")))).default;
42
+ const oraModule = await Promise.resolve().then(() => __importStar(require("ora")));
43
+ const ora = oraModule.default;
43
44
  const spinner = ora({
44
45
  text,
45
46
  color: config.noColor ? undefined : "cyan",
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "@apso/cli",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@apso/cli",
9
- "version": "0.15.0",
10
- "license": "MIT",
9
+ "version": "0.15.2",
10
+ "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@electric-sql/pglite": "^0.2.17",
13
13
  "@modelcontextprotocol/sdk": "^1.29.0",
14
14
  "@oclif/core": "^2",
15
15
  "@oclif/plugin-help": "^5",
16
16
  "@oclif/plugin-plugins": "^3",
17
+ "@oclif/plugin-warn-if-update-available": "^2.1.1",
17
18
  "debug": "^4.3.4",
18
19
  "eta": "^2.0.0",
19
20
  "inquirer": "^8.2.7",
@@ -22,7 +23,8 @@
22
23
  "rc": "^1.2.8",
23
24
  "shelljs": "^0.8.5",
24
25
  "typeorm": "^0.3.20",
25
- "typeorm-pglite": "^0.3.4"
26
+ "typeorm-pglite": "^0.3.4",
27
+ "zod": "^4.4.3"
26
28
  },
27
29
  "bin": {
28
30
  "apso": "bin/run"
@@ -1751,9 +1753,10 @@
1751
1753
  }
1752
1754
  },
1753
1755
  "node_modules/@oclif/core": {
1754
- "version": "2.11.10",
1755
- "resolved": "https://registry.npmjs.org/@oclif/core/-/core-2.11.10.tgz",
1756
- "integrity": "sha512-/7Umij3OU++6o+z4U+waJ5nP6IvK9KKEVzz+xsla68YoECLQwz43boUKqYizlNMtTfiwNkiYb5QE+OU/q5qEtA==",
1756
+ "version": "2.16.0",
1757
+ "resolved": "https://registry.npmjs.org/@oclif/core/-/core-2.16.0.tgz",
1758
+ "integrity": "sha512-dL6atBH0zCZl1A1IXCKJgLPrM/wR7K+Wi401E/IvqsK8m2iCHW+0TEOGrans/cuN3oTW+uxIyJFHJ8Im0k4qBw==",
1759
+ "license": "MIT",
1757
1760
  "dependencies": {
1758
1761
  "@types/cli-progress": "^3.11.0",
1759
1762
  "ansi-escapes": "^4.3.2",
@@ -1764,7 +1767,6 @@
1764
1767
  "cli-progress": "^3.12.0",
1765
1768
  "debug": "^4.3.4",
1766
1769
  "ejs": "^3.1.8",
1767
- "fs-extra": "^9.1.0",
1768
1770
  "get-package-type": "^0.1.0",
1769
1771
  "globby": "^11.1.0",
1770
1772
  "hyperlinker": "^1.0.0",
@@ -1774,7 +1776,6 @@
1774
1776
  "natural-orderby": "^2.0.3",
1775
1777
  "object-treeify": "^1.1.33",
1776
1778
  "password-prompt": "^1.1.2",
1777
- "semver": "^7.5.3",
1778
1779
  "slice-ansi": "^4.0.0",
1779
1780
  "string-width": "^4.2.3",
1780
1781
  "strip-ansi": "^6.0.1",
@@ -1840,18 +1841,17 @@
1840
1841
  }
1841
1842
  },
1842
1843
  "node_modules/@oclif/plugin-warn-if-update-available": {
1843
- "version": "2.0.37",
1844
- "resolved": "https://registry.npmjs.org/@oclif/plugin-warn-if-update-available/-/plugin-warn-if-update-available-2.0.37.tgz",
1845
- "integrity": "sha512-rfDNvplwgiwV+QSV4JU96ypmWgNJ6Hk5FEAEAKzqF0v0J8AHwZGpwwYO/MCZSkbc7bfYpkqLx/sxjpMO6j6PmQ==",
1846
- "dev": true,
1844
+ "version": "2.1.1",
1845
+ "resolved": "https://registry.npmjs.org/@oclif/plugin-warn-if-update-available/-/plugin-warn-if-update-available-2.1.1.tgz",
1846
+ "integrity": "sha512-y7eSzT6R5bmTIJbiMMXgOlbBpcWXGlVhNeQJBLBCCy1+90Wbjyqf6uvY0i2WcO4sh/THTJ20qCW80j3XUlgDTA==",
1847
+ "license": "MIT",
1847
1848
  "dependencies": {
1848
- "@oclif/core": "^2.8.2",
1849
+ "@oclif/core": "^2.15.0",
1849
1850
  "chalk": "^4.1.0",
1850
1851
  "debug": "^4.1.0",
1851
- "fs-extra": "^9.0.1",
1852
1852
  "http-call": "^5.2.2",
1853
- "lodash": "^4.17.21",
1854
- "semver": "^7.5.1"
1853
+ "lodash.template": "^4.5.0",
1854
+ "semver": "^7.5.4"
1855
1855
  },
1856
1856
  "engines": {
1857
1857
  "node": ">=12.0.0"
@@ -8333,6 +8333,12 @@
8333
8333
  "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
8334
8334
  "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
8335
8335
  },
8336
+ "node_modules/lodash._reinterpolate": {
8337
+ "version": "3.0.0",
8338
+ "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz",
8339
+ "integrity": "sha512-xYHt68QRoYGjeeM/XOE1uJtvXQAgvszfBhjV4yvsQH0u2i9I6cI6c6/eG4Hh3UAOVn0y/xAXwmTzEay49Q//HA==",
8340
+ "license": "MIT"
8341
+ },
8336
8342
  "node_modules/lodash.memoize": {
8337
8343
  "version": "4.1.2",
8338
8344
  "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
@@ -8345,6 +8351,26 @@
8345
8351
  "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
8346
8352
  "dev": true
8347
8353
  },
8354
+ "node_modules/lodash.template": {
8355
+ "version": "4.18.1",
8356
+ "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.18.1.tgz",
8357
+ "integrity": "sha512-5urZrLnV/VD6zHK5KsVtZgt7H19v51mIzoS0aBNH8yp3I8tbswrEjOABOPY8m8uB7NuibubLrMX+Y0PXsU9X+w==",
8358
+ "deprecated": "This package is deprecated. Use https://socket.dev/npm/package/eta instead.",
8359
+ "license": "MIT",
8360
+ "dependencies": {
8361
+ "lodash._reinterpolate": "^3.0.0",
8362
+ "lodash.templatesettings": "^4.0.0"
8363
+ }
8364
+ },
8365
+ "node_modules/lodash.templatesettings": {
8366
+ "version": "4.2.0",
8367
+ "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz",
8368
+ "integrity": "sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ==",
8369
+ "license": "MIT",
8370
+ "dependencies": {
8371
+ "lodash._reinterpolate": "^3.0.0"
8372
+ }
8373
+ },
8348
8374
  "node_modules/lodash.truncate": {
8349
8375
  "version": "4.4.2",
8350
8376
  "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.15.0",
2
+ "version": "0.15.2",
3
3
  "commands": {
4
4
  "config": {
5
5
  "id": "config",
@@ -9,6 +9,7 @@
9
9
  "pluginAlias": "@apso/cli",
10
10
  "pluginType": "core",
11
11
  "aliases": [],
12
+ "hiddenAliases": [],
12
13
  "examples": [
13
14
  "$ apso config",
14
15
  "$ apso config get apiUrl",
@@ -42,6 +43,7 @@
42
43
  "pluginAlias": "@apso/cli",
43
44
  "pluginType": "core",
44
45
  "aliases": [],
46
+ "hiddenAliases": [],
45
47
  "examples": [
46
48
  "$ apso deploy",
47
49
  "$ apso deploy --yes",
@@ -79,6 +81,7 @@
79
81
  "pluginAlias": "@apso/cli",
80
82
  "pluginType": "core",
81
83
  "aliases": [],
84
+ "hiddenAliases": [],
82
85
  "examples": [
83
86
  "$ apso dev",
84
87
  "$ apso dev --docker",
@@ -115,6 +118,7 @@
115
118
  "pluginAlias": "@apso/cli",
116
119
  "pluginType": "core",
117
120
  "aliases": [],
121
+ "hiddenAliases": [],
118
122
  "examples": [
119
123
  "$ apso doctor",
120
124
  "$ apso doctor --json",
@@ -144,6 +148,7 @@
144
148
  "pluginAlias": "@apso/cli",
145
149
  "pluginType": "core",
146
150
  "aliases": [],
151
+ "hiddenAliases": [],
147
152
  "examples": [
148
153
  "$ apso generate",
149
154
  "$ apso generate --skip-format",
@@ -188,6 +193,7 @@
188
193
  "pluginAlias": "@apso/cli",
189
194
  "pluginType": "core",
190
195
  "aliases": [],
196
+ "hiddenAliases": [],
191
197
  "examples": [
192
198
  "$ apso init",
193
199
  "$ apso init --name my-app --language typescript",
@@ -230,6 +236,7 @@
230
236
  "pluginAlias": "@apso/cli",
231
237
  "pluginType": "core",
232
238
  "aliases": [],
239
+ "hiddenAliases": [],
233
240
  "examples": [
234
241
  "$ apso link",
235
242
  "$ apso link --workspace my-team --service my-api",
@@ -268,6 +275,7 @@
268
275
  "pluginAlias": "@apso/cli",
269
276
  "pluginType": "core",
270
277
  "aliases": [],
278
+ "hiddenAliases": [],
271
279
  "examples": [
272
280
  "$ apso login",
273
281
  "$ apso login --token <api-token>"
@@ -298,6 +306,7 @@
298
306
  "pluginAlias": "@apso/cli",
299
307
  "pluginType": "core",
300
308
  "aliases": [],
309
+ "hiddenAliases": [],
301
310
  "examples": [
302
311
  "$ apso logout"
303
312
  ],
@@ -320,6 +329,7 @@
320
329
  "pluginAlias": "@apso/cli",
321
330
  "pluginType": "core",
322
331
  "aliases": [],
332
+ "hiddenAliases": [],
323
333
  "examples": [
324
334
  "$ apso logs",
325
335
  "$ apso logs <build-id>"
@@ -341,6 +351,7 @@
341
351
  "pluginAlias": "@apso/cli",
342
352
  "pluginType": "core",
343
353
  "aliases": [],
354
+ "hiddenAliases": [],
344
355
  "examples": [
345
356
  "$ apso migrate",
346
357
  "$ apso migrate --apply",
@@ -377,6 +388,7 @@
377
388
  "pluginAlias": "@apso/cli",
378
389
  "pluginType": "core",
379
390
  "aliases": [],
391
+ "hiddenAliases": [],
380
392
  "examples": [
381
393
  "$ apso open",
382
394
  "$ apso open --endpoint",
@@ -408,6 +420,7 @@
408
420
  "pluginAlias": "@apso/cli",
409
421
  "pluginType": "core",
410
422
  "aliases": [],
423
+ "hiddenAliases": [],
411
424
  "examples": [
412
425
  "$ apso projects",
413
426
  "$ apso projects --workspace my-team",
@@ -438,6 +451,7 @@
438
451
  "pluginAlias": "@apso/cli",
439
452
  "pluginType": "core",
440
453
  "aliases": [],
454
+ "hiddenAliases": [],
441
455
  "examples": [
442
456
  "$ apso status"
443
457
  ],
@@ -452,6 +466,7 @@
452
466
  "pluginAlias": "@apso/cli",
453
467
  "pluginType": "core",
454
468
  "aliases": [],
469
+ "hiddenAliases": [],
455
470
  "examples": [
456
471
  "$ apso unlink",
457
472
  "$ apso unlink --yes"
@@ -475,6 +490,7 @@
475
490
  "pluginAlias": "@apso/cli",
476
491
  "pluginType": "core",
477
492
  "aliases": [],
493
+ "hiddenAliases": [],
478
494
  "examples": [
479
495
  "$ apso whoami",
480
496
  "$ apso whoami --json"
@@ -504,6 +520,7 @@
504
520
  "pluginAlias": "@apso/cli",
505
521
  "pluginType": "core",
506
522
  "aliases": [],
523
+ "hiddenAliases": [],
507
524
  "examples": [
508
525
  "$ apso mcp serve",
509
526
  "# In Claude Code settings:",
@@ -528,6 +545,7 @@
528
545
  "pluginAlias": "@apso/cli",
529
546
  "pluginType": "core",
530
547
  "aliases": [],
548
+ "hiddenAliases": [],
531
549
  "examples": [
532
550
  "$ apso schema diff"
533
551
  ],
@@ -542,6 +560,7 @@
542
560
  "pluginAlias": "@apso/cli",
543
561
  "pluginType": "core",
544
562
  "aliases": [],
563
+ "hiddenAliases": [],
545
564
  "examples": [
546
565
  "$ apso schema pull",
547
566
  "$ apso schema pull --yes"
@@ -565,6 +584,7 @@
565
584
  "pluginAlias": "@apso/cli",
566
585
  "pluginType": "core",
567
586
  "aliases": [],
587
+ "hiddenAliases": [],
568
588
  "examples": [
569
589
  "$ apso schema push",
570
590
  "$ apso schema push --yes"
@@ -588,6 +608,7 @@
588
608
  "pluginAlias": "@apso/cli",
589
609
  "pluginType": "core",
590
610
  "aliases": [],
611
+ "hiddenAliases": [],
591
612
  "examples": [
592
613
  "$ apso schema validate",
593
614
  "$ apso schema validate --local"
@@ -611,6 +632,7 @@
611
632
  "pluginType": "core",
612
633
  "hidden": true,
613
634
  "aliases": [],
635
+ "hiddenAliases": [],
614
636
  "examples": [
615
637
  "$ apso init"
616
638
  ],
@@ -626,6 +648,7 @@
626
648
  "pluginType": "core",
627
649
  "hidden": true,
628
650
  "aliases": [],
651
+ "hiddenAliases": [],
629
652
  "examples": [
630
653
  "$ apso generate"
631
654
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apso/cli",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
4
4
  "mcpName": "io.github.apsoai/apso",
5
5
  "description": "Apso CLI",
6
6
  "author": "Apso by Mavric - @mavric",
@@ -29,6 +29,7 @@
29
29
  "@oclif/core": "^2",
30
30
  "@oclif/plugin-help": "^5",
31
31
  "@oclif/plugin-plugins": "^3",
32
+ "@oclif/plugin-warn-if-update-available": "^2.1.1",
32
33
  "debug": "^4.3.4",
33
34
  "eta": "^2.0.0",
34
35
  "inquirer": "^8.2.7",
@@ -37,7 +38,8 @@
37
38
  "rc": "^1.2.8",
38
39
  "shelljs": "^0.8.5",
39
40
  "typeorm": "^0.3.20",
40
- "typeorm-pglite": "^0.3.4"
41
+ "typeorm-pglite": "^0.3.4",
42
+ "zod": "^4.4.3"
41
43
  },
42
44
  "devDependencies": {
43
45
  "@jest/globals": "^29.5.0",
@@ -73,8 +75,14 @@
73
75
  "commands": "./dist/commands",
74
76
  "plugins": [
75
77
  "@oclif/plugin-help",
76
- "@oclif/plugin-plugins"
78
+ "@oclif/plugin-plugins",
79
+ "@oclif/plugin-warn-if-update-available"
77
80
  ],
81
+ "warn-if-update-available": {
82
+ "timeoutInDays": 1,
83
+ "registry": "https://registry.npmjs.org",
84
+ "message": "<%= config.name %> update available: <%= chalk.dim(config.version) %> → <%= chalk.greenBright(latest) %>. Run <%= chalk.cyan('npm i -g @apso/cli') %> to update."
85
+ },
78
86
  "topicSeparator": " ",
79
87
  "topics": {
80
88
  "server": {