@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,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* varity validate - Template validation
|
|
3
|
+
*
|
|
4
|
+
* Validates template configuration and structure
|
|
5
|
+
*/
|
|
6
|
+
import { Command } from 'commander';
|
|
7
|
+
import * as path from 'path';
|
|
8
|
+
import { Logger } from '../utils/logger';
|
|
9
|
+
import { validateTemplate } from '../../validation/template-validator';
|
|
10
|
+
export const validateCommand = new Command('validate')
|
|
11
|
+
.description('Validate template configuration and structure')
|
|
12
|
+
.option('-t, --template <path>', 'Path to template JSON file', './templates/template.json')
|
|
13
|
+
.option('--strict', 'Enable strict validation mode', false)
|
|
14
|
+
.action(async (options) => {
|
|
15
|
+
try {
|
|
16
|
+
Logger.header('🔍 Validate Template Configuration');
|
|
17
|
+
const templatePath = path.resolve(options.template);
|
|
18
|
+
Logger.info(`Validating: ${templatePath}`);
|
|
19
|
+
Logger.newline();
|
|
20
|
+
// Validate template
|
|
21
|
+
const result = await validateTemplate({
|
|
22
|
+
templatePath,
|
|
23
|
+
strict: options.strict
|
|
24
|
+
});
|
|
25
|
+
// Display results
|
|
26
|
+
if (result.valid) {
|
|
27
|
+
Logger.success('✓ Template validation passed!');
|
|
28
|
+
Logger.newline();
|
|
29
|
+
Logger.info('Summary:');
|
|
30
|
+
Logger.code(` Entities: ${result.summary.entities}`);
|
|
31
|
+
Logger.code(` Contracts: ${result.summary.contracts}`);
|
|
32
|
+
Logger.code(` Events: ${result.summary.events}`);
|
|
33
|
+
Logger.code(` Metrics: ${result.summary.metrics}`);
|
|
34
|
+
Logger.newline();
|
|
35
|
+
if (result.warnings.length > 0) {
|
|
36
|
+
Logger.warn('Warnings:');
|
|
37
|
+
result.warnings.forEach(warning => {
|
|
38
|
+
Logger.warn(` ${warning}`);
|
|
39
|
+
});
|
|
40
|
+
Logger.newline();
|
|
41
|
+
}
|
|
42
|
+
Logger.info('Template is ready for code generation!');
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
Logger.error('✗ Template validation failed');
|
|
46
|
+
Logger.newline();
|
|
47
|
+
if (result.errors.length > 0) {
|
|
48
|
+
Logger.error('Errors:');
|
|
49
|
+
result.errors.forEach(error => {
|
|
50
|
+
Logger.error(` ${error}`);
|
|
51
|
+
});
|
|
52
|
+
Logger.newline();
|
|
53
|
+
}
|
|
54
|
+
if (result.warnings.length > 0) {
|
|
55
|
+
Logger.warn('Warnings:');
|
|
56
|
+
result.warnings.forEach(warning => {
|
|
57
|
+
Logger.warn(` ${warning}`);
|
|
58
|
+
});
|
|
59
|
+
Logger.newline();
|
|
60
|
+
}
|
|
61
|
+
Logger.info('Fix the errors above and try again.');
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
Logger.error(`Validation failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA;;;;GAIG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Varity SDK CLI
|
|
4
|
+
*
|
|
5
|
+
* Command-line tools for rapid template development
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import { initCommand } from './commands/init';
|
|
10
|
+
import { cloneCommand } from './commands/clone';
|
|
11
|
+
import { generateCommand } from './commands/generate';
|
|
12
|
+
import { devCommand } from './commands/dev';
|
|
13
|
+
import { validateCommand } from './commands/validate';
|
|
14
|
+
const program = new Command();
|
|
15
|
+
// CLI metadata
|
|
16
|
+
program
|
|
17
|
+
.name('varity')
|
|
18
|
+
.description('Varity SDK - Rapid development tools for blockchain business templates')
|
|
19
|
+
.version('2.0.0-beta.1');
|
|
20
|
+
// Welcome message
|
|
21
|
+
console.log(chalk.cyan.bold('\n🚀 Varity SDK CLI v2.0.0\n'));
|
|
22
|
+
// Register commands
|
|
23
|
+
program.addCommand(initCommand);
|
|
24
|
+
program.addCommand(cloneCommand);
|
|
25
|
+
program.addCommand(generateCommand);
|
|
26
|
+
program.addCommand(devCommand);
|
|
27
|
+
program.addCommand(validateCommand);
|
|
28
|
+
// Parse CLI arguments
|
|
29
|
+
program.parse(process.argv);
|
|
30
|
+
// Show help if no command provided
|
|
31
|
+
if (!process.argv.slice(2).length) {
|
|
32
|
+
program.outputHelp();
|
|
33
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Logger Utilities
|
|
3
|
+
*
|
|
4
|
+
* Colored console output for CLI commands
|
|
5
|
+
*/
|
|
6
|
+
export declare class Logger {
|
|
7
|
+
static success(message: string): void;
|
|
8
|
+
static error(message: string): void;
|
|
9
|
+
static warn(message: string): void;
|
|
10
|
+
static info(message: string): void;
|
|
11
|
+
static step(step: number, total: number, message: string): void;
|
|
12
|
+
static header(message: string): void;
|
|
13
|
+
static subheader(message: string): void;
|
|
14
|
+
static code(code: string): void;
|
|
15
|
+
static newline(): void;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,qBAAa,MAAM;IACjB,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIrC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAInC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIlC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIlC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAI/D,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIpC,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIvC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI/B,MAAM,CAAC,OAAO,IAAI,IAAI;CAGvB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Logger Utilities
|
|
3
|
+
*
|
|
4
|
+
* Colored console output for CLI commands
|
|
5
|
+
*/
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
export class Logger {
|
|
8
|
+
static success(message) {
|
|
9
|
+
console.log(chalk.green('✓'), message);
|
|
10
|
+
}
|
|
11
|
+
static error(message) {
|
|
12
|
+
console.log(chalk.red('✗'), message);
|
|
13
|
+
}
|
|
14
|
+
static warn(message) {
|
|
15
|
+
console.log(chalk.yellow('⚠'), message);
|
|
16
|
+
}
|
|
17
|
+
static info(message) {
|
|
18
|
+
console.log(chalk.blue('ℹ'), message);
|
|
19
|
+
}
|
|
20
|
+
static step(step, total, message) {
|
|
21
|
+
console.log(chalk.cyan(`[${step}/${total}]`), message);
|
|
22
|
+
}
|
|
23
|
+
static header(message) {
|
|
24
|
+
console.log('\n' + chalk.bold.cyan(message) + '\n');
|
|
25
|
+
}
|
|
26
|
+
static subheader(message) {
|
|
27
|
+
console.log(chalk.bold(message));
|
|
28
|
+
}
|
|
29
|
+
static code(code) {
|
|
30
|
+
console.log(chalk.gray(code));
|
|
31
|
+
}
|
|
32
|
+
static newline() {
|
|
33
|
+
console.log('');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Prompt Utilities
|
|
3
|
+
*
|
|
4
|
+
* Interactive prompt helpers for CLI commands
|
|
5
|
+
*/
|
|
6
|
+
export interface InitPromptAnswers {
|
|
7
|
+
templateName: string;
|
|
8
|
+
description: string;
|
|
9
|
+
network: string;
|
|
10
|
+
entities: string;
|
|
11
|
+
contracts: string;
|
|
12
|
+
}
|
|
13
|
+
export interface GenerateContractsPromptAnswers {
|
|
14
|
+
templatePath: string;
|
|
15
|
+
outputPath: string;
|
|
16
|
+
includeTests: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function promptInit(): Promise<InitPromptAnswers>;
|
|
19
|
+
export declare function promptGenerateContracts(): Promise<GenerateContractsPromptAnswers>;
|
|
20
|
+
export declare function confirmAction(message: string, defaultValue?: boolean): Promise<boolean>;
|
|
21
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/prompts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,8BAA8B;IAC7C,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,OAAO,CAAA;CACtB;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAyD7D;AAED,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,8BAA8B,CAAC,CA2BvF;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,GAAE,OAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAUpG"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Prompt Utilities
|
|
3
|
+
*
|
|
4
|
+
* Interactive prompt helpers for CLI commands
|
|
5
|
+
*/
|
|
6
|
+
import inquirer from 'inquirer';
|
|
7
|
+
export async function promptInit() {
|
|
8
|
+
return await inquirer.prompt([
|
|
9
|
+
{
|
|
10
|
+
type: 'input',
|
|
11
|
+
name: 'templateName',
|
|
12
|
+
message: 'Template name (e.g., healthcare, finance):',
|
|
13
|
+
validate: (input) => {
|
|
14
|
+
if (!input || input.trim().length === 0) {
|
|
15
|
+
return 'Template name is required';
|
|
16
|
+
}
|
|
17
|
+
if (!/^[a-z][a-z0-9-]*$/.test(input)) {
|
|
18
|
+
return 'Template name must be lowercase letters, numbers, and hyphens only';
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: 'input',
|
|
25
|
+
name: 'description',
|
|
26
|
+
message: 'Template description:',
|
|
27
|
+
default: 'Business template powered by Varity'
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: 'list',
|
|
31
|
+
name: 'network',
|
|
32
|
+
message: 'Default network:',
|
|
33
|
+
choices: [
|
|
34
|
+
{ name: 'Arbitrum Sepolia (Testnet)', value: 'arbitrum-sepolia' },
|
|
35
|
+
{ name: 'Arbitrum L3 Testnet', value: 'arbitrum-l3-testnet' },
|
|
36
|
+
{ name: 'Arbitrum L3 Mainnet', value: 'arbitrum-l3-mainnet' }
|
|
37
|
+
],
|
|
38
|
+
default: 'arbitrum-sepolia'
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'input',
|
|
42
|
+
name: 'entities',
|
|
43
|
+
message: 'Business entities (comma-separated, e.g., patient,appointment):',
|
|
44
|
+
validate: (input) => {
|
|
45
|
+
if (!input || input.trim().length === 0) {
|
|
46
|
+
return 'At least one entity is required';
|
|
47
|
+
}
|
|
48
|
+
const entities = input.split(',').map(e => e.trim());
|
|
49
|
+
for (const entity of entities) {
|
|
50
|
+
if (!/^[a-z][a-z0-9_]*$/.test(entity)) {
|
|
51
|
+
return `Invalid entity name: ${entity}. Use lowercase letters, numbers, and underscores only`;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: 'input',
|
|
59
|
+
name: 'contracts',
|
|
60
|
+
message: 'Contract names (comma-separated, leave empty for auto-generation):',
|
|
61
|
+
default: ''
|
|
62
|
+
}
|
|
63
|
+
]);
|
|
64
|
+
}
|
|
65
|
+
export async function promptGenerateContracts() {
|
|
66
|
+
return await inquirer.prompt([
|
|
67
|
+
{
|
|
68
|
+
type: 'input',
|
|
69
|
+
name: 'templatePath',
|
|
70
|
+
message: 'Path to template JSON file:',
|
|
71
|
+
default: './templates/template.json',
|
|
72
|
+
validate: (input) => {
|
|
73
|
+
if (!input || input.trim().length === 0) {
|
|
74
|
+
return 'Template path is required';
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
type: 'input',
|
|
81
|
+
name: 'outputPath',
|
|
82
|
+
message: 'Output directory for contracts:',
|
|
83
|
+
default: './contracts'
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
type: 'confirm',
|
|
87
|
+
name: 'includeTests',
|
|
88
|
+
message: 'Generate test files?',
|
|
89
|
+
default: true
|
|
90
|
+
}
|
|
91
|
+
]);
|
|
92
|
+
}
|
|
93
|
+
export async function confirmAction(message, defaultValue = false) {
|
|
94
|
+
const { confirmed } = await inquirer.prompt([
|
|
95
|
+
{
|
|
96
|
+
type: 'confirm',
|
|
97
|
+
name: 'confirmed',
|
|
98
|
+
message,
|
|
99
|
+
default: defaultValue
|
|
100
|
+
}
|
|
101
|
+
]);
|
|
102
|
+
return confirmed;
|
|
103
|
+
}
|