@creact-labs/creact 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -22
- package/dist/cli.d.ts +11 -0
- package/dist/cli.js +88 -0
- package/dist/index.d.ts +19 -44
- package/dist/index.js +20 -68
- package/dist/jsx/index.d.ts +2 -0
- package/dist/jsx/index.js +1 -0
- package/dist/jsx/jsx-dev-runtime.d.ts +4 -0
- package/dist/jsx/jsx-dev-runtime.js +4 -0
- package/dist/jsx/jsx-runtime.d.ts +38 -0
- package/dist/jsx/jsx-runtime.js +38 -0
- package/dist/jsx/types.d.ts +12 -0
- package/dist/jsx/types.js +4 -0
- package/dist/primitives/context.d.ts +34 -0
- package/dist/primitives/context.js +63 -0
- package/dist/primitives/index.d.ts +3 -0
- package/dist/primitives/index.js +3 -0
- package/dist/primitives/instance.d.ts +72 -0
- package/dist/primitives/instance.js +235 -0
- package/dist/primitives/store.d.ts +22 -0
- package/dist/primitives/store.js +97 -0
- package/dist/provider/backend.d.ts +110 -0
- package/dist/provider/backend.js +37 -0
- package/dist/provider/interface.d.ts +48 -0
- package/dist/provider/interface.js +39 -0
- package/dist/reactive/effect.d.ts +11 -0
- package/dist/reactive/effect.js +42 -0
- package/dist/reactive/index.d.ts +3 -0
- package/dist/reactive/index.js +3 -0
- package/dist/reactive/signal.d.ts +32 -0
- package/dist/reactive/signal.js +60 -0
- package/dist/reactive/tracking.d.ts +41 -0
- package/dist/reactive/tracking.js +161 -0
- package/dist/runtime/fiber.d.ts +21 -0
- package/dist/runtime/fiber.js +16 -0
- package/dist/runtime/index.d.ts +4 -0
- package/dist/runtime/index.js +4 -0
- package/dist/runtime/reconcile.d.ts +66 -0
- package/dist/runtime/reconcile.js +210 -0
- package/dist/runtime/render.d.ts +42 -0
- package/dist/runtime/render.js +231 -0
- package/dist/runtime/run.d.ts +119 -0
- package/dist/runtime/run.js +334 -0
- package/dist/runtime/state-machine.d.ts +95 -0
- package/dist/runtime/state-machine.js +209 -0
- package/dist/types.d.ts +13 -0
- package/dist/types.js +4 -0
- package/package.json +11 -24
- package/dist/cli/commands/BuildCommand.d.ts +0 -40
- package/dist/cli/commands/BuildCommand.js +0 -151
- package/dist/cli/commands/DeployCommand.d.ts +0 -38
- package/dist/cli/commands/DeployCommand.js +0 -194
- package/dist/cli/commands/DevCommand.d.ts +0 -52
- package/dist/cli/commands/DevCommand.js +0 -394
- package/dist/cli/commands/PlanCommand.d.ts +0 -39
- package/dist/cli/commands/PlanCommand.js +0 -164
- package/dist/cli/commands/index.d.ts +0 -36
- package/dist/cli/commands/index.js +0 -43
- package/dist/cli/core/ArgumentParser.d.ts +0 -46
- package/dist/cli/core/ArgumentParser.js +0 -127
- package/dist/cli/core/BaseCommand.d.ts +0 -75
- package/dist/cli/core/BaseCommand.js +0 -95
- package/dist/cli/core/CLIContext.d.ts +0 -68
- package/dist/cli/core/CLIContext.js +0 -183
- package/dist/cli/core/CommandRegistry.d.ts +0 -64
- package/dist/cli/core/CommandRegistry.js +0 -89
- package/dist/cli/core/index.d.ts +0 -36
- package/dist/cli/core/index.js +0 -43
- package/dist/cli/index.d.ts +0 -35
- package/dist/cli/index.js +0 -100
- package/dist/cli/output.d.ts +0 -204
- package/dist/cli/output.js +0 -437
- package/dist/cli/utils.d.ts +0 -59
- package/dist/cli/utils.js +0 -76
- package/dist/context/createContext.d.ts +0 -90
- package/dist/context/createContext.js +0 -113
- package/dist/context/index.d.ts +0 -30
- package/dist/context/index.js +0 -35
- package/dist/core/CReact.d.ts +0 -409
- package/dist/core/CReact.js +0 -1151
- package/dist/core/CloudDOMBuilder.d.ts +0 -447
- package/dist/core/CloudDOMBuilder.js +0 -1234
- package/dist/core/ContextDependencyTracker.d.ts +0 -165
- package/dist/core/ContextDependencyTracker.js +0 -448
- package/dist/core/ErrorRecoveryManager.d.ts +0 -145
- package/dist/core/ErrorRecoveryManager.js +0 -443
- package/dist/core/EventBus.d.ts +0 -91
- package/dist/core/EventBus.js +0 -185
- package/dist/core/ProviderOutputTracker.d.ts +0 -211
- package/dist/core/ProviderOutputTracker.js +0 -476
- package/dist/core/ReactiveUpdateQueue.d.ts +0 -76
- package/dist/core/ReactiveUpdateQueue.js +0 -121
- package/dist/core/Reconciler.d.ts +0 -415
- package/dist/core/Reconciler.js +0 -1044
- package/dist/core/RenderScheduler.d.ts +0 -153
- package/dist/core/RenderScheduler.js +0 -519
- package/dist/core/Renderer.d.ts +0 -336
- package/dist/core/Renderer.js +0 -944
- package/dist/core/Runtime.d.ts +0 -246
- package/dist/core/Runtime.js +0 -640
- package/dist/core/StateBindingManager.d.ts +0 -121
- package/dist/core/StateBindingManager.js +0 -309
- package/dist/core/StateMachine.d.ts +0 -441
- package/dist/core/StateMachine.js +0 -883
- package/dist/core/StructuralChangeDetector.d.ts +0 -140
- package/dist/core/StructuralChangeDetector.js +0 -363
- package/dist/core/Validator.d.ts +0 -127
- package/dist/core/Validator.js +0 -279
- package/dist/core/errors.d.ts +0 -153
- package/dist/core/errors.js +0 -202
- package/dist/core/index.d.ts +0 -38
- package/dist/core/index.js +0 -64
- package/dist/core/types.d.ts +0 -265
- package/dist/core/types.js +0 -48
- package/dist/hooks/context.d.ts +0 -147
- package/dist/hooks/context.js +0 -334
- package/dist/hooks/useContext.d.ts +0 -113
- package/dist/hooks/useContext.js +0 -169
- package/dist/hooks/useEffect.d.ts +0 -105
- package/dist/hooks/useEffect.js +0 -540
- package/dist/hooks/useInstance.d.ts +0 -139
- package/dist/hooks/useInstance.js +0 -455
- package/dist/hooks/useState.d.ts +0 -120
- package/dist/hooks/useState.js +0 -298
- package/dist/jsx.d.ts +0 -143
- package/dist/jsx.js +0 -76
- package/dist/providers/DummyBackendProvider.d.ts +0 -193
- package/dist/providers/DummyBackendProvider.js +0 -189
- package/dist/providers/DummyCloudProvider.d.ts +0 -128
- package/dist/providers/DummyCloudProvider.js +0 -157
- package/dist/providers/IBackendProvider.d.ts +0 -177
- package/dist/providers/IBackendProvider.js +0 -31
- package/dist/providers/ICloudProvider.d.ts +0 -230
- package/dist/providers/ICloudProvider.js +0 -31
- package/dist/providers/index.d.ts +0 -31
- package/dist/providers/index.js +0 -31
- package/dist/test-event-callbacks.d.ts +0 -0
- package/dist/test-event-callbacks.js +0 -1
- package/dist/utils/Logger.d.ts +0 -144
- package/dist/utils/Logger.js +0 -220
- package/dist/utils/Output.d.ts +0 -161
- package/dist/utils/Output.js +0 -401
- package/dist/utils/deepEqual.d.ts +0 -71
- package/dist/utils/deepEqual.js +0 -276
- package/dist/utils/naming.d.ts +0 -241
- package/dist/utils/naming.js +0 -376
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StateMachine - Resource lifecycle tracking and deployment orchestration
|
|
3
|
+
*
|
|
4
|
+
* Tracks:
|
|
5
|
+
* - Individual resource states (pending → applying → deployed)
|
|
6
|
+
* - Deployment lifecycle (start → checkpoint → complete/fail)
|
|
7
|
+
* - Resume capability from crash
|
|
8
|
+
*/
|
|
9
|
+
import type { Backend, DeploymentState, ResourceState, SerializedNode } from '../provider/backend';
|
|
10
|
+
export interface StateMachineOptions {
|
|
11
|
+
user?: string;
|
|
12
|
+
enableAuditLog?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* StateMachine manages deployment lifecycle and resource states
|
|
16
|
+
*/
|
|
17
|
+
export declare class StateMachine {
|
|
18
|
+
private backend;
|
|
19
|
+
private resourceStates;
|
|
20
|
+
private options;
|
|
21
|
+
constructor(backend: Backend, options?: StateMachineOptions);
|
|
22
|
+
/**
|
|
23
|
+
* Get the current state of a resource
|
|
24
|
+
*/
|
|
25
|
+
getResourceState(nodeId: string): ResourceState;
|
|
26
|
+
/**
|
|
27
|
+
* Set the state of a resource
|
|
28
|
+
*/
|
|
29
|
+
setResourceState(nodeId: string, state: ResourceState): void;
|
|
30
|
+
/**
|
|
31
|
+
* Restore resource states from persisted nodes
|
|
32
|
+
*/
|
|
33
|
+
restoreResourceStates(nodes: SerializedNode[]): void;
|
|
34
|
+
/**
|
|
35
|
+
* Clear all resource states
|
|
36
|
+
*/
|
|
37
|
+
clearResourceStates(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Start a new deployment
|
|
40
|
+
*/
|
|
41
|
+
startDeployment(stackName: string, nodes: SerializedNode[], changeStats?: {
|
|
42
|
+
creates: number;
|
|
43
|
+
updates: number;
|
|
44
|
+
deletes: number;
|
|
45
|
+
}): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Update a node's outputs in persisted state (for crash recovery)
|
|
48
|
+
* This is the real checkpoint - nodes with outputs are considered deployed
|
|
49
|
+
*/
|
|
50
|
+
updateNodeOutputs(stackName: string, nodeId: string, outputs: Record<string, any>): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Mark a node as currently being applied (for crash recovery)
|
|
53
|
+
*/
|
|
54
|
+
markApplying(stackName: string, nodeId: string): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Clear the applying marker after successful apply
|
|
57
|
+
*/
|
|
58
|
+
clearApplying(stackName: string): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Record a resource being applied
|
|
61
|
+
*/
|
|
62
|
+
recordResourceApplied(stackName: string, nodeId: string, outputs: Record<string, any>): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Record a resource being destroyed
|
|
65
|
+
*/
|
|
66
|
+
recordResourceDestroyed(stackName: string, nodeId: string): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Complete a successful deployment
|
|
69
|
+
*/
|
|
70
|
+
completeDeployment(stackName: string, nodes: SerializedNode[]): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Record a failed deployment
|
|
73
|
+
*/
|
|
74
|
+
failDeployment(stackName: string, error: Error): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Check if a deployment can be resumed
|
|
77
|
+
*/
|
|
78
|
+
canResume(stackName: string): Promise<boolean>;
|
|
79
|
+
/**
|
|
80
|
+
* Get the node that was being applied when crash occurred
|
|
81
|
+
*/
|
|
82
|
+
getInterruptedNodeId(stackName: string): Promise<string | null>;
|
|
83
|
+
/**
|
|
84
|
+
* Get previous deployment state
|
|
85
|
+
*/
|
|
86
|
+
getPreviousState(stackName: string): Promise<DeploymentState | null>;
|
|
87
|
+
/**
|
|
88
|
+
* Acquire deployment lock (if backend supports it)
|
|
89
|
+
*/
|
|
90
|
+
acquireLock(stackName: string, holder: string, ttlSeconds?: number): Promise<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* Release deployment lock (if backend supports it)
|
|
93
|
+
*/
|
|
94
|
+
releaseLock(stackName: string): Promise<void>;
|
|
95
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StateMachine - Resource lifecycle tracking and deployment orchestration
|
|
3
|
+
*
|
|
4
|
+
* Tracks:
|
|
5
|
+
* - Individual resource states (pending → applying → deployed)
|
|
6
|
+
* - Deployment lifecycle (start → checkpoint → complete/fail)
|
|
7
|
+
* - Resume capability from crash
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* StateMachine manages deployment lifecycle and resource states
|
|
11
|
+
*/
|
|
12
|
+
export class StateMachine {
|
|
13
|
+
backend;
|
|
14
|
+
resourceStates = new Map();
|
|
15
|
+
options;
|
|
16
|
+
constructor(backend, options = {}) {
|
|
17
|
+
this.backend = backend;
|
|
18
|
+
this.options = options;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the current state of a resource
|
|
22
|
+
*/
|
|
23
|
+
getResourceState(nodeId) {
|
|
24
|
+
return this.resourceStates.get(nodeId) ?? 'pending';
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Set the state of a resource
|
|
28
|
+
*/
|
|
29
|
+
setResourceState(nodeId, state) {
|
|
30
|
+
this.resourceStates.set(nodeId, state);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Restore resource states from persisted nodes
|
|
34
|
+
*/
|
|
35
|
+
restoreResourceStates(nodes) {
|
|
36
|
+
this.resourceStates.clear();
|
|
37
|
+
for (const node of nodes) {
|
|
38
|
+
// If node has outputs, it was previously deployed
|
|
39
|
+
const state = node.state ?? (node.outputs ? 'deployed' : 'pending');
|
|
40
|
+
this.resourceStates.set(node.id, state);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Clear all resource states
|
|
45
|
+
*/
|
|
46
|
+
clearResourceStates() {
|
|
47
|
+
this.resourceStates.clear();
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Start a new deployment
|
|
51
|
+
*/
|
|
52
|
+
async startDeployment(stackName, nodes, changeStats) {
|
|
53
|
+
const state = {
|
|
54
|
+
nodes,
|
|
55
|
+
status: 'applying',
|
|
56
|
+
stackName,
|
|
57
|
+
lastDeployedAt: Date.now(),
|
|
58
|
+
user: this.options.user,
|
|
59
|
+
};
|
|
60
|
+
await this.backend.saveState(stackName, state);
|
|
61
|
+
if (this.options.enableAuditLog && this.backend.appendAuditLog) {
|
|
62
|
+
await this.backend.appendAuditLog(stackName, {
|
|
63
|
+
timestamp: Date.now(),
|
|
64
|
+
action: 'deploy_start',
|
|
65
|
+
user: this.options.user,
|
|
66
|
+
details: changeStats,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Update a node's outputs in persisted state (for crash recovery)
|
|
72
|
+
* This is the real checkpoint - nodes with outputs are considered deployed
|
|
73
|
+
*/
|
|
74
|
+
async updateNodeOutputs(stackName, nodeId, outputs) {
|
|
75
|
+
const state = await this.backend.getState(stackName);
|
|
76
|
+
if (state) {
|
|
77
|
+
const node = state.nodes.find((n) => n.id === nodeId);
|
|
78
|
+
if (node) {
|
|
79
|
+
node.outputs = outputs;
|
|
80
|
+
await this.backend.saveState(stackName, state);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Mark a node as currently being applied (for crash recovery)
|
|
86
|
+
*/
|
|
87
|
+
async markApplying(stackName, nodeId) {
|
|
88
|
+
const state = await this.backend.getState(stackName);
|
|
89
|
+
if (state) {
|
|
90
|
+
state.applyingNodeId = nodeId;
|
|
91
|
+
await this.backend.saveState(stackName, state);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Clear the applying marker after successful apply
|
|
96
|
+
*/
|
|
97
|
+
async clearApplying(stackName) {
|
|
98
|
+
const state = await this.backend.getState(stackName);
|
|
99
|
+
if (state) {
|
|
100
|
+
state.applyingNodeId = undefined;
|
|
101
|
+
await this.backend.saveState(stackName, state);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Record a resource being applied
|
|
106
|
+
*/
|
|
107
|
+
async recordResourceApplied(stackName, nodeId, outputs) {
|
|
108
|
+
this.setResourceState(nodeId, 'deployed');
|
|
109
|
+
if (this.options.enableAuditLog && this.backend.appendAuditLog) {
|
|
110
|
+
await this.backend.appendAuditLog(stackName, {
|
|
111
|
+
timestamp: Date.now(),
|
|
112
|
+
action: 'resource_applied',
|
|
113
|
+
nodeId,
|
|
114
|
+
user: this.options.user,
|
|
115
|
+
details: { outputKeys: Object.keys(outputs) },
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Record a resource being destroyed
|
|
121
|
+
*/
|
|
122
|
+
async recordResourceDestroyed(stackName, nodeId) {
|
|
123
|
+
this.resourceStates.delete(nodeId);
|
|
124
|
+
if (this.options.enableAuditLog && this.backend.appendAuditLog) {
|
|
125
|
+
await this.backend.appendAuditLog(stackName, {
|
|
126
|
+
timestamp: Date.now(),
|
|
127
|
+
action: 'resource_destroyed',
|
|
128
|
+
nodeId,
|
|
129
|
+
user: this.options.user,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Complete a successful deployment
|
|
135
|
+
*/
|
|
136
|
+
async completeDeployment(stackName, nodes) {
|
|
137
|
+
const state = {
|
|
138
|
+
nodes,
|
|
139
|
+
status: 'deployed',
|
|
140
|
+
stackName,
|
|
141
|
+
lastDeployedAt: Date.now(),
|
|
142
|
+
user: this.options.user,
|
|
143
|
+
};
|
|
144
|
+
await this.backend.saveState(stackName, state);
|
|
145
|
+
if (this.options.enableAuditLog && this.backend.appendAuditLog) {
|
|
146
|
+
await this.backend.appendAuditLog(stackName, {
|
|
147
|
+
timestamp: Date.now(),
|
|
148
|
+
action: 'deploy_complete',
|
|
149
|
+
user: this.options.user,
|
|
150
|
+
details: { nodeCount: nodes.length },
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Record a failed deployment
|
|
156
|
+
*/
|
|
157
|
+
async failDeployment(stackName, error) {
|
|
158
|
+
const state = await this.backend.getState(stackName);
|
|
159
|
+
if (state) {
|
|
160
|
+
state.status = 'failed';
|
|
161
|
+
await this.backend.saveState(stackName, state);
|
|
162
|
+
}
|
|
163
|
+
if (this.options.enableAuditLog && this.backend.appendAuditLog) {
|
|
164
|
+
await this.backend.appendAuditLog(stackName, {
|
|
165
|
+
timestamp: Date.now(),
|
|
166
|
+
action: 'deploy_failed',
|
|
167
|
+
user: this.options.user,
|
|
168
|
+
details: { error: error.message },
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Check if a deployment can be resumed
|
|
174
|
+
*/
|
|
175
|
+
async canResume(stackName) {
|
|
176
|
+
const state = await this.backend.getState(stackName);
|
|
177
|
+
return state?.status === 'applying';
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Get the node that was being applied when crash occurred
|
|
181
|
+
*/
|
|
182
|
+
async getInterruptedNodeId(stackName) {
|
|
183
|
+
const state = await this.backend.getState(stackName);
|
|
184
|
+
return state?.applyingNodeId ?? null;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Get previous deployment state
|
|
188
|
+
*/
|
|
189
|
+
async getPreviousState(stackName) {
|
|
190
|
+
return this.backend.getState(stackName);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Acquire deployment lock (if backend supports it)
|
|
194
|
+
*/
|
|
195
|
+
async acquireLock(stackName, holder, ttlSeconds = 300) {
|
|
196
|
+
if (this.backend.acquireLock) {
|
|
197
|
+
return this.backend.acquireLock(stackName, holder, ttlSeconds);
|
|
198
|
+
}
|
|
199
|
+
return true; // No locking support, allow
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Release deployment lock (if backend supports it)
|
|
203
|
+
*/
|
|
204
|
+
async releaseLock(stackName) {
|
|
205
|
+
if (this.backend.releaseLock) {
|
|
206
|
+
await this.backend.releaseLock(stackName);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types
|
|
3
|
+
*/
|
|
4
|
+
export type { JSXElement } from './jsx/jsx-runtime';
|
|
5
|
+
export type { Context } from './primitives/context';
|
|
6
|
+
export type { InstanceNode, OutputAccessors } from './primitives/instance';
|
|
7
|
+
export type { SetStoreFunction } from './primitives/store';
|
|
8
|
+
export type { AuditLogEntry, Backend, DeploymentState, DeploymentStatus, ResourceState, SerializedNode, } from './provider/backend';
|
|
9
|
+
export type { Provider } from './provider/interface';
|
|
10
|
+
export type { Accessor, Computation, Setter, Signal } from './reactive/signal';
|
|
11
|
+
export type { Fiber } from './runtime/fiber';
|
|
12
|
+
export type { ChangeSet, DependencyGraph } from './runtime/reconcile';
|
|
13
|
+
export type { StateMachineOptions } from './runtime/state-machine';
|
package/dist/types.js
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@creact-labs/creact",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Declarative universal reactive runtime",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"typesVersions": {
|
|
@@ -26,26 +26,20 @@
|
|
|
26
26
|
"prepublishOnly": "npm run build"
|
|
27
27
|
},
|
|
28
28
|
"keywords": [
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
29
|
+
"reactive",
|
|
30
|
+
"declarative",
|
|
31
|
+
"runtime",
|
|
32
32
|
"jsx",
|
|
33
|
-
"
|
|
33
|
+
"ai-agents",
|
|
34
|
+
"automation",
|
|
35
|
+
"orchestration",
|
|
36
|
+
"workflow",
|
|
37
|
+
"infrastructure-as-code",
|
|
34
38
|
"cloud",
|
|
35
|
-
"terraform",
|
|
36
|
-
"aws",
|
|
37
|
-
"kubernetes",
|
|
38
39
|
"devops",
|
|
39
40
|
"deployment",
|
|
40
|
-
"orchestration",
|
|
41
|
-
"clouddom",
|
|
42
41
|
"reconciler",
|
|
43
|
-
"
|
|
44
|
-
"pulumi",
|
|
45
|
-
"cdk",
|
|
46
|
-
"helm",
|
|
47
|
-
"multi-cloud",
|
|
48
|
-
"declarative"
|
|
42
|
+
"multi-cloud"
|
|
49
43
|
],
|
|
50
44
|
"author": "Daniel Coutinho Ribeiro <dcoutinho.96@gmail.com>",
|
|
51
45
|
"license": "Apache-2.0",
|
|
@@ -67,25 +61,18 @@
|
|
|
67
61
|
],
|
|
68
62
|
"devDependencies": {
|
|
69
63
|
"@eslint/js": "^9.37.0",
|
|
70
|
-
"@types/better-sqlite3": "^7.6.13",
|
|
71
|
-
"@types/cli-progress": "^3.11.6",
|
|
72
64
|
"@types/node": "^20.0.0",
|
|
73
65
|
"@typescript-eslint/eslint-plugin": "^8.45.0",
|
|
74
66
|
"@typescript-eslint/parser": "^8.45.0",
|
|
75
|
-
"better-sqlite3": "^12.4.1",
|
|
76
67
|
"eslint": "^9.37.0",
|
|
77
68
|
"eslint-config-prettier": "^10.1.8",
|
|
78
69
|
"eslint-plugin-prettier": "^5.5.4",
|
|
79
70
|
"prettier": "^3.6.2",
|
|
80
|
-
"ts-node": "^10.9.2",
|
|
81
71
|
"typescript": "^5.0.0",
|
|
82
72
|
"typescript-eslint": "^8.45.0",
|
|
83
73
|
"vitest": "^3.2.4"
|
|
84
74
|
},
|
|
85
75
|
"dependencies": {
|
|
86
|
-
"chalk": "^4.1.2",
|
|
87
|
-
"cli-progress": "^3.12.0",
|
|
88
|
-
"ora": "^5.4.1",
|
|
89
76
|
"tsx": "^4.20.6"
|
|
90
77
|
}
|
|
91
78
|
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
|
|
17
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
-
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
|
|
23
|
-
* limitations under the License.
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
|
|
27
|
-
* Copyright 2025 Daniel Coutinho Ribeiro
|
|
28
|
-
|
|
29
|
-
*/
|
|
30
|
-
/**
|
|
31
|
-
* Build Command - builds CloudDOM from entry file
|
|
32
|
-
*/
|
|
33
|
-
import { BaseCommand, CommandResult } from '../core/BaseCommand';
|
|
34
|
-
export declare class BuildCommand extends BaseCommand {
|
|
35
|
-
getName(): string;
|
|
36
|
-
getDescription(): string;
|
|
37
|
-
execute(): Promise<CommandResult>;
|
|
38
|
-
private printVerboseOutput;
|
|
39
|
-
private countResources;
|
|
40
|
-
}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
-
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
|
|
20
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
|
|
22
|
-
* See the License for the specific language governing permissions and
|
|
23
|
-
|
|
24
|
-
* limitations under the License.
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
* Copyright 2025 Daniel Coutinho Ribeiro
|
|
29
|
-
|
|
30
|
-
*/
|
|
31
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.BuildCommand = void 0;
|
|
33
|
-
/**
|
|
34
|
-
* Build Command - builds CloudDOM from entry file
|
|
35
|
-
*/
|
|
36
|
-
const BaseCommand_1 = require("../core/BaseCommand");
|
|
37
|
-
const CLIContext_1 = require("../core/CLIContext");
|
|
38
|
-
const Output_1 = require("../../utils/Output");
|
|
39
|
-
const Logger_1 = require("../../utils/Logger");
|
|
40
|
-
const logger = Logger_1.LoggerFactory.getLogger('cli');
|
|
41
|
-
class BuildCommand extends BaseCommand_1.BaseCommand {
|
|
42
|
-
getName() {
|
|
43
|
-
return 'build';
|
|
44
|
-
}
|
|
45
|
-
getDescription() {
|
|
46
|
-
return 'Build CloudDOM from entry file';
|
|
47
|
-
}
|
|
48
|
-
async execute() {
|
|
49
|
-
const output = (0, Output_1.createOutputManager)({
|
|
50
|
-
json: this.json,
|
|
51
|
-
quiet: !!this.context.flags.quiet,
|
|
52
|
-
verbose: this.verbose,
|
|
53
|
-
});
|
|
54
|
-
try {
|
|
55
|
-
// Find entry file
|
|
56
|
-
logger.debug('BuildCommand: Starting execution');
|
|
57
|
-
let entryPath;
|
|
58
|
-
try {
|
|
59
|
-
entryPath = CLIContext_1.CLIContextManager.findEntryFile(this.context.flags.entry);
|
|
60
|
-
logger.debug(`BuildCommand: Entry file resolved to ${entryPath}`);
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
output.showError('Entry file resolution failed', {
|
|
64
|
-
cause: error.message,
|
|
65
|
-
stackTrace: this.verbose ? error.stack : undefined,
|
|
66
|
-
});
|
|
67
|
-
return { exitCode: 1 };
|
|
68
|
-
}
|
|
69
|
-
// Load entry file and create CLI instance
|
|
70
|
-
output.showInfo('Loading entry file and configuring providers...');
|
|
71
|
-
let result;
|
|
72
|
-
try {
|
|
73
|
-
result = await CLIContext_1.CLIContextManager.createCLIInstance(entryPath, this.verbose);
|
|
74
|
-
logger.debug(`BuildCommand: CloudDOM built with ${result.cloudDOM.length} resources`);
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
output.showError('Failed to load entry file and configure providers', {
|
|
78
|
-
cause: error.message,
|
|
79
|
-
stackTrace: this.verbose ? error.stack : undefined,
|
|
80
|
-
});
|
|
81
|
-
return { exitCode: 1 };
|
|
82
|
-
}
|
|
83
|
-
output.showSuccess('Entry file loaded and providers configured');
|
|
84
|
-
// Success output
|
|
85
|
-
const message = `Build complete: ${result.cloudDOM.length} resources`;
|
|
86
|
-
if (this.verbose && !this.json) {
|
|
87
|
-
this.printVerboseOutput(result, output);
|
|
88
|
-
}
|
|
89
|
-
output.showSuccess(message);
|
|
90
|
-
if (this.json) {
|
|
91
|
-
console.log(JSON.stringify({
|
|
92
|
-
status: 'success',
|
|
93
|
-
resourceCount: result.cloudDOM.length,
|
|
94
|
-
entryFile: entryPath,
|
|
95
|
-
stackName: result.stackName,
|
|
96
|
-
resources: result.cloudDOM.map((node) => ({
|
|
97
|
-
id: node.id,
|
|
98
|
-
type: node.construct?.name || 'Unknown',
|
|
99
|
-
path: node.path,
|
|
100
|
-
})),
|
|
101
|
-
}, null, 2));
|
|
102
|
-
}
|
|
103
|
-
return { exitCode: 0 };
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
output.showError('Build failed', {
|
|
107
|
-
cause: error.message,
|
|
108
|
-
stackTrace: this.verbose ? error.stack : undefined,
|
|
109
|
-
});
|
|
110
|
-
return { exitCode: 1 };
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
printVerboseOutput(result, output) {
|
|
114
|
-
console.log('\nCloudDOM Summary:');
|
|
115
|
-
const resourceCounts = this.countResources(result.cloudDOM);
|
|
116
|
-
if (Object.keys(resourceCounts).length === 0) {
|
|
117
|
-
console.log(' No resources found');
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
for (const [type, count] of Object.entries(resourceCounts)) {
|
|
121
|
-
console.log(` ${type}: ${count}`);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
// Show first few resource IDs for debugging
|
|
125
|
-
if (result.cloudDOM.length > 0) {
|
|
126
|
-
console.log('\nResource IDs:');
|
|
127
|
-
const sampleIds = result.cloudDOM.slice(0, 5).map((node) => node.id);
|
|
128
|
-
sampleIds.forEach((id) => {
|
|
129
|
-
console.log(` • ${id}`);
|
|
130
|
-
});
|
|
131
|
-
if (result.cloudDOM.length > 5) {
|
|
132
|
-
console.log(` ... and ${result.cloudDOM.length - 5} more`);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
countResources(cloudDOM) {
|
|
137
|
-
const counts = {};
|
|
138
|
-
const walk = (nodes) => {
|
|
139
|
-
for (const node of nodes) {
|
|
140
|
-
const type = node.construct?.name || 'Unknown';
|
|
141
|
-
counts[type] = (counts[type] || 0) + 1;
|
|
142
|
-
if (node.children && node.children.length > 0) {
|
|
143
|
-
walk(node.children);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
walk(cloudDOM);
|
|
148
|
-
return counts;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
exports.BuildCommand = BuildCommand;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
|
|
17
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
-
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
|
|
23
|
-
* limitations under the License.
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
|
|
27
|
-
* Copyright 2025 Daniel Coutinho Ribeiro
|
|
28
|
-
|
|
29
|
-
*/
|
|
30
|
-
/**
|
|
31
|
-
* Deploy Command - deploys CloudDOM to cloud provider
|
|
32
|
-
*/
|
|
33
|
-
import { BaseCommand, CommandResult } from '../core/BaseCommand';
|
|
34
|
-
export declare class DeployCommand extends BaseCommand {
|
|
35
|
-
getName(): string;
|
|
36
|
-
getDescription(): string;
|
|
37
|
-
execute(): Promise<CommandResult>;
|
|
38
|
-
}
|