run402-mcp 3.8.3 → 4.0.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.
- package/README.md +3 -3
- package/dist/index.js +13 -23
- package/dist/index.js.map +1 -1
- package/dist/tools/add-custom-domain.d.ts.map +1 -1
- package/dist/tools/add-custom-domain.js +4 -33
- package/dist/tools/add-custom-domain.js.map +1 -1
- package/dist/tools/check-domain-status.d.ts.map +1 -1
- package/dist/tools/check-domain-status.js +4 -33
- package/dist/tools/check-domain-status.js.map +1 -1
- package/dist/tools/deploy.d.ts +62 -10
- package/dist/tools/deploy.d.ts.map +1 -1
- package/dist/tools/deploy.js +12 -2
- package/dist/tools/deploy.js.map +1 -1
- package/dist/tools/domains.d.ts +84 -0
- package/dist/tools/domains.d.ts.map +1 -0
- package/dist/tools/domains.js +129 -0
- package/dist/tools/domains.js.map +1 -0
- package/dist/tools/list-custom-domains.d.ts.map +1 -1
- package/dist/tools/list-custom-domains.js +4 -29
- package/dist/tools/list-custom-domains.js.map +1 -1
- package/dist/tools/remove-custom-domain.d.ts.map +1 -1
- package/dist/tools/remove-custom-domain.js +4 -16
- package/dist/tools/remove-custom-domain.js.map +1 -1
- package/package.json +1 -1
- package/schemas/release-spec.v1.json +14 -3
- package/schemas/run402-app.v1.schema.json +56 -1
- package/sdk/dist/config.d.ts +22 -5
- package/sdk/dist/config.d.ts.map +1 -1
- package/sdk/dist/config.js +6 -1
- package/sdk/dist/config.js.map +1 -1
- package/sdk/dist/namespaces/deploy.js +57 -8
- package/sdk/dist/namespaces/deploy.js.map +1 -1
- package/sdk/dist/namespaces/deploy.types.d.ts +19 -5
- package/sdk/dist/namespaces/deploy.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/deploy.types.js.map +1 -1
- package/sdk/dist/namespaces/domains.d.ts +148 -55
- package/sdk/dist/namespaces/domains.d.ts.map +1 -1
- package/sdk/dist/namespaces/domains.js +114 -69
- package/sdk/dist/namespaces/domains.js.map +1 -1
- package/sdk/dist/namespaces/sender-domain.d.ts +12 -10
- package/sdk/dist/namespaces/sender-domain.d.ts.map +1 -1
- package/sdk/dist/namespaces/sender-domain.js +25 -43
- package/sdk/dist/namespaces/sender-domain.js.map +1 -1
- package/sdk/dist/node/deploy-manifest.d.ts +14 -2
- package/sdk/dist/node/deploy-manifest.d.ts.map +1 -1
- package/sdk/dist/node/deploy-manifest.js +45 -8
- package/sdk/dist/node/deploy-manifest.js.map +1 -1
- package/sdk/dist/scoped.d.ts +22 -7
- package/sdk/dist/scoped.d.ts.map +1 -1
- package/sdk/dist/scoped.js +33 -4
- package/sdk/dist/scoped.js.map +1 -1
|
@@ -1,89 +1,134 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `domains` namespace —
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* `domains` namespace — ProjectDomain lifecycle.
|
|
3
|
+
*
|
|
4
|
+
* Domain operations are project-scoped control-plane actions. They use the
|
|
5
|
+
* SDK credential provider's server auth (SIWX, control-plane session, or
|
|
6
|
+
* delegate) and deliberately do not require local project-key cache entries.
|
|
5
7
|
*/
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import { LocalError } from "../errors.js";
|
|
9
|
+
function domainPath(projectId, domain) {
|
|
10
|
+
return `/projects/v1/${encodeURIComponent(projectId)}/domains/${encodeURIComponent(domain)}`;
|
|
11
|
+
}
|
|
12
|
+
function authMeta(method, projectId) {
|
|
13
|
+
return { method, target: { project_id: projectId } };
|
|
14
|
+
}
|
|
15
|
+
function removed(command, replacement) {
|
|
16
|
+
throw new LocalError(`${command} has been removed. Use ${replacement}.`, command, {
|
|
17
|
+
code: "COMMAND_REMOVED",
|
|
18
|
+
details: { command, replacement },
|
|
19
|
+
next_actions: [{ type: "use_replacement_command", command: replacement }],
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function waitSatisfied(domain, until) {
|
|
23
|
+
if (until === "active")
|
|
24
|
+
return domain.status === "active";
|
|
25
|
+
if (until === "receive-active") {
|
|
26
|
+
const email = domain.effective.email;
|
|
27
|
+
return email?.receive?.active === true;
|
|
28
|
+
}
|
|
29
|
+
return domain.checks.every((check) => !check.blocking || check.status === "passed");
|
|
30
|
+
}
|
|
31
|
+
function sleep(ms) {
|
|
32
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
11
33
|
}
|
|
12
34
|
export class Domains {
|
|
13
35
|
client;
|
|
14
36
|
constructor(client) {
|
|
15
37
|
this.client = client;
|
|
16
38
|
}
|
|
17
|
-
async
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
return this.client.request("/domains/v1", {
|
|
39
|
+
async ensure(projectId, domain, opts) {
|
|
40
|
+
return this.client.request(domainPath(projectId, domain), {
|
|
41
|
+
method: "PUT",
|
|
42
|
+
body: { desired: opts.desired },
|
|
43
|
+
authMeta: authMeta("domains.ensure", projectId),
|
|
44
|
+
context: "ensuring project domain",
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
async get(projectId, domain) {
|
|
48
|
+
return this.client.request(domainPath(projectId, domain), {
|
|
49
|
+
authMeta: authMeta("domains.get", projectId),
|
|
50
|
+
context: "getting project domain",
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
async list(projectId) {
|
|
54
|
+
return this.client.request(`/projects/v1/${encodeURIComponent(projectId)}/domains`, {
|
|
55
|
+
authMeta: authMeta("domains.list", projectId),
|
|
56
|
+
context: "listing project domains",
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
async check(projectId, domain) {
|
|
60
|
+
return this.client.request(`${domainPath(projectId, domain)}/actions/check`, {
|
|
41
61
|
method: "POST",
|
|
42
|
-
|
|
43
|
-
context: "
|
|
62
|
+
authMeta: authMeta("domains.check", projectId),
|
|
63
|
+
context: "checking project domain",
|
|
44
64
|
});
|
|
45
65
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
headers: { Authorization: `Bearer ${project.service_key}` },
|
|
52
|
-
context: "listing custom domains",
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
return this.client.request(withProjectId("/domains/v1", projectId), {
|
|
56
|
-
context: "listing custom domains",
|
|
66
|
+
async apply(projectId, domain) {
|
|
67
|
+
return this.client.request(`${domainPath(projectId, domain)}/actions/apply`, {
|
|
68
|
+
method: "POST",
|
|
69
|
+
authMeta: authMeta("domains.apply", projectId),
|
|
70
|
+
context: "applying project domain",
|
|
57
71
|
});
|
|
58
72
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
headers: { Authorization: `Bearer ${project.service_key}` },
|
|
65
|
-
context: "checking domain status",
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
return this.client.request(withProjectId(`/domains/v1/${encodeURIComponent(domain)}`, projectId), {
|
|
69
|
-
context: "checking domain status",
|
|
73
|
+
async repair(projectId, domain) {
|
|
74
|
+
return this.client.request(`${domainPath(projectId, domain)}/actions/repair`, {
|
|
75
|
+
method: "POST",
|
|
76
|
+
authMeta: authMeta("domains.repair", projectId),
|
|
77
|
+
context: "repairing project domain",
|
|
70
78
|
});
|
|
71
79
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
async testReceive(projectId, domain, to) {
|
|
81
|
+
return this.client.request(`${domainPath(projectId, domain)}/actions/test_receive`, {
|
|
82
|
+
method: "POST",
|
|
83
|
+
body: { to },
|
|
84
|
+
authMeta: authMeta("domains.testReceive", projectId),
|
|
85
|
+
context: "creating project domain receive test",
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
async activate(projectId, domain) {
|
|
89
|
+
return this.client.request(`${domainPath(projectId, domain)}/actions/activate_mailbox_addresses`, {
|
|
90
|
+
method: "POST",
|
|
91
|
+
authMeta: authMeta("domains.activate", projectId),
|
|
92
|
+
context: "activating project domain mailbox addresses",
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
async disconnect(projectId, domain) {
|
|
96
|
+
return this.client.request(domainPath(projectId, domain), {
|
|
83
97
|
method: "DELETE",
|
|
84
|
-
|
|
85
|
-
context: "
|
|
98
|
+
authMeta: authMeta("domains.disconnect", projectId),
|
|
99
|
+
context: "disconnecting project domain",
|
|
86
100
|
});
|
|
87
101
|
}
|
|
102
|
+
async wait(projectId, domain, opts = {}) {
|
|
103
|
+
const until = opts.until ?? "active";
|
|
104
|
+
const timeoutMs = opts.timeoutMs ?? 120_000;
|
|
105
|
+
const intervalMs = opts.intervalMs ?? 5_000;
|
|
106
|
+
const started = Date.now();
|
|
107
|
+
let last = await this.check(projectId, domain);
|
|
108
|
+
while (!waitSatisfied(last, until)) {
|
|
109
|
+
if (Date.now() - started >= timeoutMs) {
|
|
110
|
+
throw new LocalError(`Timed out waiting for project domain ${domain} to reach ${until}`, "waiting for project domain", {
|
|
111
|
+
code: "DOMAIN_WAIT_TIMEOUT",
|
|
112
|
+
details: { project_id: projectId, domain, until, last_status: last.status, checks: last.checks },
|
|
113
|
+
next_actions: [{ type: "check", command: `run402 domains check ${domain} --project ${projectId}` }],
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
await sleep(intervalMs);
|
|
117
|
+
last = await this.check(projectId, domain);
|
|
118
|
+
}
|
|
119
|
+
return last;
|
|
120
|
+
}
|
|
121
|
+
async add(projectId, domainOrOpts) {
|
|
122
|
+
const domain = typeof domainOrOpts === "string" ? domainOrOpts : domainOrOpts.domain;
|
|
123
|
+
return removed("domains.add", `run402 domains connect ${domain} --project ${projectId} --web`);
|
|
124
|
+
}
|
|
125
|
+
/** @deprecated Removed. Use get(projectId, domain). */
|
|
126
|
+
async status(projectId, domain) {
|
|
127
|
+
return removed("domains.status", `run402 domains status ${domain} --project ${projectId}`);
|
|
128
|
+
}
|
|
129
|
+
/** @deprecated Removed. Use disconnect(projectId, domain). */
|
|
130
|
+
async remove(domain, opts = {}) {
|
|
131
|
+
return removed("domains.remove", `run402 domains disconnect ${domain}${opts.projectId ? ` --project ${opts.projectId}` : ""} --confirm`);
|
|
132
|
+
}
|
|
88
133
|
}
|
|
89
134
|
//# sourceMappingURL=domains.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domains.js","sourceRoot":"","sources":["../../src/namespaces/domains.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"domains.js","sourceRoot":"","sources":["../../src/namespaces/domains.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAgJ1C,SAAS,UAAU,CAAC,SAAiB,EAAE,MAAc;IACnD,OAAO,gBAAgB,kBAAkB,CAAC,SAAS,CAAC,YAAY,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;AAC/F,CAAC;AAED,SAAS,QAAQ,CAAC,MAAc,EAAE,SAAiB;IACjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,CAAC;AACvD,CAAC;AAED,SAAS,OAAO,CAAC,OAAe,EAAE,WAAmB;IACnD,MAAM,IAAI,UAAU,CAClB,GAAG,OAAO,0BAA0B,WAAW,GAAG,EAClD,OAAO,EACP;QACE,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE;QACjC,YAAY,EAA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MAAM,cAAc,SAAS,EAAE,CAAC,CAAC;IAC7F,CAAC;IAED,8DAA8D;IAC9D,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,OAAkC,EAAE;QAC/D,OAAO,OAAO,CAAC,gBAAgB,EAAE,6BAA6B,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;IAC3I,CAAC;CACF"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `senderDomain` namespace —
|
|
3
|
-
*
|
|
2
|
+
* `senderDomain` namespace — removed compatibility shim.
|
|
3
|
+
*
|
|
4
|
+
* Sender-domain APIs are now folded into the project-scoped ProjectDomain
|
|
5
|
+
* lifecycle under `domains`. Methods remain present so existing imports fail
|
|
6
|
+
* loudly and locally with a replacement path instead of calling retired
|
|
7
|
+
* `/email/v1/domains` endpoints.
|
|
4
8
|
*/
|
|
5
|
-
import type { Client } from "../kernel.js";
|
|
6
9
|
export interface DnsRecord {
|
|
7
10
|
type: string;
|
|
8
11
|
name: string;
|
|
@@ -27,19 +30,18 @@ export interface DisableInboundResult {
|
|
|
27
30
|
status: string;
|
|
28
31
|
}
|
|
29
32
|
export declare class SenderDomain {
|
|
30
|
-
private readonly client;
|
|
31
33
|
readonly inboundEnable: (projectId: string, domain: string) => Promise<InboundEnableResult>;
|
|
32
34
|
readonly inboundDisable: (projectId: string, domain: string) => Promise<DisableInboundResult>;
|
|
33
|
-
constructor(
|
|
34
|
-
/**
|
|
35
|
+
constructor(_client: unknown);
|
|
36
|
+
/** @deprecated Use `domains.ensure(projectId, domain, { desired })`. */
|
|
35
37
|
register(projectId: string, domain: string): Promise<SenderDomainRegisterResult>;
|
|
36
|
-
/**
|
|
38
|
+
/** @deprecated Use `domains.list(projectId)` or `domains.get(projectId, domain)`. */
|
|
37
39
|
status(projectId: string): Promise<SenderDomainStatusResult>;
|
|
38
|
-
/**
|
|
40
|
+
/** @deprecated Use `domains.disconnect(projectId, domain)`. */
|
|
39
41
|
remove(projectId: string): Promise<void>;
|
|
40
|
-
/**
|
|
42
|
+
/** @deprecated Use `domains.ensure(..., { desired: { email: { receive: ... }}})`. */
|
|
41
43
|
enableInbound(projectId: string, domain: string): Promise<InboundEnableResult>;
|
|
42
|
-
/**
|
|
44
|
+
/** @deprecated Use `domains.ensure` with receive disabled or `domains.disconnect`. */
|
|
43
45
|
disableInbound(projectId: string, domain: string): Promise<DisableInboundResult>;
|
|
44
46
|
}
|
|
45
47
|
//# sourceMappingURL=sender-domain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sender-domain.d.ts","sourceRoot":"","sources":["../../src/namespaces/sender-domain.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sender-domain.d.ts","sourceRoot":"","sources":["../../src/namespaces/sender-domain.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,SAAS,EAAE,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,YAAY;IACvB,QAAQ,CAAC,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC5F,QAAQ,CAAC,cAAc,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;gBAElF,OAAO,EAAE,OAAO;IAK5B,wEAAwE;IAClE,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAOtF,qFAAqF;IAC/E,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAOlE,+DAA+D;IACzD,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO9C,qFAAqF;IAC/E,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAOpF,sFAAsF;IAChF,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAMvF"}
|
|
@@ -1,63 +1,45 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `senderDomain` namespace —
|
|
3
|
-
*
|
|
2
|
+
* `senderDomain` namespace — removed compatibility shim.
|
|
3
|
+
*
|
|
4
|
+
* Sender-domain APIs are now folded into the project-scoped ProjectDomain
|
|
5
|
+
* lifecycle under `domains`. Methods remain present so existing imports fail
|
|
6
|
+
* loudly and locally with a replacement path instead of calling retired
|
|
7
|
+
* `/email/v1/domains` endpoints.
|
|
4
8
|
*/
|
|
5
|
-
import {
|
|
9
|
+
import { LocalError } from "../errors.js";
|
|
6
10
|
export class SenderDomain {
|
|
7
|
-
client;
|
|
8
11
|
inboundEnable;
|
|
9
12
|
inboundDisable;
|
|
10
|
-
constructor(
|
|
11
|
-
this.client = client;
|
|
13
|
+
constructor(_client) {
|
|
12
14
|
this.inboundEnable = this.enableInbound.bind(this);
|
|
13
15
|
this.inboundDisable = this.disableInbound.bind(this);
|
|
14
16
|
}
|
|
15
|
-
/**
|
|
17
|
+
/** @deprecated Use `domains.ensure(projectId, domain, { desired })`. */
|
|
16
18
|
async register(projectId, domain) {
|
|
17
|
-
|
|
18
|
-
return this.client.request("/email/v1/domains", {
|
|
19
|
-
method: "POST",
|
|
20
|
-
headers: { Authorization: `Bearer ${project.service_key}` },
|
|
21
|
-
body: { domain },
|
|
22
|
-
context: "registering sender domain",
|
|
23
|
-
});
|
|
19
|
+
return removed("senderDomain.register", `run402 domains connect ${domain} --project ${projectId} --email-send`);
|
|
24
20
|
}
|
|
25
|
-
/**
|
|
21
|
+
/** @deprecated Use `domains.list(projectId)` or `domains.get(projectId, domain)`. */
|
|
26
22
|
async status(projectId) {
|
|
27
|
-
|
|
28
|
-
return this.client.request("/email/v1/domains", {
|
|
29
|
-
headers: { Authorization: `Bearer ${project.service_key}` },
|
|
30
|
-
context: "checking sender domain status",
|
|
31
|
-
});
|
|
23
|
+
return removed("senderDomain.status", `run402 domains list --project ${projectId}`);
|
|
32
24
|
}
|
|
33
|
-
/**
|
|
25
|
+
/** @deprecated Use `domains.disconnect(projectId, domain)`. */
|
|
34
26
|
async remove(projectId) {
|
|
35
|
-
|
|
36
|
-
await this.client.request("/email/v1/domains", {
|
|
37
|
-
method: "DELETE",
|
|
38
|
-
headers: { Authorization: `Bearer ${project.service_key}` },
|
|
39
|
-
context: "removing sender domain",
|
|
40
|
-
});
|
|
27
|
+
return removed("senderDomain.remove", `run402 domains disconnect <domain> --project ${projectId} --confirm`);
|
|
41
28
|
}
|
|
42
|
-
/**
|
|
29
|
+
/** @deprecated Use `domains.ensure(..., { desired: { email: { receive: ... }}})`. */
|
|
43
30
|
async enableInbound(projectId, domain) {
|
|
44
|
-
|
|
45
|
-
return this.client.request("/email/v1/domains/inbound", {
|
|
46
|
-
method: "POST",
|
|
47
|
-
headers: { Authorization: `Bearer ${project.service_key}` },
|
|
48
|
-
body: { domain },
|
|
49
|
-
context: "enabling inbound email",
|
|
50
|
-
});
|
|
31
|
+
return removed("senderDomain.enableInbound", `run402 domains connect ${domain} --project ${projectId} --email-receive`);
|
|
51
32
|
}
|
|
52
|
-
/**
|
|
33
|
+
/** @deprecated Use `domains.ensure` with receive disabled or `domains.disconnect`. */
|
|
53
34
|
async disableInbound(projectId, domain) {
|
|
54
|
-
|
|
55
|
-
return this.client.request("/email/v1/domains/inbound", {
|
|
56
|
-
method: "DELETE",
|
|
57
|
-
headers: { Authorization: `Bearer ${project.service_key}` },
|
|
58
|
-
body: { domain },
|
|
59
|
-
context: "disabling inbound email",
|
|
60
|
-
});
|
|
35
|
+
return removed("senderDomain.disableInbound", `run402 domains disconnect ${domain} --project ${projectId} --confirm`);
|
|
61
36
|
}
|
|
62
37
|
}
|
|
38
|
+
function removed(command, replacement) {
|
|
39
|
+
throw new LocalError(`${command} has been removed. Use ${replacement}.`, command, {
|
|
40
|
+
code: "COMMAND_REMOVED",
|
|
41
|
+
details: { command, replacement },
|
|
42
|
+
next_actions: [{ type: "use_replacement_command", command: replacement }],
|
|
43
|
+
});
|
|
44
|
+
}
|
|
63
45
|
//# sourceMappingURL=sender-domain.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sender-domain.js","sourceRoot":"","sources":["../../src/namespaces/sender-domain.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sender-domain.js","sourceRoot":"","sources":["../../src/namespaces/sender-domain.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA8B1C,MAAM,OAAO,YAAY;IACd,aAAa,CAAsE;IACnF,cAAc,CAAuE;IAE9F,YAAY,OAAgB;QAC1B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;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
content_type?: string;
|
|
22
22
|
};
|
|
23
23
|
export type DeployManifestFileSet = Record<string, DeployManifestFileEntry>;
|
|
24
|
-
|
|
25
|
-
id: string;
|
|
24
|
+
interface DeployManifestMigrationBaseSpec {
|
|
26
25
|
checksum?: string;
|
|
27
26
|
sql?: string;
|
|
28
27
|
sql_ref?: ContentRef;
|
|
@@ -30,6 +29,18 @@ export interface DeployManifestMigrationSpec {
|
|
|
30
29
|
sql_file?: string;
|
|
31
30
|
transaction?: "required" | "none";
|
|
32
31
|
}
|
|
32
|
+
export interface DeployManifestVersionedMigrationSpec extends DeployManifestMigrationBaseSpec {
|
|
33
|
+
id: string;
|
|
34
|
+
name?: never;
|
|
35
|
+
}
|
|
36
|
+
export interface DeployManifestContentTrackedMigrationSpec extends DeployManifestMigrationBaseSpec {
|
|
37
|
+
/** Content-tracked migration name. The SDK compiles this to
|
|
38
|
+
* `<name>_<sha256(sql)[0:16]>`; SQL MUST be idempotent because changed
|
|
39
|
+
* content applies again against a database with prior versions. */
|
|
40
|
+
name: string;
|
|
41
|
+
id?: never;
|
|
42
|
+
}
|
|
43
|
+
export type DeployManifestMigrationSpec = DeployManifestVersionedMigrationSpec | DeployManifestContentTrackedMigrationSpec;
|
|
33
44
|
export interface DeployManifestDatabaseSpec {
|
|
34
45
|
migrations?: DeployManifestMigrationSpec[];
|
|
35
46
|
expose?: DatabaseSpec["expose"];
|
|
@@ -135,4 +146,5 @@ export interface NormalizedDeployManifest {
|
|
|
135
146
|
export declare function loadDeployManifest(path: string, opts?: LoadDeployManifestOptions): Promise<NormalizedDeployManifest>;
|
|
136
147
|
export declare function loadExecutableDeployConfig(path: string, opts?: LoadExecutableDeployConfigOptions): Promise<Run402ReleaseConfig>;
|
|
137
148
|
export declare function normalizeDeployManifest(input: DeployManifestInput, opts?: NormalizeDeployManifestOptions): Promise<NormalizedDeployManifest>;
|
|
149
|
+
export {};
|
|
138
150
|
//# sourceMappingURL=deploy-manifest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-manifest.d.ts","sourceRoot":"","sources":["../../src/node/deploy-manifest.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAIV,mBAAmB,EACpB,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAGV,qBAAqB,EACrB,UAAU,EACV,aAAa,EACb,YAAY,EAEZ,YAAY,EACZ,QAAQ,EACR,WAAW,EAEX,WAAW,EACX,mBAAmB,EACpB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"deploy-manifest.d.ts","sourceRoot":"","sources":["../../src/node/deploy-manifest.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAIV,mBAAmB,EACpB,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAGV,qBAAqB,EACrB,UAAU,EACV,aAAa,EACb,YAAY,EAEZ,YAAY,EACZ,QAAQ,EACR,WAAW,EAEX,WAAW,EACX,mBAAmB,EACpB,MAAM,+BAA+B,CAAC;AA8GvC,MAAM,WAAW,iCAAiC;IAChD,2FAA2F;IAC3F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,8BAA8B;IAC7C,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,MAAM,uBAAuB,GAC/B,aAAa,GACb;IACE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,KAAK,CAAC;CACd,GACD;IACE,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AA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AqE;IACrE,MAAM,CAAC,EAAE,8BAA8B,CAAC;CACzC;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,yBAA8B,GACnC,OAAO,CAAC,wBAAwB,CAAC,CAsDnC;AAED,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,iCAAsC,GAC3C,OAAO,CAAC,mBAAmB,CAAC,CA0E9B;AAkED,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,mBAAmB,EAC1B,IAAI,GAAE,8BAAmC,GACxC,OAAO,CAAC,wBAAwB,CAAC,CAkCnC"}
|
|
@@ -38,6 +38,7 @@ const MANIFEST_I18N_FIELDS = new Set([
|
|
|
38
38
|
const MANIFEST_DATABASE_FIELDS = new Set(["migrations", "expose", "zero_downtime"]);
|
|
39
39
|
const MANIFEST_MIGRATION_FIELDS = new Set([
|
|
40
40
|
"id",
|
|
41
|
+
"name",
|
|
41
42
|
"checksum",
|
|
42
43
|
"sql",
|
|
43
44
|
"sql_ref",
|
|
@@ -104,6 +105,7 @@ const TYPESCRIPT_MANIFEST_EXTENSIONS = new Set([".ts", ".mts", ".cts"]);
|
|
|
104
105
|
const TYPESCRIPT_FUNCTION_EXTENSIONS = new Set([".ts", ".tsx", ".mts", ".cts"]);
|
|
105
106
|
const EXECUTABLE_CONFIG_TIMEOUT_MS = 5_000;
|
|
106
107
|
const EXECUTABLE_CONFIG_METADATA = Symbol("run402.executableConfigMetadata");
|
|
108
|
+
const MIGRATION_NAME_RE = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/;
|
|
107
109
|
export async function loadDeployManifest(path, opts = {}) {
|
|
108
110
|
const manifestPath = isAbsolute(path) ? path : resolvePath(process.cwd(), path);
|
|
109
111
|
const extension = extname(manifestPath).toLowerCase();
|
|
@@ -342,18 +344,43 @@ async function mapDatabase(database, opts) {
|
|
|
342
344
|
throw new LocalError("Deploy manifest database.migrations must be an array", CONTEXT);
|
|
343
345
|
}
|
|
344
346
|
out.migrations = [];
|
|
345
|
-
|
|
346
|
-
|
|
347
|
+
const seenNames = new Map();
|
|
348
|
+
for (const [index, migration] of raw.migrations.entries()) {
|
|
349
|
+
out.migrations.push(await mapMigration(migration, opts, index, seenNames));
|
|
347
350
|
}
|
|
348
351
|
}
|
|
349
352
|
return out;
|
|
350
353
|
}
|
|
351
|
-
async function mapMigration(migration, opts) {
|
|
354
|
+
async function mapMigration(migration, opts, index, seenNames) {
|
|
352
355
|
assertPlainRecord(migration, "Deploy manifest database.migrations[]");
|
|
353
356
|
assertKnownFields(migration, "Deploy manifest database.migrations[]", MANIFEST_MIGRATION_FIELDS);
|
|
354
|
-
const
|
|
355
|
-
|
|
356
|
-
|
|
357
|
+
const hasId = Object.prototype.hasOwnProperty.call(migration, "id") && migration.id !== undefined;
|
|
358
|
+
const hasName = Object.prototype.hasOwnProperty.call(migration, "name") && migration.name !== undefined;
|
|
359
|
+
const label = migrationLabel(migration, index);
|
|
360
|
+
if (hasId && hasName) {
|
|
361
|
+
throw new LocalError(`${label} declares both id and name; use exactly one`, CONTEXT);
|
|
362
|
+
}
|
|
363
|
+
if (!hasId && !hasName) {
|
|
364
|
+
throw new LocalError(`${label} must declare exactly one of id or name`, CONTEXT);
|
|
365
|
+
}
|
|
366
|
+
let out;
|
|
367
|
+
if (hasName) {
|
|
368
|
+
if (typeof migration.name !== "string" || !MIGRATION_NAME_RE.test(migration.name)) {
|
|
369
|
+
throw new LocalError(`${label}.name must match /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/`, CONTEXT);
|
|
370
|
+
}
|
|
371
|
+
const firstIndex = seenNames.get(migration.name);
|
|
372
|
+
if (firstIndex !== undefined) {
|
|
373
|
+
throw new LocalError(`${label}.name duplicates database.migrations[${firstIndex}].name ${JSON.stringify(migration.name)}`, CONTEXT);
|
|
374
|
+
}
|
|
375
|
+
seenNames.set(migration.name, index);
|
|
376
|
+
out = { name: migration.name };
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
if (typeof migration.id !== "string" || migration.id.trim() === "") {
|
|
380
|
+
throw new LocalError(`${label}.id must be a non-empty string`, CONTEXT);
|
|
381
|
+
}
|
|
382
|
+
out = { id: migration.id };
|
|
383
|
+
}
|
|
357
384
|
if (migration.sql !== undefined)
|
|
358
385
|
out.sql = migration.sql;
|
|
359
386
|
if (migration.sql_ref !== undefined)
|
|
@@ -366,7 +393,7 @@ async function mapMigration(migration, opts) {
|
|
|
366
393
|
if (migration.sql_path !== undefined &&
|
|
367
394
|
migration.sql_file !== undefined &&
|
|
368
395
|
migration.sql_path !== migration.sql_file) {
|
|
369
|
-
throw new LocalError(
|
|
396
|
+
throw new LocalError(`${label} has both sql_path and sql_file with different values`, CONTEXT);
|
|
370
397
|
}
|
|
371
398
|
if (out.sql === undefined && sqlPath !== undefined) {
|
|
372
399
|
const field = migration.sql_path !== undefined ? "sql_path" : "sql_file";
|
|
@@ -375,11 +402,21 @@ async function mapMigration(migration, opts) {
|
|
|
375
402
|
out.sql = await readFile(abs, "utf-8");
|
|
376
403
|
}
|
|
377
404
|
catch (err) {
|
|
378
|
-
throw new LocalError(`Failed to read migration ${field} '${sqlPath}': ${err.message}`, CONTEXT, err);
|
|
405
|
+
throw new LocalError(`Failed to read migration ${field} '${sqlPath}' for ${label}: ${err.message}`, CONTEXT, err);
|
|
379
406
|
}
|
|
380
407
|
}
|
|
381
408
|
return out;
|
|
382
409
|
}
|
|
410
|
+
function migrationLabel(migration, index) {
|
|
411
|
+
const identity = typeof migration.id === "string"
|
|
412
|
+
? migration.id
|
|
413
|
+
: typeof migration.name === "string"
|
|
414
|
+
? migration.name
|
|
415
|
+
: null;
|
|
416
|
+
return identity
|
|
417
|
+
? `Deploy manifest database.migrations[${index}] (${identity})`
|
|
418
|
+
: `Deploy manifest database.migrations[${index}]`;
|
|
419
|
+
}
|
|
383
420
|
function mapFunctions(functions, opts) {
|
|
384
421
|
assertPlainRecord(functions, "Deploy manifest functions");
|
|
385
422
|
assertKnownFields(functions, "Deploy manifest functions", MANIFEST_FUNCTIONS_FIELDS);
|