@anmiles/google-api-wrapper 18.0.3 → 19.0.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/.nycrc.json +27 -0
- package/CHANGELOG.md +28 -21
- package/README.md +1 -1
- package/cspell.json +22 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/api.d.ts +5 -11
- package/dist/lib/api.d.ts.map +1 -1
- package/dist/lib/api.js +5 -6
- package/dist/lib/api.js.map +1 -1
- package/dist/lib/auth.d.ts +2 -9
- package/dist/lib/auth.d.ts.map +1 -1
- package/dist/lib/auth.js +3 -23
- package/dist/lib/auth.js.map +1 -1
- package/dist/lib/credentials/generator.d.ts +4 -0
- package/dist/lib/credentials/generator.d.ts.map +1 -0
- package/dist/lib/credentials/generator.js +60 -0
- package/dist/lib/credentials/generator.js.map +1 -0
- package/dist/lib/credentials/index.d.ts +5 -0
- package/dist/lib/credentials/index.d.ts.map +1 -0
- package/dist/lib/credentials/index.js +41 -0
- package/dist/lib/credentials/index.js.map +1 -0
- package/dist/lib/credentials/validator.d.ts +6 -0
- package/dist/lib/credentials/validator.d.ts.map +1 -0
- package/dist/lib/credentials/validator.js +21 -0
- package/dist/lib/credentials/validator.js.map +1 -0
- package/dist/lib/login.d.ts +3 -0
- package/dist/lib/login.d.ts.map +1 -0
- package/dist/lib/login.js +19 -0
- package/dist/lib/login.js.map +1 -0
- package/dist/lib/profiles.d.ts +4 -12
- package/dist/lib/profiles.d.ts.map +1 -1
- package/dist/lib/profiles.js +8 -11
- package/dist/lib/profiles.js.map +1 -1
- package/dist/lib/renderer.d.ts +7 -25
- package/dist/lib/renderer.d.ts.map +1 -1
- package/dist/lib/renderer.js +26 -23
- package/dist/lib/renderer.js.map +1 -1
- package/dist/lib/scopes.d.ts +2 -0
- package/dist/lib/scopes.d.ts.map +1 -0
- package/dist/lib/scopes.js +22 -0
- package/dist/lib/scopes.js.map +1 -0
- package/dist/lib/secrets.d.ts +2 -28
- package/dist/lib/secrets.d.ts.map +1 -1
- package/dist/lib/secrets.js +11 -112
- package/dist/lib/secrets.js.map +1 -1
- package/dist/lib/utils/paths.d.ts +7 -0
- package/dist/lib/utils/paths.d.ts.map +1 -0
- package/dist/lib/{paths.js → utils/paths.js} +6 -8
- package/dist/lib/utils/paths.js.map +1 -0
- package/dist/templates/auth.html +1 -1
- package/dist/templates/index.html +6 -1
- package/dist/templates/page.html +1 -2
- package/dist/templates/script.html +0 -0
- package/{src/templates/css.html → dist/templates/style.html} +2 -2
- package/dist/types/options.d.ts +2 -3
- package/dist/types/options.d.ts.map +1 -1
- package/dist/types/secrets.d.ts +1 -2
- package/dist/types/secrets.d.ts.map +1 -1
- package/eslint.config.mts +43 -0
- package/jest.config.js +9 -9
- package/package.json +40 -30
- package/src/index.ts +3 -2
- package/src/lib/__tests__/__snapshots__/renderer.test.ts.snap +273 -0
- package/src/lib/__tests__/__snapshots__/scopes.test.ts.snap +6 -0
- package/src/lib/__tests__/__snapshots__/secrets.test.ts.snap +38 -0
- package/src/lib/__tests__/api.test.ts +72 -74
- package/src/lib/__tests__/auth.test.ts +38 -114
- package/src/lib/__tests__/login.test.ts +71 -0
- package/src/lib/__tests__/profiles.test.ts +50 -93
- package/src/lib/__tests__/renderer.test.ts +16 -89
- package/src/lib/__tests__/scopes.test.ts +41 -0
- package/src/lib/__tests__/secrets.test.ts +47 -541
- package/src/lib/api.ts +19 -21
- package/src/lib/auth.ts +5 -25
- package/src/lib/credentials/__tests__/generator.test.ts +249 -0
- package/src/lib/credentials/__tests__/index.test.ts +213 -0
- package/src/lib/credentials/__tests__/validator.test.ts +34 -0
- package/src/lib/credentials/generator.ts +70 -0
- package/src/lib/credentials/index.ts +49 -0
- package/src/lib/credentials/validator.ts +24 -0
- package/src/lib/login.ts +22 -0
- package/src/lib/profiles.ts +9 -12
- package/src/lib/renderer.ts +32 -27
- package/src/lib/scopes.ts +18 -0
- package/src/lib/secrets.ts +17 -139
- package/src/lib/utils/paths.ts +30 -0
- package/src/templates/auth.html +1 -1
- package/src/templates/index.html +6 -1
- package/src/templates/page.html +1 -2
- package/src/templates/script.html +0 -0
- package/{dist/templates/css.html → src/templates/style.html} +2 -2
- package/src/types/options.ts +5 -7
- package/src/types/secrets.ts +8 -10
- package/tsconfig.build.json +6 -0
- package/tsconfig.json +0 -5
- package/tsconfig.test.json +1 -1
- package/.eslintignore +0 -2
- package/.eslintrc.js +0 -30
- package/.vscode/settings.json +0 -9
- package/coverage.config.js +0 -8
- package/dist/lib/paths.d.ts +0 -16
- package/dist/lib/paths.d.ts.map +0 -1
- package/dist/lib/paths.js.map +0 -1
- package/src/lib/__tests__/paths.test.ts +0 -77
- package/src/lib/paths.ts +0 -32
package/dist/lib/profiles.js
CHANGED
|
@@ -3,35 +3,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.getProfiles = getProfiles;
|
|
7
|
+
exports.setProfiles = setProfiles;
|
|
8
|
+
exports.createProfile = createProfile;
|
|
9
|
+
exports.filterProfiles = filterProfiles;
|
|
7
10
|
const fs_1 = __importDefault(require("fs"));
|
|
8
11
|
require("@anmiles/prototypes");
|
|
9
|
-
const paths_1 = require("./paths");
|
|
10
|
-
const profiles_1 = __importDefault(require("./profiles"));
|
|
12
|
+
const paths_1 = require("./utils/paths");
|
|
11
13
|
function getProfiles() {
|
|
12
14
|
const profilesFile = (0, paths_1.getProfilesFile)();
|
|
13
15
|
return fs_1.default.getJSON(profilesFile, () => []);
|
|
14
16
|
}
|
|
15
|
-
exports.getProfiles = getProfiles;
|
|
16
17
|
function setProfiles(profiles) {
|
|
17
18
|
const profilesFile = (0, paths_1.getProfilesFile)();
|
|
18
19
|
fs_1.default.writeJSON(profilesFile, profiles);
|
|
19
20
|
}
|
|
20
|
-
exports.setProfiles = setProfiles;
|
|
21
21
|
function createProfile(profile) {
|
|
22
22
|
if (!profile) {
|
|
23
23
|
throw new Error('Usage: `npm run create <profile>` where `profile` - is any profile name you want');
|
|
24
24
|
}
|
|
25
|
-
const existingProfiles =
|
|
25
|
+
const existingProfiles = getProfiles();
|
|
26
26
|
if (existingProfiles.includes(profile)) {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
existingProfiles.push(profile);
|
|
30
|
-
|
|
30
|
+
setProfiles(existingProfiles);
|
|
31
31
|
}
|
|
32
|
-
exports.createProfile = createProfile;
|
|
33
32
|
function filterProfiles(profile) {
|
|
34
|
-
const existingProfiles =
|
|
33
|
+
const existingProfiles = getProfiles();
|
|
35
34
|
if (existingProfiles.length === 0) {
|
|
36
35
|
throw new Error('Please `npm run create` at least one profile');
|
|
37
36
|
}
|
|
@@ -43,6 +42,4 @@ function filterProfiles(profile) {
|
|
|
43
42
|
}
|
|
44
43
|
throw new Error(`Profile '${profile}' does not exist`);
|
|
45
44
|
}
|
|
46
|
-
exports.filterProfiles = filterProfiles;
|
|
47
|
-
exports.default = { getProfiles, setProfiles, createProfile, filterProfiles };
|
|
48
45
|
//# sourceMappingURL=profiles.js.map
|
package/dist/lib/profiles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../src/lib/profiles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../src/lib/profiles.ts"],"names":[],"mappings":";;;;;AAMA,kCAGC;AAED,kCAGC;AAED,sCAaC;AAED,wCAgBC;AA/CD,4CAAoB;AAEpB,+BAA6B;AAE7B,yCAAgD;AAEhD,SAAgB,WAAW;IAC1B,MAAM,YAAY,GAAG,IAAA,uBAAe,GAAE,CAAC;IACvC,OAAO,YAAE,CAAC,OAAO,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;AAC3C,CAAC;AAED,SAAgB,WAAW,CAAC,QAAkB;IAC7C,MAAM,YAAY,GAAG,IAAA,uBAAe,GAAE,CAAC;IACvC,YAAE,CAAC,SAAS,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;AACtC,CAAC;AAED,SAAgB,aAAa,CAAC,OAAgB;IAC7C,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;IACrG,CAAC;IAED,MAAM,gBAAgB,GAAG,WAAW,EAAE,CAAC;IAEvC,IAAI,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,OAAO;IACR,CAAC;IAED,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/B,WAAW,CAAC,gBAAgB,CAAC,CAAC;AAC/B,CAAC;AAED,SAAgB,cAAc,CAAC,OAAgB;IAC9C,MAAM,gBAAgB,GAAG,WAAW,EAAE,CAAC;IAEvC,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IACjE,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAO,gBAAgB,CAAC;IACzB,CAAC;IAED,IAAI,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,OAAO,CAAE,OAAO,CAAE,CAAC;IACpB,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,YAAY,OAAO,kBAAkB,CAAC,CAAC;AACxD,CAAC"}
|
package/dist/lib/renderer.d.ts
CHANGED
|
@@ -1,36 +1,18 @@
|
|
|
1
|
-
declare const templates: {
|
|
2
|
-
readonly index: readonly ["page"];
|
|
3
|
-
readonly page: readonly ["
|
|
4
|
-
readonly
|
|
1
|
+
export declare const templates: {
|
|
2
|
+
readonly index: readonly ["style", "page", "script"];
|
|
3
|
+
readonly page: readonly ["content"];
|
|
4
|
+
readonly style: readonly [];
|
|
5
|
+
readonly script: readonly [];
|
|
5
6
|
readonly auth: readonly ["profile", "authUrl", "scopesList"];
|
|
6
7
|
readonly scope: readonly ["type", "title", "name"];
|
|
7
8
|
readonly done: readonly ["profile"];
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
-
declare function renderAuth({ profile, authUrl, scope }: {
|
|
10
|
+
export declare function renderAuth({ profile, authUrl, scope }: {
|
|
11
11
|
profile: string;
|
|
12
12
|
authUrl: string;
|
|
13
13
|
scope: string[];
|
|
14
14
|
}): string;
|
|
15
|
-
declare function renderDone({ profile }: {
|
|
15
|
+
export declare function renderDone({ profile }: {
|
|
16
16
|
profile: string;
|
|
17
17
|
}): string;
|
|
18
|
-
declare function render<T extends TemplateName>(templateName: T, values: Record<typeof templates[T][number], string | undefined>): string;
|
|
19
|
-
declare function getTemplate(templateName: TemplateName): string;
|
|
20
|
-
export { templates, renderAuth, renderDone };
|
|
21
|
-
declare const _default: {
|
|
22
|
-
templates: {
|
|
23
|
-
readonly index: readonly ["page"];
|
|
24
|
-
readonly page: readonly ["css", "content"];
|
|
25
|
-
readonly css: readonly [];
|
|
26
|
-
readonly auth: readonly ["profile", "authUrl", "scopesList"];
|
|
27
|
-
readonly scope: readonly ["type", "title", "name"];
|
|
28
|
-
readonly done: readonly ["profile"];
|
|
29
|
-
};
|
|
30
|
-
render: typeof render;
|
|
31
|
-
getTemplate: typeof getTemplate;
|
|
32
|
-
renderAuth: typeof renderAuth;
|
|
33
|
-
renderDone: typeof renderDone;
|
|
34
|
-
};
|
|
35
|
-
export default _default;
|
|
36
18
|
//# sourceMappingURL=renderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/lib/renderer.ts"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/lib/renderer.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS;;;;;;;;CAQZ,CAAC;AAMX,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,MAAM,CAYrH;AAED,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAMnE"}
|
package/dist/lib/renderer.js
CHANGED
|
@@ -3,56 +3,59 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.templates = void 0;
|
|
7
|
+
exports.renderAuth = renderAuth;
|
|
8
|
+
exports.renderDone = renderDone;
|
|
7
9
|
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const paths_1 = require("./utils/paths");
|
|
11
|
+
exports.templates = {
|
|
12
|
+
index: ['style', 'page', 'script'],
|
|
13
|
+
page: ['content'],
|
|
14
|
+
style: [],
|
|
15
|
+
script: [],
|
|
14
16
|
auth: ['profile', 'authUrl', 'scopesList'],
|
|
15
17
|
scope: ['type', 'title', 'name'],
|
|
16
18
|
done: ['profile'],
|
|
17
19
|
};
|
|
18
|
-
|
|
19
|
-
const allHTML = {};
|
|
20
|
+
const allHTML = {}; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
20
21
|
function renderAuth({ profile, authUrl, scope }) {
|
|
21
22
|
const scopesList = scope.map((s) => render('scope', {
|
|
22
23
|
name: s.split('/').pop(),
|
|
23
24
|
title: s.endsWith('.readonly') ? 'Readonly (cannot change or delete your data)' : 'Writable (can change or delete your data)',
|
|
24
25
|
type: s.endsWith('.readonly') ? 'readonly' : '',
|
|
25
26
|
})).join('\n');
|
|
26
|
-
const
|
|
27
|
+
const style = render('style', {});
|
|
28
|
+
const script = render('script', {});
|
|
27
29
|
const content = render('auth', { profile, authUrl, scopesList });
|
|
28
|
-
const page = render('page', {
|
|
29
|
-
return render('index', { page });
|
|
30
|
+
const page = render('page', { content });
|
|
31
|
+
return render('index', { style, page, script });
|
|
30
32
|
}
|
|
31
|
-
exports.renderAuth = renderAuth;
|
|
32
33
|
function renderDone({ profile }) {
|
|
33
|
-
const
|
|
34
|
+
const style = render('style', {});
|
|
35
|
+
const script = render('script', {});
|
|
34
36
|
const content = render('done', { profile });
|
|
35
|
-
const page = render('page', {
|
|
36
|
-
return render('index', { page });
|
|
37
|
+
const page = render('page', { content });
|
|
38
|
+
return render('index', { style, page, script });
|
|
37
39
|
}
|
|
38
|
-
exports.renderDone = renderDone;
|
|
39
40
|
// TODO: Use react
|
|
40
41
|
function render(templateName, values) {
|
|
41
|
-
let html =
|
|
42
|
+
let html = getTemplate(templateName);
|
|
42
43
|
const allValues = values;
|
|
43
|
-
for (const variable of templates[templateName]) {
|
|
44
|
-
const value = allValues[variable]
|
|
45
|
-
|
|
44
|
+
for (const variable of exports.templates[templateName]) {
|
|
45
|
+
const value = allValues[variable];
|
|
46
|
+
if (typeof value === 'undefined') {
|
|
47
|
+
throw new Error(`Missing required value '${variable}' while rendering template '${templateName}'`);
|
|
48
|
+
}
|
|
49
|
+
html = html.replaceAll(`\${${variable}}`, value);
|
|
46
50
|
}
|
|
47
51
|
return html;
|
|
48
52
|
}
|
|
49
53
|
function getTemplate(templateName) {
|
|
50
54
|
if (!(templateName in allHTML)) {
|
|
51
55
|
const file = (0, paths_1.getTemplateFile)(templateName);
|
|
52
|
-
const template = fs_1.default.readFileSync(file).toString();
|
|
56
|
+
const template = fs_1.default.readFileSync(file).toString().trim();
|
|
53
57
|
allHTML[templateName] = template;
|
|
54
58
|
}
|
|
55
59
|
return allHTML[templateName];
|
|
56
60
|
}
|
|
57
|
-
exports.default = { templates, render, getTemplate, renderAuth, renderDone };
|
|
58
61
|
//# sourceMappingURL=renderer.js.map
|
package/dist/lib/renderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../src/lib/renderer.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../src/lib/renderer.ts"],"names":[],"mappings":";;;;;;AAkBA,gCAYC;AAED,gCAMC;AAtCD,4CAAoB;AAEpB,yCAAgD;AAEnC,QAAA,SAAS,GAAG;IACxB,KAAK,EAAG,CAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAW;IAC9C,IAAI,EAAI,CAAE,SAAS,CAAW;IAC9B,KAAK,EAAG,EAAY;IACpB,MAAM,EAAE,EAAY;IACpB,IAAI,EAAI,CAAE,SAAS,EAAE,SAAS,EAAE,YAAY,CAAW;IACvD,KAAK,EAAG,CAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAW;IAC5C,IAAI,EAAI,CAAE,SAAS,CAAW;CACrB,CAAC;AAIX,MAAM,OAAO,GAAG,EAAkC,CAAC,CAAC,kEAAkE;AAEtH,SAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAyD;IAC5G,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE;QACnD,IAAI,EAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAG;QAC1B,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,8CAA8C,CAAC,CAAC,CAAC,2CAA2C;QAC7H,IAAI,EAAG,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;KAChD,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEf,MAAM,KAAK,GAAK,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACpC,MAAM,MAAM,GAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;IACjE,MAAM,IAAI,GAAM,MAAM,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAC5C,OAAO,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AACjD,CAAC;AAED,SAAgB,UAAU,CAAC,EAAE,OAAO,EAAuB;IAC1D,MAAM,KAAK,GAAK,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACpC,MAAM,MAAM,GAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAM,MAAM,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAC5C,OAAO,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AACjD,CAAC;AAED,kBAAkB;AAClB,SAAS,MAAM,CAAyB,YAAe,EAAE,MAA+D;IACvH,IAAI,IAAI,GAAU,WAAW,CAAC,YAAY,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,MAA4E,CAAC;IAE/F,KAAK,MAAM,QAAQ,IAAI,iBAAS,CAAC,YAAY,CAAC,EAAE,CAAC;QAChD,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;QAElC,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,2BAA2B,QAAQ,+BAA+B,YAAY,GAAG,CAAC,CAAC;QACpG,CAAC;QAED,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,QAAQ,GAAG,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAED,SAAS,WAAW,CAAC,YAA0B;IAC9C,IAAI,CAAC,CAAC,YAAY,IAAI,OAAO,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,GAAc,IAAA,uBAAe,EAAC,YAAY,CAAC,CAAC;QACtD,MAAM,QAAQ,GAAU,YAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;QAChE,OAAO,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAC;IAClC,CAAC;IAED,OAAO,OAAO,CAAC,YAAY,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../../src/lib/scopes.ts"],"names":[],"mappings":"AAIA,wBAAgB,SAAS,IAAI,MAAM,EAAE,CAMpC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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.getScopes = getScopes;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const paths_1 = require("./utils/paths");
|
|
9
|
+
function getScopes() {
|
|
10
|
+
const scopesFile = (0, paths_1.getScopesFile)();
|
|
11
|
+
const scopes = fs_1.default.getJSON(scopesFile, () => {
|
|
12
|
+
throw new Error(getScopesError(scopesFile));
|
|
13
|
+
});
|
|
14
|
+
return scopes;
|
|
15
|
+
}
|
|
16
|
+
function getScopesError(scopesFile) {
|
|
17
|
+
return [
|
|
18
|
+
`File ${scopesFile} not found!`,
|
|
19
|
+
`This application had to have pre-defined file ${scopesFile} that will declare needed scopes`,
|
|
20
|
+
].join('\n');
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=scopes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scopes.js","sourceRoot":"","sources":["../../src/lib/scopes.ts"],"names":[],"mappings":";;;;;AAIA,8BAMC;AAVD,4CAAoB;AAEpB,yCAA8C;AAE9C,SAAgB,SAAS;IACxB,MAAM,UAAU,GAAG,IAAA,qBAAa,GAAE,CAAC;IACnC,MAAM,MAAM,GAAO,YAAE,CAAC,OAAO,CAAW,UAAU,EAAE,GAAG,EAAE;QACxD,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AACf,CAAC;AAED,SAAS,cAAc,CAAC,UAAkB;IACzC,OAAO;QACN,QAAQ,UAAU,aAAa;QAC/B,iDAAiD,UAAU,kCAAkC;KAC7F,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACd,CAAC"}
|
package/dist/lib/secrets.d.ts
CHANGED
|
@@ -1,30 +1,4 @@
|
|
|
1
|
-
import type GoogleApis from 'googleapis';
|
|
2
|
-
import type { Secrets } from '../types/secrets';
|
|
3
|
-
import type { AuthOptions } from '../types/options';
|
|
4
1
|
import '@anmiles/prototypes';
|
|
5
|
-
|
|
6
|
-
declare function getSecrets(profile: string): Secrets;
|
|
7
|
-
declare function getCredentials(profile: string, auth: GoogleApis.Common.OAuth2Client, options?: AuthOptions): Promise<GoogleApis.Auth.Credentials>;
|
|
8
|
-
declare function validateCredentials(credentials: GoogleApis.Auth.Credentials): Promise<{
|
|
9
|
-
isValid: boolean;
|
|
10
|
-
validationError?: string;
|
|
11
|
-
}>;
|
|
12
|
-
declare function createCredentials(profile: string, auth: GoogleApis.Auth.OAuth2Client, options?: AuthOptions, prompt?: GoogleApis.Auth.GenerateAuthUrlOpts['prompt']): Promise<GoogleApis.Auth.Credentials>;
|
|
13
|
-
declare function deleteCredentials(profile: string): void;
|
|
14
|
-
declare function checkSecrets(profile: string, secretsObject: Secrets, secretsFile: string): true;
|
|
15
|
-
declare function getScopesError(scopesFile: string): string;
|
|
16
|
-
declare function getSecretsError(profile: string, secretsFile: string): string;
|
|
17
|
-
export { getSecrets, getCredentials, deleteCredentials };
|
|
18
|
-
declare const _default: {
|
|
19
|
-
getScopes: typeof getScopes;
|
|
20
|
-
getSecrets: typeof getSecrets;
|
|
21
|
-
getCredentials: typeof getCredentials;
|
|
22
|
-
validateCredentials: typeof validateCredentials;
|
|
23
|
-
createCredentials: typeof createCredentials;
|
|
24
|
-
deleteCredentials: typeof deleteCredentials;
|
|
25
|
-
checkSecrets: typeof checkSecrets;
|
|
26
|
-
getSecretsError: typeof getSecretsError;
|
|
27
|
-
getScopesError: typeof getScopesError;
|
|
28
|
-
};
|
|
29
|
-
export default _default;
|
|
2
|
+
import type { Secrets } from '../types/secrets';
|
|
3
|
+
export declare function getSecrets(profile: string): Secrets;
|
|
30
4
|
//# sourceMappingURL=secrets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../src/lib/secrets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../src/lib/secrets.ts"],"names":[],"mappings":"AAEA,OAAO,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAgBhD,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAOnD"}
|
package/dist/lib/secrets.js
CHANGED
|
@@ -3,128 +3,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.getSecrets = getSecrets;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const http_1 = __importDefault(require("http"));
|
|
9
|
-
const out_url_1 = require("out-url");
|
|
10
|
-
const server_destroy_1 = __importDefault(require("server-destroy"));
|
|
11
|
-
const logger_1 = require("@anmiles/logger");
|
|
12
8
|
require("@anmiles/prototypes");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const secrets_1 = __importDefault(require("./secrets"));
|
|
9
|
+
const scopes_1 = require("./scopes");
|
|
10
|
+
const paths_1 = require("./utils/paths");
|
|
16
11
|
const port = 6006;
|
|
17
12
|
const host = `localhost:${port}`;
|
|
18
|
-
const startURI = `http://${host}/`;
|
|
19
13
|
const callbackURI = `http://${host}/oauthcallback`;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
throw new Error(secrets_1.default.getScopesError(scopesFile));
|
|
26
|
-
});
|
|
27
|
-
return scopes;
|
|
14
|
+
function checkSecrets(secretsObject) {
|
|
15
|
+
if (secretsObject.web.redirect_uris[0] === callbackURI) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
throw new Error(`Error in credentials file: redirect URI should be ${callbackURI}`);
|
|
28
19
|
}
|
|
29
20
|
function getSecrets(profile) {
|
|
30
21
|
const secretsFile = (0, paths_1.getSecretsFile)(profile);
|
|
31
22
|
const secretsObject = fs_1.default.getJSON(secretsFile, () => {
|
|
32
|
-
throw new Error(
|
|
23
|
+
throw new Error(getSecretsError(profile, secretsFile));
|
|
33
24
|
});
|
|
34
|
-
|
|
25
|
+
checkSecrets(secretsObject);
|
|
35
26
|
return secretsObject;
|
|
36
27
|
}
|
|
37
|
-
exports.getSecrets = getSecrets;
|
|
38
|
-
async function getCredentials(profile, auth, options) {
|
|
39
|
-
const credentialsFile = (0, paths_1.getCredentialsFile)(profile);
|
|
40
|
-
if (options?.temporary) {
|
|
41
|
-
return secrets_1.default.createCredentials(profile, auth, options);
|
|
42
|
-
}
|
|
43
|
-
return fs_1.default.getJSONAsync(credentialsFile, async () => {
|
|
44
|
-
const refreshToken = fs_1.default.existsSync(credentialsFile) ? fs_1.default.readJSON(credentialsFile).refresh_token : undefined;
|
|
45
|
-
const credentials = await secrets_1.default.createCredentials(profile, auth, options, refreshToken ? undefined : 'consent');
|
|
46
|
-
return { refresh_token: refreshToken, ...credentials };
|
|
47
|
-
}, secrets_1.default.validateCredentials);
|
|
48
|
-
}
|
|
49
|
-
exports.getCredentials = getCredentials;
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/require-await -- pass sync function into async context
|
|
51
|
-
async function validateCredentials(credentials) {
|
|
52
|
-
if (!credentials.access_token) {
|
|
53
|
-
return { isValid: false, validationError: 'Credentials does not have access_token' };
|
|
54
|
-
}
|
|
55
|
-
if (!credentials.refresh_token) {
|
|
56
|
-
return { isValid: false, validationError: 'Credentials does not have refresh_token' };
|
|
57
|
-
}
|
|
58
|
-
if (!credentials.expiry_date) {
|
|
59
|
-
return { isValid: false, validationError: 'Credentials does not have expiry_date' };
|
|
60
|
-
}
|
|
61
|
-
if (new Date().getTime() - credentials.expiry_date >= tokenExpiration) {
|
|
62
|
-
return { isValid: false, validationError: 'Credentials expired' };
|
|
63
|
-
}
|
|
64
|
-
return { isValid: true };
|
|
65
|
-
}
|
|
66
|
-
async function createCredentials(profile, auth, options, prompt) {
|
|
67
|
-
const scope = options?.scopes ?? secrets_1.default.getScopes();
|
|
68
|
-
return new Promise((resolve) => {
|
|
69
|
-
const authUrl = auth.generateAuthUrl({
|
|
70
|
-
access_type: 'offline',
|
|
71
|
-
prompt,
|
|
72
|
-
scope,
|
|
73
|
-
});
|
|
74
|
-
const server = http_1.default.createServer();
|
|
75
|
-
(0, server_destroy_1.default)(server);
|
|
76
|
-
server.on('request', (request, response) => {
|
|
77
|
-
if (!request.url) {
|
|
78
|
-
response.end('');
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
const url = new URL(`http://${request.headers.host}${request.url}`);
|
|
82
|
-
const code = url.searchParams.get('code');
|
|
83
|
-
if (!code) {
|
|
84
|
-
response.end((0, renderer_1.renderAuth)({ profile, authUrl, scope }));
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
response.end((0, renderer_1.renderDone)({ profile }));
|
|
88
|
-
server.destroy();
|
|
89
|
-
void (async () => {
|
|
90
|
-
const { tokens } = await auth.getToken(code);
|
|
91
|
-
resolve(tokens);
|
|
92
|
-
})();
|
|
93
|
-
});
|
|
94
|
-
server.on('error', (error) => {
|
|
95
|
-
if (error.code === 'EADDRINUSE') {
|
|
96
|
-
setTimeout(() => server.listen(port), serverRetryInterval);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
throw error;
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
server.once('listening', () => {
|
|
103
|
-
(0, logger_1.warn)('Please check your browser for further actions');
|
|
104
|
-
void (0, out_url_1.open)(startURI);
|
|
105
|
-
});
|
|
106
|
-
server.listen(port);
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
function deleteCredentials(profile) {
|
|
110
|
-
const credentialsFile = (0, paths_1.getCredentialsFile)(profile);
|
|
111
|
-
if (fs_1.default.existsSync(credentialsFile)) {
|
|
112
|
-
fs_1.default.rmSync(credentialsFile);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
exports.deleteCredentials = deleteCredentials;
|
|
116
|
-
function checkSecrets(profile, secretsObject, secretsFile) {
|
|
117
|
-
if (secretsObject.web.redirect_uris[0] === callbackURI) {
|
|
118
|
-
return true;
|
|
119
|
-
}
|
|
120
|
-
throw new Error(`Error in credentials file: redirect URI should be ${callbackURI}.\n${secrets_1.default.getSecretsError(profile, secretsFile)}`);
|
|
121
|
-
}
|
|
122
|
-
function getScopesError(scopesFile) {
|
|
123
|
-
return [
|
|
124
|
-
`File ${scopesFile} not found!`,
|
|
125
|
-
`This application had to have pre-defined file ${scopesFile} that will declare needed scopes`,
|
|
126
|
-
].join('\n');
|
|
127
|
-
}
|
|
128
28
|
function getSecretsError(profile, secretsFile) {
|
|
129
29
|
return [
|
|
130
30
|
`File ${secretsFile} not found!`,
|
|
@@ -145,7 +45,7 @@ function getSecretsError(profile, secretsFile) {
|
|
|
145
45
|
'\t\t\t\tSpecify your email as user support email and as developer contact information on the very bottom',
|
|
146
46
|
'\t\t\t\tClick "Save and continue"',
|
|
147
47
|
'\t\t\tClick "Add or remove scopes"',
|
|
148
|
-
`\t\t\t\tAdd scopes: ${
|
|
48
|
+
`\t\t\t\tAdd scopes: ${(0, scopes_1.getScopes)().join(',')}`,
|
|
149
49
|
'\t\t\t\tClick "Save and continue"',
|
|
150
50
|
'\t\t\tClick "Add users"',
|
|
151
51
|
'\t\t\t\tAdd your email',
|
|
@@ -161,5 +61,4 @@ function getSecretsError(profile, secretsFile) {
|
|
|
161
61
|
'Then start this script again',
|
|
162
62
|
].join('\n');
|
|
163
63
|
}
|
|
164
|
-
exports.default = { getScopes, getSecrets, getCredentials, validateCredentials, createCredentials, deleteCredentials, checkSecrets, getSecretsError, getScopesError };
|
|
165
64
|
//# sourceMappingURL=secrets.js.map
|
package/dist/lib/secrets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../../src/lib/secrets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../../src/lib/secrets.ts"],"names":[],"mappings":";;;;;AAoBA,gCAOC;AA3BD,4CAAoB;AAEpB,+BAA6B;AAI7B,qCAAqC;AACrC,yCAA+C;AAE/C,MAAM,IAAI,GAAU,IAAI,CAAC;AACzB,MAAM,IAAI,GAAU,aAAa,IAAI,EAAE,CAAC;AACxC,MAAM,WAAW,GAAG,UAAU,IAAI,gBAAgB,CAAC;AAEnD,SAAS,YAAY,CAAC,aAAsB;IAC3C,IAAI,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,WAAW,EAAE,CAAC;QACxD,OAAO,IAAI,CAAC;IACb,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,qDAAqD,WAAW,EAAE,CAAC,CAAC;AACrF,CAAC;AAED,SAAgB,UAAU,CAAC,OAAe;IACzC,MAAM,WAAW,GAAK,IAAA,sBAAc,EAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,aAAa,GAAG,YAAE,CAAC,OAAO,CAAU,WAAW,EAAE,GAAG,EAAE;QAC3D,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IACH,YAAY,CAAC,aAAa,CAAC,CAAC;IAC5B,OAAO,aAAa,CAAC;AACtB,CAAC;AAED,SAAS,eAAe,CAAC,OAAe,EAAE,WAAmB;IAC5D,OAAO;QACN,QAAQ,WAAW,aAAa;QAChC,2BAA2B;QAC3B,wDAAwD;QACxD,yBAAyB;QACzB,2DAA2D;QAC3D,yDAAyD;QACzD,+DAA+D;QAC/D,sCAAsC;QACtC,0BAA0B;QAC1B,yDAAyD;QACzD,iDAAiD;QACjD,qDAAqD;QACrD,2BAA2B;QAC3B,wBAAwB;QACxB,wCAAwC;QACxC,0GAA0G;QAC1G,mCAAmC;QACnC,oCAAoC;QACpC,uBAAuB,IAAA,kBAAS,GAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAC9C,mCAAmC;QACnC,yBAAyB;QACzB,wBAAwB;QACxB,mCAAmC;QACnC,oDAAoD;QACpD,6CAA6C;QAC7C,+DAA+D;QAC/D,mDAAmD;QACnD,yCAAyC;QACzC,wCAAwC,WAAW,EAAE;QACrD,wBAAwB;QACxB,uEAAuE,OAAO,OAAO;QACrF,8BAA8B;KAC9B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { templates } from '../renderer';
|
|
2
|
+
export declare function getProfilesFile(): string;
|
|
3
|
+
export declare function getScopesFile(): string;
|
|
4
|
+
export declare function getSecretsFile(profile: string): string;
|
|
5
|
+
export declare function getCredentialsFile(profile: string): string;
|
|
6
|
+
export declare function getTemplateFile(templateName: keyof typeof templates): string;
|
|
7
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/paths.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAS7C,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,OAAO,SAAS,GAAG,MAAM,CAE5E"}
|
|
@@ -3,33 +3,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.getProfilesFile = getProfilesFile;
|
|
7
|
+
exports.getScopesFile = getScopesFile;
|
|
8
|
+
exports.getSecretsFile = getSecretsFile;
|
|
9
|
+
exports.getCredentialsFile = getCredentialsFile;
|
|
10
|
+
exports.getTemplateFile = getTemplateFile;
|
|
7
11
|
const path_1 = __importDefault(require("path"));
|
|
8
12
|
const dirPaths = {
|
|
9
13
|
input: 'input',
|
|
10
14
|
secrets: 'secrets',
|
|
11
15
|
// TODO: Remove this hack after moving to React
|
|
12
|
-
templates: '
|
|
16
|
+
templates: path_1.default.relative(process.cwd(), path_1.default.join(__dirname, '../../templates')),
|
|
13
17
|
};
|
|
14
18
|
function getProfilesFile() {
|
|
15
19
|
return path_1.default.join(dirPaths.input, 'profiles.json');
|
|
16
20
|
}
|
|
17
|
-
exports.getProfilesFile = getProfilesFile;
|
|
18
21
|
function getScopesFile() {
|
|
19
22
|
return 'scopes.json';
|
|
20
23
|
}
|
|
21
|
-
exports.getScopesFile = getScopesFile;
|
|
22
24
|
function getSecretsFile(profile) {
|
|
23
25
|
return path_1.default.join(dirPaths.secrets, `${profile}.json`);
|
|
24
26
|
}
|
|
25
|
-
exports.getSecretsFile = getSecretsFile;
|
|
26
27
|
function getCredentialsFile(profile) {
|
|
27
28
|
return path_1.default.join(dirPaths.secrets, `${profile}.credentials.json`);
|
|
28
29
|
}
|
|
29
|
-
exports.getCredentialsFile = getCredentialsFile;
|
|
30
30
|
function getTemplateFile(templateName) {
|
|
31
31
|
return path_1.default.join(dirPaths.templates, `${templateName}.html`);
|
|
32
32
|
}
|
|
33
|
-
exports.getTemplateFile = getTemplateFile;
|
|
34
|
-
exports.default = { getProfilesFile, getScopesFile, getSecretsFile, getCredentialsFile, getTemplateFile };
|
|
35
33
|
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../src/lib/utils/paths.ts"],"names":[],"mappings":";;;;;AAWA,0CAEC;AAED,sCAEC;AAED,wCAEC;AAED,gDAEC;AAED,0CAEC;AA7BD,gDAAwB;AAIxB,MAAM,QAAQ,GAAG;IAChB,KAAK,EAAM,OAAO;IAClB,OAAO,EAAI,SAAS;IACpB,+CAA+C;IAC/C,SAAS,EAAE,cAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;CAChF,CAAC;AAEF,SAAgB,eAAe;IAC9B,OAAO,cAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;AACnD,CAAC;AAED,SAAgB,aAAa;IAC5B,OAAO,aAAa,CAAC;AACtB,CAAC;AAED,SAAgB,cAAc,CAAC,OAAe;IAC7C,OAAO,cAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,OAAO,OAAO,CAAC,CAAC;AACvD,CAAC;AAED,SAAgB,kBAAkB,CAAC,OAAe;IACjD,OAAO,cAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,OAAO,mBAAmB,CAAC,CAAC;AACnE,CAAC;AAED,SAAgB,eAAe,CAAC,YAAoC;IACnE,OAAO,cAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,GAAG,YAAY,OAAO,CAAC,CAAC;AAC9D,CAAC"}
|
package/dist/templates/auth.html
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<h1>Welcome ${profile}!</h1>
|
|
2
2
|
<p>Please authorize:</p>
|
|
3
3
|
<ul>
|
|
4
|
-
|
|
4
|
+
${scopesList}
|
|
5
5
|
</ul>
|
|
6
6
|
<a id="button" href="${authUrl}">Continue</a>
|
|
7
7
|
<script type="text/javascript">document.addEventListener('DOMContentLoaded', function(){ document.getElementById('button').focus(); });</script>
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
-
<title>Google API sign-in</title>
|
|
4
|
+
<title>Google API sign-in'</title>
|
|
5
5
|
<meta charset="utf-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
|
6
7
|
</head>
|
|
7
8
|
<body>
|
|
8
9
|
|
|
10
|
+
${style}
|
|
11
|
+
|
|
9
12
|
${page}
|
|
10
13
|
|
|
14
|
+
${script}
|
|
15
|
+
|
|
11
16
|
</body>
|
|
12
17
|
</html>
|
package/dist/templates/page.html
CHANGED
|
File without changes
|
package/dist/types/options.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
interface CommonOptions {
|
|
1
|
+
export interface CommonOptions {
|
|
2
2
|
hideProgress?: boolean;
|
|
3
3
|
}
|
|
4
|
-
interface AuthOptions {
|
|
4
|
+
export interface AuthOptions {
|
|
5
5
|
temporary?: boolean;
|
|
6
6
|
scopes?: string[];
|
|
7
7
|
}
|
|
8
|
-
export type { CommonOptions, AuthOptions };
|
|
9
8
|
//# sourceMappingURL=options.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/types/options.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/types/options.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB"}
|
package/dist/types/secrets.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface Secrets {
|
|
1
|
+
export interface Secrets {
|
|
2
2
|
web: {
|
|
3
3
|
client_id: `${string}.apps.googleusercontent.com`;
|
|
4
4
|
project_id: string;
|
|
@@ -9,5 +9,4 @@ interface Secrets {
|
|
|
9
9
|
redirect_uris: string[];
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
export type { Secrets };
|
|
13
12
|
//# sourceMappingURL=secrets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../src/types/secrets.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../src/types/secrets.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACvB,GAAG,EAAE;QACJ,SAAS,EAAE,GAAG,MAAM,6BAA6B,CAAC;QAClD,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,2CAA2C,CAAC;QACtD,SAAS,EAAE,qCAAqC,CAAC;QACjD,2BAA2B,EAAE,4CAA4C,CAAC;QAC1E,aAAa,EAAE,MAAM,CAAC;QACtB,aAAa,EAAE,MAAM,EAAE,CAAC;KACxB,CAAC;CACF"}
|