@taylordb/shared 0.4.0 → 0.4.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 TaylorDB
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -4,6 +4,49 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
+ interface FileInformation {
8
+ fieldname: string;
9
+ originalname: string;
10
+ encoding: string;
11
+ mimetype: string;
12
+ destination: string;
13
+ filename: string;
14
+ path: string;
15
+ size: number;
16
+ format: string;
17
+ width: number;
18
+ height: number;
19
+ }
20
+ interface UploadResponse {
21
+ collectionName: string;
22
+ fileInformation: FileInformation;
23
+ metadata: {
24
+ thumbnails: any[];
25
+ clips: any[];
26
+ };
27
+ baseId: string;
28
+ storageAdaptor: string;
29
+ _id: string;
30
+ __v: number;
31
+ }
32
+ export interface AttachmentColumnValue {
33
+ url: string;
34
+ fileType: string;
35
+ size: number;
36
+ }
37
+ export declare class Attachment {
38
+ readonly collectionName: string;
39
+ readonly fileInformation: FileInformation;
40
+ readonly metadata: {
41
+ thumbnails: any[];
42
+ clips: any[];
43
+ };
44
+ readonly baseId: string;
45
+ readonly storageAdaptor: string;
46
+ readonly _id: string;
47
+ constructor(data: UploadResponse);
48
+ toColumnValue(): AttachmentColumnValue;
49
+ }
7
50
  type IsWithinOperatorValue = 'pastWeek' | 'pastMonth' | 'pastYear' | 'nextWeek' | 'nextMonth' | 'nextYear' | 'daysFromNow' | 'daysAgo' | 'currentWeek' | 'currentMonth' | 'currentYear';
8
51
  type DefaultDateFilterValue = ('today' | 'tomorrow' | 'yesterday' | 'oneWeekAgo' | 'oneWeekFromNow' | 'oneMonthAgo' | 'oneMonthFromNow') | ['exactDay' | 'exactTimestamp', string] | ['daysAgo' | 'daysFromNow', number];
9
52
  type DateFilters = {
@@ -41,6 +84,8 @@ type TextFilters = {
41
84
  startsWith: string;
42
85
  endsWith: string;
43
86
  doesNotContain: string;
87
+ isEmpty: never;
88
+ isNotEmpty: never;
44
89
  };
45
90
  type LinkFilters = {
46
91
  hasAnyOf: number[];
@@ -48,6 +93,21 @@ type LinkFilters = {
48
93
  isExactly: number[];
49
94
  '=': number;
50
95
  hasNoneOf: number[];
96
+ contains: string;
97
+ doesNotContain: string;
98
+ isEmpty: never;
99
+ isNotEmpty: never;
100
+ };
101
+ type SelectFilters<O extends readonly string[]> = {
102
+ hasAnyOf: O[number][];
103
+ hasAllOf: O[number][];
104
+ isExactly: O[number][];
105
+ '=': O[number];
106
+ hasNoneOf: O[number][];
107
+ contains: string;
108
+ doesNotContain: string;
109
+ isEmpty: never;
110
+ isNotEmpty: never;
51
111
  };
52
112
  type LinkAggregations = {
53
113
  empty: number;
@@ -56,12 +116,16 @@ type LinkAggregations = {
56
116
  percentFilled: number;
57
117
  };
58
118
  type NumberFilters = {
119
+ '=': number;
120
+ '!=': number;
59
121
  '>': number;
60
122
  '>=': number;
61
123
  '<': number;
62
124
  '<=': number;
63
125
  hasAnyOf: number[];
64
126
  hasNoneOf: number[];
127
+ isEmpty: never;
128
+ isNotEmpty: never;
65
129
  };
66
130
  type NumberAggregations = {
67
131
  sum: number;
@@ -101,12 +165,20 @@ export type ColumnType<S, U, I, R extends boolean, F extends {
101
165
  };
102
166
  export type DateColumnType<R extends boolean> = ColumnType<string, string, string, R, DateFilters, DateAggregations>;
103
167
  export type TextColumnType<R extends boolean> = ColumnType<string, string, string, R, TextFilters>;
104
- export type LinkColumnType<T extends string, R extends boolean> = ColumnType<object, number | number[] | {
105
- newIds: number[];
106
- deletedIds: number[];
107
- }, number | number[], R, LinkFilters, LinkAggregations> & {
168
+ export type ALinkColumnType<T extends string, S, U, I, R extends boolean, F extends {
169
+ [key: string]: any;
170
+ } = LinkFilters, A extends LinkAggregations = LinkAggregations> = ColumnType<S, U, I, R, F, A> & {
108
171
  linkedTo: T;
109
172
  };
173
+ export type LinkColumnType<T extends string, R extends boolean> = ALinkColumnType<T, object, number | number[] | {
174
+ newIds: number[];
175
+ deletedIds: number[];
176
+ }, number | number[], R>;
177
+ export type AttachmentColumnType<R extends boolean> = ALinkColumnType<'attachmentTable', Attachment[], Attachment[] | {
178
+ newIds: number[];
179
+ deletedIds: number[];
180
+ } | number[], Attachment[] | number[], R>;
181
+ export type SingleSelectColumnType<O extends readonly string[], R extends boolean> = ALinkColumnType<'selectTable', O[number], O[number] | O[number][], O[number] | O[number][], R, SelectFilters<O>>;
110
182
  export type NumberColumnType<R extends boolean> = ColumnType<number, number, number, R, NumberFilters, NumberAggregations>;
111
183
  export type CheckboxColumnType<R extends boolean> = ColumnType<boolean, boolean, boolean, R, CheckboxFilters>;
112
184
  export type AutoGeneratedNumberColumnType = ColumnType<number, never, never, false, NumberFilters, NumberAggregations>;
@@ -6,4 +6,29 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.Attachment = void 0;
10
+ class Attachment {
11
+ collectionName;
12
+ fileInformation;
13
+ metadata;
14
+ baseId;
15
+ storageAdaptor;
16
+ _id;
17
+ constructor(data) {
18
+ this.collectionName = data.collectionName;
19
+ this.fileInformation = data.fileInformation;
20
+ this.metadata = data.metadata;
21
+ this.baseId = data.baseId;
22
+ this.storageAdaptor = data.storageAdaptor;
23
+ this._id = data._id;
24
+ }
25
+ toColumnValue() {
26
+ return {
27
+ url: this.fileInformation.path,
28
+ fileType: this.fileInformation.mimetype,
29
+ size: this.fileInformation.size,
30
+ };
31
+ }
32
+ }
33
+ exports.Attachment = Attachment;
9
34
  //# sourceMappingURL=column-types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"column-types.js","sourceRoot":"","sources":["../../src/column-types.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
1
+ {"version":3,"file":"column-types.js","sourceRoot":"","sources":["../../src/column-types.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAmCH,MAAa,UAAU;IACL,cAAc,CAAS;IACvB,eAAe,CAAkB;IACjC,QAAQ,CAAsC;IAC9C,MAAM,CAAS;IACf,cAAc,CAAS;IACvB,GAAG,CAAS;IAE5B,YAAY,IAAoB;QAC9B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAC5C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;IACtB,CAAC;IAED,aAAa;QACX,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI;YAC9B,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,QAAQ;YACvC,IAAI,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI;SAChC,CAAC;IACJ,CAAC;CACF;AAxBD,gCAwBC"}
@@ -4,6 +4,49 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
+ interface FileInformation {
8
+ fieldname: string;
9
+ originalname: string;
10
+ encoding: string;
11
+ mimetype: string;
12
+ destination: string;
13
+ filename: string;
14
+ path: string;
15
+ size: number;
16
+ format: string;
17
+ width: number;
18
+ height: number;
19
+ }
20
+ interface UploadResponse {
21
+ collectionName: string;
22
+ fileInformation: FileInformation;
23
+ metadata: {
24
+ thumbnails: any[];
25
+ clips: any[];
26
+ };
27
+ baseId: string;
28
+ storageAdaptor: string;
29
+ _id: string;
30
+ __v: number;
31
+ }
32
+ export interface AttachmentColumnValue {
33
+ url: string;
34
+ fileType: string;
35
+ size: number;
36
+ }
37
+ export declare class Attachment {
38
+ readonly collectionName: string;
39
+ readonly fileInformation: FileInformation;
40
+ readonly metadata: {
41
+ thumbnails: any[];
42
+ clips: any[];
43
+ };
44
+ readonly baseId: string;
45
+ readonly storageAdaptor: string;
46
+ readonly _id: string;
47
+ constructor(data: UploadResponse);
48
+ toColumnValue(): AttachmentColumnValue;
49
+ }
7
50
  type IsWithinOperatorValue = 'pastWeek' | 'pastMonth' | 'pastYear' | 'nextWeek' | 'nextMonth' | 'nextYear' | 'daysFromNow' | 'daysAgo' | 'currentWeek' | 'currentMonth' | 'currentYear';
8
51
  type DefaultDateFilterValue = ('today' | 'tomorrow' | 'yesterday' | 'oneWeekAgo' | 'oneWeekFromNow' | 'oneMonthAgo' | 'oneMonthFromNow') | ['exactDay' | 'exactTimestamp', string] | ['daysAgo' | 'daysFromNow', number];
9
52
  type DateFilters = {
@@ -41,6 +84,8 @@ type TextFilters = {
41
84
  startsWith: string;
42
85
  endsWith: string;
43
86
  doesNotContain: string;
87
+ isEmpty: never;
88
+ isNotEmpty: never;
44
89
  };
45
90
  type LinkFilters = {
46
91
  hasAnyOf: number[];
@@ -48,6 +93,21 @@ type LinkFilters = {
48
93
  isExactly: number[];
49
94
  '=': number;
50
95
  hasNoneOf: number[];
96
+ contains: string;
97
+ doesNotContain: string;
98
+ isEmpty: never;
99
+ isNotEmpty: never;
100
+ };
101
+ type SelectFilters<O extends readonly string[]> = {
102
+ hasAnyOf: O[number][];
103
+ hasAllOf: O[number][];
104
+ isExactly: O[number][];
105
+ '=': O[number];
106
+ hasNoneOf: O[number][];
107
+ contains: string;
108
+ doesNotContain: string;
109
+ isEmpty: never;
110
+ isNotEmpty: never;
51
111
  };
52
112
  type LinkAggregations = {
53
113
  empty: number;
@@ -56,12 +116,16 @@ type LinkAggregations = {
56
116
  percentFilled: number;
57
117
  };
58
118
  type NumberFilters = {
119
+ '=': number;
120
+ '!=': number;
59
121
  '>': number;
60
122
  '>=': number;
61
123
  '<': number;
62
124
  '<=': number;
63
125
  hasAnyOf: number[];
64
126
  hasNoneOf: number[];
127
+ isEmpty: never;
128
+ isNotEmpty: never;
65
129
  };
66
130
  type NumberAggregations = {
67
131
  sum: number;
@@ -101,12 +165,20 @@ export type ColumnType<S, U, I, R extends boolean, F extends {
101
165
  };
102
166
  export type DateColumnType<R extends boolean> = ColumnType<string, string, string, R, DateFilters, DateAggregations>;
103
167
  export type TextColumnType<R extends boolean> = ColumnType<string, string, string, R, TextFilters>;
104
- export type LinkColumnType<T extends string, R extends boolean> = ColumnType<object, number | number[] | {
105
- newIds: number[];
106
- deletedIds: number[];
107
- }, number | number[], R, LinkFilters, LinkAggregations> & {
168
+ export type ALinkColumnType<T extends string, S, U, I, R extends boolean, F extends {
169
+ [key: string]: any;
170
+ } = LinkFilters, A extends LinkAggregations = LinkAggregations> = ColumnType<S, U, I, R, F, A> & {
108
171
  linkedTo: T;
109
172
  };
173
+ export type LinkColumnType<T extends string, R extends boolean> = ALinkColumnType<T, object, number | number[] | {
174
+ newIds: number[];
175
+ deletedIds: number[];
176
+ }, number | number[], R>;
177
+ export type AttachmentColumnType<R extends boolean> = ALinkColumnType<'attachmentTable', Attachment[], Attachment[] | {
178
+ newIds: number[];
179
+ deletedIds: number[];
180
+ } | number[], Attachment[] | number[], R>;
181
+ export type SingleSelectColumnType<O extends readonly string[], R extends boolean> = ALinkColumnType<'selectTable', O[number], O[number] | O[number][], O[number] | O[number][], R, SelectFilters<O>>;
110
182
  export type NumberColumnType<R extends boolean> = ColumnType<number, number, number, R, NumberFilters, NumberAggregations>;
111
183
  export type CheckboxColumnType<R extends boolean> = ColumnType<boolean, boolean, boolean, R, CheckboxFilters>;
112
184
  export type AutoGeneratedNumberColumnType = ColumnType<number, never, never, false, NumberFilters, NumberAggregations>;
@@ -4,5 +4,27 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- export {};
7
+ export class Attachment {
8
+ collectionName;
9
+ fileInformation;
10
+ metadata;
11
+ baseId;
12
+ storageAdaptor;
13
+ _id;
14
+ constructor(data) {
15
+ this.collectionName = data.collectionName;
16
+ this.fileInformation = data.fileInformation;
17
+ this.metadata = data.metadata;
18
+ this.baseId = data.baseId;
19
+ this.storageAdaptor = data.storageAdaptor;
20
+ this._id = data._id;
21
+ }
22
+ toColumnValue() {
23
+ return {
24
+ url: this.fileInformation.path,
25
+ fileType: this.fileInformation.mimetype,
26
+ size: this.fileInformation.size,
27
+ };
28
+ }
29
+ }
8
30
  //# sourceMappingURL=column-types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"column-types.js","sourceRoot":"","sources":["../../src/column-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
1
+ {"version":3,"file":"column-types.js","sourceRoot":"","sources":["../../src/column-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmCH,MAAM,OAAO,UAAU;IACL,cAAc,CAAS;IACvB,eAAe,CAAkB;IACjC,QAAQ,CAAsC;IAC9C,MAAM,CAAS;IACf,cAAc,CAAS;IACvB,GAAG,CAAS;IAE5B,YAAY,IAAoB;QAC9B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAC5C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;IACtB,CAAC;IAED,aAAa;QACX,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI;YAC9B,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,QAAQ;YACvC,IAAI,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI;SAChC,CAAC;IACJ,CAAC;CACF"}