@mcpher/gas-fakes 1.1.1 → 1.1.4
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 +21 -1
- package/gasmess/bruce/bare.js +1 -0
- package/gasmess/bruce/basic.js +0 -1
- package/gasmess/bruce/package-lock.json +207 -181
- package/gasmess/bruce/package.json +3 -1
- package/logo.png +0 -0
- package/package.json +3 -7
- package/src/services/advdrive/drapis.js +1 -1
- package/src/services/logger/fakelogger.js +2 -32
- package/src/support/auth.js +12 -5
- package/src/support/sxlogger.js +41 -0
- package/src/support/syncit.js +3 -1
- package/src/support/workersync/sxfunctions.js +2 -0
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ DRIVE_TEST_FILE_ID="add the id of some test file you have access to here"
|
|
|
52
52
|
# probably dont need to change these
|
|
53
53
|
AC=default
|
|
54
54
|
# these are the scopes set by default - take some of these out if you want to minimize access
|
|
55
|
-
DEFAULT_SCOPES="https://www.googleapis.com/auth/userinfo.email,openid,https://www.googleapis.com/auth/cloud-platform
|
|
55
|
+
DEFAULT_SCOPES="https://www.googleapis.com/auth/userinfo.email,openid,https://www.googleapis.com/auth/cloud-platform"
|
|
56
56
|
EXTRA_SCOPES=",https://www.googleapis.com/auth/drive,https://www.googleapis.com/auth/spreadsheets"
|
|
57
57
|
|
|
58
58
|
# optional logging destination
|
|
@@ -60,6 +60,26 @@ EXTRA_SCOPES=",https://www.googleapis.com/auth/drive,https://www.googleapis.com/
|
|
|
60
60
|
LOG_DESTINATION="BOTH"
|
|
61
61
|
|
|
62
62
|
```
|
|
63
|
+
#### Applying the .env
|
|
64
|
+
|
|
65
|
+
You can run
|
|
66
|
+
```bash
|
|
67
|
+
cd shells
|
|
68
|
+
bash setaccounts.sh
|
|
69
|
+
```
|
|
70
|
+
Which will set up and test the initial application default login with the selected scopes.
|
|
71
|
+
|
|
72
|
+
#### enabling workspace services
|
|
73
|
+
|
|
74
|
+
You can run this shell to enable all the required cloud services
|
|
75
|
+
```bash
|
|
76
|
+
cd shells
|
|
77
|
+
bash enable.sh
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
#### Restricted scopes
|
|
81
|
+
|
|
82
|
+
Recent changes in the OAuth security model have made it more difficult for Application Default credentials to work with all the scopes we'll need to fully emulate Live Apps Script locally. However there is a way to work around this by creating an oauth client for internal use in the cloud console, and injecting its credentials into those used by the application default creadentials process. You should now follow the guidance in [restricted scopes](restricted_scopes.md) to enhance your login process to be able access all the supported services in gas-fakes
|
|
63
83
|
|
|
64
84
|
#### Manifest file
|
|
65
85
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../../main.js';
|
package/gasmess/bruce/basic.js
CHANGED
|
@@ -9,38 +9,9 @@
|
|
|
9
9
|
"version": "1.0.0",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@mcpher/gas-fakes": "^1.1.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"../..": {
|
|
16
|
-
"name": "@mcpher/gas-fakes",
|
|
17
|
-
"version": "1.1.0",
|
|
18
|
-
"extraneous": true,
|
|
19
|
-
"license": "MIT",
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"@google-cloud/logging": "^11.2.1",
|
|
22
|
-
"@mcpher/fake-gasenum": "^1.0.2",
|
|
23
|
-
"@sindresorhus/is": "^7.0.1",
|
|
24
|
-
"archiver": "^7.0.1",
|
|
25
|
-
"exceljs": "^4.4.0",
|
|
26
|
-
"fast-json-stable-stringify": "^2.1.0",
|
|
27
|
-
"get-stream": "^9.0.1",
|
|
28
|
-
"googleapis": "^157.0.0",
|
|
29
|
-
"got": "^14.4.7",
|
|
30
|
-
"into-stream": "^8.0.1",
|
|
31
|
-
"is": "^3.3.2",
|
|
32
|
-
"keyv": "^5.5.0",
|
|
33
|
-
"keyv-file": "^5.1.3",
|
|
34
|
-
"mime": "^4.0.7",
|
|
35
|
-
"sinon": "^21.0.0",
|
|
36
|
-
"sleep-synchronously": "^2.0.0",
|
|
37
|
-
"subsume": "^4.0.0",
|
|
38
|
-
"to-readable-stream": "^4.0.0",
|
|
39
|
-
"unzipper": "^0.12.3",
|
|
40
|
-
"yoctocolors": "^2.1.2"
|
|
41
|
-
},
|
|
42
|
-
"engines": {
|
|
43
|
-
"node": ">=20.11.0"
|
|
12
|
+
"@mcpher/gas-fakes": "^1.1.2",
|
|
13
|
+
"google-auth-library": ">=9.0.0",
|
|
14
|
+
"googleapis": ">=157.0.0"
|
|
44
15
|
}
|
|
45
16
|
},
|
|
46
17
|
"node_modules/@fast-csv/format": {
|
|
@@ -92,6 +63,36 @@
|
|
|
92
63
|
"node": ">=14.0.0"
|
|
93
64
|
}
|
|
94
65
|
},
|
|
66
|
+
"node_modules/@google-cloud/common/node_modules/google-auth-library": {
|
|
67
|
+
"version": "9.15.1",
|
|
68
|
+
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-9.15.1.tgz",
|
|
69
|
+
"integrity": "sha512-Jb6Z0+nvECVz+2lzSMt9u98UsoakXxA2HGHMCxh+so3n90XgYWkq5dur19JAJV7ONiJY22yBTyJB1TSkvPq9Ng==",
|
|
70
|
+
"license": "Apache-2.0",
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"base64-js": "^1.3.0",
|
|
73
|
+
"ecdsa-sig-formatter": "^1.0.11",
|
|
74
|
+
"gaxios": "^6.1.1",
|
|
75
|
+
"gcp-metadata": "^6.1.0",
|
|
76
|
+
"gtoken": "^7.0.0",
|
|
77
|
+
"jws": "^4.0.0"
|
|
78
|
+
},
|
|
79
|
+
"engines": {
|
|
80
|
+
"node": ">=14"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"node_modules/@google-cloud/common/node_modules/gtoken": {
|
|
84
|
+
"version": "7.1.0",
|
|
85
|
+
"resolved": "https://registry.npmjs.org/gtoken/-/gtoken-7.1.0.tgz",
|
|
86
|
+
"integrity": "sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw==",
|
|
87
|
+
"license": "MIT",
|
|
88
|
+
"dependencies": {
|
|
89
|
+
"gaxios": "^6.0.0",
|
|
90
|
+
"jws": "^4.0.0"
|
|
91
|
+
},
|
|
92
|
+
"engines": {
|
|
93
|
+
"node": ">=14.0.0"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
95
96
|
"node_modules/@google-cloud/logging": {
|
|
96
97
|
"version": "11.2.1",
|
|
97
98
|
"resolved": "https://registry.npmjs.org/@google-cloud/logging/-/logging-11.2.1.tgz",
|
|
@@ -119,6 +120,36 @@
|
|
|
119
120
|
"node": ">=14.0.0"
|
|
120
121
|
}
|
|
121
122
|
},
|
|
123
|
+
"node_modules/@google-cloud/logging/node_modules/google-auth-library": {
|
|
124
|
+
"version": "9.15.1",
|
|
125
|
+
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-9.15.1.tgz",
|
|
126
|
+
"integrity": "sha512-Jb6Z0+nvECVz+2lzSMt9u98UsoakXxA2HGHMCxh+so3n90XgYWkq5dur19JAJV7ONiJY22yBTyJB1TSkvPq9Ng==",
|
|
127
|
+
"license": "Apache-2.0",
|
|
128
|
+
"dependencies": {
|
|
129
|
+
"base64-js": "^1.3.0",
|
|
130
|
+
"ecdsa-sig-formatter": "^1.0.11",
|
|
131
|
+
"gaxios": "^6.1.1",
|
|
132
|
+
"gcp-metadata": "^6.1.0",
|
|
133
|
+
"gtoken": "^7.0.0",
|
|
134
|
+
"jws": "^4.0.0"
|
|
135
|
+
},
|
|
136
|
+
"engines": {
|
|
137
|
+
"node": ">=14"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"node_modules/@google-cloud/logging/node_modules/gtoken": {
|
|
141
|
+
"version": "7.1.0",
|
|
142
|
+
"resolved": "https://registry.npmjs.org/gtoken/-/gtoken-7.1.0.tgz",
|
|
143
|
+
"integrity": "sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw==",
|
|
144
|
+
"license": "MIT",
|
|
145
|
+
"dependencies": {
|
|
146
|
+
"gaxios": "^6.0.0",
|
|
147
|
+
"jws": "^4.0.0"
|
|
148
|
+
},
|
|
149
|
+
"engines": {
|
|
150
|
+
"node": ">=14.0.0"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
122
153
|
"node_modules/@google-cloud/paginator": {
|
|
123
154
|
"version": "5.0.2",
|
|
124
155
|
"resolved": "https://registry.npmjs.org/@google-cloud/paginator/-/paginator-5.0.2.tgz",
|
|
@@ -238,9 +269,9 @@
|
|
|
238
269
|
"integrity": "sha512-ExCSyt7a7wPIsaz/IZdjMElD3bQW3lNaoXhtmVwt2ozzwbEdWe5f7yueN1MtBR+bDfpWqK4v6dS0QxkmlB/Xnw=="
|
|
239
270
|
},
|
|
240
271
|
"node_modules/@mcpher/gas-fakes": {
|
|
241
|
-
"version": "1.1.
|
|
242
|
-
"resolved": "https://registry.npmjs.org/@mcpher/gas-fakes/-/gas-fakes-1.1.
|
|
243
|
-
"integrity": "sha512-
|
|
272
|
+
"version": "1.1.2",
|
|
273
|
+
"resolved": "https://registry.npmjs.org/@mcpher/gas-fakes/-/gas-fakes-1.1.2.tgz",
|
|
274
|
+
"integrity": "sha512-Wzroh7EJC+pQb+UaZMONrME2S2rYiKUX8agUI8Oh50J29+TckvA9W0ulqEIU5EionI4kJDZkase5w/h/enPqng==",
|
|
244
275
|
"license": "MIT",
|
|
245
276
|
"dependencies": {
|
|
246
277
|
"@google-cloud/logging": "^11.2.1",
|
|
@@ -266,6 +297,23 @@
|
|
|
266
297
|
},
|
|
267
298
|
"engines": {
|
|
268
299
|
"node": ">=20.11.0"
|
|
300
|
+
},
|
|
301
|
+
"peerDependencies": {
|
|
302
|
+
"google-auth-library": ">=9.0.0",
|
|
303
|
+
"googleapis": ">=157.0.0"
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
"node_modules/@mcpher/gas-fakes/node_modules/googleapis": {
|
|
307
|
+
"version": "157.0.0",
|
|
308
|
+
"resolved": "https://registry.npmjs.org/googleapis/-/googleapis-157.0.0.tgz",
|
|
309
|
+
"integrity": "sha512-0q6V93amJANRu1BRkeG6eftrAxweM7ZLbgRshmRg2zLSPpPLaRiDFCckHpEOFspXGglfw8l+hZql7NgWPwAwfQ==",
|
|
310
|
+
"license": "Apache-2.0",
|
|
311
|
+
"dependencies": {
|
|
312
|
+
"google-auth-library": "^10.2.0",
|
|
313
|
+
"googleapis-common": "^8.0.0"
|
|
314
|
+
},
|
|
315
|
+
"engines": {
|
|
316
|
+
"node": ">=18"
|
|
269
317
|
}
|
|
270
318
|
},
|
|
271
319
|
"node_modules/@opentelemetry/api": {
|
|
@@ -1952,84 +2000,24 @@
|
|
|
1952
2000
|
}
|
|
1953
2001
|
},
|
|
1954
2002
|
"node_modules/google-auth-library": {
|
|
1955
|
-
"version": "
|
|
1956
|
-
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-
|
|
1957
|
-
"integrity": "sha512-
|
|
2003
|
+
"version": "10.4.0",
|
|
2004
|
+
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-10.4.0.tgz",
|
|
2005
|
+
"integrity": "sha512-CmIrSy1bqMQUsPmA9+hcSbAXL80cFhu40cGMUjCaLpNKVzzvi+0uAHq8GNZxkoGYIsTX4ZQ7e4aInAqWxgn4fg==",
|
|
1958
2006
|
"license": "Apache-2.0",
|
|
1959
2007
|
"dependencies": {
|
|
1960
2008
|
"base64-js": "^1.3.0",
|
|
1961
2009
|
"ecdsa-sig-formatter": "^1.0.11",
|
|
1962
|
-
"gaxios": "^
|
|
1963
|
-
"gcp-metadata": "^
|
|
1964
|
-
"
|
|
2010
|
+
"gaxios": "^7.0.0",
|
|
2011
|
+
"gcp-metadata": "^7.0.0",
|
|
2012
|
+
"google-logging-utils": "^1.0.0",
|
|
2013
|
+
"gtoken": "^8.0.0",
|
|
1965
2014
|
"jws": "^4.0.0"
|
|
1966
2015
|
},
|
|
1967
|
-
"engines": {
|
|
1968
|
-
"node": ">=14"
|
|
1969
|
-
}
|
|
1970
|
-
},
|
|
1971
|
-
"node_modules/google-gax": {
|
|
1972
|
-
"version": "4.6.1",
|
|
1973
|
-
"resolved": "https://registry.npmjs.org/google-gax/-/google-gax-4.6.1.tgz",
|
|
1974
|
-
"integrity": "sha512-V6eky/xz2mcKfAd1Ioxyd6nmA61gao3n01C+YeuIwu3vzM9EDR6wcVzMSIbLMDXWeoi9SHYctXuKYC5uJUT3eQ==",
|
|
1975
|
-
"license": "Apache-2.0",
|
|
1976
|
-
"dependencies": {
|
|
1977
|
-
"@grpc/grpc-js": "^1.10.9",
|
|
1978
|
-
"@grpc/proto-loader": "^0.7.13",
|
|
1979
|
-
"@types/long": "^4.0.0",
|
|
1980
|
-
"abort-controller": "^3.0.0",
|
|
1981
|
-
"duplexify": "^4.0.0",
|
|
1982
|
-
"google-auth-library": "^9.3.0",
|
|
1983
|
-
"node-fetch": "^2.7.0",
|
|
1984
|
-
"object-hash": "^3.0.0",
|
|
1985
|
-
"proto3-json-serializer": "^2.0.2",
|
|
1986
|
-
"protobufjs": "^7.3.2",
|
|
1987
|
-
"retry-request": "^7.0.0",
|
|
1988
|
-
"uuid": "^9.0.1"
|
|
1989
|
-
},
|
|
1990
|
-
"engines": {
|
|
1991
|
-
"node": ">=14"
|
|
1992
|
-
}
|
|
1993
|
-
},
|
|
1994
|
-
"node_modules/google-logging-utils": {
|
|
1995
|
-
"version": "0.0.2",
|
|
1996
|
-
"resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-0.0.2.tgz",
|
|
1997
|
-
"integrity": "sha512-NEgUnEcBiP5HrPzufUkBzJOD/Sxsco3rLNo1F1TNf7ieU8ryUzBhqba8r756CjLX7rn3fHl6iLEwPYuqpoKgQQ==",
|
|
1998
|
-
"license": "Apache-2.0",
|
|
1999
|
-
"engines": {
|
|
2000
|
-
"node": ">=14"
|
|
2001
|
-
}
|
|
2002
|
-
},
|
|
2003
|
-
"node_modules/googleapis": {
|
|
2004
|
-
"version": "157.0.0",
|
|
2005
|
-
"resolved": "https://registry.npmjs.org/googleapis/-/googleapis-157.0.0.tgz",
|
|
2006
|
-
"integrity": "sha512-0q6V93amJANRu1BRkeG6eftrAxweM7ZLbgRshmRg2zLSPpPLaRiDFCckHpEOFspXGglfw8l+hZql7NgWPwAwfQ==",
|
|
2007
|
-
"license": "Apache-2.0",
|
|
2008
|
-
"dependencies": {
|
|
2009
|
-
"google-auth-library": "^10.2.0",
|
|
2010
|
-
"googleapis-common": "^8.0.0"
|
|
2011
|
-
},
|
|
2012
2016
|
"engines": {
|
|
2013
2017
|
"node": ">=18"
|
|
2014
2018
|
}
|
|
2015
2019
|
},
|
|
2016
|
-
"node_modules/
|
|
2017
|
-
"version": "8.0.0",
|
|
2018
|
-
"resolved": "https://registry.npmjs.org/googleapis-common/-/googleapis-common-8.0.0.tgz",
|
|
2019
|
-
"integrity": "sha512-66if47It7y+Sab3HMkwEXx1kCq9qUC9px8ZXoj1CMrmLmUw81GpbnsNlXnlyZyGbGPGcj+tDD9XsZ23m7GLaJQ==",
|
|
2020
|
-
"license": "Apache-2.0",
|
|
2021
|
-
"dependencies": {
|
|
2022
|
-
"extend": "^3.0.2",
|
|
2023
|
-
"gaxios": "^7.0.0-rc.4",
|
|
2024
|
-
"google-auth-library": "^10.1.0",
|
|
2025
|
-
"qs": "^6.7.0",
|
|
2026
|
-
"url-template": "^2.0.8"
|
|
2027
|
-
},
|
|
2028
|
-
"engines": {
|
|
2029
|
-
"node": ">=18.0.0"
|
|
2030
|
-
}
|
|
2031
|
-
},
|
|
2032
|
-
"node_modules/googleapis-common/node_modules/gaxios": {
|
|
2020
|
+
"node_modules/google-auth-library/node_modules/gaxios": {
|
|
2033
2021
|
"version": "7.1.2",
|
|
2034
2022
|
"resolved": "https://registry.npmjs.org/gaxios/-/gaxios-7.1.2.tgz",
|
|
2035
2023
|
"integrity": "sha512-/Szrn8nr+2TsQT1Gp8iIe/BEytJmbyfrbFh419DfGQSkEgNEhbPi7JRJuughjkTzPWgU9gBQf5AVu3DbHt0OXA==",
|
|
@@ -2043,7 +2031,7 @@
|
|
|
2043
2031
|
"node": ">=18"
|
|
2044
2032
|
}
|
|
2045
2033
|
},
|
|
2046
|
-
"node_modules/
|
|
2034
|
+
"node_modules/google-auth-library/node_modules/gcp-metadata": {
|
|
2047
2035
|
"version": "7.0.1",
|
|
2048
2036
|
"resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-7.0.1.tgz",
|
|
2049
2037
|
"integrity": "sha512-UcO3kefx6dCcZkgcTGgVOTFb7b1LlQ02hY1omMjjrrBzkajRMCFgYOjs7J71WqnuG1k2b+9ppGL7FsOfhZMQKQ==",
|
|
@@ -2057,25 +2045,7 @@
|
|
|
2057
2045
|
"node": ">=18"
|
|
2058
2046
|
}
|
|
2059
2047
|
},
|
|
2060
|
-
"node_modules/
|
|
2061
|
-
"version": "10.4.0",
|
|
2062
|
-
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-10.4.0.tgz",
|
|
2063
|
-
"integrity": "sha512-CmIrSy1bqMQUsPmA9+hcSbAXL80cFhu40cGMUjCaLpNKVzzvi+0uAHq8GNZxkoGYIsTX4ZQ7e4aInAqWxgn4fg==",
|
|
2064
|
-
"license": "Apache-2.0",
|
|
2065
|
-
"dependencies": {
|
|
2066
|
-
"base64-js": "^1.3.0",
|
|
2067
|
-
"ecdsa-sig-formatter": "^1.0.11",
|
|
2068
|
-
"gaxios": "^7.0.0",
|
|
2069
|
-
"gcp-metadata": "^7.0.0",
|
|
2070
|
-
"google-logging-utils": "^1.0.0",
|
|
2071
|
-
"gtoken": "^8.0.0",
|
|
2072
|
-
"jws": "^4.0.0"
|
|
2073
|
-
},
|
|
2074
|
-
"engines": {
|
|
2075
|
-
"node": ">=18"
|
|
2076
|
-
}
|
|
2077
|
-
},
|
|
2078
|
-
"node_modules/googleapis-common/node_modules/google-logging-utils": {
|
|
2048
|
+
"node_modules/google-auth-library/node_modules/google-logging-utils": {
|
|
2079
2049
|
"version": "1.1.1",
|
|
2080
2050
|
"resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-1.1.1.tgz",
|
|
2081
2051
|
"integrity": "sha512-rcX58I7nqpu4mbKztFeOAObbomBbHU2oIb/d3tJfF3dizGSApqtSwYJigGCooHdnMyQBIw8BrWyK96w3YXgr6A==",
|
|
@@ -2084,20 +2054,7 @@
|
|
|
2084
2054
|
"node": ">=14"
|
|
2085
2055
|
}
|
|
2086
2056
|
},
|
|
2087
|
-
"node_modules/
|
|
2088
|
-
"version": "8.0.0",
|
|
2089
|
-
"resolved": "https://registry.npmjs.org/gtoken/-/gtoken-8.0.0.tgz",
|
|
2090
|
-
"integrity": "sha512-+CqsMbHPiSTdtSO14O51eMNlrp9N79gmeqmXeouJOhfucAedHw9noVe/n5uJk3tbKE6a+6ZCQg3RPhVhHByAIw==",
|
|
2091
|
-
"license": "MIT",
|
|
2092
|
-
"dependencies": {
|
|
2093
|
-
"gaxios": "^7.0.0",
|
|
2094
|
-
"jws": "^4.0.0"
|
|
2095
|
-
},
|
|
2096
|
-
"engines": {
|
|
2097
|
-
"node": ">=18"
|
|
2098
|
-
}
|
|
2099
|
-
},
|
|
2100
|
-
"node_modules/googleapis-common/node_modules/node-fetch": {
|
|
2057
|
+
"node_modules/google-auth-library/node_modules/node-fetch": {
|
|
2101
2058
|
"version": "3.3.2",
|
|
2102
2059
|
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
|
|
2103
2060
|
"integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
|
|
@@ -2115,75 +2072,112 @@
|
|
|
2115
2072
|
"url": "https://opencollective.com/node-fetch"
|
|
2116
2073
|
}
|
|
2117
2074
|
},
|
|
2118
|
-
"node_modules/
|
|
2119
|
-
"version": "
|
|
2120
|
-
"resolved": "https://registry.npmjs.org/
|
|
2121
|
-
"integrity": "sha512
|
|
2075
|
+
"node_modules/google-gax": {
|
|
2076
|
+
"version": "4.6.1",
|
|
2077
|
+
"resolved": "https://registry.npmjs.org/google-gax/-/google-gax-4.6.1.tgz",
|
|
2078
|
+
"integrity": "sha512-V6eky/xz2mcKfAd1Ioxyd6nmA61gao3n01C+YeuIwu3vzM9EDR6wcVzMSIbLMDXWeoi9SHYctXuKYC5uJUT3eQ==",
|
|
2122
2079
|
"license": "Apache-2.0",
|
|
2123
2080
|
"dependencies": {
|
|
2124
|
-
"
|
|
2125
|
-
"
|
|
2126
|
-
"
|
|
2081
|
+
"@grpc/grpc-js": "^1.10.9",
|
|
2082
|
+
"@grpc/proto-loader": "^0.7.13",
|
|
2083
|
+
"@types/long": "^4.0.0",
|
|
2084
|
+
"abort-controller": "^3.0.0",
|
|
2085
|
+
"duplexify": "^4.0.0",
|
|
2086
|
+
"google-auth-library": "^9.3.0",
|
|
2087
|
+
"node-fetch": "^2.7.0",
|
|
2088
|
+
"object-hash": "^3.0.0",
|
|
2089
|
+
"proto3-json-serializer": "^2.0.2",
|
|
2090
|
+
"protobufjs": "^7.3.2",
|
|
2091
|
+
"retry-request": "^7.0.0",
|
|
2092
|
+
"uuid": "^9.0.1"
|
|
2127
2093
|
},
|
|
2128
2094
|
"engines": {
|
|
2129
|
-
"node": ">=
|
|
2095
|
+
"node": ">=14"
|
|
2130
2096
|
}
|
|
2131
2097
|
},
|
|
2132
|
-
"node_modules/
|
|
2133
|
-
"version": "
|
|
2134
|
-
"resolved": "https://registry.npmjs.org/
|
|
2135
|
-
"integrity": "sha512-
|
|
2098
|
+
"node_modules/google-gax/node_modules/google-auth-library": {
|
|
2099
|
+
"version": "9.15.1",
|
|
2100
|
+
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-9.15.1.tgz",
|
|
2101
|
+
"integrity": "sha512-Jb6Z0+nvECVz+2lzSMt9u98UsoakXxA2HGHMCxh+so3n90XgYWkq5dur19JAJV7ONiJY22yBTyJB1TSkvPq9Ng==",
|
|
2136
2102
|
"license": "Apache-2.0",
|
|
2137
2103
|
"dependencies": {
|
|
2138
|
-
"
|
|
2139
|
-
"
|
|
2140
|
-
"
|
|
2104
|
+
"base64-js": "^1.3.0",
|
|
2105
|
+
"ecdsa-sig-formatter": "^1.0.11",
|
|
2106
|
+
"gaxios": "^6.1.1",
|
|
2107
|
+
"gcp-metadata": "^6.1.0",
|
|
2108
|
+
"gtoken": "^7.0.0",
|
|
2109
|
+
"jws": "^4.0.0"
|
|
2141
2110
|
},
|
|
2142
2111
|
"engines": {
|
|
2143
|
-
"node": ">=
|
|
2112
|
+
"node": ">=14"
|
|
2144
2113
|
}
|
|
2145
2114
|
},
|
|
2146
|
-
"node_modules/
|
|
2147
|
-
"version": "
|
|
2148
|
-
"resolved": "https://registry.npmjs.org/
|
|
2149
|
-
"integrity": "sha512-
|
|
2150
|
-
"license": "
|
|
2115
|
+
"node_modules/google-gax/node_modules/gtoken": {
|
|
2116
|
+
"version": "7.1.0",
|
|
2117
|
+
"resolved": "https://registry.npmjs.org/gtoken/-/gtoken-7.1.0.tgz",
|
|
2118
|
+
"integrity": "sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw==",
|
|
2119
|
+
"license": "MIT",
|
|
2151
2120
|
"dependencies": {
|
|
2152
|
-
"
|
|
2153
|
-
"ecdsa-sig-formatter": "^1.0.11",
|
|
2154
|
-
"gaxios": "^7.0.0",
|
|
2155
|
-
"gcp-metadata": "^7.0.0",
|
|
2156
|
-
"google-logging-utils": "^1.0.0",
|
|
2157
|
-
"gtoken": "^8.0.0",
|
|
2121
|
+
"gaxios": "^6.0.0",
|
|
2158
2122
|
"jws": "^4.0.0"
|
|
2159
2123
|
},
|
|
2160
2124
|
"engines": {
|
|
2161
|
-
"node": ">=
|
|
2125
|
+
"node": ">=14.0.0"
|
|
2162
2126
|
}
|
|
2163
2127
|
},
|
|
2164
|
-
"node_modules/
|
|
2165
|
-
"version": "
|
|
2166
|
-
"resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-
|
|
2167
|
-
"integrity": "sha512-
|
|
2128
|
+
"node_modules/google-logging-utils": {
|
|
2129
|
+
"version": "0.0.2",
|
|
2130
|
+
"resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-0.0.2.tgz",
|
|
2131
|
+
"integrity": "sha512-NEgUnEcBiP5HrPzufUkBzJOD/Sxsco3rLNo1F1TNf7ieU8ryUzBhqba8r756CjLX7rn3fHl6iLEwPYuqpoKgQQ==",
|
|
2168
2132
|
"license": "Apache-2.0",
|
|
2169
2133
|
"engines": {
|
|
2170
2134
|
"node": ">=14"
|
|
2171
2135
|
}
|
|
2172
2136
|
},
|
|
2173
|
-
"node_modules/googleapis
|
|
2137
|
+
"node_modules/googleapis": {
|
|
2138
|
+
"version": "161.0.0",
|
|
2139
|
+
"resolved": "https://registry.npmjs.org/googleapis/-/googleapis-161.0.0.tgz",
|
|
2140
|
+
"integrity": "sha512-JZy2cWMxgUF8E09KHzplI+z+FVG8NWDB/bsf4xevt9Um4bInb0X1qaG9qpDn49DHT5HsU0mOp3EOBGb8+AdE3Q==",
|
|
2141
|
+
"license": "Apache-2.0",
|
|
2142
|
+
"dependencies": {
|
|
2143
|
+
"google-auth-library": "^10.2.0",
|
|
2144
|
+
"googleapis-common": "^8.0.0"
|
|
2145
|
+
},
|
|
2146
|
+
"engines": {
|
|
2147
|
+
"node": ">=18"
|
|
2148
|
+
}
|
|
2149
|
+
},
|
|
2150
|
+
"node_modules/googleapis-common": {
|
|
2174
2151
|
"version": "8.0.0",
|
|
2175
|
-
"resolved": "https://registry.npmjs.org/
|
|
2176
|
-
"integrity": "sha512
|
|
2177
|
-
"license": "
|
|
2152
|
+
"resolved": "https://registry.npmjs.org/googleapis-common/-/googleapis-common-8.0.0.tgz",
|
|
2153
|
+
"integrity": "sha512-66if47It7y+Sab3HMkwEXx1kCq9qUC9px8ZXoj1CMrmLmUw81GpbnsNlXnlyZyGbGPGcj+tDD9XsZ23m7GLaJQ==",
|
|
2154
|
+
"license": "Apache-2.0",
|
|
2178
2155
|
"dependencies": {
|
|
2179
|
-
"
|
|
2180
|
-
"
|
|
2156
|
+
"extend": "^3.0.2",
|
|
2157
|
+
"gaxios": "^7.0.0-rc.4",
|
|
2158
|
+
"google-auth-library": "^10.1.0",
|
|
2159
|
+
"qs": "^6.7.0",
|
|
2160
|
+
"url-template": "^2.0.8"
|
|
2161
|
+
},
|
|
2162
|
+
"engines": {
|
|
2163
|
+
"node": ">=18.0.0"
|
|
2164
|
+
}
|
|
2165
|
+
},
|
|
2166
|
+
"node_modules/googleapis-common/node_modules/gaxios": {
|
|
2167
|
+
"version": "7.1.2",
|
|
2168
|
+
"resolved": "https://registry.npmjs.org/gaxios/-/gaxios-7.1.2.tgz",
|
|
2169
|
+
"integrity": "sha512-/Szrn8nr+2TsQT1Gp8iIe/BEytJmbyfrbFh419DfGQSkEgNEhbPi7JRJuughjkTzPWgU9gBQf5AVu3DbHt0OXA==",
|
|
2170
|
+
"license": "Apache-2.0",
|
|
2171
|
+
"dependencies": {
|
|
2172
|
+
"extend": "^3.0.2",
|
|
2173
|
+
"https-proxy-agent": "^7.0.1",
|
|
2174
|
+
"node-fetch": "^3.3.2"
|
|
2181
2175
|
},
|
|
2182
2176
|
"engines": {
|
|
2183
2177
|
"node": ">=18"
|
|
2184
2178
|
}
|
|
2185
2179
|
},
|
|
2186
|
-
"node_modules/googleapis/node_modules/node-fetch": {
|
|
2180
|
+
"node_modules/googleapis-common/node_modules/node-fetch": {
|
|
2187
2181
|
"version": "3.3.2",
|
|
2188
2182
|
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
|
|
2189
2183
|
"integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
|
|
@@ -2245,16 +2239,48 @@
|
|
|
2245
2239
|
"license": "ISC"
|
|
2246
2240
|
},
|
|
2247
2241
|
"node_modules/gtoken": {
|
|
2248
|
-
"version": "
|
|
2249
|
-
"resolved": "https://registry.npmjs.org/gtoken/-/gtoken-
|
|
2250
|
-
"integrity": "sha512
|
|
2242
|
+
"version": "8.0.0",
|
|
2243
|
+
"resolved": "https://registry.npmjs.org/gtoken/-/gtoken-8.0.0.tgz",
|
|
2244
|
+
"integrity": "sha512-+CqsMbHPiSTdtSO14O51eMNlrp9N79gmeqmXeouJOhfucAedHw9noVe/n5uJk3tbKE6a+6ZCQg3RPhVhHByAIw==",
|
|
2251
2245
|
"license": "MIT",
|
|
2252
2246
|
"dependencies": {
|
|
2253
|
-
"gaxios": "^
|
|
2247
|
+
"gaxios": "^7.0.0",
|
|
2254
2248
|
"jws": "^4.0.0"
|
|
2255
2249
|
},
|
|
2256
2250
|
"engines": {
|
|
2257
|
-
"node": ">=
|
|
2251
|
+
"node": ">=18"
|
|
2252
|
+
}
|
|
2253
|
+
},
|
|
2254
|
+
"node_modules/gtoken/node_modules/gaxios": {
|
|
2255
|
+
"version": "7.1.2",
|
|
2256
|
+
"resolved": "https://registry.npmjs.org/gaxios/-/gaxios-7.1.2.tgz",
|
|
2257
|
+
"integrity": "sha512-/Szrn8nr+2TsQT1Gp8iIe/BEytJmbyfrbFh419DfGQSkEgNEhbPi7JRJuughjkTzPWgU9gBQf5AVu3DbHt0OXA==",
|
|
2258
|
+
"license": "Apache-2.0",
|
|
2259
|
+
"dependencies": {
|
|
2260
|
+
"extend": "^3.0.2",
|
|
2261
|
+
"https-proxy-agent": "^7.0.1",
|
|
2262
|
+
"node-fetch": "^3.3.2"
|
|
2263
|
+
},
|
|
2264
|
+
"engines": {
|
|
2265
|
+
"node": ">=18"
|
|
2266
|
+
}
|
|
2267
|
+
},
|
|
2268
|
+
"node_modules/gtoken/node_modules/node-fetch": {
|
|
2269
|
+
"version": "3.3.2",
|
|
2270
|
+
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
|
|
2271
|
+
"integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
|
|
2272
|
+
"license": "MIT",
|
|
2273
|
+
"dependencies": {
|
|
2274
|
+
"data-uri-to-buffer": "^4.0.0",
|
|
2275
|
+
"fetch-blob": "^3.1.4",
|
|
2276
|
+
"formdata-polyfill": "^4.0.10"
|
|
2277
|
+
},
|
|
2278
|
+
"engines": {
|
|
2279
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
2280
|
+
},
|
|
2281
|
+
"funding": {
|
|
2282
|
+
"type": "opencollective",
|
|
2283
|
+
"url": "https://opencollective.com/node-fetch"
|
|
2258
2284
|
}
|
|
2259
2285
|
},
|
|
2260
2286
|
"node_modules/has-flag": {
|
package/logo.png
ADDED
|
Binary file
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"exceljs": "^4.4.0",
|
|
11
11
|
"fast-json-stable-stringify": "^2.1.0",
|
|
12
12
|
"get-stream": "^9.0.1",
|
|
13
|
-
"googleapis": "^
|
|
13
|
+
"googleapis": "^161.0.0",
|
|
14
14
|
"got": "^14.4.7",
|
|
15
15
|
"into-stream": "^8.0.1",
|
|
16
16
|
"is": "^3.3.2",
|
|
@@ -66,14 +66,10 @@
|
|
|
66
66
|
"pub": "npm publish --access public"
|
|
67
67
|
},
|
|
68
68
|
"name": "@mcpher/gas-fakes",
|
|
69
|
-
"version": "1.1.
|
|
69
|
+
"version": "1.1.4",
|
|
70
70
|
"license": "MIT",
|
|
71
71
|
"main": "main.js",
|
|
72
72
|
"description": "A proof of concept implementation of Apps Script Environment on Node",
|
|
73
73
|
"repository": "github:brucemcpherson/gas-fakes",
|
|
74
|
-
"homepage": "https://ramblings.mcpher.com/a-proof-of-concept-implementation-of-apps-script-environment-on-node/"
|
|
75
|
-
"peerDependencies": {
|
|
76
|
-
"google-auth-library": ">=9.0.0",
|
|
77
|
-
"googleapis": ">=157.0.0"
|
|
78
|
-
}
|
|
74
|
+
"homepage": "https://ramblings.mcpher.com/a-proof-of-concept-implementation-of-apps-script-environment-on-node/"
|
|
79
75
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { format } from 'util';
|
|
2
2
|
import { Proxies } from '../../support/proxies.js';
|
|
3
|
-
import {
|
|
3
|
+
import { Syncit } from '../../support/syncit.js';
|
|
4
4
|
|
|
5
5
|
// --- Cloud Logging Integration ---
|
|
6
6
|
|
|
7
|
-
// Cloud Logging client instance.
|
|
8
|
-
export let cloudLog;
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
9
|
* @class
|
|
@@ -119,25 +117,6 @@ const writeToCloudOrConsole = (message, loggerInstance) => {
|
|
|
119
117
|
const scriptId = ScriptApp.getScriptId();
|
|
120
118
|
const userId = ScriptApp.__userId;
|
|
121
119
|
|
|
122
|
-
// Lazy-initialize the cloud logger if needed.
|
|
123
|
-
const initializeCloudLogging = () => {
|
|
124
|
-
if (cloudLog) return; // Already initialized.
|
|
125
|
-
try {
|
|
126
|
-
if (!projectId) {
|
|
127
|
-
throw new Error('Could not determine Google Cloud Project ID for logging.');
|
|
128
|
-
}
|
|
129
|
-
const logging = new Logging({ projectId });
|
|
130
|
-
cloudLog = logging.log(logName);
|
|
131
|
-
console.info(`gas-fakes: Cloud Logging is enabled, writing to log "${logName}".`);
|
|
132
|
-
} catch (err) {
|
|
133
|
-
console.warn(
|
|
134
|
-
`gas-fakes: Cloud Logging failed to initialize. ` +
|
|
135
|
-
'Falling back to console.log.',
|
|
136
|
-
err.message
|
|
137
|
-
);
|
|
138
|
-
cloudLog = null;
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
120
|
|
|
142
121
|
// Write to console if CONSOLE or BOTH is specified.
|
|
143
122
|
if (useConsoleLogging) {
|
|
@@ -151,10 +130,6 @@ const writeToCloudOrConsole = (message, loggerInstance) => {
|
|
|
151
130
|
|
|
152
131
|
// Write to Cloud Logging if CLOUD or BOTH is specified and client is ready.
|
|
153
132
|
if (useCloudLogging) {
|
|
154
|
-
// Initialize the cloud logger on the first use if it hasn't been already.
|
|
155
|
-
if (!cloudLog) {
|
|
156
|
-
initializeCloudLogging();
|
|
157
|
-
}
|
|
158
133
|
|
|
159
134
|
const metadata = {
|
|
160
135
|
// Use the 'global' resource type, which is a generic fallback for applications
|
|
@@ -168,10 +143,6 @@ const writeToCloudOrConsole = (message, loggerInstance) => {
|
|
|
168
143
|
severity: 'INFO',
|
|
169
144
|
};
|
|
170
145
|
|
|
171
|
-
// Use log.write which returns a promise. T
|
|
172
|
-
// his allows us to catch errors, such as a disabled API or permission issues.
|
|
173
|
-
// however we are firing and forgetting so an error might appear later on in execution
|
|
174
|
-
if (cloudLog) {
|
|
175
146
|
// filter on user/script/priject and run times
|
|
176
147
|
// we'll extend the end date filter to a little more than now
|
|
177
148
|
const aLittleMore = 7 * 1000
|
|
@@ -201,7 +172,6 @@ const writeToCloudOrConsole = (message, loggerInstance) => {
|
|
|
201
172
|
// E. Assemble the final URL
|
|
202
173
|
loggerInstance.__cloudLogLink = base + encodedQueryParam + `?project=${projectId}`;
|
|
203
174
|
// fire and forget
|
|
204
|
-
|
|
205
|
-
}
|
|
175
|
+
Syncit.fxLogger({ logName, metadata })
|
|
206
176
|
}
|
|
207
177
|
};
|
package/src/support/auth.js
CHANGED
|
@@ -64,20 +64,27 @@ const isTokenExpired = () => !_accessToken || !_tokenExpiresAt || Date.now() >=
|
|
|
64
64
|
|
|
65
65
|
const setAuth = async (scopes = [], keyFile = null) => {
|
|
66
66
|
if (!hasAuth() || !scopes.every(s => _authScopes.has(s))) {
|
|
67
|
-
syncLog(`...initializing auth and discovering project ID
|
|
68
|
-
|
|
67
|
+
syncLog(`...initializing auth and discovering project ID`);
|
|
68
|
+
// First auth is just to get the project ID.
|
|
69
|
+
const initialAuth = new GoogleAuth({
|
|
69
70
|
keyFile,
|
|
70
|
-
scopes,
|
|
71
|
-
// projectId is not needed; it will be discovered automatically.
|
|
71
|
+
scopes: ['https://www.googleapis.com/auth/cloud-platform'], // Minimal scope
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
// Discover and cache the project ID. This also serves as validation.
|
|
75
|
-
_projectId = await
|
|
75
|
+
_projectId = await initialAuth.getProjectId();
|
|
76
76
|
if (!_projectId) {
|
|
77
77
|
throw new Error('Failed to get project ID from Application Default Credentials.');
|
|
78
78
|
}
|
|
79
79
|
syncLog(`...discovered and set projectId to ${_projectId}`);
|
|
80
80
|
|
|
81
|
+
// Now, create the *real* auth client with the projectId and all required scopes.
|
|
82
|
+
_auth = new GoogleAuth({
|
|
83
|
+
keyFile,
|
|
84
|
+
scopes,
|
|
85
|
+
projectId: _projectId,
|
|
86
|
+
});
|
|
87
|
+
|
|
81
88
|
scopes.forEach(s => _authScopes.add(s));
|
|
82
89
|
}
|
|
83
90
|
return getAuth();
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
//import { syncError, syncLog } from './workersync/synclogger.js';
|
|
3
|
+
import { Logging } from '@google-cloud/logging';
|
|
4
|
+
import { syncError, syncLog } from './workersync/synclogger.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* sync a call to logger api
|
|
8
|
+
* @param {import('./auth.js').Auth} Auth an auth object
|
|
9
|
+
* @param {object} p pargs
|
|
10
|
+
* @param {string} p.logName the cloud log file name
|
|
11
|
+
* @param {string} p.metadata the entry metadata
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export const sxLogger = async (Auth , { logName, metadata }) => {
|
|
15
|
+
const keyFile = Auth.getAdcPath()
|
|
16
|
+
const projectId = Auth.getProjectId();
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
// Let the Logging client handle its own authentication by providing it
|
|
20
|
+
// with the three essential pieces of information. This is the most robust
|
|
21
|
+
// and idiomatic approach.
|
|
22
|
+
const logging = new Logging({
|
|
23
|
+
projectId, // The Logging client needs the projectId at the top level.
|
|
24
|
+
});
|
|
25
|
+
let response;
|
|
26
|
+
let error;
|
|
27
|
+
|
|
28
|
+
const cloudlog = logging.log(logName)
|
|
29
|
+
try {
|
|
30
|
+
response = await cloudlog.write(cloudlog.entry(metadata))
|
|
31
|
+
} catch (err) {
|
|
32
|
+
error = err;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
if (error) {
|
|
37
|
+
syncError(`Failed in to write to cloudlog ${logName}`, error);
|
|
38
|
+
return { data: null, response: error.message }
|
|
39
|
+
}
|
|
40
|
+
return { data: response };
|
|
41
|
+
}
|
package/src/support/syncit.js
CHANGED
|
@@ -295,7 +295,7 @@ const fxInit = ({
|
|
|
295
295
|
Auth.setProjectId(projectId);
|
|
296
296
|
//Auth.setAuth(scopes)
|
|
297
297
|
Auth.setTokenInfo(tokenInfo);
|
|
298
|
-
|
|
298
|
+
Auth.setAdcPath(adcPath)
|
|
299
299
|
//Auth.setAccessToken(accessToken)
|
|
300
300
|
Auth.setSettings(settings);
|
|
301
301
|
Auth.setClasp(clasp);
|
|
@@ -384,6 +384,7 @@ const fxGmail = (args) =>
|
|
|
384
384
|
});
|
|
385
385
|
|
|
386
386
|
const fxGetImagesFromXlsx = (args) => callSync("sxGetImagesFromXlsx", args);
|
|
387
|
+
const fxLogger = ({metadata, logName}) => callSync("sxLogger", {metadata, logName});
|
|
387
388
|
|
|
388
389
|
export const Syncit = {
|
|
389
390
|
fxFetch,
|
|
@@ -402,4 +403,5 @@ export const Syncit = {
|
|
|
402
403
|
fxForms,
|
|
403
404
|
fxGmail,
|
|
404
405
|
fxGetImagesFromXlsx,
|
|
406
|
+
fxLogger
|
|
405
407
|
};
|