@cervio/plugin-core 0.1.4 → 1.0.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/dist/index.d.cts DELETED
@@ -1,581 +0,0 @@
1
- import { P as PluginCervioApiRequirement, a as PluginEntityRequirement, b as PluginSettingsFieldRequirement, c as PluginConnectionRequirement, d as PluginActionResult, e as ParseManifestOptions, f as PluginType, g as ParsedPluginManifest } from './browser-CbWn_0Kk.cjs';
2
- export { A as AllowedApiRule, D as DEFAULT_PLUGIN_DECLARABLE_CAPABILITIES, E as ExternalConnectionHttpMethod, M as MAX_PLUGIN_UNCOMPRESSED_BYTES, h as MAX_PLUGIN_ZIP_BYTES, i as MAX_PLUGIN_ZIP_ENTRIES, j as PLUGIN_ARTIFACT_BUCKET, k as PLUGIN_KEY_RE, l as PLUGIN_VERSION_SELECT, m as PluginEntityAccess, n as PluginSettingsFieldOption, o as PluginSettingsFieldType, p as PluginVersionRow, q as assertZipFile, r as assertZipSafe } from './browser-CbWn_0Kk.cjs';
3
- import { z } from 'zod';
4
- import JSZip from 'jszip';
5
-
6
- /** Parse `entities` from manifest.json (invalid entries skipped). */
7
- declare function parsePluginEntityRequirements(raw: unknown): PluginEntityRequirement[];
8
- /** Parse `cervio_apis` from manifest.json. */
9
- declare function parsePluginCervioApiRequirements(raw: unknown): PluginCervioApiRequirement[];
10
-
11
- /** Parse `settings` from manifest.json (invalid entries skipped). */
12
- declare function parsePluginSettingsRequirements(raw: unknown): PluginSettingsFieldRequirement[];
13
-
14
- declare const EXTERNAL_CONNECTION_ALLOWED_HOSTS: Record<string, readonly string[]>;
15
- declare const EXTERNAL_CONNECTION_HTTP_METHODS: readonly ["GET", "POST", "PATCH", "PUT", "DELETE"];
16
- declare const OAUTH_PROVIDER_KEY_RE: RegExp;
17
- /** Lightweight host check (no DNS); mirrors host `normalizeExactApiHost` shape rules. */
18
- declare function normalizeExactApiHost(raw: string): string | null;
19
- declare function isExternalConnectionProvider(v: string): boolean;
20
- /** Parse manifest `connections` array; drops invalid entries. */
21
- declare function parsePluginConnections(raw: unknown): PluginConnectionRequirement[];
22
-
23
- /**
24
- * Next patch version assigned by Cervio. Ignores pre-release/build metadata on
25
- * the previous label and bumps the patch component only.
26
- */
27
- declare function nextPatchVersion(latest: string | null | undefined): string;
28
- /** Compare core x.y.z numerically (descending sort helper). */
29
- declare function compareSemverDesc(a: string, b: string): number;
30
-
31
- /** Zod schema documenting the author-facing manifest shape (source of truth for JSON Schema). */
32
- declare const pluginManifestZodSchema: z.ZodObject<{
33
- plugin_key: z.ZodOptional<z.ZodString>;
34
- id: z.ZodOptional<z.ZodString>;
35
- plugin_name: z.ZodOptional<z.ZodString>;
36
- name: z.ZodOptional<z.ZodString>;
37
- plugin_type: z.ZodOptional<z.ZodEnum<["task", "form", "task_form", "route", "policy", "server"]>>;
38
- kind: z.ZodOptional<z.ZodString>;
39
- version: z.ZodOptional<z.ZodString>;
40
- hooks: z.ZodOptional<z.ZodArray<z.ZodObject<{
41
- event: z.ZodEnum<["before_create", "before_update"]>;
42
- entities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
43
- blocking: z.ZodOptional<z.ZodBoolean>;
44
- identity: z.ZodOptional<z.ZodEnum<["caller", "plugin_principal"]>>;
45
- entry: z.ZodOptional<z.ZodString>;
46
- }, "strip", z.ZodTypeAny, {
47
- event: "before_create" | "before_update";
48
- entities?: string[] | undefined;
49
- blocking?: boolean | undefined;
50
- identity?: "caller" | "plugin_principal" | undefined;
51
- entry?: string | undefined;
52
- }, {
53
- event: "before_create" | "before_update";
54
- entities?: string[] | undefined;
55
- blocking?: boolean | undefined;
56
- identity?: "caller" | "plugin_principal" | undefined;
57
- entry?: string | undefined;
58
- }>, "many">>;
59
- required_connection_capabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
60
- requiredConnectionCapabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
61
- connections: z.ZodOptional<z.ZodArray<z.ZodObject<{
62
- id: z.ZodString;
63
- provider: z.ZodString;
64
- scopes: z.ZodArray<z.ZodString, "many">;
65
- allowed_apis: z.ZodOptional<z.ZodArray<z.ZodObject<{
66
- host: z.ZodString;
67
- methods: z.ZodArray<z.ZodString, "many">;
68
- path_prefix: z.ZodOptional<z.ZodString>;
69
- pathPrefix: z.ZodOptional<z.ZodString>;
70
- }, "strip", z.ZodTypeAny, {
71
- host: string;
72
- methods: string[];
73
- path_prefix?: string | undefined;
74
- pathPrefix?: string | undefined;
75
- }, {
76
- host: string;
77
- methods: string[];
78
- path_prefix?: string | undefined;
79
- pathPrefix?: string | undefined;
80
- }>, "many">>;
81
- allowedApis: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
82
- }, "strip", z.ZodTypeAny, {
83
- id: string;
84
- provider: string;
85
- scopes: string[];
86
- allowed_apis?: {
87
- host: string;
88
- methods: string[];
89
- path_prefix?: string | undefined;
90
- pathPrefix?: string | undefined;
91
- }[] | undefined;
92
- allowedApis?: unknown[] | undefined;
93
- }, {
94
- id: string;
95
- provider: string;
96
- scopes: string[];
97
- allowed_apis?: {
98
- host: string;
99
- methods: string[];
100
- path_prefix?: string | undefined;
101
- pathPrefix?: string | undefined;
102
- }[] | undefined;
103
- allowedApis?: unknown[] | undefined;
104
- }>, "many">>;
105
- entities: z.ZodOptional<z.ZodArray<z.ZodObject<{
106
- name: z.ZodString;
107
- fields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
108
- forms: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
109
- access: z.ZodOptional<z.ZodArray<z.ZodEnum<["read", "write"]>, "many">>;
110
- }, "strip", z.ZodTypeAny, {
111
- name: string;
112
- fields?: string[] | undefined;
113
- forms?: string[] | undefined;
114
- access?: ("read" | "write")[] | undefined;
115
- }, {
116
- name: string;
117
- fields?: string[] | undefined;
118
- forms?: string[] | undefined;
119
- access?: ("read" | "write")[] | undefined;
120
- }>, "many">>;
121
- cervio_apis: z.ZodOptional<z.ZodArray<z.ZodObject<{
122
- method: z.ZodOptional<z.ZodString>;
123
- path_prefix: z.ZodOptional<z.ZodString>;
124
- pathPrefix: z.ZodOptional<z.ZodString>;
125
- }, "strip", z.ZodTypeAny, {
126
- method?: string | undefined;
127
- path_prefix?: string | undefined;
128
- pathPrefix?: string | undefined;
129
- }, {
130
- method?: string | undefined;
131
- path_prefix?: string | undefined;
132
- pathPrefix?: string | undefined;
133
- }>, "many">>;
134
- cervioApis: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
135
- settings: z.ZodOptional<z.ZodArray<z.ZodObject<{
136
- key: z.ZodString;
137
- type: z.ZodEnum<["string", "boolean", "select", "multiselect"]>;
138
- label: z.ZodString;
139
- hint: z.ZodOptional<z.ZodString>;
140
- placeholder: z.ZodOptional<z.ZodString>;
141
- default: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString, "many">]>>;
142
- options: z.ZodOptional<z.ZodArray<z.ZodObject<{
143
- value: z.ZodString;
144
- label: z.ZodString;
145
- }, "strip", z.ZodTypeAny, {
146
- value: string;
147
- label: string;
148
- }, {
149
- value: string;
150
- label: string;
151
- }>, "many">>;
152
- }, "strip", z.ZodTypeAny, {
153
- label: string;
154
- key: string;
155
- type: "string" | "boolean" | "select" | "multiselect";
156
- options?: {
157
- value: string;
158
- label: string;
159
- }[] | undefined;
160
- hint?: string | undefined;
161
- placeholder?: string | undefined;
162
- default?: string | boolean | string[] | undefined;
163
- }, {
164
- label: string;
165
- key: string;
166
- type: "string" | "boolean" | "select" | "multiselect";
167
- options?: {
168
- value: string;
169
- label: string;
170
- }[] | undefined;
171
- hint?: string | undefined;
172
- placeholder?: string | undefined;
173
- default?: string | boolean | string[] | undefined;
174
- }>, "many">>;
175
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
176
- plugin_key: z.ZodOptional<z.ZodString>;
177
- id: z.ZodOptional<z.ZodString>;
178
- plugin_name: z.ZodOptional<z.ZodString>;
179
- name: z.ZodOptional<z.ZodString>;
180
- plugin_type: z.ZodOptional<z.ZodEnum<["task", "form", "task_form", "route", "policy", "server"]>>;
181
- kind: z.ZodOptional<z.ZodString>;
182
- version: z.ZodOptional<z.ZodString>;
183
- hooks: z.ZodOptional<z.ZodArray<z.ZodObject<{
184
- event: z.ZodEnum<["before_create", "before_update"]>;
185
- entities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
186
- blocking: z.ZodOptional<z.ZodBoolean>;
187
- identity: z.ZodOptional<z.ZodEnum<["caller", "plugin_principal"]>>;
188
- entry: z.ZodOptional<z.ZodString>;
189
- }, "strip", z.ZodTypeAny, {
190
- event: "before_create" | "before_update";
191
- entities?: string[] | undefined;
192
- blocking?: boolean | undefined;
193
- identity?: "caller" | "plugin_principal" | undefined;
194
- entry?: string | undefined;
195
- }, {
196
- event: "before_create" | "before_update";
197
- entities?: string[] | undefined;
198
- blocking?: boolean | undefined;
199
- identity?: "caller" | "plugin_principal" | undefined;
200
- entry?: string | undefined;
201
- }>, "many">>;
202
- required_connection_capabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
203
- requiredConnectionCapabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
204
- connections: z.ZodOptional<z.ZodArray<z.ZodObject<{
205
- id: z.ZodString;
206
- provider: z.ZodString;
207
- scopes: z.ZodArray<z.ZodString, "many">;
208
- allowed_apis: z.ZodOptional<z.ZodArray<z.ZodObject<{
209
- host: z.ZodString;
210
- methods: z.ZodArray<z.ZodString, "many">;
211
- path_prefix: z.ZodOptional<z.ZodString>;
212
- pathPrefix: z.ZodOptional<z.ZodString>;
213
- }, "strip", z.ZodTypeAny, {
214
- host: string;
215
- methods: string[];
216
- path_prefix?: string | undefined;
217
- pathPrefix?: string | undefined;
218
- }, {
219
- host: string;
220
- methods: string[];
221
- path_prefix?: string | undefined;
222
- pathPrefix?: string | undefined;
223
- }>, "many">>;
224
- allowedApis: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
225
- }, "strip", z.ZodTypeAny, {
226
- id: string;
227
- provider: string;
228
- scopes: string[];
229
- allowed_apis?: {
230
- host: string;
231
- methods: string[];
232
- path_prefix?: string | undefined;
233
- pathPrefix?: string | undefined;
234
- }[] | undefined;
235
- allowedApis?: unknown[] | undefined;
236
- }, {
237
- id: string;
238
- provider: string;
239
- scopes: string[];
240
- allowed_apis?: {
241
- host: string;
242
- methods: string[];
243
- path_prefix?: string | undefined;
244
- pathPrefix?: string | undefined;
245
- }[] | undefined;
246
- allowedApis?: unknown[] | undefined;
247
- }>, "many">>;
248
- entities: z.ZodOptional<z.ZodArray<z.ZodObject<{
249
- name: z.ZodString;
250
- fields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
251
- forms: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
252
- access: z.ZodOptional<z.ZodArray<z.ZodEnum<["read", "write"]>, "many">>;
253
- }, "strip", z.ZodTypeAny, {
254
- name: string;
255
- fields?: string[] | undefined;
256
- forms?: string[] | undefined;
257
- access?: ("read" | "write")[] | undefined;
258
- }, {
259
- name: string;
260
- fields?: string[] | undefined;
261
- forms?: string[] | undefined;
262
- access?: ("read" | "write")[] | undefined;
263
- }>, "many">>;
264
- cervio_apis: z.ZodOptional<z.ZodArray<z.ZodObject<{
265
- method: z.ZodOptional<z.ZodString>;
266
- path_prefix: z.ZodOptional<z.ZodString>;
267
- pathPrefix: z.ZodOptional<z.ZodString>;
268
- }, "strip", z.ZodTypeAny, {
269
- method?: string | undefined;
270
- path_prefix?: string | undefined;
271
- pathPrefix?: string | undefined;
272
- }, {
273
- method?: string | undefined;
274
- path_prefix?: string | undefined;
275
- pathPrefix?: string | undefined;
276
- }>, "many">>;
277
- cervioApis: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
278
- settings: z.ZodOptional<z.ZodArray<z.ZodObject<{
279
- key: z.ZodString;
280
- type: z.ZodEnum<["string", "boolean", "select", "multiselect"]>;
281
- label: z.ZodString;
282
- hint: z.ZodOptional<z.ZodString>;
283
- placeholder: z.ZodOptional<z.ZodString>;
284
- default: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString, "many">]>>;
285
- options: z.ZodOptional<z.ZodArray<z.ZodObject<{
286
- value: z.ZodString;
287
- label: z.ZodString;
288
- }, "strip", z.ZodTypeAny, {
289
- value: string;
290
- label: string;
291
- }, {
292
- value: string;
293
- label: string;
294
- }>, "many">>;
295
- }, "strip", z.ZodTypeAny, {
296
- label: string;
297
- key: string;
298
- type: "string" | "boolean" | "select" | "multiselect";
299
- options?: {
300
- value: string;
301
- label: string;
302
- }[] | undefined;
303
- hint?: string | undefined;
304
- placeholder?: string | undefined;
305
- default?: string | boolean | string[] | undefined;
306
- }, {
307
- label: string;
308
- key: string;
309
- type: "string" | "boolean" | "select" | "multiselect";
310
- options?: {
311
- value: string;
312
- label: string;
313
- }[] | undefined;
314
- hint?: string | undefined;
315
- placeholder?: string | undefined;
316
- default?: string | boolean | string[] | undefined;
317
- }>, "many">>;
318
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
319
- plugin_key: z.ZodOptional<z.ZodString>;
320
- id: z.ZodOptional<z.ZodString>;
321
- plugin_name: z.ZodOptional<z.ZodString>;
322
- name: z.ZodOptional<z.ZodString>;
323
- plugin_type: z.ZodOptional<z.ZodEnum<["task", "form", "task_form", "route", "policy", "server"]>>;
324
- kind: z.ZodOptional<z.ZodString>;
325
- version: z.ZodOptional<z.ZodString>;
326
- hooks: z.ZodOptional<z.ZodArray<z.ZodObject<{
327
- event: z.ZodEnum<["before_create", "before_update"]>;
328
- entities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
329
- blocking: z.ZodOptional<z.ZodBoolean>;
330
- identity: z.ZodOptional<z.ZodEnum<["caller", "plugin_principal"]>>;
331
- entry: z.ZodOptional<z.ZodString>;
332
- }, "strip", z.ZodTypeAny, {
333
- event: "before_create" | "before_update";
334
- entities?: string[] | undefined;
335
- blocking?: boolean | undefined;
336
- identity?: "caller" | "plugin_principal" | undefined;
337
- entry?: string | undefined;
338
- }, {
339
- event: "before_create" | "before_update";
340
- entities?: string[] | undefined;
341
- blocking?: boolean | undefined;
342
- identity?: "caller" | "plugin_principal" | undefined;
343
- entry?: string | undefined;
344
- }>, "many">>;
345
- required_connection_capabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
346
- requiredConnectionCapabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
347
- connections: z.ZodOptional<z.ZodArray<z.ZodObject<{
348
- id: z.ZodString;
349
- provider: z.ZodString;
350
- scopes: z.ZodArray<z.ZodString, "many">;
351
- allowed_apis: z.ZodOptional<z.ZodArray<z.ZodObject<{
352
- host: z.ZodString;
353
- methods: z.ZodArray<z.ZodString, "many">;
354
- path_prefix: z.ZodOptional<z.ZodString>;
355
- pathPrefix: z.ZodOptional<z.ZodString>;
356
- }, "strip", z.ZodTypeAny, {
357
- host: string;
358
- methods: string[];
359
- path_prefix?: string | undefined;
360
- pathPrefix?: string | undefined;
361
- }, {
362
- host: string;
363
- methods: string[];
364
- path_prefix?: string | undefined;
365
- pathPrefix?: string | undefined;
366
- }>, "many">>;
367
- allowedApis: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
368
- }, "strip", z.ZodTypeAny, {
369
- id: string;
370
- provider: string;
371
- scopes: string[];
372
- allowed_apis?: {
373
- host: string;
374
- methods: string[];
375
- path_prefix?: string | undefined;
376
- pathPrefix?: string | undefined;
377
- }[] | undefined;
378
- allowedApis?: unknown[] | undefined;
379
- }, {
380
- id: string;
381
- provider: string;
382
- scopes: string[];
383
- allowed_apis?: {
384
- host: string;
385
- methods: string[];
386
- path_prefix?: string | undefined;
387
- pathPrefix?: string | undefined;
388
- }[] | undefined;
389
- allowedApis?: unknown[] | undefined;
390
- }>, "many">>;
391
- entities: z.ZodOptional<z.ZodArray<z.ZodObject<{
392
- name: z.ZodString;
393
- fields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
394
- forms: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
395
- access: z.ZodOptional<z.ZodArray<z.ZodEnum<["read", "write"]>, "many">>;
396
- }, "strip", z.ZodTypeAny, {
397
- name: string;
398
- fields?: string[] | undefined;
399
- forms?: string[] | undefined;
400
- access?: ("read" | "write")[] | undefined;
401
- }, {
402
- name: string;
403
- fields?: string[] | undefined;
404
- forms?: string[] | undefined;
405
- access?: ("read" | "write")[] | undefined;
406
- }>, "many">>;
407
- cervio_apis: z.ZodOptional<z.ZodArray<z.ZodObject<{
408
- method: z.ZodOptional<z.ZodString>;
409
- path_prefix: z.ZodOptional<z.ZodString>;
410
- pathPrefix: z.ZodOptional<z.ZodString>;
411
- }, "strip", z.ZodTypeAny, {
412
- method?: string | undefined;
413
- path_prefix?: string | undefined;
414
- pathPrefix?: string | undefined;
415
- }, {
416
- method?: string | undefined;
417
- path_prefix?: string | undefined;
418
- pathPrefix?: string | undefined;
419
- }>, "many">>;
420
- cervioApis: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
421
- settings: z.ZodOptional<z.ZodArray<z.ZodObject<{
422
- key: z.ZodString;
423
- type: z.ZodEnum<["string", "boolean", "select", "multiselect"]>;
424
- label: z.ZodString;
425
- hint: z.ZodOptional<z.ZodString>;
426
- placeholder: z.ZodOptional<z.ZodString>;
427
- default: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString, "many">]>>;
428
- options: z.ZodOptional<z.ZodArray<z.ZodObject<{
429
- value: z.ZodString;
430
- label: z.ZodString;
431
- }, "strip", z.ZodTypeAny, {
432
- value: string;
433
- label: string;
434
- }, {
435
- value: string;
436
- label: string;
437
- }>, "many">>;
438
- }, "strip", z.ZodTypeAny, {
439
- label: string;
440
- key: string;
441
- type: "string" | "boolean" | "select" | "multiselect";
442
- options?: {
443
- value: string;
444
- label: string;
445
- }[] | undefined;
446
- hint?: string | undefined;
447
- placeholder?: string | undefined;
448
- default?: string | boolean | string[] | undefined;
449
- }, {
450
- label: string;
451
- key: string;
452
- type: "string" | "boolean" | "select" | "multiselect";
453
- options?: {
454
- value: string;
455
- label: string;
456
- }[] | undefined;
457
- hint?: string | undefined;
458
- placeholder?: string | undefined;
459
- default?: string | boolean | string[] | undefined;
460
- }>, "many">>;
461
- }, z.ZodTypeAny, "passthrough">>;
462
- type PluginManifestZod = z.infer<typeof pluginManifestZodSchema>;
463
-
464
- /**
465
- * Policy Plugin hook contract (shared by host, SDK, and manifest authors).
466
- * Wire legacy: `plugin_type: "server"` is an alias for `"policy"`.
467
- */
468
- type PolicyHookEvent = 'before_create' | 'before_update';
469
- type PolicyHookCaller = {
470
- userId?: string;
471
- channel?: string;
472
- organizationId?: string;
473
- };
474
- type PolicyHookInput = {
475
- event: PolicyHookEvent;
476
- entity: {
477
- id?: string;
478
- name?: string;
479
- };
480
- record: {
481
- id?: string | null;
482
- data: Record<string, unknown>;
483
- previousData?: Record<string, unknown> | null;
484
- };
485
- caller?: PolicyHookCaller;
486
- settings?: Record<string, unknown>;
487
- pluginKey?: string;
488
- allowedEntityReads?: string[];
489
- deadlineMs?: number;
490
- };
491
- type PolicyHookResult = {
492
- allow: true;
493
- } | {
494
- allow: false;
495
- message: string;
496
- code?: string;
497
- };
498
- /** Host-mediated reads injected by plugin-sandbox-runner (null if no allowlist/caller). */
499
- type PolicyHost = {
500
- getRecord(entityName: string, id: string): Promise<{
501
- id: string;
502
- data: Record<string, unknown>;
503
- } | null>;
504
- listRecords(entityName: string, opts?: {
505
- filters?: Record<string, unknown>;
506
- limit?: number;
507
- offset?: number;
508
- }): Promise<Array<{
509
- id: string;
510
- data: Record<string, unknown>;
511
- }>>;
512
- sumField(entityName: string, fieldName: string, opts?: {
513
- filters?: Record<string, unknown>;
514
- }): Promise<number>;
515
- };
516
- /** True for canonical `policy` and legacy wire `server`. */
517
- declare function isPolicyPluginType(t: string | null | undefined): boolean;
518
- /** Canonical type written on upload / preferred in new manifests. */
519
- declare function normalizeToPolicyPluginType(t: string | null | undefined): 'policy' | null;
520
-
521
- declare function findBareModuleSpecifiers(source: string): string[];
522
- declare function assertPolicyEntrySelfContained(source: string): {
523
- ok: true;
524
- } | {
525
- ok: false;
526
- error: string;
527
- specifiers: string[];
528
- };
529
-
530
- declare function normalizePluginKey(raw: string): string;
531
- declare function parseManifestObject(parsed: Record<string, unknown>, options?: ParseManifestOptions): PluginActionResult<{
532
- pluginKey: string;
533
- pluginName: string | null;
534
- pluginType: PluginType | null;
535
- manifestVersion: string | null;
536
- requiredConnectionCapabilities: string[];
537
- connections: PluginConnectionRequirement[];
538
- entities: PluginEntityRequirement[];
539
- cervioApis: PluginCervioApiRequirement[];
540
- settings: PluginSettingsFieldRequirement[];
541
- }>;
542
- /** Manifest JSON for hashing: drop author `version` so Cervio-owned labels do not affect dedup. */
543
- declare function manifestJsonForContentHash(raw: Record<string, unknown>): string;
544
- declare function loadZipFromBuffer(buffer: ArrayBuffer | Buffer): Promise<PluginActionResult<JSZip>>;
545
- declare function parseZipManifest(file: File | Blob, options?: ParseManifestOptions): Promise<PluginActionResult<ParsedPluginManifest>>;
546
-
547
- /**
548
- * Deterministic SHA-256 over:
549
- * - manifest.json (JSON without `version` field)
550
- * - every non-directory entry under dist/** (paths sorted)
551
- *
552
- * README / other root files and ZIP compression metadata do not affect the hash.
553
- */
554
- declare function computePluginContentSha256(zip: JSZip, rawManifest: Record<string, unknown>): Promise<PluginActionResult<string>>;
555
- declare function sha256Hex(buffer: Buffer | Uint8Array): string;
556
-
557
- type PackPluginResult = {
558
- buffer: Buffer;
559
- pluginKey: string;
560
- contentSha256: string;
561
- sizeBytes: number;
562
- };
563
- /**
564
- * Pack a built plugin directory into a ZIP buffer.
565
- * Expects `manifest.json` at root and `dist/index.html` + `dist/assets/*`.
566
- */
567
- declare function packPlugin(opts: {
568
- dir: string;
569
- options?: ParseManifestOptions;
570
- }): Promise<PluginActionResult<PackPluginResult>>;
571
- /** Validate an on-disk plugin directory (or an existing ZIP) without uploading. */
572
- declare function validatePluginDir(dir: string, options?: ParseManifestOptions): Promise<PluginActionResult<{
573
- pluginKey: string;
574
- contentSha256: string;
575
- }>>;
576
- declare function validatePluginZipBuffer(buffer: Buffer, options?: ParseManifestOptions): Promise<PluginActionResult<{
577
- pluginKey: string;
578
- contentSha256: string;
579
- }>>;
580
-
581
- export { EXTERNAL_CONNECTION_ALLOWED_HOSTS, EXTERNAL_CONNECTION_HTTP_METHODS, OAUTH_PROVIDER_KEY_RE, type PackPluginResult, ParseManifestOptions, ParsedPluginManifest, PluginActionResult, PluginCervioApiRequirement, PluginConnectionRequirement, PluginEntityRequirement, type PluginManifestZod, PluginSettingsFieldRequirement, PluginType, type PolicyHookCaller, type PolicyHookEvent, type PolicyHookInput, type PolicyHookResult, type PolicyHost, assertPolicyEntrySelfContained, compareSemverDesc, computePluginContentSha256, findBareModuleSpecifiers, isExternalConnectionProvider, isPolicyPluginType, loadZipFromBuffer, manifestJsonForContentHash, nextPatchVersion, normalizeExactApiHost, normalizePluginKey, normalizeToPolicyPluginType, packPlugin, parseManifestObject, parsePluginCervioApiRequirements, parsePluginConnections, parsePluginEntityRequirements, parsePluginSettingsRequirements, parseZipManifest, pluginManifestZodSchema, sha256Hex, validatePluginDir, validatePluginZipBuffer };