@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,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KPI Card Component
|
|
3
|
+
*
|
|
4
|
+
* Universal KPI display card for dashboards
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
export interface KPICardProps {
|
|
8
|
+
/** Card title */
|
|
9
|
+
title: string;
|
|
10
|
+
/** Main value to display */
|
|
11
|
+
value: string | number;
|
|
12
|
+
/** Optional subtitle */
|
|
13
|
+
subtitle?: string;
|
|
14
|
+
/** Loading state */
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
/** Trend indicator */
|
|
17
|
+
trend?: {
|
|
18
|
+
value: number;
|
|
19
|
+
label: string;
|
|
20
|
+
};
|
|
21
|
+
/** Custom icon */
|
|
22
|
+
icon?: React.ReactNode;
|
|
23
|
+
/** Card color variant */
|
|
24
|
+
variant?: 'default' | 'primary' | 'success' | 'error' | 'warning';
|
|
25
|
+
/** Click handler */
|
|
26
|
+
onClick?: () => void;
|
|
27
|
+
}
|
|
28
|
+
export declare const KPICard: React.FC<KPICardProps>;
|
|
29
|
+
//# sourceMappingURL=KPICard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KPICard.d.ts","sourceRoot":"","sources":["../../../src/ui/components/KPICard.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAWzB,MAAM,WAAW,YAAY;IAC3B,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,4BAA4B;IAC5B,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,wBAAwB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oBAAoB;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,sBAAsB;IACtB,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD,kBAAkB;IAClB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,yBAAyB;IACzB,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;IACjE,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB;AAUD,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA2G1C,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KPI Card Component
|
|
3
|
+
*
|
|
4
|
+
* Universal KPI display card for dashboards
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { Card, CardContent, Typography, Box, Skeleton } from '@mui/material';
|
|
8
|
+
import { TrendingUp, TrendingDown } from '@mui/icons-material';
|
|
9
|
+
const variantColors = {
|
|
10
|
+
default: '#1976d2',
|
|
11
|
+
primary: '#1976d2',
|
|
12
|
+
success: '#2e7d32',
|
|
13
|
+
error: '#d32f2f',
|
|
14
|
+
warning: '#ed6c02'
|
|
15
|
+
};
|
|
16
|
+
export const KPICard = ({ title, value, subtitle, loading = false, trend, icon, variant = 'default', onClick }) => {
|
|
17
|
+
const color = variantColors[variant];
|
|
18
|
+
if (loading) {
|
|
19
|
+
return (React.createElement(Card, { sx: {
|
|
20
|
+
height: '100%',
|
|
21
|
+
cursor: onClick ? 'pointer' : 'default',
|
|
22
|
+
transition: 'transform 0.2s, box-shadow 0.2s',
|
|
23
|
+
'&:hover': onClick ? {
|
|
24
|
+
transform: 'translateY(-4px)',
|
|
25
|
+
boxShadow: 3
|
|
26
|
+
} : {}
|
|
27
|
+
} },
|
|
28
|
+
React.createElement(CardContent, null,
|
|
29
|
+
React.createElement(Skeleton, { variant: "text", width: "60%", height: 24 }),
|
|
30
|
+
React.createElement(Skeleton, { variant: "text", width: "80%", height: 48, sx: { mt: 1 } }),
|
|
31
|
+
React.createElement(Skeleton, { variant: "text", width: "40%", height: 20, sx: { mt: 1 } }))));
|
|
32
|
+
}
|
|
33
|
+
return (React.createElement(Card, { onClick: onClick, sx: {
|
|
34
|
+
height: '100%',
|
|
35
|
+
cursor: onClick ? 'pointer' : 'default',
|
|
36
|
+
transition: 'transform 0.2s, box-shadow 0.2s',
|
|
37
|
+
'&:hover': onClick ? {
|
|
38
|
+
transform: 'translateY(-4px)',
|
|
39
|
+
boxShadow: 3
|
|
40
|
+
} : {},
|
|
41
|
+
borderTop: `4px solid ${color}`
|
|
42
|
+
} },
|
|
43
|
+
React.createElement(CardContent, null,
|
|
44
|
+
React.createElement(Box, { sx: { display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', mb: 2 } },
|
|
45
|
+
React.createElement(Typography, { variant: "subtitle2", color: "text.secondary", gutterBottom: true, sx: { fontWeight: 500 } }, title),
|
|
46
|
+
icon && (React.createElement(Box, { sx: { color, display: 'flex', alignItems: 'center' } }, icon))),
|
|
47
|
+
React.createElement(Typography, { variant: "h4", component: "div", sx: { fontWeight: 700, color: 'text.primary', mb: 1 } }, value),
|
|
48
|
+
(subtitle || trend) && (React.createElement(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1, flexWrap: 'wrap' } },
|
|
49
|
+
trend && (React.createElement(Box, { sx: {
|
|
50
|
+
display: 'flex',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
gap: 0.5,
|
|
53
|
+
color: trend.value >= 0 ? 'success.main' : 'error.main'
|
|
54
|
+
} },
|
|
55
|
+
trend.value >= 0 ? (React.createElement(TrendingUp, { fontSize: "small" })) : (React.createElement(TrendingDown, { fontSize: "small" })),
|
|
56
|
+
React.createElement(Typography, { variant: "body2", sx: { fontWeight: 600 } },
|
|
57
|
+
Math.abs(trend.value),
|
|
58
|
+
"%"),
|
|
59
|
+
React.createElement(Typography, { variant: "caption", color: "text.secondary" }, trend.label))),
|
|
60
|
+
subtitle && !trend && (React.createElement(Typography, { variant: "body2", color: "text.secondary" }, subtitle)))))));
|
|
61
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modal Component
|
|
3
|
+
*
|
|
4
|
+
* Universal modal dialog for forms and content
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
export interface ModalProps {
|
|
8
|
+
/** Modal open state */
|
|
9
|
+
open: boolean;
|
|
10
|
+
/** Close handler */
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
/** Modal title */
|
|
13
|
+
title?: string;
|
|
14
|
+
/** Modal children/content */
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
/** Action buttons */
|
|
17
|
+
actions?: Array<{
|
|
18
|
+
label: string;
|
|
19
|
+
onClick: () => void;
|
|
20
|
+
variant?: 'text' | 'outlined' | 'contained';
|
|
21
|
+
color?: 'primary' | 'secondary' | 'error' | 'success';
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
/** Max width */
|
|
25
|
+
maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | false;
|
|
26
|
+
/** Full width */
|
|
27
|
+
fullWidth?: boolean;
|
|
28
|
+
/** Disable backdrop click to close */
|
|
29
|
+
disableBackdropClick?: boolean;
|
|
30
|
+
/** Show close button */
|
|
31
|
+
showCloseButton?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare const Modal: React.FC<ModalProps>;
|
|
34
|
+
//# sourceMappingURL=Modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/ui/components/Modal.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAazB,MAAM,WAAW,UAAU;IACzB,uBAAuB;IACvB,IAAI,EAAE,OAAO,CAAA;IACb,oBAAoB;IACpB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6BAA6B;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,qBAAqB;IACrB,OAAO,CAAC,EAAE,KAAK,CAAC;QACd,KAAK,EAAE,MAAM,CAAA;QACb,OAAO,EAAE,MAAM,IAAI,CAAA;QACnB,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,CAAA;QAC3C,KAAK,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,SAAS,CAAA;QACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;KACnB,CAAC,CAAA;IACF,gBAAgB;IAChB,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAA;IACnD,iBAAiB;IACjB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,sCAAsC;IACtC,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,wBAAwB;IACxB,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAoEtC,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modal Component
|
|
3
|
+
*
|
|
4
|
+
* Universal modal dialog for forms and content
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { Dialog, DialogTitle, DialogContent, DialogActions, Button, IconButton, Box, Typography } from '@mui/material';
|
|
8
|
+
import { Close as CloseIcon } from '@mui/icons-material';
|
|
9
|
+
export const Modal = ({ open, onClose, title, children, actions, maxWidth = 'sm', fullWidth = true, disableBackdropClick = false, showCloseButton = true }) => {
|
|
10
|
+
const handleClose = (_event, reason) => {
|
|
11
|
+
if (reason === 'backdropClick' && disableBackdropClick) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
onClose();
|
|
15
|
+
};
|
|
16
|
+
return (React.createElement(Dialog, { open: open, onClose: handleClose, maxWidth: maxWidth, fullWidth: fullWidth, PaperProps: {
|
|
17
|
+
sx: {
|
|
18
|
+
borderRadius: 2
|
|
19
|
+
}
|
|
20
|
+
} },
|
|
21
|
+
title && (React.createElement(DialogTitle, null,
|
|
22
|
+
React.createElement(Box, { sx: { display: 'flex', alignItems: 'center', justifyContent: 'space-between' } },
|
|
23
|
+
React.createElement(Typography, { variant: "h6" }, title),
|
|
24
|
+
showCloseButton && (React.createElement(IconButton, { "aria-label": "close", onClick: onClose, sx: {
|
|
25
|
+
color: (theme) => theme.palette.grey[500]
|
|
26
|
+
} },
|
|
27
|
+
React.createElement(CloseIcon, null)))))),
|
|
28
|
+
React.createElement(DialogContent, { dividers: true }, children),
|
|
29
|
+
actions && actions.length > 0 && (React.createElement(DialogActions, { sx: { px: 3, py: 2 } }, actions.map((action, index) => (React.createElement(Button, { key: index, onClick: action.onClick, variant: action.variant || 'text', color: action.color || 'primary', disabled: action.disabled }, action.label)))))));
|
|
30
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Varity UI Component Library
|
|
3
|
+
*
|
|
4
|
+
* Pre-built Material-UI components for rapid dashboard development
|
|
5
|
+
*/
|
|
6
|
+
export { KPICard } from './KPICard';
|
|
7
|
+
export type { KPICardProps } from './KPICard';
|
|
8
|
+
export { DataTable } from './DataTable';
|
|
9
|
+
export type { DataTableProps, Column } from './DataTable';
|
|
10
|
+
export { EntityForm } from './EntityForm';
|
|
11
|
+
export type { EntityFormProps, FormField } from './EntityForm';
|
|
12
|
+
export { ChartWidget } from './ChartWidget';
|
|
13
|
+
export type { ChartWidgetProps, ChartType, ChartDataPoint } from './ChartWidget';
|
|
14
|
+
export { DashboardLayout } from './DashboardLayout';
|
|
15
|
+
export type { DashboardLayoutProps, NavigationItem } from './DashboardLayout';
|
|
16
|
+
export { Modal } from './Modal';
|
|
17
|
+
export type { ModalProps } from './Modal';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/components/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,YAAY,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEhF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,YAAY,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAE7E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Varity UI Component Library
|
|
3
|
+
*
|
|
4
|
+
* Pre-built Material-UI components for rapid dashboard development
|
|
5
|
+
*/
|
|
6
|
+
export { KPICard } from './KPICard';
|
|
7
|
+
export { DataTable } from './DataTable';
|
|
8
|
+
export { EntityForm } from './EntityForm';
|
|
9
|
+
export { ChartWidget } from './ChartWidget';
|
|
10
|
+
export { DashboardLayout } from './DashboardLayout';
|
|
11
|
+
export { Modal } from './Modal';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Validator
|
|
3
|
+
*
|
|
4
|
+
* Validates template configuration against schema and best practices
|
|
5
|
+
*/
|
|
6
|
+
export interface ValidateTemplateOptions {
|
|
7
|
+
templatePath: string;
|
|
8
|
+
strict: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ValidationResult {
|
|
11
|
+
valid: boolean;
|
|
12
|
+
errors: string[];
|
|
13
|
+
warnings: string[];
|
|
14
|
+
summary: {
|
|
15
|
+
entities: number;
|
|
16
|
+
contracts: number;
|
|
17
|
+
events: number;
|
|
18
|
+
metrics: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Validate template configuration
|
|
23
|
+
*/
|
|
24
|
+
export declare function validateTemplate(options: ValidateTemplateOptions): Promise<ValidationResult>;
|
|
25
|
+
//# sourceMappingURL=template-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-validator.d.ts","sourceRoot":"","sources":["../../src/validation/template-validator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAA;IACd,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAA;QAChB,SAAS,EAAE,MAAM,CAAA;QACjB,MAAM,EAAE,MAAM,CAAA;QACd,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;CACF;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,gBAAgB,CAAC,CAmE3B"}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Validator
|
|
3
|
+
*
|
|
4
|
+
* Validates template configuration against schema and best practices
|
|
5
|
+
*/
|
|
6
|
+
import * as fs from 'fs';
|
|
7
|
+
/**
|
|
8
|
+
* Validate template configuration
|
|
9
|
+
*/
|
|
10
|
+
export async function validateTemplate(options) {
|
|
11
|
+
const result = {
|
|
12
|
+
valid: false,
|
|
13
|
+
errors: [],
|
|
14
|
+
warnings: [],
|
|
15
|
+
summary: {
|
|
16
|
+
entities: 0,
|
|
17
|
+
contracts: 0,
|
|
18
|
+
events: 0,
|
|
19
|
+
metrics: 0
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
try {
|
|
23
|
+
// Check if file exists
|
|
24
|
+
if (!fs.existsSync(options.templatePath)) {
|
|
25
|
+
result.errors.push(`Template file not found: ${options.templatePath}`);
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
// Parse JSON
|
|
29
|
+
const templateContent = fs.readFileSync(options.templatePath, 'utf-8');
|
|
30
|
+
let template;
|
|
31
|
+
try {
|
|
32
|
+
template = JSON.parse(templateContent);
|
|
33
|
+
}
|
|
34
|
+
catch (parseError) {
|
|
35
|
+
result.errors.push(`Invalid JSON: ${parseError instanceof Error ? parseError.message : 'Parse error'}`);
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
// Validate schema
|
|
39
|
+
validateSchema(template, result, options.strict);
|
|
40
|
+
// Validate entities
|
|
41
|
+
validateEntities(template, result, options.strict);
|
|
42
|
+
// Validate contracts
|
|
43
|
+
validateContracts(template, result, options.strict);
|
|
44
|
+
// Validate storage configuration
|
|
45
|
+
validateStorage(template, result, options.strict);
|
|
46
|
+
// Validate API configuration
|
|
47
|
+
validateAPI(template, result, options.strict);
|
|
48
|
+
// Validate features
|
|
49
|
+
validateFeatures(template, result, options.strict);
|
|
50
|
+
// Generate summary
|
|
51
|
+
result.summary = {
|
|
52
|
+
entities: template.entities?.length || 0,
|
|
53
|
+
contracts: template.contracts?.length || 0,
|
|
54
|
+
events: template.events?.length || 0,
|
|
55
|
+
metrics: template.metrics?.length || 0
|
|
56
|
+
};
|
|
57
|
+
// Set overall validity
|
|
58
|
+
result.valid = result.errors.length === 0;
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
result.errors.push(`Validation error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
62
|
+
}
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Validate template schema
|
|
67
|
+
*/
|
|
68
|
+
function validateSchema(template, result, strict) {
|
|
69
|
+
// Required fields
|
|
70
|
+
if (!template.type) {
|
|
71
|
+
result.errors.push('Missing required field: type');
|
|
72
|
+
}
|
|
73
|
+
if (!template.name) {
|
|
74
|
+
result.errors.push('Missing required field: name');
|
|
75
|
+
}
|
|
76
|
+
if (!template.version) {
|
|
77
|
+
result.errors.push('Missing required field: version');
|
|
78
|
+
}
|
|
79
|
+
// Version format
|
|
80
|
+
if (template.version && !/^\d+\.\d+\.\d+$/.test(template.version)) {
|
|
81
|
+
result.warnings.push('Version should follow semantic versioning (e.g., 1.0.0)');
|
|
82
|
+
}
|
|
83
|
+
// Description
|
|
84
|
+
if (!template.description) {
|
|
85
|
+
if (strict) {
|
|
86
|
+
result.errors.push('Missing required field: description');
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
result.warnings.push('Missing description field');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Validate entities
|
|
95
|
+
*/
|
|
96
|
+
function validateEntities(template, result, strict) {
|
|
97
|
+
if (!template.entities || template.entities.length === 0) {
|
|
98
|
+
result.errors.push('Template must have at least one entity');
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
template.entities.forEach((entity, index) => {
|
|
102
|
+
const prefix = `Entity ${entity.name || index}`;
|
|
103
|
+
// Required fields
|
|
104
|
+
if (!entity.name) {
|
|
105
|
+
result.errors.push(`${prefix}: Missing name`);
|
|
106
|
+
}
|
|
107
|
+
if (!entity.idField) {
|
|
108
|
+
result.errors.push(`${prefix}: Missing idField`);
|
|
109
|
+
}
|
|
110
|
+
// Fields validation
|
|
111
|
+
if (!entity.fields || entity.fields.length === 0) {
|
|
112
|
+
result.errors.push(`${prefix}: Must have at least one field`);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
// Check for idField existence
|
|
116
|
+
const hasIdField = entity.fields.some(f => f.name === entity.idField);
|
|
117
|
+
if (!hasIdField) {
|
|
118
|
+
result.errors.push(`${prefix}: idField "${entity.idField}" not found in fields`);
|
|
119
|
+
}
|
|
120
|
+
// Check for required tracking fields
|
|
121
|
+
const hasCreatedAt = entity.fields.some(f => f.name === 'createdAt');
|
|
122
|
+
const hasIsActive = entity.fields.some(f => f.name === 'isActive');
|
|
123
|
+
if (!hasCreatedAt) {
|
|
124
|
+
result.warnings.push(`${prefix}: Missing recommended field "createdAt"`);
|
|
125
|
+
}
|
|
126
|
+
if (!hasIsActive) {
|
|
127
|
+
result.warnings.push(`${prefix}: Missing recommended field "isActive"`);
|
|
128
|
+
}
|
|
129
|
+
// Validate field types
|
|
130
|
+
entity.fields.forEach((field, fieldIndex) => {
|
|
131
|
+
const fieldPrefix = `${prefix}.fields[${fieldIndex}]`;
|
|
132
|
+
if (!field.name) {
|
|
133
|
+
result.errors.push(`${fieldPrefix}: Missing name`);
|
|
134
|
+
}
|
|
135
|
+
if (!field.type) {
|
|
136
|
+
result.errors.push(`${fieldPrefix}: Missing type`);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
// Universal field types - supporting all industries
|
|
140
|
+
const validTypes = [
|
|
141
|
+
// Basic types
|
|
142
|
+
'string', 'number', 'boolean', 'enum', 'array', 'object',
|
|
143
|
+
// Financial types
|
|
144
|
+
'currency', 'decimal', 'percentage',
|
|
145
|
+
// Temporal types
|
|
146
|
+
'date', 'time', 'datetime', 'duration',
|
|
147
|
+
// Contact types
|
|
148
|
+
'email', 'phone', 'url',
|
|
149
|
+
// Blockchain types
|
|
150
|
+
'address',
|
|
151
|
+
// Identification types
|
|
152
|
+
'ssn', 'tax-id', 'medical-code', 'sku', 'barcode',
|
|
153
|
+
// Content types
|
|
154
|
+
'rich-text', 'markdown', 'json',
|
|
155
|
+
// Media types
|
|
156
|
+
'file', 'image', 'document',
|
|
157
|
+
// Advanced types
|
|
158
|
+
'lookup', 'multi-select', 'coordinates', 'color', 'ip-address',
|
|
159
|
+
// Legacy types
|
|
160
|
+
'bytes', 'bytes32'
|
|
161
|
+
];
|
|
162
|
+
if (!validTypes.includes(field.type)) {
|
|
163
|
+
result.warnings.push(`${fieldPrefix}: Unknown type "${field.type}". Valid types: ${validTypes.join(', ')}`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// Additional validation for specific field types
|
|
167
|
+
if (field.type === 'enum' || field.type === 'multi-select') {
|
|
168
|
+
if (!field.enumValues || field.enumValues.length === 0) {
|
|
169
|
+
result.errors.push(`${fieldPrefix}: Field type "${field.type}" requires enumValues`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (field.type === 'lookup') {
|
|
173
|
+
if (!field.lookupConfig) {
|
|
174
|
+
result.errors.push(`${fieldPrefix}: Field type "lookup" requires lookupConfig`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// Validation rule checks
|
|
178
|
+
if (field.validation) {
|
|
179
|
+
// Validate email pattern
|
|
180
|
+
if (field.type === 'email' && !field.validation.pattern) {
|
|
181
|
+
result.warnings.push(`${fieldPrefix}: Email field should have validation pattern`);
|
|
182
|
+
}
|
|
183
|
+
// Validate phone pattern
|
|
184
|
+
if (field.type === 'phone' && !field.validation.pattern) {
|
|
185
|
+
result.warnings.push(`${fieldPrefix}: Phone field should have validation pattern`);
|
|
186
|
+
}
|
|
187
|
+
// Validate currency precision
|
|
188
|
+
if (field.type === 'currency' && !field.validation.precision) {
|
|
189
|
+
result.warnings.push(`${fieldPrefix}: Currency field should have precision validation`);
|
|
190
|
+
}
|
|
191
|
+
// Validate file types
|
|
192
|
+
if (['file', 'image', 'document'].includes(field.type) && !field.validation.fileTypes) {
|
|
193
|
+
result.warnings.push(`${fieldPrefix}: File field should specify allowed fileTypes`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
// Display name
|
|
199
|
+
if (!entity.displayName && strict) {
|
|
200
|
+
result.warnings.push(`${prefix}: Missing displayName`);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Validate contracts
|
|
206
|
+
*/
|
|
207
|
+
function validateContracts(template, result, strict) {
|
|
208
|
+
if (!template.contracts || template.contracts.length === 0) {
|
|
209
|
+
result.warnings.push('No contracts defined in template');
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
template.contracts.forEach((contract, index) => {
|
|
213
|
+
const prefix = `Contract ${contract.name || index}`;
|
|
214
|
+
if (!contract.name) {
|
|
215
|
+
result.errors.push(`${prefix}: Missing name`);
|
|
216
|
+
}
|
|
217
|
+
if (!contract.abi) {
|
|
218
|
+
result.warnings.push(`${prefix}: Missing ABI path`);
|
|
219
|
+
}
|
|
220
|
+
if (!contract.addresses) {
|
|
221
|
+
result.warnings.push(`${prefix}: Missing addresses configuration`);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
// Check for network addresses
|
|
225
|
+
const networks = ['arbitrum-sepolia', 'arbitrum-l3-testnet', 'arbitrum-l3-mainnet'];
|
|
226
|
+
networks.forEach(network => {
|
|
227
|
+
if (!(network in contract.addresses)) {
|
|
228
|
+
result.warnings.push(`${prefix}: Missing address for network "${network}"`);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Validate storage configuration
|
|
236
|
+
*/
|
|
237
|
+
function validateStorage(template, result, strict) {
|
|
238
|
+
if (!template.storage) {
|
|
239
|
+
if (strict) {
|
|
240
|
+
result.errors.push('Missing storage configuration');
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
result.warnings.push('Missing storage configuration');
|
|
244
|
+
}
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
// Check namespace patterns
|
|
248
|
+
if (!template.storage.varityNamespace) {
|
|
249
|
+
result.warnings.push('Missing varityNamespace in storage config');
|
|
250
|
+
}
|
|
251
|
+
if (!template.storage.industryNamespace) {
|
|
252
|
+
result.warnings.push('Missing industryNamespace in storage config');
|
|
253
|
+
}
|
|
254
|
+
if (!template.storage.customerNamespacePattern) {
|
|
255
|
+
result.warnings.push('Missing customerNamespacePattern in storage config');
|
|
256
|
+
}
|
|
257
|
+
// Validate namespace pattern format
|
|
258
|
+
const patterns = [
|
|
259
|
+
template.storage.customerNamespacePattern
|
|
260
|
+
].filter(Boolean);
|
|
261
|
+
patterns.forEach(pattern => {
|
|
262
|
+
if (pattern && !pattern.includes('{') && !pattern.includes('}')) {
|
|
263
|
+
result.warnings.push(`Namespace pattern "${pattern}" should include placeholders like {category}`);
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Validate API configuration
|
|
269
|
+
*/
|
|
270
|
+
function validateAPI(template, result, strict) {
|
|
271
|
+
if (!template.api) {
|
|
272
|
+
result.warnings.push('Missing API configuration');
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
if (!template.api.basePath) {
|
|
276
|
+
result.warnings.push('Missing API basePath');
|
|
277
|
+
}
|
|
278
|
+
else if (!template.api.basePath.startsWith('/api/')) {
|
|
279
|
+
result.warnings.push('API basePath should start with /api/');
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Validate features
|
|
284
|
+
*/
|
|
285
|
+
function validateFeatures(template, result, strict) {
|
|
286
|
+
if (!template.features) {
|
|
287
|
+
result.warnings.push('Missing features configuration');
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const recommendedFeatures = [
|
|
291
|
+
'analytics',
|
|
292
|
+
'forecasting',
|
|
293
|
+
'notifications',
|
|
294
|
+
'export',
|
|
295
|
+
'cache',
|
|
296
|
+
'monitoring'
|
|
297
|
+
];
|
|
298
|
+
if (template.features) {
|
|
299
|
+
recommendedFeatures.forEach(feature => {
|
|
300
|
+
if (!(feature in template.features)) {
|
|
301
|
+
result.warnings.push(`Missing recommended feature: ${feature}`);
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@varity-labs/sdk",
|
|
3
|
+
"version": "2.0.0-alpha.1",
|
|
4
|
+
"description": "Varity SDK - Build any app on Varity L3 with complete thirdweb integration (Engine, Nebula AI, Storage, Bridge, Gateway, x402)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md",
|
|
19
|
+
"LICENSE"
|
|
20
|
+
],
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"bin": {
|
|
23
|
+
"varity": "dist/cli/index.js"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc",
|
|
27
|
+
"build:watch": "tsc --watch",
|
|
28
|
+
"test": "jest",
|
|
29
|
+
"test:watch": "jest --watch",
|
|
30
|
+
"lint": "eslint src --ext .ts",
|
|
31
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
32
|
+
"cli:dev": "npm run build && node dist/cli/index.js",
|
|
33
|
+
"prepublishOnly": "npm run build"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"varity",
|
|
37
|
+
"varity-l3",
|
|
38
|
+
"thirdweb",
|
|
39
|
+
"multi-chain",
|
|
40
|
+
"web3",
|
|
41
|
+
"blockchain",
|
|
42
|
+
"erc-4337",
|
|
43
|
+
"account-abstraction",
|
|
44
|
+
"gasless-transactions",
|
|
45
|
+
"depin",
|
|
46
|
+
"arbitrum",
|
|
47
|
+
"base",
|
|
48
|
+
"ipfs",
|
|
49
|
+
"arweave",
|
|
50
|
+
"cross-chain",
|
|
51
|
+
"ai-blockchain",
|
|
52
|
+
"nebula-ai"
|
|
53
|
+
],
|
|
54
|
+
"author": "Varity",
|
|
55
|
+
"license": "MIT",
|
|
56
|
+
"repository": {
|
|
57
|
+
"type": "git",
|
|
58
|
+
"url": "https://github.com/varity/varity-sdk"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@emotion/react": "^11.11.0",
|
|
62
|
+
"@emotion/styled": "^11.11.0",
|
|
63
|
+
"@mui/icons-material": "^5.15.0",
|
|
64
|
+
"@mui/material": "^5.15.0",
|
|
65
|
+
"@mui/x-date-pickers": "^6.19.0",
|
|
66
|
+
"@varity-labs/types": "workspace:*",
|
|
67
|
+
"axios": "^1.6.0",
|
|
68
|
+
"chalk": "^5.3.0",
|
|
69
|
+
"chokidar": "^3.5.3",
|
|
70
|
+
"commander": "^11.1.0",
|
|
71
|
+
"crypto-js": "^4.2.0",
|
|
72
|
+
"date-fns": "^2.30.0",
|
|
73
|
+
"ethers": "^6.0.0",
|
|
74
|
+
"handlebars": "^4.7.8",
|
|
75
|
+
"inquirer": "^9.2.12",
|
|
76
|
+
"react": "^18.2.0",
|
|
77
|
+
"react-dom": "^18.2.0",
|
|
78
|
+
"recharts": "^2.10.0",
|
|
79
|
+
"thirdweb": "^5.112.0"
|
|
80
|
+
},
|
|
81
|
+
"devDependencies": {
|
|
82
|
+
"@types/crypto-js": "^4.2.1",
|
|
83
|
+
"@types/inquirer": "^9.0.7",
|
|
84
|
+
"@types/jest": "^29.5.0",
|
|
85
|
+
"@types/node": "^20.10.0",
|
|
86
|
+
"@types/react": "^18.2.0",
|
|
87
|
+
"@types/react-dom": "^18.2.0",
|
|
88
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
89
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
90
|
+
"eslint": "^8.50.0",
|
|
91
|
+
"jest": "^29.7.0",
|
|
92
|
+
"prettier": "^3.0.0",
|
|
93
|
+
"ts-jest": "^29.1.0",
|
|
94
|
+
"typescript": "^5.3.0"
|
|
95
|
+
},
|
|
96
|
+
"peerDependencies": {
|
|
97
|
+
"ethers": "^6.0.0"
|
|
98
|
+
},
|
|
99
|
+
"engines": {
|
|
100
|
+
"node": ">=18.0.0"
|
|
101
|
+
}
|
|
102
|
+
}
|