@rpcbase/server 0.566.0 → 0.567.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 (99) hide show
  1. package/dist/applyRouteLoaders.d.ts +9 -0
  2. package/dist/applyRouteLoaders.d.ts.map +1 -0
  3. package/dist/checkInitReplicaSet.d.ts +6 -0
  4. package/dist/checkInitReplicaSet.d.ts.map +1 -0
  5. package/dist/dev/coverage.d.ts +3 -0
  6. package/dist/dev/coverage.d.ts.map +1 -0
  7. package/dist/email.d.ts +19 -0
  8. package/dist/email.d.ts.map +1 -0
  9. package/dist/getDerivedKey.d.ts +3 -0
  10. package/dist/getDerivedKey.d.ts.map +1 -0
  11. package/dist/hashPassword.d.ts +2 -0
  12. package/dist/hashPassword.d.ts.map +1 -0
  13. package/dist/index.d.ts +7 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/initServer.d.ts +9 -0
  16. package/dist/initServer.d.ts.map +1 -0
  17. package/dist/metricsIngestProxyMiddleware.d.ts +3 -0
  18. package/dist/metricsIngestProxyMiddleware.d.ts.map +1 -0
  19. package/dist/notifications/api/notifications/handler.d.ts +4 -0
  20. package/dist/notifications/api/notifications/handler.d.ts.map +1 -0
  21. package/dist/notifications/api/notifications/index.d.ts +224 -0
  22. package/dist/notifications/api/notifications/index.d.ts.map +1 -0
  23. package/dist/notifications/api/notifications/shared.d.ts +6 -0
  24. package/dist/notifications/api/notifications/shared.d.ts.map +1 -0
  25. package/dist/notifications/createNotification.d.ts +31 -0
  26. package/dist/notifications/createNotification.d.ts.map +1 -0
  27. package/dist/notifications/digest.d.ts +15 -0
  28. package/dist/notifications/digest.d.ts.map +1 -0
  29. package/dist/notifications/routes.d.ts +2 -0
  30. package/dist/notifications/routes.d.ts.map +1 -0
  31. package/dist/notifications.d.ts +4 -0
  32. package/dist/notifications.d.ts.map +1 -0
  33. package/dist/passwordHashStorage.d.ts +11 -0
  34. package/dist/passwordHashStorage.d.ts.map +1 -0
  35. package/dist/posthog.d.ts +11 -0
  36. package/dist/posthog.d.ts.map +1 -0
  37. package/dist/proxyAuth.d.ts +17 -0
  38. package/dist/proxyAuth.d.ts.map +1 -0
  39. package/dist/renderSSR.d.ts +15 -0
  40. package/dist/renderSSR.d.ts.map +1 -0
  41. package/dist/rts/api/changes/handler.d.ts +9 -0
  42. package/dist/rts/api/changes/handler.d.ts.map +1 -0
  43. package/dist/rts/api/changes/index.d.ts +25 -0
  44. package/dist/rts/api/changes/index.d.ts.map +1 -0
  45. package/dist/rts/index.d.ts +52 -0
  46. package/dist/rts/index.d.ts.map +1 -0
  47. package/dist/rts/queryExecutor.d.ts +60 -0
  48. package/dist/rts/queryExecutor.d.ts.map +1 -0
  49. package/dist/rts/routes.d.ts +2 -0
  50. package/dist/rts/routes.d.ts.map +1 -0
  51. package/dist/rts/ssrHydration.d.ts +14 -0
  52. package/dist/rts/ssrHydration.d.ts.map +1 -0
  53. package/dist/ssrMiddleware.d.ts +18 -0
  54. package/dist/ssrMiddleware.d.ts.map +1 -0
  55. package/dist/syncAuthenticatedSession.d.ts +18 -0
  56. package/dist/syncAuthenticatedSession.d.ts.map +1 -0
  57. package/dist/types/index.d.ts +6 -0
  58. package/dist/types/index.d.ts.map +1 -0
  59. package/dist/uploads/api/file-uploads/handler.d.ts +5 -0
  60. package/dist/uploads/api/file-uploads/handler.d.ts.map +1 -0
  61. package/dist/uploads/api/file-uploads/handlers/completeUpload.d.ts +5 -0
  62. package/dist/uploads/api/file-uploads/handlers/completeUpload.d.ts.map +1 -0
  63. package/dist/uploads/api/file-uploads/handlers/getStatus.d.ts +5 -0
  64. package/dist/uploads/api/file-uploads/handlers/getStatus.d.ts.map +1 -0
  65. package/dist/uploads/api/file-uploads/handlers/initUpload.d.ts +5 -0
  66. package/dist/uploads/api/file-uploads/handlers/initUpload.d.ts.map +1 -0
  67. package/dist/uploads/api/file-uploads/handlers/uploadChunk.d.ts +9 -0
  68. package/dist/uploads/api/file-uploads/handlers/uploadChunk.d.ts.map +1 -0
  69. package/dist/uploads/api/file-uploads/imageVariantsPostProcessor.d.ts +2 -0
  70. package/dist/uploads/api/file-uploads/imageVariantsPostProcessor.d.ts.map +1 -0
  71. package/dist/uploads/api/file-uploads/index.d.ts +43 -0
  72. package/dist/uploads/api/file-uploads/index.d.ts.map +1 -0
  73. package/dist/uploads/api/file-uploads/middleware/rawBodyParser.d.ts +5 -0
  74. package/dist/uploads/api/file-uploads/middleware/rawBodyParser.d.ts.map +1 -0
  75. package/dist/uploads/api/file-uploads/postProcessors.d.ts +33 -0
  76. package/dist/uploads/api/file-uploads/postProcessors.d.ts.map +1 -0
  77. package/dist/uploads/api/file-uploads/processors/convertHeifToWebp.d.ts +32 -0
  78. package/dist/uploads/api/file-uploads/processors/convertHeifToWebp.d.ts.map +1 -0
  79. package/dist/uploads/api/file-uploads/processors/index.d.ts +29 -0
  80. package/dist/uploads/api/file-uploads/processors/index.d.ts.map +1 -0
  81. package/dist/uploads/api/file-uploads/processors/sanitizeSvg.d.ts +5 -0
  82. package/dist/uploads/api/file-uploads/processors/sanitizeSvg.d.ts.map +1 -0
  83. package/dist/uploads/api/file-uploads/shared.d.ts +32 -0
  84. package/dist/uploads/api/file-uploads/shared.d.ts.map +1 -0
  85. package/dist/uploads/api/files/handler.d.ts +4 -0
  86. package/dist/uploads/api/files/handler.d.ts.map +1 -0
  87. package/dist/uploads/api/files/handlers/deleteFile.d.ts +9 -0
  88. package/dist/uploads/api/files/handlers/deleteFile.d.ts.map +1 -0
  89. package/dist/uploads/api/files/handlers/getFile.d.ts +4 -0
  90. package/dist/uploads/api/files/handlers/getFile.d.ts.map +1 -0
  91. package/dist/uploads/api/files/index.d.ts +4 -0
  92. package/dist/uploads/api/files/index.d.ts.map +1 -0
  93. package/dist/uploads/routes.d.ts +2 -0
  94. package/dist/uploads/routes.d.ts.map +1 -0
  95. package/dist/uploads/worker.d.ts +2 -0
  96. package/dist/uploads/worker.d.ts.map +1 -0
  97. package/dist/uploads.d.ts +3 -0
  98. package/dist/uploads.d.ts.map +1 -0
  99. package/package.json +13 -1
@@ -0,0 +1,9 @@
1
+ import { Request as ExpressRequest, Response as ExpressResponse } from 'express';
2
+ import { StaticHandlerContext } from '@rpcbase/router';
3
+ export type RouterContextWithRedirect = StaticHandlerContext & {
4
+ redirectResponse?: Response;
5
+ redirectRouteId?: string | null;
6
+ redirectRoutePath?: string | null;
7
+ };
8
+ export declare function applyRouteLoaders(req: ExpressRequest, res: ExpressResponse, dataRoutes: any[]): Promise<RouterContextWithRedirect>;
9
+ //# sourceMappingURL=applyRouteLoaders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applyRouteLoaders.d.ts","sourceRoot":"","sources":["../src/applyRouteLoaders.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,SAAS,CAAA;AAChF,OAAO,EACL,oBAAoB,EAMrB,MAAM,iBAAiB,CAAA;AAmHxB,MAAM,MAAM,yBAAyB,GAAG,oBAAoB,GAAG;IAC7D,gBAAgB,CAAC,EAAE,QAAQ,CAAA;IAC3B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAClC,CAAA;AAED,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,eAAe,EACpB,UAAU,EAAE,GAAG,EAAE,GAChB,OAAO,CAAC,yBAAyB,CAAC,CA8MpC"}
@@ -0,0 +1,6 @@
1
+ type ServerEnv = {
2
+ [key: string]: string | undefined;
3
+ };
4
+ export declare const checkInitReplicaSet: (serverEnv: ServerEnv) => Promise<void>;
5
+ export {};
6
+ //# sourceMappingURL=checkInitReplicaSet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkInitReplicaSet.d.ts","sourceRoot":"","sources":["../src/checkInitReplicaSet.ts"],"names":[],"mappings":"AAGA,KAAK,SAAS,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAAE,CAAA;AAMtD,eAAO,MAAM,mBAAmB,GAAU,WAAW,SAAS,KAAG,OAAO,CAAC,IAAI,CAiH5E,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { Application } from 'express';
2
+ export declare function registerDevCoverageEndpoints(app: Application): void;
3
+ //# sourceMappingURL=coverage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../src/dev/coverage.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAwP1C,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CA8HnE"}
@@ -0,0 +1,19 @@
1
+ type SendEmailParams = {
2
+ to: string | string[];
3
+ subject: string;
4
+ html?: string;
5
+ text?: string;
6
+ from?: string;
7
+ replyTo?: string | string[];
8
+ };
9
+ export declare const sendEmail: (params: SendEmailParams) => Promise<{
10
+ id: undefined;
11
+ skipped: boolean;
12
+ error?: undefined;
13
+ } | {
14
+ id: string | undefined;
15
+ error: string | undefined;
16
+ skipped: boolean;
17
+ }>;
18
+ export {};
19
+ //# sourceMappingURL=email.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../src/email.ts"],"names":[],"mappings":"AAGA,KAAK,eAAe,GAAG;IACrB,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7B,CAAA;AAKD,eAAO,MAAM,SAAS,GAAS,QAAQ,eAAe;;;;;;;;EAsBrD,CAAA"}
@@ -0,0 +1,3 @@
1
+ export declare const getDerivedKey: (masterKey: string, info: string, length?: number, // Default to 256-bit keys
2
+ salt?: string) => string;
3
+ //# sourceMappingURL=getDerivedKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDerivedKey.d.ts","sourceRoot":"","sources":["../src/getDerivedKey.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,GACxB,WAAW,MAAM,EACjB,MAAM,MAAM,EACZ,SAAQ,MAAW,EAAE,0BAA0B;AAC/C,OAAM,MAAW,KAChB,MAUF,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare function hashPassword(password: string, salt: string): Promise<Buffer>;
2
+ //# sourceMappingURL=hashPassword.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hashPassword.d.ts","sourceRoot":"","sources":["../src/hashPassword.ts"],"names":[],"mappings":"AAGA,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBlF"}
@@ -0,0 +1,7 @@
1
+ export * from './initServer';
2
+ export * from './getDerivedKey';
3
+ export * from './hashPassword';
4
+ export * from './passwordHashStorage';
5
+ export * from './ssrMiddleware';
6
+ export * from './email';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA"}
@@ -0,0 +1,9 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initServer.d.ts","sourceRoot":"","sources":["../src/initServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AA4BrC,KAAK,SAAS,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAAE,CAAA;AA0EtD,eAAO,MAAM,UAAU,GAAU,KAAK,WAAW,EAAE,WAAW,SAAS;;EAiFtE,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { Application } from 'express';
2
+ export declare const metricsIngestProxyMiddleware: (app: Application) => void;
3
+ //# sourceMappingURL=metricsIngestProxyMiddleware.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,4 @@
1
+ import { Api } from '@rpcbase/api';
2
+ declare const _default: (api: Api) => void;
3
+ export default _default;
4
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/notifications/api/notifications/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAA6B,MAAM,cAAc,CAAA;yBAymB7C,KAAK,GAAG;AAAxB,wBAUC"}
@@ -0,0 +1,224 @@
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 MarkReadByUrlRoute = "/api/rb/notifications/mark-read-by-url";
6
+ export declare const ArchiveRoute = "/api/rb/notifications/:notificationId/archive";
7
+ export declare const MarkAllReadRoute = "/api/rb/notifications/mark-all-read";
8
+ export declare const SettingsRoute = "/api/rb/notifications/settings";
9
+ export declare const DigestRunRoute = "/api/rb/notifications/digest/run";
10
+ export declare const listRequestSchema: z.ZodObject<{
11
+ includeArchived: z.ZodOptional<z.ZodBoolean>;
12
+ unreadOnly: z.ZodOptional<z.ZodBoolean>;
13
+ limit: z.ZodOptional<z.ZodNumber>;
14
+ markSeen: z.ZodOptional<z.ZodBoolean>;
15
+ }, z.core.$strip>;
16
+ export type ListRequestPayload = z.infer<typeof listRequestSchema>;
17
+ export declare const notificationDataSchema: z.ZodRecord<z.ZodString, z.ZodString>;
18
+ export declare const notificationPlatformPayloadSchema: z.ZodObject<{
19
+ webpush: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
20
+ fcmOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
21
+ android: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
22
+ apns: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
23
+ }, z.core.$loose>;
24
+ export type NotificationPlatformPayload = z.infer<typeof notificationPlatformPayloadSchema>;
25
+ declare const notificationUrlModeSchema: z.ZodEnum<{
26
+ navigate: "navigate";
27
+ merge_current_search: "merge_current_search";
28
+ }>;
29
+ export declare const notificationContentFieldsSchema: z.ZodObject<{
30
+ title: z.ZodString;
31
+ body: z.ZodOptional<z.ZodString>;
32
+ image: z.ZodOptional<z.ZodString>;
33
+ }, z.core.$strip>;
34
+ export declare const createRequestSchema: z.ZodObject<{
35
+ topic: z.ZodOptional<z.ZodString>;
36
+ title: z.ZodString;
37
+ body: z.ZodOptional<z.ZodString>;
38
+ image: z.ZodOptional<z.ZodString>;
39
+ url: z.ZodOptional<z.ZodString>;
40
+ urlMode: z.ZodOptional<z.ZodEnum<{
41
+ navigate: "navigate";
42
+ merge_current_search: "merge_current_search";
43
+ }>>;
44
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
45
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
46
+ platform: z.ZodOptional<z.ZodObject<{
47
+ webpush: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
48
+ fcmOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
49
+ android: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
50
+ apns: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
51
+ }, z.core.$loose>>;
52
+ }, z.core.$strip>;
53
+ export type CreateRequestPayload = z.infer<typeof createRequestSchema>;
54
+ export declare const normalizeNotificationActionUrl: (url: string, origin: string) => string | null;
55
+ export declare const normalizeNotificationActionLink: (url: string, origin: string, urlMode?: z.infer<typeof notificationUrlModeSchema>) => string | null;
56
+ export declare const notificationSchema: z.ZodObject<{
57
+ id: z.ZodString;
58
+ topic: z.ZodOptional<z.ZodString>;
59
+ title: z.ZodString;
60
+ body: z.ZodOptional<z.ZodString>;
61
+ image: z.ZodOptional<z.ZodString>;
62
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
63
+ platform: z.ZodOptional<z.ZodObject<{
64
+ webpush: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
65
+ fcmOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
66
+ android: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
67
+ apns: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
68
+ }, z.core.$loose>>;
69
+ createdAt: z.ZodString;
70
+ seenAt: z.ZodOptional<z.ZodString>;
71
+ readAt: z.ZodOptional<z.ZodString>;
72
+ archivedAt: z.ZodOptional<z.ZodString>;
73
+ }, z.core.$strip>;
74
+ export type NotificationPayload = z.infer<typeof notificationSchema>;
75
+ export declare const listResponseSchema: z.ZodObject<{
76
+ ok: z.ZodBoolean;
77
+ error: z.ZodOptional<z.ZodString>;
78
+ notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
79
+ id: z.ZodString;
80
+ topic: z.ZodOptional<z.ZodString>;
81
+ title: z.ZodString;
82
+ body: z.ZodOptional<z.ZodString>;
83
+ image: z.ZodOptional<z.ZodString>;
84
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
85
+ platform: z.ZodOptional<z.ZodObject<{
86
+ webpush: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
87
+ fcmOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
88
+ android: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
89
+ apns: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
90
+ }, z.core.$loose>>;
91
+ createdAt: z.ZodString;
92
+ seenAt: z.ZodOptional<z.ZodString>;
93
+ readAt: z.ZodOptional<z.ZodString>;
94
+ archivedAt: z.ZodOptional<z.ZodString>;
95
+ }, z.core.$strip>>>;
96
+ unreadCount: z.ZodOptional<z.ZodNumber>;
97
+ unseenCount: z.ZodOptional<z.ZodNumber>;
98
+ }, z.core.$strip>;
99
+ export type ListResponsePayload = z.infer<typeof listResponseSchema>;
100
+ export declare const createResponseSchema: z.ZodObject<{
101
+ ok: z.ZodBoolean;
102
+ error: z.ZodOptional<z.ZodString>;
103
+ id: z.ZodOptional<z.ZodString>;
104
+ }, z.core.$strip>;
105
+ export type CreateResponsePayload = z.infer<typeof createResponseSchema>;
106
+ export declare const markReadResponseSchema: z.ZodObject<{
107
+ ok: z.ZodBoolean;
108
+ error: z.ZodOptional<z.ZodString>;
109
+ }, z.core.$strip>;
110
+ export type MarkReadResponsePayload = z.infer<typeof markReadResponseSchema>;
111
+ export declare const markReadByUrlRequestSchema: z.ZodObject<{
112
+ url: z.ZodString;
113
+ }, z.core.$strip>;
114
+ export type MarkReadByUrlRequestPayload = z.infer<typeof markReadByUrlRequestSchema>;
115
+ export declare const markReadByUrlResponseSchema: z.ZodObject<{
116
+ ok: z.ZodBoolean;
117
+ error: z.ZodOptional<z.ZodString>;
118
+ matchedCount: z.ZodOptional<z.ZodNumber>;
119
+ modifiedCount: z.ZodOptional<z.ZodNumber>;
120
+ }, z.core.$strip>;
121
+ export type MarkReadByUrlResponsePayload = z.infer<typeof markReadByUrlResponseSchema>;
122
+ export declare const archiveResponseSchema: z.ZodObject<{
123
+ ok: z.ZodBoolean;
124
+ error: z.ZodOptional<z.ZodString>;
125
+ }, z.core.$strip>;
126
+ export type ArchiveResponsePayload = z.infer<typeof archiveResponseSchema>;
127
+ export declare const markAllReadResponseSchema: z.ZodObject<{
128
+ ok: z.ZodBoolean;
129
+ error: z.ZodOptional<z.ZodString>;
130
+ }, z.core.$strip>;
131
+ export type MarkAllReadResponsePayload = z.infer<typeof markAllReadResponseSchema>;
132
+ export declare const digestFrequencySchema: z.ZodEnum<{
133
+ off: "off";
134
+ daily: "daily";
135
+ weekly: "weekly";
136
+ }>;
137
+ export type DigestFrequency = z.infer<typeof digestFrequencySchema>;
138
+ export declare const topicPreferenceSchema: z.ZodObject<{
139
+ topic: z.ZodString;
140
+ inApp: z.ZodBoolean;
141
+ emailDigest: z.ZodBoolean;
142
+ push: z.ZodBoolean;
143
+ }, z.core.$strip>;
144
+ export type TopicPreferencePayload = z.infer<typeof topicPreferenceSchema>;
145
+ export declare const settingsSchema: z.ZodObject<{
146
+ digestFrequency: z.ZodEnum<{
147
+ off: "off";
148
+ daily: "daily";
149
+ weekly: "weekly";
150
+ }>;
151
+ topicPreferences: z.ZodArray<z.ZodObject<{
152
+ topic: z.ZodString;
153
+ inApp: z.ZodBoolean;
154
+ emailDigest: z.ZodBoolean;
155
+ push: z.ZodBoolean;
156
+ }, z.core.$strip>>;
157
+ lastDigestSentAt: z.ZodOptional<z.ZodString>;
158
+ }, z.core.$strip>;
159
+ export type SettingsPayload = z.infer<typeof settingsSchema>;
160
+ export declare const settingsResponseSchema: z.ZodObject<{
161
+ ok: z.ZodBoolean;
162
+ error: z.ZodOptional<z.ZodString>;
163
+ settings: z.ZodOptional<z.ZodObject<{
164
+ digestFrequency: z.ZodEnum<{
165
+ off: "off";
166
+ daily: "daily";
167
+ weekly: "weekly";
168
+ }>;
169
+ topicPreferences: z.ZodArray<z.ZodObject<{
170
+ topic: z.ZodString;
171
+ inApp: z.ZodBoolean;
172
+ emailDigest: z.ZodBoolean;
173
+ push: z.ZodBoolean;
174
+ }, z.core.$strip>>;
175
+ lastDigestSentAt: z.ZodOptional<z.ZodString>;
176
+ }, z.core.$strip>>;
177
+ }, z.core.$strip>;
178
+ export type SettingsResponsePayload = z.infer<typeof settingsResponseSchema>;
179
+ export declare const updateSettingsRequestSchema: z.ZodObject<{
180
+ digestFrequency: z.ZodOptional<z.ZodEnum<{
181
+ off: "off";
182
+ daily: "daily";
183
+ weekly: "weekly";
184
+ }>>;
185
+ topicPreferences: z.ZodOptional<z.ZodArray<z.ZodObject<{
186
+ topic: z.ZodString;
187
+ inApp: z.ZodBoolean;
188
+ emailDigest: z.ZodBoolean;
189
+ push: z.ZodBoolean;
190
+ }, z.core.$strip>>>;
191
+ }, z.core.$strip>;
192
+ export type UpdateSettingsRequestPayload = z.infer<typeof updateSettingsRequestSchema>;
193
+ export declare const updateSettingsResponseSchema: z.ZodObject<{
194
+ ok: z.ZodBoolean;
195
+ error: z.ZodOptional<z.ZodString>;
196
+ settings: z.ZodOptional<z.ZodObject<{
197
+ digestFrequency: z.ZodEnum<{
198
+ off: "off";
199
+ daily: "daily";
200
+ weekly: "weekly";
201
+ }>;
202
+ topicPreferences: z.ZodArray<z.ZodObject<{
203
+ topic: z.ZodString;
204
+ inApp: z.ZodBoolean;
205
+ emailDigest: z.ZodBoolean;
206
+ push: z.ZodBoolean;
207
+ }, z.core.$strip>>;
208
+ lastDigestSentAt: z.ZodOptional<z.ZodString>;
209
+ }, z.core.$strip>>;
210
+ }, z.core.$strip>;
211
+ export type UpdateSettingsResponsePayload = z.infer<typeof updateSettingsResponseSchema>;
212
+ export declare const digestRunRequestSchema: z.ZodObject<{
213
+ force: z.ZodOptional<z.ZodBoolean>;
214
+ }, z.core.$strip>;
215
+ export type DigestRunRequestPayload = z.infer<typeof digestRunRequestSchema>;
216
+ export declare const digestRunResponseSchema: z.ZodObject<{
217
+ ok: z.ZodBoolean;
218
+ error: z.ZodOptional<z.ZodString>;
219
+ sent: z.ZodOptional<z.ZodBoolean>;
220
+ skippedReason: z.ZodOptional<z.ZodString>;
221
+ }, z.core.$strip>;
222
+ export type DigestRunResponsePayload = z.infer<typeof digestRunResponseSchema>;
223
+ export {};
224
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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,kBAAkB,2CAA2C,CAAA;AAC1E,eAAO,MAAM,YAAY,kDAAkD,CAAA;AAC3E,eAAO,MAAM,gBAAgB,wCAAwC,CAAA;AACrE,eAAO,MAAM,aAAa,mCAAmC,CAAA;AAC7D,eAAO,MAAM,cAAc,qCAAqC,CAAA;AAEhE,eAAO,MAAM,iBAAiB;;;;;iBAK5B,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAElE,eAAO,MAAM,sBAAsB,uCAAmC,CAAA;AAEtE,eAAO,MAAM,iCAAiC;;;;;iBAK9B,CAAA;AAEhB,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,C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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"}
@@ -0,0 +1,6 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,31 @@
1
+ import { Ctx } from '@rpcbase/api';
2
+ import { IRBNotificationPlatformPayload } from '@rpcbase/db';
3
+ import { AppAbility } from '@rpcbase/db/acl';
4
+ export type NotificationDataPayload = Record<string, string>;
5
+ export type NotificationMetadataPayload = Record<string, unknown>;
6
+ export type NotificationPlatformPayload = IRBNotificationPlatformPayload;
7
+ export type NotificationUrlMode = "navigate" | "merge_current_search";
8
+ export type CreateNotificationInput = {
9
+ userId: string;
10
+ topic?: string;
11
+ title: string;
12
+ body?: string;
13
+ image?: string;
14
+ url?: string;
15
+ urlMode?: NotificationUrlMode;
16
+ metadata?: NotificationMetadataPayload;
17
+ data?: NotificationDataPayload;
18
+ platform?: NotificationPlatformPayload;
19
+ };
20
+ export type CreateNotificationForUserInput = Omit<CreateNotificationInput, "userId">;
21
+ export type CreateNotificationsForUserInput = {
22
+ userId: string;
23
+ notifications: CreateNotificationForUserInput[];
24
+ };
25
+ export declare const createNotification: (ctx: Ctx, input: CreateNotificationInput, ability: AppAbility) => Promise<{
26
+ id: string;
27
+ }>;
28
+ export declare const createNotificationsForUser: (ctx: Ctx, input: CreateNotificationsForUserInput, ability: AppAbility) => Promise<{
29
+ ids: string[];
30
+ }>;
31
+ //# sourceMappingURL=createNotification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createNotification.d.ts","sourceRoot":"","sources":["../../src/notifications/createNotification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAU,KAAK,8BAA8B,EAAE,MAAM,aAAa,CAAA;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAGjD,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAC5D,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AACjE,MAAM,MAAM,2BAA2B,GAAG,8BAA8B,CAAA;AACxE,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,sBAAsB,CAAA;AAErE,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,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,mBAAmB,CAAA;IAC7B,QAAQ,CAAC,EAAE,2BAA2B,CAAA;IACtC,IAAI,CAAC,EAAE,uBAAuB,CAAA;IAC9B,QAAQ,CAAC,EAAE,2BAA2B,CAAA;CACvC,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAAC,uBAAuB,EAAE,QAAQ,CAAC,CAAA;AAEpF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,8BAA8B,EAAE,CAAA;CAChD,CAAA;AA6HD,eAAO,MAAM,kBAAkB,GAC7B,KAAK,GAAG,EACR,OAAO,uBAAuB,EAC9B,SAAS,UAAU,KAClB,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAKxB,CAAA;AAED,eAAO,MAAM,0BAA0B,GACrC,KAAK,GAAG,EACR,OAAO,+BAA+B,EACtC,SAAS,UAAU,KAClB,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,EAAE,CAAA;CAAE,CAmB3B,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { Ctx } from '@rpcbase/api';
2
+ import { AppAbility } from '@rpcbase/db/acl';
3
+ export declare const sendNotificationsDigestForUser: (ctx: Ctx, { userId, ability, force, }: {
4
+ userId: string;
5
+ ability: AppAbility;
6
+ force?: boolean;
7
+ }) => Promise<{
8
+ ok: true;
9
+ sent: boolean;
10
+ skippedReason?: string;
11
+ } | {
12
+ ok: false;
13
+ error: string;
14
+ }>;
15
+ //# sourceMappingURL=digest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["../../src/notifications/digest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAoDjD,eAAO,MAAM,8BAA8B,GACzC,KAAK,GAAG,EACR,6BAIG;IACD,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,UAAU,CAAA;IACnB,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,CA2F5F,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const routes: Record<string, unknown>;
2
+ //# sourceMappingURL=routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/notifications/routes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,yBAKb,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './notifications/routes';
2
+ export * from './notifications/createNotification';
3
+ export * from './notifications/digest';
4
+ //# sourceMappingURL=notifications.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,11 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,11 @@
1
+ import { Application } from 'express';
2
+ import { PostHog } from 'posthog-node';
3
+ type ServerEnv = Record<string, string | undefined>;
4
+ export declare const resolvePosthogApiKey: (env: ServerEnv) => string | undefined;
5
+ export declare const resolvePosthogHost: () => string;
6
+ export declare const getPosthogClient: (env: ServerEnv) => PostHog | null;
7
+ export declare const bindExpressErrorHandler: (app: Application, posthog: PostHog | null) => void;
8
+ export declare const captureServerException: (error: unknown, posthog?: PostHog | null, properties?: Record<string, unknown>) => void;
9
+ export declare const ensurePosthogShutdown: () => void;
10
+ export {};
11
+ //# sourceMappingURL=posthog.d.ts.map
@@ -0,0 +1 @@
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;AAKnD,eAAO,MAAM,oBAAoB,GAAI,KAAK,SAAS,uBAA8B,CAAA;AAEjF,eAAO,MAAM,kBAAkB,cAAmC,CAAA;AAElE,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"}
@@ -0,0 +1,17 @@
1
+ export declare const AUTHENTICATED_USER_ID_HEADER = "rb-authenticated-user-id";
2
+ export declare const AUTHENTICATED_TENANT_ID_HEADER = "rb-authenticated-tenant-id";
3
+ export declare const PROXY_AUTH_TIMESTAMP_HEADER = "rb-proxy-auth-timestamp";
4
+ export declare const PROXY_AUTH_SIGNATURE_HEADER = "rb-proxy-auth-signature";
5
+ type HeadersLike = Record<string, string | string[] | undefined>;
6
+ export declare const buildProxyAuthSignature: ({ userId, tenantId, timestamp, secret, }: {
7
+ userId: string;
8
+ tenantId: string;
9
+ timestamp: string;
10
+ secret: string;
11
+ }) => string;
12
+ export declare const getTrustedProxyAuth: (headers: HeadersLike | undefined) => {
13
+ userId: string;
14
+ tenantId: string;
15
+ } | null;
16
+ export {};
17
+ //# sourceMappingURL=proxyAuth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxyAuth.d.ts","sourceRoot":"","sources":["../src/proxyAuth.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B,6BAA6B,CAAA;AACtE,eAAO,MAAM,8BAA8B,+BAA+B,CAAA;AAC1E,eAAO,MAAM,2BAA2B,4BAA4B,CAAA;AACpE,eAAO,MAAM,2BAA2B,4BAA4B,CAAA;AAIpE,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAA;AA0BhE,eAAO,MAAM,uBAAuB,GAAI,0CAKrC;IACD,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;CACf,KAAG,MAIH,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC9B,SAAS,WAAW,GAAG,SAAS,KAC/B;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,IA0BzC,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from 'react';
2
+ import { StaticHandler } from '@rpcbase/router';
3
+ import { StaticRpcbaseRtsHydrationData } from '@rpcbase/client';
4
+ import * as express from "express";
5
+ export declare const runRtsPrepass: (element: ReactNode) => Promise<boolean>;
6
+ export declare function renderSSR(req: express.Request, res: express.Response, dataRoutes: StaticHandler["dataRoutes"]): Promise<{
7
+ element: ReactNode | null;
8
+ isMatched: boolean;
9
+ statusCode: number;
10
+ rtsHydrationData?: StaticRpcbaseRtsHydrationData | null;
11
+ redirectResponse?: Response;
12
+ redirectRouteId?: string | null;
13
+ redirectRoutePath?: string | null;
14
+ }>;
15
+ //# sourceMappingURL=renderSSR.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderSSR.d.ts","sourceRoot":"","sources":["../src/renderSSR.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,SAAS,EAAc,MAAM,OAAO,CAAA;AAE7C,OAAO,EAGL,aAAa,EACd,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAGL,KAAK,6BAA6B,EACnC,MAAM,iBAAiB,CAAA;AAWxB,eAAO,MAAM,aAAa,GAAU,SAAS,SAAS,KAAG,OAAO,CAAC,OAAO,CA8CvE,CAAA;AAID,wBAAsB,SAAS,CAC7B,GAAG,EAAE,OAAO,CAAC,OAAO,EACpB,GAAG,EAAE,OAAO,CAAC,QAAQ,EACrB,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,6BAA6B,GAAG,IAAI,CAAA;IACvD,gBAAgB,CAAC,EAAE,QAAQ,CAAA;IAC3B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAClC,CAAC,CAqGD"}
@@ -0,0 +1,9 @@
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
@@ -0,0 +1 @@
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;yBA8He,KAAK,GAAG,CAAC,WAAW,CAAC;AAArC,wBAEC"}
@@ -0,0 +1,25 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,52 @@
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
+ export type PublishRtsMessageInput = {
6
+ tenantId: string;
7
+ userId?: string;
8
+ channel: string;
9
+ payload?: unknown;
10
+ };
11
+ type SocketMeta = {
12
+ tenantId: string;
13
+ userId: string;
14
+ ability: AppAbility;
15
+ };
16
+ type HandlerFn = (socket: RtsSocket) => void | (() => void);
17
+ declare class RtsSocket {
18
+ readonly id: string;
19
+ readonly tenantId: string;
20
+ readonly userId: string;
21
+ private readonly ws;
22
+ private readonly handlers;
23
+ private readonly messageHandlers;
24
+ constructor({ id, ws, meta, }: {
25
+ id: string;
26
+ ws: WebSocket;
27
+ meta: SocketMeta;
28
+ });
29
+ on(event: string, handler: (payload: unknown) => void): () => void;
30
+ off(event: string, handler: (payload: unknown) => void): void;
31
+ emit(event: string, payload?: unknown): void;
32
+ onRtsMessage(channel: string, handler: (payload: unknown) => void): () => void;
33
+ offRtsMessage(channel: string, handler: (payload: unknown) => void): void;
34
+ emitRtsMessage(channel: string, payload?: unknown): void;
35
+ close(): void;
36
+ dispatch(event: string, payload: unknown): void;
37
+ dispatchRtsMessage(channel: string, payload: unknown): void;
38
+ }
39
+ export declare const initRts: ({ server, path, sessionMiddleware, maxPayloadBytes: maxPayloadBytesArg, maxSubscriptionsPerSocket: maxSubscriptionsPerSocketArg, dispatchDebounceMs: dispatchDebounceMsArg, allowInternalModels: allowInternalModelsArg, }: {
40
+ server: HttpServer;
41
+ path?: string;
42
+ sessionMiddleware: RequestHandler;
43
+ maxPayloadBytes?: number;
44
+ maxSubscriptionsPerSocket?: number;
45
+ dispatchDebounceMs?: number;
46
+ allowInternalModels?: boolean;
47
+ }) => void;
48
+ export declare const registerRtsHandler: (handler: HandlerFn) => void;
49
+ export declare const publishRtsMessage: ({ tenantId, userId, channel, payload }: PublishRtsMessageInput) => void;
50
+ export declare const notifyRtsModelChanged: (tenantId: string, modelName: string) => void;
51
+ export * from './routes';
52
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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;AAG7C,OAAO,EAAgD,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG/F,OAAO,EAAiC,KAAK,SAAS,EAAE,MAAM,IAAI,CAAA;AAgElE,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,UAAU,GAAG;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,UAAU,CAAA;CACpB,CAAA;AAyBD,KAAK,SAAS,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAA;AA+B3D,cAAM,SAAS;IACb,SAAgB,EAAE,EAAE,MA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