@google/clasp 2.5.0 → 3.0.1-alpha1

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.
Files changed (149) hide show
  1. package/README.md +251 -196
  2. package/build/src/auth/auth.js +176 -0
  3. package/build/src/auth/auth_code_flow.js +36 -0
  4. package/build/src/auth/credential_store.js +1 -0
  5. package/build/src/auth/file_credential_store.js +82 -0
  6. package/build/src/auth/localhost_auth_code_flow.js +63 -0
  7. package/build/src/auth/serverless_auth_code_flow.js +32 -0
  8. package/build/src/commands/clone-script.js +71 -0
  9. package/build/src/commands/create-deployment.js +33 -0
  10. package/build/src/commands/create-script.js +75 -0
  11. package/build/src/commands/create-version.js +31 -0
  12. package/build/src/commands/delete-deployment.js +71 -0
  13. package/build/src/commands/disable-api.js +19 -0
  14. package/build/src/commands/enable-api.js +31 -0
  15. package/build/src/commands/list-apis.js +23 -0
  16. package/build/src/commands/list-deployments.js +30 -0
  17. package/build/src/commands/list-scripts.js +28 -0
  18. package/build/src/commands/list-versions.js +29 -0
  19. package/build/src/commands/login.js +53 -54
  20. package/build/src/commands/logout.js +15 -15
  21. package/build/src/commands/open-apis.js +11 -0
  22. package/build/src/commands/open-container.js +15 -0
  23. package/build/src/commands/open-credentials.js +11 -0
  24. package/build/src/commands/open-logs.js +11 -0
  25. package/build/src/commands/open-script.js +18 -0
  26. package/build/src/commands/open-webapp.js +56 -0
  27. package/build/src/commands/program.js +108 -0
  28. package/build/src/commands/pull.js +19 -18
  29. package/build/src/commands/push.js +64 -74
  30. package/build/src/commands/run-function.js +61 -0
  31. package/build/src/commands/setup-logs.js +12 -0
  32. package/build/src/commands/show-authorized-user.js +18 -0
  33. package/build/src/commands/show-file-status.js +34 -0
  34. package/build/src/commands/tail-logs.js +92 -0
  35. package/build/src/commands/utils.js +82 -0
  36. package/build/src/constants.js +0 -3
  37. package/build/src/{apis.js → core/apis.js} +90 -92
  38. package/build/src/core/clasp.js +171 -0
  39. package/build/src/core/files.js +359 -0
  40. package/build/src/core/functions.js +51 -0
  41. package/build/src/core/logs.js +41 -0
  42. package/build/src/core/manifest.js +1 -0
  43. package/build/src/core/project.js +313 -0
  44. package/build/src/core/services.js +179 -0
  45. package/build/src/core/utils.js +121 -0
  46. package/build/src/index.js +16 -355
  47. package/build/src/intl.js +34 -0
  48. package/docs/README.md +0 -5
  49. package/docs/config-files.md +0 -1
  50. package/docs/run.md +2 -2
  51. package/package.json +86 -51
  52. package/CHANGELOG.md +0 -79
  53. package/build/src/apis.d.ts +0 -34
  54. package/build/src/apis.js.map +0 -1
  55. package/build/src/apiutils.d.ts +0 -16
  56. package/build/src/apiutils.js +0 -81
  57. package/build/src/apiutils.js.map +0 -1
  58. package/build/src/auth.d.ts +0 -37
  59. package/build/src/auth.js +0 -310
  60. package/build/src/auth.js.map +0 -1
  61. package/build/src/clasp-error.d.ts +0 -3
  62. package/build/src/clasp-error.js +0 -10
  63. package/build/src/clasp-error.js.map +0 -1
  64. package/build/src/commands/apis.d.ts +0 -10
  65. package/build/src/commands/apis.js +0 -90
  66. package/build/src/commands/apis.js.map +0 -1
  67. package/build/src/commands/clone.d.ts +0 -13
  68. package/build/src/commands/clone.js +0 -60
  69. package/build/src/commands/clone.js.map +0 -1
  70. package/build/src/commands/create.d.ts +0 -16
  71. package/build/src/commands/create.js +0 -81
  72. package/build/src/commands/create.js.map +0 -1
  73. package/build/src/commands/default.d.ts +0 -8
  74. package/build/src/commands/default.js +0 -10
  75. package/build/src/commands/default.js.map +0 -1
  76. package/build/src/commands/deploy.d.ts +0 -13
  77. package/build/src/commands/deploy.js +0 -51
  78. package/build/src/commands/deploy.js.map +0 -1
  79. package/build/src/commands/deployments.d.ts +0 -5
  80. package/build/src/commands/deployments.js +0 -29
  81. package/build/src/commands/deployments.js.map +0 -1
  82. package/build/src/commands/list.d.ts +0 -9
  83. package/build/src/commands/list.js +0 -34
  84. package/build/src/commands/list.js.map +0 -1
  85. package/build/src/commands/login.d.ts +0 -15
  86. package/build/src/commands/login.js.map +0 -1
  87. package/build/src/commands/logout.d.ts +0 -5
  88. package/build/src/commands/logout.js.map +0 -1
  89. package/build/src/commands/logs.d.ts +0 -17
  90. package/build/src/commands/logs.js +0 -181
  91. package/build/src/commands/logs.js.map +0 -1
  92. package/build/src/commands/open.d.ts +0 -15
  93. package/build/src/commands/open.js +0 -89
  94. package/build/src/commands/open.js.map +0 -1
  95. package/build/src/commands/pull.d.ts +0 -10
  96. package/build/src/commands/pull.js.map +0 -1
  97. package/build/src/commands/push.d.ts +0 -11
  98. package/build/src/commands/push.js.map +0 -1
  99. package/build/src/commands/run.d.ts +0 -14
  100. package/build/src/commands/run.js +0 -130
  101. package/build/src/commands/run.js.map +0 -1
  102. package/build/src/commands/setting.d.ts +0 -8
  103. package/build/src/commands/setting.js +0 -53
  104. package/build/src/commands/setting.js.map +0 -1
  105. package/build/src/commands/status.d.ts +0 -9
  106. package/build/src/commands/status.js +0 -25
  107. package/build/src/commands/status.js.map +0 -1
  108. package/build/src/commands/undeploy.d.ts +0 -9
  109. package/build/src/commands/undeploy.js +0 -55
  110. package/build/src/commands/undeploy.js.map +0 -1
  111. package/build/src/commands/version.d.ts +0 -5
  112. package/build/src/commands/version.js +0 -22
  113. package/build/src/commands/version.js.map +0 -1
  114. package/build/src/commands/versions.d.ts +0 -5
  115. package/build/src/commands/versions.js +0 -41
  116. package/build/src/commands/versions.js.map +0 -1
  117. package/build/src/conf.d.ts +0 -40
  118. package/build/src/conf.js +0 -100
  119. package/build/src/conf.js.map +0 -1
  120. package/build/src/constants.d.ts +0 -6
  121. package/build/src/constants.js.map +0 -1
  122. package/build/src/dotfile.d.ts +0 -50
  123. package/build/src/dotfile.js +0 -71
  124. package/build/src/dotfile.js.map +0 -1
  125. package/build/src/files.d.ts +0 -70
  126. package/build/src/files.js +0 -364
  127. package/build/src/files.js.map +0 -1
  128. package/build/src/index.d.ts +0 -18
  129. package/build/src/index.js.map +0 -1
  130. package/build/src/inquirer.d.ts +0 -82
  131. package/build/src/inquirer.js +0 -111
  132. package/build/src/inquirer.js.map +0 -1
  133. package/build/src/manifest.d.ts +0 -123
  134. package/build/src/manifest.js +0 -142
  135. package/build/src/manifest.js.map +0 -1
  136. package/build/src/messages.d.ts +0 -110
  137. package/build/src/messages.js +0 -161
  138. package/build/src/messages.js.map +0 -1
  139. package/build/src/urls.d.ts +0 -21
  140. package/build/src/urls.js +0 -33
  141. package/build/src/urls.js.map +0 -1
  142. package/build/src/utils.d.ts +0 -102
  143. package/build/src/utils.js +0 -232
  144. package/build/src/utils.js.map +0 -1
  145. package/docs/develop.md +0 -94
  146. package/docs/esmodules.md +0 -81
  147. package/docs/running-locally.md +0 -31
  148. package/docs/settings.md +0 -56
  149. package/docs/typescript.md +0 -354
package/CHANGELOG.md DELETED
@@ -1,79 +0,0 @@
1
- # Changelog
2
-
3
- ## [2.5.0](https://github.com/google/clasp/compare/v2.4.2...v2.5.0) (2025-01-09)
4
-
5
-
6
- ### Features
7
-
8
- * Add support for custom redirect port in clasp login ([#1020](https://github.com/google/clasp/issues/1020)) ([d55832e](https://github.com/google/clasp/commit/d55832e59d63c480ae591f7d1ecba457ebfafb7b))
9
-
10
-
11
- ### Bug Fixes
12
-
13
- * Don't write files on clone if unable to fetch project ([#824](https://github.com/google/clasp/issues/824)) ([b3b292a](https://github.com/google/clasp/commit/b3b292acfcc9bb191a3f4171601b8c420c187546))
14
- * Rethrow error so command exits with error status ([#1019](https://github.com/google/clasp/issues/1019)) ([29ac629](https://github.com/google/clasp/commit/29ac62988b970b1905fe2601828bf7dcaac47b54))
15
-
16
- ## [2.4.2](https://github.com/google/clasp/compare/v2.4.1...v2.4.2) (2022-09-26)
17
-
18
-
19
- ### Bug Fixes
20
-
21
- * remove online check ([#936](https://github.com/google/clasp/issues/936)) ([6775d9f](https://github.com/google/clasp/commit/6775d9f674886ac11ee2a23d59cbe62dd141d97b))
22
-
23
- ### [2.4.1](https://www.github.com/google/clasp/compare/v2.4.0...v2.4.1) (2021-08-09)
24
-
25
-
26
- ### Bug Fixes
27
-
28
- * Don't require package.json for simple commands ([#840](https://www.github.com/google/clasp/issues/840)) ([#862](https://www.github.com/google/clasp/issues/862)) ([ad5d045](https://www.github.com/google/clasp/commit/ad5d045c431f1341cf79bcf18f150f0e9d11db55))
29
- * Fix saving credentials when refreshed. ([#863](https://www.github.com/google/clasp/issues/863)) ([48e6fa3](https://www.github.com/google/clasp/commit/48e6fa3354de635a3ea1ce089d481847b2e939e9))
30
- * Honor --project CLI option ([#865](https://www.github.com/google/clasp/issues/865)) ([deacf03](https://github.com/google/clasp/commit/deacf03d6d2d28abd9f3a408a77b69e99b9a59bf))
31
- * Shut down embedded server on login faster ([40e0b3d](https://github.com/google/clasp/commit/40e0b3d67c3d381d0f24d738781ed61a2622c477))
32
-
33
-
34
- ## [2.4.0](https://www.github.com/google/clasp/compare/v2.3.1...v2.4.0) (2021-06-11)
35
-
36
-
37
- ### Features
38
-
39
- * env & option based config files ([1b68374](https://www.github.com/google/clasp/commit/1b6837480b2e22cb8728cb80b2d8cfa36381d982))
40
-
41
-
42
- ### Bug Fixes
43
-
44
- * unnecessary code caused `help` command to crash ([3741f71](https://www.github.com/google/clasp/commit/3741f71d744a2db8c5f1304c3426b253f8e742bd))
45
-
46
-
47
- ### Miscellaneous Chores
48
-
49
- * switch from cjs to esm ([5055865](https://www.github.com/google/clasp/commit/5055865a28e48a654ffbb3b28212e53f484f76a4))
50
-
51
-
52
- ### [2.3.2](https://www.github.com/google/clasp/compare/v2.3.0...v2.3.2) (2021-05-17)
53
-
54
-
55
- ### Miscellaneous Chores
56
-
57
- * Republish 2.3.0 as 2.3.2 due to unintended breaking changes in 2.3.1
58
-
59
-
60
- ### [2.3.1](https://www.github.com/google/clasp/compare/v2.3.0...v2.3.1) (2021-05-11)
61
-
62
-
63
- ### Features
64
-
65
- * env & option based config files ([1b68374](https://www.github.com/google/clasp/commit/1b6837480b2e22cb8728cb80b2d8cfa36381d982))
66
-
67
-
68
- ### Bug Fixes
69
-
70
- * Add missing find-up dependency ([#833](https://www.github.com/google/clasp/issues/833)) ([0c9c773](https://www.github.com/google/clasp/commit/0c9c773ff800be23aba2b32a049fec186c2e8507))
71
- * commander 6 option clash ([f2b7092](https://www.github.com/google/clasp/commit/f2b709260d4581ad5f5ac78121481824ab54f076))
72
- * commander 6 option clash ([#816](https://www.github.com/google/clasp/issues/816)) ([517a9d8](https://www.github.com/google/clasp/commit/517a9d8ff71c89f0665ae57903111529eb8d6dd7))
73
- * Make tests green again -- update commander version + minor adjustments. Also fix cleanup of tests to correctly restore credentials ([d526a9f](https://www.github.com/google/clasp/commit/d526a9fa9cc4975e27c3c153cad870ca3351b89b))
74
-
75
-
76
- ### Miscellaneous Chores
77
-
78
- * Enable release-please workflow ([60b1e25](https://www.github.com/google/clasp/commit/60b1e25a343204ce6fbff9ce5a056b479d17bbe1))
79
- * Release 2.3.1 ([4322184](https://www.github.com/google/clasp/commit/432218430e9d1506f7a09d65893b83c951c529be))
@@ -1,34 +0,0 @@
1
- /**
2
- * Google API Types
3
- */
4
- /**
5
- * Different types of starter script templates.
6
- * Technically, a script can be multiple types (e.g. Slides add-on/API),
7
- * but it's pretty rare that anyone wants that.
8
- */
9
- export declare enum SCRIPT_TYPES {
10
- STANDALONE = "standalone",
11
- DOCS = "docs",
12
- SHEETS = "sheets",
13
- SLIDES = "slides",
14
- FORMS = "forms",
15
- WEBAPP = "webapp",
16
- API = "api"
17
- }
18
- export interface AdvancedService {
19
- readonly userSymbol: string;
20
- readonly serviceId: string;
21
- readonly version: string;
22
- }
23
- /**
24
- * This is a list of all public Advanced Services.
25
- *
26
- * It was generated by:
27
- * 1. script.google.com/create
28
- * 1. Resources > Advanced Google Services
29
- * 1. Enable all services
30
- * 1. View > Show manifest file
31
- * 1. View appsscript.json
32
- */
33
- export declare const PUBLIC_ADVANCED_SERVICES: AdvancedService[];
34
- export declare const SCRIPT_ID_LENGTH = 57;
@@ -1 +0,0 @@
1
- {"version":3,"file":"apis.js","sour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E,cAAc;QACzB,OAAO,EAAE,IAAI;KACd;IACD;QACE,UAAU,EAAE,kBAAkB;QAC9B,SAAS,EAAE,gBAAgB;QAC3B,OAAO,EAAE,IAAI;KACd;IACD;QACE,UAAU,EAAE,qBAAqB;QACjC,SAAS,EAAE,gBAAgB;QAC3B,OAAO,EAAE,IAAI;KACd;IACD;QACE,UAAU,EAAE,WAAW;QACvB,SAAS,EAAE,WAAW;QACtB,OAAO,EAAE,IAAI;KACd;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC"}
@@ -1,16 +0,0 @@
1
- import { script_v1 as scriptV1 } from 'googleapis';
2
- import type { ReadonlyDeep } from 'type-fest';
3
- /**
4
- * Prompts for the function name.
5
- */
6
- export declare const getFunctionNames: (script: ReadonlyDeep<scriptV1.Script>, scriptId: string) => Promise<string>;
7
- /**
8
- * Enables or disables a Google API.
9
- * @param {string} serviceName The name of the service. i.e. sheets
10
- * @param {boolean} enable Enables the API if true, otherwise disables.
11
- */
12
- export declare const enableOrDisableAPI: (serviceName: string, enable: boolean) => Promise<void>;
13
- /**
14
- * Enable 'script.googleapis.com' of Google API.
15
- */
16
- export declare const enableAppsScriptAPI: () => Promise<void>;
@@ -1,81 +0,0 @@
1
- import fuzzy from 'fuzzy';
2
- import { loadAPICredentials, serviceUsage } from './auth.js';
3
- import { ClaspError } from './clasp-error.js';
4
- import { functionNamePrompt } from './inquirer.js';
5
- import { enableOrDisableAdvanceServiceInManifest } from './manifest.js';
6
- import { ERROR } from './messages.js';
7
- import { getProjectId, spinner, stopSpinner } from './utils.js';
8
- /**
9
- * Prompts for the function name.
10
- */
11
- export const getFunctionNames = async (script, scriptId) => {
12
- spinner.start('Getting functions');
13
- const content = await script.projects.getContent({ scriptId });
14
- stopSpinner();
15
- if (content.status !== 200) {
16
- throw new ClaspError(content.statusText);
17
- }
18
- const { files = [] } = content.data;
19
- const functionNames = files
20
- .filter(file => { var _a; return (_a = file.functionSet) === null || _a === void 0 ? void 0 : _a.values; })
21
- .flatMap(file => file.functionSet.values)
22
- .map(func => func.name);
23
- // Returns a Promise
24
- // https://www.npmjs.com/package/inquirer-autocomplete-prompt-ipt#options
25
- // Example: https://github.com/ruyadorno/inquirer-autocomplete-prompt/blob/master/example.js#L76
26
- const source = async (_answers, input = '') => fuzzy.filter(input, functionNames).map(element => element.original);
27
- return (await functionNamePrompt(source)).functionName;
28
- };
29
- /**
30
- * Gets the project ID from the manifest. If there is no project ID, it returns an error.
31
- */
32
- const getProjectIdOrDie = async () => {
33
- const projectId = await getProjectId(); // Will prompt user to set up if required
34
- if (projectId) {
35
- return projectId;
36
- }
37
- throw new ClaspError(ERROR.NO_GCLOUD_PROJECT());
38
- };
39
- // /**
40
- // * Returns true if the service is enabled for the Google Cloud Project.
41
- // * @param {string} serviceName The service name.
42
- // * @returns {boolean} True if the service is enabled.
43
- // */
44
- // export async function isEnabled(serviceName: string): Promise<boolean> {
45
- // const serviceDetails = await serviceUsage.services.get({name: serviceName});
46
- // return serviceDetails.data.state === 'ENABLED';
47
- // }
48
- /**
49
- * Enables or disables a Google API.
50
- * @param {string} serviceName The name of the service. i.e. sheets
51
- * @param {boolean} enable Enables the API if true, otherwise disables.
52
- */
53
- export const enableOrDisableAPI = async (serviceName, enable) => {
54
- if (!serviceName) {
55
- throw new ClaspError('An API name is required. Try sheets');
56
- }
57
- const name = `projects/${await getProjectIdOrDie()}/services/${serviceName}.googleapis.com`;
58
- try {
59
- await (enable ? serviceUsage.services.enable({ name }) : serviceUsage.services.disable({ name }));
60
- await enableOrDisableAdvanceServiceInManifest(serviceName, enable);
61
- console.log(`${enable ? 'Enable' : 'Disable'}d ${serviceName} API.`);
62
- }
63
- catch (error) {
64
- if (error instanceof ClaspError) {
65
- throw error;
66
- }
67
- // If given non-existent API (like fakeAPI, it throws 403 permission denied)
68
- // We will log this for the user instead:
69
- console.log(error);
70
- throw new ClaspError(ERROR.NO_API(enable, serviceName));
71
- }
72
- };
73
- /**
74
- * Enable 'script.googleapis.com' of Google API.
75
- */
76
- export const enableAppsScriptAPI = async () => {
77
- await loadAPICredentials(true);
78
- const name = `projects/${await getProjectIdOrDie()}/services/script.googleapis.com`;
79
- await serviceUsage.services.enable({ name });
80
- };
81
- //# sourceMappingURL=apiutils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiutils.js","sourceRoot":"","sources":["../../src/apiutils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAC,kBAAkB,EAAE,YAAY,EAAC,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAC,kBAAkB,EAAqB,MAAM,eAAe,CAAC;AACrE,OAAO,EAAC,uCAAuC,EAAC,MAAM,eAAe,CAAC;AACtE,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AACpC,OAAO,EAAC,YAAY,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,YAAY,CAAC;AAE9D;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,MAAqC,EAAE,QAAgB,EAAmB,EAAE;IACjH,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAC,QAAQ,EAAC,CAAC,CAAC;IAC7D,WAAW,EAAE,CAAC;IACd,IAAI,OAAO,CAAC,MAAM,KAAK,GAAG,EAAE;QAC1B,MAAM,IAAI,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;KAC1C;IAED,MAAM,EAAC,KAAK,GAAG,EAAE,EAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAClC,MAAM,aAAa,GAAG,KAAK;SACxB,MAAM,CAAC,IAAI,CAAC,EAAE,WAAC,OAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,MAAM,CAAA,EAAA,CAAC;S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,EAAC,IAAI,EAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAC,IAAI,EAAC,CAAC,CAAC,CAAC;QAC9F,MAAM,uCAAuC,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QACnE,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,KAAK,WAAW,OAAO,CAAC,CAAC;KACtE;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,KAAK,YAAY,UAAU,EAAE;YAC/B,MAAM,KAAK,CAAC;SACb;QAED,4EAA4E;QAC5E,yCAAyC;QACzC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAEnB,MAAM,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;KACzD;AACH,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,IAAmB,EAAE;IAC3D,MAAM,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,YAAY,MAAM,iBAAiB,EAAE,iCAAiC,CAAC;IACpF,MAAM,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAC,IAAI,EAAC,CAAC,CAAC;AAC7C,CAAC,CAAC"}
@@ -1,37 +0,0 @@
1
- import { script_v1 as scriptV1 } from 'googleapis';
2
- import type { ClaspToken } from './dotfile';
3
- import type { ClaspCredentials } from './utils';
4
- export declare const discovery: import("googleapis").discovery_v1.Discovery;
5
- export declare const drive: import("googleapis").drive_v3.Drive;
6
- export declare const logger: import("googleapis").logging_v2.Logging;
7
- export declare const script: scriptV1.Script;
8
- export declare const serviceUsage: import("googleapis").serviceusage_v1.Serviceusage;
9
- /**
10
- * Gets the local OAuth client for the Google Apps Script API.
11
- * Only the Apps Script API needs to use local credential for the Execution API (script.run).
12
- * @see https://developers.google.com/apps-script/api/how-tos/execute
13
- */
14
- export declare const getLocalScript: () => Promise<scriptV1.Script>;
15
- export declare const scopeWebAppDeploy = "https://www.googleapis.com/auth/script.webapp.deploy";
16
- export declare const defaultScopes: string[];
17
- /**
18
- * Requests authorization to manage Apps Script projects.
19
- * @param {boolean} useLocalhost Uses a local HTTP server if true. Manual entry o.w.
20
- * @param {ClaspCredentials?} creds An optional credentials object.
21
- * @param {string[]} [scopes=[]] List of OAuth scopes to authorize.
22
- * @param {number?} redirectPort Optional custom port for the local HTTP server during the authorization process.
23
- * If not specified, a random available port will be used.
24
- */
25
- export declare const authorize: (options: {
26
- readonly creds?: Readonly<ClaspCredentials>;
27
- readonly scopes: readonly string[];
28
- readonly useLocalhost: boolean;
29
- readonly redirectPort?: number;
30
- }) => Promise<void>;
31
- export declare const getLoggedInEmail: () => Promise<string | null | undefined>;
32
- /**
33
- * Loads the Apps Script API credentials for the CLI.
34
- *
35
- * Required before every API call.
36
- */
37
- export declare const loadAPICredentials: (local?: boolean) => Promise<ClaspToken>;
package/build/src/auth.js DELETED
@@ -1,310 +0,0 @@
1
- import { OAuth2Client } from 'google-auth-library';
2
- import { google } from 'googleapis';
3
- import { createServer } from 'http';
4
- import open from 'open';
5
- import readline from 'readline';
6
- import enableDestroy from 'server-destroy';
7
- import { ClaspError } from './clasp-error.js';
8
- import { DOTFILE } from './dotfile.js';
9
- import { ERROR, LOG } from './messages.js';
10
- import { getOAuthSettings } from './utils.js';
11
- /**
12
- * Authentication with Google's APIs.
13
- */
14
- // Auth is complicated. Consider yourself warned.
15
- // GLOBAL: clasp login will store this (~/.clasprc.json):
16
- // {
17
- // "access_token": "XXX",
18
- // "refresh_token": "1/k4rt_hgxbeGdaRag2TSVgnXgUrWcXwerPpvlzGG1peHVfzI58EZH0P25c7ykiRYd",
19
- // "scope": "https://www.googleapis.com/auth/script.projects https://www.googleapis.com/auth/script ...",
20
- // "token_type": "Bearer",
21
- // "expiry_date": 1539130731398
22
- // }
23
- // LOCAL: clasp login will store this (./.clasprc.json):
24
- // {
25
- // "token": {
26
- // "access_token": "XXX",
27
- // "refresh_token": "1/k4rw_hgxbeGdaRag2TSVgnXgUrWcXwerPpvlzGG1peHVfzI58EZH0P25c7ykiRYd",
28
- // "scope": "https://www.googleapis.com/auth/script.projects https://www.googleapis.com/auth/script ...",
29
- // "token_type": "Bearer",
30
- // "expiry_date": 1539130731398
31
- // },
32
- // // Settings
33
- // "oauth2ClientSettings": {
34
- // "clientId": "807925367021-infvb16rd7lasqi22q2npeahkeodfrq5.apps.googleusercontent.com",
35
- // "clientSecret": "9dbdeOCRHUyriewCoDrLHtPg",
36
- // "redirectUri": "http://localhost"
37
- // },
38
- // "isLocalCreds": true
39
- // }
40
- // API settings
41
- // @see https://developers.google.com/oauthplayground/
42
- const REDIRECT_URI_OOB = 'urn:ietf:wg:oauth:2.0:oob';
43
- const globalOauth2ClientSettings = {
44
- clientId: '1072944905499-vm2v2i5dvn0a0d2o4ca36i1vge8cvbn0.apps.googleusercontent.com',
45
- clientSecret: 'v6V3fKV_zWU7iw1DrpO1rknX',
46
- redirectUri: 'http://localhost',
47
- };
48
- const globalOAuth2Client = new OAuth2Client(globalOauth2ClientSettings);
49
- let localOAuth2Client; // Must be set up after authorize.
50
- // *Global* Google API clients
51
- export const discovery = google.discovery({ version: 'v1' });
52
- export const drive = google.drive({ version: 'v3', auth: globalOAuth2Client });
53
- export const logger = google.logging({ version: 'v2', auth: globalOAuth2Client });
54
- export const script = google.script({ version: 'v1', auth: globalOAuth2Client });
55
- export const serviceUsage = google.serviceusage({ version: 'v1', auth: globalOAuth2Client });
56
- /**
57
- * Gets the local OAuth client for the Google Apps Script API.
58
- * Only the Apps Script API needs to use local credential for the Execution API (script.run).
59
- * @see https://developers.google.com/apps-script/api/how-tos/execute
60
- */
61
- export const getLocalScript = async () => google.script({ version: 'v1', auth: localOAuth2Client });
62
- export const scopeWebAppDeploy = 'https://www.googleapis.com/auth/script.webapp.deploy'; // Scope needed for script.run
63
- export const defaultScopes = [
64
- // Default to clasp scopes
65
- 'https://www.googleapis.com/auth/script.deployments',
66
- 'https://www.googleapis.com/auth/script.projects',
67
- scopeWebAppDeploy,
68
- 'https://www.googleapis.com/auth/drive.metadata.readonly',
69
- 'https://www.googleapis.com/auth/drive.file',
70
- 'https://www.googleapis.com/auth/service.management',
71
- 'https://www.googleapis.com/auth/logging.read',
72
- 'https://www.googleapis.com/auth/userinfo.email',
73
- 'https://www.googleapis.com/auth/userinfo.profile',
74
- // Extra scope since service.management doesn't work alone
75
- 'https://www.googleapis.com/auth/cloud-platform',
76
- ];
77
- /**
78
- * Requests authorization to manage Apps Script projects.
79
- * @param {boolean} useLocalhost Uses a local HTTP server if true. Manual entry o.w.
80
- * @param {ClaspCredentials?} creds An optional credentials object.
81
- * @param {string[]} [scopes=[]] List of OAuth scopes to authorize.
82
- * @param {number?} redirectPort Optional custom port for the local HTTP server during the authorization process.
83
- * If not specified, a random available port will be used.
84
- */
85
- export const authorize = async (options) => {
86
- try {
87
- // Set OAuth2 Client Options
88
- let oAuth2ClientOptions;
89
- if (options.creds) {
90
- // If we passed our own creds
91
- // Use local credentials
92
- const { client_id: clientId, client_secret: clientSecret, project_id, redirect_uris: redirectUris, } = options.creds.installed;
93
- console.log(LOG.CREDS_FROM_PROJECT(project_id));
94
- oAuth2ClientOptions = { clientId, clientSecret, redirectUri: redirectUris[0] };
95
- }
96
- else {
97
- // Use global credentials
98
- const globalOauth2ClientOptions = {
99
- clientId: '1072944905499-vm2v2i5dvn0a0d2o4ca36i1vge8cvbn0.apps.googleusercontent.com',
100
- clientSecret: 'v6V3fKV_zWU7iw1DrpO1rknX',
101
- redirectUri: 'http://localhost',
102
- };
103
- oAuth2ClientOptions = globalOauth2ClientOptions;
104
- }
105
- // Set scopes
106
- let scope = (options.creds
107
- ? // Set scopes to custom scopes
108
- options.scopes
109
- : defaultScopes);
110
- if (options.creds && scope.length === 0) {
111
- scope = defaultScopes;
112
- // TODO formal error
113
- // throw new ClaspError('You need to specify scopes in the manifest.' +
114
- // 'View appsscript.json. Add a list of scopes in "oauthScopes"' +
115
- // 'Tip:' +
116
- // '1. clasp open' +
117
- // '2. File > Project Properties > Scopes');
118
- }
119
- const oAuth2ClientAuthUrlOptions = { access_type: 'offline', scope };
120
- // Grab a token from the credentials.
121
- const token = await (options.useLocalhost
122
- ? authorizeWithLocalhost(oAuth2ClientOptions, oAuth2ClientAuthUrlOptions, options.redirectPort)
123
- : authorizeWithoutLocalhost(oAuth2ClientOptions, oAuth2ClientAuthUrlOptions));
124
- console.log(`${LOG.AUTH_SUCCESSFUL}\n`);
125
- // Save the token and own creds together.
126
- let claspToken;
127
- if (options.creds) {
128
- const { client_id: clientId, client_secret: clientSecret, redirect_uris: redirectUri } = options.creds.installed;
129
- // Save local ClaspCredentials.
130
- claspToken = {
131
- token,
132
- oauth2ClientSettings: { clientId, clientSecret, redirectUri: redirectUri[0] },
133
- isLocalCreds: true,
134
- };
135
- }
136
- else {
137
- // Save global ClaspCredentials.
138
- claspToken = {
139
- token,
140
- oauth2ClientSettings: globalOauth2ClientSettings,
141
- isLocalCreds: false,
142
- };
143
- }
144
- await DOTFILE.AUTH(claspToken.isLocalCreds).write(claspToken);
145
- console.log(LOG.SAVED_CREDS(Boolean(options.creds)));
146
- }
147
- catch (error) {
148
- if (error instanceof ClaspError) {
149
- throw error;
150
- }
151
- throw new ClaspError(`${ERROR.ACCESS_TOKEN}${error}`);
152
- }
153
- };
154
- export const getLoggedInEmail = async () => {
155
- await loadAPICredentials();
156
- try {
157
- return (await google.oauth2('v2').userinfo.get({ auth: globalOAuth2Client })).data.email;
158
- }
159
- catch {
160
- return;
161
- }
162
- };
163
- /**
164
- * Loads the Apps Script API credentials for the CLI.
165
- *
166
- * Required before every API call.
167
- */
168
- export const loadAPICredentials = async (local = false) => {
169
- // Gets the OAuth settings. May be local or global.
170
- const rc = await getOAuthSettings(local);
171
- await setOauthClientCredentials(rc);
172
- return rc;
173
- };
174
- /**
175
- * Requests authorization to manage Apps Script projects. Spins up
176
- * a temporary HTTP server to handle the auth redirect.
177
- * @param {OAuth2ClientOptions} oAuth2ClientOptions The required client options for auth
178
- * @param {GenerateAuthUrlOpts} oAuth2ClientAuthUrlOptions Auth URL options
179
- * @param {number?} redirectPort Optional custom port for the local HTTP server to handle the auth redirect.
180
- * If not specified, a random available port will be used.
181
- * Used for local/global testing.
182
- */
183
- const authorizeWithLocalhost = async (oAuth2ClientOptions, oAuth2ClientAuthUrlOptions, redirectPort) => {
184
- // Wait until the server is listening, otherwise we don't have
185
- // the server port needed to set up the Oauth2Client.
186
- const server = await new Promise((resolve, reject) => {
187
- const s = createServer();
188
- enableDestroy(s);
189
- const port = redirectPort || 0;
190
- s.listen(port, () => resolve(s)).on('error', (err) => {
191
- if (err.code === 'EADDRINUSE') {
192
- console.error(`Error: Port ${port} is already in use. Please specify a different port with --redirect-port.`);
193
- }
194
- else {
195
- console.error(`Error: Unable to start the server on port ${port}.`, err.message);
196
- }
197
- reject(err);
198
- });
199
- });
200
- const { port } = server.address();
201
- const client = new OAuth2Client({ ...oAuth2ClientOptions, redirectUri: `http://localhost:${port}` });
202
- // TODO Add spinner
203
- const authCode = await new Promise((resolve, reject) => {
204
- server.on('request', (request, response) => {
205
- var _a;
206
- const urlParts = new URL((_a = request.url) !== null && _a !== void 0 ? _a : '', 'http://localhost').searchParams;
207
- const code = urlParts.get('code');
208
- const error = urlParts.get('error');
209
- if (code) {
210
- resolve(code);
211
- }
212
- else {
213
- reject(error);
214
- }
215
- response.end(LOG.AUTH_PAGE_SUCCESSFUL);
216
- });
217
- const authUrl = client.generateAuthUrl(oAuth2ClientAuthUrlOptions);
218
- console.log(LOG.AUTHORIZE(authUrl));
219
- (async () => open(authUrl))();
220
- });
221
- server.destroy();
222
- return (await client.getToken(authCode)).tokens;
223
- };
224
- /**
225
- * Requests authorization to manage Apps Script projects. Requires the user to
226
- * manually copy/paste the authorization code. No HTTP server is used.
227
- * @param {OAuth2ClientOptions} oAuth2ClientOptions The required client options for auth.
228
- * @param {GenerateAuthUrlOpts} oAuth2ClientAuthUrlOptions Auth URL options
229
- */
230
- const authorizeWithoutLocalhost = async (oAuth2ClientOptions, oAuth2ClientAuthUrlOptions) => {
231
- const client = new OAuth2Client({ ...oAuth2ClientOptions, redirectUri: REDIRECT_URI_OOB });
232
- console.log(LOG.AUTHORIZE(client.generateAuthUrl(oAuth2ClientAuthUrlOptions)));
233
- // TODO Add spinner
234
- const authCode = await new Promise((resolve, reject) => {
235
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
236
- rl.question(LOG.AUTH_CODE, (code) => {
237
- rl.close();
238
- if (code && code.length > 0) {
239
- resolve(code);
240
- }
241
- else {
242
- reject(new ClaspError('No authorization code entered.'));
243
- }
244
- });
245
- });
246
- return (await client.getToken(authCode)).tokens;
247
- };
248
- /**
249
- * Set OAuth client credentials from rc.
250
- * Can be global or local.
251
- * Saves new credentials if access token refreshed.
252
- * @param {ClaspToken} rc OAuth client settings from rc file.
253
- */
254
- // Because of mutation:
255
- const setOauthClientCredentials = async (rc) => {
256
- /**
257
- * Refreshes the credentials and saves them.
258
- */
259
- const refreshCredentials = async (oAuthClient) => {
260
- await oAuthClient.getAccessToken(); // Refreshes expiry date if required
261
- rc.token = oAuthClient.credentials;
262
- };
263
- // Set credentials and refresh them.
264
- try {
265
- if (rc.isLocalCreds) {
266
- const { clientId, clientSecret, redirectUri } = rc.oauth2ClientSettings;
267
- localOAuth2Client = new OAuth2Client({ clientId, clientSecret, redirectUri });
268
- localOAuth2Client.setCredentials(rc.token);
269
- await refreshCredentials(localOAuth2Client);
270
- }
271
- else {
272
- globalOAuth2Client.setCredentials(rc.token);
273
- await refreshCredentials(globalOAuth2Client);
274
- }
275
- // Save the credentials.
276
- await DOTFILE.AUTH(rc.isLocalCreds).write(rc);
277
- }
278
- catch (error) {
279
- if (error instanceof ClaspError) {
280
- throw error;
281
- }
282
- throw new ClaspError(`${ERROR.ACCESS_TOKEN}${error}`);
283
- }
284
- };
285
- // /**
286
- // * Compare global OAuth client scopes against manifest and prompt user to
287
- // * authorize if new scopes found (local OAuth credentials only).
288
- // * @param {ClaspToken} rc OAuth client settings from rc file.
289
- // */
290
- // // TODO: currently unused. Check relevancy
291
- // export async function checkOauthScopes(rc: ReadonlyDeep<ClaspToken>) {
292
- // try {
293
- // await checkIfOnline();
294
- // await setOauthClientCredentials(rc);
295
- // const {scopes} = await globalOAuth2Client.getTokenInfo(globalOAuth2Client.credentials.access_token as string);
296
- // const {oauthScopes} = await readManifest();
297
- // const newScopes = oauthScopes && oauthScopes.length > 1 ? oauthScopes.filter(x => !scopes.includes(x)) : [];
298
- // if (newScopes.length === 0) return;
299
- // console.log('New authorization scopes detected in manifest:\n', newScopes);
300
- // const answers = await oauthScopesPrompt();
301
- // if (answers.doAuth) {
302
- // if (!rc.isLocalCreds) throw new ClaspError(ERROR.NO_LOCAL_CREDENTIALS);
303
- // await authorize({useLocalhost: answers.localhost, scopes: newScopes});
304
- // }
305
- // } catch (error) {
306
- // if (error instanceof ClaspError) throw error;
307
- // throw new ClaspError(ERROR.BAD_REQUEST((error as {message: string}).message));
308
- // }
309
- // }
310
- //# sourceMappingURL=auth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAC,MAAM,EAAwB,MAAM,YAAY,CAAC;AACzD,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAClC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,aAAa,MAAM,gBAAgB,CAAC;AAM3C,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,KAAK,EAAE,GAAG,EAAC,MAAM,eA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AAK,CAAC,EAAE,CAAC,CAAC;KAC/C;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,KAAK,YAAY,UAAU,EAAE;YAC/B,MAAM,KAAK,CAAC;SACb;QAED,MAAM,IAAI,UAAU,CAAC,GAAG,KAAK,CAAC,YAAY,GAAG,KAAK,EAAE,CAAC,CAAC;KACvD;AACH,CAAC,CAAC;AAEF,MAAM;AACN,4EAA4E;AAC5E,mEAAmE;AACnE,gEAAgE;AAChE,MAAM;AACN,6CAA6C;AAC7C,yEAAyE;AACzE,UAAU;AACV,6BAA6B;AAC7B,2CAA2C;AAC3C,qHAAqH;AACrH,kDAAkD;AAClD,mHAAmH;AACnH,0CAA0C;AAC1C,kFAAkF;AAClF,iDAAiD;AAEjD,4BAA4B;AAC5B,gFAAgF;AAChF,+EAA+E;AAC/E,QAAQ;AACR,sBAAsB;AACtB,oDAAoD;AACpD,qFAAqF;AACrF,MAAM;AACN,IAAI"}
@@ -1,3 +0,0 @@
1
- export declare class ClaspError extends Error {
2
- constructor(message: string, exitCode?: number);
3
- }
@@ -1,10 +0,0 @@
1
- export class ClaspError extends Error {
2
- constructor(message, exitCode = 1) {
3
- super(message);
4
- // @see: typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html
5
- Object.setPrototypeOf(this, new.target.prototype); // Restore prototype chain
6
- this.name = ClaspError.name; // Stack traces display correctly now
7
- process.exitCode = exitCode;
8
- }
9
- }
10
- //# sourceMappingURL=clasp-error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clasp-error.js","sourceRoot":"","sources":["../../src/clasp-error.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC,YAAY,OAAe,EAAE,QAAQ,GAAG,CAAC;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,2EAA2E;QAC3E,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,0BAA0B;QAC7E,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,qCAAqC;QAClE,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC9B,CAAC;CACF"}
@@ -1,10 +0,0 @@
1
- interface CommandOption {
2
- readonly open?: string;
3
- }
4
- declare const _default: (options: CommandOption) => Promise<void>;
5
- /**
6
- * Acts as a router to apis subcommands
7
- * Calls functions for list, enable, or disable
8
- * Otherwise returns an error of command not supported
9
- */
10
- export default _default;