gcf-common-lib 0.13.0 → 0.13.3

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 (3) hide show
  1. package/index.js +3 -9
  2. package/index.ts +3 -9
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -50,26 +50,20 @@ class GcfCommon {
50
50
  stack: err.stack,
51
51
  },
52
52
  };
53
- const attr = {
54
- error: {
55
- name: err.name,
56
- message: `GCF [${fname}]: ${err.message}`,
57
- },
58
- };
59
- yield this.publish(event, context, response, attr).catch(noop_1.default);
53
+ yield this.publish(event, context, response, { error: '1' }).catch(noop_1.default);
60
54
  throw err;
61
55
  }));
62
56
  });
63
57
  }
64
58
  static publish(event, context, json, attributes) {
65
- var _a, _b;
59
+ var _a, _b, _c;
66
60
  return __awaiter(this, void 0, void 0, function* () {
67
61
  const topic = yield this.getTopic(event, context);
68
62
  console.log('publish:', topic === null || topic === void 0 ? void 0 : topic.name, json);
69
63
  if (topic) {
70
64
  return yield topic.publishMessage({
71
65
  json,
72
- attributes: Object.assign(Object.assign({}, attributes), { requestId: (_b = (_a = event) === null || _a === void 0 ? void 0 : _a.attributes) === null || _b === void 0 ? void 0 : _b.requestId, type: 'response', response: true }),
66
+ attributes: Object.assign(Object.assign({}, attributes), { requestId: (_c = (_b = (_a = event) === null || _a === void 0 ? void 0 : _a.attributes) === null || _b === void 0 ? void 0 : _b.requestId) !== null && _c !== void 0 ? _c : '', type: 'response', response: '1' }),
73
67
  });
74
68
  }
75
69
  });
package/index.ts CHANGED
@@ -89,13 +89,7 @@ export class GcfCommon {
89
89
  stack: err.stack,
90
90
  },
91
91
  };
92
- const attr = {
93
- error: {
94
- name: err.name,
95
- message: `GCF [${fname}]: ${err.message}`,
96
- },
97
- };
98
- await this.publish(event, context, response, attr).catch(noop);
92
+ await this.publish(event, context, response, {error: '1'}).catch(noop);
99
93
  throw err;
100
94
  })
101
95
  ;
@@ -110,9 +104,9 @@ export class GcfCommon {
110
104
  json,
111
105
  attributes: {
112
106
  ...attributes,
113
- requestId: (event as TPSEvent)?.attributes?.requestId,
107
+ requestId: (event as TPSEvent)?.attributes?.requestId ?? '',
114
108
  type: 'response',
115
- response: true,
109
+ response: '1',
116
110
  },
117
111
  });
118
112
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gcf-common-lib",
3
3
  "description": "",
4
- "version": "0.13.0",
4
+ "version": "0.13.3",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "branches": [