@forge/events 2.0.9 → 2.0.10-next.0-experimental-4cf7fd3
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/CHANGELOG.md +16 -0
- package/out/errors.d.ts +4 -0
- package/out/errors.d.ts.map +1 -1
- package/out/errors.js +7 -1
- package/out/fifoQueue.d.ts +7 -0
- package/out/fifoQueue.d.ts.map +1 -0
- package/out/fifoQueue.js +19 -0
- package/out/index.d.ts +1 -0
- package/out/index.d.ts.map +1 -1
- package/out/index.js +3 -1
- package/out/queries.d.ts +1 -0
- package/out/queries.d.ts.map +1 -1
- package/out/queries.js +2 -1
- package/out/queue.d.ts +7 -3
- package/out/queue.d.ts.map +1 -1
- package/out/queue.js +40 -11
- package/out/text.d.ts +3 -0
- package/out/text.d.ts.map +1 -1
- package/out/text.js +3 -0
- package/out/types.d.ts +15 -1
- package/out/types.d.ts.map +1 -1
- package/out/validators.d.ts +13 -3
- package/out/validators.d.ts.map +1 -1
- package/out/validators.js +48 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @forge/events
|
|
2
2
|
|
|
3
|
+
## 2.0.10-next.0-experimental-4cf7fd3
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 0375b32: As part of https://ecosystem.atlassian.net/wiki/spaces/IC/pages/4458971141/Forge+FIFO+queues, We are adding support for Fifo Queues in @forge/events package.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- @forge/api@6.1.6-next.0-experimental-4cf7fd3
|
|
12
|
+
|
|
13
|
+
## 2.0.10-next.0
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- @forge/api@6.1.6-next.0
|
|
18
|
+
|
|
3
19
|
## 2.0.9
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/out/errors.d.ts
CHANGED
|
@@ -16,6 +16,10 @@ export declare class NoEventsToPushError extends EventsError {
|
|
|
16
16
|
}
|
|
17
17
|
export declare class RateLimitError extends EventsError {
|
|
18
18
|
}
|
|
19
|
+
export declare class InvalidGroupIdError extends EventsError {
|
|
20
|
+
}
|
|
21
|
+
export declare class InvalidEventIdError extends EventsError {
|
|
22
|
+
}
|
|
19
23
|
export declare class PartialSuccessError extends EventsError {
|
|
20
24
|
result: PushResult;
|
|
21
25
|
failedEvents: FailedEvent[];
|
package/out/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAElD,qBAAa,WAAY,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,wBAAyB,SAAQ,WAAW;CAAG;AAE5D,qBAAa,qBAAsB,SAAQ,WAAW;CAAG;AAEzD,qBAAa,mBAAoB,SAAQ,WAAW;CAAG;AAEvD,qBAAa,kBAAmB,SAAQ,WAAW;CAAG;AAEtD,qBAAa,kBAAmB,SAAQ,WAAW;CAAG;AAEtD,qBAAa,mBAAoB,SAAQ,WAAW;CAAG;AAEvD,qBAAa,cAAe,SAAQ,WAAW;CAAG;AAElD,qBAAa,mBAAoB,SAAQ,WAAW;IAGzC,MAAM,EAAE,UAAU;IAClB,YAAY,EAAE,WAAW,EAAE;gBAFlC,OAAO,EAAE,MAAM,EACR,MAAM,EAAE,UAAU,EAClB,YAAY,EAAE,WAAW,EAAE;CAIrC;AAED,qBAAa,mBAAoB,SAAQ,WAAW;gBACtC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;IAMjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,oBAAqB,SAAQ,WAAW;CAAG;AAExD,qBAAa,2BAA4B,SAAQ,WAAW;CAAG"}
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAElD,qBAAa,WAAY,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,wBAAyB,SAAQ,WAAW;CAAG;AAE5D,qBAAa,qBAAsB,SAAQ,WAAW;CAAG;AAEzD,qBAAa,mBAAoB,SAAQ,WAAW;CAAG;AAEvD,qBAAa,kBAAmB,SAAQ,WAAW;CAAG;AAEtD,qBAAa,kBAAmB,SAAQ,WAAW;CAAG;AAEtD,qBAAa,mBAAoB,SAAQ,WAAW;CAAG;AAEvD,qBAAa,cAAe,SAAQ,WAAW;CAAG;AAElD,qBAAa,mBAAoB,SAAQ,WAAW;CAAG;AAEvD,qBAAa,mBAAoB,SAAQ,WAAW;CAAG;AAEvD,qBAAa,mBAAoB,SAAQ,WAAW;IAGzC,MAAM,EAAE,UAAU;IAClB,YAAY,EAAE,WAAW,EAAE;gBAFlC,OAAO,EAAE,MAAM,EACR,MAAM,EAAE,UAAU,EAClB,YAAY,EAAE,WAAW,EAAE;CAIrC;AAED,qBAAa,mBAAoB,SAAQ,WAAW;gBACtC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;IAMjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,oBAAqB,SAAQ,WAAW;CAAG;AAExD,qBAAa,2BAA4B,SAAQ,WAAW;CAAG"}
|
package/out/errors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvocationLimitReachedError = exports.JobDoesNotExistError = exports.InternalServerError = exports.PartialSuccessError = exports.RateLimitError = exports.NoEventsToPushError = exports.PayloadTooBigError = exports.TooManyEventsError = exports.InvalidPayloadError = exports.InvalidQueueNameError = exports.InvalidPushSettingsError = exports.EventsError = void 0;
|
|
3
|
+
exports.InvocationLimitReachedError = exports.JobDoesNotExistError = exports.InternalServerError = exports.PartialSuccessError = exports.InvalidEventIdError = exports.InvalidGroupIdError = exports.RateLimitError = exports.NoEventsToPushError = exports.PayloadTooBigError = exports.TooManyEventsError = exports.InvalidPayloadError = exports.InvalidQueueNameError = exports.InvalidPushSettingsError = exports.EventsError = void 0;
|
|
4
4
|
class EventsError extends Error {
|
|
5
5
|
constructor(message) {
|
|
6
6
|
super(message);
|
|
@@ -28,6 +28,12 @@ exports.NoEventsToPushError = NoEventsToPushError;
|
|
|
28
28
|
class RateLimitError extends EventsError {
|
|
29
29
|
}
|
|
30
30
|
exports.RateLimitError = RateLimitError;
|
|
31
|
+
class InvalidGroupIdError extends EventsError {
|
|
32
|
+
}
|
|
33
|
+
exports.InvalidGroupIdError = InvalidGroupIdError;
|
|
34
|
+
class InvalidEventIdError extends EventsError {
|
|
35
|
+
}
|
|
36
|
+
exports.InvalidEventIdError = InvalidEventIdError;
|
|
31
37
|
class PartialSuccessError extends EventsError {
|
|
32
38
|
result;
|
|
33
39
|
failedEvents;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fifoQueue.d.ts","sourceRoot":"","sources":["../src/fifoQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAIhC,qBAAa,SAAU,SAAQ,KAAK;IAClC,SAAS,CAAC,MAAM,IAAI,OAAO;cAIR,QAAQ,IAAI,IAAI;cAKhB,WAAW,IAAI,MAAM;CAGzC"}
|
package/out/fifoQueue.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FifoQueue = void 0;
|
|
4
|
+
const queue_1 = require("./queue");
|
|
5
|
+
const validators_1 = require("./validators");
|
|
6
|
+
const queries_1 = require("./queries");
|
|
7
|
+
class FifoQueue extends queue_1.Queue {
|
|
8
|
+
isFifo() {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
validate() {
|
|
12
|
+
super.validate();
|
|
13
|
+
(0, validators_1.validateQueueKeyLength)(this.queueParams.key);
|
|
14
|
+
}
|
|
15
|
+
getEndpoint() {
|
|
16
|
+
return queries_1.PUSH_FIFO_PATH;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.FifoQueue = FifoQueue;
|
package/out/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { Queue } from './queue';
|
|
2
|
+
export { FifoQueue } from './fifoQueue';
|
|
2
3
|
export { InvalidQueueNameError, TooManyEventsError, PayloadTooBigError, NoEventsToPushError, RateLimitError, PartialSuccessError, InternalServerError, JobDoesNotExistError, InvalidPushSettingsError, InvocationLimitReachedError } from './errors';
|
|
3
4
|
export { JobProgress, JobStats } from './jobProgress';
|
|
4
5
|
export { QueueResponse } from './queueResponse';
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EACL,SAAS,EACT,QAAQ,EACR,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EACL,SAAS,EACT,QAAQ,EACR,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,aAAa,CAAC"}
|
package/out/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.appEvents = exports.InvocationErrorCode = exports.InvocationError = exports.QueueResponse = exports.JobProgress = exports.InvocationLimitReachedError = exports.InvalidPushSettingsError = exports.JobDoesNotExistError = exports.InternalServerError = exports.PartialSuccessError = exports.RateLimitError = exports.NoEventsToPushError = exports.PayloadTooBigError = exports.TooManyEventsError = exports.InvalidQueueNameError = exports.Queue = void 0;
|
|
3
|
+
exports.appEvents = exports.InvocationErrorCode = exports.InvocationError = exports.QueueResponse = exports.JobProgress = exports.InvocationLimitReachedError = exports.InvalidPushSettingsError = exports.JobDoesNotExistError = exports.InternalServerError = exports.PartialSuccessError = exports.RateLimitError = exports.NoEventsToPushError = exports.PayloadTooBigError = exports.TooManyEventsError = exports.InvalidQueueNameError = exports.FifoQueue = exports.Queue = void 0;
|
|
4
4
|
var queue_1 = require("./queue");
|
|
5
5
|
Object.defineProperty(exports, "Queue", { enumerable: true, get: function () { return queue_1.Queue; } });
|
|
6
|
+
var fifoQueue_1 = require("./fifoQueue");
|
|
7
|
+
Object.defineProperty(exports, "FifoQueue", { enumerable: true, get: function () { return fifoQueue_1.FifoQueue; } });
|
|
6
8
|
var errors_1 = require("./errors");
|
|
7
9
|
Object.defineProperty(exports, "InvalidQueueNameError", { enumerable: true, get: function () { return errors_1.InvalidQueueNameError; } });
|
|
8
10
|
Object.defineProperty(exports, "TooManyEventsError", { enumerable: true, get: function () { return errors_1.TooManyEventsError; } });
|
package/out/queries.d.ts
CHANGED
|
@@ -2,5 +2,6 @@ import { APIResponse, FetchMethod } from '@forge/api';
|
|
|
2
2
|
export declare const PUSH_PATH = "/webhook/queue/publish/{contextAri}/{environmentId}/{appId}/{appVersion}";
|
|
3
3
|
export declare const GET_STATS_PATH = "/webhook/queue/stats/{contextAri}/{environmentId}/{appId}/{appVersion}";
|
|
4
4
|
export declare const CANCEL_JOB_PATH = "/webhook/queue/cancel/{contextAri}/{environmentId}/{appId}/{appVersion}";
|
|
5
|
+
export declare const PUSH_FIFO_PATH = "/forge/events/v1/forge-fifo-events";
|
|
5
6
|
export declare const post: (endpoint: string, body: unknown, apiClient: FetchMethod) => Promise<APIResponse>;
|
|
6
7
|
//# sourceMappingURL=queries.d.ts.map
|
package/out/queries.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtD,eAAO,MAAM,SAAS,6EAA6E,CAAC;AACpG,eAAO,MAAM,cAAc,2EAA2E,CAAC;AACvG,eAAO,MAAM,eAAe,4EAA4E,CAAC;
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtD,eAAO,MAAM,SAAS,6EAA6E,CAAC;AACpG,eAAO,MAAM,cAAc,2EAA2E,CAAC;AACvG,eAAO,MAAM,eAAe,4EAA4E,CAAC;AACzG,eAAO,MAAM,cAAc,uCAAuC,CAAC;AAEnE,eAAO,MAAM,IAAI,aAAoB,MAAM,QAAQ,OAAO,aAAa,WAAW,KAAG,QAAQ,WAAW,CAUvG,CAAC"}
|
package/out/queries.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.post = exports.CANCEL_JOB_PATH = exports.GET_STATS_PATH = exports.PUSH_PATH = void 0;
|
|
3
|
+
exports.post = exports.PUSH_FIFO_PATH = exports.CANCEL_JOB_PATH = exports.GET_STATS_PATH = exports.PUSH_PATH = void 0;
|
|
4
4
|
exports.PUSH_PATH = '/webhook/queue/publish/{contextAri}/{environmentId}/{appId}/{appVersion}';
|
|
5
5
|
exports.GET_STATS_PATH = '/webhook/queue/stats/{contextAri}/{environmentId}/{appId}/{appVersion}';
|
|
6
6
|
exports.CANCEL_JOB_PATH = '/webhook/queue/cancel/{contextAri}/{environmentId}/{appId}/{appVersion}';
|
|
7
|
+
exports.PUSH_FIFO_PATH = '/forge/events/v1/forge-fifo-events';
|
|
7
8
|
const post = async (endpoint, body, apiClient) => {
|
|
8
9
|
const request = {
|
|
9
10
|
method: 'POST',
|
package/out/queue.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { FetchMethod } from '@forge/api';
|
|
2
|
-
import {
|
|
2
|
+
import { PushEvent, PushFifoEvent, PushFifoResult, PushResult, QueueParams } from './types';
|
|
3
3
|
import { JobProgress } from './jobProgress';
|
|
4
4
|
export declare class Queue {
|
|
5
|
-
|
|
5
|
+
protected readonly queueParams: QueueParams;
|
|
6
6
|
private readonly apiClient;
|
|
7
7
|
constructor(queueParams: QueueParams, apiClient?: FetchMethod);
|
|
8
|
-
|
|
8
|
+
protected validate(): void;
|
|
9
|
+
protected isFifo(): boolean;
|
|
10
|
+
protected getEndpoint(): string;
|
|
11
|
+
push(events: PushEvent | PushEvent[] | PushFifoEvent | PushFifoEvent[]): Promise<PushResult | PushFifoResult>;
|
|
9
12
|
getJob(jobId: string): JobProgress;
|
|
13
|
+
private populatePayload;
|
|
10
14
|
}
|
|
11
15
|
//# sourceMappingURL=queue.d.ts.map
|
package/out/queue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,WAAW,EAAE,MAAM,YAAY,CAAC;AAGlE,OAAO,EACL,SAAS,EACT,aAAa,EAEb,cAAc,EAEd,UAAU,EACV,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,qBAAa,KAAK;IAEd,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW;IAC3C,OAAO,CAAC,QAAQ,CAAC,SAAS;gBADP,WAAW,EAAE,WAAW,EAC1B,SAAS,GAAE,WAAqC;IAKnE,SAAS,CAAC,QAAQ,IAAI,IAAI;IAI1B,SAAS,CAAC,MAAM,IAAI,OAAO;IAI3B,SAAS,CAAC,WAAW,IAAI,MAAM;IAIzB,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,aAAa,GAAG,aAAa,EAAE,GAAG,OAAO,CAAC,UAAU,GAAG,cAAc,CAAC;IAgBnH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IAIlC,OAAO,CAAC,eAAe;CAyBxB"}
|
package/out/queue.js
CHANGED
|
@@ -12,27 +12,56 @@ class Queue {
|
|
|
12
12
|
constructor(queueParams, apiClient = api_1.__requestAtlassianAsApp) {
|
|
13
13
|
this.queueParams = queueParams;
|
|
14
14
|
this.apiClient = apiClient;
|
|
15
|
+
this.validate();
|
|
16
|
+
}
|
|
17
|
+
validate() {
|
|
15
18
|
(0, validators_1.validateQueueKey)(this.queueParams.key);
|
|
16
19
|
}
|
|
20
|
+
isFifo() {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
getEndpoint() {
|
|
24
|
+
return queries_1.PUSH_PATH;
|
|
25
|
+
}
|
|
17
26
|
async push(events) {
|
|
18
|
-
const validEvents = (0, validators_1.validatePushEvents)(events);
|
|
27
|
+
const validEvents = (0, validators_1.validatePushEvents)(events, this.isFifo());
|
|
19
28
|
const queueName = this.queueParams.key;
|
|
20
29
|
const jobId = (0, uuid_1.v4)();
|
|
21
|
-
const pushRequest =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
type: 'avi:forge:app:event',
|
|
25
|
-
schema: 'ari:cloud:ecosystem::forge/app-event-2',
|
|
26
|
-
payload: validEvents,
|
|
27
|
-
time: new Date().toISOString()
|
|
28
|
-
};
|
|
29
|
-
const response = await (0, queries_1.post)(queries_1.PUSH_PATH, pushRequest, this.apiClient);
|
|
30
|
+
const pushRequest = this.populatePayload(queueName, jobId, validEvents);
|
|
31
|
+
const endpoint = this.getEndpoint();
|
|
32
|
+
const response = await (0, queries_1.post)(endpoint, pushRequest, this.apiClient);
|
|
30
33
|
const result = { jobId };
|
|
31
|
-
|
|
34
|
+
if (this.isFifo()) {
|
|
35
|
+
return await (0, validators_1.validateFifoResponse)(pushRequest, response);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
await (0, validators_1.validatePushAPIResponse)(pushRequest, response, result);
|
|
39
|
+
}
|
|
32
40
|
return result;
|
|
33
41
|
}
|
|
34
42
|
getJob(jobId) {
|
|
35
43
|
return new jobProgress_1.JobProgress(this.queueParams, jobId, this.apiClient);
|
|
36
44
|
}
|
|
45
|
+
populatePayload(queueName, jobId, validEvents) {
|
|
46
|
+
if (this.isFifo()) {
|
|
47
|
+
validEvents.forEach((event) => {
|
|
48
|
+
event.queueName = queueName;
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
events: validEvents,
|
|
52
|
+
queueName: queueName,
|
|
53
|
+
jobId: jobId,
|
|
54
|
+
time: new Date().toISOString()
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
queueName,
|
|
59
|
+
jobId,
|
|
60
|
+
type: 'avi:forge:app:event',
|
|
61
|
+
schema: 'ari:cloud:ecosystem::forge/app-event-2',
|
|
62
|
+
payload: validEvents,
|
|
63
|
+
time: new Date().toISOString()
|
|
64
|
+
};
|
|
65
|
+
}
|
|
37
66
|
}
|
|
38
67
|
exports.Queue = Queue;
|
package/out/text.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export declare const Text: {
|
|
2
2
|
error: {
|
|
3
3
|
invalidQueueName: string;
|
|
4
|
+
queueNameExceedingMaxLimit: string;
|
|
4
5
|
invalidEvent: string;
|
|
5
6
|
invalidEventBody: string;
|
|
6
7
|
invalidDelayInSecondsSetting: string;
|
|
7
8
|
maxEventsAllowed: (maxEventsCount: number) => string;
|
|
8
9
|
maxPayloadAllowed: (maxPayloadSize: number) => string;
|
|
10
|
+
invalidGroupId: (allowedGroupId: string) => string;
|
|
11
|
+
invalidEventId: string;
|
|
9
12
|
noEventsPushed: string;
|
|
10
13
|
rateLimitError: string;
|
|
11
14
|
invocationLimitReachedError: string;
|
package/out/text.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI;;;;;;;2CAOsB,MAAM,KAAG,MAAM;4CAEd,MAAM,KAAG,MAAM;yCAClB,MAAM,KAAG,MAAM;;;;;;gCAOxB,MAAM,aAAa,MAAM,KAAG,MAAM;;CAG7D,CAAC"}
|
package/out/text.js
CHANGED
|
@@ -4,11 +4,14 @@ exports.Text = void 0;
|
|
|
4
4
|
exports.Text = {
|
|
5
5
|
error: {
|
|
6
6
|
invalidQueueName: `Queue names can only contain alphanumeric characters, dashes and underscores.`,
|
|
7
|
+
queueNameExceedingMaxLimit: `Queue names for Fifo queues must be within 36 characters`,
|
|
7
8
|
invalidEvent: `Event must be an object.`,
|
|
8
9
|
invalidEventBody: `Event body must be an object.`,
|
|
9
10
|
invalidDelayInSecondsSetting: `The delayInSeconds setting must be between 0 and 900.`,
|
|
10
11
|
maxEventsAllowed: (maxEventsCount) => `This push contains more than the ${maxEventsCount} events allowed.`,
|
|
11
12
|
maxPayloadAllowed: (maxPayloadSize) => `The maximum payload size is ${maxPayloadSize}KB.`,
|
|
13
|
+
invalidGroupId: (allowedGroupId) => `Invalid groupId found for Fifo queue. Only "${allowedGroupId}" is allowed.`,
|
|
14
|
+
invalidEventId: `Event id for Fifo queues must not be null and within 36 characters`,
|
|
12
15
|
noEventsPushed: `No events pushed.`,
|
|
13
16
|
rateLimitError: `Too many requests.`,
|
|
14
17
|
invocationLimitReachedError: `The limit on cyclic invocation has been reached.`,
|
package/out/types.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ export interface PushRequest extends APIRequest {
|
|
|
8
8
|
type: string;
|
|
9
9
|
jobId: string;
|
|
10
10
|
}
|
|
11
|
+
export interface PushFifoRequest extends APIRequest {
|
|
12
|
+
events: PushFifoEvent[];
|
|
13
|
+
payload?: PushFifoEvent[];
|
|
14
|
+
}
|
|
11
15
|
export interface APIRequest {
|
|
12
16
|
queueName: string;
|
|
13
17
|
jobId: string;
|
|
@@ -18,6 +22,12 @@ export interface PushEvent {
|
|
|
18
22
|
delayInSeconds?: number;
|
|
19
23
|
concurrency?: Concurrency;
|
|
20
24
|
}
|
|
25
|
+
export interface PushFifoEvent {
|
|
26
|
+
body: Body;
|
|
27
|
+
queueName: string;
|
|
28
|
+
eventId: string;
|
|
29
|
+
groupId: string;
|
|
30
|
+
}
|
|
21
31
|
export declare type Body = Record<string, unknown>;
|
|
22
32
|
export interface Concurrency {
|
|
23
33
|
key: string;
|
|
@@ -26,9 +36,13 @@ export interface Concurrency {
|
|
|
26
36
|
export interface PushResult {
|
|
27
37
|
jobId: string;
|
|
28
38
|
}
|
|
39
|
+
export interface PushFifoResult {
|
|
40
|
+
type: string;
|
|
41
|
+
errorMessage?: string;
|
|
42
|
+
}
|
|
29
43
|
export interface FailedEvent {
|
|
30
44
|
errorMessage: string;
|
|
31
|
-
event: PushEvent;
|
|
45
|
+
event: PushEvent | PushFifoEvent;
|
|
32
46
|
}
|
|
33
47
|
export interface AsyncEvent extends PushEvent {
|
|
34
48
|
queueName: string;
|
package/out/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE9C,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC7C,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,IAAI,CAAC;IACX,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,oBAAY,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE3C,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE9C,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC7C,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,IAAI,CAAC;IACX,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,oBAAY,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE3C,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,SAAS,GAAG,aAAa,CAAC;CAClC;AAED,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,GAAG,CAAC;IACf,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,oBAAY,eAAe,GAAG,UAAU,CAAC;AACzC,oBAAY,gBAAgB,GAAG,UAAU,CAAC"}
|
package/out/validators.d.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { APIResponse } from '@forge/api';
|
|
2
|
-
import { CancelJobRequest, GetStatsRequest, PushEvent, PushRequest, PushResult } from './types';
|
|
2
|
+
import { CancelJobRequest, GetStatsRequest, PushEvent, PushFifoEvent, PushFifoRequest, PushRequest, PushResult } from './types';
|
|
3
3
|
export declare const validateQueueKey: (queueName: string) => void;
|
|
4
|
+
export declare const validateQueueKeyLength: (queueName: string) => void;
|
|
4
5
|
export declare const validatePushSettings: (event: PushEvent) => void;
|
|
5
|
-
export declare function validatePushEvents(arg: PushEvent | PushEvent[]): PushEvent[];
|
|
6
|
+
export declare function validatePushEvents(arg: PushEvent | PushEvent[] | PushFifoEvent | PushFifoEvent[], isFifo: boolean): PushEvent[] | PushFifoEvent[];
|
|
6
7
|
export declare const validateGetStatsPayload: (getStatsRequest: GetStatsRequest) => void;
|
|
7
8
|
export declare const validateCancelJobRequest: (cancelJobRequest: CancelJobRequest) => void;
|
|
8
9
|
export declare const validateAPIResponse: (response: APIResponse, expectedSuccessStatus: number) => Promise<void>;
|
|
9
|
-
export declare const
|
|
10
|
+
export declare const validateFifoResponse: (requestBody: PushFifoRequest, response: APIResponse) => Promise<{
|
|
11
|
+
type: string;
|
|
12
|
+
errorMessage: string;
|
|
13
|
+
status: number;
|
|
14
|
+
} | {
|
|
15
|
+
type: string;
|
|
16
|
+
status: number;
|
|
17
|
+
errorMessage?: undefined;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const validatePushAPIResponse: (requestBody: PushRequest | PushFifoRequest, response: APIResponse, result: PushResult) => Promise<void>;
|
|
10
20
|
export declare const validateGetStatsAPIResponse: (response: APIResponse, getStatsRequest: GetStatsRequest) => Promise<void>;
|
|
11
21
|
export declare const validateCancelJobAPIResponse: (response: APIResponse, cancelJobRequest: GetStatsRequest) => Promise<void>;
|
|
12
22
|
//# sourceMappingURL=validators.d.ts.map
|
package/out/validators.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAiBzC,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EACX,UAAU,EACX,MAAM,SAAS,CAAC;AAQjB,eAAO,MAAM,gBAAgB,cAAe,MAAM,SAIjD,CAAC;AACF,eAAO,MAAM,sBAAsB,cAAe,MAAM,SAIvD,CAAC;AAEF,eAAO,MAAM,oBAAoB,UAAW,SAAS,SAIpD,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,aAAa,GAAG,aAAa,EAAE,EAC9D,MAAM,EAAE,OAAO,GACd,SAAS,EAAE,GAAG,aAAa,EAAE,CAiC/B;AAoBD,eAAO,MAAM,uBAAuB,oBAAqB,eAAe,SAKvE,CAAC;AAEF,eAAO,MAAM,wBAAwB,qBAAsB,gBAAgB,SAK1E,CAAC;AAEF,eAAO,MAAM,mBAAmB,aAAoB,WAAW,yBAAyB,MAAM,kBA6B7F,CAAC;AAEF,eAAO,MAAM,oBAAoB,gBAAuB,eAAe,YAAY,WAAW;;;;;;;;EAY7F,CAAC;AAEF,eAAO,MAAM,uBAAuB,gBACrB,WAAW,GAAG,eAAe,YAChC,WAAW,UACb,UAAU,kBAmCnB,CAAC;AAEF,eAAO,MAAM,2BAA2B,aAAoB,WAAW,mBAAmB,eAAe,kBAMxG,CAAC;AAEF,eAAO,MAAM,4BAA4B,aAAoB,WAAW,oBAAoB,eAAe,kBAM1G,CAAC"}
|
package/out/validators.js
CHANGED
|
@@ -1,30 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateCancelJobAPIResponse = exports.validateGetStatsAPIResponse = exports.validatePushAPIResponse = exports.validateAPIResponse = exports.validateCancelJobRequest = exports.validateGetStatsPayload = exports.validatePushEvents = exports.validatePushSettings = exports.validateQueueKey = void 0;
|
|
3
|
+
exports.validateCancelJobAPIResponse = exports.validateGetStatsAPIResponse = exports.validatePushAPIResponse = exports.validateFifoResponse = exports.validateAPIResponse = exports.validateCancelJobRequest = exports.validateGetStatsPayload = exports.validatePushEvents = exports.validatePushSettings = exports.validateQueueKeyLength = exports.validateQueueKey = void 0;
|
|
4
4
|
const errors_1 = require("./errors");
|
|
5
5
|
const text_1 = require("./text");
|
|
6
6
|
const VALID_QUEUE_NAME_PATTERN = /^[a-zA-Z0-9-_]+$/;
|
|
7
7
|
const MAXIMUM_EVENTS = 50;
|
|
8
|
+
const MAXIMUM_EVENTS_FIFO = 10;
|
|
8
9
|
const MAXIMUM_PAYLOAD_SIZE_KB = 200;
|
|
10
|
+
const ALLOWED_GROUP_ID = 'fifo-mvp-group';
|
|
9
11
|
const validateQueueKey = (queueName) => {
|
|
10
12
|
if (!queueName || !VALID_QUEUE_NAME_PATTERN.test(queueName)) {
|
|
11
13
|
throw new errors_1.InvalidQueueNameError(text_1.Text.error.invalidQueueName);
|
|
12
14
|
}
|
|
13
15
|
};
|
|
14
16
|
exports.validateQueueKey = validateQueueKey;
|
|
17
|
+
const validateQueueKeyLength = (queueName) => {
|
|
18
|
+
if (queueName.length > 36) {
|
|
19
|
+
throw new errors_1.InvalidQueueNameError(text_1.Text.error.queueNameExceedingMaxLimit);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
exports.validateQueueKeyLength = validateQueueKeyLength;
|
|
15
23
|
const validatePushSettings = (event) => {
|
|
16
24
|
if ((event.delayInSeconds && event.delayInSeconds > 900) || (event.delayInSeconds && event.delayInSeconds < 0)) {
|
|
17
25
|
throw new errors_1.InvalidPushSettingsError(text_1.Text.error.invalidDelayInSecondsSetting);
|
|
18
26
|
}
|
|
19
27
|
};
|
|
20
28
|
exports.validatePushSettings = validatePushSettings;
|
|
21
|
-
function validatePushEvents(arg) {
|
|
29
|
+
function validatePushEvents(arg, isFifo) {
|
|
22
30
|
const events = Array.isArray(arg) ? arg : [arg];
|
|
23
31
|
if (events.length === 0) {
|
|
24
32
|
throw new errors_1.NoEventsToPushError(text_1.Text.error.noEventsPushed);
|
|
25
33
|
}
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
const maxAllowed = isFifo ? MAXIMUM_EVENTS_FIFO : MAXIMUM_EVENTS;
|
|
35
|
+
if (events.length > maxAllowed) {
|
|
36
|
+
throw new errors_1.TooManyEventsError(text_1.Text.error.maxEventsAllowed(maxAllowed));
|
|
28
37
|
}
|
|
29
38
|
for (const event of events) {
|
|
30
39
|
if (typeof event !== 'object' || Array.isArray(event) || event === null) {
|
|
@@ -33,15 +42,34 @@ function validatePushEvents(arg) {
|
|
|
33
42
|
if (typeof event.body !== 'object' || Array.isArray(event.body) || event.body === null) {
|
|
34
43
|
throw new errors_1.InvalidPayloadError(text_1.Text.error.invalidEventBody);
|
|
35
44
|
}
|
|
36
|
-
|
|
45
|
+
if (!isFifo) {
|
|
46
|
+
(0, exports.validatePushSettings)(event);
|
|
47
|
+
}
|
|
37
48
|
}
|
|
38
49
|
const payloadSizeKB = Buffer.byteLength(JSON.stringify(events)) / 1024;
|
|
39
50
|
if (payloadSizeKB > MAXIMUM_PAYLOAD_SIZE_KB) {
|
|
40
51
|
throw new errors_1.PayloadTooBigError(text_1.Text.error.maxPayloadAllowed(MAXIMUM_PAYLOAD_SIZE_KB));
|
|
41
52
|
}
|
|
53
|
+
if (isFifo) {
|
|
54
|
+
validateFifoEvents(events);
|
|
55
|
+
}
|
|
42
56
|
return events;
|
|
43
57
|
}
|
|
44
58
|
exports.validatePushEvents = validatePushEvents;
|
|
59
|
+
function validateFifoEvents(events) {
|
|
60
|
+
if (!allEventsHaveValidGroupId(events)) {
|
|
61
|
+
throw new errors_1.InvalidGroupIdError(text_1.Text.error.invalidGroupId(ALLOWED_GROUP_ID));
|
|
62
|
+
}
|
|
63
|
+
if (!allEventsHaveValidEventId(events)) {
|
|
64
|
+
throw new errors_1.InvalidEventIdError(text_1.Text.error.invalidEventId);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function allEventsHaveValidGroupId(events, allowedGroupId = ALLOWED_GROUP_ID) {
|
|
68
|
+
return events.every((event) => event.groupId != null && event.groupId === allowedGroupId);
|
|
69
|
+
}
|
|
70
|
+
function allEventsHaveValidEventId(events) {
|
|
71
|
+
return events.every((event) => event.eventId?.trim().length <= 36);
|
|
72
|
+
}
|
|
45
73
|
const validateGetStatsPayload = (getStatsRequest) => {
|
|
46
74
|
if (!getStatsRequest.jobId) {
|
|
47
75
|
throw new errors_1.JobDoesNotExistError(text_1.Text.error.jobIdEmpty);
|
|
@@ -78,6 +106,20 @@ const validateAPIResponse = async (response, expectedSuccessStatus) => {
|
|
|
78
106
|
}
|
|
79
107
|
};
|
|
80
108
|
exports.validateAPIResponse = validateAPIResponse;
|
|
109
|
+
const validateFifoResponse = async (requestBody, response) => {
|
|
110
|
+
if (!response.ok) {
|
|
111
|
+
return {
|
|
112
|
+
type: 'error',
|
|
113
|
+
errorMessage: response.statusText,
|
|
114
|
+
status: response.status
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
type: 'success',
|
|
119
|
+
status: response.status
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
exports.validateFifoResponse = validateFifoResponse;
|
|
81
123
|
const validatePushAPIResponse = async (requestBody, response, result) => {
|
|
82
124
|
if (response.status === 413) {
|
|
83
125
|
const responseBody = await response.json();
|
|
@@ -92,7 +134,7 @@ const validatePushAPIResponse = async (requestBody, response, result) => {
|
|
|
92
134
|
partialSuccessError.failedEvents = responseBody.failedEvents.map((failedEvent) => {
|
|
93
135
|
return {
|
|
94
136
|
errorMessage: failedEvent.errorMessage,
|
|
95
|
-
payload: requestBody.payload[+failedEvent.index]
|
|
137
|
+
payload: requestBody.payload != null && requestBody.payload[+failedEvent.index]
|
|
96
138
|
};
|
|
97
139
|
});
|
|
98
140
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/events",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10-next.0-experimental-4cf7fd3",
|
|
4
4
|
"description": "Forge Async Event methods",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@types/uuid": "^9.0.8"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@forge/api": "6.1.
|
|
19
|
+
"@forge/api": "6.1.6-next.0-experimental-4cf7fd3",
|
|
20
20
|
"uuid": "^9.0.1"
|
|
21
21
|
},
|
|
22
22
|
"publishConfig": {
|