@dbml/parse 9.0.0-alpha.10 → 9.0.0-alpha.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -73,6 +73,7 @@ export default class Compiler {
73
73
  nodeAtPosition: (filepath: Filepath, offset: number) => SyntaxNode | import('..').SyntaxToken | undefined;
74
74
  renameTable: (filepath: Filepath, oldName: string | import('..').TableIdentifier, newName: string | import('..').TableIdentifier) => Map<string, string>;
75
75
  updateElementSetting: (filepath: Filepath, target: import('..').ElementIdentifier, settingName: string, value: string | null | undefined) => string;
76
+ updateElementSettingEdit: (filepath: Filepath, target: import('..').ElementIdentifier, settingName: string, value: string | null | undefined) => import('.').TextEdit[];
76
77
  syncDiagramView: (filepath: Filepath, operations: import('..').DiagramViewSyncOperation[], blocks?: import('..').DiagramViewBlock[] | undefined) => {
77
78
  newDbml: string;
78
79
  edits: import('.').TextEdit[];
@@ -1,5 +1,5 @@
1
1
  export { renameTable } from './renameTable';
2
- export { updateElementSetting } from './updateElementSetting';
2
+ export { updateElementSetting, updateElementSettingEdit } from './updateElementSetting';
3
3
  export { syncDiagramView, findDiagramViewBlocks, type DiagramViewSyncOperation, type DiagramViewBlock, } from './syncDiagramView';
4
4
  export { syncDep, findDepBlocks, generateDepBlock, type DepSyncOperation, type DepSyncEdge, type DepEndpointRef, type DepBlock, } from './syncDep';
5
5
  export { applyTextEdits, type TextEdit } from './applyTextEdits';
@@ -1,11 +1,11 @@
1
1
  import { Filepath } from '../../../core/types/filepath';
2
- import { ElementDeclarationNode } from '../../../core/types/nodes';
2
+ import { ElementDeclarationNode, ProgramNode } from '../../../core/types/nodes';
3
3
  import { default as Compiler } from '../../index';
4
4
  import { TextEdit } from './applyTextEdits';
5
5
  export interface DepEndpointRef {
6
- schema?: string;
7
- table: string;
8
- fields?: string[];
6
+ schemaName?: string | null;
7
+ tableName: string;
8
+ fieldNames?: string[];
9
9
  }
10
10
  export interface DepSyncEdge {
11
11
  upstream: DepEndpointRef;
@@ -38,6 +38,8 @@ export interface InlineDep {
38
38
  */
39
39
  export declare function findDepBlocks(source: string): DepBlock[];
40
40
  export declare function findInlineDeps(source: string): InlineDep[];
41
+ export declare function depBlocksFromProgram(program: ProgramNode): DepBlock[];
42
+ export declare function inlineDepsFromProgram(source: string, program: ProgramNode): InlineDep[];
41
43
  /**
42
44
  * Emit a `Dep` block for one edge with a `[color]` setting:
43
45
  *
@@ -24,9 +24,9 @@ export interface EnumIdentifier {
24
24
  name: string;
25
25
  }
26
26
  export interface EndpointRef {
27
- schema?: string;
28
- table: string;
29
- fields?: string[];
27
+ schemaName?: string | null;
28
+ tableName: string;
29
+ fieldNames?: string[];
30
30
  }
31
31
  export interface RefIdentifier {
32
32
  kind?: typeof MetadataKind.Ref;
@@ -1,4 +1,6 @@
1
1
  import { Filepath } from '../../../core/types/filepath';
2
2
  import { default as Compiler } from '../../index';
3
+ import { TextEdit } from './applyTextEdits';
3
4
  import { ElementIdentifier } from './types';
5
+ export declare function updateElementSettingEdit(this: Compiler, filepath: Filepath, target: ElementIdentifier, settingName: string, value: string | null | undefined): TextEdit[];
4
6
  export declare function updateElementSetting(this: Compiler, filepath: Filepath, target: ElementIdentifier, settingName: string, value: string | null | undefined): string;
@@ -0,0 +1,26 @@
1
+ import { Filepath } from '../../../../core/types/filepath';
2
+ import { NodeSymbol, SymbolKind } from '../../../../core/types/symbol';
3
+ import { default as Compiler } from '../../../index';
4
+ import { EndpointRef } from '../types';
5
+ export type { ElementIdentifier } from '../types';
6
+ export { findRefDefinition, type InlineRef, type StandaloneRef } from './ref';
7
+ 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
+ export declare function normalizeTableName(input: string | {
11
+ schema?: string;
12
+ table: string;
13
+ }): {
14
+ schema: string;
15
+ table: string;
16
+ };
17
+ /**
18
+ * Looks up an element symbol by its qualified name and kind.
19
+ */
20
+ export declare function lookupElementSymbol(compiler: Compiler, filepath: Filepath, schema: string, name: string, kind?: SymbolKind): NodeSymbol | undefined;
21
+ /**
22
+ * Removes surrounding double quotes from a string if present.
23
+ */
24
+ export declare function stripQuotes(str: string): string;
25
+ export declare function formatEndpoint(ep: EndpointRef): string;
26
+ export declare function formatSetting(name: string, value: string | null | undefined): string;
@@ -0,0 +1,15 @@
1
+ import { FunctionApplicationNode } from '../../../../core/types/nodes';
2
+ import { Filepath } from '../../../../core/types/filepath';
3
+ import { default as Compiler } from '../../../index';
4
+ import { RefIdentifier } from '../types';
5
+ export interface InlineRef {
6
+ kind: 'inline';
7
+ op: string;
8
+ fullStart: number;
9
+ fullEnd: number;
10
+ }
11
+ export interface StandaloneRef {
12
+ kind: 'standalone';
13
+ node: FunctionApplicationNode;
14
+ }
15
+ export declare function findRefDefinition(compiler: Compiler, filepath: Filepath, target: RefIdentifier): InlineRef | StandaloneRef | undefined;
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": "9.0.0-alpha.10",
4
+ "version": "9.0.0-alpha.12",
5
5
  "description": "DBML parser v2",
6
6
  "author": "Holistics <dev@holistics.io>",
7
7
  "license": "Apache-2.0",
@@ -50,5 +50,5 @@
50
50
  "engines": {
51
51
  "node": ">=18"
52
52
  },
53
- "gitHead": "73ddff600b762911ed681069ed73f5e1f74448c5"
53
+ "gitHead": "b6a2cb98415baec85a1b29a694b45cd96121c242"
54
54
  }
@@ -1,21 +0,0 @@
1
- import { Filepath } from '../../../core/types/filepath';
2
- import { NodeSymbol, SymbolKind } from '../../../core/types/symbol';
3
- import { default as Compiler } from '../../index';
4
- import { EndpointRef } from './types';
5
- export type { ElementIdentifier } from './types';
6
- export declare function endpointsEqual(a: EndpointRef, b: EndpointRef): boolean;
7
- export declare function normalizeTableName(input: string | {
8
- schema?: string;
9
- table: string;
10
- }): {
11
- schema: string;
12
- table: string;
13
- };
14
- /**
15
- * Looks up an element symbol by its qualified name and kind.
16
- */
17
- export declare function lookupElementSymbol(compiler: Compiler, filepath: Filepath, schema: string, name: string, kind?: SymbolKind): NodeSymbol | undefined;
18
- /**
19
- * Removes surrounding double quotes from a string if present.
20
- */
21
- export declare function stripQuotes(str: string): string;