tsondb 0.19.11 → 0.19.12

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 (162) hide show
  1. package/dist/src/{bin → node/bin}/tsondb.js +4 -4
  2. package/dist/src/node/config.d.ts +3 -1
  3. package/dist/src/node/index.d.ts +2 -1
  4. package/dist/src/node/output.d.ts +5 -0
  5. package/dist/src/node/renderers/jsonschema/index.d.ts +1 -1
  6. package/dist/src/node/renderers/ts/index.d.ts +1 -1
  7. package/dist/src/node/schema/dsl/declarations/EntityDecl.d.ts +1 -4
  8. package/dist/src/node/schema/dsl/index.d.ts +1 -1
  9. package/dist/src/node/schema/treeOperations/format.js +0 -1
  10. package/dist/src/node/server/index.d.ts +1 -1
  11. package/dist/src/node/server/index.js +5 -32
  12. package/dist/src/node/server/utils/instanceOperations.d.ts +1 -1
  13. package/dist/src/node/server/utils/instanceOperations.js +1 -1
  14. package/dist/src/node/utils/childInstances.d.ts +2 -26
  15. package/dist/src/node/utils/unique.js +1 -1
  16. package/dist/src/shared/api.d.ts +10 -2
  17. package/dist/src/shared/schema/declarations/Declaration.d.ts +1 -0
  18. package/dist/src/shared/schema/declarations/EntityDecl.d.ts +4 -1
  19. package/dist/src/shared/schema/types/TranslationObjectType.d.ts +1 -1
  20. package/dist/src/shared/schema/types/Type.d.ts +1 -1
  21. package/dist/src/shared/utils/childInstances.d.ts +26 -0
  22. package/dist/src/shared/utils/instances.d.ts +0 -3
  23. package/dist/src/shared/utils/instances.js +1 -10
  24. package/dist/src/web/482.js +7547 -0
  25. package/dist/src/web/712.js +437 -0
  26. package/dist/src/web/rslib-runtime.js +129 -0
  27. package/dist/src/web/web.js +1 -0
  28. package/package.json +10 -5
  29. package/public/css/styles.css +13 -0
  30. package/dist/src/index.d.ts +0 -2
  31. package/dist/src/index.js +0 -1
  32. package/dist/src/shared/output.d.ts +0 -5
  33. package/dist/src/web/api/declarations.d.ts +0 -26
  34. package/dist/src/web/api/declarations.js +0 -51
  35. package/dist/src/web/api/git.d.ts +0 -18
  36. package/dist/src/web/api/git.js +0 -24
  37. package/dist/src/web/api/index.d.ts +0 -1
  38. package/dist/src/web/api/index.js +0 -2
  39. package/dist/src/web/api/instances.d.ts +0 -2
  40. package/dist/src/web/api/instances.js +0 -2
  41. package/dist/src/web/api/search.d.ts +0 -2
  42. package/dist/src/web/api/search.js +0 -7
  43. package/dist/src/web/components/ContextProviderWrapper.d.ts +0 -7
  44. package/dist/src/web/components/ContextProviderWrapper.js +0 -5
  45. package/dist/src/web/components/InstanceRouteSkeleton.d.ts +0 -79
  46. package/dist/src/web/components/InstanceRouteSkeleton.js +0 -194
  47. package/dist/src/web/components/Layout.d.ts +0 -10
  48. package/dist/src/web/components/Layout.js +0 -12
  49. package/dist/src/web/components/LoadingOverlay.d.ts +0 -1
  50. package/dist/src/web/components/LoadingOverlay.js +0 -3
  51. package/dist/src/web/components/ModalDialog.d.ts +0 -2
  52. package/dist/src/web/components/ModalDialog.js +0 -17
  53. package/dist/src/web/components/Select.d.ts +0 -2
  54. package/dist/src/web/components/Select.js +0 -5
  55. package/dist/src/web/components/Settings.d.ts +0 -2
  56. package/dist/src/web/components/Settings.js +0 -55
  57. package/dist/src/web/components/git/Git.d.ts +0 -2
  58. package/dist/src/web/components/git/Git.js +0 -49
  59. package/dist/src/web/components/git/GitBranchManager.d.ts +0 -7
  60. package/dist/src/web/components/git/GitBranchManager.js +0 -17
  61. package/dist/src/web/components/git/GitFileList.d.ts +0 -17
  62. package/dist/src/web/components/git/GitFileList.js +0 -12
  63. package/dist/src/web/components/git/GitFileManager.d.ts +0 -8
  64. package/dist/src/web/components/git/GitFileManager.js +0 -34
  65. package/dist/src/web/components/git/GitStatusIndicator.d.ts +0 -7
  66. package/dist/src/web/components/git/GitStatusIndicator.js +0 -6
  67. package/dist/src/web/components/typeInputs/ArrayTypeInput.d.ts +0 -6
  68. package/dist/src/web/components/typeInputs/ArrayTypeInput.js +0 -26
  69. package/dist/src/web/components/typeInputs/BooleanTypeInput.d.ts +0 -6
  70. package/dist/src/web/components/typeInputs/BooleanTypeInput.js +0 -10
  71. package/dist/src/web/components/typeInputs/ChildEntitiesTypeInput.d.ts +0 -6
  72. package/dist/src/web/components/typeInputs/ChildEntitiesTypeInput.js +0 -77
  73. package/dist/src/web/components/typeInputs/ChildEntitiesTypeInputElement.d.ts +0 -23
  74. package/dist/src/web/components/typeInputs/ChildEntitiesTypeInputElement.js +0 -21
  75. package/dist/src/web/components/typeInputs/DateTypeInput.d.ts +0 -6
  76. package/dist/src/web/components/typeInputs/DateTypeInput.js +0 -13
  77. package/dist/src/web/components/typeInputs/EnumTypeInput.d.ts +0 -6
  78. package/dist/src/web/components/typeInputs/EnumTypeInput.js +0 -72
  79. package/dist/src/web/components/typeInputs/FloatTypeInput.d.ts +0 -6
  80. package/dist/src/web/components/typeInputs/FloatTypeInput.js +0 -20
  81. package/dist/src/web/components/typeInputs/GenericTypeArgumentIdentifierTypeInput.d.ts +0 -6
  82. package/dist/src/web/components/typeInputs/GenericTypeArgumentIdentifierTypeInput.js +0 -4
  83. package/dist/src/web/components/typeInputs/IncludeIdentifierTypeInput.d.ts +0 -6
  84. package/dist/src/web/components/typeInputs/IncludeIdentifierTypeInput.js +0 -10
  85. package/dist/src/web/components/typeInputs/IntegerTypeInput.d.ts +0 -6
  86. package/dist/src/web/components/typeInputs/IntegerTypeInput.js +0 -19
  87. package/dist/src/web/components/typeInputs/NestedEntityMapTypeInput.d.ts +0 -6
  88. package/dist/src/web/components/typeInputs/NestedEntityMapTypeInput.js +0 -41
  89. package/dist/src/web/components/typeInputs/ObjectTypeInput.d.ts +0 -6
  90. package/dist/src/web/components/typeInputs/ObjectTypeInput.js +0 -44
  91. package/dist/src/web/components/typeInputs/ReferenceIdentifierTypeInput.d.ts +0 -6
  92. package/dist/src/web/components/typeInputs/ReferenceIdentifierTypeInput.js +0 -13
  93. package/dist/src/web/components/typeInputs/StringTypeInput.d.ts +0 -6
  94. package/dist/src/web/components/typeInputs/StringTypeInput.js +0 -24
  95. package/dist/src/web/components/typeInputs/TranslationObjectTypeInput.d.ts +0 -6
  96. package/dist/src/web/components/typeInputs/TranslationObjectTypeInput.js +0 -39
  97. package/dist/src/web/components/typeInputs/TypeInput.d.ts +0 -22
  98. package/dist/src/web/components/typeInputs/TypeInput.js +0 -56
  99. package/dist/src/web/components/typeInputs/utils/MismatchingTypeError.d.ts +0 -7
  100. package/dist/src/web/components/typeInputs/utils/MismatchingTypeError.js +0 -4
  101. package/dist/src/web/components/typeInputs/utils/ValidationErrors.d.ts +0 -7
  102. package/dist/src/web/components/typeInputs/utils/ValidationErrors.js +0 -2
  103. package/dist/src/web/context/config.d.ts +0 -11
  104. package/dist/src/web/context/config.js +0 -6
  105. package/dist/src/web/context/entities.d.ts +0 -10
  106. package/dist/src/web/context/entities.js +0 -2
  107. package/dist/src/web/context/git.d.ts +0 -4
  108. package/dist/src/web/context/git.js +0 -2
  109. package/dist/src/web/context/gitClient.d.ts +0 -2
  110. package/dist/src/web/context/gitClient.js +0 -2
  111. package/dist/src/web/context/settings.d.ts +0 -8
  112. package/dist/src/web/context/settings.js +0 -12
  113. package/dist/src/web/hooks/useAPIResource.d.ts +0 -1
  114. package/dist/src/web/hooks/useAPIResource.js +0 -3
  115. package/dist/src/web/hooks/useBoolean.d.ts +0 -1
  116. package/dist/src/web/hooks/useBoolean.js +0 -13
  117. package/dist/src/web/hooks/useEntityFromRoute.d.ts +0 -5
  118. package/dist/src/web/hooks/useEntityFromRoute.js +0 -9
  119. package/dist/src/web/hooks/useGitClient.d.ts +0 -38
  120. package/dist/src/web/hooks/useGitClient.js +0 -317
  121. package/dist/src/web/hooks/useInstanceNamesByEntity.d.ts +0 -3
  122. package/dist/src/web/hooks/useInstanceNamesByEntity.js +0 -23
  123. package/dist/src/web/hooks/useMappedAPIResource.d.ts +0 -1
  124. package/dist/src/web/hooks/useMappedAPIResource.js +0 -15
  125. package/dist/src/web/hooks/useSecondaryDeclarations.d.ts +0 -3
  126. package/dist/src/web/hooks/useSecondaryDeclarations.js +0 -27
  127. package/dist/src/web/hooks/useSettings.d.ts +0 -12
  128. package/dist/src/web/hooks/useSettings.js +0 -52
  129. package/dist/src/web/index.js +0 -41
  130. package/dist/src/web/routes/CreateInstance.d.ts +0 -2
  131. package/dist/src/web/routes/CreateInstance.js +0 -59
  132. package/dist/src/web/routes/Entity.d.ts +0 -2
  133. package/dist/src/web/routes/Entity.js +0 -97
  134. package/dist/src/web/routes/Home.d.ts +0 -3
  135. package/dist/src/web/routes/Home.js +0 -43
  136. package/dist/src/web/routes/Instance.d.ts +0 -2
  137. package/dist/src/web/routes/Instance.js +0 -63
  138. package/dist/src/web/routes/NotFound.d.ts +0 -2
  139. package/dist/src/web/routes/NotFound.js +0 -10
  140. package/dist/src/web/routes/Search.d.ts +0 -2
  141. package/dist/src/web/routes/Search.js +0 -56
  142. package/dist/src/web/signals/loading.d.ts +0 -2
  143. package/dist/src/web/signals/loading.js +0 -11
  144. package/dist/src/web/utils/BlockMarkdown.d.ts +0 -10
  145. package/dist/src/web/utils/BlockMarkdown.js +0 -46
  146. package/dist/src/web/utils/BlockMarkdownHighlighting.d.ts +0 -7
  147. package/dist/src/web/utils/BlockMarkdownHighlighting.js +0 -22
  148. package/dist/src/web/utils/InlineMarkdown.d.ts +0 -7
  149. package/dist/src/web/utils/InlineMarkdown.js +0 -36
  150. package/dist/src/web/utils/Markdown.d.ts +0 -9
  151. package/dist/src/web/utils/Markdown.js +0 -11
  152. package/dist/src/web/utils/MarkdownHighlighting.d.ts +0 -7
  153. package/dist/src/web/utils/MarkdownHighlighting.js +0 -11
  154. package/dist/src/web/utils/api.d.ts +0 -25
  155. package/dist/src/web/utils/api.js +0 -34
  156. package/dist/src/web/utils/debug.d.ts +0 -2
  157. package/dist/src/web/utils/debug.js +0 -9
  158. package/dist/src/web/utils/typeSkeleton.d.ts +0 -3
  159. package/dist/src/web/utils/typeSkeleton.js +0 -57
  160. /package/dist/src/{bin → node/bin}/tsondb.d.ts +0 -0
  161. /package/dist/src/{shared → node}/output.js +0 -0
  162. /package/dist/src/{web/index.d.ts → shared/utils/childInstances.js} +0 -0
@@ -15,9 +15,9 @@ import { cwd } from "node:process";
15
15
  import { pathToFileURL } from "node:url";
16
16
  import { styleText } from "node:util";
17
17
  import { parseArguments } from "simple-cli-args";
18
- import { validateConfigForData, validateConfigForGeneration, validateConfigForServer, validateConfigForTesting, } from "../node/config.js";
19
- import { TSONDB } from "../node/index.js";
20
- import { createServer } from "../node/server/index.js";
18
+ import { validateConfigForData, validateConfigForGeneration, validateConfigForServer, validateConfigForTesting, } from "../config.js";
19
+ import { TSONDB } from "../index.js";
20
+ import { createServer } from "../server/index.js";
21
21
  const debug = Debug("tsondb:cli");
22
22
  const passedArguments = parseArguments({
23
23
  commands: {
@@ -120,7 +120,7 @@ else {
120
120
  debug(`running command: serve`);
121
121
  validateConfigForServer(config);
122
122
  const db = await createDB(config, config.validationOptions, false);
123
- await createServer(db, config.homeLayoutSections, config.serverOptions, config.validationOptions, config.customStylesheetPath);
123
+ createServer(db, config.homeLayoutSections, config.serverOptions, config.validationOptions, config.customStylesheetPath, config.customAssetsPath);
124
124
  break;
125
125
  }
126
126
  case "validate": {
@@ -1,5 +1,5 @@
1
- import type { Output } from "../shared/output.ts";
2
1
  import type { DefaultTSONDBTypes, ValidationOptions } from "./index.ts";
2
+ import type { Output } from "./output.ts";
3
3
  import type { EntityDecl } from "./schema/dsl/index.ts";
4
4
  import type { Schema } from "./schema/index.ts";
5
5
  /**
@@ -16,6 +16,7 @@ export type Config<T extends DefaultTSONDBTypes = DefaultTSONDBTypes> = {
16
16
  dataRootPath?: string;
17
17
  homeLayoutSections?: HomeLayoutSection[];
18
18
  customStylesheetPath?: string;
19
+ customAssetsPath?: string;
19
20
  validationOptions?: Partial<ValidationOptions>;
20
21
  };
21
22
  export type ServerOptions = {
@@ -51,6 +52,7 @@ export type ServerConfig = DataConfig & {
51
52
  homeLayoutSections?: HomeLayoutSection[];
52
53
  validationOptions?: Partial<ValidationOptions>;
53
54
  customStylesheetPath?: string;
55
+ customAssetsPath?: string;
54
56
  };
55
57
  /**
56
58
  * The configuration type required for validating the contents of the database.
@@ -1,6 +1,6 @@
1
- import type { Output } from "../shared/output.ts";
2
1
  import type { InstanceContainer, InstanceContainerOverview } from "../shared/utils/instances.ts";
3
2
  import { Git } from "./git.js";
3
+ import type { Output } from "./output.ts";
4
4
  import { type EntityDecl } from "./schema/dsl/index.ts";
5
5
  import type { AnyChildEntityMap, AnyEntityMap, AnyEnumMap, AnyTypeAliasMap } from "./schema/generatedTypeHelpers.ts";
6
6
  import { type IdArgsVariant } from "./schema/generatedTypeHelpers.ts";
@@ -242,3 +242,4 @@ export declare class TSONDB<T extends DefaultTSONDBTypes = DefaultTSONDBTypes> {
242
242
  export type TSONDBWithGit<T extends DefaultTSONDBTypes = DefaultTSONDBTypes> = TSONDB<T> & {
243
243
  git: Git<T>;
244
244
  };
245
+ export type { Config } from "./config.ts";
@@ -0,0 +1,5 @@
1
+ import type { DefaultTSONDBTypes } from "./index.ts";
2
+ import type { Schema } from "./schema/index.ts";
3
+ export interface Output {
4
+ run: <T extends DefaultTSONDBTypes>(schema: Schema<T>) => Promise<void>;
5
+ }
@@ -1,4 +1,4 @@
1
- import type { Output } from "../../../shared/output.ts";
1
+ import type { Output } from "../../output.ts";
2
2
  import type { JsonSchemaRendererOptions } from "./render.ts";
3
3
  export declare const JsonSchemaOutput: (options: {
4
4
  targetPath: string;
@@ -1,4 +1,4 @@
1
- import type { Output } from "../../../shared/output.ts";
1
+ import type { Output } from "../../output.ts";
2
2
  import type { TypeScriptRendererOptions } from "./render.ts";
3
3
  export declare const TypeScriptOutput: (options: {
4
4
  targetPath: string;
@@ -1,4 +1,5 @@
1
1
  import { Lazy } from "@elyukai/utils/lazy";
2
+ import type { GenericEntityDisplayName } from "../../../../shared/schema/declarations/EntityDecl.ts";
2
3
  import { NodeKind } from "../../../../shared/schema/Node.js";
3
4
  import type { SortOrder } from "../../../../shared/schema/utils/sortOrder.ts";
4
5
  import type { UniqueConstraints } from "../../../../shared/schema/utils/uniqueConstraint.ts";
@@ -10,10 +11,6 @@ import type { MemberDecl, ObjectType } from "../types/ObjectType.ts";
10
11
  import { StringType } from "../types/StringType.ts";
11
12
  import type { BaseDecl } from "./Decl.ts";
12
13
  import { TypeAliasDecl } from "./TypeAliasDecl.ts";
13
- export type GenericEntityDisplayName = string | {
14
- pathToLocaleMap?: string;
15
- pathInLocaleMap?: string;
16
- } | null;
17
14
  export type EntityDisplayName<T extends TConstraint> = PathTo<T, StringType> | {
18
15
  /**
19
16
  * @default "translations"
@@ -3,7 +3,7 @@ import type { Decl } from "./declarations/Decl.ts";
3
3
  import type { Type } from "./types/Type.ts";
4
4
  export { Param, TypeParameter } from "./TypeParameter.ts";
5
5
  export { type Decl, type DeclP, type IncludableDeclP, type SecondaryDecl, } from "./declarations/Decl.ts";
6
- export { Entity, EntityDecl, type EntityDeclWithParentReference, type EntityDisplayName, type GenericEntityDisplayName, } from "./declarations/EntityDecl.ts";
6
+ export { Entity, EntityDecl, type EntityDeclWithParentReference, type EntityDisplayName, } from "./declarations/EntityDecl.ts";
7
7
  export { Enum, EnumDecl, GenEnum, GenEnumDecl } from "./declarations/EnumDecl.ts";
8
8
  export { GenTypeAlias, GenTypeAliasDecl, TypeAlias, TypeAliasDecl, } from "./declarations/TypeAliasDecl.ts";
9
9
  export { Array, ArrayType } from "./types/ArrayType.ts";
@@ -3,7 +3,6 @@ import { assertExhaustive } from "@elyukai/utils/typeSafety";
3
3
  import { ENUM_DISCRIMINATOR_KEY } from "../../../shared/schema/declarations/EnumDecl.js";
4
4
  import { NodeKind } from "../../../shared/schema/Node.js";
5
5
  import { isObjectType } from "../dsl/types/ObjectType.js";
6
- import {} from "../dsl/types/TranslationObjectType.js";
7
6
  const formatTranslationObjectValue = (type, value) => typeof value === "object" && value !== null && !Array.isArray(value)
8
7
  ? sortObjectKeysByIndex(Object.fromEntries(Object.entries(value).map(([key, item]) => [
9
8
  key,
@@ -16,4 +16,4 @@ declare global {
16
16
  }
17
17
  }
18
18
  }
19
- export declare const createServer: (db: TSONDB, homeLayoutSections?: HomeLayoutSection[], options?: Partial<ServerOptions>, validationOptions?: Partial<ValidationOptions>, customStylesheetPath?: string) => Promise<void>;
19
+ export declare const createServer: (db: TSONDB, homeLayoutSections?: HomeLayoutSection[], options?: Partial<ServerOptions>, validationOptions?: Partial<ValidationOptions>, customStylesheetPath?: string, customAssetsPath?: string) => void;
@@ -1,6 +1,5 @@
1
1
  import Debug from "debug";
2
2
  import express from "express";
3
- import { readdir } from "node:fs/promises";
4
3
  import { findPackageJSON } from "node:module";
5
4
  import { dirname, join } from "node:path";
6
5
  import { api } from "./api/index.js";
@@ -16,16 +15,7 @@ const staticNodeModule = (moduleName) => {
16
15
  }
17
16
  return express.static(dirname(pathToPackageJson));
18
17
  };
19
- const getAllJsFilesInNodeModule = async (moduleName, pathInside = []) => {
20
- const pathToPackageJson = findPackageJSON(moduleName, import.meta.url);
21
- if (!pathToPackageJson) {
22
- throw new Error(`Could not find module "${moduleName}"`);
23
- }
24
- const moduleDir = dirname(pathToPackageJson);
25
- const paths = await readdir(join(moduleDir, ...pathInside), { recursive: true });
26
- return paths.filter(p => p.endsWith(".js")).map(p => p.replace(/\.js$/, ""));
27
- };
28
- export const createServer = async (db, homeLayoutSections, options, validationOptions, customStylesheetPath) => {
18
+ export const createServer = (db, homeLayoutSections, options, validationOptions, customStylesheetPath, customAssetsPath) => {
29
19
  const { port } = { ...defaultOptions, ...options };
30
20
  const app = express();
31
21
  app.use(express.static(join(import.meta.dirname, "../../../../public")));
@@ -54,25 +44,6 @@ export const createServer = async (db, homeLayoutSections, options, validationOp
54
44
  next();
55
45
  });
56
46
  app.use("/api", api);
57
- const importMap = JSON.stringify({
58
- imports: {
59
- preact: "/js/node_modules/preact/dist/preact.module.js",
60
- "preact/compat": "/js/node_modules/preact/compat/dist/compat.module.js",
61
- "preact/debug": "/js/node_modules/preact/debug/dist/debug.module.js",
62
- "preact/devtools": "/js/node_modules/preact/devtools/dist/devtools.module.js",
63
- "preact/hooks": "/js/node_modules/preact/hooks/dist/hooks.module.js",
64
- "preact/jsx-runtime": "/js/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js",
65
- "preact-iso": "/js/node_modules/preact-iso/src/index.js",
66
- "@preact/signals": "/js/node_modules/@preact/signals/dist/signals.module.js",
67
- "@preact/signals-core": "/js/node_modules/@preact/signals-core/dist/signals-core.module.js",
68
- ...Object.fromEntries((await getAllJsFilesInNodeModule("@elyukai/utils", ["dist"])).map(localPath => [
69
- "@elyukai/utils/" + localPath.replace(/\\/g, "/"),
70
- "/js/node_modules/@elyukai/utils/dist/" + localPath.replace(/\\/g, "/") + ".js",
71
- ])),
72
- "@elyukai/markdown": "/js/node_modules/@elyukai/markdown/dist/src/index.js",
73
- "@elyukai/markdown/types": "/js/node_modules/@elyukai/markdown/dist/src/types.js",
74
- },
75
- }, null, 2);
76
47
  const customStylesheetLinkHeader = customStylesheetPath
77
48
  ? `
78
49
  <link rel="stylesheet" href="/css/custom.css">`
@@ -82,6 +53,9 @@ export const createServer = async (db, homeLayoutSections, options, validationOp
82
53
  res.sendFile(customStylesheetPath);
83
54
  });
84
55
  }
56
+ if (customAssetsPath) {
57
+ app.use("/assets/custom", express.static(customAssetsPath));
58
+ }
85
59
  app.get(/^\/.*/, (_req, res) => {
86
60
  res.send(`<!DOCTYPE html>
87
61
  <html lang="en">
@@ -90,11 +64,10 @@ export const createServer = async (db, homeLayoutSections, options, validationOp
90
64
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
91
65
  <title>TSONDB</title>
92
66
  <link rel="stylesheet" href="/css/styles.css">${customStylesheetLinkHeader}
93
- <script type="importmap">${importMap}</script>
94
67
  </head>
95
68
  <body>
96
69
  <div id="app"></div>
97
- <script type="module" src="/js/client/index.js"></script>
70
+ <script type="module" src="/js/client/web.js"></script>
98
71
  </body>
99
72
  </html>`);
100
73
  });
@@ -1,6 +1,6 @@
1
+ import type { CreatedEntityTaggedInstanceContainerWithChildInstances, UpdatedEntityTaggedInstanceContainerWithChildInstances } from "../../../shared/utils/childInstances.ts";
1
2
  import type { InstanceContainer } from "../../../shared/utils/instances.ts";
2
3
  import type { TSONDB } from "../../index.ts";
3
- import { type CreatedEntityTaggedInstanceContainerWithChildInstances, type UpdatedEntityTaggedInstanceContainerWithChildInstances } from "../../utils/childInstances.ts";
4
4
  export declare const createInstance: (db: TSONDB, instance: CreatedEntityTaggedInstanceContainerWithChildInstances, idQueryParam: string | undefined) => Promise<InstanceContainer>;
5
5
  export declare const updateInstance: (db: TSONDB, instance: UpdatedEntityTaggedInstanceContainerWithChildInstances) => Promise<InstanceContainer>;
6
6
  export declare const deleteInstance: (db: TSONDB, entityName: string, instanceId: string) => Promise<InstanceContainer>;
@@ -1,4 +1,4 @@
1
- import { getChildInstances, saveInstanceTree, } from "../../utils/childInstances.js";
1
+ import { getChildInstances, saveInstanceTree } from "../../utils/childInstances.js";
2
2
  import { HTTPError } from "../../utils/error.js";
3
3
  export const createInstance = async (db, instance, idQueryParam) => {
4
4
  const getEntity = db.schema.getEntity.bind(db.schema);
@@ -1,33 +1,9 @@
1
- import type { GitFileStatus } from "../../shared/utils/git.ts";
2
- import type { InstanceContainer, InstanceContent } from "../../shared/utils/instances.ts";
1
+ import type { EntityTaggedInstanceContainerWithChildInstances, UnsafeEntityTaggedInstanceContainerWithChildInstances } from "../../shared/utils/childInstances.ts";
2
+ import type { InstanceContainer } from "../../shared/utils/instances.ts";
3
3
  import type { TSONDB } from "../index.ts";
4
4
  import type { EntityDecl, EntityDeclWithParentReference } from "../schema/dsl/declarations/EntityDecl.ts";
5
5
  import type { Transaction } from "../transaction.ts";
6
6
  import { type DatabaseInMemory } from "./databaseInMemory.ts";
7
- export interface ChildInstanceContainer {
8
- id?: string;
9
- content: InstanceContent;
10
- gitStatus?: GitFileStatus;
11
- }
12
- export interface EntityTaggedInstanceContainer {
13
- entityName: string;
14
- id: string;
15
- content: InstanceContent;
16
- }
17
- export interface CreatedEntityTaggedInstanceContainerWithChildInstances extends GenEntityTaggedInstanceContainerWithChildInstances<undefined, UnsafeEntityTaggedInstanceContainerWithChildInstances> {
18
- }
19
- export interface UpdatedEntityTaggedInstanceContainerWithChildInstances extends GenEntityTaggedInstanceContainerWithChildInstances<string, UnsafeEntityTaggedInstanceContainerWithChildInstances> {
20
- }
21
- export interface UnsafeEntityTaggedInstanceContainerWithChildInstances extends GenEntityTaggedInstanceContainerWithChildInstances<string | undefined, UnsafeEntityTaggedInstanceContainerWithChildInstances> {
22
- }
23
- export interface EntityTaggedInstanceContainerWithChildInstances extends GenEntityTaggedInstanceContainerWithChildInstances<string, EntityTaggedInstanceContainerWithChildInstances> {
24
- }
25
- export interface GenEntityTaggedInstanceContainerWithChildInstances<ID extends string | undefined, C> {
26
- entityName: string;
27
- id: ID;
28
- content: InstanceContent;
29
- childInstances: C[];
30
- }
31
7
  export declare const getChildInstancesFromEntity: (databaseInMemory: DatabaseInMemory, parentEntity: EntityDecl, parentId: string, childEntity: EntityDeclWithParentReference) => InstanceContainer[];
32
8
  export declare const getChildInstances: (db: TSONDB, parentEntity: EntityDecl, parentId: string, recursive?: boolean) => EntityTaggedInstanceContainerWithChildInstances[];
33
9
  export declare const saveInstanceTree: (txn: Transaction, getEntity: (entityName: string) => EntityDecl | undefined, parentEntityName: string | undefined, parentId: string | undefined, entityName: string, oldInstance: EntityTaggedInstanceContainerWithChildInstances | undefined, newInstance: UnsafeEntityTaggedInstanceContainerWithChildInstances | undefined, customId: string | undefined) => [Transaction, InstanceContainer];
@@ -1,5 +1,5 @@
1
1
  import { anySameIndices } from "@elyukai/utils/array/filters";
2
- import { flatCombine } from "@elyukai/utils/array/generators";
2
+ import { flatCombine } from "@elyukai/utils/array/transformations";
3
3
  import { deepEqual } from "@elyukai/utils/equality";
4
4
  import { error, isError, mapError, ok } from "@elyukai/utils/result";
5
5
  import { getValueAtKeyPath, renderKeyPath } from "../../shared/schema/utils/keyPath.js";
@@ -1,7 +1,15 @@
1
- import type { CreatedEntityTaggedInstanceContainerWithChildInstances, EntityTaggedInstanceContainerWithChildInstances, UpdatedEntityTaggedInstanceContainerWithChildInstances } from "../node/utils/childInstances.ts";
2
- import type { WebConfig } from "../web/context/config.ts";
3
1
  import type { SerializedDecl } from "./schema/declarations/Declaration.ts";
2
+ import type { CreatedEntityTaggedInstanceContainerWithChildInstances, EntityTaggedInstanceContainerWithChildInstances, UpdatedEntityTaggedInstanceContainerWithChildInstances } from "./utils/childInstances.ts";
4
3
  import type { InstanceContainer, InstanceContainerOverview } from "./utils/instances.ts";
4
+ export type WebConfig = {
5
+ localeEntityName: string | undefined;
6
+ defaultLocales: string[];
7
+ homeLayoutSections?: {
8
+ title: string;
9
+ comment?: string;
10
+ entities: string[];
11
+ }[];
12
+ };
5
13
  export type GetWebConfigResponseBody = WebConfig;
6
14
  export interface GetAllDeclarationsResponseBody<D extends SerializedDecl = SerializedDecl> {
7
15
  declarations: {
@@ -13,6 +13,7 @@ export declare const getSerializedTypeArgumentsRecord: <Params extends Serialize
13
13
  export type SerializedDecl = SerializedEntityDecl | SerializedEnumDecl | SerializedTypeAliasDecl;
14
14
  export type SerializedDeclP<Params extends SerializedTypeParameter[] = SerializedTypeParameter[]> = SerializedEntityDecl | SerializedEnumDecl<string, Record<string, SerializedEnumCaseDecl>, Params> | SerializedTypeAliasDecl<string, SerializedType, Params>;
15
15
  export type SerializedSecondaryDecl = SerializedEnumDecl | SerializedTypeAliasDecl | SerializedEntityDecl<string, Record<string, SerializedMemberDecl>, string>;
16
+ export type GetDeclFromDeclName = (name: string) => SerializedSecondaryDecl | undefined;
16
17
  export interface SerializedBaseDecl<Name extends string = string, Params extends SerializedTypeParameter[] = SerializedTypeParameter[]> extends BaseNode {
17
18
  sourceUrl: string;
18
19
  name: Name;
@@ -1,4 +1,3 @@
1
- import type { GenericEntityDisplayName } from "../../../node/schema/dsl/index.ts";
2
1
  import { NodeKind, type GetReferencesSerialized, type SerializedNode, type SerializedTypeArgumentsResolver } from "../Node.ts";
3
2
  import type { SerializedNestedEntityMapType } from "../types/NestedEntityMapType.ts";
4
3
  import { type SerializedMemberDecl, type SerializedObjectType } from "../types/ObjectType.ts";
@@ -6,6 +5,10 @@ import type { SerializedStringType } from "../types/StringType.ts";
6
5
  import type { SortOrder } from "../utils/sortOrder.ts";
7
6
  import type { UniqueConstraints } from "../utils/uniqueConstraint.ts";
8
7
  import type { SerializedBaseDecl } from "./Declaration.ts";
8
+ export type GenericEntityDisplayName = string | {
9
+ pathToLocaleMap?: string;
10
+ pathInLocaleMap?: string;
11
+ } | null;
9
12
  export type SerializedEntityDisplayName<T extends TSerializedConstraint> = SerializedPathTo<T, SerializedStringType> | {
10
13
  /**
11
14
  * @default "translations"
@@ -4,6 +4,7 @@ import type { SerializedBaseType } from "./Type.ts";
4
4
  type TSerializedConstraint = {
5
5
  [key: string]: null | TSerializedConstraint;
6
6
  };
7
+ export type { TSerializedConstraint as SerializedTranslationObjectTypeConstraint };
7
8
  export interface SerializedTranslationObjectType<T extends TSerializedConstraint = TSerializedConstraint> extends SerializedBaseType {
8
9
  kind: NodeKind["TranslationObjectType"];
9
10
  properties: T;
@@ -13,4 +14,3 @@ export declare const isSerializedTranslationObjectType: (node: SerializedNode) =
13
14
  export declare const resolveTypeArgumentsInSerializedTranslationObjectType: SerializedTypeArgumentsResolver<SerializedTranslationObjectType>;
14
15
  export declare const getReferencesForSerializedTranslationObjectType: GetReferencesSerialized<SerializedTranslationObjectType>;
15
16
  export declare const getSerializedTypeOfKey: <T extends TSerializedConstraint>(keyValue: null | T, parentType?: SerializedTranslationObjectType) => SerializedStringType | SerializedTranslationObjectType<T>;
16
- export {};
@@ -1,4 +1,4 @@
1
- import type { GetDeclFromDeclName } from "../../../web/hooks/useSecondaryDeclarations.ts";
1
+ import type { GetDeclFromDeclName } from "../declarations/Declaration.ts";
2
2
  import type { BaseNode } from "../Node.ts";
3
3
  import type { SerializedArrayType } from "./ArrayType.ts";
4
4
  import type { SerializedBooleanType } from "./BooleanType.ts";
@@ -0,0 +1,26 @@
1
+ import type { GitFileStatus } from "./git.ts";
2
+ import type { InstanceContent } from "./instances.ts";
3
+ export interface ChildInstanceContainer {
4
+ id?: string;
5
+ content: InstanceContent;
6
+ gitStatus?: GitFileStatus;
7
+ }
8
+ export interface EntityTaggedInstanceContainer {
9
+ entityName: string;
10
+ id: string;
11
+ content: InstanceContent;
12
+ }
13
+ export interface CreatedEntityTaggedInstanceContainerWithChildInstances extends GenEntityTaggedInstanceContainerWithChildInstances<undefined, UnsafeEntityTaggedInstanceContainerWithChildInstances> {
14
+ }
15
+ export interface UpdatedEntityTaggedInstanceContainerWithChildInstances extends GenEntityTaggedInstanceContainerWithChildInstances<string, UnsafeEntityTaggedInstanceContainerWithChildInstances> {
16
+ }
17
+ export interface UnsafeEntityTaggedInstanceContainerWithChildInstances extends GenEntityTaggedInstanceContainerWithChildInstances<string | undefined, UnsafeEntityTaggedInstanceContainerWithChildInstances> {
18
+ }
19
+ export interface EntityTaggedInstanceContainerWithChildInstances extends GenEntityTaggedInstanceContainerWithChildInstances<string, EntityTaggedInstanceContainerWithChildInstances> {
20
+ }
21
+ export interface GenEntityTaggedInstanceContainerWithChildInstances<ID extends string | undefined, C> {
22
+ entityName: string;
23
+ id: ID;
24
+ content: InstanceContent;
25
+ childInstances: C[];
26
+ }
@@ -1,5 +1,3 @@
1
- import type { EntityDecl } from "../../node/schema/dsl/index.ts";
2
- import type { AnyChildEntityMap, AnyEntityMap, GetAllChildInstanceContainersForParent, GetEntityByName, GetInstanceContainerById } from "../../node/schema/generatedTypeHelpers.ts";
3
1
  import type { GitFileStatus } from "./git.ts";
4
2
  export type InstanceContent = object;
5
3
  export interface InstanceContainer<T = InstanceContent> {
@@ -13,4 +11,3 @@ export interface InstanceContainerOverview {
13
11
  displayName: string;
14
12
  displayNameLocaleId?: string;
15
13
  }
16
- export declare const getInstanceContainerOverview: <EM extends AnyEntityMap, CEM extends AnyChildEntityMap>(entity: EntityDecl, instanceContainer: InstanceContainer, getEntityByName: GetEntityByName<EM>, getInstanceById: GetInstanceContainerById<EM>, getChildInstancesForInstanceId: GetAllChildInstanceContainersForParent<CEM>, locales: string[]) => InstanceContainerOverview;
@@ -1,10 +1 @@
1
- import { getDisplayNameFromEntityInstance } from "../../node/utils/displayName.js";
2
- export const getInstanceContainerOverview = (entity, instanceContainer, getEntityByName, getInstanceById, getChildInstancesForInstanceId, locales) => {
3
- const { content: _, ...rest } = instanceContainer;
4
- const { name: displayName, localeId: displayNameLocaleId } = getDisplayNameFromEntityInstance(entity, instanceContainer, getEntityByName, getInstanceById, getChildInstancesForInstanceId, locales);
5
- return {
6
- ...rest,
7
- displayName,
8
- displayNameLocaleId,
9
- };
10
- };
1
+ export {};