vome-core 0.3.34 → 0.3.35
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/dist/admin/components/ui/avatar/index.js +1 -1
- package/dist/admin/components/ui/checkbox/index.js +1 -1
- package/dist/admin/components/ui/dialog/index.js +1 -1
- package/dist/admin/components/ui/dropdown-menu/index.js +1 -1
- package/dist/admin/components/ui/input/index.js +1 -1
- package/dist/admin/components/ui/label/index.js +1 -1
- package/dist/admin/components/ui/scroll-area/index.js +1 -1
- package/dist/admin/components/ui/select/index.js +1 -1
- package/dist/admin/components/ui/separator/index.js +1 -1
- package/dist/admin/components/ui/sheet/index.js +1 -1
- package/dist/admin/components/ui/sonner/index.js +1 -1
- package/dist/admin/components/ui/table/index.js +1 -1
- package/dist/admin/components/ui/tabs/index.js +1 -1
- package/dist/admin/components/ui/tooltip/index.js +1 -1
- package/dist/admin/crud/auto-fields.js +1 -1
- package/dist/admin/crud/components/vm-richtext-extensions.js +1 -1
- package/dist/admin/crud/config.js +1 -1
- package/dist/admin/crud/confirm.js +1 -1
- package/dist/admin/crud/crud-page-request.js +1 -1
- package/dist/admin/crud/data-i18n.js +1 -1
- package/dist/admin/crud/dict.js +1 -1
- package/dist/admin/crud/export-fetch.js +1 -1
- package/dist/admin/crud/key.js +1 -1
- package/dist/admin/crud/plugins.js +1 -1
- package/dist/admin/crud/span.js +1 -1
- package/dist/admin/crud/style.js +1 -1
- package/dist/admin/crud/validate.js +1 -1
- package/dist/admin/directives/perm.js +1 -1
- package/dist/admin/hooks/useUpload.js +1 -1
- package/dist/admin/lib/browser.js +1 -1
- package/dist/admin/lib/cn.js +1 -1
- package/dist/admin/lib/dialog-float.js +1 -1
- package/dist/admin/lib/export-excel.js +1 -1
- package/dist/admin/lib/import-excel.js +1 -1
- package/dist/admin/lib/json.js +1 -1
- package/dist/admin/lib/menu.js +1 -1
- package/dist/admin/lib/micro-locale.js +1 -1
- package/dist/admin/lib/micro-theme.js +1 -1
- package/dist/admin/lib/shell.js +1 -1
- package/dist/admin/lib/theme-color-options.js +1 -1
- package/dist/admin/lib/tree.js +1 -1
- package/dist/admin/lib/upload.js +1 -1
- package/dist/admin/lib/video-frame.js +1 -1
- package/dist/admin/router/create.js +1 -1
- package/dist/admin/router/guards.js +1 -1
- package/dist/ai/index.js +1 -1
- package/dist/client/ai-model-registry.js +1 -1
- package/dist/client/base.js +1 -1
- package/dist/client/configure.js +1 -1
- package/dist/client/dict.js +1 -1
- package/dist/client/eps-payload.js +1 -1
- package/dist/client/eps.js +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/locale-change.js +1 -1
- package/dist/client/locale-store.js +1 -1
- package/dist/client/service.js +1 -1
- package/dist/client/vite-admin.js +1 -1
- package/dist/client/vite-auto-import.js +1 -1
- package/dist/client/vite-micro-proxy.js +1 -1
- package/dist/client/vite-plugin-eps.js +1 -1
- package/dist/client/vite-resolve.js +1 -1
- package/dist/config/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/orm/import-excel.d.ts +7 -6
- package/dist/orm/index.d.ts +1 -0
- package/dist/orm/repository.d.ts +17 -2
- package/dist/orm/service.d.ts +3 -1
- package/dist/orm/unique-keys.d.ts +6 -0
- package/dist/server/index.js +1 -1
- package/dist/shared/datetime-picker.js +1 -1
- package/dist/shared/decimal.js +1 -1
- package/dist/shared/excel.js +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/shared/locale-json.js +1 -1
- package/dist/shared/tree.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { PgTable } from 'drizzle-orm/pg-core';
|
|
2
2
|
import type { BaseService } from './service';
|
|
3
|
+
export { listUniqueKeySets, buildUniqueWhere } from './unique-keys';
|
|
3
4
|
export declare function buildEntityImportTemplate(table: PgTable, ignoreProperty?: string[]): Uint8Array;
|
|
4
5
|
type ImportRowResult = {
|
|
5
6
|
inserted: number;
|
|
@@ -10,12 +11,13 @@ type ImportRowResult = {
|
|
|
10
11
|
}>;
|
|
11
12
|
};
|
|
12
13
|
/**
|
|
13
|
-
* 按唯一键 upsert
|
|
14
|
-
* 1. 有 id 且存在 →
|
|
15
|
-
* 2. 否则按 unique 索引匹配 →
|
|
16
|
-
* 3.
|
|
14
|
+
* 按唯一键 upsert 导入行(含软删恢复,走 Repository.upsert):
|
|
15
|
+
* 1. 有 id 且存在 → 更新(软删先 restore)
|
|
16
|
+
* 2. 否则按 unique 索引匹配 → 更新(软删先 restore)
|
|
17
|
+
* 3. 否则新增(唯一键撞软删亦 restore)
|
|
17
18
|
*/
|
|
18
19
|
export declare function importEntityRows(svc: BaseService, table: PgTable, rows: Record<string, unknown>[], options?: {
|
|
20
|
+
/** 覆盖表唯一索引;不传则读表 unique */
|
|
19
21
|
uniqueKeys?: string[];
|
|
20
22
|
ignoreProperty?: string[];
|
|
21
23
|
}): Promise<ImportRowResult>;
|
|
@@ -24,4 +26,3 @@ export declare function importEntityExcel(svc: BaseService, table: PgTable, file
|
|
|
24
26
|
uniqueKeys?: string[];
|
|
25
27
|
ignoreProperty?: string[];
|
|
26
28
|
}): Promise<ImportRowResult>;
|
|
27
|
-
export {};
|
package/dist/orm/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { readCrudConfig, resolveSoftDelete, resolveUpsert, } from './crud-config
|
|
|
14
14
|
export { Repository, getRepository, InjectRepository, } from './repository';
|
|
15
15
|
export { registerOnForceDelete, clearForceDeleteHooks, runOnForceDelete, } from './force-delete-hooks';
|
|
16
16
|
export type { ForceDeleteHook, ForceDeleteHookEvent, } from './force-delete-hooks';
|
|
17
|
+
export { listUniqueKeySets, buildUniqueWhere } from './unique-keys';
|
|
17
18
|
export { BaseService } from './service';
|
|
18
19
|
export { q, compactWhere, needsAdvancedQuery, buildQueryOp } from './query-op';
|
|
19
20
|
export { queryWithOp } from './query-builder';
|
package/dist/orm/repository.d.ts
CHANGED
|
@@ -37,11 +37,26 @@ export declare class Repository<T extends PgTable> {
|
|
|
37
37
|
orderBy?: SQL[];
|
|
38
38
|
} & CrudTrashQueryOptions): Promise<PageResult<InferSelectModel<T>>>;
|
|
39
39
|
private parseInsert;
|
|
40
|
-
/**
|
|
40
|
+
/** 按唯一键找软删行(须开 softDelete 才能看到 deleteTime) */
|
|
41
|
+
private findSoftDeletedByUnique;
|
|
42
|
+
/** 按唯一键找行(含软删) */
|
|
43
|
+
private findByUniqueIncludingTrashed;
|
|
44
|
+
private rowId;
|
|
45
|
+
private rowDeleteTime;
|
|
46
|
+
private restoreThenUpdate;
|
|
47
|
+
private createOne;
|
|
48
|
+
/**
|
|
49
|
+
* 插入;若唯一键命中软删行则 restore + update(不再抛唯一冲突)。
|
|
50
|
+
* 数组:开启软删时逐条处理(可能混插/恢复);否则仍一条批量 INSERT。
|
|
51
|
+
*/
|
|
41
52
|
create(data: readonly unknown[]): Promise<InferSelectModel<T>[]>;
|
|
42
53
|
create(data: unknown): Promise<InferSelectModel<T>>;
|
|
43
54
|
/**
|
|
44
|
-
*
|
|
55
|
+
* 按 id 或唯一键写入:命中则 update(软删先 restore),未命中则 create。
|
|
56
|
+
*/
|
|
57
|
+
upsert(data: unknown): Promise<InferSelectModel<T>>;
|
|
58
|
+
/**
|
|
59
|
+
* 有 id 且存在(含软删)则更新(软删先 restore),否则插入。
|
|
45
60
|
* 对象 / 数组均可;数组时一次查出已存在 id,再批量 update + insert。
|
|
46
61
|
*/
|
|
47
62
|
save(data: readonly unknown[]): Promise<InferSelectModel<T>[]>;
|
package/dist/orm/service.d.ts
CHANGED
|
@@ -32,7 +32,9 @@ export declare abstract class BaseService {
|
|
|
32
32
|
* - delete:data 为 where 条件
|
|
33
33
|
*/
|
|
34
34
|
modifyAfter(_data: any, _type: CrudModifyType): Promise<void>;
|
|
35
|
-
/** 新增;数组走 create/save 批量;受 vome.crud.upsert
|
|
35
|
+
/** 新增;数组走 create/save 批量;受 vome.crud.upsert 控制。
|
|
36
|
+
* create:唯一键撞软删行会 restore + update。
|
|
37
|
+
*/
|
|
36
38
|
add(data: unknown, options?: CrudWriteOptions): Promise<{
|
|
37
39
|
[x: string]: any;
|
|
38
40
|
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type SQL } from 'drizzle-orm';
|
|
2
|
+
import { type PgTable } from 'drizzle-orm/pg-core';
|
|
3
|
+
/** 从表唯一索引 / unique 约束提取键集合 */
|
|
4
|
+
export declare function listUniqueKeySets(table: PgTable): string[][];
|
|
5
|
+
/** 按唯一键拼 where;任一键为空则返回 undefined */
|
|
6
|
+
export declare function buildUniqueWhere(table: PgTable, keys: string[], row: Record<string, unknown>): SQL | undefined;
|