@coffer-org/server 2.2.0 → 2.2.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.
@@ -145,7 +145,7 @@ export function makeTable(em, table) {
145
145
  const sources = new Set(c.from);
146
146
  for (const t of c.to) {
147
147
  if (info.columns.has(t.name) && !sources.has(t.name)) {
148
- throw new Error(`[migrations] ${table}.${t.name}: цільова колонка convert вже існує і не є джереломвикористай changeType/renameColumn`);
148
+ throw new Error(`[migrations] ${table}.${t.name}: convert target column already exists and is not a source use changeType/renameColumn`);
149
149
  }
150
150
  }
151
151
  const sqlite = dialectOf(em) === 'sqlite';
@@ -1,4 +1,5 @@
1
1
  import { execFile } from 'node:child_process';
2
+ import { isNewerVersion } from '@coffer-org/core/version';
2
3
  import { getPluginState, setPluginState } from "./plugin-state.js";
3
4
  const TTL_MS = 60 * 60 * 1000;
4
5
  const STATE_PLUGIN = 'core';
@@ -37,14 +38,15 @@ export function resolveUpdateTarget(assets, id, latestVersion) {
37
38
  const rec = assets.find((a) => a.id === id);
38
39
  if (!rec)
39
40
  return { ok: false, error: 'unknown_plugin' };
40
- if (!latestVersion || latestVersion === rec.version)
41
+ if (!latestVersion || !isNewerVersion(latestVersion, rec.version)) {
41
42
  return { ok: false, error: 'no_update_available' };
43
+ }
42
44
  return { ok: true, packageName: rec.packageName, version: latestVersion };
43
45
  }
44
46
  export function resolveAllUpdateTargets(assets, latestById) {
45
47
  return assets.flatMap((rec) => {
46
48
  const latest = latestById.get(rec.id) ?? null;
47
- if (!latest || latest === rec.version)
49
+ if (!latest || !isNewerVersion(latest, rec.version))
48
50
  return [];
49
51
  return [{ id: rec.id, packageName: rec.packageName, from: rec.version, to: latest }];
50
52
  });
@@ -53,7 +55,7 @@ export function resolveBaseTargets(assets, runtime, coreLatest, runtimeLatest) {
53
55
  const core = assets.find((a) => a.id === 'core');
54
56
  const rt = resolveRuntimeTarget(runtime, runtimeLatest);
55
57
  return [
56
- ...(core && !core.local && coreLatest && coreLatest !== core.version
58
+ ...(core && !core.local && coreLatest && isNewerVersion(coreLatest, core.version)
57
59
  ? [{ id: 'core', packageName: core.packageName, from: core.version, to: coreLatest }]
58
60
  : []),
59
61
  ...(rt ? [{ id: 'runtime', packageName: rt.packageName, from: rt.from, to: rt.to }] : []),
@@ -62,7 +64,7 @@ export function resolveBaseTargets(assets, runtime, coreLatest, runtimeLatest) {
62
64
  export function resolveRuntimeTarget(runtime, latestVersion) {
63
65
  if (!runtime || runtime.local)
64
66
  return null;
65
- if (!latestVersion || latestVersion === runtime.installedVersion)
67
+ if (!latestVersion || !isNewerVersion(latestVersion, runtime.installedVersion))
66
68
  return null;
67
69
  return { packageName: runtime.packageName, from: runtime.installedVersion, to: latestVersion };
68
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coffer-org/server",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=24"
@@ -24,8 +24,8 @@
24
24
  "postpack": "node ../../scripts/swap-exports.mjs src"
25
25
  },
26
26
  "dependencies": {
27
- "@coffer-org/core": "^2.1.0",
28
- "@coffer-org/sdk": "^2.1.0",
27
+ "@coffer-org/core": "^2.1.2",
28
+ "@coffer-org/sdk": "^2.1.1",
29
29
  "@extractus/oembed-extractor": "^4.1.0",
30
30
  "@fastify/cors": "^11.2.0",
31
31
  "@fastify/multipart": "^10.0.0",