@hey-api/openapi-ts 0.90.7 → 0.90.8
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.cjs +8 -2
- package/dist/index.d.cts +3 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/internal.d.cts +2 -1
- package/dist/internal.d.mts +2 -1
- package/dist/openApi-B6J9qPwL.mjs.map +1 -1
- package/dist/openApi-BZ7m5ia5.cjs.map +1 -1
- package/dist/run.cjs +2 -2
- package/dist/run.mjs +2 -2
- package/dist/{src-BehyjtZ7.mjs → src-C9rj3EgV.mjs} +8 -144
- package/dist/src-C9rj3EgV.mjs.map +1 -0
- package/dist/{src-BkOFTEi8.cjs → src-Dbxz7RgS.cjs} +7 -149
- package/dist/src-Dbxz7RgS.cjs.map +1 -0
- package/dist/{config-CU3acGju.d.mts → types-ByDiVB9E.d.mts} +4636 -4655
- package/dist/{config-BF7XAWuG.d.cts → types-DzR_aHdx.d.cts} +4636 -4655
- package/package.json +2 -2
- package/dist/src-BehyjtZ7.mjs.map +0 -1
- package/dist/src-BkOFTEi8.cjs.map +0 -1
package/dist/run.cjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
const require_openApi = require('./openApi-BZ7m5ia5.cjs');
|
|
5
|
-
const require_src = require('./src-
|
|
5
|
+
const require_src = require('./src-Dbxz7RgS.cjs');
|
|
6
6
|
let commander = require("commander");
|
|
7
7
|
|
|
8
8
|
//#region package.json
|
|
9
|
-
var version = "0.90.
|
|
9
|
+
var version = "0.90.8";
|
|
10
10
|
var bin = { "openapi-ts": "./bin/run.js" };
|
|
11
11
|
|
|
12
12
|
//#endregion
|
package/dist/run.mjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
import "./openApi-B6J9qPwL.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { i as createClient } from "./src-C9rj3EgV.mjs";
|
|
6
6
|
import { Command } from "commander";
|
|
7
7
|
|
|
8
8
|
//#region package.json
|
|
9
|
-
var version = "0.90.
|
|
9
|
+
var version = "0.90.8";
|
|
10
10
|
var bin = { "openapi-ts": "./bin/run.js" };
|
|
11
11
|
|
|
12
12
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { A as openGitHubIssueWithCrashReport, D as ConfigValidationError, E as ConfigError, M as shouldReportCrash, N as loadPackageJson, O as JobError, T as getLogs, i as initConfigs, j as printCrashReport, k as logCrashReport, n as buildGraph, r as getSpec, s as generateClientBundle, t as parseOpenApiSpec, u as toCase, w as postprocessOutput, y as getClientPlugin } from "./openApi-B6J9qPwL.mjs";
|
|
3
|
-
import "@hey-api/codegen-core";
|
|
3
|
+
import { Logger, Logger as Logger$1 } from "@hey-api/codegen-core";
|
|
4
4
|
import colors from "ansi-colors";
|
|
5
5
|
import colorSupport from "color-support";
|
|
6
6
|
import fs from "node:fs";
|
|
@@ -352,152 +352,16 @@ const asciiToLines = (ascii, options) => {
|
|
|
352
352
|
maxLineLength
|
|
353
353
|
};
|
|
354
354
|
};
|
|
355
|
-
function printCliIntro() {
|
|
355
|
+
function printCliIntro(showLogo = false) {
|
|
356
356
|
const packageJson = loadPackageJson();
|
|
357
|
-
|
|
358
|
-
|
|
357
|
+
if (showLogo) {
|
|
358
|
+
const text = asciiToLines(textAscii, { padding: 1 });
|
|
359
|
+
for (const line of text.lines) console.log(colors.cyan(line));
|
|
360
|
+
}
|
|
359
361
|
console.log(colors.gray(`${packageJson.name} v${packageJson.version}`));
|
|
360
362
|
console.log("");
|
|
361
363
|
}
|
|
362
364
|
|
|
363
|
-
//#endregion
|
|
364
|
-
//#region src/utils/logger.ts
|
|
365
|
-
let loggerCounter = 0;
|
|
366
|
-
const nameToId = (name) => `${name}-${loggerCounter++}`;
|
|
367
|
-
const idEnd = (id) => `${id}-end`;
|
|
368
|
-
const idLength = (id) => `${id}-length`;
|
|
369
|
-
const idStart = (id) => `${id}-start`;
|
|
370
|
-
const getSeverity = (duration, percentage) => {
|
|
371
|
-
if (duration > 200) return {
|
|
372
|
-
color: colors.red,
|
|
373
|
-
type: "duration"
|
|
374
|
-
};
|
|
375
|
-
if (percentage > 30) return {
|
|
376
|
-
color: colors.red,
|
|
377
|
-
type: "percentage"
|
|
378
|
-
};
|
|
379
|
-
if (duration > 50) return {
|
|
380
|
-
color: colors.yellow,
|
|
381
|
-
type: "duration"
|
|
382
|
-
};
|
|
383
|
-
if (percentage > 10) return {
|
|
384
|
-
color: colors.yellow,
|
|
385
|
-
type: "percentage"
|
|
386
|
-
};
|
|
387
|
-
};
|
|
388
|
-
var Logger = class {
|
|
389
|
-
events = [];
|
|
390
|
-
end(result) {
|
|
391
|
-
let event;
|
|
392
|
-
let events = this.events;
|
|
393
|
-
for (const index of result.position) {
|
|
394
|
-
event = events[index];
|
|
395
|
-
if (event?.events) events = event.events;
|
|
396
|
-
}
|
|
397
|
-
if (event && !event.end) event.end = performance.mark(idEnd(event.id));
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* Recursively end all unended events in the event tree.
|
|
401
|
-
* This ensures all events have end marks before measuring.
|
|
402
|
-
*/
|
|
403
|
-
endAllEvents(events) {
|
|
404
|
-
for (const event of events) {
|
|
405
|
-
if (!event.end) event.end = performance.mark(idEnd(event.id));
|
|
406
|
-
if (event.events.length > 0) this.endAllEvents(event.events);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
report(print = true) {
|
|
410
|
-
const firstEvent = this.events[0];
|
|
411
|
-
if (!firstEvent) return;
|
|
412
|
-
this.endAllEvents(this.events);
|
|
413
|
-
const lastEvent = this.events[this.events.length - 1];
|
|
414
|
-
const name = "root";
|
|
415
|
-
const id = nameToId(name);
|
|
416
|
-
try {
|
|
417
|
-
const measure = performance.measure(idLength(id), idStart(firstEvent.id), idEnd(lastEvent.id));
|
|
418
|
-
if (print) this.reportEvent({
|
|
419
|
-
end: lastEvent.end,
|
|
420
|
-
events: this.events,
|
|
421
|
-
id,
|
|
422
|
-
indent: 0,
|
|
423
|
-
measure,
|
|
424
|
-
name,
|
|
425
|
-
start: firstEvent.start
|
|
426
|
-
});
|
|
427
|
-
return measure;
|
|
428
|
-
} catch {
|
|
429
|
-
return;
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
reportEvent({ indent, ...parent }) {
|
|
433
|
-
const color = !indent ? colors.cyan : colors.gray;
|
|
434
|
-
const lastIndex = parent.events.length - 1;
|
|
435
|
-
parent.events.forEach((event, index) => {
|
|
436
|
-
try {
|
|
437
|
-
const measure = performance.measure(idLength(event.id), idStart(event.id), idEnd(event.id));
|
|
438
|
-
const duration = Math.ceil(measure.duration * 100) / 100;
|
|
439
|
-
const percentage = Math.ceil(measure.duration / parent.measure.duration * 100 * 100) / 100;
|
|
440
|
-
const severity = indent ? getSeverity(duration, percentage) : void 0;
|
|
441
|
-
let durationLabel = `${duration.toFixed(2).padStart(8)}ms`;
|
|
442
|
-
if (severity?.type === "duration") durationLabel = severity.color(durationLabel);
|
|
443
|
-
const branch = index === lastIndex ? "└─ " : "├─ ";
|
|
444
|
-
const prefix = !indent ? "" : "│ ".repeat(indent - 1) + branch;
|
|
445
|
-
const maxLength = 38 - prefix.length;
|
|
446
|
-
const percentageBranch = !indent ? "" : "↳ ";
|
|
447
|
-
let percentageLabel = `${indent ? " ".repeat(indent - 1) + percentageBranch : ""}${percentage.toFixed(2)}%`;
|
|
448
|
-
if (severity?.type === "percentage") percentageLabel = severity.color(percentageLabel);
|
|
449
|
-
const jobPrefix = colors.gray("[root] ");
|
|
450
|
-
console.log(`${jobPrefix}${colors.gray(prefix)}${color(`${event.name.padEnd(maxLength)} ${durationLabel} (${percentageLabel})`)}`);
|
|
451
|
-
this.reportEvent({
|
|
452
|
-
...event,
|
|
453
|
-
indent: indent + 1,
|
|
454
|
-
measure
|
|
455
|
-
});
|
|
456
|
-
} catch {}
|
|
457
|
-
});
|
|
458
|
-
}
|
|
459
|
-
start(id) {
|
|
460
|
-
return performance.mark(idStart(id));
|
|
461
|
-
}
|
|
462
|
-
storeEvent({ result, ...event }) {
|
|
463
|
-
const lastEventIndex = event.events.length - 1;
|
|
464
|
-
const lastEvent = event.events[lastEventIndex];
|
|
465
|
-
if (lastEvent && !lastEvent.end) {
|
|
466
|
-
result.position = [...result.position, lastEventIndex];
|
|
467
|
-
this.storeEvent({
|
|
468
|
-
...event,
|
|
469
|
-
events: lastEvent.events,
|
|
470
|
-
result
|
|
471
|
-
});
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
const length = event.events.push({
|
|
475
|
-
...event,
|
|
476
|
-
events: []
|
|
477
|
-
});
|
|
478
|
-
result.position = [...result.position, length - 1];
|
|
479
|
-
}
|
|
480
|
-
timeEvent(name) {
|
|
481
|
-
const id = nameToId(name);
|
|
482
|
-
const start = this.start(id);
|
|
483
|
-
const event = {
|
|
484
|
-
events: this.events,
|
|
485
|
-
id,
|
|
486
|
-
name,
|
|
487
|
-
start
|
|
488
|
-
};
|
|
489
|
-
const result = { position: [] };
|
|
490
|
-
this.storeEvent({
|
|
491
|
-
...event,
|
|
492
|
-
result
|
|
493
|
-
});
|
|
494
|
-
return {
|
|
495
|
-
mark: start,
|
|
496
|
-
timeEnd: () => this.end(result)
|
|
497
|
-
};
|
|
498
|
-
}
|
|
499
|
-
};
|
|
500
|
-
|
|
501
365
|
//#endregion
|
|
502
366
|
//#region src/generate.ts
|
|
503
367
|
/**
|
|
@@ -585,5 +449,5 @@ colors.enabled = colorSupport().hasBasic;
|
|
|
585
449
|
const defineConfig = async (config) => typeof config === "function" ? await config() : config;
|
|
586
450
|
|
|
587
451
|
//#endregion
|
|
588
|
-
export {
|
|
589
|
-
//# sourceMappingURL=src-
|
|
452
|
+
export { createClient as i, defineConfig as n, utils as r, Logger$1 as t };
|
|
453
|
+
//# sourceMappingURL=src-C9rj3EgV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-C9rj3EgV.mjs","names":["path","path","result: Pick<\n Partial<Input>,\n | 'api_key'\n | 'branch'\n | 'commit_sha'\n | 'organization'\n | 'project'\n | 'registry'\n | 'tags'\n | 'version'\n > &\n Pick<Input, 'path'>","path","queryParams: Array<string>","lines: Array<string>","createClient","watches: ReadonlyArray<WatchValues>","context: Context | undefined","data","lines: Array<string>","configs: Configs | undefined","result","pCreateClient"],"sources":["../src/config/engine.ts","../src/ir/intents.ts","../src/generate/output.ts","../src/openApi/shared/utils/patch.ts","../src/createClient.ts","../src/utils/cli.ts","../src/generate.ts","../src/utils/exports.ts","../src/index.ts"],"sourcesContent":["import { ConfigError } from '~/error';\n\nexport const checkNodeVersion = () => {\n if (typeof Bun !== 'undefined') {\n const [major] = Bun.version.split('.').map(Number);\n if (major! < 1) {\n throw new ConfigError(\n `Unsupported Bun version ${Bun.version}. Please use Bun 1.0.0 or newer.`,\n );\n }\n } else if (typeof process !== 'undefined' && process.versions?.node) {\n const [major] = process.versions.node.split('.').map(Number);\n if (major! < 20) {\n throw new ConfigError(\n `Unsupported Node version ${process.versions.node}. Please use Node 20 or newer.`,\n );\n }\n }\n};\n","import type { MaybePromise } from '@hey-api/types';\n\nimport type { CodeSampleObject } from '~/openApi/shared/types';\n\nimport type { IR } from './types';\n\nexport interface ExampleIntent {\n run(ctx: IntentContext): MaybePromise<void>;\n}\n\nexport class IntentContext<Spec extends Record<string, any> = any> {\n private spec: Spec;\n\n constructor(spec: Spec) {\n this.spec = spec;\n }\n\n private getOperation(\n path: string,\n method: string,\n ): Record<string, any> | undefined {\n const paths = (this.spec as any).paths;\n if (!paths) return;\n return paths[path]?.[method];\n }\n\n setExample(operation: IR.OperationObject, example: CodeSampleObject): void {\n const source = this.getOperation(operation.path, operation.method);\n if (!source) return;\n source['x-codeSamples'] ||= [];\n source['x-codeSamples'].push(example);\n }\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport type { Context } from '~/ir/context';\nimport { IntentContext } from '~/ir/intents';\nimport { getClientPlugin } from '~/plugins/@hey-api/client-core/utils';\n\nimport { generateClientBundle } from './client';\n\nexport const generateOutput = async ({ context }: { context: Context }) => {\n const outputPath = path.resolve(context.config.output.path);\n\n if (context.config.output.clean) {\n if (fs.existsSync(outputPath)) {\n fs.rmSync(outputPath, { force: true, recursive: true });\n }\n }\n\n const client = getClientPlugin(context.config);\n if (\n 'bundle' in client.config &&\n client.config.bundle &&\n !context.config.dryRun\n ) {\n // not proud of this one\n // @ts-expect-error\n context.config._FRAGILE_CLIENT_BUNDLE_RENAMED = generateClientBundle({\n meta: {\n importFileExtension: context.config.output.importFileExtension,\n },\n outputPath,\n // @ts-expect-error\n plugin: client,\n project: context.gen,\n });\n }\n\n for (const plugin of context.registerPlugins()) {\n await plugin.run();\n }\n\n context.gen.plan();\n\n const ctx = new IntentContext(context.spec);\n for (const intent of context.intents) {\n await intent.run(ctx);\n }\n\n for (const file of context.gen.render()) {\n const filePath = path.resolve(outputPath, file.path);\n const dir = path.dirname(filePath);\n if (!context.config.dryRun) {\n fs.mkdirSync(dir, { recursive: true });\n fs.writeFileSync(filePath, file.content, { encoding: 'utf8' });\n }\n }\n\n const { source } = context.config.output;\n if (source.enabled) {\n const sourcePath =\n source.path === null ? undefined : path.resolve(outputPath, source.path);\n if (!context.config.dryRun && sourcePath && sourcePath !== outputPath) {\n fs.mkdirSync(sourcePath, { recursive: true });\n }\n const serialized = await source.serialize(context.spec);\n // TODO: handle yaml (convert before writing)\n if (!context.config.dryRun && sourcePath) {\n fs.writeFileSync(\n path.resolve(sourcePath, `${source.fileName}.${source.extension}`),\n serialized,\n { encoding: 'utf8' },\n );\n }\n if (source.callback) {\n await source.callback(serialized);\n }\n }\n};\n","import type { OpenApi } from '~/openApi/types';\n\nimport type { Patch } from '../../../types/parser';\n\nexport const patchOpenApiSpec = ({\n patchOptions,\n spec: _spec,\n}: {\n patchOptions: Patch | undefined;\n spec: unknown;\n}) => {\n if (!patchOptions) {\n return;\n }\n\n const spec = _spec as OpenApi.V2_0_X | OpenApi.V3_0_X | OpenApi.V3_1_X;\n\n if ('swagger' in spec) {\n if (patchOptions.version && spec.swagger) {\n spec.swagger = (\n typeof patchOptions.version === 'string'\n ? patchOptions.version\n : patchOptions.version(spec.swagger)\n ) as typeof spec.swagger;\n }\n\n if (patchOptions.meta && spec.info) {\n patchOptions.meta(spec.info);\n }\n\n if (patchOptions.schemas && spec.definitions) {\n for (const key in patchOptions.schemas) {\n const schema = spec.definitions[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.schemas[key]!;\n patchFn(schema);\n }\n }\n\n if (patchOptions.operations && spec.paths) {\n for (const key in patchOptions.operations) {\n const [method, path] = key.split(' ');\n if (!method || !path) continue;\n\n const pathItem = spec.paths[path as keyof typeof spec.paths];\n if (!pathItem) continue;\n\n const operation =\n pathItem[method.toLocaleLowerCase() as keyof typeof pathItem] ||\n pathItem[method.toLocaleUpperCase() as keyof typeof pathItem];\n if (!operation || typeof operation !== 'object') continue;\n\n const patchFn = patchOptions.operations[key]!;\n patchFn(operation as any);\n }\n }\n return;\n }\n\n if (patchOptions.version && spec.openapi) {\n spec.openapi = (\n typeof patchOptions.version === 'string'\n ? patchOptions.version\n : patchOptions.version(spec.openapi)\n ) as typeof spec.openapi;\n }\n\n if (patchOptions.meta && spec.info) {\n patchOptions.meta(spec.info);\n }\n\n if (spec.components) {\n if (patchOptions.schemas && spec.components.schemas) {\n for (const key in patchOptions.schemas) {\n const schema = spec.components.schemas[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.schemas[key]!;\n patchFn(schema as Parameters<typeof patchFn>[0]);\n }\n }\n\n if (patchOptions.parameters && spec.components.parameters) {\n for (const key in patchOptions.parameters) {\n const schema = spec.components.parameters[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.parameters[key]!;\n patchFn(schema);\n }\n }\n\n if (patchOptions.requestBodies && spec.components.requestBodies) {\n for (const key in patchOptions.requestBodies) {\n const schema = spec.components.requestBodies[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.requestBodies[key]!;\n patchFn(schema);\n }\n }\n\n if (patchOptions.responses && spec.components.responses) {\n for (const key in patchOptions.responses) {\n const schema = spec.components.responses[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.responses[key]!;\n patchFn(schema);\n }\n }\n }\n\n if (patchOptions.operations && spec.paths) {\n for (const key in patchOptions.operations) {\n const [method, path] = key.split(' ');\n if (!method || !path) continue;\n\n const pathItem = spec.paths[path as keyof typeof spec.paths];\n if (!pathItem) continue;\n\n const operation =\n pathItem[method.toLocaleLowerCase() as keyof typeof pathItem] ||\n pathItem[method.toLocaleUpperCase() as keyof typeof pathItem];\n if (!operation || typeof operation !== 'object') continue;\n\n const patchFn = patchOptions.operations[key]!;\n patchFn(operation as any);\n }\n }\n};\n","import path from 'node:path';\n\nimport type { Logger } from '@hey-api/codegen-core';\nimport { $RefParser } from '@hey-api/json-schema-ref-parser';\nimport colors from 'ansi-colors';\n\nimport { postprocessOutput } from '~/config/output';\nimport type { Config } from '~/config/types';\nimport { generateOutput } from '~/generate/output';\nimport { getSpec } from '~/getSpec';\nimport type { Context } from '~/ir/context';\nimport { parseOpenApiSpec } from '~/openApi';\nimport { buildGraph } from '~/openApi/shared/utils/graph';\nimport { patchOpenApiSpec } from '~/openApi/shared/utils/patch';\nimport type { Input } from '~/types/input';\nimport type { WatchValues } from '~/types/types';\n\nexport const compileInputPath = (input: Omit<Input, 'watch'>) => {\n const result: Pick<\n Partial<Input>,\n | 'api_key'\n | 'branch'\n | 'commit_sha'\n | 'organization'\n | 'project'\n | 'registry'\n | 'tags'\n | 'version'\n > &\n Pick<Input, 'path'> = {\n ...input,\n path: '',\n };\n\n if (\n input.path &&\n (typeof input.path !== 'string' || input.registry !== 'hey-api')\n ) {\n result.path = input.path;\n return result;\n }\n\n const [basePath, baseQuery] = input.path.split('?');\n const queryParts = (baseQuery || '').split('&');\n const queryPath = queryParts.map((part) => part.split('='));\n\n let path = basePath || '';\n if (path.endsWith('/')) {\n path = path.slice(0, path.length - 1);\n }\n\n const [, pathUrl] = path.split('://');\n const [baseUrl, organization, project] = (pathUrl || '').split('/');\n result.organization = organization || input.organization;\n result.project = project || input.project;\n\n const queryParams: Array<string> = [];\n\n const kApiKey = 'api_key';\n result.api_key =\n queryPath.find(([key]) => key === kApiKey)?.[1] ||\n input.api_key ||\n process.env.HEY_API_TOKEN;\n if (result.api_key) {\n queryParams.push(`${kApiKey}=${result.api_key}`);\n }\n\n const kBranch = 'branch';\n result.branch =\n queryPath.find(([key]) => key === kBranch)?.[1] || input.branch;\n if (result.branch) {\n queryParams.push(`${kBranch}=${result.branch}`);\n }\n\n const kCommitSha = 'commit_sha';\n result.commit_sha =\n queryPath.find(([key]) => key === kCommitSha)?.[1] || input.commit_sha;\n if (result.commit_sha) {\n queryParams.push(`${kCommitSha}=${result.commit_sha}`);\n }\n\n const kTags = 'tags';\n result.tags =\n queryPath.find(([key]) => key === kTags)?.[1]?.split(',') || input.tags;\n if (result.tags?.length) {\n queryParams.push(`${kTags}=${result.tags.join(',')}`);\n }\n\n const kVersion = 'version';\n result.version =\n queryPath.find(([key]) => key === kVersion)?.[1] || input.version;\n if (result.version) {\n queryParams.push(`${kVersion}=${result.version}`);\n }\n\n if (!result.organization) {\n throw new Error(\n 'missing organization - from which Hey API Platform organization do you want to generate your output?',\n );\n }\n\n if (!result.project) {\n throw new Error(\n 'missing project - from which Hey API Platform project do you want to generate your output?',\n );\n }\n\n const query = queryParams.join('&');\n const platformUrl = baseUrl || 'get.heyapi.dev';\n const isLocalhost = platformUrl.startsWith('localhost');\n const platformUrlWithProtocol = [\n isLocalhost ? 'http' : 'https',\n platformUrl,\n ].join('://');\n const compiledPath = isLocalhost\n ? [\n platformUrlWithProtocol,\n 'v1',\n 'get',\n result.organization,\n result.project,\n ].join('/')\n : [platformUrlWithProtocol, result.organization, result.project].join('/');\n result.path = query ? `${compiledPath}?${query}` : compiledPath;\n\n return result;\n};\n\nconst logInputPaths = (\n inputPaths: ReadonlyArray<ReturnType<typeof compileInputPath>>,\n jobIndex: number,\n) => {\n const lines: Array<string> = [];\n\n const jobPrefix = colors.gray(`[Job ${jobIndex + 1}] `);\n const count = inputPaths.length;\n const baseString = colors.cyan(\n `Generating from ${count} ${count === 1 ? 'input' : 'inputs'}:`,\n );\n lines.push(`${jobPrefix}⏳ ${baseString}`);\n\n inputPaths.forEach((inputPath, index) => {\n const itemPrefixStr = ` [${index + 1}] `;\n const itemPrefix = colors.cyan(itemPrefixStr);\n const detailIndent = ' '.repeat(itemPrefixStr.length);\n\n if (typeof inputPath.path !== 'string') {\n lines.push(`${jobPrefix}${itemPrefix}raw OpenAPI specification`);\n return;\n }\n\n switch (inputPath.registry) {\n case 'hey-api': {\n const baseInput = [inputPath.organization, inputPath.project]\n .filter(Boolean)\n .join('/');\n lines.push(`${jobPrefix}${itemPrefix}${baseInput}`);\n if (inputPath.branch) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('branch:')} ${colors.green(\n inputPath.branch,\n )}`,\n );\n }\n if (inputPath.commit_sha) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('commit:')} ${colors.green(\n inputPath.commit_sha,\n )}`,\n );\n }\n if (inputPath.tags?.length) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('tags:')} ${colors.green(\n inputPath.tags.join(', '),\n )}`,\n );\n }\n if (inputPath.version) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('version:')} ${colors.green(\n inputPath.version,\n )}`,\n );\n }\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('registry:')} ${colors.green('Hey API')}`,\n );\n break;\n }\n case 'readme': {\n const baseInput = [inputPath.organization, inputPath.project]\n .filter(Boolean)\n .join('/');\n if (!baseInput) {\n lines.push(`${jobPrefix}${itemPrefix}${inputPath.path}`);\n } else {\n lines.push(`${jobPrefix}${itemPrefix}${baseInput}`);\n }\n // @ts-expect-error\n if (inputPath.uuid) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('uuid:')} ${colors.green(\n // @ts-expect-error\n inputPath.uuid,\n )}`,\n );\n }\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('registry:')} ${colors.green('ReadMe')}`,\n );\n break;\n }\n case 'scalar': {\n const baseInput = [inputPath.organization, inputPath.project]\n .filter(Boolean)\n .join('/');\n lines.push(`${jobPrefix}${itemPrefix}${baseInput}`);\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('registry:')} ${colors.green('Scalar')}`,\n );\n break;\n }\n default:\n lines.push(`${jobPrefix}${itemPrefix}${inputPath.path}`);\n break;\n }\n });\n\n for (const line of lines) {\n console.log(line);\n }\n};\n\nexport const createClient = async ({\n config,\n dependencies,\n jobIndex,\n logger,\n watches: _watches,\n}: {\n config: Config;\n dependencies: Record<string, string>;\n jobIndex: number;\n logger: Logger;\n /**\n * Always undefined on the first run, defined on subsequent runs.\n */\n watches?: ReadonlyArray<WatchValues>;\n}): Promise<Context | undefined> => {\n const watches: ReadonlyArray<WatchValues> =\n _watches ||\n Array.from({ length: config.input.length }, () => ({\n headers: new Headers(),\n }));\n\n const inputPaths = config.input.map((input) => compileInputPath(input));\n\n // on first run, print the message as soon as possible\n if (config.logs.level !== 'silent' && !_watches) {\n logInputPaths(inputPaths, jobIndex);\n }\n\n const getSpecData = async (input: Input, index: number) => {\n const eventSpec = logger.timeEvent('spec');\n const { arrayBuffer, error, resolvedInput, response } = await getSpec({\n fetchOptions: input.fetch,\n inputPath: inputPaths[index]!.path,\n timeout: input.watch.timeout,\n watch: watches[index]!,\n });\n eventSpec.timeEnd();\n\n // throw on first run if there's an error to preserve user experience\n // if in watch mode, subsequent errors won't throw to gracefully handle\n // cases where server might be reloading\n if (error && !_watches) {\n throw new Error(\n `Request failed with status ${response.status}: ${response.statusText}`,\n );\n }\n\n return { arrayBuffer, resolvedInput };\n };\n const specData = (\n await Promise.all(\n config.input.map((input, index) => getSpecData(input, index)),\n )\n ).filter((data) => data.arrayBuffer || data.resolvedInput);\n\n let context: Context | undefined;\n\n if (specData.length) {\n const refParser = new $RefParser();\n const data =\n specData.length > 1\n ? await refParser.bundleMany({\n arrayBuffer: specData.map((data) => data.arrayBuffer!),\n pathOrUrlOrSchemas: [],\n resolvedInputs: specData.map((data) => data.resolvedInput!),\n })\n : await refParser.bundle({\n arrayBuffer: specData[0]!.arrayBuffer,\n pathOrUrlOrSchema: undefined,\n resolvedInput: specData[0]!.resolvedInput,\n });\n\n // on subsequent runs in watch mode, print the message only if we know we're\n // generating the output\n if (config.logs.level !== 'silent' && _watches) {\n console.clear();\n logInputPaths(inputPaths, jobIndex);\n }\n\n const eventInputPatch = logger.timeEvent('input.patch');\n patchOpenApiSpec({ patchOptions: config.parser.patch, spec: data });\n eventInputPatch.timeEnd();\n\n const eventParser = logger.timeEvent('parser');\n context = parseOpenApiSpec({ config, dependencies, logger, spec: data });\n context.graph = buildGraph(context.ir, logger).graph;\n eventParser.timeEnd();\n\n const eventGenerator = logger.timeEvent('generator');\n await generateOutput({ context });\n eventGenerator.timeEnd();\n\n const eventPostprocess = logger.timeEvent('postprocess');\n if (!config.dryRun) {\n const jobPrefix = colors.gray(`[Job ${jobIndex + 1}] `);\n postprocessOutput(config.output, jobPrefix);\n\n if (config.logs.level !== 'silent') {\n const outputPath = process.env.INIT_CWD\n ? `./${path.relative(process.env.INIT_CWD, config.output.path)}`\n : config.output.path;\n console.log(\n `${jobPrefix}${colors.green('✅ Done!')} Your output is in ${colors.cyanBright(outputPath)}`,\n );\n }\n }\n eventPostprocess.timeEnd();\n }\n\n const watchedInput = config.input.find(\n (input, index) =>\n input.watch.enabled && typeof inputPaths[index]!.path === 'string',\n );\n\n if (watchedInput) {\n setTimeout(() => {\n createClient({\n config,\n dependencies,\n jobIndex,\n logger,\n watches,\n });\n }, watchedInput.watch.interval);\n }\n\n return context;\n};\n","import colors from 'ansi-colors';\n\nimport { loadPackageJson } from '~/generate/tsConfig';\n\nconst textAscii = `\n888 | e 888~-_ 888\n888___| e88~~8e Y88b / d8b 888 \\\\ 888\n888 | d888 88b Y888/ /Y88b 888 | 888\n888 | 8888__888 Y8/ / Y88b 888 / 888\n888 | Y888 , Y /____Y88b 888_-~ 888\n888 | \"88___/ / / Y88b 888 888\n _/\n`;\n\nconst asciiToLines = (\n ascii: string,\n options?: {\n padding?: number;\n },\n) => {\n const lines: Array<string> = [];\n const padding = Array.from<string>({ length: options?.padding ?? 0 }).fill(\n '',\n );\n lines.push(...padding);\n let maxLineLength = 0;\n let line = '';\n for (const char of ascii) {\n if (char === '\\n') {\n if (line) {\n lines.push(line);\n maxLineLength = Math.max(maxLineLength, line.length);\n line = '';\n }\n } else {\n line += char;\n }\n }\n lines.push(...padding);\n return { lines, maxLineLength };\n};\n\n// TODO: show ascii logo only in `--help` and `--version` commands\nexport function printCliIntro(showLogo: boolean = false): void {\n const packageJson = loadPackageJson();\n if (showLogo) {\n const text = asciiToLines(textAscii, { padding: 1 });\n for (const line of text.lines) {\n console.log(colors.cyan(line));\n }\n }\n console.log(colors.gray(`${packageJson.name} v${packageJson.version}`));\n console.log('');\n}\n","import { Logger } from '@hey-api/codegen-core';\nimport type { LazyOrAsync, MaybeArray } from '@hey-api/types';\n\nimport { checkNodeVersion } from '~/config/engine';\nimport type { Configs } from '~/config/init';\nimport { initConfigs } from '~/config/init';\nimport { getLogs } from '~/config/logs';\nimport type { UserConfig } from '~/config/types';\nimport { createClient as pCreateClient } from '~/createClient';\nimport {\n ConfigValidationError,\n JobError,\n logCrashReport,\n openGitHubIssueWithCrashReport,\n printCrashReport,\n shouldReportCrash,\n} from '~/error';\nimport type { Context } from '~/ir/context';\nimport { printCliIntro } from '~/utils/cli';\n\n/**\n * Generate a client from the provided configuration.\n *\n * @param userConfig User provided {@link UserConfig} configuration(s).\n */\nexport const createClient = async (\n userConfig?: LazyOrAsync<MaybeArray<UserConfig>>,\n logger = new Logger(),\n): Promise<ReadonlyArray<Context>> => {\n const resolvedConfig =\n typeof userConfig === 'function' ? await userConfig() : userConfig;\n const userConfigs = resolvedConfig\n ? resolvedConfig instanceof Array\n ? resolvedConfig\n : [resolvedConfig]\n : [];\n\n let rawLogs = userConfigs.find(\n (config) => getLogs(config).level !== 'silent',\n )?.logs;\n if (typeof rawLogs === 'string') {\n rawLogs = getLogs({ logs: rawLogs });\n }\n\n let configs: Configs | undefined;\n\n try {\n checkNodeVersion();\n\n const eventCreateClient = logger.timeEvent('createClient');\n\n const eventConfig = logger.timeEvent('config');\n configs = await initConfigs({ logger, userConfigs });\n const printIntro = configs.results.some(\n (result) => result.config.logs.level !== 'silent',\n );\n if (printIntro) {\n printCliIntro();\n }\n eventConfig.timeEnd();\n\n const allConfigErrors = configs.results.flatMap((result) =>\n result.errors.map((error) => ({ error, jobIndex: result.jobIndex })),\n );\n if (allConfigErrors.length) {\n throw new ConfigValidationError(allConfigErrors);\n }\n\n const clients = await Promise.all(\n configs.results.map(async (result) => {\n try {\n return await pCreateClient({\n config: result.config,\n dependencies: configs!.dependencies,\n jobIndex: result.jobIndex,\n logger,\n });\n } catch (error) {\n throw new JobError('', {\n error,\n jobIndex: result.jobIndex,\n });\n }\n }),\n );\n const result = clients.filter((client) =>\n Boolean(client),\n ) as ReadonlyArray<Context>;\n\n eventCreateClient.timeEnd();\n\n const printLogs = configs.results.some(\n (result) => result.config.logs.level === 'debug',\n );\n logger.report(printLogs);\n\n return result;\n } catch (error) {\n const results = configs?.results ?? [];\n\n const logs =\n results.find((result) => result.config.logs.level !== 'silent')?.config\n .logs ??\n results[0]?.config.logs ??\n rawLogs;\n const dryRun =\n results.some((result) => result.config.dryRun) ??\n userConfigs.some((config) => config.dryRun) ??\n false;\n const logPath =\n logs?.file && !dryRun\n ? logCrashReport(error, logs.path ?? '')\n : undefined;\n if (!logs || logs.level !== 'silent') {\n printCrashReport({ error, logPath });\n const isInteractive =\n results.some((result) => result.config.interactive) ??\n userConfigs.some((config) => config.interactive) ??\n false;\n if (await shouldReportCrash({ error, isInteractive })) {\n await openGitHubIssueWithCrashReport(error);\n }\n }\n\n throw error;\n }\n};\n","import type { Casing } from './naming';\nimport { toCase } from './naming';\n\n/**\n * Utilities shared across the package.\n */\nexport const utils = {\n /**\n * @deprecated use `toCase` instead\n */\n stringCase({\n case: casing,\n stripLeadingSeparators,\n value,\n }: {\n readonly case: Casing | undefined;\n /**\n * If leading separators have a semantic meaning, we might not want to\n * remove them.\n */\n stripLeadingSeparators?: boolean;\n value: string;\n }) {\n return toCase(value, casing, { stripLeadingSeparators });\n },\n /**\n * Converts the given string to the specified casing.\n */\n toCase,\n};\n","// OVERRIDES\n// hard-coded here because build process doesn't pick up overrides from separate files\nimport '@hey-api/codegen-core';\n\ndeclare module '@hey-api/codegen-core' {\n interface ProjectRenderMeta {\n /**\n * If specified, this will be the file extension used when importing\n * other modules. By default, we don't add a file extension and let the\n * runtime resolve it.\n *\n * @default null\n */\n importFileExtension?: (string & {}) | null;\n }\n\n interface SymbolMeta {\n category?:\n | 'client'\n | 'external'\n | 'hook'\n | 'schema'\n | 'sdk'\n | 'transform'\n | 'type'\n | 'utility'\n | (string & {});\n /**\n * Path to the resource this symbol represents.\n */\n path?: ReadonlyArray<string | number>;\n /**\n * Name of the plugin that registered this symbol.\n */\n pluginName?: string;\n resource?:\n | 'client'\n | 'definition'\n | 'operation'\n | 'webhook'\n | (string & {});\n resourceId?: string;\n role?:\n | 'data'\n | 'error'\n | 'errors'\n | 'options'\n | 'response'\n | 'responses'\n | (string & {});\n /**\n * Tags associated with this symbol.\n */\n tags?: ReadonlyArray<string>;\n tool?:\n | 'angular'\n | 'arktype'\n | 'fastify'\n | 'json-schema'\n | 'sdk'\n | 'typescript'\n | 'valibot'\n | 'zod'\n | (string & {});\n variant?: 'container' | (string & {});\n }\n}\n// END OVERRIDES\n\nimport type { LazyOrAsync, MaybeArray } from '@hey-api/types';\nimport colors from 'ansi-colors';\n// @ts-expect-error\nimport colorSupport from 'color-support';\n\nimport type { UserConfig } from '~/config/types';\n\ncolors.enabled = colorSupport().hasBasic;\n\nexport { createClient } from '~/generate';\n\n/**\n * Type helper for openapi-ts.config.ts, returns {@link MaybeArray<UserConfig>} object(s)\n */\nexport const defineConfig = async <T extends MaybeArray<UserConfig>>(\n config: LazyOrAsync<T>,\n): Promise<T> => (typeof config === 'function' ? await config() : config);\n\nexport { Logger } from '@hey-api/codegen-core';\nexport { defaultPaginationKeywords } from '~/config/parser';\nexport { defaultPlugins } from '~/config/plugins';\nexport type { UserConfig } from '~/config/types';\nexport type { IR } from '~/ir/types';\nexport { OperationPath, OperationStrategy } from '~/openApi/shared/locations';\nexport type {\n OpenApi,\n OpenApiMetaObject,\n OpenApiOperationObject,\n OpenApiParameterObject,\n OpenApiRequestBodyObject,\n OpenApiResponseObject,\n OpenApiSchemaObject,\n} from '~/openApi/types';\nexport type { DefinePlugin, Plugin } from '~/plugins';\nexport type { AngularClient } from '~/plugins/@hey-api/client-angular';\nexport type { AxiosClient } from '~/plugins/@hey-api/client-axios';\nexport {\n clientDefaultConfig,\n clientDefaultMeta,\n} from '~/plugins/@hey-api/client-core/config';\nexport { clientPluginHandler } from '~/plugins/@hey-api/client-core/plugin';\nexport type { Client } from '~/plugins/@hey-api/client-core/types';\nexport type { FetchClient } from '~/plugins/@hey-api/client-fetch';\nexport type { NextClient } from '~/plugins/@hey-api/client-next';\nexport type { NuxtClient } from '~/plugins/@hey-api/client-nuxt';\nexport type { OfetchClient } from '~/plugins/@hey-api/client-ofetch';\nexport type { ExpressionTransformer } from '~/plugins/@hey-api/transformers/expressions';\nexport type { TypeTransformer } from '~/plugins/@hey-api/transformers/types';\nexport { definePluginConfig } from '~/plugins/shared/utils/config';\nexport * from '~/ts-dsl';\nexport { utils } from '~/utils/exports';\n"],"mappings":";;;;;;;;;;AAEA,MAAa,yBAAyB;AACpC,KAAI,OAAO,QAAQ,aAAa;EAC9B,MAAM,CAAC,SAAS,IAAI,QAAQ,MAA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() {
|
|
359
|
+
function printCliIntro(showLogo = false) {
|
|
360
360
|
const packageJson = require_openApi.loadPackageJson();
|
|
361
|
-
|
|
362
|
-
|
|
361
|
+
if (showLogo) {
|
|
362
|
+
const text = asciiToLines(textAscii, { padding: 1 });
|
|
363
|
+
for (const line of text.lines) console.log(ansi_colors.default.cyan(line));
|
|
364
|
+
}
|
|
363
365
|
console.log(ansi_colors.default.gray(`${packageJson.name} v${packageJson.version}`));
|
|
364
366
|
console.log("");
|
|
365
367
|
}
|
|
366
368
|
|
|
367
|
-
//#endregion
|
|
368
|
-
//#region src/utils/logger.ts
|
|
369
|
-
let loggerCounter = 0;
|
|
370
|
-
const nameToId = (name) => `${name}-${loggerCounter++}`;
|
|
371
|
-
const idEnd = (id) => `${id}-end`;
|
|
372
|
-
const idLength = (id) => `${id}-length`;
|
|
373
|
-
const idStart = (id) => `${id}-start`;
|
|
374
|
-
const getSeverity = (duration, percentage) => {
|
|
375
|
-
if (duration > 200) return {
|
|
376
|
-
color: ansi_colors.default.red,
|
|
377
|
-
type: "duration"
|
|
378
|
-
};
|
|
379
|
-
if (percentage > 30) return {
|
|
380
|
-
color: ansi_colors.default.red,
|
|
381
|
-
type: "percentage"
|
|
382
|
-
};
|
|
383
|
-
if (duration > 50) return {
|
|
384
|
-
color: ansi_colors.default.yellow,
|
|
385
|
-
type: "duration"
|
|
386
|
-
};
|
|
387
|
-
if (percentage > 10) return {
|
|
388
|
-
color: ansi_colors.default.yellow,
|
|
389
|
-
type: "percentage"
|
|
390
|
-
};
|
|
391
|
-
};
|
|
392
|
-
var Logger = class {
|
|
393
|
-
events = [];
|
|
394
|
-
end(result) {
|
|
395
|
-
let event;
|
|
396
|
-
let events = this.events;
|
|
397
|
-
for (const index of result.position) {
|
|
398
|
-
event = events[index];
|
|
399
|
-
if (event?.events) events = event.events;
|
|
400
|
-
}
|
|
401
|
-
if (event && !event.end) event.end = performance.mark(idEnd(event.id));
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Recursively end all unended events in the event tree.
|
|
405
|
-
* This ensures all events have end marks before measuring.
|
|
406
|
-
*/
|
|
407
|
-
endAllEvents(events) {
|
|
408
|
-
for (const event of events) {
|
|
409
|
-
if (!event.end) event.end = performance.mark(idEnd(event.id));
|
|
410
|
-
if (event.events.length > 0) this.endAllEvents(event.events);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
report(print = true) {
|
|
414
|
-
const firstEvent = this.events[0];
|
|
415
|
-
if (!firstEvent) return;
|
|
416
|
-
this.endAllEvents(this.events);
|
|
417
|
-
const lastEvent = this.events[this.events.length - 1];
|
|
418
|
-
const name = "root";
|
|
419
|
-
const id = nameToId(name);
|
|
420
|
-
try {
|
|
421
|
-
const measure = performance.measure(idLength(id), idStart(firstEvent.id), idEnd(lastEvent.id));
|
|
422
|
-
if (print) this.reportEvent({
|
|
423
|
-
end: lastEvent.end,
|
|
424
|
-
events: this.events,
|
|
425
|
-
id,
|
|
426
|
-
indent: 0,
|
|
427
|
-
measure,
|
|
428
|
-
name,
|
|
429
|
-
start: firstEvent.start
|
|
430
|
-
});
|
|
431
|
-
return measure;
|
|
432
|
-
} catch {
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
reportEvent({ indent, ...parent }) {
|
|
437
|
-
const color = !indent ? ansi_colors.default.cyan : ansi_colors.default.gray;
|
|
438
|
-
const lastIndex = parent.events.length - 1;
|
|
439
|
-
parent.events.forEach((event, index) => {
|
|
440
|
-
try {
|
|
441
|
-
const measure = performance.measure(idLength(event.id), idStart(event.id), idEnd(event.id));
|
|
442
|
-
const duration = Math.ceil(measure.duration * 100) / 100;
|
|
443
|
-
const percentage = Math.ceil(measure.duration / parent.measure.duration * 100 * 100) / 100;
|
|
444
|
-
const severity = indent ? getSeverity(duration, percentage) : void 0;
|
|
445
|
-
let durationLabel = `${duration.toFixed(2).padStart(8)}ms`;
|
|
446
|
-
if (severity?.type === "duration") durationLabel = severity.color(durationLabel);
|
|
447
|
-
const branch = index === lastIndex ? "└─ " : "├─ ";
|
|
448
|
-
const prefix = !indent ? "" : "│ ".repeat(indent - 1) + branch;
|
|
449
|
-
const maxLength = 38 - prefix.length;
|
|
450
|
-
const percentageBranch = !indent ? "" : "↳ ";
|
|
451
|
-
let percentageLabel = `${indent ? " ".repeat(indent - 1) + percentageBranch : ""}${percentage.toFixed(2)}%`;
|
|
452
|
-
if (severity?.type === "percentage") percentageLabel = severity.color(percentageLabel);
|
|
453
|
-
const jobPrefix = ansi_colors.default.gray("[root] ");
|
|
454
|
-
console.log(`${jobPrefix}${ansi_colors.default.gray(prefix)}${color(`${event.name.padEnd(maxLength)} ${durationLabel} (${percentageLabel})`)}`);
|
|
455
|
-
this.reportEvent({
|
|
456
|
-
...event,
|
|
457
|
-
indent: indent + 1,
|
|
458
|
-
measure
|
|
459
|
-
});
|
|
460
|
-
} catch {}
|
|
461
|
-
});
|
|
462
|
-
}
|
|
463
|
-
start(id) {
|
|
464
|
-
return performance.mark(idStart(id));
|
|
465
|
-
}
|
|
466
|
-
storeEvent({ result, ...event }) {
|
|
467
|
-
const lastEventIndex = event.events.length - 1;
|
|
468
|
-
const lastEvent = event.events[lastEventIndex];
|
|
469
|
-
if (lastEvent && !lastEvent.end) {
|
|
470
|
-
result.position = [...result.position, lastEventIndex];
|
|
471
|
-
this.storeEvent({
|
|
472
|
-
...event,
|
|
473
|
-
events: lastEvent.events,
|
|
474
|
-
result
|
|
475
|
-
});
|
|
476
|
-
return;
|
|
477
|
-
}
|
|
478
|
-
const length = event.events.push({
|
|
479
|
-
...event,
|
|
480
|
-
events: []
|
|
481
|
-
});
|
|
482
|
-
result.position = [...result.position, length - 1];
|
|
483
|
-
}
|
|
484
|
-
timeEvent(name) {
|
|
485
|
-
const id = nameToId(name);
|
|
486
|
-
const start = this.start(id);
|
|
487
|
-
const event = {
|
|
488
|
-
events: this.events,
|
|
489
|
-
id,
|
|
490
|
-
name,
|
|
491
|
-
start
|
|
492
|
-
};
|
|
493
|
-
const result = { position: [] };
|
|
494
|
-
this.storeEvent({
|
|
495
|
-
...event,
|
|
496
|
-
result
|
|
497
|
-
});
|
|
498
|
-
return {
|
|
499
|
-
mark: start,
|
|
500
|
-
timeEnd: () => this.end(result)
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
};
|
|
504
|
-
|
|
505
369
|
//#endregion
|
|
506
370
|
//#region src/generate.ts
|
|
507
371
|
/**
|
|
@@ -509,7 +373,7 @@ var Logger = class {
|
|
|
509
373
|
*
|
|
510
374
|
* @param userConfig User provided {@link UserConfig} configuration(s).
|
|
511
375
|
*/
|
|
512
|
-
const createClient = async (userConfig, logger = new Logger()) => {
|
|
376
|
+
const createClient = async (userConfig, logger = new _hey_api_codegen_core.Logger()) => {
|
|
513
377
|
const resolvedConfig = typeof userConfig === "function" ? await userConfig() : userConfig;
|
|
514
378
|
const userConfigs = resolvedConfig ? resolvedConfig instanceof Array ? resolvedConfig : [resolvedConfig] : [];
|
|
515
379
|
let rawLogs = userConfigs.find((config) => require_openApi.getLogs(config).level !== "silent")?.logs;
|
|
@@ -589,12 +453,6 @@ ansi_colors.default.enabled = (0, color_support.default)().hasBasic;
|
|
|
589
453
|
const defineConfig = async (config) => typeof config === "function" ? await config() : config;
|
|
590
454
|
|
|
591
455
|
//#endregion
|
|
592
|
-
Object.defineProperty(exports, 'Logger', {
|
|
593
|
-
enumerable: true,
|
|
594
|
-
get: function () {
|
|
595
|
-
return Logger;
|
|
596
|
-
}
|
|
597
|
-
});
|
|
598
456
|
Object.defineProperty(exports, 'createClient', {
|
|
599
457
|
enumerable: true,
|
|
600
458
|
get: function () {
|
|
@@ -613,4 +471,4 @@ Object.defineProperty(exports, 'utils', {
|
|
|
613
471
|
return utils;
|
|
614
472
|
}
|
|
615
473
|
});
|
|
616
|
-
//# sourceMappingURL=src-
|
|
474
|
+
//# sourceMappingURL=src-Dbxz7RgS.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-Dbxz7RgS.cjs","names":["ConfigError","path","path","fs","getClientPlugin","generateClientBundle","path","result: Pick<\n Partial<Input>,\n | 'api_key'\n | 'branch'\n | 'commit_sha'\n | 'organization'\n | 'project'\n | 'registry'\n | 'tags'\n | 'version'\n > &\n Pick<Input, 'path'>","path","queryParams: Array<string>","lines: Array<string>","colors","createClient","watches: ReadonlyArray<WatchValues>","getSpec","context: Context | undefined","$RefParser","data","parseOpenApiSpec","buildGraph","lines: Array<string>","loadPackageJson","colors","Logger","getLogs","configs: Configs | undefined","initConfigs","result","ConfigValidationError","pCreateClient","JobError","logCrashReport","shouldReportCrash","openGitHubIssueWithCrashReport","toCase"],"sources":["../src/config/engine.ts","../src/ir/intents.ts","../src/generate/output.ts","../src/openApi/shared/utils/patch.ts","../src/createClient.ts","../src/utils/cli.ts","../src/generate.ts","../src/utils/exports.ts","../src/index.ts"],"sourcesContent":["import { ConfigError } from '~/error';\n\nexport const checkNodeVersion = () => {\n if (typeof Bun !== 'undefined') {\n const [major] = Bun.version.split('.').map(Number);\n if (major! < 1) {\n throw new ConfigError(\n `Unsupported Bun version ${Bun.version}. Please use Bun 1.0.0 or newer.`,\n );\n }\n } else if (typeof process !== 'undefined' && process.versions?.node) {\n const [major] = process.versions.node.split('.').map(Number);\n if (major! < 20) {\n throw new ConfigError(\n `Unsupported Node version ${process.versions.node}. Please use Node 20 or newer.`,\n );\n }\n }\n};\n","import type { MaybePromise } from '@hey-api/types';\n\nimport type { CodeSampleObject } from '~/openApi/shared/types';\n\nimport type { IR } from './types';\n\nexport interface ExampleIntent {\n run(ctx: IntentContext): MaybePromise<void>;\n}\n\nexport class IntentContext<Spec extends Record<string, any> = any> {\n private spec: Spec;\n\n constructor(spec: Spec) {\n this.spec = spec;\n }\n\n private getOperation(\n path: string,\n method: string,\n ): Record<string, any> | undefined {\n const paths = (this.spec as any).paths;\n if (!paths) return;\n return paths[path]?.[method];\n }\n\n setExample(operation: IR.OperationObject, example: CodeSampleObject): void {\n const source = this.getOperation(operation.path, operation.method);\n if (!source) return;\n source['x-codeSamples'] ||= [];\n source['x-codeSamples'].push(example);\n }\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport type { Context } from '~/ir/context';\nimport { IntentContext } from '~/ir/intents';\nimport { getClientPlugin } from '~/plugins/@hey-api/client-core/utils';\n\nimport { generateClientBundle } from './client';\n\nexport const generateOutput = async ({ context }: { context: Context }) => {\n const outputPath = path.resolve(context.config.output.path);\n\n if (context.config.output.clean) {\n if (fs.existsSync(outputPath)) {\n fs.rmSync(outputPath, { force: true, recursive: true });\n }\n }\n\n const client = getClientPlugin(context.config);\n if (\n 'bundle' in client.config &&\n client.config.bundle &&\n !context.config.dryRun\n ) {\n // not proud of this one\n // @ts-expect-error\n context.config._FRAGILE_CLIENT_BUNDLE_RENAMED = generateClientBundle({\n meta: {\n importFileExtension: context.config.output.importFileExtension,\n },\n outputPath,\n // @ts-expect-error\n plugin: client,\n project: context.gen,\n });\n }\n\n for (const plugin of context.registerPlugins()) {\n await plugin.run();\n }\n\n context.gen.plan();\n\n const ctx = new IntentContext(context.spec);\n for (const intent of context.intents) {\n await intent.run(ctx);\n }\n\n for (const file of context.gen.render()) {\n const filePath = path.resolve(outputPath, file.path);\n const dir = path.dirname(filePath);\n if (!context.config.dryRun) {\n fs.mkdirSync(dir, { recursive: true });\n fs.writeFileSync(filePath, file.content, { encoding: 'utf8' });\n }\n }\n\n const { source } = context.config.output;\n if (source.enabled) {\n const sourcePath =\n source.path === null ? undefined : path.resolve(outputPath, source.path);\n if (!context.config.dryRun && sourcePath && sourcePath !== outputPath) {\n fs.mkdirSync(sourcePath, { recursive: true });\n }\n const serialized = await source.serialize(context.spec);\n // TODO: handle yaml (convert before writing)\n if (!context.config.dryRun && sourcePath) {\n fs.writeFileSync(\n path.resolve(sourcePath, `${source.fileName}.${source.extension}`),\n serialized,\n { encoding: 'utf8' },\n );\n }\n if (source.callback) {\n await source.callback(serialized);\n }\n }\n};\n","import type { OpenApi } from '~/openApi/types';\n\nimport type { Patch } from '../../../types/parser';\n\nexport const patchOpenApiSpec = ({\n patchOptions,\n spec: _spec,\n}: {\n patchOptions: Patch | undefined;\n spec: unknown;\n}) => {\n if (!patchOptions) {\n return;\n }\n\n const spec = _spec as OpenApi.V2_0_X | OpenApi.V3_0_X | OpenApi.V3_1_X;\n\n if ('swagger' in spec) {\n if (patchOptions.version && spec.swagger) {\n spec.swagger = (\n typeof patchOptions.version === 'string'\n ? patchOptions.version\n : patchOptions.version(spec.swagger)\n ) as typeof spec.swagger;\n }\n\n if (patchOptions.meta && spec.info) {\n patchOptions.meta(spec.info);\n }\n\n if (patchOptions.schemas && spec.definitions) {\n for (const key in patchOptions.schemas) {\n const schema = spec.definitions[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.schemas[key]!;\n patchFn(schema);\n }\n }\n\n if (patchOptions.operations && spec.paths) {\n for (const key in patchOptions.operations) {\n const [method, path] = key.split(' ');\n if (!method || !path) continue;\n\n const pathItem = spec.paths[path as keyof typeof spec.paths];\n if (!pathItem) continue;\n\n const operation =\n pathItem[method.toLocaleLowerCase() as keyof typeof pathItem] ||\n pathItem[method.toLocaleUpperCase() as keyof typeof pathItem];\n if (!operation || typeof operation !== 'object') continue;\n\n const patchFn = patchOptions.operations[key]!;\n patchFn(operation as any);\n }\n }\n return;\n }\n\n if (patchOptions.version && spec.openapi) {\n spec.openapi = (\n typeof patchOptions.version === 'string'\n ? patchOptions.version\n : patchOptions.version(spec.openapi)\n ) as typeof spec.openapi;\n }\n\n if (patchOptions.meta && spec.info) {\n patchOptions.meta(spec.info);\n }\n\n if (spec.components) {\n if (patchOptions.schemas && spec.components.schemas) {\n for (const key in patchOptions.schemas) {\n const schema = spec.components.schemas[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.schemas[key]!;\n patchFn(schema as Parameters<typeof patchFn>[0]);\n }\n }\n\n if (patchOptions.parameters && spec.components.parameters) {\n for (const key in patchOptions.parameters) {\n const schema = spec.components.parameters[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.parameters[key]!;\n patchFn(schema);\n }\n }\n\n if (patchOptions.requestBodies && spec.components.requestBodies) {\n for (const key in patchOptions.requestBodies) {\n const schema = spec.components.requestBodies[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.requestBodies[key]!;\n patchFn(schema);\n }\n }\n\n if (patchOptions.responses && spec.components.responses) {\n for (const key in patchOptions.responses) {\n const schema = spec.components.responses[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.responses[key]!;\n patchFn(schema);\n }\n }\n }\n\n if (patchOptions.operations && spec.paths) {\n for (const key in patchOptions.operations) {\n const [method, path] = key.split(' ');\n if (!method || !path) continue;\n\n const pathItem = spec.paths[path as keyof typeof spec.paths];\n if (!pathItem) continue;\n\n const operation =\n pathItem[method.toLocaleLowerCase() as keyof typeof pathItem] ||\n pathItem[method.toLocaleUpperCase() as keyof typeof pathItem];\n if (!operation || typeof operation !== 'object') continue;\n\n const patchFn = patchOptions.operations[key]!;\n patchFn(operation as any);\n }\n }\n};\n","import path from 'node:path';\n\nimport type { Logger } from '@hey-api/codegen-core';\nimport { $RefParser } from '@hey-api/json-schema-ref-parser';\nimport colors from 'ansi-colors';\n\nimport { postprocessOutput } from '~/config/output';\nimport type { Config } from '~/config/types';\nimport { generateOutput } from '~/generate/output';\nimport { getSpec } from '~/getSpec';\nimport type { Context } from '~/ir/context';\nimport { parseOpenApiSpec } from '~/openApi';\nimport { buildGraph } from '~/openApi/shared/utils/graph';\nimport { patchOpenApiSpec } from '~/openApi/shared/utils/patch';\nimport type { Input } from '~/types/input';\nimport type { WatchValues } from '~/types/types';\n\nexport const compileInputPath = (input: Omit<Input, 'watch'>) => {\n const result: Pick<\n Partial<Input>,\n | 'api_key'\n | 'branch'\n | 'commit_sha'\n | 'organization'\n | 'project'\n | 'registry'\n | 'tags'\n | 'version'\n > &\n Pick<Input, 'path'> = {\n ...input,\n path: '',\n };\n\n if (\n input.path &&\n (typeof input.path !== 'string' || input.registry !== 'hey-api')\n ) {\n result.path = input.path;\n return result;\n }\n\n const [basePath, baseQuery] = input.path.split('?');\n const queryParts = (baseQuery || '').split('&');\n const queryPath = queryParts.map((part) => part.split('='));\n\n let path = basePath || '';\n if (path.endsWith('/')) {\n path = path.slice(0, path.length - 1);\n }\n\n const [, pathUrl] = path.split('://');\n const [baseUrl, organization, project] = (pathUrl || '').split('/');\n result.organization = organization || input.organization;\n result.project = project || input.project;\n\n const queryParams: Array<string> = [];\n\n const kApiKey = 'api_key';\n result.api_key =\n queryPath.find(([key]) => key === kApiKey)?.[1] ||\n input.api_key ||\n process.env.HEY_API_TOKEN;\n if (result.api_key) {\n queryParams.push(`${kApiKey}=${result.api_key}`);\n }\n\n const kBranch = 'branch';\n result.branch =\n queryPath.find(([key]) => key === kBranch)?.[1] || input.branch;\n if (result.branch) {\n queryParams.push(`${kBranch}=${result.branch}`);\n }\n\n const kCommitSha = 'commit_sha';\n result.commit_sha =\n queryPath.find(([key]) => key === kCommitSha)?.[1] || input.commit_sha;\n if (result.commit_sha) {\n queryParams.push(`${kCommitSha}=${result.commit_sha}`);\n }\n\n const kTags = 'tags';\n result.tags =\n queryPath.find(([key]) => key === kTags)?.[1]?.split(',') || input.tags;\n if (result.tags?.length) {\n queryParams.push(`${kTags}=${result.tags.join(',')}`);\n }\n\n const kVersion = 'version';\n result.version =\n queryPath.find(([key]) => key === kVersion)?.[1] || input.version;\n if (result.version) {\n queryParams.push(`${kVersion}=${result.version}`);\n }\n\n if (!result.organization) {\n throw new Error(\n 'missing organization - from which Hey API Platform organization do you want to generate your output?',\n );\n }\n\n if (!result.project) {\n throw new Error(\n 'missing project - from which Hey API Platform project do you want to generate your output?',\n );\n }\n\n const query = queryParams.join('&');\n const platformUrl = baseUrl || 'get.heyapi.dev';\n const isLocalhost = platformUrl.startsWith('localhost');\n const platformUrlWithProtocol = [\n isLocalhost ? 'http' : 'https',\n platformUrl,\n ].join('://');\n const compiledPath = isLocalhost\n ? [\n platformUrlWithProtocol,\n 'v1',\n 'get',\n result.organization,\n result.project,\n ].join('/')\n : [platformUrlWithProtocol, result.organization, result.project].join('/');\n result.path = query ? `${compiledPath}?${query}` : compiledPath;\n\n return result;\n};\n\nconst logInputPaths = (\n inputPaths: ReadonlyArray<ReturnType<typeof compileInputPath>>,\n jobIndex: number,\n) => {\n const lines: Array<string> = [];\n\n const jobPrefix = colors.gray(`[Job ${jobIndex + 1}] `);\n const count = inputPaths.length;\n const baseString = colors.cyan(\n `Generating from ${count} ${count === 1 ? 'input' : 'inputs'}:`,\n );\n lines.push(`${jobPrefix}⏳ ${baseString}`);\n\n inputPaths.forEach((inputPath, index) => {\n const itemPrefixStr = ` [${index + 1}] `;\n const itemPrefix = colors.cyan(itemPrefixStr);\n const detailIndent = ' '.repeat(itemPrefixStr.length);\n\n if (typeof inputPath.path !== 'string') {\n lines.push(`${jobPrefix}${itemPrefix}raw OpenAPI specification`);\n return;\n }\n\n switch (inputPath.registry) {\n case 'hey-api': {\n const baseInput = [inputPath.organization, inputPath.project]\n .filter(Boolean)\n .join('/');\n lines.push(`${jobPrefix}${itemPrefix}${baseInput}`);\n if (inputPath.branch) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('branch:')} ${colors.green(\n inputPath.branch,\n )}`,\n );\n }\n if (inputPath.commit_sha) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('commit:')} ${colors.green(\n inputPath.commit_sha,\n )}`,\n );\n }\n if (inputPath.tags?.length) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('tags:')} ${colors.green(\n inputPath.tags.join(', '),\n )}`,\n );\n }\n if (inputPath.version) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('version:')} ${colors.green(\n inputPath.version,\n )}`,\n );\n }\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('registry:')} ${colors.green('Hey API')}`,\n );\n break;\n }\n case 'readme': {\n const baseInput = [inputPath.organization, inputPath.project]\n .filter(Boolean)\n .join('/');\n if (!baseInput) {\n lines.push(`${jobPrefix}${itemPrefix}${inputPath.path}`);\n } else {\n lines.push(`${jobPrefix}${itemPrefix}${baseInput}`);\n }\n // @ts-expect-error\n if (inputPath.uuid) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('uuid:')} ${colors.green(\n // @ts-expect-error\n inputPath.uuid,\n )}`,\n );\n }\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('registry:')} ${colors.green('ReadMe')}`,\n );\n break;\n }\n case 'scalar': {\n const baseInput = [inputPath.organization, inputPath.project]\n .filter(Boolean)\n .join('/');\n lines.push(`${jobPrefix}${itemPrefix}${baseInput}`);\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('registry:')} ${colors.green('Scalar')}`,\n );\n break;\n }\n default:\n lines.push(`${jobPrefix}${itemPrefix}${inputPath.path}`);\n break;\n }\n });\n\n for (const line of lines) {\n console.log(line);\n }\n};\n\nexport const createClient = async ({\n config,\n dependencies,\n jobIndex,\n logger,\n watches: _watches,\n}: {\n config: Config;\n dependencies: Record<string, string>;\n jobIndex: number;\n logger: Logger;\n /**\n * Always undefined on the first run, defined on subsequent runs.\n */\n watches?: ReadonlyArray<WatchValues>;\n}): Promise<Context | undefined> => {\n const watches: ReadonlyArray<WatchValues> =\n _watches ||\n Array.from({ length: config.input.length }, () => ({\n headers: new Headers(),\n }));\n\n const inputPaths = config.input.map((input) => compileInputPath(input));\n\n // on first run, print the message as soon as possible\n if (config.logs.level !== 'silent' && !_watches) {\n logInputPaths(inputPaths, jobIndex);\n }\n\n const getSpecData = async (input: Input, index: number) => {\n const eventSpec = logger.timeEvent('spec');\n const { arrayBuffer, error, resolvedInput, response } = await getSpec({\n fetchOptions: input.fetch,\n inputPath: inputPaths[index]!.path,\n timeout: input.watch.timeout,\n watch: watches[index]!,\n });\n eventSpec.timeEnd();\n\n // throw on first run if there's an error to preserve user experience\n // if in watch mode, subsequent errors won't throw to gracefully handle\n // cases where server might be reloading\n if (error && !_watches) {\n throw new Error(\n `Request failed with status ${response.status}: ${response.statusText}`,\n );\n }\n\n return { arrayBuffer, resolvedInput };\n };\n const specData = (\n await Promise.all(\n config.input.map((input, index) => getSpecData(input, index)),\n )\n ).filter((data) => data.arrayBuffer || data.resolvedInput);\n\n let context: Context | undefined;\n\n if (specData.length) {\n const refParser = new $RefParser();\n const data =\n specData.length > 1\n ? await refParser.bundleMany({\n arrayBuffer: specData.map((data) => data.arrayBuffer!),\n pathOrUrlOrSchemas: [],\n resolvedInputs: specData.map((data) => data.resolvedInput!),\n })\n : await refParser.bundle({\n arrayBuffer: specData[0]!.arrayBuffer,\n pathOrUrlOrSchema: undefined,\n resolvedInput: specData[0]!.resolvedInput,\n });\n\n // on subsequent runs in watch mode, print the message only if we know we're\n // generating the output\n if (config.logs.level !== 'silent' && _watches) {\n console.clear();\n logInputPaths(inputPaths, jobIndex);\n }\n\n const eventInputPatch = logger.timeEvent('input.patch');\n patchOpenApiSpec({ patchOptions: config.parser.patch, spec: data });\n eventInputPatch.timeEnd();\n\n const eventParser = logger.timeEvent('parser');\n context = parseOpenApiSpec({ config, dependencies, logger, spec: data });\n context.graph = buildGraph(context.ir, logger).graph;\n eventParser.timeEnd();\n\n const eventGenerator = logger.timeEvent('generator');\n await generateOutput({ context });\n eventGenerator.timeEnd();\n\n const eventPostprocess = logger.timeEvent('postprocess');\n if (!config.dryRun) {\n const jobPrefix = colors.gray(`[Job ${jobIndex + 1}] `);\n postprocessOutput(config.output, jobPrefix);\n\n if (config.logs.level !== 'silent') {\n const outputPath = process.env.INIT_CWD\n ? `./${path.relative(process.env.INIT_CWD, config.output.path)}`\n : config.output.path;\n console.log(\n `${jobPrefix}${colors.green('✅ Done!')} Your output is in ${colors.cyanBright(outputPath)}`,\n );\n }\n }\n eventPostprocess.timeEnd();\n }\n\n const watchedInput = config.input.find(\n (input, index) =>\n input.watch.enabled && typeof inputPaths[index]!.path === 'string',\n );\n\n if (watchedInput) {\n setTimeout(() => {\n createClient({\n config,\n dependencies,\n jobIndex,\n logger,\n watches,\n });\n }, watchedInput.watch.interval);\n }\n\n return context;\n};\n","import colors from 'ansi-colors';\n\nimport { loadPackageJson } from '~/generate/tsConfig';\n\nconst textAscii = `\n888 | e 888~-_ 888\n888___| e88~~8e Y88b / d8b 888 \\\\ 888\n888 | d888 88b Y888/ /Y88b 888 | 888\n888 | 8888__888 Y8/ / Y88b 888 / 888\n888 | Y888 , Y /____Y88b 888_-~ 888\n888 | \"88___/ / / Y88b 888 888\n _/\n`;\n\nconst asciiToLines = (\n ascii: string,\n options?: {\n padding?: number;\n },\n) => {\n const lines: Array<string> = [];\n const padding = Array.from<string>({ length: options?.padding ?? 0 }).fill(\n '',\n );\n lines.push(...padding);\n let maxLineLength = 0;\n let line = '';\n for (const char of ascii) {\n if (char === '\\n') {\n if (line) {\n lines.push(line);\n maxLineLength = Math.max(maxLineLength, line.length);\n line = '';\n }\n } else {\n line += char;\n }\n }\n lines.push(...padding);\n return { lines, maxLineLength };\n};\n\n// TODO: show ascii logo only in `--help` and `--version` commands\nexport function printCliIntro(showLogo: boolean = false): void {\n const packageJson = loadPackageJson();\n if (showLogo) {\n const text = asciiToLines(textAscii, { padding: 1 });\n for (const line of text.lines) {\n console.log(colors.cyan(line));\n }\n }\n console.log(colors.gray(`${packageJson.name} v${packageJson.version}`));\n console.log('');\n}\n","import { Logger } from '@hey-api/codegen-core';\nimport type { LazyOrAsync, MaybeArray } from '@hey-api/types';\n\nimport { checkNodeVersion } from '~/config/engine';\nimport type { Configs } from '~/config/init';\nimport { initConfigs } from '~/config/init';\nimport { getLogs } from '~/config/logs';\nimport type { UserConfig } from '~/config/types';\nimport { createClient as pCreateClient } from '~/createClient';\nimport {\n ConfigValidationError,\n JobError,\n logCrashReport,\n openGitHubIssueWithCrashReport,\n printCrashReport,\n shouldReportCrash,\n} from '~/error';\nimport type { Context } from '~/ir/context';\nimport { printCliIntro } from '~/utils/cli';\n\n/**\n * Generate a client from the provided configuration.\n *\n * @param userConfig User provided {@link UserConfig} configuration(s).\n */\nexport const createClient = async (\n userConfig?: LazyOrAsync<MaybeArray<UserConfig>>,\n logger = new Logger(),\n): Promise<ReadonlyArray<Context>> => {\n const resolvedConfig =\n typeof userConfig === 'function' ? await userConfig() : userConfig;\n const userConfigs = resolvedConfig\n ? resolvedConfig instanceof Array\n ? resolvedConfig\n : [resolvedConfig]\n : [];\n\n let rawLogs = userConfigs.find(\n (config) => getLogs(config).level !== 'silent',\n )?.logs;\n if (typeof rawLogs === 'string') {\n rawLogs = getLogs({ logs: rawLogs });\n }\n\n let configs: Configs | undefined;\n\n try {\n checkNodeVersion();\n\n const eventCreateClient = logger.timeEvent('createClient');\n\n const eventConfig = logger.timeEvent('config');\n configs = await initConfigs({ logger, userConfigs });\n const printIntro = configs.results.some(\n (result) => result.config.logs.level !== 'silent',\n );\n if (printIntro) {\n printCliIntro();\n }\n eventConfig.timeEnd();\n\n const allConfigErrors = configs.results.flatMap((result) =>\n result.errors.map((error) => ({ error, jobIndex: result.jobIndex })),\n );\n if (allConfigErrors.length) {\n throw new ConfigValidationError(allConfigErrors);\n }\n\n const clients = await Promise.all(\n configs.results.map(async (result) => {\n try {\n return await pCreateClient({\n config: result.config,\n dependencies: configs!.dependencies,\n jobIndex: result.jobIndex,\n logger,\n });\n } catch (error) {\n throw new JobError('', {\n error,\n jobIndex: result.jobIndex,\n });\n }\n }),\n );\n const result = clients.filter((client) =>\n Boolean(client),\n ) as ReadonlyArray<Context>;\n\n eventCreateClient.timeEnd();\n\n const printLogs = configs.results.some(\n (result) => result.config.logs.level === 'debug',\n );\n logger.report(printLogs);\n\n return result;\n } catch (error) {\n const results = configs?.results ?? [];\n\n const logs =\n results.find((result) => result.config.logs.level !== 'silent')?.config\n .logs ??\n results[0]?.config.logs ??\n rawLogs;\n const dryRun =\n results.some((result) => result.config.dryRun) ??\n userConfigs.some((config) => config.dryRun) ??\n false;\n const logPath =\n logs?.file && !dryRun\n ? logCrashReport(error, logs.path ?? '')\n : undefined;\n if (!logs || logs.level !== 'silent') {\n printCrashReport({ error, logPath });\n const isInteractive =\n results.some((result) => result.config.interactive) ??\n userConfigs.some((config) => config.interactive) ??\n false;\n if (await shouldReportCrash({ error, isInteractive })) {\n await openGitHubIssueWithCrashReport(error);\n }\n }\n\n throw error;\n }\n};\n","import type { Casing } from './naming';\nimport { toCase } from './naming';\n\n/**\n * Utilities shared across the package.\n */\nexport const utils = {\n /**\n * @deprecated use `toCase` instead\n */\n stringCase({\n case: casing,\n stripLeadingSeparators,\n value,\n }: {\n readonly case: Casing | undefined;\n /**\n * If leading separators have a semantic meaning, we might not want to\n * remove them.\n */\n stripLeadingSeparators?: boolean;\n value: string;\n }) {\n return toCase(value, casing, { stripLeadingSeparators });\n },\n /**\n * Converts the given string to the specified casing.\n */\n toCase,\n};\n","// OVERRIDES\n// hard-coded here because build process doesn't pick up overrides from separate files\nimport '@hey-api/codegen-core';\n\ndeclare module '@hey-api/codegen-core' {\n interface ProjectRenderMeta {\n /**\n * If specified, this will be the file extension used when importing\n * other modules. By default, we don't add a file extension and let the\n * runtime resolve it.\n *\n * @default null\n */\n importFileExtension?: (string & {}) | null;\n }\n\n interface SymbolMeta {\n category?:\n | 'client'\n | 'external'\n | 'hook'\n | 'schema'\n | 'sdk'\n | 'transform'\n | 'type'\n | 'utility'\n | (string & {});\n /**\n * Path to the resource this symbol represents.\n */\n path?: ReadonlyArray<string | number>;\n /**\n * Name of the plugin that registered this symbol.\n */\n pluginName?: string;\n resource?:\n | 'client'\n | 'definition'\n | 'operation'\n | 'webhook'\n | (string & {});\n resourceId?: string;\n role?:\n | 'data'\n | 'error'\n | 'errors'\n | 'options'\n | 'response'\n | 'responses'\n | (string & {});\n /**\n * Tags associated with this symbol.\n */\n tags?: ReadonlyArray<string>;\n tool?:\n | 'angular'\n | 'arktype'\n | 'fastify'\n | 'json-schema'\n | 'sdk'\n | 'typescript'\n | 'valibot'\n | 'zod'\n | (string & {});\n variant?: 'container' | (string & {});\n }\n}\n// END OVERRIDES\n\nimport type { LazyOrAsync, MaybeArray } from '@hey-api/types';\nimport colors from 'ansi-colors';\n// @ts-expect-error\nimport colorSupport from 'color-support';\n\nimport type { UserConfig } from '~/config/types';\n\ncolors.enabled = colorSupport().hasBasic;\n\nexport { createClient } from '~/generate';\n\n/**\n * Type helper for openapi-ts.config.ts, returns {@link MaybeArray<UserConfig>} object(s)\n */\nexport const defineConfig = async <T extends MaybeArray<UserConfig>>(\n config: LazyOrAsync<T>,\n): Promise<T> => (typeof config === 'function' ? await config() : config);\n\nexport { Logger } from '@hey-api/codegen-core';\nexport { defaultPaginationKeywords } from '~/config/parser';\nexport { defaultPlugins } from '~/config/plugins';\nexport type { UserConfig } from '~/config/types';\nexport type { IR } from '~/ir/types';\nexport { OperationPath, OperationStrategy } from '~/openApi/shared/locations';\nexport type {\n OpenApi,\n OpenApiMetaObject,\n OpenApiOperationObject,\n OpenApiParameterObject,\n OpenApiRequestBodyObject,\n OpenApiResponseObject,\n OpenApiSchemaObject,\n} from '~/openApi/types';\nexport type { DefinePlugin, Plugin } from '~/plugins';\nexport type { AngularClient } from '~/plugins/@hey-api/client-angular';\nexport type { AxiosClient } from '~/plugins/@hey-api/client-axios';\nexport {\n clientDefaultConfig,\n clientDefaultMeta,\n} from '~/plugins/@hey-api/client-core/config';\nexport { clientPluginHandler } from '~/plugins/@hey-api/client-core/plugin';\nexport type { Client } from '~/plugins/@hey-api/client-core/types';\nexport type { FetchClient } from '~/plugins/@hey-api/client-fetch';\nexport type { NextClient } from '~/plugins/@hey-api/client-next';\nexport type { NuxtClient } from '~/plugins/@hey-api/client-nuxt';\nexport type { OfetchClient } from '~/plugins/@hey-api/client-ofetch';\nexport type { ExpressionTransformer } from '~/plugins/@hey-api/transformers/expressions';\nexport type { TypeTransformer } from '~/plugins/@hey-api/transformers/types';\nexport { definePluginConfig } from '~/plugins/shared/utils/config';\nexport * from '~/ts-dsl';\n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