@tstdl/base 0.90.92 → 0.91.0-beta2
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/api/types.d.ts +1 -1
- package/authentication/authentication.api.d.ts +21 -22
- package/authentication/authentication.api.js +1 -6
- package/authentication/client/api.client.d.ts +4 -5
- package/authentication/client/api.client.js +1 -2
- package/authentication/client/http-client.middleware.d.ts +1 -1
- package/browser/pdf-options.js +8 -9
- package/errors/custom.error.d.ts +5 -5
- package/examples/api/basic-overview.js +4 -4
- package/http/client/http-client-request.d.ts +1 -2
- package/http/client/module.d.ts +1 -1
- package/image-service/image-service.js +4 -7
- package/mail/mail.client.d.ts +2 -2
- package/mail/mail.client.js +3 -5
- package/orm/decorators.d.ts +1 -0
- package/orm/decorators.js +4 -0
- package/orm/entity.js +3 -3
- package/orm/index.d.ts +4 -0
- package/orm/index.js +4 -0
- package/orm/repository.d.ts +6 -8
- package/orm/repository.js +7 -0
- package/orm/schema-converter.d.ts +83 -0
- package/orm/schema-converter.js +74 -0
- package/orm/schema.d.ts +3 -0
- package/orm/schema.js +1 -0
- package/orm/types.d.ts +8 -0
- package/orm/types.js +6 -0
- package/package.json +6 -4
- package/reflection/registry.d.ts +1 -1
- package/reflection/utils.d.ts +2 -2
- package/schema/decorators/class.d.ts +1 -1
- package/schema/decorators/index.d.ts +0 -2
- package/schema/decorators/index.js +0 -2
- package/schema/decorators/property.d.ts +6 -5
- package/schema/decorators/property.js +10 -14
- package/schema/decorators/types.d.ts +7 -12
- package/schema/decorators/utils.d.ts +2 -15
- package/schema/decorators/utils.js +4 -43
- package/schema/index.d.ts +1 -6
- package/schema/index.js +15 -6
- package/schema/schema.d.ts +89 -14
- package/schema/schema.error.d.ts +4 -6
- package/schema/schema.error.js +6 -10
- package/schema/schema.js +74 -276
- package/schema/schemas/any.d.ts +7 -5
- package/schema/schemas/any.js +10 -6
- package/schema/schemas/array.d.ts +11 -12
- package/schema/schemas/array.js +27 -19
- package/schema/schemas/bigint.d.ts +9 -0
- package/schema/schemas/bigint.js +19 -0
- package/schema/schemas/boolean.d.ts +15 -5
- package/schema/schemas/boolean.js +47 -6
- package/schema/schemas/date.d.ts +9 -7
- package/schema/schemas/date.js +25 -19
- package/schema/schemas/defaulted.d.ts +11 -6
- package/schema/schemas/defaulted.js +23 -8
- package/schema/schemas/enumeration.d.ts +10 -5
- package/schema/schemas/enumeration.js +25 -15
- package/schema/schemas/index.d.ts +4 -6
- package/schema/schemas/index.js +4 -6
- package/schema/schemas/instance.d.ts +11 -3
- package/schema/schemas/instance.js +25 -4
- package/schema/schemas/literal.d.ts +10 -5
- package/schema/schemas/literal.js +25 -15
- package/schema/schemas/never.d.ts +6 -0
- package/schema/schemas/never.js +11 -0
- package/schema/schemas/nullable.d.ts +11 -6
- package/schema/schemas/nullable.js +24 -7
- package/schema/schemas/number.d.ts +13 -7
- package/schema/schemas/number.js +34 -23
- package/schema/schemas/object.d.ts +75 -7
- package/schema/schemas/object.js +171 -6
- package/schema/schemas/one-or-many.d.ts +10 -7
- package/schema/schemas/one-or-many.js +18 -11
- package/schema/schemas/optional.d.ts +11 -7
- package/schema/schemas/optional.js +24 -6
- package/schema/schemas/readable-stream.d.ts +8 -6
- package/schema/schemas/readable-stream.js +11 -6
- package/schema/schemas/regexp.d.ts +8 -6
- package/schema/schemas/regexp.js +25 -7
- package/schema/schemas/simple.d.ts +27 -0
- package/schema/schemas/simple.js +57 -0
- package/schema/schemas/string.d.ts +13 -21
- package/schema/schemas/string.js +26 -34
- package/schema/schemas/symbol.d.ts +12 -0
- package/schema/schemas/symbol.js +25 -0
- package/schema/schemas/transform.d.ts +9 -5
- package/schema/schemas/transform.js +19 -6
- package/schema/schemas/uint8-array.d.ts +9 -5
- package/schema/schemas/uint8-array.js +17 -26
- package/schema/schemas/union.d.ts +14 -7
- package/schema/schemas/union.js +30 -11
- package/schema/schemas/unknown.d.ts +7 -5
- package/schema/schemas/unknown.js +11 -7
- package/schema/testable.d.ts +3 -0
- package/schema/testable.js +30 -0
- package/schema/types.d.ts +31 -0
- package/schema/types.js +1 -0
- package/schema-old/decorators/class.d.ts +3 -0
- package/schema-old/decorators/class.js +5 -0
- package/schema-old/decorators/index.d.ts +6 -0
- package/schema-old/decorators/index.js +6 -0
- package/schema-old/decorators/property.d.ts +6 -0
- package/schema-old/decorators/property.js +17 -0
- package/schema-old/decorators/types.d.ts +19 -0
- package/schema-old/decorators/types.js +1 -0
- package/schema-old/decorators/utils.d.ts +15 -0
- package/schema-old/decorators/utils.js +48 -0
- package/schema-old/index.d.ts +10 -0
- package/schema-old/index.js +10 -0
- package/schema-old/schema.d.ts +15 -0
- package/schema-old/schema.error.d.ts +26 -0
- package/schema-old/schema.error.js +64 -0
- package/schema-old/schema.js +283 -0
- package/schema-old/schemas/any.d.ts +5 -0
- package/schema-old/schemas/any.js +9 -0
- package/schema-old/schemas/array.d.ts +12 -0
- package/schema-old/schemas/array.js +23 -0
- package/schema-old/schemas/boolean.d.ts +5 -0
- package/schema-old/schemas/boolean.js +9 -0
- package/schema-old/schemas/date.d.ts +8 -0
- package/schema-old/schemas/date.js +22 -0
- package/schema-old/schemas/defaulted.d.ts +6 -0
- package/schema-old/schemas/defaulted.js +10 -0
- package/schema-old/schemas/enumeration.d.ts +6 -0
- package/schema-old/schemas/enumeration.js +17 -0
- package/schema-old/schemas/index.d.ts +26 -0
- package/schema-old/schemas/index.js +26 -0
- package/schema-old/schemas/instance.d.ts +3 -0
- package/schema-old/schemas/instance.js +5 -0
- package/schema-old/schemas/literal.d.ts +5 -0
- package/schema-old/schemas/literal.js +17 -0
- package/schema-old/schemas/nullable.d.ts +6 -0
- package/schema-old/schemas/nullable.js +9 -0
- package/schema-old/schemas/number.d.ts +9 -0
- package/schema-old/schemas/number.js +27 -0
- package/schema-old/schemas/object.d.ts +7 -0
- package/schema-old/schemas/object.js +12 -0
- package/schema-old/schemas/one-or-many.d.ts +9 -0
- package/schema-old/schemas/one-or-many.js +15 -0
- package/schema-old/schemas/optional.d.ts +7 -0
- package/schema-old/schemas/optional.js +8 -0
- package/schema-old/schemas/readable-stream.d.ts +6 -0
- package/schema-old/schemas/readable-stream.js +9 -0
- package/schema-old/schemas/regexp.d.ts +6 -0
- package/schema-old/schemas/regexp.js +9 -0
- package/schema-old/schemas/string.d.ts +22 -0
- package/schema-old/schemas/string.js +38 -0
- package/schema-old/schemas/transform.d.ts +5 -0
- package/schema-old/schemas/transform.js +7 -0
- package/schema-old/schemas/uint8-array.d.ts +10 -0
- package/schema-old/schemas/uint8-array.js +29 -0
- package/schema-old/schemas/union.d.ts +7 -0
- package/schema-old/schemas/union.js +13 -0
- package/schema-old/schemas/unknown.d.ts +5 -0
- package/schema-old/schemas/unknown.js +9 -0
- package/templates/resolvers/string.template-resolver.d.ts +0 -1
- package/templates/resolvers/string.template-resolver.js +1 -5
- package/templates/template.model.js +1 -1
- package/types.d.ts +2 -0
- package/utils/type-guards.js +1 -1
- /package/{schema → schema-old}/array-constraints/index.d.ts +0 -0
- /package/{schema → schema-old}/array-constraints/index.js +0 -0
- /package/{schema → schema-old}/array-constraints/maximum-length.d.ts +0 -0
- /package/{schema → schema-old}/array-constraints/maximum-length.js +0 -0
- /package/{schema → schema-old}/array-constraints/minimum-length.d.ts +0 -0
- /package/{schema → schema-old}/array-constraints/minimum-length.js +0 -0
- /package/{schema → schema-old}/coercers/boolean.coercer.d.ts +0 -0
- /package/{schema → schema-old}/coercers/boolean.coercer.js +0 -0
- /package/{schema → schema-old}/coercers/date.coercer.d.ts +0 -0
- /package/{schema → schema-old}/coercers/date.coercer.js +0 -0
- /package/{schema → schema-old}/coercers/index.d.ts +0 -0
- /package/{schema → schema-old}/coercers/index.js +0 -0
- /package/{schema → schema-old}/coercers/number.coercer.d.ts +0 -0
- /package/{schema → schema-old}/coercers/number.coercer.js +0 -0
- /package/{schema → schema-old}/coercers/regexp.coercer.d.ts +0 -0
- /package/{schema → schema-old}/coercers/regexp.coercer.js +0 -0
- /package/{schema → schema-old}/coercers/string.coercer.d.ts +0 -0
- /package/{schema → schema-old}/coercers/string.coercer.js +0 -0
- /package/{schema → schema-old}/coercers/uint8-array.coercer.d.ts +0 -0
- /package/{schema → schema-old}/coercers/uint8-array.coercer.js +0 -0
- /package/{schema → schema-old}/constraints/enumeration.d.ts +0 -0
- /package/{schema → schema-old}/constraints/enumeration.js +0 -0
- /package/{schema → schema-old}/constraints/generic.d.ts +0 -0
- /package/{schema → schema-old}/constraints/generic.js +0 -0
- /package/{schema → schema-old}/constraints/index.d.ts +0 -0
- /package/{schema → schema-old}/constraints/index.js +0 -0
- /package/{schema → schema-old}/constraints/integer.d.ts +0 -0
- /package/{schema → schema-old}/constraints/integer.js +0 -0
- /package/{schema → schema-old}/constraints/length.d.ts +0 -0
- /package/{schema → schema-old}/constraints/length.js +0 -0
- /package/{schema → schema-old}/constraints/literal.d.ts +0 -0
- /package/{schema → schema-old}/constraints/literal.js +0 -0
- /package/{schema → schema-old}/constraints/maximum-date.d.ts +0 -0
- /package/{schema → schema-old}/constraints/maximum-date.js +0 -0
- /package/{schema → schema-old}/constraints/maximum-length.d.ts +0 -0
- /package/{schema → schema-old}/constraints/maximum-length.js +0 -0
- /package/{schema → schema-old}/constraints/maximum.d.ts +0 -0
- /package/{schema → schema-old}/constraints/maximum.js +0 -0
- /package/{schema → schema-old}/constraints/minimum-date.d.ts +0 -0
- /package/{schema → schema-old}/constraints/minimum-date.js +0 -0
- /package/{schema → schema-old}/constraints/minimum-length.d.ts +0 -0
- /package/{schema → schema-old}/constraints/minimum-length.js +0 -0
- /package/{schema → schema-old}/constraints/minimum.d.ts +0 -0
- /package/{schema → schema-old}/constraints/minimum.js +0 -0
- /package/{schema → schema-old}/constraints/pattern.d.ts +0 -0
- /package/{schema → schema-old}/constraints/pattern.js +0 -0
- /package/{schema → schema-old}/decorators/coerce.d.ts +0 -0
- /package/{schema → schema-old}/decorators/coerce.js +0 -0
- /package/{schema → schema-old}/decorators/constraint.d.ts +0 -0
- /package/{schema → schema-old}/decorators/constraint.js +0 -0
- /package/{schema → schema-old}/schemas/assign.d.ts +0 -0
- /package/{schema → schema-old}/schemas/assign.js +0 -0
- /package/{schema → schema-old}/schemas/constraint.d.ts +0 -0
- /package/{schema → schema-old}/schemas/constraint.js +0 -0
- /package/{schema → schema-old}/schemas/omit.d.ts +0 -0
- /package/{schema → schema-old}/schemas/omit.js +0 -0
- /package/{schema → schema-old}/schemas/partial.d.ts +0 -0
- /package/{schema → schema-old}/schemas/partial.js +0 -0
- /package/{schema → schema-old}/schemas/pick.d.ts +0 -0
- /package/{schema → schema-old}/schemas/pick.js +0 -0
- /package/{schema → schema-old}/schemas/record.d.ts +0 -0
- /package/{schema → schema-old}/schemas/record.js +0 -0
- /package/{schema → schema-old}/transformers/generic.d.ts +0 -0
- /package/{schema → schema-old}/transformers/generic.js +0 -0
- /package/{schema → schema-old}/transformers/index.d.ts +0 -0
- /package/{schema → schema-old}/transformers/index.js +0 -0
- /package/{schema → schema-old}/transformers/lowercase.d.ts +0 -0
- /package/{schema → schema-old}/transformers/lowercase.js +0 -0
- /package/{schema → schema-old}/transformers/trim.d.ts +0 -0
- /package/{schema → schema-old}/transformers/trim.js +0 -0
- /package/{schema → schema-old}/transformers/uppercase.d.ts +0 -0
- /package/{schema → schema-old}/transformers/uppercase.js +0 -0
- /package/{schema → schema-old}/types/index.d.ts +0 -0
- /package/{schema → schema-old}/types/index.js +0 -0
- /package/{schema → schema-old}/types/schema-array-constraint.d.ts +0 -0
- /package/{schema → schema-old}/types/schema-array-constraint.js +0 -0
- /package/{schema → schema-old}/types/schema-value-coercer.d.ts +0 -0
- /package/{schema → schema-old}/types/schema-value-coercer.js +0 -0
- /package/{schema → schema-old}/types/schema-value-constraint.d.ts +0 -0
- /package/{schema → schema-old}/types/schema-value-constraint.js +0 -0
- /package/{schema → schema-old}/types/schema-value-transformer.d.ts +0 -0
- /package/{schema → schema-old}/types/schema-value-transformer.js +0 -0
- /package/{schema → schema-old}/types/types.d.ts +0 -0
- /package/{schema → schema-old}/types/types.js +0 -0
- /package/{schema → schema-old}/utils/index.d.ts +0 -0
- /package/{schema → schema-old}/utils/index.js +0 -0
- /package/{schema → schema-old}/utils/schema.d.ts +0 -0
- /package/{schema → schema-old}/utils/schema.js +0 -0
- /package/{schema → schema-old}/utils/value-type.d.ts +0 -0
- /package/{schema → schema-old}/utils/value-type.js +0 -0
package/api/types.d.ts
CHANGED
|
@@ -91,7 +91,7 @@ export type ApiEndpointParametersSchema<T extends ApiDefinition, K extends ApiEn
|
|
|
91
91
|
export type ApiEndpointBodySchema<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = NonUndefinable<ApiEndpoint<T, K>['body']>;
|
|
92
92
|
export type ApiEndpointResultSchema<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = NonUndefinable<ApiEndpoint<T, K>['result']>;
|
|
93
93
|
export type ApiBinaryType = typeof Uint8Array | typeof Blob | typeof ReadableStream<any>;
|
|
94
|
-
export type ApiInputType<T extends SchemaTestable> = T extends ApiBinaryType ?
|
|
94
|
+
export type ApiInputType<T extends SchemaTestable> = T extends ApiBinaryType ? InstanceType<ApiBinaryType> : T extends typeof ServerSentEvents ? ServerSentEventsSource : T extends SchemaTestable ? SchemaOutput<T> : never;
|
|
95
95
|
export type ApiOutputType<T extends SchemaTestable> = T extends typeof ReadableStream ? ReadableStream<Uint8Array> : T extends SchemaTestable ? SchemaOutput<T> : never;
|
|
96
96
|
export type ApiParameters<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = ApiInputType<ApiEndpointParametersSchema<T, K>>;
|
|
97
97
|
export type ApiClientBody<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = ApiInputType<ApiEndpointBodySchema<T, K>>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ApiDefinition } from '../api/types.js';
|
|
2
|
+
import { type ObjectSchema, type ObjectSchemaOrType } from '../schema/index.js';
|
|
2
3
|
import type { SchemaTestable } from '../schema/schema.js';
|
|
3
|
-
import type { ObjectSchema, ObjectSchemaOrType } from '../schema/types/types.js';
|
|
4
4
|
import type { Record } from '../types.js';
|
|
5
5
|
import type { TokenPayload } from './index.js';
|
|
6
6
|
import { SecretCheckResult } from './models/secret-check-result.model.js';
|
|
7
|
-
import { TokenPayloadBase } from './models/token-payload-base.model.js';
|
|
8
7
|
export declare const dontWaitForValidToken: unique symbol;
|
|
9
8
|
type GetAuthenticationApiEndpointsDefinition<AdditionalTokenPayload extends Record = Record<never>, AuthenticationData = void, AdditionalInitSecretResetData extends Record = Record<never>> = typeof getAuthenticationApiEndpointsDefinition<AdditionalTokenPayload, AuthenticationData, AdditionalInitSecretResetData>;
|
|
10
9
|
type AuthenticationApiEndpointsDefinition<AdditionalTokenPayload extends Record = Record<never>, AuthenticationData = void, AdditionalInitSecretResetData extends Record = Record<never>> = ReturnType<GetAuthenticationApiEndpointsDefinition<AdditionalTokenPayload, AuthenticationData, AdditionalInitSecretResetData>>;
|
|
@@ -20,7 +19,7 @@ export declare const authenticationApiDefinition: {
|
|
|
20
19
|
secret: string;
|
|
21
20
|
data: unknown;
|
|
22
21
|
}>;
|
|
23
|
-
result: ObjectSchema<
|
|
22
|
+
result: ObjectSchema<TokenPayload<import("type-fest").EmptyObject>>;
|
|
24
23
|
credentials: true;
|
|
25
24
|
data: {
|
|
26
25
|
[dontWaitForValidToken]: boolean;
|
|
@@ -32,7 +31,7 @@ export declare const authenticationApiDefinition: {
|
|
|
32
31
|
parameters: ObjectSchema<{
|
|
33
32
|
data: unknown;
|
|
34
33
|
}>;
|
|
35
|
-
result: ObjectSchema<
|
|
34
|
+
result: ObjectSchema<TokenPayload<import("type-fest").EmptyObject>>;
|
|
36
35
|
credentials: true;
|
|
37
36
|
data: {
|
|
38
37
|
[dontWaitForValidToken]: boolean;
|
|
@@ -45,7 +44,7 @@ export declare const authenticationApiDefinition: {
|
|
|
45
44
|
subject: string;
|
|
46
45
|
data: unknown;
|
|
47
46
|
}>;
|
|
48
|
-
result: ObjectSchema<
|
|
47
|
+
result: ObjectSchema<TokenPayload<import("type-fest").EmptyObject>>;
|
|
49
48
|
credentials: true;
|
|
50
49
|
data: {
|
|
51
50
|
[dontWaitForValidToken]: boolean;
|
|
@@ -57,7 +56,7 @@ export declare const authenticationApiDefinition: {
|
|
|
57
56
|
parameters: ObjectSchema<{
|
|
58
57
|
data: unknown;
|
|
59
58
|
}>;
|
|
60
|
-
result: ObjectSchema<
|
|
59
|
+
result: ObjectSchema<TokenPayload<import("type-fest").EmptyObject>>;
|
|
61
60
|
credentials: true;
|
|
62
61
|
data: {
|
|
63
62
|
[dontWaitForValidToken]: boolean;
|
|
@@ -66,7 +65,7 @@ export declare const authenticationApiDefinition: {
|
|
|
66
65
|
endSession: {
|
|
67
66
|
resource: string;
|
|
68
67
|
method: "POST";
|
|
69
|
-
result: import("../schema/
|
|
68
|
+
result: import("../schema/index.js").LiteralSchema<"ok">;
|
|
70
69
|
credentials: true;
|
|
71
70
|
data: {
|
|
72
71
|
[dontWaitForValidToken]: boolean;
|
|
@@ -77,9 +76,9 @@ export declare const authenticationApiDefinition: {
|
|
|
77
76
|
method: "POST";
|
|
78
77
|
parameters: ObjectSchema<{
|
|
79
78
|
subject: string;
|
|
80
|
-
data: import("
|
|
79
|
+
data: import("type-fest").EmptyObject;
|
|
81
80
|
}>;
|
|
82
|
-
result: import("../schema/
|
|
81
|
+
result: import("../schema/index.js").LiteralSchema<"ok">;
|
|
83
82
|
};
|
|
84
83
|
resetSecret: {
|
|
85
84
|
resource: string;
|
|
@@ -88,7 +87,7 @@ export declare const authenticationApiDefinition: {
|
|
|
88
87
|
token: string;
|
|
89
88
|
newSecret: string;
|
|
90
89
|
}>;
|
|
91
|
-
result: import("../schema/
|
|
90
|
+
result: import("../schema/index.js").LiteralSchema<"ok">;
|
|
92
91
|
};
|
|
93
92
|
checkSecret: {
|
|
94
93
|
resource: string;
|
|
@@ -100,11 +99,11 @@ export declare const authenticationApiDefinition: {
|
|
|
100
99
|
};
|
|
101
100
|
timestamp: {
|
|
102
101
|
resource: string;
|
|
103
|
-
result: import("../schema/
|
|
102
|
+
result: import("../schema/index.js").NumberSchema;
|
|
104
103
|
};
|
|
105
104
|
};
|
|
106
105
|
};
|
|
107
|
-
export declare function getAuthenticationApiDefinition<AdditionalTokenPayload extends Record, AuthenticationData, AdditionalInitSecretResetData, AdditionalEndpoints>(additionalTokenPayloadSchema: ObjectSchemaOrType<AdditionalTokenPayload>, authenticationDataSchema: SchemaTestable<AuthenticationData>, initSecretResetDataSchema: ObjectSchemaOrType<AdditionalInitSecretResetData>, resource?: string, additionalEndpoints?: AdditionalEndpoints): {
|
|
106
|
+
export declare function getAuthenticationApiDefinition<AdditionalTokenPayload extends Record, AuthenticationData, AdditionalInitSecretResetData extends Record, AdditionalEndpoints>(additionalTokenPayloadSchema: ObjectSchemaOrType<AdditionalTokenPayload>, authenticationDataSchema: SchemaTestable<AuthenticationData>, initSecretResetDataSchema: ObjectSchemaOrType<AdditionalInitSecretResetData>, resource?: string, additionalEndpoints?: AdditionalEndpoints): {
|
|
108
107
|
resource: string;
|
|
109
108
|
endpoints: {
|
|
110
109
|
getToken: {
|
|
@@ -161,7 +160,7 @@ export declare function getAuthenticationApiDefinition<AdditionalTokenPayload ex
|
|
|
161
160
|
endSession: {
|
|
162
161
|
resource: string;
|
|
163
162
|
method: "POST";
|
|
164
|
-
result: import("../schema/
|
|
163
|
+
result: import("../schema/index.js").LiteralSchema<"ok">;
|
|
165
164
|
credentials: true;
|
|
166
165
|
data: {
|
|
167
166
|
[dontWaitForValidToken]: boolean;
|
|
@@ -174,7 +173,7 @@ export declare function getAuthenticationApiDefinition<AdditionalTokenPayload ex
|
|
|
174
173
|
subject: string;
|
|
175
174
|
data: AdditionalInitSecretResetData;
|
|
176
175
|
}>;
|
|
177
|
-
result: import("../schema/
|
|
176
|
+
result: import("../schema/index.js").LiteralSchema<"ok">;
|
|
178
177
|
};
|
|
179
178
|
resetSecret: {
|
|
180
179
|
resource: string;
|
|
@@ -183,7 +182,7 @@ export declare function getAuthenticationApiDefinition<AdditionalTokenPayload ex
|
|
|
183
182
|
token: string;
|
|
184
183
|
newSecret: string;
|
|
185
184
|
}>;
|
|
186
|
-
result: import("../schema/
|
|
185
|
+
result: import("../schema/index.js").LiteralSchema<"ok">;
|
|
187
186
|
};
|
|
188
187
|
checkSecret: {
|
|
189
188
|
resource: string;
|
|
@@ -195,11 +194,11 @@ export declare function getAuthenticationApiDefinition<AdditionalTokenPayload ex
|
|
|
195
194
|
};
|
|
196
195
|
timestamp: {
|
|
197
196
|
resource: string;
|
|
198
|
-
result: import("../schema/
|
|
197
|
+
result: import("../schema/index.js").NumberSchema;
|
|
199
198
|
};
|
|
200
199
|
};
|
|
201
200
|
};
|
|
202
|
-
export declare function getAuthenticationApiEndpointsDefinition<AdditionalTokenPayload extends Record, AuthenticationData, AdditionalInitSecretResetData>(additionalTokenPayloadSchema: ObjectSchemaOrType<AdditionalTokenPayload>, authenticationDataSchema: SchemaTestable<AuthenticationData>, additionalInitSecretResetDataSchema: ObjectSchemaOrType<AdditionalInitSecretResetData>): {
|
|
201
|
+
export declare function getAuthenticationApiEndpointsDefinition<AdditionalTokenPayload extends Record, AuthenticationData, AdditionalInitSecretResetData extends Record>(additionalTokenPayloadSchema: ObjectSchemaOrType<AdditionalTokenPayload>, authenticationDataSchema: SchemaTestable<AuthenticationData>, additionalInitSecretResetDataSchema: ObjectSchemaOrType<AdditionalInitSecretResetData>): {
|
|
203
202
|
getToken: {
|
|
204
203
|
resource: string;
|
|
205
204
|
method: "POST";
|
|
@@ -254,7 +253,7 @@ export declare function getAuthenticationApiEndpointsDefinition<AdditionalTokenP
|
|
|
254
253
|
endSession: {
|
|
255
254
|
resource: string;
|
|
256
255
|
method: "POST";
|
|
257
|
-
result: import("../schema/
|
|
256
|
+
result: import("../schema/index.js").LiteralSchema<"ok">;
|
|
258
257
|
credentials: true;
|
|
259
258
|
data: {
|
|
260
259
|
[dontWaitForValidToken]: boolean;
|
|
@@ -267,7 +266,7 @@ export declare function getAuthenticationApiEndpointsDefinition<AdditionalTokenP
|
|
|
267
266
|
subject: string;
|
|
268
267
|
data: AdditionalInitSecretResetData;
|
|
269
268
|
}>;
|
|
270
|
-
result: import("../schema/
|
|
269
|
+
result: import("../schema/index.js").LiteralSchema<"ok">;
|
|
271
270
|
};
|
|
272
271
|
resetSecret: {
|
|
273
272
|
resource: string;
|
|
@@ -276,7 +275,7 @@ export declare function getAuthenticationApiEndpointsDefinition<AdditionalTokenP
|
|
|
276
275
|
token: string;
|
|
277
276
|
newSecret: string;
|
|
278
277
|
}>;
|
|
279
|
-
result: import("../schema/
|
|
278
|
+
result: import("../schema/index.js").LiteralSchema<"ok">;
|
|
280
279
|
};
|
|
281
280
|
checkSecret: {
|
|
282
281
|
resource: string;
|
|
@@ -288,7 +287,7 @@ export declare function getAuthenticationApiEndpointsDefinition<AdditionalTokenP
|
|
|
288
287
|
};
|
|
289
288
|
timestamp: {
|
|
290
289
|
resource: string;
|
|
291
|
-
result: import("../schema/
|
|
290
|
+
result: import("../schema/index.js").NumberSchema;
|
|
292
291
|
};
|
|
293
292
|
};
|
|
294
293
|
export {};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { defineApi } from '../api/types.js';
|
|
2
|
-
import { assign } from '../schema/
|
|
3
|
-
import { literal } from '../schema/schemas/literal.js';
|
|
4
|
-
import { number } from '../schema/schemas/number.js';
|
|
5
|
-
import { emptyObjectSchema, explicitObject, object } from '../schema/schemas/object.js';
|
|
6
|
-
import { string } from '../schema/schemas/string.js';
|
|
7
|
-
import { unknown } from '../schema/schemas/unknown.js';
|
|
2
|
+
import { assign, emptyObjectSchema, explicitObject, literal, number, object, string, unknown } from '../schema/index.js';
|
|
8
3
|
import { SecretCheckResult } from './models/secret-check-result.model.js';
|
|
9
4
|
import { TokenPayloadBase } from './models/token-payload-base.model.js';
|
|
10
5
|
export const dontWaitForValidToken = Symbol('dontWaitForValidToken');
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import type { ObjectSchemaOrType } from '../../schema/types/types.js';
|
|
1
|
+
import { ApiClient } from '../../api/client/index.js';
|
|
2
|
+
import { ObjectSchemaOrType, SchemaTestable } from '../../schema/index.js';
|
|
4
3
|
import type { Record } from '../../types.js';
|
|
5
|
-
import
|
|
4
|
+
import { AuthenticationApiDefinition } from '../authentication.api.js';
|
|
6
5
|
export declare function getAuthenticationApiClient<AdditionalTokenPayload extends Record, AuthenticationData, AdditionalInitSecretResetData extends Record>(additionalTokenPayloadSchema: ObjectSchemaOrType<AdditionalTokenPayload>, authenticationDataSchema: SchemaTestable<AuthenticationData>, additionalInitSecretResetData: ObjectSchemaOrType<AdditionalInitSecretResetData>): ApiClient<AuthenticationApiDefinition<AdditionalTokenPayload, AuthenticationData, AdditionalInitSecretResetData>>;
|
|
7
|
-
declare const defaultAuthenticationApiClient: ApiClient<AuthenticationApiDefinition<import("
|
|
6
|
+
declare const defaultAuthenticationApiClient: ApiClient<AuthenticationApiDefinition<import("type-fest").EmptyObject, unknown, import("type-fest").EmptyObject>>;
|
|
8
7
|
export declare class AuthenticationApiClient extends defaultAuthenticationApiClient {
|
|
9
8
|
}
|
|
10
9
|
export {};
|
|
@@ -6,8 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { compileClient } from '../../api/client/index.js';
|
|
8
8
|
import { ReplaceClass, Singleton } from '../../injector/index.js';
|
|
9
|
-
import { emptyObjectSchema } from '../../schema/
|
|
10
|
-
import { unknown } from '../../schema/schemas/unknown.js';
|
|
9
|
+
import { emptyObjectSchema, unknown } from '../../schema/index.js';
|
|
11
10
|
import { getAuthenticationApiDefinition } from '../authentication.api.js';
|
|
12
11
|
export function getAuthenticationApiClient(additionalTokenPayloadSchema, authenticationDataSchema, additionalInitSecretResetData) {
|
|
13
12
|
const definition = getAuthenticationApiDefinition(additionalTokenPayloadSchema, authenticationDataSchema, additionalInitSecretResetData);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { HttpClientMiddleware } from '../../http/client/middleware.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type ValueOrAsyncProvider } from '../../utils/value-or-provider.js';
|
|
3
3
|
import type { AuthenticationClientService } from './authentication.service.js';
|
|
4
4
|
export declare function waitForAuthenticationCredentialsMiddleware(authenticationServiceOrProvider: ValueOrAsyncProvider<AuthenticationClientService>): HttpClientMiddleware;
|
package/browser/pdf-options.js
CHANGED
|
@@ -7,8 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
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
|
-
import { Enumeration } from '../schema/
|
|
11
|
-
import { Optional } from '../schema/schemas/optional.js';
|
|
10
|
+
import { Enumeration, Optional, Union } from '../schema/index.js';
|
|
12
11
|
export var PdfFormat;
|
|
13
12
|
(function (PdfFormat) {
|
|
14
13
|
PdfFormat["Letter"] = "letter";
|
|
@@ -30,19 +29,19 @@ export class PdfMarginObject {
|
|
|
30
29
|
left;
|
|
31
30
|
}
|
|
32
31
|
__decorate([
|
|
33
|
-
|
|
32
|
+
Union(Number, String, { optional: true }),
|
|
34
33
|
__metadata("design:type", Object)
|
|
35
34
|
], PdfMarginObject.prototype, "top", void 0);
|
|
36
35
|
__decorate([
|
|
37
|
-
|
|
36
|
+
Union(Number, String, { optional: true }),
|
|
38
37
|
__metadata("design:type", Object)
|
|
39
38
|
], PdfMarginObject.prototype, "bottom", void 0);
|
|
40
39
|
__decorate([
|
|
41
|
-
|
|
40
|
+
Union(Number, String, { optional: true }),
|
|
42
41
|
__metadata("design:type", Object)
|
|
43
42
|
], PdfMarginObject.prototype, "right", void 0);
|
|
44
43
|
__decorate([
|
|
45
|
-
|
|
44
|
+
Union(Number, String, { optional: true }),
|
|
46
45
|
__metadata("design:type", Object)
|
|
47
46
|
], PdfMarginObject.prototype, "left", void 0);
|
|
48
47
|
export class PdfRenderOptions {
|
|
@@ -75,11 +74,11 @@ __decorate([
|
|
|
75
74
|
__metadata("design:type", String)
|
|
76
75
|
], PdfRenderOptions.prototype, "format", void 0);
|
|
77
76
|
__decorate([
|
|
78
|
-
|
|
77
|
+
Union(String, Number, { optional: true }),
|
|
79
78
|
__metadata("design:type", Object)
|
|
80
79
|
], PdfRenderOptions.prototype, "width", void 0);
|
|
81
80
|
__decorate([
|
|
82
|
-
|
|
81
|
+
Union(String, Number, { optional: true }),
|
|
83
82
|
__metadata("design:type", Object)
|
|
84
83
|
], PdfRenderOptions.prototype, "height", void 0);
|
|
85
84
|
__decorate([
|
|
@@ -87,7 +86,7 @@ __decorate([
|
|
|
87
86
|
__metadata("design:type", Number)
|
|
88
87
|
], PdfRenderOptions.prototype, "scale", void 0);
|
|
89
88
|
__decorate([
|
|
90
|
-
|
|
89
|
+
Union(String, Number, PdfMarginObject, { optional: true }),
|
|
91
90
|
__metadata("design:type", Object)
|
|
92
91
|
], PdfRenderOptions.prototype, "margin", void 0);
|
|
93
92
|
__decorate([
|
package/errors/custom.error.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
export type CustomErrorOptions = {
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Name of error
|
|
4
4
|
*
|
|
5
5
|
* defaults to static {@link CustomErrorStatic.errorName} if set and constructor (class) name if unset.
|
|
6
6
|
*/
|
|
7
7
|
name?: string;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Error message
|
|
10
10
|
*/
|
|
11
11
|
message?: string;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Stack trace
|
|
14
14
|
*/
|
|
15
15
|
stack?: string;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Cause for error
|
|
18
18
|
*/
|
|
19
19
|
cause?: Error;
|
|
20
|
-
/**
|
|
20
|
+
/** Skip {@link Error} super call, which improves speed but looses stack trace */
|
|
21
21
|
fast?: boolean | undefined;
|
|
22
22
|
};
|
|
23
23
|
export declare abstract class CustomError extends Error {
|
|
@@ -18,7 +18,7 @@ import { configureHttpClient } from '../../http/client/module.js';
|
|
|
18
18
|
import { configureNodeHttpServer } from '../../http/server/node/module.js';
|
|
19
19
|
import { inject } from '../../injector/inject.js';
|
|
20
20
|
import { WebServerModule } from '../../module/modules/web-server.module.js';
|
|
21
|
-
import { Property, array, boolean, number, object } from '../../schema/index.js';
|
|
21
|
+
import { Number, Property, array, boolean, number, object } from '../../schema/index.js';
|
|
22
22
|
import { timeout } from '../../utils/timing.js';
|
|
23
23
|
import { Agent } from 'undici';
|
|
24
24
|
class User {
|
|
@@ -26,7 +26,7 @@ class User {
|
|
|
26
26
|
name;
|
|
27
27
|
}
|
|
28
28
|
__decorate([
|
|
29
|
-
|
|
29
|
+
Number({ coerce: true }),
|
|
30
30
|
__metadata("design:type", Number)
|
|
31
31
|
], User.prototype, "id", void 0);
|
|
32
32
|
__decorate([
|
|
@@ -92,11 +92,11 @@ async function clientTest() {
|
|
|
92
92
|
console.log(allUsersAfterDelete);
|
|
93
93
|
Application.requestShutdown();
|
|
94
94
|
}
|
|
95
|
-
|
|
95
|
+
function main() {
|
|
96
96
|
configureNodeHttpServer();
|
|
97
97
|
configureApiServer({ controllers: [UserApi] });
|
|
98
98
|
configureUndiciHttpClientAdapter({ dispatcher: new Agent({ keepAliveMaxTimeout: 1 }) });
|
|
99
99
|
configureHttpClient({ baseUrl: 'http://localhost:8000' });
|
|
100
100
|
Application.run(WebServerModule, clientTest);
|
|
101
101
|
}
|
|
102
|
-
|
|
102
|
+
main();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type CancellationSignal } from '../../cancellation/index.js';
|
|
2
2
|
import { dispose, type Disposable } from '../../disposable/index.js';
|
|
3
|
-
import type { OneOrMany } from '../../
|
|
4
|
-
import type { Record, TypedOmit, UndefinableJson, UndefinableJsonObject } from '../../types.js';
|
|
3
|
+
import type { OneOrMany, Record, TypedOmit, UndefinableJson, UndefinableJsonObject } from '../../types.js';
|
|
5
4
|
import { HttpForm, type HttpFormObject } from '../http-form.js';
|
|
6
5
|
import { HttpHeaders, type HttpHeadersObject } from '../http-headers.js';
|
|
7
6
|
import { HttpQuery, type HttpQueryObject } from '../http-query.js';
|
package/http/client/module.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { HttpClientMiddleware } from './middleware.js';
|
|
|
5
5
|
export type HttpClientModuleConfig = HttpClientOptions & {
|
|
6
6
|
adapter?: Type<HttpClientAdapter>;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Middlewares to add
|
|
9
9
|
*/
|
|
10
10
|
middleware?: OneOrMany<HttpClientMiddleware>;
|
|
11
11
|
};
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
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
|
-
import {
|
|
10
|
+
import { Enumeration, Number, Optional } from '../schema/index.js';
|
|
11
11
|
export var ImageResizeMode;
|
|
12
12
|
(function (ImageResizeMode) {
|
|
13
13
|
ImageResizeMode["Fit"] = "fit";
|
|
@@ -49,13 +49,11 @@ __decorate([
|
|
|
49
49
|
__metadata("design:type", String)
|
|
50
50
|
], ImageOptions.prototype, "resizeMode", void 0);
|
|
51
51
|
__decorate([
|
|
52
|
-
|
|
53
|
-
Coerce(),
|
|
52
|
+
Number({ optional: true, coerce: true }),
|
|
54
53
|
__metadata("design:type", Number)
|
|
55
54
|
], ImageOptions.prototype, "width", void 0);
|
|
56
55
|
__decorate([
|
|
57
|
-
|
|
58
|
-
Coerce(),
|
|
56
|
+
Number({ optional: true, coerce: true }),
|
|
59
57
|
__metadata("design:type", Number)
|
|
60
58
|
], ImageOptions.prototype, "height", void 0);
|
|
61
59
|
__decorate([
|
|
@@ -64,8 +62,7 @@ __decorate([
|
|
|
64
62
|
__metadata("design:type", String)
|
|
65
63
|
], ImageOptions.prototype, "origin", void 0);
|
|
66
64
|
__decorate([
|
|
67
|
-
|
|
68
|
-
Coerce(),
|
|
65
|
+
Number({ optional: true, coerce: true }),
|
|
69
66
|
__metadata("design:type", Number)
|
|
70
67
|
], ImageOptions.prototype, "quality", void 0);
|
|
71
68
|
__decorate([
|
package/mail/mail.client.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { resolveArgumentType } from '../injector/index.js';
|
|
1
|
+
import { resolveArgumentType, type Resolvable } from '../injector/index.js';
|
|
3
2
|
import type { MailData, MailSendResult } from './models/index.js';
|
|
4
3
|
export declare class MailClientAuthConfig {
|
|
5
4
|
user: string;
|
|
@@ -8,6 +7,7 @@ export declare class MailClientAuthConfig {
|
|
|
8
7
|
export declare class MailClientConfig {
|
|
9
8
|
host: string;
|
|
10
9
|
port: number;
|
|
10
|
+
/** Enable TLS (if not defined it is automatically set depending on port) */
|
|
11
11
|
secure?: boolean;
|
|
12
12
|
auth?: MailClientAuthConfig;
|
|
13
13
|
}
|
package/mail/mail.client.js
CHANGED
|
@@ -8,7 +8,7 @@ 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 { Property } from '../schema/decorators/property.js';
|
|
11
|
-
import {
|
|
11
|
+
import { Boolean } from '../schema/index.js';
|
|
12
12
|
import { Optional } from '../schema/schemas/optional.js';
|
|
13
13
|
export class MailClientAuthConfig {
|
|
14
14
|
user;
|
|
@@ -25,7 +25,7 @@ __decorate([
|
|
|
25
25
|
export class MailClientConfig {
|
|
26
26
|
host;
|
|
27
27
|
port;
|
|
28
|
-
|
|
28
|
+
/** Enable TLS (if not defined it is automatically set depending on port) */
|
|
29
29
|
secure;
|
|
30
30
|
auth;
|
|
31
31
|
}
|
|
@@ -38,9 +38,7 @@ __decorate([
|
|
|
38
38
|
__metadata("design:type", Number)
|
|
39
39
|
], MailClientConfig.prototype, "port", void 0);
|
|
40
40
|
__decorate([
|
|
41
|
-
|
|
42
|
-
/* enable TLS (if not defined it is automatically set depending on port) */
|
|
43
|
-
,
|
|
41
|
+
Boolean({ optional: true }),
|
|
44
42
|
__metadata("design:type", Boolean)
|
|
45
43
|
], MailClientConfig.prototype, "secure", void 0);
|
|
46
44
|
__decorate([
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PrimaryKey(): PropertyDecorator;
|
package/orm/entity.js
CHANGED
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
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
|
-
import {
|
|
10
|
+
import { Number, Property, any, record } from '../schema/index.js';
|
|
11
11
|
export class EntityMetadata {
|
|
12
12
|
revision;
|
|
13
13
|
revisionTimestamp;
|
|
@@ -28,11 +28,11 @@ __decorate([
|
|
|
28
28
|
__metadata("design:type", Number)
|
|
29
29
|
], EntityMetadata.prototype, "createTimestamp", void 0);
|
|
30
30
|
__decorate([
|
|
31
|
-
|
|
31
|
+
Number({ nullable: true }),
|
|
32
32
|
__metadata("design:type", Object)
|
|
33
33
|
], EntityMetadata.prototype, "deleteTimestamp", void 0);
|
|
34
34
|
__decorate([
|
|
35
|
-
Property(
|
|
35
|
+
Property(record(any(), any())),
|
|
36
36
|
__metadata("design:type", Object)
|
|
37
37
|
], EntityMetadata.prototype, "attributes", void 0);
|
|
38
38
|
export class Entity {
|
package/orm/index.d.ts
CHANGED
package/orm/index.js
CHANGED
package/orm/repository.d.ts
CHANGED
|
@@ -19,7 +19,8 @@ export type EntityMetadataUpdate = {
|
|
|
19
19
|
export type EntityUpdate<T extends Entity> = Partial<TypedOmit<T, 'metadata'>> & EntityMetadataUpdate;
|
|
20
20
|
export declare abstract class EntityRepository<T extends Entity = Entity> {
|
|
21
21
|
readonly type: Type<T>;
|
|
22
|
-
|
|
22
|
+
readonly database: import("drizzle-orm/node-postgres").NodePgDatabase<Record<string, never>>;
|
|
23
|
+
load(_id: string): Promise<T>;
|
|
23
24
|
abstract tryLoad(id: string): Promise<T | undefined>;
|
|
24
25
|
abstract loadByFilter(query: Query<T>, options?: LoadOptions<T>): Promise<T>;
|
|
25
26
|
abstract tryLoadByFilter(query: Query<T>, options?: LoadOptions<T>): Promise<T | undefined>;
|
|
@@ -33,7 +34,6 @@ export declare abstract class EntityRepository<T extends Entity = Entity> {
|
|
|
33
34
|
abstract countByFilter(query: Query<T>): Promise<number>;
|
|
34
35
|
abstract has(id: string): Promise<boolean>;
|
|
35
36
|
abstract hasByFilter(query: Query<T>): Promise<boolean>;
|
|
36
|
-
abstract hasMany(ids: string[]): Promise<string[]>;
|
|
37
37
|
abstract hasAll(ids: string[]): Promise<boolean>;
|
|
38
38
|
abstract insert(entity: NewEntity<T>): Promise<T>;
|
|
39
39
|
abstract insertMany(entities: NewEntity<T>[]): Promise<T[]>;
|
|
@@ -41,10 +41,8 @@ export declare abstract class EntityRepository<T extends Entity = Entity> {
|
|
|
41
41
|
abstract updateByFilter(query: Query<T>, update: EntityUpdate<T>): Promise<void>;
|
|
42
42
|
abstract updateMany(ids: string[], update: EntityUpdate<T>): Promise<void>;
|
|
43
43
|
abstract updateManyByFilter(filter: Query<T>, update: EntityUpdate<T>): Promise<void>;
|
|
44
|
-
abstract delete
|
|
45
|
-
abstract deleteMany
|
|
46
|
-
abstract
|
|
47
|
-
abstract
|
|
48
|
-
abstract deleteByFilter<U extends T = T>(query: Query<U>): Promise<boolean>;
|
|
49
|
-
abstract deleteManyByFilter<U extends T = T>(query: Query<U>): Promise<number>;
|
|
44
|
+
abstract delete(id: string): Promise<boolean>;
|
|
45
|
+
abstract deleteMany(ids: string[]): Promise<number>;
|
|
46
|
+
abstract deleteByFilter(query: Query<T>): Promise<boolean>;
|
|
47
|
+
abstract deleteManyByFilter(query: Query<T>): Promise<number>;
|
|
50
48
|
}
|
package/orm/repository.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
import { NotImplementedError } from '../errors/not-implemented.error.js';
|
|
2
|
+
import { drizzle } from 'drizzle-orm/node-postgres';
|
|
1
3
|
export const repositoryType = Symbol('repositoryType');
|
|
2
4
|
export class EntityRepository {
|
|
3
5
|
type;
|
|
6
|
+
database = drizzle(null);
|
|
7
|
+
async load(_id) {
|
|
8
|
+
// const result = await this.database.select({ name2: mySchemaUsers.name }).from(mySchemaUsers).leftJoin();
|
|
9
|
+
throw new NotImplementedError();
|
|
10
|
+
}
|
|
4
11
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { boolean, doublePrecision, text, type PgTableWithColumns } from 'drizzle-orm/pg-core';
|
|
2
|
+
import type { GetTagMetadata, SnakeCase, Tagged } from 'type-fest';
|
|
3
|
+
import type { Type } from '../types.js';
|
|
4
|
+
import { BuildColumns, NotNull } from 'drizzle-orm';
|
|
5
|
+
import type { DbSchemaStatic } from './schema.js';
|
|
6
|
+
import { Integer } from './types.js';
|
|
7
|
+
export declare const mySchema: import("drizzle-orm/pg-core").PgSchema<"my_schema">;
|
|
8
|
+
export declare const colors: import("drizzle-orm/pg-core").PgEnum<["red", "green", "blue"]>;
|
|
9
|
+
export declare const mySchemaUsers: PgTableWithColumns<{
|
|
10
|
+
name: "users";
|
|
11
|
+
schema: "my_schema";
|
|
12
|
+
columns: {
|
|
13
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
14
|
+
name: "id";
|
|
15
|
+
tableName: "users";
|
|
16
|
+
dataType: "string";
|
|
17
|
+
columnType: "PgUUID";
|
|
18
|
+
data: string;
|
|
19
|
+
driverParam: string;
|
|
20
|
+
notNull: false;
|
|
21
|
+
hasDefault: false;
|
|
22
|
+
enumValues: undefined;
|
|
23
|
+
baseColumn: never;
|
|
24
|
+
}, {}, {}>;
|
|
25
|
+
name: import("drizzle-orm/pg-core").PgColumn<{
|
|
26
|
+
name: "name";
|
|
27
|
+
tableName: "users";
|
|
28
|
+
dataType: "string";
|
|
29
|
+
columnType: "PgText";
|
|
30
|
+
data: string;
|
|
31
|
+
driverParam: string;
|
|
32
|
+
notNull: false;
|
|
33
|
+
hasDefault: false;
|
|
34
|
+
enumValues: [string, ...string[]];
|
|
35
|
+
baseColumn: never;
|
|
36
|
+
}, {}, {}>;
|
|
37
|
+
age: import("drizzle-orm/pg-core").PgColumn<{
|
|
38
|
+
name: "";
|
|
39
|
+
tableName: "users";
|
|
40
|
+
dataType: "number";
|
|
41
|
+
columnType: "PgInteger";
|
|
42
|
+
data: number;
|
|
43
|
+
driverParam: string | number;
|
|
44
|
+
notNull: false;
|
|
45
|
+
hasDefault: false;
|
|
46
|
+
enumValues: undefined;
|
|
47
|
+
baseColumn: never;
|
|
48
|
+
}, {}, {}>;
|
|
49
|
+
color: import("drizzle-orm/pg-core").PgColumn<{
|
|
50
|
+
name: "color";
|
|
51
|
+
tableName: "users";
|
|
52
|
+
dataType: "string";
|
|
53
|
+
columnType: "PgEnumColumn";
|
|
54
|
+
data: "red" | "green" | "blue";
|
|
55
|
+
driverParam: string;
|
|
56
|
+
notNull: false;
|
|
57
|
+
hasDefault: true;
|
|
58
|
+
enumValues: ["red", "green", "blue"];
|
|
59
|
+
baseColumn: never;
|
|
60
|
+
}, {}, {}>;
|
|
61
|
+
};
|
|
62
|
+
dialect: "pg";
|
|
63
|
+
}>;
|
|
64
|
+
type ColumnBase<Name extends string, T> = T extends Tagged<T, 'column', any> ? GetTagMetadata<T, 'column'> : T extends string ? ReturnType<typeof text<Name, string, [string, ...string[]]>> : T extends number ? ReturnType<typeof doublePrecision<Name>> : T extends boolean ? ReturnType<typeof boolean<Name>> : never;
|
|
65
|
+
type Column<Name extends string, T> = null extends T ? ColumnBase<Name, T> : NotNull<ColumnBase<Name, T>>;
|
|
66
|
+
export declare function getDrizzleSchemaFromType<T extends Type & DbSchemaStatic>(type: T): PgTableWithColumns<{
|
|
67
|
+
name: SnakeCase<T['entityName']>;
|
|
68
|
+
schema: '';
|
|
69
|
+
columns: BuildColumns<T['entityName'], {
|
|
70
|
+
[P in keyof InstanceType<T>]: Column<Extract<P, string>, InstanceType<T>[P]>;
|
|
71
|
+
}, 'pg'>;
|
|
72
|
+
dialect: '';
|
|
73
|
+
}>;
|
|
74
|
+
export declare class Entity2 {
|
|
75
|
+
id: string;
|
|
76
|
+
}
|
|
77
|
+
export declare class User extends Entity2 {
|
|
78
|
+
static entityName: 'UserData';
|
|
79
|
+
name: string;
|
|
80
|
+
age: Integer<'age'> | null;
|
|
81
|
+
hasAge: boolean;
|
|
82
|
+
}
|
|
83
|
+
export {};
|