@cervio/plugin-core 0.1.1 → 1.0.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/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/browser-Ddj__JFI.d.ts +141 -0
- package/dist/browser.d.ts +1 -0
- package/dist/browser.js +166 -0
- package/dist/index.d.ts +63 -368
- package/dist/index.js +390 -155
- package/manifest.schema.json +159 -4
- package/package.json +36 -21
- package/dist/index.cjs +0 -549
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -427
- package/dist/index.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,114 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type PluginType = 'task' | 'form' | 'task_form' | 'route';
|
|
5
|
-
type PluginActionResult<T> = {
|
|
6
|
-
ok: true;
|
|
7
|
-
value: T;
|
|
8
|
-
} | {
|
|
9
|
-
ok: false;
|
|
10
|
-
error: string;
|
|
11
|
-
};
|
|
12
|
-
interface PluginVersionRow {
|
|
13
|
-
id: string;
|
|
14
|
-
plugin_id: string;
|
|
15
|
-
version: string;
|
|
16
|
-
changelog: string | null;
|
|
17
|
-
artifact_path: string | null;
|
|
18
|
-
artifact_entry_path?: string | null;
|
|
19
|
-
artifact_sha256: string | null;
|
|
20
|
-
content_sha256?: string | null;
|
|
21
|
-
artifact_size_bytes: number | null;
|
|
22
|
-
created_at: string;
|
|
23
|
-
/** Soft-delete timestamp; when set the row is history-only (strikethrough in Admin). */
|
|
24
|
-
deleted_at?: string | null;
|
|
25
|
-
deleted_by?: string | null;
|
|
26
|
-
}
|
|
27
|
-
interface ParsedPluginManifest {
|
|
28
|
-
pluginKey: string;
|
|
29
|
-
pluginName: string | null;
|
|
30
|
-
pluginType: PluginType | null;
|
|
31
|
-
/** Present in ZIP but ignored for assignment; Cervio owns release versions. */
|
|
32
|
-
manifestVersion: string | null;
|
|
33
|
-
/** Catalog capability ids the plugin needs (e.g. calendar). */
|
|
34
|
-
requiredConnectionCapabilities: string[];
|
|
35
|
-
/** External Connections requirements (OAuth broker). */
|
|
36
|
-
connections: PluginConnectionRequirement[];
|
|
37
|
-
/** Declared Cervio entity deps (name-based; for Admin + future export). */
|
|
38
|
-
entities: PluginEntityRequirement[];
|
|
39
|
-
/** Declared Cervio API path prefixes (documentation / future allowlist). */
|
|
40
|
-
cervioApis: PluginCervioApiRequirement[];
|
|
41
|
-
artifactEntryPath: string;
|
|
42
|
-
rawManifest: Record<string, unknown>;
|
|
43
|
-
manifestEntryName: string;
|
|
44
|
-
}
|
|
45
|
-
type PluginEntityAccess = 'read' | 'write';
|
|
46
|
-
type PluginEntityRequirement = {
|
|
47
|
-
name: string;
|
|
48
|
-
fields: string[];
|
|
49
|
-
forms: string[];
|
|
50
|
-
access: PluginEntityAccess[];
|
|
51
|
-
};
|
|
52
|
-
type PluginCervioApiRequirement = {
|
|
53
|
-
method: string;
|
|
54
|
-
path_prefix: string;
|
|
55
|
-
};
|
|
56
|
-
type ExternalConnectionHttpMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
|
|
57
|
-
type AllowedApiRule = {
|
|
58
|
-
host: string;
|
|
59
|
-
methods: ExternalConnectionHttpMethod[];
|
|
60
|
-
path_prefix: string;
|
|
61
|
-
};
|
|
62
|
-
type PluginConnectionRequirement = {
|
|
63
|
-
id: string;
|
|
64
|
-
provider: string;
|
|
65
|
-
consent: 'user';
|
|
66
|
-
scopes: string[];
|
|
67
|
-
allowed_apis: AllowedApiRule[];
|
|
68
|
-
};
|
|
69
|
-
type ParseManifestOptions = {
|
|
70
|
-
/**
|
|
71
|
-
* Capability ids a plugin may declare in `required_connection_capabilities`.
|
|
72
|
-
* Host passes the live catalog; CLI uses {@link DEFAULT_PLUGIN_DECLARABLE_CAPABILITIES}.
|
|
73
|
-
*/
|
|
74
|
-
allowedCapabilities?: readonly string[];
|
|
75
|
-
};
|
|
76
|
-
declare const PLUGIN_ARTIFACT_BUCKET = "plugin-artifacts";
|
|
77
|
-
declare const MAX_PLUGIN_ZIP_BYTES: number;
|
|
78
|
-
declare const MAX_PLUGIN_ZIP_ENTRIES = 5000;
|
|
79
|
-
declare const MAX_PLUGIN_UNCOMPRESSED_BYTES: number;
|
|
80
|
-
declare const PLUGIN_KEY_RE: RegExp;
|
|
81
|
-
declare const PLUGIN_VERSION_SELECT = "id, plugin_id, version, changelog, artifact_path, artifact_entry_path, artifact_sha256, content_sha256, artifact_size_bytes, created_at, deleted_at, deleted_by";
|
|
82
|
-
/**
|
|
83
|
-
* Static default for CLI validate. Generated from host `CONNECTION_CAPABILITY_CATALOG`
|
|
84
|
-
* where `pluginDeclarable === true`. Guarded by drift test against the host catalog.
|
|
85
|
-
*/
|
|
86
|
-
declare const DEFAULT_PLUGIN_DECLARABLE_CAPABILITIES: readonly ["calendar"];
|
|
87
|
-
|
|
88
|
-
/** Parse `entities` from manifest.json (invalid entries skipped). */
|
|
89
|
-
declare function parsePluginEntityRequirements(raw: unknown): PluginEntityRequirement[];
|
|
90
|
-
/** Parse `cervio_apis` from manifest.json. */
|
|
91
|
-
declare function parsePluginCervioApiRequirements(raw: unknown): PluginCervioApiRequirement[];
|
|
92
|
-
|
|
93
|
-
declare const EXTERNAL_CONNECTION_ALLOWED_HOSTS: Record<string, readonly string[]>;
|
|
94
|
-
declare const EXTERNAL_CONNECTION_HTTP_METHODS: readonly ["GET", "POST", "PATCH", "PUT", "DELETE"];
|
|
95
|
-
declare const OAUTH_PROVIDER_KEY_RE: RegExp;
|
|
96
|
-
/** Lightweight host check (no DNS); mirrors host `normalizeExactApiHost` shape rules. */
|
|
97
|
-
declare function normalizeExactApiHost(raw: string): string | null;
|
|
98
|
-
declare function isExternalConnectionProvider(v: string): boolean;
|
|
99
|
-
/** Parse manifest `connections` array; drops invalid entries. */
|
|
100
|
-
declare function parsePluginConnections(raw: unknown): PluginConnectionRequirement[];
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Validates a loaded plugin ZIP before any entry is inflated (CERVIO-SEC-014):
|
|
104
|
-
* caps the entry count and total declared uncompressed size to stop zip bombs,
|
|
105
|
-
* and rejects path-traversal / absolute entry names as defense-in-depth.
|
|
106
|
-
*/
|
|
107
|
-
declare function assertZipSafe(zip: JSZip): PluginActionResult<true>;
|
|
108
|
-
declare function assertZipFile(file: {
|
|
109
|
-
name?: string;
|
|
110
|
-
size: number;
|
|
111
|
-
}): PluginActionResult<true>;
|
|
1
|
+
import { P as ParseManifestOptions, a as PluginActionResult, b as PluginType, c as PluginConnectionRequirement, d as PluginEntityRequirement, e as PluginCervioApiRequirement, f as PluginSettingsFieldRequirement, g as PluginBootRequest, h as ParsedPluginManifest, i as PluginZip } from './browser-Ddj__JFI.js';
|
|
2
|
+
export { A as AllowedApiRule, D as DEFAULT_PLUGIN_DECLARABLE_CAPABILITIES, E as ExternalConnectionHttpMethod, M as MAX_PLUGIN_UNCOMPRESSED_BYTES, j as MAX_PLUGIN_ZIP_BYTES, k as MAX_PLUGIN_ZIP_ENTRIES, l as PLUGIN_ARTIFACT_SOFT_STRONG_WARN_BYTES, m as PLUGIN_ARTIFACT_SOFT_WARN_BYTES, n as PLUGIN_KEY_RE, o as PluginEntityAccess, p as PluginSettingsFieldOption, q as PluginSettingsFieldType, r as assertZipFile, s as isDeclarableCervioApiRequirement, t as isDeclaredCervioApiRequest, u as parsePluginBootRequests, v as parsePluginCervioApiRequirements, w as parsePluginEntityRequirements, x as readPluginZip } from './browser-Ddj__JFI.js';
|
|
112
3
|
|
|
113
4
|
/**
|
|
114
5
|
* Next patch version assigned by Cervio. Ignores pre-release/build metadata on
|
|
@@ -118,261 +9,62 @@ declare function nextPatchVersion(latest: string | null | undefined): string;
|
|
|
118
9
|
/** Compare core x.y.z numerically (descending sort helper). */
|
|
119
10
|
declare function compareSemverDesc(a: string, b: string): number;
|
|
120
11
|
|
|
121
|
-
/**
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
host: string;
|
|
159
|
-
methods: string[];
|
|
160
|
-
path_prefix?: string | undefined;
|
|
161
|
-
pathPrefix?: string | undefined;
|
|
162
|
-
}[] | undefined;
|
|
163
|
-
allowedApis?: unknown[] | undefined;
|
|
164
|
-
}, {
|
|
165
|
-
id: string;
|
|
166
|
-
provider: string;
|
|
167
|
-
scopes: string[];
|
|
168
|
-
allowed_apis?: {
|
|
169
|
-
host: string;
|
|
170
|
-
methods: string[];
|
|
171
|
-
path_prefix?: string | undefined;
|
|
172
|
-
pathPrefix?: string | undefined;
|
|
173
|
-
}[] | undefined;
|
|
174
|
-
allowedApis?: unknown[] | undefined;
|
|
175
|
-
}>, "many">>;
|
|
176
|
-
entities: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
177
|
-
name: z.ZodString;
|
|
178
|
-
fields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
179
|
-
forms: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
180
|
-
access: z.ZodOptional<z.ZodArray<z.ZodEnum<["read", "write"]>, "many">>;
|
|
181
|
-
}, "strip", z.ZodTypeAny, {
|
|
182
|
-
name: string;
|
|
183
|
-
fields?: string[] | undefined;
|
|
184
|
-
forms?: string[] | undefined;
|
|
185
|
-
access?: ("read" | "write")[] | undefined;
|
|
186
|
-
}, {
|
|
187
|
-
name: string;
|
|
188
|
-
fields?: string[] | undefined;
|
|
189
|
-
forms?: string[] | undefined;
|
|
190
|
-
access?: ("read" | "write")[] | undefined;
|
|
191
|
-
}>, "many">>;
|
|
192
|
-
cervio_apis: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
193
|
-
method: z.ZodOptional<z.ZodString>;
|
|
194
|
-
path_prefix: z.ZodOptional<z.ZodString>;
|
|
195
|
-
pathPrefix: z.ZodOptional<z.ZodString>;
|
|
196
|
-
}, "strip", z.ZodTypeAny, {
|
|
197
|
-
method?: string | undefined;
|
|
198
|
-
path_prefix?: string | undefined;
|
|
199
|
-
pathPrefix?: string | undefined;
|
|
200
|
-
}, {
|
|
201
|
-
method?: string | undefined;
|
|
202
|
-
path_prefix?: string | undefined;
|
|
203
|
-
pathPrefix?: string | undefined;
|
|
204
|
-
}>, "many">>;
|
|
205
|
-
cervioApis: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
|
|
206
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
207
|
-
plugin_key: z.ZodOptional<z.ZodString>;
|
|
208
|
-
id: z.ZodOptional<z.ZodString>;
|
|
209
|
-
plugin_name: z.ZodOptional<z.ZodString>;
|
|
210
|
-
name: z.ZodOptional<z.ZodString>;
|
|
211
|
-
plugin_type: z.ZodOptional<z.ZodEnum<["task", "form", "task_form", "route"]>>;
|
|
212
|
-
kind: z.ZodOptional<z.ZodString>;
|
|
213
|
-
version: z.ZodOptional<z.ZodString>;
|
|
214
|
-
required_connection_capabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
215
|
-
requiredConnectionCapabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
216
|
-
connections: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
217
|
-
id: z.ZodString;
|
|
218
|
-
provider: z.ZodString;
|
|
219
|
-
scopes: z.ZodArray<z.ZodString, "many">;
|
|
220
|
-
allowed_apis: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
221
|
-
host: z.ZodString;
|
|
222
|
-
methods: z.ZodArray<z.ZodString, "many">;
|
|
223
|
-
path_prefix: z.ZodOptional<z.ZodString>;
|
|
224
|
-
pathPrefix: z.ZodOptional<z.ZodString>;
|
|
225
|
-
}, "strip", z.ZodTypeAny, {
|
|
226
|
-
host: string;
|
|
227
|
-
methods: string[];
|
|
228
|
-
path_prefix?: string | undefined;
|
|
229
|
-
pathPrefix?: string | undefined;
|
|
230
|
-
}, {
|
|
231
|
-
host: string;
|
|
232
|
-
methods: string[];
|
|
233
|
-
path_prefix?: string | undefined;
|
|
234
|
-
pathPrefix?: string | undefined;
|
|
235
|
-
}>, "many">>;
|
|
236
|
-
allowedApis: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
|
|
237
|
-
}, "strip", z.ZodTypeAny, {
|
|
238
|
-
id: string;
|
|
239
|
-
provider: string;
|
|
240
|
-
scopes: string[];
|
|
241
|
-
allowed_apis?: {
|
|
242
|
-
host: string;
|
|
243
|
-
methods: string[];
|
|
244
|
-
path_prefix?: string | undefined;
|
|
245
|
-
pathPrefix?: string | undefined;
|
|
246
|
-
}[] | undefined;
|
|
247
|
-
allowedApis?: unknown[] | undefined;
|
|
248
|
-
}, {
|
|
249
|
-
id: string;
|
|
250
|
-
provider: string;
|
|
251
|
-
scopes: string[];
|
|
252
|
-
allowed_apis?: {
|
|
253
|
-
host: string;
|
|
254
|
-
methods: string[];
|
|
255
|
-
path_prefix?: string | undefined;
|
|
256
|
-
pathPrefix?: string | undefined;
|
|
257
|
-
}[] | undefined;
|
|
258
|
-
allowedApis?: unknown[] | undefined;
|
|
259
|
-
}>, "many">>;
|
|
260
|
-
entities: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
261
|
-
name: z.ZodString;
|
|
262
|
-
fields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
263
|
-
forms: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
264
|
-
access: z.ZodOptional<z.ZodArray<z.ZodEnum<["read", "write"]>, "many">>;
|
|
265
|
-
}, "strip", z.ZodTypeAny, {
|
|
266
|
-
name: string;
|
|
267
|
-
fields?: string[] | undefined;
|
|
268
|
-
forms?: string[] | undefined;
|
|
269
|
-
access?: ("read" | "write")[] | undefined;
|
|
270
|
-
}, {
|
|
271
|
-
name: string;
|
|
272
|
-
fields?: string[] | undefined;
|
|
273
|
-
forms?: string[] | undefined;
|
|
274
|
-
access?: ("read" | "write")[] | undefined;
|
|
275
|
-
}>, "many">>;
|
|
276
|
-
cervio_apis: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
277
|
-
method: z.ZodOptional<z.ZodString>;
|
|
278
|
-
path_prefix: z.ZodOptional<z.ZodString>;
|
|
279
|
-
pathPrefix: z.ZodOptional<z.ZodString>;
|
|
280
|
-
}, "strip", z.ZodTypeAny, {
|
|
281
|
-
method?: string | undefined;
|
|
282
|
-
path_prefix?: string | undefined;
|
|
283
|
-
pathPrefix?: string | undefined;
|
|
284
|
-
}, {
|
|
285
|
-
method?: string | undefined;
|
|
286
|
-
path_prefix?: string | undefined;
|
|
287
|
-
pathPrefix?: string | undefined;
|
|
288
|
-
}>, "many">>;
|
|
289
|
-
cervioApis: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
|
|
290
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
291
|
-
plugin_key: z.ZodOptional<z.ZodString>;
|
|
292
|
-
id: z.ZodOptional<z.ZodString>;
|
|
293
|
-
plugin_name: z.ZodOptional<z.ZodString>;
|
|
294
|
-
name: z.ZodOptional<z.ZodString>;
|
|
295
|
-
plugin_type: z.ZodOptional<z.ZodEnum<["task", "form", "task_form", "route"]>>;
|
|
296
|
-
kind: z.ZodOptional<z.ZodString>;
|
|
297
|
-
version: z.ZodOptional<z.ZodString>;
|
|
298
|
-
required_connection_capabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
299
|
-
requiredConnectionCapabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
300
|
-
connections: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
301
|
-
id: z.ZodString;
|
|
302
|
-
provider: z.ZodString;
|
|
303
|
-
scopes: z.ZodArray<z.ZodString, "many">;
|
|
304
|
-
allowed_apis: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
305
|
-
host: z.ZodString;
|
|
306
|
-
methods: z.ZodArray<z.ZodString, "many">;
|
|
307
|
-
path_prefix: z.ZodOptional<z.ZodString>;
|
|
308
|
-
pathPrefix: z.ZodOptional<z.ZodString>;
|
|
309
|
-
}, "strip", z.ZodTypeAny, {
|
|
310
|
-
host: string;
|
|
311
|
-
methods: string[];
|
|
312
|
-
path_prefix?: string | undefined;
|
|
313
|
-
pathPrefix?: string | undefined;
|
|
314
|
-
}, {
|
|
315
|
-
host: string;
|
|
316
|
-
methods: string[];
|
|
317
|
-
path_prefix?: string | undefined;
|
|
318
|
-
pathPrefix?: string | undefined;
|
|
319
|
-
}>, "many">>;
|
|
320
|
-
allowedApis: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
|
|
321
|
-
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
/**
|
|
13
|
+
* Policy Plugin hook contract (shared by host, SDK, and manifest authors).
|
|
14
|
+
* Wire legacy: `plugin_type: "server"` is an alias for `"policy"`.
|
|
15
|
+
*/
|
|
16
|
+
type PolicyHookEvent = 'before_create' | 'before_update';
|
|
17
|
+
type PolicyHookCaller = {
|
|
18
|
+
userId?: string;
|
|
19
|
+
channel?: string;
|
|
20
|
+
organizationId?: string;
|
|
21
|
+
};
|
|
22
|
+
type PolicyHookInput = {
|
|
23
|
+
event: PolicyHookEvent;
|
|
24
|
+
entity: {
|
|
25
|
+
id?: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
};
|
|
28
|
+
record: {
|
|
29
|
+
id?: string | null;
|
|
30
|
+
data: Record<string, unknown>;
|
|
31
|
+
previousData?: Record<string, unknown> | null;
|
|
32
|
+
};
|
|
33
|
+
caller?: PolicyHookCaller;
|
|
34
|
+
settings?: Record<string, unknown>;
|
|
35
|
+
pluginKey?: string;
|
|
36
|
+
allowedEntityReads?: string[];
|
|
37
|
+
deadlineMs?: number;
|
|
38
|
+
};
|
|
39
|
+
type PolicyHookResult = {
|
|
40
|
+
allow: true;
|
|
41
|
+
} | {
|
|
42
|
+
allow: false;
|
|
43
|
+
message: string;
|
|
44
|
+
code?: string;
|
|
45
|
+
};
|
|
46
|
+
/** Host-mediated reads injected by plugin-sandbox-runner (null if no allowlist/caller). */
|
|
47
|
+
type PolicyHost = {
|
|
48
|
+
getRecord(entityName: string, id: string): Promise<{
|
|
322
49
|
id: string;
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
}[] | undefined;
|
|
331
|
-
allowedApis?: unknown[] | undefined;
|
|
332
|
-
}, {
|
|
50
|
+
data: Record<string, unknown>;
|
|
51
|
+
} | null>;
|
|
52
|
+
listRecords(entityName: string, opts?: {
|
|
53
|
+
filters?: Record<string, unknown>;
|
|
54
|
+
limit?: number;
|
|
55
|
+
offset?: number;
|
|
56
|
+
}): Promise<Array<{
|
|
333
57
|
id: string;
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
entities: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
345
|
-
name: z.ZodString;
|
|
346
|
-
fields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
347
|
-
forms: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
348
|
-
access: z.ZodOptional<z.ZodArray<z.ZodEnum<["read", "write"]>, "many">>;
|
|
349
|
-
}, "strip", z.ZodTypeAny, {
|
|
350
|
-
name: string;
|
|
351
|
-
fields?: string[] | undefined;
|
|
352
|
-
forms?: string[] | undefined;
|
|
353
|
-
access?: ("read" | "write")[] | undefined;
|
|
354
|
-
}, {
|
|
355
|
-
name: string;
|
|
356
|
-
fields?: string[] | undefined;
|
|
357
|
-
forms?: string[] | undefined;
|
|
358
|
-
access?: ("read" | "write")[] | undefined;
|
|
359
|
-
}>, "many">>;
|
|
360
|
-
cervio_apis: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
361
|
-
method: z.ZodOptional<z.ZodString>;
|
|
362
|
-
path_prefix: z.ZodOptional<z.ZodString>;
|
|
363
|
-
pathPrefix: z.ZodOptional<z.ZodString>;
|
|
364
|
-
}, "strip", z.ZodTypeAny, {
|
|
365
|
-
method?: string | undefined;
|
|
366
|
-
path_prefix?: string | undefined;
|
|
367
|
-
pathPrefix?: string | undefined;
|
|
368
|
-
}, {
|
|
369
|
-
method?: string | undefined;
|
|
370
|
-
path_prefix?: string | undefined;
|
|
371
|
-
pathPrefix?: string | undefined;
|
|
372
|
-
}>, "many">>;
|
|
373
|
-
cervioApis: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
|
|
374
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
375
|
-
type PluginManifestZod = z.infer<typeof pluginManifestZodSchema>;
|
|
58
|
+
data: Record<string, unknown>;
|
|
59
|
+
}>>;
|
|
60
|
+
sumField(entityName: string, fieldName: string, opts?: {
|
|
61
|
+
filters?: Record<string, unknown>;
|
|
62
|
+
}): Promise<number>;
|
|
63
|
+
};
|
|
64
|
+
/** True for canonical `policy` and legacy wire `server`. */
|
|
65
|
+
declare function isPolicyPluginType(t: string | null | undefined): boolean;
|
|
66
|
+
/** Canonical type written on upload / preferred in new manifests. */
|
|
67
|
+
declare function normalizeToPolicyPluginType(t: string | null | undefined): 'policy' | null;
|
|
376
68
|
|
|
377
69
|
declare function normalizePluginKey(raw: string): string;
|
|
378
70
|
declare function parseManifestObject(parsed: Record<string, unknown>, options?: ParseManifestOptions): PluginActionResult<{
|
|
@@ -384,11 +76,13 @@ declare function parseManifestObject(parsed: Record<string, unknown>, options?:
|
|
|
384
76
|
connections: PluginConnectionRequirement[];
|
|
385
77
|
entities: PluginEntityRequirement[];
|
|
386
78
|
cervioApis: PluginCervioApiRequirement[];
|
|
79
|
+
settings: PluginSettingsFieldRequirement[];
|
|
80
|
+
bootRequests: PluginBootRequest[];
|
|
387
81
|
}>;
|
|
388
82
|
/** Manifest JSON for hashing: drop author `version` so Cervio-owned labels do not affect dedup. */
|
|
389
83
|
declare function manifestJsonForContentHash(raw: Record<string, unknown>): string;
|
|
390
|
-
|
|
391
|
-
declare function parseZipManifest(file:
|
|
84
|
+
/** Reads and validates the manifest of a plugin ZIP (an uploaded file, or its bytes). */
|
|
85
|
+
declare function parseZipManifest(file: Blob | ArrayBuffer | Uint8Array, options?: ParseManifestOptions): Promise<PluginActionResult<ParsedPluginManifest>>;
|
|
392
86
|
|
|
393
87
|
/**
|
|
394
88
|
* Deterministic SHA-256 over:
|
|
@@ -397,7 +91,7 @@ declare function parseZipManifest(file: File | Blob, options?: ParseManifestOpti
|
|
|
397
91
|
*
|
|
398
92
|
* README / other root files and ZIP compression metadata do not affect the hash.
|
|
399
93
|
*/
|
|
400
|
-
declare function computePluginContentSha256(zip:
|
|
94
|
+
declare function computePluginContentSha256(zip: PluginZip, rawManifest: Record<string, unknown>): PluginActionResult<string>;
|
|
401
95
|
declare function sha256Hex(buffer: Buffer | Uint8Array): string;
|
|
402
96
|
|
|
403
97
|
type PackPluginResult = {
|
|
@@ -424,4 +118,5 @@ declare function validatePluginZipBuffer(buffer: Buffer, options?: ParseManifest
|
|
|
424
118
|
contentSha256: string;
|
|
425
119
|
}>>;
|
|
426
120
|
|
|
427
|
-
export {
|
|
121
|
+
export { ParseManifestOptions, ParsedPluginManifest, PluginActionResult, PluginBootRequest, PluginCervioApiRequirement, PluginConnectionRequirement, PluginEntityRequirement, PluginSettingsFieldRequirement, PluginType, PluginZip, compareSemverDesc, computePluginContentSha256, isPolicyPluginType, manifestJsonForContentHash, nextPatchVersion, normalizePluginKey, normalizeToPolicyPluginType, packPlugin, parseManifestObject, parseZipManifest, sha256Hex, validatePluginDir, validatePluginZipBuffer };
|
|
122
|
+
export type { PackPluginResult, PolicyHookCaller, PolicyHookEvent, PolicyHookInput, PolicyHookResult, PolicyHost };
|