podverse-external-services 5.1.1-alpha.1 → 5.1.1-alpha.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/podcast-index/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAG9D,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AASD,qBAAa,mBAAmB;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;gBAEZ,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,WAAW;IAMzD,sBAAsB,GAAU,KAAK,MAAM,EAAE,SAAS,GAAG,kBAcxD;IAED,sBAAsB,uBA6BrB;IAED,gBAAgB,GAAU,aAAa,MAAM,KAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAYpF;IAED,uCAAuC,GACrC,4BAA4B,MAAM,EAAE,EAAE,gBAAW,KAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAatE;IAED,4BAA4B,QAAa,OAAO,CAAC,MAAM,EAAE,CAAC,CAMzD;IAED,qBAAqB,QAAa,OAAO,CAAC,GAAG,EAAE,CAAC,CAwC/C;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/podcast-index/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAG9D,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AASD,qBAAa,mBAAmB;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;gBAEZ,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,WAAW;IAMzD,sBAAsB,GAAU,KAAK,MAAM,EAAE,SAAS,GAAG,kBAkDxD;IAED,sBAAsB,uBA6BrB;IAED,gBAAgB,GAAU,aAAa,MAAM,KAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAYpF;IAED,uCAAuC,GACrC,4BAA4B,MAAM,EAAE,EAAE,gBAAW,KAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAatE;IAED,4BAA4B,QAAa,OAAO,CAAC,MAAM,EAAE,CAAC,CAMzD;IAED,qBAAqB,QAAa,OAAO,CAAC,GAAG,EAAE,CAAC,CAwC/C;CACF"}
@@ -29,13 +29,51 @@ const config_1 = require("@external-services/config");
29
29
  class PodcastIndexService {
30
30
  constructor({ authKey, baseUrl, secretKey }) {
31
31
  this.podcastIndexAPIRequest = (url, config) => __awaiter(this, void 0, void 0, function* () {
32
- const apiHeaderTime = new Date().getTime() / 1000;
32
+ var _a, _b, _c;
33
+ const apiHeaderTime = Math.floor(Date.now() / 1000);
33
34
  const hash = (0, sha1_1.default)(this.authKey + this.secretKey + apiHeaderTime).toString(enc_hex_1.default);
34
- return (0, podverse_helpers_1.request)(url, Object.assign({ headers: {
35
+ podverse_helpers_1.logger.info('[PodcastIndex] Request details', {
36
+ url,
37
+ apiHeaderTime,
38
+ authKey: this.authKey,
39
+ baseUrl: this.baseUrl,
40
+ secretKeyPresent: !!this.secretKey,
41
+ headers: {
35
42
  'X-Auth-Key': this.authKey,
36
43
  'X-Auth-Date': apiHeaderTime,
37
44
  Authorization: hash
38
- } }, config));
45
+ },
46
+ config
47
+ });
48
+ // Log system time for drift debugging
49
+ podverse_helpers_1.logger.info('[PodcastIndex] System time (UTC)', {
50
+ iso: new Date().toISOString(),
51
+ epoch: Math.floor(Date.now() / 1000)
52
+ });
53
+ try {
54
+ const response = yield (0, podverse_helpers_1.request)(url, Object.assign({ headers: {
55
+ 'X-Auth-Key': this.authKey,
56
+ 'X-Auth-Date': apiHeaderTime,
57
+ Authorization: hash
58
+ } }, config));
59
+ podverse_helpers_1.logger.info('[PodcastIndex] Response received', {
60
+ status: response === null || response === void 0 ? void 0 : response.status,
61
+ statusText: response === null || response === void 0 ? void 0 : response.statusText,
62
+ dataKeys: (response === null || response === void 0 ? void 0 : response.data) ? Object.keys(response.data) : undefined
63
+ });
64
+ return response;
65
+ }
66
+ catch (error) {
67
+ podverse_helpers_1.logger.error('[PodcastIndex] Request failed', {
68
+ url,
69
+ errorMessage: error === null || error === void 0 ? void 0 : error.message,
70
+ errorStack: error === null || error === void 0 ? void 0 : error.stack,
71
+ errorResponse: (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data,
72
+ errorStatus: (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.status,
73
+ errorHeaders: (_c = error === null || error === void 0 ? void 0 : error.response) === null || _c === void 0 ? void 0 : _c.headers
74
+ });
75
+ throw error;
76
+ }
39
77
  });
40
78
  this.getRecentlyUpdatedData = () => __awaiter(this, void 0, void 0, function* () {
41
79
  podverse_helpers_1.logger.info('getRecentlyUpdatedData beginning...');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podverse-external-services",
3
- "version": "5.1.1-alpha.1",
3
+ "version": "5.1.1-alpha.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  "module-alias": "^2.2.3",
35
35
  "paypal-rest-sdk": "2.0.0-rc.2",
36
36
  "podcast-partytime": "^4.8.3",
37
- "podverse-helpers": "^5.1.2-alpha.2",
37
+ "podverse-helpers": "^5.1.2-alpha.3",
38
38
  "web-push": "^3.6.3"
39
39
  }
40
40
  }