@dbml/parse 10.1.0-alpha.0 → 10.1.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dbml-parse.js +12 -12
- package/dist/dbml-parse.mjs +315 -346
- package/dist/src/compiler/index.d.ts +1 -1
- package/dist/src/compiler/queries/transform/syncDep.d.ts +1 -1
- package/dist/src/compiler/queries/transform/utils/dep.d.ts +26 -0
- package/dist/src/compiler/queries/transform/utils/index.d.ts +1 -2
- package/package.json +2 -2
|
@@ -78,7 +78,7 @@ export default class Compiler {
|
|
|
78
78
|
newDbml: string;
|
|
79
79
|
edits: import('.').TextEdit[];
|
|
80
80
|
};
|
|
81
|
-
syncDep: (filepath: Filepath, operations: import('..').DepSyncOperation[]
|
|
81
|
+
syncDep: (filepath: Filepath, operations: import('..').DepSyncOperation[]) => {
|
|
82
82
|
newDbml: string;
|
|
83
83
|
edits: import('.').TextEdit[];
|
|
84
84
|
};
|
|
@@ -35,7 +35,7 @@ export interface InlineDep {
|
|
|
35
35
|
* Synchronizes `Dep` blocks in the DBML source at `filepath`.
|
|
36
36
|
* Applies create/update/remove operations and returns the rewritten source.
|
|
37
37
|
*/
|
|
38
|
-
export declare function syncDep(this: Compiler, filepath: Filepath, operations: DepSyncOperation[]
|
|
38
|
+
export declare function syncDep(this: Compiler, filepath: Filepath, operations: DepSyncOperation[]): {
|
|
39
39
|
newDbml: string;
|
|
40
40
|
edits: TextEdit[];
|
|
41
41
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ElementDeclarationNode } from '../../../../core/types/nodes';
|
|
2
|
+
import { Filepath } from '../../../../core/types/filepath';
|
|
3
|
+
import { default as Compiler } from '../../../index';
|
|
4
|
+
import { DepIdentifier } from '../types';
|
|
5
|
+
export interface InlineDepDefinition {
|
|
6
|
+
kind: 'inline';
|
|
7
|
+
op: string;
|
|
8
|
+
fullStart: number;
|
|
9
|
+
fullEnd: number;
|
|
10
|
+
}
|
|
11
|
+
export interface BlockDepDefinition {
|
|
12
|
+
kind: 'block';
|
|
13
|
+
declaration: ElementDeclarationNode;
|
|
14
|
+
}
|
|
15
|
+
export type DepDefinition = InlineDepDefinition | BlockDepDefinition;
|
|
16
|
+
/**
|
|
17
|
+
* Finds the `Dep` block or inline `[dep: …]` setting that carries the edge `target` names.
|
|
18
|
+
*
|
|
19
|
+
* Matching runs on resolved table and column symbols, the way {@link findRefDefinition} does.
|
|
20
|
+
* The endpoints' source text cannot be compared instead: `a.b` is `schema.table` or
|
|
21
|
+
* `table.field` depending on what `a` resolves to, so a mixed-level edge such as
|
|
22
|
+
* `a.x -> b` is not describable without the symbol table.
|
|
23
|
+
*
|
|
24
|
+
* A target with no field names matches only an edge with no columns on that side.
|
|
25
|
+
*/
|
|
26
|
+
export declare function findDepDefinition(compiler: Compiler, filepath: Filepath, target: DepIdentifier): DepDefinition | undefined;
|
|
@@ -4,9 +4,8 @@ import { default as Compiler } from '../../../index';
|
|
|
4
4
|
import { EndpointRef } from '../types';
|
|
5
5
|
export type { ElementIdentifier } from '../types';
|
|
6
6
|
export { findRefDefinition, type InlineRef, type StandaloneRef } from './ref';
|
|
7
|
+
export { findDepDefinition, type DepDefinition, type InlineDepDefinition, type BlockDepDefinition, } from './dep';
|
|
7
8
|
export declare function normalizeSchema(schema?: string | null): string;
|
|
8
|
-
export declare function endpointsEqual(left: EndpointRef, right: EndpointRef): boolean;
|
|
9
|
-
export declare function endpointMatches(candidate: EndpointRef, target: EndpointRef): boolean;
|
|
10
9
|
export declare function normalizeTableName(input: string | {
|
|
11
10
|
schema?: string;
|
|
12
11
|
table: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@dbml/parse",
|
|
4
|
-
"version": "10.1.
|
|
4
|
+
"version": "10.1.1-alpha.0",
|
|
5
5
|
"description": "DBML parser v2",
|
|
6
6
|
"author": "Holistics <dev@holistics.io>",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">=18"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "e0ed6604c3d42902004bcfb5b22791d3f364d759"
|
|
55
55
|
}
|