tsondb 0.5.19 → 0.6.1
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.
- package/dist/src/bin/tsondb.js +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/node/config.d.ts +20 -0
- package/dist/src/node/config.js +5 -0
- package/dist/src/node/index.d.ts +3 -2
- package/dist/src/node/index.js +13 -8
- package/dist/src/node/renderers/jsonschema/render.d.ts +1 -1
- package/dist/src/node/renderers/jsonschema/render.js +12 -7
- package/dist/src/node/renderers/ts/render.d.ts +1 -1
- package/dist/src/node/renderers/ts/render.js +12 -6
- package/dist/src/node/schema/Node.d.ts +100 -29
- package/dist/src/node/schema/Node.js +268 -61
- package/dist/src/node/schema/Schema.js +96 -1
- package/dist/src/node/schema/TypeParameter.d.ts +7 -9
- package/dist/src/node/schema/TypeParameter.js +7 -5
- package/dist/src/node/schema/declarations/Declaration.d.ts +10 -28
- package/dist/src/node/schema/declarations/Declaration.js +8 -110
- package/dist/src/node/schema/declarations/EntityDecl.d.ts +48 -48
- package/dist/src/node/schema/declarations/EntityDecl.js +15 -12
- package/dist/src/node/schema/declarations/EnumDecl.d.ts +14 -17
- package/dist/src/node/schema/declarations/EnumDecl.js +12 -12
- package/dist/src/node/schema/declarations/TypeAliasDecl.d.ts +8 -14
- package/dist/src/node/schema/declarations/TypeAliasDecl.js +10 -11
- package/dist/src/node/schema/index.d.ts +0 -2
- package/dist/src/node/schema/index.js +0 -1
- package/dist/src/node/schema/types/Type.d.ts +19 -42
- package/dist/src/node/schema/types/Type.js +29 -167
- package/dist/src/node/schema/types/generic/ArrayType.d.ts +5 -14
- package/dist/src/node/schema/types/generic/ArrayType.js +15 -20
- package/dist/src/node/schema/types/generic/EnumType.d.ts +5 -17
- package/dist/src/node/schema/types/generic/EnumType.js +12 -20
- package/dist/src/node/schema/types/generic/ObjectType.d.ts +5 -19
- package/dist/src/node/schema/types/generic/ObjectType.js +11 -15
- package/dist/src/node/schema/types/primitives/BooleanType.d.ts +7 -8
- package/dist/src/node/schema/types/primitives/BooleanType.js +5 -4
- package/dist/src/node/schema/types/primitives/DateType.d.ts +6 -8
- package/dist/src/node/schema/types/primitives/DateType.js +5 -4
- package/dist/src/node/schema/types/primitives/FloatType.d.ts +9 -21
- package/dist/src/node/schema/types/primitives/FloatType.js +5 -4
- package/dist/src/node/schema/types/primitives/IntegerType.d.ts +9 -21
- package/dist/src/node/schema/types/primitives/IntegerType.js +5 -4
- package/dist/src/node/schema/types/primitives/StringType.d.ts +6 -10
- package/dist/src/node/schema/types/primitives/StringType.js +5 -4
- package/dist/src/node/schema/types/references/ChildEntitiesType.d.ts +18 -0
- package/dist/src/node/schema/types/references/ChildEntitiesType.js +18 -0
- package/dist/src/node/schema/types/references/IncludeIdentifierType.d.ts +7 -13
- package/dist/src/node/schema/types/references/IncludeIdentifierType.js +12 -12
- package/dist/src/node/schema/types/references/NestedEntityMapType.d.ts +7 -17
- package/dist/src/node/schema/types/references/NestedEntityMapType.js +11 -13
- package/dist/src/node/schema/types/references/ReferenceIdentifierType.d.ts +4 -10
- package/dist/src/node/schema/types/references/ReferenceIdentifierType.js +3 -5
- package/dist/src/node/schema/types/references/TypeArgumentType.d.ts +5 -10
- package/dist/src/node/schema/types/references/TypeArgumentType.js +10 -5
- package/dist/src/node/server/api/declarations.js +24 -6
- package/dist/src/node/server/api/index.js +11 -0
- package/dist/src/node/server/api/instances.js +9 -6
- package/dist/src/node/server/index.d.ts +6 -1
- package/dist/src/node/server/index.js +7 -3
- package/dist/src/node/server/init.d.ts +2 -1
- package/dist/src/node/server/init.js +11 -11
- package/dist/src/node/server/utils/childInstances.d.ts +4 -0
- package/dist/src/node/server/utils/childInstances.js +41 -0
- package/dist/src/node/server/utils/instanceOperations.d.ts +8 -0
- package/dist/src/node/server/utils/instanceOperations.js +107 -0
- package/dist/src/node/server/utils/locales.d.ts +2 -0
- package/dist/src/node/server/utils/locales.js +8 -0
- package/dist/src/node/utils/childInstances.d.ts +32 -0
- package/dist/src/node/utils/childInstances.js +164 -0
- package/dist/src/node/utils/displayName.d.ts +2 -1
- package/dist/src/node/utils/displayName.js +5 -4
- package/dist/src/node/utils/files.d.ts +5 -0
- package/dist/src/node/utils/files.js +9 -0
- package/dist/src/node/utils/instanceOperations.d.ts +14 -0
- package/dist/src/node/utils/instanceOperations.js +88 -0
- package/dist/src/node/utils/instances.d.ts +1 -1
- package/dist/src/node/utils/instances.js +12 -6
- package/dist/src/node/utils/references.d.ts +3 -1
- package/dist/src/node/utils/references.js +43 -18
- package/dist/src/node/utils/referencesWorker.d.ts +5 -0
- package/dist/src/node/utils/referencesWorker.js +22 -0
- package/dist/src/node/utils/workers.d.ts +15 -0
- package/dist/src/node/utils/workers.js +90 -0
- package/dist/src/shared/api.d.ts +14 -1
- package/dist/src/shared/schema/Node.d.ts +63 -0
- package/dist/src/shared/schema/Node.js +128 -0
- package/dist/src/shared/schema/TypeParameter.d.ts +9 -0
- package/dist/src/shared/schema/TypeParameter.js +2 -0
- package/dist/src/shared/schema/declarations/Declaration.d.ts +21 -0
- package/dist/src/shared/schema/declarations/Declaration.js +4 -0
- package/dist/src/shared/schema/declarations/EntityDecl.d.ts +32 -0
- package/dist/src/shared/schema/declarations/EntityDecl.js +8 -0
- package/dist/src/shared/schema/declarations/EnumDecl.d.ts +11 -0
- package/dist/src/shared/schema/declarations/EnumDecl.js +9 -0
- package/dist/src/shared/schema/declarations/TypeAliasDecl.d.ts +11 -0
- package/dist/src/shared/schema/declarations/TypeAliasDecl.js +7 -0
- package/dist/src/shared/schema/types/ArrayType.d.ts +11 -0
- package/dist/src/shared/schema/types/ArrayType.js +8 -0
- package/dist/src/shared/schema/types/BooleanType.d.ts +7 -0
- package/dist/src/shared/schema/types/BooleanType.js +2 -0
- package/dist/src/shared/schema/types/ChildEntitiesType.d.ts +8 -0
- package/dist/src/shared/schema/types/ChildEntitiesType.js +2 -0
- package/dist/src/shared/schema/types/DateType.d.ts +8 -0
- package/dist/src/shared/schema/types/DateType.js +2 -0
- package/dist/src/shared/schema/types/EnumType.d.ts +14 -0
- package/dist/src/shared/schema/types/EnumType.js +28 -0
- package/dist/src/shared/schema/types/FloatType.d.ts +11 -0
- package/dist/src/shared/schema/types/FloatType.js +2 -0
- package/dist/src/shared/schema/types/IncludeIdentifierType.d.ts +11 -0
- package/dist/src/shared/schema/types/IncludeIdentifierType.js +13 -0
- package/dist/src/shared/schema/types/IntegerType.d.ts +11 -0
- package/dist/src/shared/schema/types/IntegerType.js +2 -0
- package/dist/src/shared/schema/types/NestedEntityMapType.d.ts +17 -0
- package/dist/src/shared/schema/types/NestedEntityMapType.js +14 -0
- package/dist/src/shared/schema/types/ObjectType.d.ts +19 -0
- package/dist/src/shared/schema/types/ObjectType.js +14 -0
- package/dist/src/shared/schema/types/ReferenceIdentifierType.d.ts +8 -0
- package/dist/src/shared/schema/types/ReferenceIdentifierType.js +2 -0
- package/dist/src/shared/schema/types/StringType.d.ts +10 -0
- package/dist/src/shared/schema/types/StringType.js +2 -0
- package/dist/src/shared/schema/types/Type.d.ts +20 -0
- package/dist/src/shared/schema/types/TypeArgumentType.d.ts +12 -0
- package/dist/src/shared/schema/types/TypeArgumentType.js +7 -0
- package/dist/src/shared/utils/array.d.ts +4 -0
- package/dist/src/shared/utils/array.js +30 -0
- package/dist/src/shared/utils/async.d.ts +8 -0
- package/dist/src/shared/utils/async.js +35 -0
- package/dist/src/shared/utils/compare.js +3 -3
- package/dist/src/shared/utils/displayName.d.ts +6 -2
- package/dist/src/shared/utils/displayName.js +21 -8
- package/dist/src/shared/utils/instances.d.ts +2 -3
- package/dist/src/shared/utils/instances.js +3 -1
- package/dist/src/shared/utils/markdown.d.ts +4 -0
- package/dist/src/shared/utils/markdown.js +91 -4
- package/dist/src/shared/utils/object.d.ts +2 -0
- package/dist/src/shared/utils/object.js +2 -0
- package/dist/src/shared/utils/result.d.ts +8 -2
- package/dist/src/shared/utils/result.js +1 -1
- package/dist/src/web/api/declarations.d.ts +26 -0
- package/dist/src/web/api/declarations.js +51 -0
- package/dist/src/web/api/git.d.ts +14 -0
- package/dist/src/web/api/git.js +20 -0
- package/dist/src/web/api/index.d.ts +1 -0
- package/dist/src/web/api/index.js +2 -0
- package/dist/src/web/api/instances.d.ts +2 -0
- package/dist/src/web/api/instances.js +2 -0
- package/dist/src/web/components/Git.js +19 -16
- package/dist/src/web/components/InstanceRouteSkeleton.d.ts +42 -0
- package/dist/src/web/components/InstanceRouteSkeleton.js +114 -0
- package/dist/src/web/components/Layout.js +3 -2
- package/dist/src/web/components/ModalDialog.d.ts +2 -0
- package/dist/src/web/components/ModalDialog.js +16 -0
- package/dist/src/web/components/Select.d.ts +1 -2
- package/dist/src/web/components/Settings.d.ts +2 -0
- package/dist/src/web/components/Settings.js +47 -0
- package/dist/src/web/components/typeInputs/ArrayTypeInput.d.ts +3 -11
- package/dist/src/web/components/typeInputs/ArrayTypeInput.js +5 -4
- package/dist/src/web/components/typeInputs/BooleanTypeInput.d.ts +3 -6
- package/dist/src/web/components/typeInputs/BooleanTypeInput.js +2 -2
- package/dist/src/web/components/typeInputs/ChildEntitiesTypeInput.d.ts +6 -0
- package/dist/src/web/components/typeInputs/ChildEntitiesTypeInput.js +27 -0
- package/dist/src/web/components/typeInputs/DateTypeInput.d.ts +3 -6
- package/dist/src/web/components/typeInputs/DateTypeInput.js +2 -2
- package/dist/src/web/components/typeInputs/EnumTypeInput.d.ts +3 -11
- package/dist/src/web/components/typeInputs/EnumTypeInput.js +55 -22
- package/dist/src/web/components/typeInputs/FloatTypeInput.d.ts +3 -6
- package/dist/src/web/components/typeInputs/FloatTypeInput.js +2 -2
- package/dist/src/web/components/typeInputs/GenericTypeArgumentIdentifierTypeInput.d.ts +3 -4
- package/dist/src/web/components/typeInputs/IncludeIdentifierTypeInput.d.ts +3 -11
- package/dist/src/web/components/typeInputs/IncludeIdentifierTypeInput.js +3 -2
- package/dist/src/web/components/typeInputs/IntegerTypeInput.d.ts +3 -6
- package/dist/src/web/components/typeInputs/IntegerTypeInput.js +2 -2
- package/dist/src/web/components/typeInputs/NestedEntityMapTypeInput.d.ts +3 -11
- package/dist/src/web/components/typeInputs/NestedEntityMapTypeInput.js +5 -4
- package/dist/src/web/components/typeInputs/ObjectTypeInput.d.ts +3 -11
- package/dist/src/web/components/typeInputs/ObjectTypeInput.js +8 -5
- package/dist/src/web/components/typeInputs/ReferenceIdentifierTypeInput.d.ts +3 -8
- package/dist/src/web/components/typeInputs/ReferenceIdentifierTypeInput.js +2 -2
- package/dist/src/web/components/typeInputs/StringTypeInput.d.ts +3 -6
- package/dist/src/web/components/typeInputs/StringTypeInput.js +3 -3
- package/dist/src/web/components/typeInputs/TypeInput.d.ts +12 -4
- package/dist/src/web/components/typeInputs/TypeInput.js +22 -17
- package/dist/src/web/components/typeInputs/utils/ValidationErrors.d.ts +1 -0
- package/dist/src/web/components/typeInputs/utils/ValidationErrors.js +1 -3
- package/dist/src/web/context/config.d.ts +11 -0
- package/dist/src/web/context/config.js +6 -0
- package/dist/src/web/context/entities.d.ts +8 -5
- package/dist/src/web/context/entities.js +1 -1
- package/dist/src/web/context/settings.d.ts +8 -0
- package/dist/src/web/context/settings.js +10 -0
- package/dist/src/web/hooks/useEntityFromRoute.d.ts +1 -1
- package/dist/src/web/hooks/useEntityFromRoute.js +2 -2
- package/dist/src/web/hooks/useInstanceNamesByEntity.d.ts +1 -1
- package/dist/src/web/hooks/useInstanceNamesByEntity.js +4 -2
- package/dist/src/web/hooks/useMappedAPIResource.js +2 -4
- package/dist/src/web/hooks/useSecondaryDeclarations.d.ts +1 -1
- package/dist/src/web/hooks/useSecondaryDeclarations.js +8 -4
- package/dist/src/web/hooks/useSettings.d.ts +10 -0
- package/dist/src/web/hooks/useSettings.js +51 -0
- package/dist/src/web/index.js +11 -5
- package/dist/src/web/routes/CreateInstance.js +40 -79
- package/dist/src/web/routes/Entity.js +42 -19
- package/dist/src/web/routes/Home.js +24 -5
- package/dist/src/web/routes/Instance.js +34 -85
- package/dist/src/web/utils/InlineMarkdown.d.ts +1 -1
- package/dist/src/web/utils/InlineMarkdown.js +13 -1
- package/dist/src/web/utils/api.d.ts +25 -0
- package/dist/src/web/utils/api.js +34 -0
- package/dist/src/web/utils/typeSkeleton.d.ts +1 -1
- package/dist/src/web/utils/typeSkeleton.js +2 -0
- package/package.json +14 -13
- package/public/css/styles.css +171 -12
- package/dist/src/node/schema/types/primitives/NumericType.d.ts +0 -6
- package/dist/src/node/schema/types/primitives/NumericType.js +0 -2
- package/dist/src/node/schema/types/primitives/PrimitiveType.d.ts +0 -6
- package/dist/src/node/schema/validation/type.d.ts +0 -4
- package/dist/src/node/schema/validation/type.js +0 -1
- package/dist/src/node/server/api/instanceOperations.d.ts +0 -6
- package/dist/src/node/server/api/instanceOperations.js +0 -93
- package/dist/src/shared/config.d.ts +0 -11
- package/dist/src/shared/config.js +0 -1
- package/dist/src/web/api.d.ts +0 -24
- package/dist/src/web/api.js +0 -201
- /package/dist/src/{node/schema/types/primitives/PrimitiveType.js → shared/schema/types/Type.js} +0 -0
|
@@ -29,3 +29,33 @@ export const difference = (oldArr, newArr) => newArr.reduce((acc, item) => {
|
|
|
29
29
|
return acc;
|
|
30
30
|
}, { removed: oldArr, added: newArr });
|
|
31
31
|
export const unique = (arr, equalityCheck = (a, b) => a === b) => arr.filter((item, index) => arr.findIndex(other => equalityCheck(item, other)) === index);
|
|
32
|
+
/**
|
|
33
|
+
* Moves an element from one position to another within the array.
|
|
34
|
+
*/
|
|
35
|
+
export const reorder = (arr, sourceIndex, targetIndex) => {
|
|
36
|
+
if (sourceIndex < 0 || sourceIndex >= arr.length) {
|
|
37
|
+
throw new RangeError(`source index ${sourceIndex.toString()} is out of bounds for array of length ${arr.length.toString()}`);
|
|
38
|
+
}
|
|
39
|
+
if (targetIndex < 0 || targetIndex >= arr.length) {
|
|
40
|
+
throw new RangeError(`target index ${targetIndex.toString()} is out of bounds for array of length ${arr.length.toString()}`);
|
|
41
|
+
}
|
|
42
|
+
if (sourceIndex === targetIndex) {
|
|
43
|
+
return arr;
|
|
44
|
+
}
|
|
45
|
+
if (sourceIndex < targetIndex) {
|
|
46
|
+
return [
|
|
47
|
+
...arr.slice(0, sourceIndex),
|
|
48
|
+
...arr.slice(sourceIndex + 1, targetIndex + 1),
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
50
|
+
arr[sourceIndex],
|
|
51
|
+
...arr.slice(targetIndex + 1),
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
return [
|
|
55
|
+
...arr.slice(0, targetIndex),
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
57
|
+
arr[sourceIndex],
|
|
58
|
+
...arr.slice(targetIndex, sourceIndex),
|
|
59
|
+
...arr.slice(sourceIndex + 1),
|
|
60
|
+
];
|
|
61
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple async map to process tasks with a concurrency limit.
|
|
3
|
+
* @param tasks The list of tasks to process.
|
|
4
|
+
* @param worker The async function to process each task.
|
|
5
|
+
* @param concurrency The maximum number of concurrent tasks.
|
|
6
|
+
* @returns A promise that resolves to the list of results.
|
|
7
|
+
*/
|
|
8
|
+
export declare const mapAsync: <T, R>(tasks: readonly T[], worker: (task: T) => Promise<R>, concurrency: number) => Promise<R[]>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple async map to process tasks with a concurrency limit.
|
|
3
|
+
* @param tasks The list of tasks to process.
|
|
4
|
+
* @param worker The async function to process each task.
|
|
5
|
+
* @param concurrency The maximum number of concurrent tasks.
|
|
6
|
+
* @returns A promise that resolves to the list of results.
|
|
7
|
+
*/
|
|
8
|
+
export const mapAsync = (tasks, worker, concurrency) => new Promise((resolve, reject) => {
|
|
9
|
+
const results = [];
|
|
10
|
+
let activeIndex = 0;
|
|
11
|
+
let activeCount = 0;
|
|
12
|
+
let resolvedCount = 0;
|
|
13
|
+
const totalCount = tasks.length;
|
|
14
|
+
const runNext = () => {
|
|
15
|
+
if (resolvedCount === totalCount) {
|
|
16
|
+
resolve(results);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
while (activeCount < concurrency && activeIndex < totalCount) {
|
|
20
|
+
const currentIndex = activeIndex++;
|
|
21
|
+
const task = tasks[currentIndex];
|
|
22
|
+
activeCount++;
|
|
23
|
+
worker(task)
|
|
24
|
+
.then(result => {
|
|
25
|
+
results[currentIndex] = result;
|
|
26
|
+
resolvedCount++;
|
|
27
|
+
activeCount--;
|
|
28
|
+
runNext();
|
|
29
|
+
})
|
|
30
|
+
.catch(reject);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
runNext();
|
|
35
|
+
});
|
|
@@ -2,15 +2,15 @@ export const lt = (a, b) => a < b;
|
|
|
2
2
|
export const lte = (a, b) => a <= b;
|
|
3
3
|
export const gt = (a, b) => a > b;
|
|
4
4
|
export const gte = (a, b) => a >= b;
|
|
5
|
-
export const eq = (a, b) => a
|
|
6
|
-
export const neq = (a, b) => a
|
|
5
|
+
export const eq = (a, b) => Object.is(a, b);
|
|
6
|
+
export const neq = (a, b) => !Object.is(a, b);
|
|
7
7
|
/**
|
|
8
8
|
* Checks two values for value equality. This is a deep equality check that
|
|
9
9
|
* works for all types, including objects and arrays. For objects, it only
|
|
10
10
|
* compares all enumerable keys, no other properties or the prototype chain.
|
|
11
11
|
*/
|
|
12
12
|
export const deepEqual = (a, b) => {
|
|
13
|
-
if (a
|
|
13
|
+
if (Object.is(a, b)) {
|
|
14
14
|
return true;
|
|
15
15
|
}
|
|
16
16
|
if (typeof a === "object" && typeof b === "object" && a !== null && b !== null) {
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import type { SerializedEntityDecl } from "
|
|
2
|
-
export
|
|
1
|
+
import type { SerializedEntityDecl } from "../schema/declarations/EntityDecl.ts";
|
|
2
|
+
export type DisplayNameResult = {
|
|
3
|
+
name: string;
|
|
4
|
+
localeId?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const getSerializedDisplayNameFromEntityInstance: (entity: SerializedEntityDecl, instance: unknown, defaultName: string, locales: string[]) => DisplayNameResult;
|
|
@@ -11,13 +11,16 @@ const getValueAtPath = (value, path) => {
|
|
|
11
11
|
}
|
|
12
12
|
return current;
|
|
13
13
|
};
|
|
14
|
-
export const getSerializedDisplayNameFromEntityInstance = (entity, instance, defaultName, locales
|
|
14
|
+
export const getSerializedDisplayNameFromEntityInstance = (entity, instance, defaultName, locales) => {
|
|
15
15
|
if (entity.displayName === null) {
|
|
16
|
-
return defaultName;
|
|
16
|
+
return { name: defaultName, localeId: locales[0] };
|
|
17
17
|
}
|
|
18
18
|
const displayNamePath = entity.displayName ?? "name";
|
|
19
19
|
if (typeof displayNamePath === "string") {
|
|
20
|
-
return
|
|
20
|
+
return {
|
|
21
|
+
name: getValueAtPath(instance, displayNamePath) ?? defaultName,
|
|
22
|
+
localeId: locales[0],
|
|
23
|
+
};
|
|
21
24
|
}
|
|
22
25
|
else {
|
|
23
26
|
const localeMapPath = displayNamePath.pathToLocaleMap ?? "translations";
|
|
@@ -25,12 +28,22 @@ export const getSerializedDisplayNameFromEntityInstance = (entity, instance, def
|
|
|
25
28
|
const pathInLocaleMap = displayNamePath.pathInLocaleMap ?? "name";
|
|
26
29
|
const availableLocales = Object.keys(localeMap ?? {});
|
|
27
30
|
return availableLocales.length === 0
|
|
28
|
-
? defaultName
|
|
29
|
-
: (locales.reduce((name, locale) =>
|
|
31
|
+
? { name: defaultName }
|
|
32
|
+
: (locales.reduce((name, locale) => {
|
|
33
|
+
if (name)
|
|
34
|
+
return name;
|
|
30
35
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
31
|
-
getValueAtPath(localeMap[locale], pathInLocaleMap)
|
|
36
|
+
const possibleName = getValueAtPath(localeMap[locale], pathInLocaleMap);
|
|
37
|
+
if (possibleName) {
|
|
38
|
+
return { name: possibleName, localeId: locale };
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
}, undefined) ?? {
|
|
44
|
+
name:
|
|
32
45
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
33
|
-
getValueAtPath(localeMap[availableLocales[0]], pathInLocaleMap) ??
|
|
34
|
-
|
|
46
|
+
getValueAtPath(localeMap[availableLocales[0]], pathInLocaleMap) ?? defaultName,
|
|
47
|
+
});
|
|
35
48
|
}
|
|
36
49
|
};
|
|
@@ -2,16 +2,15 @@ import type { EntityDecl } from "../../node/schema/index.ts";
|
|
|
2
2
|
import type { GetInstanceById } from "../../node/server/index.ts";
|
|
3
3
|
import type { GitFileStatus } from "./git.ts";
|
|
4
4
|
export interface InstanceContainer {
|
|
5
|
-
fileName: string;
|
|
6
5
|
id: string;
|
|
7
6
|
content: unknown;
|
|
8
7
|
gitStatus?: GitFileStatus;
|
|
9
8
|
}
|
|
10
9
|
export interface InstanceContainerOverview {
|
|
11
|
-
fileName: string;
|
|
12
10
|
id: string;
|
|
13
11
|
gitStatus?: GitFileStatus;
|
|
14
12
|
displayName: string;
|
|
13
|
+
displayNameLocaleId?: string;
|
|
15
14
|
}
|
|
16
|
-
export declare const getInstanceContainerOverview: (entity: EntityDecl, instanceContainer: InstanceContainer, getInstanceById: GetInstanceById, locales
|
|
15
|
+
export declare const getInstanceContainerOverview: (entity: EntityDecl, instanceContainer: InstanceContainer, getInstanceById: GetInstanceById, locales: string[]) => InstanceContainerOverview;
|
|
17
16
|
export type InstancesByEntityName = Record<string, InstanceContainer[]>;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { getDisplayNameFromEntityInstance } from "../../node/utils/displayName.js";
|
|
2
2
|
export const getInstanceContainerOverview = (entity, instanceContainer, getInstanceById, locales) => {
|
|
3
3
|
const { content: _, ...rest } = instanceContainer;
|
|
4
|
+
const { name: displayName, localeId: displayNameLocaleId } = getDisplayNameFromEntityInstance(entity, instanceContainer.content, getInstanceById, locales);
|
|
4
5
|
return {
|
|
5
6
|
...rest,
|
|
6
|
-
displayName
|
|
7
|
+
displayName,
|
|
8
|
+
displayNameLocaleId,
|
|
7
9
|
};
|
|
8
10
|
};
|
|
@@ -12,6 +12,10 @@ export type InlineMarkdownNode = {
|
|
|
12
12
|
kind: "link";
|
|
13
13
|
href: string;
|
|
14
14
|
content: InlineMarkdownNode[];
|
|
15
|
+
} | {
|
|
16
|
+
kind: "attributed";
|
|
17
|
+
attributes: Record<string, string | number | boolean>;
|
|
18
|
+
content: InlineMarkdownNode[];
|
|
15
19
|
} | TextNode;
|
|
16
20
|
export type BlockMarkdownNode = {
|
|
17
21
|
kind: "paragraph";
|
|
@@ -54,7 +54,7 @@ const italicRule = {
|
|
|
54
54
|
}),
|
|
55
55
|
};
|
|
56
56
|
const linkRule = {
|
|
57
|
-
pattern: /(
|
|
57
|
+
pattern: /(?<![\\^])\[(.*?[^\\])\]\((.*?[^\\])\)/,
|
|
58
58
|
map: (result, parseInside) => ({
|
|
59
59
|
kind: "link",
|
|
60
60
|
href: result[2] ?? "",
|
|
@@ -66,6 +66,88 @@ const linkRule = {
|
|
|
66
66
|
content: [textNode("["), ...parseInside(result[1] ?? ""), textNode(`](${result[2] ?? ""})`)],
|
|
67
67
|
}),
|
|
68
68
|
};
|
|
69
|
+
const booleanAttributePattern = /^(true|false)/;
|
|
70
|
+
const numberAttributePattern = /^(-?\d+(\.\d+)?)/;
|
|
71
|
+
const stringAttributePattern = /^("(.*?)(?<!\\)"|'(.*?)(?<!\\)')/;
|
|
72
|
+
const parseAttributeValue = (text) => {
|
|
73
|
+
const booleanResult = booleanAttributePattern.exec(text);
|
|
74
|
+
if (booleanResult !== null) {
|
|
75
|
+
return [booleanResult[1] === "true", booleanResult[0]];
|
|
76
|
+
}
|
|
77
|
+
const numberResult = numberAttributePattern.exec(text);
|
|
78
|
+
if (numberResult !== null) {
|
|
79
|
+
return [Number.parseFloat(numberResult[1] ?? "0"), numberResult[0]];
|
|
80
|
+
}
|
|
81
|
+
const stringResult = stringAttributePattern.exec(text);
|
|
82
|
+
if (stringResult !== null) {
|
|
83
|
+
return [stringResult[2] ?? stringResult[3] ?? "", stringResult[0]];
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
};
|
|
87
|
+
const attributeNamePattern = /^(\w+)(: *)/;
|
|
88
|
+
const attributeSeparatorPattern = /^,( *)/;
|
|
89
|
+
const parseNextAttributes = (text) => {
|
|
90
|
+
const separatorResult = attributeSeparatorPattern.exec(text);
|
|
91
|
+
if (separatorResult === null) {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
const remainingText = text.slice(separatorResult[0].length);
|
|
95
|
+
return [separatorResult[0], ...parseAttributes(remainingText)];
|
|
96
|
+
};
|
|
97
|
+
const parseAttributes = (text) => {
|
|
98
|
+
const nameResult = attributeNamePattern.exec(text);
|
|
99
|
+
if (nameResult === null) {
|
|
100
|
+
return [];
|
|
101
|
+
}
|
|
102
|
+
const name = nameResult[1] ?? "";
|
|
103
|
+
const separator = nameResult[2] ?? "";
|
|
104
|
+
const remainingText = text.slice(nameResult[0].length);
|
|
105
|
+
const valueResult = parseAttributeValue(remainingText);
|
|
106
|
+
if (valueResult === null) {
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
const [value, rawValue] = valueResult;
|
|
110
|
+
return [
|
|
111
|
+
{ name, separator, value, rawValue },
|
|
112
|
+
...parseNextAttributes(remainingText.slice(rawValue.length)),
|
|
113
|
+
];
|
|
114
|
+
};
|
|
115
|
+
const mapAttributesToObject = (rawAttributes) => Object.fromEntries(rawAttributes.filter(attr => typeof attr !== "string").map(attr => [attr.name, attr.value]));
|
|
116
|
+
const mapAttributesToNodes = (rawAttributes) => rawAttributes.flatMap(attr => typeof attr === "string"
|
|
117
|
+
? [textNode(attr)]
|
|
118
|
+
: [textNode(attr.name), textNode(attr.separator), textNode(attr.rawValue)]);
|
|
119
|
+
const parsedAttributesLength = (rawAttributes) => rawAttributes.reduce((sum, attr) => sum +
|
|
120
|
+
(typeof attr === "string"
|
|
121
|
+
? attr.length
|
|
122
|
+
: attr.name.length + attr.separator.length + attr.rawValue.length), 0);
|
|
123
|
+
const attributedRule = {
|
|
124
|
+
pattern: /(?<!\\)\^\[(.*?[^\\])\]\(((?:\w+: *(?:true|false|\d+(?:\.\d+)?|"(.*?)(?<!\\)"|'(.*?)(?<!\\)'))(?:, *\w+: *(?:true|false|\d+(?:\.\d+)?|"(.*?)(?<!\\)"|'(.*?)(?<!\\)'))*)\)/,
|
|
125
|
+
map: (result, parseInside) => ({
|
|
126
|
+
kind: "attributed",
|
|
127
|
+
attributes: mapAttributesToObject(parseAttributes(result[2] ?? "")),
|
|
128
|
+
content: parseInside(result[1] ?? ""),
|
|
129
|
+
}),
|
|
130
|
+
mapHighlighting: (result, parseInside) => {
|
|
131
|
+
const attributesText = result[2] ?? "";
|
|
132
|
+
const attributes = parseAttributes(attributesText);
|
|
133
|
+
const length = parsedAttributesLength(attributes);
|
|
134
|
+
const unparsedText = attributesText.length > length
|
|
135
|
+
? [{ kind: "text", content: attributesText.slice(length) }]
|
|
136
|
+
: [];
|
|
137
|
+
return {
|
|
138
|
+
kind: "attributed",
|
|
139
|
+
attributes: mapAttributesToObject(attributes),
|
|
140
|
+
content: [
|
|
141
|
+
textNode("^["),
|
|
142
|
+
...parseInside(result[1] ?? ""),
|
|
143
|
+
textNode("]("),
|
|
144
|
+
...mapAttributesToNodes(attributes),
|
|
145
|
+
...unparsedText,
|
|
146
|
+
textNode(")"),
|
|
147
|
+
],
|
|
148
|
+
};
|
|
149
|
+
},
|
|
150
|
+
};
|
|
69
151
|
const textNode = (content) => ({
|
|
70
152
|
kind: "text",
|
|
71
153
|
content: content,
|
|
@@ -85,6 +167,7 @@ const textRule = {
|
|
|
85
167
|
const inlineRules = [
|
|
86
168
|
codeRule,
|
|
87
169
|
linkRule,
|
|
170
|
+
attributedRule,
|
|
88
171
|
boldWithItalicRule,
|
|
89
172
|
italicWithBoldRule,
|
|
90
173
|
boldRule,
|
|
@@ -114,6 +197,10 @@ const parseForInlineRules = (rules, text, forSyntaxHighlighting) => {
|
|
|
114
197
|
}
|
|
115
198
|
};
|
|
116
199
|
const parseInlineMarkdown = (text, forSyntaxHighlighting) => parseForInlineRules(inlineRules, text, forSyntaxHighlighting);
|
|
200
|
+
const nodesForTrailingWhitespace = (text) => {
|
|
201
|
+
const trailingWhitespace = text ?? "";
|
|
202
|
+
return trailingWhitespace.length === 0 ? [] : [textNode(trailingWhitespace)];
|
|
203
|
+
};
|
|
117
204
|
const listRule = {
|
|
118
205
|
pattern: /^((?:(?:\d+\.|[-*]) [^\n]+?)(?:\n(?:\d+\.|[-*]) [^\n]+?)*)(\n{2,}|$)/,
|
|
119
206
|
map: result => ({
|
|
@@ -133,7 +220,7 @@ const listRule = {
|
|
|
133
220
|
...parseInlineMarkdown(item.replace(/^\d+\. |[-*] /, ""), true),
|
|
134
221
|
...(index < array.length - 1 ? [textNode("\n")] : []),
|
|
135
222
|
]),
|
|
136
|
-
|
|
223
|
+
...nodesForTrailingWhitespace(result[2]),
|
|
137
224
|
],
|
|
138
225
|
};
|
|
139
226
|
const paragraphRule = {
|
|
@@ -144,7 +231,7 @@ const paragraphRule = {
|
|
|
144
231
|
}),
|
|
145
232
|
mapHighlighting: result => [
|
|
146
233
|
...parseInlineMarkdown(result[1] ?? "", true),
|
|
147
|
-
|
|
234
|
+
...nodesForTrailingWhitespace(result[2]),
|
|
148
235
|
],
|
|
149
236
|
};
|
|
150
237
|
const removeSurroundingPipes = (text) => text.replace(/^\|/, "").replace(/\|$/, "");
|
|
@@ -183,7 +270,7 @@ const tableRule = {
|
|
|
183
270
|
? parseInlineMarkdown(tc, true)
|
|
184
271
|
: [tableMarker("|"), ...parseInlineMarkdown(tc, true)]),
|
|
185
272
|
]) ?? []),
|
|
186
|
-
|
|
273
|
+
...nodesForTrailingWhitespace(result[6]),
|
|
187
274
|
],
|
|
188
275
|
};
|
|
189
276
|
const blockRules = [tableRule, listRule, paragraphRule];
|
|
@@ -4,3 +4,5 @@ export declare const mergeObjects: <T>(obj1: Record<string, T>, obj2: Record<str
|
|
|
4
4
|
export type Leaves<T> = T extends object ? {
|
|
5
5
|
[K in keyof T]: T[K] extends unknown[] ? never : `${Exclude<K, symbol>}${Leaves<T[K]> extends never ? "" : `.${Leaves<T[K]>}`}`;
|
|
6
6
|
}[keyof T] : never;
|
|
7
|
+
export declare const onlyKeys: <T extends object, K extends keyof T>(obj: T, ...keys: K[]) => Pick<T, K>;
|
|
8
|
+
export declare const hasKey: <T extends object, K extends PropertyKey>(obj: T, key: K) => obj is T & { [k in K]: unknown; };
|
|
@@ -8,3 +8,5 @@ export const mergeObjects = (obj1, obj2, solveConflict) => Object.entries(obj2).
|
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
9
9
|
[key]: Object.hasOwn(acc, key) ? solveConflict(acc[key], value) : value,
|
|
10
10
|
}), obj1);
|
|
11
|
+
export const onlyKeys = (obj, ...keys) => Object.fromEntries(Object.entries(obj).filter(([key]) => keys.includes(key)));
|
|
12
|
+
export const hasKey = (obj, key) => Object.hasOwn(obj, key);
|
|
@@ -19,7 +19,10 @@ export interface Error<E> {
|
|
|
19
19
|
/**
|
|
20
20
|
* Creates a result that contains a value.
|
|
21
21
|
*/
|
|
22
|
-
export declare const ok:
|
|
22
|
+
export declare const ok: {
|
|
23
|
+
(): Result<void, never>;
|
|
24
|
+
<T>(value: T): Result<T, never>;
|
|
25
|
+
};
|
|
23
26
|
/**
|
|
24
27
|
* Checks if a result contains a value.
|
|
25
28
|
*/
|
|
@@ -46,7 +49,10 @@ export declare const map: <T, U, E>(result: Result<T, E>, f: (value: T) => U) =>
|
|
|
46
49
|
export declare const mapError: <T, E, F>(result: Result<T, E>, f: (value: E) => F) => Result<T, F>;
|
|
47
50
|
export declare const combine: <T1, T2, TR, E1, E2, ER>(result1: Result<T1, E1>, result2: Result<T2, E2>, fok: (value1: T1, value2: T2) => TR, ferror: (error1: E1, error2: E2) => ER) => Result<TR, E1 | E2 | ER>;
|
|
48
51
|
export declare const Result: Readonly<{
|
|
49
|
-
ok:
|
|
52
|
+
ok: {
|
|
53
|
+
(): Result<void, never>;
|
|
54
|
+
<T>(value: T): Result<T, never>;
|
|
55
|
+
};
|
|
50
56
|
isOk: <T, E>(result: Result<T, E>) => result is Ok<T>;
|
|
51
57
|
error: <E>(error: E) => Result<never, E>;
|
|
52
58
|
isError: <T, E>(result: Result<T, E>) => result is Error<E>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CreatedEntityTaggedInstanceContainerWithChildInstances, UpdatedEntityTaggedInstanceContainerWithChildInstances } from "../../node/utils/childInstances.ts";
|
|
2
|
+
import type { CreateInstanceOfEntityResponseBody, DeleteInstanceOfEntityResponseBody, GetAllChildInstancesOfInstanceResponseBody, GetAllDeclarationsResponseBody, GetAllInstancesOfEntityResponseBody, GetDeclarationResponseBody, GetInstanceOfEntityResponseBody, UpdateInstanceOfEntityResponseBody } from "../../shared/api.ts";
|
|
3
|
+
import type { SerializedDecl } from "../../shared/schema/declarations/Declaration.ts";
|
|
4
|
+
import type { SerializedEntityDecl } from "../../shared/schema/declarations/EntityDecl.ts";
|
|
5
|
+
import type { SerializedEnumDecl } from "../../shared/schema/declarations/EnumDecl.ts";
|
|
6
|
+
import type { SerializedTypeAliasDecl } from "../../shared/schema/declarations/TypeAliasDecl.ts";
|
|
7
|
+
type DeclKind = "Entity" | "Enum" | "TypeAlias";
|
|
8
|
+
type DeclTypeForKind<K extends DeclKind | undefined> = K extends "Entity" ? SerializedEntityDecl : K extends "Enum" ? SerializedEnumDecl : K extends "TypeAlias" ? SerializedTypeAliasDecl : SerializedDecl;
|
|
9
|
+
export declare const getAllDeclarations: {
|
|
10
|
+
(locales: string[], kind?: undefined): Promise<GetAllDeclarationsResponseBody>;
|
|
11
|
+
<D extends "Entity" | "Enum" | "TypeAlias">(locales: string[], kind: D): Promise<GetAllDeclarationsResponseBody<DeclTypeForKind<D>>>;
|
|
12
|
+
};
|
|
13
|
+
export declare const getAllEntities: (locales: string[]) => Promise<GetAllDeclarationsResponseBody<SerializedEntityDecl<string, {
|
|
14
|
+
[x: string]: import("../../shared/schema/types/ObjectType.ts").SerializedMemberDecl<import("../../shared/schema/types/Type.ts").SerializedType, boolean>;
|
|
15
|
+
}, string | undefined>>>;
|
|
16
|
+
export declare const getEntityByName: (locales: string[], name: string) => Promise<GetDeclarationResponseBody<SerializedEntityDecl<string, {
|
|
17
|
+
[x: string]: import("../../shared/schema/types/ObjectType.ts").SerializedMemberDecl<import("../../shared/schema/types/Type.ts").SerializedType, boolean>;
|
|
18
|
+
}, string | undefined>>>;
|
|
19
|
+
export declare const getInstancesByEntityName: (locales: string[], name: string) => Promise<GetAllInstancesOfEntityResponseBody>;
|
|
20
|
+
export declare const getLocaleInstances: (locales: string[], localeEntityName: string | undefined) => Promise<GetAllInstancesOfEntityResponseBody>;
|
|
21
|
+
export declare const createInstanceByEntityNameAndId: (locales: string[], name: string, content: CreatedEntityTaggedInstanceContainerWithChildInstances, id?: string) => Promise<CreateInstanceOfEntityResponseBody>;
|
|
22
|
+
export declare const getInstanceByEntityNameAndId: (locales: string[], name: string, id: string) => Promise<GetInstanceOfEntityResponseBody>;
|
|
23
|
+
export declare const updateInstanceByEntityNameAndId: (locales: string[], name: string, id: string, content: UpdatedEntityTaggedInstanceContainerWithChildInstances) => Promise<UpdateInstanceOfEntityResponseBody>;
|
|
24
|
+
export declare const deleteInstanceByEntityNameAndId: (locales: string[], name: string, id: string) => Promise<DeleteInstanceOfEntityResponseBody>;
|
|
25
|
+
export declare const getChildInstancesForInstanceByEntityName: (locales: string[], name: string, parentId: string) => Promise<GetAllChildInstancesOfInstanceResponseBody>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { deleteResource, getResource, postResource, putResource } from "../utils/api.js";
|
|
2
|
+
export const getAllDeclarations = async (locales, kind) => getResource("/api/declarations", {
|
|
3
|
+
locales,
|
|
4
|
+
modifyUrl: url => {
|
|
5
|
+
if (kind) {
|
|
6
|
+
url.searchParams.append("kind", kind);
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
export const getAllEntities = (locales) => getAllDeclarations(locales, "Entity");
|
|
11
|
+
export const getEntityByName = async (locales, name) => getResource(`/api/declarations/${name}`, {
|
|
12
|
+
locales,
|
|
13
|
+
});
|
|
14
|
+
export const getInstancesByEntityName = async (locales, name) => getResource(`/api/declarations/${name}/instances`, {
|
|
15
|
+
locales,
|
|
16
|
+
});
|
|
17
|
+
export const getLocaleInstances = (locales, localeEntityName) => localeEntityName
|
|
18
|
+
? getInstancesByEntityName(locales, localeEntityName)
|
|
19
|
+
: Promise.resolve({ instances: [], isLocaleEntity: true });
|
|
20
|
+
export const createInstanceByEntityNameAndId = async (locales, name, content, id) => {
|
|
21
|
+
const body = {
|
|
22
|
+
instance: content,
|
|
23
|
+
};
|
|
24
|
+
return postResource(`/api/declarations/${name}/instances`, {
|
|
25
|
+
locales,
|
|
26
|
+
body,
|
|
27
|
+
modifyUrl: url => {
|
|
28
|
+
if (id) {
|
|
29
|
+
url.searchParams.append("id", id);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export const getInstanceByEntityNameAndId = async (locales, name, id) => getResource(`/api/declarations/${name}/instances/${id}`, {
|
|
35
|
+
locales,
|
|
36
|
+
});
|
|
37
|
+
export const updateInstanceByEntityNameAndId = async (locales, name, id, content) => {
|
|
38
|
+
const body = {
|
|
39
|
+
instance: content,
|
|
40
|
+
};
|
|
41
|
+
return putResource(`/api/declarations/${name}/instances/${id}`, {
|
|
42
|
+
locales,
|
|
43
|
+
body,
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
export const deleteInstanceByEntityNameAndId = async (locales, name, id) => deleteResource(`/api/declarations/${name}/instances/${id}`, {
|
|
47
|
+
locales,
|
|
48
|
+
});
|
|
49
|
+
export const getChildInstancesForInstanceByEntityName = async (locales, name, parentId) => getResource(`/api/declarations/${name}/instances/${parentId}/children`, {
|
|
50
|
+
locales,
|
|
51
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GetAllGitBranchesResponseBody, GitStatusResponseBody } from "../../shared/api.ts";
|
|
2
|
+
export declare const getStatus: (locales: string[]) => Promise<GitStatusResponseBody>;
|
|
3
|
+
export declare const stageAllFiles: (locales: string[]) => Promise<void>;
|
|
4
|
+
export declare const stageAllFilesOfEntity: (locales: string[], entityName: string) => Promise<void>;
|
|
5
|
+
export declare const stageFileOfEntity: (locales: string[], entityName: string, id: string) => Promise<void>;
|
|
6
|
+
export declare const unstageAllFiles: (locales: string[]) => Promise<void>;
|
|
7
|
+
export declare const unstageAllFilesOfEntity: (locales: string[], entityName: string) => Promise<void>;
|
|
8
|
+
export declare const unstageFileOfEntity: (locales: string[], entityName: string, id: string) => Promise<void>;
|
|
9
|
+
export declare const commitStagedFiles: (locales: string[], message: string) => Promise<void>;
|
|
10
|
+
export declare const pushCommits: (locales: string[]) => Promise<void>;
|
|
11
|
+
export declare const pullCommits: (locales: string[]) => Promise<void>;
|
|
12
|
+
export declare const getBranches: (locales: string[]) => Promise<GetAllGitBranchesResponseBody>;
|
|
13
|
+
export declare const createBranch: (locales: string[], branchName: string) => Promise<void>;
|
|
14
|
+
export declare const switchBranch: (locales: string[], branchName: string) => Promise<void>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getResource, postResource } from "../utils/api.js";
|
|
2
|
+
export const getStatus = async (locales) => getResource("/api/git/status", { locales });
|
|
3
|
+
export const stageAllFiles = async (locales) => postResource("/api/git/stage", { locales });
|
|
4
|
+
export const stageAllFilesOfEntity = async (locales, entityName) => postResource(`/api/git/stage/${entityName}`, { locales });
|
|
5
|
+
export const stageFileOfEntity = async (locales, entityName, id) => postResource(`/api/git/stage/${entityName}/${id}`, { locales });
|
|
6
|
+
export const unstageAllFiles = async (locales) => postResource(`/api/git/unstage`, { locales });
|
|
7
|
+
export const unstageAllFilesOfEntity = async (locales, entityName) => postResource(`/api/git/unstage/${entityName}`, { locales });
|
|
8
|
+
export const unstageFileOfEntity = async (locales, entityName, id) => postResource(`/api/git/unstage/${entityName}/${id}`, { locales });
|
|
9
|
+
export const commitStagedFiles = async (locales, message) => {
|
|
10
|
+
const body = { message };
|
|
11
|
+
return postResource(`/api/git/commit`, { locales, body });
|
|
12
|
+
};
|
|
13
|
+
export const pushCommits = async (locales) => postResource(`/api/git/push`, { locales });
|
|
14
|
+
export const pullCommits = async (locales) => postResource(`/api/git/pull`, { locales });
|
|
15
|
+
export const getBranches = async (locales) => getResource(`/api/git/branch`, { locales });
|
|
16
|
+
export const createBranch = async (locales, branchName) => {
|
|
17
|
+
const body = { branchName };
|
|
18
|
+
return postResource(`/api/git/branch`, { locales, body });
|
|
19
|
+
};
|
|
20
|
+
export const switchBranch = async (locales, branchName) => postResource(`/api/git/branch/${branchName}`, { locales });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getWebConfig: () => Promise<import("../context/config.ts").WebConfig>;
|