@dcupl/common 0.0.81-beta.0 → 0.0.81-beta.2

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.
@@ -50,26 +50,59 @@ export type DcuplGlobalQueryOptions<T> = DcuplItemsOptions<T> & {
50
50
  listKey: string;
51
51
  query: FilterOptions[];
52
52
  };
53
- type DcuplQueryTransformOptions = 'none' | 'lowercase' | 'uppercase' | 'trim' | 'removeWhitespace';
53
+ export type DcuplQueryTransformOptions = 'lowercase' | 'trim' | 'removeWhitespace';
54
54
  type DcuplQueryOptions = {
55
- transform: DcuplQueryTransformOptions[];
55
+ transform?: DcuplQueryTransformOptions[];
56
+ /**
57
+ * Invert possible for eq, typeof
58
+ */
59
+ invert?: boolean;
56
60
  };
57
- type DcuplQueryArrayOperators = 'in' | 'nin';
58
- type DcuplQueryStringOperators = 'startsWith' | 'endsWith' | 'includes' | 'notIncludes';
59
- type DcuplQueryGeneralOperators = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte';
60
- type DcuplQueryFalsy = 'isUndefined' | 'isNotUndefined' | 'isNull' | 'isNotNull' | 'isFalsy' | 'isTruthy';
61
- export type DcuplQueryOperator = DcuplQueryGeneralOperators | DcuplQueryArrayOperators | DcuplQueryFalsy | DcuplQueryStringOperators;
61
+ type DcuplQueryFindOperator = 'find';
62
+ type DcuplQueryGeneralOperators = 'eq' | 'gt' | 'gte' | 'lt' | 'lte';
63
+ type DcuplQuerySpecialOperator = 'typeof' | 'isTruthy' | 'size';
64
+ export type DcuplQueryOperator = DcuplQueryGeneralOperators | DcuplQueryFindOperator | DcuplQuerySpecialOperator;
62
65
  export type DcuplQueryType = 'and' | 'or';
63
- export type DcuplQuery = {
66
+ type DcuplQueryBase = {
67
+ /**
68
+ * title, something.key someArray[0].key
69
+ * */
64
70
  attribute: string;
65
- operator: DcuplQueryOperator;
66
- value: any;
67
71
  options?: DcuplQueryOptions;
68
72
  };
73
+ type DcuplQueryEq = DcuplQueryBase & {
74
+ operator: 'eq';
75
+ /**
76
+ * You may search for any value but
77
+ * only values of type string and { key:string } may be used for indexed search
78
+ */
79
+ value: any;
80
+ };
81
+ type DcuplQueryFind = DcuplQueryBase & {
82
+ operator: 'find';
83
+ value: Record<string, unknown> | string;
84
+ };
85
+ type DcuplQueryNumbers = DcuplQueryBase & {
86
+ operator: 'gt' | 'lt' | 'gte' | 'lte';
87
+ value: string | number | Date;
88
+ };
89
+ type DcuplQueryTypeOf = DcuplQueryBase & {
90
+ operator: 'typeof';
91
+ value: string;
92
+ };
93
+ type DcuplQueryIsTruthy = DcuplQueryBase & {
94
+ operator: 'isTruthy';
95
+ value: boolean;
96
+ };
97
+ type DcuplQuerySize = DcuplQueryBase & {
98
+ operator: 'size';
99
+ value: number;
100
+ };
101
+ export type DcuplQuery = DcuplQueryEq | DcuplQueryNumbers | DcuplQueryTypeOf | DcuplQueryIsTruthy | DcuplQuerySize | DcuplQueryFind;
69
102
  export type DcuplQueryGroup = {
70
103
  queryType?: DcuplQueryType;
71
104
  queryKey?: string;
72
- query: Array<DcuplQuery> | Array<DcuplQueryGroup>;
105
+ query: Array<DcuplQuery | DcuplQueryGroup>;
73
106
  options?: DcuplQueryOptions;
74
107
  };
75
108
  export type DcuplGlobalQueryOptionsNew<T> = DcuplItemsOptions<T> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcupl/common",
3
- "version": "0.0.81-beta.0",
3
+ "version": "0.0.81-beta.2",
4
4
  "description": "Dcupl Common Code",
5
5
  "main": "dist/lib-cjs/index.js",
6
6
  "module": "dist/lib-esm/index.js",
@@ -21,7 +21,7 @@
21
21
  "author": "dcupl Team",
22
22
  "license": "ISC",
23
23
  "dependencies": {
24
- "date-fns": "^2.28.x",
24
+ "date-fns": "^2.29.x",
25
25
  "lodash": "4.17.x"
26
26
  },
27
27
  "peerDependencies": {