playov2-js-utilities 0.3.13 → 0.3.16

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.
@@ -14,8 +14,6 @@ const client = new CloudTasksClient();
14
14
  const PROJECT = process.env.GCP_PROJECT;
15
15
  const LOCATION = process.env.GCP_LOCATION;
16
16
 
17
- const MAX_HTTP_TASK_TTL = 1800000 // milliseconds - half an hour
18
-
19
17
  if (!PROJECT || !LOCATION) {
20
18
  console.warn('You need to pass - GCP_PROJECT, GCP_LOCATION in env for message queue to work!');
21
19
  }
@@ -27,6 +25,7 @@ if (!PROJECT || !LOCATION) {
27
25
  * url: String,
28
26
  * headers: Object,
29
27
  * body: Object, // not needed if GET request
28
+ * ttl: Optional, date in utc format, consumer will check if the ttl has been exceeded or not and then will respond accordingly
30
29
  * ...
31
30
  *
32
31
  * }
@@ -34,10 +33,9 @@ if (!PROJECT || !LOCATION) {
34
33
  * delay
35
34
  * }
36
35
  * @param {String} taskId -used as de-duplication key
37
- * @param {Date} ttl - utc date format
38
36
  * @param {String} requestId
39
37
  */
40
- async function createHttpTask(queueId, payload, messageProcessingProperties, taskId, ttl, requestId) {
38
+ async function createHttpTask(queueId, payload, messageProcessingProperties, taskId, requestId) {
41
39
 
42
40
  try {
43
41
  const project = PROJECT;
@@ -55,8 +53,6 @@ async function createHttpTask(queueId, payload, messageProcessingProperties, tas
55
53
 
56
54
  task.name = getTaskId(project, location, queue, taskId);
57
55
 
58
- task.dispatchDeadline = _getHTTPTaskTTL(ttl); // nano seconds
59
-
60
56
  if (payload.body) {
61
57
  task.httpRequest.body = Buffer.from(payload.body).toString('base64');
62
58
  }
@@ -91,23 +87,6 @@ const getTaskId = (projectId, locationId, queueId, taskId = uuidv4()) => {
91
87
  return `projects/${projectId}/locations/${locationId}/queues/${queueId}/tasks/${taskId}`;
92
88
  };
93
89
 
94
- /**
95
- * Returns ttl for http tasks in nanoseconds
96
- * https://cloud.google.com/tasks/docs/reference/rest/v2beta3/projects.locations.queues.tasks#resource:-task
97
- * @param {Date} ttl
98
- */
99
- const _getHTTPTaskTTL = (ttl) => {
100
-
101
- const currentTimestamp = new Date().getTime()
102
- const providedTTLTimestamp = new Date(ttl).getTime();
103
-
104
- if (providedTTLTimestamp > currentTimestamp) {
105
- return Math.min(providedTTLTimestamp, MAX_HTTP_TASK_TTL) * 1000000
106
- }
107
-
108
- return MAX_HTTP_TASK_TTL * 1000000;
109
- }
110
-
111
90
  module.exports = {
112
91
  createHttpTask,
113
92
  getTaskId
@@ -163,7 +163,7 @@ const config = {
163
163
  target: "group",
164
164
  path: "board",
165
165
  title: "Group Update",
166
- type: ["drawer","push"],
166
+ type: ["drawer", "push"],
167
167
  buttons: [],
168
168
  android_channel_id: notificationChannels.group_updates
169
169
  },
@@ -435,11 +435,11 @@ const config = {
435
435
  buttons: [],
436
436
  android_channel_id: notificationChannels.activity_query
437
437
  },
438
- [notificationIds.ACTIVITY_REMINDER] : {
438
+ [notificationIds.ACTIVITY_REMINDER]: {
439
439
  category: notificationCategories.ACTIVITY,
440
440
  target: "match",
441
441
  title: "Activity Reminder",
442
- type: ["push", "drawer"],
442
+ type: ["push"],
443
443
  buttons: [],
444
444
  android_channel_id: notificationChannels.activity_reminders
445
445
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playov2-js-utilities",
3
- "version": "0.3.13",
3
+ "version": "0.3.16",
4
4
  "description": "Private package for JS utility functions",
5
5
  "main": "index.js",
6
6
  "scripts": {