@nhtio/lucid-resourceful 1.20260331.0 → 1.20260417.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/{context-B7PCydQE.js → context-xMXF4d-y.js} +2 -2
- package/{context-B7PCydQE.js.map → context-xMXF4d-y.js.map} +1 -1
- package/{decorator_utils-D19Egvlb.js → decorator_utils-CxElZOe6.js} +2 -2
- package/{decorator_utils-D19Egvlb.js.map → decorator_utils-CxElZOe6.js.map} +1 -1
- package/{definitions-CnmQ3iKe.js → definitions-CBCPzK9J.js} +2 -2
- package/{definitions-CnmQ3iKe.js.map → definitions-CBCPzK9J.js.map} +1 -1
- package/definitions.mjs +1 -1
- package/{errors-cyaA0CWp.js → errors-D39NvW3e.js} +5 -5
- package/{errors-cyaA0CWp.js.map → errors-D39NvW3e.js.map} +1 -1
- package/errors.mjs +5 -5
- package/{index-BVMxhd1X.js → index-DT5v8dyq.js} +523 -67
- package/{index-BVMxhd1X.js.map → index-DT5v8dyq.js.map} +1 -1
- package/{index-C7EvI6VB.cjs → index-DUZqURr9.cjs} +518 -62
- package/{index-C7EvI6VB.cjs.map → index-DUZqURr9.cjs.map} +1 -1
- package/index.cjs +1 -1
- package/index.mjs +3 -3
- package/integration/middlewares/odata_error.cjs +1 -1
- package/integration/middlewares/odata_error.mjs +1 -1
- package/integration/middlewares/resourceful_encoded_request.mjs +1 -1
- package/integration/middlewares/resourceful_error.mjs +1 -1
- package/integration/provider.cjs +1 -1
- package/integration/provider.mjs +1 -1
- package/odata/context.mjs +2 -2
- package/{odata_error_middleware-BhAl-hoO.cjs → odata_error_middleware-BqXuvgDD.cjs} +14 -1
- package/odata_error_middleware-BqXuvgDD.cjs.map +1 -0
- package/{odata_error_middleware-CthkDm1c.js → odata_error_middleware-CNWwZC0d.js} +15 -2
- package/odata_error_middleware-CNWwZC0d.js.map +1 -0
- package/package.json +6 -6
- package/private/odata_macro/controllers/resourceful_model_controller.d.ts +45 -3
- package/private/odata_macro/utils/http.d.ts +25 -0
- package/private/odata_macro/utils/odata.d.ts +2 -2
- package/{resourceful_error_middleware-CTgDPlGO.js → resourceful_error_middleware-CLedAAkX.js} +2 -2
- package/{resourceful_error_middleware-CTgDPlGO.js.map → resourceful_error_middleware-CLedAAkX.js.map} +1 -1
- package/router/context.mjs +1 -1
- package/router/utils.cjs +1 -1
- package/router/utils.mjs +1 -1
- package/router.cjs +1 -1
- package/router.mjs +1 -1
- package/utils.mjs +2 -2
- package/odata_error_middleware-BhAl-hoO.cjs.map +0 -1
- package/odata_error_middleware-CthkDm1c.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { k as E_NOT_IN_ODATA_CONTEXT } from "./errors-
|
|
1
|
+
import { k as E_NOT_IN_ODATA_CONTEXT } from "./errors-D39NvW3e.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
const ODataContext = new AsyncLocalStorage();
|
|
4
4
|
const useODataContext = async () => {
|
|
@@ -16,4 +16,4 @@ export {
|
|
|
16
16
|
ODataContext as O,
|
|
17
17
|
useODataContext as u
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=context-
|
|
19
|
+
//# sourceMappingURL=context-xMXF4d-y.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-
|
|
1
|
+
{"version":3,"file":"context-xMXF4d-y.js","sources":["../src/private/odata_macro/services/odata_context_service.ts","../src/odata/context.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks'\nimport type { ODataResponseFormat, ODataMetadataLevel } from '../utils/http'\n\nexport interface ResolvedODataContext {\n serviceBaseUrl: string\n serveAs: ODataResponseFormat\n metadataLevel: ODataMetadataLevel\n}\n\nexport interface ResourcefulODataContextResolver {\n (\n fallbackResponseFormat?: ODataResponseFormat,\n fallbackMetadataLevel?: ODataMetadataLevel\n ): Promise<ResolvedODataContext>\n}\n\nexport interface ResourcefulODataContextStore {\n resolver: ResourcefulODataContextResolver\n}\n\nexport const ODataContext = new AsyncLocalStorage<ResourcefulODataContextStore>()\n","/**\n * Utility which allows resolution of resourceful odata context.\n * @module @nhtio/lucid-resourceful/odata/context\n */\nimport { E_NOT_IN_ODATA_CONTEXT } from '@nhtio/lucid-resourceful/errors'\nimport { ODataContext } from '@/private/odata_macro/services/odata_context_service'\nimport type { ResolvedODataContext } from '@/private/odata_macro/services/odata_context_service'\n\nexport const useODataContext = async (): Promise<ResolvedODataContext> => {\n try {\n const store = ODataContext.getStore()\n if (!store || !('resolver' in store) || 'function' !== typeof store.resolver) {\n throw new E_NOT_IN_ODATA_CONTEXT()\n }\n return await store.resolver()\n } catch (err) {\n throw new E_NOT_IN_ODATA_CONTEXT(err)\n }\n}\n\nexport type { ResolvedODataContext }\n"],"names":[],"mappings":";;AAoBO,MAAM,eAAe,IAAI,kBAAA;ACZzB,MAAM,kBAAkB,YAA2C;AACxE,MAAI;AACF,UAAM,QAAQ,aAAa,SAAA;AAC3B,QAAI,CAAC,SAAS,EAAE,cAAc,UAAU,eAAe,OAAO,MAAM,UAAU;AAC5E,YAAM,IAAI,uBAAA;AAAA,IACZ;AACA,WAAO,MAAM,MAAM,SAAA;AAAA,EACrB,SAAS,KAAK;AACZ,UAAM,IAAI,uBAAuB,GAAG;AAAA,EACtC;AACF;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DateTime } from "luxon";
|
|
2
|
-
import { s as stripUndefinedValuesFromObject, i as isException, b as isJoiValidationError, c as isNotImplementedError, d as isStringContent, e as isVineValidationError, f as E_UNCASTABLE, g as E_INVALID_PREPARED_VALUE, h as E_INVALID_CONSUMED_VALUE, j as isString$1 } from "./errors-
|
|
2
|
+
import { s as stripUndefinedValuesFromObject, i as isException, b as isJoiValidationError, c as isNotImplementedError, d as isStringContent, e as isVineValidationError, f as E_UNCASTABLE, g as E_INVALID_PREPARED_VALUE, h as E_INVALID_CONSUMED_VALUE, j as isString$1 } from "./errors-D39NvW3e.js";
|
|
3
3
|
import { joi as validator } from "./joi.mjs";
|
|
4
4
|
import { i as isObject$1, a as isArray, b as isBigInt, c as isBigIntTypedArray, d as isError, e as isInstanceOf, f as isLucidBinaryValue, g as isLuxonDateTime, h as isLuxonDuration, j as isLuxonInterval, k as isLuxonSystemZone, l as isMap, m as isNegativeZero, n as isNumber, o as isPhoneObject, p as isPrimitive, q as isSet, r as isTypedArray, s as isUniterableObject } from "./type_guards-UkDoe__i-DxusUx_p.js";
|
|
5
5
|
import { R as ResourcefulStringTypeSchema, a as ResourcefulDateTypeSchema, b as ResourcefulDateTimeTypeSchema, c as ResourcefulBinaryTypeSchema, d as ResourcefulNumberTypeSchema, e as ResourcefulIntegerTypeSchema, f as ResourcefulBigintTypeSchema, g as ResourcefulUnsignedIntegerTypeSchema, h as ResourcefulBooleanTypeSchema, i as ResourcefulObjectTypeSchema, j as ResourcefulArrayTypeSchema } from "./data_type_schemas-I8EGtjRh.js";
|
|
@@ -815,4 +815,4 @@ export {
|
|
|
815
815
|
consumeBinary as y,
|
|
816
816
|
consumeBoolean as z
|
|
817
817
|
};
|
|
818
|
-
//# sourceMappingURL=decorator_utils-
|
|
818
|
+
//# sourceMappingURL=decorator_utils-CxElZOe6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator_utils-D19Egvlb.js","sources":["../src/private/type_guards.ts","../src/private/decorator_utils.ts"],"sourcesContent":["/*\n|--------------------------------------------------------------------------\n| Type Guards\n|--------------------------------------------------------------------------\n|\n| Utility functions that help determine the type of unknown values\n|\n*/\n\nimport { joi } from '@nhtio/lucid-resourceful/joi'\nimport { stripUndefinedValuesFromObject } from './utils'\nimport {\n isException,\n isJoiValidationError,\n isVineValidationError,\n isNotImplementedError,\n} from './router_macro/utils/errors'\nimport {\n isArray,\n isBigInt,\n isBigIntTypedArray,\n isError,\n isInstanceOf,\n isLucidBinaryValue,\n isLuxonDateTime,\n isLuxonDuration,\n isLuxonInterval,\n isLuxonSystemZone,\n isMap,\n isNegativeZero,\n isNumber,\n isObject,\n isPhoneObject,\n isPrimitive,\n isSet,\n isTypedArray,\n isUniterableObject,\n} from '@nhtio/encoder/type_guards'\nimport {\n ResourcefulStringTypeSchema,\n ResourcefulDateTypeSchema,\n ResourcefulDateTimeTypeSchema,\n ResourcefulBinaryTypeSchema,\n ResourcefulNumberTypeSchema,\n ResourcefulIntegerTypeSchema,\n ResourcefulBigintTypeSchema,\n ResourcefulUnsignedIntegerTypeSchema,\n ResourcefulBooleanTypeSchema,\n ResourcefulObjectTypeSchema,\n ResourcefulArrayTypeSchema,\n} from './data_type_schemas'\nimport type { OpenAPIV3 } from 'openapi-types'\nimport type { ResourcefulModel } from './mixin'\nimport type { ObjectSchema, AnySchema } from '@nhtio/lucid-resourceful/joi'\nimport type {\n ResourcefulStringType,\n ResourcefulDateType,\n ResourcefulDateTimeType,\n ResourcefulBinaryType,\n ResourcefulNumberType,\n ResourcefulIntegerType,\n ResourcefulBigintType,\n ResourcefulUnsignedIntegerType,\n ResourcefulBooleanType,\n ResourcefulObjectType,\n ResourcefulArrayType,\n} from '@nhtio/lucid-resourceful/definitions'\n\nexport {\n isArray,\n isBigInt,\n isBigIntTypedArray,\n isError,\n isInstanceOf,\n isLucidBinaryValue,\n isLuxonDateTime,\n isLuxonDuration,\n isLuxonInterval,\n isLuxonSystemZone,\n isMap,\n isNegativeZero,\n isNumber,\n isObject,\n isPhoneObject,\n isPrimitive,\n isSet,\n isTypedArray,\n isUniterableObject,\n isException,\n isJoiValidationError,\n isVineValidationError,\n isNotImplementedError,\n}\n\nconst isResourcefulModelCache = new Map<unknown, boolean>()\n\n/**\n * Type guard to check if a value is a ResourcefulModel\n * @param value - The value to check\n * @returns True if the value is a ResourcefulModel, false otherwise\n */\nexport const isResourcefulModel = (value: unknown): value is ResourcefulModel => {\n const cached = isResourcefulModelCache.get(value)\n if ('undefined' !== typeof cached) {\n return cached\n }\n if (!isObject(value) && !(typeof value === 'function')) return false\n\n // For class constructors (functions), check the properties directly on the constructor\n if (typeof value === 'function') {\n const returnable =\n '$resourcefulName' in value &&\n 'string' === typeof value.$resourcefulName &&\n '$resourcefulColumns' in value &&\n value.$resourcefulColumns instanceof Map &&\n '$resourcefulRelationships' in value &&\n value.$resourcefulRelationships instanceof Map &&\n '$resourcefulComputedAccessors' in value &&\n value.$resourcefulComputedAccessors instanceof Map\n isResourcefulModelCache.set(value, returnable)\n return returnable\n }\n\n // For instances, check the constructor of the instance\n /* istanbul ignore if -- @preserve */\n if ('constructor' in value) {\n // @ts-ignore\n const constructor = value.constructor\n /* istanbul ignore if -- @preserve */\n if (!constructor || typeof constructor !== 'function') {\n isResourcefulModelCache.set(value, false)\n return false\n }\n\n return isResourcefulModel(constructor) // Recursively check the constructor\n }\n\n /* istanbul ignore next -- @preserve */\n const proto = Object.getPrototypeOf(value)\n return isResourcefulModel(proto)\n}\n\nconst BaseDataTypeSchemaFactory = (name: string, type: string) => {\n return joi\n .object({\n type: joi.string().allow(type).required(),\n name: joi.string().allow(name).optional(),\n schema: joi\n .object({\n _cache: joi.required(),\n _flags: joi.object().unknown(true).required(),\n _ids: joi\n .object({\n _byId: joi.object().instance(Map).required(),\n _byKey: joi.object().instance(Map).required(),\n _schemaChain: joi.boolean().required(),\n })\n .unknown(true)\n .required(),\n _invalids: joi.required(),\n _preferences: joi.required(),\n _refs: joi.object().unknown(true).required(),\n _rules: joi.array().items(joi.any()).required(),\n _singleRules: joi.object().instance(Map).required(),\n _valids: joi.required(),\n $: joi.required(),\n $_root: joi.required(),\n $_super: joi.required(),\n $_temp: joi.required(),\n $_terms: joi.required(),\n ruleset: joi.func().required(),\n type: joi.string().required(),\n })\n .unknown(true)\n .optional(),\n })\n .unknown(true)\n}\n\nconst getDataTypeSchemaResults = (\n value: unknown,\n name: string,\n type: string,\n schema: ObjectSchema\n) => {\n if (!isObject(value)) return false\n if (value.type !== type) return false\n const base = BaseDataTypeSchemaFactory(name, type)\n const { error: errorFromSchema } = schema.validate(\n stripUndefinedValuesFromObject({\n ...value,\n type: undefined,\n name: undefined,\n schema: undefined,\n })\n )\n const { error: errorFromBase } = base.validate({\n type: value.type,\n name: value.name,\n schema: value.schema,\n })\n return 'undefined' === typeof errorFromSchema && 'undefined' === typeof errorFromBase\n}\n\nexport const isResourcefulStringType = (value: unknown): value is ResourcefulStringType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulStringType',\n 'string',\n ResourcefulStringTypeSchema()\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulDateType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulDateType, false otherwise\n */\nexport const isResourcefulDateType = (value: unknown): value is ResourcefulDateType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulDateType',\n 'string',\n ResourcefulDateTypeSchema().append({\n format: joi.string().valid('date').required(),\n })\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulDateTimeType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulDateTimeType, false otherwise\n */\nexport const isResourcefulDateTimeType = (value: unknown): value is ResourcefulDateTimeType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulDateTimeType',\n 'string',\n ResourcefulDateTimeTypeSchema().append({\n format: joi.string().valid('date-time').required(),\n })\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulBinaryType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulBinaryType, false otherwise\n */\nexport const isResourcefulBinaryType = (value: unknown): value is ResourcefulBinaryType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulBinaryType',\n 'string',\n ResourcefulBinaryTypeSchema().append({\n format: joi.string().valid('binary').required(),\n })\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulNumberType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulNumberType, false otherwise\n */\nexport const isResourcefulNumberType = (value: unknown): value is ResourcefulNumberType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulNumberType',\n 'number',\n ResourcefulNumberTypeSchema()\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulIntegerType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulIntegerType, false otherwise\n */\nexport const isResourcefulIntegerType = (value: unknown): value is ResourcefulIntegerType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulIntegerType',\n 'integer',\n ResourcefulIntegerTypeSchema().append({\n format: joi.string().valid('int32').required(),\n })\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulBigintType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulBigintType, false otherwise\n */\nexport const isResourcefulBigintType = (value: unknown): value is ResourcefulBigintType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulBigintType',\n 'integer',\n ResourcefulBigintTypeSchema().append({\n format: joi.string().valid('int64').required(),\n })\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulUnsignedIntegerType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulUnsignedIntegerType, false otherwise\n */\nexport const isResourcefulUnsignedIntegerType = (\n value: unknown\n): value is ResourcefulUnsignedIntegerType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulUnsignedIntegerType',\n 'integer',\n ResourcefulUnsignedIntegerTypeSchema()\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulBooleanType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulBooleanType, false otherwise\n */\nexport const isResourcefulBooleanType = (value: unknown): value is ResourcefulBooleanType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulBooleanType',\n 'boolean',\n ResourcefulBooleanTypeSchema()\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulObjectType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulObjectType, false otherwise\n */\nexport const isResourcefulObjectType = (value: unknown): value is ResourcefulObjectType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulObjectType',\n 'object',\n ResourcefulObjectTypeSchema()\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulArrayType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulArrayType, false otherwise\n */\nexport const isResourcefulArrayType = (value: unknown): value is ResourcefulArrayType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulArrayType',\n 'array',\n ResourcefulArrayTypeSchema()\n )\n}\n\nconst matchesSchema = (value: unknown, schema: AnySchema): boolean => {\n const { error } = schema.validate(value, {\n abortEarly: true,\n })\n return !error\n}\n\nconst stringSchema = joi.string().allow('').required()\nconst booleanSchema = joi.boolean().required()\nconst bigintSchema = joi\n .any()\n .custom((value, helpers) => {\n if (typeof value === 'bigint') {\n return value\n }\n return helpers.error('any.invalid')\n })\n .required()\nconst nullSchema = joi.any().valid(null).required()\nconst undefinedSchema = joi.any().custom((value, helpers) => {\n /* v8 ignore next 3 */\n if (typeof value === 'undefined') {\n return value\n }\n return helpers.error('any.invalid')\n})\n\nconst int8ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof Int8Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst uint8ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof Uint8Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst uint8ClampedArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof Uint8ClampedArray) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst int16ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof Int16Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst uint16ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof Uint16Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst int32ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof Int32Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst uint32ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof Uint32Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst float32ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof Float32Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst float64ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof Float64Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst bigInt64ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof BigInt64Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst bigUint64ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof BigUint64Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\n\nconst dateSchema = joi.any().custom((value, helpers) => {\n if (value instanceof Date) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst regExpSchema = joi.any().custom((value, helpers) => {\n if (value instanceof RegExp) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst arrayBufferSchema = joi.any().custom((value, helpers) => {\n if (value instanceof ArrayBuffer) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst dataViewSchema = joi.any().custom((value, helpers) => {\n if (value instanceof DataView) {\n return value\n }\n return helpers.error('any.invalid')\n})\n\nexport const isString = (value: unknown): value is string => {\n return matchesSchema(value, stringSchema)\n}\n\nexport const isBoolean = (value: unknown): value is boolean => {\n return matchesSchema(value, booleanSchema)\n}\n\nexport const isBigint = (value: unknown): value is bigint => {\n return matchesSchema(value, bigintSchema)\n}\n\nexport const isNull = (value: unknown): value is null => {\n return matchesSchema(value, nullSchema)\n}\n\nexport const isUndefined = (value: unknown): value is undefined => {\n return matchesSchema(value, undefinedSchema)\n}\n\nexport const isInt8Array = (value: unknown): value is Int8Array => {\n return matchesSchema(value, int8ArraySchema)\n}\n\nexport const isUint8Array = (value: unknown): value is Uint8Array => {\n return matchesSchema(value, uint8ArraySchema)\n}\n\nexport const isUint8ClampedArray = (value: unknown): value is Uint8ClampedArray => {\n return matchesSchema(value, uint8ClampedArraySchema)\n}\n\nexport const isInt16Array = (value: unknown): value is Int16Array => {\n return matchesSchema(value, int16ArraySchema)\n}\n\nexport const isUint16Array = (value: unknown): value is Uint16Array => {\n return matchesSchema(value, uint16ArraySchema)\n}\n\nexport const isInt32Array = (value: unknown): value is Int32Array => {\n return matchesSchema(value, int32ArraySchema)\n}\n\nexport const isUint32Array = (value: unknown): value is Uint32Array => {\n return matchesSchema(value, uint32ArraySchema)\n}\n\nexport const isFloat32Array = (value: unknown): value is Float32Array => {\n return matchesSchema(value, float32ArraySchema)\n}\n\nexport const isFloat64Array = (value: unknown): value is Float64Array => {\n return matchesSchema(value, float64ArraySchema)\n}\n\nexport const isBigInt64Array = (value: unknown): value is BigInt64Array => {\n return matchesSchema(value, bigInt64ArraySchema)\n}\n\nexport const isBigUint64Array = (value: unknown): value is BigUint64Array => {\n return matchesSchema(value, bigUint64ArraySchema)\n}\n\nexport const isDate = (value: unknown): value is Date => {\n return matchesSchema(value, dateSchema)\n}\n\nexport const isRegExp = (value: unknown): value is RegExp => {\n return matchesSchema(value, regExpSchema)\n}\n\nexport const isArrayBuffer = (value: unknown): value is ArrayBuffer => {\n return matchesSchema(value, arrayBufferSchema)\n}\n\nexport const isDataView = (value: unknown): value is DataView => {\n return matchesSchema(value, dataViewSchema)\n}\n\nexport const isNonArraySchemaObject = (\n value?: OpenAPIV3.SchemaObject | undefined\n): value is OpenAPIV3.NonArraySchemaObject => {\n return isObject(value) && value.type !== 'array'\n}\n\nexport { isStringContent } from './utils'\n","/*\n|--------------------------------------------------------------------------\n| Decorator Utilities\n|--------------------------------------------------------------------------\n|\n| Utility functions for Resourceful decorators. These functions help to\n| ensure that information sent TO the database and information retrieved\n| FROM the database are the expected shapes and types.\n|\n*/\nimport { DateTime } from 'luxon'\nimport { isString } from '@/private/utils'\nimport { isLuxonDateTime, isLucidBinaryValue, isObject, isArray } from './type_guards'\nimport {\n E_INVALID_PREPARED_VALUE,\n E_INVALID_CONSUMED_VALUE,\n E_UNCASTABLE,\n} from '@nhtio/lucid-resourceful/errors'\nimport type { LucidBinaryValue, LucidPlainObject } from '@nhtio/lucid-resourceful/types'\n\n/**\n * Casts an unknown value to a string\n * @param value - The value to cast\n * @returns The value as a string\n * @throws E_UNCASTABLE when the value cannot be cast to a string\n */\nexport const castValueAsString = (value: unknown): string => {\n if ('string' === typeof value) return value\n if ('number' === typeof value) return value.toString()\n throw new E_UNCASTABLE(['String'])\n}\n/**\n * Casts an unknown value to a Luxon DateTime with enhanced string parsing\n * @param value - The value to cast (string, number, Date, or DateTime)\n * @returns The value as a Luxon DateTime\n * @throws E_UNCASTABLE when the value cannot be cast to a DateTime\n * @remarks For string values, attempts SQL format parsing first, then falls back to ISO format parsing\n */\nexport const castValueAsDate = (value: unknown): DateTime => {\n switch (typeof value) {\n case 'string': {\n const ret = DateTime.fromSQL(value)\n if (!ret.isValid) {\n const fromIso = DateTime.fromISO(value)\n if (fromIso.isValid) return fromIso\n throw new E_UNCASTABLE(['Date'])\n }\n return ret\n }\n case 'number': {\n let ret = DateTime.fromSeconds(value)\n if (!ret.isValid) {\n throw new E_UNCASTABLE(['Date'])\n }\n if (ret.year > 9999 || ret.year < 0) {\n ret = DateTime.fromMillis(value)\n }\n return ret\n }\n case 'object': {\n if (isLuxonDateTime(value)) {\n return value\n }\n if (value instanceof Date) {\n const ret = DateTime.fromJSDate(value)\n if (!ret.isValid) {\n throw new E_UNCASTABLE(['Date'])\n }\n return ret\n }\n throw new E_UNCASTABLE(['Date'])\n }\n default: {\n throw new E_UNCASTABLE(['Date'])\n }\n }\n}\n/**\n * Casts an unknown value to a Luxon DateTime with enhanced error handling and string parsing\n * @param value - The value to cast (string, number, Date, or DateTime)\n * @returns The value as a Luxon DateTime\n * @throws E_UNCASTABLE when the value cannot be cast to a DateTime\n * @remarks For string values, attempts SQL format parsing first, then falls back to ISO format parsing\n */\nexport const castValueAsDateTime = (value: unknown): DateTime => {\n try {\n return castValueAsDate(value)\n } catch {\n throw new E_UNCASTABLE(['DateTime'])\n }\n}\n/**\n * Casts an unknown value to a Uint8Array (binary data)\n * @param value - The value to cast\n * @returns The value as a Uint8Array\n * @throws E_UNCASTABLE when the value cannot be cast to binary data\n */\nexport const castValueAsBinary = (value: unknown): Uint8Array => {\n if (isLucidBinaryValue(value)) return value\n throw new E_UNCASTABLE(['Binary'])\n}\n/**\n * Casts an unknown value to a number\n * @param value - The value to cast\n * @returns The value as a number\n * @throws E_UNCASTABLE when the value cannot be cast to a number\n */\nexport const castValueAsNumber = (value: unknown): number => {\n if ('number' === typeof value) return value\n if ('string' === typeof value) {\n const parsed = Number(value)\n if (Number.isNaN(parsed)) {\n throw new E_UNCASTABLE(['Number'])\n }\n return parsed\n }\n throw new E_UNCASTABLE(['Number'])\n}\n/**\n * Casts an unknown value to an integer\n * @param value - The value to cast\n * @returns The value as an integer (truncated if necessary)\n * @throws E_UNCASTABLE when the value cannot be cast to an integer\n */\nexport const castValueAsInteger = (value: unknown): number => {\n const num = castValueAsNumber(value)\n return Math.trunc(num)\n}\n/**\n * Casts an unknown value to a bigint\n * @param value - The value to cast\n * @returns The value as a bigint\n * @throws E_UNCASTABLE when the value cannot be cast to a bigint\n */\nexport const castValueAsBigint = (value: unknown): bigint => {\n try {\n if (typeof value === 'bigint') return value\n const num = castValueAsNumber(value)\n return BigInt(num)\n } catch {\n throw new E_UNCASTABLE(['Bigint'])\n }\n}\n/**\n * Casts an unknown value to an unsigned integer\n * @param value - The value to cast\n * @returns The value as an unsigned integer (32-bit)\n * @throws E_UNCASTABLE when the value cannot be cast to an unsigned integer\n */\nexport const castValueAsUnsignedInt = (value: unknown): number => {\n try {\n const num = typeof value === 'bigint' ? Number(value) : castValueAsNumber(value)\n if (!Number.isFinite(num) || Number.isNaN(num)) {\n throw new E_UNCASTABLE(['Unsignedint'])\n }\n return num >>> 0\n } catch {\n throw new E_UNCASTABLE(['Unsignedint'])\n }\n}\n/**\n * Casts an unknown value to a boolean\n * @param value - The value to cast\n * @returns The value as a boolean\n * @throws E_UNCASTABLE when the value cannot be cast to a boolean\n */\nexport const castValueAsBoolean = (value: unknown): boolean => {\n if ('boolean' === typeof value) return value\n if ('string' === typeof value) {\n const lower = value.toLowerCase()\n if (['true', '1'].includes(lower)) return true\n if (['false', '0'].includes(lower)) return false\n throw new E_UNCASTABLE(['Boolean'])\n }\n if ('number' === typeof value) {\n if (value === 0) return false\n if (value === 1) return true\n throw new E_UNCASTABLE(['Boolean'])\n }\n throw new E_UNCASTABLE(['Boolean'])\n}\n/**\n * Casts an unknown value to a plain object\n * @param value - The value to cast\n * @returns The value as a LucidPlainObject\n * @throws E_UNCASTABLE when the value cannot be cast to an object\n */\nexport const castValueAsObject = (value: unknown): LucidPlainObject => {\n if (isObject(value)) return value\n throw new E_UNCASTABLE(['Object'])\n}\n/**\n * Casts an unknown value to an array\n * @param value - The value to cast\n * @returns The value as an array of unknown elements\n * @throws E_UNCASTABLE when the value cannot be cast to an array\n */\nexport const castValueAsArray = (value: unknown): Array<unknown> => {\n if (isArray(value)) return value\n throw new E_UNCASTABLE(['Array'])\n}\n\n/**\n * Prepares a string value for database storage with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared string value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n */\nexport function prepareString(key: string, value: unknown, nullable: true): string | null\nexport function prepareString(key: string, value: unknown, nullable?: false): string\nexport function prepareString(\n key: string,\n value: unknown,\n nullable: boolean = false\n): string | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsString(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'String'])\n }\n}\n/**\n * Prepares a date value for database storage with nullable support and enhanced string parsing\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared DateTime value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n * @remarks For string values, attempts SQL format parsing first, then falls back to ISO format parsing\n */\nexport function prepareDate(key: string, value: unknown, nullable: true): Date | null\nexport function prepareDate(key: string, value: unknown, nullable?: false): Date\nexport function prepareDate(key: string, value: unknown, nullable: boolean = false): Date | null {\n if (value === null && nullable === true) return null\n try {\n const dto = castValueAsDate(value)\n return dto.toJSDate()\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'Date'])\n }\n}\n/**\n * Prepares a datetime value for database storage with nullable support and enhanced string parsing\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared DateTime value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n * @remarks For string values, attempts SQL format parsing first, then falls back to ISO format parsing\n */\nexport function prepareDateTime(key: string, value: unknown, nullable: true): Date | null\nexport function prepareDateTime(key: string, value: unknown, nullable?: false): Date\nexport function prepareDateTime(\n key: string,\n value: unknown,\n nullable: boolean = false\n): Date | null {\n if (value === null && nullable === true) return null\n try {\n const dto = castValueAsDateTime(value)\n return dto.toJSDate()\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'DateTime'])\n }\n}\n/**\n * Prepares a binary value for database storage with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared binary value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n */\nexport function prepareBinary(key: string, value: unknown, nullable: true): LucidBinaryValue | null\nexport function prepareBinary(key: string, value: unknown, nullable?: false): LucidBinaryValue\nexport function prepareBinary(\n key: string,\n value: unknown,\n nullable: boolean = false\n): LucidBinaryValue | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsBinary(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'Binary'])\n }\n}\n/**\n * Prepares a number value for database storage with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared number value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n */\nexport function prepareNumber(key: string, value: unknown, nullable: true): number | null\nexport function prepareNumber(key: string, value: unknown, nullable?: false): number\nexport function prepareNumber(\n key: string,\n value: unknown,\n nullable: boolean = false\n): number | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsNumber(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'Number'])\n }\n}\n/**\n * Prepares an integer value for database storage with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared integer value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n */\nexport function prepareInteger(key: string, value: unknown, nullable: true): number | null\nexport function prepareInteger(key: string, value: unknown, nullable?: false): number\nexport function prepareInteger(\n key: string,\n value: unknown,\n nullable: boolean = false\n): number | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsInteger(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'Integer'])\n }\n}\n/**\n * Prepares a bigint value for database storage with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared bigint value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n */\nexport function prepareBigint(key: string, value: unknown, nullable: true): bigint | null\nexport function prepareBigint(key: string, value: unknown, nullable?: false): bigint\nexport function prepareBigint(\n key: string,\n value: unknown,\n nullable: boolean = false\n): bigint | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsBigint(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'Bigint'])\n }\n}\n/**\n * Prepares an unsigned integer value for database storage with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared unsigned integer value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n */\nexport function prepareUnsignedint(key: string, value: unknown, nullable: true): number | null\nexport function prepareUnsignedint(key: string, value: unknown, nullable?: false): number\nexport function prepareUnsignedint(\n key: string,\n value: unknown,\n nullable: boolean = false\n): number | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsUnsignedInt(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'Unsignedint'])\n }\n}\n/**\n * Prepares a boolean value for database storage with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared boolean value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n */\nexport function prepareBoolean(key: string, value: unknown, nullable: true): boolean | null\nexport function prepareBoolean(key: string, value: unknown, nullable?: false): boolean\nexport function prepareBoolean(\n key: string,\n value: unknown,\n nullable: boolean = false\n): boolean | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsBoolean(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'Boolean'])\n }\n}\n/**\n * Prepares an object value for database storage with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared object value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n */\nexport function prepareObject(key: string, value: unknown, nullable: true): LucidPlainObject | null\nexport function prepareObject(key: string, value: unknown, nullable?: false): LucidPlainObject\nexport function prepareObject(\n key: string,\n value: unknown,\n nullable: boolean = false\n): LucidPlainObject | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsObject(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'Object'])\n }\n}\n/**\n * Prepares an array value for database storage with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared array value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n */\nexport function prepareArray(key: string, value: unknown, nullable: true): Array<unknown> | null\nexport function prepareArray(key: string, value: unknown, nullable?: false): Array<unknown>\nexport function prepareArray(\n key: string,\n value: unknown,\n nullable: boolean = false\n): Array<unknown> | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsArray(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'Array'])\n }\n}\n\n/**\n * Consumes a string value from database results with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed string value or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n */\nexport function consumeString(key: string, value: unknown, nullable: true): string | null\nexport function consumeString(key: string, value: unknown, nullable?: false): string\nexport function consumeString(\n key: string,\n value: unknown,\n nullable: boolean = false\n): string | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsString(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'String'])\n }\n}\n/**\n * Consumes a date value from database results with nullable support and enhanced string parsing\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed DateTime value or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n * @remarks For string values, attempts SQL format parsing first, then falls back to ISO format parsing\n */\nexport function consumeDate(key: string, value: unknown, nullable: true): DateTime | null\nexport function consumeDate(key: string, value: unknown, nullable?: false): DateTime\nexport function consumeDate(\n key: string,\n value: unknown,\n nullable: boolean = false\n): DateTime | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsDate(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'Date'])\n }\n}\n/**\n * Consumes a datetime value from database results with nullable support and enhanced string parsing\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed DateTime value or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n * @remarks For string values, attempts SQL format parsing first, then falls back to ISO format parsing\n */\nexport function consumeDateTime(key: string, value: unknown, nullable: true): DateTime | null\nexport function consumeDateTime(key: string, value: unknown, nullable?: false): DateTime\nexport function consumeDateTime(\n key: string,\n value: unknown,\n nullable: boolean = false\n): DateTime | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsDateTime(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'DateTime'])\n }\n}\n/**\n * Consumes a binary value from database results with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed LucidBinaryValue or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n */\nexport function consumeBinary(key: string, value: unknown, nullable: true): LucidBinaryValue | null\nexport function consumeBinary(key: string, value: unknown, nullable?: false): LucidBinaryValue\nexport function consumeBinary(\n key: string,\n value: unknown,\n nullable: boolean = false\n): LucidBinaryValue | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsBinary(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'Binary'])\n }\n}\n/**\n * Consumes a number value from database results with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed number value or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n */\nexport function consumeNumber(key: string, value: unknown, nullable: true): number | null\nexport function consumeNumber(key: string, value: unknown, nullable?: false): number\nexport function consumeNumber(\n key: string,\n value: unknown,\n nullable: boolean = false\n): number | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsNumber(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'Number'])\n }\n}\n/**\n * Consumes an integer value from database results with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed integer value or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n */\nexport function consumeInteger(key: string, value: unknown, nullable: true): number | null\nexport function consumeInteger(key: string, value: unknown, nullable?: false): number\nexport function consumeInteger(\n key: string,\n value: unknown,\n nullable: boolean = false\n): number | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsInteger(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'Integer'])\n }\n}\n/**\n * Consumes a bigint value from database results with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed bigint value or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n */\nexport function consumeBigint(key: string, value: unknown, nullable: true): bigint | null\nexport function consumeBigint(key: string, value: unknown, nullable?: false): bigint\nexport function consumeBigint(\n key: string,\n value: unknown,\n nullable: boolean = false\n): bigint | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsBigint(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'Bigint'])\n }\n}\n/**\n * Consumes an unsigned integer value from database results with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed unsigned integer value or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n */\nexport function consumeUnsignedint(key: string, value: unknown, nullable: true): number | null\nexport function consumeUnsignedint(key: string, value: unknown, nullable?: false): number\nexport function consumeUnsignedint(\n key: string,\n value: unknown,\n nullable: boolean = false\n): number | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsUnsignedInt(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'Unsignedint'])\n }\n}\n/**\n * Consumes a boolean value from database results with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed boolean value or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n */\nexport function consumeBoolean(key: string, value: unknown, nullable: true): boolean | null\nexport function consumeBoolean(key: string, value: unknown, nullable?: false): boolean\nexport function consumeBoolean(\n key: string,\n value: unknown,\n nullable: boolean = false\n): boolean | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsBoolean(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'Boolean'])\n }\n}\n/**\n * Consumes an object value from database results with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed LucidPlainObject or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n */\nexport function consumeObject(key: string, value: unknown, nullable: true): LucidPlainObject | null\nexport function consumeObject(key: string, value: unknown, nullable?: false): LucidPlainObject\nexport function consumeObject(\n key: string,\n value: unknown,\n nullable: boolean = false\n): LucidPlainObject | null {\n if (value === null && nullable === true) return null\n try {\n if (isString(value)) {\n value = JSON.parse(value)\n }\n\n return castValueAsObject(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'Object'])\n }\n}\n/**\n * Consumes an array value from database results with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed array value or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n */\nexport function consumeArray(key: string, value: unknown, nullable: true): Array<unknown> | null\nexport function consumeArray(key: string, value: unknown, nullable?: false): Array<unknown>\nexport function consumeArray(\n key: string,\n value: unknown,\n nullable: boolean = false\n): Array<unknown> | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsArray(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'Array'])\n }\n}\n"],"names":["isObject","joi","isString"],"mappings":";;;;;AA8FA,MAAM,8CAA8B,IAAA;AAO7B,MAAM,qBAAqB,CAAC,UAA8C;AAC/E,QAAM,SAAS,wBAAwB,IAAI,KAAK;AAChD,M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,WAAO,iBAAiB,KAAK;AAAA,EAC/B,QAAQ;AACN,QAAI,SAAS,UAAU;AACrB,aAAO;AAAA,IACT;AACA,UAAM,IAAI,yBAAyB,CAAC,KAAK,OAAO,OAAO,CAAC;AAAA,EAC1D;AACF;"}
|
|
1
|
+
{"version":3,"file":"decorator_utils-CxElZOe6.js","sources":["../src/private/type_guards.ts","../src/private/decorator_utils.ts"],"sourcesContent":["/*\n|--------------------------------------------------------------------------\n| Type Guards\n|--------------------------------------------------------------------------\n|\n| Utility functions that help determine the type of unknown values\n|\n*/\n\nimport { joi } from '@nhtio/lucid-resourceful/joi'\nimport { stripUndefinedValuesFromObject } from './utils'\nimport {\n isException,\n isJoiValidationError,\n isVineValidationError,\n isNotImplementedError,\n} from './router_macro/utils/errors'\nimport {\n isArray,\n isBigInt,\n isBigIntTypedArray,\n isError,\n isInstanceOf,\n isLucidBinaryValue,\n isLuxonDateTime,\n isLuxonDuration,\n isLuxonInterval,\n isLuxonSystemZone,\n isMap,\n isNegativeZero,\n isNumber,\n isObject,\n isPhoneObject,\n isPrimitive,\n isSet,\n isTypedArray,\n isUniterableObject,\n} from '@nhtio/encoder/type_guards'\nimport {\n ResourcefulStringTypeSchema,\n ResourcefulDateTypeSchema,\n ResourcefulDateTimeTypeSchema,\n ResourcefulBinaryTypeSchema,\n ResourcefulNumberTypeSchema,\n ResourcefulIntegerTypeSchema,\n ResourcefulBigintTypeSchema,\n ResourcefulUnsignedIntegerTypeSchema,\n ResourcefulBooleanTypeSchema,\n ResourcefulObjectTypeSchema,\n ResourcefulArrayTypeSchema,\n} from './data_type_schemas'\nimport type { OpenAPIV3 } from 'openapi-types'\nimport type { ResourcefulModel } from './mixin'\nimport type { ObjectSchema, AnySchema } from '@nhtio/lucid-resourceful/joi'\nimport type {\n ResourcefulStringType,\n ResourcefulDateType,\n ResourcefulDateTimeType,\n ResourcefulBinaryType,\n ResourcefulNumberType,\n ResourcefulIntegerType,\n ResourcefulBigintType,\n ResourcefulUnsignedIntegerType,\n ResourcefulBooleanType,\n ResourcefulObjectType,\n ResourcefulArrayType,\n} from '@nhtio/lucid-resourceful/definitions'\n\nexport {\n isArray,\n isBigInt,\n isBigIntTypedArray,\n isError,\n isInstanceOf,\n isLucidBinaryValue,\n isLuxonDateTime,\n isLuxonDuration,\n isLuxonInterval,\n isLuxonSystemZone,\n isMap,\n isNegativeZero,\n isNumber,\n isObject,\n isPhoneObject,\n isPrimitive,\n isSet,\n isTypedArray,\n isUniterableObject,\n isException,\n isJoiValidationError,\n isVineValidationError,\n isNotImplementedError,\n}\n\nconst isResourcefulModelCache = new Map<unknown, boolean>()\n\n/**\n * Type guard to check if a value is a ResourcefulModel\n * @param value - The value to check\n * @returns True if the value is a ResourcefulModel, false otherwise\n */\nexport const isResourcefulModel = (value: unknown): value is ResourcefulModel => {\n const cached = isResourcefulModelCache.get(value)\n if ('undefined' !== typeof cached) {\n return cached\n }\n if (!isObject(value) && !(typeof value === 'function')) return false\n\n // For class constructors (functions), check the properties directly on the constructor\n if (typeof value === 'function') {\n const returnable =\n '$resourcefulName' in value &&\n 'string' === typeof value.$resourcefulName &&\n '$resourcefulColumns' in value &&\n value.$resourcefulColumns instanceof Map &&\n '$resourcefulRelationships' in value &&\n value.$resourcefulRelationships instanceof Map &&\n '$resourcefulComputedAccessors' in value &&\n value.$resourcefulComputedAccessors instanceof Map\n isResourcefulModelCache.set(value, returnable)\n return returnable\n }\n\n // For instances, check the constructor of the instance\n /* istanbul ignore if -- @preserve */\n if ('constructor' in value) {\n // @ts-ignore\n const constructor = value.constructor\n /* istanbul ignore if -- @preserve */\n if (!constructor || typeof constructor !== 'function') {\n isResourcefulModelCache.set(value, false)\n return false\n }\n\n return isResourcefulModel(constructor) // Recursively check the constructor\n }\n\n /* istanbul ignore next -- @preserve */\n const proto = Object.getPrototypeOf(value)\n return isResourcefulModel(proto)\n}\n\nconst BaseDataTypeSchemaFactory = (name: string, type: string) => {\n return joi\n .object({\n type: joi.string().allow(type).required(),\n name: joi.string().allow(name).optional(),\n schema: joi\n .object({\n _cache: joi.required(),\n _flags: joi.object().unknown(true).required(),\n _ids: joi\n .object({\n _byId: joi.object().instance(Map).required(),\n _byKey: joi.object().instance(Map).required(),\n _schemaChain: joi.boolean().required(),\n })\n .unknown(true)\n .required(),\n _invalids: joi.required(),\n _preferences: joi.required(),\n _refs: joi.object().unknown(true).required(),\n _rules: joi.array().items(joi.any()).required(),\n _singleRules: joi.object().instance(Map).required(),\n _valids: joi.required(),\n $: joi.required(),\n $_root: joi.required(),\n $_super: joi.required(),\n $_temp: joi.required(),\n $_terms: joi.required(),\n ruleset: joi.func().required(),\n type: joi.string().required(),\n })\n .unknown(true)\n .optional(),\n })\n .unknown(true)\n}\n\nconst getDataTypeSchemaResults = (\n value: unknown,\n name: string,\n type: string,\n schema: ObjectSchema\n) => {\n if (!isObject(value)) return false\n if (value.type !== type) return false\n const base = BaseDataTypeSchemaFactory(name, type)\n const { error: errorFromSchema } = schema.validate(\n stripUndefinedValuesFromObject({\n ...value,\n type: undefined,\n name: undefined,\n schema: undefined,\n })\n )\n const { error: errorFromBase } = base.validate({\n type: value.type,\n name: value.name,\n schema: value.schema,\n })\n return 'undefined' === typeof errorFromSchema && 'undefined' === typeof errorFromBase\n}\n\nexport const isResourcefulStringType = (value: unknown): value is ResourcefulStringType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulStringType',\n 'string',\n ResourcefulStringTypeSchema()\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulDateType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulDateType, false otherwise\n */\nexport const isResourcefulDateType = (value: unknown): value is ResourcefulDateType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulDateType',\n 'string',\n ResourcefulDateTypeSchema().append({\n format: joi.string().valid('date').required(),\n })\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulDateTimeType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulDateTimeType, false otherwise\n */\nexport const isResourcefulDateTimeType = (value: unknown): value is ResourcefulDateTimeType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulDateTimeType',\n 'string',\n ResourcefulDateTimeTypeSchema().append({\n format: joi.string().valid('date-time').required(),\n })\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulBinaryType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulBinaryType, false otherwise\n */\nexport const isResourcefulBinaryType = (value: unknown): value is ResourcefulBinaryType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulBinaryType',\n 'string',\n ResourcefulBinaryTypeSchema().append({\n format: joi.string().valid('binary').required(),\n })\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulNumberType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulNumberType, false otherwise\n */\nexport const isResourcefulNumberType = (value: unknown): value is ResourcefulNumberType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulNumberType',\n 'number',\n ResourcefulNumberTypeSchema()\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulIntegerType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulIntegerType, false otherwise\n */\nexport const isResourcefulIntegerType = (value: unknown): value is ResourcefulIntegerType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulIntegerType',\n 'integer',\n ResourcefulIntegerTypeSchema().append({\n format: joi.string().valid('int32').required(),\n })\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulBigintType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulBigintType, false otherwise\n */\nexport const isResourcefulBigintType = (value: unknown): value is ResourcefulBigintType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulBigintType',\n 'integer',\n ResourcefulBigintTypeSchema().append({\n format: joi.string().valid('int64').required(),\n })\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulUnsignedIntegerType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulUnsignedIntegerType, false otherwise\n */\nexport const isResourcefulUnsignedIntegerType = (\n value: unknown\n): value is ResourcefulUnsignedIntegerType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulUnsignedIntegerType',\n 'integer',\n ResourcefulUnsignedIntegerTypeSchema()\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulBooleanType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulBooleanType, false otherwise\n */\nexport const isResourcefulBooleanType = (value: unknown): value is ResourcefulBooleanType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulBooleanType',\n 'boolean',\n ResourcefulBooleanTypeSchema()\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulObjectType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulObjectType, false otherwise\n */\nexport const isResourcefulObjectType = (value: unknown): value is ResourcefulObjectType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulObjectType',\n 'object',\n ResourcefulObjectTypeSchema()\n )\n}\n\n/**\n * Type guard to check if a value is a ResourcefulArrayType\n * @param value - The value to check\n * @returns True if the value is a ResourcefulArrayType, false otherwise\n */\nexport const isResourcefulArrayType = (value: unknown): value is ResourcefulArrayType => {\n return getDataTypeSchemaResults(\n value,\n 'ResourcefulArrayType',\n 'array',\n ResourcefulArrayTypeSchema()\n )\n}\n\nconst matchesSchema = (value: unknown, schema: AnySchema): boolean => {\n const { error } = schema.validate(value, {\n abortEarly: true,\n })\n return !error\n}\n\nconst stringSchema = joi.string().allow('').required()\nconst booleanSchema = joi.boolean().required()\nconst bigintSchema = joi\n .any()\n .custom((value, helpers) => {\n if (typeof value === 'bigint') {\n return value\n }\n return helpers.error('any.invalid')\n })\n .required()\nconst nullSchema = joi.any().valid(null).required()\nconst undefinedSchema = joi.any().custom((value, helpers) => {\n /* v8 ignore next 3 */\n if (typeof value === 'undefined') {\n return value\n }\n return helpers.error('any.invalid')\n})\n\nconst int8ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof Int8Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst uint8ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof Uint8Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst uint8ClampedArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof Uint8ClampedArray) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst int16ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof Int16Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst uint16ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof Uint16Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst int32ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof Int32Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst uint32ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof Uint32Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst float32ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof Float32Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst float64ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof Float64Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst bigInt64ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof BigInt64Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst bigUint64ArraySchema = joi.any().custom((value, helpers) => {\n if (value instanceof BigUint64Array) {\n return value\n }\n return helpers.error('any.invalid')\n})\n\nconst dateSchema = joi.any().custom((value, helpers) => {\n if (value instanceof Date) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst regExpSchema = joi.any().custom((value, helpers) => {\n if (value instanceof RegExp) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst arrayBufferSchema = joi.any().custom((value, helpers) => {\n if (value instanceof ArrayBuffer) {\n return value\n }\n return helpers.error('any.invalid')\n})\nconst dataViewSchema = joi.any().custom((value, helpers) => {\n if (value instanceof DataView) {\n return value\n }\n return helpers.error('any.invalid')\n})\n\nexport const isString = (value: unknown): value is string => {\n return matchesSchema(value, stringSchema)\n}\n\nexport const isBoolean = (value: unknown): value is boolean => {\n return matchesSchema(value, booleanSchema)\n}\n\nexport const isBigint = (value: unknown): value is bigint => {\n return matchesSchema(value, bigintSchema)\n}\n\nexport const isNull = (value: unknown): value is null => {\n return matchesSchema(value, nullSchema)\n}\n\nexport const isUndefined = (value: unknown): value is undefined => {\n return matchesSchema(value, undefinedSchema)\n}\n\nexport const isInt8Array = (value: unknown): value is Int8Array => {\n return matchesSchema(value, int8ArraySchema)\n}\n\nexport const isUint8Array = (value: unknown): value is Uint8Array => {\n return matchesSchema(value, uint8ArraySchema)\n}\n\nexport const isUint8ClampedArray = (value: unknown): value is Uint8ClampedArray => {\n return matchesSchema(value, uint8ClampedArraySchema)\n}\n\nexport const isInt16Array = (value: unknown): value is Int16Array => {\n return matchesSchema(value, int16ArraySchema)\n}\n\nexport const isUint16Array = (value: unknown): value is Uint16Array => {\n return matchesSchema(value, uint16ArraySchema)\n}\n\nexport const isInt32Array = (value: unknown): value is Int32Array => {\n return matchesSchema(value, int32ArraySchema)\n}\n\nexport const isUint32Array = (value: unknown): value is Uint32Array => {\n return matchesSchema(value, uint32ArraySchema)\n}\n\nexport const isFloat32Array = (value: unknown): value is Float32Array => {\n return matchesSchema(value, float32ArraySchema)\n}\n\nexport const isFloat64Array = (value: unknown): value is Float64Array => {\n return matchesSchema(value, float64ArraySchema)\n}\n\nexport const isBigInt64Array = (value: unknown): value is BigInt64Array => {\n return matchesSchema(value, bigInt64ArraySchema)\n}\n\nexport const isBigUint64Array = (value: unknown): value is BigUint64Array => {\n return matchesSchema(value, bigUint64ArraySchema)\n}\n\nexport const isDate = (value: unknown): value is Date => {\n return matchesSchema(value, dateSchema)\n}\n\nexport const isRegExp = (value: unknown): value is RegExp => {\n return matchesSchema(value, regExpSchema)\n}\n\nexport const isArrayBuffer = (value: unknown): value is ArrayBuffer => {\n return matchesSchema(value, arrayBufferSchema)\n}\n\nexport const isDataView = (value: unknown): value is DataView => {\n return matchesSchema(value, dataViewSchema)\n}\n\nexport const isNonArraySchemaObject = (\n value?: OpenAPIV3.SchemaObject | undefined\n): value is OpenAPIV3.NonArraySchemaObject => {\n return isObject(value) && value.type !== 'array'\n}\n\nexport { isStringContent } from './utils'\n","/*\n|--------------------------------------------------------------------------\n| Decorator Utilities\n|--------------------------------------------------------------------------\n|\n| Utility functions for Resourceful decorators. These functions help to\n| ensure that information sent TO the database and information retrieved\n| FROM the database are the expected shapes and types.\n|\n*/\nimport { DateTime } from 'luxon'\nimport { isString } from '@/private/utils'\nimport { isLuxonDateTime, isLucidBinaryValue, isObject, isArray } from './type_guards'\nimport {\n E_INVALID_PREPARED_VALUE,\n E_INVALID_CONSUMED_VALUE,\n E_UNCASTABLE,\n} from '@nhtio/lucid-resourceful/errors'\nimport type { LucidBinaryValue, LucidPlainObject } from '@nhtio/lucid-resourceful/types'\n\n/**\n * Casts an unknown value to a string\n * @param value - The value to cast\n * @returns The value as a string\n * @throws E_UNCASTABLE when the value cannot be cast to a string\n */\nexport const castValueAsString = (value: unknown): string => {\n if ('string' === typeof value) return value\n if ('number' === typeof value) return value.toString()\n throw new E_UNCASTABLE(['String'])\n}\n/**\n * Casts an unknown value to a Luxon DateTime with enhanced string parsing\n * @param value - The value to cast (string, number, Date, or DateTime)\n * @returns The value as a Luxon DateTime\n * @throws E_UNCASTABLE when the value cannot be cast to a DateTime\n * @remarks For string values, attempts SQL format parsing first, then falls back to ISO format parsing\n */\nexport const castValueAsDate = (value: unknown): DateTime => {\n switch (typeof value) {\n case 'string': {\n const ret = DateTime.fromSQL(value)\n if (!ret.isValid) {\n const fromIso = DateTime.fromISO(value)\n if (fromIso.isValid) return fromIso\n throw new E_UNCASTABLE(['Date'])\n }\n return ret\n }\n case 'number': {\n let ret = DateTime.fromSeconds(value)\n if (!ret.isValid) {\n throw new E_UNCASTABLE(['Date'])\n }\n if (ret.year > 9999 || ret.year < 0) {\n ret = DateTime.fromMillis(value)\n }\n return ret\n }\n case 'object': {\n if (isLuxonDateTime(value)) {\n return value\n }\n if (value instanceof Date) {\n const ret = DateTime.fromJSDate(value)\n if (!ret.isValid) {\n throw new E_UNCASTABLE(['Date'])\n }\n return ret\n }\n throw new E_UNCASTABLE(['Date'])\n }\n default: {\n throw new E_UNCASTABLE(['Date'])\n }\n }\n}\n/**\n * Casts an unknown value to a Luxon DateTime with enhanced error handling and string parsing\n * @param value - The value to cast (string, number, Date, or DateTime)\n * @returns The value as a Luxon DateTime\n * @throws E_UNCASTABLE when the value cannot be cast to a DateTime\n * @remarks For string values, attempts SQL format parsing first, then falls back to ISO format parsing\n */\nexport const castValueAsDateTime = (value: unknown): DateTime => {\n try {\n return castValueAsDate(value)\n } catch {\n throw new E_UNCASTABLE(['DateTime'])\n }\n}\n/**\n * Casts an unknown value to a Uint8Array (binary data)\n * @param value - The value to cast\n * @returns The value as a Uint8Array\n * @throws E_UNCASTABLE when the value cannot be cast to binary data\n */\nexport const castValueAsBinary = (value: unknown): Uint8Array => {\n if (isLucidBinaryValue(value)) return value\n throw new E_UNCASTABLE(['Binary'])\n}\n/**\n * Casts an unknown value to a number\n * @param value - The value to cast\n * @returns The value as a number\n * @throws E_UNCASTABLE when the value cannot be cast to a number\n */\nexport const castValueAsNumber = (value: unknown): number => {\n if ('number' === typeof value) return value\n if ('string' === typeof value) {\n const parsed = Number(value)\n if (Number.isNaN(parsed)) {\n throw new E_UNCASTABLE(['Number'])\n }\n return parsed\n }\n throw new E_UNCASTABLE(['Number'])\n}\n/**\n * Casts an unknown value to an integer\n * @param value - The value to cast\n * @returns The value as an integer (truncated if necessary)\n * @throws E_UNCASTABLE when the value cannot be cast to an integer\n */\nexport const castValueAsInteger = (value: unknown): number => {\n const num = castValueAsNumber(value)\n return Math.trunc(num)\n}\n/**\n * Casts an unknown value to a bigint\n * @param value - The value to cast\n * @returns The value as a bigint\n * @throws E_UNCASTABLE when the value cannot be cast to a bigint\n */\nexport const castValueAsBigint = (value: unknown): bigint => {\n try {\n if (typeof value === 'bigint') return value\n const num = castValueAsNumber(value)\n return BigInt(num)\n } catch {\n throw new E_UNCASTABLE(['Bigint'])\n }\n}\n/**\n * Casts an unknown value to an unsigned integer\n * @param value - The value to cast\n * @returns The value as an unsigned integer (32-bit)\n * @throws E_UNCASTABLE when the value cannot be cast to an unsigned integer\n */\nexport const castValueAsUnsignedInt = (value: unknown): number => {\n try {\n const num = typeof value === 'bigint' ? Number(value) : castValueAsNumber(value)\n if (!Number.isFinite(num) || Number.isNaN(num)) {\n throw new E_UNCASTABLE(['Unsignedint'])\n }\n return num >>> 0\n } catch {\n throw new E_UNCASTABLE(['Unsignedint'])\n }\n}\n/**\n * Casts an unknown value to a boolean\n * @param value - The value to cast\n * @returns The value as a boolean\n * @throws E_UNCASTABLE when the value cannot be cast to a boolean\n */\nexport const castValueAsBoolean = (value: unknown): boolean => {\n if ('boolean' === typeof value) return value\n if ('string' === typeof value) {\n const lower = value.toLowerCase()\n if (['true', '1'].includes(lower)) return true\n if (['false', '0'].includes(lower)) return false\n throw new E_UNCASTABLE(['Boolean'])\n }\n if ('number' === typeof value) {\n if (value === 0) return false\n if (value === 1) return true\n throw new E_UNCASTABLE(['Boolean'])\n }\n throw new E_UNCASTABLE(['Boolean'])\n}\n/**\n * Casts an unknown value to a plain object\n * @param value - The value to cast\n * @returns The value as a LucidPlainObject\n * @throws E_UNCASTABLE when the value cannot be cast to an object\n */\nexport const castValueAsObject = (value: unknown): LucidPlainObject => {\n if (isObject(value)) return value\n throw new E_UNCASTABLE(['Object'])\n}\n/**\n * Casts an unknown value to an array\n * @param value - The value to cast\n * @returns The value as an array of unknown elements\n * @throws E_UNCASTABLE when the value cannot be cast to an array\n */\nexport const castValueAsArray = (value: unknown): Array<unknown> => {\n if (isArray(value)) return value\n throw new E_UNCASTABLE(['Array'])\n}\n\n/**\n * Prepares a string value for database storage with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared string value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n */\nexport function prepareString(key: string, value: unknown, nullable: true): string | null\nexport function prepareString(key: string, value: unknown, nullable?: false): string\nexport function prepareString(\n key: string,\n value: unknown,\n nullable: boolean = false\n): string | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsString(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'String'])\n }\n}\n/**\n * Prepares a date value for database storage with nullable support and enhanced string parsing\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared DateTime value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n * @remarks For string values, attempts SQL format parsing first, then falls back to ISO format parsing\n */\nexport function prepareDate(key: string, value: unknown, nullable: true): Date | null\nexport function prepareDate(key: string, value: unknown, nullable?: false): Date\nexport function prepareDate(key: string, value: unknown, nullable: boolean = false): Date | null {\n if (value === null && nullable === true) return null\n try {\n const dto = castValueAsDate(value)\n return dto.toJSDate()\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'Date'])\n }\n}\n/**\n * Prepares a datetime value for database storage with nullable support and enhanced string parsing\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared DateTime value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n * @remarks For string values, attempts SQL format parsing first, then falls back to ISO format parsing\n */\nexport function prepareDateTime(key: string, value: unknown, nullable: true): Date | null\nexport function prepareDateTime(key: string, value: unknown, nullable?: false): Date\nexport function prepareDateTime(\n key: string,\n value: unknown,\n nullable: boolean = false\n): Date | null {\n if (value === null && nullable === true) return null\n try {\n const dto = castValueAsDateTime(value)\n return dto.toJSDate()\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'DateTime'])\n }\n}\n/**\n * Prepares a binary value for database storage with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared binary value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n */\nexport function prepareBinary(key: string, value: unknown, nullable: true): LucidBinaryValue | null\nexport function prepareBinary(key: string, value: unknown, nullable?: false): LucidBinaryValue\nexport function prepareBinary(\n key: string,\n value: unknown,\n nullable: boolean = false\n): LucidBinaryValue | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsBinary(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'Binary'])\n }\n}\n/**\n * Prepares a number value for database storage with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared number value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n */\nexport function prepareNumber(key: string, value: unknown, nullable: true): number | null\nexport function prepareNumber(key: string, value: unknown, nullable?: false): number\nexport function prepareNumber(\n key: string,\n value: unknown,\n nullable: boolean = false\n): number | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsNumber(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'Number'])\n }\n}\n/**\n * Prepares an integer value for database storage with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared integer value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n */\nexport function prepareInteger(key: string, value: unknown, nullable: true): number | null\nexport function prepareInteger(key: string, value: unknown, nullable?: false): number\nexport function prepareInteger(\n key: string,\n value: unknown,\n nullable: boolean = false\n): number | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsInteger(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'Integer'])\n }\n}\n/**\n * Prepares a bigint value for database storage with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared bigint value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n */\nexport function prepareBigint(key: string, value: unknown, nullable: true): bigint | null\nexport function prepareBigint(key: string, value: unknown, nullable?: false): bigint\nexport function prepareBigint(\n key: string,\n value: unknown,\n nullable: boolean = false\n): bigint | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsBigint(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'Bigint'])\n }\n}\n/**\n * Prepares an unsigned integer value for database storage with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared unsigned integer value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n */\nexport function prepareUnsignedint(key: string, value: unknown, nullable: true): number | null\nexport function prepareUnsignedint(key: string, value: unknown, nullable?: false): number\nexport function prepareUnsignedint(\n key: string,\n value: unknown,\n nullable: boolean = false\n): number | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsUnsignedInt(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'Unsignedint'])\n }\n}\n/**\n * Prepares a boolean value for database storage with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared boolean value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n */\nexport function prepareBoolean(key: string, value: unknown, nullable: true): boolean | null\nexport function prepareBoolean(key: string, value: unknown, nullable?: false): boolean\nexport function prepareBoolean(\n key: string,\n value: unknown,\n nullable: boolean = false\n): boolean | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsBoolean(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'Boolean'])\n }\n}\n/**\n * Prepares an object value for database storage with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared object value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n */\nexport function prepareObject(key: string, value: unknown, nullable: true): LucidPlainObject | null\nexport function prepareObject(key: string, value: unknown, nullable?: false): LucidPlainObject\nexport function prepareObject(\n key: string,\n value: unknown,\n nullable: boolean = false\n): LucidPlainObject | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsObject(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'Object'])\n }\n}\n/**\n * Prepares an array value for database storage with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to prepare\n * @param nullable - Whether the field can be null\n * @returns The prepared array value or null if nullable and value is null\n * @throws E_INVALID_PREPARED_VALUE when the value cannot be prepared\n */\nexport function prepareArray(key: string, value: unknown, nullable: true): Array<unknown> | null\nexport function prepareArray(key: string, value: unknown, nullable?: false): Array<unknown>\nexport function prepareArray(\n key: string,\n value: unknown,\n nullable: boolean = false\n): Array<unknown> | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsArray(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_PREPARED_VALUE([key, 'Array'])\n }\n}\n\n/**\n * Consumes a string value from database results with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed string value or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n */\nexport function consumeString(key: string, value: unknown, nullable: true): string | null\nexport function consumeString(key: string, value: unknown, nullable?: false): string\nexport function consumeString(\n key: string,\n value: unknown,\n nullable: boolean = false\n): string | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsString(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'String'])\n }\n}\n/**\n * Consumes a date value from database results with nullable support and enhanced string parsing\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed DateTime value or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n * @remarks For string values, attempts SQL format parsing first, then falls back to ISO format parsing\n */\nexport function consumeDate(key: string, value: unknown, nullable: true): DateTime | null\nexport function consumeDate(key: string, value: unknown, nullable?: false): DateTime\nexport function consumeDate(\n key: string,\n value: unknown,\n nullable: boolean = false\n): DateTime | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsDate(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'Date'])\n }\n}\n/**\n * Consumes a datetime value from database results with nullable support and enhanced string parsing\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed DateTime value or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n * @remarks For string values, attempts SQL format parsing first, then falls back to ISO format parsing\n */\nexport function consumeDateTime(key: string, value: unknown, nullable: true): DateTime | null\nexport function consumeDateTime(key: string, value: unknown, nullable?: false): DateTime\nexport function consumeDateTime(\n key: string,\n value: unknown,\n nullable: boolean = false\n): DateTime | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsDateTime(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'DateTime'])\n }\n}\n/**\n * Consumes a binary value from database results with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed LucidBinaryValue or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n */\nexport function consumeBinary(key: string, value: unknown, nullable: true): LucidBinaryValue | null\nexport function consumeBinary(key: string, value: unknown, nullable?: false): LucidBinaryValue\nexport function consumeBinary(\n key: string,\n value: unknown,\n nullable: boolean = false\n): LucidBinaryValue | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsBinary(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'Binary'])\n }\n}\n/**\n * Consumes a number value from database results with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed number value or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n */\nexport function consumeNumber(key: string, value: unknown, nullable: true): number | null\nexport function consumeNumber(key: string, value: unknown, nullable?: false): number\nexport function consumeNumber(\n key: string,\n value: unknown,\n nullable: boolean = false\n): number | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsNumber(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'Number'])\n }\n}\n/**\n * Consumes an integer value from database results with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed integer value or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n */\nexport function consumeInteger(key: string, value: unknown, nullable: true): number | null\nexport function consumeInteger(key: string, value: unknown, nullable?: false): number\nexport function consumeInteger(\n key: string,\n value: unknown,\n nullable: boolean = false\n): number | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsInteger(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'Integer'])\n }\n}\n/**\n * Consumes a bigint value from database results with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed bigint value or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n */\nexport function consumeBigint(key: string, value: unknown, nullable: true): bigint | null\nexport function consumeBigint(key: string, value: unknown, nullable?: false): bigint\nexport function consumeBigint(\n key: string,\n value: unknown,\n nullable: boolean = false\n): bigint | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsBigint(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'Bigint'])\n }\n}\n/**\n * Consumes an unsigned integer value from database results with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed unsigned integer value or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n */\nexport function consumeUnsignedint(key: string, value: unknown, nullable: true): number | null\nexport function consumeUnsignedint(key: string, value: unknown, nullable?: false): number\nexport function consumeUnsignedint(\n key: string,\n value: unknown,\n nullable: boolean = false\n): number | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsUnsignedInt(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'Unsignedint'])\n }\n}\n/**\n * Consumes a boolean value from database results with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed boolean value or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n */\nexport function consumeBoolean(key: string, value: unknown, nullable: true): boolean | null\nexport function consumeBoolean(key: string, value: unknown, nullable?: false): boolean\nexport function consumeBoolean(\n key: string,\n value: unknown,\n nullable: boolean = false\n): boolean | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsBoolean(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'Boolean'])\n }\n}\n/**\n * Consumes an object value from database results with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed LucidPlainObject or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n */\nexport function consumeObject(key: string, value: unknown, nullable: true): LucidPlainObject | null\nexport function consumeObject(key: string, value: unknown, nullable?: false): LucidPlainObject\nexport function consumeObject(\n key: string,\n value: unknown,\n nullable: boolean = false\n): LucidPlainObject | null {\n if (value === null && nullable === true) return null\n try {\n if (isString(value)) {\n value = JSON.parse(value)\n }\n\n return castValueAsObject(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'Object'])\n }\n}\n/**\n * Consumes an array value from database results with nullable support\n * @param key - The field name for error reporting\n * @param value - The value to consume\n * @param nullable - Whether the field can be null\n * @returns The consumed array value or null if nullable and value is null\n * @throws E_INVALID_CONSUMED_VALUE when the value cannot be consumed\n */\nexport function consumeArray(key: string, value: unknown, nullable: true): Array<unknown> | null\nexport function consumeArray(key: string, value: unknown, nullable?: false): Array<unknown>\nexport function consumeArray(\n key: string,\n value: unknown,\n nullable: boolean = false\n): Array<unknown> | null {\n if (value === null && nullable === true) return null\n try {\n return castValueAsArray(value)\n } catch {\n if (true === nullable) {\n return null\n }\n throw new E_INVALID_CONSUMED_VALUE([key, value, 'Array'])\n }\n}\n"],"names":["isObject","joi","isString"],"mappings":";;;;;AA8FA,MAAM,8CAA8B,IAAA;AAO7B,MAAM,qBAAqB,CAAC,UAA8C;AAC/E,QAAM,SAAS,wBAAwB,IAAI,KAAK;AAChD,MAAI,gBAAgB,OAAO,QAAQ;AACjC,WAAO;AAAA,EACT;AACA,MAAI,CAACA,WAAS,KAAK,KAAK,EAAE,OAAO,UAAU,YAAa,QAAO;AAG/D,MAAI,OAAO,UAAU,YAAY;AAC/B,UAAM,aACJ,sBAAsB,SACtB,aAAa,OAAO,MAAM,oBAC1B,yBAAyB,SACzB,MAAM,+BAA+B,OACrC,+BAA+B,SAC/B,MAAM,qCAAqC,OAC3C,mCAAmC,SACnC,MAAM,yCAAyC;AACjD,4BAAwB,IAAI,OAAO,UAAU;AAC7C,WAAO;AAAA,EACT;AAIA,MAAI,iBAAiB,OAAO;AAE1B,UAAM,cAAc,MAAM;AAE1B,QAAI,CAAC,eAAe,OAAO,gBAAgB,YAAY;AACrD,8BAAwB,IAAI,OAAO,KAAK;AACxC,aAAO;AAAA,IACT;AAEA,WAAO,mBAAmB,WAAW;AAAA,EACvC;AAGA,QAAM,QAAQ,OAAO,eAAe,KAAK;AACzC,SAAO,mBAAmB,KAAK;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QAAO;AAChD,MAAI;AACF,WAAO,mBAAmB,KAAK;AAAA,EACjC,QAAQ;AACN,QAAI,SAAS,UAAU;AACrB,aAAO;AAAA,IACT;AACA,UAAM,IAAI,yBAAyB,CAAC,KAAK,OAAO,SAAS,CAAC;AAAA,EAC5D;AACF;AAWO,SAAS,cACd,KACA,OACA,WAAoB,OACK;AACzB,MAAI,UAAU,QAAQ,aAAa,KAAM,QAAO;AAChD,MAAI;AACF,QAAIE,WAAS,KAAK,GAAG;AACnB,cAAQ,KAAK,MAAM,KAAK;AAAA,IAC1B;AAEA,WAAO,kBAAkB,KAAK;AAAA,EAChC,QAAQ;AACN,QAAI,SAAS,UAAU;AACrB,aAAO;AAAA,IACT;AACA,UAAM,IAAI,yBAAyB,CAAC,KAAK,OAAO,QAAQ,CAAC;AAAA,EAC3D;AACF;AAWO,SAAS,aACd,KACA,OACA,WAAoB,OACG;AACvB,MAAI,UAAU,QAAQ,aAAa,KAAM,QAAO;AAChD,MAAI;AACF,WAAO,iBAAiB,KAAK;AAAA,EAC/B,QAAQ;AACN,QAAI,SAAS,UAAU;AACrB,aAAO;AAAA,IACT;AACA,UAAM,IAAI,yBAAyB,CAAC,KAAK,OAAO,OAAO,CAAC;AAAA,EAC1D;AACF;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as E_INVALID_RESOURCEFUL_DATA_TYPE_OPTIONS } from "./errors-
|
|
1
|
+
import { a as E_INVALID_RESOURCEFUL_DATA_TYPE_OPTIONS } from "./errors-D39NvW3e.js";
|
|
2
2
|
import { R as ResourcefulStringTypeSchema, a as ResourcefulDateTypeSchema, b as ResourcefulDateTimeTypeSchema, c as ResourcefulBinaryTypeSchema, d as ResourcefulNumberTypeSchema, e as ResourcefulIntegerTypeSchema, f as ResourcefulBigintTypeSchema, g as ResourcefulUnsignedIntegerTypeSchema, h as ResourcefulBooleanTypeSchema, i as ResourcefulObjectTypeSchema, j as ResourcefulArrayTypeSchema } from "./data_type_schemas-I8EGtjRh.js";
|
|
3
3
|
const generateResourcefulDataTypeClass = (name, type, resolver, staticDefinitions = {}) => {
|
|
4
4
|
const schema = resolver();
|
|
@@ -171,4 +171,4 @@ export {
|
|
|
171
171
|
ResourcefulArrayType as j,
|
|
172
172
|
definitions as k
|
|
173
173
|
};
|
|
174
|
-
//# sourceMappingURL=definitions-
|
|
174
|
+
//# sourceMappingURL=definitions-CBCPzK9J.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions-CnmQ3iKe.js","sources":["../src/private/data_types.ts"],"sourcesContent":["/*\n|--------------------------------------------------------------------------\n| Column Data Types\n|--------------------------------------------------------------------------\n|\n| Classes which are used to define the data types of columns in\n| Lucid models that have been extended with the Resourceful mixin.\n|\n| Based on OpenAPI 3.0 Specifications found at:\n| https://swagger.io/docs/specification/v3_0/data-models/data-types/\n*/\n\nimport { E_INVALID_RESOURCEFUL_DATA_TYPE_OPTIONS } from '@nhtio/lucid-resourceful/errors'\nimport {\n ResourcefulStringTypeSchema,\n ResourcefulDateTypeSchema,\n ResourcefulDateTimeTypeSchema,\n ResourcefulBinaryTypeSchema,\n ResourcefulNumberTypeSchema,\n ResourcefulIntegerTypeSchema,\n ResourcefulBigintTypeSchema,\n ResourcefulUnsignedIntegerTypeSchema,\n ResourcefulBooleanTypeSchema,\n ResourcefulObjectTypeSchema,\n ResourcefulArrayTypeSchema,\n} from './data_type_schemas'\nimport type { ObjectSchema } from '@nhtio/validation'\n\n/**\n * Base interface for all Resourceful data type options.\n * Includes common modifier properties that apply to all data types.\n */\nexport interface BaseInterface {\n /** Whether the value can be null */\n nullable?: boolean\n /** Whether the property is read-only (not included in create/update operations) */\n readOnly?: boolean\n /** Whether the property is write-only (not included in response serialization) */\n writeOnly?: boolean\n}\n\n/**\n * Base type constraint for abstract constructor functions used in data type generation.\n */\nexport type BaseClass = abstract new (...args: any[]) => any\n\n/**\n * A hybrid type that represents a constructor function which can be called both with and without the `new` keyword.\n * This type enables creating data type classes that work as both constructors and factory functions.\n *\n * @typeParam ClassConstructorOptions - The interface defining the constructor options for the class\n * @typeParam C - The abstract constructor type constraint\n */\nexport type CallableNewable<\n ClassConstructorOptions extends BaseInterface,\n C extends BaseClass = BaseClass,\n> = {\n readonly schema: ObjectSchema<ClassConstructorOptions>\n new (...args: ConstructorParameters<C>): InstanceType<C>\n} & { (...args: ConstructorParameters<C>): InstanceType<C> } & { prototype: InstanceType<C> }\n\nconst generateResourcefulDataTypeClass = <\n ClassConstructorOptions extends BaseInterface,\n C extends BaseClass = BaseClass,\n>(\n name: string,\n type: string,\n resolver: () => ObjectSchema<ClassConstructorOptions>,\n staticDefinitions: { [key: string]: any } = {}\n): CallableNewable<ClassConstructorOptions, C> => {\n const schema = resolver()\n const Base = class {\n declare static readonly schema: ObjectSchema<ClassConstructorOptions>\n constructor(options: Partial<ClassConstructorOptions> = {}) {\n const { error, value } = schema.validate(options, {\n abortEarly: false,\n convert: true,\n allowUnknown: false,\n })\n if (error) {\n throw new E_INVALID_RESOURCEFUL_DATA_TYPE_OPTIONS(name, error)\n }\n Object.defineProperty(this, 'type', {\n value: type,\n writable: false,\n enumerable: true,\n configurable: false,\n })\n Object.entries(value).forEach(([key, val]) => {\n Object.defineProperty(this, key, {\n value: val,\n writable: false,\n enumerable: true,\n configurable: false,\n })\n })\n Object.entries(staticDefinitions).forEach(([key, val]) => {\n Object.defineProperty(this, key, {\n value: val,\n writable: false,\n enumerable: true,\n configurable: false,\n })\n })\n }\n\n get [Symbol.toStringTag]() {\n return JSON.stringify(this)\n }\n\n toString(): string {\n return JSON.stringify(this)\n }\n\n // toObject(): { [key: string]: any } {\n // const ret: { [key: string]: any } = {\n // type,\n // }\n // for (const key of Object.getOwnPropertyNames(this)) {\n // if (key !== 'constructor' && key !== 'toString' && key !== 'toObject') {\n // ret[key] = (this as any)[key]\n // }\n // }\n // Object.entries(staticDefinitions).forEach(([key, val]) => {\n // ret[key] = val\n // })\n // return ret\n // }\n } as unknown as C\n Object.defineProperty(Base, 'name', {\n value: name,\n writable: false,\n enumerable: false,\n configurable: false,\n })\n Object.defineProperty(Base, 'schema', {\n value: schema,\n writable: false,\n enumerable: false,\n configurable: false,\n })\n const Fn: any = function (this: any, ...args: any[]) {\n if (!new.target) {\n return new (Fn as any)(...args)\n }\n return new (Base as any)(...args)\n }\n Fn.prototype = Object.create(Base.prototype)\n Fn.prototype.constructor = Fn\n for (const key of Object.getOwnPropertyNames(Base)) {\n if (key !== 'prototype' && key !== 'name' && key !== 'length') {\n Object.defineProperty(Fn, key, Object.getOwnPropertyDescriptor(Base, key)!)\n }\n }\n return Fn as CallableNewable<ClassConstructorOptions, C>\n}\n\n/**\n * Supported string formats for ResourcefulStringType, excluding OpenAPI reserved formats.\n * These formats provide additional validation and documentation for string fields.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport const ResourcefulStringFormat = ['password' as 'password', 'byte' as 'byte']\n\n/**\n * Union type of supported string formats for ResourcefulStringType.\n * Used to provide type safety when specifying string field formats.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport type ResourcefulStringFormat = (typeof ResourcefulStringFormat)[number]\n\n/**\n * ResourcefulStringJoiFormat represents a collection of predefined validation formats for strings.\n * It is used to specify constraints or patterns that a string should adhere to during validation.\n * This type is typically employed in conjunction with validation libraries like Joi.\n */\nexport type ResourcefulStringJoiFormat =\n | 'alphanum'\n | 'email'\n | 'uppercase'\n | 'lowercase'\n | 'creditCard'\n | 'dataUri'\n | 'domain'\n | 'uuid'\n | 'guid'\n | 'hex'\n | 'hostname'\n | 'ip'\n | 'duration'\n | 'uri'\n | 'fqdn'\n\nexport type ResourcefulEnumObject<T> = {\n value: T\n title?: string\n i18n?: boolean\n}\n\nexport type ResourcefulEnum<T> = T[] | ResourcefulEnumObject<T>[]\n\n/**\n * Configuration options for ResourcefulStringType instances.\n * Defines validation rules and constraints for string-based fields in OpenAPI schemas.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport interface ResourcefulStringTypeOptions extends BaseInterface {\n /** Minimum length constraint for the string value */\n minLength: number\n /** Maximum length constraint for the string value */\n maxLength: number\n /** Regular expression pattern that the string value must match */\n pattern?: string\n /** String format specification, excluding OpenAPI reserved formats like date, date-time, and binary */\n format?:\n | ResourcefulStringFormat\n | Exclude<string, 'date' | 'date-time' | 'password' | 'byte' | 'binary'>\n | ResourcefulStringJoiFormat\n /** Array of allowed string values for enumeration validation */\n enum?: ResourcefulEnum<string>\n}\n\n/**\n * Callable constructor for creating validated string type instances.\n * Supports both constructor and function call patterns for flexible usage.\n *\n * @example\n * ```typescript\n * const stringType = new ResourcefulStringType({ minLength: 1, maxLength: 100 })\n * const stringType2 = ResourcefulStringType({ pattern: '^[a-zA-Z]+$' })\n * ```\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport const ResourcefulStringType = generateResourcefulDataTypeClass<ResourcefulStringTypeOptions>(\n 'ResourcefulStringType',\n 'string',\n ResourcefulStringTypeSchema\n)\n\n/**\n * Instance type for ResourcefulStringType with validated properties.\n * Represents a string data type with validation constraints as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport interface ResourcefulStringType extends ResourcefulStringTypeOptions {\n type: 'string'\n}\n\n/**\n * Configuration options for ResourcefulDateType instances.\n * Represents date-only values formatted as ISO 8601 date strings.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport interface ResourcefulDateTypeOptions extends BaseInterface {\n autoCreate?: boolean\n autoUpdate?: boolean\n}\n\n/**\n * Callable constructor for creating validated date type instances.\n * Automatically sets the OpenAPI format to 'date' for ISO 8601 date strings.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport const ResourcefulDateType = generateResourcefulDataTypeClass<ResourcefulDateTypeOptions>(\n 'ResourcefulDateType',\n 'string',\n ResourcefulDateTypeSchema,\n { format: 'date' }\n)\n\n/**\n * Instance type for ResourcefulDateType with validated properties.\n * Represents a date-only value formatted as ISO 8601 date string as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport interface ResourcefulDateType extends ResourcefulDateTypeOptions {\n type: 'string'\n format: 'date'\n}\n\n/**\n * Configuration options for ResourcefulDateTimeType instances.\n * Represents date-time values formatted as ISO 8601 date-time strings.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport interface ResourcefulDateTimeTypeOptions extends BaseInterface {\n autoCreate?: boolean\n autoUpdate?: boolean\n}\n\n/**\n * Callable constructor for creating validated date-time type instances.\n * Automatically sets the OpenAPI format to 'date-time' for ISO 8601 date-time strings.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport const ResourcefulDateTimeType =\n generateResourcefulDataTypeClass<ResourcefulDateTimeTypeOptions>(\n 'ResourcefulDateTimeType',\n 'string',\n ResourcefulDateTimeTypeSchema,\n { format: 'date-time' }\n )\n\n/**\n * Instance type for ResourcefulDateTimeType with validated properties.\n * Represents a date-time value formatted as ISO 8601 date-time string as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport interface ResourcefulDateTimeType extends ResourcefulDateTimeTypeOptions {\n type: 'string'\n format: 'date-time'\n}\n\n/**\n * Configuration options for ResourcefulBinaryType instances.\n * Defines constraints for binary data represented as base64-encoded strings.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport interface ResourcefulBinaryTypeOptions extends BaseInterface {\n /** Minimum length constraint for the base64-encoded binary data */\n minLength: number\n /** Maximum length constraint for the base64-encoded binary data */\n maxLength: number\n}\n\n/**\n * Callable constructor for creating validated binary type instances.\n * Automatically sets the OpenAPI format to 'binary' for base64-encoded binary data.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport const ResourcefulBinaryType = generateResourcefulDataTypeClass<ResourcefulBinaryTypeOptions>(\n 'ResourcefulBinaryType',\n 'string',\n ResourcefulBinaryTypeSchema,\n { format: 'binary' }\n)\n\n/**\n * Instance type for ResourcefulBinaryType with validated properties.\n * Represents binary data as base64-encoded string as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport interface ResourcefulBinaryType extends ResourcefulBinaryTypeOptions {\n type: 'string'\n format: 'binary'\n}\n\n/**\n * Supported number formats for ResourcefulNumberType, following OpenAPI 3.0 specification.\n * These formats provide additional precision and validation for numeric fields.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Number Type}\n */\nexport const ResourcefulNumberFormat = ['float' as 'float', 'double' as 'double']\n\n/**\n * Union type of supported number formats for ResourcefulNumberType.\n * Used to provide type safety when specifying numeric field formats.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Number Type}\n */\nexport type ResourcefulNumberFormat = (typeof ResourcefulNumberFormat)[number]\n\n/**\n * Configuration options for ResourcefulNumberType instances.\n * Defines validation rules and constraints for numeric fields in OpenAPI schemas.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Number Type}\n */\nexport interface ResourcefulNumberTypeOptions extends BaseInterface {\n /** Minimum value constraint for the number */\n minimum: number\n /** Whether the minimum value is exclusive (value must be greater than minimum) */\n exclusiveMinimum: boolean\n /** Maximum value constraint for the number */\n maximum: number\n /** Whether the maximum value is exclusive (value must be less than maximum) */\n exclusiveMaximum: boolean\n /** Number format specification for precision (float or double) */\n format: ResourcefulNumberFormat\n /** Value must be a multiple of this number */\n multipleOf: number\n}\n\n/**\n * Callable constructor for creating validated number type instances.\n * Supports floating-point numbers with configurable precision and range constraints.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Number Type}\n */\nexport const ResourcefulNumberType = generateResourcefulDataTypeClass<ResourcefulNumberTypeOptions>(\n 'ResourcefulNumberType',\n 'number',\n ResourcefulNumberTypeSchema\n)\n\n/**\n * Instance type for ResourcefulNumberType with validated properties.\n * Represents floating-point numbers as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Number Type}\n */\nexport interface ResourcefulNumberType extends ResourcefulNumberTypeOptions {\n type: 'number'\n}\n\n/**\n * Configuration options for ResourcefulIntegerType instances.\n * Defines validation rules and constraints for 32-bit integer fields in OpenAPI schemas.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type}\n */\nexport interface ResourcefulIntegerTypeOptions extends BaseInterface {\n /** Minimum value constraint for the integer */\n minimum: number\n /** Whether the minimum value is exclusive (value must be greater than minimum) */\n exclusiveMinimum: boolean\n /** Maximum value constraint for the integer */\n maximum: number\n /** Whether the maximum value is exclusive (value must be less than maximum) */\n exclusiveMaximum: boolean\n /** Value must be a multiple of this number */\n multipleOf: number\n}\n\n/**\n * Callable constructor for creating validated integer type instances.\n * Automatically sets the OpenAPI format to 'int32' for 32-bit signed integers.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type}\n */\nexport const ResourcefulIntegerType =\n generateResourcefulDataTypeClass<ResourcefulIntegerTypeOptions>(\n 'ResourcefulIntegerType',\n 'integer',\n ResourcefulIntegerTypeSchema,\n { format: 'int32' }\n )\n\n/**\n * Instance type for ResourcefulIntegerType with validated properties.\n * Represents 32-bit signed integers as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type}\n */\nexport interface ResourcefulIntegerType extends ResourcefulIntegerTypeOptions {\n type: 'integer'\n format: 'int32'\n}\n\n/**\n * Configuration options for ResourcefulBigintType instances.\n * Defines validation rules and constraints for 64-bit integer fields in OpenAPI schemas.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type}\n */\nexport interface ResourcefulBigintTypeOptions extends BaseInterface {\n /** Minimum value constraint for the 64-bit integer */\n minimum: bigint\n /** Whether the minimum value is exclusive (value must be greater than minimum) */\n exclusiveMinimum: boolean\n /** Maximum value constraint for the 64-bit integer */\n maximum: bigint\n /** Whether the maximum value is exclusive (value must be less than maximum) */\n exclusiveMaximum: boolean\n /** Value must be a multiple of this number */\n multipleOf: bigint\n}\n\n/**\n * Callable constructor for creating validated bigint type instances.\n * Automatically sets the OpenAPI format to 'int64' for 64-bit signed integers.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type}\n */\nexport const ResourcefulBigintType = generateResourcefulDataTypeClass<ResourcefulBigintTypeOptions>(\n 'ResourcefulBigintType',\n 'integer',\n ResourcefulBigintTypeSchema,\n { format: 'int64' }\n)\n\n/**\n * Instance type for ResourcefulBigintType with validated properties.\n * Represents 64-bit signed integers as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type}\n */\nexport interface ResourcefulBigintType extends ResourcefulBigintTypeOptions {\n type: 'integer'\n format: 'int64'\n}\n\n/**\n * Configuration options for ResourcefulUnsignedIntegerType instances.\n * Defines validation rules and constraints for unsigned integer fields in OpenAPI schemas.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type}\n */\nexport interface ResourcefulUnsignedIntegerTypeOptions extends BaseInterface {\n /** Minimum value constraint for the unsigned integer */\n minimum: number\n /** Whether the minimum value is exclusive (value must be greater than minimum) */\n exclusiveMinimum: boolean\n /** Maximum value constraint for the unsigned integer */\n maximum: number\n /** Whether the maximum value is exclusive (value must be less than maximum) */\n exclusiveMaximum: boolean\n /** Value must be a multiple of this number */\n multipleOf: number\n}\n\n/**\n * Callable constructor for creating validated unsigned integer type instances.\n * Represents unsigned integers without a specific OpenAPI format constraint.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type}\n */\nexport const ResourcefulUnsignedIntegerType =\n generateResourcefulDataTypeClass<ResourcefulUnsignedIntegerTypeOptions>(\n 'ResourcefulUnsignedIntegerType',\n 'integer',\n ResourcefulUnsignedIntegerTypeSchema\n )\n\n/**\n * Instance type for ResourcefulUnsignedIntegerType with validated properties.\n * Represents unsigned integers as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type}\n */\nexport interface ResourcefulUnsignedIntegerType extends ResourcefulUnsignedIntegerTypeOptions {\n type: 'integer'\n format: never\n}\n\n/**\n * Configuration options for ResourcefulBooleanType instances.\n * Currently has no specific configuration options as boolean types are straightforward.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#boolean | OpenAPI 3.0 Boolean Type}\n */\nexport interface ResourcefulBooleanTypeOptions extends BaseInterface {}\n\n/**\n * Callable constructor for creating validated boolean type instances.\n * Represents simple true/false values in OpenAPI schemas.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#boolean | OpenAPI 3.0 Boolean Type}\n */\nexport const ResourcefulBooleanType =\n generateResourcefulDataTypeClass<ResourcefulBooleanTypeOptions>(\n 'ResourcefulBooleanType',\n 'boolean',\n ResourcefulBooleanTypeSchema\n )\n\n/**\n * Instance type for ResourcefulBooleanType with validated properties.\n * Represents boolean true/false values as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#boolean | OpenAPI 3.0 Boolean Type}\n */\nexport interface ResourcefulBooleanType extends ResourcefulBooleanTypeOptions {\n type: 'boolean'\n}\n\n/**\n * Configuration options for ResourcefulObjectType instances.\n * Defines complex object schemas with typed properties and validation rules.\n * Supports advanced OpenAPI features like oneOf, allOf, anyOf, and not operators.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#object | OpenAPI 3.0 Object Type}\n */\nexport interface ResourcefulObjectTypeOptions extends BaseInterface {\n /** Object properties definition supporting direct data types and composition patterns */\n properties: {\n [key: string]:\n | ResourcefulDataType\n | { oneOf: Array<ResourcefulDataType> }\n | { allOf: Array<ResourcefulDataType> }\n | { anyOf: Array<ResourcefulDataType> }\n | { not: Array<ResourcefulDataType> }\n }\n /** Array of property names that are required for object validation */\n required?: string[]\n /** Whether additional properties beyond those defined are allowed, or direct data type for additional properties */\n additionalProperties?: boolean | ResourcefulDataType\n /** Minimum number of properties required in the object */\n minProperties?: number\n /** Maximum number of properties allowed in the object */\n maxProperties?: number\n}\n\n/**\n * Callable constructor for creating validated object type instances.\n * Supports complex nested object schemas with property validation and constraints.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#object | OpenAPI 3.0 Object Type}\n */\nexport const ResourcefulObjectType = generateResourcefulDataTypeClass<ResourcefulObjectTypeOptions>(\n 'ResourcefulObjectType',\n 'object',\n ResourcefulObjectTypeSchema\n)\n\n/**\n * Instance type for ResourcefulObjectType with validated properties.\n * Represents complex object schemas with typed properties as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#object | OpenAPI 3.0 Object Type}\n */\nexport interface ResourcefulObjectType extends ResourcefulObjectTypeOptions {\n type: 'object'\n}\n\n/**\n * Configuration options for ResourcefulArrayType instances.\n * Defines array schemas with typed items and validation constraints.\n * Supports complex item types including nested objects and arrays.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#array | OpenAPI 3.0 Array Type}\n */\nexport interface ResourcefulArrayTypeOptions extends BaseInterface {\n /** Type specification for array items, supporting all resourceful data types and composition patterns */\n items:\n | ResourcefulDataType\n | { oneOf: Array<ResourcefulDataType> }\n | { allOf: Array<ResourcefulDataType> }\n | { anyOf: Array<ResourcefulDataType> }\n | { not: Array<ResourcefulDataType> }\n /** Minimum number of items required in the array */\n minItems?: number\n /** Maximum number of items allowed in the array */\n maxItems?: number\n /** Whether all items in the array must be unique */\n uniqueItems?: boolean\n}\n\n/**\n * Callable constructor for creating validated array type instances.\n * Supports arrays with typed items and validation constraints like minimum/maximum length.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#array | OpenAPI 3.0 Array Type}\n */\nexport const ResourcefulArrayType = generateResourcefulDataTypeClass<ResourcefulArrayTypeOptions>(\n 'ResourcefulArrayType',\n 'array',\n ResourcefulArrayTypeSchema\n)\n\n/**\n * Instance type for ResourcefulArrayType with validated properties.\n * Represents arrays with typed items and validation constraints as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#array | OpenAPI 3.0 Array Type}\n */\nexport interface ResourcefulArrayType extends ResourcefulArrayTypeOptions {\n type: 'array'\n}\n\n/**\n * Union type representing all available resourceful data types.\n * Provides a comprehensive type for working with any resourceful data type instance.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/ | OpenAPI 3.0 Data Types}\n */\nexport type ResourcefulDataType =\n | ResourcefulStringType\n | ResourcefulDateType\n | ResourcefulDateTimeType\n | ResourcefulBinaryType\n | ResourcefulNumberType\n | ResourcefulIntegerType\n | ResourcefulBigintType\n | ResourcefulUnsignedIntegerType\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yBACX;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;AA6CK,MAAM,wBAAwB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AACF;AAyCO,MAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AACF;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"definitions-CBCPzK9J.js","sources":["../src/private/data_types.ts"],"sourcesContent":["/*\n|--------------------------------------------------------------------------\n| Column Data Types\n|--------------------------------------------------------------------------\n|\n| Classes which are used to define the data types of columns in\n| Lucid models that have been extended with the Resourceful mixin.\n|\n| Based on OpenAPI 3.0 Specifications found at:\n| https://swagger.io/docs/specification/v3_0/data-models/data-types/\n*/\n\nimport { E_INVALID_RESOURCEFUL_DATA_TYPE_OPTIONS } from '@nhtio/lucid-resourceful/errors'\nimport {\n ResourcefulStringTypeSchema,\n ResourcefulDateTypeSchema,\n ResourcefulDateTimeTypeSchema,\n ResourcefulBinaryTypeSchema,\n ResourcefulNumberTypeSchema,\n ResourcefulIntegerTypeSchema,\n ResourcefulBigintTypeSchema,\n ResourcefulUnsignedIntegerTypeSchema,\n ResourcefulBooleanTypeSchema,\n ResourcefulObjectTypeSchema,\n ResourcefulArrayTypeSchema,\n} from './data_type_schemas'\nimport type { ObjectSchema } from '@nhtio/validation'\n\n/**\n * Base interface for all Resourceful data type options.\n * Includes common modifier properties that apply to all data types.\n */\nexport interface BaseInterface {\n /** Whether the value can be null */\n nullable?: boolean\n /** Whether the property is read-only (not included in create/update operations) */\n readOnly?: boolean\n /** Whether the property is write-only (not included in response serialization) */\n writeOnly?: boolean\n}\n\n/**\n * Base type constraint for abstract constructor functions used in data type generation.\n */\nexport type BaseClass = abstract new (...args: any[]) => any\n\n/**\n * A hybrid type that represents a constructor function which can be called both with and without the `new` keyword.\n * This type enables creating data type classes that work as both constructors and factory functions.\n *\n * @typeParam ClassConstructorOptions - The interface defining the constructor options for the class\n * @typeParam C - The abstract constructor type constraint\n */\nexport type CallableNewable<\n ClassConstructorOptions extends BaseInterface,\n C extends BaseClass = BaseClass,\n> = {\n readonly schema: ObjectSchema<ClassConstructorOptions>\n new (...args: ConstructorParameters<C>): InstanceType<C>\n} & { (...args: ConstructorParameters<C>): InstanceType<C> } & { prototype: InstanceType<C> }\n\nconst generateResourcefulDataTypeClass = <\n ClassConstructorOptions extends BaseInterface,\n C extends BaseClass = BaseClass,\n>(\n name: string,\n type: string,\n resolver: () => ObjectSchema<ClassConstructorOptions>,\n staticDefinitions: { [key: string]: any } = {}\n): CallableNewable<ClassConstructorOptions, C> => {\n const schema = resolver()\n const Base = class {\n declare static readonly schema: ObjectSchema<ClassConstructorOptions>\n constructor(options: Partial<ClassConstructorOptions> = {}) {\n const { error, value } = schema.validate(options, {\n abortEarly: false,\n convert: true,\n allowUnknown: false,\n })\n if (error) {\n throw new E_INVALID_RESOURCEFUL_DATA_TYPE_OPTIONS(name, error)\n }\n Object.defineProperty(this, 'type', {\n value: type,\n writable: false,\n enumerable: true,\n configurable: false,\n })\n Object.entries(value).forEach(([key, val]) => {\n Object.defineProperty(this, key, {\n value: val,\n writable: false,\n enumerable: true,\n configurable: false,\n })\n })\n Object.entries(staticDefinitions).forEach(([key, val]) => {\n Object.defineProperty(this, key, {\n value: val,\n writable: false,\n enumerable: true,\n configurable: false,\n })\n })\n }\n\n get [Symbol.toStringTag]() {\n return JSON.stringify(this)\n }\n\n toString(): string {\n return JSON.stringify(this)\n }\n\n // toObject(): { [key: string]: any } {\n // const ret: { [key: string]: any } = {\n // type,\n // }\n // for (const key of Object.getOwnPropertyNames(this)) {\n // if (key !== 'constructor' && key !== 'toString' && key !== 'toObject') {\n // ret[key] = (this as any)[key]\n // }\n // }\n // Object.entries(staticDefinitions).forEach(([key, val]) => {\n // ret[key] = val\n // })\n // return ret\n // }\n } as unknown as C\n Object.defineProperty(Base, 'name', {\n value: name,\n writable: false,\n enumerable: false,\n configurable: false,\n })\n Object.defineProperty(Base, 'schema', {\n value: schema,\n writable: false,\n enumerable: false,\n configurable: false,\n })\n const Fn: any = function (this: any, ...args: any[]) {\n if (!new.target) {\n return new (Fn as any)(...args)\n }\n return new (Base as any)(...args)\n }\n Fn.prototype = Object.create(Base.prototype)\n Fn.prototype.constructor = Fn\n for (const key of Object.getOwnPropertyNames(Base)) {\n if (key !== 'prototype' && key !== 'name' && key !== 'length') {\n Object.defineProperty(Fn, key, Object.getOwnPropertyDescriptor(Base, key)!)\n }\n }\n return Fn as CallableNewable<ClassConstructorOptions, C>\n}\n\n/**\n * Supported string formats for ResourcefulStringType, excluding OpenAPI reserved formats.\n * These formats provide additional validation and documentation for string fields.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport const ResourcefulStringFormat = ['password' as 'password', 'byte' as 'byte']\n\n/**\n * Union type of supported string formats for ResourcefulStringType.\n * Used to provide type safety when specifying string field formats.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport type ResourcefulStringFormat = (typeof ResourcefulStringFormat)[number]\n\n/**\n * ResourcefulStringJoiFormat represents a collection of predefined validation formats for strings.\n * It is used to specify constraints or patterns that a string should adhere to during validation.\n * This type is typically employed in conjunction with validation libraries like Joi.\n */\nexport type ResourcefulStringJoiFormat =\n | 'alphanum'\n | 'email'\n | 'uppercase'\n | 'lowercase'\n | 'creditCard'\n | 'dataUri'\n | 'domain'\n | 'uuid'\n | 'guid'\n | 'hex'\n | 'hostname'\n | 'ip'\n | 'duration'\n | 'uri'\n | 'fqdn'\n\nexport type ResourcefulEnumObject<T> = {\n value: T\n title?: string\n i18n?: boolean\n}\n\nexport type ResourcefulEnum<T> = T[] | ResourcefulEnumObject<T>[]\n\n/**\n * Configuration options for ResourcefulStringType instances.\n * Defines validation rules and constraints for string-based fields in OpenAPI schemas.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport interface ResourcefulStringTypeOptions extends BaseInterface {\n /** Minimum length constraint for the string value */\n minLength: number\n /** Maximum length constraint for the string value */\n maxLength: number\n /** Regular expression pattern that the string value must match */\n pattern?: string\n /** String format specification, excluding OpenAPI reserved formats like date, date-time, and binary */\n format?:\n | ResourcefulStringFormat\n | Exclude<string, 'date' | 'date-time' | 'password' | 'byte' | 'binary'>\n | ResourcefulStringJoiFormat\n /** Array of allowed string values for enumeration validation */\n enum?: ResourcefulEnum<string>\n}\n\n/**\n * Callable constructor for creating validated string type instances.\n * Supports both constructor and function call patterns for flexible usage.\n *\n * @example\n * ```typescript\n * const stringType = new ResourcefulStringType({ minLength: 1, maxLength: 100 })\n * const stringType2 = ResourcefulStringType({ pattern: '^[a-zA-Z]+$' })\n * ```\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport const ResourcefulStringType = generateResourcefulDataTypeClass<ResourcefulStringTypeOptions>(\n 'ResourcefulStringType',\n 'string',\n ResourcefulStringTypeSchema\n)\n\n/**\n * Instance type for ResourcefulStringType with validated properties.\n * Represents a string data type with validation constraints as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport interface ResourcefulStringType extends ResourcefulStringTypeOptions {\n type: 'string'\n}\n\n/**\n * Configuration options for ResourcefulDateType instances.\n * Represents date-only values formatted as ISO 8601 date strings.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport interface ResourcefulDateTypeOptions extends BaseInterface {\n autoCreate?: boolean\n autoUpdate?: boolean\n}\n\n/**\n * Callable constructor for creating validated date type instances.\n * Automatically sets the OpenAPI format to 'date' for ISO 8601 date strings.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport const ResourcefulDateType = generateResourcefulDataTypeClass<ResourcefulDateTypeOptions>(\n 'ResourcefulDateType',\n 'string',\n ResourcefulDateTypeSchema,\n { format: 'date' }\n)\n\n/**\n * Instance type for ResourcefulDateType with validated properties.\n * Represents a date-only value formatted as ISO 8601 date string as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport interface ResourcefulDateType extends ResourcefulDateTypeOptions {\n type: 'string'\n format: 'date'\n}\n\n/**\n * Configuration options for ResourcefulDateTimeType instances.\n * Represents date-time values formatted as ISO 8601 date-time strings.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport interface ResourcefulDateTimeTypeOptions extends BaseInterface {\n autoCreate?: boolean\n autoUpdate?: boolean\n}\n\n/**\n * Callable constructor for creating validated date-time type instances.\n * Automatically sets the OpenAPI format to 'date-time' for ISO 8601 date-time strings.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport const ResourcefulDateTimeType =\n generateResourcefulDataTypeClass<ResourcefulDateTimeTypeOptions>(\n 'ResourcefulDateTimeType',\n 'string',\n ResourcefulDateTimeTypeSchema,\n { format: 'date-time' }\n )\n\n/**\n * Instance type for ResourcefulDateTimeType with validated properties.\n * Represents a date-time value formatted as ISO 8601 date-time string as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport interface ResourcefulDateTimeType extends ResourcefulDateTimeTypeOptions {\n type: 'string'\n format: 'date-time'\n}\n\n/**\n * Configuration options for ResourcefulBinaryType instances.\n * Defines constraints for binary data represented as base64-encoded strings.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport interface ResourcefulBinaryTypeOptions extends BaseInterface {\n /** Minimum length constraint for the base64-encoded binary data */\n minLength: number\n /** Maximum length constraint for the base64-encoded binary data */\n maxLength: number\n}\n\n/**\n * Callable constructor for creating validated binary type instances.\n * Automatically sets the OpenAPI format to 'binary' for base64-encoded binary data.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport const ResourcefulBinaryType = generateResourcefulDataTypeClass<ResourcefulBinaryTypeOptions>(\n 'ResourcefulBinaryType',\n 'string',\n ResourcefulBinaryTypeSchema,\n { format: 'binary' }\n)\n\n/**\n * Instance type for ResourcefulBinaryType with validated properties.\n * Represents binary data as base64-encoded string as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type}\n */\nexport interface ResourcefulBinaryType extends ResourcefulBinaryTypeOptions {\n type: 'string'\n format: 'binary'\n}\n\n/**\n * Supported number formats for ResourcefulNumberType, following OpenAPI 3.0 specification.\n * These formats provide additional precision and validation for numeric fields.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Number Type}\n */\nexport const ResourcefulNumberFormat = ['float' as 'float', 'double' as 'double']\n\n/**\n * Union type of supported number formats for ResourcefulNumberType.\n * Used to provide type safety when specifying numeric field formats.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Number Type}\n */\nexport type ResourcefulNumberFormat = (typeof ResourcefulNumberFormat)[number]\n\n/**\n * Configuration options for ResourcefulNumberType instances.\n * Defines validation rules and constraints for numeric fields in OpenAPI schemas.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Number Type}\n */\nexport interface ResourcefulNumberTypeOptions extends BaseInterface {\n /** Minimum value constraint for the number */\n minimum: number\n /** Whether the minimum value is exclusive (value must be greater than minimum) */\n exclusiveMinimum: boolean\n /** Maximum value constraint for the number */\n maximum: number\n /** Whether the maximum value is exclusive (value must be less than maximum) */\n exclusiveMaximum: boolean\n /** Number format specification for precision (float or double) */\n format: ResourcefulNumberFormat\n /** Value must be a multiple of this number */\n multipleOf: number\n}\n\n/**\n * Callable constructor for creating validated number type instances.\n * Supports floating-point numbers with configurable precision and range constraints.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Number Type}\n */\nexport const ResourcefulNumberType = generateResourcefulDataTypeClass<ResourcefulNumberTypeOptions>(\n 'ResourcefulNumberType',\n 'number',\n ResourcefulNumberTypeSchema\n)\n\n/**\n * Instance type for ResourcefulNumberType with validated properties.\n * Represents floating-point numbers as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Number Type}\n */\nexport interface ResourcefulNumberType extends ResourcefulNumberTypeOptions {\n type: 'number'\n}\n\n/**\n * Configuration options for ResourcefulIntegerType instances.\n * Defines validation rules and constraints for 32-bit integer fields in OpenAPI schemas.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type}\n */\nexport interface ResourcefulIntegerTypeOptions extends BaseInterface {\n /** Minimum value constraint for the integer */\n minimum: number\n /** Whether the minimum value is exclusive (value must be greater than minimum) */\n exclusiveMinimum: boolean\n /** Maximum value constraint for the integer */\n maximum: number\n /** Whether the maximum value is exclusive (value must be less than maximum) */\n exclusiveMaximum: boolean\n /** Value must be a multiple of this number */\n multipleOf: number\n}\n\n/**\n * Callable constructor for creating validated integer type instances.\n * Automatically sets the OpenAPI format to 'int32' for 32-bit signed integers.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type}\n */\nexport const ResourcefulIntegerType =\n generateResourcefulDataTypeClass<ResourcefulIntegerTypeOptions>(\n 'ResourcefulIntegerType',\n 'integer',\n ResourcefulIntegerTypeSchema,\n { format: 'int32' }\n )\n\n/**\n * Instance type for ResourcefulIntegerType with validated properties.\n * Represents 32-bit signed integers as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type}\n */\nexport interface ResourcefulIntegerType extends ResourcefulIntegerTypeOptions {\n type: 'integer'\n format: 'int32'\n}\n\n/**\n * Configuration options for ResourcefulBigintType instances.\n * Defines validation rules and constraints for 64-bit integer fields in OpenAPI schemas.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type}\n */\nexport interface ResourcefulBigintTypeOptions extends BaseInterface {\n /** Minimum value constraint for the 64-bit integer */\n minimum: bigint\n /** Whether the minimum value is exclusive (value must be greater than minimum) */\n exclusiveMinimum: boolean\n /** Maximum value constraint for the 64-bit integer */\n maximum: bigint\n /** Whether the maximum value is exclusive (value must be less than maximum) */\n exclusiveMaximum: boolean\n /** Value must be a multiple of this number */\n multipleOf: bigint\n}\n\n/**\n * Callable constructor for creating validated bigint type instances.\n * Automatically sets the OpenAPI format to 'int64' for 64-bit signed integers.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type}\n */\nexport const ResourcefulBigintType = generateResourcefulDataTypeClass<ResourcefulBigintTypeOptions>(\n 'ResourcefulBigintType',\n 'integer',\n ResourcefulBigintTypeSchema,\n { format: 'int64' }\n)\n\n/**\n * Instance type for ResourcefulBigintType with validated properties.\n * Represents 64-bit signed integers as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type}\n */\nexport interface ResourcefulBigintType extends ResourcefulBigintTypeOptions {\n type: 'integer'\n format: 'int64'\n}\n\n/**\n * Configuration options for ResourcefulUnsignedIntegerType instances.\n * Defines validation rules and constraints for unsigned integer fields in OpenAPI schemas.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type}\n */\nexport interface ResourcefulUnsignedIntegerTypeOptions extends BaseInterface {\n /** Minimum value constraint for the unsigned integer */\n minimum: number\n /** Whether the minimum value is exclusive (value must be greater than minimum) */\n exclusiveMinimum: boolean\n /** Maximum value constraint for the unsigned integer */\n maximum: number\n /** Whether the maximum value is exclusive (value must be less than maximum) */\n exclusiveMaximum: boolean\n /** Value must be a multiple of this number */\n multipleOf: number\n}\n\n/**\n * Callable constructor for creating validated unsigned integer type instances.\n * Represents unsigned integers without a specific OpenAPI format constraint.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type}\n */\nexport const ResourcefulUnsignedIntegerType =\n generateResourcefulDataTypeClass<ResourcefulUnsignedIntegerTypeOptions>(\n 'ResourcefulUnsignedIntegerType',\n 'integer',\n ResourcefulUnsignedIntegerTypeSchema\n )\n\n/**\n * Instance type for ResourcefulUnsignedIntegerType with validated properties.\n * Represents unsigned integers as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type}\n */\nexport interface ResourcefulUnsignedIntegerType extends ResourcefulUnsignedIntegerTypeOptions {\n type: 'integer'\n format: never\n}\n\n/**\n * Configuration options for ResourcefulBooleanType instances.\n * Currently has no specific configuration options as boolean types are straightforward.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#boolean | OpenAPI 3.0 Boolean Type}\n */\nexport interface ResourcefulBooleanTypeOptions extends BaseInterface {}\n\n/**\n * Callable constructor for creating validated boolean type instances.\n * Represents simple true/false values in OpenAPI schemas.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#boolean | OpenAPI 3.0 Boolean Type}\n */\nexport const ResourcefulBooleanType =\n generateResourcefulDataTypeClass<ResourcefulBooleanTypeOptions>(\n 'ResourcefulBooleanType',\n 'boolean',\n ResourcefulBooleanTypeSchema\n )\n\n/**\n * Instance type for ResourcefulBooleanType with validated properties.\n * Represents boolean true/false values as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#boolean | OpenAPI 3.0 Boolean Type}\n */\nexport interface ResourcefulBooleanType extends ResourcefulBooleanTypeOptions {\n type: 'boolean'\n}\n\n/**\n * Configuration options for ResourcefulObjectType instances.\n * Defines complex object schemas with typed properties and validation rules.\n * Supports advanced OpenAPI features like oneOf, allOf, anyOf, and not operators.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#object | OpenAPI 3.0 Object Type}\n */\nexport interface ResourcefulObjectTypeOptions extends BaseInterface {\n /** Object properties definition supporting direct data types and composition patterns */\n properties: {\n [key: string]:\n | ResourcefulDataType\n | { oneOf: Array<ResourcefulDataType> }\n | { allOf: Array<ResourcefulDataType> }\n | { anyOf: Array<ResourcefulDataType> }\n | { not: Array<ResourcefulDataType> }\n }\n /** Array of property names that are required for object validation */\n required?: string[]\n /** Whether additional properties beyond those defined are allowed, or direct data type for additional properties */\n additionalProperties?: boolean | ResourcefulDataType\n /** Minimum number of properties required in the object */\n minProperties?: number\n /** Maximum number of properties allowed in the object */\n maxProperties?: number\n}\n\n/**\n * Callable constructor for creating validated object type instances.\n * Supports complex nested object schemas with property validation and constraints.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#object | OpenAPI 3.0 Object Type}\n */\nexport const ResourcefulObjectType = generateResourcefulDataTypeClass<ResourcefulObjectTypeOptions>(\n 'ResourcefulObjectType',\n 'object',\n ResourcefulObjectTypeSchema\n)\n\n/**\n * Instance type for ResourcefulObjectType with validated properties.\n * Represents complex object schemas with typed properties as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#object | OpenAPI 3.0 Object Type}\n */\nexport interface ResourcefulObjectType extends ResourcefulObjectTypeOptions {\n type: 'object'\n}\n\n/**\n * Configuration options for ResourcefulArrayType instances.\n * Defines array schemas with typed items and validation constraints.\n * Supports complex item types including nested objects and arrays.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#array | OpenAPI 3.0 Array Type}\n */\nexport interface ResourcefulArrayTypeOptions extends BaseInterface {\n /** Type specification for array items, supporting all resourceful data types and composition patterns */\n items:\n | ResourcefulDataType\n | { oneOf: Array<ResourcefulDataType> }\n | { allOf: Array<ResourcefulDataType> }\n | { anyOf: Array<ResourcefulDataType> }\n | { not: Array<ResourcefulDataType> }\n /** Minimum number of items required in the array */\n minItems?: number\n /** Maximum number of items allowed in the array */\n maxItems?: number\n /** Whether all items in the array must be unique */\n uniqueItems?: boolean\n}\n\n/**\n * Callable constructor for creating validated array type instances.\n * Supports arrays with typed items and validation constraints like minimum/maximum length.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#array | OpenAPI 3.0 Array Type}\n */\nexport const ResourcefulArrayType = generateResourcefulDataTypeClass<ResourcefulArrayTypeOptions>(\n 'ResourcefulArrayType',\n 'array',\n ResourcefulArrayTypeSchema\n)\n\n/**\n * Instance type for ResourcefulArrayType with validated properties.\n * Represents arrays with typed items and validation constraints as defined in the OpenAPI 3.0 specification.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#array | OpenAPI 3.0 Array Type}\n */\nexport interface ResourcefulArrayType extends ResourcefulArrayTypeOptions {\n type: 'array'\n}\n\n/**\n * Union type representing all available resourceful data types.\n * Provides a comprehensive type for working with any resourceful data type instance.\n *\n * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/ | OpenAPI 3.0 Data Types}\n */\nexport type ResourcefulDataType =\n | ResourcefulStringType\n | ResourcefulDateType\n | ResourcefulDateTimeType\n | ResourcefulBinaryType\n | ResourcefulNumberType\n | ResourcefulIntegerType\n | ResourcefulBigintType\n | ResourcefulUnsignedIntegerType\n | ResourcefulBooleanType\n | ResourcefulObjectType\n | ResourcefulArrayType\n"],"names":[],"mappings":";;AA6DA,MAAM,mCAAmC,CAIvC,M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A;AACF;AAyCO,MAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AACF;;;;;;;;;;;;;;;"}
|
package/definitions.mjs
CHANGED
|
@@ -3809,10 +3809,10 @@ export {
|
|
|
3809
3809
|
E_ODATA_FILTER_INVALID_COMPARISON_SIDE as a7,
|
|
3810
3810
|
E_ODATA_FILTER_UNSUPPORTED_FUNCTION_COMPARISON as a8,
|
|
3811
3811
|
E_ODATA_FILTER_EXPECTED_COLUMN_REFERENCE as a9,
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3812
|
+
E_UNACCEPTABLE_FORMAT as aa,
|
|
3813
|
+
E_EXPAND_NOT_IMPLEMENTED as ab,
|
|
3814
|
+
E_UNSUPPORTED_DATABASE_DIALECT as ac,
|
|
3815
|
+
E_INVALID_ENTITYSET_IDENTIFIERS as ad,
|
|
3816
3816
|
libErrors as ae,
|
|
3817
3817
|
E_INVALID_LUCENE_QUERY as af,
|
|
3818
3818
|
E_UNEXPECTED_COLUMN_IN_QUERY as ag,
|
|
@@ -3857,4 +3857,4 @@ export {
|
|
|
3857
3857
|
E_INVALID_PAYLOAD_EXCEPTION as y,
|
|
3858
3858
|
operationCRUDToACL as z
|
|
3859
3859
|
};
|
|
3860
|
-
//# sourceMappingURL=errors-
|
|
3860
|
+
//# sourceMappingURL=errors-D39NvW3e.js.map
|