@anchan828/nest-cloud-run-queue-tasks-publisher 3.3.6 → 3.4.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.
@@ -12,5 +12,6 @@ export type TasksPublisherModuleOptionsFactory = ModuleOptionsFactory<TasksPubli
12
12
  export type PublishConfig = Omit<google.cloud.tasks.v2.ITask, "name">;
13
13
  export type PublishOptions = {
14
14
  queue?: string;
15
+ deduplicationId?: string;
15
16
  } & PublishConfig;
16
17
  export type PublishData<T> = Message<T>;
@@ -25,9 +25,11 @@ let TasksPublisherService = class TasksPublisherService {
25
25
  const taskMessage = this.options.extraConfig?.prePublish
26
26
  ? await this.options.extraConfig?.prePublish(message)
27
27
  : message;
28
+ const queue = options?.queue || this.options.queue;
28
29
  const [task] = await this.client.createTask({
29
- parent: options?.queue || this.options.queue,
30
+ parent: queue,
30
31
  task: {
32
+ name: options?.deduplicationId ? `${queue}/tasks/${options.deduplicationId}` : undefined,
31
33
  ...this.options.publishConfig,
32
34
  ...options,
33
35
  httpRequest: {
@@ -12,5 +12,6 @@ export type TasksPublisherModuleOptionsFactory = ModuleOptionsFactory<TasksPubli
12
12
  export type PublishConfig = Omit<google.cloud.tasks.v2.ITask, "name">;
13
13
  export type PublishOptions = {
14
14
  queue?: string;
15
+ deduplicationId?: string;
15
16
  } & PublishConfig;
16
17
  export type PublishData<T> = Message<T>;
@@ -22,9 +22,11 @@ let TasksPublisherService = class TasksPublisherService {
22
22
  const taskMessage = this.options.extraConfig?.prePublish
23
23
  ? await this.options.extraConfig?.prePublish(message)
24
24
  : message;
25
+ const queue = options?.queue || this.options.queue;
25
26
  const [task] = await this.client.createTask({
26
- parent: options?.queue || this.options.queue,
27
+ parent: queue,
27
28
  task: {
29
+ name: options?.deduplicationId ? `${queue}/tasks/${options.deduplicationId}` : undefined,
28
30
  ...this.options.publishConfig,
29
31
  ...options,
30
32
  httpRequest: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anchan828/nest-cloud-run-queue-tasks-publisher",
3
- "version": "3.3.6",
3
+ "version": "3.4.0",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "https://github.com/anchan828/nest-cloud-run-queue/tree/master/packages/pubsub-publish#readme",
6
6
  "bugs": {
@@ -33,7 +33,7 @@
33
33
  "watch": "tsc -w"
34
34
  },
35
35
  "dependencies": {
36
- "@anchan828/nest-cloud-run-queue-common": "^3.3.6",
36
+ "@anchan828/nest-cloud-run-queue-common": "^3.4.0",
37
37
  "@google-cloud/tasks": "^5.5.1"
38
38
  },
39
39
  "devDependencies": {
@@ -61,5 +61,5 @@
61
61
  "default": "./dist/cjs/index.js"
62
62
  }
63
63
  },
64
- "gitHead": "e8200936941aecad20dbbb76b72b117e778d17f0"
64
+ "gitHead": "608359b5d1c860de0d79b3384dc9600a28217cdf"
65
65
  }