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

Commit 0a511e0

Browse files
committed
Update client to use new REST API urls
1 parent 5392975 commit 0a511e0

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

packages/client/src/__tests__/api.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ describe( 'API functions', () => {
228228
'test/server-ability'
229229
);
230230
expect( apiFetch ).toHaveBeenCalledWith( {
231-
path: '/wp/v2/abilities/test/server-ability/run',
231+
path: '/wp-abilities/v1/abilities/test/server-ability/run',
232232
method: 'POST',
233233
data: { input },
234234
} );
@@ -337,7 +337,7 @@ describe( 'API functions', () => {
337337
const result = await executeAbility( 'test/read-only', input );
338338

339339
expect( apiFetch ).toHaveBeenCalledWith( {
340-
path: '/wp/v2/abilities/test/read-only/run?input%5Bid%5D=123&input%5Bformat%5D=json',
340+
path: '/wp-abilities/v1/abilities/test/read-only/run?input%5Bid%5D=123&input%5Bformat%5D=json',
341341
method: 'GET',
342342
} );
343343
expect( result ).toEqual( mockResponse );
@@ -369,7 +369,7 @@ describe( 'API functions', () => {
369369
const result = await executeAbility( 'test/read-only', {} );
370370

371371
expect( apiFetch ).toHaveBeenCalledWith( {
372-
path: '/wp/v2/abilities/test/read-only/run?',
372+
path: '/wp-abilities/v1/abilities/test/read-only/run?',
373373
method: 'GET',
374374
} );
375375
expect( result ).toEqual( mockResponse );
@@ -469,7 +469,7 @@ describe( 'API functions', () => {
469469
} );
470470

471471
expect( apiFetch ).toHaveBeenCalledWith( {
472-
path: '/wp/v2/abilities/test/ability/run',
472+
path: '/wp-abilities/v1/abilities/test/ability/run',
473473
method: 'POST',
474474
data: { input: { data: 'test' } },
475475
} );

packages/client/src/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ async function executeServerAbility(
275275
): Promise< AbilityOutput > {
276276
const method = !! ability.meta?.annotations?.readonly ? 'GET' : 'POST';
277277

278-
let path = `/wp/v2/abilities/${ ability.name }/run`;
278+
let path = `/wp-abilities/v1/abilities/${ ability.name }/run`;
279279
const options: {
280280
method: string;
281281
data?: { input: AbilityInput };

packages/client/src/store/__tests__/reducer.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ describe( 'Store Reducer', () => {
6767
label: 'Test Ability',
6868
description: 'Test ability with links',
6969
_links: {
70-
self: { href: '/wp/v2/abilities/test/ability' },
71-
collection: { href: '/wp/v2/abilities' },
70+
self: { href: '/wp-abilities/v1/abilities/test/ability' },
71+
collection: { href: '/wp-abilities/v1/abilities' },
7272
},
7373
},
7474
];
@@ -444,10 +444,10 @@ describe( 'Store Reducer', () => {
444444
description: 'Test category with links',
445445
_links: {
446446
self: {
447-
href: '/wp/v2/abilities/categories/data-retrieval',
447+
href: '/wp-abilities/v1/categories/data-retrieval',
448448
},
449449
collection: {
450-
href: '/wp/v2/abilities/categories',
450+
href: '/wp-abilities/v1/categories',
451451
},
452452
},
453453
},

packages/client/src/store/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dispatch( coreStore ).addEntities( [
3636
name: ENTITY_NAME,
3737
kind: ENTITY_KIND,
3838
key: 'name',
39-
baseURL: '/wp/v2/abilities',
39+
baseURL: '/wp-abilities/v1/abilities',
4040
baseURLParams: { context: 'edit' },
4141
plural: 'abilities',
4242
label: __( 'Abilities' ),
@@ -46,7 +46,7 @@ dispatch( coreStore ).addEntities( [
4646
name: ENTITY_NAME_CATEGORIES,
4747
kind: ENTITY_KIND,
4848
key: 'slug',
49-
baseURL: '/wp/v2/abilities/categories',
49+
baseURL: '/wp-abilities/v1/categories',
5050
baseURLParams: { context: 'edit' },
5151
plural: 'ability-categories',
5252
label: __( 'Ability Categories' ),

packages/client/src/types.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,9 @@ export interface Ability {
8282
*/
8383
meta?: {
8484
annotations?: {
85-
instructions?: string;
86-
readonly?: boolean;
87-
destructive?: boolean;
88-
idempotent?: boolean;
85+
readonly?: boolean | null;
86+
destructive?: boolean | null;
87+
idempotent?: boolean | null;
8988
};
9089
[ key: string ]: any;
9190
};

0 commit comments

Comments
 (0)