@eeplatform/core 1.8.8 → 1.8.10
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/CHANGELOG.md +12 -0
- package/dist/index.d.ts +206 -59
- package/dist/index.js +3066 -968
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3051 -943
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @eeplatform/core
|
|
2
2
|
|
|
3
|
+
## 1.8.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 364ae20: Revise role management, add app and permission management
|
|
8
|
+
|
|
9
|
+
## 1.8.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- a899c41: Add app management and revise roles and permission management
|
|
14
|
+
|
|
3
15
|
## 1.8.8
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -88,8 +88,7 @@ declare class MUser implements TUser {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
declare function useUserRepo(): {
|
|
91
|
-
|
|
92
|
-
createUniqueIndex: () => Promise<void>;
|
|
91
|
+
createIndexes: () => Promise<void>;
|
|
93
92
|
createUser: (value: TUser, session?: ClientSession) => Promise<ObjectId>;
|
|
94
93
|
getUserByEmail: (email: string) => Promise<TUser | null>;
|
|
95
94
|
getUserById: (_id: string | ObjectId) => Promise<TUser | null>;
|
|
@@ -246,71 +245,164 @@ declare function useOrgController(): {
|
|
|
246
245
|
getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
247
246
|
};
|
|
248
247
|
|
|
249
|
-
type
|
|
248
|
+
type TApp = {
|
|
250
249
|
_id?: ObjectId;
|
|
251
|
-
|
|
252
|
-
name
|
|
253
|
-
description
|
|
254
|
-
permissions?: Array<string>;
|
|
250
|
+
code: string;
|
|
251
|
+
name: string;
|
|
252
|
+
description: string;
|
|
255
253
|
type?: string;
|
|
256
254
|
status?: string;
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
updatedAt?: string;
|
|
261
|
-
deletedAt?: string;
|
|
255
|
+
createdAt?: string | Date;
|
|
256
|
+
updatedAt?: string | Date;
|
|
257
|
+
deletedAt?: string | Date;
|
|
262
258
|
};
|
|
263
|
-
|
|
264
|
-
declare
|
|
265
|
-
|
|
266
|
-
id: string | ObjectId;
|
|
267
|
-
name?: string;
|
|
268
|
-
description?: string;
|
|
269
|
-
permissions?: Array<string>;
|
|
270
|
-
type?: string;
|
|
271
|
-
status?: string;
|
|
272
|
-
default?: boolean;
|
|
273
|
-
createdBy?: string | ObjectId;
|
|
274
|
-
createdAt?: string;
|
|
275
|
-
updatedAt?: string;
|
|
276
|
-
deletedAt?: string;
|
|
277
|
-
constructor(value: TRole);
|
|
278
|
-
}
|
|
259
|
+
declare const schemaApp: Joi.ObjectSchema<any>;
|
|
260
|
+
declare const schemaAppUpdate: Joi.ObjectSchema<any>;
|
|
261
|
+
declare function modelApp(value: TApp): TApp;
|
|
279
262
|
|
|
280
|
-
declare function
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
addRole: (value: TRole, session?: ClientSession, clearCache?: boolean) => Promise<ObjectId>;
|
|
285
|
-
getRoles: ({ search, page, limit, sort, type, id, }?: {
|
|
263
|
+
declare function useAppRepo(): {
|
|
264
|
+
createIndexes: () => Promise<void>;
|
|
265
|
+
add: (value: TApp, session?: ClientSession) => Promise<ObjectId>;
|
|
266
|
+
getAll: ({ search, page, limit, sort, status, type, }?: {
|
|
286
267
|
search?: string;
|
|
287
268
|
page?: number;
|
|
288
269
|
limit?: number;
|
|
289
|
-
sort?: any
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}) => Promise<{
|
|
270
|
+
sort?: Record<string, any>;
|
|
271
|
+
status?: string;
|
|
272
|
+
type?: string | string[];
|
|
273
|
+
}) => Promise<Record<string, any> | {
|
|
293
274
|
items: any[];
|
|
294
275
|
pages: number;
|
|
295
276
|
pageRange: string;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
277
|
+
}>;
|
|
278
|
+
getById: (_id: string | ObjectId) => Promise<TApp | null>;
|
|
279
|
+
getByCode: (code: string) => Promise<TApp | null>;
|
|
280
|
+
updateById: (_id: ObjectId | string, value: {
|
|
281
|
+
name: string;
|
|
282
|
+
description: string;
|
|
283
|
+
}, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
284
|
+
deleteById: (_id: string | ObjectId, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
304
285
|
};
|
|
305
286
|
|
|
306
|
-
declare function
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
287
|
+
declare function useAppService(): {
|
|
288
|
+
addDefaultApps: () => Promise<void>;
|
|
289
|
+
deleteById: (id: string) => Promise<string>;
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
declare function useAppController(): {
|
|
293
|
+
add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
294
|
+
updateById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
295
|
+
getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
296
|
+
getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
297
|
+
deleteById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
type TPermission = {
|
|
301
|
+
_id?: ObjectId;
|
|
302
|
+
app: string;
|
|
303
|
+
key: string;
|
|
304
|
+
name: string;
|
|
305
|
+
group: string;
|
|
306
|
+
description: string;
|
|
307
|
+
deprecated?: boolean;
|
|
308
|
+
status?: string;
|
|
309
|
+
createdAt?: string | Date;
|
|
310
|
+
updatedAt?: string | Date;
|
|
311
|
+
deletedAt?: string | Date;
|
|
312
|
+
};
|
|
313
|
+
declare const schemaPermission: Joi.ObjectSchema<any>;
|
|
314
|
+
declare const schemaPermissionUpdate: Joi.ObjectSchema<any>;
|
|
315
|
+
declare function modelPermission(value: TPermission): TPermission;
|
|
316
|
+
|
|
317
|
+
declare function usePermissionRepo(): {
|
|
318
|
+
createIndexes: () => Promise<void>;
|
|
319
|
+
add: (value: TPermission, session?: ClientSession) => Promise<ObjectId>;
|
|
320
|
+
getAll: ({ search, page, limit, sort, app, status, }?: {
|
|
321
|
+
search?: string | undefined;
|
|
322
|
+
page?: number | undefined;
|
|
323
|
+
limit?: number | undefined;
|
|
324
|
+
sort?: {} | undefined;
|
|
325
|
+
app?: string | undefined;
|
|
326
|
+
status?: string | undefined;
|
|
327
|
+
}) => Promise<Record<string, any> | {
|
|
328
|
+
items: any[];
|
|
329
|
+
pages: number;
|
|
330
|
+
pageRange: string;
|
|
331
|
+
}>;
|
|
332
|
+
getById: (_id: string | ObjectId) => Promise<TPermission | null>;
|
|
333
|
+
getByKey: (key: string, group?: string, app?: string) => Promise<TPermission | null>;
|
|
334
|
+
updateById: (_id: ObjectId | string, value: {
|
|
335
|
+
key?: string;
|
|
336
|
+
group?: string;
|
|
337
|
+
description?: string;
|
|
338
|
+
}, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
339
|
+
deleteById: (_id: string | ObjectId, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
340
|
+
countByGroup: (group: string) => Promise<number>;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
declare function usePermissionService(): {
|
|
344
|
+
deleteById: (id: string) => Promise<string>;
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
declare function usePermissionController(): {
|
|
348
|
+
add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
349
|
+
getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
350
|
+
getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
351
|
+
deleteById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
352
|
+
updateById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
type TPermissionGroup = {
|
|
356
|
+
_id?: ObjectId;
|
|
357
|
+
app: string;
|
|
358
|
+
key: string;
|
|
359
|
+
label: string;
|
|
360
|
+
order?: number;
|
|
361
|
+
status?: string;
|
|
362
|
+
createdAt?: string | Date;
|
|
363
|
+
updatedAt?: string | Date;
|
|
364
|
+
deletedAt?: string | Date;
|
|
365
|
+
};
|
|
366
|
+
declare const schemaPermissionGroup: Joi.ObjectSchema<any>;
|
|
367
|
+
declare const schemaPermissionGroupUpdate: Joi.ObjectSchema<any>;
|
|
368
|
+
declare function modelPermissionGroup(value: TPermissionGroup): TPermissionGroup;
|
|
369
|
+
|
|
370
|
+
declare function usePermissionGroupRepo(): {
|
|
371
|
+
createIndexes: () => Promise<void>;
|
|
372
|
+
add: (value: TPermissionGroup, session?: ClientSession) => Promise<ObjectId>;
|
|
373
|
+
getAll: ({ search, page, limit, sort, app, status, }?: {
|
|
374
|
+
search?: string | undefined;
|
|
375
|
+
page?: number | undefined;
|
|
376
|
+
limit?: number | undefined;
|
|
377
|
+
sort?: {} | undefined;
|
|
378
|
+
app?: string | undefined;
|
|
379
|
+
status?: string | undefined;
|
|
380
|
+
}) => Promise<Record<string, any> | {
|
|
381
|
+
items: any[];
|
|
382
|
+
pages: number;
|
|
383
|
+
pageRange: string;
|
|
384
|
+
}>;
|
|
385
|
+
getById: (_id: string | ObjectId) => Promise<TPermissionGroup | null>;
|
|
386
|
+
getByKey: (key: string, app?: string) => Promise<TPermissionGroup | null>;
|
|
387
|
+
updateById: (_id: ObjectId | string, value: {
|
|
388
|
+
name: string;
|
|
389
|
+
serial: string;
|
|
390
|
+
levels: number;
|
|
391
|
+
}, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
392
|
+
deleteById: (_id: string | ObjectId, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
declare function usePermissionGroupService(): {
|
|
396
|
+
addDefaultModule: () => Promise<void>;
|
|
397
|
+
deleteById: (id: string) => Promise<string>;
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
declare function usePermissionGroupController(): {
|
|
401
|
+
add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
402
|
+
getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
403
|
+
getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
404
|
+
deleteById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
405
|
+
updateById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
314
406
|
};
|
|
315
407
|
|
|
316
408
|
type TFile = {
|
|
@@ -346,6 +438,62 @@ declare function useFileController(): {
|
|
|
346
438
|
deleteFile: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
347
439
|
};
|
|
348
440
|
|
|
441
|
+
type TRole = {
|
|
442
|
+
_id?: ObjectId;
|
|
443
|
+
id?: string | ObjectId;
|
|
444
|
+
name: string;
|
|
445
|
+
description?: string;
|
|
446
|
+
permissions?: Array<string>;
|
|
447
|
+
org?: string | ObjectId;
|
|
448
|
+
app: string;
|
|
449
|
+
status?: string;
|
|
450
|
+
createdBy?: string | ObjectId;
|
|
451
|
+
createdAt?: string | Date;
|
|
452
|
+
updatedAt?: string | Date;
|
|
453
|
+
deletedAt?: string | Date;
|
|
454
|
+
};
|
|
455
|
+
declare const schemaRole: Joi.ObjectSchema<any>;
|
|
456
|
+
declare const schemaRoleUpdate: Joi.ObjectSchema<any>;
|
|
457
|
+
declare function modelRole(value: TRole): TRole;
|
|
458
|
+
|
|
459
|
+
declare function useRoleRepo(): {
|
|
460
|
+
createIndexes: () => Promise<void>;
|
|
461
|
+
addRole: (value: TRole, session?: ClientSession, clearCache?: boolean) => Promise<ObjectId>;
|
|
462
|
+
getRoles: ({ search, page, limit, sort, app, org, }?: {
|
|
463
|
+
search?: string;
|
|
464
|
+
page?: number;
|
|
465
|
+
limit?: number;
|
|
466
|
+
sort?: any;
|
|
467
|
+
app?: string;
|
|
468
|
+
org?: string | ObjectId;
|
|
469
|
+
}) => Promise<{
|
|
470
|
+
items: any[];
|
|
471
|
+
pages: number;
|
|
472
|
+
pageRange: string;
|
|
473
|
+
} | TRole[]>;
|
|
474
|
+
getRoleByUserId: (value: ObjectId | string) => Promise<TRole | null>;
|
|
475
|
+
getById: (_id: ObjectId | string) => Promise<mongodb.WithId<bson.Document> | TRole | null>;
|
|
476
|
+
getRoleByName: (name: string) => Promise<mongodb.WithId<bson.Document> | TRole | null>;
|
|
477
|
+
updateRole: (_id: string | ObjectId, value: Pick<TRole, "name" | "permissions" | "description">, session?: ClientSession) => Promise<string>;
|
|
478
|
+
deleteById: (_id: ObjectId | string, session?: ClientSession) => Promise<string>;
|
|
479
|
+
updatePermissionsById: (_id: string | ObjectId, permissions: TRole["permissions"], session?: ClientSession) => Promise<string>;
|
|
480
|
+
delCachedData: () => void;
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
declare function useRoleService(): {
|
|
484
|
+
deleteById: (id: string) => Promise<void>;
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
declare function useRoleController(): {
|
|
488
|
+
createRole: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
489
|
+
getRoles: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
490
|
+
getRoleByUserId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
491
|
+
getRoleById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
492
|
+
updateRole: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
493
|
+
deleteRole: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
494
|
+
updatePermissionsById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
495
|
+
};
|
|
496
|
+
|
|
349
497
|
type TVerificationMetadata = {
|
|
350
498
|
name?: string;
|
|
351
499
|
app?: string;
|
|
@@ -488,11 +636,10 @@ type TMember = {
|
|
|
488
636
|
declare function MMember(value: TMember): TMember;
|
|
489
637
|
|
|
490
638
|
declare function useMemberRepo(): {
|
|
491
|
-
|
|
492
|
-
createUniqueIndex: () => Promise<void>;
|
|
493
|
-
createTextIndex: () => Promise<void>;
|
|
639
|
+
createIndexes: () => Promise<void>;
|
|
494
640
|
add: (value: TMember, session?: ClientSession) => Promise<string>;
|
|
495
641
|
getById: (_id: string | ObjectId) => Promise<TMember | null>;
|
|
642
|
+
getByRole: (role: string | ObjectId) => Promise<TMember | null>;
|
|
496
643
|
getByOrg: (org: string | ObjectId) => Promise<TMember | null>;
|
|
497
644
|
getAll: ({ search, limit, page, user, org, type, status }?: {
|
|
498
645
|
search: string;
|
|
@@ -523,7 +670,7 @@ declare function useMemberRepo(): {
|
|
|
523
670
|
name: string;
|
|
524
671
|
}[]>;
|
|
525
672
|
updateStatusByUserId: (user: string | ObjectId, status: string) => Promise<string>;
|
|
526
|
-
updateName: (value: Pick<TMember, "
|
|
673
|
+
updateName: (value: Pick<TMember, "name" | "user">, session?: ClientSession) => Promise<string>;
|
|
527
674
|
getByUserId: (user: string | ObjectId) => Promise<TMember | null>;
|
|
528
675
|
getOrgsByMembership: ({ search, limit, page, user }?: {
|
|
529
676
|
search: string;
|
|
@@ -813,4 +960,4 @@ declare const GEMINI_API_KEY: string;
|
|
|
813
960
|
declare const ASSEMBLY_AI_API_KEY: string;
|
|
814
961
|
declare const DOMAIN: string;
|
|
815
962
|
|
|
816
|
-
export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, ASSEMBLY_AI_API_KEY, AudioFileData, AudioTranscriptionOptions, AudioTranscriptionResult, DEFAULT_USER_EMAIL, DEFAULT_USER_FIRST_NAME, DEFAULT_USER_LAST_NAME, DEFAULT_USER_PASSWORD, DOMAIN, GEMINI_API_KEY, MAILER_EMAIL, MAILER_PASSWORD, MAILER_TRANSPORT_HOST, MAILER_TRANSPORT_PORT, MAILER_TRANSPORT_SECURE, MAddress, MFile, MMember, MONGO_DB, MONGO_URI, MOrg,
|
|
963
|
+
export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, ASSEMBLY_AI_API_KEY, AudioFileData, AudioTranscriptionOptions, AudioTranscriptionResult, DEFAULT_USER_EMAIL, DEFAULT_USER_FIRST_NAME, DEFAULT_USER_LAST_NAME, DEFAULT_USER_PASSWORD, DOMAIN, GEMINI_API_KEY, MAILER_EMAIL, MAILER_PASSWORD, MAILER_TRANSPORT_HOST, MAILER_TRANSPORT_PORT, MAILER_TRANSPORT_SECURE, MAddress, MFile, MMember, MONGO_DB, MONGO_URI, MOrg, MToken, MUser, MUserRole, MVerification, PAYPAL_API_URL, PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET, PORT, PhonemeMatchOptions, PhonemeMatchResult, REDIS_HOST, REDIS_PASSWORD, REDIS_PORT, REFRESH_TOKEN_EXPIRY, REFRESH_TOKEN_SECRET, SECRET_KEY, SPACES_ACCESS_KEY, SPACES_BUCKET, SPACES_ENDPOINT, SPACES_REGION, SPACES_SECRET_KEY, TAddress, TApp, TCounter, TFile, TMember, TOrg, TPSGC, TPermission, TPermissionGroup, TRole, TToken, TUser, TUserRole, TVerification, TVerificationMetadata, VERIFICATION_FORGET_PASSWORD_DURATION, VERIFICATION_USER_INVITE_DURATION, XENDIT_BASE_URL, XENDIT_SECRET_KEY, addressSchema, isDev, modelApp, modelPSGC, modelPermission, modelPermissionGroup, modelRole, schemaApp, schemaAppUpdate, schemaOrg, schemaPSGC, schemaPermission, schemaPermissionGroup, schemaPermissionGroupUpdate, schemaPermissionUpdate, schemaRole, schemaRoleUpdate, transactionSchema, useAddressController, useAddressRepo, useAppController, useAppRepo, useAppService, useAudioTranscriptionController, useAuthController, useAuthService, useCounterModel, useCounterRepo, useFileController, useFileRepo, useFileService, useGeminiAiService, useGitHubService, useMemberController, useMemberRepo, useOrgController, useOrgRepo, useOrgService, usePSGCController, usePSGCRepo, usePermissionController, usePermissionGroupController, usePermissionGroupRepo, usePermissionGroupService, usePermissionRepo, usePermissionService, useRoleController, useRoleRepo, useRoleService, useTokenRepo, useTranscribeService, useUserController, useUserRepo, useUserService, useUtilController, useVerificationController, useVerificationRepo, useVerificationService };
|