@livepreso/api 6.56.0 → 6.56.1

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 (53) hide show
  1. package/.rush/temp/1aebf46f78ad5c45f82f8147751890adb37bef9d.log +10 -0
  2. package/.rush/temp/256021b5963b4c0221d3dec247b697b9691a9b2c.log +10 -0
  3. package/.rush/temp/2a322f00f12cf9d1e64afe81275cc78d01c49050.log +10 -0
  4. package/.rush/temp/30061f1865447dcbb3f20a305061205f3dbe6091.log +10 -0
  5. package/.rush/temp/3cdc82c352e8ed90607952873f3aa4c200490874.log +10 -0
  6. package/.rush/temp/45522aea0dee8cb2be1a53248ba45bd235743b43.log +10 -0
  7. package/.rush/temp/5489ab737e406518983c16c57fc3e1edc07c0341.log +10 -0
  8. package/.rush/temp/58fcbb7f15a76326d40e0839ab179755da82a891.log +10 -0
  9. package/.rush/temp/5bc0bba70b733baa4dd976667ba0a1386e516186.log +10 -0
  10. package/.rush/temp/64f1bb696f8d7d7e72907b80df316b127f72e23e.log +10 -0
  11. package/.rush/temp/6f640f951414ea68adb65c17e4ed7527cde54faf.log +10 -0
  12. package/.rush/temp/7c7b958682d4ab5697530be47d0aac62efe1adf1.log +10 -0
  13. package/.rush/temp/82bfb987463fbcfebf04022e6ed00015c73879c8.log +10 -0
  14. package/.rush/temp/844034aa6e542115075e8f3dc5ffc640973e0064.log +10 -0
  15. package/.rush/temp/8b42957a7c15da1f29cb57bee125f13affa70dca.log +10 -0
  16. package/.rush/temp/924652444ab5a6063f328a2217123a2227058896.log +10 -0
  17. package/.rush/temp/9f2030f96d62f3e38052e35201819a216566f14f.log +10 -0
  18. package/.rush/temp/a769db9d81a23000c0e9b1bf4f1a9a9e721d0d7c.log +10 -0
  19. package/.rush/temp/a87d3a8b4ece87ec66f27c86226a9f205617681f.log +10 -0
  20. package/.rush/temp/bb7a5bdcc4af4ad1507f81f33774b31f5b4e4fb7.log +10 -0
  21. package/.rush/temp/build-cache-tar.log +7 -0
  22. package/.rush/temp/c20e29ccaaa9231b38a28bb24451b4ce7562cdc0.log +10 -0
  23. package/.rush/temp/chunked-rush-logs/api.build.chunks.jsonl +15 -5
  24. package/.rush/temp/chunked-rush-logs/api.test.chunks.jsonl +1 -0
  25. package/.rush/temp/e21303db8f59b4625fd184c9114377d781fd24f8.log +10 -0
  26. package/.rush/temp/e6d303862765b6a5f41dd483d0f9ae083a1fae10.log +10 -0
  27. package/.rush/temp/eaf69fbc059d2f1258d7569136180d4a1d3c7072.log +10 -0
  28. package/.rush/temp/f85d279e2674966daaec83e1c3986a96f86ef304.log +10 -0
  29. package/.rush/temp/fc0a332c5b34c6b90006850cf2d93a48fb4b9a6e.log +10 -0
  30. package/.rush/temp/operation/build/all.log +15 -5
  31. package/.rush/temp/operation/build/error.log +13 -3
  32. package/.rush/temp/operation/build/log-chunks.jsonl +15 -5
  33. package/.rush/temp/operation/build/state.json +1 -1
  34. package/.rush/temp/operation/test/all.log +21 -0
  35. package/.rush/temp/operation/test/log-chunks.jsonl +21 -0
  36. package/.rush/temp/operation/test/state.json +3 -0
  37. package/.rush/temp/package-deps_build.json +185 -0
  38. package/CHANGELOG.json +12 -0
  39. package/CHANGELOG.md +8 -1
  40. package/api.build.log +9 -0
  41. package/api.test.cache.log +1 -0
  42. package/api.test.log +19 -0
  43. package/cjs/models/timing-log.js +17 -17
  44. package/cjs/models/timing-log.js.map +1 -1
  45. package/cjs/sync.js +14 -2
  46. package/cjs/sync.js.map +1 -1
  47. package/package.json +1 -1
  48. package/rush-logs/api.build.error.log +13 -3
  49. package/rush-logs/api.build.log +15 -5
  50. package/rush-logs/api.test.cache.log +1 -0
  51. package/rush-logs/api.test.log +1 -0
  52. package/src/models/timing-log.js +24 -28
  53. package/src/sync.js +14 -2
@@ -1,9 +1,19 @@
1
1
  Invoking: run-p build:*
2
+ npm verbose cli /home/adam/.nvm/versions/node/v24.12.0/bin/node /home/adam/.nvm/versions/node/v24.12.0/bin/npm
3
+ npm info using npm@11.6.2
4
+ npm info using node@v24.12.0
5
+ npm verbose title npm run build:cjs
6
+ npm verbose argv "run" "build:cjs"
7
+ npm verbose logfile logs-max:10 dir:/home/adam/.npm/_logs/2026-02-17T02_45_57_253Z-
8
+ npm verbose logfile /home/adam/.npm/_logs/2026-02-17T02_45_57_253Z-debug-0.log
2
9
 
3
- > @livepreso/api@6.53.0 build:cjs
10
+ > @livepreso/api@6.55.2 build:cjs
4
11
  > BABEL_ENV=cjs babel --delete-dir-on-start src/ --out-dir=cjs/ -s
5
12
 
6
- Browserslist: browsers data (caniuse-lite) is 9 months old. Please run:
7
- npx update-browserslist-db@latest
8
- Why you should do it regularly: https://github.com/browserslist/update-db#readme
9
- Successfully compiled 163 files with Babel (17903ms).
13
+ Successfully compiled 165 files with Babel (6718ms).
14
+ npm verbose cwd /home/adam/Programming/work/livepreso/modules/api
15
+ npm verbose os Linux 6.14.0-29-generic
16
+ npm verbose node v24.12.0
17
+ npm verbose npm v11.6.2
18
+ npm verbose exit 0
19
+ npm info ok
@@ -0,0 +1 @@
1
+ This project does not define the caching behavior of the "test" command, so caching has been disabled.
@@ -0,0 +1 @@
1
+ Invoking: jest --coverage --coverageReporters=json
@@ -5,15 +5,12 @@ import "../collections/users.js";
5
5
 
6
6
  import { DATE_FORMAT, DATE_FORMAT_T } from "../utils.js";
7
7
 
8
- import { Auth } from "../auth.js";
9
8
  import { BaseModel } from "./base.js";
10
- import _ from "lodash";
11
9
  import dedent from "dedent-js";
12
10
  import { getShortURL } from "../utils.js";
13
11
  import log from "../log.js";
14
12
  import moment from "moment";
15
13
  import { register } from "../state-register.js";
16
- import superagent from "superagent";
17
14
 
18
15
  /**
19
16
  * @typedef Event
@@ -104,6 +101,18 @@ export const TimingLogModel = BaseModel.extend(
104
101
  remote_attendee_set: "UserCollection",
105
102
  },
106
103
 
104
+ ajaxConfig() {
105
+ return {
106
+ headers: {
107
+ "content-type": "application/vnd.salespreso+timinglog",
108
+ },
109
+ };
110
+ },
111
+
112
+ toServer() {
113
+ return this.toCompactFormat();
114
+ },
115
+
107
116
  /**
108
117
  * Returns the current timing log model in expected compact format.
109
118
  * @see http://doc.dev.salespreso.com/api/tracking.html#compact-representation
@@ -198,7 +207,9 @@ export const TimingLogModel = BaseModel.extend(
198
207
  * timingLog.addEvent("http://client.salespreso.com/api/sections/28/", moment());
199
208
  * timingLog.addEvent("http://client.salespreso.com/api/slides/100/", "2016-10-27T00:42:47.045186Z");
200
209
  */
201
- addEvent(path, timestamp) {
210
+ addEvent(_path, timestamp) {
211
+ let path = _path;
212
+
202
213
  if (!path) {
203
214
  throw new Error("A path is required");
204
215
  }
@@ -280,33 +291,18 @@ export const TimingLogModel = BaseModel.extend(
280
291
  return Promise.resolve(this.toJSON());
281
292
  }
282
293
 
283
- if (options && options.patch) {
284
- return BaseModel.prototype.save.call(this, data, options);
285
- }
286
-
287
294
  this.checkEventsAscending();
288
295
 
289
- const method = this.isNew() ? "post" : "put";
290
-
291
- return superagent[method](this.url())
292
- .set(Auth.headers)
293
- .type("application/vnd.salespreso+timinglog")
294
- .send(this.toCompactFormat())
295
- .then(({ body }) => {
296
- this.set(_.omit(body, ["events"]));
297
- return body;
298
- })
299
- .catch(superagent.SuperagentPromiseError, (e) => {
300
- if (e.status === 405 && e.res.body.detail.indexOf("end") > -1) {
301
- // Don't send timing log events if the tracking is ended.
302
- throw e;
303
- }
304
-
305
- if ((e.status >= 400 && e.status <= 499) || e.status === 503) {
306
- e.message += `\nBody: ${JSON.stringify(e.res.body)}`;
307
- }
296
+ return BaseModel.prototype.save.call(this, data, options).catch((e) => {
297
+ if (e.status === 405 && e.response?.body?.detail?.indexOf("end") > -1) {
308
298
  throw e;
309
- });
299
+ }
300
+
301
+ if ((e.status >= 400 && e.status <= 499) || e.status === 503) {
302
+ e.message += `\nBody: ${JSON.stringify(e.response?.body)}`;
303
+ }
304
+ throw e;
305
+ });
310
306
  },
311
307
  },
312
308
  );
package/src/sync.js CHANGED
@@ -142,13 +142,25 @@ export const ajaxSync = function (method, model, options) {
142
142
  // Combine generated headers with user's headers.
143
143
  if (ajaxConfig.headers) {
144
144
  for (const key in ajaxConfig.headers) {
145
- request.header[key.toLowerCase()] = ajaxConfig.headers[key];
145
+ const lowerKey = key.toLowerCase();
146
+ // Use superagent's .type() method to explicitly set content-type
147
+ // This ensures superagent respects the content-type and doesn't override it
148
+ if (lowerKey === "content-type") {
149
+ request.type(ajaxConfig.headers[key].split(";")[0]);
150
+ } else {
151
+ request.header[lowerKey] = ajaxConfig.headers[key];
152
+ }
146
153
  }
147
154
  }
148
155
 
149
156
  if (options.headers) {
150
157
  for (const key in options.headers) {
151
- request.header[key.toLowerCase()] = options.headers[key];
158
+ const lowerKey = key.toLowerCase();
159
+ if (lowerKey === "content-type") {
160
+ request.type(options.headers[key].split(";")[0]);
161
+ } else {
162
+ request.header[lowerKey] = options.headers[key];
163
+ }
152
164
  }
153
165
  }
154
166