@dbml/parse 10.1.1-alpha.0 → 10.2.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.
@@ -1,6 +1,6 @@
1
1
  export { renameTable } from './renameTable';
2
2
  export { updateElementSetting, updateElementSettingEdit } from './updateElementSetting';
3
3
  export { syncDiagramView, findDiagramViewBlocks, type DiagramViewSyncOperation, type DiagramViewBlock, } from './syncDiagramView';
4
- export { syncDep, findDepBlocks, generateDepBlock, type DepSyncOperation, type DepSyncEdge, type DepEndpointRef, type DepBlock, } from './syncDep';
4
+ export { syncDep, generateDepBlock, type DepSyncOperation, type DepSyncEdge, type DepEndpointRef, } from './syncDep';
5
5
  export { applyTextEdits, type TextEdit } from './applyTextEdits';
6
6
  export type { ElementIdentifier, SchemaIdentifier, TableIdentifier, ColumnIdentifier, EnumIdentifier, EndpointRef, RefIdentifier, DepIdentifier, NoteIdentifier, TableGroupIdentifier, } from './types';
@@ -1,5 +1,4 @@
1
1
  import { Filepath } from '../../../core/types/filepath';
2
- import { ElementDeclarationNode, ProgramNode } from '../../../core/types/nodes';
3
2
  import { default as Compiler } from '../../index';
4
3
  import { TextEdit } from './applyTextEdits';
5
4
  export interface DepEndpointRef {
@@ -20,17 +19,6 @@ export interface DepSyncOperation {
20
19
  /** Set to a value to create/update, null to remove, undefined to leave unchanged. */
21
20
  note?: string | null;
22
21
  }
23
- export interface DepBlock {
24
- startIndex: number;
25
- endIndex: number;
26
- declaration: ElementDeclarationNode;
27
- edges: DepSyncEdge[];
28
- }
29
- export interface InlineDep {
30
- edge: DepSyncEdge;
31
- fullStart: number;
32
- fullEnd: number;
33
- }
34
22
  /**
35
23
  * Synchronizes `Dep` blocks in the DBML source at `filepath`.
36
24
  * Applies create/update/remove operations and returns the rewritten source.
@@ -39,16 +27,5 @@ export declare function syncDep(this: Compiler, filepath: Filepath, operations:
39
27
  newDbml: string;
40
28
  edits: TextEdit[];
41
29
  };
42
- /**
43
- * Returns every standalone `Dep` block in `source`.
44
- * On lex/parse error returns [] (mirrors findDiagramViewBlocks).
45
- */
46
- export declare function findDepBlocks(source: string): DepBlock[];
47
- /** Returns every inline `[dep: -> target]` setting on columns in `source`. */
48
- export declare function findInlineDeps(source: string): InlineDep[];
49
30
  /** Emit a `Dep` block string for one edge with a `[color]` setting. */
50
31
  export declare function generateDepBlock(edge: DepSyncEdge, color: string): string;
51
- /** Extract `DepBlock[]` from an already-parsed program AST. */
52
- export declare function depBlocksFromProgram(program: ProgramNode): DepBlock[];
53
- /** Extract `InlineDep[]` from an already-parsed program AST. */
54
- export declare function inlineDepsFromProgram(source: string, program: ProgramNode): InlineDep[];
@@ -1,6 +1,8 @@
1
1
  import { default as Compiler } from '../../../compiler';
2
2
  import { CompileError } from '../../types/errors';
3
- import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode } from '../../types/nodes';
3
+ import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, ListExpressionNode } from '../../types/nodes';
4
+ import { default as Report } from '../../types/report';
5
+ import { Settings } from '../../utils/validate';
4
6
  export default class RecordsValidator {
5
7
  private declarationNode;
6
8
  private compiler;
@@ -18,3 +20,4 @@ export default class RecordsValidator {
18
20
  private isValidRecordValue;
19
21
  private validateSubElements;
20
22
  }
23
+ export declare function validateRecordsSettings(settingList?: ListExpressionNode): Report<Settings>;
@@ -102,13 +102,16 @@ export declare enum CompileErrorCode {
102
102
  INVALID_RECORDS_FIELD = 3084,
103
103
  DUPLICATE_COLUMN_REFERENCES_IN_RECORDS = 3085,
104
104
  DUPLICATE_RECORDS_FOR_TABLE = 3086,
105
- INVALID_USE_CONTEXT = 3087,
106
- INVALID_USE_SPECIFIER_KIND = 3088,
107
- INVALID_USE_SPECIFIER_NAME = 3089,
108
- INVALID_DIAGRAMVIEW_CONTEXT = 3090,
109
- DUPLICATE_DIAGRAMVIEW_NAME = 3091,
110
- INVALID_DIAGRAMVIEW_FIELD = 3092,
111
- DUPLICATE_DIAGRAMVIEW_FIELD = 3093,
105
+ UNKNOWN_RECORDS_SETTING = 3087,
106
+ DUPLICATE_RECORDS_SETTING = 3088,
107
+ INVALID_RECORDS_SETTING_VALUE = 3089,
108
+ INVALID_USE_CONTEXT = 3090,
109
+ INVALID_USE_SPECIFIER_KIND = 3091,
110
+ INVALID_USE_SPECIFIER_NAME = 3092,
111
+ INVALID_DIAGRAMVIEW_CONTEXT = 3093,
112
+ DUPLICATE_DIAGRAMVIEW_NAME = 3094,
113
+ INVALID_DIAGRAMVIEW_FIELD = 3095,
114
+ DUPLICATE_DIAGRAMVIEW_FIELD = 3096,
112
115
  BINDING_ERROR = 4000,
113
116
  NONEXISTENT_MODULE = 4001,
114
117
  UNSUPPORTED = 5000,
@@ -35,5 +35,6 @@ export declare enum SettingName {
35
35
  Check = "check",
36
36
  Update = "update",
37
37
  Delete = "delete",
38
- Inactive = "inactive"
38
+ Inactive = "inactive",
39
+ Example = "example"
39
40
  }
@@ -276,6 +276,7 @@ export interface TableRecord {
276
276
  tableName: string;
277
277
  columns: string[];
278
278
  values: RecordValue[][];
279
+ example?: boolean;
279
280
  token: TokenPosition;
280
281
  }
281
282
  export type MetadataValues = Record<string, {
@@ -105,6 +105,7 @@ export declare class RecordsMetadata extends NodeMetadata {
105
105
  readonly kind = MetadataKind.Records;
106
106
  constructor(declaration: SyntaxNode);
107
107
  table(compiler: Compiler): TableSymbol | undefined;
108
+ example(compiler: Compiler): boolean;
108
109
  owners(compiler: Compiler): NodeSymbol[];
109
110
  }
110
111
  export declare class MetadataElementMetadata extends NodeMetadata {
@@ -14,8 +14,8 @@ export { ScopeKind, splitQualifiedIdentifier, unescapeString, escapeString, form
14
14
  export { type Database, type MasterDatabase, type Table, type Note, type Column, type ColumnType, type Index, type Check, type InlineRef, type Ref, type RefEndpointPair, type RefEndpoint, type Enum, type EnumField, type TableGroup, type TableGroupField, type Alias, type AliasKind, type TablePartial, type TablePartialInjection, type RecordValue, type RecordValueType, type TableRecord, type Project, type SchemaElement, type TokenPosition, type ElementRef, type FilterConfig, type DiagramView, type CustomMetadata, } from './core/types/schemaJson';
15
15
  export { type RelationCardinality, type RelationshipOp, getRelationshipOp, getMultiplicities, parseCardinality, makeCardinalityRequired, makeCardinalityOptional, makeRelationshipRequired, isEndpointOneSide, isEndpointManySide, isEndpointOptional, isEndpointRequired, CARDINALITY_ONE, CARDINALITY_MAYBE, CARDINALITY_SOME, CARDINALITY_MANY, } from './core/types/relation';
16
16
  export type { DiagramViewSyncOperation, DiagramViewBlock, TextEdit, } from './compiler/queries/transform';
17
- export { findDiagramViewBlocks, findDepBlocks } from './compiler/queries/transform';
18
- export type { DepSyncOperation, DepSyncEdge, DepEndpointRef, DepBlock, } from './compiler/queries/transform';
17
+ export { findDiagramViewBlocks } from './compiler/queries/transform';
18
+ export type { DepSyncOperation, DepSyncEdge, DepEndpointRef } from './compiler/queries/transform';
19
19
  export type { ElementIdentifier, SchemaIdentifier, TableIdentifier, ColumnIdentifier, EnumIdentifier, EndpointRef, RefIdentifier, DepIdentifier, NoteIdentifier, TableGroupIdentifier, } from './compiler/queries/transform';
20
20
  export { dbmlLanguageConfig, dbmlMonarchTokensProvider, } from './services/monarch';
21
21
  export * from './compiler/projectLayout/layout';
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.1-alpha.0",
4
+ "version": "10.2.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": "e0ed6604c3d42902004bcfb5b22791d3f364d759"
54
+ "gitHead": "c0844906edf50438efe35207712d1c06eac53ef0"
55
55
  }