@pipeline-builder/pipeline-data 4.1.18 → 4.1.19

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.
@@ -1,3 +1,37 @@
1
+ /**
2
+ * Resolving a plugin reference to an ecosystem LISTING version through the
3
+ * org's install (docs/plugin-installing.md).
4
+ *
5
+ * One implementation shared by every place that answers "which listed version
6
+ * does this org's reference run?": the plugin service's `/plugins/lookup` (what
7
+ * synth pins), the pipeline service's contract check at pipeline create, the AI
8
+ * generator's plugin list and the placeholder guard. The decisions are PURE
9
+ * functions over loaded rows; the rows come through a {@link ListingDataSource}
10
+ * so each service can load them its own way ({@link drizzleListingSource} is the
11
+ * plain drizzle one).
12
+ *
13
+ * The model:
14
+ * - An org resolves a listing only through an INSTALL: an explicit
15
+ * `plugin_installs` row (its own, or — for a team — its root org's), or
16
+ * for the Official publisher the IMPLICIT install every org has unless its
17
+ * consumption policy says `officialInstalls: explicit`. An explicit
18
+ * install overrides the implicit one.
19
+ * - The org's CONSUMPTION POLICY is applied at every resolution: allowed
20
+ * tiers, blocked listings, advisory blocking; secrets are withheld from tiers
21
+ * the policy doesn't trust with them. A team's policy is merged with its root
22
+ * org's and can only be stricter.
23
+ * - Version choice: the install's range (pinned / `~` / `^` / non-breaking
24
+ * latest; implicit = the lowest live major), narrowed by the reference's own
25
+ * version spec. Yanked versions never resolve for a listing; a paused
26
+ * version is skipped unless the install already resolved to it or the
27
+ * reference pins it exactly; advisory-blocked versions are skipped.
28
+ * - Scan flags: a version the nightly rescan FLAGGED (fixable Criticals
29
+ * over `PLUGIN_VULN_MAX_CRITICAL`) resolves with a `VULN_FLAGGED` warning —
30
+ * or, with `PLUGIN_BLOCK_ON_NEW_CRITICAL` on, is skipped like an
31
+ * advisory-blocked one, and an exact pin to it is refused
32
+ * `PLUGIN_VERSION_VULN_BLOCKED`.
33
+ */
34
+ import { type VulnFlaggedWarning } from '@pipeline-builder/api-core';
1
35
  import type { CrudTx } from './crud-service.js';
2
36
  import { type AdvisorySeverity, type BlockedListingRef, type BlockOnAdvisory, type OfficialInstalls, type PluginAdvisory, type PluginInstall, type PluginInstallPolicy, type PluginListing, type PluginListingVersion, type Publisher, type PublisherTier } from '../database/drizzle-schema.js';
3
37
  /** An org's consumption policy, as the resolver applies it. */
@@ -36,16 +70,16 @@ export declare function effectiveConsumptionPolicy(rows: ReadonlyArray<Partial<P
36
70
  export declare function applyPolicyUpdate(base: ConsumptionPolicy, input: unknown): ConsumptionPolicy | string;
37
71
  /** Why a reference can't resolve; `code` is an api-core `ErrorCode` name. */
38
72
  export interface ResolutionRefusal {
39
- code: 'NOT_FOUND' | 'PLUGIN_NOT_INSTALLED' | 'PLUGIN_BLOCKED_BY_POLICY' | 'PLUGIN_UNAVAILABLE';
73
+ code: 'NOT_FOUND' | 'PLUGIN_NOT_INSTALLED' | 'PLUGIN_BLOCKED_BY_POLICY' | 'PLUGIN_UNAVAILABLE' | 'PLUGIN_VERSION_VULN_BLOCKED';
40
74
  reason: string;
41
75
  message: string;
42
76
  details?: Record<string, unknown>;
43
77
  }
44
- /** A non-fatal note a resolution carries (synth prints it). */
45
- export interface ResolutionWarning {
78
+ /** A non-fatal note a resolution carries (synth prints its `message`). */
79
+ export type ResolutionWarning = {
46
80
  code: 'PLUGIN_ADVISORY' | 'PLUGIN_DEPRECATED' | 'PLUGIN_SECRETS_WITHHELD' | 'LISTING_UNMAINTAINED';
47
81
  message: string;
48
- }
82
+ } | VulnFlaggedWarning;
49
83
  /** Why the org's policy (or the listing's state) keeps a listing out, or null. */
50
84
  export interface ListingBlock {
51
85
  reason: 'tier' | 'blocked_listing' | 'suspended';
@@ -102,6 +136,8 @@ export interface VersionChoiceInput<V extends PluginListingVersion = PluginListi
102
136
  requested?: string;
103
137
  advisories: readonly PluginAdvisory[];
104
138
  policy: ConsumptionPolicy;
139
+ /** Skip / refuse rescan-flagged versions (default: `PLUGIN_BLOCK_ON_NEW_CRITICAL`). */
140
+ blockFlagged?: boolean;
105
141
  }
106
142
  /**
107
143
  * Pick the listed version a reference resolves to (see the module doc), or
@@ -194,7 +230,7 @@ export declare function resolveListingReference(source: ListingDataSource, ref:
194
230
  export declare function listedVersionWarnings(input: {
195
231
  publisher: Pick<Publisher, 'handle' | 'tier'>;
196
232
  listing: Pick<PluginListing, 'name' | 'state'>;
197
- version: Pick<PluginListingVersion, 'version' | 'deprecatedAt' | 'deprecationMessage' | 'specSnapshot'>;
233
+ version: Pick<PluginListingVersion, 'version' | 'deprecatedAt' | 'deprecationMessage' | 'specSnapshot'> & Partial<Pick<PluginListingVersion, 'scanFlaggedAt' | 'scanFlag'>>;
198
234
  advisories: readonly Pick<PluginAdvisory, 'severity' | 'state' | 'affectedRange' | 'fixedVersion' | 'summary'>[];
199
235
  policy: Pick<ConsumptionPolicy, 'secretsAllowedTiers'>;
200
236
  }): {