ras-stack 5.5.6 → 6.0.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 (190) hide show
  1. package/README.md +32 -34
  2. package/dist/cli.d.ts +0 -27
  3. package/dist/cli.js +4 -32
  4. package/dist/cli.js.map +1 -1
  5. package/package.json +12 -228
  6. package/config/vite.mjs +0 -3
  7. package/dist/auth/client.d.ts +0 -11
  8. package/dist/auth/client.js +0 -57
  9. package/dist/auth/client.js.map +0 -1
  10. package/dist/auth/index.d.ts +0 -9
  11. package/dist/auth/index.js +0 -6
  12. package/dist/auth/index.js.map +0 -1
  13. package/dist/auth/origins.d.ts +0 -13
  14. package/dist/auth/origins.js +0 -41
  15. package/dist/auth/origins.js.map +0 -1
  16. package/dist/auth/providers.d.ts +0 -11
  17. package/dist/auth/providers.js +0 -26
  18. package/dist/auth/providers.js.map +0 -1
  19. package/dist/auth/random.d.ts +0 -2
  20. package/dist/auth/random.js +0 -10
  21. package/dist/auth/random.js.map +0 -1
  22. package/dist/auth/react.d.ts +0 -18
  23. package/dist/auth/react.js +0 -34
  24. package/dist/auth/react.js.map +0 -1
  25. package/dist/auth/secret.d.ts +0 -8
  26. package/dist/auth/secret.js +0 -44
  27. package/dist/auth/secret.js.map +0 -1
  28. package/dist/auth/settings.d.ts +0 -54
  29. package/dist/auth/settings.js +0 -37
  30. package/dist/auth/settings.js.map +0 -1
  31. package/dist/build/cli.d.ts +0 -1
  32. package/dist/build/cli.js +0 -24
  33. package/dist/build/cli.js.map +0 -1
  34. package/dist/build/index.d.ts +0 -17
  35. package/dist/build/index.js +0 -93
  36. package/dist/build/index.js.map +0 -1
  37. package/dist/changesets/cli.d.ts +0 -1
  38. package/dist/changesets/cli.js +0 -14
  39. package/dist/changesets/cli.js.map +0 -1
  40. package/dist/changesets/index.d.ts +0 -1
  41. package/dist/changesets/index.js +0 -38
  42. package/dist/changesets/index.js.map +0 -1
  43. package/dist/config.d.ts +0 -3
  44. package/dist/config.js +0 -3
  45. package/dist/config.js.map +0 -1
  46. package/dist/conformance/index.d.ts +0 -9
  47. package/dist/conformance/index.js +0 -92
  48. package/dist/conformance/index.js.map +0 -1
  49. package/dist/database/index.d.ts +0 -19
  50. package/dist/database/index.js +0 -21
  51. package/dist/database/index.js.map +0 -1
  52. package/dist/database/libsql.d.ts +0 -14
  53. package/dist/database/libsql.js +0 -31
  54. package/dist/database/libsql.js.map +0 -1
  55. package/dist/database/postgres.d.ts +0 -13
  56. package/dist/database/postgres.js +0 -16
  57. package/dist/database/postgres.js.map +0 -1
  58. package/dist/database/pragmas.d.ts +0 -7
  59. package/dist/database/pragmas.js +0 -12
  60. package/dist/database/pragmas.js.map +0 -1
  61. package/dist/database/sqlite.d.ts +0 -20
  62. package/dist/database/sqlite.js +0 -45
  63. package/dist/database/sqlite.js.map +0 -1
  64. package/dist/email/index.d.ts +0 -63
  65. package/dist/email/index.js +0 -95
  66. package/dist/email/index.js.map +0 -1
  67. package/dist/managed/catalog.d.ts +0 -40
  68. package/dist/managed/catalog.js +0 -114
  69. package/dist/managed/catalog.js.map +0 -1
  70. package/dist/managed/cli.d.ts +0 -1
  71. package/dist/managed/cli.js +0 -54
  72. package/dist/managed/cli.js.map +0 -1
  73. package/dist/managed/environment.d.ts +0 -5
  74. package/dist/managed/environment.js +0 -52
  75. package/dist/managed/environment.js.map +0 -1
  76. package/dist/managed/files.d.ts +0 -4
  77. package/dist/managed/files.js +0 -30
  78. package/dist/managed/files.js.map +0 -1
  79. package/dist/managed/install.d.ts +0 -4
  80. package/dist/managed/install.js +0 -62
  81. package/dist/managed/install.js.map +0 -1
  82. package/dist/managed/model.d.ts +0 -24
  83. package/dist/managed/model.js +0 -30
  84. package/dist/managed/model.js.map +0 -1
  85. package/dist/managed/plan.d.ts +0 -13
  86. package/dist/managed/plan.js +0 -99
  87. package/dist/managed/plan.js.map +0 -1
  88. package/dist/managed/pnpm.d.ts +0 -23
  89. package/dist/managed/pnpm.js +0 -2808
  90. package/dist/managed/pnpm.js.map +0 -7
  91. package/dist/managed/process.d.ts +0 -4
  92. package/dist/managed/process.js +0 -23
  93. package/dist/managed/process.js.map +0 -1
  94. package/dist/managed/sync.d.ts +0 -6
  95. package/dist/managed/sync.js +0 -96
  96. package/dist/managed/sync.js.map +0 -1
  97. package/dist/managed/tools.d.ts +0 -1
  98. package/dist/managed/tools.js +0 -7
  99. package/dist/managed/tools.js.map +0 -1
  100. package/dist/posthog/config.d.ts +0 -19
  101. package/dist/posthog/config.js +0 -51
  102. package/dist/posthog/config.js.map +0 -1
  103. package/dist/posthog/index.d.ts +0 -4
  104. package/dist/posthog/index.js +0 -3
  105. package/dist/posthog/index.js.map +0 -1
  106. package/dist/posthog/proxy.d.ts +0 -30
  107. package/dist/posthog/proxy.js +0 -51
  108. package/dist/posthog/proxy.js.map +0 -1
  109. package/dist/posthog/react.d.ts +0 -39
  110. package/dist/posthog/react.js +0 -81
  111. package/dist/posthog/react.js.map +0 -1
  112. package/dist/posthog/request.d.ts +0 -12
  113. package/dist/posthog/request.js +0 -22
  114. package/dist/posthog/request.js.map +0 -1
  115. package/dist/posthog/server.d.ts +0 -67
  116. package/dist/posthog/server.js +0 -388
  117. package/dist/posthog/server.js.map +0 -1
  118. package/dist/query/index.d.ts +0 -8
  119. package/dist/query/index.js +0 -17
  120. package/dist/query/index.js.map +0 -1
  121. package/dist/realtime/client.d.ts +0 -19
  122. package/dist/realtime/client.js +0 -37
  123. package/dist/realtime/client.js.map +0 -1
  124. package/dist/realtime/environment.d.ts +0 -10
  125. package/dist/realtime/environment.js +0 -28
  126. package/dist/realtime/environment.js.map +0 -1
  127. package/dist/realtime/index.d.ts +0 -6
  128. package/dist/realtime/index.js +0 -4
  129. package/dist/realtime/index.js.map +0 -1
  130. package/dist/realtime/publisher.d.ts +0 -37
  131. package/dist/realtime/publisher.js +0 -195
  132. package/dist/realtime/publisher.js.map +0 -1
  133. package/dist/realtime/react.d.ts +0 -13
  134. package/dist/realtime/react.js +0 -78
  135. package/dist/realtime/react.js.map +0 -1
  136. package/dist/realtime/tokens.d.ts +0 -6
  137. package/dist/realtime/tokens.js +0 -13
  138. package/dist/realtime/tokens.js.map +0 -1
  139. package/dist/runtime/dev.d.ts +0 -21
  140. package/dist/runtime/dev.js +0 -138
  141. package/dist/runtime/dev.js.map +0 -1
  142. package/dist/runtime/index.d.ts +0 -2
  143. package/dist/runtime/index.js +0 -2
  144. package/dist/runtime/index.js.map +0 -1
  145. package/dist/runtime/stack.d.ts +0 -65
  146. package/dist/runtime/stack.js +0 -226
  147. package/dist/runtime/stack.js.map +0 -1
  148. package/dist/server/canonical-host.d.ts +0 -6
  149. package/dist/server/canonical-host.js +0 -23
  150. package/dist/server/canonical-host.js.map +0 -1
  151. package/dist/server/errors.d.ts +0 -1
  152. package/dist/server/errors.js +0 -20
  153. package/dist/server/errors.js.map +0 -1
  154. package/dist/server/health.d.ts +0 -10
  155. package/dist/server/health.js +0 -12
  156. package/dist/server/health.js.map +0 -1
  157. package/dist/server/index.d.ts +0 -7
  158. package/dist/server/index.js +0 -5
  159. package/dist/server/index.js.map +0 -1
  160. package/dist/server/rpc.d.ts +0 -19
  161. package/dist/server/rpc.js +0 -52
  162. package/dist/server/rpc.js.map +0 -1
  163. package/dist/server/server-function.d.ts +0 -8
  164. package/dist/server/server-function.js +0 -18
  165. package/dist/server/server-function.js.map +0 -1
  166. package/dist/server/singleton.d.ts +0 -4
  167. package/dist/server/singleton.js +0 -48
  168. package/dist/server/singleton.js.map +0 -1
  169. package/dist/spacetime/index.d.ts +0 -36
  170. package/dist/spacetime/index.js +0 -103
  171. package/dist/spacetime/index.js.map +0 -1
  172. package/dist/tanstack/client.d.ts +0 -11
  173. package/dist/tanstack/client.js +0 -33
  174. package/dist/tanstack/client.js.map +0 -1
  175. package/dist/tanstack/middleware.d.ts +0 -9
  176. package/dist/tanstack/middleware.js +0 -32
  177. package/dist/tanstack/middleware.js.map +0 -1
  178. package/dist/tanstack/server.d.ts +0 -10
  179. package/dist/tanstack/server.js +0 -14
  180. package/dist/tanstack/server.js.map +0 -1
  181. package/dist/uploads/index.d.ts +0 -29
  182. package/dist/uploads/index.js +0 -83
  183. package/dist/uploads/index.js.map +0 -1
  184. package/dist/vite/config.d.ts +0 -18
  185. package/dist/vite/config.js +0 -88
  186. package/dist/vite/config.js.map +0 -1
  187. package/dist/vite/index.d.ts +0 -2
  188. package/dist/vite/index.js +0 -2
  189. package/dist/vite/index.js.map +0 -1
  190. package/pnpmfile.mjs +0 -1
@@ -1,388 +0,0 @@
1
- import { AsyncLocalStorage } from 'node:async_hooks';
2
- import { setTimeout as delay } from 'node:timers/promises';
3
- import { currentServerFunction } from '../server/server-function.js';
4
- import { postHogRequestContext } from './request.js';
5
- async function createPostHogServerClient(environment, options) {
6
- const { PostHog } = await import('posthog-node');
7
- return new PostHog(environment.projectToken, {
8
- host: environment.host,
9
- enableExceptionAutocapture: true,
10
- ...options,
11
- });
12
- }
13
- export function createManagedPostHogServerTelemetry(options) {
14
- let client;
15
- let logProvider;
16
- let closed = false;
17
- const context = new AsyncLocalStorage();
18
- const report = (error) => {
19
- try {
20
- options.onError?.(error);
21
- }
22
- catch { }
23
- };
24
- const getClient = () => {
25
- if (closed || !options.environment)
26
- return undefined;
27
- if (!client) {
28
- const pending = createPostHogServerClient(options.environment, managedClientOptions(options));
29
- client = pending;
30
- void pending.catch(() => {
31
- if (client === pending)
32
- client = undefined;
33
- });
34
- }
35
- return client;
36
- };
37
- const getLogProvider = () => {
38
- if (closed || !options.environment)
39
- return undefined;
40
- if (!logProvider) {
41
- const pending = createPostHogLogProvider(options.environment, options);
42
- logProvider = pending;
43
- void pending.catch(() => {
44
- if (logProvider === pending)
45
- logProvider = undefined;
46
- });
47
- }
48
- return logProvider;
49
- };
50
- const safely = async (work) => {
51
- if (closed || !options.environment)
52
- return;
53
- try {
54
- await work();
55
- }
56
- catch (error) {
57
- report(error);
58
- }
59
- };
60
- const loadClient = async () => {
61
- try {
62
- return await getClient();
63
- }
64
- catch (error) {
65
- report(error);
66
- return undefined;
67
- }
68
- };
69
- async function withContext(telemetryContext, work) {
70
- const inherited = context.getStore();
71
- const correlation = {
72
- ...(inherited?.distinctId ? { distinctId: inherited.distinctId } : {}),
73
- ...(inherited?.sessionId ? { sessionId: inherited.sessionId } : {}),
74
- ...telemetryContext,
75
- };
76
- const requestContext = {
77
- ...(correlation.distinctId ? { distinctId: correlation.distinctId } : {}),
78
- ...(correlation.sessionId ? { sessionId: correlation.sessionId } : {}),
79
- properties: {
80
- ...inherited?.properties,
81
- ...telemetryContext.properties,
82
- ...(correlation.sessionId ? { $session_id: correlation.sessionId } : {}),
83
- },
84
- };
85
- const run = () => context.run(requestContext, work);
86
- const value = await loadClient();
87
- return (value ? value.withContext(telemetryContext, run) : run());
88
- }
89
- async function withRequestContext(request, requestOptions, work) {
90
- return withContext(postHogRequestContext(request, requestOptions), work);
91
- }
92
- async function withSpan(name, optionsOrWork, maybeWork) {
93
- const spanOptions = typeof optionsOrWork === 'function' ? undefined : optionsOrWork;
94
- const work = typeof optionsOrWork === 'function' ? optionsOrWork : maybeWork;
95
- const value = await loadClient();
96
- if (!value)
97
- return work(undefined);
98
- return (spanOptions ? value.withSpan(name, spanOptions, work) : value.withSpan(name, work));
99
- }
100
- const metrics = {
101
- count(name, value = 1, metricOptions) {
102
- return safely(async () => (await getClient())?.metrics.count(name, value, metricOptions));
103
- },
104
- gauge(name, value, metricOptions) {
105
- return safely(async () => (await getClient())?.metrics.gauge(name, value, metricOptions));
106
- },
107
- histogram(name, value, metricOptions) {
108
- return safely(async () => (await getClient())?.metrics.histogram(name, value, metricOptions));
109
- },
110
- };
111
- return {
112
- metrics,
113
- async start() {
114
- await safely(async () => {
115
- await Promise.all([getClient(), getLogProvider()]);
116
- });
117
- },
118
- async capture(distinctId, event, properties) {
119
- await safely(async () => {
120
- const value = await getClient();
121
- value?.capture({ distinctId, event, ...(properties ? { properties } : {}) });
122
- });
123
- },
124
- async exception(error, distinctId, properties) {
125
- await safely(async () => {
126
- const value = await getClient();
127
- const correlation = context.getStore();
128
- const capturedProperties = mergeProperties(serverFunctionProperties(), properties, correlation?.properties);
129
- value?.captureException(error, distinctId ?? correlation?.distinctId ?? 'server', capturedProperties);
130
- });
131
- },
132
- async log(record) {
133
- await safely(async () => {
134
- const provider = await getLogProvider();
135
- const correlation = context.getStore();
136
- const attributes = boundedAttributes(mergeProperties(serverFunctionProperties(), record.attributes, {
137
- ...(correlation?.distinctId ? { posthogDistinctId: correlation.distinctId } : {}),
138
- ...(correlation?.sessionId ? { sessionId: correlation.sessionId } : {}),
139
- }));
140
- provider?.getLogger(options.serviceName).emit({
141
- body: boundedString(record.body),
142
- ...(record.severityText ? { severityText: record.severityText } : {}),
143
- ...(record.timestamp === undefined ? {} : { timestamp: record.timestamp }),
144
- ...(attributes ? { attributes } : {}),
145
- });
146
- });
147
- },
148
- async flush() {
149
- await safely(async () => {
150
- const [value, provider] = await Promise.all([getClient(), getLogProvider()]);
151
- await Promise.all([value?.flush(), provider?.forceFlush()]);
152
- });
153
- },
154
- async startSpan(name, spanOptions) {
155
- return (await loadClient())?.startSpan(name, spanOptions);
156
- },
157
- withContext,
158
- withRequestContext,
159
- withSpan,
160
- async shutdown(timeoutMs = 10_000) {
161
- if (closed)
162
- return;
163
- assertShutdownTimeout(timeoutMs);
164
- closed = true;
165
- const results = await Promise.allSettled([
166
- // oxlint-disable-next-line no-underscore-dangle -- posthog-node's async shutdown API is named `_shutdown`.
167
- client?.then((value) => value._shutdown(timeoutMs)),
168
- logProvider?.then((value) => shutdownPostHogLogProvider(value, timeoutMs)),
169
- ]);
170
- for (const result of results)
171
- if (result.status === 'rejected')
172
- report(result.reason);
173
- },
174
- };
175
- }
176
- function managedClientOptions(options) {
177
- const { metrics, traces, ...clientOptions } = options.clientOptions ?? {};
178
- const service = {
179
- serviceName: options.serviceName,
180
- ...(options.serviceVersion ? { serviceVersion: options.serviceVersion } : {}),
181
- ...(options.deploymentEnvironment ? { environment: options.deploymentEnvironment } : {}),
182
- ...(options.resourceAttributes ? { resourceAttributes: options.resourceAttributes } : {}),
183
- };
184
- return {
185
- ...clientOptions,
186
- metrics: { ...service, ...metrics },
187
- traces: { ...service, ...traces },
188
- };
189
- }
190
- export function createPostHogRpcLogger(telemetry, options = {}) {
191
- return async (error, context, request) => {
192
- try {
193
- options.logError?.(error, context);
194
- }
195
- catch { }
196
- let authenticatedDistinctId;
197
- if (request && options.resolveAuthenticatedDistinctId) {
198
- try {
199
- authenticatedDistinctId = await options.resolveAuthenticatedDistinctId(request);
200
- }
201
- catch { }
202
- }
203
- const correlation = request
204
- ? postHogRequestContext(request, {
205
- ...(authenticatedDistinctId ? { authenticatedDistinctId } : {}),
206
- ...(options.allowAnonymousDistinctId === undefined ? {} : { allowAnonymousDistinctId: options.allowAnonymousDistinctId }),
207
- })
208
- : { properties: {} };
209
- const distinctId = correlation.distinctId ?? options.fallbackDistinctId ?? 'server';
210
- const properties = {
211
- ...correlation.properties,
212
- ...(context.method ? { request_method: context.method } : {}),
213
- ...(context.path ? { request_path: context.path } : {}),
214
- ...(context.function ? { server_function: context.function } : {}),
215
- ...(context.status === undefined ? {} : { response_status: context.status }),
216
- };
217
- await Promise.all([
218
- telemetry.exception(error, distinctId, properties),
219
- telemetry.log({
220
- body: 'server function failed',
221
- severityText: 'error',
222
- attributes: { ...properties, posthogDistinctId: distinctId },
223
- }),
224
- ]);
225
- };
226
- }
227
- export function createPostHogRpcObserver(telemetry, options = {}) {
228
- const metricPrefix = options.metricPrefix ?? 'server_function';
229
- const spanName = options.spanName ?? 'server_function';
230
- return async function observe(request, work) {
231
- if (!request)
232
- return work();
233
- const method = request.method.toUpperCase();
234
- const identity = currentServerFunction();
235
- // A function name is bounded by the application's code, unlike its URL or caller.
236
- const attributes = identity ? { method, function: identity.name } : { method };
237
- const parent = request.headers.get('traceparent');
238
- const settled = await telemetry.withRequestContext(request, {}, () => telemetry.withSpan(spanName, { kind: 'server', ...(parent ? { parent } : {}) }, async (span) => {
239
- const startedAt = performance.now();
240
- span?.setAttribute('http.request.method', method);
241
- if (identity) {
242
- span?.setAttribute('code.function.name', identity.name);
243
- span?.setAttribute('code.file.path', identity.filename);
244
- }
245
- let outcome = 'error';
246
- try {
247
- const value = await work();
248
- outcome = 'success';
249
- return { value };
250
- }
251
- catch (error) {
252
- const status = responseStatus(error);
253
- if (status !== undefined)
254
- span?.setAttribute('http.response.status_code', status);
255
- if (status === undefined || status >= 500)
256
- throw error;
257
- outcome = status >= 400 ? 'refused' : 'success';
258
- // Returning instead of throwing keeps an intended response from marking the span as failed.
259
- return { response: error };
260
- }
261
- finally {
262
- span?.setAttribute('server.function.outcome', outcome);
263
- await Promise.all([
264
- telemetry.metrics.count(`${metricPrefix}.requests`, 1, { attributes: { ...attributes, outcome } }),
265
- telemetry.metrics.histogram(`${metricPrefix}.duration`, Math.max(0, performance.now() - startedAt), {
266
- unit: 'ms',
267
- attributes,
268
- }),
269
- ]);
270
- }
271
- }));
272
- if ('response' in settled)
273
- throw settled.response;
274
- return settled.value;
275
- };
276
- }
277
- /** The status of a thrown `Response`, which `createRpc` rethrows as an `Error` whose cause is that response. */
278
- function responseStatus(error) {
279
- const response = error instanceof Error ? error.cause : error;
280
- return response instanceof Response ? response.status : undefined;
281
- }
282
- export function installPostHogServerTelemetryShutdown(telemetry, target = process) {
283
- let shuttingDown = false;
284
- const listeners = new Map();
285
- const remove = () => {
286
- for (const [signal, listener] of listeners)
287
- target.off(signal, listener);
288
- listeners.clear();
289
- };
290
- for (const signal of ['SIGINT', 'SIGTERM']) {
291
- const listener = () => {
292
- if (shuttingDown)
293
- return;
294
- shuttingDown = true;
295
- void telemetry
296
- .shutdown()
297
- .catch(() => undefined)
298
- .finally(() => {
299
- remove();
300
- target.kill(target.pid, signal);
301
- });
302
- };
303
- listeners.set(signal, listener);
304
- target.on(signal, listener);
305
- }
306
- return remove;
307
- }
308
- async function createPostHogLogProvider(environment, options) {
309
- const [{ OTLPLogExporter }, { resourceFromAttributes }, { BatchLogRecordProcessor, LoggerProvider }] = await Promise.all([
310
- import('@opentelemetry/exporter-logs-otlp-http'),
311
- import('@opentelemetry/resources'),
312
- import('@opentelemetry/sdk-logs'),
313
- ]);
314
- const exporter = new OTLPLogExporter({
315
- url: `${environment.host.replace(/\/$/, '')}/i/v1/logs`,
316
- headers: { Authorization: `Bearer ${environment.projectToken}` },
317
- });
318
- return new LoggerProvider({
319
- resource: resourceFromAttributes({
320
- 'service.name': options.serviceName,
321
- ...(options.serviceVersion ? { 'service.version': options.serviceVersion } : {}),
322
- ...(options.deploymentEnvironment ? { 'deployment.environment': options.deploymentEnvironment } : {}),
323
- ...options.resourceAttributes,
324
- }),
325
- processors: [new BatchLogRecordProcessor({ exporter })],
326
- });
327
- }
328
- /** Names the server function a log or exception was recorded in, so it reads without the request path's opaque id. */
329
- function serverFunctionProperties() {
330
- const name = currentServerFunction()?.name;
331
- return name ? { server_function: name } : undefined;
332
- }
333
- function mergeProperties(...values) {
334
- const merged = Object.assign({}, ...values.filter(Boolean));
335
- return Object.keys(merged).length ? merged : undefined;
336
- }
337
- function boundedAttributes(attributes) {
338
- if (!attributes)
339
- return undefined;
340
- return Object.fromEntries(Object.entries(attributes)
341
- .slice(0, 64)
342
- .map(([key, value]) => [key.slice(0, 128), boundedLogValue(value, 0)])
343
- .filter((entry) => entry[1] !== undefined));
344
- }
345
- function boundedLogValue(value, depth) {
346
- if (value === null || typeof value === 'number' || typeof value === 'boolean')
347
- return value;
348
- if (typeof value === 'string')
349
- return boundedString(value);
350
- if (depth >= 3)
351
- return '[Truncated]';
352
- if (Array.isArray(value)) {
353
- return value
354
- .slice(0, 32)
355
- .map((entry) => boundedLogValue(entry, depth + 1))
356
- .filter((entry) => entry !== undefined);
357
- }
358
- if (value === undefined)
359
- return undefined;
360
- try {
361
- return boundedString(JSON.stringify(value));
362
- }
363
- catch {
364
- return '[Unserializable value]';
365
- }
366
- }
367
- function boundedString(value) {
368
- return value.slice(0, 2_048);
369
- }
370
- async function shutdownPostHogLogProvider(provider, timeoutMs) {
371
- const timer = new AbortController();
372
- try {
373
- await Promise.race([
374
- provider.shutdown(),
375
- delay(timeoutMs, undefined, { ref: false, signal: timer.signal }).then(() => {
376
- throw new Error(`PostHog log shutdown timed out after ${timeoutMs}ms`);
377
- }),
378
- ]);
379
- }
380
- finally {
381
- timer.abort();
382
- }
383
- }
384
- function assertShutdownTimeout(timeoutMs) {
385
- if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 0)
386
- throw new Error('timeoutMs must be a non-negative integer');
387
- }
388
- //# sourceMappingURL=server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/posthog/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAG1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AAEpE,OAAO,EAAE,qBAAqB,EAAqC,MAAM,cAAc,CAAA;AAoDvF,KAAK,UAAU,yBAAyB,CAAC,WAA+B,EAAE,OAAqC;IAC7G,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAA;IAChD,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE;QAC3C,IAAI,EAAE,WAAW,CAAC,IAAI;QACtB,0BAA0B,EAAE,IAAI;QAChC,GAAG,OAAO;KACX,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,mCAAmC,CAAC,OAA6C;IAC/F,IAAI,MAAoC,CAAA;IACxC,IAAI,WAA6C,CAAA;IACjD,IAAI,MAAM,GAAG,KAAK,CAAA;IAClB,MAAM,OAAO,GAAG,IAAI,iBAAiB,EAA2B,CAAA;IAEhE,MAAM,MAAM,GAAG,CAAC,KAAc,EAAE,EAAE;QAChC,IAAI,CAAC;YACH,OAAO,CAAC,OAAO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AAK,EAAE,CAAA;IACf,CAAC;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,SAAiB;IAC9C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,SAAS,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;AACpH,CAAC","sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks'\nimport { setTimeout as delay } from 'node:timers/promises'\nimport type { CaptureMetricOptions, PostHog, PostHogOptions, Span, StartSpanOptions } from 'posthog-node'\nimport type { RpcErrorContext, RpcLogger, RpcObserver } from '../server/rpc.js'\nimport { currentServerFunction } from '../server/server-function.js'\nimport type { PostHogEnvironment } from './config.js'\nimport { postHogRequestContext, type PostHogRequestContextOptions } from './request.js'\n\ntype LogProvider = InstanceType<(typeof import('@opentelemetry/sdk-logs'))['LoggerProvider']>\n\nexport type PostHogLogValue = string | number | boolean | null | PostHogLogValue[]\n\nexport type PostHogLogRecord = {\n body: string\n severityText?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal'\n timestamp?: number\n attributes?: Record<string, unknown>\n}\n\nexport type ManagedPostHogServerTelemetryOptions = {\n environment: PostHogEnvironment | undefined\n serviceName: string\n serviceVersion?: string\n deploymentEnvironment?: string\n resourceAttributes?: Record<string, string>\n clientOptions?: Omit<PostHogOptions, 'host'>\n onError?: (error: unknown) => void\n}\n\nexport type PostHogServerTelemetry = ReturnType<typeof createManagedPostHogServerTelemetry>\n\nexport type PostHogTelemetryContext = {\n distinctId?: string\n sessionId?: string\n properties?: Record<string, unknown>\n}\n\nexport type PostHogTraceSpan = Span | undefined\n\nexport type PostHogRpcLoggerOptions = {\n logError?: (error: unknown, context: RpcErrorContext) => void\n resolveAuthenticatedDistinctId?: (request: Request) => string | undefined | Promise<string | undefined>\n allowAnonymousDistinctId?: boolean\n fallbackDistinctId?: string\n}\n\nexport type PostHogRpcObserverOptions = {\n metricPrefix?: string\n spanName?: string\n}\n\ntype PostHogShutdownProcess = {\n pid: number\n on(signal: 'SIGINT' | 'SIGTERM', listener: () => void): void\n off(signal: 'SIGINT' | 'SIGTERM', listener: () => void): void\n kill(pid: number, signal: 'SIGINT' | 'SIGTERM'): void\n}\n\nasync function createPostHogServerClient(environment: PostHogEnvironment, options: Omit<PostHogOptions, 'host'>) {\n const { PostHog } = await import('posthog-node')\n return new PostHog(environment.projectToken, {\n host: environment.host,\n enableExceptionAutocapture: true,\n ...options,\n })\n}\n\nexport function createManagedPostHogServerTelemetry(options: ManagedPostHogServerTelemetryOptions) {\n let client: Promise<PostHog> | undefined\n let logProvider: Promise<LogProvider> | undefined\n let closed = false\n const context = new AsyncLocalStorage<PostHogTelemetryContext>()\n\n const report = (error: unknown) => {\n try {\n options.onError?.(error)\n } catch {}\n }\n\n const getClient = () => {\n if (closed || !options.environment) return undefined\n if (!client) {\n const pending = createPostHogServerClient(options.environment, managedClientOptions(options))\n client = pending\n void pending.catch(() => {\n if (client === pending) client = undefined\n })\n }\n return client\n }\n\n const getLogProvider = () => {\n if (closed || !options.environment) return undefined\n if (!logProvider) {\n const pending = createPostHogLogProvider(options.environment, options)\n logProvider = pending\n void pending.catch(() => {\n if (logProvider === pending) logProvider = undefined\n })\n }\n return logProvider\n }\n\n const safely = async (work: () => void | Promise<void>) => {\n if (closed || !options.environment) return\n try {\n await work()\n } catch (error) {\n report(error)\n }\n }\n\n const loadClient = async () => {\n try {\n return await getClient()\n } catch (error) {\n report(error)\n return undefined\n }\n }\n\n async function withContext<T>(telemetryContext: PostHogTelemetryContext, work: () => T): Promise<Awaited<T>> {\n const inherited = context.getStore()\n const correlation = {\n ...(inherited?.distinctId ? { distinctId: inherited.distinctId } : {}),\n ...(inherited?.sessionId ? { sessionId: inherited.sessionId } : {}),\n ...telemetryContext,\n }\n const requestContext: PostHogTelemetryContext = {\n ...(correlation.distinctId ? { distinctId: correlation.distinctId } : {}),\n ...(correlation.sessionId ? { sessionId: correlation.sessionId } : {}),\n properties: {\n ...inherited?.properties,\n ...telemetryContext.properties,\n ...(correlation.sessionId ? { $session_id: correlation.sessionId } : {}),\n },\n }\n const run = () => context.run(requestContext, work)\n const value = await loadClient()\n return (value ? value.withContext(telemetryContext, run) : run()) as Awaited<T>\n }\n\n async function withRequestContext<T>(request: Request, requestOptions: PostHogRequestContextOptions, work: () => T): Promise<Awaited<T>> {\n return withContext(postHogRequestContext(request, requestOptions), work)\n }\n\n async function withSpan<T>(name: string, work: (span: PostHogTraceSpan) => T): Promise<Awaited<T>>\n async function withSpan<T>(name: string, spanOptions: StartSpanOptions, work: (span: PostHogTraceSpan) => T): Promise<Awaited<T>>\n async function withSpan<T>(\n name: string,\n optionsOrWork: StartSpanOptions | ((span: PostHogTraceSpan) => T),\n maybeWork?: (span: PostHogTraceSpan) => T,\n ): Promise<Awaited<T>> {\n const spanOptions = typeof optionsOrWork === 'function' ? undefined : optionsOrWork\n const work = typeof optionsOrWork === 'function' ? optionsOrWork : maybeWork!\n const value = await loadClient()\n if (!value) return work(undefined) as Awaited<T>\n return (spanOptions ? value.withSpan(name, spanOptions, work) : value.withSpan(name, work)) as Awaited<T>\n }\n\n const metrics = {\n count(name: string, value = 1, metricOptions?: CaptureMetricOptions) {\n return safely(async () => (await getClient())?.metrics.count(name, value, metricOptions))\n },\n gauge(name: string, value: number, metricOptions?: CaptureMetricOptions) {\n return safely(async () => (await getClient())?.metrics.gauge(name, value, metricOptions))\n },\n histogram(name: string, value: number, metricOptions?: CaptureMetricOptions) {\n return safely(async () => (await getClient())?.metrics.histogram(name, value, metricOptions))\n },\n }\n\n return {\n metrics,\n async start() {\n await safely(async () => {\n await Promise.all([getClient(), getLogProvider()])\n })\n },\n async capture(distinctId: string, event: string, properties?: Record<string, unknown>) {\n await safely(async () => {\n const value = await getClient()\n value?.capture({ distinctId, event, ...(properties ? { properties } : {}) })\n })\n },\n async exception(error: unknown, distinctId?: string, properties?: Record<string, unknown>) {\n await safely(async () => {\n const value = await getClient()\n const correlation = context.getStore()\n const capturedProperties = mergeProperties(serverFunctionProperties(), properties, correlation?.properties)\n value?.captureException(error, distinctId ?? correlation?.distinctId ?? 'server', capturedProperties)\n })\n },\n async log(record: PostHogLogRecord) {\n await safely(async () => {\n const provider = await getLogProvider()\n const correlation = context.getStore()\n const attributes = boundedAttributes(\n mergeProperties(serverFunctionProperties(), record.attributes, {\n ...(correlation?.distinctId ? { posthogDistinctId: correlation.distinctId } : {}),\n ...(correlation?.sessionId ? { sessionId: correlation.sessionId } : {}),\n }),\n )\n provider?.getLogger(options.serviceName).emit({\n body: boundedString(record.body),\n ...(record.severityText ? { severityText: record.severityText } : {}),\n ...(record.timestamp === undefined ? {} : { timestamp: record.timestamp }),\n ...(attributes ? { attributes } : {}),\n })\n })\n },\n async flush() {\n await safely(async () => {\n const [value, provider] = await Promise.all([getClient(), getLogProvider()])\n await Promise.all([value?.flush(), provider?.forceFlush()])\n })\n },\n async startSpan(name: string, spanOptions?: StartSpanOptions) {\n return (await loadClient())?.startSpan(name, spanOptions)\n },\n withContext,\n withRequestContext,\n withSpan,\n async shutdown(timeoutMs = 10_000) {\n if (closed) return\n assertShutdownTimeout(timeoutMs)\n closed = true\n const results = await Promise.allSettled([\n // oxlint-disable-next-line no-underscore-dangle -- posthog-node's async shutdown API is named `_shutdown`.\n client?.then((value) => value._shutdown(timeoutMs)),\n logProvider?.then((value) => shutdownPostHogLogProvider(value, timeoutMs)),\n ])\n for (const result of results) if (result.status === 'rejected') report(result.reason)\n },\n }\n}\n\nfunction managedClientOptions(options: ManagedPostHogServerTelemetryOptions): Omit<PostHogOptions, 'host'> {\n const { metrics, traces, ...clientOptions } = options.clientOptions ?? {}\n const service = {\n serviceName: options.serviceName,\n ...(options.serviceVersion ? { serviceVersion: options.serviceVersion } : {}),\n ...(options.deploymentEnvironment ? { environment: options.deploymentEnvironment } : {}),\n ...(options.resourceAttributes ? { resourceAttributes: options.resourceAttributes } : {}),\n }\n return {\n ...clientOptions,\n metrics: { ...service, ...metrics },\n traces: { ...service, ...traces },\n }\n}\n\nexport function createPostHogRpcLogger(telemetry: PostHogServerTelemetry, options: PostHogRpcLoggerOptions = {}): RpcLogger {\n return async (error, context, request) => {\n try {\n options.logError?.(error, context)\n } catch {}\n let authenticatedDistinctId: string | undefined\n if (request && options.resolveAuthenticatedDistinctId) {\n try {\n authenticatedDistinctId = await options.resolveAuthenticatedDistinctId(request)\n } catch {}\n }\n const correlation = request\n ? postHogRequestContext(request, {\n ...(authenticatedDistinctId ? { authenticatedDistinctId } : {}),\n ...(options.allowAnonymousDistinctId === undefined ? {} : { allowAnonymousDistinctId: options.allowAnonymousDistinctId }),\n })\n : { properties: {} }\n const distinctId = correlation.distinctId ?? options.fallbackDistinctId ?? 'server'\n const properties = {\n ...correlation.properties,\n ...(context.method ? { request_method: context.method } : {}),\n ...(context.path ? { request_path: context.path } : {}),\n ...(context.function ? { server_function: context.function } : {}),\n ...(context.status === undefined ? {} : { response_status: context.status }),\n }\n await Promise.all([\n telemetry.exception(error, distinctId, properties),\n telemetry.log({\n body: 'server function failed',\n severityText: 'error',\n attributes: { ...properties, posthogDistinctId: distinctId },\n }),\n ])\n }\n}\n\nexport function createPostHogRpcObserver(\n telemetry: Pick<PostHogServerTelemetry, 'metrics' | 'withRequestContext' | 'withSpan'>,\n options: PostHogRpcObserverOptions = {},\n): RpcObserver {\n const metricPrefix = options.metricPrefix ?? 'server_function'\n const spanName = options.spanName ?? 'server_function'\n return async function observe<T>(request: Request | undefined, work: () => Promise<T>) {\n if (!request) return work()\n const method = request.method.toUpperCase()\n const identity = currentServerFunction()\n // A function name is bounded by the application's code, unlike its URL or caller.\n const attributes = identity ? { method, function: identity.name } : { method }\n const parent = request.headers.get('traceparent')\n const settled = await telemetry.withRequestContext(request, {}, () =>\n telemetry.withSpan(spanName, { kind: 'server', ...(parent ? { parent } : {}) }, async (span) => {\n const startedAt = performance.now()\n span?.setAttribute('http.request.method', method)\n if (identity) {\n span?.setAttribute('code.function.name', identity.name)\n span?.setAttribute('code.file.path', identity.filename)\n }\n let outcome = 'error'\n try {\n const value = await work()\n outcome = 'success'\n return { value }\n } catch (error) {\n const status = responseStatus(error)\n if (status !== undefined) span?.setAttribute('http.response.status_code', status)\n if (status === undefined || status >= 500) throw error\n outcome = status >= 400 ? 'refused' : 'success'\n // Returning instead of throwing keeps an intended response from marking the span as failed.\n return { response: error }\n } finally {\n span?.setAttribute('server.function.outcome', outcome)\n await Promise.all([\n telemetry.metrics.count(`${metricPrefix}.requests`, 1, { attributes: { ...attributes, outcome } }),\n telemetry.metrics.histogram(`${metricPrefix}.duration`, Math.max(0, performance.now() - startedAt), {\n unit: 'ms',\n attributes,\n }),\n ])\n }\n }),\n )\n if ('response' in settled) throw settled.response\n return settled.value\n }\n}\n\n/** The status of a thrown `Response`, which `createRpc` rethrows as an `Error` whose cause is that response. */\nfunction responseStatus(error: unknown) {\n const response = error instanceof Error ? error.cause : error\n return response instanceof Response ? response.status : undefined\n}\n\nexport function installPostHogServerTelemetryShutdown(\n telemetry: Pick<PostHogServerTelemetry, 'shutdown'>,\n target: PostHogShutdownProcess = process,\n) {\n let shuttingDown = false\n const listeners = new Map<'SIGINT' | 'SIGTERM', () => void>()\n const remove = () => {\n for (const [signal, listener] of listeners) target.off(signal, listener)\n listeners.clear()\n }\n for (const signal of ['SIGINT', 'SIGTERM'] as const) {\n const listener = () => {\n if (shuttingDown) return\n shuttingDown = true\n void telemetry\n .shutdown()\n .catch(() => undefined)\n .finally(() => {\n remove()\n target.kill(target.pid, signal)\n })\n }\n listeners.set(signal, listener)\n target.on(signal, listener)\n }\n return remove\n}\n\nasync function createPostHogLogProvider(environment: PostHogEnvironment, options: ManagedPostHogServerTelemetryOptions) {\n const [{ OTLPLogExporter }, { resourceFromAttributes }, { BatchLogRecordProcessor, LoggerProvider }] = await Promise.all([\n import('@opentelemetry/exporter-logs-otlp-http'),\n import('@opentelemetry/resources'),\n import('@opentelemetry/sdk-logs'),\n ])\n const exporter = new OTLPLogExporter({\n url: `${environment.host.replace(/\\/$/, '')}/i/v1/logs`,\n headers: { Authorization: `Bearer ${environment.projectToken}` },\n })\n return new LoggerProvider({\n resource: resourceFromAttributes({\n 'service.name': options.serviceName,\n ...(options.serviceVersion ? { 'service.version': options.serviceVersion } : {}),\n ...(options.deploymentEnvironment ? { 'deployment.environment': options.deploymentEnvironment } : {}),\n ...options.resourceAttributes,\n }),\n processors: [new BatchLogRecordProcessor({ exporter })],\n })\n}\n\n/** Names the server function a log or exception was recorded in, so it reads without the request path's opaque id. */\nfunction serverFunctionProperties() {\n const name = currentServerFunction()?.name\n return name ? { server_function: name } : undefined\n}\n\nfunction mergeProperties(...values: Array<Record<string, unknown> | undefined>) {\n const merged = Object.assign({}, ...values.filter(Boolean))\n return Object.keys(merged).length ? merged : undefined\n}\n\nfunction boundedAttributes(attributes: Record<string, unknown> | undefined) {\n if (!attributes) return undefined\n return Object.fromEntries(\n Object.entries(attributes)\n .slice(0, 64)\n .map(([key, value]) => [key.slice(0, 128), boundedLogValue(value, 0)])\n .filter((entry): entry is [string, PostHogLogValue] => entry[1] !== undefined),\n )\n}\n\nfunction boundedLogValue(value: unknown, depth: number): PostHogLogValue | undefined {\n if (value === null || typeof value === 'number' || typeof value === 'boolean') return value\n if (typeof value === 'string') return boundedString(value)\n if (depth >= 3) return '[Truncated]'\n if (Array.isArray(value)) {\n return value\n .slice(0, 32)\n .map((entry) => boundedLogValue(entry, depth + 1))\n .filter((entry): entry is PostHogLogValue => entry !== undefined)\n }\n if (value === undefined) return undefined\n try {\n return boundedString(JSON.stringify(value))\n } catch {\n return '[Unserializable value]'\n }\n}\n\nfunction boundedString(value: string) {\n return value.slice(0, 2_048)\n}\n\nasync function shutdownPostHogLogProvider(provider: LogProvider, timeoutMs: number) {\n const timer = new AbortController()\n try {\n await Promise.race([\n provider.shutdown(),\n delay(timeoutMs, undefined, { ref: false, signal: timer.signal }).then(() => {\n throw new Error(`PostHog log shutdown timed out after ${timeoutMs}ms`)\n }),\n ])\n } finally {\n timer.abort()\n }\n}\n\nfunction assertShutdownTimeout(timeoutMs: number) {\n if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 0) throw new Error('timeoutMs must be a non-negative integer')\n}\n"]}
@@ -1,8 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import { QueryClient, type DehydratedState, type QueryClientConfig } from '@tanstack/react-query';
3
- export declare function createQueryClient(config?: QueryClientConfig): QueryClient;
4
- export declare function QueryProvider({ children, client, state }: {
5
- children?: ReactNode;
6
- client: QueryClient;
7
- state?: DehydratedState;
8
- }): import("react").FunctionComponentElement<import("@tanstack/react-query").QueryClientProviderProps>;
@@ -1,17 +0,0 @@
1
- import { createElement } from 'react';
2
- import { HydrationBoundary, QueryClient, QueryClientProvider } from '@tanstack/react-query';
3
- export function createQueryClient(config = {}) {
4
- return new QueryClient({
5
- ...config,
6
- defaultOptions: {
7
- ...config.defaultOptions,
8
- queries: { staleTime: 60_000, ...config.defaultOptions?.queries },
9
- },
10
- });
11
- }
12
- export function QueryProvider({ children, client, state }) {
13
- if (!client)
14
- throw new Error('QueryProvider requires a client with an application-owned lifetime');
15
- return createElement(QueryClientProvider, { client }, createElement(HydrationBoundary, { state }, children));
16
- }
17
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/query/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,OAAO,CAAA;AACrD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,mBAAmB,EAAgD,MAAM,uBAAuB,CAAA;AAEzI,MAAM,UAAU,iBAAiB,CAAC,MAAM,GAAsB,EAAE;IAC9D,OAAO,IAAI,WAAW,CAAC;QACrB,GAAG,MAAM;QACT,cAAc,EAAE;YACd,GAAG,MAAM,CAAC,cAAc;YACxB,OAAO,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,cAAc,EAAE,OAAO,EAAE;SAClE;KACF,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAA0E;IAC/H,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAA;IAClG,OAAO,aAAa,CAAC,mBAAmB,EAAE,EAAE,MAAM,EAAE,EAAE,aAAa,CAAC,iBAAiB,EAAE,EAAE,KAAK,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAA;AAC9G,CAAC","sourcesContent":["import { createElement, type ReactNode } from 'react'\nimport { HydrationBoundary, QueryClient, QueryClientProvider, type DehydratedState, type QueryClientConfig } from '@tanstack/react-query'\n\nexport function createQueryClient(config: QueryClientConfig = {}): QueryClient {\n return new QueryClient({\n ...config,\n defaultOptions: {\n ...config.defaultOptions,\n queries: { staleTime: 60_000, ...config.defaultOptions?.queries },\n },\n })\n}\n\nexport function QueryProvider({ children, client, state }: { children?: ReactNode; client: QueryClient; state?: DehydratedState }) {\n if (!client) throw new Error('QueryProvider requires a client with an application-owned lifetime')\n return createElement(QueryClientProvider, { client }, createElement(HydrationBoundary, { state }, children))\n}\n"]}
@@ -1,19 +0,0 @@
1
- import { Centrifuge, type Options, type ServerPublicationContext, type ServerSubscribedContext } from 'centrifuge';
2
- type BrowserLocation = Pick<Location, 'host' | 'protocol'>;
3
- export type RealtimeTicketOptions<T> = {
4
- fetch?: typeof fetch;
5
- init?: RequestInit;
6
- parse: (value: unknown) => T;
7
- unauthorizedStatuses?: readonly number[];
8
- errorMessage?: (status: number) => string;
9
- };
10
- export declare function requestRealtimeTicket<T>(input: RequestInfo | URL, options: RealtimeTicketOptions<T>): Promise<T>;
11
- export declare function createSameOriginRealtimeClient(options: Partial<Options>, config?: {
12
- location?: BrowserLocation;
13
- path?: string;
14
- }): Centrifuge;
15
- export declare function watchServerChannel(client: Centrifuge, channel: string, handlers: {
16
- publication?: (context: ServerPublicationContext) => void;
17
- unrecovered?: (context: ServerSubscribedContext) => void;
18
- }): () => void;
19
- export {};
@@ -1,37 +0,0 @@
1
- import { Centrifuge, UnauthorizedError } from 'centrifuge';
2
- function sameOriginWebSocketUrl(location, path = '/connection/websocket') {
3
- if (!path.startsWith('/') || path.startsWith('//'))
4
- throw new Error('WebSocket path must be same-origin');
5
- const url = new URL(path, `${location.protocol}//${location.host}`);
6
- url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:';
7
- return url.toString();
8
- }
9
- export async function requestRealtimeTicket(input, options) {
10
- const response = await (options.fetch ?? fetch)(input, options.init);
11
- if ((options.unauthorizedStatuses ?? [401, 403]).includes(response.status))
12
- throw new UnauthorizedError('unauthorized');
13
- if (!response.ok)
14
- throw new Error(options.errorMessage?.(response.status) ?? `Realtime authentication failed with status ${response.status}`);
15
- return options.parse(await response.json());
16
- }
17
- export function createSameOriginRealtimeClient(options, config = {}) {
18
- const location = config.location ?? window.location;
19
- return new Centrifuge(sameOriginWebSocketUrl(location, config.path), options);
20
- }
21
- export function watchServerChannel(client, channel, handlers) {
22
- const publication = (context) => {
23
- if (context.channel === channel)
24
- handlers.publication?.(context);
25
- };
26
- const subscribed = (context) => {
27
- if (context.channel === channel && context.wasRecovering && !context.recovered)
28
- handlers.unrecovered?.(context);
29
- };
30
- client.on('publication', publication);
31
- client.on('subscribed', subscribed);
32
- return () => {
33
- client.off('publication', publication);
34
- client.off('subscribed', subscribed);
35
- };
36
- }
37
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/realtime/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAA6E,MAAM,YAAY,CAAA;AAIrI,SAAS,sBAAsB,CAAC,QAAyB,EAAE,IAAI,GAAG,uBAAuB;IACvF,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,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ClB,OAAe,EACf,QAAiI;IAEjI,MAAM,WAAW,GAAG,CAAC,OAAiC,EAAE,EAAE;QACxD,IAAI,OAAO,CAAC,OAAO,KAAK,OAAO;YAAE,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,CAAA;IAClE,CAAC,CAAA;IACD,MAAM,UAAU,GAAG,CAAC,OAAgC,EAAE,EAAE;QACtD,IAAI,OAAO,CAAC,OAAO,KAAK,OAAO,IAAI,OAAO,CAAC,aAAa,IAAI,CAAC,OAAO,CAAC,SAAS;YAAE,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,CAAA;IACjH,CAAC,CAAA;IACD,MAAM,CAAC,EAAE,CAAC,aAAa,EAAE,WAAW,CAAC,CAAA;IACrC,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE,UAAU,CAAC,CAAA;IACnC,OAAO,GAAG,EAAE;QACV,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,WAAW,CAAC,CAAA;QACtC,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAA;IACtC,CAAC,CAAA;AACH,CAAC","sourcesContent":["import { Centrifuge, UnauthorizedError, type Options, type ServerPublicationContext, type ServerSubscribedContext } from 'centrifuge'\n\ntype BrowserLocation = Pick<Location, 'host' | 'protocol'>\n\nfunction sameOriginWebSocketUrl(location: BrowserLocation, path = '/connection/websocket') {\n if (!path.startsWith('/') || path.startsWith('//')) throw new Error('WebSocket path must be same-origin')\n const url = new URL(path, `${location.protocol}//${location.host}`)\n url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:'\n return url.toString()\n}\n\nexport type RealtimeTicketOptions<T> = {\n fetch?: typeof fetch\n init?: RequestInit\n parse: (value: unknown) => T\n unauthorizedStatuses?: readonly number[]\n errorMessage?: (status: number) => string\n}\n\nexport async function requestRealtimeTicket<T>(input: RequestInfo | URL, options: RealtimeTicketOptions<T>) {\n const response = await (options.fetch ?? fetch)(input, options.init)\n if ((options.unauthorizedStatuses ?? [401, 403]).includes(response.status)) throw new UnauthorizedError('unauthorized')\n if (!response.ok)\n throw new Error(options.errorMessage?.(response.status) ?? `Realtime authentication failed with status ${response.status}`)\n return options.parse(await response.json())\n}\n\nexport function createSameOriginRealtimeClient(options: Partial<Options>, config: { location?: BrowserLocation; path?: string } = {}) {\n const location = config.location ?? window.location\n return new Centrifuge(sameOriginWebSocketUrl(location, config.path), options)\n}\n\nexport function watchServerChannel(\n client: Centrifuge,\n channel: string,\n handlers: { publication?: (context: ServerPublicationContext) => void; unrecovered?: (context: ServerSubscribedContext) => void },\n) {\n const publication = (context: ServerPublicationContext) => {\n if (context.channel === channel) handlers.publication?.(context)\n }\n const subscribed = (context: ServerSubscribedContext) => {\n if (context.channel === channel && context.wasRecovering && !context.recovered) handlers.unrecovered?.(context)\n }\n client.on('publication', publication)\n client.on('subscribed', subscribed)\n return () => {\n client.off('publication', publication)\n client.off('subscribed', subscribed)\n }\n}\n"]}
@@ -1,10 +0,0 @@
1
- export type RealtimeEnvironmentOptions = {
2
- prefix?: string;
3
- developmentSecret?: string;
4
- };
5
- export type RealtimeEnvironment = {
6
- apiUrl: string;
7
- apiKey: string;
8
- secret: string;
9
- };
10
- export declare function realtimeEnvironment(environment?: NodeJS.ProcessEnv, options?: RealtimeEnvironmentOptions): RealtimeEnvironment | undefined;
@@ -1,28 +0,0 @@
1
- import fs from 'node:fs';
2
- import { errorHasCode } from '../server/errors.js';
3
- export function realtimeEnvironment(environment = process.env, options = {}) {
4
- const value = (name) => environment[`${options.prefix ?? ''}REALTIME_${name}`]?.trim() || undefined;
5
- const secret = value('SECRET') ??
6
- secretFromFile(value('SECRET_FILE')) ??
7
- (environment.NODE_ENV === 'production' ? undefined : options.developmentSecret);
8
- if (!secret)
9
- return undefined;
10
- return {
11
- apiUrl: (value('API_URL') ?? 'http://127.0.0.1:8000/api').replace(/\/$/, ''),
12
- apiKey: value('API_KEY') ?? secret,
13
- secret,
14
- };
15
- }
16
- function secretFromFile(file) {
17
- if (!file)
18
- return undefined;
19
- try {
20
- return fs.readFileSync(file, 'utf8').trim() || undefined;
21
- }
22
- catch (error) {
23
- if (errorHasCode(error, 'ENOENT'))
24
- return undefined;
25
- throw error;
26
- }
27
- }
28
- //# sourceMappingURL=environment.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/realtime/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AASlD,MAAM,UAAU,mBAAmB,CACjC,WAAW,GAAsB,OAAO,CAAC,GAAG,EAC5C,OAAO,GAA+B,EAAE;IAExC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,MAAM,IAAI,EAAE,YAAY,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,SAAS,CAAA;IAC3G,MAAM,MAAM,GACV,KAAK,CAAC,QAAQ,CAAC;QACf,cAAc,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACpC,CAAC,WAAW,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAA;IACjF,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAA;IAC7B,OAAO;QACL,MAAM,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,2BAA2B,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;QAC5E,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,MAAM;QAClC,MAAM;KACP,CAAA;AACH,CAAC;AAED,SAAS,cAAc,CAAC,IAAwB;IAC9C,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAA;IAC3B,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,SAAS,CAAA;IAC1D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC;YAAE,OAAO,SAAS,CAAA;QACnD,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC","sourcesContent":["import fs from 'node:fs'\nimport { errorHasCode } from '../server/errors.js'\n\nexport type RealtimeEnvironmentOptions = {\n prefix?: string\n developmentSecret?: string\n}\n\nexport type RealtimeEnvironment = { apiUrl: string; apiKey: string; secret: string }\n\nexport function realtimeEnvironment(\n environment: NodeJS.ProcessEnv = process.env,\n options: RealtimeEnvironmentOptions = {},\n): RealtimeEnvironment | undefined {\n const value = (name: string) => environment[`${options.prefix ?? ''}REALTIME_${name}`]?.trim() || undefined\n const secret =\n value('SECRET') ??\n secretFromFile(value('SECRET_FILE')) ??\n (environment.NODE_ENV === 'production' ? undefined : options.developmentSecret)\n if (!secret) return undefined\n return {\n apiUrl: (value('API_URL') ?? 'http://127.0.0.1:8000/api').replace(/\\/$/, ''),\n apiKey: value('API_KEY') ?? secret,\n secret,\n }\n}\n\nfunction secretFromFile(file: string | undefined) {\n if (!file) return undefined\n try {\n return fs.readFileSync(file, 'utf8').trim() || undefined\n } catch (error) {\n if (errorHasCode(error, 'ENOENT')) return undefined\n throw error\n }\n}\n"]}
@@ -1,6 +0,0 @@
1
- export { CentrifugoPublisher } from './publisher.js';
2
- export type { CentrifugoPublisherOptions } from './publisher.js';
3
- export { signRealtimeToken } from './tokens.js';
4
- export type { RealtimeTokenOptions } from './tokens.js';
5
- export { realtimeEnvironment } from './environment.js';
6
- export type { RealtimeEnvironment, RealtimeEnvironmentOptions } from './environment.js';
@@ -1,4 +0,0 @@
1
- export { CentrifugoPublisher } from './publisher.js';
2
- export { signRealtimeToken } from './tokens.js';
3
- export { realtimeEnvironment } from './environment.js';
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/realtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA","sourcesContent":["export { CentrifugoPublisher } from './publisher.js'\nexport type { CentrifugoPublisherOptions } from './publisher.js'\nexport { signRealtimeToken } from './tokens.js'\nexport type { RealtimeTokenOptions } from './tokens.js'\nexport { realtimeEnvironment } from './environment.js'\nexport type { RealtimeEnvironment, RealtimeEnvironmentOptions } from './environment.js'\n"]}