@tstdl/base 0.91.0-beta6 → 0.91.0-beta7
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.
|
@@ -19,8 +19,12 @@ export declare const mySchemaUsers: PgTableWithColumns<{
|
|
|
19
19
|
driverParam: string;
|
|
20
20
|
notNull: false;
|
|
21
21
|
hasDefault: false;
|
|
22
|
+
isPrimaryKey: false;
|
|
23
|
+
isAutoincrement: false;
|
|
24
|
+
hasRuntimeDefault: false;
|
|
22
25
|
enumValues: undefined;
|
|
23
26
|
baseColumn: never;
|
|
27
|
+
generated: undefined;
|
|
24
28
|
}, {}, {}>;
|
|
25
29
|
name: import("drizzle-orm/pg-core").PgColumn<{
|
|
26
30
|
name: "name";
|
|
@@ -31,8 +35,12 @@ export declare const mySchemaUsers: PgTableWithColumns<{
|
|
|
31
35
|
driverParam: string;
|
|
32
36
|
notNull: false;
|
|
33
37
|
hasDefault: false;
|
|
38
|
+
isPrimaryKey: false;
|
|
39
|
+
isAutoincrement: false;
|
|
40
|
+
hasRuntimeDefault: false;
|
|
34
41
|
enumValues: [string, ...string[]];
|
|
35
42
|
baseColumn: never;
|
|
43
|
+
generated: undefined;
|
|
36
44
|
}, {}, {}>;
|
|
37
45
|
age: import("drizzle-orm/pg-core").PgColumn<{
|
|
38
46
|
name: "";
|
|
@@ -43,8 +51,12 @@ export declare const mySchemaUsers: PgTableWithColumns<{
|
|
|
43
51
|
driverParam: string | number;
|
|
44
52
|
notNull: false;
|
|
45
53
|
hasDefault: false;
|
|
54
|
+
isPrimaryKey: false;
|
|
55
|
+
isAutoincrement: false;
|
|
56
|
+
hasRuntimeDefault: false;
|
|
46
57
|
enumValues: undefined;
|
|
47
58
|
baseColumn: never;
|
|
59
|
+
generated: undefined;
|
|
48
60
|
}, {}, {}>;
|
|
49
61
|
color: import("drizzle-orm/pg-core").PgColumn<{
|
|
50
62
|
name: "color";
|
|
@@ -55,8 +67,12 @@ export declare const mySchemaUsers: PgTableWithColumns<{
|
|
|
55
67
|
driverParam: string;
|
|
56
68
|
notNull: false;
|
|
57
69
|
hasDefault: true;
|
|
70
|
+
isPrimaryKey: false;
|
|
71
|
+
isAutoincrement: false;
|
|
72
|
+
hasRuntimeDefault: false;
|
|
58
73
|
enumValues: ["red", "green", "blue"];
|
|
59
74
|
baseColumn: never;
|
|
75
|
+
generated: undefined;
|
|
60
76
|
}, {}, {}>;
|
|
61
77
|
};
|
|
62
78
|
dialect: "pg";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.91.0-
|
|
3
|
+
"version": "0.91.0-beta7",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"luxon": "^3.4",
|
|
112
112
|
"reflect-metadata": "^0.2",
|
|
113
113
|
"rxjs": "^7.8",
|
|
114
|
-
"type-fest": "4.
|
|
114
|
+
"type-fest": "4.22"
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
117
|
"@mxssfd/typedoc-theme": "1.1",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { JsonPath } from '../../json-path/json-path.js';
|
|
2
|
+
import { type SchemaPropertyDecorator, type SchemaPropertyDecoratorOptions } from '../decorators/index.js';
|
|
3
|
+
import { Schema, type SchemaTestOptions, type SchemaTestResult } from '../schema.js';
|
|
4
|
+
export declare class FunctionSchema extends Schema<Function> {
|
|
5
|
+
_test(value: any, path: JsonPath, options: SchemaTestOptions): SchemaTestResult<Function>;
|
|
6
|
+
}
|
|
7
|
+
export declare function func(): FunctionSchema;
|
|
8
|
+
export declare function Function(options?: SchemaPropertyDecoratorOptions): SchemaPropertyDecorator;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SchemaError } from '../../schema/schema.error.js';
|
|
2
|
+
import { isFunction } from '../../utils/type-guards.js';
|
|
3
|
+
import { typeOf } from '../../utils/type-of.js';
|
|
4
|
+
import { Property } from '../decorators/index.js';
|
|
5
|
+
import { Schema } from '../schema.js';
|
|
6
|
+
export class FunctionSchema extends Schema {
|
|
7
|
+
_test(value, path, options) {
|
|
8
|
+
if (isFunction(value)) {
|
|
9
|
+
return { valid: true, value };
|
|
10
|
+
}
|
|
11
|
+
return { valid: false, error: SchemaError.expectedButGot('Function', typeOf(value), path, { fast: options.fastErrors }) };
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function func() {
|
|
15
|
+
return new FunctionSchema();
|
|
16
|
+
}
|
|
17
|
+
export function Function(options) {
|
|
18
|
+
return Property(func(), options);
|
|
19
|
+
}
|
package/schema/schemas/index.js
CHANGED
|
@@ -8,14 +8,14 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import { Singleton } from '../../injector/decorators.js';
|
|
11
|
-
import { Union } from '../../schema/index.js';
|
|
11
|
+
import { func, Union } from '../../schema/index.js';
|
|
12
12
|
import { TemplateField } from '../template.model.js';
|
|
13
13
|
import { TemplateResolver } from '../template.resolver.js';
|
|
14
14
|
export class StringTemplateField extends TemplateField {
|
|
15
15
|
template;
|
|
16
16
|
}
|
|
17
17
|
__decorate([
|
|
18
|
-
Union(String,
|
|
18
|
+
Union(String, func()),
|
|
19
19
|
__metadata("design:type", Object)
|
|
20
20
|
], StringTemplateField.prototype, "template", void 0);
|
|
21
21
|
let StringTemplateResolver = class StringTemplateResolver extends TemplateResolver {
|