better-ship 0.35.1 → 0.37.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 (47) hide show
  1. package/dist/application.d.ts +2 -2
  2. package/dist/application.js +2 -1
  3. package/dist/browser-user.d.ts +14 -0
  4. package/dist/browser-user.d.ts.map +1 -0
  5. package/dist/browser-user.js +25 -0
  6. package/dist/browser-user.js.map +1 -0
  7. package/dist/cloudflare/queue.d.ts +1 -1
  8. package/dist/cloudflare.d.ts +2 -2
  9. package/dist/{index-CbvNd665.d.ts → index-BosM_da2.d.ts} +8 -2
  10. package/dist/index-BosM_da2.d.ts.map +1 -0
  11. package/dist/{metrics-DXhrc6ii.d.ts → metrics-B89jvpZQ.d.ts} +2 -2
  12. package/dist/{metrics-DXhrc6ii.d.ts.map → metrics-B89jvpZQ.d.ts.map} +1 -1
  13. package/dist/{outbox-repository-options-gk3JOjLB.d.ts → outbox-repository-options-A2fA1UDX.d.ts} +2 -2
  14. package/dist/{outbox-repository-options-gk3JOjLB.d.ts.map → outbox-repository-options-A2fA1UDX.d.ts.map} +1 -1
  15. package/dist/postgres.d.ts +2 -2
  16. package/dist/posthog/metrics.d.ts +1 -1
  17. package/dist/posthog/server.d.ts +2 -2
  18. package/dist/request-user-B4rh1c2-.js +19 -0
  19. package/dist/request-user-B4rh1c2-.js.map +1 -0
  20. package/dist/resend.d.ts +1 -1
  21. package/dist/sentry/server.d.ts +5 -2
  22. package/dist/sentry/server.d.ts.map +1 -1
  23. package/dist/sentry/server.js +9 -1
  24. package/dist/sentry/server.js.map +1 -1
  25. package/dist/tanstack/oxlint.d.ts +10 -0
  26. package/dist/tanstack/oxlint.d.ts.map +1 -0
  27. package/dist/tanstack/oxlint.js +256 -0
  28. package/dist/tanstack/oxlint.js.map +1 -0
  29. package/dist/tanstack.d.ts +1 -1
  30. package/dist/tanstack.d.ts.map +1 -1
  31. package/dist/tanstack.js +3 -1
  32. package/dist/tanstack.js.map +1 -1
  33. package/dist/testing/outbox-repository.d.ts +1 -1
  34. package/package.json +5 -1
  35. package/src/application/index.ts +1 -0
  36. package/src/application/request-user.ts +18 -0
  37. package/src/infrastructure/observability/browser-user.ts +24 -0
  38. package/src/infrastructure/sentry/server.ts +11 -1
  39. package/src/infrastructure/tanstack/auth.middleware.ts +3 -1
  40. package/src/infrastructure/tanstack/oxlint/form-options.ts +58 -0
  41. package/src/infrastructure/tanstack/oxlint/form-schema-validators.ts +57 -0
  42. package/src/infrastructure/tanstack/oxlint/form-stable-default-values.ts +46 -0
  43. package/src/infrastructure/tanstack/oxlint/index.ts +25 -0
  44. package/src/infrastructure/tanstack/oxlint/no-field-validators.ts +40 -0
  45. package/src/infrastructure/tanstack/oxlint/no-submit-branching.ts +38 -0
  46. package/src/infrastructure/tanstack/oxlint/query-key-from-factory.ts +36 -0
  47. package/dist/index-CbvNd665.d.ts.map +0 -1
@@ -1,3 +1,3 @@
1
1
  import { G as DomainMessage, K as DomainQuery, U as DomainCommand, W as DomainEvent, q as MessageId } from "./index-DUFS0SJ_.js";
2
- import { $ as AnalyticsService, A as IOutboxRepository, B as OutboundEmail, C as UnitOfWorkDeps, D as OutboxRelay, E as IOutboxRelay, F as IEventCollector, G as ObservabilityScope, H as ReceivedContent, I as EmailAccepted, J as MetricAttributeValue, K as ObservabilityService, L as EmailAttachment, M as OutboxClaim, N as OutboxMessage, O as OutboxRelayOptions, P as IMessageStore, Q as NULL_METRICS_SERVICE, R as IEmailService, S as UnitOfWork, T as IOutboxPublisher, U as ReceivedEmail, V as ReceivedAttachment, W as RecordingEmailService, X as MetricOptions, Y as MetricAttributes, Z as MetricsService, _ as RecordEmailEventCommand, a as OutboxRetentionResult, b as recordEmailEvent, c as CommandRegistry, d as MessageRegistry, et as NULL_ANALYTICS, f as MessageResult, g as IEmailDeliverabilityStore, h as EmailBounceRecord, i as OutboxRetentionOptions, j as IOutboxRetentionRepository, k as DeadLetterReason, l as EventRegistry, m as RegistryMessage, n as MessageAlreadyProcessedError, nt as EventHandler, o as IMessageBus, p as QueryRegistry, q as ObservabilityUser, r as OutboxRetention, rt as QueryHandler, s as MessageBus, t as UnitOfWorkAlreadyActiveError, tt as CommandHandler, u as Handlers, v as RecordEmailEventDeps, w as ITransaction, x as IUnitOfWork, y as RecordEmailEventRepos, z as MimeType } from "./index-CbvNd665.js";
3
- export { type AnalyticsService, type CommandHandler, type CommandRegistry, type DeadLetterReason, type DomainCommand, type DomainEvent, type DomainMessage, type DomainQuery, type EmailAccepted, type EmailAttachment, type EmailBounceRecord, type EventHandler, type EventRegistry, type Handlers, type IEmailDeliverabilityStore, type IEmailService, type IEventCollector, type IMessageBus, type IMessageStore, type IOutboxPublisher, type IOutboxRelay, type IOutboxRepository, type IOutboxRetentionRepository, type ITransaction, type IUnitOfWork, MessageAlreadyProcessedError, MessageBus, type MessageId, type MessageRegistry, type MessageResult, type MetricAttributeValue, type MetricAttributes, type MetricOptions, type MetricsService, type MimeType, NULL_ANALYTICS, NULL_METRICS_SERVICE, type ObservabilityScope, type ObservabilityService, type ObservabilityUser, type OutboundEmail, type OutboxClaim, type OutboxMessage, OutboxRelay, type OutboxRelayOptions, OutboxRetention, type OutboxRetentionOptions, type OutboxRetentionResult, type QueryHandler, type QueryRegistry, type ReceivedAttachment, type ReceivedContent, type ReceivedEmail, type RecordEmailEventCommand, type RecordEmailEventDeps, type RecordEmailEventRepos, RecordingEmailService, type RegistryMessage, UnitOfWork, UnitOfWorkAlreadyActiveError, type UnitOfWorkDeps, recordEmailEvent };
2
+ import { $ as MetricsService, A as IOutboxRepository, B as OutboundEmail, C as UnitOfWorkDeps, D as OutboxRelay, E as IOutboxRelay, F as IEventCollector, G as applyObservabilityUser, H as ReceivedContent, I as EmailAccepted, J as ObservabilityService, K as setObservabilityUserHook, L as EmailAttachment, M as OutboxClaim, N as OutboxMessage, O as OutboxRelayOptions, P as IMessageStore, Q as MetricOptions, R as IEmailService, S as UnitOfWork, T as IOutboxPublisher, U as ReceivedEmail, V as ReceivedAttachment, W as RecordingEmailService, X as MetricAttributeValue, Y as ObservabilityUser, Z as MetricAttributes, _ as RecordEmailEventCommand, a as OutboxRetentionResult, at as QueryHandler, b as recordEmailEvent, c as CommandRegistry, d as MessageRegistry, et as NULL_METRICS_SERVICE, f as MessageResult, g as IEmailDeliverabilityStore, h as EmailBounceRecord, i as OutboxRetentionOptions, it as EventHandler, j as IOutboxRetentionRepository, k as DeadLetterReason, l as EventRegistry, m as RegistryMessage, n as MessageAlreadyProcessedError, nt as NULL_ANALYTICS, o as IMessageBus, p as QueryRegistry, q as ObservabilityScope, r as OutboxRetention, rt as CommandHandler, s as MessageBus, t as UnitOfWorkAlreadyActiveError, tt as AnalyticsService, u as Handlers, v as RecordEmailEventDeps, w as ITransaction, x as IUnitOfWork, y as RecordEmailEventRepos, z as MimeType } from "./index-BosM_da2.js";
3
+ export { type AnalyticsService, type CommandHandler, type CommandRegistry, type DeadLetterReason, type DomainCommand, type DomainEvent, type DomainMessage, type DomainQuery, type EmailAccepted, type EmailAttachment, type EmailBounceRecord, type EventHandler, type EventRegistry, type Handlers, type IEmailDeliverabilityStore, type IEmailService, type IEventCollector, type IMessageBus, type IMessageStore, type IOutboxPublisher, type IOutboxRelay, type IOutboxRepository, type IOutboxRetentionRepository, type ITransaction, type IUnitOfWork, MessageAlreadyProcessedError, MessageBus, type MessageId, type MessageRegistry, type MessageResult, type MetricAttributeValue, type MetricAttributes, type MetricOptions, type MetricsService, type MimeType, NULL_ANALYTICS, NULL_METRICS_SERVICE, type ObservabilityScope, type ObservabilityService, type ObservabilityUser, type OutboundEmail, type OutboxClaim, type OutboxMessage, OutboxRelay, type OutboxRelayOptions, OutboxRetention, type OutboxRetentionOptions, type OutboxRetentionResult, type QueryHandler, type QueryRegistry, type ReceivedAttachment, type ReceivedContent, type ReceivedEmail, type RecordEmailEventCommand, type RecordEmailEventDeps, type RecordEmailEventRepos, RecordingEmailService, type RegistryMessage, UnitOfWork, UnitOfWorkAlreadyActiveError, type UnitOfWorkDeps, applyObservabilityUser, recordEmailEvent, setObservabilityUserHook };
@@ -1,3 +1,4 @@
1
1
  import { a as MessageBus, c as RecordingEmailService, i as OutboxRelay, l as NULL_METRICS_SERVICE, n as UnitOfWork, o as MessageAlreadyProcessedError, r as OutboxRetention, s as recordEmailEvent, t as UnitOfWorkAlreadyActiveError, u as NULL_ANALYTICS } from "./application-B5hnNUdI.js";
2
+ import { n as setObservabilityUserHook, t as applyObservabilityUser } from "./request-user-B4rh1c2-.js";
2
3
 
3
- export { MessageAlreadyProcessedError, MessageBus, NULL_ANALYTICS, NULL_METRICS_SERVICE, OutboxRelay, OutboxRetention, RecordingEmailService, UnitOfWork, UnitOfWorkAlreadyActiveError, recordEmailEvent };
4
+ export { MessageAlreadyProcessedError, MessageBus, NULL_ANALYTICS, NULL_METRICS_SERVICE, OutboxRelay, OutboxRetention, RecordingEmailService, UnitOfWork, UnitOfWorkAlreadyActiveError, applyObservabilityUser, recordEmailEvent, setObservabilityUserHook };
@@ -0,0 +1,14 @@
1
+ //#region src/infrastructure/observability/browser-user.d.ts
2
+ /**
3
+ * Identify the signed-in user in PostHog and Sentry.
4
+ * Sends the id only. A client that is not initialized does nothing.
5
+ * Call it when the session user id is present. A loading session does not call it.
6
+ */
7
+ export declare function identifyObservabilityUser(userId: string): void;
8
+ /**
9
+ * Clear the Sentry user and reset PostHog on sign-out.
10
+ * A disabled client does nothing. Call this once from the application's sign-out path.
11
+ */
12
+ export declare function clearObservabilityUser(): void;
13
+ //#endregion
14
+ //# sourceMappingURL=browser-user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-user.d.ts","names":[],"sources":["../src/infrastructure/observability/browser-user.ts"],"mappings":";;;;;;wBAQgB,0BAA0B;;;;;wBAW1B"}
@@ -0,0 +1,25 @@
1
+ import * as Sentry from "@sentry/tanstackstart-react";
2
+ import { posthog as posthog$1 } from "posthog-js";
3
+
4
+ //#region src/infrastructure/observability/browser-user.ts
5
+ /**
6
+ * Identify the signed-in user in PostHog and Sentry.
7
+ * Sends the id only. A client that is not initialized does nothing.
8
+ * Call it when the session user id is present. A loading session does not call it.
9
+ */
10
+ function identifyObservabilityUser(userId) {
11
+ if (posthog$1.__loaded) posthog$1.identify(userId);
12
+ if (Sentry.isEnabled()) Sentry.setUser({ id: userId });
13
+ }
14
+ /**
15
+ * Clear the Sentry user and reset PostHog on sign-out.
16
+ * A disabled client does nothing. Call this once from the application's sign-out path.
17
+ */
18
+ function clearObservabilityUser() {
19
+ if (posthog$1.__loaded) posthog$1.reset();
20
+ if (Sentry.isEnabled()) Sentry.setUser(null);
21
+ }
22
+
23
+ //#endregion
24
+ export { clearObservabilityUser, identifyObservabilityUser };
25
+ //# sourceMappingURL=browser-user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-user.js","names":["posthog"],"sources":["../src/infrastructure/observability/browser-user.ts"],"sourcesContent":["import * as Sentry from '@sentry/tanstackstart-react'\nimport { posthog } from 'posthog-js'\n\n/**\n * Identify the signed-in user in PostHog and Sentry.\n * Sends the id only. A client that is not initialized does nothing.\n * Call it when the session user id is present. A loading session does not call it.\n */\nexport function identifyObservabilityUser(userId: string): void {\n // identify() warns when the SDK is not loaded. A disabled client must stay silent.\n // oxlint-disable-next-line no-underscore-dangle -- PostHog's public loaded flag. There is no other initialized check.\n if (posthog.__loaded) posthog.identify(userId)\n if (Sentry.isEnabled()) Sentry.setUser({ id: userId })\n}\n\n/**\n * Clear the Sentry user and reset PostHog on sign-out.\n * A disabled client does nothing. Call this once from the application's sign-out path.\n */\nexport function clearObservabilityUser(): void {\n // oxlint-disable-next-line no-underscore-dangle -- Same loaded flag as identifyObservabilityUser.\n if (posthog.__loaded) posthog.reset()\n if (Sentry.isEnabled()) Sentry.setUser(null)\n}\n"],"mappings":";;;;;;;;;AAQA,SAAgB,0BAA0B,QAAsB;CAG9D,IAAIA,UAAQ,UAAU,UAAQ,SAAS,MAAM;CAC7C,IAAI,OAAO,UAAU,GAAG,OAAO,QAAQ,EAAE,IAAI,OAAO,CAAC;AACvD;;;;;AAMA,SAAgB,yBAA+B;CAE7C,IAAIA,UAAQ,UAAU,UAAQ,MAAM;CACpC,IAAI,OAAO,UAAU,GAAG,OAAO,QAAQ,IAAI;AAC7C"}
@@ -1,5 +1,5 @@
1
1
  import { U as DomainCommand, W as DomainEvent, Xt as AppError, Zt as FailureClassification } from "../index-DUFS0SJ_.js";
2
- import { D as OutboxRelay, E as IOutboxRelay } from "../index-CbvNd665.js";
2
+ import { D as OutboxRelay, E as IOutboxRelay } from "../index-BosM_da2.js";
3
3
  import { z } from "zod";
4
4
  //#region src/infrastructure/cloudflare/queue/queue-message.d.ts
5
5
  /** A message a queue carries: a command from outside the request, or an event from the outbox. */
@@ -1,6 +1,6 @@
1
1
  import { W as DomainEvent, et as D1ConstraintKind, nt as DatabaseFailure, q as MessageId, tt as DatabaseError } from "./index-DUFS0SJ_.js";
2
- import { A as IOutboxRepository, M as OutboxClaim, N as OutboxMessage, P as IMessageStore, k as DeadLetterReason, w as ITransaction } from "./index-CbvNd665.js";
3
- import { n as eventCollector, r as DrizzleSchema, t as OutboxRepositoryOptions } from "./outbox-repository-options-gk3JOjLB.js";
2
+ import { A as IOutboxRepository, M as OutboxClaim, N as OutboxMessage, P as IMessageStore, k as DeadLetterReason, w as ITransaction } from "./index-BosM_da2.js";
3
+ import { n as eventCollector, r as DrizzleSchema, t as OutboxRepositoryOptions } from "./outbox-repository-options-A2fA1UDX.js";
4
4
  import { BatchItem } from "drizzle-orm/batch";
5
5
  import { AnyD1Database, DrizzleD1Database } from "drizzle-orm/d1";
6
6
  //#region src/infrastructure/cloudflare/d1-database-types.d.ts
@@ -66,6 +66,12 @@ interface ObservabilityService extends ObservabilityScope {
66
66
  withIsolationScope<T>(callback: (scope: ObservabilityScope) => T | Promise<T>): Promise<T>;
67
67
  }
68
68
  //#endregion
69
+ //#region src/application/request-user.d.ts
70
+ /** Set or clear the process-wide request user hook. */
71
+ declare function setObservabilityUserHook(hook: ((user: ObservabilityUser) => void) | null): void;
72
+ /** Attribute the current execution to this user. No hook means the call does nothing. */
73
+ declare function applyObservabilityUser(user: ObservabilityUser): void;
74
+ //#endregion
69
75
  //#region src/application/email-service.d.ts
70
76
  /** A media type such as `application/pdf`. */
71
77
  type MimeType = `${string}/${string}`;
@@ -409,5 +415,5 @@ declare class UnitOfWorkAlreadyActiveError extends AppError {
409
415
  constructor();
410
416
  }
411
417
  //#endregion
412
- export { AnalyticsService as $, IOutboxRepository as A, OutboundEmail as B, UnitOfWorkDeps as C, OutboxRelay as D, IOutboxRelay as E, IEventCollector as F, ObservabilityScope as G, ReceivedContent as H, EmailAccepted as I, MetricAttributeValue as J, ObservabilityService as K, EmailAttachment as L, OutboxClaim as M, OutboxMessage as N, OutboxRelayOptions as O, IMessageStore as P, NULL_METRICS_SERVICE as Q, IEmailService as R, UnitOfWork as S, IOutboxPublisher as T, ReceivedEmail as U, ReceivedAttachment as V, RecordingEmailService as W, MetricOptions as X, MetricAttributes as Y, MetricsService as Z, RecordEmailEventCommand as _, OutboxRetentionResult as a, recordEmailEvent as b, CommandRegistry as c, MessageRegistry as d, NULL_ANALYTICS as et, MessageResult as f, IEmailDeliverabilityStore as g, EmailBounceRecord as h, OutboxRetentionOptions as i, IOutboxRetentionRepository as j, DeadLetterReason as k, EventRegistry as l, RegistryMessage as m, MessageAlreadyProcessedError as n, EventHandler as nt, IMessageBus as o, QueryRegistry as p, ObservabilityUser as q, OutboxRetention as r, QueryHandler as rt, MessageBus as s, UnitOfWorkAlreadyActiveError as t, CommandHandler as tt, Handlers as u, RecordEmailEventDeps as v, ITransaction as w, IUnitOfWork as x, RecordEmailEventRepos as y, MimeType as z };
413
- //# sourceMappingURL=index-CbvNd665.d.ts.map
418
+ export { MetricsService as $, IOutboxRepository as A, OutboundEmail as B, UnitOfWorkDeps as C, OutboxRelay as D, IOutboxRelay as E, IEventCollector as F, applyObservabilityUser as G, ReceivedContent as H, EmailAccepted as I, ObservabilityService as J, setObservabilityUserHook as K, EmailAttachment as L, OutboxClaim as M, OutboxMessage as N, OutboxRelayOptions as O, IMessageStore as P, MetricOptions as Q, IEmailService as R, UnitOfWork as S, IOutboxPublisher as T, ReceivedEmail as U, ReceivedAttachment as V, RecordingEmailService as W, MetricAttributeValue as X, ObservabilityUser as Y, MetricAttributes as Z, RecordEmailEventCommand as _, OutboxRetentionResult as a, QueryHandler as at, recordEmailEvent as b, CommandRegistry as c, MessageRegistry as d, NULL_METRICS_SERVICE as et, MessageResult as f, IEmailDeliverabilityStore as g, EmailBounceRecord as h, OutboxRetentionOptions as i, EventHandler as it, IOutboxRetentionRepository as j, DeadLetterReason as k, EventRegistry as l, RegistryMessage as m, MessageAlreadyProcessedError as n, NULL_ANALYTICS as nt, IMessageBus as o, QueryRegistry as p, ObservabilityScope as q, OutboxRetention as r, CommandHandler as rt, MessageBus as s, UnitOfWorkAlreadyActiveError as t, AnalyticsService as tt, Handlers as u, RecordEmailEventDeps as v, ITransaction as w, IUnitOfWork as x, RecordEmailEventRepos as y, MimeType as z };
419
+ //# sourceMappingURL=index-BosM_da2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BosM_da2.d.ts","names":[],"sources":["../src/application/handlers.ts","../src/application/analytics-service.ts","../src/application/metrics-service.ts","../src/application/observability-service.ts","../src/application/request-user.ts","../src/application/email-service.ts","../src/application/event-collector.ts","../src/application/message-store.ts","../src/application/outbox-repository.ts","../src/application/outbox-relay.ts","../src/application/transaction.ts","../src/application/unit-of-work.ts","../src/application/record-email-event.ts","../src/application/registry.ts","../src/application/message-bus.ts","../src/application/outbox-retention.ts","../src/application/message-already-processed.error.ts","../src/application/unit-of-work.errors.ts"],"mappings":";;;;;;KAMY,eAAe,iBAAiB,eAAe,MAAM,UAC/D,SAAS,UACT,MAAM,SACH,QAAQ;;;;;KAMD,aAAa,eAAe,aAAa,WAAW,UAC9D,OAAO,QACP,MAAM,cACH,QAAQ;;KAGD,aAAa,eAAe,aAAa,SACnD,OA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WACA;WACA;WACA;WACA;;;KAIC;WACD;WACA;WACA;;;cAIE;mBAIQ;mBAHF;EAEjB,YACmB,YAAY,4BAC7B,UAAS;;EAYL,MAAM,IAAI,OAAO,QAAQ;UAcjB;;;;;cC/CH,qCAAqC;WAKrC,WAAW;WAJb;WACA;EAET,YACW,WAAW,WACpB;aAAqB;;;SAMhB,KAAK,gBAAgB,WAAW,YAAY;;;;;cCZxC,qCAAqC;WACvC;WACA;EAET"}
@@ -1,4 +1,4 @@
1
- import { X as MetricOptions, Z as MetricsService } from "./index-CbvNd665.js";
1
+ import { $ as MetricsService, Q as MetricOptions } from "./index-BosM_da2.js";
2
2
  import { PostHog } from "posthog-node";
3
3
  //#region src/infrastructure/posthog/metrics.d.ts
4
4
  /** PostHog Metrics with Worker lifetime management, ported from Typist's metrics-service.ts. */
@@ -16,4 +16,4 @@ declare class PostHogMetricsService implements MetricsService {
16
16
  }
17
17
  //#endregion
18
18
  export { PostHogMetricsService as t };
19
- //# sourceMappingURL=metrics-DXhrc6ii.d.ts.map
19
+ //# sourceMappingURL=metrics-B89jvpZQ.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"metrics-DXhrc6ii.d.ts","names":[],"sources":["../src/infrastructure/posthog/metrics.ts"],"mappings":";;;;cAKa,iCAAiC;mBAGzB;mBACA;;EAFnB,YACmB,QAAQ,KAAK,qBACb,YAAY,SAAS;;EAIxC,MAAM,cAAc,gBAAW,UAAU;;EAMzC,MAAM,cAAc,eAAe,UAAU;;EAM7C,UAAU,cAAc,eAAe,UAAU"}
1
+ {"version":3,"file":"metrics-B89jvpZQ.d.ts","names":[],"sources":["../src/infrastructure/posthog/metrics.ts"],"mappings":";;;;cAKa,iCAAiC;mBAGzB;mBACA;;EAFnB,YACmB,QAAQ,KAAK,qBACb,YAAY,SAAS;;EAIxC,MAAM,cAAc,gBAAW,UAAU;;EAMzC,MAAM,cAAc,eAAe,UAAU;;EAM7C,UAAU,cAAc,eAAe,UAAU"}
@@ -1,5 +1,5 @@
1
1
  import "./index-DUFS0SJ_.js";
2
- import { F as IEventCollector } from "./index-CbvNd665.js";
2
+ import { F as IEventCollector } from "./index-BosM_da2.js";
3
3
  import { BatchItem } from "drizzle-orm/batch";
4
4
  //#region src/infrastructure/drizzle-schema.d.ts
5
5
  /**
@@ -23,4 +23,4 @@ declare const OUTBOX_REPOSITORY_DEFAULTS: {
23
23
  type OutboxRepositoryOptions = Readonly<Partial<typeof OUTBOX_REPOSITORY_DEFAULTS>>;
24
24
  //#endregion
25
25
  export { eventCollector as n, DrizzleSchema as r, OutboxRepositoryOptions as t };
26
- //# sourceMappingURL=outbox-repository-options-gk3JOjLB.d.ts.map
26
+ //# sourceMappingURL=outbox-repository-options-A2fA1UDX.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"outbox-repository-options-gk3JOjLB.d.ts","names":[],"sources":["../src/infrastructure/drizzle-schema.ts","../src/infrastructure/unit-of-work-context.ts","../src/infrastructure/outbox-repository-options.ts"],"mappings":";;;;;;;;KAKY,gBAAgB;;;;cCuBf,gBAAgB;;;;cC3BhB;EACX;EACA;EACA;;;KAIU,0BAA0B,SAAS,eAAe"}
1
+ {"version":3,"file":"outbox-repository-options-A2fA1UDX.d.ts","names":[],"sources":["../src/infrastructure/drizzle-schema.ts","../src/infrastructure/unit-of-work-context.ts","../src/infrastructure/outbox-repository-options.ts"],"mappings":";;;;;;;;KAKY,gBAAgB;;;;cCuBf,gBAAgB;;;;cC3BhB;EACX;EACA;EACA;;;KAIU,0BAA0B,SAAS,eAAe"}
@@ -1,6 +1,6 @@
1
1
  import { W as DomainEvent, Xt as AppError, nt as DatabaseFailure, q as MessageId, tt as DatabaseError } from "./index-DUFS0SJ_.js";
2
- import { A as IOutboxRepository, M as OutboxClaim, N as OutboxMessage, P as IMessageStore, k as DeadLetterReason, w as ITransaction } from "./index-CbvNd665.js";
3
- import { n as eventCollector, r as DrizzleSchema, t as OutboxRepositoryOptions } from "./outbox-repository-options-gk3JOjLB.js";
2
+ import { A as IOutboxRepository, M as OutboxClaim, N as OutboxMessage, P as IMessageStore, k as DeadLetterReason, w as ITransaction } from "./index-BosM_da2.js";
3
+ import { n as eventCollector, r as DrizzleSchema, t as OutboxRepositoryOptions } from "./outbox-repository-options-A2fA1UDX.js";
4
4
  import { ExtractTablesWithRelations } from "drizzle-orm";
5
5
  import { NodePgDatabase, NodePgTransaction } from "drizzle-orm/node-postgres";
6
6
  import { Pool } from "pg";
@@ -1,2 +1,2 @@
1
- import { t as PostHogMetricsService } from "../metrics-DXhrc6ii.js";
1
+ import { t as PostHogMetricsService } from "../metrics-B89jvpZQ.js";
2
2
  export { PostHogMetricsService };
@@ -1,6 +1,6 @@
1
1
  import { Gt as AnalyticsEventIdentity, Kt as AnalyticsEventInput, qt as AnalyticsProperties } from "../index-DUFS0SJ_.js";
2
- import { $ as AnalyticsService } from "../index-CbvNd665.js";
3
- import { t as PostHogMetricsService } from "../metrics-DXhrc6ii.js";
2
+ import { tt as AnalyticsService } from "../index-BosM_da2.js";
3
+ import { t as PostHogMetricsService } from "../metrics-B89jvpZQ.js";
4
4
  import { PostHog, PostHogOptions } from "posthog-node";
5
5
  //#region src/infrastructure/posthog/server.d.ts
6
6
  /** Deployment values and SDK options; the runtime owns delivery promises. */
@@ -0,0 +1,19 @@
1
+ //#region src/application/request-user.ts
2
+ /**
3
+ * Process-wide request user hook.
4
+ * The Sentry server entry sets it once. Auth middleware calls it after a session resolves.
5
+ * The hook does not store a user id. The adapter writes the id on the current isolation scope.
6
+ */
7
+ let observabilityUserHook = null;
8
+ /** Set or clear the process-wide request user hook. */
9
+ function setObservabilityUserHook(hook) {
10
+ observabilityUserHook = hook;
11
+ }
12
+ /** Attribute the current execution to this user. No hook means the call does nothing. */
13
+ function applyObservabilityUser(user) {
14
+ observabilityUserHook?.(user);
15
+ }
16
+
17
+ //#endregion
18
+ export { setObservabilityUserHook as n, applyObservabilityUser as t };
19
+ //# sourceMappingURL=request-user-B4rh1c2-.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-user-B4rh1c2-.js","names":[],"sources":["../src/application/request-user.ts"],"sourcesContent":["import type { ObservabilityUser } from './observability-service.ts'\n\n/**\n * Process-wide request user hook.\n * The Sentry server entry sets it once. Auth middleware calls it after a session resolves.\n * The hook does not store a user id. The adapter writes the id on the current isolation scope.\n */\nlet observabilityUserHook: ((user: ObservabilityUser) => void) | null = null\n\n/** Set or clear the process-wide request user hook. */\nexport function setObservabilityUserHook(hook: ((user: ObservabilityUser) => void) | null): void {\n observabilityUserHook = hook\n}\n\n/** Attribute the current execution to this user. No hook means the call does nothing. */\nexport function applyObservabilityUser(user: ObservabilityUser): void {\n observabilityUserHook?.(user)\n}\n"],"mappings":";;;;;;AAOA,IAAI,wBAAoE;;AAGxE,SAAgB,yBAAyB,MAAwD;CAC/F,wBAAwB;AAC1B;;AAGA,SAAgB,uBAAuB,MAA+B;CACpE,wBAAwB,IAAI;AAC9B"}
package/dist/resend.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jt as BounceType } from "./index-DUFS0SJ_.js";
2
- import { B as OutboundEmail, H as ReceivedContent, I as EmailAccepted, R as IEmailService, U as ReceivedEmail } from "./index-CbvNd665.js";
2
+ import { B as OutboundEmail, H as ReceivedContent, I as EmailAccepted, R as IEmailService, U as ReceivedEmail } from "./index-BosM_da2.js";
3
3
  import { n as WebhookVerifier } from "./webhook-verification-D1c7BY4q.js";
4
4
  import "resend";
5
5
  //#region src/infrastructure/resend/resend-email-service.d.ts
@@ -1,5 +1,5 @@
1
1
  import { u as LoggerErrorHook } from "../index-DUFS0SJ_.js";
2
- import { G as ObservabilityScope, K as ObservabilityService, q as ObservabilityUser } from "../index-CbvNd665.js";
2
+ import { J as ObservabilityService, Y as ObservabilityUser, q as ObservabilityScope } from "../index-BosM_da2.js";
3
3
  import * as Sentry from "@sentry/cloudflare";
4
4
  //#region src/infrastructure/sentry/server.d.ts
5
5
  /** Application-owned deployment settings with the full Cloudflare SDK option contract. */
@@ -8,7 +8,10 @@ export type SentryServerOptions = Sentry.CloudflareOptions & {
8
8
  readonly environment: string;
9
9
  readonly enabled: boolean;
10
10
  };
11
- /** Pass application options to Workers, Durable Objects, and Workflows with the SDK defaults. */
11
+ /**
12
+ * Pass application options to Workers, Durable Objects, and Workflows with the SDK defaults.
13
+ * Registers the request user hook so auth middleware can set `{ id }` on the current isolation scope.
14
+ */
12
15
  export declare function createSentryOptions(options: SentryServerOptions): Sentry.CloudflareOptions;
13
16
  /** Register with setLoggerErrorHook once at startup; an explicit user applies only to this report. */
14
17
  export declare function createSentryLoggerErrorHook(): LoggerErrorHook;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","names":[],"sources":["../../src/infrastructure/sentry/server.ts"],"mappings":";;;;;YAMY,sBAAsB,OAAO;WAC9B;WACA;WACA;;;wBAIK,oBAAoB,SAAS,sBAAsB,OAAO;;wBAK1D,+BAA+B;;qBAWlC,sCAAsC;;EAEjD,QAAQ,MAAM;;EAKR,mBAAmB,GAAG,WAAW,OAAO,uBAAuB,IAAI,QAAQ,KAAK,QAAQ"}
1
+ {"version":3,"file":"server.d.ts","names":[],"sources":["../../src/infrastructure/sentry/server.ts"],"mappings":";;;;;YAQY,sBAAsB,OAAO;WAC9B;WACA;WACA;;;;;;wBAOK,oBAAoB,SAAS,sBAAsB,OAAO;;wBAU1D,+BAA+B;;qBAWlC,sCAAsC;;EAEjD,QAAQ,MAAM;;EAKR,mBAAmB,GAAG,WAAW,OAAO,uBAAuB,IAAI,QAAQ,KAAK,QAAQ"}
@@ -1,8 +1,16 @@
1
+ import { n as setObservabilityUserHook } from "../request-user-B4rh1c2-.js";
1
2
  import * as Sentry from "@sentry/cloudflare";
2
3
 
3
4
  //#region src/infrastructure/sentry/server.ts
4
- /** Pass application options to Workers, Durable Objects, and Workflows with the SDK defaults. */
5
+ /**
6
+ * Pass application options to Workers, Durable Objects, and Workflows with the SDK defaults.
7
+ * Registers the request user hook so auth middleware can set `{ id }` on the current isolation scope.
8
+ */
5
9
  function createSentryOptions(options) {
10
+ setObservabilityUserHook((user) => {
11
+ if (!Sentry.isEnabled()) return;
12
+ Sentry.setUser({ id: user.id });
13
+ });
6
14
  return options;
7
15
  }
8
16
  /** Register with setLoggerErrorHook once at startup; an explicit user applies only to this report. */
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","names":[],"sources":["../../src/infrastructure/sentry/server.ts"],"sourcesContent":["import * as Sentry from '@sentry/cloudflare'\n\nimport type { ObservabilityScope, ObservabilityService, ObservabilityUser } from '@/application'\nimport type { LoggerErrorHook } from '@/core'\n\n/** Application-owned deployment settings with the full Cloudflare SDK option contract. */\nexport type SentryServerOptions = Sentry.CloudflareOptions & {\n readonly dsn: string\n readonly environment: string\n readonly enabled: boolean\n}\n\n/** Pass application options to Workers, Durable Objects, and Workflows with the SDK defaults. */\nexport function createSentryOptions(options: SentryServerOptions): Sentry.CloudflareOptions {\n return options\n}\n\n/** Register with setLoggerErrorHook once at startup; an explicit user applies only to this report. */\nexport function createSentryLoggerErrorHook(): LoggerErrorHook {\n return ({ error, userId, attributes }) => {\n if (userId !== undefined) {\n Sentry.captureException(error, { extra: attributes, user: { id: userId } })\n return\n }\n Sentry.captureException(error, { extra: attributes })\n }\n}\n\n/** Identity and scope adapter from Typist and Porte; call inside Sentry's instrumented runtime. */\nexport class SentryObservabilityService implements ObservabilityService {\n /** Attribute subsequent reports in the current isolation scope. */\n setUser(user: ObservabilityUser): void {\n Sentry.setUser({ id: user.id })\n }\n\n /** Await work in a separate scope for each queue message or concurrent operation. */\n async withIsolationScope<T>(callback: (scope: ObservabilityScope) => T | Promise<T>): Promise<T> {\n return await Sentry.withIsolationScope((scope) =>\n callback({ setUser: (user) => scope.setUser({ id: user.id }) }),\n )\n }\n}\n\nexport { Sentry }\n"],"mappings":";;;;AAaA,SAAgB,oBAAoB,SAAwD;CAC1F,OAAO;AACT;;AAGA,SAAgB,8BAA+C;CAC7D,QAAQ,EAAE,OAAO,QAAQ,iBAAiB;EACxC,IAAI,WAAW,QAAW;GACxB,OAAO,iBAAiB,OAAO;IAAE,OAAO;IAAY,MAAM,EAAE,IAAI,OAAO;GAAE,CAAC;GAC1E;EACF;EACA,OAAO,iBAAiB,OAAO,EAAE,OAAO,WAAW,CAAC;CACtD;AACF;;AAGA,IAAa,6BAAb,MAAwE;;CAEtE,QAAQ,MAA+B;EACrC,OAAO,QAAQ,EAAE,IAAI,KAAK,GAAG,CAAC;CAChC;;CAGA,MAAM,mBAAsB,UAAqE;EAC/F,OAAO,MAAM,OAAO,oBAAoB,UACtC,SAAS,EAAE,UAAU,SAAS,MAAM,QAAQ,EAAE,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC,CAChE;CACF;AACF"}
1
+ {"version":3,"file":"server.js","names":[],"sources":["../../src/infrastructure/sentry/server.ts"],"sourcesContent":["import * as Sentry from '@sentry/cloudflare'\n\nimport type { ObservabilityScope, ObservabilityService, ObservabilityUser } from '@/application'\nimport type { LoggerErrorHook } from '@/core'\n\nimport { setObservabilityUserHook } from '../../application/request-user.ts'\n\n/** Application-owned deployment settings with the full Cloudflare SDK option contract. */\nexport type SentryServerOptions = Sentry.CloudflareOptions & {\n readonly dsn: string\n readonly environment: string\n readonly enabled: boolean\n}\n\n/**\n * Pass application options to Workers, Durable Objects, and Workflows with the SDK defaults.\n * Registers the request user hook so auth middleware can set `{ id }` on the current isolation scope.\n */\nexport function createSentryOptions(options: SentryServerOptions): Sentry.CloudflareOptions {\n // Auth middleware cannot import this SDK. The hook writes `{ id }` only when Sentry is enabled.\n setObservabilityUserHook((user) => {\n if (!Sentry.isEnabled()) return\n Sentry.setUser({ id: user.id })\n })\n return options\n}\n\n/** Register with setLoggerErrorHook once at startup; an explicit user applies only to this report. */\nexport function createSentryLoggerErrorHook(): LoggerErrorHook {\n return ({ error, userId, attributes }) => {\n if (userId !== undefined) {\n Sentry.captureException(error, { extra: attributes, user: { id: userId } })\n return\n }\n Sentry.captureException(error, { extra: attributes })\n }\n}\n\n/** Identity and scope adapter from Typist and Porte; call inside Sentry's instrumented runtime. */\nexport class SentryObservabilityService implements ObservabilityService {\n /** Attribute subsequent reports in the current isolation scope. */\n setUser(user: ObservabilityUser): void {\n Sentry.setUser({ id: user.id })\n }\n\n /** Await work in a separate scope for each queue message or concurrent operation. */\n async withIsolationScope<T>(callback: (scope: ObservabilityScope) => T | Promise<T>): Promise<T> {\n return await Sentry.withIsolationScope((scope) =>\n callback({ setUser: (user) => scope.setUser({ id: user.id }) }),\n )\n }\n}\n\nexport { Sentry }\n"],"mappings":";;;;;;;;AAkBA,SAAgB,oBAAoB,SAAwD;CAE1F,0BAA0B,SAAS;EACjC,IAAI,CAAC,OAAO,UAAU,GAAG;EACzB,OAAO,QAAQ,EAAE,IAAI,KAAK,GAAG,CAAC;CAChC,CAAC;CACD,OAAO;AACT;;AAGA,SAAgB,8BAA+C;CAC7D,QAAQ,EAAE,OAAO,QAAQ,iBAAiB;EACxC,IAAI,WAAW,QAAW;GACxB,OAAO,iBAAiB,OAAO;IAAE,OAAO;IAAY,MAAM,EAAE,IAAI,OAAO;GAAE,CAAC;GAC1E;EACF;EACA,OAAO,iBAAiB,OAAO,EAAE,OAAO,WAAW,CAAC;CACtD;AACF;;AAGA,IAAa,6BAAb,MAAwE;;CAEtE,QAAQ,MAA+B;EACrC,OAAO,QAAQ,EAAE,IAAI,KAAK,GAAG,CAAC;CAChC;;CAGA,MAAM,mBAAsB,UAAqE;EAC/F,OAAO,MAAM,OAAO,oBAAoB,UACtC,SAAS,EAAE,UAAU,SAAS,MAAM,QAAQ,EAAE,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC,CAChE;CACF;AACF"}
@@ -0,0 +1,10 @@
1
+ //#region src/infrastructure/tanstack/oxlint/index.d.ts
2
+ /**
3
+ * Oxlint plugin for TanStack Form and Query.
4
+ * Enable the `tanstack/*` rules from `jsPlugins`.
5
+ * Ported from Suparelay `packages/tanstack-lint`. The rule ids are unchanged.
6
+ */
7
+ declare const tanstackPlugin: import("@oxlint/plugins").Plugin;
8
+ //#endregion
9
+ export { tanstackPlugin as default };
10
+ //# sourceMappingURL=oxlint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oxlint.d.ts","names":[],"sources":["../../src/infrastructure/tanstack/oxlint/index.ts"],"mappings":";;;;;;cAaM,0CAAc"}
@@ -0,0 +1,256 @@
1
+ import { defineRule, eslintCompatPlugin } from "@oxlint/plugins";
2
+
3
+ //#region src/infrastructure/tanstack/oxlint/form-options.ts
4
+ const FORM_HOOKS = /* @__PURE__ */ new Set(["useForm", "useAppForm"]);
5
+ const SAFETY = /(?:^|[^\p{L}\p{N}_])SAFETY\s*:\s*\S/u;
6
+ /** The options object of a `useForm({ … })` or `useAppForm({ … })` call. */
7
+ function formOptions(node) {
8
+ if (node.callee.type !== "Identifier" || !FORM_HOOKS.has(node.callee.name)) return null;
9
+ const [options] = node.arguments;
10
+ return options?.type === "ObjectExpression" ? options : null;
11
+ }
12
+ /** A plain `name: value` property of an object literal. */
13
+ function propertyNamed(object, name) {
14
+ for (const property of object.properties) {
15
+ if (property.type !== "Property" || property.computed) continue;
16
+ const key = property.key;
17
+ if (key.type === "Identifier" && key.name === name) return property;
18
+ if (key.type === "Literal" && key.value === name) return property;
19
+ }
20
+ return null;
21
+ }
22
+ /** A `// SAFETY:` comment directly before the node allows one exception. */
23
+ function hasSafetyComment(sourceCode, node) {
24
+ return sourceCode.getCommentsBefore(node).some((comment) => SAFETY.test(comment.value));
25
+ }
26
+ /** Every node under `root`. Parent links are not followed. */
27
+ function* descendants(root) {
28
+ for (const [key, value] of Object.entries(root)) {
29
+ if (key === "parent") continue;
30
+ const children = Array.isArray(value) ? value : [value];
31
+ for (const child of children) if (isAstNode(child)) {
32
+ yield child;
33
+ yield* descendants(child);
34
+ }
35
+ }
36
+ }
37
+ function isAstNode(value) {
38
+ return value instanceof Object && "type" in value && "start" in value;
39
+ }
40
+
41
+ //#endregion
42
+ //#region src/infrastructure/tanstack/oxlint/form-schema-validators.ts
43
+ const DYNAMIC_SLOTS = /* @__PURE__ */ new Set(["onDynamic", "onDynamicAsync"]);
44
+ /**
45
+ * Require one named schema on `useForm` and `useAppForm`.
46
+ * `validationLogic` must call `revalidateLogic`. The schema sits on `validators.onDynamic`.
47
+ * A `// SAFETY:` comment before the call allows one form.
48
+ */
49
+ const formSchemaValidatorsRule = defineRule({
50
+ meta: {
51
+ type: "problem",
52
+ docs: { description: "Require `validationLogic: revalidateLogic(…)` and `validators: { onDynamic: Schema }` on every TanStack form." },
53
+ messages: {
54
+ logic: "Choose the timing with validationLogic: revalidateLogic({ mode, modeAfterSubmission }).",
55
+ missing: "Validate the form with one schema: validators: { onDynamic: Schema }.",
56
+ slot: "Replace {{slot}} with onDynamic; revalidateLogic sets the timing.",
57
+ inline: "Pass a schema, not a function: validators: { onDynamic: Schema }."
58
+ }
59
+ },
60
+ createOnce(context) {
61
+ return { CallExpression(node) {
62
+ const options = formOptions(node);
63
+ if (options === null || hasSafetyComment(context.sourceCode, node)) return;
64
+ const logic = propertyNamed(options, "validationLogic");
65
+ if (logic === null || logic.value.type !== "CallExpression" || logic.value.callee.type !== "Identifier" || logic.value.callee.name !== "revalidateLogic") context.report({
66
+ node: logic ?? node,
67
+ messageId: "logic"
68
+ });
69
+ const validators = propertyNamed(options, "validators");
70
+ if (validators === null || validators.value.type !== "ObjectExpression") {
71
+ context.report({
72
+ node: validators ?? node,
73
+ messageId: "missing"
74
+ });
75
+ return;
76
+ }
77
+ for (const slot of validators.value.properties) {
78
+ if (slot.type !== "Property" || slot.key.type !== "Identifier") continue;
79
+ if (!DYNAMIC_SLOTS.has(slot.key.name)) context.report({
80
+ node: slot,
81
+ messageId: "slot",
82
+ data: { slot: slot.key.name }
83
+ });
84
+ else if (slot.value.type !== "Identifier" && slot.value.type !== "MemberExpression") context.report({
85
+ node: slot.value,
86
+ messageId: "inline"
87
+ });
88
+ }
89
+ } };
90
+ }
91
+ });
92
+
93
+ //#endregion
94
+ //#region src/infrastructure/tanstack/oxlint/form-stable-default-values.ts
95
+ /** A call whose result changes between renders, such as the current time or a random id. */
96
+ function isUnstable(node) {
97
+ if (node.type === "NewExpression") return node.callee.type === "Identifier" && node.callee.name === "Date";
98
+ if (node.type !== "CallExpression" || node.callee.type !== "MemberExpression") return false;
99
+ const { object, property } = node.callee;
100
+ if (object.type !== "Identifier" || property.type !== "Identifier") return false;
101
+ return object.name === "Date" && property.name === "now" || object.name === "Math" && property.name === "random" || object.name === "crypto" && property.name === "randomUUID";
102
+ }
103
+ /**
104
+ * Reject a time or random value written inside `defaultValues`.
105
+ * TanStack Form applies a changed default to an untouched form on the next render.
106
+ */
107
+ const formStableDefaultValuesRule = defineRule({
108
+ meta: {
109
+ type: "problem",
110
+ docs: { description: "Disallow time or random values computed inline in `defaultValues`." },
111
+ messages: { unstable: "Compute this default once with useState(() => …) or a module constant; an inline value resets the form on render." }
112
+ },
113
+ createOnce(context) {
114
+ return { CallExpression(node) {
115
+ const options = formOptions(node);
116
+ const defaults = options === null ? null : propertyNamed(options, "defaultValues");
117
+ if (defaults === null) return;
118
+ for (const child of [defaults.value, ...descendants(defaults.value)]) if (isUnstable(child)) context.report({
119
+ node: child,
120
+ messageId: "unstable"
121
+ });
122
+ } };
123
+ }
124
+ });
125
+
126
+ //#endregion
127
+ //#region src/infrastructure/tanstack/oxlint/no-field-validators.ts
128
+ const FIELD_COMPONENTS = /* @__PURE__ */ new Set(["Field", "AppField"]);
129
+ /** Reject field-level `validators`. The form schema is the only validation source. */
130
+ const noFieldValidatorsRule = defineRule({
131
+ meta: {
132
+ type: "problem",
133
+ docs: { description: "Disallow field-level `validators`; the form schema validates." },
134
+ messages: { fieldValidators: "Remove validators from the field. Put the rule in the form schema." }
135
+ },
136
+ createOnce(context) {
137
+ return {
138
+ JSXOpeningElement(node) {
139
+ if (node.name.type !== "JSXMemberExpression") return;
140
+ if (!FIELD_COMPONENTS.has(node.name.property.name)) return;
141
+ for (const attribute of node.attributes) if (attribute.type === "JSXAttribute" && attribute.name.type === "JSXIdentifier" && attribute.name.name === "validators") context.report({
142
+ node: attribute,
143
+ messageId: "fieldValidators"
144
+ });
145
+ },
146
+ CallExpression(node) {
147
+ if (node.callee.type !== "Identifier" || node.callee.name !== "useField") return;
148
+ const [options] = node.arguments;
149
+ if (options?.type !== "ObjectExpression") return;
150
+ const validators = propertyNamed(options, "validators");
151
+ if (validators !== null) context.report({
152
+ node: validators,
153
+ messageId: "fieldValidators"
154
+ });
155
+ }
156
+ };
157
+ }
158
+ });
159
+
160
+ //#endregion
161
+ //#region src/infrastructure/tanstack/oxlint/no-submit-branching.ts
162
+ const BRANCH_OPERATORS = /* @__PURE__ */ new Set([
163
+ "??",
164
+ "||",
165
+ "&&"
166
+ ]);
167
+ function isBranch(node) {
168
+ if (node.type === "IfStatement" || node.type === "ConditionalExpression") return true;
169
+ return node.type === "LogicalExpression" && BRANCH_OPERATORS.has(node.operator);
170
+ }
171
+ /**
172
+ * Reject a condition inside `onSubmit`.
173
+ * The schema already accepted the values. A `// SAFETY:` comment on `onSubmit` allows one check.
174
+ */
175
+ const noSubmitBranchingRule = defineRule({
176
+ meta: {
177
+ type: "problem",
178
+ docs: { description: "Disallow conditions in a TanStack form's `onSubmit`." },
179
+ messages: { branch: "Move this check into the form schema. Use Schema.parse(value) when the submitted type must be narrowed." }
180
+ },
181
+ createOnce(context) {
182
+ return { CallExpression(node) {
183
+ const options = formOptions(node);
184
+ const submit = options === null ? null : propertyNamed(options, "onSubmit");
185
+ if (submit === null || hasSafetyComment(context.sourceCode, submit)) return;
186
+ for (const child of descendants(submit.value)) if (isBranch(child)) context.report({
187
+ node: child,
188
+ messageId: "branch"
189
+ });
190
+ } };
191
+ }
192
+ });
193
+
194
+ //#endregion
195
+ //#region src/infrastructure/tanstack/oxlint/query-key-from-factory.ts
196
+ const CACHE_METHODS = /* @__PURE__ */ new Set([
197
+ "getQueryData",
198
+ "setQueryData",
199
+ "getQueryState",
200
+ "ensureQueryData"
201
+ ]);
202
+ /**
203
+ * Reject a query key array written outside a `*-queries.ts` factory.
204
+ * Invalidation then reads the same key the factory stored.
205
+ */
206
+ const queryKeyFromFactoryRule = defineRule({
207
+ meta: {
208
+ type: "problem",
209
+ docs: { description: "Disallow query key arrays outside `*-queries.ts` factory files." },
210
+ messages: { literal: "Read this key from the entity's query factory, for example entityQueries.lists() or entityQueries.detail(input).queryKey." }
211
+ },
212
+ createOnce(context) {
213
+ const inFactory = () => context.filename.endsWith("-queries.ts");
214
+ return {
215
+ Property(node) {
216
+ if (inFactory() || node.computed || node.key.type !== "Identifier") return;
217
+ if (node.key.name === "queryKey" && node.value.type === "ArrayExpression") context.report({
218
+ node: node.value,
219
+ messageId: "literal"
220
+ });
221
+ },
222
+ CallExpression(node) {
223
+ if (inFactory() || node.callee.type !== "MemberExpression") return;
224
+ const method = node.callee.property;
225
+ if (method.type !== "Identifier" || !CACHE_METHODS.has(method.name)) return;
226
+ const [key] = node.arguments;
227
+ if (key?.type === "ArrayExpression") context.report({
228
+ node: key,
229
+ messageId: "literal"
230
+ });
231
+ }
232
+ };
233
+ }
234
+ });
235
+
236
+ //#endregion
237
+ //#region src/infrastructure/tanstack/oxlint/index.ts
238
+ /**
239
+ * Oxlint plugin for TanStack Form and Query.
240
+ * Enable the `tanstack/*` rules from `jsPlugins`.
241
+ * Ported from Suparelay `packages/tanstack-lint`. The rule ids are unchanged.
242
+ */
243
+ const tanstackPlugin = eslintCompatPlugin({
244
+ meta: { name: "tanstack" },
245
+ rules: {
246
+ "form-schema-validators": formSchemaValidatorsRule,
247
+ "form-stable-default-values": formStableDefaultValuesRule,
248
+ "no-field-validators": noFieldValidatorsRule,
249
+ "no-submit-branching": noSubmitBranchingRule,
250
+ "query-key-from-factory": queryKeyFromFactoryRule
251
+ }
252
+ });
253
+
254
+ //#endregion
255
+ export { tanstackPlugin as default };
256
+ //# sourceMappingURL=oxlint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oxlint.js","names":[],"sources":["../../src/infrastructure/tanstack/oxlint/form-options.ts","../../src/infrastructure/tanstack/oxlint/form-schema-validators.ts","../../src/infrastructure/tanstack/oxlint/form-stable-default-values.ts","../../src/infrastructure/tanstack/oxlint/no-field-validators.ts","../../src/infrastructure/tanstack/oxlint/no-submit-branching.ts","../../src/infrastructure/tanstack/oxlint/query-key-from-factory.ts","../../src/infrastructure/tanstack/oxlint/index.ts"],"sourcesContent":["import type { ESTree, SourceCode } from '@oxlint/plugins'\n\nconst FORM_HOOKS = new Set(['useForm', 'useAppForm'])\nconst SAFETY = /(?:^|[^\\p{L}\\p{N}_])SAFETY\\s*:\\s*\\S/u\n\n/** The options object of a `useForm({ … })` or `useAppForm({ … })` call. */\nexport function formOptions(node: ESTree.CallExpression): ESTree.ObjectExpression | null {\n if (node.callee.type !== 'Identifier' || !FORM_HOOKS.has(node.callee.name)) return null\n const [options] = node.arguments\n return options?.type === 'ObjectExpression' ? options : null\n}\n\n/** A plain `name: value` property of an object literal. */\nexport function propertyNamed(\n object: ESTree.ObjectExpression,\n name: string,\n): ESTree.ObjectProperty | null {\n for (const property of object.properties) {\n if (property.type !== 'Property' || property.computed) continue\n const key = property.key\n if (key.type === 'Identifier' && key.name === name) return property\n if (key.type === 'Literal' && key.value === name) return property\n }\n return null\n}\n\n/** A `// SAFETY:` comment directly before the node allows one exception. */\nexport function hasSafetyComment(sourceCode: SourceCode, node: ESTree.Node): boolean {\n return sourceCode.getCommentsBefore(node).some((comment) => SAFETY.test(comment.value))\n}\n\n/** Every node under `root`. Parent links are not followed. */\nexport function* descendants(root: ESTree.Node): Generator<ESTree.Node> {\n for (const [key, value] of Object.entries(root)) {\n if (key === 'parent') continue\n const children = Array.isArray(value) ? value : [value]\n for (const child of children) {\n if (isAstNode(child)) {\n yield child\n yield* descendants(child)\n }\n }\n }\n}\n\ntype AstChild =\n | { type?: string; start?: number }\n | string\n | number\n | boolean\n | bigint\n | symbol\n | null\n | undefined\n\nfunction isAstNode(value: AstChild): value is ESTree.Node {\n return value instanceof Object && 'type' in value && 'start' in value\n}\n","import { defineRule } from '@oxlint/plugins'\n\nimport { formOptions, hasSafetyComment, propertyNamed } from './form-options.ts'\n\nconst DYNAMIC_SLOTS = new Set(['onDynamic', 'onDynamicAsync'])\n\n/**\n * Require one named schema on `useForm` and `useAppForm`.\n * `validationLogic` must call `revalidateLogic`. The schema sits on `validators.onDynamic`.\n * A `// SAFETY:` comment before the call allows one form.\n */\nexport const formSchemaValidatorsRule = defineRule({\n meta: {\n type: 'problem',\n docs: {\n description:\n 'Require `validationLogic: revalidateLogic(…)` and `validators: { onDynamic: Schema }` on every TanStack form.',\n },\n messages: {\n logic:\n 'Choose the timing with validationLogic: revalidateLogic({ mode, modeAfterSubmission }).',\n missing: 'Validate the form with one schema: validators: { onDynamic: Schema }.',\n slot: 'Replace {{slot}} with onDynamic; revalidateLogic sets the timing.',\n inline: 'Pass a schema, not a function: validators: { onDynamic: Schema }.',\n },\n },\n createOnce(context) {\n return {\n CallExpression(node) {\n const options = formOptions(node)\n if (options === null || hasSafetyComment(context.sourceCode, node)) return\n const logic = propertyNamed(options, 'validationLogic')\n if (\n logic === null ||\n logic.value.type !== 'CallExpression' ||\n logic.value.callee.type !== 'Identifier' ||\n logic.value.callee.name !== 'revalidateLogic'\n ) {\n context.report({ node: logic ?? node, messageId: 'logic' })\n }\n const validators = propertyNamed(options, 'validators')\n if (validators === null || validators.value.type !== 'ObjectExpression') {\n context.report({ node: validators ?? node, messageId: 'missing' })\n return\n }\n for (const slot of validators.value.properties) {\n if (slot.type !== 'Property' || slot.key.type !== 'Identifier') continue\n if (!DYNAMIC_SLOTS.has(slot.key.name)) {\n context.report({ node: slot, messageId: 'slot', data: { slot: slot.key.name } })\n } else if (slot.value.type !== 'Identifier' && slot.value.type !== 'MemberExpression') {\n context.report({ node: slot.value, messageId: 'inline' })\n }\n }\n },\n }\n },\n})\n","import { defineRule } from '@oxlint/plugins'\nimport type { ESTree } from '@oxlint/plugins'\n\nimport { descendants, formOptions, propertyNamed } from './form-options.ts'\n\n/** A call whose result changes between renders, such as the current time or a random id. */\nfunction isUnstable(node: ESTree.Node): boolean {\n if (node.type === 'NewExpression') {\n return node.callee.type === 'Identifier' && node.callee.name === 'Date'\n }\n if (node.type !== 'CallExpression' || node.callee.type !== 'MemberExpression') return false\n const { object, property } = node.callee\n if (object.type !== 'Identifier' || property.type !== 'Identifier') return false\n return (\n (object.name === 'Date' && property.name === 'now') ||\n (object.name === 'Math' && property.name === 'random') ||\n (object.name === 'crypto' && property.name === 'randomUUID')\n )\n}\n\n/**\n * Reject a time or random value written inside `defaultValues`.\n * TanStack Form applies a changed default to an untouched form on the next render.\n */\nexport const formStableDefaultValuesRule = defineRule({\n meta: {\n type: 'problem',\n docs: { description: 'Disallow time or random values computed inline in `defaultValues`.' },\n messages: {\n unstable:\n 'Compute this default once with useState(() => …) or a module constant; an inline value resets the form on render.',\n },\n },\n createOnce(context) {\n return {\n CallExpression(node) {\n const options = formOptions(node)\n const defaults = options === null ? null : propertyNamed(options, 'defaultValues')\n if (defaults === null) return\n for (const child of [defaults.value, ...descendants(defaults.value)]) {\n if (isUnstable(child)) context.report({ node: child, messageId: 'unstable' })\n }\n },\n }\n },\n})\n","import { defineRule } from '@oxlint/plugins'\n\nimport { propertyNamed } from './form-options.ts'\n\nconst FIELD_COMPONENTS = new Set(['Field', 'AppField'])\n\n/** Reject field-level `validators`. The form schema is the only validation source. */\nexport const noFieldValidatorsRule = defineRule({\n meta: {\n type: 'problem',\n docs: { description: 'Disallow field-level `validators`; the form schema validates.' },\n messages: {\n fieldValidators: 'Remove validators from the field. Put the rule in the form schema.',\n },\n },\n createOnce(context) {\n return {\n JSXOpeningElement(node) {\n if (node.name.type !== 'JSXMemberExpression') return\n if (!FIELD_COMPONENTS.has(node.name.property.name)) return\n for (const attribute of node.attributes) {\n if (\n attribute.type === 'JSXAttribute' &&\n attribute.name.type === 'JSXIdentifier' &&\n attribute.name.name === 'validators'\n ) {\n context.report({ node: attribute, messageId: 'fieldValidators' })\n }\n }\n },\n CallExpression(node) {\n if (node.callee.type !== 'Identifier' || node.callee.name !== 'useField') return\n const [options] = node.arguments\n if (options?.type !== 'ObjectExpression') return\n const validators = propertyNamed(options, 'validators')\n if (validators !== null) context.report({ node: validators, messageId: 'fieldValidators' })\n },\n }\n },\n})\n","import { defineRule } from '@oxlint/plugins'\nimport type { ESTree } from '@oxlint/plugins'\n\nimport { descendants, formOptions, hasSafetyComment, propertyNamed } from './form-options.ts'\n\nconst BRANCH_OPERATORS = new Set(['??', '||', '&&'])\n\nfunction isBranch(node: ESTree.Node): boolean {\n if (node.type === 'IfStatement' || node.type === 'ConditionalExpression') return true\n return node.type === 'LogicalExpression' && BRANCH_OPERATORS.has(node.operator)\n}\n\n/**\n * Reject a condition inside `onSubmit`.\n * The schema already accepted the values. A `// SAFETY:` comment on `onSubmit` allows one check.\n */\nexport const noSubmitBranchingRule = defineRule({\n meta: {\n type: 'problem',\n docs: { description: \"Disallow conditions in a TanStack form's `onSubmit`.\" },\n messages: {\n branch:\n 'Move this check into the form schema. Use Schema.parse(value) when the submitted type must be narrowed.',\n },\n },\n createOnce(context) {\n return {\n CallExpression(node) {\n const options = formOptions(node)\n const submit = options === null ? null : propertyNamed(options, 'onSubmit')\n if (submit === null || hasSafetyComment(context.sourceCode, submit)) return\n for (const child of descendants(submit.value)) {\n if (isBranch(child)) context.report({ node: child, messageId: 'branch' })\n }\n },\n }\n },\n})\n","import { defineRule } from '@oxlint/plugins'\n\nconst CACHE_METHODS = new Set(['getQueryData', 'setQueryData', 'getQueryState', 'ensureQueryData'])\n\n/**\n * Reject a query key array written outside a `*-queries.ts` factory.\n * Invalidation then reads the same key the factory stored.\n */\nexport const queryKeyFromFactoryRule = defineRule({\n meta: {\n type: 'problem',\n docs: { description: 'Disallow query key arrays outside `*-queries.ts` factory files.' },\n messages: {\n literal:\n \"Read this key from the entity's query factory, for example entityQueries.lists() or entityQueries.detail(input).queryKey.\",\n },\n },\n createOnce(context) {\n const inFactory = () => context.filename.endsWith('-queries.ts')\n return {\n Property(node) {\n if (inFactory() || node.computed || node.key.type !== 'Identifier') return\n if (node.key.name === 'queryKey' && node.value.type === 'ArrayExpression') {\n context.report({ node: node.value, messageId: 'literal' })\n }\n },\n CallExpression(node) {\n if (inFactory() || node.callee.type !== 'MemberExpression') return\n const method = node.callee.property\n if (method.type !== 'Identifier' || !CACHE_METHODS.has(method.name)) return\n const [key] = node.arguments\n if (key?.type === 'ArrayExpression') context.report({ node: key, messageId: 'literal' })\n },\n }\n },\n})\n","import { eslintCompatPlugin } from '@oxlint/plugins'\n\nimport { formSchemaValidatorsRule } from './form-schema-validators.ts'\nimport { formStableDefaultValuesRule } from './form-stable-default-values.ts'\nimport { noFieldValidatorsRule } from './no-field-validators.ts'\nimport { noSubmitBranchingRule } from './no-submit-branching.ts'\nimport { queryKeyFromFactoryRule } from './query-key-from-factory.ts'\n\n/**\n * Oxlint plugin for TanStack Form and Query.\n * Enable the `tanstack/*` rules from `jsPlugins`.\n * Ported from Suparelay `packages/tanstack-lint`. The rule ids are unchanged.\n */\nconst tanstackPlugin = eslintCompatPlugin({\n meta: { name: 'tanstack' },\n rules: {\n 'form-schema-validators': formSchemaValidatorsRule,\n 'form-stable-default-values': formStableDefaultValuesRule,\n 'no-field-validators': noFieldValidatorsRule,\n 'no-submit-branching': noSubmitBranchingRule,\n 'query-key-from-factory': queryKeyFromFactoryRule,\n },\n})\n\nexport default tanstackPlugin\n"],"mappings":";;;AAEA,MAAM,6BAAa,IAAI,IAAI,CAAC,WAAW,YAAY,CAAC;AACpD,MAAM,SAAS;;AAGf,SAAgB,YAAY,MAA6D;CACvF,IAAI,KAAK,OAAO,SAAS,gBAAgB,CAAC,WAAW,IAAI,KAAK,OAAO,IAAI,GAAG,OAAO;CACnF,MAAM,CAAC,WAAW,KAAK;CACvB,OAAO,SAAS,SAAS,qBAAqB,UAAU;AAC1D;;AAGA,SAAgB,cACd,QACA,MAC8B;CAC9B,KAAK,MAAM,YAAY,OAAO,YAAY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,MAAM,iBAAiB,mBAAmB;CACxC,MAAM,EAAE,MAAM,WAAW;CACzB,OAAO;EACL,0BAA0B;EAC1B,8BAA8B;EAC9B,uBAAuB;EACvB,uBAAuB;EACvB,0BAA0B;CAC5B;AACF,CAAC"}
@@ -55,7 +55,7 @@ type AuthMiddlewareOptions<Session extends AuthSession> = {
55
55
  /**
56
56
  * Preserve Porte's function and request middleware contracts with application-owned services.
57
57
  * Optional lookup failures log once and continue as guests. Required lookup failures propagate.
58
- * `onAuthenticated` runs after a session resolves and before the rest of the chain.
58
+ * A resolved session applies `{ id }` on the observability hook, then runs `onAuthenticated`, before the handler.
59
59
  */
60
60
  export declare function createAuthMiddleware<Session extends AuthSession>(options: AuthMiddlewareOptions<Session>): {
61
61
  extractAuth: import("@tanstack/react-start").FunctionMiddlewareAfterServer<{}, unknown, undefined, AuthContext<Session>, undefined, undefined, undefined>;