@tsofist/schema-forge 2.8.0 → 2.9.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/lib/types/db.types.d.ts +33 -1
- package/lib/validator.js +11 -0
- package/package.json +1 -1
package/lib/types/db.types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrayMay } from '@tsofist/stem';
|
|
1
|
+
import { ArrayMay, HexString } from '@tsofist/stem';
|
|
2
2
|
/**
|
|
3
3
|
* Database index types.
|
|
4
4
|
*
|
|
@@ -38,10 +38,22 @@ export type DBIndexOptions = {
|
|
|
38
38
|
* @default false
|
|
39
39
|
*/
|
|
40
40
|
pk?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Any important notes.
|
|
43
|
+
* Can be used in DDL.
|
|
44
|
+
*/
|
|
45
|
+
note?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Any important developer comments.
|
|
48
|
+
* Can't be used in DDL.
|
|
49
|
+
*/
|
|
50
|
+
comment?: string;
|
|
41
51
|
};
|
|
42
52
|
export type DBIndexOptionsDef<B extends boolean = boolean> = ArrayMay<DBIndexOptions | string | B>;
|
|
43
53
|
/**
|
|
44
54
|
* Database entity options.
|
|
55
|
+
*
|
|
56
|
+
* @see https://dbml.dbdiagram.io/docs/#table-definition dbml spec
|
|
45
57
|
*/
|
|
46
58
|
export type DBEntityOptions = {
|
|
47
59
|
/**
|
|
@@ -60,5 +72,25 @@ export type DBEntityOptions = {
|
|
|
60
72
|
indexes?: {
|
|
61
73
|
[field: string]: DBIndexOptionsDef<true>;
|
|
62
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* Any important notes.
|
|
77
|
+
* Can be used in DDL.
|
|
78
|
+
*/
|
|
79
|
+
note?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Any important developer comments.
|
|
82
|
+
* Can't be used in DDL.
|
|
83
|
+
*/
|
|
84
|
+
comment?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Table name alias.
|
|
87
|
+
*/
|
|
88
|
+
alias?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Settings.
|
|
91
|
+
*/
|
|
92
|
+
settings?: {
|
|
93
|
+
headercolor: HexString;
|
|
94
|
+
};
|
|
63
95
|
};
|
|
64
96
|
export type DBEntityOptionsDef = DBEntityOptions | string;
|
package/lib/validator.js
CHANGED
|
@@ -339,6 +339,8 @@ function addJSDocKeywords(engine) {
|
|
|
339
339
|
type: 'string',
|
|
340
340
|
enum: db_types_1.DBIndexTypeList,
|
|
341
341
|
},
|
|
342
|
+
note: { type: 'string' },
|
|
343
|
+
comment: { type: 'string' },
|
|
342
344
|
};
|
|
343
345
|
const DBIndexSchema = {
|
|
344
346
|
type: ['string', 'boolean', 'object', 'array'],
|
|
@@ -374,6 +376,15 @@ function addJSDocKeywords(engine) {
|
|
|
374
376
|
pattern: NestedPropertyNamePattern,
|
|
375
377
|
},
|
|
376
378
|
},
|
|
379
|
+
note: { type: 'string' },
|
|
380
|
+
comment: { type: 'string' },
|
|
381
|
+
alias: { type: 'string' },
|
|
382
|
+
settings: {
|
|
383
|
+
type: 'object',
|
|
384
|
+
properties: {
|
|
385
|
+
headercolor: { type: 'string' },
|
|
386
|
+
},
|
|
387
|
+
},
|
|
377
388
|
},
|
|
378
389
|
},
|
|
379
390
|
});
|