@dbml/parse 10.4.0-alpha.1 → 10.4.0-metadata-ref-type.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
  import { default as Compiler } from '../../../compiler/index';
2
2
  import { Filepath, SettingName } from '../../types';
3
- import { Column, Note, Ref, Table, TableGroup, TokenPosition } from '../../types/schemaJson';
3
+ import { Column, CustomMetadataValue, Note, Ref, Table, TableGroup, TokenPosition } from '../../types/schemaJson';
4
4
  import { SyntaxNode } from '../../types/nodes';
5
5
  import { NodeSymbol, SymbolKind, MetadataTargetKind } from '../../types/symbol';
6
6
  export type MetadataTarget = Table | TableGroup | Note | Column | Ref;
@@ -14,9 +14,9 @@ interface MetadataField<T extends MetadataTarget> {
14
14
  isValidBuiltinFieldValue(node?: SyntaxNode): boolean;
15
15
  message: string;
16
16
  /** Write the metadata value to the element builtin props (e.g. write to `table.note`) */
17
- assignBuiltinField(element: Partial<T>, value: string, token: TokenPosition): void;
17
+ assignBuiltinField(element: Partial<T>, value: CustomMetadataValue, token: TokenPosition): void;
18
18
  }
19
- export type MetadataFieldRegistry<T extends MetadataTarget, K extends SettingName = SettingName> = Record<K, MetadataField<T>>;
19
+ export type MetadataFieldRegistry<T extends MetadataTarget, K extends SettingName> = Record<K, MetadataField<T>>;
20
20
  export type NameWithSymbolKind = {
21
21
  name: string;
22
22
  symbolKind: SymbolKind;
@@ -2,7 +2,8 @@ import { NONE_COLOR } from '../../../constants';
2
2
  import { Filepath } from '../filepath';
3
3
  import { Position } from '../position';
4
4
  import { RelationshipOp, RelationCardinality } from '../relation';
5
- export type CustomMetadata = Record<string, string>;
5
+ export type CustomMetadataValue = string | Color | number | boolean;
6
+ export type CustomMetadata = Record<string, CustomMetadataValue>;
6
7
  export type Color = `#${string}` | typeof NONE_COLOR;
7
8
  export declare enum AliasKind {
8
9
  Table = "table"
@@ -285,7 +286,7 @@ export interface TableRecord {
285
286
  token: TokenPosition;
286
287
  }
287
288
  export type MetadataValues = Record<string, {
288
- value: string;
289
+ value: CustomMetadataValue;
289
290
  token: TokenPosition;
290
291
  }>;
291
292
  export type Project = Record<string, never> | {
@@ -23,6 +23,7 @@ export declare function destructureIndexNode(node?: SyntaxNode): {
23
23
  } | undefined;
24
24
  export declare function extractQuotedStringToken(value?: SyntaxNode): string | undefined;
25
25
  export declare function extractNumericLiteral(node?: SyntaxNode): number | null;
26
+ export declare function extractBooleanLiteral(node?: SyntaxNode): boolean | null;
26
27
  export declare function destructureCallExpression(node?: SyntaxNode): {
27
28
  variables: (PrimaryExpressionNode & {
28
29
  expression: VariableNode;
@@ -1,5 +1,5 @@
1
1
  import { default as Compiler } from '../../compiler';
2
- import { Color, ColumnType, CustomMetadata, TokenPosition } from '../types/schemaJson';
2
+ import { Color, ColumnType, CustomMetadata, CustomMetadataValue, TokenPosition } from '../types/schemaJson';
3
3
  import { SyntaxNode } from '../types/nodes';
4
4
  import { default as Report } from '../types/report';
5
5
  import { Settings } from './validate';
@@ -23,4 +23,4 @@ export declare function processColumnType(compiler: Compiler, typeNode: SyntaxNo
23
23
  * NOTE: This is used during interpret phase, so no need to validate values, just extract them
24
24
  */
25
25
  export declare function extractCustomInlineMetadata(settingMap: Settings, builtinSettings: readonly SettingName[]): CustomMetadata;
26
- export declare function extractMetadataValue(node?: SyntaxNode): string | Color | undefined;
26
+ export declare function extractMetadataValue(node?: SyntaxNode): CustomMetadataValue | undefined;
@@ -54,7 +54,6 @@ export declare function isTupleOfVariables(value?: SyntaxNode): value is TupleEx
54
54
  };
55
55
  export declare function isValidColumnType(type: SyntaxNode): boolean;
56
56
  export type Settings = Record<SettingName | string, AttributeNode[]>;
57
- export declare function isValidMetadataValue(value?: SyntaxNode): boolean;
58
57
  export declare function aggregateSettingList(settingList?: ListExpressionNode): Report<Settings>;
59
58
  export declare function isExpressionAQuotedString(value?: unknown): value is PrimaryExpressionNode & ({
60
59
  expression: VariableNode & {
@@ -11,7 +11,7 @@ export { SyntaxToken, SyntaxTokenKind, isTriviaToken, isOp, isOpToken, } from '.
11
11
  export { CompileError, CompileErrorCode, } from './core/types/errors';
12
12
  export type { Position, } from './core/types';
13
13
  export { ScopeKind, splitQualifiedIdentifier, unescapeString, escapeString, formatRecordValue, isValidIdentifier, addDoubleQuoteIfNeeded, normalizeQualifiedName, } from './compiler/index';
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';
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, type CustomMetadataValue, } 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
17
  export { findDiagramViewBlocks } from './compiler/queries/transform';
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.4.0-alpha.1",
4
+ "version": "10.4.0-metadata-ref-type.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": "2abacb40597047ca589b2c18117f57f8fe3978e6"
54
+ "gitHead": "f2806cfb089ae685523e444dd409fd1e4514962b"
55
55
  }