@candlerip/shared3 0.0.96 → 0.0.98

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. package/package.json +1 -1
  2. package/src/filter-sort/filter-sort/candle-filter-sort/domains/index.d.ts +12 -0
  3. package/src/filter-sort/filter-sort/candle-filter-sort/domains/index.js +1 -0
  4. package/src/filter-sort/filter-sort/candle-filter-sort/index.d.ts +1 -0
  5. package/src/filter-sort/filter-sort/candle-filter-sort/index.js +1 -0
  6. package/src/filter-sort/filter-sort/index.d.ts +2 -0
  7. package/src/filter-sort/filter-sort/index.js +2 -0
  8. package/src/filter-sort/filter-sort/person-filter-sort/domains/index.d.ts +14 -0
  9. package/src/filter-sort/filter-sort/person-filter-sort/domains/index.js +1 -0
  10. package/src/filter-sort/filter-sort/person-filter-sort/index.d.ts +1 -0
  11. package/src/filter-sort/filter-sort/person-filter-sort/index.js +1 -0
  12. package/src/filter-sort/index.d.ts +4 -0
  13. package/src/filter-sort/index.js +4 -0
  14. package/src/filter-sort/sort/domains/index.d.ts +5 -0
  15. package/src/filter-sort/sort/domains/index.js +1 -0
  16. package/src/filter-sort/sort/index.d.ts +1 -0
  17. package/src/filter-sort/sort/index.js +1 -0
  18. package/src/filter-sort/sort-name/candle-sort-name/configs/index.d.ts +1 -0
  19. package/src/filter-sort/sort-name/candle-sort-name/configs/index.js +1 -0
  20. package/src/filter-sort/sort-name/candle-sort-name/domains/index.d.ts +2 -0
  21. package/src/filter-sort/sort-name/candle-sort-name/domains/index.js +1 -0
  22. package/src/filter-sort/sort-name/candle-sort-name/index.d.ts +3 -0
  23. package/src/filter-sort/sort-name/candle-sort-name/index.js +3 -0
  24. package/src/filter-sort/sort-name/candle-sort-name/type-guards/index.d.ts +1 -0
  25. package/src/filter-sort/sort-name/candle-sort-name/type-guards/index.js +1 -0
  26. package/src/filter-sort/sort-name/candle-sort-name/type-guards/is-candle-sort-name/index.d.ts +2 -0
  27. package/src/filter-sort/sort-name/candle-sort-name/type-guards/is-candle-sort-name/index.js +4 -0
  28. package/src/filter-sort/sort-name/index.d.ts +2 -0
  29. package/src/filter-sort/sort-name/index.js +2 -0
  30. package/src/filter-sort/sort-name/person-sort-name/configs/index.d.ts +1 -0
  31. package/src/filter-sort/sort-name/person-sort-name/configs/index.js +1 -0
  32. package/src/filter-sort/sort-name/person-sort-name/domains/index.d.ts +2 -0
  33. package/src/filter-sort/sort-name/person-sort-name/domains/index.js +1 -0
  34. package/src/filter-sort/sort-name/person-sort-name/index.d.ts +3 -0
  35. package/src/filter-sort/sort-name/person-sort-name/index.js +3 -0
  36. package/src/filter-sort/sort-name/person-sort-name/type-guards/index.d.ts +1 -0
  37. package/src/filter-sort/sort-name/person-sort-name/type-guards/index.js +1 -0
  38. package/src/filter-sort/sort-name/person-sort-name/type-guards/is-person-sort-name/index.d.ts +2 -0
  39. package/src/filter-sort/sort-name/person-sort-name/type-guards/is-person-sort-name/index.js +4 -0
  40. package/src/filter-sort/sort-order/configs/index.d.ts +1 -0
  41. package/src/filter-sort/sort-order/configs/index.js +1 -0
  42. package/src/filter-sort/sort-order/domains/index.d.ts +2 -0
  43. package/src/filter-sort/sort-order/domains/index.js +1 -0
  44. package/src/filter-sort/sort-order/index.d.ts +3 -0
  45. package/src/filter-sort/sort-order/index.js +3 -0
  46. package/src/filter-sort/sort-order/type-guards/index.d.ts +1 -0
  47. package/src/filter-sort/sort-order/type-guards/index.js +1 -0
  48. package/src/filter-sort/sort-order/type-guards/is-sort-order/index.d.ts +2 -0
  49. package/src/filter-sort/sort-order/type-guards/is-sort-order/index.js +4 -0
  50. package/src/index.d.ts +1 -0
  51. package/src/index.js +1 -0
  52. package/src/type/array/index.d.ts +1 -0
  53. package/src/type/array/index.js +1 -0
  54. package/src/type/array/validate.d.ts +6 -0
  55. package/src/type/array/validate.js +16 -0
  56. package/src/type/string/index.d.ts +1 -0
  57. package/src/type/string/index.js +1 -0
  58. package/src/type/string/validate-comma-separated-string/index.d.ts +2 -0
  59. package/src/type/string/validate-comma-separated-string/index.js +17 -0
  60. package/src/type/string/validate-comma-separated-string/types.d.ts +6 -0
  61. package/src/type/string/validate-comma-separated-string/types.js +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@candlerip/shared3",
3
- "version": "0.0.96",
3
+ "version": "0.0.98",
4
4
  "type": "module",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -0,0 +1,12 @@
1
+ import { BurningCandleState } from '../../../../candle/index.js';
2
+ import { CandleSortName } from '../../../sort-name/index.js';
3
+ import { SortOrder } from '../../../sort-order/index.js';
4
+ export interface CandleFilterSort {
5
+ count: number;
6
+ burning_states?: BurningCandleState[];
7
+ person_id?: string;
8
+ skip_count?: number;
9
+ sort_name: CandleSortName;
10
+ sort_order: SortOrder;
11
+ user_id?: string;
12
+ }
@@ -0,0 +1 @@
1
+ export * from './domains/index.js';
@@ -0,0 +1 @@
1
+ export * from './domains/index.js';
@@ -0,0 +1,2 @@
1
+ export * from './candle-filter-sort/index.js';
2
+ export * from './person-filter-sort/index.js';
@@ -0,0 +1,2 @@
1
+ export * from './candle-filter-sort/index.js';
2
+ export * from './person-filter-sort/index.js';
@@ -0,0 +1,14 @@
1
+ import { CountryCode } from '../../../../geographical/index.js';
2
+ import { PersonSortName } from '../../../sort-name/index.js';
3
+ import { SortOrder } from '../../../sort-order/index.js';
4
+ export interface PersonFilterSort {
5
+ count: number;
6
+ name?: string;
7
+ name_case_sensitive?: boolean;
8
+ place_of_births?: CountryCode[];
9
+ skip_count?: number;
10
+ sort_name: PersonSortName;
11
+ sort_order: SortOrder;
12
+ user_id?: string;
13
+ with_photo?: boolean;
14
+ }
@@ -0,0 +1 @@
1
+ export * from './domains/index.js';
@@ -0,0 +1 @@
1
+ export * from './domains/index.js';
@@ -0,0 +1,4 @@
1
+ export * from './filter-sort/index.js';
2
+ export * from './sort/index.js';
3
+ export * from './sort-name/index.js';
4
+ export * from './sort-order/index.js';
@@ -0,0 +1,4 @@
1
+ export * from './filter-sort/index.js';
2
+ export * from './sort/index.js';
3
+ export * from './sort-name/index.js';
4
+ export * from './sort-order/index.js';
@@ -0,0 +1,5 @@
1
+ import { SortOrder } from '../../sort-order/index.js';
2
+ export type Sort<T> = {
3
+ name: T;
4
+ order: SortOrder;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './domains/index.js';
@@ -0,0 +1 @@
1
+ export * from './domains/index.js';
@@ -0,0 +1 @@
1
+ export declare const CANDLE_SORT_NAMES: readonly ["burningEndsAt", "createdAt", "litAt", "litName"];
@@ -0,0 +1 @@
1
+ export const CANDLE_SORT_NAMES = ['burningEndsAt', 'createdAt', 'litAt', 'litName'];
@@ -0,0 +1,2 @@
1
+ import { CANDLE_SORT_NAMES } from '../configs/index.js';
2
+ export type CandleSortName = (typeof CANDLE_SORT_NAMES)[number];
@@ -0,0 +1,3 @@
1
+ export * from './configs/index.js';
2
+ export * from './domains/index.js';
3
+ export * from './type-guards/index.js';
@@ -0,0 +1,3 @@
1
+ export * from './configs/index.js';
2
+ export * from './domains/index.js';
3
+ export * from './type-guards/index.js';
@@ -0,0 +1 @@
1
+ export * from './is-candle-sort-name/index.js';
@@ -0,0 +1 @@
1
+ export * from './is-candle-sort-name/index.js';
@@ -0,0 +1,2 @@
1
+ import { CandleSortName } from '../../domains/index.js';
2
+ export declare const isCandleSortName: (data?: unknown) => data is CandleSortName;
@@ -0,0 +1,4 @@
1
+ import { CANDLE_SORT_NAMES } from '../../configs/index.js';
2
+ export const isCandleSortName = (data) => {
3
+ return CANDLE_SORT_NAMES.some((it) => data === it);
4
+ };
@@ -0,0 +1,2 @@
1
+ export * from './candle-sort-name/index.js';
2
+ export * from './person-sort-name/index.js';
@@ -0,0 +1,2 @@
1
+ export * from './candle-sort-name/index.js';
2
+ export * from './person-sort-name/index.js';
@@ -0,0 +1 @@
1
+ export declare const PERSON_SORT_NAMES: readonly ["createdAt", "name"];
@@ -0,0 +1 @@
1
+ export const PERSON_SORT_NAMES = ['createdAt', 'name'];
@@ -0,0 +1,2 @@
1
+ import { PERSON_SORT_NAMES } from '../configs/index.js';
2
+ export type PersonSortName = (typeof PERSON_SORT_NAMES)[number];
@@ -0,0 +1,3 @@
1
+ export * from './configs/index.js';
2
+ export * from './domains/index.js';
3
+ export * from './type-guards/index.js';
@@ -0,0 +1,3 @@
1
+ export * from './configs/index.js';
2
+ export * from './domains/index.js';
3
+ export * from './type-guards/index.js';
@@ -0,0 +1 @@
1
+ export * from './is-person-sort-name/index.js';
@@ -0,0 +1 @@
1
+ export * from './is-person-sort-name/index.js';
@@ -0,0 +1,2 @@
1
+ import { PersonSortName } from '../../domains/index.js';
2
+ export declare const isPersonSortName: (data?: unknown) => data is PersonSortName;
@@ -0,0 +1,4 @@
1
+ import { PERSON_SORT_NAMES } from '../../configs/index.js';
2
+ export const isPersonSortName = (data) => {
3
+ return PERSON_SORT_NAMES.some((it) => data === it);
4
+ };
@@ -0,0 +1 @@
1
+ export declare const SORT_ORDERS: readonly ["asc", "desc"];
@@ -0,0 +1 @@
1
+ export const SORT_ORDERS = ['asc', 'desc'];
@@ -0,0 +1,2 @@
1
+ import { SORT_ORDERS } from '../configs/index.js';
2
+ export type SortOrder = (typeof SORT_ORDERS)[number];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './configs/index.js';
2
+ export * from './domains/index.js';
3
+ export * from './type-guards/index.js';
@@ -0,0 +1,3 @@
1
+ export * from './configs/index.js';
2
+ export * from './domains/index.js';
3
+ export * from './type-guards/index.js';
@@ -0,0 +1 @@
1
+ export * from './is-sort-order/index.js';
@@ -0,0 +1 @@
1
+ export * from './is-sort-order/index.js';
@@ -0,0 +1,2 @@
1
+ import { SortOrder } from '../../domains/index.js';
2
+ export declare const isSortOrder: (data?: unknown) => data is SortOrder;
@@ -0,0 +1,4 @@
1
+ import { SORT_ORDERS } from '../../configs/index.js';
2
+ export const isSortOrder = (data) => {
3
+ return SORT_ORDERS.some((it) => data === it);
4
+ };
package/src/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from './database/index.js';
6
6
  export * from './date/index.js';
7
7
  export * from './environment/index.js';
8
8
  export * from './error/index.js';
9
+ export * from './filter-sort/index.js';
9
10
  export * from './geographical/index.js';
10
11
  export * from './helper/index.js';
11
12
  export * from './image/index.js';
package/src/index.js CHANGED
@@ -6,6 +6,7 @@ export * from './database/index.js';
6
6
  export * from './date/index.js';
7
7
  export * from './environment/index.js';
8
8
  export * from './error/index.js';
9
+ export * from './filter-sort/index.js';
9
10
  export * from './geographical/index.js';
10
11
  export * from './helper/index.js';
11
12
  export * from './image/index.js';
@@ -1 +1,2 @@
1
1
  export * from './type-guard.js';
2
+ export * from './validate.js';
@@ -1 +1,2 @@
1
1
  export * from './type-guard.js';
2
+ export * from './validate.js';
@@ -0,0 +1,6 @@
1
+ import { CustomError } from '../../error/index.js';
2
+ export declare const validateArray: <T>(data: unknown, name: string, valid: readonly T[]) => {
3
+ data: T[];
4
+ } | {
5
+ customError: CustomError;
6
+ };
@@ -0,0 +1,16 @@
1
+ import { customErrorWorker } from '../../error/index.js';
2
+ export const validateArray = (data, name, valid) => {
3
+ const { composeCustomError } = customErrorWorker({ data, name, valid });
4
+ if (!data) {
5
+ return composeCustomError(`Missing ${name}`);
6
+ }
7
+ if (!Array.isArray(data)) {
8
+ return composeCustomError(`Invalid ${name}`);
9
+ }
10
+ if (!data.every((it) => valid.includes(it))) {
11
+ return composeCustomError(`Invalid ${name}`);
12
+ }
13
+ return {
14
+ data,
15
+ };
16
+ };
@@ -1,2 +1,3 @@
1
1
  export * from './type-guard.js';
2
2
  export * from './validate.js';
3
+ export * from './validate-comma-separated-string/index.js';
@@ -1,2 +1,3 @@
1
1
  export * from './type-guard.js';
2
2
  export * from './validate.js';
3
+ export * from './validate-comma-separated-string/index.js';
@@ -0,0 +1,2 @@
1
+ import { ValidateCommaSeparatedString } from './types.js';
2
+ export declare const validateCommaSeparatedString: ValidateCommaSeparatedString;
@@ -0,0 +1,17 @@
1
+ import { customErrorWorker } from '../../../error/index.js';
2
+ import { validateArray } from '../../array/index.js';
3
+ import { isString } from '../type-guard.js';
4
+ export const validateCommaSeparatedString = (data, name, valid) => {
5
+ const { composeCustomError } = customErrorWorker({ data, name, valid });
6
+ if (!data) {
7
+ return composeCustomError(`Missing ${name}`);
8
+ }
9
+ if (!isString(data)) {
10
+ return composeCustomError(`${name} not string`);
11
+ }
12
+ const parsedArr = data.split(',');
13
+ if (parsedArr.length === 0) {
14
+ return composeCustomError(`Invalid ${name}`);
15
+ }
16
+ return validateArray(parsedArr, name, valid);
17
+ };
@@ -0,0 +1,6 @@
1
+ import { CustomError } from '../../../error/index.js';
2
+ export type ValidateCommaSeparatedString = <T>(data: unknown, name: string, valid: readonly T[]) => {
3
+ data: T[];
4
+ } | {
5
+ customError: CustomError;
6
+ };