@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.
Files changed (78) hide show
  1. package/LICENSE.md +21 -0
  2. package/dist/index.d.ts +3 -0
  3. package/dist/index.js +3 -0
  4. package/dist/lib/adminSections.d.ts +53 -0
  5. package/dist/lib/adminSections.js +62 -0
  6. package/dist/lib/attachmentHelpers.d.ts +1 -0
  7. package/dist/lib/attachmentHelpers.js +13 -0
  8. package/dist/lib/capabilitiesHelpers.d.ts +118 -0
  9. package/dist/lib/capabilitiesHelpers.js +238 -0
  10. package/dist/lib/colors.d.ts +5 -0
  11. package/dist/lib/colors.js +17 -0
  12. package/dist/lib/csvHelpers.d.ts +6 -0
  13. package/dist/lib/csvHelpers.js +17 -0
  14. package/dist/lib/eventIcs.d.ts +4 -0
  15. package/dist/lib/eventIcs.js +83 -0
  16. package/dist/lib/groupHelpers.d.ts +134 -0
  17. package/dist/lib/groupHelpers.js +216 -0
  18. package/dist/lib/index.d.ts +17 -0
  19. package/dist/lib/index.js +17 -0
  20. package/dist/lib/jamHelpers.d.ts +5 -0
  21. package/dist/lib/jamHelpers.js +37 -0
  22. package/dist/lib/markdownHelpers.d.ts +1 -0
  23. package/dist/lib/markdownHelpers.js +24 -0
  24. package/dist/lib/mediaDimensions.d.ts +19 -0
  25. package/dist/lib/mediaDimensions.js +19 -0
  26. package/dist/lib/postHelpers.d.ts +146 -0
  27. package/dist/lib/postHelpers.js +144 -0
  28. package/dist/lib/profileHelpers.d.ts +30 -0
  29. package/dist/lib/profileHelpers.js +75 -0
  30. package/dist/lib/pushHelpers.d.ts +4 -0
  31. package/dist/lib/pushHelpers.js +6 -0
  32. package/dist/lib/scopeHelpers.d.ts +25 -0
  33. package/dist/lib/scopeHelpers.js +85 -0
  34. package/dist/lib/text.d.ts +3 -0
  35. package/dist/lib/text.js +18 -0
  36. package/dist/lib/tokenHelpers.d.ts +21 -0
  37. package/dist/lib/tokenHelpers.js +81 -0
  38. package/dist/lib/utils.d.ts +43 -0
  39. package/dist/lib/utils.js +200 -0
  40. package/dist/types/admin-db.d.ts +62 -0
  41. package/dist/types/admin-db.js +41 -0
  42. package/dist/types/admin-email.d.ts +39 -0
  43. package/dist/types/admin-email.js +41 -0
  44. package/dist/types/admin-jobs.d.ts +15 -0
  45. package/dist/types/admin-jobs.js +14 -0
  46. package/dist/types/admin-performance.d.ts +23 -0
  47. package/dist/types/admin-performance.js +14 -0
  48. package/dist/types/analytics.d.ts +583 -0
  49. package/dist/types/analytics.js +213 -0
  50. package/dist/types/api.d.ts +20076 -0
  51. package/dist/types/api.js +492 -0
  52. package/dist/types/apple-app-site-association.d.ts +50 -0
  53. package/dist/types/apple-app-site-association.js +38 -0
  54. package/dist/types/auth.d.ts +367 -0
  55. package/dist/types/auth.js +17 -0
  56. package/dist/types/capabilities.d.ts +24 -0
  57. package/dist/types/capabilities.js +144 -0
  58. package/dist/types/config.d.ts +858 -0
  59. package/dist/types/config.js +352 -0
  60. package/dist/types/db.d.ts +8780 -0
  61. package/dist/types/db.js +65 -0
  62. package/dist/types/index.d.ts +18 -0
  63. package/dist/types/index.js +18 -0
  64. package/dist/types/internal.d.ts +44337 -0
  65. package/dist/types/internal.js +154 -0
  66. package/dist/types/models.d.ts +2619 -0
  67. package/dist/types/models.js +599 -0
  68. package/dist/types/notifications.d.ts +148 -0
  69. package/dist/types/notifications.js +40 -0
  70. package/dist/types/plugins.d.ts +66 -0
  71. package/dist/types/plugins.js +29 -0
  72. package/dist/types/stats.d.ts +10216 -0
  73. package/dist/types/stats.js +109 -0
  74. package/dist/types/stripe.d.ts +42 -0
  75. package/dist/types/stripe.js +35 -0
  76. package/dist/types/utils.d.ts +84 -0
  77. package/dist/types/utils.js +39 -0
  78. package/package.json +54 -0
@@ -0,0 +1,148 @@
1
+ import { z } from 'zod';
2
+ import { NotificationStats } from './api';
3
+ import { RoleCapability } from './capabilities';
4
+ import { ExpandedNotification } from './internal';
5
+ export declare const actionSchema: z.ZodObject<{
6
+ action: z.ZodString;
7
+ title: z.ZodString;
8
+ }, z.core.$strip>;
9
+ export type Action = z.infer<typeof actionSchema>;
10
+ export type ActionType = {
11
+ actions?: {
12
+ action: string;
13
+ title: string;
14
+ }[];
15
+ };
16
+ export declare const notificationOptionsSchema: z.ZodObject<{
17
+ body: z.ZodOptional<z.ZodString>;
18
+ icon: z.ZodOptional<z.ZodString>;
19
+ image: z.ZodOptional<z.ZodString>;
20
+ link: z.ZodOptional<z.ZodString>;
21
+ tag: z.ZodOptional<z.ZodString>;
22
+ badge: z.ZodOptional<z.ZodNumber>;
23
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
24
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
25
+ action: z.ZodString;
26
+ title: z.ZodString;
27
+ }, z.core.$strip>>>;
28
+ }, z.core.$strip>;
29
+ export type NotificationOptions = z.infer<typeof notificationOptionsSchema>;
30
+ export declare const pushNotificationSchema: z.ZodObject<{
31
+ title: z.ZodOptional<z.ZodString>;
32
+ options: z.ZodOptional<z.ZodObject<{
33
+ body: z.ZodOptional<z.ZodString>;
34
+ icon: z.ZodOptional<z.ZodString>;
35
+ image: z.ZodOptional<z.ZodString>;
36
+ link: z.ZodOptional<z.ZodString>;
37
+ tag: z.ZodOptional<z.ZodString>;
38
+ badge: z.ZodOptional<z.ZodNumber>;
39
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
40
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
41
+ action: z.ZodString;
42
+ title: z.ZodString;
43
+ }, z.core.$strip>>>;
44
+ }, z.core.$strip>>;
45
+ invalidateQueries: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
46
+ }, z.core.$strip>;
47
+ export type PushNotification = z.infer<typeof pushNotificationSchema>;
48
+ export interface PushMessage {
49
+ notificationStats: NotificationStats;
50
+ notification: PushNotification;
51
+ }
52
+ export interface NotificationHandler {
53
+ type: string;
54
+ event: string;
55
+ requiredCapabilities?: RoleCapability[];
56
+ defaultSettings?: {
57
+ create: boolean;
58
+ push: boolean;
59
+ email: boolean;
60
+ };
61
+ eventHandler: (...data: unknown[]) => Promise<void> | void;
62
+ expander?: (notification: ExpandedNotification) => Promise<ExpandedNotification>;
63
+ pushRenderer: (notification: ExpandedNotification) => Promise<PushNotification>;
64
+ }
65
+ export declare const notificationTypeSchema: z.ZodObject<{
66
+ type: z.ZodString;
67
+ requiredCapabilities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
68
+ "core-posts-delete": "core-posts-delete";
69
+ "core-groups-read": "core-groups-read";
70
+ "core-groups-delete": "core-groups-delete";
71
+ "core-groups-addMember": "core-groups-addMember";
72
+ "core-groups-removeMember": "core-groups-removeMember";
73
+ "core-groups-changeMemberRole": "core-groups-changeMemberRole";
74
+ "core-profiles-read": "core-profiles-read";
75
+ "core-profiles-update": "core-profiles-update";
76
+ "core-profiles-delete": "core-profiles-delete";
77
+ "core-reports-create": "core-reports-create";
78
+ "core-serviceTokens-create": "core-serviceTokens-create";
79
+ "core-serviceTokens-read": "core-serviceTokens-read";
80
+ "core-serviceTokens-delete": "core-serviceTokens-delete";
81
+ "core-local": "core-local";
82
+ "core-accounts-read": "core-accounts-read";
83
+ "core-accounts-create": "core-accounts-create";
84
+ "core-accounts-update": "core-accounts-update";
85
+ "core-accounts-delete": "core-accounts-delete";
86
+ "core-reports-update": "core-reports-update";
87
+ "core-groups-create": "core-groups-create";
88
+ "core-posts-create-note-local": "core-posts-create-note-local";
89
+ "core-posts-create-note-public": "core-posts-create-note-public";
90
+ "core-posts-create-note-direct": "core-posts-create-note-direct";
91
+ "core-posts-create-note-private": "core-posts-create-note-private";
92
+ "core-posts-create-event-local": "core-posts-create-event-local";
93
+ "core-posts-create-event-public": "core-posts-create-event-public";
94
+ "core-posts-create-event-direct": "core-posts-create-event-direct";
95
+ "core-posts-create-event-private": "core-posts-create-event-private";
96
+ "core-posts-create-poll-local": "core-posts-create-poll-local";
97
+ "core-posts-create-poll-public": "core-posts-create-poll-public";
98
+ "core-posts-create-poll-direct": "core-posts-create-poll-direct";
99
+ "core-posts-create-poll-private": "core-posts-create-poll-private";
100
+ "core-posts-create-article-local": "core-posts-create-article-local";
101
+ "core-posts-create-article-public": "core-posts-create-article-public";
102
+ "core-posts-create-article-direct": "core-posts-create-article-direct";
103
+ "core-posts-create-article-private": "core-posts-create-article-private";
104
+ "core-posts-read-local": "core-posts-read-local";
105
+ "core-posts-announce": "core-posts-announce";
106
+ "core-profiles-roles-update": "core-profiles-roles-update";
107
+ "core-profiles-suspend": "core-profiles-suspend";
108
+ "core-profiles-impersonate": "core-profiles-impersonate";
109
+ "core-analytics-read": "core-analytics-read";
110
+ "core-config-update": "core-config-update";
111
+ "core-config-read": "core-config-read";
112
+ "core-customization-read": "core-customization-read";
113
+ "core-customization-update": "core-customization-update";
114
+ "core-capabilities-read": "core-capabilities-read";
115
+ "core-capabilities-update": "core-capabilities-update";
116
+ "core-backups-create": "core-backups-create";
117
+ "core-backups-read": "core-backups-read";
118
+ "core-backups-download": "core-backups-download";
119
+ "core-backups-restore": "core-backups-restore";
120
+ "core-db-access": "core-db-access";
121
+ "core-i18n-update": "core-i18n-update";
122
+ "core-logs-read": "core-logs-read";
123
+ "core-roles-read": "core-roles-read";
124
+ "core-roles-update": "core-roles-update";
125
+ "core-maintenance-restart": "core-maintenance-restart";
126
+ "core-inviteLinks-create": "core-inviteLinks-create";
127
+ "core-inviteLinks-read": "core-inviteLinks-read";
128
+ "core-inviteLinks-update": "core-inviteLinks-update";
129
+ "core-inviteLinks-delete": "core-inviteLinks-delete";
130
+ "core-serviceTokens-update": "core-serviceTokens-update";
131
+ }>>>;
132
+ defaultSettings: z.ZodOptional<z.ZodObject<{
133
+ create: z.ZodBoolean;
134
+ push: z.ZodBoolean;
135
+ email: z.ZodBoolean;
136
+ }, z.core.$strip>>;
137
+ }, z.core.$strip>;
138
+ export type NotificationType = z.infer<typeof notificationTypeSchema>;
139
+ export declare const notificationDefaults: {
140
+ readonly create: true;
141
+ readonly push: true;
142
+ readonly email: false;
143
+ };
144
+ export declare const notificationAll: {
145
+ readonly create: true;
146
+ readonly push: true;
147
+ readonly email: true;
148
+ };
@@ -0,0 +1,40 @@
1
+ import { z } from 'zod';
2
+ import { roleCapabilities } from './capabilities.js';
3
+ export const actionSchema = z.object({
4
+ action: z.string(),
5
+ title: z.string(),
6
+ });
7
+ export const notificationOptionsSchema = z.object({
8
+ body: z.string().optional(),
9
+ icon: z.string().optional(),
10
+ image: z.string().optional(),
11
+ link: z.string().optional(),
12
+ tag: z.string().optional(),
13
+ badge: z.number().optional(),
14
+ data: z.record(z.string(), z.unknown()).optional(),
15
+ actions: actionSchema.array().optional(),
16
+ });
17
+ export const pushNotificationSchema = z.object({
18
+ title: z.string().optional(),
19
+ options: notificationOptionsSchema.optional(),
20
+ invalidateQueries: z.array(z.array(z.string())).optional(),
21
+ });
22
+ export const notificationTypeSchema = z.object({
23
+ type: z.string(),
24
+ requiredCapabilities: z.enum(roleCapabilities).array().optional(),
25
+ defaultSettings: z.object({
26
+ create: z.boolean(),
27
+ push: z.boolean(),
28
+ email: z.boolean(),
29
+ }).optional(),
30
+ });
31
+ export const notificationDefaults = {
32
+ create: true,
33
+ push: true,
34
+ email: false,
35
+ };
36
+ export const notificationAll = {
37
+ create: true,
38
+ push: true,
39
+ email: true,
40
+ };
@@ -0,0 +1,66 @@
1
+ import { z } from 'zod';
2
+ import { PackageJson } from 'type-fest';
3
+ export interface Plugin {
4
+ key: string;
5
+ namespace: string;
6
+ name: string;
7
+ info: PackageJson;
8
+ path: string;
9
+ status?: 'loaded' | 'failed';
10
+ error?: string;
11
+ }
12
+ export declare const pluginInfoSchema: z.ZodObject<{
13
+ key: z.ZodString;
14
+ namespace: z.ZodString;
15
+ name: z.ZodString;
16
+ version: z.ZodOptional<z.ZodString>;
17
+ displayName: z.ZodOptional<z.ZodString>;
18
+ description: z.ZodOptional<z.ZodString>;
19
+ status: z.ZodOptional<z.ZodEnum<{
20
+ failed: "failed";
21
+ loaded: "loaded";
22
+ }>>;
23
+ }, z.core.$strip>;
24
+ export type PluginInfo = z.infer<typeof pluginInfoSchema>;
25
+ export declare const pluginManifestSchema: z.ZodObject<{
26
+ components: z.ZodDefault<z.ZodArray<z.ZodObject<{
27
+ slot: z.ZodString;
28
+ asset: z.ZodString;
29
+ componentKey: z.ZodString;
30
+ }, z.core.$strip>>>;
31
+ }, z.core.$strip>;
32
+ export type PluginManifest = z.infer<typeof pluginManifestSchema>;
33
+ export declare const pluginEntrySchema: z.ZodObject<{
34
+ key: z.ZodString;
35
+ namespace: z.ZodString;
36
+ name: z.ZodString;
37
+ version: z.ZodOptional<z.ZodString>;
38
+ displayName: z.ZodOptional<z.ZodString>;
39
+ description: z.ZodOptional<z.ZodString>;
40
+ status: z.ZodOptional<z.ZodEnum<{
41
+ failed: "failed";
42
+ loaded: "loaded";
43
+ }>>;
44
+ manifest: z.ZodOptional<z.ZodObject<{
45
+ components: z.ZodDefault<z.ZodArray<z.ZodObject<{
46
+ slot: z.ZodString;
47
+ asset: z.ZodString;
48
+ componentKey: z.ZodString;
49
+ }, z.core.$strip>>>;
50
+ }, z.core.$strip>>;
51
+ }, z.core.$strip>;
52
+ export type PluginEntry = z.infer<typeof pluginEntrySchema>;
53
+ export declare const pluginConfigItemSchema: z.ZodObject<{
54
+ namespace: z.ZodString;
55
+ name: z.ZodString;
56
+ config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
57
+ defaults: z.ZodRecord<z.ZodString, z.ZodUnknown>;
58
+ }, z.core.$strip>;
59
+ export type PluginConfigItem = z.infer<typeof pluginConfigItemSchema>;
60
+ export declare const pluginConfigResponseSchema: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
61
+ namespace: z.ZodString;
62
+ name: z.ZodString;
63
+ config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
64
+ defaults: z.ZodRecord<z.ZodString, z.ZodUnknown>;
65
+ }, z.core.$strip>>>;
66
+ export type PluginConfigResponse = z.infer<typeof pluginConfigResponseSchema>;
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ export const pluginInfoSchema = z.object({
3
+ key: z.string(),
4
+ namespace: z.string(),
5
+ name: z.string(),
6
+ version: z.string().optional(),
7
+ displayName: z.string().optional(),
8
+ description: z.string().optional(),
9
+ status: z.enum(['loaded', 'failed']).optional(),
10
+ });
11
+ export const pluginManifestSchema = z.object({
12
+ components: z
13
+ .array(z.object({
14
+ slot: z.string(),
15
+ asset: z.string(),
16
+ componentKey: z.string(),
17
+ }))
18
+ .default([]),
19
+ });
20
+ export const pluginEntrySchema = pluginInfoSchema.extend({
21
+ manifest: pluginManifestSchema.optional(),
22
+ });
23
+ export const pluginConfigItemSchema = z.object({
24
+ namespace: z.string(),
25
+ name: z.string(),
26
+ config: z.record(z.string(), z.unknown()),
27
+ defaults: z.record(z.string(), z.unknown()),
28
+ });
29
+ export const pluginConfigResponseSchema = z.record(z.string(), z.record(z.string(), pluginConfigItemSchema));