90078[FEATURE] Introduce URL factory in TypeScript
Commit message
Review
-
Code review CR +2 Done
- Andreas Kienast +2
- Benjamin Franzke +1
- Georg Ringer +1
-
Verified V +2 Done
- Andreas Kienast +2
- Benjamin Franzke +1
- Georg Ringer +1
- core-ci +1 CI
Issues 1
Files 4
- Build/Sources/TypeScript/core/factory/url-factory.ts5new+73 −0
- Build/Sources/TypeScript/core/tests/factory/url-factory-test.tsnew+105 −0
- typo3/sysext/core/Documentation/Changelog/14.0/Feature-107104-IntroduceUrlFactoryJavaScriptModule.rstnew+99 −0
- typo3/sysext/core/Resources/Public/JavaScript/factory/url-factory.jsnew+13 −0
Review log 3345
Show 1420 earlier messages
-
Andreas Kienast uploaded patch set 1 07/16/25, 13:29
-
Andreas Kienast uploaded patch set 2 07/16/25, 13:30
-
Andreas Kienast uploaded patch set 3 07/16/25, 13:32
-
core-ci voted on patch set 1 V +1 07/16/25, 13:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81775
-
Andreas Kienast commented on patch set 3 07/16/25, 13:38
-
core-ci voted on patch set 2 V +1 07/16/25, 13:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81776
-
core-ci voted on patch set 3 V +1 07/16/25, 13:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81777
-
Benjamin Franzke commented on patch set 3 07/16/25, 13:57
url-factory.ts:27ReplyWhat will be the consumer of this case? Why would we add arbitrary data structures (see any in method signature) to URLs? Smeels like somethign that should use `FormData` and non-GET requests.url-factory.ts:40should be `unknown` to make sure we are enforced to check/cast types -
Andreas Kienast uploaded patch set 4
V +107/16/25, 14:22 -
Andreas Kienast commented on patch set 4 07/16/25, 14:24
url-factory.ts:27ReplyThis is a helper to allow feeding nested structures, which will be flattened to a query string. Please see the tests for an example case.url-factory.ts:40ReplyI tried and failed to get that method in a compilable state. Can you please assist here? -
Andreas Kienast commented on patch set 4 07/16/25, 14:29
url-factory.ts:27ReplyExample: URLs to EditDocumentController Excerpt from file-list.ts ```js const url = new URL(top.TYPO3.settings.FormEngine.moduleUrl, window.location.origin); url.searchParams.set('edit[' + configuration.table + '][' + list.join(',') + ']', 'edit'); url.searchParams.set('returnUrl', Filelist.getReturnUrl(configuration.returnUrl || '')); ``` IMO this is rather counter-intuitive. -
core-ci voted on patch set 4 V +1 07/16/25, 14:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81782
-
Andreas Kienast commented on patch set 4 07/17/25, 06:49
url-factory.ts:40ReplyI can declare this to be `Record<string, string>`, which is fine for TS. However, to my understanding this does conflict with the check `typeof obj[currentValue] === 'object' && obj[currentValue] !== null` as this will never be the case, according to the types. What am I missing here? -
Benjamin Franzke uploaded patch set 5
V +107/17/25, 07:30 -
Benjamin Franzke commented on patch set 5 07/17/25, 07:30
url-factory.ts:40ReplyThe problem was that `accumulator[objPrefix + currentValue + objSuffix] = obj[currentValue];` actually assigned non-strings (like undefined or null or number) to the object, without casting to a string. I've reworked the code to type via the reducer generic and simplified a bit. -
core-ci voted on patch set 5 V +1 07/17/25, 07:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81808
-
Benjamin Franzke uploaded patch set 6
V +107/17/25, 08:15 -
Benjamin Franzke commented on patch set 6 07/17/25, 08:15
url-factory.ts:14This type does not reflect the nested object case that is used in the generator test… Can be verified by changing the test to ``` function* queryArgumentsDataProvider(): Generator<[string, URLSearchParamsFeedable, string]> { ``` -
core-ci voted on patch set 6 V +1 07/17/25, 08:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81819
-
Benjamin Franzke uploaded patch set 7
V +107/17/25, 09:03
-
Benjamin Franzke commented on patch set 7 07/17/25, 09:03
url-factory.ts:27Replyok, fine by me. -
core-ci voted on patch set 7 V +1 07/17/25, 09:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81824
-
Andreas Kienast uploaded patch set 8
V +107/17/25, 12:17 -
core-ci voted on patch set 8 V +1 07/17/25, 15:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81849
-
Simon Schaufelberger voted on patch set 8 CR +1 07/17/25, 15:32
-
Andreas Kienast uploaded patch set 9
CR +1V +107/18/25, 12:54 -
core-ci voted on patch set 9 V +1 07/18/25, 13:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81934
-
Andreas Nedbal voted on patch set 9 CR +1 V +1 07/18/25, 14:30
-
Simon Schaufelberger voted on patch set 9 CR +1 V +1 07/18/25, 15:23
-
Andreas Kienast commented on patch set 9 CR -1 07/21/25, 07:21
The code currently doesn't handle query argument _replacement_, which is rather hard to solve as the API doesn't know the user's intent. Examples: Input: `/typo3/record/edit?edit[pages][1290]=edit` Parameters: `{ edit: { pages: { 1280: 'foo' } } }` Result: `/typo3/record/edit?edit[pages][1290]=edit&edit[pages][1280]=foo` This one is arguably correct Input: `/typo3/record/edit?edit[pages][1290]=edit` Parameters: `{ edit: 'foo' }` Result: `/typo3/record/edit?edit[pages][1290]=edit&edit=foo` This one obviously bonkers. -
Benjamin Franzke commented on patch set 9 07/24/25, 14:40
url-factory.ts:35Btw, we already have similar API: ``` import { InputTransformer } from '@typo3/core/ajax/input-transformer'; InputTransformer.toSearchParams({foo: { bar: 'baz' }}) ``` Feels wrong to implement this multiple times. Should we deprecate `@typo3/core/ajax/input-transformer` (or at least base it on this implementation?) -
Andreas Kienast commented on patch set 9 07/24/25, 14:54
url-factory.ts:35ReplyI know, I built this API ;). When this patch is in, I'll happily rewrite parts of the AJAX implementation that removes the old code. -
Andreas Kienast commented on patch set 9 08/05/25, 12:02
Reply
This is pretty tough to handle right now as the URLSearchParams and FormData APIs are limited in that area. Needs to be handled later.url-factory.ts:35ReplyDone -
Andreas Kienast uploaded patch set 10
CR +1V +108/05/25, 12:07 -
core-ci voted on patch set 10 V +1 08/05/25, 12:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82804
-
Andreas Kienast rebased onto patch set 11
V +109/11/25, 07:53 -
core-ci voted on patch set 11 V +1 09/11/25, 08:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84821
-
Simon Schaufelberger voted on patch set 11 CR +1 V +1 09/11/25, 08:40
-
Benjamin Franzke commented on patch set 11 CR +1 V +1 09/12/25, 07:41
url-factory.ts:35ReplyOk, I would have preferred to see it replaced directly, but I try to respect that we work differently 😜 -
Andreas Kienast uploaded patch set 12
CR +1V +109/12/25, 07:46 -
Benjamin Franzke voted on patch set 12 CR +1 V +1 09/12/25, 07:46
-
core-ci voted on patch set 12 V +1 09/12/25, 07:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84886
-
Georg Ringer voted on patch set 12 CR +1 V +1 09/12/25, 09:07
-
Andreas Kienast voted on patch set 12 CR +2 V +2 09/12/25, 09:12
-
Andreas Kienast merged patch set 13 09/12/25, 09:12
url-factory.ts:27