@fractal_cloud/sdk 0.1.1 → 1.0.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 +68 -28
- package/dist/index.cjs +2070 -0
- package/dist/index.d.cts +1625 -0
- package/dist/index.d.mts +1625 -0
- package/dist/index.mjs +2029 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
|
|
10
10
|
## Overview
|
|
11
11
|
|
|
12
|
-
The Fractal TypeScript SDK is an early stage but production
|
|
12
|
+
The Fractal TypeScript SDK is an early stage but production ready SDK that allows platform engineers and application developers to define cloud agnostic infrastructure blueprints using TypeScript.
|
|
13
13
|
It is designed to bridge software architecture and infrastructure automation, enabling teams to express infrastructure intent in a general purpose language without relying on vendor specific tools or domain specific languages.
|
|
14
14
|
With Fractal, infrastructure is no longer written as low level scripts. It is modeled as reusable architectural building blocks that can be validated, governed, and evolved over time.
|
|
15
|
-
This SDK is currently at version
|
|
15
|
+
This SDK is currently at version 1.0.0. It supports Blueprint and Live System definition and deployment and is intended for early production pilots and platform experimentation.
|
|
16
16
|
|
|
17
17
|
## Why Fractal
|
|
18
18
|
|
|
@@ -44,12 +44,18 @@ You do not need prior knowledge of Fractal to use this SDK, the most important c
|
|
|
44
44
|
|
|
45
45
|
A Fractal is a governed, reusable infrastructure construct.
|
|
46
46
|
It defines what an infrastructure system is allowed to be, not just what it deploys.
|
|
47
|
+
It is composed by a Blueprint and an Interface.
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
#### Blueprint
|
|
49
50
|
|
|
50
51
|
A Blueprint is the static definition of a Fractal.
|
|
51
52
|
It describes components, their relationships, and their architectural intent.
|
|
52
53
|
|
|
54
|
+
#### Interface
|
|
55
|
+
|
|
56
|
+
An Interface is the versioned set of operations through which a Fractal can be specialized or extended.
|
|
57
|
+
These operations may involve the addition, removal, or modification of components and their integrations within the Fractal.
|
|
58
|
+
|
|
53
59
|
### Live System
|
|
54
60
|
|
|
55
61
|
A Live System is a running instance of a Fractal deployed to a cloud environment.
|
|
@@ -59,22 +65,20 @@ For a deeper explanation of Fractal Architecture, see the documentation linked b
|
|
|
59
65
|
|
|
60
66
|
## What this SDK does today
|
|
61
67
|
|
|
62
|
-
Version
|
|
68
|
+
Version 1.0.0 supports the following capabilities.
|
|
63
69
|
|
|
64
|
-
* Definition of Fractal Blueprints
|
|
70
|
+
* Definition of Fractal Blueprints
|
|
65
71
|
* Deployment of Blueprints to Fractal Cloud
|
|
72
|
+
* Definition of Live Systems
|
|
73
|
+
* Deployment of Live Systems to a specified Fractal Cloud Environment
|
|
66
74
|
* Usage from both personal and organization owned accounts
|
|
67
75
|
|
|
68
76
|
This SDK does not yet support:
|
|
69
77
|
|
|
70
|
-
*
|
|
71
|
-
* Component instantiation
|
|
72
|
-
* Lifecycle or operational actions
|
|
78
|
+
* Fractal Interface definition
|
|
73
79
|
* Bounded Context helpers
|
|
74
80
|
* Environment helpers
|
|
75
81
|
|
|
76
|
-
If you are looking to model architecture, validate concepts, or start early production pilots with Fractal Blueprints, this SDK is ready.
|
|
77
|
-
|
|
78
82
|
## Architectural positioning
|
|
79
83
|
|
|
80
84
|
The Fractal TypeScript SDK acts as a bridge between software architecture and infrastructure automation.
|
|
@@ -111,15 +115,25 @@ The following example defines and deploys the smallest useful Fractal Blueprint
|
|
|
111
115
|
It creates a Fractal with a single component and deploys the Blueprint to Fractal Cloud.
|
|
112
116
|
|
|
113
117
|
```js
|
|
118
|
+
// The Bounded Context ID is used to group Blueprints and Live System in order to granularly control access within an Organization
|
|
119
|
+
const bcId = BoundedContext.Id.getBuilder()
|
|
120
|
+
.withOwnerType(OwnerType.Personal)
|
|
121
|
+
.withOwnerId(OwnerId.getBuilder()
|
|
122
|
+
.withValue("00000000-0000-0000-0000-000000000000")
|
|
123
|
+
.build())
|
|
124
|
+
.withName(KebabCaseString.getBuilder().withValue("test").build())
|
|
125
|
+
.build();
|
|
126
|
+
|
|
127
|
+
// Service account credentials are obtained from environment variables
|
|
128
|
+
const serviceAccountCredentials = ServiceAccountCredentials.getBuilder()
|
|
129
|
+
.withId(ServiceAccountId.getBuilder().withValue(process.env['SERVICE_ACCOUNT_ID']).build())
|
|
130
|
+
.withSecret(process.env['SERVICE_ACCOUNT_SECRET'])
|
|
131
|
+
.build();
|
|
132
|
+
|
|
133
|
+
// The Fractal is defined using the Builder pattern
|
|
114
134
|
const fractal = Fractal.getBuilder()
|
|
115
135
|
.withId(Fractal.Id.getBuilder()
|
|
116
|
-
.withBoundedContextId(
|
|
117
|
-
.withOwnerType(OwnerType.Personal)
|
|
118
|
-
.withOwnerId(OwnerId.getBuilder()
|
|
119
|
-
.withValue("1896f44c-9ff6-4dde-9a6d-f8d621d6bcab")
|
|
120
|
-
.build())
|
|
121
|
-
.withName(KebabCaseString.getBuilder().withValue("test-ang").build())
|
|
122
|
-
.build())
|
|
136
|
+
.withBoundedContextId(bcId)
|
|
123
137
|
.withName(KebabCaseString.getBuilder().withValue("fractal-from-ts").build())
|
|
124
138
|
.withVersion(Version.getBuilder().withMajor(1).withMinor(0).withPatch(0).build())
|
|
125
139
|
.build())
|
|
@@ -138,13 +152,8 @@ const fractal = Fractal.getBuilder()
|
|
|
138
152
|
.build())
|
|
139
153
|
.build();
|
|
140
154
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
.withId(ServiceAccountId.getBuilder()
|
|
144
|
-
.withValue(process.env["SERVICE_ACCOUNT_ID"])
|
|
145
|
-
.build())
|
|
146
|
-
.withSecret(process.env["SERVICE_ACCOUNT_SECRET"])
|
|
147
|
-
.build());
|
|
155
|
+
// Blueprint deployment is initiated using the deploy method on the Fractal object
|
|
156
|
+
await fractal.deploy(serviceAccountCredentials);
|
|
148
157
|
```
|
|
149
158
|
Important notes:
|
|
150
159
|
|
|
@@ -152,6 +161,38 @@ Important notes:
|
|
|
152
161
|
* Deployment registers the Blueprint with Fractal Cloud
|
|
153
162
|
* No cloud resources are provisioned at this stage
|
|
154
163
|
|
|
164
|
+
The following code instead, uses the same Blueprint to deploy a Live System to a specified Fractal Cloud Environment.
|
|
165
|
+
|
|
166
|
+
```js
|
|
167
|
+
// The Live System is defined using the Builder pattern
|
|
168
|
+
const liveSystem = LiveSystem.getBuilder()
|
|
169
|
+
.withId(LiveSystem.Id.getBuilder()
|
|
170
|
+
.withBoundedContextId(bcId)
|
|
171
|
+
.withName(KebabCaseString.getBuilder().withValue("live-system-from-ts").build())
|
|
172
|
+
.build())
|
|
173
|
+
.withComponent(LiveSystem.Component.getBuilder()
|
|
174
|
+
.withId(fractal.components[0].id)
|
|
175
|
+
.withDescription(fractal.components[0].description)
|
|
176
|
+
.withType(fractal.components[0].type)
|
|
177
|
+
.withDisplayName(fractal.components[0].displayName)
|
|
178
|
+
.withVersion(fractal.components[0].version)
|
|
179
|
+
.build())
|
|
180
|
+
.withDescription('Live System deployed from TypeScript')
|
|
181
|
+
.withFractalId(fractal.id)
|
|
182
|
+
.withGenericProvider('Azure')
|
|
183
|
+
.withEnvironment(Environment.getBuilder()
|
|
184
|
+
.withId(Environment.Id.getBuilder()
|
|
185
|
+
.withOwnerType(OwnerType.Personal)
|
|
186
|
+
.withOwnerId(OwnerId.getBuilder().withValue('00000000-0000-0000-0000-000000000000').build())
|
|
187
|
+
.withName(KebabCaseString.getBuilder().withValue('test').build())
|
|
188
|
+
.build())
|
|
189
|
+
.build())
|
|
190
|
+
.build();
|
|
191
|
+
|
|
192
|
+
// Deployment is initiated using the deploy method on the Live System object
|
|
193
|
+
await liveSystem.deploy(serviceAccountCredentials);
|
|
194
|
+
```
|
|
195
|
+
|
|
155
196
|
## Current limitations
|
|
156
197
|
|
|
157
198
|
This version intentionally exposes the raw model.
|
|
@@ -168,10 +209,9 @@ These limitations are addressed in the roadmap below.
|
|
|
168
209
|
|
|
169
210
|
Planned development priorities are:
|
|
170
211
|
|
|
171
|
-
1.
|
|
172
|
-
2.
|
|
173
|
-
3.
|
|
174
|
-
4. Environment support
|
|
212
|
+
1. Syntax sugar and typed helpers
|
|
213
|
+
2. Bounded Context support
|
|
214
|
+
3. Environment support
|
|
175
215
|
|
|
176
216
|
The API is expected to evolve as these capabilities are introduced. Feedback from early users will directly influence design decisions.
|
|
177
217
|
|