@firebase/data-connect 0.3.2 → 0.3.3

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/public.d.ts CHANGED
@@ -52,6 +52,26 @@ export declare class DataConnect {
52
52
  setInitialized(): void;
53
53
  enableEmulator(transportOptions: TransportOptions): void;
54
54
  }
55
+ /** An error returned by a DataConnect operation. */
56
+ export declare class DataConnectError extends FirebaseError {
57
+ private constructor();
58
+ }
59
+ export declare type DataConnectErrorCode = 'other' | 'already-initialized' | 'not-initialized' | 'not-supported' | 'invalid-argument' | 'partial-error' | 'unauthorized';
60
+ /** An error returned by a DataConnect operation. */
61
+ export declare class DataConnectOperationError extends DataConnectError {
62
+ /* Excluded from this release type: name */
63
+ /** The response received from the backend. */
64
+ readonly response: DataConnectOperationFailureResponse;
65
+ private constructor();
66
+ }
67
+ export declare interface DataConnectOperationFailureResponse {
68
+ readonly data?: Record<string, unknown> | null;
69
+ readonly errors: DataConnectOperationFailureResponseErrorInfo[];
70
+ }
71
+ export declare interface DataConnectOperationFailureResponseErrorInfo {
72
+ readonly message: string;
73
+ readonly path: Array<string | number>;
74
+ }
55
75
  /**
56
76
  * DataConnectOptions including project id
57
77
  */
@@ -66,7 +86,7 @@ export declare interface DataConnectResult<Data, Variables> extends OpResult<Dat
66
86
  */
67
87
  export declare interface DataConnectSubscription<Data, Variables> {
68
88
  userCallback: OnResultSubscription<Data, Variables>;
69
- errCallback?: (e?: FirebaseError) => void;
89
+ errCallback?: (e?: DataConnectError) => void;
70
90
  unsubscribe: () => void;
71
91
  }
72
92
  /* Excluded from this release type: DataConnectTransport */
@@ -130,7 +150,7 @@ export declare type OnCompleteSubscription = () => void;
130
150
  /**
131
151
  * Signature for `OnErrorSubscription` for `subscribe`
132
152
  */
133
- export declare type OnErrorSubscription = (err?: FirebaseError) => void;
153
+ export declare type OnErrorSubscription = (err?: DataConnectError) => void;
134
154
  /**
135
155
  * Signature for `OnResultSubscription` for `subscribe`
136
156
  */
@@ -21,3 +21,4 @@ export * from './Mutation';
21
21
  export * from './query';
22
22
  export { setLogLevel } from '../logger';
23
23
  export { validateArgs } from '../util/validateArgs';
24
+ export { DataConnectErrorCode, DataConnectError, DataConnectOperationError, DataConnectOperationFailureResponse, DataConnectOperationFailureResponseErrorInfo } from '../core/error';
@@ -28,24 +28,27 @@ export declare const Code: {
28
28
  };
29
29
  /** An error returned by a DataConnect operation. */
30
30
  export declare class DataConnectError extends FirebaseError {
31
- /**
32
- * The backend error code associated with this error.
33
- */
34
- readonly code: DataConnectErrorCode;
35
- /**
36
- * A custom error description.
37
- */
38
- readonly message: string;
39
- /** The stack of the error. */
40
- readonly stack?: string;
31
+ /** @internal */
32
+ readonly name: string;
33
+ /** @hideconstructor */
34
+ constructor(code: Code, message: string);
35
+ /** @internal */
36
+ toString(): string;
37
+ }
38
+ /** An error returned by a DataConnect operation. */
39
+ export declare class DataConnectOperationError extends DataConnectError {
40
+ /** @internal */
41
+ readonly name: string;
42
+ /** The response received from the backend. */
43
+ readonly response: DataConnectOperationFailureResponse;
41
44
  /** @hideconstructor */
42
- constructor(
43
- /**
44
- * The backend error code associated with this error.
45
- */
46
- code: DataConnectErrorCode,
47
- /**
48
- * A custom error description.
49
- */
50
- message: string);
45
+ constructor(message: string, response: DataConnectOperationFailureResponse);
46
+ }
47
+ export interface DataConnectOperationFailureResponse {
48
+ readonly data?: Record<string, unknown> | null;
49
+ readonly errors: DataConnectOperationFailureResponseErrorInfo[];
50
+ }
51
+ export interface DataConnectOperationFailureResponseErrorInfo {
52
+ readonly message: string;
53
+ readonly path: Array<string | number>;
51
54
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/data-connect",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "",
5
5
  "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
6
6
  "main": "dist/index.node.cjs.js",
@@ -55,7 +55,7 @@
55
55
  "tslib": "^2.1.0"
56
56
  },
57
57
  "devDependencies": {
58
- "@firebase/app": "0.11.3",
58
+ "@firebase/app": "0.11.4",
59
59
  "rollup": "2.79.2",
60
60
  "rollup-plugin-typescript2": "0.36.0",
61
61
  "typescript": "5.5.4"