@dbml/parse 9.0.0-optional-ref.4 → 9.0.0-optional-ref.8

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.
@@ -77,9 +77,6 @@ export default class Compiler {
77
77
  newDbml: string;
78
78
  edits: import('.').TextEdit[];
79
79
  };
80
- addSetting: (filepath: Filepath, declaration: SyntaxNode, setting: string) => string | undefined;
81
- updateSetting: (filepath: Filepath, declaration: SyntaxNode, settingName: string, newValue: string) => string | undefined;
82
- removeSetting: (filepath: Filepath, declaration: SyntaxNode, settingName: string) => string | undefined;
83
80
  findDiagramViewBlocks(filepath: Filepath): DiagramViewBlock[];
84
81
  readonly token: {
85
82
  invalidStream: (filepath: Filepath) => readonly import('..').SyntaxToken[];
@@ -1,6 +1,4 @@
1
1
  export { renameTable } from './renameTable';
2
2
  export { syncDiagramView, findDiagramViewBlocks, type DiagramViewSyncOperation, type DiagramViewBlock, } from './syncDiagramView';
3
3
  export { applyTextEdits, type TextEdit } from './applyTextEdits';
4
- export { addSetting, addSettingEdit } from './addSetting';
5
- export { updateSetting, updateSettingEdit, removeSetting, removeSettingEdit, } from './updateSetting';
6
4
  export { type TableNameInput } from './utils';
@@ -10,7 +10,7 @@ export default class ProgramInterpreter {
10
10
  private filepath;
11
11
  private errors;
12
12
  private warnings;
13
- private hints;
13
+ private infos;
14
14
  private db;
15
15
  constructor(compiler: Compiler, symbol: ProgramSymbol, filepath: Filepath);
16
16
  interpret(): Report<SchemaElement | SchemaElement[] | undefined>;
@@ -1,7 +1,8 @@
1
1
  import { default as Compiler } from '../../../compiler';
2
2
  import { CompileInfo } from '../../types/errors';
3
3
  import { RefMetadata, PartialRefMetadata } from '../../types/symbol/metadata';
4
- export declare function validateCardinality(compiler: Compiler, meta: RefMetadata | PartialRefMetadata, side: 'left' | 'right', options?: {
4
+ export declare function validateCardinality(compiler: Compiler, meta: RefMetadata | PartialRefMetadata, side: 'left' | 'right', // Whether we're validating the left side or the right side
5
+ options?: {
5
6
  allowOtherColFix?: boolean;
6
7
  allowOwnColFix?: boolean;
7
8
  }): CompileInfo[];
@@ -1,3 +1,4 @@
1
+ import { TextEdit } from '../../compiler';
1
2
  import { Filepath } from './filepath';
2
3
  import { SyntaxNode } from './nodes';
3
4
  import { SyntaxToken } from './tokens';
@@ -125,7 +126,6 @@ export declare class CompileError extends Error {
125
126
  nodeOrToken: Readonly<SyntaxNode | SyntaxToken>;
126
127
  start: Readonly<number>;
127
128
  end: Readonly<number>;
128
- relatedLocations?: RelatedLocation[];
129
129
  constructor(code: number, message: string, nodeOrToken: SyntaxNode | SyntaxToken);
130
130
  toWarning(): CompileWarning;
131
131
  get filepath(): Filepath;
@@ -136,14 +136,13 @@ export declare class CompileWarning extends Error {
136
136
  nodeOrToken: Readonly<SyntaxNode | SyntaxToken>;
137
137
  start: Readonly<number>;
138
138
  end: Readonly<number>;
139
- relatedLocations?: RelatedLocation[];
140
139
  constructor(code: number, message: string, nodeOrToken: SyntaxNode | SyntaxToken);
141
140
  get filepath(): Filepath;
142
141
  }
143
142
  export interface QuickFix {
144
143
  title: string;
145
144
  filepath: Filepath;
146
- edits: import('../../compiler/queries/transform/applyTextEdits').TextEdit[];
145
+ edits: TextEdit[];
147
146
  }
148
147
  export declare class CompileInfo extends Error {
149
148
  code: Readonly<CompileErrorCode>;
@@ -152,10 +151,8 @@ export declare class CompileInfo extends Error {
152
151
  start: Readonly<number>;
153
152
  end: Readonly<number>;
154
153
  quickFixes?: QuickFix[];
155
- relatedLocations?: RelatedLocation[];
156
154
  constructor(code: number, message: string, nodeOrToken: SyntaxNode | SyntaxToken, options?: {
157
155
  quickFixes?: QuickFix[];
158
- relatedLocations?: RelatedLocation[];
159
156
  });
160
157
  get filepath(): Filepath;
161
158
  }
@@ -3,16 +3,16 @@ export default class Report<T> {
3
3
  private value;
4
4
  private errors;
5
5
  private warnings?;
6
- private hints?;
7
- static create<T>(value: T, errors?: CompileError[], warnings?: CompileWarning[], hints?: CompileInfo[]): Report<T>;
8
- constructor(value: T, errors?: CompileError[], warnings?: CompileWarning[], hints?: CompileInfo[]);
6
+ private infos?;
7
+ static create<T>(value: T, errors?: CompileError[], warnings?: CompileWarning[], infos?: CompileInfo[]): Report<T>;
8
+ constructor(value: T, errors?: CompileError[], warnings?: CompileWarning[], infos?: CompileInfo[]);
9
9
  filter<S extends symbol>(filteredValue: S): Report<undefined | Exclude<T, S>>;
10
10
  hasValue<S>(value: S): this is Report<S>;
11
11
  getFiltered<S extends symbol | undefined | null>(filteredValue: S): Exclude<T, S> | undefined;
12
12
  getValue(): T;
13
13
  getErrors(): CompileError[];
14
14
  getWarnings(): CompileWarning[];
15
- getHints(): CompileInfo[];
15
+ getInfos(): CompileInfo[];
16
16
  chainFiltered<S extends symbol | undefined | null, U>(fn: (_: Exclude<T, S>) => Report<U>, filteredValue: S): Report<U | undefined>;
17
17
  chain<U>(fn: (_: T) => Report<U>): Report<U>;
18
18
  mapFiltered<S extends symbol | undefined | null, U>(fn: (_: Exclude<T, S>) => U, filteredValue: S): Report<U | undefined>;
@@ -149,6 +149,7 @@ export declare class ColumnSymbol extends NodeSymbol {
149
149
  get originalSymbol(): NodeSymbol;
150
150
  qualifiedName(compiler: Compiler): string;
151
151
  pk(compiler: Compiler): boolean;
152
+ isUniqueSet(compiler: Compiler): boolean;
152
153
  unique(compiler: Compiler): boolean;
153
154
  nullable(compiler: Compiler): boolean;
154
155
  isNotNullSet(compiler: Compiler): boolean | undefined;
@@ -0,0 +1,17 @@
1
+ import { SyntaxNode } from '../types/nodes';
2
+ import { TextEdit } from '../../compiler/queries/transform/applyTextEdits';
3
+ /**
4
+ * Produces a TextEdit that adds a setting to a field/element declaration.
5
+ * If the declaration already has a settings block [...], inserts before the closing ].
6
+ * Otherwise, appends a new [setting] block.
7
+ */
8
+ export declare function addSettingEdit(declaration: SyntaxNode, setting: string): TextEdit | undefined;
9
+ /**
10
+ * Produces a TextEdit that updates an existing setting's value in a declaration.
11
+ */
12
+ export declare function updateSettingEdit(declaration: SyntaxNode, settingName: string, newValue: string, source: string): TextEdit | undefined;
13
+ /**
14
+ * Produces a TextEdit that removes a setting from a declaration.
15
+ * If it's the only setting, removes the entire settings block [...].
16
+ */
17
+ export declare function removeSettingEdit(declaration: SyntaxNode, settingName: string, source: string): TextEdit | undefined;
@@ -11,7 +11,7 @@ export { CompileError, CompileErrorCode, } from './core/types/errors';
11
11
  export type { Position, } from './core/types';
12
12
  export { ScopeKind, splitQualifiedIdentifier, unescapeString, escapeString, formatRecordValue, isValidIdentifier, addDoubleQuoteIfNeeded, } from './compiler/index';
13
13
  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, } from './core/types/schemaJson';
14
- export { type RelationCardinality, type RelationshipOp, getRelationshipOp, getMultiplicities, parseCardinality, CARDINALITY_ONE, CARDINALITY_MAYBE, CARDINALITY_SOME, CARDINALITY_MANY, } from './core/types/relation';
14
+ export { type RelationCardinality, type RelationshipOp, getRelationshipOp, getMultiplicities, parseCardinality, makeCardinalityRequired, makeCardinalityOptional, CARDINALITY_ONE, CARDINALITY_MAYBE, CARDINALITY_SOME, CARDINALITY_MANY, } from './core/types/relation';
15
15
  export type { DiagramViewSyncOperation, DiagramViewBlock, TextEdit, } from './compiler/queries/transform';
16
16
  export { dbmlLanguageConfig, dbmlMonarchTokensProvider, } from './services/monarch';
17
17
  export * from './compiler/projectLayout/layout';
@@ -1,9 +1,8 @@
1
1
  import { default as Compiler } from '../../compiler';
2
2
  import { Filepath } from '../../core/types/filepath';
3
- import { RelatedLocation } from '../../core/types/errors';
4
3
  import { MarkerData } from '../types';
5
4
  export interface Diagnostic {
6
- type: 'error' | 'warning' | 'hint';
5
+ type: 'error' | 'warning' | 'info';
7
6
  text: string;
8
7
  startRow: number;
9
8
  startColumn: number;
@@ -11,7 +10,6 @@ export interface Diagnostic {
11
10
  endColumn: number;
12
11
  code?: string | number;
13
12
  filepath: Filepath;
14
- relatedLocations?: RelatedLocation[];
15
13
  }
16
14
  export default class DBMLDiagnosticsProvider {
17
15
  private compiler;
@@ -29,9 +27,9 @@ export default class DBMLDiagnosticsProvider {
29
27
  */
30
28
  provideWarnings(filepath?: Filepath): Diagnostic[];
31
29
  /**
32
- * Get only hints from the current compilation
30
+ * Get only infos from the current compilation
33
31
  */
34
- provideHints(filepath?: Filepath): Diagnostic[];
32
+ provideInfos(filepath?: Filepath): Diagnostic[];
35
33
  /**
36
34
  * Convert Monaco markers format (for editor integration)
37
35
  */
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-optional-ref.4",
4
+ "version": "9.0.0-optional-ref.8",
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": "14171e298fb3503fc9c703da67d3102a7272e3ce"
53
+ "gitHead": "f70d4bfbf56addaab11a3877928897be44c157a7"
54
54
  }
@@ -1,14 +0,0 @@
1
- import { SyntaxNode } from '../../../core/types/nodes';
2
- import { Filepath } from '../../../core/types/filepath';
3
- import { default as Compiler } from '../../index';
4
- import { TextEdit } from './applyTextEdits';
5
- /**
6
- * Produces a TextEdit that adds a setting to a field/element declaration.
7
- * If the declaration already has a settings block [...], inserts before the closing ].
8
- * Otherwise, appends a new [setting] block.
9
- */
10
- export declare function addSettingEdit(declaration: SyntaxNode, setting: string): TextEdit | undefined;
11
- /**
12
- * Adds a setting to a field/element declaration and returns the updated source.
13
- */
14
- export declare function addSetting(this: Compiler, filepath: Filepath, declaration: SyntaxNode, setting: string): string | undefined;
@@ -1,8 +0,0 @@
1
- import { SyntaxNode } from '../../../core/types/nodes';
2
- import { Filepath } from '../../../core/types/filepath';
3
- import { default as Compiler } from '../../index';
4
- import { TextEdit } from './applyTextEdits';
5
- export declare function updateSettingEdit(declaration: SyntaxNode, settingName: string, newValue: string, source: string): TextEdit | undefined;
6
- export declare function removeSettingEdit(declaration: SyntaxNode, settingName: string, source: string): TextEdit | undefined;
7
- export declare function updateSetting(this: Compiler, filepath: Filepath, declaration: SyntaxNode, settingName: string, newValue: string): string | undefined;
8
- export declare function removeSetting(this: Compiler, filepath: Filepath, declaration: SyntaxNode, settingName: string): string | undefined;