@cloudtower/eagle 0.27.2 → 0.27.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.
@@ -0,0 +1,65 @@
1
+ import dayjs from "dayjs";
2
+ type PresetValidator = (args: {
3
+ date: dayjs.Dayjs;
4
+ lastSendAt: dayjs.Dayjs | null;
5
+ args: string[];
6
+ }) => boolean;
7
+ export declare class CronTime {
8
+ source: dayjs.Dayjs | string;
9
+ presetValidation?: PresetValidator;
10
+ presetArgs?: string[];
11
+ presetStep?: number;
12
+ realDate: boolean;
13
+ utcOffset?: number;
14
+ startAt?: dayjs.Dayjs;
15
+ unitMap: Record<string, Record<string, boolean>>;
16
+ lastSendAt: dayjs.Dayjs | null;
17
+ constructor(source: Date | string, startAt?: dayjs.Dayjs, utcOffset?: number);
18
+ /**
19
+ * Calculate the "next" scheduled time
20
+ */
21
+ sendAt(): dayjs.Dayjs;
22
+ sendAt(i: number): dayjs.Dayjs[];
23
+ /**
24
+ * Get the number of milliseconds in the future at which to fire our callbacks.
25
+ */
26
+ getTimeout(): number;
27
+ /**
28
+ * writes out a cron string
29
+ */
30
+ toString(): string;
31
+ /**
32
+ * Json representation of the parsed cron syntax.
33
+ */
34
+ toJSON(): string[];
35
+ setLastSendAt(date: dayjs.Dayjs): void;
36
+ private parse;
37
+ private parsePrestArgs;
38
+ private parseField;
39
+ private verifyParse;
40
+ private getNextDateFromWithValidation;
41
+ /**
42
+ * Get next date matching the specified cron time.
43
+ *
44
+ * Algorithm:
45
+ * - Start with a start date and a parsed crontime.
46
+ * - Loop until 5 seconds have passed, or we found the next date.
47
+ * - Within the loop:
48
+ * - If it took longer than 5 seconds to select a date, throw an exception.
49
+ * - Find the next month to run at.
50
+ * - Find the next day of the month to run at.
51
+ * - Find the next day of the week to run at.
52
+ * - Find the next hour to run at.
53
+ * - Find the next minute to run at.
54
+ * - Find the next second to run at.
55
+ * - Check that the chosen time does not equal the current execution.
56
+ * - Return the selected date object.
57
+ */
58
+ private getNextDateFrom;
59
+ /**
60
+ * wildcard, or all params in array (for to string)
61
+ */
62
+ private wcOrAll;
63
+ private hasAll;
64
+ }
65
+ export {};
@@ -1,4 +1,7 @@
1
+ export * from "./compute";
1
2
  export * from "./constants";
3
+ export * from "./cron-time";
2
4
  export * from "./dom";
3
5
  export * from "./formatValue";
4
6
  export * from "./icon";
7
+ export * from "./time";
@@ -0,0 +1,25 @@
1
+ import dayjs from "dayjs";
2
+ import { CronTime } from "./cron-time";
3
+ export declare const DEFAULT_TIME: dayjs.Dayjs;
4
+ export declare function getTime(cronTime: CronTime, isUTC?: boolean): dayjs.Dayjs;
5
+ export type CronMode = "day" | "week" | "month";
6
+ export declare function getMode(source: string): CronMode;
7
+ export declare function getDaily(mode: CronMode, source: string, time: dayjs.Dayjs, defaultTime?: dayjs.Dayjs): {
8
+ step: number;
9
+ time: dayjs.Dayjs;
10
+ };
11
+ export declare function toDailyString(step: number, time: dayjs.Dayjs): string;
12
+ export declare function getWeekly(mode: CronMode, source: string, time: dayjs.Dayjs, defaultTime?: dayjs.Dayjs): {
13
+ step: number;
14
+ days: number[];
15
+ time: dayjs.Dayjs;
16
+ };
17
+ export declare function toWeeklyString(step: number, time: dayjs.Dayjs, days: number[]): string;
18
+ export declare function getMonthly(mode: CronMode, month: string, day: string, time: dayjs.Dayjs, defaultTime?: dayjs.Dayjs): {
19
+ step: number;
20
+ days: number[];
21
+ time: dayjs.Dayjs;
22
+ };
23
+ export declare function toMonthlyString(step: number, time: dayjs.Dayjs, days: number[]): string;
24
+ export declare function transformPeriodToLocal(period: string | undefined, start_at?: string): string;
25
+ export declare function transformPeriodToUTC(period: string | undefined, start_at?: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudtower/eagle",
3
- "version": "0.27.2",
3
+ "version": "0.27.3",
4
4
  "main": "dist/umd/index.js",
5
5
  "module": "./dist/esm/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,8 +28,8 @@
28
28
  "build-storybook": "storybook build"
29
29
  },
30
30
  "dependencies": {
31
- "@cloudtower/icons-react": "0.27.2",
32
- "@cloudtower/parrot": "0.27.2",
31
+ "@cloudtower/icons-react": "0.27.3",
32
+ "@cloudtower/parrot": "0.27.3",
33
33
  "@cloudtower/rc-notification": "^4.6.1",
34
34
  "@linaria/core": "^4.2.2",
35
35
  "@linaria/react": "^4.3.0",
@@ -50,7 +50,7 @@
50
50
  "@babel/preset-env": "^7.22.15",
51
51
  "@babel/preset-react": "^7.22.15",
52
52
  "@babel/preset-typescript": "^7.22.15",
53
- "@cloudtower/icons": "0.27.2",
53
+ "@cloudtower/icons": "0.27.3",
54
54
  "@linaria/babel-preset": "4.4.1",
55
55
  "@linaria/rollup": "^4.1.5",
56
56
  "@linaria/vite": "^4.2.5",
@@ -83,6 +83,7 @@
83
83
  "less": "^4.1.3",
84
84
  "linaria": "^4.1.13",
85
85
  "mini-css-extract-plugin": "^2.7.2",
86
+ "mockdate": "^3.0.5",
86
87
  "postcss": "^8.4.20",
87
88
  "postcss-url": "^10.1.3",
88
89
  "react": "17.0.2",
@@ -106,5 +107,5 @@
106
107
  "vite": "^3.1.7",
107
108
  "vitest": "^0.24.1"
108
109
  },
109
- "gitHead": "a9ddd849dbb19a2a6643cdf31f899898f41674be"
110
+ "gitHead": "0b58116a659f025665b7858ee4f19f43cc89930e"
110
111
  }