@beezping/adapter-prisma 0.7.0 → 0.8.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.
package/dist/email.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The one email pattern every Siteping surface validates against.
2
+ * The one email pattern every Beezping surface validates against.
3
3
  *
4
4
  * The widget's identity modal and the HTTP handler's schema used to disagree
5
5
  * (a permissive regex on one side, an ASCII-only default on the other), so an
@@ -8,12 +8,15 @@
8
8
  * sides, makes that drift impossible.
9
9
  *
10
10
  * Deliberately Unicode-aware: internationalised local parts and domains
11
- * (`françois@exemple.fr`, `user@münchen.de`) are real addresses and common in
12
- * the audience this widget serves. Structure follows the usual rules — a
13
- * local part of 1 to 64 characters with no leading, trailing or doubled dot,
11
+ * (`françois@exemple.fr`, `user@münchen.de`, `user@हिंदी.भारत`) are real
12
+ * addresses and common in the audience this widget serves. Combining marks
13
+ * (`\p{M}`) are allowed alongside letters — scripts like Devanagari need them,
14
+ * and NFD-composed input spells `ç` as `c` + U+0327 — except as the first
15
+ * character of a domain label. Structure follows the usual rules — a local
16
+ * part of 1 to 64 characters with no leading, trailing or doubled dot,
14
17
  * dot-separated domain labels of at most 63 characters that neither start nor
15
18
  * end with a hyphen, and a final label of at least two characters.
16
19
  */
17
20
  export declare const EMAIL_PATTERN: RegExp;
18
- /** Whether `value` is an email address Siteping accepts — see {@link EMAIL_PATTERN}. */
21
+ /** Whether `value` is an email address Beezping accepts — see {@link EMAIL_PATTERN}. */
19
22
  export declare function isValidEmail(value: string): boolean;
package/dist/email.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The one email pattern every Siteping surface validates against.
2
+ * The one email pattern every Beezping surface validates against.
3
3
  *
4
4
  * The widget's identity modal and the HTTP handler's schema used to disagree
5
5
  * (a permissive regex on one side, an ASCII-only default on the other), so an
@@ -8,12 +8,15 @@
8
8
  * sides, makes that drift impossible.
9
9
  *
10
10
  * Deliberately Unicode-aware: internationalised local parts and domains
11
- * (`françois@exemple.fr`, `user@münchen.de`) are real addresses and common in
12
- * the audience this widget serves. Structure follows the usual rules — a
13
- * local part of 1 to 64 characters with no leading, trailing or doubled dot,
11
+ * (`françois@exemple.fr`, `user@münchen.de`, `user@हिंदी.भारत`) are real
12
+ * addresses and common in the audience this widget serves. Combining marks
13
+ * (`\p{M}`) are allowed alongside letters — scripts like Devanagari need them,
14
+ * and NFD-composed input spells `ç` as `c` + U+0327 — except as the first
15
+ * character of a domain label. Structure follows the usual rules — a local
16
+ * part of 1 to 64 characters with no leading, trailing or doubled dot,
14
17
  * dot-separated domain labels of at most 63 characters that neither start nor
15
18
  * end with a hyphen, and a final label of at least two characters.
16
19
  */
17
20
  export declare const EMAIL_PATTERN: RegExp;
18
- /** Whether `value` is an email address Siteping accepts — see {@link EMAIL_PATTERN}. */
21
+ /** Whether `value` is an email address Beezping accepts — see {@link EMAIL_PATTERN}. */
19
22
  export declare function isValidEmail(value: string): boolean;
package/dist/errors.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Typed error hierarchy for Siteping client/server boundaries.
2
+ * Typed error hierarchy for Beezping client/server boundaries.
3
3
  *
4
4
  * Consumers can `instanceof`-check or read `code` / `retryable` instead of
5
5
  * pattern-matching error messages. Designed to be additive on top of the
@@ -7,35 +7,49 @@
7
7
  * remain the canonical signals for server-side store implementations.
8
8
  *
9
9
  * Usage on the widget side (api-client.ts):
10
- * - fetch failures / aborts / timeouts → `SitepingNetworkError` (retryable)
11
- * - HTTP 4xx (except 401/403) → `SitepingValidationError` (not retryable)
12
- * - HTTP 401 / 403 → `SitepingAuthError` (not retryable)
13
- * - everything else → `SitepingError` generic
10
+ * - fetch failures / aborts / timeouts → `BeezpingNetworkError` (retryable)
11
+ * - HTTP 4xx (except 401/403) → `BeezpingValidationError` (not retryable)
12
+ * - HTTP 401 / 403 → `BeezpingAuthError` (not retryable)
13
+ * - everything else → `BeezpingError` generic
14
+ *
15
+ * Store mode (store-client.ts): a `createFeedback` that does not settle in
16
+ * time → `BeezpingError` with code `"TIMEOUT"` (retryable).
14
17
  *
15
18
  * `retryable` is meta information surfaced to host apps that want to wire
16
19
  * their own retry/queue/backoff strategy — the widget already retries
17
20
  * network failures via its built-in retry queue.
18
21
  */
19
22
  /**
20
- * Discriminant string carried by every `SitepingError`. Subclasses pin a
23
+ * Discriminant string carried by every `BeezpingError`. Subclasses pin a
21
24
  * literal value; the base class accepts a wider string so userland can
22
25
  * extend the hierarchy without colliding with built-ins.
23
26
  */
24
- export type SitepingErrorCode = "NETWORK" | "VALIDATION" | "AUTH" | "SERVER" | (string & {});
25
- export declare class SitepingError<TCode extends SitepingErrorCode = SitepingErrorCode> extends Error {
27
+ export type BeezpingErrorCode = "NETWORK" | "VALIDATION" | "AUTH" | "SERVER" | "TIMEOUT" | (string & {});
28
+ export declare class BeezpingError<TCode extends BeezpingErrorCode = BeezpingErrorCode> extends Error {
26
29
  readonly code: TCode;
27
30
  readonly retryable: boolean;
28
31
  constructor(message: string, code: TCode, retryable: boolean);
29
32
  }
30
33
  /** Network-level failure: connection refused, DNS, CORS, timeout, abort. Retryable. */
31
- export declare class SitepingNetworkError extends SitepingError<"NETWORK"> {
34
+ export declare class BeezpingNetworkError extends BeezpingError<"NETWORK"> {
32
35
  constructor(message: string);
33
36
  }
34
- /** Server rejected the request (4xx, not auth). Validation problem on the client side. */
35
- export declare class SitepingValidationError extends SitepingError<"VALIDATION"> {
36
- constructor(message: string);
37
+ /**
38
+ * Server rejected the request (4xx, not auth). Validation problem on the
39
+ * client side. `status` is the HTTP status when a response said so: a 404
40
+ * (the target is gone) and a 409 (a full thread) call for other answers
41
+ * than a 400.
42
+ */
43
+ export declare class BeezpingValidationError extends BeezpingError<"VALIDATION"> {
44
+ readonly status: number | undefined;
45
+ constructor(message: string, status?: number);
37
46
  }
38
47
  /** Server rejected auth (401 or 403). Not retryable without fresh credentials. */
39
- export declare class SitepingAuthError extends SitepingError<"AUTH"> {
40
- constructor(message: string);
48
+ export declare class BeezpingAuthError extends BeezpingError<"AUTH"> {
49
+ /**
50
+ * `401`: the credentials are missing or no longer work — drop a dead token
51
+ * on this one. `403`: they work, and the server's policy refuses this request.
52
+ */
53
+ readonly status: 401 | 403;
54
+ constructor(message: string, status: 401 | 403);
41
55
  }
package/dist/errors.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Typed error hierarchy for Siteping client/server boundaries.
2
+ * Typed error hierarchy for Beezping client/server boundaries.
3
3
  *
4
4
  * Consumers can `instanceof`-check or read `code` / `retryable` instead of
5
5
  * pattern-matching error messages. Designed to be additive on top of the
@@ -7,35 +7,49 @@
7
7
  * remain the canonical signals for server-side store implementations.
8
8
  *
9
9
  * Usage on the widget side (api-client.ts):
10
- * - fetch failures / aborts / timeouts → `SitepingNetworkError` (retryable)
11
- * - HTTP 4xx (except 401/403) → `SitepingValidationError` (not retryable)
12
- * - HTTP 401 / 403 → `SitepingAuthError` (not retryable)
13
- * - everything else → `SitepingError` generic
10
+ * - fetch failures / aborts / timeouts → `BeezpingNetworkError` (retryable)
11
+ * - HTTP 4xx (except 401/403) → `BeezpingValidationError` (not retryable)
12
+ * - HTTP 401 / 403 → `BeezpingAuthError` (not retryable)
13
+ * - everything else → `BeezpingError` generic
14
+ *
15
+ * Store mode (store-client.ts): a `createFeedback` that does not settle in
16
+ * time → `BeezpingError` with code `"TIMEOUT"` (retryable).
14
17
  *
15
18
  * `retryable` is meta information surfaced to host apps that want to wire
16
19
  * their own retry/queue/backoff strategy — the widget already retries
17
20
  * network failures via its built-in retry queue.
18
21
  */
19
22
  /**
20
- * Discriminant string carried by every `SitepingError`. Subclasses pin a
23
+ * Discriminant string carried by every `BeezpingError`. Subclasses pin a
21
24
  * literal value; the base class accepts a wider string so userland can
22
25
  * extend the hierarchy without colliding with built-ins.
23
26
  */
24
- export type SitepingErrorCode = "NETWORK" | "VALIDATION" | "AUTH" | "SERVER" | (string & {});
25
- export declare class SitepingError<TCode extends SitepingErrorCode = SitepingErrorCode> extends Error {
27
+ export type BeezpingErrorCode = "NETWORK" | "VALIDATION" | "AUTH" | "SERVER" | "TIMEOUT" | (string & {});
28
+ export declare class BeezpingError<TCode extends BeezpingErrorCode = BeezpingErrorCode> extends Error {
26
29
  readonly code: TCode;
27
30
  readonly retryable: boolean;
28
31
  constructor(message: string, code: TCode, retryable: boolean);
29
32
  }
30
33
  /** Network-level failure: connection refused, DNS, CORS, timeout, abort. Retryable. */
31
- export declare class SitepingNetworkError extends SitepingError<"NETWORK"> {
34
+ export declare class BeezpingNetworkError extends BeezpingError<"NETWORK"> {
32
35
  constructor(message: string);
33
36
  }
34
- /** Server rejected the request (4xx, not auth). Validation problem on the client side. */
35
- export declare class SitepingValidationError extends SitepingError<"VALIDATION"> {
36
- constructor(message: string);
37
+ /**
38
+ * Server rejected the request (4xx, not auth). Validation problem on the
39
+ * client side. `status` is the HTTP status when a response said so: a 404
40
+ * (the target is gone) and a 409 (a full thread) call for other answers
41
+ * than a 400.
42
+ */
43
+ export declare class BeezpingValidationError extends BeezpingError<"VALIDATION"> {
44
+ readonly status: number | undefined;
45
+ constructor(message: string, status?: number);
37
46
  }
38
47
  /** Server rejected auth (401 or 403). Not retryable without fresh credentials. */
39
- export declare class SitepingAuthError extends SitepingError<"AUTH"> {
40
- constructor(message: string);
48
+ export declare class BeezpingAuthError extends BeezpingError<"AUTH"> {
49
+ /**
50
+ * `401`: the credentials are missing or no longer work — drop a dead token
51
+ * on this one. `403`: they work, and the server's policy refuses this request.
52
+ */
53
+ readonly status: 401 | 403;
54
+ constructor(message: string, status: 401 | 403);
41
55
  }
@@ -4,13 +4,14 @@
4
4
  * near-identical copies of the same logic. Any adapter that holds an
5
5
  * in-memory snapshot of feedbacks can use it.
6
6
  *
7
- * Filtering order matches the historical adapter behaviour:
8
- * 1. projectName (always required)
9
- * 2. type
10
- * 3. status / statuses (`statuses` bucket wins when both are set)
11
- * 4. url
12
- * 5. urlPattern
13
- * 6. search (lowercase substring match on `message`)
7
+ * A record matches when it passes every active filter (see
8
+ * {@link matchesFeedbackQuery}):
9
+ * - projectName (always required)
10
+ * - type
11
+ * - status / statuses (`statuses` bucket wins when both are set)
12
+ * - url
13
+ * - urlPattern
14
+ * - search (lowercase substring match on `message`)
14
15
  *
15
16
  * Pagination goes through `clampPagination`: `limit` capped at 100, `page`
16
17
  * 1-based, both clamped up to 1 rather than indexing backwards from the end
@@ -63,6 +64,13 @@ export declare function clampPagination(query: Pick<FeedbackQuery, "page" | "lim
63
64
  * @returns `true` when no row can sit at that offset.
64
65
  */
65
66
  export declare function isUnreachableOffset(skip: number): boolean;
67
+ /**
68
+ * Whether one record passes every filter of `query` — the filter half of
69
+ * {@link applyFeedbackFilters}, exposed so a client holding a single record
70
+ * (e.g. the dashboard deciding whether an optimistic edit still belongs in
71
+ * its list) applies exactly the stores' semantics. Pagination is ignored.
72
+ */
73
+ export declare function matchesFeedbackQuery(record: FeedbackRecord, query: FeedbackQuery): boolean;
66
74
  /**
67
75
  * Apply the standard feedback filter + pagination pipeline against an
68
76
  * in-memory snapshot. Used by `MemoryStore.getFeedbacks` and
package/dist/filters.d.ts CHANGED
@@ -4,13 +4,14 @@
4
4
  * near-identical copies of the same logic. Any adapter that holds an
5
5
  * in-memory snapshot of feedbacks can use it.
6
6
  *
7
- * Filtering order matches the historical adapter behaviour:
8
- * 1. projectName (always required)
9
- * 2. type
10
- * 3. status / statuses (`statuses` bucket wins when both are set)
11
- * 4. url
12
- * 5. urlPattern
13
- * 6. search (lowercase substring match on `message`)
7
+ * A record matches when it passes every active filter (see
8
+ * {@link matchesFeedbackQuery}):
9
+ * - projectName (always required)
10
+ * - type
11
+ * - status / statuses (`statuses` bucket wins when both are set)
12
+ * - url
13
+ * - urlPattern
14
+ * - search (lowercase substring match on `message`)
14
15
  *
15
16
  * Pagination goes through `clampPagination`: `limit` capped at 100, `page`
16
17
  * 1-based, both clamped up to 1 rather than indexing backwards from the end
@@ -63,6 +64,13 @@ export declare function clampPagination(query: Pick<FeedbackQuery, "page" | "lim
63
64
  * @returns `true` when no row can sit at that offset.
64
65
  */
65
66
  export declare function isUnreachableOffset(skip: number): boolean;
67
+ /**
68
+ * Whether one record passes every filter of `query` — the filter half of
69
+ * {@link applyFeedbackFilters}, exposed so a client holding a single record
70
+ * (e.g. the dashboard deciding whether an optimistic edit still belongs in
71
+ * its list) applies exactly the stores' semantics. Pagination is ignored.
72
+ */
73
+ export declare function matchesFeedbackQuery(record: FeedbackRecord, query: FeedbackQuery): boolean;
66
74
  /**
67
75
  * Apply the standard feedback filter + pagination pipeline against an
68
76
  * in-memory snapshot. Used by `MemoryStore.getFeedbacks` and
package/dist/i18n.d.cts CHANGED
@@ -48,6 +48,24 @@ export interface I18n<T> {
48
48
  */
49
49
  registerLocale(code: string, translations: Partial<T>): void;
50
50
  }
51
+ /**
52
+ * `locale` as `Intl` accepts it. Locale options take any string, and a
53
+ * backend-style tag (`fr_FR` from PHP / WordPress) makes every `Intl`
54
+ * constructor and `toLocale*` call throw a RangeError: `_` reads as `-`, and
55
+ * a tag `Intl` still rejects falls back to English, as `createT` does.
56
+ * Silent, so it is safe on a render path; see `canonicalizeLocale` for the
57
+ * one-time, warning variant.
58
+ */
59
+ export declare function intlLocale(locale: string): string;
60
+ /**
61
+ * The host's locale tag as `Intl` accepts it. `BeezpingLocale` takes any
62
+ * string, and PHP / WordPress hand out POSIX-style tags (`fr_FR`, `pt_BR`)
63
+ * that every `Intl` constructor rejects with a RangeError: `_` becomes `-`,
64
+ * then the tag is canonicalised (`fr-FR`). Falls back to `"en"`, with a
65
+ * warning, only when the tag is still invalid (empty, garbage) — meant to run
66
+ * once, where the config is read.
67
+ */
68
+ export declare function canonicalizeLocale(locale: string): string;
51
69
  /**
52
70
  * Build the i18n machinery for one message catalog.
53
71
  *
package/dist/i18n.d.ts CHANGED
@@ -48,6 +48,24 @@ export interface I18n<T> {
48
48
  */
49
49
  registerLocale(code: string, translations: Partial<T>): void;
50
50
  }
51
+ /**
52
+ * `locale` as `Intl` accepts it. Locale options take any string, and a
53
+ * backend-style tag (`fr_FR` from PHP / WordPress) makes every `Intl`
54
+ * constructor and `toLocale*` call throw a RangeError: `_` reads as `-`, and
55
+ * a tag `Intl` still rejects falls back to English, as `createT` does.
56
+ * Silent, so it is safe on a render path; see `canonicalizeLocale` for the
57
+ * one-time, warning variant.
58
+ */
59
+ export declare function intlLocale(locale: string): string;
60
+ /**
61
+ * The host's locale tag as `Intl` accepts it. `BeezpingLocale` takes any
62
+ * string, and PHP / WordPress hand out POSIX-style tags (`fr_FR`, `pt_BR`)
63
+ * that every `Intl` constructor rejects with a RangeError: `_` becomes `-`,
64
+ * then the tag is canonicalised (`fr-FR`). Falls back to `"en"`, with a
65
+ * warning, only when the tag is still invalid (empty, garbage) — meant to run
66
+ * once, where the config is read.
67
+ */
68
+ export declare function canonicalizeLocale(locale: string): string;
51
69
  /**
52
70
  * Build the i18n machinery for one message catalog.
53
71
  *