gcf-common-lib 0.25.50 → 0.25.51

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/types.ts +30 -30
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gcf-common-lib",
3
3
  "description": "",
4
- "version": "0.25.50",
4
+ "version": "0.25.51",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "branches": [
package/src/types.ts CHANGED
@@ -1,32 +1,6 @@
1
1
  import Dict = NodeJS.Dict;
2
2
 
3
- export type TMetadataOrAttributes = {
4
- topic?: string; // response PubSub topic [t_{GUID}__{YYYY-MM-DD}]
5
- exchange?: string; // response amqp exchange
6
- queue?: string; // response amqp queue
7
- //
8
- filename?: string;
9
- referer?: string;
10
- 'remote-address'?: string;
11
- 'upload-id'?: string;
12
- 'user-agent'?: string;
13
- timestamp?: string;
14
- //
15
- action?: string;
16
- pipeline?: string;
17
- options?: string;
18
- 'job-uid'?: string;
19
- 'user-id'?: string;
20
- 'tenant-id'?: string;
21
- //
22
- env?: string; // app environment
23
- appId?: string; // app id
24
- 'app-id'?: string; // app id
25
- requestId?: string; // for rpc response [GUID]
26
- 'request-id'?: string; // for rpc response [GUID]
27
- };
28
-
29
- export type TGSEvent = {
3
+ export type TGSEvent<M = TMetadataOrAttributes> = {
30
4
  bucket: string;
31
5
  contentType: string;
32
6
  crc32c: string;
@@ -36,7 +10,7 @@ export type TGSEvent = {
36
10
  kind: string; // 'storage#object'
37
11
  md5Hash: string;
38
12
  mediaLink: string;
39
- metadata: TMetadataOrAttributes;
13
+ metadata: M;
40
14
  metageneration: string;
41
15
  name: string;
42
16
  selfLink: string;
@@ -47,15 +21,41 @@ export type TGSEvent = {
47
21
  updated: string;
48
22
  };
49
23
 
50
- export type TPSEvent = {
24
+ export type TPSEvent<A = TMetadataOrAttributes> = {
51
25
  '@type': string; // 'type.googleapis.com/google.pubsub.v1.PubsubMessage'
52
- attributes?: TMetadataOrAttributes;
26
+ attributes?: A;
53
27
  data?: string;
54
28
  json?: Dict<any>;
55
29
  };
56
30
 
57
31
  export type TEvent = TGSEvent | TPSEvent;
58
32
 
33
+ export type TMetadataOrAttributes = {
34
+ topic?: string; // response PubSub topic [t_{GUID}__{YYYY-MM-DD}]
35
+ exchange?: string; // response amqp exchange
36
+ queue?: string; // response amqp queue
37
+ //
38
+ filename?: string;
39
+ referer?: string;
40
+ 'remote-address'?: string;
41
+ 'upload-id'?: string;
42
+ 'user-agent'?: string;
43
+ timestamp?: string;
44
+ //
45
+ action?: string;
46
+ pipeline?: string;
47
+ options?: string;
48
+ 'job-uid'?: string;
49
+ 'user-id'?: string;
50
+ 'tenant-id'?: string;
51
+ //
52
+ env?: string; // app environment
53
+ appId?: string; // app id
54
+ 'app-id'?: string; // app id
55
+ requestId?: string; // for rpc response [GUID]
56
+ 'request-id'?: string; // for rpc response [GUID]
57
+ };
58
+
59
59
  export type TContext = {
60
60
  eventId: string;
61
61
  timestamp: string;