@byline/cli 2.6.1 → 3.0.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/dist/templates/byline/i18n.ts +9 -0
- package/dist/templates/byline-examples/collections/docs/admin.tsx +1 -1
- package/dist/templates/byline-examples/collections/docs/schema.ts +1 -2
- package/dist/templates/byline-examples/collections/news/admin.tsx +1 -1
- package/dist/templates/byline-examples/collections/news/schema.ts +1 -2
- package/dist/templates/byline-examples/collections/pages/admin.tsx +1 -1
- package/dist/templates/byline-examples/collections/pages/schema.ts +1 -2
- package/dist/templates/byline-examples/fields/available-languages-field.ts +7 -0
- package/dist/templates/byline-examples/i18n.ts +9 -0
- package/dist/templates/byline-examples/scripts/backfill-version-locales.ts +46 -0
- package/dist/templates/byline-examples/scripts/import-docs.ts +107 -23
- package/dist/templates/byline-examples/scripts/lib/mdast-to-lexical.test.node.ts +262 -0
- package/dist/templates/byline-examples/scripts/lib/mdast-to-lexical.ts +8 -3
- package/dist/templates/byline-examples/scripts/lib/rewrite-doc-links.ts +141 -0
- package/dist/templates/byline-examples/scripts/lib/strip-leading-h1.test.node.ts +66 -0
- package/dist/templates/byline-examples/scripts/re-anchor.ts +102 -0
- package/dist/templates/byline-examples/scripts/regenerate-media.ts +1 -1
- package/dist/templates/migrations/{0000_black_sabra.sql → 0000_yielding_northstar.sql} +22 -2
- package/dist/templates/migrations/meta/0000_snapshot.json +164 -3
- package/dist/templates/migrations/meta/_journal.json +2 -2
- package/dist/templates/routes/_byline/route.lazy.tsx +16 -6
- package/dist/templates/routes/_byline/route.tsx +34 -9
- package/package.json +1 -1
|
@@ -115,6 +115,15 @@ CREATE TABLE "byline_store_datetime" (
|
|
|
115
115
|
CONSTRAINT "unique_datetime_field" UNIQUE("document_version_id","field_path","locale")
|
|
116
116
|
);
|
|
117
117
|
--> statement-breakpoint
|
|
118
|
+
CREATE TABLE "byline_document_available_locales" (
|
|
119
|
+
"document_id" uuid NOT NULL,
|
|
120
|
+
"locale" varchar(10) NOT NULL,
|
|
121
|
+
"collection_id" uuid NOT NULL,
|
|
122
|
+
"created_at" timestamp (6) with time zone DEFAULT now() NOT NULL,
|
|
123
|
+
"updated_at" timestamp (6) with time zone DEFAULT now() NOT NULL,
|
|
124
|
+
CONSTRAINT "byline_document_available_locales_document_id_locale_pk" PRIMARY KEY("document_id","locale")
|
|
125
|
+
);
|
|
126
|
+
--> statement-breakpoint
|
|
118
127
|
CREATE TABLE "byline_document_paths" (
|
|
119
128
|
"document_id" uuid NOT NULL,
|
|
120
129
|
"locale" varchar(10) NOT NULL,
|
|
@@ -133,6 +142,12 @@ CREATE TABLE "byline_document_relationships" (
|
|
|
133
142
|
CONSTRAINT "byline_document_relationships_parent_document_id_child_document_id_unique" UNIQUE("parent_document_id","child_document_id")
|
|
134
143
|
);
|
|
135
144
|
--> statement-breakpoint
|
|
145
|
+
CREATE TABLE "byline_document_version_locales" (
|
|
146
|
+
"document_version_id" uuid NOT NULL,
|
|
147
|
+
"locale" varchar(10) NOT NULL,
|
|
148
|
+
CONSTRAINT "byline_document_version_locales_document_version_id_locale_pk" PRIMARY KEY("document_version_id","locale")
|
|
149
|
+
);
|
|
150
|
+
--> statement-breakpoint
|
|
136
151
|
CREATE TABLE "byline_document_versions" (
|
|
137
152
|
"id" uuid PRIMARY KEY NOT NULL,
|
|
138
153
|
"document_id" uuid NOT NULL,
|
|
@@ -152,6 +167,7 @@ CREATE TABLE "byline_documents" (
|
|
|
152
167
|
"id" uuid PRIMARY KEY NOT NULL,
|
|
153
168
|
"collection_id" uuid NOT NULL,
|
|
154
169
|
"order_key" varchar(128) COLLATE "C",
|
|
170
|
+
"source_locale" varchar(10) NOT NULL,
|
|
155
171
|
"created_at" timestamp (6) with time zone DEFAULT now() NOT NULL,
|
|
156
172
|
"updated_at" timestamp (6) with time zone DEFAULT now() NOT NULL
|
|
157
173
|
);
|
|
@@ -270,10 +286,13 @@ ALTER TABLE "byline_store_boolean" ADD CONSTRAINT "byline_store_boolean_document
|
|
|
270
286
|
ALTER TABLE "byline_store_boolean" ADD CONSTRAINT "byline_store_boolean_collection_id_byline_collections_id_fk" FOREIGN KEY ("collection_id") REFERENCES "public"."byline_collections"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
271
287
|
ALTER TABLE "byline_store_datetime" ADD CONSTRAINT "byline_store_datetime_document_version_id_byline_document_versions_id_fk" FOREIGN KEY ("document_version_id") REFERENCES "public"."byline_document_versions"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
272
288
|
ALTER TABLE "byline_store_datetime" ADD CONSTRAINT "byline_store_datetime_collection_id_byline_collections_id_fk" FOREIGN KEY ("collection_id") REFERENCES "public"."byline_collections"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
289
|
+
ALTER TABLE "byline_document_available_locales" ADD CONSTRAINT "byline_document_available_locales_document_id_byline_documents_id_fk" FOREIGN KEY ("document_id") REFERENCES "public"."byline_documents"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
290
|
+
ALTER TABLE "byline_document_available_locales" ADD CONSTRAINT "byline_document_available_locales_collection_id_byline_collections_id_fk" FOREIGN KEY ("collection_id") REFERENCES "public"."byline_collections"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
273
291
|
ALTER TABLE "byline_document_paths" ADD CONSTRAINT "byline_document_paths_document_id_byline_documents_id_fk" FOREIGN KEY ("document_id") REFERENCES "public"."byline_documents"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
274
292
|
ALTER TABLE "byline_document_paths" ADD CONSTRAINT "byline_document_paths_collection_id_byline_collections_id_fk" FOREIGN KEY ("collection_id") REFERENCES "public"."byline_collections"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
275
293
|
ALTER TABLE "byline_document_relationships" ADD CONSTRAINT "byline_document_relationships_parent_document_id_byline_documents_id_fk" FOREIGN KEY ("parent_document_id") REFERENCES "public"."byline_documents"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
276
294
|
ALTER TABLE "byline_document_relationships" ADD CONSTRAINT "byline_document_relationships_child_document_id_byline_documents_id_fk" FOREIGN KEY ("child_document_id") REFERENCES "public"."byline_documents"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
295
|
+
ALTER TABLE "byline_document_version_locales" ADD CONSTRAINT "byline_document_version_locales_document_version_id_byline_document_versions_id_fk" FOREIGN KEY ("document_version_id") REFERENCES "public"."byline_document_versions"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
277
296
|
ALTER TABLE "byline_document_versions" ADD CONSTRAINT "byline_document_versions_document_id_byline_documents_id_fk" FOREIGN KEY ("document_id") REFERENCES "public"."byline_documents"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
278
297
|
ALTER TABLE "byline_document_versions" ADD CONSTRAINT "byline_document_versions_collection_id_byline_collections_id_fk" FOREIGN KEY ("collection_id") REFERENCES "public"."byline_collections"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
279
298
|
ALTER TABLE "byline_documents" ADD CONSTRAINT "byline_documents_collection_id_byline_collections_id_fk" FOREIGN KEY ("collection_id") REFERENCES "public"."byline_collections"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
@@ -304,6 +323,7 @@ CREATE INDEX "idx_datetime_date" ON "byline_store_datetime" USING btree ("value_
|
|
|
304
323
|
CREATE INDEX "idx_datetime_timestamp_tz" ON "byline_store_datetime" USING btree ("value_timestamp_tz");--> statement-breakpoint
|
|
305
324
|
CREATE INDEX "idx_datetime_path_date" ON "byline_store_datetime" USING btree ("field_path","value_timestamp_tz");--> statement-breakpoint
|
|
306
325
|
CREATE INDEX "idx_datetime_collection_date" ON "byline_store_datetime" USING btree ("collection_id","value_timestamp_tz");--> statement-breakpoint
|
|
326
|
+
CREATE INDEX "idx_document_available_locales_document_id" ON "byline_document_available_locales" USING btree ("document_id");--> statement-breakpoint
|
|
307
327
|
CREATE INDEX "idx_document_paths_document_id" ON "byline_document_paths" USING btree ("document_id");--> statement-breakpoint
|
|
308
328
|
CREATE INDEX "idx_document_relationships_parent" ON "byline_document_relationships" USING btree ("parent_document_id");--> statement-breakpoint
|
|
309
329
|
CREATE INDEX "idx_document_relationships_child" ON "byline_document_relationships" USING btree ("child_document_id");--> statement-breakpoint
|
|
@@ -342,5 +362,5 @@ CREATE INDEX "idx_text_value" ON "byline_store_text" USING btree ("value");--> s
|
|
|
342
362
|
CREATE INDEX "idx_text_fulltext" ON "byline_store_text" USING gin (to_tsvector('english', "value"));--> statement-breakpoint
|
|
343
363
|
CREATE INDEX "idx_text_locale_value" ON "byline_store_text" USING btree ("locale","value");--> statement-breakpoint
|
|
344
364
|
CREATE INDEX "idx_text_path_value" ON "byline_store_text" USING btree ("field_path","value");--> statement-breakpoint
|
|
345
|
-
CREATE VIEW "public"."byline_current_documents" AS (with "sq" as (select "id", "document_id", "collection_id", "collection_version", "event_type", "status", "is_deleted", "created_at", "updated_at", "created_by", "change_summary", row_number() OVER (PARTITION BY "document_id" ORDER BY "id" DESC) as "rn" from "byline_document_versions" where "byline_document_versions"."is_deleted" = false) select "sq"."id", "sq"."document_id", "sq"."collection_id", "sq"."collection_version", "sq"."event_type", "sq"."status", "sq"."is_deleted", "sq"."created_at", "sq"."updated_at", "sq"."created_by", "sq"."change_summary", "byline_documents"."order_key" from "sq" inner join "byline_documents" on "byline_documents"."id" = "sq"."document_id" where "rn" = 1);--> statement-breakpoint
|
|
346
|
-
CREATE VIEW "public"."byline_current_published_documents" AS (with "sq" as (select "id", "document_id", "collection_id", "collection_version", "event_type", "status", "is_deleted", "created_at", "updated_at", "created_by", "change_summary", row_number() OVER (PARTITION BY "document_id" ORDER BY "id" DESC) as "rn" from "byline_document_versions" where "byline_document_versions"."is_deleted" = false AND "byline_document_versions"."status" = 'published') select "sq"."id", "sq"."document_id", "sq"."collection_id", "sq"."collection_version", "sq"."event_type", "sq"."status", "sq"."is_deleted", "sq"."created_at", "sq"."updated_at", "sq"."created_by", "sq"."change_summary", "byline_documents"."order_key" from "sq" inner join "byline_documents" on "byline_documents"."id" = "sq"."document_id" where "rn" = 1);
|
|
365
|
+
CREATE VIEW "public"."byline_current_documents" AS (with "sq" as (select "id", "document_id", "collection_id", "collection_version", "event_type", "status", "is_deleted", "created_at", "updated_at", "created_by", "change_summary", row_number() OVER (PARTITION BY "document_id" ORDER BY "id" DESC) as "rn" from "byline_document_versions" where "byline_document_versions"."is_deleted" = false) select "sq"."id", "sq"."document_id", "sq"."collection_id", "sq"."collection_version", "sq"."event_type", "sq"."status", "sq"."is_deleted", "sq"."created_at", "sq"."updated_at", "sq"."created_by", "sq"."change_summary", "byline_documents"."order_key", "byline_documents"."source_locale" from "sq" inner join "byline_documents" on "byline_documents"."id" = "sq"."document_id" where "rn" = 1);--> statement-breakpoint
|
|
366
|
+
CREATE VIEW "public"."byline_current_published_documents" AS (with "sq" as (select "id", "document_id", "collection_id", "collection_version", "event_type", "status", "is_deleted", "created_at", "updated_at", "created_by", "change_summary", row_number() OVER (PARTITION BY "document_id" ORDER BY "id" DESC) as "rn" from "byline_document_versions" where "byline_document_versions"."is_deleted" = false AND "byline_document_versions"."status" = 'published') select "sq"."id", "sq"."document_id", "sq"."collection_id", "sq"."collection_version", "sq"."event_type", "sq"."status", "sq"."is_deleted", "sq"."created_at", "sq"."updated_at", "sq"."created_by", "sq"."change_summary", "byline_documents"."order_key", "byline_documents"."source_locale" from "sq" inner join "byline_documents" on "byline_documents"."id" = "sq"."document_id" where "rn" = 1);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "
|
|
2
|
+
"id": "52560051-1da6-41f4-8a2c-b9a7b5421d26",
|
|
3
3
|
"prevId": "00000000-0000-0000-0000-000000000000",
|
|
4
4
|
"version": "7",
|
|
5
5
|
"dialect": "postgresql",
|
|
@@ -1053,6 +1053,102 @@
|
|
|
1053
1053
|
"checkConstraints": {},
|
|
1054
1054
|
"isRLSEnabled": false
|
|
1055
1055
|
},
|
|
1056
|
+
"public.byline_document_available_locales": {
|
|
1057
|
+
"name": "byline_document_available_locales",
|
|
1058
|
+
"schema": "",
|
|
1059
|
+
"columns": {
|
|
1060
|
+
"document_id": {
|
|
1061
|
+
"name": "document_id",
|
|
1062
|
+
"type": "uuid",
|
|
1063
|
+
"primaryKey": false,
|
|
1064
|
+
"notNull": true
|
|
1065
|
+
},
|
|
1066
|
+
"locale": {
|
|
1067
|
+
"name": "locale",
|
|
1068
|
+
"type": "varchar(10)",
|
|
1069
|
+
"primaryKey": false,
|
|
1070
|
+
"notNull": true
|
|
1071
|
+
},
|
|
1072
|
+
"collection_id": {
|
|
1073
|
+
"name": "collection_id",
|
|
1074
|
+
"type": "uuid",
|
|
1075
|
+
"primaryKey": false,
|
|
1076
|
+
"notNull": true
|
|
1077
|
+
},
|
|
1078
|
+
"created_at": {
|
|
1079
|
+
"name": "created_at",
|
|
1080
|
+
"type": "timestamp (6) with time zone",
|
|
1081
|
+
"primaryKey": false,
|
|
1082
|
+
"notNull": true,
|
|
1083
|
+
"default": "now()"
|
|
1084
|
+
},
|
|
1085
|
+
"updated_at": {
|
|
1086
|
+
"name": "updated_at",
|
|
1087
|
+
"type": "timestamp (6) with time zone",
|
|
1088
|
+
"primaryKey": false,
|
|
1089
|
+
"notNull": true,
|
|
1090
|
+
"default": "now()"
|
|
1091
|
+
}
|
|
1092
|
+
},
|
|
1093
|
+
"indexes": {
|
|
1094
|
+
"idx_document_available_locales_document_id": {
|
|
1095
|
+
"name": "idx_document_available_locales_document_id",
|
|
1096
|
+
"columns": [
|
|
1097
|
+
{
|
|
1098
|
+
"expression": "document_id",
|
|
1099
|
+
"isExpression": false,
|
|
1100
|
+
"asc": true,
|
|
1101
|
+
"nulls": "last"
|
|
1102
|
+
}
|
|
1103
|
+
],
|
|
1104
|
+
"isUnique": false,
|
|
1105
|
+
"concurrently": false,
|
|
1106
|
+
"method": "btree",
|
|
1107
|
+
"with": {}
|
|
1108
|
+
}
|
|
1109
|
+
},
|
|
1110
|
+
"foreignKeys": {
|
|
1111
|
+
"byline_document_available_locales_document_id_byline_documents_id_fk": {
|
|
1112
|
+
"name": "byline_document_available_locales_document_id_byline_documents_id_fk",
|
|
1113
|
+
"tableFrom": "byline_document_available_locales",
|
|
1114
|
+
"tableTo": "byline_documents",
|
|
1115
|
+
"columnsFrom": [
|
|
1116
|
+
"document_id"
|
|
1117
|
+
],
|
|
1118
|
+
"columnsTo": [
|
|
1119
|
+
"id"
|
|
1120
|
+
],
|
|
1121
|
+
"onDelete": "cascade",
|
|
1122
|
+
"onUpdate": "no action"
|
|
1123
|
+
},
|
|
1124
|
+
"byline_document_available_locales_collection_id_byline_collections_id_fk": {
|
|
1125
|
+
"name": "byline_document_available_locales_collection_id_byline_collections_id_fk",
|
|
1126
|
+
"tableFrom": "byline_document_available_locales",
|
|
1127
|
+
"tableTo": "byline_collections",
|
|
1128
|
+
"columnsFrom": [
|
|
1129
|
+
"collection_id"
|
|
1130
|
+
],
|
|
1131
|
+
"columnsTo": [
|
|
1132
|
+
"id"
|
|
1133
|
+
],
|
|
1134
|
+
"onDelete": "cascade",
|
|
1135
|
+
"onUpdate": "no action"
|
|
1136
|
+
}
|
|
1137
|
+
},
|
|
1138
|
+
"compositePrimaryKeys": {
|
|
1139
|
+
"byline_document_available_locales_document_id_locale_pk": {
|
|
1140
|
+
"name": "byline_document_available_locales_document_id_locale_pk",
|
|
1141
|
+
"columns": [
|
|
1142
|
+
"document_id",
|
|
1143
|
+
"locale"
|
|
1144
|
+
]
|
|
1145
|
+
}
|
|
1146
|
+
},
|
|
1147
|
+
"uniqueConstraints": {},
|
|
1148
|
+
"policies": {},
|
|
1149
|
+
"checkConstraints": {},
|
|
1150
|
+
"isRLSEnabled": false
|
|
1151
|
+
},
|
|
1056
1152
|
"public.byline_document_paths": {
|
|
1057
1153
|
"name": "byline_document_paths",
|
|
1058
1154
|
"schema": "",
|
|
@@ -1264,6 +1360,53 @@
|
|
|
1264
1360
|
"checkConstraints": {},
|
|
1265
1361
|
"isRLSEnabled": false
|
|
1266
1362
|
},
|
|
1363
|
+
"public.byline_document_version_locales": {
|
|
1364
|
+
"name": "byline_document_version_locales",
|
|
1365
|
+
"schema": "",
|
|
1366
|
+
"columns": {
|
|
1367
|
+
"document_version_id": {
|
|
1368
|
+
"name": "document_version_id",
|
|
1369
|
+
"type": "uuid",
|
|
1370
|
+
"primaryKey": false,
|
|
1371
|
+
"notNull": true
|
|
1372
|
+
},
|
|
1373
|
+
"locale": {
|
|
1374
|
+
"name": "locale",
|
|
1375
|
+
"type": "varchar(10)",
|
|
1376
|
+
"primaryKey": false,
|
|
1377
|
+
"notNull": true
|
|
1378
|
+
}
|
|
1379
|
+
},
|
|
1380
|
+
"indexes": {},
|
|
1381
|
+
"foreignKeys": {
|
|
1382
|
+
"byline_document_version_locales_document_version_id_byline_document_versions_id_fk": {
|
|
1383
|
+
"name": "byline_document_version_locales_document_version_id_byline_document_versions_id_fk",
|
|
1384
|
+
"tableFrom": "byline_document_version_locales",
|
|
1385
|
+
"tableTo": "byline_document_versions",
|
|
1386
|
+
"columnsFrom": [
|
|
1387
|
+
"document_version_id"
|
|
1388
|
+
],
|
|
1389
|
+
"columnsTo": [
|
|
1390
|
+
"id"
|
|
1391
|
+
],
|
|
1392
|
+
"onDelete": "cascade",
|
|
1393
|
+
"onUpdate": "no action"
|
|
1394
|
+
}
|
|
1395
|
+
},
|
|
1396
|
+
"compositePrimaryKeys": {
|
|
1397
|
+
"byline_document_version_locales_document_version_id_locale_pk": {
|
|
1398
|
+
"name": "byline_document_version_locales_document_version_id_locale_pk",
|
|
1399
|
+
"columns": [
|
|
1400
|
+
"document_version_id",
|
|
1401
|
+
"locale"
|
|
1402
|
+
]
|
|
1403
|
+
}
|
|
1404
|
+
},
|
|
1405
|
+
"uniqueConstraints": {},
|
|
1406
|
+
"policies": {},
|
|
1407
|
+
"checkConstraints": {},
|
|
1408
|
+
"isRLSEnabled": false
|
|
1409
|
+
},
|
|
1267
1410
|
"public.byline_document_versions": {
|
|
1268
1411
|
"name": "byline_document_versions",
|
|
1269
1412
|
"schema": "",
|
|
@@ -1530,6 +1673,12 @@
|
|
|
1530
1673
|
"primaryKey": false,
|
|
1531
1674
|
"notNull": false
|
|
1532
1675
|
},
|
|
1676
|
+
"source_locale": {
|
|
1677
|
+
"name": "source_locale",
|
|
1678
|
+
"type": "varchar(10)",
|
|
1679
|
+
"primaryKey": false,
|
|
1680
|
+
"notNull": true
|
|
1681
|
+
},
|
|
1533
1682
|
"created_at": {
|
|
1534
1683
|
"name": "created_at",
|
|
1535
1684
|
"type": "timestamp (6) with time zone",
|
|
@@ -2999,9 +3148,15 @@
|
|
|
2999
3148
|
"type": "varchar(128) COLLATE \"C\"",
|
|
3000
3149
|
"primaryKey": false,
|
|
3001
3150
|
"notNull": false
|
|
3151
|
+
},
|
|
3152
|
+
"source_locale": {
|
|
3153
|
+
"name": "source_locale",
|
|
3154
|
+
"type": "varchar(10)",
|
|
3155
|
+
"primaryKey": false,
|
|
3156
|
+
"notNull": true
|
|
3002
3157
|
}
|
|
3003
3158
|
},
|
|
3004
|
-
"definition": "with \"sq\" as (select \"id\", \"document_id\", \"collection_id\", \"collection_version\", \"event_type\", \"status\", \"is_deleted\", \"created_at\", \"updated_at\", \"created_by\", \"change_summary\", row_number() OVER (PARTITION BY \"document_id\" ORDER BY \"id\" DESC) as \"rn\" from \"byline_document_versions\" where \"byline_document_versions\".\"is_deleted\" = false) select \"sq\".\"id\", \"sq\".\"document_id\", \"sq\".\"collection_id\", \"sq\".\"collection_version\", \"sq\".\"event_type\", \"sq\".\"status\", \"sq\".\"is_deleted\", \"sq\".\"created_at\", \"sq\".\"updated_at\", \"sq\".\"created_by\", \"sq\".\"change_summary\", \"byline_documents\".\"order_key\" from \"sq\" inner join \"byline_documents\" on \"byline_documents\".\"id\" = \"sq\".\"document_id\" where \"rn\" = 1",
|
|
3159
|
+
"definition": "with \"sq\" as (select \"id\", \"document_id\", \"collection_id\", \"collection_version\", \"event_type\", \"status\", \"is_deleted\", \"created_at\", \"updated_at\", \"created_by\", \"change_summary\", row_number() OVER (PARTITION BY \"document_id\" ORDER BY \"id\" DESC) as \"rn\" from \"byline_document_versions\" where \"byline_document_versions\".\"is_deleted\" = false) select \"sq\".\"id\", \"sq\".\"document_id\", \"sq\".\"collection_id\", \"sq\".\"collection_version\", \"sq\".\"event_type\", \"sq\".\"status\", \"sq\".\"is_deleted\", \"sq\".\"created_at\", \"sq\".\"updated_at\", \"sq\".\"created_by\", \"sq\".\"change_summary\", \"byline_documents\".\"order_key\", \"byline_documents\".\"source_locale\" from \"sq\" inner join \"byline_documents\" on \"byline_documents\".\"id\" = \"sq\".\"document_id\" where \"rn\" = 1",
|
|
3005
3160
|
"name": "byline_current_documents",
|
|
3006
3161
|
"schema": "public",
|
|
3007
3162
|
"isExisting": false,
|
|
@@ -3085,9 +3240,15 @@
|
|
|
3085
3240
|
"type": "varchar(128) COLLATE \"C\"",
|
|
3086
3241
|
"primaryKey": false,
|
|
3087
3242
|
"notNull": false
|
|
3243
|
+
},
|
|
3244
|
+
"source_locale": {
|
|
3245
|
+
"name": "source_locale",
|
|
3246
|
+
"type": "varchar(10)",
|
|
3247
|
+
"primaryKey": false,
|
|
3248
|
+
"notNull": true
|
|
3088
3249
|
}
|
|
3089
3250
|
},
|
|
3090
|
-
"definition": "with \"sq\" as (select \"id\", \"document_id\", \"collection_id\", \"collection_version\", \"event_type\", \"status\", \"is_deleted\", \"created_at\", \"updated_at\", \"created_by\", \"change_summary\", row_number() OVER (PARTITION BY \"document_id\" ORDER BY \"id\" DESC) as \"rn\" from \"byline_document_versions\" where \"byline_document_versions\".\"is_deleted\" = false AND \"byline_document_versions\".\"status\" = 'published') select \"sq\".\"id\", \"sq\".\"document_id\", \"sq\".\"collection_id\", \"sq\".\"collection_version\", \"sq\".\"event_type\", \"sq\".\"status\", \"sq\".\"is_deleted\", \"sq\".\"created_at\", \"sq\".\"updated_at\", \"sq\".\"created_by\", \"sq\".\"change_summary\", \"byline_documents\".\"order_key\" from \"sq\" inner join \"byline_documents\" on \"byline_documents\".\"id\" = \"sq\".\"document_id\" where \"rn\" = 1",
|
|
3251
|
+
"definition": "with \"sq\" as (select \"id\", \"document_id\", \"collection_id\", \"collection_version\", \"event_type\", \"status\", \"is_deleted\", \"created_at\", \"updated_at\", \"created_by\", \"change_summary\", row_number() OVER (PARTITION BY \"document_id\" ORDER BY \"id\" DESC) as \"rn\" from \"byline_document_versions\" where \"byline_document_versions\".\"is_deleted\" = false AND \"byline_document_versions\".\"status\" = 'published') select \"sq\".\"id\", \"sq\".\"document_id\", \"sq\".\"collection_id\", \"sq\".\"collection_version\", \"sq\".\"event_type\", \"sq\".\"status\", \"sq\".\"is_deleted\", \"sq\".\"created_at\", \"sq\".\"updated_at\", \"sq\".\"created_by\", \"sq\".\"change_summary\", \"byline_documents\".\"order_key\", \"byline_documents\".\"source_locale\" from \"sq\" inner join \"byline_documents\" on \"byline_documents\".\"id\" = \"sq\".\"document_id\" where \"rn\" = 1",
|
|
3091
3252
|
"name": "byline_current_published_documents",
|
|
3092
3253
|
"schema": "public",
|
|
3093
3254
|
"isExisting": false,
|
|
@@ -9,9 +9,19 @@
|
|
|
9
9
|
/**
|
|
10
10
|
* Lazy companion to `_byline/route.tsx`. TanStack Router loads this on
|
|
11
11
|
* demand when a `_byline/*` URL matches, so the Byline UI providers,
|
|
12
|
-
* stylesheets, and the admin config side-effect import (which
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* stylesheets, and the admin config side-effect import (which transitively
|
|
13
|
+
* pulls in the Lexical editor module graph) only run when an admin route is
|
|
14
|
+
* actually visited — public routes stay clean.
|
|
15
|
+
*
|
|
16
|
+
* The `byline/admin.config` import below registers the client config in the
|
|
17
|
+
* *client component graph* — it runs whenever this lazy module loads (component
|
|
18
|
+
* render / initial hydration), where the sibling `route.tsx` `beforeLoad` does
|
|
19
|
+
* NOT help: on initial hydration TanStack Start reuses the dehydrated SSR result
|
|
20
|
+
* and does not re-run `beforeLoad`, yet the admin layout component still calls
|
|
21
|
+
* `getClientConfig()` at render. The two registration points are complementary —
|
|
22
|
+
* `beforeLoad` (a dynamic import) covers the *loader* phase before any
|
|
23
|
+
* `_byline/*` child loader; this import covers component render / hydration.
|
|
24
|
+
* Both call `defineClientConfig` idempotently.
|
|
15
25
|
*
|
|
16
26
|
* If you also want to use the Byline UI components on your public site,
|
|
17
27
|
* import the same stylesheets from your front-end's pathless layout
|
|
@@ -26,9 +36,9 @@ import { ToastProvider, ToastViewport } from '@byline/ui/react'
|
|
|
26
36
|
import '@byline/ui/reset.css'
|
|
27
37
|
import '@byline/ui/styles.css'
|
|
28
38
|
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
39
|
+
// Register the Byline client config (component-render / hydration entry point —
|
|
40
|
+
// see the file header). The sibling `route.tsx` `beforeLoad` covers the loader
|
|
41
|
+
// phase. Lexical's module graph only loads when a `_byline/*` URL matches.
|
|
32
42
|
import '../../../byline/admin.config'
|
|
33
43
|
|
|
34
44
|
export const Route = createLazyFileRoute('/_byline')({
|
|
@@ -12,17 +12,42 @@
|
|
|
12
12
|
* to URL paths — `/_byline/admin/...` resolves to `/admin/...` and
|
|
13
13
|
* `/_byline/sign-in` resolves to `/sign-in`.
|
|
14
14
|
*
|
|
15
|
-
* This file is intentionally
|
|
16
|
-
* at startup to build the tree for URL matching, so anything
|
|
17
|
-
* here ends up in the eager module graph (and Vite will
|
|
18
|
-
* its dependencies on every page).
|
|
15
|
+
* This file is intentionally light. The router needs the route definition
|
|
16
|
+
* at startup to build the tree for URL matching, so anything *statically*
|
|
17
|
+
* imported here ends up in the eager module graph (and Vite will
|
|
18
|
+
* modulepreload its dependencies on every page).
|
|
19
19
|
*
|
|
20
|
-
* The component, providers, Byline UI stylesheets
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
20
|
+
* The component, providers, and Byline UI stylesheets live in the sibling
|
|
21
|
+
* `route.lazy.tsx` — TanStack Router loads that file on demand when a
|
|
22
|
+
* `_byline/*` URL matches, so the editor + admin shell deps stay out of
|
|
23
|
+
* public-route bundles.
|
|
24
|
+
*
|
|
25
|
+
* Registering the Byline client config has two complementary entry points
|
|
26
|
+
* (both call `defineClientConfig` idempotently):
|
|
27
|
+
* - the `beforeLoad` below — covers the *loader* phase, resolving before any
|
|
28
|
+
* `_byline/*` child loader reads the config (e.g. the admin dashboard
|
|
29
|
+
* loader's `getClientConfig()`);
|
|
30
|
+
* - the side-effect import in `route.lazy.tsx` — covers component render /
|
|
31
|
+
* initial hydration, where `beforeLoad` is not re-run.
|
|
32
|
+
* Both use `byline/admin.config` (a dynamic import here), so its module graph
|
|
33
|
+
* (incl. the Lexical editor) stays code-split out of the eager/public bundle.
|
|
24
34
|
*/
|
|
25
35
|
|
|
26
36
|
import { createFileRoute } from '@tanstack/react-router'
|
|
27
37
|
|
|
28
|
-
export const Route = createFileRoute('/_byline')({
|
|
38
|
+
export const Route = createFileRoute('/_byline')({
|
|
39
|
+
beforeLoad: async () => {
|
|
40
|
+
// Register the Byline client config (`defineClientConfig` runs as a
|
|
41
|
+
// side-effect of importing `byline/admin.config`) before any `_byline/*`
|
|
42
|
+
// child loader reads it. A parent route's `beforeLoad` resolves before its
|
|
43
|
+
// children's loaders, closing the dev race where a loader outran the lazy
|
|
44
|
+
// component module's side-effect import (on the client there is no
|
|
45
|
+
// server-config fallback, so `getClientConfig()` threw "Byline has not been
|
|
46
|
+
// configured yet"). The dynamic import keeps `admin.config` out of the
|
|
47
|
+
// eager/public bundle and evaluates once (cached). NOTE: `beforeLoad` is
|
|
48
|
+
// not re-run on initial client hydration (the SSR result is dehydrated), so
|
|
49
|
+
// the `route.lazy.tsx` side-effect import registers the config for the
|
|
50
|
+
// hydrated component render.
|
|
51
|
+
await import('../../../byline/admin.config')
|
|
52
|
+
},
|
|
53
|
+
})
|