Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Sync libpg-query binary #557

Merged
merged 3 commits into from
Jul 27, 2023
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
7 changes: 7 additions & 0 deletions config/binaries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,13 @@ const binaries = {
},
},
},
'libpg-query': {
category: 'libpg-query',
description: 'libpg-query is a real PostgreSQL query parser',
type: BinaryType.NodePreGyp,
repo: 'pyramation/libpg-query-node',
distUrl: 'https://supabase-public-artifacts-bucket.s3.amazonaws.com',
},
} as const;

export type BinaryName = keyof typeof binaries;
Expand Down
71 changes: 71 additions & 0 deletions test/common/adapter/binary/NodePreGypBinary.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,76 @@ describe('test/common/adapter/binary/NodePreGypBinary.test.ts', () => {
assert(matchFile2);
assert(matchFile3);
});

it('should fetch libpg-query', async () => {
app.mockHttpclient('https://registry.npmjs.com/libpg-query', 'GET', {
data: await TestUtil.readFixturesFile('registry.npmjs.com/libpg-query.json'),
});
app.mockHttpclient('https://nodejs.org/dist/index.json', 'GET', {
data: await TestUtil.readFixturesFile('nodejs.org/site/index.json'),
});
const result = await binary.fetch('/', 'libpg-query');
assert(result);
assert(result.items.length > 0);
let matchFile1 = false;
let matchFile2 = false;
let matchFile3 = false;
let matchFile4 = false;
let matchFile5 = false;
for (const item of result.items) {
assert(item.isDir === false);
assert.deepEqual(item.ignoreDownloadStatuses, [ 404 ]);
if (item.name === 'queryparser-v13.2.1-node-v108-darwin-arm64.tar.gz') {
assert(item.date === '2022-03-11T00:49:54.060Z');
assert(item.size === '-');
assert(
item.url ===
'https://supabase-public-artifacts-bucket.s3.amazonaws.com/libpg-query/queryparser-v13.2.1-node-v108-darwin-arm64.tar.gz',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wandergis 这个下载地址不对,应该是 https://supabase-public-artifacts-bucket.s3.amazonaws.com/libpg-query-node/queryparser-v13.1.2-node-v83-darwin-arm64.tar.gz

路径是 libpg-query-node ,而不是 libpg-query

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我马上验证一下

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fengmk2 #559 重新提了个pr,修改了一下NodePreGypBinary.ts的部分逻辑,看下是否正确?

);
matchFile1 = true;
}
if (item.name === 'queryparser-v13.2.1-node-v108-darwin-x64.tar.gz') {
assert(item.date === '2022-03-11T00:49:54.060Z');
assert(item.size === '-');
assert(
item.url ===
'https://supabase-public-artifacts-bucket.s3.amazonaws.com/libpg-query/queryparser-v13.2.1-node-v108-darwin-x64.tar.gz',
);
matchFile2 = true;
}
if (item.name === 'queryparser-v13.2.1-node-v108-linux-arm.tar.gz') {
assert(item.date === '2022-03-11T00:49:54.060Z');
assert(item.size === '-');
assert(
item.url ===
'https://supabase-public-artifacts-bucket.s3.amazonaws.com/libpg-query/queryparser-v13.2.1-node-v108-linux-arm.tar.gz',
);
matchFile3 = true;
}
if (item.name === 'queryparser-v13.2.1-node-v108-linux-x64.tar.gz') {
assert(item.date === '2022-03-11T00:49:54.060Z');
assert(item.size === '-');
assert(
item.url ===
'https://supabase-public-artifacts-bucket.s3.amazonaws.com/libpg-query/queryparser-v13.2.1-node-v108-linux-x64.tar.gz',
);
matchFile4 = true;
}
if (item.name === 'queryparser-v13.2.1-node-v108-win32-x64.tar.gz') {
assert(item.date === '2022-03-11T00:49:54.060Z');
assert(item.size === '-');
assert(
item.url ===
'https://supabase-public-artifacts-bucket.s3.amazonaws.com/libpg-query/queryparser-v13.2.1-node-v108-win32-x64.tar.gz',
);
matchFile5 = true;
}
}
assert(matchFile1);
assert(matchFile2);
assert(matchFile3);
assert(matchFile4);
assert(matchFile5);
});
});
});
Loading
Loading