@or-sdk/queue-manager 1.0.1-beta.1350.0

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/README.md ADDED
@@ -0,0 +1 @@
1
+ ## Installation:
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.QueueManager = void 0;
40
+ var providers_1 = require("@or-sdk/providers");
41
+ var QueueManager = (function () {
42
+ function QueueManager(params) {
43
+ var token = params.token, eventManagerUrl = params.eventManagerUrl, discoveryUrl = params.discoveryUrl, providersAccountId = params.providersAccountId;
44
+ this.providers = new providers_1.Providers({
45
+ token: token,
46
+ eventManagerUrl: eventManagerUrl,
47
+ discoveryUrl: discoveryUrl,
48
+ providersAccountId: providersAccountId,
49
+ });
50
+ }
51
+ QueueManager.prototype.listQueues = function (params, customHeaders) {
52
+ return __awaiter(this, void 0, void 0, function () {
53
+ return __generator(this, function (_a) {
54
+ switch (_a.label) {
55
+ case 0: return [4, this.providers.makeRequest({
56
+ method: 'GET',
57
+ route: 'queues',
58
+ params: params,
59
+ customHeaders: customHeaders,
60
+ })];
61
+ case 1: return [2, _a.sent()];
62
+ }
63
+ });
64
+ });
65
+ };
66
+ QueueManager.prototype.checkQueueName = function (params) {
67
+ return __awaiter(this, void 0, void 0, function () {
68
+ return __generator(this, function (_a) {
69
+ switch (_a.label) {
70
+ case 0: return [4, this.providers.makeRequest({
71
+ method: 'GET',
72
+ route: 'queues',
73
+ params: params,
74
+ })];
75
+ case 1: return [2, _a.sent()];
76
+ }
77
+ });
78
+ });
79
+ };
80
+ QueueManager.prototype.deleteQueue = function (params) {
81
+ return __awaiter(this, void 0, void 0, function () {
82
+ return __generator(this, function (_a) {
83
+ switch (_a.label) {
84
+ case 0: return [4, this.providers.makeRequest({
85
+ method: 'DELETE',
86
+ route: 'queues',
87
+ params: params,
88
+ })];
89
+ case 1: return [2, _a.sent()];
90
+ }
91
+ });
92
+ });
93
+ };
94
+ QueueManager.prototype.createQueue = function (data) {
95
+ return __awaiter(this, void 0, void 0, function () {
96
+ return __generator(this, function (_a) {
97
+ switch (_a.label) {
98
+ case 0: return [4, this.providers.makeRequest({
99
+ method: 'POST',
100
+ route: 'queues',
101
+ data: data,
102
+ })];
103
+ case 1: return [2, _a.sent()];
104
+ }
105
+ });
106
+ });
107
+ };
108
+ QueueManager.prototype.updateQueue = function (data) {
109
+ return __awaiter(this, void 0, void 0, function () {
110
+ return __generator(this, function (_a) {
111
+ switch (_a.label) {
112
+ case 0: return [4, this.providers.makeRequest({
113
+ method: 'PUT',
114
+ route: 'queues',
115
+ data: data,
116
+ })];
117
+ case 1: return [2, _a.sent()];
118
+ }
119
+ });
120
+ });
121
+ };
122
+ QueueManager.prototype.getAttributes = function (params) {
123
+ return __awaiter(this, void 0, void 0, function () {
124
+ return __generator(this, function (_a) {
125
+ switch (_a.label) {
126
+ case 0: return [4, this.providers.makeRequest({
127
+ method: 'GET',
128
+ route: 'queue-attributes',
129
+ params: params,
130
+ })];
131
+ case 1: return [2, _a.sent()];
132
+ }
133
+ });
134
+ });
135
+ };
136
+ return QueueManager;
137
+ }());
138
+ exports.QueueManager = QueueManager;
139
+ //# sourceMappingURL=QueueManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueueManager.js","sourceRoot":"","sources":["../../src/QueueManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,+CAA8C;AAE9C;IAGE,sBAAY,MAA0B;QAElC,IAAA,KAAK,GAIH,MAAM,MAJH,EACL,eAAe,GAGb,MAAM,gBAHO,EACf,YAAY,GAEV,MAAM,aAFI,EACZ,kBAAkB,GAChB,MAAM,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;;;;KACJ;IAEY,oCAAa,GAA1B,UAA2B,MAAqB;;;;4BACvC,WAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;4BACtC,MAAM,EAAE,KAAK;4BACb,KAAK,EAAE,kBAAkB;4BACzB,MAAM,QAAA;yBACP,CAAC,EAAA;4BAJF,WAAO,SAIL,EAAC;;;;KACJ;IACH,mBAAC;AAAD,CAAC,AAnED,IAmEC;AAnEY,oCAAY"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SERVICE_KEY = void 0;
4
+ exports.SERVICE_KEY = 'REPLACE_ME';
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,YAAY,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.QueueManager = void 0;
18
+ var QueueManager_1 = require("./QueueManager");
19
+ Object.defineProperty(exports, "QueueManager", { enumerable: true, get: function () { return QueueManager_1.QueueManager; } });
20
+ __exportStar(require("./types"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,0CAAwB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,77 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { Providers } from '@or-sdk/providers';
11
+ export class QueueManager {
12
+ constructor(params) {
13
+ const { token, eventManagerUrl, discoveryUrl, providersAccountId, } = params;
14
+ this.providers = new Providers({
15
+ token,
16
+ eventManagerUrl,
17
+ discoveryUrl,
18
+ providersAccountId,
19
+ });
20
+ }
21
+ listQueues(params, customHeaders) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ return yield this.providers.makeRequest({
24
+ method: 'GET',
25
+ route: 'queues',
26
+ params,
27
+ customHeaders,
28
+ });
29
+ });
30
+ }
31
+ checkQueueName(params) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ return yield this.providers.makeRequest({
34
+ method: 'GET',
35
+ route: 'queues',
36
+ params,
37
+ });
38
+ });
39
+ }
40
+ deleteQueue(params) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ return yield this.providers.makeRequest({
43
+ method: 'DELETE',
44
+ route: 'queues',
45
+ params,
46
+ });
47
+ });
48
+ }
49
+ createQueue(data) {
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ return yield this.providers.makeRequest({
52
+ method: 'POST',
53
+ route: 'queues',
54
+ data,
55
+ });
56
+ });
57
+ }
58
+ updateQueue(data) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ return yield this.providers.makeRequest({
61
+ method: 'PUT',
62
+ route: 'queues',
63
+ data,
64
+ });
65
+ });
66
+ }
67
+ getAttributes(params) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ return yield this.providers.makeRequest({
70
+ method: 'GET',
71
+ route: 'queue-attributes',
72
+ params,
73
+ });
74
+ });
75
+ }
76
+ }
77
+ //# sourceMappingURL=QueueManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueueManager.js","sourceRoot":"","sources":["../../src/QueueManager.ts"],"names":[],"mappings":";;;;;;;;;AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,OAAO,YAAY;IAGvB,YAAY,MAA0B;QACpC,MAAM,EACJ,KAAK,EACL,eAAe,EACf,YAAY,EACZ,kBAAkB,GACnB,GAAG,MAAM,CAAC;QAEX,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC;YAC7B,KAAK;YACL,eAAe;YACf,YAAY;YACZ,kBAAkB;SACnB,CAAC,CAAC;IACL,CAAC;IAEY,UAAU,CAAC,MAAe,EAAE,aAAkC;;YACzE,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;gBACtC,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,QAAQ;gBACf,MAAM;gBACN,aAAa;aACd,CAAC,CAAC;QACL,CAAC;KAAA;IAEY,cAAc,CAAC,MAAiB;;YAC3C,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;gBACtC,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,QAAQ;gBACf,MAAM;aACP,CAAC,CAAC;QACL,CAAC;KAAA;IAEY,WAAW,CAAC,MAAmB;;YAC1C,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;gBACtC,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,QAAQ;gBACf,MAAM;aACP,CAAC,CAAC;QACL,CAAC;KAAA;IAEY,WAAW,CAAC,IAAiB;;YACxC,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;gBACtC,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE,QAAQ;gBACf,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;IAEY,WAAW,CAAC,IAAiB;;YACxC,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;gBACtC,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,QAAQ;gBACf,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;IAEY,aAAa,CAAC,MAAqB;;YAC9C,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;gBACtC,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,kBAAkB;gBACzB,MAAM;aACP,CAAC,CAAC;QACL,CAAC;KAAA;CACF"}
@@ -0,0 +1,2 @@
1
+ export const SERVICE_KEY = 'REPLACE_ME';
2
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { QueueManager } from './QueueManager';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,cAAc,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import { CheckName, CreateQueue, DeleteQueue, GetAttributes, GetList, HeaderForPagination, ListQueues, QueueAttributes, QueueManagerConfig, RequestResponse, UpdateQueue } from './types';
2
+ export declare class QueueManager {
3
+ private readonly providers;
4
+ constructor(params: QueueManagerConfig);
5
+ listQueues(params: GetList, customHeaders: HeaderForPagination): Promise<ListQueues>;
6
+ checkQueueName(params: CheckName): Promise<unknown>;
7
+ deleteQueue(params: DeleteQueue): Promise<RequestResponse>;
8
+ createQueue(data: CreateQueue): Promise<RequestResponse>;
9
+ updateQueue(data: UpdateQueue): Promise<RequestResponse>;
10
+ getAttributes(params: GetAttributes): Promise<QueueAttributes>;
11
+ }
12
+ //# sourceMappingURL=QueueManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueueManager.d.ts","sourceRoot":"","sources":["../../src/QueueManager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX,aAAa,EACb,OAAO,EACP,mBAAmB,EACnB,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,WAAW,EACZ,MAAM,SAAS,CAAC;AAGjB,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;gBAE1B,MAAM,EAAE,kBAAkB;IAgBzB,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;IASpF,cAAc,CAAC,MAAM,EAAE,SAAS;IAQhC,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC;IAQ1D,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC;IAQxD,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC;IAQxD,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC;CAO5E"}
@@ -0,0 +1,2 @@
1
+ export declare const SERVICE_KEY = "REPLACE_ME";
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { QueueManager } from './QueueManager';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,cAAc,SAAS,CAAC"}
@@ -0,0 +1,73 @@
1
+ import { Token } from '@or-sdk/base';
2
+ export type QueueManagerConfig = {
3
+ token: Token;
4
+ discoveryUrl: string;
5
+ eventManagerUrl?: string;
6
+ providersAccountId?: string;
7
+ };
8
+ export type GetList = {
9
+ amount: number;
10
+ };
11
+ export type HeaderForPagination = {
12
+ next: string;
13
+ };
14
+ export type CheckName = {
15
+ queueName: string;
16
+ };
17
+ export type DeleteQueue = {
18
+ queueId: string;
19
+ };
20
+ export type CreateQueue = {
21
+ queueMrc: number;
22
+ queueMrt: string;
23
+ queueName: string;
24
+ queueRedrive: boolean;
25
+ };
26
+ export type UpdateQueue = {
27
+ queueId: string;
28
+ queueMrc: number;
29
+ queueMrt: string;
30
+ queueName: string;
31
+ queueRedrive: boolean;
32
+ };
33
+ export type GetAttributes = {
34
+ queueUrl: string;
35
+ };
36
+ export type Queue = {
37
+ queueId: string;
38
+ name: string;
39
+ dateCreated: string;
40
+ dateModified: string;
41
+ deadQueueArn: string;
42
+ deadQueueUrl: string;
43
+ mrc: number;
44
+ mrt: string;
45
+ queueAWSName: string;
46
+ redrivePolicy: boolean;
47
+ url: string;
48
+ };
49
+ export type ListQueues = {
50
+ statusCode: number;
51
+ body: BodyListQueues;
52
+ };
53
+ export type BodyListQueues = {
54
+ records: Queue[];
55
+ };
56
+ export type QueueAttributes = {
57
+ QueueArn: string;
58
+ ApproximateNumberOfMessages: string;
59
+ ApproximateNumberOfMessagesDelayed: string;
60
+ ApproximateNumberOfMessagesNotVisible: string;
61
+ MaximumMessageSize: string;
62
+ CreatedTimestamp: string;
63
+ LastModifiedTimestamp: string;
64
+ VisibilityTimeout: string;
65
+ MessageRetentionPeriod: string;
66
+ DelaySeconds: string;
67
+ ReceiveMessageWaitTimeSeconds: string;
68
+ SqsManagedSseEnabled: string;
69
+ };
70
+ export type RequestResponse = {
71
+ response: string;
72
+ };
73
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,MAAM,MAAM,kBAAkB,GAAG;IAI/B,KAAK,EAAE,KAAK,CAAC;IAIb,YAAY,EAAE,MAAM,CAAC;IAIrB,eAAe,CAAC,EAAE,MAAM,CAAC;IAIzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC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BAA6B,EAAE,MAAM,CAAC;IACtC,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "version": "1.0.1-beta.1350.0",
3
+ "name": "@or-sdk/queue-manager",
4
+ "main": "dist/cjs/index.js",
5
+ "module": "dist/esm/index.js",
6
+ "types": "dist/types/index.d.ts",
7
+ "scripts": {
8
+ "build": "pnpm clean && pnpm build:esm && pnpm build:cjs",
9
+ "build:cjs": "tsc --project tsconfig.json",
10
+ "build:esm": "tsc --project tsconfig.esm.json",
11
+ "build:types": "tsc --project tsconfig.types.json",
12
+ "build:watch": "concurrently -r --hide 1,2 \"pnpm build:watch:cjs\" \"pnpm build:watch:esm\" \"pnpm build:watch:types\"",
13
+ "build:watch:cjs": "tsc --project tsconfig.json -w",
14
+ "build:watch:esm": "tsc --project tsconfig.esm.json -w",
15
+ "build:watch:types": "tsc --project tsconfig.types.json -w",
16
+ "clean": "rm -rf ./dist",
17
+ "dev": "pnpm build:watch:esm"
18
+ },
19
+ "devDependencies": {
20
+ "concurrently": "^6.4.0",
21
+ "typescript": "^4.4.4"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "dependencies": {
27
+ "@or-sdk/base": "^0.28.1",
28
+ "@or-sdk/providers": "^0.2.2"
29
+ }
30
+ }
@@ -0,0 +1,83 @@
1
+ import {
2
+ CheckName,
3
+ CreateQueue,
4
+ DeleteQueue,
5
+ GetAttributes,
6
+ GetList,
7
+ HeaderForPagination,
8
+ ListQueues,
9
+ QueueAttributes,
10
+ QueueManagerConfig,
11
+ RequestResponse,
12
+ UpdateQueue,
13
+ } from './types';
14
+ import { Providers } from '@or-sdk/providers';
15
+
16
+ export class QueueManager {
17
+ private readonly providers: Providers;
18
+
19
+ constructor(params: QueueManagerConfig) {
20
+ const {
21
+ token,
22
+ eventManagerUrl,
23
+ discoveryUrl,
24
+ providersAccountId,
25
+ } = params;
26
+
27
+ this.providers = new Providers({
28
+ token,
29
+ eventManagerUrl,
30
+ discoveryUrl,
31
+ providersAccountId,
32
+ });
33
+ }
34
+
35
+ public async listQueues(params: GetList, customHeaders: HeaderForPagination): Promise<ListQueues> {
36
+ return await this.providers.makeRequest({
37
+ method: 'GET',
38
+ route: 'queues',
39
+ params,
40
+ customHeaders,
41
+ });
42
+ }
43
+
44
+ public async checkQueueName(params: CheckName) {
45
+ return await this.providers.makeRequest({
46
+ method: 'GET',
47
+ route: 'queues',
48
+ params,
49
+ });
50
+ }
51
+
52
+ public async deleteQueue(params: DeleteQueue): Promise<RequestResponse> {
53
+ return await this.providers.makeRequest({
54
+ method: 'DELETE',
55
+ route: 'queues',
56
+ params,
57
+ });
58
+ }
59
+
60
+ public async createQueue(data: CreateQueue): Promise<RequestResponse> {
61
+ return await this.providers.makeRequest({
62
+ method: 'POST',
63
+ route: 'queues',
64
+ data,
65
+ });
66
+ }
67
+
68
+ public async updateQueue(data: UpdateQueue): Promise<RequestResponse> {
69
+ return await this.providers.makeRequest({
70
+ method: 'PUT',
71
+ route: 'queues',
72
+ data,
73
+ });
74
+ }
75
+
76
+ public async getAttributes(params: GetAttributes): Promise<QueueAttributes> {
77
+ return await this.providers.makeRequest({
78
+ method: 'GET',
79
+ route: 'queue-attributes',
80
+ params,
81
+ });
82
+ }
83
+ }
@@ -0,0 +1 @@
1
+ export const SERVICE_KEY = 'REPLACE_ME';
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { QueueManager } from './QueueManager';
2
+ export * from './types';
package/src/types.ts ADDED
@@ -0,0 +1,97 @@
1
+ import { Token } from '@or-sdk/base';
2
+
3
+ export type QueueManagerConfig = {
4
+ /**
5
+ * token
6
+ */
7
+ token: Token;
8
+ /**
9
+ * function which return token
10
+ */
11
+ discoveryUrl: string;
12
+ /**
13
+ * Url of OneReach Event Manager api
14
+ */
15
+ eventManagerUrl?: string;
16
+ /**
17
+ * accountId of providers OneReach account
18
+ */
19
+ providersAccountId?: string;
20
+ };
21
+
22
+ export type GetList = {
23
+ amount: number;
24
+ };
25
+
26
+ export type HeaderForPagination = {
27
+ next: string;
28
+ };
29
+
30
+ export type CheckName = {
31
+ queueName: string;
32
+ };
33
+
34
+ export type DeleteQueue = {
35
+ queueId: string;
36
+ };
37
+
38
+ export type CreateQueue = {
39
+ queueMrc: number;
40
+ queueMrt: string;
41
+ queueName: string;
42
+ queueRedrive: boolean;
43
+ };
44
+
45
+ export type UpdateQueue = {
46
+ queueId: string;
47
+ queueMrc: number;
48
+ queueMrt: string;
49
+ queueName: string;
50
+ queueRedrive: boolean;
51
+ };
52
+
53
+ export type GetAttributes = {
54
+ queueUrl: string;
55
+ };
56
+
57
+ export type Queue = {
58
+ queueId: string;
59
+ name: string;
60
+ dateCreated: string;
61
+ dateModified: string;
62
+ deadQueueArn: string;
63
+ deadQueueUrl: string;
64
+ mrc: number;
65
+ mrt: string;
66
+ queueAWSName: string;
67
+ redrivePolicy: boolean;
68
+ url: string;
69
+ };
70
+
71
+ export type ListQueues = {
72
+ statusCode: number;
73
+ body: BodyListQueues;
74
+ };
75
+
76
+ export type BodyListQueues = {
77
+ records: Queue[];
78
+ };
79
+
80
+ export type QueueAttributes = {
81
+ QueueArn: string;
82
+ ApproximateNumberOfMessages: string;
83
+ ApproximateNumberOfMessagesDelayed: string;
84
+ ApproximateNumberOfMessagesNotVisible: string;
85
+ MaximumMessageSize: string;
86
+ CreatedTimestamp: string;
87
+ LastModifiedTimestamp: string;
88
+ VisibilityTimeout: string;
89
+ MessageRetentionPeriod: string;
90
+ DelaySeconds: string;
91
+ ReceiveMessageWaitTimeSeconds: string;
92
+ SqsManagedSseEnabled: string;
93
+ };
94
+
95
+ export type RequestResponse = {
96
+ response: string;
97
+ };
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.esm.json",
3
+ "compilerOptions": {
4
+ "declarationDir": "./dist/types",
5
+ "rootDir": "./src",
6
+ "declaration": true
7
+ }
8
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist/esm",
5
+ "declarationDir": "./dist/types",
6
+ "module": "ES6",
7
+ "target": "es6",
8
+ "rootDir": "./src",
9
+ "declaration": true,
10
+ "declarationMap": true
11
+ }
12
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist/cjs/",
5
+ "rootDir": "./src"
6
+ }
7
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist/types/",
5
+ "rootDir": "./src",
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "emitDeclarationOnly": true
9
+ }
10
+ }