@varity-labs/sdk 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +31 -0
- package/README.md +253 -0
- package/dist/analytics/index.d.ts +7 -0
- package/dist/analytics/index.d.ts.map +1 -0
- package/dist/analytics/index.js +6 -0
- package/dist/analytics/tracker.d.ts +128 -0
- package/dist/analytics/tracker.d.ts.map +1 -0
- package/dist/analytics/tracker.js +203 -0
- package/dist/blockchain/BlockchainService.d.ts +100 -0
- package/dist/blockchain/BlockchainService.d.ts.map +1 -0
- package/dist/blockchain/BlockchainService.js +188 -0
- package/dist/blockchain/NFTLicensingService.d.ts +69 -0
- package/dist/blockchain/NFTLicensingService.d.ts.map +1 -0
- package/dist/blockchain/NFTLicensingService.js +136 -0
- package/dist/blockchain/RevenueSplitService.d.ts +71 -0
- package/dist/blockchain/RevenueSplitService.d.ts.map +1 -0
- package/dist/blockchain/RevenueSplitService.js +111 -0
- package/dist/blockchain/index.d.ts +48 -0
- package/dist/blockchain/index.d.ts.map +1 -0
- package/dist/blockchain/index.js +46 -0
- package/dist/blockchain/types.d.ts +63 -0
- package/dist/blockchain/types.d.ts.map +1 -0
- package/dist/blockchain/types.js +6 -0
- package/dist/chains/arbitrum.d.ts +89 -0
- package/dist/chains/arbitrum.d.ts.map +1 -0
- package/dist/chains/arbitrum.js +134 -0
- package/dist/chains/base.d.ts +84 -0
- package/dist/chains/base.d.ts.map +1 -0
- package/dist/chains/base.js +131 -0
- package/dist/chains/index.d.ts +36 -0
- package/dist/chains/index.d.ts.map +1 -0
- package/dist/chains/index.js +32 -0
- package/dist/chains/registry.d.ts +113 -0
- package/dist/chains/registry.d.ts.map +1 -0
- package/dist/chains/registry.js +201 -0
- package/dist/chains/varityL3.d.ts +81 -0
- package/dist/chains/varityL3.d.ts.map +1 -0
- package/dist/chains/varityL3.js +125 -0
- package/dist/cli/commands/clone.d.ts +8 -0
- package/dist/cli/commands/clone.d.ts.map +1 -0
- package/dist/cli/commands/clone.js +391 -0
- package/dist/cli/commands/dev.d.ts +8 -0
- package/dist/cli/commands/dev.d.ts.map +1 -0
- package/dist/cli/commands/dev.js +40 -0
- package/dist/cli/commands/generate.d.ts +8 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/generate.js +303 -0
- package/dist/cli/commands/init.d.ts +8 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +317 -0
- package/dist/cli/commands/validate.d.ts +8 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +69 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +33 -0
- package/dist/cli/utils/logger.d.ts +17 -0
- package/dist/cli/utils/logger.d.ts.map +1 -0
- package/dist/cli/utils/logger.js +35 -0
- package/dist/cli/utils/prompts.d.ts +21 -0
- package/dist/cli/utils/prompts.d.ts.map +1 -0
- package/dist/cli/utils/prompts.js +103 -0
- package/dist/contracts/abis/iso/AccessControlRegistry.json +1468 -0
- package/dist/contracts/abis/iso/DataProofRegistry.json +797 -0
- package/dist/contracts/abis/iso/MerchantRegistry.json +1237 -0
- package/dist/contracts/abis/iso/RepPerformance.json +1351 -0
- package/dist/contracts/abis/iso/ResidualCalculator.json +1118 -0
- package/dist/contracts/abis/iso/TransactionVault.json +1588 -0
- package/dist/contracts/abis/iso/VarityWalletFactory.json +475 -0
- package/dist/contracts/addresses.d.ts +88 -0
- package/dist/contracts/addresses.d.ts.map +1 -0
- package/dist/contracts/addresses.js +94 -0
- package/dist/contracts/index.d.ts +7 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +6 -0
- package/dist/core/VaritySDK.d.ts +177 -0
- package/dist/core/VaritySDK.d.ts.map +1 -0
- package/dist/core/VaritySDK.js +325 -0
- package/dist/core/config.d.ts +120 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +187 -0
- package/dist/core/credentials-proxy.d.ts +157 -0
- package/dist/core/credentials-proxy.d.ts.map +1 -0
- package/dist/core/credentials-proxy.js +345 -0
- package/dist/core/credentials.d.ts +219 -0
- package/dist/core/credentials.d.ts.map +1 -0
- package/dist/core/credentials.js +345 -0
- package/dist/core/template-loader.d.ts +15 -0
- package/dist/core/template-loader.d.ts.map +1 -0
- package/dist/core/template-loader.js +380 -0
- package/dist/core/template.d.ts +321 -0
- package/dist/core/template.d.ts.map +1 -0
- package/dist/core/template.js +189 -0
- package/dist/core/types.d.ts +572 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +52 -0
- package/dist/dev/dev-server.d.ts +16 -0
- package/dist/dev/dev-server.d.ts.map +1 -0
- package/dist/dev/dev-server.js +119 -0
- package/dist/generators/contracts/generator.d.ts +21 -0
- package/dist/generators/contracts/generator.d.ts.map +1 -0
- package/dist/generators/contracts/generator.js +252 -0
- package/dist/generators/tests/generator.d.ts +20 -0
- package/dist/generators/tests/generator.d.ts.map +1 -0
- package/dist/generators/tests/generator.js +375 -0
- package/dist/generators/types/generator.d.ts +19 -0
- package/dist/generators/types/generator.d.ts.map +1 -0
- package/dist/generators/types/generator.js +165 -0
- package/dist/generators/ui/component-generator.d.ts +20 -0
- package/dist/generators/ui/component-generator.d.ts.map +1 -0
- package/dist/generators/ui/component-generator.js +749 -0
- package/dist/generators/ui/dashboard-generator.d.ts +20 -0
- package/dist/generators/ui/dashboard-generator.d.ts.map +1 -0
- package/dist/generators/ui/dashboard-generator.js +349 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/modules/analytics/AnalyticsModule.d.ts +349 -0
- package/dist/modules/analytics/AnalyticsModule.d.ts.map +1 -0
- package/dist/modules/analytics/AnalyticsModule.js +274 -0
- package/dist/modules/analytics/index.d.ts +3 -0
- package/dist/modules/analytics/index.d.ts.map +1 -0
- package/dist/modules/analytics/index.js +1 -0
- package/dist/modules/auth/AccessKeyModule.d.ts +189 -0
- package/dist/modules/auth/AccessKeyModule.d.ts.map +1 -0
- package/dist/modules/auth/AccessKeyModule.js +322 -0
- package/dist/modules/auth/AuthModule.d.ts +133 -0
- package/dist/modules/auth/AuthModule.d.ts.map +1 -0
- package/dist/modules/auth/AuthModule.js +214 -0
- package/dist/modules/auth/index.d.ts +8 -0
- package/dist/modules/auth/index.d.ts.map +1 -0
- package/dist/modules/auth/index.js +6 -0
- package/dist/modules/cache/CacheModule.d.ts +279 -0
- package/dist/modules/cache/CacheModule.d.ts.map +1 -0
- package/dist/modules/cache/CacheModule.js +493 -0
- package/dist/modules/cache/index.d.ts +3 -0
- package/dist/modules/cache/index.d.ts.map +1 -0
- package/dist/modules/cache/index.js +1 -0
- package/dist/modules/compute/ComputeModule.d.ts +226 -0
- package/dist/modules/compute/ComputeModule.d.ts.map +1 -0
- package/dist/modules/compute/ComputeModule.js +379 -0
- package/dist/modules/compute/index.d.ts +6 -0
- package/dist/modules/compute/index.d.ts.map +1 -0
- package/dist/modules/compute/index.js +4 -0
- package/dist/modules/contracts/ContractsModule.d.ts +164 -0
- package/dist/modules/contracts/ContractsModule.d.ts.map +1 -0
- package/dist/modules/contracts/ContractsModule.js +242 -0
- package/dist/modules/contracts/index.d.ts +6 -0
- package/dist/modules/contracts/index.d.ts.map +1 -0
- package/dist/modules/contracts/index.js +4 -0
- package/dist/modules/export/ExportModule.d.ts +346 -0
- package/dist/modules/export/ExportModule.d.ts.map +1 -0
- package/dist/modules/export/ExportModule.js +432 -0
- package/dist/modules/export/index.d.ts +3 -0
- package/dist/modules/export/index.d.ts.map +1 -0
- package/dist/modules/export/index.js +1 -0
- package/dist/modules/forecasting/ForecastingModule.d.ts +579 -0
- package/dist/modules/forecasting/ForecastingModule.d.ts.map +1 -0
- package/dist/modules/forecasting/ForecastingModule.js +310 -0
- package/dist/modules/forecasting/index.d.ts +3 -0
- package/dist/modules/forecasting/index.d.ts.map +1 -0
- package/dist/modules/forecasting/index.js +1 -0
- package/dist/modules/monitoring/MonitoringModule.d.ts +359 -0
- package/dist/modules/monitoring/MonitoringModule.d.ts.map +1 -0
- package/dist/modules/monitoring/MonitoringModule.js +483 -0
- package/dist/modules/monitoring/index.d.ts +3 -0
- package/dist/modules/monitoring/index.d.ts.map +1 -0
- package/dist/modules/monitoring/index.js +1 -0
- package/dist/modules/notifications/NotificationsModule.d.ts +336 -0
- package/dist/modules/notifications/NotificationsModule.d.ts.map +1 -0
- package/dist/modules/notifications/NotificationsModule.js +418 -0
- package/dist/modules/notifications/index.d.ts +3 -0
- package/dist/modules/notifications/index.d.ts.map +1 -0
- package/dist/modules/notifications/index.js +1 -0
- package/dist/modules/oracle/OracleModule.d.ts +110 -0
- package/dist/modules/oracle/OracleModule.d.ts.map +1 -0
- package/dist/modules/oracle/OracleModule.js +151 -0
- package/dist/modules/oracle/index.d.ts +6 -0
- package/dist/modules/oracle/index.d.ts.map +1 -0
- package/dist/modules/oracle/index.js +4 -0
- package/dist/modules/storage/S3Module.d.ts +377 -0
- package/dist/modules/storage/S3Module.d.ts.map +1 -0
- package/dist/modules/storage/S3Module.js +680 -0
- package/dist/modules/storage/StorageModule.d.ts +157 -0
- package/dist/modules/storage/StorageModule.d.ts.map +1 -0
- package/dist/modules/storage/StorageModule.js +302 -0
- package/dist/modules/storage/adapters/AdapterFactory.d.ts +100 -0
- package/dist/modules/storage/adapters/AdapterFactory.d.ts.map +1 -0
- package/dist/modules/storage/adapters/AdapterFactory.js +209 -0
- package/dist/modules/storage/adapters/FilecoinAdapter.d.ts +94 -0
- package/dist/modules/storage/adapters/FilecoinAdapter.d.ts.map +1 -0
- package/dist/modules/storage/adapters/FilecoinAdapter.js +263 -0
- package/dist/modules/storage/adapters/IStorageAdapter.d.ts +287 -0
- package/dist/modules/storage/adapters/IStorageAdapter.d.ts.map +1 -0
- package/dist/modules/storage/adapters/IStorageAdapter.js +81 -0
- package/dist/modules/storage/adapters/MultiTierAdapter.d.ts +187 -0
- package/dist/modules/storage/adapters/MultiTierAdapter.d.ts.map +1 -0
- package/dist/modules/storage/adapters/MultiTierAdapter.js +430 -0
- package/dist/modules/storage/adapters/index.d.ts +12 -0
- package/dist/modules/storage/adapters/index.d.ts.map +1 -0
- package/dist/modules/storage/adapters/index.js +12 -0
- package/dist/modules/storage/index.d.ts +16 -0
- package/dist/modules/storage/index.d.ts.map +1 -0
- package/dist/modules/storage/index.js +15 -0
- package/dist/modules/storage/tiering/AccessAnalyzer.d.ts +227 -0
- package/dist/modules/storage/tiering/AccessAnalyzer.d.ts.map +1 -0
- package/dist/modules/storage/tiering/AccessAnalyzer.js +367 -0
- package/dist/modules/storage/tiering/CostOptimizer.d.ts +248 -0
- package/dist/modules/storage/tiering/CostOptimizer.d.ts.map +1 -0
- package/dist/modules/storage/tiering/CostOptimizer.js +356 -0
- package/dist/modules/storage/tiering/MetadataStore.d.ts +287 -0
- package/dist/modules/storage/tiering/MetadataStore.d.ts.map +1 -0
- package/dist/modules/storage/tiering/MetadataStore.js +535 -0
- package/dist/modules/storage/tiering/TieringEngine.d.ts +237 -0
- package/dist/modules/storage/tiering/TieringEngine.d.ts.map +1 -0
- package/dist/modules/storage/tiering/TieringEngine.js +419 -0
- package/dist/modules/storage/tiering/example.d.ts +8 -0
- package/dist/modules/storage/tiering/example.d.ts.map +1 -0
- package/dist/modules/storage/tiering/example.js +250 -0
- package/dist/modules/storage/tiering/index.d.ts +17 -0
- package/dist/modules/storage/tiering/index.d.ts.map +1 -0
- package/dist/modules/storage/tiering/index.js +13 -0
- package/dist/modules/webhooks/WebhooksModule.d.ts +476 -0
- package/dist/modules/webhooks/WebhooksModule.d.ts.map +1 -0
- package/dist/modules/webhooks/WebhooksModule.js +359 -0
- package/dist/modules/webhooks/index.d.ts +3 -0
- package/dist/modules/webhooks/index.d.ts.map +1 -0
- package/dist/modules/webhooks/index.js +1 -0
- package/dist/modules/zk/ZKModule.d.ts +153 -0
- package/dist/modules/zk/ZKModule.d.ts.map +1 -0
- package/dist/modules/zk/ZKModule.js +262 -0
- package/dist/modules/zk/index.d.ts +7 -0
- package/dist/modules/zk/index.d.ts.map +1 -0
- package/dist/modules/zk/index.js +4 -0
- package/dist/thirdweb/BridgeClient.d.ts +228 -0
- package/dist/thirdweb/BridgeClient.d.ts.map +1 -0
- package/dist/thirdweb/BridgeClient.js +160 -0
- package/dist/thirdweb/EngineClient.d.ts +396 -0
- package/dist/thirdweb/EngineClient.d.ts.map +1 -0
- package/dist/thirdweb/EngineClient.js +386 -0
- package/dist/thirdweb/GatewayClient.d.ts +190 -0
- package/dist/thirdweb/GatewayClient.d.ts.map +1 -0
- package/dist/thirdweb/GatewayClient.js +257 -0
- package/dist/thirdweb/NebulaClient.d.ts +292 -0
- package/dist/thirdweb/NebulaClient.d.ts.map +1 -0
- package/dist/thirdweb/NebulaClient.js +180 -0
- package/dist/thirdweb/StorageClient.d.ts +445 -0
- package/dist/thirdweb/StorageClient.d.ts.map +1 -0
- package/dist/thirdweb/StorageClient.js +405 -0
- package/dist/thirdweb/ThirdwebWrapper.d.ts +236 -0
- package/dist/thirdweb/ThirdwebWrapper.d.ts.map +1 -0
- package/dist/thirdweb/ThirdwebWrapper.js +332 -0
- package/dist/thirdweb/index.d.ts +21 -0
- package/dist/thirdweb/index.d.ts.map +1 -0
- package/dist/thirdweb/index.js +28 -0
- package/dist/thirdweb/varity-chain.d.ts +48 -0
- package/dist/thirdweb/varity-chain.d.ts.map +1 -0
- package/dist/thirdweb/varity-chain.js +64 -0
- package/dist/thirdweb/x402Client.d.ts +319 -0
- package/dist/thirdweb/x402Client.d.ts.map +1 -0
- package/dist/thirdweb/x402Client.js +223 -0
- package/dist/tracking/gasTracker.d.ts +158 -0
- package/dist/tracking/gasTracker.d.ts.map +1 -0
- package/dist/tracking/gasTracker.js +227 -0
- package/dist/tracking/index.d.ts +10 -0
- package/dist/tracking/index.d.ts.map +1 -0
- package/dist/tracking/index.js +8 -0
- package/dist/tracking/types.d.ts +327 -0
- package/dist/tracking/types.d.ts.map +1 -0
- package/dist/tracking/types.js +8 -0
- package/dist/ui/components/ChartWidget.d.ts +36 -0
- package/dist/ui/components/ChartWidget.d.ts.map +1 -0
- package/dist/ui/components/ChartWidget.js +82 -0
- package/dist/ui/components/DashboardLayout.d.ts +41 -0
- package/dist/ui/components/DashboardLayout.d.ts.map +1 -0
- package/dist/ui/components/DashboardLayout.js +102 -0
- package/dist/ui/components/DataTable.d.ts +49 -0
- package/dist/ui/components/DataTable.d.ts.map +1 -0
- package/dist/ui/components/DataTable.js +96 -0
- package/dist/ui/components/EntityForm.d.ts +60 -0
- package/dist/ui/components/EntityForm.d.ts.map +1 -0
- package/dist/ui/components/EntityForm.js +182 -0
- package/dist/ui/components/KPICard.d.ts +29 -0
- package/dist/ui/components/KPICard.d.ts.map +1 -0
- package/dist/ui/components/KPICard.js +61 -0
- package/dist/ui/components/Modal.d.ts +34 -0
- package/dist/ui/components/Modal.d.ts.map +1 -0
- package/dist/ui/components/Modal.js +30 -0
- package/dist/ui/components/index.d.ts +18 -0
- package/dist/ui/components/index.d.ts.map +1 -0
- package/dist/ui/components/index.js +11 -0
- package/dist/validation/template-validator.d.ts +25 -0
- package/dist/validation/template-validator.d.ts.map +1 -0
- package/dist/validation/template-validator.js +305 -0
- package/package.json +102 -0
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ExportModule - Universal data export and report generation
|
|
3
|
+
*
|
|
4
|
+
* Provides flexible export capabilities for any data source with multiple
|
|
5
|
+
* format options. Works across all templates by reading from template-specific
|
|
6
|
+
* data sources.
|
|
7
|
+
*/
|
|
8
|
+
export class ExportModule {
|
|
9
|
+
constructor(sdk) {
|
|
10
|
+
this.sdk = sdk;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Export data to CSV format
|
|
14
|
+
*
|
|
15
|
+
* Universal method - exports any data source to CSV.
|
|
16
|
+
* Template configuration determines available data sources.
|
|
17
|
+
*
|
|
18
|
+
* @example ISO Dashboard
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const csv = await sdk.export.toCSV({
|
|
21
|
+
* dataSource: 'merchants',
|
|
22
|
+
* startDate: '2025-01-01',
|
|
23
|
+
* endDate: '2025-01-31',
|
|
24
|
+
* columns: ['merchantId', 'businessName', 'status', 'totalVolume'],
|
|
25
|
+
* delimiter: ','
|
|
26
|
+
* })
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example Healthcare Dashboard
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const csv = await sdk.export.toCSV({
|
|
32
|
+
* dataSource: 'patients',
|
|
33
|
+
* filters: { status: 'active' },
|
|
34
|
+
* columns: ['patientId', 'name', 'lastVisit']
|
|
35
|
+
* })
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
async toCSV(options) {
|
|
39
|
+
const apiEndpoint = this.sdk.getAPIEndpoint();
|
|
40
|
+
const apiKey = this.sdk.getAPIKey();
|
|
41
|
+
const response = await fetch(`${apiEndpoint}/api/v1/export/csv`, {
|
|
42
|
+
method: 'POST',
|
|
43
|
+
headers: {
|
|
44
|
+
'Content-Type': 'application/json',
|
|
45
|
+
...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
|
|
46
|
+
},
|
|
47
|
+
body: JSON.stringify({ ...options, format: 'csv' })
|
|
48
|
+
});
|
|
49
|
+
if (!response.ok) {
|
|
50
|
+
throw new Error(`Failed to export to CSV: ${response.statusText}`);
|
|
51
|
+
}
|
|
52
|
+
return await response.json();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Export data to JSON format
|
|
56
|
+
*
|
|
57
|
+
* Universal method - exports any data source to JSON.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* const json = await sdk.export.toJSON({
|
|
62
|
+
* dataSource: 'transactions',
|
|
63
|
+
* startDate: '2025-01-01',
|
|
64
|
+
* endDate: '2025-01-31',
|
|
65
|
+
* pretty: true,
|
|
66
|
+
* indent: 2
|
|
67
|
+
* })
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
async toJSON(options) {
|
|
71
|
+
const apiEndpoint = this.sdk.getAPIEndpoint();
|
|
72
|
+
const apiKey = this.sdk.getAPIKey();
|
|
73
|
+
const response = await fetch(`${apiEndpoint}/api/v1/export/json`, {
|
|
74
|
+
method: 'POST',
|
|
75
|
+
headers: {
|
|
76
|
+
'Content-Type': 'application/json',
|
|
77
|
+
...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
|
|
78
|
+
},
|
|
79
|
+
body: JSON.stringify({ ...options, format: 'json' })
|
|
80
|
+
});
|
|
81
|
+
if (!response.ok) {
|
|
82
|
+
throw new Error(`Failed to export to JSON: ${response.statusText}`);
|
|
83
|
+
}
|
|
84
|
+
return await response.json();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Export data to Excel (XLSX) format
|
|
88
|
+
*
|
|
89
|
+
* Universal method - exports any data source to Excel with formatting.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const xlsx = await sdk.export.toExcel({
|
|
94
|
+
* dataSource: 'merchants',
|
|
95
|
+
* columns: ['merchantId', 'businessName', 'totalVolume'],
|
|
96
|
+
* fileName: 'merchants_report_2025-01.xlsx'
|
|
97
|
+
* })
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
async toExcel(options) {
|
|
101
|
+
const apiEndpoint = this.sdk.getAPIEndpoint();
|
|
102
|
+
const apiKey = this.sdk.getAPIKey();
|
|
103
|
+
const response = await fetch(`${apiEndpoint}/api/v1/export/xlsx`, {
|
|
104
|
+
method: 'POST',
|
|
105
|
+
headers: {
|
|
106
|
+
'Content-Type': 'application/json',
|
|
107
|
+
...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
|
|
108
|
+
},
|
|
109
|
+
body: JSON.stringify({ ...options, format: 'xlsx' })
|
|
110
|
+
});
|
|
111
|
+
if (!response.ok) {
|
|
112
|
+
throw new Error(`Failed to export to Excel: ${response.statusText}`);
|
|
113
|
+
}
|
|
114
|
+
return await response.json();
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Generate PDF report
|
|
118
|
+
*
|
|
119
|
+
* Universal method - generates formatted PDF reports using templates.
|
|
120
|
+
* Template configuration provides report templates.
|
|
121
|
+
*
|
|
122
|
+
* @example ISO Dashboard
|
|
123
|
+
* ```typescript
|
|
124
|
+
* const report = await sdk.export.generateReport({
|
|
125
|
+
* template: 'monthly_summary',
|
|
126
|
+
* format: 'pdf',
|
|
127
|
+
* period: '2025-01',
|
|
128
|
+
* includeCharts: true
|
|
129
|
+
* })
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* @example Healthcare Dashboard
|
|
133
|
+
* ```typescript
|
|
134
|
+
* const report = await sdk.export.generateReport({
|
|
135
|
+
* template: 'patient_outcomes_report',
|
|
136
|
+
* format: 'pdf',
|
|
137
|
+
* period: 'Q1 2025',
|
|
138
|
+
* data: { departmentId: 'cardiology' }
|
|
139
|
+
* })
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
async generateReport(options) {
|
|
143
|
+
const apiEndpoint = this.sdk.getAPIEndpoint();
|
|
144
|
+
const apiKey = this.sdk.getAPIKey();
|
|
145
|
+
const response = await fetch(`${apiEndpoint}/api/v1/export/report`, {
|
|
146
|
+
method: 'POST',
|
|
147
|
+
headers: {
|
|
148
|
+
'Content-Type': 'application/json',
|
|
149
|
+
...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
|
|
150
|
+
},
|
|
151
|
+
body: JSON.stringify(options)
|
|
152
|
+
});
|
|
153
|
+
if (!response.ok) {
|
|
154
|
+
throw new Error(`Failed to generate report: ${response.statusText}`);
|
|
155
|
+
}
|
|
156
|
+
return await response.json();
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Download previously exported file
|
|
160
|
+
*
|
|
161
|
+
* Universal method - downloads an export file by ID.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```typescript
|
|
165
|
+
* const file = await sdk.export.downloadFile({
|
|
166
|
+
* fileId: 'export-123',
|
|
167
|
+
* fileName: 'custom_name.csv'
|
|
168
|
+
* })
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
async downloadFile(options) {
|
|
172
|
+
const apiEndpoint = this.sdk.getAPIEndpoint();
|
|
173
|
+
const apiKey = this.sdk.getAPIKey();
|
|
174
|
+
const response = await fetch(`${apiEndpoint}/api/v1/export/download/${options.fileId}`, {
|
|
175
|
+
method: 'GET',
|
|
176
|
+
headers: {
|
|
177
|
+
...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
if (!response.ok) {
|
|
181
|
+
throw new Error(`Failed to download file: ${response.statusText}`);
|
|
182
|
+
}
|
|
183
|
+
return await response.blob();
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Get export file URL for direct download
|
|
187
|
+
*
|
|
188
|
+
* Universal method - returns a downloadable URL for an export.
|
|
189
|
+
*/
|
|
190
|
+
async getDownloadUrl(fileId) {
|
|
191
|
+
const apiEndpoint = this.sdk.getAPIEndpoint();
|
|
192
|
+
const apiKey = this.sdk.getAPIKey();
|
|
193
|
+
const response = await fetch(`${apiEndpoint}/api/v1/export/download-url/${fileId}`, {
|
|
194
|
+
method: 'GET',
|
|
195
|
+
headers: {
|
|
196
|
+
'Content-Type': 'application/json',
|
|
197
|
+
...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
if (!response.ok) {
|
|
201
|
+
throw new Error(`Failed to get download URL: ${response.statusText}`);
|
|
202
|
+
}
|
|
203
|
+
return await response.json();
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Export multiple data sources in bulk (creates ZIP file)
|
|
207
|
+
*
|
|
208
|
+
* Universal method - exports multiple data sources and packages them in ZIP.
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```typescript
|
|
212
|
+
* const bulk = await sdk.export.bulkExport({
|
|
213
|
+
* exports: [
|
|
214
|
+
* { dataSource: 'merchants', format: 'csv' },
|
|
215
|
+
* { dataSource: 'transactions', format: 'csv' },
|
|
216
|
+
* { dataSource: 'residuals', format: 'xlsx' }
|
|
217
|
+
* ],
|
|
218
|
+
* zipFileName: 'iso_data_export_2025-01.zip'
|
|
219
|
+
* })
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
async bulkExport(options) {
|
|
223
|
+
const apiEndpoint = this.sdk.getAPIEndpoint();
|
|
224
|
+
const apiKey = this.sdk.getAPIKey();
|
|
225
|
+
const response = await fetch(`${apiEndpoint}/api/v1/export/bulk`, {
|
|
226
|
+
method: 'POST',
|
|
227
|
+
headers: {
|
|
228
|
+
'Content-Type': 'application/json',
|
|
229
|
+
...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
|
|
230
|
+
},
|
|
231
|
+
body: JSON.stringify(options)
|
|
232
|
+
});
|
|
233
|
+
if (!response.ok) {
|
|
234
|
+
throw new Error(`Failed to perform bulk export: ${response.statusText}`);
|
|
235
|
+
}
|
|
236
|
+
return await response.json();
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* List available data sources for export
|
|
240
|
+
*
|
|
241
|
+
* Universal method - returns available data sources based on template.
|
|
242
|
+
*/
|
|
243
|
+
async listDataSources() {
|
|
244
|
+
const apiEndpoint = this.sdk.getAPIEndpoint();
|
|
245
|
+
const apiKey = this.sdk.getAPIKey();
|
|
246
|
+
const response = await fetch(`${apiEndpoint}/api/v1/export/data-sources`, {
|
|
247
|
+
method: 'GET',
|
|
248
|
+
headers: {
|
|
249
|
+
'Content-Type': 'application/json',
|
|
250
|
+
...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
if (!response.ok) {
|
|
254
|
+
throw new Error(`Failed to list data sources: ${response.statusText}`);
|
|
255
|
+
}
|
|
256
|
+
return await response.json();
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Create reusable export template
|
|
260
|
+
*
|
|
261
|
+
* Universal method - creates a saved export configuration.
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* ```typescript
|
|
265
|
+
* const template = await sdk.export.createTemplate({
|
|
266
|
+
* name: 'active_merchants_monthly',
|
|
267
|
+
* description: 'Export active merchants for monthly review',
|
|
268
|
+
* dataSource: 'merchants',
|
|
269
|
+
* columns: ['merchantId', 'businessName', 'status', 'totalVolume'],
|
|
270
|
+
* defaultFilters: { status: 'ACTIVE' },
|
|
271
|
+
* format: 'csv'
|
|
272
|
+
* })
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
async createTemplate(template) {
|
|
276
|
+
const apiEndpoint = this.sdk.getAPIEndpoint();
|
|
277
|
+
const apiKey = this.sdk.getAPIKey();
|
|
278
|
+
const response = await fetch(`${apiEndpoint}/api/v1/export/templates`, {
|
|
279
|
+
method: 'POST',
|
|
280
|
+
headers: {
|
|
281
|
+
'Content-Type': 'application/json',
|
|
282
|
+
...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
|
|
283
|
+
},
|
|
284
|
+
body: JSON.stringify(template)
|
|
285
|
+
});
|
|
286
|
+
if (!response.ok) {
|
|
287
|
+
throw new Error(`Failed to create export template: ${response.statusText}`);
|
|
288
|
+
}
|
|
289
|
+
return await response.json();
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Export using saved template
|
|
293
|
+
*
|
|
294
|
+
* Universal method - runs an export using a saved template.
|
|
295
|
+
*/
|
|
296
|
+
async exportFromTemplate(templateName, overrides) {
|
|
297
|
+
const apiEndpoint = this.sdk.getAPIEndpoint();
|
|
298
|
+
const apiKey = this.sdk.getAPIKey();
|
|
299
|
+
const response = await fetch(`${apiEndpoint}/api/v1/export/templates/${templateName}/execute`, {
|
|
300
|
+
method: 'POST',
|
|
301
|
+
headers: {
|
|
302
|
+
'Content-Type': 'application/json',
|
|
303
|
+
...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
|
|
304
|
+
},
|
|
305
|
+
body: JSON.stringify(overrides || {})
|
|
306
|
+
});
|
|
307
|
+
if (!response.ok) {
|
|
308
|
+
throw new Error(`Failed to export from template: ${response.statusText}`);
|
|
309
|
+
}
|
|
310
|
+
return await response.json();
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* List export templates
|
|
314
|
+
*
|
|
315
|
+
* Universal method - lists all saved export templates.
|
|
316
|
+
*/
|
|
317
|
+
async listTemplates() {
|
|
318
|
+
const apiEndpoint = this.sdk.getAPIEndpoint();
|
|
319
|
+
const apiKey = this.sdk.getAPIKey();
|
|
320
|
+
const response = await fetch(`${apiEndpoint}/api/v1/export/templates`, {
|
|
321
|
+
method: 'GET',
|
|
322
|
+
headers: {
|
|
323
|
+
'Content-Type': 'application/json',
|
|
324
|
+
...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
if (!response.ok) {
|
|
328
|
+
throw new Error(`Failed to list export templates: ${response.statusText}`);
|
|
329
|
+
}
|
|
330
|
+
return await response.json();
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Schedule recurring export
|
|
334
|
+
*
|
|
335
|
+
* Universal method - schedules automatic exports.
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* ```typescript
|
|
339
|
+
* const scheduled = await sdk.export.scheduleExport({
|
|
340
|
+
* dataSource: 'transactions',
|
|
341
|
+
* format: 'csv',
|
|
342
|
+
* schedule: {
|
|
343
|
+
* frequency: 'monthly',
|
|
344
|
+
* dayOfMonth: 1,
|
|
345
|
+
* time: '09:00'
|
|
346
|
+
* },
|
|
347
|
+
* recipients: ['finance@example.com'],
|
|
348
|
+
* enabled: true
|
|
349
|
+
* })
|
|
350
|
+
* ```
|
|
351
|
+
*/
|
|
352
|
+
async scheduleExport(options) {
|
|
353
|
+
const apiEndpoint = this.sdk.getAPIEndpoint();
|
|
354
|
+
const apiKey = this.sdk.getAPIKey();
|
|
355
|
+
const response = await fetch(`${apiEndpoint}/api/v1/export/scheduled`, {
|
|
356
|
+
method: 'POST',
|
|
357
|
+
headers: {
|
|
358
|
+
'Content-Type': 'application/json',
|
|
359
|
+
...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
|
|
360
|
+
},
|
|
361
|
+
body: JSON.stringify(options)
|
|
362
|
+
});
|
|
363
|
+
if (!response.ok) {
|
|
364
|
+
throw new Error(`Failed to schedule export: ${response.statusText}`);
|
|
365
|
+
}
|
|
366
|
+
return await response.json();
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* List scheduled exports
|
|
370
|
+
*
|
|
371
|
+
* Universal method - lists all scheduled exports.
|
|
372
|
+
*/
|
|
373
|
+
async listScheduledExports() {
|
|
374
|
+
const apiEndpoint = this.sdk.getAPIEndpoint();
|
|
375
|
+
const apiKey = this.sdk.getAPIKey();
|
|
376
|
+
const response = await fetch(`${apiEndpoint}/api/v1/export/scheduled`, {
|
|
377
|
+
method: 'GET',
|
|
378
|
+
headers: {
|
|
379
|
+
'Content-Type': 'application/json',
|
|
380
|
+
...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
if (!response.ok) {
|
|
384
|
+
throw new Error(`Failed to list scheduled exports: ${response.statusText}`);
|
|
385
|
+
}
|
|
386
|
+
return await response.json();
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Cancel scheduled export
|
|
390
|
+
*
|
|
391
|
+
* Universal method - cancels a scheduled export.
|
|
392
|
+
*/
|
|
393
|
+
async cancelScheduledExport(exportId) {
|
|
394
|
+
const apiEndpoint = this.sdk.getAPIEndpoint();
|
|
395
|
+
const apiKey = this.sdk.getAPIKey();
|
|
396
|
+
const response = await fetch(`${apiEndpoint}/api/v1/export/scheduled/${exportId}`, {
|
|
397
|
+
method: 'DELETE',
|
|
398
|
+
headers: {
|
|
399
|
+
'Content-Type': 'application/json',
|
|
400
|
+
...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
if (!response.ok) {
|
|
404
|
+
throw new Error(`Failed to cancel scheduled export: ${response.statusText}`);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Get export history
|
|
409
|
+
*
|
|
410
|
+
* Universal method - retrieves past export records.
|
|
411
|
+
*/
|
|
412
|
+
async getHistory(options = {}) {
|
|
413
|
+
const apiEndpoint = this.sdk.getAPIEndpoint();
|
|
414
|
+
const apiKey = this.sdk.getAPIKey();
|
|
415
|
+
const queryParams = new URLSearchParams();
|
|
416
|
+
if (options.limit)
|
|
417
|
+
queryParams.append('limit', options.limit.toString());
|
|
418
|
+
if (options.offset)
|
|
419
|
+
queryParams.append('offset', options.offset.toString());
|
|
420
|
+
const response = await fetch(`${apiEndpoint}/api/v1/export/history?${queryParams}`, {
|
|
421
|
+
method: 'GET',
|
|
422
|
+
headers: {
|
|
423
|
+
'Content-Type': 'application/json',
|
|
424
|
+
...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
if (!response.ok) {
|
|
428
|
+
throw new Error(`Failed to get export history: ${response.statusText}`);
|
|
429
|
+
}
|
|
430
|
+
return await response.json();
|
|
431
|
+
}
|
|
432
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { ExportModule } from './ExportModule';
|
|
2
|
+
export type { ExportFormat, ReportFormat, ExportOptions, ExportResult, CSVExportOptions, JSONExportOptions, ReportOptions, ReportResult, DownloadOptions, BulkExportOptions, BulkExportResult, ExportTemplate, ScheduledExportOptions, ScheduledExport } from './ExportModule';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/export/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,eAAe,EAChB,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ExportModule } from './ExportModule';
|