@forge/sql 2.1.0 → 2.2.0-next.1
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/__test__/sql.test.js +27 -57
- package/out/index.d.ts +2 -0
- package/out/index.d.ts.map +1 -1
- package/out/migration.d.ts.map +1 -1
- package/out/sql-statement.d.ts +8 -7
- package/out/sql-statement.d.ts.map +1 -1
- package/out/sql-statement.js +6 -3
- package/out/sql.d.ts +3 -3
- package/out/sql.d.ts.map +1 -1
- package/out/utils/response-handler.d.ts +1 -1
- package/out/utils/response-handler.d.ts.map +1 -1
- package/out/utils/types.d.ts +10 -2
- package/out/utils/types.d.ts.map +1 -1
- package/package.json +1 -1
package/out/__test__/sql.test.js
CHANGED
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const node_fetch_1 = require("node-fetch");
|
|
3
4
|
const api_1 = require("@forge/api");
|
|
4
5
|
const sql_1 = require("../sql");
|
|
5
6
|
const sql_statement_1 = require("../sql-statement");
|
|
7
|
+
const response_handler_1 = require("../utils/response-handler");
|
|
6
8
|
jest.mock('@forge/api');
|
|
7
|
-
jest.mock('../sql-statement');
|
|
8
|
-
jest.mock('../utils/response-handler', () => ({
|
|
9
|
-
ApiError: jest.fn(),
|
|
10
|
-
getResponseBody: jest.fn()
|
|
11
|
-
}));
|
|
12
9
|
describe('SqlClient', () => {
|
|
13
10
|
let sqlClient;
|
|
14
11
|
let mockFetch;
|
|
15
|
-
let mockSqlStatement;
|
|
16
|
-
let mockGetResponseBody;
|
|
17
12
|
beforeEach(() => {
|
|
18
13
|
sqlClient = new sql_1.SqlClient();
|
|
19
14
|
mockFetch = jest.fn();
|
|
20
15
|
api_1.__fetchProduct.mockReturnValue(mockFetch);
|
|
21
|
-
mockSqlStatement = {
|
|
22
|
-
bindParams: jest.fn().mockReturnThis(),
|
|
23
|
-
execute: jest.fn()
|
|
24
|
-
};
|
|
25
|
-
sql_statement_1.SqlStatement.mockImplementation(() => mockSqlStatement);
|
|
26
|
-
mockGetResponseBody = jest.fn();
|
|
27
|
-
jest.requireMock('../utils/response-handler').getResponseBody = mockGetResponseBody;
|
|
28
16
|
jest.clearAllMocks();
|
|
29
17
|
});
|
|
18
|
+
function mockFetchExecute(rows) {
|
|
19
|
+
const body = { rows };
|
|
20
|
+
const response = new node_fetch_1.Response(JSON.stringify(body), { status: 200 });
|
|
21
|
+
mockFetch.mockResolvedValue(response);
|
|
22
|
+
return body;
|
|
23
|
+
}
|
|
30
24
|
describe('sendRequest', () => {
|
|
31
25
|
it('should send a request with the correct options and return the response', async () => {
|
|
32
26
|
const mockResponse = { ok: true, status: 200 };
|
|
@@ -67,9 +61,7 @@ describe('SqlClient', () => {
|
|
|
67
61
|
});
|
|
68
62
|
describe('storageApi', () => {
|
|
69
63
|
it('should send a request and return the response body', async () => {
|
|
70
|
-
|
|
71
|
-
mockFetch.mockResolvedValue(mockResponse);
|
|
72
|
-
mockGetResponseBody.mockResolvedValue({ rows: [] });
|
|
64
|
+
mockFetchExecute([]);
|
|
73
65
|
const result = await sqlClient.storageApi('SELECT * FROM test');
|
|
74
66
|
expect(mockFetch).toHaveBeenCalledWith('api/v1/execute', {
|
|
75
67
|
method: 'POST',
|
|
@@ -77,13 +69,10 @@ describe('SqlClient', () => {
|
|
|
77
69
|
redirect: 'follow',
|
|
78
70
|
headers: { 'Content-Type': 'application/json' }
|
|
79
71
|
});
|
|
80
|
-
expect(mockGetResponseBody).toHaveBeenCalledWith(mockResponse);
|
|
81
72
|
expect(result).toEqual({ rows: [] });
|
|
82
73
|
});
|
|
83
74
|
it('should send a request with parameters and method', async () => {
|
|
84
|
-
|
|
85
|
-
mockFetch.mockResolvedValue(mockResponse);
|
|
86
|
-
mockGetResponseBody.mockResolvedValue({ rows: [] });
|
|
75
|
+
mockFetchExecute([]);
|
|
87
76
|
const params = [1];
|
|
88
77
|
const result = await sqlClient.storageApi('SELECT * FROM test WHERE id = ?', params, 'one');
|
|
89
78
|
expect(mockFetch).toHaveBeenCalledWith('api/v1/execute', {
|
|
@@ -92,58 +81,39 @@ describe('SqlClient', () => {
|
|
|
92
81
|
redirect: 'follow',
|
|
93
82
|
headers: { 'Content-Type': 'application/json' }
|
|
94
83
|
});
|
|
95
|
-
expect(mockGetResponseBody).toHaveBeenCalledWith(mockResponse);
|
|
96
84
|
expect(result).toEqual({ rows: [] });
|
|
97
85
|
});
|
|
98
86
|
it('should handle errors from getResponseBody', async () => {
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
await expect(sqlClient.storageApi('INVALID SQL QUERY')).rejects.toThrow(mockError);
|
|
104
|
-
expect(mockFetch).toHaveBeenCalledWith('api/v1/execute', expect.any(Object));
|
|
105
|
-
expect(mockGetResponseBody).toHaveBeenCalledWith(mockResponse);
|
|
87
|
+
const responseText = 'Invalid JSON';
|
|
88
|
+
const response = new node_fetch_1.Response(responseText, { status: 200 });
|
|
89
|
+
mockFetch.mockResolvedValue(response);
|
|
90
|
+
await expect(sqlClient.storageApi('INVALID SQL QUERY')).rejects.toThrow(`Unexpected error. Response was not valid JSON: ${responseText}`);
|
|
106
91
|
});
|
|
107
92
|
});
|
|
108
93
|
describe('prepare', () => {
|
|
109
|
-
it('should return a SqlStatement instance', () => {
|
|
110
|
-
const statement = sqlClient.prepare('
|
|
111
|
-
expect(statement).
|
|
112
|
-
expect(
|
|
113
|
-
});
|
|
114
|
-
it('should pass the correct query to SqlStatement', () => {
|
|
115
|
-
sqlClient.prepare('INSERT INTO test VALUES (?, ?)');
|
|
116
|
-
expect(sql_statement_1.SqlStatement).toHaveBeenCalledWith('INSERT INTO test VALUES (?, ?)', expect.any(Function));
|
|
117
|
-
});
|
|
118
|
-
it('should pass the storageApi method to SqlStatement', () => {
|
|
119
|
-
sqlClient.prepare('SELECT * FROM test');
|
|
120
|
-
const passedFunction = sql_statement_1.SqlStatement.mock.calls[0][1];
|
|
121
|
-
expect(typeof passedFunction).toBe('function');
|
|
94
|
+
it('should return a SqlStatement instance with query', () => {
|
|
95
|
+
const statement = sqlClient.prepare('INSERT INTO test VALUES (?, ?)');
|
|
96
|
+
expect(statement).toBeInstanceOf(sql_statement_1.SqlStatement);
|
|
97
|
+
expect(statement.query).toBe('INSERT INTO test VALUES (?, ?)');
|
|
122
98
|
});
|
|
123
99
|
});
|
|
124
100
|
describe('execute', () => {
|
|
125
101
|
it('should execute a query and return the result', async () => {
|
|
126
|
-
const
|
|
127
|
-
mockSqlStatement.execute.mockResolvedValue(mockResult);
|
|
102
|
+
const expectedResult = mockFetchExecute([{ id: 1, name: 'Test' }]);
|
|
128
103
|
const result = await sqlClient.executeRaw('SELECT * FROM test');
|
|
129
|
-
expect(result).toEqual(
|
|
130
|
-
expect(sql_statement_1.SqlStatement).toHaveBeenCalledWith('SELECT * FROM test', expect.any(Function));
|
|
131
|
-
expect(mockSqlStatement.execute).toHaveBeenCalled();
|
|
104
|
+
expect(result).toEqual(expectedResult);
|
|
132
105
|
});
|
|
133
106
|
it('should execute a query with parameters', async () => {
|
|
134
|
-
const mockResult =
|
|
135
|
-
|
|
136
|
-
|
|
107
|
+
const mockResult = mockFetchExecute([{ id: 1, name: 'Test' }]);
|
|
108
|
+
const result = await sqlClient
|
|
109
|
+
.prepare('SELECT * FROM test WHERE id = ?')
|
|
110
|
+
.bindParams(1)
|
|
111
|
+
.execute();
|
|
137
112
|
expect(result).toEqual(mockResult);
|
|
138
|
-
expect(mockSqlStatement.bindParams).toHaveBeenCalledWith(1);
|
|
139
|
-
expect(mockSqlStatement.execute).toHaveBeenCalled();
|
|
140
113
|
});
|
|
141
114
|
it('should handle API errors', async () => {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
await expect(sqlClient.executeRaw('INVALID SQL QUERY')).rejects.toThrow(mockApiError1);
|
|
145
|
-
expect(sql_statement_1.SqlStatement).toHaveBeenCalledWith('INVALID SQL QUERY', expect.any(Function));
|
|
146
|
-
expect(mockSqlStatement.execute).toHaveBeenCalled();
|
|
115
|
+
mockFetch.mockResolvedValue(new node_fetch_1.Response(JSON.stringify({ code: 'INVALID_QUERY', message: 'Invalid SQL query' }), { status: 400 }));
|
|
116
|
+
await expect(sqlClient.executeRaw('INVALID SQL QUERY')).rejects.toThrow(new response_handler_1.ApiError(400, 'INVALID_QUERY', 'Invalid SQL query'));
|
|
147
117
|
});
|
|
148
118
|
});
|
|
149
119
|
});
|
package/out/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { sql } from './sql';
|
|
2
2
|
import { errorCodes } from './errorCodes';
|
|
3
3
|
import { migrationRunner } from './migration';
|
|
4
|
+
import type { Result, UpdateQueryResponse } from './utils/types';
|
|
5
|
+
export type { Result, UpdateQueryResponse };
|
|
4
6
|
export { errorCodes, migrationRunner, sql };
|
|
5
7
|
export default sql;
|
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC;AAC5C,eAAe,GAAG,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEjE,YAAY,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC;AAC5C,eAAe,GAAG,CAAC"}
|
package/out/migration.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../src/migration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,aAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,aAAK,gBAAgB,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,IAAI,CAAC;CAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../src/migration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,aAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,aAAK,gBAAgB,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,IAAI,CAAC;CAClB,CAAC;AAcF,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IACtC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoB;gBAEnC,SAAS,EAAE,SAAS;IAK1B,UAAU;IAIT,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,eAAe;IAQzD,WAAW,IAAI,eAAe,EAAE;IAIjC,IAAI,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAYnC,GAAG,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAiC/B;AAED,eAAO,MAAM,eAAe,iBAA2B,CAAC"}
|
package/out/sql-statement.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Result } from './utils/types';
|
|
2
1
|
export declare type SqlParameters = any[];
|
|
3
|
-
export declare
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
export declare type RemoteApiCall<ApiResponse> = (query: string, params?: SqlParameters, method?: string) => Promise<ApiResponse>;
|
|
3
|
+
export declare class SqlStatement<APIResponse> {
|
|
4
|
+
readonly query: string;
|
|
5
|
+
private _params;
|
|
6
6
|
private readonly remoteSqlApi;
|
|
7
|
-
constructor(query: string, remoteSqlApi:
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
constructor(query: string, remoteSqlApi: RemoteApiCall<APIResponse>);
|
|
8
|
+
get params(): SqlParameters;
|
|
9
|
+
bindParams(...args: SqlParameters): this;
|
|
10
|
+
execute(): Promise<APIResponse>;
|
|
10
11
|
}
|
|
11
12
|
//# sourceMappingURL=sql-statement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql-statement.d.ts","sourceRoot":"","sources":["../src/sql-statement.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"sql-statement.d.ts","sourceRoot":"","sources":["../src/sql-statement.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa,GAAG,GAAG,EAAE,CAAC;AAElC,oBAAY,aAAa,CAAC,WAAW,IAAI,CACvC,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,aAAa,EACtB,MAAM,CAAC,EAAE,MAAM,KACZ,OAAO,CAAC,WAAW,CAAC,CAAC;AAE1B,qBAAa,YAAY,CAAC,WAAW;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6B;gBAE9C,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,CAAC,WAAW,CAAC;IAMnE,IAAI,MAAM,IAAI,aAAa,CAE1B;IACD,UAAU,CAAC,GAAG,IAAI,EAAE,aAAa,GAAG,IAAI;IAKlC,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC;CAGtC"}
|
package/out/sql-statement.js
CHANGED
|
@@ -3,15 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SqlStatement = void 0;
|
|
4
4
|
class SqlStatement {
|
|
5
5
|
query;
|
|
6
|
-
|
|
6
|
+
_params;
|
|
7
7
|
remoteSqlApi;
|
|
8
8
|
constructor(query, remoteSqlApi) {
|
|
9
9
|
this.query = query;
|
|
10
|
-
this.
|
|
10
|
+
this._params = [];
|
|
11
11
|
this.remoteSqlApi = remoteSqlApi;
|
|
12
12
|
}
|
|
13
|
+
get params() {
|
|
14
|
+
return this._params;
|
|
15
|
+
}
|
|
13
16
|
bindParams(...args) {
|
|
14
|
-
this.
|
|
17
|
+
this._params = args;
|
|
15
18
|
return this;
|
|
16
19
|
}
|
|
17
20
|
async execute() {
|
package/out/sql.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { Result } from './utils/types';
|
|
|
2
2
|
import { SqlParameters, SqlStatement } from './sql-statement';
|
|
3
3
|
export declare class SqlClient {
|
|
4
4
|
private sendRequest;
|
|
5
|
-
storageApi(query: string, params?: SqlParameters, method?: string): Promise<Result
|
|
6
|
-
prepare(query: string): SqlStatement
|
|
7
|
-
executeRaw(query: string): Promise<Result
|
|
5
|
+
storageApi<DataType>(query: string, params?: SqlParameters, method?: string): Promise<Result<DataType>>;
|
|
6
|
+
prepare<DataType>(query: string): SqlStatement<Result<DataType>>;
|
|
7
|
+
executeRaw<DataType>(query: string): Promise<Result<DataType>>;
|
|
8
8
|
_provision(): Promise<void>;
|
|
9
9
|
}
|
|
10
10
|
export declare const sql: SqlClient;
|
package/out/sql.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql.d.ts","sourceRoot":"","sources":["../src/sql.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAY,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE9D,qBAAa,SAAS;YACN,WAAW;IAYnB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,aAAkB,EAAE,MAAM,SAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"sql.d.ts","sourceRoot":"","sources":["../src/sql.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAY,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE9D,qBAAa,SAAS;YACN,WAAW;IAYnB,UAAU,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,aAAkB,EAAE,MAAM,SAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAQhH,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAI1D,UAAU,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAI9D,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAMlC;AAED,eAAO,MAAM,GAAG,WAAkB,CAAC"}
|
|
@@ -16,5 +16,5 @@ export declare class MigrationCheckPointError extends Error {
|
|
|
16
16
|
readonly migrationsYetToRun: string[];
|
|
17
17
|
constructor(migrationName: string, migrationsYetToRun: string[]);
|
|
18
18
|
}
|
|
19
|
-
export declare function getResponseBody(response: Response): Promise<Result
|
|
19
|
+
export declare function getResponseBody<DataType>(response: Response): Promise<Result<DataType>>;
|
|
20
20
|
//# 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,UAAU,CAAC;IACpB,QAAQ,CAAC,KAAK,CAAC;gBAJN,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACN,UAAU,CAAC,oBAAQ,EACnB,KAAK,CAAC,KAAK;CAIvB;AAED,qBAAa,uBAAwB,SAAQ,KAAK;IAE9C,QAAQ,CAAC,aAAa,EAAE,MAAM;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,EAAE;gBAD5B,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,MAAM,EAAE;CAIxC;AAED,qBAAa,wBAAyB,SAAQ,KAAK;IAE/C,QAAQ,CAAC,aAAa,EAAE,MAAM;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,EAAE;gBAD5B,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,MAAM,EAAE;CAIxC;AAED,wBAAsB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
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;IACpB,QAAQ,CAAC,KAAK,CAAC;gBAJN,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACN,UAAU,CAAC,oBAAQ,EACnB,KAAK,CAAC,KAAK;CAIvB;AAED,qBAAa,uBAAwB,SAAQ,KAAK;IAE9C,QAAQ,CAAC,aAAa,EAAE,MAAM;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,EAAE;gBAD5B,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,MAAM,EAAE;CAIxC;AAED,qBAAa,wBAAyB,SAAQ,KAAK;IAE/C,QAAQ,CAAC,aAAa,EAAE,MAAM;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,EAAE;gBAD5B,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,MAAM,EAAE;CAIxC;AAED,wBAAsB,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CA2B7F"}
|
package/out/utils/types.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { APIResponse } from '@forge/api';
|
|
2
2
|
export declare type Response = Pick<APIResponse, 'text' | 'ok' | 'status'>;
|
|
3
|
-
export interface
|
|
4
|
-
|
|
3
|
+
export interface UpdateQueryResponse {
|
|
4
|
+
affectedRows: number;
|
|
5
|
+
fieldCount: number;
|
|
6
|
+
info: string;
|
|
7
|
+
insertId: number;
|
|
8
|
+
serverStatus: number;
|
|
9
|
+
warningStatus: number;
|
|
10
|
+
}
|
|
11
|
+
export interface Result<DataType = any> {
|
|
12
|
+
rows: DataType extends UpdateQueryResponse ? UpdateQueryResponse : DataType[];
|
|
5
13
|
metadata?: Record<string, any>;
|
|
6
14
|
}
|
|
7
15
|
//# sourceMappingURL=types.d.ts.map
|
package/out/utils/types.d.ts.map
CHANGED
|
@@ -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;
|
|
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;AAGnE,MAAM,WAAW,mBAAmB;IAElC,YAAY,EAAE,MAAM,CAAC;IAErB,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;IAEb,QAAQ,EAAE,MAAM,CAAC;IAEjB,YAAY,EAAE,MAAM,CAAC;IAErB,aAAa,EAAE,MAAM,CAAC;CACvB;AAWD,MAAM,WAAW,MAAM,CAAC,QAAQ,GAAG,GAAG;IAKpC,IAAI,EAAE,QAAQ,SAAS,mBAAmB,GAAG,mBAAmB,GAAG,QAAQ,EAAE,CAAC;IAM9E,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC"}
|