@wzyjs/utils 0.2.13 → 0.2.20

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 (117) hide show
  1. package/dist/cjs/browser/element.d.ts +0 -1
  2. package/dist/cjs/browser/index.js +3 -1
  3. package/dist/cjs/browser/initHttpClient.js +62 -0
  4. package/dist/cjs/browser/other.d.ts +0 -1
  5. package/dist/cjs/browser/style.d.ts +0 -1
  6. package/dist/cjs/browser.d.ts +0 -1
  7. package/dist/cjs/common/array.d.ts +2 -0
  8. package/dist/cjs/common/array.js +68 -0
  9. package/dist/cjs/common/classs.d.ts +0 -1
  10. package/dist/cjs/common/dayjs.js +1 -0
  11. package/dist/cjs/common/index.d.ts +1 -1
  12. package/dist/cjs/common/index.js +3 -1
  13. package/dist/cjs/common/number.d.ts +1 -1
  14. package/dist/cjs/common/number.js +14 -0
  15. package/dist/cjs/common/object.d.ts +0 -1
  16. package/dist/cjs/common/other.d.ts +0 -1
  17. package/dist/cjs/common/string.d.ts +2 -1
  18. package/dist/cjs/common/string.js +33 -0
  19. package/dist/cjs/node/file/index.js +58 -0
  20. package/dist/cjs/node/index.d.ts +1 -1
  21. package/dist/cjs/node/index.js +3 -1
  22. package/dist/cjs/node/jsonFile/config.json +8 -0
  23. package/dist/cjs/node/jsonFile/index.d.ts +3 -3
  24. package/dist/cjs/node/jsonFile/index.js +37 -13
  25. package/dist/cjs/node/mail/index.d.ts +0 -1
  26. package/dist/cjs/node.d.ts +0 -1
  27. package/dist/esm/browser/element.d.ts +0 -1
  28. package/dist/esm/browser/index.js +2 -1
  29. package/dist/esm/{node/database/Collection.js → browser/initHttpClient.js} +51 -340
  30. package/dist/esm/browser/other.d.ts +0 -1
  31. package/dist/esm/browser/style.d.ts +0 -1
  32. package/dist/esm/browser.d.ts +0 -1
  33. package/dist/esm/common/array.d.ts +2 -0
  34. package/dist/esm/common/array.js +65 -0
  35. package/dist/esm/common/classs.d.ts +0 -1
  36. package/dist/esm/common/dayjs.js +1 -0
  37. package/dist/esm/common/index.d.ts +1 -1
  38. package/dist/esm/common/index.js +1 -0
  39. package/dist/esm/common/number.d.ts +1 -1
  40. package/dist/esm/common/number.js +21 -0
  41. package/dist/esm/common/object.d.ts +0 -1
  42. package/dist/esm/common/other.d.ts +0 -1
  43. package/dist/esm/common/string.d.ts +2 -1
  44. package/dist/esm/common/string.js +40 -0
  45. package/dist/esm/node/file/index.js +52 -0
  46. package/dist/esm/node/index.d.ts +1 -1
  47. package/dist/esm/node/index.js +1 -1
  48. package/dist/esm/node/jsonFile/index.d.ts +3 -3
  49. package/dist/esm/node/jsonFile/index.js +79 -21
  50. package/dist/esm/node/mail/index.d.ts +0 -1
  51. package/dist/esm/node.d.ts +0 -1
  52. package/package.json +8 -8
  53. package/dist/cjs/browser/element.d.ts.map +0 -1
  54. package/dist/cjs/browser/index.d.ts +0 -19
  55. package/dist/cjs/browser/index.d.ts.map +0 -1
  56. package/dist/cjs/browser/other.d.ts.map +0 -1
  57. package/dist/cjs/browser/style.d.ts.map +0 -1
  58. package/dist/cjs/browser.d.ts.map +0 -1
  59. package/dist/cjs/common/classs.d.ts.map +0 -1
  60. package/dist/cjs/common/dayjs.d.ts +0 -8
  61. package/dist/cjs/common/dayjs.d.ts.map +0 -1
  62. package/dist/cjs/common/index.d.ts.map +0 -1
  63. package/dist/cjs/common/number.d.ts.map +0 -1
  64. package/dist/cjs/common/object.d.ts.map +0 -1
  65. package/dist/cjs/common/other.d.ts.map +0 -1
  66. package/dist/cjs/common/string.d.ts.map +0 -1
  67. package/dist/cjs/node/database/Collection.d.ts +0 -23
  68. package/dist/cjs/node/database/Collection.d.ts.map +0 -1
  69. package/dist/cjs/node/database/Collection.js +0 -219
  70. package/dist/cjs/node/database/Database.d.ts +0 -11
  71. package/dist/cjs/node/database/Database.d.ts.map +0 -1
  72. package/dist/cjs/node/database/Database.js +0 -47
  73. package/dist/cjs/node/database/index.d.ts +0 -3
  74. package/dist/cjs/node/database/index.d.ts.map +0 -1
  75. package/dist/cjs/node/database/index.js +0 -38
  76. package/dist/cjs/node/database/types.d.ts +0 -152
  77. package/dist/cjs/node/database/types.d.ts.map +0 -1
  78. package/dist/cjs/node/database/types.js +0 -51
  79. package/dist/cjs/node/database/utils.d.ts +0 -4
  80. package/dist/cjs/node/database/utils.d.ts.map +0 -1
  81. package/dist/cjs/node/database/utils.js +0 -53
  82. package/dist/cjs/node/index.d.ts.map +0 -1
  83. package/dist/cjs/node/jsonFile/index.d.ts.map +0 -1
  84. package/dist/cjs/node/mail/index.d.ts.map +0 -1
  85. package/dist/cjs/node.d.ts.map +0 -1
  86. package/dist/esm/browser/element.d.ts.map +0 -1
  87. package/dist/esm/browser/index.d.ts +0 -19
  88. package/dist/esm/browser/index.d.ts.map +0 -1
  89. package/dist/esm/browser/other.d.ts.map +0 -1
  90. package/dist/esm/browser/style.d.ts.map +0 -1
  91. package/dist/esm/browser.d.ts.map +0 -1
  92. package/dist/esm/common/classs.d.ts.map +0 -1
  93. package/dist/esm/common/dayjs.d.ts +0 -8
  94. package/dist/esm/common/dayjs.d.ts.map +0 -1
  95. package/dist/esm/common/index.d.ts.map +0 -1
  96. package/dist/esm/common/number.d.ts.map +0 -1
  97. package/dist/esm/common/object.d.ts.map +0 -1
  98. package/dist/esm/common/other.d.ts.map +0 -1
  99. package/dist/esm/common/string.d.ts.map +0 -1
  100. package/dist/esm/node/database/Collection.d.ts +0 -23
  101. package/dist/esm/node/database/Collection.d.ts.map +0 -1
  102. package/dist/esm/node/database/Database.d.ts +0 -11
  103. package/dist/esm/node/database/Database.d.ts.map +0 -1
  104. package/dist/esm/node/database/Database.js +0 -36
  105. package/dist/esm/node/database/index.d.ts +0 -3
  106. package/dist/esm/node/database/index.d.ts.map +0 -1
  107. package/dist/esm/node/database/index.js +0 -2
  108. package/dist/esm/node/database/types.d.ts +0 -152
  109. package/dist/esm/node/database/types.d.ts.map +0 -1
  110. package/dist/esm/node/database/types.js +0 -55
  111. package/dist/esm/node/database/utils.d.ts +0 -4
  112. package/dist/esm/node/database/utils.d.ts.map +0 -1
  113. package/dist/esm/node/database/utils.js +0 -29
  114. package/dist/esm/node/index.d.ts.map +0 -1
  115. package/dist/esm/node/jsonFile/index.d.ts.map +0 -1
  116. package/dist/esm/node/mail/index.d.ts.map +0 -1
  117. package/dist/esm/node.d.ts.map +0 -1
@@ -1,219 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/node/database/Collection.ts
20
- var Collection_exports = {};
21
- __export(Collection_exports, {
22
- Collection: () => Collection
23
- });
24
- module.exports = __toCommonJS(Collection_exports);
25
- var import_lodash = require("lodash");
26
- var import_utils = require("./utils");
27
- var import_types = require("./types");
28
- var Collection = class {
29
- constructor(db, name) {
30
- this.db = db;
31
- this.collection = db.collection(name);
32
- }
33
- joinConditions(conditions) {
34
- let record = this.collection;
35
- if (!conditions) {
36
- return record;
37
- }
38
- if ("_id" in conditions) {
39
- record = record.doc(conditions._id);
40
- } else {
41
- const { page, order, where, options } = conditions;
42
- if (options) {
43
- record = record.options(options);
44
- }
45
- if (where) {
46
- record = record.where(where);
47
- }
48
- if (order) {
49
- record = record.orderBy(order.field, order.type || "desc");
50
- }
51
- if ((page == null ? void 0 : page.current) && (page == null ? void 0 : page.size)) {
52
- record = record.skip((page.current - 1) * page.size);
53
- }
54
- if (page == null ? void 0 : page.size) {
55
- record = record.limit(page.size);
56
- }
57
- }
58
- if (Array.isArray(conditions.field)) {
59
- record = record.field(conditions.field.reduce((o, i) => ({ ...o, [i]: true }), {}));
60
- } else if (conditions.field) {
61
- record = record.field(conditions.field);
62
- }
63
- return record;
64
- }
65
- request(params) {
66
- switch (params.method) {
67
- case import_types.Method.Add:
68
- return this.joinConditions().add(params.data);
69
- case import_types.Method.Find:
70
- case import_types.Method.FindList:
71
- return this.joinConditions(params.conditions).get();
72
- case import_types.Method.Delete:
73
- return this.joinConditions(params.conditions).remove();
74
- case import_types.Method.Update:
75
- if (params.isSet && "_id" in params.conditions) {
76
- return this.joinConditions(params.conditions).set(params.data);
77
- }
78
- return this.joinConditions(params.conditions).update(params.data);
79
- case import_types.Method.Count:
80
- return this.joinConditions(params.conditions).count();
81
- default:
82
- throw new Error("method is not exist");
83
- }
84
- }
85
- // 处理出参
86
- async handleRes(params, res) {
87
- var _a, _b;
88
- if (res) {
89
- delete res.requestId;
90
- }
91
- let data = res;
92
- switch (params.method) {
93
- case import_types.Method.Add:
94
- const addRes = res;
95
- if (addRes.id && params.isReturn) {
96
- data = await this.find({ _id: addRes.id, field: (_a = params.conditions) == null ? void 0 : _a.field });
97
- }
98
- break;
99
- case import_types.Method.Update:
100
- const updateRes = res;
101
- if (updateRes.updated && params.isReturn && "_id" in params.conditions) {
102
- data = await this.find({ _id: params.conditions._id, field: (_b = params.conditions) == null ? void 0 : _b.field });
103
- }
104
- break;
105
- case import_types.Method.Find:
106
- const getRes = res;
107
- data = (getRes == null ? void 0 : getRes.data[0]) || null;
108
- break;
109
- case import_types.Method.FindList:
110
- const getListRes = res;
111
- const countRes = await this.request({
112
- method: import_types.Method.Count,
113
- conditions: params.conditions
114
- });
115
- data = {
116
- list: getListRes.data,
117
- total: countRes.total
118
- };
119
- break;
120
- }
121
- return data;
122
- }
123
- // 处理数据
124
- async handleData(params) {
125
- switch (params.method) {
126
- case import_types.Method.Add:
127
- params.data = (0, import_utils.appendTime)(params.data, "create");
128
- params.data = (0, import_utils.appendTime)(params.data, "update");
129
- break;
130
- case import_types.Method.Update:
131
- if ("_id" in params.data) {
132
- delete params.data._id;
133
- }
134
- break;
135
- }
136
- return params;
137
- }
138
- // 处理条件
139
- handleConditions(params) {
140
- if (params.method !== import_types.Method.Add) {
141
- params.conditions = (0, import_lodash.merge)((0, import_lodash.cloneDeep)(import_utils.defaultConditions), params.conditions);
142
- }
143
- if (params.conditions && "where" in params.conditions) {
144
- const { command: _ } = this.db;
145
- for (const key in params.conditions.where) {
146
- const whereValue = params.conditions.where[key];
147
- if ((0, import_lodash.isObject)(whereValue)) {
148
- const { type, value } = whereValue;
149
- switch (type) {
150
- case import_types.Command.In:
151
- params.conditions.where[key] = _.in(value);
152
- break;
153
- case import_types.Command.Nin:
154
- params.conditions.where[key] = _.nin(value);
155
- break;
156
- case import_types.Command.Gt:
157
- params.conditions.where[key] = _.gt(value);
158
- break;
159
- case import_types.Command.Gte:
160
- params.conditions.where[key] = _.gte(value);
161
- break;
162
- case import_types.Command.Lt:
163
- params.conditions.where[key] = _.lt(value);
164
- break;
165
- case import_types.Command.Lte:
166
- params.conditions.where[key] = _.lte(value);
167
- break;
168
- case import_types.Command.Eq:
169
- params.conditions.where[key] = _.eq(value);
170
- break;
171
- case import_types.Command.Neq:
172
- params.conditions.where[key] = _.neq(value);
173
- break;
174
- case import_types.Command.Gtlt:
175
- params.conditions.where[key] = _.and(_.gt(value[0]), _.lt(value[1]));
176
- break;
177
- default:
178
- const check = type;
179
- console.error(666, "处理 where 条件 出现未定义的情况", check);
180
- break;
181
- }
182
- }
183
- }
184
- }
185
- return params;
186
- }
187
- async exec(params) {
188
- params = await this.handleData(params);
189
- params = await this.handleConditions(params);
190
- const res = await this.request(params);
191
- return this.handleRes(params, res);
192
- }
193
- add(data, isReturn, conditions) {
194
- return this.exec({ method: import_types.Method.Add, conditions, data, isReturn });
195
- }
196
- // 删
197
- delete(conditions) {
198
- return this.exec({ method: import_types.Method.Delete, conditions });
199
- }
200
- update(conditions, data, isReturn, isSet) {
201
- return this.exec({ method: import_types.Method.Update, conditions, data, isReturn, isSet });
202
- }
203
- // 查
204
- find(conditions) {
205
- return this.exec({ method: import_types.Method.Find, conditions });
206
- }
207
- // 查列表
208
- findList(conditions) {
209
- return this.exec({ method: import_types.Method.FindList, conditions });
210
- }
211
- // 查
212
- count(conditions) {
213
- return this.exec({ method: import_types.Method.Count, conditions });
214
- }
215
- };
216
- // Annotate the CommonJS export names for ESM import in node:
217
- 0 && (module.exports = {
218
- Collection
219
- });
@@ -1,11 +0,0 @@
1
- import tcb, { IKeyValue } from '@cloudbase/node-sdk';
2
- import { Config } from './types';
3
- import { Collection } from './Collection';
4
- export declare class Database {
5
- private readonly db;
6
- private readonly instance;
7
- constructor(config: Config);
8
- collection<D extends IKeyValue>(name: string): Collection<D>;
9
- createCollection(name: string): tcb.IBaseRes;
10
- }
11
- //# sourceMappingURL=Database.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Database.d.ts","sourceRoot":"","sources":["Database.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,EAAE,EAAQ,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAiB;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+C;gBAE5D,MAAM,EAAE,MAAM;IAKnB,UAAU,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC;IAQ5D,gBAAgB,CAAC,IAAI,EAAE,MAAM;CAGrC"}
@@ -1,47 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/node/database/Database.ts
20
- var Database_exports = {};
21
- __export(Database_exports, {
22
- Database: () => Database
23
- });
24
- module.exports = __toCommonJS(Database_exports);
25
- var import_node_sdk = require("@cloudbase/node-sdk");
26
- var import_Collection = require("./Collection");
27
- var Database = class {
28
- constructor(config) {
29
- this.instance = {};
30
- this.db = (0, import_node_sdk.init)(config).database();
31
- }
32
- // 封装了较多功能的 collection
33
- collection(name) {
34
- if (!this.instance[name]) {
35
- this.instance[name] = new import_Collection.Collection(this.db, name);
36
- }
37
- return this.instance[name];
38
- }
39
- // 创建 collection
40
- createCollection(name) {
41
- return this.db.createCollection(name);
42
- }
43
- };
44
- // Annotate the CommonJS export names for ESM import in node:
45
- 0 && (module.exports = {
46
- Database
47
- });
@@ -1,3 +0,0 @@
1
- export { Database } from './Database';
2
- export { Conditions, IdConditions, WhereConditions, Record } from './types';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA"}
@@ -1,38 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/node/database/index.ts
20
- var database_exports = {};
21
- __export(database_exports, {
22
- Conditions: () => import_types.Conditions,
23
- Database: () => import_Database.Database,
24
- IdConditions: () => import_types.IdConditions,
25
- Record: () => import_types.Record,
26
- WhereConditions: () => import_types.WhereConditions
27
- });
28
- module.exports = __toCommonJS(database_exports);
29
- var import_Database = require("./Database");
30
- var import_types = require("./types");
31
- // Annotate the CommonJS export names for ESM import in node:
32
- 0 && (module.exports = {
33
- Conditions,
34
- Database,
35
- IdConditions,
36
- Record,
37
- WhereConditions
38
- });
@@ -1,152 +0,0 @@
1
- import { Database, ICountRes } from '@cloudbase/node-sdk';
2
- export interface Config {
3
- env: string;
4
- secretId: string;
5
- secretKey: string;
6
- }
7
- export declare type IdConditions = {
8
- _id: string;
9
- field?: string[] | {
10
- [key: string]: false;
11
- };
12
- options?: {
13
- timeout: number;
14
- multiple?: false;
15
- };
16
- };
17
- export declare enum Command {
18
- Eq = "eq",
19
- Neq = "neq",
20
- Lt = "lt",
21
- Lte = "lte",
22
- Gt = "gt",
23
- Gte = "gte",
24
- In = "in",
25
- Nin = "nin",
26
- Gtlt = "gtlt"
27
- }
28
- export declare type CommandWhere = {
29
- type: Command.Eq;
30
- value: any;
31
- } | {
32
- type: Command.Neq;
33
- value: any;
34
- } | {
35
- type: Command.Gt;
36
- value: number;
37
- } | {
38
- type: Command.Gte;
39
- value: number;
40
- } | {
41
- type: Command.Lt;
42
- value: number;
43
- } | {
44
- type: Command.Lte;
45
- value: number;
46
- } | {
47
- type: Command.Gtlt;
48
- value: number[];
49
- } | {
50
- type: Command.In;
51
- value: any[];
52
- } | {
53
- type: Command.Nin;
54
- value: any[];
55
- };
56
- export declare type WhereConditions = {
57
- where?: {
58
- [key: string]: any | CommandWhere;
59
- };
60
- field?: string[] | {
61
- [key: string]: false;
62
- };
63
- page?: {
64
- size?: number;
65
- current?: number;
66
- };
67
- order?: {
68
- field: string;
69
- type?: 'asc' | 'desc';
70
- };
71
- options?: {
72
- timeout?: number;
73
- multiple?: boolean;
74
- };
75
- };
76
- export declare type Conditions = IdConditions | WhereConditions;
77
- export declare enum Method {
78
- Add = "add",
79
- Find = "find",
80
- FindList = "findList",
81
- Delete = "delete",
82
- Update = "update",
83
- Count = "count"
84
- }
85
- export declare namespace Add {
86
- type Params<D> = {
87
- method: Method.Add;
88
- data: D;
89
- conditions?: Pick<IdConditions, 'field'>;
90
- isReturn?: true;
91
- };
92
- type Res = {
93
- id: string;
94
- };
95
- }
96
- export declare namespace Find {
97
- type Params = {
98
- method: Method.Find;
99
- conditions?: Conditions;
100
- };
101
- type Res<D> = Record<D> | undefined;
102
- }
103
- export declare namespace FindList {
104
- type Params = {
105
- method: Method.FindList;
106
- conditions?: WhereConditions;
107
- };
108
- type Res<D> = {
109
- list?: Record<D>[];
110
- total?: number;
111
- };
112
- }
113
- export declare namespace Delete {
114
- type Params = {
115
- method: Method.Delete;
116
- conditions: Conditions;
117
- };
118
- type Res = {
119
- deleted: number | string;
120
- };
121
- }
122
- export declare namespace Update {
123
- type Params<D> = {
124
- method: Method.Update;
125
- conditions: Conditions;
126
- data: Partial<Record<D>>;
127
- isReturn?: true;
128
- isSet?: true;
129
- };
130
- type Res<D> = {
131
- updated?: number;
132
- doc?: D;
133
- };
134
- }
135
- export declare namespace Count {
136
- type Params = {
137
- method: Method.Count;
138
- conditions?: WhereConditions;
139
- };
140
- type Res = {
141
- total?: number;
142
- };
143
- }
144
- export declare type MethodParams<D> = Add.Params<D> | Find.Params | FindList.Params | Delete.Params | Update.Params<D> | Count.Params;
145
- export declare type MethodRes<D> = Add.Res | Find.Res<D> | FindList.Res<D> | Delete.Res | Update.Res<D> | Count.Res;
146
- export declare type IRes = Database.IAddRes | Database.IGetRes | Database.IDeleteResult | Database.IUpdateResult | ICountRes;
147
- export declare type Record<D> = D & {
148
- _id: string;
149
- createAt: number;
150
- updateAt: number;
151
- };
152
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAGzD,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAGD,oBAAY,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAA;KAAE,CAAA;IAC3C,OAAO,CAAC,EAAE;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,KAAK,CAAA;KACjB,CAAA;CACF,CAAA;AAGD,oBAAY,OAAO;IACjB,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED,oBAAY,YAAY,GAAG;IACzB,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC;IACjB,KAAK,EAAE,GAAG,CAAA;CACX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AA;AAGpH,oBAAY,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAA"}
@@ -1,51 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/node/database/types.ts
20
- var types_exports = {};
21
- __export(types_exports, {
22
- Command: () => Command,
23
- Method: () => Method
24
- });
25
- module.exports = __toCommonJS(types_exports);
26
- var Command = /* @__PURE__ */ ((Command2) => {
27
- Command2["Eq"] = "eq";
28
- Command2["Neq"] = "neq";
29
- Command2["Lt"] = "lt";
30
- Command2["Lte"] = "lte";
31
- Command2["Gt"] = "gt";
32
- Command2["Gte"] = "gte";
33
- Command2["In"] = "in";
34
- Command2["Nin"] = "nin";
35
- Command2["Gtlt"] = "gtlt";
36
- return Command2;
37
- })(Command || {});
38
- var Method = /* @__PURE__ */ ((Method2) => {
39
- Method2["Add"] = "add";
40
- Method2["Find"] = "find";
41
- Method2["FindList"] = "findList";
42
- Method2["Delete"] = "delete";
43
- Method2["Update"] = "update";
44
- Method2["Count"] = "count";
45
- return Method2;
46
- })(Method || {});
47
- // Annotate the CommonJS export names for ESM import in node:
48
- 0 && (module.exports = {
49
- Command,
50
- Method
51
- });
@@ -1,4 +0,0 @@
1
- import { Conditions } from './types';
2
- export declare const appendTime: <D>(data: D, type: 'create' | 'update') => D;
3
- export declare const defaultConditions: Conditions;
4
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAGpC,eAAO,MAAM,UAAU,qBAAsB,QAAQ,GAAG,QAAQ,MAQ/D,CAAA;AAGD,eAAO,MAAM,iBAAiB,EAAE,UAa/B,CAAA"}
@@ -1,53 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/node/database/utils.ts
20
- var utils_exports = {};
21
- __export(utils_exports, {
22
- appendTime: () => appendTime,
23
- defaultConditions: () => defaultConditions
24
- });
25
- module.exports = __toCommonJS(utils_exports);
26
- var appendTime = (data, type) => {
27
- if (!data) {
28
- return {};
29
- }
30
- return {
31
- ...data,
32
- [type + "At"]: Date.now()
33
- };
34
- };
35
- var defaultConditions = {
36
- order: {
37
- field: "createAt",
38
- type: "desc"
39
- },
40
- options: {
41
- timeout: 1e4,
42
- multiple: true
43
- },
44
- page: {
45
- current: 1,
46
- size: 10
47
- }
48
- };
49
- // Annotate the CommonJS export names for ESM import in node:
50
- 0 && (module.exports = {
51
- appendTime,
52
- defaultConditions
53
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AAEtB,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAIA,qBAAa,QAAQ;IACnB,QAAQ,EAAE,MAAM,CAAC;gBAEL,QAAQ,EAAE,MAAM;IAI5B,GAAG,CAAC,GAAG,EAAE,MAAM;IASf,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;CAQ5B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,QAAQ,YAAmB,MAAM,SAAS,MAAM,YAAY,MAAM,oBAY9E,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["node.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["element.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,cAAc,OAAQ,OAAO,WAAW,qBAAqB,SAKzE,CAAA;AAGD,eAAO,MAAM,UAAU,OAAQ,MAAM,GAAG,OAAO;;;;;;CAa9C,CAAA;AAGD,eAAO,MAAM,mBAAmB,OAAQ,MAAM,GAAG,OAAO,wBAYvD,CAAA"}
@@ -1,19 +0,0 @@
1
- import md5 from 'md5';
2
- import classnames from 'classnames';
3
- import copy from 'copy-to-clipboard';
4
- import anime from 'animejs';
5
- export { copy, classnames, md5, anime };
6
- export declare const localforage: {
7
- config: {
8
- (options: LocalForageOptions): boolean;
9
- (options: string): any;
10
- (): LocalForageOptions;
11
- };
12
- setItem: <T>(key: string, value: T, callback?: ((err: any, value: T) => void) | undefined) => Promise<T>;
13
- getItem: <T_1>(key: string, callback?: ((err: any, value: T_1 | null) => void) | undefined) => Promise<T_1 | null>;
14
- removeItem: (key: string, callback?: ((err: any) => void) | undefined) => Promise<void>;
15
- };
16
- export * from './style';
17
- export * from './element';
18
- export * from './other';
19
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,IAAI,MAAM,mBAAmB,CAAA;AAGpC,OAAO,KAAK,MAAM,SAAS,CAAA;AAE3B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;AAEvC,eAAO,MAAM,WAAW;;;;;;;;;CAKvB,CAAA;AAED,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"other.d.ts","sourceRoot":"","sources":["other.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,uBAMzB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["style.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS,aAAc,MAAM;;;;;;;CAQzC,CAAA;AAGD,eAAO,MAAM,eAAe,OAAQ,MAAM,GAAG,OAAO,SAAS,MAAM,qBAclE,CAAA;AAGD,eAAO,MAAM,WAAW,OAAQ,MAAM,GAAG,OAAO,SAAS,MAAM,qBAc9D,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["browser.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"classs.d.ts","sourceRoot":"","sources":["classs.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAY,SAAQ,KAAK;IACpC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,GAAG,CAAA;gBAEE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;CAMvD"}
@@ -1,8 +0,0 @@
1
- import dayjs from 'dayjs';
2
- import 'dayjs/locale/zh-cn';
3
- export declare enum Timezone {
4
- AsiaShanghai = "Asia/Shanghai"
5
- }
6
- export { Dayjs } from 'dayjs';
7
- export default dayjs;
8
- //# sourceMappingURL=dayjs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dayjs.d.ts","sourceRoot":"","sources":["dayjs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB,OAAO,oBAAoB,CAAA;AAgB3B,oBAAY,QAAQ;IAClB,YAAY,kBAAkB;CAC/B;AAED,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAE7B,eAAe,KAAK,CAAA"}