@d-mok/quasar-app-extension-quasar-axe 4.0.4 → 4.0.5
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
|
@@ -90,15 +90,20 @@ export function ORM<
|
|
|
90
90
|
return Rs.map(r => this.convert(r))
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
private async wrapper
|
|
93
|
+
private async wrapper(
|
|
94
94
|
logType: 'select' | 'insert' | 'update' | 'delete',
|
|
95
95
|
options: uiOptions | undefined,
|
|
96
|
-
fn: () => Promise<
|
|
97
|
-
): Promise<
|
|
96
|
+
fn: () => Promise<T[]>
|
|
97
|
+
): Promise<T[]> {
|
|
98
98
|
const { confirm, notify, loading } = options ?? {}
|
|
99
99
|
|
|
100
100
|
if (confirm) {
|
|
101
|
-
|
|
101
|
+
if (Array.isArray(confirm)) {
|
|
102
|
+
const [title, msg] = confirm
|
|
103
|
+
await qDialog.confirm(title, msg)
|
|
104
|
+
} else {
|
|
105
|
+
await qDialog.confirm(confirm)
|
|
106
|
+
}
|
|
102
107
|
}
|
|
103
108
|
|
|
104
109
|
if (loading === false) {
|
|
@@ -156,6 +161,8 @@ export function ORM<
|
|
|
156
161
|
: this.set(entities)
|
|
157
162
|
|
|
158
163
|
this.onChange()
|
|
164
|
+
|
|
165
|
+
return entities
|
|
159
166
|
})
|
|
160
167
|
}
|
|
161
168
|
|
|
@@ -182,6 +189,8 @@ export function ORM<
|
|
|
182
189
|
|
|
183
190
|
this.sortBy($ => vals.indexOf($[key]))
|
|
184
191
|
this.onChange()
|
|
192
|
+
|
|
193
|
+
return entities
|
|
185
194
|
})
|
|
186
195
|
}
|
|
187
196
|
|
|
@@ -216,7 +225,7 @@ export function ORM<
|
|
|
216
225
|
|
|
217
226
|
async insert(row: Partial<R>, options?: uiOptions): Promise<T> {
|
|
218
227
|
let entities = await this.insertMany([row], options)
|
|
219
|
-
return entities[0]
|
|
228
|
+
return entities[0]
|
|
220
229
|
}
|
|
221
230
|
|
|
222
231
|
async update(
|
|
@@ -224,28 +233,34 @@ export function ORM<
|
|
|
224
233
|
row: Partial<R>,
|
|
225
234
|
options?: uiOptions
|
|
226
235
|
): Promise<T> {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
236
|
+
const entities = await this.wrapper(
|
|
237
|
+
'update',
|
|
238
|
+
options,
|
|
239
|
+
async () => {
|
|
240
|
+
const data: R = await supabase
|
|
241
|
+
.from(tableName)
|
|
242
|
+
.update(this.onSanitize(row))
|
|
243
|
+
.eq(idKey, idVal as any)
|
|
244
|
+
.select(fields)
|
|
245
|
+
.single()
|
|
246
|
+
.then(handleError)
|
|
235
247
|
|
|
236
|
-
|
|
248
|
+
const entity = this.convert(data)
|
|
237
249
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
250
|
+
this.merge([entity], idKey)
|
|
251
|
+
this.onChange()
|
|
252
|
+
this.onEdit()
|
|
241
253
|
|
|
242
|
-
|
|
243
|
-
|
|
254
|
+
return [entity]
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
return entities[0]
|
|
244
259
|
}
|
|
245
260
|
|
|
246
261
|
async delete(idVal: R[IdK], options?: uiOptions): Promise<void> {
|
|
247
262
|
await this.wrapper('delete', options, async () => {
|
|
248
|
-
await supabase
|
|
263
|
+
const data: R = await supabase
|
|
249
264
|
.from(tableName)
|
|
250
265
|
.delete()
|
|
251
266
|
.eq(idKey, idVal as any)
|
|
@@ -253,9 +268,13 @@ export function ORM<
|
|
|
253
268
|
.single()
|
|
254
269
|
.then(handleError)
|
|
255
270
|
|
|
271
|
+
const entity = this.convert(data)
|
|
272
|
+
|
|
256
273
|
this.remove($ => $[idKey] === idVal)
|
|
257
274
|
this.onChange()
|
|
258
275
|
this.onEdit()
|
|
276
|
+
|
|
277
|
+
return [entity]
|
|
259
278
|
})
|
|
260
279
|
}
|
|
261
280
|
|
|
@@ -303,7 +322,7 @@ if (process.env.DEBUGGING) {
|
|
|
303
322
|
}
|
|
304
323
|
|
|
305
324
|
type uiOptions = {
|
|
306
|
-
confirm?: [string, string]
|
|
325
|
+
confirm?: [string, string] | string
|
|
307
326
|
notify?: string | false
|
|
308
327
|
loading?: false
|
|
309
328
|
}
|