semola 0.5.3 → 0.6.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 +18 -45
- package/dist/chunk-CKQMccvm.cjs +28 -0
- package/dist/lib/api/index.cjs +536 -4
- package/dist/lib/api/index.d.cts +270 -4
- package/dist/lib/api/index.d.mts +270 -4
- package/dist/lib/api/index.mjs +534 -2
- package/dist/lib/cache/index.cjs +47 -22
- package/dist/lib/cache/index.d.cts +14 -23
- package/dist/lib/cache/index.d.mts +14 -23
- package/dist/lib/cache/index.mjs +48 -25
- package/dist/lib/cron/index.cjs +734 -12
- package/dist/lib/cron/index.d.cts +145 -3
- package/dist/lib/cron/index.d.mts +145 -3
- package/dist/lib/cron/index.mjs +725 -3
- package/dist/lib/errors/index.d.cts +4 -4
- package/dist/lib/errors/index.d.mts +4 -4
- package/dist/lib/errors/index.mjs +0 -2
- package/dist/lib/i18n/index.d.cts +12 -4
- package/dist/lib/i18n/index.d.mts +12 -4
- package/dist/lib/i18n/index.mjs +0 -2
- package/dist/lib/logging/index.cjs +387 -17
- package/dist/lib/logging/index.d.cts +107 -6
- package/dist/lib/logging/index.d.mts +107 -6
- package/dist/lib/logging/index.mjs +373 -4
- package/dist/lib/orm/index.cjs +1641 -19
- package/dist/lib/orm/index.d.cts +402 -7
- package/dist/lib/orm/index.d.mts +402 -7
- package/dist/lib/orm/index.mjs +1630 -6
- package/dist/lib/policy/index.cjs +206 -20
- package/dist/lib/policy/index.d.cts +61 -5
- package/dist/lib/policy/index.d.mts +61 -5
- package/dist/lib/policy/index.mjs +187 -3
- package/dist/lib/prompts/index.cjs +374 -14
- package/dist/lib/prompts/index.d.cts +73 -29
- package/dist/lib/prompts/index.d.mts +73 -29
- package/dist/lib/prompts/index.mjs +361 -4
- package/dist/lib/pubsub/index.cjs +43 -19
- package/dist/lib/pubsub/index.d.cts +12 -22
- package/dist/lib/pubsub/index.d.mts +12 -22
- package/dist/lib/pubsub/index.mjs +44 -22
- package/dist/lib/queue/index.cjs +40 -10
- package/dist/lib/queue/index.d.cts +57 -8
- package/dist/lib/queue/index.d.mts +57 -8
- package/dist/lib/queue/index.mjs +39 -13
- package/dist/lib/workflow/index.cjs +285 -282
- package/dist/lib/workflow/index.d.cts +147 -4
- package/dist/lib/workflow/index.d.mts +147 -4
- package/dist/lib/workflow/index.mjs +278 -286
- package/package.json +11 -1
- package/dist/api/core/index.cjs +0 -206
- package/dist/api/core/index.d.cts +0 -21
- package/dist/api/core/index.d.cts.map +0 -1
- package/dist/api/core/index.d.mts +0 -21
- package/dist/api/core/index.d.mts.map +0 -1
- package/dist/api/core/index.mjs +0 -208
- package/dist/api/core/index.mjs.map +0 -1
- package/dist/api/core/types.d.cts +0 -107
- package/dist/api/core/types.d.cts.map +0 -1
- package/dist/api/core/types.d.mts +0 -107
- package/dist/api/core/types.d.mts.map +0 -1
- package/dist/api/middleware/index.cjs +0 -8
- package/dist/api/middleware/index.d.cts +0 -11
- package/dist/api/middleware/index.d.cts.map +0 -1
- package/dist/api/middleware/index.d.mts +0 -11
- package/dist/api/middleware/index.d.mts.map +0 -1
- package/dist/api/middleware/index.mjs +0 -10
- package/dist/api/middleware/index.mjs.map +0 -1
- package/dist/api/middleware/types.d.cts +0 -16
- package/dist/api/middleware/types.d.cts.map +0 -1
- package/dist/api/middleware/types.d.mts +0 -16
- package/dist/api/middleware/types.d.mts.map +0 -1
- package/dist/api/openapi/index.cjs +0 -254
- package/dist/api/openapi/index.mjs +0 -256
- package/dist/api/openapi/index.mjs.map +0 -1
- package/dist/api/openapi/types.d.cts +0 -60
- package/dist/api/openapi/types.d.cts.map +0 -1
- package/dist/api/openapi/types.d.mts +0 -60
- package/dist/api/openapi/types.d.mts.map +0 -1
- package/dist/api/validation/index.cjs +0 -64
- package/dist/api/validation/index.mjs +0 -61
- package/dist/api/validation/index.mjs.map +0 -1
- package/dist/cache/types.d.cts +0 -17
- package/dist/cache/types.d.cts.map +0 -1
- package/dist/cache/types.d.mts +0 -17
- package/dist/cache/types.d.mts.map +0 -1
- package/dist/cron/builder/index.cjs +0 -166
- package/dist/cron/builder/index.d.cts +0 -28
- package/dist/cron/builder/index.d.cts.map +0 -1
- package/dist/cron/builder/index.d.mts +0 -28
- package/dist/cron/builder/index.d.mts.map +0 -1
- package/dist/cron/builder/index.mjs +0 -163
- package/dist/cron/builder/index.mjs.map +0 -1
- package/dist/cron/builder/types.cjs +0 -27
- package/dist/cron/builder/types.d.cts +0 -79
- package/dist/cron/builder/types.d.cts.map +0 -1
- package/dist/cron/builder/types.d.mts +0 -79
- package/dist/cron/builder/types.d.mts.map +0 -1
- package/dist/cron/builder/types.mjs +0 -28
- package/dist/cron/builder/types.mjs.map +0 -1
- package/dist/cron/core/index.cjs +0 -308
- package/dist/cron/core/index.d.cts +0 -39
- package/dist/cron/core/index.d.cts.map +0 -1
- package/dist/cron/core/index.d.mts +0 -39
- package/dist/cron/core/index.d.mts.map +0 -1
- package/dist/cron/core/index.mjs +0 -310
- package/dist/cron/core/index.mjs.map +0 -1
- package/dist/cron/core/scanner.cjs +0 -237
- package/dist/cron/core/scanner.mjs +0 -238
- package/dist/cron/core/scanner.mjs.map +0 -1
- package/dist/cron/core/types.d.cts +0 -11
- package/dist/cron/core/types.d.cts.map +0 -1
- package/dist/cron/core/types.d.mts +0 -11
- package/dist/cron/core/types.d.mts.map +0 -1
- package/dist/errors/types.d.cts +0 -5
- package/dist/errors/types.d.cts.map +0 -1
- package/dist/errors/types.d.mts +0 -5
- package/dist/errors/types.d.mts.map +0 -1
- package/dist/i18n/types.d.cts +0 -13
- package/dist/i18n/types.d.cts.map +0 -1
- package/dist/i18n/types.d.mts +0 -13
- package/dist/i18n/types.d.mts.map +0 -1
- package/dist/lib/cache/index.d.cts.map +0 -1
- package/dist/lib/cache/index.d.mts.map +0 -1
- package/dist/lib/cache/index.mjs.map +0 -1
- package/dist/lib/errors/index.d.cts.map +0 -1
- package/dist/lib/errors/index.d.mts.map +0 -1
- package/dist/lib/errors/index.mjs.map +0 -1
- package/dist/lib/i18n/index.d.cts.map +0 -1
- package/dist/lib/i18n/index.d.mts.map +0 -1
- package/dist/lib/i18n/index.mjs.map +0 -1
- package/dist/lib/policy/index.d.cts.map +0 -1
- package/dist/lib/policy/index.d.mts.map +0 -1
- package/dist/lib/policy/index.mjs.map +0 -1
- package/dist/lib/prompts/index.d.cts.map +0 -1
- package/dist/lib/prompts/index.d.mts.map +0 -1
- package/dist/lib/prompts/index.mjs.map +0 -1
- package/dist/lib/pubsub/index.d.cts.map +0 -1
- package/dist/lib/pubsub/index.d.mts.map +0 -1
- package/dist/lib/pubsub/index.mjs.map +0 -1
- package/dist/lib/queue/index.d.cts.map +0 -1
- package/dist/lib/queue/index.d.mts.map +0 -1
- package/dist/lib/queue/index.mjs.map +0 -1
- package/dist/lib/workflow/index.d.cts.map +0 -1
- package/dist/lib/workflow/index.d.mts.map +0 -1
- package/dist/lib/workflow/index.mjs.map +0 -1
- package/dist/logging/core/index.cjs +0 -99
- package/dist/logging/core/index.d.cts +0 -26
- package/dist/logging/core/index.d.cts.map +0 -1
- package/dist/logging/core/index.d.mts +0 -26
- package/dist/logging/core/index.d.mts.map +0 -1
- package/dist/logging/core/index.mjs +0 -99
- package/dist/logging/core/index.mjs.map +0 -1
- package/dist/logging/core/types.cjs +0 -10
- package/dist/logging/core/types.d.cts +0 -22
- package/dist/logging/core/types.d.cts.map +0 -1
- package/dist/logging/core/types.d.mts +0 -22
- package/dist/logging/core/types.d.mts.map +0 -1
- package/dist/logging/core/types.mjs +0 -12
- package/dist/logging/core/types.mjs.map +0 -1
- package/dist/logging/formatter/index.cjs +0 -119
- package/dist/logging/formatter/index.d.cts +0 -27
- package/dist/logging/formatter/index.d.cts.map +0 -1
- package/dist/logging/formatter/index.d.mts +0 -27
- package/dist/logging/formatter/index.d.mts.map +0 -1
- package/dist/logging/formatter/index.mjs +0 -115
- package/dist/logging/formatter/index.mjs.map +0 -1
- package/dist/logging/formatter/types.d.cts +0 -5
- package/dist/logging/formatter/types.d.cts.map +0 -1
- package/dist/logging/formatter/types.d.mts +0 -5
- package/dist/logging/formatter/types.d.mts.map +0 -1
- package/dist/logging/provider/index.cjs +0 -165
- package/dist/logging/provider/index.d.cts +0 -28
- package/dist/logging/provider/index.d.cts.map +0 -1
- package/dist/logging/provider/index.d.mts +0 -28
- package/dist/logging/provider/index.d.mts.map +0 -1
- package/dist/logging/provider/index.mjs +0 -165
- package/dist/logging/provider/index.mjs.map +0 -1
- package/dist/logging/provider/types.d.cts +0 -23
- package/dist/logging/provider/types.d.cts.map +0 -1
- package/dist/logging/provider/types.d.mts +0 -23
- package/dist/logging/provider/types.d.mts.map +0 -1
- package/dist/node_modules/@standard-schema/spec/dist/index.d.cts +0 -80
- package/dist/node_modules/@standard-schema/spec/dist/index.d.cts.map +0 -1
- package/dist/node_modules/@standard-schema/spec/dist/index.d.mts +0 -80
- package/dist/node_modules/@standard-schema/spec/dist/index.d.mts.map +0 -1
- package/dist/orm/column.cjs +0 -137
- package/dist/orm/column.d.cts +0 -121
- package/dist/orm/column.d.cts.map +0 -1
- package/dist/orm/column.d.mts +0 -121
- package/dist/orm/column.d.mts.map +0 -1
- package/dist/orm/column.mjs +0 -132
- package/dist/orm/column.mjs.map +0 -1
- package/dist/orm/dialect/index.cjs +0 -14
- package/dist/orm/dialect/index.mjs +0 -16
- package/dist/orm/dialect/index.mjs.map +0 -1
- package/dist/orm/dialect/mysql.cjs +0 -31
- package/dist/orm/dialect/mysql.mjs +0 -33
- package/dist/orm/dialect/mysql.mjs.map +0 -1
- package/dist/orm/dialect/postgres.cjs +0 -23
- package/dist/orm/dialect/postgres.mjs +0 -25
- package/dist/orm/dialect/postgres.mjs.map +0 -1
- package/dist/orm/dialect/sqlite.cjs +0 -31
- package/dist/orm/dialect/sqlite.mjs +0 -33
- package/dist/orm/dialect/sqlite.mjs.map +0 -1
- package/dist/orm/dialect/utils.cjs +0 -8
- package/dist/orm/dialect/utils.mjs +0 -10
- package/dist/orm/dialect/utils.mjs.map +0 -1
- package/dist/orm/internal/table-columns.cjs +0 -31
- package/dist/orm/internal/table-columns.mjs +0 -32
- package/dist/orm/internal/table-columns.mjs.map +0 -1
- package/dist/orm/internal/table-lookup.cjs +0 -35
- package/dist/orm/internal/table-lookup.mjs +0 -35
- package/dist/orm/internal/table-lookup.mjs.map +0 -1
- package/dist/orm/internal/table-relations.cjs +0 -28
- package/dist/orm/internal/table-relations.mjs +0 -29
- package/dist/orm/internal/table-relations.mjs.map +0 -1
- package/dist/orm/migration/config.cjs +0 -7
- package/dist/orm/migration/config.d.cts +0 -7
- package/dist/orm/migration/config.d.cts.map +0 -1
- package/dist/orm/migration/config.d.mts +0 -7
- package/dist/orm/migration/config.d.mts.map +0 -1
- package/dist/orm/migration/config.mjs +0 -8
- package/dist/orm/migration/config.mjs.map +0 -1
- package/dist/orm/migration/types.d.cts +0 -20
- package/dist/orm/migration/types.d.cts.map +0 -1
- package/dist/orm/migration/types.d.mts +0 -20
- package/dist/orm/migration/types.d.mts.map +0 -1
- package/dist/orm/orm.cjs +0 -41
- package/dist/orm/orm.d.cts +0 -18
- package/dist/orm/orm.d.cts.map +0 -1
- package/dist/orm/orm.d.mts +0 -18
- package/dist/orm/orm.d.mts.map +0 -1
- package/dist/orm/orm.mjs +0 -43
- package/dist/orm/orm.mjs.map +0 -1
- package/dist/orm/relation.cjs +0 -18
- package/dist/orm/relation.d.cts +0 -8
- package/dist/orm/relation.d.cts.map +0 -1
- package/dist/orm/relation.d.mts +0 -8
- package/dist/orm/relation.d.mts.map +0 -1
- package/dist/orm/relation.mjs +0 -19
- package/dist/orm/relation.mjs.map +0 -1
- package/dist/orm/runtime/builders/mutations.cjs +0 -29
- package/dist/orm/runtime/builders/mutations.mjs +0 -28
- package/dist/orm/runtime/builders/mutations.mjs.map +0 -1
- package/dist/orm/runtime/builders/select.cjs +0 -18
- package/dist/orm/runtime/builders/select.mjs +0 -19
- package/dist/orm/runtime/builders/select.mjs.map +0 -1
- package/dist/orm/runtime/client.cjs +0 -90
- package/dist/orm/runtime/client.mjs +0 -92
- package/dist/orm/runtime/client.mjs.map +0 -1
- package/dist/orm/runtime/context.cjs +0 -49
- package/dist/orm/runtime/context.mjs +0 -51
- package/dist/orm/runtime/context.mjs.map +0 -1
- package/dist/orm/runtime/dialect/index.cjs +0 -11
- package/dist/orm/runtime/dialect/index.mjs +0 -13
- package/dist/orm/runtime/dialect/index.mjs.map +0 -1
- package/dist/orm/runtime/dialect/mysql.cjs +0 -95
- package/dist/orm/runtime/dialect/mysql.mjs +0 -97
- package/dist/orm/runtime/dialect/mysql.mjs.map +0 -1
- package/dist/orm/runtime/dialect/postgres.cjs +0 -51
- package/dist/orm/runtime/dialect/postgres.mjs +0 -53
- package/dist/orm/runtime/dialect/postgres.mjs.map +0 -1
- package/dist/orm/runtime/dialect/sqlite.cjs +0 -4
- package/dist/orm/runtime/dialect/sqlite.mjs +0 -7
- package/dist/orm/runtime/dialect/sqlite.mjs.map +0 -1
- package/dist/orm/runtime/errors.cjs +0 -19
- package/dist/orm/runtime/errors.mjs +0 -21
- package/dist/orm/runtime/errors.mjs.map +0 -1
- package/dist/orm/runtime/hydrate/many.cjs +0 -46
- package/dist/orm/runtime/hydrate/many.mjs +0 -48
- package/dist/orm/runtime/hydrate/many.mjs.map +0 -1
- package/dist/orm/runtime/hydrate/one.cjs +0 -38
- package/dist/orm/runtime/hydrate/one.mjs +0 -40
- package/dist/orm/runtime/hydrate/one.mjs.map +0 -1
- package/dist/orm/runtime/hydrate.cjs +0 -49
- package/dist/orm/runtime/hydrate.mjs +0 -51
- package/dist/orm/runtime/hydrate.mjs.map +0 -1
- package/dist/orm/runtime/rows.cjs +0 -30
- package/dist/orm/runtime/rows.mjs +0 -31
- package/dist/orm/runtime/rows.mjs.map +0 -1
- package/dist/orm/runtime/utils.cjs +0 -27
- package/dist/orm/runtime/utils.mjs +0 -27
- package/dist/orm/runtime/utils.mjs.map +0 -1
- package/dist/orm/sql/parse-array.cjs +0 -64
- package/dist/orm/sql/parse-array.mjs +0 -66
- package/dist/orm/sql/parse-array.mjs.map +0 -1
- package/dist/orm/sql/plan/select.cjs +0 -36
- package/dist/orm/sql/plan/select.mjs +0 -38
- package/dist/orm/sql/plan/select.mjs.map +0 -1
- package/dist/orm/sql/plan/where/operators.cjs +0 -95
- package/dist/orm/sql/plan/where/operators.mjs +0 -97
- package/dist/orm/sql/plan/where/operators.mjs.map +0 -1
- package/dist/orm/sql/plan/where.cjs +0 -59
- package/dist/orm/sql/plan/where.mjs +0 -61
- package/dist/orm/sql/plan/where.mjs.map +0 -1
- package/dist/orm/sql/serialize/clauses.cjs +0 -36
- package/dist/orm/sql/serialize/clauses.mjs +0 -37
- package/dist/orm/sql/serialize/clauses.mjs.map +0 -1
- package/dist/orm/sql/serialize/joins.cjs +0 -31
- package/dist/orm/sql/serialize/joins.mjs +0 -33
- package/dist/orm/sql/serialize/joins.mjs.map +0 -1
- package/dist/orm/sql/serialize/values.cjs +0 -30
- package/dist/orm/sql/serialize/values.mjs +0 -32
- package/dist/orm/sql/serialize/values.mjs.map +0 -1
- package/dist/orm/sql/serialize/where/predicate.cjs +0 -73
- package/dist/orm/sql/serialize/where/predicate.mjs +0 -75
- package/dist/orm/sql/serialize/where/predicate.mjs.map +0 -1
- package/dist/orm/sql/serialize/where/tree.cjs +0 -26
- package/dist/orm/sql/serialize/where/tree.mjs +0 -28
- package/dist/orm/sql/serialize/where/tree.mjs.map +0 -1
- package/dist/orm/sql/serialize/where.cjs +0 -10
- package/dist/orm/sql/serialize/where.mjs +0 -12
- package/dist/orm/sql/serialize/where.mjs.map +0 -1
- package/dist/orm/sql/serialize.cjs +0 -24
- package/dist/orm/sql/serialize.mjs +0 -25
- package/dist/orm/sql/serialize.mjs.map +0 -1
- package/dist/orm/table.cjs +0 -12
- package/dist/orm/table.d.cts +0 -12
- package/dist/orm/table.d.cts.map +0 -1
- package/dist/orm/table.d.mts +0 -12
- package/dist/orm/table.d.mts.map +0 -1
- package/dist/orm/table.mjs +0 -14
- package/dist/orm/table.mjs.map +0 -1
- package/dist/orm/types.d.cts +0 -183
- package/dist/orm/types.d.cts.map +0 -1
- package/dist/orm/types.d.mts +0 -183
- package/dist/orm/types.d.mts.map +0 -1
- package/dist/policy/helpers.cjs +0 -206
- package/dist/policy/helpers.d.cts +0 -50
- package/dist/policy/helpers.d.cts.map +0 -1
- package/dist/policy/helpers.d.mts +0 -50
- package/dist/policy/helpers.d.mts.map +0 -1
- package/dist/policy/helpers.mjs +0 -190
- package/dist/policy/helpers.mjs.map +0 -1
- package/dist/policy/types.d.cts +0 -16
- package/dist/policy/types.d.cts.map +0 -1
- package/dist/policy/types.d.mts +0 -16
- package/dist/policy/types.d.mts.map +0 -1
- package/dist/prompts/core/keys.cjs +0 -165
- package/dist/prompts/core/keys.mjs +0 -167
- package/dist/prompts/core/keys.mjs.map +0 -1
- package/dist/prompts/core/runtime.cjs +0 -104
- package/dist/prompts/core/runtime.mjs +0 -106
- package/dist/prompts/core/runtime.mjs.map +0 -1
- package/dist/prompts/core/session.cjs +0 -98
- package/dist/prompts/core/session.mjs +0 -100
- package/dist/prompts/core/session.mjs.map +0 -1
- package/dist/prompts/core/types.d.cts +0 -21
- package/dist/prompts/core/types.d.cts.map +0 -1
- package/dist/prompts/core/types.d.mts +0 -21
- package/dist/prompts/core/types.d.mts.map +0 -1
- package/dist/prompts/types.d.cts +0 -52
- package/dist/prompts/types.d.cts.map +0 -1
- package/dist/prompts/types.d.mts +0 -52
- package/dist/prompts/types.d.mts.map +0 -1
- package/dist/pubsub/types.d.cts +0 -10
- package/dist/pubsub/types.d.cts.map +0 -1
- package/dist/pubsub/types.d.mts +0 -10
- package/dist/pubsub/types.d.mts.map +0 -1
- package/dist/queue/types.d.cts +0 -47
- package/dist/queue/types.d.cts.map +0 -1
- package/dist/queue/types.d.mts +0 -47
- package/dist/queue/types.d.mts.map +0 -1
- package/dist/workflow/types.d.cts +0 -83
- package/dist/workflow/types.d.cts.map +0 -1
- package/dist/workflow/types.d.mts +0 -83
- package/dist/workflow/types.d.mts.map +0 -1
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
//#region src/lib/cron/builder/index.ts
|
|
2
|
-
const CRON_FIELD_ORDER = [
|
|
3
|
-
"second",
|
|
4
|
-
"minute",
|
|
5
|
-
"hour",
|
|
6
|
-
"day",
|
|
7
|
-
"month",
|
|
8
|
-
"weekday"
|
|
9
|
-
];
|
|
10
|
-
var FieldWrapper = class {
|
|
11
|
-
fields = [];
|
|
12
|
-
add(expr) {
|
|
13
|
-
this.fields.push(expr);
|
|
14
|
-
}
|
|
15
|
-
read() {
|
|
16
|
-
return this.fields;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
var CronListBuilder = class {
|
|
20
|
-
wrapper;
|
|
21
|
-
constructor(wrapper) {
|
|
22
|
-
this.wrapper = wrapper;
|
|
23
|
-
}
|
|
24
|
-
any() {
|
|
25
|
-
this.wrapper.add({ type: "any" });
|
|
26
|
-
return this;
|
|
27
|
-
}
|
|
28
|
-
range(options) {
|
|
29
|
-
this.wrapper.add({
|
|
30
|
-
type: "range",
|
|
31
|
-
...options
|
|
32
|
-
});
|
|
33
|
-
return this;
|
|
34
|
-
}
|
|
35
|
-
step(options) {
|
|
36
|
-
this.wrapper.add({
|
|
37
|
-
type: "step",
|
|
38
|
-
...options
|
|
39
|
-
});
|
|
40
|
-
return this;
|
|
41
|
-
}
|
|
42
|
-
number(value) {
|
|
43
|
-
this.wrapper.add({
|
|
44
|
-
type: "value",
|
|
45
|
-
value
|
|
46
|
-
});
|
|
47
|
-
return this;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
function range(options) {
|
|
51
|
-
return {
|
|
52
|
-
type: "range",
|
|
53
|
-
...options
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function any() {
|
|
57
|
-
return { type: "any" };
|
|
58
|
-
}
|
|
59
|
-
function step(options) {
|
|
60
|
-
return {
|
|
61
|
-
type: "step",
|
|
62
|
-
...options
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
function list(builderFn) {
|
|
66
|
-
const wrapper = new FieldWrapper();
|
|
67
|
-
builderFn(new CronListBuilder(wrapper));
|
|
68
|
-
return {
|
|
69
|
-
type: "list",
|
|
70
|
-
values: wrapper.read()
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
function number(value) {
|
|
74
|
-
return {
|
|
75
|
-
type: "value",
|
|
76
|
-
value
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
function cronJobBuilder(buildFn) {
|
|
80
|
-
const fields = {
|
|
81
|
-
second: void 0,
|
|
82
|
-
minute: void 0,
|
|
83
|
-
hour: void 0,
|
|
84
|
-
day: void 0,
|
|
85
|
-
month: void 0,
|
|
86
|
-
weekday: void 0
|
|
87
|
-
};
|
|
88
|
-
const obj = {
|
|
89
|
-
second(expr) {
|
|
90
|
-
fields.second = checkExpr(expr);
|
|
91
|
-
return obj;
|
|
92
|
-
},
|
|
93
|
-
minute(expr) {
|
|
94
|
-
fields.minute = checkExpr(expr);
|
|
95
|
-
return obj;
|
|
96
|
-
},
|
|
97
|
-
hour(expr) {
|
|
98
|
-
fields.hour = checkExpr(expr);
|
|
99
|
-
return obj;
|
|
100
|
-
},
|
|
101
|
-
day(expr) {
|
|
102
|
-
fields.day = checkExpr(expr);
|
|
103
|
-
return obj;
|
|
104
|
-
},
|
|
105
|
-
month(expr) {
|
|
106
|
-
fields.month = checkExpr(expr);
|
|
107
|
-
return obj;
|
|
108
|
-
},
|
|
109
|
-
weekday(expr) {
|
|
110
|
-
fields.weekday = checkExpr(expr);
|
|
111
|
-
return obj;
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
buildFn(obj);
|
|
115
|
-
return generate(fields);
|
|
116
|
-
}
|
|
117
|
-
function checkExpr(expr) {
|
|
118
|
-
if (expr.type === "list") {
|
|
119
|
-
const { values } = expr;
|
|
120
|
-
if (values.length === 0) throw new Error("EmptyListError: List expression cannot be empty");
|
|
121
|
-
return values.map((e) => handleSimpleExpression(e)).join(",");
|
|
122
|
-
}
|
|
123
|
-
return handleSimpleExpression(expr);
|
|
124
|
-
}
|
|
125
|
-
function handleSimpleExpression(expr) {
|
|
126
|
-
switch (expr.type) {
|
|
127
|
-
case "any": return "*";
|
|
128
|
-
case "value": return `${expr.value}`;
|
|
129
|
-
case "range": {
|
|
130
|
-
const { min, max } = expr;
|
|
131
|
-
if (min > max) throw new Error(`OutOfBoundError: Expected ${min} <= ${max}`);
|
|
132
|
-
return `${min}-${max}`;
|
|
133
|
-
}
|
|
134
|
-
case "step": {
|
|
135
|
-
const { step, range } = expr;
|
|
136
|
-
if (step === 0) throw new Error(`OutOfBoundError: Expected step value greater than zero`);
|
|
137
|
-
if (!range) return `*/${step}`;
|
|
138
|
-
const { min, max } = range;
|
|
139
|
-
if (max === 0) {
|
|
140
|
-
if (min > max) throw new Error(`OutOfBoundError: Expected max value greater than zero`);
|
|
141
|
-
return `${min}-${max}/${step}`;
|
|
142
|
-
}
|
|
143
|
-
if (!max) return `${min}/${step}`;
|
|
144
|
-
if (min > max) throw new Error(`OutOfBoundError: Expected ${min} <= ${max}`);
|
|
145
|
-
return `${min}-${max}/${step}`;
|
|
146
|
-
}
|
|
147
|
-
default: return "*";
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
function generate(fields) {
|
|
151
|
-
const parts = [];
|
|
152
|
-
for (let index = 0; index < CRON_FIELD_ORDER.length; index++) {
|
|
153
|
-
const key = CRON_FIELD_ORDER[index];
|
|
154
|
-
if (!key) return "";
|
|
155
|
-
if (key === "second" && !fields[key]) continue;
|
|
156
|
-
parts.push(fields[key] ?? "*");
|
|
157
|
-
}
|
|
158
|
-
return parts.join(" ");
|
|
159
|
-
}
|
|
160
|
-
//#endregion
|
|
161
|
-
exports.any = any;
|
|
162
|
-
exports.cronJobBuilder = cronJobBuilder;
|
|
163
|
-
exports.list = list;
|
|
164
|
-
exports.number = number;
|
|
165
|
-
exports.range = range;
|
|
166
|
-
exports.step = step;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { BuilderFn, CronExpr, CronListExpr, CronRange, CronStep } from "./types.cjs";
|
|
2
|
-
|
|
3
|
-
//#region src/lib/cron/builder/index.d.ts
|
|
4
|
-
declare class FieldWrapper<T> {
|
|
5
|
-
private fields;
|
|
6
|
-
add(expr: CronListExpr<T>): void;
|
|
7
|
-
read(): CronListExpr<T>[];
|
|
8
|
-
}
|
|
9
|
-
declare class CronListBuilder<T> {
|
|
10
|
-
private wrapper;
|
|
11
|
-
constructor(wrapper: FieldWrapper<T>);
|
|
12
|
-
any(): CronListBuilder<T>;
|
|
13
|
-
range(options: CronRange<T>): CronListBuilder<T>;
|
|
14
|
-
step(options: CronStep<T>): CronListBuilder<T>;
|
|
15
|
-
number(value: T): CronListBuilder<T>;
|
|
16
|
-
}
|
|
17
|
-
declare function range<T>(options: CronRange<T>): CronExpr<T>;
|
|
18
|
-
declare function any<T>(): CronExpr<T>;
|
|
19
|
-
declare function step<T>(options: CronStep<T>): CronExpr<T>;
|
|
20
|
-
declare function list<T>(builderFn: (builder: CronListBuilder<T>) => CronListBuilder<T>): CronExpr<T>;
|
|
21
|
-
declare function number<T>(value: T): {
|
|
22
|
-
type: "value";
|
|
23
|
-
value: T;
|
|
24
|
-
};
|
|
25
|
-
declare function cronJobBuilder(buildFn: BuilderFn): string;
|
|
26
|
-
//#endregion
|
|
27
|
-
export { any, cronJobBuilder, list, number, range, step };
|
|
28
|
-
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/lib/cron/builder/index.ts"],"mappings":";;;cAwBM,YAAA;EAAA,QACI,MAAA;EAED,GAAA,CAAI,IAAA,EAAM,YAAA,CAAa,CAAA;EAIvB,IAAA,CAAA,GAAI,YAAA,CAAA,CAAA;AAAA;AAAA,cAKP,eAAA;EAAA,QACI,OAAA;cAEW,OAAA,EAAS,YAAA,CAAa,CAAA;EAIlC,GAAA,CAAA,GAAO,eAAA,CAAgB,CAAA;EAKvB,KAAA,CAAM,OAAA,EAAS,SAAA,CAAU,CAAA,IAAK,eAAA,CAAgB,CAAA;EAK9C,IAAA,CAAK,OAAA,EAAS,QAAA,CAAS,CAAA,IAAK,eAAA,CAAgB,CAAA;EAK5C,MAAA,CAAO,KAAA,EAAO,CAAA,GAAI,eAAA,CAAgB,CAAA;AAAA;AAAA,iBAM3B,KAAA,GAAA,CAAS,OAAA,EAAS,SAAA,CAAU,CAAA,IAAK,QAAA,CAAS,CAAA;AAAA,iBAI1C,GAAA,GAAA,CAAA,GAAU,QAAA,CAAS,CAAA;AAAA,iBAInB,IAAA,GAAA,CAAQ,OAAA,EAAS,QAAA,CAAS,CAAA,IAAK,QAAA,CAAS,CAAA;AAAA,iBAIxC,IAAA,GAAA,CACd,SAAA,GAAY,OAAA,EAAS,eAAA,CAAgB,CAAA,MAAO,eAAA,CAAgB,CAAA,IAC3D,QAAA,CAAS,CAAA;AAAA,iBAOI,MAAA,GAAA,CAAU,KAAA,EAAO,CAAA;;SAAA,CAAA;AAAA;AAAA,iBAIjB,cAAA,CAAe,OAAA,EAAS,SAAA"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { BuilderFn, CronExpr, CronListExpr, CronRange, CronStep } from "./types.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/lib/cron/builder/index.d.ts
|
|
4
|
-
declare class FieldWrapper<T> {
|
|
5
|
-
private fields;
|
|
6
|
-
add(expr: CronListExpr<T>): void;
|
|
7
|
-
read(): CronListExpr<T>[];
|
|
8
|
-
}
|
|
9
|
-
declare class CronListBuilder<T> {
|
|
10
|
-
private wrapper;
|
|
11
|
-
constructor(wrapper: FieldWrapper<T>);
|
|
12
|
-
any(): CronListBuilder<T>;
|
|
13
|
-
range(options: CronRange<T>): CronListBuilder<T>;
|
|
14
|
-
step(options: CronStep<T>): CronListBuilder<T>;
|
|
15
|
-
number(value: T): CronListBuilder<T>;
|
|
16
|
-
}
|
|
17
|
-
declare function range<T>(options: CronRange<T>): CronExpr<T>;
|
|
18
|
-
declare function any<T>(): CronExpr<T>;
|
|
19
|
-
declare function step<T>(options: CronStep<T>): CronExpr<T>;
|
|
20
|
-
declare function list<T>(builderFn: (builder: CronListBuilder<T>) => CronListBuilder<T>): CronExpr<T>;
|
|
21
|
-
declare function number<T>(value: T): {
|
|
22
|
-
type: "value";
|
|
23
|
-
value: T;
|
|
24
|
-
};
|
|
25
|
-
declare function cronJobBuilder(buildFn: BuilderFn): string;
|
|
26
|
-
//#endregion
|
|
27
|
-
export { any, cronJobBuilder, list, number, range, step };
|
|
28
|
-
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/lib/cron/builder/index.ts"],"mappings":";;;cAwBM,YAAA;EAAA,QACI,MAAA;EAED,GAAA,CAAI,IAAA,EAAM,YAAA,CAAa,CAAA;EAIvB,IAAA,CAAA,GAAI,YAAA,CAAA,CAAA;AAAA;AAAA,cAKP,eAAA;EAAA,QACI,OAAA;cAEW,OAAA,EAAS,YAAA,CAAa,CAAA;EAIlC,GAAA,CAAA,GAAO,eAAA,CAAgB,CAAA;EAKvB,KAAA,CAAM,OAAA,EAAS,SAAA,CAAU,CAAA,IAAK,eAAA,CAAgB,CAAA;EAK9C,IAAA,CAAK,OAAA,EAAS,QAAA,CAAS,CAAA,IAAK,eAAA,CAAgB,CAAA;EAK5C,MAAA,CAAO,KAAA,EAAO,CAAA,GAAI,eAAA,CAAgB,CAAA;AAAA;AAAA,iBAM3B,KAAA,GAAA,CAAS,OAAA,EAAS,SAAA,CAAU,CAAA,IAAK,QAAA,CAAS,CAAA;AAAA,iBAI1C,GAAA,GAAA,CAAA,GAAU,QAAA,CAAS,CAAA;AAAA,iBAInB,IAAA,GAAA,CAAQ,OAAA,EAAS,QAAA,CAAS,CAAA,IAAK,QAAA,CAAS,CAAA;AAAA,iBAIxC,IAAA,GAAA,CACd,SAAA,GAAY,OAAA,EAAS,eAAA,CAAgB,CAAA,MAAO,eAAA,CAAgB,CAAA,IAC3D,QAAA,CAAS,CAAA;AAAA,iBAOI,MAAA,GAAA,CAAU,KAAA,EAAO,CAAA;;SAAA,CAAA;AAAA;AAAA,iBAIjB,cAAA,CAAe,OAAA,EAAS,SAAA"}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
//#region src/lib/cron/builder/index.ts
|
|
2
|
-
const CRON_FIELD_ORDER = [
|
|
3
|
-
"second",
|
|
4
|
-
"minute",
|
|
5
|
-
"hour",
|
|
6
|
-
"day",
|
|
7
|
-
"month",
|
|
8
|
-
"weekday"
|
|
9
|
-
];
|
|
10
|
-
var FieldWrapper = class {
|
|
11
|
-
fields = [];
|
|
12
|
-
add(expr) {
|
|
13
|
-
this.fields.push(expr);
|
|
14
|
-
}
|
|
15
|
-
read() {
|
|
16
|
-
return this.fields;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
var CronListBuilder = class {
|
|
20
|
-
wrapper;
|
|
21
|
-
constructor(wrapper) {
|
|
22
|
-
this.wrapper = wrapper;
|
|
23
|
-
}
|
|
24
|
-
any() {
|
|
25
|
-
this.wrapper.add({ type: "any" });
|
|
26
|
-
return this;
|
|
27
|
-
}
|
|
28
|
-
range(options) {
|
|
29
|
-
this.wrapper.add({
|
|
30
|
-
type: "range",
|
|
31
|
-
...options
|
|
32
|
-
});
|
|
33
|
-
return this;
|
|
34
|
-
}
|
|
35
|
-
step(options) {
|
|
36
|
-
this.wrapper.add({
|
|
37
|
-
type: "step",
|
|
38
|
-
...options
|
|
39
|
-
});
|
|
40
|
-
return this;
|
|
41
|
-
}
|
|
42
|
-
number(value) {
|
|
43
|
-
this.wrapper.add({
|
|
44
|
-
type: "value",
|
|
45
|
-
value
|
|
46
|
-
});
|
|
47
|
-
return this;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
function range(options) {
|
|
51
|
-
return {
|
|
52
|
-
type: "range",
|
|
53
|
-
...options
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function any() {
|
|
57
|
-
return { type: "any" };
|
|
58
|
-
}
|
|
59
|
-
function step(options) {
|
|
60
|
-
return {
|
|
61
|
-
type: "step",
|
|
62
|
-
...options
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
function list(builderFn) {
|
|
66
|
-
const wrapper = new FieldWrapper();
|
|
67
|
-
builderFn(new CronListBuilder(wrapper));
|
|
68
|
-
return {
|
|
69
|
-
type: "list",
|
|
70
|
-
values: wrapper.read()
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
function number(value) {
|
|
74
|
-
return {
|
|
75
|
-
type: "value",
|
|
76
|
-
value
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
function cronJobBuilder(buildFn) {
|
|
80
|
-
const fields = {
|
|
81
|
-
second: void 0,
|
|
82
|
-
minute: void 0,
|
|
83
|
-
hour: void 0,
|
|
84
|
-
day: void 0,
|
|
85
|
-
month: void 0,
|
|
86
|
-
weekday: void 0
|
|
87
|
-
};
|
|
88
|
-
const obj = {
|
|
89
|
-
second(expr) {
|
|
90
|
-
fields.second = checkExpr(expr);
|
|
91
|
-
return obj;
|
|
92
|
-
},
|
|
93
|
-
minute(expr) {
|
|
94
|
-
fields.minute = checkExpr(expr);
|
|
95
|
-
return obj;
|
|
96
|
-
},
|
|
97
|
-
hour(expr) {
|
|
98
|
-
fields.hour = checkExpr(expr);
|
|
99
|
-
return obj;
|
|
100
|
-
},
|
|
101
|
-
day(expr) {
|
|
102
|
-
fields.day = checkExpr(expr);
|
|
103
|
-
return obj;
|
|
104
|
-
},
|
|
105
|
-
month(expr) {
|
|
106
|
-
fields.month = checkExpr(expr);
|
|
107
|
-
return obj;
|
|
108
|
-
},
|
|
109
|
-
weekday(expr) {
|
|
110
|
-
fields.weekday = checkExpr(expr);
|
|
111
|
-
return obj;
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
buildFn(obj);
|
|
115
|
-
return generate(fields);
|
|
116
|
-
}
|
|
117
|
-
function checkExpr(expr) {
|
|
118
|
-
if (expr.type === "list") {
|
|
119
|
-
const { values } = expr;
|
|
120
|
-
if (values.length === 0) throw new Error("EmptyListError: List expression cannot be empty");
|
|
121
|
-
return values.map((e) => handleSimpleExpression(e)).join(",");
|
|
122
|
-
}
|
|
123
|
-
return handleSimpleExpression(expr);
|
|
124
|
-
}
|
|
125
|
-
function handleSimpleExpression(expr) {
|
|
126
|
-
switch (expr.type) {
|
|
127
|
-
case "any": return "*";
|
|
128
|
-
case "value": return `${expr.value}`;
|
|
129
|
-
case "range": {
|
|
130
|
-
const { min, max } = expr;
|
|
131
|
-
if (min > max) throw new Error(`OutOfBoundError: Expected ${min} <= ${max}`);
|
|
132
|
-
return `${min}-${max}`;
|
|
133
|
-
}
|
|
134
|
-
case "step": {
|
|
135
|
-
const { step, range } = expr;
|
|
136
|
-
if (step === 0) throw new Error(`OutOfBoundError: Expected step value greater than zero`);
|
|
137
|
-
if (!range) return `*/${step}`;
|
|
138
|
-
const { min, max } = range;
|
|
139
|
-
if (max === 0) {
|
|
140
|
-
if (min > max) throw new Error(`OutOfBoundError: Expected max value greater than zero`);
|
|
141
|
-
return `${min}-${max}/${step}`;
|
|
142
|
-
}
|
|
143
|
-
if (!max) return `${min}/${step}`;
|
|
144
|
-
if (min > max) throw new Error(`OutOfBoundError: Expected ${min} <= ${max}`);
|
|
145
|
-
return `${min}-${max}/${step}`;
|
|
146
|
-
}
|
|
147
|
-
default: return "*";
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
function generate(fields) {
|
|
151
|
-
const parts = [];
|
|
152
|
-
for (let index = 0; index < CRON_FIELD_ORDER.length; index++) {
|
|
153
|
-
const key = CRON_FIELD_ORDER[index];
|
|
154
|
-
if (!key) return "";
|
|
155
|
-
if (key === "second" && !fields[key]) continue;
|
|
156
|
-
parts.push(fields[key] ?? "*");
|
|
157
|
-
}
|
|
158
|
-
return parts.join(" ");
|
|
159
|
-
}
|
|
160
|
-
//#endregion
|
|
161
|
-
export { any, cronJobBuilder, list, number, range, step };
|
|
162
|
-
|
|
163
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/lib/cron/builder/index.ts"],"sourcesContent":["import type {\n BuilderFn,\n CronBuilderType,\n CronExpr,\n CronField,\n CronListExpr,\n CronRange,\n CronStep,\n DayType,\n HourType,\n MonthType,\n TimeType,\n WeekDayType,\n} from \"./types.js\";\n\nconst CRON_FIELD_ORDER: CronField[] = [\n \"second\",\n \"minute\",\n \"hour\",\n \"day\",\n \"month\",\n \"weekday\",\n] as const;\n\nclass FieldWrapper<T> {\n private fields: CronListExpr<T>[] = [];\n\n public add(expr: CronListExpr<T>) {\n this.fields.push(expr);\n }\n\n public read() {\n return this.fields;\n }\n}\n\nclass CronListBuilder<T> {\n private wrapper: FieldWrapper<T>;\n\n public constructor(wrapper: FieldWrapper<T>) {\n this.wrapper = wrapper;\n }\n\n public any(): CronListBuilder<T> {\n this.wrapper.add({ type: \"any\" });\n return this;\n }\n\n public range(options: CronRange<T>): CronListBuilder<T> {\n this.wrapper.add({ type: \"range\", ...options });\n return this;\n }\n\n public step(options: CronStep<T>): CronListBuilder<T> {\n this.wrapper.add({ type: \"step\", ...options });\n return this;\n }\n\n public number(value: T): CronListBuilder<T> {\n this.wrapper.add({ type: \"value\", value: value });\n return this;\n }\n}\n\nexport function range<T>(options: CronRange<T>): CronExpr<T> {\n return { type: \"range\", ...options };\n}\n\nexport function any<T>(): CronExpr<T> {\n return { type: \"any\" };\n}\n\nexport function step<T>(options: CronStep<T>): CronExpr<T> {\n return { type: \"step\", ...options };\n}\n\nexport function list<T>(\n builderFn: (builder: CronListBuilder<T>) => CronListBuilder<T>,\n): CronExpr<T> {\n const wrapper = new FieldWrapper<T>();\n builderFn(new CronListBuilder<T>(wrapper));\n\n return { type: \"list\", values: wrapper.read() };\n}\n\nexport function number<T>(value: T) {\n return { type: \"value\", value: value } satisfies CronExpr<T>;\n}\n\nexport function cronJobBuilder(buildFn: BuilderFn) {\n const fields: Partial<Record<CronField, string>> = {\n second: undefined,\n minute: undefined,\n hour: undefined,\n day: undefined,\n month: undefined,\n weekday: undefined,\n };\n\n const obj: CronBuilderType = {\n second(expr: CronExpr<TimeType>) {\n fields.second = checkExpr(expr);\n return obj;\n },\n minute(expr: CronExpr<TimeType>) {\n fields.minute = checkExpr(expr);\n return obj;\n },\n hour(expr: CronExpr<HourType>) {\n fields.hour = checkExpr(expr);\n return obj;\n },\n day(expr: CronExpr<DayType>) {\n fields.day = checkExpr(expr);\n return obj;\n },\n month(expr: CronExpr<MonthType>) {\n fields.month = checkExpr(expr);\n return obj;\n },\n weekday(expr: CronExpr<WeekDayType>) {\n fields.weekday = checkExpr(expr);\n return obj;\n },\n };\n\n buildFn(obj);\n return generate(fields);\n}\n\nfunction checkExpr<T>(expr: CronExpr<T>) {\n if (expr.type === \"list\") {\n const { values } = expr;\n if (values.length === 0) {\n throw new Error(\"EmptyListError: List expression cannot be empty\");\n }\n\n const data = values.map((e) => handleSimpleExpression(e));\n\n return data.join(\",\");\n }\n\n return handleSimpleExpression(expr);\n}\n\nfunction handleSimpleExpression<T>(expr: CronExpr<T>) {\n switch (expr.type) {\n case \"any\": {\n return \"*\";\n }\n\n case \"value\": {\n return `${expr.value}`;\n }\n\n case \"range\": {\n const { min, max } = expr;\n if (min > max) {\n throw new Error(`OutOfBoundError: Expected ${min} <= ${max}`);\n }\n\n return `${min}-${max}`;\n }\n\n case \"step\": {\n const { step, range } = expr;\n\n if (step === 0) {\n throw new Error(\n `OutOfBoundError: Expected step value greater than zero`,\n );\n }\n\n if (!range) {\n return `*/${step}`;\n }\n\n const { min, max } = range;\n\n if (max === 0) {\n if (min > max) {\n throw new Error(\n `OutOfBoundError: Expected max value greater than zero`,\n );\n }\n\n return `${min}-${max}/${step}`;\n }\n\n if (!max) {\n return `${min}/${step}`;\n }\n\n if (min > max) {\n throw new Error(`OutOfBoundError: Expected ${min} <= ${max}`);\n }\n\n return `${min}-${max}/${step}`;\n }\n\n default: {\n return \"*\";\n }\n }\n}\n\nfunction generate(fields: Partial<Record<CronField, string>>): string {\n const parts: string[] = [];\n\n for (let index = 0; index < CRON_FIELD_ORDER.length; index++) {\n const key = CRON_FIELD_ORDER[index];\n if (!key) return \"\";\n if (key === \"second\" && !fields[key]) {\n continue;\n }\n\n parts.push(fields[key] ?? \"*\");\n }\n\n return parts.join(\" \");\n}\n"],"mappings":";AAeA,MAAM,mBAAgC;CACpC;CACA;CACA;CACA;CACA;CACA;CACD;AAED,IAAM,eAAN,MAAsB;CACpB,SAAoC,EAAE;CAEtC,IAAW,MAAuB;AAChC,OAAK,OAAO,KAAK,KAAK;;CAGxB,OAAc;AACZ,SAAO,KAAK;;;AAIhB,IAAM,kBAAN,MAAyB;CACvB;CAEA,YAAmB,SAA0B;AAC3C,OAAK,UAAU;;CAGjB,MAAiC;AAC/B,OAAK,QAAQ,IAAI,EAAE,MAAM,OAAO,CAAC;AACjC,SAAO;;CAGT,MAAa,SAA2C;AACtD,OAAK,QAAQ,IAAI;GAAE,MAAM;GAAS,GAAG;GAAS,CAAC;AAC/C,SAAO;;CAGT,KAAY,SAA0C;AACpD,OAAK,QAAQ,IAAI;GAAE,MAAM;GAAQ,GAAG;GAAS,CAAC;AAC9C,SAAO;;CAGT,OAAc,OAA8B;AAC1C,OAAK,QAAQ,IAAI;GAAE,MAAM;GAAgB;GAAO,CAAC;AACjD,SAAO;;;AAIX,SAAgB,MAAS,SAAoC;AAC3D,QAAO;EAAE,MAAM;EAAS,GAAG;EAAS;;AAGtC,SAAgB,MAAsB;AACpC,QAAO,EAAE,MAAM,OAAO;;AAGxB,SAAgB,KAAQ,SAAmC;AACzD,QAAO;EAAE,MAAM;EAAQ,GAAG;EAAS;;AAGrC,SAAgB,KAC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|
-
aug: 8,
|
|
20
|
-
sep: 9,
|
|
21
|
-
oct: 10,
|
|
22
|
-
nov: 11,
|
|
23
|
-
dec: 12
|
|
24
|
-
};
|
|
25
|
-
//#endregion
|
|
26
|
-
exports.Month = Month;
|
|
27
|
-
exports.WeekDay = WeekDay;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
//#region src/lib/cron/builder/types.d.ts
|
|
2
|
-
declare const WeekDay: {
|
|
3
|
-
readonly sun: 0;
|
|
4
|
-
readonly mon: 1;
|
|
5
|
-
readonly tue: 2;
|
|
6
|
-
readonly wed: 3;
|
|
7
|
-
readonly thu: 4;
|
|
8
|
-
readonly fri: 5;
|
|
9
|
-
readonly sat: 6;
|
|
10
|
-
};
|
|
11
|
-
declare const Month: {
|
|
12
|
-
readonly jan: 1;
|
|
13
|
-
readonly feb: 2;
|
|
14
|
-
readonly mar: 3;
|
|
15
|
-
readonly apr: 4;
|
|
16
|
-
readonly may: 5;
|
|
17
|
-
readonly jun: 6;
|
|
18
|
-
readonly jul: 7;
|
|
19
|
-
readonly aug: 8;
|
|
20
|
-
readonly sep: 9;
|
|
21
|
-
readonly oct: 10;
|
|
22
|
-
readonly nov: 11;
|
|
23
|
-
readonly dec: 12;
|
|
24
|
-
};
|
|
25
|
-
type Enumerate<N extends number, Acc extends number[] = []> = Acc["length"] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc["length"]]>;
|
|
26
|
-
type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
|
|
27
|
-
type TimeType = IntRange<0, 60>;
|
|
28
|
-
type HourType = IntRange<0, 24>;
|
|
29
|
-
type DayType = IntRange<1, 32>;
|
|
30
|
-
type MonthType = IntRange<1, 13>;
|
|
31
|
-
type WeekDayType = IntRange<0, 7>;
|
|
32
|
-
type CronRange<T> = {
|
|
33
|
-
min: NoInfer<T>;
|
|
34
|
-
max: NoInfer<T>;
|
|
35
|
-
};
|
|
36
|
-
type CronStep<T> = {
|
|
37
|
-
step: NoInfer<T>;
|
|
38
|
-
range?: {
|
|
39
|
-
min: NoInfer<T>;
|
|
40
|
-
max?: NoInfer<T>;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
type CronField = "second" | "minute" | "hour" | "day" | "month" | "weekday";
|
|
44
|
-
type CronListExpr<T> = Exclude<CronExpr<T>, {
|
|
45
|
-
type: "list";
|
|
46
|
-
}>;
|
|
47
|
-
type CronExpr<T> = {
|
|
48
|
-
type: "any";
|
|
49
|
-
} | {
|
|
50
|
-
type: "value";
|
|
51
|
-
value: T;
|
|
52
|
-
} | {
|
|
53
|
-
type: "range";
|
|
54
|
-
min: T;
|
|
55
|
-
max: T;
|
|
56
|
-
} | {
|
|
57
|
-
type: "step";
|
|
58
|
-
step: T;
|
|
59
|
-
range?: {
|
|
60
|
-
min: T;
|
|
61
|
-
max?: T;
|
|
62
|
-
};
|
|
63
|
-
} | {
|
|
64
|
-
type: "list";
|
|
65
|
-
values: CronListExpr<T>[];
|
|
66
|
-
};
|
|
67
|
-
interface IBuilder<Used extends CronField> {
|
|
68
|
-
second(expr: CronExpr<TimeType>): CronBuilderType<Used | "second">;
|
|
69
|
-
minute(expr: CronExpr<TimeType>): CronBuilderType<Used | "minute">;
|
|
70
|
-
hour(expr: CronExpr<HourType>): CronBuilderType<Used | "hour">;
|
|
71
|
-
day(expr: CronExpr<DayType>): CronBuilderType<Used | "day">;
|
|
72
|
-
month(expr: CronExpr<MonthType>): CronBuilderType<Used | "month">;
|
|
73
|
-
weekday(expr: CronExpr<WeekDayType>): CronBuilderType<Used | "weekday">;
|
|
74
|
-
}
|
|
75
|
-
type CronBuilderType<Used extends CronField = never> = Omit<IBuilder<Used>, Used>;
|
|
76
|
-
type BuilderFn = (builder: CronBuilderType) => void;
|
|
77
|
-
//#endregion
|
|
78
|
-
export { BuilderFn, CronExpr, CronListExpr, CronRange, CronStep, Month, WeekDay };
|
|
79
|
-
//# sourceMappingURL=types.d.cts.map
|
|
@@ -1 +0,0 @@
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AA,CAAO,IAAA,EAAM,QAAA,CAAS,QAAA,IAAY,eAAA,CAAgB,IAAA;EAClD,IAAA,CAAK,IAAA,EAAM,QAAA,CAAS,QAAA,IAAY,eAAA,CAAgB,IAAA;EAChD,GAAA,CAAI,IAAA,EAAM,QAAA,CAAS,OAAA,IAAW,eAAA,CAAgB,IAAA;EAC9C,KAAA,CAAM,IAAA,EAAM,QAAA,CAAS,SAAA,IAAa,eAAA,CAAgB,IAAA;EAClD,OAAA,CAAQ,IAAA,EAAM,QAAA,CAAS,WAAA,IAAe,eAAA,CAAgB,IAAA;AAAA;AAAA,KAG5C,eAAA,cAA6B,SAAA,YAAqB,IAAA,CAC5D,QAAA,CAAS,IAAA,GACT,IAAA;AAAA,KAGU,SAAA,IAAa,OAAA,EAAS,eAAA"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
//#region src/lib/cron/builder/types.d.ts
|
|
2
|
-
declare const WeekDay: {
|
|
3
|
-
readonly sun: 0;
|
|
4
|
-
readonly mon: 1;
|
|
5
|
-
readonly tue: 2;
|
|
6
|
-
readonly wed: 3;
|
|
7
|
-
readonly thu: 4;
|
|
8
|
-
readonly fri: 5;
|
|
9
|
-
readonly sat: 6;
|
|
10
|
-
};
|
|
11
|
-
declare const Month: {
|
|
12
|
-
readonly jan: 1;
|
|
13
|
-
readonly feb: 2;
|
|
14
|
-
readonly mar: 3;
|
|
15
|
-
readonly apr: 4;
|
|
16
|
-
readonly may: 5;
|
|
17
|
-
readonly jun: 6;
|
|
18
|
-
readonly jul: 7;
|
|
19
|
-
readonly aug: 8;
|
|
20
|
-
readonly sep: 9;
|
|
21
|
-
readonly oct: 10;
|
|
22
|
-
readonly nov: 11;
|
|
23
|
-
readonly dec: 12;
|
|
24
|
-
};
|
|
25
|
-
type Enumerate<N extends number, Acc extends number[] = []> = Acc["length"] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc["length"]]>;
|
|
26
|
-
type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
|
|
27
|
-
type TimeType = IntRange<0, 60>;
|
|
28
|
-
type HourType = IntRange<0, 24>;
|
|
29
|
-
type DayType = IntRange<1, 32>;
|
|
30
|
-
type MonthType = IntRange<1, 13>;
|
|
31
|
-
type WeekDayType = IntRange<0, 7>;
|
|
32
|
-
type CronRange<T> = {
|
|
33
|
-
min: NoInfer<T>;
|
|
34
|
-
max: NoInfer<T>;
|
|
35
|
-
};
|
|
36
|
-
type CronStep<T> = {
|
|
37
|
-
step: NoInfer<T>;
|
|
38
|
-
range?: {
|
|
39
|
-
min: NoInfer<T>;
|
|
40
|
-
max?: NoInfer<T>;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
type CronField = "second" | "minute" | "hour" | "day" | "month" | "weekday";
|
|
44
|
-
type CronListExpr<T> = Exclude<CronExpr<T>, {
|
|
45
|
-
type: "list";
|
|
46
|
-
}>;
|
|
47
|
-
type CronExpr<T> = {
|
|
48
|
-
type: "any";
|
|
49
|
-
} | {
|
|
50
|
-
type: "value";
|
|
51
|
-
value: T;
|
|
52
|
-
} | {
|
|
53
|
-
type: "range";
|
|
54
|
-
min: T;
|
|
55
|
-
max: T;
|
|
56
|
-
} | {
|
|
57
|
-
type: "step";
|
|
58
|
-
step: T;
|
|
59
|
-
range?: {
|
|
60
|
-
min: T;
|
|
61
|
-
max?: T;
|
|
62
|
-
};
|
|
63
|
-
} | {
|
|
64
|
-
type: "list";
|
|
65
|
-
values: CronListExpr<T>[];
|
|
66
|
-
};
|
|
67
|
-
interface IBuilder<Used extends CronField> {
|
|
68
|
-
second(expr: CronExpr<TimeType>): CronBuilderType<Used | "second">;
|
|
69
|
-
minute(expr: CronExpr<TimeType>): CronBuilderType<Used | "minute">;
|
|
70
|
-
hour(expr: CronExpr<HourType>): CronBuilderType<Used | "hour">;
|
|
71
|
-
day(expr: CronExpr<DayType>): CronBuilderType<Used | "day">;
|
|
72
|
-
month(expr: CronExpr<MonthType>): CronBuilderType<Used | "month">;
|
|
73
|
-
weekday(expr: CronExpr<WeekDayType>): CronBuilderType<Used | "weekday">;
|
|
74
|
-
}
|
|
75
|
-
type CronBuilderType<Used extends CronField = never> = Omit<IBuilder<Used>, Used>;
|
|
76
|
-
type BuilderFn = (builder: CronBuilderType) => void;
|
|
77
|
-
//#endregion
|
|
78
|
-
export { BuilderFn, CronExpr, CronListExpr, CronRange, CronStep, Month, WeekDay };
|
|
79
|
-
//# sourceMappingURL=types.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../src/lib/cron/builder/types.ts"],"mappings":";cAAa,OAAA;EAAA;;;;;;;;cAUA,KAAA;EAAA;;;;;;;;;;;;;KAeR,SAAA,gDAGD,GAAA,mBAAsB,CAAA,GACtB,GAAA,WACA,SAAA,CAAU,CAAA,MAAO,GAAA,EAAK,GAAA;AAAA,KAErB,QAAA,uCAA+C,OAAA,CAClD,SAAA,CAAU,CAAA,GACV,SAAA,CAAU,CAAA;AAAA,KAGA,QAAA,GAAW,QAAA;AAAA,KACX,QAAA,GAAW,QAAA;AAAA,KACX,OAAA,GAAU,QAAA;AAAA,KACV,SAAA,GAAY,QAAA;AAAA,KACZ,WAAA,GAAc,QAAA;AAAA,KAEd,SAAA;EAAiB,GAAA,EAAK,OAAA,CAAQ,CAAA;EAAI,GAAA,EAAK,OAAA,CAAQ,CAAA;AAAA;AAAA,KAC/C,QAAA;EACV,IAAA,EAAM,OAAA,CAAQ,CAAA;EACd,KAAA;IAAU,GAAA,EAAK,OAAA,CAAQ,CAAA;IAAI,GAAA,GAAM,OAAA,CAAQ,CAAA;EAAA;AAAA;AAAA,KAG/B,SAAA;AAAA,KAQA,YAAA,MAAkB,OAAA,CAAQ,QAAA,CAAS,CAAA;EAAM,IAAA;AAAA;AAAA,KAEzC,QAAA;EACN,IAAA;AAAA;EACA,IAAA;EAAe,KAAA,EAAO,CAAA;AAAA;EACtB,IAAA;EAAe,GAAA,EAAK,CAAA;E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
|
-
sep: 9,
|
|
21
|
-
oct: 10,
|
|
22
|
-
nov: 11,
|
|
23
|
-
dec: 12
|
|
24
|
-
};
|
|
25
|
-
//#endregion
|
|
26
|
-
export { Month, WeekDay };
|
|
27
|
-
|
|
28
|
-
//# sourceMappingURL=types.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","names":[],"sources":["../../../src/lib/cron/builder/types.ts"],"sourcesContent":["export const WeekDay = {\n sun: 0,\n mon: 1,\n tue: 2,\n wed: 3,\n thu: 4,\n fri: 5,\n sat: 6,\n} as const;\n\nexport const Month = {\n jan: 1,\n feb: 2,\n mar: 3,\n apr: 4,\n may: 5,\n jun: 6,\n jul: 7,\n aug: 8,\n sep: 9,\n oct: 10,\n nov: 11,\n dec: 12,\n} as const;\n\ntype Enumerate<\n N extends number,\n Acc extends number[] = [],\n> = Acc[\"length\"] extends N\n ? Acc[number]\n : Enumerate<N, [...Acc, Acc[\"length\"]]>;\n\ntype IntRange<F extends number, T extends number> = Exclude<\n Enumerate<T>,\n Enumerate<F>\n>;\n\nexport type TimeType = IntRange<0, 60>; // 0–59\nexport type HourType = IntRange<0, 24>; // 0–23\nexport type DayType = IntRange<1, 32>; // 1–31\nexport type MonthType = IntRange<1, 13>; // 1–12\nexport type WeekDayType = IntRange<0, 7>; // 0–6\n\nexport type CronRange<T> = { min: NoInfer<T>; max: NoInfer<T> };\nexport type CronStep<T> = {\n step: NoInfer<T>;\n range?: { min: NoInfer<T>; max?: NoInfer<T> };\n};\n\nexport type CronField =\n | \"second\"\n | \"minute\"\n | \"hour\"\n | \"day\"\n | \"month\"\n | \"weekday\";\n\nexport type CronListExpr<T> = Exclude<CronExpr<T>, { type: \"list\" }>;\n\nexport type CronExpr<T> =\n | { type: \"any\" }\n | { type: \"value\"; value: T }\n | { type: \"range\"; min: T; max: T }\n | { type: \"step\"; step: T; range?: { min: T; max?: T } }\n | { type: \"list\"; values: CronListExpr<T>[] };\n\ninterface IBuilder<Used extends CronField> {\n second(expr: CronExpr<TimeType>): CronBuilderType<Used | \"second\">;\n minute(expr: CronExpr<TimeType>): CronBuilderType<Used | \"minute\">;\n hour(expr: CronExpr<HourType>): CronBuilderType<Used | \"hour\">;\n day(expr: CronExpr<DayType>): CronBuilderType<Used | \"day\">;\n month(expr: CronExpr<MonthType>): CronBuilderType<Used | \"month\">;\n weekday(expr: CronExpr<WeekDayType>): CronBuilderType<Used | \"weekday\">;\n}\n\nexport type CronBuilderType<Used extends CronField = never> = Omit<\n IBuilder<Used>,\n Used\n>;\n\nexport type BuilderFn = (builder: CronBuilderType) => void;\n"],"mappings":";AAAA,MAAa,UAAU;CACrB,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACN;AAED,MAAa,QAAQ;CACnB,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACN"}
|