@gapi/gcli 1.8.133 → 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.133",
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
@@ -475,6 +475,10 @@ scaleOptions {
475
475
  maxScale
476
476
  targetCpu
477
477
  executorType
478
+ idleTimeout
479
+ concurrency
480
+ functionTimeout
481
+ specializationTimeout
478
482
  }
479
483
  `;
480
484
 
@@ -15502,6 +15506,7 @@ exports.createOrUpdateLambda = (cmd, type) => helpers_1.parseProjectId(cmd.proje
15502
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 }))))
15503
15507
  .toPromise();
15504
15508
  })), operators_1.switchMap((payload) => __awaiter(void 0, void 0, void 0, function* () {
15509
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
15505
15510
  return gql_client_1.GraphqlClienAPI[type]({
15506
15511
  code: cmd.code ||
15507
15512
  (yield ReadFile(payload.file || cmd.file).toPromise()) ||
@@ -15521,15 +15526,22 @@ exports.createOrUpdateLambda = (cmd, type) => helpers_1.parseProjectId(cmd.proje
15521
15526
  params: cmd.params || payload.params || [],
15522
15527
  secret: cmd.secret || payload.secret || '',
15523
15528
  customUploadFileId: cmd.customUploadFileId || payload.customUploadFileId || '',
15524
- scaleOptions: payload.scaleOptions || {
15525
- executorType: 'POOLMGR',
15526
- maxCpu: 0,
15527
- maxMemory: 0,
15528
- maxScale: 0,
15529
- minCpu: 0,
15530
- minMemory: 0,
15531
- minScale: 0,
15532
- targetCpu: 0,
15529
+ scaleOptions: {
15530
+ executorType: cmd.executorType || ((_a = payload.scaleOptions) === null || _a === void 0 ? void 0 : _a.executorType) ||
15531
+ 'POOLMGR',
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) ||
15542
+ 60,
15543
+ specializationTimeout: cmd.specializationTimeout || ((_m = payload.scaleOptions) === null || _m === void 0 ? void 0 : _m.specializationTimeout) ||
15544
+ 120,
15533
15545
  },
15534
15546
  }).toPromise();
15535
15547
  })), operators_1.tap((data) => {
@@ -44617,23 +44629,26 @@ function gql(...args) {
44617
44629
  exports.gql = gql;
44618
44630
  class GraphqlClienAPI {
44619
44631
  static query({ query, variables, }) {
44620
- return this.getConfig().pipe(operators_1.switchMap(({ token, url }) => rxjs_1.from(fetch(url, {
44621
- method: 'POST',
44622
- headers: {
44623
- 'Content-Type': 'application/json',
44624
- authorization: token,
44625
- Accept: 'application/json',
44626
- },
44627
- body: JSON.stringify({ query, variables }),
44628
- })).pipe(operators_1.switchMap((res) => res.json()), operators_1.map(({ data, errors }) => {
44629
- if (errors === null || errors === void 0 ? void 0 : errors.length) {
44630
- throw new Error(JSON.stringify(errors, null, 2));
44631
- }
44632
- if (!data) {
44633
- throw new Error('missing-entry');
44634
- }
44635
- return data;
44636
- }))));
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
+ }));
44637
44652
  }
44638
44653
  static getLambda(lambdaId, fragments) {
44639
44654
  return this.query({
@@ -64892,20 +64907,73 @@ function registerLambdaCommands(program) {
64892
64907
  .pipe(operators_1.map((m) => m.default))
64893
64908
  .toPromise()));
64894
64909
  const createOrUpdateOptions = [
64895
- ['--name <name>', 'lambda name'],
64896
- ['--project <project>', 'lambda project'],
64897
- ['--env <env>', 'lambda project'],
64898
- ['--method <method>', 'lambda project'],
64899
- ['--spec <spec>', 'lambda project'],
64900
- ['--packageJson <packageJson>', 'lambda project'],
64901
- ['--package <package>', 'lambda project'],
64902
- ['--buildBashScript <buildBashScript>', 'lambda project'],
64903
- ['--script <script>', 'lambda project'],
64904
- ['--params <params>', 'lambda project'],
64905
- ['--route <route>', 'lambda project'],
64906
- ['--code <code>', 'lambda project'],
64907
- ['--file <file>', 'lambda project'],
64908
- ['--secret <secret>', 'lambda project'],
64910
+ ['--name <name>', 'Function name'],
64911
+ ['--project <project>', 'Project in which this lambda is defined'],
64912
+ ['--env <env>', 'Environment name for function can be NODEJS'],
64913
+ [
64914
+ '--method <method>',
64915
+ 'HTTP Methods: GET,POST,PUT,DELETE,HEAD. To mention single method',
64916
+ ],
64917
+ ['--spec <spec>', 'Spec file yml or json path'],
64918
+ ['--packageJson <packageJson>', 'Define packageJson in string format'],
64919
+ ['--package <package>', 'Path to package.json'],
64920
+ [
64921
+ '--buildBashScript <buildBashScript>',
64922
+ 'Package build command for builder to run with',
64923
+ ],
64924
+ ['--script <script>', 'Package build script path'],
64925
+ ['--params <params>', 'Array from strings which defines route params'],
64926
+ ['--route <route>', 'Lambda route in which will be accessible'],
64927
+ ['--code <code>', 'URL or local path for single file source code'],
64928
+ ['--file <file>', 'Main lambda file'],
64929
+ [
64930
+ '--executorType <executorType>',
64931
+ "Executor type for execution; one of 'poolmgr', 'newdeploy'",
64932
+ ],
64933
+ [
64934
+ '--maxCpu <maxCpu>',
64935
+ 'Maximum CPU to be assigned to pod (In millicore, minimum 1)',
64936
+ ],
64937
+ [
64938
+ '--minCpu <minCpu>',
64939
+ 'Minimum CPU to be assigned to pod (In millicore, minimum 1)',
64940
+ ],
64941
+ [
64942
+ '--maxMemory <maxMemory>',
64943
+ 'Maximum memory to be assigned to pod (In megabyte)',
64944
+ ],
64945
+ [
64946
+ '--minMemory <minMemory>',
64947
+ 'Minimum memory to be assigned to pod (In megabyte)',
64948
+ ],
64949
+ [
64950
+ '--minScale <minScale>',
64951
+ 'Minimum number of pods (Uses resource inputs to configure HPA)',
64952
+ ],
64953
+ [
64954
+ '--maxScale <maxScale>',
64955
+ 'Maximum number of pods (Uses resource inputs to configure HPA)',
64956
+ ],
64957
+ [
64958
+ '--targetCpu <targetCpu>',
64959
+ 'Target average CPU usage percentage across pods for scaling',
64960
+ ],
64961
+ [
64962
+ '--idleTimeout <idleTimeout>',
64963
+ 'The length of time (in seconds) that a function is idle before pod(s) are eligible for recycling',
64964
+ ],
64965
+ [
64966
+ '--concurrency <concurrency>',
64967
+ 'Maximum number of pods specialized concurrently to serve requests',
64968
+ ],
64969
+ [
64970
+ '--functionTimeout <functionTimeout>',
64971
+ 'Maximum time for a request to wait for the response from the function',
64972
+ ],
64973
+ [
64974
+ '--specializationTimeout <specializationTimeout>',
64975
+ 'Timeout for executor to wait for function pod creation',
64976
+ ],
64909
64977
  ];
64910
64978
  helpers_2.createCommand('lambda:create')(createOrUpdateOptions)(program).action(helpers_1.lazy(() => rxjs_1.from(Promise.resolve().then(() => __webpack_require__(520)))
64911
64979
  .pipe(operators_1.map((m) => m.default))