nextly 0.0.1 → 0.0.2-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +122 -0
- package/dist/_dts-chunks/collections-handler.d-DjgO74Wt.d.ts +20540 -0
- package/dist/_dts-chunks/config.d-DNwsDnjs.d.ts +2589 -0
- package/dist/_dts-chunks/define-component.d-BUgTHmt3.d.ts +1149 -0
- package/dist/_dts-chunks/image-processor.d-OO1PmMrv.d.ts +335 -0
- package/dist/_dts-chunks/index.d-axCAzZ7m.d.ts +17842 -0
- package/dist/_dts-chunks/media.d-DjDOZo4B.d.ts +117 -0
- package/dist/_dts-chunks/on-error.d-CHIKWNxd.d.ts +38 -0
- package/dist/_dts-chunks/storage.d-BUhQ2we_.d.ts +404 -0
- package/dist/actions/index.d.ts +239 -0
- package/dist/actions/index.mjs +281 -0
- package/dist/api/auth-state.d.ts +5 -0
- package/dist/api/auth-state.mjs +131 -0
- package/dist/api/collections-schema-detail.d.ts +56 -0
- package/dist/api/collections-schema-detail.mjs +244 -0
- package/dist/api/collections-schema-export.d.ts +56 -0
- package/dist/api/collections-schema-export.mjs +129 -0
- package/dist/api/collections-schema.d.ts +59 -0
- package/dist/api/collections-schema.mjs +207 -0
- package/dist/api/components-detail.d.ts +50 -0
- package/dist/api/components-detail.mjs +132 -0
- package/dist/api/components.d.ts +69 -0
- package/dist/api/components.mjs +144 -0
- package/dist/api/email-providers-default.d.ts +40 -0
- package/dist/api/email-providers-default.mjs +75 -0
- package/dist/api/email-providers-detail.d.ts +81 -0
- package/dist/api/email-providers-detail.mjs +109 -0
- package/dist/api/email-providers-test.d.ts +43 -0
- package/dist/api/email-providers-test.mjs +114 -0
- package/dist/api/email-providers.d.ts +69 -0
- package/dist/api/email-providers.mjs +110 -0
- package/dist/api/email-send-template.d.ts +41 -0
- package/dist/api/email-send-template.mjs +58 -0
- package/dist/api/email-send.d.ts +42 -0
- package/dist/api/email-send.mjs +58 -0
- package/dist/api/email-templates-detail.d.ts +74 -0
- package/dist/api/email-templates-detail.mjs +112 -0
- package/dist/api/email-templates-layout.d.ts +55 -0
- package/dist/api/email-templates-layout.mjs +92 -0
- package/dist/api/email-templates-preview.d.ts +48 -0
- package/dist/api/email-templates-preview.mjs +93 -0
- package/dist/api/email-templates.d.ts +61 -0
- package/dist/api/email-templates.mjs +118 -0
- package/dist/api/health.d.ts +68 -0
- package/dist/api/health.mjs +67 -0
- package/dist/api/index.d.ts +54 -0
- package/dist/api/index.mjs +16 -0
- package/dist/api/media-bulk.d.ts +74 -0
- package/dist/api/media-bulk.mjs +196 -0
- package/dist/api/media-folders.d.ts +112 -0
- package/dist/api/media-folders.mjs +187 -0
- package/dist/api/media-handlers.d.ts +102 -0
- package/dist/api/media-handlers.mjs +437 -0
- package/dist/api/media.d.ts +117 -0
- package/dist/api/media.mjs +242 -0
- package/dist/api/singles-detail.d.ts +87 -0
- package/dist/api/singles-detail.mjs +170 -0
- package/dist/api/singles-schema-detail.d.ts +54 -0
- package/dist/api/singles-schema-detail.mjs +182 -0
- package/dist/api/singles.d.ts +34 -0
- package/dist/api/singles.mjs +94 -0
- package/dist/api/storage-upload-url.d.ts +48 -0
- package/dist/api/storage-upload-url.mjs +202 -0
- package/dist/api/uploads.d.ts +109 -0
- package/dist/api/uploads.mjs +359 -0
- package/dist/auth/index.d.ts +425 -0
- package/dist/auth/index.mjs +199 -0
- package/dist/boot-apply-PQSYLDIN.mjs +7 -0
- package/dist/chunk-2OALJTK6.mjs +489 -0
- package/dist/chunk-2Q2SX2CS.mjs +365 -0
- package/dist/chunk-2TFX4ND3.mjs +13 -0
- package/dist/chunk-2TWPDSYD.mjs +87 -0
- package/dist/chunk-2W3DVD7S.mjs +647 -0
- package/dist/chunk-2ZFKXPQM.mjs +88 -0
- package/dist/chunk-3FA7FKAV.mjs +832 -0
- package/dist/chunk-3NZ2KMBL.mjs +58 -0
- package/dist/chunk-4MJLT6PZ.mjs +0 -0
- package/dist/chunk-56WO4WX7.mjs +0 -0
- package/dist/chunk-5APFUGAD.mjs +89 -0
- package/dist/chunk-5HMZ644B.mjs +108 -0
- package/dist/chunk-67GXH6PR.mjs +32 -0
- package/dist/chunk-6JNEPWRW.mjs +14368 -0
- package/dist/chunk-6NFHQIJD.mjs +45 -0
- package/dist/chunk-7P6ASYW6.mjs +9 -0
- package/dist/chunk-A3WPLSDT.mjs +1364 -0
- package/dist/chunk-AGJ6F2T3.mjs +144 -0
- package/dist/chunk-AK6Z23OX.mjs +1464 -0
- package/dist/chunk-APKKRD2G.mjs +102 -0
- package/dist/chunk-B2GV2BWH.mjs +73 -0
- package/dist/chunk-D5HQBNUB.mjs +74 -0
- package/dist/chunk-DNNG377Z.mjs +204 -0
- package/dist/chunk-DP3G27G5.mjs +135 -0
- package/dist/chunk-DV6WVX2Q.mjs +0 -0
- package/dist/chunk-DXGGXIUZ.mjs +57 -0
- package/dist/chunk-EGXBZCGC.mjs +943 -0
- package/dist/chunk-ERCNLX3V.mjs +176 -0
- package/dist/chunk-FQULBZ53.mjs +850 -0
- package/dist/chunk-G2AA4QLC.mjs +262 -0
- package/dist/chunk-GDBJ5JCU.mjs +488 -0
- package/dist/chunk-GJNSJU4S.mjs +19 -0
- package/dist/chunk-GZ6DCQKC.mjs +69 -0
- package/dist/chunk-H26B4FYG.mjs +167 -0
- package/dist/chunk-I4JMR3UR.mjs +21 -0
- package/dist/chunk-INV7QKLG.mjs +508 -0
- package/dist/chunk-IUDOC7N7.mjs +46 -0
- package/dist/chunk-IZWPRDC3.mjs +206 -0
- package/dist/chunk-KIMNCZGV.mjs +15 -0
- package/dist/chunk-L6HW2DA7.mjs +15 -0
- package/dist/chunk-LAZXX4HR.mjs +100 -0
- package/dist/chunk-LDKCUMHK.mjs +95 -0
- package/dist/chunk-LRXMECUA.mjs +0 -0
- package/dist/chunk-M52VMPGA.mjs +119 -0
- package/dist/chunk-MGUWEEI6.mjs +160 -0
- package/dist/chunk-NRUWQ5Z7.mjs +419 -0
- package/dist/chunk-NSEFNNU4.mjs +25360 -0
- package/dist/chunk-NTHVDFGO.mjs +138 -0
- package/dist/chunk-O3QHXMOX.mjs +3166 -0
- package/dist/chunk-P7NH2OSC.mjs +2605 -0
- package/dist/chunk-PKMABBB5.mjs +184 -0
- package/dist/chunk-PWS6XGJK.mjs +76 -0
- package/dist/chunk-R6JJQHFC.mjs +20 -0
- package/dist/chunk-RJLLGGPG.mjs +0 -0
- package/dist/chunk-SBACDPNX.mjs +689 -0
- package/dist/chunk-TO5AFLVQ.mjs +124 -0
- package/dist/chunk-TS7GHTG2.mjs +5436 -0
- package/dist/chunk-UJ2IMJ4W.mjs +133 -0
- package/dist/chunk-UOP63Q54.mjs +102 -0
- package/dist/chunk-UUOFWCM6.mjs +78 -0
- package/dist/chunk-V4EQTOA4.mjs +893 -0
- package/dist/chunk-VJ66NCL4.mjs +193 -0
- package/dist/chunk-VQJQHVEV.mjs +29 -0
- package/dist/chunk-VTJADRO3.mjs +141 -0
- package/dist/chunk-VWF3JO32.mjs +0 -0
- package/dist/chunk-W4MGXIRR.mjs +27 -0
- package/dist/chunk-W5KKPZT5.mjs +1204 -0
- package/dist/chunk-WD34YQ6T.mjs +381 -0
- package/dist/chunk-WZBYMYVW.mjs +14 -0
- package/dist/chunk-X23WKS3Z.mjs +50 -0
- package/dist/chunk-X7TXCYYN.mjs +6496 -0
- package/dist/chunk-XGI4EMS3.mjs +140 -0
- package/dist/chunk-XZKLBMN6.mjs +1153 -0
- package/dist/chunk-YB7INWPY.mjs +0 -0
- package/dist/chunk-YV4Y7SDL.mjs +83 -0
- package/dist/chunk-YZNBLFIW.mjs +1688 -0
- package/dist/chunk-YZZCTONM.mjs +263 -0
- package/dist/chunk-ZE6A3FYH.mjs +289 -0
- package/dist/cli/nextly.mjs +68 -0
- package/dist/cli/utils/index.d.ts +449 -0
- package/dist/cli/utils/index.mjs +49 -0
- package/dist/component-schema-service-5577KVW6.mjs +11 -0
- package/dist/config-loader-23YEMC3Z.mjs +23 -0
- package/dist/config.d.ts +44 -0
- package/dist/config.mjs +109 -0
- package/dist/container-ORGFGYSZ.mjs +9 -0
- package/dist/database/index.d.ts +12 -0
- package/dist/database/index.mjs +40 -0
- package/dist/database/seeders/index.d.ts +93 -0
- package/dist/database/seeders/index.mjs +47 -0
- package/dist/db-sync-demote-LJGKLB3S.mjs +117 -0
- package/dist/db-sync-promote-B26VSYQF.mjs +113 -0
- package/dist/dev-reload-broadcaster-B73IQ53V.mjs +25 -0
- package/dist/dist-M2NOU37V.mjs +19 -0
- package/dist/drizzle-kit-lazy-D2M2PXR2.mjs +13 -0
- package/dist/dynamic-collection-schema-service-IEXTPIZ7.mjs +8 -0
- package/dist/errors/index.d.ts +159 -0
- package/dist/errors/index.mjs +10 -0
- package/dist/factory-IWMBKUJM.mjs +15 -0
- package/dist/first-run-QIVKWJIF.mjs +63 -0
- package/dist/fresh-push-NR67DC3R.mjs +8 -0
- package/dist/index.d.ts +4175 -0
- package/dist/index.mjs +1336 -0
- package/dist/local-plugin-PTET4NAT.mjs +7 -0
- package/dist/logger-NU46DXNY.mjs +15 -0
- package/dist/logger-YE4TC7ZN.mjs +9 -0
- package/dist/migration-journal-EP532Y4L.mjs +139 -0
- package/dist/migrations/mysql/0000_eager_sentry.sql +174 -0
- package/dist/migrations/mysql/0001_soft_giant_girl.sql +27 -0
- package/dist/migrations/mysql/0002_media_table.sql +24 -0
- package/dist/migrations/mysql/0003_dynamic_singles.sql +37 -0
- package/dist/migrations/mysql/0004_dynamic_components.sql +35 -0
- package/dist/migrations/mysql/0005_user_management_tables.sql +92 -0
- package/dist/migrations/mysql/0006_api_keys.sql +36 -0
- package/dist/migrations/mysql/0007_general_settings.sql +20 -0
- package/dist/migrations/mysql/0008_site_settings_logo_url.sql +9 -0
- package/dist/migrations/mysql/0009_activity_log.sql +30 -0
- package/dist/migrations/mysql/0010_site_settings_sidebar.sql +13 -0
- package/dist/migrations/mysql/0011_missing_tables_and_columns.sql +54 -0
- package/dist/migrations/mysql/0012_image_sizes_and_focal_point.sql +30 -0
- package/dist/migrations/mysql/0012_media_folders.sql +43 -0
- package/dist/migrations/mysql/0013_user_brute_force_protection.sql +31 -0
- package/dist/migrations/mysql/0014_email_template_attachments.sql +12 -0
- package/dist/migrations/mysql/0015_media_uploaded_by_nullable.sql +15 -0
- package/dist/migrations/mysql/20260429_000000_000_initial_journal.sql +22 -0
- package/dist/migrations/mysql/20260501_000000_journal_batch.sql +17 -0
- package/dist/migrations/mysql/20260501_000001_audit_log.sql +24 -0
- package/dist/migrations/mysql/20260504_000000_nextly_meta.sql +21 -0
- package/dist/migrations/mysql/meta/0000_snapshot.json +1005 -0
- package/dist/migrations/mysql/meta/0001_snapshot.json +1099 -0
- package/dist/migrations/mysql/meta/_journal.json +41 -0
- package/dist/migrations/postgresql/0000_misty_king_bedlam.sql +169 -0
- package/dist/migrations/postgresql/0001_perpetual_captain_marvel.sql +8 -0
- package/dist/migrations/postgresql/0002_sad_spectrum.sql +16 -0
- package/dist/migrations/postgresql/0003_hesitant_ultron.sql +17 -0
- package/dist/migrations/postgresql/0004_media_table.sql +24 -0
- package/dist/migrations/postgresql/0005_media_folders.sql +36 -0
- package/dist/migrations/postgresql/0006_dynamic_collections_update.sql +50 -0
- package/dist/migrations/postgresql/0007_dynamic_singles.sql +38 -0
- package/dist/migrations/postgresql/0008_dynamic_components.sql +37 -0
- package/dist/migrations/postgresql/0009_user_management_tables.sql +95 -0
- package/dist/migrations/postgresql/0010_api_keys.sql +34 -0
- package/dist/migrations/postgresql/0011_general_settings.sql +20 -0
- package/dist/migrations/postgresql/0012_site_settings_logo_url.sql +9 -0
- package/dist/migrations/postgresql/0013_activity_log.sql +29 -0
- package/dist/migrations/postgresql/0014_image_sizes_and_focal_point.sql +33 -0
- package/dist/migrations/postgresql/0014_site_settings_sidebar.sql +13 -0
- package/dist/migrations/postgresql/0015_user_brute_force_protection.sql +29 -0
- package/dist/migrations/postgresql/0016_email_template_attachments.sql +12 -0
- package/dist/migrations/postgresql/0017_media_uploaded_by_nullable.sql +15 -0
- package/dist/migrations/postgresql/20260429_000000_000_initial_journal.sql +24 -0
- package/dist/migrations/postgresql/20260501_000000_journal_batch.sql +17 -0
- package/dist/migrations/postgresql/20260501_000001_audit_log.sql +24 -0
- package/dist/migrations/postgresql/20260504_000000_nextly_meta.sql +22 -0
- package/dist/migrations/postgresql/meta/0000_snapshot.json +1286 -0
- package/dist/migrations/postgresql/meta/0001_snapshot.json +1407 -0
- package/dist/migrations/postgresql/meta/0002_snapshot.json +1552 -0
- package/dist/migrations/postgresql/meta/0003_snapshot.json +1695 -0
- package/dist/migrations/postgresql/meta/0010_snapshot.json +2345 -0
- package/dist/migrations/postgresql/meta/_journal.json +90 -0
- package/dist/migrations/sqlite/0000_api_keys.sql +34 -0
- package/dist/migrations/sqlite/0001_general_settings.sql +20 -0
- package/dist/migrations/sqlite/0002_site_settings_logo_url.sql +9 -0
- package/dist/migrations/sqlite/0003_activity_log.sql +29 -0
- package/dist/migrations/sqlite/0004_image_sizes_and_focal_point.sql +29 -0
- package/dist/migrations/sqlite/0004_site_settings_sidebar.sql +11 -0
- package/dist/migrations/sqlite/0005_user_brute_force_protection.sql +29 -0
- package/dist/migrations/sqlite/0006_email_template_attachments.sql +12 -0
- package/dist/migrations/sqlite/0007_media_uploaded_by_nullable.sql +111 -0
- package/dist/migrations/sqlite/20260429_000000_000_initial_journal.sql +24 -0
- package/dist/migrations/sqlite/20260501_000000_journal_batch.sql +19 -0
- package/dist/migrations/sqlite/20260501_000001_audit_log.sql +24 -0
- package/dist/migrations/sqlite/20260504_000000_nextly_meta.sql +21 -0
- package/dist/migrations/sqlite/20260505_000000_user_management_tables.sql +77 -0
- package/dist/next.d.ts +57 -0
- package/dist/next.mjs +55 -0
- package/dist/observability/index.d.ts +87 -0
- package/dist/observability/index.mjs +57 -0
- package/dist/permissions-3DZZQZMI.mjs +39 -0
- package/dist/pipeline-YOML7SWF.mjs +29 -0
- package/dist/preview-ZZTR3QGS.mjs +9 -0
- package/dist/program-PW6UB2ZC.mjs +5934 -0
- package/dist/reconcile-single-tables-7ENVXJGB.mjs +7 -0
- package/dist/register-SF6E6FVU.mjs +49 -0
- package/dist/reload-config-HWQ4G5MM.mjs +23 -0
- package/dist/resolve-single-table-name-JSOMUB3R.mjs +7 -0
- package/dist/routeHandler-UNMMJIBM.mjs +77 -0
- package/dist/runtime-schema-generator-NRA6A6Z6.mjs +8 -0
- package/dist/runtime.d.ts +120 -0
- package/dist/runtime.mjs +73 -0
- package/dist/schema-hash-FMMG6VPJ.mjs +13 -0
- package/dist/schema-registry-EQ36FZDP.mjs +7 -0
- package/dist/scripts/load-env.mjs +42 -0
- package/dist/storage/index.d.ts +566 -0
- package/dist/storage/index.mjs +45 -0
- package/dist/super-admin-G5ZK5F4T.mjs +39 -0
- package/dist/system-table-service-WGSRVEGT.mjs +17 -0
- package/dist/users-7KELGRYJ.mjs +38 -0
- package/package.json +308 -9
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// src/schemas/migration-journal/postgres.ts
|
|
2
|
+
import {
|
|
3
|
+
pgTable,
|
|
4
|
+
varchar,
|
|
5
|
+
integer,
|
|
6
|
+
timestamp,
|
|
7
|
+
text,
|
|
8
|
+
index
|
|
9
|
+
} from "drizzle-orm/pg-core";
|
|
10
|
+
var nextlyMigrationJournalPg = pgTable(
|
|
11
|
+
"nextly_migration_journal",
|
|
12
|
+
{
|
|
13
|
+
// Client-side default keeps id-generation identical across dialects
|
|
14
|
+
// (MySQL + SQLite use the same $defaultFn pattern). Avoids parity
|
|
15
|
+
// drift between PG's defaultRandom() and the others.
|
|
16
|
+
id: text("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
|
|
17
|
+
// Lifecycle.
|
|
18
|
+
source: varchar("source", { length: 20 }).$type().notNull(),
|
|
19
|
+
status: varchar("status", { length: 20 }).$type().default("in_progress").notNull(),
|
|
20
|
+
// Timing. `started_at` set at recordStart; `ended_at` + `duration_ms`
|
|
21
|
+
// set at recordEnd. Rows stuck at `started_at` only indicate a crash
|
|
22
|
+
// between recordStart and recordEnd. Client-side $defaultFn matches
|
|
23
|
+
// MySQL + SQLite — DB-side defaultNow() was inconsistent.
|
|
24
|
+
startedAt: timestamp("started_at", { withTimezone: true }).$defaultFn(() => /* @__PURE__ */ new Date()).notNull(),
|
|
25
|
+
endedAt: timestamp("ended_at", { withTimezone: true }),
|
|
26
|
+
durationMs: integer("duration_ms"),
|
|
27
|
+
// Counters: planned set at start; executed + renames set at end.
|
|
28
|
+
statementsPlanned: integer("statements_planned").notNull().default(0),
|
|
29
|
+
statementsExecuted: integer("statements_executed"),
|
|
30
|
+
renamesApplied: integer("renames_applied"),
|
|
31
|
+
// Failure details: only populated when status === 'failed'.
|
|
32
|
+
errorCode: varchar("error_code", { length: 64 }),
|
|
33
|
+
errorMessage: text("error_message"),
|
|
34
|
+
// F10 PR 1: scope + summary columns. All nullable for forward-compat
|
|
35
|
+
// with rows written before this migration ran. Pipeline starts
|
|
36
|
+
// populating these in F10 PR 2.
|
|
37
|
+
scopeKind: varchar("scope_kind", {
|
|
38
|
+
length: 20
|
|
39
|
+
}).$type(),
|
|
40
|
+
scopeSlug: text("scope_slug"),
|
|
41
|
+
summaryAdded: integer("summary_added"),
|
|
42
|
+
summaryRemoved: integer("summary_removed"),
|
|
43
|
+
summaryRenamed: integer("summary_renamed"),
|
|
44
|
+
summaryChanged: integer("summary_changed"),
|
|
45
|
+
// Phase 5 (2026-05-01): batch sentinel for distinguishing dev-time
|
|
46
|
+
// pushes from production migrations. -1 = HMR/dev push (the
|
|
47
|
+
// pipeline sets this when source=="code"); 0+ = production migration
|
|
48
|
+
// batch numbers (reserved for symmetry with Payload's pattern).
|
|
49
|
+
// Default 0 keeps existing audit queries simple: `WHERE batch >= 0`
|
|
50
|
+
// returns production migrations, `WHERE batch < 0` returns dev pushes.
|
|
51
|
+
batch: integer("batch").notNull().default(0)
|
|
52
|
+
},
|
|
53
|
+
(table) => [
|
|
54
|
+
// Filter rows by lifecycle state (e.g. find stuck `in_progress` rows).
|
|
55
|
+
index("nextly_migration_journal_status_idx").on(table.status),
|
|
56
|
+
// Order most-recent first in admin views (F10).
|
|
57
|
+
index("nextly_migration_journal_started_at_idx").on(table.startedAt),
|
|
58
|
+
// Filter by HMR vs admin origin.
|
|
59
|
+
index("nextly_migration_journal_source_idx").on(table.source)
|
|
60
|
+
]
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
// src/schemas/migration-journal/mysql.ts
|
|
64
|
+
import {
|
|
65
|
+
mysqlTable,
|
|
66
|
+
varchar as varchar2,
|
|
67
|
+
int,
|
|
68
|
+
datetime,
|
|
69
|
+
text as text2,
|
|
70
|
+
index as index2
|
|
71
|
+
} from "drizzle-orm/mysql-core";
|
|
72
|
+
var nextlyMigrationJournalMysql = mysqlTable(
|
|
73
|
+
"nextly_migration_journal",
|
|
74
|
+
{
|
|
75
|
+
// MySQL has no native UUID type; varchar(36) is the standard
|
|
76
|
+
// pattern (matches the `nextly_migrations` legacy ledger).
|
|
77
|
+
id: varchar2("id", { length: 36 }).primaryKey().$defaultFn(() => crypto.randomUUID()),
|
|
78
|
+
source: varchar2("source", { length: 20 }).$type().notNull(),
|
|
79
|
+
status: varchar2("status", { length: 20 }).$type().default("in_progress").notNull(),
|
|
80
|
+
// datetime(3) gives ms precision so duration_ms math stays exact.
|
|
81
|
+
// $defaultFn matches PG + SQLite — keeps cross-dialect parity even
|
|
82
|
+
// for callers that omit startedAt at insert time.
|
|
83
|
+
startedAt: datetime("started_at", { fsp: 3 }).$defaultFn(() => /* @__PURE__ */ new Date()).notNull(),
|
|
84
|
+
endedAt: datetime("ended_at", { fsp: 3 }),
|
|
85
|
+
durationMs: int("duration_ms"),
|
|
86
|
+
statementsPlanned: int("statements_planned").notNull().default(0),
|
|
87
|
+
statementsExecuted: int("statements_executed"),
|
|
88
|
+
renamesApplied: int("renames_applied"),
|
|
89
|
+
errorCode: varchar2("error_code", { length: 64 }),
|
|
90
|
+
errorMessage: text2("error_message"),
|
|
91
|
+
// F10 PR 1: scope + summary columns. All nullable for forward-compat
|
|
92
|
+
// with rows written before this migration ran. Pipeline starts
|
|
93
|
+
// populating these in F10 PR 2.
|
|
94
|
+
scopeKind: varchar2("scope_kind", {
|
|
95
|
+
length: 20
|
|
96
|
+
}).$type(),
|
|
97
|
+
scopeSlug: varchar2("scope_slug", { length: 255 }),
|
|
98
|
+
summaryAdded: int("summary_added"),
|
|
99
|
+
summaryRemoved: int("summary_removed"),
|
|
100
|
+
summaryRenamed: int("summary_renamed"),
|
|
101
|
+
summaryChanged: int("summary_changed"),
|
|
102
|
+
// Phase 5 (2026-05-01): batch sentinel for distinguishing dev-time
|
|
103
|
+
// pushes from production migrations. -1 = HMR/dev push (the
|
|
104
|
+
// pipeline sets this when source=="code"); 0+ = production migration
|
|
105
|
+
// batch numbers (reserved for symmetry with Payload's pattern).
|
|
106
|
+
// Default 0 keeps existing audit queries simple: `WHERE batch >= 0`
|
|
107
|
+
// returns production migrations, `WHERE batch < 0` returns dev pushes.
|
|
108
|
+
batch: int("batch").notNull().default(0)
|
|
109
|
+
},
|
|
110
|
+
(table) => [
|
|
111
|
+
index2("nextly_migration_journal_status_idx").on(table.status),
|
|
112
|
+
index2("nextly_migration_journal_started_at_idx").on(table.startedAt),
|
|
113
|
+
index2("nextly_migration_journal_source_idx").on(table.source)
|
|
114
|
+
]
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
// src/schemas/migration-journal/sqlite.ts
|
|
118
|
+
import { sqliteTable, text as text3, integer as integer2, index as index3 } from "drizzle-orm/sqlite-core";
|
|
119
|
+
var nextlyMigrationJournalSqlite = sqliteTable(
|
|
120
|
+
"nextly_migration_journal",
|
|
121
|
+
{
|
|
122
|
+
// SQLite stores UUIDs as text; matches the convention used by
|
|
123
|
+
// nextly_migrations and dynamic_collections.
|
|
124
|
+
id: text3("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
|
|
125
|
+
source: text3("source").$type().notNull(),
|
|
126
|
+
status: text3("status").$type().default("in_progress").notNull(),
|
|
127
|
+
// SQLite stores timestamps as integer epoch-ms (matches the
|
|
128
|
+
// dynamic-collections convention). The journal service computes
|
|
129
|
+
// ms-precision durations from these. $defaultFn matches PG + MySQL.
|
|
130
|
+
startedAt: integer2("started_at", { mode: "timestamp_ms" }).$defaultFn(() => /* @__PURE__ */ new Date()).notNull(),
|
|
131
|
+
endedAt: integer2("ended_at", { mode: "timestamp_ms" }),
|
|
132
|
+
durationMs: integer2("duration_ms"),
|
|
133
|
+
statementsPlanned: integer2("statements_planned").notNull().default(0),
|
|
134
|
+
statementsExecuted: integer2("statements_executed"),
|
|
135
|
+
renamesApplied: integer2("renames_applied"),
|
|
136
|
+
errorCode: text3("error_code"),
|
|
137
|
+
errorMessage: text3("error_message"),
|
|
138
|
+
// F10 PR 1: scope + summary columns. All nullable for forward-compat
|
|
139
|
+
// with rows written before this migration ran. Pipeline starts
|
|
140
|
+
// populating these in F10 PR 2.
|
|
141
|
+
scopeKind: text3("scope_kind").$type(),
|
|
142
|
+
scopeSlug: text3("scope_slug"),
|
|
143
|
+
summaryAdded: integer2("summary_added"),
|
|
144
|
+
summaryRemoved: integer2("summary_removed"),
|
|
145
|
+
summaryRenamed: integer2("summary_renamed"),
|
|
146
|
+
summaryChanged: integer2("summary_changed"),
|
|
147
|
+
// Phase 5 (2026-05-01): batch sentinel for distinguishing dev-time
|
|
148
|
+
// pushes from production migrations. -1 = HMR/dev push (the
|
|
149
|
+
// pipeline sets this when source=="code"); 0+ = production migration
|
|
150
|
+
// batch numbers (incremented by the migration runner — currently
|
|
151
|
+
// unused but reserved for symmetry with Payload's pattern). Default
|
|
152
|
+
// 0 keeps existing audit queries simple: `WHERE batch >= 0` returns
|
|
153
|
+
// production migrations, `WHERE batch < 0` returns dev pushes.
|
|
154
|
+
batch: integer2("batch").notNull().default(0)
|
|
155
|
+
},
|
|
156
|
+
(table) => [
|
|
157
|
+
index3("nextly_migration_journal_status_idx").on(table.status),
|
|
158
|
+
index3("nextly_migration_journal_started_at_idx").on(table.startedAt),
|
|
159
|
+
index3("nextly_migration_journal_source_idx").on(table.source)
|
|
160
|
+
]
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
export {
|
|
164
|
+
nextlyMigrationJournalPg,
|
|
165
|
+
nextlyMigrationJournalMysql,
|
|
166
|
+
nextlyMigrationJournalSqlite
|
|
167
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/domains/singles/services/resolve-single-table-name.ts
|
|
2
|
+
var PREFIX = "single_";
|
|
3
|
+
function normalizeIdentifier(input) {
|
|
4
|
+
return input.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
5
|
+
}
|
|
6
|
+
function ensurePrefixed(name) {
|
|
7
|
+
return name.startsWith(PREFIX) ? name : `${PREFIX}${name}`;
|
|
8
|
+
}
|
|
9
|
+
function resolveSingleTableName(config) {
|
|
10
|
+
if (!config.slug || config.slug.trim().length === 0) {
|
|
11
|
+
throw new Error(
|
|
12
|
+
"resolveSingleTableName: slug is required and cannot be empty"
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
const base = config.dbName ? normalizeIdentifier(config.dbName) : normalizeIdentifier(config.slug);
|
|
16
|
+
return ensurePrefixed(base);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
resolveSingleTableName
|
|
21
|
+
};
|