akanjs 3.0.0-alpha.111 → 3.0.0-alpha.112
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/document/documentSchema.ts +20 -0
- package/document/filterMeta.ts +21 -0
- package/document/into.ts +0 -8
- package/local/apps/serverLifecycle/serverLifecycle-local.db-shm +0 -0
- package/local/apps/serverLifecycle/serverLifecycle-local_solid.db-shm +0 -0
- package/package.json +1 -1
- package/server/resolver/database.resolver.ts +70 -72
- package/server/resolver/service.resolver.ts +4 -14
- package/types/dictionary/base.dictionary.d.ts +1 -1
- package/types/dictionary/dictionary.d.ts +8 -8
- package/types/document/documentSchema.d.ts +2 -0
- package/types/document/filterMeta.d.ts +8 -0
- package/types/document/into.d.ts +0 -8
|
@@ -53,6 +53,26 @@ export class DocumentSchema<Doc = unknown> {
|
|
|
53
53
|
return this;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
removePre<HookDoc = Doc>(type: SaveEventType, hook: DocumentSaveHook<HookDoc>) {
|
|
57
|
+
const hooks = this.preHooks.get(type);
|
|
58
|
+
if (hooks)
|
|
59
|
+
this.preHooks.set(
|
|
60
|
+
type,
|
|
61
|
+
hooks.filter((registered) => registered !== (hook as unknown)),
|
|
62
|
+
);
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
removePost<HookDoc = Doc>(type: SaveEventType, hook: DocumentSaveHook<HookDoc>) {
|
|
67
|
+
const hooks = this.postHooks.get(type);
|
|
68
|
+
if (hooks)
|
|
69
|
+
this.postHooks.set(
|
|
70
|
+
type,
|
|
71
|
+
hooks.filter((registered) => registered !== (hook as unknown)),
|
|
72
|
+
);
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
|
|
56
76
|
hook(type: DocumentHookName, hook: DocumentSaveHook<Doc>) {
|
|
57
77
|
const [, phase, event] = /^(before|after)(.+)$/.exec(type) ?? [];
|
|
58
78
|
if (!phase || !event) throw new Error(`Invalid document hook: ${type}`);
|
package/document/filterMeta.ts
CHANGED
|
@@ -100,6 +100,27 @@ export const fillMissingFilterArgs = (filterInfo: FilterInfo, args: unknown[]) =
|
|
|
100
100
|
return [...args, ...Array(filterInfo.args.length - args.length).fill(undefined)];
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
+
const queryOptionKeys = new Set(["select", "skip", "limit", "sort", "sample"]);
|
|
104
|
+
|
|
105
|
+
const isQueryOptionArg = (value: unknown) => {
|
|
106
|
+
if (!value || typeof value !== "object") return false;
|
|
107
|
+
const proto = Object.getPrototypeOf(value);
|
|
108
|
+
if (proto !== Object.prototype && proto !== null) return false;
|
|
109
|
+
return Object.keys(value).every((key) => queryOptionKeys.has(key));
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Splits a generated filter method's arguments into the filter's own args and the trailing query option.
|
|
114
|
+
* Shared by the database and service resolvers so the two cannot drift into disagreeing about what an option is.
|
|
115
|
+
*/
|
|
116
|
+
export const splitFilterArgs = (filterInfo: FilterInfo, args: unknown[]) => {
|
|
117
|
+
const hasQueryOption = args.length > filterInfo.args.length || isQueryOptionArg(args.at(-1));
|
|
118
|
+
return {
|
|
119
|
+
queryArgs: fillMissingFilterArgs(filterInfo, hasQueryOption ? args.slice(0, -1) : args),
|
|
120
|
+
queryOption: (hasQueryOption ? args.at(-1) : {}) as Record<string, unknown>,
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
|
|
103
124
|
export interface FilterArgInfo {
|
|
104
125
|
name: string;
|
|
105
126
|
argRef: ConstantFieldType;
|
package/document/into.ts
CHANGED
|
@@ -24,14 +24,6 @@ interface DefaultMdlStats<
|
|
|
24
24
|
pickById: (docId: string | undefined, projection?: _Projection) => Promise<TDocument>;
|
|
25
25
|
sample: (query: _FilterQuery, size?: number) => Promise<TDocument[]>;
|
|
26
26
|
sampleOne: (query: _FilterQuery) => Promise<TDocument | null>;
|
|
27
|
-
preSaveListenerSet: Set<(doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>>;
|
|
28
|
-
postSaveListenerSet: Set<(doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>>;
|
|
29
|
-
preCreateListenerSet: Set<(doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>>;
|
|
30
|
-
postCreateListenerSet: Set<(doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>>;
|
|
31
|
-
preUpdateListenerSet: Set<(doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>>;
|
|
32
|
-
postUpdateListenerSet: Set<(doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>>;
|
|
33
|
-
preRemoveListenerSet: Set<(doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>>;
|
|
34
|
-
postRemoveListenerSet: Set<(doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>>;
|
|
35
27
|
listenPre: (
|
|
36
28
|
eventType: SaveEventType,
|
|
37
29
|
listener: (doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>,
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
type DocumentUpdateInput,
|
|
14
14
|
documentQueryHelper,
|
|
15
15
|
type FindQueryOption,
|
|
16
|
-
fillMissingFilterArgs,
|
|
17
16
|
getFilterInfoByKey,
|
|
18
17
|
getFilterMeta,
|
|
19
18
|
getFilterSortByKey,
|
|
@@ -22,6 +21,7 @@ import {
|
|
|
22
21
|
type Mdl,
|
|
23
22
|
NoDocumentError,
|
|
24
23
|
type SaveEventType,
|
|
24
|
+
splitFilterArgs,
|
|
25
25
|
type UpdateChain,
|
|
26
26
|
} from "akanjs/document";
|
|
27
27
|
import {
|
|
@@ -107,6 +107,25 @@ export class DatabaseResolver {
|
|
|
107
107
|
schema.index(fields as { [key: string]: 1 | -1 });
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
const listen = (phase: "pre" | "post") => {
|
|
111
|
+
return (
|
|
112
|
+
type: SaveEventType,
|
|
113
|
+
listener: (doc: any, type: CRUDEventType, previous?: any) => PromiseOrObject<void>,
|
|
114
|
+
) => {
|
|
115
|
+
const hook = function (this: any, _next?: () => void, crudType?: CRUDEventType, previous?: any) {
|
|
116
|
+
return listener(this, crudType ?? "update", previous);
|
|
117
|
+
};
|
|
118
|
+
if (phase === "pre") schema.pre(type, hook);
|
|
119
|
+
else schema.post(type, hook);
|
|
120
|
+
return () => {
|
|
121
|
+
if (phase === "pre") schema.removePre(type, hook);
|
|
122
|
+
else schema.removePost(type, hook);
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
const listenPreHook = listen("pre");
|
|
127
|
+
const listenPostHook = listen("post");
|
|
128
|
+
|
|
110
129
|
class DatabaseModelInstance extends adapt(`${modelName}Model`, ({ plug }) => ({
|
|
111
130
|
__database: plug(DatabaseAdaptorRole, (database) => database),
|
|
112
131
|
__cache: plug(CacheAdaptorRole, (cache) => new CacheDatabase(modelName, cache)),
|
|
@@ -224,50 +243,45 @@ export class DatabaseResolver {
|
|
|
224
243
|
};
|
|
225
244
|
return chain;
|
|
226
245
|
};
|
|
246
|
+
const pickById = async (id: string | undefined, projection?: any) => {
|
|
247
|
+
if (!id) throw new NoDocumentError("No Document ID");
|
|
248
|
+
const doc = await timedQuery(() => store.findOne({ id }, { select: projection }));
|
|
249
|
+
if (!doc) throw new NoDocumentError(`No Document (${modelName}): ${id}`);
|
|
250
|
+
return doc;
|
|
251
|
+
};
|
|
227
252
|
return Object.assign(Model, {
|
|
228
253
|
refName: modelName,
|
|
229
|
-
pickOne: (query: QueryOf<any>, projection?: any) =>
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
count: (query: QueryOf<any>) => store.count(query),
|
|
254
|
+
pickOne: (query: QueryOf<any>, projection?: any) =>
|
|
255
|
+
timedQuery(() => store.pickOne(query, { select: projection })),
|
|
256
|
+
pickById,
|
|
257
|
+
|
|
258
|
+
pickAndWrite: async (id: string, rawData: any) => await (await pickById(id)).set(rawData).save(),
|
|
259
|
+
pickOneAndWrite: async (query: QueryOf<any>, rawData: any) =>
|
|
260
|
+
await (await timedQuery(() => store.pickOne(query))).set(rawData).save(),
|
|
261
|
+
exists: async (query: QueryOf<any>) => await timedQuery(() => store.exists(query)),
|
|
262
|
+
sample: (query: QueryOf<any>, size = 1) => timedQuery(() => store.find(query, { sample: size, limit: size })),
|
|
263
|
+
sampleOne: (query: QueryOf<any>) => timedQuery(() => store.findOne(query, { sample: true })),
|
|
264
|
+
find: (query: QueryOf<any>, projection?: any) => createFindManyChain(query, { select: projection }),
|
|
265
|
+
findOne: (query: QueryOf<any>, projection?: any) => createFindOneChain(query, { select: projection }),
|
|
266
|
+
findById: (id: string | undefined, projection?: any) =>
|
|
267
|
+
id ? timedQuery(() => store.findOne({ id }, { select: projection })) : Promise.resolve(null),
|
|
268
|
+
count: (query: QueryOf<any>) => timedQuery(() => store.count(query)),
|
|
244
269
|
updateOne: (query: QueryOf<any>, update: DocumentUpdateInput, options?: { upsert?: boolean }) =>
|
|
245
|
-
store.updateOneByQuery(query, update, options),
|
|
246
|
-
updateMany: (query: QueryOf<any>, update: DocumentUpdateInput) =>
|
|
247
|
-
|
|
248
|
-
|
|
270
|
+
timedQuery(() => store.updateOneByQuery(query, update, options)),
|
|
271
|
+
updateMany: (query: QueryOf<any>, update: DocumentUpdateInput) =>
|
|
272
|
+
timedQuery(() => store.updateManyByQuery(query, update)),
|
|
273
|
+
removeOne: (query: QueryOf<any>) => timedQuery(() => store.removeOneByQuery(query)),
|
|
274
|
+
removeMany: (query: QueryOf<any>) => timedQuery(() => store.removeManyByQuery(query)),
|
|
249
275
|
updateById: (id: string, update: DocumentUpdateInput, options?: { upsert?: boolean }) =>
|
|
250
|
-
store.updateOneByQuery({ id }, update, options),
|
|
251
|
-
removeById: (id: string) => store.removeOneByQuery({ id }),
|
|
276
|
+
timedQuery(() => store.updateOneByQuery({ id }, update, options)),
|
|
277
|
+
removeById: (id: string) => timedQuery(() => store.removeOneByQuery({ id })),
|
|
252
278
|
|
|
253
|
-
countDocuments: (query: QueryOf<any>) => store.count(query),
|
|
279
|
+
countDocuments: (query: QueryOf<any>) => timedQuery(() => store.count(query)),
|
|
254
280
|
bulkWrite: (
|
|
255
281
|
operations: { updateOne: { filter: QueryOf<any>; update: DocumentUpdateInput; upsert?: boolean } }[],
|
|
256
|
-
) => store.bulkWrite(operations),
|
|
257
|
-
listenPre:
|
|
258
|
-
|
|
259
|
-
listener: (doc: any, type: CRUDEventType, previous?: any) => PromiseOrObject<void>,
|
|
260
|
-
) =>
|
|
261
|
-
schema.pre(type, function (this: any, _next, crudType, previous) {
|
|
262
|
-
return listener(this, crudType ?? "update", previous);
|
|
263
|
-
}),
|
|
264
|
-
listenPost: (
|
|
265
|
-
type: SaveEventType,
|
|
266
|
-
listener: (doc: any, type: CRUDEventType, previous?: any) => PromiseOrObject<void>,
|
|
267
|
-
) =>
|
|
268
|
-
schema.post(type, function (this: any, _next, crudType, previous) {
|
|
269
|
-
return listener(this, crudType ?? "update", previous);
|
|
270
|
-
}),
|
|
282
|
+
) => timedQuery(() => store.bulkWrite(operations)),
|
|
283
|
+
listenPre: listenPreHook,
|
|
284
|
+
listenPost: listenPostHook,
|
|
271
285
|
});
|
|
272
286
|
}
|
|
273
287
|
|
|
@@ -289,40 +303,34 @@ export class DatabaseResolver {
|
|
|
289
303
|
}
|
|
290
304
|
async __pick(query?: QueryOf<any>, queryOption?: FindQueryOption): Promise<any> {
|
|
291
305
|
const { find, sort, skip, sample, select } = getFindQuery(query, queryOption);
|
|
292
|
-
return await this.__store.pickOne(find, { sort, skip, sample, select });
|
|
306
|
+
return await timedQuery(() => this.__store.pickOne(find, { sort, skip, sample, select }));
|
|
293
307
|
}
|
|
294
308
|
async __pickId(query?: QueryOf<any>, queryOption?: FindQueryOption): Promise<string> {
|
|
295
309
|
const { find, sort, skip, sample } = getFindQuery(query, queryOption);
|
|
296
|
-
const id = await this.__store.findId(find, { sort, skip, sample });
|
|
310
|
+
const id = await timedQuery(() => this.__store.findId(find, { sort, skip, sample }));
|
|
297
311
|
if (!id) throw new NoDocumentError(`No Document (${database.refName}): ${JSON.stringify(query)}`);
|
|
298
312
|
return id;
|
|
299
313
|
}
|
|
300
314
|
async __exists(query?: QueryOf<any>): Promise<string | null> {
|
|
301
|
-
return await this.__store.exists(query);
|
|
315
|
+
return await timedQuery(() => this.__store.exists(query));
|
|
302
316
|
}
|
|
303
317
|
async __count(query?: QueryOf<any>): Promise<number> {
|
|
304
318
|
return await timedQuery(() => this.__store.count(query));
|
|
305
319
|
}
|
|
306
320
|
async __insight(query?: QueryOf<any>): Promise<any> {
|
|
307
|
-
return await this.__store.insight(query);
|
|
321
|
+
return await timedQuery(() => this.__store.insight(query));
|
|
308
322
|
}
|
|
309
323
|
listenPre(
|
|
310
324
|
type: SaveEventType,
|
|
311
325
|
listener: (doc: any, type: CRUDEventType, previous?: any) => PromiseOrObject<void>,
|
|
312
326
|
) {
|
|
313
|
-
|
|
314
|
-
return listener(this, crudType ?? "update", previous);
|
|
315
|
-
});
|
|
316
|
-
return () => undefined;
|
|
327
|
+
return listenPreHook(type, listener);
|
|
317
328
|
}
|
|
318
329
|
listenPost(
|
|
319
330
|
type: SaveEventType,
|
|
320
331
|
listener: (doc: any, type: CRUDEventType, previous?: any) => PromiseOrObject<void>,
|
|
321
332
|
) {
|
|
322
|
-
|
|
323
|
-
return listener(this, crudType ?? "update", previous);
|
|
324
|
-
});
|
|
325
|
-
return () => undefined;
|
|
333
|
+
return listenPostHook(type, listener);
|
|
326
334
|
}
|
|
327
335
|
async __get(id: string) {
|
|
328
336
|
const doc = await this.__loader.load(id);
|
|
@@ -345,7 +353,7 @@ export class DatabaseResolver {
|
|
|
345
353
|
return this.__loadMany(ids);
|
|
346
354
|
}
|
|
347
355
|
async clone(data: DataInputOf<any, any> & { id: string }) {
|
|
348
|
-
return await this.__store.clone(data);
|
|
356
|
+
return await timedQuery(() => this.__store.clone(data));
|
|
349
357
|
}
|
|
350
358
|
async __create(data: DataInputOf<any, any>) {
|
|
351
359
|
return await timedQuery(() => this.__store.create(data));
|
|
@@ -360,7 +368,7 @@ export class DatabaseResolver {
|
|
|
360
368
|
return this.__update(id, data);
|
|
361
369
|
}
|
|
362
370
|
async __remove(id: string) {
|
|
363
|
-
return await this.__store.remove(id);
|
|
371
|
+
return await timedQuery(() => this.__store.remove(id));
|
|
364
372
|
}
|
|
365
373
|
async __removeMany(query: QueryOf<any>) {
|
|
366
374
|
return await timedQuery(() => this.__store.removeManyByQuery(query));
|
|
@@ -380,21 +388,11 @@ export class DatabaseResolver {
|
|
|
380
388
|
}
|
|
381
389
|
|
|
382
390
|
const getQueryDataFromKey = (queryKey: string, args: any): { query: any; queryOption: any } => {
|
|
383
|
-
const lastArg = args.at(-1);
|
|
384
|
-
const hasQueryOption =
|
|
385
|
-
lastArg &&
|
|
386
|
-
typeof lastArg === "object" &&
|
|
387
|
-
(typeof lastArg.select === "object" ||
|
|
388
|
-
typeof lastArg.skip === "number" ||
|
|
389
|
-
typeof lastArg.limit === "number" ||
|
|
390
|
-
typeof lastArg.sort === "string");
|
|
391
391
|
const filterInfo = getFilterInfoByKey(database.filter, queryKey);
|
|
392
392
|
const queryFn = filterInfo.queryFn;
|
|
393
393
|
if (!queryFn) throw new Error(`No query function for key: ${queryKey}`);
|
|
394
|
-
const queryArgs =
|
|
395
|
-
|
|
396
|
-
const queryOption = hasQueryOption ? lastArg : {};
|
|
397
|
-
return { query, queryOption };
|
|
394
|
+
const { queryArgs, queryOption } = splitFilterArgs(filterInfo, args);
|
|
395
|
+
return { query: queryFn(...queryArgs, documentQueryHelper), queryOption };
|
|
398
396
|
};
|
|
399
397
|
Object.entries(filterMeta.query).forEach(([queryKey, filterInfo]) => {
|
|
400
398
|
const queryFn = filterInfo.queryFn;
|
|
@@ -426,35 +424,35 @@ export class DatabaseResolver {
|
|
|
426
424
|
return (this as unknown as DatabaseInstance).__pickId(query, queryOption);
|
|
427
425
|
},
|
|
428
426
|
[`exists${capitalize(queryKey)}`]: async function (...args: any) {
|
|
429
|
-
const query = queryFn(...
|
|
427
|
+
const query = queryFn(...splitFilterArgs(filterInfo, args).queryArgs, documentQueryHelper);
|
|
430
428
|
return (this as unknown as DatabaseInstance).__exists(query);
|
|
431
429
|
},
|
|
432
430
|
[`count${capitalize(queryKey)}`]: async function (...args: any) {
|
|
433
|
-
const query = queryFn(...
|
|
431
|
+
const query = queryFn(...splitFilterArgs(filterInfo, args).queryArgs, documentQueryHelper);
|
|
434
432
|
return (this as unknown as DatabaseInstance).__count(query);
|
|
435
433
|
},
|
|
436
434
|
[`insight${capitalize(queryKey)}`]: async function (...args: any) {
|
|
437
|
-
const query = queryFn(...
|
|
435
|
+
const query = queryFn(...splitFilterArgs(filterInfo, args).queryArgs, documentQueryHelper);
|
|
438
436
|
return (this as unknown as DatabaseInstance).__insight(query);
|
|
439
437
|
},
|
|
440
438
|
[`query${capitalize(queryKey)}`]: (...args: any) =>
|
|
441
|
-
queryFn(...
|
|
439
|
+
queryFn(...splitFilterArgs(filterInfo, args).queryArgs, documentQueryHelper),
|
|
442
440
|
[`remove${capitalize(queryKey)}`]: async function (...args: any) {
|
|
443
|
-
const query = queryFn(...
|
|
441
|
+
const query = queryFn(...splitFilterArgs(filterInfo, args).queryArgs, documentQueryHelper);
|
|
444
442
|
return (this as unknown as DatabaseInstance).__removeMany(query);
|
|
445
443
|
},
|
|
446
444
|
[`removeOne${capitalize(queryKey)}`]: async function (...args: any) {
|
|
447
|
-
const query = queryFn(...
|
|
445
|
+
const query = queryFn(...splitFilterArgs(filterInfo, args).queryArgs, documentQueryHelper);
|
|
448
446
|
return (this as unknown as DatabaseInstance).__removeOne(query);
|
|
449
447
|
},
|
|
450
448
|
[`update${capitalize(queryKey)}`]: function (...args: any): UpdateChain {
|
|
451
449
|
const instance = this as unknown as DatabaseInstance;
|
|
452
|
-
const query = queryFn(...
|
|
450
|
+
const query = queryFn(...splitFilterArgs(filterInfo, args).queryArgs, documentQueryHelper);
|
|
453
451
|
return { set: (update) => instance.__updateMany(query, update) };
|
|
454
452
|
},
|
|
455
453
|
[`updateOne${capitalize(queryKey)}`]: function (...args: any): UpdateChain {
|
|
456
454
|
const instance = this as unknown as DatabaseInstance;
|
|
457
|
-
const query = queryFn(...
|
|
455
|
+
const query = queryFn(...splitFilterArgs(filterInfo, args).queryArgs, documentQueryHelper);
|
|
458
456
|
return { set: (update) => instance.__updateOne(query, update) };
|
|
459
457
|
},
|
|
460
458
|
});
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
type DocumentUpdateInput,
|
|
11
11
|
documentQueryHelper,
|
|
12
12
|
type FindQueryOption,
|
|
13
|
-
fillMissingFilterArgs,
|
|
14
13
|
getFilterInfoByKey,
|
|
15
14
|
getFilterMeta,
|
|
16
15
|
type ListQueryOption,
|
|
17
16
|
type SaveEventType,
|
|
17
|
+
splitFilterArgs,
|
|
18
18
|
type UpdateChain,
|
|
19
19
|
} from "akanjs/document";
|
|
20
20
|
import type { DatabaseService, ServiceCls } from "akanjs/service";
|
|
@@ -127,21 +127,11 @@ export class ServiceResolver {
|
|
|
127
127
|
const className = capitalize(database.refName);
|
|
128
128
|
Object.assign(srvRef.prototype, ServiceResolver.#getDefaultDbServiceMethods(database.refName, className, cascade));
|
|
129
129
|
const getQueryDataFromKey = (queryKey: string, args: any): { query: any; queryOption: any } => {
|
|
130
|
-
const lastArg = args.at(-1);
|
|
131
|
-
const hasQueryOption =
|
|
132
|
-
lastArg &&
|
|
133
|
-
typeof lastArg === "object" &&
|
|
134
|
-
(typeof lastArg.select === "object" ||
|
|
135
|
-
typeof lastArg.skip === "number" ||
|
|
136
|
-
typeof lastArg.limit === "number" ||
|
|
137
|
-
typeof lastArg.sort === "string");
|
|
138
130
|
const filterInfo = getFilterInfoByKey(database.filter, queryKey);
|
|
139
131
|
const queryFn = filterInfo.queryFn;
|
|
140
132
|
if (!queryFn) throw new Error(`No query function for key: ${queryKey}`);
|
|
141
|
-
const queryArgs =
|
|
142
|
-
|
|
143
|
-
const queryOption = hasQueryOption ? lastArg : {};
|
|
144
|
-
return { query, queryOption };
|
|
133
|
+
const { queryArgs, queryOption } = splitFilterArgs(filterInfo, args);
|
|
134
|
+
return { query: queryFn(...queryArgs, documentQueryHelper), queryOption };
|
|
145
135
|
};
|
|
146
136
|
const filterMeta = getFilterMeta(database.filter);
|
|
147
137
|
const queryKeys = Object.keys(filterMeta.query);
|
|
@@ -189,7 +179,7 @@ export class ServiceResolver {
|
|
|
189
179
|
return this.__insight(query);
|
|
190
180
|
},
|
|
191
181
|
[`query${capitalize(queryKey)}`]: function (this: DatabaseService, ...args: any) {
|
|
192
|
-
return queryFn(...
|
|
182
|
+
return queryFn(...splitFilterArgs(filterInfo, args).queryArgs, documentQueryHelper);
|
|
193
183
|
},
|
|
194
184
|
[`remove${capitalizedQueryKey}`]: async function (this: DatabaseService, ...args: any) {
|
|
195
185
|
const { query } = getQueryDataFromKey(queryKey, args);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const baseDictionary: import("./dictInfo.d.ts").ServiceDictInfo<[string, string], "ping" | "pingBody" | "pingParam" | "pingQuery" | "wsPing" | "pubsubPing", "serverUnreachable" | "serverUnavailable" | "gatewayTimeout" | "unexpectedResponse", "error" | "remove" | "save" | "refresh" | "password" | "
|
|
1
|
+
export declare const baseDictionary: import("./dictInfo.d.ts").ServiceDictInfo<[string, string], "ping" | "pingBody" | "pingParam" | "pingQuery" | "wsPing" | "pubsubPing", "serverUnreachable" | "serverUnavailable" | "gatewayTimeout" | "unexpectedResponse", "error" | "remove" | "save" | "refresh" | "password" | "skip" | "stop" | "send" | "ok" | "agent" | "connecting" | "new" | "success" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "approve" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "edit" | "view">;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { AgentEndpoint, AgentTurn, BaseEndpoint } from "akanjs/signal";
|
|
2
2
|
export declare const dictionary: {
|
|
3
|
-
base: import("./locale.d.ts").DictModule<import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "remove" | "save" | "refresh" | "password" | "
|
|
3
|
+
base: import("./locale.d.ts").DictModule<import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "remove" | "save" | "refresh" | "password" | "skip" | "stop" | "send" | "ok" | "agent" | "connecting" | "new" | "success" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "approve" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "edit" | "view">, "base.error.gatewayTimeout" | "base.error.serverUnavailable" | "base.error.serverUnreachable" | "base.error.unexpectedResponse">;
|
|
4
4
|
agentTurn: import("./locale.d.ts").DictModule<import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc`, never>;
|
|
5
5
|
agent: import("./locale.d.ts").DictModule<import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, "agent.error.llmUnavailable" | "agent.error.deepseekRequestFailed">;
|
|
6
6
|
};
|
|
7
|
-
export declare const Err: import("./trans.d.ts").ErrConstructor<"base.error.gatewayTimeout" | "base.error.serverUnavailable" | "base.error.serverUnreachable" | "base.error.unexpectedResponse" | "agent.error.llmUnavailable" | "agent.error.deepseekRequestFailed">, translate: (lang: "en" | "ko" | (string & {}) | "zhChs" | "zhCht" | "ja", key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "remove" | "save" | "refresh" | "password" | "
|
|
8
|
-
info: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "remove" | "save" | "refresh" | "password" | "
|
|
9
|
-
success: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "remove" | "save" | "refresh" | "password" | "
|
|
10
|
-
error: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "remove" | "save" | "refresh" | "password" | "
|
|
11
|
-
warning: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "remove" | "save" | "refresh" | "password" | "
|
|
12
|
-
loading: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "remove" | "save" | "refresh" | "password" | "
|
|
13
|
-
}, getDictionary: (lang: "en" | "ko" | (string & {}) | "zhChs" | "zhCht" | "ja") => object, getAllDictionary: () => import("./trans.d.ts").RootDictionary, __Dict_Key__: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "remove" | "save" | "refresh" | "password" | "
|
|
7
|
+
export declare const Err: import("./trans.d.ts").ErrConstructor<"base.error.gatewayTimeout" | "base.error.serverUnavailable" | "base.error.serverUnreachable" | "base.error.unexpectedResponse" | "agent.error.llmUnavailable" | "agent.error.deepseekRequestFailed">, translate: (lang: "en" | "ko" | (string & {}) | "zhChs" | "zhCht" | "ja", key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "remove" | "save" | "refresh" | "password" | "skip" | "stop" | "send" | "ok" | "agent" | "connecting" | "new" | "success" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "approve" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "edit" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, data?: import("./trans.d.ts").TranslationData) => string, msg: {
|
|
8
|
+
info: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "remove" | "save" | "refresh" | "password" | "skip" | "stop" | "send" | "ok" | "agent" | "connecting" | "new" | "success" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "approve" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "edit" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
|
|
9
|
+
success: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "remove" | "save" | "refresh" | "password" | "skip" | "stop" | "send" | "ok" | "agent" | "connecting" | "new" | "success" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "approve" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "edit" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
|
|
10
|
+
error: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "remove" | "save" | "refresh" | "password" | "skip" | "stop" | "send" | "ok" | "agent" | "connecting" | "new" | "success" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "approve" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "edit" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
|
|
11
|
+
warning: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "remove" | "save" | "refresh" | "password" | "skip" | "stop" | "send" | "ok" | "agent" | "connecting" | "new" | "success" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "approve" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "edit" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
|
|
12
|
+
loading: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "remove" | "save" | "refresh" | "password" | "skip" | "stop" | "send" | "ok" | "agent" | "connecting" | "new" | "success" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "approve" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "edit" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
|
|
13
|
+
}, getDictionary: (lang: "en" | "ko" | (string & {}) | "zhChs" | "zhCht" | "ja") => object, getAllDictionary: () => import("./trans.d.ts").RootDictionary, __Dict_Key__: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "remove" | "save" | "refresh" | "password" | "skip" | "stop" | "send" | "ok" | "agent" | "connecting" | "new" | "success" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "approve" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "edit" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, __Error_Key__: "base.error.gatewayTimeout" | "base.error.serverUnavailable" | "base.error.serverUnreachable" | "base.error.unexpectedResponse" | "agent.error.llmUnavailable" | "agent.error.deepseekRequestFailed";
|
|
@@ -28,6 +28,8 @@ export declare class DocumentSchema<Doc = unknown> {
|
|
|
28
28
|
readonly indexes: DocumentIndexDescriptor[];
|
|
29
29
|
pre<HookDoc = Doc>(type: SaveEventType, hook: DocumentSaveHook<HookDoc>): this;
|
|
30
30
|
post<HookDoc = Doc>(type: SaveEventType, hook: DocumentSaveHook<HookDoc>): this;
|
|
31
|
+
removePre<HookDoc = Doc>(type: SaveEventType, hook: DocumentSaveHook<HookDoc>): this;
|
|
32
|
+
removePost<HookDoc = Doc>(type: SaveEventType, hook: DocumentSaveHook<HookDoc>): this;
|
|
31
33
|
hook(type: DocumentHookName, hook: DocumentSaveHook<Doc>): this;
|
|
32
34
|
index(fields: DocumentIndexDescriptor["fields"], options?: Omit<DocumentIndexDescriptor, "fields">): this;
|
|
33
35
|
createIndex(name: string): DocumentIndexBuilder<this>;
|
|
@@ -19,6 +19,14 @@ export declare const getFilterInfoByKey: <ArgNames extends string[] = [], Args e
|
|
|
19
19
|
export declare const setFilterInfoByKey: <ArgNames extends string[] = [], Args extends any[] = any[], Model = any>(modelRef: Cls<Model>, key: string, filterInfo: FilterInfo<ArgNames, Args, Model>) => void;
|
|
20
20
|
export declare const getFilterSortByKey: (modelRef: FilterCls, key: string) => unknown;
|
|
21
21
|
export declare const fillMissingFilterArgs: (filterInfo: FilterInfo, args: unknown[]) => any[];
|
|
22
|
+
/**
|
|
23
|
+
* Splits a generated filter method's arguments into the filter's own args and the trailing query option.
|
|
24
|
+
* Shared by the database and service resolvers so the two cannot drift into disagreeing about what an option is.
|
|
25
|
+
*/
|
|
26
|
+
export declare const splitFilterArgs: (filterInfo: FilterInfo, args: unknown[]) => {
|
|
27
|
+
queryArgs: any[];
|
|
28
|
+
queryOption: Record<string, unknown>;
|
|
29
|
+
};
|
|
22
30
|
export interface FilterArgInfo {
|
|
23
31
|
name: string;
|
|
24
32
|
argRef: ConstantFieldType;
|
package/types/document/into.d.ts
CHANGED
|
@@ -15,14 +15,6 @@ interface DefaultMdlStats<TDocument, TSchema, _Partial extends Partial<TSchema>
|
|
|
15
15
|
pickById: (docId: string | undefined, projection?: _Projection) => Promise<TDocument>;
|
|
16
16
|
sample: (query: _FilterQuery, size?: number) => Promise<TDocument[]>;
|
|
17
17
|
sampleOne: (query: _FilterQuery) => Promise<TDocument | null>;
|
|
18
|
-
preSaveListenerSet: Set<(doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>>;
|
|
19
|
-
postSaveListenerSet: Set<(doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>>;
|
|
20
|
-
preCreateListenerSet: Set<(doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>>;
|
|
21
|
-
postCreateListenerSet: Set<(doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>>;
|
|
22
|
-
preUpdateListenerSet: Set<(doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>>;
|
|
23
|
-
postUpdateListenerSet: Set<(doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>>;
|
|
24
|
-
preRemoveListenerSet: Set<(doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>>;
|
|
25
|
-
postRemoveListenerSet: Set<(doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>>;
|
|
26
18
|
listenPre: (eventType: SaveEventType, listener: (doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>) => () => void;
|
|
27
19
|
listenPost: (eventType: SaveEventType, listener: (doc: TDocument, type: CRUDEventType, previous?: TDocument) => PromiseOrObject<void>) => () => void;
|
|
28
20
|
}
|