gcf-common-lib 0.25.47 → 0.25.50

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gcf-common-lib",
3
3
  "description": "",
4
- "version": "0.25.47",
4
+ "version": "0.25.50",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "branches": [
package/src/types.ts CHANGED
@@ -24,8 +24,6 @@ export type TMetadataOrAttributes = {
24
24
  'app-id'?: string; // app id
25
25
  requestId?: string; // for rpc response [GUID]
26
26
  'request-id'?: string; // for rpc response [GUID]
27
-
28
- [prop: string]: any;
29
27
  };
30
28
 
31
29
  export type TGSEvent = {
@@ -51,8 +49,8 @@ export type TGSEvent = {
51
49
 
52
50
  export type TPSEvent = {
53
51
  '@type': string; // 'type.googleapis.com/google.pubsub.v1.PubsubMessage'
54
- attributes: TMetadataOrAttributes;
55
- data: string;
52
+ attributes?: TMetadataOrAttributes;
53
+ data?: string;
56
54
  json?: Dict<any>;
57
55
  };
58
56
 
package/src/utils.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Channel, ConfirmChannel, connect, Connection, Options } from 'amqplib';
2
2
  import Bluebird from 'bluebird';
3
3
  import { chain, Dictionary } from 'lodash';
4
+ import Dict = NodeJS.Dict;
4
5
 
5
6
  /**
6
7
  *
@@ -84,9 +85,9 @@ export function A1ToColNum(value: string) {
84
85
  return result;
85
86
  }
86
87
 
87
- export function safeJsonParse(value: string, fallbackValue?: any) {
88
+ export function safeJsonParse<T = Dict<any>>(value: string, fallbackValue?: T) {
88
89
  try {
89
- return JSON.parse(value);
90
+ return JSON.parse(value) as T;
90
91
  } catch (err) {
91
92
  return fallbackValue;
92
93
  }