@yopdev/dev-server 1.3.1 → 1.3.7
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/src/event-proxy.js +1 -1
- package/dist/src/internal-queue.d.ts +1 -0
- package/dist/src/internal-queue.js +4 -4
- package/dist/src/pre-traffic-hooks.d.ts +2 -11
- package/dist/src/pre-traffic-hooks.js +2 -3
- package/dist/src/sqs.d.ts +3 -1
- package/dist/src/sqs.js +11 -2
- package/package.json +1 -1
package/dist/src/event-proxy.js
CHANGED
|
@@ -66,7 +66,7 @@ var EventsProxy = /** @class */ (function () {
|
|
|
66
66
|
}); };
|
|
67
67
|
this.queueConnectedToTopic = function (sns, topic, sqs, queue) { return __awaiter(_this, void 0, void 0, function () {
|
|
68
68
|
return __generator(this, function (_a) {
|
|
69
|
-
return [2 /*return*/, sqs.
|
|
69
|
+
return [2 /*return*/, sqs.createStandardQueue(queue)
|
|
70
70
|
.then(function (queue) { return sns
|
|
71
71
|
.createSubscription({ arn: topic }, { arn: queue.arn })
|
|
72
72
|
.then(function () { return queue.url; }); })];
|
|
@@ -42,14 +42,15 @@ var sqs_consumer_1 = require("sqs-consumer");
|
|
|
42
42
|
var stoppable_1 = require("./stoppable");
|
|
43
43
|
var mappers_1 = require("./mappers");
|
|
44
44
|
var services_1 = require("./services");
|
|
45
|
-
var newInternalQueue = function (name, config, callback) { return new services_1.Service(new InternalQueue(name, config.visibility, config.handler, config.index), callback); };
|
|
45
|
+
var newInternalQueue = function (name, config, callback) { return new services_1.Service(new InternalQueue(name, config.visibility, config.handler, config.index, function (sqs) { return config.fifo ? sqs.createFifoQueue : sqs.createStandardQueue; }), callback); };
|
|
46
46
|
exports.newInternalQueue = newInternalQueue;
|
|
47
47
|
var InternalQueue = /** @class */ (function () {
|
|
48
|
-
function InternalQueue(name, visibility, handler, index) {
|
|
48
|
+
function InternalQueue(name, visibility, handler, index, creator) {
|
|
49
49
|
var _this = this;
|
|
50
50
|
this.name = name;
|
|
51
51
|
this.visibility = visibility;
|
|
52
52
|
this.handler = handler;
|
|
53
|
+
this.creator = creator;
|
|
53
54
|
this.start = function (config) { return _this.create(config.sqs); };
|
|
54
55
|
this.create = function (sqs) { return __awaiter(_this, void 0, void 0, function () {
|
|
55
56
|
var _this = this;
|
|
@@ -97,8 +98,7 @@ var InternalQueue = /** @class */ (function () {
|
|
|
97
98
|
return __awaiter(this, void 0, void 0, function () {
|
|
98
99
|
var _this = this;
|
|
99
100
|
return __generator(this, function (_a) {
|
|
100
|
-
return [2 /*return*/, sqs
|
|
101
|
-
.createNamedQueue(name) //
|
|
101
|
+
return [2 /*return*/, this.creator(sqs)(name) //
|
|
102
102
|
.then(function (queue) {
|
|
103
103
|
_this.LOGGER.info('created: %s', queue.url);
|
|
104
104
|
return queue;
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const newPreTrafficHooks: (name: string, hooks: () => Promise<void>[]
|
|
3
|
-
declare class PreTrafficHooks implements Lifecycle<PreTrafficHooks> {
|
|
4
|
-
readonly name: string;
|
|
5
|
-
private readonly hooks;
|
|
6
|
-
private LOGGER;
|
|
7
|
-
constructor(name: string, hooks: () => Promise<void>[]);
|
|
8
|
-
start: () => Promise<this>;
|
|
9
|
-
stop: () => Promise<void>;
|
|
10
|
-
}
|
|
11
|
-
export {};
|
|
1
|
+
import { Service } from './services';
|
|
2
|
+
export declare const newPreTrafficHooks: (name: string, hooks: () => Promise<void>[]) => Service<any>;
|
|
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.newPreTrafficHooks = void 0;
|
|
40
40
|
var logging_1 = require("@yopdev/logging");
|
|
41
41
|
var services_1 = require("./services");
|
|
42
|
-
var newPreTrafficHooks = function (name, hooks
|
|
42
|
+
var newPreTrafficHooks = function (name, hooks) { return new services_1.Service(new PreTrafficHooks(name, hooks)); };
|
|
43
43
|
exports.newPreTrafficHooks = newPreTrafficHooks;
|
|
44
44
|
var PreTrafficHooks = /** @class */ (function () {
|
|
45
45
|
function PreTrafficHooks(name, hooks) {
|
|
@@ -47,11 +47,10 @@ var PreTrafficHooks = /** @class */ (function () {
|
|
|
47
47
|
this.name = name;
|
|
48
48
|
this.hooks = hooks;
|
|
49
49
|
this.start = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
50
|
-
var _this = this;
|
|
51
50
|
return __generator(this, function (_a) {
|
|
52
51
|
return [2 /*return*/, Promise
|
|
53
52
|
.all(this.hooks())
|
|
54
|
-
.then(function () { return
|
|
53
|
+
.then(function () { return undefined; })];
|
|
55
54
|
});
|
|
56
55
|
}); };
|
|
57
56
|
this.stop = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
package/dist/src/sqs.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ import { AwsConfig } from "./config";
|
|
|
3
3
|
export declare class Sqs {
|
|
4
4
|
readonly client: SQSClient;
|
|
5
5
|
constructor(config: AwsConfig);
|
|
6
|
-
|
|
6
|
+
createStandardQueue: (name: string) => Promise<Queue>;
|
|
7
|
+
createFifoQueue: (name: string) => Promise<Queue>;
|
|
8
|
+
private createNamedQueue;
|
|
7
9
|
}
|
|
8
10
|
export type Queue = {
|
|
9
11
|
arn: string;
|
package/dist/src/sqs.js
CHANGED
|
@@ -45,12 +45,21 @@ var LOGGER = logging_1.LoggerFactory.create('SQS');
|
|
|
45
45
|
var Sqs = /** @class */ (function () {
|
|
46
46
|
function Sqs(config) {
|
|
47
47
|
var _this = this;
|
|
48
|
-
this.
|
|
48
|
+
this.createStandardQueue = function (name) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
49
|
+
return [2 /*return*/, this.createNamedQueue(name, false)];
|
|
50
|
+
}); }); };
|
|
51
|
+
this.createFifoQueue = function (name) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
52
|
+
return [2 /*return*/, this.createNamedQueue(name, true)];
|
|
53
|
+
}); }); };
|
|
54
|
+
this.createNamedQueue = function (name, fifo) { return __awaiter(_this, void 0, void 0, function () {
|
|
49
55
|
var _this = this;
|
|
50
56
|
return __generator(this, function (_a) {
|
|
51
57
|
return [2 /*return*/, this.client
|
|
52
58
|
.send(new client_sqs_1.CreateQueueCommand({
|
|
53
|
-
QueueName: name,
|
|
59
|
+
QueueName: fifo ? "".concat(name, ".fifo") : name,
|
|
60
|
+
Attributes: {
|
|
61
|
+
FifoQueue: fifo ? 'true' : 'false',
|
|
62
|
+
}
|
|
54
63
|
}))
|
|
55
64
|
.then(function (create) { return _this.client
|
|
56
65
|
.send(new client_sqs_1.GetQueueAttributesCommand({
|