noodleseed-cli 0.1.11 → 0.1.13
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/agents.d.ts +3 -0
- package/dist/agents.d.ts.map +1 -0
- package/dist/agents.js +231 -0
- package/dist/agents.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +16 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1102 -107
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +2 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/control-plane.d.ts +15 -1
- package/dist/control-plane.d.ts.map +1 -1
- package/dist/control-plane.js +90 -15
- package/dist/control-plane.js.map +1 -1
- package/dist/deploy.d.ts +3 -5
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +20 -7
- package/dist/deploy.js.map +1 -1
- package/dist/dev.d.ts +11 -5
- package/dist/dev.d.ts.map +1 -1
- package/dist/dev.js +7 -17
- package/dist/dev.js.map +1 -1
- package/dist/diagnostics.d.ts +9 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +10 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/doctor.d.ts +7 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +396 -0
- package/dist/doctor.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/node-version.d.ts +5 -0
- package/dist/node-version.d.ts.map +1 -0
- package/dist/node-version.js +17 -0
- package/dist/node-version.js.map +1 -0
- package/dist/openapi-import.d.ts +12 -0
- package/dist/openapi-import.d.ts.map +1 -0
- package/dist/openapi-import.js +95 -0
- package/dist/openapi-import.js.map +1 -0
- package/dist/project.d.ts +45 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.js +252 -0
- package/dist/project.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/broker/secret-box.d.ts +2 -2
- package/node_modules/@noodle-borg/runtime/dist/broker/secret-box.js +2 -2
- package/node_modules/@noodle-borg/service/dist/service.d.ts +6 -25
- package/node_modules/@noodle-borg/service/dist/service.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/service.js +219 -175
- package/node_modules/@noodle-borg/service/dist/service.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres.d.ts +2 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres.js +19 -78
- package/node_modules/@noodle-borg/service/dist/store/postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store.d.ts +24 -12
- package/node_modules/@noodle-borg/service/dist/store.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store.js +18 -18
- package/node_modules/@noodle-borg/service/dist/store.js.map +1 -1
- package/node_modules/@noodle-borg/transport-http/dist/handler.d.ts +2 -21
- package/node_modules/@noodle-borg/transport-http/dist/handler.d.ts.map +1 -1
- package/node_modules/@noodle-borg/transport-http/dist/handler.js +14 -25
- package/node_modules/@noodle-borg/transport-http/dist/handler.js.map +1 -1
- package/node_modules/@noodle-borg/transport-http/dist/index.d.ts +1 -2
- package/node_modules/@noodle-borg/transport-http/dist/index.d.ts.map +1 -1
- package/node_modules/@noodle-borg/transport-http/dist/index.js +0 -1
- package/node_modules/@noodle-borg/transport-http/dist/index.js.map +1 -1
- package/node_modules/@noodle-borg/transport-http/dist/logging.d.ts +1 -1
- package/node_modules/@noodle-borg/transport-http/dist/logging.js +1 -1
- package/package.json +2 -2
package/dist/doctor.js
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join, resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { compileConnectors } from '@noodle-borg/connector-defs';
|
|
5
|
+
import { readConfig, readServers } from './config.js';
|
|
6
|
+
import { resolveControlPlaneToken, serviceJson } from './control-plane.js';
|
|
7
|
+
import { DEFAULT_SERVICE_URL, readDeployInput } from './deploy.js';
|
|
8
|
+
import { readProjectLink, resolveLinkedEntrypoint } from './project.js';
|
|
9
|
+
import { currentCliVersion } from './update.js';
|
|
10
|
+
import { validate } from './validate.js';
|
|
11
|
+
export async function runDoctor(options) {
|
|
12
|
+
const args = parseDoctorArgs(options.rest);
|
|
13
|
+
const project = readProjectLink();
|
|
14
|
+
const config = readConfig(options.home);
|
|
15
|
+
const checks = [];
|
|
16
|
+
const node = nodeCheck();
|
|
17
|
+
checks.push(node);
|
|
18
|
+
checks.push({ level: 'PASS', name: 'CLI', message: currentCliVersion() });
|
|
19
|
+
const { serviceUrl, token, config: resolvedConfig } = await resolveControlPlaneToken({
|
|
20
|
+
serviceFlag: args.service ??
|
|
21
|
+
(options.env.NOODLE_SERVICE_URL === undefined && project?.serviceUrl !== undefined
|
|
22
|
+
? project.serviceUrl
|
|
23
|
+
: undefined),
|
|
24
|
+
authFlag: args.authToken,
|
|
25
|
+
env: options.env,
|
|
26
|
+
home: options.home,
|
|
27
|
+
});
|
|
28
|
+
const hasLogin = token !== undefined ||
|
|
29
|
+
resolvedConfig.identity !== undefined ||
|
|
30
|
+
config.identity !== undefined ||
|
|
31
|
+
config.authToken !== undefined;
|
|
32
|
+
checks.push(hasLogin
|
|
33
|
+
? {
|
|
34
|
+
level: 'PASS',
|
|
35
|
+
name: 'Login',
|
|
36
|
+
message: resolvedConfig.identity?.email ?? config.identity?.email ?? 'token available',
|
|
37
|
+
}
|
|
38
|
+
: {
|
|
39
|
+
level: 'FAIL',
|
|
40
|
+
name: 'Login',
|
|
41
|
+
message: 'missing',
|
|
42
|
+
cause: 'No saved Noodle login token or identity was found.',
|
|
43
|
+
fix: 'Sign in to Noodle Cloud before deploy and management commands.',
|
|
44
|
+
next: 'noodle login',
|
|
45
|
+
});
|
|
46
|
+
checks.push(await serviceCheck(serviceUrl));
|
|
47
|
+
const entrypoint = args.entrypoint ?? resolveLinkedEntrypoint();
|
|
48
|
+
const target = {
|
|
49
|
+
org: args.org ?? project?.org ?? config.defaultOrg ?? 'local',
|
|
50
|
+
app: args.app ?? project?.app ?? config.defaultApp ?? appFromEntrypoint(entrypoint ?? 'app'),
|
|
51
|
+
env: args.targetEnv ?? project?.env ?? config.defaultEnv ?? 'prod',
|
|
52
|
+
};
|
|
53
|
+
checks.push(await orgMembershipCheck(serviceUrl, token, target.org));
|
|
54
|
+
if (project === undefined && args.entrypoint === undefined) {
|
|
55
|
+
checks.push({
|
|
56
|
+
level: 'FAIL',
|
|
57
|
+
name: 'Project link',
|
|
58
|
+
message: 'missing',
|
|
59
|
+
cause: 'No readable .noodle/project.json was found in this directory.',
|
|
60
|
+
fix: 'Create or bind a local Noodle project.',
|
|
61
|
+
next: 'noodle init && noodle link --org <org> --app <app>',
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
checks.push({
|
|
66
|
+
level: 'PASS',
|
|
67
|
+
name: 'Project link',
|
|
68
|
+
message: project !== undefined
|
|
69
|
+
? `${project.org}/${project.app}/${project.env}`
|
|
70
|
+
: 'explicit entrypoint',
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (entrypoint === undefined || !existsSync(entrypoint)) {
|
|
74
|
+
checks.push({
|
|
75
|
+
level: 'FAIL',
|
|
76
|
+
name: 'Entrypoint',
|
|
77
|
+
message: 'missing',
|
|
78
|
+
cause: 'The linked or supplied project entrypoint does not exist.',
|
|
79
|
+
fix: 'Point the project at a deployable server.ts, manifest.yaml, or manifest.json file.',
|
|
80
|
+
next: 'noodle link --entrypoint <path>',
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
checks.push({ level: 'PASS', name: 'Entrypoint', message: entrypoint });
|
|
85
|
+
const validation = await validate({
|
|
86
|
+
manifestPath: entrypoint,
|
|
87
|
+
...(args.connectorsPath !== undefined ? { connectorsPath: args.connectorsPath } : {}),
|
|
88
|
+
});
|
|
89
|
+
if (validation.ok) {
|
|
90
|
+
checks.push({ level: 'PASS', name: 'Validate', message: 'manifest compiles locally' });
|
|
91
|
+
checks.push(await secretsCheck({
|
|
92
|
+
entrypoint,
|
|
93
|
+
serviceUrl,
|
|
94
|
+
target,
|
|
95
|
+
...(args.connectorsPath !== undefined ? { connectorsPath: args.connectorsPath } : {}),
|
|
96
|
+
...(token !== undefined ? { token } : {}),
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
const first = validation.errors[0];
|
|
101
|
+
checks.push({
|
|
102
|
+
level: 'FAIL',
|
|
103
|
+
name: 'Validate',
|
|
104
|
+
message: `${validation.errors.length} error(s)`,
|
|
105
|
+
cause: first !== undefined
|
|
106
|
+
? `${first.code}${first.path ? ` at ${first.path}` : ''}: ${first.message}`
|
|
107
|
+
: 'The project did not compile.',
|
|
108
|
+
fix: 'Fix the manifest or authored server before running dev or deploy.',
|
|
109
|
+
next: 'noodle validate',
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
checks.push(await endpointHealthCheck(options.home));
|
|
114
|
+
if (args.agentOutput) {
|
|
115
|
+
console.log(agentDoctorOutput(checks));
|
|
116
|
+
return checks.some((check) => check.level === 'FAIL') ? 1 : 0;
|
|
117
|
+
}
|
|
118
|
+
for (const check of checks)
|
|
119
|
+
printCheck(check);
|
|
120
|
+
const next = checks.find((check) => check.level === 'FAIL' && check.next !== undefined)?.next;
|
|
121
|
+
console.log(`Next: ${next ?? 'noodle dev'}`);
|
|
122
|
+
return checks.some((check) => check.level === 'FAIL') ? 1 : 0;
|
|
123
|
+
}
|
|
124
|
+
async function orgMembershipCheck(serviceUrl, token, org) {
|
|
125
|
+
if (token === undefined) {
|
|
126
|
+
return {
|
|
127
|
+
level: 'WARN',
|
|
128
|
+
name: 'Org membership',
|
|
129
|
+
message: 'skipped',
|
|
130
|
+
cause: 'No login token was available to verify org membership.',
|
|
131
|
+
fix: 'Sign in before deploying to hosted Noodle Cloud.',
|
|
132
|
+
next: 'noodle login',
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
const body = await serviceJson(`${serviceUrl}/v1/whoami`, token);
|
|
137
|
+
if (body.identity.superAdmin || body.orgs.some((item) => item.slug === org)) {
|
|
138
|
+
return { level: 'PASS', name: 'Org membership', message: org };
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
level: 'FAIL',
|
|
142
|
+
name: 'Org membership',
|
|
143
|
+
message: org,
|
|
144
|
+
cause: `The current identity is not a member of org "${org}".`,
|
|
145
|
+
fix: 'Ask an org owner to add this identity before deploying.',
|
|
146
|
+
next: `noodle members add --org ${org} --email <email> --subject <subject>`,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
return {
|
|
151
|
+
level: 'WARN',
|
|
152
|
+
name: 'Org membership',
|
|
153
|
+
message: 'could not verify',
|
|
154
|
+
cause: error instanceof Error ? error.message : String(error),
|
|
155
|
+
fix: 'Confirm login and service reachability.',
|
|
156
|
+
next: `noodle login --service ${serviceUrl}`,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
async function endpointHealthCheck(home) {
|
|
161
|
+
const latest = readServers(home).at(-1);
|
|
162
|
+
if (latest === undefined) {
|
|
163
|
+
return { level: 'WARN', name: 'Endpoint health', message: 'no saved deployment metadata' };
|
|
164
|
+
}
|
|
165
|
+
try {
|
|
166
|
+
const res = await fetch(latest.url, { method: 'HEAD' });
|
|
167
|
+
if (res.status < 500)
|
|
168
|
+
return { level: 'PASS', name: 'Endpoint health', message: latest.url };
|
|
169
|
+
return {
|
|
170
|
+
level: 'FAIL',
|
|
171
|
+
name: 'Endpoint health',
|
|
172
|
+
message: latest.url,
|
|
173
|
+
cause: `Endpoint returned HTTP ${res.status}.`,
|
|
174
|
+
fix: 'Check deployment status and service logs.',
|
|
175
|
+
next: 'noodle deploy',
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
return {
|
|
180
|
+
level: 'WARN',
|
|
181
|
+
name: 'Endpoint health',
|
|
182
|
+
message: latest.url,
|
|
183
|
+
cause: error instanceof Error ? error.message : String(error),
|
|
184
|
+
fix: 'Confirm the saved deployment endpoint is still reachable.',
|
|
185
|
+
next: 'noodle deploy',
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function parseDoctorArgs(rest) {
|
|
190
|
+
let service;
|
|
191
|
+
let authToken;
|
|
192
|
+
let org;
|
|
193
|
+
let app;
|
|
194
|
+
let targetEnv;
|
|
195
|
+
let entrypoint;
|
|
196
|
+
let connectorsPath;
|
|
197
|
+
let agentOutput = false;
|
|
198
|
+
for (let i = 0; i < rest.length; i++) {
|
|
199
|
+
const arg = rest[i];
|
|
200
|
+
if (arg === '--service')
|
|
201
|
+
service = rest[++i];
|
|
202
|
+
else if (arg === '--auth-token')
|
|
203
|
+
authToken = rest[++i];
|
|
204
|
+
else if (arg === '--org')
|
|
205
|
+
org = rest[++i];
|
|
206
|
+
else if (arg === '--app')
|
|
207
|
+
app = rest[++i];
|
|
208
|
+
else if (arg === '--env')
|
|
209
|
+
targetEnv = rest[++i];
|
|
210
|
+
else if (arg === '--entrypoint')
|
|
211
|
+
entrypoint = resolve(rest[++i] ?? 'server.ts');
|
|
212
|
+
else if (arg === '--connectors')
|
|
213
|
+
connectorsPath = rest[++i];
|
|
214
|
+
else if (arg === '--agent-output' || arg === '--fix-prompt')
|
|
215
|
+
agentOutput = true;
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
...(service !== undefined ? { service } : {}),
|
|
219
|
+
...(authToken !== undefined ? { authToken } : {}),
|
|
220
|
+
...(org !== undefined ? { org } : {}),
|
|
221
|
+
...(app !== undefined ? { app } : {}),
|
|
222
|
+
...(targetEnv !== undefined ? { targetEnv } : {}),
|
|
223
|
+
...(entrypoint !== undefined ? { entrypoint } : {}),
|
|
224
|
+
...(connectorsPath !== undefined ? { connectorsPath } : {}),
|
|
225
|
+
...(agentOutput ? { agentOutput } : {}),
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function agentDoctorOutput(checks) {
|
|
229
|
+
const failed = checks.filter((check) => check.level === 'FAIL');
|
|
230
|
+
return [
|
|
231
|
+
'Fix this Noodle project readiness failure from `doctor`.',
|
|
232
|
+
'',
|
|
233
|
+
...(failed.length > 0
|
|
234
|
+
? failed.map((check) => `- ${check.name}: ${check.cause ?? check.message}. Next: ${check.next ?? 'noodle doctor'}`)
|
|
235
|
+
: ['- No blocking failures. Keep using `noodle validate`, `noodle test`, and `noodle deploy`.']),
|
|
236
|
+
'',
|
|
237
|
+
'Do not inspect or print tokens, `.env.noodle`, or secret values.',
|
|
238
|
+
].join('\n');
|
|
239
|
+
}
|
|
240
|
+
function nodeCheck() {
|
|
241
|
+
const required = requiredNodeMajor();
|
|
242
|
+
const actual = Number(process.versions.node.split('.')[0]);
|
|
243
|
+
if (Number.isFinite(actual) && actual >= required) {
|
|
244
|
+
return { level: 'PASS', name: 'Node', message: `v${process.versions.node}` };
|
|
245
|
+
}
|
|
246
|
+
return {
|
|
247
|
+
level: 'FAIL',
|
|
248
|
+
name: 'Node',
|
|
249
|
+
message: `v${process.versions.node}`,
|
|
250
|
+
cause: `Noodle CLI requires Node ${required} or newer.`,
|
|
251
|
+
fix: `Install and select Node ${required} LTS.`,
|
|
252
|
+
next: `nvm install ${required} && nvm use ${required}`,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
function requiredNodeMajor() {
|
|
256
|
+
try {
|
|
257
|
+
const pkg = JSON.parse(readFileSync(join(packageRoot(), 'package.json'), 'utf8'));
|
|
258
|
+
const match = /^>=(\d+)/.exec(pkg.engines?.node ?? '');
|
|
259
|
+
return match ? Number(match[1]) : 24;
|
|
260
|
+
}
|
|
261
|
+
catch {
|
|
262
|
+
return 24;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
async function serviceCheck(serviceUrl) {
|
|
266
|
+
try {
|
|
267
|
+
const auth = await fetch(`${serviceUrl}/v1/auth/google`, { headers: { accept: 'application/json' } });
|
|
268
|
+
if (auth.ok)
|
|
269
|
+
return { level: 'PASS', name: 'Service', message: serviceUrl };
|
|
270
|
+
}
|
|
271
|
+
catch { }
|
|
272
|
+
try {
|
|
273
|
+
const ready = await fetch(`${serviceUrl}/readyz`, { headers: { accept: 'application/json' } });
|
|
274
|
+
if (ready.ok)
|
|
275
|
+
return { level: 'PASS', name: 'Service', message: serviceUrl };
|
|
276
|
+
return serviceFailure(serviceUrl, `ready check returned HTTP ${ready.status}`);
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
return serviceFailure(serviceUrl, error instanceof Error ? error.message : String(error));
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
function serviceFailure(serviceUrl, cause) {
|
|
283
|
+
return {
|
|
284
|
+
level: 'FAIL',
|
|
285
|
+
name: 'Service',
|
|
286
|
+
message: serviceUrl,
|
|
287
|
+
cause: `Could not reach ${serviceUrl}: ${cause}`,
|
|
288
|
+
fix: 'Check the service URL and network connection.',
|
|
289
|
+
next: `noodle login --service ${serviceUrl}`,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
async function secretsCheck(input) {
|
|
293
|
+
const refs = await requiredSecretRefs(input.entrypoint, input.connectorsPath);
|
|
294
|
+
if (!refs.ok) {
|
|
295
|
+
return {
|
|
296
|
+
level: 'FAIL',
|
|
297
|
+
name: 'Secrets',
|
|
298
|
+
message: 'could not inspect connector secrets',
|
|
299
|
+
cause: refs.message,
|
|
300
|
+
fix: 'Fix connector definitions before deploying.',
|
|
301
|
+
next: 'noodle validate',
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
if (refs.names.length === 0) {
|
|
305
|
+
return { level: 'PASS', name: 'Secrets', message: 'no required connector secrets' };
|
|
306
|
+
}
|
|
307
|
+
const available = await availableManagedSecretNames(input.serviceUrl, input.token, input.target);
|
|
308
|
+
if (!available.ok) {
|
|
309
|
+
return {
|
|
310
|
+
level: 'FAIL',
|
|
311
|
+
name: 'Secrets',
|
|
312
|
+
message: 'could not inspect managed secrets',
|
|
313
|
+
cause: available.message,
|
|
314
|
+
fix: 'Confirm your login and service target before deploy.',
|
|
315
|
+
next: 'noodle login',
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
const missing = refs.names.filter((name) => !available.names.has(name));
|
|
319
|
+
if (missing.length === 0) {
|
|
320
|
+
return { level: 'PASS', name: 'Secrets', message: `${refs.names.length} required secret(s) configured` };
|
|
321
|
+
}
|
|
322
|
+
return {
|
|
323
|
+
level: 'FAIL',
|
|
324
|
+
name: 'Secrets',
|
|
325
|
+
message: `missing ${missing.join(', ')}`,
|
|
326
|
+
cause: `Missing required managed secret(s): ${missing.join(', ')}`,
|
|
327
|
+
fix: 'Set the missing secret(s) at the environment scope.',
|
|
328
|
+
next: secretSetCommand(missing[0], input.target),
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
async function requiredSecretRefs(entrypoint, connectorsPath) {
|
|
332
|
+
try {
|
|
333
|
+
const input = await readDeployInput(entrypoint);
|
|
334
|
+
const connectors = connectorsPath !== undefined
|
|
335
|
+
? readFileSync(connectorsPath, 'utf8')
|
|
336
|
+
: input.connectors;
|
|
337
|
+
if (connectors === undefined || connectors.trim() === '')
|
|
338
|
+
return { ok: true, names: [] };
|
|
339
|
+
const compiled = compileConnectors(connectors);
|
|
340
|
+
if (!compiled.ok) {
|
|
341
|
+
return {
|
|
342
|
+
ok: false,
|
|
343
|
+
message: compiled.errors.map((error) => `${error.code}: ${error.message}`).join('; '),
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
return {
|
|
347
|
+
ok: true,
|
|
348
|
+
names: [...new Set(compiled.secretBindings.map((binding) => binding.secretRef))].sort(),
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
catch (error) {
|
|
352
|
+
return { ok: false, message: error instanceof Error ? error.message : String(error) };
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
async function availableManagedSecretNames(serviceUrl, token, target) {
|
|
356
|
+
const paths = [
|
|
357
|
+
`/v1/orgs/${encodeURIComponent(target.org)}/secrets`,
|
|
358
|
+
`/v1/orgs/${encodeURIComponent(target.org)}/apps/${encodeURIComponent(target.app)}/secrets`,
|
|
359
|
+
`/v1/orgs/${encodeURIComponent(target.org)}/apps/${encodeURIComponent(target.app)}/envs/${encodeURIComponent(target.env)}/secrets`,
|
|
360
|
+
];
|
|
361
|
+
const names = new Set();
|
|
362
|
+
try {
|
|
363
|
+
for (const path of paths) {
|
|
364
|
+
const body = await serviceJson(`${serviceUrl}${path}`, token);
|
|
365
|
+
for (const value of body.values)
|
|
366
|
+
names.add(value.name);
|
|
367
|
+
}
|
|
368
|
+
return { ok: true, names };
|
|
369
|
+
}
|
|
370
|
+
catch (error) {
|
|
371
|
+
return { ok: false, message: error instanceof Error ? error.message : String(error) };
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
function printCheck(check) {
|
|
375
|
+
console.log(`${check.level} ${check.name}: ${check.message}`);
|
|
376
|
+
if (check.cause !== undefined)
|
|
377
|
+
console.log(` Cause: ${check.cause}`);
|
|
378
|
+
if (check.fix !== undefined)
|
|
379
|
+
console.log(` Fix: ${check.fix}`);
|
|
380
|
+
if (check.next !== undefined)
|
|
381
|
+
console.log(` Next: ${check.next}`);
|
|
382
|
+
}
|
|
383
|
+
function secretSetCommand(name, target) {
|
|
384
|
+
return (`noodle secrets set ${name} --scope env --org ${target.org}` +
|
|
385
|
+
` --app ${target.app} --env ${target.env} --value <value>`);
|
|
386
|
+
}
|
|
387
|
+
function appFromEntrypoint(entrypoint) {
|
|
388
|
+
return entrypoint
|
|
389
|
+
.split(/[\\/]/)
|
|
390
|
+
.pop()
|
|
391
|
+
?.replace(/\.[^.]+$/, '') ?? 'app';
|
|
392
|
+
}
|
|
393
|
+
function packageRoot() {
|
|
394
|
+
return resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
395
|
+
}
|
|
396
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA8BzC,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAsB;IACpD,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,MAAM,GAAkB,EAAE,CAAC;IAEjC,MAAM,IAAI,GAAG,SAAS,EAAE,CAAC;IACzB,MAAM,CAAC,IAAI,CAAC,IAAI,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AC;IAC9D,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS;QAAE,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IACtE,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS;QAAE,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;IAChE,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,gBAAgB,CACvB,IAAY,EACZ,MAA4E;IAE5E,OAAO,CACL,sBAAsB,IAAI,sBAAsB,MAAM,CAAC,GAAG,EAAE;QAC5D,UAAU,MAAM,CAAC,GAAG,UAAU,MAAM,CAAC,GAAG,kBAAkB,CAC3D,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,UAAkB;IAC3C,OAAO,UAAU;SACd,KAAK,CAAC,OAAO,CAAC;SACd,GAAG,EAAE;QACN,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC;AACvC,CAAC;AAED,SAAS,WAAW;IAClB,OAAO,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AAChE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ export { run } from './cli.js';
|
|
|
2
2
|
export { appendServer, clearConfig, configPath, type NoodleConfig, maskToken, readConfig, readServers, resolveAuthToken, resolveServiceUrl, type SavedServer, serversPath, writeConfig, } from './config.js';
|
|
3
3
|
export { DEFAULT_SERVICE_URL, type DeployOptions, type DeployOutcome, deploy } from './deploy.js';
|
|
4
4
|
export { type DevHandle, type DevOptions, type DevReloadResult, dev } from './dev.js';
|
|
5
|
+
export { connector, server, when, z } from '@noodle-borg/authoring';
|
|
5
6
|
export { deleteLocalConfigValue, type LocalConfigKind, type LocalConfigRecord, localConfigPath, type LocalConfigScope, readLocalConfigValues, resolveLocalConfigValues, setLocalConfigValue, } from './local-config.js';
|
|
6
7
|
export { type ValidateOptions, type ValidateOutcome, type ValidationIssue, validate, } from './validate.js';
|
|
8
|
+
export { initProject, type InitProjectOptions, type InitTemplate, type LinkProjectOptions, type ProjectLink, type ProjectDeployment, projectConfigPath, projectDeploymentPath, readProjectDeployment, readProjectLink, relativeEntrypoint, resolveLinkedEntrypoint, writeProjectDeployment, writeProjectLink, } from './project.js';
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,UAAU,EACV,KAAK,YAAY,EACjB,SAAS,EACT,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,WAAW,EAChB,WAAW,EACX,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAClG,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACtF,OAAO,EACL,sBAAsB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,eAAe,EACf,KAAK,gBAAgB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,QAAQ,GACT,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,UAAU,EACV,KAAK,YAAY,EACjB,SAAS,EACT,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,WAAW,EAChB,WAAW,EACX,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAClG,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EACL,sBAAsB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,eAAe,EACf,KAAK,gBAAgB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,WAAW,EACX,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,8 @@ export { run } from './cli.js';
|
|
|
2
2
|
export { appendServer, clearConfig, configPath, maskToken, readConfig, readServers, resolveAuthToken, resolveServiceUrl, serversPath, writeConfig, } from './config.js';
|
|
3
3
|
export { DEFAULT_SERVICE_URL, deploy } from './deploy.js';
|
|
4
4
|
export { dev } from './dev.js';
|
|
5
|
+
export { connector, server, when, z } from '@noodle-borg/authoring';
|
|
5
6
|
export { deleteLocalConfigValue, localConfigPath, readLocalConfigValues, resolveLocalConfigValues, setLocalConfigValue, } from './local-config.js';
|
|
6
7
|
export { validate, } from './validate.js';
|
|
8
|
+
export { initProject, projectConfigPath, projectDeploymentPath, readProjectDeployment, readProjectLink, relativeEntrypoint, resolveLinkedEntrypoint, writeProjectDeployment, writeProjectLink, } from './project.js';
|
|
7
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,UAAU,EAEV,SAAS,EACT,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EAEjB,WAAW,EACX,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAA0C,MAAM,EAAE,MAAM,aAAa,CAAC;AAClG,OAAO,EAAyD,GAAG,EAAE,MAAM,UAAU,CAAC;AACtF,OAAO,EACL,sBAAsB,EAGtB,eAAe,EAEf,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAIL,QAAQ,GACT,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,UAAU,EAEV,SAAS,EACT,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EAEjB,WAAW,EACX,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAA0C,MAAM,EAAE,MAAM,aAAa,CAAC;AAClG,OAAO,EAAyD,GAAG,EAAE,MAAM,UAAU,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EACL,sBAAsB,EAGtB,eAAe,EAEf,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAIL,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,WAAW,EAMX,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const MINIMUM_NODE_MAJOR = 24;
|
|
2
|
+
export declare function nodeMajor(version: string): number | null;
|
|
3
|
+
export declare function isSupportedNodeVersion(version?: string): boolean;
|
|
4
|
+
export declare function unsupportedNodeMessage(version?: string): string;
|
|
5
|
+
//# sourceMappingURL=node-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-version.d.ts","sourceRoot":"","sources":["../src/node-version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGxD;AAED,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,MAA8B,GAAG,OAAO,CAGvF;AAED,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,MAA8B,GAAG,MAAM,CAMtF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const MINIMUM_NODE_MAJOR = 24;
|
|
2
|
+
export function nodeMajor(version) {
|
|
3
|
+
const match = /^v?(\d+)(?:\.|$)/.exec(version.trim());
|
|
4
|
+
return match ? Number(match[1]) : null;
|
|
5
|
+
}
|
|
6
|
+
export function isSupportedNodeVersion(version = process.versions.node) {
|
|
7
|
+
const major = nodeMajor(version);
|
|
8
|
+
return major !== null && major >= MINIMUM_NODE_MAJOR;
|
|
9
|
+
}
|
|
10
|
+
export function unsupportedNodeMessage(version = process.versions.node) {
|
|
11
|
+
return [
|
|
12
|
+
`noodle requires Node.js ${MINIMUM_NODE_MAJOR} or newer; current runtime is Node.js ${version}.`,
|
|
13
|
+
'Fix: switch to Node 24 LTS, then reinstall the global CLI so the noodle bin uses that runtime.',
|
|
14
|
+
'Next: nvm install 24 && nvm use 24 && hash -r && npm install -g noodleseed-cli@latest',
|
|
15
|
+
].join('\n');
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=node-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-version.js","sourceRoot":"","sources":["../src/node-version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,MAAM,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACtD,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,UAAkB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAC5E,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IACjC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,IAAI,kBAAkB,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,UAAkB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAC5E,OAAO;QACL,2BAA2B,kBAAkB,yCAAyC,OAAO,GAAG;QAChG,gGAAgG;QAChG,uFAAuF;KACxF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ImportOpenApiOptions {
|
|
2
|
+
readonly specPath: string;
|
|
3
|
+
readonly output: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly baseUrl?: string;
|
|
6
|
+
readonly force?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function importOpenApiProject(options: ImportOpenApiOptions): {
|
|
9
|
+
readonly output: string;
|
|
10
|
+
readonly warnings: readonly string[];
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=openapi-import.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi-import.d.ts","sourceRoot":"","sources":["../src/openapi-import.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAID,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,oBAAoB,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAwFrI"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import YAML from 'yaml';
|
|
4
|
+
import { initProject } from './project.js';
|
|
5
|
+
const METHODS = new Set(['get', 'post', 'put', 'patch', 'delete']);
|
|
6
|
+
export function importOpenApiProject(options) {
|
|
7
|
+
const doc = YAML.parse(readFileSync(options.specPath, 'utf8'));
|
|
8
|
+
if (typeof doc.openapi !== 'string' || !/^3\.[01]\./.test(doc.openapi)) {
|
|
9
|
+
throw new Error('import openapi: only OpenAPI 3.0 and 3.1 documents are supported');
|
|
10
|
+
}
|
|
11
|
+
const baseUrl = options.baseUrl ?? doc.servers?.find((server) => typeof server.url === 'string')?.url;
|
|
12
|
+
if (baseUrl === undefined)
|
|
13
|
+
throw new Error('import openapi: missing base URL; pass --base-url');
|
|
14
|
+
initProject({ dir: options.output, name: options.name, force: options.force ?? true });
|
|
15
|
+
const operations = [];
|
|
16
|
+
const tools = [];
|
|
17
|
+
const warnings = [];
|
|
18
|
+
for (const [path, item] of Object.entries(doc.paths ?? {})) {
|
|
19
|
+
for (const [method, rawOperation] of Object.entries(item)) {
|
|
20
|
+
if (!METHODS.has(method))
|
|
21
|
+
continue;
|
|
22
|
+
const operation = rawOperation;
|
|
23
|
+
const opName = identifier(typeof operation.operationId === 'string' ? operation.operationId : `${method}_${path}`);
|
|
24
|
+
const params = operation.parameters ?? [];
|
|
25
|
+
const inputEntries = params
|
|
26
|
+
.filter((param) => param.in === 'path' || param.in === 'query')
|
|
27
|
+
.map((param) => {
|
|
28
|
+
const name = identifier(String(param.name ?? 'param'));
|
|
29
|
+
return `${name}: { type: 'string'${param.required ? ', required: true' : ''} }`;
|
|
30
|
+
});
|
|
31
|
+
if (operation.requestBody !== undefined)
|
|
32
|
+
warnings.push(`${opName}: requestBody imported as opaque JSON string placeholder`);
|
|
33
|
+
operations.push(`${opName}: {
|
|
34
|
+
type: '${method === 'get' ? 'read' : 'action'}',
|
|
35
|
+
method: '${method.toUpperCase()}',
|
|
36
|
+
path: '${path.replace(/\{([^}]+)\}/g, '${args.$1}')}',
|
|
37
|
+
input: { ${inputEntries.join(', ')} },
|
|
38
|
+
${params.some((param) => param.in === 'query') ? `query: [${params.filter((param) => param.in === 'query').map((param) => `'${identifier(String(param.name ?? 'param'))}'`).join(', ')}],` : ''}
|
|
39
|
+
output: { value: { type: 'object' } },
|
|
40
|
+
response: { value: '\${response.json}' },
|
|
41
|
+
}`);
|
|
42
|
+
const zodShape = params
|
|
43
|
+
.filter((param) => param.in === 'path' || param.in === 'query')
|
|
44
|
+
.map((param) => `${identifier(String(param.name ?? 'param'))}: z.string()`)
|
|
45
|
+
.join(', ');
|
|
46
|
+
tools.push(`.tool('${opName}', {
|
|
47
|
+
description: 'Call ${method.toUpperCase()} ${path}.',
|
|
48
|
+
input: z.object({ ${zodShape} }),
|
|
49
|
+
fulfil({ input, connectors }) {
|
|
50
|
+
return connectors.api.${opName}(input);
|
|
51
|
+
},
|
|
52
|
+
})`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (operations.length === 0)
|
|
56
|
+
throw new Error('import openapi: no supported operations found');
|
|
57
|
+
const connectorName = identifier(options.name);
|
|
58
|
+
const server = `import { connector, server, z } from 'noodleseed-cli';
|
|
59
|
+
|
|
60
|
+
const api = connector('${connectorName}')
|
|
61
|
+
.version('1.0.0')
|
|
62
|
+
.http({
|
|
63
|
+
baseUrl: '${baseUrl}',
|
|
64
|
+
allowedOrigins: ['${baseUrl}'],
|
|
65
|
+
operations: {
|
|
66
|
+
${operations.join(',\n ')}
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export default server('${connectorName}', { title: '${title(options.name)}', version: '1.0.0' })
|
|
71
|
+
.use({ api })
|
|
72
|
+
${tools.join('\n ')};
|
|
73
|
+
`;
|
|
74
|
+
writeFileSync(join(options.output, 'server.ts'), server);
|
|
75
|
+
mkdirSync(dirname(join(options.output, 'README.md')), { recursive: true });
|
|
76
|
+
writeFileSync(join(options.output, 'README.md'), `# ${title(options.name)}
|
|
77
|
+
|
|
78
|
+
Generated from OpenAPI.
|
|
79
|
+
|
|
80
|
+
\`\`\`sh
|
|
81
|
+
noodle validate
|
|
82
|
+
noodle dev
|
|
83
|
+
noodle deploy
|
|
84
|
+
\`\`\`
|
|
85
|
+
`);
|
|
86
|
+
return { output: options.output, warnings };
|
|
87
|
+
}
|
|
88
|
+
function identifier(value) {
|
|
89
|
+
const out = value.replace(/[^A-Za-z0-9_]+/g, '_').replace(/^_+|_+$/g, '');
|
|
90
|
+
return /^[A-Za-z_]/.test(out) ? out : `op_${out || 'operation'}`;
|
|
91
|
+
}
|
|
92
|
+
function title(value) {
|
|
93
|
+
return value.replace(/[-_]+/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=openapi-import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi-import.js","sourceRoot":"","sources":["../src/openapi-import.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAU3C,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEnE,MAAM,UAAU,oBAAoB,CAAC,OAA6B;IAChE,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAI5D,CAAC;IACF,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QACvE,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;IACtF,CAAC;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,EA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