@camunda8/cli 2.8.0-alpha.9 → 3.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/EXAMPLES.md +22 -5
- package/PLUGIN-HELP.md +26 -0
- package/README.md +37 -4
- package/dist/command-dispatch.d.ts.map +1 -1
- package/dist/command-dispatch.js +2 -1
- package/dist/command-dispatch.js.map +1 -1
- package/dist/command-registry.d.ts +30 -0
- package/dist/command-registry.d.ts.map +1 -1
- package/dist/command-registry.js +34 -1
- package/dist/command-registry.js.map +1 -1
- package/dist/commands/plugins.d.ts +21 -0
- package/dist/commands/plugins.d.ts.map +1 -1
- package/dist/commands/plugins.js +74 -1
- package/dist/commands/plugins.js.map +1 -1
- package/dist/commands/resource-extensions.d.ts +12 -0
- package/dist/commands/resource-extensions.d.ts.map +1 -1
- package/dist/commands/resource-extensions.js +13 -1
- package/dist/commands/resource-extensions.js.map +1 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +5 -3
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +21 -12
- package/dist/commands/watch.js.map +1 -1
- package/dist/completion.d.ts.map +1 -1
- package/dist/completion.js +140 -13
- package/dist/completion.js.map +1 -1
- package/dist/default-plugins/bpmn/README.md +69 -0
- package/dist/default-plugins/bpmn/c8ctl-plugin.js +125 -0
- package/dist/default-plugins/bpmn/c8ctl-plugin.js.map +1 -0
- package/dist/default-plugins/bpmn/lint.js +259 -0
- package/dist/default-plugins/bpmn/lint.js.map +1 -0
- package/dist/default-plugins/bpmn/package.json +8 -0
- package/dist/default-plugins/cluster/package.json +1 -1
- package/dist/default-plugins/element-template/AGENTS.md +65 -0
- package/dist/default-plugins/element-template/README.md +331 -0
- package/dist/default-plugins/element-template/c8ctl-plugin.js +247 -0
- package/dist/default-plugins/element-template/c8ctl-plugin.js.map +1 -0
- package/dist/default-plugins/element-template/commands/apply.js +298 -0
- package/dist/default-plugins/element-template/commands/apply.js.map +1 -0
- package/dist/default-plugins/element-template/commands/get-properties.js +344 -0
- package/dist/default-plugins/element-template/commands/get-properties.js.map +1 -0
- package/dist/default-plugins/element-template/commands/get.js +107 -0
- package/dist/default-plugins/element-template/commands/get.js.map +1 -0
- package/dist/default-plugins/element-template/commands/info.js +189 -0
- package/dist/default-plugins/element-template/commands/info.js.map +1 -0
- package/dist/default-plugins/element-template/commands/search.js +101 -0
- package/dist/default-plugins/element-template/commands/search.js.map +1 -0
- package/dist/default-plugins/element-template/commands/sync.js +36 -0
- package/dist/default-plugins/element-template/commands/sync.js.map +1 -0
- package/dist/default-plugins/element-template/docs/design.md +145 -0
- package/dist/default-plugins/element-template/helpers.js +404 -0
- package/dist/default-plugins/element-template/helpers.js.map +1 -0
- package/dist/default-plugins/element-template/marketplace.js +396 -0
- package/dist/default-plugins/element-template/marketplace.js.map +1 -0
- package/dist/default-plugins/element-template/package.json +8 -0
- package/dist/default-plugins/element-template/template-ref.js +232 -0
- package/dist/default-plugins/element-template/template-ref.js.map +1 -0
- package/dist/default-plugins/element-template/vendor-src/bundle-entry.js +44 -0
- package/dist/default-plugins/feel/README.md +163 -0
- package/dist/default-plugins/feel/c8ctl-plugin.js +616 -0
- package/dist/default-plugins/feel/c8ctl-plugin.js.map +1 -0
- package/dist/default-plugins/feel/package.json +8 -0
- package/dist/deployments.d.ts +1 -0
- package/dist/deployments.d.ts.map +1 -1
- package/dist/deployments.js +89 -20
- package/dist/deployments.js.map +1 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +156 -5
- package/dist/help.js.map +1 -1
- package/dist/ignore.d.ts +16 -1
- package/dist/ignore.d.ts.map +1 -1
- package/dist/ignore.js +55 -3
- package/dist/ignore.js.map +1 -1
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +294 -25
- package/dist/index.js.map +1 -1
- package/dist/plugin-loader.d.ts +168 -7
- package/dist/plugin-loader.d.ts.map +1 -1
- package/dist/plugin-loader.js +284 -21
- package/dist/plugin-loader.js.map +1 -1
- package/dist/runtime.d.ts +10 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +6 -0
- package/dist/runtime.js.map +1 -1
- package/dist/vendor/bpmn-element-templates.cjs +59639 -0
- package/package.json +20 -7
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marketplace OOTB element-template index.
|
|
3
|
+
*
|
|
4
|
+
* Source: GET https://marketplace.cloud.camunda.io/api/v1/ootb-connectors
|
|
5
|
+
* → { [id]: [{ version, ref, engine: { camunda: "^8.x" } }, ...] }
|
|
6
|
+
*
|
|
7
|
+
* Each `ref` is a commit-pinned raw.githubusercontent.com URL → immutable.
|
|
8
|
+
* We download every ref once, inline the templates into a single
|
|
9
|
+
* `templates.json` cache file, and inject `metadata.upstreamRef = <ref>` so
|
|
10
|
+
* subsequent syncs can skip already-cached entries (matches Modeler's
|
|
11
|
+
* approach in `app/lib/template-updater/util.js`).
|
|
12
|
+
*/
|
|
13
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
import semver from "semver";
|
|
16
|
+
import { isRecord, USER_AGENT } from "./helpers.js";
|
|
17
|
+
const DEFAULT_OOTB_URL = "https://marketplace.cloud.camunda.io/api/v1/ootb-connectors";
|
|
18
|
+
const FETCH_CONCURRENCY = 12;
|
|
19
|
+
const STALE_AFTER_MS = 7 * 24 * 60 * 60 * 1000; // 7 days
|
|
20
|
+
const FETCH_TIMEOUT_MS = 30_000; // 30 s per HTTP request
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Paths
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
export function getMarketplaceUrl() {
|
|
25
|
+
return process.env.C8CTL_OOTB_ELEMENT_TEMPLATES_URL || DEFAULT_OOTB_URL;
|
|
26
|
+
}
|
|
27
|
+
export function getCacheDir() {
|
|
28
|
+
if (!globalThis.c8ctl?.getUserDataDir) {
|
|
29
|
+
throw new Error("c8ctl runtime is not available; cannot resolve element-template cache dir.");
|
|
30
|
+
}
|
|
31
|
+
return join(globalThis.c8ctl.getUserDataDir(), "element-templates");
|
|
32
|
+
}
|
|
33
|
+
function getCachePath() {
|
|
34
|
+
return join(getCacheDir(), "templates.json");
|
|
35
|
+
}
|
|
36
|
+
function getFetchedAtPath() {
|
|
37
|
+
return join(getCacheDir(), "fetched-at");
|
|
38
|
+
}
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// Cache I/O
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
function isTemplateArray(value) {
|
|
43
|
+
return (Array.isArray(value) &&
|
|
44
|
+
value.every((item) => isRecord(item) && Array.isArray(item.properties)));
|
|
45
|
+
}
|
|
46
|
+
export function loadCache() {
|
|
47
|
+
const path = getCachePath();
|
|
48
|
+
if (!existsSync(path))
|
|
49
|
+
return null;
|
|
50
|
+
let parsed;
|
|
51
|
+
try {
|
|
52
|
+
parsed = JSON.parse(readFileSync(path, "utf-8"));
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
56
|
+
throw new Error(`Element template cache is corrupt at ${path}: ${message}`);
|
|
57
|
+
}
|
|
58
|
+
if (!Array.isArray(parsed)) {
|
|
59
|
+
throw new Error(`Element template cache is corrupt at ${path}: expected an array`);
|
|
60
|
+
}
|
|
61
|
+
if (!isTemplateArray(parsed)) {
|
|
62
|
+
throw new Error(`Element template cache is corrupt at ${path}: entries must be template objects with a properties array`);
|
|
63
|
+
}
|
|
64
|
+
return parsed;
|
|
65
|
+
}
|
|
66
|
+
function loadFetchedAt() {
|
|
67
|
+
const path = getFetchedAtPath();
|
|
68
|
+
if (!existsSync(path))
|
|
69
|
+
return null;
|
|
70
|
+
const value = readFileSync(path, "utf-8").trim();
|
|
71
|
+
const ms = Number(value);
|
|
72
|
+
return Number.isFinite(ms) ? ms : null;
|
|
73
|
+
}
|
|
74
|
+
function saveCache(templates) {
|
|
75
|
+
const dir = getCacheDir();
|
|
76
|
+
mkdirSync(dir, { recursive: true });
|
|
77
|
+
writeFileSync(getCachePath(), `${JSON.stringify(templates, null, 2)}\n`, "utf-8");
|
|
78
|
+
writeFileSync(getFetchedAtPath(), String(Date.now()), "utf-8");
|
|
79
|
+
}
|
|
80
|
+
export function isCacheStale() {
|
|
81
|
+
const fetchedAt = loadFetchedAt();
|
|
82
|
+
if (fetchedAt === null)
|
|
83
|
+
return true;
|
|
84
|
+
return Date.now() - fetchedAt > STALE_AFTER_MS;
|
|
85
|
+
}
|
|
86
|
+
export function getCacheAgeDays() {
|
|
87
|
+
const fetchedAt = loadFetchedAt();
|
|
88
|
+
if (fetchedAt === null)
|
|
89
|
+
return null;
|
|
90
|
+
return Math.floor((Date.now() - fetchedAt) / (24 * 60 * 60 * 1000));
|
|
91
|
+
}
|
|
92
|
+
export function nudgeIfStale(logger) {
|
|
93
|
+
if (!existsSync(getCachePath()))
|
|
94
|
+
return;
|
|
95
|
+
if (!isCacheStale())
|
|
96
|
+
return;
|
|
97
|
+
const days = getCacheAgeDays();
|
|
98
|
+
const ageText = days === null ? "stale" : `${days} day${days === 1 ? "" : "s"} old`;
|
|
99
|
+
logger.warn(`Element template cache is ${ageText}. ` +
|
|
100
|
+
"Run 'c8ctl element-template sync' to refresh.");
|
|
101
|
+
}
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
// HTTP
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
105
|
+
async function fetchJson(url) {
|
|
106
|
+
const response = await fetch(url, {
|
|
107
|
+
headers: { "User-Agent": USER_AGENT },
|
|
108
|
+
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
|
|
109
|
+
});
|
|
110
|
+
if (!response.ok) {
|
|
111
|
+
throw new Error(`HTTP ${response.status} ${response.statusText} for ${url}`);
|
|
112
|
+
}
|
|
113
|
+
return response.json();
|
|
114
|
+
}
|
|
115
|
+
async function fetchIndex() {
|
|
116
|
+
const raw = await fetchJson(getMarketplaceUrl());
|
|
117
|
+
if (!isRecord(raw)) {
|
|
118
|
+
throw new Error("Marketplace index is not a JSON object");
|
|
119
|
+
}
|
|
120
|
+
// Trust the upstream shape — schema-validated at the marketplace.
|
|
121
|
+
const result = {};
|
|
122
|
+
for (const [id, value] of Object.entries(raw)) {
|
|
123
|
+
if (!Array.isArray(value))
|
|
124
|
+
continue;
|
|
125
|
+
const entries = [];
|
|
126
|
+
for (const entry of value) {
|
|
127
|
+
if (!isRecord(entry))
|
|
128
|
+
continue;
|
|
129
|
+
entries.push({
|
|
130
|
+
version: typeof entry.version === "number" ? entry.version : undefined,
|
|
131
|
+
ref: typeof entry.ref === "string" ? entry.ref : undefined,
|
|
132
|
+
engine: isRecord(entry.engine)
|
|
133
|
+
? {
|
|
134
|
+
camunda: typeof entry.engine.camunda === "string"
|
|
135
|
+
? entry.engine.camunda
|
|
136
|
+
: undefined,
|
|
137
|
+
}
|
|
138
|
+
: undefined,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
result[id] = entries;
|
|
142
|
+
}
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
function isTemplateLike(value) {
|
|
146
|
+
return isRecord(value) && Array.isArray(value.properties);
|
|
147
|
+
}
|
|
148
|
+
async function fetchTemplate(url) {
|
|
149
|
+
const raw = await fetchJson(url);
|
|
150
|
+
if (!isTemplateLike(raw)) {
|
|
151
|
+
throw new Error(`Fetched template at ${url} did not match expected shape`);
|
|
152
|
+
}
|
|
153
|
+
return raw;
|
|
154
|
+
}
|
|
155
|
+
// ---------------------------------------------------------------------------
|
|
156
|
+
// Sync
|
|
157
|
+
// ---------------------------------------------------------------------------
|
|
158
|
+
/**
|
|
159
|
+
* Run `fn` over `items` with at most `concurrency` in flight.
|
|
160
|
+
* Each fn() must handle its own errors — exceptions abort the pool.
|
|
161
|
+
*/
|
|
162
|
+
async function pool(items, concurrency, fn) {
|
|
163
|
+
const queue = items.slice();
|
|
164
|
+
const workers = Array.from({ length: Math.min(concurrency, queue.length) }, async () => {
|
|
165
|
+
while (queue.length > 0) {
|
|
166
|
+
const item = queue.shift();
|
|
167
|
+
if (item === undefined)
|
|
168
|
+
break;
|
|
169
|
+
await fn(item);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
await Promise.all(workers);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Flatten the marketplace index `{ id: [{version, ref, engine}] }` into a flat
|
|
176
|
+
* list of `{ id, version, ref, engine }` entries, dropping legacy entries with
|
|
177
|
+
* no `version`.
|
|
178
|
+
*/
|
|
179
|
+
function flattenIndex(index) {
|
|
180
|
+
const entries = [];
|
|
181
|
+
for (const [id, versions] of Object.entries(index)) {
|
|
182
|
+
for (const entry of versions) {
|
|
183
|
+
if (entry.version === undefined || entry.ref === undefined)
|
|
184
|
+
continue;
|
|
185
|
+
entries.push({
|
|
186
|
+
id,
|
|
187
|
+
version: entry.version,
|
|
188
|
+
ref: entry.ref,
|
|
189
|
+
engine: entry.engine,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return entries;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Sync the cache with the marketplace.
|
|
197
|
+
*
|
|
198
|
+
* - Always re-fetches the index.
|
|
199
|
+
* - Fetches refs that aren't already cached (matches by `metadata.upstreamRef`).
|
|
200
|
+
* - With `prune: true`, drops cached entries whose `upstreamRef` is no longer
|
|
201
|
+
* in the fresh index.
|
|
202
|
+
*
|
|
203
|
+
* Per-template fetch failures are logged + counted but do not abort the run.
|
|
204
|
+
*
|
|
205
|
+
* Returns a summary `{ total, fetched, cached, errors, pruned }`.
|
|
206
|
+
*/
|
|
207
|
+
export async function syncTemplates({ logger, prune = false, }) {
|
|
208
|
+
logger.info(`Fetching index from ${getMarketplaceUrl()} ...`);
|
|
209
|
+
const index = await fetchIndex();
|
|
210
|
+
const entries = flattenIndex(index);
|
|
211
|
+
logger.info(`Index has ${entries.length} template versions across ${Object.keys(index).length} connectors.`);
|
|
212
|
+
let existing;
|
|
213
|
+
try {
|
|
214
|
+
existing = loadCache() || [];
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
218
|
+
logger.warn(`Corrupt cache — starting fresh: ${message}`);
|
|
219
|
+
existing = [];
|
|
220
|
+
}
|
|
221
|
+
const byUpstreamRef = new Map();
|
|
222
|
+
for (const tpl of existing) {
|
|
223
|
+
const ref = tpl.metadata?.upstreamRef;
|
|
224
|
+
if (ref)
|
|
225
|
+
byUpstreamRef.set(ref, tpl);
|
|
226
|
+
}
|
|
227
|
+
const freshRefs = new Set(entries.map((e) => e.ref));
|
|
228
|
+
const toFetch = entries.filter((e) => !byUpstreamRef.has(e.ref));
|
|
229
|
+
logger.info(`${byUpstreamRef.size > 0
|
|
230
|
+
? `Reusing ${entries.length - toFetch.length} cached, `
|
|
231
|
+
: ""}fetching ${toFetch.length} new...`);
|
|
232
|
+
let fetched = 0;
|
|
233
|
+
let errors = 0;
|
|
234
|
+
let progress = 0;
|
|
235
|
+
const fetchedTemplates = [];
|
|
236
|
+
await pool(toFetch, FETCH_CONCURRENCY, async (entry) => {
|
|
237
|
+
progress += 1;
|
|
238
|
+
const myProgress = progress;
|
|
239
|
+
const label = `${entry.id}@${entry.version}`;
|
|
240
|
+
try {
|
|
241
|
+
const template = await fetchTemplate(entry.ref);
|
|
242
|
+
template.metadata = template.metadata || {};
|
|
243
|
+
template.metadata.upstreamRef = entry.ref;
|
|
244
|
+
fetchedTemplates.push(template);
|
|
245
|
+
fetched += 1;
|
|
246
|
+
logger.info(` [${myProgress}/${toFetch.length}] ${label}`);
|
|
247
|
+
}
|
|
248
|
+
catch (error) {
|
|
249
|
+
errors += 1;
|
|
250
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
251
|
+
logger.warn(` [${myProgress}/${toFetch.length}] ${label} — ${message}`);
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
// Build the new cache: keep cached entries that are still in the index,
|
|
255
|
+
// plus everything we just fetched. Sort fetched entries by id+version so
|
|
256
|
+
// cache order (and therefore search result order) is deterministic
|
|
257
|
+
// regardless of network timing.
|
|
258
|
+
fetchedTemplates.sort((a, b) => {
|
|
259
|
+
const idCmp = (a.id ?? "").localeCompare(b.id ?? "");
|
|
260
|
+
if (idCmp !== 0)
|
|
261
|
+
return idCmp;
|
|
262
|
+
return (a.version ?? 0) - (b.version ?? 0);
|
|
263
|
+
});
|
|
264
|
+
const next = [];
|
|
265
|
+
for (const tpl of existing) {
|
|
266
|
+
const ref = tpl.metadata?.upstreamRef;
|
|
267
|
+
if (ref && freshRefs.has(ref)) {
|
|
268
|
+
next.push(tpl);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
next.push(...fetchedTemplates);
|
|
272
|
+
let pruned = 0;
|
|
273
|
+
if (prune) {
|
|
274
|
+
pruned =
|
|
275
|
+
existing.length -
|
|
276
|
+
next.filter((t) => {
|
|
277
|
+
const ref = t.metadata?.upstreamRef;
|
|
278
|
+
return ref !== undefined && byUpstreamRef.has(ref);
|
|
279
|
+
}).length;
|
|
280
|
+
}
|
|
281
|
+
// Without --prune, keep templates whose upstreamRef vanished from the index
|
|
282
|
+
// (e.g. user wants to retain an older version that was removed upstream).
|
|
283
|
+
if (!prune) {
|
|
284
|
+
for (const tpl of existing) {
|
|
285
|
+
const ref = tpl.metadata?.upstreamRef;
|
|
286
|
+
if (ref && !freshRefs.has(ref) && !next.includes(tpl)) {
|
|
287
|
+
next.push(tpl);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
saveCache(next);
|
|
292
|
+
const summary = {
|
|
293
|
+
total: next.length,
|
|
294
|
+
fetched,
|
|
295
|
+
cached: entries.length - toFetch.length,
|
|
296
|
+
errors,
|
|
297
|
+
pruned,
|
|
298
|
+
};
|
|
299
|
+
logger.info(`Sync complete: ${summary.fetched} fetched, ${summary.cached} cached` +
|
|
300
|
+
`${summary.errors > 0 ? `, ${summary.errors} errors` : ""}` +
|
|
301
|
+
`${prune ? `, ${summary.pruned} pruned` : ""}.`);
|
|
302
|
+
return summary;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Run a sync if the cache doesn't exist yet. No-op if cache is present.
|
|
306
|
+
*/
|
|
307
|
+
export async function bootstrapIfNeeded({ logger, }) {
|
|
308
|
+
if (existsSync(getCachePath()))
|
|
309
|
+
return;
|
|
310
|
+
logger.info("Element template cache not found — running first-time sync...");
|
|
311
|
+
await syncTemplates({ logger });
|
|
312
|
+
}
|
|
313
|
+
// ---------------------------------------------------------------------------
|
|
314
|
+
// Lookup & search
|
|
315
|
+
// ---------------------------------------------------------------------------
|
|
316
|
+
/**
|
|
317
|
+
* Return all cached templates matching `id`. Empty if none.
|
|
318
|
+
*/
|
|
319
|
+
export function findById(id) {
|
|
320
|
+
const cache = loadCache();
|
|
321
|
+
if (!cache)
|
|
322
|
+
return [];
|
|
323
|
+
return cache.filter((t) => t.id === id);
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Pick the template version best matching the BPMN's executionPlatformVersion.
|
|
327
|
+
*
|
|
328
|
+
* - If `version` is given: exact `version` match required.
|
|
329
|
+
* - If `executionPlatformVersion` is given: highest `version` whose
|
|
330
|
+
* `engines.camunda` is satisfied by `coerce(executionPlatformVersion)`.
|
|
331
|
+
* Templates without `engines.camunda` are treated as compatible with any
|
|
332
|
+
* version (legacy fallback).
|
|
333
|
+
* - Otherwise: highest `version`.
|
|
334
|
+
*
|
|
335
|
+
* Returns `null` if no candidate matches.
|
|
336
|
+
*/
|
|
337
|
+
export function pickVersion(templates, { version, executionPlatformVersion } = {}) {
|
|
338
|
+
if (templates.length === 0)
|
|
339
|
+
return null;
|
|
340
|
+
if (version !== undefined) {
|
|
341
|
+
const exact = templates.find((t) => Number(t.version) === Number(version));
|
|
342
|
+
return exact || null;
|
|
343
|
+
}
|
|
344
|
+
let candidates = templates.filter((t) => t.version !== undefined);
|
|
345
|
+
if (executionPlatformVersion) {
|
|
346
|
+
const coerced = semver.coerce(executionPlatformVersion);
|
|
347
|
+
if (coerced) {
|
|
348
|
+
candidates = candidates.filter((t) => {
|
|
349
|
+
const constraint = t.engines?.camunda;
|
|
350
|
+
if (!constraint)
|
|
351
|
+
return true;
|
|
352
|
+
return semver.satisfies(coerced, constraint);
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
if (candidates.length === 0)
|
|
357
|
+
return null;
|
|
358
|
+
return candidates.reduce((best, cur) => Number(cur.version) > Number(best.version) ? cur : best);
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Substring search on name + description + keywords (case-insensitive).
|
|
362
|
+
* Mirrors Modeler's discovery path. Deprecated versions are excluded
|
|
363
|
+
* before the per-id latest-version reduction so that if the newest
|
|
364
|
+
* version of a connector is deprecated, the latest non-deprecated
|
|
365
|
+
* version is still discoverable.
|
|
366
|
+
*/
|
|
367
|
+
export function searchTemplates(query) {
|
|
368
|
+
const cache = loadCache() || [];
|
|
369
|
+
const q = query.toLowerCase();
|
|
370
|
+
const matches = cache
|
|
371
|
+
.filter((t) => {
|
|
372
|
+
const name = (t.name || "").toLowerCase();
|
|
373
|
+
const description = (t.description || "").toLowerCase();
|
|
374
|
+
const id = (t.id || "").toLowerCase();
|
|
375
|
+
const keywords = (t.keywords ?? []).map((k) => k.toLowerCase()).join(" ");
|
|
376
|
+
return (name.includes(q) ||
|
|
377
|
+
description.includes(q) ||
|
|
378
|
+
id.includes(q) ||
|
|
379
|
+
keywords.includes(q));
|
|
380
|
+
})
|
|
381
|
+
// Filter deprecated before per-id reduction so the latest
|
|
382
|
+
// non-deprecated version surfaces when the newest is deprecated.
|
|
383
|
+
.filter((t) => !t.deprecated);
|
|
384
|
+
// Reduce to the latest version per id.
|
|
385
|
+
const byId = new Map();
|
|
386
|
+
for (const t of matches) {
|
|
387
|
+
if (t.id === undefined)
|
|
388
|
+
continue;
|
|
389
|
+
const existing = byId.get(t.id);
|
|
390
|
+
if (!existing || Number(t.version || 0) > Number(existing.version || 0)) {
|
|
391
|
+
byId.set(t.id, t);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return [...byId.values()];
|
|
395
|
+
}
|
|
396
|
+
//# sourceMappingURL=marketplace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marketplace.js","sourceRoot":"","sources":["../../../default-plugins/element-template/marketplace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAA8B,UAAU,EAAE,MAAM,cAAc,CAAC;AAEhF,MAAM,gBAAgB,GACrB,6DAA6D,CAAC;AAC/D,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,SAAS;AACzD,MAAM,gBAAgB,GAAG,MAAM,CAAC,CAAC,wBAAwB;AA6BzD,8EAA8E;AAC9E,QAAQ;AACR,8EAA8E;AAE9E,MAAM,UAAU,iBAAiB;IAChC,OAAO,OAAO,CAAC,GAAG,CAAC,gCAAgC,IAAI,gBAAgB,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,WAAW;IAC1B,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CACd,4EAA4E,CAC5E,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,cAA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;QAC1E,OAAO,CACN,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YAChB,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;YACvB,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;YACd,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CACpB,CAAC;IACH,CAAC,CAAC;QACF,0DAA0D;QAC1D,iEAAiE;SAChE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAE/B,uCAAuC;IACvC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAoB,CAAC;IACzC,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACzB,IAAI,CAAC,CAAC,EAAE,KAAK,SAAS;YAAE,SAAS;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAChC,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC,EAAE,CAAC;YACzE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QACnB,CAAC;IACF,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "c8ctl-plugin-element-template",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "c8ctl plugin to apply and inspect Camunda element templates",
|
|
6
|
+
"keywords": ["c8ctl", "c8ctl-plugin", "element-template", "camunda"],
|
|
7
|
+
"main": "c8ctl-plugin.ts"
|
|
8
|
+
}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template/BPMN input resolution shared by element-template subcommands.
|
|
3
|
+
*
|
|
4
|
+
* Covers:
|
|
5
|
+
* - Classifying a `<template>` argument as URL, local path, or OOTB id.
|
|
6
|
+
* - Loading a template from any of those sources (cache lookup for ids,
|
|
7
|
+
* fetch/parse for URLs and paths).
|
|
8
|
+
* - Reading BPMN input from a file path or stdin.
|
|
9
|
+
* - Extracting `modeler:executionPlatformVersion` from BPMN XML.
|
|
10
|
+
*/
|
|
11
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
12
|
+
import { resolve as resolvePath } from "node:path";
|
|
13
|
+
import { getPropertyDetail, getSettableProperties, parseTemplateJson, readFileOrUrl, } from "./helpers.js";
|
|
14
|
+
import { bootstrapIfNeeded, findById, nudgeIfStale, pickVersion, } from "./marketplace.js";
|
|
15
|
+
if (!globalThis.c8ctl)
|
|
16
|
+
throw new Error("c8ctl runtime not initialised");
|
|
17
|
+
const c8ctl = globalThis.c8ctl;
|
|
18
|
+
/**
|
|
19
|
+
* Read BPMN XML from a file path or stdin. Returns null if no input is available.
|
|
20
|
+
*
|
|
21
|
+
* Stdin is consumed via async iteration so a slow upstream writer (e.g.
|
|
22
|
+
* `apply | lint` in a pipeline, or any producer that hasn't flushed yet)
|
|
23
|
+
* is awaited until 'end'. Do not use `readFileSync(0)` here — when stdin
|
|
24
|
+
* is a pipe with no buffered data yet, it throws EAGAIN, which gets
|
|
25
|
+
* swallowed and surfaces as "no input".
|
|
26
|
+
*/
|
|
27
|
+
export async function readBpmnInput(filePath) {
|
|
28
|
+
if (filePath) {
|
|
29
|
+
const resolved = resolvePath(filePath);
|
|
30
|
+
if (!existsSync(resolved)) {
|
|
31
|
+
throw new Error(`File not found: ${filePath}`);
|
|
32
|
+
}
|
|
33
|
+
return { xml: readFileSync(resolved, "utf-8"), source: resolved };
|
|
34
|
+
}
|
|
35
|
+
if (!process.stdin.isTTY) {
|
|
36
|
+
process.stdin.setEncoding("utf-8");
|
|
37
|
+
let xml = "";
|
|
38
|
+
for await (const chunk of process.stdin) {
|
|
39
|
+
xml += chunk;
|
|
40
|
+
}
|
|
41
|
+
if (!xml.trim()) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return { xml, source: "stdin" };
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Classify a template argument as one of:
|
|
50
|
+
* - { kind: 'url', value }
|
|
51
|
+
* - { kind: 'path', value }
|
|
52
|
+
* - { kind: 'id', id, version? }
|
|
53
|
+
*
|
|
54
|
+
* Detection rules (in order):
|
|
55
|
+
* 1. starts with http:// or https:// → URL
|
|
56
|
+
* 2. contains / or \, starts with `.`, or ends with .json → path
|
|
57
|
+
* 3. matches `<id>` or `<id>@<n>` → id
|
|
58
|
+
*/
|
|
59
|
+
export function parseTemplateRef(arg) {
|
|
60
|
+
if (!arg) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
if (/^http:\/\//.test(arg)) {
|
|
64
|
+
throw new Error(`Insecure template URL rejected: ${arg}\n` +
|
|
65
|
+
"Template URLs must use HTTPS to protect credentials and content integrity.");
|
|
66
|
+
}
|
|
67
|
+
if (/^https:\/\//.test(arg)) {
|
|
68
|
+
return { kind: "url", value: arg };
|
|
69
|
+
}
|
|
70
|
+
if (arg.includes("/") ||
|
|
71
|
+
arg.includes("\\") ||
|
|
72
|
+
arg.startsWith(".") ||
|
|
73
|
+
arg.toLowerCase().endsWith(".json")) {
|
|
74
|
+
return { kind: "path", value: arg };
|
|
75
|
+
}
|
|
76
|
+
const match = arg.match(/^([^@\s]+?)(?:@(\d+))?$/);
|
|
77
|
+
if (!match) {
|
|
78
|
+
return { kind: "path", value: arg };
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
kind: "id",
|
|
82
|
+
id: match[1],
|
|
83
|
+
version: match[2] !== undefined ? Number(match[2]) : undefined,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export async function getExecutionPlatformVersion(xml) {
|
|
87
|
+
const BpmnModdle = (await import("bpmn-moddle")).default;
|
|
88
|
+
const moddle = new BpmnModdle();
|
|
89
|
+
try {
|
|
90
|
+
const { rootElement } = await moddle.fromXML(xml);
|
|
91
|
+
const version = rootElement.$attrs?.["modeler:executionPlatformVersion"];
|
|
92
|
+
return typeof version === "string" ? version : null;
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Walk the moddle tree returned by bpmn-moddle and check whether any element
|
|
100
|
+
* carries the given `id`. Used by the dry-run path to surface "element not
|
|
101
|
+
* found" before reporting a successful preview.
|
|
102
|
+
*/
|
|
103
|
+
function containsId(node, id, seen) {
|
|
104
|
+
if (node === null || typeof node !== "object")
|
|
105
|
+
return false;
|
|
106
|
+
if (seen.has(node))
|
|
107
|
+
return false;
|
|
108
|
+
seen.add(node);
|
|
109
|
+
// biome-ignore lint/plugin: narrowing unknown to a plain object record for tree traversal
|
|
110
|
+
const record = node;
|
|
111
|
+
if (record.id === id)
|
|
112
|
+
return true;
|
|
113
|
+
for (const key of Object.keys(record)) {
|
|
114
|
+
if (key.startsWith("$"))
|
|
115
|
+
continue;
|
|
116
|
+
const value = record[key];
|
|
117
|
+
if (Array.isArray(value)) {
|
|
118
|
+
for (const item of value) {
|
|
119
|
+
if (containsId(item, id, seen))
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else if (containsId(value, id, seen)) {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
export async function elementExistsInBpmn(xml, elementId) {
|
|
130
|
+
const BpmnModdle = (await import("bpmn-moddle")).default;
|
|
131
|
+
const moddle = new BpmnModdle();
|
|
132
|
+
try {
|
|
133
|
+
const { rootElement } = await moddle.fromXML(xml);
|
|
134
|
+
return containsId(rootElement, elementId, new Set());
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
// Surface BPMN parse failures so dry-run does not report a successful
|
|
138
|
+
// plan for invalid XML.
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
export async function readTemplateFromPathOrUrl(input) {
|
|
143
|
+
const content = await readFileOrUrl(input);
|
|
144
|
+
return parseTemplateJson(content);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Resolve an `<id>[@<v>]` reference to a single template object using the
|
|
148
|
+
* local cache, bootstrapping if needed. `executionPlatformVersion` (from the
|
|
149
|
+
* BPMN file) drives version selection when no explicit version is pinned.
|
|
150
|
+
*/
|
|
151
|
+
export async function resolveOotbTemplate(ref, { executionPlatformVersion, } = {}) {
|
|
152
|
+
const logger = c8ctl.getLogger();
|
|
153
|
+
await bootstrapIfNeeded({ logger });
|
|
154
|
+
nudgeIfStale(logger);
|
|
155
|
+
const candidates = findById(ref.id);
|
|
156
|
+
if (candidates.length === 0) {
|
|
157
|
+
throw new Error(`Element template '${ref.id}' not found. Run 'c8ctl element-template sync' to refresh the cache, ` +
|
|
158
|
+
"or use 'c8ctl element-template search <query>' to find an id.");
|
|
159
|
+
}
|
|
160
|
+
const picked = pickVersion(candidates, {
|
|
161
|
+
version: ref.version,
|
|
162
|
+
executionPlatformVersion,
|
|
163
|
+
});
|
|
164
|
+
if (!picked) {
|
|
165
|
+
if (ref.version !== undefined) {
|
|
166
|
+
const known = candidates
|
|
167
|
+
.map((t) => t.version)
|
|
168
|
+
.filter((v) => Number.isFinite(Number(v)))
|
|
169
|
+
.sort((a, b) => Number(a) - Number(b));
|
|
170
|
+
const available = known.length > 0
|
|
171
|
+
? `Available: ${known.join(", ")}.`
|
|
172
|
+
: "No known versions in cache.";
|
|
173
|
+
throw new Error(`Element template '${ref.id}' has no version ${ref.version}. ${available}`);
|
|
174
|
+
}
|
|
175
|
+
const available = candidates
|
|
176
|
+
.map((t) => {
|
|
177
|
+
const versionLabel = Number.isFinite(Number(t.version))
|
|
178
|
+
? String(t.version)
|
|
179
|
+
: "unversioned";
|
|
180
|
+
return `${versionLabel} (${t.engines?.camunda || "any"})`;
|
|
181
|
+
})
|
|
182
|
+
.join(", ");
|
|
183
|
+
throw new Error(`Element template '${ref.id}' has no version compatible with execution platform ` +
|
|
184
|
+
`${executionPlatformVersion}. Available: ${available}.`);
|
|
185
|
+
}
|
|
186
|
+
return picked;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Load and parse a template (OOTB id, local path, or URL), and produce the
|
|
190
|
+
* derived views the inspect subcommands need: settable property details,
|
|
191
|
+
* a group id→label map, and a side-table from detail → source property.
|
|
192
|
+
*
|
|
193
|
+
* The side-table preserves access to the raw schema-shaped property for
|
|
194
|
+
* JSON projection without leaking the back-reference into the detail
|
|
195
|
+
* itself. Required because two distinct properties can share the same
|
|
196
|
+
* `binding.name` + type (template authors use it for operation-conditional
|
|
197
|
+
* duplicates), so we can't recover identity from the detail's name+type
|
|
198
|
+
* tuple.
|
|
199
|
+
*/
|
|
200
|
+
export async function loadTemplate(templateArg) {
|
|
201
|
+
const ref = parseTemplateRef(templateArg);
|
|
202
|
+
if (!ref) {
|
|
203
|
+
throw new Error("Missing template argument.");
|
|
204
|
+
}
|
|
205
|
+
let template;
|
|
206
|
+
if (ref.kind === "id") {
|
|
207
|
+
template = await resolveOotbTemplate(ref);
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
template = await readTemplateFromPathOrUrl(ref.value);
|
|
211
|
+
}
|
|
212
|
+
const settable = getSettableProperties(template.properties);
|
|
213
|
+
const groupLabelMap = new Map((template.groups ?? []).map((g) => [g.id, g.label]));
|
|
214
|
+
const sourceByDetail = new WeakMap();
|
|
215
|
+
const allDetails = settable.map((p) => {
|
|
216
|
+
const detail = getPropertyDetail(p, groupLabelMap);
|
|
217
|
+
sourceByDetail.set(detail, p);
|
|
218
|
+
return detail;
|
|
219
|
+
});
|
|
220
|
+
// `autoResolvedVersion` is true when the user gave an OOTB id without
|
|
221
|
+
// pinning `@<n>` and we picked the latest. The info card surfaces
|
|
222
|
+
// this as a dim parenthetical on the Version row instead of a
|
|
223
|
+
// separate stderr warning.
|
|
224
|
+
return {
|
|
225
|
+
template,
|
|
226
|
+
allDetails,
|
|
227
|
+
groupLabelMap,
|
|
228
|
+
sourceByDetail,
|
|
229
|
+
autoResolvedVersion: ref.kind === "id" && ref.version === undefined,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=template-ref.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-ref.js","sourceRoot":"","sources":["../../../default-plugins/element-template/template-ref.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EACN,iBAAiB,EACjB,qBAAqB,EAErB,iBAAiB,EACjB,aAAa,GAGb,MAAM,cAAc,CAAC;AACtB,OAAO,EACN,iBAAiB,EACjB,QAAQ,EACR,YAAY,EACZ,WAAW,GACX,MAAM,kBAAkB,CAAC;AAE1B,IAAI,CAAC,UAAU,CAAC,KAAK;IAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;AACxE,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;AAqB/B;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAClC,QAA4B;IAE5B,IAAI,QAAQ,EAAE,CAAC;QACd,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,EAAE,GAAG,EAAE,YAAY,CAAC,QAAQ,EAAE,O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