@bshsolutions/sdk 0.0.24 → 0.0.27

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.
@@ -51,5 +51,5 @@ var formatFileSize = (file) => {
51
51
  };
52
52
 
53
53
  export { BshEntityPermissions, BshEntityTypes, BshError, BshInsertDuplicates, BshPKStrategies, BshPKTypes, BshUpdateStrategies, PolicyActions, PrincipalType, defaultSettings, formatFileSize, isOk };
54
- //# sourceMappingURL=chunk-ZY43Z77S.js.map
55
- //# sourceMappingURL=chunk-ZY43Z77S.js.map
54
+ //# sourceMappingURL=chunk-I2BHGWFM.js.map
55
+ //# sourceMappingURL=chunk-I2BHGWFM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/response/index.ts","../src/types/entities/index.ts","../src/types/security/index.ts","../src/types/config/index.ts","../src/types/storage/index.ts"],"names":[],"mappings":";AAyBO,IAAM,IAAA,GAAO,CAAC,QAAA,KAA+C,QAAA,IAAY,MAAA,GAAY,QAAQ,QAAA,EAAU,IAAA,IAAQ,GAAA,IAAO,QAAA,EAAU,IAAA,GAAO;AAEvI,IAAM,QAAA,GAAN,cAAuB,KAAA,CAAM;AAAA,EAChC,WAAA,CACW,MAAA,EACA,QAAA,EACA,QAAA,EACT;AACE,IAAA,IAAI,QAAA,WAAmB,QAAA,GAAW,QAAA;AAClC,IAAA,KAAA,CAAM,IAAA,CAAK,SAAA,CAAU,QAAA,EAAU,IAAA,EAAM,CAAC,CAAC,CAAA;AALhC,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AACA,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA;AACA,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA;AAIP,IAAA,IAAA,CAAK,IAAA,GAAO,UAAA;AAAA,EAChB;AACJ;;;ACPO,IAAM,cAAA,GAAiB,CAAC,OAAA,EAAS,MAAA,EAAQ,UAAU;AACnD,IAAM,mBAAA,GAAsB,CAAC,SAAA,EAAW,QAAQ;AAChD,IAAM,mBAAA,GAAsB,CAAC,QAAA,EAAU,OAAO;AAC9C,IAAM,eAAA,GAAkB,CAAC,eAAA,EAAiB,MAAA,EAAQ,OAAO;AACzD,IAAM,UAAA,GAAa,CAAC,QAAA,EAAU,QAAQ;AACtC,IAAM,oBAAA,GAAuB,CAAC,MAAA,EAAQ,OAAA,EAAS,UAAU,QAAQ;;;ACsBjE,IAAM,aAAA,GAAgB;AAAA,EAAC,MAAA;AAAA,EAAQ,MAAA;AAAA,EAAQ,KAAA;AAAA,EAAO;AAAA;AAAqB;AACnE,IAAM,gBAAgB,CAAC,GAAA,EAAK,QAAQ,OAAA,EAAS,QAAA,EAAU,UAAU,QAAQ;;;ACrCzE,IAAM,eAAA,GAA+B;AAAA,EACxC,IAAA,EAAM,WAAA;AAAA,EACN,GAAA,EAAK;AAAA,IACD,QAAA,EAAU;AAAA,MACN,OAAA,EAAS;AAAA,KACb;AAAA,IACA,IAAA,EAAM;AAAA,MACF,cAAA,EAAgB;AAAA;AACpB;AAER;;;ACgBO,IAAM,cAAA,GAAiB,CAAC,IAAA,KAA2B;AACtD,EAAA,IAAI,CAAC,IAAA,EAAM,KAAA,EAAO,OAAO,SAAA;AACzB,EAAA,MAAM,KAAA,GAAQ,CAAC,OAAA,EAAS,IAAA,EAAM,MAAM,IAAI,CAAA;AACxC,EAAA,MAAM,CAAA,GAAI,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,KAAK,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,IAAI,CAAC,CAAA;AAC1D,EAAA,OAAO,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,KAAA,GAAQ,KAAK,GAAA,CAAI,IAAA,EAAM,CAAC,CAAA,GAAI,GAAG,CAAA,GAAI,GAAA,GAAM,GAAA,GAAM,MAAM,CAAC,CAAA;AACjF","file":"chunk-I2BHGWFM.js","sourcesContent":["export type BshResponse<T> = {\n data: T[]\n timestamp: number\n code: number\n status: string\n message?: string\n error?: string\n meta?: {\n type?: string,\n sql?: string,\n error?: string,\n tips?: {[key: string]: string}\n }\n pagination?: {\n current: number,\n total: number,\n pages: number,\n first: boolean,\n last: boolean\n }\n endpoint?: string,\n api?: string,\n validations?: {field: string, error: string}[]\n}\n\nexport const isOk = (response: BshResponse<unknown> | undefined) => response == undefined ? false : response?.code >= 200 && response?.code < 300\n\nexport class BshError extends Error {\n constructor(\n public status: number,\n public endpoint: string,\n public response?: BshResponse<unknown>\n ) {\n if (response) response.endpoint = endpoint\n super(JSON.stringify(response, null, 2));\n this.name = 'BshError';\n }\n}\n","import { BshObject, BshObjectPure } from '@types';\n\nexport type BshEntities = {\n name: string\n dbTable: string\n dbSchema: string\n type: 'Table' | 'View' | 'Function'\n dbSource: string\n updateStrategy: 'Replace' | 'Upsert'\n insertDuplicate: 'Upsert' | 'Error'\n bshSchema?: string\n bshPlugin?: string\n auditable?: boolean\n isPluginBased?: boolean\n isMultiTenant?: boolean\n pks: {\n key: string\n strategy: 'AutoIncrement' | 'UUID' | 'Fixed'\n type: 'string' | 'number'\n }[]\n permissions?: {\n write?: boolean\n read?: boolean\n delete?: boolean\n update?: boolean\n }\n} & BshObject;\n\nexport type BshEntitiesPure = BshObjectPure<BshEntities>;\nexport type BshEntityPermissions = 'read' | 'write' | 'update' | 'delete';\nexport const BshEntityTypes = ['Table', 'View', 'Function'] as const;\nexport const BshUpdateStrategies = ['Replace', 'Upsert'] as const;\nexport const BshInsertDuplicates = ['Upsert', 'Error'] as const;\nexport const BshPKStrategies = ['AutoIncrement', 'UUID', 'Fixed'] as const;\nexport const BshPKTypes = ['string', 'number'] as const;\nexport const BshEntityPermissions = ['read', 'write', 'update', 'delete'] as const;\n\nexport type BshSchemas = {\n name: string\n label: string\n description: string\n bshPlugin: string\n properties: {\n type: string\n name: string\n label: string\n\n meta?: {\n description?: string\n\n required?: boolean\n unique?: boolean\n default?: string\n\n length?: number\n maxLength?: number\n minLength?: number\n\n pattern?: string\n }\n }[]\n} & BshObject;\n\nexport type BshSchemasPure = BshObjectPure<BshSchemas>;\nexport type BshSchemaProperty = BshSchemas['properties'][number];\n\nexport type BshTypes = {\n name: string\n label: string\n bshPlugin?: string\n baseType?: string\n schema?: string\n meta?: {\n description?: string\n pattern?: string\n maxLength?: number\n minLength?: number\n max?: number\n min?: number\n }\n} & BshObject;\n\nexport type BshTypesPure = BshObjectPure<BshTypes>;\n\n","import {BshDate, BshObject, BshObjectPure} from '@types';\n\nexport type BshUser = {\n userId: string\n tenantId: string\n email: string\n password?: string\n roles: string[]\n status: 'ACTIVATED' | 'REQUIRED_ACTIVATION' | 'DISABLED' | 'REQUIRED_RESET_PASSWORD'\n profile?: {\n firstName?: string\n lastName?: string\n phone?: string\n picture?: string\n tags?: string[]\n [k: string]: unknown\n }\n} & BshObject;\n\nexport type BshUserInit = {\n email: string\n password?: string\n roles?: string[]\n profile: BshUser['profile']\n}\n\nexport type BshUserPure = BshObjectPure<BshUser>;\n\nexport type BshRole = {\n name: string\n public?: boolean\n admin?: boolean\n description?: string\n bshPlugin?: string;\n} & BshObject;\n\nexport type BshRolePure = BshObjectPure<BshRole>;\n\nexport type BshPolicy = {\n name: string\n description?: string\n principals: {\n type: Uppercase<'user' | 'group' | 'role' | 'apiKey' | 'any'>\n value: string[]\n }[]\n permissions: {\n entity: string[]\n actions: ('READ' | 'WRITE' | 'DELETE' | 'UPDATE' | 'SEARCH' | '*')[]\n allow: boolean\n }[]\n enabled: boolean\n priority?: number\n apiKeyId?: number\n bshPlugin?: string;\n} & BshObject;\n\nexport type BshPolicyPure = BshObjectPure<BshPolicy>;\nexport const PrincipalType = ['user', 'role', 'any', 'apiKey', /*'group'*/] as const;\nexport const PolicyActions = ['*', 'READ', 'WRITE', 'DELETE', 'UPDATE', 'SEARCH'] as const;\n\nexport type BshApiKeysScopes = {\n read: boolean\n write: boolean\n delete: boolean\n update: boolean\n}\n\nexport type BshApiKeysForm = {\n name: string\n description?: string\n duration: number\n type: 'PERSONAL' | 'MACHINE'\n scopes: string[] // Format: [\"EntityName:ACTION\", ...]\n}\n\nexport type BshApiKeys = BshApiKeysForm & {\n id: number\n apiKey: string\n startedAt: BshDate\n expiresAt?: BshDate\n status: 'ACTIVE' | 'REVOKED'\n userId?: string\n} & BshObject;\n\nexport type BshTenant = {\n tenantId: string;\n name: string;\n status: 'Active' | 'Inactive' | 'Blocked';\n description?: string;\n domain?: string;\n adminId?: string;\n settings?: Record<string, unknown>;\n} & BshObject;\n\nexport type BshTenantPure = BshObjectPure<BshTenant>;\n","import {BshObject} from \"@types\";\n\nexport type BshConfigurations<T extends Record<string, unknown> = Record<string, unknown>> = {\n name: string;\n description: string;\n bshPlugin?: string;\n config?: T;\n} & BshObject\n\nexport type BshSettings = {\n name: string;\n api: {\n response?: {\n showSql?: boolean;\n };\n auth?: {\n enableRegister?: boolean;\n };\n };\n}\n\nexport const defaultSettings: BshSettings = {\n name: 'BshEngine',\n api: {\n response: {\n showSql: true\n },\n auth: {\n enableRegister: false\n }\n }\n}\n\n","import { BshObject, BshConfigurations } from '@types';\n\nexport type StorageProvider = 'cloudinary';\n\nexport type CloudinaryConfig = {\n url: string;\n folder?: string;\n}\n\nexport type StorageConfiguration = BshConfigurations & {\n enabled?: StorageProvider;\n cloudinary: CloudinaryConfig\n}\n\nexport type BshFiles = {\n storageId: string;\n id: string;\n filename: string;\n mediaType: string;\n uri: string;\n secureUri: string;\n bytes: number;\n format: string;\n folder: string;\n width: number;\n height: number;\n tags: string[];\n context: { [key: string]: unknown };\n fileId: string;\n} & BshObject\n\nexport type UploadOptions = {\n tags: string[]\n context: { [key: string]: unknown }\n [key: string]: unknown;\n}\n\nexport type UploadResponse = {\n fileId: string\n publicId: string\n assetId: string\n uri: string\n secureUri: string\n tags: string[]\n context: { [key: string]: unknown }\n}\n\nexport const formatFileSize = (file: BshFiles): string => {\n if (!file?.bytes) return 'Unknown';\n const sizes = ['Bytes', 'KB', 'MB', 'GB'];\n const i = Math.floor(Math.log(file.bytes) / Math.log(1024));\n return Math.round(file.bytes / Math.pow(1024, i) * 100) / 100 + ' ' + sizes[i];\n};\n\n"]}
@@ -1,4 +1,4 @@
1
- import { CoreEntities } from './chunk-CAQ6G7NK.js';
1
+ import { CoreEntities } from './chunk-ZOCNJXUZ.js';
2
2
 
3
3
  // src/services/entities/index.ts
4
4
  var EntityService = class {
@@ -18,7 +18,7 @@ var EntityService = class {
18
18
  "Content-Type": "application/json"
19
19
  }
20
20
  },
21
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
21
+ bshOptions: params,
22
22
  api: `entities.${params.entity || this.entity}.findById`,
23
23
  entity: params.entity || this.entity
24
24
  });
@@ -35,7 +35,7 @@ var EntityService = class {
35
35
  "Content-Type": "application/json"
36
36
  }
37
37
  },
38
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
38
+ bshOptions: params,
39
39
  api: `entities.${params.entity || this.entity}.create`,
40
40
  entity: params.entity || this.entity
41
41
  });
@@ -52,7 +52,7 @@ var EntityService = class {
52
52
  "Content-Type": "application/json"
53
53
  }
54
54
  },
55
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
55
+ bshOptions: params,
56
56
  api: `entities.${params.entity || this.entity}.createMany`,
57
57
  entity: params.entity || this.entity
58
58
  });
@@ -69,7 +69,7 @@ var EntityService = class {
69
69
  "Content-Type": "application/json"
70
70
  }
71
71
  },
72
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
72
+ bshOptions: params,
73
73
  api: `entities.${params.entity || this.entity}.update`,
74
74
  entity: params.entity || this.entity
75
75
  });
@@ -86,7 +86,7 @@ var EntityService = class {
86
86
  "Content-Type": "application/json"
87
87
  }
88
88
  },
89
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
89
+ bshOptions: params,
90
90
  api: `entities.${params.entity || this.entity}.updateMany`,
91
91
  entity: params.entity || this.entity
92
92
  });
@@ -103,7 +103,7 @@ var EntityService = class {
103
103
  "Content-Type": "application/json"
104
104
  }
105
105
  },
106
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
106
+ bshOptions: params,
107
107
  api: `entities.${params.entity || this.entity}.search`,
108
108
  entity: params.entity || this.entity
109
109
  });
@@ -120,7 +120,7 @@ var EntityService = class {
120
120
  "Content-Type": "application/json"
121
121
  }
122
122
  },
123
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
123
+ bshOptions: params,
124
124
  api: `entities.${params.entity || this.entity}.delete`,
125
125
  entity: params.entity || this.entity
126
126
  });
@@ -136,7 +136,7 @@ var EntityService = class {
136
136
  "Content-Type": "application/json"
137
137
  }
138
138
  },
139
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
139
+ bshOptions: params,
140
140
  api: `entities.${params.entity || this.entity}.deleteById`,
141
141
  entity: params.entity || this.entity
142
142
  });
@@ -152,7 +152,7 @@ var EntityService = class {
152
152
  "Content-Type": "application/json"
153
153
  }
154
154
  },
155
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
155
+ bshOptions: params,
156
156
  api: `entities.${params.entity || this.entity}.columns`,
157
157
  entity: params.entity || this.entity
158
158
  });
@@ -168,7 +168,7 @@ var EntityService = class {
168
168
  "Content-Type": "application/json"
169
169
  }
170
170
  },
171
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
171
+ bshOptions: params,
172
172
  api: `entities.${params.entity || this.entity}.count`,
173
173
  entity: params.entity || this.entity
174
174
  });
@@ -185,7 +185,7 @@ var EntityService = class {
185
185
  "Content-Type": "application/json"
186
186
  }
187
187
  },
188
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
188
+ bshOptions: params,
189
189
  api: `entities.${params.entity || this.entity}.countBySearch`,
190
190
  entity: params.entity || this.entity
191
191
  });
@@ -228,7 +228,7 @@ var AuthService = class {
228
228
  "Content-Type": "application/json"
229
229
  }
230
230
  },
231
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
231
+ bshOptions: params,
232
232
  api: "auth.login"
233
233
  });
234
234
  }
@@ -239,7 +239,7 @@ var AuthService = class {
239
239
  responseType: "json",
240
240
  requestFormat: "json"
241
241
  },
242
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
242
+ bshOptions: params,
243
243
  api: "auth.logout"
244
244
  });
245
245
  }
@@ -254,7 +254,7 @@ var AuthService = class {
254
254
  "Content-Type": "application/json"
255
255
  }
256
256
  },
257
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
257
+ bshOptions: params,
258
258
  api: "auth.register",
259
259
  entity: CoreEntities.BshUsers
260
260
  });
@@ -270,7 +270,7 @@ var AuthService = class {
270
270
  "Content-Type": "application/json"
271
271
  }
272
272
  },
273
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
273
+ bshOptions: params,
274
274
  api: "auth.refreshToken"
275
275
  });
276
276
  }
@@ -285,7 +285,7 @@ var AuthService = class {
285
285
  "Content-Type": "application/json"
286
286
  }
287
287
  },
288
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
288
+ bshOptions: params,
289
289
  api: "auth.forgetPassword"
290
290
  });
291
291
  }
@@ -300,7 +300,7 @@ var AuthService = class {
300
300
  "Content-Type": "application/json"
301
301
  }
302
302
  },
303
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
303
+ bshOptions: params,
304
304
  api: "auth.resetPassword"
305
305
  });
306
306
  }
@@ -315,7 +315,7 @@ var AuthService = class {
315
315
  "Content-Type": "application/json"
316
316
  }
317
317
  },
318
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
318
+ bshOptions: params,
319
319
  api: "auth.activateAccount"
320
320
  });
321
321
  }
@@ -330,7 +330,7 @@ var AuthService = class {
330
330
  "Content-Type": "application/json"
331
331
  }
332
332
  },
333
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
333
+ bshOptions: params,
334
334
  api: "auth.resendActivationEmail",
335
335
  entity: CoreEntities.BshUsers
336
336
  });
@@ -347,7 +347,7 @@ var AdminUserService = class {
347
347
  return this.client.put({
348
348
  path: `${this.baseEndpoint}/forget-password/${params.email}`,
349
349
  options: { responseType: "json" },
350
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
350
+ bshOptions: params,
351
351
  api: "users.admin.resetPassword",
352
352
  entity: CoreEntities.BshUsers
353
353
  });
@@ -356,7 +356,7 @@ var AdminUserService = class {
356
356
  return this.client.put({
357
357
  path: `${this.baseEndpoint}/activate-account/${params.email}`,
358
358
  options: { responseType: "json" },
359
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
359
+ bshOptions: params,
360
360
  api: "users.admin.activateAccount",
361
361
  entity: CoreEntities.BshUsers
362
362
  });
@@ -365,7 +365,7 @@ var AdminUserService = class {
365
365
  return this.client.put({
366
366
  path: `${this.baseEndpoint}/resend-activation-email/${params.email}`,
367
367
  options: { responseType: "json" },
368
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
368
+ bshOptions: params,
369
369
  api: "users.admin.resendActivationCode",
370
370
  entity: CoreEntities.BshUsers
371
371
  });
@@ -383,7 +383,7 @@ var UserService = class {
383
383
  responseType: "json",
384
384
  requestFormat: "json"
385
385
  },
386
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
386
+ bshOptions: params,
387
387
  api: "users.me",
388
388
  entity: CoreEntities.BshUsers
389
389
  });
@@ -399,7 +399,7 @@ var UserService = class {
399
399
  "Content-Type": "application/json"
400
400
  }
401
401
  },
402
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
402
+ bshOptions: params,
403
403
  api: "users.init",
404
404
  entity: CoreEntities.BshUsers
405
405
  });
@@ -415,7 +415,7 @@ var UserService = class {
415
415
  "Content-Type": "application/json"
416
416
  }
417
417
  },
418
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
418
+ bshOptions: params,
419
419
  api: "users.invite",
420
420
  entity: CoreEntities.BshUsers
421
421
  });
@@ -431,7 +431,7 @@ var UserService = class {
431
431
  "Content-Type": "application/json"
432
432
  }
433
433
  },
434
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
434
+ bshOptions: params,
435
435
  api: "users.updateProfile",
436
436
  entity: CoreEntities.BshUsers
437
437
  });
@@ -446,7 +446,7 @@ var UserService = class {
446
446
  requestFormat: "form",
447
447
  body: formData
448
448
  },
449
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
449
+ bshOptions: params,
450
450
  api: "users.updatePicture",
451
451
  entity: CoreEntities.BshUsers
452
452
  });
@@ -462,7 +462,7 @@ var UserService = class {
462
462
  "Content-Type": "application/json"
463
463
  }
464
464
  },
465
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
465
+ bshOptions: params,
466
466
  api: "users.updatePassword",
467
467
  entity: CoreEntities.BshUsers
468
468
  });
@@ -479,7 +479,7 @@ var UserService = class {
479
479
  responseType: "json",
480
480
  requestFormat: "json"
481
481
  },
482
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
482
+ bshOptions: params,
483
483
  api: "users.getById",
484
484
  entity: CoreEntities.BshUsers
485
485
  });
@@ -495,7 +495,7 @@ var UserService = class {
495
495
  "Content-Type": "application/json"
496
496
  }
497
497
  },
498
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
498
+ bshOptions: params,
499
499
  api: "users.search",
500
500
  entity: CoreEntities.BshUsers
501
501
  });
@@ -514,7 +514,7 @@ var UserService = class {
514
514
  responseType: "json",
515
515
  requestFormat: "json"
516
516
  },
517
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
517
+ bshOptions: params,
518
518
  api: "users.list",
519
519
  entity: CoreEntities.BshUsers
520
520
  });
@@ -530,7 +530,7 @@ var UserService = class {
530
530
  "Content-Type": "application/json"
531
531
  }
532
532
  },
533
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
533
+ bshOptions: params,
534
534
  api: "users.update",
535
535
  entity: CoreEntities.BshUsers
536
536
  });
@@ -542,7 +542,7 @@ var UserService = class {
542
542
  responseType: "json",
543
543
  requestFormat: "json"
544
544
  },
545
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
545
+ bshOptions: params,
546
546
  api: "users.deleteById",
547
547
  entity: CoreEntities.BshUsers
548
548
  });
@@ -554,7 +554,7 @@ var UserService = class {
554
554
  responseType: "json",
555
555
  requestFormat: "json"
556
556
  },
557
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
557
+ bshOptions: params,
558
558
  api: "users.count",
559
559
  entity: CoreEntities.BshUsers
560
560
  });
@@ -570,13 +570,180 @@ var UserService = class {
570
570
  "Content-Type": "application/json"
571
571
  }
572
572
  },
573
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
573
+ bshOptions: params,
574
574
  api: "users.countFiltered",
575
575
  entity: CoreEntities.BshUsers
576
576
  });
577
577
  }
578
578
  };
579
579
 
580
+ // src/services/tenant/index.ts
581
+ var TenantService = class {
582
+ constructor(client) {
583
+ this.client = client;
584
+ this.baseEndpoint = "/api/tenants";
585
+ }
586
+ async create(params) {
587
+ console.log("params", params);
588
+ return this.client.post({
589
+ path: this.baseEndpoint,
590
+ options: {
591
+ responseType: "json",
592
+ requestFormat: "json",
593
+ body: params.payload,
594
+ headers: {
595
+ "Content-Type": "application/json"
596
+ }
597
+ },
598
+ bshOptions: params,
599
+ api: "tenants.create",
600
+ entity: CoreEntities.BshTenants
601
+ });
602
+ }
603
+ async assignAdmin(params) {
604
+ return this.client.put({
605
+ path: `${this.baseEndpoint}/${params.id}/admin/${params.adminId}`,
606
+ options: {
607
+ responseType: "json"
608
+ },
609
+ bshOptions: params,
610
+ api: "tenants.assignAdmin",
611
+ entity: CoreEntities.BshTenants
612
+ });
613
+ }
614
+ async activate(params) {
615
+ return this.client.post({
616
+ path: `${this.baseEndpoint}/${params.id}/activate`,
617
+ options: {
618
+ responseType: "json"
619
+ },
620
+ bshOptions: params,
621
+ api: "tenants.activate",
622
+ entity: CoreEntities.BshTenants
623
+ });
624
+ }
625
+ async deactivate(params) {
626
+ return this.client.post({
627
+ path: `${this.baseEndpoint}/${params.id}/deactivate`,
628
+ options: {
629
+ responseType: "json"
630
+ },
631
+ bshOptions: params,
632
+ api: "tenants.deactivate",
633
+ entity: CoreEntities.BshTenants
634
+ });
635
+ }
636
+ async block(params) {
637
+ return this.client.post({
638
+ path: `${this.baseEndpoint}/${params.id}/block`,
639
+ options: {
640
+ responseType: "json"
641
+ },
642
+ bshOptions: params,
643
+ api: "tenants.block",
644
+ entity: CoreEntities.BshTenants
645
+ });
646
+ }
647
+ async getById(params) {
648
+ return this.client.get({
649
+ path: `${this.baseEndpoint}/${params.id}`,
650
+ options: {
651
+ responseType: "json"
652
+ },
653
+ bshOptions: params,
654
+ api: "tenants.getById",
655
+ entity: CoreEntities.BshTenants
656
+ });
657
+ }
658
+ async search(params) {
659
+ return this.client.post({
660
+ path: `${this.baseEndpoint}/search`,
661
+ options: {
662
+ responseType: "json",
663
+ requestFormat: "json",
664
+ body: params.payload,
665
+ headers: {
666
+ "Content-Type": "application/json"
667
+ }
668
+ },
669
+ bshOptions: params,
670
+ api: "tenants.search",
671
+ entity: CoreEntities.BshTenants
672
+ });
673
+ }
674
+ async list(params) {
675
+ const queryParams = {};
676
+ if (params.page !== void 0) queryParams.page = params.page.toString();
677
+ if (params.size !== void 0) queryParams.size = params.size.toString();
678
+ if (params.sort !== void 0) queryParams.sort = params.sort;
679
+ if (params.filter !== void 0) queryParams.filter = params.filter;
680
+ return this.client.get({
681
+ path: this.baseEndpoint,
682
+ options: {
683
+ responseType: "json",
684
+ queryParams
685
+ },
686
+ bshOptions: params,
687
+ api: "tenants.list",
688
+ entity: CoreEntities.BshTenants
689
+ });
690
+ }
691
+ async update(params) {
692
+ return this.client.put({
693
+ path: this.baseEndpoint,
694
+ options: {
695
+ responseType: "json",
696
+ requestFormat: "json",
697
+ body: params.payload,
698
+ headers: {
699
+ "Content-Type": "application/json"
700
+ }
701
+ },
702
+ bshOptions: params,
703
+ api: "tenants.update",
704
+ entity: CoreEntities.BshTenants
705
+ });
706
+ }
707
+ async delete(params) {
708
+ return this.client.delete({
709
+ path: `${this.baseEndpoint}/${params.id}`,
710
+ options: {
711
+ responseType: "json"
712
+ },
713
+ bshOptions: params,
714
+ api: "tenants.delete",
715
+ entity: CoreEntities.BshTenants
716
+ });
717
+ }
718
+ async count(params) {
719
+ return this.client.get({
720
+ path: `${this.baseEndpoint}/count`,
721
+ options: {
722
+ responseType: "json"
723
+ },
724
+ bshOptions: params,
725
+ api: "tenants.count",
726
+ entity: CoreEntities.BshTenants
727
+ });
728
+ }
729
+ async countFiltered(params) {
730
+ return this.client.post({
731
+ path: `${this.baseEndpoint}/count`,
732
+ options: {
733
+ responseType: "json",
734
+ requestFormat: "json",
735
+ body: params.payload,
736
+ headers: {
737
+ "Content-Type": "application/json"
738
+ }
739
+ },
740
+ bshOptions: params,
741
+ api: "tenants.countFiltered",
742
+ entity: CoreEntities.BshTenants
743
+ });
744
+ }
745
+ };
746
+
580
747
  // src/services/settings/index.ts
581
748
  var SettingsService = class {
582
749
  constructor(client) {
@@ -590,7 +757,7 @@ var SettingsService = class {
590
757
  responseType: "json",
591
758
  requestFormat: "json"
592
759
  },
593
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
760
+ bshOptions: params,
594
761
  api: "settings.load",
595
762
  entity: CoreEntities.BshConfigurations
596
763
  });
@@ -606,7 +773,7 @@ var SettingsService = class {
606
773
  "Content-Type": "application/json"
607
774
  }
608
775
  },
609
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
776
+ bshOptions: params,
610
777
  api: "settings.update",
611
778
  entity: CoreEntities.BshConfigurations
612
779
  });
@@ -632,7 +799,7 @@ var ImageService = class {
632
799
  requestFormat: "form",
633
800
  body: formData
634
801
  },
635
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
802
+ bshOptions: params,
636
803
  api: "image.upload",
637
804
  entity: CoreEntities.BshFiles
638
805
  });
@@ -656,7 +823,7 @@ var MailingService = class {
656
823
  "Content-Type": "application/json"
657
824
  }
658
825
  },
659
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
826
+ bshOptions: params,
660
827
  api: "mailing.send",
661
828
  entity: CoreEntities.BshEmails
662
829
  });
@@ -728,7 +895,7 @@ var CachingService = class {
728
895
  responseType: "json",
729
896
  requestFormat: "json"
730
897
  },
731
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
898
+ bshOptions: params,
732
899
  api: "caching.findById"
733
900
  });
734
901
  }
@@ -743,7 +910,7 @@ var CachingService = class {
743
910
  "Content-Type": "application/json"
744
911
  }
745
912
  },
746
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
913
+ bshOptions: params,
747
914
  api: "caching.search"
748
915
  });
749
916
  }
@@ -754,7 +921,7 @@ var CachingService = class {
754
921
  responseType: "json",
755
922
  requestFormat: "json"
756
923
  },
757
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
924
+ bshOptions: params,
758
925
  api: "caching.names"
759
926
  });
760
927
  }
@@ -765,7 +932,7 @@ var CachingService = class {
765
932
  responseType: "json",
766
933
  requestFormat: "json"
767
934
  },
768
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
935
+ bshOptions: params,
769
936
  api: "caching.clearById"
770
937
  });
771
938
  }
@@ -776,7 +943,7 @@ var CachingService = class {
776
943
  responseType: "json",
777
944
  requestFormat: "json"
778
945
  },
779
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
946
+ bshOptions: params,
780
947
  api: "caching.clearAll"
781
948
  });
782
949
  }
@@ -799,7 +966,7 @@ var ApiKeyService = class {
799
966
  "Content-Type": "application/json"
800
967
  }
801
968
  },
802
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
969
+ bshOptions: params,
803
970
  entity: CoreEntities.BshApiKeys,
804
971
  api: "api-key.create"
805
972
  });
@@ -811,7 +978,7 @@ var ApiKeyService = class {
811
978
  responseType: "json",
812
979
  requestFormat: "json"
813
980
  },
814
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
981
+ bshOptions: params,
815
982
  entity: CoreEntities.BshApiKeys,
816
983
  api: "api-key.details"
817
984
  });
@@ -823,11 +990,23 @@ var ApiKeyService = class {
823
990
  responseType: "json",
824
991
  requestFormat: "json"
825
992
  },
826
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
993
+ bshOptions: params,
827
994
  entity: CoreEntities.BshApiKeys,
828
995
  api: "api-key.revoke"
829
996
  });
830
997
  }
998
+ async rotate(params) {
999
+ return this.client.post({
1000
+ path: `${this.baseEndpoint}/${params.id}/rotate`,
1001
+ options: {
1002
+ responseType: "json",
1003
+ requestFormat: "json"
1004
+ },
1005
+ bshOptions: params,
1006
+ entity: CoreEntities.BshApiKeys,
1007
+ api: "api-key.rotate"
1008
+ });
1009
+ }
831
1010
  // CRUD
832
1011
  async getById(params) {
833
1012
  return this.client.get({
@@ -836,7 +1015,7 @@ var ApiKeyService = class {
836
1015
  responseType: "json",
837
1016
  requestFormat: "json"
838
1017
  },
839
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
1018
+ bshOptions: params,
840
1019
  entity: CoreEntities.BshApiKeys,
841
1020
  api: "api-key.getById"
842
1021
  });
@@ -852,7 +1031,7 @@ var ApiKeyService = class {
852
1031
  "Content-Type": "application/json"
853
1032
  }
854
1033
  },
855
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
1034
+ bshOptions: params,
856
1035
  entity: CoreEntities.BshApiKeys,
857
1036
  api: "api-key.search"
858
1037
  });
@@ -871,7 +1050,7 @@ var ApiKeyService = class {
871
1050
  responseType: "json",
872
1051
  requestFormat: "json"
873
1052
  },
874
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
1053
+ bshOptions: params,
875
1054
  entity: CoreEntities.BshApiKeys,
876
1055
  api: "api-key.list"
877
1056
  });
@@ -883,7 +1062,7 @@ var ApiKeyService = class {
883
1062
  responseType: "json",
884
1063
  requestFormat: "json"
885
1064
  },
886
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
1065
+ bshOptions: params,
887
1066
  entity: CoreEntities.BshApiKeys,
888
1067
  api: "api-key.deleteById"
889
1068
  });
@@ -895,7 +1074,7 @@ var ApiKeyService = class {
895
1074
  responseType: "json",
896
1075
  requestFormat: "json"
897
1076
  },
898
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
1077
+ bshOptions: params,
899
1078
  entity: CoreEntities.BshApiKeys,
900
1079
  api: "api-key.count"
901
1080
  });
@@ -911,13 +1090,13 @@ var ApiKeyService = class {
911
1090
  "Content-Type": "application/json"
912
1091
  }
913
1092
  },
914
- bshOptions: { onSuccess: params.onSuccess, onError: params.onError },
1093
+ bshOptions: params,
915
1094
  entity: CoreEntities.BshApiKeys,
916
1095
  api: "api-key.countFiltered"
917
1096
  });
918
1097
  }
919
1098
  };
920
1099
 
921
- export { AdminUserService, ApiKeyService, AuthService, BshUtilsService, CachingService, EntityService, ImageService, MailingService, SettingsService, UserService };
922
- //# sourceMappingURL=chunk-PUOW7V6Z.js.map
923
- //# sourceMappingURL=chunk-PUOW7V6Z.js.map
1100
+ export { AdminUserService, ApiKeyService, AuthService, BshUtilsService, CachingService, EntityService, ImageService, MailingService, SettingsService, TenantService, UserService };
1101
+ //# sourceMappingURL=chunk-JKM4NXLY.js.map
1102
+ //# sourceMappingURL=chunk-JKM4NXLY.js.map