@nhtio/lucid-resourceful 1.20250718.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/LICENSE.md +9 -0
- package/README.md +5 -0
- package/decorator_utils-1yWqd_Gg.cjs +6792 -0
- package/decorator_utils-1yWqd_Gg.cjs.map +1 -0
- package/decorator_utils-BUuBwQYK.js +6793 -0
- package/decorator_utils-BUuBwQYK.js.map +1 -0
- package/definitions-B66EPk0H.js +381 -0
- package/definitions-B66EPk0H.js.map +1 -0
- package/definitions-BrN-oCRI.cjs +380 -0
- package/definitions-BrN-oCRI.cjs.map +1 -0
- package/definitions.cjs +15 -0
- package/definitions.cjs.map +1 -0
- package/definitions.d.ts +5 -0
- package/definitions.mjs +15 -0
- package/definitions.mjs.map +1 -0
- package/errors-B1rr67uM.js +3004 -0
- package/errors-B1rr67uM.js.map +1 -0
- package/errors-D8jb9VxY.cjs +3000 -0
- package/errors-D8jb9VxY.cjs.map +1 -0
- package/errors.cjs +22 -0
- package/errors.cjs.map +1 -0
- package/errors.d.ts +94 -0
- package/errors.mjs +22 -0
- package/errors.mjs.map +1 -0
- package/index-Cv6KC1rC.cjs +670 -0
- package/index-Cv6KC1rC.cjs.map +1 -0
- package/index-DDaZ2qr2.js +671 -0
- package/index-DDaZ2qr2.js.map +1 -0
- package/index.cjs +12706 -0
- package/index.cjs.map +1 -0
- package/index.d.ts +14 -0
- package/index.mjs +12708 -0
- package/index.mjs.map +1 -0
- package/joi.cjs +5 -0
- package/joi.cjs.map +1 -0
- package/joi.d.ts +5 -0
- package/joi.mjs +5 -0
- package/joi.mjs.map +1 -0
- package/package.json +65 -0
- package/private/constants.d.ts +11 -0
- package/private/controller_factory.d.ts +1 -0
- package/private/data_type_schemas.d.ts +12 -0
- package/private/data_types.d.ts +437 -0
- package/private/decorator_schemas.d.ts +34 -0
- package/private/decorator_utils.d.ts +305 -0
- package/private/decorators.d.ts +209 -0
- package/private/helpers.d.ts +34 -0
- package/private/joi/bigint.d.ts +85 -0
- package/private/joi/index.d.ts +65 -0
- package/private/lucene_to_lucid_translator.d.ts +201 -0
- package/private/mixin.d.ts +563 -0
- package/private/schema_types.d.ts +157 -0
- package/private/type_guards.d.ts +42 -0
- package/private/types.d.ts +102 -0
- package/private/utils.d.ts +10 -0
- package/types.cjs +2 -0
- package/types.cjs.map +1 -0
- package/types.d.ts +28 -0
- package/types.mjs +2 -0
- package/types.mjs.map +1 -0
- package/utils/casters.d.ts +1 -0
- package/utils/consumers.d.ts +1 -0
- package/utils/preparers.d.ts +1 -0
- package/utils.cjs +50 -0
- package/utils.cjs.map +1 -0
- package/utils.d.ts +20 -0
- package/utils.mjs +51 -0
- package/utils.mjs.map +1 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { AnySchema as JoiAnySchema, StringSchema as JoiStringSchema, BinarySchema as JoiBinarySchema, NumberSchema as JoiNumberSchema, BooleanSchema as JoiBooleanSchema, ObjectSchema as JoiObjectSchema, ArraySchema as JoiArraySchema, DateSchema as JoiDateSchema, Reference, BasicType, CustomHelpers } from 'joi';
|
|
2
|
+
/**
|
|
3
|
+
* Base schema type for all Joi validation schemas.
|
|
4
|
+
*
|
|
5
|
+
* This interface provides the foundation for all Joi schema types with
|
|
6
|
+
* comprehensive validation methods and options.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export interface AnySchema<TSchema = any> extends Omit<JoiAnySchema<TSchema>, 'default'> {
|
|
11
|
+
/**
|
|
12
|
+
* Sets a default value if the original value is `undefined`.
|
|
13
|
+
*
|
|
14
|
+
* @param value - The default value. Can be:
|
|
15
|
+
* - A literal value (string, number, object, etc.)
|
|
16
|
+
* - A reference to another schema value
|
|
17
|
+
* - A function that returns the default value with signature `(parent, helpers) => value`
|
|
18
|
+
* - `parent` - A clone of the object containing the value being validated
|
|
19
|
+
* - `helpers` - Validation helper functions for custom validation logic
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const schema = joi.string().default('hello world')
|
|
24
|
+
* const schemaWithFunction = joi.number().default((parent, helpers) => parent.someOtherField * 2)
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
default(value?: Reference | BasicType | ((parent: any, helpers: CustomHelpers) => Reference | BasicType)): this;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Schema type for string validation.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export interface StringSchema<TSchema = string> extends Omit<JoiStringSchema<TSchema>, 'default'> {
|
|
35
|
+
/**
|
|
36
|
+
* Sets a default value if the original value is `undefined`.
|
|
37
|
+
*
|
|
38
|
+
* @param value - The default value. Can be:
|
|
39
|
+
* - A literal string value
|
|
40
|
+
* - A reference to another schema value
|
|
41
|
+
* - A function that returns the default value with signature `(parent, helpers) => value`
|
|
42
|
+
* - `parent` - A clone of the object containing the value being validated
|
|
43
|
+
* - `helpers` - Validation helper functions for custom validation logic
|
|
44
|
+
*/
|
|
45
|
+
default(value?: Reference | BasicType | ((parent: any, helpers: CustomHelpers) => Reference | BasicType)): this;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Schema type for binary data validation.
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export interface BinarySchema<TSchema = Buffer> extends Omit<JoiBinarySchema<TSchema>, 'default'> {
|
|
53
|
+
/**
|
|
54
|
+
* Sets a default value if the original value is `undefined`.
|
|
55
|
+
*
|
|
56
|
+
* @param value - The default value. Can be:
|
|
57
|
+
* - A literal binary value (Buffer, Uint8Array, etc.)
|
|
58
|
+
* - A reference to another schema value
|
|
59
|
+
* - A function that returns the default value with signature `(parent, helpers) => value`
|
|
60
|
+
* - `parent` - A clone of the object containing the value being validated
|
|
61
|
+
* - `helpers` - Validation helper functions for custom validation logic
|
|
62
|
+
*/
|
|
63
|
+
default(value?: Reference | BasicType | ((parent: any, helpers: CustomHelpers) => Reference | BasicType)): this;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Schema type for number validation.
|
|
67
|
+
*
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
export interface NumberSchema<TSchema = number> extends Omit<JoiNumberSchema<TSchema>, 'default'> {
|
|
71
|
+
/**
|
|
72
|
+
* Sets a default value if the original value is `undefined`.
|
|
73
|
+
*
|
|
74
|
+
* @param value - The default value. Can be:
|
|
75
|
+
* - A literal number value
|
|
76
|
+
* - A reference to another schema value
|
|
77
|
+
* - A function that returns the default value with signature `(parent, helpers) => value`
|
|
78
|
+
* - `parent` - A clone of the object containing the value being validated
|
|
79
|
+
* - `helpers` - Validation helper functions for custom validation logic
|
|
80
|
+
*/
|
|
81
|
+
default(value?: Reference | BasicType | ((parent: any, helpers: CustomHelpers) => Reference | BasicType)): this;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Schema type for boolean validation.
|
|
85
|
+
*
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
export interface BooleanSchema<TSchema = boolean> extends Omit<JoiBooleanSchema<TSchema>, 'default'> {
|
|
89
|
+
/**
|
|
90
|
+
* Sets a default value if the original value is `undefined`.
|
|
91
|
+
*
|
|
92
|
+
* @param value - The default value. Can be:
|
|
93
|
+
* - A literal boolean value
|
|
94
|
+
* - A reference to another schema value
|
|
95
|
+
* - A function that returns the default value with signature `(parent, helpers) => value`
|
|
96
|
+
* - `parent` - A clone of the object containing the value being validated
|
|
97
|
+
* - `helpers` - Validation helper functions for custom validation logic
|
|
98
|
+
*/
|
|
99
|
+
default(value?: Reference | BasicType | ((parent: any, helpers: CustomHelpers) => Reference | BasicType)): this;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Schema type for object validation.
|
|
103
|
+
*
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
export interface ObjectSchema<TSchema = any> extends Omit<JoiObjectSchema<TSchema>, 'default'> {
|
|
107
|
+
/**
|
|
108
|
+
* Sets a default value if the original value is `undefined`.
|
|
109
|
+
*
|
|
110
|
+
* @param value - The default value. Can be:
|
|
111
|
+
* - A literal object value
|
|
112
|
+
* - A reference to another schema value
|
|
113
|
+
* - A function that returns the default value with signature `(parent, helpers) => value`
|
|
114
|
+
* - `parent` - A clone of the object containing the value being validated
|
|
115
|
+
* - `helpers` - Validation helper functions for custom validation logic
|
|
116
|
+
*
|
|
117
|
+
* When called without any value on an object schema type, a default value will be
|
|
118
|
+
* automatically generated based on the default values of the object keys.
|
|
119
|
+
*/
|
|
120
|
+
default(value?: Reference | BasicType | ((parent: any, helpers: CustomHelpers) => Reference | BasicType)): this;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Schema type for array validation.
|
|
124
|
+
*
|
|
125
|
+
* @public
|
|
126
|
+
*/
|
|
127
|
+
export interface ArraySchema<TSchema = any[]> extends Omit<JoiArraySchema<TSchema>, 'default'> {
|
|
128
|
+
/**
|
|
129
|
+
* Sets a default value if the original value is `undefined`.
|
|
130
|
+
*
|
|
131
|
+
* @param value - The default value. Can be:
|
|
132
|
+
* - A literal array value
|
|
133
|
+
* - A reference to another schema value
|
|
134
|
+
* - A function that returns the default value with signature `(parent, helpers) => value`
|
|
135
|
+
* - `parent` - A clone of the object containing the value being validated
|
|
136
|
+
* - `helpers` - Validation helper functions for custom validation logic
|
|
137
|
+
*/
|
|
138
|
+
default(value?: Reference | BasicType | ((parent: any, helpers: CustomHelpers) => Reference | BasicType)): this;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Schema type for date validation.
|
|
142
|
+
*
|
|
143
|
+
* @public
|
|
144
|
+
*/
|
|
145
|
+
export interface DateSchema<TSchema = Date> extends Omit<JoiDateSchema<TSchema>, 'default'> {
|
|
146
|
+
/**
|
|
147
|
+
* Sets a default value if the original value is `undefined`.
|
|
148
|
+
*
|
|
149
|
+
* @param value - The default value. Can be:
|
|
150
|
+
* - A literal date value
|
|
151
|
+
* - A reference to another schema value
|
|
152
|
+
* - A function that returns the default value with signature `(parent, helpers) => value`
|
|
153
|
+
* - `parent` - A clone of the object containing the value being validated
|
|
154
|
+
* - `helpers` - Validation helper functions for custom validation logic
|
|
155
|
+
*/
|
|
156
|
+
default(value?: Reference | BasicType | ((parent: any, helpers: CustomHelpers) => Reference | BasicType)): this;
|
|
157
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DateTime } from 'luxon';
|
|
2
|
+
import type { LucidBinaryValue } from './types';
|
|
3
|
+
import type { ResourcefulModel } from './mixin';
|
|
4
|
+
/**
|
|
5
|
+
* Type guard to check if a value is a Luxon DateTime instance
|
|
6
|
+
* @param value - The value to check
|
|
7
|
+
* @returns True if the value is a Luxon DateTime, false otherwise
|
|
8
|
+
*/
|
|
9
|
+
export declare const isLuxonDateTime: (value: unknown) => value is DateTime;
|
|
10
|
+
/**
|
|
11
|
+
* Type guard to check if a value is a valid Lucid binary value (Uint8Array or Buffer)
|
|
12
|
+
* @param value - The value to check
|
|
13
|
+
* @returns True if the value is a LucidBinaryValue, false otherwise
|
|
14
|
+
*/
|
|
15
|
+
export declare const isLucidBinaryValue: (value: unknown) => value is LucidBinaryValue;
|
|
16
|
+
/**
|
|
17
|
+
* Type guard to check if a value is a plain object (not null, not array)
|
|
18
|
+
* @param value - The value to check
|
|
19
|
+
* @returns True if the value is a plain object, false otherwise
|
|
20
|
+
*/
|
|
21
|
+
export declare const isObject: (value: unknown) => value is {
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Type guard to check if a value is an array
|
|
26
|
+
* @param value - The value to check
|
|
27
|
+
* @returns True if the value is an array, false otherwise
|
|
28
|
+
*/
|
|
29
|
+
export declare const isArray: (value: unknown) => value is unknown[];
|
|
30
|
+
/**
|
|
31
|
+
* Checks if a value is an instance of a specific class.
|
|
32
|
+
* @param value - The value to check
|
|
33
|
+
* @param type - The name of the class to check against
|
|
34
|
+
* @returns true if the value is an instance of the specified class, false otherwise
|
|
35
|
+
*/
|
|
36
|
+
export declare const isInstanceOf: <T>(value: unknown, type: string, ctor?: new (...args: any[]) => T) => value is T;
|
|
37
|
+
/**
|
|
38
|
+
* Type guard to check if a value is a ResourcefulModel
|
|
39
|
+
* @param value - The value to check
|
|
40
|
+
* @returns True if the value is a ResourcefulModel, false otherwise
|
|
41
|
+
*/
|
|
42
|
+
export declare const isResourcefulModel: (value: unknown) => value is ResourcefulModel;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import type { HttpContext } from '@adonisjs/core/http';
|
|
3
|
+
import type { ApplicationService } from '@adonisjs/core/types';
|
|
4
|
+
import type { ResourcefulDataType } from '@nhtio/lucid-resourceful/types';
|
|
5
|
+
import type { ModelRelationTypes } from '@adonisjs/lucid/types/relations';
|
|
6
|
+
import type { LucidModel, LucidRow, ModelColumnOptions, ComputedOptions } from '@adonisjs/lucid/types/model';
|
|
7
|
+
import type { AnySchema, StringSchema, BinarySchema, NumberSchema, BooleanSchema, ObjectSchema, ArraySchema, DateSchema } from './schema_types';
|
|
8
|
+
export type PromiseAble<T = unknown> = T | Promise<T> | PromiseLike<T>;
|
|
9
|
+
export type Promised<T = unknown> = Promise<T> | PromiseLike<T>;
|
|
10
|
+
export interface ResourcefulGeneralAccessControlFilter {
|
|
11
|
+
(ctx: HttpContext, app: ApplicationService): PromiseAble<boolean>;
|
|
12
|
+
}
|
|
13
|
+
export interface ResourcefulAccessControlFilter<ResourcefulModel extends LucidModel = LucidModel, ResourcefulModelInstance = InstanceType<ResourcefulModel>> {
|
|
14
|
+
(ctx: HttpContext, app: ApplicationService, instance?: ResourcefulModelInstance): PromiseAble<boolean>;
|
|
15
|
+
}
|
|
16
|
+
export interface ResourcefulResourceAccessControlFilter<ResourcefulModel extends LucidModel = LucidModel, ResourcefulModelInstance = InstanceType<ResourcefulModel>> {
|
|
17
|
+
(ctx: HttpContext, app: ApplicationService, instance: ResourcefulModelInstance): PromiseAble<boolean>;
|
|
18
|
+
}
|
|
19
|
+
export interface ExternalDocumentationObject {
|
|
20
|
+
description?: string;
|
|
21
|
+
url: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ResourcefulPropertyDefinition {
|
|
24
|
+
propertyKey: string;
|
|
25
|
+
readAccessControlFilters: ResourcefulAccessControlFilter[];
|
|
26
|
+
writeAccessControlFilters: ResourcefulAccessControlFilter[];
|
|
27
|
+
nullable: boolean;
|
|
28
|
+
description?: string;
|
|
29
|
+
default?: any;
|
|
30
|
+
externalDocs?: ExternalDocumentationObject;
|
|
31
|
+
example?: string;
|
|
32
|
+
deprecated?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface ValidationScoper<BaseSchema extends AnySchema> {
|
|
35
|
+
(schema: BaseSchema): void;
|
|
36
|
+
}
|
|
37
|
+
export interface LocalResourcefulPropertyDefinition<PropertyBaseSchema extends AnySchema> extends ResourcefulPropertyDefinition {
|
|
38
|
+
type: ResourcefulDataType;
|
|
39
|
+
validationScopes?: ValidationScoper<PropertyBaseSchema>[];
|
|
40
|
+
}
|
|
41
|
+
export interface ResourcefulColumnDefinition<ColumnBaseSchema extends AnySchema> extends LocalResourcefulPropertyDefinition<ColumnBaseSchema> {
|
|
42
|
+
}
|
|
43
|
+
export interface ResourcefulComputedAccessorDefinition<ComputedSetterBaseSchema extends AnySchema> extends LocalResourcefulPropertyDefinition<ComputedSetterBaseSchema> {
|
|
44
|
+
writable: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface ResourcefulRelationshipDefinition<Model extends LucidModel = LucidModel> extends ResourcefulPropertyDefinition {
|
|
47
|
+
relatedModel: () => Model;
|
|
48
|
+
}
|
|
49
|
+
export type LucidBinaryValue = Uint8Array | Buffer;
|
|
50
|
+
export type LucidPlainObject = {
|
|
51
|
+
[key: string]: unknown;
|
|
52
|
+
};
|
|
53
|
+
export type ResourcefulPropertySchema = StringSchema | BinarySchema | NumberSchema | BooleanSchema | ObjectSchema | ArraySchema | DateSchema;
|
|
54
|
+
export interface ResourcefulModelMetaSchema {
|
|
55
|
+
name: string;
|
|
56
|
+
properties: {
|
|
57
|
+
[key: string]: ResourcefulModelPropertyMetaSchema;
|
|
58
|
+
};
|
|
59
|
+
description?: string;
|
|
60
|
+
externalDocs?: ExternalDocumentationObject;
|
|
61
|
+
example?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface ResourcefulModelColumnMetaSchema {
|
|
64
|
+
propertyKey: string;
|
|
65
|
+
definition: ResourcefulColumnDefinition<any>;
|
|
66
|
+
lucidDefinitions: ModelColumnOptions;
|
|
67
|
+
canRead: boolean;
|
|
68
|
+
canWrite: boolean;
|
|
69
|
+
kind: 'column';
|
|
70
|
+
validator: AnySchema;
|
|
71
|
+
}
|
|
72
|
+
export interface ResourcefulModelComputedAccessorMetaSchema {
|
|
73
|
+
propertyKey: string;
|
|
74
|
+
definition: ResourcefulComputedAccessorDefinition<any>;
|
|
75
|
+
lucidDefinitions: ComputedOptions;
|
|
76
|
+
canRead: boolean;
|
|
77
|
+
canWrite: boolean;
|
|
78
|
+
kind: 'computedAccessor';
|
|
79
|
+
validator: AnySchema;
|
|
80
|
+
}
|
|
81
|
+
export interface ResourcefulModelRelationshipMetaSchema<Model extends LucidModel = LucidModel> {
|
|
82
|
+
propertyKey: string;
|
|
83
|
+
definition: ResourcefulRelationshipDefinition;
|
|
84
|
+
lucidDefinitions: ReturnType<LucidModel['$getRelation']>;
|
|
85
|
+
canRead: boolean;
|
|
86
|
+
canWrite: boolean;
|
|
87
|
+
kind: 'relationship';
|
|
88
|
+
validator: AnySchema;
|
|
89
|
+
relatedModel: () => Model;
|
|
90
|
+
}
|
|
91
|
+
export type ResourcefulModelPropertyMetaSchema = ResourcefulModelColumnMetaSchema | ResourcefulModelComputedAccessorMetaSchema | ResourcefulModelRelationshipMetaSchema;
|
|
92
|
+
export type ResourcefulModelOpenApiSchema = OpenAPIV3.SchemaObject;
|
|
93
|
+
export type ResourcefulModelOpenApiRelatedSchema = OpenAPIV3.ReferenceObject;
|
|
94
|
+
export type ResourcefulModelSerializableAttributes<Model extends LucidRow> = Model['$columns'] extends undefined ? {
|
|
95
|
+
[P in keyof Model as P extends keyof LucidRow | 'serializeExtras' ? never : Model[P] extends Function | ModelRelationTypes ? never : Model extends {
|
|
96
|
+
$columnsDefinitions: Map<infer K, infer V>;
|
|
97
|
+
} ? P extends K ? V extends {
|
|
98
|
+
serializeAs: null;
|
|
99
|
+
} ? never : V extends {
|
|
100
|
+
serializeAs: infer S;
|
|
101
|
+
} ? S extends string ? S : P : P : P : P]: Model[P];
|
|
102
|
+
} : Model['$columns'];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ACLOperationsEnum, CRUDOperationsEnum } from './constants';
|
|
2
|
+
export declare const operationCRUDToACL: (operation: CRUDOperationsEnum) => ACLOperationsEnum | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a value is a string
|
|
5
|
+
*/
|
|
6
|
+
export declare const isString: (value: unknown) => value is string;
|
|
7
|
+
/**
|
|
8
|
+
* Checks if a value is a function
|
|
9
|
+
*/
|
|
10
|
+
export declare const isFunction: (value: unknown) => value is Function;
|
package/types.cjs
ADDED
package/types.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types utilized by @nhtio/lucid-resourceful
|
|
3
|
+
* @module @nhtio/lucid-resourceful/types
|
|
4
|
+
*/
|
|
5
|
+
export type { ResourcefulIndexResult, ResourcefulPayloadValidatorGetter, ResourcefulPayloadSchemaGetter, ResourcefulQueryScopeCallback, ResourcefulHooks, ResourcefulModel, AdvancedResourcefulMixinOptions, ResourcefulMixinOptions, ResourcefulScopeHooks, ResourcefulValidationHooks, ResourcefulMixinEventMap, ResourcefulErrorHandlerMethod, ResourcefulACLOperationType, } from './private/mixin';
|
|
6
|
+
export type * from './private/types';
|
|
7
|
+
export type { CallableNewable } from './private/data_types';
|
|
8
|
+
export type { BaseInterface, BaseClass, ResourcefulStringTypeOptions, ResourcefulDateTypeOptions, ResourcefulDateTimeTypeOptions, ResourcefulBinaryTypeOptions, ResourcefulNumberTypeOptions, ResourcefulIntegerTypeOptions, ResourcefulBigintTypeOptions, ResourcefulUnsignedIntegerTypeOptions, ResourcefulBooleanTypeOptions, ResourcefulObjectTypeOptions, ResourcefulArrayTypeOptions, ResourcefulDataType, } from './private/data_types';
|
|
9
|
+
export type { DateTime } from 'luxon';
|
|
10
|
+
export type { RelatedModelRelationOptions, HasManyThroughRelationOptions, DataTypeColumnOptions, DataTypeComputedOptions, DateColumnOptions, } from './private/decorators';
|
|
11
|
+
import type { AnySchema, StringSchema, BinarySchema, NumberSchema, BooleanSchema, ObjectSchema, ArraySchema, DateSchema } from './private/schema_types';
|
|
12
|
+
export type { SchemaInternals } from 'joi';
|
|
13
|
+
export type { AnySchema, StringSchema, BinarySchema, NumberSchema, BooleanSchema, ObjectSchema, ArraySchema, DateSchema, };
|
|
14
|
+
/**
|
|
15
|
+
* Union type of all available Joi schema types
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export type Schema = AnySchema | StringSchema | BinarySchema | NumberSchema | BooleanSchema | ObjectSchema | ArraySchema | DateSchema;
|
|
19
|
+
export type { LucidModel, ModelColumnOptions, ComputedOptions } from '@adonisjs/lucid/types/model';
|
|
20
|
+
export type { ValidationError } from 'joi';
|
|
21
|
+
export type { BaseModel } from '@adonisjs/lucid/orm';
|
|
22
|
+
export type { HttpContext } from '@adonisjs/core/http';
|
|
23
|
+
export type { ApplicationService } from '@adonisjs/core/types';
|
|
24
|
+
export type { EventMap, Key, Listener } from '@nhtio/tiny-typed-emitter';
|
|
25
|
+
export type { NormalizeConstructor } from '@adonisjs/core/types/helpers';
|
|
26
|
+
export type { ModelQueryBuilderContract } from '@adonisjs/lucid/types/model';
|
|
27
|
+
export type { OpenAPIV3 } from 'openapi-types';
|
|
28
|
+
export type { DatabaseQueryBuilderContract } from '@adonisjs/lucid/types/querybuilder';
|
package/types.mjs
ADDED
package/types.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { castValueAsString, castValueAsDate, castValueAsDateTime, castValueAsBinary, castValueAsNumber, castValueAsInteger, castValueAsBigint, castValueAsUnsignedInt, castValueAsBoolean, castValueAsObject, castValueAsArray, } from '../private/decorator_utils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { consumeString, consumeDate, consumeDateTime, consumeBinary, consumeNumber, consumeInteger, consumeBigint, consumeUnsignedint, consumeBoolean, consumeObject, consumeArray, } from '../private/decorator_utils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { prepareString, prepareDate, prepareDateTime, prepareBinary, prepareNumber, prepareInteger, prepareBigint, prepareUnsignedint, prepareBoolean, prepareObject, prepareArray, } from '../private/decorator_utils';
|
package/utils.cjs
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const decorator_utils = require("./decorator_utils-1yWqd_Gg.cjs");
|
|
4
|
+
const casters = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5
|
+
__proto__: null,
|
|
6
|
+
castValueAsArray: decorator_utils.castValueAsArray,
|
|
7
|
+
castValueAsBigint: decorator_utils.castValueAsBigint,
|
|
8
|
+
castValueAsBinary: decorator_utils.castValueAsBinary,
|
|
9
|
+
castValueAsBoolean: decorator_utils.castValueAsBoolean,
|
|
10
|
+
castValueAsDate: decorator_utils.castValueAsDate,
|
|
11
|
+
castValueAsDateTime: decorator_utils.castValueAsDateTime,
|
|
12
|
+
castValueAsInteger: decorator_utils.castValueAsInteger,
|
|
13
|
+
castValueAsNumber: decorator_utils.castValueAsNumber,
|
|
14
|
+
castValueAsObject: decorator_utils.castValueAsObject,
|
|
15
|
+
castValueAsString: decorator_utils.castValueAsString,
|
|
16
|
+
castValueAsUnsignedInt: decorator_utils.castValueAsUnsignedInt
|
|
17
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
18
|
+
const preparers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
19
|
+
__proto__: null,
|
|
20
|
+
prepareArray: decorator_utils.prepareArray,
|
|
21
|
+
prepareBigint: decorator_utils.prepareBigint,
|
|
22
|
+
prepareBinary: decorator_utils.prepareBinary,
|
|
23
|
+
prepareBoolean: decorator_utils.prepareBoolean,
|
|
24
|
+
prepareDate: decorator_utils.prepareDate,
|
|
25
|
+
prepareDateTime: decorator_utils.prepareDateTime,
|
|
26
|
+
prepareInteger: decorator_utils.prepareInteger,
|
|
27
|
+
prepareNumber: decorator_utils.prepareNumber,
|
|
28
|
+
prepareObject: decorator_utils.prepareObject,
|
|
29
|
+
prepareString: decorator_utils.prepareString,
|
|
30
|
+
prepareUnsignedint: decorator_utils.prepareUnsignedint
|
|
31
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
32
|
+
const consumers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
33
|
+
__proto__: null,
|
|
34
|
+
consumeArray: decorator_utils.consumeArray,
|
|
35
|
+
consumeBigint: decorator_utils.consumeBigint,
|
|
36
|
+
consumeBinary: decorator_utils.consumeBinary,
|
|
37
|
+
consumeBoolean: decorator_utils.consumeBoolean,
|
|
38
|
+
consumeDate: decorator_utils.consumeDate,
|
|
39
|
+
consumeDateTime: decorator_utils.consumeDateTime,
|
|
40
|
+
consumeInteger: decorator_utils.consumeInteger,
|
|
41
|
+
consumeNumber: decorator_utils.consumeNumber,
|
|
42
|
+
consumeObject: decorator_utils.consumeObject,
|
|
43
|
+
consumeString: decorator_utils.consumeString,
|
|
44
|
+
consumeUnsignedint: decorator_utils.consumeUnsignedint
|
|
45
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
46
|
+
exports.guards = decorator_utils.type_guards;
|
|
47
|
+
exports.casters = casters;
|
|
48
|
+
exports.consumers = consumers;
|
|
49
|
+
exports.preparers = preparers;
|
|
50
|
+
//# sourceMappingURL=utils.cjs.map
|
package/utils.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/utils.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers and utilities used by Lucid Resourceful
|
|
3
|
+
* @module @nhtio/lucid-resourceful/utils
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Utilities used to cast values to specific data types
|
|
7
|
+
*/
|
|
8
|
+
export * as casters from './utils/casters';
|
|
9
|
+
/**
|
|
10
|
+
* Type guards for Resourceful data types
|
|
11
|
+
*/
|
|
12
|
+
export * as guards from './private/type_guards';
|
|
13
|
+
/**
|
|
14
|
+
* Utilities used to prepare values before being inserted into the database
|
|
15
|
+
*/
|
|
16
|
+
export * as preparers from './utils/preparers';
|
|
17
|
+
/**
|
|
18
|
+
* Utilities used to consume values from the database for specific data types
|
|
19
|
+
*/
|
|
20
|
+
export * as consumers from './utils/consumers';
|
package/utils.mjs
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { c as castValueAsArray, a as castValueAsBigint, b as castValueAsBinary, d as castValueAsBoolean, e as castValueAsDate, f as castValueAsDateTime, g as castValueAsInteger, h as castValueAsNumber, i as castValueAsObject, j as castValueAsString, k as castValueAsUnsignedInt, p as prepareArray, l as prepareBigint, m as prepareBinary, n as prepareBoolean, o as prepareDate, q as prepareDateTime, r as prepareInteger, s as prepareNumber, t as prepareObject, u as prepareString, v as prepareUnsignedint, w as consumeArray, x as consumeBigint, y as consumeBinary, z as consumeBoolean, A as consumeDate, B as consumeDateTime, C as consumeInteger, D as consumeNumber, E as consumeObject, F as consumeString, G as consumeUnsignedint } from "./decorator_utils-BUuBwQYK.js";
|
|
2
|
+
import { H } from "./decorator_utils-BUuBwQYK.js";
|
|
3
|
+
const casters = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4
|
+
__proto__: null,
|
|
5
|
+
castValueAsArray,
|
|
6
|
+
castValueAsBigint,
|
|
7
|
+
castValueAsBinary,
|
|
8
|
+
castValueAsBoolean,
|
|
9
|
+
castValueAsDate,
|
|
10
|
+
castValueAsDateTime,
|
|
11
|
+
castValueAsInteger,
|
|
12
|
+
castValueAsNumber,
|
|
13
|
+
castValueAsObject,
|
|
14
|
+
castValueAsString,
|
|
15
|
+
castValueAsUnsignedInt
|
|
16
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
17
|
+
const preparers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
18
|
+
__proto__: null,
|
|
19
|
+
prepareArray,
|
|
20
|
+
prepareBigint,
|
|
21
|
+
prepareBinary,
|
|
22
|
+
prepareBoolean,
|
|
23
|
+
prepareDate,
|
|
24
|
+
prepareDateTime,
|
|
25
|
+
prepareInteger,
|
|
26
|
+
prepareNumber,
|
|
27
|
+
prepareObject,
|
|
28
|
+
prepareString,
|
|
29
|
+
prepareUnsignedint
|
|
30
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
31
|
+
const consumers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
32
|
+
__proto__: null,
|
|
33
|
+
consumeArray,
|
|
34
|
+
consumeBigint,
|
|
35
|
+
consumeBinary,
|
|
36
|
+
consumeBoolean,
|
|
37
|
+
consumeDate,
|
|
38
|
+
consumeDateTime,
|
|
39
|
+
consumeInteger,
|
|
40
|
+
consumeNumber,
|
|
41
|
+
consumeObject,
|
|
42
|
+
consumeString,
|
|
43
|
+
consumeUnsignedint
|
|
44
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
45
|
+
export {
|
|
46
|
+
casters,
|
|
47
|
+
consumers,
|
|
48
|
+
H as guards,
|
|
49
|
+
preparers
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=utils.mjs.map
|
package/utils.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|