tigger 0.0.26 → 0.0.28

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 (39) hide show
  1. package/.swcrc +5 -0
  2. package/bin/example/operation/alterIssue.js +1 -1
  3. package/bin/example/operation/createComment.js +1 -1
  4. package/bin/example/operation/createIssue.js +1 -1
  5. package/bin/example/operation/editComment.js +1 -1
  6. package/bin/example/operation/editIssue.js +1 -1
  7. package/bin/example/operation/getBaseTreeSHA.js +1 -1
  8. package/bin/example/operation/getComments.js +1 -1
  9. package/bin/example/operation/getIssue.js +1 -1
  10. package/bin/example/operation/getIssues.js +1 -1
  11. package/bin/example/operation/getLatestCommitSHA.js +1 -1
  12. package/bin/example/operation/postCommitSHA.js +1 -1
  13. package/bin/example/operation/postCommitTreeSHA.js +1 -1
  14. package/bin/example/operation/postMetaJSONFileContent.js +1 -1
  15. package/bin/example/operation/postReadmeFileContent.js +1 -1
  16. package/bin/example/operation/postUpdatedHead.js +1 -1
  17. package/bin/example/operation/removeComment.js +1 -1
  18. package/lib/constants.js +42 -0
  19. package/lib/index.js +35 -0
  20. package/lib/uris.js +46 -0
  21. package/lib/utilities/comment.js +66 -0
  22. package/lib/utilities/commit.js +97 -0
  23. package/lib/utilities/headers.js +46 -0
  24. package/lib/utilities/issue.js +81 -0
  25. package/lib/utilities/repository.js +46 -0
  26. package/lib/utilities/request.js +76 -0
  27. package/package.json +18 -2
  28. package/src/constants.js +9 -0
  29. package/src/index.js +6 -0
  30. package/src/uris.js +10 -0
  31. package/{bin → src}/utilities/comment.js +10 -10
  32. package/{bin → src}/utilities/commit.js +14 -14
  33. package/{bin → src}/utilities/headers.js +4 -9
  34. package/{bin → src}/utilities/issue.js +10 -10
  35. package/{bin → src}/utilities/repository.js +5 -6
  36. package/{bin → src}/utilities/request.js +8 -15
  37. package/bin/constants.js +0 -19
  38. package/bin/uris.js +0 -21
  39. package/index.js +0 -13
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get default () {
13
+ return _default;
14
+ },
15
+ get isRepositoryValid () {
16
+ return isRepositoryValid;
17
+ },
18
+ get ownerFromRepository () {
19
+ return ownerFromRepository;
20
+ },
21
+ get repoFromRepository () {
22
+ return repoFromRepository;
23
+ }
24
+ });
25
+ var _necessary = require("necessary");
26
+ var second = _necessary.arrayUtilities.second;
27
+ var repoRegularExpression = /([^\/]+)$/, ownerRegularExpression = /([^\/]+)\/[^\/]+$/;
28
+ function isRepositoryValid(repository) {
29
+ var repoPresent = repoRegularExpression.test(repository), ownerPresent = ownerRegularExpression.test(repository), repositoryValid = repoPresent && ownerPresent;
30
+ return repositoryValid;
31
+ }
32
+ function repoFromRepository(repository) {
33
+ var matches = repository.match(repoRegularExpression), secondMatch = second(matches), repo = secondMatch; ///
34
+ return repo;
35
+ }
36
+ function ownerFromRepository(repository) {
37
+ var matches = repository.match(ownerRegularExpression), secondMatch = second(matches), owner = secondMatch; ///
38
+ return owner;
39
+ }
40
+ var _default = {
41
+ isRepositoryValid: isRepositoryValid,
42
+ repoFromRepository: repoFromRepository,
43
+ ownerFromRepository: ownerFromRepository
44
+ };
45
+
46
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvcmVwb3NpdG9yeS5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuaW1wb3J0IHsgYXJyYXlVdGlsaXRpZXMgfSBmcm9tIFwibmVjZXNzYXJ5XCI7XG5cbmNvbnN0IHsgc2Vjb25kIH0gPSBhcnJheVV0aWxpdGllcztcblxuY29uc3QgcmVwb1JlZ3VsYXJFeHByZX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sVUFDckJJLFFBQVFGLGFBQWEsR0FBRztJQUU5QixPQUFPRTtBQUNUO0lBRUEsV0FBZTtJQUNiaEIsbUJBQUFBO0lBQ0FFLG9CQUFBQTtJQUNBRCxxQkFBQUE7QUFDRiJ9
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get deleteRequest () {
13
+ return deleteRequest;
14
+ },
15
+ get getRequest () {
16
+ return getRequest;
17
+ },
18
+ get patchRequest () {
19
+ return patchRequest;
20
+ },
21
+ get postRequest () {
22
+ return postRequest;
23
+ }
24
+ });
25
+ var _stream = require("stream");
26
+ var _necessary = require("necessary");
27
+ var _constants = require("../constants");
28
+ var _headers = require("../utilities/headers");
29
+ var createRequest = _necessary.requestUtilities.createRequest, GET_METHOD = _necessary.methods.GET_METHOD, POST_METHOD = _necessary.methods.POST_METHOD, DELETE_METHOD = _necessary.methods.DELETE_METHOD, PATCH_METHOD = _necessary.methods.PATCH_METHOD;
30
+ function getRequest(uri, query, userAgent, clientId, clientSecret, callback) {
31
+ var host = _constants.GITHUB_API_HOST, method = GET_METHOD, headers = (0, _headers.headersFromUserAgentClientIdAndClientSecret)(userAgent, clientId, clientSecret), request = createRequest(host, uri, query, method, headers, function(error, response) {
32
+ contentFromResponse(response, function(content) {
33
+ var jsonString = content, json = JSON.parse(jsonString);
34
+ callback(error, json);
35
+ });
36
+ });
37
+ request.end();
38
+ }
39
+ function postRequest(uri, query, content, userAgent, gitHubAccessToken, callback) {
40
+ var host = _constants.GITHUB_API_HOST, method = POST_METHOD, headers = (0, _headers.headersFromUserAgentAndGitHubAccessToken)(userAgent, gitHubAccessToken), postRequest = createRequest(host, uri, query, method, headers, function(error, response) {
41
+ contentFromResponse(response, function(content) {
42
+ var jsonString = content, json = JSON.parse(jsonString);
43
+ callback(error, json);
44
+ });
45
+ }), readable = _stream.Readable.from(content);
46
+ readable.pipe(postRequest);
47
+ }
48
+ function patchRequest(uri, query, content, userAgent, gitHubAccessToken, callback) {
49
+ var host = _constants.GITHUB_API_HOST, method = PATCH_METHOD, headers = (0, _headers.headersFromUserAgentAndGitHubAccessToken)(userAgent, gitHubAccessToken), postRequest = createRequest(host, uri, query, method, headers, function(error, response) {
50
+ contentFromResponse(response, function(content) {
51
+ var jsonString = content, json = JSON.parse(jsonString);
52
+ callback(error, json);
53
+ });
54
+ }), readable = _stream.Readable.from(content);
55
+ readable.pipe(postRequest);
56
+ }
57
+ function deleteRequest(uri, query, userAgent, gitHubAccessToken, callback) {
58
+ var host = _constants.GITHUB_API_HOST, method = DELETE_METHOD, headers = (0, _headers.headersFromUserAgentAndGitHubAccessToken)(userAgent, gitHubAccessToken), deleteRequest = createRequest(host, uri, query, method, headers, function(error, response) {
59
+ contentFromResponse(response, function(content) {
60
+ var string = content; ///
61
+ callback(error, string);
62
+ });
63
+ });
64
+ deleteRequest.end();
65
+ }
66
+ function contentFromResponse(response, callback) {
67
+ var content = _constants.EMPTY_STRING;
68
+ response.on(_constants.DATA, function(data) {
69
+ content += data;
70
+ });
71
+ response.on(_constants.END, function() {
72
+ callback(content);
73
+ });
74
+ }
75
+
76
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvcmVxdWVzdC5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuaW1wb3J0IHsgUmVhZGFibGUgfSBmcm9tIFwic3RyZWFtXCI7XG5pbXBvcnQgeyBtZXRob2RzLCByZXF1ZXN0VXRpbGl0aWVzIH0gZnJvbSBcIm5lY2Vzc2FyeVwiO1xuXG5pbXBvcnQgeyBFTkQsIERBVEEsIEVNUFRZX1NUUklORywgR0lUSFVCX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ENBQUNsQztBQUNoQjtBQUVPLFNBQVNILGNBQWNXLEdBQUcsRUFBRUMsS0FBSyxFQUFFQyxTQUFTLEVBQUVtQixpQkFBaUIsRUFBRWhCLFFBQVE7SUFDOUUsSUFBTUMsT0FBT0MsMEJBQWUsRUFDdEJDLFNBQVNWLGVBQ1RXLFVBQVVhLElBQUFBLGlEQUF3QyxFQUFDcEIsV0FBV21CLG9CQUM5RGhDLGdCQUFnQkksY0FBY2EsTUFBTU4sS0FBS0MsT0FBT08sUUFBUUMsU0FBUyxTQUFDRyxPQUFPQztRQUN2RUMsb0JBQW9CRCxVQUFVLFNBQUNFO1lBQzdCLElBQU1ZLFNBQVNaLFNBQVUsR0FBRztZQUU1QlYsU0FBU08sT0FBT2U7UUFDbEI7SUFDRjtJQUVOdEMsY0FBYytCLEdBQUc7QUFDbkI7QUFFQSxTQUFTTixvQkFBb0JELFFBQVEsRUFBRVIsUUFBUTtJQUM3QyxJQUFJVSxVQUFVYSx1QkFBWTtJQUUxQmYsU0FBU2dCLEVBQUUsQ0FBQ0MsZUFBSSxFQUFFLFNBQUNDO1FBQ2pCaEIsV0FBV2dCO0lBQ2I7SUFFQWxCLFNBQVNnQixFQUFFLENBQUNHLGNBQUcsRUFBRTtRQUNmM0IsU0FBU1U7SUFDWDtBQUNGIn0=
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tigger",
3
3
  "author": "James Smith",
4
- "version": "0.0.26",
4
+ "version": "0.0.28",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/tigger",
7
7
  "description": "Tales the fun out of using the GitHub API.",
@@ -9,8 +9,24 @@
9
9
  "type": "git",
10
10
  "url": "https://github.com/djalbat/tigger"
11
11
  },
12
+ "devDependencies": {
13
+ "@swc/core": "1.13.20",
14
+ "watchful-cli": "^1.7.61"
15
+ },
12
16
  "dependencies": {
13
17
  "necessary": "^15.0.6"
14
18
  },
15
- "scripts": {}
19
+ "scripts": {
20
+ "clean": "rm -rf ./lib",
21
+ "watchful": "watchful -m --transpiler=swc --source-directory=./src --lib-directory=./lib --pause=100",
22
+ "batch": "npm run watchful batch --",
23
+ "batch-debug": "npm run watchful batch -- --debug",
24
+ "incremental": "npm run watchful incremental --",
25
+ "incremental-debug": "npm run watchful incremental -- --debug",
26
+ "build": "npm run clean && npm run batch",
27
+ "build-debug": "npm run clean && npm run batch-debug",
28
+ "watch": "npm run clean && npm run batch && npm run incremental",
29
+ "watch-debug": "npm run clean && npm run batch-debug && npm run incremental-debug"
30
+ },
31
+ "main": "./lib/index.js"
16
32
  }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ export const END = "end";
4
+ export const DATA = "data";
5
+ export const BLOB_TYPE = "blob";
6
+ export const BLOB_MODE = "100644";
7
+ export const EMPTY_STRING = "";
8
+ export const GITHUB_API_HOST = "https://api.github.com";
9
+ export const APPLICATION_VND_GITHUB_VS_JSON = "application/vnd.github.v3+json";
package/src/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ export { default as issueUtilities } from "./utilities/issue";
4
+ export { default as commitUtilities } from "./utilities/commit";
5
+ export { default as commentUtilities } from "./utilities/comment";
6
+ export { default as repositoryUtilities } from "./utilities/repository";
package/src/uris.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ export const GITHUB_REPOS_URI = "/repos";
4
+ export const GITHUB_ISSUES_URI = "/issues";
5
+ export const GITHUB_COMMENTS_URI = "/comments";
6
+ export const GITHUB_GIT_TREES_URI = "/git/trees";
7
+ export const GITHUB_GIT_BLOBS_URI = "/git/blobs";
8
+ export const GITHUB_GIT_COMMITS_URI = "/git/commits";
9
+ export const GITHUB_ISSUES_COMMENTS_URI = "/issues/comments";
10
+ export const GITHUB_GIT_REFS_HEADS_MASTER_URI = "/git/refs/heads/master";
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
 
3
- const { encodings } = require("necessary");
3
+ import { encodings } from "necessary";
4
4
 
5
- const { repoFromRepository, ownerFromRepository } = require("../utilities/repository"),
6
- { getRequest, postRequest, patchRequest, deleteRequest } = require("../utilities/request"),
7
- { GITHUB_REPOS_URI, GITHUB_ISSUES_URI, GITHUB_COMMENTS_URI, GITHUB_ISSUES_COMMENTS_URI } = require("../uris");
5
+ import { repoFromRepository, ownerFromRepository } from "../utilities/repository";
6
+ import { getRequest, postRequest, patchRequest, deleteRequest } from "../utilities/request";
7
+ import { GITHUB_REPOS_URI, GITHUB_ISSUES_URI, GITHUB_COMMENTS_URI, GITHUB_ISSUES_COMMENTS_URI } from "../uris";
8
8
 
9
9
  const { UTF_8_ENCODING } = encodings;
10
10
 
11
- function commentsGetRequest(repository, issueNumber, userAgent, clientId, clientSecret, callback) {
11
+ export function commentsGetRequest(repository, issueNumber, userAgent, clientId, clientSecret, callback) {
12
12
  const owner = ownerFromRepository(repository),
13
13
  repo = repoFromRepository(repository),
14
14
  uri = `${GITHUB_REPOS_URI}/${owner}/${repo}${GITHUB_ISSUES_URI}/${issueNumber}${GITHUB_COMMENTS_URI}`,
@@ -17,7 +17,7 @@ function commentsGetRequest(repository, issueNumber, userAgent, clientId, client
17
17
  getRequest(uri, query, userAgent, clientId, clientSecret, callback);
18
18
  }
19
19
 
20
- function editCommentPatchRequest(repository, description, commentIdentifier, userAgent, gitHubAccessToken, callback) {
20
+ export function editCommentPatchRequest(repository, description, commentIdentifier, userAgent, gitHubAccessToken, callback) {
21
21
  const owner = ownerFromRepository(repository),
22
22
  repo = repoFromRepository(repository),
23
23
  uri = `${GITHUB_REPOS_URI}/${owner}/${repo}${GITHUB_ISSUES_COMMENTS_URI}/${commentIdentifier}`,
@@ -34,7 +34,7 @@ function editCommentPatchRequest(repository, description, commentIdentifier, use
34
34
  patchRequest(uri, query, body, userAgent, gitHubAccessToken, callback);
35
35
  }
36
36
 
37
- function createCommentPostRequest(repository, description, issueNumber, userAgent, gitHubAccessToken, callback) {
37
+ export function createCommentPostRequest(repository, description, issueNumber, userAgent, gitHubAccessToken, callback) {
38
38
  const owner = ownerFromRepository(repository),
39
39
  repo = repoFromRepository(repository),
40
40
  uri = `${GITHUB_REPOS_URI}/${owner}/${repo}${GITHUB_ISSUES_URI}/${issueNumber}${GITHUB_COMMENTS_URI}`,
@@ -51,7 +51,7 @@ function createCommentPostRequest(repository, description, issueNumber, userAgen
51
51
  postRequest(uri, query, body, userAgent, gitHubAccessToken, callback);
52
52
  }
53
53
 
54
- function removeCommentDeleteRequest(repository, commentIdentifier, userAgent, gitHubAccessToken, callback) {
54
+ export function removeCommentDeleteRequest(repository, commentIdentifier, userAgent, gitHubAccessToken, callback) {
55
55
  const owner = ownerFromRepository(repository),
56
56
  repo = repoFromRepository(repository),
57
57
  uri = `${GITHUB_REPOS_URI}/${owner}/${repo}${GITHUB_ISSUES_COMMENTS_URI}/${commentIdentifier}`,
@@ -60,9 +60,9 @@ function removeCommentDeleteRequest(repository, commentIdentifier, userAgent, gi
60
60
  deleteRequest(uri, query, userAgent, gitHubAccessToken, callback);
61
61
  }
62
62
 
63
- module.exports = {
63
+ export default {
64
64
  commentsGetRequest,
65
65
  editCommentPatchRequest,
66
66
  createCommentPostRequest,
67
67
  removeCommentDeleteRequest
68
- };
68
+ };
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
 
3
- const { encodings } = require("necessary");
3
+ import { encodings } from "necessary";
4
4
 
5
- const { BLOB_MODE, BLOB_TYPE } = require("../constants"),
6
- { getRequest, postRequest } = require("../utilities/request"),
7
- { repoFromRepository, ownerFromRepository } = require("../utilities/repository"),
8
- { GITHUB_REPOS_URI, GITHUB_GIT_TREES_URI, GITHUB_GIT_BLOBS_URI, GITHUB_GIT_COMMITS_URI, GITHUB_GIT_REFS_HEADS_MASTER_URI } = require("../uris");
5
+ import { BLOB_MODE, BLOB_TYPE } from "../constants";
6
+ import { getRequest, postRequest } from "../utilities/request";
7
+ import { repoFromRepository, ownerFromRepository } from "../utilities/repository";
8
+ import { GITHUB_REPOS_URI, GITHUB_GIT_TREES_URI, GITHUB_GIT_BLOBS_URI, GITHUB_GIT_COMMITS_URI, GITHUB_GIT_REFS_HEADS_MASTER_URI } from "../uris";
9
9
 
10
10
  const { UTF_8_ENCODING } = encodings;
11
11
 
12
- function commitSHAPostRequest(repository, commitMessage, commitTreeSHA, latestCommitSHA, userAgent, gitHubAccessToken, callback) {
12
+ export function commitSHAPostRequest(repository, commitMessage, commitTreeSHA, latestCommitSHA, userAgent, gitHubAccessToken, callback) {
13
13
  const owner = ownerFromRepository(repository),
14
14
  repo = repoFromRepository(repository),
15
15
  uri = `${GITHUB_REPOS_URI}/${owner}/${repo}${GITHUB_GIT_COMMITS_URI}`,
@@ -29,7 +29,7 @@ function commitSHAPostRequest(repository, commitMessage, commitTreeSHA, latestCo
29
29
  postRequest(uri, query, body, userAgent, gitHubAccessToken, callback);
30
30
  }
31
31
 
32
- function baseTreeSHAGetRequest(repository, latestCommitSHA, userAgent, clientId, clientSecret, callback) {
32
+ export function baseTreeSHAGetRequest(repository, latestCommitSHA, userAgent, clientId, clientSecret, callback) {
33
33
  const owner = ownerFromRepository(repository),
34
34
  repo = repoFromRepository(repository),
35
35
  uri = `${GITHUB_REPOS_URI}/${owner}/${repo}${GITHUB_GIT_COMMITS_URI}/${latestCommitSHA}`,
@@ -38,7 +38,7 @@ function baseTreeSHAGetRequest(repository, latestCommitSHA, userAgent, clientId,
38
38
  getRequest(uri, query, userAgent, clientId, clientSecret, callback);
39
39
  }
40
40
 
41
- function updatedHeadPostRequest(repository, commitSHA, userAgent, gitHubAccessToken, callback) {
41
+ export function updatedHeadPostRequest(repository, commitSHA, userAgent, gitHubAccessToken, callback) {
42
42
  const owner = ownerFromRepository(repository),
43
43
  repo = repoFromRepository(repository),
44
44
  uri = `${GITHUB_REPOS_URI}/${owner}/${repo}${GITHUB_GIT_REFS_HEADS_MASTER_URI}`,
@@ -51,7 +51,7 @@ function updatedHeadPostRequest(repository, commitSHA, userAgent, gitHubAccessTo
51
51
  postRequest(uri, query, body, userAgent, gitHubAccessToken, callback);
52
52
  }
53
53
 
54
- function commitTreeSHAPostRequest(repository, baseTreeSHA, fileSHAs, filePaths, userAgent, gitHubAccessToken, callback) {
54
+ export function commitTreeSHAPostRequest(repository, baseTreeSHA, fileSHAs, filePaths, userAgent, gitHubAccessToken, callback) {
55
55
  const owner = ownerFromRepository(repository),
56
56
  repo = repoFromRepository(repository),
57
57
  uri = `${GITHUB_REPOS_URI}/${owner}/${repo}${GITHUB_GIT_TREES_URI}`,
@@ -82,7 +82,7 @@ function commitTreeSHAPostRequest(repository, baseTreeSHA, fileSHAs, filePaths,
82
82
  postRequest(uri, query, body, userAgent, gitHubAccessToken, callback);
83
83
  }
84
84
 
85
- function latestCommitSHAGetRequest(repository, userAgent, clientId, clientSecret, callback) {
85
+ export function latestCommitSHAGetRequest(repository, userAgent, clientId, clientSecret, callback) {
86
86
  const owner = ownerFromRepository(repository),
87
87
  repo = repoFromRepository(repository),
88
88
  uri = `${GITHUB_REPOS_URI}/${owner}/${repo}${GITHUB_GIT_REFS_HEADS_MASTER_URI}`,
@@ -91,7 +91,7 @@ function latestCommitSHAGetRequest(repository, userAgent, clientId, clientSecret
91
91
  getRequest(uri, query, userAgent, clientId, clientSecret, callback);
92
92
  }
93
93
 
94
- function contentBlobSHAPostRequest(repository, content, userAgent, gitHubAccessToken, callback) {
94
+ export function contentBlobSHAPostRequest(repository, content, userAgent, gitHubAccessToken, callback) {
95
95
  const owner = ownerFromRepository(repository),
96
96
  repo = repoFromRepository(repository),
97
97
  uri = `${GITHUB_REPOS_URI}/${owner}/${repo}${GITHUB_GIT_BLOBS_URI}`,
@@ -105,11 +105,11 @@ function contentBlobSHAPostRequest(repository, content, userAgent, gitHubAccessT
105
105
  postRequest(uri, query, body, userAgent, gitHubAccessToken, callback);
106
106
  }
107
107
 
108
- module.exports = {
108
+ export default {
109
109
  commitSHAPostRequest,
110
110
  baseTreeSHAGetRequest,
111
111
  updatedHeadPostRequest,
112
112
  commitTreeSHAPostRequest,
113
- contentBlobSHAPostRequest,
114
- latestCommitSHAGetRequest
113
+ latestCommitSHAGetRequest,
114
+ contentBlobSHAPostRequest
115
115
  };
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
 
3
- const { headers, encodings } = require("necessary");
3
+ import { headers, encodings } from "necessary";
4
4
 
5
- const { APPLICATION_VND_GITHUB_VS_JSON } = require("../constants");
5
+ import { APPLICATION_VND_GITHUB_VS_JSON } from "../constants";
6
6
 
7
7
  const { BASE64_ENCODING } = encodings,
8
8
  { ACCEPT_HEADER, USER_AGENT_HEADER, CONTENT_TYPE_HEADER, AUTHORIZATION_HEADER } = headers;
9
9
 
10
- function headersFromUserAgentAndGitHubAccessToken(userAgent, gitHubAccessToken) {
10
+ export function headersFromUserAgentAndGitHubAccessToken(userAgent, gitHubAccessToken) {
11
11
  const tokenAuthorization = `Token ${gitHubAccessToken}`,
12
12
  accept = APPLICATION_VND_GITHUB_VS_JSON, ///
13
13
  contentType = APPLICATION_VND_GITHUB_VS_JSON, ///
@@ -22,7 +22,7 @@ function headersFromUserAgentAndGitHubAccessToken(userAgent, gitHubAccessToken)
22
22
  return headers;
23
23
  }
24
24
 
25
- function headersFromUserAgentClientIdAndClientSecret(userAgent, clientId, clientSecret) {
25
+ export function headersFromUserAgentClientIdAndClientSecret(userAgent, clientId, clientSecret) {
26
26
  const digest = `${clientId}:${clientSecret}`,
27
27
  encodedDigest = Buffer.from(digest).toString(BASE64_ENCODING),
28
28
  basicAuthorization = `Basic ${encodedDigest}`,
@@ -36,8 +36,3 @@ function headersFromUserAgentClientIdAndClientSecret(userAgent, clientId, client
36
36
 
37
37
  return headers;
38
38
  }
39
-
40
- module.exports = {
41
- headersFromUserAgentAndGitHubAccessToken,
42
- headersFromUserAgentClientIdAndClientSecret
43
- };
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
 
3
- const { encodings } = require("necessary");
3
+ import { encodings } from "necessary";
4
4
 
5
- const { GITHUB_REPOS_URI, GITHUB_ISSUES_URI } = require("../uris"),
6
- { getRequest, postRequest, patchRequest } = require("../utilities/request"),
7
- { repoFromRepository, ownerFromRepository } = require("../utilities/repository");
5
+ import { GITHUB_REPOS_URI, GITHUB_ISSUES_URI } from "../uris";
6
+ import { getRequest, postRequest, patchRequest } from "../utilities/request";
7
+ import { repoFromRepository, ownerFromRepository } from "../utilities/repository";
8
8
 
9
9
  const { UTF_8_ENCODING } = encodings;
10
10
 
11
- function issueGetRequest(repository, issueNumber, userAgent, clientId, clientSecret, callback) {
11
+ export function issueGetRequest(repository, issueNumber, userAgent, clientId, clientSecret, callback) {
12
12
  const owner = ownerFromRepository(repository),
13
13
  repo = repoFromRepository(repository),
14
14
  uri = `${GITHUB_REPOS_URI}/${owner}/${repo}${GITHUB_ISSUES_URI}/${issueNumber}?`,
@@ -17,7 +17,7 @@ function issueGetRequest(repository, issueNumber, userAgent, clientId, clientSec
17
17
  getRequest(uri, query, userAgent, clientId, clientSecret, callback);
18
18
  }
19
19
 
20
- function issuesGetRequest(repository, state, userAgent, clientId, clientSecret, callback) {
20
+ export function issuesGetRequest(repository, state, userAgent, clientId, clientSecret, callback) {
21
21
  const owner = ownerFromRepository(repository),
22
22
  repo = repoFromRepository(repository),
23
23
  uri = `${GITHUB_REPOS_URI}/${owner}/${repo}${GITHUB_ISSUES_URI}`,
@@ -28,7 +28,7 @@ function issuesGetRequest(repository, state, userAgent, clientId, clientSecret,
28
28
  getRequest(uri, query, userAgent, clientId, clientSecret, callback);
29
29
  }
30
30
 
31
- function editIssuePatchRequest(repository, title, description, issueNumber, userAgent, gitHubAccessToken, callback) {
31
+ export function editIssuePatchRequest(repository, title, description, issueNumber, userAgent, gitHubAccessToken, callback) {
32
32
  const owner = ownerFromRepository(repository),
33
33
  repo = repoFromRepository(repository),
34
34
  uri = `${GITHUB_REPOS_URI}/${owner}/${repo}${GITHUB_ISSUES_URI}/${issueNumber}`,
@@ -46,7 +46,7 @@ function editIssuePatchRequest(repository, title, description, issueNumber, user
46
46
  patchRequest(uri, query, body, userAgent, gitHubAccessToken, callback);
47
47
  }
48
48
 
49
- function alterIssuePatchRequest(repository, state, issueNumber, userAgent, gitHubAccessToken, callback) {
49
+ export function alterIssuePatchRequest(repository, state, issueNumber, userAgent, gitHubAccessToken, callback) {
50
50
  const owner = ownerFromRepository(repository),
51
51
  repo = repoFromRepository(repository),
52
52
  uri = `${GITHUB_REPOS_URI}/${owner}/${repo}${GITHUB_ISSUES_URI}/${issueNumber}`,
@@ -60,7 +60,7 @@ function alterIssuePatchRequest(repository, state, issueNumber, userAgent, gitHu
60
60
  patchRequest(uri, query, body, userAgent, gitHubAccessToken, callback);
61
61
  }
62
62
 
63
- function createIssuePostRequest(repository, title, description, userAgent, gitHubAccessToken, callback) {
63
+ export function createIssuePostRequest(repository, title, description, userAgent, gitHubAccessToken, callback) {
64
64
  const owner = ownerFromRepository(repository),
65
65
  repo = repoFromRepository(repository),
66
66
  uri = `${GITHUB_REPOS_URI}/${owner}/${repo}${GITHUB_ISSUES_URI}`,
@@ -78,7 +78,7 @@ function createIssuePostRequest(repository, title, description, userAgent, gitHu
78
78
  postRequest(uri, query, body, userAgent, gitHubAccessToken, callback);
79
79
  }
80
80
 
81
- module.exports = {
81
+ export default {
82
82
  issueGetRequest,
83
83
  issuesGetRequest,
84
84
  editIssuePatchRequest,
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
 
3
- const { arrayUtilities } = require("necessary");
3
+ import { arrayUtilities } from "necessary";
4
4
 
5
5
  const { second } = arrayUtilities;
6
6
 
7
7
  const repoRegularExpression = /([^\/]+)$/,
8
8
  ownerRegularExpression = /([^\/]+)\/[^\/]+$/;
9
9
 
10
- function isRepositoryValid(repository) {
10
+ export function isRepositoryValid(repository) {
11
11
  const repoPresent = repoRegularExpression.test(repository),
12
12
  ownerPresent = ownerRegularExpression.test(repository),
13
13
  repositoryValid = (repoPresent && ownerPresent);
@@ -15,7 +15,7 @@ function isRepositoryValid(repository) {
15
15
  return repositoryValid;
16
16
  }
17
17
 
18
- function repoFromRepository(repository) {
18
+ export function repoFromRepository(repository) {
19
19
  const matches = repository.match(repoRegularExpression),
20
20
  secondMatch = second(matches),
21
21
  repo = secondMatch; ///
@@ -23,7 +23,7 @@ function repoFromRepository(repository) {
23
23
  return repo;
24
24
  }
25
25
 
26
- function ownerFromRepository(repository) {
26
+ export function ownerFromRepository(repository) {
27
27
  const matches = repository.match(ownerRegularExpression),
28
28
  secondMatch = second(matches),
29
29
  owner = secondMatch; ///
@@ -31,9 +31,8 @@ function ownerFromRepository(repository) {
31
31
  return owner;
32
32
  }
33
33
 
34
- module.exports = {
34
+ export default {
35
35
  isRepositoryValid,
36
36
  repoFromRepository,
37
37
  ownerFromRepository
38
38
  };
39
-
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
 
3
- const { Readable } = require("stream"),
4
- { methods, requestUtilities } = require("necessary");
3
+ import { Readable } from "stream";
4
+ import { methods, requestUtilities } from "necessary";
5
5
 
6
- const { END, DATA, EMPTY_STRING, GITHUB_API_HOST } = require("../constants"),
7
- { headersFromUserAgentAndGitHubAccessToken, headersFromUserAgentClientIdAndClientSecret } = require("../utilities/headers");
6
+ import { END, DATA, EMPTY_STRING, GITHUB_API_HOST } from "../constants";
7
+ import { headersFromUserAgentAndGitHubAccessToken, headersFromUserAgentClientIdAndClientSecret } from "../utilities/headers";
8
8
 
9
9
  const { createRequest } = requestUtilities,
10
10
  { GET_METHOD, POST_METHOD, DELETE_METHOD, PATCH_METHOD } = methods;
11
11
 
12
- function getRequest(uri, query, userAgent, clientId, clientSecret, callback) {
12
+ export function getRequest(uri, query, userAgent, clientId, clientSecret, callback) {
13
13
  const host = GITHUB_API_HOST,
14
14
  method = GET_METHOD,
15
15
  headers = headersFromUserAgentClientIdAndClientSecret(userAgent, clientId, clientSecret),
@@ -25,7 +25,7 @@ function getRequest(uri, query, userAgent, clientId, clientSecret, callback) {
25
25
  request.end();
26
26
  }
27
27
 
28
- function postRequest(uri, query, content, userAgent, gitHubAccessToken, callback) {
28
+ export function postRequest(uri, query, content, userAgent, gitHubAccessToken, callback) {
29
29
  const host = GITHUB_API_HOST,
30
30
  method = POST_METHOD,
31
31
  headers = headersFromUserAgentAndGitHubAccessToken(userAgent, gitHubAccessToken),
@@ -42,7 +42,7 @@ function postRequest(uri, query, content, userAgent, gitHubAccessToken, callback
42
42
  readable.pipe(postRequest);
43
43
  }
44
44
 
45
- function patchRequest(uri, query, content, userAgent, gitHubAccessToken, callback) {
45
+ export function patchRequest(uri, query, content, userAgent, gitHubAccessToken, callback) {
46
46
  const host = GITHUB_API_HOST,
47
47
  method = PATCH_METHOD,
48
48
  headers = headersFromUserAgentAndGitHubAccessToken(userAgent, gitHubAccessToken),
@@ -59,7 +59,7 @@ function patchRequest(uri, query, content, userAgent, gitHubAccessToken, callbac
59
59
  readable.pipe(postRequest);
60
60
  }
61
61
 
62
- function deleteRequest(uri, query, userAgent, gitHubAccessToken, callback) {
62
+ export function deleteRequest(uri, query, userAgent, gitHubAccessToken, callback) {
63
63
  const host = GITHUB_API_HOST,
64
64
  method = DELETE_METHOD,
65
65
  headers = headersFromUserAgentAndGitHubAccessToken(userAgent, gitHubAccessToken),
@@ -74,13 +74,6 @@ function deleteRequest(uri, query, userAgent, gitHubAccessToken, callback) {
74
74
  deleteRequest.end();
75
75
  }
76
76
 
77
- module.exports = {
78
- getRequest,
79
- postRequest,
80
- patchRequest,
81
- deleteRequest
82
- };
83
-
84
77
  function contentFromResponse(response, callback) {
85
78
  let content = EMPTY_STRING;
86
79
 
package/bin/constants.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- const END = "end",
4
- DATA = "data",
5
- BLOB_TYPE = "blob",
6
- BLOB_MODE = "100644",
7
- EMPTY_STRING = "",
8
- GITHUB_API_HOST = "https://api.github.com",
9
- APPLICATION_VND_GITHUB_VS_JSON = "application/vnd.github.v3+json";
10
-
11
- module.exports = {
12
- END,
13
- DATA,
14
- BLOB_TYPE,
15
- BLOB_MODE,
16
- EMPTY_STRING,
17
- GITHUB_API_HOST,
18
- APPLICATION_VND_GITHUB_VS_JSON
19
- };
package/bin/uris.js DELETED
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- const GITHUB_REPOS_URI = "/repos",
4
- GITHUB_ISSUES_URI = "/issues",
5
- GITHUB_COMMENTS_URI = "/comments",
6
- GITHUB_GIT_TREES_URI = "/git/trees",
7
- GITHUB_GIT_BLOBS_URI = "/git/blobs",
8
- GITHUB_GIT_COMMITS_URI = "/git/commits",
9
- GITHUB_ISSUES_COMMENTS_URI = "/issues/comments",
10
- GITHUB_GIT_REFS_HEADS_MASTER_URI = "/git/refs/heads/master";
11
-
12
- module.exports = {
13
- GITHUB_REPOS_URI,
14
- GITHUB_ISSUES_URI,
15
- GITHUB_COMMENTS_URI,
16
- GITHUB_GIT_TREES_URI,
17
- GITHUB_GIT_BLOBS_URI,
18
- GITHUB_GIT_COMMITS_URI,
19
- GITHUB_ISSUES_COMMENTS_URI,
20
- GITHUB_GIT_REFS_HEADS_MASTER_URI
21
- };
package/index.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- const issueUtilities = require("./bin/utilities/issue"),
4
- commitUtilities = require("./bin/utilities/commit"),
5
- commentUtilities = require("./bin/utilities/comment"),
6
- repositoryUtilities = require("./bin/utilities/repository");
7
-
8
- module.exports = {
9
- issueUtilities,
10
- commitUtilities,
11
- commentUtilities,
12
- repositoryUtilities
13
- };