0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

refactor(core): remove query-string (#2667)

This commit is contained in:
Gao Sun 2022-12-15 10:54:03 +08:00 committed by GitHub
parent 93cd6a27d0
commit 5b647cf7cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 36 deletions

View file

@ -61,7 +61,6 @@
"nanoid": "^4.0.0", "nanoid": "^4.0.0",
"oidc-provider": "^7.13.0", "oidc-provider": "^7.13.0",
"p-retry": "^5.1.2", "p-retry": "^5.1.2",
"query-string": "^7.0.1",
"roarr": "^7.11.0", "roarr": "^7.11.0",
"slonik": "^30.0.0", "slonik": "^30.0.0",
"slonik-interceptor-preset": "^1.2.10", "slonik-interceptor-preset": "^1.2.10",
@ -109,7 +108,10 @@
"eslintConfig": { "eslintConfig": {
"extends": "@silverhand", "extends": "@silverhand",
"rules": { "rules": {
"complexity": ["error", 11], "complexity": [
"error",
11
],
"default-case": "off" "default-case": "off"
} }
}, },

View file

@ -1,5 +1,4 @@
import type { Request } from 'koa'; import type { Request } from 'koa';
import { stringify } from 'query-string';
type LinkRelationType = 'first' | 'prev' | 'next' | 'last'; type LinkRelationType = 'first' | 'prev' | 'next' | 'last';
@ -10,5 +9,8 @@ export const buildLink = (
): string => { ): string => {
const baseUrl = `${request.origin}${request.path}`; const baseUrl = `${request.origin}${request.path}`;
return `<${baseUrl}?${stringify({ ...request.query, page })}>; rel="${type}"`; return `<${baseUrl}?${new URLSearchParams({
...request.query,
page: String(page),
}).toString()}>; rel="${type}"`;
}; };

View file

@ -314,7 +314,6 @@ importers:
openapi-types: ^12.0.0 openapi-types: ^12.0.0
p-retry: ^5.1.2 p-retry: ^5.1.2
prettier: ^2.7.1 prettier: ^2.7.1
query-string: ^7.0.1
roarr: ^7.11.0 roarr: ^7.11.0
sinon: ^15.0.0 sinon: ^15.0.0
slonik: ^30.0.0 slonik: ^30.0.0
@ -362,7 +361,6 @@ importers:
nanoid: 4.0.0 nanoid: 4.0.0
oidc-provider: 7.13.0 oidc-provider: 7.13.0
p-retry: 5.1.2 p-retry: 5.1.2
query-string: 7.0.1
roarr: 7.11.0 roarr: 7.11.0
slonik: 30.1.2 slonik: 30.1.2
slonik-interceptor-preset: 1.2.10 slonik-interceptor-preset: 1.2.10
@ -5969,11 +5967,6 @@ packages:
character-entities: 2.0.1 character-entities: 2.0.1
dev: true dev: true
/decode-uri-component/0.2.0:
resolution: {integrity: sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=}
engines: {node: '>=0.10'}
dev: false
/decompress-response/6.0.0: /decompress-response/6.0.0:
resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==} resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==}
engines: {node: '>=10'} engines: {node: '>=10'}
@ -7105,11 +7098,6 @@ packages:
to-regex-range: 5.0.1 to-regex-range: 5.0.1
dev: true dev: true
/filter-obj/1.1.0:
resolution: {integrity: sha1-mzERErxsYSehbgFsbF1/GeCAXFs=}
engines: {node: '>=0.10.0'}
dev: false
/find-file-up/0.1.3: /find-file-up/0.1.3:
resolution: {integrity: sha512-mBxmNbVyjg1LQIIpgO8hN+ybWBgDQK8qjht+EbrTCGmmPV/sc7RF1i9stPTD6bpvXZywBdrwRYxhSdJv867L6A==} resolution: {integrity: sha512-mBxmNbVyjg1LQIIpgO8hN+ybWBgDQK8qjht+EbrTCGmmPV/sc7RF1i9stPTD6bpvXZywBdrwRYxhSdJv867L6A==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
@ -12370,16 +12358,6 @@ packages:
resolution: {integrity: sha512-EbZYNarm6138UKKq46tdx08Yo/q9ZhFoAXAI1meAFd2GtbRDhbZY2WQSICskT0c5q99aFzLG1D4nvTk9tqfXIw==} resolution: {integrity: sha512-EbZYNarm6138UKKq46tdx08Yo/q9ZhFoAXAI1meAFd2GtbRDhbZY2WQSICskT0c5q99aFzLG1D4nvTk9tqfXIw==}
engines: {node: '>=0.6'} engines: {node: '>=0.6'}
/query-string/7.0.1:
resolution: {integrity: sha512-uIw3iRvHnk9to1blJCG3BTc+Ro56CBowJXKmNNAm3RulvPBzWLRqKSiiDk+IplJhsydwtuNMHi8UGQFcCLVfkA==}
engines: {node: '>=6'}
dependencies:
decode-uri-component: 0.2.0
filter-obj: 1.1.0
split-on-first: 1.1.0
strict-uri-encode: 2.0.0
dev: false
/querystringify/2.2.0: /querystringify/2.2.0:
resolution: {integrity: sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==} resolution: {integrity: sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==}
dev: true dev: true
@ -13583,11 +13561,6 @@ packages:
resolution: {integrity: sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==} resolution: {integrity: sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==}
dev: true dev: true
/split-on-first/1.1.0:
resolution: {integrity: sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==}
engines: {node: '>=6'}
dev: false
/split2/3.2.2: /split2/3.2.2:
resolution: {integrity: sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==} resolution: {integrity: sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==}
dependencies: dependencies:
@ -13637,11 +13610,6 @@ packages:
mixme: 0.5.4 mixme: 0.5.4
dev: true dev: true
/strict-uri-encode/2.0.0:
resolution: {integrity: sha1-ucczDHBChi9rFC3CdLvMWGbONUY=}
engines: {node: '>=4'}
dev: false
/string-argv/0.3.1: /string-argv/0.3.1:
resolution: {integrity: sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==} resolution: {integrity: sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==}
engines: {node: '>=0.6.19'} engines: {node: '>=0.6.19'}