@rpcbase/server 0.489.0 → 0.490.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.
Files changed (107) hide show
  1. package/package.json +1 -1
  2. package/dist/applyRouteLoaders.d.ts +0 -9
  3. package/dist/applyRouteLoaders.d.ts.map +0 -1
  4. package/dist/checkInitReplicaSet.d.ts +0 -6
  5. package/dist/checkInitReplicaSet.d.ts.map +0 -1
  6. package/dist/dev/coverage.d.ts +0 -3
  7. package/dist/dev/coverage.d.ts.map +0 -1
  8. package/dist/email-DEw8keax.js +0 -8042
  9. package/dist/email-DEw8keax.js.map +0 -1
  10. package/dist/email.d.ts +0 -19
  11. package/dist/email.d.ts.map +0 -1
  12. package/dist/getDerivedKey.d.ts +0 -3
  13. package/dist/getDerivedKey.d.ts.map +0 -1
  14. package/dist/handler-BwK8qxLn.js +0 -438
  15. package/dist/handler-BwK8qxLn.js.map +0 -1
  16. package/dist/handler-CedzJJg0.js +0 -114
  17. package/dist/handler-CedzJJg0.js.map +0 -1
  18. package/dist/handler-Cohj3cz3.js +0 -176
  19. package/dist/handler-Cohj3cz3.js.map +0 -1
  20. package/dist/handler-qCAUmVgd.js +0 -684
  21. package/dist/handler-qCAUmVgd.js.map +0 -1
  22. package/dist/hashPassword.d.ts +0 -2
  23. package/dist/hashPassword.d.ts.map +0 -1
  24. package/dist/index.d.ts +0 -7
  25. package/dist/index.d.ts.map +0 -1
  26. package/dist/index.js +0 -4628
  27. package/dist/index.js.map +0 -1
  28. package/dist/initServer.d.ts +0 -9
  29. package/dist/initServer.d.ts.map +0 -1
  30. package/dist/metricsIngestProxyMiddleware.d.ts +0 -3
  31. package/dist/metricsIngestProxyMiddleware.d.ts.map +0 -1
  32. package/dist/notifications/api/notifications/handler.d.ts +0 -4
  33. package/dist/notifications/api/notifications/handler.d.ts.map +0 -1
  34. package/dist/notifications/api/notifications/index.d.ts +0 -168
  35. package/dist/notifications/api/notifications/index.d.ts.map +0 -1
  36. package/dist/notifications/api/notifications/shared.d.ts +0 -6
  37. package/dist/notifications/api/notifications/shared.d.ts.map +0 -1
  38. package/dist/notifications/createNotification.d.ts +0 -13
  39. package/dist/notifications/createNotification.d.ts.map +0 -1
  40. package/dist/notifications/digest.d.ts +0 -13
  41. package/dist/notifications/digest.d.ts.map +0 -1
  42. package/dist/notifications/routes.d.ts +0 -2
  43. package/dist/notifications/routes.d.ts.map +0 -1
  44. package/dist/notifications.d.ts +0 -4
  45. package/dist/notifications.d.ts.map +0 -1
  46. package/dist/notifications.js +0 -127
  47. package/dist/notifications.js.map +0 -1
  48. package/dist/passwordHashStorage.d.ts +0 -11
  49. package/dist/passwordHashStorage.d.ts.map +0 -1
  50. package/dist/posthog.d.ts +0 -9
  51. package/dist/posthog.d.ts.map +0 -1
  52. package/dist/renderSSR.d.ts +0 -12
  53. package/dist/renderSSR.d.ts.map +0 -1
  54. package/dist/render_resend_false-MiC__Smr.js +0 -6
  55. package/dist/render_resend_false-MiC__Smr.js.map +0 -1
  56. package/dist/rts/api/changes/handler.d.ts +0 -9
  57. package/dist/rts/api/changes/handler.d.ts.map +0 -1
  58. package/dist/rts/api/changes/index.d.ts +0 -25
  59. package/dist/rts/api/changes/index.d.ts.map +0 -1
  60. package/dist/rts/index.d.ts +0 -40
  61. package/dist/rts/index.d.ts.map +0 -1
  62. package/dist/rts/index.js +0 -631
  63. package/dist/rts/index.js.map +0 -1
  64. package/dist/rts/routes.d.ts +0 -2
  65. package/dist/rts/routes.d.ts.map +0 -1
  66. package/dist/schemas-7qqi9OQy.js +0 -4225
  67. package/dist/schemas-7qqi9OQy.js.map +0 -1
  68. package/dist/shared-BJomDDWK.js +0 -107
  69. package/dist/shared-BJomDDWK.js.map +0 -1
  70. package/dist/ssrMiddleware.d.ts +0 -18
  71. package/dist/ssrMiddleware.d.ts.map +0 -1
  72. package/dist/types/index.d.ts +0 -6
  73. package/dist/types/index.d.ts.map +0 -1
  74. package/dist/uploads/api/file-uploads/handler.d.ts +0 -5
  75. package/dist/uploads/api/file-uploads/handler.d.ts.map +0 -1
  76. package/dist/uploads/api/file-uploads/handlers/completeUpload.d.ts +0 -5
  77. package/dist/uploads/api/file-uploads/handlers/completeUpload.d.ts.map +0 -1
  78. package/dist/uploads/api/file-uploads/handlers/getStatus.d.ts +0 -5
  79. package/dist/uploads/api/file-uploads/handlers/getStatus.d.ts.map +0 -1
  80. package/dist/uploads/api/file-uploads/handlers/initUpload.d.ts +0 -5
  81. package/dist/uploads/api/file-uploads/handlers/initUpload.d.ts.map +0 -1
  82. package/dist/uploads/api/file-uploads/handlers/uploadChunk.d.ts +0 -9
  83. package/dist/uploads/api/file-uploads/handlers/uploadChunk.d.ts.map +0 -1
  84. package/dist/uploads/api/file-uploads/index.d.ts +0 -43
  85. package/dist/uploads/api/file-uploads/index.d.ts.map +0 -1
  86. package/dist/uploads/api/file-uploads/middleware/rawBodyParser.d.ts +0 -5
  87. package/dist/uploads/api/file-uploads/middleware/rawBodyParser.d.ts.map +0 -1
  88. package/dist/uploads/api/file-uploads/processors/index.d.ts +0 -25
  89. package/dist/uploads/api/file-uploads/processors/index.d.ts.map +0 -1
  90. package/dist/uploads/api/file-uploads/processors/sanitizeSvg.d.ts +0 -5
  91. package/dist/uploads/api/file-uploads/processors/sanitizeSvg.d.ts.map +0 -1
  92. package/dist/uploads/api/file-uploads/shared.d.ts +0 -32
  93. package/dist/uploads/api/file-uploads/shared.d.ts.map +0 -1
  94. package/dist/uploads/api/files/handler.d.ts +0 -4
  95. package/dist/uploads/api/files/handler.d.ts.map +0 -1
  96. package/dist/uploads/api/files/handlers/deleteFile.d.ts +0 -9
  97. package/dist/uploads/api/files/handlers/deleteFile.d.ts.map +0 -1
  98. package/dist/uploads/api/files/handlers/getFile.d.ts +0 -4
  99. package/dist/uploads/api/files/handlers/getFile.d.ts.map +0 -1
  100. package/dist/uploads/api/files/index.d.ts +0 -4
  101. package/dist/uploads/api/files/index.d.ts.map +0 -1
  102. package/dist/uploads/routes.d.ts +0 -2
  103. package/dist/uploads/routes.d.ts.map +0 -1
  104. package/dist/uploads.d.ts +0 -2
  105. package/dist/uploads.d.ts.map +0 -1
  106. package/dist/uploads.js +0 -10
  107. package/dist/uploads.js.map +0 -1
@@ -1,9 +0,0 @@
1
- import { Application } from 'express';
2
- type ServerEnv = {
3
- [key: string]: string | undefined;
4
- };
5
- export declare const initServer: (app: Application, serverEnv: ServerEnv) => Promise<{
6
- sessionMiddleware: import('express').RequestHandler<import('express-serve-static-core').ParamsDictionary, any, any, import('qs').ParsedQs, Record<string, any>>;
7
- }>;
8
- export {};
9
- //# sourceMappingURL=initServer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"initServer.d.ts","sourceRoot":"","sources":["../src/initServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AA0BrC,KAAK,SAAS,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAAE,CAAA;AA0FtD,eAAO,MAAM,UAAU,GAAU,KAAK,WAAW,EAAE,WAAW,SAAS;;EA6EtE,CAAA"}
@@ -1,3 +0,0 @@
1
- import { Application } from 'express';
2
- export declare const metricsIngestProxyMiddleware: (app: Application) => void;
3
- //# sourceMappingURL=metricsIngestProxyMiddleware.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"metricsIngestProxyMiddleware.d.ts","sourceRoot":"","sources":["../src/metricsIngestProxyMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AAwCxC,eAAO,MAAM,4BAA4B,GAAI,KAAK,WAAW,SAQ5D,CAAA"}
@@ -1,4 +0,0 @@
1
- import { Api } from '@rpcbase/api';
2
- declare const _default: (api: Api) => void;
3
- export default _default;
4
- //# sourceMappingURL=handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/notifications/api/notifications/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAmB,MAAM,cAAc,CAAA;yBAubnC,KAAK,GAAG;AAAxB,wBASC"}
@@ -1,168 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const ListRoute = "/api/rb/notifications";
3
- export declare const CreateRoute = "/api/rb/notifications/create";
4
- export declare const MarkReadRoute = "/api/rb/notifications/:notificationId/read";
5
- export declare const ArchiveRoute = "/api/rb/notifications/:notificationId/archive";
6
- export declare const MarkAllReadRoute = "/api/rb/notifications/mark-all-read";
7
- export declare const SettingsRoute = "/api/rb/notifications/settings";
8
- export declare const DigestRunRoute = "/api/rb/notifications/digest/run";
9
- export declare const listRequestSchema: z.ZodObject<{
10
- includeArchived: z.ZodOptional<z.ZodBoolean>;
11
- unreadOnly: z.ZodOptional<z.ZodBoolean>;
12
- limit: z.ZodOptional<z.ZodNumber>;
13
- markSeen: z.ZodOptional<z.ZodBoolean>;
14
- }, z.core.$strip>;
15
- export type ListRequestPayload = z.infer<typeof listRequestSchema>;
16
- export declare const createRequestSchema: z.ZodObject<{
17
- topic: z.ZodOptional<z.ZodString>;
18
- title: z.ZodString;
19
- body: z.ZodOptional<z.ZodString>;
20
- url: z.ZodOptional<z.ZodString>;
21
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
22
- }, z.core.$strip>;
23
- export type CreateRequestPayload = z.infer<typeof createRequestSchema>;
24
- export declare const notificationSchema: z.ZodObject<{
25
- id: z.ZodString;
26
- topic: z.ZodOptional<z.ZodString>;
27
- title: z.ZodString;
28
- body: z.ZodOptional<z.ZodString>;
29
- url: z.ZodOptional<z.ZodString>;
30
- createdAt: z.ZodString;
31
- seenAt: z.ZodOptional<z.ZodString>;
32
- readAt: z.ZodOptional<z.ZodString>;
33
- archivedAt: z.ZodOptional<z.ZodString>;
34
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
35
- }, z.core.$strip>;
36
- export type NotificationPayload = z.infer<typeof notificationSchema>;
37
- export declare const listResponseSchema: z.ZodObject<{
38
- ok: z.ZodBoolean;
39
- error: z.ZodOptional<z.ZodString>;
40
- notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
41
- id: z.ZodString;
42
- topic: z.ZodOptional<z.ZodString>;
43
- title: z.ZodString;
44
- body: z.ZodOptional<z.ZodString>;
45
- url: z.ZodOptional<z.ZodString>;
46
- createdAt: z.ZodString;
47
- seenAt: z.ZodOptional<z.ZodString>;
48
- readAt: z.ZodOptional<z.ZodString>;
49
- archivedAt: z.ZodOptional<z.ZodString>;
50
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
51
- }, z.core.$strip>>>;
52
- unreadCount: z.ZodOptional<z.ZodNumber>;
53
- unseenCount: z.ZodOptional<z.ZodNumber>;
54
- }, z.core.$strip>;
55
- export type ListResponsePayload = z.infer<typeof listResponseSchema>;
56
- export declare const createResponseSchema: z.ZodObject<{
57
- ok: z.ZodBoolean;
58
- error: z.ZodOptional<z.ZodString>;
59
- id: z.ZodOptional<z.ZodString>;
60
- }, z.core.$strip>;
61
- export type CreateResponsePayload = z.infer<typeof createResponseSchema>;
62
- export declare const markReadResponseSchema: z.ZodObject<{
63
- ok: z.ZodBoolean;
64
- error: z.ZodOptional<z.ZodString>;
65
- }, z.core.$strip>;
66
- export type MarkReadResponsePayload = z.infer<typeof markReadResponseSchema>;
67
- export declare const archiveResponseSchema: z.ZodObject<{
68
- ok: z.ZodBoolean;
69
- error: z.ZodOptional<z.ZodString>;
70
- }, z.core.$strip>;
71
- export type ArchiveResponsePayload = z.infer<typeof archiveResponseSchema>;
72
- export declare const markAllReadResponseSchema: z.ZodObject<{
73
- ok: z.ZodBoolean;
74
- error: z.ZodOptional<z.ZodString>;
75
- }, z.core.$strip>;
76
- export type MarkAllReadResponsePayload = z.infer<typeof markAllReadResponseSchema>;
77
- export declare const digestFrequencySchema: z.ZodEnum<{
78
- off: "off";
79
- daily: "daily";
80
- weekly: "weekly";
81
- }>;
82
- export type DigestFrequency = z.infer<typeof digestFrequencySchema>;
83
- export declare const topicPreferenceSchema: z.ZodObject<{
84
- topic: z.ZodString;
85
- inApp: z.ZodBoolean;
86
- emailDigest: z.ZodBoolean;
87
- push: z.ZodBoolean;
88
- }, z.core.$strip>;
89
- export type TopicPreferencePayload = z.infer<typeof topicPreferenceSchema>;
90
- export declare const settingsSchema: z.ZodObject<{
91
- digestFrequency: z.ZodEnum<{
92
- off: "off";
93
- daily: "daily";
94
- weekly: "weekly";
95
- }>;
96
- topicPreferences: z.ZodArray<z.ZodObject<{
97
- topic: z.ZodString;
98
- inApp: z.ZodBoolean;
99
- emailDigest: z.ZodBoolean;
100
- push: z.ZodBoolean;
101
- }, z.core.$strip>>;
102
- lastDigestSentAt: z.ZodOptional<z.ZodString>;
103
- }, z.core.$strip>;
104
- export type SettingsPayload = z.infer<typeof settingsSchema>;
105
- export declare const settingsResponseSchema: z.ZodObject<{
106
- ok: z.ZodBoolean;
107
- error: z.ZodOptional<z.ZodString>;
108
- settings: z.ZodOptional<z.ZodObject<{
109
- digestFrequency: z.ZodEnum<{
110
- off: "off";
111
- daily: "daily";
112
- weekly: "weekly";
113
- }>;
114
- topicPreferences: z.ZodArray<z.ZodObject<{
115
- topic: z.ZodString;
116
- inApp: z.ZodBoolean;
117
- emailDigest: z.ZodBoolean;
118
- push: z.ZodBoolean;
119
- }, z.core.$strip>>;
120
- lastDigestSentAt: z.ZodOptional<z.ZodString>;
121
- }, z.core.$strip>>;
122
- }, z.core.$strip>;
123
- export type SettingsResponsePayload = z.infer<typeof settingsResponseSchema>;
124
- export declare const updateSettingsRequestSchema: z.ZodObject<{
125
- digestFrequency: z.ZodOptional<z.ZodEnum<{
126
- off: "off";
127
- daily: "daily";
128
- weekly: "weekly";
129
- }>>;
130
- topicPreferences: z.ZodOptional<z.ZodArray<z.ZodObject<{
131
- topic: z.ZodString;
132
- inApp: z.ZodBoolean;
133
- emailDigest: z.ZodBoolean;
134
- push: z.ZodBoolean;
135
- }, z.core.$strip>>>;
136
- }, z.core.$strip>;
137
- export type UpdateSettingsRequestPayload = z.infer<typeof updateSettingsRequestSchema>;
138
- export declare const updateSettingsResponseSchema: z.ZodObject<{
139
- ok: z.ZodBoolean;
140
- error: z.ZodOptional<z.ZodString>;
141
- settings: z.ZodOptional<z.ZodObject<{
142
- digestFrequency: z.ZodEnum<{
143
- off: "off";
144
- daily: "daily";
145
- weekly: "weekly";
146
- }>;
147
- topicPreferences: z.ZodArray<z.ZodObject<{
148
- topic: z.ZodString;
149
- inApp: z.ZodBoolean;
150
- emailDigest: z.ZodBoolean;
151
- push: z.ZodBoolean;
152
- }, z.core.$strip>>;
153
- lastDigestSentAt: z.ZodOptional<z.ZodString>;
154
- }, z.core.$strip>>;
155
- }, z.core.$strip>;
156
- export type UpdateSettingsResponsePayload = z.infer<typeof updateSettingsResponseSchema>;
157
- export declare const digestRunRequestSchema: z.ZodObject<{
158
- force: z.ZodOptional<z.ZodBoolean>;
159
- }, z.core.$strip>;
160
- export type DigestRunRequestPayload = z.infer<typeof digestRunRequestSchema>;
161
- export declare const digestRunResponseSchema: z.ZodObject<{
162
- ok: z.ZodBoolean;
163
- error: z.ZodOptional<z.ZodString>;
164
- sent: z.ZodOptional<z.ZodBoolean>;
165
- skippedReason: z.ZodOptional<z.ZodString>;
166
- }, z.core.$strip>;
167
- export type DigestRunResponsePayload = z.infer<typeof digestRunResponseSchema>;
168
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/notifications/api/notifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,SAAS,0BAA0B,CAAA;AAChD,eAAO,MAAM,WAAW,iCAAiC,CAAA;AACzD,eAAO,MAAM,aAAa,+CAA+C,CAAA;AACzE,eAAO,MAAM,YAAY,kDAAkD,CAAA;AA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eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnE,eAAO,MAAM,qBAAqB;;;;;iBAKhC,CAAA;AAEF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAE1E,eAAO,MAAM,cAAc;;;;;;;;;;;;;iBAIzB,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAE5D,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;iBAIjC,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAE5E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;iBAGtC,CAAA;AAEF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAEtF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;iBAIvC,CAAA;AAEF,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AAExF,eAAO,MAAM,sBAAsB;;iBAEjC,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAE5E,eAAO,MAAM,uBAAuB;;;;;iBAKlC,CAAA;AAEF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
@@ -1,6 +0,0 @@
1
- import { Ctx } from '@rpcbase/api';
2
- export declare const getSessionUser: (ctx: Ctx) => {
3
- userId: string;
4
- tenantId: string;
5
- } | null;
6
- //# sourceMappingURL=shared.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../src/notifications/api/notifications/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAQvC,eAAO,MAAM,cAAc,GAAI,KAAK,GAAG;;;QAgBtC,CAAA"}
@@ -1,13 +0,0 @@
1
- import { Ctx } from '@rpcbase/api';
2
- export type CreateNotificationInput = {
3
- userId: string;
4
- topic?: string;
5
- title: string;
6
- body?: string;
7
- url?: string;
8
- metadata?: Record<string, unknown>;
9
- };
10
- export declare const createNotification: (ctx: Ctx, input: CreateNotificationInput) => Promise<{
11
- id: string;
12
- }>;
13
- //# sourceMappingURL=createNotification.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createNotification.d.ts","sourceRoot":"","sources":["../../src/notifications/createNotification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAIvC,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC7B,KAAK,GAAG,EACR,OAAO,uBAAuB,KAC7B,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAyBxB,CAAA"}
@@ -1,13 +0,0 @@
1
- import { Ctx } from '@rpcbase/api';
2
- export declare const sendNotificationsDigestForUser: (ctx: Ctx, { userId, force, }: {
3
- userId: string;
4
- force?: boolean;
5
- }) => Promise<{
6
- ok: true;
7
- sent: boolean;
8
- skippedReason?: string;
9
- } | {
10
- ok: false;
11
- error: string;
12
- }>;
13
- //# sourceMappingURL=digest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["../../src/notifications/digest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAuCvC,eAAO,MAAM,8BAA8B,GACzC,KAAK,GAAG,EACR,oBAGG;IACD,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,KACA,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CA0F5F,CAAA"}
@@ -1,2 +0,0 @@
1
- export declare const routes: Record<string, unknown>;
2
- //# sourceMappingURL=routes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/notifications/routes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,yBAKb,CAAA"}
@@ -1,4 +0,0 @@
1
- export * from './notifications/routes';
2
- export * from './notifications/createNotification';
3
- export * from './notifications/digest';
4
- //# sourceMappingURL=notifications.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../src/notifications.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,oCAAoC,CAAA;AAClD,cAAc,wBAAwB,CAAA"}
@@ -1,127 +0,0 @@
1
- import { models } from "@rpcbase/db";
2
- import { s as sendEmail } from "./email-DEw8keax.js";
3
- const routes = Object.entries({
4
- .../* @__PURE__ */ Object.assign({ "./api/notifications/handler.ts": () => import("./handler-BwK8qxLn.js") })
5
- }).reduce((acc, [path, mod]) => {
6
- acc[path.replace("./api/", "@rpcbase/server/notifications/api/")] = mod;
7
- return acc;
8
- }, {});
9
- const createNotification = async (ctx, input) => {
10
- const userId = input.userId.trim();
11
- const title = input.title.trim();
12
- if (!userId) {
13
- throw new Error("createNotification: userId is required");
14
- }
15
- if (!title) {
16
- throw new Error("createNotification: title is required");
17
- }
18
- const topic = typeof input.topic === "string" ? input.topic.trim() : "";
19
- const body = typeof input.body === "string" ? input.body.trim() : "";
20
- const url = typeof input.url === "string" ? input.url.trim() : "";
21
- const NotificationModel = await models.get("RBNotification", ctx);
22
- const doc = await NotificationModel.create({
23
- userId,
24
- ...topic ? { topic } : {},
25
- title,
26
- ...body ? { body } : {},
27
- ...url ? { url } : {},
28
- ...input.metadata ? { metadata: input.metadata } : {}
29
- });
30
- return { id: doc._id.toString() };
31
- };
32
- const DAY_MS = 24 * 60 * 60 * 1e3;
33
- const WEEK_MS = 7 * DAY_MS;
34
- const getDigestWindowMs = (frequency) => {
35
- if (frequency === "daily") return DAY_MS;
36
- if (frequency === "weekly") return WEEK_MS;
37
- return 0;
38
- };
39
- const formatIso = (value) => {
40
- if (!(value instanceof Date)) return void 0;
41
- return value.toISOString();
42
- };
43
- const buildPreferencesByTopic = (settings) => {
44
- const record = {};
45
- const raw = settings?.topicPreferences;
46
- if (!Array.isArray(raw)) return record;
47
- for (const pref of raw) {
48
- if (!pref || typeof pref !== "object") continue;
49
- const topic = typeof pref.topic === "string" ? pref.topic.trim() : "";
50
- if (!topic) continue;
51
- const emailDigest = pref.emailDigest;
52
- record[topic] = { emailDigest: emailDigest === true };
53
- }
54
- return record;
55
- };
56
- const sendNotificationsDigestForUser = async (ctx, {
57
- userId,
58
- force = false
59
- }) => {
60
- const SettingsModel = await models.get("RBNotificationSettings", ctx);
61
- const NotificationModel = await models.get("RBNotification", ctx);
62
- const settings = await SettingsModel.findOne({ userId }).lean();
63
- const digestFrequencyRaw = typeof settings?.digestFrequency === "string" ? settings.digestFrequency : "weekly";
64
- const digestFrequency = digestFrequencyRaw === "daily" || digestFrequencyRaw === "weekly" || digestFrequencyRaw === "off" ? digestFrequencyRaw : "weekly";
65
- if (digestFrequency === "off") {
66
- return { ok: true, sent: false, skippedReason: "digest_off" };
67
- }
68
- const now = /* @__PURE__ */ new Date();
69
- const windowMs = getDigestWindowMs(digestFrequency);
70
- const lastSentAt = settings?.lastDigestSentAt instanceof Date ? settings.lastDigestSentAt : null;
71
- const since = lastSentAt ?? new Date(now.getTime() - windowMs);
72
- if (!force && lastSentAt && now.getTime() - lastSentAt.getTime() < windowMs) {
73
- return { ok: true, sent: false, skippedReason: "not_due" };
74
- }
75
- const preferencesByTopic = buildPreferencesByTopic(settings);
76
- const disabledTopics = Object.entries(preferencesByTopic).filter(([, pref]) => pref.emailDigest === false).map(([topic]) => topic);
77
- const query = {
78
- userId,
79
- archivedAt: { $exists: false },
80
- readAt: { $exists: false },
81
- createdAt: { $gt: since }
82
- };
83
- if (disabledTopics.length > 0) {
84
- query.topic = { $nin: disabledTopics };
85
- }
86
- const notifications = await NotificationModel.find(query).sort({ createdAt: -1 }).limit(50).lean();
87
- if (!notifications.length) {
88
- await SettingsModel.updateOne(
89
- { userId },
90
- { $set: { lastDigestSentAt: now }, $setOnInsert: { userId, digestFrequency: "weekly" } },
91
- { upsert: true }
92
- );
93
- return { ok: true, sent: false, skippedReason: "empty" };
94
- }
95
- const UserModel = await models.getGlobal("RBUser", ctx);
96
- const user = await UserModel.findById(userId, { email: 1 }).lean();
97
- const email = typeof user?.email === "string" ? user.email.trim() : "";
98
- if (!email) {
99
- return { ok: true, sent: false, skippedReason: "missing_email" };
100
- }
101
- const subject = "Notifications digest";
102
- const rows = notifications.map((n) => {
103
- const title = typeof n.title === "string" ? n.title : "";
104
- const body = typeof n.body === "string" ? n.body : "";
105
- const url = typeof n.url === "string" ? n.url : "";
106
- const createdAt = formatIso(n.createdAt) ?? "";
107
- const line = url ? `<li><strong>${title}</strong><br>${body}<br><a href="${url}">${url}</a><br><small>${createdAt}</small></li>` : `<li><strong>${title}</strong><br>${body}<br><small>${createdAt}</small></li>`;
108
- return line;
109
- }).join("");
110
- const html = `<div><p>Here is your notifications digest:</p><ul>${rows}</ul></div>`;
111
- const emailResult = await sendEmail({ to: email, subject, html });
112
- if (emailResult.error) {
113
- return { ok: false, error: emailResult.error };
114
- }
115
- await SettingsModel.updateOne(
116
- { userId },
117
- { $set: { lastDigestSentAt: now }, $setOnInsert: { userId, digestFrequency: "weekly" } },
118
- { upsert: true }
119
- );
120
- return { ok: true, sent: emailResult.skipped !== true, ...emailResult.skipped ? { skippedReason: "email_skipped" } : {} };
121
- };
122
- export {
123
- createNotification,
124
- routes,
125
- sendNotificationsDigestForUser
126
- };
127
- //# sourceMappingURL=notifications.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notifications.js","sources":["../src/notifications/routes.ts","../src/notifications/createNotification.ts","../src/notifications/digest.ts"],"sourcesContent":["export const routes = Object.entries({\n ...import.meta.glob(\"./api/**/handler.ts\"),\n}).reduce<Record<string, unknown>>((acc, [path, mod]) => {\n acc[path.replace(\"./api/\", \"@rpcbase/server/notifications/api/\")] = mod\n return acc\n}, {})\n\n","import type { Ctx } from \"@rpcbase/api\"\nimport { models } from \"@rpcbase/db\"\n\n\nexport type CreateNotificationInput = {\n userId: string\n topic?: string\n title: string\n body?: string\n url?: string\n metadata?: Record<string, unknown>\n}\n\nexport const createNotification = async (\n ctx: Ctx,\n input: CreateNotificationInput,\n): Promise<{ id: string }> => {\n const userId = input.userId.trim()\n const title = input.title.trim()\n if (!userId) {\n throw new Error(\"createNotification: userId is required\")\n }\n if (!title) {\n throw new Error(\"createNotification: title is required\")\n }\n\n const topic = typeof input.topic === \"string\" ? input.topic.trim() : \"\"\n const body = typeof input.body === \"string\" ? input.body.trim() : \"\"\n const url = typeof input.url === \"string\" ? input.url.trim() : \"\"\n\n const NotificationModel = await models.get(\"RBNotification\", ctx)\n const doc = await NotificationModel.create({\n userId,\n ...(topic ? { topic } : {}),\n title,\n ...(body ? { body } : {}),\n ...(url ? { url } : {}),\n ...(input.metadata ? { metadata: input.metadata } : {}),\n })\n\n return { id: doc._id.toString() }\n}\n","import type { Ctx } from \"@rpcbase/api\"\nimport { models, type IRBNotification, type IRBNotificationSettings } from \"@rpcbase/db\"\n\nimport { sendEmail } from \"../email\"\n\n\nconst DAY_MS = 24 * 60 * 60 * 1000\nconst WEEK_MS = 7 * DAY_MS\n\ntype DigestFrequency = \"off\" | \"daily\" | \"weekly\"\n\ntype NotificationDoc = IRBNotification & { _id: unknown }\ntype SettingsDoc = IRBNotificationSettings & { _id: unknown }\n\nconst getDigestWindowMs = (frequency: DigestFrequency): number => {\n if (frequency === \"daily\") return DAY_MS\n if (frequency === \"weekly\") return WEEK_MS\n return 0\n}\n\nconst formatIso = (value: unknown): string | undefined => {\n if (!(value instanceof Date)) return undefined\n return value.toISOString()\n}\n\nconst buildPreferencesByTopic = (settings: SettingsDoc | null): Record<string, { emailDigest: boolean }> => {\n const record: Record<string, { emailDigest: boolean }> = {}\n const raw = settings?.topicPreferences\n if (!Array.isArray(raw)) return record\n for (const pref of raw) {\n if (!pref || typeof pref !== \"object\") continue\n const topic = typeof (pref as { topic?: unknown }).topic === \"string\" ? (pref as { topic: string }).topic.trim() : \"\"\n if (!topic) continue\n const emailDigest = (pref as { emailDigest?: unknown }).emailDigest\n record[topic] = { emailDigest: emailDigest === true }\n }\n return record\n}\n\nexport const sendNotificationsDigestForUser = async (\n ctx: Ctx,\n {\n userId,\n force = false,\n }: {\n userId: string\n force?: boolean\n },\n): Promise<{ ok: true; sent: boolean; skippedReason?: string } | { ok: false; error: string }> => {\n const SettingsModel = await models.get(\"RBNotificationSettings\", ctx)\n const NotificationModel = await models.get(\"RBNotification\", ctx)\n\n const settings = (await SettingsModel.findOne({ userId }).lean()) as SettingsDoc | null\n\n const digestFrequencyRaw = typeof settings?.digestFrequency === \"string\" ? settings.digestFrequency : \"weekly\"\n const digestFrequency: DigestFrequency =\n digestFrequencyRaw === \"daily\" || digestFrequencyRaw === \"weekly\" || digestFrequencyRaw === \"off\"\n ? digestFrequencyRaw\n : \"weekly\"\n\n if (digestFrequency === \"off\") {\n return { ok: true, sent: false, skippedReason: \"digest_off\" }\n }\n\n const now = new Date()\n const windowMs = getDigestWindowMs(digestFrequency)\n const lastSentAt = settings?.lastDigestSentAt instanceof Date ? settings.lastDigestSentAt : null\n const since = lastSentAt ?? new Date(now.getTime() - windowMs)\n\n if (!force && lastSentAt && now.getTime() - lastSentAt.getTime() < windowMs) {\n return { ok: true, sent: false, skippedReason: \"not_due\" }\n }\n\n const preferencesByTopic = buildPreferencesByTopic(settings)\n const disabledTopics = Object.entries(preferencesByTopic)\n .filter(([, pref]) => pref.emailDigest === false)\n .map(([topic]) => topic)\n\n const query: Record<string, unknown> = {\n userId,\n archivedAt: { $exists: false },\n readAt: { $exists: false },\n createdAt: { $gt: since },\n }\n\n if (disabledTopics.length > 0) {\n query.topic = { $nin: disabledTopics }\n }\n\n const notifications = (await NotificationModel.find(query)\n .sort({ createdAt: -1 })\n .limit(50)\n .lean()) as NotificationDoc[]\n\n if (!notifications.length) {\n await SettingsModel.updateOne(\n { userId },\n { $set: { lastDigestSentAt: now }, $setOnInsert: { userId, digestFrequency: \"weekly\" } },\n { upsert: true },\n )\n return { ok: true, sent: false, skippedReason: \"empty\" }\n }\n\n const UserModel = await models.getGlobal(\"RBUser\", ctx)\n const user = (await UserModel.findById(userId, { email: 1 }).lean()) as { email?: unknown } | null\n const email = typeof user?.email === \"string\" ? user.email.trim() : \"\"\n if (!email) {\n return { ok: true, sent: false, skippedReason: \"missing_email\" }\n }\n\n const subject = \"Notifications digest\"\n const rows = notifications\n .map((n) => {\n const title = typeof n.title === \"string\" ? n.title : \"\"\n const body = typeof n.body === \"string\" ? n.body : \"\"\n const url = typeof n.url === \"string\" ? n.url : \"\"\n const createdAt = formatIso(n.createdAt) ?? \"\"\n const line = url\n ? `<li><strong>${title}</strong><br>${body}<br><a href=\"${url}\">${url}</a><br><small>${createdAt}</small></li>`\n : `<li><strong>${title}</strong><br>${body}<br><small>${createdAt}</small></li>`\n return line\n })\n .join(\"\")\n\n const html = `<div><p>Here is your notifications digest:</p><ul>${rows}</ul></div>`\n\n const emailResult = await sendEmail({ to: email, subject, html })\n if (emailResult.error) {\n return { ok: false, error: emailResult.error }\n }\n\n await SettingsModel.updateOne(\n { userId },\n { $set: { lastDigestSentAt: now }, $setOnInsert: { userId, digestFrequency: \"weekly\" } },\n { upsert: true },\n )\n\n return { ok: true, sent: emailResult.skipped !== true, ...(emailResult.skipped ? { skippedReason: \"email_skipped\" } : {}) }\n}\n"],"names":[],"mappings":";;AAAO,MAAM,SAAS,OAAO,QAAQ;AAAA,EACnC,GAAG,uBAAA,OAAA,EAAA,kCAAA,MAAA,OAAA,uBAAA,EAAA,CAAA;AACL,CAAC,EAAE,OAAgC,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM;AACvD,MAAI,KAAK,QAAQ,UAAU,oCAAoC,CAAC,IAAI;AACpE,SAAO;AACT,GAAG,CAAA,CAAE;ACQE,MAAM,qBAAqB,OAChC,KACA,UAC4B;AAC5B,QAAM,SAAS,MAAM,OAAO,KAAA;AAC5B,QAAM,QAAQ,MAAM,MAAM,KAAA;AAC1B,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,wCAAwC;AAAA,EAC1D;AACA,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,uCAAuC;AAAA,EACzD;AAEA,QAAM,QAAQ,OAAO,MAAM,UAAU,WAAW,MAAM,MAAM,SAAS;AACrE,QAAM,OAAO,OAAO,MAAM,SAAS,WAAW,MAAM,KAAK,SAAS;AAClE,QAAM,MAAM,OAAO,MAAM,QAAQ,WAAW,MAAM,IAAI,SAAS;AAE/D,QAAM,oBAAoB,MAAM,OAAO,IAAI,kBAAkB,GAAG;AAChE,QAAM,MAAM,MAAM,kBAAkB,OAAO;AAAA,IACzC;AAAA,IACA,GAAI,QAAQ,EAAE,MAAA,IAAU,CAAA;AAAA,IACxB;AAAA,IACA,GAAI,OAAO,EAAE,KAAA,IAAS,CAAA;AAAA,IACtB,GAAI,MAAM,EAAE,IAAA,IAAQ,CAAA;AAAA,IACpB,GAAI,MAAM,W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A;AAC7D,QAAM,QAAQ,OAAO,MAAM,UAAU,WAAW,KAAK,MAAM,SAAS;AACpE,MAAI,CAAC,OAAO;AACV,WAAO,EAAE,IAAI,MAAM,MAAM,OAAO,eAAe,gBAAA;AAAA,EACjD;AAEA,QAAM,UAAU;AAChB,QAAM,OAAO,cACV,IAAI,CAAC,MAAM;AACV,UAAM,QAAQ,OAAO,EAAE,UAAU,WAAW,EAAE,QAAQ;AACtD,UAAM,OAAO,OAAO,EAAE,SAAS,WAAW,EAAE,OAAO;AACnD,UAAM,MAAM,OAAO,EAAE,QAAQ,WAAW,EAAE,MAAM;AAChD,UAAM,YAAY,UAAU,EAAE,SAAS,KAAK;AAC5C,UAAM,OAAO,MACT,eAAe,KAAK,gBAAgB,IAAI,gBAAgB,GAAG,KAAK,GAAG,kBAAkB,SAAS,kBAC9F,eAAe,KAAK,gBAAgB,IAAI,cAAc,SAAS;AACnE,WAAO;AAAA,EACT,CAAC,EACA,KAAK,EAAE;AAEV,QAAM,OAAO,qDAAqD,IAAI;AAEtE,QAAM,cAAc,MAAM,UAAU,EAAE,IAAI,OAAO,SAAS,MAAM;AAChE,MAAI,YAAY,OAAO;AACrB,WAAO,EAAE,IAAI,OAAO,OAAO,YAAY,MAAA;AAAA,EACzC;AAEA,QAAM,cAAc;AAAA,IAClB,EAAE,OAAA;AAAA,IACF,EAAE,MAAM,EAAE,kBAAkB,IAAA,GAAO,cAAc,EAAE,QAAQ,iBAAiB,WAAS;AAAA,IACrF,EAAE,QAAQ,KAAA;AAAA,EAAK;AAGjB,SAAO,EAAE,IAAI,MAAM,MAAM,YAAY,YAAY,MAAM,GAAI,YAAY,UAAU,EAAE,eAAe,gBAAA,IAAoB,CAAA,EAAC;AACzH;"}
@@ -1,11 +0,0 @@
1
- export type HashPasswordForStorageOptions = Partial<{
2
- N: number;
3
- r: number;
4
- p: number;
5
- keylen: number;
6
- saltBytes: number;
7
- maxmemBytes: number;
8
- }>;
9
- export declare function hashPasswordForStorage(password: string, opts?: HashPasswordForStorageOptions): Promise<string>;
10
- export declare function verifyPasswordFromStorage(password: string, stored: string): Promise<boolean>;
11
- //# sourceMappingURL=passwordHashStorage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"passwordHashStorage.d.ts","sourceRoot":"","sources":["../src/passwordHashStorage.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,6BAA6B,GAAG,OAAO,CAAC;IAClD,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAC,CAAA;AA4MF,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,6BAA6B,GAAG,OAAO,CAAC,MAAM,CAAC,CAUpH;AAED,wBAAsB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAiBlG"}
package/dist/posthog.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { Application } from 'express';
2
- import { PostHog } from 'posthog-node';
3
- type ServerEnv = Record<string, string | undefined>;
4
- export declare const getPosthogClient: (env: ServerEnv) => PostHog | null;
5
- export declare const bindExpressErrorHandler: (app: Application, posthog: PostHog | null) => void;
6
- export declare const captureServerException: (error: unknown, posthog?: PostHog | null, properties?: Record<string, unknown>) => void;
7
- export declare const ensurePosthogShutdown: () => void;
8
- export {};
9
- //# sourceMappingURL=posthog.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"posthog.d.ts","sourceRoot":"","sources":["../src/posthog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,OAAO,EAA4B,MAAM,cAAc,CAAA;AAGhE,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;AAenD,eAAO,MAAM,gBAAgB,GAAI,KAAK,SAAS,KAAG,OAAO,GAAG,IAkB3D,CAAA;AAED,eAAO,MAAM,uBAAuB,GAAI,KAAK,WAAW,EAAE,SAAS,OAAO,GAAG,IAAI,SAGhF,CAAA;AAED,eAAO,MAAM,sBAAsB,GACjC,OAAO,OAAO,EACd,UAAU,OAAO,GAAG,IAAI,EACxB,aAAa,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,SAOrC,CAAA;AAWD,eAAO,MAAM,qBAAqB,YAWjC,CAAA"}
@@ -1,12 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { StaticHandler } from '@rpcbase/router';
3
- import * as express from "express";
4
- export declare function renderSSR(req: express.Request, dataRoutes: StaticHandler["dataRoutes"]): Promise<{
5
- element: ReactNode | null;
6
- isMatched: boolean;
7
- statusCode: number;
8
- redirectResponse?: Response;
9
- redirectRouteId?: string | null;
10
- redirectRoutePath?: string | null;
11
- }>;
12
- //# sourceMappingURL=renderSSR.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderSSR.d.ts","sourceRoot":"","sources":["../src/renderSSR.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,SAAS,EAAc,MAAM,OAAO,CAAA;AAC7C,OAAO,EAGL,aAAa,EACd,MAAM,iBAAiB,CAAA;AAOxB,wBAAsB,SAAS,CAC7B,GAAG,EAAE,OAAO,CAAC,OAAO,EACpB,UAAU,EAAE,aAAa,CAAC,YAAY,CAAC,GACtC,OAAO,CAAC;IACT,OAAO,EAAE,SAAS,GAAG,IAAI,CAAA;IACzB,SAAS,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,CAAC,EAAE,QAAQ,CAAA;IAC3B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAClC,CAAC,CAwED"}
@@ -1,6 +0,0 @@
1
- const render_resend_false = {};
2
- throw new Error(`Could not resolve "@react-email/render" imported by "resend".`);
3
- export {
4
- render_resend_false as default
5
- };
6
- //# sourceMappingURL=render_resend_false-MiC__Smr.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render_resend_false-MiC__Smr.js","sources":["../__vite-optional-peer-dep:@react-email/render:resend:false"],"sourcesContent":["export default {};throw new Error(`Could not resolve \"@react-email/render\" imported by \"resend\".`)"],"names":[],"mappings":"AAAA,MAAA,sBAAe,CAAA;AAAG,MAAM,IAAI,MAAM,+DAA+D;"}
@@ -1,9 +0,0 @@
1
- import { Api } from '@rpcbase/api';
2
- type SessionUser = {
3
- id?: string;
4
- currentTenantId?: string;
5
- signedInTenants?: string[];
6
- };
7
- declare const _default: (api: Api<SessionUser>) => void;
8
- export default _default;
9
- //# sourceMappingURL=handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/rts/api/changes/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAmB,MAAM,cAAc,CAAA;AAQnD,KAAK,WAAW,GAAG;IACjB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;CAC3B,CAAA;yBAuIe,KAAK,GAAG,CAAC,WAAW,CAAC;AAArC,wBAEC"}
@@ -1,25 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const Route = "/api/rb/rts/changes";
3
- export declare const requestSchema: z.ZodObject<{
4
- sinceSeq: z.ZodDefault<z.ZodNumber>;
5
- limit: z.ZodDefault<z.ZodNumber>;
6
- modelNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
7
- }, z.core.$strip>;
8
- export type RequestPayload = z.infer<typeof requestSchema>;
9
- export declare const responseSchema: z.ZodObject<{
10
- ok: z.ZodBoolean;
11
- needsFullResync: z.ZodOptional<z.ZodBoolean>;
12
- earliestSeq: z.ZodOptional<z.ZodNumber>;
13
- latestSeq: z.ZodNumber;
14
- changes: z.ZodArray<z.ZodObject<{
15
- seq: z.ZodNumber;
16
- modelName: z.ZodString;
17
- op: z.ZodEnum<{
18
- delete: "delete";
19
- reset_model: "reset_model";
20
- }>;
21
- docId: z.ZodOptional<z.ZodString>;
22
- }, z.core.$strip>>;
23
- }, z.core.$strip>;
24
- export type ResponsePayload = z.infer<typeof responseSchema>;
25
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rts/api/changes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,KAAK,wBAAwB,CAAA;AAE1C,eAAO,MAAM,aAAa;;;;iBAIxB,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAE1D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;iBAWzB,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA"}
@@ -1,40 +0,0 @@
1
- import { Server as HttpServer } from 'node:http';
2
- import { RequestHandler } from 'express';
3
- import { AppAbility } from '@rpcbase/db/acl';
4
- import { WebSocket } from 'ws';
5
- type SocketMeta = {
6
- tenantId: string;
7
- userId: string;
8
- ability: AppAbility;
9
- };
10
- type HandlerFn = (socket: RtsSocket) => void | (() => void);
11
- declare class RtsSocket {
12
- readonly id: string;
13
- readonly tenantId: string;
14
- readonly userId: string;
15
- private readonly ws;
16
- private readonly handlers;
17
- constructor({ id, ws, meta, }: {
18
- id: string;
19
- ws: WebSocket;
20
- meta: SocketMeta;
21
- });
22
- on(event: string, handler: (payload: unknown) => void): () => void;
23
- off(event: string, handler: (payload: unknown) => void): void;
24
- emit(event: string, payload?: unknown): void;
25
- close(): void;
26
- dispatch(event: string, payload: unknown): void;
27
- }
28
- export declare const initRts: ({ server, path, sessionMiddleware, maxPayloadBytes: maxPayloadBytesArg, maxSubscriptionsPerSocket: maxSubscriptionsPerSocketArg, dispatchDebounceMs: dispatchDebounceMsArg, allowInternalModels: allowInternalModelsArg, }: {
29
- server: HttpServer;
30
- path?: string;
31
- sessionMiddleware?: RequestHandler;
32
- maxPayloadBytes?: number;
33
- maxSubscriptionsPerSocket?: number;
34
- dispatchDebounceMs?: number;
35
- allowInternalModels?: boolean;
36
- }) => void;
37
- export declare const registerRtsHandler: (handler: HandlerFn) => void;
38
- export declare const notifyRtsModelChanged: (tenantId: string, modelName: string) => void;
39
- export * from './routes';
40
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rts/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,MAAM,IAAI,UAAU,EAAE,MAAM,WAAW,CAAA;AAGtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,OAAO,EAAmH,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAGlK,OAAO,EAAiC,KAAK,SAAS,EAAE,MAAM,IAAI,CAAA;AAqBlE,KAAK,UAAU,GAAG;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,UAAU,CAAA;CACpB,CAAA;AAoBD,KAAK,SAAS,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAA;AAiC3D,cAAM,SAAS;IACb,SAAgB,EAAE,EAAE,MAAM,CAAA;IAC1B,SAAgB,QAAQ,EAAE,MAAM,CAAA;IAChC,SAAgB,MAAM,EAAE,MAAM,CAAA;IAE9B,OAAO,CAAC,QAAQ,C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