@sdk-it/cli 0.20.0 → 0.22.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/index.js +93 -549
- package/dist/index.js.map +4 -4
- package/dist/lib/langs/typescript.d.ts +2 -2
- package/dist/lib/langs/typescript.d.ts.map +1 -1
- package/package.json +9 -5
package/dist/index.js
CHANGED
|
@@ -7,544 +7,7 @@ import { Command as Command3, program } from "commander";
|
|
|
7
7
|
import { Command } from "commander";
|
|
8
8
|
import { execFile, execSync } from "node:child_process";
|
|
9
9
|
import { generate } from "@sdk-it/dart";
|
|
10
|
-
|
|
11
|
-
// packages/spec/dist/lib/loaders/local-loader.js
|
|
12
|
-
import { readFile } from "node:fs/promises";
|
|
13
|
-
import { extname } from "node:path";
|
|
14
|
-
import { parse } from "yaml";
|
|
15
|
-
async function loadLocal(location) {
|
|
16
|
-
const extName = extname(location);
|
|
17
|
-
const text = await readFile(location, "utf-8");
|
|
18
|
-
switch (extName) {
|
|
19
|
-
case ".json":
|
|
20
|
-
return JSON.parse(text);
|
|
21
|
-
case ".yaml":
|
|
22
|
-
case ".yml":
|
|
23
|
-
return parse(text);
|
|
24
|
-
default:
|
|
25
|
-
throw new Error(`Unsupported file extension: ${extName}`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// packages/spec/dist/lib/loaders/postman/postman-converter.js
|
|
30
|
-
function descriptionToText(description) {
|
|
31
|
-
if (!description) {
|
|
32
|
-
return void 0;
|
|
33
|
-
}
|
|
34
|
-
if (typeof description === "string") {
|
|
35
|
-
return description;
|
|
36
|
-
}
|
|
37
|
-
if (description.content) {
|
|
38
|
-
return description.content;
|
|
39
|
-
}
|
|
40
|
-
return void 0;
|
|
41
|
-
}
|
|
42
|
-
function isFolder(item) {
|
|
43
|
-
return "item" in item;
|
|
44
|
-
}
|
|
45
|
-
function isRequest(item) {
|
|
46
|
-
return !!item.request;
|
|
47
|
-
}
|
|
48
|
-
function processItems(items, parentTags, globalTags, paths, securitySchemes) {
|
|
49
|
-
for (const item of items) {
|
|
50
|
-
if (!isFolder(item) && !isRequest(item)) {
|
|
51
|
-
console.warn(
|
|
52
|
-
`Skipping item ${item.name} because it is not a folder or request`
|
|
53
|
-
);
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
if (isFolder(item)) {
|
|
57
|
-
if (item.auth) {
|
|
58
|
-
processAuthScheme(item.auth, securitySchemes);
|
|
59
|
-
}
|
|
60
|
-
if (!globalTags.some((tag) => tag.name === item.name)) {
|
|
61
|
-
globalTags.push({
|
|
62
|
-
name: item.name,
|
|
63
|
-
description: descriptionToText(item.description)
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
const currentTags = [...parentTags, item.name];
|
|
67
|
-
processItems(item.item, currentTags, globalTags, paths, securitySchemes);
|
|
68
|
-
} else if (isRequest(item)) {
|
|
69
|
-
let operation;
|
|
70
|
-
if (typeof item.request === "string") {
|
|
71
|
-
const url = new URL(item.request);
|
|
72
|
-
operation = requestToOperation(
|
|
73
|
-
{
|
|
74
|
-
name: url.pathname,
|
|
75
|
-
response: [{ code: 200 }],
|
|
76
|
-
request: {
|
|
77
|
-
method: "get",
|
|
78
|
-
url: {
|
|
79
|
-
path: url.pathname.split("/").slice(1)
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
securitySchemes
|
|
84
|
-
);
|
|
85
|
-
} else {
|
|
86
|
-
const auth = item.request.auth;
|
|
87
|
-
operation = requestToOperation(
|
|
88
|
-
{
|
|
89
|
-
name: item.name,
|
|
90
|
-
request: { ...item.request, auth },
|
|
91
|
-
response: item.response
|
|
92
|
-
},
|
|
93
|
-
securitySchemes
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
paths[operation.path] ??= {};
|
|
97
|
-
Object.assign(paths[operation.path], {
|
|
98
|
-
[operation.method]: {
|
|
99
|
-
tags: parentTags.length ? parentTags : void 0,
|
|
100
|
-
...operation.operation
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
function coerceVariable(query) {
|
|
107
|
-
if (!query.key) {
|
|
108
|
-
throw new Error("Invalid query parameter format");
|
|
109
|
-
}
|
|
110
|
-
return {
|
|
111
|
-
key: query.key,
|
|
112
|
-
description: descriptionToText(query.description)
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
function coerceQuery(query) {
|
|
116
|
-
if (!query.key) {
|
|
117
|
-
throw new Error("Invalid query parameter format");
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
key: query.key,
|
|
121
|
-
description: descriptionToText(query.description)
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
function coerceUrl(url) {
|
|
125
|
-
if (!url) {
|
|
126
|
-
throw new Error("Invalid URL format");
|
|
127
|
-
}
|
|
128
|
-
if (typeof url === "string") {
|
|
129
|
-
return {
|
|
130
|
-
path: url.split("/").slice(1),
|
|
131
|
-
query: [],
|
|
132
|
-
variable: []
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
if (typeof url.path === "string") {
|
|
136
|
-
return {
|
|
137
|
-
path: url.path.split("/").slice(1),
|
|
138
|
-
query: (url.query ?? []).map(coerceQuery),
|
|
139
|
-
variable: (url.variable ?? []).map(coerceVariable)
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
return {
|
|
143
|
-
path: (url.path ?? []).map((p) => {
|
|
144
|
-
if (typeof p === "string") {
|
|
145
|
-
return p;
|
|
146
|
-
}
|
|
147
|
-
throw new Error("Invalid URL path format");
|
|
148
|
-
}),
|
|
149
|
-
query: (url.query ?? []).map(coerceQuery),
|
|
150
|
-
variable: (url.variable ?? []).map(coerceVariable)
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
function coerceResponseHeader(header) {
|
|
154
|
-
if (!header) {
|
|
155
|
-
return [];
|
|
156
|
-
}
|
|
157
|
-
if (typeof header === "string") {
|
|
158
|
-
throw new Error(`Invalid header format: ${header}`);
|
|
159
|
-
}
|
|
160
|
-
return header.map((h) => {
|
|
161
|
-
if (typeof h === "string") {
|
|
162
|
-
return {
|
|
163
|
-
key: h,
|
|
164
|
-
value: null
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
return h;
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
function processAuthScheme(auth, securitySchemes) {
|
|
171
|
-
if (!auth || auth.type === "noauth")
|
|
172
|
-
return null;
|
|
173
|
-
const getAuthAttr = (key) => {
|
|
174
|
-
if (!auth || auth.type === "noauth")
|
|
175
|
-
return void 0;
|
|
176
|
-
const authType = auth[auth.type];
|
|
177
|
-
if (!authType)
|
|
178
|
-
return void 0;
|
|
179
|
-
const attr = authType.find((a) => a.key === key);
|
|
180
|
-
return attr ? String(attr.value) : void 0;
|
|
181
|
-
};
|
|
182
|
-
const schemeId = `${auth.type}Auth`;
|
|
183
|
-
switch (auth.type) {
|
|
184
|
-
case "apikey": {
|
|
185
|
-
const key = getAuthAttr("key") || "api_key";
|
|
186
|
-
const in_ = getAuthAttr("in") || "header";
|
|
187
|
-
securitySchemes[schemeId] = {
|
|
188
|
-
type: "apiKey",
|
|
189
|
-
name: key,
|
|
190
|
-
in: in_,
|
|
191
|
-
description: "API key authentication"
|
|
192
|
-
};
|
|
193
|
-
break;
|
|
194
|
-
}
|
|
195
|
-
case "basic":
|
|
196
|
-
securitySchemes[schemeId] = {
|
|
197
|
-
type: "http",
|
|
198
|
-
scheme: "basic",
|
|
199
|
-
description: "Basic HTTP authentication"
|
|
200
|
-
};
|
|
201
|
-
break;
|
|
202
|
-
case "bearer": {
|
|
203
|
-
const token = getAuthAttr("token");
|
|
204
|
-
securitySchemes[schemeId] = {
|
|
205
|
-
type: "http",
|
|
206
|
-
scheme: "bearer",
|
|
207
|
-
description: "Bearer token authentication",
|
|
208
|
-
...token ? { bearerFormat: "JWT" } : {}
|
|
209
|
-
};
|
|
210
|
-
break;
|
|
211
|
-
}
|
|
212
|
-
case "oauth2": {
|
|
213
|
-
const flowType = getAuthAttr("grant_type") || "implicit";
|
|
214
|
-
securitySchemes[schemeId] = {
|
|
215
|
-
type: "oauth2",
|
|
216
|
-
description: "OAuth 2.0 authentication",
|
|
217
|
-
flows: {
|
|
218
|
-
[flowType === "authorization_code" ? "authorizationCode" : flowType]: {
|
|
219
|
-
authorizationUrl: getAuthAttr("authUrl") || "https://example.com/oauth/authorize",
|
|
220
|
-
tokenUrl: getAuthAttr("tokenUrl") || "https://example.com/oauth/token",
|
|
221
|
-
scopes: {}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
case "digest":
|
|
228
|
-
securitySchemes[schemeId] = {
|
|
229
|
-
type: "http",
|
|
230
|
-
scheme: "digest",
|
|
231
|
-
description: "Digest authentication"
|
|
232
|
-
};
|
|
233
|
-
break;
|
|
234
|
-
case "awsv4":
|
|
235
|
-
securitySchemes[schemeId] = {
|
|
236
|
-
type: "apiKey",
|
|
237
|
-
name: "Authorization",
|
|
238
|
-
in: "header",
|
|
239
|
-
description: "AWS Signature v4 authentication"
|
|
240
|
-
};
|
|
241
|
-
break;
|
|
242
|
-
default:
|
|
243
|
-
securitySchemes[schemeId] = {
|
|
244
|
-
type: "apiKey",
|
|
245
|
-
name: "Authorization",
|
|
246
|
-
in: "header",
|
|
247
|
-
description: `${auth.type} authentication`
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
return schemeId;
|
|
251
|
-
}
|
|
252
|
-
function generateSecurityRequirement(auth, securitySchemes) {
|
|
253
|
-
if (!auth || auth.type === "noauth")
|
|
254
|
-
return [];
|
|
255
|
-
const schemeId = `${auth.type}Auth`;
|
|
256
|
-
if (securitySchemes[schemeId]) {
|
|
257
|
-
return [{ [schemeId]: [] }];
|
|
258
|
-
}
|
|
259
|
-
return [];
|
|
260
|
-
}
|
|
261
|
-
function requestToOperation(item, securitySchemes) {
|
|
262
|
-
const url = coerceUrl(item.request.url);
|
|
263
|
-
const headers = Array.isArray(item.request.header) ? item.request.header : [];
|
|
264
|
-
const parameters = [
|
|
265
|
-
...url.query.filter((param) => !param.disabled).map((param) => {
|
|
266
|
-
return {
|
|
267
|
-
in: "query",
|
|
268
|
-
name: param.key,
|
|
269
|
-
required: false,
|
|
270
|
-
description: param.description,
|
|
271
|
-
schema: {
|
|
272
|
-
...param.value && !isNaN(Number(param.value)) ? { type: "number" } : param.value === "true" || param.value === "false" ? { type: "boolean" } : { type: "string" }
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
}),
|
|
276
|
-
...url.variable.map((param) => {
|
|
277
|
-
return {
|
|
278
|
-
in: "path",
|
|
279
|
-
name: param.key,
|
|
280
|
-
required: true,
|
|
281
|
-
description: param.description,
|
|
282
|
-
schema: {
|
|
283
|
-
...param.value && !isNaN(Number(param.value)) ? { type: "number" } : param.value === "true" || param.value === "false" ? { type: "boolean" } : { type: "string" }
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
}),
|
|
287
|
-
...headers.filter(
|
|
288
|
-
(h) => !h.disabled && h.key.toLowerCase() !== "accept" && h.key.toLowerCase() !== "content-type"
|
|
289
|
-
).map((header) => {
|
|
290
|
-
return {
|
|
291
|
-
in: "header",
|
|
292
|
-
name: header.key,
|
|
293
|
-
required: false,
|
|
294
|
-
description: descriptionToText(header.description),
|
|
295
|
-
schema: {
|
|
296
|
-
type: "string"
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
})
|
|
300
|
-
];
|
|
301
|
-
const acceptHeaderIdx = headers.findIndex(
|
|
302
|
-
(h) => h.key.toLowerCase() === "accept"
|
|
303
|
-
);
|
|
304
|
-
const contentTypeIdx = headers.findIndex(
|
|
305
|
-
(h) => h.key.toLowerCase() === "content-type"
|
|
306
|
-
);
|
|
307
|
-
const [acceptHeaderValue] = acceptHeaderIdx !== -1 ? headers.splice(acceptHeaderIdx, 1).map((h) => h.value) : [];
|
|
308
|
-
const [contentTypeValue] = contentTypeIdx !== -1 ? headers.splice(contentTypeIdx, 1).map((h) => h.value) : [];
|
|
309
|
-
let security;
|
|
310
|
-
if (item.request.auth) {
|
|
311
|
-
const schemeId = processAuthScheme(item.request.auth, securitySchemes);
|
|
312
|
-
if (schemeId) {
|
|
313
|
-
security = [{ [schemeId]: [] }];
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
return {
|
|
317
|
-
path: `/${url.path.join("/")}`.replace(/:([^/]+)/g, "{$1}"),
|
|
318
|
-
method: (item.request.method ?? "get").toLowerCase(),
|
|
319
|
-
operation: {
|
|
320
|
-
summary: item.name,
|
|
321
|
-
description: descriptionToText(item.request.description),
|
|
322
|
-
parameters,
|
|
323
|
-
security,
|
|
324
|
-
responses: !item.response || item.response.length === 0 ? {
|
|
325
|
-
200: {
|
|
326
|
-
description: "Successful response"
|
|
327
|
-
}
|
|
328
|
-
} : item.response.reduce((acc, response) => {
|
|
329
|
-
const headers2 = coerceResponseHeader(response.header);
|
|
330
|
-
const contentTypeIdx2 = headers2.findIndex(
|
|
331
|
-
(h) => h.key.toLowerCase() === "content-type"
|
|
332
|
-
);
|
|
333
|
-
const [contentTypeValue2] = contentTypeIdx2 !== -1 ? headers2.splice(contentTypeIdx2).map((h) => h.value) : [];
|
|
334
|
-
const contentType = response.body ? contentTypeValue2 || "application/json" : "application/octet-stream";
|
|
335
|
-
return {
|
|
336
|
-
...acc,
|
|
337
|
-
[response.code ?? 200]: {
|
|
338
|
-
description: response.name ? response.name : `Response for ${response.code}`,
|
|
339
|
-
content: {
|
|
340
|
-
[contentType]: {
|
|
341
|
-
schema: bodyToSchema(response.body)
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
}, {}),
|
|
347
|
-
requestBody: item.request.body ? requestBodyToOperationBody(
|
|
348
|
-
contentTypeValue || "application/json",
|
|
349
|
-
item.request.body
|
|
350
|
-
) : void 0
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
function requestBodyToOperationBody(contentType, body) {
|
|
355
|
-
if (body.mode === "raw") {
|
|
356
|
-
return {
|
|
357
|
-
content: {
|
|
358
|
-
[contentType]: {
|
|
359
|
-
schema: bodyToSchema(body.raw)
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
} else if (body.mode === "urlencoded") {
|
|
364
|
-
const properties = {};
|
|
365
|
-
(body.urlencoded || []).filter((param) => !param.disabled).forEach((param) => {
|
|
366
|
-
properties[param.key] = {
|
|
367
|
-
type: "string",
|
|
368
|
-
description: descriptionToText(param.description)
|
|
369
|
-
};
|
|
370
|
-
});
|
|
371
|
-
return {
|
|
372
|
-
content: {
|
|
373
|
-
"application/x-www-form-urlencoded": {
|
|
374
|
-
schema: {
|
|
375
|
-
type: "object",
|
|
376
|
-
properties
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
} else if (body.mode === "formdata") {
|
|
382
|
-
const properties = {};
|
|
383
|
-
(body.formdata || []).filter((param) => !param.disabled).forEach((param) => {
|
|
384
|
-
if (param.type === "text") {
|
|
385
|
-
properties[param.key] = {
|
|
386
|
-
type: "string",
|
|
387
|
-
description: descriptionToText(param.description)
|
|
388
|
-
};
|
|
389
|
-
} else if (param.type === "file") {
|
|
390
|
-
properties[param.key] = {
|
|
391
|
-
type: "string",
|
|
392
|
-
format: "binary",
|
|
393
|
-
description: descriptionToText(param.description)
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
});
|
|
397
|
-
return {
|
|
398
|
-
content: {
|
|
399
|
-
"multipart/form-data": {
|
|
400
|
-
schema: {
|
|
401
|
-
type: "object",
|
|
402
|
-
properties
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
throw new Error(
|
|
409
|
-
`Unsupported request body mode: ${body.mode}. Supported modes are: raw, urlencoded, formdata`
|
|
410
|
-
);
|
|
411
|
-
}
|
|
412
|
-
function bodyToSchema(bodyString) {
|
|
413
|
-
if (!bodyString) {
|
|
414
|
-
return void 0;
|
|
415
|
-
}
|
|
416
|
-
let body;
|
|
417
|
-
try {
|
|
418
|
-
body = JSON.parse(bodyString);
|
|
419
|
-
} catch (error) {
|
|
420
|
-
console.warn(
|
|
421
|
-
`Failed to parse JSON body: ${bodyString}. Treating as plain string.`,
|
|
422
|
-
error
|
|
423
|
-
);
|
|
424
|
-
return { type: "string", example: bodyString };
|
|
425
|
-
}
|
|
426
|
-
return toSchema(body);
|
|
427
|
-
}
|
|
428
|
-
function toSchema(body) {
|
|
429
|
-
const typeMap = {
|
|
430
|
-
"<number>": "number",
|
|
431
|
-
"<string>": "string",
|
|
432
|
-
"<boolean>": "boolean",
|
|
433
|
-
false: "boolean",
|
|
434
|
-
true: "boolean"
|
|
435
|
-
};
|
|
436
|
-
if (Array.isArray(body)) {
|
|
437
|
-
return {
|
|
438
|
-
type: "array",
|
|
439
|
-
items: toSchema(body[0])
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
if (typeof body === "object" && body !== null) {
|
|
443
|
-
const properties = {};
|
|
444
|
-
for (const [key, value] of Object.entries(body)) {
|
|
445
|
-
properties[key] = toSchema(value);
|
|
446
|
-
}
|
|
447
|
-
return {
|
|
448
|
-
type: "object",
|
|
449
|
-
properties
|
|
450
|
-
};
|
|
451
|
-
}
|
|
452
|
-
if (typeof body === "string") {
|
|
453
|
-
return {
|
|
454
|
-
type: typeMap[body] ?? "string"
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
if (typeof body === "number") {
|
|
458
|
-
return {
|
|
459
|
-
type: "number"
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
if (typeof body === "boolean") {
|
|
463
|
-
return {
|
|
464
|
-
type: "boolean"
|
|
465
|
-
};
|
|
466
|
-
}
|
|
467
|
-
if (body === null) {
|
|
468
|
-
return {
|
|
469
|
-
type: "null"
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
console.warn(`Unknown type for body: ${body}. Defaulting to string.`, body);
|
|
473
|
-
return {
|
|
474
|
-
type: "string"
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
function convertPostmanToOpenAPI(collection) {
|
|
478
|
-
const tags = [];
|
|
479
|
-
const paths = {};
|
|
480
|
-
const securitySchemes = {};
|
|
481
|
-
if (collection.auth) {
|
|
482
|
-
processAuthScheme(collection.auth, securitySchemes);
|
|
483
|
-
}
|
|
484
|
-
processItems(collection.item, [], tags, paths, securitySchemes);
|
|
485
|
-
return {
|
|
486
|
-
openapi: "3.1.0",
|
|
487
|
-
info: {
|
|
488
|
-
title: collection.info.name,
|
|
489
|
-
version: "1.0.0",
|
|
490
|
-
description: descriptionToText(collection.info.description)
|
|
491
|
-
},
|
|
492
|
-
tags,
|
|
493
|
-
paths,
|
|
494
|
-
// Only add security at top level if there's collection auth
|
|
495
|
-
security: collection.auth ? generateSecurityRequirement(collection.auth, securitySchemes) : void 0,
|
|
496
|
-
components: Object.keys(securitySchemes).length > 0 ? {
|
|
497
|
-
securitySchemes
|
|
498
|
-
} : void 0
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
// packages/spec/dist/lib/loaders/remote-loader.js
|
|
503
|
-
import { extname as extname2 } from "node:path";
|
|
504
|
-
import { parse as parse2 } from "yaml";
|
|
505
|
-
async function loadRemote(location) {
|
|
506
|
-
const extName = extname2(location);
|
|
507
|
-
const response = await fetch(location);
|
|
508
|
-
switch (extName) {
|
|
509
|
-
case ".json":
|
|
510
|
-
return response.json();
|
|
511
|
-
case ".yaml":
|
|
512
|
-
case ".yml": {
|
|
513
|
-
const text = await response.text();
|
|
514
|
-
return parse2(text);
|
|
515
|
-
}
|
|
516
|
-
default:
|
|
517
|
-
try {
|
|
518
|
-
return response.json();
|
|
519
|
-
} catch {
|
|
520
|
-
const text = await response.text();
|
|
521
|
-
return parse2(text);
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
// packages/spec/dist/lib/loaders/load-spec.js
|
|
527
|
-
function isPostman(content) {
|
|
528
|
-
return typeof content === "object" && content !== null && "info" in content && typeof content.info === "object" && content.info !== null && "item" in content && Array.isArray(content.item) && "schema" in content.info && typeof content.info.schema === "string" && content.info.schema.includes("//schema.getpostman.com/");
|
|
529
|
-
}
|
|
530
|
-
async function loadSpec(location) {
|
|
531
|
-
const content = await loadFile(location);
|
|
532
|
-
if (isPostman(content)) {
|
|
533
|
-
return convertPostmanToOpenAPI(content);
|
|
534
|
-
}
|
|
535
|
-
return content;
|
|
536
|
-
}
|
|
537
|
-
function loadFile(location) {
|
|
538
|
-
const [protocol] = location.split(":");
|
|
539
|
-
if (protocol === "http" || protocol === "https") {
|
|
540
|
-
return loadRemote(location);
|
|
541
|
-
}
|
|
542
|
-
return loadLocal(location);
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
// packages/spec/dist/lib/operation.js
|
|
546
|
-
import { camelcase } from "stringcase";
|
|
547
|
-
import { followRef, isRef } from "@sdk-it/core";
|
|
10
|
+
import { augmentSpec, loadSpec } from "@sdk-it/spec";
|
|
548
11
|
|
|
549
12
|
// packages/cli/src/lib/options.ts
|
|
550
13
|
import { Option } from "commander";
|
|
@@ -562,15 +25,15 @@ function shellEnv(name) {
|
|
|
562
25
|
|
|
563
26
|
// packages/cli/src/lib/langs/dart.ts
|
|
564
27
|
var dart_default = new Command("dart").description("Generate Dart SDK").addOption(specOption.makeOptionMandatory(true)).addOption(outputOption.makeOptionMandatory(true)).option("-l, --language <language>", "Programming language for the SDK").option("-n, --name <name>", "Name of the generated client", "Client").option("-v, --verbose", "Verbose output", false).action(async (options) => {
|
|
565
|
-
const spec = await loadSpec(options.spec);
|
|
28
|
+
const spec = augmentSpec({ spec: await loadSpec(options.spec) }, true);
|
|
566
29
|
await generate(spec, {
|
|
567
30
|
output: options.output,
|
|
568
31
|
mode: options.mode || "full",
|
|
569
32
|
name: options.name,
|
|
570
33
|
formatCode: ({ output }) => {
|
|
571
34
|
if (options.formatter) {
|
|
572
|
-
const [
|
|
573
|
-
execFile(
|
|
35
|
+
const [command2, ...args] = options.formatter.split(" ");
|
|
36
|
+
execFile(command2, args, {
|
|
574
37
|
env: { ...process.env, SDK_IT_OUTPUT: output }
|
|
575
38
|
});
|
|
576
39
|
} else {
|
|
@@ -584,10 +47,17 @@ var dart_default = new Command("dart").description("Generate Dart SDK").addOptio
|
|
|
584
47
|
});
|
|
585
48
|
|
|
586
49
|
// packages/cli/src/lib/langs/typescript.ts
|
|
587
|
-
import { Command as Command2 } from "commander";
|
|
50
|
+
import { Command as Command2, Option as Option2 } from "commander";
|
|
51
|
+
import { publish } from "libnpmpublish";
|
|
588
52
|
import { execFile as execFile2, execSync as execSync2, spawnSync } from "node:child_process";
|
|
53
|
+
import { readFile } from "node:fs/promises";
|
|
54
|
+
import { tmpdir } from "node:os";
|
|
55
|
+
import { join } from "node:path";
|
|
56
|
+
import getAuthToken from "registry-auth-token";
|
|
57
|
+
import { writeFiles } from "@sdk-it/core/file-system.js";
|
|
58
|
+
import { augmentSpec as augmentSpec2, loadSpec as loadSpec2 } from "@sdk-it/spec";
|
|
589
59
|
import { generate as generate2 } from "@sdk-it/typescript";
|
|
590
|
-
var
|
|
60
|
+
var command = new Command2("typescript").alias("ts").description("Generate TypeScript SDK").addOption(specOption.makeOptionMandatory(true)).addOption(outputOption.makeOptionMandatory(false)).option(
|
|
591
61
|
"--useTsExtension [value]",
|
|
592
62
|
"Use .ts extension for generated files",
|
|
593
63
|
(value) => value === "false" ? false : true,
|
|
@@ -602,14 +72,48 @@ var typescript_default = new Command2("typescript").alias("ts").description("Gen
|
|
|
602
72
|
"--install",
|
|
603
73
|
"Install dependencies using npm (only in full mode)",
|
|
604
74
|
true
|
|
75
|
+
).option(
|
|
76
|
+
"--readme <readme>",
|
|
77
|
+
"Generate a README file",
|
|
78
|
+
(value) => value === "false" ? false : true,
|
|
79
|
+
true
|
|
605
80
|
).option("--output-type <outputType>", "Endpoint output type", "default").option(
|
|
606
81
|
"--error-as-value <errorAsValue>",
|
|
607
82
|
"Treat errors as values instead of throwing them",
|
|
608
83
|
(value) => value === "false" ? false : true,
|
|
609
|
-
|
|
610
|
-
).option("--no-default-formatter", "Do not use the default formatter").option("--no-install", "Do not install dependencies").option("-v, --verbose", "Verbose output", false).
|
|
611
|
-
|
|
84
|
+
false
|
|
85
|
+
).option("--no-default-formatter", "Do not use the default formatter").option("--no-install", "Do not install dependencies").option("-v, --verbose", "Verbose output", false).addOption(
|
|
86
|
+
new Option2(
|
|
87
|
+
"--publish <publish>",
|
|
88
|
+
"Publish the SDK to a package registry (npm, github, or a custom registry)"
|
|
89
|
+
).hideHelp(true).makeOptionMandatory(false)
|
|
90
|
+
).action(async (options) => {
|
|
91
|
+
if (!options.publish && !options.output) {
|
|
92
|
+
command.error("Error: --publish or --output option is required.", {
|
|
93
|
+
exitCode: 1
|
|
94
|
+
});
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const spec = augmentSpec2(
|
|
98
|
+
{
|
|
99
|
+
spec: await loadSpec2(options.spec),
|
|
100
|
+
responses: { flattenErrorResponses: true }
|
|
101
|
+
},
|
|
102
|
+
false
|
|
103
|
+
);
|
|
104
|
+
if (options.output) {
|
|
105
|
+
await emitLocal(spec, { ...options, output: options.output });
|
|
106
|
+
}
|
|
107
|
+
if (options.publish) {
|
|
108
|
+
await emitRemote(spec, {
|
|
109
|
+
...options,
|
|
110
|
+
publish: options.publish
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
async function emitLocal(spec, options) {
|
|
612
115
|
await generate2(spec, {
|
|
116
|
+
writer: writeFiles,
|
|
613
117
|
output: options.output,
|
|
614
118
|
mode: options.mode || "minimal",
|
|
615
119
|
name: options.name,
|
|
@@ -618,11 +122,12 @@ var typescript_default = new Command2("typescript").alias("ts").description("Gen
|
|
|
618
122
|
outputType: options.outputType,
|
|
619
123
|
errorAsValue: options.errorAsValue
|
|
620
124
|
},
|
|
125
|
+
readme: options.readme,
|
|
621
126
|
useTsExtension: options.useTsExtension,
|
|
622
127
|
formatCode: ({ env, output }) => {
|
|
623
128
|
if (options.formatter) {
|
|
624
|
-
const [
|
|
625
|
-
execFile2(
|
|
129
|
+
const [command2, ...args] = options.formatter.split(" ");
|
|
130
|
+
execFile2(command2, args, {
|
|
626
131
|
env: { ...env, SDK_IT_OUTPUT: output }
|
|
627
132
|
});
|
|
628
133
|
} else if (options.defaultFormatter) {
|
|
@@ -644,7 +149,46 @@ var typescript_default = new Command2("typescript").alias("ts").description("Gen
|
|
|
644
149
|
stdio: options.verbose ? "inherit" : "pipe"
|
|
645
150
|
});
|
|
646
151
|
}
|
|
647
|
-
}
|
|
152
|
+
}
|
|
153
|
+
async function emitRemote(spec, options) {
|
|
154
|
+
const registry = options.publish === "npm" ? "https://registry.npmjs.org/" : options.publish === "github" ? "https://npm.pkg.github.com/" : options.publish;
|
|
155
|
+
console.log("Publishing to registry:", registry);
|
|
156
|
+
const path = join(tmpdir(), crypto.randomUUID());
|
|
157
|
+
await emitLocal(spec, {
|
|
158
|
+
...options,
|
|
159
|
+
output: path,
|
|
160
|
+
install: false,
|
|
161
|
+
mode: "full"
|
|
162
|
+
});
|
|
163
|
+
const manifest = JSON.parse(
|
|
164
|
+
await readFile(join(path, "package.json"), "utf-8")
|
|
165
|
+
);
|
|
166
|
+
const registryUrl = new URL(registry);
|
|
167
|
+
const npmrc = process.env.NPM_TOKEN ? {
|
|
168
|
+
npmrc: {
|
|
169
|
+
registry,
|
|
170
|
+
[`//${registryUrl.hostname}:_authToken`]: process.env.NPM_TOKEN
|
|
171
|
+
}
|
|
172
|
+
} : registry;
|
|
173
|
+
const auth = getAuthToken(npmrc);
|
|
174
|
+
if (!auth || !auth.token) {
|
|
175
|
+
throw new Error(
|
|
176
|
+
"No npm auth token found in .npmrc or environment. please provide NPM_TOKEN."
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
const packResult = execSync2("npm pack --pack-destination .", { cwd: path });
|
|
180
|
+
const [tgzName] = packResult.toString().trim().split("\n");
|
|
181
|
+
await publish(manifest, await readFile(join(path, tgzName)), {
|
|
182
|
+
registry,
|
|
183
|
+
defaultTag: "latest",
|
|
184
|
+
forceAuth: {
|
|
185
|
+
token: auth.token
|
|
186
|
+
},
|
|
187
|
+
strictSSL: true,
|
|
188
|
+
preferOnline: true
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
var typescript_default = command;
|
|
648
192
|
|
|
649
193
|
// packages/cli/src/lib/cli.ts
|
|
650
194
|
var generate3 = new Command3("generate").addCommand(typescript_default).addCommand(dart_default);
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/lib/cli.ts", "../src/lib/langs/dart.ts", "
|
|
4
|
-
"sourcesContent": ["#!/usr/bin/env node\nimport { Command, program } from 'commander';\n\nimport dart from './langs/dart.ts';\nimport typescript from './langs/typescript.ts';\n\nconst generate = new Command('generate')\n .addCommand(typescript)\n .addCommand(dart);\nconst cli = program\n .description(`CLI tool to interact with SDK-IT.`)\n .addCommand(generate, { isDefault: true })\n .addCommand(\n new Command('_internal').action(() => {\n // do nothing\n }),\n { hidden: true },\n )\n .parse(process.argv);\n\nexport default cli;\n", "import { Command } from 'commander';\nimport { execFile, execSync } from 'node:child_process';\n\nimport { generate } from '@sdk-it/dart';\nimport { loadSpec } from '@sdk-it/spec';\n\nimport { outputOption, shellEnv, specOption } from '../options.ts';\n\ninterface Options {\n spec: string;\n output: string;\n language: string;\n mode?: 'full' | 'minimal';\n name?: string;\n useTsExtension: boolean;\n /**\n * Command to run the formatter.\n * @example 'biome check $SDK_IT_OUTPUT --write'\n * @example 'prettier $SDK_IT_OUTPUT --write'\n */\n formatter?: string;\n verbose: boolean;\n}\n\nexport default new Command('dart')\n .description('Generate Dart SDK')\n .addOption(specOption.makeOptionMandatory(true))\n .addOption(outputOption.makeOptionMandatory(true))\n .option('-l, --language <language>', 'Programming language for the SDK')\n // .option(\n // '-m, --mode <mode>',\n // 'full: generate a full project including package.json and tsconfig.json. useful for monorepo/workspaces minimal: generate only the client sdk',\n // )\n .option('-n, --name <name>', 'Name of the generated client', 'Client')\n .option('-v, --verbose', 'Verbose output', false)\n // .option('--formatter <formatter>', 'Formatter to use for the generated code')\n .action(async (options: Options) => {\n const spec = await loadSpec(options.spec);\n await generate(spec, {\n output: options.output,\n mode: options.mode || 'full',\n name: options.name,\n formatCode: ({ output }) => {\n if (options.formatter) {\n const [command, ...args] = options.formatter.split(' ');\n execFile(command, args, {\n env: { ...process.env, SDK_IT_OUTPUT: output },\n });\n } else {\n execSync(`dart format ${shellEnv('SDK_IT_OUTPUT')}`, {\n env: { ...process.env, SDK_IT_OUTPUT: output },\n stdio: options.verbose ? 'inherit' : 'pipe',\n });\n // execSync('dart fix --apply $SDK_IT_OUTPUT ', {\n // env: { ...process.env, SDK_IT_OUTPUT: output },\n // stdio: options.verbose ? 'inherit' : 'pipe',\n // });\n }\n },\n });\n });\n", "import { readFile } from 'node:fs/promises';\nimport { extname } from 'node:path';\nimport { parse } from 'yaml';\n\nexport async function loadLocal(location: string) {\n const extName = extname(location);\n const text = await readFile(location, 'utf-8');\n switch (extName) {\n case '.json':\n return JSON.parse(text);\n case '.yaml':\n case '.yml':\n return parse(text);\n default:\n throw new Error(`Unsupported file extension: ${extName}`);\n }\n}\n", "import type {\n ContentObject,\n OpenAPIObject,\n OperationObject,\n ParameterObject,\n PathsObject,\n RequestBodyObject,\n ResponseObject,\n SchemaObject,\n SecuritySchemeObject,\n TagObject,\n} from 'openapi3-ts/oas31';\n\nimport type {\n Auth,\n Description,\n Folder,\n Header,\n Headers,\n Item,\n Items,\n PostmanCollection,\n PostmanRequest,\n QueryParam,\n Request,\n RequestBody,\n Url,\n Variable,\n} from './spec-types';\n\nfunction descriptionToText(description?: Description) {\n if (!description) {\n return undefined;\n }\n if (typeof description === 'string') {\n return description;\n }\n if (description.content) {\n return description.content;\n }\n return undefined;\n}\n\ntype OurQueryParam = Omit<QueryParam, 'key'> & {\n key: string;\n description?: string;\n};\ntype OurVariable = Omit<QueryParam, 'key'> & {\n key: string;\n description?: string;\n};\ntype OurUrl = {\n path: string[];\n query: OurQueryParam[];\n variable: OurVariable[];\n};\n\nfunction isFolder(item: Items): item is Folder & { name: string } {\n return 'item' in item;\n}\n\nfunction isRequest(\n item: Items,\n): item is Item & { name: string; request: Request } {\n return !!item.request;\n}\n\n/**\n * Recursively processes items and folders in a Postman collection\n * @param items Array of Postman items (requests or folders)\n * @param parentTags Array of parent folder tags for proper nesting\n */\nfunction processItems(\n items: Items[],\n parentTags: string[],\n globalTags: TagObject[],\n paths: PathsObject,\n securitySchemes: Record<string, SecuritySchemeObject>,\n) {\n for (const item of items) {\n if (!isFolder(item) && !isRequest(item)) {\n console.warn(\n `Skipping item ${item.name} because it is not a folder or request`,\n );\n continue;\n }\n\n if (isFolder(item)) {\n // Process folder-level auth if it exists\n if (item.auth) {\n processAuthScheme(item.auth, securitySchemes);\n }\n\n // Add this folder as a tag if not already added\n if (!globalTags.some((tag) => tag.name === item.name)) {\n globalTags.push({\n name: item.name,\n description: descriptionToText(item.description),\n });\n }\n\n const currentTags = [...parentTags, item.name];\n processItems(item.item, currentTags, globalTags, paths, securitySchemes);\n } else if (isRequest(item)) {\n // Process this request\n let operation: ReturnType<typeof requestToOperation>;\n if (typeof item.request === 'string') {\n const url = new URL(item.request);\n operation = requestToOperation(\n {\n name: url.pathname,\n response: [{ code: 200 }],\n request: {\n method: 'get',\n url: {\n path: url.pathname.split('/').slice(1),\n },\n },\n },\n securitySchemes,\n );\n } else {\n const auth = item.request.auth;\n operation = requestToOperation(\n {\n name: item.name,\n request: { ...item.request, auth },\n response: item.response,\n },\n securitySchemes,\n );\n }\n\n paths[operation.path] ??= {};\n Object.assign(paths[operation.path], {\n [operation.method]: {\n tags: parentTags.length ? parentTags : undefined,\n ...operation.operation,\n },\n });\n }\n }\n}\n\nfunction coerceVariable(query: Variable): OurVariable {\n if (!query.key) {\n throw new Error('Invalid query parameter format');\n }\n return {\n key: query.key,\n description: descriptionToText(query.description),\n };\n}\nfunction coerceQuery(query: QueryParam): OurQueryParam {\n if (!query.key) {\n throw new Error('Invalid query parameter format');\n }\n return {\n key: query.key,\n description: descriptionToText(query.description),\n };\n}\nfunction coerceUrl(url?: Url): OurUrl {\n if (!url) {\n throw new Error('Invalid URL format');\n }\n if (typeof url === 'string') {\n return {\n path: url.split('/').slice(1),\n query: [],\n variable: [],\n };\n }\n if (typeof url.path === 'string') {\n return {\n path: url.path.split('/').slice(1),\n query: (url.query ?? []).map(coerceQuery),\n variable: (url.variable ?? []).map(coerceVariable),\n };\n }\n return {\n path: (url.path ?? []).map((p) => {\n if (typeof p === 'string') {\n return p;\n }\n throw new Error('Invalid URL path format');\n }),\n query: (url.query ?? []).map(coerceQuery),\n variable: (url.variable ?? []).map(coerceVariable),\n };\n}\n\nfunction coerceResponseHeader(header?: Headers) {\n if (!header) {\n return [];\n }\n if (typeof header === 'string') {\n throw new Error(`Invalid header format: ${header}`);\n }\n return header.map((h) => {\n if (typeof h === 'string') {\n return {\n key: h,\n value: null,\n };\n }\n return h;\n });\n}\n\n/**\n * Process an auth scheme and add it to securitySchemes\n */\nfunction processAuthScheme(\n auth: Auth,\n securitySchemes: Record<string, SecuritySchemeObject>,\n): string | null {\n if (!auth || auth.type === 'noauth') return null;\n\n const getAuthAttr = (key: string): string | undefined => {\n if (!auth || auth.type === 'noauth') return undefined;\n const authType = auth[auth.type];\n if (!authType) return undefined;\n const attr = authType.find((a) => a.key === key);\n return attr ? String(attr.value) : undefined;\n };\n\n const schemeId = `${auth.type}Auth`;\n\n switch (auth.type) {\n case 'apikey': {\n const key = getAuthAttr('key') || 'api_key';\n const in_ = getAuthAttr('in') || 'header';\n securitySchemes[schemeId] = {\n type: 'apiKey',\n name: key,\n in: in_ as 'header' | 'query' | 'cookie',\n description: 'API key authentication',\n };\n break;\n }\n case 'basic':\n securitySchemes[schemeId] = {\n type: 'http',\n scheme: 'basic',\n description: 'Basic HTTP authentication',\n };\n break;\n case 'bearer': {\n const token = getAuthAttr('token');\n securitySchemes[schemeId] = {\n type: 'http',\n scheme: 'bearer',\n description: 'Bearer token authentication',\n ...(token ? { bearerFormat: 'JWT' } : {}),\n };\n break;\n }\n case 'oauth2': {\n const flowType = getAuthAttr('grant_type') || 'implicit';\n securitySchemes[schemeId] = {\n type: 'oauth2',\n description: 'OAuth 2.0 authentication',\n flows: {\n [flowType === 'authorization_code' ? 'authorizationCode' : flowType]:\n {\n authorizationUrl:\n getAuthAttr('authUrl') || 'https://example.com/oauth/authorize',\n tokenUrl:\n getAuthAttr('tokenUrl') || 'https://example.com/oauth/token',\n scopes: {},\n },\n },\n };\n break;\n }\n case 'digest':\n securitySchemes[schemeId] = {\n type: 'http',\n scheme: 'digest',\n description: 'Digest authentication',\n };\n break;\n case 'awsv4':\n securitySchemes[schemeId] = {\n type: 'apiKey',\n name: 'Authorization',\n in: 'header',\n description: 'AWS Signature v4 authentication',\n };\n break;\n default:\n securitySchemes[schemeId] = {\n type: 'apiKey',\n name: 'Authorization',\n in: 'header',\n description: `${auth.type} authentication`,\n };\n }\n\n return schemeId;\n}\n\nfunction generateSecurityRequirement(\n auth: Auth,\n securitySchemes: Record<string, SecuritySchemeObject>,\n) {\n if (!auth || auth.type === 'noauth') return [];\n\n const schemeId = `${auth.type}Auth`;\n\n // Only include if the scheme was successfully processed\n if (securitySchemes[schemeId]) {\n return [{ [schemeId]: [] }];\n }\n\n return [];\n}\n\nfunction requestToOperation(\n item: Exclude<Item, 'name' | 'request'> & {\n name: string;\n request: PostmanRequest;\n },\n securitySchemes: Record<string, SecuritySchemeObject>,\n) {\n const url = coerceUrl(item.request.url);\n const headers = Array.isArray(item.request.header)\n ? item.request.header\n : ([] as Header[]);\n\n const parameters: ParameterObject[] = [\n ...url.query\n .filter((param) => !param.disabled)\n .map((param) => {\n return {\n in: 'query',\n name: param.key,\n required: false,\n description: param.description,\n schema: {\n ...(param.value && !isNaN(Number(param.value))\n ? { type: 'number' }\n : param.value === 'true' || param.value === 'false'\n ? { type: 'boolean' }\n : { type: 'string' }),\n },\n } satisfies ParameterObject;\n }),\n\n ...url.variable.map((param) => {\n return {\n in: 'path',\n name: param.key,\n required: true,\n description: param.description,\n schema: {\n ...(param.value && !isNaN(Number(param.value))\n ? { type: 'number' }\n : param.value === 'true' || param.value === 'false'\n ? { type: 'boolean' }\n : { type: 'string' }),\n },\n } satisfies ParameterObject;\n }),\n\n ...headers\n .filter(\n (h) =>\n !h.disabled &&\n h.key.toLowerCase() !== 'accept' &&\n h.key.toLowerCase() !== 'content-type',\n )\n .map((header) => {\n return {\n in: 'header',\n name: header.key,\n required: false,\n description: descriptionToText(header.description),\n schema: {\n type: 'string',\n },\n } satisfies ParameterObject;\n }),\n ];\n\n // Extract Accept and Content-Type headers\n const acceptHeaderIdx = headers.findIndex(\n (h) => h.key.toLowerCase() === 'accept',\n );\n const contentTypeIdx = headers.findIndex(\n (h) => h.key.toLowerCase() === 'content-type',\n );\n const [acceptHeaderValue] =\n acceptHeaderIdx !== -1\n ? headers.splice(acceptHeaderIdx, 1).map((h) => h.value)\n : [];\n const [contentTypeValue] =\n contentTypeIdx !== -1\n ? headers.splice(contentTypeIdx, 1).map((h) => h.value)\n : [];\n\n let security;\n if (item.request.auth) {\n const schemeId = processAuthScheme(item.request.auth, securitySchemes);\n if (schemeId) {\n security = [{ [schemeId]: [] }];\n }\n }\n\n return {\n path: `/${url.path.join('/')}`.replace(/:([^/]+)/g, '{$1}'),\n method: (item.request.method ?? 'get').toLowerCase(),\n operation: {\n summary: item.name,\n description: descriptionToText(item.request.description),\n parameters,\n security,\n responses:\n !item.response || item.response.length === 0\n ? {\n 200: {\n description: 'Successful response',\n },\n }\n : item.response.reduce((acc, response) => {\n const headers = coerceResponseHeader(response.header);\n const contentTypeIdx = headers.findIndex(\n (h) => h.key.toLowerCase() === 'content-type',\n );\n const [contentTypeValue] =\n contentTypeIdx !== -1\n ? headers.splice(contentTypeIdx).map((h) => h.value)\n : [];\n const contentType = response.body\n ? contentTypeValue || 'application/json'\n : 'application/octet-stream';\n\n return {\n ...acc,\n [response.code ?? 200]: {\n description: response.name\n ? response.name\n : `Response for ${response.code}`,\n content: {\n [contentType]: {\n schema: bodyToSchema(response.body),\n },\n },\n } satisfies ResponseObject,\n };\n }, {}),\n requestBody: item.request.body\n ? requestBodyToOperationBody(\n contentTypeValue || 'application/json',\n item.request.body,\n )\n : undefined,\n } satisfies OperationObject,\n };\n}\n\n/**\n * Helper function to determine the likely type of a value\n */\nfunction inferSchemaType(value: string | null): { type: string } {\n if (!value) return { type: 'string' };\n\n // Check if value is a number\n if (!isNaN(Number(value))) {\n return { type: 'number' };\n }\n\n // Check if value is a boolean\n if (value === 'true' || value === 'false') {\n return { type: 'boolean' };\n }\n\n // Default to string\n return { type: 'string' };\n}\n\nfunction requestBodyToOperationBody(\n contentType: string,\n body: RequestBody,\n): RequestBodyObject {\n if (body.mode === 'raw') {\n return {\n content: {\n [contentType]: {\n schema: bodyToSchema(body.raw),\n },\n },\n };\n } else if (body.mode === 'urlencoded') {\n const properties: Record<string, any> = {};\n (body.urlencoded || [])\n .filter((param) => !param.disabled)\n .forEach((param) => {\n properties[param.key] = {\n type: 'string',\n description: descriptionToText(param.description),\n };\n });\n\n return {\n content: {\n 'application/x-www-form-urlencoded': {\n schema: {\n type: 'object',\n properties,\n },\n },\n } satisfies ContentObject,\n };\n } else if (body.mode === 'formdata') {\n const properties: SchemaObject['properties'] = {};\n (body.formdata || [])\n .filter((param) => !param.disabled)\n .forEach((param) => {\n if (param.type === 'text') {\n properties[param.key] = {\n type: 'string',\n description: descriptionToText(param.description),\n };\n } else if (param.type === 'file') {\n properties[param.key] = {\n type: 'string',\n format: 'binary',\n description: descriptionToText(param.description),\n };\n }\n });\n\n return {\n content: {\n 'multipart/form-data': {\n schema: {\n type: 'object',\n properties,\n },\n },\n } satisfies ContentObject,\n };\n }\n\n throw new Error(\n `Unsupported request body mode: ${body.mode}. Supported modes are: raw, urlencoded, formdata`,\n );\n}\n\nfunction bodyToSchema(bodyString?: string | null): SchemaObject | undefined {\n if (!bodyString) {\n return undefined;\n }\n\n let body: unknown;\n try {\n body = JSON.parse(bodyString);\n } catch (error) {\n console.warn(\n `Failed to parse JSON body: ${bodyString}. Treating as plain string.`,\n error,\n );\n return { type: 'string', example: bodyString };\n }\n\n return toSchema(body);\n}\n\nfunction toSchema(body: unknown | unknown[]): any {\n const typeMap: Record<string, string> = {\n '<number>': 'number',\n '<string>': 'string',\n '<boolean>': 'boolean',\n false: 'boolean',\n true: 'boolean',\n };\n if (Array.isArray(body)) {\n return {\n type: 'array',\n items: toSchema(body[0]),\n };\n }\n if (typeof body === 'object' && body !== null) {\n const properties: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(body)) {\n properties[key] = toSchema(value);\n }\n return {\n type: 'object',\n properties,\n };\n }\n if (typeof body === 'string') {\n return {\n type: typeMap[body] ?? 'string',\n };\n }\n if (typeof body === 'number') {\n return {\n type: 'number',\n };\n }\n if (typeof body === 'boolean') {\n return {\n type: 'boolean',\n };\n }\n if (body === null) {\n return {\n type: 'null',\n };\n }\n console.warn(`Unknown type for body: ${body}. Defaulting to string.`, body);\n return {\n type: 'string',\n };\n}\n\nexport function convertPostmanToOpenAPI(\n collection: PostmanCollection,\n): OpenAPIObject {\n const tags: TagObject[] = [];\n const paths: PathsObject = {};\n const securitySchemes: Record<string, SecuritySchemeObject> = {};\n\n if (collection.auth) {\n processAuthScheme(collection.auth, securitySchemes);\n }\n processItems(collection.item, [], tags, paths, securitySchemes);\n return {\n openapi: '3.1.0',\n info: {\n title: collection.info.name,\n version: '1.0.0',\n description: descriptionToText(collection.info.description),\n },\n tags,\n paths,\n // Only add security at top level if there's collection auth\n security: collection.auth\n ? generateSecurityRequirement(collection.auth, securitySchemes)\n : undefined,\n components:\n Object.keys(securitySchemes).length > 0\n ? {\n securitySchemes,\n }\n : undefined,\n };\n}\n", "import { extname } from 'node:path';\nimport { parse } from 'yaml';\n\nexport async function loadRemote<T>(location: string): Promise<T> {\n const extName = extname(location);\n const response = await fetch(location);\n switch (extName) {\n case '.json':\n return response.json() as Promise<T>;\n case '.yaml':\n case '.yml': {\n const text = await response.text();\n return parse(text);\n }\n default:\n try {\n // try to parse it as json first\n return response.json() as Promise<T>;\n } catch {\n // parse as yaml\n const text = await response.text();\n return parse(text) as Promise<T>;\n }\n }\n}\n", "import type { OpenAPIObject } from 'openapi3-ts/oas31';\n\nimport { loadLocal } from './local-loader.js';\nimport { convertPostmanToOpenAPI } from './postman/postman-converter.js';\nimport type { PostmanCollection } from './postman/spec-types.js';\nimport { loadRemote } from './remote-loader.js';\n\nfunction isPostman(content: unknown): content is PostmanCollection {\n return (\n typeof content === 'object' &&\n content !== null &&\n 'info' in content &&\n typeof content.info === 'object' &&\n content.info !== null &&\n 'item' in content &&\n Array.isArray(content.item) &&\n 'schema' in content.info &&\n typeof content.info.schema === 'string' &&\n content.info.schema.includes('//schema.getpostman.com/')\n );\n}\nexport async function loadSpec(location: string): Promise<OpenAPIObject> {\n const content = await loadFile(location);\n if (isPostman(content)) {\n return convertPostmanToOpenAPI(content);\n }\n return content as OpenAPIObject;\n}\n\nexport function loadFile<T>(location: string): Promise<T> {\n const [protocol] = location.split(':');\n if (protocol === 'http' || protocol === 'https') {\n return loadRemote(location);\n }\n return loadLocal(location);\n}\n", "import type {\n OpenAPIObject,\n OperationObject,\n ParameterObject,\n ReferenceObject,\n ResponseObject,\n} from 'openapi3-ts/oas31';\nimport { camelcase } from 'stringcase';\n\nimport { followRef, isRef } from '@sdk-it/core';\n\nexport const defaults: Partial<GenerateSdkConfig> &\n Required<Pick<GenerateSdkConfig, 'operationId' | 'tag'>> = {\n operationId: (operation, path, method) => {\n if (operation.operationId) {\n return camelcase(operation.operationId);\n }\n const metadata = operation['x-oaiMeta'];\n if (metadata && metadata.name) {\n return camelcase(metadata.name);\n }\n return camelcase(\n [method, ...path.replace(/[\\\\/\\\\{\\\\}]/g, ' ').split(' ')]\n .filter(Boolean)\n .join(' ')\n .trim(),\n );\n },\n tag: (operation, path) => {\n return operation.tags?.[0]\n ? sanitizeTag(operation.tags?.[0])\n : determineGenericTag(path, operation);\n },\n};\n\nexport type TunedOperationObject = Omit<\n OperationObject,\n 'operationId' | 'parameters' | 'responses'\n> & {\n operationId: string;\n parameters: (ParameterObject | ReferenceObject)[];\n responses: Record<string, ResponseObject>;\n};\n\nexport interface OperationEntry {\n name?: string;\n method: string;\n path: string;\n groupName: string;\n tag: string;\n}\nexport type Operation = {\n entry: OperationEntry;\n operation: TunedOperationObject;\n};\n\nfunction resolveResponses(spec: OpenAPIObject, operation: OperationObject) {\n const responses = operation.responses ?? {};\n const resolved: Record<string, ResponseObject> = {};\n for (const status in responses) {\n const response = isRef(responses[status] as ReferenceObject)\n ? followRef<ResponseObject>(spec, responses[status].$ref)\n : (responses[status] as ResponseObject);\n resolved[status] = response;\n }\n return resolved;\n}\n\nexport function forEachOperation<T>(\n config: GenerateSdkConfig,\n callback: (entry: OperationEntry, operation: TunedOperationObject) => T,\n) {\n const result: T[] = [];\n for (const [path, pathItem] of Object.entries(config.spec.paths ?? {})) {\n const { parameters = [], ...methods } = pathItem;\n\n // Convert Express-style routes (:param) to OpenAPI-style routes ({param})\n const fixedPath = path.replace(/:([^/]+)/g, '{$1}');\n\n for (const [method, operation] of Object.entries(methods) as [\n string,\n OperationObject,\n ][]) {\n const formatOperationId = config.operationId ?? defaults.operationId;\n const formatTag = config.tag ?? defaults.tag;\n const operationName = formatOperationId(operation, fixedPath, method);\n const operationTag = formatTag(operation, fixedPath);\n const metadata = operation['x-oaiMeta'] ?? {};\n\n result.push(\n callback(\n {\n name: metadata.name,\n method,\n path: fixedPath,\n groupName: operationTag,\n tag: operationTag,\n },\n {\n ...operation,\n parameters: [...parameters, ...(operation.parameters ?? [])],\n operationId: operationName,\n responses: resolveResponses(config.spec, operation),\n },\n ),\n );\n }\n }\n return result;\n}\n\nexport interface GenerateSdkConfig {\n spec: OpenAPIObject;\n operationId?: (\n operation: OperationObject,\n path: string,\n method: string,\n ) => string;\n tag?: (operation: OperationObject, path: string) => string;\n}\n\n/**\n * Set of reserved TypeScript keywords and common verbs potentially used as tags.\n */\n\nconst reservedKeywords = new Set([\n 'await', // Reserved in async functions\n 'break',\n 'case',\n 'catch',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'else',\n 'enum',\n 'export',\n 'extends',\n 'false',\n 'finally',\n 'for',\n 'function',\n 'if',\n 'implements', // Strict mode\n 'import',\n 'in',\n 'instanceof',\n 'interface', // Strict mode\n 'let', // Strict mode\n 'new',\n 'null',\n 'package', // Strict mode\n 'private', // Strict mode\n 'protected', // Strict mode\n 'public', // Strict mode\n 'return',\n 'static', // Strict mode\n 'super',\n 'switch',\n 'this',\n 'throw',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'while',\n 'with',\n 'yield', // Strict mode / Generator functions\n // 'arguments' is not technically a reserved word, but it's a special identifier within functions\n // and assigning to it or declaring it can cause issues or unexpected behavior.\n 'arguments',\n]);\n\n/**\n * Sanitizes a potential tag name (assumed to be already camelCased)\n * to avoid conflicts with reserved keywords or invalid starting characters (numbers).\n * Appends an underscore if the tag matches a reserved keyword.\n * Prepends an underscore if the tag starts with a number.\n * @param camelCasedTag The potential tag name, already camelCased.\n * @returns The sanitized tag name.\n */\nfunction sanitizeTag(camelCasedTag: string): string {\n // Prepend underscore if starts with a number\n if (/^\\d/.test(camelCasedTag)) {\n return `_${camelCasedTag}`;\n }\n // Append underscore if it's a reserved keyword\n return reservedKeywords.has(camelcase(camelCasedTag))\n ? `${camelCasedTag}_`\n : camelCasedTag;\n}\n\n/**\n * Attempts to determine a generic tag for an OpenAPI operation based on path and operationId.\n * Rules and fallbacks are documented within the code.\n * @param pathString The path string.\n * @param operation The OpenAPI Operation Object.\n * @returns A sanitized, camelCased tag name string.\n */\nexport function determineGenericTag(\n pathString: string,\n operation: OperationObject,\n): string {\n const operationId = operation.operationId || '';\n const VERSION_REGEX = /^[vV]\\d+$/;\n const commonVerbs = new Set([\n // Verbs to potentially strip from operationId prefix\n 'get',\n 'list',\n 'create',\n 'update',\n 'delete',\n 'post',\n 'put',\n 'patch',\n 'do',\n 'send',\n 'add',\n 'remove',\n 'set',\n 'find',\n 'search',\n 'check',\n 'make',\n ]);\n\n const segments = pathString.split('/').filter(Boolean);\n\n const potentialCandidates = segments.filter(\n (segment) =>\n segment &&\n !segment.startsWith('{') &&\n !segment.endsWith('}') &&\n !VERSION_REGEX.test(segment),\n );\n\n // --- Heuristic 1: Last non-'@' path segment ---\n for (let i = potentialCandidates.length - 1; i >= 0; i--) {\n const segment = potentialCandidates[i];\n if (!segment.startsWith('@')) {\n // Sanitize just before returning\n return sanitizeTag(camelcase(segment));\n }\n }\n\n const canFallbackToPathSegment = potentialCandidates.length > 0;\n\n // --- Heuristic 2: OperationId parsing ---\n if (operationId) {\n const lowerOpId = operationId.toLowerCase();\n const parts = operationId\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/([A-Z])([A-Z][a-z])/g, '$1_$2')\n .replace(/([a-zA-Z])(\\d)/g, '$1_$2')\n .replace(/(\\d)([a-zA-Z])/g, '$1_$2')\n .toLowerCase()\n .split(/[_-\\s]+/);\n\n const validParts = parts.filter(Boolean);\n\n // Quick skip: If opId is just a verb and we can use Heuristic 3, prefer that.\n if (\n commonVerbs.has(lowerOpId) &&\n validParts.length === 1 &&\n canFallbackToPathSegment\n ) {\n // Proceed directly to Heuristic 3\n }\n // Only process if there are valid parts and the quick skip didn't happen\n else if (validParts.length > 0) {\n const firstPart = validParts[0];\n const isFirstPartVerb = commonVerbs.has(firstPart);\n\n // Case 2a: Starts with verb, has following parts\n if (isFirstPartVerb && validParts.length > 1) {\n const verbPrefixLength = firstPart.length;\n let nextPartStartIndex = -1;\n if (operationId.length > verbPrefixLength) {\n // Simplified check for next part start\n const charAfterPrefix = operationId[verbPrefixLength];\n if (charAfterPrefix >= 'A' && charAfterPrefix <= 'Z') {\n nextPartStartIndex = verbPrefixLength;\n } else if (charAfterPrefix >= '0' && charAfterPrefix <= '9') {\n nextPartStartIndex = verbPrefixLength;\n } else if (['_', '-'].includes(charAfterPrefix)) {\n nextPartStartIndex = verbPrefixLength + 1;\n } else {\n const match = operationId\n .substring(verbPrefixLength)\n .match(/[A-Z0-9]/);\n if (match && match.index !== undefined) {\n nextPartStartIndex = verbPrefixLength + match.index;\n }\n if (\n nextPartStartIndex === -1 &&\n operationId.length > verbPrefixLength\n ) {\n nextPartStartIndex = verbPrefixLength; // Default guess\n }\n }\n }\n\n if (\n nextPartStartIndex !== -1 &&\n nextPartStartIndex < operationId.length\n ) {\n const remainingOriginalSubstring =\n operationId.substring(nextPartStartIndex);\n const potentialTag = camelcase(remainingOriginalSubstring);\n if (potentialTag) {\n // Sanitize just before returning\n return sanitizeTag(potentialTag);\n }\n }\n\n // Fallback: join remaining lowercased parts\n const potentialTagJoined = camelcase(validParts.slice(1).join('_'));\n if (potentialTagJoined) {\n // Sanitize just before returning\n return sanitizeTag(potentialTagJoined);\n }\n }\n\n // Case 2b: Doesn't start with verb, or only one part (might be verb)\n const potentialTagFull = camelcase(operationId);\n if (potentialTagFull) {\n const isResultSingleVerb = validParts.length === 1 && isFirstPartVerb;\n\n // Avoid returning only a verb if Heuristic 3 is possible\n if (!(isResultSingleVerb && canFallbackToPathSegment)) {\n if (potentialTagFull.length > 0) {\n // Sanitize just before returning\n return sanitizeTag(potentialTagFull);\n }\n }\n }\n\n // Case 2c: Further fallbacks within OpId if above failed/skipped\n const firstPartCamel = camelcase(firstPart);\n if (firstPartCamel) {\n const isFirstPartCamelVerb = commonVerbs.has(firstPartCamel);\n if (\n !isFirstPartCamelVerb ||\n validParts.length === 1 ||\n !canFallbackToPathSegment\n ) {\n // Sanitize just before returning\n return sanitizeTag(firstPartCamel);\n }\n }\n if (\n isFirstPartVerb &&\n validParts.length > 1 &&\n validParts[1] &&\n canFallbackToPathSegment\n ) {\n const secondPartCamel = camelcase(validParts[1]);\n if (secondPartCamel) {\n // Sanitize just before returning\n return sanitizeTag(secondPartCamel);\n }\n }\n } // End if(validParts.length > 0) after quick skip check\n } // End if(operationId)\n\n // --- Heuristic 3: First path segment (stripping '@') ---\n if (potentialCandidates.length > 0) {\n let firstCandidate = potentialCandidates[0];\n if (firstCandidate.startsWith('@')) {\n firstCandidate = firstCandidate.substring(1);\n }\n if (firstCandidate) {\n // Sanitize just before returning\n return sanitizeTag(camelcase(firstCandidate));\n }\n }\n\n // --- Heuristic 4: Default ---\n console.warn(\n `Could not determine a suitable tag for path: ${pathString}, operationId: ${operationId}. Using 'unknown'.`,\n );\n return 'unknown'; // 'unknown' is safe\n}\n\nexport function parseJsonContentType(contentType: string | null | undefined) {\n if (!contentType) {\n return null;\n }\n\n // 1. Trim whitespace\n let mainType = contentType.trim();\n\n // 2. Remove parameters (anything after the first ';')\n const semicolonIndex = mainType.indexOf(';');\n if (semicolonIndex !== -1) {\n mainType = mainType.substring(0, semicolonIndex).trim(); // Trim potential space before ';'\n }\n\n // 3. Convert to lowercase for case-insensitive comparison\n mainType = mainType.toLowerCase();\n\n if (mainType.endsWith('/json')) {\n return mainType.split('/')[1];\n } else if (mainType.endsWith('+json')) {\n return mainType.split('+')[1];\n }\n return null;\n}\n\n/**\n * Checks if a given content type string represents Server-Sent Events (SSE).\n * Handles case-insensitivity, parameters (like charset), and leading/trailing whitespace.\n *\n * @param contentType The content type string to check (e.g., from a Content-Type header).\n * @returns True if the content type is 'text/event-stream', false otherwise.\n */\nexport function isSseContentType(\n contentType: string | null | undefined,\n): boolean {\n if (!contentType) {\n return false; // Handle null, undefined, or empty string\n }\n\n // 1. Trim whitespace from the input string\n let mainType = contentType.trim();\n\n // 2. Find the position of the first semicolon (if any) to remove parameters\n const semicolonIndex = mainType.indexOf(';');\n if (semicolonIndex !== -1) {\n // Extract the part before the semicolon and trim potential space\n mainType = mainType.substring(0, semicolonIndex).trim();\n }\n\n // 3. Convert the main type part to lowercase for case-insensitive comparison\n mainType = mainType.toLowerCase();\n\n // 4. Compare against the standard SSE MIME type\n return mainType === 'text/event-stream';\n}\n\nexport function isStreamingContentType(\n contentType: string | null | undefined,\n): boolean {\n return contentType === 'application/octet-stream';\n}\n\nexport function isSuccessStatusCode(statusCode: number | string): boolean {\n statusCode = Number(statusCode);\n return statusCode >= 200 && statusCode < 300;\n}\n", "import { Option } from 'commander';\n\n\n\n\n\nexport const specOption = new Option(\n '-s, --spec <spec>',\n 'Path to OpenAPI specification file',\n);\n\nexport const outputOption = new Option(\n '-o, --output <output>',\n 'Output directory for the generated SDK',\n);\n\n/**\n * Return the correct shell\u2010expansion syntax for an env var\n * on the current platform (cmd.exe vs POSIX).\n */\nexport function shellEnv(name: string): string {\n return process.platform === 'win32'\n ? `%${name}%` // Windows cmd.exe\n : `$${name}`; // POSIX shells\n}", "import { Command } from 'commander';\nimport { execFile, execSync, spawnSync } from 'node:child_process';\n\nimport { loadSpec } from '@sdk-it/spec';\nimport { generate } from '@sdk-it/typescript';\n\nimport { outputOption, specOption } from '../options.ts';\n\ninterface Options {\n spec: string;\n output: string;\n language: string;\n mode?: 'full' | 'minimal';\n name?: string;\n useTsExtension: boolean;\n /**\n * Command to run the formatter.\n * @example 'biome check $SDK_IT_OUTPUT --write'\n * @example 'prettier $SDK_IT_OUTPUT --write'\n */\n formatter?: string;\n framework?: string;\n install: boolean;\n verbose: boolean;\n defaultFormatter: boolean;\n outputType?: 'default' | 'status';\n errorAsValue?: boolean;\n}\n\nexport default new Command('typescript')\n .alias('ts')\n .description('Generate TypeScript SDK')\n .addOption(specOption.makeOptionMandatory(true))\n .addOption(outputOption.makeOptionMandatory(true))\n .option(\n '--useTsExtension [value]',\n 'Use .ts extension for generated files',\n (value) => (value === 'false' ? false : true),\n true,\n )\n .option('-l, --language <language>', 'Programming language for the SDK')\n .option(\n '-m, --mode <mode>',\n 'full: generate a full project including package.json and tsconfig.json. useful for monorepo/workspaces minimal: generate only the client sdk',\n )\n .option('-n, --name <name>', 'Name of the generated client', 'Client')\n .option(\n '-f, --framework <framework>',\n 'Framework that is integrating with the SDK',\n )\n .option('--formatter <formatter>', 'Formatter to use for the generated code')\n .option(\n '--install',\n 'Install dependencies using npm (only in full mode)',\n true,\n )\n .option('--output-type <outputType>', 'Endpoint output type', 'default')\n .option(\n '--error-as-value <errorAsValue>',\n 'Treat errors as values instead of throwing them',\n (value) => (value === 'false' ? false : true),\n true,\n )\n .option('--no-default-formatter', 'Do not use the default formatter')\n .option('--no-install', 'Do not install dependencies')\n .option('-v, --verbose', 'Verbose output', false)\n .action(async (options: Options) => {\n const spec = await loadSpec(options.spec);\n await generate(spec, {\n output: options.output,\n mode: options.mode || 'minimal',\n name: options.name,\n style: {\n name: 'github',\n outputType: options.outputType,\n errorAsValue: options.errorAsValue,\n },\n useTsExtension: options.useTsExtension,\n formatCode: ({ env, output }) => {\n if (options.formatter) {\n const [command, ...args] = options.formatter.split(' ');\n execFile(command, args, {\n env: { ...env, SDK_IT_OUTPUT: output },\n });\n } else if (options.defaultFormatter) {\n spawnSync('npx', ['-y', 'prettier', output, '--write'], {\n env: {\n ...env,\n SDK_IT_OUTPUT: output,\n NODE_OPTIONS: '--experimental-strip-types',\n },\n stdio: options.verbose ? 'inherit' : 'pipe',\n });\n // execSync(`npx -y prettier ${shellEnv('SDK_IT_OUTPUT')} --write`, {\n // env: {\n // ...env,\n // SDK_IT_OUTPUT: output,\n // NODE_OPTIONS: '--experimental-strip-types',\n // },\n // stdio: options.verbose ? 'inherit' : 'pipe',\n // });\n }\n },\n });\n\n // Install dependencies if in full mode and install option is enabled\n if (options.install && options.mode === 'full') {\n console.log('Installing dependencies...');\n execSync('npm install', {\n cwd: options.output,\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,WAAW,QAAQ,kBAAkB;AACnC,kBAAU,OAAO,CAAC,MAAM,YAAY,QAAQ,SAAS,GAAG;AAAA,UACtD,KAAK;AAAA,YACH,GAAG;AAAA,YACH,eAAe;AAAA,YACf,cAAc;AAAA,UAChB;AAAA,UACA,OAAO,QAAQ,UAAU,YAAY;AAAA,QACvC,CAAC;AAAA,MASH;AAAA,IACF;AAAA,EACF,CAAC;AAGD,MAAI,QAAQ,WAAW,QAAQ,SAAS,QAAQ;AAC9C,YAAQ,IAAI,4BAA4B;AACxC,IAAAC,UAAS,eAAe;AAAA,MACtB,KAAK,QAAQ;AAAA,MACb,OAAO,QAAQ,UAAU,YAAY;AAAA,IACvC,CAAC;AAAA,EACH;AACF,CAAC;;;AR3GH,IAAMC,YAAW,IAAIC,SAAQ,UAAU,EACpC,WAAW,kBAAU,EACrB,WAAW,YAAI;AAClB,IAAM,MAAM,QACT,YAAY,mCAAmC,EAC/C,WAAWD,WAAU,EAAE,WAAW,KAAK,CAAC,EACxC;AAAA,EACC,IAAIC,SAAQ,WAAW,EAAE,OAAO,MAAM;AAAA,EAEtC,CAAC;AAAA,EACD,EAAE,QAAQ,KAAK;AACjB,EACC,MAAM,QAAQ,IAAI;",
|
|
6
|
-
"names": ["Command", "
|
|
3
|
+
"sources": ["../src/lib/cli.ts", "../src/lib/langs/dart.ts", "../src/lib/options.ts", "../src/lib/langs/typescript.ts"],
|
|
4
|
+
"sourcesContent": ["#!/usr/bin/env node\nimport { Command, program } from 'commander';\n\nimport dart from './langs/dart.ts';\nimport typescript from './langs/typescript.ts';\n\nconst generate = new Command('generate')\n .addCommand(typescript)\n .addCommand(dart);\nconst cli = program\n .description(`CLI tool to interact with SDK-IT.`)\n .addCommand(generate, { isDefault: true })\n .addCommand(\n new Command('_internal').action(() => {\n // do nothing\n }),\n { hidden: true },\n )\n .parse(process.argv);\n\nexport default cli;\n", "import { Command } from 'commander';\nimport { execFile, execSync } from 'node:child_process';\n\nimport { generate } from '@sdk-it/dart';\nimport { augmentSpec, loadSpec } from '@sdk-it/spec';\n\nimport { outputOption, shellEnv, specOption } from '../options.ts';\n\ninterface Options {\n spec: string;\n output: string;\n language: string;\n mode?: 'full' | 'minimal';\n name?: string;\n useTsExtension: boolean;\n /**\n * Command to run the formatter.\n * @example 'biome check $SDK_IT_OUTPUT --write'\n * @example 'prettier $SDK_IT_OUTPUT --write'\n */\n formatter?: string;\n verbose: boolean;\n}\n\nexport default new Command('dart')\n .description('Generate Dart SDK')\n .addOption(specOption.makeOptionMandatory(true))\n .addOption(outputOption.makeOptionMandatory(true))\n .option('-l, --language <language>', 'Programming language for the SDK')\n // .option(\n // '-m, --mode <mode>',\n // 'full: generate a full project including package.json and tsconfig.json. useful for monorepo/workspaces minimal: generate only the client sdk',\n // )\n .option('-n, --name <name>', 'Name of the generated client', 'Client')\n .option('-v, --verbose', 'Verbose output', false)\n // .option('--formatter <formatter>', 'Formatter to use for the generated code')\n .action(async (options: Options) => {\n const spec = augmentSpec({ spec: await loadSpec(options.spec) }, true);\n await generate(spec, {\n output: options.output,\n mode: options.mode || 'full',\n name: options.name,\n formatCode: ({ output }) => {\n if (options.formatter) {\n const [command, ...args] = options.formatter.split(' ');\n execFile(command, args, {\n env: { ...process.env, SDK_IT_OUTPUT: output },\n });\n } else {\n execSync(`dart format ${shellEnv('SDK_IT_OUTPUT')}`, {\n env: { ...process.env, SDK_IT_OUTPUT: output },\n stdio: options.verbose ? 'inherit' : 'pipe',\n });\n // execSync('dart fix --apply $SDK_IT_OUTPUT ', {\n // env: { ...process.env, SDK_IT_OUTPUT: output },\n // stdio: options.verbose ? 'inherit' : 'pipe',\n // });\n }\n },\n });\n });\n", "import { Option } from 'commander';\n\n\n\n\n\nexport const specOption = new Option(\n '-s, --spec <spec>',\n 'Path to OpenAPI specification file',\n);\n\nexport const outputOption = new Option(\n '-o, --output <output>',\n 'Output directory for the generated SDK',\n);\n\n/**\n * Return the correct shell\u2010expansion syntax for an env var\n * on the current platform (cmd.exe vs POSIX).\n */\nexport function shellEnv(name: string): string {\n return process.platform === 'win32'\n ? `%${name}%` // Windows cmd.exe\n : `$${name}`; // POSIX shells\n}", "import { Command, Option } from 'commander';\nimport { publish } from 'libnpmpublish';\nimport { execFile, execSync, spawnSync } from 'node:child_process';\nimport { readFile } from 'node:fs/promises';\nimport { tmpdir } from 'node:os';\nimport { join } from 'node:path';\nimport type { OpenAPIObject } from 'openapi3-ts/oas31';\nimport getAuthToken from 'registry-auth-token';\n\nimport { writeFiles } from '@sdk-it/core/file-system.js';\nimport { augmentSpec, loadSpec } from '@sdk-it/spec';\nimport { generate } from '@sdk-it/typescript';\n\nimport { outputOption, specOption } from '../options.ts';\n\ninterface Options {\n spec: string;\n output?: string;\n language: string;\n mode?: 'full' | 'minimal';\n name?: string;\n useTsExtension: boolean;\n /**\n * Command to run the formatter.\n * @example 'biome check $SDK_IT_OUTPUT --write'\n * @example 'prettier $SDK_IT_OUTPUT --write'\n */\n formatter?: string;\n framework?: string;\n install: boolean;\n verbose: boolean;\n defaultFormatter: boolean;\n outputType?: 'default' | 'status';\n errorAsValue?: boolean;\n readme?: boolean;\n publish?: string;\n}\n\nconst command = new Command('typescript')\n .alias('ts')\n .description('Generate TypeScript SDK')\n .addOption(specOption.makeOptionMandatory(true))\n .addOption(outputOption.makeOptionMandatory(false))\n .option(\n '--useTsExtension [value]',\n 'Use .ts extension for generated files',\n (value) => (value === 'false' ? false : true),\n true,\n )\n .option('-l, --language <language>', 'Programming language for the SDK')\n .option(\n '-m, --mode <mode>',\n 'full: generate a full project including package.json and tsconfig.json. useful for monorepo/workspaces minimal: generate only the client sdk',\n )\n .option('-n, --name <name>', 'Name of the generated client', 'Client')\n .option(\n '-f, --framework <framework>',\n 'Framework that is integrating with the SDK',\n )\n .option('--formatter <formatter>', 'Formatter to use for the generated code')\n .option(\n '--install',\n 'Install dependencies using npm (only in full mode)',\n true,\n )\n .option(\n '--readme <readme>',\n 'Generate a README file',\n (value) => (value === 'false' ? false : true),\n true,\n )\n .option('--output-type <outputType>', 'Endpoint output type', 'default')\n .option(\n '--error-as-value <errorAsValue>',\n 'Treat errors as values instead of throwing them',\n (value) => (value === 'false' ? false : true),\n false,\n )\n .option('--no-default-formatter', 'Do not use the default formatter')\n .option('--no-install', 'Do not install dependencies')\n .option('-v, --verbose', 'Verbose output', false)\n .addOption(\n new Option(\n '--publish <publish>',\n 'Publish the SDK to a package registry (npm, github, or a custom registry)',\n )\n .hideHelp(true)\n .makeOptionMandatory(false),\n )\n .action(async (options: Options) => {\n if (!options.publish && !options.output) {\n command.error('Error: --publish or --output option is required.', {\n exitCode: 1,\n });\n return;\n }\n const spec = augmentSpec(\n {\n spec: await loadSpec(options.spec),\n responses: { flattenErrorResponses: true },\n },\n false,\n );\n if (options.output) {\n await emitLocal(spec, { ...options, output: options.output });\n }\n if (options.publish) {\n await emitRemote(spec, {\n ...options,\n publish: options.publish,\n });\n }\n });\n\nasync function emitLocal(\n spec: OpenAPIObject,\n options: Options & { output: string },\n) {\n await generate(spec, {\n writer: writeFiles,\n output: options.output,\n mode: options.mode || 'minimal',\n name: options.name,\n style: {\n name: 'github',\n outputType: options.outputType,\n errorAsValue: options.errorAsValue,\n },\n readme: options.readme,\n useTsExtension: options.useTsExtension,\n formatCode: ({ env, output }) => {\n if (options.formatter) {\n const [command, ...args] = options.formatter.split(' ');\n execFile(command, args, {\n env: { ...env, SDK_IT_OUTPUT: output },\n });\n } else if (options.defaultFormatter) {\n spawnSync('npx', ['-y', 'prettier', output, '--write'], {\n env: {\n ...env,\n SDK_IT_OUTPUT: output,\n NODE_OPTIONS: '--experimental-strip-types',\n },\n stdio: options.verbose ? 'inherit' : 'pipe',\n });\n }\n },\n });\n\n // Install dependencies if in full mode and install option is enabled\n if (options.install && options.mode === 'full') {\n console.log('Installing dependencies...');\n execSync('npm install', {\n cwd: options.output,\n stdio: options.verbose ? 'inherit' : 'pipe',\n });\n }\n}\n\nasync function emitRemote(\n spec: OpenAPIObject,\n options: Options & { publish: string },\n) {\n const registry =\n options.publish === 'npm'\n ? 'https://registry.npmjs.org/'\n : options.publish === 'github'\n ? 'https://npm.pkg.github.com/'\n : options.publish;\n\n console.log('Publishing to registry:', registry);\n const path = join(tmpdir(), crypto.randomUUID());\n await emitLocal(spec, {\n ...options,\n output: path,\n install: false,\n mode: 'full',\n });\n const manifest = JSON.parse(\n await readFile(join(path, 'package.json'), 'utf-8'),\n );\n const registryUrl = new URL(registry);\n const npmrc = process.env.NPM_TOKEN\n ? {\n npmrc: {\n registry,\n [`//${registryUrl.hostname}:_authToken`]: process.env.NPM_TOKEN,\n },\n }\n : registry;\n const auth = getAuthToken(npmrc);\n if (!auth || !auth.token) {\n throw new Error(\n 'No npm auth token found in .npmrc or environment. please provide NPM_TOKEN.',\n );\n }\n const packResult = execSync('npm pack --pack-destination .', { cwd: path });\n const [tgzName] = packResult.toString().trim().split('\\n');\n await publish(manifest, await readFile(join(path, tgzName)), {\n registry,\n defaultTag: 'latest',\n forceAuth: {\n token: auth.token,\n },\n strictSSL: true,\n preferOnline: true,\n });\n}\n\nexport default command;\n"],
|
|
5
|
+
"mappings": ";;;AACA,SAAS,WAAAA,UAAS,eAAe;;;ACDjC,SAAS,eAAe;AACxB,SAAS,UAAU,gBAAgB;AAEnC,SAAS,gBAAgB;AACzB,SAAS,aAAa,gBAAgB;;;ACJtC,SAAS,cAAc;AAMhB,IAAM,aAAa,IAAI;AAAA,EAC5B;AAAA,EACA;AACF;AAEO,IAAM,eAAe,IAAI;AAAA,EAC9B;AAAA,EACA;AACF;AAMO,SAAS,SAAS,MAAsB;AAC7C,SAAO,QAAQ,aAAa,UACxB,IAAI,IAAI,MACR,IAAI,IAAI;AACd;;;ADAA,IAAO,eAAQ,IAAI,QAAQ,MAAM,EAC9B,YAAY,mBAAmB,EAC/B,UAAU,WAAW,oBAAoB,IAAI,CAAC,EAC9C,UAAU,aAAa,oBAAoB,IAAI,CAAC,EAChD,OAAO,6BAA6B,kCAAkC,EAKtE,OAAO,qBAAqB,gCAA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AAAA,IACpB,MAAM,SAAS,KAAK,MAAM,cAAc,GAAG,OAAO;AAAA,EACpD;AACA,QAAM,cAAc,IAAI,IAAI,QAAQ;AACpC,QAAM,QAAQ,QAAQ,IAAI,YACtB;AAAA,IACE,OAAO;AAAA,MACL;AAAA,MACA,CAAC,KAAK,YAAY,QAAQ,aAAa,GAAG,QAAQ,IAAI;AAAA,IACxD;AAAA,EACF,IACA;AACJ,QAAM,OAAO,aAAa,KAAK;AAC/B,MAAI,CAAC,QAAQ,CAAC,KAAK,OAAO;AACxB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,QAAM,aAAaA,UAAS,iCAAiC,EAAE,KAAK,KAAK,CAAC;AAC1E,QAAM,CAAC,OAAO,IAAI,WAAW,SAAS,EAAE,KAAK,EAAE,MAAM,IAAI;AACzD,QAAM,QAAQ,UAAU,MAAM,SAAS,KAAK,MAAM,OAAO,CAAC,GAAG;AAAA,IAC3D;AAAA,IACA,YAAY;AAAA,IACZ,WAAW;AAAA,MACT,OAAO,KAAK;AAAA,IACd;AAAA,IACA,WAAW;AAAA,IACX,cAAc;AAAA,EAChB,CAAC;AACH;AAEA,IAAO,qBAAQ;;;AH3Mf,IAAMC,YAAW,IAAIC,SAAQ,UAAU,EACpC,WAAW,kBAAU,EACrB,WAAW,YAAI;AAClB,IAAM,MAAM,QACT,YAAY,mCAAmC,EAC/C,WAAWD,WAAU,EAAE,WAAW,KAAK,CAAC,EACxC;AAAA,EACC,IAAIC,SAAQ,WAAW,EAAE,OAAO,MAAM;AAAA,EAEtC,CAAC;AAAA,EACD,EAAE,QAAQ,KAAK;AACjB,EACC,MAAM,QAAQ,IAAI;",
|
|
6
|
+
"names": ["Command", "command", "Command", "Option", "execFile", "execSync", "augmentSpec", "loadSpec", "generate", "Command", "Option", "augmentSpec", "loadSpec", "generate", "command", "execFile", "execSync", "generate", "Command"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../src/lib/langs/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../src/lib/langs/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAsC5C,QAAA,MAAM,OAAO,SA0ET,CAAC;AAiGL,eAAe,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdk-it/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -19,10 +19,14 @@
|
|
|
19
19
|
"!**/*.tsbuildinfo"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@sdk-it/typescript": "0.
|
|
23
|
-
"@sdk-it/dart": "0.
|
|
24
|
-
"@sdk-it/spec": "0.
|
|
25
|
-
"commander": "^13.1.0"
|
|
22
|
+
"@sdk-it/typescript": "0.22.0",
|
|
23
|
+
"@sdk-it/dart": "0.22.0",
|
|
24
|
+
"@sdk-it/spec": "0.22.0",
|
|
25
|
+
"commander": "^13.1.0",
|
|
26
|
+
"@sdk-it/core": "0.22.0",
|
|
27
|
+
"libnpmpublish": "^11.0.0",
|
|
28
|
+
"openapi3-ts": "4.4.0",
|
|
29
|
+
"registry-auth-token": "^5.1.0"
|
|
26
30
|
},
|
|
27
31
|
"publishConfig": {
|
|
28
32
|
"access": "public"
|