@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,375 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates comprehensive test suites for smart contracts
|
|
5
|
+
*/
|
|
6
|
+
import * as fs from 'fs';
|
|
7
|
+
import * as path from 'path';
|
|
8
|
+
/**
|
|
9
|
+
* Generate test suites for contracts
|
|
10
|
+
*/
|
|
11
|
+
export async function generateTests(options) {
|
|
12
|
+
const result = {
|
|
13
|
+
tests: [],
|
|
14
|
+
success: false,
|
|
15
|
+
errors: []
|
|
16
|
+
};
|
|
17
|
+
try {
|
|
18
|
+
// Load template configuration
|
|
19
|
+
const templatePath = path.resolve(options.templatePath);
|
|
20
|
+
if (!fs.existsSync(templatePath)) {
|
|
21
|
+
throw new Error(`Template file not found: ${templatePath}`);
|
|
22
|
+
}
|
|
23
|
+
const templateContent = fs.readFileSync(templatePath, 'utf-8');
|
|
24
|
+
const template = JSON.parse(templateContent);
|
|
25
|
+
// Create output directory
|
|
26
|
+
const outputPath = path.resolve(options.outputPath);
|
|
27
|
+
if (!fs.existsSync(outputPath)) {
|
|
28
|
+
fs.mkdirSync(outputPath, { recursive: true });
|
|
29
|
+
}
|
|
30
|
+
// Generate tests for each entity
|
|
31
|
+
for (const entity of template.entities) {
|
|
32
|
+
try {
|
|
33
|
+
const contractName = getContractNameForEntity(entity);
|
|
34
|
+
const testContent = generateTestSuite(entity, template, contractName);
|
|
35
|
+
const testFile = path.join(outputPath, `${contractName}.test.ts`);
|
|
36
|
+
fs.writeFileSync(testFile, testContent);
|
|
37
|
+
result.tests.push(testFile);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
result.errors.push(`Failed to generate test for entity ${entity.name}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// Generate integration test suite
|
|
44
|
+
const integrationTest = generateIntegrationTestSuite(template);
|
|
45
|
+
const integrationTestFile = path.join(outputPath, 'integration.test.ts');
|
|
46
|
+
fs.writeFileSync(integrationTestFile, integrationTest);
|
|
47
|
+
result.tests.push(integrationTestFile);
|
|
48
|
+
result.success = result.errors.length === 0;
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
result.errors.push(`Failed to generate tests: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Generate test suite for entity contract
|
|
57
|
+
*/
|
|
58
|
+
function generateTestSuite(entity, template, contractName) {
|
|
59
|
+
const entityDisplayName = entity.displayName || capitalize(entity.name);
|
|
60
|
+
const entityNameLower = entity.name.toLowerCase();
|
|
61
|
+
// Find required fields for creation
|
|
62
|
+
const requiredFields = entity.fields.filter(f => f.required && !['createdAt', 'isActive'].includes(f.name));
|
|
63
|
+
// Generate sample test data
|
|
64
|
+
const testData = requiredFields.map(field => {
|
|
65
|
+
return `const test${capitalize(field.name)} = ${getTestValue(field.type)}`;
|
|
66
|
+
}).join('\n ');
|
|
67
|
+
const createParams = requiredFields.map(field => `test${capitalize(field.name)}`).join(', ');
|
|
68
|
+
return `import { expect } from "chai"
|
|
69
|
+
import { ethers } from "hardhat"
|
|
70
|
+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers"
|
|
71
|
+
import type { ${contractName} } from "../typechain-types"
|
|
72
|
+
|
|
73
|
+
describe("${contractName}", function () {
|
|
74
|
+
/**
|
|
75
|
+
* Deployment fixture
|
|
76
|
+
*/
|
|
77
|
+
async function deploy${contractName}Fixture() {
|
|
78
|
+
const [owner, manager, user, other] = await ethers.getSigners()
|
|
79
|
+
|
|
80
|
+
const Contract = await ethers.getContractFactory("${contractName}")
|
|
81
|
+
const contract = await Contract.deploy() as ${contractName}
|
|
82
|
+
|
|
83
|
+
// Grant manager role
|
|
84
|
+
const MANAGER_ROLE = await contract.MANAGER_ROLE()
|
|
85
|
+
await contract.grantRole(MANAGER_ROLE, manager.address)
|
|
86
|
+
|
|
87
|
+
return { contract, owner, manager, user, other, MANAGER_ROLE }
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
describe("Deployment", function () {
|
|
91
|
+
it("Should deploy successfully", async function () {
|
|
92
|
+
const { contract, owner } = await loadFixture(deploy${contractName}Fixture)
|
|
93
|
+
|
|
94
|
+
expect(await contract.hasRole(
|
|
95
|
+
await contract.DEFAULT_ADMIN_ROLE(),
|
|
96
|
+
owner.address
|
|
97
|
+
)).to.be.true
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it("Should grant admin role to deployer", async function () {
|
|
101
|
+
const { contract, owner } = await loadFixture(deploy${contractName}Fixture)
|
|
102
|
+
|
|
103
|
+
const ADMIN_ROLE = await contract.ADMIN_ROLE()
|
|
104
|
+
expect(await contract.hasRole(ADMIN_ROLE, owner.address)).to.be.true
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
it("Should grant manager role correctly", async function () {
|
|
108
|
+
const { contract, manager, MANAGER_ROLE } = await loadFixture(deploy${contractName}Fixture)
|
|
109
|
+
|
|
110
|
+
expect(await contract.hasRole(MANAGER_ROLE, manager.address)).to.be.true
|
|
111
|
+
})
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
describe("Create ${entityDisplayName}", function () {
|
|
115
|
+
it("Should create new ${entityNameLower}", async function () {
|
|
116
|
+
const { contract, manager } = await loadFixture(deploy${contractName}Fixture)
|
|
117
|
+
|
|
118
|
+
${testData}
|
|
119
|
+
|
|
120
|
+
const tx = await contract.connect(manager).create${entityDisplayName}(
|
|
121
|
+
${createParams}
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
await expect(tx).to.emit(contract, "${entityDisplayName}Created")
|
|
125
|
+
|
|
126
|
+
// Verify counter incremented
|
|
127
|
+
expect(await contract.get${entityDisplayName}Count()).to.equal(1)
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
it("Should fail if not manager", async function () {
|
|
131
|
+
const { contract, user } = await loadFixture(deploy${contractName}Fixture)
|
|
132
|
+
|
|
133
|
+
${testData}
|
|
134
|
+
|
|
135
|
+
await expect(
|
|
136
|
+
contract.connect(user).create${entityDisplayName}(${createParams})
|
|
137
|
+
).to.be.reverted
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
it("Should assign correct values to ${entityNameLower}", async function () {
|
|
141
|
+
const { contract, manager } = await loadFixture(deploy${contractName}Fixture)
|
|
142
|
+
|
|
143
|
+
${testData}
|
|
144
|
+
|
|
145
|
+
const tx = await contract.connect(manager).create${entityDisplayName}(
|
|
146
|
+
${createParams}
|
|
147
|
+
)
|
|
148
|
+
await tx.wait()
|
|
149
|
+
|
|
150
|
+
const ${entityNameLower}Id = await contract.${entityNameLower}Ids(0)
|
|
151
|
+
const ${entityNameLower} = await contract.get${entityDisplayName}(${entityNameLower}Id)
|
|
152
|
+
|
|
153
|
+
expect(${entityNameLower}.isActive).to.be.true
|
|
154
|
+
expect(${entityNameLower}.createdAt).to.be.gt(0)
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
describe("Read ${entityDisplayName}", function () {
|
|
159
|
+
it("Should read ${entityNameLower} data correctly", async function () {
|
|
160
|
+
const { contract, manager } = await loadFixture(deploy${contractName}Fixture)
|
|
161
|
+
|
|
162
|
+
${testData}
|
|
163
|
+
|
|
164
|
+
const tx = await contract.connect(manager).create${entityDisplayName}(
|
|
165
|
+
${createParams}
|
|
166
|
+
)
|
|
167
|
+
await tx.wait()
|
|
168
|
+
|
|
169
|
+
const ${entityNameLower}Id = await contract.${entityNameLower}Ids(0)
|
|
170
|
+
const ${entityNameLower} = await contract.get${entityDisplayName}(${entityNameLower}Id)
|
|
171
|
+
|
|
172
|
+
expect(${entityNameLower}.isActive).to.be.true
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
it("Should fail for non-existent ${entityNameLower}", async function () {
|
|
176
|
+
const { contract } = await loadFixture(deploy${contractName}Fixture)
|
|
177
|
+
|
|
178
|
+
await expect(
|
|
179
|
+
contract.get${entityDisplayName}("0x" + "0".repeat(64))
|
|
180
|
+
).to.be.revertedWith("${entityDisplayName} not found or inactive")
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
it("Should return all ${entityNameLower} IDs", async function () {
|
|
184
|
+
const { contract, manager } = await loadFixture(deploy${contractName}Fixture)
|
|
185
|
+
|
|
186
|
+
${testData}
|
|
187
|
+
|
|
188
|
+
// Create multiple ${entityNameLower}s
|
|
189
|
+
await contract.connect(manager).create${entityDisplayName}(${createParams})
|
|
190
|
+
await contract.connect(manager).create${entityDisplayName}(${createParams})
|
|
191
|
+
|
|
192
|
+
const ids = await contract.getAll${entityDisplayName}Ids()
|
|
193
|
+
expect(ids.length).to.equal(2)
|
|
194
|
+
})
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
describe("Update ${entityDisplayName}", function () {
|
|
198
|
+
it("Should update ${entityNameLower} successfully", async function () {
|
|
199
|
+
const { contract, manager } = await loadFixture(deploy${contractName}Fixture)
|
|
200
|
+
|
|
201
|
+
${testData}
|
|
202
|
+
|
|
203
|
+
// Create ${entityNameLower}
|
|
204
|
+
const createTx = await contract.connect(manager).create${entityDisplayName}(
|
|
205
|
+
${createParams}
|
|
206
|
+
)
|
|
207
|
+
await createTx.wait()
|
|
208
|
+
|
|
209
|
+
const ${entityNameLower}Id = await contract.${entityNameLower}Ids(0)
|
|
210
|
+
|
|
211
|
+
// Update ${entityNameLower}
|
|
212
|
+
const updateTx = await contract.connect(manager).update${entityDisplayName}(
|
|
213
|
+
${entityNameLower}Id,
|
|
214
|
+
${createParams}
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
await expect(updateTx).to.emit(contract, "${entityDisplayName}Updated")
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
it("Should fail if not manager", async function () {
|
|
221
|
+
const { contract, manager, user } = await loadFixture(deploy${contractName}Fixture)
|
|
222
|
+
|
|
223
|
+
${testData}
|
|
224
|
+
|
|
225
|
+
const tx = await contract.connect(manager).create${entityDisplayName}(
|
|
226
|
+
${createParams}
|
|
227
|
+
)
|
|
228
|
+
await tx.wait()
|
|
229
|
+
|
|
230
|
+
const ${entityNameLower}Id = await contract.${entityNameLower}Ids(0)
|
|
231
|
+
|
|
232
|
+
await expect(
|
|
233
|
+
contract.connect(user).update${entityDisplayName}(
|
|
234
|
+
${entityNameLower}Id,
|
|
235
|
+
${createParams}
|
|
236
|
+
)
|
|
237
|
+
).to.be.reverted
|
|
238
|
+
})
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
describe("Deactivate ${entityDisplayName}", function () {
|
|
242
|
+
it("Should deactivate ${entityNameLower} successfully", async function () {
|
|
243
|
+
const { contract, manager, owner } = await loadFixture(deploy${contractName}Fixture)
|
|
244
|
+
|
|
245
|
+
${testData}
|
|
246
|
+
|
|
247
|
+
const tx = await contract.connect(manager).create${entityDisplayName}(
|
|
248
|
+
${createParams}
|
|
249
|
+
)
|
|
250
|
+
await tx.wait()
|
|
251
|
+
|
|
252
|
+
const ${entityNameLower}Id = await contract.${entityNameLower}Ids(0)
|
|
253
|
+
|
|
254
|
+
const deactivateTx = await contract.connect(owner).deactivate${entityDisplayName}(
|
|
255
|
+
${entityNameLower}Id
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
await expect(deactivateTx).to.emit(contract, "${entityDisplayName}Deactivated")
|
|
259
|
+
|
|
260
|
+
expect(await contract.is${entityDisplayName}Active(${entityNameLower}Id)).to.be.false
|
|
261
|
+
})
|
|
262
|
+
|
|
263
|
+
it("Should fail if not admin", async function () {
|
|
264
|
+
const { contract, manager, user } = await loadFixture(deploy${contractName}Fixture)
|
|
265
|
+
|
|
266
|
+
${testData}
|
|
267
|
+
|
|
268
|
+
const tx = await contract.connect(manager).create${entityDisplayName}(
|
|
269
|
+
${createParams}
|
|
270
|
+
)
|
|
271
|
+
await tx.wait()
|
|
272
|
+
|
|
273
|
+
const ${entityNameLower}Id = await contract.${entityNameLower}Ids(0)
|
|
274
|
+
|
|
275
|
+
await expect(
|
|
276
|
+
contract.connect(user).deactivate${entityDisplayName}(${entityNameLower}Id)
|
|
277
|
+
).to.be.reverted
|
|
278
|
+
})
|
|
279
|
+
|
|
280
|
+
it("Should fail for already inactive ${entityNameLower}", async function () {
|
|
281
|
+
const { contract, manager, owner } = await loadFixture(deploy${contractName}Fixture)
|
|
282
|
+
|
|
283
|
+
${testData}
|
|
284
|
+
|
|
285
|
+
const tx = await contract.connect(manager).create${entityDisplayName}(
|
|
286
|
+
${createParams}
|
|
287
|
+
)
|
|
288
|
+
await tx.wait()
|
|
289
|
+
|
|
290
|
+
const ${entityNameLower}Id = await contract.${entityNameLower}Ids(0)
|
|
291
|
+
|
|
292
|
+
await contract.connect(owner).deactivate${entityDisplayName}(${entityNameLower}Id)
|
|
293
|
+
|
|
294
|
+
await expect(
|
|
295
|
+
contract.connect(owner).deactivate${entityDisplayName}(${entityNameLower}Id)
|
|
296
|
+
).to.be.revertedWith("${entityDisplayName} already inactive")
|
|
297
|
+
})
|
|
298
|
+
})
|
|
299
|
+
|
|
300
|
+
describe("Access Control", function () {
|
|
301
|
+
it("Should respect role-based access control", async function () {
|
|
302
|
+
const { contract, user, MANAGER_ROLE } = await loadFixture(deploy${contractName}Fixture)
|
|
303
|
+
|
|
304
|
+
expect(await contract.hasRole(MANAGER_ROLE, user.address)).to.be.false
|
|
305
|
+
})
|
|
306
|
+
|
|
307
|
+
it("Should allow admin to grant manager role", async function () {
|
|
308
|
+
const { contract, owner, other, MANAGER_ROLE } = await loadFixture(deploy${contractName}Fixture)
|
|
309
|
+
|
|
310
|
+
await contract.connect(owner).grantRole(MANAGER_ROLE, other.address)
|
|
311
|
+
expect(await contract.hasRole(MANAGER_ROLE, other.address)).to.be.true
|
|
312
|
+
})
|
|
313
|
+
})
|
|
314
|
+
})
|
|
315
|
+
`;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Generate integration test suite
|
|
319
|
+
*/
|
|
320
|
+
function generateIntegrationTestSuite(template) {
|
|
321
|
+
const contractNames = template.entities.map(e => getContractNameForEntity(e));
|
|
322
|
+
return `import { expect } from "chai"
|
|
323
|
+
import { ethers } from "hardhat"
|
|
324
|
+
|
|
325
|
+
describe("Integration Tests", function () {
|
|
326
|
+
describe("Multi-Contract Interactions", function () {
|
|
327
|
+
it("Should deploy all contracts successfully", async function () {
|
|
328
|
+
const [owner] = await ethers.getSigners()
|
|
329
|
+
|
|
330
|
+
${contractNames.map(name => `
|
|
331
|
+
const ${name} = await ethers.getContractFactory("${name}")
|
|
332
|
+
const ${name.toLowerCase()} = await ${name}.deploy()
|
|
333
|
+
expect(await ${name.toLowerCase()}.hasRole(
|
|
334
|
+
await ${name.toLowerCase()}.DEFAULT_ADMIN_ROLE(),
|
|
335
|
+
owner.address
|
|
336
|
+
)).to.be.true`).join('\n')}
|
|
337
|
+
})
|
|
338
|
+
})
|
|
339
|
+
|
|
340
|
+
describe("Template Configuration", function () {
|
|
341
|
+
it("Should validate template structure", async function () {
|
|
342
|
+
// Add template-specific integration tests here
|
|
343
|
+
expect(true).to.be.true
|
|
344
|
+
})
|
|
345
|
+
})
|
|
346
|
+
})
|
|
347
|
+
`;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Get contract name for entity
|
|
351
|
+
*/
|
|
352
|
+
function getContractNameForEntity(entity) {
|
|
353
|
+
const baseName = capitalize(entity.name);
|
|
354
|
+
return `${baseName}Registry`;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Get test value for field type
|
|
358
|
+
*/
|
|
359
|
+
function getTestValue(type) {
|
|
360
|
+
const testValues = {
|
|
361
|
+
'string': '"Test Value"',
|
|
362
|
+
'number': '12345',
|
|
363
|
+
'boolean': 'true',
|
|
364
|
+
'address': 'ethers.ZeroAddress',
|
|
365
|
+
'bytes': '"0x1234"',
|
|
366
|
+
'bytes32': 'ethers.ZeroHash'
|
|
367
|
+
};
|
|
368
|
+
return testValues[type] || '"Test Value"';
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Capitalize first letter
|
|
372
|
+
*/
|
|
373
|
+
function capitalize(str) {
|
|
374
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
375
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript Type Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates TypeScript type definitions from contract ABIs
|
|
5
|
+
*/
|
|
6
|
+
export interface GenerateTypesOptions {
|
|
7
|
+
abiDir: string;
|
|
8
|
+
outputPath: string;
|
|
9
|
+
}
|
|
10
|
+
export interface GenerateTypesResult {
|
|
11
|
+
types: string[];
|
|
12
|
+
success: boolean;
|
|
13
|
+
errors: string[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Generate TypeScript types from contract ABIs
|
|
17
|
+
*/
|
|
18
|
+
export declare function generateTypes(options: GenerateTypesOptions): Promise<GenerateTypesResult>;
|
|
19
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/generators/types/generator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,mBAAmB,CAAC,CAgE9B"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript Type Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates TypeScript type definitions from contract ABIs
|
|
5
|
+
*/
|
|
6
|
+
import * as fs from 'fs';
|
|
7
|
+
import * as path from 'path';
|
|
8
|
+
/**
|
|
9
|
+
* Generate TypeScript types from contract ABIs
|
|
10
|
+
*/
|
|
11
|
+
export async function generateTypes(options) {
|
|
12
|
+
const result = {
|
|
13
|
+
types: [],
|
|
14
|
+
success: false,
|
|
15
|
+
errors: []
|
|
16
|
+
};
|
|
17
|
+
try {
|
|
18
|
+
// Check if ABI directory exists
|
|
19
|
+
if (!fs.existsSync(options.abiDir)) {
|
|
20
|
+
throw new Error(`ABI directory not found: ${options.abiDir}`);
|
|
21
|
+
}
|
|
22
|
+
// Create output directory
|
|
23
|
+
const outputPath = path.resolve(options.outputPath);
|
|
24
|
+
if (!fs.existsSync(outputPath)) {
|
|
25
|
+
fs.mkdirSync(outputPath, { recursive: true });
|
|
26
|
+
}
|
|
27
|
+
// Find all ABI files
|
|
28
|
+
const abiFiles = findABIFiles(options.abiDir);
|
|
29
|
+
if (abiFiles.length === 0) {
|
|
30
|
+
result.errors.push('No ABI files found in directory');
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
// Generate types for each ABI
|
|
34
|
+
for (const abiFile of abiFiles) {
|
|
35
|
+
try {
|
|
36
|
+
const abiContent = fs.readFileSync(abiFile, 'utf-8');
|
|
37
|
+
const abi = JSON.parse(abiContent);
|
|
38
|
+
const contractName = path.basename(abiFile, '.json');
|
|
39
|
+
const typeDefinition = generateTypeDefinitionFromABI(contractName, abi);
|
|
40
|
+
const typeFile = path.join(outputPath, `${contractName}.ts`);
|
|
41
|
+
fs.writeFileSync(typeFile, typeDefinition);
|
|
42
|
+
result.types.push(typeFile);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
result.errors.push(`Failed to generate types for ${abiFile}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Generate index file
|
|
49
|
+
const indexContent = generateIndexFile(result.types, outputPath);
|
|
50
|
+
const indexFile = path.join(outputPath, 'index.ts');
|
|
51
|
+
fs.writeFileSync(indexFile, indexContent);
|
|
52
|
+
result.types.push(indexFile);
|
|
53
|
+
result.success = result.errors.length === 0;
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
result.errors.push(`Failed to generate types: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Find all ABI JSON files in directory
|
|
62
|
+
*/
|
|
63
|
+
function findABIFiles(dir) {
|
|
64
|
+
const files = [];
|
|
65
|
+
function scanDirectory(currentDir) {
|
|
66
|
+
const entries = fs.readdirSync(currentDir, { withFileTypes: true });
|
|
67
|
+
for (const entry of entries) {
|
|
68
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
69
|
+
if (entry.isDirectory()) {
|
|
70
|
+
scanDirectory(fullPath);
|
|
71
|
+
}
|
|
72
|
+
else if (entry.isFile() && entry.name.endsWith('.json')) {
|
|
73
|
+
files.push(fullPath);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
scanDirectory(dir);
|
|
78
|
+
return files;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Generate TypeScript type definition from ABI
|
|
82
|
+
*/
|
|
83
|
+
function generateTypeDefinitionFromABI(contractName, abi) {
|
|
84
|
+
// Extract function signatures
|
|
85
|
+
const functions = abi.filter(item => item.type === 'function');
|
|
86
|
+
const events = abi.filter(item => item.type === 'event');
|
|
87
|
+
// Generate function interface
|
|
88
|
+
const functionSignatures = functions.map(fn => {
|
|
89
|
+
const inputs = fn.inputs.map((input) => `${input.name}: ${mapABITypeToTypeScript(input.type)}`).join(', ');
|
|
90
|
+
const outputs = fn.outputs && fn.outputs.length > 0
|
|
91
|
+
? mapABITypeToTypeScript(fn.outputs[0].type)
|
|
92
|
+
: 'void';
|
|
93
|
+
return ` ${fn.name}(${inputs}): Promise<${outputs}>`;
|
|
94
|
+
}).join('\n');
|
|
95
|
+
// Generate event interface
|
|
96
|
+
const eventSignatures = events.map(event => {
|
|
97
|
+
const inputs = event.inputs.map((input) => `${input.name}: ${mapABITypeToTypeScript(input.type)}`).join(', ');
|
|
98
|
+
return ` ${event.name}: { ${inputs} }`;
|
|
99
|
+
}).join('\n');
|
|
100
|
+
return `/**
|
|
101
|
+
* TypeScript definitions for ${contractName}
|
|
102
|
+
* Generated from contract ABI
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
import { ethers } from 'ethers'
|
|
106
|
+
|
|
107
|
+
export interface ${contractName}Functions {
|
|
108
|
+
${functionSignatures}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface ${contractName}Events {
|
|
112
|
+
${eventSignatures}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export type ${contractName} = ethers.Contract & ${contractName}Functions
|
|
116
|
+
|
|
117
|
+
export const ${contractName}ABI = ${JSON.stringify(abi, null, 2)}
|
|
118
|
+
`;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Map Solidity ABI types to TypeScript types
|
|
122
|
+
*/
|
|
123
|
+
function mapABITypeToTypeScript(abiType) {
|
|
124
|
+
if (abiType.startsWith('uint') || abiType.startsWith('int')) {
|
|
125
|
+
return 'bigint';
|
|
126
|
+
}
|
|
127
|
+
if (abiType === 'address') {
|
|
128
|
+
return 'string';
|
|
129
|
+
}
|
|
130
|
+
if (abiType === 'bool') {
|
|
131
|
+
return 'boolean';
|
|
132
|
+
}
|
|
133
|
+
if (abiType === 'string') {
|
|
134
|
+
return 'string';
|
|
135
|
+
}
|
|
136
|
+
if (abiType.startsWith('bytes')) {
|
|
137
|
+
return 'string';
|
|
138
|
+
}
|
|
139
|
+
if (abiType.endsWith('[]')) {
|
|
140
|
+
const baseType = abiType.slice(0, -2);
|
|
141
|
+
return `${mapABITypeToTypeScript(baseType)}[]`;
|
|
142
|
+
}
|
|
143
|
+
return 'any';
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Generate index.ts file that exports all types
|
|
147
|
+
*/
|
|
148
|
+
function generateIndexFile(typeFiles, outputPath) {
|
|
149
|
+
const exports = typeFiles
|
|
150
|
+
.filter(file => !file.endsWith('index.ts'))
|
|
151
|
+
.map(file => {
|
|
152
|
+
const basename = path.basename(file, '.ts');
|
|
153
|
+
return `export * from './${basename}'`;
|
|
154
|
+
})
|
|
155
|
+
.join('\n');
|
|
156
|
+
return `/**
|
|
157
|
+
* Auto-generated type definitions
|
|
158
|
+
*
|
|
159
|
+
* Import contract types:
|
|
160
|
+
* import { MyContract } from './types'
|
|
161
|
+
*/
|
|
162
|
+
|
|
163
|
+
${exports}
|
|
164
|
+
`;
|
|
165
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI Component Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates CRUD React components from template entity definitions
|
|
5
|
+
*/
|
|
6
|
+
export interface GenerateUIOptions {
|
|
7
|
+
templatePath: string;
|
|
8
|
+
outputPath: string;
|
|
9
|
+
componentsPath?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface GenerateUIResult {
|
|
12
|
+
components: string[];
|
|
13
|
+
success: boolean;
|
|
14
|
+
errors: string[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Generate UI components from template configuration
|
|
18
|
+
*/
|
|
19
|
+
export declare function generateUIComponents(options: GenerateUIOptions): Promise<GenerateUIResult>;
|
|
20
|
+
//# sourceMappingURL=component-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-generator.d.ts","sourceRoot":"","sources":["../../../src/generators/ui/component-generator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,gBAAgB,CAAC,CA4E3B"}
|