gcf-common-lib 0.17.0 → 0.19.0

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/index.ts CHANGED
@@ -5,6 +5,7 @@ import fromPairs from "lodash/fromPairs";
5
5
  import isEmpty from "lodash/isEmpty";
6
6
  import noop from "lodash/noop";
7
7
  import {timeoutAfter} from "./utils";
8
+ import Dict = NodeJS.Dict;
8
9
 
9
10
  export type TGSEvent = {
10
11
  bucket: string;
@@ -41,7 +42,7 @@ export type TPSEvent = {
41
42
  requestId: string,
42
43
  env: string,
43
44
  };
44
- data?: string | { [k: string]: any };
45
+ data?: string | Dict<any>;
45
46
  }
46
47
 
47
48
  export type TEvent = TGSEvent | TPSEvent;
@@ -58,6 +59,7 @@ export type TContext = {
58
59
  }
59
60
 
60
61
  export type TResponse = {
62
+ [prop: string]: any,
61
63
  error?: {
62
64
  name: string,
63
65
  message: string,
@@ -78,7 +80,7 @@ export class GcfCommon {
78
80
  * @param handler
79
81
  * @param timeout Seconds
80
82
  */
81
- static async process<T>(
83
+ static async process<T extends TResponse>(
82
84
  event: TEvent,
83
85
  context: TContext,
84
86
  handler: (event: TEvent, context: TContext) => Promise<T>,
@@ -106,7 +108,7 @@ export class GcfCommon {
106
108
  });
107
109
  }
108
110
 
109
- static async publish(event: TEvent, context: TContext, json?: TResponse, attributes?: { [k: string]: any }) {
111
+ static async publish(event: TEvent, context: TContext, json?: TResponse, attributes?: Dict<any>) {
110
112
  const {topic, requestId, env} = await this.getTopic(event, context);
111
113
  console.log('publish:', topic, env, json, attributes);
112
114
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gcf-common-lib",
3
3
  "description": "",
4
- "version": "0.17.0",
4
+ "version": "0.19.0",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "branches": [
@@ -20,14 +20,15 @@
20
20
  "url": "https://github.com/TopTechnologies/gcf-common.git"
21
21
  },
22
22
  "dependencies": {
23
- "@google-cloud/pubsub": "^2.19.4",
24
- "@google-cloud/secret-manager": "^3.12.0",
25
- "@google-cloud/storage": "^5.19.4",
23
+ "@google-cloud/pubsub": "^3.2.0",
24
+ "@google-cloud/secret-manager": "^4.1.3",
25
+ "@google-cloud/storage": "^6.5.2",
26
26
  "lodash": "^4.17.21"
27
27
  },
28
28
  "devDependencies": {
29
- "@tsconfig/node14": "^1.0.1",
30
- "@types/lodash": "^4.14.182"
29
+ "@tsconfig/node14": "^1.0.3",
30
+ "@types/node": "^14.18.32",
31
+ "@types/lodash": "^4.14.186"
31
32
  },
32
33
  "author": "alert83@gmail.com",
33
34
  "license": "MIT"
package/tsconfig.json CHANGED
@@ -2,7 +2,6 @@
2
2
  "$schema": "http://json.schemastore.org/tsconfig",
3
3
  "extends": "@tsconfig/node14/tsconfig.json",
4
4
  "compilerOptions": {
5
- "moduleResolution": "node",
6
5
  "target": "ES6",
7
6
  "lib": [
8
7
  "ES2018",
package/utils.js CHANGED
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.A1ToColNum = exports.A1ToIndex = exports.colNumToA1 = exports.indexToA1 = exports.timeoutAfter = void 0;
12
+ exports.A1ToColNum = exports.colNumToA1 = exports.A1ToIndex = exports.indexToA1 = exports.timeoutAfter = void 0;
13
13
  /**
14
14
  *
15
15
  * @param seconds Google function timeout limit (max: 9 min)
@@ -29,6 +29,10 @@ function indexToA1(idx) {
29
29
  return colNumToA1(idx + 1);
30
30
  }
31
31
  exports.indexToA1 = indexToA1;
32
+ function A1ToIndex(value) {
33
+ return A1ToColNum(value) - 1;
34
+ }
35
+ exports.A1ToIndex = A1ToIndex;
32
36
  function colNumToA1(columnNumber) {
33
37
  const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
34
38
  // To store result (Excel column name)
@@ -51,10 +55,6 @@ function colNumToA1(columnNumber) {
51
55
  return charIdxArr.reverse().map((n) => chars[n]).join('');
52
56
  }
53
57
  exports.colNumToA1 = colNumToA1;
54
- function A1ToIndex(value) {
55
- return A1ToColNum(value) - 1;
56
- }
57
- exports.A1ToIndex = A1ToIndex;
58
58
  function A1ToColNum(value) {
59
59
  const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
60
60
  let result = 0;
package/utils.ts CHANGED
@@ -16,6 +16,10 @@ export function indexToA1(idx: number) {
16
16
  return colNumToA1(idx + 1);
17
17
  }
18
18
 
19
+ export function A1ToIndex(value: string) {
20
+ return A1ToColNum(value) - 1;
21
+ }
22
+
19
23
  export function colNumToA1(columnNumber: number) {
20
24
  const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
21
25
 
@@ -41,10 +45,6 @@ export function colNumToA1(columnNumber: number) {
41
45
  return charIdxArr.reverse().map((n) => chars[n]).join('');
42
46
  }
43
47
 
44
- export function A1ToIndex(value: string) {
45
- return A1ToColNum(value) - 1;
46
- }
47
-
48
48
  export function A1ToColNum(value: string) {
49
49
  const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
50
50
  let result = 0;