@apso/cli 0.53.0 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/import/supabase.js +2 -2
- package/dist/commands/mcp/serve.js +1 -0
- package/dist/commands/schema/validate.js +18 -1
- package/dist/lib/base-command.js +14 -3
- package/dist/lib/config/types.d.ts +5 -0
- package/dist/lib/ddl/change.js +11 -4
- package/dist/lib/ddl/index.d.ts +17 -0
- package/dist/lib/ddl/index.js +35 -5
- package/dist/lib/generators/go.js +5 -2
- package/dist/lib/generators/python.js +5 -2
- package/dist/lib/generators/typescript.js +17 -2
- package/dist/lib/import/introspect.js +18 -12
- package/dist/lib/import/pg-to-apsorc.d.ts +1 -0
- package/dist/lib/import/pg-to-apsorc.js +27 -4
- package/dist/lib/import/types.d.ts +7 -5
- package/dist/lib/telemetry/error-utils.d.ts +74 -0
- package/dist/lib/telemetry/error-utils.js +221 -0
- package/dist/lib/telemetry/internal-constants.d.ts +27 -0
- package/dist/lib/telemetry/internal-constants.js +32 -0
- package/dist/lib/telemetry/internal-detection.d.ts +37 -0
- package/dist/lib/telemetry/internal-detection.js +78 -0
- package/dist/lib/telemetry/telemetry.d.ts +11 -0
- package/dist/lib/telemetry/telemetry.js +197 -3
- package/dist/lib/templates/entities/entity.eta +6 -0
- package/dist/lib/types/constraints.d.ts +14 -0
- package/dist/lib/types/entity.d.ts +3 -1
- package/dist/lib/upgrade.d.ts +5 -6
- package/dist/lib/upgrade.js +12 -23
- package/npm-shrinkwrap.json +7 -6
- package/oclif.manifest.json +1 -1
- package/package.json +2 -1
|
@@ -23,6 +23,9 @@ import {
|
|
|
23
23
|
Index,
|
|
24
24
|
Unique,
|
|
25
25
|
Check,
|
|
26
|
+
<% if (it.foreignKeys.length > 0) { %>
|
|
27
|
+
ForeignKey,
|
|
28
|
+
<% } %>
|
|
26
29
|
PrimaryColumn
|
|
27
30
|
} from "typeorm";
|
|
28
31
|
import {
|
|
@@ -58,6 +61,9 @@ const { CREATE, UPDATE } = CrudValidationGroups;
|
|
|
58
61
|
<% it.checks.forEach((check) => { %>
|
|
59
62
|
@Check(<% if (check.name) { %><%~ JSON.stringify(check.name) %>, <% } %><%~ JSON.stringify(check.expression) %>)
|
|
60
63
|
<% }) %>
|
|
64
|
+
<% it.foreignKeys.forEach((key) => { %>
|
|
65
|
+
@ForeignKey(() => <%= key.target %>, [<%~ JSON.stringify(key.column) %>], [<%~ JSON.stringify(key.targetColumn) %>], { name: <%~ JSON.stringify(key.name) %><% if (key.onDelete) { %>, onDelete: "<%= key.onDelete %>"<% } %> })
|
|
66
|
+
<% }) %>
|
|
61
67
|
<% it.uniques.forEach((unique) => { %>
|
|
62
68
|
@Unique(<% if (unique.name) {%> "<%= unique.name %>", <%} %>[<%~ unique.fields.map((field) => `"${field}"`).join(', ') %>])
|
|
63
69
|
<% }) %>
|
|
@@ -15,3 +15,17 @@ export interface Check {
|
|
|
15
15
|
*/
|
|
16
16
|
validate?: boolean;
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* A foreign key beyond the one a relationship makes, for a column that has
|
|
20
|
+
* more than one. It is a database constraint only: no relation property.
|
|
21
|
+
*/
|
|
22
|
+
export interface ExtraForeignKey {
|
|
23
|
+
name: string;
|
|
24
|
+
/** The column's database name. */
|
|
25
|
+
column: string;
|
|
26
|
+
/** The entity it references, by its primary key. */
|
|
27
|
+
to: string;
|
|
28
|
+
onDelete?: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION";
|
|
29
|
+
/** False keeps the key NOT VALID in migrations, as on a relationship. */
|
|
30
|
+
validate?: boolean;
|
|
31
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Unique, Check } from "./constraints";
|
|
1
|
+
import { Unique, Check, ExtraForeignKey } from "./constraints";
|
|
2
2
|
import { Field } from "./field";
|
|
3
3
|
import { Index, SqlIndex } from "./indices";
|
|
4
4
|
import { Association } from "./relationship";
|
|
@@ -98,6 +98,8 @@ export interface Entity {
|
|
|
98
98
|
uniques?: Unique[];
|
|
99
99
|
/** CHECK constraints, for example "end_date >= start_date". */
|
|
100
100
|
checks?: Check[];
|
|
101
|
+
/** A second foreign key on a column that a relationship already keys. */
|
|
102
|
+
foreignKeys?: ExtraForeignKey[];
|
|
101
103
|
/**
|
|
102
104
|
* Fields or paths that define the authorization scope for this entity.
|
|
103
105
|
* Can be a single field name (e.g., 'workspaceId') or an array of fields/paths
|
package/dist/lib/upgrade.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Upgrade-on-limit flow.
|
|
3
3
|
*
|
|
4
|
-
* When the platform rejects an action
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* "you've hit a limit, upgrade?" flow developers expect from modern CLIs.
|
|
4
|
+
* When the platform rejects an action for a plan or billing reason (the free-tier
|
|
5
|
+
* service cap, staging on a free service, a suspended service), the CLI opens the
|
|
6
|
+
* web app page where the user fixes it and retries once they are done.
|
|
8
7
|
*/
|
|
9
8
|
import { ApiClientError } from "./api/client";
|
|
10
9
|
/** Where the user is when the refusal happened, so the link can go to the exact page. */
|
|
@@ -18,8 +17,8 @@ export declare function fixPage(error: ApiClientError, ctx?: PageContext): {
|
|
|
18
17
|
label: string;
|
|
19
18
|
};
|
|
20
19
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* Open the web app page that resolves a plan or billing refusal, then wait for
|
|
21
|
+
* the user to finish there. Returns true if the caller should retry.
|
|
23
22
|
*/
|
|
24
23
|
export declare function promptUpgrade(error: ApiClientError, ctx?: PageContext): Promise<boolean>;
|
|
25
24
|
/**
|
package/dist/lib/upgrade.js
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Upgrade-on-limit flow.
|
|
4
4
|
*
|
|
5
|
-
* When the platform rejects an action
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* "you've hit a limit, upgrade?" flow developers expect from modern CLIs.
|
|
5
|
+
* When the platform rejects an action for a plan or billing reason (the free-tier
|
|
6
|
+
* service cap, staging on a free service, a suspended service), the CLI opens the
|
|
7
|
+
* web app page where the user fixes it and retries once they are done.
|
|
9
8
|
*/
|
|
10
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
10
|
exports.withUpgradeRetry = exports.promptUpgrade = exports.fixPage = void 0;
|
|
@@ -49,38 +48,28 @@ function fixPage(error, ctx = {}) {
|
|
|
49
48
|
}
|
|
50
49
|
exports.fixPage = fixPage;
|
|
51
50
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
51
|
+
* Open the web app page that resolves a plan or billing refusal, then wait for
|
|
52
|
+
* the user to finish there. Returns true if the caller should retry.
|
|
54
53
|
*/
|
|
55
54
|
async function promptUpgrade(error, ctx = {}) {
|
|
56
|
-
const { url
|
|
55
|
+
const { url, label } = fixPage(error, ctx);
|
|
57
56
|
console.log("");
|
|
58
57
|
console.log(` ⚠ ${error.message || "You've reached a plan limit."}`);
|
|
59
58
|
console.log("");
|
|
60
|
-
|
|
61
|
-
{
|
|
62
|
-
type: "confirm",
|
|
63
|
-
name: "proceed",
|
|
64
|
-
message: `Open ${label} in your browser?`,
|
|
65
|
-
default: true,
|
|
66
|
-
},
|
|
67
|
-
]);
|
|
68
|
-
if (!proceed) {
|
|
69
|
-
console.log(` You can do this any time at: ${upgradeUrl}`);
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
console.log("");
|
|
73
|
-
console.log(` Opening ${upgradeUrl}`);
|
|
59
|
+
console.log(` Opening ${label} in your browser: ${url}`);
|
|
74
60
|
console.log(" If the browser doesn't open, visit the URL above.");
|
|
75
|
-
|
|
61
|
+
console.log("");
|
|
62
|
+
await openBrowser(url);
|
|
76
63
|
const { done } = await inquirer_1.default.prompt([
|
|
77
64
|
{
|
|
78
65
|
type: "confirm",
|
|
79
66
|
name: "done",
|
|
80
|
-
message: "
|
|
67
|
+
message: "Done there? Retry now",
|
|
81
68
|
default: true,
|
|
82
69
|
},
|
|
83
70
|
]);
|
|
71
|
+
if (!done)
|
|
72
|
+
console.log(` You can finish this any time at: ${url}`);
|
|
84
73
|
return done;
|
|
85
74
|
}
|
|
86
75
|
exports.promptUpgrade = promptUpgrade;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apso/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.55.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@apso/cli",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.55.0",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@apso/schema-tools": "^0.2.3",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"@oclif/plugin-warn-if-update-available": "^2.1.1",
|
|
20
20
|
"@sentry/node": "^10.68.0",
|
|
21
21
|
"adm-zip": "^0.6.0",
|
|
22
|
+
"ci-info": "^3.9.0",
|
|
22
23
|
"debug": "^4.3.4",
|
|
23
24
|
"eta": "^2.0.0",
|
|
24
25
|
"inquirer": "^8.2.7",
|
|
@@ -4602,16 +4603,16 @@
|
|
|
4602
4603
|
}
|
|
4603
4604
|
},
|
|
4604
4605
|
"node_modules/ci-info": {
|
|
4605
|
-
"version": "3.
|
|
4606
|
-
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.
|
|
4607
|
-
"integrity": "sha512-
|
|
4608
|
-
"dev": true,
|
|
4606
|
+
"version": "3.9.0",
|
|
4607
|
+
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz",
|
|
4608
|
+
"integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==",
|
|
4609
4609
|
"funding": [
|
|
4610
4610
|
{
|
|
4611
4611
|
"type": "github",
|
|
4612
4612
|
"url": "https://github.com/sponsors/sibiraj-s"
|
|
4613
4613
|
}
|
|
4614
4614
|
],
|
|
4615
|
+
"license": "MIT",
|
|
4615
4616
|
"engines": {
|
|
4616
4617
|
"node": ">=8"
|
|
4617
4618
|
}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apso/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.55.0",
|
|
4
4
|
"mcpName": "io.github.apsoai/apso",
|
|
5
5
|
"description": "Apso CLI",
|
|
6
6
|
"author": "Apso by Mavric - @mavric",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"@oclif/plugin-warn-if-update-available": "^2.1.1",
|
|
35
35
|
"@sentry/node": "^10.68.0",
|
|
36
36
|
"adm-zip": "^0.6.0",
|
|
37
|
+
"ci-info": "^3.9.0",
|
|
37
38
|
"debug": "^4.3.4",
|
|
38
39
|
"eta": "^2.0.0",
|
|
39
40
|
"inquirer": "^8.2.7",
|