@epztickets/common 1.66.0 → 1.68.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.
@@ -31,7 +31,8 @@ export declare enum Subjects {
31
31
  UserEmailVerificationRequested = "events.user.email-verification-requested",
32
32
  ConnectDisconnectRequested = "events.user.connect-disconnect-requested",
33
33
  ConnectDisconnectApproved = "events.user.connect-disconnect-approved",
34
- ConnectDisconnectRejected = "events.user.connect-disconnect-rejected"
34
+ ConnectDisconnectRejected = "events.user.connect-disconnect-rejected",
35
+ UserSelfBookingRecorded = "events.user.self-booking-recorded"
35
36
  }
36
37
  export declare enum Streams {
37
38
  Events = "events",
@@ -60,6 +60,16 @@ var Subjects;
60
60
  Subjects["ConnectDisconnectRequested"] = "events.user.connect-disconnect-requested";
61
61
  Subjects["ConnectDisconnectApproved"] = "events.user.connect-disconnect-approved";
62
62
  Subjects["ConnectDisconnectRejected"] = "events.user.connect-disconnect-rejected";
63
+ // Published by orders when an owner self-books a slot on their own
64
+ // room (buyer === owner). Auth consumes to (a) insert a SelfBooking
65
+ // row that accrues toward the monthly Venmo bill, (b) bump the
66
+ // owner's lifetime selfBookingCount surfaced on /currentuser, and
67
+ // (c) publish UserUpdated downstream so other replicas see the new
68
+ // count. The fee snapshot rides on the event — $0 during the
69
+ // owner's free trial, otherwise the per-owner override or platform
70
+ // default ($1). Snapshotting at publish time means rate changes
71
+ // never retroactively affect past bookings.
72
+ Subjects["UserSelfBookingRecorded"] = "events.user.self-booking-recorded";
63
73
  })(Subjects || (exports.Subjects = Subjects = {}));
64
74
  var Streams;
65
75
  (function (Streams) {
@@ -0,0 +1,15 @@
1
+ import { Subjects } from "./subjects";
2
+ export interface UserSelfBookingRecordedEvent {
3
+ subject: Subjects.UserSelfBookingRecorded;
4
+ data: {
5
+ userId: string;
6
+ /** The owning Order's id. Used by auth's OrderCancelled listener
7
+ * to find + cancel the matching SelfBooking row. */
8
+ orderId: string;
9
+ /** Per-booking fee at the moment this booking was created, in
10
+ * cents. 0 during trial; otherwise override or platform default. */
11
+ feeAmount: number;
12
+ /** ISO timestamp of when orders-srv created the booking. */
13
+ recordedAt: string;
14
+ };
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/build/index.d.ts CHANGED
@@ -49,6 +49,7 @@ export * from "./events/user-deleted-event";
49
49
  export * from "./events/user-deletion-requested-event";
50
50
  export * from "./events/user-deletion-rejected-event";
51
51
  export * from "./events/user-email-verification-requested-event";
52
+ export * from "./events/user-self-booking-recorded-event";
52
53
  export * from "./events/connect-disconnect-requested-event";
53
54
  export * from "./events/connect-disconnect-approved-event";
54
55
  export * from "./events/connect-disconnect-rejected-event";
package/build/index.js CHANGED
@@ -69,6 +69,7 @@ __exportStar(require("./events/user-deleted-event"), exports);
69
69
  __exportStar(require("./events/user-deletion-requested-event"), exports);
70
70
  __exportStar(require("./events/user-deletion-rejected-event"), exports);
71
71
  __exportStar(require("./events/user-email-verification-requested-event"), exports);
72
+ __exportStar(require("./events/user-self-booking-recorded-event"), exports);
72
73
  __exportStar(require("./events/connect-disconnect-requested-event"), exports);
73
74
  __exportStar(require("./events/connect-disconnect-approved-event"), exports);
74
75
  __exportStar(require("./events/connect-disconnect-rejected-event"), exports);
@@ -6,7 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createLogger = createLogger;
7
7
  const pino_1 = __importDefault(require("pino"));
8
8
  const isTest = process.env.NODE_ENV === "test";
9
- const isProd = process.env.NODE_ENV === "production";
9
+ // Pretty-printing is OPT-IN. The previous behavior ("pretty unless
10
+ // production or test") caused crashes in dockerized dev/staging
11
+ // environments where NODE_ENV is unset — pino's transport mechanism
12
+ // would try to spawn the pino-pretty worker and fail. Inverting the
13
+ // check so prod-defaults (no NODE_ENV) get raw JSON matches what
14
+ // log aggregators want anyway.
15
+ //
16
+ // To enable pretty output on a local laptop: `NODE_ENV=development`
17
+ // or `LOG_PRETTY=1`.
18
+ const wantsPretty = process.env.NODE_ENV === "development" || process.env.LOG_PRETTY === "1";
10
19
  function createLogger(serviceOrOpts) {
11
20
  var _a, _b;
12
21
  const opts = typeof serviceOrOpts === "string"
@@ -16,9 +25,10 @@ function createLogger(serviceOrOpts) {
16
25
  return (0, pino_1.default)({
17
26
  name: opts.service,
18
27
  level,
19
- // Dev convenience: pretty-print colored lines instead of raw JSON.
20
- // Production gets the raw JSON which is what log aggregators want.
21
- transport: !isProd && !isTest
28
+ // Pretty-printed colored lines for local dev only. Defaults to
29
+ // raw JSON everywhere else exactly what every log aggregator
30
+ // (Loki, Datadog, CloudWatch, etc.) expects.
31
+ transport: wantsPretty
22
32
  ? {
23
33
  target: "pino-pretty",
24
34
  options: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epztickets/common",
3
- "version": "1.66.0",
3
+ "version": "1.68.0",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [
@@ -35,6 +35,7 @@
35
35
  "jsonwebtoken": "^9.0.2",
36
36
  "nats": "^2.29.3",
37
37
  "pino": "^9.5.0",
38
- "pino-http": "^10.3.0"
38
+ "pino-http": "^10.3.0",
39
+ "pino-pretty": "^11.3.0"
39
40
  }
40
41
  }