Skip to content
This repository was archived by the owner on Mar 1, 2026. It is now read-only.

Commit 2b09acb

Browse files
committed
chore: cleanup
1 parent 206a296 commit 2b09acb

10 files changed

Lines changed: 30 additions & 125 deletions

File tree

packages/clients/tanstack-query/src/react.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,6 @@ export type ProcedureHooks<Schema extends SchemaDef> = Schema extends { procedur
195195
* Preferred procedures API.
196196
*/
197197
$procs: ProcedureHookGroup<Schema>;
198-
199-
/**
200-
* Backward-compatible procedures API.
201-
*/
202-
$procedures: ProcedureHookGroup<Schema>;
203198
}
204199
: {};
205200

@@ -345,7 +340,7 @@ export function useClientQueries<Schema extends SchemaDef, Options extends Query
345340

346341
const procedures = (schema as any).procedures as Record<string, { mutation?: boolean }> | undefined;
347342
if (procedures) {
348-
const buildProcedureHooks = (endpointModel: '$procs' | '$procedures') => {
343+
const buildProcedureHooks = (endpointModel: '$procs') => {
349344
return Object.keys(procedures).reduce((acc, name) => {
350345
const procDef = procedures[name];
351346
if (procDef?.mutation) {
@@ -379,15 +374,14 @@ export function useClientQueries<Schema extends SchemaDef, Options extends Query
379374
};
380375

381376
(result as any).$procs = buildProcedureHooks('$procs');
382-
(result as any).$procedures = buildProcedureHooks('$procedures');
383377
}
384378

385379
return result;
386380
}
387381

388382
export function useInternalProcedureQuery<TQueryFnData, TData>(
389383
_schema: SchemaDef,
390-
endpointModel: '$procs' | '$procedures',
384+
endpointModel: '$procs',
391385
procedure: string,
392386
args?: unknown,
393387
options?: Omit<UseQueryOptions<TQueryFnData, DefaultError, TData>, 'queryKey'> & ExtraQueryOptions,
@@ -410,7 +404,7 @@ export function useInternalProcedureQuery<TQueryFnData, TData>(
410404

411405
export function useInternalProcedureSuspenseQuery<TQueryFnData, TData>(
412406
_schema: SchemaDef,
413-
endpointModel: '$procs' | '$procedures',
407+
endpointModel: '$procs',
414408
procedure: string,
415409
args?: unknown,
416410
options?: Omit<UseSuspenseQueryOptions<TQueryFnData, DefaultError, TData>, 'queryKey'> & ExtraQueryOptions,
@@ -433,7 +427,7 @@ export function useInternalProcedureSuspenseQuery<TQueryFnData, TData>(
433427

434428
export function useInternalProcedureInfiniteQuery<TQueryFnData, TData>(
435429
schema: SchemaDef,
436-
endpointModel: '$procs' | '$procedures',
430+
endpointModel: '$procs',
437431
procedure: string,
438432
args: unknown,
439433
options:
@@ -449,7 +443,7 @@ export function useInternalProcedureInfiniteQuery<TQueryFnData, TData>(
449443

450444
export function useInternalProcedureSuspenseInfiniteQuery<TQueryFnData, TData>(
451445
schema: SchemaDef,
452-
endpointModel: '$procs' | '$procedures',
446+
endpointModel: '$procs',
453447
procedure: string,
454448
args: unknown,
455449
options: Omit<
@@ -462,7 +456,7 @@ export function useInternalProcedureSuspenseInfiniteQuery<TQueryFnData, TData>(
462456

463457
export function useInternalProcedureMutation<TArgs, R = any>(
464458
_schema: SchemaDef,
465-
endpointModel: '$procs' | '$procedures',
459+
endpointModel: '$procs',
466460
procedure: string,
467461
options?: Omit<UseMutationOptions<R, DefaultError, TArgs>, 'mutationFn'> & QueryContext,
468462
) {

packages/clients/tanstack-query/src/svelte/index.svelte.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,6 @@ export type ProcedureHooks<Schema extends SchemaDef> = Schema extends { procedur
174174
* Preferred procedures API.
175175
*/
176176
$procs: ProcedureHookGroup<Schema>;
177-
178-
/**
179-
* Backward-compatible procedures API.
180-
*/
181-
$procedures: ProcedureHookGroup<Schema>;
182177
}
183178
: {};
184179

@@ -292,7 +287,7 @@ export function useClientQueries<Schema extends SchemaDef, Options extends Query
292287

293288
const procedures = (schema as any).procedures as Record<string, { mutation?: boolean }> | undefined;
294289
if (procedures) {
295-
const buildProcedureHooks = (endpointModel: '$procs' | '$procedures') => {
290+
const buildProcedureHooks = (endpointModel: '$procs') => {
296291
return Object.keys(procedures).reduce((acc, name) => {
297292
const procDef = procedures[name];
298293
if (procDef?.mutation) {
@@ -313,15 +308,14 @@ export function useClientQueries<Schema extends SchemaDef, Options extends Query
313308
};
314309

315310
(result as any).$procs = buildProcedureHooks('$procs');
316-
(result as any).$procedures = buildProcedureHooks('$procedures');
317311
}
318312

319313
return result;
320314
}
321315

322316
export function useInternalProcedureQuery<TQueryFnData, TData>(
323317
schema: SchemaDef,
324-
endpointModel: '$procs' | '$procedures',
318+
endpointModel: '$procs',
325319
procedure: string,
326320
args?: Accessor<unknown>,
327321
options?: Accessor<Omit<CreateQueryOptions<TQueryFnData, DefaultError, TData>, 'queryKey'> & ExtraQueryOptions>,
@@ -331,7 +325,7 @@ export function useInternalProcedureQuery<TQueryFnData, TData>(
331325

332326
export function useInternalProcedureInfiniteQuery<TQueryFnData, TData>(
333327
schema: SchemaDef,
334-
endpointModel: '$procs' | '$procedures',
328+
endpointModel: '$procs',
335329
procedure: string,
336330
args: Accessor<unknown>,
337331
options?: Accessor<
@@ -344,7 +338,7 @@ export function useInternalProcedureInfiniteQuery<TQueryFnData, TData>(
344338

345339
export function useInternalProcedureMutation<TArgs, R = any>(
346340
_schema: SchemaDef,
347-
endpointModel: '$procs' | '$procedures',
341+
endpointModel: '$procs',
348342
procedure: string,
349343
options?: Accessor<Omit<CreateMutationOptions<R, DefaultError, TArgs>, 'mutationFn'> & QueryContext>,
350344
) {

packages/clients/tanstack-query/src/vue.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,6 @@ export type ProcedureHooks<Schema extends SchemaDef> = Schema extends { procedur
184184
* Preferred procedures API.
185185
*/
186186
$procs: ProcedureHookGroup<Schema>;
187-
188-
/**
189-
* Backward-compatible procedures API.
190-
*/
191-
$procedures: ProcedureHookGroup<Schema>;
192187
}
193188
: {};
194189

@@ -304,7 +299,7 @@ export function useClientQueries<Schema extends SchemaDef, Options extends Query
304299

305300
const procedures = (schema as any).procedures as Record<string, { mutation?: boolean }> | undefined;
306301
if (procedures) {
307-
const buildProcedureHooks = (endpointModel: '$procs' | '$procedures') => {
302+
const buildProcedureHooks = (endpointModel: '$procs') => {
308303
return Object.keys(procedures).reduce((acc, name) => {
309304
const procDef = procedures[name];
310305
if (procDef?.mutation) {
@@ -331,15 +326,14 @@ export function useClientQueries<Schema extends SchemaDef, Options extends Query
331326
};
332327

333328
(result as any).$procs = buildProcedureHooks('$procs');
334-
(result as any).$procedures = buildProcedureHooks('$procedures');
335329
}
336330

337331
return result;
338332
}
339333

340334
export function useInternalProcedureQuery<TQueryFnData, TData>(
341335
schema: SchemaDef,
342-
endpointModel: '$procs' | '$procedures',
336+
endpointModel: '$procs',
343337
procedure: string,
344338
args?: MaybeRefOrGetter<unknown>,
345339
options?: MaybeRefOrGetter<
@@ -351,7 +345,7 @@ export function useInternalProcedureQuery<TQueryFnData, TData>(
351345

352346
export function useInternalProcedureInfiniteQuery<TQueryFnData, TData>(
353347
schema: SchemaDef,
354-
endpointModel: '$procs' | '$procedures',
348+
endpointModel: '$procs',
355349
procedure: string,
356350
args: MaybeRefOrGetter<unknown>,
357351
options?: MaybeRefOrGetter<
@@ -367,7 +361,7 @@ export function useInternalProcedureInfiniteQuery<TQueryFnData, TData>(
367361

368362
export function useInternalProcedureMutation<TArgs, R = any>(
369363
_schema: SchemaDef,
370-
endpointModel: '$procs' | '$procedures',
364+
endpointModel: '$procs',
371365
procedure: string,
372366
options?: MaybeRefOrGetter<Omit<UnwrapRef<UseMutationOptions<R, DefaultError, TArgs>>, 'mutationFn'> & QueryContext>,
373367
) {

packages/language/src/validators/procedure-validator.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { validateAttributeApplication } from './attribute-application-validator'
44
import type { AstValidator } from './common';
55

66
const RESERVED_PROCEDURE_NAMES = new Set([
7-
// avoid prototype pollution / surprising JS behavior
87
'__proto__',
98
'prototype',
109
'constructor',

packages/orm/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"build": "tsc --noEmit && tsup-node",
88
"watch": "tsup-node --watch",
99
"lint": "eslint src --ext ts",
10-
"test": "vitest run",
1110
"pack": "pnpm pack"
1211
},
1312
"keywords": [],

packages/server/src/api/rest/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,7 @@ export class RestApiHandler<Schema extends SchemaDef = SchemaDef> implements Api
343343
}
344344

345345
try {
346-
// Custom procedures escape hatch
347-
if (path.startsWith('/$procedures/') || path.startsWith('/$procs/')) {
346+
if (path.startsWith('/$procs/')) {
348347
const proc = path.split('/')[2];
349348
return await this.processProcedureRequest({ client, method, proc, query, requestBody });
350349
}

packages/server/src/api/rpc/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ export class RPCApiHandler<Schema extends SchemaDef = SchemaDef> implements ApiH
5353
return this.makeBadInputErrorResponse('invalid request path');
5454
}
5555

56-
// Special path: /$procedures/<name> or /$procs/<name>
57-
if (model === '$procedures' || model === '$procs') {
56+
if (model === '$procs') {
5857
return this.handleProcedureRequest({
5958
client,
6059
method: method.toUpperCase(),

packages/server/test/api/procedures.e2e.test.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,14 @@ mutation procedure createTwoAndFail(email1: String, email2: String): Int
4747
});
4848

4949
it('supports $procs and $procedures routes', async () => {
50-
const r1 = await api.handleRequest({
50+
const r = await api.handleRequest({
5151
client,
5252
method: 'get',
5353
path: '/$procs/greet',
5454
query: { q: JSON.stringify('alice') },
5555
});
56-
expect(r1.status).toBe(200);
57-
expect(r1.body).toEqual({ data: 'hello alice' });
58-
59-
const r2 = await api.handleRequest({
60-
client,
61-
method: 'get',
62-
path: '/$procedures/greet',
63-
query: { q: JSON.stringify('bob') },
64-
});
65-
expect(r2.status).toBe(200);
66-
expect(r2.body).toEqual({ data: 'hello bob' });
56+
expect(r.status).toBe(200);
57+
expect(r.body).toEqual({ data: 'hello alice' });
6758
});
6859

6960
it('returns 422 for invalid input', async () => {

packages/server/test/api/rest.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3218,7 +3218,7 @@ mutation procedure sum(a: Int, b: Int): Int
32183218
const { json, meta } = SuperJSON.serialize(new Decimal('1.23'));
32193219
const r = await handler({
32203220
method: 'get',
3221-
path: '/$procedures/echoDecimal',
3221+
path: '/$procs/echoDecimal',
32223222
query: {
32233223
q: JSON.stringify(json),
32243224
meta: JSON.stringify({ serialization: meta }),
@@ -3234,7 +3234,7 @@ mutation procedure sum(a: Int, b: Int): Int
32343234
it('supports GET procedures without args when param is optional', async () => {
32353235
const r = await handler({
32363236
method: 'get',
3237-
path: '/$procedures/greet',
3237+
path: '/$procs/greet',
32383238
query: {},
32393239
client,
32403240
});
@@ -3246,7 +3246,7 @@ mutation procedure sum(a: Int, b: Int): Int
32463246
it('errors for missing required single-param arg', async () => {
32473247
const r = await handler({
32483248
method: 'get',
3249-
path: '/$procedures/echoInt',
3249+
path: '/$procs/echoInt',
32503250
query: {},
32513251
client,
32523252
});
@@ -3266,7 +3266,7 @@ mutation procedure sum(a: Int, b: Int): Int
32663266
it('supports GET procedures without args when all params are optional', async () => {
32673267
const r = await handler({
32683268
method: 'get',
3269-
path: '/$procedures/opt2',
3269+
path: '/$procs/opt2',
32703270
query: {},
32713271
client,
32723272
});
@@ -3278,7 +3278,7 @@ mutation procedure sum(a: Int, b: Int): Int
32783278
it('supports array-typed single param via q JSON array', async () => {
32793279
const r = await handler({
32803280
method: 'get',
3281-
path: '/$procedures/sumIds',
3281+
path: '/$procs/sumIds',
32823282
query: { q: JSON.stringify([1, 2, 3]) },
32833283
client,
32843284
});
@@ -3290,7 +3290,7 @@ mutation procedure sum(a: Int, b: Int): Int
32903290
it('supports enum-typed params with validation', async () => {
32913291
const r = await handler({
32923292
method: 'get',
3293-
path: '/$procedures/echoRole',
3293+
path: '/$procs/echoRole',
32943294
query: { q: JSON.stringify('ADMIN') },
32953295
client,
32963296
});
@@ -3302,7 +3302,7 @@ mutation procedure sum(a: Int, b: Int): Int
33023302
it('supports typedef params (object payload)', async () => {
33033303
const r = await handler({
33043304
method: 'get',
3305-
path: '/$procedures/echoOverview',
3305+
path: '/$procs/echoOverview',
33063306
query: { q: JSON.stringify({ total: 123 }) },
33073307
client,
33083308
});
@@ -3314,7 +3314,7 @@ mutation procedure sum(a: Int, b: Int): Int
33143314
it('errors for wrong type input', async () => {
33153315
const r = await handler({
33163316
method: 'get',
3317-
path: '/$procedures/echoInt',
3317+
path: '/$procs/echoInt',
33183318
query: { q: JSON.stringify('not-an-int') },
33193319
client,
33203320
});
@@ -3335,7 +3335,7 @@ mutation procedure sum(a: Int, b: Int): Int
33353335
const { json, meta } = SuperJSON.serialize({ a: 1, b: 2 });
33363336
const r = await handler({
33373337
method: 'post',
3338-
path: '/$procedures/sum',
3338+
path: '/$procs/sum',
33393339
query: {
33403340
q: JSON.stringify(json),
33413341
meta: JSON.stringify({ serialization: meta }),
@@ -3350,7 +3350,7 @@ mutation procedure sum(a: Int, b: Int): Int
33503350
it('errors for too many args (positional array)', async () => {
33513351
const r = await handler({
33523352
method: 'post',
3353-
path: '/$procedures/sum',
3353+
path: '/$procs/sum',
33543354
query: { q: JSON.stringify([1, 2, 3]) },
33553355
client,
33563356
});
@@ -3370,7 +3370,7 @@ mutation procedure sum(a: Int, b: Int): Int
33703370
it('errors for unknown argument keys (object mapping)', async () => {
33713371
const r = await handler({
33723372
method: 'post',
3373-
path: '/$procedures/sum',
3373+
path: '/$procs/sum',
33743374
query: { q: JSON.stringify({ a: 1, b: 2, c: 3 }) },
33753375
client,
33763376
});

0 commit comments

Comments
 (0)