@crowi/plugin-api 1.0.0-alpha.5 → 1.0.0-alpha.6

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.mts CHANGED
@@ -1323,6 +1323,32 @@ interface PluginRouterScope {
1323
1323
  route(method: PluginRouteMethod, path: string, handler: PluginRouteHandler, opts?: PluginRouteOptions): void;
1324
1324
  }
1325
1325
 
1326
+ /**
1327
+ * Declares that, when a specific driver from a specific registry is
1328
+ * selected (`crowi.config.json:<registry>.driver === driver`), this
1329
+ * plugin's own config becomes required to actually work at runtime —
1330
+ * even though the `configSchema` field itself is optional / defaults to
1331
+ * `''` so `configSchema.parse()` alone can't detect "present but
1332
+ * unusable" (see `@crowi/plugin-storage-aws-s3`'s `bucket` and
1333
+ * `@crowi/plugin-search-elasticsearch` / `@crowi/plugin-search-opensearch`'s
1334
+ * `url`, both `z.string().default('')`).
1335
+ *
1336
+ * This is metadata only — it never carries an actual config value.
1337
+ * `registry` / `driver` / every name in `requiredConfigFields` must be
1338
+ * non-empty. The runtime (`PluginManager.getReadinessIssues()`) reads
1339
+ * this once per admin readiness check, cross-references it against the
1340
+ * currently selected driver and the plugin's current config namespace,
1341
+ * and reports which declared fields are still empty — never the values
1342
+ * themselves. See RFC-none / feature-plugin-config-readiness.
1343
+ */
1344
+ interface PluginReadinessDeclaration {
1345
+ /** Which driver registry this declaration is scoped to. */
1346
+ registry: 'storage' | 'search' | 'mail';
1347
+ /** The driver name (as registered via `registry.register(name, …)`) this declaration applies to. */
1348
+ driver: string;
1349
+ /** `configSchema` field names that must be non-empty for `driver` to actually work once selected. */
1350
+ requiredConfigFields: string[];
1351
+ }
1326
1352
  /**
1327
1353
  * The contract every Crowi plugin satisfies. Plugins export their
1328
1354
  * `CrowiPlugin` object as the package's default export; the runtime
@@ -1457,6 +1483,14 @@ interface CrowiPlugin {
1457
1483
  label?: string;
1458
1484
  description?: string;
1459
1485
  }>>;
1486
+ /**
1487
+ * Declares which of this plugin's own `configSchema` fields must be
1488
+ * non-empty for a specific driver selection to actually work at
1489
+ * runtime (see {@link PluginReadinessDeclaration}). Optional — a
1490
+ * plugin with no readiness declaration is never surfaced by the
1491
+ * admin readiness check, same as before this field existed.
1492
+ */
1493
+ readiness?: PluginReadinessDeclaration;
1460
1494
  /** Storage driver registration. Called once at boot. */
1461
1495
  registerStorage?: (registry: StorageRegistry, ctx: PluginContext) => void;
1462
1496
  /** Search backend registration. Called once at boot. */
@@ -1729,4 +1763,4 @@ type SanitizeSvgResult = {
1729
1763
  */
1730
1764
  declare function sanitizeSvg(input: string, policy: SanitizeSvgPolicy): SanitizeSvgResult;
1731
1765
 
1732
- export { ACTION_FIELD_MARKER, type AdmissionControlConfig, type AppInfo, type AuthContext, type AuthDriver, type AuthProfile, type AuthRegistry, type AuthVerifyResult, type CacheEntry, type CacheKey, type CacheStorage, type CodeBlockInfo, type CodeBlockRenderer, 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 PageMetadataAccessor, type PluginContext, type PluginEvents, type PluginLogger, 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, escapeHtml, extractSvgDimensions, getActionAnnotation, isSensitiveField, sanitizeSvg };
1766
+ export { ACTION_FIELD_MARKER, type AdmissionControlConfig, type AppInfo, type AuthContext, type AuthDriver, type AuthProfile, type AuthRegistry, type AuthVerifyResult, type CacheEntry, type CacheKey, type CacheStorage, type CodeBlockInfo, type CodeBlockRenderer, 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 PageMetadataAccessor, 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, escapeHtml, extractSvgDimensions, getActionAnnotation, isSensitiveField, sanitizeSvg };
package/dist/index.d.ts CHANGED
@@ -1323,6 +1323,32 @@ interface PluginRouterScope {
1323
1323
  route(method: PluginRouteMethod, path: string, handler: PluginRouteHandler, opts?: PluginRouteOptions): void;
1324
1324
  }
1325
1325
 
1326
+ /**
1327
+ * Declares that, when a specific driver from a specific registry is
1328
+ * selected (`crowi.config.json:<registry>.driver === driver`), this
1329
+ * plugin's own config becomes required to actually work at runtime —
1330
+ * even though the `configSchema` field itself is optional / defaults to
1331
+ * `''` so `configSchema.parse()` alone can't detect "present but
1332
+ * unusable" (see `@crowi/plugin-storage-aws-s3`'s `bucket` and
1333
+ * `@crowi/plugin-search-elasticsearch` / `@crowi/plugin-search-opensearch`'s
1334
+ * `url`, both `z.string().default('')`).
1335
+ *
1336
+ * This is metadata only — it never carries an actual config value.
1337
+ * `registry` / `driver` / every name in `requiredConfigFields` must be
1338
+ * non-empty. The runtime (`PluginManager.getReadinessIssues()`) reads
1339
+ * this once per admin readiness check, cross-references it against the
1340
+ * currently selected driver and the plugin's current config namespace,
1341
+ * and reports which declared fields are still empty — never the values
1342
+ * themselves. See RFC-none / feature-plugin-config-readiness.
1343
+ */
1344
+ interface PluginReadinessDeclaration {
1345
+ /** Which driver registry this declaration is scoped to. */
1346
+ registry: 'storage' | 'search' | 'mail';
1347
+ /** The driver name (as registered via `registry.register(name, …)`) this declaration applies to. */
1348
+ driver: string;
1349
+ /** `configSchema` field names that must be non-empty for `driver` to actually work once selected. */
1350
+ requiredConfigFields: string[];
1351
+ }
1326
1352
  /**
1327
1353
  * The contract every Crowi plugin satisfies. Plugins export their
1328
1354
  * `CrowiPlugin` object as the package's default export; the runtime
@@ -1457,6 +1483,14 @@ interface CrowiPlugin {
1457
1483
  label?: string;
1458
1484
  description?: string;
1459
1485
  }>>;
1486
+ /**
1487
+ * Declares which of this plugin's own `configSchema` fields must be
1488
+ * non-empty for a specific driver selection to actually work at
1489
+ * runtime (see {@link PluginReadinessDeclaration}). Optional — a
1490
+ * plugin with no readiness declaration is never surfaced by the
1491
+ * admin readiness check, same as before this field existed.
1492
+ */
1493
+ readiness?: PluginReadinessDeclaration;
1460
1494
  /** Storage driver registration. Called once at boot. */
1461
1495
  registerStorage?: (registry: StorageRegistry, ctx: PluginContext) => void;
1462
1496
  /** Search backend registration. Called once at boot. */
@@ -1729,4 +1763,4 @@ type SanitizeSvgResult = {
1729
1763
  */
1730
1764
  declare function sanitizeSvg(input: string, policy: SanitizeSvgPolicy): SanitizeSvgResult;
1731
1765
 
1732
- export { ACTION_FIELD_MARKER, type AdmissionControlConfig, type AppInfo, type AuthContext, type AuthDriver, type AuthProfile, type AuthRegistry, type AuthVerifyResult, type CacheEntry, type CacheKey, type CacheStorage, type CodeBlockInfo, type CodeBlockRenderer, 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 PageMetadataAccessor, type PluginContext, type PluginEvents, type PluginLogger, 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, escapeHtml, extractSvgDimensions, getActionAnnotation, isSensitiveField, sanitizeSvg };
1766
+ export { ACTION_FIELD_MARKER, type AdmissionControlConfig, type AppInfo, type AuthContext, type AuthDriver, type AuthProfile, type AuthRegistry, type AuthVerifyResult, type CacheEntry, type CacheKey, type CacheStorage, type CodeBlockInfo, type CodeBlockRenderer, 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 PageMetadataAccessor, 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, escapeHtml, extractSvgDimensions, getActionAnnotation, isSensitiveField, sanitizeSvg };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowi/plugin-api",
3
- "version": "1.0.0-alpha.5",
3
+ "version": "1.0.0-alpha.6",
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",
@@ -25,13 +25,13 @@
25
25
  "access": "public"
26
26
  },
27
27
  "peerDependencies": {
28
- "hono": "^4.12.25",
28
+ "hono": "^4.12.34",
29
29
  "zod": "^4"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/jest": "^29.5.14",
33
33
  "@types/node": "^24",
34
- "hono": "^4.12.31",
34
+ "hono": "^4.12.34",
35
35
  "jest": "^29.7.0",
36
36
  "ts-jest": "^29.3.4",
37
37
  "tsup": "^8.3.5",