@google/clasp 2.4.2 → 3.0.0-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.
- package/README.md +253 -196
- package/build/src/auth/auth.js +176 -0
- package/build/src/auth/auth_code_flow.js +36 -0
- package/build/src/auth/credential_store.js +1 -0
- package/build/src/auth/file_credential_store.js +82 -0
- package/build/src/auth/localhost_auth_code_flow.js +62 -0
- package/build/src/auth/serverless_auth_code_flow.js +32 -0
- package/build/src/commands/clone-script.js +71 -0
- package/build/src/commands/create-deployment.js +33 -0
- package/build/src/commands/create-script.js +75 -0
- package/build/src/commands/create-version.js +31 -0
- package/build/src/commands/delete-deployment.js +71 -0
- package/build/src/commands/disable-api.js +19 -0
- package/build/src/commands/enable-api.js +31 -0
- package/build/src/commands/list-apis.js +23 -0
- package/build/src/commands/list-deployments.js +30 -0
- package/build/src/commands/list-scripts.js +28 -0
- package/build/src/commands/list-versions.js +29 -0
- package/build/src/commands/login.js +54 -53
- package/build/src/commands/logout.js +15 -15
- package/build/src/commands/open-apis.js +11 -0
- package/build/src/commands/open-container.js +15 -0
- package/build/src/commands/open-credentials.js +11 -0
- package/build/src/commands/open-logs.js +11 -0
- package/build/src/commands/open-script.js +18 -0
- package/build/src/commands/open-webapp.js +56 -0
- package/build/src/commands/program.js +108 -0
- package/build/src/commands/pull.js +19 -18
- package/build/src/commands/push.js +64 -74
- package/build/src/commands/run-function.js +61 -0
- package/build/src/commands/setup-logs.js +12 -0
- package/build/src/commands/show-authorized-user.js +18 -0
- package/build/src/commands/show-file-status.js +34 -0
- package/build/src/commands/tail-logs.js +92 -0
- package/build/src/commands/utils.js +82 -0
- package/build/src/constants.js +0 -3
- package/build/src/{apis.js → core/apis.js} +90 -92
- package/build/src/core/clasp.js +171 -0
- package/build/src/core/files.js +359 -0
- package/build/src/core/functions.js +51 -0
- package/build/src/core/logs.js +41 -0
- package/build/src/core/manifest.js +1 -0
- package/build/src/core/project.js +313 -0
- package/build/src/core/services.js +179 -0
- package/build/src/core/utils.js +121 -0
- package/build/src/index.js +16 -354
- package/build/src/intl.js +34 -0
- package/docs/README.md +1 -4
- package/docs/config-files.md +4 -5
- package/docs/run.md +26 -7
- package/package.json +87 -51
- package/CHANGELOG.md +0 -66
- package/build/src/apis.d.ts +0 -34
- package/build/src/apis.js.map +0 -1
- package/build/src/apiutils.d.ts +0 -16
- package/build/src/apiutils.js +0 -81
- package/build/src/apiutils.js.map +0 -1
- package/build/src/auth.d.ts +0 -34
- package/build/src/auth.js +0 -295
- package/build/src/auth.js.map +0 -1
- package/build/src/clasp-error.d.ts +0 -3
- package/build/src/clasp-error.js +0 -10
- package/build/src/clasp-error.js.map +0 -1
- package/build/src/commands/apis.d.ts +0 -10
- package/build/src/commands/apis.js +0 -91
- package/build/src/commands/apis.js.map +0 -1
- package/build/src/commands/clone.d.ts +0 -13
- package/build/src/commands/clone.js +0 -59
- package/build/src/commands/clone.js.map +0 -1
- package/build/src/commands/create.d.ts +0 -16
- package/build/src/commands/create.js +0 -81
- package/build/src/commands/create.js.map +0 -1
- package/build/src/commands/default.d.ts +0 -8
- package/build/src/commands/default.js +0 -10
- package/build/src/commands/default.js.map +0 -1
- package/build/src/commands/deploy.d.ts +0 -13
- package/build/src/commands/deploy.js +0 -51
- package/build/src/commands/deploy.js.map +0 -1
- package/build/src/commands/deployments.d.ts +0 -5
- package/build/src/commands/deployments.js +0 -29
- package/build/src/commands/deployments.js.map +0 -1
- package/build/src/commands/list.d.ts +0 -9
- package/build/src/commands/list.js +0 -34
- package/build/src/commands/list.js.map +0 -1
- package/build/src/commands/login.d.ts +0 -14
- package/build/src/commands/login.js.map +0 -1
- package/build/src/commands/logout.d.ts +0 -5
- package/build/src/commands/logout.js.map +0 -1
- package/build/src/commands/logs.d.ts +0 -17
- package/build/src/commands/logs.js +0 -181
- package/build/src/commands/logs.js.map +0 -1
- package/build/src/commands/open.d.ts +0 -15
- package/build/src/commands/open.js +0 -89
- package/build/src/commands/open.js.map +0 -1
- package/build/src/commands/pull.d.ts +0 -10
- package/build/src/commands/pull.js.map +0 -1
- package/build/src/commands/push.d.ts +0 -11
- package/build/src/commands/push.js.map +0 -1
- package/build/src/commands/run.d.ts +0 -14
- package/build/src/commands/run.js +0 -130
- package/build/src/commands/run.js.map +0 -1
- package/build/src/commands/setting.d.ts +0 -8
- package/build/src/commands/setting.js +0 -53
- package/build/src/commands/setting.js.map +0 -1
- package/build/src/commands/status.d.ts +0 -9
- package/build/src/commands/status.js +0 -25
- package/build/src/commands/status.js.map +0 -1
- package/build/src/commands/undeploy.d.ts +0 -9
- package/build/src/commands/undeploy.js +0 -55
- package/build/src/commands/undeploy.js.map +0 -1
- package/build/src/commands/version.d.ts +0 -5
- package/build/src/commands/version.js +0 -22
- package/build/src/commands/version.js.map +0 -1
- package/build/src/commands/versions.d.ts +0 -5
- package/build/src/commands/versions.js +0 -41
- package/build/src/commands/versions.js.map +0 -1
- package/build/src/conf.d.ts +0 -40
- package/build/src/conf.js +0 -100
- package/build/src/conf.js.map +0 -1
- package/build/src/constants.d.ts +0 -6
- package/build/src/constants.js.map +0 -1
- package/build/src/dotfile.d.ts +0 -50
- package/build/src/dotfile.js +0 -71
- package/build/src/dotfile.js.map +0 -1
- package/build/src/files.d.ts +0 -70
- package/build/src/files.js +0 -318
- package/build/src/files.js.map +0 -1
- package/build/src/index.d.ts +0 -18
- package/build/src/index.js.map +0 -1
- package/build/src/inquirer.d.ts +0 -82
- package/build/src/inquirer.js +0 -111
- package/build/src/inquirer.js.map +0 -1
- package/build/src/manifest.d.ts +0 -123
- package/build/src/manifest.js +0 -142
- package/build/src/manifest.js.map +0 -1
- package/build/src/messages.d.ts +0 -110
- package/build/src/messages.js +0 -161
- package/build/src/messages.js.map +0 -1
- package/build/src/urls.d.ts +0 -21
- package/build/src/urls.js +0 -33
- package/build/src/urls.js.map +0 -1
- package/build/src/utils.d.ts +0 -102
- package/build/src/utils.js +0 -232
- package/build/src/utils.js.map +0 -1
- package/docs/develop.md +0 -81
- package/docs/esmodules.md +0 -81
- package/docs/running-locally.md +0 -31
- package/docs/settings.md +0 -56
- package/docs/typescript.md +0 -354
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@google/clasp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha1",
|
|
4
4
|
"description": "Develop Apps Script Projects locally",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./build/src/index.js",
|
|
7
7
|
"main": "build/src/index.js",
|
|
8
8
|
"engines": {
|
|
9
|
-
"node": "
|
|
9
|
+
"node": " >=20.0.0"
|
|
10
10
|
},
|
|
11
11
|
"bin": {
|
|
12
12
|
"clasp": "build/src/index.js"
|
|
@@ -16,21 +16,31 @@
|
|
|
16
16
|
"build/src"
|
|
17
17
|
],
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "npm run compile && npm i
|
|
19
|
+
"build": "npm run compile && npm i --loglevel=error --force",
|
|
20
20
|
"build-fresh": "npm cache clean --force && npm i && npm run build",
|
|
21
|
-
"watch": "
|
|
21
|
+
"watch": "tspc --project tsconfig.json --watch",
|
|
22
22
|
"prepare": "npm run compile",
|
|
23
23
|
"lint": "npm run check",
|
|
24
|
-
"test": "nyc mocha
|
|
24
|
+
"test": "nyc mocha",
|
|
25
25
|
"coverage": "nyc --cache false report --reporter=text-lcov | coveralls",
|
|
26
|
-
"prettier": "
|
|
27
|
-
"check": "
|
|
28
|
-
"clean": "
|
|
29
|
-
"compile": "
|
|
30
|
-
"fix": "
|
|
31
|
-
"
|
|
26
|
+
"prettier": "biome format src test --write",
|
|
27
|
+
"check": "biome check src test && npm run compile",
|
|
28
|
+
"clean": "rm -rf build",
|
|
29
|
+
"compile": "tspc",
|
|
30
|
+
"fix": "biome check src test --fix",
|
|
31
|
+
"clasp": "node --loader ts-node/esm --no-warnings src/index.ts"
|
|
32
|
+
},
|
|
33
|
+
"messageformat": {
|
|
34
|
+
"locale": [
|
|
35
|
+
"en"
|
|
36
|
+
],
|
|
37
|
+
"include": [
|
|
38
|
+
"src/messages/"
|
|
39
|
+
],
|
|
40
|
+
"outfile": "src/messages/messages.js"
|
|
32
41
|
},
|
|
33
42
|
"nyc": {
|
|
43
|
+
"extends": "@istanbuljs/nyc-config-typescript",
|
|
34
44
|
"include": [
|
|
35
45
|
"src/**/*.ts"
|
|
36
46
|
],
|
|
@@ -60,55 +70,81 @@
|
|
|
60
70
|
"author": "Grant Timmerman",
|
|
61
71
|
"license": "Apache-2.0",
|
|
62
72
|
"dependencies": {
|
|
63
|
-
"@
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
73
|
+
"@formatjs/intl": "^3.1.4",
|
|
74
|
+
"@messageformat/core": "^3.4.0",
|
|
75
|
+
"@sindresorhus/is": "^7.0.1",
|
|
76
|
+
"@types/debug": "^4.1.12",
|
|
77
|
+
"chalk": "^5.4.1",
|
|
78
|
+
"chokidar": "^4.0.3",
|
|
79
|
+
"cli-truncate": "^4.0.0",
|
|
80
|
+
"commander": "^13.0.0",
|
|
81
|
+
"debounce": "^2.2.0",
|
|
82
|
+
"debug": "^4.4.0",
|
|
69
83
|
"dotf": "^2.0.2",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
84
|
+
"fdir": "^6.4.3",
|
|
85
|
+
"find-up": "^7.0.0",
|
|
72
86
|
"fuzzy": "^0.1.3",
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
87
|
+
"gaxios": "^6.7.1",
|
|
88
|
+
"google-auth-library": "^9.15.0",
|
|
89
|
+
"googleapis": "^144.0.0",
|
|
90
|
+
"googleapis-common": "7.2.0",
|
|
91
|
+
"inflection": "^3.0.2",
|
|
92
|
+
"inquirer": "^12.3.2",
|
|
93
|
+
"inquirer-autocomplete-standalone": "^0.8.1",
|
|
94
|
+
"log-symbols": "^7.0.0",
|
|
79
95
|
"loud-rejection": "^2.2.0",
|
|
80
|
-
"make-dir": "^
|
|
81
|
-
"
|
|
96
|
+
"make-dir": "^5.0.0",
|
|
97
|
+
"micromatch": "^4.0.8",
|
|
98
|
+
"multimatch": "^7.0.0",
|
|
82
99
|
"normalize-newline": "^4.1.0",
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
100
|
+
"normalize-path": "^3.0.0",
|
|
101
|
+
"open": "^10.1.0",
|
|
102
|
+
"ora": "^8.1.1",
|
|
103
|
+
"p-map": "^7.0.3",
|
|
104
|
+
"picomatch": "^4.0.2",
|
|
105
|
+
"read-pkg-up": "^11.0.0",
|
|
88
106
|
"server-destroy": "^1.0.1",
|
|
89
107
|
"split-lines": "^3.0.0",
|
|
90
108
|
"strip-bom": "^5.0.0",
|
|
91
|
-
"
|
|
92
|
-
"typescript": "^4.4.2"
|
|
109
|
+
"typescript": "^5.7.3"
|
|
93
110
|
},
|
|
94
111
|
"devDependencies": {
|
|
95
|
-
"@
|
|
96
|
-
"@
|
|
97
|
-
"@
|
|
98
|
-
"@
|
|
99
|
-
"@
|
|
100
|
-
"@types/
|
|
101
|
-
"@types/
|
|
102
|
-
"@types/
|
|
103
|
-
"@types/
|
|
104
|
-
"@types/
|
|
105
|
-
"
|
|
112
|
+
"@biomejs/biome": "^1.9.4",
|
|
113
|
+
"@commander-js/extra-typings": "^13.0.0",
|
|
114
|
+
"@formatjs/ts-transformer": "^3.13.32",
|
|
115
|
+
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
116
|
+
"@messageformat/cli": "^4.0.1",
|
|
117
|
+
"@types/chai": "^5.0.1",
|
|
118
|
+
"@types/chai-as-promised": "^8.0.1",
|
|
119
|
+
"@types/chai-fs": "^2.0.5",
|
|
120
|
+
"@types/chai-subset": "^1.3.5",
|
|
121
|
+
"@types/debounce": "^1.2.4",
|
|
122
|
+
"@types/fs-extra": "^11.0.4",
|
|
123
|
+
"@types/micromatch": "^4.0.9",
|
|
124
|
+
"@types/mocha": "^10.0.10",
|
|
125
|
+
"@types/mock-fs": "^4.13.4",
|
|
126
|
+
"@types/node": "^22.10.10",
|
|
127
|
+
"@types/normalize-path": "^3.0.2",
|
|
128
|
+
"@types/picomatch": "^3.0.2",
|
|
129
|
+
"@types/server-destroy": "^1.0.4",
|
|
130
|
+
"@types/sinon": "^17.0.4",
|
|
131
|
+
"@types/tmp": "^0.2.6",
|
|
132
|
+
"@types/wtfnode": "^0.7.3",
|
|
133
|
+
"chai": "^5.1.2",
|
|
134
|
+
"chai-as-promised": "^8.0.1",
|
|
135
|
+
"chai-subset": "^1.6.0",
|
|
106
136
|
"coveralls": "^3.1.1",
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
137
|
+
"mocha": "^11.1.0",
|
|
138
|
+
"mock-fs": "^5.4.1",
|
|
139
|
+
"nock": "^14.0.0",
|
|
140
|
+
"nyc": "^17.1.0",
|
|
141
|
+
"sinon": "^19.0.2",
|
|
142
|
+
"source-map-support": "^0.5.21",
|
|
143
|
+
"tmp": "^0.2.3",
|
|
144
|
+
"ts-node": "^10.9.2",
|
|
145
|
+
"ts-patch": "^3.3.0",
|
|
146
|
+
"type-fest": "^4.33.0",
|
|
147
|
+
"why-is-node-running": "^3.2.2",
|
|
148
|
+
"wtfnode": "^0.10.0"
|
|
113
149
|
}
|
|
114
150
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [2.4.2](https://github.com/google/clasp/compare/v2.4.1...v2.4.2) (2022-09-26)
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
### Bug Fixes
|
|
7
|
-
|
|
8
|
-
* remove online check ([#936](https://github.com/google/clasp/issues/936)) ([6775d9f](https://github.com/google/clasp/commit/6775d9f674886ac11ee2a23d59cbe62dd141d97b))
|
|
9
|
-
|
|
10
|
-
### [2.4.1](https://www.github.com/google/clasp/compare/v2.4.0...v2.4.1) (2021-08-09)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
### Bug Fixes
|
|
14
|
-
|
|
15
|
-
* 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))
|
|
16
|
-
* Fix saving credentials when refreshed. ([#863](https://www.github.com/google/clasp/issues/863)) ([48e6fa3](https://www.github.com/google/clasp/commit/48e6fa3354de635a3ea1ce089d481847b2e939e9))
|
|
17
|
-
* Honor --project CLI option ([#865](https://www.github.com/google/clasp/issues/865)) ([deacf03](https://github.com/google/clasp/commit/deacf03d6d2d28abd9f3a408a77b69e99b9a59bf))
|
|
18
|
-
* Shut down embedded server on login faster ([40e0b3d](https://github.com/google/clasp/commit/40e0b3d67c3d381d0f24d738781ed61a2622c477))
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## [2.4.0](https://www.github.com/google/clasp/compare/v2.3.1...v2.4.0) (2021-06-11)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
### Features
|
|
25
|
-
|
|
26
|
-
* env & option based config files ([1b68374](https://www.github.com/google/clasp/commit/1b6837480b2e22cb8728cb80b2d8cfa36381d982))
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Bug Fixes
|
|
30
|
-
|
|
31
|
-
* unnecessary code caused `help` command to crash ([3741f71](https://www.github.com/google/clasp/commit/3741f71d744a2db8c5f1304c3426b253f8e742bd))
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
### Miscellaneous Chores
|
|
35
|
-
|
|
36
|
-
* switch from cjs to esm ([5055865](https://www.github.com/google/clasp/commit/5055865a28e48a654ffbb3b28212e53f484f76a4))
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
### [2.3.2](https://www.github.com/google/clasp/compare/v2.3.0...v2.3.2) (2021-05-17)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
### Miscellaneous Chores
|
|
43
|
-
|
|
44
|
-
* Republish 2.3.0 as 2.3.2 due to unintended breaking changes in 2.3.1
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
### [2.3.1](https://www.github.com/google/clasp/compare/v2.3.0...v2.3.1) (2021-05-11)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
### Features
|
|
51
|
-
|
|
52
|
-
* env & option based config files ([1b68374](https://www.github.com/google/clasp/commit/1b6837480b2e22cb8728cb80b2d8cfa36381d982))
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
### Bug Fixes
|
|
56
|
-
|
|
57
|
-
* Add missing find-up dependency ([#833](https://www.github.com/google/clasp/issues/833)) ([0c9c773](https://www.github.com/google/clasp/commit/0c9c773ff800be23aba2b32a049fec186c2e8507))
|
|
58
|
-
* commander 6 option clash ([f2b7092](https://www.github.com/google/clasp/commit/f2b709260d4581ad5f5ac78121481824ab54f076))
|
|
59
|
-
* commander 6 option clash ([#816](https://www.github.com/google/clasp/issues/816)) ([517a9d8](https://www.github.com/google/clasp/commit/517a9d8ff71c89f0665ae57903111529eb8d6dd7))
|
|
60
|
-
* 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))
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
### Miscellaneous Chores
|
|
64
|
-
|
|
65
|
-
* Enable release-please workflow ([60b1e25](https://www.github.com/google/clasp/commit/60b1e25a343204ce6fbff9ce5a056b479d17bbe1))
|
|
66
|
-
* Release 2.3.1 ([4322184](https://www.github.com/google/clasp/commit/432218430e9d1506f7a09d65893b83c951c529be))
|
package/build/src/apis.d.ts
DELETED
|
@@ -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;
|
package/build/src/apis.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apis.js","sourceRoot":"","sources":["../../src/apis.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,MAAM,CAAN,IAAY,YAQX;AARD,WAAY,YAAY;IACtB,yCAAyB,CAAA;IACzB,6BAAa,CAAA;IACb,iCAAiB,CAAA;IACjB,iCAAiB,CAAA;IACjB,+BAAe,CAAA;IACf,iCAAiB,CAAA;IACjB,2BAAW,CAAA;AACb,CAAC,EARW,YAAY,KAAZ,YAAY,QAQvB;AAUD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,wBAAwB,GA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CAAC"}
|
package/build/src/apiutils.d.ts
DELETED
|
@@ -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>;
|
package/build/src/apiutils.js
DELETED
|
@@ -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,g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C,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"}
|
package/build/src/auth.d.ts
DELETED
|
@@ -1,34 +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
|
-
*/
|
|
23
|
-
export declare const authorize: (options: {
|
|
24
|
-
readonly creds?: Readonly<ClaspCredentials>;
|
|
25
|
-
readonly scopes: readonly string[];
|
|
26
|
-
readonly useLocalhost: boolean;
|
|
27
|
-
}) => Promise<void>;
|
|
28
|
-
export declare const getLoggedInEmail: () => Promise<string | null | undefined>;
|
|
29
|
-
/**
|
|
30
|
-
* Loads the Apps Script API credentials for the CLI.
|
|
31
|
-
*
|
|
32
|
-
* Required before every API call.
|
|
33
|
-
*/
|
|
34
|
-
export declare const loadAPICredentials: (local?: boolean) => Promise<ClaspToken>;
|