@apso/cli 0.46.1 → 0.46.3

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.
@@ -124,8 +124,16 @@ class Migrate extends base_command_1.default {
124
124
  verified = result.ok;
125
125
  if (!this.json)
126
126
  (0, verify_1.report)((s) => this.log(s), { ...result, findings: [] }, false);
127
- if (!result.ok)
128
- this.fail(`The migration in ${written.file} failed its test. Fix the answers in ${written.planFile} or the .apsorc, then run apso migrate again.`, { file: written.file, planFile: written.planFile, steps: result.steps });
127
+ if (!result.ok) {
128
+ // Don't keep a migration that failed: the next run would read it as
129
+ // deployed and find nothing to migrate. The working plan keeps the
130
+ // answers and the baseline, so a rerun picks up where this one stopped.
131
+ for (const f of [written.file, written.planFile])
132
+ fs.rmSync(path.resolve(cwd, f), { force: true });
133
+ save();
134
+ const planRel = path.relative(cwd, planPath);
135
+ this.fail(`The migration failed its test, so it was not kept. Change an answer in ${planRel} or the .apsorc, then run apso migrate again. If the data loss is intended, rerun with --accept-loss <table.column>.`, { plan: planRel, steps: result.steps });
136
+ }
129
137
  }
130
138
  this.say(`\nReview and commit ${written.file} and ${written.planFile}, then deploy.`);
131
139
  if (verified === true && !flags.seed)
@@ -40,7 +40,7 @@ class BaseGenerator {
40
40
  * Render a template file with the given data
41
41
  */
42
42
  async renderTemplate(templatePath, data) {
43
- const content = await this.templateEngine.renderFileAsync(templatePath, (0, file_system_1.withGeneratedMeta)(data));
43
+ const content = await this.templateEngine.renderFileAsync(templatePath, data);
44
44
  return content;
45
45
  }
46
46
  /**
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const path = tslib_1.__importStar(require("path"));
6
6
  const Eta = tslib_1.__importStar(require("eta"));
7
7
  const base_1 = require("./base");
8
- // Utilities available for future use: createFile, withGeneratedMeta from "../utils/file-system"
8
+ // Utilities available for future use: createFile from "../utils/file-system"
9
9
  const field_1 = require("../utils/field");
10
10
  const relationships_1 = require("../utils/relationships");
11
11
  const parse_1 = require("../utils/relationships/parse");
@@ -365,8 +365,6 @@ class TypeScriptGenerator extends base_1.BaseGenerator {
365
365
  authEntities,
366
366
  jwt,
367
367
  apiKey,
368
- generatedAt: new Date().toISOString(),
369
- generatedBy: "Apso CLI",
370
368
  };
371
369
  // Generate auth.guard.ts if auth is configured
372
370
  if (hasAuth) {
@@ -2,7 +2,6 @@
2
2
  * AuthGuard - application API keys stored as SHA-256 hashes on <%= it.apiKey.apiKeyEntity %>
3
3
  *
4
4
  * Auto-generated by Apso CLI from .apsorc auth configuration
5
- * Generated at: <%= it.generatedAt %>
6
5
  *
7
6
  * This guard:
8
7
  * - Reads the key from the <%= it.apiKey.apiKeyHeader %> header
@@ -2,7 +2,6 @@
2
2
  * AuthGuard - Authentication guard for <%= it.authConfig.provider %> provider
3
3
  *
4
4
  * Auto-generated by Apso CLI from .apsorc auth configuration
5
- * Generated at: <%= it.generatedAt %>
6
5
  *
7
6
  * This guard:
8
7
  * - Validates session tokens from cookies/headers
@@ -31,7 +31,6 @@ import { <%= entity %> } from '../<%= entity %>/<%= entity %>.entity';
31
31
  * GuardsModule provides authentication and scope-based data isolation guards.
32
32
  *
33
33
  * Auto-generated from .apsorc configuration.
34
- * Generated at: <%= it.generatedAt %>
35
34
  *
36
35
  * Usage:
37
36
  * 1. Import GuardsModule in your AppModule
@@ -2,7 +2,6 @@
2
2
  * AuthGuard - verifies <%= it.jwt.provider %> JWTs against the issuer's JWKS
3
3
  *
4
4
  * Auto-generated by Apso CLI from .apsorc auth configuration
5
- * Generated at: <%= it.generatedAt %>
6
5
  *
7
6
  * This guard:
8
7
  * - Reads the token from the Authorization: Bearer header
@@ -8,7 +8,3 @@ export declare const createFile: (file: string, content: string) => Promise<void
8
8
  */
9
9
  export declare const removeStaleGeneratedFiles: (dir: string, keep: Set<string>) => string[];
10
10
  export declare const createDirectoryContents: (templatePath: string, newProjectPath: string, apiType: string) => void;
11
- export declare function withGeneratedMeta<T extends object>(data: T): T & {
12
- generatedAt: string;
13
- generatedBy: string;
14
- };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withGeneratedMeta = exports.createDirectoryContents = exports.removeStaleGeneratedFiles = exports.createFile = void 0;
3
+ exports.createDirectoryContents = exports.removeStaleGeneratedFiles = exports.createFile = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const path = tslib_1.__importStar(require("path"));
6
6
  const fs = tslib_1.__importStar(require("fs"));
@@ -80,11 +80,3 @@ const writeFile = (fileName, origFilePath, writePath, mode, apiType) => {
80
80
  fs.chmodSync(fileWritePath, mode);
81
81
  }
82
82
  };
83
- function withGeneratedMeta(data) {
84
- return {
85
- ...data,
86
- generatedAt: new Date().toISOString(),
87
- generatedBy: process.env.USER || process.env.USERNAME || "unknown",
88
- };
89
- }
90
- exports.withGeneratedMeta = withGeneratedMeta;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@apso/cli",
3
- "version": "0.46.1",
3
+ "version": "0.46.3",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@apso/cli",
9
- "version": "0.46.1",
9
+ "version": "0.46.3",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@apso/schema-tools": "^0.2.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.46.1",
2
+ "version": "0.46.3",
3
3
  "commands": {
4
4
  "config": {
5
5
  "id": "config",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apso/cli",
3
- "version": "0.46.1",
3
+ "version": "0.46.3",
4
4
  "mcpName": "io.github.apsoai/apso",
5
5
  "description": "Apso CLI",
6
6
  "author": "Apso by Mavric - @mavric",