@certik/skynet 0.22.0 → 0.22.1
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/abi.js +563 -614
- package/dist/address.js +21 -67
- package/dist/api.js +127 -35155
- package/dist/app.js +297 -71683
- package/dist/availability.js +54 -917
- package/dist/cli.js +24 -73
- package/dist/const.js +132 -198
- package/dist/databricks.js +54 -84906
- package/dist/date.js +21 -93
- package/dist/deploy.js +306 -17358
- package/dist/dynamodb.js +279 -27316
- package/dist/env.js +9 -61
- package/dist/graphql.js +22 -70
- package/dist/indexer.js +443 -36930
- package/dist/log.js +52 -98
- package/dist/object-hash.js +52 -427
- package/dist/opsgenie.js +31 -313
- package/dist/por.js +123 -157
- package/dist/s3.js +77 -28845
- package/dist/search.js +21 -37745
- package/dist/selector.js +38 -79
- package/dist/slack.js +19 -16837
- package/dist/util.js +20 -66
- package/examples/api.ts +0 -0
- package/examples/indexer.ts +0 -0
- package/examples/mode-indexer.ts +0 -0
- package/package.json +3 -3
- package/tsconfig.build.json +0 -1
- package/.vscode/settings.json +0 -5
- package/bun.lockb +0 -0
- package/dist/xxhash.win32-x64-msvc-hrdz34v7.node +0 -0
package/dist/date.js
CHANGED
|
@@ -1,101 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __toESM = (mod, isNodeMode, target) => {
|
|
9
|
-
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
|
-
for (let key of __getOwnPropNames(mod))
|
|
12
|
-
if (!__hasOwnProp.call(to, key))
|
|
13
|
-
__defProp(to, key, {
|
|
14
|
-
get: () => mod[key],
|
|
15
|
-
enumerable: true
|
|
16
|
-
});
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
20
|
-
var __toCommonJS = (from) => {
|
|
21
|
-
var entry = __moduleCache.get(from), desc;
|
|
22
|
-
if (entry)
|
|
23
|
-
return entry;
|
|
24
|
-
entry = __defProp({}, "__esModule", { value: true });
|
|
25
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
26
|
-
__getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
|
|
27
|
-
get: () => from[key],
|
|
28
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
-
}));
|
|
30
|
-
__moduleCache.set(from, entry);
|
|
31
|
-
return entry;
|
|
32
|
-
};
|
|
33
|
-
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
34
|
-
var __export = (target, all) => {
|
|
35
|
-
for (var name in all)
|
|
36
|
-
__defProp(target, name, {
|
|
37
|
-
get: all[name],
|
|
38
|
-
enumerable: true,
|
|
39
|
-
configurable: true,
|
|
40
|
-
set: (newValue) => all[name] = () => newValue
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
44
|
-
var __require = import.meta.require;
|
|
45
|
-
|
|
46
|
-
// util.ts
|
|
47
|
-
function range(startAt, endAt, step) {
|
|
48
|
-
const arr = [];
|
|
49
|
-
for (let i = startAt;i <= endAt; i += step) {
|
|
50
|
-
arr.push([i, Math.min(endAt, i + step - 1)]);
|
|
51
|
-
}
|
|
52
|
-
return arr;
|
|
53
|
-
}
|
|
54
|
-
function arrayGroup(array, groupSize) {
|
|
55
|
-
const groups = [];
|
|
56
|
-
for (let i = 0;i < array.length; i += groupSize) {
|
|
57
|
-
groups.push(array.slice(i, i + groupSize));
|
|
58
|
-
}
|
|
59
|
-
return groups;
|
|
60
|
-
}
|
|
61
|
-
function fillRange(start, end) {
|
|
62
|
-
const result = [];
|
|
63
|
-
for (let i = start;i <= end; i++) {
|
|
64
|
-
result.push(i);
|
|
65
|
-
}
|
|
66
|
-
return result;
|
|
67
|
-
}
|
|
68
|
-
// date.ts
|
|
69
|
-
var MS_IN_A_DAY = 3600 * 24 * 1000;
|
|
1
|
+
import { arrayGroup } from "./util";
|
|
2
|
+
const MS_IN_A_DAY = 3600 * 24 * 1000;
|
|
70
3
|
function getDateOnly(date) {
|
|
71
|
-
|
|
4
|
+
return new Date(date).toISOString().split("T")[0];
|
|
72
5
|
}
|
|
73
6
|
function findDateAfter(date, n) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
7
|
+
const d = new Date(date);
|
|
8
|
+
const after = new Date(d.getTime() + MS_IN_A_DAY * n);
|
|
9
|
+
return getDateOnly(after);
|
|
77
10
|
}
|
|
78
11
|
function daysInRange(from, to) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
12
|
+
const fromTime = new Date(from).getTime();
|
|
13
|
+
const toTime = new Date(to).getTime();
|
|
14
|
+
if (fromTime > toTime) {
|
|
15
|
+
throw new Error(`range to date couldn't be earlier than range from date`);
|
|
16
|
+
}
|
|
17
|
+
const daysBetween = Math.floor((toTime - fromTime) / MS_IN_A_DAY);
|
|
18
|
+
const dates = [getDateOnly(new Date(fromTime))];
|
|
19
|
+
for (let i = 1; i <= daysBetween; i += 1) {
|
|
20
|
+
dates.push(getDateOnly(new Date(fromTime + i * MS_IN_A_DAY)));
|
|
21
|
+
}
|
|
22
|
+
return dates;
|
|
90
23
|
}
|
|
91
24
|
function dateRange(from, to, step) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
25
|
+
const days = daysInRange(from, to);
|
|
26
|
+
const windows = arrayGroup(days, step);
|
|
27
|
+
return windows.map((w) => [w[0], w[w.length - 1]]);
|
|
95
28
|
}
|
|
96
|
-
export {
|
|
97
|
-
getDateOnly,
|
|
98
|
-
findDateAfter,
|
|
99
|
-
daysInRange,
|
|
100
|
-
dateRange
|
|
101
|
-
};
|
|
29
|
+
export { getDateOnly, findDateAfter, daysInRange, dateRange };
|