@crowi/plugin-api 1.0.0-alpha.7 → 1.0.0-alpha.9
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/README.md +34 -0
- package/dist/index.d.mts +129 -1
- package/dist/index.d.ts +129 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -109,6 +109,40 @@ const myPlugin: CrowiPlugin = {
|
|
|
109
109
|
export default myPlugin;
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
+
## Post-save connectivity verification (`verifyConfig`)
|
|
113
|
+
|
|
114
|
+
A plugin whose config change needs a real connectivity/permission check (a storage bucket, a search cluster, …) can implement `verifyConfig`. The runtime calls it once after an admin save has already persisted and `reconfigure` has already run — never before, and never as a condition for the save itself:
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
import type { CrowiPlugin, PluginConfigVerificationSnapshot, PluginConfigVerificationOptions, PluginConfigVerificationResult } from '@crowi/plugin-api';
|
|
118
|
+
|
|
119
|
+
const myPlugin: CrowiPlugin = {
|
|
120
|
+
// ...
|
|
121
|
+
|
|
122
|
+
verifyConfig: async (
|
|
123
|
+
snapshot: PluginConfigVerificationSnapshot,
|
|
124
|
+
options: PluginConfigVerificationOptions,
|
|
125
|
+
): Promise<PluginConfigVerificationResult> => {
|
|
126
|
+
const config = snapshot.config<{ endpoint: string; accessKey: string }>();
|
|
127
|
+
try {
|
|
128
|
+
await probeMyBackend(config);
|
|
129
|
+
return { status: 'ok' };
|
|
130
|
+
} catch (err) {
|
|
131
|
+
return { status: 'failed', reason: classifyMyError(err) };
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
A few things make this different from every other `register*` / `reconfigure` callback:
|
|
138
|
+
|
|
139
|
+
- **Snapshot, not `PluginContext`.** `verifyConfig` receives a `PluginConfigVerificationSnapshot` — a read-only, point-in-time view of this plugin's own config (and any declared, `exposesConfigToDependents` dependency's config), frozen at the moment the triggering save was about to persist. It is NOT the live `PluginContext`: there is no `setConfig`, `model`, `state`, or `pageMetadata` on it, and calling `snapshot.config()` later never reflects a different admin request's save that lands while your hook is still running.
|
|
140
|
+
- **Fans out to dependents.** If plugin B `requires` plugin A and B implements `verifyConfig`, saving A's config also re-verifies B (same affected-set walk `reconfigure` uses). B's hook only sees A's dependency config if A also set `exposesConfigToDependents: true`.
|
|
141
|
+
- **Non-blocking, always.** A failing (or throwing, or never-resolving) `verifyConfig` never fails the save — the save already succeeded by the time this hook runs. `options.timeoutMs` (currently 10 seconds) is a NOTICE the caller stops waiting on your promise after, not a cancellation signal: there is no `AbortSignal` anywhere in this contract, and none is threaded down into any `StorageDriver` call your hook makes. Design your hook's own I/O with a bounded retry/attempt policy (e.g. a single attempt, no retries) so it settles well within that budget on its own.
|
|
142
|
+
- **Result is a closed, safe union.** Return `{ status: 'ok' }` or `{ status: 'failed', reason }`, where `reason` is one of `'unreachable' | 'auth-failed' | 'resource-missing' | 'write-denied' | 'unknown'`. Never put raw SDK error text, a stack trace, an endpoint, or credential material anywhere in the result (or in anything you log) — the runtime reports this straight to the admin API response. Anything your hook returns outside this shape is normalized to `{ status: 'failed', reason: 'unknown' }` by the caller, so prefer an honest `'unknown'` yourself over guessing a more specific reason you can't actually confirm.
|
|
143
|
+
- **Optional.** A plugin with no `verifyConfig` is completely unaffected — no extra work at boot or save time, no entry in the response's `verificationResults`.
|
|
144
|
+
- **Instance-local, not cluster-wide.** The runtime calls `verifyConfig` on whichever api process handled the save request and reports only that process's outcome. It never coordinates with other replicas, so a result reflects reachability/permissions from that one instance at that moment — not the deployment as a whole. If your hook's I/O (network reachability, IAM/role assumption, DNS) can differ between replicas, document that for operators; don't imply a passing result means every replica can reach the backend.
|
|
145
|
+
|
|
112
146
|
## See also
|
|
113
147
|
|
|
114
148
|
- [Plugin development guide](https://crowi.wiki/docs/plugins/developing) —
|
package/dist/index.d.mts
CHANGED
|
@@ -207,6 +207,101 @@ interface PluginLogger {
|
|
|
207
207
|
error(message: string, ...args: unknown[]): void;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Contract for `CrowiPlugin.verifyConfig` — a non-blocking, post-save
|
|
212
|
+
* connectivity/permission probe (feature-plugin-config-live-verification).
|
|
213
|
+
* Deliberately its own module, separate from `context.ts`'s live
|
|
214
|
+
* `PluginContext`: a verification hook runs AFTER the admin save has
|
|
215
|
+
* already persisted (and after `reconfigure` has already rebuilt the live
|
|
216
|
+
* driver), against the EXACT values that request saved — not whatever the
|
|
217
|
+
* config cache holds by the time the hook actually runs. Handing a hook
|
|
218
|
+
* `PluginContext` would let it call `ctx.setConfig()` / read a
|
|
219
|
+
* concurrently-updated cache / touch models, none of which a read-only,
|
|
220
|
+
* best-effort probe should be able to do.
|
|
221
|
+
*/
|
|
222
|
+
/**
|
|
223
|
+
* Recursively read-only view of `T`. Used for both `config()` and
|
|
224
|
+
* `dependencyConfig()` on {@link PluginConfigVerificationSnapshot} — a
|
|
225
|
+
* verification hook must not be able to mutate the plan's materialized
|
|
226
|
+
* values (they are shared across the plan and, for a dependency, may be
|
|
227
|
+
* read by more than one hook).
|
|
228
|
+
*/
|
|
229
|
+
type ReadonlyDeep<T> = T extends readonly (infer U)[] ? readonly ReadonlyDeep<U>[] : T extends object ? {
|
|
230
|
+
readonly [K in keyof T]: ReadonlyDeep<T[K]>;
|
|
231
|
+
} : T;
|
|
232
|
+
/**
|
|
233
|
+
* Immutable facade a `verifyConfig` hook reads its plugin's (and its
|
|
234
|
+
* declared dependencies') config through. NOT `PluginContext`: this
|
|
235
|
+
* snapshot is materialized once, before the save that triggered
|
|
236
|
+
* verification, and never changes for the lifetime of the hook call — a
|
|
237
|
+
* concurrent save of another plugin's config (or of this plugin's config,
|
|
238
|
+
* from a second in-flight admin request) cannot change what an
|
|
239
|
+
* already-running hook sees. See `PluginManager.createVerificationPlan()`.
|
|
240
|
+
*/
|
|
241
|
+
interface PluginConfigVerificationSnapshot {
|
|
242
|
+
/**
|
|
243
|
+
* This plugin's own config, as it was — or will be, for the plugin whose
|
|
244
|
+
* save triggered this verification — immediately after the save. Throws
|
|
245
|
+
* if the plugin does not declare a `configSchema` (mirrors
|
|
246
|
+
* `PluginContext.config()`).
|
|
247
|
+
*/
|
|
248
|
+
config<T>(): ReadonlyDeep<T>;
|
|
249
|
+
/**
|
|
250
|
+
* A declared dependency's config. Same capability check as
|
|
251
|
+
* `PluginContext.dependencyConfig()`: `dependencyName` must be listed in
|
|
252
|
+
* this plugin's `requires`, AND the dependency must declare
|
|
253
|
+
* `exposesConfigToDependents: true`. Throws otherwise.
|
|
254
|
+
*/
|
|
255
|
+
dependencyConfig<T>(dependencyName: string): ReadonlyDeep<T>;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Passed alongside the snapshot to every `verifyConfig` call.
|
|
259
|
+
*
|
|
260
|
+
* `timeoutMs` is a NOTICE, not a cancellation mechanism: the caller
|
|
261
|
+
* (`PluginManager`) stops waiting on the hook's returned promise after
|
|
262
|
+
* this many milliseconds and normalizes the result to
|
|
263
|
+
* `{ status: 'failed', reason: 'unreachable' }`, but it never aborts the
|
|
264
|
+
* hook itself — there is no `AbortSignal` here, and none is passed down to
|
|
265
|
+
* any `StorageDriver` call a storage hook makes (the driver's public `put`
|
|
266
|
+
* / `get` / `delete` contract takes no such option; see
|
|
267
|
+
* `@crowi/plugin-api`'s `registries/storage.ts`). A hook whose underlying
|
|
268
|
+
* I/O is still in flight when the caller gives up keeps running in the
|
|
269
|
+
* background; hooks that touch external resources they created (e.g. a
|
|
270
|
+
* storage probe object) should not rely on ever being told to stop, and
|
|
271
|
+
* should clean up opportunistically rather than assume they'll get to run
|
|
272
|
+
* to completion before anyone stops watching.
|
|
273
|
+
*/
|
|
274
|
+
interface PluginConfigVerificationOptions {
|
|
275
|
+
timeoutMs: number;
|
|
276
|
+
}
|
|
277
|
+
/** The closed set of reasons a verification probe can fail for. Anything a driver can't confidently place in one of these falls into `'unknown'` — a wrong specific reason would mislead an operator more than an honest "couldn't tell". */
|
|
278
|
+
type VerificationFailureReason = 'unreachable' | 'auth-failed' | 'resource-missing' | 'write-denied' | 'unknown';
|
|
279
|
+
/**
|
|
280
|
+
* What a `verifyConfig` hook resolves to. Deliberately a closed,
|
|
281
|
+
* allow-listed shape — the caller projects whatever a hook returns onto
|
|
282
|
+
* this union (an invalid shape normalizes to `{ status: 'failed', reason:
|
|
283
|
+
* 'unknown' }`), so a hook can never smuggle raw SDK error text, a stack
|
|
284
|
+
* trace, an endpoint, or credential material into the admin response or
|
|
285
|
+
* logs by returning it as an extra field.
|
|
286
|
+
*/
|
|
287
|
+
type PluginConfigVerificationResult = {
|
|
288
|
+
status: 'ok';
|
|
289
|
+
} | {
|
|
290
|
+
status: 'failed';
|
|
291
|
+
reason: VerificationFailureReason;
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* Key namespace every storage `verifyConfig` probe writes its round-trip
|
|
295
|
+
* object under — deliberately disjoint from `attachment/*` (core's
|
|
296
|
+
* uploaded-file namespace) so a probe object can never collide with,
|
|
297
|
+
* shadow, or get mistaken for a real attachment. A storage hook builds its
|
|
298
|
+
* probe key as `` `${CONFIG_VERIFICATION_KEY_PREFIX}<random>` ``; because
|
|
299
|
+
* cleanup after a probe is best-effort (see the `timeoutMs` note on
|
|
300
|
+
* {@link PluginConfigVerificationOptions}), an operator who finds a
|
|
301
|
+
* leftover object can safely delete anything under this prefix.
|
|
302
|
+
*/
|
|
303
|
+
declare const CONFIG_VERIFICATION_KEY_PREFIX = "__crowi_config_verification__/";
|
|
304
|
+
|
|
210
305
|
/**
|
|
211
306
|
* Domain events emitted by core. The full event payload shapes live in
|
|
212
307
|
* `@crowi/server`; this contract publishes only the event names so the
|
|
@@ -1739,6 +1834,39 @@ interface CrowiPlugin {
|
|
|
1739
1834
|
* of the very UI they need to fix the misconfiguration.
|
|
1740
1835
|
*/
|
|
1741
1836
|
reconfigure?: (ctx: PluginContext) => void | Promise<void>;
|
|
1837
|
+
/**
|
|
1838
|
+
* Non-blocking connectivity/permission probe run once, after a save that
|
|
1839
|
+
* touched this plugin's own config OR a dependency's config (any plugin
|
|
1840
|
+
* that has this one in `requires`) has already persisted AND already
|
|
1841
|
+
* run `reconfigure` — feature-plugin-config-live-verification. Never
|
|
1842
|
+
* gates the save: whatever this returns is reported alongside a save
|
|
1843
|
+
* that already succeeded, never rolled back.
|
|
1844
|
+
*
|
|
1845
|
+
* Receives a {@link PluginConfigVerificationSnapshot}, NOT the live
|
|
1846
|
+
* `PluginContext` — do not close over or otherwise reach for `ctx` from
|
|
1847
|
+
* inside this hook. The snapshot is a read-only, point-in-time view
|
|
1848
|
+
* materialized from the exact values the triggering save just wrote (own
|
|
1849
|
+
* config) plus any declared, `exposesConfigToDependents`-opted-in
|
|
1850
|
+
* dependency config — it never reflects a LATER save by a different
|
|
1851
|
+
* admin request, even one that lands while this hook is still running.
|
|
1852
|
+
* `snapshot.config()` / `snapshot.dependencyConfig()` can throw if the
|
|
1853
|
+
* runtime couldn't materialize a value (e.g. an existing, currently
|
|
1854
|
+
* invalid dependency config); the runtime skips calling this hook
|
|
1855
|
+
* entirely in that case rather than invoking it with a broken snapshot.
|
|
1856
|
+
*
|
|
1857
|
+
* `options.timeoutMs` is a notice, not a cancellation signal — see its
|
|
1858
|
+
* doc. Must resolve within that budget or the caller treats it as
|
|
1859
|
+
* `{ status: 'failed', reason: 'unreachable' }`; a promise that keeps
|
|
1860
|
+
* running past that point should still clean up after itself when it
|
|
1861
|
+
* eventually settles, but must never throw out of that cleanup in a way
|
|
1862
|
+
* that becomes an unhandled rejection.
|
|
1863
|
+
*
|
|
1864
|
+
* The returned result (and anything it internally logs) must never
|
|
1865
|
+
* include raw SDK/driver error text, stack traces, endpoints, or
|
|
1866
|
+
* credential material — only the closed `reason` enum. See
|
|
1867
|
+
* `PluginConfigVerificationResult`.
|
|
1868
|
+
*/
|
|
1869
|
+
verifyConfig?: (snapshot: PluginConfigVerificationSnapshot, options: PluginConfigVerificationOptions) => Promise<PluginConfigVerificationResult>;
|
|
1742
1870
|
}
|
|
1743
1871
|
|
|
1744
1872
|
/**
|
|
@@ -1930,4 +2058,4 @@ type SanitizeSvgResult = {
|
|
|
1930
2058
|
*/
|
|
1931
2059
|
declare function sanitizeSvg(input: string, policy: SanitizeSvgPolicy): SanitizeSvgResult;
|
|
1932
2060
|
|
|
1933
|
-
export { ACTION_FIELD_MARKER, type AdmissionControlConfig, type AppInfo, type AuthContext, type AuthDriver, type AuthDriverKind, type AuthProfile, type AuthRegistry, type AuthVerifyResult, type CacheEntry, type CacheKey, type CacheStorage, type CodeBlockInfo, type CodeBlockRenderer, type CreateOAuth2DriverOptions, type CreateOidcDriverOptions, type CredentialAuthDriver, type CredentialField, type CrowiPlugin, type EmailMessage, type EmbedFragment, type EmbedInput, type EmbedRenderer, type EventBus, type InlineExpansion, type MailSender, type MailSenderRegistry, type NodeRenderer, type NotificationPayload, type NotifierDriver, type NotifierRegistry, type OAuth2AuthDriver, type OAuthClientConfig, type OAuthTokens, type OidcAuthDriver, type PageMetadataAccessor, type PluginConfigAtomicGroup, type PluginContext, type PluginEvents, type PluginLogger, type PluginReadinessDeclaration, type PluginRouteHandler, type PluginRouteMethod, type PluginRouteOptions, type PluginRouterScope, type RenderActor, type RenderContext, type RenderError, type RenderPhase, type RenderResult, type RendererRegistry, type Reservation, SENSITIVE_FIELD_MARKER, type SanitizeSvgPolicy, type SanitizeSvgResult, type ScopedCacheStorage, type SearchDriver, type SearchHit, type SearchHits, type SearchPageType, type SearchQuery, type SearchQueryGrants, type SearchQueryViewer, type SearchRegistry, type SearchableDoc, type StateCell, type StorageDriver, type StoragePutMeta, type StoragePutResult, type StorageRegistry, type StructuredRenderPayload, type UrlInlineExpansionRule, createOAuth2Driver, createOidcDriver, escapeHtml, extractSvgDimensions, getActionAnnotation, isSensitiveField, sanitizeSvg };
|
|
2061
|
+
export { ACTION_FIELD_MARKER, type AdmissionControlConfig, type AppInfo, type AuthContext, type AuthDriver, type AuthDriverKind, type AuthProfile, type AuthRegistry, type AuthVerifyResult, CONFIG_VERIFICATION_KEY_PREFIX, type CacheEntry, type CacheKey, type CacheStorage, type CodeBlockInfo, type CodeBlockRenderer, type CreateOAuth2DriverOptions, type CreateOidcDriverOptions, type CredentialAuthDriver, type CredentialField, type CrowiPlugin, type EmailMessage, type EmbedFragment, type EmbedInput, type EmbedRenderer, type EventBus, type InlineExpansion, type MailSender, type MailSenderRegistry, type NodeRenderer, type NotificationPayload, type NotifierDriver, type NotifierRegistry, type OAuth2AuthDriver, type OAuthClientConfig, type OAuthTokens, type OidcAuthDriver, type PageMetadataAccessor, type PluginConfigAtomicGroup, type PluginConfigVerificationOptions, type PluginConfigVerificationResult, type PluginConfigVerificationSnapshot, type PluginContext, type PluginEvents, type PluginLogger, type PluginReadinessDeclaration, type PluginRouteHandler, type PluginRouteMethod, type PluginRouteOptions, type PluginRouterScope, type ReadonlyDeep, type RenderActor, type RenderContext, type RenderError, type RenderPhase, type RenderResult, type RendererRegistry, type Reservation, SENSITIVE_FIELD_MARKER, type SanitizeSvgPolicy, type SanitizeSvgResult, type ScopedCacheStorage, type SearchDriver, type SearchHit, type SearchHits, type SearchPageType, type SearchQuery, type SearchQueryGrants, type SearchQueryViewer, type SearchRegistry, type SearchableDoc, type StateCell, type StorageDriver, type StoragePutMeta, type StoragePutResult, type StorageRegistry, type StructuredRenderPayload, type UrlInlineExpansionRule, type VerificationFailureReason, createOAuth2Driver, createOidcDriver, escapeHtml, extractSvgDimensions, getActionAnnotation, isSensitiveField, sanitizeSvg };
|
package/dist/index.d.ts
CHANGED
|
@@ -207,6 +207,101 @@ interface PluginLogger {
|
|
|
207
207
|
error(message: string, ...args: unknown[]): void;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Contract for `CrowiPlugin.verifyConfig` — a non-blocking, post-save
|
|
212
|
+
* connectivity/permission probe (feature-plugin-config-live-verification).
|
|
213
|
+
* Deliberately its own module, separate from `context.ts`'s live
|
|
214
|
+
* `PluginContext`: a verification hook runs AFTER the admin save has
|
|
215
|
+
* already persisted (and after `reconfigure` has already rebuilt the live
|
|
216
|
+
* driver), against the EXACT values that request saved — not whatever the
|
|
217
|
+
* config cache holds by the time the hook actually runs. Handing a hook
|
|
218
|
+
* `PluginContext` would let it call `ctx.setConfig()` / read a
|
|
219
|
+
* concurrently-updated cache / touch models, none of which a read-only,
|
|
220
|
+
* best-effort probe should be able to do.
|
|
221
|
+
*/
|
|
222
|
+
/**
|
|
223
|
+
* Recursively read-only view of `T`. Used for both `config()` and
|
|
224
|
+
* `dependencyConfig()` on {@link PluginConfigVerificationSnapshot} — a
|
|
225
|
+
* verification hook must not be able to mutate the plan's materialized
|
|
226
|
+
* values (they are shared across the plan and, for a dependency, may be
|
|
227
|
+
* read by more than one hook).
|
|
228
|
+
*/
|
|
229
|
+
type ReadonlyDeep<T> = T extends readonly (infer U)[] ? readonly ReadonlyDeep<U>[] : T extends object ? {
|
|
230
|
+
readonly [K in keyof T]: ReadonlyDeep<T[K]>;
|
|
231
|
+
} : T;
|
|
232
|
+
/**
|
|
233
|
+
* Immutable facade a `verifyConfig` hook reads its plugin's (and its
|
|
234
|
+
* declared dependencies') config through. NOT `PluginContext`: this
|
|
235
|
+
* snapshot is materialized once, before the save that triggered
|
|
236
|
+
* verification, and never changes for the lifetime of the hook call — a
|
|
237
|
+
* concurrent save of another plugin's config (or of this plugin's config,
|
|
238
|
+
* from a second in-flight admin request) cannot change what an
|
|
239
|
+
* already-running hook sees. See `PluginManager.createVerificationPlan()`.
|
|
240
|
+
*/
|
|
241
|
+
interface PluginConfigVerificationSnapshot {
|
|
242
|
+
/**
|
|
243
|
+
* This plugin's own config, as it was — or will be, for the plugin whose
|
|
244
|
+
* save triggered this verification — immediately after the save. Throws
|
|
245
|
+
* if the plugin does not declare a `configSchema` (mirrors
|
|
246
|
+
* `PluginContext.config()`).
|
|
247
|
+
*/
|
|
248
|
+
config<T>(): ReadonlyDeep<T>;
|
|
249
|
+
/**
|
|
250
|
+
* A declared dependency's config. Same capability check as
|
|
251
|
+
* `PluginContext.dependencyConfig()`: `dependencyName` must be listed in
|
|
252
|
+
* this plugin's `requires`, AND the dependency must declare
|
|
253
|
+
* `exposesConfigToDependents: true`. Throws otherwise.
|
|
254
|
+
*/
|
|
255
|
+
dependencyConfig<T>(dependencyName: string): ReadonlyDeep<T>;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Passed alongside the snapshot to every `verifyConfig` call.
|
|
259
|
+
*
|
|
260
|
+
* `timeoutMs` is a NOTICE, not a cancellation mechanism: the caller
|
|
261
|
+
* (`PluginManager`) stops waiting on the hook's returned promise after
|
|
262
|
+
* this many milliseconds and normalizes the result to
|
|
263
|
+
* `{ status: 'failed', reason: 'unreachable' }`, but it never aborts the
|
|
264
|
+
* hook itself — there is no `AbortSignal` here, and none is passed down to
|
|
265
|
+
* any `StorageDriver` call a storage hook makes (the driver's public `put`
|
|
266
|
+
* / `get` / `delete` contract takes no such option; see
|
|
267
|
+
* `@crowi/plugin-api`'s `registries/storage.ts`). A hook whose underlying
|
|
268
|
+
* I/O is still in flight when the caller gives up keeps running in the
|
|
269
|
+
* background; hooks that touch external resources they created (e.g. a
|
|
270
|
+
* storage probe object) should not rely on ever being told to stop, and
|
|
271
|
+
* should clean up opportunistically rather than assume they'll get to run
|
|
272
|
+
* to completion before anyone stops watching.
|
|
273
|
+
*/
|
|
274
|
+
interface PluginConfigVerificationOptions {
|
|
275
|
+
timeoutMs: number;
|
|
276
|
+
}
|
|
277
|
+
/** The closed set of reasons a verification probe can fail for. Anything a driver can't confidently place in one of these falls into `'unknown'` — a wrong specific reason would mislead an operator more than an honest "couldn't tell". */
|
|
278
|
+
type VerificationFailureReason = 'unreachable' | 'auth-failed' | 'resource-missing' | 'write-denied' | 'unknown';
|
|
279
|
+
/**
|
|
280
|
+
* What a `verifyConfig` hook resolves to. Deliberately a closed,
|
|
281
|
+
* allow-listed shape — the caller projects whatever a hook returns onto
|
|
282
|
+
* this union (an invalid shape normalizes to `{ status: 'failed', reason:
|
|
283
|
+
* 'unknown' }`), so a hook can never smuggle raw SDK error text, a stack
|
|
284
|
+
* trace, an endpoint, or credential material into the admin response or
|
|
285
|
+
* logs by returning it as an extra field.
|
|
286
|
+
*/
|
|
287
|
+
type PluginConfigVerificationResult = {
|
|
288
|
+
status: 'ok';
|
|
289
|
+
} | {
|
|
290
|
+
status: 'failed';
|
|
291
|
+
reason: VerificationFailureReason;
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* Key namespace every storage `verifyConfig` probe writes its round-trip
|
|
295
|
+
* object under — deliberately disjoint from `attachment/*` (core's
|
|
296
|
+
* uploaded-file namespace) so a probe object can never collide with,
|
|
297
|
+
* shadow, or get mistaken for a real attachment. A storage hook builds its
|
|
298
|
+
* probe key as `` `${CONFIG_VERIFICATION_KEY_PREFIX}<random>` ``; because
|
|
299
|
+
* cleanup after a probe is best-effort (see the `timeoutMs` note on
|
|
300
|
+
* {@link PluginConfigVerificationOptions}), an operator who finds a
|
|
301
|
+
* leftover object can safely delete anything under this prefix.
|
|
302
|
+
*/
|
|
303
|
+
declare const CONFIG_VERIFICATION_KEY_PREFIX = "__crowi_config_verification__/";
|
|
304
|
+
|
|
210
305
|
/**
|
|
211
306
|
* Domain events emitted by core. The full event payload shapes live in
|
|
212
307
|
* `@crowi/server`; this contract publishes only the event names so the
|
|
@@ -1739,6 +1834,39 @@ interface CrowiPlugin {
|
|
|
1739
1834
|
* of the very UI they need to fix the misconfiguration.
|
|
1740
1835
|
*/
|
|
1741
1836
|
reconfigure?: (ctx: PluginContext) => void | Promise<void>;
|
|
1837
|
+
/**
|
|
1838
|
+
* Non-blocking connectivity/permission probe run once, after a save that
|
|
1839
|
+
* touched this plugin's own config OR a dependency's config (any plugin
|
|
1840
|
+
* that has this one in `requires`) has already persisted AND already
|
|
1841
|
+
* run `reconfigure` — feature-plugin-config-live-verification. Never
|
|
1842
|
+
* gates the save: whatever this returns is reported alongside a save
|
|
1843
|
+
* that already succeeded, never rolled back.
|
|
1844
|
+
*
|
|
1845
|
+
* Receives a {@link PluginConfigVerificationSnapshot}, NOT the live
|
|
1846
|
+
* `PluginContext` — do not close over or otherwise reach for `ctx` from
|
|
1847
|
+
* inside this hook. The snapshot is a read-only, point-in-time view
|
|
1848
|
+
* materialized from the exact values the triggering save just wrote (own
|
|
1849
|
+
* config) plus any declared, `exposesConfigToDependents`-opted-in
|
|
1850
|
+
* dependency config — it never reflects a LATER save by a different
|
|
1851
|
+
* admin request, even one that lands while this hook is still running.
|
|
1852
|
+
* `snapshot.config()` / `snapshot.dependencyConfig()` can throw if the
|
|
1853
|
+
* runtime couldn't materialize a value (e.g. an existing, currently
|
|
1854
|
+
* invalid dependency config); the runtime skips calling this hook
|
|
1855
|
+
* entirely in that case rather than invoking it with a broken snapshot.
|
|
1856
|
+
*
|
|
1857
|
+
* `options.timeoutMs` is a notice, not a cancellation signal — see its
|
|
1858
|
+
* doc. Must resolve within that budget or the caller treats it as
|
|
1859
|
+
* `{ status: 'failed', reason: 'unreachable' }`; a promise that keeps
|
|
1860
|
+
* running past that point should still clean up after itself when it
|
|
1861
|
+
* eventually settles, but must never throw out of that cleanup in a way
|
|
1862
|
+
* that becomes an unhandled rejection.
|
|
1863
|
+
*
|
|
1864
|
+
* The returned result (and anything it internally logs) must never
|
|
1865
|
+
* include raw SDK/driver error text, stack traces, endpoints, or
|
|
1866
|
+
* credential material — only the closed `reason` enum. See
|
|
1867
|
+
* `PluginConfigVerificationResult`.
|
|
1868
|
+
*/
|
|
1869
|
+
verifyConfig?: (snapshot: PluginConfigVerificationSnapshot, options: PluginConfigVerificationOptions) => Promise<PluginConfigVerificationResult>;
|
|
1742
1870
|
}
|
|
1743
1871
|
|
|
1744
1872
|
/**
|
|
@@ -1930,4 +2058,4 @@ type SanitizeSvgResult = {
|
|
|
1930
2058
|
*/
|
|
1931
2059
|
declare function sanitizeSvg(input: string, policy: SanitizeSvgPolicy): SanitizeSvgResult;
|
|
1932
2060
|
|
|
1933
|
-
export { ACTION_FIELD_MARKER, type AdmissionControlConfig, type AppInfo, type AuthContext, type AuthDriver, type AuthDriverKind, type AuthProfile, type AuthRegistry, type AuthVerifyResult, type CacheEntry, type CacheKey, type CacheStorage, type CodeBlockInfo, type CodeBlockRenderer, type CreateOAuth2DriverOptions, type CreateOidcDriverOptions, type CredentialAuthDriver, type CredentialField, type CrowiPlugin, type EmailMessage, type EmbedFragment, type EmbedInput, type EmbedRenderer, type EventBus, type InlineExpansion, type MailSender, type MailSenderRegistry, type NodeRenderer, type NotificationPayload, type NotifierDriver, type NotifierRegistry, type OAuth2AuthDriver, type OAuthClientConfig, type OAuthTokens, type OidcAuthDriver, type PageMetadataAccessor, type PluginConfigAtomicGroup, type PluginContext, type PluginEvents, type PluginLogger, type PluginReadinessDeclaration, type PluginRouteHandler, type PluginRouteMethod, type PluginRouteOptions, type PluginRouterScope, type RenderActor, type RenderContext, type RenderError, type RenderPhase, type RenderResult, type RendererRegistry, type Reservation, SENSITIVE_FIELD_MARKER, type SanitizeSvgPolicy, type SanitizeSvgResult, type ScopedCacheStorage, type SearchDriver, type SearchHit, type SearchHits, type SearchPageType, type SearchQuery, type SearchQueryGrants, type SearchQueryViewer, type SearchRegistry, type SearchableDoc, type StateCell, type StorageDriver, type StoragePutMeta, type StoragePutResult, type StorageRegistry, type StructuredRenderPayload, type UrlInlineExpansionRule, createOAuth2Driver, createOidcDriver, escapeHtml, extractSvgDimensions, getActionAnnotation, isSensitiveField, sanitizeSvg };
|
|
2061
|
+
export { ACTION_FIELD_MARKER, type AdmissionControlConfig, type AppInfo, type AuthContext, type AuthDriver, type AuthDriverKind, type AuthProfile, type AuthRegistry, type AuthVerifyResult, CONFIG_VERIFICATION_KEY_PREFIX, type CacheEntry, type CacheKey, type CacheStorage, type CodeBlockInfo, type CodeBlockRenderer, type CreateOAuth2DriverOptions, type CreateOidcDriverOptions, type CredentialAuthDriver, type CredentialField, type CrowiPlugin, type EmailMessage, type EmbedFragment, type EmbedInput, type EmbedRenderer, type EventBus, type InlineExpansion, type MailSender, type MailSenderRegistry, type NodeRenderer, type NotificationPayload, type NotifierDriver, type NotifierRegistry, type OAuth2AuthDriver, type OAuthClientConfig, type OAuthTokens, type OidcAuthDriver, type PageMetadataAccessor, type PluginConfigAtomicGroup, type PluginConfigVerificationOptions, type PluginConfigVerificationResult, type PluginConfigVerificationSnapshot, type PluginContext, type PluginEvents, type PluginLogger, type PluginReadinessDeclaration, type PluginRouteHandler, type PluginRouteMethod, type PluginRouteOptions, type PluginRouterScope, type ReadonlyDeep, type RenderActor, type RenderContext, type RenderError, type RenderPhase, type RenderResult, type RendererRegistry, type Reservation, SENSITIVE_FIELD_MARKER, type SanitizeSvgPolicy, type SanitizeSvgResult, type ScopedCacheStorage, type SearchDriver, type SearchHit, type SearchHits, type SearchPageType, type SearchQuery, type SearchQueryGrants, type SearchQueryViewer, type SearchRegistry, type SearchableDoc, type StateCell, type StorageDriver, type StoragePutMeta, type StoragePutResult, type StorageRegistry, type StructuredRenderPayload, type UrlInlineExpansionRule, type VerificationFailureReason, createOAuth2Driver, createOidcDriver, escapeHtml, extractSvgDimensions, getActionAnnotation, isSensitiveField, sanitizeSvg };
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
ACTION_FIELD_MARKER: () => ACTION_FIELD_MARKER,
|
|
34
|
+
CONFIG_VERIFICATION_KEY_PREFIX: () => CONFIG_VERIFICATION_KEY_PREFIX,
|
|
34
35
|
SENSITIVE_FIELD_MARKER: () => SENSITIVE_FIELD_MARKER,
|
|
35
36
|
createOAuth2Driver: () => createOAuth2Driver,
|
|
36
37
|
createOidcDriver: () => createOidcDriver,
|
|
@@ -42,6 +43,9 @@ __export(index_exports, {
|
|
|
42
43
|
});
|
|
43
44
|
module.exports = __toCommonJS(index_exports);
|
|
44
45
|
|
|
46
|
+
// src/config-verification.ts
|
|
47
|
+
var CONFIG_VERIFICATION_KEY_PREFIX = "__crowi_config_verification__/";
|
|
48
|
+
|
|
45
49
|
// src/html.ts
|
|
46
50
|
function escapeHtml(s) {
|
|
47
51
|
return s.replace(/[&<>"']/g, (c) => {
|
|
@@ -395,6 +399,7 @@ function cssUnescape(css) {
|
|
|
395
399
|
// Annotate the CommonJS export names for ESM import in node:
|
|
396
400
|
0 && (module.exports = {
|
|
397
401
|
ACTION_FIELD_MARKER,
|
|
402
|
+
CONFIG_VERIFICATION_KEY_PREFIX,
|
|
398
403
|
SENSITIVE_FIELD_MARKER,
|
|
399
404
|
createOAuth2Driver,
|
|
400
405
|
createOidcDriver,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/html.ts","../src/registries/auth.ts","../src/schema-markers.ts","../../svg-sanitize/src/dimensions.ts","../../svg-sanitize/src/sanitize.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/config-verification.ts","../src/html.ts","../src/registries/auth.ts","../src/schema-markers.ts","../../svg-sanitize/src/dimensions.ts","../../svg-sanitize/src/sanitize.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiGO,IAAM,iCAAiC;;;ACpFvC,SAAS,WAAW,GAAmB;AAC5C,SAAO,EAAE,QAAQ,YAAY,CAAC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AC5B,MAAI,MAAM,WAAW,GAAG,EAAG,QAAO;AAClC,MAAI,gBAAgB,KAAK,KAAK,EAAG,QAAO;AACxC,MAAI,UAAU,KAAK,KAAK,EAAG,QAAO;AAClC,MAAI,MAAM,WAAW,IAAI,EAAG,QAAO;AACnC,MAAI,OAAO,iBAAiB,eAAe,KAAK,KAAK,EAAG,QAAO;AAC/D,SAAO;AACT;AA6CA,SAAS,kBAAkB,KAAqB;AAM9C,QAAM,kBAAkB,IAAI,QAAQ,qBAAqB,GAAG;AAC5D,MAAI,MAAM,YAAY,eAAe;AACrC,QAAM,IAAI,QAAQ,sBAAsB,EAAE;AAC1C,QAAM,IAAI,QAAQ,kBAAkB,CAAC,OAAO,QAAQ,WAAY,OAAO,KAAK,EAAE,WAAW,GAAG,IAAI,QAAQ,MAAO;AAC/G,SAAO;AACT;AAaA,SAAS,YAAY,KAAqB;AACxC,SAAO,IAAI,QAAQ,uDAAuD,CAAC,QAAQ,KAAyB,YAAgC;AAC1I,QAAI,QAAQ,QAAW;AACrB,YAAM,YAAY,OAAO,SAAS,KAAK,EAAE;AACzC,UAAI,cAAc,KAAK,YAAY,WAAa,aAAa,SAAU,aAAa,MAAS,QAAO;AACpG,aAAO,OAAO,cAAc,SAAS;IACvC;AACA,QAAI,YAAY,OAAW,QAAO;AAClC,WAAO;EACT,CAAC;AACH;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// src/config-verification.ts
|
|
2
|
+
var CONFIG_VERIFICATION_KEY_PREFIX = "__crowi_config_verification__/";
|
|
3
|
+
|
|
1
4
|
// src/html.ts
|
|
2
5
|
function escapeHtml(s) {
|
|
3
6
|
return s.replace(/[&<>"']/g, (c) => {
|
|
@@ -350,6 +353,7 @@ function cssUnescape(css) {
|
|
|
350
353
|
}
|
|
351
354
|
export {
|
|
352
355
|
ACTION_FIELD_MARKER,
|
|
356
|
+
CONFIG_VERIFICATION_KEY_PREFIX,
|
|
353
357
|
SENSITIVE_FIELD_MARKER,
|
|
354
358
|
createOAuth2Driver,
|
|
355
359
|
createOidcDriver,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/html.ts","../src/registries/auth.ts","../src/schema-markers.ts","../../svg-sanitize/src/dimensions.ts","../../svg-sanitize/src/sanitize.ts"],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../src/config-verification.ts","../src/html.ts","../src/registries/auth.ts","../src/schema-markers.ts","../../svg-sanitize/src/dimensions.ts","../../svg-sanitize/src/sanitize.ts"],"mappings":";AAiGO,IAAM,iCAAiC;;;ACpFvC,SAAS,WAAW,GAAmB;AAC5C,SAAO,EAAE,QAAQ,YAAY,CAAC,MAAM;AAClC,YAAQ,GAAG;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IACX;AAAA,EACF,CAAC;AACH;;;AC9BA,SAAS,kBAAkB;AA2K3B,SAAS,qBAAqB,OAAe,OAAe,SAAuB;AACjF,MAAI,MAAM,KAAK,MAAM,IAAI;AACvB,UAAM,IAAI,UAAU,GAAG,OAAO,MAAM,KAAK,+BAA+B;AAAA,EAC1E;AACF;AAEA,SAAS,eAAe,OAAe,OAAe,SAAuB;AAC3E,MAAI;AACF,QAAI,IAAI,KAAK;AAAA,EACf,QAAQ;AACN,UAAM,IAAI,UAAU,GAAG,OAAO,MAAM,KAAK,+BAA+B,KAAK,IAAI;AAAA,EACnF;AACF;AAEA,SAAS,qBAAqB,QAAkB,SAAuB;AACrE,aAAW,SAAS,QAAQ;AAC1B,yBAAqB,OAAO,YAAY,OAAO;AAAA,EACjD;AACF;AAkBO,SAAS,mBAAmB,SAAsD;AACvF,QAAM,UAAU;AAChB,uBAAqB,QAAQ,aAAa,eAAe,OAAO;AAChE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,cAAc,SAAS;IACvC;AACA,QAAI,YAAY,OAAW,QAAO;AAClC,WAAO;EACT,CAAC;AACH;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crowi/plugin-api",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.9",
|
|
4
4
|
"description": "Type-only contract for Crowi 2.0 plugins. See docs/rfcs/0001-plugin-architecture.md.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"zod": "^4"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/jest": "^
|
|
32
|
+
"@types/jest": "^30.0.0",
|
|
33
33
|
"@types/node": "^24",
|
|
34
34
|
"hono": "^4.12.34",
|
|
35
|
-
"jest": "^
|
|
36
|
-
"ts-jest": "^29.
|
|
35
|
+
"jest": "^30.5.0",
|
|
36
|
+
"ts-jest": "^29.4.12",
|
|
37
37
|
"tsup": "^8.3.5",
|
|
38
|
-
"typescript": "^
|
|
38
|
+
"typescript": "^6.0.3",
|
|
39
39
|
"zod": "^4.4.3",
|
|
40
40
|
"@crowi/svg-sanitize": "0.1.0-alpha.1",
|
|
41
41
|
"@crowi/tsconfig": "0.1.0-alpha.0"
|