tsondb 0.21.4 → 0.21.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/src/node/bin/tsondb.js +10 -4
  2. package/dist/src/node/index.d.ts +12 -3
  3. package/dist/src/node/index.js +29 -14
  4. package/dist/src/node/renderers/jsonschema/index.d.ts +1 -1
  5. package/dist/src/node/renderers/jsonschema/index.js +2 -2
  6. package/dist/src/node/renderers/jsonschema/render.js +4 -6
  7. package/dist/src/node/renderers/ts/index.d.ts +1 -1
  8. package/dist/src/node/renderers/ts/index.js +2 -2
  9. package/dist/src/node/renderers/ts/render.js +11 -21
  10. package/dist/src/node/schema/detached.d.ts +1 -1
  11. package/dist/src/node/schema/detached.js +0 -1
  12. package/dist/src/node/schema/dsl/declarations/Decl.d.ts +3 -3
  13. package/dist/src/node/schema/dsl/declarations/Decl.js +1 -1
  14. package/dist/src/node/schema/dsl/declarations/EntityDecl.d.ts +2 -2
  15. package/dist/src/node/schema/dsl/declarations/EntityDecl.js +1 -1
  16. package/dist/src/node/schema/dsl/declarations/EnumDecl.d.ts +2 -3
  17. package/dist/src/node/schema/dsl/declarations/SingletonEntityDecl.d.ts +1 -1
  18. package/dist/src/node/schema/dsl/declarations/TypeAliasDecl.d.ts +1 -1
  19. package/dist/src/node/schema/dsl/index.d.ts +1 -1
  20. package/dist/src/node/schema/dsl/types/ChildEntitiesType.d.ts +1 -1
  21. package/dist/src/node/schema/dsl/types/ChildEntitiesType.js +0 -1
  22. package/dist/src/node/schema/dsl/types/IncludeIdentifierType.d.ts +1 -1
  23. package/dist/src/node/schema/dsl/types/IncludeIdentifierType.js +0 -1
  24. package/dist/src/node/schema/dsl/types/NestedEntityMapType.d.ts +1 -1
  25. package/dist/src/node/schema/dsl/types/NestedEntityMapType.js +0 -1
  26. package/dist/src/node/schema/dsl/types/ObjectType.js +1 -1
  27. package/dist/src/node/schema/helpers.d.ts +4 -4
  28. package/dist/src/node/schema/helpers.js +8 -11
  29. package/dist/src/node/schema/index.d.ts +2 -2
  30. package/dist/src/node/schema/index.js +4 -3
  31. package/dist/src/node/schema/treeOperations/format.js +2 -1
  32. package/dist/src/node/schema/treeOperations/serialization.d.ts +19 -19
  33. package/dist/src/node/schema/treeOperations/serialization.js +0 -18
  34. package/dist/src/node/schema/treeOperations/typeResolution.d.ts +9 -11
  35. package/dist/src/node/schema/treeOperations/typeResolution.js +0 -7
  36. package/dist/src/node/schema/treeOperations/validation.d.ts +1 -1
  37. package/dist/src/node/schema/treeOperations/validation.js +5 -6
  38. package/dist/src/node/schema/validation/options.js +2 -1
  39. package/dist/src/node/server/api/declarations.js +2 -2
  40. package/dist/src/node/server/api/git.js +2 -2
  41. package/dist/src/node/server/index.d.ts +2 -2
  42. package/dist/src/node/server/index.js +2 -2
  43. package/dist/src/node/server/utils/query.js +1 -1
  44. package/dist/src/node/transaction.d.ts +2 -2
  45. package/dist/src/node/transaction.js +0 -2
  46. package/dist/src/node/utils/childInstances.d.ts +1 -1
  47. package/dist/src/node/utils/childInstances.js +3 -2
  48. package/dist/src/node/utils/customConstraints.d.ts +1 -1
  49. package/dist/src/node/utils/customConstraints.js +0 -1
  50. package/dist/src/node/utils/databaseInMemory.js +16 -18
  51. package/dist/src/node/utils/databaseOnDisk.js +8 -0
  52. package/dist/src/node/utils/displayName.d.ts +1 -1
  53. package/dist/src/node/utils/displayName.js +24 -29
  54. package/dist/src/node/utils/files.d.ts +1 -1
  55. package/dist/src/node/utils/files.js +1 -2
  56. package/dist/src/node/utils/path.js +2 -1
  57. package/dist/src/node/utils/references.d.ts +1 -1
  58. package/dist/src/node/utils/references.js +6 -5
  59. package/dist/src/node/utils/unique.d.ts +1 -1
  60. package/dist/src/node/utils/unique.js +8 -17
  61. package/dist/src/shared/schema/declarations/Declaration.d.ts +1 -1
  62. package/dist/src/shared/schema/declarations/Declaration.js +0 -1
  63. package/dist/src/shared/schema/declarations/EnumDecl.js +5 -7
  64. package/dist/src/shared/schema/types/EnumType.js +2 -2
  65. package/dist/src/shared/schema/types/NestedEntityMapType.d.ts +1 -2
  66. package/dist/src/shared/schema/utils/keyPath.js +14 -14
  67. package/dist/src/shared/schema/utils/sortOrder.js +1 -1
  68. package/dist/src/shared/utils/git.js +6 -1
  69. package/dist/src/shared/utils/render.js +3 -3
  70. package/dist/src/shared/utils/translation.js +15 -16
  71. package/dist/src/shared/utils/validation.js +4 -4
  72. package/dist/src/shared/validation/date.js +2 -2
  73. package/dist/src/shared/validation/identifier.js +1 -1
  74. package/dist/src/shared/validation/number.js +3 -3
  75. package/dist/src/shared/validation/object.js +1 -1
  76. package/dist/src/shared/validation/string.js +1 -1
  77. package/dist/src/web/web.js +1140 -1212
  78. package/package.json +19 -18
@@ -1,6 +1,6 @@
1
1
  import type { DeclarationName, DefaultTSONDBTypes, EntityName, SingletonEntityName } from "../index.ts";
2
- import type { Decl } from "./dsl/declarations/Decl.ts";
3
- import type { EntityDecl } from "./dsl/declarations/EntityDecl.ts";
2
+ import { type Decl } from "./dsl/declarations/Decl.ts";
3
+ import { type EntityDecl } from "./dsl/declarations/EntityDecl.ts";
4
4
  import type { SingletonEntityDecl } from "./dsl/index.ts";
5
5
  export declare class Schema<T extends DefaultTSONDBTypes = DefaultTSONDBTypes> {
6
6
  #private;
@@ -278,6 +278,7 @@ const checkChildEntityTypes = (localeEntity, decls) => {
278
278
  if (localeEntity && localeEntity.parentReferenceKey !== undefined) {
279
279
  throw new TypeError(`The locale entity "${localeEntity.name}" cannot be used as a child entity to other entities.`);
280
280
  }
281
+ // oxlint-disable-next-line no-warning-comments
281
282
  // TODO: Check that no cycles exist in child entity relations
282
283
  for (const decl of decls) {
283
284
  if (isEnumDecl(decl)) {
@@ -333,14 +334,14 @@ const isDeclarationRecursive = (declToCheck) => {
333
334
  case NodeKind.ArrayType:
334
335
  return isDeclarationIncludedInNode(visitedDecls, node.items);
335
336
  case NodeKind.ObjectType:
336
- return Object.entries(node.properties).some(([_, memberDecl]) => isDeclarationIncludedInNode(visitedDecls, memberDecl.type));
337
+ return Object.entries(node.properties).some(([_key, memberDecl]) => isDeclarationIncludedInNode(visitedDecls, memberDecl.type));
337
338
  case NodeKind.IncludeIdentifierType:
338
339
  return (declToCheck === node.reference ||
339
340
  isDeclarationIncludedInNode(visitedDecls, node.reference));
340
341
  case NodeKind.NestedEntityMapType:
341
342
  return isDeclarationIncludedInNode(visitedDecls, node.type.value);
342
343
  case NodeKind.EnumType:
343
- return Object.entries(node.values).some(([_, caseDecl]) => caseDecl.type !== null && isDeclarationIncludedInNode(visitedDecls, caseDecl.type));
344
+ return Object.entries(node.values).some(([_caseName, caseDecl]) => caseDecl.type !== null && isDeclarationIncludedInNode(visitedDecls, caseDecl.type));
344
345
  default:
345
346
  return assertExhaustive(node);
346
347
  }
@@ -431,7 +432,7 @@ const checkSortOrders = (declarations) => {
431
432
  });
432
433
  }
433
434
  };
434
- const sortOrder = decl.sortOrder;
435
+ const { sortOrder } = decl;
435
436
  if (sortOrder === "displayName") {
436
437
  continue;
437
438
  }
@@ -1,4 +1,5 @@
1
1
  import { format as formatMarkdown, formatInline as formatMarkdownInline, } from "@elyukai/markdown/format";
2
+ import { isNullish } from "@elyukai/utils/nullable";
2
3
  import { mapObject, sortObjectKeys, sortObjectKeysByIndex } from "@elyukai/utils/object";
3
4
  import { assertExhaustive } from "@elyukai/utils/typeSafety";
4
5
  import { ENUM_DISCRIMINATOR_KEY } from "../../../shared/schema/declarations/EnumDecl.js";
@@ -71,7 +72,7 @@ export const formatValue = (type, value, typeArguments, options) => {
71
72
  const caseType = type.values[caseName]?.type;
72
73
  return {
73
74
  [ENUM_DISCRIMINATOR_KEY]: caseName,
74
- ...(caseValue == null || caseType == null
75
+ ...(isNullish(caseValue) || isNullish(caseType)
75
76
  ? {}
76
77
  : { [caseName]: formatValue(caseType, caseValue, typeArguments, options) }),
77
78
  };
@@ -18,26 +18,26 @@ import type { SerializedReferenceIdentifierType } from "../../../shared/schema/t
18
18
  import type { SerializedStringType } from "../../../shared/schema/types/StringType.ts";
19
19
  import type { SerializedTranslationObjectType } from "../../../shared/schema/types/TranslationObjectType.ts";
20
20
  import type { SerializedTypeArgumentType } from "../../../shared/schema/types/TypeArgumentType.ts";
21
- import { type EntityDecl } from "../dsl/declarations/EntityDecl.ts";
22
- import { type EnumDecl } from "../dsl/declarations/EnumDecl.ts";
21
+ import type { EntityDecl } from "../dsl/declarations/EntityDecl.ts";
22
+ import type { EnumDecl } from "../dsl/declarations/EnumDecl.ts";
23
23
  import type { SingletonEntityDecl } from "../dsl/declarations/SingletonEntityDecl.ts";
24
- import { type TypeAliasDecl } from "../dsl/declarations/TypeAliasDecl.ts";
24
+ import type { TypeAliasDecl } from "../dsl/declarations/TypeAliasDecl.ts";
25
25
  import type { Node, Type } from "../dsl/index.ts";
26
- import { type TypeParameter } from "../dsl/TypeParameter.ts";
27
- import { type ArrayType } from "../dsl/types/ArrayType.ts";
28
- import { type BooleanType } from "../dsl/types/BooleanType.ts";
29
- import { type ChildEntitiesType } from "../dsl/types/ChildEntitiesType.ts";
30
- import { type DateType } from "../dsl/types/DateType.ts";
31
- import { type EnumCaseDecl, type EnumType } from "../dsl/types/EnumType.ts";
32
- import { type FloatType } from "../dsl/types/FloatType.ts";
33
- import { type IncludeIdentifierType } from "../dsl/types/IncludeIdentifierType.ts";
34
- import { type IntegerType } from "../dsl/types/IntegerType.ts";
35
- import { type NestedEntityMapType } from "../dsl/types/NestedEntityMapType.ts";
36
- import { type MemberDecl, type ObjectType } from "../dsl/types/ObjectType.ts";
37
- import { type ReferenceIdentifierType } from "../dsl/types/ReferenceIdentifierType.ts";
38
- import { type StringType } from "../dsl/types/StringType.ts";
39
- import { type TranslationObjectType } from "../dsl/types/TranslationObjectType.ts";
40
- import { type TypeArgumentType } from "../dsl/types/TypeArgumentType.ts";
26
+ import type { TypeParameter } from "../dsl/TypeParameter.ts";
27
+ import type { ArrayType } from "../dsl/types/ArrayType.ts";
28
+ import type { BooleanType } from "../dsl/types/BooleanType.ts";
29
+ import type { ChildEntitiesType } from "../dsl/types/ChildEntitiesType.ts";
30
+ import type { DateType } from "../dsl/types/DateType.ts";
31
+ import type { EnumCaseDecl, EnumType } from "../dsl/types/EnumType.ts";
32
+ import type { FloatType } from "../dsl/types/FloatType.ts";
33
+ import type { IncludeIdentifierType } from "../dsl/types/IncludeIdentifierType.ts";
34
+ import type { IntegerType } from "../dsl/types/IntegerType.ts";
35
+ import type { NestedEntityMapType } from "../dsl/types/NestedEntityMapType.ts";
36
+ import type { MemberDecl, ObjectType } from "../dsl/types/ObjectType.ts";
37
+ import type { ReferenceIdentifierType } from "../dsl/types/ReferenceIdentifierType.ts";
38
+ import type { StringType } from "../dsl/types/StringType.ts";
39
+ import type { TranslationObjectType } from "../dsl/types/TranslationObjectType.ts";
40
+ import type { TypeArgumentType } from "../dsl/types/TypeArgumentType.ts";
41
41
  export type SerializedNodeMap = {
42
42
  [NodeKind.EntityDecl]: [EntityDecl, SerializedEntityDecl];
43
43
  [NodeKind.SingletonEntityDecl]: [EntityDecl, SerializedSingletonEntityDecl];
@@ -68,7 +68,7 @@ export type SerializedMemberDeclObject<T extends Record<string, MemberDecl>> = {
68
68
  export type SerializedEnumCaseDeclObject<T extends Record<string, EnumCaseDecl>> = {
69
69
  [K in keyof T]: T[K] extends EnumCaseDecl<infer CT> ? SerializedEnumCaseDecl<CT extends Type ? Serialized<CT> : null> : never;
70
70
  };
71
- export type Serialized<T extends Node> = T extends EntityDecl<infer Name, infer T, infer FK> ? SerializedEntityDecl<Name, SerializedMemberDeclObject<T>, FK> : T extends SingletonEntityDecl<infer Name, infer T> ? SerializedSingletonEntityDecl<Name, SerializedMemberDeclObject<T>> : T extends EnumDecl<infer Name, infer T, infer Params> ? SerializedEnumDecl<Name, SerializedEnumCaseDeclObject<T>, SerializedTypeParameters<Params>> : T extends TypeAliasDecl<infer Name, infer T, infer Params> ? SerializedTypeAliasDecl<Name, Serialized<T>, SerializedTypeParameters<Params>> : T extends ArrayType<infer T> ? SerializedArrayType<Serialized<T>> : T extends ObjectType<infer T> ? SerializedObjectType<SerializedMemberDeclObject<T>> : T extends BooleanType ? SerializedBooleanType : T extends DateType ? SerializedDateType : T extends FloatType ? SerializedFloatType : T extends IntegerType ? SerializedIntegerType : T extends StringType ? SerializedStringType : T extends TypeArgumentType<infer T> ? SerializedTypeArgumentType<Serialized<T>> : T extends ReferenceIdentifierType ? SerializedReferenceIdentifierType : T extends IncludeIdentifierType<infer Params> ? SerializedIncludeIdentifierType<SerializedTypeParameters<Params>> : T extends NestedEntityMapType<infer Name, infer T> ? SerializedNestedEntityMapType<Name, SerializedMemberDeclObject<T>> : T extends EnumType<infer T> ? SerializedEnumType<SerializedEnumCaseDeclObject<T>> : T extends TypeParameter<infer N, infer C> ? SerializedTypeParameter<N, C extends Type ? Serialized<C> : undefined> : T extends ChildEntitiesType ? SerializedChildEntitiesType : T extends TranslationObjectType<infer E> ? SerializedTranslationObjectType<E> : never;
71
+ export type Serialized<T extends Node> = T extends EntityDecl<infer Name, infer TC, infer FK> ? SerializedEntityDecl<Name, SerializedMemberDeclObject<TC>, FK> : T extends SingletonEntityDecl<infer Name, infer TC> ? SerializedSingletonEntityDecl<Name, SerializedMemberDeclObject<TC>> : T extends EnumDecl<infer Name, infer TC, infer Params> ? SerializedEnumDecl<Name, SerializedEnumCaseDeclObject<TC>, SerializedTypeParameters<Params>> : T extends TypeAliasDecl<infer Name, infer TC, infer Params> ? SerializedTypeAliasDecl<Name, Serialized<TC>, SerializedTypeParameters<Params>> : T extends ArrayType<infer TC> ? SerializedArrayType<Serialized<TC>> : T extends ObjectType<infer TC> ? SerializedObjectType<SerializedMemberDeclObject<TC>> : T extends BooleanType ? SerializedBooleanType : T extends DateType ? SerializedDateType : T extends FloatType ? SerializedFloatType : T extends IntegerType ? SerializedIntegerType : T extends StringType ? SerializedStringType : T extends TypeArgumentType<infer TC> ? SerializedTypeArgumentType<Serialized<TC>> : T extends ReferenceIdentifierType ? SerializedReferenceIdentifierType : T extends IncludeIdentifierType<infer Params> ? SerializedIncludeIdentifierType<SerializedTypeParameters<Params>> : T extends NestedEntityMapType<infer Name, infer TC> ? SerializedNestedEntityMapType<Name, SerializedMemberDeclObject<TC>> : T extends EnumType<infer TC> ? SerializedEnumType<SerializedEnumCaseDeclObject<TC>> : T extends TypeParameter<infer N, infer C> ? SerializedTypeParameter<N, C extends Type ? Serialized<C> : undefined> : T extends ChildEntitiesType ? SerializedChildEntitiesType : T extends TranslationObjectType<infer E> ? SerializedTranslationObjectType<E> : never;
72
72
  export type SerializedOf<T extends Node> = SerializedNodeMap[T["kind"]][1];
73
73
  export type Serializer<T extends Node = Node> = (node: T) => Serialized<T>;
74
74
  export declare const serializeNode: <T extends Node>(node: T) => Serialized<T>;
@@ -1,23 +1,5 @@
1
1
  import { assertExhaustive } from "@elyukai/utils/typeSafety";
2
2
  import { NodeKind } from "../../../shared/schema/Node.js";
3
- import {} from "../dsl/declarations/EntityDecl.js";
4
- import {} from "../dsl/declarations/EnumDecl.js";
5
- import {} from "../dsl/declarations/TypeAliasDecl.js";
6
- import {} from "../dsl/TypeParameter.js";
7
- import {} from "../dsl/types/ArrayType.js";
8
- import {} from "../dsl/types/BooleanType.js";
9
- import {} from "../dsl/types/ChildEntitiesType.js";
10
- import {} from "../dsl/types/DateType.js";
11
- import {} from "../dsl/types/EnumType.js";
12
- import {} from "../dsl/types/FloatType.js";
13
- import {} from "../dsl/types/IncludeIdentifierType.js";
14
- import {} from "../dsl/types/IntegerType.js";
15
- import {} from "../dsl/types/NestedEntityMapType.js";
16
- import {} from "../dsl/types/ObjectType.js";
17
- import {} from "../dsl/types/ReferenceIdentifierType.js";
18
- import {} from "../dsl/types/StringType.js";
19
- import {} from "../dsl/types/TranslationObjectType.js";
20
- import {} from "../dsl/types/TypeArgumentType.js";
21
3
  export const serializeNode = (node) => {
22
4
  switch (node.kind) {
23
5
  case NodeKind.EntityDecl: {
@@ -6,19 +6,17 @@ import { TypeAliasDecl } from "../dsl/declarations/TypeAliasDecl.ts";
6
6
  import type { Node, Type } from "../dsl/index.ts";
7
7
  import type { TypeParameter } from "../dsl/TypeParameter.ts";
8
8
  import { ArrayType } from "../dsl/types/ArrayType.ts";
9
- import { type BooleanType } from "../dsl/types/BooleanType.ts";
10
- import { type ChildEntitiesType } from "../dsl/types/ChildEntitiesType.ts";
11
- import { type DateType } from "../dsl/types/DateType.ts";
12
- import type { EnumCaseDecl } from "../dsl/types/EnumType.ts";
13
- import { EnumType } from "../dsl/types/EnumType.ts";
14
- import { type FloatType } from "../dsl/types/FloatType.ts";
9
+ import type { BooleanType } from "../dsl/types/BooleanType.ts";
10
+ import type { ChildEntitiesType } from "../dsl/types/ChildEntitiesType.ts";
11
+ import type { DateType } from "../dsl/types/DateType.ts";
12
+ import { type EnumCaseDecl, EnumType } from "../dsl/types/EnumType.ts";
13
+ import type { FloatType } from "../dsl/types/FloatType.ts";
15
14
  import { IncludeIdentifierType } from "../dsl/types/IncludeIdentifierType.ts";
16
- import { type IntegerType } from "../dsl/types/IntegerType.ts";
15
+ import type { IntegerType } from "../dsl/types/IntegerType.ts";
17
16
  import { type NestedEntityMapType } from "../dsl/types/NestedEntityMapType.ts";
18
- import type { MemberDecl } from "../dsl/types/ObjectType.ts";
19
- import { ObjectType } from "../dsl/types/ObjectType.ts";
20
- import { type ReferenceIdentifierType } from "../dsl/types/ReferenceIdentifierType.ts";
21
- import { type StringType } from "../dsl/types/StringType.ts";
17
+ import { type MemberDecl, ObjectType } from "../dsl/types/ObjectType.ts";
18
+ import type { ReferenceIdentifierType } from "../dsl/types/ReferenceIdentifierType.ts";
19
+ import type { StringType } from "../dsl/types/StringType.ts";
22
20
  import type { TranslationObjectType } from "../dsl/types/TranslationObjectType.ts";
23
21
  import { type TypeArgumentType } from "../dsl/types/TypeArgumentType.ts";
24
22
  export type NodeWithResolvedTypeArguments<T extends Node | null> = T extends BooleanType | DateType | FloatType | IntegerType | StringType | ReferenceIdentifierType | ChildEntitiesType | TranslationObjectType ? T : T extends EntityDecl<infer N, infer P, infer FK> ? EntityDecl<N, {
@@ -6,17 +6,10 @@ import { EnumDecl } from "../dsl/declarations/EnumDecl.js";
6
6
  import { SingletonEntityDecl } from "../dsl/declarations/SingletonEntityDecl.js";
7
7
  import { isTypeAliasDecl, TypeAliasDecl } from "../dsl/declarations/TypeAliasDecl.js";
8
8
  import { ArrayType } from "../dsl/types/ArrayType.js";
9
- import {} from "../dsl/types/BooleanType.js";
10
- import {} from "../dsl/types/ChildEntitiesType.js";
11
- import {} from "../dsl/types/DateType.js";
12
9
  import { EnumType } from "../dsl/types/EnumType.js";
13
- import {} from "../dsl/types/FloatType.js";
14
10
  import { IncludeIdentifierType, isIncludeIdentifierType, isNoGenericIncludeIdentifierType, } from "../dsl/types/IncludeIdentifierType.js";
15
- import {} from "../dsl/types/IntegerType.js";
16
11
  import { _NestedEntityMapType } from "../dsl/types/NestedEntityMapType.js";
17
12
  import { ObjectType } from "../dsl/types/ObjectType.js";
18
- import {} from "../dsl/types/ReferenceIdentifierType.js";
19
- import {} from "../dsl/types/StringType.js";
20
13
  import { isTypeArgumentType } from "../dsl/types/TypeArgumentType.js";
21
14
  export const resolveTypeArguments = (args, node, inDecl) => {
22
15
  switch (node.kind) {
@@ -1,5 +1,5 @@
1
1
  import type { ValidationOptions } from "../../index.ts";
2
- import { type DatabaseInMemory } from "../../utils/databaseInMemory.ts";
2
+ import type { DatabaseInMemory } from "../../utils/databaseInMemory.ts";
3
3
  import { type Decl } from "../dsl/declarations/Decl.ts";
4
4
  import type { Type } from "../dsl/index.ts";
5
5
  import type { AnyEntityMap } from "../generatedTypeHelpers.ts";
@@ -12,7 +12,6 @@ import { validateDateConstraints } from "../../../shared/validation/date.js";
12
12
  import { validateNumberConstraints } from "../../../shared/validation/number.js";
13
13
  import { validateObjectConstraints, validateObjectRangeConstraints, validateUnknownKeys, } from "../../../shared/validation/object.js";
14
14
  import { validateStringConstraints } from "../../../shared/validation/string.js";
15
- import {} from "../../utils/databaseInMemory.js";
16
15
  import { entity, json, key } from "../../utils/errorFormatting.js";
17
16
  import { getTypeArgumentsRecord } from "../dsl/declarations/Decl.js";
18
17
  import { createEntityIdentifierType } from "../dsl/declarations/EntityDecl.js";
@@ -50,7 +49,7 @@ const validateTranslationObjectStructuralIntegrity = (context, allKeysAreRequire
50
49
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
51
50
  return [TypeError(`expected an object, but got ${json(value, context.useStyling)}`)];
52
51
  }
53
- const expectedKeys = Object.keys(type).filter(key => type[key] !== undefined);
52
+ const expectedKeys = Object.keys(type).filter(transKey => type[transKey] !== undefined);
54
53
  return parallelizeErrors([
55
54
  ...validateUnknownKeys(expectedKeys, Object.keys(value)),
56
55
  ...expectedKeys.map(propName => {
@@ -99,12 +98,12 @@ const createStructuralAttributedStringKeyValidator = (validationOptions) => {
99
98
  const { checkInstanceReferencesInAttributedStrings: checkAttrRefs, checkAttributedStringKeys } = validationOptions.markdown ?? {};
100
99
  if (checkAttributedStringKeys !== undefined) {
101
100
  const generalTest = Array.isArray(checkAttributedStringKeys)
102
- ? key => checkAttributedStringKeys.includes(key)
103
- : key => checkAttributedStringKeys.test(key);
101
+ ? attr => checkAttributedStringKeys.includes(attr)
102
+ : attr => checkAttributedStringKeys.test(attr);
104
103
  if (checkAttrRefs === true || typeof checkAttrRefs === "object") {
105
104
  const { entityKey, instanceKey } = normalizeAttributedStringReferenceKeys(checkAttrRefs);
106
105
  const additionalValidKeys = [entityKey, instanceKey];
107
- return key => generalTest(key) || additionalValidKeys.includes(key);
106
+ return attr => generalTest(attr) || additionalValidKeys.includes(attr);
108
107
  }
109
108
  return generalTest;
110
109
  }
@@ -264,7 +263,7 @@ export const validateTypeStructuralIntegrity = (helpers, inDecls, type, value) =
264
263
  return unknownKeyErrors;
265
264
  }
266
265
  const associatedType = type.values[caseName]?.type;
267
- if (associatedType != null) {
266
+ if (isNotNullish(associatedType)) {
268
267
  if (!(caseName in value)) {
269
268
  return [
270
269
  TypeError(`missing required associated value for case ${key(`"${caseName}"`, helpers.useStyling)}`),
@@ -1,3 +1,4 @@
1
+ import { isNotNullish } from "@elyukai/utils/nullable";
1
2
  export class OptionError extends Error {
2
3
  constructor(message) {
3
4
  super(message);
@@ -5,7 +6,7 @@ export class OptionError extends Error {
5
6
  }
6
7
  }
7
8
  export const validateOption = (value, name, validator) => {
8
- if (value == null || validator(value)) {
9
+ if (!isNotNullish(value) || validator(value)) {
9
10
  return value;
10
11
  }
11
12
  throw new OptionError(`Invalid value for "${name}": ${JSON.stringify(value)}`);
@@ -208,7 +208,7 @@ declarationsApi.get("/:name/instances/:id", (req, res) => {
208
208
  return;
209
209
  }
210
210
  const body = {
211
- instance: instance,
211
+ instance,
212
212
  isLocaleEntity: decl === req.db.schema.localeEntity,
213
213
  };
214
214
  res.json(body);
@@ -289,7 +289,7 @@ declarationsApi.get("/:name/instance", (req, res) => {
289
289
  return;
290
290
  }
291
291
  const body = {
292
- instance: instance,
292
+ instance,
293
293
  };
294
294
  res.json(body);
295
295
  });
@@ -178,7 +178,7 @@ gitApi.post("/reset/:entityName/:instanceId", async (req, res) => {
178
178
  }
179
179
  });
180
180
  gitApi.post("/commit", async (req, res) => {
181
- const message = req.body.message;
181
+ const { message } = req.body;
182
182
  if (typeof message !== "string" || message.length === 0) {
183
183
  res.set("Content-Type", "text/plain");
184
184
  res.status(400).send("Invalid commit message");
@@ -225,7 +225,7 @@ gitApi.get("/branch", async (req, res) => {
225
225
  res.json(body);
226
226
  });
227
227
  gitApi.post("/branch", async (req, res) => {
228
- const branchName = req.body.branchName;
228
+ const { branchName } = req.body;
229
229
  if (typeof branchName !== "string" || branchName.length === 0) {
230
230
  res.set("Content-Type", "text/plain");
231
231
  res.status(400).send("Invalid branch name");
@@ -1,5 +1,5 @@
1
1
  import type { HomeLayoutSection, ServerConfig } from "../config.ts";
2
- import type { TSONDB, ValidationOptions } from "../index.ts";
2
+ import type { DefaultTSONDBTypes, TSONDB, ValidationOptions } from "../index.ts";
3
3
  export type ServerOptions = {
4
4
  port: number;
5
5
  };
@@ -16,4 +16,4 @@ declare global {
16
16
  }
17
17
  }
18
18
  }
19
- export declare const createServer: (db: TSONDB, config: Omit<ServerConfig, "locales">) => void;
19
+ export declare const createServer: <T extends DefaultTSONDBTypes = DefaultTSONDBTypes>(db: TSONDB<T>, config: Omit<ServerConfig<T>, "locales">) => void;
@@ -31,7 +31,7 @@ export const createServer = (db, config) => {
31
31
  app.use(express.json());
32
32
  const defaultLocales = db.locales;
33
33
  const requestLocals = {
34
- db,
34
+ db: db,
35
35
  defaultLocales,
36
36
  locales: defaultLocales,
37
37
  homeLayoutSections,
@@ -57,7 +57,7 @@ export const createServer = (db, config) => {
57
57
  if (customAssetsPath) {
58
58
  app.use("/assets/custom", express.static(customAssetsPath));
59
59
  }
60
- app.get(/^\/.*/, (_req, res) => {
60
+ app.get(/^\/.*/u, (_req, res) => {
61
61
  res.send(`<!DOCTYPE html>
62
62
  <html lang="en">
63
63
  <head>
@@ -3,5 +3,5 @@ export const getQueryParamString = (parsedQueryString, key) => {
3
3
  if (typeof value === "string") {
4
4
  return value;
5
5
  }
6
- return;
6
+ return undefined;
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import type { InstanceContainer, InstanceContent, SingletonInstanceContainer } from "../shared/utils/instances.ts";
2
- import { type EntityDecl, type SingletonEntityDecl } from "./schema/dsl/index.ts";
2
+ import type { EntityDecl, SingletonEntityDecl } from "./schema/dsl/index.ts";
3
3
  import type { AnyEntityMap, AnySingletonEntityMap, GetEntityByName, GetSingletonEntityByName, RegisteredEntityMap, RegisteredSingletonEntityMap } from "./schema/generatedTypeHelpers.ts";
4
- import { type DatabaseInMemory } from "./utils/databaseInMemory.ts";
4
+ import type { DatabaseInMemory } from "./utils/databaseInMemory.ts";
5
5
  import { type ReferencesToInstances } from "./utils/references.ts";
6
6
  export type TransactionStep = {
7
7
  kind: "create";
@@ -2,8 +2,6 @@ import { isEmpty } from "@elyukai/utils/array/nonEmpty";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { getSortOrderKeyPathForReorder } from "../shared/schema/utils/sortOrder.js";
4
4
  import { getErrorMessageForDisplay, HTTPError } from "../shared/utils/error.js";
5
- import {} from "./schema/dsl/index.js";
6
- import {} from "./utils/databaseInMemory.js";
7
5
  import { isReferencedByOtherInstances, updateReferencesToInstances, } from "./utils/references.js";
8
6
  import { getSortOrderStartIndex } from "./utils/sortOrder.js";
9
7
  export const createNewId = () => randomUUID();
@@ -3,7 +3,7 @@ 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
- import { type DatabaseInMemory } from "./databaseInMemory.ts";
6
+ import type { DatabaseInMemory } from "./databaseInMemory.ts";
7
7
  export declare const getChildInstancesFromEntity: (databaseInMemory: DatabaseInMemory, parentEntity: EntityDecl, parentId: string, childEntity: EntityDeclWithParentReference) => InstanceContainer[];
8
8
  export declare const getChildInstances: (db: TSONDB, parentEntity: EntityDecl, parentId: string, recursive?: boolean) => EntityTaggedInstanceContainerWithChildInstances[];
9
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,14 +1,13 @@
1
1
  import { hasKey } from "@elyukai/utils/object";
2
2
  import { error, isError, ok } from "@elyukai/utils/result";
3
+ import { assertExhaustive } from "@elyukai/utils/typeSafety";
3
4
  import { createEnumCaseValue, ENUM_DISCRIMINATOR_KEY, } from "../../shared/schema/declarations/EnumDecl.js";
4
5
  import { NodeKind } from "../../shared/schema/Node.js";
5
6
  import { HTTPError } from "../../shared/utils/error.js";
6
- import {} from "../schema/dsl/index.js";
7
7
  import { isChildEntitiesType } from "../schema/dsl/types/ChildEntitiesType.js";
8
8
  import { Case } from "../schema/generatedTypeHelpers.js";
9
9
  import { isEntityDeclWithParentReference, isEnumDecl, isIncludeIdentifierType, isReferenceIdentifierType, } from "../schema/guards.js";
10
10
  import { reduceNodes } from "../schema/helpers.js";
11
- import {} from "./databaseInMemory.js";
12
11
  const isParentReferenceReferencingParent = (value, parentEntityName, parentId) => {
13
12
  if (typeof value === "object" && value !== null && hasKey(value, ENUM_DISCRIMINATOR_KEY)) {
14
13
  return (value[ENUM_DISCRIMINATOR_KEY] === parentEntityName &&
@@ -33,6 +32,8 @@ const getParentReferenceTypeAux = (type) => {
33
32
  return "enum";
34
33
  case NodeKind.TypeAliasDecl:
35
34
  return getParentReferenceTypeAux(type.reference.type.value);
35
+ default:
36
+ return assertExhaustive(type.reference);
36
37
  }
37
38
  }
38
39
  else if (isReferenceIdentifierType(type)) {
@@ -1,7 +1,7 @@
1
1
  import { type Result } from "@elyukai/utils/result";
2
2
  import type { InstanceContent } from "../../shared/utils/instances.ts";
3
3
  import type { DefaultTSONDBTypes, EntityName, SingletonEntityName } from "../index.ts";
4
- import { type EntityDecl, type SingletonEntityDecl } from "../schema/dsl/index.ts";
4
+ import type { EntityDecl, SingletonEntityDecl } from "../schema/dsl/index.ts";
5
5
  import type { AnyChildEntityMap, AnyEntityMap, AnySingletonEntityMap, GetAllChildInstanceContainersForParent, GetAllInstanceContainers, GetAllInstances, GetDisplayName, GetDisplayNameAndId, GetEntityByName, GetInstanceById, GetInstanceOverviewOfEntityById, GetSingletonInstance, RegisteredChildEntityMap, RegisteredEntity, RegisteredEntityMap, RegisteredEnumOrTypeAlias, RegisteredSingletonEntityMap } from "../schema/generatedTypeHelpers.ts";
6
6
  import type { DatabaseInMemory } from "./databaseInMemory.ts";
7
7
  export type CustomConstraintHelpers<EM extends AnyEntityMap = RegisteredEntityMap, CEM extends AnyChildEntityMap = RegisteredChildEntityMap, SEM extends AnySingletonEntityMap = RegisteredSingletonEntityMap> = {
@@ -1,6 +1,5 @@
1
1
  import { error, isError, mapError, ok } from "@elyukai/utils/result";
2
2
  import { NodeKind } from "../../shared/schema/Node.js";
3
- import {} from "../schema/dsl/index.js";
4
3
  import { checkCustomConstraintsInEntityDecl, checkCustomConstraintsInSingletonEntityDecl, } from "../schema/treeOperations/customConstraints.js";
5
4
  const collectErrorsForEntity = (data, entity, getInstanceOverviewOfEntityById, helpers) => {
6
5
  switch (entity.kind) {
@@ -15,7 +15,7 @@ import { HTTPError } from "../../shared/utils/error.js";
15
15
  import { normalizedIdArgs, } from "../schema/generatedTypeHelpers.js";
16
16
  import { getPathToSingletonInstance, readSingletonInstance } from "./files.js";
17
17
  const exec = promisify(child_process.exec);
18
- const ulimit = platform === "win32" ? 2048 : Number.parseInt((await exec("ulimit -n")).stdout);
18
+ const ulimit = platform === "win32" ? 2048 : Number.parseInt((await exec("ulimit -n")).stdout, 10);
19
19
  export class DatabaseInMemory {
20
20
  #data;
21
21
  #singletonData;
@@ -142,9 +142,7 @@ export class DatabaseInMemory {
142
142
  const parentKey = entity.parentReferenceKey;
143
143
  return this.getAllInstanceContainersOfEntity(childEntityName).filter(instance => deepEqual(instance.content[parentKey], parentId));
144
144
  };
145
- getAllChildInstancesForParent = (getEntityByName, childEntityName, parentId) => {
146
- return this.getAllChildInstanceContainersForParent(getEntityByName, childEntityName, parentId).map(container => container.content);
147
- };
145
+ getAllChildInstancesForParent = (getEntityByName, childEntityName, parentId) => this.getAllChildInstanceContainersForParent(getEntityByName, childEntityName, parentId).map(container => container.content);
148
146
  setInstanceContainerOfEntityById(entityName, instance) {
149
147
  const instances = this.#data.get(entityName) ?? Dictionary.empty;
150
148
  return [
@@ -159,20 +157,20 @@ export class DatabaseInMemory {
159
157
  ];
160
158
  }
161
159
  deleteInstanceContainerOfEntityById(entityName, instanceId) {
162
- const instances = this.#data.get(entityName) ?? Dictionary.empty;
163
- const oldInstance = instances.get(instanceId);
164
- return oldInstance
165
- ? [
166
- new DatabaseInMemory(this.#data.modify(entityName, instances => {
167
- if (instances === undefined) {
168
- return instances;
169
- }
170
- const remainingInstances = instances.remove(instanceId);
171
- return remainingInstances.size === 0 ? undefined : remainingInstances;
172
- }), this.#singletonData),
160
+ const instances = this.#data.get(entityName);
161
+ const oldInstance = instances?.get(instanceId);
162
+ if (oldInstance !== undefined) {
163
+ const remainingInstances = instances?.remove(instanceId) ?? Dictionary.empty;
164
+ return [
165
+ remainingInstances.size === 0
166
+ ? new DatabaseInMemory(this.#data.remove(entityName), this.#singletonData)
167
+ : new DatabaseInMemory(this.#data.set(entityName, remainingInstances), this.#singletonData),
173
168
  oldInstance.content,
174
- ]
175
- : [this, undefined];
169
+ ];
170
+ }
171
+ else {
172
+ return [this, undefined];
173
+ }
176
174
  }
177
175
  deleteInstanceContainerOfSingletonEntity(entityName) {
178
176
  const oldInstance = this.#singletonData.get(entityName);
@@ -209,7 +207,7 @@ export class DatabaseInMemory {
209
207
  }
210
208
  reorderInstanceOfEntity(entityName, keyPath, instanceId, newIndex, startIndex = 0) {
211
209
  const instancesWithPositions = this.getAllInstanceContainersOfEntity(entityName).map(instance => [instance.id, getValueAtKeyPathIfDefined(instance.content, keyPath)]);
212
- const normalizedInstancesWithPositions = instancesWithPositions.toSorted(on(([_, position]) => position, compareNumber));
210
+ const normalizedInstancesWithPositions = instancesWithPositions.toSorted(on(([_id, position]) => position, compareNumber));
213
211
  const currentIndex = normalizedInstancesWithPositions.findIndex(([id]) => id === instanceId);
214
212
  if (currentIndex === -1) {
215
213
  throw new HTTPError(400, `Instance with ID "${instanceId}" does not exist in entity "${entityName}"`);
@@ -1,8 +1,10 @@
1
1
  import { error, ok } from "@elyukai/utils/result";
2
+ import { assertExhaustive } from "@elyukai/utils/typeSafety";
2
3
  import * as DatabaseFilesystem from "./files.js";
3
4
  const rollbackChanges = async (root, steps, formatterOptions) => {
4
5
  for (const step of steps) {
5
6
  try {
7
+ // oxlint-disable-next-line no-await-in-loop
6
8
  await runReverseStepAction(root, step, formatterOptions);
7
9
  }
8
10
  catch (e) {
@@ -23,6 +25,8 @@ const runStepAction = (root, step, formatterOptions) => {
23
25
  return DatabaseFilesystem.writeSingletonInstance(root, step.entity, step.instanceContent, formatterOptions);
24
26
  case "deleteSingleton":
25
27
  return DatabaseFilesystem.deleteSingletonInstance(root, step.entity.name);
28
+ default:
29
+ return assertExhaustive(step);
26
30
  }
27
31
  };
28
32
  const runReverseStepAction = (root, step, formatterOptions) => {
@@ -39,6 +43,8 @@ const runReverseStepAction = (root, step, formatterOptions) => {
39
43
  return DatabaseFilesystem.writeSingletonInstance(root, step.entity, step.oldInstance, formatterOptions);
40
44
  case "deleteSingleton":
41
45
  return DatabaseFilesystem.writeSingletonInstance(root, step.entity, step.oldInstance, formatterOptions);
46
+ default:
47
+ return assertExhaustive(step);
42
48
  }
43
49
  };
44
50
  export const applyStepsToDisk = async (root, steps, formatterOptions) => {
@@ -46,9 +52,11 @@ export const applyStepsToDisk = async (root, steps, formatterOptions) => {
46
52
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
47
53
  const step = steps[i];
48
54
  try {
55
+ // oxlint-disable-next-line no-await-in-loop
49
56
  await runStepAction(root, step, formatterOptions);
50
57
  }
51
58
  catch (e) {
59
+ // oxlint-disable-next-line no-await-in-loop
52
60
  await rollbackChanges(root, steps.slice(0, i), formatterOptions);
53
61
  return error(e);
54
62
  }
@@ -2,7 +2,7 @@ import { type DisplayNameResult } from "../../shared/utils/displayName.ts";
2
2
  import type { InstanceContainer, InstanceContainerOverview, InstanceContent } from "../../shared/utils/instances.ts";
3
3
  import type { EntityDecl } from "../schema/dsl/declarations/EntityDecl.ts";
4
4
  import { type AnyChildEntityMap, type AnyEntityMap, type GetAllChildInstanceContainersForParent, type GetDisplayNameWithLocaleId, type GetEntityByName, type GetInstanceById, type GetInstanceContainerById, type IdArgsVariant, type RegisteredChildEntityMap, type RegisteredEntity, type RegisteredEntityMap } from "../schema/generatedTypeHelpers.js";
5
- import { type DatabaseInMemory } from "./databaseInMemory.ts";
5
+ import type { DatabaseInMemory } from "./databaseInMemory.ts";
6
6
  export type GetChildInstancesForInstanceId = (parentEntityName: string, parentId: string, childEntityName: string) => {
7
7
  id: string;
8
8
  content: InstanceContent;
@@ -2,7 +2,6 @@ import { sortBySortOrder } from "../../shared/schema/utils/sortOrder.js";
2
2
  import { getSerializedDisplayNameFromEntityInstance, } from "../../shared/utils/displayName.js";
3
3
  import { normalizedIdArgs, } from "../schema/generatedTypeHelpers.js";
4
4
  import { serializeNode } from "../schema/treeOperations/serialization.js";
5
- import {} from "./databaseInMemory.js";
6
5
  export const getDisplayNameFromEntityInstance = (entity, instanceContainer, getEntityByName, getInstanceById, getAllChildInstancesForParent, locales, defaultName = "", useCustomizer = true) => {
7
6
  const instanceDisplayNameCustomizer = entity.instanceDisplayNameCustomizer;
8
7
  if (useCustomizer && instanceDisplayNameCustomizer) {
@@ -17,9 +16,9 @@ export const getDisplayNameFromEntityInstance = (entity, instanceContainer, getE
17
16
  getDisplayNameForInstanceId: (...args) => {
18
17
  const instance = getInstanceById(...args);
19
18
  const { entityName } = normalizedIdArgs(args);
20
- const entity = getEntityByName(entityName);
21
- if (instance && entity) {
22
- return getDisplayNameFromEntityInstance(entity, instance, getEntityByName, getInstanceById, getAllChildInstancesForParent, locales, instance.id);
19
+ const entityOfInstance = getEntityByName(entityName);
20
+ if (instance && entityOfInstance) {
21
+ return getDisplayNameFromEntityInstance(entityOfInstance, instance, getEntityByName, getInstanceById, getAllChildInstancesForParent, locales, instance.id);
23
22
  }
24
23
  else {
25
24
  return undefined;
@@ -47,28 +46,24 @@ export const getInstanceOverview = (getInstanceById, getAllChildInstancesForPare
47
46
  gitStatus: instance.gitStatus,
48
47
  };
49
48
  };
50
- export const getInstanceOverviewsByEntityName = (getInstanceById, getAllChildInstancesForParent, getEntityByName, entity, instances, locales) => {
51
- return sortBySortOrder(instances.map((instance) => {
52
- const { name, localeId } = getDisplayNameFromEntityInstance(entity, instance, getEntityByName, getInstanceById, getAllChildInstancesForParent, locales);
53
- return [
54
- instance,
55
- {
56
- id: instance.id,
57
- displayName: name,
58
- displayNameLocaleId: localeId,
59
- gitStatus: instance.gitStatus,
60
- },
61
- ];
62
- }), entity.sortOrder).map(arr => arr[1]);
63
- };
64
- export const getAllInstanceOverviewsByEntityName = (getEntityByName, databaseInMemory, locales) => {
65
- return Object.fromEntries(databaseInMemory.getAllInstances().map(([entityName, instances]) => {
66
- const entity = getEntityByName(entityName);
67
- return [
68
- entityName,
69
- getInstanceOverviewsByEntityName(databaseInMemory.getInstanceContainerOfEntityById.bind(databaseInMemory), databaseInMemory.getAllChildInstanceContainersForParent.bind(databaseInMemory, getEntityByName), getEntityByName,
70
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
71
- entity, instances, locales),
72
- ];
73
- }));
74
- };
49
+ export const getInstanceOverviewsByEntityName = (getInstanceById, getAllChildInstancesForParent, getEntityByName, entity, instances, locales) => sortBySortOrder(instances.map((instance) => {
50
+ const { name, localeId } = getDisplayNameFromEntityInstance(entity, instance, getEntityByName, getInstanceById, getAllChildInstancesForParent, locales);
51
+ return [
52
+ instance,
53
+ {
54
+ id: instance.id,
55
+ displayName: name,
56
+ displayNameLocaleId: localeId,
57
+ gitStatus: instance.gitStatus,
58
+ },
59
+ ];
60
+ }), entity.sortOrder).map(arr => arr[1]);
61
+ export const getAllInstanceOverviewsByEntityName = (getEntityByName, databaseInMemory, locales) => Object.fromEntries(databaseInMemory.getAllInstances().map(([entityName, instances]) => {
62
+ const entity = getEntityByName(entityName);
63
+ return [
64
+ entityName,
65
+ getInstanceOverviewsByEntityName(databaseInMemory.getInstanceContainerOfEntityById.bind(databaseInMemory), databaseInMemory.getAllChildInstanceContainersForParent.bind(databaseInMemory, getEntityByName), getEntityByName,
66
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
67
+ entity, instances, locales),
68
+ ];
69
+ }));
@@ -1,6 +1,6 @@
1
1
  import type { InstanceContent } from "../../shared/utils/instances.ts";
2
2
  import type { FormatterOptions } from "../config.ts";
3
- import { type EntityDecl, type SingletonEntityDecl } from "../schema/dsl/index.ts";
3
+ import type { EntityDecl, SingletonEntityDecl } from "../schema/dsl/index.ts";
4
4
  export declare const getFileNameForId: (id: string) => string;
5
5
  export declare const getSingletonFileName: (entityName: string) => string;
6
6
  export declare const getPathToInstance: (dataRoot: string, entityName: string, id: string) => string;