occam-open-cli 4.0.28 → 4.0.34

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/bin/post.js CHANGED
@@ -6,13 +6,13 @@ const { Readable } = require("stream");
6
6
  const { requestUtilities } = require("necessary");
7
7
 
8
8
  const { retrieveHostURL } = require("./configuration"),
9
- { bodyFromResponse } = require("./utilities/response"),
10
9
  { getPackageVersion } = require("./utilities/packageJSON"),
10
+ { contentFromResponse } = require("./utilities/response"),
11
11
  { USER_AGENT, CONTENT_TYPE, OPEN_CLI } = require("./constants"),
12
12
  { APPLICATION_JSON_CHARSET_UTF_8_CONTENT_TYPE } = require("./contentTypes"),
13
13
  { SERVER_ERROR_MESSAGE, SERVER_FAILED_TO_RESPOND_ERROR_MESSAGE } = require("./messages");
14
14
 
15
- const { post: postEx } = requestUtilities;
15
+ const { createPostRequest } = requestUtilities;
16
16
 
17
17
  function post(uri, data, callback) {
18
18
  const host = getHost(),
@@ -22,20 +22,21 @@ function post(uri, data, callback) {
22
22
  versionString
23
23
  }),
24
24
  content = JSON.stringify(json),
25
- query = {};
26
-
27
- const request = postEx(host, uri, query, headers, (error, response) => {
25
+ query = {},
26
+ postRequest = createPostRequest(host, uri, query, headers, (error, response) => {
28
27
  if (error) {
29
28
  console.log(SERVER_FAILED_TO_RESPOND_ERROR_MESSAGE);
30
29
 
31
30
  process.exit(1);
32
31
  }
33
32
 
34
- bodyFromResponse(response, (body) => {
33
+ contentFromResponse(response, (content) => {
35
34
  let json;
36
35
 
37
36
  try {
38
- json = JSON.parse(body);
37
+ const jsonString = content; ///
38
+
39
+ json = JSON.parse(jsonString);
39
40
  } catch (error) {
40
41
  if (error) {
41
42
  console.log(SERVER_FAILED_TO_RESPOND_ERROR_MESSAGE);
@@ -63,7 +64,7 @@ function post(uri, data, callback) {
63
64
  }),
64
65
  readable = Readable.from(content);
65
66
 
66
- readable.pipe(request);
67
+ readable.pipe(postRequest);
67
68
  }
68
69
 
69
70
  module.exports = post;
@@ -2,18 +2,18 @@
2
2
 
3
3
  const { END, DATA, EMPTY_STRING } = require("../constants");
4
4
 
5
- function bodyFromResponse(response, callback) {
6
- let body = EMPTY_STRING;
5
+ function contentFromResponse(response, callback) {
6
+ let content = EMPTY_STRING;
7
7
 
8
8
  response.on(DATA, (data) => {
9
- body += data;
9
+ content += data;
10
10
  });
11
11
 
12
12
  response.on(END, () => {
13
- callback(body);
13
+ callback(content);
14
14
  });
15
15
  }
16
16
 
17
17
  module.exports = {
18
- bodyFromResponse
18
+ contentFromResponse
19
19
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "occam-open-cli",
3
3
  "author": "James Smith",
4
- "version": "4.0.28",
4
+ "version": "4.0.34",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/occam-open-cli",
7
7
  "description": "Occam's command line package management tool.",
@@ -12,12 +12,12 @@
12
12
  "dependencies": {
13
13
  "argumentative": "^2.0.15",
14
14
  "mkdirp": "^0.5.1",
15
- "necessary": "^9.0.4",
16
- "occam-parsers": "^14.0.51"
15
+ "necessary": "^10.0.0",
16
+ "occam-parsers": "^14.0.52"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@swc/core": "^1.2.51",
20
- "watchful-cli": "^1.7.10"
20
+ "watchful-cli": "^1.7.13"
21
21
  },
22
22
  "scripts": {
23
23
  "clean": "rm -rf ./lib",