@certik/skynet 0.22.2 → 0.22.3
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 +4 -0
- package/dist/api.js +38 -38
- package/dist/app.js +281 -281
- package/dist/deploy.js +19 -19
- package/dist/dynamodb.js +22 -22
- package/dist/indexer.js +132 -132
- package/dist/opsgenie.d.ts +97 -19
- package/dist/opsgenie.js +7 -3
- package/examples/api.ts +0 -0
- package/examples/indexer.ts +0 -0
- package/examples/mode-indexer.ts +0 -0
- package/package.json +2 -2
- package/src/opsgenie.ts +129 -23
- package/.vscode/settings.json +0 -5
- package/bun.lockb +0 -0
package/dist/dynamodb.js
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
// src/util.ts
|
|
2
|
+
function range(startAt, endAt, step) {
|
|
3
|
+
const arr = [];
|
|
4
|
+
for (let i = startAt;i <= endAt; i += step) {
|
|
5
|
+
arr.push([i, Math.min(endAt, i + step - 1)]);
|
|
6
|
+
}
|
|
7
|
+
return arr;
|
|
8
|
+
}
|
|
9
|
+
function arrayGroup(array, groupSize) {
|
|
10
|
+
const groups = [];
|
|
11
|
+
for (let i = 0;i < array.length; i += groupSize) {
|
|
12
|
+
groups.push(array.slice(i, i + groupSize));
|
|
13
|
+
}
|
|
14
|
+
return groups;
|
|
15
|
+
}
|
|
16
|
+
function fillRange(start, end) {
|
|
17
|
+
const result = [];
|
|
18
|
+
for (let i = start;i <= end; i++) {
|
|
19
|
+
result.push(i);
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
1
23
|
// src/object-hash.ts
|
|
2
24
|
import xh from "@node-rs/xxhash";
|
|
3
25
|
function getHash(obj) {
|
|
@@ -124,28 +146,6 @@ function memoize(func, options) {
|
|
|
124
146
|
}
|
|
125
147
|
return pMemoize(func, options);
|
|
126
148
|
}
|
|
127
|
-
// src/util.ts
|
|
128
|
-
function range(startAt, endAt, step) {
|
|
129
|
-
const arr = [];
|
|
130
|
-
for (let i = startAt;i <= endAt; i += step) {
|
|
131
|
-
arr.push([i, Math.min(endAt, i + step - 1)]);
|
|
132
|
-
}
|
|
133
|
-
return arr;
|
|
134
|
-
}
|
|
135
|
-
function arrayGroup(array, groupSize) {
|
|
136
|
-
const groups = [];
|
|
137
|
-
for (let i = 0;i < array.length; i += groupSize) {
|
|
138
|
-
groups.push(array.slice(i, i + groupSize));
|
|
139
|
-
}
|
|
140
|
-
return groups;
|
|
141
|
-
}
|
|
142
|
-
function fillRange(start, end) {
|
|
143
|
-
const result = [];
|
|
144
|
-
for (let i = start;i <= end; i++) {
|
|
145
|
-
result.push(i);
|
|
146
|
-
}
|
|
147
|
-
return result;
|
|
148
|
-
}
|
|
149
149
|
// src/dynamodb.ts
|
|
150
150
|
import {
|
|
151
151
|
DynamoDBDocumentClient,
|
package/dist/indexer.js
CHANGED
|
@@ -1,41 +1,3 @@
|
|
|
1
|
-
// src/selector.ts
|
|
2
|
-
function getSelectorDesc(selector) {
|
|
3
|
-
return Object.keys(selector).map((name) => {
|
|
4
|
-
return ` --${name.padEnd(14)}${selector[name].desc || selector[name].description || ""}`;
|
|
5
|
-
}).join(`
|
|
6
|
-
`);
|
|
7
|
-
}
|
|
8
|
-
function getSelectorFlags(selector) {
|
|
9
|
-
return Object.keys(selector).reduce((acc, name) => {
|
|
10
|
-
const flag = {
|
|
11
|
-
type: selector[name].type || "string",
|
|
12
|
-
...selector[name]
|
|
13
|
-
};
|
|
14
|
-
if (!selector[name].optional && selector[name].isRequired !== false) {
|
|
15
|
-
flag.isRequired = true;
|
|
16
|
-
}
|
|
17
|
-
return { ...acc, [name]: flag };
|
|
18
|
-
}, {});
|
|
19
|
-
}
|
|
20
|
-
function toSelectorString(selectorFlags, delim = ",") {
|
|
21
|
-
return Object.keys(selectorFlags).sort().map((flag) => {
|
|
22
|
-
return `${flag}=${selectorFlags[flag]}`;
|
|
23
|
-
}).join(delim);
|
|
24
|
-
}
|
|
25
|
-
function normalizeSelectorValue(v) {
|
|
26
|
-
return v.replace(/[^A-Za-z0-9]+/g, "-");
|
|
27
|
-
}
|
|
28
|
-
function getJobName(name, selectorFlags, mode) {
|
|
29
|
-
const selectorNamePart = Object.keys(selectorFlags).sort().map((name2) => selectorFlags[name2]).join("-");
|
|
30
|
-
let jobName = name;
|
|
31
|
-
if (mode) {
|
|
32
|
-
jobName += `-${mode}`;
|
|
33
|
-
}
|
|
34
|
-
if (selectorNamePart.length > 0) {
|
|
35
|
-
jobName += `-${normalizeSelectorValue(selectorNamePart)}`;
|
|
36
|
-
}
|
|
37
|
-
return jobName;
|
|
38
|
-
}
|
|
39
1
|
// src/env.ts
|
|
40
2
|
function ensureAndGet(envName, defaultValue) {
|
|
41
3
|
return process.env[envName] || defaultValue;
|
|
@@ -55,63 +17,56 @@ function isProduction() {
|
|
|
55
17
|
function isDev() {
|
|
56
18
|
return getEnvironment() === "dev";
|
|
57
19
|
}
|
|
58
|
-
// src/
|
|
59
|
-
function
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (Array.isArray(o)) {
|
|
64
|
-
return `[${o.map(print).join(", ")}]`;
|
|
20
|
+
// src/util.ts
|
|
21
|
+
function range(startAt, endAt, step) {
|
|
22
|
+
const arr = [];
|
|
23
|
+
for (let i = startAt;i <= endAt; i += step) {
|
|
24
|
+
arr.push([i, Math.min(endAt, i + step - 1)]);
|
|
65
25
|
}
|
|
66
|
-
|
|
67
|
-
|
|
26
|
+
return arr;
|
|
27
|
+
}
|
|
28
|
+
function arrayGroup(array, groupSize) {
|
|
29
|
+
const groups = [];
|
|
30
|
+
for (let i = 0;i < array.length; i += groupSize) {
|
|
31
|
+
groups.push(array.slice(i, i + groupSize));
|
|
68
32
|
}
|
|
69
|
-
return
|
|
33
|
+
return groups;
|
|
70
34
|
}
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
for (let i =
|
|
74
|
-
|
|
35
|
+
function fillRange(start, end) {
|
|
36
|
+
const result = [];
|
|
37
|
+
for (let i = start;i <= end; i++) {
|
|
38
|
+
result.push(i);
|
|
75
39
|
}
|
|
76
|
-
return
|
|
40
|
+
return result;
|
|
77
41
|
}
|
|
78
|
-
|
|
79
|
-
|
|
42
|
+
// src/date.ts
|
|
43
|
+
var MS_IN_A_DAY = 3600 * 24 * 1000;
|
|
44
|
+
function getDateOnly(date) {
|
|
45
|
+
return new Date(date).toISOString().split("T")[0];
|
|
80
46
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
},
|
|
92
|
-
error: function(...args) {
|
|
93
|
-
if (true) {
|
|
94
|
-
console.error(`${timestamp()} ${getLine(args)}`);
|
|
95
|
-
}
|
|
47
|
+
function findDateAfter(date, n) {
|
|
48
|
+
const d = new Date(date);
|
|
49
|
+
const after = new Date(d.getTime() + MS_IN_A_DAY * n);
|
|
50
|
+
return getDateOnly(after);
|
|
51
|
+
}
|
|
52
|
+
function daysInRange(from, to) {
|
|
53
|
+
const fromTime = new Date(from).getTime();
|
|
54
|
+
const toTime = new Date(to).getTime();
|
|
55
|
+
if (fromTime > toTime) {
|
|
56
|
+
throw new Error(`range to date couldn't be earlier than range from date`);
|
|
96
57
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
console.log(`[${timestamp()}]`, ...args);
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
log: function(...args) {
|
|
105
|
-
if (true) {
|
|
106
|
-
console.log(`[${timestamp()}]`, ...args);
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
error: function(...args) {
|
|
110
|
-
if (true) {
|
|
111
|
-
console.error(`[${timestamp()}]`, ...args);
|
|
112
|
-
}
|
|
58
|
+
const daysBetween = Math.floor((toTime - fromTime) / MS_IN_A_DAY);
|
|
59
|
+
const dates = [getDateOnly(new Date(fromTime))];
|
|
60
|
+
for (let i = 1;i <= daysBetween; i += 1) {
|
|
61
|
+
dates.push(getDateOnly(new Date(fromTime + i * MS_IN_A_DAY)));
|
|
113
62
|
}
|
|
114
|
-
|
|
63
|
+
return dates;
|
|
64
|
+
}
|
|
65
|
+
function dateRange(from, to, step) {
|
|
66
|
+
const days = daysInRange(from, to);
|
|
67
|
+
const windows = arrayGroup(days, step);
|
|
68
|
+
return windows.map((w) => [w[0], w[w.length - 1]]);
|
|
69
|
+
}
|
|
115
70
|
// src/object-hash.ts
|
|
116
71
|
import xh from "@node-rs/xxhash";
|
|
117
72
|
function getHash(obj) {
|
|
@@ -238,28 +193,63 @@ function memoize(func, options) {
|
|
|
238
193
|
}
|
|
239
194
|
return pMemoize(func, options);
|
|
240
195
|
}
|
|
241
|
-
// src/
|
|
242
|
-
function
|
|
243
|
-
|
|
244
|
-
for (let i = startAt;i <= endAt; i += step) {
|
|
245
|
-
arr.push([i, Math.min(endAt, i + step - 1)]);
|
|
246
|
-
}
|
|
247
|
-
return arr;
|
|
196
|
+
// src/log.ts
|
|
197
|
+
function isObject(a) {
|
|
198
|
+
return !!a && a.constructor === Object;
|
|
248
199
|
}
|
|
249
|
-
function
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
groups.push(array.slice(i, i + groupSize));
|
|
200
|
+
function print(o) {
|
|
201
|
+
if (Array.isArray(o)) {
|
|
202
|
+
return `[${o.map(print).join(", ")}]`;
|
|
253
203
|
}
|
|
254
|
-
|
|
204
|
+
if (isObject(o)) {
|
|
205
|
+
return `{${Object.keys(o).map((k) => `${k}: ${o[k]}`).join(", ")}}`;
|
|
206
|
+
}
|
|
207
|
+
return `${o}`;
|
|
255
208
|
}
|
|
256
|
-
function
|
|
257
|
-
|
|
258
|
-
for (let i =
|
|
259
|
-
|
|
209
|
+
function getLine(params) {
|
|
210
|
+
let line = "";
|
|
211
|
+
for (let i = 0, l = params.length;i < l; i++) {
|
|
212
|
+
line += `${print(params[i])} `.replace(/\n/gm, "\t");
|
|
260
213
|
}
|
|
261
|
-
return
|
|
214
|
+
return line.trim();
|
|
262
215
|
}
|
|
216
|
+
function timestamp() {
|
|
217
|
+
return new Date().toISOString();
|
|
218
|
+
}
|
|
219
|
+
var inline = {
|
|
220
|
+
debug: function(...args) {
|
|
221
|
+
if (true) {
|
|
222
|
+
console.log(`${timestamp()} ${getLine(args)}`);
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
log: function(...args) {
|
|
226
|
+
if (true) {
|
|
227
|
+
console.log(`${timestamp()} ${getLine(args)}`);
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
error: function(...args) {
|
|
231
|
+
if (true) {
|
|
232
|
+
console.error(`${timestamp()} ${getLine(args)}`);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
var logger = {
|
|
237
|
+
debug: function(...args) {
|
|
238
|
+
if (true) {
|
|
239
|
+
console.log(`[${timestamp()}]`, ...args);
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
log: function(...args) {
|
|
243
|
+
if (true) {
|
|
244
|
+
console.log(`[${timestamp()}]`, ...args);
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
error: function(...args) {
|
|
248
|
+
if (true) {
|
|
249
|
+
console.error(`[${timestamp()}]`, ...args);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
};
|
|
263
253
|
// src/dynamodb.ts
|
|
264
254
|
import {
|
|
265
255
|
DynamoDBDocumentClient,
|
|
@@ -574,6 +564,44 @@ async function deleteRecordsByHashKey(tableName, indexName, hashKeyValue, verbos
|
|
|
574
564
|
}
|
|
575
565
|
return totalDeleted;
|
|
576
566
|
}
|
|
567
|
+
// src/selector.ts
|
|
568
|
+
function getSelectorDesc(selector) {
|
|
569
|
+
return Object.keys(selector).map((name) => {
|
|
570
|
+
return ` --${name.padEnd(14)}${selector[name].desc || selector[name].description || ""}`;
|
|
571
|
+
}).join(`
|
|
572
|
+
`);
|
|
573
|
+
}
|
|
574
|
+
function getSelectorFlags(selector) {
|
|
575
|
+
return Object.keys(selector).reduce((acc, name) => {
|
|
576
|
+
const flag = {
|
|
577
|
+
type: selector[name].type || "string",
|
|
578
|
+
...selector[name]
|
|
579
|
+
};
|
|
580
|
+
if (!selector[name].optional && selector[name].isRequired !== false) {
|
|
581
|
+
flag.isRequired = true;
|
|
582
|
+
}
|
|
583
|
+
return { ...acc, [name]: flag };
|
|
584
|
+
}, {});
|
|
585
|
+
}
|
|
586
|
+
function toSelectorString(selectorFlags, delim = ",") {
|
|
587
|
+
return Object.keys(selectorFlags).sort().map((flag) => {
|
|
588
|
+
return `${flag}=${selectorFlags[flag]}`;
|
|
589
|
+
}).join(delim);
|
|
590
|
+
}
|
|
591
|
+
function normalizeSelectorValue(v) {
|
|
592
|
+
return v.replace(/[^A-Za-z0-9]+/g, "-");
|
|
593
|
+
}
|
|
594
|
+
function getJobName(name, selectorFlags, mode) {
|
|
595
|
+
const selectorNamePart = Object.keys(selectorFlags).sort().map((name2) => selectorFlags[name2]).join("-");
|
|
596
|
+
let jobName = name;
|
|
597
|
+
if (mode) {
|
|
598
|
+
jobName += `-${mode}`;
|
|
599
|
+
}
|
|
600
|
+
if (selectorNamePart.length > 0) {
|
|
601
|
+
jobName += `-${normalizeSelectorValue(selectorNamePart)}`;
|
|
602
|
+
}
|
|
603
|
+
return jobName;
|
|
604
|
+
}
|
|
577
605
|
// src/cli.ts
|
|
578
606
|
import path from "path";
|
|
579
607
|
import fs from "fs";
|
|
@@ -609,34 +637,6 @@ function detectBin() {
|
|
|
609
637
|
const wd = detectDirectory(process.argv[1], "package.json");
|
|
610
638
|
return process.argv[1].slice(wd.length + path.sep.length).replace(path.sep, "/");
|
|
611
639
|
}
|
|
612
|
-
// src/date.ts
|
|
613
|
-
var MS_IN_A_DAY = 3600 * 24 * 1000;
|
|
614
|
-
function getDateOnly(date) {
|
|
615
|
-
return new Date(date).toISOString().split("T")[0];
|
|
616
|
-
}
|
|
617
|
-
function findDateAfter(date, n) {
|
|
618
|
-
const d = new Date(date);
|
|
619
|
-
const after = new Date(d.getTime() + MS_IN_A_DAY * n);
|
|
620
|
-
return getDateOnly(after);
|
|
621
|
-
}
|
|
622
|
-
function daysInRange(from, to) {
|
|
623
|
-
const fromTime = new Date(from).getTime();
|
|
624
|
-
const toTime = new Date(to).getTime();
|
|
625
|
-
if (fromTime > toTime) {
|
|
626
|
-
throw new Error(`range to date couldn't be earlier than range from date`);
|
|
627
|
-
}
|
|
628
|
-
const daysBetween = Math.floor((toTime - fromTime) / MS_IN_A_DAY);
|
|
629
|
-
const dates = [getDateOnly(new Date(fromTime))];
|
|
630
|
-
for (let i = 1;i <= daysBetween; i += 1) {
|
|
631
|
-
dates.push(getDateOnly(new Date(fromTime + i * MS_IN_A_DAY)));
|
|
632
|
-
}
|
|
633
|
-
return dates;
|
|
634
|
-
}
|
|
635
|
-
function dateRange(from, to, step) {
|
|
636
|
-
const days = daysInRange(from, to);
|
|
637
|
-
const windows = arrayGroup(days, step);
|
|
638
|
-
return windows.map((w) => [w[0], w[w.length - 1]]);
|
|
639
|
-
}
|
|
640
640
|
// src/indexer.ts
|
|
641
641
|
import meow from "meow";
|
|
642
642
|
var STATE_TABLE_NAME = "skynet-" + getEnvironment() + "-indexer-state";
|
package/dist/opsgenie.d.ts
CHANGED
|
@@ -1,21 +1,99 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
export type OpsgeniePriority = "P1" | "P2" | "P3" | "P4" | "P5";
|
|
2
|
+
export interface TeamRefById {
|
|
3
|
+
id: string;
|
|
4
|
+
type: "team";
|
|
5
|
+
}
|
|
6
|
+
export interface TeamRefByName {
|
|
7
|
+
name: string;
|
|
8
|
+
type: "team";
|
|
9
|
+
}
|
|
10
|
+
export type TeamRef = TeamRefById | TeamRefByName;
|
|
11
|
+
export interface UserRefById {
|
|
12
|
+
id: string;
|
|
13
|
+
type: "user";
|
|
14
|
+
}
|
|
15
|
+
export interface UserRefByUsername {
|
|
16
|
+
username: string;
|
|
17
|
+
type: "user";
|
|
18
|
+
}
|
|
19
|
+
export type UserRef = UserRefById | UserRefByUsername;
|
|
20
|
+
export interface EscalationRefById {
|
|
21
|
+
id: string;
|
|
22
|
+
type: "escalation";
|
|
23
|
+
}
|
|
24
|
+
export interface EscalationRefByName {
|
|
25
|
+
name: string;
|
|
26
|
+
type: "escalation";
|
|
27
|
+
}
|
|
28
|
+
export type EscalationRef = EscalationRefById | EscalationRefByName;
|
|
29
|
+
export interface ScheduleRefById {
|
|
30
|
+
id: string;
|
|
31
|
+
type: "schedule";
|
|
32
|
+
}
|
|
33
|
+
export interface ScheduleRefByName {
|
|
34
|
+
name: string;
|
|
35
|
+
type: "schedule";
|
|
36
|
+
}
|
|
37
|
+
export type ScheduleRef = ScheduleRefById | ScheduleRefByName;
|
|
38
|
+
export type ResponderRef = TeamRef | UserRef | EscalationRef | ScheduleRef;
|
|
39
|
+
export interface VisibleToTeamById {
|
|
40
|
+
id: string;
|
|
41
|
+
type: "team";
|
|
42
|
+
}
|
|
43
|
+
export interface VisibleToTeamByName {
|
|
44
|
+
name: string;
|
|
45
|
+
type: "team";
|
|
46
|
+
}
|
|
47
|
+
export type VisibleToTeam = VisibleToTeamById | VisibleToTeamByName;
|
|
48
|
+
export interface VisibleToUserById {
|
|
49
|
+
id: string;
|
|
50
|
+
type: "user";
|
|
51
|
+
}
|
|
52
|
+
export interface VisibleToUserByUsername {
|
|
53
|
+
username: string;
|
|
54
|
+
type: "user";
|
|
55
|
+
}
|
|
56
|
+
export type VisibleToUser = VisibleToUserById | VisibleToUserByUsername;
|
|
57
|
+
export type VisibleToRef = VisibleToTeam | VisibleToUser;
|
|
58
|
+
export interface CreateAlertRequest {
|
|
18
59
|
message: string;
|
|
60
|
+
alias?: string;
|
|
19
61
|
description?: string;
|
|
20
|
-
|
|
21
|
-
|
|
62
|
+
responders?: ResponderRef[];
|
|
63
|
+
visibleTo?: VisibleToRef[];
|
|
64
|
+
actions?: string[];
|
|
65
|
+
tags?: string[];
|
|
66
|
+
details?: Record<string, string>;
|
|
67
|
+
entity?: string;
|
|
68
|
+
source?: string;
|
|
69
|
+
priority?: OpsgeniePriority;
|
|
70
|
+
user?: string;
|
|
71
|
+
note?: string;
|
|
72
|
+
}
|
|
73
|
+
export interface OpsgenieAcceptedResponse {
|
|
74
|
+
result: string;
|
|
75
|
+
took: number;
|
|
76
|
+
requestId: string;
|
|
77
|
+
}
|
|
78
|
+
export interface OpsgenieRequestStatusData {
|
|
79
|
+
success: boolean;
|
|
80
|
+
action: string;
|
|
81
|
+
processedAt: string;
|
|
82
|
+
integrationId: string;
|
|
83
|
+
isSuccess: boolean;
|
|
84
|
+
status: string;
|
|
85
|
+
alertId: string;
|
|
86
|
+
alias: string;
|
|
87
|
+
}
|
|
88
|
+
export interface OpsgenieRequestStatusResponse extends OpsgenieAcceptedResponse {
|
|
89
|
+
data: OpsgenieRequestStatusData;
|
|
90
|
+
}
|
|
91
|
+
export type OpsgenieResponse = OpsgenieAcceptedResponse | OpsgenieRequestStatusResponse;
|
|
92
|
+
export interface OpsgenieErrorResponse {
|
|
93
|
+
message?: string;
|
|
94
|
+
took?: number;
|
|
95
|
+
requestId?: string;
|
|
96
|
+
errors?: unknown;
|
|
97
|
+
status?: number | string;
|
|
98
|
+
}
|
|
99
|
+
export declare function postGenieMessage(body: CreateAlertRequest, apiKey?: string, verbose?: boolean): Promise<OpsgenieResponse>;
|
package/dist/opsgenie.js
CHANGED
|
@@ -24,11 +24,15 @@ async function postGenieMessage(body, apiKey, verbose) {
|
|
|
24
24
|
},
|
|
25
25
|
body: JSON.stringify(body)
|
|
26
26
|
});
|
|
27
|
-
const
|
|
27
|
+
const json = await response.json();
|
|
28
28
|
if (verbose) {
|
|
29
|
-
console.log(
|
|
29
|
+
console.log("Result of API call to Opsgenie...", json);
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
if ("result" in json) {
|
|
32
|
+
return json;
|
|
33
|
+
}
|
|
34
|
+
console.error("Error response from Opsgenie API", json);
|
|
35
|
+
throw new Error(json.message || "Unknown error from Opsgenie API");
|
|
32
36
|
} catch (error) {
|
|
33
37
|
console.error("Failed to make opsgenie API call", error);
|
|
34
38
|
throw error;
|
package/examples/api.ts
CHANGED
|
File without changes
|
package/examples/indexer.ts
CHANGED
|
File without changes
|
package/examples/mode-indexer.ts
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@certik/skynet",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.3",
|
|
4
4
|
"description": "Skynet Shared JS library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -151,4 +151,4 @@
|
|
|
151
151
|
"patchedDependencies": {
|
|
152
152
|
"@databricks/sql@1.9.0": "patches/@databricks%2Fsql@1.9.0.patch"
|
|
153
153
|
}
|
|
154
|
-
}
|
|
154
|
+
}
|