@faable/deploy-sdk 2.14.0 → 2.15.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/FaableDeployApi.d.ts.map +1 -1
- package/dist/api/api-types.d.ts +2 -0
- package/dist/api/api-types.d.ts.map +1 -1
- package/dist/api/generated-client.d.ts +76 -0
- package/dist/api/generated-client.d.ts.map +1 -1
- package/dist/api/generated-client.js +58 -0
- package/dist/api/types.d.ts +117 -0
- package/dist/api/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/scripts/gen-client.mjs +48 -2
- package/spec/openapi.json +266 -3
package/scripts/gen-client.mjs
CHANGED
|
@@ -87,6 +87,40 @@ for (const [path, methods] of Object.entries(spec.paths || {})) {
|
|
|
87
87
|
}
|
|
88
88
|
operations.sort((a, b) => a.op.operationId.localeCompare(b.op.operationId));
|
|
89
89
|
|
|
90
|
+
// Multi-line descriptions become one JSDoc line each.
|
|
91
|
+
const escapeBlock = (text) =>
|
|
92
|
+
String(text)
|
|
93
|
+
.split("\n")
|
|
94
|
+
.map((l) => ` * ${escape(l)}`);
|
|
95
|
+
|
|
96
|
+
// The server documents each 4xx/5xx as an ErrorResponse whose `error_code`
|
|
97
|
+
// is restricted to an enum, and describes every code in the response
|
|
98
|
+
// description as "`code` — text" lines. Read both back so the docstring can
|
|
99
|
+
// list what a caller may branch on.
|
|
100
|
+
const errorCodesOf = (op) => {
|
|
101
|
+
const out = [];
|
|
102
|
+
const seen = new Set();
|
|
103
|
+
for (const [status, res] of Object.entries(op.responses || {})) {
|
|
104
|
+
if (!/^[45]\d\d$/.test(status)) continue;
|
|
105
|
+
const schema = res?.content?.["application/json"]?.schema;
|
|
106
|
+
const parts = schema?.allOf || (schema ? [schema] : []);
|
|
107
|
+
const codes = parts.flatMap((p) => p?.properties?.error_code?.enum || []);
|
|
108
|
+
const descriptions = new Map(
|
|
109
|
+
String(res?.description || "")
|
|
110
|
+
.split("\n")
|
|
111
|
+
.map((l) => l.match(/^`([a-z_]+)` — (.*)$/))
|
|
112
|
+
.filter(Boolean)
|
|
113
|
+
.map((m) => [m[1], m[2]]),
|
|
114
|
+
);
|
|
115
|
+
for (const code of codes) {
|
|
116
|
+
if (seen.has(code)) continue;
|
|
117
|
+
seen.add(code);
|
|
118
|
+
out.push({ code, status, description: descriptions.get(code) });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return out;
|
|
122
|
+
};
|
|
123
|
+
|
|
90
124
|
const emitMethod = ({ path, httpMethod, op }) => {
|
|
91
125
|
const id = op.operationId;
|
|
92
126
|
const name = toMethodName(id);
|
|
@@ -146,11 +180,23 @@ const emitMethod = ({ path, httpMethod, op }) => {
|
|
|
146
180
|
}
|
|
147
181
|
|
|
148
182
|
const guards = pathParams.map((p) => ` requireId("${p}", ${p});`);
|
|
149
|
-
|
|
183
|
+
// Summary AND description: the CRUD summaries are generic ("Get User") and
|
|
184
|
+
// used to hide the prose that actually explains the endpoint.
|
|
185
|
+
const docLines = [op.summary, op.description]
|
|
186
|
+
.filter((x, i, all) => x && all.indexOf(x) === i)
|
|
187
|
+
.flatMap((text, i) => [...(i ? [" *"] : []), ...escapeBlock(text)]);
|
|
188
|
+
// One `@throws` per documented error code, read from the 4xx/5xx responses
|
|
189
|
+
// the server injects (see auth's server/openapi_errors.ts). The code is
|
|
190
|
+
// `err.error_code` on the FaableApiError the fetcher throws.
|
|
191
|
+
const throwsLines = errorCodesOf(op).map(
|
|
192
|
+
({ code, status, description }) =>
|
|
193
|
+
` * @throws {FaableApiError} \`${code}\` (${status})${description ? ` — ${escape(description)}` : ""}`,
|
|
194
|
+
);
|
|
150
195
|
const jsdoc = [
|
|
151
196
|
" /**",
|
|
152
197
|
` * \`${httpMethod.toUpperCase()} ${path}\` — operationId: \`${id}\``,
|
|
153
|
-
...(
|
|
198
|
+
...(docLines.length ? [" *", ...docLines] : []),
|
|
199
|
+
...(throwsLines.length ? [" *", ...throwsLines] : []),
|
|
154
200
|
" */",
|
|
155
201
|
].join("\n");
|
|
156
202
|
|
package/spec/openapi.json
CHANGED
|
@@ -69,6 +69,105 @@
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"schemas": {
|
|
72
|
+
"ProjectLimits": {
|
|
73
|
+
"type": "object",
|
|
74
|
+
"required": [
|
|
75
|
+
"can_create",
|
|
76
|
+
"reason",
|
|
77
|
+
"message",
|
|
78
|
+
"free_projects",
|
|
79
|
+
"max_free_projects",
|
|
80
|
+
"upgradable_projects",
|
|
81
|
+
"new_account_window_ends_at",
|
|
82
|
+
"resolved"
|
|
83
|
+
],
|
|
84
|
+
"properties": {
|
|
85
|
+
"can_create": {
|
|
86
|
+
"type": "boolean"
|
|
87
|
+
},
|
|
88
|
+
"reason": {
|
|
89
|
+
"anyOf": [
|
|
90
|
+
{
|
|
91
|
+
"type": "string",
|
|
92
|
+
"enum": [
|
|
93
|
+
"free_project_limit"
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"type": "string",
|
|
98
|
+
"enum": [
|
|
99
|
+
"new_account_window"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"type": "null"
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
"message": {
|
|
108
|
+
"anyOf": [
|
|
109
|
+
{
|
|
110
|
+
"type": "string"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"type": "null"
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
"free_projects": {
|
|
118
|
+
"anyOf": [
|
|
119
|
+
{
|
|
120
|
+
"type": "integer"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"type": "null"
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
"max_free_projects": {
|
|
128
|
+
"anyOf": [
|
|
129
|
+
{
|
|
130
|
+
"type": "integer"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"type": "null"
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
"upgradable_projects": {
|
|
138
|
+
"type": "array",
|
|
139
|
+
"items": {
|
|
140
|
+
"type": "object",
|
|
141
|
+
"required": [
|
|
142
|
+
"id",
|
|
143
|
+
"name"
|
|
144
|
+
],
|
|
145
|
+
"properties": {
|
|
146
|
+
"id": {
|
|
147
|
+
"type": "string"
|
|
148
|
+
},
|
|
149
|
+
"name": {
|
|
150
|
+
"type": "string"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"new_account_window_ends_at": {
|
|
156
|
+
"anyOf": [
|
|
157
|
+
{
|
|
158
|
+
"type": "string",
|
|
159
|
+
"format": "date-time"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"type": "null"
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
},
|
|
166
|
+
"resolved": {
|
|
167
|
+
"type": "boolean"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
},
|
|
72
171
|
"ProjectInvite": {
|
|
73
172
|
"type": "object",
|
|
74
173
|
"required": [
|
|
@@ -1040,7 +1139,8 @@
|
|
|
1040
1139
|
"description": {
|
|
1041
1140
|
"type": "string"
|
|
1042
1141
|
}
|
|
1043
|
-
}
|
|
1142
|
+
},
|
|
1143
|
+
"additionalProperties": false
|
|
1044
1144
|
},
|
|
1045
1145
|
"AppUpdate": {
|
|
1046
1146
|
"type": "object",
|
|
@@ -1074,6 +1174,44 @@
|
|
|
1074
1174
|
},
|
|
1075
1175
|
"additionalProperties": false
|
|
1076
1176
|
},
|
|
1177
|
+
"AppRepoLinkable": {
|
|
1178
|
+
"type": "object",
|
|
1179
|
+
"required": [
|
|
1180
|
+
"linkable"
|
|
1181
|
+
],
|
|
1182
|
+
"properties": {
|
|
1183
|
+
"linkable": {
|
|
1184
|
+
"type": "boolean"
|
|
1185
|
+
},
|
|
1186
|
+
"code": {
|
|
1187
|
+
"type": "string",
|
|
1188
|
+
"enum": [
|
|
1189
|
+
"repository_already_linked"
|
|
1190
|
+
]
|
|
1191
|
+
},
|
|
1192
|
+
"message": {
|
|
1193
|
+
"type": "string"
|
|
1194
|
+
},
|
|
1195
|
+
"details": {
|
|
1196
|
+
"type": "object",
|
|
1197
|
+
"required": [
|
|
1198
|
+
"app_id"
|
|
1199
|
+
],
|
|
1200
|
+
"properties": {
|
|
1201
|
+
"app_id": {
|
|
1202
|
+
"type": "string"
|
|
1203
|
+
},
|
|
1204
|
+
"app_name": {
|
|
1205
|
+
"type": "string"
|
|
1206
|
+
},
|
|
1207
|
+
"project": {
|
|
1208
|
+
"type": "string"
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
},
|
|
1213
|
+
"description": "Repository link pre-check"
|
|
1214
|
+
},
|
|
1077
1215
|
"DeployBranchResult": {
|
|
1078
1216
|
"type": "object",
|
|
1079
1217
|
"required": [
|
|
@@ -1358,6 +1496,16 @@
|
|
|
1358
1496
|
"type": "string",
|
|
1359
1497
|
"description": "Why the deployment failed (shown to the user on ERROR)"
|
|
1360
1498
|
},
|
|
1499
|
+
"failure_code": {
|
|
1500
|
+
"type": "string",
|
|
1501
|
+
"description": "Producer's own name for what failed (e.g. detect_no_buildpack). Not the fault taxonomy."
|
|
1502
|
+
},
|
|
1503
|
+
"failure_detail": {
|
|
1504
|
+
"type": "object",
|
|
1505
|
+
"properties": {},
|
|
1506
|
+
"additionalProperties": true,
|
|
1507
|
+
"description": "Structured context the producer had before writing `reason` (found_files, subdir_hits, workdir, root_dir…). Never free build output: it must carry no repository paths beyond the entry names detection already lists."
|
|
1508
|
+
},
|
|
1361
1509
|
"cold_state": {
|
|
1362
1510
|
"anyOf": [
|
|
1363
1511
|
{
|
|
@@ -4117,6 +4265,48 @@
|
|
|
4117
4265
|
}
|
|
4118
4266
|
},
|
|
4119
4267
|
"paths": {
|
|
4268
|
+
"/project/limits": {
|
|
4269
|
+
"get": {
|
|
4270
|
+
"operationId": "project/limits",
|
|
4271
|
+
"summary": "Project creation limits for the caller",
|
|
4272
|
+
"tags": [
|
|
4273
|
+
"projects"
|
|
4274
|
+
],
|
|
4275
|
+
"description": "Whether the caller can create another project, and why not",
|
|
4276
|
+
"security": [
|
|
4277
|
+
{
|
|
4278
|
+
"faable_user": []
|
|
4279
|
+
},
|
|
4280
|
+
{
|
|
4281
|
+
"faable_cli": []
|
|
4282
|
+
},
|
|
4283
|
+
{
|
|
4284
|
+
"faable_m2m": []
|
|
4285
|
+
},
|
|
4286
|
+
{
|
|
4287
|
+
"faable_machine": []
|
|
4288
|
+
},
|
|
4289
|
+
{
|
|
4290
|
+
"apikey_basic": []
|
|
4291
|
+
},
|
|
4292
|
+
{
|
|
4293
|
+
"apikey": []
|
|
4294
|
+
}
|
|
4295
|
+
],
|
|
4296
|
+
"responses": {
|
|
4297
|
+
"200": {
|
|
4298
|
+
"description": "Default Response",
|
|
4299
|
+
"content": {
|
|
4300
|
+
"application/json": {
|
|
4301
|
+
"schema": {
|
|
4302
|
+
"$ref": "#/components/schemas/ProjectLimits"
|
|
4303
|
+
}
|
|
4304
|
+
}
|
|
4305
|
+
}
|
|
4306
|
+
}
|
|
4307
|
+
}
|
|
4308
|
+
}
|
|
4309
|
+
},
|
|
4120
4310
|
"/project/{id}/invite": {
|
|
4121
4311
|
"post": {
|
|
4122
4312
|
"operationId": "project/invite",
|
|
@@ -5067,7 +5257,8 @@
|
|
|
5067
5257
|
"description": {
|
|
5068
5258
|
"type": "string"
|
|
5069
5259
|
}
|
|
5070
|
-
}
|
|
5260
|
+
},
|
|
5261
|
+
"additionalProperties": false
|
|
5071
5262
|
}
|
|
5072
5263
|
}
|
|
5073
5264
|
}
|
|
@@ -6597,6 +6788,71 @@
|
|
|
6597
6788
|
}
|
|
6598
6789
|
}
|
|
6599
6790
|
},
|
|
6791
|
+
"/app/repo-linkable": {
|
|
6792
|
+
"get": {
|
|
6793
|
+
"operationId": "app/repo_linkable",
|
|
6794
|
+
"summary": "Check whether a repository can be linked to a new app",
|
|
6795
|
+
"tags": [
|
|
6796
|
+
"apps",
|
|
6797
|
+
"github"
|
|
6798
|
+
],
|
|
6799
|
+
"description": "Runs the free-plan \"one repository, one app\" guard before the app exists. Always 200: `linkable:false` names the app that already has the repository (and its project when it is another one of yours), with the same message the link would refuse with.",
|
|
6800
|
+
"parameters": [
|
|
6801
|
+
{
|
|
6802
|
+
"schema": {
|
|
6803
|
+
"type": "string",
|
|
6804
|
+
"minLength": 3,
|
|
6805
|
+
"maxLength": 255
|
|
6806
|
+
},
|
|
6807
|
+
"in": "query",
|
|
6808
|
+
"name": "repository",
|
|
6809
|
+
"required": true,
|
|
6810
|
+
"description": "GitHub repository full name, e.g. acme/api"
|
|
6811
|
+
},
|
|
6812
|
+
{
|
|
6813
|
+
"schema": {
|
|
6814
|
+
"type": "string"
|
|
6815
|
+
},
|
|
6816
|
+
"in": "query",
|
|
6817
|
+
"name": "github_installation_id",
|
|
6818
|
+
"required": false,
|
|
6819
|
+
"description": "GitHub App installation the repo belongs to"
|
|
6820
|
+
}
|
|
6821
|
+
],
|
|
6822
|
+
"security": [
|
|
6823
|
+
{
|
|
6824
|
+
"faable_user": []
|
|
6825
|
+
},
|
|
6826
|
+
{
|
|
6827
|
+
"faable_cli": []
|
|
6828
|
+
},
|
|
6829
|
+
{
|
|
6830
|
+
"faable_m2m": []
|
|
6831
|
+
},
|
|
6832
|
+
{
|
|
6833
|
+
"faable_machine": []
|
|
6834
|
+
},
|
|
6835
|
+
{
|
|
6836
|
+
"apikey_basic": []
|
|
6837
|
+
},
|
|
6838
|
+
{
|
|
6839
|
+
"apikey": []
|
|
6840
|
+
}
|
|
6841
|
+
],
|
|
6842
|
+
"responses": {
|
|
6843
|
+
"200": {
|
|
6844
|
+
"description": "Repository link pre-check",
|
|
6845
|
+
"content": {
|
|
6846
|
+
"application/json": {
|
|
6847
|
+
"schema": {
|
|
6848
|
+
"$ref": "#/components/schemas/AppRepoLinkable"
|
|
6849
|
+
}
|
|
6850
|
+
}
|
|
6851
|
+
}
|
|
6852
|
+
}
|
|
6853
|
+
}
|
|
6854
|
+
}
|
|
6855
|
+
},
|
|
6600
6856
|
"/app/{app_id}/registry": {
|
|
6601
6857
|
"get": {
|
|
6602
6858
|
"operationId": "app/get_registry",
|
|
@@ -6870,7 +7126,8 @@
|
|
|
6870
7126
|
"origin_status_codes",
|
|
6871
7127
|
"latency",
|
|
6872
7128
|
"top_referrers",
|
|
6873
|
-
"top_user_agents"
|
|
7129
|
+
"top_user_agents",
|
|
7130
|
+
"degraded"
|
|
6874
7131
|
],
|
|
6875
7132
|
"properties": {
|
|
6876
7133
|
"range": {
|
|
@@ -7089,6 +7346,12 @@
|
|
|
7089
7346
|
}
|
|
7090
7347
|
}
|
|
7091
7348
|
}
|
|
7349
|
+
},
|
|
7350
|
+
"degraded": {
|
|
7351
|
+
"type": "array",
|
|
7352
|
+
"items": {
|
|
7353
|
+
"type": "string"
|
|
7354
|
+
}
|
|
7092
7355
|
}
|
|
7093
7356
|
}
|
|
7094
7357
|
}
|