@openpeepshq/common 0.1.43
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.md +21 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/lib/adminSections.d.ts +53 -0
- package/dist/lib/adminSections.js +62 -0
- package/dist/lib/attachmentHelpers.d.ts +1 -0
- package/dist/lib/attachmentHelpers.js +13 -0
- package/dist/lib/capabilitiesHelpers.d.ts +118 -0
- package/dist/lib/capabilitiesHelpers.js +238 -0
- package/dist/lib/colors.d.ts +5 -0
- package/dist/lib/colors.js +17 -0
- package/dist/lib/csvHelpers.d.ts +6 -0
- package/dist/lib/csvHelpers.js +17 -0
- package/dist/lib/eventIcs.d.ts +4 -0
- package/dist/lib/eventIcs.js +83 -0
- package/dist/lib/groupHelpers.d.ts +134 -0
- package/dist/lib/groupHelpers.js +216 -0
- package/dist/lib/index.d.ts +17 -0
- package/dist/lib/index.js +17 -0
- package/dist/lib/jamHelpers.d.ts +5 -0
- package/dist/lib/jamHelpers.js +37 -0
- package/dist/lib/markdownHelpers.d.ts +1 -0
- package/dist/lib/markdownHelpers.js +24 -0
- package/dist/lib/mediaDimensions.d.ts +19 -0
- package/dist/lib/mediaDimensions.js +19 -0
- package/dist/lib/postHelpers.d.ts +146 -0
- package/dist/lib/postHelpers.js +144 -0
- package/dist/lib/profileHelpers.d.ts +30 -0
- package/dist/lib/profileHelpers.js +75 -0
- package/dist/lib/pushHelpers.d.ts +4 -0
- package/dist/lib/pushHelpers.js +6 -0
- package/dist/lib/scopeHelpers.d.ts +25 -0
- package/dist/lib/scopeHelpers.js +85 -0
- package/dist/lib/text.d.ts +3 -0
- package/dist/lib/text.js +18 -0
- package/dist/lib/tokenHelpers.d.ts +21 -0
- package/dist/lib/tokenHelpers.js +81 -0
- package/dist/lib/utils.d.ts +43 -0
- package/dist/lib/utils.js +200 -0
- package/dist/types/admin-db.d.ts +62 -0
- package/dist/types/admin-db.js +41 -0
- package/dist/types/admin-email.d.ts +39 -0
- package/dist/types/admin-email.js +41 -0
- package/dist/types/admin-jobs.d.ts +15 -0
- package/dist/types/admin-jobs.js +14 -0
- package/dist/types/admin-performance.d.ts +23 -0
- package/dist/types/admin-performance.js +14 -0
- package/dist/types/analytics.d.ts +583 -0
- package/dist/types/analytics.js +213 -0
- package/dist/types/api.d.ts +20076 -0
- package/dist/types/api.js +492 -0
- package/dist/types/apple-app-site-association.d.ts +50 -0
- package/dist/types/apple-app-site-association.js +38 -0
- package/dist/types/auth.d.ts +367 -0
- package/dist/types/auth.js +17 -0
- package/dist/types/capabilities.d.ts +24 -0
- package/dist/types/capabilities.js +144 -0
- package/dist/types/config.d.ts +858 -0
- package/dist/types/config.js +352 -0
- package/dist/types/db.d.ts +8780 -0
- package/dist/types/db.js +65 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/types/index.js +18 -0
- package/dist/types/internal.d.ts +44337 -0
- package/dist/types/internal.js +154 -0
- package/dist/types/models.d.ts +2619 -0
- package/dist/types/models.js +599 -0
- package/dist/types/notifications.d.ts +148 -0
- package/dist/types/notifications.js +40 -0
- package/dist/types/plugins.d.ts +66 -0
- package/dist/types/plugins.js +29 -0
- package/dist/types/stats.d.ts +10216 -0
- package/dist/types/stats.js +109 -0
- package/dist/types/stripe.d.ts +42 -0
- package/dist/types/stripe.js +35 -0
- package/dist/types/utils.d.ts +84 -0
- package/dist/types/utils.js +39 -0
- package/package.json +54 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { accountSchema, baseSchemaShape, profileStatsSchema, profileDataSchema, idSchemaShape, roleSchema, profileSchema, groupDataSchema, modelSchema, groupRoleSchema, mentionDataSchema, reactionDataSchema, answerSchema, rsvpSchema, postDataUnionSchema, postTypeSchema, visibilityTypeSchema, applicationDataSchema, hashtagSchema, accountInteractionsSchema, inviteLinkSchema, reportSchema, groupSchema, jamRecordingSchema, accessTokenSchema, scopeSchema, } from './models.js';
|
|
3
|
+
import { jsonSchema } from './utils.js';
|
|
4
|
+
export const groupWithMetaSchema = groupDataSchema.extend({
|
|
5
|
+
...baseSchemaShape,
|
|
6
|
+
...idSchemaShape,
|
|
7
|
+
membersCount: z.number(),
|
|
8
|
+
lastPostAt: z.string().datetime().nullable().optional(),
|
|
9
|
+
});
|
|
10
|
+
export const adminGroupSchema = groupWithMetaSchema.extend({
|
|
11
|
+
postsCount: z.number(),
|
|
12
|
+
admins: profileSchema.array(),
|
|
13
|
+
});
|
|
14
|
+
export const membershipSchema = groupRoleSchema.extend({
|
|
15
|
+
group: modelSchema(groupWithMetaSchema),
|
|
16
|
+
});
|
|
17
|
+
export const profileWithMetaSchema = profileDataSchema.extend({
|
|
18
|
+
...baseSchemaShape,
|
|
19
|
+
...idSchemaShape,
|
|
20
|
+
roles: roleSchema.array(),
|
|
21
|
+
followers: profileSchema.array(),
|
|
22
|
+
following: profileSchema.array(),
|
|
23
|
+
controllers: accountSchema.array(),
|
|
24
|
+
memberships: membershipSchema.array(),
|
|
25
|
+
profileStats: profileStatsSchema,
|
|
26
|
+
});
|
|
27
|
+
export const memberExportStatsSchema = z.object({
|
|
28
|
+
postsCount: z.number(),
|
|
29
|
+
reactionsCount: z.number(),
|
|
30
|
+
lastSeen: z.iso.datetime().nullable(),
|
|
31
|
+
});
|
|
32
|
+
export const accessTokenWithMetaSchema = accessTokenSchema.extend({
|
|
33
|
+
profile: profileWithMetaSchema,
|
|
34
|
+
scopes: z.array(scopeSchema).optional(),
|
|
35
|
+
});
|
|
36
|
+
export const mentionWithProfileSchema = mentionDataSchema.extend({
|
|
37
|
+
profile: profileWithMetaSchema,
|
|
38
|
+
});
|
|
39
|
+
const reactionWithProfileSchema = reactionDataSchema.extend({
|
|
40
|
+
profile: profileWithMetaSchema,
|
|
41
|
+
});
|
|
42
|
+
const _answerWithProfileSchema = answerSchema.extend({
|
|
43
|
+
profile: profileWithMetaSchema,
|
|
44
|
+
});
|
|
45
|
+
const rsvpWithMetaSchema = rsvpSchema.extend({
|
|
46
|
+
profile: profileWithMetaSchema,
|
|
47
|
+
createdAt: z.string().datetime(),
|
|
48
|
+
});
|
|
49
|
+
export const entryWithProfileSchema = z.discriminatedUnion('type', [
|
|
50
|
+
z.object({
|
|
51
|
+
type: z.literal('create'),
|
|
52
|
+
data: postDataUnionSchema,
|
|
53
|
+
profile: profileWithMetaSchema,
|
|
54
|
+
createdAt: z.string().datetime(),
|
|
55
|
+
}),
|
|
56
|
+
z.object({
|
|
57
|
+
type: z.literal('edit'),
|
|
58
|
+
data: postDataUnionSchema,
|
|
59
|
+
profile: profileWithMetaSchema,
|
|
60
|
+
createdAt: z.string().datetime(),
|
|
61
|
+
}),
|
|
62
|
+
z.object({
|
|
63
|
+
type: z.literal('delete'),
|
|
64
|
+
data: z.any(),
|
|
65
|
+
profile: profileWithMetaSchema,
|
|
66
|
+
createdAt: z.string().datetime(),
|
|
67
|
+
}),
|
|
68
|
+
z.object({
|
|
69
|
+
type: z.literal('answer'),
|
|
70
|
+
data: answerSchema,
|
|
71
|
+
profile: profileWithMetaSchema,
|
|
72
|
+
createdAt: z.string().datetime(),
|
|
73
|
+
}),
|
|
74
|
+
z.object({
|
|
75
|
+
type: z.literal('rsvp'),
|
|
76
|
+
data: rsvpSchema,
|
|
77
|
+
profile: profileWithMetaSchema,
|
|
78
|
+
createdAt: z.string().datetime(),
|
|
79
|
+
}),
|
|
80
|
+
]);
|
|
81
|
+
export const replyPostSchema = z.object({
|
|
82
|
+
id: z.string(),
|
|
83
|
+
type: postTypeSchema,
|
|
84
|
+
profile: profileWithMetaSchema,
|
|
85
|
+
data: postDataUnionSchema,
|
|
86
|
+
creatorId: z.string(),
|
|
87
|
+
entries: entryWithProfileSchema.array(),
|
|
88
|
+
createdAt: z.string().datetime(),
|
|
89
|
+
deletedAt: z.string().datetime().optional().nullable(),
|
|
90
|
+
visibility: visibilityTypeSchema,
|
|
91
|
+
group: groupWithMetaSchema.optional().nullable(),
|
|
92
|
+
audience: z.array(profileWithMetaSchema).optional().nullable(),
|
|
93
|
+
});
|
|
94
|
+
const basePostSchema = replyPostSchema.extend({
|
|
95
|
+
repostCount: z.number(),
|
|
96
|
+
replyCount: z.number(),
|
|
97
|
+
reactions: reactionWithProfileSchema.array(),
|
|
98
|
+
application: applicationDataSchema.optional(),
|
|
99
|
+
mentions: z.array(mentionWithProfileSchema),
|
|
100
|
+
tags: z.array(hashtagSchema),
|
|
101
|
+
groupId: z.string().optional().nullable(),
|
|
102
|
+
groupDiscoverable: z.boolean().optional().nullable(),
|
|
103
|
+
updatedAt: z.string().datetime(),
|
|
104
|
+
accountInteractions: accountInteractionsSchema.optional(),
|
|
105
|
+
rsvps: rsvpWithMetaSchema.array(),
|
|
106
|
+
seen: z.boolean().optional(),
|
|
107
|
+
});
|
|
108
|
+
const withReplyPostSchema = basePostSchema.extend({
|
|
109
|
+
inReplyToId: z.string().optional().nullable(),
|
|
110
|
+
replyTo: replyPostSchema.optional().nullable(),
|
|
111
|
+
});
|
|
112
|
+
export const postWithMetaSchema = withReplyPostSchema
|
|
113
|
+
.extend({
|
|
114
|
+
repost: basePostSchema.optional().nullable(),
|
|
115
|
+
})
|
|
116
|
+
.openapi('Post');
|
|
117
|
+
export const expandedNotificationSchema = z.object({
|
|
118
|
+
id: z.string().uuid(),
|
|
119
|
+
profileId: z.string().uuid(),
|
|
120
|
+
pushHandled: z.boolean().optional(),
|
|
121
|
+
emailHandled: z.boolean().optional(),
|
|
122
|
+
type: z.string(),
|
|
123
|
+
seen: z.boolean().optional(),
|
|
124
|
+
read: z.boolean().optional(),
|
|
125
|
+
createdAt: z.string().datetime(),
|
|
126
|
+
updatedAt: z.string().datetime(),
|
|
127
|
+
recipientProfile: profileWithMetaSchema,
|
|
128
|
+
senderProfile: profileWithMetaSchema.nullable().optional(),
|
|
129
|
+
group: groupSchema.nullable().optional(),
|
|
130
|
+
post: postWithMetaSchema.nullable().optional(),
|
|
131
|
+
data: jsonSchema.optional(),
|
|
132
|
+
});
|
|
133
|
+
export const groupMemberSchema = groupRoleSchema.extend({
|
|
134
|
+
profile: profileWithMetaSchema,
|
|
135
|
+
});
|
|
136
|
+
export const inviteLinkWithMetaSchema = inviteLinkSchema.extend({
|
|
137
|
+
profile: profileWithMetaSchema,
|
|
138
|
+
redemptions: profileWithMetaSchema.array(),
|
|
139
|
+
/** Resolved from `groupIds` by the mapping so the UI can show group names. */
|
|
140
|
+
groups: groupWithMetaSchema.array(),
|
|
141
|
+
});
|
|
142
|
+
export const postContextSchema = z.object({
|
|
143
|
+
ancestors: postWithMetaSchema.array(),
|
|
144
|
+
descendants: postWithMetaSchema.array(),
|
|
145
|
+
});
|
|
146
|
+
export const reportWithMetaSchema = reportSchema.extend({
|
|
147
|
+
reporterProfile: profileWithMetaSchema,
|
|
148
|
+
reportedProfile: profileWithMetaSchema,
|
|
149
|
+
reportedPosts: z.array(postWithMetaSchema),
|
|
150
|
+
});
|
|
151
|
+
export const jamRecordingWithMetaSchema = jamRecordingSchema.extend({
|
|
152
|
+
profile: profileWithMetaSchema,
|
|
153
|
+
post: postWithMetaSchema,
|
|
154
|
+
});
|