@creact-labs/creact 0.1.8 → 0.2.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/README.md +85 -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 +29 -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
|
@@ -1,177 +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
|
-
* Lock information for state locking
|
|
32
|
-
* REQ-O02: State locking to prevent concurrent deployments
|
|
33
|
-
*/
|
|
34
|
-
export interface LockInfo {
|
|
35
|
-
/** Process/user holding the lock */
|
|
36
|
-
holder: string;
|
|
37
|
-
/** Timestamp when lock was acquired (milliseconds since epoch) */
|
|
38
|
-
acquiredAt: number;
|
|
39
|
-
/** Time-to-live in seconds */
|
|
40
|
-
ttl: number;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* IBackendProvider defines the interface for state storage backends.
|
|
44
|
-
* Implementations manage persistent state for CloudDOM trees and outputs.
|
|
45
|
-
*
|
|
46
|
-
* This interface supports dependency injection, allowing different backends
|
|
47
|
-
* (e.g., DummyBackendProvider for testing, S3BackendProvider for production)
|
|
48
|
-
* to be swapped without changing core CReact logic.
|
|
49
|
-
*
|
|
50
|
-
* @template TState - Type of state object stored (defaults to any for flexibility)
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```typescript
|
|
54
|
-
* class DummyBackendProvider implements IBackendProvider {
|
|
55
|
-
* private state = new Map<string, any>();
|
|
56
|
-
* private locks = new Map<string, LockInfo>();
|
|
57
|
-
*
|
|
58
|
-
* async initialize() {
|
|
59
|
-
* console.log('Backend initialized');
|
|
60
|
-
* }
|
|
61
|
-
*
|
|
62
|
-
* async getState(stackName: string): Promise<any | undefined> {
|
|
63
|
-
* return this.state.get(stackName);
|
|
64
|
-
* }
|
|
65
|
-
*
|
|
66
|
-
* async saveState(stackName: string, state: any): Promise<void> {
|
|
67
|
-
* this.state.set(stackName, state);
|
|
68
|
-
* }
|
|
69
|
-
*
|
|
70
|
-
* async acquireLock(stackName: string, holder: string, ttl: number): Promise<void> {
|
|
71
|
-
* // Implementation
|
|
72
|
-
* }
|
|
73
|
-
*
|
|
74
|
-
* async releaseLock(stackName: string): Promise<void> {
|
|
75
|
-
* this.locks.delete(stackName);
|
|
76
|
-
* }
|
|
77
|
-
*
|
|
78
|
-
* async checkLock(stackName: string): Promise<LockInfo | null> {
|
|
79
|
-
* return this.locks.get(stackName) || null;
|
|
80
|
-
* }
|
|
81
|
-
* }
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
export interface IBackendProvider<TState = any> {
|
|
85
|
-
/**
|
|
86
|
-
* Optional async initialization for remote connections (S3, DynamoDB, etc.)
|
|
87
|
-
* Called before any other provider methods.
|
|
88
|
-
*
|
|
89
|
-
* REQ-04.4: Support async initialization for providers that need to
|
|
90
|
-
* establish remote connections or load configuration.
|
|
91
|
-
*
|
|
92
|
-
* @returns Promise that resolves when initialization is complete
|
|
93
|
-
*/
|
|
94
|
-
initialize?(): Promise<void>;
|
|
95
|
-
/**
|
|
96
|
-
* Retrieve state for a given stack.
|
|
97
|
-
* Returns undefined if no state exists for the stack.
|
|
98
|
-
*
|
|
99
|
-
* REQ-04: Core provider interface for state retrieval
|
|
100
|
-
* REQ-05: State management for deployment tracking and idempotency
|
|
101
|
-
* REQ-06: Universal output access across stacks
|
|
102
|
-
*
|
|
103
|
-
* @param stackName - Name of the stack to retrieve state for
|
|
104
|
-
* @returns Promise resolving to stack state, or undefined if not found
|
|
105
|
-
*/
|
|
106
|
-
getState(stackName: string): Promise<TState | undefined>;
|
|
107
|
-
/**
|
|
108
|
-
* Save state for a given stack.
|
|
109
|
-
* State typically includes CloudDOM tree, outputs, and metadata.
|
|
110
|
-
*
|
|
111
|
-
* REQ-04: Core provider interface for state persistence
|
|
112
|
-
* REQ-05: State management for deployment tracking and idempotency
|
|
113
|
-
* REQ-08.5: Store migration map versions in backend state
|
|
114
|
-
*
|
|
115
|
-
* @param stackName - Name of the stack to save state for
|
|
116
|
-
* @param state - State object to persist (CloudDOM, outputs, metadata)
|
|
117
|
-
* @returns Promise that resolves when state is saved
|
|
118
|
-
*/
|
|
119
|
-
saveState(stackName: string, state: TState): Promise<void>;
|
|
120
|
-
/**
|
|
121
|
-
* Acquire lock for a stack to prevent concurrent deployments.
|
|
122
|
-
* Locking mechanism is backend-specific:
|
|
123
|
-
* - File backend: flock on .creact/.lock
|
|
124
|
-
* - S3 backend: DynamoDB conditional writes
|
|
125
|
-
* - Redis backend: SETNX with TTL
|
|
126
|
-
*
|
|
127
|
-
* REQ-O02: State locking to prevent concurrent deployments
|
|
128
|
-
* REQ-O02.1: WHEN deployment starts THEN CReact SHALL call acquireLock
|
|
129
|
-
* REQ-O02.2: WHEN lock is held THEN acquireLock SHALL throw error with lock holder info
|
|
130
|
-
*
|
|
131
|
-
* @param stackName - Name of the stack to lock
|
|
132
|
-
* @param holder - Identifier of the lock holder (user/process)
|
|
133
|
-
* @param ttl - Time-to-live in seconds (lock auto-expires after this duration)
|
|
134
|
-
* @throws Error if lock is already held and not expired
|
|
135
|
-
*/
|
|
136
|
-
acquireLock?(stackName: string, holder: string, ttl: number): Promise<void>;
|
|
137
|
-
/**
|
|
138
|
-
* Release lock for a stack.
|
|
139
|
-
*
|
|
140
|
-
* REQ-O02: State locking to prevent concurrent deployments
|
|
141
|
-
* REQ-O02.5: WHEN deployment completes THEN CReact SHALL call releaseLock
|
|
142
|
-
*
|
|
143
|
-
* @param stackName - Name of the stack to unlock
|
|
144
|
-
*/
|
|
145
|
-
releaseLock?(stackName: string): Promise<void>;
|
|
146
|
-
/**
|
|
147
|
-
* Check lock status for a stack.
|
|
148
|
-
* Returns lock info if lock exists, null otherwise.
|
|
149
|
-
*
|
|
150
|
-
* REQ-O02: State locking to prevent concurrent deployments
|
|
151
|
-
* REQ-O02.3: WHEN process crashes THEN lock SHALL have TTL and auto-expire
|
|
152
|
-
*
|
|
153
|
-
* @param stackName - Name of the stack to check
|
|
154
|
-
* @returns Lock info if lock exists, null otherwise
|
|
155
|
-
*/
|
|
156
|
-
checkLock?(stackName: string): Promise<LockInfo | null>;
|
|
157
|
-
/**
|
|
158
|
-
* Append audit log entry for compliance and debugging.
|
|
159
|
-
* Optional method for backends that support audit logging.
|
|
160
|
-
*
|
|
161
|
-
* REQ-O05: Audit log for compliance and debugging
|
|
162
|
-
*
|
|
163
|
-
* @param stackName - Name of the stack
|
|
164
|
-
* @param entry - Audit log entry to append
|
|
165
|
-
*/
|
|
166
|
-
appendAuditLog?(stackName: string, entry: any): Promise<void>;
|
|
167
|
-
/**
|
|
168
|
-
* Save state snapshot for time-travel debugging.
|
|
169
|
-
* Optional method for backends that support snapshots.
|
|
170
|
-
*
|
|
171
|
-
* REQ-O01: State snapshots for time-travel debugging
|
|
172
|
-
*
|
|
173
|
-
* @param stackName - Name of the stack
|
|
174
|
-
* @param state - State snapshot to save
|
|
175
|
-
*/
|
|
176
|
-
saveSnapshot?(stackName: string, state: TState): Promise<void>;
|
|
177
|
-
}
|
|
@@ -1,31 +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 });
|
|
@@ -1,230 +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
|
-
import { CloudDOMNode } from '../core/types';
|
|
31
|
-
/**
|
|
32
|
-
* OutputChangeEvent represents a provider output change notification
|
|
33
|
-
* Emitted when a resource's outputs become available or change
|
|
34
|
-
*/
|
|
35
|
-
export interface OutputChangeEvent {
|
|
36
|
-
/** CloudDOM node ID that changed */
|
|
37
|
-
nodeId: string;
|
|
38
|
-
/** New output values */
|
|
39
|
-
outputs: Record<string, any>;
|
|
40
|
-
/** Timestamp of the change */
|
|
41
|
-
timestamp: number;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* DriftDetectionResult represents the result of checking if a resource has drifted
|
|
45
|
-
*/
|
|
46
|
-
export interface DriftDetectionResult {
|
|
47
|
-
/** Resource ID that was checked */
|
|
48
|
-
nodeId: string;
|
|
49
|
-
/** Whether the resource has drifted from expected state */
|
|
50
|
-
hasDrifted: boolean;
|
|
51
|
-
/** Expected state from CloudDOM */
|
|
52
|
-
expectedState?: Record<string, any>;
|
|
53
|
-
/** Actual state from cloud provider */
|
|
54
|
-
actualState?: Record<string, any>;
|
|
55
|
-
/** Human-readable description of the drift */
|
|
56
|
-
driftDescription?: string;
|
|
57
|
-
/** Timestamp of the check */
|
|
58
|
-
timestamp: number;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* ICloudProvider defines the interface for cloud infrastructure providers.
|
|
62
|
-
* Implementations materialize CloudDOM trees into actual cloud resources.
|
|
63
|
-
*
|
|
64
|
-
* This interface supports dependency injection, allowing different providers
|
|
65
|
-
* (e.g., DummyCloudProvider for testing, CDKTFProvider for production) to be
|
|
66
|
-
* swapped without changing core CReact logic.
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```typescript
|
|
70
|
-
* class DummyCloudProvider implements ICloudProvider {
|
|
71
|
-
* async initialize() {
|
|
72
|
-
* console.log('Provider initialized');
|
|
73
|
-
* }
|
|
74
|
-
*
|
|
75
|
-
* materialize(cloudDOM: CloudDOMNode[], scope: any): void {
|
|
76
|
-
* console.log('Materializing:', cloudDOM);
|
|
77
|
-
* }
|
|
78
|
-
* }
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
export interface ICloudProvider {
|
|
82
|
-
/**
|
|
83
|
-
* Optional async initialization for remote connections (AWS, Vault, etc.)
|
|
84
|
-
* Called before any other provider methods.
|
|
85
|
-
*
|
|
86
|
-
* REQ-04.4: Support async initialization for providers that need to
|
|
87
|
-
* establish remote connections or load configuration.
|
|
88
|
-
*
|
|
89
|
-
* @returns Promise that resolves when initialization is complete
|
|
90
|
-
*/
|
|
91
|
-
initialize?(): Promise<void>;
|
|
92
|
-
/**
|
|
93
|
-
* Materialize CloudDOM tree into actual cloud resources.
|
|
94
|
-
* This is the core method that deploys infrastructure.
|
|
95
|
-
*
|
|
96
|
-
* REQ-04: Core provider interface for cloud resource creation
|
|
97
|
-
*
|
|
98
|
-
* @param cloudDOM - Array of CloudDOM nodes to materialize
|
|
99
|
-
* @param scope - Optional provider-specific scope object (e.g., CDKTF App)
|
|
100
|
-
*/
|
|
101
|
-
materialize(cloudDOM: CloudDOMNode[], scope?: any): void;
|
|
102
|
-
/**
|
|
103
|
-
* Optional lifecycle hook called before deployment begins.
|
|
104
|
-
* Use for validation, logging, or pre-deployment checks.
|
|
105
|
-
*
|
|
106
|
-
* REQ-09.1: preDeploy lifecycle hook for auditing and validation
|
|
107
|
-
*
|
|
108
|
-
* @param cloudDOM - CloudDOM tree about to be deployed
|
|
109
|
-
* @returns Promise that resolves when pre-deployment tasks complete
|
|
110
|
-
* @throws Error if pre-deployment checks fail (halts deployment)
|
|
111
|
-
*/
|
|
112
|
-
preDeploy?(cloudDOM: CloudDOMNode[]): Promise<void>;
|
|
113
|
-
/**
|
|
114
|
-
* Optional lifecycle hook called after successful deployment.
|
|
115
|
-
* Use for logging, metrics collection, or post-deployment actions.
|
|
116
|
-
*
|
|
117
|
-
* REQ-09.2: postDeploy lifecycle hook for observability
|
|
118
|
-
*
|
|
119
|
-
* @param cloudDOM - CloudDOM tree that was deployed
|
|
120
|
-
* @param outputs - Collected outputs from deployed resources
|
|
121
|
-
* @returns Promise that resolves when post-deployment tasks complete
|
|
122
|
-
*/
|
|
123
|
-
postDeploy?(cloudDOM: CloudDOMNode[], outputs: Record<string, any>): Promise<void>;
|
|
124
|
-
/**
|
|
125
|
-
* Optional lifecycle hook called when deployment fails.
|
|
126
|
-
* Use for error logging, cleanup, or alerting.
|
|
127
|
-
*
|
|
128
|
-
* REQ-09.3: onError lifecycle hook for error handling
|
|
129
|
-
*
|
|
130
|
-
* @param error - Error that caused deployment to fail
|
|
131
|
-
* @param cloudDOM - CloudDOM tree that failed to deploy
|
|
132
|
-
* @returns Promise that resolves when error handling completes
|
|
133
|
-
*/
|
|
134
|
-
onError?(error: Error, cloudDOM: CloudDOMNode[]): Promise<void>;
|
|
135
|
-
/**
|
|
136
|
-
* Subscribe to output change events (optional - for event-driven reactivity)
|
|
137
|
-
* Providers can emit events when resource outputs become available
|
|
138
|
-
*
|
|
139
|
-
* This enables real-time reactivity without polling:
|
|
140
|
-
* - Provider emits when outputs are ready
|
|
141
|
-
* - Orchestrator subscribes and triggers re-renders
|
|
142
|
-
* - useEffect callbacks can react to specific output changes
|
|
143
|
-
*
|
|
144
|
-
* @param event - Event type to subscribe to
|
|
145
|
-
* @param handler - Callback function to handle the event
|
|
146
|
-
*/
|
|
147
|
-
on?(event: 'outputsChanged', handler: (change: OutputChangeEvent) => void): void;
|
|
148
|
-
/**
|
|
149
|
-
* Unsubscribe from output change events
|
|
150
|
-
*
|
|
151
|
-
* @param event - Event type to unsubscribe from
|
|
152
|
-
* @param handler - Callback function to remove
|
|
153
|
-
*/
|
|
154
|
-
off?(event: 'outputsChanged', handler: (change: OutputChangeEvent) => void): void;
|
|
155
|
-
/**
|
|
156
|
-
* Emit output change event (used by provider implementations)
|
|
157
|
-
* Internal method for providers to notify subscribers
|
|
158
|
-
*
|
|
159
|
-
* @param event - Event type
|
|
160
|
-
* @param change - Output change details
|
|
161
|
-
*/
|
|
162
|
-
emit?(event: 'outputsChanged', change: OutputChangeEvent): void;
|
|
163
|
-
/**
|
|
164
|
-
* Detect drift for a specific resource (REQUIRED)
|
|
165
|
-
*
|
|
166
|
-
* Compares the expected state (from CloudDOM) with the actual state
|
|
167
|
-
* (from the cloud provider) to detect if the resource has drifted.
|
|
168
|
-
*
|
|
169
|
-
* This is called by CReact automatically during:
|
|
170
|
-
* - Every state load (to detect stale state)
|
|
171
|
-
* - Plan command (to show drift before deployment)
|
|
172
|
-
* - Deploy command (to ensure state accuracy)
|
|
173
|
-
*
|
|
174
|
-
* Providers MUST implement this to ensure state accuracy.
|
|
175
|
-
*
|
|
176
|
-
* @param node - CloudDOM node representing expected state
|
|
177
|
-
* @returns Promise resolving to drift detection result
|
|
178
|
-
*
|
|
179
|
-
* @example
|
|
180
|
-
* ```typescript
|
|
181
|
-
* async detectDrift(node: CloudDOMNode): Promise<DriftDetectionResult> {
|
|
182
|
-
* // For resources without outputs, no drift possible
|
|
183
|
-
* if (!node.outputs) {
|
|
184
|
-
* return { nodeId: node.id, hasDrifted: false, timestamp: Date.now() };
|
|
185
|
-
* }
|
|
186
|
-
*
|
|
187
|
-
* const actualState = await this.getActualResourceState(node.id);
|
|
188
|
-
* const hasDrifted = !this.statesMatch(node.outputs, actualState);
|
|
189
|
-
*
|
|
190
|
-
* return {
|
|
191
|
-
* nodeId: node.id,
|
|
192
|
-
* hasDrifted,
|
|
193
|
-
* expectedState: node.outputs,
|
|
194
|
-
* actualState,
|
|
195
|
-
* driftDescription: hasDrifted ? 'Resource no longer exists' : undefined,
|
|
196
|
-
* timestamp: Date.now(),
|
|
197
|
-
* };
|
|
198
|
-
* }
|
|
199
|
-
* ```
|
|
200
|
-
*/
|
|
201
|
-
detectDrift(node: CloudDOMNode): Promise<DriftDetectionResult>;
|
|
202
|
-
/**
|
|
203
|
-
* Refresh resource state from actual cloud provider (REQUIRED)
|
|
204
|
-
*
|
|
205
|
-
* Queries the actual state of a resource and updates the node's outputs
|
|
206
|
-
* to reflect reality. This is the mechanism for fixing drift.
|
|
207
|
-
*
|
|
208
|
-
* Called automatically by CReact when drift is detected.
|
|
209
|
-
*
|
|
210
|
-
* Providers MUST implement this to enable automatic drift recovery.
|
|
211
|
-
*
|
|
212
|
-
* @param node - CloudDOM node to refresh
|
|
213
|
-
* @returns Promise resolving when refresh is complete (node.outputs updated)
|
|
214
|
-
*
|
|
215
|
-
* @example
|
|
216
|
-
* ```typescript
|
|
217
|
-
* async refreshState(node: CloudDOMNode): Promise<void> {
|
|
218
|
-
* const actualState = await this.getActualResourceState(node.id);
|
|
219
|
-
* if (actualState) {
|
|
220
|
-
* // Resource exists - update outputs to match reality
|
|
221
|
-
* node.outputs = actualState;
|
|
222
|
-
* } else {
|
|
223
|
-
* // Resource doesn't exist - clear outputs to force redeployment
|
|
224
|
-
* node.outputs = undefined;
|
|
225
|
-
* }
|
|
226
|
-
* }
|
|
227
|
-
* ```
|
|
228
|
-
*/
|
|
229
|
-
refreshState(node: CloudDOMNode): Promise<void>;
|
|
230
|
-
}
|
|
@@ -1,31 +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 });
|
|
@@ -1,31 +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
|
-
export { ICloudProvider } from './ICloudProvider';
|
|
31
|
-
export { IBackendProvider } from './IBackendProvider';
|
package/dist/providers/index.js
DELETED
|
@@ -1,31 +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 });
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/utils/Logger.d.ts
DELETED
|
@@ -1,144 +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
|
-
* Logger - Internal debugging and diagnostics only
|
|
32
|
-
*
|
|
33
|
-
* IMPORTANT: This logger is for INTERNAL debugging only, not user-facing output.
|
|
34
|
-
* - All output goes to stderr (not stdout)
|
|
35
|
-
* - Controlled by --verbose flag or CREACT_DEBUG environment variable
|
|
36
|
-
* - For user-facing messages, use OutputManager (src/utils/Output.ts)
|
|
37
|
-
*
|
|
38
|
-
* Usage:
|
|
39
|
-
* - logger.debug() - Internal state tracking, algorithm steps
|
|
40
|
-
* - logger.info() - Internal lifecycle events (not user messages)
|
|
41
|
-
* - logger.warn() - Internal warnings
|
|
42
|
-
* - logger.error() - Internal errors with stack traces
|
|
43
|
-
*/
|
|
44
|
-
/**
|
|
45
|
-
* Log levels in order of severity
|
|
46
|
-
*/
|
|
47
|
-
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
48
|
-
/**
|
|
49
|
-
* Standard log scopes for CReact subsystems
|
|
50
|
-
*/
|
|
51
|
-
export type LogScope = 'renderer' | 'reconciler' | 'validator' | 'clouddom' | 'state-machine' | 'provider' | 'hooks' | 'cli' | 'runtime' | 'parallel';
|
|
52
|
-
/**
|
|
53
|
-
* Logger configuration
|
|
54
|
-
*/
|
|
55
|
-
export interface LoggerConfig {
|
|
56
|
-
/** Enabled scopes (or ['*'] for all) */
|
|
57
|
-
scopes: string[];
|
|
58
|
-
/** Minimum log level */
|
|
59
|
-
level: LogLevel;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Scoped logger with level filtering
|
|
63
|
-
*/
|
|
64
|
-
export declare class Logger {
|
|
65
|
-
private readonly scope;
|
|
66
|
-
private readonly config;
|
|
67
|
-
private readonly context;
|
|
68
|
-
private readonly enabled;
|
|
69
|
-
constructor(scope: LogScope, config: LoggerConfig, context?: Record<string, any>);
|
|
70
|
-
/**
|
|
71
|
-
* Log a debug message
|
|
72
|
-
*/
|
|
73
|
-
debug(message: string, ...args: any[]): void;
|
|
74
|
-
/**
|
|
75
|
-
* Log an info message
|
|
76
|
-
*/
|
|
77
|
-
info(message: string, ...args: any[]): void;
|
|
78
|
-
/**
|
|
79
|
-
* Log a warning message
|
|
80
|
-
*/
|
|
81
|
-
warn(message: string, ...args: any[]): void;
|
|
82
|
-
/**
|
|
83
|
-
* Log an error message
|
|
84
|
-
*/
|
|
85
|
-
error(message: string, ...args: any[]): void;
|
|
86
|
-
/**
|
|
87
|
-
* Create a child logger with additional context
|
|
88
|
-
*/
|
|
89
|
-
child(additionalContext: Record<string, any>): Logger;
|
|
90
|
-
/**
|
|
91
|
-
* Internal log method with filtering
|
|
92
|
-
*/
|
|
93
|
-
private log;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Logger factory for creating scoped loggers
|
|
97
|
-
*/
|
|
98
|
-
export declare class LoggerFactory {
|
|
99
|
-
private static config;
|
|
100
|
-
/**
|
|
101
|
-
* Configure the logger factory
|
|
102
|
-
*/
|
|
103
|
-
static configure(config: Partial<LoggerConfig>): void;
|
|
104
|
-
/**
|
|
105
|
-
* Get a logger for a specific scope
|
|
106
|
-
*/
|
|
107
|
-
static getLogger(scope: LogScope): Logger;
|
|
108
|
-
/**
|
|
109
|
-
* Parse configuration from environment variables
|
|
110
|
-
* Supports CREACT_LOG=scope1,scope2 or CREACT_LOG=*
|
|
111
|
-
* Supports CREACT_LOG_LEVEL=debug|info|warn|error
|
|
112
|
-
*/
|
|
113
|
-
static configureFromEnv(): void;
|
|
114
|
-
/**
|
|
115
|
-
* Parse configuration from CLI flags
|
|
116
|
-
* Supports --log=scope1,scope2 or --log=*
|
|
117
|
-
* Supports --log-level=debug|info|warn|error
|
|
118
|
-
*/
|
|
119
|
-
static configureFromCLI(args: {
|
|
120
|
-
log?: string;
|
|
121
|
-
logLevel?: string;
|
|
122
|
-
}): void;
|
|
123
|
-
/**
|
|
124
|
-
* Parse configuration from config file
|
|
125
|
-
*/
|
|
126
|
-
static configureFromFile(fileConfig: {
|
|
127
|
-
log?: {
|
|
128
|
-
scopes?: string[];
|
|
129
|
-
level?: string;
|
|
130
|
-
};
|
|
131
|
-
}): void;
|
|
132
|
-
/**
|
|
133
|
-
* Get current configuration
|
|
134
|
-
*/
|
|
135
|
-
static getConfig(): LoggerConfig;
|
|
136
|
-
/**
|
|
137
|
-
* Reset configuration to defaults
|
|
138
|
-
*/
|
|
139
|
-
static reset(): void;
|
|
140
|
-
/**
|
|
141
|
-
* Check if a string is a valid log level
|
|
142
|
-
*/
|
|
143
|
-
private static isValidLogLevel;
|
|
144
|
-
}
|