ts-class-to-openapi 1.3.2 → 1.3.4

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.
Files changed (45) hide show
  1. package/dist/index.cjs +976 -0
  2. package/dist/index.d.cts +56 -0
  3. package/dist/index.d.mts +58 -0
  4. package/dist/index.mjs +951 -0
  5. package/package.json +32 -28
  6. package/dist/__test__/entities/additional-test-classes.d.ts +0 -12
  7. package/dist/__test__/entities/circular-reference-cases.d.ts +0 -1
  8. package/dist/__test__/entities/circular-reference-classes.d.ts +0 -110
  9. package/dist/__test__/entities/collision/arrays/number-array.d.ts +0 -3
  10. package/dist/__test__/entities/collision/arrays/string-array.d.ts +0 -3
  11. package/dist/__test__/entities/collision/number-props/same-name.d.ts +0 -5
  12. package/dist/__test__/entities/collision/string-props/same-name.d.ts +0 -5
  13. package/dist/__test__/entities/collision/throwing/class-a.d.ts +0 -4
  14. package/dist/__test__/entities/collision/throwing/class-b.d.ts +0 -4
  15. package/dist/__test__/entities/complex-circular-dependencies.d.ts +0 -71
  16. package/dist/__test__/entities/decorated-classes.d.ts +0 -54
  17. package/dist/__test__/entities/deep-nested-classes.d.ts +0 -1
  18. package/dist/__test__/entities/enum-classes.d.ts +0 -38
  19. package/dist/__test__/entities/evaluation/generics.d.ts +0 -6
  20. package/dist/__test__/entities/evaluation/modifiers.d.ts +0 -7
  21. package/dist/__test__/entities/generic-circular-classes.d.ts +0 -57
  22. package/dist/__test__/entities/nested-classes.d.ts +0 -70
  23. package/dist/__test__/entities/nested-reuse-classes.d.ts +0 -43
  24. package/dist/__test__/entities/pure-classes.d.ts +0 -37
  25. package/dist/__test__/entities/schema-validation-classes.d.ts +0 -35
  26. package/dist/__test__/index.d.ts +0 -8
  27. package/dist/__test__/test.d.ts +0 -1
  28. package/dist/__test__/testCases/collision-advanced.test.d.ts +0 -1
  29. package/dist/__test__/testCases/collision.test.d.ts +0 -1
  30. package/dist/__test__/testCases/decorated-classes.test.d.ts +0 -1
  31. package/dist/__test__/testCases/edge-cases.test.d.ts +0 -1
  32. package/dist/__test__/testCases/enum-properties.test.d.ts +0 -1
  33. package/dist/__test__/testCases/generics-and-modifiers.test.d.ts +0 -1
  34. package/dist/__test__/testCases/nested-classes.test.d.ts +0 -1
  35. package/dist/__test__/testCases/nested-reuse.test.d.ts +0 -1
  36. package/dist/__test__/testCases/pure-classes.test.d.ts +0 -1
  37. package/dist/__test__/testCases/schema-validation.test.d.ts +0 -1
  38. package/dist/index.d.ts +0 -3
  39. package/dist/index.esm.js +0 -1230
  40. package/dist/index.js +0 -1232
  41. package/dist/run.d.ts +0 -1
  42. package/dist/run.js +0 -1319
  43. package/dist/transformer.d.ts +0 -5
  44. package/dist/transformer.fixtures.d.ts +0 -175
  45. package/dist/types.d.ts +0 -97
@@ -0,0 +1,56 @@
1
+ //#region src/types.d.ts
2
+ type SchemaType = ({
3
+ [key: string]: any;
4
+ } & {
5
+ properties: {
6
+ [key: string]: any;
7
+ } & {
8
+ additionalProperties?: boolean;
9
+ };
10
+ } & {
11
+ required?: string[];
12
+ } & {
13
+ type: string;
14
+ }) | ({
15
+ [key: string]: any;
16
+ } & {
17
+ $ref: string;
18
+ }) | ({
19
+ [key: string]: any;
20
+ } & {
21
+ type: 'array';
22
+ } & {
23
+ items: SchemaType;
24
+ });
25
+ /**
26
+ * Information about a class-validator decorator found on a property.
27
+ * @interface DecoratorInfo
28
+ */
29
+ /**
30
+ * Configuration options for SchemaTransformer memory management
31
+ * @interface TransformerOptions
32
+ */
33
+ interface TransformerOptions {
34
+ /** Maximum number of schemas to cache before cleanup (default: 100) */
35
+ maxCacheSize?: number;
36
+ /** Whether to automatically clean up cache (default: true) */
37
+ autoCleanup?: boolean;
38
+ /** Options related to the source of the class being transformed */
39
+ sourceOptions?: {
40
+ /** Whether the class is from an external module */isExternal: true; /** The package name (required when isExternal is true) */
41
+ packageName: string; /** The file path of the class being transformed */
42
+ filePath?: string;
43
+ } | {
44
+ /** Whether the class is from an external module */isExternal: false; /** The package name (optional when isExternal is false) */
45
+ packageName: never; /** The file path of the class being transformed */
46
+ filePath?: string;
47
+ };
48
+ }
49
+ //#endregion
50
+ //#region src/transformer.d.ts
51
+ declare function transform<T>(cls: new (...args: any[]) => T, options?: TransformerOptions): {
52
+ name: string;
53
+ schema: SchemaType;
54
+ };
55
+ //#endregion
56
+ export { type SchemaType, type TransformerOptions, transform };
@@ -0,0 +1,58 @@
1
+ import ts from "typescript";
2
+
3
+ //#region src/types.d.ts
4
+ type SchemaType = ({
5
+ [key: string]: any;
6
+ } & {
7
+ properties: {
8
+ [key: string]: any;
9
+ } & {
10
+ additionalProperties?: boolean;
11
+ };
12
+ } & {
13
+ required?: string[];
14
+ } & {
15
+ type: string;
16
+ }) | ({
17
+ [key: string]: any;
18
+ } & {
19
+ $ref: string;
20
+ }) | ({
21
+ [key: string]: any;
22
+ } & {
23
+ type: 'array';
24
+ } & {
25
+ items: SchemaType;
26
+ });
27
+ /**
28
+ * Information about a class-validator decorator found on a property.
29
+ * @interface DecoratorInfo
30
+ */
31
+ /**
32
+ * Configuration options for SchemaTransformer memory management
33
+ * @interface TransformerOptions
34
+ */
35
+ interface TransformerOptions {
36
+ /** Maximum number of schemas to cache before cleanup (default: 100) */
37
+ maxCacheSize?: number;
38
+ /** Whether to automatically clean up cache (default: true) */
39
+ autoCleanup?: boolean;
40
+ /** Options related to the source of the class being transformed */
41
+ sourceOptions?: {
42
+ /** Whether the class is from an external module */isExternal: true; /** The package name (required when isExternal is true) */
43
+ packageName: string; /** The file path of the class being transformed */
44
+ filePath?: string;
45
+ } | {
46
+ /** Whether the class is from an external module */isExternal: false; /** The package name (optional when isExternal is false) */
47
+ packageName: never; /** The file path of the class being transformed */
48
+ filePath?: string;
49
+ };
50
+ }
51
+ //#endregion
52
+ //#region src/transformer.d.ts
53
+ declare function transform<T>(cls: new (...args: any[]) => T, options?: TransformerOptions): {
54
+ name: string;
55
+ schema: SchemaType;
56
+ };
57
+ //#endregion
58
+ export { type SchemaType, type TransformerOptions, transform };