@freshpointcz/fresh-core 0.0.20 → 0.0.21
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/dist/index.d.mts +47 -2
- package/dist/index.d.ts +47 -2
- package/dist/index.js +1059 -1006
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1057 -1007
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseEntity, ColumnOptions, Repository, EntityTarget, EntityManager, ObjectLiteral, EntitySubscriberInterface, InsertEvent, UpdateEvent, SoftRemoveEvent, TransactionCommitEvent, DataSourceOptions } from 'typeorm';
|
|
1
|
+
import { FindOperator, BaseEntity, FindOptionsOrder, ColumnOptions, Repository, EntityTarget, EntityManager, ObjectLiteral, EntitySubscriberInterface, InsertEvent, UpdateEvent, SoftRemoveEvent, TransactionCommitEvent, DataSourceOptions } from 'typeorm';
|
|
2
2
|
import dayjs, { Dayjs } from 'dayjs';
|
|
3
3
|
import { Job } from 'node-schedule';
|
|
4
4
|
import * as _eslint_core from '@eslint/core';
|
|
@@ -54,6 +54,36 @@ declare class StatusDto {
|
|
|
54
54
|
constructor(status: Status, details?: string, timestamp?: string);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Converts optional date range strings into a TypeORM `FindOperator<Date>`.
|
|
59
|
+
*
|
|
60
|
+
* - Both provided → `Between(from, to)`
|
|
61
|
+
* - Only `from` → `MoreThanOrEqual(from)`
|
|
62
|
+
* - Only `to` → `LessThanOrEqual(to)`
|
|
63
|
+
* - Neither → `undefined`
|
|
64
|
+
*
|
|
65
|
+
* @param from - ISO date string for the lower bound (inclusive).
|
|
66
|
+
* @param to - ISO date string for the upper bound (inclusive).
|
|
67
|
+
* @returns A TypeORM date range operator, or `undefined` if no bounds are provided.
|
|
68
|
+
*/
|
|
69
|
+
declare function buildDateRange(from?: string, to?: string): FindOperator<Date> | undefined;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Converts optional sort query params into a TypeORM `FindOptionsOrder` object.
|
|
73
|
+
*
|
|
74
|
+
* Defaults to `ASC` if `sortBy` is provided but `sortOrder` is omitted.
|
|
75
|
+
* Returns `undefined` if no sort field is specified, leaving the order to TypeORM's default.
|
|
76
|
+
*
|
|
77
|
+
* @param sortBy - Entity field to sort by.
|
|
78
|
+
* @param sortOrder - Sort direction. Defaults to `"ASC"`.
|
|
79
|
+
* @returns A `FindOptionsOrder` object, or `undefined` if `sortBy` is not provided.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* buildOrder("createdAt", "DESC") // → { createdAt: "DESC" }
|
|
83
|
+
* buildOrder() // → undefined
|
|
84
|
+
*/
|
|
85
|
+
declare function buildOrder<TEntity extends BaseEntity, TSortableFields extends keyof TEntity>(sortBy?: TSortableFields, sortOrder?: "ASC" | "DESC"): FindOptionsOrder<TEntity> | undefined;
|
|
86
|
+
|
|
57
87
|
/**
|
|
58
88
|
* Pagination parameters used to describe the current page slice of a query.
|
|
59
89
|
*
|
|
@@ -122,6 +152,21 @@ declare function getPaginationParams(params?: Partial<PaginationParams>): Pagina
|
|
|
122
152
|
*/
|
|
123
153
|
declare const DEFAULT_PAGINATION_PARAMS: PaginationParams;
|
|
124
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Converts optional pagination query params into a `PaginationParams` object
|
|
157
|
+
* with a pre-calculated `skip` offset for TypeORM queries.
|
|
158
|
+
*
|
|
159
|
+
* Defaults to page `1` and limit `1000` if only one side is provided.
|
|
160
|
+
* Returns `undefined` if neither param is present, allowing the caller
|
|
161
|
+
* to opt out of pagination entirely.
|
|
162
|
+
*
|
|
163
|
+
* @param page - 1-based page number. Must be ≥ 1 if provided.
|
|
164
|
+
* @param limit - Maximum number of records per page. Must be ≥ 0 if provided.
|
|
165
|
+
* @returns Resolved `PaginationParams` with `skip`, or `undefined` if both params are absent.
|
|
166
|
+
* @throws {ApiError} `400 BAD_REQUEST` if `page < 1` or `limit < 0`.
|
|
167
|
+
*/
|
|
168
|
+
declare function buildPagination(page?: number, limit?: number): PaginationParams | undefined;
|
|
169
|
+
|
|
125
170
|
/**
|
|
126
171
|
* Converts {@link PaginationParams} into the `take`/`skip` shape expected by
|
|
127
172
|
* TypeORM's `find`, `findAndCount`, and `findOne` options.
|
|
@@ -1317,4 +1362,4 @@ interface HealthCheckResult {
|
|
|
1317
1362
|
};
|
|
1318
1363
|
}
|
|
1319
1364
|
|
|
1320
|
-
export { AMOUNT_UNIT, ActionCommandCode, ApiError, BadGatewayError, BadRequestError, BaseEntityChangeSubscriber, type BinaryFlag, BusinessWarning, type CardNumber, Category, ConflictError, DEFAULT_PAGINATION_PARAMS, DataHelper, DateUtils, type Deferred, DepotPoolStatus, Device, type EntityChangeEvent, ExpectationFailedError, FailedDependencyError, ForbiddenError, FreshDao, FreshEntity, FreshError, type FreshErrorOptions, FreshHyperEntity, FreshJob, FreshTranslationBase, GatewayTimeoutError, GoneError, type HealthCheckResult, HttpStatus, HttpVersionNotSupportedError, ImATeapotError, InsufficientStorageError, InternalServerError, type IsDecimalOptions, LanguageCode, LengthRequiredError, LockedError, LoopDetectedError, Manufacturer, type Maybe, MethodNotAllowedError, MisdirectedRequestError, NetworkAuthenticationRequiredError, NotAcceptableError, NotExtendedError, NotFoundError, NotImplementedError, type PaginatedList, type PaginationMeta, type PaginationParams, PayloadTooLargeError, PaymentMethod, PaymentRequiredError, PG_DATA_SOURCE_OPTIONS as PgDataSourceOptions, PreconditionFailedError, PreconditionRequiredError, Product, ProxyAuthenticationRequiredError, RangeNotSatisfiableError, RequestHeaderFieldsTooLargeError, RequestTimeoutError, ServiceUnavailableError, SinglePromiseWaiter, Singleton, type Status, StatusDto, Subcategory, TO_BINARY_FLAG, TimestampColumn, TooEarlyError, TooManyRequestsError, TransactionType, UnauthorizedError, UnavailableForLegalReasonsError, UnprocessableEntityError, UnsupportedMediaTypeError, UpgradeRequiredError, UriTooLongError, VariantAlsoNegotiatesError, buildPatch, constructTypeormPagination, createDeferred, FRESH_ESLINT_CONFIG as freshEslintConfig, getPaginationMeta, getPaginationParams, hasOwn, isDecimal, isEnumValue, isFlag01, isMaybe, isNumber, isNumberInRange, isObject, isString, isValidCron, listAll, parsePaginationFromURL, resolvePathParameterId, runWithConcurrency, toDecimal };
|
|
1365
|
+
export { AMOUNT_UNIT, ActionCommandCode, ApiError, BadGatewayError, BadRequestError, BaseEntityChangeSubscriber, type BinaryFlag, BusinessWarning, type CardNumber, Category, ConflictError, DEFAULT_PAGINATION_PARAMS, DataHelper, DateUtils, type Deferred, DepotPoolStatus, Device, type EntityChangeEvent, ExpectationFailedError, FailedDependencyError, ForbiddenError, FreshDao, FreshEntity, FreshError, type FreshErrorOptions, FreshHyperEntity, FreshJob, FreshTranslationBase, GatewayTimeoutError, GoneError, type HealthCheckResult, HttpStatus, HttpVersionNotSupportedError, ImATeapotError, InsufficientStorageError, InternalServerError, type IsDecimalOptions, LanguageCode, LengthRequiredError, LockedError, LoopDetectedError, Manufacturer, type Maybe, MethodNotAllowedError, MisdirectedRequestError, NetworkAuthenticationRequiredError, NotAcceptableError, NotExtendedError, NotFoundError, NotImplementedError, type PaginatedList, type PaginationMeta, type PaginationParams, PayloadTooLargeError, PaymentMethod, PaymentRequiredError, PG_DATA_SOURCE_OPTIONS as PgDataSourceOptions, PreconditionFailedError, PreconditionRequiredError, Product, ProxyAuthenticationRequiredError, RangeNotSatisfiableError, RequestHeaderFieldsTooLargeError, RequestTimeoutError, ServiceUnavailableError, SinglePromiseWaiter, Singleton, type Status, StatusDto, Subcategory, TO_BINARY_FLAG, TimestampColumn, TooEarlyError, TooManyRequestsError, TransactionType, UnauthorizedError, UnavailableForLegalReasonsError, UnprocessableEntityError, UnsupportedMediaTypeError, UpgradeRequiredError, UriTooLongError, VariantAlsoNegotiatesError, buildDateRange, buildOrder, buildPagination, buildPatch, constructTypeormPagination, createDeferred, FRESH_ESLINT_CONFIG as freshEslintConfig, getPaginationMeta, getPaginationParams, hasOwn, isDecimal, isEnumValue, isFlag01, isMaybe, isNumber, isNumberInRange, isObject, isString, isValidCron, listAll, parsePaginationFromURL, resolvePathParameterId, runWithConcurrency, toDecimal };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseEntity, ColumnOptions, Repository, EntityTarget, EntityManager, ObjectLiteral, EntitySubscriberInterface, InsertEvent, UpdateEvent, SoftRemoveEvent, TransactionCommitEvent, DataSourceOptions } from 'typeorm';
|
|
1
|
+
import { FindOperator, BaseEntity, FindOptionsOrder, ColumnOptions, Repository, EntityTarget, EntityManager, ObjectLiteral, EntitySubscriberInterface, InsertEvent, UpdateEvent, SoftRemoveEvent, TransactionCommitEvent, DataSourceOptions } from 'typeorm';
|
|
2
2
|
import dayjs, { Dayjs } from 'dayjs';
|
|
3
3
|
import { Job } from 'node-schedule';
|
|
4
4
|
import * as _eslint_core from '@eslint/core';
|
|
@@ -54,6 +54,36 @@ declare class StatusDto {
|
|
|
54
54
|
constructor(status: Status, details?: string, timestamp?: string);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Converts optional date range strings into a TypeORM `FindOperator<Date>`.
|
|
59
|
+
*
|
|
60
|
+
* - Both provided → `Between(from, to)`
|
|
61
|
+
* - Only `from` → `MoreThanOrEqual(from)`
|
|
62
|
+
* - Only `to` → `LessThanOrEqual(to)`
|
|
63
|
+
* - Neither → `undefined`
|
|
64
|
+
*
|
|
65
|
+
* @param from - ISO date string for the lower bound (inclusive).
|
|
66
|
+
* @param to - ISO date string for the upper bound (inclusive).
|
|
67
|
+
* @returns A TypeORM date range operator, or `undefined` if no bounds are provided.
|
|
68
|
+
*/
|
|
69
|
+
declare function buildDateRange(from?: string, to?: string): FindOperator<Date> | undefined;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Converts optional sort query params into a TypeORM `FindOptionsOrder` object.
|
|
73
|
+
*
|
|
74
|
+
* Defaults to `ASC` if `sortBy` is provided but `sortOrder` is omitted.
|
|
75
|
+
* Returns `undefined` if no sort field is specified, leaving the order to TypeORM's default.
|
|
76
|
+
*
|
|
77
|
+
* @param sortBy - Entity field to sort by.
|
|
78
|
+
* @param sortOrder - Sort direction. Defaults to `"ASC"`.
|
|
79
|
+
* @returns A `FindOptionsOrder` object, or `undefined` if `sortBy` is not provided.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* buildOrder("createdAt", "DESC") // → { createdAt: "DESC" }
|
|
83
|
+
* buildOrder() // → undefined
|
|
84
|
+
*/
|
|
85
|
+
declare function buildOrder<TEntity extends BaseEntity, TSortableFields extends keyof TEntity>(sortBy?: TSortableFields, sortOrder?: "ASC" | "DESC"): FindOptionsOrder<TEntity> | undefined;
|
|
86
|
+
|
|
57
87
|
/**
|
|
58
88
|
* Pagination parameters used to describe the current page slice of a query.
|
|
59
89
|
*
|
|
@@ -122,6 +152,21 @@ declare function getPaginationParams(params?: Partial<PaginationParams>): Pagina
|
|
|
122
152
|
*/
|
|
123
153
|
declare const DEFAULT_PAGINATION_PARAMS: PaginationParams;
|
|
124
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Converts optional pagination query params into a `PaginationParams` object
|
|
157
|
+
* with a pre-calculated `skip` offset for TypeORM queries.
|
|
158
|
+
*
|
|
159
|
+
* Defaults to page `1` and limit `1000` if only one side is provided.
|
|
160
|
+
* Returns `undefined` if neither param is present, allowing the caller
|
|
161
|
+
* to opt out of pagination entirely.
|
|
162
|
+
*
|
|
163
|
+
* @param page - 1-based page number. Must be ≥ 1 if provided.
|
|
164
|
+
* @param limit - Maximum number of records per page. Must be ≥ 0 if provided.
|
|
165
|
+
* @returns Resolved `PaginationParams` with `skip`, or `undefined` if both params are absent.
|
|
166
|
+
* @throws {ApiError} `400 BAD_REQUEST` if `page < 1` or `limit < 0`.
|
|
167
|
+
*/
|
|
168
|
+
declare function buildPagination(page?: number, limit?: number): PaginationParams | undefined;
|
|
169
|
+
|
|
125
170
|
/**
|
|
126
171
|
* Converts {@link PaginationParams} into the `take`/`skip` shape expected by
|
|
127
172
|
* TypeORM's `find`, `findAndCount`, and `findOne` options.
|
|
@@ -1317,4 +1362,4 @@ interface HealthCheckResult {
|
|
|
1317
1362
|
};
|
|
1318
1363
|
}
|
|
1319
1364
|
|
|
1320
|
-
export { AMOUNT_UNIT, ActionCommandCode, ApiError, BadGatewayError, BadRequestError, BaseEntityChangeSubscriber, type BinaryFlag, BusinessWarning, type CardNumber, Category, ConflictError, DEFAULT_PAGINATION_PARAMS, DataHelper, DateUtils, type Deferred, DepotPoolStatus, Device, type EntityChangeEvent, ExpectationFailedError, FailedDependencyError, ForbiddenError, FreshDao, FreshEntity, FreshError, type FreshErrorOptions, FreshHyperEntity, FreshJob, FreshTranslationBase, GatewayTimeoutError, GoneError, type HealthCheckResult, HttpStatus, HttpVersionNotSupportedError, ImATeapotError, InsufficientStorageError, InternalServerError, type IsDecimalOptions, LanguageCode, LengthRequiredError, LockedError, LoopDetectedError, Manufacturer, type Maybe, MethodNotAllowedError, MisdirectedRequestError, NetworkAuthenticationRequiredError, NotAcceptableError, NotExtendedError, NotFoundError, NotImplementedError, type PaginatedList, type PaginationMeta, type PaginationParams, PayloadTooLargeError, PaymentMethod, PaymentRequiredError, PG_DATA_SOURCE_OPTIONS as PgDataSourceOptions, PreconditionFailedError, PreconditionRequiredError, Product, ProxyAuthenticationRequiredError, RangeNotSatisfiableError, RequestHeaderFieldsTooLargeError, RequestTimeoutError, ServiceUnavailableError, SinglePromiseWaiter, Singleton, type Status, StatusDto, Subcategory, TO_BINARY_FLAG, TimestampColumn, TooEarlyError, TooManyRequestsError, TransactionType, UnauthorizedError, UnavailableForLegalReasonsError, UnprocessableEntityError, UnsupportedMediaTypeError, UpgradeRequiredError, UriTooLongError, VariantAlsoNegotiatesError, buildPatch, constructTypeormPagination, createDeferred, FRESH_ESLINT_CONFIG as freshEslintConfig, getPaginationMeta, getPaginationParams, hasOwn, isDecimal, isEnumValue, isFlag01, isMaybe, isNumber, isNumberInRange, isObject, isString, isValidCron, listAll, parsePaginationFromURL, resolvePathParameterId, runWithConcurrency, toDecimal };
|
|
1365
|
+
export { AMOUNT_UNIT, ActionCommandCode, ApiError, BadGatewayError, BadRequestError, BaseEntityChangeSubscriber, type BinaryFlag, BusinessWarning, type CardNumber, Category, ConflictError, DEFAULT_PAGINATION_PARAMS, DataHelper, DateUtils, type Deferred, DepotPoolStatus, Device, type EntityChangeEvent, ExpectationFailedError, FailedDependencyError, ForbiddenError, FreshDao, FreshEntity, FreshError, type FreshErrorOptions, FreshHyperEntity, FreshJob, FreshTranslationBase, GatewayTimeoutError, GoneError, type HealthCheckResult, HttpStatus, HttpVersionNotSupportedError, ImATeapotError, InsufficientStorageError, InternalServerError, type IsDecimalOptions, LanguageCode, LengthRequiredError, LockedError, LoopDetectedError, Manufacturer, type Maybe, MethodNotAllowedError, MisdirectedRequestError, NetworkAuthenticationRequiredError, NotAcceptableError, NotExtendedError, NotFoundError, NotImplementedError, type PaginatedList, type PaginationMeta, type PaginationParams, PayloadTooLargeError, PaymentMethod, PaymentRequiredError, PG_DATA_SOURCE_OPTIONS as PgDataSourceOptions, PreconditionFailedError, PreconditionRequiredError, Product, ProxyAuthenticationRequiredError, RangeNotSatisfiableError, RequestHeaderFieldsTooLargeError, RequestTimeoutError, ServiceUnavailableError, SinglePromiseWaiter, Singleton, type Status, StatusDto, Subcategory, TO_BINARY_FLAG, TimestampColumn, TooEarlyError, TooManyRequestsError, TransactionType, UnauthorizedError, UnavailableForLegalReasonsError, UnprocessableEntityError, UnsupportedMediaTypeError, UpgradeRequiredError, UriTooLongError, VariantAlsoNegotiatesError, buildDateRange, buildOrder, buildPagination, buildPatch, constructTypeormPagination, createDeferred, FRESH_ESLINT_CONFIG as freshEslintConfig, getPaginationMeta, getPaginationParams, hasOwn, isDecimal, isEnumValue, isFlag01, isMaybe, isNumber, isNumberInRange, isObject, isString, isValidCron, listAll, parsePaginationFromURL, resolvePathParameterId, runWithConcurrency, toDecimal };
|