run402 4.130.5 → 4.132.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/cli.mjs +6 -0
- package/lib/app-repos.mjs +444 -0
- package/lib/ci.mjs +64 -18
- package/lib/command-manifest.mjs +13 -0
- package/lib/deploy-v2.mjs +1 -1
- package/lib/path-lookup.mjs +9 -4
- package/package.json +1 -1
- package/sdk/dist/index.d.ts +11 -0
- package/sdk/dist/index.d.ts.map +1 -1
- package/sdk/dist/index.js +11 -0
- package/sdk/dist/index.js.map +1 -1
- package/sdk/dist/namespaces/app-repos.d.ts +69 -0
- package/sdk/dist/namespaces/app-repos.d.ts.map +1 -0
- package/sdk/dist/namespaces/app-repos.js +312 -0
- package/sdk/dist/namespaces/app-repos.js.map +1 -0
- package/sdk/dist/namespaces/app-repos.types.d.ts +188 -0
- package/sdk/dist/namespaces/app-repos.types.d.ts.map +1 -0
- package/sdk/dist/namespaces/app-repos.types.js +12 -0
- package/sdk/dist/namespaces/app-repos.types.js.map +1 -0
- package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
- package/sdk/dist/namespaces/deploy.js +68 -3
- package/sdk/dist/namespaces/deploy.js.map +1 -1
- package/sdk/dist/namespaces/deploy.types.d.ts +34 -2
- 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/snapshots.types.d.ts +2 -0
- package/sdk/dist/namespaces/snapshots.types.d.ts.map +1 -1
- package/sdk/dist/node/deploy-manifest.d.ts.map +1 -1
- package/sdk/dist/node/deploy-manifest.js +28 -2
- package/sdk/dist/node/deploy-manifest.js.map +1 -1
- package/sdk/dist/scoped.d.ts +28 -0
- package/sdk/dist/scoped.d.ts.map +1 -1
- package/sdk/dist/scoped.js +51 -0
- package/sdk/dist/scoped.js.map +1 -1
- package/vault-surface.json +1 -1
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the `appRepos` namespace: plain git repositories owned by a
|
|
3
|
+
* project and written by its app (`/projects/v1/:project_id/app-repos`).
|
|
4
|
+
*
|
|
5
|
+
* An app repo is NOT a KyGit vault: it is unencrypted, the platform reads its
|
|
6
|
+
* files to serve them, and it has one linear branch, `main`. The encrypted
|
|
7
|
+
* remote for source is `r.repos`. Every project has a `default` app repo that
|
|
8
|
+
* needs no creation; until its first commit it reads as an empty repository
|
|
9
|
+
* (`head: null`, no files, an empty log).
|
|
10
|
+
*/
|
|
11
|
+
/** A git identity as the history records it. */
|
|
12
|
+
export interface AppRepoPerson {
|
|
13
|
+
name: string;
|
|
14
|
+
email: string;
|
|
15
|
+
}
|
|
16
|
+
/** One app repo (`GET /projects/v1/:project_id/app-repos/:repo_name`). */
|
|
17
|
+
export interface AppRepo {
|
|
18
|
+
/** `default`, or a name matching `^[a-z0-9][a-z0-9._-]{0,63}$` (never ending in `.git`). */
|
|
19
|
+
repo_name: string;
|
|
20
|
+
/** The commit `main` points at; `null` for an empty repo. */
|
|
21
|
+
head: string | null;
|
|
22
|
+
/** The head commit's per-repo sequence number; `null` for an empty repo. */
|
|
23
|
+
seq: number | null;
|
|
24
|
+
commit_count: number;
|
|
25
|
+
/** Bytes of the objects this repo references (counted toward the organization's pooled storage). */
|
|
26
|
+
size_bytes: number;
|
|
27
|
+
/** `size_bytes` as a decimal label, e.g. `"1.2 MB"`. */
|
|
28
|
+
size: string;
|
|
29
|
+
/** `https://…/projects/v1/:project_id/app-repos/:repo_name.git`; holds no credential. Clone it with `run402 app-repos clone`. */
|
|
30
|
+
clone_url: string;
|
|
31
|
+
/** `null` for the `default` repo before its first commit. */
|
|
32
|
+
created_at: string | null;
|
|
33
|
+
updated_at: string | null;
|
|
34
|
+
}
|
|
35
|
+
/** `GET /projects/v1/:project_id/app-repos`: `default` is always listed. */
|
|
36
|
+
export interface AppRepoList {
|
|
37
|
+
app_repos: AppRepo[];
|
|
38
|
+
}
|
|
39
|
+
/** `POST /projects/v1/:project_id/app-repos`. */
|
|
40
|
+
export interface AppRepoCreateOptions {
|
|
41
|
+
repo_name: string;
|
|
42
|
+
/** Another repo of the same project to start from: its head and history are copied, its objects shared (no bytes copied). */
|
|
43
|
+
from?: string;
|
|
44
|
+
}
|
|
45
|
+
/** `DELETE …/app-repos/:repo_name?confirm=<repo_name>`. */
|
|
46
|
+
export interface AppRepoDeleteOptions {
|
|
47
|
+
/** Must equal the repo name. */
|
|
48
|
+
confirm: string;
|
|
49
|
+
}
|
|
50
|
+
export interface AppRepoDeleteResult {
|
|
51
|
+
deleted: true;
|
|
52
|
+
repo_name: string;
|
|
53
|
+
}
|
|
54
|
+
/** One commit on `main`, as the log records it. */
|
|
55
|
+
export interface AppRepoCommit {
|
|
56
|
+
commit: string;
|
|
57
|
+
/** First parent; `null` for the first commit. */
|
|
58
|
+
parent: string | null;
|
|
59
|
+
seq: number;
|
|
60
|
+
author: AppRepoPerson;
|
|
61
|
+
committer: AppRepoPerson;
|
|
62
|
+
message: string;
|
|
63
|
+
committed_at: string;
|
|
64
|
+
/** Changed paths relative to the first parent, capped at 100. */
|
|
65
|
+
paths: string[];
|
|
66
|
+
/** Exact number of changed paths. */
|
|
67
|
+
paths_total: number;
|
|
68
|
+
/** The end user the gateway verified for an app commit (`Run402-Actor` trailer); `null` otherwise. */
|
|
69
|
+
actor_user_id: string | null;
|
|
70
|
+
}
|
|
71
|
+
export interface AppRepoLogOptions {
|
|
72
|
+
/** Only commits that changed this path (a file, or a directory prefix). */
|
|
73
|
+
path?: string;
|
|
74
|
+
/** `next_cursor` from the previous page. */
|
|
75
|
+
cursor?: string;
|
|
76
|
+
/** 1–100, default 50. */
|
|
77
|
+
limit?: number;
|
|
78
|
+
}
|
|
79
|
+
/** `GET …/:repo_name/commits`: newest first. */
|
|
80
|
+
export interface AppRepoLogPage {
|
|
81
|
+
commits: AppRepoCommit[];
|
|
82
|
+
head: string | null;
|
|
83
|
+
has_more: boolean;
|
|
84
|
+
next_cursor: string | null;
|
|
85
|
+
}
|
|
86
|
+
export interface AppRepoReadOptions {
|
|
87
|
+
/** A commit id; omitted reads the head. */
|
|
88
|
+
at?: string;
|
|
89
|
+
}
|
|
90
|
+
/** A file read with `readFile`. */
|
|
91
|
+
export interface AppRepoFile {
|
|
92
|
+
repo_name: string;
|
|
93
|
+
path: string;
|
|
94
|
+
/** The commit read (`X-Run402-Commit`). */
|
|
95
|
+
commit: string | null;
|
|
96
|
+
/** The blob's git object id (`ETag`). */
|
|
97
|
+
oid: string | null;
|
|
98
|
+
content_type: string | null;
|
|
99
|
+
size_bytes: number;
|
|
100
|
+
bytes: Uint8Array;
|
|
101
|
+
/** `bytes` decoded as UTF-8, or `null` when they are not valid UTF-8. */
|
|
102
|
+
text: string | null;
|
|
103
|
+
}
|
|
104
|
+
export interface AppRepoTreeEntry {
|
|
105
|
+
name: string;
|
|
106
|
+
path: string;
|
|
107
|
+
type: "file" | "dir";
|
|
108
|
+
/** File size in bytes; `null` for a directory. */
|
|
109
|
+
size: number | null;
|
|
110
|
+
oid: string;
|
|
111
|
+
}
|
|
112
|
+
/** `GET …/:repo_name/tree[/<path>]`. */
|
|
113
|
+
export interface AppRepoTree {
|
|
114
|
+
/** `null` for an empty repo (and then `entries` is empty). */
|
|
115
|
+
commit: string | null;
|
|
116
|
+
path: string;
|
|
117
|
+
entries: AppRepoTreeEntry[];
|
|
118
|
+
}
|
|
119
|
+
export interface AppRepoDiffChange {
|
|
120
|
+
path: string;
|
|
121
|
+
status: "added" | "modified" | "deleted";
|
|
122
|
+
old_oid: string | null;
|
|
123
|
+
new_oid: string | null;
|
|
124
|
+
}
|
|
125
|
+
/** `GET …/:repo_name/diff?from=&to=`. */
|
|
126
|
+
export interface AppRepoDiff {
|
|
127
|
+
from: string;
|
|
128
|
+
to: string;
|
|
129
|
+
changes: AppRepoDiffChange[];
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* One path's new content on the wire: UTF-8 text, base64 bytes, or a JSON
|
|
133
|
+
* value the gateway writes canonically (object keys sorted, two-space
|
|
134
|
+
* indent, a trailing newline).
|
|
135
|
+
*/
|
|
136
|
+
export type AppRepoFileContent = {
|
|
137
|
+
text: string;
|
|
138
|
+
} | {
|
|
139
|
+
base64: string;
|
|
140
|
+
} | {
|
|
141
|
+
json: unknown;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Path → content. A `string` is shorthand for `{ text }`, a `Uint8Array` for
|
|
145
|
+
* `{ base64 }`, and `null` deletes the path. Paths have no leading `/`, no
|
|
146
|
+
* `.`, `..` or `.git` segment; at most 1,000 entries; each file at most
|
|
147
|
+
* 4 MiB (`APP_REPO_FILE_TOO_LARGE`: put media in `assets.put` and commit a
|
|
148
|
+
* reference).
|
|
149
|
+
*/
|
|
150
|
+
export type AppRepoCommitFiles = Record<string, AppRepoFileContent | string | Uint8Array | null>;
|
|
151
|
+
/** `POST …/:repo_name/commits`. */
|
|
152
|
+
export interface AppRepoCommitOptions {
|
|
153
|
+
files: AppRepoCommitFiles;
|
|
154
|
+
/** Default `Update <path>` for one path, `Update <n> files` otherwise. */
|
|
155
|
+
message?: string;
|
|
156
|
+
/** Who the commit names as author; the committer is always the app. */
|
|
157
|
+
author?: AppRepoPerson;
|
|
158
|
+
/** Land only if this is still the head (`409 APP_REPO_CONFLICT` otherwise). */
|
|
159
|
+
parent?: string;
|
|
160
|
+
/**
|
|
161
|
+
* The commit you read from (default: the head). Without `parent`, the
|
|
162
|
+
* commit lands on a newer head only when none of its paths changed since
|
|
163
|
+
* `base`; otherwise `409 APP_REPO_CONFLICT` with `details.conflicting_paths`.
|
|
164
|
+
*/
|
|
165
|
+
base?: string;
|
|
166
|
+
}
|
|
167
|
+
/** `POST …/:repo_name/reverts`. */
|
|
168
|
+
export interface AppRepoRevertOptions {
|
|
169
|
+
/** Default `Revert "<subject>"`, with the trailer `This reverts commit <commit>.` */
|
|
170
|
+
message?: string;
|
|
171
|
+
}
|
|
172
|
+
/** A commit that changed something (`201`). */
|
|
173
|
+
export interface AppRepoCommitted {
|
|
174
|
+
committed: true;
|
|
175
|
+
commit: string;
|
|
176
|
+
parent: string | null;
|
|
177
|
+
head: string;
|
|
178
|
+
seq: number;
|
|
179
|
+
paths: string[];
|
|
180
|
+
author: AppRepoPerson;
|
|
181
|
+
}
|
|
182
|
+
/** A commit that changed nothing (`200`): no commit was created. */
|
|
183
|
+
export interface AppRepoNotCommitted {
|
|
184
|
+
committed: false;
|
|
185
|
+
head: string | null;
|
|
186
|
+
}
|
|
187
|
+
export type AppRepoCommitResult = AppRepoCommitted | AppRepoNotCommitted;
|
|
188
|
+
//# sourceMappingURL=app-repos.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-repos.types.d.ts","sourceRoot":"","sources":["../../src/namespaces/app-repos.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,gDAAgD;AAChD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,0EAA0E;AAC1E,MAAM,WAAW,OAAO;IACtB,4FAA4F;IAC5F,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,4EAA4E;IAC5E,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,oGAAoG;IACpG,UAAU,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,iIAAiI;IACjI,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,4EAA4E;AAC5E,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,OAAO,EAAE,CAAC;CACtB;AAED,iDAAiD;AACjD,MAAM,WAA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;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,CAAC;AAEjG,mCAAmC;AACnC,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,mCAAmC;AACnC,MAAM,WAAW,oBAAoB;IACnC,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,+CAA+C;AAC/C,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,IAAI,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,oEAAoE;AACpE,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,KAAK,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,GAAG,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the `appRepos` namespace: plain git repositories owned by a
|
|
3
|
+
* project and written by its app (`/projects/v1/:project_id/app-repos`).
|
|
4
|
+
*
|
|
5
|
+
* An app repo is NOT a KyGit vault: it is unencrypted, the platform reads its
|
|
6
|
+
* files to serve them, and it has one linear branch, `main`. The encrypted
|
|
7
|
+
* remote for source is `r.repos`. Every project has a `default` app repo that
|
|
8
|
+
* needs no creation; until its first commit it reads as an empty repository
|
|
9
|
+
* (`head: null`, no files, an empty log).
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=app-repos.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-repos.types.js","sourceRoot":"","sources":["../../src/namespaces/app-repos.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/namespaces/deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAwB3C,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EAQtB,WAAW,EACX,oBAAoB,EAEpB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EAIvB,sBAAsB,EACtB,oBAAoB,EAUpB,iBAAiB,EAGjB,YAAY,EACZ,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,2BAA2B,EAC3B,uBAAuB,EACvB,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAGlB,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAgH3B,qBAAa,MAAM;IACL,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAnC,YAA6B,MAAM,EAAE,MAAM,EAAI;IAE/C;;;;OAIG;IACG,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAiD7E;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAE1E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U,CAAC,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA2B7E;IAED;;;;OAIG;IACG,gBAAgB,CACpB,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,sBAAsB,CAAC,CAmBjC;IAED;;;;OAIG;IACG,IAAI,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA6BlE;IAED;;;;OAIG;IACG,OAAO,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAUxE;CACF;AAszED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;iEAG6D;IAC7D,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;CACvC;AA2iFD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKrD"}
|
|
@@ -2474,7 +2474,7 @@ const FUNCTION_SPEC_FIELDS = new Set([
|
|
|
2474
2474
|
"capabilities",
|
|
2475
2475
|
]);
|
|
2476
2476
|
const FUNCTION_CONFIG_FIELDS = new Set(["timeoutSeconds", "memoryMb"]);
|
|
2477
|
-
const FUNCTION_TRIGGER_FIELDS = new Set(["id", "type", "cron", "timezone", "misfire_policy", "overlap_policy", "mailbox", "events", "run"]);
|
|
2477
|
+
const FUNCTION_TRIGGER_FIELDS = new Set(["id", "type", "cron", "timezone", "misfire_policy", "overlap_policy", "mailbox", "events", "repo", "paths", "run"]);
|
|
2478
2478
|
const FUNCTION_TRIGGER_RUN_FIELDS = new Set(["event_type", "payload", "retry", "expires_after_seconds"]);
|
|
2479
2479
|
const SITE_SPEC_FIELDS = new Set(["replace", "patch", "public_paths", "embedding", "sign_in_path", "noindex"]);
|
|
2480
2480
|
const SITE_PATCH_FIELDS = new Set(["put", "delete"]);
|
|
@@ -2485,6 +2485,7 @@ const ROUTES_SPEC_FIELDS = new Set(["replace"]);
|
|
|
2485
2485
|
const ROUTE_ENTRY_FIELDS = new Set(["pattern", "methods", "target", "pricing"]);
|
|
2486
2486
|
const FUNCTION_ROUTE_TARGET_FIELDS = new Set(["type", "name"]);
|
|
2487
2487
|
const STATIC_ROUTE_TARGET_FIELDS = new Set(["type", "file"]);
|
|
2488
|
+
const REPO_ROUTE_TARGET_FIELDS = new Set(["type", "repo", "path", "requireAuth", "requireRole"]);
|
|
2488
2489
|
const ROUTE_METHOD_SET = new Set(ROUTE_HTTP_METHODS);
|
|
2489
2490
|
const ROUTE_PRICING_FIELDS = new Set([
|
|
2490
2491
|
"mode",
|
|
@@ -2662,6 +2663,9 @@ function validateFunctionTriggers(value, resource) {
|
|
|
2662
2663
|
if (seen.has(obj.id))
|
|
2663
2664
|
throw invalidSpec(`ReleaseSpec.${path}.id duplicates ${JSON.stringify(obj.id)}`, `${path}.id`);
|
|
2664
2665
|
seen.add(obj.id);
|
|
2666
|
+
if (obj.type !== "app_repo" && (obj.repo !== undefined || obj.paths !== undefined)) {
|
|
2667
|
+
throw invalidSpec(`ReleaseSpec.${path} ${String(obj.type)} triggers cannot include repo or paths`, path);
|
|
2668
|
+
}
|
|
2665
2669
|
if (obj.type === "schedule") {
|
|
2666
2670
|
if (obj.mailbox !== undefined || obj.events !== undefined) {
|
|
2667
2671
|
throw invalidSpec(`ReleaseSpec.${path} schedule triggers cannot include mailbox or events`, path);
|
|
@@ -2698,8 +2702,31 @@ function validateFunctionTriggers(value, resource) {
|
|
|
2698
2702
|
}
|
|
2699
2703
|
}
|
|
2700
2704
|
}
|
|
2705
|
+
else if (obj.type === "app_repo") {
|
|
2706
|
+
if (obj.cron !== undefined ||
|
|
2707
|
+
obj.timezone !== undefined ||
|
|
2708
|
+
obj.misfire_policy !== undefined ||
|
|
2709
|
+
obj.overlap_policy !== undefined ||
|
|
2710
|
+
obj.mailbox !== undefined ||
|
|
2711
|
+
obj.events !== undefined) {
|
|
2712
|
+
throw invalidSpec(`ReleaseSpec.${path} app_repo triggers take only repo, paths and run`, path);
|
|
2713
|
+
}
|
|
2714
|
+
if (typeof obj.repo !== "string" || obj.repo.trim() === "") {
|
|
2715
|
+
throw invalidSpec(`ReleaseSpec.${path}.repo is required (an app repo name, e.g. "default")`, `${path}.repo`);
|
|
2716
|
+
}
|
|
2717
|
+
if (obj.paths !== undefined) {
|
|
2718
|
+
if (!Array.isArray(obj.paths) || obj.paths.length === 0) {
|
|
2719
|
+
throw invalidSpec(`ReleaseSpec.${path}.paths must be a non-empty array of path prefixes; omit it for every commit`, `${path}.paths`);
|
|
2720
|
+
}
|
|
2721
|
+
for (const [pathIndex, prefix] of obj.paths.entries()) {
|
|
2722
|
+
if (typeof prefix !== "string" || prefix === "") {
|
|
2723
|
+
throw invalidSpec(`ReleaseSpec.${path}.paths.${pathIndex} must be a non-empty string`, `${path}.paths.${pathIndex}`);
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2701
2728
|
else {
|
|
2702
|
-
throw invalidSpec(`ReleaseSpec.${path}.type must be "schedule" or "
|
|
2729
|
+
throw invalidSpec(`ReleaseSpec.${path}.type must be "schedule", "email" or "app_repo"`, `${path}.type`);
|
|
2703
2730
|
}
|
|
2704
2731
|
const run = requireObject(obj.run, `${path}.run`);
|
|
2705
2732
|
validateKnownFields(run, `${path}.run`, FUNCTION_TRIGGER_RUN_FIELDS);
|
|
@@ -2964,6 +2991,19 @@ function validateRouteEntry(route, resource) {
|
|
|
2964
2991
|
if (targetType === "static") {
|
|
2965
2992
|
validateStaticRouteEntry(entry, resource);
|
|
2966
2993
|
}
|
|
2994
|
+
if (targetType === "repo") {
|
|
2995
|
+
validateRepoRouteEntry(entry, resource);
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
/** Shape only: the gateway checks that the repo exists and the path is valid. */
|
|
2999
|
+
function validateRepoRouteEntry(entry, resource) {
|
|
3000
|
+
if (entry.methods === undefined)
|
|
3001
|
+
return;
|
|
3002
|
+
const methodSet = new Set(entry.methods);
|
|
3003
|
+
const valid = methodSet.has("GET") && (methodSet.size === 1 || (methodSet.size === 2 && methodSet.has("HEAD")));
|
|
3004
|
+
if (!valid) {
|
|
3005
|
+
throw invalidRouteSpec(`ReleaseSpec.${resource}.methods for repo route targets must be ["GET"] or ["GET", "HEAD"] (or omitted); a repo target serves GET and HEAD only`, `${resource}.methods`);
|
|
3006
|
+
}
|
|
2967
3007
|
}
|
|
2968
3008
|
function validateRoutePricing(pricing, resource, targetType) {
|
|
2969
3009
|
if (pricing === undefined)
|
|
@@ -3056,7 +3096,23 @@ function validateRouteTarget(target, resource) {
|
|
|
3056
3096
|
validateStaticTargetFile(obj.file, `${resource}.file`);
|
|
3057
3097
|
return "static";
|
|
3058
3098
|
}
|
|
3059
|
-
|
|
3099
|
+
if (obj.type === "repo") {
|
|
3100
|
+
validateKnownFields(obj, resource, REPO_ROUTE_TARGET_FIELDS);
|
|
3101
|
+
if (typeof obj.repo !== "string" || obj.repo.length === 0) {
|
|
3102
|
+
throw invalidRouteSpec(`ReleaseSpec.${resource}.repo is required for repo route targets (an app repo name, e.g. "default")`, `${resource}.repo`);
|
|
3103
|
+
}
|
|
3104
|
+
if (obj.path !== undefined && typeof obj.path !== "string") {
|
|
3105
|
+
throw invalidRouteSpec(`ReleaseSpec.${resource}.path must be a string`, `${resource}.path`);
|
|
3106
|
+
}
|
|
3107
|
+
if (obj.requireAuth !== undefined && typeof obj.requireAuth !== "boolean") {
|
|
3108
|
+
throw invalidRouteSpec(`ReleaseSpec.${resource}.requireAuth must be a boolean`, `${resource}.requireAuth`);
|
|
3109
|
+
}
|
|
3110
|
+
if (obj.requireRole !== undefined && obj.requireRole !== null) {
|
|
3111
|
+
requireObject(obj.requireRole, `${resource}.requireRole`);
|
|
3112
|
+
}
|
|
3113
|
+
return "repo";
|
|
3114
|
+
}
|
|
3115
|
+
throw invalidRouteSpec(`Unsupported route target type ${JSON.stringify(obj.type)} at ReleaseSpec.${resource}.type; route targets support "function", "static" and "repo"`, `${resource}.type`);
|
|
3060
3116
|
}
|
|
3061
3117
|
function validateStaticRouteEntry(entry, resource) {
|
|
3062
3118
|
const pattern = entry.pattern;
|
|
@@ -3809,6 +3865,15 @@ function normalizeFunctionTriggers(triggers) {
|
|
|
3809
3865
|
run,
|
|
3810
3866
|
};
|
|
3811
3867
|
}
|
|
3868
|
+
if (trigger.type === "app_repo") {
|
|
3869
|
+
return {
|
|
3870
|
+
id: trigger.id,
|
|
3871
|
+
type: "app_repo",
|
|
3872
|
+
repo: trigger.repo,
|
|
3873
|
+
...(trigger.paths !== undefined ? { paths: [...trigger.paths] } : {}),
|
|
3874
|
+
run,
|
|
3875
|
+
};
|
|
3876
|
+
}
|
|
3812
3877
|
return {
|
|
3813
3878
|
id: trigger.id,
|
|
3814
3879
|
type: "schedule",
|