@openpeepshq/core 0.18.0 → 0.26.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/db/pg/schema/documents.js +13 -0
- package/dist/db/pg/sql/0022_add_article_slug_indexes.sql +2 -0
- package/dist/db/pg/sql/meta/0022_snapshot.json +4701 -0
- package/dist/db/pg/sql/meta/_journal.json +7 -0
- package/dist/groups/helpers.d.ts +6 -6
- package/dist/jams/index.d.ts +1 -0
- package/dist/jams/index.js +1 -0
- package/dist/jams/spotlight.d.ts +12 -0
- package/dist/jams/spotlight.js +52 -0
- package/dist/posts/finders.d.ts +13 -0
- package/dist/posts/finders.js +48 -0
- package/dist/posts/helpers/index.d.ts +8 -0
- package/dist/posts/index.d.ts +1 -0
- package/dist/posts/index.js +1 -0
- package/dist/posts/mapping.d.ts +28 -0
- package/dist/posts/mutations.d.ts +4 -0
- package/dist/posts/mutations.js +9 -1
- package/dist/posts/slugPolicy.d.ts +20 -0
- package/dist/posts/slugPolicy.js +42 -0
- package/dist/seo/index.js +57 -32
- package/dist/seo/route.d.ts +33 -7
- package/dist/seo/route.js +85 -4
- package/dist/stats/mapping.d.ts +2 -0
- package/package.json +4 -4
|
@@ -87,6 +87,19 @@ export const posts = pgTable('posts', {
|
|
|
87
87
|
index('posts_in_reply_to_uri_idx').on(t.inReplyToUri),
|
|
88
88
|
index('posts_search_vector_idx').using('gin', t.searchVector),
|
|
89
89
|
index('posts_last_activity_id_idx').on(t.lastActivityAt, t.id),
|
|
90
|
+
// Article slugs live in the JSONB body; the two partial indexes pin the
|
|
91
|
+
// uniqueness rule per scope — instance slugs are globally unique,
|
|
92
|
+
// profile slugs are unique per creator. `findPostBySlug` mirrors these
|
|
93
|
+
// predicates, so a matching row is always the only row that can own the
|
|
94
|
+
// slug. All comparisons use `->>` (text extraction) so both sides of
|
|
95
|
+
// every comparison are text — `->` returns jsonb and `jsonb = text`
|
|
96
|
+
// does not match a stored JSON string literal.
|
|
97
|
+
uniqueIndex('posts_slug_instance_unique')
|
|
98
|
+
.on(sql `(body ->> 'slug')`)
|
|
99
|
+
.where(sql `type = 'article' AND body ->> 'slug' IS NOT NULL AND body ->> 'instanceScoped' = 'true'`),
|
|
100
|
+
uniqueIndex('posts_slug_profile_unique')
|
|
101
|
+
.on(sql `(body ->> 'slug')`, t.creatorId)
|
|
102
|
+
.where(sql `type = 'article' AND body ->> 'slug' IS NOT NULL AND (body ->> 'instanceScoped' IS NULL OR body ->> 'instanceScoped' = 'false')`),
|
|
90
103
|
]);
|
|
91
104
|
export const notifications = pgTable('notifications', {
|
|
92
105
|
id: idColumn(),
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
CREATE UNIQUE INDEX "posts_slug_instance_unique" ON "posts" USING btree ((body ->> 'slug')) WHERE type = 'article' AND body ->> 'slug' IS NOT NULL AND body ->> 'instanceScoped' = 'true';--> statement-breakpoint
|
|
2
|
+
CREATE UNIQUE INDEX "posts_slug_profile_unique" ON "posts" USING btree ((body ->> 'slug'),"creator_id") WHERE type = 'article' AND body ->> 'slug' IS NOT NULL AND (body ->> 'instanceScoped' IS NULL OR body ->> 'instanceScoped' = 'false');
|