@kvasar/openclaw-storyblok-plugin 0.1.5 → 0.1.6
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/index.ts +55 -14
- package/openclaw.plugin.json +1 -1
- package/package.json +5 -5
- package/src/openclaw-plugin-entry.d.ts +3 -0
- package/tsconfig.json +2 -2
package/index.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { Type } from "@sinclair/typebox";
|
|
11
11
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
12
12
|
|
|
13
|
-
import { StoryblokClient } from "./src/client.js";
|
|
13
|
+
import { StoryblokClient, type StoryblokConfig } from "./src/client.js";
|
|
14
14
|
import { validateConfig, redactTokens } from "./src/config.js";
|
|
15
15
|
|
|
16
16
|
interface StoryblokPluginConfig {
|
|
@@ -20,6 +20,39 @@ interface StoryblokPluginConfig {
|
|
|
20
20
|
previewToken?: string;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
interface OpenClawPluginApi {
|
|
24
|
+
pluginConfig?: unknown;
|
|
25
|
+
config?: unknown;
|
|
26
|
+
registerTool(tool: {
|
|
27
|
+
name: string;
|
|
28
|
+
description: string;
|
|
29
|
+
parameters: unknown;
|
|
30
|
+
execute: (_id?: string, params?: any) => Promise<unknown> | unknown;
|
|
31
|
+
}): void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface CreateStoryParams {
|
|
35
|
+
title: string;
|
|
36
|
+
slug?: string;
|
|
37
|
+
folder_id?: number;
|
|
38
|
+
parent_id?: number;
|
|
39
|
+
content?: Record<string, any>;
|
|
40
|
+
tags?: string[];
|
|
41
|
+
is_folder?: boolean;
|
|
42
|
+
language?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface UpdateStoryParams {
|
|
46
|
+
story_id: string;
|
|
47
|
+
title?: string;
|
|
48
|
+
slug?: string;
|
|
49
|
+
content?: Record<string, any>;
|
|
50
|
+
parent_id?: number;
|
|
51
|
+
tags?: string[];
|
|
52
|
+
language?: string;
|
|
53
|
+
version?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
23
56
|
function ok(data: unknown) {
|
|
24
57
|
return {
|
|
25
58
|
content: [
|
|
@@ -56,10 +89,10 @@ export default definePluginEntry({
|
|
|
56
89
|
description:
|
|
57
90
|
"Interact with Storyblok CMS: manage stories, components, and space information.",
|
|
58
91
|
|
|
59
|
-
register(api) {
|
|
92
|
+
register(api: OpenClawPluginApi) {
|
|
60
93
|
const rawCfg = (
|
|
61
|
-
|
|
62
|
-
|
|
94
|
+
api.pluginConfig ??
|
|
95
|
+
api.config ??
|
|
63
96
|
{}
|
|
64
97
|
) as StoryblokPluginConfig;
|
|
65
98
|
|
|
@@ -79,7 +112,14 @@ export default definePluginEntry({
|
|
|
79
112
|
);
|
|
80
113
|
}
|
|
81
114
|
|
|
82
|
-
const
|
|
115
|
+
const clientCfg: StoryblokConfig = {
|
|
116
|
+
baseUrl: cfg.baseUrl ?? "https://api.storyblok.com",
|
|
117
|
+
spaceId: cfg.spaceId ?? "",
|
|
118
|
+
managementToken: cfg.managementToken ?? "",
|
|
119
|
+
previewToken: cfg.previewToken,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const client = new StoryblokClient(clientCfg);
|
|
83
123
|
|
|
84
124
|
api.registerTool({
|
|
85
125
|
name: "storyblok_get_space",
|
|
@@ -111,7 +151,7 @@ export default definePluginEntry({
|
|
|
111
151
|
svg_render: Type.Optional(Type.Boolean()),
|
|
112
152
|
}),
|
|
113
153
|
async execute(
|
|
114
|
-
_id: string,
|
|
154
|
+
_id: string | undefined,
|
|
115
155
|
params: {
|
|
116
156
|
identifier: string;
|
|
117
157
|
version?: string;
|
|
@@ -146,7 +186,7 @@ export default definePluginEntry({
|
|
|
146
186
|
sort_by: Type.Optional(Type.String()),
|
|
147
187
|
direction: Type.Optional(Type.String()),
|
|
148
188
|
}),
|
|
149
|
-
async execute(_id: string, params: Record<string, any>) {
|
|
189
|
+
async execute(_id: string | undefined, params: Record<string, any>) {
|
|
150
190
|
try {
|
|
151
191
|
return ok(await client.listStories(params));
|
|
152
192
|
} catch (error) {
|
|
@@ -170,7 +210,7 @@ export default definePluginEntry({
|
|
|
170
210
|
is_folder: Type.Optional(Type.Boolean()),
|
|
171
211
|
language: Type.Optional(Type.String()),
|
|
172
212
|
}),
|
|
173
|
-
async execute(_id: string, params:
|
|
213
|
+
async execute(_id: string | undefined, params: CreateStoryParams) {
|
|
174
214
|
try {
|
|
175
215
|
return ok(await client.createStory(params));
|
|
176
216
|
} catch (error) {
|
|
@@ -194,12 +234,13 @@ export default definePluginEntry({
|
|
|
194
234
|
language: Type.Optional(Type.String()),
|
|
195
235
|
version: Type.Optional(Type.String()),
|
|
196
236
|
}),
|
|
197
|
-
async execute(_id: string, params:
|
|
237
|
+
async execute(_id: string | undefined, params: UpdateStoryParams) {
|
|
198
238
|
try {
|
|
239
|
+
const { story_id, ...update } = params;
|
|
199
240
|
return ok(
|
|
200
241
|
await client.updateStory(
|
|
201
|
-
|
|
202
|
-
|
|
242
|
+
story_id,
|
|
243
|
+
update
|
|
203
244
|
)
|
|
204
245
|
);
|
|
205
246
|
} catch (error) {
|
|
@@ -217,7 +258,7 @@ export default definePluginEntry({
|
|
|
217
258
|
language: Type.Optional(Type.String()),
|
|
218
259
|
publish_notes: Type.Optional(Type.String()),
|
|
219
260
|
}),
|
|
220
|
-
async execute(_id: string, params: Record<string, any>) {
|
|
261
|
+
async execute(_id: string | undefined, params: Record<string, any>) {
|
|
221
262
|
try {
|
|
222
263
|
return ok(
|
|
223
264
|
await client.publishStory(params.story_id, {
|
|
@@ -239,7 +280,7 @@ export default definePluginEntry({
|
|
|
239
280
|
story_id: Type.String(),
|
|
240
281
|
language: Type.Optional(Type.String()),
|
|
241
282
|
}),
|
|
242
|
-
async execute(_id: string, params: Record<string, any>) {
|
|
283
|
+
async execute(_id: string | undefined, params: Record<string, any>) {
|
|
243
284
|
try {
|
|
244
285
|
return ok(
|
|
245
286
|
await client.unpublishStory(
|
|
@@ -260,7 +301,7 @@ export default definePluginEntry({
|
|
|
260
301
|
version: Type.Optional(Type.String()),
|
|
261
302
|
language: Type.Optional(Type.String()),
|
|
262
303
|
}),
|
|
263
|
-
async execute(_id: string, params: Record<string, any>) {
|
|
304
|
+
async execute(_id: string | undefined, params: Record<string, any>) {
|
|
264
305
|
try {
|
|
265
306
|
return ok(
|
|
266
307
|
await client.getComponents(
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "openclaw-storyblok",
|
|
3
3
|
"name": "Storyblok Integration",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.6",
|
|
5
5
|
"description": "Provides tools to interact with Storyblok CMS via Management API and Delivery API. Supports stories, components, and space management.",
|
|
6
6
|
"skills": ["skills"],
|
|
7
7
|
"configSchema": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kvasar/openclaw-storyblok-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "OpenClaw plugin — interact with Storyblok CMS via Management API and Delivery API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.ts",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"./index.ts"
|
|
25
25
|
],
|
|
26
26
|
"compat": {
|
|
27
|
-
"pluginApi": ">=2026.3.
|
|
28
|
-
"minGatewayVersion": "2026.3.
|
|
27
|
+
"pluginApi": ">=2026.3.13",
|
|
28
|
+
"minGatewayVersion": "2026.3.13"
|
|
29
29
|
},
|
|
30
30
|
"build": {
|
|
31
|
-
"openclawVersion": "2026.3.
|
|
32
|
-
"pluginSdkVersion": "2026.3.
|
|
31
|
+
"openclawVersion": "2026.3.13",
|
|
32
|
+
"pluginSdkVersion": "2026.3.13"
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
package/tsconfig.json
CHANGED