@explorins/pers-sdk 1.6.4 → 1.6.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/README.md +86 -342
- package/dist/analytics/index.d.ts +0 -16
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/analytics.cjs +5 -73
- package/dist/analytics.cjs.map +1 -1
- package/dist/analytics.js +1 -72
- package/dist/analytics.js.map +1 -1
- package/dist/business/index.d.ts +0 -24
- package/dist/business/index.d.ts.map +1 -1
- package/dist/business.cjs +5 -273
- package/dist/business.cjs.map +1 -1
- package/dist/business.js +1 -272
- package/dist/business.js.map +1 -1
- package/dist/campaign/api/campaign-api.d.ts +3 -3
- package/dist/campaign/api/campaign-api.d.ts.map +1 -1
- package/dist/campaign/index.d.ts +0 -34
- package/dist/campaign/index.d.ts.map +1 -1
- package/dist/campaign.cjs +5 -447
- package/dist/campaign.cjs.map +1 -1
- package/dist/campaign.js +1 -446
- package/dist/campaign.js.map +1 -1
- package/dist/chunks/analytics-service-CitlimKJ.cjs +49 -0
- package/dist/chunks/analytics-service-CitlimKJ.cjs.map +1 -0
- package/dist/chunks/analytics-service-CxyrOwel.js +46 -0
- package/dist/chunks/analytics-service-CxyrOwel.js.map +1 -0
- package/dist/chunks/{token-sdk-BW4kkJb3.js → base-token-service-BSXDwrcq.js} +138 -204
- package/dist/chunks/base-token-service-BSXDwrcq.js.map +1 -0
- package/dist/chunks/{token-sdk-CiAbOb6c.cjs → base-token-service-CYuqPPs0.cjs} +140 -207
- package/dist/chunks/base-token-service-CYuqPPs0.cjs.map +1 -0
- package/dist/chunks/business-service-Cq3-oksM.cjs +241 -0
- package/dist/chunks/business-service-Cq3-oksM.cjs.map +1 -0
- package/dist/chunks/business-service-DrC-TNGa.js +238 -0
- package/dist/chunks/business-service-DrC-TNGa.js.map +1 -0
- package/dist/chunks/campaign-service-CWK9I388.cjs +403 -0
- package/dist/chunks/campaign-service-CWK9I388.cjs.map +1 -0
- package/dist/chunks/campaign-service-Dd7gMjC9.js +400 -0
- package/dist/chunks/campaign-service-Dd7gMjC9.js.map +1 -0
- package/dist/chunks/donation-service-CyJS4DIZ.js +47 -0
- package/dist/chunks/donation-service-CyJS4DIZ.js.map +1 -0
- package/dist/chunks/donation-service-D-xFrONi.cjs +50 -0
- package/dist/chunks/donation-service-D-xFrONi.cjs.map +1 -0
- package/dist/chunks/{index-CJ9Jfa4A.js → explorer.utils-Ckll15ja.js} +108 -172
- package/dist/chunks/explorer.utils-Ckll15ja.js.map +1 -0
- package/dist/chunks/{index-CzEluQmf.cjs → explorer.utils-GpskbLl1.cjs} +106 -174
- package/dist/chunks/explorer.utils-GpskbLl1.cjs.map +1 -0
- package/dist/chunks/index-BtDNXaFq.js +13 -0
- package/dist/chunks/index-BtDNXaFq.js.map +1 -0
- package/dist/chunks/index-CMk3Aqkk.cjs +15 -0
- package/dist/chunks/index-CMk3Aqkk.cjs.map +1 -0
- package/dist/chunks/payment-service-B4qx0qiE.cjs +220 -0
- package/dist/chunks/payment-service-B4qx0qiE.cjs.map +1 -0
- package/dist/chunks/payment-service-DfCBFosx.js +217 -0
- package/dist/chunks/payment-service-DfCBFosx.js.map +1 -0
- package/dist/chunks/pers-sdk-Bd6BZHgt.js +5672 -0
- package/dist/chunks/pers-sdk-Bd6BZHgt.js.map +1 -0
- package/dist/chunks/pers-sdk-CmyPEhy7.cjs +5705 -0
- package/dist/chunks/pers-sdk-CmyPEhy7.cjs.map +1 -0
- package/dist/chunks/redemption-service-7qbeQxEM.cjs +330 -0
- package/dist/chunks/redemption-service-7qbeQxEM.cjs.map +1 -0
- package/dist/chunks/redemption-service-BT0J5Iy7.js +327 -0
- package/dist/chunks/redemption-service-BT0J5Iy7.js.map +1 -0
- package/dist/chunks/tenant-service-Ba7xrWED.cjs +171 -0
- package/dist/chunks/tenant-service-Ba7xrWED.cjs.map +1 -0
- package/dist/chunks/tenant-service-DELk412y.js +168 -0
- package/dist/chunks/tenant-service-DELk412y.js.map +1 -0
- package/dist/chunks/token-service-BWScn8Qa.cjs +208 -0
- package/dist/chunks/token-service-BWScn8Qa.cjs.map +1 -0
- package/dist/chunks/token-service-CpVwC5Eb.js +205 -0
- package/dist/chunks/token-service-CpVwC5Eb.js.map +1 -0
- package/dist/chunks/user-service-D1Rn4U8u.cjs +153 -0
- package/dist/chunks/user-service-D1Rn4U8u.cjs.map +1 -0
- package/dist/chunks/user-service-D6mTa_WZ.js +150 -0
- package/dist/chunks/user-service-D6mTa_WZ.js.map +1 -0
- package/dist/chunks/{index-BfOoX87y.cjs → web3-chain-service-D75TcHkh.cjs} +28 -53
- package/dist/chunks/web3-chain-service-D75TcHkh.cjs.map +1 -0
- package/dist/chunks/{index-CM21r58m.js → web3-chain-service-Dp5Z8p9I.js} +28 -51
- package/dist/chunks/web3-chain-service-Dp5Z8p9I.js.map +1 -0
- package/dist/core/auth/api/auth-api.d.ts +11 -14
- package/dist/core/auth/api/auth-api.d.ts.map +1 -1
- package/dist/core/auth/auth-provider.interface.d.ts +36 -68
- package/dist/core/auth/auth-provider.interface.d.ts.map +1 -1
- package/dist/core/auth/default-auth-provider.d.ts +13 -59
- package/dist/core/auth/default-auth-provider.d.ts.map +1 -1
- package/dist/core/auth/index.d.ts +8 -14
- package/dist/core/auth/index.d.ts.map +1 -1
- package/dist/core/auth/refresh-manager.d.ts +15 -0
- package/dist/core/auth/refresh-manager.d.ts.map +1 -0
- package/dist/core/auth/services/auth-service.d.ts +15 -21
- package/dist/core/auth/services/auth-service.d.ts.map +1 -1
- package/dist/core/auth/token-storage.d.ts +26 -48
- package/dist/core/auth/token-storage.d.ts.map +1 -1
- package/dist/core/environment.d.ts +2 -4
- package/dist/core/environment.d.ts.map +1 -1
- package/dist/core/errors/index.d.ts +1 -5
- package/dist/core/errors/index.d.ts.map +1 -1
- package/dist/core/index.d.ts +4 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/pers-api-client.d.ts +14 -156
- package/dist/core/pers-api-client.d.ts.map +1 -1
- package/dist/core/pers-config.d.ts +13 -12
- package/dist/core/pers-config.d.ts.map +1 -1
- package/dist/core/utils/jwt.function.d.ts +9 -0
- package/dist/core/utils/jwt.function.d.ts.map +1 -1
- package/dist/core.cjs +22 -18
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +13 -14
- package/dist/core.js.map +1 -1
- package/dist/donation/index.d.ts +0 -15
- package/dist/donation/index.d.ts.map +1 -1
- package/dist/donation.cjs +5 -75
- package/dist/donation.cjs.map +1 -1
- package/dist/donation.js +1 -74
- package/dist/donation.js.map +1 -1
- package/dist/index.cjs +50 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -15
- package/dist/managers/analytics-manager.d.ts +290 -10
- package/dist/managers/analytics-manager.d.ts.map +1 -1
- package/dist/managers/auth-manager.d.ts +123 -23
- package/dist/managers/auth-manager.d.ts.map +1 -1
- package/dist/managers/business-manager.d.ts +273 -18
- package/dist/managers/business-manager.d.ts.map +1 -1
- package/dist/managers/campaign-manager.d.ts +585 -46
- package/dist/managers/campaign-manager.d.ts.map +1 -1
- package/dist/managers/donation-manager.d.ts +5 -5
- package/dist/managers/donation-manager.d.ts.map +1 -1
- package/dist/managers/file-manager.d.ts +430 -13
- package/dist/managers/file-manager.d.ts.map +1 -1
- package/dist/managers/purchase-manager.d.ts +340 -15
- package/dist/managers/purchase-manager.d.ts.map +1 -1
- package/dist/managers/redemption-manager.d.ts +450 -27
- package/dist/managers/redemption-manager.d.ts.map +1 -1
- package/dist/managers/tenant-manager.d.ts +5 -5
- package/dist/managers/tenant-manager.d.ts.map +1 -1
- package/dist/managers/token-manager.d.ts +245 -21
- package/dist/managers/token-manager.d.ts.map +1 -1
- package/dist/managers/transaction-manager.d.ts +447 -18
- package/dist/managers/transaction-manager.d.ts.map +1 -1
- package/dist/managers/user-manager.d.ts +216 -14
- package/dist/managers/user-manager.d.ts.map +1 -1
- package/dist/managers/web3-manager.d.ts +4 -4
- package/dist/managers/web3-manager.d.ts.map +1 -1
- package/dist/package.json +10 -4
- package/dist/payment/index.d.ts +0 -21
- package/dist/payment/index.d.ts.map +1 -1
- package/dist/payment.cjs +5 -255
- package/dist/payment.cjs.map +1 -1
- package/dist/payment.js +1 -254
- package/dist/payment.js.map +1 -1
- package/dist/pers-sdk.d.ts +141 -34
- package/dist/pers-sdk.d.ts.map +1 -1
- package/dist/redemption/index.d.ts +0 -25
- package/dist/redemption/index.d.ts.map +1 -1
- package/dist/redemption.cjs +5 -365
- package/dist/redemption.cjs.map +1 -1
- package/dist/redemption.js +1 -364
- package/dist/redemption.js.map +1 -1
- package/dist/tenant/index.d.ts +0 -22
- package/dist/tenant/index.d.ts.map +1 -1
- package/dist/tenant.cjs +5 -203
- package/dist/tenant.cjs.map +1 -1
- package/dist/tenant.js +1 -202
- package/dist/tenant.js.map +1 -1
- package/dist/token.cjs +6 -6
- package/dist/token.js +2 -2
- package/dist/transaction/index.d.ts +0 -22
- package/dist/transaction/index.d.ts.map +1 -1
- package/dist/transaction.cjs +0 -40
- package/dist/transaction.cjs.map +1 -1
- package/dist/transaction.js +1 -40
- package/dist/transaction.js.map +1 -1
- package/dist/user/index.d.ts +0 -25
- package/dist/user/index.d.ts.map +1 -1
- package/dist/user.cjs +5 -185
- package/dist/user.cjs.map +1 -1
- package/dist/user.js +1 -184
- package/dist/user.js.map +1 -1
- package/dist/web3/index.d.ts +0 -11
- package/dist/web3/index.d.ts.map +1 -1
- package/dist/web3-chain/index.d.ts +0 -9
- package/dist/web3-chain/index.d.ts.map +1 -1
- package/dist/web3-chain/services/getWeb3FCD.service.d.ts.map +1 -1
- package/dist/web3-chain.cjs +5 -6
- package/dist/web3-chain.cjs.map +1 -1
- package/dist/web3-chain.js +2 -2
- package/dist/web3.cjs +6 -10
- package/dist/web3.cjs.map +1 -1
- package/dist/web3.js +1 -4
- package/dist/web3.js.map +1 -1
- package/package.json +10 -4
- package/dist/chunks/base-token-service-D0KANDgM.js +0 -139
- package/dist/chunks/base-token-service-D0KANDgM.js.map +0 -1
- package/dist/chunks/base-token-service-zNfPjHRx.cjs +0 -141
- package/dist/chunks/base-token-service-zNfPjHRx.cjs.map +0 -1
- package/dist/chunks/index-BfOoX87y.cjs.map +0 -1
- package/dist/chunks/index-CJ9Jfa4A.js.map +0 -1
- package/dist/chunks/index-CM21r58m.js.map +0 -1
- package/dist/chunks/index-CzEluQmf.cjs.map +0 -1
- package/dist/chunks/pers-sdk-DbPwFKrf.cjs +0 -3378
- package/dist/chunks/pers-sdk-DbPwFKrf.cjs.map +0 -1
- package/dist/chunks/pers-sdk-Z6MKeFBX.js +0 -3353
- package/dist/chunks/pers-sdk-Z6MKeFBX.js.map +0 -1
- package/dist/chunks/token-sdk-BW4kkJb3.js.map +0 -1
- package/dist/chunks/token-sdk-CiAbOb6c.cjs.map +0 -1
- package/dist/core/auth/auth-constants.d.ts +0 -33
- package/dist/core/auth/auth-constants.d.ts.map +0 -1
- package/dist/core/auth/auth-errors.d.ts +0 -8
- package/dist/core/auth/auth-errors.d.ts.map +0 -1
- package/dist/core/auth/create-auth-provider.d.ts +0 -27
- package/dist/core/auth/create-auth-provider.d.ts.map +0 -1
- package/dist/core/auth/token-refresh.d.ts +0 -91
- package/dist/core/auth/token-refresh.d.ts.map +0 -1
package/dist/analytics.js
CHANGED
|
@@ -1,74 +1,3 @@
|
|
|
1
|
+
export { A as AnalyticsApi, a as AnalyticsService } from './chunks/analytics-service-CxyrOwel.js';
|
|
1
2
|
export { AccountOwnerType } from '@explorins/pers-shared';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Platform-Agnostic Analytics API Client
|
|
5
|
-
*
|
|
6
|
-
* Handles analytics operations using the PERS backend.
|
|
7
|
-
* Uses @explorins/pers-shared DTOs for consistency with backend.
|
|
8
|
-
*/
|
|
9
|
-
class AnalyticsApi {
|
|
10
|
-
constructor(apiClient) {
|
|
11
|
-
this.apiClient = apiClient;
|
|
12
|
-
}
|
|
13
|
-
// ==========================================
|
|
14
|
-
// ADMIN OPERATIONS
|
|
15
|
-
// ==========================================
|
|
16
|
-
/**
|
|
17
|
-
* ADMIN: Get transaction analytics with filtering and aggregation
|
|
18
|
-
*/
|
|
19
|
-
async getTransactionAnalytics(request) {
|
|
20
|
-
return this.apiClient.post('/transactions/analytics', request);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Platform-Agnostic Analytics Service
|
|
26
|
-
*
|
|
27
|
-
* Contains analytics business logic and operations that work across platforms.
|
|
28
|
-
* No framework dependencies - pure TypeScript business logic.
|
|
29
|
-
*
|
|
30
|
-
* Focuses only on actual backend capabilities.
|
|
31
|
-
*/
|
|
32
|
-
class AnalyticsService {
|
|
33
|
-
constructor(analyticsApi) {
|
|
34
|
-
this.analyticsApi = analyticsApi;
|
|
35
|
-
}
|
|
36
|
-
// ==========================================
|
|
37
|
-
// ADMIN OPERATIONS
|
|
38
|
-
// ==========================================
|
|
39
|
-
/**
|
|
40
|
-
* ADMIN: Get transaction analytics with filtering and aggregation
|
|
41
|
-
*/
|
|
42
|
-
async getTransactionAnalytics(request) {
|
|
43
|
-
return this.analyticsApi.getTransactionAnalytics(request);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @explorins/pers-sdk-analytics
|
|
49
|
-
*
|
|
50
|
-
* Platform-agnostic Analytics Domain SDK for PERS ecosystem
|
|
51
|
-
* Handles analytics operations and data aggregation
|
|
52
|
-
*/
|
|
53
|
-
// API Layer
|
|
54
|
-
/**
|
|
55
|
-
* Create a complete Analytics SDK instance
|
|
56
|
-
*
|
|
57
|
-
* @param apiClient - Configured PERS API client
|
|
58
|
-
* @returns Analytics SDK with flattened structure for better DX
|
|
59
|
-
*/
|
|
60
|
-
function createAnalyticsSDK(apiClient) {
|
|
61
|
-
const analyticsApi = new AnalyticsApi(apiClient);
|
|
62
|
-
const analyticsService = new AnalyticsService(analyticsApi);
|
|
63
|
-
return {
|
|
64
|
-
// Direct access to service methods (primary interface)
|
|
65
|
-
// Admin methods
|
|
66
|
-
getTransactionAnalytics: (request) => analyticsService.getTransactionAnalytics(request),
|
|
67
|
-
// Advanced access for edge cases
|
|
68
|
-
api: analyticsApi,
|
|
69
|
-
service: analyticsService
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export { AnalyticsApi, AnalyticsService, createAnalyticsSDK };
|
|
74
3
|
//# sourceMappingURL=analytics.js.map
|
package/dist/analytics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.js","sources":[
|
|
1
|
+
{"version":3,"file":"analytics.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/business/index.d.ts
CHANGED
|
@@ -7,28 +7,4 @@
|
|
|
7
7
|
export { BusinessApi } from './api/business-api';
|
|
8
8
|
export { BusinessService } from './services/business-service';
|
|
9
9
|
export * from '../shared/interfaces/pers-shared-lib.interfaces';
|
|
10
|
-
import { BusinessUpdateRequestDTO, BusinessToggleActiveRequestDTO } from '../shared/interfaces/pers-shared-lib.interfaces';
|
|
11
|
-
import { PersApiClient } from '../core/pers-api-client';
|
|
12
|
-
import { BusinessApi } from './api/business-api';
|
|
13
|
-
import { BusinessService } from './services/business-service';
|
|
14
|
-
/**
|
|
15
|
-
* Create a complete Business SDK instance
|
|
16
|
-
*
|
|
17
|
-
* @param apiClient - Configured PERS API client
|
|
18
|
-
* @returns Business SDK with flattened structure for better DX
|
|
19
|
-
*/
|
|
20
|
-
export declare function createBusinessSDK(apiClient: PersApiClient): {
|
|
21
|
-
getActiveBusinesses: () => Promise<import("@explorins/pers-shared").BusinessDTO[]>;
|
|
22
|
-
getBusinessTypes: () => Promise<import("@explorins/pers-shared").BusinessTypeDTO[]>;
|
|
23
|
-
getBusinessById: (businessId: string) => Promise<import("@explorins/pers-shared").BusinessDTO>;
|
|
24
|
-
getBusinessByAccount: (accountAddress: string) => Promise<import("@explorins/pers-shared").BusinessDTO>;
|
|
25
|
-
getBusinessesByType: (typeId: string) => Promise<import("@explorins/pers-shared").BusinessDTO[]>;
|
|
26
|
-
getBusinesses: () => Promise<import("@explorins/pers-shared").BusinessDTO[]>;
|
|
27
|
-
createBusinessByDisplayName: (displayName: string) => Promise<import("@explorins/pers-shared").BusinessTokenBalancesDTO | import("@explorins/pers-shared").BusinessApiKeyDTO>;
|
|
28
|
-
updateBusiness: (id: string, businessData: BusinessUpdateRequestDTO) => Promise<import("@explorins/pers-shared").BusinessDTO>;
|
|
29
|
-
toggleBusinessActive: (id: string, dto: BusinessToggleActiveRequestDTO) => Promise<import("@explorins/pers-shared").BusinessDTO>;
|
|
30
|
-
api: BusinessApi;
|
|
31
|
-
service: BusinessService;
|
|
32
|
-
};
|
|
33
|
-
export type BusinessSDK = ReturnType<typeof createBusinessSDK>;
|
|
34
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/business/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,cAAc,iDAAiD,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/business/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,cAAc,iDAAiD,CAAC"}
|
package/dist/business.cjs
CHANGED
|
@@ -1,282 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var businessService = require('./chunks/business-service-Cq3-oksM.cjs');
|
|
3
4
|
var persShared = require('@explorins/pers-shared');
|
|
4
5
|
|
|
5
|
-
/**
|
|
6
|
-
* Platform-Agnostic Business API Client
|
|
7
|
-
*
|
|
8
|
-
* Updated to match the actual RESTful endpoints:
|
|
9
|
-
* - /businesses for business operations
|
|
10
|
-
* - /business-types for business type operations (separate controller)
|
|
11
|
-
*/
|
|
12
|
-
class BusinessApi {
|
|
13
|
-
constructor(apiClient) {
|
|
14
|
-
this.apiClient = apiClient;
|
|
15
|
-
this.basePath = '/businesses';
|
|
16
|
-
this.businessTypesPath = '/businesses/types';
|
|
17
|
-
}
|
|
18
|
-
// ==========================================
|
|
19
|
-
// 🌐 BUSINESS TYPES MANAGEMENT
|
|
20
|
-
// ==========================================
|
|
21
|
-
/**
|
|
22
|
-
* Get all business types (project key required)
|
|
23
|
-
*
|
|
24
|
-
* Endpoint: GET /business-types
|
|
25
|
-
* Auth: @ApiSecurity('projectKey')
|
|
26
|
-
*/
|
|
27
|
-
async getBusinessTypes() {
|
|
28
|
-
return this.apiClient.get(this.businessTypesPath);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* ADMIN: Create business type
|
|
32
|
-
*
|
|
33
|
-
* Endpoint: POST /business-types
|
|
34
|
-
* Auth: @TenantAdmin()
|
|
35
|
-
*/
|
|
36
|
-
async createBusinessType(dto) {
|
|
37
|
-
return this.apiClient.post(this.businessTypesPath, dto);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* ADMIN: Update business type
|
|
41
|
-
*
|
|
42
|
-
* Endpoint: PUT /business-types
|
|
43
|
-
* Auth: @TenantAdmin()
|
|
44
|
-
*/
|
|
45
|
-
async updateBusinessType(dto) {
|
|
46
|
-
return this.apiClient.put(this.businessTypesPath, dto);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* ADMIN: Delete business type
|
|
50
|
-
*
|
|
51
|
-
* Endpoint: DELETE /business-types/{id}
|
|
52
|
-
* Auth: @TenantAdmin()
|
|
53
|
-
*/
|
|
54
|
-
async deleteBusinessType(id) {
|
|
55
|
-
return this.apiClient.delete(`${this.businessTypesPath}/${id}`);
|
|
56
|
-
}
|
|
57
|
-
// ==========================================
|
|
58
|
-
// 🏢 BUSINESS MANAGEMENT
|
|
59
|
-
// ==========================================
|
|
60
|
-
/**
|
|
61
|
-
* Get current business info (business authentication required)
|
|
62
|
-
*
|
|
63
|
-
* Endpoint: GET /businesses/me
|
|
64
|
-
* Auth: @Business()
|
|
65
|
-
*/
|
|
66
|
-
async getCurrentBusiness() {
|
|
67
|
-
return this.apiClient.get(`${this.basePath}/me`);
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Get all businesses with role-based filtering
|
|
71
|
-
*
|
|
72
|
-
* Endpoint: GET /businesses?active={boolean}&sanitize={mode}
|
|
73
|
-
* Auth: @ApiSecurity('projectKey') (enhanced with role-based filtering)
|
|
74
|
-
* Note:
|
|
75
|
-
* - Project API Key users: Active businesses only (automatically filtered)
|
|
76
|
-
* - Admin JWT users: Full access with all query parameters
|
|
77
|
-
*/
|
|
78
|
-
async getBusinesses(options) {
|
|
79
|
-
const params = new URLSearchParams();
|
|
80
|
-
if (options?.active !== undefined) {
|
|
81
|
-
params.append('active', String(options.active));
|
|
82
|
-
}
|
|
83
|
-
if (options?.sanitize) {
|
|
84
|
-
params.append('sanitize', options.sanitize);
|
|
85
|
-
}
|
|
86
|
-
const queryString = params.toString();
|
|
87
|
-
const url = queryString ? `${this.basePath}?${queryString}` : this.basePath;
|
|
88
|
-
return this.apiClient.get(url);
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Get all active businesses (convenience method)
|
|
92
|
-
*
|
|
93
|
-
* Endpoint: GET /businesses
|
|
94
|
-
* Auth: @ApiSecurity('projectKey')
|
|
95
|
-
*/
|
|
96
|
-
async getActiveBusinesses() {
|
|
97
|
-
return this.apiClient.get(this.basePath);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Get business by ID
|
|
101
|
-
*
|
|
102
|
-
* Endpoint: GET /businesses/{id}
|
|
103
|
-
* Auth: @ApiSecurity('projectKey')
|
|
104
|
-
*/
|
|
105
|
-
async getBusinessById(businessId) {
|
|
106
|
-
return this.apiClient.get(`${this.basePath}/${businessId}`);
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Get business by account address
|
|
110
|
-
*
|
|
111
|
-
* Endpoint: GET /businesses/account/{accountAddress}
|
|
112
|
-
* Auth: @ApiSecurity('projectKey')
|
|
113
|
-
*/
|
|
114
|
-
async getBusinessByAccount(accountAddress) {
|
|
115
|
-
return this.apiClient.get(`${this.basePath}/account/${accountAddress}`);
|
|
116
|
-
}
|
|
117
|
-
// ==========================================
|
|
118
|
-
// 🔧 ADMIN OPERATIONS
|
|
119
|
-
// ==========================================
|
|
120
|
-
/**
|
|
121
|
-
* ADMIN: Create business
|
|
122
|
-
*
|
|
123
|
-
* Endpoint: POST /businesses
|
|
124
|
-
* Auth: @TenantAdmin()
|
|
125
|
-
* Returns: BusinessApiKeyDTO | BusinessTokenBalancesDTO
|
|
126
|
-
*/
|
|
127
|
-
async createBusiness(dto) {
|
|
128
|
-
return this.apiClient.post(this.basePath, dto);
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* ADMIN: Create business by display name (convenience method)
|
|
132
|
-
*/
|
|
133
|
-
async createBusinessByDisplayName(displayName) {
|
|
134
|
-
const dto = {
|
|
135
|
-
displayName,
|
|
136
|
-
// Add other required fields based on BusinessCreateRequestDTO structure
|
|
137
|
-
};
|
|
138
|
-
return this.createBusiness(dto);
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* ADMIN: Create businesses from URL
|
|
142
|
-
*
|
|
143
|
-
* Endpoint: POST /businesses/bulk/url
|
|
144
|
-
* Auth: @TenantAdmin()
|
|
145
|
-
*/
|
|
146
|
-
async createBusinessesFromUrl(url) {
|
|
147
|
-
return this.apiClient.post(`${this.basePath}/bulk/url`, { url });
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* ADMIN: Update business
|
|
151
|
-
*
|
|
152
|
-
* Endpoint: PUT /businesses/{id}
|
|
153
|
-
* Auth: @TenantAdmin()
|
|
154
|
-
*/
|
|
155
|
-
async updateBusiness(id, businessData) {
|
|
156
|
-
return this.apiClient.put(`${this.basePath}/${id}`, businessData);
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* ADMIN: Toggle business active status
|
|
160
|
-
*
|
|
161
|
-
* Endpoint: PUT /businesses/{id}/status
|
|
162
|
-
* Auth: @TenantAdmin()
|
|
163
|
-
*/
|
|
164
|
-
async toggleBusinessActive(id, dto) {
|
|
165
|
-
return this.apiClient.put(`${this.basePath}/${id}/status`, dto);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
6
|
|
|
169
|
-
/**
|
|
170
|
-
* Platform-Agnostic Business Service
|
|
171
|
-
*
|
|
172
|
-
* Contains business logic and operations that work across platforms.
|
|
173
|
-
* No framework dependencies - pure TypeScript business logic.
|
|
174
|
-
*
|
|
175
|
-
* Focuses only on actual backend capabilities.
|
|
176
|
-
*/
|
|
177
|
-
class BusinessService {
|
|
178
|
-
constructor(businessApi) {
|
|
179
|
-
this.businessApi = businessApi;
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Get all active businesses
|
|
183
|
-
*/
|
|
184
|
-
async getActiveBusinesses() {
|
|
185
|
-
return this.businessApi.getActiveBusinesses();
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Get all business types
|
|
189
|
-
*/
|
|
190
|
-
async getBusinessTypes() {
|
|
191
|
-
return this.businessApi.getBusinessTypes();
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Get business by ID
|
|
195
|
-
*/
|
|
196
|
-
async getBusinessById(businessId) {
|
|
197
|
-
return this.businessApi.getBusinessById(businessId);
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Get business by account address
|
|
201
|
-
*/
|
|
202
|
-
async getBusinessByAccount(accountAddress) {
|
|
203
|
-
return this.businessApi.getBusinessByAccount(accountAddress);
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Get businesses by type (client-side filtering)
|
|
207
|
-
*/
|
|
208
|
-
async getBusinessesByType(typeId) {
|
|
209
|
-
const businesses = await this.getActiveBusinesses();
|
|
210
|
-
return businesses.filter(business => business.businessType && business.businessType.id === parseInt(typeId));
|
|
211
|
-
}
|
|
212
|
-
// ==========================================
|
|
213
|
-
// ADMIN OPERATIONS
|
|
214
|
-
// ==========================================
|
|
215
|
-
/**
|
|
216
|
-
* ADMIN: Get all businesses (active and inactive)
|
|
217
|
-
*/
|
|
218
|
-
async getBusinesses() {
|
|
219
|
-
return this.businessApi.getBusinesses();
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* ADMIN: Create business by display name
|
|
223
|
-
*/
|
|
224
|
-
async createBusinessByDisplayName(displayName) {
|
|
225
|
-
return this.businessApi.createBusinessByDisplayName(displayName);
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* ADMIN: Update business
|
|
229
|
-
*/
|
|
230
|
-
async updateBusiness(id, businessData) {
|
|
231
|
-
return this.businessApi.updateBusiness(id, businessData);
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* ADMIN: Toggle business active status
|
|
235
|
-
*/
|
|
236
|
-
async toggleBusinessActive(id, dto) {
|
|
237
|
-
return this.businessApi.toggleBusinessActive(id, dto);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* @explorins/pers-sdk-business
|
|
243
|
-
*
|
|
244
|
-
* Platform-agnostic Business Domain SDK for PERS ecosystem
|
|
245
|
-
* Focuses on non-admin business operations
|
|
246
|
-
*/
|
|
247
|
-
// API Layer
|
|
248
|
-
/**
|
|
249
|
-
* Create a complete Business SDK instance
|
|
250
|
-
*
|
|
251
|
-
* @param apiClient - Configured PERS API client
|
|
252
|
-
* @returns Business SDK with flattened structure for better DX
|
|
253
|
-
*/
|
|
254
|
-
function createBusinessSDK(apiClient) {
|
|
255
|
-
const businessApi = new BusinessApi(apiClient);
|
|
256
|
-
const businessService = new BusinessService(businessApi);
|
|
257
|
-
return {
|
|
258
|
-
// Direct access to service methods (primary interface)
|
|
259
|
-
getActiveBusinesses: () => businessService.getActiveBusinesses(),
|
|
260
|
-
getBusinessTypes: () => businessService.getBusinessTypes(),
|
|
261
|
-
getBusinessById: (businessId) => businessService.getBusinessById(businessId),
|
|
262
|
-
getBusinessByAccount: (accountAddress) => businessService.getBusinessByAccount(accountAddress),
|
|
263
|
-
getBusinessesByType: (typeId) => businessService.getBusinessesByType(typeId),
|
|
264
|
-
// Admin methods
|
|
265
|
-
getBusinesses: () => businessService.getBusinesses(),
|
|
266
|
-
createBusinessByDisplayName: (displayName) => businessService.createBusinessByDisplayName(displayName),
|
|
267
|
-
updateBusiness: (id, businessData) => businessService.updateBusiness(id, businessData),
|
|
268
|
-
toggleBusinessActive: (id, dto) => businessService.toggleBusinessActive(id, dto),
|
|
269
|
-
// Advanced access for edge cases
|
|
270
|
-
api: businessApi,
|
|
271
|
-
service: businessService
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
7
|
|
|
8
|
+
exports.BusinessApi = businessService.BusinessApi;
|
|
9
|
+
exports.BusinessService = businessService.BusinessService;
|
|
275
10
|
Object.defineProperty(exports, "AccountOwnerType", {
|
|
276
|
-
|
|
277
|
-
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () { return persShared.AccountOwnerType; }
|
|
278
13
|
});
|
|
279
|
-
exports.BusinessApi = BusinessApi;
|
|
280
|
-
exports.BusinessService = BusinessService;
|
|
281
|
-
exports.createBusinessSDK = createBusinessSDK;
|
|
282
14
|
//# sourceMappingURL=business.cjs.map
|
package/dist/business.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"business.cjs","sources":[
|
|
1
|
+
{"version":3,"file":"business.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
package/dist/business.js
CHANGED
|
@@ -1,274 +1,3 @@
|
|
|
1
|
+
export { B as BusinessApi, a as BusinessService } from './chunks/business-service-DrC-TNGa.js';
|
|
1
2
|
export { AccountOwnerType } from '@explorins/pers-shared';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Platform-Agnostic Business API Client
|
|
5
|
-
*
|
|
6
|
-
* Updated to match the actual RESTful endpoints:
|
|
7
|
-
* - /businesses for business operations
|
|
8
|
-
* - /business-types for business type operations (separate controller)
|
|
9
|
-
*/
|
|
10
|
-
class BusinessApi {
|
|
11
|
-
constructor(apiClient) {
|
|
12
|
-
this.apiClient = apiClient;
|
|
13
|
-
this.basePath = '/businesses';
|
|
14
|
-
this.businessTypesPath = '/businesses/types';
|
|
15
|
-
}
|
|
16
|
-
// ==========================================
|
|
17
|
-
// 🌐 BUSINESS TYPES MANAGEMENT
|
|
18
|
-
// ==========================================
|
|
19
|
-
/**
|
|
20
|
-
* Get all business types (project key required)
|
|
21
|
-
*
|
|
22
|
-
* Endpoint: GET /business-types
|
|
23
|
-
* Auth: @ApiSecurity('projectKey')
|
|
24
|
-
*/
|
|
25
|
-
async getBusinessTypes() {
|
|
26
|
-
return this.apiClient.get(this.businessTypesPath);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* ADMIN: Create business type
|
|
30
|
-
*
|
|
31
|
-
* Endpoint: POST /business-types
|
|
32
|
-
* Auth: @TenantAdmin()
|
|
33
|
-
*/
|
|
34
|
-
async createBusinessType(dto) {
|
|
35
|
-
return this.apiClient.post(this.businessTypesPath, dto);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* ADMIN: Update business type
|
|
39
|
-
*
|
|
40
|
-
* Endpoint: PUT /business-types
|
|
41
|
-
* Auth: @TenantAdmin()
|
|
42
|
-
*/
|
|
43
|
-
async updateBusinessType(dto) {
|
|
44
|
-
return this.apiClient.put(this.businessTypesPath, dto);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* ADMIN: Delete business type
|
|
48
|
-
*
|
|
49
|
-
* Endpoint: DELETE /business-types/{id}
|
|
50
|
-
* Auth: @TenantAdmin()
|
|
51
|
-
*/
|
|
52
|
-
async deleteBusinessType(id) {
|
|
53
|
-
return this.apiClient.delete(`${this.businessTypesPath}/${id}`);
|
|
54
|
-
}
|
|
55
|
-
// ==========================================
|
|
56
|
-
// 🏢 BUSINESS MANAGEMENT
|
|
57
|
-
// ==========================================
|
|
58
|
-
/**
|
|
59
|
-
* Get current business info (business authentication required)
|
|
60
|
-
*
|
|
61
|
-
* Endpoint: GET /businesses/me
|
|
62
|
-
* Auth: @Business()
|
|
63
|
-
*/
|
|
64
|
-
async getCurrentBusiness() {
|
|
65
|
-
return this.apiClient.get(`${this.basePath}/me`);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Get all businesses with role-based filtering
|
|
69
|
-
*
|
|
70
|
-
* Endpoint: GET /businesses?active={boolean}&sanitize={mode}
|
|
71
|
-
* Auth: @ApiSecurity('projectKey') (enhanced with role-based filtering)
|
|
72
|
-
* Note:
|
|
73
|
-
* - Project API Key users: Active businesses only (automatically filtered)
|
|
74
|
-
* - Admin JWT users: Full access with all query parameters
|
|
75
|
-
*/
|
|
76
|
-
async getBusinesses(options) {
|
|
77
|
-
const params = new URLSearchParams();
|
|
78
|
-
if (options?.active !== undefined) {
|
|
79
|
-
params.append('active', String(options.active));
|
|
80
|
-
}
|
|
81
|
-
if (options?.sanitize) {
|
|
82
|
-
params.append('sanitize', options.sanitize);
|
|
83
|
-
}
|
|
84
|
-
const queryString = params.toString();
|
|
85
|
-
const url = queryString ? `${this.basePath}?${queryString}` : this.basePath;
|
|
86
|
-
return this.apiClient.get(url);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Get all active businesses (convenience method)
|
|
90
|
-
*
|
|
91
|
-
* Endpoint: GET /businesses
|
|
92
|
-
* Auth: @ApiSecurity('projectKey')
|
|
93
|
-
*/
|
|
94
|
-
async getActiveBusinesses() {
|
|
95
|
-
return this.apiClient.get(this.basePath);
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Get business by ID
|
|
99
|
-
*
|
|
100
|
-
* Endpoint: GET /businesses/{id}
|
|
101
|
-
* Auth: @ApiSecurity('projectKey')
|
|
102
|
-
*/
|
|
103
|
-
async getBusinessById(businessId) {
|
|
104
|
-
return this.apiClient.get(`${this.basePath}/${businessId}`);
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Get business by account address
|
|
108
|
-
*
|
|
109
|
-
* Endpoint: GET /businesses/account/{accountAddress}
|
|
110
|
-
* Auth: @ApiSecurity('projectKey')
|
|
111
|
-
*/
|
|
112
|
-
async getBusinessByAccount(accountAddress) {
|
|
113
|
-
return this.apiClient.get(`${this.basePath}/account/${accountAddress}`);
|
|
114
|
-
}
|
|
115
|
-
// ==========================================
|
|
116
|
-
// 🔧 ADMIN OPERATIONS
|
|
117
|
-
// ==========================================
|
|
118
|
-
/**
|
|
119
|
-
* ADMIN: Create business
|
|
120
|
-
*
|
|
121
|
-
* Endpoint: POST /businesses
|
|
122
|
-
* Auth: @TenantAdmin()
|
|
123
|
-
* Returns: BusinessApiKeyDTO | BusinessTokenBalancesDTO
|
|
124
|
-
*/
|
|
125
|
-
async createBusiness(dto) {
|
|
126
|
-
return this.apiClient.post(this.basePath, dto);
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* ADMIN: Create business by display name (convenience method)
|
|
130
|
-
*/
|
|
131
|
-
async createBusinessByDisplayName(displayName) {
|
|
132
|
-
const dto = {
|
|
133
|
-
displayName,
|
|
134
|
-
// Add other required fields based on BusinessCreateRequestDTO structure
|
|
135
|
-
};
|
|
136
|
-
return this.createBusiness(dto);
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* ADMIN: Create businesses from URL
|
|
140
|
-
*
|
|
141
|
-
* Endpoint: POST /businesses/bulk/url
|
|
142
|
-
* Auth: @TenantAdmin()
|
|
143
|
-
*/
|
|
144
|
-
async createBusinessesFromUrl(url) {
|
|
145
|
-
return this.apiClient.post(`${this.basePath}/bulk/url`, { url });
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* ADMIN: Update business
|
|
149
|
-
*
|
|
150
|
-
* Endpoint: PUT /businesses/{id}
|
|
151
|
-
* Auth: @TenantAdmin()
|
|
152
|
-
*/
|
|
153
|
-
async updateBusiness(id, businessData) {
|
|
154
|
-
return this.apiClient.put(`${this.basePath}/${id}`, businessData);
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* ADMIN: Toggle business active status
|
|
158
|
-
*
|
|
159
|
-
* Endpoint: PUT /businesses/{id}/status
|
|
160
|
-
* Auth: @TenantAdmin()
|
|
161
|
-
*/
|
|
162
|
-
async toggleBusinessActive(id, dto) {
|
|
163
|
-
return this.apiClient.put(`${this.basePath}/${id}/status`, dto);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Platform-Agnostic Business Service
|
|
169
|
-
*
|
|
170
|
-
* Contains business logic and operations that work across platforms.
|
|
171
|
-
* No framework dependencies - pure TypeScript business logic.
|
|
172
|
-
*
|
|
173
|
-
* Focuses only on actual backend capabilities.
|
|
174
|
-
*/
|
|
175
|
-
class BusinessService {
|
|
176
|
-
constructor(businessApi) {
|
|
177
|
-
this.businessApi = businessApi;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Get all active businesses
|
|
181
|
-
*/
|
|
182
|
-
async getActiveBusinesses() {
|
|
183
|
-
return this.businessApi.getActiveBusinesses();
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Get all business types
|
|
187
|
-
*/
|
|
188
|
-
async getBusinessTypes() {
|
|
189
|
-
return this.businessApi.getBusinessTypes();
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Get business by ID
|
|
193
|
-
*/
|
|
194
|
-
async getBusinessById(businessId) {
|
|
195
|
-
return this.businessApi.getBusinessById(businessId);
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Get business by account address
|
|
199
|
-
*/
|
|
200
|
-
async getBusinessByAccount(accountAddress) {
|
|
201
|
-
return this.businessApi.getBusinessByAccount(accountAddress);
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Get businesses by type (client-side filtering)
|
|
205
|
-
*/
|
|
206
|
-
async getBusinessesByType(typeId) {
|
|
207
|
-
const businesses = await this.getActiveBusinesses();
|
|
208
|
-
return businesses.filter(business => business.businessType && business.businessType.id === parseInt(typeId));
|
|
209
|
-
}
|
|
210
|
-
// ==========================================
|
|
211
|
-
// ADMIN OPERATIONS
|
|
212
|
-
// ==========================================
|
|
213
|
-
/**
|
|
214
|
-
* ADMIN: Get all businesses (active and inactive)
|
|
215
|
-
*/
|
|
216
|
-
async getBusinesses() {
|
|
217
|
-
return this.businessApi.getBusinesses();
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* ADMIN: Create business by display name
|
|
221
|
-
*/
|
|
222
|
-
async createBusinessByDisplayName(displayName) {
|
|
223
|
-
return this.businessApi.createBusinessByDisplayName(displayName);
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* ADMIN: Update business
|
|
227
|
-
*/
|
|
228
|
-
async updateBusiness(id, businessData) {
|
|
229
|
-
return this.businessApi.updateBusiness(id, businessData);
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* ADMIN: Toggle business active status
|
|
233
|
-
*/
|
|
234
|
-
async toggleBusinessActive(id, dto) {
|
|
235
|
-
return this.businessApi.toggleBusinessActive(id, dto);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* @explorins/pers-sdk-business
|
|
241
|
-
*
|
|
242
|
-
* Platform-agnostic Business Domain SDK for PERS ecosystem
|
|
243
|
-
* Focuses on non-admin business operations
|
|
244
|
-
*/
|
|
245
|
-
// API Layer
|
|
246
|
-
/**
|
|
247
|
-
* Create a complete Business SDK instance
|
|
248
|
-
*
|
|
249
|
-
* @param apiClient - Configured PERS API client
|
|
250
|
-
* @returns Business SDK with flattened structure for better DX
|
|
251
|
-
*/
|
|
252
|
-
function createBusinessSDK(apiClient) {
|
|
253
|
-
const businessApi = new BusinessApi(apiClient);
|
|
254
|
-
const businessService = new BusinessService(businessApi);
|
|
255
|
-
return {
|
|
256
|
-
// Direct access to service methods (primary interface)
|
|
257
|
-
getActiveBusinesses: () => businessService.getActiveBusinesses(),
|
|
258
|
-
getBusinessTypes: () => businessService.getBusinessTypes(),
|
|
259
|
-
getBusinessById: (businessId) => businessService.getBusinessById(businessId),
|
|
260
|
-
getBusinessByAccount: (accountAddress) => businessService.getBusinessByAccount(accountAddress),
|
|
261
|
-
getBusinessesByType: (typeId) => businessService.getBusinessesByType(typeId),
|
|
262
|
-
// Admin methods
|
|
263
|
-
getBusinesses: () => businessService.getBusinesses(),
|
|
264
|
-
createBusinessByDisplayName: (displayName) => businessService.createBusinessByDisplayName(displayName),
|
|
265
|
-
updateBusiness: (id, businessData) => businessService.updateBusiness(id, businessData),
|
|
266
|
-
toggleBusinessActive: (id, dto) => businessService.toggleBusinessActive(id, dto),
|
|
267
|
-
// Advanced access for edge cases
|
|
268
|
-
api: businessApi,
|
|
269
|
-
service: businessService
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
export { BusinessApi, BusinessService, createBusinessSDK };
|
|
274
3
|
//# sourceMappingURL=business.js.map
|