@webiny/mcp 6.0.0 → 6.1.0-beta.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/agents/claude.d.ts +2 -2
- package/agents/claude.js.map +1 -1
- package/agents/cline.d.ts +2 -2
- package/agents/cline.js.map +1 -1
- package/agents/copilot.d.ts +2 -2
- package/agents/copilot.js +1 -1
- package/agents/copilot.js.map +1 -1
- package/agents/cursor.d.ts +2 -2
- package/agents/cursor.js.map +1 -1
- package/agents/instructions.js +1 -1
- package/agents/instructions.js.map +1 -1
- package/agents/kiro.d.ts +15 -0
- package/agents/kiro.js +33 -0
- package/agents/kiro.js.map +1 -0
- package/agents/opencode.d.ts +22 -0
- package/agents/opencode.js +76 -0
- package/agents/opencode.js.map +1 -0
- package/agents/shared.d.ts +5 -5
- package/agents/shared.js +3 -3
- package/agents/shared.js.map +1 -1
- package/agents/windsurf.d.ts +2 -2
- package/agents/windsurf.js.map +1 -1
- package/bin.d.ts +2 -0
- package/bin.js +4 -0
- package/bin.js.map +1 -0
- package/cli/ConfigureMcp.d.ts +7 -14
- package/cli/ConfigureMcp.js +24 -52
- package/cli/ConfigureMcp.js.map +1 -1
- package/cli/McpServer.d.ts +3 -10
- package/cli/McpServer.js +83 -109
- package/cli/McpServer.js.map +1 -1
- package/cli.d.ts +1 -0
- package/cli.js +60 -0
- package/cli.js.map +1 -0
- package/index.d.ts +6 -1
- package/index.js +7 -1
- package/index.js.map +1 -1
- package/package.json +11 -23
- package/skills/admin/admin-architect/SKILL.md +389 -0
- package/skills/admin/ui-extensions/SKILL.md +268 -0
- package/skills/api/api-architect/SKILL.md +189 -0
- package/skills/api/custom-field-type/SKILL.md +263 -0
- package/skills/api/event-handler-pattern/SKILL.md +131 -0
- package/skills/{custom-graphql-api → api/graphql-api}/SKILL.md +3 -3
- package/skills/api/use-case-pattern/SKILL.md +102 -0
- package/skills/cli-extensions/SKILL.md +45 -47
- package/skills/configure-auth0/SKILL.md +4 -4
- package/skills/configure-okta/SKILL.md +3 -3
- package/skills/content-models/SKILL.md +197 -196
- package/skills/dependency-injection/SKILL.md +9 -219
- package/skills/full-stack-architect/SKILL.md +195 -0
- package/skills/generated/admin/SKILL.md +119 -0
- package/skills/generated/admin/aco/SKILL.md +28 -0
- package/skills/generated/admin/build-params/SKILL.md +33 -0
- package/skills/generated/admin/cms/SKILL.md +342 -0
- package/skills/generated/admin/configs/SKILL.md +23 -0
- package/skills/generated/admin/env-config/SKILL.md +30 -0
- package/skills/generated/admin/form/SKILL.md +88 -0
- package/skills/generated/admin/graphql-client/SKILL.md +23 -0
- package/skills/generated/admin/lexical/SKILL.md +105 -0
- package/skills/generated/admin/local-storage/SKILL.md +42 -0
- package/skills/generated/admin/router/SKILL.md +48 -0
- package/skills/generated/admin/security/SKILL.md +63 -0
- package/skills/generated/admin/tenancy/SKILL.md +64 -0
- package/skills/generated/admin/ui/SKILL.md +468 -0
- package/skills/generated/admin/website-builder/SKILL.md +318 -0
- package/skills/generated/api/SKILL.md +40 -0
- package/skills/generated/api/aco/SKILL.md +202 -0
- package/skills/generated/api/build-params/SKILL.md +31 -0
- package/skills/generated/api/cms/SKILL.md +646 -0
- package/skills/generated/api/event-publisher/SKILL.md +31 -0
- package/skills/generated/api/file-manager/SKILL.md +189 -0
- package/skills/generated/api/graphql/SKILL.md +61 -0
- package/skills/generated/api/key-value-store/SKILL.md +31 -0
- package/skills/generated/api/logger/SKILL.md +25 -0
- package/skills/generated/api/opensearch/SKILL.md +39 -0
- package/skills/generated/api/scheduler/SKILL.md +112 -0
- package/skills/generated/api/security/SKILL.md +317 -0
- package/skills/generated/api/system/SKILL.md +34 -0
- package/skills/generated/api/tasks/SKILL.md +31 -0
- package/skills/generated/api/tenancy/SKILL.md +124 -0
- package/skills/generated/api/tenant-manager/SKILL.md +34 -0
- package/skills/generated/api/website-builder/SKILL.md +356 -0
- package/skills/generated/cli/SKILL.md +28 -0
- package/skills/generated/cli/command/SKILL.md +24 -0
- package/skills/generated/extensions/SKILL.md +43 -0
- package/skills/generated/infra/SKILL.md +190 -0
- package/skills/infrastructure-extensions/SKILL.md +3 -2
- package/skills/local-development/SKILL.md +2 -28
- package/skills/project-structure/SKILL.md +78 -56
- package/skills/webiny-sdk/SKILL.md +77 -76
- package/skills/website-builder/SKILL.md +143 -149
- package/ui.d.ts +24 -0
- package/ui.js +31 -0
- package/ui.js.map +1 -0
- package/Extension.d.ts +0 -2
- package/Extension.js +0 -11
- package/Extension.js.map +0 -1
- package/skills/admin-ui-extensions/SKILL.md +0 -267
- package/skills/api-custom-feature/SKILL.md +0 -195
- package/skills/lifecycle-events/SKILL.md +0 -348
|
@@ -31,6 +31,7 @@ class MyImplementation implements SomeFactory.Interface {
|
|
|
31
31
|
|
|
32
32
|
execute(/* factory-specific params */) {
|
|
33
33
|
this.logger.info("Doing something...");
|
|
34
|
+
// buildParams.get() returns T | null — always account for null.
|
|
34
35
|
const value = this.buildParams.get<string>("MY_PARAM");
|
|
35
36
|
}
|
|
36
37
|
}
|
|
@@ -58,222 +59,7 @@ Key rules:
|
|
|
58
59
|
| CLI Commands | `CliCommandFactory` | `"webiny/cli/command"` |
|
|
59
60
|
| Pulumi Handlers | `CorePulumi` | `"webiny/infra/core"` |
|
|
60
61
|
|
|
61
|
-
> **Event handlers** use the same `createImplementation` pattern but are not injectable dependencies.
|
|
62
|
-
|
|
63
|
-
## Injectable Abstractions
|
|
64
|
-
|
|
65
|
-
Every Abstraction listed below can be used as a constructor dependency or as a base for `createImplementation`. Import from the `"webiny/..."` path shown.
|
|
66
|
-
|
|
67
|
-
### `webiny/api/build-params`
|
|
68
|
-
|
|
69
|
-
| Abstraction | Purpose |
|
|
70
|
-
| ------------ | ------------------------ |
|
|
71
|
-
| `BuildParam` | Define a build parameter |
|
|
72
|
-
| `BuildParams` | Access build-time parameters |
|
|
73
|
-
|
|
74
|
-
### `webiny/api/logger`
|
|
75
|
-
|
|
76
|
-
| Abstraction | Purpose |
|
|
77
|
-
| ----------- | -------------------------------- |
|
|
78
|
-
| `Logger` | Logging (persists to CloudWatch) |
|
|
79
|
-
|
|
80
|
-
### `webiny/api/key-value-store`
|
|
81
|
-
|
|
82
|
-
| Abstraction | Purpose |
|
|
83
|
-
| -------------------- | ------------------------------ |
|
|
84
|
-
| `GlobalKeyValueStore` | Global (cross-tenant) key-value store |
|
|
85
|
-
| `KeyValueStore` | Tenant-scoped key-value store |
|
|
86
|
-
|
|
87
|
-
### `webiny/api/event-publisher`
|
|
88
|
-
|
|
89
|
-
| Abstraction | Purpose |
|
|
90
|
-
| ---------------- | -------------------- |
|
|
91
|
-
| `EventPublisher` | Publish domain events |
|
|
92
|
-
|
|
93
|
-
### `webiny/api/graphql`
|
|
94
|
-
|
|
95
|
-
| Abstraction | Purpose |
|
|
96
|
-
| ---------------------- | --------------------- |
|
|
97
|
-
| `GraphQLSchemaFactory` | Define GraphQL schemas |
|
|
98
|
-
|
|
99
|
-
### `webiny/api/tasks`
|
|
100
|
-
|
|
101
|
-
| Abstraction | Purpose |
|
|
102
|
-
| ---------------- | ---------------------- |
|
|
103
|
-
| `TaskService` | Task management service |
|
|
104
|
-
| `TaskDefinition` | Define a background task |
|
|
105
|
-
|
|
106
|
-
### `webiny/api/system`
|
|
107
|
-
|
|
108
|
-
| Abstraction | Purpose |
|
|
109
|
-
| ---------------------- | ------------------------- |
|
|
110
|
-
| `InstallSystemUseCase` | System installation logic |
|
|
111
|
-
|
|
112
|
-
### `webiny/api/security`
|
|
113
|
-
|
|
114
|
-
| Abstraction | Purpose |
|
|
115
|
-
| --------------------- | ------------------------------------- |
|
|
116
|
-
| `IdentityContext` | Current user identity and permissions |
|
|
117
|
-
| `ApiKeyFactory` | Define custom API key types |
|
|
118
|
-
| `IdentityProvider` | Base identity provider abstraction |
|
|
119
|
-
| `OidcIdentityProvider` | OIDC identity provider |
|
|
120
|
-
| `JwtIdentityProvider` | JWT identity provider |
|
|
121
|
-
| `Authenticator` | Authentication logic |
|
|
122
|
-
| `Authorizer` | Authorization logic |
|
|
123
|
-
|
|
124
|
-
### `webiny/api/security/api-key`
|
|
125
|
-
|
|
126
|
-
| Abstraction | Purpose |
|
|
127
|
-
| ----------------------- | --------------------------- |
|
|
128
|
-
| `CreateApiKeyUseCase` | Create an API key |
|
|
129
|
-
| `DeleteApiKeyUseCase` | Delete an API key |
|
|
130
|
-
| `GetApiKeyUseCase` | Get API key by ID |
|
|
131
|
-
| `GetApiKeyByTokenUseCase` | Get API key by token |
|
|
132
|
-
| `ListApiKeysUseCase` | List all API keys |
|
|
133
|
-
| `UpdateApiKeyUseCase` | Update an API key |
|
|
134
|
-
| `ApiKeyFactory` | Define custom API key types |
|
|
135
|
-
|
|
136
|
-
### `webiny/api/security/role`
|
|
137
|
-
|
|
138
|
-
| Abstraction | Purpose |
|
|
139
|
-
| ----------------- | -------------- |
|
|
140
|
-
| `CreateRoleUseCase` | Create a role |
|
|
141
|
-
| `DeleteRoleUseCase` | Delete a role |
|
|
142
|
-
| `GetRoleUseCase` | Get role by ID |
|
|
143
|
-
| `ListRolesUseCase` | List all roles |
|
|
144
|
-
| `UpdateRoleUseCase` | Update a role |
|
|
145
|
-
|
|
146
|
-
### `webiny/api/security/user`
|
|
147
|
-
|
|
148
|
-
| Abstraction | Purpose |
|
|
149
|
-
| -------------------- | ----------------- |
|
|
150
|
-
| `CreateUserUseCase` | Create a user |
|
|
151
|
-
| `DeleteUserUseCase` | Delete a user |
|
|
152
|
-
| `UpdateUserUseCase` | Update a user |
|
|
153
|
-
| `GetUserUseCase` | Get user by ID |
|
|
154
|
-
| `ListUsersUseCase` | List all users |
|
|
155
|
-
| `ListUserTeamsUseCase` | List user's teams |
|
|
156
|
-
|
|
157
|
-
### `webiny/api/tenancy`
|
|
158
|
-
|
|
159
|
-
| Abstraction | Purpose |
|
|
160
|
-
| ------------------------ | ------------------------------------ |
|
|
161
|
-
| `TenantContext` | Current tenant information |
|
|
162
|
-
| `CreateTenantUseCase` | Create a tenant |
|
|
163
|
-
| `CreateTenantRepository` | Tenant creation storage |
|
|
164
|
-
| `GetTenantByIdUseCase` | Fetch tenant by ID |
|
|
165
|
-
| `UpdateTenantUseCase` | Update a tenant |
|
|
166
|
-
| `UpdateTenantRepository` | Tenant update storage |
|
|
167
|
-
| `DeleteTenantUseCase` | Delete a tenant |
|
|
168
|
-
| `DeleteTenantRepository` | Tenant deletion storage |
|
|
169
|
-
| `InstallTenantUseCase` | Install a tenant |
|
|
170
|
-
| `AppInstaller` | App installation during tenant install |
|
|
171
|
-
|
|
172
|
-
### `webiny/api/tenant-manager`
|
|
173
|
-
|
|
174
|
-
| Abstraction | Purpose |
|
|
175
|
-
| ---------------------- | ------------------------------ |
|
|
176
|
-
| `TenantModelExtension` | Extend tenant data model |
|
|
177
|
-
|
|
178
|
-
### `webiny/api/cms/entry`
|
|
179
|
-
|
|
180
|
-
| Abstraction | Purpose |
|
|
181
|
-
| --------------------------------------------------- | ----------------------------------- |
|
|
182
|
-
| `CreateEntryUseCase` | Create a CMS entry |
|
|
183
|
-
| `CreateEntryRevisionFromUseCase` | Create entry revision from existing |
|
|
184
|
-
| `DeleteEntryUseCase` | Delete an entry |
|
|
185
|
-
| `MoveEntryToBinUseCase` | Move entry to bin |
|
|
186
|
-
| `DeleteEntryRevisionUseCase` | Delete a specific revision |
|
|
187
|
-
| `DeleteMultipleEntriesUseCase` | Delete multiple entries |
|
|
188
|
-
| `MoveEntryUseCase` | Move entry to folder |
|
|
189
|
-
| `PublishEntryUseCase` | Publish an entry |
|
|
190
|
-
| `RepublishEntryUseCase` | Republish an entry |
|
|
191
|
-
| `RestoreEntryFromBinUseCase` | Restore entry from bin |
|
|
192
|
-
| `UnpublishEntryUseCase` | Unpublish an entry |
|
|
193
|
-
| `UpdateEntryUseCase` | Update an entry |
|
|
194
|
-
| `UpdateSingletonEntryUseCase` | Update a singleton entry |
|
|
195
|
-
| `GetEntriesByIdsUseCase` | Get entries by IDs |
|
|
196
|
-
| `GetEntryUseCase` | Get entry by query |
|
|
197
|
-
| `GetEntryByIdUseCase` | Get entry by revision ID |
|
|
198
|
-
| `GetLatestEntriesByIdsUseCase` | Get latest entries by IDs |
|
|
199
|
-
| `GetLatestRevisionByEntryIdBaseUseCase` | Get latest revision (base) |
|
|
200
|
-
| `GetLatestRevisionByEntryIdUseCase` | Get latest revision |
|
|
201
|
-
| `GetLatestDeletedRevisionByEntryIdUseCase` | Get latest deleted revision |
|
|
202
|
-
| `GetLatestRevisionByEntryIdIncludingDeletedUseCase` | Get latest revision (incl. deleted) |
|
|
203
|
-
| `GetPreviousRevisionByEntryIdBaseUseCase` | Get previous revision (base) |
|
|
204
|
-
| `GetPreviousRevisionByEntryIdUseCase` | Get previous revision |
|
|
205
|
-
| `GetPublishedEntriesByIdsUseCase` | Get published entries by IDs |
|
|
206
|
-
| `GetPublishedRevisionByEntryIdUseCase` | Get published revision |
|
|
207
|
-
| `GetRevisionByIdUseCase` | Get revision by ID |
|
|
208
|
-
| `GetRevisionsByEntryIdUseCase` | Get all revisions of an entry |
|
|
209
|
-
| `GetSingletonEntryUseCase` | Get singleton entry |
|
|
210
|
-
| `ListEntriesUseCase` | List entries (base) |
|
|
211
|
-
| `ListLatestEntriesUseCase` | List latest entries |
|
|
212
|
-
| `ListPublishedEntriesUseCase` | List published entries |
|
|
213
|
-
| `ListDeletedEntriesUseCase` | List deleted entries |
|
|
214
|
-
| `ValidateEntryUseCase` | Validate entry data |
|
|
215
|
-
| `CmsWhereMapper` | Map CMS where conditions |
|
|
216
|
-
| `CmsSortMapper` | Map CMS sort conditions |
|
|
217
|
-
|
|
218
|
-
### `webiny/api/cms/model`
|
|
219
|
-
|
|
220
|
-
| Abstraction | Purpose |
|
|
221
|
-
| --------------------- | ------------------------- |
|
|
222
|
-
| `ModelFactory` | Define CMS content models |
|
|
223
|
-
| `FieldType` | Define custom field types |
|
|
224
|
-
| `CreateModelUseCase` | Create a model |
|
|
225
|
-
| `CreateModelFromUseCase` | Clone a model |
|
|
226
|
-
| `UpdateModelUseCase` | Update a model |
|
|
227
|
-
| `DeleteModelUseCase` | Delete a model |
|
|
228
|
-
| `GetModelUseCase` | Get model by ID |
|
|
229
|
-
| `ListModelsUseCase` | List all models |
|
|
230
|
-
|
|
231
|
-
### `webiny/api/cms/group`
|
|
232
|
-
|
|
233
|
-
| Abstraction | Purpose |
|
|
234
|
-
| -------------------- | --------------- |
|
|
235
|
-
| `ModelGroupFactory` | Define model groups |
|
|
236
|
-
| `CreateGroupUseCase` | Create a group |
|
|
237
|
-
| `UpdateGroupUseCase` | Update a group |
|
|
238
|
-
| `DeleteGroupUseCase` | Delete a group |
|
|
239
|
-
| `ListGroupsUseCase` | List all groups |
|
|
240
|
-
| `GetGroupUseCase` | Get group by ID |
|
|
241
|
-
|
|
242
|
-
### `webiny/api/website-builder/nextjs`
|
|
243
|
-
|
|
244
|
-
| Abstraction | Purpose |
|
|
245
|
-
| ------------- | -------------------------- |
|
|
246
|
-
| `NextjsConfig` | Configure Next.js integration |
|
|
247
|
-
|
|
248
|
-
### `webiny/api/website-builder/page`
|
|
249
|
-
|
|
250
|
-
| Abstraction | Purpose |
|
|
251
|
-
| ------------------------------- | ---------------------------------- |
|
|
252
|
-
| `CreatePageUseCase` | Create a page |
|
|
253
|
-
| `CreatePageRevisionFromUseCase` | Create page revision from existing |
|
|
254
|
-
| `DeletePageUseCase` | Delete a page |
|
|
255
|
-
| `DuplicatePageUseCase` | Duplicate a page |
|
|
256
|
-
| `GetPageByIdUseCase` | Get page by ID |
|
|
257
|
-
| `GetPageByPathUseCase` | Get page by path |
|
|
258
|
-
| `GetPageRevisionsUseCase` | Get page revisions |
|
|
259
|
-
| `ListPagesUseCase` | List pages |
|
|
260
|
-
| `MovePageUseCase` | Move a page |
|
|
261
|
-
| `PublishPageUseCase` | Publish a page |
|
|
262
|
-
| `UnpublishPageUseCase` | Unpublish a page |
|
|
263
|
-
| `UpdatePageUseCase` | Update a page |
|
|
264
|
-
|
|
265
|
-
### `webiny/api/website-builder/redirect`
|
|
266
|
-
|
|
267
|
-
| Abstraction | Purpose |
|
|
268
|
-
| --------------------------------- | -------------------------- |
|
|
269
|
-
| `CreateRedirectUseCase` | Create a redirect |
|
|
270
|
-
| `DeleteRedirectUseCase` | Delete a redirect |
|
|
271
|
-
| `GetActiveRedirectsUseCase` | Get active redirects |
|
|
272
|
-
| `GetRedirectByIdUseCase` | Get redirect by ID |
|
|
273
|
-
| `InvalidateRedirectsCacheUseCase` | Invalidate redirects cache |
|
|
274
|
-
| `ListRedirectsUseCase` | List redirects |
|
|
275
|
-
| `MoveRedirectUseCase` | Move a redirect |
|
|
276
|
-
| `UpdateRedirectUseCase` | Update a redirect |
|
|
62
|
+
> **Event handlers** use the same `createImplementation` pattern but are not injectable dependencies.
|
|
277
63
|
|
|
278
64
|
## Examples Across Extension Types
|
|
279
65
|
|
|
@@ -372,9 +158,13 @@ export default CorePulumi.createImplementation({
|
|
|
372
158
|
3. The `dependencies` array order must match the constructor parameter order.
|
|
373
159
|
4. Read the `abstractions.ts` file in the feature folder to see available methods.
|
|
374
160
|
5. Extensions with no dependencies use `dependencies: []`.
|
|
161
|
+
6. `BuildParams.get<T>(name)` returns `T | null` — always type the receiving property/variable as nullable (e.g. `string | null`) and handle the `null` case.
|
|
162
|
+
7. **BuildParam declarations belong inside the extension's `Extension.tsx`**, not in `webiny.config.tsx`. Expose required params as React props on the extension component so the consumer decides where values come from (see `webiny-full-stack-architect` skill for the full pattern).
|
|
375
163
|
|
|
376
164
|
## Related Skills
|
|
377
165
|
|
|
378
|
-
- `custom-graphql-api` -- DI in GraphQL schema extensions
|
|
379
|
-
- `
|
|
380
|
-
- `
|
|
166
|
+
- `webiny-custom-graphql-api` -- DI in GraphQL schema extensions
|
|
167
|
+
- `webiny-cli-extensions` -- DI in CLI command extensions
|
|
168
|
+
- `webiny-full-stack-architect` -- Full-stack extension skeleton and registration pattern
|
|
169
|
+
- `webiny-api-architect` -- API-side architecture using DI
|
|
170
|
+
- `webiny-admin-architect` -- Admin-side architecture using DI
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: webiny-full-stack-architect
|
|
3
|
+
context: webiny-extensions
|
|
4
|
+
description: >
|
|
5
|
+
Full-stack extension skeleton and registration pattern. Use this skill when creating
|
|
6
|
+
an extension that spans both API and Admin — the top-level component with Api.Extension
|
|
7
|
+
and Admin.Extension entry points, shared domain layer, BuildParam declarations, and
|
|
8
|
+
package structure. References webiny-api-architect and webiny-admin-architect for layer-specific details.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Full-Stack Extension Skeleton
|
|
12
|
+
|
|
13
|
+
## TL;DR
|
|
14
|
+
|
|
15
|
+
A full-stack extension bundles **API** and **Admin** into a single package with a shared domain layer. The top-level component registers both sides via `<Api.Extension>` and `<Admin.Extension>`, which point to separate entry-point files. Each side follows its own layered architecture pattern — see **webiny-api-architect** and **webiny-admin-architect** skills for details.
|
|
16
|
+
|
|
17
|
+
## RULE — Extension Entry Points
|
|
18
|
+
|
|
19
|
+
> **Admin extensions CANNOT be directly mounted in `webiny.config.tsx` or in any child component tree without going through `<Admin.Extension />`.**
|
|
20
|
+
|
|
21
|
+
The same rule applies to API extensions — they must go through `<Api.Extension />`.
|
|
22
|
+
|
|
23
|
+
These entry-point components are the **only** way to register code that runs inside the Admin app or the API runtime. They use the `src` prop to point to a file that will be loaded in the correct execution environment (browser for Admin, Lambda for API). Bypassing these entry points will fail at runtime because the Admin and API contexts (DI containers, routers, GraphQL registries, etc.) are not available outside their respective runtimes.
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
// CORRECT — always use entry-point components
|
|
27
|
+
<Api.Extension src={import.meta.dirname + "/api/Extension.js"} />
|
|
28
|
+
<Admin.Extension src={import.meta.dirname + "/admin/Extension.js"} />
|
|
29
|
+
|
|
30
|
+
// WRONG — never mount admin/api code directly
|
|
31
|
+
<MyAdminComponent /> // Will not have access to Admin DI container
|
|
32
|
+
<MyApiFeature /> // Will not have access to API DI container
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Package Structure
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
my-extension/
|
|
39
|
+
├── src/
|
|
40
|
+
│ ├── index.ts # Single public export
|
|
41
|
+
│ ├── MyExtension.tsx # Top-level component (registers Api + Admin)
|
|
42
|
+
│ ├── shared/ # Shared between API and Admin
|
|
43
|
+
│ │ ├── constants.ts # Model IDs, permission names, etc.
|
|
44
|
+
│ │ └── types.ts # Shared types
|
|
45
|
+
│ ├── api/ # API-side code → see webiny-api-architect skill
|
|
46
|
+
│ │ ├── Extension.ts
|
|
47
|
+
│ │ ├── domain/
|
|
48
|
+
│ │ ├── features/
|
|
49
|
+
│ │ └── graphql/
|
|
50
|
+
│ └── admin/ # Admin-side code → see webiny-admin-architect skill
|
|
51
|
+
│ ├── Extension.tsx
|
|
52
|
+
│ ├── features/
|
|
53
|
+
│ └── presentation/
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Top-Level Component
|
|
57
|
+
|
|
58
|
+
The top-level component is the single entry point that consumers use. It registers both the API and Admin extensions:
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
// src/MyExtension.tsx
|
|
62
|
+
import React from "react";
|
|
63
|
+
import { Api, Admin } from "webiny/extensions";
|
|
64
|
+
|
|
65
|
+
export const MyExtension = () => {
|
|
66
|
+
return (
|
|
67
|
+
<>
|
|
68
|
+
{/* API extensions — runs in Lambda */}
|
|
69
|
+
<Api.Extension src={import.meta.dirname + "/api/Extension.js"} />
|
|
70
|
+
|
|
71
|
+
{/* Admin extensions — runs in browser */}
|
|
72
|
+
<Admin.Extension src={import.meta.dirname + "/admin/Extension.js"} />
|
|
73
|
+
</>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Conditional rendering can wrap the entry points (e.g., feature flags, config parameters):
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
<Infra.Env.Is name={"prod"}>
|
|
82
|
+
<Api.Extension src={import.meta.dirname + "/api/Extension.js"} />
|
|
83
|
+
<Admin.Extension src={import.meta.dirname + "/admin/Extension.js"} />
|
|
84
|
+
</Infra.Env.Is>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Shared Domain Layer
|
|
88
|
+
|
|
89
|
+
The `shared/` directory contains types and value objects used by both API and Admin:
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
// src/shared/constants.ts
|
|
93
|
+
export const MY_MODEL_ID = "myModel";
|
|
94
|
+
|
|
95
|
+
// src/shared/MyEntity.ts
|
|
96
|
+
export interface MyEntityValues {
|
|
97
|
+
name: string;
|
|
98
|
+
status: "active" | "inactive";
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface MyEntityDto {
|
|
102
|
+
id: string;
|
|
103
|
+
values: MyEntityValues;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export class MyEntity {
|
|
107
|
+
private constructor(private dto: MyEntityDto) {}
|
|
108
|
+
|
|
109
|
+
static from(dto: MyEntityDto) {
|
|
110
|
+
return new MyEntity(dto);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
get id() {
|
|
114
|
+
return this.dto.id;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
get values() {
|
|
118
|
+
return this.dto.values;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Build Parameters
|
|
124
|
+
|
|
125
|
+
Build parameters pass configuration from `webiny.config.tsx` (build time) into both the API runtime and the Admin app. **A deployed API must NEVER use `process.env` to read configuration.**
|
|
126
|
+
|
|
127
|
+
**`BuildParam` declarations MUST live inside the extension's top-level component, NOT in `webiny.config.tsx`.** Required parameters are exposed as React props on the extension component.
|
|
128
|
+
|
|
129
|
+
### Declaring BuildParams
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
// src/MyExtension.tsx — declares build params as React props
|
|
133
|
+
interface MyExtensionProps {
|
|
134
|
+
apiEndpoint: string;
|
|
135
|
+
dashboardUrl: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export const MyExtension = ({ apiEndpoint, dashboardUrl }: MyExtensionProps) => {
|
|
139
|
+
return (
|
|
140
|
+
<>
|
|
141
|
+
<Api.BuildParam paramName="MY_API_ENDPOINT" value={apiEndpoint} />
|
|
142
|
+
<Admin.BuildParam paramName="DASHBOARD_URL" value={dashboardUrl} />
|
|
143
|
+
|
|
144
|
+
<Api.Extension src={import.meta.dirname + "/api/Extension.js"} />
|
|
145
|
+
<Admin.Extension src={import.meta.dirname + "/admin/Extension.js"} />
|
|
146
|
+
</>
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Consuming in `webiny.config.tsx`
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
// webiny.config.tsx — the ONLY place where process.env is read
|
|
155
|
+
<MyExtension
|
|
156
|
+
apiEndpoint={process.env.MY_API_ENDPOINT || ""}
|
|
157
|
+
dashboardUrl={process.env.DASHBOARD_URL || ""}
|
|
158
|
+
/>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Reading BuildParams
|
|
162
|
+
|
|
163
|
+
- **API side:** Inject `BuildParams` via DI — see **webiny-api-architect** skill
|
|
164
|
+
- **Admin side:** Use `useBuildParams()` hook — see **webiny-admin-architect** skill
|
|
165
|
+
|
|
166
|
+
## Checklist
|
|
167
|
+
|
|
168
|
+
1. Create top-level component that uses `<Api.Extension>` and `<Admin.Extension>` — never mount admin/api code directly
|
|
169
|
+
2. Put shared domain models and constants in `shared/`
|
|
170
|
+
3. Declare `<Api.BuildParam>` / `<Admin.BuildParam>` in the top-level component, not in `webiny.config.tsx`
|
|
171
|
+
4. API entry point uses `createFeature` with `register(container)` — see **webiny-api-architect**
|
|
172
|
+
5. Admin entry point is a React component with `<RegisterFeature>` — see **webiny-admin-architect**
|
|
173
|
+
6. Use `.js` extensions in all import paths (ESM modules)
|
|
174
|
+
|
|
175
|
+
## Quick Reference
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
Entry point: <Api.Extension src={...} /> + <Admin.Extension src={...} />
|
|
179
|
+
Shared code: shared/ directory for domain models, constants, types
|
|
180
|
+
API architecture: → see webiny-api-architect skill
|
|
181
|
+
Admin architecture: → see webiny-admin-architect skill
|
|
182
|
+
DI pattern: → see webiny-dependency-injection skill
|
|
183
|
+
BuildParam declare: <Api.BuildParam paramName="KEY" value={prop} />
|
|
184
|
+
<Admin.BuildParam paramName="KEY" value={prop} />
|
|
185
|
+
BuildParam read (API): buildParams.get<T>("KEY") via DI (→ webiny-api-architect)
|
|
186
|
+
BuildParam read (Admin): useBuildParams().get<T>("KEY") (→ webiny-admin-architect)
|
|
187
|
+
Import extensions: Always use .js extensions in import paths (ESM)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Related Skills
|
|
191
|
+
|
|
192
|
+
- **webiny-api-architect** — API-side architecture (features, abstractions, container registration)
|
|
193
|
+
- **webiny-admin-architect** — Admin-side architecture (headless + presentation features)
|
|
194
|
+
- **webiny-project-structure** — Extension registration and `webiny.config.tsx`
|
|
195
|
+
- **webiny-dependency-injection** — The `createImplementation` DI pattern and injectable services
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: webiny-admin-catalog
|
|
3
|
+
context: webiny-api
|
|
4
|
+
description: >
|
|
5
|
+
admin — 18 abstractions.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# admin
|
|
9
|
+
|
|
10
|
+
## How to Use
|
|
11
|
+
|
|
12
|
+
1. Find the abstraction you need below
|
|
13
|
+
2. Read the source file to get the exact interface and types
|
|
14
|
+
3. Import: `import { Name } from "<importPath>";`
|
|
15
|
+
|
|
16
|
+
## Abstractions
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
**Name:** `AdminConfig`
|
|
20
|
+
**Import:** `import { AdminConfig } from "webiny/admin"`
|
|
21
|
+
**Source:** `@webiny/app-admin/config/AdminConfig.tsx`
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
**Name:** `BaseError`
|
|
25
|
+
**Import:** `import { BaseError } from "webiny/admin"`
|
|
26
|
+
**Source:** `@webiny/feature/admin/index.ts`
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
**Name:** `BuildParam`
|
|
30
|
+
**Import:** `import { BuildParam } from "webiny/admin"`
|
|
31
|
+
**Source:** `@webiny/app-admin/features/buildParams/index.ts`
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
**Name:** `BuildParams`
|
|
35
|
+
**Import:** `import { BuildParams } from "webiny/admin"`
|
|
36
|
+
**Source:** `@webiny/app-admin/features/buildParams/index.ts`
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
**Name:** `createAbstraction`
|
|
40
|
+
**Import:** `import { createAbstraction } from "webiny/admin"`
|
|
41
|
+
**Source:** `@webiny/feature/admin/index.ts`
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
**Name:** `createFeature`
|
|
45
|
+
**Import:** `import { createFeature } from "webiny/admin"`
|
|
46
|
+
**Source:** `@webiny/feature/admin/index.ts`
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
**Name:** `createHasPermission`
|
|
50
|
+
**Import:** `import { createHasPermission } from "webiny/admin"`
|
|
51
|
+
**Source:** `@webiny/app-admin/permissions/index.ts`
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
**Name:** `createPermissionSchema`
|
|
55
|
+
**Import:** `import { createPermissionSchema } from "webiny/admin"`
|
|
56
|
+
**Source:** `@webiny/app-admin/permissions/index.ts`
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
**Name:** `createProvider`
|
|
60
|
+
**Import:** `import { createProvider } from "webiny/admin"`
|
|
61
|
+
**Source:** `@webiny/app/core/createProvider.tsx`
|
|
62
|
+
**Description:** Creates a Higher Order Component which wraps the entire app content.
|
|
63
|
+
This is mostly useful for adding React Context providers.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
**Name:** `createProviderPlugin`
|
|
67
|
+
**Import:** `import { createProviderPlugin } from "webiny/admin"`
|
|
68
|
+
**Source:** `@webiny/app/core/createProviderPlugin.tsx`
|
|
69
|
+
**Description:** Creates a component, which, when mounted, will register an app provider.
|
|
70
|
+
This is particularly useful for wrapping the entire app with custom React Context providers.
|
|
71
|
+
For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
**Name:** `createUsePermissions`
|
|
75
|
+
**Import:** `import { createUsePermissions } from "webiny/admin"`
|
|
76
|
+
**Source:** `@webiny/app-admin/permissions/index.ts`
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
**Name:** `DevToolsSection`
|
|
80
|
+
**Import:** `import { DevToolsSection } from "webiny/admin"`
|
|
81
|
+
**Source:** `@webiny/app-admin/components/index.ts`
|
|
82
|
+
**Description:** Registers a named section in the Webiny DevTools extension.
|
|
83
|
+
Renders nothing — purely a data registration side-effect.
|
|
84
|
+
|
|
85
|
+
When the component unmounts (e.g., route change), the section
|
|
86
|
+
is automatically removed from DevTools.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
**Name:** `NetworkErrorEventHandler`
|
|
90
|
+
**Import:** `import { NetworkErrorEventHandler } from "webiny/admin"`
|
|
91
|
+
**Source:** `@webiny/app/errors/index.ts`
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
**Name:** `Plugin`
|
|
95
|
+
**Import:** `import { Plugin } from "webiny/admin"`
|
|
96
|
+
**Source:** `@webiny/app/core/Plugin.tsx`
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
**Name:** `Provider`
|
|
100
|
+
**Import:** `import { Provider } from "webiny/admin"`
|
|
101
|
+
**Source:** `@webiny/app/core/Provider.tsx`
|
|
102
|
+
**Description:** Register a new React context provider.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
**Name:** `RegisterFeature`
|
|
106
|
+
**Import:** `import { RegisterFeature } from "webiny/admin"`
|
|
107
|
+
**Source:** `@webiny/app-admin/components/RegisterFeature.tsx`
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
**Name:** `Routes`
|
|
111
|
+
**Import:** `import { Routes } from "webiny/admin"`
|
|
112
|
+
**Source:** `@webiny/app-admin/routes.ts`
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
**Name:** `useFeature`
|
|
116
|
+
**Import:** `import { useFeature } from "webiny/admin"`
|
|
117
|
+
**Source:** `@webiny/app/shared/di/useFeature.ts`
|
|
118
|
+
|
|
119
|
+
---
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: webiny-admin-aco-catalog
|
|
3
|
+
context: webiny-api
|
|
4
|
+
description: >
|
|
5
|
+
admin/aco — 2 abstractions.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# admin/aco
|
|
9
|
+
|
|
10
|
+
## How to Use
|
|
11
|
+
|
|
12
|
+
1. Find the abstraction you need below
|
|
13
|
+
2. Read the source file to get the exact interface and types
|
|
14
|
+
3. Import: `import { Name } from "<importPath>";`
|
|
15
|
+
|
|
16
|
+
## Abstractions
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
**Name:** `useNavigateFolder`
|
|
20
|
+
**Import:** `import { useNavigateFolder } from "webiny/admin/aco"`
|
|
21
|
+
**Source:** `@webiny/app-aco/hooks/useNavigateFolder.ts`
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
**Name:** `useRecords`
|
|
25
|
+
**Import:** `import { useRecords } from "webiny/admin/aco"`
|
|
26
|
+
**Source:** `@webiny/app-aco/hooks/useRecords.ts`
|
|
27
|
+
|
|
28
|
+
---
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: webiny-admin-build-params-catalog
|
|
3
|
+
context: webiny-api
|
|
4
|
+
description: >
|
|
5
|
+
admin/build-params — 3 abstractions.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# admin/build-params
|
|
9
|
+
|
|
10
|
+
## How to Use
|
|
11
|
+
|
|
12
|
+
1. Find the abstraction you need below
|
|
13
|
+
2. Read the source file to get the exact interface and types
|
|
14
|
+
3. Import: `import { Name } from "<importPath>";`
|
|
15
|
+
|
|
16
|
+
## Abstractions
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
**Name:** `BuildParam`
|
|
20
|
+
**Import:** `import { BuildParam } from "webiny/admin/build-params"`
|
|
21
|
+
**Source:** `@webiny/app-admin/features/buildParams/index.ts`
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
**Name:** `BuildParams`
|
|
25
|
+
**Import:** `import { BuildParams } from "webiny/admin/build-params"`
|
|
26
|
+
**Source:** `@webiny/app-admin/features/buildParams/index.ts`
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
**Name:** `useBuildParams`
|
|
30
|
+
**Import:** `import { useBuildParams } from "webiny/admin/build-params"`
|
|
31
|
+
**Source:** `@webiny/app-admin/presentation/buildParams/useBuildParams.ts`
|
|
32
|
+
|
|
33
|
+
---
|