@geekmidas/constructs 3.0.2 → 3.0.3

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 (173) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/{AmazonApiGatewayV1EndpointAdaptor-COLHHAsd.mjs → AmazonApiGatewayV1EndpointAdaptor-DCfEo-Tu.mjs} +2 -2
  3. package/dist/{AmazonApiGatewayV1EndpointAdaptor-COLHHAsd.mjs.map → AmazonApiGatewayV1EndpointAdaptor-DCfEo-Tu.mjs.map} +1 -1
  4. package/dist/{AmazonApiGatewayV1EndpointAdaptor-CW0BCUkm.cjs → AmazonApiGatewayV1EndpointAdaptor-DwKlAfnb.cjs} +2 -2
  5. package/dist/{AmazonApiGatewayV1EndpointAdaptor-CW0BCUkm.cjs.map → AmazonApiGatewayV1EndpointAdaptor-DwKlAfnb.cjs.map} +1 -1
  6. package/dist/{AmazonApiGatewayV2EndpointAdaptor-C7ZrwcTX.cjs → AmazonApiGatewayV2EndpointAdaptor-B126fL6i.cjs} +4 -7
  7. package/dist/AmazonApiGatewayV2EndpointAdaptor-B126fL6i.cjs.map +1 -0
  8. package/dist/{AmazonApiGatewayV2EndpointAdaptor-Cl9ERGyi.mjs → AmazonApiGatewayV2EndpointAdaptor-CGMF4lD4.mjs} +3 -7
  9. package/dist/AmazonApiGatewayV2EndpointAdaptor-CGMF4lD4.mjs.map +1 -0
  10. package/dist/AmazonApiGatewayV2EndpointAdaptor-OkwjABOz.d.cts.map +1 -1
  11. package/dist/AmazonApiGatewayV2EndpointAdaptor-ofjuxcPV.d.mts.map +1 -1
  12. package/dist/{Authorizer-Dx57psuM.cjs → Authorizer-BXxBee2P.cjs} +1 -1
  13. package/dist/{Authorizer-Dx57psuM.cjs.map → Authorizer-BXxBee2P.cjs.map} +1 -1
  14. package/dist/{Authorizer-4unKN3Xn.mjs → Authorizer-BgjU8-z6.mjs} +1 -1
  15. package/dist/{Authorizer-4unKN3Xn.mjs.map → Authorizer-BgjU8-z6.mjs.map} +1 -1
  16. package/dist/{Cron-B3vrGuaD.mjs → Cron-BUpUS-0f.mjs} +1 -1
  17. package/dist/{Cron-B3vrGuaD.mjs.map → Cron-BUpUS-0f.mjs.map} +1 -1
  18. package/dist/{Cron-DEKZg5j4.cjs → Cron-Bp08dJ4R.cjs} +1 -1
  19. package/dist/{Cron-DEKZg5j4.cjs.map → Cron-Bp08dJ4R.cjs.map} +1 -1
  20. package/dist/{CronBuilder-BHpY6w3b.cjs → CronBuilder-CIxJQ1Ps.cjs} +2 -2
  21. package/dist/{CronBuilder-BHpY6w3b.cjs.map → CronBuilder-CIxJQ1Ps.cjs.map} +1 -1
  22. package/dist/{CronBuilder-VXpyNfp2.mjs → CronBuilder-DUggbCHc.mjs} +2 -2
  23. package/dist/{CronBuilder-VXpyNfp2.mjs.map → CronBuilder-DUggbCHc.mjs.map} +1 -1
  24. package/dist/{EndpointBuilder-D1RtrBu1.mjs → EndpointBuilder-CF-ZWtdu.mjs} +3 -3
  25. package/dist/{EndpointBuilder-D1RtrBu1.mjs.map → EndpointBuilder-CF-ZWtdu.mjs.map} +1 -1
  26. package/dist/{EndpointBuilder-fXmTxRyW.cjs → EndpointBuilder-CyszO0bs.cjs} +3 -3
  27. package/dist/{EndpointBuilder-fXmTxRyW.cjs.map → EndpointBuilder-CyszO0bs.cjs.map} +1 -1
  28. package/dist/{EndpointFactory-DBfTbSTX.cjs → EndpointFactory-B0D6d6t9.cjs} +3 -3
  29. package/dist/{EndpointFactory-DBfTbSTX.cjs.map → EndpointFactory-B0D6d6t9.cjs.map} +1 -1
  30. package/dist/{EndpointFactory-DkB8yxdQ.mjs → EndpointFactory-Do498RmG.mjs} +3 -3
  31. package/dist/{EndpointFactory-DkB8yxdQ.mjs.map → EndpointFactory-Do498RmG.mjs.map} +1 -1
  32. package/dist/{HonoEndpointAdaptor-BCql3gLP.d.cts → HonoEndpointAdaptor-BNHGwpvZ.d.cts} +3 -3
  33. package/dist/{HonoEndpointAdaptor-BCql3gLP.d.cts.map → HonoEndpointAdaptor-BNHGwpvZ.d.cts.map} +1 -1
  34. package/dist/{HonoEndpointAdaptor-y9fCIxaz.mjs → HonoEndpointAdaptor-BvxQreVM.mjs} +2 -2
  35. package/dist/{HonoEndpointAdaptor-y9fCIxaz.mjs.map → HonoEndpointAdaptor-BvxQreVM.mjs.map} +1 -1
  36. package/dist/{HonoEndpointAdaptor-CavBd6P2.cjs → HonoEndpointAdaptor-CQqQPLHH.cjs} +2 -2
  37. package/dist/{HonoEndpointAdaptor-CavBd6P2.cjs.map → HonoEndpointAdaptor-CQqQPLHH.cjs.map} +1 -1
  38. package/dist/{HonoEndpointAdaptor-C3AdQ0xS.d.mts → HonoEndpointAdaptor-DgoeqUX6.d.mts} +3 -3
  39. package/dist/{HonoEndpointAdaptor-C3AdQ0xS.d.mts.map → HonoEndpointAdaptor-DgoeqUX6.d.mts.map} +1 -1
  40. package/dist/{Subscriber-Scz7hrV6.cjs → Subscriber-ClqSPbIZ.cjs} +1 -1
  41. package/dist/{Subscriber-Scz7hrV6.cjs.map → Subscriber-ClqSPbIZ.cjs.map} +1 -1
  42. package/dist/{Subscriber-BEhOdNQi.mjs → Subscriber-DKQK5gLD.mjs} +1 -1
  43. package/dist/{Subscriber-BEhOdNQi.mjs.map → Subscriber-DKQK5gLD.mjs.map} +1 -1
  44. package/dist/{SubscriberBuilder-B82h4v-S.cjs → SubscriberBuilder-BS5B_688.cjs} +2 -2
  45. package/dist/{SubscriberBuilder-B82h4v-S.cjs.map → SubscriberBuilder-BS5B_688.cjs.map} +1 -1
  46. package/dist/{SubscriberBuilder-DlUaG0Ej.mjs → SubscriberBuilder-BswTuvUc.mjs} +2 -2
  47. package/dist/{SubscriberBuilder-DlUaG0Ej.mjs.map → SubscriberBuilder-BswTuvUc.mjs.map} +1 -1
  48. package/dist/adaptors/aws.cjs +3 -3
  49. package/dist/adaptors/aws.d.cts +1 -1
  50. package/dist/adaptors/aws.d.mts +1 -1
  51. package/dist/adaptors/aws.mjs +3 -3
  52. package/dist/adaptors/hono.cjs +2 -2
  53. package/dist/adaptors/hono.d.cts +2 -2
  54. package/dist/adaptors/hono.d.mts +2 -2
  55. package/dist/adaptors/hono.mjs +2 -2
  56. package/dist/adaptors/testing.d.cts +1 -1
  57. package/dist/adaptors/testing.d.mts +1 -1
  58. package/dist/crons/Cron.cjs +1 -1
  59. package/dist/crons/Cron.d.cts +1 -1
  60. package/dist/crons/Cron.d.mts +1 -1
  61. package/dist/crons/Cron.mjs +1 -1
  62. package/dist/crons/CronBuilder.cjs +2 -2
  63. package/dist/crons/CronBuilder.d.cts +1 -1
  64. package/dist/crons/CronBuilder.d.mts +1 -1
  65. package/dist/crons/CronBuilder.mjs +2 -2
  66. package/dist/crons/index.cjs +2 -2
  67. package/dist/crons/index.d.cts +5 -5
  68. package/dist/crons/index.d.cts.map +1 -1
  69. package/dist/crons/index.d.mts +5 -5
  70. package/dist/crons/index.d.mts.map +1 -1
  71. package/dist/crons/index.mjs +2 -2
  72. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.cts +1 -1
  73. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.mts +1 -1
  74. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.cjs +2 -2
  75. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.cts +1 -1
  76. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.mts +1 -1
  77. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.mjs +2 -2
  78. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.cjs +1 -2
  79. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.cts +1 -1
  80. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.mts +1 -1
  81. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.mjs +1 -2
  82. package/dist/endpoints/Authorizer.cjs +1 -1
  83. package/dist/endpoints/Authorizer.mjs +1 -1
  84. package/dist/endpoints/Endpoint.d.cts +1 -1
  85. package/dist/endpoints/Endpoint.d.mts +1 -1
  86. package/dist/endpoints/EndpointBuilder.cjs +3 -3
  87. package/dist/endpoints/EndpointBuilder.d.cts +1 -1
  88. package/dist/endpoints/EndpointBuilder.d.mts +1 -1
  89. package/dist/endpoints/EndpointBuilder.mjs +3 -3
  90. package/dist/endpoints/EndpointFactory.cjs +4 -4
  91. package/dist/endpoints/EndpointFactory.d.cts +1 -1
  92. package/dist/endpoints/EndpointFactory.d.mts +1 -1
  93. package/dist/endpoints/EndpointFactory.mjs +4 -4
  94. package/dist/endpoints/HonoEndpointAdaptor.cjs +2 -2
  95. package/dist/endpoints/HonoEndpointAdaptor.d.cts +2 -2
  96. package/dist/endpoints/HonoEndpointAdaptor.d.mts +2 -2
  97. package/dist/endpoints/HonoEndpointAdaptor.mjs +2 -2
  98. package/dist/endpoints/TestEndpointAdaptor.d.cts +1 -1
  99. package/dist/endpoints/TestEndpointAdaptor.d.mts +1 -1
  100. package/dist/endpoints/audit.d.cts +1 -1
  101. package/dist/endpoints/audit.d.mts +1 -1
  102. package/dist/endpoints/helpers.d.cts +1 -1
  103. package/dist/endpoints/helpers.d.mts +1 -1
  104. package/dist/endpoints/index.cjs +4 -4
  105. package/dist/endpoints/index.d.cts +3 -3
  106. package/dist/endpoints/index.d.mts +3 -3
  107. package/dist/endpoints/index.mjs +4 -4
  108. package/dist/endpoints/lazyAccessors.d.cts +1 -1
  109. package/dist/endpoints/lazyAccessors.d.mts +1 -1
  110. package/dist/endpoints/parseHonoQuery.cjs +1 -1
  111. package/dist/endpoints/parseHonoQuery.d.cts +2 -2
  112. package/dist/endpoints/parseHonoQuery.d.cts.map +1 -1
  113. package/dist/endpoints/parseHonoQuery.d.mts +2 -2
  114. package/dist/endpoints/parseHonoQuery.d.mts.map +1 -1
  115. package/dist/endpoints/parseHonoQuery.mjs +1 -1
  116. package/dist/endpoints/parseQueryParams.cjs +1 -1
  117. package/dist/endpoints/parseQueryParams.d.cts +2 -2
  118. package/dist/endpoints/parseQueryParams.d.cts.map +1 -1
  119. package/dist/endpoints/parseQueryParams.d.mts +2 -2
  120. package/dist/endpoints/parseQueryParams.d.mts.map +1 -1
  121. package/dist/endpoints/parseQueryParams.mjs +1 -1
  122. package/dist/endpoints/processAudits.d.cts +1 -1
  123. package/dist/endpoints/processAudits.d.mts +1 -1
  124. package/dist/endpoints/rls.cjs +1 -1
  125. package/dist/endpoints/rls.d.cts +1 -1
  126. package/dist/endpoints/rls.d.mts +1 -1
  127. package/dist/endpoints/rls.mjs +1 -1
  128. package/dist/functions/index.d.cts +1 -1
  129. package/dist/functions/index.d.mts +1 -1
  130. package/dist/index-Br-zTYii.d.mts +12 -0
  131. package/dist/{index-BRoc67OX.d.cts.map → index-Br-zTYii.d.mts.map} +1 -1
  132. package/dist/index-dRNH0dT6.d.cts +12 -0
  133. package/dist/{index-_5DYCNAt.d.mts.map → index-dRNH0dT6.d.cts.map} +1 -1
  134. package/dist/parseHonoQuery-BBs8CX-H.cjs +24 -0
  135. package/dist/parseHonoQuery-BBs8CX-H.cjs.map +1 -0
  136. package/dist/parseHonoQuery-Cp8CII0P.mjs +18 -0
  137. package/dist/parseHonoQuery-Cp8CII0P.mjs.map +1 -0
  138. package/dist/parseQueryParams-B4RK1za3.cjs +31 -0
  139. package/dist/parseQueryParams-B4RK1za3.cjs.map +1 -0
  140. package/dist/parseQueryParams-DS3Qmrbd.mjs +25 -0
  141. package/dist/parseQueryParams-DS3Qmrbd.mjs.map +1 -0
  142. package/dist/{rls-DxFqdIA0.cjs → rls-BrywnrQb.cjs} +1 -1
  143. package/dist/{rls-DxFqdIA0.cjs.map → rls-BrywnrQb.cjs.map} +1 -1
  144. package/dist/{rls-7XXX7DvY.mjs → rls-C0cWOnk4.mjs} +1 -1
  145. package/dist/{rls-7XXX7DvY.mjs.map → rls-C0cWOnk4.mjs.map} +1 -1
  146. package/dist/subscribers/Subscriber.cjs +1 -1
  147. package/dist/subscribers/Subscriber.mjs +1 -1
  148. package/dist/subscribers/SubscriberBuilder.cjs +2 -2
  149. package/dist/subscribers/SubscriberBuilder.mjs +2 -2
  150. package/dist/subscribers/index.cjs +2 -2
  151. package/dist/subscribers/index.d.cts +2 -2
  152. package/dist/subscribers/index.d.mts +2 -2
  153. package/dist/subscribers/index.mjs +2 -2
  154. package/package.json +15 -13
  155. package/src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts +2 -18
  156. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.spec.ts +7 -7
  157. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.events.spec.ts +4 -2
  158. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.spec.ts +9 -7
  159. package/src/endpoints/__tests__/HonoEndpointAdaptor.spec.ts +4 -4
  160. package/src/endpoints/parseHonoQuery.ts +9 -46
  161. package/src/endpoints/parseQueryParams.ts +12 -33
  162. package/dist/AmazonApiGatewayV2EndpointAdaptor-C7ZrwcTX.cjs.map +0 -1
  163. package/dist/AmazonApiGatewayV2EndpointAdaptor-Cl9ERGyi.mjs.map +0 -1
  164. package/dist/index-BRoc67OX.d.cts +0 -12
  165. package/dist/index-_5DYCNAt.d.mts +0 -12
  166. package/dist/parseHonoQuery-D4MhxTRc.cjs +0 -39
  167. package/dist/parseHonoQuery-D4MhxTRc.cjs.map +0 -1
  168. package/dist/parseHonoQuery-DpK3sGPc.mjs +0 -33
  169. package/dist/parseHonoQuery-DpK3sGPc.mjs.map +0 -1
  170. package/dist/parseQueryParams-BSNkjmZ9.cjs +0 -40
  171. package/dist/parseQueryParams-BSNkjmZ9.cjs.map +0 -1
  172. package/dist/parseQueryParams-UMTRnRrW.mjs +0 -34
  173. package/dist/parseQueryParams-UMTRnRrW.mjs.map +0 -1
@@ -4,6 +4,7 @@ import type { Logger } from '@geekmidas/logger';
4
4
  import type { Service } from '@geekmidas/services';
5
5
  import type { StandardSchemaV1 } from '@standard-schema/spec';
6
6
  import type { APIGatewayProxyEventV2, Context } from 'aws-lambda';
7
+ import qs from 'qs';
7
8
  import type { HttpMethod } from '../types';
8
9
  import {
9
10
  AmazonApiGatewayEndpoint,
@@ -14,7 +15,6 @@ import {
14
15
  } from './AmazonApiGatewayEndpointAdaptor';
15
16
  import type { CookieFn, Endpoint, EndpointSchemas } from './Endpoint';
16
17
  import { createApiGatewayCookies } from './lazyAccessors';
17
- import { parseQueryParams } from './parseQueryParams';
18
18
 
19
19
  export class AmazonApiGatewayV2Endpoint<
20
20
  TRoute extends string,
@@ -45,25 +45,9 @@ export class AmazonApiGatewayV2Endpoint<
45
45
  }
46
46
 
47
47
  override getInput(e: APIGatewayProxyEventV2): GetInputResponse {
48
- // API Gateway V2 handles arrays as comma-separated values
49
- const queryParams = e.queryStringParameters || {};
50
- const processedParams: Record<string, string | string[]> = {};
51
-
52
- for (const [key, value] of Object.entries(queryParams)) {
53
- if (value !== undefined) {
54
- // Check if value contains comma and could be an array
55
- // Be careful not to split values that legitimately contain commas
56
- if (value.includes(',') && !value.includes('"')) {
57
- processedParams[key] = value.split(',').map((v) => v.trim());
58
- } else {
59
- processedParams[key] = value;
60
- }
61
- }
62
- }
63
-
64
48
  return {
65
49
  body: e.body ? JSON.parse(e.body) : undefined,
66
- query: parseQueryParams(processedParams),
50
+ query: qs.parse(e.rawQueryString) as Record<string, any>,
67
51
  params: e.pathParameters || {},
68
52
  };
69
53
  }
@@ -775,7 +775,7 @@ describe('AmazonApiGatewayV1Endpoint', () => {
775
775
  });
776
776
 
777
777
  describe('combined inputs', () => {
778
- it('should handle array query parameters', async () => {
778
+ it('should handle array query parameters with bracket notation', async () => {
779
779
  const querySchema = z.object({
780
780
  tags: z.array(z.string()),
781
781
  page: z.coerce.number().default(1),
@@ -808,9 +808,9 @@ describe('AmazonApiGatewayV1Endpoint', () => {
808
808
  const handler = adapter.handler;
809
809
 
810
810
  const event = createMockV1Event({
811
- queryStringParameters: { tags: 'nodejs', page: '2' },
811
+ queryStringParameters: { 'tags[]': 'nodejs', page: '2' },
812
812
  multiValueQueryStringParameters: {
813
- tags: ['nodejs', 'typescript', 'javascript'],
813
+ 'tags[]': ['nodejs', 'typescript', 'javascript'],
814
814
  page: ['2'],
815
815
  },
816
816
  });
@@ -825,7 +825,7 @@ describe('AmazonApiGatewayV1Endpoint', () => {
825
825
  });
826
826
  });
827
827
 
828
- it('should handle object query parameters with dot notation', async () => {
828
+ it('should handle object query parameters with bracket notation', async () => {
829
829
  const querySchema = z.object({
830
830
  filter: z.object({
831
831
  name: z.string(),
@@ -867,9 +867,9 @@ describe('AmazonApiGatewayV1Endpoint', () => {
867
867
 
868
868
  const event = createMockV1Event({
869
869
  queryStringParameters: {
870
- 'filter.name': 'john',
871
- 'filter.status': 'active',
872
- 'filter.priority': '1',
870
+ 'filter[name]': 'john',
871
+ 'filter[status]': 'active',
872
+ 'filter[priority]': '1',
873
873
  sort: 'priority',
874
874
  },
875
875
  });
@@ -635,7 +635,7 @@ describe('AmazonApiGatewayV2Endpoint Events', () => {
635
635
  expect(mockPublisher.publish).not.toHaveBeenCalled();
636
636
  });
637
637
 
638
- it('should handle comma-separated array query parameters', async () => {
638
+ it('should handle bracket notation array query parameters', async () => {
639
639
  const mockPublisher: EventPublisher<TestEvent> = {
640
640
  publish: vi.fn().mockResolvedValue(undefined),
641
641
  };
@@ -702,8 +702,10 @@ describe('AmazonApiGatewayV2Endpoint Events', () => {
702
702
  },
703
703
  },
704
704
  pathParameters: { id: '123' },
705
+ rawQueryString:
706
+ 'tags%5B%5D=javascript&tags%5B%5D=typescript&tags%5B%5D=nodejs',
705
707
  queryStringParameters: {
706
- tags: 'javascript, typescript, nodejs', // V2 handles arrays as comma-separated
708
+ 'tags[]': 'javascript,typescript,nodejs',
707
709
  },
708
710
  });
709
711
  const context = createMockContext();
@@ -139,7 +139,7 @@ describe('AmazonApiGatewayV2Endpoint', () => {
139
139
  });
140
140
  });
141
141
 
142
- it('should handle array query parameters (comma-separated)', async () => {
142
+ it('should handle array query parameters with bracket notation', async () => {
143
143
  const endpoint = e
144
144
  .get('/search')
145
145
  .query(
@@ -164,9 +164,10 @@ describe('AmazonApiGatewayV2Endpoint', () => {
164
164
  const event = createMockV2Event({
165
165
  routeKey: 'GET /search',
166
166
  rawPath: '/search',
167
- rawQueryString: 'tags=nodejs,typescript,javascript&limit=20',
167
+ rawQueryString:
168
+ 'tags%5B%5D=nodejs&tags%5B%5D=typescript&tags%5B%5D=javascript&limit=20',
168
169
  queryStringParameters: {
169
- tags: 'nodejs,typescript,javascript',
170
+ 'tags[]': 'nodejs,typescript,javascript',
170
171
  limit: '20',
171
172
  },
172
173
  });
@@ -182,7 +183,7 @@ describe('AmazonApiGatewayV2Endpoint', () => {
182
183
  });
183
184
  });
184
185
 
185
- it('should handle object query parameters with dot notation', async () => {
186
+ it('should handle object query parameters with bracket notation', async () => {
186
187
  const endpoint = e
187
188
  .get('/search')
188
189
  .query(
@@ -210,10 +211,11 @@ describe('AmazonApiGatewayV2Endpoint', () => {
210
211
  const event = createMockV2Event({
211
212
  routeKey: 'GET /search',
212
213
  rawPath: '/search',
213
- rawQueryString: 'filter.category=electronics&filter.active=true',
214
+ rawQueryString:
215
+ 'filter%5Bcategory%5D=electronics&filter%5Bactive%5D=true',
214
216
  queryStringParameters: {
215
- 'filter.category': 'electronics',
216
- 'filter.active': 'true',
217
+ 'filter[category]': 'electronics',
218
+ 'filter[active]': 'true',
217
219
  },
218
220
  });
219
221
 
@@ -626,7 +626,7 @@ describe('HonoEndpointAdaptor', () => {
626
626
  });
627
627
 
628
628
  describe('query parameter handling', () => {
629
- it('should handle array query parameters', async () => {
629
+ it('should handle array query parameters with bracket notation', async () => {
630
630
  const querySchema = z.object({
631
631
  tags: z.array(z.string()),
632
632
  limit: z.coerce.number().default(10),
@@ -663,7 +663,7 @@ describe('HonoEndpointAdaptor', () => {
663
663
  adaptor.addRoute(serviceDiscovery, app);
664
664
 
665
665
  const response = await app.request(
666
- '/search?tags=nodejs&tags=typescript&tags=javascript&limit=20',
666
+ '/search?tags[]=nodejs&tags[]=typescript&tags[]=javascript&limit=20',
667
667
  );
668
668
 
669
669
  expect(response.status).toBe(200);
@@ -673,7 +673,7 @@ describe('HonoEndpointAdaptor', () => {
673
673
  });
674
674
  });
675
675
 
676
- it('should handle object query parameters with dot notation', async () => {
676
+ it('should handle object query parameters with bracket notation', async () => {
677
677
  const querySchema = z.object({
678
678
  filter: z.object({
679
679
  category: z.string(),
@@ -718,7 +718,7 @@ describe('HonoEndpointAdaptor', () => {
718
718
  adaptor.addRoute(serviceDiscovery, app);
719
719
 
720
720
  const response = await app.request(
721
- '/products?filter.category=electronics&filter.active=true&filter.minPrice=100&sort=price',
721
+ '/products?filter[category]=electronics&filter[active]=true&filter[minPrice]=100&sort=price',
722
722
  );
723
723
 
724
724
  expect(response.status).toBe(200);
@@ -1,53 +1,16 @@
1
1
  import type { Context } from 'hono';
2
+ import qs from 'qs';
2
3
 
3
4
  /**
4
- * Parse Hono query parameters to handle arrays and nested objects
5
- * Hono provides c.req.queries() for arrays, but we need to handle dot notation for objects
5
+ * Parse Hono query parameters using qs bracket notation
6
+ * Supports nested objects, arrays, and deep nesting via standard bracket syntax
6
7
  */
7
8
  export function parseHonoQuery(c: Context): Record<string, any> {
8
- const allParams = c.req.query();
9
- const result: Record<string, any> = {};
10
-
11
- // First, handle all query parameters
12
- for (const [key, value] of Object.entries(allParams)) {
13
- if (key.includes('.')) {
14
- // Handle dot notation for objects
15
- const parts = key.split('.');
16
- let current = result;
17
-
18
- // Navigate/create the nested structure
19
- for (let i = 0; i < parts.length - 1; i++) {
20
- const part = parts[i];
21
- if (!part) continue;
22
- if (
23
- !current[part] ||
24
- typeof current[part] !== 'object' ||
25
- Array.isArray(current[part])
26
- ) {
27
- current[part] = {};
28
- }
29
- current = current[part];
30
- }
31
-
32
- // Set the final value, checking for arrays in nested keys
33
- const lastPart = parts[parts.length - 1];
34
- if (!lastPart) continue;
35
- const multipleValues = c.req.queries(key);
36
- if (multipleValues && multipleValues.length > 1) {
37
- current[lastPart] = multipleValues;
38
- } else {
39
- current[lastPart] = value;
40
- }
41
- } else {
42
- // For regular keys, check if there are multiple values
43
- const multipleValues = c.req.queries(key);
44
- if (multipleValues && multipleValues.length > 1) {
45
- result[key] = multipleValues;
46
- } else {
47
- result[key] = value;
48
- }
49
- }
9
+ const url = c.req.url;
10
+ const queryIndex = url.indexOf('?');
11
+ if (queryIndex === -1) {
12
+ return {};
50
13
  }
51
-
52
- return result;
14
+ const queryString = url.slice(queryIndex + 1);
15
+ return qs.parse(queryString) as Record<string, any>;
53
16
  }
@@ -1,9 +1,11 @@
1
+ import qs from 'qs';
2
+
1
3
  /**
2
4
  * Parse query parameters from a flat object into a nested structure
3
- * Handles arrays (multiple values with same key) and objects (dot notation)
5
+ * Uses qs bracket notation for standard interoperability
4
6
  *
5
7
  * @example
6
- * parseQueryParams({ 'tags': ['a', 'b'], 'filter.name': 'john' })
8
+ * parseQueryParams({ 'tags[]': ['a', 'b'], 'filter[name]': 'john' })
7
9
  * // Returns: { tags: ['a', 'b'], filter: { name: 'john' } }
8
10
  */
9
11
  export function parseQueryParams(
@@ -13,41 +15,18 @@ export function parseQueryParams(
13
15
  return {};
14
16
  }
15
17
 
16
- const result: Record<string, any> = {};
17
-
18
+ // Reconstruct a query string from the flat object so qs can parse bracket notation
19
+ const parts: string[] = [];
18
20
  for (const [key, value] of Object.entries(queryParams)) {
19
- if (value === undefined) {
20
- continue;
21
- }
22
-
23
- // Check if the key contains dot notation
24
- if (key.includes('.')) {
25
- const parts = key.split('.');
26
- let current = result;
27
-
28
- // Navigate/create the nested structure
29
- for (let i = 0; i < parts.length - 1; i++) {
30
- const part = parts[i];
31
- if (!part) continue;
32
- if (
33
- !current[part] ||
34
- typeof current[part] !== 'object' ||
35
- Array.isArray(current[part])
36
- ) {
37
- current[part] = {};
38
- }
39
- current = current[part];
21
+ if (value === undefined) continue;
22
+ if (Array.isArray(value)) {
23
+ for (const v of value) {
24
+ parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(v)}`);
40
25
  }
41
-
42
- // Set the final value
43
- const lastPart = parts[parts.length - 1];
44
- if (!lastPart) continue;
45
- current[lastPart] = value;
46
26
  } else {
47
- // Simple key, just assign the value
48
- result[key] = value;
27
+ parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
49
28
  }
50
29
  }
51
30
 
52
- return result;
31
+ return qs.parse(parts.join('&')) as Record<string, any>;
53
32
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-C7ZrwcTX.cjs","names":["AmazonApiGatewayEndpoint","e: APIGatewayProxyEventV2","processedParams: Record<string, string | string[]>","event: APIGatewayProxyEventV2","context: Context","envParser: EnvironmentParser<{}>","endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>","options: AmazonApiGatewayEndpointOptions"],"sources":["../src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts"],"sourcesContent":["import type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { APIGatewayProxyEventV2, Context } from 'aws-lambda';\nimport type { HttpMethod } from '../types';\nimport {\n\tAmazonApiGatewayEndpoint,\n\ttype AmazonApiGatewayEndpointOptions,\n\ttype AmazonApiGatewayV2EndpointHandler,\n\ttype GetInputResponse,\n\ttype LoggerContext,\n} from './AmazonApiGatewayEndpointAdaptor';\nimport type { CookieFn, Endpoint, EndpointSchemas } from './Endpoint';\nimport { createApiGatewayCookies } from './lazyAccessors';\nimport { parseQueryParams } from './parseQueryParams';\n\nexport class AmazonApiGatewayV2Endpoint<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n> extends AmazonApiGatewayEndpoint<\n\tAmazonApiGatewayV2EndpointHandler,\n\tAPIGatewayProxyEventV2,\n\tTRoute,\n\tTMethod,\n\tTInput,\n\tTOutSchema,\n\tTServices,\n\tTLogger,\n\tTSession,\n\tTEventPublisher\n> {\n\toverride getCookies(e: APIGatewayProxyEventV2): CookieFn {\n\t\treturn createApiGatewayCookies(\n\t\t\te.cookies,\n\t\t\t(e.headers as Record<string, string>)?.cookie,\n\t\t);\n\t}\n\n\toverride getInput(e: APIGatewayProxyEventV2): GetInputResponse {\n\t\t// API Gateway V2 handles arrays as comma-separated values\n\t\tconst queryParams = e.queryStringParameters || {};\n\t\tconst processedParams: Record<string, string | string[]> = {};\n\n\t\tfor (const [key, value] of Object.entries(queryParams)) {\n\t\t\tif (value !== undefined) {\n\t\t\t\t// Check if value contains comma and could be an array\n\t\t\t\t// Be careful not to split values that legitimately contain commas\n\t\t\t\tif (value.includes(',') && !value.includes('\"')) {\n\t\t\t\t\tprocessedParams[key] = value.split(',').map((v) => v.trim());\n\t\t\t\t} else {\n\t\t\t\t\tprocessedParams[key] = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tbody: e.body ? JSON.parse(e.body) : undefined,\n\t\t\tquery: parseQueryParams(processedParams),\n\t\t\tparams: e.pathParameters || {},\n\t\t};\n\t}\n\toverride getLoggerContext(\n\t\tevent: APIGatewayProxyEventV2,\n\t\tcontext: Context,\n\t): LoggerContext {\n\t\treturn {\n\t\t\tfn: {\n\t\t\t\tname: context.functionName,\n\t\t\t\tversion: context.functionVersion,\n\t\t\t},\n\t\t\treq: {\n\t\t\t\tid: event.requestContext.requestId,\n\t\t\t\tawsRequestId: context.awsRequestId,\n\t\t\t\tip: event.requestContext.http.sourceIp,\n\t\t\t\tuserAgent: event.requestContext.http.userAgent || undefined,\n\t\t\t\tpath: event.requestContext.http.path,\n\t\t\t},\n\t\t};\n\t}\n\tconstructor(\n\t\tprotected override envParser: EnvironmentParser<{}>,\n\t\tprotected override readonly endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>,\n\t\toptions: AmazonApiGatewayEndpointOptions = {},\n\t) {\n\t\tsuper(envParser, endpoint, options);\n\t}\n}\n\n// Re-export options type for convenience\nexport type { AmazonApiGatewayEndpointOptions };\n"],"mappings":";;;;;AAkBA,IAAa,6BAAb,cASUA,iEAWR;CACD,AAAS,WAAWC,GAAqC;AACxD,SAAO,8CACN,EAAE,SACD,EAAE,SAAoC,OACvC;CACD;CAED,AAAS,SAASA,GAA6C;EAE9D,MAAM,cAAc,EAAE,yBAAyB,CAAE;EACjD,MAAMC,kBAAqD,CAAE;AAE7D,OAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,YAAY,CACrD,KAAI,iBAGH,KAAI,MAAM,SAAS,IAAI,KAAK,MAAM,SAAS,KAAI,CAC9C,iBAAgB,OAAO,MAAM,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;MAE5D,iBAAgB,OAAO;AAK1B,SAAO;GACN,MAAM,EAAE,OAAO,KAAK,MAAM,EAAE,KAAK;GACjC,OAAO,0CAAiB,gBAAgB;GACxC,QAAQ,EAAE,kBAAkB,CAAE;EAC9B;CACD;CACD,AAAS,iBACRC,OACAC,SACgB;AAChB,SAAO;GACN,IAAI;IACH,MAAM,QAAQ;IACd,SAAS,QAAQ;GACjB;GACD,KAAK;IACJ,IAAI,MAAM,eAAe;IACzB,cAAc,QAAQ;IACtB,IAAI,MAAM,eAAe,KAAK;IAC9B,WAAW,MAAM,eAAe,KAAK;IACrC,MAAM,MAAM,eAAe,KAAK;GAChC;EACD;CACD;CACD,YACoBC,WACSC,UAU5BC,UAA2C,CAAE,GAC5C;AACD,QAAM,WAAW,UAAU,QAAQ;EAbhB;EACS;CAa5B;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-Cl9ERGyi.mjs","names":["e: APIGatewayProxyEventV2","processedParams: Record<string, string | string[]>","event: APIGatewayProxyEventV2","context: Context","envParser: EnvironmentParser<{}>","endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>","options: AmazonApiGatewayEndpointOptions"],"sources":["../src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts"],"sourcesContent":["import type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { APIGatewayProxyEventV2, Context } from 'aws-lambda';\nimport type { HttpMethod } from '../types';\nimport {\n\tAmazonApiGatewayEndpoint,\n\ttype AmazonApiGatewayEndpointOptions,\n\ttype AmazonApiGatewayV2EndpointHandler,\n\ttype GetInputResponse,\n\ttype LoggerContext,\n} from './AmazonApiGatewayEndpointAdaptor';\nimport type { CookieFn, Endpoint, EndpointSchemas } from './Endpoint';\nimport { createApiGatewayCookies } from './lazyAccessors';\nimport { parseQueryParams } from './parseQueryParams';\n\nexport class AmazonApiGatewayV2Endpoint<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n> extends AmazonApiGatewayEndpoint<\n\tAmazonApiGatewayV2EndpointHandler,\n\tAPIGatewayProxyEventV2,\n\tTRoute,\n\tTMethod,\n\tTInput,\n\tTOutSchema,\n\tTServices,\n\tTLogger,\n\tTSession,\n\tTEventPublisher\n> {\n\toverride getCookies(e: APIGatewayProxyEventV2): CookieFn {\n\t\treturn createApiGatewayCookies(\n\t\t\te.cookies,\n\t\t\t(e.headers as Record<string, string>)?.cookie,\n\t\t);\n\t}\n\n\toverride getInput(e: APIGatewayProxyEventV2): GetInputResponse {\n\t\t// API Gateway V2 handles arrays as comma-separated values\n\t\tconst queryParams = e.queryStringParameters || {};\n\t\tconst processedParams: Record<string, string | string[]> = {};\n\n\t\tfor (const [key, value] of Object.entries(queryParams)) {\n\t\t\tif (value !== undefined) {\n\t\t\t\t// Check if value contains comma and could be an array\n\t\t\t\t// Be careful not to split values that legitimately contain commas\n\t\t\t\tif (value.includes(',') && !value.includes('\"')) {\n\t\t\t\t\tprocessedParams[key] = value.split(',').map((v) => v.trim());\n\t\t\t\t} else {\n\t\t\t\t\tprocessedParams[key] = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tbody: e.body ? JSON.parse(e.body) : undefined,\n\t\t\tquery: parseQueryParams(processedParams),\n\t\t\tparams: e.pathParameters || {},\n\t\t};\n\t}\n\toverride getLoggerContext(\n\t\tevent: APIGatewayProxyEventV2,\n\t\tcontext: Context,\n\t): LoggerContext {\n\t\treturn {\n\t\t\tfn: {\n\t\t\t\tname: context.functionName,\n\t\t\t\tversion: context.functionVersion,\n\t\t\t},\n\t\t\treq: {\n\t\t\t\tid: event.requestContext.requestId,\n\t\t\t\tawsRequestId: context.awsRequestId,\n\t\t\t\tip: event.requestContext.http.sourceIp,\n\t\t\t\tuserAgent: event.requestContext.http.userAgent || undefined,\n\t\t\t\tpath: event.requestContext.http.path,\n\t\t\t},\n\t\t};\n\t}\n\tconstructor(\n\t\tprotected override envParser: EnvironmentParser<{}>,\n\t\tprotected override readonly endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>,\n\t\toptions: AmazonApiGatewayEndpointOptions = {},\n\t) {\n\t\tsuper(envParser, endpoint, options);\n\t}\n}\n\n// Re-export options type for convenience\nexport type { AmazonApiGatewayEndpointOptions };\n"],"mappings":";;;;;AAkBA,IAAa,6BAAb,cASU,yBAWR;CACD,AAAS,WAAWA,GAAqC;AACxD,SAAO,wBACN,EAAE,SACD,EAAE,SAAoC,OACvC;CACD;CAED,AAAS,SAASA,GAA6C;EAE9D,MAAM,cAAc,EAAE,yBAAyB,CAAE;EACjD,MAAMC,kBAAqD,CAAE;AAE7D,OAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,YAAY,CACrD,KAAI,iBAGH,KAAI,MAAM,SAAS,IAAI,KAAK,MAAM,SAAS,KAAI,CAC9C,iBAAgB,OAAO,MAAM,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;MAE5D,iBAAgB,OAAO;AAK1B,SAAO;GACN,MAAM,EAAE,OAAO,KAAK,MAAM,EAAE,KAAK;GACjC,OAAO,iBAAiB,gBAAgB;GACxC,QAAQ,EAAE,kBAAkB,CAAE;EAC9B;CACD;CACD,AAAS,iBACRC,OACAC,SACgB;AAChB,SAAO;GACN,IAAI;IACH,MAAM,QAAQ;IACd,SAAS,QAAQ;GACjB;GACD,KAAK;IACJ,IAAI,MAAM,eAAe;IACzB,cAAc,QAAQ;IACtB,IAAI,MAAM,eAAe,KAAK;IAC9B,WAAW,MAAM,eAAe,KAAK;IACrC,MAAM,MAAM,eAAe,KAAK;GAChC;EACD;CACD;CACD,YACoBC,WACSC,UAU5BC,UAA2C,CAAE,GAC5C;AACD,QAAM,WAAW,UAAU,QAAQ;EAbhB;EACS;CAa5B;AACD"}
@@ -1,12 +0,0 @@
1
- import { FunctionBuilder } from "./FunctionBuilder-D_7f5MfS.cjs";
2
- import * as _geekmidas_audit10 from "@geekmidas/audit";
3
- import * as _geekmidas_logger9 from "@geekmidas/logger";
4
- import * as _geekmidas_schema8 from "@geekmidas/schema";
5
-
6
- //#region src/functions/index.d.ts
7
- declare const f: FunctionBuilder<_geekmidas_schema8.ComposableStandardSchema, undefined, [], _geekmidas_logger9.Logger, undefined, string, undefined, string, undefined, string, _geekmidas_audit10.AuditableAction<string, unknown>>;
8
- //# sourceMappingURL=index.d.ts.map
9
-
10
- //#endregion
11
- export { f };
12
- //# sourceMappingURL=index-BRoc67OX.d.cts.map
@@ -1,12 +0,0 @@
1
- import { FunctionBuilder } from "./FunctionBuilder-m5BNA2Ap.mjs";
2
- import * as _geekmidas_audit2 from "@geekmidas/audit";
3
- import * as _geekmidas_logger1 from "@geekmidas/logger";
4
- import * as _geekmidas_schema0 from "@geekmidas/schema";
5
-
6
- //#region src/functions/index.d.ts
7
- declare const f: FunctionBuilder<_geekmidas_schema0.ComposableStandardSchema, undefined, [], _geekmidas_logger1.Logger, undefined, string, undefined, string, undefined, string, _geekmidas_audit2.AuditableAction<string, unknown>>;
8
- //# sourceMappingURL=index.d.ts.map
9
-
10
- //#endregion
11
- export { f };
12
- //# sourceMappingURL=index-_5DYCNAt.d.mts.map
@@ -1,39 +0,0 @@
1
-
2
- //#region src/endpoints/parseHonoQuery.ts
3
- /**
4
- * Parse Hono query parameters to handle arrays and nested objects
5
- * Hono provides c.req.queries() for arrays, but we need to handle dot notation for objects
6
- */
7
- function parseHonoQuery(c) {
8
- const allParams = c.req.query();
9
- const result = {};
10
- for (const [key, value] of Object.entries(allParams)) if (key.includes(".")) {
11
- const parts = key.split(".");
12
- let current = result;
13
- for (let i = 0; i < parts.length - 1; i++) {
14
- const part = parts[i];
15
- if (!part) continue;
16
- if (!current[part] || typeof current[part] !== "object" || Array.isArray(current[part])) current[part] = {};
17
- current = current[part];
18
- }
19
- const lastPart = parts[parts.length - 1];
20
- if (!lastPart) continue;
21
- const multipleValues = c.req.queries(key);
22
- if (multipleValues && multipleValues.length > 1) current[lastPart] = multipleValues;
23
- else current[lastPart] = value;
24
- } else {
25
- const multipleValues = c.req.queries(key);
26
- if (multipleValues && multipleValues.length > 1) result[key] = multipleValues;
27
- else result[key] = value;
28
- }
29
- return result;
30
- }
31
-
32
- //#endregion
33
- Object.defineProperty(exports, 'parseHonoQuery', {
34
- enumerable: true,
35
- get: function () {
36
- return parseHonoQuery;
37
- }
38
- });
39
- //# sourceMappingURL=parseHonoQuery-D4MhxTRc.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseHonoQuery-D4MhxTRc.cjs","names":["c: Context","result: Record<string, any>"],"sources":["../src/endpoints/parseHonoQuery.ts"],"sourcesContent":["import type { Context } from 'hono';\n\n/**\n * Parse Hono query parameters to handle arrays and nested objects\n * Hono provides c.req.queries() for arrays, but we need to handle dot notation for objects\n */\nexport function parseHonoQuery(c: Context): Record<string, any> {\n\tconst allParams = c.req.query();\n\tconst result: Record<string, any> = {};\n\n\t// First, handle all query parameters\n\tfor (const [key, value] of Object.entries(allParams)) {\n\t\tif (key.includes('.')) {\n\t\t\t// Handle dot notation for objects\n\t\t\tconst parts = key.split('.');\n\t\t\tlet current = result;\n\n\t\t\t// Navigate/create the nested structure\n\t\t\tfor (let i = 0; i < parts.length - 1; i++) {\n\t\t\t\tconst part = parts[i];\n\t\t\t\tif (!part) continue;\n\t\t\t\tif (\n\t\t\t\t\t!current[part] ||\n\t\t\t\t\ttypeof current[part] !== 'object' ||\n\t\t\t\t\tArray.isArray(current[part])\n\t\t\t\t) {\n\t\t\t\t\tcurrent[part] = {};\n\t\t\t\t}\n\t\t\t\tcurrent = current[part];\n\t\t\t}\n\n\t\t\t// Set the final value, checking for arrays in nested keys\n\t\t\tconst lastPart = parts[parts.length - 1];\n\t\t\tif (!lastPart) continue;\n\t\t\tconst multipleValues = c.req.queries(key);\n\t\t\tif (multipleValues && multipleValues.length > 1) {\n\t\t\t\tcurrent[lastPart] = multipleValues;\n\t\t\t} else {\n\t\t\t\tcurrent[lastPart] = value;\n\t\t\t}\n\t\t} else {\n\t\t\t// For regular keys, check if there are multiple values\n\t\t\tconst multipleValues = c.req.queries(key);\n\t\t\tif (multipleValues && multipleValues.length > 1) {\n\t\t\t\tresult[key] = multipleValues;\n\t\t\t} else {\n\t\t\t\tresult[key] = value;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n"],"mappings":";;;;;;AAMA,SAAgB,eAAeA,GAAiC;CAC/D,MAAM,YAAY,EAAE,IAAI,OAAO;CAC/B,MAAMC,SAA8B,CAAE;AAGtC,MAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,UAAU,CACnD,KAAI,IAAI,SAAS,IAAI,EAAE;EAEtB,MAAM,QAAQ,IAAI,MAAM,IAAI;EAC5B,IAAI,UAAU;AAGd,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,SAAS,GAAG,KAAK;GAC1C,MAAM,OAAO,MAAM;AACnB,QAAK,KAAM;AACX,QACE,QAAQ,gBACF,QAAQ,UAAU,YACzB,MAAM,QAAQ,QAAQ,MAAM,CAE5B,SAAQ,QAAQ,CAAE;AAEnB,aAAU,QAAQ;EAClB;EAGD,MAAM,WAAW,MAAM,MAAM,SAAS;AACtC,OAAK,SAAU;EACf,MAAM,iBAAiB,EAAE,IAAI,QAAQ,IAAI;AACzC,MAAI,kBAAkB,eAAe,SAAS,EAC7C,SAAQ,YAAY;MAEpB,SAAQ,YAAY;CAErB,OAAM;EAEN,MAAM,iBAAiB,EAAE,IAAI,QAAQ,IAAI;AACzC,MAAI,kBAAkB,eAAe,SAAS,EAC7C,QAAO,OAAO;MAEd,QAAO,OAAO;CAEf;AAGF,QAAO;AACP"}
@@ -1,33 +0,0 @@
1
- //#region src/endpoints/parseHonoQuery.ts
2
- /**
3
- * Parse Hono query parameters to handle arrays and nested objects
4
- * Hono provides c.req.queries() for arrays, but we need to handle dot notation for objects
5
- */
6
- function parseHonoQuery(c) {
7
- const allParams = c.req.query();
8
- const result = {};
9
- for (const [key, value] of Object.entries(allParams)) if (key.includes(".")) {
10
- const parts = key.split(".");
11
- let current = result;
12
- for (let i = 0; i < parts.length - 1; i++) {
13
- const part = parts[i];
14
- if (!part) continue;
15
- if (!current[part] || typeof current[part] !== "object" || Array.isArray(current[part])) current[part] = {};
16
- current = current[part];
17
- }
18
- const lastPart = parts[parts.length - 1];
19
- if (!lastPart) continue;
20
- const multipleValues = c.req.queries(key);
21
- if (multipleValues && multipleValues.length > 1) current[lastPart] = multipleValues;
22
- else current[lastPart] = value;
23
- } else {
24
- const multipleValues = c.req.queries(key);
25
- if (multipleValues && multipleValues.length > 1) result[key] = multipleValues;
26
- else result[key] = value;
27
- }
28
- return result;
29
- }
30
-
31
- //#endregion
32
- export { parseHonoQuery };
33
- //# sourceMappingURL=parseHonoQuery-DpK3sGPc.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseHonoQuery-DpK3sGPc.mjs","names":["c: Context","result: Record<string, any>"],"sources":["../src/endpoints/parseHonoQuery.ts"],"sourcesContent":["import type { Context } from 'hono';\n\n/**\n * Parse Hono query parameters to handle arrays and nested objects\n * Hono provides c.req.queries() for arrays, but we need to handle dot notation for objects\n */\nexport function parseHonoQuery(c: Context): Record<string, any> {\n\tconst allParams = c.req.query();\n\tconst result: Record<string, any> = {};\n\n\t// First, handle all query parameters\n\tfor (const [key, value] of Object.entries(allParams)) {\n\t\tif (key.includes('.')) {\n\t\t\t// Handle dot notation for objects\n\t\t\tconst parts = key.split('.');\n\t\t\tlet current = result;\n\n\t\t\t// Navigate/create the nested structure\n\t\t\tfor (let i = 0; i < parts.length - 1; i++) {\n\t\t\t\tconst part = parts[i];\n\t\t\t\tif (!part) continue;\n\t\t\t\tif (\n\t\t\t\t\t!current[part] ||\n\t\t\t\t\ttypeof current[part] !== 'object' ||\n\t\t\t\t\tArray.isArray(current[part])\n\t\t\t\t) {\n\t\t\t\t\tcurrent[part] = {};\n\t\t\t\t}\n\t\t\t\tcurrent = current[part];\n\t\t\t}\n\n\t\t\t// Set the final value, checking for arrays in nested keys\n\t\t\tconst lastPart = parts[parts.length - 1];\n\t\t\tif (!lastPart) continue;\n\t\t\tconst multipleValues = c.req.queries(key);\n\t\t\tif (multipleValues && multipleValues.length > 1) {\n\t\t\t\tcurrent[lastPart] = multipleValues;\n\t\t\t} else {\n\t\t\t\tcurrent[lastPart] = value;\n\t\t\t}\n\t\t} else {\n\t\t\t// For regular keys, check if there are multiple values\n\t\t\tconst multipleValues = c.req.queries(key);\n\t\t\tif (multipleValues && multipleValues.length > 1) {\n\t\t\t\tresult[key] = multipleValues;\n\t\t\t} else {\n\t\t\t\tresult[key] = value;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n"],"mappings":";;;;;AAMA,SAAgB,eAAeA,GAAiC;CAC/D,MAAM,YAAY,EAAE,IAAI,OAAO;CAC/B,MAAMC,SAA8B,CAAE;AAGtC,MAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,UAAU,CACnD,KAAI,IAAI,SAAS,IAAI,EAAE;EAEtB,MAAM,QAAQ,IAAI,MAAM,IAAI;EAC5B,IAAI,UAAU;AAGd,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,SAAS,GAAG,KAAK;GAC1C,MAAM,OAAO,MAAM;AACnB,QAAK,KAAM;AACX,QACE,QAAQ,gBACF,QAAQ,UAAU,YACzB,MAAM,QAAQ,QAAQ,MAAM,CAE5B,SAAQ,QAAQ,CAAE;AAEnB,aAAU,QAAQ;EAClB;EAGD,MAAM,WAAW,MAAM,MAAM,SAAS;AACtC,OAAK,SAAU;EACf,MAAM,iBAAiB,EAAE,IAAI,QAAQ,IAAI;AACzC,MAAI,kBAAkB,eAAe,SAAS,EAC7C,SAAQ,YAAY;MAEpB,SAAQ,YAAY;CAErB,OAAM;EAEN,MAAM,iBAAiB,EAAE,IAAI,QAAQ,IAAI;AACzC,MAAI,kBAAkB,eAAe,SAAS,EAC7C,QAAO,OAAO;MAEd,QAAO,OAAO;CAEf;AAGF,QAAO;AACP"}
@@ -1,40 +0,0 @@
1
-
2
- //#region src/endpoints/parseQueryParams.ts
3
- /**
4
- * Parse query parameters from a flat object into a nested structure
5
- * Handles arrays (multiple values with same key) and objects (dot notation)
6
- *
7
- * @example
8
- * parseQueryParams({ 'tags': ['a', 'b'], 'filter.name': 'john' })
9
- * // Returns: { tags: ['a', 'b'], filter: { name: 'john' } }
10
- */
11
- function parseQueryParams(queryParams) {
12
- if (!queryParams) return {};
13
- const result = {};
14
- for (const [key, value] of Object.entries(queryParams)) {
15
- if (value === void 0) continue;
16
- if (key.includes(".")) {
17
- const parts = key.split(".");
18
- let current = result;
19
- for (let i = 0; i < parts.length - 1; i++) {
20
- const part = parts[i];
21
- if (!part) continue;
22
- if (!current[part] || typeof current[part] !== "object" || Array.isArray(current[part])) current[part] = {};
23
- current = current[part];
24
- }
25
- const lastPart = parts[parts.length - 1];
26
- if (!lastPart) continue;
27
- current[lastPart] = value;
28
- } else result[key] = value;
29
- }
30
- return result;
31
- }
32
-
33
- //#endregion
34
- Object.defineProperty(exports, 'parseQueryParams', {
35
- enumerable: true,
36
- get: function () {
37
- return parseQueryParams;
38
- }
39
- });
40
- //# sourceMappingURL=parseQueryParams-BSNkjmZ9.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseQueryParams-BSNkjmZ9.cjs","names":["queryParams: Record<string, string | string[] | undefined> | null","result: Record<string, any>"],"sources":["../src/endpoints/parseQueryParams.ts"],"sourcesContent":["/**\n * Parse query parameters from a flat object into a nested structure\n * Handles arrays (multiple values with same key) and objects (dot notation)\n *\n * @example\n * parseQueryParams({ 'tags': ['a', 'b'], 'filter.name': 'john' })\n * // Returns: { tags: ['a', 'b'], filter: { name: 'john' } }\n */\nexport function parseQueryParams(\n\tqueryParams: Record<string, string | string[] | undefined> | null,\n): Record<string, any> {\n\tif (!queryParams) {\n\t\treturn {};\n\t}\n\n\tconst result: Record<string, any> = {};\n\n\tfor (const [key, value] of Object.entries(queryParams)) {\n\t\tif (value === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Check if the key contains dot notation\n\t\tif (key.includes('.')) {\n\t\t\tconst parts = key.split('.');\n\t\t\tlet current = result;\n\n\t\t\t// Navigate/create the nested structure\n\t\t\tfor (let i = 0; i < parts.length - 1; i++) {\n\t\t\t\tconst part = parts[i];\n\t\t\t\tif (!part) continue;\n\t\t\t\tif (\n\t\t\t\t\t!current[part] ||\n\t\t\t\t\ttypeof current[part] !== 'object' ||\n\t\t\t\t\tArray.isArray(current[part])\n\t\t\t\t) {\n\t\t\t\t\tcurrent[part] = {};\n\t\t\t\t}\n\t\t\t\tcurrent = current[part];\n\t\t\t}\n\n\t\t\t// Set the final value\n\t\t\tconst lastPart = parts[parts.length - 1];\n\t\t\tif (!lastPart) continue;\n\t\t\tcurrent[lastPart] = value;\n\t\t} else {\n\t\t\t// Simple key, just assign the value\n\t\t\tresult[key] = value;\n\t\t}\n\t}\n\n\treturn result;\n}\n"],"mappings":";;;;;;;;;;AAQA,SAAgB,iBACfA,aACsB;AACtB,MAAK,YACJ,QAAO,CAAE;CAGV,MAAMC,SAA8B,CAAE;AAEtC,MAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,YAAY,EAAE;AACvD,MAAI,iBACH;AAID,MAAI,IAAI,SAAS,IAAI,EAAE;GACtB,MAAM,QAAQ,IAAI,MAAM,IAAI;GAC5B,IAAI,UAAU;AAGd,QAAK,IAAI,IAAI,GAAG,IAAI,MAAM,SAAS,GAAG,KAAK;IAC1C,MAAM,OAAO,MAAM;AACnB,SAAK,KAAM;AACX,SACE,QAAQ,gBACF,QAAQ,UAAU,YACzB,MAAM,QAAQ,QAAQ,MAAM,CAE5B,SAAQ,QAAQ,CAAE;AAEnB,cAAU,QAAQ;GAClB;GAGD,MAAM,WAAW,MAAM,MAAM,SAAS;AACtC,QAAK,SAAU;AACf,WAAQ,YAAY;EACpB,MAEA,QAAO,OAAO;CAEf;AAED,QAAO;AACP"}
@@ -1,34 +0,0 @@
1
- //#region src/endpoints/parseQueryParams.ts
2
- /**
3
- * Parse query parameters from a flat object into a nested structure
4
- * Handles arrays (multiple values with same key) and objects (dot notation)
5
- *
6
- * @example
7
- * parseQueryParams({ 'tags': ['a', 'b'], 'filter.name': 'john' })
8
- * // Returns: { tags: ['a', 'b'], filter: { name: 'john' } }
9
- */
10
- function parseQueryParams(queryParams) {
11
- if (!queryParams) return {};
12
- const result = {};
13
- for (const [key, value] of Object.entries(queryParams)) {
14
- if (value === void 0) continue;
15
- if (key.includes(".")) {
16
- const parts = key.split(".");
17
- let current = result;
18
- for (let i = 0; i < parts.length - 1; i++) {
19
- const part = parts[i];
20
- if (!part) continue;
21
- if (!current[part] || typeof current[part] !== "object" || Array.isArray(current[part])) current[part] = {};
22
- current = current[part];
23
- }
24
- const lastPart = parts[parts.length - 1];
25
- if (!lastPart) continue;
26
- current[lastPart] = value;
27
- } else result[key] = value;
28
- }
29
- return result;
30
- }
31
-
32
- //#endregion
33
- export { parseQueryParams };
34
- //# sourceMappingURL=parseQueryParams-UMTRnRrW.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseQueryParams-UMTRnRrW.mjs","names":["queryParams: Record<string, string | string[] | undefined> | null","result: Record<string, any>"],"sources":["../src/endpoints/parseQueryParams.ts"],"sourcesContent":["/**\n * Parse query parameters from a flat object into a nested structure\n * Handles arrays (multiple values with same key) and objects (dot notation)\n *\n * @example\n * parseQueryParams({ 'tags': ['a', 'b'], 'filter.name': 'john' })\n * // Returns: { tags: ['a', 'b'], filter: { name: 'john' } }\n */\nexport function parseQueryParams(\n\tqueryParams: Record<string, string | string[] | undefined> | null,\n): Record<string, any> {\n\tif (!queryParams) {\n\t\treturn {};\n\t}\n\n\tconst result: Record<string, any> = {};\n\n\tfor (const [key, value] of Object.entries(queryParams)) {\n\t\tif (value === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Check if the key contains dot notation\n\t\tif (key.includes('.')) {\n\t\t\tconst parts = key.split('.');\n\t\t\tlet current = result;\n\n\t\t\t// Navigate/create the nested structure\n\t\t\tfor (let i = 0; i < parts.length - 1; i++) {\n\t\t\t\tconst part = parts[i];\n\t\t\t\tif (!part) continue;\n\t\t\t\tif (\n\t\t\t\t\t!current[part] ||\n\t\t\t\t\ttypeof current[part] !== 'object' ||\n\t\t\t\t\tArray.isArray(current[part])\n\t\t\t\t) {\n\t\t\t\t\tcurrent[part] = {};\n\t\t\t\t}\n\t\t\t\tcurrent = current[part];\n\t\t\t}\n\n\t\t\t// Set the final value\n\t\t\tconst lastPart = parts[parts.length - 1];\n\t\t\tif (!lastPart) continue;\n\t\t\tcurrent[lastPart] = value;\n\t\t} else {\n\t\t\t// Simple key, just assign the value\n\t\t\tresult[key] = value;\n\t\t}\n\t}\n\n\treturn result;\n}\n"],"mappings":";;;;;;;;;AAQA,SAAgB,iBACfA,aACsB;AACtB,MAAK,YACJ,QAAO,CAAE;CAGV,MAAMC,SAA8B,CAAE;AAEtC,MAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,YAAY,EAAE;AACvD,MAAI,iBACH;AAID,MAAI,IAAI,SAAS,IAAI,EAAE;GACtB,MAAM,QAAQ,IAAI,MAAM,IAAI;GAC5B,IAAI,UAAU;AAGd,QAAK,IAAI,IAAI,GAAG,IAAI,MAAM,SAAS,GAAG,KAAK;IAC1C,MAAM,OAAO,MAAM;AACnB,SAAK,KAAM;AACX,SACE,QAAQ,gBACF,QAAQ,UAAU,YACzB,MAAM,QAAQ,QAAQ,MAAM,CAE5B,SAAQ,QAAQ,CAAE;AAEnB,cAAU,QAAQ;GAClB;GAGD,MAAM,WAAW,MAAM,MAAM,SAAS;AACtC,QAAK,SAAU;AACf,WAAQ,YAAY;EACpB,MAEA,QAAO,OAAO;CAEf;AAED,QAAO;AACP"}