@commitspark/git-adapter-github 0.8.3 → 0.21.0
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/CHANGELOG.md +17 -0
- package/README.md +63 -2
- package/dist/cjs/{axios-cache-key-generator.js → axios/cache-key-generator.js} +4 -4
- package/dist/cjs/axios/cache-key-generator.js.map +1 -0
- package/dist/cjs/axios/cached-instance.js +19 -0
- package/dist/cjs/axios/cached-instance.js.map +1 -0
- package/dist/cjs/errors.js +58 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/github-adapter.js +166 -0
- package/dist/cjs/github-adapter.js.map +1 -0
- package/dist/cjs/index.js +10 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model/addition.model.js.map +1 -0
- package/dist/cjs/model/deletion.model.js.map +1 -0
- package/dist/cjs/util/entries-to-actions-converter.js +28 -0
- package/dist/cjs/util/entries-to-actions-converter.js.map +1 -0
- package/dist/cjs/util/entry-factory.js +20 -0
- package/dist/cjs/util/entry-factory.js.map +1 -0
- package/dist/cjs/{graphql-query-factory.service.js → util/graphql-query-factory.js} +16 -16
- package/dist/cjs/util/graphql-query-factory.js.map +1 -0
- package/dist/cjs/util/path-factory.js +18 -0
- package/dist/cjs/util/path-factory.js.map +1 -0
- package/dist/cjs/util/types.js +7 -0
- package/dist/cjs/util/types.js.map +1 -0
- package/dist/esm/{axios-cache-key-generator.js → axios/cache-key-generator.js} +2 -3
- package/dist/esm/axios/cache-key-generator.js.map +1 -0
- package/dist/esm/axios/cached-instance.js +12 -0
- package/dist/esm/axios/cached-instance.js.map +1 -0
- package/dist/esm/errors.js +51 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/github-adapter.js +148 -0
- package/dist/esm/github-adapter.js.map +1 -0
- package/dist/esm/index.js +10 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model/addition.model.js.map +1 -0
- package/dist/esm/model/deletion.model.js.map +1 -0
- package/dist/esm/util/entries-to-actions-converter.js +25 -0
- package/dist/esm/util/entries-to-actions-converter.js.map +1 -0
- package/dist/esm/util/entry-factory.js +17 -0
- package/dist/esm/util/entry-factory.js.map +1 -0
- package/{src/graphql-query-factory.service.ts → dist/esm/util/graphql-query-factory.js} +12 -16
- package/dist/esm/util/graphql-query-factory.js.map +1 -0
- package/dist/esm/util/path-factory.js +12 -0
- package/dist/esm/util/path-factory.js.map +1 -0
- package/dist/esm/util/types.js +4 -0
- package/dist/esm/util/types.js.map +1 -0
- package/dist/tsconfig.build.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.build.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.build.types.tsbuildinfo +1 -1
- package/dist/types/axios/cache-key-generator.d.ts +3 -0
- package/dist/types/axios/cache-key-generator.d.ts.map +1 -0
- package/dist/types/axios/cached-instance.d.ts +4 -0
- package/dist/types/axios/cached-instance.d.ts.map +1 -0
- package/dist/types/errors.d.ts +4 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/github-adapter.d.ts +9 -0
- package/dist/types/github-adapter.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/model/addition.model.d.ts.map +1 -0
- package/dist/types/model/deletion.model.d.ts.map +1 -0
- package/dist/types/util/entries-to-actions-converter.d.ts +8 -0
- package/dist/types/util/entries-to-actions-converter.d.ts.map +1 -0
- package/dist/types/{entry-factory.service.d.ts → util/entry-factory.d.ts} +2 -4
- package/dist/types/util/entry-factory.d.ts.map +1 -0
- package/dist/types/util/graphql-query-factory.d.ts +5 -0
- package/dist/types/util/graphql-query-factory.d.ts.map +1 -0
- package/dist/types/util/path-factory.d.ts +4 -0
- package/dist/types/util/path-factory.d.ts.map +1 -0
- package/dist/types/util/types.d.ts +4 -0
- package/dist/types/util/types.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/{axios-cache-key-generator.ts → axios/cache-key-generator.ts} +1 -3
- package/src/axios/cached-instance.ts +17 -0
- package/src/errors.ts +54 -0
- package/src/github-adapter.ts +250 -0
- package/src/index.ts +24 -7
- package/src/util/entries-to-actions-converter.ts +36 -0
- package/src/util/entry-factory.ts +34 -0
- package/{dist/esm/graphql-query-factory.service.js → src/util/graphql-query-factory.ts} +18 -18
- package/src/util/path-factory.ts +19 -0
- package/src/util/types.ts +3 -0
- package/dist/cjs/addition.model.js.map +0 -1
- package/dist/cjs/axios-cache-key-generator.js.map +0 -1
- package/dist/cjs/container.js +0 -25
- package/dist/cjs/container.js.map +0 -1
- package/dist/cjs/deletion.model.js.map +0 -1
- package/dist/cjs/entries-to-actions-converter.service.js +0 -31
- package/dist/cjs/entries-to-actions-converter.service.js.map +0 -1
- package/dist/cjs/entry-factory.service.js +0 -25
- package/dist/cjs/entry-factory.service.js.map +0 -1
- package/dist/cjs/git-hub-adapter.service.js +0 -154
- package/dist/cjs/git-hub-adapter.service.js.map +0 -1
- package/dist/cjs/graphql-query-factory.service.js.map +0 -1
- package/dist/cjs/path-factory.service.js +0 -20
- package/dist/cjs/path-factory.service.js.map +0 -1
- package/dist/esm/addition.model.js.map +0 -1
- package/dist/esm/axios-cache-key-generator.js.map +0 -1
- package/dist/esm/container.js +0 -19
- package/dist/esm/container.js.map +0 -1
- package/dist/esm/deletion.model.js.map +0 -1
- package/dist/esm/entries-to-actions-converter.service.js +0 -27
- package/dist/esm/entries-to-actions-converter.service.js.map +0 -1
- package/dist/esm/entry-factory.service.js +0 -21
- package/dist/esm/entry-factory.service.js.map +0 -1
- package/dist/esm/git-hub-adapter.service.js +0 -135
- package/dist/esm/git-hub-adapter.service.js.map +0 -1
- package/dist/esm/graphql-query-factory.service.js.map +0 -1
- package/dist/esm/path-factory.service.js +0 -14
- package/dist/esm/path-factory.service.js.map +0 -1
- package/dist/types/addition.model.d.ts.map +0 -1
- package/dist/types/axios-cache-key-generator.d.ts +0 -4
- package/dist/types/axios-cache-key-generator.d.ts.map +0 -1
- package/dist/types/container.d.ts +0 -3
- package/dist/types/container.d.ts.map +0 -1
- package/dist/types/deletion.model.d.ts.map +0 -1
- package/dist/types/entries-to-actions-converter.service.d.ts +0 -10
- package/dist/types/entries-to-actions-converter.service.d.ts.map +0 -1
- package/dist/types/entry-factory.service.d.ts.map +0 -1
- package/dist/types/git-hub-adapter.service.d.ts +0 -24
- package/dist/types/git-hub-adapter.service.d.ts.map +0 -1
- package/dist/types/graphql-query-factory.service.d.ts +0 -7
- package/dist/types/graphql-query-factory.service.d.ts.map +0 -1
- package/dist/types/path-factory.service.d.ts +0 -6
- package/dist/types/path-factory.service.d.ts.map +0 -1
- package/src/container.ts +0 -27
- package/src/entries-to-actions-converter.service.ts +0 -37
- package/src/entry-factory.service.ts +0 -35
- package/src/git-hub-adapter.service.ts +0 -205
- package/src/path-factory.service.ts +0 -21
- /package/dist/cjs/{addition.model.js → model/addition.model.js} +0 -0
- /package/dist/cjs/{deletion.model.js → model/deletion.model.js} +0 -0
- /package/dist/esm/{addition.model.js → model/addition.model.js} +0 -0
- /package/dist/esm/{deletion.model.js → model/deletion.model.js} +0 -0
- /package/dist/types/{addition.model.d.ts → model/addition.model.d.ts} +0 -0
- /package/dist/types/{deletion.model.d.ts → model/deletion.model.d.ts} +0 -0
- /package/src/{addition.model.ts → model/addition.model.ts} +0 -0
- /package/src/{deletion.model.ts → model/deletion.model.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,23 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.21.0] - 2025-11-11
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Add error handling and abstraction for GitHub API responses
|
|
13
|
+
|
|
14
|
+
## [0.20.0] - 2025-11-08
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Upgrade to `@commitspark/git-adapter` 0.20.0
|
|
19
|
+
- Refactor implementation to drop dependency injection pattern
|
|
20
|
+
|
|
21
|
+
### Removed
|
|
22
|
+
|
|
23
|
+
- Removed separate `setRepositoryOptions()` in favor of less complex configuration on instantiation
|
|
24
|
+
|
|
8
25
|
## [0.8.3] - 2025-09-16
|
|
9
26
|
|
|
10
27
|
### Changed
|
package/README.md
CHANGED
|
@@ -5,10 +5,15 @@
|
|
|
5
5
|
This repository holds code for a [Commitspark Git adapter](https://github.com/commitspark/git-adapter) that provides
|
|
6
6
|
access to Git repositories hosted on GitHub.
|
|
7
7
|
|
|
8
|
+
# Installation
|
|
9
|
+
|
|
10
|
+
```shell
|
|
11
|
+
npm i @commitspark/git-adapter-github
|
|
12
|
+
```
|
|
13
|
+
|
|
8
14
|
# Usage
|
|
9
15
|
|
|
10
|
-
Instantiate the adapter with `createAdapter()
|
|
11
|
-
the instance. These options are as follows:
|
|
16
|
+
Instantiate the adapter with `createAdapter()`, providing `GitHubRepositoryOptions` with the following parameters:
|
|
12
17
|
|
|
13
18
|
| Option name | Required | Default value | Description |
|
|
14
19
|
|-------------------|----------|-------------------------------------|---------------------------------------------------|
|
|
@@ -53,6 +58,62 @@ Access tokens for a user obtained
|
|
|
53
58
|
from an [OAuth app](https://docs.github.com/en/apps/oauth-apps/using-oauth-apps/authorizing-oauth-apps) can be used in
|
|
54
59
|
the same way (including permissions) as fine-grained personal access tokens.
|
|
55
60
|
|
|
61
|
+
## Error Handling
|
|
62
|
+
|
|
63
|
+
This adapter sends requests to the GitHub GraphQL API. In case a request fails, HTTP and GraphQL errors are mapped to
|
|
64
|
+
`GitAdapterError` exceptions with `ErrorCode` values from the `@commitspark/git-adapter` package. This enables the
|
|
65
|
+
[Commitspark GraphQL API library](https://github.com/commitspark/graphql-api) to handle adapter errors in an
|
|
66
|
+
adapter-agnostic way.
|
|
67
|
+
|
|
68
|
+
### HTTP Status Code Mapping
|
|
69
|
+
|
|
70
|
+
HTTP error status codes are mapped as follows:
|
|
71
|
+
|
|
72
|
+
| HTTP Status | GitAdapter ErrorCode |
|
|
73
|
+
|-------------|----------------------|
|
|
74
|
+
| 400 | `BAD_REQUEST` |
|
|
75
|
+
| 401 | `UNAUTHORIZED` |
|
|
76
|
+
| 403 | `FORBIDDEN` |
|
|
77
|
+
| 404 | `NOT_FOUND` |
|
|
78
|
+
| 409 | `CONFLICT` |
|
|
79
|
+
| 429 | `TOO_MANY_REQUESTS` |
|
|
80
|
+
| Other | `INTERNAL_ERROR` |
|
|
81
|
+
|
|
82
|
+
### GitHub GraphQL API Error Type Mapping
|
|
83
|
+
|
|
84
|
+
GitHub GraphQL API error types are mapped as follows:
|
|
85
|
+
|
|
86
|
+
| GitHub Error Type | GitAdapter ErrorCode |
|
|
87
|
+
|-------------------|----------------------|
|
|
88
|
+
| `NOT_FOUND` | `NOT_FOUND` |
|
|
89
|
+
| `RATE_LIMITED` | `TOO_MANY_REQUESTS` |
|
|
90
|
+
| `FORBIDDEN` | `FORBIDDEN` |
|
|
91
|
+
| `STALE_DATA` | `CONFLICT` |
|
|
92
|
+
| Other | `INTERNAL_ERROR` |
|
|
93
|
+
|
|
94
|
+
All errors include the original error message from GitHub for debugging purposes.
|
|
95
|
+
|
|
96
|
+
As GitHub GraphQL error types (codes) are not documented (see
|
|
97
|
+
[GitHub documentation issue #22607](https://github.com/github/docs/issues/22607)), mapping of GraphQL error types is
|
|
98
|
+
done on a best-effort basis.
|
|
99
|
+
|
|
100
|
+
# Example
|
|
101
|
+
|
|
102
|
+
To use this adapter together with the Commitspark GraphQL API library, your code could be the following:
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
import { createAdapter } from '@commitspark/git-adapter-github'
|
|
106
|
+
import { createClient } from '@commitspark/graphql-api'
|
|
107
|
+
|
|
108
|
+
const gitHubAdapter = createAdapter({
|
|
109
|
+
repositoryOwner: process.env.GITHUB_REPOSITORY_OWNER,
|
|
110
|
+
repositoryName: process.env.GITHUB_REPOSITORY_NAME,
|
|
111
|
+
accessToken: process.env.GITHUB_ACCESS_TOKEN,
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
const client = await createClient(gitHubAdapter)
|
|
115
|
+
```
|
|
116
|
+
|
|
56
117
|
# License
|
|
57
118
|
|
|
58
119
|
The code in this repository is licensed under the permissive ISC license (see [LICENSE](LICENSE)).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
3
|
+
exports.cacheKeyGenerator = void 0;
|
|
4
|
+
const cacheKeyGenerator = (request) => {
|
|
5
5
|
var _a;
|
|
6
6
|
const authorization = (_a = request.headers) === null || _a === void 0 ? void 0 : _a.authorization;
|
|
7
7
|
const key = {
|
|
@@ -16,5 +16,5 @@ const axiosCacheKeyGenerator = (request) => {
|
|
|
16
16
|
}
|
|
17
17
|
return key;
|
|
18
18
|
};
|
|
19
|
-
exports.
|
|
20
|
-
//# sourceMappingURL=
|
|
19
|
+
exports.cacheKeyGenerator = cacheKeyGenerator;
|
|
20
|
+
//# sourceMappingURL=cache-key-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-key-generator.js","sourceRoot":"","sources":["../../../src/axios/cache-key-generator.ts"],"names":[],"mappings":";;;AAEO,MAAM,iBAAiB,GAAG,CAC/B,OAAiC,EACjC,EAAE;;IACF,MAAM,aAAa,GAAG,MAAA,OAAO,CAAC,OAAO,0CAAE,aAAa,CAAA;IACpD,MAAM,GAAG,GAA2C;QAClD,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,uCAAuC;KAC5D,CAAA;IAED,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QAChC,uGAAuG;QACvG,+EAA+E;QAC/E,GAAG,CAAC,MAAM,CAAC,GAAG,aAAa,CAAA;IAC7B,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAjBY,QAAA,iBAAiB,qBAiB7B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createAxiosCachedInstance = exports.QUERY_CACHE_SECONDS = void 0;
|
|
7
|
+
const axios_cache_interceptor_1 = require("axios-cache-interceptor");
|
|
8
|
+
const axios_1 = __importDefault(require("axios"));
|
|
9
|
+
const cache_key_generator_1 = require("./cache-key-generator");
|
|
10
|
+
exports.QUERY_CACHE_SECONDS = 10 * 60;
|
|
11
|
+
const createAxiosCachedInstance = () => {
|
|
12
|
+
return (0, axios_cache_interceptor_1.setupCache)(axios_1.default.create(), {
|
|
13
|
+
ttl: exports.QUERY_CACHE_SECONDS * 1000, // milliseconds
|
|
14
|
+
methods: ['get', 'post'],
|
|
15
|
+
generateKey: (0, axios_cache_interceptor_1.buildKeyGenerator)(cache_key_generator_1.cacheKeyGenerator), //
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
exports.createAxiosCachedInstance = createAxiosCachedInstance;
|
|
19
|
+
//# sourceMappingURL=cached-instance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cached-instance.js","sourceRoot":"","sources":["../../../src/axios/cached-instance.ts"],"names":[],"mappings":";;;;;;AAAA,qEAIgC;AAChC,kDAAyB;AACzB,+DAAyD;AAE5C,QAAA,mBAAmB,GAAG,EAAE,GAAG,EAAE,CAAA;AAEnC,MAAM,yBAAyB,GAAG,GAAuB,EAAE;IAChE,OAAO,IAAA,oCAAU,EAAC,eAAK,CAAC,MAAM,EAAE,EAAE;QAChC,GAAG,EAAE,2BAAmB,GAAG,IAAI,EAAE,eAAe;QAChD,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;QACxB,WAAW,EAAE,IAAA,2CAAiB,EAAC,uCAAiB,CAAC,EAAE,EAAE;KACtD,CAAC,CAAA;AACJ,CAAC,CAAA;AANY,QAAA,yBAAyB,6BAMrC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleGraphQLErrors = exports.handleHttpErrors = void 0;
|
|
4
|
+
const git_adapter_1 = require("@commitspark/git-adapter");
|
|
5
|
+
const axios_1 = require("axios");
|
|
6
|
+
const handleHttpErrors = (error) => {
|
|
7
|
+
var _a, _b, _c;
|
|
8
|
+
if (error instanceof axios_1.AxiosError) {
|
|
9
|
+
const status = (_a = error.response) === null || _a === void 0 ? void 0 : _a.status;
|
|
10
|
+
const message = ((_c = (_b = error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || error.message;
|
|
11
|
+
switch (status) {
|
|
12
|
+
case 400:
|
|
13
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.BAD_REQUEST, message);
|
|
14
|
+
case 401:
|
|
15
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.UNAUTHORIZED, message);
|
|
16
|
+
case 403:
|
|
17
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.FORBIDDEN, message);
|
|
18
|
+
case 404:
|
|
19
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.NOT_FOUND, message);
|
|
20
|
+
case 409:
|
|
21
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.CONFLICT, message);
|
|
22
|
+
case 429:
|
|
23
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.TOO_MANY_REQUESTS, message);
|
|
24
|
+
default:
|
|
25
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.INTERNAL_ERROR, message);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.INTERNAL_ERROR, error instanceof Error ? error.message : 'Unknown error');
|
|
29
|
+
};
|
|
30
|
+
exports.handleHttpErrors = handleHttpErrors;
|
|
31
|
+
const handleGraphQLErrors = (response) => {
|
|
32
|
+
var _a;
|
|
33
|
+
if (response.data.errors) {
|
|
34
|
+
const errors = response.data.errors;
|
|
35
|
+
const errorMessage = JSON.stringify(errors);
|
|
36
|
+
const errorType = (_a = errors[0]) === null || _a === void 0 ? void 0 : _a.type;
|
|
37
|
+
// GitHub error types are not documented, and documentation is not planned,
|
|
38
|
+
// see https://github.com/github/docs/issues/22607
|
|
39
|
+
// Error type values below have been discovered through manual testing
|
|
40
|
+
if (errorType === 'NOT_FOUND') {
|
|
41
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.NOT_FOUND, errorMessage);
|
|
42
|
+
}
|
|
43
|
+
else if (errorType === 'RATE_LIMITED') {
|
|
44
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.TOO_MANY_REQUESTS, errorMessage);
|
|
45
|
+
}
|
|
46
|
+
else if (errorType === 'FORBIDDEN') {
|
|
47
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.FORBIDDEN, errorMessage);
|
|
48
|
+
}
|
|
49
|
+
else if (errorType === 'STALE_DATA') {
|
|
50
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.CONFLICT, errorMessage);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.INTERNAL_ERROR, errorMessage);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.handleGraphQLErrors = handleGraphQLErrors;
|
|
58
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|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CAAC,CAAA;AA3BY,QAAA,gBAAgB,oBA2B5B;AAEM,MAAM,mBAAmB,GAAG,CAAC,QAAuB,EAAQ,EAAE;;IACnE,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAA;QACnC,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QAC3C,MAAM,SAAS,GAAuB,MAAA,MAAM,CAAC,CAAC,CAAC,0CAAE,IAAI,CAAA;QAErD,2EAA2E;QAC3E,kDAAkD;QAClD,sEAAsE;QACtE,IAAI,SAAS,KAAK,WAAW,EAAE,CAAC;YAC9B,MAAM,IAAI,6BAAe,CAAC,uBAAS,CAAC,SAAS,EAAE,YAAY,CAAC,CAAA;QAC9D,CAAC;aAAM,IAAI,SAAS,KAAK,cAAc,EAAE,CAAC;YACxC,MAAM,IAAI,6BAAe,CAAC,uBAAS,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAA;QACtE,CAAC;aAAM,IAAI,SAAS,KAAK,WAAW,EAAE,CAAC;YACrC,MAAM,IAAI,6BAAe,CAAC,uBAAS,CAAC,SAAS,EAAE,YAAY,CAAC,CAAA;QAC9D,CAAC;aAAM,IAAI,SAAS,KAAK,YAAY,EAAE,CAAC;YACtC,MAAM,IAAI,6BAAe,CAAC,uBAAS,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;QAC7D,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,6BAAe,CAAC,uBAAS,CAAC,cAAc,EAAE,YAAY,CAAC,CAAA;QACnE,CAAC;IACH,CAAC;AACH,CAAC,CAAA;AArBY,QAAA,mBAAmB,uBAqB/B"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.createCommit = exports.getLatestCommitHash = exports.getSchema = exports.getEntries = exports.API_URL = void 0;
|
|
13
|
+
const git_adapter_1 = require("@commitspark/git-adapter");
|
|
14
|
+
const graphql_query_factory_1 = require("./util/graphql-query-factory");
|
|
15
|
+
const entries_to_actions_converter_1 = require("./util/entries-to-actions-converter");
|
|
16
|
+
const path_factory_1 = require("./util/path-factory");
|
|
17
|
+
const entry_factory_1 = require("./util/entry-factory");
|
|
18
|
+
const errors_1 = require("./errors");
|
|
19
|
+
exports.API_URL = 'https://api.github.com/graphql';
|
|
20
|
+
const getEntries = (gitRepositoryOptions, axiosCacheInstance, commitHash) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
const token = gitRepositoryOptions.accessToken;
|
|
23
|
+
const pathEntryFolder = (0, path_factory_1.getPathEntryFolder)(gitRepositoryOptions);
|
|
24
|
+
const queryFilesContent = (0, graphql_query_factory_1.createBlobsContentQuery)();
|
|
25
|
+
let filesContentResponse;
|
|
26
|
+
try {
|
|
27
|
+
filesContentResponse = yield axiosCacheInstance.post(exports.API_URL, {
|
|
28
|
+
query: queryFilesContent,
|
|
29
|
+
variables: {
|
|
30
|
+
repositoryOwner: gitRepositoryOptions.repositoryOwner,
|
|
31
|
+
repositoryName: gitRepositoryOptions.repositoryName,
|
|
32
|
+
expression: `${commitHash}:${pathEntryFolder}`,
|
|
33
|
+
},
|
|
34
|
+
}, {
|
|
35
|
+
headers: {
|
|
36
|
+
authorization: `Bearer ${token}`,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
(0, errors_1.handleHttpErrors)(error);
|
|
42
|
+
}
|
|
43
|
+
if (!filesContentResponse) {
|
|
44
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.INTERNAL_ERROR, 'Failed to fetch entries');
|
|
45
|
+
}
|
|
46
|
+
(0, errors_1.handleGraphQLErrors)(filesContentResponse);
|
|
47
|
+
if (!((_b = (_a = filesContentResponse.data.data.repository) === null || _a === void 0 ? void 0 : _a.object) === null || _b === void 0 ? void 0 : _b.entries)) {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
return (0, entry_factory_1.createEntriesFromBlobsQueryResponseData)(filesContentResponse.data.data.repository.object.entries);
|
|
51
|
+
});
|
|
52
|
+
exports.getEntries = getEntries;
|
|
53
|
+
const getSchema = (gitRepositoryOptions, axiosCacheInstance, commitHash) => __awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
+
var _a, _b, _c, _d;
|
|
55
|
+
const repositoryOwner = gitRepositoryOptions.repositoryOwner;
|
|
56
|
+
const repositoryName = gitRepositoryOptions.repositoryName;
|
|
57
|
+
const token = gitRepositoryOptions.accessToken;
|
|
58
|
+
const schemaFilePath = (0, path_factory_1.getPathSchema)(gitRepositoryOptions);
|
|
59
|
+
const queryContent = (0, graphql_query_factory_1.createBlobContentQuery)();
|
|
60
|
+
let response;
|
|
61
|
+
try {
|
|
62
|
+
response = yield axiosCacheInstance.post(exports.API_URL, {
|
|
63
|
+
query: queryContent,
|
|
64
|
+
variables: {
|
|
65
|
+
repositoryOwner: repositoryOwner,
|
|
66
|
+
repositoryName: repositoryName,
|
|
67
|
+
expression: `${commitHash}:${schemaFilePath}`,
|
|
68
|
+
},
|
|
69
|
+
}, {
|
|
70
|
+
headers: {
|
|
71
|
+
authorization: `Bearer ${token}`,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
(0, errors_1.handleHttpErrors)(error);
|
|
77
|
+
}
|
|
78
|
+
if (!response) {
|
|
79
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.INTERNAL_ERROR, `Failed to fetch schema`);
|
|
80
|
+
}
|
|
81
|
+
(0, errors_1.handleGraphQLErrors)(response);
|
|
82
|
+
const schema = (_d = (_c = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.repository) === null || _c === void 0 ? void 0 : _c.object) === null || _d === void 0 ? void 0 : _d.text;
|
|
83
|
+
if (!schema) {
|
|
84
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.NOT_FOUND, `"${schemaFilePath}" not found in Git repository "${repositoryOwner}/${repositoryName}" at commit "${commitHash}"`);
|
|
85
|
+
}
|
|
86
|
+
return schema;
|
|
87
|
+
});
|
|
88
|
+
exports.getSchema = getSchema;
|
|
89
|
+
const getLatestCommitHash = (gitRepositoryOptions, axiosCacheInstance, ref) => __awaiter(void 0, void 0, void 0, function* () {
|
|
90
|
+
var _a, _b, _c, _d, _e;
|
|
91
|
+
const token = gitRepositoryOptions.accessToken;
|
|
92
|
+
const queryLatestCommit = (0, graphql_query_factory_1.createLatestCommitQuery)();
|
|
93
|
+
let response;
|
|
94
|
+
try {
|
|
95
|
+
response = yield axiosCacheInstance.post(exports.API_URL, {
|
|
96
|
+
query: queryLatestCommit,
|
|
97
|
+
variables: {
|
|
98
|
+
repositoryOwner: gitRepositoryOptions.repositoryOwner,
|
|
99
|
+
repositoryName: gitRepositoryOptions.repositoryName,
|
|
100
|
+
ref: ref,
|
|
101
|
+
},
|
|
102
|
+
}, {
|
|
103
|
+
cache: false, // must not use cache, so we always get the branch's current head
|
|
104
|
+
headers: {
|
|
105
|
+
authorization: `Bearer ${token}`,
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
(0, errors_1.handleHttpErrors)(error);
|
|
111
|
+
}
|
|
112
|
+
if (!response) {
|
|
113
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.INTERNAL_ERROR, 'Failed to fetch latest commit');
|
|
114
|
+
}
|
|
115
|
+
(0, errors_1.handleGraphQLErrors)(response);
|
|
116
|
+
if (!response.data.data.repository) {
|
|
117
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.NOT_FOUND, `No repository found "${gitRepositoryOptions.repositoryOwner}/${gitRepositoryOptions.repositoryName}"`);
|
|
118
|
+
}
|
|
119
|
+
const lastCommit = (_e = (_c = (_b = (_a = response.data.data.repository.ref) === null || _a === void 0 ? void 0 : _a.target) === null || _b === void 0 ? void 0 : _b.oid) !== null && _c !== void 0 ? _c : (_d = response.data.data.repository.object) === null || _d === void 0 ? void 0 : _d.oid) !== null && _e !== void 0 ? _e : undefined;
|
|
120
|
+
if (!lastCommit) {
|
|
121
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.NOT_FOUND, `No commit found for ref "${ref}"`);
|
|
122
|
+
}
|
|
123
|
+
return lastCommit;
|
|
124
|
+
});
|
|
125
|
+
exports.getLatestCommitHash = getLatestCommitHash;
|
|
126
|
+
const createCommit = (gitRepositoryOptions, axiosCacheInstance, commitDraft) => __awaiter(void 0, void 0, void 0, function* () {
|
|
127
|
+
var _a;
|
|
128
|
+
const token = gitRepositoryOptions.accessToken;
|
|
129
|
+
const pathEntryFolder = (0, path_factory_1.getPathEntryFolder)(gitRepositoryOptions);
|
|
130
|
+
const { additions, deletions } = (0, entries_to_actions_converter_1.convertEntriesToActions)(commitDraft.entries, pathEntryFolder);
|
|
131
|
+
const mutateCommit = (0, graphql_query_factory_1.createCommitMutation)();
|
|
132
|
+
let response;
|
|
133
|
+
try {
|
|
134
|
+
response = yield axiosCacheInstance.post(exports.API_URL, {
|
|
135
|
+
query: mutateCommit,
|
|
136
|
+
variables: {
|
|
137
|
+
repositoryNameWithOwner: `${gitRepositoryOptions.repositoryOwner}/${gitRepositoryOptions.repositoryName}`,
|
|
138
|
+
branchName: commitDraft.ref,
|
|
139
|
+
commitMessage: (_a = commitDraft.message) !== null && _a !== void 0 ? _a : '-',
|
|
140
|
+
precedingCommitSha: commitDraft.parentSha,
|
|
141
|
+
additions: additions,
|
|
142
|
+
deletions: deletions,
|
|
143
|
+
},
|
|
144
|
+
}, {
|
|
145
|
+
cache: false,
|
|
146
|
+
headers: {
|
|
147
|
+
authorization: `Bearer ${token}`,
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
(0, errors_1.handleHttpErrors)(error);
|
|
153
|
+
}
|
|
154
|
+
if (!response) {
|
|
155
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.INTERNAL_ERROR, `Failed to create commit`);
|
|
156
|
+
}
|
|
157
|
+
(0, errors_1.handleGraphQLErrors)(response);
|
|
158
|
+
const mutationResult = response.data.data.commitCreate;
|
|
159
|
+
if (mutationResult.errors) {
|
|
160
|
+
const errorMessage = JSON.stringify(mutationResult.errors);
|
|
161
|
+
throw new git_adapter_1.GitAdapterError(git_adapter_1.ErrorCode.BAD_REQUEST, `Failed to create commit: ${errorMessage}`);
|
|
162
|
+
}
|
|
163
|
+
return { ref: mutationResult.commit.oid };
|
|
164
|
+
});
|
|
165
|
+
exports.createCommit = createCommit;
|
|
166
|
+
//# sourceMappingURL=github-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-adapter.js","sourceRoot":"","sources":["../../src/github-adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,0DAMiC;AAEjC,wEAKqC;AACrC,sFAA6E;AAC7E,sDAAuE;AACvE,wDAA8E;AAC9E,qCAAgE;AAEnD,QAAA,OAAO,GAAG,gCAAgC,CAAA;AAEh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AC,OAAO,KAAK,EAAE,CAAC;QACf,IAAA,yBAAgB,EAAC,KAAK,CAAC,CAAA;IACzB,CAAC;IAED,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,6BAAe,CACvB,uBAAS,CAAC,cAAc,EACxB,yBAAyB,CAC1B,CAAA;IACH,CAAC;IAED,IAAA,4BAAmB,EAAC,QAAQ,CAAC,CAAA;IAE7B,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAA;IAEtD,IAAI,cAAc,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;QAC1D,MAAM,IAAI,6BAAe,CACvB,uBAAS,CAAC,WAAW,EACrB,4BAA4B,YAAY,EAAE,CAC3C,CAAA;IACH,CAAC;IAED,OAAO,EAAE,GAAG,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;AAC3C,CAAC,CAAA,CAAA;AA7DY,QAAA,YAAY,gBA6DxB"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GitHubAdapterService = void 0;
|
|
4
3
|
exports.createAdapter = createAdapter;
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return
|
|
4
|
+
const cached_instance_1 = require("./axios/cached-instance");
|
|
5
|
+
const github_adapter_1 = require("./github-adapter");
|
|
6
|
+
function createAdapter(gitRepositoryOptions) {
|
|
7
|
+
const axiosCacheInstance = (0, cached_instance_1.createAxiosCachedInstance)();
|
|
8
|
+
return {
|
|
9
|
+
getEntries: (commitHash) => (0, github_adapter_1.getEntries)(gitRepositoryOptions, axiosCacheInstance, commitHash),
|
|
10
|
+
getSchema: (commitHash) => (0, github_adapter_1.getSchema)(gitRepositoryOptions, axiosCacheInstance, commitHash),
|
|
11
|
+
getLatestCommitHash: (ref) => (0, github_adapter_1.getLatestCommitHash)(gitRepositoryOptions, axiosCacheInstance, ref),
|
|
12
|
+
createCommit: (commitDraft) => (0, github_adapter_1.createCommit)(gitRepositoryOptions, axiosCacheInstance, commitDraft),
|
|
13
|
+
};
|
|
10
14
|
}
|
|
11
15
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAiBA,sCAeC;AA/BD,6DAAmE;AACnE,qDAKyB;AAUzB,SAAgB,aAAa,CAC3B,oBAA6C;IAE7C,MAAM,kBAAkB,GAAG,IAAA,2CAAyB,GAAE,CAAA;IAEtD,OAAO;QACL,UAAU,EAAE,CAAC,UAAkB,EAAE,EAAE,CACjC,IAAA,2BAAU,EAAC,oBAAoB,EAAE,kBAAkB,EAAE,UAAU,CAAC;QAClE,SAAS,EAAE,CAAC,UAAkB,EAAE,EAAE,CAChC,IAAA,0BAAS,EAAC,oBAAoB,EAAE,kBAAkB,EAAE,UAAU,CAAC;QACjE,mBAAmB,EAAE,CAAC,GAAW,EAAE,EAAE,CACnC,IAAA,oCAAmB,EAAC,oBAAoB,EAAE,kBAAkB,EAAE,GAAG,CAAC;QACpE,YAAY,EAAE,CAAC,WAAwB,EAAE,EAAE,CACzC,IAAA,6BAAY,EAAC,oBAAoB,EAAE,kBAAkB,EAAE,WAAW,CAAC;KACtE,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addition.model.js","sourceRoot":"","sources":["../../../src/model/addition.model.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAa;IAExB,YACW,IAAY,EACrB,QAAgB;QADP,SAAI,GAAJ,IAAI,CAAQ;QAGrB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAClE,CAAC;CACF;AARD,sCAQC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deletion.model.js","sourceRoot":"","sources":["../../../src/model/deletion.model.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAa;IACxB,YAAqB,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;CACtC;AAFD,sCAEC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertEntriesToActions = convertEntriesToActions;
|
|
4
|
+
const yaml_1 = require("yaml");
|
|
5
|
+
const addition_model_1 = require("../model/addition.model");
|
|
6
|
+
const deletion_model_1 = require("../model/deletion.model");
|
|
7
|
+
const types_1 = require("./types");
|
|
8
|
+
function convertEntriesToActions(entryDrafts, pathEntryFolder) {
|
|
9
|
+
const additions = [];
|
|
10
|
+
const deletions = [];
|
|
11
|
+
entryDrafts.forEach((entryDraft) => {
|
|
12
|
+
const entryPath = `${pathEntryFolder}/${entryDraft.id}${types_1.ENTRY_EXTENSION}`;
|
|
13
|
+
if (entryDraft.deletion) {
|
|
14
|
+
deletions.push(new deletion_model_1.DeletionModel(entryPath));
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
additions.push(new addition_model_1.AdditionModel(entryPath, (0, yaml_1.stringify)({
|
|
18
|
+
metadata: entryDraft.metadata,
|
|
19
|
+
data: entryDraft.data,
|
|
20
|
+
})));
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
additions,
|
|
25
|
+
deletions,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=entries-to-actions-converter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entries-to-actions-converter.js","sourceRoot":"","sources":["../../../src/util/entries-to-actions-converter.ts"],"names":[],"mappings":";;AAMA,0DA6BC;AAlCD,+BAAgC;AAChC,4DAAuD;AACvD,4DAAuD;AACvD,mCAAyC;AAEzC,SAAgB,uBAAuB,CACrC,WAAyB,EACzB,eAAuB;IAKvB,MAAM,SAAS,GAAoB,EAAE,CAAA;IACrC,MAAM,SAAS,GAAoB,EAAE,CAAA;IACrC,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;QACjC,MAAM,SAAS,GAAG,GAAG,eAAe,IAAI,UAAU,CAAC,EAAE,GAAG,uBAAe,EAAE,CAAA;QACzE,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;YACxB,SAAS,CAAC,IAAI,CAAC,IAAI,8BAAa,CAAC,SAAS,CAAC,CAAC,CAAA;QAC9C,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,IAAI,CACZ,IAAI,8BAAa,CACf,SAAS,EACT,IAAA,gBAAS,EAAC;gBACR,QAAQ,EAAE,UAAU,CAAC,QAAQ;gBAC7B,IAAI,EAAE,UAAU,CAAC,IAAI;aACtB,CAAC,CACH,CACF,CAAA;QACH,CAAC;IACH,CAAC,CAAC,CAAA;IACF,OAAO;QACL,SAAS;QACT,SAAS;KACV,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createEntriesFromBlobsQueryResponseData = createEntriesFromBlobsQueryResponseData;
|
|
4
|
+
const yaml_1 = require("yaml");
|
|
5
|
+
const types_1 = require("./types");
|
|
6
|
+
function createEntriesFromBlobsQueryResponseData(entries) {
|
|
7
|
+
return entries
|
|
8
|
+
.filter((entry) => entry.name.endsWith(types_1.ENTRY_EXTENSION) &&
|
|
9
|
+
entry.object['__typename'] === 'Blob')
|
|
10
|
+
.map((entry) => {
|
|
11
|
+
const fileContent = (0, yaml_1.parse)(entry.object.text);
|
|
12
|
+
const id = entry.name.substring(0, entry.name.length - types_1.ENTRY_EXTENSION.length);
|
|
13
|
+
return {
|
|
14
|
+
id: id,
|
|
15
|
+
metadata: fileContent.metadata,
|
|
16
|
+
data: fileContent.data,
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=entry-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-factory.js","sourceRoot":"","sources":["../../../src/util/entry-factory.ts"],"names":[],"mappings":";;AAYA,0FAqBC;AAjCD,+BAA4B;AAE5B,mCAAyC;AAUzC,SAAgB,uCAAuC,CACrD,OAAoB;IAEpB,OAAO,OAAO;SACX,MAAM,CACL,CAAC,KAAgB,EAAE,EAAE,CACnB,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,uBAAe,CAAC;QACpC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,MAAM,CACxC;SACA,GAAG,CAAC,CAAC,KAAgB,EAAE,EAAE;QACxB,MAAM,WAAW,GAAG,IAAA,YAAK,EAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAC5C,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAC7B,CAAC,EACD,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,uBAAe,CAAC,MAAM,CAC3C,CAAA;QACD,OAAO;YACL,EAAE,EAAE,EAAE;YACN,QAAQ,EAAE,WAAW,CAAC,QAAQ;YAC9B,IAAI,EAAE,WAAW,CAAC,IAAI;SACd,CAAA;IACZ,CAAC,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
exports.createBlobsContentQuery = createBlobsContentQuery;
|
|
4
|
+
exports.createBlobContentQuery = createBlobContentQuery;
|
|
5
|
+
exports.createCommitMutation = createCommitMutation;
|
|
6
|
+
exports.createLatestCommitQuery = createLatestCommitQuery;
|
|
7
|
+
function createBlobsContentQuery() {
|
|
8
|
+
return `
|
|
7
9
|
query ($repositoryOwner: String!, $repositoryName: String!, $expression: String!) {
|
|
8
10
|
repository(owner: $repositoryOwner, name: $repositoryName) {
|
|
9
11
|
object(expression: $expression) {
|
|
@@ -22,9 +24,9 @@ class GraphqlQueryFactoryService {
|
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
`;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
}
|
|
28
|
+
function createBlobContentQuery() {
|
|
29
|
+
return `
|
|
28
30
|
query ($repositoryOwner: String!, $repositoryName: String!, $expression: String!) {
|
|
29
31
|
repository(owner: $repositoryOwner, name: $repositoryName) {
|
|
30
32
|
object(expression: $expression) {
|
|
@@ -35,9 +37,9 @@ class GraphqlQueryFactoryService {
|
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
`;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
}
|
|
41
|
+
function createCommitMutation() {
|
|
42
|
+
return `
|
|
41
43
|
mutation (
|
|
42
44
|
$repositoryNameWithOwner: String!,
|
|
43
45
|
$branchName: String!,
|
|
@@ -67,9 +69,9 @@ class GraphqlQueryFactoryService {
|
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
`;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
}
|
|
73
|
+
function createLatestCommitQuery() {
|
|
74
|
+
return `
|
|
73
75
|
query ($repositoryOwner: String!, $repositoryName: String!, $ref: String!) {
|
|
74
76
|
repository(owner: $repositoryOwner, name: $repositoryName) {
|
|
75
77
|
ref(qualifiedName: $ref) {
|
|
@@ -83,7 +85,5 @@ class GraphqlQueryFactoryService {
|
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
87
|
`;
|
|
86
|
-
}
|
|
87
88
|
}
|
|
88
|
-
|
|
89
|
-
//# sourceMappingURL=graphql-query-factory.service.js.map
|
|
89
|
+
//# sourceMappingURL=graphql-query-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-query-factory.js","sourceRoot":"","sources":["../../../src/util/graphql-query-factory.ts"],"names":[],"mappings":";;AAAA,0DAoBC;AAED,wDAYC;AAED,oDA+BC;AAED,0DAeC;AApFD,SAAgB,uBAAuB;IACrC,OAAO;;;;;;;;;;;;;;;;;;KAkBJ,CAAA;AACL,CAAC;AAED,SAAgB,sBAAsB;IACpC,OAAO;;;;;;;;;;KAUJ,CAAA;AACL,CAAC;AAED,SAAgB,oBAAoB;IAClC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6BJ,CAAA;AACL,CAAC;AAED,SAAgB,uBAAuB;IACrC,OAAO;;;;;;;;;;;;;KAaJ,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPathSchema = getPathSchema;
|
|
4
|
+
exports.getPathEntryFolder = getPathEntryFolder;
|
|
5
|
+
const types_1 = require("./types");
|
|
6
|
+
function getPathSchema(gitRepositoryOptions) {
|
|
7
|
+
var _a;
|
|
8
|
+
return (_a = gitRepositoryOptions.pathSchemaFile) !== null && _a !== void 0 ? _a : types_1.PATH_SCHEMA_FILE;
|
|
9
|
+
}
|
|
10
|
+
function getPathEntryFolder(gitRepositoryOptions) {
|
|
11
|
+
var _a;
|
|
12
|
+
const pathEntryFolder = (_a = gitRepositoryOptions.pathEntryFolder) !== null && _a !== void 0 ? _a : types_1.PATH_ENTRY_FOLDER;
|
|
13
|
+
if (pathEntryFolder.endsWith('/')) {
|
|
14
|
+
return pathEntryFolder.substring(0, pathEntryFolder.length - 1);
|
|
15
|
+
}
|
|
16
|
+
return pathEntryFolder;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=path-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-factory.js","sourceRoot":"","sources":["../../../src/util/path-factory.ts"],"names":[],"mappings":";;AAGA,sCAEC;AAED,gDAWC;AAjBD,mCAA6D;AAE7D,SAAgB,aAAa,CAAC,oBAA6C;;IACzE,OAAO,MAAA,oBAAoB,CAAC,cAAc,mCAAI,wBAAgB,CAAA;AAChE,CAAC;AAED,SAAgB,kBAAkB,CAChC,oBAA6C;;IAE7C,MAAM,eAAe,GACnB,MAAA,oBAAoB,CAAC,eAAe,mCAAI,yBAAiB,CAAA;IAE3D,IAAI,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAClC,OAAO,eAAe,CAAC,SAAS,CAAC,CAAC,EAAE,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IACjE,CAAC;IAED,OAAO,eAAe,CAAA;AACxB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PATH_ENTRY_FOLDER = exports.PATH_SCHEMA_FILE = exports.ENTRY_EXTENSION = void 0;
|
|
4
|
+
exports.ENTRY_EXTENSION = '.yaml';
|
|
5
|
+
exports.PATH_SCHEMA_FILE = 'commitspark/schema/schema.graphql';
|
|
6
|
+
exports.PATH_ENTRY_FOLDER = 'commitspark/entries/';
|
|
7
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/util/types.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,OAAO,CAAA;AACzB,QAAA,gBAAgB,GAAG,mCAAmC,CAAA;AACtD,QAAA,iBAAiB,GAAG,sBAAsB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
export const cacheKeyGenerator = (request) => {
|
|
2
2
|
const authorization = request.headers?.authorization;
|
|
3
3
|
const key = {
|
|
4
4
|
method: request.method,
|
|
@@ -12,5 +12,4 @@ const axiosCacheKeyGenerator = (request) => {
|
|
|
12
12
|
}
|
|
13
13
|
return key;
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=axios-cache-key-generator.js.map
|
|
15
|
+
//# sourceMappingURL=cache-key-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-key-generator.js","sourceRoot":"","sources":["../../../src/axios/cache-key-generator.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,OAAiC,EACjC,EAAE;IACF,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,EAAE,aAAa,CAAA;IACpD,MAAM,GAAG,GAA2C;QAClD,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,uCAAuC;KAC5D,CAAA;IAED,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QAChC,uGAAuG;QACvG,+EAA+E;QAC/E,GAAG,CAAC,MAAM,CAAC,GAAG,aAAa,CAAA;IAC7B,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { buildKeyGenerator, setupCache, } from 'axios-cache-interceptor';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import { cacheKeyGenerator } from './cache-key-generator';
|
|
4
|
+
export const QUERY_CACHE_SECONDS = 10 * 60;
|
|
5
|
+
export const createAxiosCachedInstance = () => {
|
|
6
|
+
return setupCache(axios.create(), {
|
|
7
|
+
ttl: QUERY_CACHE_SECONDS * 1000, // milliseconds
|
|
8
|
+
methods: ['get', 'post'],
|
|
9
|
+
generateKey: buildKeyGenerator(cacheKeyGenerator), //
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=cached-instance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cached-instance.js","sourceRoot":"","sources":["../../../src/axios/cached-instance.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,UAAU,GACX,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAEzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,GAAG,EAAE,CAAA;AAE1C,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAuB,EAAE;IAChE,OAAO,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE;QAChC,GAAG,EAAE,mBAAmB,GAAG,IAAI,EAAE,eAAe;QAChD,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;QACxB,WAAW,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,EAAE,EAAE;KACtD,CAAC,CAAA;AACJ,CAAC,CAAA"}
|