@forge/sql 0.0.1-experimental-c8ed390 → 0.0.1-experimental-6353b34

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/out/sql.js CHANGED
@@ -34,7 +34,7 @@ class SqlClient {
34
34
  return await this.prepare(query).execute();
35
35
  }
36
36
  catch (e) {
37
- return { rows: [], err: e };
37
+ return { rows: [], error: e };
38
38
  }
39
39
  }
40
40
  }
@@ -51,11 +51,10 @@ describe('getResponseBody', () => {
51
51
  });
52
52
  describe('ApiError', () => {
53
53
  it('should create an ApiError with correct properties', () => {
54
- const error = new response_handler_1.ApiError(404, 'NOT_FOUND', 'Resource not found', { resource: 'User' });
54
+ const error = new response_handler_1.ApiError(404, 'NOT_FOUND', 'Resource not found');
55
55
  expect(error).toBeInstanceOf(Error);
56
56
  expect(error.status).toBe(404);
57
57
  expect(error.code).toBe('NOT_FOUND');
58
58
  expect(error.message).toBe('Resource not found');
59
- expect(error.data).toEqual({ resource: 'User' });
60
59
  });
61
60
  });
@@ -2,8 +2,8 @@ import { Response, Result } from './types';
2
2
  export declare class ApiError extends Error {
3
3
  readonly status: number;
4
4
  readonly code: string;
5
- readonly data?: any;
6
- constructor(status: number, code: string, message: string, data?: any);
5
+ readonly suggestion?: string | undefined;
6
+ constructor(status: number, code: string, message: string, suggestion?: string | undefined);
7
7
  }
8
8
  export declare function getResponseBody(response: Response): Promise<Result>;
9
9
  //# sourceMappingURL=response-handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"response-handler.d.ts","sourceRoot":"","sources":["../../src/utils/response-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE3C,qBAAa,QAAS,SAAQ,KAAK;IAE/B,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAErB,QAAQ,CAAC,IAAI,CAAC;gBAHL,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACN,IAAI,CAAC,KAAK;CAItB;AAED,wBAAsB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CA0BzE"}
1
+ {"version":3,"file":"response-handler.d.ts","sourceRoot":"","sources":["../../src/utils/response-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE3C,qBAAa,QAAS,SAAQ,KAAK;IAE/B,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAErB,QAAQ,CAAC,UAAU,CAAC;gBAHX,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACN,UAAU,CAAC,oBAAQ;CAI/B;AAED,wBAAsB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CA0BzE"}
@@ -4,12 +4,12 @@ exports.getResponseBody = exports.ApiError = void 0;
4
4
  class ApiError extends Error {
5
5
  status;
6
6
  code;
7
- data;
8
- constructor(status, code, message, data) {
7
+ suggestion;
8
+ constructor(status, code, message, suggestion) {
9
9
  super(message);
10
10
  this.status = status;
11
11
  this.code = code;
12
- this.data = data;
12
+ this.suggestion = suggestion;
13
13
  }
14
14
  }
15
15
  exports.ApiError = ApiError;
@@ -18,7 +18,7 @@ async function getResponseBody(response) {
18
18
  if (!response.ok) {
19
19
  try {
20
20
  const parsedError = JSON.parse(responseText);
21
- throw new ApiError(response.status, parsedError?.error?.code, parsedError?.error?.title, parsedError?.error?.data);
21
+ throw new ApiError(response.status, parsedError?.error?.code, parsedError?.error?.message, parsedError?.error?.suggestion);
22
22
  }
23
23
  catch (e) {
24
24
  if (!(e instanceof ApiError)) {
@@ -30,7 +30,7 @@ async function getResponseBody(response) {
30
30
  }
31
31
  }
32
32
  try {
33
- return JSON.parse(responseText).response;
33
+ return JSON.parse(responseText);
34
34
  }
35
35
  catch (error) {
36
36
  throw new Error(`Unexpected error. Response was not valid JSON: ${responseText}`);
@@ -3,6 +3,6 @@ export declare type Response = Pick<APIResponse, 'text' | 'ok' | 'status'>;
3
3
  export interface Result {
4
4
  rows: any;
5
5
  metadata?: Record<string, any>;
6
- err?: Error;
6
+ error?: Error;
7
7
  }
8
8
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,oBAAY,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,CAAC;AAEnE,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,GAAG,CAAC;IACV,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,GAAG,CAAC,EAAE,KAAK,CAAC;CACb"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,oBAAY,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,CAAC;AAEnE,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,GAAG,CAAC;IACV,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,KAAK,CAAC;CACf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/sql",
3
- "version": "0.0.1-experimental-c8ed390",
3
+ "version": "0.0.1-experimental-6353b34",
4
4
  "description": "Forge SQL package",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",
@@ -21,6 +21,6 @@
21
21
  "node-fetch": "2.7.0"
22
22
  },
23
23
  "dependencies": {
24
- "@forge/api": "^3.9.1-experimental-c8ed390"
24
+ "@forge/api": "^3.9.1-experimental-6353b34"
25
25
  }
26
26
  }