@bifravst/http-api-mock 3.0.7 → 3.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +3 -3
  2. package/{npm → dist}/cdk/http-api-mock.js +1 -1
  3. package/dist/package.json +103 -0
  4. package/package.json +5 -7
  5. package/cdk/App.ts +0 -26
  6. package/cdk/Stack.ts +0 -66
  7. package/cdk/http-api-mock.ts +0 -109
  8. package/cdk/resources/HttpApiMock.ts +0 -117
  9. package/cdk/resources/checkMatchingQueryParams.spec.ts +0 -67
  10. package/cdk/resources/checkMatchingQueryParams.ts +0 -40
  11. package/cdk/resources/http-api-mock-lambda.ts +0 -147
  12. package/cdk/resources/splitMockResponse.spec.ts +0 -17
  13. package/cdk/resources/splitMockResponse.ts +0 -25
  14. package/npm/cdk/App.ts +0 -26
  15. package/npm/cdk/Stack.ts +0 -66
  16. package/npm/cdk/http-api-mock.ts +0 -109
  17. package/npm/cdk/resources/HttpApiMock.ts +0 -117
  18. package/npm/cdk/resources/checkMatchingQueryParams.spec.ts +0 -67
  19. package/npm/cdk/resources/checkMatchingQueryParams.ts +0 -40
  20. package/npm/cdk/resources/http-api-mock-lambda.ts +0 -147
  21. package/npm/cdk/resources/splitMockResponse.spec.ts +0 -17
  22. package/npm/cdk/resources/splitMockResponse.ts +0 -25
  23. package/npm/package.json +0 -105
  24. package/src/mock.spec.ts +0 -52
  25. package/src/mock.ts +0 -61
  26. package/src/parseMockRequest.spec.ts +0 -30
  27. package/src/parseMockRequest.ts +0 -35
  28. package/src/parseMockResponse.spec.ts +0 -27
  29. package/src/parseMockResponse.ts +0 -35
  30. package/src/randomString.ts +0 -7
  31. package/src/requests.ts +0 -28
  32. package/src/responses.ts +0 -50
  33. package/src/sortQueryString.spec.ts +0 -38
  34. package/src/sortQueryString.ts +0 -26
  35. /package/{npm → dist}/cdk/App.d.ts +0 -0
  36. /package/{npm → dist}/cdk/App.js +0 -0
  37. /package/{npm → dist}/cdk/Stack.d.ts +0 -0
  38. /package/{npm → dist}/cdk/Stack.js +0 -0
  39. /package/{npm → dist}/cdk/http-api-mock.d.ts +0 -0
  40. /package/{npm → dist}/cdk/resources/HttpApiMock.d.ts +0 -0
  41. /package/{npm → dist}/cdk/resources/HttpApiMock.js +0 -0
  42. /package/{npm → dist}/cdk/resources/checkMatchingQueryParams.d.ts +0 -0
  43. /package/{npm → dist}/cdk/resources/checkMatchingQueryParams.js +0 -0
  44. /package/{npm → dist}/cdk/resources/checkMatchingQueryParams.spec.d.ts +0 -0
  45. /package/{npm → dist}/cdk/resources/checkMatchingQueryParams.spec.js +0 -0
  46. /package/{npm → dist}/cdk/resources/http-api-mock-lambda.d.ts +0 -0
  47. /package/{npm → dist}/cdk/resources/http-api-mock-lambda.js +0 -0
  48. /package/{npm → dist}/cdk/resources/splitMockResponse.d.ts +0 -0
  49. /package/{npm → dist}/cdk/resources/splitMockResponse.js +0 -0
  50. /package/{npm → dist}/cdk/resources/splitMockResponse.spec.d.ts +0 -0
  51. /package/{npm → dist}/cdk/resources/splitMockResponse.spec.js +0 -0
  52. /package/{npm → dist}/e2e.spec.d.ts +0 -0
  53. /package/{npm → dist}/e2e.spec.js +0 -0
  54. /package/{npm → dist}/src/mock.d.ts +0 -0
  55. /package/{npm → dist}/src/mock.js +0 -0
  56. /package/{npm → dist}/src/mock.spec.d.ts +0 -0
  57. /package/{npm → dist}/src/mock.spec.js +0 -0
  58. /package/{npm → dist}/src/parseMockRequest.d.ts +0 -0
  59. /package/{npm → dist}/src/parseMockRequest.js +0 -0
  60. /package/{npm → dist}/src/parseMockRequest.spec.d.ts +0 -0
  61. /package/{npm → dist}/src/parseMockRequest.spec.js +0 -0
  62. /package/{npm → dist}/src/parseMockResponse.d.ts +0 -0
  63. /package/{npm → dist}/src/parseMockResponse.js +0 -0
  64. /package/{npm → dist}/src/parseMockResponse.spec.d.ts +0 -0
  65. /package/{npm → dist}/src/parseMockResponse.spec.js +0 -0
  66. /package/{npm → dist}/src/randomString.d.ts +0 -0
  67. /package/{npm → dist}/src/randomString.js +0 -0
  68. /package/{npm → dist}/src/requests.d.ts +0 -0
  69. /package/{npm → dist}/src/requests.js +0 -0
  70. /package/{npm → dist}/src/responses.d.ts +0 -0
  71. /package/{npm → dist}/src/responses.js +0 -0
  72. /package/{npm → dist}/src/sortQueryString.d.ts +0 -0
  73. /package/{npm → dist}/src/sortQueryString.js +0 -0
  74. /package/{npm → dist}/src/sortQueryString.spec.d.ts +0 -0
  75. /package/{npm → dist}/src/sortQueryString.spec.js +0 -0
@@ -1,26 +0,0 @@
1
- import { URLSearchParams } from 'node:url'
2
-
3
- export const sortQueryString = (mockUrl: string): string => {
4
- const [host, query] = mockUrl.split('?', 2) as [string, string | undefined]
5
- if (query === undefined || (query?.length ?? 0) === 0) return host
6
- return `${host}?${sortQuery(new URLSearchParams(query))}`
7
- }
8
-
9
- export const sortQuery = (
10
- query: URLSearchParams | Record<string, string>,
11
- ): string => {
12
- const params: string[][] = []
13
- if (query instanceof URLSearchParams) {
14
- query.forEach((v, k) => {
15
- params.push([k, v])
16
- })
17
- } else {
18
- params.push(...Object.entries(query))
19
- }
20
- params.sort(([k1], [k2]) => (k1 ?? '').localeCompare(k2 ?? ''))
21
- const sortedParams = new URLSearchParams()
22
- for (const [k, v] of params) {
23
- sortedParams.append(k as string, v as string)
24
- }
25
- return sortedParams.toString()
26
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes