@lesliechan721/aw-plugin-core 0.1.0-beta.5 → 0.1.0-beta.51

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.
Files changed (49) hide show
  1. package/dist/aw-capabilities.d.ts +27 -0
  2. package/dist/aw-capabilities.js +114 -0
  3. package/dist/aw-capabilities.js.map +1 -0
  4. package/dist/catalog-file-modes.d.ts +5 -0
  5. package/dist/catalog-file-modes.js +67 -0
  6. package/dist/catalog-file-modes.js.map +1 -0
  7. package/dist/catalog-workspace-resolution.d.ts +3 -0
  8. package/dist/catalog-workspace-resolution.js +34 -0
  9. package/dist/catalog-workspace-resolution.js.map +1 -0
  10. package/dist/generated/plugin-manifest-v3.d.ts +1350 -0
  11. package/dist/generated/{plugin-manifest-v1.js → plugin-manifest-v3.js} +1 -1
  12. package/dist/generated/plugin-manifest-v3.js.map +1 -0
  13. package/dist/index.d.ts +3 -2
  14. package/dist/index.js +2 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/manifest-contract.d.ts +3 -6
  17. package/dist/manifest-contract.js +224 -398
  18. package/dist/manifest-contract.js.map +1 -1
  19. package/dist/manifest-type-contract.d.ts +2 -2
  20. package/dist/manifest.d.ts +10 -8
  21. package/dist/manifest.js +16 -7
  22. package/dist/manifest.js.map +1 -1
  23. package/dist/plugin-authoring-capabilities.d.ts +1 -1
  24. package/dist/plugin-authoring-capabilities.js +60 -26
  25. package/dist/plugin-authoring-capabilities.js.map +1 -1
  26. package/dist/plugin-config.d.ts +39 -0
  27. package/dist/plugin-config.js +1320 -0
  28. package/dist/plugin-config.js.map +1 -0
  29. package/dist/plugin-requirements.d.ts +34 -0
  30. package/dist/plugin-requirements.js +289 -0
  31. package/dist/plugin-requirements.js.map +1 -0
  32. package/dist/plugin-script-contract.d.ts +11 -12
  33. package/dist/plugin-script-contract.js +44 -71
  34. package/dist/plugin-script-contract.js.map +1 -1
  35. package/dist/runtime-config.d.ts +38 -0
  36. package/dist/runtime-config.js +31 -0
  37. package/dist/runtime-config.js.map +1 -0
  38. package/dist/types.d.ts +249 -61
  39. package/dist/workspace.d.ts +37 -9
  40. package/dist/workspace.js +419 -191
  41. package/dist/workspace.js.map +1 -1
  42. package/package.json +13 -4
  43. package/schemas/plugin-manifest-v3.json +2122 -0
  44. package/dist/generated/plugin-manifest-v1.d.ts +0 -368
  45. package/dist/generated/plugin-manifest-v1.js.map +0 -1
  46. package/dist/plugin-release.d.ts +0 -30
  47. package/dist/plugin-release.js +0 -187
  48. package/dist/plugin-release.js.map +0 -1
  49. package/schemas/plugin-manifest-v1.json +0 -329
@@ -1,368 +0,0 @@
1
- /**
2
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
3
- * via the `definition` "semver".
4
- */
5
- export type Semver = string;
6
- /**
7
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
8
- * via the `definition` "pluginPath".
9
- */
10
- export type PluginPath = string;
11
- /**
12
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
13
- * via the `definition` "stringArray".
14
- */
15
- export type StringArray = string[];
16
- /**
17
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
18
- * via the `definition` "lifecycleDefinition".
19
- */
20
- export type LifecycleDefinition = (string | {
21
- default?: ScriptEntry;
22
- unix?: ScriptEntry;
23
- windows?: ScriptEntry;
24
- linux?: ScriptEntry;
25
- darwin?: ScriptEntry;
26
- win32?: ScriptEntry;
27
- });
28
- export interface PluginManifestSourceV1 {
29
- schemaVersion?: 1;
30
- name: string;
31
- version: Semver;
32
- description: string;
33
- /**
34
- * @maxItems 64
35
- */
36
- dependencies?: string[];
37
- compatibility?: Compatibility;
38
- skills?: PluginPath;
39
- slashCommands?: PluginPath;
40
- mcpServers?: PluginPath;
41
- apps?: PluginPath;
42
- distributions?: Distributions;
43
- marketplace: Marketplace;
44
- interface?: Interface;
45
- extensions?: Extensions;
46
- artifacts?: Artifacts;
47
- buildConfig?: BuildConfig;
48
- scripts?: Scripts;
49
- config?: Config;
50
- }
51
- /**
52
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
53
- * via the `definition` "compatibility".
54
- */
55
- export interface Compatibility {
56
- aw: {
57
- minVersion: Semver;
58
- };
59
- }
60
- /**
61
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
62
- * via the `definition` "distributions".
63
- */
64
- export interface Distributions {
65
- agentSkills?: {
66
- skills?: PluginPath;
67
- };
68
- }
69
- /**
70
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
71
- * via the `definition` "marketplace".
72
- */
73
- export interface Marketplace {
74
- category: string;
75
- tags?: string[];
76
- strict: boolean;
77
- policy: {
78
- installation: ("AVAILABLE" | "NOT_AVAILABLE" | "INSTALLED_BY_DEFAULT");
79
- authentication: ("ON_INSTALL" | "ON_USE");
80
- products?: string[];
81
- };
82
- }
83
- /**
84
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
85
- * via the `definition` "interface".
86
- */
87
- export interface Interface {
88
- displayName?: string;
89
- shortDescription?: string;
90
- capabilities?: string[];
91
- }
92
- /**
93
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
94
- * via the `definition` "extensions".
95
- */
96
- export interface Extensions {
97
- instructions?: Instruction[];
98
- permissions?: Permission[];
99
- hooks?: Hook[];
100
- nativeHooks?: {
101
- claude?: NativeHook[];
102
- codex?: NativeHook[];
103
- };
104
- agents?: Agent[];
105
- }
106
- /**
107
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
108
- * via the `definition` "instruction".
109
- */
110
- export interface Instruction {
111
- name: string;
112
- title: string;
113
- content: string;
114
- paths?: StringArray;
115
- agentOverrides?: PlatformOverrides;
116
- }
117
- /**
118
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
119
- * via the `definition` "platformOverrides".
120
- */
121
- export interface PlatformOverrides {
122
- claude?: ({
123
- [k: string]: unknown | undefined;
124
- } | null);
125
- codex?: ({
126
- [k: string]: unknown | undefined;
127
- } | null);
128
- }
129
- /**
130
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
131
- * via the `definition` "permission".
132
- */
133
- export interface Permission {
134
- name: string;
135
- allow?: StringArray;
136
- ask?: StringArray;
137
- deny?: StringArray;
138
- agentOverrides?: PlatformOverrides;
139
- }
140
- /**
141
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
142
- * via the `definition` "hook".
143
- */
144
- export interface Hook {
145
- event: string;
146
- matcher?: string;
147
- command: string;
148
- agentOverrides?: PlatformOverrides;
149
- }
150
- /**
151
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
152
- * via the `definition` "nativeHook".
153
- */
154
- export interface NativeHook {
155
- event: string;
156
- matcher?: string;
157
- command: string;
158
- }
159
- /**
160
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
161
- * via the `definition` "agent".
162
- */
163
- export interface Agent {
164
- name: string;
165
- description: string;
166
- prompt: string;
167
- tools?: StringArray;
168
- agentOverrides?: PlatformOverrides;
169
- }
170
- /**
171
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
172
- * via the `definition` "artifacts".
173
- */
174
- export interface Artifacts {
175
- targets?: ArtifactTarget[];
176
- }
177
- /**
178
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
179
- * via the `definition` "artifactTarget".
180
- */
181
- export interface ArtifactTarget {
182
- id: string;
183
- platform?: ("codex" | "claude");
184
- distribution?: "agent-skills";
185
- scopes: ("user" | "project")[];
186
- target: ("codex.developerInstructionsBlock" | "codex.agentRole" | "codex.skill" | "claude.skill" | "agent-skills.skill");
187
- kind?: ("instruction" | "codexRole" | "skill");
188
- projectManagedKind?: ("skill" | "mcpServer" | "instruction" | "permission" | "hook" | "agent");
189
- states: ("present" | "disabled")[];
190
- refreshKeys: StringArray;
191
- requiresCodexProjectConfig?: boolean;
192
- roleKey?: string;
193
- skillKey?: string;
194
- sourceDirs?: StringArray;
195
- runtimeImports?: {
196
- name: string;
197
- plugin: string;
198
- export: string;
199
- resolved?: {
200
- path: string;
201
- digest: string;
202
- providerPluginId: string;
203
- providerVersion: Semver;
204
- source: string;
205
- };
206
- }[];
207
- }
208
- /**
209
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
210
- * via the `definition` "buildConfig".
211
- */
212
- export interface BuildConfig {
213
- cacheable?: true;
214
- templates?: {
215
- vars: {
216
- [k: string]: PlatformTemplateValue | undefined;
217
- };
218
- include: StringArray;
219
- };
220
- fileRules?: {
221
- claude?: FileRules;
222
- codex?: FileRules;
223
- };
224
- manifestOverrides?: {
225
- claude?: {
226
- commands?: string;
227
- outputStyles?: string;
228
- lspServers?: unknown;
229
- userConfig?: unknown;
230
- channels?: unknown;
231
- };
232
- codex?: {
233
- [k: string]: unknown | undefined;
234
- };
235
- };
236
- runtimeExports?: {
237
- name: string;
238
- source: string;
239
- }[];
240
- buildImports?: {
241
- plugin: string;
242
- export: string;
243
- env: string;
244
- }[];
245
- skillRuntimeFiles?: {
246
- skill: string;
247
- target: string;
248
- platforms?: ("codex" | "claude")[];
249
- distributions?: ("agent-skills")[];
250
- source?: string;
251
- import?: ImportReference;
252
- }[];
253
- generatedSkillRuntimeFiles?: {
254
- skill: string;
255
- target: string;
256
- distributions?: ("agent-skills")[];
257
- }[];
258
- }
259
- /**
260
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
261
- * via the `definition` "platformTemplateValue".
262
- */
263
- export interface PlatformTemplateValue {
264
- claude: (string | boolean);
265
- codex: (string | boolean);
266
- }
267
- /**
268
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
269
- * via the `definition` "fileRules".
270
- */
271
- export interface FileRules {
272
- include: StringArray;
273
- exclude: StringArray;
274
- }
275
- /**
276
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
277
- * via the `definition` "importReference".
278
- */
279
- export interface ImportReference {
280
- plugin: string;
281
- export: string;
282
- }
283
- /**
284
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
285
- * via the `definition` "scripts".
286
- */
287
- export interface Scripts {
288
- timeoutMs?: number;
289
- lifecycle?: {
290
- install?: LifecycleDefinition;
291
- upgrade?: LifecycleDefinition;
292
- uninstall?: LifecycleDefinition;
293
- };
294
- helpers?: {
295
- config: string;
296
- };
297
- node?: {
298
- packageRoot?: string;
299
- build?: ScriptEntry;
300
- };
301
- artifacts?: {
302
- render?: ScriptEntry;
303
- };
304
- tests?: {
305
- node?: StringArray;
306
- };
307
- }
308
- /**
309
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
310
- * via the `definition` "scriptEntry".
311
- */
312
- export interface ScriptEntry {
313
- runner: ("node" | "sh" | "bash" | "pwsh" | "powershell" | "cmd" | "auto");
314
- path: string;
315
- args?: StringArray;
316
- }
317
- /**
318
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
319
- * via the `definition` "config".
320
- */
321
- export interface Config {
322
- schema: {
323
- [k: string]: ConfigField | undefined;
324
- };
325
- presentation?: {
326
- groups?: {
327
- id: string;
328
- title: string;
329
- description?: string;
330
- fields: StringArray;
331
- advanced?: boolean;
332
- }[];
333
- fields?: {
334
- [k: string]: {
335
- valueLabels?: {
336
- [k: string]: string | undefined;
337
- };
338
- recommendedValue?: (string | number | boolean);
339
- placeholder?: string;
340
- unit?: string;
341
- advanced?: boolean;
342
- } | undefined;
343
- };
344
- presets?: {
345
- id: string;
346
- title: string;
347
- description?: string;
348
- values: {
349
- [k: string]: (string | number | boolean) | undefined;
350
- };
351
- }[];
352
- };
353
- }
354
- /**
355
- * This interface was referenced by `PluginManifestSourceV1`'s JSON-Schema
356
- * via the `definition` "configField".
357
- */
358
- export interface ConfigField {
359
- type: ("string" | "number" | "boolean" | "enum" | "file" | "directory");
360
- title?: string;
361
- description?: string;
362
- default?: (string | number | boolean);
363
- required?: boolean;
364
- sensitive?: boolean;
365
- values?: StringArray;
366
- min?: number;
367
- max?: number;
368
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin-manifest-v1.js","sourceRoot":"","sources":["../../src/generated/plugin-manifest-v1.ts"],"names":[],"mappings":"AAAA,uFAAuF"}
@@ -1,30 +0,0 @@
1
- import type { CatalogChannel, CatalogManifestV4, PluginMeta } from './types.js';
2
- export declare const PLUGIN_RELEASE_LEDGER_FILENAME = "plugin-release-ledger.json";
3
- export declare const PLUGIN_RELEASE_LEDGER_SCHEMA_VERSION = 2;
4
- export interface PluginReleaseLedgerRecord {
5
- plugin: string;
6
- version: string;
7
- contentDigest: string | null;
8
- artifactDigest: string;
9
- manifestDigest: string;
10
- channel: CatalogChannel;
11
- catalogVersion: string;
12
- }
13
- export interface PluginReleaseLedger {
14
- schemaVersion: 2;
15
- records: PluginReleaseLedgerRecord[];
16
- }
17
- export declare function assertStablePluginVersion(version: string, fieldName?: string): string;
18
- export declare function validatePluginReleaseLedger(rawValue: unknown): PluginReleaseLedger;
19
- export declare function validatePluginReleaseLedgerAgainstManifest(rawLedger: unknown, manifest: CatalogManifestV4): PluginReleaseLedger;
20
- export declare function mergePluginReleaseLedgers(...ledgers: Array<PluginReleaseLedger | null | undefined>): PluginReleaseLedger;
21
- export declare function resolveBetaPluginVersionOverrides(options: {
22
- plugins: readonly PluginMeta[];
23
- contentDigests: ReadonlyMap<string, string>;
24
- ledger: PluginReleaseLedger;
25
- }): Record<string, string>;
26
- export declare function appendCatalogToPluginReleaseLedger(options: {
27
- previous: PluginReleaseLedger;
28
- manifest: CatalogManifestV4;
29
- contentDigests: ReadonlyMap<string, string>;
30
- }): PluginReleaseLedger;
@@ -1,187 +0,0 @@
1
- import { assertStrictSemVer, compareStrictSemVer, parseStrictSemVer, } from './manifest-contract.js';
2
- export const PLUGIN_RELEASE_LEDGER_FILENAME = 'plugin-release-ledger.json';
3
- export const PLUGIN_RELEASE_LEDGER_SCHEMA_VERSION = 2;
4
- const PLUGIN_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;
5
- const SHA256_DIGEST_PATTERN = /^sha256:[0-9a-f]{64}$/u;
6
- function assertPlainObject(value, fieldName) {
7
- if (!value || typeof value !== 'object' || Array.isArray(value)) {
8
- throw new Error(`Invalid ${fieldName}: expected a JSON object.`);
9
- }
10
- return value;
11
- }
12
- function assertAllowedKeys(value, fieldName, allowedKeys) {
13
- const allowed = new Set(allowedKeys);
14
- for (const key of Object.keys(value)) {
15
- if (!allowed.has(key))
16
- throw new Error(`Invalid ${fieldName}: unknown field ${JSON.stringify(key)}.`);
17
- }
18
- }
19
- function assertPluginName(value, fieldName) {
20
- if (typeof value !== 'string' || !PLUGIN_NAME_PATTERN.test(value)) {
21
- throw new Error(`Invalid ${fieldName}: expected lowercase hyphen-case.`);
22
- }
23
- return value;
24
- }
25
- function assertDigest(value, fieldName) {
26
- if (typeof value !== 'string' || !SHA256_DIGEST_PATTERN.test(value)) {
27
- throw new Error(`Invalid ${fieldName}: expected a canonical sha256 digest.`);
28
- }
29
- return value;
30
- }
31
- export function assertStablePluginVersion(version, fieldName = 'plugin version') {
32
- const parsed = parseStrictSemVer(version, fieldName);
33
- if (parsed.prerelease.length > 0 || parsed.build.length > 0) {
34
- throw new Error(`Invalid ${fieldName}: expected a stable SemVer without prerelease or build metadata.`);
35
- }
36
- return version;
37
- }
38
- function identityKey(record) {
39
- return `${record.plugin}@${record.version}`;
40
- }
41
- function recordKey(record) {
42
- return JSON.stringify([record.channel, record.catalogVersion, record.plugin, record.version]);
43
- }
44
- function sameDigests(left, right) {
45
- return left.artifactDigest === right.artifactDigest
46
- && left.manifestDigest === right.manifestDigest
47
- && left.contentDigest === right.contentDigest;
48
- }
49
- function validateRecord(rawValue, index) {
50
- const raw = assertPlainObject(rawValue, `plugin release ledger.records[${index}]`);
51
- assertAllowedKeys(raw, `plugin release ledger.records[${index}]`, [
52
- 'plugin', 'version', 'contentDigest', 'artifactDigest', 'manifestDigest', 'channel', 'catalogVersion',
53
- ]);
54
- if (raw.channel !== 'latest' && raw.channel !== 'beta') {
55
- throw new Error(`Invalid plugin release ledger.records[${index}].channel.`);
56
- }
57
- return {
58
- plugin: assertPluginName(raw.plugin, `plugin release ledger.records[${index}].plugin`),
59
- version: assertStrictSemVer(raw.version, `plugin release ledger.records[${index}].version`),
60
- contentDigest: raw.contentDigest === null ? null : assertDigest(raw.contentDigest, `plugin release ledger.records[${index}].contentDigest`),
61
- artifactDigest: assertDigest(raw.artifactDigest, `plugin release ledger.records[${index}].artifactDigest`),
62
- manifestDigest: assertDigest(raw.manifestDigest, `plugin release ledger.records[${index}].manifestDigest`),
63
- channel: raw.channel,
64
- catalogVersion: assertStrictSemVer(raw.catalogVersion, `plugin release ledger.records[${index}].catalogVersion`),
65
- };
66
- }
67
- export function validatePluginReleaseLedger(rawValue) {
68
- const raw = assertPlainObject(rawValue, 'plugin release ledger');
69
- assertAllowedKeys(raw, 'plugin release ledger', ['schemaVersion', 'records']);
70
- if (raw.schemaVersion !== 2 || !Array.isArray(raw.records)) {
71
- throw new Error('Invalid plugin release ledger: expected schemaVersion 2 and records array.');
72
- }
73
- const byRecord = new Map();
74
- const byIdentity = new Map();
75
- for (const record of raw.records.map(validateRecord)) {
76
- const duplicate = byRecord.get(recordKey(record));
77
- if (duplicate) {
78
- if (!sameDigests(duplicate, record))
79
- throw new Error(`Plugin publication record for ${identityKey(record)} contains conflicting digests.`);
80
- continue;
81
- }
82
- const identity = byIdentity.get(identityKey(record));
83
- if (identity && !sameDigests(identity, record))
84
- throw new Error(`Plugin release identity ${identityKey(record)} maps to different digests.`);
85
- byRecord.set(recordKey(record), record);
86
- byIdentity.set(identityKey(record), record);
87
- }
88
- return {
89
- schemaVersion: 2,
90
- records: [...byRecord.values()].sort((left, right) => left.plugin.localeCompare(right.plugin)
91
- || compareStrictSemVer(left.version, right.version)
92
- || left.channel.localeCompare(right.channel)
93
- || compareStrictSemVer(left.catalogVersion, right.catalogVersion)),
94
- };
95
- }
96
- export function validatePluginReleaseLedgerAgainstManifest(rawLedger, manifest) {
97
- const ledger = validatePluginReleaseLedger(rawLedger);
98
- for (const entry of manifest.entries) {
99
- const records = ledger.records.filter((record) => record.plugin === entry.name
100
- && record.version === entry.version
101
- && record.channel === manifest.channel
102
- && record.catalogVersion === manifest.catalogVersion);
103
- if (records.length !== 1
104
- || records[0].artifactDigest !== entry.artifactDigest
105
- || records[0].manifestDigest !== entry.manifestDigest
106
- || records[0].contentDigest !== entry.contentDigest) {
107
- throw new Error(`Plugin release ledger does not match catalog entry ${entry.name}@${entry.version}.`);
108
- }
109
- }
110
- const current = ledger.records.filter((record) => record.channel === manifest.channel
111
- && record.catalogVersion === manifest.catalogVersion);
112
- if (current.length !== manifest.entries.length) {
113
- throw new Error('Plugin release ledger contains unexpected records for the current catalog.');
114
- }
115
- return ledger;
116
- }
117
- export function mergePluginReleaseLedgers(...ledgers) {
118
- return validatePluginReleaseLedger({
119
- schemaVersion: PLUGIN_RELEASE_LEDGER_SCHEMA_VERSION,
120
- records: ledgers.flatMap((ledger) => ledger?.records ?? []),
121
- });
122
- }
123
- export function resolveBetaPluginVersionOverrides(options) {
124
- const ledger = validatePluginReleaseLedger(options.ledger);
125
- const overrides = {};
126
- for (const plugin of options.plugins) {
127
- const name = plugin.manifest.name;
128
- const target = assertStablePluginVersion(plugin.manifest.version, `${name} source version`);
129
- const contentDigest = options.contentDigests.get(name);
130
- if (!contentDigest)
131
- throw new Error(`Missing release content digest for plugin ${JSON.stringify(name)}.`);
132
- const stable = ledger.records.find((record) => record.plugin === name && record.version === target);
133
- if (stable) {
134
- if (stable.contentDigest !== contentDigest) {
135
- throw new Error(`Plugin release identity ${name}@${target} maps to different content. Increase the source plugin version.`);
136
- }
137
- continue;
138
- }
139
- const prefix = `${target}-beta.`;
140
- const betas = ledger.records.filter((record) => record.plugin === name && record.version.startsWith(prefix)
141
- && /^\d+$/u.test(record.version.slice(prefix.length)));
142
- const highest = betas.reduce((value, record) => Math.max(value, Number(record.version.slice(prefix.length))), 0);
143
- const latest = betas.find((record) => Number(record.version.slice(prefix.length)) === highest);
144
- overrides[name] = latest?.contentDigest === contentDigest ? latest.version : `${prefix}${highest + 1}`;
145
- }
146
- return overrides;
147
- }
148
- export function appendCatalogToPluginReleaseLedger(options) {
149
- const previous = validatePluginReleaseLedger(options.previous);
150
- const records = [...previous.records];
151
- for (const entry of options.manifest.entries) {
152
- const contentDigest = options.contentDigests.get(entry.name);
153
- if (!contentDigest)
154
- throw new Error(`Missing release content digest for plugin ${JSON.stringify(entry.name)}.`);
155
- const candidate = {
156
- plugin: entry.name,
157
- version: entry.version,
158
- contentDigest,
159
- artifactDigest: entry.artifactDigest,
160
- manifestDigest: entry.manifestDigest,
161
- channel: options.manifest.channel,
162
- catalogVersion: options.manifest.catalogVersion,
163
- };
164
- const exact = records.find((record) => recordKey(record) === recordKey(candidate));
165
- const identity = records.find((record) => identityKey(record) === identityKey(candidate));
166
- const highest = records.filter((record) => record.plugin === candidate.plugin)
167
- .reduce((current, record) => !current
168
- || compareStrictSemVer(record.version, current.version) > 0 ? record : current, null);
169
- if (exact) {
170
- if (!sameDigests(exact, candidate))
171
- throw new Error(`Plugin publication record for ${identityKey(candidate)} contains conflicting digests.`);
172
- continue;
173
- }
174
- if (identity && !sameDigests(identity, candidate))
175
- throw new Error(`Plugin release identity ${identityKey(candidate)} maps to different digests.`);
176
- if (highest && (identity
177
- ? compareStrictSemVer(candidate.version, highest.version) < 0
178
- : compareStrictSemVer(candidate.version, highest.version) <= 0)) {
179
- throw new Error(identity
180
- ? `Plugin ${candidate.plugin} version ${candidate.version} must not be lower than published ${highest.version}.`
181
- : `Plugin ${candidate.plugin} version ${candidate.version} must be higher than published ${highest.version}.`);
182
- }
183
- records.push(candidate);
184
- }
185
- return validatePluginReleaseLedger({ schemaVersion: 2, records });
186
- }
187
- //# sourceMappingURL=plugin-release.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin-release.js","sourceRoot":"","sources":["../src/plugin-release.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,GACl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