shelving 1.129.0 → 1.130.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/error/ConnectionError.d.ts +0 -2
- package/error/ConnectionError.js +0 -1
- package/error/PermissionError.d.ts +0 -1
- package/error/PermissionError.js +0 -1
- package/error/RequiredError.d.ts +0 -1
- package/error/RequiredError.js +0 -1
- package/error/StateError.d.ts +0 -2
- package/error/StateError.js +1 -2
- package/error/UnimplementedError.d.ts +0 -1
- package/error/UnimplementedError.js +0 -1
- package/error/ValueError.d.ts +0 -1
- package/error/ValueError.js +0 -1
- package/error/index.d.ts +1 -0
- package/error/index.js +1 -0
- package/package.json +1 -1
- package/schema/KeySchema.d.ts +2 -2
- package/schema/KeySchema.js +2 -2
- package/util/error.d.ts +0 -9
- package/util/error.js +0 -15
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type { ErrorCode } from "../util/error.js";
|
|
2
1
|
import { EnhancedError } from "./EnhancedError.js";
|
|
3
2
|
/** Thrown if e.g. a user's internet connection fails. */
|
|
4
3
|
export declare class ConnectionError extends EnhancedError {
|
|
5
|
-
readonly code: ErrorCode;
|
|
6
4
|
constructor(message?: string, context?: unknown);
|
|
7
5
|
}
|
package/error/ConnectionError.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { EnhancedError } from "./EnhancedError.js";
|
|
2
2
|
/** Thrown if e.g. a user's internet connection fails. */
|
|
3
3
|
export class ConnectionError extends EnhancedError {
|
|
4
|
-
code = "unavailable";
|
|
5
4
|
constructor(message = "Connection error", context) {
|
|
6
5
|
super(message, context);
|
|
7
6
|
}
|
package/error/PermissionError.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { EnhancedError } from "./EnhancedError.js";
|
|
2
2
|
/** Thrown if an operation failed due to permissions. */
|
|
3
3
|
export class PermissionError extends EnhancedError {
|
|
4
|
-
code = "permission-denied";
|
|
5
4
|
constructor(message = "Permission denied", context) {
|
|
6
5
|
super(message, context);
|
|
7
6
|
}
|
package/error/RequiredError.d.ts
CHANGED
package/error/RequiredError.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { EnhancedError } from "./EnhancedError.js";
|
|
2
2
|
/** Thrown if e.g. a value is required but wasn't provided. */
|
|
3
3
|
export class RequiredError extends EnhancedError {
|
|
4
|
-
code = "not-found";
|
|
5
4
|
constructor(message = "Value is required", context) {
|
|
6
5
|
super(message, context);
|
|
7
6
|
}
|
package/error/StateError.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type { ErrorCode } from "../util/error.js";
|
|
2
1
|
import { EnhancedError } from "./EnhancedError.js";
|
|
3
2
|
/** Thrown if the state of the program is correct to execute a given operation. */
|
|
4
3
|
export declare class StateError extends EnhancedError {
|
|
5
|
-
readonly code: ErrorCode;
|
|
6
4
|
constructor(message?: string, context?: unknown);
|
|
7
5
|
}
|
package/error/StateError.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { EnhancedError } from "./EnhancedError.js";
|
|
2
2
|
/** Thrown if the state of the program is correct to execute a given operation. */
|
|
3
3
|
export class StateError extends EnhancedError {
|
|
4
|
-
|
|
5
|
-
constructor(message = "Failed precondition", context) {
|
|
4
|
+
constructor(message = "Invalid state", context) {
|
|
6
5
|
super(message, context);
|
|
7
6
|
}
|
|
8
7
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EnhancedError } from "./EnhancedError.js";
|
|
2
2
|
/** Error thrown when functionality is called but is not implemented by an interface. */
|
|
3
3
|
export declare class UnimplementedError extends EnhancedError {
|
|
4
|
-
readonly code = "unimplemented";
|
|
5
4
|
constructor(message?: string, value?: unknown);
|
|
6
5
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { EnhancedError } from "./EnhancedError.js";
|
|
2
2
|
/** Error thrown when functionality is called but is not implemented by an interface. */
|
|
3
3
|
export class UnimplementedError extends EnhancedError {
|
|
4
|
-
code = "unimplemented";
|
|
5
4
|
constructor(message = "Not implemented", value) {
|
|
6
5
|
super(message, value);
|
|
7
6
|
}
|
package/error/ValueError.d.ts
CHANGED
package/error/ValueError.js
CHANGED
package/error/index.d.ts
CHANGED
package/error/index.js
CHANGED
package/package.json
CHANGED
package/schema/KeySchema.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { StringSchema, type StringSchemaOptions } from "./StringSchema.js";
|
|
|
8
8
|
export declare class KeySchema extends StringSchema {
|
|
9
9
|
constructor({ min, max, ...options }: StringSchemaOptions);
|
|
10
10
|
}
|
|
11
|
-
/** Valid
|
|
11
|
+
/** Valid database key. */
|
|
12
12
|
export declare const KEY: KeySchema;
|
|
13
|
-
/** Valid
|
|
13
|
+
/** Valid optional database key. */
|
|
14
14
|
export declare const OPTIONAL_KEY: import("./OptionalSchema.js").OptionalSchema<string>;
|
package/schema/KeySchema.js
CHANGED
|
@@ -11,7 +11,7 @@ export class KeySchema extends StringSchema {
|
|
|
11
11
|
super({ min, max, ...options });
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
/** Valid
|
|
14
|
+
/** Valid database key. */
|
|
15
15
|
export const KEY = new KeySchema({});
|
|
16
|
-
/** Valid
|
|
16
|
+
/** Valid optional database key. */
|
|
17
17
|
export const OPTIONAL_KEY = OPTIONAL(KEY);
|
package/util/error.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Valid error codes in gRPC.
|
|
3
|
-
* See also: https://firebase.google.com/docs/reference/node/firebase.firestore#firestoreerrorcode
|
|
4
|
-
*/
|
|
5
|
-
export type ErrorCode = "cancelled" | "unknown" | "invalid-argument" | "deadline-exceeded" | "not-found" | "already-exists" | "permission-denied" | "resource-exhausted" | "failed-precondition" | "aborted" | "out-of-range" | "unimplemented" | "internal" | "unavailable" | "data-loss" | "unauthenticated";
|
|
6
1
|
/** Callback function that reports an error. */
|
|
7
2
|
export type Report = (reason: unknown) => void;
|
|
8
3
|
/** Log an error to the console. */
|
|
@@ -11,9 +6,5 @@ export declare function logError(reason: unknown): void;
|
|
|
11
6
|
export declare function isError(v: unknown): v is Error & {
|
|
12
7
|
readonly code?: string | undefined;
|
|
13
8
|
};
|
|
14
|
-
/** Get the string `.code` property from an object or error, or `undefined` if it doesn't exist. */
|
|
15
|
-
export declare function getOptionalErrorCode(v: unknown): string | undefined;
|
|
16
|
-
/** Get the string `.code` property from an object or error, or throw `ValueError` if it doesn't exist. */
|
|
17
|
-
export declare function getErrorCode(v: unknown): string | undefined;
|
|
18
9
|
/** Pop a number of items off an error stack. */
|
|
19
10
|
export declare function popErrorStack(error: Error, count?: number): Error;
|
package/util/error.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { ValueError } from "../error/ValueError.js";
|
|
2
|
-
import { isObject } from "./object.js";
|
|
3
|
-
import { isString } from "./string.js";
|
|
4
1
|
/** Log an error to the console. */
|
|
5
2
|
export function logError(reason) {
|
|
6
3
|
console.error(reason);
|
|
@@ -9,18 +6,6 @@ export function logError(reason) {
|
|
|
9
6
|
export function isError(v) {
|
|
10
7
|
return v instanceof Error;
|
|
11
8
|
}
|
|
12
|
-
/** Get the string `.code` property from an object or error, or `undefined` if it doesn't exist. */
|
|
13
|
-
export function getOptionalErrorCode(v) {
|
|
14
|
-
if (isObject(v) && isString(v.code))
|
|
15
|
-
return v.code;
|
|
16
|
-
}
|
|
17
|
-
/** Get the string `.code` property from an object or error, or throw `ValueError` if it doesn't exist. */
|
|
18
|
-
export function getErrorCode(v) {
|
|
19
|
-
const code = getOptionalErrorCode(v);
|
|
20
|
-
if (typeof code !== "string")
|
|
21
|
-
throw new ValueError("Error code must be string", v);
|
|
22
|
-
return code;
|
|
23
|
-
}
|
|
24
9
|
/** Pop a number of items off an error stack. */
|
|
25
10
|
export function popErrorStack(error, count = 1) {
|
|
26
11
|
const { name, message, stack } = error;
|