@bagdock/cli 0.8.0 → 0.9.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.
Files changed (2) hide show
  1. package/dist/bagdock.js +69 -1
  2. package/package.json +1 -1
package/dist/bagdock.js CHANGED
@@ -4107,7 +4107,9 @@ Deploying ${config.slug}@${config.version} → ${envLabel}
4107
4107
  environment,
4108
4108
  compatibilityDate: config.compatibilityDate ?? "2024-09-23",
4109
4109
  ...config.kv ? { kv: config.kv } : {},
4110
- ...config.webhooks ? { webhooks: config.webhooks } : {}
4110
+ ...config.webhooks ? { webhooks: config.webhooks } : {},
4111
+ ...config.inputs ? { inputs: config.inputs } : {},
4112
+ ...config.displays ? { displays: config.displays } : {}
4111
4113
  }));
4112
4114
  try {
4113
4115
  const res = await fetch(`${getApiBase()}/api/v1/developer/apps/${config.slug}/deploy`, {
@@ -4407,6 +4409,72 @@ async function validate() {
4407
4409
  }
4408
4410
  }
4409
4411
  }
4412
+ if (config.inputs !== undefined) {
4413
+ if (!Array.isArray(config.inputs)) {
4414
+ checks.push({ name: "Inputs", status: "fail", message: '"inputs" must be an array of { key, label, type, required }' });
4415
+ } else {
4416
+ const problems = [];
4417
+ const seen = new Set;
4418
+ config.inputs.forEach((inp, i) => {
4419
+ if (!inp || typeof inp !== "object") {
4420
+ problems.push(`#${i} is not an object`);
4421
+ return;
4422
+ }
4423
+ const id = typeof inp.key === "string" && inp.key ? inp.key : `#${i}`;
4424
+ if (typeof inp.key !== "string" || !inp.key.trim())
4425
+ problems.push(`${id} "key" must be a non-empty string`);
4426
+ if (typeof inp.label !== "string" || !inp.label.trim())
4427
+ problems.push(`${id} "label" must be a non-empty string`);
4428
+ if (inp.type !== "text" && inp.type !== "password")
4429
+ problems.push(`${id} type must be "text" or "password" (got "${inp.type}")`);
4430
+ if (typeof inp.required !== "boolean")
4431
+ problems.push(`${id} "required" must be a boolean`);
4432
+ if (inp.help !== undefined && typeof inp.help !== "string")
4433
+ problems.push(`${id} "help" must be a string`);
4434
+ if (inp.placeholder !== undefined && typeof inp.placeholder !== "string")
4435
+ problems.push(`${id} "placeholder" must be a string`);
4436
+ if (typeof inp.key === "string" && inp.key) {
4437
+ if (seen.has(inp.key))
4438
+ problems.push(`duplicate key "${inp.key}"`);
4439
+ seen.add(inp.key);
4440
+ }
4441
+ });
4442
+ if (problems.length) {
4443
+ checks.push({ name: "Inputs", status: "fail", message: problems.join("; ") });
4444
+ } else {
4445
+ checks.push({ name: "Inputs", status: "pass", message: `${config.inputs.length} declared` });
4446
+ }
4447
+ }
4448
+ }
4449
+ if (config.displays !== undefined) {
4450
+ if (!Array.isArray(config.displays)) {
4451
+ checks.push({ name: "Displays", status: "fail", message: '"displays" must be an array of { label, value|template, copyable? }' });
4452
+ } else {
4453
+ const problems = [];
4454
+ config.displays.forEach((d, i) => {
4455
+ if (!d || typeof d !== "object") {
4456
+ problems.push(`#${i} is not an object`);
4457
+ return;
4458
+ }
4459
+ const id = typeof d.label === "string" && d.label ? `"${d.label}"` : `#${i}`;
4460
+ if (typeof d.label !== "string" || !d.label.trim())
4461
+ problems.push(`${id} "label" must be a non-empty string`);
4462
+ if (d.value === undefined && d.template === undefined)
4463
+ problems.push(`${id} needs "value" or "template"`);
4464
+ if (d.value !== undefined && typeof d.value !== "string")
4465
+ problems.push(`${id} "value" must be a string`);
4466
+ if (d.template !== undefined && typeof d.template !== "string")
4467
+ problems.push(`${id} "template" must be a string`);
4468
+ if (d.copyable !== undefined && typeof d.copyable !== "boolean")
4469
+ problems.push(`${id} "copyable" must be a boolean`);
4470
+ });
4471
+ if (problems.length) {
4472
+ checks.push({ name: "Displays", status: "fail", message: problems.join("; ") });
4473
+ } else {
4474
+ checks.push({ name: "Displays", status: "pass", message: `${config.displays.length} declared` });
4475
+ }
4476
+ }
4477
+ }
4410
4478
  const linked = resolveSlug();
4411
4479
  if (linked && linked !== config.slug) {
4412
4480
  checks.push({ name: "Project link", status: "warn", message: `bagdock.json slug "${config.slug}" differs from linked project "${linked}"` });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bagdock/cli",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Bagdock developer CLI — build, test, and deploy apps and edges on the Bagdock platform",
5
5
  "keywords": [
6
6
  "bagdock",