@webiny/mcp 6.0.0-rc.5 → 6.0.0-rc.7
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/package.json +4 -4
- package/skills/api-custom-feature/SKILL.md +195 -0
- package/skills/configure-auth0/SKILL.md +302 -0
- package/skills/configure-okta/SKILL.md +303 -0
- package/skills/custom-graphql-api/SKILL.md +145 -135
- package/skills/dependency-injection/SKILL.md +277 -149
- package/skills/infrastructure-extensions/SKILL.md +84 -66
- package/skills/lifecycle-events/SKILL.md +151 -6
- package/skills/local-development/SKILL.md +25 -16
|
@@ -25,19 +25,19 @@ import { Ui } from "webiny/infra";
|
|
|
25
25
|
import { CorePulumi } from "webiny/infra/core";
|
|
26
26
|
|
|
27
27
|
class MyCorePulumiHandlerImpl implements CorePulumi.Interface {
|
|
28
|
-
|
|
28
|
+
constructor(private ui: Ui.Interface) {}
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
execute(app: any) {
|
|
31
|
+
this.ui.info("Executing MyCorePulumiHandler with environment:", app.env);
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
// Access and modify Pulumi resources here
|
|
34
|
+
// app.resources gives you access to all provisioned resources
|
|
35
|
+
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export default CorePulumi.createImplementation({
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
implementation: MyCorePulumiHandlerImpl,
|
|
40
|
+
dependencies: [Ui]
|
|
41
41
|
});
|
|
42
42
|
```
|
|
43
43
|
|
|
@@ -72,30 +72,38 @@ These components go directly in `webiny.config.tsx` -- no separate extension fil
|
|
|
72
72
|
### Search & Networking
|
|
73
73
|
|
|
74
74
|
```tsx
|
|
75
|
-
{
|
|
76
|
-
|
|
75
|
+
{
|
|
76
|
+
/* Enable/disable OpenSearch */
|
|
77
|
+
}
|
|
78
|
+
<Infra.OpenSearch enabled={true} />;
|
|
77
79
|
|
|
78
|
-
{
|
|
79
|
-
|
|
80
|
+
{
|
|
81
|
+
/* Enable/disable VPC deployment */
|
|
82
|
+
}
|
|
83
|
+
<Infra.Vpc enabled={false} />;
|
|
80
84
|
```
|
|
81
85
|
|
|
82
86
|
### Resource Naming
|
|
83
87
|
|
|
84
88
|
```tsx
|
|
85
|
-
{
|
|
86
|
-
|
|
89
|
+
{
|
|
90
|
+
/* Prefix all Pulumi resource names */
|
|
91
|
+
}
|
|
92
|
+
<Infra.PulumiResourceNamePrefix prefix={"myproj-"} />;
|
|
87
93
|
|
|
88
|
-
{
|
|
89
|
-
|
|
94
|
+
{
|
|
95
|
+
/* Define which environments use production-grade infrastructure */
|
|
96
|
+
}
|
|
97
|
+
<Infra.ProductionEnvironments environments={["prod", "staging"]} />;
|
|
90
98
|
```
|
|
91
99
|
|
|
92
100
|
### Custom Domains
|
|
93
101
|
|
|
94
102
|
```tsx
|
|
95
103
|
<Infra.Admin.CustomDomains
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
104
|
+
domains={["admin.example.com"]}
|
|
105
|
+
sslMethod="sni-only"
|
|
106
|
+
certificateArn="arn:aws:acm:us-east-1:123456789:certificate/abc-123"
|
|
99
107
|
/>
|
|
100
108
|
```
|
|
101
109
|
|
|
@@ -103,21 +111,21 @@ These components go directly in `webiny.config.tsx` -- no separate extension fil
|
|
|
103
111
|
|
|
104
112
|
```tsx
|
|
105
113
|
<Infra.BlueGreenDeployments
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
114
|
+
enabled={true}
|
|
115
|
+
domains={{
|
|
116
|
+
acmCertificateArn: "arn:aws:acm:us-east-1:123456789:certificate/abc-123",
|
|
117
|
+
sslSupportMethod: "sni-only",
|
|
118
|
+
domains: {
|
|
119
|
+
api: ["api.example.com"],
|
|
120
|
+
admin: ["admin.example.com"],
|
|
121
|
+
website: ["website.example.com"],
|
|
122
|
+
preview: ["preview.example.com"]
|
|
123
|
+
}
|
|
124
|
+
}}
|
|
125
|
+
deployments={[
|
|
126
|
+
{ name: "green", env: "dev", variant: "green" },
|
|
127
|
+
{ name: "blue", env: "dev", variant: "blue" }
|
|
128
|
+
]}
|
|
121
129
|
/>
|
|
122
130
|
```
|
|
123
131
|
|
|
@@ -126,54 +134,64 @@ These components go directly in `webiny.config.tsx` -- no separate extension fil
|
|
|
126
134
|
Use `<Infra.Env.Is>` to apply settings only in specific environments:
|
|
127
135
|
|
|
128
136
|
```tsx
|
|
129
|
-
{
|
|
137
|
+
{
|
|
138
|
+
/* Production only */
|
|
139
|
+
}
|
|
130
140
|
<Infra.Env.Is env="prod">
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
</Infra.Env.Is
|
|
141
|
+
<Infra.Aws.Tags tags={{ ENV: "production" }} />
|
|
142
|
+
<Infra.OpenSearch enabled={true} />
|
|
143
|
+
</Infra.Env.Is>;
|
|
134
144
|
|
|
135
|
-
{
|
|
145
|
+
{
|
|
146
|
+
/* Non-production (accepts array) */
|
|
147
|
+
}
|
|
136
148
|
<Infra.Env.Is env={["dev", "staging"]}>
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
</Infra.Env.Is
|
|
149
|
+
<Infra.Aws.Tags tags={{ ENV: "non-production" }} />
|
|
150
|
+
<Infra.OpenSearch enabled={false} />
|
|
151
|
+
</Infra.Env.Is>;
|
|
140
152
|
```
|
|
141
153
|
|
|
142
154
|
## Project-Level Settings
|
|
143
155
|
|
|
144
156
|
```tsx
|
|
145
|
-
{
|
|
146
|
-
|
|
157
|
+
{
|
|
158
|
+
/* Disable telemetry */
|
|
159
|
+
}
|
|
160
|
+
<Project.Telemetry enabled={false} />;
|
|
147
161
|
|
|
148
|
-
{
|
|
149
|
-
|
|
162
|
+
{
|
|
163
|
+
/* Auto-install for CI/CD (skip the installation wizard) */
|
|
164
|
+
}
|
|
165
|
+
{
|
|
166
|
+
process.env.WEBINY_CLI_AUTO_INSTALL && (
|
|
150
167
|
<Project.AutoInstall
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
168
|
+
adminUser={{
|
|
169
|
+
firstName: "Ad",
|
|
170
|
+
lastName: "Min",
|
|
171
|
+
email: "admin@webiny.com",
|
|
172
|
+
password: "12345678"
|
|
173
|
+
}}
|
|
157
174
|
/>
|
|
158
|
-
)
|
|
175
|
+
);
|
|
176
|
+
}
|
|
159
177
|
```
|
|
160
178
|
|
|
161
179
|
## All Infrastructure Components Reference
|
|
162
180
|
|
|
163
|
-
| Component
|
|
164
|
-
|
|
165
|
-
| `<Infra.Aws.DefaultRegion name="..." />`
|
|
166
|
-
| `<Infra.Aws.Tags tags={{ ... }} />`
|
|
167
|
-
| `<Infra.OpenSearch enabled={bool} />`
|
|
168
|
-
| `<Infra.Vpc enabled={bool} />`
|
|
169
|
-
| `<Infra.PulumiResourceNamePrefix prefix="..." />`
|
|
181
|
+
| Component | Purpose |
|
|
182
|
+
| ------------------------------------------------------- | ------------------------------------ |
|
|
183
|
+
| `<Infra.Aws.DefaultRegion name="..." />` | Set the AWS region |
|
|
184
|
+
| `<Infra.Aws.Tags tags={{ ... }} />` | Tag all AWS resources |
|
|
185
|
+
| `<Infra.OpenSearch enabled={bool} />` | Enable/disable OpenSearch cluster |
|
|
186
|
+
| `<Infra.Vpc enabled={bool} />` | Enable/disable VPC deployment |
|
|
187
|
+
| `<Infra.PulumiResourceNamePrefix prefix="..." />` | Prefix Pulumi resource names |
|
|
170
188
|
| `<Infra.ProductionEnvironments environments={[...]} />` | Define production-grade environments |
|
|
171
|
-
| `<Infra.Admin.CustomDomains ... />`
|
|
172
|
-
| `<Infra.BlueGreenDeployments ... />`
|
|
173
|
-
| `<Infra.Env.Is env="..." />`
|
|
174
|
-
| `<Infra.Core.Pulumi src="..." />`
|
|
175
|
-
| `<Project.Telemetry enabled={bool} />`
|
|
176
|
-
| `<Project.AutoInstall adminUser={{ ... }} />`
|
|
189
|
+
| `<Infra.Admin.CustomDomains ... />` | Custom domains for Admin app |
|
|
190
|
+
| `<Infra.BlueGreenDeployments ... />` | Blue-green deployment configuration |
|
|
191
|
+
| `<Infra.Env.Is env="..." />` | Conditional config per environment |
|
|
192
|
+
| `<Infra.Core.Pulumi src="..." />` | Register a custom Pulumi handler |
|
|
193
|
+
| `<Project.Telemetry enabled={bool} />` | Enable/disable telemetry |
|
|
194
|
+
| `<Project.AutoInstall adminUser={{ ... }} />` | Auto-install for CI/CD |
|
|
177
195
|
|
|
178
196
|
## Quick Reference
|
|
179
197
|
|
|
@@ -37,7 +37,7 @@ Every handler receives an `event` with:
|
|
|
37
37
|
|
|
38
38
|
- `event.modelId` -- The model ID string (e.g., `"contactSubmission"`)
|
|
39
39
|
- `event.payload` -- The entry data object
|
|
40
|
-
|
|
40
|
+
- `event.payload.values` -- The field values (can be mutated in `before` hooks)
|
|
41
41
|
|
|
42
42
|
### Pattern
|
|
43
43
|
|
|
@@ -153,11 +153,11 @@ export default Handler.createImplementation({
|
|
|
153
153
|
|
|
154
154
|
```typescript
|
|
155
155
|
// extensions/MyApiKeyAfterUpdate.ts
|
|
156
|
-
import {
|
|
156
|
+
import { ApiKeyAfterUpdateEventHandler } from "webiny/api/security/api-key";
|
|
157
157
|
import { Logger } from "webiny/api/logger";
|
|
158
158
|
import { BuildParams } from "webiny/api/build-params";
|
|
159
159
|
|
|
160
|
-
class MyApiKeyAfterUpdateImpl implements
|
|
160
|
+
class MyApiKeyAfterUpdateImpl implements ApiKeyAfterUpdateEventHandler.Interface {
|
|
161
161
|
constructor(
|
|
162
162
|
private logger: Logger.Interface,
|
|
163
163
|
private buildParams: BuildParams.Interface
|
|
@@ -171,7 +171,7 @@ class MyApiKeyAfterUpdateImpl implements ApiKeyAfterUpdateHandler.Interface {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
const MyApiKeyAfterUpdate =
|
|
174
|
+
const MyApiKeyAfterUpdate = ApiKeyAfterUpdateEventHandler.createImplementation({
|
|
175
175
|
implementation: MyApiKeyAfterUpdateImpl,
|
|
176
176
|
dependencies: [Logger, BuildParams]
|
|
177
177
|
});
|
|
@@ -185,11 +185,156 @@ Register with a dedicated JSX element:
|
|
|
185
185
|
<Security.ApiKey.AfterUpdate src={"/extensions/MyApiKeyAfterUpdate.ts"} />
|
|
186
186
|
```
|
|
187
187
|
|
|
188
|
+
## All Available Event Handlers
|
|
189
|
+
|
|
190
|
+
### `webiny/api/cms/entry`
|
|
191
|
+
|
|
192
|
+
| Handler | Fires When |
|
|
193
|
+
| --- | --- |
|
|
194
|
+
| `EntryBeforeCreateEventHandler` | Before a new entry is saved |
|
|
195
|
+
| `EntryAfterCreateEventHandler` | After a new entry is saved |
|
|
196
|
+
| `EntryRevisionBeforeCreateEventHandler` | Before a revision is created |
|
|
197
|
+
| `EntryRevisionAfterCreateEventHandler` | After a revision is created |
|
|
198
|
+
| `EntryBeforeUpdateEventHandler` | Before an entry is updated |
|
|
199
|
+
| `EntryAfterUpdateEventHandler` | After an entry is updated |
|
|
200
|
+
| `EntryBeforeDeleteEventHandler` | Before an entry is deleted |
|
|
201
|
+
| `EntryAfterDeleteEventHandler` | After an entry is deleted |
|
|
202
|
+
| `EntryRevisionBeforeDeleteEventHandler` | Before a revision is deleted |
|
|
203
|
+
| `EntryRevisionAfterDeleteEventHandler` | After a revision is deleted |
|
|
204
|
+
| `EntryBeforeDeleteMultipleEventHandler` | Before multiple entries are deleted |
|
|
205
|
+
| `EntryAfterDeleteMultipleEventHandler` | After multiple entries are deleted |
|
|
206
|
+
| `EntryBeforeMoveEventHandler` | Before an entry is moved |
|
|
207
|
+
| `EntryAfterMoveEventHandler` | After an entry is moved |
|
|
208
|
+
| `EntryBeforePublishEventHandler` | Before an entry is published |
|
|
209
|
+
| `EntryAfterPublishEventHandler` | After an entry is published |
|
|
210
|
+
| `EntryBeforeRepublishEventHandler` | Before an entry is republished |
|
|
211
|
+
| `EntryAfterRepublishEventHandler` | After an entry is republished |
|
|
212
|
+
| `EntryBeforeRestoreFromBinEventHandler` | Before an entry is restored from bin |
|
|
213
|
+
| `EntryAfterRestoreFromBinEventHandler` | After an entry is restored from bin |
|
|
214
|
+
| `EntryBeforeUnpublishEventHandler` | Before an entry is unpublished |
|
|
215
|
+
| `EntryAfterUnpublishEventHandler` | After an entry is unpublished |
|
|
216
|
+
|
|
217
|
+
### `webiny/api/cms/model`
|
|
218
|
+
|
|
219
|
+
| Handler | Fires When |
|
|
220
|
+
| --- | --- |
|
|
221
|
+
| `ModelBeforeCreateEventHandler` | Before a model is created |
|
|
222
|
+
| `ModelAfterCreateEventHandler` | After a model is created |
|
|
223
|
+
| `ModelBeforeCreateFromEventHandler` | Before a model is cloned |
|
|
224
|
+
| `ModelAfterCreateFromEventHandler` | After a model is cloned |
|
|
225
|
+
| `ModelBeforeUpdateEventHandler` | Before a model is updated |
|
|
226
|
+
| `ModelAfterUpdateEventHandler` | After a model is updated |
|
|
227
|
+
| `ModelBeforeDeleteEventHandler` | Before a model is deleted |
|
|
228
|
+
| `ModelAfterDeleteEventHandler` | After a model is deleted |
|
|
229
|
+
|
|
230
|
+
### `webiny/api/cms/group`
|
|
231
|
+
|
|
232
|
+
| Handler | Fires When |
|
|
233
|
+
| --- | --- |
|
|
234
|
+
| `GroupBeforeCreateEventHandler` | Before a group is created |
|
|
235
|
+
| `GroupAfterCreateEventHandler` | After a group is created |
|
|
236
|
+
| `GroupBeforeUpdateEventHandler` | Before a group is updated |
|
|
237
|
+
| `GroupAfterUpdateEventHandler` | After a group is updated |
|
|
238
|
+
| `GroupBeforeDeleteEventHandler` | Before a group is deleted |
|
|
239
|
+
| `GroupAfterDeleteEventHandler` | After a group is deleted |
|
|
240
|
+
|
|
241
|
+
### `webiny/api/security/authentication`
|
|
242
|
+
|
|
243
|
+
| Handler | Fires When |
|
|
244
|
+
| --- | --- |
|
|
245
|
+
| `BeforeAuthenticationEventHandler` | Before authentication |
|
|
246
|
+
| `AfterAuthenticationEventHandler` | After authentication |
|
|
247
|
+
|
|
248
|
+
### `webiny/api/security/api-key`
|
|
249
|
+
|
|
250
|
+
| Handler | Fires When |
|
|
251
|
+
| --- | --- |
|
|
252
|
+
| `ApiKeyBeforeCreateEventHandler` | Before an API key is created |
|
|
253
|
+
| `ApiKeyAfterCreateEventHandler` | After an API key is created |
|
|
254
|
+
| `ApiKeyBeforeDeleteEventHandler` | Before an API key is deleted |
|
|
255
|
+
| `ApiKeyAfterDeleteEventHandler` | After an API key is deleted |
|
|
256
|
+
| `ApiKeyBeforeUpdateEventHandler` | Before an API key is updated |
|
|
257
|
+
| `ApiKeyAfterUpdateEventHandler` | After an API key is updated |
|
|
258
|
+
|
|
259
|
+
### `webiny/api/security/role`
|
|
260
|
+
|
|
261
|
+
| Handler | Fires When |
|
|
262
|
+
| --- | --- |
|
|
263
|
+
| `RoleBeforeCreateEventHandler` | Before a role is created |
|
|
264
|
+
| `RoleAfterCreateEventHandler` | After a role is created |
|
|
265
|
+
| `RoleBeforeDeleteEventHandler` | Before a role is deleted |
|
|
266
|
+
| `RoleAfterDeleteEventHandler` | After a role is deleted |
|
|
267
|
+
| `RoleBeforeUpdateEventHandler` | Before a role is updated |
|
|
268
|
+
| `RoleAfterUpdateEventHandler` | After a role is updated |
|
|
269
|
+
|
|
270
|
+
### `webiny/api/security/user`
|
|
271
|
+
|
|
272
|
+
| Handler | Fires When |
|
|
273
|
+
| --- | --- |
|
|
274
|
+
| `UserBeforeCreateEventHandler` | Before a user is created |
|
|
275
|
+
| `UserAfterCreateEventHandler` | After a user is created |
|
|
276
|
+
| `UserBeforeDeleteEventHandler` | Before a user is deleted |
|
|
277
|
+
| `UserAfterDeleteEventHandler` | After a user is deleted |
|
|
278
|
+
| `UserBeforeUpdateEventHandler` | Before a user is updated |
|
|
279
|
+
| `UserAfterUpdateEventHandler` | After a user is updated |
|
|
280
|
+
|
|
281
|
+
### `webiny/api/tenancy`
|
|
282
|
+
|
|
283
|
+
| Handler | Fires When |
|
|
284
|
+
| --- | --- |
|
|
285
|
+
| `TenantBeforeCreateEventHandler` | Before a tenant is created |
|
|
286
|
+
| `TenantAfterCreateEventHandler` | After a tenant is created |
|
|
287
|
+
| `TenantBeforeUpdateEventHandler` | Before a tenant is updated |
|
|
288
|
+
| `TenantAfterUpdateEventHandler` | After a tenant is updated |
|
|
289
|
+
| `TenantBeforeDeleteEventHandler` | Before a tenant is deleted |
|
|
290
|
+
| `TenantAfterDeleteEventHandler` | After a tenant is deleted |
|
|
291
|
+
| `TenantInstalledEventHandler` | After a tenant is installed |
|
|
292
|
+
|
|
293
|
+
### `webiny/api/system`
|
|
294
|
+
|
|
295
|
+
| Handler | Fires When |
|
|
296
|
+
| --- | --- |
|
|
297
|
+
| `SystemInstalledEventHandler` | After the system is installed |
|
|
298
|
+
|
|
299
|
+
### `webiny/api/website-builder/page`
|
|
300
|
+
|
|
301
|
+
| Handler | Fires When |
|
|
302
|
+
| --- | --- |
|
|
303
|
+
| `PageBeforeCreateEventHandler` | Before a page is created |
|
|
304
|
+
| `PageAfterCreateEventHandler` | After a page is created |
|
|
305
|
+
| `PageBeforeCreateRevisionFromEventHandler` | Before a page revision is created |
|
|
306
|
+
| `PageAfterCreateRevisionFromEventHandler` | After a page revision is created |
|
|
307
|
+
| `PageBeforeDeleteEventHandler` | Before a page is deleted |
|
|
308
|
+
| `PageAfterDeleteEventHandler` | After a page is deleted |
|
|
309
|
+
| `PageBeforeDuplicateEventHandler` | Before a page is duplicated |
|
|
310
|
+
| `PageAfterDuplicateEventHandler` | After a page is duplicated |
|
|
311
|
+
| `PageBeforeMoveEventHandler` | Before a page is moved |
|
|
312
|
+
| `PageAfterMoveEventHandler` | After a page is moved |
|
|
313
|
+
| `PageBeforePublishEventHandler` | Before a page is published |
|
|
314
|
+
| `PageAfterPublishEventHandler` | After a page is published |
|
|
315
|
+
| `PageBeforeUnpublishEventHandler` | Before a page is unpublished |
|
|
316
|
+
| `PageAfterUnpublishEventHandler` | After a page is unpublished |
|
|
317
|
+
| `PageBeforeUpdateEventHandler` | Before a page is updated |
|
|
318
|
+
| `PageAfterUpdateEventHandler` | After a page is updated |
|
|
319
|
+
|
|
320
|
+
### `webiny/api/website-builder/redirect`
|
|
321
|
+
|
|
322
|
+
| Handler | Fires When |
|
|
323
|
+
| --- | --- |
|
|
324
|
+
| `RedirectBeforeCreateEventHandler` | Before a redirect is created |
|
|
325
|
+
| `RedirectAfterCreateEventHandler` | After a redirect is created |
|
|
326
|
+
| `RedirectBeforeDeleteEventHandler` | Before a redirect is deleted |
|
|
327
|
+
| `RedirectAfterDeleteEventHandler` | After a redirect is deleted |
|
|
328
|
+
| `RedirectBeforeMoveEventHandler` | Before a redirect is moved |
|
|
329
|
+
| `RedirectAfterMoveEventHandler` | After a redirect is moved |
|
|
330
|
+
| `RedirectBeforeUpdateEventHandler` | Before a redirect is updated |
|
|
331
|
+
| `RedirectAfterUpdateEventHandler` | After a redirect is updated |
|
|
332
|
+
|
|
188
333
|
## Quick Reference
|
|
189
334
|
|
|
190
335
|
```
|
|
191
336
|
CMS hooks import: import { EntryBeforeCreateEventHandler } from "webiny/api/cms/entry";
|
|
192
|
-
Security import: import {
|
|
337
|
+
Security import: import { ApiKeyAfterUpdateEventHandler } from "webiny/api/security/api-key";
|
|
193
338
|
Event shape: event.modelId (string), event.payload (object), event.payload.values (object)
|
|
194
339
|
Export: Handler.createImplementation({ implementation, dependencies })
|
|
195
340
|
Register CMS: <Api.Extension src={"/extensions/MyHook.ts"} />
|
|
@@ -200,4 +345,4 @@ Deploy: yarn webiny deploy api
|
|
|
200
345
|
## Related Skills
|
|
201
346
|
|
|
202
347
|
- `content-models` -- Define the models your hooks target
|
|
203
|
-
- `dependency-injection` -- Inject Logger, BuildParams, and other services
|
|
348
|
+
- `dependency-injection` -- Inject Logger, BuildParams, and other services into event handlers
|
|
@@ -75,12 +75,14 @@ yarn webiny watch api
|
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
How it works:
|
|
78
|
+
|
|
78
79
|
1. **Lambda stubs deployed** -- real Lambda functions are replaced with stubs that forward events
|
|
79
80
|
2. **Events forwarded** -- requests to AWS get forwarded to your local machine
|
|
80
81
|
3. **Local execution** -- your code runs locally with full AWS Lambda environment
|
|
81
82
|
4. **Response routing** -- responses sent back through the Lambda stub
|
|
82
83
|
|
|
83
84
|
Benefits:
|
|
85
|
+
|
|
84
86
|
- See backend code changes instantly (no redeployment)
|
|
85
87
|
- Debug locally with standard Node.js tools
|
|
86
88
|
- Console logs appear directly in your terminal
|
|
@@ -112,6 +114,7 @@ yarn webiny watch admin
|
|
|
112
114
|
### Long-Lived Environments
|
|
113
115
|
|
|
114
116
|
Persistent environments maintained over time:
|
|
117
|
+
|
|
115
118
|
- **dev** -- daily development
|
|
116
119
|
- **staging** -- pre-production testing
|
|
117
120
|
- **prod** -- production
|
|
@@ -121,6 +124,7 @@ Best practice: manage via CI/CD pipelines.
|
|
|
121
124
|
### Short-Lived Environments
|
|
122
125
|
|
|
123
126
|
Temporary environments for specific purposes:
|
|
127
|
+
|
|
124
128
|
- Feature branch testing
|
|
125
129
|
- PR previews
|
|
126
130
|
- Experimentation
|
|
@@ -136,6 +140,7 @@ yarn webiny destroy --env feature-123
|
|
|
136
140
|
### Deployment Modes
|
|
137
141
|
|
|
138
142
|
Webiny has two deployment templates:
|
|
143
|
+
|
|
139
144
|
- **dev** -- smaller, cheaper infrastructure for development
|
|
140
145
|
- **prod** -- production-grade infrastructure with HA, backups, auto-scaling
|
|
141
146
|
|
|
@@ -149,6 +154,7 @@ The mode is determined by whether the environment name is in the `ProductionEnvi
|
|
|
149
154
|
## State Files
|
|
150
155
|
|
|
151
156
|
State files are JSON files that track the current state of your deployment:
|
|
157
|
+
|
|
152
158
|
- Store infrastructure resource info, configurations, and metadata
|
|
153
159
|
- Essential for managing environments and tracking changes
|
|
154
160
|
- Stored in S3 by default
|
|
@@ -170,12 +176,12 @@ Access in API extensions:
|
|
|
170
176
|
import { BuildParams } from "webiny/api/build-params";
|
|
171
177
|
|
|
172
178
|
class MyExtension implements SomeFactory.Interface {
|
|
173
|
-
|
|
179
|
+
constructor(private buildParams: BuildParams.Interface) {}
|
|
174
180
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
181
|
+
execute() {
|
|
182
|
+
const value = this.buildParams.get<string>("MY_PARAM");
|
|
183
|
+
const config = this.buildParams.get<{ myKey: number }>("MY_CONFIG");
|
|
184
|
+
}
|
|
179
185
|
}
|
|
180
186
|
```
|
|
181
187
|
|
|
@@ -184,6 +190,7 @@ class MyExtension implements SomeFactory.Interface {
|
|
|
184
190
|
### API Errors
|
|
185
191
|
|
|
186
192
|
During `yarn webiny watch api`:
|
|
193
|
+
|
|
187
194
|
- **Console logs** appear directly in the terminal
|
|
188
195
|
- Use `console.log()` for quick debugging
|
|
189
196
|
- Use `Logger` (DI-injected) for production logging to CloudWatch
|
|
@@ -200,6 +207,7 @@ this.logger.error("Something failed");
|
|
|
200
207
|
### Admin Errors
|
|
201
208
|
|
|
202
209
|
Use browser DevTools:
|
|
210
|
+
|
|
203
211
|
- **Console** -- view logs and errors
|
|
204
212
|
- **Network tab** -- inspect GraphQL requests/responses
|
|
205
213
|
- **React Developer Tools** -- debug component state/props
|
|
@@ -208,6 +216,7 @@ Use browser DevTools:
|
|
|
208
216
|
### Infrastructure Errors
|
|
209
217
|
|
|
210
218
|
Deployment errors from Pulumi typically relate to:
|
|
219
|
+
|
|
211
220
|
- IAM permission issues
|
|
212
221
|
- AWS service quotas
|
|
213
222
|
- Resource configuration problems
|
|
@@ -216,17 +225,17 @@ Check the deployment output for specific error messages.
|
|
|
216
225
|
|
|
217
226
|
## CLI Commands Reference
|
|
218
227
|
|
|
219
|
-
| Command
|
|
220
|
-
|
|
221
|
-
| `yarn webiny deploy`
|
|
222
|
-
| `yarn webiny deploy [core\|api\|admin]` | Deploy specific application
|
|
223
|
-
| `yarn webiny deploy --env <name>`
|
|
224
|
-
| `yarn webiny destroy --env <name>`
|
|
225
|
-
| `yarn webiny watch api`
|
|
226
|
-
| `yarn webiny watch admin`
|
|
227
|
-
| `yarn webiny info`
|
|
228
|
-
| `yarn webiny info --env <name>`
|
|
229
|
-
| `yarn webiny extension <name>`
|
|
228
|
+
| Command | Purpose |
|
|
229
|
+
| --------------------------------------- | ---------------------------------- |
|
|
230
|
+
| `yarn webiny deploy` | Deploy all applications |
|
|
231
|
+
| `yarn webiny deploy [core\|api\|admin]` | Deploy specific application |
|
|
232
|
+
| `yarn webiny deploy --env <name>` | Deploy to specific environment |
|
|
233
|
+
| `yarn webiny destroy --env <name>` | Destroy an environment |
|
|
234
|
+
| `yarn webiny watch api` | Start local API development |
|
|
235
|
+
| `yarn webiny watch admin` | Start local Admin development |
|
|
236
|
+
| `yarn webiny info` | Show deployment info and URLs |
|
|
237
|
+
| `yarn webiny info --env <name>` | Show info for specific environment |
|
|
238
|
+
| `yarn webiny extension <name>` | Install a pre-built extension |
|
|
230
239
|
|
|
231
240
|
## Quick Reference
|
|
232
241
|
|