@dialecte/core 0.0.17 → 0.0.18
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/chain-methods → chain-methods}/chain-assembler.d.ts +4 -3
- package/dist/chain-methods/chain-assembler.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/chain-creator.d.ts +4 -3
- package/dist/chain-methods/chain-creator.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/ending/index.d.ts +1 -0
- package/dist/chain-methods/ending/index.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/ending/queries/context.d.ts +3 -2
- package/dist/chain-methods/ending/queries/context.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/ending/queries/descendants/filter-utils.helper.d.ts +3 -2
- package/dist/chain-methods/ending/queries/descendants/filter-utils.helper.d.ts.map +1 -0
- package/dist/chain-methods/ending/queries/descendants/find-descendants-as-tree.d.ts +9 -0
- package/dist/chain-methods/ending/queries/descendants/find-descendants-as-tree.d.ts.map +1 -0
- package/dist/chain-methods/ending/queries/descendants/find-descendants.d.ts +16 -0
- package/dist/chain-methods/ending/queries/descendants/find-descendants.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/ending/queries/descendants/flatten-tree.helper.d.ts +2 -1
- package/dist/chain-methods/ending/queries/descendants/flatten-tree.helper.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/ending/queries/descendants/group-records.helper.d.ts +2 -1
- package/dist/chain-methods/ending/queries/descendants/group-records.helper.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/ending/queries/descendants/index.d.ts +1 -0
- package/dist/chain-methods/ending/queries/descendants/index.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/ending/queries/descendants/match-conditions.helper.d.ts +3 -2
- package/dist/chain-methods/ending/queries/descendants/match-conditions.helper.d.ts.map +1 -0
- package/dist/chain-methods/ending/queries/descendants/types.d.ts +35 -0
- package/dist/chain-methods/ending/queries/descendants/types.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/ending/queries/descendants/walk-ancestry.helper.d.ts +2 -1
- package/dist/chain-methods/ending/queries/descendants/walk-ancestry.helper.d.ts.map +1 -0
- package/dist/chain-methods/ending/queries/find-children.d.ts +9 -0
- package/dist/chain-methods/ending/queries/find-children.d.ts.map +1 -0
- package/dist/chain-methods/ending/queries/find-children.types.d.ts +6 -0
- package/dist/chain-methods/ending/queries/find-children.types.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/ending/queries/get-attributes-values.d.ts +2 -1
- package/dist/chain-methods/ending/queries/get-attributes-values.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/ending/queries/get-parent.d.ts +2 -1
- package/dist/chain-methods/ending/queries/get-parent.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/ending/queries/get-tree.d.ts +4 -3
- package/dist/chain-methods/ending/queries/get-tree.d.ts.map +1 -0
- package/dist/chain-methods/ending/queries/get-tree.types.d.ts +18 -0
- package/dist/chain-methods/ending/queries/get-tree.types.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/ending/queries/index.d.ts +1 -0
- package/dist/chain-methods/ending/queries/index.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/ending/transaction/commit.d.ts +3 -2
- package/dist/chain-methods/ending/transaction/commit.d.ts.map +1 -0
- package/dist/chain-methods/ending/transaction/index.d.ts +2 -0
- package/dist/chain-methods/ending/transaction/index.d.ts.map +1 -0
- package/dist/chain-methods/ending/transaction/merge-operations.d.ts +33 -0
- package/dist/chain-methods/ending/transaction/merge-operations.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/index.d.ts +1 -0
- package/dist/chain-methods/index.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/mutations/clone.d.ts +3 -2
- package/dist/chain-methods/mutations/clone.d.ts.map +1 -0
- package/dist/chain-methods/mutations/clone.types.d.ts +17 -0
- package/dist/chain-methods/mutations/clone.types.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/mutations/create.d.ts +4 -3
- package/dist/chain-methods/mutations/create.d.ts.map +1 -0
- package/dist/chain-methods/mutations/create.types.d.ts +32 -0
- package/dist/chain-methods/mutations/create.types.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/mutations/delete.d.ts +5 -4
- package/dist/chain-methods/mutations/delete.d.ts.map +1 -0
- package/dist/chain-methods/mutations/delete.types.d.ts +6 -0
- package/dist/chain-methods/mutations/delete.types.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/mutations/index.d.ts +1 -0
- package/dist/chain-methods/mutations/index.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/mutations/update.d.ts +4 -3
- package/dist/chain-methods/mutations/update.d.ts.map +1 -0
- package/dist/chain-methods/mutations/update.types.d.ts +6 -0
- package/dist/chain-methods/mutations/update.types.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/navigation/go-to-element.d.ts +5 -4
- package/dist/chain-methods/navigation/go-to-element.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/navigation/go-to-parent.d.ts +6 -5
- package/dist/chain-methods/navigation/go-to-parent.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/navigation/index.d.ts +1 -0
- package/dist/chain-methods/navigation/index.d.ts.map +1 -0
- package/dist/chain-methods/navigation/types.d.ts +12 -0
- package/dist/chain-methods/navigation/types.d.ts.map +1 -0
- package/dist/{src/chain-methods → chain-methods}/types.d.ts +10 -9
- package/dist/chain-methods/types.d.ts.map +1 -0
- package/dist/{src/database → database}/index.d.ts +1 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/{src/database → database}/instance.d.ts +3 -2
- package/dist/database/instance.d.ts.map +1 -0
- package/dist/database/types.d.ts +8 -0
- package/dist/database/types.d.ts.map +1 -0
- package/dist/{src/dialecte → dialecte}/entrypoints.d.ts +5 -4
- package/dist/dialecte/entrypoints.d.ts.map +1 -0
- package/dist/{src/dialecte → dialecte}/index.d.ts +1 -0
- package/dist/dialecte/index.d.ts.map +1 -0
- package/dist/{src/dialecte → dialecte}/main.d.ts +3 -2
- package/dist/dialecte/main.d.ts.map +1 -0
- package/dist/{src/dialecte → dialecte}/state.d.ts +2 -1
- package/dist/dialecte/state.d.ts.map +1 -0
- package/dist/{src/dialecte → dialecte}/types.d.ts +7 -6
- package/dist/dialecte/types.d.ts.map +1 -0
- package/dist/{src/errors → errors}/codes.d.ts +1 -0
- package/dist/errors/codes.d.ts.map +1 -0
- package/dist/{src/errors → errors}/errors.d.ts +3 -2
- package/dist/errors/errors.d.ts.map +1 -0
- package/dist/{src/errors → errors}/index.d.ts +1 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/types.d.ts +23 -0
- package/dist/errors/types.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/assert.d.ts +1 -0
- package/dist/helpers/assert.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/index.d.ts +1 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/record/converter.d.ts +2 -1
- package/dist/helpers/record/converter.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/record/guard.d.ts +2 -1
- package/dist/helpers/record/guard.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/record/index.d.ts +1 -0
- package/dist/helpers/record/index.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/record/operations.d.ts +2 -1
- package/dist/helpers/record/operations.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/record/query/find-by-attributes.d.ts +4 -3
- package/dist/helpers/record/query/find-by-attributes.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/record/query/index.d.ts +1 -0
- package/dist/helpers/record/query/index.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/record/query/record.d.ts +3 -2
- package/dist/helpers/record/query/record.d.ts.map +1 -0
- package/dist/helpers/record/query/types.d.ts +10 -0
- package/dist/helpers/record/query/types.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/record/standardizing.d.ts +2 -1
- package/dist/helpers/record/standardizing.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/test-fixtures/config.d.ts +36 -35
- package/dist/helpers/test-fixtures/config.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/test-fixtures/constant.d.ts +1 -0
- package/dist/helpers/test-fixtures/constant.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/test-fixtures/create-test-dialecte.d.ts +4 -3
- package/dist/helpers/test-fixtures/create-test-dialecte.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/test-fixtures/generated/constants.generated.d.ts +42 -41
- package/dist/helpers/test-fixtures/generated/constants.generated.d.ts.map +1 -0
- package/dist/helpers/test-fixtures/generated/definition.d.ts +3 -0
- package/dist/helpers/test-fixtures/generated/definition.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/test-fixtures/generated/index.d.ts +1 -0
- package/dist/helpers/test-fixtures/generated/index.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/test-fixtures/generated/types.generated.d.ts +38 -37
- package/dist/helpers/test-fixtures/generated/types.generated.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/test-fixtures/index.d.ts +1 -0
- package/dist/helpers/test-fixtures/index.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/test-fixtures/test-operations.d.ts +5 -4
- package/dist/helpers/test-fixtures/test-operations.d.ts.map +1 -0
- package/dist/helpers/test-fixtures/test-operations.types.d.ts +20 -0
- package/dist/helpers/test-fixtures/test-operations.types.d.ts.map +1 -0
- package/dist/{src/helpers → helpers}/test-fixtures/test-record.d.ts +3 -2
- package/dist/helpers/test-fixtures/test-record.d.ts.map +1 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/{src/io → io}/export/constant.d.ts +1 -0
- package/dist/io/export/constant.d.ts.map +1 -0
- package/dist/{src/io → io}/export/download-file.d.ts +2 -1
- package/dist/io/export/download-file.d.ts.map +1 -0
- package/dist/{src/io → io}/export/formatter.d.ts +1 -0
- package/dist/io/export/formatter.d.ts.map +1 -0
- package/dist/{src/io → io}/export/index.d.ts +1 -0
- package/dist/io/export/index.d.ts.map +1 -0
- package/dist/{src/io → io}/export/main.d.ts +2 -1
- package/dist/io/export/main.d.ts.map +1 -0
- package/dist/{src/io → io}/import/database-helpers.d.ts +2 -1
- package/dist/io/import/database-helpers.d.ts.map +1 -0
- package/dist/{src/io → io}/import/guards.d.ts +1 -0
- package/dist/io/import/guards.d.ts.map +1 -0
- package/dist/{src/io → io}/import/index.d.ts +1 -0
- package/dist/io/import/index.d.ts.map +1 -0
- package/dist/{src/io → io}/import/main.d.ts +2 -1
- package/dist/io/import/main.d.ts.map +1 -0
- package/dist/{src/io → io}/import/parser.d.ts +3 -2
- package/dist/io/import/parser.d.ts.map +1 -0
- package/dist/{src/io → io}/import/relationships.d.ts +2 -1
- package/dist/io/import/relationships.d.ts.map +1 -0
- package/dist/io/import/test.handler.d.ts +9 -0
- package/dist/io/import/test.handler.d.ts.map +1 -0
- package/dist/io/import/test.types.d.ts +4 -0
- package/dist/io/import/test.types.d.ts.map +1 -0
- package/dist/{src/io → io}/import/types.d.ts +5 -4
- package/dist/io/import/types.d.ts.map +1 -0
- package/dist/{src/io → io}/index.d.ts +1 -0
- package/dist/io/index.d.ts.map +1 -0
- package/dist/script/element-parent-mapping.d.ts +2 -0
- package/dist/script/element-parent-mapping.d.ts.map +1 -0
- package/dist/script/find-unreferenced-elements.d.ts +3 -0
- package/dist/script/find-unreferenced-elements.d.ts.map +1 -0
- package/dist/script/generate-definition.d.ts +3 -0
- package/dist/script/generate-definition.d.ts.map +1 -0
- package/dist/script/generate-definition.types.d.ts +86 -0
- package/dist/script/generate-definition.types.d.ts.map +1 -0
- package/dist/script/generate-test-fixtures.d.ts +16 -0
- package/dist/script/generate-test-fixtures.d.ts.map +1 -0
- package/dist/script/pyodide.d.ts +12 -0
- package/dist/script/pyodide.d.ts.map +1 -0
- package/dist/script/sorted-dexie-dump-json.d.ts +2 -0
- package/dist/script/sorted-dexie-dump-json.d.ts.map +1 -0
- package/dist/script/test-pyodide.d.ts +9 -0
- package/dist/script/test-pyodide.d.ts.map +1 -0
- package/dist/types/context.d.ts +16 -0
- package/dist/types/context.d.ts.map +1 -0
- package/dist/{src/types → types}/definition.d.ts +7 -6
- package/dist/types/definition.d.ts.map +1 -0
- package/dist/{src/types → types}/dialecte-config.d.ts +32 -31
- package/dist/types/dialecte-config.d.ts.map +1 -0
- package/dist/{src/types → types}/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/{src/types → types}/io.d.ts +4 -3
- package/dist/types/io.d.ts.map +1 -0
- package/dist/{src/types → types}/operations.d.ts +6 -5
- package/dist/types/operations.d.ts.map +1 -0
- package/dist/types/records.d.ts +57 -0
- package/dist/types/records.d.ts.map +1 -0
- package/dist/{src/utils → utils}/attributes.d.ts +2 -1
- package/dist/utils/attributes.d.ts.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/package.json +8 -8
- package/dist/env.d.ts +0 -1
- package/dist/src/chain-methods/ending/queries/descendants/find-descendants-as-tree.d.ts +0 -51
- package/dist/src/chain-methods/ending/queries/descendants/find-descendants.d.ts +0 -59
- package/dist/src/chain-methods/ending/queries/descendants/types.d.ts +0 -34
- package/dist/src/chain-methods/ending/queries/find-children.d.ts +0 -8
- package/dist/src/chain-methods/ending/queries/find-children.types.d.ts +0 -5
- package/dist/src/chain-methods/ending/queries/get-tree.types.d.ts +0 -17
- package/dist/src/chain-methods/ending/transaction/index.d.ts +0 -1
- package/dist/src/chain-methods/ending/transaction/merge-operations.d.ts +0 -20
- package/dist/src/chain-methods/mutations/clone.types.d.ts +0 -16
- package/dist/src/chain-methods/mutations/create.types.d.ts +0 -31
- package/dist/src/chain-methods/mutations/delete.types.d.ts +0 -5
- package/dist/src/chain-methods/mutations/update.types.d.ts +0 -5
- package/dist/src/chain-methods/navigation/types.d.ts +0 -11
- package/dist/src/database/types.d.ts +0 -8
- package/dist/src/errors/types.d.ts +0 -22
- package/dist/src/helpers/record/query/types.d.ts +0 -9
- package/dist/src/helpers/test-fixtures/generated/definition.d.ts +0 -1
- package/dist/src/helpers/test-fixtures/test-operations.types.d.ts +0 -19
- package/dist/src/index.d.ts +0 -7
- package/dist/src/types/context.d.ts +0 -15
- package/dist/src/types/records.d.ts +0 -56
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/vitest.shims.d.ts +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { AnyDialecteConfig, ElementsOf } from './dialecte-config';
|
|
2
|
+
import { RawRecord } from './records';
|
|
3
3
|
/**
|
|
4
4
|
* Operation status for tracking element lifecycle
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type OperationStatus = 'created' | 'updated' | 'deleted' | 'unchanged';
|
|
7
7
|
/**
|
|
8
8
|
* Staged operation - tracks changes before commit
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export type Operation<GenericConfig extends AnyDialecteConfig> = {
|
|
11
11
|
status: 'created';
|
|
12
12
|
oldRecord: undefined;
|
|
13
13
|
newRecord: RawRecord<GenericConfig, ElementsOf<GenericConfig>>;
|
|
@@ -23,4 +23,5 @@ export declare type Operation<GenericConfig extends AnyDialecteConfig> = {
|
|
|
23
23
|
/**
|
|
24
24
|
* Generic operation for contexts where specific dialecte is not known
|
|
25
25
|
*/
|
|
26
|
-
export
|
|
26
|
+
export type AnyOperation = Operation<AnyDialecteConfig>;
|
|
27
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/types/operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAE1C;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,CAAA;AAE7E;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,aAAa,SAAS,iBAAiB,IAC1D;IACA,MAAM,EAAE,SAAS,CAAA;IACjB,SAAS,EAAE,SAAS,CAAA;IACpB,SAAS,EAAE,SAAS,CAAC,aAAa,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,CAAA;CAC7D,GACD;IACA,MAAM,EAAE,SAAS,CAAA;IACjB,SAAS,EAAE,SAAS,CAAC,aAAa,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,CAAA;IAC9D,SAAS,EAAE,SAAS,CAAC,aAAa,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,CAAA;CAC7D,GACD;IACA,MAAM,EAAE,SAAS,CAAA;IACjB,SAAS,EAAE,SAAS,CAAC,aAAa,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,CAAA;IAC9D,SAAS,EAAE,SAAS,CAAA;CACnB,CAAA;AAEJ;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC,iBAAiB,CAAC,CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { AnyDialecteConfig, ElementsOf, AttributesOf, ParentsOf, ChildrenOf } from './dialecte-config';
|
|
2
|
+
import { OperationStatus } from './operations';
|
|
3
|
+
export type Namespace = {
|
|
4
|
+
prefix: string;
|
|
5
|
+
uri: string;
|
|
6
|
+
};
|
|
7
|
+
export type AnyRelationship = {
|
|
8
|
+
id: string;
|
|
9
|
+
tagName: string;
|
|
10
|
+
};
|
|
11
|
+
export type ParentRelationship<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = Omit<AnyRelationship, 'tagName'> & {
|
|
12
|
+
tagName: ParentsOf<GenericConfig, GenericElement>;
|
|
13
|
+
};
|
|
14
|
+
export type ChildRelationship<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = Omit<AnyRelationship, 'tagName'> & {
|
|
15
|
+
tagName: ChildrenOf<GenericConfig, GenericElement>;
|
|
16
|
+
};
|
|
17
|
+
export type AnyAttribute = {
|
|
18
|
+
name: string;
|
|
19
|
+
value: string;
|
|
20
|
+
namespace?: Namespace;
|
|
21
|
+
};
|
|
22
|
+
export type Attribute<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = Omit<AnyAttribute, 'name' | 'namespace'> & {
|
|
23
|
+
name: AttributesOf<GenericConfig, GenericElement>;
|
|
24
|
+
};
|
|
25
|
+
export type AnyQualifiedAttribute = Omit<AnyAttribute, 'namespace'> & {
|
|
26
|
+
namespace: Namespace;
|
|
27
|
+
};
|
|
28
|
+
export type QualifiedAttribute<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = Omit<Attribute<GenericConfig, GenericElement>, 'namespace'> & {
|
|
29
|
+
namespace: Namespace;
|
|
30
|
+
};
|
|
31
|
+
export type RawRecord<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = {
|
|
32
|
+
id: string;
|
|
33
|
+
tagName: GenericElement;
|
|
34
|
+
namespace: Namespace;
|
|
35
|
+
attributes: Array<Attribute<GenericConfig, GenericElement> | QualifiedAttribute<GenericConfig, GenericElement>>;
|
|
36
|
+
value: string;
|
|
37
|
+
parent: ParentRelationship<GenericConfig, GenericElement> | null;
|
|
38
|
+
children: ChildRelationship<GenericConfig, GenericElement>[];
|
|
39
|
+
};
|
|
40
|
+
export type AnyRawRecord = {
|
|
41
|
+
id: string;
|
|
42
|
+
tagName: string;
|
|
43
|
+
namespace: Namespace;
|
|
44
|
+
attributes: AnyAttribute[];
|
|
45
|
+
value: string;
|
|
46
|
+
parent: AnyRelationship | null;
|
|
47
|
+
children: AnyRelationship[];
|
|
48
|
+
};
|
|
49
|
+
export type ChainRecord<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = RawRecord<GenericConfig, GenericElement> & {
|
|
50
|
+
status: OperationStatus;
|
|
51
|
+
};
|
|
52
|
+
export type AnyChainRecord<GenericConfig extends AnyDialecteConfig = AnyDialecteConfig> = ChainRecord<GenericConfig, ElementsOf<GenericConfig>>;
|
|
53
|
+
export type TreeRecord<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = ChainRecord<GenericConfig, GenericElement> & {
|
|
54
|
+
tree: TreeRecord<GenericConfig, ChildrenOf<GenericConfig, GenericElement>>[];
|
|
55
|
+
};
|
|
56
|
+
export type AnyTreeRecord<GenericConfig extends AnyDialecteConfig = AnyDialecteConfig> = TreeRecord<GenericConfig, ElementsOf<GenericConfig>>;
|
|
57
|
+
//# sourceMappingURL=records.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/types/records.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AnyDialecteConfig, ElementsOf, FullAttributeObjectOf } from '../types';
|
|
2
2
|
export declare function getAttributeValueByName<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, GenericAttribute extends FullAttributeObjectOf<GenericConfig, GenericElement>>(params: {
|
|
3
3
|
attributes: GenericAttribute[];
|
|
4
4
|
name: GenericAttribute['name'];
|
|
@@ -6,3 +6,4 @@ export declare function getAttributeValueByName<GenericConfig extends AnyDialect
|
|
|
6
6
|
export declare function getAttributesValuesByName<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, GenericAttribute extends FullAttributeObjectOf<GenericConfig, GenericElement>>(params: {
|
|
7
7
|
attributes: GenericAttribute[];
|
|
8
8
|
}): Record<GenericAttribute['name'], GenericAttribute['value']>;
|
|
9
|
+
//# sourceMappingURL=attributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/utils/attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEnF,wBAAgB,uBAAuB,CACtC,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAChD,gBAAgB,SAAS,qBAAqB,CAAC,aAAa,EAAE,cAAc,CAAC,EAC5E,MAAM,EAAE;IACT,UAAU,EAAE,gBAAgB,EAAE,CAAA;IAC9B,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;CAC9B,GAAG,gBAAgB,CAAC,OAAO,CAAC,GAAG,EAAE,CAMjC;AAED,wBAAgB,yBAAyB,CACxC,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAChD,gBAAgB,SAAS,qBAAqB,CAAC,aAAa,EAAE,cAAc,CAAC,EAC5E,MAAM,EAAE;IACT,UAAU,EAAE,gBAAgB,EAAE,CAAA;CAC9B,GAAG,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAY9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dialecte/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"description": "Dialecte - Core functionality for Dialecte SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -62,14 +62,14 @@
|
|
|
62
62
|
"husky": "^9.1.7",
|
|
63
63
|
"jiti": "^2.4.2",
|
|
64
64
|
"npm-run-all2": "^8.0.4",
|
|
65
|
-
"oxfmt": "^0.
|
|
66
|
-
"oxlint": "^1.
|
|
67
|
-
"oxlint-tsgolint": "^0.
|
|
65
|
+
"oxfmt": "^0.35.0",
|
|
66
|
+
"oxlint": "^1.50.0",
|
|
67
|
+
"oxlint-tsgolint": "^0.14.2",
|
|
68
68
|
"playwright": "^1.53.2",
|
|
69
|
-
"tsx": "^4.
|
|
70
|
-
"typescript": "
|
|
71
|
-
"vite": "^7.
|
|
72
|
-
"vite-plugin-dts": "^
|
|
69
|
+
"tsx": "^4.21.0",
|
|
70
|
+
"typescript": "^5.9.3",
|
|
71
|
+
"vite": "^7.3.1",
|
|
72
|
+
"vite-plugin-dts": "^4.5.4",
|
|
73
73
|
"vitepress": "^2.0.0-alpha.16",
|
|
74
74
|
"vitest": "^3.2.4",
|
|
75
75
|
"vitest-browser-vue": "^1.0.0"
|
package/dist/env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { DatabaseInstance } from '../../../../database';
|
|
2
|
-
import type { AnyDialecteConfig, Context, ElementsOf, TreeRecord } from '../../../../types';
|
|
3
|
-
export declare function createFindDescendantsAsTreeMethod<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>>(params: {
|
|
4
|
-
contextPromise: Promise<Context<GenericConfig, GenericElement>>;
|
|
5
|
-
dialecteConfig: GenericConfig;
|
|
6
|
-
databaseInstance: DatabaseInstance<GenericConfig>;
|
|
7
|
-
}): <GenericFilter extends {
|
|
8
|
-
tagName: ElementsOf<GenericConfig_1>;
|
|
9
|
-
attributes?: FilterAttributes<GenericConfig_1, K>;
|
|
10
|
-
descendant?: {
|
|
11
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
12
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
13
|
-
descendant?: {
|
|
14
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
15
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
16
|
-
descendant?: {
|
|
17
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
18
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
19
|
-
descendant?: {
|
|
20
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
21
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
22
|
-
descendant?: {
|
|
23
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
24
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
25
|
-
descendant?: {
|
|
26
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
27
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
28
|
-
descendant?: {
|
|
29
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
30
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
31
|
-
descendant?: {
|
|
32
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
33
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
34
|
-
descendant?: {
|
|
35
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
36
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
37
|
-
descendant?: {
|
|
38
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
39
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
40
|
-
descendant?: never;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
}>(filter: GenericFilter) => Promise<TreeRecord<GenericConfig, GenericFilter["tagName"]>[]>;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { DatabaseInstance } from '../../../../database';
|
|
2
|
-
import type { FindDescendantsReturn } from './types';
|
|
3
|
-
import type { AnyDialecteConfig, Context, ElementsOf } from '../../../../types';
|
|
4
|
-
/**
|
|
5
|
-
* Find descendants matching filter with "any depth" semantic
|
|
6
|
-
*
|
|
7
|
-
* Two modes:
|
|
8
|
-
* 1. No filter → get all descendants from tree
|
|
9
|
-
* 2. With filter → query deepest level, validate ancestors at any depth
|
|
10
|
-
*/
|
|
11
|
-
export declare function createFindDescendantsMethod<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>>(params: {
|
|
12
|
-
contextPromise: Promise<Context<GenericConfig, GenericElement>>;
|
|
13
|
-
dialecteConfig: GenericConfig;
|
|
14
|
-
databaseInstance: DatabaseInstance<GenericConfig>;
|
|
15
|
-
}): <GenericFilter extends {
|
|
16
|
-
tagName: ElementsOf<GenericConfig_1>;
|
|
17
|
-
attributes?: FilterAttributes<GenericConfig_1, K>;
|
|
18
|
-
descendant?: {
|
|
19
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
20
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
21
|
-
descendant?: {
|
|
22
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
23
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
24
|
-
descendant?: {
|
|
25
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
26
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
27
|
-
descendant?: {
|
|
28
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
29
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
30
|
-
descendant?: {
|
|
31
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
32
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
33
|
-
descendant?: {
|
|
34
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
35
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
36
|
-
descendant?: {
|
|
37
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
38
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
39
|
-
descendant?: {
|
|
40
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
41
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
42
|
-
descendant?: {
|
|
43
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
44
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
45
|
-
descendant?: {
|
|
46
|
-
tagName: DescendantsOf<GenericConfig_2, GenericElement_1>;
|
|
47
|
-
attributes?: FilterAttributes<GenericConfig_2, K_1>;
|
|
48
|
-
descendant?: never;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
}>(filter?: GenericFilter) => FindDescendantsReturn<GenericConfig, GenericFilter, GenericElement>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { FilterAttributes } from '../../../../helpers';
|
|
2
|
-
import type { AnyDialecteConfig, DescendantsOf, ElementsOf, ChainRecord } from '../../../../types';
|
|
3
|
-
declare type Depth = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
4
|
-
declare type FilterNode<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, D extends number> = Depth[D] extends never ? never : {
|
|
5
|
-
[K in DescendantsOf<GenericConfig, GenericElement>]: {
|
|
6
|
-
tagName: K;
|
|
7
|
-
attributes?: FilterAttributes<GenericConfig, K>;
|
|
8
|
-
descendant?: FilterNode<GenericConfig, K, Depth[D]>;
|
|
9
|
-
};
|
|
10
|
-
}[DescendantsOf<GenericConfig, GenericElement>];
|
|
11
|
-
export declare type DescendantsFilter<GenericConfig extends AnyDialecteConfig> = {
|
|
12
|
-
[K in ElementsOf<GenericConfig>]: {
|
|
13
|
-
tagName: K;
|
|
14
|
-
attributes?: FilterAttributes<GenericConfig, K>;
|
|
15
|
-
descendant?: FilterNode<GenericConfig, K, 10>;
|
|
16
|
-
};
|
|
17
|
-
}[ElementsOf<GenericConfig>];
|
|
18
|
-
export declare type FilterCondition<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = {
|
|
19
|
-
tagName: GenericElement;
|
|
20
|
-
attributes?: FilterAttributes<GenericConfig, GenericElement>;
|
|
21
|
-
optional?: boolean;
|
|
22
|
-
};
|
|
23
|
-
export declare type ExtractTags<F> = F extends {
|
|
24
|
-
tagName: infer T;
|
|
25
|
-
} ? T | (F extends {
|
|
26
|
-
descendant?: infer D;
|
|
27
|
-
} ? ExtractTags<D> : never) : never;
|
|
28
|
-
export declare type ResultMap<GenericConfig extends AnyDialecteConfig, GenericTags extends string> = {
|
|
29
|
-
[K in GenericTags]: ChainRecord<GenericConfig, K>[];
|
|
30
|
-
};
|
|
31
|
-
export declare type FindDescendantsReturn<GenericConfig extends AnyDialecteConfig, GenericFilter extends DescendantsFilter<GenericConfig> | undefined, GenericElement extends ElementsOf<GenericConfig> = ElementsOf<GenericConfig>> = Promise<GenericFilter extends undefined ? {
|
|
32
|
-
[K in GenericElement | DescendantsOf<GenericConfig, GenericElement>]: ChainRecord<GenericConfig, K>[];
|
|
33
|
-
} : GenericFilter extends DescendantsFilter<GenericConfig> ? ResultMap<GenericConfig, ExtractTags<GenericFilter>> : never>;
|
|
34
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { FindChildrenParams } from './find-children.types';
|
|
2
|
-
import type { DatabaseInstance } from '../../../index';
|
|
3
|
-
import type { AnyDialecteConfig, ElementsOf, Context, ChainRecord } from '../../../types';
|
|
4
|
-
export declare function createFindChildrenMethod<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>>(params: {
|
|
5
|
-
contextPromise: Promise<Context<GenericConfig, GenericElement>>;
|
|
6
|
-
dialecteConfig: GenericConfig;
|
|
7
|
-
databaseInstance: DatabaseInstance<GenericConfig>;
|
|
8
|
-
}): <GenericChild extends ChildrenOf<GenericConfig, GenericElement>>(filters: Partial<{ [K in GenericChild]: FilterAttributes<GenericConfig_1, K_1>; }>) => Promise<Record<GenericChild, ChainRecord<GenericConfig, GenericChild>[]>>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { FilterAttributes } from '../../../helpers';
|
|
2
|
-
import type { AnyDialecteConfig, ElementsOf, ChildrenOf } from '../../../types';
|
|
3
|
-
export declare type FindChildrenParams<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, GenericChild extends ChildrenOf<GenericConfig, GenericElement>> = Partial<{
|
|
4
|
-
[K in GenericChild]: FilterAttributes<GenericConfig, K>;
|
|
5
|
-
}>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { FilterAttributes } from '../../../helpers';
|
|
2
|
-
import type { AnyDialecteConfig, ElementsOf, ChildrenOf } from '../../../types';
|
|
3
|
-
export declare type GetTreeParams<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = {
|
|
4
|
-
include?: IncludeFilter<GenericConfig, GenericElement>;
|
|
5
|
-
exclude?: ExcludeFilter<GenericConfig>[];
|
|
6
|
-
unwrap?: ElementsOf<GenericConfig>[];
|
|
7
|
-
};
|
|
8
|
-
export declare type IncludeFilter<GenericConfig extends AnyDialecteConfig, GenericParent extends ElementsOf<GenericConfig>> = ChildrenOf<GenericConfig, GenericParent> extends infer Child ? Child extends ElementsOf<GenericConfig> ? {
|
|
9
|
-
tagName: Child;
|
|
10
|
-
attributes?: FilterAttributes<GenericConfig, Child>;
|
|
11
|
-
children?: IncludeFilter<GenericConfig, Child>[];
|
|
12
|
-
} : never : never;
|
|
13
|
-
export declare type ExcludeFilter<GenericConfig extends AnyDialecteConfig> = {
|
|
14
|
-
tagName: ElementsOf<GenericConfig>;
|
|
15
|
-
attributes?: FilterAttributes<GenericConfig, ElementsOf<GenericConfig>>;
|
|
16
|
-
scope?: 'self' | 'children';
|
|
17
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './commit';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { AnyDialecteConfig, Operation } from '../../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Merge operations by element ID to optimize database operations.
|
|
4
|
-
* Consolidates multiple operations on the same element into a single final operation.
|
|
5
|
-
*
|
|
6
|
-
* Merge rules:
|
|
7
|
-
* - created + updated → created (with final state)
|
|
8
|
-
* - created + deleted → no-op (removed)
|
|
9
|
-
* - updated + updated → updated (with final state)
|
|
10
|
-
* - updated + deleted → deleted (with original old state)
|
|
11
|
-
* - deleted → terminal (no further merging)
|
|
12
|
-
*
|
|
13
|
-
* @param operations - Array of staged operations to merge
|
|
14
|
-
* @returns Object containing arrays of merged creates, updates, and deletes
|
|
15
|
-
*/
|
|
16
|
-
export declare function mergeOperations<GenericConfig extends AnyDialecteConfig>(operations: Operation<GenericConfig>[]): {
|
|
17
|
-
creates: Operation<GenericConfig>[];
|
|
18
|
-
updates: Operation<GenericConfig>[];
|
|
19
|
-
deletes: Operation<GenericConfig>[];
|
|
20
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { AnyDialecteConfig, ElementsOf, TreeRecord } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* DeepCloneChild with setFocus: true - narrows to child element type
|
|
4
|
-
*/
|
|
5
|
-
export declare type DeepCloneChildWithFocusParams<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = {
|
|
6
|
-
record: TreeRecord<GenericConfig, GenericElement>;
|
|
7
|
-
setFocus: true;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* DeepCloneChild with setFocus: false - stays on current element
|
|
11
|
-
*/
|
|
12
|
-
export declare type DeepCloneChildWithoutFocusParams<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = {
|
|
13
|
-
record: TreeRecord<GenericConfig, GenericElement>;
|
|
14
|
-
setFocus: false;
|
|
15
|
-
};
|
|
16
|
-
export declare type DeepCloneChildParams<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = DeepCloneChildWithFocusParams<GenericConfig, GenericElement> | DeepCloneChildWithoutFocusParams<GenericConfig, GenericElement>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { AnyDialecteConfig, ElementsOf, ChildrenOf, Namespace, AttributesValueObjectOf, FullAttributeObjectOf } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* AddChild with setFocus: true - narrows to child element type
|
|
4
|
-
*/
|
|
5
|
-
export declare type AddChildParamsWithFocus<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, GenericChildElement extends ChildrenOf<GenericConfig, GenericElement>> = {
|
|
6
|
-
id?: `${string}-${string}-${string}-${string}-${string}`;
|
|
7
|
-
tagName: GenericChildElement;
|
|
8
|
-
namespace?: Namespace;
|
|
9
|
-
attributes: AttributesValueObjectOf<GenericConfig, GenericChildElement> | FullAttributeObjectOf<GenericConfig, GenericChildElement>[];
|
|
10
|
-
value?: string;
|
|
11
|
-
setFocus: true;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* AddChild with setFocus: false - stays on current element
|
|
15
|
-
*/
|
|
16
|
-
export declare type AddChildParamsWithoutFocus<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, GenericChildElement extends ChildrenOf<GenericConfig, GenericElement>> = {
|
|
17
|
-
id?: `${string}-${string}-${string}-${string}-${string}`;
|
|
18
|
-
tagName: GenericChildElement;
|
|
19
|
-
namespace?: Namespace;
|
|
20
|
-
attributes: AttributesValueObjectOf<GenericConfig, GenericChildElement> | FullAttributeObjectOf<GenericConfig, GenericChildElement>[];
|
|
21
|
-
value?: string;
|
|
22
|
-
setFocus?: false;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Union type for both addChild variants
|
|
26
|
-
*/
|
|
27
|
-
export declare type AddChildParams<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, GenericChildElement extends ChildrenOf<GenericConfig, GenericElement>> = AddChildParamsWithFocus<GenericConfig, GenericElement, GenericChildElement> | AddChildParamsWithoutFocus<GenericConfig, GenericElement, GenericChildElement>;
|
|
28
|
-
/**
|
|
29
|
-
* Any addChild params - for tests or generic operations
|
|
30
|
-
*/
|
|
31
|
-
export declare type AnyAddChildParams = AddChildParams<AnyDialecteConfig, string, string>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { AnyDialecteConfig, ElementsOf, AnyElement, ParentsOf, AnyParent } from '../../types';
|
|
2
|
-
export declare type DeleteElementParams<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, GenericParentElement extends ParentsOf<GenericConfig, GenericElement>> = {
|
|
3
|
-
parentTagName: GenericParentElement;
|
|
4
|
-
};
|
|
5
|
-
export declare type AnyDeleteParams = DeleteElementParams<AnyDialecteConfig, AnyElement, AnyParent>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { AnyDialecteConfig, ElementsOf, AttributesValueObjectOf } from '../../types';
|
|
2
|
-
export declare type UpdateElementParams<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = {
|
|
3
|
-
attributes?: Partial<AttributesValueObjectOf<GenericConfig, GenericElement>>;
|
|
4
|
-
value?: string;
|
|
5
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AnyDialecteConfig, ElementsOf, SingletonElementsOf, AnyElement, ParentsOf, AnyParent } from '../../types';
|
|
2
|
-
export declare type GoToElementParams<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = GenericElement extends SingletonElementsOf<GenericConfig> ? {
|
|
3
|
-
tagName: GenericElement;
|
|
4
|
-
id?: string;
|
|
5
|
-
} : {
|
|
6
|
-
tagName: GenericElement;
|
|
7
|
-
id: string;
|
|
8
|
-
};
|
|
9
|
-
export declare type AnyGoToElementParams = GoToElementParams<AnyDialecteConfig, AnyElement>;
|
|
10
|
-
export declare type GoToParentParams<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, GenericParentElement extends ParentsOf<GenericConfig, GenericElement>> = GenericParentElement;
|
|
11
|
-
export declare type AnyGoToParentParams = GoToParentParams<AnyDialecteConfig, AnyElement, AnyParent>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import Dexie from 'dexie';
|
|
2
|
-
import type { AnyDialecteConfig, ElementsOf } from '../types/dialecte-config';
|
|
3
|
-
import type { RawRecord } from '../types/records';
|
|
4
|
-
import type { EntityTable } from 'dexie';
|
|
5
|
-
export declare type DatabaseInstance<GenericConfig extends AnyDialecteConfig> = Dexie & {
|
|
6
|
-
[tableName: string]: EntityTable<RawRecord<GenericConfig, ElementsOf<GenericConfig>>, 'id'>;
|
|
7
|
-
};
|
|
8
|
-
export declare type AnyDatabaseInstance = DatabaseInstance<AnyDialecteConfig>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ERROR_CATALOG } from './codes';
|
|
2
|
-
import type { AnyDialecteConfig, ChainRecord, ElementsOf, Operation } from '../types';
|
|
3
|
-
export declare type DialecteErrorKey = keyof typeof ERROR_CATALOG;
|
|
4
|
-
export declare type DialecteErrorCode = (typeof ERROR_CATALOG)[DialecteErrorKey]['code'];
|
|
5
|
-
/**
|
|
6
|
-
* Standard error context that all errors should include
|
|
7
|
-
*/
|
|
8
|
-
export declare type DialecteErrorContext<GenericConfig extends AnyDialecteConfig = AnyDialecteConfig> = {
|
|
9
|
-
method?: string;
|
|
10
|
-
currentFocus?: ChainRecord<GenericConfig, ElementsOf<GenericConfig>>;
|
|
11
|
-
operations?: Operation<GenericConfig>[];
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Core error type with code, default message, and context
|
|
16
|
-
*/
|
|
17
|
-
export declare type DialecteCoreError<GenericConfig extends AnyDialecteConfig = AnyDialecteConfig> = Error & {
|
|
18
|
-
code: DialecteErrorCode;
|
|
19
|
-
errorKey: DialecteErrorKey;
|
|
20
|
-
defaultMessage: string;
|
|
21
|
-
context?: DialecteErrorContext<GenericConfig>;
|
|
22
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AnyDialecteConfig, AttributesOf, AttributesValueObjectOf, ChainRecord, ElementsOf } from '../../../types';
|
|
2
|
-
export declare type FilterAttributes<GenericVersion extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericVersion>> = {
|
|
3
|
-
[K in AttributesOf<GenericVersion, GenericElement>]?: AttributesValueObjectOf<GenericVersion, GenericElement>[K] | Array<AttributesValueObjectOf<GenericVersion, GenericElement>[K]>;
|
|
4
|
-
};
|
|
5
|
-
export declare type GroupedRecordsByTagName<GenericConfig extends AnyDialecteConfig, GenericRecords extends readonly ChainRecord<GenericConfig, any>[]> = {
|
|
6
|
-
[K in GenericRecords[number]['tagName']]?: Extract<GenericRecords[number], {
|
|
7
|
-
tagName: K;
|
|
8
|
-
}>[];
|
|
9
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const DEFINITION: Record<string, ElementDefinition>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { GoToElementParams } from '../../chain-methods/navigation';
|
|
2
|
-
import type { AddChildParams, UpdateElementParams } from '../../chain-methods/mutations';
|
|
3
|
-
import type { AnyDialecteConfig, ChildrenOf, ElementsOf } from '../../types';
|
|
4
|
-
export declare type ChainTestOperation<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, GenericChildElement extends ChildrenOf<GenericConfig, GenericElement>> = ({
|
|
5
|
-
type: 'update';
|
|
6
|
-
goTo?: GoToElementParams<GenericConfig, GenericElement>;
|
|
7
|
-
} & UpdateElementParams<GenericConfig, GenericElement>) | {
|
|
8
|
-
type: 'delete';
|
|
9
|
-
goTo?: GoToElementParams<GenericConfig, GenericElement>;
|
|
10
|
-
} | ({
|
|
11
|
-
type: 'addChild';
|
|
12
|
-
goTo?: GoToElementParams<GenericConfig, GenericElement>;
|
|
13
|
-
} & AddChildParams<GenericConfig, GenericElement, GenericChildElement>);
|
|
14
|
-
export declare type AnyChainTestOperation = ChainTestOperation<AnyDialecteConfig, ElementsOf<AnyDialecteConfig>, ChildrenOf<AnyDialecteConfig, ElementsOf<AnyDialecteConfig>>>;
|
|
15
|
-
/**
|
|
16
|
-
* For table-driven tests where operations can target any element in the config.
|
|
17
|
-
* This creates a distributive union that maintains proper type narrowing for each operation.
|
|
18
|
-
*/
|
|
19
|
-
export declare type AnyElementChainTestOperation<GenericConfig extends AnyDialecteConfig> = ElementsOf<GenericConfig> extends infer Element ? Element extends ElementsOf<GenericConfig> ? ChainTestOperation<GenericConfig, Element, ChildrenOf<GenericConfig, Element>> : never : never;
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { AnyDialecteConfig, ElementsOf } from './dialecte-config';
|
|
2
|
-
import type { Operation } from './operations';
|
|
3
|
-
import type { ChainRecord } from './records';
|
|
4
|
-
/**
|
|
5
|
-
* Context carries the state through the promise chain
|
|
6
|
-
* Each operation returns a new builder with updated context
|
|
7
|
-
*/
|
|
8
|
-
export declare type Context<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = {
|
|
9
|
-
currentFocus: ChainRecord<GenericConfig, GenericElement>;
|
|
10
|
-
stagedOperations: Operation<GenericConfig>[];
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Generic context for situations where element type is not yet known
|
|
14
|
-
*/
|
|
15
|
-
export declare type AnyContext = Context<AnyDialecteConfig, ElementsOf<AnyDialecteConfig>>;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { AnyDialecteConfig, ElementsOf, AttributesOf, ParentsOf, ChildrenOf } from './dialecte-config';
|
|
2
|
-
import type { OperationStatus } from './operations';
|
|
3
|
-
export declare type Namespace = {
|
|
4
|
-
prefix: string;
|
|
5
|
-
uri: string;
|
|
6
|
-
};
|
|
7
|
-
export declare type AnyRelationship = {
|
|
8
|
-
id: string;
|
|
9
|
-
tagName: string;
|
|
10
|
-
};
|
|
11
|
-
export declare type ParentRelationship<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = Omit<AnyRelationship, 'tagName'> & {
|
|
12
|
-
tagName: ParentsOf<GenericConfig, GenericElement>;
|
|
13
|
-
};
|
|
14
|
-
export declare type ChildRelationship<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = Omit<AnyRelationship, 'tagName'> & {
|
|
15
|
-
tagName: ChildrenOf<GenericConfig, GenericElement>;
|
|
16
|
-
};
|
|
17
|
-
export declare type AnyAttribute = {
|
|
18
|
-
name: string;
|
|
19
|
-
value: string;
|
|
20
|
-
namespace?: Namespace;
|
|
21
|
-
};
|
|
22
|
-
export declare type Attribute<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = Omit<AnyAttribute, 'name' | 'namespace'> & {
|
|
23
|
-
name: AttributesOf<GenericConfig, GenericElement>;
|
|
24
|
-
};
|
|
25
|
-
export declare type AnyQualifiedAttribute = Omit<AnyAttribute, 'namespace'> & {
|
|
26
|
-
namespace: Namespace;
|
|
27
|
-
};
|
|
28
|
-
export declare type QualifiedAttribute<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = Omit<Attribute<GenericConfig, GenericElement>, 'namespace'> & {
|
|
29
|
-
namespace: Namespace;
|
|
30
|
-
};
|
|
31
|
-
export declare type RawRecord<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = {
|
|
32
|
-
id: string;
|
|
33
|
-
tagName: GenericElement;
|
|
34
|
-
namespace: Namespace;
|
|
35
|
-
attributes: Array<Attribute<GenericConfig, GenericElement> | QualifiedAttribute<GenericConfig, GenericElement>>;
|
|
36
|
-
value: string;
|
|
37
|
-
parent: ParentRelationship<GenericConfig, GenericElement> | null;
|
|
38
|
-
children: ChildRelationship<GenericConfig, GenericElement>[];
|
|
39
|
-
};
|
|
40
|
-
export declare type AnyRawRecord = {
|
|
41
|
-
id: string;
|
|
42
|
-
tagName: string;
|
|
43
|
-
namespace: Namespace;
|
|
44
|
-
attributes: AnyAttribute[];
|
|
45
|
-
value: string;
|
|
46
|
-
parent: AnyRelationship | null;
|
|
47
|
-
children: AnyRelationship[];
|
|
48
|
-
};
|
|
49
|
-
export declare type ChainRecord<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = RawRecord<GenericConfig, GenericElement> & {
|
|
50
|
-
status: OperationStatus;
|
|
51
|
-
};
|
|
52
|
-
export declare type AnyChainRecord<GenericConfig extends AnyDialecteConfig = AnyDialecteConfig> = ChainRecord<GenericConfig, ElementsOf<GenericConfig>>;
|
|
53
|
-
export declare type TreeRecord<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = ChainRecord<GenericConfig, GenericElement> & {
|
|
54
|
-
tree: TreeRecord<GenericConfig, ChildrenOf<GenericConfig, GenericElement>>[];
|
|
55
|
-
};
|
|
56
|
-
export declare type AnyTreeRecord<GenericConfig extends AnyDialecteConfig = AnyDialecteConfig> = TreeRecord<GenericConfig, ElementsOf<GenericConfig>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './attributes';
|
package/dist/vitest.shims.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="@vitest/browser/providers/playwright" />
|