@forge/auth 0.0.1 → 0.0.2-next.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 +6 -0
- package/out/api.js +2 -1
- package/out/confluence/index.d.ts +1 -1
- package/out/confluence/index.d.ts.map +1 -1
- package/out/confluence/index.js +3 -2
- package/out/index.d.ts +3 -2
- package/out/index.d.ts.map +1 -1
- package/out/index.js +1 -0
- package/out/jira/index.d.ts +1 -2
- package/out/jira/index.d.ts.map +1 -1
- package/out/jira/index.js +4 -3
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
package/out/api.js
CHANGED
|
@@ -7,7 +7,8 @@ const fromEntries = (array) => {
|
|
|
7
7
|
return acc;
|
|
8
8
|
}, {});
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
const createApiMethods = (methodToPermissionMap, permissionCheckFactory) => {
|
|
11
11
|
const apiMethodEntries = Object.entries(methodToPermissionMap).map(([methodName, permission]) => [methodName, permissionCheckFactory(permission)]);
|
|
12
12
|
return fromEntries(apiMethodEntries);
|
|
13
13
|
};
|
|
14
|
+
exports.createApiMethods = createApiMethods;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FetchHelper } from '../types';
|
|
2
2
|
declare type RequestConfluence = FetchHelper['requestConfluence'];
|
|
3
|
-
declare type ContentId = string | number;
|
|
3
|
+
export declare type ContentId = string | number;
|
|
4
4
|
export declare const authorizeConfluenceWithFetch: (requestConfluence: RequestConfluence, accountId: string) => {
|
|
5
5
|
readonly onConfluenceContent: (contentId: ContentId) => Record<string, import("../types").PermissionCheck>;
|
|
6
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/confluence/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,aAAK,iBAAiB,GAAG,WAAW,CAAC,mBAAmB,CAAC,CAAC;AAE1D,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/confluence/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,aAAK,iBAAiB,GAAG,WAAW,CAAC,mBAAmB,CAAC,CAAC;AAE1D,oBAAY,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AA+BxC,eAAO,MAAM,4BAA4B,sBAAuB,iBAAiB,aAAa,MAAM;8CAE/D,SAAS;CAG7C,CAAC"}
|
package/out/confluence/index.js
CHANGED
|
@@ -23,8 +23,9 @@ const getPermissionsCheckFactory = (requestConfluence, accountId, contentId) =>
|
|
|
23
23
|
return Boolean(res === null || res === void 0 ? void 0 : res.hasPermission);
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
const authorizeConfluenceWithFetch = (requestConfluence, accountId) => {
|
|
27
27
|
return {
|
|
28
|
-
onConfluenceContent: (contentId) => api_1.createApiMethods(permissions_1.default, getPermissionsCheckFactory(requestConfluence, accountId, contentId))
|
|
28
|
+
onConfluenceContent: (contentId) => (0, api_1.createApiMethods)(permissions_1.default, getPermissionsCheckFactory(requestConfluence, accountId, contentId))
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
+
exports.authorizeConfluenceWithFetch = authorizeConfluenceWithFetch;
|
package/out/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { authorizeConfluenceWithFetch } from './confluence';
|
|
2
|
-
export { authorizeJiraWithFetch } from './jira';
|
|
1
|
+
export { authorizeConfluenceWithFetch, ContentId } from './confluence';
|
|
2
|
+
export { authorizeJiraWithFetch, ProjectPermission, ProjectPermissionResponse, Id } from './jira';
|
|
3
|
+
export { PermissionCheck } from './types';
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClG,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
|
package/out/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.authorizeJiraWithFetch = exports.authorizeConfluenceWithFetch = void 0;
|
|
3
4
|
var confluence_1 = require("./confluence");
|
|
4
5
|
Object.defineProperty(exports, "authorizeConfluenceWithFetch", { enumerable: true, get: function () { return confluence_1.authorizeConfluenceWithFetch; } });
|
|
5
6
|
var jira_1 = require("./jira");
|
package/out/jira/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FetchHelper } from '../types';
|
|
2
|
-
declare type RequestJira = FetchHelper['requestJira'];
|
|
2
|
+
export declare type RequestJira = FetchHelper['requestJira'];
|
|
3
3
|
export declare type Id = number | string;
|
|
4
4
|
export interface ProjectPermission {
|
|
5
5
|
permissions: string[];
|
|
@@ -16,5 +16,4 @@ export declare const authorizeJiraWithFetch: (requestJira: RequestJira, accountI
|
|
|
16
16
|
readonly onJiraProject: (projects: Id | Id[]) => Record<string, import("../types").PermissionCheck>;
|
|
17
17
|
readonly onJiraIssue: (issues: Id | Id[]) => Record<string, import("../types").PermissionCheck>;
|
|
18
18
|
};
|
|
19
|
-
export {};
|
|
20
19
|
//# sourceMappingURL=index.d.ts.map
|
package/out/jira/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/jira/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/jira/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,oBAAY,WAAW,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC;AAIrD,oBAAY,EAAE,GAAG,MAAM,GAAG,MAAM,CAAC;AACjC,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC;IACd,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAwDD,eAAO,MAAM,sBAAsB,gBAAiB,WAAW,aAAa,MAAM;+CAEtC,iBAAiB,EAAE;uCAIjC,EAAE,GAAG,EAAE,EAAE;mCAMb,EAAE,GAAG,EAAE,EAAE;CAMlC,CAAC"}
|
package/out/jira/index.js
CHANGED
|
@@ -35,13 +35,14 @@ const getPermissionCheckFactory = (requestJira, accountId, type, entities) => (p
|
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
const toArray = (id) => (Array.isArray(id) ? id : [id]);
|
|
38
|
-
|
|
38
|
+
const authorizeJiraWithFetch = (requestJira, accountId) => {
|
|
39
39
|
return {
|
|
40
40
|
onJira: async (projectPermissionsInput) => {
|
|
41
41
|
const result = await checkJiraPermissions(requestJira, accountId, projectPermissionsInput);
|
|
42
42
|
return result.projectPermissions || [];
|
|
43
43
|
},
|
|
44
|
-
onJiraProject: (projects) => api_1.createApiMethods(permissions_1.API_PROJECTS_PERMISSIONS_MAP, getPermissionCheckFactory(requestJira, accountId, 'projects', toArray(projects))),
|
|
45
|
-
onJiraIssue: (issues) => api_1.createApiMethods(permissions_1.API_ISSUES_PERMISSIONS_MAP, getPermissionCheckFactory(requestJira, accountId, 'issues', toArray(issues)))
|
|
44
|
+
onJiraProject: (projects) => (0, api_1.createApiMethods)(permissions_1.API_PROJECTS_PERMISSIONS_MAP, getPermissionCheckFactory(requestJira, accountId, 'projects', toArray(projects))),
|
|
45
|
+
onJiraIssue: (issues) => (0, api_1.createApiMethods)(permissions_1.API_ISSUES_PERMISSIONS_MAP, getPermissionCheckFactory(requestJira, accountId, 'issues', toArray(issues)))
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
|
+
exports.authorizeJiraWithFetch = authorizeJiraWithFetch;
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/auth",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2-next.0",
|
|
4
4
|
"description": "Supports authorization for product REST API calls",
|
|
5
5
|
"main": "out/index.js",
|
|
6
|
+
"types": "out/index.d.ts",
|
|
6
7
|
"license": "UNLICENSED",
|
|
7
8
|
"scripts": {
|
|
8
9
|
"build": "yarn run clean && yarn run compile",
|
|
@@ -10,6 +11,6 @@
|
|
|
10
11
|
"clean": "rm -rf ./out && rm -f tsconfig.tsbuildinfo"
|
|
11
12
|
},
|
|
12
13
|
"dependencies": {
|
|
13
|
-
"tslib": "^
|
|
14
|
+
"tslib": "^2.4.0"
|
|
14
15
|
}
|
|
15
16
|
}
|