@openpeepshq/common 0.15.0 → 0.17.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.
@@ -0,0 +1,9 @@
1
+ export declare const CALENDAR_FEED_PATH = "/api/openpeeps/core/v1/events/feed";
2
+ /**
3
+ * Absolute subscription URL for a calendar feed token. The token travels as a
4
+ * query param, so it must be the last (and only) component of the URL.
5
+ * The token is percent-encoded even though it is currently plain lowercase
6
+ * hex — the helper is a published export and the encoding keeps the contract
7
+ * valid for any token shape (mirrors the server-side URL builders).
8
+ */
9
+ export declare const buildCalendarFeedUrl: (origin: string, token: string) => string;
@@ -0,0 +1,11 @@
1
+ // The ICS feed endpoint lives at the application root, not under the API
2
+ // subtree — the same reason the HLS streaming URLs use the bare origin.
3
+ export const CALENDAR_FEED_PATH = '/api/openpeeps/core/v1/events/feed';
4
+ /**
5
+ * Absolute subscription URL for a calendar feed token. The token travels as a
6
+ * query param, so it must be the last (and only) component of the URL.
7
+ * The token is percent-encoded even though it is currently plain lowercase
8
+ * hex — the helper is a published export and the encoding keeps the contract
9
+ * valid for any token shape (mirrors the server-side URL builders).
10
+ */
11
+ export const buildCalendarFeedUrl = (origin, token) => `${origin.replace(/\/+$/, '')}${CALENDAR_FEED_PATH}?token=${encodeURIComponent(token)}`;
@@ -14,6 +14,7 @@ export * from './markdownHelpers';
14
14
  export * from './contentLength';
15
15
  export * from './attachmentHelpers';
16
16
  export * from './resources';
17
+ export * from './calendarFeedUrl';
17
18
  export * from './eventIcs';
18
19
  export * from './eventTime';
19
20
  export * from './timeZone';
package/dist/lib/index.js CHANGED
@@ -14,6 +14,7 @@ export * from './markdownHelpers.js';
14
14
  export * from './contentLength.js';
15
15
  export * from './attachmentHelpers.js';
16
16
  export * from './resources.js';
17
+ export * from './calendarFeedUrl.js';
17
18
  export * from './eventIcs.js';
18
19
  export * from './eventTime.js';
19
20
  export * from './timeZone.js';
@@ -17,3 +17,31 @@ export declare const EVENT_HEADER_ASPECT_RATIO = "16:9";
17
17
  * with grey gaps.
18
18
  */
19
19
  export declare const PROFILE_GROUP_HEADER_ASPECT_RATIO = "3:1";
20
+ /**
21
+ * Max duration (seconds) of voice notes recorded in the post composers.
22
+ * Enforced on the client (web modal + RN sheet) and re-checked server-side
23
+ * during media processing, so it is the single source of truth for the cap.
24
+ *
25
+ * Boundary rule — clients auto-stop at `VOICE_NOTE_AUTO_STOP_SECONDS`, the
26
+ * server rejects with `>`: the recorders tick every 500 ms and the stop check
27
+ * runs against the *raw* wall-clock span, so a take can finish anywhere in
28
+ * [90.0 s, 90.5 s). The file's probed duration is that raw span, so stopping
29
+ * at exactly 90 s would let roughly half of honest cap-length takes probe
30
+ * above the server's `duration > 90` check and surface the 400 right after
31
+ * the recorder stopped itself. Auto-stopping at 89.5 s keeps every honest
32
+ * take strictly under 90 s (≤ 89.999 s), while a genuinely-overshot or
33
+ * crafted upload (≥ 90.5 s) still probes above the cap and is rejected —
34
+ * the two sides are pinned by tests (`transcodeAudio.test.ts`,
35
+ * `mediaDimensions.test.ts`, `VoiceRecorderModal.test.tsx`,
36
+ * `record-audio-sheet.test.tsx`) so they cannot drift apart — change either
37
+ * the threshold or the server operator only together with those tests.
38
+ */
39
+ export declare const VOICE_NOTE_MAX_SECONDS = 90;
40
+ /**
41
+ * The wall-clock moment the recorders auto-stop. Half a second *under*
42
+ * VOICE_NOTE_MAX_SECONDS: the coarse 500 ms tick that detects the threshold
43
+ * guarantees the actual file stays under the cap (see above), which is what
44
+ * makes the server's `duration > VOICE_NOTE_MAX_SECONDS` boundary safe for
45
+ * honest takes.
46
+ */
47
+ export declare const VOICE_NOTE_AUTO_STOP_SECONDS: number;
@@ -17,3 +17,31 @@ export const EVENT_HEADER_ASPECT_RATIO = '16:9';
17
17
  * with grey gaps.
18
18
  */
19
19
  export const PROFILE_GROUP_HEADER_ASPECT_RATIO = '3:1';
20
+ /**
21
+ * Max duration (seconds) of voice notes recorded in the post composers.
22
+ * Enforced on the client (web modal + RN sheet) and re-checked server-side
23
+ * during media processing, so it is the single source of truth for the cap.
24
+ *
25
+ * Boundary rule — clients auto-stop at `VOICE_NOTE_AUTO_STOP_SECONDS`, the
26
+ * server rejects with `>`: the recorders tick every 500 ms and the stop check
27
+ * runs against the *raw* wall-clock span, so a take can finish anywhere in
28
+ * [90.0 s, 90.5 s). The file's probed duration is that raw span, so stopping
29
+ * at exactly 90 s would let roughly half of honest cap-length takes probe
30
+ * above the server's `duration > 90` check and surface the 400 right after
31
+ * the recorder stopped itself. Auto-stopping at 89.5 s keeps every honest
32
+ * take strictly under 90 s (≤ 89.999 s), while a genuinely-overshot or
33
+ * crafted upload (≥ 90.5 s) still probes above the cap and is rejected —
34
+ * the two sides are pinned by tests (`transcodeAudio.test.ts`,
35
+ * `mediaDimensions.test.ts`, `VoiceRecorderModal.test.tsx`,
36
+ * `record-audio-sheet.test.tsx`) so they cannot drift apart — change either
37
+ * the threshold or the server operator only together with those tests.
38
+ */
39
+ export const VOICE_NOTE_MAX_SECONDS = 90;
40
+ /**
41
+ * The wall-clock moment the recorders auto-stop. Half a second *under*
42
+ * VOICE_NOTE_MAX_SECONDS: the coarse 500 ms tick that detects the threshold
43
+ * guarantees the actual file stays under the cap (see above), which is what
44
+ * makes the server's `duration > VOICE_NOTE_MAX_SECONDS` boundary safe for
45
+ * honest takes.
46
+ */
47
+ export const VOICE_NOTE_AUTO_STOP_SECONDS = VOICE_NOTE_MAX_SECONDS - 0.5;
@@ -39073,6 +39073,16 @@ export type JamWaitingProfile = {
39073
39073
  id: string;
39074
39074
  displayName?: string;
39075
39075
  };
39076
+ /** The waiting-room join stream emits either the admittance token or a denial. */
39077
+ export declare const jamWaitingRoomJoinEventSchema: z.ZodUnion<readonly [z.ZodObject<{
39078
+ success: z.ZodLiteral<true>;
39079
+ token: z.ZodString;
39080
+ checkoutUrl: z.ZodOptional<z.ZodString>;
39081
+ livekitUrl: z.ZodString;
39082
+ }, z.core.$strip>, z.ZodObject<{
39083
+ denied: z.ZodLiteral<true>;
39084
+ }, z.core.$strip>]>;
39085
+ export type JamWaitingRoomJoinEvent = z.infer<typeof jamWaitingRoomJoinEventSchema>;
39076
39086
  export interface Credentials {
39077
39087
  token: string;
39078
39088
  }
package/dist/types/api.js CHANGED
@@ -397,6 +397,11 @@ export const calendarFeedTokenResponseSchema = z.object({
397
397
  export const jamWaitingRoomEntrySchema = z.object({
398
398
  displayName: z.string().optional(),
399
399
  });
400
+ /** The waiting-room join stream emits either the admittance token or a denial. */
401
+ export const jamWaitingRoomJoinEventSchema = z.union([
402
+ jamTokenResponseSchema,
403
+ z.object({ denied: z.literal(true) }),
404
+ ]);
400
405
  const focusCoordinatesPattern = /^-?\d+,-?\d+$/;
401
406
  // NOTE: `file` / `thumbnail` accept a `File` (browser) or any
402
407
  // multipart body — modelled as `z.any()` for the API contract so the OpenAPI
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpeepshq/common",
3
- "version": "0.15.0",
3
+ "version": "0.17.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -0,0 +1,15 @@
1
+ // The ICS feed endpoint lives at the application root, not under the API
2
+ // subtree — the same reason the HLS streaming URLs use the bare origin.
3
+ export const CALENDAR_FEED_PATH = '/api/openpeeps/core/v1/events/feed';
4
+
5
+ /**
6
+ * Absolute subscription URL for a calendar feed token. The token travels as a
7
+ * query param, so it must be the last (and only) component of the URL.
8
+ * The token is percent-encoded even though it is currently plain lowercase
9
+ * hex — the helper is a published export and the encoding keeps the contract
10
+ * valid for any token shape (mirrors the server-side URL builders).
11
+ */
12
+ export const buildCalendarFeedUrl = (origin: string, token: string): string =>
13
+ `${origin.replace(/\/+$/, '')}${CALENDAR_FEED_PATH}?token=${encodeURIComponent(
14
+ token,
15
+ )}`;
package/src/lib/index.ts CHANGED
@@ -14,6 +14,7 @@ export * from './markdownHelpers';
14
14
  export * from './contentLength';
15
15
  export * from './attachmentHelpers';
16
16
  export * from './resources';
17
+ export * from './calendarFeedUrl';
17
18
  export * from './eventIcs';
18
19
  export * from './eventTime';
19
20
  export * from './timeZone';
@@ -19,3 +19,33 @@ export const EVENT_HEADER_ASPECT_RATIO = '16:9';
19
19
  * with grey gaps.
20
20
  */
21
21
  export const PROFILE_GROUP_HEADER_ASPECT_RATIO = '3:1';
22
+
23
+ /**
24
+ * Max duration (seconds) of voice notes recorded in the post composers.
25
+ * Enforced on the client (web modal + RN sheet) and re-checked server-side
26
+ * during media processing, so it is the single source of truth for the cap.
27
+ *
28
+ * Boundary rule — clients auto-stop at `VOICE_NOTE_AUTO_STOP_SECONDS`, the
29
+ * server rejects with `>`: the recorders tick every 500 ms and the stop check
30
+ * runs against the *raw* wall-clock span, so a take can finish anywhere in
31
+ * [90.0 s, 90.5 s). The file's probed duration is that raw span, so stopping
32
+ * at exactly 90 s would let roughly half of honest cap-length takes probe
33
+ * above the server's `duration > 90` check and surface the 400 right after
34
+ * the recorder stopped itself. Auto-stopping at 89.5 s keeps every honest
35
+ * take strictly under 90 s (≤ 89.999 s), while a genuinely-overshot or
36
+ * crafted upload (≥ 90.5 s) still probes above the cap and is rejected —
37
+ * the two sides are pinned by tests (`transcodeAudio.test.ts`,
38
+ * `mediaDimensions.test.ts`, `VoiceRecorderModal.test.tsx`,
39
+ * `record-audio-sheet.test.tsx`) so they cannot drift apart — change either
40
+ * the threshold or the server operator only together with those tests.
41
+ */
42
+ export const VOICE_NOTE_MAX_SECONDS = 90;
43
+
44
+ /**
45
+ * The wall-clock moment the recorders auto-stop. Half a second *under*
46
+ * VOICE_NOTE_MAX_SECONDS: the coarse 500 ms tick that detects the threshold
47
+ * guarantees the actual file stays under the cap (see above), which is what
48
+ * makes the server's `duration > VOICE_NOTE_MAX_SECONDS` boundary safe for
49
+ * honest takes.
50
+ */
51
+ export const VOICE_NOTE_AUTO_STOP_SECONDS = VOICE_NOTE_MAX_SECONDS - 0.5;
package/src/types/api.ts CHANGED
@@ -616,6 +616,15 @@ export type JamWaitingProfile = {
616
616
  displayName?: string;
617
617
  };
618
618
 
619
+ /** The waiting-room join stream emits either the admittance token or a denial. */
620
+ export const jamWaitingRoomJoinEventSchema = z.union([
621
+ jamTokenResponseSchema,
622
+ z.object({ denied: z.literal(true) }),
623
+ ]);
624
+ export type JamWaitingRoomJoinEvent = z.infer<
625
+ typeof jamWaitingRoomJoinEventSchema
626
+ >;
627
+
619
628
  export interface Credentials {
620
629
  token: string;
621
630
  }