Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions packages/cubejs-api-gateway/src/sql-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,34 +194,6 @@ export class SQLServer {
}
});
},
load: async ({ request, session, query }) => {
const context = await contextByRequest(request, session);

// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve, reject) => {
try {
await this.apiGateway.load({
query,
queryType: 'multi',
context,
res: (response) => {
if ('error' in response) {
reject({
message: response.error
});

return;
}

resolve(response);
},
apiType: 'sql',
});
} catch (e) {
reject(e);
}
});
},
sqlApiLoad: async ({ request, session, query, queryKey, sqlQuery, streaming, cacheMode }) => {
const context = await contextByRequest(request, session);

Expand Down
6 changes: 0 additions & 6 deletions packages/cubejs-backend-native/js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export type SQLInterfaceOptions = {
contextToApiScopes: (payload: ContextToApiScopesPayload) => ContextToApiScopesResponse | Promise<ContextToApiScopesResponse>,
checkAuth: (payload: CheckAuthPayload) => CheckAuthResponse | Promise<CheckAuthResponse>,
checkSqlAuth: (payload: CheckSQLAuthPayload) => CheckSQLAuthResponse | Promise<CheckSQLAuthResponse>,
load: (payload: LoadPayload) => unknown | Promise<unknown>,
sql: (payload: SqlPayload) => unknown | Promise<unknown>,
meta: (payload: MetaPayload) => unknown | Promise<unknown>,
stream: (payload: LoadPayload) => unknown | Promise<unknown>,
Expand Down Expand Up @@ -396,10 +395,6 @@ export const registerInterface = async (options: SQLInterfaceOptions): Promise<S
throw new Error('options.checkSqlAuth must be a function');
}

if (typeof options.load !== 'function') {
throw new Error('options.load must be a function');
}

if (typeof options.meta !== 'function') {
throw new Error('options.meta must be a function');
}
Expand All @@ -426,7 +421,6 @@ export const registerInterface = async (options: SQLInterfaceOptions): Promise<S
contextToApiScopes: wrapNativeFunctionWithChannelCallback(options.contextToApiScopes),
checkAuth: wrapNativeFunctionWithChannelCallback(options.checkAuth),
checkSqlAuth: wrapNativeFunctionWithChannelCallback(options.checkSqlAuth),
load: wrapNativeFunctionWithChannelCallback(options.load),
sql: wrapNativeFunctionWithChannelCallback(options.sql),
meta: wrapNativeFunctionWithChannelCallback(options.meta),
stream: wrapNativeFunctionWithStream(options.stream),
Expand Down
11 changes: 0 additions & 11 deletions packages/cubejs-backend-native/test/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ const native = require('../js/index');
const meta_fixture = require('./meta');

(async () => {
const load = async ({ request, session, query }) => {
console.log('[js] load', {
request,
session,
query,
});

throw new Error('load is not implemented');
};

const sqlApiLoad = async ({ request, session, query, streaming }) => {
console.log('[js] sqlApiLoad', {
request,
Expand Down Expand Up @@ -122,7 +112,6 @@ const meta_fixture = require('./meta');
const server = await native.registerInterface({
// nonce: '12345678910111213141516'.substring(0, 20),
checkAuth,
load,
sql,
meta,
stream,
Expand Down
21 changes: 1 addition & 20 deletions packages/cubejs-backend-native/test/sql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,8 @@ const _logger = jest.fn(({ event }) => {

function interfaceMethods() {
return {
load: jest.fn(async ({ request, session, query }) => {
console.log('[js] load', {
request,
session,
query,
});

expect(session).toEqual({
user: expect.toBeTypeOrNull(String),
superuser: expect.any(Boolean),
securityContext: { foo: 'bar' },
});

// It's just an emulation that ApiGateway returns error
return {
error: 'This error should be passed back to PostgreSQL client',
};
}),
sqlApiLoad: jest.fn(async ({ request, session, query, streaming }) => {
console.log('[js] load', {
console.log('[js] sqlApiLoad', {
request,
session,
query,
Expand Down Expand Up @@ -282,7 +264,6 @@ describe('SQLInterface', () => {
});

try {
// limit is used to router query to load method instead of stream
await connection.query(
'select * from KibanaSampleDataEcommerce LIMIT 1000'
);
Expand Down
Loading