@eeplatform/core 1.8.8 → 1.8.9

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @eeplatform/core
2
2
 
3
+ ## 1.8.9
4
+
5
+ ### Patch Changes
6
+
7
+ - a899c41: Add app management and revise roles and permission management
8
+
3
9
  ## 1.8.8
4
10
 
5
11
  ### 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
- createTextIndex: () => Promise<void>;
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,6 +245,199 @@ declare function useOrgController(): {
246
245
  getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
247
246
  };
248
247
 
248
+ type TApp = {
249
+ _id?: ObjectId;
250
+ code: string;
251
+ name: string;
252
+ description: string;
253
+ type?: string;
254
+ status?: string;
255
+ createdAt?: string | Date;
256
+ updatedAt?: string | Date;
257
+ deletedAt?: string | Date;
258
+ };
259
+ declare const schemaApp: Joi.ObjectSchema<any>;
260
+ declare const schemaAppUpdate: Joi.ObjectSchema<any>;
261
+ declare function modelApp(value: TApp): TApp;
262
+
263
+ declare function useAppRepo(): {
264
+ createIndexes: () => Promise<void>;
265
+ add: (value: TApp, session?: ClientSession) => Promise<ObjectId>;
266
+ getAll: ({ search, page, limit, sort, status, type, }?: {
267
+ search?: string;
268
+ page?: number;
269
+ limit?: number;
270
+ sort?: Record<string, any>;
271
+ status?: string;
272
+ type?: string | string[];
273
+ }) => Promise<Record<string, any> | {
274
+ items: any[];
275
+ pages: number;
276
+ pageRange: string;
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>>;
285
+ };
286
+
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>;
406
+ };
407
+
408
+ type TFile = {
409
+ _id?: ObjectId;
410
+ name: string;
411
+ type?: string;
412
+ status?: string;
413
+ createdAt: string;
414
+ };
415
+ declare class MFile implements TFile {
416
+ _id?: ObjectId;
417
+ name: string;
418
+ type?: string;
419
+ status?: string;
420
+ createdAt: string;
421
+ constructor(value: TFile);
422
+ }
423
+
424
+ declare function useFileRepo(): {
425
+ createFile: (value: TFile, session?: ClientSession) => Promise<string>;
426
+ deleteFileById: (_id: string | ObjectId, session?: ClientSession) => Promise<string>;
427
+ getAllDraftedFiles: () => Promise<any[]>;
428
+ };
429
+
430
+ declare function useFileService(): {
431
+ createFile: (value: Express.Multer.File) => Promise<string>;
432
+ deleteFile: (id: string) => Promise<string>;
433
+ deleteDraft: () => void;
434
+ };
435
+
436
+ declare function useFileController(): {
437
+ upload: (req: Request, res: Response, next: NextFunction) => Promise<void>;
438
+ deleteFile: (req: Request, res: Response, next: NextFunction) => Promise<void>;
439
+ };
440
+
249
441
  type TRole = {
250
442
  _id?: ObjectId;
251
443
  id?: string | ObjectId;
@@ -278,8 +470,7 @@ declare class MRole implements TRole {
278
470
  }
279
471
 
280
472
  declare function useRoleRepo(): {
281
- createIndex: () => Promise<void>;
282
- createTextIndex: () => Promise<void>;
473
+ createIndexes: () => Promise<void>;
283
474
  createUniqueIndex: () => Promise<void>;
284
475
  addRole: (value: TRole, session?: ClientSession, clearCache?: boolean) => Promise<ObjectId>;
285
476
  getRoles: ({ search, page, limit, sort, type, id, }?: {
@@ -313,39 +504,6 @@ declare function useRoleController(): {
313
504
  updatePermissionsById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
314
505
  };
315
506
 
316
- type TFile = {
317
- _id?: ObjectId;
318
- name: string;
319
- type?: string;
320
- status?: string;
321
- createdAt: string;
322
- };
323
- declare class MFile implements TFile {
324
- _id?: ObjectId;
325
- name: string;
326
- type?: string;
327
- status?: string;
328
- createdAt: string;
329
- constructor(value: TFile);
330
- }
331
-
332
- declare function useFileRepo(): {
333
- createFile: (value: TFile, session?: ClientSession) => Promise<string>;
334
- deleteFileById: (_id: string | ObjectId, session?: ClientSession) => Promise<string>;
335
- getAllDraftedFiles: () => Promise<any[]>;
336
- };
337
-
338
- declare function useFileService(): {
339
- createFile: (value: Express.Multer.File) => Promise<string>;
340
- deleteFile: (id: string) => Promise<string>;
341
- deleteDraft: () => void;
342
- };
343
-
344
- declare function useFileController(): {
345
- upload: (req: Request, res: Response, next: NextFunction) => Promise<void>;
346
- deleteFile: (req: Request, res: Response, next: NextFunction) => Promise<void>;
347
- };
348
-
349
507
  type TVerificationMetadata = {
350
508
  name?: string;
351
509
  app?: string;
@@ -488,9 +646,7 @@ type TMember = {
488
646
  declare function MMember(value: TMember): TMember;
489
647
 
490
648
  declare function useMemberRepo(): {
491
- createIndex: () => Promise<void>;
492
- createUniqueIndex: () => Promise<void>;
493
- createTextIndex: () => Promise<void>;
649
+ createIndexes: () => Promise<void>;
494
650
  add: (value: TMember, session?: ClientSession) => Promise<string>;
495
651
  getById: (_id: string | ObjectId) => Promise<TMember | null>;
496
652
  getByOrg: (org: string | ObjectId) => Promise<TMember | null>;
@@ -523,7 +679,7 @@ declare function useMemberRepo(): {
523
679
  name: string;
524
680
  }[]>;
525
681
  updateStatusByUserId: (user: string | ObjectId, status: string) => Promise<string>;
526
- updateName: (value: Pick<TMember, "user" | "name">, session?: ClientSession) => Promise<string>;
682
+ updateName: (value: Pick<TMember, "name" | "user">, session?: ClientSession) => Promise<string>;
527
683
  getByUserId: (user: string | ObjectId) => Promise<TMember | null>;
528
684
  getOrgsByMembership: ({ search, limit, page, user }?: {
529
685
  search: string;
@@ -813,4 +969,4 @@ declare const GEMINI_API_KEY: string;
813
969
  declare const ASSEMBLY_AI_API_KEY: string;
814
970
  declare const DOMAIN: string;
815
971
 
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, MRole, 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, TCounter, TFile, TMember, TMiniRole, TOrg, TPSGC, TRole, TToken, TUser, TUserRole, TVerification, TVerificationMetadata, VERIFICATION_FORGET_PASSWORD_DURATION, VERIFICATION_USER_INVITE_DURATION, XENDIT_BASE_URL, XENDIT_SECRET_KEY, addressSchema, isDev, modelPSGC, schemaOrg, schemaPSGC, transactionSchema, useAddressController, useAddressRepo, useAudioTranscriptionController, useAuthController, useAuthService, useCounterModel, useCounterRepo, useFileController, useFileRepo, useFileService, useGeminiAiService, useGitHubService, useMemberController, useMemberRepo, useOrgController, useOrgRepo, useOrgService, usePSGCController, usePSGCRepo, useRoleController, useRoleRepo, useTokenRepo, useTranscribeService, useUserController, useUserRepo, useUserService, useUtilController, useVerificationController, useVerificationRepo, useVerificationService };
972
+ 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, MRole, 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, TMiniRole, 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, schemaApp, schemaAppUpdate, schemaOrg, schemaPSGC, schemaPermission, schemaPermissionGroup, schemaPermissionGroupUpdate, schemaPermissionUpdate, 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, useTokenRepo, useTranscribeService, useUserController, useUserRepo, useUserService, useUtilController, useVerificationController, useVerificationRepo, useVerificationService };