@gapi/gcli 1.8.134 → 1.8.135

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 CHANGED
@@ -120,3 +120,11 @@ gcli lambda:get
120
120
  ```bash
121
121
  gcli lambda:test --queryParams '?test=1&proba=1&dada=5' --pathParams 'proba=5;test=7'
122
122
  ```
123
+
124
+ #### Default long lived token for CI/CD using github actions
125
+
126
+ Can be set using environment variable called `GCLI_AUTH_TOKEN`
127
+
128
+ ```
129
+ export GCLI_AUTH_TOKEN='my-generated-token'
130
+ ```
package/build.js ADDED
@@ -0,0 +1,21 @@
1
+ const dotenvLoad = require('dotenv-load');
2
+ dotenvLoad(process.env.NODE_ENV);
3
+
4
+ require('esbuild')
5
+ .build({
6
+ entryPoints: ['./src/main.ts'],
7
+ bundle: true,
8
+ platform: 'node',
9
+ target: 'node14.4',
10
+ outfile: './release/index.js',
11
+ define: {
12
+ 'process.env.MONGODB_URI': `'${process.env.MONGODB_URI}'`,
13
+ 'process.env.NODE_ENV': `'${process.env.NODE_ENV}'`,
14
+ 'process.env.PORT': `9000`,
15
+ },
16
+ })
17
+ .then((data) => console.log('SUCCESS', data))
18
+ .catch((e) => {
19
+ console.error(e);
20
+ process.exit(1);
21
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gapi/gcli",
3
- "version": "1.8.134",
3
+ "version": "1.8.135",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Stradivario/gapi.git"
@@ -15,6 +15,7 @@
15
15
  "lint-fix": "npx eslint . --fix --ext .ts",
16
16
  "build:release": "gapi build --single-executable && cp ./dist/gcli-linux ./release && cp ./dist/index.js ./release",
17
17
  "build": "echo BUILD",
18
+ "esbuild": "node build.js",
18
19
  "introspect": "gapi schema introspect --collect-documents --collect-types"
19
20
  },
20
21
  "author": {
@@ -59,7 +60,9 @@
59
60
  "node-fetch": "^2.1.2",
60
61
  "rxjs": "6.5.2",
61
62
  "stream-to-buffer": "^0.1.0",
62
- "@rxdi/compressor": "^0.7.136"
63
+ "@rxdi/compressor": "^0.7.136",
64
+ "dotenv-load": "^2.0.1",
65
+ "esbuild": "0.15.18"
63
66
  },
64
67
  "bin": {
65
68
  "gcli": "./release/index.js"
package/release/index.js CHANGED
@@ -44629,23 +44629,26 @@ function gql(...args) {
44629
44629
  exports.gql = gql;
44630
44630
  class GraphqlClienAPI {
44631
44631
  static query({ query, variables, }) {
44632
- return this.getConfig().pipe(operators_1.switchMap(({ token, url }) => rxjs_1.from(fetch(url, {
44633
- method: 'POST',
44634
- headers: {
44635
- 'Content-Type': 'application/json',
44636
- authorization: token,
44637
- Accept: 'application/json',
44638
- },
44639
- body: JSON.stringify({ query, variables }),
44640
- })).pipe(operators_1.switchMap((res) => res.json()), operators_1.map(({ data, errors }) => {
44641
- if (errors === null || errors === void 0 ? void 0 : errors.length) {
44642
- throw new Error(JSON.stringify(errors, null, 2));
44643
- }
44644
- if (!data) {
44645
- throw new Error('missing-entry');
44646
- }
44647
- return data;
44648
- }))));
44632
+ return this.getConfig().pipe(operators_1.switchMap(({ token, url }) => {
44633
+ var _a;
44634
+ return rxjs_1.from(fetch(url, {
44635
+ method: 'POST',
44636
+ headers: {
44637
+ 'Content-Type': 'application/json',
44638
+ authorization: (_a = process.env.GCLI_AUTH_TOKEN) !== null && _a !== void 0 ? _a : token,
44639
+ Accept: 'application/json',
44640
+ },
44641
+ body: JSON.stringify({ query, variables }),
44642
+ })).pipe(operators_1.switchMap((res) => res.json()), operators_1.map(({ data, errors }) => {
44643
+ if (errors === null || errors === void 0 ? void 0 : errors.length) {
44644
+ throw new Error(JSON.stringify(errors, null, 2));
44645
+ }
44646
+ if (!data) {
44647
+ throw new Error('missing-entry');
44648
+ }
44649
+ return data;
44650
+ }));
44651
+ }));
44649
44652
  }
44650
44653
  static getLambda(lambdaId, fragments) {
44651
44654
  return this.query({