@nocobase/database 1.2.12-alpha → 1.3.0-alpha.20240710084543

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 (247) hide show
  1. package/package.json +4 -4
  2. package/lib/collection-factory.d.ts +0 -25
  3. package/lib/collection-factory.js +0 -61
  4. package/lib/collection-group-manager.d.ts +0 -34
  5. package/lib/collection-group-manager.js +0 -66
  6. package/lib/collection-importer.d.ts +0 -15
  7. package/lib/collection-importer.js +0 -83
  8. package/lib/collection.d.ts +0 -145
  9. package/lib/collection.js +0 -663
  10. package/lib/database-utils/index.d.ts +0 -16
  11. package/lib/database-utils/index.js +0 -75
  12. package/lib/database.d.ts +0 -228
  13. package/lib/database.js +0 -795
  14. package/lib/decorators/must-have-filter-decorator.d.ts +0 -10
  15. package/lib/decorators/must-have-filter-decorator.js +0 -48
  16. package/lib/decorators/target-collection-decorator.d.ts +0 -10
  17. package/lib/decorators/target-collection-decorator.js +0 -56
  18. package/lib/decorators/transaction-decorator.d.ts +0 -9
  19. package/lib/decorators/transaction-decorator.js +0 -95
  20. package/lib/eager-loading/eager-loading-tree.d.ts +0 -39
  21. package/lib/eager-loading/eager-loading-tree.js +0 -448
  22. package/lib/errors/identifier-error.d.ts +0 -11
  23. package/lib/errors/identifier-error.js +0 -44
  24. package/lib/errors/zero-column-table-error.d.ts +0 -10
  25. package/lib/errors/zero-column-table-error.js +0 -40
  26. package/lib/features/references-map.d.ts +0 -29
  27. package/lib/features/references-map.js +0 -120
  28. package/lib/features/referential-integrity-check.d.ts +0 -16
  29. package/lib/features/referential-integrity-check.js +0 -86
  30. package/lib/field-repository/array-field-repository.d.ts +0 -36
  31. package/lib/field-repository/array-field-repository.js +0 -179
  32. package/lib/fields/array-field.d.ts +0 -19
  33. package/lib/fields/array-field.js +0 -66
  34. package/lib/fields/belongs-to-field.d.ts +0 -25
  35. package/lib/fields/belongs-to-field.js +0 -166
  36. package/lib/fields/belongs-to-many-field.d.ts +0 -28
  37. package/lib/fields/belongs-to-many-field.js +0 -196
  38. package/lib/fields/boolean-field.d.ts +0 -16
  39. package/lib/fields/boolean-field.js +0 -45
  40. package/lib/fields/context-field.d.ts +0 -22
  41. package/lib/fields/context-field.js +0 -79
  42. package/lib/fields/date-field.d.ts +0 -21
  43. package/lib/fields/date-field.js +0 -73
  44. package/lib/fields/field.d.ts +0 -52
  45. package/lib/fields/field.js +0 -168
  46. package/lib/fields/has-inverse-field.d.ts +0 -12
  47. package/lib/fields/has-inverse-field.js +0 -24
  48. package/lib/fields/has-many-field.d.ts +0 -76
  49. package/lib/fields/has-many-field.js +0 -165
  50. package/lib/fields/has-one-field.d.ts +0 -76
  51. package/lib/fields/has-one-field.js +0 -159
  52. package/lib/fields/index.d.ts +0 -54
  53. package/lib/fields/index.js +0 -74
  54. package/lib/fields/json-field.d.ts +0 -22
  55. package/lib/fields/json-field.js +0 -63
  56. package/lib/fields/nanoid-field.d.ts +0 -22
  57. package/lib/fields/nanoid-field.js +0 -65
  58. package/lib/fields/number-field.d.ts +0 -49
  59. package/lib/fields/number-field.js +0 -94
  60. package/lib/fields/password-field.d.ts +0 -29
  61. package/lib/fields/password-field.js +0 -106
  62. package/lib/fields/radio-field.d.ts +0 -24
  63. package/lib/fields/radio-field.js +0 -75
  64. package/lib/fields/relation-field.d.ts +0 -31
  65. package/lib/fields/relation-field.js +0 -94
  66. package/lib/fields/set-field.d.ts +0 -18
  67. package/lib/fields/set-field.js +0 -55
  68. package/lib/fields/sort-field.d.ts +0 -22
  69. package/lib/fields/sort-field.js +0 -197
  70. package/lib/fields/string-field.d.ts +0 -16
  71. package/lib/fields/string-field.js +0 -45
  72. package/lib/fields/text-field.d.ts +0 -18
  73. package/lib/fields/text-field.js +0 -53
  74. package/lib/fields/time-field.d.ts +0 -16
  75. package/lib/fields/time-field.js +0 -45
  76. package/lib/fields/uid-field.d.ts +0 -21
  77. package/lib/fields/uid-field.js +0 -72
  78. package/lib/fields/uuid-field.d.ts +0 -20
  79. package/lib/fields/uuid-field.js +0 -63
  80. package/lib/fields/virtual-field.d.ts +0 -16
  81. package/lib/fields/virtual-field.js +0 -45
  82. package/lib/filter-match.d.ts +0 -9
  83. package/lib/filter-match.js +0 -75
  84. package/lib/filter-parser.d.ts +0 -29
  85. package/lib/filter-parser.js +0 -238
  86. package/lib/helpers.d.ts +0 -11
  87. package/lib/helpers.js +0 -182
  88. package/lib/index.d.ts +0 -37
  89. package/lib/index.js +0 -138
  90. package/lib/inherited-collection.d.ts +0 -22
  91. package/lib/inherited-collection.js +0 -147
  92. package/lib/inherited-map.d.ts +0 -29
  93. package/lib/inherited-map.js +0 -125
  94. package/lib/inherited-sync-runner.d.ts +0 -12
  95. package/lib/inherited-sync-runner.js +0 -184
  96. package/lib/interface-manager.d.ts +0 -17
  97. package/lib/interface-manager.js +0 -50
  98. package/lib/interfaces/base-interface.d.ts +0 -33
  99. package/lib/interfaces/base-interface.js +0 -80
  100. package/lib/interfaces/boolean-interface.d.ts +0 -13
  101. package/lib/interfaces/boolean-interface.js +0 -70
  102. package/lib/interfaces/checkboxes-interface.d.ts +0 -11
  103. package/lib/interfaces/checkboxes-interface.js +0 -41
  104. package/lib/interfaces/datetime-interface.d.ts +0 -13
  105. package/lib/interfaces/datetime-interface.js +0 -108
  106. package/lib/interfaces/index.d.ts +0 -14
  107. package/lib/interfaces/index.js +0 -40
  108. package/lib/interfaces/integer-interface.d.ts +0 -12
  109. package/lib/interfaces/integer-interface.js +0 -44
  110. package/lib/interfaces/json-interface.d.ts +0 -13
  111. package/lib/interfaces/json-interface.js +0 -47
  112. package/lib/interfaces/many-to-many-interface.d.ts +0 -11
  113. package/lib/interfaces/many-to-many-interface.js +0 -41
  114. package/lib/interfaces/many-to-one-interface.d.ts +0 -11
  115. package/lib/interfaces/many-to-one-interface.js +0 -41
  116. package/lib/interfaces/multiple-select-interface.d.ts +0 -13
  117. package/lib/interfaces/multiple-select-interface.js +0 -76
  118. package/lib/interfaces/number-interface.d.ts +0 -15
  119. package/lib/interfaces/number-interface.js +0 -72
  120. package/lib/interfaces/one-belongs-to-one-interface.d.ts +0 -11
  121. package/lib/interfaces/one-belongs-to-one-interface.js +0 -41
  122. package/lib/interfaces/one-has-one-interface.d.ts +0 -11
  123. package/lib/interfaces/one-has-one-interface.js +0 -41
  124. package/lib/interfaces/one-to-many-interface.d.ts +0 -11
  125. package/lib/interfaces/one-to-many-interface.js +0 -41
  126. package/lib/interfaces/percent-interface.d.ts +0 -13
  127. package/lib/interfaces/percent-interface.js +0 -55
  128. package/lib/interfaces/select-interface.d.ts +0 -13
  129. package/lib/interfaces/select-interface.js +0 -63
  130. package/lib/interfaces/to-many-interface.d.ts +0 -12
  131. package/lib/interfaces/to-many-interface.js +0 -61
  132. package/lib/interfaces/to-one-interface.d.ts +0 -13
  133. package/lib/interfaces/to-one-interface.js +0 -61
  134. package/lib/interfaces/utils.d.ts +0 -10
  135. package/lib/interfaces/utils.js +0 -72
  136. package/lib/listeners/adjacency-list.d.ts +0 -10
  137. package/lib/listeners/adjacency-list.js +0 -51
  138. package/lib/listeners/append-child-collection-name-after-repository-find.d.ts +0 -14
  139. package/lib/listeners/append-child-collection-name-after-repository-find.js +0 -75
  140. package/lib/listeners/index.d.ts +0 -10
  141. package/lib/listeners/index.js +0 -42
  142. package/lib/magic-attribute-model.d.ts +0 -16
  143. package/lib/magic-attribute-model.js +0 -213
  144. package/lib/migration.d.ts +0 -43
  145. package/lib/migration.js +0 -112
  146. package/lib/mock-database.d.ts +0 -33
  147. package/lib/mock-database.js +0 -136
  148. package/lib/model-hook.d.ts +0 -20
  149. package/lib/model-hook.js +0 -96
  150. package/lib/model.d.ts +0 -32
  151. package/lib/model.js +0 -179
  152. package/lib/operators/array.d.ts +0 -10
  153. package/lib/operators/array.js +0 -196
  154. package/lib/operators/association.d.ts +0 -10
  155. package/lib/operators/association.js +0 -44
  156. package/lib/operators/boolean.d.ts +0 -10
  157. package/lib/operators/boolean.js +0 -47
  158. package/lib/operators/child-collection.d.ts +0 -10
  159. package/lib/operators/child-collection.js +0 -77
  160. package/lib/operators/date.d.ts +0 -10
  161. package/lib/operators/date.js +0 -149
  162. package/lib/operators/empty.d.ts +0 -13
  163. package/lib/operators/empty.js +0 -102
  164. package/lib/operators/eq.d.ts +0 -10
  165. package/lib/operators/eq.js +0 -44
  166. package/lib/operators/index.d.ts +0 -13
  167. package/lib/operators/index.js +0 -63
  168. package/lib/operators/ne.d.ts +0 -10
  169. package/lib/operators/ne.js +0 -49
  170. package/lib/operators/notIn.d.ts +0 -10
  171. package/lib/operators/notIn.js +0 -42
  172. package/lib/operators/string.d.ts +0 -10
  173. package/lib/operators/string.js +0 -118
  174. package/lib/operators/utils.d.ts +0 -12
  175. package/lib/operators/utils.js +0 -53
  176. package/lib/options-parser.d.ts +0 -45
  177. package/lib/options-parser.js +0 -350
  178. package/lib/query-interface/mysql-query-interface.d.ts +0 -44
  179. package/lib/query-interface/mysql-query-interface.js +0 -134
  180. package/lib/query-interface/postgres-query-interface.d.ts +0 -41
  181. package/lib/query-interface/postgres-query-interface.js +0 -207
  182. package/lib/query-interface/query-interface-builder.d.ts +0 -10
  183. package/lib/query-interface/query-interface-builder.js +0 -55
  184. package/lib/query-interface/query-interface.d.ts +0 -52
  185. package/lib/query-interface/query-interface.js +0 -59
  186. package/lib/query-interface/sqlite-query-interface.d.ts +0 -44
  187. package/lib/query-interface/sqlite-query-interface.js +0 -141
  188. package/lib/relation-repository/belongs-to-many-repository.d.ts +0 -28
  189. package/lib/relation-repository/belongs-to-many-repository.js +0 -248
  190. package/lib/relation-repository/belongs-to-repository.d.ts +0 -17
  191. package/lib/relation-repository/belongs-to-repository.js +0 -51
  192. package/lib/relation-repository/hasmany-repository.d.ts +0 -21
  193. package/lib/relation-repository/hasmany-repository.js +0 -158
  194. package/lib/relation-repository/hasone-repository.d.ts +0 -17
  195. package/lib/relation-repository/hasone-repository.js +0 -51
  196. package/lib/relation-repository/multiple-relation-repository.d.ts +0 -27
  197. package/lib/relation-repository/multiple-relation-repository.js +0 -200
  198. package/lib/relation-repository/relation-repository.d.ts +0 -38
  199. package/lib/relation-repository/relation-repository.js +0 -175
  200. package/lib/relation-repository/single-relation-repository.d.ts +0 -36
  201. package/lib/relation-repository/single-relation-repository.js +0 -151
  202. package/lib/relation-repository/types.d.ts +0 -15
  203. package/lib/relation-repository/types.js +0 -24
  204. package/lib/repositories/tree-repository/adjacency-list-repository.d.ts +0 -26
  205. package/lib/repositories/tree-repository/adjacency-list-repository.js +0 -192
  206. package/lib/repositories/view-repository.d.ts +0 -11
  207. package/lib/repositories/view-repository.js +0 -41
  208. package/lib/repository.d.ts +0 -214
  209. package/lib/repository.js +0 -609
  210. package/lib/sql-parser/index.d.ts +0 -13
  211. package/lib/sql-parser/index.js +0 -33
  212. package/lib/sync-runner.d.ts +0 -41
  213. package/lib/sync-runner.js +0 -335
  214. package/lib/types.d.ts +0 -57
  215. package/lib/types.js +0 -24
  216. package/lib/update-associations.d.ts +0 -68
  217. package/lib/update-associations.js +0 -429
  218. package/lib/update-guard.d.ts +0 -36
  219. package/lib/update-guard.js +0 -212
  220. package/lib/utils.d.ts +0 -15
  221. package/lib/utils.js +0 -136
  222. package/lib/value-parsers/array-value-parser.d.ts +0 -16
  223. package/lib/value-parsers/array-value-parser.js +0 -67
  224. package/lib/value-parsers/base-value-parser.d.ts +0 -20
  225. package/lib/value-parsers/base-value-parser.js +0 -72
  226. package/lib/value-parsers/boolean-value-parser.d.ts +0 -12
  227. package/lib/value-parsers/boolean-value-parser.js +0 -61
  228. package/lib/value-parsers/date-value-parser.d.ts +0 -13
  229. package/lib/value-parsers/date-value-parser.js +0 -99
  230. package/lib/value-parsers/index.d.ts +0 -20
  231. package/lib/value-parsers/index.js +0 -87
  232. package/lib/value-parsers/json-value-parser.d.ts +0 -12
  233. package/lib/value-parsers/json-value-parser.js +0 -56
  234. package/lib/value-parsers/number-value-parser.d.ts +0 -12
  235. package/lib/value-parsers/number-value-parser.js +0 -67
  236. package/lib/value-parsers/string-value-parser.d.ts +0 -16
  237. package/lib/value-parsers/string-value-parser.js +0 -73
  238. package/lib/value-parsers/to-many-value-parser.d.ts +0 -21
  239. package/lib/value-parsers/to-many-value-parser.js +0 -117
  240. package/lib/value-parsers/to-one-value-parser.d.ts +0 -12
  241. package/lib/value-parsers/to-one-value-parser.js +0 -57
  242. package/lib/view/field-type-map.d.ts +0 -109
  243. package/lib/view/field-type-map.js +0 -101
  244. package/lib/view/view-inference.d.ts +0 -40
  245. package/lib/view/view-inference.js +0 -157
  246. package/lib/view-collection.d.ts +0 -14
  247. package/lib/view-collection.js +0 -54
@@ -1,44 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var association_exports = {};
28
- __export(association_exports, {
29
- default: () => association_default
30
- });
31
- module.exports = __toCommonJS(association_exports);
32
- var import_sequelize = require("sequelize");
33
- var association_default = {
34
- $exists(value, ctx) {
35
- return {
36
- [import_sequelize.Op.not]: null
37
- };
38
- },
39
- $notExists(value, ctx) {
40
- return {
41
- [import_sequelize.Op.is]: null
42
- };
43
- }
44
- };
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: Record<string, any>;
10
- export default _default;
@@ -1,47 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var boolean_exports = {};
28
- __export(boolean_exports, {
29
- default: () => boolean_default
30
- });
31
- module.exports = __toCommonJS(boolean_exports);
32
- var import_sequelize = require("sequelize");
33
- var boolean_default = {
34
- $isFalsy() {
35
- return {
36
- [import_sequelize.Op.or]: {
37
- [import_sequelize.Op.is]: null,
38
- [import_sequelize.Op.eq]: false
39
- }
40
- };
41
- },
42
- $isTruly() {
43
- return {
44
- [import_sequelize.Op.eq]: true
45
- };
46
- }
47
- };
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: Record<string, any>;
10
- export default _default;
@@ -1,77 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
17
- var __export = (target, all) => {
18
- for (var name in all)
19
- __defProp(target, name, { get: all[name], enumerable: true });
20
- };
21
- var __copyProps = (to, from, except, desc) => {
22
- if (from && typeof from === "object" || typeof from === "function") {
23
- for (let key of __getOwnPropNames(from))
24
- if (!__hasOwnProp.call(to, key) && key !== except)
25
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
26
- }
27
- return to;
28
- };
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
- // If the importer is in node compatibility mode or this is not an ESM
31
- // file that has been converted to a CommonJS file using a Babel-
32
- // compatible transform (i.e. "__esModule" has not been set), then set
33
- // "default" to the CommonJS "module.exports" for node compatibility.
34
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
- mod
36
- ));
37
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
- var child_collection_exports = {};
39
- __export(child_collection_exports, {
40
- default: () => child_collection_default
41
- });
42
- module.exports = __toCommonJS(child_collection_exports);
43
- var import_lodash = __toESM(require("lodash"));
44
- var import_sequelize = require("sequelize");
45
- const mapVal = /* @__PURE__ */ __name((values, db) => values.map((v) => {
46
- const collection = db.getCollection(v);
47
- return import_sequelize.Sequelize.literal(`'${collection.tableNameAsString()}'::regclass`);
48
- }), "mapVal");
49
- const filterItems = /* @__PURE__ */ __name((values, db) => {
50
- return import_lodash.default.castArray(values).map((v) => {
51
- const collection = db.getCollection(v);
52
- if (!collection)
53
- return null;
54
- return `'${collection.tableNameAsString()}'::regclass`;
55
- }).filter(Boolean);
56
- }, "filterItems");
57
- const joinValues = /* @__PURE__ */ __name((items) => items.join(", "), "joinValues");
58
- var child_collection_default = {
59
- $childIn(values, ctx) {
60
- const db = ctx.db;
61
- const items = filterItems(values, db);
62
- if (items.length) {
63
- return import_sequelize.Sequelize.literal(`"${ctx.model.name}"."tableoid" IN (${joinValues(items)})`);
64
- } else {
65
- return import_sequelize.Sequelize.literal(`1 = 2`);
66
- }
67
- },
68
- $childNotIn(values, ctx) {
69
- const db = ctx.db;
70
- const items = filterItems(values, db);
71
- if (items.length) {
72
- return import_sequelize.Sequelize.literal(`"${ctx.model.name}"."tableoid" NOT IN (${joinValues(items)})`);
73
- } else {
74
- return import_sequelize.Sequelize.literal(`1 = 1`);
75
- }
76
- }
77
- };
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: Record<string, any>;
10
- export default _default;
@@ -1,149 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
15
- var __export = (target, all) => {
16
- for (var name in all)
17
- __defProp(target, name, { get: all[name], enumerable: true });
18
- };
19
- var __copyProps = (to, from, except, desc) => {
20
- if (from && typeof from === "object" || typeof from === "function") {
21
- for (let key of __getOwnPropNames(from))
22
- if (!__hasOwnProp.call(to, key) && key !== except)
23
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
- }
25
- return to;
26
- };
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var date_exports = {};
29
- __export(date_exports, {
30
- default: () => date_default
31
- });
32
- module.exports = __toCommonJS(date_exports);
33
- var import_utils = require("@nocobase/utils");
34
- var import_sequelize = require("sequelize");
35
- function isDate(input) {
36
- return input instanceof Date || Object.prototype.toString.call(input) === "[object Date]";
37
- }
38
- __name(isDate, "isDate");
39
- const toDate = /* @__PURE__ */ __name((date) => {
40
- if (isDate(date)) {
41
- return date;
42
- }
43
- return new Date(date);
44
- }, "toDate");
45
- var date_default = {
46
- $dateOn(value, ctx) {
47
- const r = (0, import_utils.parseDate)(value, {
48
- timezone: ctx.db.options.timezone
49
- });
50
- if (typeof r === "string") {
51
- return {
52
- [import_sequelize.Op.eq]: toDate(r)
53
- };
54
- }
55
- if (Array.isArray(r)) {
56
- return {
57
- [import_sequelize.Op.and]: [{ [import_sequelize.Op.gte]: toDate(r[0]) }, { [import_sequelize.Op.lt]: toDate(r[1]) }]
58
- };
59
- }
60
- throw new Error(`Invalid Date ${JSON.stringify(value)}`);
61
- },
62
- $dateNotOn(value, ctx) {
63
- const r = (0, import_utils.parseDate)(value, {
64
- timezone: ctx.db.options.timezone
65
- });
66
- if (typeof r === "string") {
67
- return {
68
- [import_sequelize.Op.ne]: toDate(r)
69
- };
70
- }
71
- if (Array.isArray(r)) {
72
- return {
73
- [import_sequelize.Op.or]: [{ [import_sequelize.Op.lt]: toDate(r[0]) }, { [import_sequelize.Op.gte]: toDate(r[1]) }]
74
- };
75
- }
76
- throw new Error(`Invalid Date ${JSON.stringify(value)}`);
77
- },
78
- $dateBefore(value, ctx) {
79
- const r = (0, import_utils.parseDate)(value, {
80
- timezone: ctx.db.options.timezone
81
- });
82
- if (typeof r === "string") {
83
- return {
84
- [import_sequelize.Op.lt]: toDate(r)
85
- };
86
- } else if (Array.isArray(r)) {
87
- return {
88
- [import_sequelize.Op.lt]: toDate(r[0])
89
- };
90
- }
91
- throw new Error(`Invalid Date ${JSON.stringify(value)}`);
92
- },
93
- $dateNotBefore(value, ctx) {
94
- const r = (0, import_utils.parseDate)(value, {
95
- timezone: ctx.db.options.timezone
96
- });
97
- if (typeof r === "string") {
98
- return {
99
- [import_sequelize.Op.gte]: toDate(r)
100
- };
101
- } else if (Array.isArray(r)) {
102
- return {
103
- [import_sequelize.Op.gte]: toDate(r[0])
104
- };
105
- }
106
- throw new Error(`Invalid Date ${JSON.stringify(value)}`);
107
- },
108
- $dateAfter(value, ctx) {
109
- const r = (0, import_utils.parseDate)(value, {
110
- timezone: ctx.db.options.timezone
111
- });
112
- if (typeof r === "string") {
113
- return {
114
- [import_sequelize.Op.gt]: toDate(r)
115
- };
116
- } else if (Array.isArray(r)) {
117
- return {
118
- [import_sequelize.Op.gte]: toDate(r[1])
119
- };
120
- }
121
- throw new Error(`Invalid Date ${JSON.stringify(value)}`);
122
- },
123
- $dateNotAfter(value, ctx) {
124
- const r = (0, import_utils.parseDate)(value, {
125
- timezone: ctx.db.options.timezone
126
- });
127
- if (typeof r === "string") {
128
- return {
129
- [import_sequelize.Op.lte]: toDate(r)
130
- };
131
- } else if (Array.isArray(r)) {
132
- return {
133
- [import_sequelize.Op.lt]: toDate(r[1])
134
- };
135
- }
136
- throw new Error(`Invalid Date ${JSON.stringify(value)}`);
137
- },
138
- $dateBetween(value, ctx) {
139
- const r = (0, import_utils.parseDate)(value, {
140
- timezone: ctx.db.options.timezone
141
- });
142
- if (r) {
143
- return {
144
- [import_sequelize.Op.and]: [{ [import_sequelize.Op.gte]: toDate(r[0]) }, { [import_sequelize.Op.lt]: toDate(r[1]) }]
145
- };
146
- }
147
- throw new Error(`Invalid Date ${JSON.stringify(value)}`);
148
- }
149
- };
@@ -1,13 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: {
10
- $empty(_: any, ctx: any): any;
11
- $notEmpty(_: any, ctx: any): any;
12
- };
13
- export default _default;
@@ -1,102 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
17
- var __export = (target, all) => {
18
- for (var name in all)
19
- __defProp(target, name, { get: all[name], enumerable: true });
20
- };
21
- var __copyProps = (to, from, except, desc) => {
22
- if (from && typeof from === "object" || typeof from === "function") {
23
- for (let key of __getOwnPropNames(from))
24
- if (!__hasOwnProp.call(to, key) && key !== except)
25
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
26
- }
27
- return to;
28
- };
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
- // If the importer is in node compatibility mode or this is not an ESM
31
- // file that has been converted to a CommonJS file using a Babel-
32
- // compatible transform (i.e. "__esModule" has not been set), then set
33
- // "default" to the CommonJS "module.exports" for node compatibility.
34
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
- mod
36
- ));
37
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
- var empty_exports = {};
39
- __export(empty_exports, {
40
- default: () => empty_default
41
- });
42
- module.exports = __toCommonJS(empty_exports);
43
- var import_sequelize = require("sequelize");
44
- var import_fields = require("../fields");
45
- var import_array = __toESM(require("./array"));
46
- var import_lodash = __toESM(require("lodash"));
47
- const findFilterFieldType = /* @__PURE__ */ __name((ctx) => {
48
- const db = ctx.db;
49
- const path = ctx.path.split(".");
50
- path.pop();
51
- const fieldName = path.pop();
52
- let model = ctx.model;
53
- const associationPath = path;
54
- for (const association of associationPath) {
55
- if (import_lodash.default.isFinite((0, import_lodash.parseInt)(association)) || association.startsWith("$")) {
56
- continue;
57
- }
58
- const modelAssociation = model.associations[association];
59
- if (!modelAssociation) {
60
- break;
61
- }
62
- model = modelAssociation.target;
63
- }
64
- const collection = db.modelCollection.get(model);
65
- return collection.getField(fieldName);
66
- }, "findFilterFieldType");
67
- var empty_default = {
68
- $empty(_, ctx) {
69
- const field = findFilterFieldType(ctx);
70
- if (field instanceof import_fields.StringField) {
71
- return {
72
- [import_sequelize.Op.or]: {
73
- [import_sequelize.Op.is]: null,
74
- [import_sequelize.Op.eq]: ""
75
- }
76
- };
77
- }
78
- if (field instanceof import_fields.ArrayField) {
79
- return import_array.default.$arrayEmpty(_, ctx);
80
- }
81
- return {
82
- [import_sequelize.Op.is]: null
83
- };
84
- },
85
- $notEmpty(_, ctx) {
86
- const field = findFilterFieldType(ctx);
87
- if (field instanceof import_fields.StringField) {
88
- return {
89
- [import_sequelize.Op.and]: {
90
- [import_sequelize.Op.not]: null,
91
- [import_sequelize.Op.ne]: ""
92
- }
93
- };
94
- }
95
- if (field instanceof import_fields.ArrayField) {
96
- return import_array.default.$arrayNotEmpty(_, ctx);
97
- }
98
- return {
99
- [import_sequelize.Op.not]: null
100
- };
101
- }
102
- };
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: Record<string, any>;
10
- export default _default;
@@ -1,44 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var eq_exports = {};
28
- __export(eq_exports, {
29
- default: () => eq_default
30
- });
31
- module.exports = __toCommonJS(eq_exports);
32
- var import_sequelize = require("sequelize");
33
- var eq_default = {
34
- $eq(val) {
35
- if (Array.isArray(val)) {
36
- return {
37
- [import_sequelize.Op.in]: val
38
- };
39
- }
40
- return {
41
- [import_sequelize.Op.eq]: val
42
- };
43
- }
44
- };
@@ -1,13 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: {
10
- $empty(_: any, ctx: any): any;
11
- $notEmpty(_: any, ctx: any): any;
12
- };
13
- export default _default;
@@ -1,63 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var operators_exports = {};
38
- __export(operators_exports, {
39
- default: () => operators_default
40
- });
41
- module.exports = __toCommonJS(operators_exports);
42
- var import_association = __toESM(require("./association"));
43
- var import_date = __toESM(require("./date"));
44
- var import_array = __toESM(require("./array"));
45
- var import_empty = __toESM(require("./empty"));
46
- var import_string = __toESM(require("./string"));
47
- var import_eq = __toESM(require("./eq"));
48
- var import_ne = __toESM(require("./ne"));
49
- var import_notIn = __toESM(require("./notIn"));
50
- var import_boolean = __toESM(require("./boolean"));
51
- var import_child_collection = __toESM(require("./child-collection"));
52
- var operators_default = {
53
- ...import_association.default,
54
- ...import_date.default,
55
- ...import_array.default,
56
- ...import_empty.default,
57
- ...import_string.default,
58
- ...import_eq.default,
59
- ...import_ne.default,
60
- ...import_notIn.default,
61
- ...import_boolean.default,
62
- ...import_child_collection.default
63
- };
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: Record<string, any>;
10
- export default _default;
@@ -1,49 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var ne_exports = {};
28
- __export(ne_exports, {
29
- default: () => ne_default
30
- });
31
- module.exports = __toCommonJS(ne_exports);
32
- var import_sequelize = require("sequelize");
33
- var ne_default = {
34
- $ne(val, ctx) {
35
- if (Array.isArray(val)) {
36
- return {
37
- [import_sequelize.Op.notIn]: val
38
- };
39
- }
40
- return val === null ? {
41
- [import_sequelize.Op.ne]: null
42
- } : {
43
- [import_sequelize.Op.or]: {
44
- [import_sequelize.Op.ne]: val,
45
- [import_sequelize.Op.is]: null
46
- }
47
- };
48
- }
49
- };
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: Record<string, any>;
10
- export default _default;