@atproto/lex-data 0.0.9 → 0.0.10
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/CHANGELOG.md +6 -0
- package/dist/lex-error.d.ts +3 -2
- package/dist/lex-error.d.ts.map +1 -1
- package/dist/lex-error.js +3 -2
- package/dist/lex-error.js.map +1 -1
- package/package.json +1 -1
- package/src/cid-implementation.test.ts +0 -2
- package/src/cid.test.ts +0 -2
- package/src/lex-error.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atproto/lex-data
|
|
2
2
|
|
|
3
|
+
## 0.0.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#4589](https://github.com/bluesky-social/atproto/pull/4589) [`369bb02`](https://github.com/bluesky-social/atproto/commit/369bb02b9f80f0e15e5242e54f09bd4e01117f3a) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Avoid exposing empty string as `message` in error payloads
|
|
8
|
+
|
|
3
9
|
## 0.0.9
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/lex-error.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type LexErrorCode = string
|
|
1
|
+
export type LexErrorCode = string & NonNullable<unknown>;
|
|
2
2
|
export type LexErrorData<N extends LexErrorCode = LexErrorCode> = {
|
|
3
3
|
error: N;
|
|
4
4
|
message?: string;
|
|
@@ -6,7 +6,8 @@ export type LexErrorData<N extends LexErrorCode = LexErrorCode> = {
|
|
|
6
6
|
export declare class LexError<N extends LexErrorCode = LexErrorCode> extends Error {
|
|
7
7
|
readonly error: N;
|
|
8
8
|
name: string;
|
|
9
|
-
constructor(error: N, message?: string,
|
|
9
|
+
constructor(error: N, message?: string, // Defaults to empty string in Error constructor
|
|
10
|
+
options?: ErrorOptions);
|
|
10
11
|
toString(): string;
|
|
11
12
|
toJSON(): LexErrorData<N>;
|
|
12
13
|
/**
|
package/dist/lex-error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lex-error.d.ts","sourceRoot":"","sources":["../src/lex-error.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"lex-error.d.ts","sourceRoot":"","sources":["../src/lex-error.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;AAExD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,IAAI;IAChE,KAAK,EAAE,CAAC,CAAA;IACR,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,qBAAa,QAAQ,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,CAAE,SAAQ,KAAK;IAItE,QAAQ,CAAC,KAAK,EAAE,CAAC;IAHnB,IAAI,SAAa;gBAGN,KAAK,EAAE,CAAC,EACjB,OAAO,CAAC,EAAE,MAAM,EAAE,gDAAgD;IAClE,OAAO,CAAC,EAAE,YAAY;IAKxB,QAAQ,IAAI,MAAM;IAIlB,MAAM,IAAI,YAAY,CAAC,CAAC,CAAC;IAKzB;;OAEG;IACH,UAAU,IAAI,QAAQ;CAGvB"}
|
package/dist/lex-error.js
CHANGED
|
@@ -4,7 +4,8 @@ exports.LexError = void 0;
|
|
|
4
4
|
class LexError extends Error {
|
|
5
5
|
error;
|
|
6
6
|
name = 'LexError';
|
|
7
|
-
constructor(error, message,
|
|
7
|
+
constructor(error, message, // Defaults to empty string in Error constructor
|
|
8
|
+
options) {
|
|
8
9
|
super(message, options);
|
|
9
10
|
this.error = error;
|
|
10
11
|
}
|
|
@@ -13,7 +14,7 @@ class LexError extends Error {
|
|
|
13
14
|
}
|
|
14
15
|
toJSON() {
|
|
15
16
|
const { error, message } = this;
|
|
16
|
-
return { error, message: message
|
|
17
|
+
return { error, message: message || undefined };
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* Translate into an HTTP response for downstream clients.
|
package/dist/lex-error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lex-error.js","sourceRoot":"","sources":["../src/lex-error.ts"],"names":[],"mappings":";;;AAOA,MAAa,QAAgD,SAAQ,KAAK;IAI7D;IAHX,IAAI,GAAG,UAAU,CAAA;IAEjB,YACW,KAAQ,EACjB,OAAgB,
|
|
1
|
+
{"version":3,"file":"lex-error.js","sourceRoot":"","sources":["../src/lex-error.ts"],"names":[],"mappings":";;;AAOA,MAAa,QAAgD,SAAQ,KAAK;IAI7D;IAHX,IAAI,GAAG,UAAU,CAAA;IAEjB,YACW,KAAQ,EACjB,OAAgB,EAAE,gDAAgD;IAClE,OAAsB;QAEtB,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAJd,UAAK,GAAL,KAAK,CAAG;IAKnB,CAAC;IAED,QAAQ;QACN,OAAO,GAAG,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,OAAO,EAAE,CAAA;IACxD,CAAC;IAED,MAAM;QACJ,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;QAC/B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,CAAA;IACjD,CAAC;IAED;;OAEG;IACH,UAAU;QACR,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;IACtD,CAAC;CACF;AA1BD,4BA0BC","sourcesContent":["export type LexErrorCode = string & NonNullable<unknown>\n\nexport type LexErrorData<N extends LexErrorCode = LexErrorCode> = {\n error: N\n message?: string\n}\n\nexport class LexError<N extends LexErrorCode = LexErrorCode> extends Error {\n name = 'LexError'\n\n constructor(\n readonly error: N,\n message?: string, // Defaults to empty string in Error constructor\n options?: ErrorOptions,\n ) {\n super(message, options)\n }\n\n toString(): string {\n return `${this.name}: [${this.error}] ${this.message}`\n }\n\n toJSON(): LexErrorData<N> {\n const { error, message } = this\n return { error, message: message || undefined }\n }\n\n /**\n * Translate into an HTTP response for downstream clients.\n */\n toResponse(): Response {\n return Response.json(this.toJSON(), { status: 400 })\n }\n}\n"]}
|
package/package.json
CHANGED
package/src/cid.test.ts
CHANGED
package/src/lex-error.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type LexErrorCode = string
|
|
1
|
+
export type LexErrorCode = string & NonNullable<unknown>
|
|
2
2
|
|
|
3
3
|
export type LexErrorData<N extends LexErrorCode = LexErrorCode> = {
|
|
4
4
|
error: N
|
|
@@ -10,7 +10,7 @@ export class LexError<N extends LexErrorCode = LexErrorCode> extends Error {
|
|
|
10
10
|
|
|
11
11
|
constructor(
|
|
12
12
|
readonly error: N,
|
|
13
|
-
message?: string,
|
|
13
|
+
message?: string, // Defaults to empty string in Error constructor
|
|
14
14
|
options?: ErrorOptions,
|
|
15
15
|
) {
|
|
16
16
|
super(message, options)
|
|
@@ -22,7 +22,7 @@ export class LexError<N extends LexErrorCode = LexErrorCode> extends Error {
|
|
|
22
22
|
|
|
23
23
|
toJSON(): LexErrorData<N> {
|
|
24
24
|
const { error, message } = this
|
|
25
|
-
return { error, message: message
|
|
25
|
+
return { error, message: message || undefined }
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|