@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/README.md +11 -11
- package/dist/beezping-core.d.cts +20 -0
- package/dist/beezping-core.d.ts +20 -0
- package/dist/concurrency.d.cts +14 -0
- package/dist/concurrency.d.ts +14 -0
- package/dist/constants/schema.d.cts +239 -0
- package/dist/constants/schema.d.ts +239 -0
- package/dist/deep-link.d.cts +14 -0
- package/dist/deep-link.d.ts +14 -0
- package/dist/email.d.cts +8 -5
- package/dist/email.d.ts +8 -5
- package/dist/errors.d.cts +28 -14
- package/dist/errors.d.ts +28 -14
- package/dist/filters.d.cts +15 -7
- package/dist/filters.d.ts +15 -7
- package/dist/i18n.d.cts +18 -0
- package/dist/i18n.d.ts +18 -0
- package/dist/index.cjs +178 -868
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +95 -213
- package/dist/index.d.ts +95 -213
- package/dist/index.js +175 -855
- package/dist/index.js.map +1 -1
- package/dist/schema.d.cts +12 -195
- package/dist/schema.d.ts +12 -195
- package/dist/screenshot-storage.d.cts +55 -30
- package/dist/screenshot-storage.d.ts +55 -30
- package/dist/store-helpers.d.cts +62 -34
- package/dist/store-helpers.d.ts +62 -34
- package/dist/type-utils.d.cts +8 -0
- package/dist/type-utils.d.ts +8 -0
- package/dist/types.d.cts +413 -154
- package/dist/types.d.ts +413 -154
- package/dist/wire.d.cts +42 -9
- package/dist/wire.d.ts +42 -9
- package/package.json +14 -10
- package/dist/siteping-core.d.cts +0 -17
- package/dist/siteping-core.d.ts +0 -17
package/dist/wire.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* HTTP wire helpers shared by every client that talks to a
|
|
2
|
+
* HTTP wire helpers shared by every client that talks to a Beezping
|
|
3
3
|
* endpoint (widget `ApiClient`, dashboard `createEndpointSource`).
|
|
4
4
|
*
|
|
5
5
|
* One definition of the query-string encoding and the HTTP→typed-error
|
|
@@ -7,29 +7,62 @@
|
|
|
7
7
|
* once (the dashboard forgot to serialize `statuses`), so they live here
|
|
8
8
|
* now.
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
10
|
+
import { BeezpingError, BeezpingNetworkError } from "./errors.cjs";
|
|
11
11
|
import type { FeedbackQuery } from "./types.cjs";
|
|
12
|
+
/**
|
|
13
|
+
* A fresh `clientId` for a write the server dedupes a resend of — a feedback,
|
|
14
|
+
* or a reply in a thread.
|
|
15
|
+
*/
|
|
16
|
+
export declare function newClientId(): string;
|
|
12
17
|
/**
|
|
13
18
|
* Encode a `FeedbackQuery` as the endpoint's expected query string.
|
|
14
19
|
* Omitted/empty filters are not serialized; `statuses` uses the CSV form
|
|
15
20
|
* the server's schema splits (`statuses=open,in_progress`).
|
|
16
21
|
*/
|
|
17
22
|
export declare function feedbackQueryToSearchParams(query: FeedbackQuery): URLSearchParams;
|
|
23
|
+
/**
|
|
24
|
+
* Merge caller-supplied `extra` headers over a client's `defaults`
|
|
25
|
+
* (`Content-Type`, `Authorization` from `apiKey`). Header names are
|
|
26
|
+
* case-insensitive, so a default spelled differently is dropped and the
|
|
27
|
+
* explicit value replaces it — a plain object merge kept both, and fetch
|
|
28
|
+
* joined them (`authorization: "Basic x"` over an apiKey went out as
|
|
29
|
+
* "Bearer k, Basic x").
|
|
30
|
+
*/
|
|
31
|
+
export declare function mergeRequestHeaders(defaults: Record<string, string>, extra: Record<string, string> | undefined): Record<string, string>;
|
|
32
|
+
/**
|
|
33
|
+
* Append `params` to `endpoint`, which may already carry a query string
|
|
34
|
+
* (`/api/beezping?tenant=acme`) or a fragment — naive `${endpoint}?${params}`
|
|
35
|
+
* produced `?tenant=acme?projectName=…`, a 400. Plain string work, so
|
|
36
|
+
* relative endpoints stay relative and nothing depends on `location`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function withSearchParams(endpoint: string, params: URLSearchParams): string;
|
|
18
39
|
/**
|
|
19
40
|
* Map a non-OK `Response` to the appropriate typed error:
|
|
20
|
-
* - 401 / 403 → `
|
|
21
|
-
* - other 4xx → `
|
|
22
|
-
* - 5xx (or anything else) → generic `
|
|
41
|
+
* - 401 / 403 → `BeezpingAuthError`, with its `status`
|
|
42
|
+
* - other 4xx → `BeezpingValidationError`, with its `status`
|
|
43
|
+
* - 5xx (or anything else) → generic `BeezpingError` (code `"SERVER"`)
|
|
23
44
|
*
|
|
24
45
|
* The response body is consumed via `.text()` so the caller keeps the
|
|
25
46
|
* server-supplied message in the thrown error; `.text()` failures fall back
|
|
26
47
|
* to `"Unknown error"` (kept verbatim — host apps grep for it).
|
|
27
48
|
*/
|
|
28
|
-
export declare function errorFromResponse(response: Response, label: string): Promise<
|
|
49
|
+
export declare function errorFromResponse(response: Response, label: string): Promise<BeezpingError>;
|
|
50
|
+
/**
|
|
51
|
+
* Whether a failed reply met a full thread — a store's `StoreLimitError`, or
|
|
52
|
+
* a 409 (the endpoint's other 409, a clientId reused on another feedback,
|
|
53
|
+
* never comes from clients that mint one per reply). Retrying won't help.
|
|
54
|
+
*/
|
|
55
|
+
export declare function isThreadFull(error: unknown): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether a failed reply delete found nothing to delete — a store's
|
|
58
|
+
* `StoreNotFoundError`, or a 404: it is gone already. (Unlike
|
|
59
|
+
* `isStoreNotFound`, no Prisma `P2025`: a browser source never meets one.)
|
|
60
|
+
*/
|
|
61
|
+
export declare function isCommentGone(error: unknown): boolean;
|
|
29
62
|
/**
|
|
30
63
|
* Normalise an exception thrown by `fetch` (or a timeout AbortController)
|
|
31
|
-
* into a `
|
|
32
|
-
* in
|
|
64
|
+
* into a `BeezpingNetworkError`. AbortErrors count as network failures —
|
|
65
|
+
* in Beezping client code they always come from internal timeouts, never a
|
|
33
66
|
* user-driven cancellation.
|
|
34
67
|
*/
|
|
35
|
-
export declare function networkErrorFromException(error: unknown, label: string):
|
|
68
|
+
export declare function networkErrorFromException(error: unknown, label: string): BeezpingNetworkError;
|
package/dist/wire.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* HTTP wire helpers shared by every client that talks to a
|
|
2
|
+
* HTTP wire helpers shared by every client that talks to a Beezping
|
|
3
3
|
* endpoint (widget `ApiClient`, dashboard `createEndpointSource`).
|
|
4
4
|
*
|
|
5
5
|
* One definition of the query-string encoding and the HTTP→typed-error
|
|
@@ -7,29 +7,62 @@
|
|
|
7
7
|
* once (the dashboard forgot to serialize `statuses`), so they live here
|
|
8
8
|
* now.
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
10
|
+
import { BeezpingError, BeezpingNetworkError } from "./errors.js";
|
|
11
11
|
import type { FeedbackQuery } from "./types.js";
|
|
12
|
+
/**
|
|
13
|
+
* A fresh `clientId` for a write the server dedupes a resend of — a feedback,
|
|
14
|
+
* or a reply in a thread.
|
|
15
|
+
*/
|
|
16
|
+
export declare function newClientId(): string;
|
|
12
17
|
/**
|
|
13
18
|
* Encode a `FeedbackQuery` as the endpoint's expected query string.
|
|
14
19
|
* Omitted/empty filters are not serialized; `statuses` uses the CSV form
|
|
15
20
|
* the server's schema splits (`statuses=open,in_progress`).
|
|
16
21
|
*/
|
|
17
22
|
export declare function feedbackQueryToSearchParams(query: FeedbackQuery): URLSearchParams;
|
|
23
|
+
/**
|
|
24
|
+
* Merge caller-supplied `extra` headers over a client's `defaults`
|
|
25
|
+
* (`Content-Type`, `Authorization` from `apiKey`). Header names are
|
|
26
|
+
* case-insensitive, so a default spelled differently is dropped and the
|
|
27
|
+
* explicit value replaces it — a plain object merge kept both, and fetch
|
|
28
|
+
* joined them (`authorization: "Basic x"` over an apiKey went out as
|
|
29
|
+
* "Bearer k, Basic x").
|
|
30
|
+
*/
|
|
31
|
+
export declare function mergeRequestHeaders(defaults: Record<string, string>, extra: Record<string, string> | undefined): Record<string, string>;
|
|
32
|
+
/**
|
|
33
|
+
* Append `params` to `endpoint`, which may already carry a query string
|
|
34
|
+
* (`/api/beezping?tenant=acme`) or a fragment — naive `${endpoint}?${params}`
|
|
35
|
+
* produced `?tenant=acme?projectName=…`, a 400. Plain string work, so
|
|
36
|
+
* relative endpoints stay relative and nothing depends on `location`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function withSearchParams(endpoint: string, params: URLSearchParams): string;
|
|
18
39
|
/**
|
|
19
40
|
* Map a non-OK `Response` to the appropriate typed error:
|
|
20
|
-
* - 401 / 403 → `
|
|
21
|
-
* - other 4xx → `
|
|
22
|
-
* - 5xx (or anything else) → generic `
|
|
41
|
+
* - 401 / 403 → `BeezpingAuthError`, with its `status`
|
|
42
|
+
* - other 4xx → `BeezpingValidationError`, with its `status`
|
|
43
|
+
* - 5xx (or anything else) → generic `BeezpingError` (code `"SERVER"`)
|
|
23
44
|
*
|
|
24
45
|
* The response body is consumed via `.text()` so the caller keeps the
|
|
25
46
|
* server-supplied message in the thrown error; `.text()` failures fall back
|
|
26
47
|
* to `"Unknown error"` (kept verbatim — host apps grep for it).
|
|
27
48
|
*/
|
|
28
|
-
export declare function errorFromResponse(response: Response, label: string): Promise<
|
|
49
|
+
export declare function errorFromResponse(response: Response, label: string): Promise<BeezpingError>;
|
|
50
|
+
/**
|
|
51
|
+
* Whether a failed reply met a full thread — a store's `StoreLimitError`, or
|
|
52
|
+
* a 409 (the endpoint's other 409, a clientId reused on another feedback,
|
|
53
|
+
* never comes from clients that mint one per reply). Retrying won't help.
|
|
54
|
+
*/
|
|
55
|
+
export declare function isThreadFull(error: unknown): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether a failed reply delete found nothing to delete — a store's
|
|
58
|
+
* `StoreNotFoundError`, or a 404: it is gone already. (Unlike
|
|
59
|
+
* `isStoreNotFound`, no Prisma `P2025`: a browser source never meets one.)
|
|
60
|
+
*/
|
|
61
|
+
export declare function isCommentGone(error: unknown): boolean;
|
|
29
62
|
/**
|
|
30
63
|
* Normalise an exception thrown by `fetch` (or a timeout AbortController)
|
|
31
|
-
* into a `
|
|
32
|
-
* in
|
|
64
|
+
* into a `BeezpingNetworkError`. AbortErrors count as network failures —
|
|
65
|
+
* in Beezping client code they always come from internal timeouts, never a
|
|
33
66
|
* user-driven cancellation.
|
|
34
67
|
*/
|
|
35
|
-
export declare function networkErrorFromException(error: unknown, label: string):
|
|
68
|
+
export declare function networkErrorFromException(error: unknown, label: string): BeezpingNetworkError;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beezping/adapter-prisma",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Prisma adapter for
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "Prisma adapter for Beezping — server-side request handlers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"exports": {
|
|
@@ -25,11 +25,10 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "tsup && node ../../scripts/fix-dts.mjs dist",
|
|
27
27
|
"check": "tsc --noEmit",
|
|
28
|
-
"clean": "rm -rf dist"
|
|
29
|
-
"prepublishOnly": "beez-rp guard-publish"
|
|
28
|
+
"clean": "rm -rf dist"
|
|
30
29
|
},
|
|
31
30
|
"keywords": [
|
|
32
|
-
"
|
|
31
|
+
"beezping",
|
|
33
32
|
"prisma",
|
|
34
33
|
"adapter",
|
|
35
34
|
"feedback",
|
|
@@ -41,14 +40,14 @@
|
|
|
41
40
|
],
|
|
42
41
|
"author": "neosianexus",
|
|
43
42
|
"license": "MIT",
|
|
44
|
-
"homepage": "https://
|
|
43
|
+
"homepage": "https://github.com/guidomodarelli/beezping",
|
|
45
44
|
"repository": {
|
|
46
45
|
"type": "git",
|
|
47
|
-
"url": "git+https://github.com/guidomodarelli/
|
|
46
|
+
"url": "git+https://github.com/guidomodarelli/beezping.git",
|
|
48
47
|
"directory": "packages/adapter-prisma"
|
|
49
48
|
},
|
|
50
49
|
"bugs": {
|
|
51
|
-
"url": "https://github.com/guidomodarelli/
|
|
50
|
+
"url": "https://github.com/guidomodarelli/beezping/issues"
|
|
52
51
|
},
|
|
53
52
|
"publishConfig": {
|
|
54
53
|
"access": "public"
|
|
@@ -57,13 +56,18 @@
|
|
|
57
56
|
"node": ">=20"
|
|
58
57
|
},
|
|
59
58
|
"dependencies": {
|
|
60
|
-
"
|
|
59
|
+
"@beezping/server": "^0.2.0"
|
|
61
60
|
},
|
|
62
61
|
"devDependencies": {
|
|
63
62
|
"@beezping/core": "workspace:*",
|
|
64
|
-
"@beezping/
|
|
63
|
+
"@beezping/screenshot-storage": "workspace:*"
|
|
65
64
|
},
|
|
66
65
|
"peerDependencies": {
|
|
67
66
|
"@prisma/client": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
67
|
+
},
|
|
68
|
+
"peerDependenciesMeta": {
|
|
69
|
+
"@prisma/client": {
|
|
70
|
+
"optional": true
|
|
71
|
+
}
|
|
68
72
|
}
|
|
69
73
|
}
|
package/dist/siteping-core.d.cts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export { EMAIL_PATTERN, isValidEmail } from "./email.cjs";
|
|
2
|
-
export type { SitepingErrorCode } from "./errors.cjs";
|
|
3
|
-
export { SitepingAuthError, SitepingError, SitepingNetworkError, SitepingValidationError } from "./errors.cjs";
|
|
4
|
-
export type { FilterResult, Pagination } from "./filters.cjs";
|
|
5
|
-
export { applyFeedbackFilters, clampPagination, DEFAULT_PAGE_LIMIT, isUnreachableOffset, MAX_PAGE_LIMIT, } from "./filters.cjs";
|
|
6
|
-
export type { I18n, LocaleLoaders, TranslateFunction } from "./i18n.cjs";
|
|
7
|
-
export { createI18n, interpolate, tWithParams } from "./i18n.cjs";
|
|
8
|
-
export type { FieldDef, IndexDef, ModelDef, PrismaNativeType, PrismaScalarType, RelationDef, RelationKind, RelationOnDelete, SitepingModelFieldName, SitepingModelName, } from "./schema.cjs";
|
|
9
|
-
export { isRelationField, isScalarField, SITEPING_MODELS } from "./schema.cjs";
|
|
10
|
-
export type { ScreenshotStorage } from "./screenshot-storage.cjs";
|
|
11
|
-
export type { CollectionStore, CollectionStoreBackend } from "./store-helpers.cjs";
|
|
12
|
-
export { buildAnnotationRecord, buildFeedbackRecord, createCollectionStore } from "./store-helpers.cjs";
|
|
13
|
-
export type { AssertEqual, IfEquals, Prettify, Serialized } from "./type-utils.cjs";
|
|
14
|
-
export { hasOwn, isRecord } from "./type-utils.cjs";
|
|
15
|
-
export type { AnchorData, AnnotationCreateInput, AnnotationPayload, AnnotationRecord, AnnotationResponse, BuiltinLocale, ClosedFeedbackStatus, ConsoleDiagnosticEntry, ConsoleDiagnosticLevel, DiagnosticsCaptureOptions, DiagnosticsSnapshot, FeedbackCreateInput, FeedbackCreateOutcome, FeedbackPage, FeedbackPayload, FeedbackQuery, FeedbackRecord, FeedbackResponse, FeedbackResponseList, FeedbackStatus, FeedbackType, FeedbackUpdateInput, NetworkDiagnosticEntry, OpenFeedbackStatus, PageScope, RectData, ScreenshotRegion, SitepingBaseConfig, SitepingConfig, SitepingDeepLinkOptions, SitepingHeadersOption, SitepingHttpConfig, SitepingIdentity, SitepingInstance, SitepingLocale, SitepingPosition, SitepingPublicEventListener, SitepingPublicEvents, SitepingRequestCredentials, SitepingSkipReason, SitepingStore, SitepingStoreConfig, SitepingTheme, SitepingUnsubscribe, } from "./types.cjs";
|
|
16
|
-
export { BUILTIN_LOCALES, CLOSED_FEEDBACK_STATUSES, CONSOLE_DIAGNOSTIC_LEVELS, DEFAULT_REQUEST_CREDENTIALS, describeInvalidRequestCredentials, FEEDBACK_STATUSES, FEEDBACK_TYPES, flattenAnnotation, isClosedStatus, isRequestCredentials, isStoreDuplicate, isStoreNotFound, isStorePersistence, OPEN_FEEDBACK_STATUSES, REQUEST_CREDENTIALS_MODES, StoreDuplicateError, StoreNotFoundError, StorePersistenceError, toFeedbackUpdate, } from "./types.cjs";
|
|
17
|
-
export { errorFromResponse, feedbackQueryToSearchParams, networkErrorFromException } from "./wire.cjs";
|
package/dist/siteping-core.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export { EMAIL_PATTERN, isValidEmail } from "./email.js";
|
|
2
|
-
export type { SitepingErrorCode } from "./errors.js";
|
|
3
|
-
export { SitepingAuthError, SitepingError, SitepingNetworkError, SitepingValidationError } from "./errors.js";
|
|
4
|
-
export type { FilterResult, Pagination } from "./filters.js";
|
|
5
|
-
export { applyFeedbackFilters, clampPagination, DEFAULT_PAGE_LIMIT, isUnreachableOffset, MAX_PAGE_LIMIT, } from "./filters.js";
|
|
6
|
-
export type { I18n, LocaleLoaders, TranslateFunction } from "./i18n.js";
|
|
7
|
-
export { createI18n, interpolate, tWithParams } from "./i18n.js";
|
|
8
|
-
export type { FieldDef, IndexDef, ModelDef, PrismaNativeType, PrismaScalarType, RelationDef, RelationKind, RelationOnDelete, SitepingModelFieldName, SitepingModelName, } from "./schema.js";
|
|
9
|
-
export { isRelationField, isScalarField, SITEPING_MODELS } from "./schema.js";
|
|
10
|
-
export type { ScreenshotStorage } from "./screenshot-storage.js";
|
|
11
|
-
export type { CollectionStore, CollectionStoreBackend } from "./store-helpers.js";
|
|
12
|
-
export { buildAnnotationRecord, buildFeedbackRecord, createCollectionStore } from "./store-helpers.js";
|
|
13
|
-
export type { AssertEqual, IfEquals, Prettify, Serialized } from "./type-utils.js";
|
|
14
|
-
export { hasOwn, isRecord } from "./type-utils.js";
|
|
15
|
-
export type { AnchorData, AnnotationCreateInput, AnnotationPayload, AnnotationRecord, AnnotationResponse, BuiltinLocale, ClosedFeedbackStatus, ConsoleDiagnosticEntry, ConsoleDiagnosticLevel, DiagnosticsCaptureOptions, DiagnosticsSnapshot, FeedbackCreateInput, FeedbackCreateOutcome, FeedbackPage, FeedbackPayload, FeedbackQuery, FeedbackRecord, FeedbackResponse, FeedbackResponseList, FeedbackStatus, FeedbackType, FeedbackUpdateInput, NetworkDiagnosticEntry, OpenFeedbackStatus, PageScope, RectData, ScreenshotRegion, SitepingBaseConfig, SitepingConfig, SitepingDeepLinkOptions, SitepingHeadersOption, SitepingHttpConfig, SitepingIdentity, SitepingInstance, SitepingLocale, SitepingPosition, SitepingPublicEventListener, SitepingPublicEvents, SitepingRequestCredentials, SitepingSkipReason, SitepingStore, SitepingStoreConfig, SitepingTheme, SitepingUnsubscribe, } from "./types.js";
|
|
16
|
-
export { BUILTIN_LOCALES, CLOSED_FEEDBACK_STATUSES, CONSOLE_DIAGNOSTIC_LEVELS, DEFAULT_REQUEST_CREDENTIALS, describeInvalidRequestCredentials, FEEDBACK_STATUSES, FEEDBACK_TYPES, flattenAnnotation, isClosedStatus, isRequestCredentials, isStoreDuplicate, isStoreNotFound, isStorePersistence, OPEN_FEEDBACK_STATUSES, REQUEST_CREDENTIALS_MODES, StoreDuplicateError, StoreNotFoundError, StorePersistenceError, toFeedbackUpdate, } from "./types.js";
|
|
17
|
-
export { errorFromResponse, feedbackQueryToSearchParams, networkErrorFromException } from "./wire.js";
|