tsondb 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/LICENSE +385 -0
  2. package/README.md +173 -1
  3. package/lib/bin/tsondb.d.ts +8 -0
  4. package/lib/bin/tsondb.js +83 -0
  5. package/lib/index.d.ts +2 -1
  6. package/lib/index.js +1 -1
  7. package/lib/{Schema.d.ts → node/Schema.d.ts} +2 -2
  8. package/lib/{Schema.js → node/Schema.js} +1 -1
  9. package/lib/node/index.d.ts +8 -0
  10. package/lib/node/index.js +62 -0
  11. package/lib/{renderers → node/renderers}/Output.d.ts +1 -1
  12. package/lib/{renderers → node/renderers}/jsonschema/index.d.ts +2 -2
  13. package/lib/{renderers → node/renderers}/jsonschema/index.js +2 -2
  14. package/lib/{renderers → node/renderers}/jsonschema/render.d.ts +1 -1
  15. package/lib/{renderers → node/renderers}/jsonschema/render.js +9 -9
  16. package/lib/{renderers → node/renderers}/ts/index.d.ts +2 -2
  17. package/lib/{renderers → node/renderers}/ts/index.js +2 -2
  18. package/lib/{renderers → node/renderers}/ts/render.d.ts +1 -1
  19. package/lib/{renderers → node/renderers}/ts/render.js +9 -8
  20. package/lib/{schema → node/schema}/Node.d.ts +4 -4
  21. package/lib/{schema → node/schema}/Node.js +5 -5
  22. package/lib/{schema/parameters → node/schema}/TypeParameter.d.ts +3 -2
  23. package/lib/{schema/parameters → node/schema}/TypeParameter.js +2 -2
  24. package/lib/{schema → node/schema}/declarations/Declaration.d.ts +10 -11
  25. package/lib/{schema → node/schema}/declarations/Declaration.js +7 -5
  26. package/lib/{schema → node/schema}/declarations/EntityDecl.d.ts +10 -9
  27. package/lib/{schema → node/schema}/declarations/EntityDecl.js +2 -2
  28. package/lib/{schema → node/schema}/declarations/EnumDecl.d.ts +9 -7
  29. package/lib/{schema → node/schema}/declarations/EnumDecl.js +3 -3
  30. package/lib/{schema → node/schema}/declarations/TypeAliasDecl.d.ts +8 -7
  31. package/lib/{schema → node/schema}/declarations/TypeAliasDecl.js +3 -3
  32. package/lib/{schema → node/schema}/index.d.ts +4 -4
  33. package/lib/{schema → node/schema}/index.js +3 -4
  34. package/lib/node/schema/types/Type.d.ts +48 -0
  35. package/lib/{schema → node/schema}/types/Type.js +41 -25
  36. package/lib/{schema → node/schema}/types/generic/ArrayType.d.ts +5 -4
  37. package/lib/{schema → node/schema}/types/generic/ArrayType.js +3 -3
  38. package/lib/{schema → node/schema}/types/generic/EnumType.d.ts +5 -4
  39. package/lib/{schema → node/schema}/types/generic/EnumType.js +4 -2
  40. package/lib/{schema → node/schema}/types/generic/ObjectType.d.ts +8 -7
  41. package/lib/{schema → node/schema}/types/generic/ObjectType.js +8 -4
  42. package/lib/{schema → node/schema}/types/primitives/BooleanType.d.ts +4 -3
  43. package/lib/{schema → node/schema}/types/primitives/DateType.d.ts +5 -4
  44. package/lib/{schema → node/schema}/types/primitives/DateType.js +1 -1
  45. package/lib/{schema → node/schema}/types/primitives/FloatType.d.ts +5 -4
  46. package/lib/{schema → node/schema}/types/primitives/FloatType.js +1 -1
  47. package/lib/{schema → node/schema}/types/primitives/IntegerType.d.ts +5 -4
  48. package/lib/{schema → node/schema}/types/primitives/IntegerType.js +1 -1
  49. package/lib/{schema → node/schema}/types/primitives/NumericType.d.ts +2 -2
  50. package/lib/node/schema/types/primitives/PrimitiveType.d.ts +6 -0
  51. package/lib/{schema → node/schema}/types/primitives/StringType.d.ts +5 -4
  52. package/lib/{schema → node/schema}/types/primitives/StringType.js +1 -1
  53. package/lib/{schema → node/schema}/types/references/IncludeIdentifierType.d.ts +9 -8
  54. package/lib/{schema → node/schema}/types/references/IncludeIdentifierType.js +1 -1
  55. package/lib/{schema → node/schema}/types/references/NestedEntityMapType.d.ts +10 -9
  56. package/lib/{schema → node/schema}/types/references/NestedEntityMapType.js +4 -4
  57. package/lib/{schema → node/schema}/types/references/ReferenceIdentifierType.d.ts +7 -6
  58. package/lib/{schema → node/schema}/types/references/ReferenceIdentifierType.js +1 -1
  59. package/lib/node/schema/types/references/TypeArgumentType.d.ts +23 -0
  60. package/lib/node/schema/types/references/TypeArgumentType.js +19 -0
  61. package/lib/node/schema/validation/type.d.ts +4 -0
  62. package/lib/{server → node/server}/api/declarations.js +1 -1
  63. package/lib/{server → node/server}/api/git.js +14 -10
  64. package/lib/{server → node/server}/api/instanceOperations.d.ts +3 -3
  65. package/lib/{server → node/server}/api/instanceOperations.js +13 -4
  66. package/lib/{server → node/server}/api/instances.js +7 -3
  67. package/lib/node/server/index.d.ts +28 -0
  68. package/lib/{server → node/server}/index.js +6 -6
  69. package/lib/node/server/init.d.ts +5 -0
  70. package/lib/{server → node/server}/init.js +8 -8
  71. package/lib/{utils → node/utils}/error.js +4 -1
  72. package/lib/{utils → node/utils}/git.d.ts +2 -2
  73. package/lib/{utils → node/utils}/instances.d.ts +3 -3
  74. package/lib/{utils → node/utils}/instances.js +8 -6
  75. package/lib/{utils → node/utils}/references.d.ts +2 -2
  76. package/lib/{utils → node/utils}/references.js +3 -3
  77. package/lib/{utils → node/utils}/render.js +1 -1
  78. package/lib/shared/api.d.ts +8 -2
  79. package/lib/shared/utils/array.js +12 -9
  80. package/lib/shared/utils/displayName.d.ts +1 -1
  81. package/lib/shared/utils/displayName.js +4 -2
  82. package/lib/shared/utils/instances.d.ts +2 -2
  83. package/lib/{utils → shared/utils}/lazy.js +1 -1
  84. package/lib/shared/utils/markdown.js +6 -6
  85. package/lib/shared/utils/object.d.ts +3 -0
  86. package/lib/shared/utils/object.js +1 -0
  87. package/lib/{utils → shared/utils}/result.js +2 -2
  88. package/lib/shared/utils/string.js +7 -4
  89. package/lib/shared/utils/validation.js +3 -2
  90. package/lib/shared/validation/number.js +3 -3
  91. package/lib/shared/validation/object.js +4 -3
  92. package/lib/shared/validation/string.js +12 -7
  93. package/lib/{client → web}/api.d.ts +2 -2
  94. package/lib/{client → web}/api.js +4 -2
  95. package/lib/web/components/Git.d.ts +2 -0
  96. package/lib/{client → web}/components/Git.js +58 -14
  97. package/lib/{client → web}/components/Layout.d.ts +1 -1
  98. package/lib/{client → web}/components/Layout.js +1 -1
  99. package/lib/web/components/Select.d.ts +3 -0
  100. package/lib/web/components/Select.js +5 -0
  101. package/lib/web/components/typeInputs/ArrayTypeInput.d.ts +13 -0
  102. package/lib/{client → web}/components/typeInputs/ArrayTypeInput.js +7 -1
  103. package/lib/{client → web}/components/typeInputs/BooleanTypeInput.d.ts +2 -2
  104. package/lib/{client → web}/components/typeInputs/DateTypeInput.d.ts +2 -2
  105. package/lib/web/components/typeInputs/EnumTypeInput.d.ts +13 -0
  106. package/lib/{client → web}/components/typeInputs/EnumTypeInput.js +1 -1
  107. package/lib/{client → web}/components/typeInputs/FloatTypeInput.d.ts +2 -2
  108. package/lib/web/components/typeInputs/GenericTypeArgumentIdentifierTypeInput.d.ts +7 -0
  109. package/lib/{client → web}/components/typeInputs/GenericTypeArgumentIdentifierTypeInput.js +1 -1
  110. package/lib/web/components/typeInputs/IncludeIdentifierTypeInput.d.ts +13 -0
  111. package/lib/{client → web}/components/typeInputs/IntegerTypeInput.d.ts +2 -2
  112. package/lib/web/components/typeInputs/NestedEntityMapTypeInput.d.ts +13 -0
  113. package/lib/{client → web}/components/typeInputs/NestedEntityMapTypeInput.js +7 -2
  114. package/lib/{client → web}/components/typeInputs/ObjectTypeInput.d.ts +4 -4
  115. package/lib/{client → web}/components/typeInputs/ObjectTypeInput.js +4 -1
  116. package/lib/{client → web}/components/typeInputs/ReferenceIdentifierTypeInput.d.ts +3 -3
  117. package/lib/web/components/typeInputs/ReferenceIdentifierTypeInput.js +11 -0
  118. package/lib/{client → web}/components/typeInputs/StringTypeInput.d.ts +2 -2
  119. package/lib/web/components/typeInputs/TypeInput.d.ts +13 -0
  120. package/lib/{client → web}/components/typeInputs/TypeInput.js +3 -3
  121. package/lib/{client → web}/components/typeInputs/utils/Markdown.d.ts +1 -1
  122. package/lib/{client → web}/components/typeInputs/utils/Markdown.js +2 -2
  123. package/lib/{client → web}/components/typeInputs/utils/MismatchingTypeError.d.ts +1 -1
  124. package/lib/{client → web}/components/typeInputs/utils/ValidationErrors.d.ts +1 -1
  125. package/lib/web/hooks/useAPIResource.d.ts +1 -0
  126. package/lib/{client → web}/hooks/useEntityFromRoute.d.ts +1 -1
  127. package/lib/{client → web}/hooks/useEntityFromRoute.js +1 -1
  128. package/lib/{client → web}/hooks/useInstanceNamesByEntity.d.ts +1 -1
  129. package/lib/{client → web}/hooks/useInstanceNamesByEntity.js +8 -6
  130. package/lib/web/hooks/useMappedAPIResource.d.ts +1 -0
  131. package/lib/{client → web}/hooks/useMappedAPIResource.js +7 -9
  132. package/lib/{client → web}/hooks/useSecondaryDeclarations.d.ts +1 -1
  133. package/lib/{client → web}/hooks/useSecondaryDeclarations.js +4 -2
  134. package/lib/{client → web}/routes/CreateInstance.d.ts +1 -1
  135. package/lib/{client → web}/routes/CreateInstance.js +4 -2
  136. package/lib/web/routes/Entity.d.ts +2 -0
  137. package/lib/{client → web}/routes/Entity.js +5 -3
  138. package/lib/web/routes/Home.d.ts +2 -0
  139. package/lib/{client → web}/routes/Instance.d.ts +1 -1
  140. package/lib/{client → web}/routes/Instance.js +14 -8
  141. package/lib/{client → web}/routes/NotFound.d.ts +1 -1
  142. package/lib/web/utils/typeSkeleton.d.ts +3 -0
  143. package/lib/{client → web}/utils/typeSkeleton.js +4 -1
  144. package/package.json +31 -18
  145. package/lib/ModelContainer.d.ts +0 -17
  146. package/lib/ModelContainer.js +0 -65
  147. package/lib/client/components/Git.d.ts +0 -2
  148. package/lib/client/components/Select.d.ts +0 -3
  149. package/lib/client/components/Select.js +0 -2
  150. package/lib/client/components/typeInputs/ArrayTypeInput.d.ts +0 -13
  151. package/lib/client/components/typeInputs/EnumTypeInput.d.ts +0 -13
  152. package/lib/client/components/typeInputs/GenericTypeArgumentIdentifierTypeInput.d.ts +0 -7
  153. package/lib/client/components/typeInputs/IncludeIdentifierTypeInput.d.ts +0 -13
  154. package/lib/client/components/typeInputs/NestedEntityMapTypeInput.d.ts +0 -13
  155. package/lib/client/components/typeInputs/ReferenceIdentifierTypeInput.js +0 -9
  156. package/lib/client/components/typeInputs/TypeInput.d.ts +0 -13
  157. package/lib/client/hooks/useAPIResource.d.ts +0 -1
  158. package/lib/client/hooks/useMappedAPIResource.d.ts +0 -1
  159. package/lib/client/routes/Entity.d.ts +0 -2
  160. package/lib/client/routes/Home.d.ts +0 -2
  161. package/lib/client/utils/typeSkeleton.d.ts +0 -3
  162. package/lib/schema/types/Type.d.ts +0 -48
  163. package/lib/schema/types/primitives/PrimitiveType.d.ts +0 -6
  164. package/lib/schema/types/references/GenericArgumentIdentifierType.d.ts +0 -22
  165. package/lib/schema/types/references/GenericArgumentIdentifierType.js +0 -19
  166. package/lib/schema/validation/type.d.ts +0 -4
  167. package/lib/server/index.d.ts +0 -29
  168. package/lib/server/init.d.ts +0 -5
  169. package/lib/tsconfig.tsbuildinfo +0 -1
  170. package/lib/utils/object.d.ts +0 -3
  171. package/lib/utils/object.js +0 -1
  172. /package/lib/{renderers → node/renderers}/Output.js +0 -0
  173. /package/lib/{schema → node/schema}/types/primitives/BooleanType.js +0 -0
  174. /package/lib/{schema → node/schema}/types/primitives/NumericType.js +0 -0
  175. /package/lib/{schema → node/schema}/types/primitives/PrimitiveType.js +0 -0
  176. /package/lib/{schema → node/schema}/validation/options.d.ts +0 -0
  177. /package/lib/{schema → node/schema}/validation/options.js +0 -0
  178. /package/lib/{schema → node/schema}/validation/type.js +0 -0
  179. /package/lib/{server → node/server}/api/declarations.d.ts +0 -0
  180. /package/lib/{server → node/server}/api/git.d.ts +0 -0
  181. /package/lib/{server → node/server}/api/index.d.ts +0 -0
  182. /package/lib/{server → node/server}/api/index.js +0 -0
  183. /package/lib/{server → node/server}/api/instances.d.ts +0 -0
  184. /package/lib/{utils → node/utils}/error.d.ts +0 -0
  185. /package/lib/{utils → node/utils}/git.js +0 -0
  186. /package/lib/{utils → node/utils}/path.d.ts +0 -0
  187. /package/lib/{utils → node/utils}/path.js +0 -0
  188. /package/lib/{utils → node/utils}/render.d.ts +0 -0
  189. /package/lib/{utils → shared/utils}/enum.d.ts +0 -0
  190. /package/lib/{utils → shared/utils}/enum.js +0 -0
  191. /package/lib/{utils → shared/utils}/lazy.d.ts +0 -0
  192. /package/lib/{utils → shared/utils}/result.d.ts +0 -0
  193. /package/lib/{client → web}/components/typeInputs/BooleanTypeInput.js +0 -0
  194. /package/lib/{client → web}/components/typeInputs/DateTypeInput.js +0 -0
  195. /package/lib/{client → web}/components/typeInputs/FloatTypeInput.js +0 -0
  196. /package/lib/{client → web}/components/typeInputs/IncludeIdentifierTypeInput.js +0 -0
  197. /package/lib/{client → web}/components/typeInputs/IntegerTypeInput.js +0 -0
  198. /package/lib/{client → web}/components/typeInputs/StringTypeInput.js +0 -0
  199. /package/lib/{client → web}/components/typeInputs/utils/MismatchingTypeError.js +0 -0
  200. /package/lib/{client → web}/components/typeInputs/utils/ValidationErrors.js +0 -0
  201. /package/lib/{client → web}/hooks/useAPIResource.js +0 -0
  202. /package/lib/{client → web}/index.d.ts +0 -0
  203. /package/lib/{client → web}/index.js +0 -0
  204. /package/lib/{client → web}/routes/Home.js +0 -0
  205. /package/lib/{client → web}/routes/NotFound.js +0 -0
@@ -0,0 +1,8 @@
1
+ import type { Output } from "./renderers/Output.ts";
2
+ import type { Schema } from "./Schema.ts";
3
+ import type { ServerOptions } from "./server/index.ts";
4
+ export declare const generateOutputs: (schema: Schema, outputs: Output[]) => Promise<void>;
5
+ export declare const validate: (schema: Schema, dataRootPath: string) => Promise<void>;
6
+ export declare const generateAndValidate: (schema: Schema, outputs: Output[], dataRootPath: string) => Promise<void>;
7
+ export declare const serve: (schema: Schema, dataRootPath: string, serverOptions?: Partial<ServerOptions>) => Promise<void>;
8
+ export declare const generateValidateAndServe: (schema: Schema, outputs: Output[], dataRootPath: string, serverOptions?: Partial<ServerOptions>) => Promise<void>;
@@ -0,0 +1,62 @@
1
+ import Debug from "debug";
2
+ import { mkdir } from "fs/promises";
3
+ import { join } from "path";
4
+ import { parallelizeErrors } from "../shared/utils/validation.js";
5
+ import { getEntities } from "./Schema.js";
6
+ import { createValidators, validateEntityDecl } from "./schema/index.js";
7
+ import { createServer } from "./server/index.js";
8
+ import { getErrorMessageForDisplay, wrapErrorsIfAny } from "./utils/error.js";
9
+ import { getInstancesByEntityName } from "./utils/instances.js";
10
+ const debug = Debug("tsondb:schema");
11
+ const prepareFolders = async (dataRootPath, entities) => {
12
+ await mkdir(dataRootPath, { recursive: true });
13
+ for (const entity of entities) {
14
+ const entityDir = join(dataRootPath, entity.name);
15
+ await mkdir(entityDir, { recursive: true });
16
+ }
17
+ };
18
+ export const generateOutputs = async (schema, outputs) => {
19
+ for (const output of outputs) {
20
+ await output.run(schema);
21
+ }
22
+ };
23
+ const _validate = (entities, instancesByEntityName) => {
24
+ const errors = entities.flatMap(entity => parallelizeErrors(instancesByEntityName[entity.name]?.map(instance => wrapErrorsIfAny(`in file "${entity.name}/${instance.fileName}"`, validateEntityDecl(createValidators(instancesByEntityName), entity, instance.content))) ?? []));
25
+ if (errors.length === 0) {
26
+ debug("All entities are valid");
27
+ }
28
+ else {
29
+ debug("Errors:\n");
30
+ for (const error of errors) {
31
+ debug(getErrorMessageForDisplay(error) + "\n");
32
+ }
33
+ throw new Error("Validation failed");
34
+ }
35
+ };
36
+ export const validate = async (schema, dataRootPath) => {
37
+ const entities = getEntities(schema);
38
+ await prepareFolders(dataRootPath, entities);
39
+ const instancesByEntityName = await getInstancesByEntityName(dataRootPath, entities);
40
+ _validate(entities, instancesByEntityName);
41
+ };
42
+ export const generateAndValidate = async (schema, outputs, dataRootPath) => {
43
+ await generateOutputs(schema, outputs);
44
+ const entities = getEntities(schema);
45
+ await prepareFolders(dataRootPath, entities);
46
+ const instancesByEntityName = await getInstancesByEntityName(dataRootPath, entities);
47
+ _validate(entities, instancesByEntityName);
48
+ };
49
+ export const serve = async (schema, dataRootPath, serverOptions) => {
50
+ const entities = getEntities(schema);
51
+ await prepareFolders(dataRootPath, entities);
52
+ const instancesByEntityName = await getInstancesByEntityName(dataRootPath, entities);
53
+ await createServer(schema, dataRootPath, instancesByEntityName, serverOptions);
54
+ };
55
+ export const generateValidateAndServe = async (schema, outputs, dataRootPath, serverOptions) => {
56
+ await generateOutputs(schema, outputs);
57
+ const entities = getEntities(schema);
58
+ await prepareFolders(dataRootPath, entities);
59
+ const instancesByEntityName = await getInstancesByEntityName(dataRootPath, entities);
60
+ _validate(entities, instancesByEntityName);
61
+ await createServer(schema, dataRootPath, instancesByEntityName, serverOptions);
62
+ };
@@ -1,4 +1,4 @@
1
- import { Schema } from "../Schema.js";
1
+ import type { Schema } from "../Schema.js";
2
2
  export interface Output {
3
3
  run: (schema: Schema) => Promise<void>;
4
4
  }
@@ -1,5 +1,5 @@
1
- import { Output } from "../Output.js";
2
- import { JsonSchemaRendererOptions } from "./render.js";
1
+ import type { Output } from "../Output.js";
2
+ import type { JsonSchemaRendererOptions } from "./render.js";
3
3
  export declare const JsonSchemaOutput: (options: {
4
4
  targetPath: string;
5
5
  rendererOptions?: Partial<JsonSchemaRendererOptions>;
@@ -1,8 +1,8 @@
1
1
  import { mkdir, rm, writeFile } from "node:fs/promises";
2
2
  import { basename, dirname, extname, join, relative } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
+ import { commonPrefix } from "../../../shared/utils/string.js";
4
5
  import { groupDeclarationsBySourceUrl, resolveTypeArgumentsInDecls } from "../../schema/index.js";
5
- import { commonPrefix } from "../../shared/utils/string.js";
6
6
  import { render } from "./render.js";
7
7
  const extension = ".schema.json";
8
8
  export const JsonSchemaOutput = (options) => ({
@@ -19,7 +19,7 @@ export const JsonSchemaOutput = (options) => ({
19
19
  const newDir = join(options.targetPath, relativePath);
20
20
  const newPath = join(newDir, basename(sourcePath, extname(sourcePath)) + extension);
21
21
  await mkdir(newDir, { recursive: true });
22
- await writeFile(newPath, render(options.rendererOptions, decls), {
22
+ await writeFile(newPath, render(options.rendererOptions, decls ?? []), {
23
23
  encoding: "utf-8",
24
24
  });
25
25
  }
@@ -1,4 +1,4 @@
1
- import { Decl } from "../../schema/declarations/Declaration.js";
1
+ import type { Decl } from "../../schema/declarations/Declaration.js";
2
2
  export type JsonSchemaRendererOptions = {
3
3
  format: "minified" | "tabs" | {
4
4
  kind: "spaces";
@@ -1,11 +1,11 @@
1
1
  import { dirname, relative } from "node:path";
2
+ import { discriminatorKey } from "../../../shared/enum.js";
3
+ import { assertExhaustive } from "../../../shared/utils/typeSafety.js";
2
4
  import { addEphemeralUUIDToType, createEntityIdentifierTypeAsDecl, isEntityDecl, } from "../../schema/declarations/EntityDecl.js";
3
5
  import { TypeAliasDecl } from "../../schema/declarations/TypeAliasDecl.js";
4
6
  import { flatMapAuxiliaryDecls, NodeKind } from "../../schema/Node.js";
5
- import { isNestedEntityMapType, } from "../../schema/types/references/NestedEntityMapType.js";
7
+ import { isNestedEntityMapType } from "../../schema/types/references/NestedEntityMapType.js";
6
8
  import { getParentDecl } from "../../schema/types/Type.js";
7
- import { discriminatorKey } from "../../shared/enum.js";
8
- import { assertExhaustive } from "../../shared/utils/typeSafety.js";
9
9
  import { ensureSpecialDirStart } from "../../utils/path.js";
10
10
  const defaultIndentation = 2;
11
11
  const defaultOptions = {
@@ -67,8 +67,8 @@ const renderStringType = (_options, type) => ({
67
67
  maxLength: type.maxLength,
68
68
  pattern: type.pattern?.source,
69
69
  });
70
- const renderGenericArgumentIdentifierType = (_options, _type) => {
71
- throw new TypeError("GenericArgumentIdentifierType is not supported in JSON Schema.");
70
+ const renderTypeArgumentType = (_options, _type) => {
71
+ throw new TypeError("TypeArgumentType is not supported in JSON Schema.");
72
72
  };
73
73
  const renderReferenceIdentifierType = (_options, type) => ({
74
74
  $ref: `#/$defs/${type.entity.name}_ID`,
@@ -98,7 +98,7 @@ const renderEnumType = (options, type) => ({
98
98
  },
99
99
  ...(caseDef.type === null ? {} : { [caseName]: renderType(options, caseDef.type) }),
100
100
  },
101
- required: [discriminatorKey, ...(caseDef === null ? [] : [caseName])],
101
+ required: [discriminatorKey, ...(caseDef.type === null ? [] : [caseName])],
102
102
  })),
103
103
  });
104
104
  const renderType = (options, type) => {
@@ -117,8 +117,8 @@ const renderType = (options, type) => {
117
117
  return renderIntegerType(options, type);
118
118
  case NodeKind.StringType:
119
119
  return renderStringType(options, type);
120
- case NodeKind.GenericArgumentIdentifierType:
121
- return renderGenericArgumentIdentifierType(options, type);
120
+ case NodeKind.TypeArgumentType:
121
+ return renderTypeArgumentType(options, type);
122
122
  case NodeKind.ReferenceIdentifierType:
123
123
  return renderReferenceIdentifierType(options, type);
124
124
  case NodeKind.IncludeIdentifierType:
@@ -179,5 +179,5 @@ export const render = (options = defaultOptions, declarations) => {
179
179
  ? undefined
180
180
  : finalOptions.format === "tabs"
181
181
  ? "\t"
182
- : finalOptions.format.indentation ?? defaultIndentation);
182
+ : (finalOptions.format.indentation ?? defaultIndentation));
183
183
  };
@@ -1,5 +1,5 @@
1
- import { Output } from "../Output.js";
2
- import { TypeScriptRendererOptions } from "./render.js";
1
+ import type { Output } from "../Output.js";
2
+ import type { TypeScriptRendererOptions } from "./render.js";
3
3
  export declare const TypeScriptOutput: (options: {
4
4
  targetPath: string;
5
5
  rendererOptions?: Partial<TypeScriptRendererOptions>;
@@ -2,8 +2,8 @@ import Debug from "debug";
2
2
  import { mkdir, rm, writeFile } from "node:fs/promises";
3
3
  import { basename, dirname, extname, join, relative } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
+ import { commonPrefix } from "../../../shared/utils/string.js";
5
6
  import { groupDeclarationsBySourceUrl } from "../../schema/declarations/Declaration.js";
6
- import { commonPrefix } from "../../shared/utils/string.js";
7
7
  import { render } from "./render.js";
8
8
  const debug = Debug("tsondb:renderer:ts");
9
9
  const extension = ".d.ts";
@@ -23,7 +23,7 @@ export const TypeScriptOutput = (options) => ({
23
23
  const newDir = join(options.targetPath, relativePath);
24
24
  const newPath = join(newDir, basename(sourcePath, extname(sourcePath)) + extension);
25
25
  await mkdir(newDir, { recursive: true });
26
- await writeFile(newPath, render(options.rendererOptions, decls), {
26
+ await writeFile(newPath, render(options.rendererOptions, decls ?? []), {
27
27
  encoding: "utf-8",
28
28
  });
29
29
  }
@@ -1,4 +1,4 @@
1
- import { Decl } from "../../schema/declarations/Declaration.js";
1
+ import type { Decl } from "../../schema/declarations/Declaration.js";
2
2
  export type TypeScriptRendererOptions = {
3
3
  indentation: number;
4
4
  objectTypeKeyword: "interface" | "type";
@@ -1,14 +1,14 @@
1
1
  import { EOL } from "node:os";
2
2
  import { dirname, relative } from "node:path";
3
+ import { discriminatorKey } from "../../../shared/enum.js";
4
+ import { toCamelCase } from "../../../shared/utils/string.js";
5
+ import { assertExhaustive } from "../../../shared/utils/typeSafety.js";
3
6
  import { addEphemeralUUIDToType, createEntityIdentifierTypeAsDecl, isEntityDecl, } from "../../schema/declarations/EntityDecl.js";
4
7
  import { TypeAliasDecl } from "../../schema/declarations/TypeAliasDecl.js";
5
8
  import { flatMapAuxiliaryDecls, NodeKind } from "../../schema/Node.js";
6
9
  import { isObjectType } from "../../schema/types/generic/ObjectType.js";
7
- import { isNestedEntityMapType, } from "../../schema/types/references/NestedEntityMapType.js";
10
+ import { isNestedEntityMapType } from "../../schema/types/references/NestedEntityMapType.js";
8
11
  import { getParentDecl } from "../../schema/types/Type.js";
9
- import { discriminatorKey } from "../../shared/enum.js";
10
- import { toCamelCase } from "../../shared/utils/string.js";
11
- import { assertExhaustive } from "../../shared/utils/typeSafety.js";
12
12
  import { ensureSpecialDirStart } from "../../utils/path.js";
13
13
  import { combineSyntaxes, indent, prefixLines, syntax } from "../../utils/render.js";
14
14
  const defaultOptions = {
@@ -39,7 +39,7 @@ const renderBooleanType = (_options, _type) => syntax `boolean`;
39
39
  const renderDateType = (_options, _type) => syntax `Date`;
40
40
  const renderNumericType = (_options, _type) => syntax `number`;
41
41
  const renderStringType = (_options, _type) => syntax `string`;
42
- const renderGenericArgumentIdentifierType = (_options, type) => syntax `${type.argument.name}`;
42
+ const renderTypeArgumentType = (_options, type) => syntax `${type.argument.name}`;
43
43
  const renderReferenceIdentifierType = (_options, type) => [
44
44
  { [type.entity.sourceUrl]: [type.entity.name + "_ID"] },
45
45
  type.entity.name + "_ID",
@@ -70,8 +70,8 @@ const renderType = (options, type) => {
70
70
  return renderNumericType(options, type);
71
71
  case NodeKind.StringType:
72
72
  return renderStringType(options, type);
73
- case NodeKind.GenericArgumentIdentifierType:
74
- return renderGenericArgumentIdentifierType(options, type);
73
+ case NodeKind.TypeArgumentType:
74
+ return renderTypeArgumentType(options, type);
75
75
  case NodeKind.ReferenceIdentifierType:
76
76
  return renderReferenceIdentifierType(options, type);
77
77
  case NodeKind.IncludeIdentifierType:
@@ -130,6 +130,7 @@ export const render = (options = defaultOptions, declarations) => {
130
130
  return undefined;
131
131
  }, declarations));
132
132
  return finalOptions.preserveFiles
133
- ? renderImports(declarations[0].sourceUrl, imports) + content
133
+ ? (declarations[0] === undefined ? "" : renderImports(declarations[0].sourceUrl, imports)) +
134
+ content
134
135
  : content;
135
136
  };
@@ -1,6 +1,6 @@
1
- import { InstancesByEntityName } from "../shared/utils/instances.js";
2
- import { Decl } from "./declarations/Declaration.js";
3
- import { Type } from "./types/Type.js";
1
+ import type { InstancesByEntityName } from "../../shared/utils/instances.js";
2
+ import type { Decl } from "./declarations/Declaration.js";
3
+ import type { Type } from "./types/Type.js";
4
4
  export interface NodeKind {
5
5
  EntityDecl: "EntityDecl";
6
6
  EnumDecl: "EnumDecl";
@@ -14,7 +14,7 @@ export interface NodeKind {
14
14
  IntegerType: "IntegerType";
15
15
  StringType: "StringType";
16
16
  DateType: "DateType";
17
- GenericArgumentIdentifierType: "GenericArgumentIdentifierType";
17
+ TypeArgumentType: "TypeArgumentType";
18
18
  GenericParameter: "GenericParameter";
19
19
  ReferenceIdentifierType: "ReferenceIdentifierType";
20
20
  IncludeIdentifierType: "IncludeIdentifierType";
@@ -1,5 +1,5 @@
1
- import { assertExhaustive } from "../shared/utils/typeSafety.js";
2
- import { enumOfObject } from "../utils/enum.js";
1
+ import { enumOfObject } from "../../shared/utils/enum.js";
2
+ import { assertExhaustive } from "../../shared/utils/typeSafety.js";
3
3
  export const NodeKind = enumOfObject({
4
4
  EntityDecl: null,
5
5
  EnumDecl: null,
@@ -13,7 +13,7 @@ export const NodeKind = enumOfObject({
13
13
  IntegerType: null,
14
14
  StringType: null,
15
15
  DateType: null,
16
- GenericArgumentIdentifierType: null,
16
+ TypeArgumentType: null,
17
17
  GenericParameter: null,
18
18
  ReferenceIdentifierType: null,
19
19
  IncludeIdentifierType: null,
@@ -48,7 +48,7 @@ export const flatMapAuxiliaryDecls = (callbackFn, declarations) => {
48
48
  case NodeKind.FloatType:
49
49
  case NodeKind.IntegerType:
50
50
  case NodeKind.StringType:
51
- case NodeKind.GenericArgumentIdentifierType:
51
+ case NodeKind.TypeArgumentType:
52
52
  case NodeKind.ReferenceIdentifierType:
53
53
  case NodeKind.IncludeIdentifierType:
54
54
  case NodeKind.NestedEntityMapType:
@@ -74,7 +74,7 @@ export const flatMapAuxiliaryDecls = (callbackFn, declarations) => {
74
74
  return declarations.reduce((decls, node) => mapNodeTree(reducer, node, [...decls, node]), []);
75
75
  };
76
76
  export const createValidators = (instancesByEntityName) => ({
77
- checkReferentialIntegrity: ({ name, value }) => instancesByEntityName[name].some(instance => typeof instance.content === "object" &&
77
+ checkReferentialIntegrity: ({ name, value }) => instancesByEntityName[name]?.some(instance => typeof instance.content === "object" &&
78
78
  instance.content !== null &&
79
79
  !Array.isArray(instance.content) &&
80
80
  instance.id === value)
@@ -1,5 +1,6 @@
1
- import { NodeKind, Serializer } from "../Node.js";
2
- import { SerializedBaseType, SerializedType, Type } from "../types/Type.js";
1
+ import type { Serializer } from "./Node.js";
2
+ import { NodeKind } from "./Node.js";
3
+ import type { SerializedBaseType, SerializedType, Type } from "./types/Type.js";
3
4
  export interface TypeParameter<N extends string = string, T extends Type = Type> {
4
5
  kind: NodeKind["GenericParameter"];
5
6
  name: N;
@@ -1,5 +1,5 @@
1
- import { NodeKind } from "../Node.js";
2
- import { removeParentKey, serializeType, } from "../types/Type.js";
1
+ import { NodeKind } from "./Node.js";
2
+ import { removeParentKey, serializeType } from "./types/Type.js";
3
3
  export const Param = (name, constraint) => ({
4
4
  kind: NodeKind.GenericParameter,
5
5
  name,
@@ -1,12 +1,11 @@
1
- import { BaseNode, GetReferences, Node, Serializer } from "../Node.js";
2
- import { SerializedTypeParameter, TypeParameter } from "../parameters/TypeParameter.js";
3
- import { EnumCaseDecl, SerializedEnumCaseDecl } from "../types/generic/EnumType.js";
4
- import { ObjectType, SerializedObjectType } from "../types/generic/ObjectType.js";
5
- import { SerializedType, Type } from "../types/Type.js";
6
- import { ValidatorHelpers } from "../validation/type.js";
7
- import { EntityDecl, SerializedEntityDecl } from "./EntityDecl.js";
8
- import { EnumDecl, SerializedEnumDecl } from "./EnumDecl.js";
9
- import { SerializedTypeAliasDecl, TypeAliasDecl } from "./TypeAliasDecl.js";
1
+ import type { BaseNode, GetReferences, Node, Serializer } from "../Node.js";
2
+ import type { SerializedTypeParameter, TypeParameter } from "../TypeParameter.js";
3
+ import type { EnumCaseDecl, SerializedEnumCaseDecl } from "../types/generic/EnumType.js";
4
+ import type { SerializedType, Type } from "../types/Type.js";
5
+ import type { ValidatorHelpers } from "../validation/type.js";
6
+ import type { EntityDecl, SerializedEntityDecl } from "./EntityDecl.js";
7
+ import type { EnumDecl, SerializedEnumDecl } from "./EnumDecl.js";
8
+ import type { SerializedTypeAliasDecl, TypeAliasDecl } from "./TypeAliasDecl.js";
10
9
  export type TypeArguments<Params extends TypeParameter[]> = {
11
10
  [K in keyof Params]: Params[K] extends TypeParameter<string, infer T> ? T : Type;
12
11
  };
@@ -17,8 +16,8 @@ export declare const getParameterNames: (decl: Decl) => string[];
17
16
  export declare const getTypeArgumentsRecord: <Params extends TypeParameter[]>(decl: DeclP<Params>, args: TypeArguments<Params>) => Record<string, Type>;
18
17
  export type Decl = EntityDecl | EnumDecl | TypeAliasDecl;
19
18
  export type SerializedDecl = SerializedEntityDecl | SerializedEnumDecl | SerializedTypeAliasDecl;
20
- export type DeclP<Params extends TypeParameter[] = TypeParameter[]> = EntityDecl<string, ObjectType> | EnumDecl<string, Record<string, EnumCaseDecl>, Params> | TypeAliasDecl<string, Type, Params>;
21
- export type SerializedDeclP<Params extends SerializedTypeParameter[] = SerializedTypeParameter[]> = SerializedEntityDecl<string, SerializedObjectType> | SerializedEnumDecl<string, Record<string, SerializedEnumCaseDecl>, Params> | SerializedTypeAliasDecl<string, SerializedType, Params>;
19
+ export type DeclP<Params extends TypeParameter[] = TypeParameter[]> = EntityDecl | EnumDecl<string, Record<string, EnumCaseDecl>, Params> | TypeAliasDecl<string, Type, Params>;
20
+ export type SerializedDeclP<Params extends SerializedTypeParameter[] = SerializedTypeParameter[]> = SerializedEntityDecl | SerializedEnumDecl<string, Record<string, SerializedEnumCaseDecl>, Params> | SerializedTypeAliasDecl<string, SerializedType, Params>;
22
21
  export type SecondaryDecl = EnumDecl | TypeAliasDecl;
23
22
  export type SerializedSecondaryDecl = SerializedEnumDecl | SerializedTypeAliasDecl;
24
23
  export declare const getNestedDeclarations: GetNestedDeclarations;
@@ -1,8 +1,8 @@
1
- import { assertExhaustive } from "../../shared/utils/typeSafety.js";
1
+ import { assertExhaustive } from "../../../shared/utils/typeSafety.js";
2
2
  import { NodeKind } from "../Node.js";
3
3
  import { getNestedDeclarationsInArrayType } from "../types/generic/ArrayType.js";
4
- import { getNestedDeclarationsInEnumType, } from "../types/generic/EnumType.js";
5
- import { getNestedDeclarationsInObjectType, } from "../types/generic/ObjectType.js";
4
+ import { getNestedDeclarationsInEnumType } from "../types/generic/EnumType.js";
5
+ import { getNestedDeclarationsInObjectType } from "../types/generic/ObjectType.js";
6
6
  import { getNestedDeclarationsInIncludeIdentifierType } from "../types/references/IncludeIdentifierType.js";
7
7
  import { getNestedDeclarationsInNestedEntityMapType } from "../types/references/NestedEntityMapType.js";
8
8
  import { getNestedDeclarationsInReferenceIdentifierType } from "../types/references/ReferenceIdentifierType.js";
@@ -10,7 +10,9 @@ import { getNestedDeclarationsInEntityDecl, getReferencesForEntityDecl, isEntity
10
10
  import { getNestedDeclarationsInEnumDecl, getReferencesForEnumDecl, isEnumDecl, resolveTypeArgumentsInEnumDecl, serializeEnumDecl, validateEnumDecl, } from "./EnumDecl.js";
11
11
  import { getNestedDeclarationsInTypeAliasDecl, getReferencesForTypeAliasDecl, isTypeAliasDecl, resolveTypeArgumentsInTypeAliasDecl, serializeTypeAliasDecl, validateTypeAliasDecl, } from "./TypeAliasDecl.js";
12
12
  export const getParameterNames = (decl) => decl.parameters.map(param => param.name);
13
- export const getTypeArgumentsRecord = (decl, args) => Object.fromEntries(args.map((arg, i) => [decl.parameters[i].name, arg]));
13
+ export const getTypeArgumentsRecord = (decl, args) => Object.fromEntries(
14
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
15
+ args.slice(0, decl.parameters.length).map((arg, i) => [decl.parameters[i].name, arg]));
14
16
  export const getNestedDeclarations = (addedDecls, node) => {
15
17
  switch (node.kind) {
16
18
  case NodeKind.EntityDecl:
@@ -28,7 +30,7 @@ export const getNestedDeclarations = (addedDecls, node) => {
28
30
  case NodeKind.FloatType:
29
31
  case NodeKind.IntegerType:
30
32
  case NodeKind.StringType:
31
- case NodeKind.GenericArgumentIdentifierType:
33
+ case NodeKind.TypeArgumentType:
32
34
  return addedDecls;
33
35
  case NodeKind.ReferenceIdentifierType:
34
36
  return getNestedDeclarationsInReferenceIdentifierType(addedDecls, node);
@@ -1,11 +1,12 @@
1
- import { Lazy } from "../../utils/lazy.js";
2
- import { Leaves } from "../../utils/object.js";
3
- import { GetReferences, Node, NodeKind, Serializer } from "../Node.js";
4
- import { MemberDecl, ObjectType, SerializedObjectType } from "../types/generic/ObjectType.js";
1
+ import { Lazy } from "../../../shared/utils/lazy.js";
2
+ import type { Leaves } from "../../../shared/utils/object.js";
3
+ import type { GetReferences, Node, Serializer } from "../Node.js";
4
+ import { NodeKind } from "../Node.js";
5
+ import type { MemberDecl, ObjectType, SerializedObjectType } from "../types/generic/ObjectType.js";
5
6
  import { StringType } from "../types/primitives/StringType.js";
6
- import { AsType, SerializedAsType, Type } from "../types/Type.js";
7
- import { ValidatorHelpers } from "../validation/type.js";
8
- import { BaseDecl, GetNestedDeclarations, SerializedBaseDecl } from "./Declaration.js";
7
+ import type { AsType, SerializedAsType } from "../types/Type.js";
8
+ import type { ValidatorHelpers } from "../validation/type.js";
9
+ import type { BaseDecl, GetNestedDeclarations, SerializedBaseDecl } from "./Declaration.js";
9
10
  import { TypeAliasDecl } from "./TypeAliasDecl.js";
10
11
  export interface EntityDecl<Name extends string = string, T extends ObjectType = ObjectType> extends BaseDecl<Name, []> {
11
12
  kind: NodeKind["EntityDecl"];
@@ -70,10 +71,10 @@ export declare const isEntityDecl: (node: Node) => node is EntityDecl;
70
71
  export declare const getNestedDeclarationsInEntityDecl: GetNestedDeclarations<EntityDecl>;
71
72
  export declare const validateEntityDecl: (helpers: ValidatorHelpers, decl: EntityDecl, value: unknown) => Error[];
72
73
  export declare const resolveTypeArgumentsInEntityDecl: (decl: EntityDecl) => EntityDecl;
73
- export declare const addEphemeralUUIDToType: <T extends Record<string, MemberDecl<Type, boolean>>>(decl: EntityDecl<string, ObjectType<T>>) => ObjectType<Omit<T, "id"> & {
74
+ export declare const addEphemeralUUIDToType: <T extends Record<string, MemberDecl>>(decl: EntityDecl<string, ObjectType<T>>) => ObjectType<Omit<T, "id"> & {
74
75
  id: MemberDecl<StringType, true>;
75
76
  }>;
76
77
  export declare const createEntityIdentifierType: () => StringType;
77
- export declare const createEntityIdentifierTypeAsDecl: <Name extends string>(decl: EntityDecl<Name, ObjectType>) => TypeAliasDecl<`${Name}_ID`, StringType, []>;
78
+ export declare const createEntityIdentifierTypeAsDecl: <Name extends string>(decl: EntityDecl<Name>) => TypeAliasDecl<`${Name}_ID`, StringType, []>;
78
79
  export declare const serializeEntityDecl: Serializer<EntityDecl, SerializedEntityDecl>;
79
80
  export declare const getReferencesForEntityDecl: GetReferences<EntityDecl>;
@@ -1,9 +1,9 @@
1
- import { Lazy } from "../../utils/lazy.js";
1
+ import { Lazy } from "../../../shared/utils/lazy.js";
2
2
  import { NodeKind } from "../Node.js";
3
3
  import { getNestedDeclarationsInObjectType, getReferencesForObjectType, Required, resolveTypeArgumentsInObjectType, serializeObjectType, } from "../types/generic/ObjectType.js";
4
4
  import { StringType } from "../types/primitives/StringType.js";
5
5
  import { validate } from "../types/Type.js";
6
- import { validateDeclName, } from "./Declaration.js";
6
+ import { validateDeclName } from "./Declaration.js";
7
7
  import { TypeAliasDecl } from "./TypeAliasDecl.js";
8
8
  export const EntityDecl = (sourceUrl, options) => {
9
9
  validateDeclName(options.name);
@@ -1,10 +1,12 @@
1
- import { Lazy } from "../../utils/lazy.js";
2
- import { GetReferences, Node, NodeKind, Serializer } from "../Node.js";
3
- import { SerializedTypeParameter, TypeParameter } from "../parameters/TypeParameter.js";
4
- import { EnumCaseDecl, EnumType, SerializedEnumCaseDecl, SerializedEnumType } from "../types/generic/EnumType.js";
5
- import { Type } from "../types/Type.js";
6
- import { ValidatorHelpers } from "../validation/type.js";
7
- import { BaseDecl, GetNestedDeclarations, SerializedBaseDecl, TypeArguments } from "./Declaration.js";
1
+ import { Lazy } from "../../../shared/utils/lazy.js";
2
+ import type { GetReferences, Node, Serializer } from "../Node.js";
3
+ import { NodeKind } from "../Node.js";
4
+ import type { SerializedTypeParameter, TypeParameter } from "../TypeParameter.js";
5
+ import type { EnumCaseDecl, SerializedEnumCaseDecl, SerializedEnumType } from "../types/generic/EnumType.js";
6
+ import { EnumType } from "../types/generic/EnumType.js";
7
+ import type { Type } from "../types/Type.js";
8
+ import type { ValidatorHelpers } from "../validation/type.js";
9
+ import type { BaseDecl, GetNestedDeclarations, SerializedBaseDecl, TypeArguments } from "./Declaration.js";
8
10
  export interface EnumDecl<Name extends string = string, T extends Record<string, EnumCaseDecl> = Record<string, EnumCaseDecl>, Params extends TypeParameter[] = TypeParameter[]> extends BaseDecl<Name, Params> {
9
11
  kind: NodeKind["EnumDecl"];
10
12
  type: Lazy<EnumType<T>>;
@@ -1,8 +1,8 @@
1
- import { Lazy } from "../../utils/lazy.js";
1
+ import { Lazy } from "../../../shared/utils/lazy.js";
2
2
  import { NodeKind } from "../Node.js";
3
- import { serializeTypeParameter, } from "../parameters/TypeParameter.js";
3
+ import { serializeTypeParameter } from "../TypeParameter.js";
4
4
  import { EnumType, getNestedDeclarationsInEnumType, getReferencesForEnumType, resolveTypeArgumentsInEnumType, serializeEnumType, validateEnumType, } from "../types/generic/EnumType.js";
5
- import { getTypeArgumentsRecord, validateDeclName, } from "./Declaration.js";
5
+ import { getTypeArgumentsRecord, validateDeclName } from "./Declaration.js";
6
6
  export const GenEnumDecl = (sourceUrl, options) => {
7
7
  validateDeclName(options.name);
8
8
  const decl = {
@@ -1,9 +1,10 @@
1
- import { Lazy } from "../../utils/lazy.js";
2
- import { GetReferences, Node, NodeKind, Serializer } from "../Node.js";
3
- import { SerializedTypeParameter, TypeParameter } from "../parameters/TypeParameter.js";
4
- import { SerializedType, Type } from "../types/Type.js";
5
- import { ValidatorHelpers } from "../validation/type.js";
6
- import { BaseDecl, GetNestedDeclarations, SerializedBaseDecl, TypeArguments } from "./Declaration.js";
1
+ import { Lazy } from "../../../shared/utils/lazy.js";
2
+ import type { GetReferences, Node, Serializer } from "../Node.js";
3
+ import { NodeKind } from "../Node.js";
4
+ import type { SerializedTypeParameter, TypeParameter } from "../TypeParameter.js";
5
+ import type { SerializedType, Type } from "../types/Type.js";
6
+ import type { ValidatorHelpers } from "../validation/type.js";
7
+ import type { BaseDecl, GetNestedDeclarations, SerializedBaseDecl, TypeArguments } from "./Declaration.js";
7
8
  export interface TypeAliasDecl<Name extends string = string, T extends Type = Type, Params extends TypeParameter[] = TypeParameter[]> extends BaseDecl<Name, Params> {
8
9
  kind: NodeKind["TypeAliasDecl"];
9
10
  type: Lazy<T>;
@@ -29,7 +30,7 @@ export declare const TypeAliasDecl: <Name extends string, T extends Type>(source
29
30
  type: () => T;
30
31
  }) => TypeAliasDecl<Name, T, []>;
31
32
  export { TypeAliasDecl as TypeAlias };
32
- export declare const isTypeAliasDecl: (node: Node) => node is TypeAliasDecl<string, Type, TypeParameter[]>;
33
+ export declare const isTypeAliasDecl: (node: Node) => node is TypeAliasDecl;
33
34
  export declare const getNestedDeclarationsInTypeAliasDecl: GetNestedDeclarations<TypeAliasDecl>;
34
35
  export declare const validateTypeAliasDecl: <Params extends TypeParameter[]>(helpers: ValidatorHelpers, decl: TypeAliasDecl<string, Type, Params>, args: TypeArguments<Params>, value: unknown) => Error[];
35
36
  export declare const resolveTypeArgumentsInTypeAliasDecl: <Params extends TypeParameter[]>(decl: TypeAliasDecl<string, Type, Params>, args: TypeArguments<Params>) => TypeAliasDecl<string, Type, []>;
@@ -1,8 +1,8 @@
1
- import { Lazy } from "../../utils/lazy.js";
1
+ import { Lazy } from "../../../shared/utils/lazy.js";
2
2
  import { NodeKind } from "../Node.js";
3
- import { serializeTypeParameter, } from "../parameters/TypeParameter.js";
3
+ import { serializeTypeParameter } from "../TypeParameter.js";
4
4
  import { getReferencesForType, resolveTypeArgumentsInType, serializeType, validate, } from "../types/Type.js";
5
- import { getNestedDeclarations, getTypeArgumentsRecord, validateDeclName, } from "./Declaration.js";
5
+ import { getNestedDeclarations, getTypeArgumentsRecord, validateDeclName } from "./Declaration.js";
6
6
  export const GenTypeAliasDecl = (sourceUrl, options) => {
7
7
  validateDeclName(options.name);
8
8
  const decl = {
@@ -3,19 +3,19 @@ export * from "./declarations/EntityDecl.js";
3
3
  export * from "./declarations/EnumDecl.js";
4
4
  export * from "./declarations/TypeAliasDecl.js";
5
5
  export * from "./Node.js";
6
- export * from "./parameters/TypeParameter.js";
6
+ export * from "./TypeParameter.js";
7
7
  export * from "./types/generic/ArrayType.js";
8
- export { EnumCase } from "./types/generic/EnumType.js";
8
+ export * from "./types/generic/EnumType.js";
9
9
  export * from "./types/generic/ObjectType.js";
10
10
  export * from "./types/primitives/BooleanType.js";
11
11
  export * from "./types/primitives/DateType.js";
12
12
  export * from "./types/primitives/FloatType.js";
13
13
  export * from "./types/primitives/IntegerType.js";
14
14
  export * from "./types/primitives/NumericType.js";
15
- export * from "./types/primitives/PrimitiveType.js";
15
+ export type * from "./types/primitives/PrimitiveType.js";
16
16
  export * from "./types/primitives/StringType.js";
17
- export * from "./types/references/GenericArgumentIdentifierType.js";
18
17
  export * from "./types/references/IncludeIdentifierType.js";
19
18
  export * from "./types/references/NestedEntityMapType.js";
20
19
  export * from "./types/references/ReferenceIdentifierType.js";
20
+ export * from "./types/references/TypeArgumentType.js";
21
21
  export * from "./types/Type.js";
@@ -3,19 +3,18 @@ export * from "./declarations/EntityDecl.js";
3
3
  export * from "./declarations/EnumDecl.js";
4
4
  export * from "./declarations/TypeAliasDecl.js";
5
5
  export * from "./Node.js";
6
- export * from "./parameters/TypeParameter.js";
6
+ export * from "./TypeParameter.js";
7
7
  export * from "./types/generic/ArrayType.js";
8
- export { EnumCase } from "./types/generic/EnumType.js";
8
+ export * from "./types/generic/EnumType.js";
9
9
  export * from "./types/generic/ObjectType.js";
10
10
  export * from "./types/primitives/BooleanType.js";
11
11
  export * from "./types/primitives/DateType.js";
12
12
  export * from "./types/primitives/FloatType.js";
13
13
  export * from "./types/primitives/IntegerType.js";
14
14
  export * from "./types/primitives/NumericType.js";
15
- export * from "./types/primitives/PrimitiveType.js";
16
15
  export * from "./types/primitives/StringType.js";
17
- export * from "./types/references/GenericArgumentIdentifierType.js";
18
16
  export * from "./types/references/IncludeIdentifierType.js";
19
17
  export * from "./types/references/NestedEntityMapType.js";
20
18
  export * from "./types/references/ReferenceIdentifierType.js";
19
+ export * from "./types/references/TypeArgumentType.js";
21
20
  export * from "./types/Type.js";