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: qs -> neoqs #3615

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ npm-debug.log
dist
coverage
reports
test-results
.rpt2_cache
.idea
.DS_Store
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"release:next": "auto next",
"release:canary": "auto canary",
"release": "auto shipit",
"postinstall": "husky init",
"prepare": "husky"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
},
"dependencies": {
"@gitbeaker/requester-utils": "^40.1.4",
"qs": "^6.12.2",
"neoqs": "^6.12.4",
"xcase": "^2.0.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/infrastructure/RequestHelper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parse as parseQueryString } from 'qs';
import { parse as parseQueryString } from 'neoqs/legacy';
import { camelizeKeys } from 'xcase';
import { BaseResource } from '@gitbeaker/requester-utils';
import type {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/infrastructure/Utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { decamelizeKeys } from 'xcase';
import QS from 'qs';
import * as QS from 'neoqs/legacy';

export interface UserAgentDetailSchema extends Record<string, unknown> {
user_agent: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/requester-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
"lint:fix": "yarn lint --fix"
},
"dependencies": {
"neoqs": "^6.12.4",
"picomatch-browser": "^2.2.6",
"qs": "^6.12.2",
"rate-limiter-flexible": "^4.0.1",
"xcase": "^2.0.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/requester-utils/src/RequesterUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { stringify } from 'qs';
import { stringify } from 'neoqs/legacy';
import { decamelizeKeys } from 'xcase';
import { RateLimiterMemory, RateLimiterQueue } from 'rate-limiter-flexible';
import Picomatch from 'picomatch-browser';
Expand Down
1 change: 0 additions & 1 deletion packages/rest/playwright.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const launchOptions = {
};

export default defineConfig({
testMatch: /.*.ts/,
testMatch: /.*.ts/,
reporter: [['line'], ['junit', { outputFile: './reports/browser_junit.xml' }]],
projects: [
Expand Down
15 changes: 9 additions & 6 deletions packages/rest/test/assets/test-import.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=1, initial-scale=1.0" />
<title>Document</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Example Import</title>
</head>
<body>
<!-- Import Map for Module Resolution -->
<script type="importmap">
{
"imports": {
"qs": "https://esm.sh/qs?min",
"neoqs/legacy": "https://esm.sh/neoqs/legacy?min",
"xcase": "https://esm.sh/xcase?min",
"rate-limiter-flexible": "https://esm.sh/rate-limiter-flexible?min",
"picomatch-browser": "https://esm.sh/picomatch-browser?min",
Expand All @@ -18,11 +19,13 @@
}
}
</script>

<!-- Importing Gitbeaker Module -->
<script type="module">
import * as gitbeaker from '../../dist/index.mjs';

// BAD PRACTISE!!! - Just for testing purposes
// Assign to global for testing
window.gitbeaker = gitbeaker;
</script>
</body>
</html>
</html>
13 changes: 11 additions & 2 deletions packages/rest/test/integration/browser/General.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,17 @@ describe('Browser Import', () => {
await page.goto(`file://${filepath}`);

// Run import JS
const importObject: Record<string, unknown> = await page.evaluate('window.gitbeaker');
const importObjectKeys: Record<string, unknown> = await page.evaluate(() => {
return Object.keys(window['gitbeaker'])
});

expect(Object.keys(importObject)).toMatchObject(keys);
const importObjectValuesPresent: Record<string, unknown> = await page.evaluate(() => {
return Object.values(window['gitbeaker']).filter(v => v)
});


expect(importObjectKeys).toMatchObject(keys);

expect(importObjectValuesPresent).toHaveLength(keys.length);
});
});
Loading