@mawaru/sdk 0.15.0 → 0.16.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/_schemas/graph.ts CHANGED
@@ -230,6 +230,29 @@ export const graphNodeHookSchema = z.object({
230
230
  export type GraphNodeHook = z.infer<typeof graphNodeHookSchema>
231
231
 
232
232
  // 新規ノードの id・ポートの id もクライアントが採番する(一時IDの解決を不要にする)
233
+ // ノードの表示アイコン:プリセット・絵文字・画像 URL のいずれか一つ。
234
+ // 未設定(省略)=既定の kind アイコン(docs/tasks/wip/ノードのアイコン(プログラム任意設定・HUMAN担当者の自動表示).md)。
235
+ // preset は契約上不透明な文字列(承認ビューと同じ方式):カタログはフロントが
236
+ // 表示時に参照し、無い key は既定グリフへフォールバックする
237
+ export const nodeIconSchema = z.union([
238
+ z.strictObject({ preset: z.string().min(1) }),
239
+ // ZWJ 合字の絵文字を許容する長さ(1グリフでも code unit は最大10超になりうる)
240
+ z.strictObject({ emoji: z.string().min(1).max(16) }),
241
+ z.strictObject({ image_url: z.url() }),
242
+ ])
243
+ export type NodeIcon = z.infer<typeof nodeIconSchema>
244
+
245
+ // mawaru 提供のプリセットアイコンのカタログ(SVG 実体はフロントに同梱)
246
+ export const NODE_ICON_PRESETS = [
247
+ { key: "github", name: "GitHub" },
248
+ { key: "slack", name: "Slack" },
249
+ { key: "gmail", name: "Gmail" },
250
+ { key: "google-sheets", name: "Google スプレッドシート" },
251
+ { key: "google-drive", name: "Google Drive" },
252
+ { key: "notion", name: "Notion" },
253
+ ] as const
254
+ export type NodeIconPresetKey = (typeof NODE_ICON_PRESETS)[number]["key"]
255
+
233
256
  export const graphNodeSchema = z.object({
234
257
  id: z.uuid(),
235
258
  kind: graphNodeKindSchema,
@@ -238,6 +261,8 @@ export const graphNodeSchema = z.object({
238
261
  hooks: z.array(graphNodeHookSchema).default([]),
239
262
  position_x: z.number(),
240
263
  position_y: z.number(),
264
+ // 表示アイコン(全 kind 共通の任意設定。human はフロントが担当から導出するので通常設定しない)
265
+ icon: nodeIconSchema.optional(),
241
266
  // kind 別設定(自 kind のときだけ意味を持つ。省略時は保存側がデフォルトを補う)
242
267
  wait: waitConfigSchema.optional(),
243
268
  program: programConfigSchema.optional(),
@@ -78,6 +78,34 @@ export declare const graphNodeHookSchema: z.ZodObject<{
78
78
  on_signal: z.ZodDefault<z.ZodBoolean>;
79
79
  }, z.core.$strip>;
80
80
  export type GraphNodeHook = z.infer<typeof graphNodeHookSchema>;
81
+ export declare const nodeIconSchema: z.ZodUnion<readonly [z.ZodObject<{
82
+ preset: z.ZodString;
83
+ }, z.core.$strict>, z.ZodObject<{
84
+ emoji: z.ZodString;
85
+ }, z.core.$strict>, z.ZodObject<{
86
+ image_url: z.ZodURL;
87
+ }, z.core.$strict>]>;
88
+ export type NodeIcon = z.infer<typeof nodeIconSchema>;
89
+ export declare const NODE_ICON_PRESETS: readonly [{
90
+ readonly key: "github";
91
+ readonly name: "GitHub";
92
+ }, {
93
+ readonly key: "slack";
94
+ readonly name: "Slack";
95
+ }, {
96
+ readonly key: "gmail";
97
+ readonly name: "Gmail";
98
+ }, {
99
+ readonly key: "google-sheets";
100
+ readonly name: "Google スプレッドシート";
101
+ }, {
102
+ readonly key: "google-drive";
103
+ readonly name: "Google Drive";
104
+ }, {
105
+ readonly key: "notion";
106
+ readonly name: "Notion";
107
+ }];
108
+ export type NodeIconPresetKey = (typeof NODE_ICON_PRESETS)[number]["key"];
81
109
  export declare const graphNodeSchema: z.ZodObject<{
82
110
  id: z.ZodUUID;
83
111
  kind: z.ZodEnum<{
@@ -117,6 +145,13 @@ export declare const graphNodeSchema: z.ZodObject<{
117
145
  }, z.core.$strip>>>;
118
146
  position_x: z.ZodNumber;
119
147
  position_y: z.ZodNumber;
148
+ icon: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
149
+ preset: z.ZodString;
150
+ }, z.core.$strict>, z.ZodObject<{
151
+ emoji: z.ZodString;
152
+ }, z.core.$strict>, z.ZodObject<{
153
+ image_url: z.ZodURL;
154
+ }, z.core.$strict>]>>;
120
155
  wait: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
121
156
  wait_type: z.ZodLiteral<"duration">;
122
157
  duration_seconds: z.ZodNumber;
@@ -209,6 +244,13 @@ export declare const saveGraphBodySchema: z.ZodObject<{
209
244
  }, z.core.$strip>>>;
210
245
  position_x: z.ZodNumber;
211
246
  position_y: z.ZodNumber;
247
+ icon: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
248
+ preset: z.ZodString;
249
+ }, z.core.$strict>, z.ZodObject<{
250
+ emoji: z.ZodString;
251
+ }, z.core.$strict>, z.ZodObject<{
252
+ image_url: z.ZodURL;
253
+ }, z.core.$strict>]>>;
212
254
  wait: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
213
255
  wait_type: z.ZodLiteral<"duration">;
214
256
  duration_seconds: z.ZodNumber;
@@ -178,6 +178,25 @@ export const graphNodeHookSchema = z.object({
178
178
  on_signal: z.boolean().default(false),
179
179
  });
180
180
  // 新規ノードの id・ポートの id もクライアントが採番する(一時IDの解決を不要にする)
181
+ // ノードの表示アイコン:プリセット・絵文字・画像 URL のいずれか一つ。
182
+ // 未設定(省略)=既定の kind アイコン(docs/tasks/wip/ノードのアイコン(プログラム任意設定・HUMAN担当者の自動表示).md)。
183
+ // preset は契約上不透明な文字列(承認ビューと同じ方式):カタログはフロントが
184
+ // 表示時に参照し、無い key は既定グリフへフォールバックする
185
+ export const nodeIconSchema = z.union([
186
+ z.strictObject({ preset: z.string().min(1) }),
187
+ // ZWJ 合字の絵文字を許容する長さ(1グリフでも code unit は最大10超になりうる)
188
+ z.strictObject({ emoji: z.string().min(1).max(16) }),
189
+ z.strictObject({ image_url: z.url() }),
190
+ ]);
191
+ // mawaru 提供のプリセットアイコンのカタログ(SVG 実体はフロントに同梱)
192
+ export const NODE_ICON_PRESETS = [
193
+ { key: "github", name: "GitHub" },
194
+ { key: "slack", name: "Slack" },
195
+ { key: "gmail", name: "Gmail" },
196
+ { key: "google-sheets", name: "Google スプレッドシート" },
197
+ { key: "google-drive", name: "Google Drive" },
198
+ { key: "notion", name: "Notion" },
199
+ ];
181
200
  export const graphNodeSchema = z.object({
182
201
  id: z.uuid(),
183
202
  kind: graphNodeKindSchema,
@@ -186,6 +205,8 @@ export const graphNodeSchema = z.object({
186
205
  hooks: z.array(graphNodeHookSchema).default([]),
187
206
  position_x: z.number(),
188
207
  position_y: z.number(),
208
+ // 表示アイコン(全 kind 共通の任意設定。human はフロントが担当から導出するので通常設定しない)
209
+ icon: nodeIconSchema.optional(),
189
210
  // kind 別設定(自 kind のときだけ意味を持つ。省略時は保存側がデフォルトを補う)
190
211
  wait: waitConfigSchema.optional(),
191
212
  program: programConfigSchema.optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mawaru/sdk",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "mawaru 実行 repo の開発 SDK。契約スキーマ(config.json 規約・ループ graph API)の正 + typegen / validate CLI",
5
5
  "type": "module",
6
6
  "bin": {