@revturbine/cli 0.5.1 → 0.5.2

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/cli.js +21 -1
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -6024,6 +6024,16 @@ function requireSelectors(opts, positionalFiles, {
6024
6024
  return found;
6025
6025
  }
6026
6026
 
6027
+ // src/lib/version-trail.ts
6028
+ function serverSchemaIsNewer(config, bundledVersion) {
6029
+ const server = config?.schema_version;
6030
+ if (typeof server !== "string" || !server) return null;
6031
+ const parse = (v) => v.split(".").map((n) => Number.parseInt(n, 10) || 0);
6032
+ const [a, b] = [parse(server), parse(bundledVersion)];
6033
+ const newer = a[0] !== b[0] ? a[0] > b[0] : a[1] !== b[1] ? a[1] > b[1] : (a[2] ?? 0) > (b[2] ?? 0);
6034
+ return newer ? server : null;
6035
+ }
6036
+
6027
6037
  // src/cli.ts
6028
6038
  var DOCS_URL = "https://github.com/revt-eng/revturbine-cli#readme";
6029
6039
  var DEFAULT_URL = "https://revturbine.com/app";
@@ -6104,11 +6114,21 @@ async function getJson(conn, pathname) {
6104
6114
  const json = await res.json().catch(() => ({}));
6105
6115
  return { res, json };
6106
6116
  }
6117
+ function warnIfSchemaBehind(config) {
6118
+ const server = serverSchemaIsNewer(config, SCHEMA_VERSION);
6119
+ if (server) {
6120
+ diag(
6121
+ `WARNING: the server's schema (${server}) is newer than this CLI's bundled snapshot (${SCHEMA_VERSION}) \u2014 offline validation may be missing rules. Update: npm i -g @revturbine/cli`
6122
+ );
6123
+ }
6124
+ }
6107
6125
  async function downloadConfig(conn, playbookVersionId) {
6108
6126
  const qs = playbookVersionId ? `?playbookVersionId=${encodeURIComponent(playbookVersionId)}` : "";
6109
6127
  const res = await request(conn, `/api/config/export${qs}`);
6110
6128
  if (!res.ok) httpFail(conn, "download", res.status);
6111
- return res.json().catch(() => ({}));
6129
+ const config = await res.json().catch(() => ({}));
6130
+ warnIfSchemaBehind(config);
6131
+ return config;
6112
6132
  }
6113
6133
  async function requireOpenDraft(conn) {
6114
6134
  const { ok, status, draft } = await resolveActiveDraft(conn.url, conn.headers);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revturbine/cli",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "revturbine — verify RevTurbine ExportedConfig files and ship them to a RevTurbine instance through the Change Set lifecycle.",
5
5
  "license": "MIT",
6
6
  "repository": {