@gapi/gcli 1.8.137 → 1.8.139

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
@@ -17,7 +17,7 @@ npm i -g @gapi/gcli
17
17
  ### Login
18
18
 
19
19
  ```bash
20
- gcli login --token 'GRAPHQL_TOKEN' --key 'GOOGLE_API_KEY' --url 'URL' --uploadUrl 'UPLOAD_URL
20
+ gcli login --token 'GRAPHQL_TOKEN' --key 'GOOGLE_API_KEY' --url 'URL' --uploadUrl 'UPLOAD_URL'
21
21
  ```
22
22
 
23
23
  ### List Projects
@@ -123,8 +123,8 @@ gcli lambda:test --queryParams '?test=1&proba=1&dada=5' --pathParams 'proba=5;te
123
123
 
124
124
  #### Default long lived token for CI/CD using github actions
125
125
 
126
- Can be set using environment variable called `GCLI_AUTH_TOKEN`
126
+ Can be set using secret variable called `GCLI_AUTH_TOKEN`
127
127
 
128
128
  ```
129
- export GCLI_AUTH_TOKEN='my-generated-token'
129
+ npx gcli login --ci --token ${{ secrets.GCLI_AUTH_TOKEN }} --key '' --url '' --uploadUrl ''
130
130
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gapi/gcli",
3
- "version": "1.8.137",
3
+ "version": "1.8.139",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Stradivario/gapi.git"
package/release/index.js CHANGED
@@ -15476,7 +15476,6 @@ exports.createOrUpdateLambda = (cmd, type) => helpers_1.parseProjectId(cmd.proje
15476
15476
  .pipe(operators_1.switchMap((projectId) => gql_client_1.GraphqlClienAPI.getProject(projectId).pipe(operators_1.map(() => projectId))), operators_1.switchMap((projectId) => __awaiter(void 0, void 0, void 0, function* () {
15477
15477
  return (Object.assign({ projectId }, (yield load_spec_1.loadSpec(cmd.spec).toPromise())));
15478
15478
  })), operators_1.switchMap((data) => __awaiter(void 0, void 0, void 0, function* () {
15479
- var _a;
15480
15479
  if (!data.uploadAsZip) {
15481
15480
  return Object.assign(Object.assign({}, data), { customUploadFileId: '' });
15482
15481
  }
@@ -15502,12 +15501,12 @@ exports.createOrUpdateLambda = (cmd, type) => helpers_1.parseProjectId(cmd.proje
15502
15501
  return rxjs_1.from(fetch(config.uploadUrl, {
15503
15502
  method: 'POST',
15504
15503
  body: body,
15505
- headers: Object.assign(Object.assign({}, body.getHeaders()), { Authorization: (_a = process.env.GCLI_AUTH_TOKEN) !== null && _a !== void 0 ? _a : config.token, projectid: data.projectId, lambdaname: data.name }),
15504
+ headers: Object.assign(Object.assign({}, body.getHeaders()), { Authorization: config.token, projectid: data.projectId, lambdaname: data.name }),
15506
15505
  }))
15507
15506
  .pipe(operators_1.switchMap((res) => res.json()), operators_1.tap((res) => console.log(res)), operators_1.map((file) => (Object.assign(Object.assign({}, data), { customUploadFileId: file.id }))))
15508
15507
  .toPromise();
15509
15508
  })), operators_1.switchMap((payload) => __awaiter(void 0, void 0, void 0, function* () {
15510
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
15509
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
15511
15510
  return gql_client_1.GraphqlClienAPI[type]({
15512
15511
  code: cmd.code ||
15513
15512
  (yield ReadFile(payload.file || cmd.file).toPromise()) ||
@@ -15528,20 +15527,20 @@ exports.createOrUpdateLambda = (cmd, type) => helpers_1.parseProjectId(cmd.proje
15528
15527
  secret: cmd.secret || payload.secret || '',
15529
15528
  customUploadFileId: cmd.customUploadFileId || payload.customUploadFileId || '',
15530
15529
  scaleOptions: {
15531
- executorType: cmd.executorType || ((_b = payload.scaleOptions) === null || _b === void 0 ? void 0 : _b.executorType) ||
15530
+ executorType: cmd.executorType || ((_a = payload.scaleOptions) === null || _a === void 0 ? void 0 : _a.executorType) ||
15532
15531
  'POOLMGR',
15533
- maxCpu: cmd.maxCpu || ((_c = payload.scaleOptions) === null || _c === void 0 ? void 0 : _c.maxCpu) || 0,
15534
- maxMemory: cmd.maxMemory || ((_d = payload.scaleOptions) === null || _d === void 0 ? void 0 : _d.maxMemory) || 0,
15535
- maxScale: cmd.maxScale || ((_e = payload.scaleOptions) === null || _e === void 0 ? void 0 : _e.maxScale) || 0,
15536
- minCpu: cmd.minCpu || ((_f = payload.scaleOptions) === null || _f === void 0 ? void 0 : _f.minCpu) || 0,
15537
- minMemory: cmd.minMemory || ((_g = payload.scaleOptions) === null || _g === void 0 ? void 0 : _g.minMemory) || 0,
15538
- minScale: cmd.minScale || ((_h = payload.scaleOptions) === null || _h === void 0 ? void 0 : _h.minScale) || 0,
15539
- targetCpu: cmd.targetCpu || ((_j = payload.scaleOptions) === null || _j === void 0 ? void 0 : _j.targetCpu) || 0,
15540
- idleTimeout: cmd.idleTimeout || ((_k = payload.scaleOptions) === null || _k === void 0 ? void 0 : _k.idleTimeout) || 120,
15541
- concurrency: cmd.concurrency || ((_l = payload.scaleOptions) === null || _l === void 0 ? void 0 : _l.concurrency) || 500,
15542
- functionTimeout: cmd.functionTimeout || ((_m = payload.scaleOptions) === null || _m === void 0 ? void 0 : _m.functionTimeout) ||
15532
+ maxCpu: cmd.maxCpu || ((_b = payload.scaleOptions) === null || _b === void 0 ? void 0 : _b.maxCpu) || 0,
15533
+ maxMemory: cmd.maxMemory || ((_c = payload.scaleOptions) === null || _c === void 0 ? void 0 : _c.maxMemory) || 0,
15534
+ maxScale: cmd.maxScale || ((_d = payload.scaleOptions) === null || _d === void 0 ? void 0 : _d.maxScale) || 0,
15535
+ minCpu: cmd.minCpu || ((_e = payload.scaleOptions) === null || _e === void 0 ? void 0 : _e.minCpu) || 0,
15536
+ minMemory: cmd.minMemory || ((_f = payload.scaleOptions) === null || _f === void 0 ? void 0 : _f.minMemory) || 0,
15537
+ minScale: cmd.minScale || ((_g = payload.scaleOptions) === null || _g === void 0 ? void 0 : _g.minScale) || 0,
15538
+ targetCpu: cmd.targetCpu || ((_h = payload.scaleOptions) === null || _h === void 0 ? void 0 : _h.targetCpu) || 0,
15539
+ idleTimeout: cmd.idleTimeout || ((_j = payload.scaleOptions) === null || _j === void 0 ? void 0 : _j.idleTimeout) || 120,
15540
+ concurrency: cmd.concurrency || ((_k = payload.scaleOptions) === null || _k === void 0 ? void 0 : _k.concurrency) || 500,
15541
+ functionTimeout: cmd.functionTimeout || ((_l = payload.scaleOptions) === null || _l === void 0 ? void 0 : _l.functionTimeout) ||
15543
15542
  60,
15544
- specializationTimeout: cmd.specializationTimeout || ((_o = payload.scaleOptions) === null || _o === void 0 ? void 0 : _o.specializationTimeout) ||
15543
+ specializationTimeout: cmd.specializationTimeout || ((_m = payload.scaleOptions) === null || _m === void 0 ? void 0 : _m.specializationTimeout) ||
15545
15544
  120,
15546
15545
  },
15547
15546
  }).toPromise();
@@ -16751,7 +16750,7 @@ function registerAuthCommands(program) {
16751
16750
  .description('Login to graphql-server')
16752
16751
  .option('-k, --key <key>', 'Specify api key')
16753
16752
  .option('-uu, --uploadUrl <key>', 'Specify upload server')
16754
- .option('-i, --integration <key>', 'Initialize directories for CI/CD purposes')
16753
+ .option('-ci, --ci', 'Initialize directories for CI/CD purposes')
16755
16754
  .option('-t, --token <token>', 'Specify custom token generated from the website')
16756
16755
  .option('-u, --url <url>', 'Specify api url')
16757
16756
  .action(helpers_1.lazy(() => Promise.resolve().then(() => __webpack_require__(875)).then((m) => m.default)));
@@ -44631,26 +44630,23 @@ function gql(...args) {
44631
44630
  exports.gql = gql;
44632
44631
  class GraphqlClienAPI {
44633
44632
  static query({ query, variables, }) {
44634
- return this.getConfig().pipe(operators_1.switchMap(({ token, url }) => {
44635
- var _a;
44636
- return rxjs_1.from(fetch(url, {
44637
- method: 'POST',
44638
- headers: {
44639
- 'Content-Type': 'application/json',
44640
- authorization: (_a = process.env.GCLI_AUTH_TOKEN) !== null && _a !== void 0 ? _a : token,
44641
- Accept: 'application/json',
44642
- },
44643
- body: JSON.stringify({ query, variables }),
44644
- })).pipe(operators_1.switchMap((res) => res.json()), operators_1.map(({ data, errors }) => {
44645
- if (errors === null || errors === void 0 ? void 0 : errors.length) {
44646
- throw new Error(JSON.stringify(errors, null, 2));
44647
- }
44648
- if (!data) {
44649
- throw new Error('missing-entry');
44650
- }
44651
- return data;
44652
- }));
44653
- }));
44633
+ return this.getConfig().pipe(operators_1.switchMap(({ token, url }) => rxjs_1.from(fetch(url, {
44634
+ method: 'POST',
44635
+ headers: {
44636
+ 'Content-Type': 'application/json',
44637
+ authorization: token,
44638
+ Accept: 'application/json',
44639
+ },
44640
+ body: JSON.stringify({ query, variables }),
44641
+ })).pipe(operators_1.switchMap((res) => res.json()), operators_1.map(({ data, errors }) => {
44642
+ if (errors === null || errors === void 0 ? void 0 : errors.length) {
44643
+ throw new Error(JSON.stringify(errors, null, 2));
44644
+ }
44645
+ if (!data) {
44646
+ throw new Error('missing-entry');
44647
+ }
44648
+ return data;
44649
+ }))));
44654
44650
  }
44655
44651
  static getLambda(lambdaId, fragments) {
44656
44652
  return this.query({
@@ -54515,14 +54511,14 @@ exports.default = (cmd) => rxjs_1.of(gql_client_1.GraphqlClienAPI.init(cmd.key))
54515
54511
  encoding: 'utf-8',
54516
54512
  }),
54517
54513
  ])))
54518
- .pipe(operators_1.switchMap(() => cmd.integration
54514
+ .pipe(operators_1.switchMap(() => cmd.ci
54519
54515
  ? rxjs_1.of({
54520
54516
  user: {
54521
54517
  displayName: 'Integration Account for CI/CD',
54522
54518
  email: 'support@graphql-server.com',
54523
54519
  },
54524
- refresh: '',
54525
- token: '',
54520
+ refresh: cmd.token,
54521
+ token: cmd.token,
54526
54522
  })
54527
54523
  : gql_client_1.GraphqlClienAPI.signIn(cmd.token).toPromise()), operators_1.switchMap(({ user, refresh, token }) => rxjs_1.combineLatest([
54528
54524
  util_1.promisify(fs_1.writeFile)(types_1.tokenDirectory, token, {