@webiny/mcp 6.0.0 → 6.1.0-beta.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/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
|
@@ -159,32 +159,6 @@ State files are JSON files that track the current state of your deployment:
|
|
|
159
159
|
- Essential for managing environments and tracking changes
|
|
160
160
|
- Stored in S3 by default
|
|
161
161
|
|
|
162
|
-
## Build Parameters
|
|
163
|
-
|
|
164
|
-
Pass custom config values from `webiny.config.tsx` to your extensions:
|
|
165
|
-
|
|
166
|
-
```tsx
|
|
167
|
-
// webiny.config.tsx
|
|
168
|
-
<Api.BuildParam paramName="MY_PARAM" value="customValue" />
|
|
169
|
-
<Api.BuildParam paramName="MY_CONFIG" value={{ myKey: 2, nested: { foo: "bar" } }} />
|
|
170
|
-
<Admin.BuildParam paramName="ADMIN_PARAM" value="adminValue" />
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
Access in API extensions:
|
|
174
|
-
|
|
175
|
-
```typescript
|
|
176
|
-
import { BuildParams } from "webiny/api/build-params";
|
|
177
|
-
|
|
178
|
-
class MyExtension implements SomeFactory.Interface {
|
|
179
|
-
constructor(private buildParams: BuildParams.Interface) {}
|
|
180
|
-
|
|
181
|
-
execute() {
|
|
182
|
-
const value = this.buildParams.get<string>("MY_PARAM");
|
|
183
|
-
const config = this.buildParams.get<{ myKey: number }>("MY_CONFIG");
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
```
|
|
187
|
-
|
|
188
162
|
## Debugging
|
|
189
163
|
|
|
190
164
|
### API Errors
|
|
@@ -250,5 +224,5 @@ After watch: yarn webiny deploy api (MUST redeploy!)
|
|
|
250
224
|
|
|
251
225
|
## Related Skills
|
|
252
226
|
|
|
253
|
-
- `project-structure` -- Project layout and `webiny.config.tsx`
|
|
254
|
-
- `infrastructure-extensions` -- Customizing AWS infrastructure and environments
|
|
227
|
+
- `webiny-project-structure` -- Project layout and `webiny.config.tsx`
|
|
228
|
+
- `webiny-infrastructure-extensions` -- Customizing AWS infrastructure and environments
|
|
@@ -35,6 +35,7 @@ my-webiny-project/
|
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
Key points:
|
|
38
|
+
|
|
38
39
|
- **Single `package.json`** -- no monorepo, no workspaces needed.
|
|
39
40
|
- **Single `tsconfig.json`** -- straightforward TypeScript setup.
|
|
40
41
|
- **`webiny.config.tsx`** -- the entry point for everything. All extensions, infrastructure options, and project settings are declared here.
|
|
@@ -51,66 +52,66 @@ import { Admin, Api, Cli, Infra, Project, Security } from "webiny/extensions";
|
|
|
51
52
|
import { Cognito } from "@webiny/cognito";
|
|
52
53
|
|
|
53
54
|
export const Extensions = () => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
55
|
+
return (
|
|
56
|
+
<>
|
|
57
|
+
{/* Infrastructure configuration */}
|
|
58
|
+
<Infra.Aws.DefaultRegion name={"us-east-1"} />
|
|
59
|
+
<Infra.OpenSearch enabled={true} />
|
|
60
|
+
<Infra.Aws.Tags tags={{ OWNER: "me", PROJECT: "my-project" }} />
|
|
61
|
+
|
|
62
|
+
{/* Identity provider */}
|
|
63
|
+
<Cognito />
|
|
64
|
+
|
|
65
|
+
{/* API extensions (backend) */}
|
|
66
|
+
<Api.Extension src={"/extensions/ProductCategoryModel.ts"} />
|
|
67
|
+
<Api.Extension src={"/extensions/ProductModel.ts"} />
|
|
68
|
+
<Api.Extension src={"/extensions/contactSubmission/ContactSubmissionHook.ts"} />
|
|
69
|
+
|
|
70
|
+
{/* Security hooks */}
|
|
71
|
+
<Api.Extension src={"/extensions/MyApiKey.ts"} />
|
|
72
|
+
<Security.ApiKey.AfterUpdate src={"/extensions/MyApiKeyAfterUpdate.ts"} />
|
|
73
|
+
|
|
74
|
+
{/* Admin extensions (frontend) */}
|
|
75
|
+
<Admin.Extension src={"/extensions/AdminTheme/AdminTheme.tsx"} />
|
|
76
|
+
<Admin.Extension src={"/extensions/AdminTitleLogo/AdminTitleLogo.tsx"} />
|
|
77
|
+
<Admin.Extension src={"/extensions/contactSubmission/EmailEntryListColumn.tsx"} />
|
|
78
|
+
|
|
79
|
+
{/* Infrastructure / Pulumi extensions */}
|
|
80
|
+
<Infra.Core.Pulumi src={"/extensions/MyCorePulumiHandler.ts"} />
|
|
81
|
+
|
|
82
|
+
{/* CLI extensions */}
|
|
83
|
+
<Cli.Command src={"/extensions/MyCustomCommand.ts"} />
|
|
84
|
+
|
|
85
|
+
{/* Project settings */}
|
|
86
|
+
<Project.Telemetry enabled={false} />
|
|
87
|
+
</>
|
|
88
|
+
);
|
|
88
89
|
};
|
|
89
90
|
```
|
|
90
91
|
|
|
91
92
|
## Extension Types
|
|
92
93
|
|
|
93
|
-
| JSX Element
|
|
94
|
-
|
|
95
|
-
| `<Api.Extension src="..." />`
|
|
96
|
-
| `<Admin.Extension src="..." />`
|
|
97
|
-
| `<Infra.Core.Pulumi src="..." />`
|
|
98
|
-
| `<Cli.Command src="..." />`
|
|
99
|
-
| `<Security.ApiKey.AfterUpdate src="..." />` | Registers a security lifecycle hook
|
|
94
|
+
| JSX Element | What It Does | File Type |
|
|
95
|
+
| ------------------------------------------- | ---------------------------------------------------------------------------------------- | --------- |
|
|
96
|
+
| `<Api.Extension src="..." />` | Registers a backend extension (GraphQL schemas, content models, lifecycle hooks) | `.ts` |
|
|
97
|
+
| `<Admin.Extension src="..." />` | Registers a frontend Admin UI extension (themes, branding, custom columns, custom forms) | `.tsx` |
|
|
98
|
+
| `<Infra.Core.Pulumi src="..." />` | Registers a Pulumi infrastructure handler | `.ts` |
|
|
99
|
+
| `<Cli.Command src="..." />` | Registers a custom CLI command | `.ts` |
|
|
100
|
+
| `<Security.ApiKey.AfterUpdate src="..." />` | Registers a security lifecycle hook | `.ts` |
|
|
100
101
|
|
|
101
102
|
## Infrastructure Components
|
|
102
103
|
|
|
103
104
|
Declarative components for configuring AWS infrastructure:
|
|
104
105
|
|
|
105
|
-
| Component
|
|
106
|
-
|
|
107
|
-
| `<Infra.Aws.DefaultRegion name="us-east-1" />`
|
|
108
|
-
| `<Infra.Aws.Tags tags={{ KEY: "value" }} />`
|
|
109
|
-
| `<Infra.OpenSearch enabled={true} />`
|
|
110
|
-
| `<Infra.Vpc enabled={true} />`
|
|
111
|
-
| `<Infra.PulumiResourceNamePrefix prefix="myproj-" />`
|
|
106
|
+
| Component | Purpose |
|
|
107
|
+
| --------------------------------------------------------------------- | -------------------------------------- |
|
|
108
|
+
| `<Infra.Aws.DefaultRegion name="us-east-1" />` | Set the AWS region |
|
|
109
|
+
| `<Infra.Aws.Tags tags={{ KEY: "value" }} />` | Apply tags to all AWS resources |
|
|
110
|
+
| `<Infra.OpenSearch enabled={true} />` | Enable/disable OpenSearch |
|
|
111
|
+
| `<Infra.Vpc enabled={true} />` | Enable/disable VPC deployment |
|
|
112
|
+
| `<Infra.PulumiResourceNamePrefix prefix="myproj-" />` | Prefix all Pulumi resource names |
|
|
112
113
|
| `<Infra.ProductionEnvironments environments={["prod", "staging"]} />` | Define which envs use production infra |
|
|
113
|
-
| `<Project.Telemetry enabled={false} />`
|
|
114
|
+
| `<Project.Telemetry enabled={false} />` | Enable/disable telemetry |
|
|
114
115
|
|
|
115
116
|
## Environment-Conditional Configuration
|
|
116
117
|
|
|
@@ -130,15 +131,35 @@ Use `<Infra.Env.Is>` to load extensions or config only in specific environments:
|
|
|
130
131
|
|
|
131
132
|
## Build Parameters
|
|
132
133
|
|
|
133
|
-
|
|
134
|
+
Build parameters pass values from config to extensions at build time. They are accessed in backend code via the `BuildParams` DI service (see dependency-injection skill).
|
|
135
|
+
|
|
136
|
+
**Rule: `<Api.BuildParam>` and `<Admin.BuildParam>` MUST live inside the extension's `Extension.tsx`, NOT directly in `webiny.config.tsx`.** Required parameters are exposed as React props on the extension component. The consumer in `webiny.config.tsx` decides where the value comes from (env var, hardcoded, config, etc.).
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
// extensions/myExtension/Extension.tsx
|
|
140
|
+
import React from "react";
|
|
141
|
+
import { Api } from "webiny/extensions";
|
|
142
|
+
|
|
143
|
+
interface MyExtensionProps {
|
|
144
|
+
apiKey: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export const MyExtension = ({ apiKey }: MyExtensionProps) => {
|
|
148
|
+
return (
|
|
149
|
+
<>
|
|
150
|
+
<Api.BuildParam paramName="MY_API_KEY" value={apiKey} />
|
|
151
|
+
<Api.Extension src={"@/extensions/myExtension/features/myService/feature.ts"} />
|
|
152
|
+
</>
|
|
153
|
+
);
|
|
154
|
+
};
|
|
155
|
+
```
|
|
134
156
|
|
|
135
157
|
```tsx
|
|
136
|
-
|
|
137
|
-
<
|
|
138
|
-
<Admin.BuildParam paramName="ADMIN_CUSTOM_PARAM" value="adminValue" />
|
|
158
|
+
// webiny.config.tsx — consumer decides where the value comes from
|
|
159
|
+
<MyExtension apiKey={process.env.MY_API_KEY || ""} />
|
|
139
160
|
```
|
|
140
161
|
|
|
141
|
-
|
|
162
|
+
This keeps extensions self-contained — all required configuration is declared via typed props in one place.
|
|
142
163
|
|
|
143
164
|
## Installing Pre-Built Extensions
|
|
144
165
|
|
|
@@ -152,5 +173,6 @@ This downloads the extension code into `extensions/`, updates `webiny.config.tsx
|
|
|
152
173
|
|
|
153
174
|
## Related Skills
|
|
154
175
|
|
|
155
|
-
- `dependency-injection` -- How extensions use DI to access services
|
|
156
|
-
- `local-development` -- How to deploy and develop locally
|
|
176
|
+
- `webiny-dependency-injection` -- How extensions use DI to access services
|
|
177
|
+
- `webiny-local-development` -- How to deploy and develop locally
|
|
178
|
+
- `webiny-full-stack-architect` -- Full-stack extension skeleton, entry points, and shared domain layer
|
|
@@ -29,9 +29,9 @@ Initialize once and reuse:
|
|
|
29
29
|
import { Sdk } from "@webiny/sdk";
|
|
30
30
|
|
|
31
31
|
export const sdk = new Sdk({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
token: process.env.WEBINY_API_TOKEN!,
|
|
33
|
+
endpoint: process.env.WEBINY_API_ENDPOINT!,
|
|
34
|
+
tenant: process.env.WEBINY_API_TENANT || "root"
|
|
35
35
|
});
|
|
36
36
|
```
|
|
37
37
|
|
|
@@ -43,13 +43,14 @@ export const sdk = new Sdk({
|
|
|
43
43
|
|
|
44
44
|
Webiny provides three separate GraphQL APIs:
|
|
45
45
|
|
|
46
|
-
| API
|
|
47
|
-
|
|
48
|
-
| **Read**
|
|
49
|
-
| **Manage**
|
|
50
|
-
| **Preview** | `/cms/preview` | Latest revisions (drafts + published) | No
|
|
46
|
+
| API | URL Path | Returns | Can Write | Use For |
|
|
47
|
+
| ----------- | -------------- | ------------------------------------- | --------- | ----------------------------- |
|
|
48
|
+
| **Read** | `/cms/read` | Published entries only | No | Public-facing apps, SSG |
|
|
49
|
+
| **Manage** | `/cms/manage` | All revisions (drafts + published) | Yes | Admin tools, content creation |
|
|
50
|
+
| **Preview** | `/cms/preview` | Latest revisions (drafts + published) | No | Content preview |
|
|
51
51
|
|
|
52
52
|
The SDK automatically routes to the correct API based on the method:
|
|
53
|
+
|
|
53
54
|
- `listEntries`, `getEntry` -> Read API
|
|
54
55
|
- `createEntry`, `updateEntry`, `publishEntry`, `unpublishEntry` -> Manage API
|
|
55
56
|
|
|
@@ -61,9 +62,9 @@ Every SDK method returns a `Result` object -- it never throws:
|
|
|
61
62
|
const result = await sdk.cms.listEntries({ modelId: "product", fields: ["id"] });
|
|
62
63
|
|
|
63
64
|
if (result.isOk()) {
|
|
64
|
-
|
|
65
|
+
console.log(result.value.data); // success -- typed data
|
|
65
66
|
} else {
|
|
66
|
-
|
|
67
|
+
console.error(result.error.message); // failure -- error info
|
|
67
68
|
}
|
|
68
69
|
```
|
|
69
70
|
|
|
@@ -75,26 +76,26 @@ Pass a type parameter for full type safety on `values`:
|
|
|
75
76
|
import type { CmsEntryData } from "@webiny/sdk";
|
|
76
77
|
|
|
77
78
|
interface Product {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
name: string;
|
|
80
|
+
price: number;
|
|
81
|
+
sku: string;
|
|
82
|
+
description: string;
|
|
83
|
+
category?: CmsEntryData<ProductCategory>;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
interface ProductCategory {
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
name: string;
|
|
88
|
+
slug: string;
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
const result = await sdk.cms.listEntries<Product>({
|
|
91
|
-
|
|
92
|
+
modelId: "product"
|
|
92
93
|
});
|
|
93
94
|
|
|
94
95
|
if (result.isOk()) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
// result.value.data is CmsEntryData<Product>[]
|
|
97
|
+
const products = result.value.data;
|
|
98
|
+
// products[0].values.name -- fully typed
|
|
98
99
|
}
|
|
99
100
|
```
|
|
100
101
|
|
|
@@ -106,9 +107,9 @@ Reference fields like `category` are typed as `CmsEntryData<T>`, which wraps ref
|
|
|
106
107
|
|
|
107
108
|
```typescript
|
|
108
109
|
const result = await sdk.cms.listEntries<Product>({
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
modelId: "product",
|
|
111
|
+
sort: ["values.name_ASC"],
|
|
112
|
+
limit: 10
|
|
112
113
|
});
|
|
113
114
|
```
|
|
114
115
|
|
|
@@ -116,43 +117,43 @@ const result = await sdk.cms.listEntries<Product>({
|
|
|
116
117
|
|
|
117
118
|
```typescript
|
|
118
119
|
const result = await sdk.cms.listEntries<Product>({
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
modelId: "product",
|
|
121
|
+
where: {
|
|
122
|
+
"values.price_gte": 100,
|
|
123
|
+
"values.name_contains": "Pro"
|
|
124
|
+
},
|
|
125
|
+
sort: ["values.price_DESC"]
|
|
125
126
|
});
|
|
126
127
|
```
|
|
127
128
|
|
|
128
129
|
### Filter Operators
|
|
129
130
|
|
|
130
|
-
| Operator
|
|
131
|
-
|
|
132
|
-
| `_eq`
|
|
133
|
-
| `_not`
|
|
134
|
-
| `_contains`
|
|
135
|
-
| `_startsWith`
|
|
136
|
-
| `_gt` / `_gte` | Greater than / >=
|
|
137
|
-
| `_lt` / `_lte` | Less than / <=
|
|
138
|
-
| `_in`
|
|
131
|
+
| Operator | Description | Example |
|
|
132
|
+
| -------------- | ------------------ | -------------------------------------------- |
|
|
133
|
+
| `_eq` | Equals (default) | `"values.status": "active"` |
|
|
134
|
+
| `_not` | Not equals | `"values.status_not": "archived"` |
|
|
135
|
+
| `_contains` | Contains substring | `"values.name_contains": "Pro"` |
|
|
136
|
+
| `_startsWith` | Starts with | `"values.name_startsWith": "Web"` |
|
|
137
|
+
| `_gt` / `_gte` | Greater than / >= | `"values.price_gte": 100` |
|
|
138
|
+
| `_lt` / `_lte` | Less than / <= | `"values.price_lt": 500` |
|
|
139
|
+
| `_in` | In array | `"values.status_in": ["active", "featured"]` |
|
|
139
140
|
|
|
140
141
|
### Sort Format
|
|
141
142
|
|
|
142
143
|
Sort strings follow the pattern `values.<fieldId>_ASC` or `values.<fieldId>_DESC`:
|
|
143
144
|
|
|
144
145
|
```typescript
|
|
145
|
-
sort: ["values.name_ASC"]
|
|
146
|
-
sort: ["values.price_DESC"]
|
|
147
|
-
sort: ["values.createdOn_DESC"]
|
|
146
|
+
sort: ["values.name_ASC"]; // alphabetical
|
|
147
|
+
sort: ["values.price_DESC"]; // highest price first
|
|
148
|
+
sort: ["values.createdOn_DESC"]; // newest first
|
|
148
149
|
```
|
|
149
150
|
|
|
150
151
|
### Get Single Entry
|
|
151
152
|
|
|
152
153
|
```typescript
|
|
153
154
|
const result = await sdk.cms.getEntry<Product>({
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
modelId: "product",
|
|
156
|
+
id: "abc123#0001"
|
|
156
157
|
});
|
|
157
158
|
```
|
|
158
159
|
|
|
@@ -162,8 +163,8 @@ Control which fields are returned:
|
|
|
162
163
|
|
|
163
164
|
```typescript
|
|
164
165
|
const result = await sdk.cms.listEntries<Product>({
|
|
165
|
-
|
|
166
|
-
|
|
166
|
+
modelId: "product",
|
|
167
|
+
fields: ["id", "values.name", "values.price"]
|
|
167
168
|
});
|
|
168
169
|
```
|
|
169
170
|
|
|
@@ -175,12 +176,12 @@ When omitted, all fields are returned. The `depth` parameter (default: `1`) cont
|
|
|
175
176
|
|
|
176
177
|
```typescript
|
|
177
178
|
const result = await sdk.cms.createEntry({
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
179
|
+
modelId: "contactSubmission",
|
|
180
|
+
data: {
|
|
181
|
+
name: "John Doe",
|
|
182
|
+
email: "john@example.com",
|
|
183
|
+
message: "Hello from the contact form!"
|
|
184
|
+
}
|
|
184
185
|
});
|
|
185
186
|
```
|
|
186
187
|
|
|
@@ -188,11 +189,11 @@ const result = await sdk.cms.createEntry({
|
|
|
188
189
|
|
|
189
190
|
```typescript
|
|
190
191
|
const result = await sdk.cms.updateEntry({
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
modelId: "product",
|
|
193
|
+
id: "abc123#0001",
|
|
194
|
+
data: {
|
|
195
|
+
price: 29.99
|
|
196
|
+
}
|
|
196
197
|
});
|
|
197
198
|
```
|
|
198
199
|
|
|
@@ -222,21 +223,21 @@ For programmatic access, create API keys as an extension:
|
|
|
222
223
|
import { ApiKeyFactory } from "webiny/api/security";
|
|
223
224
|
|
|
224
225
|
class MyApiKeyImpl implements ApiKeyFactory.Interface {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
226
|
+
execute(): ApiKeyFactory.Return {
|
|
227
|
+
return [
|
|
228
|
+
{
|
|
229
|
+
name: "Universal API Key",
|
|
230
|
+
slug: "universal-key",
|
|
231
|
+
token: "wat_12345678",
|
|
232
|
+
permissions: [{ name: "*" }]
|
|
233
|
+
}
|
|
234
|
+
];
|
|
235
|
+
}
|
|
235
236
|
}
|
|
236
237
|
|
|
237
238
|
export default ApiKeyFactory.createImplementation({
|
|
238
|
-
|
|
239
|
-
|
|
239
|
+
implementation: MyApiKeyImpl,
|
|
240
|
+
dependencies: []
|
|
240
241
|
});
|
|
241
242
|
```
|
|
242
243
|
|
|
@@ -248,11 +249,11 @@ Register:
|
|
|
248
249
|
|
|
249
250
|
## SDK Modules Reference
|
|
250
251
|
|
|
251
|
-
| Module
|
|
252
|
-
|
|
253
|
-
| `sdk.cms`
|
|
254
|
-
| `sdk.fileManager`
|
|
255
|
-
| `sdk.websiteBuilder` | Website Builder | List and retrieve website builder content
|
|
252
|
+
| Module | Webiny App | What You Can Do |
|
|
253
|
+
| -------------------- | --------------- | ----------------------------------------------------- |
|
|
254
|
+
| `sdk.cms` | Headless CMS | List, get, create, update, publish, unpublish entries |
|
|
255
|
+
| `sdk.fileManager` | File Manager | List, upload, and manage files and folders |
|
|
256
|
+
| `sdk.websiteBuilder` | Website Builder | List and retrieve website builder content |
|
|
256
257
|
|
|
257
258
|
## Quick Reference
|
|
258
259
|
|
|
@@ -267,5 +268,5 @@ API endpoint: yarn webiny info (in your Webiny project)
|
|
|
267
268
|
|
|
268
269
|
## Related Skills
|
|
269
270
|
|
|
270
|
-
- `content-models` -- Define the models you query with the SDK
|
|
271
|
-
- `website-builder` -- Use the SDK inside Website Builder components to fetch CMS data
|
|
271
|
+
- `webiny-api-cms-content-models` -- Define the models you query with the SDK
|
|
272
|
+
- `webiny-website-builder` -- Use the SDK inside Website Builder components to fetch CMS data
|