semola 0.5.3 → 0.5.4
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/dist/index-BhGNDjPq.d.mts +13 -0
- package/dist/index-DxSbeGP-.d.cts +13 -0
- package/dist/lib/api/index.cjs +522 -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 +520 -2
- package/dist/lib/cache/index.d.cts +16 -4
- package/dist/lib/cache/index.d.mts +16 -4
- package/dist/lib/cache/index.mjs +0 -2
- 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 +2 -13
- package/dist/lib/errors/index.d.mts +2 -13
- 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 +386 -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/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 +69 -4
- package/dist/lib/prompts/index.d.mts +69 -4
- package/dist/lib/prompts/index.mjs +362 -4
- package/dist/lib/pubsub/index.d.cts +9 -4
- package/dist/lib/pubsub/index.d.mts +9 -4
- package/dist/lib/pubsub/index.mjs +0 -2
- package/dist/lib/queue/index.d.cts +48 -6
- package/dist/lib/queue/index.d.mts +48 -6
- package/dist/lib/queue/index.mjs +0 -2
- package/dist/lib/workflow/index.d.cts +82 -4
- package/dist/lib/workflow/index.d.mts +82 -4
- package/dist/lib/workflow/index.mjs +0 -2
- package/package.json +1 -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/orm/index.cjs +0 -20
- package/dist/lib/orm/index.d.cts +0 -7
- package/dist/lib/orm/index.d.mts +0 -7
- package/dist/lib/orm/index.mjs +0 -6
- 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,165 +0,0 @@
|
|
|
1
|
-
import { mightThrowSync } from "../../lib/errors/index.mjs";
|
|
2
|
-
import { isoDateTimeFormat } from "../formatter/index.mjs";
|
|
3
|
-
import { PROVIDER_OPTION_DEFAULT } from "../core/index.mjs";
|
|
4
|
-
import { LogLevel } from "../core/types.mjs";
|
|
5
|
-
import { basename, dirname, extname, join } from "node:path";
|
|
6
|
-
import { appendFileSync, existsSync, mkdirSync, statSync } from "node:fs";
|
|
7
|
-
//#region src/lib/logging/provider/index.ts
|
|
8
|
-
const DEFAULT_MAX_SIZE = 4 * 1024;
|
|
9
|
-
const DurationUnit = {
|
|
10
|
-
hour: 1e3 * 60 * 60,
|
|
11
|
-
day: 1e3 * 60 * 60 * 24,
|
|
12
|
-
week: 1e3 * 60 * 60 * 24 * 7,
|
|
13
|
-
month: 1e3 * 60 * 60 * 24 * 7 * 4.345
|
|
14
|
-
};
|
|
15
|
-
var LoggerProvider = class {
|
|
16
|
-
options;
|
|
17
|
-
constructor(options = PROVIDER_OPTION_DEFAULT) {
|
|
18
|
-
this.options = {
|
|
19
|
-
...PROVIDER_OPTION_DEFAULT,
|
|
20
|
-
...options
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
getLogLevel() {
|
|
24
|
-
if (!this.options.level) return LogLevel.debug;
|
|
25
|
-
return LogLevel[this.options.level];
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const FILE_PROVIDER_OPTION_DEFAULT = {
|
|
29
|
-
...PROVIDER_OPTION_DEFAULT,
|
|
30
|
-
policy: { type: "size" }
|
|
31
|
-
};
|
|
32
|
-
var FileProvider = class extends LoggerProvider {
|
|
33
|
-
filePath;
|
|
34
|
-
counter;
|
|
35
|
-
file;
|
|
36
|
-
policy;
|
|
37
|
-
constructor(file, options = FILE_PROVIDER_OPTION_DEFAULT) {
|
|
38
|
-
super({
|
|
39
|
-
formatter: options.formatter ?? PROVIDER_OPTION_DEFAULT.formatter,
|
|
40
|
-
level: options.level ?? PROVIDER_OPTION_DEFAULT.level
|
|
41
|
-
});
|
|
42
|
-
this.policy = options.policy ?? FILE_PROVIDER_OPTION_DEFAULT.policy;
|
|
43
|
-
this.filePath = file;
|
|
44
|
-
this.counter = 0;
|
|
45
|
-
this.file = this.createNewFileName();
|
|
46
|
-
}
|
|
47
|
-
execute(data) {
|
|
48
|
-
if (this.getLogLevel() > LogLevel[data.level]) return;
|
|
49
|
-
const [error, formattedMessage] = mightThrowSync(() => {
|
|
50
|
-
if (this.isJSONFile()) return JSON.stringify({
|
|
51
|
-
timestamp: isoDateTimeFormat(),
|
|
52
|
-
level: data.level,
|
|
53
|
-
message: data.msg
|
|
54
|
-
});
|
|
55
|
-
const { formatter } = this.options;
|
|
56
|
-
return formatter?.format(data) ?? "";
|
|
57
|
-
});
|
|
58
|
-
const [fsError] = mightThrowSync(() => {
|
|
59
|
-
if (error && error instanceof Error) {
|
|
60
|
-
const { formatter } = this.options;
|
|
61
|
-
const errorMsg = formatter?.formatError(data, error);
|
|
62
|
-
appendFileSync(this.file, `${errorMsg}\n`);
|
|
63
|
-
}
|
|
64
|
-
if (this.canRollFile()) {
|
|
65
|
-
this.counter += 1;
|
|
66
|
-
this.file = this.createNewFileName();
|
|
67
|
-
}
|
|
68
|
-
if (error || !formattedMessage) return;
|
|
69
|
-
appendFileSync(this.file, `${formattedMessage}\n`);
|
|
70
|
-
});
|
|
71
|
-
if (fsError && fsError instanceof Error) throw fsError;
|
|
72
|
-
}
|
|
73
|
-
canRollFile() {
|
|
74
|
-
if (!this.policy) return false;
|
|
75
|
-
switch (this.policy.type) {
|
|
76
|
-
case "size":
|
|
77
|
-
if (this.policy.maxSize) return this.getFileSize() >= this.policy.maxSize;
|
|
78
|
-
return this.getFileSize() >= DEFAULT_MAX_SIZE;
|
|
79
|
-
case "time": {
|
|
80
|
-
if (!existsSync(this.file)) return false;
|
|
81
|
-
const { duration, instant } = this.policy;
|
|
82
|
-
const { birthtime } = statSync(this.file);
|
|
83
|
-
const creationTimeMs = birthtime.getTime();
|
|
84
|
-
const currenTimeMs = Date.now();
|
|
85
|
-
const diffMs = currenTimeMs - creationTimeMs;
|
|
86
|
-
switch (instant) {
|
|
87
|
-
case "hour": return Math.floor(diffMs / DurationUnit.hour) >= duration;
|
|
88
|
-
case "day": return Math.floor(diffMs / DurationUnit.day) >= duration;
|
|
89
|
-
case "week": return Math.floor(diffMs / DurationUnit.week) >= duration;
|
|
90
|
-
case "month": {
|
|
91
|
-
const currentDate = new Date(currenTimeMs);
|
|
92
|
-
const monthsDiff = (currentDate.getFullYear() - birthtime.getFullYear()) * 12 + (currentDate.getMonth() - birthtime.getMonth());
|
|
93
|
-
return (currentDate.getDate() >= birthtime.getDate() ? monthsDiff : monthsDiff - 1) >= duration;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
getFileSize() {
|
|
100
|
-
if (!existsSync(this.file)) return 0;
|
|
101
|
-
const [statError, size] = mightThrowSync(() => {
|
|
102
|
-
const { size } = statSync(this.file);
|
|
103
|
-
return size;
|
|
104
|
-
});
|
|
105
|
-
if (statError && statError instanceof Error) return 0;
|
|
106
|
-
if (!size) return 0;
|
|
107
|
-
return size;
|
|
108
|
-
}
|
|
109
|
-
isJSONFile() {
|
|
110
|
-
return extname(this.filePath) === ".json";
|
|
111
|
-
}
|
|
112
|
-
createNewFileName() {
|
|
113
|
-
const fileName = basename(this.filePath);
|
|
114
|
-
const directory = dirname(this.filePath);
|
|
115
|
-
if (!existsSync(directory)) mkdirSync(directory, { recursive: true });
|
|
116
|
-
const fileInfo = fileName.split(".");
|
|
117
|
-
const extension = fileInfo.pop();
|
|
118
|
-
return join(directory, [
|
|
119
|
-
...fileInfo,
|
|
120
|
-
this.counter,
|
|
121
|
-
extension
|
|
122
|
-
].join("."));
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
var ConsoleProvider = class extends LoggerProvider {
|
|
126
|
-
execute(data) {
|
|
127
|
-
const level = this.getLogLevel();
|
|
128
|
-
const userLevel = LogLevel[data.level];
|
|
129
|
-
if (level > userLevel) return;
|
|
130
|
-
const [error, formattedMessage] = mightThrowSync(() => {
|
|
131
|
-
const { formatter } = this.options;
|
|
132
|
-
return formatter?.format(data) ?? "";
|
|
133
|
-
});
|
|
134
|
-
if (error && error instanceof Error) {
|
|
135
|
-
const { formatter } = this.options;
|
|
136
|
-
console.error(formatter?.formatError(data, error));
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
if (!formattedMessage) return;
|
|
140
|
-
switch (userLevel) {
|
|
141
|
-
case LogLevel.debug:
|
|
142
|
-
console.debug(formattedMessage);
|
|
143
|
-
break;
|
|
144
|
-
case LogLevel.info:
|
|
145
|
-
console.info(formattedMessage);
|
|
146
|
-
break;
|
|
147
|
-
case LogLevel.warning:
|
|
148
|
-
console.warn(formattedMessage);
|
|
149
|
-
break;
|
|
150
|
-
case LogLevel.error:
|
|
151
|
-
console.error(formattedMessage);
|
|
152
|
-
break;
|
|
153
|
-
case LogLevel.critical:
|
|
154
|
-
console.error(formattedMessage);
|
|
155
|
-
break;
|
|
156
|
-
default:
|
|
157
|
-
console.debug(formattedMessage);
|
|
158
|
-
break;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
//#endregion
|
|
163
|
-
export { ConsoleProvider, FileProvider, LoggerProvider };
|
|
164
|
-
|
|
165
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/lib/logging/provider/index.ts"],"sourcesContent":["import { appendFileSync, existsSync, mkdirSync, statSync } from \"node:fs\";\nimport { basename, dirname, extname, join } from \"node:path\";\nimport { mightThrowSync } from \"../../errors/index.js\";\nimport { PROVIDER_OPTION_DEFAULT } from \"../core/index.js\";\n\nimport { type LogDataType, LogLevel } from \"../core/types.js\";\nimport { isoDateTimeFormat } from \"../formatter/index.js\";\nimport type {\n FileProviderOptions,\n ProviderOptions,\n SizeBasedPolicyType,\n TimeBasedPolicyType,\n} from \"./types.js\";\n\nconst DEFAULT_MAX_SIZE = 4 * 1024; // 4KB\n\nconst DurationUnit = {\n hour: 1000 * 60 * 60,\n day: 1000 * 60 * 60 * 24,\n week: 1000 * 60 * 60 * 24 * 7,\n month: 1000 * 60 * 60 * 24 * 7 * 4.345, // On average 1 month has 4,345 weeks\n} as const;\n\nexport abstract class LoggerProvider {\n protected options: ProviderOptions;\n\n public constructor(options: ProviderOptions = PROVIDER_OPTION_DEFAULT) {\n this.options = { ...PROVIDER_OPTION_DEFAULT, ...options };\n }\n\n public abstract execute(data: LogDataType): void;\n\n public getLogLevel(): number {\n if (!this.options.level) {\n return LogLevel.debug;\n }\n\n return LogLevel[this.options.level];\n }\n}\n\nconst FILE_PROVIDER_OPTION_DEFAULT: FileProviderOptions = {\n ...PROVIDER_OPTION_DEFAULT,\n policy: { type: \"size\" },\n} as const;\n\nexport class FileProvider extends LoggerProvider {\n private readonly filePath: string;\n\n private counter: number;\n private file: string;\n private policy?: SizeBasedPolicyType | TimeBasedPolicyType;\n\n public constructor(\n file: string,\n options: FileProviderOptions = FILE_PROVIDER_OPTION_DEFAULT,\n ) {\n super({\n formatter: options.formatter ?? PROVIDER_OPTION_DEFAULT.formatter,\n level: options.level ?? PROVIDER_OPTION_DEFAULT.level,\n });\n this.policy = options.policy ?? FILE_PROVIDER_OPTION_DEFAULT.policy;\n\n this.filePath = file;\n this.counter = 0;\n this.file = this.createNewFileName();\n }\n\n public execute(data: LogDataType): void {\n const level = this.getLogLevel();\n const userLevel = LogLevel[data.level];\n if (level > userLevel) return;\n\n const [error, formattedMessage] = mightThrowSync(() => {\n if (this.isJSONFile()) {\n return JSON.stringify({\n timestamp: isoDateTimeFormat(),\n level: data.level,\n message: data.msg,\n });\n }\n\n const { formatter } = this.options;\n return formatter?.format(data) ?? \"\";\n });\n\n const [fsError] = mightThrowSync(() => {\n if (error && error instanceof Error) {\n const { formatter } = this.options;\n const errorMsg = formatter?.formatError(data, error);\n appendFileSync(this.file, `${errorMsg}\\n`);\n }\n\n if (this.canRollFile()) {\n this.counter += 1;\n this.file = this.createNewFileName();\n }\n\n if (error || !formattedMessage) return;\n appendFileSync(this.file, `${formattedMessage}\\n`);\n });\n\n if (fsError && fsError instanceof Error) {\n throw fsError;\n }\n }\n\n private canRollFile() {\n if (!this.policy) return false;\n\n switch (this.policy.type) {\n case \"size\": {\n if (this.policy.maxSize) {\n return this.getFileSize() >= this.policy.maxSize;\n }\n\n return this.getFileSize() >= DEFAULT_MAX_SIZE;\n }\n case \"time\": {\n if (!existsSync(this.file)) return false;\n\n const { duration, instant } = this.policy;\n const { birthtime } = statSync(this.file);\n const creationTimeMs = birthtime.getTime();\n const currenTimeMs = Date.now();\n const diffMs = currenTimeMs - creationTimeMs;\n\n switch (instant) {\n case \"hour\":\n return Math.floor(diffMs / DurationUnit.hour) >= duration;\n case \"day\":\n return Math.floor(diffMs / DurationUnit.day) >= duration;\n case \"week\":\n return Math.floor(diffMs / DurationUnit.week) >= duration;\n case \"month\": {\n const currentDate = new Date(currenTimeMs);\n const monthsDiff =\n (currentDate.getFullYear() - birthtime.getFullYear()) * 12 +\n (currentDate.getMonth() - birthtime.getMonth());\n\n const adjustedDiff =\n currentDate.getDate() >= birthtime.getDate()\n ? monthsDiff\n : monthsDiff - 1;\n\n return adjustedDiff >= duration;\n }\n }\n }\n }\n }\n\n private getFileSize() {\n if (!existsSync(this.file)) {\n return 0;\n }\n\n const [statError, size] = mightThrowSync(() => {\n const { size } = statSync(this.file);\n return size;\n });\n\n if (statError && statError instanceof Error) {\n return 0;\n }\n\n if (!size) return 0;\n\n return size;\n }\n\n private isJSONFile() {\n return extname(this.filePath) === \".json\";\n }\n\n private createNewFileName() {\n const fileName = basename(this.filePath);\n const directory = dirname(this.filePath);\n\n if (!existsSync(directory)) {\n mkdirSync(directory, { recursive: true });\n }\n\n const fileInfo = fileName.split(\".\");\n const extension = fileInfo.pop();\n const newFileName = [...fileInfo, this.counter, extension].join(\".\");\n\n return join(directory, newFileName);\n }\n}\n\nexport class ConsoleProvider extends LoggerProvider {\n public execute(data: LogDataType): void {\n const level = this.getLogLevel();\n const userLevel = LogLevel[data.level];\n if (level > userLevel) return;\n\n const [error, formattedMessage] = mightThrowSync(() => {\n const { formatter } = this.options;\n return formatter?.format(data) ?? \"\";\n });\n\n // biome-ignore-start lint/suspicious/noConsole: function used for the correct\n // functionality of the logger\n if (error && error instanceof Error) {\n const { formatter } = this.options;\n console.error(formatter?.formatError(data, error));\n\n return;\n }\n\n if (!formattedMessage) return;\n\n switch (userLevel) {\n case LogLevel.debug:\n console.debug(formattedMessage);\n break;\n case LogLevel.info:\n console.info(formattedMessage);\n break;\n case LogLevel.warning:\n console.warn(formattedMessage);\n break;\n case LogLevel.error:\n console.error(formattedMessage);\n break;\n case LogLevel.critical:\n console.error(formattedMessage);\n break;\n default:\n console.debug(formattedMessage);\n break;\n }\n // biome-ignore-end lint/suspicious/noConsole: function used for the correct\n // functionality of the logger\n }\n}\n"],"mappings":";;;;;;;AAcA,MAAM,mBAAmB,IAAI;AAE7B,MAAM,eAAe;CACnB,MAAM,MAAO,KAAK;CAClB,KAAK,MAAO,KAAK,KAAK;CACtB,MAAM,MAAO,KAAK,KAAK,KAAK;CAC5B,OAAO,MAAO,KAAK,KAAK,KAAK,IAAI;CAClC;AAED,IAAsB,iBAAtB,MAAqC;CACnC;CAEA,YAAmB,UAA2B,yBAAyB;AACrE,OAAK,UAAU;GAAE,GAAG;GAAyB,GAAG;GAAS;;CAK3D,cAA6B;AAC3B,MAAI,CAAC,KAAK,QAAQ,MAChB,QAAO,SAAS;AAGlB,SAAO,SAAS,KAAK,QAAQ;;;AAIjC,MAAM,+BAAoD;CACxD,GAAG;CACH,QAAQ,EAAE,MAAM,QAAQ;CACzB;AAED,IAAa,eAAb,cAAkC,eAAe;CAC/C;CAEA;CACA;CACA;CAEA,YACE,MACA,UAA+B,8BAC/B;AACA,QAAM;GACJ,WAAW,QAAQ,aAA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AAC,OAAO,oBAAoB,qBAAqB;GACrD,MAAM,EAAE,cAAc,KAAK;AAC3B,UAAO,WAAW,OAAO,KAAK,IAAI;IAClC;AAIF,MAAI,SAAS,iBAAiB,OAAO;GACnC,MAAM,EAAE,cAAc,KAAK;AAC3B,WAAQ,MAAM,WAAW,YAAY,MAAM,MAAM,CAAC;AAElD;;AAGF,MAAI,CAAC,iBAAkB;AAEvB,UAAQ,WAAR;GACE,KAAK,SAAS;AACZ,YAAQ,MAAM,iBAAiB;AAC/B;GACF,KAAK,SAAS;AACZ,YAAQ,KAAK,iBAAiB;AAC9B;GACF,KAAK,SAAS;AACZ,YAAQ,KAAK,iBAAiB;AAC9B;GACF,KAAK,SAAS;AACZ,YAAQ,MAAM,iBAAiB;AAC/B;GACF,KAAK,SAAS;AACZ,YAAQ,MAAM,iBAAiB;AAC/B;GACF;AACE,YAAQ,MAAM,iBAAiB;AAC/B"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { LogLevelType } from "../core/types.cjs";
|
|
2
|
-
import { Formatter } from "../formatter/index.cjs";
|
|
3
|
-
|
|
4
|
-
//#region src/lib/logging/provider/types.d.ts
|
|
5
|
-
type ProviderOptions = {
|
|
6
|
-
level?: LogLevelType;
|
|
7
|
-
formatter?: Formatter;
|
|
8
|
-
};
|
|
9
|
-
interface SizeBasedPolicyType {
|
|
10
|
-
type: "size";
|
|
11
|
-
maxSize?: number;
|
|
12
|
-
}
|
|
13
|
-
interface TimeBasedPolicyType {
|
|
14
|
-
type: "time";
|
|
15
|
-
instant: "hour" | "day" | "week" | "month";
|
|
16
|
-
duration: number;
|
|
17
|
-
}
|
|
18
|
-
type FileProviderOptions = ProviderOptions & {
|
|
19
|
-
policy?: SizeBasedPolicyType | TimeBasedPolicyType;
|
|
20
|
-
};
|
|
21
|
-
//#endregion
|
|
22
|
-
export { FileProviderOptions, ProviderOptions, SizeBasedPolicyType, TimeBasedPolicyType };
|
|
23
|
-
//# sourceMappingURL=types.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../../src/lib/logging/provider/types.ts"],"mappings":";;;;KAGY,eAAA;EACV,KAAA,GAAQ,YAAA;EACR,SAAA,GAAY,SAAA;AAAA;AAAA,UAGG,mBAAA;EACf,IAAA;EACA,OAAA;AAAA;AAAA,UAGe,mBAAA;EACf,IAAA;EACA,OAAA;EACA,QAAA;AAAA;AAAA,KAGU,mBAAA,GAAsB,eAAA;EAChC,MAAA,GAAS,mBAAA,GAAsB,mBAAA;AAAA"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { LogLevelType } from "../core/types.mjs";
|
|
2
|
-
import { Formatter } from "../formatter/index.mjs";
|
|
3
|
-
|
|
4
|
-
//#region src/lib/logging/provider/types.d.ts
|
|
5
|
-
type ProviderOptions = {
|
|
6
|
-
level?: LogLevelType;
|
|
7
|
-
formatter?: Formatter;
|
|
8
|
-
};
|
|
9
|
-
interface SizeBasedPolicyType {
|
|
10
|
-
type: "size";
|
|
11
|
-
maxSize?: number;
|
|
12
|
-
}
|
|
13
|
-
interface TimeBasedPolicyType {
|
|
14
|
-
type: "time";
|
|
15
|
-
instant: "hour" | "day" | "week" | "month";
|
|
16
|
-
duration: number;
|
|
17
|
-
}
|
|
18
|
-
type FileProviderOptions = ProviderOptions & {
|
|
19
|
-
policy?: SizeBasedPolicyType | TimeBasedPolicyType;
|
|
20
|
-
};
|
|
21
|
-
//#endregion
|
|
22
|
-
export { FileProviderOptions, ProviderOptions, SizeBasedPolicyType, TimeBasedPolicyType };
|
|
23
|
-
//# sourceMappingURL=types.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../src/lib/logging/provider/types.ts"],"mappings":";;;;KAGY,eAAA;EACV,KAAA,GAAQ,YAAA;EACR,SAAA,GAAY,SAAA;AAAA;AAAA,UAGG,mBAAA;EACf,IAAA;EACA,OAAA;AAAA;AAAA,UAGe,mBAAA;EACf,IAAA;EACA,OAAA;EACA,QAAA;AAAA;AAAA,KAGU,mBAAA,GAAsB,eAAA;EAChC,MAAA,GAAS,mBAAA,GAAsB,mBAAA;AAAA"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
//#region node_modules/@standard-schema/spec/dist/index.d.ts
|
|
2
|
-
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
3
|
-
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
4
|
-
/** The Standard properties. */
|
|
5
|
-
readonly "~standard": StandardTypedV1.Props<Input, Output>;
|
|
6
|
-
}
|
|
7
|
-
declare namespace StandardTypedV1 {
|
|
8
|
-
/** The Standard Typed properties interface. */
|
|
9
|
-
interface Props<Input = unknown, Output = Input> {
|
|
10
|
-
/** The version number of the standard. */
|
|
11
|
-
readonly version: 1;
|
|
12
|
-
/** The vendor name of the schema library. */
|
|
13
|
-
readonly vendor: string;
|
|
14
|
-
/** Inferred types associated with the schema. */
|
|
15
|
-
readonly types?: Types<Input, Output> | undefined;
|
|
16
|
-
}
|
|
17
|
-
/** The Standard Typed types interface. */
|
|
18
|
-
interface Types<Input = unknown, Output = Input> {
|
|
19
|
-
/** The input type of the schema. */
|
|
20
|
-
readonly input: Input;
|
|
21
|
-
/** The output type of the schema. */
|
|
22
|
-
readonly output: Output;
|
|
23
|
-
}
|
|
24
|
-
/** Infers the input type of a Standard Typed. */
|
|
25
|
-
type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
26
|
-
/** Infers the output type of a Standard Typed. */
|
|
27
|
-
type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
28
|
-
}
|
|
29
|
-
/** The Standard Schema interface. */
|
|
30
|
-
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
31
|
-
/** The Standard Schema properties. */
|
|
32
|
-
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
33
|
-
}
|
|
34
|
-
declare namespace StandardSchemaV1 {
|
|
35
|
-
/** The Standard Schema properties interface. */
|
|
36
|
-
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
37
|
-
/** Validates unknown input values. */
|
|
38
|
-
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
39
|
-
}
|
|
40
|
-
/** The result interface of the validate function. */
|
|
41
|
-
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
42
|
-
/** The result interface if validation succeeds. */
|
|
43
|
-
interface SuccessResult<Output> {
|
|
44
|
-
/** The typed output value. */
|
|
45
|
-
readonly value: Output;
|
|
46
|
-
/** A falsy value for `issues` indicates success. */
|
|
47
|
-
readonly issues?: undefined;
|
|
48
|
-
}
|
|
49
|
-
interface Options {
|
|
50
|
-
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
51
|
-
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
52
|
-
}
|
|
53
|
-
/** The result interface if validation fails. */
|
|
54
|
-
interface FailureResult {
|
|
55
|
-
/** The issues of failed validation. */
|
|
56
|
-
readonly issues: ReadonlyArray<Issue>;
|
|
57
|
-
}
|
|
58
|
-
/** The issue interface of the failure output. */
|
|
59
|
-
interface Issue {
|
|
60
|
-
/** The error message of the issue. */
|
|
61
|
-
readonly message: string;
|
|
62
|
-
/** The path of the issue, if any. */
|
|
63
|
-
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
64
|
-
}
|
|
65
|
-
/** The path segment interface of the issue. */
|
|
66
|
-
interface PathSegment {
|
|
67
|
-
/** The key representing a path segment. */
|
|
68
|
-
readonly key: PropertyKey;
|
|
69
|
-
}
|
|
70
|
-
/** The Standard types interface. */
|
|
71
|
-
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
|
|
72
|
-
/** Infers the input type of a Standard. */
|
|
73
|
-
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
74
|
-
/** Infers the output type of a Standard. */
|
|
75
|
-
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
76
|
-
}
|
|
77
|
-
/** The Standard JSON Schema interface. */
|
|
78
|
-
//#endregion
|
|
79
|
-
export { StandardSchemaV1 };
|
|
80
|
-
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":["StandardTypedV1","Input","Output","Props","Schema","Types","NonNullable","version","vendor","types","input","output","InferInput","InferOutput","StandardSchemaV1","Options","Result","Promise","SuccessResult","FailureResult","Record","Issue","ReadonlyArray","PropertyKey","PathSegment","validate","value","options","issues","libraryOptions","message","path","key","StandardJSONSchemaV1","Converter","Target","jsonSchema","target"],"sources":["../../../../../node_modules/@standard-schema/spec/dist/index.d.ts"],"x_google_ignoreList":[0],"mappings":";;UACUA,eAAAA,2BAA0CC,KAAAA;EAA3B;EAAA,SAEZ,WAAA,EAAaD,eAAAA,CAAgBG,KAAAA,CAAMF,KAAAA,EAAOC,MAAAA;AAAAA;AAAAA,kBAErCF,eAAAA;EAFqCE;EAAAA,UAIzCC,KAAAA,2BAAgCF,KAAAA;IAJC;IAAA,SAM9BM,OAAAA;IARSN;IAAAA,SAUTO,MAAAA;IAVmCP;IAAAA,SAYnCQ,KAAAA,GAAQJ,KAAAA,CAAMJ,KAAAA,EAAOC,MAAAA;EAAAA;EAVIC;EAAAA,UAa5BE,KAAAA,2BAAgCJ,KAAAA;IAbSC;IAAAA,SAetCQ,KAAAA,EAAOT,KAAAA;IAfqC;IAAA,SAiB5CU,MAAAA,EAAQT,MAAAA;EAAAA;EAfQD;EAAAA,KAkBxBW,UAAAA,gBAA0BZ,eAAAA,IAAmBM,WAAAA,CAAYF,MAAAA;EAVnCH;EAAAA,KAYtBY,WAAAA,gBAA2Bb,eAAAA,IAAmBM,WAAAA,CAAYF,MAAAA;AAAAA;;UAGzDU,gBAAA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UAAAA,CAAWR,MAAAA;EA1CzBF;EAAAA,KA4C/CW,WAAAA,gBAA2Bb,eAAAA,IAAmBA,eAAAA,CAAgBa,WAAAA,CAAYT,MAAAA;AAAAA"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
//#region node_modules/@standard-schema/spec/dist/index.d.ts
|
|
2
|
-
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
3
|
-
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
4
|
-
/** The Standard properties. */
|
|
5
|
-
readonly "~standard": StandardTypedV1.Props<Input, Output>;
|
|
6
|
-
}
|
|
7
|
-
declare namespace StandardTypedV1 {
|
|
8
|
-
/** The Standard Typed properties interface. */
|
|
9
|
-
interface Props<Input = unknown, Output = Input> {
|
|
10
|
-
/** The version number of the standard. */
|
|
11
|
-
readonly version: 1;
|
|
12
|
-
/** The vendor name of the schema library. */
|
|
13
|
-
readonly vendor: string;
|
|
14
|
-
/** Inferred types associated with the schema. */
|
|
15
|
-
readonly types?: Types<Input, Output> | undefined;
|
|
16
|
-
}
|
|
17
|
-
/** The Standard Typed types interface. */
|
|
18
|
-
interface Types<Input = unknown, Output = Input> {
|
|
19
|
-
/** The input type of the schema. */
|
|
20
|
-
readonly input: Input;
|
|
21
|
-
/** The output type of the schema. */
|
|
22
|
-
readonly output: Output;
|
|
23
|
-
}
|
|
24
|
-
/** Infers the input type of a Standard Typed. */
|
|
25
|
-
type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
26
|
-
/** Infers the output type of a Standard Typed. */
|
|
27
|
-
type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
28
|
-
}
|
|
29
|
-
/** The Standard Schema interface. */
|
|
30
|
-
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
31
|
-
/** The Standard Schema properties. */
|
|
32
|
-
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
33
|
-
}
|
|
34
|
-
declare namespace StandardSchemaV1 {
|
|
35
|
-
/** The Standard Schema properties interface. */
|
|
36
|
-
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
37
|
-
/** Validates unknown input values. */
|
|
38
|
-
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
39
|
-
}
|
|
40
|
-
/** The result interface of the validate function. */
|
|
41
|
-
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
42
|
-
/** The result interface if validation succeeds. */
|
|
43
|
-
interface SuccessResult<Output> {
|
|
44
|
-
/** The typed output value. */
|
|
45
|
-
readonly value: Output;
|
|
46
|
-
/** A falsy value for `issues` indicates success. */
|
|
47
|
-
readonly issues?: undefined;
|
|
48
|
-
}
|
|
49
|
-
interface Options {
|
|
50
|
-
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
51
|
-
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
52
|
-
}
|
|
53
|
-
/** The result interface if validation fails. */
|
|
54
|
-
interface FailureResult {
|
|
55
|
-
/** The issues of failed validation. */
|
|
56
|
-
readonly issues: ReadonlyArray<Issue>;
|
|
57
|
-
}
|
|
58
|
-
/** The issue interface of the failure output. */
|
|
59
|
-
interface Issue {
|
|
60
|
-
/** The error message of the issue. */
|
|
61
|
-
readonly message: string;
|
|
62
|
-
/** The path of the issue, if any. */
|
|
63
|
-
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
64
|
-
}
|
|
65
|
-
/** The path segment interface of the issue. */
|
|
66
|
-
interface PathSegment {
|
|
67
|
-
/** The key representing a path segment. */
|
|
68
|
-
readonly key: PropertyKey;
|
|
69
|
-
}
|
|
70
|
-
/** The Standard types interface. */
|
|
71
|
-
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
|
|
72
|
-
/** Infers the input type of a Standard. */
|
|
73
|
-
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
74
|
-
/** Infers the output type of a Standard. */
|
|
75
|
-
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
76
|
-
}
|
|
77
|
-
/** The Standard JSON Schema interface. */
|
|
78
|
-
//#endregion
|
|
79
|
-
export { StandardSchemaV1 };
|
|
80
|
-
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":["StandardTypedV1","Input","Output","Props","Schema","Types","NonNullable","version","vendor","types","input","output","InferInput","InferOutput","StandardSchemaV1","Options","Result","Promise","SuccessResult","FailureResult","Record","Issue","ReadonlyArray","PropertyKey","PathSegment","validate","value","options","issues","libraryOptions","message","path","key","StandardJSONSchemaV1","Converter","Target","jsonSchema","target"],"sources":["../../../../../node_modules/@standard-schema/spec/dist/index.d.ts"],"x_google_ignoreList":[0],"mappings":";;UACUA,eAAAA,2BAA0CC,KAAAA;EAA3B;EAAA,SAEZ,WAAA,EAAaD,eAAAA,CAAgBG,KAAAA,CAAMF,KAAAA,EAAOC,MAAAA;AAAAA;AAAAA,kBAErCF,eAAAA;EAFqCE;EAAAA,UAIzCC,KAAAA,2BAAgCF,KAAAA;IAJC;IAAA,SAM9BM,OAAAA;IARSN;IAAAA,SAUTO,MAAAA;IAVmCP;IAAAA,SAYnCQ,KAAAA,GAAQJ,KAAAA,CAAMJ,KAAAA,EAAOC,MAAAA;EAAAA;EAVIC;EAAAA,UAa5BE,KAAAA,2BAAgCJ,KAAAA;IAbSC;IAAAA,SAetCQ,KAAAA,EAAOT,KAAAA;IAfqC;IAAA,SAiB5CU,MAAAA,EAAQT,MAAAA;EAAAA;EAfQD;EAAAA,KAkBxBW,UAAAA,gBAA0BZ,eAAAA,IAAmBM,WAAAA,CAAYF,MAAAA;EAVnCH;EAAAA,KAYtBY,WAAAA,gBAA2Bb,eAAAA,IAAmBM,WAAAA,CAAYF,MAAAA;AAAAA;;UAGzDU,gBAAAA,2BAA2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AAWR,MAAAA;EA1CzBF;EAAAA,KA4C/CW,WAAAA,gBAA2Bb,eAAAA,IAAmBA,eAAAA,CAAgBa,WAAAA,CAAYT,MAAAA;AAAAA"}
|
package/dist/orm/column.cjs
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
//#region src/lib/orm/column.ts
|
|
2
|
-
var ColumnDef = class ColumnDef {
|
|
3
|
-
constructor(kind, meta) {
|
|
4
|
-
this.kind = kind;
|
|
5
|
-
this.meta = meta;
|
|
6
|
-
}
|
|
7
|
-
primaryKey() {
|
|
8
|
-
return new ColumnDef(this.kind, {
|
|
9
|
-
...this.meta,
|
|
10
|
-
isPrimaryKey: true,
|
|
11
|
-
isNotNull: true
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
asArray() {
|
|
15
|
-
return new ColumnDef(this.kind, {
|
|
16
|
-
...this.meta,
|
|
17
|
-
isSqlArray: true
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
notNull() {
|
|
21
|
-
return new ColumnDef(this.kind, {
|
|
22
|
-
...this.meta,
|
|
23
|
-
isNotNull: true
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
unique() {
|
|
27
|
-
return new ColumnDef(this.kind, {
|
|
28
|
-
...this.meta,
|
|
29
|
-
isUnique: true
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
references(fn) {
|
|
33
|
-
return new ColumnDef(this.kind, {
|
|
34
|
-
...this.meta,
|
|
35
|
-
references: fn
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
onDelete(action) {
|
|
39
|
-
return new ColumnDef(this.kind, {
|
|
40
|
-
...this.meta,
|
|
41
|
-
onDeleteAction: action
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
default(value) {
|
|
45
|
-
return new ColumnDef(this.kind, {
|
|
46
|
-
...this.meta,
|
|
47
|
-
hasDefault: true,
|
|
48
|
-
defaultKind: "value",
|
|
49
|
-
defaultValue: value,
|
|
50
|
-
defaultFn: null
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
defaultFn(fn) {
|
|
54
|
-
return new ColumnDef(this.kind, {
|
|
55
|
-
...this.meta,
|
|
56
|
-
hasDefault: true,
|
|
57
|
-
defaultKind: "fn",
|
|
58
|
-
defaultValue: void 0,
|
|
59
|
-
defaultFn: fn
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
const defaultMeta = {
|
|
64
|
-
isSqlArray: false,
|
|
65
|
-
isPrimaryKey: false,
|
|
66
|
-
isNotNull: false,
|
|
67
|
-
isUnique: false,
|
|
68
|
-
isEnum: false,
|
|
69
|
-
enumValues: null,
|
|
70
|
-
enumName: null,
|
|
71
|
-
hasDefault: false,
|
|
72
|
-
defaultKind: null,
|
|
73
|
-
defaultValue: void 0,
|
|
74
|
-
defaultFn: null,
|
|
75
|
-
references: null,
|
|
76
|
-
onDeleteAction: null
|
|
77
|
-
};
|
|
78
|
-
function uuid(sqlName) {
|
|
79
|
-
return new ColumnDef("uuid", {
|
|
80
|
-
...defaultMeta,
|
|
81
|
-
sqlName
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
function string(sqlName) {
|
|
85
|
-
return new ColumnDef("string", {
|
|
86
|
-
...defaultMeta,
|
|
87
|
-
sqlName
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function enumeration(sqlName, enumName, values) {
|
|
91
|
-
return new ColumnDef("enum", {
|
|
92
|
-
...defaultMeta,
|
|
93
|
-
isEnum: true,
|
|
94
|
-
enumValues: values,
|
|
95
|
-
enumName,
|
|
96
|
-
sqlName
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
function number(sqlName) {
|
|
100
|
-
return new ColumnDef("number", {
|
|
101
|
-
...defaultMeta,
|
|
102
|
-
sqlName
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
function boolean(sqlName) {
|
|
106
|
-
return new ColumnDef("boolean", {
|
|
107
|
-
...defaultMeta,
|
|
108
|
-
sqlName
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
function date(sqlName) {
|
|
112
|
-
return new ColumnDef("date", {
|
|
113
|
-
...defaultMeta,
|
|
114
|
-
sqlName
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
function json(sqlName) {
|
|
118
|
-
return new ColumnDef("json", {
|
|
119
|
-
...defaultMeta,
|
|
120
|
-
sqlName
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
function jsonb(sqlName) {
|
|
124
|
-
return new ColumnDef("jsonb", {
|
|
125
|
-
...defaultMeta,
|
|
126
|
-
sqlName
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
//#endregion
|
|
130
|
-
exports.boolean = boolean;
|
|
131
|
-
exports.date = date;
|
|
132
|
-
exports.enumeration = enumeration;
|
|
133
|
-
exports.json = json;
|
|
134
|
-
exports.jsonb = jsonb;
|
|
135
|
-
exports.number = number;
|
|
136
|
-
exports.string = string;
|
|
137
|
-
exports.uuid = uuid;
|
package/dist/orm/column.d.cts
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { ColumnKind, ColumnMetaBase, KindToType } from "./types.cjs";
|
|
2
|
-
|
|
3
|
-
//#region src/lib/orm/column.d.ts
|
|
4
|
-
declare class ColumnDef<K extends ColumnKind, TMeta extends ColumnMetaBase, TValue = KindToType<K>> {
|
|
5
|
-
readonly kind: K;
|
|
6
|
-
readonly meta: TMeta;
|
|
7
|
-
constructor(kind: K, meta: TMeta);
|
|
8
|
-
primaryKey(): ColumnDef<K, TMeta & {
|
|
9
|
-
isPrimaryKey: true;
|
|
10
|
-
isNotNull: true;
|
|
11
|
-
}, TValue>;
|
|
12
|
-
asArray(): ColumnDef<K, TMeta & {
|
|
13
|
-
isSqlArray: true;
|
|
14
|
-
}, [TValue] extends [unknown[]] ? TValue : TValue[]>;
|
|
15
|
-
notNull(): ColumnDef<K, TMeta & {
|
|
16
|
-
isNotNull: true;
|
|
17
|
-
}, TValue>;
|
|
18
|
-
unique(): ColumnDef<K, TMeta & {
|
|
19
|
-
isUnique: true;
|
|
20
|
-
}, TValue>;
|
|
21
|
-
references(fn: () => ColumnDef<ColumnKind, ColumnMetaBase, unknown>): ColumnDef<K, TMeta & {
|
|
22
|
-
references: () => ColumnDef<ColumnKind, ColumnMetaBase, unknown>;
|
|
23
|
-
}, TValue>;
|
|
24
|
-
onDelete(action: "CASCADE" | "RESTRICT" | "SET NULL"): ColumnDef<K, TMeta & {
|
|
25
|
-
onDeleteAction: "CASCADE" | "RESTRICT" | "SET NULL";
|
|
26
|
-
}, TValue>;
|
|
27
|
-
default(value: TValue): ColumnDef<K, TMeta & {
|
|
28
|
-
hasDefault: true;
|
|
29
|
-
defaultKind: "value";
|
|
30
|
-
}, TValue>;
|
|
31
|
-
defaultFn(fn: () => TValue): ColumnDef<K, TMeta & {
|
|
32
|
-
hasDefault: true;
|
|
33
|
-
defaultKind: "fn";
|
|
34
|
-
}, TValue>;
|
|
35
|
-
}
|
|
36
|
-
declare function uuid(sqlName: string): ColumnDef<"uuid", {
|
|
37
|
-
sqlName: string;
|
|
38
|
-
defaultValue: unknown;
|
|
39
|
-
isSqlArray: boolean;
|
|
40
|
-
isPrimaryKey: boolean;
|
|
41
|
-
isNotNull: boolean;
|
|
42
|
-
isUnique: boolean;
|
|
43
|
-
isEnum: boolean;
|
|
44
|
-
enumValues: string[] | null;
|
|
45
|
-
enumName: string | null;
|
|
46
|
-
hasDefault: boolean;
|
|
47
|
-
defaultKind: "value" | "fn" | null;
|
|
48
|
-
defaultFn: (() => unknown) | null;
|
|
49
|
-
references: (() => ColumnDef<ColumnKind, ColumnMetaBase, unknown>) | null;
|
|
50
|
-
onDeleteAction: "CASCADE" | "RESTRICT" | "SET NULL" | null;
|
|
51
|
-
}, string>;
|
|
52
|
-
declare function string(sqlName: string): ColumnDef<"string", {
|
|
53
|
-
sqlName: string;
|
|
54
|
-
defaultValue: unknown;
|
|
55
|
-
isSqlArray: boolean;
|
|
56
|
-
isPrimaryKey: boolean;
|
|
57
|
-
isNotNull: boolean;
|
|
58
|
-
isUnique: boolean;
|
|
59
|
-
isEnum: boolean;
|
|
60
|
-
enumValues: string[] | null;
|
|
61
|
-
enumName: string | null;
|
|
62
|
-
hasDefault: boolean;
|
|
63
|
-
defaultKind: "value" | "fn" | null;
|
|
64
|
-
defaultFn: (() => unknown) | null;
|
|
65
|
-
references: (() => ColumnDef<ColumnKind, ColumnMetaBase, unknown>) | null;
|
|
66
|
-
onDeleteAction: "CASCADE" | "RESTRICT" | "SET NULL" | null;
|
|
67
|
-
}, string>;
|
|
68
|
-
declare function enumeration<const TValues extends string[]>(sqlName: string, enumName: string, values: TValues): ColumnDef<"enum", ColumnMetaBase, TValues[number]>;
|
|
69
|
-
declare function number(sqlName: string): ColumnDef<"number", {
|
|
70
|
-
sqlName: string;
|
|
71
|
-
defaultValue: unknown;
|
|
72
|
-
isSqlArray: boolean;
|
|
73
|
-
isPrimaryKey: boolean;
|
|
74
|
-
isNotNull: boolean;
|
|
75
|
-
isUnique: boolean;
|
|
76
|
-
isEnum: boolean;
|
|
77
|
-
enumValues: string[] | null;
|
|
78
|
-
enumName: string | null;
|
|
79
|
-
hasDefault: boolean;
|
|
80
|
-
defaultKind: "value" | "fn" | null;
|
|
81
|
-
defaultFn: (() => unknown) | null;
|
|
82
|
-
references: (() => ColumnDef<ColumnKind, ColumnMetaBase, unknown>) | null;
|
|
83
|
-
onDeleteAction: "CASCADE" | "RESTRICT" | "SET NULL" | null;
|
|
84
|
-
}, number>;
|
|
85
|
-
declare function boolean(sqlName: string): ColumnDef<"boolean", {
|
|
86
|
-
sqlName: string;
|
|
87
|
-
defaultValue: unknown;
|
|
88
|
-
isSqlArray: boolean;
|
|
89
|
-
isPrimaryKey: boolean;
|
|
90
|
-
isNotNull: boolean;
|
|
91
|
-
isUnique: boolean;
|
|
92
|
-
isEnum: boolean;
|
|
93
|
-
enumValues: string[] | null;
|
|
94
|
-
enumName: string | null;
|
|
95
|
-
hasDefault: boolean;
|
|
96
|
-
defaultKind: "value" | "fn" | null;
|
|
97
|
-
defaultFn: (() => unknown) | null;
|
|
98
|
-
references: (() => ColumnDef<ColumnKind, ColumnMetaBase, unknown>) | null;
|
|
99
|
-
onDeleteAction: "CASCADE" | "RESTRICT" | "SET NULL" | null;
|
|
100
|
-
}, boolean>;
|
|
101
|
-
declare function date(sqlName: string): ColumnDef<"date", {
|
|
102
|
-
sqlName: string;
|
|
103
|
-
defaultValue: unknown;
|
|
104
|
-
isSqlArray: boolean;
|
|
105
|
-
isPrimaryKey: boolean;
|
|
106
|
-
isNotNull: boolean;
|
|
107
|
-
isUnique: boolean;
|
|
108
|
-
isEnum: boolean;
|
|
109
|
-
enumValues: string[] | null;
|
|
110
|
-
enumName: string | null;
|
|
111
|
-
hasDefault: boolean;
|
|
112
|
-
defaultKind: "value" | "fn" | null;
|
|
113
|
-
defaultFn: (() => unknown) | null;
|
|
114
|
-
references: (() => ColumnDef<ColumnKind, ColumnMetaBase, unknown>) | null;
|
|
115
|
-
onDeleteAction: "CASCADE" | "RESTRICT" | "SET NULL" | null;
|
|
116
|
-
}, Date>;
|
|
117
|
-
declare function json<const T>(sqlName: string): ColumnDef<"json", ColumnMetaBase, T>;
|
|
118
|
-
declare function jsonb<const T>(sqlName: string): ColumnDef<"jsonb", ColumnMetaBase, T>;
|
|
119
|
-
//#endregion
|
|
120
|
-
export { ColumnDef, boolean, date, enumeration, json, jsonb, number, string, uuid };
|
|
121
|
-
//# sourceMappingURL=column.d.cts.map
|