@a2a-js/sdk 0.3.11 → 0.3.13
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/dist/{chunk-2TNRJNPO.js → chunk-5ONEQMOQ.js} +23 -0
- package/dist/client/index.js +1 -1
- package/dist/client/transports/grpc/index.js +1 -1
- package/dist/server/express/index.cjs +47 -117
- package/dist/server/express/index.js +27 -118
- package/dist/server/grpc/index.js +1 -1
- package/package.json +1 -1
|
@@ -1013,6 +1013,28 @@ var SendMessageRequest = {
|
|
|
1013
1013
|
return obj;
|
|
1014
1014
|
}
|
|
1015
1015
|
};
|
|
1016
|
+
var CreateTaskPushNotificationConfigRequest = {
|
|
1017
|
+
fromJSON(object) {
|
|
1018
|
+
return {
|
|
1019
|
+
parent: isSet(object.parent) ? globalThis.String(object.parent) : "",
|
|
1020
|
+
configId: isSet(object.configId) ? globalThis.String(object.configId) : isSet(object.config_id) ? globalThis.String(object.config_id) : "",
|
|
1021
|
+
config: isSet(object.config) ? TaskPushNotificationConfig.fromJSON(object.config) : void 0
|
|
1022
|
+
};
|
|
1023
|
+
},
|
|
1024
|
+
toJSON(message) {
|
|
1025
|
+
const obj = {};
|
|
1026
|
+
if (message.parent !== "") {
|
|
1027
|
+
obj.parent = message.parent;
|
|
1028
|
+
}
|
|
1029
|
+
if (message.configId !== "") {
|
|
1030
|
+
obj.configId = message.configId;
|
|
1031
|
+
}
|
|
1032
|
+
if (message.config !== void 0) {
|
|
1033
|
+
obj.config = TaskPushNotificationConfig.toJSON(message.config);
|
|
1034
|
+
}
|
|
1035
|
+
return obj;
|
|
1036
|
+
}
|
|
1037
|
+
};
|
|
1016
1038
|
var SendMessageResponse = {
|
|
1017
1039
|
fromJSON(object) {
|
|
1018
1040
|
return {
|
|
@@ -1978,6 +2000,7 @@ export {
|
|
|
1978
2000
|
AgentCard,
|
|
1979
2001
|
TaskPushNotificationConfig,
|
|
1980
2002
|
SendMessageRequest,
|
|
2003
|
+
CreateTaskPushNotificationConfigRequest,
|
|
1981
2004
|
SendMessageResponse,
|
|
1982
2005
|
StreamResponse,
|
|
1983
2006
|
ListTaskPushNotificationConfigResponse,
|
package/dist/client/index.js
CHANGED
|
@@ -575,23 +575,32 @@ var RestTransportHandler = class _RestTransportHandler {
|
|
|
575
575
|
async getAuthenticatedExtendedAgentCard(context) {
|
|
576
576
|
return this.requestHandler.getAuthenticatedExtendedAgentCard(context);
|
|
577
577
|
}
|
|
578
|
+
/**
|
|
579
|
+
* Validate MessageSendParams.
|
|
580
|
+
*/
|
|
581
|
+
validateMessageSendParams(params) {
|
|
582
|
+
if (!params.message) {
|
|
583
|
+
throw A2AError.invalidParams("message is required");
|
|
584
|
+
}
|
|
585
|
+
if (!params.message.messageId) {
|
|
586
|
+
throw A2AError.invalidParams("message.messageId is required");
|
|
587
|
+
}
|
|
588
|
+
}
|
|
578
589
|
/**
|
|
579
590
|
* Sends a message to the agent.
|
|
580
|
-
* Accepts both snake_case and camelCase input, returns camelCase.
|
|
581
591
|
*/
|
|
582
592
|
async sendMessage(params, context) {
|
|
583
|
-
|
|
584
|
-
return this.requestHandler.sendMessage(
|
|
593
|
+
this.validateMessageSendParams(params);
|
|
594
|
+
return this.requestHandler.sendMessage(params, context);
|
|
585
595
|
}
|
|
586
596
|
/**
|
|
587
597
|
* Sends a message with streaming response.
|
|
588
|
-
* Accepts both snake_case and camelCase input, returns camelCase stream.
|
|
589
598
|
* @throws {A2AError} UnsupportedOperation if streaming not supported
|
|
590
599
|
*/
|
|
591
600
|
async sendMessageStream(params, context) {
|
|
592
601
|
await this.requireCapability("streaming");
|
|
593
|
-
|
|
594
|
-
return this.requestHandler.sendMessageStream(
|
|
602
|
+
this.validateMessageSendParams(params);
|
|
603
|
+
return this.requestHandler.sendMessageStream(params, context);
|
|
595
604
|
}
|
|
596
605
|
/**
|
|
597
606
|
* Gets a task by ID.
|
|
@@ -623,13 +632,17 @@ var RestTransportHandler = class _RestTransportHandler {
|
|
|
623
632
|
}
|
|
624
633
|
/**
|
|
625
634
|
* Sets a push notification configuration.
|
|
626
|
-
* Accepts both snake_case and camelCase input, returns camelCase.
|
|
627
635
|
* @throws {A2AError} PushNotificationNotSupported if push notifications not supported
|
|
628
636
|
*/
|
|
629
637
|
async setTaskPushNotificationConfig(config, context) {
|
|
630
638
|
await this.requireCapability("pushNotifications");
|
|
631
|
-
|
|
632
|
-
|
|
639
|
+
if (!config.taskId) {
|
|
640
|
+
throw A2AError.invalidParams("taskId is required");
|
|
641
|
+
}
|
|
642
|
+
if (!config.pushNotificationConfig) {
|
|
643
|
+
throw A2AError.invalidParams("pushNotificationConfig is required");
|
|
644
|
+
}
|
|
645
|
+
return this.requestHandler.setTaskPushNotificationConfig(config, context);
|
|
633
646
|
}
|
|
634
647
|
/**
|
|
635
648
|
* Lists all push notification configurations for a task.
|
|
@@ -655,28 +668,6 @@ var RestTransportHandler = class _RestTransportHandler {
|
|
|
655
668
|
context
|
|
656
669
|
);
|
|
657
670
|
}
|
|
658
|
-
// ==========================================================================
|
|
659
|
-
// Private Transformation Methods
|
|
660
|
-
// ==========================================================================
|
|
661
|
-
// All type conversion between REST (snake_case) and internal (camelCase) formats
|
|
662
|
-
/**
|
|
663
|
-
* Validates and normalizes message parameters.
|
|
664
|
-
* Accepts both snake_case and camelCase input.
|
|
665
|
-
* @throws {A2AError} InvalidParams if message is missing or conversion fails
|
|
666
|
-
*/
|
|
667
|
-
normalizeMessageParams(input) {
|
|
668
|
-
if (!input.message) {
|
|
669
|
-
throw A2AError.invalidParams("message is required");
|
|
670
|
-
}
|
|
671
|
-
try {
|
|
672
|
-
return this.normalizeMessageSendParams(input);
|
|
673
|
-
} catch (error) {
|
|
674
|
-
if (error instanceof A2AError) throw error;
|
|
675
|
-
throw A2AError.invalidParams(
|
|
676
|
-
error instanceof Error ? error.message : "Invalid message parameters"
|
|
677
|
-
);
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
671
|
/**
|
|
681
672
|
* Static map of capability to error for missing capabilities.
|
|
682
673
|
*/
|
|
@@ -710,86 +701,6 @@ var RestTransportHandler = class _RestTransportHandler {
|
|
|
710
701
|
}
|
|
711
702
|
return parsed;
|
|
712
703
|
}
|
|
713
|
-
/**
|
|
714
|
-
* Normalizes Part input - accepts both snake_case and camelCase for file mimeType.
|
|
715
|
-
*/
|
|
716
|
-
normalizePart(part) {
|
|
717
|
-
if (part.kind === "text") return { kind: "text", text: part.text };
|
|
718
|
-
if (part.kind === "file") {
|
|
719
|
-
const file = this.normalizeFile(part.file);
|
|
720
|
-
return { kind: "file", file, metadata: part.metadata };
|
|
721
|
-
}
|
|
722
|
-
return { kind: "data", data: part.data, metadata: part.metadata };
|
|
723
|
-
}
|
|
724
|
-
/**
|
|
725
|
-
* Normalizes File input - accepts both snake_case (mime_type) and camelCase (mimeType).
|
|
726
|
-
*/
|
|
727
|
-
normalizeFile(f) {
|
|
728
|
-
const file = f;
|
|
729
|
-
const mimeType = file.mimeType ?? file.mime_type;
|
|
730
|
-
if ("bytes" in file) {
|
|
731
|
-
return { bytes: file.bytes, mimeType, name: file.name };
|
|
732
|
-
}
|
|
733
|
-
return { uri: file.uri, mimeType, name: file.name };
|
|
734
|
-
}
|
|
735
|
-
/**
|
|
736
|
-
* Normalizes Message input - accepts both snake_case and camelCase.
|
|
737
|
-
*/
|
|
738
|
-
normalizeMessage(input) {
|
|
739
|
-
const m = input;
|
|
740
|
-
const messageId = m.messageId ?? m.message_id;
|
|
741
|
-
if (!messageId) {
|
|
742
|
-
throw A2AError.invalidParams("message.messageId is required");
|
|
743
|
-
}
|
|
744
|
-
if (!m.parts || !Array.isArray(m.parts)) {
|
|
745
|
-
throw A2AError.invalidParams("message.parts must be an array");
|
|
746
|
-
}
|
|
747
|
-
return {
|
|
748
|
-
contextId: m.contextId ?? m.context_id,
|
|
749
|
-
extensions: m.extensions,
|
|
750
|
-
kind: "message",
|
|
751
|
-
messageId,
|
|
752
|
-
metadata: m.metadata,
|
|
753
|
-
parts: m.parts.map((p) => this.normalizePart(p)),
|
|
754
|
-
referenceTaskIds: m.referenceTaskIds ?? m.reference_task_ids,
|
|
755
|
-
role: m.role,
|
|
756
|
-
taskId: m.taskId ?? m.task_id
|
|
757
|
-
};
|
|
758
|
-
}
|
|
759
|
-
/**
|
|
760
|
-
* Normalizes MessageSendParams - accepts both snake_case and camelCase.
|
|
761
|
-
*/
|
|
762
|
-
normalizeMessageSendParams(input) {
|
|
763
|
-
const p = input;
|
|
764
|
-
const config = p.configuration;
|
|
765
|
-
return {
|
|
766
|
-
configuration: config ? {
|
|
767
|
-
acceptedOutputModes: config.acceptedOutputModes ?? config.accepted_output_modes,
|
|
768
|
-
blocking: config.blocking,
|
|
769
|
-
historyLength: config.historyLength ?? config.history_length
|
|
770
|
-
} : void 0,
|
|
771
|
-
message: this.normalizeMessage(p.message),
|
|
772
|
-
metadata: p.metadata
|
|
773
|
-
};
|
|
774
|
-
}
|
|
775
|
-
/**
|
|
776
|
-
* Normalizes TaskPushNotificationConfig - accepts both snake_case and camelCase.
|
|
777
|
-
*/
|
|
778
|
-
normalizeTaskPushNotificationConfig(input) {
|
|
779
|
-
const c = input;
|
|
780
|
-
const taskId = c.taskId ?? c.task_id;
|
|
781
|
-
if (!taskId) {
|
|
782
|
-
throw A2AError.invalidParams("taskId is required");
|
|
783
|
-
}
|
|
784
|
-
const pnConfig = c.pushNotificationConfig ?? c.push_notification_config;
|
|
785
|
-
if (!pnConfig) {
|
|
786
|
-
throw A2AError.invalidParams("pushNotificationConfig is required");
|
|
787
|
-
}
|
|
788
|
-
return {
|
|
789
|
-
pushNotificationConfig: pnConfig,
|
|
790
|
-
taskId
|
|
791
|
-
};
|
|
792
|
-
}
|
|
793
704
|
};
|
|
794
705
|
|
|
795
706
|
// src/types/pb/a2a_types.ts
|
|
@@ -1803,6 +1714,28 @@ var SendMessageRequest = {
|
|
|
1803
1714
|
return obj;
|
|
1804
1715
|
}
|
|
1805
1716
|
};
|
|
1717
|
+
var CreateTaskPushNotificationConfigRequest = {
|
|
1718
|
+
fromJSON(object) {
|
|
1719
|
+
return {
|
|
1720
|
+
parent: isSet(object.parent) ? globalThis.String(object.parent) : "",
|
|
1721
|
+
configId: isSet(object.configId) ? globalThis.String(object.configId) : isSet(object.config_id) ? globalThis.String(object.config_id) : "",
|
|
1722
|
+
config: isSet(object.config) ? TaskPushNotificationConfig.fromJSON(object.config) : void 0
|
|
1723
|
+
};
|
|
1724
|
+
},
|
|
1725
|
+
toJSON(message) {
|
|
1726
|
+
const obj = {};
|
|
1727
|
+
if (message.parent !== "") {
|
|
1728
|
+
obj.parent = message.parent;
|
|
1729
|
+
}
|
|
1730
|
+
if (message.configId !== "") {
|
|
1731
|
+
obj.configId = message.configId;
|
|
1732
|
+
}
|
|
1733
|
+
if (message.config !== void 0) {
|
|
1734
|
+
obj.config = TaskPushNotificationConfig.toJSON(message.config);
|
|
1735
|
+
}
|
|
1736
|
+
return obj;
|
|
1737
|
+
}
|
|
1738
|
+
};
|
|
1806
1739
|
var SendMessageResponse = {
|
|
1807
1740
|
fromJSON(object) {
|
|
1808
1741
|
return {
|
|
@@ -2931,12 +2864,9 @@ function restHandler(options) {
|
|
|
2931
2864
|
"/v1/tasks/:taskId/pushNotificationConfigs",
|
|
2932
2865
|
asyncHandler(async (req, res) => {
|
|
2933
2866
|
const context = await buildContext(req);
|
|
2934
|
-
const
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
task_id: req.params.taskId
|
|
2938
|
-
};
|
|
2939
|
-
const result = await restTransportHandler.setTaskPushNotificationConfig(config, context);
|
|
2867
|
+
const protoReq = CreateTaskPushNotificationConfigRequest.fromJSON(req.body);
|
|
2868
|
+
const params = FromProto.createTaskPushNotificationConfig(protoReq);
|
|
2869
|
+
const result = await restTransportHandler.setTaskPushNotificationConfig(params, context);
|
|
2940
2870
|
const protoResult = ToProto.taskPushNotificationConfig(result);
|
|
2941
2871
|
sendResponse(
|
|
2942
2872
|
res,
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
} from "../../chunk-EGOOH5HP.js";
|
|
23
23
|
import {
|
|
24
24
|
AgentCard,
|
|
25
|
+
CreateTaskPushNotificationConfigRequest,
|
|
25
26
|
FromProto,
|
|
26
27
|
ListTaskPushNotificationConfigResponse,
|
|
27
28
|
SendMessageRequest,
|
|
@@ -30,7 +31,7 @@ import {
|
|
|
30
31
|
Task,
|
|
31
32
|
TaskPushNotificationConfig,
|
|
32
33
|
ToProto
|
|
33
|
-
} from "../../chunk-
|
|
34
|
+
} from "../../chunk-5ONEQMOQ.js";
|
|
34
35
|
import {
|
|
35
36
|
A2AError
|
|
36
37
|
} from "../../chunk-UHZEIZLS.js";
|
|
@@ -245,23 +246,32 @@ var RestTransportHandler = class _RestTransportHandler {
|
|
|
245
246
|
async getAuthenticatedExtendedAgentCard(context) {
|
|
246
247
|
return this.requestHandler.getAuthenticatedExtendedAgentCard(context);
|
|
247
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* Validate MessageSendParams.
|
|
251
|
+
*/
|
|
252
|
+
validateMessageSendParams(params) {
|
|
253
|
+
if (!params.message) {
|
|
254
|
+
throw A2AError.invalidParams("message is required");
|
|
255
|
+
}
|
|
256
|
+
if (!params.message.messageId) {
|
|
257
|
+
throw A2AError.invalidParams("message.messageId is required");
|
|
258
|
+
}
|
|
259
|
+
}
|
|
248
260
|
/**
|
|
249
261
|
* Sends a message to the agent.
|
|
250
|
-
* Accepts both snake_case and camelCase input, returns camelCase.
|
|
251
262
|
*/
|
|
252
263
|
async sendMessage(params, context) {
|
|
253
|
-
|
|
254
|
-
return this.requestHandler.sendMessage(
|
|
264
|
+
this.validateMessageSendParams(params);
|
|
265
|
+
return this.requestHandler.sendMessage(params, context);
|
|
255
266
|
}
|
|
256
267
|
/**
|
|
257
268
|
* Sends a message with streaming response.
|
|
258
|
-
* Accepts both snake_case and camelCase input, returns camelCase stream.
|
|
259
269
|
* @throws {A2AError} UnsupportedOperation if streaming not supported
|
|
260
270
|
*/
|
|
261
271
|
async sendMessageStream(params, context) {
|
|
262
272
|
await this.requireCapability("streaming");
|
|
263
|
-
|
|
264
|
-
return this.requestHandler.sendMessageStream(
|
|
273
|
+
this.validateMessageSendParams(params);
|
|
274
|
+
return this.requestHandler.sendMessageStream(params, context);
|
|
265
275
|
}
|
|
266
276
|
/**
|
|
267
277
|
* Gets a task by ID.
|
|
@@ -293,13 +303,17 @@ var RestTransportHandler = class _RestTransportHandler {
|
|
|
293
303
|
}
|
|
294
304
|
/**
|
|
295
305
|
* Sets a push notification configuration.
|
|
296
|
-
* Accepts both snake_case and camelCase input, returns camelCase.
|
|
297
306
|
* @throws {A2AError} PushNotificationNotSupported if push notifications not supported
|
|
298
307
|
*/
|
|
299
308
|
async setTaskPushNotificationConfig(config, context) {
|
|
300
309
|
await this.requireCapability("pushNotifications");
|
|
301
|
-
|
|
302
|
-
|
|
310
|
+
if (!config.taskId) {
|
|
311
|
+
throw A2AError.invalidParams("taskId is required");
|
|
312
|
+
}
|
|
313
|
+
if (!config.pushNotificationConfig) {
|
|
314
|
+
throw A2AError.invalidParams("pushNotificationConfig is required");
|
|
315
|
+
}
|
|
316
|
+
return this.requestHandler.setTaskPushNotificationConfig(config, context);
|
|
303
317
|
}
|
|
304
318
|
/**
|
|
305
319
|
* Lists all push notification configurations for a task.
|
|
@@ -325,28 +339,6 @@ var RestTransportHandler = class _RestTransportHandler {
|
|
|
325
339
|
context
|
|
326
340
|
);
|
|
327
341
|
}
|
|
328
|
-
// ==========================================================================
|
|
329
|
-
// Private Transformation Methods
|
|
330
|
-
// ==========================================================================
|
|
331
|
-
// All type conversion between REST (snake_case) and internal (camelCase) formats
|
|
332
|
-
/**
|
|
333
|
-
* Validates and normalizes message parameters.
|
|
334
|
-
* Accepts both snake_case and camelCase input.
|
|
335
|
-
* @throws {A2AError} InvalidParams if message is missing or conversion fails
|
|
336
|
-
*/
|
|
337
|
-
normalizeMessageParams(input) {
|
|
338
|
-
if (!input.message) {
|
|
339
|
-
throw A2AError.invalidParams("message is required");
|
|
340
|
-
}
|
|
341
|
-
try {
|
|
342
|
-
return this.normalizeMessageSendParams(input);
|
|
343
|
-
} catch (error) {
|
|
344
|
-
if (error instanceof A2AError) throw error;
|
|
345
|
-
throw A2AError.invalidParams(
|
|
346
|
-
error instanceof Error ? error.message : "Invalid message parameters"
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
342
|
/**
|
|
351
343
|
* Static map of capability to error for missing capabilities.
|
|
352
344
|
*/
|
|
@@ -380,86 +372,6 @@ var RestTransportHandler = class _RestTransportHandler {
|
|
|
380
372
|
}
|
|
381
373
|
return parsed;
|
|
382
374
|
}
|
|
383
|
-
/**
|
|
384
|
-
* Normalizes Part input - accepts both snake_case and camelCase for file mimeType.
|
|
385
|
-
*/
|
|
386
|
-
normalizePart(part) {
|
|
387
|
-
if (part.kind === "text") return { kind: "text", text: part.text };
|
|
388
|
-
if (part.kind === "file") {
|
|
389
|
-
const file = this.normalizeFile(part.file);
|
|
390
|
-
return { kind: "file", file, metadata: part.metadata };
|
|
391
|
-
}
|
|
392
|
-
return { kind: "data", data: part.data, metadata: part.metadata };
|
|
393
|
-
}
|
|
394
|
-
/**
|
|
395
|
-
* Normalizes File input - accepts both snake_case (mime_type) and camelCase (mimeType).
|
|
396
|
-
*/
|
|
397
|
-
normalizeFile(f) {
|
|
398
|
-
const file = f;
|
|
399
|
-
const mimeType = file.mimeType ?? file.mime_type;
|
|
400
|
-
if ("bytes" in file) {
|
|
401
|
-
return { bytes: file.bytes, mimeType, name: file.name };
|
|
402
|
-
}
|
|
403
|
-
return { uri: file.uri, mimeType, name: file.name };
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Normalizes Message input - accepts both snake_case and camelCase.
|
|
407
|
-
*/
|
|
408
|
-
normalizeMessage(input) {
|
|
409
|
-
const m = input;
|
|
410
|
-
const messageId = m.messageId ?? m.message_id;
|
|
411
|
-
if (!messageId) {
|
|
412
|
-
throw A2AError.invalidParams("message.messageId is required");
|
|
413
|
-
}
|
|
414
|
-
if (!m.parts || !Array.isArray(m.parts)) {
|
|
415
|
-
throw A2AError.invalidParams("message.parts must be an array");
|
|
416
|
-
}
|
|
417
|
-
return {
|
|
418
|
-
contextId: m.contextId ?? m.context_id,
|
|
419
|
-
extensions: m.extensions,
|
|
420
|
-
kind: "message",
|
|
421
|
-
messageId,
|
|
422
|
-
metadata: m.metadata,
|
|
423
|
-
parts: m.parts.map((p) => this.normalizePart(p)),
|
|
424
|
-
referenceTaskIds: m.referenceTaskIds ?? m.reference_task_ids,
|
|
425
|
-
role: m.role,
|
|
426
|
-
taskId: m.taskId ?? m.task_id
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
/**
|
|
430
|
-
* Normalizes MessageSendParams - accepts both snake_case and camelCase.
|
|
431
|
-
*/
|
|
432
|
-
normalizeMessageSendParams(input) {
|
|
433
|
-
const p = input;
|
|
434
|
-
const config = p.configuration;
|
|
435
|
-
return {
|
|
436
|
-
configuration: config ? {
|
|
437
|
-
acceptedOutputModes: config.acceptedOutputModes ?? config.accepted_output_modes,
|
|
438
|
-
blocking: config.blocking,
|
|
439
|
-
historyLength: config.historyLength ?? config.history_length
|
|
440
|
-
} : void 0,
|
|
441
|
-
message: this.normalizeMessage(p.message),
|
|
442
|
-
metadata: p.metadata
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Normalizes TaskPushNotificationConfig - accepts both snake_case and camelCase.
|
|
447
|
-
*/
|
|
448
|
-
normalizeTaskPushNotificationConfig(input) {
|
|
449
|
-
const c = input;
|
|
450
|
-
const taskId = c.taskId ?? c.task_id;
|
|
451
|
-
if (!taskId) {
|
|
452
|
-
throw A2AError.invalidParams("taskId is required");
|
|
453
|
-
}
|
|
454
|
-
const pnConfig = c.pushNotificationConfig ?? c.push_notification_config;
|
|
455
|
-
if (!pnConfig) {
|
|
456
|
-
throw A2AError.invalidParams("pushNotificationConfig is required");
|
|
457
|
-
}
|
|
458
|
-
return {
|
|
459
|
-
pushNotificationConfig: pnConfig,
|
|
460
|
-
taskId
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
375
|
};
|
|
464
376
|
|
|
465
377
|
// src/server/express/rest_handler.ts
|
|
@@ -630,12 +542,9 @@ function restHandler(options) {
|
|
|
630
542
|
"/v1/tasks/:taskId/pushNotificationConfigs",
|
|
631
543
|
asyncHandler(async (req, res) => {
|
|
632
544
|
const context = await buildContext(req);
|
|
633
|
-
const
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
task_id: req.params.taskId
|
|
637
|
-
};
|
|
638
|
-
const result = await restTransportHandler.setTaskPushNotificationConfig(config, context);
|
|
545
|
+
const protoReq = CreateTaskPushNotificationConfigRequest.fromJSON(req.body);
|
|
546
|
+
const params = FromProto.createTaskPushNotificationConfig(protoReq);
|
|
547
|
+
const result = await restTransportHandler.setTaskPushNotificationConfig(params, context);
|
|
639
548
|
const protoResult = ToProto.taskPushNotificationConfig(result);
|
|
640
549
|
sendResponse(
|
|
641
550
|
res,
|