@tsofist/schema-forge 2.6.0 → 2.8.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.
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const guards_1 = require("@tsofist/stem/lib/cldr/date-time/guards");
|
|
4
4
|
const types_1 = require("@tsofist/stem/lib/cldr/date-time/types");
|
|
5
5
|
const enum_1 = require("@tsofist/stem/lib/enum");
|
|
6
|
-
const guards_2 = require("@tsofist/stem/lib/number/guards");
|
|
6
|
+
const guards_2 = require("@tsofist/stem/lib/number/integer/guards");
|
|
7
7
|
const entries_1 = require("@tsofist/stem/lib/object/entries");
|
|
8
8
|
const camel_1 = require("@tsofist/stem/lib/string/case/camel");
|
|
9
9
|
const fake_generator_1 = require("./fake-generator");
|
package/lib/generator.spec.js
CHANGED
|
@@ -472,8 +472,11 @@ describe('generator for a1', () => {
|
|
|
472
472
|
});
|
|
473
473
|
it('getSchema', () => {
|
|
474
474
|
expect(validator.getValidator('test#/definitions/PositiveInt').schema).toStrictEqual({
|
|
475
|
-
minimum: 1,
|
|
476
475
|
type: 'integer',
|
|
476
|
+
minimum: 1,
|
|
477
|
+
maximum: 9007199254740991,
|
|
478
|
+
description: 'Positive integer value.',
|
|
479
|
+
faker: { 'number.int': [{ max: 10000, min: 1 }] },
|
|
477
480
|
});
|
|
478
481
|
expect(validator.getValidator('#/definitions/NotExists')).toStrictEqual(undefined);
|
|
479
482
|
expect(validator.getSchema('test#/definitions/SomeName')).toStrictEqual({
|
package/lib/types/db.types.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export declare const DBIndexTypeList: readonly ["btree", "hash", "gin", "gist",
|
|
|
14
14
|
export type DBIndexType = (typeof DBIndexTypeList)[number];
|
|
15
15
|
/**
|
|
16
16
|
* Database index options.
|
|
17
|
+
*
|
|
18
|
+
* @see https://dbml.dbdiagram.io/docs/#index-definition dbml spec
|
|
17
19
|
*/
|
|
18
20
|
export type DBIndexOptions = {
|
|
19
21
|
/**
|
|
@@ -31,6 +33,11 @@ export type DBIndexOptions = {
|
|
|
31
33
|
* @default false
|
|
32
34
|
*/
|
|
33
35
|
unique?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Is it a primary key
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
pk?: boolean;
|
|
34
41
|
};
|
|
35
42
|
export type DBIndexOptionsDef<B extends boolean = boolean> = ArrayMay<DBIndexOptions | string | B>;
|
|
36
43
|
/**
|
package/lib/validator.js
CHANGED
|
@@ -334,6 +334,7 @@ function addJSDocKeywords(engine) {
|
|
|
334
334
|
const DBIndexOptionsProperties = {
|
|
335
335
|
name: { type: 'string', pattern: IXNamePattern },
|
|
336
336
|
unique: { type: 'boolean' },
|
|
337
|
+
pk: { type: 'boolean' },
|
|
337
338
|
type: {
|
|
338
339
|
type: 'string',
|
|
339
340
|
enum: db_types_1.DBIndexTypeList,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsofist/schema-forge",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "Generate JSON schema from TypeScript types",
|
|
5
5
|
"author": "Andrew Berdnikov <tsofistgudmen@gmail.com>",
|
|
6
6
|
"license": "LGPL-3.0",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"test:watch": "jest --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@faker-js/faker": "^9.
|
|
24
|
-
"@tsofist/stem": "^
|
|
23
|
+
"@faker-js/faker": "^9.7.0",
|
|
24
|
+
"@tsofist/stem": "^4.0.0",
|
|
25
25
|
"ajv": "^8.17.1",
|
|
26
26
|
"ajv-formats": "^3.0.1",
|
|
27
27
|
"json-schema-faker": "^0.5.9",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"@types/jest": "^29.5.14",
|
|
35
35
|
"@types/node": "^20.17.30",
|
|
36
36
|
"@types/supertest": "^6.0.3",
|
|
37
|
-
"jest": "
|
|
37
|
+
"jest": "~29.7.0",
|
|
38
38
|
"rimraf": "^6.0.1",
|
|
39
39
|
"supertest": "^7.1.0",
|
|
40
|
-
"ts-jest": "
|
|
40
|
+
"ts-jest": "~29.3.2",
|
|
41
41
|
"typescript": "~5.8.3"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|