decap-cms-backend-github 3.0.1 → 3.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/CHANGELOG.md +19 -0
- package/dist/decap-cms-backend-github.js +71 -71
- package/dist/decap-cms-backend-github.js.map +1 -1
- package/dist/esm/API.js +5 -8
- package/dist/esm/AuthenticationPage.js +27 -27
- package/dist/esm/GraphQLAPI.js +4 -4
- package/dist/esm/fragments.js +8 -15
- package/dist/esm/implementation.js +8 -8
- package/dist/esm/index.js +2 -3
- package/dist/esm/mutations.js +11 -19
- package/dist/esm/queries.js +14 -25
- package/package.json +4 -4
- package/src/AuthenticationPage.js +1 -1
- package/src/implementation.tsx +6 -2
package/dist/esm/queries.js
CHANGED
|
@@ -9,9 +9,9 @@ exports.user = exports.statues = exports.repository = exports.repoPermission = e
|
|
|
9
9
|
var _graphqlTag = require("graphql-tag");
|
|
10
10
|
var _commonTags = require("common-tags");
|
|
11
11
|
var fragments = _interopRequireWildcard(require("./fragments"));
|
|
12
|
-
function _getRequireWildcardCache(
|
|
13
|
-
function _interopRequireWildcard(
|
|
14
|
-
const repoPermission = (0, _graphqlTag.gql)`
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
const repoPermission = exports.repoPermission = (0, _graphqlTag.gql)`
|
|
15
15
|
query repoPermission($owner: String!, $name: String!) {
|
|
16
16
|
repository(owner: $owner, name: $name) {
|
|
17
17
|
...RepositoryParts
|
|
@@ -20,8 +20,7 @@ const repoPermission = (0, _graphqlTag.gql)`
|
|
|
20
20
|
}
|
|
21
21
|
${fragments.repository}
|
|
22
22
|
`;
|
|
23
|
-
exports.
|
|
24
|
-
const user = (0, _graphqlTag.gql)`
|
|
23
|
+
const user = exports.user = (0, _graphqlTag.gql)`
|
|
25
24
|
query {
|
|
26
25
|
viewer {
|
|
27
26
|
id
|
|
@@ -31,8 +30,7 @@ const user = (0, _graphqlTag.gql)`
|
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
`;
|
|
34
|
-
exports.
|
|
35
|
-
const blob = (0, _graphqlTag.gql)`
|
|
33
|
+
const blob = exports.blob = (0, _graphqlTag.gql)`
|
|
36
34
|
query blob($owner: String!, $name: String!, $expression: String!) {
|
|
37
35
|
repository(owner: $owner, name: $name) {
|
|
38
36
|
...RepositoryParts
|
|
@@ -46,8 +44,7 @@ const blob = (0, _graphqlTag.gql)`
|
|
|
46
44
|
${fragments.repository}
|
|
47
45
|
${fragments.blobWithText}
|
|
48
46
|
`;
|
|
49
|
-
exports.
|
|
50
|
-
const statues = (0, _graphqlTag.gql)`
|
|
47
|
+
const statues = exports.statues = (0, _graphqlTag.gql)`
|
|
51
48
|
query statues($owner: String!, $name: String!, $sha: GitObjectID!) {
|
|
52
49
|
repository(owner: $owner, name: $name) {
|
|
53
50
|
...RepositoryParts
|
|
@@ -70,7 +67,6 @@ const statues = (0, _graphqlTag.gql)`
|
|
|
70
67
|
${fragments.repository}
|
|
71
68
|
${fragments.object}
|
|
72
69
|
`;
|
|
73
|
-
exports.statues = statues;
|
|
74
70
|
function buildFilesQuery(depth = 1) {
|
|
75
71
|
const PLACE_HOLDER = 'PLACE_HOLDER';
|
|
76
72
|
let query = (0, _commonTags.oneLine)`
|
|
@@ -117,7 +113,7 @@ branch: ref(qualifiedName: $qualifiedName) {
|
|
|
117
113
|
...BranchParts
|
|
118
114
|
}
|
|
119
115
|
`;
|
|
120
|
-
const branch = (0, _graphqlTag.gql)`
|
|
116
|
+
const branch = exports.branch = (0, _graphqlTag.gql)`
|
|
121
117
|
query branch($owner: String!, $name: String!, $qualifiedName: String!) {
|
|
122
118
|
repository(owner: $owner, name: $name) {
|
|
123
119
|
...RepositoryParts
|
|
@@ -127,8 +123,7 @@ const branch = (0, _graphqlTag.gql)`
|
|
|
127
123
|
${fragments.repository}
|
|
128
124
|
${fragments.branch}
|
|
129
125
|
`;
|
|
130
|
-
exports.
|
|
131
|
-
const openAuthoringBranches = (0, _graphqlTag.gql)`
|
|
126
|
+
const openAuthoringBranches = exports.openAuthoringBranches = (0, _graphqlTag.gql)`
|
|
132
127
|
query openAuthoringBranches($owner: String!, $name: String!, $refPrefix: String!) {
|
|
133
128
|
repository(owner: $owner, name: $name) {
|
|
134
129
|
...RepositoryParts
|
|
@@ -142,8 +137,7 @@ const openAuthoringBranches = (0, _graphqlTag.gql)`
|
|
|
142
137
|
${fragments.repository}
|
|
143
138
|
${fragments.branch}
|
|
144
139
|
`;
|
|
145
|
-
exports.
|
|
146
|
-
const repository = (0, _graphqlTag.gql)`
|
|
140
|
+
const repository = exports.repository = (0, _graphqlTag.gql)`
|
|
147
141
|
query repository($owner: String!, $name: String!) {
|
|
148
142
|
repository(owner: $owner, name: $name) {
|
|
149
143
|
...RepositoryParts
|
|
@@ -151,13 +145,12 @@ const repository = (0, _graphqlTag.gql)`
|
|
|
151
145
|
}
|
|
152
146
|
${fragments.repository}
|
|
153
147
|
`;
|
|
154
|
-
exports.repository = repository;
|
|
155
148
|
const pullRequestQueryPart = `
|
|
156
149
|
pullRequest(number: $number) {
|
|
157
150
|
...PullRequestParts
|
|
158
151
|
}
|
|
159
152
|
`;
|
|
160
|
-
const pullRequest = (0, _graphqlTag.gql)`
|
|
153
|
+
const pullRequest = exports.pullRequest = (0, _graphqlTag.gql)`
|
|
161
154
|
query pullRequest($owner: String!, $name: String!, $number: Int!) {
|
|
162
155
|
repository(owner: $owner, name: $name) {
|
|
163
156
|
id
|
|
@@ -166,8 +159,7 @@ const pullRequest = (0, _graphqlTag.gql)`
|
|
|
166
159
|
}
|
|
167
160
|
${fragments.pullRequest}
|
|
168
161
|
`;
|
|
169
|
-
exports.
|
|
170
|
-
const pullRequests = (0, _graphqlTag.gql)`
|
|
162
|
+
const pullRequests = exports.pullRequests = (0, _graphqlTag.gql)`
|
|
171
163
|
query pullRequests($owner: String!, $name: String!, $head: String, $states: [PullRequestState!]) {
|
|
172
164
|
repository(owner: $owner, name: $name) {
|
|
173
165
|
id
|
|
@@ -180,8 +172,7 @@ const pullRequests = (0, _graphqlTag.gql)`
|
|
|
180
172
|
}
|
|
181
173
|
${fragments.pullRequest}
|
|
182
174
|
`;
|
|
183
|
-
exports.
|
|
184
|
-
const pullRequestAndBranch = (0, _graphqlTag.gql)`
|
|
175
|
+
const pullRequestAndBranch = exports.pullRequestAndBranch = (0, _graphqlTag.gql)`
|
|
185
176
|
query pullRequestAndBranch($owner: String!, $name: String!, $originRepoOwner: String!, $originRepoName: String!, $qualifiedName: String!, $number: Int!) {
|
|
186
177
|
repository(owner: $owner, name: $name) {
|
|
187
178
|
...RepositoryParts
|
|
@@ -196,8 +187,7 @@ const pullRequestAndBranch = (0, _graphqlTag.gql)`
|
|
|
196
187
|
${fragments.branch}
|
|
197
188
|
${fragments.pullRequest}
|
|
198
189
|
`;
|
|
199
|
-
exports.
|
|
200
|
-
const fileSha = (0, _graphqlTag.gql)`
|
|
190
|
+
const fileSha = exports.fileSha = (0, _graphqlTag.gql)`
|
|
201
191
|
query fileSha($owner: String!, $name: String!, $expression: String!) {
|
|
202
192
|
repository(owner: $owner, name: $name) {
|
|
203
193
|
...RepositoryParts
|
|
@@ -208,5 +198,4 @@ const fileSha = (0, _graphqlTag.gql)`
|
|
|
208
198
|
}
|
|
209
199
|
${fragments.repository}
|
|
210
200
|
${fragments.object}
|
|
211
|
-
`;
|
|
212
|
-
exports.fileSha = fileSha;
|
|
201
|
+
`;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "decap-cms-backend-github",
|
|
3
3
|
"description": "GitHub backend for Decap CMS",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/decaporg/decap-cms/tree/master/packages/decap-cms-backend-github",
|
|
7
7
|
"bugs": "https://github.com/decaporg/decap-cms/issues",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"semaphore": "^1.1.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@emotion/
|
|
35
|
-
"@emotion/styled": "^
|
|
34
|
+
"@emotion/react": "^11.11.1",
|
|
35
|
+
"@emotion/styled": "^11.11.0",
|
|
36
36
|
"decap-cms-lib-auth": "^3.0.0",
|
|
37
37
|
"decap-cms-lib-util": "^3.0.0",
|
|
38
38
|
"decap-cms-ui-default": "^3.0.0",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"prop-types": "^15.7.2",
|
|
41
41
|
"react": "^16.8.4 || ^17.0.0"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "d9cb3119d09e7a76b995e477f7578fb5ad80b461"
|
|
44
44
|
}
|
|
@@ -70,7 +70,7 @@ export default class GitHubAuthenticationPage extends React.Component {
|
|
|
70
70
|
base_url: this.props.base_url,
|
|
71
71
|
site_id:
|
|
72
72
|
document.location.host.split(':')[0] === 'localhost'
|
|
73
|
-
? '
|
|
73
|
+
? 'demo.decapcms.org'
|
|
74
74
|
: this.props.siteId,
|
|
75
75
|
auth_endpoint: this.props.authEndpoint,
|
|
76
76
|
};
|
package/src/implementation.tsx
CHANGED
|
@@ -401,14 +401,18 @@ export default class GitHub implements Implementation {
|
|
|
401
401
|
return files;
|
|
402
402
|
}
|
|
403
403
|
|
|
404
|
-
async allEntriesByFolder(folder: string, extension: string, depth: number) {
|
|
404
|
+
async allEntriesByFolder(folder: string, extension: string, depth: number, pathRegex?: RegExp) {
|
|
405
405
|
const repoURL = this.api!.originRepoURL;
|
|
406
406
|
|
|
407
407
|
const listFiles = () =>
|
|
408
408
|
this.api!.listFiles(folder, {
|
|
409
409
|
repoURL,
|
|
410
410
|
depth,
|
|
411
|
-
}).then(files =>
|
|
411
|
+
}).then(files =>
|
|
412
|
+
files.filter(
|
|
413
|
+
file => (!pathRegex || pathRegex.test(file.path)) && filterByExtension(file, extension),
|
|
414
|
+
),
|
|
415
|
+
);
|
|
412
416
|
|
|
413
417
|
const readFile = (path: string, id: string | null | undefined) => {
|
|
414
418
|
return this.api!.readFile(path, id, { repoURL }) as Promise<string>;
|