@forge/events
Advanced tools
Comparing version 0.3.0-next.0 to 0.3.0-next.1
# @forge/events | ||
## 0.3.0-next.1 | ||
### Minor Changes | ||
- 66b6648: Add errors and validations | ||
## 0.3.0-next.0 | ||
@@ -4,0 +10,0 @@ |
@@ -56,2 +56,9 @@ "use strict"; | ||
}); | ||
it('should throw InvocationLimitReachedError', async () => { | ||
const apiClientMock = utils_1.getApiClientMock({}, 405); | ||
const queue = getQueue(apiClientMock, 'name'); | ||
const payload = [1, 2, 3, 4, 5]; | ||
await expect(queue.push(payload)).rejects.toThrow(new errors_1.InvocationLimitReachedError()); | ||
utils_1.verifyApiClientCalledPushPathWith(apiClientMock, payload, 'name'); | ||
}); | ||
it('should throw PartialSuccessError when there are failed events', async () => { | ||
@@ -58,0 +65,0 @@ const apiClientMock = utils_1.getApiClientMock({ |
@@ -32,2 +32,5 @@ import { FailedEvent } from './types'; | ||
} | ||
export declare class InvocationLimitReachedError extends Error { | ||
constructor(); | ||
} | ||
//# sourceMappingURL=errors.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.JobDoesNotExistError = exports.InternalServerError = exports.PartialSuccessError = exports.RateLimitError = exports.NoEventsToPushError = exports.PayloadTooBigError = exports.TooManyEventsError = exports.InvalidQueueNameError = exports.InvalidPushSettingsError = void 0; | ||
exports.InvocationLimitReachedError = exports.JobDoesNotExistError = exports.InternalServerError = exports.PartialSuccessError = exports.RateLimitError = exports.NoEventsToPushError = exports.PayloadTooBigError = exports.TooManyEventsError = exports.InvalidQueueNameError = exports.InvalidPushSettingsError = void 0; | ||
class InvalidPushSettingsError extends Error { | ||
@@ -61,1 +61,7 @@ constructor(message) { | ||
exports.JobDoesNotExistError = JobDoesNotExistError; | ||
class InvocationLimitReachedError extends Error { | ||
constructor() { | ||
super(); | ||
} | ||
} | ||
exports.InvocationLimitReachedError = InvocationLimitReachedError; |
export { Queue } from './queue'; | ||
export { InvalidQueueNameError, TooManyEventsError, PayloadTooBigError, NoEventsToPushError, RateLimitError, PartialSuccessError, InternalServerError, JobDoesNotExistError, InvalidPushSettingsError } from './errors'; | ||
export { InvalidQueueNameError, TooManyEventsError, PayloadTooBigError, NoEventsToPushError, RateLimitError, PartialSuccessError, InternalServerError, JobDoesNotExistError, InvalidPushSettingsError, InvocationLimitReachedError } from './errors'; | ||
export { JobProgress } from './jobProgress'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -15,3 +15,4 @@ "use strict"; | ||
Object.defineProperty(exports, "InvalidPushSettingsError", { enumerable: true, get: function () { return errors_1.InvalidPushSettingsError; } }); | ||
Object.defineProperty(exports, "InvocationLimitReachedError", { enumerable: true, get: function () { return errors_1.InvocationLimitReachedError; } }); | ||
var jobProgress_1 = require("./jobProgress"); | ||
Object.defineProperty(exports, "JobProgress", { enumerable: true, get: function () { return jobProgress_1.JobProgress; } }); |
@@ -40,2 +40,5 @@ "use strict"; | ||
} | ||
if (response.status === 405) { | ||
throw new errors_1.InvocationLimitReachedError(); | ||
} | ||
if (response.status != expectedSuccessStatus && response.status) { | ||
@@ -42,0 +45,0 @@ let internalServerError; |
{ | ||
"name": "@forge/events", | ||
"version": "0.3.0-next.0", | ||
"version": "0.3.0-next.1", | ||
"description": "Forge Async Event methods", | ||
@@ -5,0 +5,0 @@ "author": "Atlassian", |
@@ -9,3 +9,4 @@ import { | ||
TooManyEventsError, | ||
InvalidPushSettingsError | ||
InvalidPushSettingsError, | ||
InvocationLimitReachedError | ||
} from '../errors'; | ||
@@ -83,2 +84,10 @@ import { getApiClientMock, getApiClientMockWithoutResponseBody, verifyApiClientCalledPushPathWith } from './utils'; | ||
it('should throw InvocationLimitReachedError', async () => { | ||
const apiClientMock = getApiClientMock({}, 405); | ||
const queue = getQueue(apiClientMock, 'name'); | ||
const payload = [1, 2, 3, 4, 5]; | ||
await expect(queue.push(payload)).rejects.toThrow(new InvocationLimitReachedError()); | ||
verifyApiClientCalledPushPathWith(apiClientMock, payload, 'name'); | ||
}); | ||
it('should throw PartialSuccessError when there are failed events', async () => { | ||
@@ -85,0 +94,0 @@ const apiClientMock = getApiClientMock( |
@@ -64,1 +64,7 @@ import { FailedEvent } from './types'; | ||
} | ||
export class InvocationLimitReachedError extends Error { | ||
constructor() { | ||
super(); | ||
} | ||
} |
@@ -11,4 +11,5 @@ export { Queue } from './queue'; | ||
JobDoesNotExistError, | ||
InvalidPushSettingsError | ||
InvalidPushSettingsError, | ||
InvocationLimitReachedError | ||
} from './errors'; | ||
export { JobProgress } from './jobProgress'; |
@@ -10,3 +10,4 @@ import { | ||
TooManyEventsError, | ||
InvalidPushSettingsError | ||
InvalidPushSettingsError, | ||
InvocationLimitReachedError | ||
} from './errors'; | ||
@@ -60,2 +61,6 @@ import { APIResponse, GetStatsRequest, Payload, PushRequest, PushSettings } from './types'; | ||
if (response.status === 405) { | ||
throw new InvocationLimitReachedError(); | ||
} | ||
if (response.status != expectedSuccessStatus && response.status) { | ||
@@ -62,0 +67,0 @@ //Catch all errors from server that we have not handled |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
116012
1322