@pushwoosh/rpc-gateway-messaging 0.6.105 → 0.6.106

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/data.js CHANGED
@@ -1,105 +1,6 @@
1
1
  /* eslint-disable */
2
2
  /* Autogenerated code */
3
3
  export const data = {
4
- "pushwoosh.channels.messagingApi.v2.MessagesInProgressService": {
5
- "type": "S",
6
- "key": "messagesInProgress",
7
- "methods": {}
8
- },
9
- "pushwoosh.channels.messagingApi.v2.MessageStalledStatusState": {
10
- "type": "E",
11
- "values": [
12
- "MESSAGE_STATUS_STATE_UNKNOWN",
13
- "MESSAGE_STATUS_STATE_ALIVE",
14
- "MESSAGE_STATUS_STATE_STUCK",
15
- "MESSAGE_STATUS_STATE_DEAD"
16
- ]
17
- },
18
- "pushwoosh.channels.messagingApi.v2.MessageStalled": {
19
- "type": "I",
20
- "fields": {
21
- "messageCode": {
22
- "type": "string"
23
- },
24
- "clientId": {
25
- "type": "string"
26
- },
27
- "state": {
28
- "type": "pushwoosh.channels.messagingApi.v2.MessageStalledStatusState"
29
- },
30
- "processed": {
31
- "type": "number"
32
- },
33
- "isClientAlive": {
34
- "type": "boolean"
35
- },
36
- "accountId": {
37
- "type": "number"
38
- },
39
- "lastUpdated": {
40
- "type": "Date"
41
- },
42
- "lastResend": {
43
- "type": "Date"
44
- },
45
- "sendDate": {
46
- "type": "Date"
47
- }
48
- }
49
- },
50
- "pushwoosh.channels.messagingApi.v2.ListRequest": {
51
- "type": "I",
52
- "fields": {}
53
- },
54
- "pushwoosh.channels.messagingApi.v2.ListResponse": {
55
- "type": "I",
56
- "fields": {
57
- "messages": {
58
- "type": "pushwoosh.channels.messagingApi.v2.MessageStalled",
59
- "array": true
60
- }
61
- }
62
- },
63
- "pushwoosh.channels.messagingApi.v2.GetStalledMessageRequest": {
64
- "type": "I",
65
- "fields": {
66
- "messageCode": {
67
- "type": "string"
68
- }
69
- }
70
- },
71
- "pushwoosh.channels.messagingApi.v2.GetStalledMessageResponse": {
72
- "type": "I",
73
- "fields": {
74
- "message": {
75
- "type": "pushwoosh.channels.messagingApi.v2.MessageStalled"
76
- }
77
- }
78
- },
79
- "pushwoosh.channels.messagingApi.v2.ResendMessageRequest": {
80
- "type": "I",
81
- "fields": {
82
- "messageCode": {
83
- "type": "string"
84
- }
85
- }
86
- },
87
- "pushwoosh.channels.messagingApi.v2.ResendMessageResponse": {
88
- "type": "I",
89
- "fields": {}
90
- },
91
- "pushwoosh.channels.messagingApi.v2.ClearMessageRequest": {
92
- "type": "I",
93
- "fields": {
94
- "messageCode": {
95
- "type": "string"
96
- }
97
- }
98
- },
99
- "pushwoosh.channels.messagingApi.v2.ClearMessageResponse": {
100
- "type": "I",
101
- "fields": {}
102
- },
103
4
  "pushwoosh.channels.messagingApi.v2.MessagingService": {
104
5
  "type": "S",
105
6
  "key": "messaging",
@@ -110,6 +11,12 @@ export const data = {
110
11
  "method": "post",
111
12
  "path": "/messaging/v2/notify"
112
13
  },
14
+ "NotifyBatch": {
15
+ "request": "pushwoosh.channels.messagingApi.v2.NotifyBatchRequest",
16
+ "response": "pushwoosh.channels.messagingApi.v2.NotifyBatchResponse",
17
+ "method": "post",
18
+ "path": "/messaging/v2/notify/batch"
19
+ },
113
20
  "Cancel": {
114
21
  "request": "pushwoosh.channels.messagingApi.v2.CancelRequest",
115
22
  "response": "pushwoosh.channels.messagingApi.v2.CancelResponse",
@@ -172,6 +79,75 @@ export const data = {
172
79
  }
173
80
  }
174
81
  },
82
+ "pushwoosh.channels.messagingApi.v2.NotifyBatchRequest": {
83
+ "type": "I",
84
+ "fields": {
85
+ "items": {
86
+ "type": "pushwoosh.channels.messagingApi.v2.NotifyBatchItem",
87
+ "array": true
88
+ }
89
+ }
90
+ },
91
+ "pushwoosh.channels.messagingApi.v2.NotifyBatchItem": {
92
+ "type": "I",
93
+ "fields": {
94
+ "itemId": {
95
+ "type": "string"
96
+ },
97
+ "request": {
98
+ "type": "pushwoosh.channels.messagingApi.v2.NotifyRequest"
99
+ }
100
+ }
101
+ },
102
+ "pushwoosh.channels.messagingApi.v2.NotifyBatchResponse": {
103
+ "type": "I",
104
+ "fields": {
105
+ "results": {
106
+ "type": "pushwoosh.channels.messagingApi.v2.NotifyBatchResult",
107
+ "array": true
108
+ },
109
+ "succeeded": {
110
+ "type": "number"
111
+ },
112
+ "failed": {
113
+ "type": "number"
114
+ }
115
+ }
116
+ },
117
+ "pushwoosh.channels.messagingApi.v2.NotifyBatchResult": {
118
+ "type": "I",
119
+ "fields": {
120
+ "itemId": {
121
+ "type": "string"
122
+ },
123
+ "index": {
124
+ "type": "number"
125
+ },
126
+ "result": {
127
+ "type": "pushwoosh.channels.messagingApi.v2.NotifyResult"
128
+ },
129
+ "error": {
130
+ "type": "pushwoosh.channels.messagingApi.v2.NotifyBatchError"
131
+ }
132
+ }
133
+ },
134
+ "pushwoosh.channels.messagingApi.v2.NotifyBatchError": {
135
+ "type": "I",
136
+ "fields": {
137
+ "code": {
138
+ "type": "number"
139
+ },
140
+ "message": {
141
+ "type": "string"
142
+ },
143
+ "reason": {
144
+ "type": "string"
145
+ },
146
+ "domain": {
147
+ "type": "string"
148
+ }
149
+ }
150
+ },
175
151
  "pushwoosh.channels.messagingApi.v2.CancelRequest": {
176
152
  "type": "I",
177
153
  "fields": {
package/index.d.ts CHANGED
@@ -1,8 +1,6 @@
1
- import { MessagesInProgressService as pushwoosh_channels_messagingApi_v2_MessagesInProgressService } from './pushwoosh_channels_messagingApi_v2';
2
1
  import { MessagingService as pushwoosh_channels_messagingApi_v2_MessagingService } from './pushwoosh_channels_messagingApi_v2';
3
2
  import { FiltersCrudService as pushwoosh_objects_filters_v1_FiltersCrudService } from './pushwoosh_objects_filters_v1';
4
3
  export type API = {
5
- messagesInProgress: pushwoosh_channels_messagingApi_v2_MessagesInProgressService;
6
4
  messaging: pushwoosh_channels_messagingApi_v2_MessagingService;
7
5
  filtersCrud: pushwoosh_objects_filters_v1_FiltersCrudService;
8
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/rpc-gateway-messaging",
3
- "version": "0.6.105",
3
+ "version": "0.6.106",
4
4
  "description": "Channels Messaging API gateway HTTP API Types and Data",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -1,55 +1,26 @@
1
1
  import { RpcMethod, Duration } from './commonTypes';
2
2
  import { FilterExpression as pushwoosh_objects_filters_v1_FilterExpression } from './pushwoosh_objects_filters_v1';
3
- /**
4
- * MessagesInProgressService is an INTERNAL service (exposed on the private gRPC
5
- * port only). It surfaces the in-flight messages that the publisher tracks in
6
- * Redis so operators can list stalled sends, inspect one, re-dispatch them, or
7
- * clear their records from the admin panel.
8
- *
9
- * It deliberately has no HTTP gateway annotations: it is reached over gRPC by
10
- * internal services (admin-grpc), never by public clients.
11
- */
12
- export interface MessagesInProgressService {
13
- }
14
- export type MessageStalledStatusState = 'MESSAGE_STATUS_STATE_UNKNOWN' | 'MESSAGE_STATUS_STATE_ALIVE' | 'MESSAGE_STATUS_STATE_STUCK' | 'MESSAGE_STATUS_STATE_DEAD';
15
- export type MessageStalled = {
16
- messageCode: string;
17
- clientId: string;
18
- state: MessageStalledStatusState;
19
- processed: number;
20
- isClientAlive: boolean;
21
- accountId: number;
22
- /** Last progress update; unset if absent. */
23
- lastUpdated: Date;
24
- /** Last resend; unset if the message was never resent. */
25
- lastResend: Date;
26
- sendDate: Date;
27
- };
28
- export type ListRequest = {};
29
- export type ListResponse = {
30
- messages: MessageStalled[];
31
- };
32
- export type GetStalledMessageRequest = {
33
- messageCode: string;
34
- };
35
- export type GetStalledMessageResponse = {
36
- message: MessageStalled;
37
- };
38
- export type ResendMessageRequest = {
39
- messageCode: string;
40
- };
41
- export type ResendMessageResponse = {};
42
- export type ClearMessageRequest = {
43
- messageCode: string;
44
- };
45
- export type ClearMessageResponse = {};
46
3
  export type MessagingService_Notify = RpcMethod<NotifyRequest, NotifyResponse>;
4
+ export type MessagingService_NotifyBatch = RpcMethod<NotifyBatchRequest, NotifyBatchResponse>;
47
5
  export type MessagingService_Cancel = RpcMethod<CancelRequest, CancelResponse>;
48
6
  export type MessagingService_Update = RpcMethod<UpdateRequest, UpdateResponse>;
49
7
  export type MessagingService_Delete = RpcMethod<DeleteRequest, DeleteResponse>;
50
8
  export interface MessagingService {
51
9
  /** Notify creates a new message. Can be targeted to a segment or a list of users. */
52
10
  Notify: MessagingService_Notify;
11
+ /**
12
+ * NotifyBatch creates several messages in one call. Every item is an
13
+ * independent Notify: it is validated, authorized and sent on its own, and it
14
+ * gets its own result. The call itself succeeds even when every item failed,
15
+ * so the caller must read the per-item results and not just the status code.
16
+ *
17
+ * Intended for callers that cannot issue concurrent requests. It is not
18
+ * faster than the same items sent in parallel through Notify.
19
+ *
20
+ * Public API only: the fan-out re-enters through the public port, so calling
21
+ * this on the private port fails with Unimplemented.
22
+ */
23
+ NotifyBatch: MessagingService_NotifyBatch;
53
24
  /**
54
25
  * Cancel cancels a previously created message identified by message_code.
55
26
  * Only messages in a cancelable state (pending, waiting, processing) can be canceled.
@@ -96,6 +67,65 @@ export type NotifyResult = {
96
67
  /** Requested identifiers no device or user was found for. */
97
68
  unknownIdentifiers: string[];
98
69
  };
70
+ export type NotifyBatchRequest = {
71
+ /**
72
+ * At most 500 entries; the exact limit is server-configured. Items are
73
+ * processed concurrently, but results come back in request order.
74
+ */
75
+ items: NotifyBatchItem[];
76
+ };
77
+ export type NotifyBatchItem = {
78
+ /**
79
+ * Caller-supplied correlation id, echoed back in the matching result and
80
+ * otherwise ignored. Optional.
81
+ */
82
+ itemId: string;
83
+ /**
84
+ * Same body as a single Notify, transaction_id included. Setting
85
+ * transaction_id per item is what makes retrying a batch safe.
86
+ */
87
+ request: NotifyRequest;
88
+ };
89
+ export type NotifyBatchResponse = {
90
+ /** One result per requested item, in the order the items were sent. */
91
+ results: NotifyBatchResult[];
92
+ /** Counts over results, so a caller can check the outcome without scanning. */
93
+ succeeded: number;
94
+ failed: number;
95
+ };
96
+ export type NotifyBatchResult = {
97
+ /** Echo of NotifyBatchItem.item_id. */
98
+ itemId: string;
99
+ /**
100
+ * Zero-based position of the item in the request, so results can be
101
+ * correlated even when item_id was left empty.
102
+ */
103
+ index: number;
104
+ /** Set when the item succeeded. */
105
+ result: NotifyResult;
106
+ /** Set when the item failed. */
107
+ error: NotifyBatchError;
108
+ };
109
+ /**
110
+ * NotifyBatchError carries what a single Notify would have returned as a gRPC
111
+ * error. It mirrors google.rpc.Status, but is declared here and with the
112
+ * ErrorInfo detail flattened into plain fields: the TypeScript client generator
113
+ * resolves only google.protobuf.* imports, and a flat shape spares REST callers
114
+ * from unpacking an Any.
115
+ */
116
+ export type NotifyBatchError = {
117
+ /** gRPC status code, as in google.rpc.Code. */
118
+ code: number;
119
+ /** Developer-facing message, in English. */
120
+ message: string;
121
+ /**
122
+ * Short name of the messaging status code, same value a single Notify puts
123
+ * into the ErrorInfo detail. Empty when the failure carried no ErrorInfo.
124
+ */
125
+ reason: string;
126
+ /** Domain of the reason above. */
127
+ domain: string;
128
+ };
99
129
  export type CancelRequest = {
100
130
  /** Code of the message to cancel (as returned by Notify in NotifyResult.message_code). */
101
131
  messageCode: string;