@lunora/errors 1.0.0-alpha.1 → 1.0.0-alpha.2
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/LICENSE.md +6 -0
- package/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.mjs +4 -4
- package/dist/packem_shared/{ERROR_CATALOG-D3knuUQT.mjs → ERROR_CATALOG-DAg3Unhb.mjs} +21 -8
- package/dist/packem_shared/{LunoraError-bpS_TPIe.mjs → LunoraError-Dg03M4uC.mjs} +1 -1
- package/dist/packem_shared/{invariant-DLXTsHpj.mjs → invariant-BsrkuTaN.mjs} +1 -1
- package/dist/packem_shared/{toErrorBody-DihI5p4Q.mjs → toErrorBody-BbR2r6pO.mjs} +1 -1
- package/package.json +1 -1
package/LICENSE.md
CHANGED
|
@@ -103,3 +103,9 @@ Unless required by applicable law or agreed to in writing, software distributed
|
|
|
103
103
|
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
104
|
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
105
|
specific language governing permissions and limitations under the License.
|
|
106
|
+
|
|
107
|
+
<!-- DEPENDENCIES -->
|
|
108
|
+
<!-- /DEPENDENCIES -->
|
|
109
|
+
|
|
110
|
+
<!-- TYPE_DEPENDENCIES -->
|
|
111
|
+
<!-- /TYPE_DEPENDENCIES -->
|
package/dist/index.d.mts
CHANGED
|
@@ -59,9 +59,9 @@ declare const ERROR_CATALOG: {
|
|
|
59
59
|
readonly title: "Conflict";
|
|
60
60
|
};
|
|
61
61
|
readonly NOT_UNIQUE: {
|
|
62
|
-
readonly hint: readonly ["
|
|
62
|
+
readonly hint: readonly ["`.unique()` matched more than one document — it expects the query to identify at most one row.", "", "- If several matches are legitimate, use `.first()` (take one) or `.collect()` (take all) instead.", "- Otherwise tighten the query (e.g. filter on a unique/indexed field) so it can only match one row."];
|
|
63
63
|
readonly status: 400;
|
|
64
|
-
readonly title: "
|
|
64
|
+
readonly title: "Query matched more than one document";
|
|
65
65
|
};
|
|
66
66
|
readonly VALIDATION_ERROR: {
|
|
67
67
|
readonly status: 400;
|
|
@@ -136,20 +136,25 @@ declare const ERROR_CATALOG: {
|
|
|
136
136
|
readonly OFFLINE_IDENTITY_CHANGED: {
|
|
137
137
|
readonly status: 409;
|
|
138
138
|
readonly title: "Offline identity changed";
|
|
139
|
-
}; /** Package-specific codes. Build-time
|
|
139
|
+
}; /** Package-specific codes. Build-time-only — never cross the RPC wire, so deliberately not `internal`. */
|
|
140
140
|
readonly CODEGEN_DIAGNOSTIC: {
|
|
141
141
|
readonly status: 500;
|
|
142
142
|
readonly title: "Codegen diagnostic";
|
|
143
143
|
};
|
|
144
|
+
/** Build-time-only — never crosses the RPC wire, so deliberately not `internal`. */
|
|
144
145
|
readonly SCHEMA_SNAPSHOT_PARSE: {
|
|
145
146
|
readonly status: 500;
|
|
146
147
|
readonly title: "Schema snapshot parse error";
|
|
147
148
|
};
|
|
149
|
+
/** Runtime-reachable (env.ts): message enumerates failing env key names — redact on the wire. */
|
|
148
150
|
readonly ENV_INVALID: {
|
|
151
|
+
readonly internal: true;
|
|
149
152
|
readonly status: 500;
|
|
150
153
|
readonly title: "Invalid environment";
|
|
151
154
|
};
|
|
155
|
+
/** Runtime-reachable (auth/middleware.ts): message carries auth-wiring guidance — redact on the wire. */
|
|
152
156
|
readonly AUTH_HEADERS_MISSING: {
|
|
157
|
+
readonly internal: true;
|
|
153
158
|
readonly status: 500;
|
|
154
159
|
readonly title: "Auth headers missing";
|
|
155
160
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -59,9 +59,9 @@ declare const ERROR_CATALOG: {
|
|
|
59
59
|
readonly title: "Conflict";
|
|
60
60
|
};
|
|
61
61
|
readonly NOT_UNIQUE: {
|
|
62
|
-
readonly hint: readonly ["
|
|
62
|
+
readonly hint: readonly ["`.unique()` matched more than one document — it expects the query to identify at most one row.", "", "- If several matches are legitimate, use `.first()` (take one) or `.collect()` (take all) instead.", "- Otherwise tighten the query (e.g. filter on a unique/indexed field) so it can only match one row."];
|
|
63
63
|
readonly status: 400;
|
|
64
|
-
readonly title: "
|
|
64
|
+
readonly title: "Query matched more than one document";
|
|
65
65
|
};
|
|
66
66
|
readonly VALIDATION_ERROR: {
|
|
67
67
|
readonly status: 400;
|
|
@@ -136,20 +136,25 @@ declare const ERROR_CATALOG: {
|
|
|
136
136
|
readonly OFFLINE_IDENTITY_CHANGED: {
|
|
137
137
|
readonly status: 409;
|
|
138
138
|
readonly title: "Offline identity changed";
|
|
139
|
-
}; /** Package-specific codes. Build-time
|
|
139
|
+
}; /** Package-specific codes. Build-time-only — never cross the RPC wire, so deliberately not `internal`. */
|
|
140
140
|
readonly CODEGEN_DIAGNOSTIC: {
|
|
141
141
|
readonly status: 500;
|
|
142
142
|
readonly title: "Codegen diagnostic";
|
|
143
143
|
};
|
|
144
|
+
/** Build-time-only — never crosses the RPC wire, so deliberately not `internal`. */
|
|
144
145
|
readonly SCHEMA_SNAPSHOT_PARSE: {
|
|
145
146
|
readonly status: 500;
|
|
146
147
|
readonly title: "Schema snapshot parse error";
|
|
147
148
|
};
|
|
149
|
+
/** Runtime-reachable (env.ts): message enumerates failing env key names — redact on the wire. */
|
|
148
150
|
readonly ENV_INVALID: {
|
|
151
|
+
readonly internal: true;
|
|
149
152
|
readonly status: 500;
|
|
150
153
|
readonly title: "Invalid environment";
|
|
151
154
|
};
|
|
155
|
+
/** Runtime-reachable (auth/middleware.ts): message carries auth-wiring guidance — redact on the wire. */
|
|
152
156
|
readonly AUTH_HEADERS_MISSING: {
|
|
157
|
+
readonly internal: true;
|
|
153
158
|
readonly status: 500;
|
|
154
159
|
readonly title: "Auth headers missing";
|
|
155
160
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { LunoraError } from './packem_shared/LunoraError-
|
|
2
|
-
export { ERROR_CATALOG, MESSAGE_SOLUTIONS, findSolutionByMessage, flattenHint, isInternalCode, resolveHint } from './packem_shared/ERROR_CATALOG-
|
|
1
|
+
export { LunoraError } from './packem_shared/LunoraError-Dg03M4uC.mjs';
|
|
2
|
+
export { ERROR_CATALOG, MESSAGE_SOLUTIONS, findSolutionByMessage, flattenHint, isInternalCode, resolveHint } from './packem_shared/ERROR_CATALOG-DAg3Unhb.mjs';
|
|
3
3
|
export { isLunoraError } from './packem_shared/isLunoraError-BvsoKcWE.mjs';
|
|
4
|
-
export { invariant, unreachable } from './packem_shared/invariant-
|
|
5
|
-
export { toErrorBody } from './packem_shared/toErrorBody-
|
|
4
|
+
export { invariant, unreachable } from './packem_shared/invariant-BsrkuTaN.mjs';
|
|
5
|
+
export { toErrorBody } from './packem_shared/toErrorBody-BbR2r6pO.mjs';
|
|
@@ -14,13 +14,13 @@ const ERROR_CATALOG = {
|
|
|
14
14
|
},
|
|
15
15
|
NOT_UNIQUE: {
|
|
16
16
|
hint: [
|
|
17
|
-
"
|
|
17
|
+
"`.unique()` matched more than one document — it expects the query to identify at most one row.",
|
|
18
18
|
"",
|
|
19
|
-
"- If
|
|
20
|
-
|
|
19
|
+
"- If several matches are legitimate, use `.first()` (take one) or `.collect()` (take all) instead.",
|
|
20
|
+
"- Otherwise tighten the query (e.g. filter on a unique/indexed field) so it can only match one row."
|
|
21
21
|
],
|
|
22
22
|
status: 400,
|
|
23
|
-
title: "
|
|
23
|
+
title: "Query matched more than one document"
|
|
24
24
|
},
|
|
25
25
|
VALIDATION_ERROR: { status: 400, title: "Validation failed" },
|
|
26
26
|
TOO_MANY_REQUESTS: { status: 429, title: "Too many requests" },
|
|
@@ -51,11 +51,14 @@ const ERROR_CATALOG = {
|
|
|
51
51
|
SHARD_ERROR: { status: 503, title: "Shard error" },
|
|
52
52
|
SHARD_UNAVAILABLE: { status: 503, title: "Shard unavailable" },
|
|
53
53
|
OFFLINE_IDENTITY_CHANGED: { status: 409, title: "Offline identity changed" },
|
|
54
|
-
/** Package-specific codes. Build-time
|
|
54
|
+
/** Package-specific codes. Build-time-only — never cross the RPC wire, so deliberately not `internal`. */
|
|
55
55
|
CODEGEN_DIAGNOSTIC: { status: 500, title: "Codegen diagnostic" },
|
|
56
|
+
/** Build-time-only — never crosses the RPC wire, so deliberately not `internal`. */
|
|
56
57
|
SCHEMA_SNAPSHOT_PARSE: { status: 500, title: "Schema snapshot parse error" },
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
/** Runtime-reachable (env.ts): message enumerates failing env key names — redact on the wire. */
|
|
59
|
+
ENV_INVALID: { internal: true, status: 500, title: "Invalid environment" },
|
|
60
|
+
/** Runtime-reachable (auth/middleware.ts): message carries auth-wiring guidance — redact on the wire. */
|
|
61
|
+
AUTH_HEADERS_MISSING: { internal: true, status: 500, title: "Auth headers missing" },
|
|
59
62
|
/**
|
|
60
63
|
* Upstream Cloudflare API failures surfaced from an action. The message
|
|
61
64
|
* carries the upstream response body (Cloudflare's own error text — trusted
|
|
@@ -167,7 +170,17 @@ const MESSAGE_SOLUTIONS = [
|
|
|
167
170
|
test: (message) => message.includes("not exported by your worker entry")
|
|
168
171
|
},
|
|
169
172
|
{
|
|
170
|
-
|
|
173
|
+
// Deliberately NOT ERROR_CATALOG.NOT_UNIQUE.hint: that code (and hint)
|
|
174
|
+
// describes the read-side `.unique()` multi-match, while this matcher
|
|
175
|
+
// fires on the WRITE-path message ("unique constraint violation on
|
|
176
|
+
// <table>") thrown as a CONFLICT by an insert/patch breaching a
|
|
177
|
+
// `unique` index — a different error class needing insert remediation.
|
|
178
|
+
body: [
|
|
179
|
+
"A row with the same value already exists in a `unique` index.",
|
|
180
|
+
"",
|
|
181
|
+
"- If you meant to upsert, use `ctx.db.<table>().upsert(...)` (or `.patch(...)` an existing row) instead of `.insert(...)`.",
|
|
182
|
+
`- Otherwise pick a value that isn't already taken, and consider surfacing a friendly "already exists" message to the user.`
|
|
183
|
+
].join("\n"),
|
|
171
184
|
header: "Unique constraint violation",
|
|
172
185
|
id: "lunora-runtime-unique",
|
|
173
186
|
test: (message) => message.includes("unique constraint violation on")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/errors",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.2",
|
|
4
4
|
"description": "Unified error layer for Lunora: one LunoraError base + a central catalog of codes, statuses, and actionable hints, rendered across CLI, overlay, Studio, and the client",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|