@ix-xs/node-comfort 1.0.54 → 1.0.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ix-xs/node-comfort",
3
- "version": "1.0.54",
3
+ "version": "1.0.55",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -106,6 +106,19 @@ module.exports = class localStorage {
106
106
  return `${firstCol} DESC`;
107
107
  }
108
108
 
109
+ /**
110
+ * @param {object} table
111
+ * @param {string} table.name
112
+ * @param {Record<string, {
113
+ * type: "INTEGER"|"TEXT"|"REAL"|"BLOB"|"NUMERIC",
114
+ * primaryKey?: boolean,
115
+ * autoincrement?: boolean,
116
+ * notNull?: boolean,
117
+ * unique?: boolean,
118
+ * defaultValue?: *,
119
+ * values?: Array<*>
120
+ * }>} table.options
121
+ */
109
122
  async createTable(table) {
110
123
  try {
111
124
  this.#defineModel(table.name, table.options);
@@ -115,6 +128,9 @@ module.exports = class localStorage {
115
128
  }
116
129
  }
117
130
 
131
+ /**
132
+ * @param {string} tableName
133
+ */
118
134
  async deleteTable(tableName) {
119
135
  try {
120
136
  if (!this.#models.has(tableName)) {
@@ -129,6 +145,9 @@ module.exports = class localStorage {
129
145
  }
130
146
  }
131
147
 
148
+ /**
149
+ * @param {string} tableName
150
+ */
132
151
  async clearTable(tableName) {
133
152
  try {
134
153
  if (!this.#models.has(tableName)) {
@@ -142,6 +161,10 @@ module.exports = class localStorage {
142
161
  }
143
162
  }
144
163
 
164
+ /**
165
+ * @param {string} tableName
166
+ * @param {object} where
167
+ */
145
168
  async get(tableName, where) {
146
169
  try {
147
170
  if (!this.#models.has(tableName)) return undefined;
@@ -157,6 +180,12 @@ module.exports = class localStorage {
157
180
  }
158
181
  }
159
182
 
183
+ /**
184
+ * @param {string} tableName
185
+ * @param {object} where
186
+ * @param {number} limit
187
+ * @param {number} offset
188
+ */
160
189
  async getAll(tableName, where = {}, limit = 50, offset = 0) {
161
190
  try {
162
191
  if (!this.#models.has(tableName)) return [];
@@ -173,6 +202,11 @@ module.exports = class localStorage {
173
202
  }
174
203
  }
175
204
 
205
+ /**
206
+ * @param {string} tableName
207
+ * @param {*} data
208
+ * @param {object} where
209
+ */
176
210
  async set(tableName, data, where = null) {
177
211
  try {
178
212
  if (!this.#models.has(tableName)) {
@@ -196,6 +230,10 @@ module.exports = class localStorage {
196
230
  }
197
231
  }
198
232
 
233
+ /**
234
+ * @param {string} tableName
235
+ * @param {object} where
236
+ */
199
237
  async delete(tableName, where) {
200
238
  try {
201
239
  if (!this.#models.has(tableName)) {
@@ -212,6 +250,10 @@ module.exports = class localStorage {
212
250
  }
213
251
  }
214
252
 
253
+ /**
254
+ * @param {string} tableName
255
+ * @param {object} [where]
256
+ */
215
257
  async count(tableName, where = {}) {
216
258
  try {
217
259
  if (!this.#models.has(tableName)) {