podverse-external-services 5.0.1 → 5.0.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.
package/README.md CHANGED
@@ -2,18 +2,36 @@
2
2
 
3
3
  A collection of helpers for interacting with 3rd party external services, like AWS and Podcast Index API.
4
4
 
5
- ## Developing Podverse modules
5
+ ## Dev Setup
6
6
 
7
- Podverse maintains several different modules which are imported across apps. Please read [Developing Podverse modules](https://github.com/podverse/podverse-ops/blob/master/docs/how-to-develop-podverse-modules.md) for a workflow you can use to make code changes to this module locally.
7
+ ### Environment Variables
8
8
 
9
- ## Setup
9
+ The environment variables for this module must be set within the app that consumes this module (ex. `podverse-api` or `podverse-workers`). See `podverse-external-services/config/index.ts` for a list of the env vars expected.
10
10
 
11
- ```sh
12
- yarn
11
+ ### Local Dev Workflow
12
+
13
+ Podverse uses many modules that are maintained in separate repos, and they need to be linked and running for a local dev workflow. Please read the `podverse-ops/dev/local-dev-setup.md` file to set up the required dependencies and module linking.
14
+
15
+ ### Running Locally
16
+
17
+ Install the node_modules:
18
+
19
+ ```
20
+ npm install
21
+ ```
22
+
23
+ Then to build:
24
+
25
+ ```
26
+ npm run build
13
27
  ```
14
28
 
15
- ## Development
29
+ Or if you want the app to auto-build on saved changes:
16
30
 
17
- ```sh
18
- yarn dev:watch
19
31
  ```
32
+ npm run build:watch
33
+ ```
34
+
35
+ ## Publishing
36
+
37
+ To publish your changes to npm, increment the version number is `package.json` then run `npm publish`.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/podcast-index/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAA;AAIlF,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,GAAG,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAED,KAAK,UAAU,GAAG;IAChB,KAAK,EAAE,YAAY,CAAA;IACnB,YAAY,EAAE,kBAAkB,EAAE,CAAA;IAClC,iBAAiB,EAAE,oBAAoB,EAAE,CAAA;CAC1C,CAAA;AAED,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,QAAe,MAAM,kBAa1C;IAED,sBAAsB,uBAuBrB;IAED,kCAAkC,mBAA0B,MAAM,kBAIjE;IAED,0CAA0C,mBAA0B,MAAM,kBAYzE;IAED,+BAA+B,mBAA0B,MAAM,kBAG9D;IAED,8BAA8B,OAAc,MAAM,kBAGjD;IAED,mCAAmC,OAAc,MAAM,oBAItD;IAED,6CAA6C,+BACf,MAAM,EAAE,uBAAgB,QAAQ,MAAM,EAAE,CAAC,CAatE;IAED,kCAAkC,0BAMjC;IAED,kCAAkC,eAAgB,UAAU,WAoB3D;IAED,gCAAgC,gBAAuB,MAAM,kBAe5D;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/podcast-index/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAA;AAElF,KAAK,YAAY,GAAG;IAClB,I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17,6 @@ const sha1_1 = __importDefault(require("crypto-js/sha1"));
17
17
  const enc_hex_1 = __importDefault(require("crypto-js/enc-hex"));
18
18
  const http_errors_1 = __importDefault(require("http-errors"));
19
19
  const podverse_helpers_1 = require("podverse-helpers");
20
- console.log('podcast index!!!');
21
20
  /*
22
21
  NOTE!!!
23
22
  The episodeGuid needs to be encoded both on the client-side and server side if it is an http url guid.
@@ -38,19 +37,17 @@ class PodcastIndexService {
38
37
  });
39
38
  });
40
39
  this.getRecentlyUpdatedData = () => __awaiter(this, void 0, void 0, function* () {
40
+ podverse_helpers_1.logger.info('getRecentlyUpdatedData beginning...');
41
41
  const currentTimeInSeconds = Math.floor(Date.now() / 1000);
42
42
  const sinceRange = 1800; // 30 minutes
43
43
  const sinceTimeInSeconds = currentTimeInSeconds - sinceRange;
44
- const fetchData = (since, allData = []) => __awaiter(this, void 0, void 0, function* () {
44
+ const fetchData = (since_1, ...args_1) => __awaiter(this, [since_1, ...args_1], void 0, function* (since, allData = []) {
45
45
  const url = `${this.baseUrl}/recent/data?max=5000&since=${since}`;
46
46
  const response = yield this.podcastIndexAPIRequest(url);
47
47
  const updatedFeeds = response.data.feeds;
48
48
  const nextSince = response.nextSince;
49
49
  allData = allData.concat(updatedFeeds);
50
- console.log('nextSince', nextSince);
51
- console.log('currentTimeInSeconds', currentTimeInSeconds);
52
50
  if (nextSince && nextSince <= currentTimeInSeconds) {
53
- console.log('fetching more...');
54
51
  return fetchData(nextSince, allData);
55
52
  }
56
53
  return allData;
@@ -88,7 +85,7 @@ class PodcastIndexService {
88
85
  const pvValueTagArray = this.convertPIValueTagToPVValueTagArray(podcast.feed.value);
89
86
  return pvValueTagArray;
90
87
  });
91
- this.getValueTagEnabledPodcastIdsFromPIRecursively = (accumulatedPodcastIndexIds, startAt = 1) => __awaiter(this, void 0, void 0, function* () {
88
+ this.getValueTagEnabledPodcastIdsFromPIRecursively = (accumulatedPodcastIndexIds_1, ...args_1) => __awaiter(this, [accumulatedPodcastIndexIds_1, ...args_1], void 0, function* (accumulatedPodcastIndexIds, startAt = 1) {
92
89
  const url = `${this.baseUrl}/podcasts/bytag?podcast-value=true&max=5000&start_at=${startAt}`;
93
90
  const data = yield this.podcastIndexAPIRequest(url);
94
91
  for (const feed of data.feeds) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podverse-external-services",
3
- "version": "5.0.1",
3
+ "version": "5.0.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "dist/**/*"
9
9
  ],
10
10
  "scripts": {
11
- "dev:watch": "nodemon --watch 'src' --watch $(realpath node_modules/podverse-helpers) --delay 500ms -x \"npm run build\"",
11
+ "build:watch": "nodemon --watch 'src' --watch $(realpath node_modules/podverse-helpers) --delay 500ms -x \"npm run build\"",
12
12
  "build": "tsc",
13
13
  "lint": "eslint ./src --ext .ts",
14
14
  "prepare": "npm run build",