Skip to content

Commit 698e119

Browse files
Revert "update packages (#212)" (#228)
This reverts commit 16d8966.
1 parent 16d8966 commit 698e119

File tree

8 files changed

+387
-454
lines changed

8 files changed

+387
-454
lines changed

jwt_console_project/package-lock.json

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jwt_console_project/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
"author": "DocuSign, Inc",
1313
"license": "ISC",
1414
"dependencies": {
15-
"docusign-esign": "^8.1.0",
15+
"docusign-esign": "^8.0.1",
1616
"fs": "^0.0.1-security",
17-
"fs-extra": "^11.3.0",
17+
"fs-extra": "^11.2.0",
1818
"path": "^0.12.7",
1919
"prompt-sync": "^4.2.0",
2020
"remove-node-modules": "^1.7.6"
Lines changed: 110 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,110 @@
1-
/**
2-
* @file
3-
* Example 008: Grant office access to form group
4-
* @author DocuSign
5-
*/
6-
7-
const path = require('path');
8-
const { grantOfficeAccessToFormGroup, getFormGroupsAndOffices } = require('../examples/grantOfficeAccessToFormGroup');
9-
const validator = require('validator');
10-
const { getExampleByNumber } = require('../../manifestService');
11-
const dsConfig = require('../../../config/index.js').config;
12-
const { formatString, API_TYPES } = require('../../utils.js');
13-
14-
const eg008GrantOfficeAccessToFormGroup = exports;
15-
const exampleNumber = 8;
16-
const eg = `reg00${exampleNumber}`; // This example reference.
17-
const api = API_TYPES.ROOMS;
18-
const mustAuthenticate = '/ds/mustAuthenticate';
19-
const minimumBufferMin = 3;
20-
21-
/**
22-
* Grant office access to form group
23-
* @param {object} req Request obj
24-
* @param {object} res Response obj
25-
*/
26-
eg008GrantOfficeAccessToFormGroup.createController = async (req, res) => {
27-
// At this point we should have a good token. But we
28-
// double-check here to enable a better UX to the user.
29-
const isTokenOK = req.dsAuth.checkToken(minimumBufferMin);
30-
if (!isTokenOK) {
31-
req.flash('info', 'Sorry, you need to re-authenticate.');
32-
// Save the current operation so it will be resumed after authentication
33-
req.dsAuth.setEg(req, eg);
34-
return res.redirect(mustAuthenticate);
35-
}
36-
37-
// Call the worker method
38-
let results = null;
39-
const body = req.body;
40-
const args = {
41-
accessToken: req.user.accessToken,
42-
basePath: `${dsConfig.roomsApiUrl}/restapi`,
43-
accountId: req.session.accountId,
44-
formGroupId: validator.escape(body.formGroupId),
45-
officeId: validator.escape(body.officeId)
46-
};
47-
try {
48-
results = await grantOfficeAccessToFormGroup(args);
49-
50-
const example = getExampleByNumber(res.locals.manifest, exampleNumber, api);
51-
res.render('pages/example_done', {
52-
title: example.ExampleName,
53-
message: formatString(example.ResultsPageText, args.officeId, args.formGroupId),
54-
});
55-
} catch (error) {
56-
const errorBody = error?.body || error?.response?.body;
57-
// we can pull the DocuSign error code and message from the response body
58-
const errorCode = errorBody?.errorCode;
59-
const errorMessage = errorBody?.message;
60-
// In production, may want to provide customized error messages and
61-
// remediation advice to the user.
62-
res.render('pages/error', { err: error, errorCode, errorMessage });
63-
}
64-
};
65-
66-
/**
67-
* Form page for this application
68-
*/
69-
eg008GrantOfficeAccessToFormGroup.getController = async (req, res) => {
70-
// Check that the authentication token is ok with a long buffer time.
71-
// If needed, now is the best time to ask the user to authenticate
72-
// since they have not yet entered any information into the form.
73-
const isTokenOK = req.dsAuth.checkToken();
74-
if (!isTokenOK) {
75-
// Save the current operation so it will be resumed after authentication
76-
req.dsAuth.setEg(req, eg);
77-
return res.redirect(mustAuthenticate);
78-
}
79-
80-
try {
81-
const args = {
82-
accessToken: req.user.accessToken,
83-
basePath: `${dsConfig.roomsApiUrl}/restapi`,
84-
accountId: req.session.accountId,
85-
};
86-
87-
const results = await getFormGroupsAndOffices(args);
88-
89-
const example = getExampleByNumber(res.locals.manifest, exampleNumber, api);
90-
const sourceFile = (path.basename(__filename))[5].toLowerCase() + (path.basename(__filename)).substr(6);
91-
res.render('pages/rooms-examples/eg008GrantOfficeAccessToFormGroup', {
92-
eg: eg, csrfToken: req.csrfToken(),
93-
example: example,
94-
formGroups: results.formGroups,
95-
offices: results.offices,
96-
sourceFile: sourceFile,
97-
sourceUrl: dsConfig.githubExampleUrl + 'rooms/examples/' + sourceFile,
98-
documentation: dsConfig.documentation + eg,
99-
showDoc: dsConfig.documentation
100-
});
101-
} catch (error) {
102-
const errorBody = error && error.response && error.response.body;
103-
// we can pull the DocuSign error code and message from the response body
104-
const errorCode = errorBody && errorBody.errorCode;
105-
const errorMessage = errorBody && errorBody.message;
106-
// In production, may want to provide customized error messages and
107-
// remediation advice to the user.
108-
res.render('pages/error', { err: error, errorCode, errorMessage });
109-
}
110-
};
1+
/**
2+
* @file
3+
* Example 008: Grant office access to form group
4+
* @author DocuSign
5+
*/
6+
7+
const path = require('path');
8+
const { grantOfficeAccessToFormGroup, getFormGroupsAndOffices } = require('../examples/grantOfficeAccessToFormGroup');
9+
const validator = require('validator');
10+
const { getExampleByNumber } = require('../../manifestService');
11+
const dsConfig = require('../../../config/index.js').config;
12+
const { formatString, API_TYPES } = require('../../utils.js');
13+
14+
const eg008GrantOfficeAccessToFormGroup = exports;
15+
const exampleNumber = 8;
16+
const eg = `reg00${exampleNumber}`; // This example reference.
17+
const api = API_TYPES.ROOMS;
18+
const mustAuthenticate = '/ds/mustAuthenticate';
19+
const minimumBufferMin = 3;
20+
21+
/**
22+
* Grant office access to form group
23+
* @param {object} req Request obj
24+
* @param {object} res Response obj
25+
*/
26+
eg008GrantOfficeAccessToFormGroup.createController = async (req, res) => {
27+
// At this point we should have a good token. But we
28+
// double-check here to enable a better UX to the user.
29+
const isTokenOK = req.dsAuth.checkToken(minimumBufferMin);
30+
if (!isTokenOK) {
31+
req.flash('info', 'Sorry, you need to re-authenticate.');
32+
// Save the current operation so it will be resumed after authentication
33+
req.dsAuth.setEg(req, eg);
34+
return res.redirect(mustAuthenticate);
35+
}
36+
37+
// Call the worker method
38+
let results = null;
39+
const body = req.body;
40+
const args = {
41+
accessToken: req.user.accessToken,
42+
basePath: `${dsConfig.roomsApiUrl}/restapi`,
43+
accountId: req.session.accountId,
44+
formGroupId: validator.escape(body.formGroupId),
45+
officeId: validator.escape(body.officeId)
46+
};
47+
try {
48+
results = await grantOfficeAccessToFormGroup(args);
49+
50+
const example = getExampleByNumber(res.locals.manifest, exampleNumber, api);
51+
res.render('pages/example_done', {
52+
title: example.ExampleName,
53+
message: formatString(example.ResultsPageText, args.officeId, args.formGroupId),
54+
});
55+
} catch (error) {
56+
const errorBody = error && error.response && error.response.body;
57+
// we can pull the DocuSign error code and message from the response body
58+
const errorCode = errorBody && errorBody.errorCode;
59+
const errorMessage = errorBody && errorBody.message;
60+
// In production, may want to provide customized error messages and
61+
// remediation advice to the user.
62+
res.render('pages/error', { err: error, errorCode, errorMessage });
63+
}
64+
};
65+
66+
/**
67+
* Form page for this application
68+
*/
69+
eg008GrantOfficeAccessToFormGroup.getController = async (req, res) => {
70+
// Check that the authentication token is ok with a long buffer time.
71+
// If needed, now is the best time to ask the user to authenticate
72+
// since they have not yet entered any information into the form.
73+
const isTokenOK = req.dsAuth.checkToken();
74+
if (!isTokenOK) {
75+
// Save the current operation so it will be resumed after authentication
76+
req.dsAuth.setEg(req, eg);
77+
return res.redirect(mustAuthenticate);
78+
}
79+
80+
try {
81+
const args = {
82+
accessToken: req.user.accessToken,
83+
basePath: `${dsConfig.roomsApiUrl}/restapi`,
84+
accountId: req.session.accountId,
85+
};
86+
87+
const results = await getFormGroupsAndOffices(args);
88+
89+
const example = getExampleByNumber(res.locals.manifest, exampleNumber, api);
90+
const sourceFile = (path.basename(__filename))[5].toLowerCase() + (path.basename(__filename)).substr(6);
91+
res.render('pages/rooms-examples/eg008GrantOfficeAccessToFormGroup', {
92+
eg: eg, csrfToken: req.csrfToken(),
93+
example: example,
94+
formGroups: results.formGroups,
95+
offices: results.offices,
96+
sourceFile: sourceFile,
97+
sourceUrl: dsConfig.githubExampleUrl + 'rooms/examples/' + sourceFile,
98+
documentation: dsConfig.documentation + eg,
99+
showDoc: dsConfig.documentation
100+
});
101+
} catch (error) {
102+
const errorBody = error && error.response && error.response.body;
103+
// we can pull the DocuSign error code and message from the response body
104+
const errorCode = errorBody && errorBody.errorCode;
105+
const errorMessage = errorBody && errorBody.message;
106+
// In production, may want to provide customized error messages and
107+
// remediation advice to the user.
108+
res.render('pages/error', { err: error, errorCode, errorMessage });
109+
}
110+
};

0 commit comments

Comments
 (0)