@openpeepshq/common 0.19.0 → 0.28.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/lib/articleSlug.d.ts +31 -0
- package/dist/lib/articleSlug.js +34 -0
- package/dist/lib/capabilitiesHelpers.d.ts +7 -7
- package/dist/lib/groupHelpers.d.ts +1 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/postHelpers.d.ts +3 -3
- package/dist/types/api.d.ts +1215 -974
- package/dist/types/api.js +4 -0
- package/dist/types/auth.d.ts +7 -7
- package/dist/types/db.d.ts +121 -77
- package/dist/types/internal.d.ts +708 -620
- package/dist/types/models.d.ts +22 -8
- package/dist/types/models.js +13 -0
- package/dist/types/stats.d.ts +1077 -861
- package/package.json +1 -1
- package/src/lib/articleSlug.ts +40 -0
- package/src/lib/index.ts +1 -0
- package/src/types/api.ts +7 -0
- package/src/types/models.ts +16 -0
package/dist/types/models.d.ts
CHANGED
|
@@ -281,9 +281,9 @@ export type ServiceResourceType = z.infer<typeof serviceResourceTypeSchema>;
|
|
|
281
281
|
export type ResourceType = ProfileResourceType | ServiceResourceType | '*';
|
|
282
282
|
export declare const resourceSchema: z.ZodObject<{
|
|
283
283
|
type: z.ZodEnum<{
|
|
284
|
+
db: "db";
|
|
284
285
|
self: "self";
|
|
285
286
|
"*": "*";
|
|
286
|
-
db: "db";
|
|
287
287
|
jams: "jams";
|
|
288
288
|
profiles: "profiles";
|
|
289
289
|
notifications: "notifications";
|
|
@@ -315,9 +315,9 @@ export declare const scopeSchema: z.ZodObject<{
|
|
|
315
315
|
}>>;
|
|
316
316
|
resource: z.ZodObject<{
|
|
317
317
|
type: z.ZodEnum<{
|
|
318
|
+
db: "db";
|
|
318
319
|
self: "self";
|
|
319
320
|
"*": "*";
|
|
320
|
-
db: "db";
|
|
321
321
|
jams: "jams";
|
|
322
322
|
profiles: "profiles";
|
|
323
323
|
notifications: "notifications";
|
|
@@ -405,9 +405,9 @@ export declare const profileDataSchema: z.ZodObject<{
|
|
|
405
405
|
email: z.ZodOptional<z.ZodEmail>;
|
|
406
406
|
resource: z.ZodOptional<z.ZodObject<{
|
|
407
407
|
type: z.ZodEnum<{
|
|
408
|
+
db: "db";
|
|
408
409
|
self: "self";
|
|
409
410
|
"*": "*";
|
|
410
|
-
db: "db";
|
|
411
411
|
jams: "jams";
|
|
412
412
|
profiles: "profiles";
|
|
413
413
|
notifications: "notifications";
|
|
@@ -462,9 +462,9 @@ export declare const profileSchema: z.ZodObject<{
|
|
|
462
462
|
email: z.ZodOptional<z.ZodEmail>;
|
|
463
463
|
resource: z.ZodOptional<z.ZodObject<{
|
|
464
464
|
type: z.ZodEnum<{
|
|
465
|
+
db: "db";
|
|
465
466
|
self: "self";
|
|
466
467
|
"*": "*";
|
|
467
|
-
db: "db";
|
|
468
468
|
jams: "jams";
|
|
469
469
|
profiles: "profiles";
|
|
470
470
|
notifications: "notifications";
|
|
@@ -536,9 +536,9 @@ export declare const accountWithMetaSchema: z.ZodObject<{
|
|
|
536
536
|
email: z.ZodOptional<z.ZodEmail>;
|
|
537
537
|
resource: z.ZodOptional<z.ZodObject<{
|
|
538
538
|
type: z.ZodEnum<{
|
|
539
|
+
db: "db";
|
|
539
540
|
self: "self";
|
|
540
541
|
"*": "*";
|
|
541
|
-
db: "db";
|
|
542
542
|
jams: "jams";
|
|
543
543
|
profiles: "profiles";
|
|
544
544
|
notifications: "notifications";
|
|
@@ -650,9 +650,9 @@ export declare const followSchema: z.ZodObject<{
|
|
|
650
650
|
email: z.ZodOptional<z.ZodEmail>;
|
|
651
651
|
resource: z.ZodOptional<z.ZodObject<{
|
|
652
652
|
type: z.ZodEnum<{
|
|
653
|
+
db: "db";
|
|
653
654
|
self: "self";
|
|
654
655
|
"*": "*";
|
|
655
|
-
db: "db";
|
|
656
656
|
jams: "jams";
|
|
657
657
|
profiles: "profiles";
|
|
658
658
|
notifications: "notifications";
|
|
@@ -710,9 +710,9 @@ export declare const followSchema: z.ZodObject<{
|
|
|
710
710
|
email: z.ZodOptional<z.ZodEmail>;
|
|
711
711
|
resource: z.ZodOptional<z.ZodObject<{
|
|
712
712
|
type: z.ZodEnum<{
|
|
713
|
+
db: "db";
|
|
713
714
|
self: "self";
|
|
714
715
|
"*": "*";
|
|
715
|
-
db: "db";
|
|
716
716
|
jams: "jams";
|
|
717
717
|
profiles: "profiles";
|
|
718
718
|
notifications: "notifications";
|
|
@@ -1069,6 +1069,8 @@ export declare const articleSchema: z.ZodObject<{
|
|
|
1069
1069
|
type: z.ZodLiteral<"article">;
|
|
1070
1070
|
image: z.ZodOptional<z.ZodURL>;
|
|
1071
1071
|
title: z.ZodOptional<z.ZodString>;
|
|
1072
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
1073
|
+
instanceScoped: z.ZodOptional<z.ZodBoolean>;
|
|
1072
1074
|
}, z.core.$strip>;
|
|
1073
1075
|
export type Article = z.infer<typeof articleSchema>;
|
|
1074
1076
|
/** Resource titles are library headings, so they stay much shorter than the description. */
|
|
@@ -1524,6 +1526,8 @@ export declare const postDataUnionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1524
1526
|
type: z.ZodLiteral<"article">;
|
|
1525
1527
|
image: z.ZodOptional<z.ZodURL>;
|
|
1526
1528
|
title: z.ZodOptional<z.ZodString>;
|
|
1529
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
1530
|
+
instanceScoped: z.ZodOptional<z.ZodBoolean>;
|
|
1527
1531
|
}, z.core.$strip>, z.ZodObject<{
|
|
1528
1532
|
content: z.ZodOptional<z.ZodString>;
|
|
1529
1533
|
sensitive: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1809,6 +1813,8 @@ export declare const postDataInputUnionSchema: z.ZodDiscriminatedUnion<[z.ZodObj
|
|
|
1809
1813
|
type: z.ZodLiteral<"article">;
|
|
1810
1814
|
image: z.ZodOptional<z.ZodURL>;
|
|
1811
1815
|
title: z.ZodOptional<z.ZodString>;
|
|
1816
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
1817
|
+
instanceScoped: z.ZodOptional<z.ZodBoolean>;
|
|
1812
1818
|
}, z.core.$strip>, z.ZodObject<{
|
|
1813
1819
|
content: z.ZodOptional<z.ZodString>;
|
|
1814
1820
|
sensitive: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -2112,6 +2118,8 @@ export declare const postDataSchema: z.ZodObject<{
|
|
|
2112
2118
|
type: z.ZodLiteral<"article">;
|
|
2113
2119
|
image: z.ZodOptional<z.ZodURL>;
|
|
2114
2120
|
title: z.ZodOptional<z.ZodString>;
|
|
2121
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
2122
|
+
instanceScoped: z.ZodOptional<z.ZodBoolean>;
|
|
2115
2123
|
}, z.core.$strip>, z.ZodObject<{
|
|
2116
2124
|
content: z.ZodOptional<z.ZodString>;
|
|
2117
2125
|
sensitive: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -2417,6 +2425,8 @@ export declare const postSchema: z.ZodObject<{
|
|
|
2417
2425
|
type: z.ZodLiteral<"article">;
|
|
2418
2426
|
image: z.ZodOptional<z.ZodURL>;
|
|
2419
2427
|
title: z.ZodOptional<z.ZodString>;
|
|
2428
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
2429
|
+
instanceScoped: z.ZodOptional<z.ZodBoolean>;
|
|
2420
2430
|
}, z.core.$strip>, z.ZodObject<{
|
|
2421
2431
|
content: z.ZodOptional<z.ZodString>;
|
|
2422
2432
|
sensitive: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -2750,6 +2760,8 @@ export declare const entryDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2750
2760
|
type: z.ZodLiteral<"article">;
|
|
2751
2761
|
image: z.ZodOptional<z.ZodURL>;
|
|
2752
2762
|
title: z.ZodOptional<z.ZodString>;
|
|
2763
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
2764
|
+
instanceScoped: z.ZodOptional<z.ZodBoolean>;
|
|
2753
2765
|
}, z.core.$strip>, z.ZodObject<{
|
|
2754
2766
|
content: z.ZodOptional<z.ZodString>;
|
|
2755
2767
|
sensitive: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -3036,6 +3048,8 @@ export declare const entryDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
3036
3048
|
type: z.ZodLiteral<"article">;
|
|
3037
3049
|
image: z.ZodOptional<z.ZodURL>;
|
|
3038
3050
|
title: z.ZodOptional<z.ZodString>;
|
|
3051
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
3052
|
+
instanceScoped: z.ZodOptional<z.ZodBoolean>;
|
|
3039
3053
|
}, z.core.$strip>, z.ZodObject<{
|
|
3040
3054
|
content: z.ZodOptional<z.ZodString>;
|
|
3041
3055
|
sensitive: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -3483,11 +3497,11 @@ export declare const groupSchema: z.ZodObject<{
|
|
|
3483
3497
|
export type Group = z.infer<typeof groupSchema>;
|
|
3484
3498
|
export declare const groupRoleSchema: z.ZodObject<{
|
|
3485
3499
|
roles: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
3500
|
+
admin: "admin";
|
|
3486
3501
|
none: "none";
|
|
3487
3502
|
local: "local";
|
|
3488
3503
|
member: "member";
|
|
3489
3504
|
moderator: "moderator";
|
|
3490
|
-
admin: "admin";
|
|
3491
3505
|
owner: "owner";
|
|
3492
3506
|
invited: "invited";
|
|
3493
3507
|
}>>>>;
|
package/dist/types/models.js
CHANGED
|
@@ -4,6 +4,7 @@ import ISO6391 from 'iso-639-1';
|
|
|
4
4
|
import { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
|
|
5
5
|
import { isEndBeforeStart } from '../lib/eventTime.js';
|
|
6
6
|
import { hasVisibleText, postContentWithinBudget } from '../lib/contentLength.js';
|
|
7
|
+
import { ARTICLE_SLUG_MAX_LENGTH, articleSlugPattern, } from '../lib/articleSlug.js';
|
|
7
8
|
import { groupRelationships } from './capabilities.js';
|
|
8
9
|
import { capabilitiesSchema, reactionEmojiSchema } from './config.js';
|
|
9
10
|
import { HANDLE_RESERVED_MESSAGE, additionalForbiddenHandlesSchema, classifyAdditionalForbiddenHandle, collectAdditionalForbiddenHandles, forbiddenHandles, handleRegex, handleRegexBase, isDefaultForbiddenHandle, isForbiddenHandle, normalizeForbiddenHandle, } from './forbiddenHandles.js';
|
|
@@ -406,6 +407,18 @@ export const articleSchema = noteBaseSchema
|
|
|
406
407
|
type: z.literal('article'),
|
|
407
408
|
image: z.url().optional(),
|
|
408
409
|
title: z.string().optional(),
|
|
410
|
+
/** Optional clean URL (`/{slug}` or `/{handle}/{slug}`); enforced unique
|
|
411
|
+
* by partial indexes on `posts.body->>'slug'`. Shape/length come from
|
|
412
|
+
* `articleSlug.ts` (single source of truth). */
|
|
413
|
+
slug: z
|
|
414
|
+
.string()
|
|
415
|
+
.min(1)
|
|
416
|
+
.max(ARTICLE_SLUG_MAX_LENGTH)
|
|
417
|
+
.regex(articleSlugPattern)
|
|
418
|
+
.optional(),
|
|
419
|
+
/** `true` = globally unique `/{slug}` route (admin/moderator);
|
|
420
|
+
* defaults to profile-scoped `/{handle}/{slug}`. */
|
|
421
|
+
instanceScoped: z.boolean().optional(),
|
|
409
422
|
})
|
|
410
423
|
.openapi('Article');
|
|
411
424
|
/** Resource titles are library headings, so they stay much shorter than the description. */
|