@taylordb/shared 0.1.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.
Files changed (46) hide show
  1. package/dist/@types/index.d.ts +2 -0
  2. package/dist/@types/index.js +19 -0
  3. package/dist/@types/index.js.map +1 -0
  4. package/dist/@types/metadata.d.ts +32 -0
  5. package/dist/@types/metadata.js +3 -0
  6. package/dist/@types/metadata.js.map +1 -0
  7. package/dist/@types/table-loader.d.ts +99 -0
  8. package/dist/@types/table-loader.js +3 -0
  9. package/dist/@types/table-loader.js.map +1 -0
  10. package/dist/column-types.d.ts +21 -0
  11. package/dist/column-types.js +9 -0
  12. package/dist/column-types.js.map +1 -0
  13. package/dist/constants/date-filters.d.ts +26 -0
  14. package/dist/constants/date-filters.js +32 -0
  15. package/dist/constants/date-filters.js.map +1 -0
  16. package/dist/constants/index.d.ts +2 -0
  17. package/dist/constants/index.js +19 -0
  18. package/dist/constants/index.js.map +1 -0
  19. package/dist/constants/select.d.ts +43 -0
  20. package/dist/constants/select.js +47 -0
  21. package/dist/constants/select.js.map +1 -0
  22. package/dist/filters.d.ts +46 -0
  23. package/dist/filters.js +8 -0
  24. package/dist/filters.js.map +1 -0
  25. package/dist/index.d.ts +5 -0
  26. package/dist/index.js +22 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/table-types.d.ts +26 -0
  29. package/dist/table-types.js +9 -0
  30. package/dist/table-types.js.map +1 -0
  31. package/dist/utilities/index.d.ts +4 -0
  32. package/dist/utilities/index.js +21 -0
  33. package/dist/utilities/index.js.map +1 -0
  34. package/dist/utilities/makeCamelCase.d.ts +2 -0
  35. package/dist/utilities/makeCamelCase.js +11 -0
  36. package/dist/utilities/makeCamelCase.js.map +1 -0
  37. package/dist/utilities/makeColumnName.d.ts +1 -0
  38. package/dist/utilities/makeColumnName.js +11 -0
  39. package/dist/utilities/makeColumnName.js.map +1 -0
  40. package/dist/utilities/makeSelectKey.d.ts +1 -0
  41. package/dist/utilities/makeSelectKey.js +6 -0
  42. package/dist/utilities/makeSelectKey.js.map +1 -0
  43. package/dist/utilities/validateString.d.ts +2 -0
  44. package/dist/utilities/validateString.js +7 -0
  45. package/dist/utilities/validateString.js.map +1 -0
  46. package/package.json +24 -0
@@ -0,0 +1,2 @@
1
+ export * from './metadata';
2
+ export * from './table-loader';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./metadata"), exports);
18
+ __exportStar(require("./table-loader"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/@types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,iDAA+B"}
@@ -0,0 +1,32 @@
1
+ import { AggregateConfiguration, Configuration, FiltersSet, PaginationRequest } from './table-loader';
2
+ export type SelectQueryMetaData = {
3
+ type: 'select';
4
+ } & Configuration<string>;
5
+ export type PaginationQueryMetaData = {
6
+ type: 'pagination';
7
+ filtersSet?: FiltersSet<string>;
8
+ pagination?: PaginationRequest;
9
+ };
10
+ export type AggregationQueryMetaData = {
11
+ type: 'aggregation';
12
+ } & AggregateConfiguration<string>;
13
+ export type UpdateMutationMetaData = {
14
+ type: 'update';
15
+ values: any;
16
+ filtersSet?: FiltersSet<string>;
17
+ };
18
+ export type DeleteMutationMetaData = {
19
+ type: 'delete';
20
+ filtersSet?: FiltersSet<string>;
21
+ deletedRecordIds: number[];
22
+ };
23
+ export type CreateMutationMetaData = {
24
+ type: 'create';
25
+ createdRecords: any[];
26
+ };
27
+ export type AvailableMetaData = UpdateMutationMetaData | DeleteMutationMetaData | CreateMutationMetaData | SelectQueryMetaData | PaginationQueryMetaData | AggregationQueryMetaData;
28
+ export type QueryMetadata = SelectQueryMetaData | PaginationQueryMetaData | AggregationQueryMetaData;
29
+ export type MutationMetaData = UpdateMutationMetaData | DeleteMutationMetaData | CreateMutationMetaData;
30
+ export type MetadataWithTableName<T extends AvailableMetaData> = T & {
31
+ tableName: string;
32
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/@types/metadata.ts"],"names":[],"mappings":""}
@@ -0,0 +1,99 @@
1
+ export type FieldWithDirection<FN> = {
2
+ field: FN;
3
+ direction: string;
4
+ values?: unknown;
5
+ };
6
+ export type FiltersSet<FN> = {
7
+ conjunction: 'and' | 'or';
8
+ filtersSet: (FiltersSet<FN> | Filters<FN>)[];
9
+ };
10
+ export type Filters<FN> = {
11
+ field: FN;
12
+ operator: string;
13
+ value?: unknown;
14
+ };
15
+ export type FieldsOrder<FN> = {
16
+ field: FN;
17
+ isVisible: boolean;
18
+ };
19
+ export type FieldsConfiguration<FN extends string> = {
20
+ [key in FN]: string[] | null;
21
+ };
22
+ export type FieldsWithPaginationConfiguration = {
23
+ field: string;
24
+ pagination?: PaginationRequest;
25
+ fields: string[];
26
+ };
27
+ export type FieldsConfigurations = {
28
+ field: string;
29
+ pagination?: PaginationRequest;
30
+ fields: FieldsConfigurations[];
31
+ isVisible: boolean;
32
+ isQueryable: boolean;
33
+ isFilterable: boolean;
34
+ hasPagination: boolean;
35
+ };
36
+ export type ObjConfigurationVisibleField<FN extends string> = Configuration<string> & {
37
+ field: FN;
38
+ };
39
+ export type ConfigurationVisibleField<FN extends string> = '*' | FN | `${FN}:${string}` | ObjConfigurationVisibleField<FN>;
40
+ export type Configuration<FN extends string> = {
41
+ filtersSet?: FiltersSet<FN>;
42
+ /**
43
+ *
44
+ * This property is deprecated please use filtersSet instead
45
+ *
46
+ * @deprecated
47
+ */
48
+ filters?: Filters<FN>[];
49
+ sorting?: FieldWithDirection<FN>[];
50
+ pagination?: PaginationRequest | LimitOffset;
51
+ fields?: ConfigurationVisibleField<FN>[];
52
+ };
53
+ export type LimitOffset = {
54
+ limit: number;
55
+ offset: number;
56
+ };
57
+ export type PaginationRequest = {
58
+ perPage: number;
59
+ page: number;
60
+ };
61
+ export type PaginationResponse = {
62
+ total: number;
63
+ } | {
64
+ page: number;
65
+ perPage: number;
66
+ total: number;
67
+ pages: number;
68
+ };
69
+ export type InsertionReturnValue<DB extends object, TB extends keyof DB> = {
70
+ [key in keyof DB[TB]]: any;
71
+ };
72
+ export type AggregationFields<FN extends string> = {
73
+ [field in FN]: string[];
74
+ };
75
+ export type FieldBasedGrouping<FN extends string> = FieldWithDirection<FN>;
76
+ export type FormulaBasedGrouping<FN extends string> = {
77
+ formula: string;
78
+ } & Pick<FieldWithDirection<FN>, 'direction'>;
79
+ export type GroupingConfiguration<FN extends string> = FieldBasedGrouping<FN> | FormulaBasedGrouping<FN>;
80
+ export type AggregateConfiguration<FN extends string> = Exclude<Configuration<FN>, 'fields' | 'sorting'> & {
81
+ groupings?: GroupingConfiguration<FN>[];
82
+ aggregations?: AggregationFields<FN>;
83
+ };
84
+ export type Aggregates<FN extends string> = {
85
+ [k in FN]?: {
86
+ [operator: string]: AggregationValue;
87
+ };
88
+ };
89
+ export type AggregationValue = number | null | object | undefined;
90
+ export type AggregateRecord<FN extends string> = {
91
+ slug?: string;
92
+ value?: unknown;
93
+ count: number;
94
+ children?: AggregateRecord<FN>[];
95
+ aggregates: Aggregates<FN>;
96
+ };
97
+ export type FieldAggregation = {
98
+ [name: string]: () => AggregationValue;
99
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=table-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-loader.js","sourceRoot":"","sources":["../../src/@types/table-loader.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright (c) 2025 TaylorDB
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ export type ColumnType<S, U, I, T> = {
8
+ raw: S;
9
+ insert: I;
10
+ update: U;
11
+ type: T;
12
+ };
13
+ export type TextColumnType = ColumnType<string | undefined, string | undefined, string | null, 'text'>;
14
+ export type LinkColumnType<T extends string> = ColumnType<object, number[] | {
15
+ newIds: number[];
16
+ deletedIds: number[];
17
+ } | undefined, number[] | undefined, 'link'> & {
18
+ linkedTo: T;
19
+ };
20
+ export type NumberColumnType = ColumnType<number | undefined, number | undefined, number | undefined, 'number'>;
21
+ export type CheckboxColumnType = ColumnType<boolean | undefined, boolean | undefined, boolean | undefined, 'checkbox'>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2025 TaylorDB
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ //# sourceMappingURL=column-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column-types.js","sourceRoot":"","sources":["../src/column-types.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
@@ -0,0 +1,26 @@
1
+ export declare enum DefaultOperatorValue {
2
+ TODAY = "today",
3
+ TOMORROW = "tomorrow",
4
+ YESTERDAY = "yesterday",
5
+ ONE_WEEK_AGO = "oneWeekAgo",
6
+ ONE_WEEK_FROM_NOW = "oneWeekFromNow",
7
+ ONE_MONTH_AGO = "oneMonthAgo",
8
+ ONE_MONTH_FROM_NOW = "oneMonthFromNow",
9
+ DAYS_AGO = "daysAgo",
10
+ DAYS_FROM_NOW = "daysFromNow",
11
+ EXACT_DAY = "exactDay",
12
+ EXACT_TIMESTAMP = "exactTimestamp"
13
+ }
14
+ export declare enum IsWithinOperatorValue {
15
+ PAST_WEEK = "pastWeek",
16
+ PAST_MONTH = "pastMonth",
17
+ PAST_YEAR = "pastYear",
18
+ NEXT_WEEK = "nextWeek",
19
+ NEXT_MONTH = "nextMonth",
20
+ NEXT_YEAR = "nextYear",
21
+ DAYS_FROM_NOW = "daysFromNow",
22
+ DAYS_AGO = "daysAgo",
23
+ CURRENT_WEEK = "currentWeek",
24
+ CURRENT_MONTH = "currentMonth",
25
+ CURRENT_YEAR = "currentYear"
26
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IsWithinOperatorValue = exports.DefaultOperatorValue = void 0;
4
+ var DefaultOperatorValue;
5
+ (function (DefaultOperatorValue) {
6
+ DefaultOperatorValue["TODAY"] = "today";
7
+ DefaultOperatorValue["TOMORROW"] = "tomorrow";
8
+ DefaultOperatorValue["YESTERDAY"] = "yesterday";
9
+ DefaultOperatorValue["ONE_WEEK_AGO"] = "oneWeekAgo";
10
+ DefaultOperatorValue["ONE_WEEK_FROM_NOW"] = "oneWeekFromNow";
11
+ DefaultOperatorValue["ONE_MONTH_AGO"] = "oneMonthAgo";
12
+ DefaultOperatorValue["ONE_MONTH_FROM_NOW"] = "oneMonthFromNow";
13
+ DefaultOperatorValue["DAYS_AGO"] = "daysAgo";
14
+ DefaultOperatorValue["DAYS_FROM_NOW"] = "daysFromNow";
15
+ DefaultOperatorValue["EXACT_DAY"] = "exactDay";
16
+ DefaultOperatorValue["EXACT_TIMESTAMP"] = "exactTimestamp";
17
+ })(DefaultOperatorValue || (exports.DefaultOperatorValue = DefaultOperatorValue = {}));
18
+ var IsWithinOperatorValue;
19
+ (function (IsWithinOperatorValue) {
20
+ IsWithinOperatorValue["PAST_WEEK"] = "pastWeek";
21
+ IsWithinOperatorValue["PAST_MONTH"] = "pastMonth";
22
+ IsWithinOperatorValue["PAST_YEAR"] = "pastYear";
23
+ IsWithinOperatorValue["NEXT_WEEK"] = "nextWeek";
24
+ IsWithinOperatorValue["NEXT_MONTH"] = "nextMonth";
25
+ IsWithinOperatorValue["NEXT_YEAR"] = "nextYear";
26
+ IsWithinOperatorValue["DAYS_FROM_NOW"] = "daysFromNow";
27
+ IsWithinOperatorValue["DAYS_AGO"] = "daysAgo";
28
+ IsWithinOperatorValue["CURRENT_WEEK"] = "currentWeek";
29
+ IsWithinOperatorValue["CURRENT_MONTH"] = "currentMonth";
30
+ IsWithinOperatorValue["CURRENT_YEAR"] = "currentYear";
31
+ })(IsWithinOperatorValue || (exports.IsWithinOperatorValue = IsWithinOperatorValue = {}));
32
+ //# sourceMappingURL=date-filters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-filters.js","sourceRoot":"","sources":["../../src/constants/date-filters.ts"],"names":[],"mappings":";;;AAAA,IAAY,oBAYX;AAZD,WAAY,oBAAoB;IAC9B,uCAAe,CAAA;IACf,6CAAqB,CAAA;IACrB,+CAAuB,CAAA;IACvB,mDAA2B,CAAA;IAC3B,4DAAoC,CAAA;IACpC,qDAA6B,CAAA;IAC7B,8DAAsC,CAAA;IACtC,4CAAoB,CAAA;IACpB,qDAA6B,CAAA;IAC7B,8CAAsB,CAAA;IACtB,0DAAkC,CAAA;AACpC,CAAC,EAZW,oBAAoB,oCAApB,oBAAoB,QAY/B;AAED,IAAY,qBAYX;AAZD,WAAY,qBAAqB;IAC/B,+CAAsB,CAAA;IACtB,iDAAwB,CAAA;IACxB,+CAAsB,CAAA;IACtB,+CAAsB,CAAA;IACtB,iDAAwB,CAAA;IACxB,+CAAsB,CAAA;IACtB,sDAA6B,CAAA;IAC7B,6CAAoB,CAAA;IACpB,qDAA4B,CAAA;IAC5B,uDAA8B,CAAA;IAC9B,qDAA4B,CAAA;AAC9B,CAAC,EAZW,qBAAqB,qCAArB,qBAAqB,QAYhC"}
@@ -0,0 +1,2 @@
1
+ export * from './date-filters';
2
+ export * from './select';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./date-filters"), exports);
18
+ __exportStar(require("./select"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,2CAAyB"}
@@ -0,0 +1,43 @@
1
+ export declare const TABLE_COLORS: {
2
+ violet1: string;
3
+ blue1: string;
4
+ mint1: string;
5
+ green1: string;
6
+ red1: string;
7
+ pink1: string;
8
+ orange1: string;
9
+ grey1: string;
10
+ violet2: string;
11
+ blue2: string;
12
+ mint2: string;
13
+ green2: string;
14
+ red2: string;
15
+ pink2: string;
16
+ orange2: string;
17
+ grey2: string;
18
+ violet3: string;
19
+ blue3: string;
20
+ mint3: string;
21
+ green3: string;
22
+ red3: string;
23
+ pink3: string;
24
+ orange3: string;
25
+ grey3: string;
26
+ violet4: string;
27
+ blue4: string;
28
+ mint4: string;
29
+ green4: string;
30
+ red4: string;
31
+ pink4: string;
32
+ orange4: string;
33
+ grey4: string;
34
+ violet5: string;
35
+ blue5: string;
36
+ mint5: string;
37
+ green5: string;
38
+ red5: string;
39
+ pink5: string;
40
+ orange5: string;
41
+ grey5: string;
42
+ };
43
+ export declare const TABLE_COLOR_NAMES: string[];
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TABLE_COLOR_NAMES = exports.TABLE_COLORS = void 0;
4
+ exports.TABLE_COLORS = {
5
+ violet1: '#F1EFFF',
6
+ blue1: '#CDF6FE',
7
+ mint1: '#D8FDEE',
8
+ green1: '#D2FFC6',
9
+ red1: '#FEF7F2',
10
+ pink1: '#FFEDF3',
11
+ orange1: '#FDF4DE',
12
+ grey1: '#F3F0F4',
13
+ violet2: '#DFE0FF',
14
+ blue2: '#A5EAFF',
15
+ mint2: '#9CFFE8',
16
+ green2: '#ACFAA9',
17
+ red2: '#FDEEE6',
18
+ pink2: '#FFD2F0',
19
+ orange2: '#FBECCD',
20
+ grey2: '#E4E1E6',
21
+ violet3: '#BDC2FF',
22
+ blue3: '#84D2FE',
23
+ mint3: '#6FEFD1',
24
+ green3: '#7DF890',
25
+ red3: '#F3D1CB',
26
+ pink3: '#DB99CB',
27
+ orange3: '#F2D4A8',
28
+ grey3: '#C8C5CA',
29
+ violet4: '#9BA4FF',
30
+ blue4: '#68A3D9',
31
+ mint4: '#13BBBB',
32
+ green4: '#00CA85',
33
+ red4: '#FB614C',
34
+ pink4: '#C95AAE',
35
+ orange4: '#FF9736',
36
+ grey4: '#ADAAAF',
37
+ violet5: '#4250CC',
38
+ blue5: '#006BCD',
39
+ mint5: '#008989',
40
+ green5: '#009B66',
41
+ red5: '#C34C3B',
42
+ pink5: '#B54E7F',
43
+ orange5: '#C75F00',
44
+ grey5: '#929094',
45
+ };
46
+ exports.TABLE_COLOR_NAMES = Object.keys(exports.TABLE_COLORS);
47
+ //# sourceMappingURL=select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/constants/select.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;CACjB,CAAC;AAEW,QAAA,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,oBAAY,CAAC,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Copyright (c) 2025 TaylorDB
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ export type Filters = {
8
+ text: {
9
+ operators: {
10
+ '=': string;
11
+ '!=': string;
12
+ caseEqual: string;
13
+ hasAnyOf: string[];
14
+ contains: string;
15
+ startsWith: string;
16
+ endsWith: string;
17
+ doesNotContain: string;
18
+ };
19
+ };
20
+ number: {
21
+ operators: {
22
+ '=': number;
23
+ '!=': number;
24
+ '>': number;
25
+ '>=': number;
26
+ '<': number;
27
+ '<=': number;
28
+ hasAnyOf: number[];
29
+ hasNoneOf: number[];
30
+ };
31
+ };
32
+ checkbox: {
33
+ operators: {
34
+ '=': number;
35
+ };
36
+ };
37
+ link: {
38
+ operators: {
39
+ hasAnyOf: number[];
40
+ hasAllOf: number[];
41
+ isExactly: number[];
42
+ '=': number[];
43
+ hasNoneOf: number[];
44
+ };
45
+ };
46
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) 2025 TaylorDB
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=filters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filters.js","sourceRoot":"","sources":["../src/filters.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,5 @@
1
+ export * from './@types';
2
+ export * from './column-types';
3
+ export * from './constants';
4
+ export * from './table-types';
5
+ export * from './utilities';
package/dist/index.js ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./@types"), exports);
18
+ __exportStar(require("./column-types"), exports);
19
+ __exportStar(require("./constants"), exports);
20
+ __exportStar(require("./table-types"), exports);
21
+ __exportStar(require("./utilities"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,iDAA+B;AAC/B,8CAA4B;AAC5B,gDAA8B;AAC9B,8CAA4B"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright (c) 2025 TaylorDB
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { NumberColumnType, TextColumnType } from './column-types';
8
+ export type SelectTable = {
9
+ id: NumberColumnType;
10
+ name: TextColumnType;
11
+ color: TextColumnType;
12
+ };
13
+ export type AttachmentTable = {
14
+ id: NumberColumnType;
15
+ name: TextColumnType;
16
+ metadata: TextColumnType;
17
+ size: NumberColumnType;
18
+ fileType: TextColumnType;
19
+ url: TextColumnType;
20
+ };
21
+ export type CollaboratorsTable = {
22
+ id: NumberColumnType;
23
+ name: TextColumnType;
24
+ emailAddress: TextColumnType;
25
+ avatar: TextColumnType;
26
+ };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2025 TaylorDB
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ //# sourceMappingURL=table-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-types.js","sourceRoot":"","sources":["../src/table-types.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
@@ -0,0 +1,4 @@
1
+ export * from './makeCamelCase';
2
+ export * from './makeColumnName';
3
+ export * from './makeSelectKey';
4
+ export * from './validateString';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./makeCamelCase"), exports);
18
+ __exportStar(require("./makeColumnName"), exports);
19
+ __exportStar(require("./makeSelectKey"), exports);
20
+ __exportStar(require("./validateString"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,mDAAiC;AACjC,kDAAgC;AAChC,mDAAiC"}
@@ -0,0 +1,2 @@
1
+ export declare const makeCamelCase: (...strings: string[]) => string;
2
+ export default makeCamelCase;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.makeCamelCase = void 0;
7
+ const camelCase_1 = __importDefault(require("lodash/camelCase"));
8
+ const makeCamelCase = (...strings) => (0, camelCase_1.default)(strings.join(' '));
9
+ exports.makeCamelCase = makeCamelCase;
10
+ exports.default = exports.makeCamelCase;
11
+ //# sourceMappingURL=makeCamelCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeCamelCase.js","sourceRoot":"","sources":["../../src/utilities/makeCamelCase.ts"],"names":[],"mappings":";;;;;;AAAA,iEAAyC;AAElC,MAAM,aAAa,GAAG,CAAC,GAAG,OAAiB,EAAE,EAAE,CACpD,IAAA,mBAAS,EAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AADlB,QAAA,aAAa,iBACK;AAE/B,kBAAe,qBAAa,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const makeColumnName: (selectKey: string) => string;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeColumnName = void 0;
4
+ const makeColumnName = (selectKey) => {
5
+ return selectKey
6
+ .split('.')
7
+ .map(str => `"${str}"`)
8
+ .join('.');
9
+ };
10
+ exports.makeColumnName = makeColumnName;
11
+ //# sourceMappingURL=makeColumnName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeColumnName.js","sourceRoot":"","sources":["../../src/utilities/makeColumnName.ts"],"names":[],"mappings":";;;AAAO,MAAM,cAAc,GAAG,CAAC,SAAiB,EAAE,EAAE;IAClD,OAAO,SAAS;SACb,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,GAAG,CAAC;SACtB,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC,CAAC;AALW,QAAA,cAAc,kBAKzB"}
@@ -0,0 +1 @@
1
+ export declare const makeSelectKey: <F extends string, S extends string>(tableName: F, column: S) => `${F}.${S}`;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeSelectKey = void 0;
4
+ const makeSelectKey = (tableName, column) => `${tableName}.${column}`;
5
+ exports.makeSelectKey = makeSelectKey;
6
+ //# sourceMappingURL=makeSelectKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeSelectKey.js","sourceRoot":"","sources":["../../src/utilities/makeSelectKey.ts"],"names":[],"mappings":";;;AAAO,MAAM,aAAa,GAAG,CAC3B,SAAY,EACZ,MAAS,EACT,EAAE,CAAC,GAAG,SAAS,IAAI,MAAM,EAAW,CAAC;AAH1B,QAAA,aAAa,iBAGa"}
@@ -0,0 +1,2 @@
1
+ export declare const validateString: (string: string) => boolean;
2
+ export default validateString;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateString = void 0;
4
+ const validateString = (string) => /^(_|[a-zA-Z0-9])+(_?[a-zA-Z0-9]+)*$/.test(string);
5
+ exports.validateString = validateString;
6
+ exports.default = exports.validateString;
7
+ //# sourceMappingURL=validateString.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateString.js","sourceRoot":"","sources":["../../src/utilities/validateString.ts"],"names":[],"mappings":";;;AAAO,MAAM,cAAc,GAAG,CAAC,MAAc,EAAE,EAAE,CAC/C,qCAAqC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AADxC,QAAA,cAAc,kBAC0B;AAErD,kBAAe,sBAAc,CAAC"}
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@taylordb/shared",
3
+ "version": "0.1.0",
4
+ "description": "Shared types and utilities for TaylorDB",
5
+ "types": "src/index.ts",
6
+ "private": false,
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "keywords": [
11
+ "shared",
12
+ "types",
13
+ "taylordb"
14
+ ],
15
+ "author": "",
16
+ "license": "ISC",
17
+ "devDependencies": {
18
+ "@types/node": "^18.0.0"
19
+ },
20
+ "scripts": {
21
+ "build": "tsc",
22
+ "dev": "tsc -w"
23
+ }
24
+ }