vona-module-a-layoutprofile 5.0.1

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 (49) hide show
  1. package/LICENSE +21 -0
  2. package/dist/.metadata/index.d.ts +279 -0
  3. package/dist/.metadata/index.d.ts.map +1 -0
  4. package/dist/.metadata/this.d.ts +3 -0
  5. package/dist/.metadata/this.d.ts.map +1 -0
  6. package/dist/bean/meta.index.d.ts +4 -0
  7. package/dist/bean/meta.index.d.ts.map +1 -0
  8. package/dist/bean/meta.redlock.d.ts +6 -0
  9. package/dist/bean/meta.redlock.d.ts.map +1 -0
  10. package/dist/bean/meta.version.d.ts +6 -0
  11. package/dist/bean/meta.version.d.ts.map +1 -0
  12. package/dist/controller/layoutprofile.d.ts +14 -0
  13. package/dist/controller/layoutprofile.d.ts.map +1 -0
  14. package/dist/dto/layoutProfile.d.ts +13 -0
  15. package/dist/dto/layoutProfile.d.ts.map +1 -0
  16. package/dist/dto/layoutProfileLoad.d.ts +7 -0
  17. package/dist/dto/layoutProfileLoad.d.ts.map +1 -0
  18. package/dist/dto/layoutProfileSave.d.ts +16 -0
  19. package/dist/dto/layoutProfileSave.d.ts.map +1 -0
  20. package/dist/entity/layoutprofile.d.ts +11 -0
  21. package/dist/entity/layoutprofile.d.ts.map +1 -0
  22. package/dist/index.d.ts +3 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +203 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/model/layoutprofile.d.ts +8 -0
  27. package/dist/model/layoutprofile.d.ts.map +1 -0
  28. package/dist/service/layoutprofile.d.ts +12 -0
  29. package/dist/service/layoutprofile.d.ts.map +1 -0
  30. package/dist/types/index.d.ts +2 -0
  31. package/dist/types/index.d.ts.map +1 -0
  32. package/dist/types/layoutprofile.d.ts +18 -0
  33. package/dist/types/layoutprofile.d.ts.map +1 -0
  34. package/package.json +42 -0
  35. package/src/.metadata/index.ts +346 -0
  36. package/src/.metadata/this.ts +2 -0
  37. package/src/bean/meta.index.ts +12 -0
  38. package/src/bean/meta.redlock.ts +11 -0
  39. package/src/bean/meta.version.ts +20 -0
  40. package/src/controller/layoutprofile.ts +38 -0
  41. package/src/dto/layoutProfile.tsx +26 -0
  42. package/src/dto/layoutProfileLoad.tsx +13 -0
  43. package/src/dto/layoutProfileSave.tsx +31 -0
  44. package/src/entity/layoutprofile.ts +20 -0
  45. package/src/index.ts +2 -0
  46. package/src/model/layoutprofile.ts +10 -0
  47. package/src/service/layoutprofile.ts +64 -0
  48. package/src/types/index.ts +1 -0
  49. package/src/types/layoutprofile.ts +21 -0
@@ -0,0 +1,346 @@
1
+ // eslint-disable
2
+ import type { TypeEntityMeta,TypeModelsClassLikeGeneral,TypeSymbolKeyFieldsMore } from 'vona-module-a-orm';
3
+ import type { TypeEntityOptionsFields,TypeControllerOptionsActions } from 'vona-module-a-openapi';
4
+ import type { TableIdentity } from 'table-identity';
5
+ /** entity: begin */
6
+ export * from '../entity/layoutprofile.ts';
7
+ import type { IEntityOptionsLayoutprofile } from '../entity/layoutprofile.ts';
8
+ import 'vona-module-a-orm';
9
+ declare module 'vona-module-a-orm' {
10
+
11
+ export interface IEntityRecord {
12
+ 'a-layoutprofile:layoutprofile': IEntityOptionsLayoutprofile;
13
+ }
14
+
15
+
16
+ }
17
+ declare module 'vona-module-a-layoutprofile' {
18
+
19
+ }
20
+ /** entity: end */
21
+ /** entity: begin */
22
+ import type { EntityLayoutprofile } from '../entity/layoutprofile.ts';
23
+ export interface IModuleEntity {
24
+ 'layoutprofile': EntityLayoutprofileMeta;
25
+ }
26
+ /** entity: end */
27
+ /** entity: begin */
28
+ export type EntityLayoutprofileTableName = 'aLayoutProfile';
29
+ export type EntityLayoutprofileMeta=TypeEntityMeta<EntityLayoutprofile,EntityLayoutprofileTableName>;
30
+ declare module 'vona-module-a-orm' {
31
+ export interface ITableRecord {
32
+ 'aLayoutProfile': EntityLayoutprofileMeta;
33
+ }
34
+ }
35
+ declare module 'vona-module-a-layoutprofile' {
36
+
37
+ export interface IEntityOptionsLayoutprofile {
38
+ fields?: TypeEntityOptionsFields<EntityLayoutprofile, IEntityOptionsLayoutprofile[TypeSymbolKeyFieldsMore]>;
39
+ }
40
+ }
41
+ /** entity: end */
42
+ /** model: begin */
43
+ export * from '../model/layoutprofile.ts';
44
+ import type { IModelOptionsLayoutprofile } from '../model/layoutprofile.ts';
45
+ import 'vona-module-a-orm';
46
+ declare module 'vona-module-a-orm' {
47
+
48
+ export interface IModelRecord {
49
+ 'a-layoutprofile:layoutprofile': IModelOptionsLayoutprofile;
50
+ }
51
+
52
+
53
+ }
54
+ declare module 'vona-module-a-layoutprofile' {
55
+
56
+ export interface ModelLayoutprofile {
57
+ /** @internal */
58
+ get scope(): ScopeModuleALayoutprofile;
59
+ }
60
+
61
+ export interface ModelLayoutprofile {
62
+ get $beanFullName(): 'a-layoutprofile.model.layoutprofile';
63
+ get $onionName(): 'a-layoutprofile:layoutprofile';
64
+ get $onionOptions(): IModelOptionsLayoutprofile;
65
+ }
66
+ }
67
+ /** model: end */
68
+ /** model: begin */
69
+ import type { ModelLayoutprofile } from '../model/layoutprofile.ts';
70
+ export interface IModuleModel {
71
+ 'layoutprofile': ModelLayoutprofile;
72
+ }
73
+ /** model: end */
74
+ /** model: begin */
75
+
76
+ import 'vona';
77
+ declare module 'vona' {
78
+ export interface IBeanRecordGeneral {
79
+ 'a-layoutprofile.model.layoutprofile': ModelLayoutprofile;
80
+ }
81
+ }
82
+ /** model: end */
83
+ /** model: begin */
84
+ import type { IModelGetOptions, IModelMethodOptions, IModelSelectParams, TypeModelSelectAndCount, TypeModelRelationResult, TypeModelWhere, IModelInsertOptions, TypeModelMutateRelationData, IModelDeleteOptions, IModelUpdateOptions, IModelMutateOptions, IModelSelectCountParams, IModelIncrementParams, IModelSelectAggrParams, TypeModelAggrRelationResult, IModelSelectGroupParams, TypeModelGroupRelationResult } from 'vona-module-a-orm';
85
+ import { SymbolKeyEntity, SymbolKeyEntityMeta, SymbolKeyModelOptions } from 'vona-module-a-orm';
86
+ declare module 'vona-module-a-layoutprofile' {
87
+
88
+ export interface ModelLayoutprofile {
89
+ [SymbolKeyEntity]: EntityLayoutprofile;
90
+ [SymbolKeyEntityMeta]: EntityLayoutprofileMeta;
91
+ [SymbolKeyModelOptions]: IModelOptionsLayoutprofile;
92
+ get<T extends IModelGetOptions<EntityLayoutprofile,ModelLayoutprofile>>(where: TypeModelWhere<EntityLayoutprofile>, options?: T): Promise<TypeModelRelationResult<EntityLayoutprofile, ModelLayoutprofile, T> | undefined>;
93
+ /**
94
+ * Retrieves one matching primary row with a pessimistic FOR UPDATE lock.
95
+ * Requires an active transaction. The lock is released when that transaction completes.
96
+ * Entity and query caches are bypassed.
97
+ */
98
+ getForUpdate<T extends IModelGetOptions<EntityLayoutprofile,ModelLayoutprofile>>(where: TypeModelWhere<EntityLayoutprofile>, options?: T): Promise<TypeModelRelationResult<EntityLayoutprofile, ModelLayoutprofile, T> | undefined>;
99
+ /**
100
+ * Retrieves a primary row by ID with the same pessimistic FOR UPDATE lock semantics.
101
+ * Requires an active transaction. The lock is released when that transaction completes.
102
+ * Entity and query caches are bypassed.
103
+ */
104
+ getByIdForUpdate<T extends IModelGetOptions<EntityLayoutprofile,ModelLayoutprofile>>(id: TableIdentity, options?: T): Promise<TypeModelRelationResult<EntityLayoutprofile, ModelLayoutprofile, T> | undefined>;
105
+ mget<T extends IModelGetOptions<EntityLayoutprofile,ModelLayoutprofile>>(ids: TableIdentity[], options?: T): Promise<TypeModelRelationResult<EntityLayoutprofile, ModelLayoutprofile, T>[]>;
106
+ selectAndCount<T extends IModelSelectParams<EntityLayoutprofile,ModelLayoutprofile,ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<TypeModelSelectAndCount<EntityLayoutprofile, ModelLayoutprofile, T>>;
107
+ select<T extends IModelSelectParams<EntityLayoutprofile,ModelLayoutprofile,ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<TypeModelRelationResult<EntityLayoutprofile, ModelLayoutprofile, T>[]>;
108
+ insert<T extends IModelInsertOptions<EntityLayoutprofile,ModelLayoutprofile>>(data?: TypeModelMutateRelationData<EntityLayoutprofile,ModelLayoutprofile, T>, options?: T): Promise<TypeModelMutateRelationData<EntityLayoutprofile,ModelLayoutprofile, T, true>>;
109
+ insertBulk<T extends IModelInsertOptions<EntityLayoutprofile,ModelLayoutprofile>>(items: TypeModelMutateRelationData<EntityLayoutprofile,ModelLayoutprofile, T>[], options?: T): Promise<TypeModelMutateRelationData<EntityLayoutprofile,ModelLayoutprofile, T, true>[]>;
110
+ update<T extends IModelUpdateOptions<EntityLayoutprofile,ModelLayoutprofile>>(data: TypeModelMutateRelationData<EntityLayoutprofile,ModelLayoutprofile, T>, options?: T): Promise<TypeModelMutateRelationData<EntityLayoutprofile,ModelLayoutprofile, T>>;
111
+ updateBulk<T extends IModelUpdateOptions<EntityLayoutprofile,ModelLayoutprofile>>(items: TypeModelMutateRelationData<EntityLayoutprofile,ModelLayoutprofile, T>[], options?: T): Promise<TypeModelMutateRelationData<EntityLayoutprofile,ModelLayoutprofile, T>[]>;
112
+ delete<T extends IModelDeleteOptions<EntityLayoutprofile,ModelLayoutprofile>>(where?: TypeModelWhere<EntityLayoutprofile>, options?: T): Promise<void>;
113
+ deleteBulk<T extends IModelDeleteOptions<EntityLayoutprofile,ModelLayoutprofile>>(ids: TableIdentity[], options?: T): Promise<void>;
114
+ mutate<T extends IModelMutateOptions<EntityLayoutprofile,ModelLayoutprofile>>(data?: TypeModelMutateRelationData<EntityLayoutprofile,ModelLayoutprofile, T>, options?: T): Promise<TypeModelMutateRelationData<EntityLayoutprofile,ModelLayoutprofile, T>>;
115
+ mutateBulk<T extends IModelMutateOptions<EntityLayoutprofile,ModelLayoutprofile>>(items: TypeModelMutateRelationData<EntityLayoutprofile,ModelLayoutprofile, T>[], options?: T): Promise<TypeModelMutateRelationData<EntityLayoutprofile,ModelLayoutprofile, T>[]>;
116
+ count<T extends IModelSelectCountParams<EntityLayoutprofile,ModelLayoutprofile,ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<string | undefined>;
117
+ increment<T extends IModelIncrementParams<EntityLayoutprofile,ModelLayoutprofile,ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<number>;
118
+ decrement<T extends IModelIncrementParams<EntityLayoutprofile,ModelLayoutprofile,ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<number>;
119
+ aggregate<T extends IModelSelectAggrParams<EntityLayoutprofile,ModelLayoutprofile,ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<TypeModelAggrRelationResult<T>>;
120
+ group<T extends IModelSelectGroupParams<EntityLayoutprofile,ModelLayoutprofile,ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<TypeModelGroupRelationResult<EntityLayoutprofile, T>[]>;
121
+ getById<T extends IModelGetOptions<EntityLayoutprofile,ModelLayoutprofile>>(id: TableIdentity, options?: T): Promise<TypeModelRelationResult<EntityLayoutprofile, ModelLayoutprofile, T> | undefined>;
122
+ updateById<T extends IModelUpdateOptions<EntityLayoutprofile,ModelLayoutprofile>>(id: TableIdentity, data: TypeModelMutateRelationData<EntityLayoutprofile,ModelLayoutprofile, T>, options?: T): Promise<TypeModelMutateRelationData<EntityLayoutprofile,ModelLayoutprofile, T>>;
123
+ deleteById<T extends IModelDeleteOptions<EntityLayoutprofile,ModelLayoutprofile>>(id: TableIdentity, options?: T): Promise<void>;
124
+ }
125
+ }
126
+ declare module 'vona-module-a-orm' {
127
+ export interface IModelClassRecord {
128
+ 'a-layoutprofile:layoutprofile': ModelLayoutprofile;
129
+ }
130
+ }
131
+ /** model: end */
132
+ /** dto: begin */
133
+ export * from '../dto/layoutProfile.tsx';
134
+ export * from '../dto/layoutProfileLoad.tsx';
135
+ export * from '../dto/layoutProfileSave.tsx';
136
+ import type { IDtoOptionsLayoutProfile } from '../dto/layoutProfile.tsx';
137
+ import type { IDtoOptionsLayoutProfileLoad } from '../dto/layoutProfileLoad.tsx';
138
+ import type { IDtoOptionsLayoutProfileSave } from '../dto/layoutProfileSave.tsx';
139
+ import 'vona-module-a-web';
140
+ declare module 'vona-module-a-web' {
141
+
142
+ export interface IDtoRecord {
143
+ 'a-layoutprofile:layoutProfile': IDtoOptionsLayoutProfile;
144
+ 'a-layoutprofile:layoutProfileLoad': IDtoOptionsLayoutProfileLoad;
145
+ 'a-layoutprofile:layoutProfileSave': IDtoOptionsLayoutProfileSave;
146
+ }
147
+
148
+
149
+ }
150
+ declare module 'vona-module-a-layoutprofile' {
151
+
152
+ }
153
+ /** dto: end */
154
+ /** dto: begin */
155
+ import type { DtoLayoutProfile } from '../dto/layoutProfile.tsx';
156
+ import type { DtoLayoutProfileLoad } from '../dto/layoutProfileLoad.tsx';
157
+ import type { DtoLayoutProfileSave } from '../dto/layoutProfileSave.tsx';
158
+ declare module 'vona-module-a-layoutprofile' {
159
+
160
+ export interface IDtoOptionsLayoutProfile {
161
+ fields?: TypeEntityOptionsFields<DtoLayoutProfile, IDtoOptionsLayoutProfile[TypeSymbolKeyFieldsMore]>;
162
+ }
163
+
164
+ export interface IDtoOptionsLayoutProfileLoad {
165
+ fields?: TypeEntityOptionsFields<DtoLayoutProfileLoad, IDtoOptionsLayoutProfileLoad[TypeSymbolKeyFieldsMore]>;
166
+ }
167
+
168
+ export interface IDtoOptionsLayoutProfileSave {
169
+ fields?: TypeEntityOptionsFields<DtoLayoutProfileSave, IDtoOptionsLayoutProfileSave[TypeSymbolKeyFieldsMore]>;
170
+ }
171
+ }
172
+ /** dto: end */
173
+ /** controller: begin */
174
+ export * from '../controller/layoutprofile.ts';
175
+ import type { IControllerOptionsLayoutprofile } from '../controller/layoutprofile.ts';
176
+ import 'vona-module-a-web';
177
+ declare module 'vona-module-a-web' {
178
+
179
+ export interface IControllerRecord {
180
+ 'a-layoutprofile:layoutprofile': IControllerOptionsLayoutprofile;
181
+ }
182
+
183
+
184
+ }
185
+ declare module 'vona-module-a-layoutprofile' {
186
+
187
+ export interface ControllerLayoutprofile {
188
+ /** @internal */
189
+ get scope(): ScopeModuleALayoutprofile;
190
+ }
191
+
192
+ export interface ControllerLayoutprofile {
193
+ get $beanFullName(): 'a-layoutprofile.controller.layoutprofile';
194
+ get $onionName(): 'a-layoutprofile:layoutprofile';
195
+ get $onionOptions(): IControllerOptionsLayoutprofile;
196
+ }
197
+ }
198
+ /** controller: end */
199
+ /** controller: begin */
200
+ // @ts-ignore ignore
201
+ import type { ControllerLayoutprofile } from '../controller/layoutprofile.ts';
202
+ declare module 'vona-module-a-layoutprofile' {
203
+
204
+ export interface IControllerOptionsLayoutprofile {
205
+ actions?: TypeControllerOptionsActions<ControllerLayoutprofile>;
206
+ }
207
+ }
208
+ declare module 'vona-module-a-web' {
209
+ export interface IApiPathGetRecord{
210
+ '/layoutprofile/load': undefined;
211
+ }
212
+ export interface IApiPathPostRecord{
213
+ '/layoutprofile/save': undefined;
214
+ }
215
+ export interface IApiPathDeleteRecord{
216
+ '/layoutprofile/reset': undefined;
217
+ }
218
+
219
+ }
220
+
221
+ /** controller: end */
222
+ /** service: begin */
223
+ export * from '../service/layoutprofile.ts';
224
+
225
+ import 'vona-module-a-bean';
226
+ declare module 'vona-module-a-bean' {
227
+
228
+ export interface IServiceRecord {
229
+ 'a-layoutprofile:layoutprofile': never;
230
+ }
231
+
232
+
233
+ }
234
+ declare module 'vona-module-a-layoutprofile' {
235
+
236
+ export interface ServiceLayoutprofile {
237
+ /** @internal */
238
+ get scope(): ScopeModuleALayoutprofile;
239
+ }
240
+
241
+ export interface ServiceLayoutprofile {
242
+ get $beanFullName(): 'a-layoutprofile.service.layoutprofile';
243
+ get $onionName(): 'a-layoutprofile:layoutprofile';
244
+ }
245
+ }
246
+ /** service: end */
247
+ /** service: begin */
248
+ import type { ServiceLayoutprofile } from '../service/layoutprofile.ts';
249
+ export interface IModuleService {
250
+ 'layoutprofile': ServiceLayoutprofile;
251
+ }
252
+ /** service: end */
253
+ /** service: begin */
254
+
255
+ import 'vona';
256
+ declare module 'vona' {
257
+ export interface IBeanRecordGeneral {
258
+ 'a-layoutprofile.service.layoutprofile': ServiceLayoutprofile;
259
+ }
260
+ }
261
+ /** service: end */
262
+ /** meta: begin */
263
+ export * from '../bean/meta.index.ts';
264
+ export * from '../bean/meta.redlock.ts';
265
+ export * from '../bean/meta.version.ts';
266
+ import type { IMetaOptionsIndex } from 'vona-module-a-index';
267
+ import 'vona-module-a-meta';
268
+ declare module 'vona-module-a-meta' {
269
+
270
+ export interface IMetaRecord {
271
+ 'a-layoutprofile:index': IMetaOptionsIndex;
272
+ 'a-layoutprofile:redlock': never;
273
+ 'a-layoutprofile:version': never;
274
+ }
275
+
276
+
277
+ }
278
+ declare module 'vona-module-a-layoutprofile' {
279
+
280
+ export interface MetaIndex {
281
+ /** @internal */
282
+ get scope(): ScopeModuleALayoutprofile;
283
+ }
284
+
285
+ export interface MetaIndex {
286
+ get $beanFullName(): 'a-layoutprofile.meta.index';
287
+ get $onionName(): 'a-layoutprofile:index';
288
+ get $onionOptions(): IMetaOptionsIndex;
289
+ }
290
+
291
+ export interface MetaRedlock {
292
+ /** @internal */
293
+ get scope(): ScopeModuleALayoutprofile;
294
+ }
295
+
296
+ export interface MetaRedlock {
297
+ get $beanFullName(): 'a-layoutprofile.meta.redlock';
298
+ get $onionName(): 'a-layoutprofile:redlock';
299
+ }
300
+
301
+ export interface MetaVersion {
302
+ /** @internal */
303
+ get scope(): ScopeModuleALayoutprofile;
304
+ }
305
+
306
+ export interface MetaVersion {
307
+ get $beanFullName(): 'a-layoutprofile.meta.version';
308
+ get $onionName(): 'a-layoutprofile:version';
309
+ }
310
+ }
311
+ /** meta: end */
312
+ /** meta redlock: begin */
313
+ import type { MetaRedlock } from '../bean/meta.redlock.ts';
314
+ /** meta redlock: end */
315
+ /** scope: begin */
316
+ import { BeanScopeBase, type BeanScopeUtil } from 'vona';
317
+ import { Scope } from 'vona-module-a-bean';
318
+
319
+ @Scope()
320
+ export class ScopeModuleALayoutprofile extends BeanScopeBase {}
321
+
322
+ export interface ScopeModuleALayoutprofile {
323
+ util: BeanScopeUtil;
324
+ entity: IModuleEntity;
325
+ model: IModuleModel;
326
+ service: IModuleService;
327
+ redlock: MetaRedlock;
328
+ }
329
+
330
+ import 'vona';
331
+ declare module 'vona' {
332
+ export interface IBeanScopeRecord {
333
+ 'a-layoutprofile': ScopeModuleALayoutprofile;
334
+ }
335
+
336
+ export interface IBeanScopeContainer {
337
+ layoutprofile: ScopeModuleALayoutprofile;
338
+ }
339
+
340
+
341
+
342
+
343
+
344
+
345
+ }
346
+ /** scope: end */
@@ -0,0 +1,2 @@
1
+ export const __ThisModule__ = 'a-layoutprofile';
2
+ export { ScopeModuleALayoutprofile as ScopeModule } from './index.ts';
@@ -0,0 +1,12 @@
1
+ import type { IMetaOptionsIndex } from 'vona-module-a-index';
2
+
3
+ import { BeanBase } from 'vona';
4
+ import { Meta } from 'vona-module-a-meta';
5
+ import { $tableColumns } from 'vona-module-a-ormutils';
6
+
7
+ @Meta<IMetaOptionsIndex>({
8
+ indexes: {
9
+ ...$tableColumns('aLayoutProfile', ['userId', 'layoutKey']),
10
+ },
11
+ })
12
+ export class MetaIndex extends BeanBase {}
@@ -0,0 +1,11 @@
1
+ import { Meta } from 'vona-module-a-meta';
2
+ import { BeanRedlockBase } from 'vona-module-a-redlock';
3
+
4
+ export type TypeRedlockLockResource = never;
5
+ export type TypeRedlockLockIsolateResource = `layoutprofileSave.${string}`;
6
+
7
+ @Meta()
8
+ export class MetaRedlock extends BeanRedlockBase<
9
+ TypeRedlockLockResource,
10
+ TypeRedlockLockIsolateResource
11
+ > {}
@@ -0,0 +1,20 @@
1
+ import type { IMetaVersionUpdate, IMetaVersionUpdateOptions } from 'vona-module-a-version';
2
+
3
+ import { BeanBase } from 'vona';
4
+ import { Meta } from 'vona-module-a-meta';
5
+
6
+ @Meta()
7
+ export class MetaVersion extends BeanBase implements IMetaVersionUpdate {
8
+ async update(options: IMetaVersionUpdateOptions) {
9
+ if (options.version !== 1) return;
10
+
11
+ const entity = this.scope.entity.layoutprofile;
12
+ await this.bean.model.createTable(entity.$table, table => {
13
+ table.comment(entity.$comment.$table);
14
+ table.basicFields();
15
+ table.userId(entity.userId).comment(entity.$comment.userId);
16
+ table.string(entity.layoutKey, 255).comment(entity.$comment.layoutKey);
17
+ table.json(entity.profile).comment(entity.$comment.profile);
18
+ });
19
+ }
20
+ }
@@ -0,0 +1,38 @@
1
+ import type { IUser } from 'vona-module-a-user';
2
+ import type { IDecoratorControllerOptions } from 'vona-module-a-web';
3
+
4
+ import { BeanBase } from 'vona';
5
+ import { Api, v } from 'vona-module-a-openapiutils';
6
+ import { Arg, Controller, Web } from 'vona-module-a-web';
7
+
8
+ import { DtoLayoutProfile } from '../dto/layoutProfile.tsx';
9
+ import { DtoLayoutProfileLoad } from '../dto/layoutProfileLoad.tsx';
10
+ import { DtoLayoutProfileSave } from '../dto/layoutProfileSave.tsx';
11
+
12
+ export interface IControllerOptionsLayoutprofile extends IDecoratorControllerOptions {}
13
+
14
+ @Controller<IControllerOptionsLayoutprofile>('layoutprofile')
15
+ export class ControllerLayoutprofile extends BeanBase {
16
+ @Web.get('load')
17
+ @Api.body(v.optional(), v.object(DtoLayoutProfile))
18
+ async load(
19
+ @Arg.query() query: DtoLayoutProfileLoad,
20
+ @Arg.user() user: IUser,
21
+ ): Promise<DtoLayoutProfile | undefined> {
22
+ return await this.scope.service.layoutprofile.load(user, query.layoutKey);
23
+ }
24
+
25
+ @Web.post('save')
26
+ @Api.body(v.object(DtoLayoutProfile))
27
+ async save(
28
+ @Arg.body(v.object(DtoLayoutProfileSave)) command: DtoLayoutProfileSave,
29
+ @Arg.user() user: IUser,
30
+ ): Promise<DtoLayoutProfile> {
31
+ return await this.scope.service.layoutprofile.save(user, command.layoutKey, command.profile);
32
+ }
33
+
34
+ @Web.delete('reset')
35
+ async reset(@Arg.query() query: DtoLayoutProfileLoad, @Arg.user() user: IUser): Promise<void> {
36
+ await this.scope.service.layoutprofile.reset(user, query.layoutKey);
37
+ }
38
+ }
@@ -0,0 +1,26 @@
1
+ import type { IDecoratorDtoOptions } from 'vona-module-a-web';
2
+
3
+ import { Api, v } from 'vona-module-a-openapiutils';
4
+ import { Dto } from 'vona-module-a-web';
5
+ import { z } from 'zod';
6
+
7
+ export interface IDtoOptionsLayoutProfile extends IDecoratorDtoOptions {}
8
+
9
+ const width = z.union([z.literal('auto'), z.number().int().min(1).max(2000)]);
10
+ const column = z.object({
11
+ key: z.string().trim().min(1).max(100),
12
+ visible: z.union([z.literal(true), z.literal(false)]),
13
+ width,
14
+ });
15
+
16
+ @Dto<IDtoOptionsLayoutProfile>()
17
+ export class DtoLayoutProfile {
18
+ @Api.field(v.required(), z.literal(1))
19
+ version: 1;
20
+
21
+ @Api.field(z.string().trim().max(255).optional())
22
+ schemaFingerprint?: string;
23
+
24
+ @Api.field(v.required(), z.array(column).max(200))
25
+ columns: Array<{ key: string; visible: boolean; width: number | 'auto' }>;
26
+ }
@@ -0,0 +1,13 @@
1
+ import type { IDecoratorDtoOptions } from 'vona-module-a-web';
2
+
3
+ import { Api, v } from 'vona-module-a-openapiutils';
4
+ import { Dto } from 'vona-module-a-web';
5
+ import { z } from 'zod';
6
+
7
+ export interface IDtoOptionsLayoutProfileLoad extends IDecoratorDtoOptions {}
8
+
9
+ @Dto<IDtoOptionsLayoutProfileLoad>()
10
+ export class DtoLayoutProfileLoad {
11
+ @Api.field(v.required(), z.string().trim().min(1).max(255))
12
+ layoutKey: string;
13
+ }
@@ -0,0 +1,31 @@
1
+ import type { IDecoratorDtoOptions } from 'vona-module-a-web';
2
+
3
+ import { Api, v } from 'vona-module-a-openapiutils';
4
+ import { Dto } from 'vona-module-a-web';
5
+ import { z } from 'zod';
6
+
7
+ import { DtoLayoutProfileLoad } from './layoutProfileLoad.tsx';
8
+
9
+ export interface IDtoOptionsLayoutProfileSave extends IDecoratorDtoOptions {}
10
+
11
+ const width = z.union([z.literal('auto'), z.number().int().min(1).max(2000)]);
12
+ const column = z.object({
13
+ key: z.string().trim().min(1).max(100),
14
+ visible: z.union([z.literal(true), z.literal(false)]),
15
+ width,
16
+ });
17
+ const profile = z.object({
18
+ version: z.literal(1),
19
+ schemaFingerprint: z.string().trim().max(255).optional(),
20
+ columns: z.array(column).max(200),
21
+ });
22
+
23
+ @Dto<IDtoOptionsLayoutProfileSave>()
24
+ export class DtoLayoutProfileSave extends DtoLayoutProfileLoad {
25
+ @Api.field(v.required(), profile)
26
+ profile: {
27
+ version: 1;
28
+ schemaFingerprint?: string;
29
+ columns: Array<{ key: string; visible: boolean; width: number | 'auto' }>;
30
+ };
31
+ }
@@ -0,0 +1,20 @@
1
+ import type { TableIdentity } from 'table-identity';
2
+ import type { IDecoratorEntityOptions } from 'vona-module-a-orm';
3
+
4
+ import { Api, v } from 'vona-module-a-openapiutils';
5
+ import { Entity, EntityBase } from 'vona-module-a-orm';
6
+ import { z } from 'zod';
7
+
8
+ export interface IEntityOptionsLayoutprofile extends IDecoratorEntityOptions {}
9
+
10
+ @Entity<IEntityOptionsLayoutprofile>('aLayoutProfile')
11
+ export class EntityLayoutprofile extends EntityBase {
12
+ @Api.field(v.tableIdentity())
13
+ userId: TableIdentity;
14
+
15
+ @Api.field(z.string().trim().min(1).max(255))
16
+ layoutKey: string;
17
+
18
+ @Api.field(z.record(z.string(), z.unknown()))
19
+ profile: Record<string, unknown>;
20
+ }
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './.metadata/index.ts';
2
+ export * from './types/index.ts';
@@ -0,0 +1,10 @@
1
+ import type { IDecoratorModelOptions } from 'vona-module-a-orm';
2
+
3
+ import { BeanModelBase, Model } from 'vona-module-a-orm';
4
+
5
+ import { EntityLayoutprofile } from '../entity/layoutprofile.ts';
6
+
7
+ export interface IModelOptionsLayoutprofile extends IDecoratorModelOptions<EntityLayoutprofile> {}
8
+
9
+ @Model<IModelOptionsLayoutprofile>({ entity: EntityLayoutprofile, disableDeleted: true })
10
+ export class ModelLayoutprofile extends BeanModelBase<EntityLayoutprofile> {}
@@ -0,0 +1,64 @@
1
+ import type { TableIdentity } from 'table-identity';
2
+ import type { IUser } from 'vona-module-a-user';
3
+
4
+ import { BeanBase } from 'vona';
5
+ import { Service } from 'vona-module-a-bean';
6
+ import { Core } from 'vona-module-a-core';
7
+
8
+ import type { ILayoutProfile } from '../types/layoutprofile.ts';
9
+
10
+ @Service()
11
+ export class ServiceLayoutprofile extends BeanBase {
12
+ async load(user: IUser, layoutKey: string): Promise<ILayoutProfile | undefined> {
13
+ const entity = await this.scope.model.layoutprofile.get({ userId: user.id, layoutKey });
14
+ return entity?.profile as ILayoutProfile | undefined;
15
+ }
16
+
17
+ async save(user: IUser, layoutKey: string, profile: ILayoutProfile): Promise<ILayoutProfile> {
18
+ if (await this._saveExisting(user.id, layoutKey, profile)) return profile;
19
+ return await this.scope.redlock.lockIsolate(
20
+ `layoutprofileSave.${user.id}.${layoutKey}`,
21
+ async () => await this._saveAfterLock(user.id, layoutKey, profile),
22
+ );
23
+ }
24
+
25
+ async reset(user: IUser, layoutKey: string): Promise<void> {
26
+ await this.scope.redlock.lockIsolate(
27
+ `layoutprofileSave.${user.id}.${layoutKey}`,
28
+ async () => await this._reset(user.id, layoutKey),
29
+ );
30
+ }
31
+
32
+ @Core.transaction()
33
+ private async _saveExisting(
34
+ userId: TableIdentity,
35
+ layoutKey: string,
36
+ profile: ILayoutProfile,
37
+ ): Promise<boolean> {
38
+ const entity = await this.scope.model.layoutprofile.getForUpdate({ userId, layoutKey });
39
+ if (!entity) return false;
40
+ await this.scope.model.layoutprofile.updateById(entity.id, { profile });
41
+ return true;
42
+ }
43
+
44
+ @Core.transaction()
45
+ private async _saveAfterLock(
46
+ userId: TableIdentity,
47
+ layoutKey: string,
48
+ profile: ILayoutProfile,
49
+ ): Promise<ILayoutProfile> {
50
+ const entity = await this.scope.model.layoutprofile.getForUpdate({ userId, layoutKey });
51
+ if (entity) {
52
+ await this.scope.model.layoutprofile.updateById(entity.id, { profile });
53
+ } else {
54
+ await this.scope.model.layoutprofile.insert({ userId, layoutKey, profile });
55
+ }
56
+ return profile;
57
+ }
58
+
59
+ @Core.transaction()
60
+ private async _reset(userId: TableIdentity, layoutKey: string): Promise<void> {
61
+ const entity = await this.scope.model.layoutprofile.getForUpdate({ userId, layoutKey });
62
+ if (entity) await this.scope.model.layoutprofile.deleteById(entity.id);
63
+ }
64
+ }
@@ -0,0 +1 @@
1
+ export * from './layoutprofile.ts';
@@ -0,0 +1,21 @@
1
+ import type { TableIdentity } from 'table-identity';
2
+
3
+ export type TypeLayoutProfileWidth = number | 'auto';
4
+
5
+ export interface ILayoutProfileColumn {
6
+ key: string;
7
+ visible: boolean;
8
+ width: TypeLayoutProfileWidth;
9
+ }
10
+
11
+ export interface ILayoutProfile extends Record<string, unknown> {
12
+ version: 1;
13
+ schemaFingerprint?: string;
14
+ columns: ILayoutProfileColumn[];
15
+ }
16
+
17
+ export interface ILayoutProfileRecord {
18
+ id?: TableIdentity;
19
+ layoutKey: string;
20
+ profile: ILayoutProfile;
21
+ }