Skip to content

Commit

Permalink
feat: Sync libpg-query binary (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
wandergis authored Jul 27, 2023
1 parent e4d44c6 commit 8556b5f
Show file tree
Hide file tree
Showing 3 changed files with 1,255 additions and 0 deletions.
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',
);
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

0 comments on commit 8556b5f

Please sign in to comment.