chore: Adds createServiceMethodFactory + transfer.tunnel.next.*#753
chore: Adds createServiceMethodFactory + transfer.tunnel.next.*#753jbottigliero wants to merge 15 commits intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #753 +/- ##
==========================================
+ Coverage 95.25% 95.35% +0.09%
==========================================
Files 84 85 +1
Lines 1561 1592 +31
Branches 248 258 +10
==========================================
+ Hits 1487 1518 +31
Misses 73 73
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
…gurations with 'scope' member
| describe('Typescript Types', () => { | ||
| /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/naming-convention */ | ||
| /** | ||
| * Compile-time type equality check. | ||
| * If the two type arguments are not identical the assignment will fail to compile. | ||
| */ | ||
| type Expect<T extends true> = T; | ||
| type Equal<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false; | ||
| test('method with segments requires all segments', async () => { |
There was a problem hiding this comment.
This is wild, I've never seen a "type" test like this. Still trying to parse it
There was a problem hiding this comment.
The generic constraints are just used to see if the two passed in values extend each other (returning true | false) then the wrapped Expect is just looking for true.
It probably won't work for all types, and could very likely be tricked based on type inheritance, but seemed like a decent gut check.
I think we'll eventually move this to Vitest and use https://vitest.dev/guide/testing-types.html (https://github.com/mmkal/expect-type)
This pull request only introduces the new signatures under the
nextnamespace for Tunnels (e.g.,transfer.tunnel.next.getAll())This will allow us to pilot the new signatures (for use in
@globus/react-query) before moving forward.Use a single type for all service methods, enforced by a factory method.
New Call Signature
All service methods now take a single parameter (
ServiceMethodPayload); There are no more positional arguments for path segments.Method without Segments
Method with Segments