@wordrhyme/plugin 0.1.0-alpha.5

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.
Files changed (52) hide show
  1. package/dist/admin/index.d.ts +19 -0
  2. package/dist/admin/index.js +42 -0
  3. package/dist/admin/index.js.map +1 -0
  4. package/dist/artifact.d.ts +17 -0
  5. package/dist/artifact.js +96 -0
  6. package/dist/artifact.js.map +1 -0
  7. package/dist/chunk-46KUIGB6.js +230 -0
  8. package/dist/chunk-46KUIGB6.js.map +1 -0
  9. package/dist/chunk-6GDCFR67.js +218 -0
  10. package/dist/chunk-6GDCFR67.js.map +1 -0
  11. package/dist/chunk-DY44Q4CK.js +188 -0
  12. package/dist/chunk-DY44Q4CK.js.map +1 -0
  13. package/dist/chunk-MZOLSLJ7.js +65 -0
  14. package/dist/chunk-MZOLSLJ7.js.map +1 -0
  15. package/dist/chunk-QNCOGISF.js +694 -0
  16. package/dist/chunk-QNCOGISF.js.map +1 -0
  17. package/dist/chunk-UGMYO6AU.js +37 -0
  18. package/dist/chunk-UGMYO6AU.js.map +1 -0
  19. package/dist/chunk-YQDKOEUI.js +242 -0
  20. package/dist/chunk-YQDKOEUI.js.map +1 -0
  21. package/dist/chunk-ZUBFLOKU.js +153 -0
  22. package/dist/chunk-ZUBFLOKU.js.map +1 -0
  23. package/dist/client-WXWbuuvd.d.ts +100 -0
  24. package/dist/client.d.ts +3 -0
  25. package/dist/client.js +29 -0
  26. package/dist/client.js.map +1 -0
  27. package/dist/dev-utils.d.ts +68 -0
  28. package/dist/dev-utils.js +21 -0
  29. package/dist/dev-utils.js.map +1 -0
  30. package/dist/entity-extensions-B5BbZH-m.d.ts +56 -0
  31. package/dist/globalization.d.ts +80 -0
  32. package/dist/globalization.js +43 -0
  33. package/dist/globalization.js.map +1 -0
  34. package/dist/index.d.ts +316 -0
  35. package/dist/index.js +354 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/manifest-CPSCN_Ft.d.ts +1471 -0
  38. package/dist/react.d.ts +145 -0
  39. package/dist/react.js +94 -0
  40. package/dist/react.js.map +1 -0
  41. package/dist/release-CyapqJ3z.d.ts +230 -0
  42. package/dist/server.d.ts +114 -0
  43. package/dist/server.js +194 -0
  44. package/dist/server.js.map +1 -0
  45. package/dist/time.d.ts +34 -0
  46. package/dist/time.js +31 -0
  47. package/dist/time.js.map +1 -0
  48. package/dist/trpc.d.ts +43 -0
  49. package/dist/trpc.js +11 -0
  50. package/dist/trpc.js.map +1 -0
  51. package/dist/types-8P7XyoyQ.d.ts +1599 -0
  52. package/package.json +83 -0
@@ -0,0 +1,694 @@
1
+ // src/manifest.ts
2
+ import { z } from "zod";
3
+ var aggregationStrategySchema = z.enum(["none", "by_target", "by_actor", "by_type"]);
4
+ var notificationCategorySchema = z.enum(["system", "collaboration", "social"]);
5
+ var notificationTypeSchema = z.object({
6
+ id: z.string().min(1).regex(/^[a-z0-9_]+$/, "type id must be lowercase alphanumeric with underscores"),
7
+ category: notificationCategorySchema,
8
+ aggregation: aggregationStrategySchema.default("none"),
9
+ i18n: z.record(
10
+ z.string(),
11
+ // locale key (e.g., 'en-US', 'zh-CN')
12
+ z.object({
13
+ title: z.string().min(1),
14
+ description: z.string().optional()
15
+ })
16
+ )
17
+ });
18
+ var notificationWebhooksSchema = z.object({
19
+ onClicked: z.string().url().optional(),
20
+ onArchived: z.string().url().optional()
21
+ }).optional();
22
+ var notificationRateLimitSchema = z.object({
23
+ maxPerMinute: z.number().int().positive().max(1e4).default(100),
24
+ maxPerHour: z.number().int().positive().max(2e4).default(1e3),
25
+ maxPerDay: z.number().int().positive().max(1e5).default(1e4)
26
+ }).partial();
27
+ var notificationPermissionSchema = z.enum([
28
+ "notification:send",
29
+ "notification:send:batch",
30
+ "notification:read:own"
31
+ ]);
32
+ var notificationsConfigSchema = z.object({
33
+ types: z.array(notificationTypeSchema).min(1),
34
+ permissions: z.array(notificationPermissionSchema).optional(),
35
+ rateLimit: notificationRateLimitSchema.optional(),
36
+ webhooks: notificationWebhooksSchema
37
+ }).optional();
38
+ var permissionDeclarationSchema = z.union([
39
+ z.string().min(1),
40
+ z.object({
41
+ action: z.string().min(1),
42
+ subject: z.string().min(1),
43
+ anonymous: z.boolean().optional()
44
+ })
45
+ ]);
46
+ var navTargetSchema = z.object({
47
+ slot: z.literal("nav.sidebar"),
48
+ path: z.string(),
49
+ icon: z.string().optional(),
50
+ order: z.number().optional(),
51
+ permission: permissionDeclarationSchema.optional(),
52
+ /** @deprecated Use permission instead. */
53
+ requiredPermission: z.string().optional(),
54
+ parent: z.string().optional()
55
+ });
56
+ var navGroupTargetSchema = z.object({
57
+ slot: z.literal("nav.sidebar.group"),
58
+ path: z.string().optional(),
59
+ icon: z.string().optional(),
60
+ order: z.number().optional()
61
+ });
62
+ var routeTargetSchema = z.object({
63
+ slot: z.literal("plugin.route"),
64
+ path: z.string(),
65
+ order: z.number().optional(),
66
+ params: z.record(z.string(), z.string()).optional()
67
+ });
68
+ var settingsTargetSchema = z.object({
69
+ slot: z.literal("settings.plugin"),
70
+ category: z.string().optional(),
71
+ order: z.number().optional(),
72
+ visibility: z.enum(["platform", "all"]).optional()
73
+ });
74
+ var dashboardTargetSchema = z.object({
75
+ slot: z.enum(["dashboard.widgets", "dashboard.overview"]),
76
+ order: z.number().optional(),
77
+ colSpan: z.union([z.literal(1), z.literal(2), z.literal(3), z.literal(4)]).optional()
78
+ });
79
+ var genericTargetSchema = z.object({
80
+ slot: z.string(),
81
+ order: z.number().optional()
82
+ });
83
+ var targetSchema = z.union([
84
+ navTargetSchema,
85
+ navGroupTargetSchema,
86
+ routeTargetSchema,
87
+ settingsTargetSchema,
88
+ dashboardTargetSchema,
89
+ genericTargetSchema
90
+ ]);
91
+ var adminExtensionSchema = z.object({
92
+ id: z.string().min(1),
93
+ label: z.string().min(1),
94
+ icon: z.string().optional(),
95
+ targets: z.array(targetSchema).min(1)
96
+ });
97
+ var adminSlotPropSchema = z.union([
98
+ z.string().min(1),
99
+ z.object({
100
+ name: z.string().min(1),
101
+ type: z.string().optional(),
102
+ required: z.boolean().optional(),
103
+ description: z.string().optional()
104
+ }).passthrough()
105
+ ]);
106
+ var adminSlotSchema = z.object({
107
+ slot: z.string().min(1),
108
+ description: z.string().optional(),
109
+ props: z.array(adminSlotPropSchema).optional()
110
+ }).passthrough();
111
+ var adminTourPlacementSchema = z.enum([
112
+ "top",
113
+ "top-start",
114
+ "top-end",
115
+ "bottom",
116
+ "bottom-start",
117
+ "bottom-end",
118
+ "left",
119
+ "left-start",
120
+ "left-end",
121
+ "right",
122
+ "right-start",
123
+ "right-end",
124
+ "auto",
125
+ "center"
126
+ ]);
127
+ var adminTourStepSchema = z.object({
128
+ target: z.string().min(1),
129
+ title: z.string().min(1).optional(),
130
+ titleKey: z.string().min(1).optional(),
131
+ content: z.string().min(1).optional(),
132
+ contentKey: z.string().min(1).optional(),
133
+ placement: adminTourPlacementSchema.optional()
134
+ }).refine((step) => Boolean(step.content || step.contentKey), {
135
+ message: "admin tour step must define content or contentKey",
136
+ path: ["content"]
137
+ });
138
+ var adminTourSchema = z.object({
139
+ id: z.string().min(1),
140
+ label: z.string().min(1).optional(),
141
+ labelKey: z.string().min(1).optional(),
142
+ routePatterns: z.array(z.string().min(1)).optional(),
143
+ order: z.number().optional(),
144
+ steps: z.array(adminTourStepSchema).min(1)
145
+ });
146
+ var pluginI18nSchema = z.record(
147
+ z.string().min(1),
148
+ z.record(z.string().min(1), z.string())
149
+ );
150
+ var extensionTargetPluginIdSchema = z.string().min(1).max(160).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "target pluginId must be reverse-domain format");
151
+ var crudIdSchema = z.string().min(1).max(80).regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/, "crud id must be an identifier");
152
+ var entityNameSchema = z.string().min(1).max(160).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, 'entity must be dot-separated (e.g., "shop.store")');
153
+ var extensionFieldNameSchema = z.string().min(1).max(80).regex(/^[a-zA-Z][a-zA-Z0-9_]*$/, "field must be an identifier");
154
+ var entityExtensionFieldTypeSchema = z.enum([
155
+ "text",
156
+ "number",
157
+ "boolean",
158
+ "date",
159
+ "datetime",
160
+ "select",
161
+ "ref",
162
+ "json"
163
+ ]);
164
+ var entityExtensionRefSchema = z.object({
165
+ entity: entityNameSchema,
166
+ display: z.string().min(1).optional(),
167
+ changed: z.string().min(1).optional()
168
+ }).passthrough();
169
+ var autoCrudFieldOptionSchema = z.object({
170
+ label: z.string().min(1),
171
+ value: z.string().min(1),
172
+ searchText: z.union([
173
+ z.string().min(1),
174
+ z.array(z.string().min(1))
175
+ ]).optional(),
176
+ count: z.number().optional(),
177
+ disabled: z.boolean().optional()
178
+ }).passthrough();
179
+ var autoCrudDataSourceSchema = z.string().min(1);
180
+ var autoCrudFieldConfigSchema = z.object({
181
+ label: z.string().min(1).optional(),
182
+ enum: z.array(autoCrudFieldOptionSchema).optional(),
183
+ dataSource: autoCrudDataSourceSchema.optional(),
184
+ hidden: z.boolean().optional(),
185
+ table: z.union([z.literal(false), z.record(z.string(), z.unknown())]).optional(),
186
+ filter: z.union([z.literal(false), z.record(z.string(), z.unknown())]).optional(),
187
+ form: z.union([z.literal(false), z.record(z.string(), z.unknown())]).optional(),
188
+ search: z.boolean().optional()
189
+ }).passthrough();
190
+ var entityExtensionOwnedFieldSchema = autoCrudFieldConfigSchema.extend({
191
+ label: z.string().min(1),
192
+ type: entityExtensionFieldTypeSchema,
193
+ ref: entityExtensionRefSchema.optional()
194
+ });
195
+ var entityExtensionFieldSchema = z.union([
196
+ entityExtensionOwnedFieldSchema,
197
+ autoCrudFieldConfigSchema
198
+ ]);
199
+ var autoCrudActionZoneSchema = z.enum(["toolbar", "row", "batch"]);
200
+ var autoCrudActionSchema = z.object({
201
+ type: z.enum([
202
+ "create",
203
+ "import",
204
+ "export",
205
+ "view",
206
+ "edit",
207
+ "copy",
208
+ "delete",
209
+ "batchUpdate",
210
+ "custom"
211
+ ]),
212
+ id: z.string().min(1).optional(),
213
+ label: z.string().min(1).optional(),
214
+ component: z.string().min(1).optional(),
215
+ onClick: z.string().min(1).optional(),
216
+ order: z.number().optional(),
217
+ hidden: z.boolean().optional(),
218
+ position: z.enum(["start", "end"]).optional(),
219
+ variant: z.enum(["default", "destructive"]).optional()
220
+ }).passthrough();
221
+ var autoCrudActionsSchema = z.object({
222
+ toolbar: z.array(autoCrudActionSchema).optional(),
223
+ row: z.array(autoCrudActionSchema).optional(),
224
+ batch: z.array(autoCrudActionSchema).optional()
225
+ }).passthrough();
226
+ var entityExtensionCrudConfigSchema = z.object({
227
+ fields: z.record(extensionFieldNameSchema, entityExtensionFieldSchema).optional(),
228
+ actions: autoCrudActionsSchema.optional()
229
+ }).passthrough();
230
+ var entityExtensionSlotSchema = z.object({
231
+ slot: z.string().min(1),
232
+ component: z.string().min(1),
233
+ order: z.number().optional(),
234
+ label: z.string().optional()
235
+ }).passthrough();
236
+ var entityExtensionBaseSchema = z.object({
237
+ fields: z.record(
238
+ crudIdSchema,
239
+ z.record(extensionFieldNameSchema, entityExtensionFieldSchema)
240
+ ).optional(),
241
+ slots: z.array(entityExtensionSlotSchema).optional(),
242
+ hide: z.record(crudIdSchema, z.array(extensionFieldNameSchema)).optional()
243
+ }).passthrough();
244
+ var entityExtensionSchema = entityExtensionBaseSchema.superRefine((extension, ctx) => {
245
+ const reservedKeys = /* @__PURE__ */ new Set(["fields", "slots", "hide"]);
246
+ for (const [key, value] of Object.entries(extension)) {
247
+ if (reservedKeys.has(key)) continue;
248
+ if (typeof value !== "object" || value === null || Array.isArray(value)) continue;
249
+ const record = value;
250
+ if (!("fields" in record) && !("actions" in record)) continue;
251
+ const parsed = entityExtensionCrudConfigSchema.safeParse(value);
252
+ if (!parsed.success) {
253
+ for (const issue of parsed.error.issues) {
254
+ ctx.addIssue({
255
+ ...issue,
256
+ path: [key, ...issue.path]
257
+ });
258
+ }
259
+ }
260
+ }
261
+ });
262
+ var entityExtensionUseSchema = z.object({
263
+ pluginId: z.string().regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "pluginId must be reverse-domain format"),
264
+ targetId: z.string().min(1).max(240),
265
+ field: extensionFieldNameSchema,
266
+ required: z.boolean().optional()
267
+ }).passthrough();
268
+ var pluginUsesSchema = z.object({
269
+ extensions: z.array(entityExtensionUseSchema).optional()
270
+ }).passthrough();
271
+ var webSsrContractVersionSchema = z.union([z.literal(1), z.literal("1")]);
272
+ var webPluginRouteSchema = z.object({
273
+ id: z.string().min(1).optional(),
274
+ path: z.string().min(1).regex(/^\//, "web route path must start with /"),
275
+ handler: z.string().min(1).optional(),
276
+ component: z.string().min(1),
277
+ permission: permissionDeclarationSchema.optional(),
278
+ order: z.number().optional()
279
+ }).passthrough();
280
+ var webExtensionTargetSchema = z.object({
281
+ pluginId: extensionTargetPluginIdSchema,
282
+ slot: z.string().min(1),
283
+ permission: permissionDeclarationSchema.optional(),
284
+ order: z.number().optional()
285
+ }).passthrough();
286
+ var webExtensionQuerySchema = z.object({
287
+ id: z.string().min(1),
288
+ procedure: z.string().min(1),
289
+ inputFrom: z.enum(["slotProps", "static"]).optional(),
290
+ staticInput: z.record(z.string(), z.unknown()).optional()
291
+ }).passthrough();
292
+ var webExtensionSchema = z.object({
293
+ id: z.string().min(1),
294
+ label: z.string().min(1).optional(),
295
+ component: z.string().min(1),
296
+ expose: z.string().min(1).optional(),
297
+ permission: permissionDeclarationSchema.optional(),
298
+ targets: z.array(webExtensionTargetSchema).min(1),
299
+ queries: z.array(webExtensionQuerySchema).optional()
300
+ }).passthrough();
301
+ var webDesignBlockSchema = z.object({
302
+ id: z.string().min(1),
303
+ component: z.string().min(1),
304
+ title: z.string().min(1).optional(),
305
+ /** @deprecated Use title instead. */
306
+ label: z.string().min(1).optional(),
307
+ category: z.string().min(1).optional(),
308
+ icon: z.string().min(1).optional(),
309
+ defaultProps: z.record(z.string(), z.unknown()).optional(),
310
+ previewProps: z.record(z.string(), z.unknown()).optional(),
311
+ propsSchema: z.record(z.string(), z.unknown()).optional(),
312
+ settingsSchema: z.record(z.string(), z.unknown()).optional(),
313
+ designable: z.object({
314
+ resource: z.record(z.string(), z.unknown()).optional(),
315
+ behavior: z.record(z.string(), z.unknown()).optional()
316
+ }).optional(),
317
+ previewImage: z.string().min(1).optional(),
318
+ order: z.number().optional()
319
+ }).passthrough().superRefine((block, ctx) => {
320
+ if ("schema" in block) {
321
+ ctx.addIssue({
322
+ code: "custom",
323
+ path: ["schema"],
324
+ message: "web.design.blocks[] must not declare platform schema; use propsSchema/settingsSchema for configuration metadata"
325
+ });
326
+ }
327
+ if (!block.title && !block.label) {
328
+ ctx.addIssue({
329
+ code: "custom",
330
+ path: ["title"],
331
+ message: "web.design.blocks[] must define title or label"
332
+ });
333
+ }
334
+ });
335
+ var webDesignSlotSchema = z.object({
336
+ id: z.string().min(1),
337
+ label: z.string().min(1).optional(),
338
+ scope: z.enum(["site", "route", "template", "entity"]).optional(),
339
+ routeId: z.string().min(1).optional(),
340
+ templateId: z.string().min(1).optional(),
341
+ acceptedBlocks: z.array(z.string().min(1)).optional(),
342
+ order: z.number().optional()
343
+ }).passthrough();
344
+ var webDesignTemplateSchema = z.object({
345
+ id: z.string().min(1),
346
+ label: z.string().min(1).optional(),
347
+ routeId: z.string().min(1).optional(),
348
+ entityType: z.string().min(1).optional(),
349
+ component: z.string().min(1),
350
+ slots: z.array(z.string().min(1)).optional(),
351
+ order: z.number().optional()
352
+ }).passthrough();
353
+ var webDesignDataSourceSchema = z.object({
354
+ id: z.string().min(1),
355
+ title: z.string().min(1).optional(),
356
+ /** @deprecated Use title instead. */
357
+ label: z.string().min(1).optional(),
358
+ permission: permissionDeclarationSchema.optional(),
359
+ inputSchema: z.record(z.string(), z.unknown()).optional(),
360
+ outputSchema: z.record(z.string(), z.unknown()).optional(),
361
+ order: z.number().optional()
362
+ }).passthrough().superRefine((dataSource, ctx) => {
363
+ if (!dataSource.title && !dataSource.label) {
364
+ ctx.addIssue({
365
+ code: "custom",
366
+ path: ["title"],
367
+ message: "web.design.dataSources[] must define title or label"
368
+ });
369
+ }
370
+ });
371
+ var webDesignActionSchema = z.object({
372
+ id: z.string().min(1),
373
+ title: z.string().min(1).optional(),
374
+ /** @deprecated Use title instead. */
375
+ label: z.string().min(1).optional(),
376
+ permission: permissionDeclarationSchema.optional(),
377
+ inputSchema: z.record(z.string(), z.unknown()).optional(),
378
+ order: z.number().optional()
379
+ }).passthrough().superRefine((action, ctx) => {
380
+ if (!action.title && !action.label) {
381
+ ctx.addIssue({
382
+ code: "custom",
383
+ path: ["title"],
384
+ message: "web.design.actions[] must define title or label"
385
+ });
386
+ }
387
+ });
388
+ var webDesignSurfaceSchema = z.object({
389
+ editorEntry: z.string().min(1).optional(),
390
+ previewEntry: z.string().min(1).optional(),
391
+ blocks: z.array(webDesignBlockSchema).optional(),
392
+ slots: z.array(webDesignSlotSchema).optional(),
393
+ templates: z.array(webDesignTemplateSchema).optional(),
394
+ dataSources: z.array(webDesignDataSourceSchema).optional(),
395
+ actions: z.array(webDesignActionSchema).optional()
396
+ }).superRefine((design, ctx) => {
397
+ const hasDesignSurface = Boolean(
398
+ design.blocks?.length || design.slots?.length || design.templates?.length || design.dataSources?.length || design.actions?.length
399
+ );
400
+ if (!hasDesignSurface) {
401
+ ctx.addIssue({
402
+ code: "custom",
403
+ path: [],
404
+ message: "web.design must declare at least one block, slot, template, dataSource, or action"
405
+ });
406
+ }
407
+ });
408
+ var webSurfaceSchema = z.object({
409
+ ssrContractVersion: webSsrContractVersionSchema.optional(),
410
+ serverEntry: z.string().min(1).optional(),
411
+ clientEntry: z.string().min(1).optional(),
412
+ remoteEntry: z.string().min(1).optional(),
413
+ devRemoteEntry: z.string().min(1).optional(),
414
+ moduleName: z.string().min(1).optional(),
415
+ exposes: z.record(z.string(), z.string()).optional(),
416
+ routes: z.array(webPluginRouteSchema).optional(),
417
+ fills: z.never().optional(),
418
+ extensions: z.array(webExtensionSchema).optional(),
419
+ design: webDesignSurfaceSchema.optional(),
420
+ /** @deprecated Use serverEntry/clientEntry plus routes[].handler/component. */
421
+ entry: z.string().optional(),
422
+ /** @deprecated Use routes[].component. */
423
+ components: z.array(z.string()).optional()
424
+ }).superRefine((web, ctx) => {
425
+ const hasRoutes = Boolean(web.routes?.length);
426
+ const hasExtensions = Boolean(web.extensions?.length);
427
+ const usesSsrSurface = Boolean(
428
+ web.ssrContractVersion || web.serverEntry || web.clientEntry || hasRoutes
429
+ );
430
+ const usesRemoteSurface = Boolean(
431
+ web.remoteEntry || web.devRemoteEntry || web.moduleName || web.exposes || hasExtensions
432
+ );
433
+ if (!usesSsrSurface && !usesRemoteSurface) return;
434
+ if (hasRoutes && !web.ssrContractVersion) {
435
+ ctx.addIssue({
436
+ code: "custom",
437
+ path: ["ssrContractVersion"],
438
+ message: "web.ssrContractVersion is required for SSR web surface"
439
+ });
440
+ }
441
+ if (hasRoutes && !web.serverEntry) {
442
+ ctx.addIssue({
443
+ code: "custom",
444
+ path: ["serverEntry"],
445
+ message: "web.serverEntry is required for SSR web surface"
446
+ });
447
+ }
448
+ if (hasRoutes && !web.clientEntry) {
449
+ ctx.addIssue({
450
+ code: "custom",
451
+ path: ["clientEntry"],
452
+ message: "web.clientEntry is required for SSR web surface"
453
+ });
454
+ }
455
+ if (hasExtensions && !web.remoteEntry) {
456
+ ctx.addIssue({
457
+ code: "custom",
458
+ path: ["remoteEntry"],
459
+ message: "web.remoteEntry is required when web.extensions are declared"
460
+ });
461
+ }
462
+ for (const [index, route] of (web.routes ?? []).entries()) {
463
+ if (!route.id) {
464
+ ctx.addIssue({
465
+ code: "custom",
466
+ path: ["routes", index, "id"],
467
+ message: "web.routes[].id is required for SSR web surface"
468
+ });
469
+ }
470
+ if (!route.handler) {
471
+ ctx.addIssue({
472
+ code: "custom",
473
+ path: ["routes", index, "handler"],
474
+ message: "web.routes[].handler is required for SSR web surface"
475
+ });
476
+ }
477
+ if (!route.permission) {
478
+ ctx.addIssue({
479
+ code: "custom",
480
+ path: ["routes", index, "permission"],
481
+ message: "web.routes[].permission is required for SSR web surface"
482
+ });
483
+ }
484
+ }
485
+ });
486
+ var pluginManifestSchema = z.object({
487
+ // === Identity ===
488
+ pluginId: z.string().regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "pluginId must be reverse-domain format (e.g., com.vendor.plugin-name)"),
489
+ version: z.string().regex(/^\d+\.\d+\.\d+/, "version must be semver format"),
490
+ name: z.string().min(1).max(100),
491
+ description: z.string().max(500).optional(),
492
+ vendor: z.string().min(1).max(100),
493
+ private: z.boolean().optional(),
494
+ type: z.enum(["backend", "frontend", "full", "extension", "integration", "feature"]).optional(),
495
+ // === UI Translations ===
496
+ // Locale -> { key: translated text }. Stored under namespace `plugin.{pluginId}`.
497
+ i18n: pluginI18nSchema.optional(),
498
+ // === Runtime ===
499
+ runtime: z.enum(["node"]).default("node"),
500
+ // Note: surfaces is auto-generated from server/admin/web presence
501
+ // Used by plugin marketplace for filtering
502
+ // === Compatibility ===
503
+ engines: z.object({
504
+ wordrhyme: z.string(),
505
+ // semver range, e.g., "^0.1.0"
506
+ node: z.string().optional()
507
+ // e.g., ">=20.0.0"
508
+ }),
509
+ // === Capabilities Declared ===
510
+ capabilities: z.object({
511
+ ui: z.object({
512
+ adminPage: z.boolean().optional(),
513
+ webPage: z.boolean().optional(),
514
+ webTheme: z.boolean().optional(),
515
+ webDesigner: z.boolean().optional(),
516
+ settingsTab: z.boolean().optional()
517
+ }).optional(),
518
+ storage: z.object({
519
+ provider: z.boolean().optional()
520
+ }).optional(),
521
+ artifacts: z.object({
522
+ write: z.boolean().optional()
523
+ }).optional(),
524
+ provides: z.array(z.string()).optional(),
525
+ // e.g., ["logger-adapter", "cache-adapter"]
526
+ billing: z.object({
527
+ subjects: z.array(z.object({
528
+ subject: z.string().min(1).regex(
529
+ /^[a-z0-9-]+(\.[a-z0-9-]+)+\.[a-zA-Z0-9_]+$/,
530
+ 'subject must be dot-separated (e.g., "com.vendor.plugin.apiCalls")'
531
+ ),
532
+ type: z.enum(["boolean", "metered"]),
533
+ unit: z.string().optional(),
534
+ description: z.string().optional()
535
+ })).optional(),
536
+ procedures: z.record(z.string(), z.string()).optional()
537
+ }).optional()
538
+ }).optional(),
539
+ // === Exports ===
540
+ exports: z.object({
541
+ loggerAdapter: z.string().optional(),
542
+ // e.g., "./dist/logger-adapter.js"
543
+ cacheAdapter: z.string().optional()
544
+ }).optional(),
545
+ // === Permissions Defined ===
546
+ permissions: z.object({
547
+ definitions: z.array(z.object({
548
+ key: z.string().regex(/^[a-z0-9_.]+$/, "Permission key must be lowercase with dots/underscores"),
549
+ description: z.string().optional()
550
+ })).optional(),
551
+ required: z.array(z.string()).optional(),
552
+ /**
553
+ * Quick-select action groups for the permission configuration UI.
554
+ * Keyed by CASL subject name. Each subject can have multiple groups,
555
+ * and groups may overlap (same action in multiple groups).
556
+ *
557
+ * @example
558
+ * ```json
559
+ * {
560
+ * "Article": [
561
+ * { "key": "editor", "label": "Editor", "actions": ["create", "update"] },
562
+ * { "key": "full", "label": "Full Access", "actions": ["create", "update", "delete", "publish"] }
563
+ * ]
564
+ * }
565
+ * ```
566
+ */
567
+ actionGroups: z.record(
568
+ z.string(),
569
+ // subject name
570
+ z.array(z.object({
571
+ key: z.string().min(1),
572
+ label: z.string().min(1),
573
+ actions: z.array(z.string().min(1)).min(1)
574
+ }))
575
+ ).optional()
576
+ }).optional(),
577
+ // === Server Entry ===
578
+ server: z.object({
579
+ entry: z.string(),
580
+ // e.g., "./dist/server/index.js"
581
+ router: z.boolean().optional(),
582
+ // Exports tRPC router
583
+ nestModule: z.string().optional(),
584
+ // NestJS module for advanced plugins, e.g., "./dist/server/hello.module.js"
585
+ fastifyRoutes: z.string().optional(),
586
+ // Fastify route registrar, e.g., "./dist/server/http/routes.js"
587
+ publicServices: z.array(z.object({
588
+ name: z.string().min(1).max(80).regex(/^[a-z0-9-]+$/),
589
+ mountPath: z.string().regex(/^\/api\/[a-z0-9/-]+$/),
590
+ methods: z.array(z.enum(["GET", "POST", "PUT", "PATCH", "DELETE"])).min(1),
591
+ auth: z.enum(["public", "bearer", "session", "user"]).default("public"),
592
+ maxBodyBytes: z.number().int().positive().max(100 * 1024 * 1024).default(1024 * 1024)
593
+ })).optional(),
594
+ trustedApiTokenProxy: z.object({
595
+ invoker: z.string().min(1),
596
+ paths: z.array(z.string().min(1)).min(1)
597
+ }).optional(),
598
+ hooks: z.array(z.enum(["onInstall", "onEnable", "onDisable", "onUninstall"])).optional()
599
+ }).optional(),
600
+ // === Admin UI Entry ===
601
+ admin: z.object({
602
+ remoteEntry: z.string(),
603
+ // e.g., "./dist/admin/remoteEntry.js"
604
+ devRemoteEntry: z.string().optional(),
605
+ // Dev mode: e.g., "http://localhost:3010/remoteEntry.js"
606
+ moduleName: z.string().optional(),
607
+ // MF2.0 module name
608
+ exposes: z.record(z.string(), z.string()).optional(),
609
+ extensions: z.array(adminExtensionSchema).optional(),
610
+ slots: z.array(adminSlotSchema).optional(),
611
+ tours: z.array(adminTourSchema).optional(),
612
+ /** @deprecated Use slots instead. */
613
+ extensionSlots: z.array(adminSlotSchema).optional(),
614
+ /** @deprecated Use extensions[] instead */
615
+ menus: z.array(z.object({
616
+ label: z.string(),
617
+ icon: z.string().optional(),
618
+ path: z.string(),
619
+ order: z.number().optional(),
620
+ parentId: z.string().optional(),
621
+ permission: permissionDeclarationSchema.optional(),
622
+ /** @deprecated Use permission instead. */
623
+ requiredPermission: z.string().optional(),
624
+ metadata: z.record(z.string(), z.unknown()).optional()
625
+ })).optional()
626
+ }).optional(),
627
+ // === Web UI Entry ===
628
+ web: webSurfaceSchema.optional(),
629
+ // === Dependencies ===
630
+ dependencies: z.array(z.string()).optional(),
631
+ // Other plugin IDs
632
+ conflicts: z.array(z.string()).optional(),
633
+ // Conflicting plugin IDs
634
+ peerDependencies: z.record(z.string(), z.string()).optional(),
635
+ // e.g., { react: "^18.0.0" }
636
+ compatibilityMode: z.enum(["strict", "lenient", "fallback"]).optional(),
637
+ // === Entity Extensions ===
638
+ extends: z.record(extensionTargetPluginIdSchema, entityExtensionSchema).optional(),
639
+ uses: pluginUsesSchema.optional(),
640
+ // === Data Retention ===
641
+ dataRetention: z.object({
642
+ onDisable: z.enum(["retain"]).optional(),
643
+ onUninstall: z.enum(["delete", "archive", "retain"]).optional(),
644
+ tables: z.array(z.string()).optional()
645
+ }).optional(),
646
+ // === Infrastructure (Tenant Config Delegation) ===
647
+ infrastructure: z.object({
648
+ tenantOverride: z.boolean(),
649
+ riskLevel: z.enum(["high", "medium", "low"]),
650
+ sensitiveFields: z.array(z.string()).default([])
651
+ }).optional(),
652
+ // === Notifications ===
653
+ notifications: notificationsConfigSchema
654
+ });
655
+
656
+ export {
657
+ navTargetSchema,
658
+ navGroupTargetSchema,
659
+ routeTargetSchema,
660
+ settingsTargetSchema,
661
+ dashboardTargetSchema,
662
+ targetSchema,
663
+ adminExtensionSchema,
664
+ adminTourPlacementSchema,
665
+ adminTourStepSchema,
666
+ adminTourSchema,
667
+ pluginI18nSchema,
668
+ autoCrudFieldOptionSchema,
669
+ autoCrudDataSourceSchema,
670
+ autoCrudFieldConfigSchema,
671
+ entityExtensionFieldSchema,
672
+ autoCrudActionZoneSchema,
673
+ autoCrudActionSchema,
674
+ autoCrudActionsSchema,
675
+ entityExtensionCrudConfigSchema,
676
+ entityExtensionSlotSchema,
677
+ entityExtensionSchema,
678
+ entityExtensionUseSchema,
679
+ pluginUsesSchema,
680
+ webSsrContractVersionSchema,
681
+ webPluginRouteSchema,
682
+ webExtensionTargetSchema,
683
+ webExtensionQuerySchema,
684
+ webExtensionSchema,
685
+ webDesignBlockSchema,
686
+ webDesignSlotSchema,
687
+ webDesignTemplateSchema,
688
+ webDesignDataSourceSchema,
689
+ webDesignActionSchema,
690
+ webDesignSurfaceSchema,
691
+ webSurfaceSchema,
692
+ pluginManifestSchema
693
+ };
694
+ //# sourceMappingURL=chunk-QNCOGISF.js.map