@lessonkit/xapi 1.0.1 → 1.0.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.
package/dist/index.cjs CHANGED
@@ -211,8 +211,17 @@ function createXAPIClient(opts) {
211
211
  return;
212
212
  }
213
213
  const existing = inflightById.get(statement.id);
214
- if (existing) return;
215
- const flight = Promise.resolve().then(() => transport(statement)).catch(() => {
214
+ if (existing) {
215
+ void existing.then(
216
+ () => void 0,
217
+ () => {
218
+ sendOrQueue(statement);
219
+ }
220
+ );
221
+ return;
222
+ }
223
+ const transportFlight = Promise.resolve().then(() => transport(statement));
224
+ const flight = transportFlight.catch(() => {
216
225
  queue.enqueue(statement);
217
226
  if (isDevEnvironment() && !warnedTransportFailure) {
218
227
  warnedTransportFailure = true;
@@ -223,7 +232,7 @@ function createXAPIClient(opts) {
223
232
  }).finally(() => {
224
233
  inflightById.delete(statement.id);
225
234
  });
226
- inflightById.set(statement.id, flight);
235
+ inflightById.set(statement.id, transportFlight);
227
236
  void flight;
228
237
  };
229
238
  const emit = (event) => {
package/dist/index.js CHANGED
@@ -183,8 +183,17 @@ function createXAPIClient(opts) {
183
183
  return;
184
184
  }
185
185
  const existing = inflightById.get(statement.id);
186
- if (existing) return;
187
- const flight = Promise.resolve().then(() => transport(statement)).catch(() => {
186
+ if (existing) {
187
+ void existing.then(
188
+ () => void 0,
189
+ () => {
190
+ sendOrQueue(statement);
191
+ }
192
+ );
193
+ return;
194
+ }
195
+ const transportFlight = Promise.resolve().then(() => transport(statement));
196
+ const flight = transportFlight.catch(() => {
188
197
  queue.enqueue(statement);
189
198
  if (isDevEnvironment() && !warnedTransportFailure) {
190
199
  warnedTransportFailure = true;
@@ -195,7 +204,7 @@ function createXAPIClient(opts) {
195
204
  }).finally(() => {
196
205
  inflightById.delete(statement.id);
197
206
  });
198
- inflightById.set(statement.id, flight);
207
+ inflightById.set(statement.id, transportFlight);
199
208
  void flight;
200
209
  };
201
210
  const emit = (event) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lessonkit/xapi",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "private": false,
5
5
  "description": "xAPI statement generation primitives for LessonKit.",
6
6
  "license": "Apache-2.0",
@@ -48,11 +48,11 @@
48
48
  "lint": "echo \"(no lint configured yet)\""
49
49
  },
50
50
  "dependencies": {
51
- "@lessonkit/core": "1.0.1"
51
+ "@lessonkit/core": "1.0.2"
52
52
  },
53
53
  "devDependencies": {
54
54
  "tsup": "^8.5.0",
55
55
  "typescript": "^5.8.3",
56
- "vitest": "^3.2.4"
56
+ "vitest": "^4.1.8"
57
57
  }
58
58
  }