@sdk-it/core 0.9.0 → 0.10.2

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.
@@ -0,0 +1,8 @@
1
+ export * from './lib/deriver.ts';
2
+ export * from './lib/program.ts';
3
+ export * from './lib/paths.ts';
4
+ export * from './lib/file-system.ts';
5
+ export declare function removeDuplicates<T>(data: T[], accessor: (item: T) => T[keyof T]): T[];
6
+ export type InferRecordValue<T> = T extends Record<string, infer U> ? U : any;
7
+ export declare function toLitObject<T extends Record<string, any>>(obj: T, accessor?: (value: InferRecordValue<T>) => string): string;
8
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,8 +1,14 @@
1
+ import type ts from 'typescript';
2
+ import type { TypeDeriver } from './lib/deriver.ts';
3
+ import type { ResponseItem } from './lib/paths.ts';
1
4
  export * from './lib/deriver.ts';
2
- export * from './lib/program.ts';
3
- export * from './lib/paths.ts';
4
5
  export * from './lib/file-system.ts';
6
+ export * from './lib/paths.ts';
7
+ export * from './lib/program.ts';
5
8
  export declare function removeDuplicates<T>(data: T[], accessor: (item: T) => T[keyof T]): T[];
6
9
  export type InferRecordValue<T> = T extends Record<string, infer U> ? U : any;
7
10
  export declare function toLitObject<T extends Record<string, any>>(obj: T, accessor?: (value: InferRecordValue<T>) => string): string;
11
+ export type NaunceResponseAnalyzerFn = (handler: ts.ArrowFunction, deriver: TypeDeriver, node: ts.Node) => ResponseItem[];
12
+ export type NaunceResponseAnalyzer = Record<string, NaunceResponseAnalyzerFn>;
13
+ export type ResponseAnalyzerFn = (handler: ts.ArrowFunction, deriver: TypeDeriver) => ResponseItem[];
8
14
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AAErC,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,IAAI,EAAE,CAAC,EAAE,EACT,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,GAChC,CAAC,EAAE,CAEL;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;AAE9E,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACvD,GAAG,EAAE,CAAC,EACN,QAAQ,GAAE,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,MAAyB,UAKpE"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AAErC,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,IAAI,EAAE,CAAC,EAAE,EACT,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,GAChC,CAAC,EAAE,CAEL;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;AAE9E,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACvD,GAAG,EAAE,CAAC,EACN,QAAQ,GAAE,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,MAAyB,UAKpE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AAEjC,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,IAAI,EAAE,CAAC,EAAE,EACT,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,GAChC,CAAC,EAAE,CAEL;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;AAE9E,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACvD,GAAG,EAAE,CAAC,EACN,QAAQ,GAAE,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,MAAyB,UAKpE;AAED,MAAM,MAAM,wBAAwB,GAAG,CACrC,OAAO,EAAE,EAAE,CAAC,aAAa,EACzB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,EAAE,CAAC,IAAI,KACV,YAAY,EAAE,CAAC;AACpB,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;AAE9E,MAAM,MAAM,kBAAkB,GAAG,CAC/B,OAAO,EAAE,EAAE,CAAC,aAAa,EACzB,OAAO,EAAE,WAAW,KACjB,YAAY,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -216,8 +216,17 @@ var TypeDeriver = class {
216
216
  if (properties.length > 0) {
217
217
  const serializedProps = {};
218
218
  for (const prop of properties) {
219
- if ((prop.getDeclarations() ?? []).some(
220
- (it) => ts.isPropertySignature(it) || ts.isPropertyAssignment(it)
219
+ const propAssingment = (prop.getDeclarations() ?? []).find(
220
+ (it) => ts.isPropertyAssignment(it)
221
+ );
222
+ if (propAssingment) {
223
+ const type2 = this.checker.getTypeAtLocation(
224
+ propAssingment.initializer
225
+ );
226
+ serializedProps[prop.name] = this.serializeType(type2);
227
+ }
228
+ if ((prop.getDeclarations() ?? []).find(
229
+ (it) => ts.isPropertySignature(it)
221
230
  )) {
222
231
  const propType = this.checker.getTypeOfSymbol(prop);
223
232
  serializedProps[prop.name] = this.serializeType(propType);
@@ -261,6 +270,12 @@ var TypeDeriver = class {
261
270
  const type = this.checker.getTypeOfSymbol(symbol);
262
271
  props[symbol.name] = this.serializeType(type);
263
272
  }
273
+ for (const prop of node.properties) {
274
+ if (ts.isPropertyAssignment(prop)) {
275
+ const type = this.checker.getTypeAtLocation(prop.initializer);
276
+ props[prop.name.getText()] = this.serializeType(type);
277
+ }
278
+ }
264
279
  return props;
265
280
  }
266
281
  if (ts.isPropertyAccessExpression(node)) {
@@ -439,74 +454,67 @@ function isInterfaceType(type) {
439
454
  return false;
440
455
  }
441
456
 
442
- // packages/core/src/lib/program.ts
443
- import debug from "debug";
444
- import { dirname, join } from "node:path";
445
- import ts2 from "typescript";
446
- var logger = debug("january:client");
447
- function parseTsConfig(tsconfigPath) {
448
- logger(`Using TypeScript version: ${ts2.version}`);
449
- const configContent = ts2.readConfigFile(tsconfigPath, ts2.sys.readFile);
450
- if (configContent.error) {
451
- console.error(
452
- `Failed to read tsconfig file:`,
453
- ts2.formatDiagnosticsWithColorAndContext([configContent.error], {
454
- getCanonicalFileName: (path) => path,
455
- getCurrentDirectory: ts2.sys.getCurrentDirectory,
456
- getNewLine: () => ts2.sys.newLine
457
- })
458
- );
459
- throw new Error("Failed to parse tsconfig.json");
460
- }
461
- const parsed = ts2.parseJsonConfigFileContent(
462
- configContent.config,
463
- ts2.sys,
464
- dirname(tsconfigPath)
465
- );
466
- if (parsed.errors.length > 0) {
467
- console.error(
468
- `Errors found in tsconfig.json:`,
469
- ts2.formatDiagnosticsWithColorAndContext(parsed.errors, {
470
- getCanonicalFileName: (path) => path,
471
- getCurrentDirectory: ts2.sys.getCurrentDirectory,
472
- getNewLine: () => ts2.sys.newLine
473
- })
474
- );
475
- throw new Error("Failed to parse tsconfig.json");
457
+ // packages/core/src/lib/file-system.ts
458
+ import { mkdir, readFile, readdir, stat, writeFile } from "node:fs/promises";
459
+ import { dirname, isAbsolute, join } from "node:path";
460
+ async function getFile(filePath) {
461
+ if (await exist(filePath)) {
462
+ return readFile(filePath, "utf-8");
476
463
  }
477
- return parsed;
464
+ return null;
478
465
  }
479
- function getProgram(tsconfigPath) {
480
- const tsConfigParseResult = parseTsConfig(tsconfigPath);
481
- logger(`Parsing tsconfig`);
482
- return ts2.createProgram({
483
- options: {
484
- ...tsConfigParseResult.options,
485
- noEmit: true,
486
- incremental: true,
487
- tsBuildInfoFile: join(dirname(tsconfigPath), "./.tsbuildinfo")
488
- // not working atm
489
- },
490
- rootNames: tsConfigParseResult.fileNames,
491
- projectReferences: tsConfigParseResult.projectReferences,
492
- configFileParsingDiagnostics: tsConfigParseResult.errors
493
- });
466
+ async function exist(file) {
467
+ return stat(file).then(() => true).catch(() => false);
494
468
  }
495
- function getPropertyAssignment(node, name) {
496
- if (ts2.isObjectLiteralExpression(node)) {
497
- return node.properties.filter((prop) => ts2.isPropertyAssignment(prop)).find((prop) => prop.name.getText() === name);
469
+ async function readFolder(path) {
470
+ if (await exist(path)) {
471
+ return readdir(path);
498
472
  }
499
- return void 0;
473
+ return [];
500
474
  }
501
- function isCallExpression(node, name) {
502
- return ts2.isCallExpression(node) && node.expression && ts2.isIdentifier(node.expression) && node.expression.text === name;
475
+ async function writeFiles(dir, contents) {
476
+ return Promise.all(
477
+ Object.entries(contents).map(async ([file, content]) => {
478
+ const filePath = isAbsolute(file) ? file : join(dir, file);
479
+ await mkdir(dirname(filePath), { recursive: true });
480
+ if (typeof content === "string") {
481
+ await writeFile(filePath, content, "utf-8");
482
+ } else {
483
+ if (content.ignoreIfExists) {
484
+ if (!await exist(filePath)) {
485
+ await writeFile(filePath, content.content, "utf-8");
486
+ }
487
+ }
488
+ }
489
+ })
490
+ );
503
491
  }
504
- function isInterfaceType2(type) {
505
- if (type.isClassOrInterface()) {
506
- return !!(type.symbol.flags & ts2.SymbolFlags.Interface);
492
+ async function getFolderExports(folder, extensions = ["ts"]) {
493
+ const files = await readdir(folder, { withFileTypes: true });
494
+ const exports = [];
495
+ for (const file of files) {
496
+ if (file.isDirectory()) {
497
+ exports.push(`export * from './${file.name}/index.ts';`);
498
+ } else if (file.name !== "index.ts" && extensions.includes(getExt(file.name))) {
499
+ exports.push(`export * from './${file.name}';`);
500
+ }
507
501
  }
508
- return false;
502
+ return exports.join("\n");
509
503
  }
504
+ var getExt = (fileName) => {
505
+ if (!fileName) {
506
+ return "";
507
+ }
508
+ const lastDot = fileName.lastIndexOf(".");
509
+ if (lastDot === -1) {
510
+ return "";
511
+ }
512
+ const ext = fileName.slice(lastDot + 1).split("/").filter(Boolean).join("");
513
+ if (ext === fileName) {
514
+ return "";
515
+ }
516
+ return ext || "txt";
517
+ };
510
518
 
511
519
  // packages/core/src/lib/paths.ts
512
520
  var methods = [
@@ -735,67 +743,74 @@ function isHttpMethod(name) {
735
743
  return ["get", "post", "put", "delete", "patch"].includes(name);
736
744
  }
737
745
 
738
- // packages/core/src/lib/file-system.ts
739
- import { mkdir, readFile, readdir, stat, writeFile } from "node:fs/promises";
740
- import { dirname as dirname2, isAbsolute, join as join2 } from "node:path";
741
- async function getFile(filePath) {
742
- if (await exist(filePath)) {
743
- return readFile(filePath, "utf-8");
746
+ // packages/core/src/lib/program.ts
747
+ import debug from "debug";
748
+ import { dirname as dirname2, join as join2 } from "node:path";
749
+ import ts2 from "typescript";
750
+ var logger = debug("january:client");
751
+ function parseTsConfig(tsconfigPath) {
752
+ logger(`Using TypeScript version: ${ts2.version}`);
753
+ const configContent = ts2.readConfigFile(tsconfigPath, ts2.sys.readFile);
754
+ if (configContent.error) {
755
+ console.error(
756
+ `Failed to read tsconfig file:`,
757
+ ts2.formatDiagnosticsWithColorAndContext([configContent.error], {
758
+ getCanonicalFileName: (path) => path,
759
+ getCurrentDirectory: ts2.sys.getCurrentDirectory,
760
+ getNewLine: () => ts2.sys.newLine
761
+ })
762
+ );
763
+ throw new Error("Failed to parse tsconfig.json");
744
764
  }
745
- return null;
765
+ const parsed = ts2.parseJsonConfigFileContent(
766
+ configContent.config,
767
+ ts2.sys,
768
+ dirname2(tsconfigPath)
769
+ );
770
+ if (parsed.errors.length > 0) {
771
+ console.error(
772
+ `Errors found in tsconfig.json:`,
773
+ ts2.formatDiagnosticsWithColorAndContext(parsed.errors, {
774
+ getCanonicalFileName: (path) => path,
775
+ getCurrentDirectory: ts2.sys.getCurrentDirectory,
776
+ getNewLine: () => ts2.sys.newLine
777
+ })
778
+ );
779
+ throw new Error("Failed to parse tsconfig.json");
780
+ }
781
+ return parsed;
746
782
  }
747
- async function exist(file) {
748
- return stat(file).then(() => true).catch(() => false);
783
+ function getProgram(tsconfigPath) {
784
+ const tsConfigParseResult = parseTsConfig(tsconfigPath);
785
+ logger(`Parsing tsconfig`);
786
+ return ts2.createProgram({
787
+ options: {
788
+ ...tsConfigParseResult.options,
789
+ noEmit: true,
790
+ incremental: true,
791
+ tsBuildInfoFile: join2(dirname2(tsconfigPath), "./.tsbuildinfo")
792
+ // not working atm
793
+ },
794
+ rootNames: tsConfigParseResult.fileNames,
795
+ projectReferences: tsConfigParseResult.projectReferences,
796
+ configFileParsingDiagnostics: tsConfigParseResult.errors
797
+ });
749
798
  }
750
- async function readFolder(path) {
751
- if (await exist(path)) {
752
- return readdir(path);
799
+ function getPropertyAssignment(node, name) {
800
+ if (ts2.isObjectLiteralExpression(node)) {
801
+ return node.properties.filter((prop) => ts2.isPropertyAssignment(prop)).find((prop) => prop.name.getText() === name);
753
802
  }
754
- return [];
803
+ return void 0;
755
804
  }
756
- async function writeFiles(dir, contents) {
757
- return Promise.all(
758
- Object.entries(contents).map(async ([file, content]) => {
759
- const filePath = isAbsolute(file) ? file : join2(dir, file);
760
- await mkdir(dirname2(filePath), { recursive: true });
761
- if (typeof content === "string") {
762
- await writeFile(filePath, content, "utf-8");
763
- } else {
764
- if (content.ignoreIfExists) {
765
- if (!await exist(filePath)) {
766
- await writeFile(filePath, content.content, "utf-8");
767
- }
768
- }
769
- }
770
- })
771
- );
805
+ function isCallExpression(node, name) {
806
+ return ts2.isCallExpression(node) && node.expression && ts2.isIdentifier(node.expression) && node.expression.text === name;
772
807
  }
773
- async function getFolderExports(folder, extensions = ["ts"]) {
774
- const files = await readdir(folder, { withFileTypes: true });
775
- const exports = [];
776
- for (const file of files) {
777
- if (file.isDirectory()) {
778
- exports.push(`export * from './${file.name}/index.ts';`);
779
- } else if (file.name !== "index.ts" && extensions.includes(getExt(file.name))) {
780
- exports.push(`export * from './${file.name}';`);
781
- }
808
+ function isInterfaceType2(type) {
809
+ if (type.isClassOrInterface()) {
810
+ return !!(type.symbol.flags & ts2.SymbolFlags.Interface);
782
811
  }
783
- return exports.join("\n");
812
+ return false;
784
813
  }
785
- var getExt = (fileName) => {
786
- if (!fileName) {
787
- return "";
788
- }
789
- const lastDot = fileName.lastIndexOf(".");
790
- if (lastDot === -1) {
791
- return "";
792
- }
793
- const ext = fileName.slice(lastDot + 1).split("/").filter(Boolean).join("");
794
- if (ext === fileName) {
795
- return "";
796
- }
797
- return ext || "txt";
798
- };
799
814
 
800
815
  // packages/core/src/index.ts
801
816
  function removeDuplicates(data, accessor) {
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/lib/deriver.ts", "../src/lib/program.ts", "../src/lib/paths.ts", "../src/lib/file-system.ts", "../src/index.ts"],
4
+ "sourcesContent": ["import ts, { TypeFlags, symbolName } from 'typescript';\n\ntype Collector = Record<string, any>;\nexport const deriveSymbol = Symbol.for('serialize');\nexport const $types = Symbol.for('types');\nconst defaults: Record<string, string> = {\n ReadableStream: 'any',\n DateConstructor: 'string',\n ArrayBufferConstructor: 'any',\n SharedArrayBufferConstructor: 'any',\n Int8ArrayConstructor: 'any',\n Uint8Array: 'any',\n};\nexport class TypeDeriver {\n public readonly collector: Collector = {};\n public readonly checker: ts.TypeChecker;\n constructor(checker: ts.TypeChecker) {\n this.checker = checker;\n }\n\n serializeType(type: ts.Type): any {\n if (type.flags & TypeFlags.Any) {\n return {\n [deriveSymbol]: true,\n optional: false,\n [$types]: [],\n };\n }\n if (type.flags & ts.TypeFlags.Boolean) {\n return {\n [deriveSymbol]: true,\n optional: false,\n [$types]: ['boolean'],\n };\n }\n if (type.isIntersection()) {\n let optional: boolean | undefined;\n const types: any[] = [];\n for (const unionType of type.types) {\n if (optional === undefined) {\n optional = (unionType.flags & ts.TypeFlags.Undefined) !== 0;\n if (optional) {\n continue;\n }\n }\n\n types.push(this.serializeType(unionType));\n }\n return {\n [deriveSymbol]: true,\n kind: 'intersection',\n optional,\n [$types]: types,\n };\n }\n if (type.isUnion()) {\n let optional: boolean | undefined;\n const types: any[] = [];\n for (const unionType of type.types) {\n if (optional === undefined) {\n optional = (unionType.flags & ts.TypeFlags.Undefined) !== 0;\n if (optional) {\n continue;\n }\n }\n\n types.push(this.serializeType(unionType));\n }\n return {\n [deriveSymbol]: true,\n kind: 'union',\n optional,\n [$types]: types,\n };\n }\n if (this.checker.isArrayLikeType(type)) {\n const [argType] = this.checker.getTypeArguments(type as ts.TypeReference);\n if (!argType) {\n const typeName = type.symbol?.getName() || '<unknown>';\n console.warn(\n `Could not find generic type argument for array type ${typeName}`,\n );\n return {\n [deriveSymbol]: true,\n optional: false,\n kind: 'array',\n [$types]: ['any'],\n };\n }\n const typeSymbol = argType.getSymbol();\n if (!typeSymbol) {\n return {\n [deriveSymbol]: true,\n optional: false,\n kind: 'array',\n [$types]: [this.serializeType(argType)],\n };\n }\n\n if (typeSymbol.valueDeclaration) {\n return {\n kind: 'array',\n [deriveSymbol]: true,\n [$types]: [this.serializeNode(typeSymbol.valueDeclaration)],\n };\n }\n const maybeDeclaration = typeSymbol.declarations?.[0];\n if (maybeDeclaration) {\n if (ts.isMappedTypeNode(maybeDeclaration)) {\n const resolvedType = this.checker\n .getPropertiesOfType(argType)\n .reduce<Record<string, unknown>>((acc, prop) => {\n const propType = this.checker.getTypeOfSymbol(prop);\n acc[prop.name] = this.serializeType(propType);\n return acc;\n }, {});\n return {\n kind: 'array',\n optional: false,\n [deriveSymbol]: true,\n [$types]: [resolvedType],\n };\n } else {\n return {\n kind: 'array',\n ...this.serializeNode(maybeDeclaration),\n };\n }\n }\n\n return {\n kind: 'array',\n optional: false,\n [deriveSymbol]: true,\n [$types]: ['any'],\n };\n }\n if (type.isClass()) {\n const declaration = type.symbol?.valueDeclaration;\n if (!declaration) {\n return {\n [deriveSymbol]: true,\n optional: false,\n [$types]: [type.symbol.getName()],\n };\n }\n return this.serializeNode(declaration);\n }\n if (isInterfaceType(type)) {\n const valueDeclaration =\n type.symbol.valueDeclaration ?? type.symbol.declarations?.[0];\n if (!valueDeclaration) {\n return {\n [deriveSymbol]: true,\n optional: false,\n [$types]: [type.symbol.getName()],\n };\n }\n return this.serializeNode(valueDeclaration);\n }\n if (type.flags & TypeFlags.Null) {\n return {\n [deriveSymbol]: true,\n optional: true,\n [$types]: ['null'],\n };\n }\n if (type.flags & TypeFlags.Object) {\n if (defaults[symbolName(type.symbol)]) {\n return {\n [deriveSymbol]: true,\n optional: false,\n [$types]: [defaults[type.symbol.name]],\n };\n }\n const properties = this.checker.getPropertiesOfType(type);\n if (properties.length > 0) {\n const serializedProps: Record<string, any> = {};\n for (const prop of properties) {\n if (\n (prop.getDeclarations() ?? []).some(\n (it) => ts.isPropertySignature(it) || ts.isPropertyAssignment(it),\n )\n ) {\n const propType = this.checker.getTypeOfSymbol(prop);\n serializedProps[prop.name] = this.serializeType(propType);\n }\n }\n return {\n [deriveSymbol]: true,\n kind: 'object',\n optional: false,\n [$types]: [serializedProps],\n };\n }\n const declaration =\n type.symbol.valueDeclaration ?? type.symbol.declarations?.[0];\n if (!declaration) {\n return {\n [deriveSymbol]: true,\n optional: false,\n [$types]: [type.symbol.getName()],\n };\n }\n return this.serializeNode(declaration);\n }\n\n return {\n [deriveSymbol]: true,\n optional: false,\n [$types]: [\n this.checker.typeToString(\n type,\n undefined,\n ts.TypeFormatFlags.NoTruncation,\n ),\n ],\n };\n }\n\n serializeNode(node: ts.Node): any {\n if (ts.isObjectLiteralExpression(node)) {\n const symbolType = this.checker.getTypeAtLocation(node);\n const props: Record<string, any> = {};\n for (const symbol of symbolType.getProperties()) {\n const type = this.checker.getTypeOfSymbol(symbol);\n props[symbol.name] = this.serializeType(type);\n }\n return props;\n }\n if (ts.isPropertyAccessExpression(node)) {\n const symbol = this.checker.getSymbolAtLocation(node.name);\n if (!symbol) {\n console.warn(`No symbol found for ${node.name.getText()}`);\n return null;\n }\n const type = this.checker.getTypeOfSymbol(symbol);\n return this.serializeType(type);\n }\n if (ts.isPropertySignature(node)) {\n const symbol = this.checker.getSymbolAtLocation(node.name);\n if (!symbol) {\n console.warn(`No symbol found for ${node.name.getText()}`);\n return null;\n }\n const type = this.checker.getTypeOfSymbol(symbol);\n return this.serializeType(type);\n }\n if (ts.isPropertyDeclaration(node)) {\n const symbol = this.checker.getSymbolAtLocation(node.name);\n if (!symbol) {\n console.warn(`No symbol found for ${node.name.getText()}`);\n return null;\n }\n const type = this.checker.getTypeOfSymbol(symbol);\n return this.serializeType(type);\n }\n if (ts.isInterfaceDeclaration(node)) {\n if (!node.name?.text) {\n throw new Error('Interface has no name');\n }\n if (defaults[node.name.text]) {\n return {\n [deriveSymbol]: true,\n optional: false,\n [$types]: [defaults[node.name.text]],\n };\n }\n if (!this.collector[node.name.text]) {\n this.collector[node.name.text] = {};\n const members: Record<string, any> = {};\n for (const member of node.members.filter(ts.isPropertySignature)) {\n members[member.name.getText()] = this.serializeNode(member);\n }\n this.collector[node.name.text] = members;\n }\n return {\n [deriveSymbol]: true,\n optional: false,\n [$types]: [`#/components/schemas/${node.name.text}`],\n };\n }\n if (ts.isClassDeclaration(node)) {\n if (!node.name?.text) {\n throw new Error('Class has no name');\n }\n if (defaults[node.name.text]) {\n return {\n [deriveSymbol]: true,\n optional: false,\n [$types]: [defaults[node.name.text]],\n };\n }\n\n if (!this.collector[node.name.text]) {\n this.collector[node.name.text] = {};\n const members: Record<string, unknown> = {};\n for (const member of node.members.filter(ts.isPropertyDeclaration)) {\n members[member.name!.getText()] = this.serializeNode(member);\n }\n this.collector[node.name.text] = members;\n }\n return {\n [deriveSymbol]: true,\n optional: false,\n [$types]: [`#/components/schemas/${node.name.text}`],\n $ref: `#/components/schemas/${node.name.text}`,\n };\n }\n if (ts.isVariableDeclaration(node)) {\n const symbol = this.checker.getSymbolAtLocation(node.name);\n if (!symbol) {\n console.warn(`No symbol found for ${node.name.getText()}`);\n return null;\n }\n if (!node.type) {\n console.warn(`No type found for ${node.name.getText()}`);\n return 'any';\n }\n const type = this.checker.getTypeFromTypeNode(node.type);\n return this.serializeType(type);\n }\n if (ts.isIdentifier(node)) {\n const symbol = this.checker.getSymbolAtLocation(node);\n if (!symbol) {\n console.warn(`Identifer: No symbol found for ${node.getText()}`);\n return null;\n }\n const type = this.checker.getTypeAtLocation(node);\n return this.serializeType(type);\n }\n if (ts.isAwaitExpression(node)) {\n const type = this.checker.getTypeAtLocation(node);\n return this.serializeType(type);\n }\n if (ts.isCallExpression(node)) {\n const type = this.checker.getTypeAtLocation(node);\n return this.serializeType(type);\n }\n if (ts.isAsExpression(node)) {\n const type = this.checker.getTypeAtLocation(node);\n return this.serializeType(type);\n }\n if (ts.isTypeLiteralNode(node)) {\n const symbolType = this.checker.getTypeAtLocation(node);\n const props: Record<string, unknown> = {};\n for (const symbol of symbolType.getProperties()) {\n const type = this.checker.getTypeOfSymbol(symbol);\n props[symbol.name] = this.serializeType(type);\n }\n return {\n [deriveSymbol]: true,\n optional: false,\n [$types]: [props],\n };\n }\n if (node.kind === ts.SyntaxKind.NullKeyword) {\n return {\n [deriveSymbol]: true,\n optional: true,\n [$types]: ['null'],\n };\n }\n if (node.kind === ts.SyntaxKind.BooleanKeyword) {\n return {\n [deriveSymbol]: true,\n optional: false,\n [$types]: ['boolean'],\n };\n }\n if (\n node.kind === ts.SyntaxKind.TrueKeyword ||\n node.kind === ts.SyntaxKind.FalseKeyword\n ) {\n return {\n [deriveSymbol]: true,\n optional: false,\n [$types]: ['boolean'],\n };\n }\n if (ts.isArrayLiteralExpression(node)) {\n const type = this.checker.getTypeAtLocation(node);\n return this.serializeType(type);\n }\n\n console.warn(`Unhandled node: ${ts.SyntaxKind[node.kind]} ${node.flags}`);\n return {\n [deriveSymbol]: true,\n optional: false,\n [$types]: ['any'],\n };\n }\n}\n\nfunction isInterfaceType(type: ts.Type): boolean {\n if (type.isClassOrInterface()) {\n // Check if it's an interface\n return !!(type.symbol.flags & ts.SymbolFlags.Interface);\n }\n return false;\n}\n", "import debug from 'debug';\nimport { dirname, join } from 'node:path';\nimport ts from 'typescript';\n\n\n\n\n\nconst logger = debug('january:client');\n\nexport function parseTsConfig(tsconfigPath: string) {\n logger(`Using TypeScript version: ${ts.version}`);\n const configContent = ts.readConfigFile(tsconfigPath, ts.sys.readFile);\n\n if (configContent.error) {\n console.error(\n `Failed to read tsconfig file:`,\n ts.formatDiagnosticsWithColorAndContext([configContent.error], {\n getCanonicalFileName: (path) => path,\n getCurrentDirectory: ts.sys.getCurrentDirectory,\n getNewLine: () => ts.sys.newLine,\n }),\n );\n throw new Error('Failed to parse tsconfig.json');\n }\n\n const parsed = ts.parseJsonConfigFileContent(\n configContent.config,\n ts.sys,\n dirname(tsconfigPath),\n );\n\n if (parsed.errors.length > 0) {\n console.error(\n `Errors found in tsconfig.json:`,\n ts.formatDiagnosticsWithColorAndContext(parsed.errors, {\n getCanonicalFileName: (path) => path,\n getCurrentDirectory: ts.sys.getCurrentDirectory,\n getNewLine: () => ts.sys.newLine,\n }),\n );\n throw new Error('Failed to parse tsconfig.json');\n }\n return parsed;\n}\nexport function getProgram(tsconfigPath: string) {\n const tsConfigParseResult = parseTsConfig(tsconfigPath);\n logger(`Parsing tsconfig`);\n return ts.createProgram({\n options: {\n ...tsConfigParseResult.options,\n noEmit: true,\n incremental: true,\n tsBuildInfoFile: join(dirname(tsconfigPath), './.tsbuildinfo'), // not working atm\n },\n rootNames: tsConfigParseResult.fileNames,\n projectReferences: tsConfigParseResult.projectReferences,\n configFileParsingDiagnostics: tsConfigParseResult.errors,\n });\n}\nexport function getPropertyAssignment(node: ts.Node, name: string) {\n if (ts.isObjectLiteralExpression(node)) {\n return node.properties\n .filter((prop) => ts.isPropertyAssignment(prop))\n .find((prop) => prop.name!.getText() === name);\n }\n return undefined;\n}\nexport function isCallExpression(\n node: ts.Node,\n name: string,\n): node is ts.CallExpression {\n return (\n ts.isCallExpression(node) &&\n node.expression &&\n ts.isIdentifier(node.expression) &&\n node.expression.text === name\n );\n}\n\nexport function isInterfaceType(type: ts.Type): boolean {\n if (type.isClassOrInterface()) {\n // Check if it's an interface\n return !!(type.symbol.flags & ts.SymbolFlags.Interface);\n }\n return false;\n}", "import type {\n OperationObject,\n ParameterObject,\n PathsObject,\n ResponseObject,\n ResponsesObject,\n SchemaObject,\n} from 'openapi3-ts/oas31';\n\nimport { $types } from './deriver.ts';\n\nexport type Method =\n | 'get'\n | 'post'\n | 'put'\n | 'patch'\n | 'delete'\n | 'trace'\n | 'head';\nexport const methods = [\n 'get',\n 'post',\n 'put',\n 'patch',\n 'delete',\n 'trace',\n 'head',\n] as const;\nexport type SemanticSource =\n | 'query'\n | 'queries'\n | 'body'\n | 'params'\n | 'headers';\n\nconst semanticSourceToOpenAPI = {\n queries: 'query',\n query: 'query',\n headers: 'header',\n params: 'path',\n} as const;\nexport interface Selector {\n name: string;\n select: string;\n against: string;\n source: SemanticSource;\n nullable: boolean;\n required: boolean;\n}\n\nexport interface ResponseItem {\n statusCode: string;\n response?: DateType;\n contentType: string;\n headers: string[];\n}\n\nexport type OnOperation = (\n sourceFile: string,\n method: Method,\n path: string,\n operation: OperationObject,\n) => PathsObject;\nexport class Paths {\n #commonZodImport?: string;\n #onOperation?: OnOperation;\n #operations: Array<{\n sourceFile: string;\n name: string;\n path: string;\n method: Method;\n selectors: Selector[];\n responses: ResponsesObject;\n tags?: string[];\n description?: string;\n }> = [];\n\n constructor(config: { commonZodImport?: string; onOperation?: OnOperation }) {\n this.#commonZodImport = config.commonZodImport;\n this.#onOperation = config.onOperation;\n }\n\n addPath(\n name: string,\n path: string,\n method: Method,\n selectors: Selector[],\n responses: ResponseItem[],\n sourceFile: string,\n tags?: string[],\n description?: string,\n ) {\n const responsesObject = this.#responseItemToResponses(responses);\n this.#operations.push({\n name,\n path,\n sourceFile,\n method,\n selectors,\n responses: responsesObject,\n tags,\n description,\n });\n return this;\n }\n\n #responseItemToResponses(responses: ResponseItem[]): ResponsesObject {\n const responsesObject: ResponsesObject = {};\n for (const item of responses) {\n const ct = item.contentType;\n const schema = item.response ? toSchema(item.response) : {};\n if (!responsesObject[item.statusCode]) {\n responsesObject[item.statusCode] = {\n description: `Response for ${item.statusCode}`,\n content: {\n [ct]:\n ct === 'application/octet-stream'\n ? { schema: { type: 'string', format: 'binary' } }\n : { schema },\n },\n headers: item.headers.length\n ? item.headers.reduce(\n (acc, header) => ({\n ...acc,\n [header]: { schema: { type: 'string' } },\n }),\n {},\n )\n : undefined,\n } satisfies ResponseObject;\n } else {\n if (!responsesObject[item.statusCode].content[ct]) {\n responsesObject[item.statusCode].content[ct] = { schema };\n } else {\n const existing = responsesObject[item.statusCode].content[ct]\n .schema as SchemaObject;\n if (existing.oneOf) {\n if (\n !existing.oneOf.find(\n (it) => JSON.stringify(it) === JSON.stringify(schema),\n )\n ) {\n existing.oneOf.push(schema);\n }\n } else if (JSON.stringify(existing) !== JSON.stringify(schema)) {\n responsesObject[item.statusCode].content[ct].schema = {\n oneOf: [existing, schema],\n };\n }\n }\n }\n }\n return responsesObject;\n }\n\n async #selectosToParameters(selectors: Selector[]) {\n const parameters: ParameterObject[] = [];\n const bodySchemaProps: Record<string, SchemaObject> = {};\n for (const selector of selectors) {\n if (selector.source === 'body') {\n bodySchemaProps[selector.name] = await evalZod(\n selector.against,\n this.#commonZodImport,\n );\n continue;\n }\n\n const parameter: ParameterObject = {\n in: semanticSourceToOpenAPI[selector.source],\n name: selector.name,\n required: selector.required,\n schema: await evalZod(selector.against, this.#commonZodImport),\n };\n parameters.push(parameter);\n }\n return { parameters, bodySchemaProps };\n }\n\n async getPaths() {\n const operations: PathsObject = {};\n for (const operation of this.#operations) {\n const { path, method, selectors } = operation;\n const { parameters, bodySchemaProps } =\n await this.#selectosToParameters(selectors);\n const operationObject: OperationObject = {\n operationId: operation.name,\n parameters,\n tags: operation.tags,\n description: operation.description,\n requestBody: Object.keys(bodySchemaProps).length\n ? {\n content: {\n 'application/json': {\n schema: {\n type: 'object',\n properties: bodySchemaProps,\n },\n },\n },\n }\n : undefined,\n responses: operation.responses,\n };\n if (!operations[path]) {\n operations[path] = {};\n }\n operations[path][method] = operationObject;\n if (this.#onOperation) {\n const operations = this.#onOperation?.(\n operation.sourceFile,\n method,\n path,\n operationObject,\n );\n Object.assign(operations, operations ?? {});\n }\n }\n return operations;\n }\n}\n\nasync function evalZod(schema: string, commonZodImport?: string) {\n // https://github.com/nodejs/node/issues/51956\n const lines = [\n `import { createRequire } from \"node:module\";`,\n `const filename = \"${import.meta.url}\";`,\n `const require = createRequire(filename);`,\n `const z = require(\"zod\");`,\n commonZodImport ? `import * as commonZod from '${commonZodImport}';` : '',\n `const {zodToJsonSchema} = require('zod-to-json-schema');`,\n `const schema = ${schema.replace('.optional()', '')};`,\n `const jsonSchema = zodToJsonSchema(schema, {\n \t$refStrategy: 'root',\n \tbasePath: ['#', 'components', 'schemas']\n });`,\n `export default jsonSchema;`,\n ];\n const base64 = Buffer.from(lines.join('\\n')).toString('base64');\n return import(`data:text/javascript;base64,${base64}`)\n .then((mod) => mod.default)\n .then(({ $schema, ...result }) => result);\n}\n\ninterface DateType {\n [$types]: any[];\n kind: string;\n optional: boolean;\n}\n\nexport function toSchema(data: DateType | string | null | undefined): any {\n if (data === null || data === undefined) {\n return { type: 'any' };\n } else if (typeof data === 'string') {\n const isRef = data.startsWith('#');\n if (isRef) {\n return { $ref: data };\n }\n return { type: data };\n } else if (data.kind === 'array') {\n const items = data[$types].map(toSchema);\n return { type: 'array', items: data[$types].length ? items[0] : {} };\n } else if (data.kind === 'union') {\n return { oneOf: data[$types].map(toSchema) };\n } else if (data.kind === 'intersection') {\n return { allOf: data[$types].map(toSchema) };\n } else if ($types in data) {\n return data[$types].map(toSchema)[0] ?? {};\n } else {\n const props: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(data)) {\n props[key] = toSchema(value as any);\n }\n return {\n type: 'object',\n properties: props,\n additionalProperties: false,\n };\n }\n}\n\nexport function isHttpMethod(name: string): name is Method {\n return ['get', 'post', 'put', 'delete', 'patch'].includes(name);\n}\n", "import { mkdir, readFile, readdir, stat, writeFile } from 'node:fs/promises';\nimport { dirname, isAbsolute, join } from 'node:path';\n\nexport async function getFile(filePath: string) {\n if (await exist(filePath)) {\n return readFile(filePath, 'utf-8');\n }\n return null;\n}\n\nexport async function exist(file: string): Promise<boolean> {\n return stat(file)\n .then(() => true)\n .catch(() => false);\n}\n\nexport async function readFolder(path: string) {\n if (await exist(path)) {\n return readdir(path);\n }\n return [] as string[];\n}\n\nexport async function writeFiles(\n dir: string,\n contents: Record<\n string,\n string | { content: string; ignoreIfExists?: boolean }\n >,\n) {\n return Promise.all(\n Object.entries(contents).map(async ([file, content]) => {\n const filePath = isAbsolute(file) ? file : join(dir, file);\n await mkdir(dirname(filePath), { recursive: true });\n if (typeof content === 'string') {\n await writeFile(filePath, content, 'utf-8');\n } else {\n if (content.ignoreIfExists) {\n if (!(await exist(filePath))) {\n await writeFile(filePath, content.content, 'utf-8');\n }\n }\n }\n }),\n );\n}\n\nexport async function getFolderExports(folder: string, extensions = ['ts']) {\n const files = await readdir(folder, { withFileTypes: true });\n const exports: string[] = [];\n for (const file of files) {\n if (file.isDirectory()) {\n exports.push(`export * from './${file.name}';`);\n } else if (\n file.name !== 'index.ts' &&\n extensions.includes(getExt(file.name))\n ) {\n exports.push(`export * from './${file.name}';`);\n }\n }\n return exports.join('\\n');\n}\n\nexport const getExt = (fileName?: string) => {\n if (!fileName) {\n return ''; // shouldn't happen as there will always be a file name\n }\n const lastDot = fileName.lastIndexOf('.');\n if (lastDot === -1) {\n return '';\n }\n const ext = fileName\n .slice(lastDot + 1)\n .split('/')\n .filter(Boolean)\n .join('');\n if (ext === fileName) {\n // files that have no extension\n return '';\n }\n return ext || 'txt';\n};\n", "export * from './lib/deriver.ts';\nexport * from './lib/program.ts';\nexport * from './lib/paths.ts';\nexport * from './lib/file-system.ts';\n\nexport function removeDuplicates<T>(\n data: T[],\n accessor: (item: T) => T[keyof T],\n): T[] {\n return [...new Map(data.map((x) => [accessor(x), x])).values()];\n}\n\nexport type InferRecordValue<T> = T extends Record<string, infer U> ? U : any;\n\nexport function toLitObject<T extends Record<string, any>>(\n obj: T,\n accessor: (value: InferRecordValue<T>) => string = (value) => value,\n) {\n return `{${Object.keys(obj)\n .map((key) => `${key}: ${accessor(obj[key])}`)\n .join(', ')}}`;\n}\n"],
5
+ "mappings": ";AAAA,OAAO,MAAM,WAAW,kBAAkB;AAGnC,IAAM,eAAe,OAAO,IAAI,WAAW;AAC3C,IAAM,SAAS,OAAO,IAAI,OAAO;AACxC,IAAM,WAAmC;AAAA,EACvC,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,wBAAwB;AAAA,EACxB,8BAA8B;AAAA,EAC9B,sBAAsB;AAAA,EACtB,YAAY;AACd;AACO,IAAM,cAAN,MAAkB;AAAA,EACP,YAAuB,CAAC;AAAA,EACxB;AAAA,EAChB,YAAY,SAAyB;AACnC,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,cAAc,MAAoB;AAChC,QAAI,K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