@evomap/evolver-adapter-public 2.0.12 → 2.0.16

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.
@@ -147,10 +147,20 @@ export class HubLearningPacketSink {
147
147
  redirect: 'manual',
148
148
  body: JSON.stringify(learningPacketWireBody(draft, this.opts.nodeId?.())),
149
149
  });
150
- if (res.status === 201) {
150
+ // Hub route returns 201 Created. The public website BFF/proxy in front of
151
+ // /api/learning-packets has been observed to surface the same body as 200.
152
+ // Accept both when a packet id is present so a successful write is never
153
+ // reported as hub 200 rejection (which previously made every live upload
154
+ // look failed while the row was already stored).
155
+ if (res.status === 201 || res.status === 200) {
151
156
  const body = await res.json().catch(() => null);
152
157
  const packet = body && typeof body === 'object' ? body.packet : undefined;
153
- return { accepted: true, ...(typeof packet?.id === 'string' ? { reason: packet.id } : {}) };
158
+ if (typeof packet?.id === 'string') {
159
+ return { accepted: true, reason: packet.id };
160
+ }
161
+ if (res.status === 201)
162
+ return { accepted: true };
163
+ // Bare 200 without a packet body is not a create success we can claim.
154
164
  }
155
165
  if (res.status === 409)
156
166
  return { accepted: true, reason: 'duplicate_source' };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evomap/evolver-adapter-public",
3
- "version": "2.0.12",
3
+ "version": "2.0.16",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "engines": {
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@evomap/atp-sdk": "^0.1.0",
20
- "@evomap/evolver-core": "2.0.12",
20
+ "@evomap/evolver-core": "2.0.16",
21
21
  "undici": "^6.27.0"
22
22
  },
23
23
  "optionalDependencies": {