@wordpress/abilities 0.23.0 → 0.25.0
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.
- package/build/api.cjs +176 -122
- package/build/api.cjs.map +1 -7
- package/build/index.cjs +73 -52
- package/build/store/actions.cjs +119 -187
- package/build/store/actions.cjs.map +1 -7
- package/build/store/constants.cjs +23 -47
- package/build/store/constants.cjs.map +1 -7
- package/build/store/index.cjs +36 -40
- package/build/store/index.cjs.map +1 -7
- package/build/store/reducer.cjs +102 -94
- package/build/store/reducer.cjs.map +1 -7
- package/build/store/selectors.cjs +49 -58
- package/build/store/selectors.cjs.map +1 -7
- package/build/store/types.cjs +4 -18
- package/build/types.cjs +4 -18
- package/build/validation.cjs +122 -137
- package/build/validation.cjs.map +1 -7
- package/build-module/api.mjs +161 -87
- package/build-module/api.mjs.map +1 -7
- package/build-module/index.mjs +2 -26
- package/build-module/store/actions.mjs +112 -167
- package/build-module/store/actions.mjs.map +1 -7
- package/build-module/store/constants.mjs +13 -17
- package/build-module/store/constants.mjs.map +1 -7
- package/build-module/store/index.mjs +11 -9
- package/build-module/store/index.mjs.map +1 -7
- package/build-module/store/reducer.mjs +97 -78
- package/build-module/store/reducer.mjs.map +1 -7
- package/build-module/store/selectors.mjs +42 -31
- package/build-module/store/selectors.mjs.map +1 -7
- package/build-module/store/types.mjs +0 -1
- package/build-module/types.mjs +0 -1
- package/build-module/validation.mjs +101 -109
- package/build-module/validation.mjs.map +1 -7
- package/build-types/index.d.ts +1 -1
- package/package.json +7 -8
- package/src/index.ts +1 -1
- package/CHANGELOG.md +0 -65
- package/build/index.cjs.map +0 -7
- package/build/store/types.cjs.map +0 -7
- package/build/types.cjs.map +0 -7
- package/build-module/index.mjs.map +0 -7
- package/build-module/store/types.mjs.map +0 -7
- package/build-module/types.mjs.map +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/abilities",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "JavaScript client for WordPress Abilities API.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -20,14 +20,13 @@
|
|
|
20
20
|
"url": "https://github.com/WordPress/gutenberg/issues"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
|
-
"node": ">=
|
|
23
|
+
"node": ">=22.13.0"
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"src",
|
|
27
27
|
"build",
|
|
28
28
|
"build-module",
|
|
29
|
-
"build-types"
|
|
30
|
-
"*.md"
|
|
29
|
+
"build-types"
|
|
31
30
|
],
|
|
32
31
|
"main": "build/index.cjs",
|
|
33
32
|
"module": "build-module/index.mjs",
|
|
@@ -44,14 +43,14 @@
|
|
|
44
43
|
},
|
|
45
44
|
"types": "build-types",
|
|
46
45
|
"dependencies": {
|
|
47
|
-
"@wordpress/data": "^
|
|
48
|
-
"@wordpress/i18n": "^
|
|
46
|
+
"@wordpress/data": "^11.1.0",
|
|
47
|
+
"@wordpress/i18n": "^7.1.0",
|
|
49
48
|
"ajv": "^8.20.0",
|
|
50
49
|
"ajv-draft-04": "^1.0.0",
|
|
51
50
|
"ajv-formats": "^3.0.1"
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
|
-
"vitest": "^5.0.
|
|
53
|
+
"vitest": "^5.0.5"
|
|
55
54
|
},
|
|
56
55
|
"peerDependencies": {
|
|
57
56
|
"@types/react": "^18 || ^19",
|
|
@@ -70,5 +69,5 @@
|
|
|
70
69
|
"publishConfig": {
|
|
71
70
|
"access": "public"
|
|
72
71
|
},
|
|
73
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "9b70363b9f93cff0583a1f3153738d383cf5a49e"
|
|
74
73
|
}
|
package/src/index.ts
CHANGED
package/CHANGELOG.md
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
<!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->
|
|
2
|
-
|
|
3
|
-
## Unreleased
|
|
4
|
-
|
|
5
|
-
## 0.23.0 (2026-10-07)
|
|
6
|
-
|
|
7
|
-
### Bug Fixes
|
|
8
|
-
|
|
9
|
-
- Declare `react`, `react-dom`, and their types as peer dependencies, forwarding the peers of `@wordpress/data`, so strict package managers such as Yarn PnP can resolve them ([#83765](https://github.com/WordPress/gutenberg/pull/83765)).
|
|
10
|
-
|
|
11
|
-
## 0.22.0 (2026-09-23)
|
|
12
|
-
|
|
13
|
-
## 0.21.0 (2026-09-10)
|
|
14
|
-
|
|
15
|
-
### Internal
|
|
16
|
-
|
|
17
|
-
- Remove tsconfig project references to packages that are not dependencies ([#82106](https://github.com/WordPress/gutenberg/pull/82106)).
|
|
18
|
-
|
|
19
|
-
## 0.20.0 (2026-08-26)
|
|
20
|
-
|
|
21
|
-
### Internal
|
|
22
|
-
|
|
23
|
-
- Split tsconfig into a build project and a default dev project so dev files are type checked without publishing their declarations. ([#81517](https://github.com/WordPress/gutenberg/pull/81517))
|
|
24
|
-
|
|
25
|
-
## 0.19.0 (2026-08-12)
|
|
26
|
-
|
|
27
|
-
## 0.18.0 (2026-07-29)
|
|
28
|
-
|
|
29
|
-
## 0.17.0 (2026-07-14)
|
|
30
|
-
|
|
31
|
-
## 0.16.0 (2026-07-01)
|
|
32
|
-
|
|
33
|
-
## 0.15.0 (2026-06-24)
|
|
34
|
-
|
|
35
|
-
## 0.14.1 (2026-06-16)
|
|
36
|
-
|
|
37
|
-
## 0.14.0 (2026-06-10)
|
|
38
|
-
|
|
39
|
-
## 0.13.0 (2026-05-27)
|
|
40
|
-
|
|
41
|
-
## 0.12.0 (2026-05-14)
|
|
42
|
-
|
|
43
|
-
## 0.11.0 (2026-04-29)
|
|
44
|
-
|
|
45
|
-
## 0.10.0 (2026-04-15)
|
|
46
|
-
|
|
47
|
-
## 0.9.0 (2026-04-01)
|
|
48
|
-
|
|
49
|
-
## 0.8.0 (2026-03-18)
|
|
50
|
-
|
|
51
|
-
## 0.7.0 (2026-03-04)
|
|
52
|
-
|
|
53
|
-
## 0.6.0 (2026-02-18)
|
|
54
|
-
|
|
55
|
-
## 0.5.0 (2026-01-29)
|
|
56
|
-
|
|
57
|
-
## 0.4.0 (2026-01-16)
|
|
58
|
-
|
|
59
|
-
## 0.2.0 (2025-11-26)
|
|
60
|
-
|
|
61
|
-
## 0.1.0 (Unreleased)
|
|
62
|
-
|
|
63
|
-
### New Features
|
|
64
|
-
|
|
65
|
-
- Initial release of the WordPress Abilities API client library.
|
package/build/index.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress Abilities API Client\n *\n * This package provides a client for interacting with the\n * WordPress Abilities API, allowing you to list, retrieve, and execute\n * abilities from client-side code.\n *\n * @package\n */\n\n/**\n * Public API functions\n */\nexport {\n\tgetAbilities,\n\tgetAbility,\n\tgetAbilityCategories,\n\tgetAbilityCategory,\n\texecuteAbility,\n\tregisterAbility,\n\tunregisterAbility,\n\tregisterAbilityCategory,\n\tunregisterAbilityCategory,\n} from './api';\n\n/**\n * The store can be used directly with @wordpress/data via selectors\n * in React components with useSelect.\n *\n * @example\n * ```js\n * import { useSelect } from '@wordpress/data';\n * import { store as abilitiesStore } from '@wordpress/abilities';\n *\n * function MyComponent() {\n * const abilities = useSelect(\n * (select) => select(abilitiesStore).getAbilities(),\n * []\n * );\n * // Use abilities...\n * }\n * ```\n */\nexport { store } from './store';\n\n/**\n * Type definitions\n */\nexport type {\n\tAbility,\n\tAbilityCategory,\n\tAbilityCategoryArgs,\n\tAbilitiesQueryArgs,\n\tAbilityCallback,\n\tPermissionCallback,\n\tAbilityInput,\n\tAbilityOutput,\n\tValidationError,\n} from './types';\n\n/**\n * Validation utilities\n */\nexport { validateValueFromSchema } from './validation';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaA,iBAUO;AAoBP,mBAAsB;AAoBtB,wBAAwC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/store/types.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Ability, AbilityCategory } from '../types';\n\n/**\n * The state shape for the abilities store.\n */\nexport interface AbilitiesState {\n\t/**\n\t * Map of ability names to ability objects.\n\t */\n\tabilitiesByName: Record< string, Ability >;\n\n\t/**\n\t * Map of category slugs to category objects.\n\t */\n\tcategoriesBySlug: Record< string, AbilityCategory >;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/build/types.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress Abilities API Types\n */\n\n/**\n * Callback function for client-side abilities.\n */\nexport type AbilityCallback = (\n\tinput: AbilityInput\n) => AbilityOutput | Promise< AbilityOutput >;\n\n/**\n * Permission callback function for client-side abilities.\n * Returns true if the ability can be executed, false otherwise.\n */\nexport type PermissionCallback = (\n\tinput?: AbilityInput\n) => boolean | Promise< boolean >;\n\n/**\n * Represents an ability in the WordPress Abilities API.\n *\n * @see WP_Ability\n */\nexport interface Ability {\n\t/**\n\t * The unique name/identifier of the ability, with its namespace.\n\t * Supports 2-4 segments (e.g. 'my-plugin/my-ability', 'core/posts/find', 'my-plugin/resource/sub/action').\n\t * @see WP_Ability::get_name()\n\t */\n\tname: string;\n\n\t/**\n\t * The human-readable label for the ability.\n\t * @see WP_Ability::get_label()\n\t */\n\tlabel: string;\n\n\t/**\n\t * The detailed description of the ability.\n\t * @see WP_Ability::get_description()\n\t */\n\tdescription: string;\n\n\t/**\n\t * The category this ability belongs to.\n\t * Must be a valid category slug (lowercase alphanumeric with dashes).\n\t * Example: 'data-retrieval', 'user-management'\n\t * @see WP_Ability::get_category()\n\t */\n\tcategory: string;\n\n\t/**\n\t * JSON Schema for the ability's input parameters.\n\t * @see WP_Ability::get_input_schema()\n\t */\n\tinput_schema?: Record< string, any >;\n\n\t/**\n\t * JSON Schema for the ability's output format.\n\t * @see WP_Ability::get_output_schema()\n\t */\n\toutput_schema?: Record< string, any >;\n\n\t/**\n\t * Callback function for ability execution.\n\t * This property is required for all abilities.\n\t */\n\tcallback?: AbilityCallback;\n\n\t/**\n\t * Permission callback for abilities.\n\t * Called before executing the ability to check if it's allowed.\n\t * If it returns false, the ability execution will be denied.\n\t */\n\tpermissionCallback?: PermissionCallback;\n\n\t/**\n\t * Metadata about the ability.\n\t */\n\tmeta?: {\n\t\tannotations?: {\n\t\t\tclientRegistered?: boolean;\n\t\t\tserverRegistered?: boolean;\n\t\t\treadonly?: boolean;\n\t\t\tdestructive?: boolean;\n\t\t\tidempotent?: boolean;\n\t\t};\n\t\t[ key: string ]: any;\n\t};\n}\n\n/**\n * The shape of the arguments for querying abilities.\n */\nexport interface AbilitiesQueryArgs {\n\t/**\n\t * Optional category slug to filter abilities.\n\t */\n\tcategory?: string;\n}\n\n/**\n * Represents an ability category in the WordPress Abilities API.\n *\n * @see WP_Ability_Category\n */\nexport interface AbilityCategory {\n\t/**\n\t * The unique slug identifier for the category.\n\t * Must be lowercase alphanumeric with dashes only.\n\t * Example: 'data-retrieval', 'user-management'\n\t * @see WP_Ability_Category::get_slug()\n\t */\n\tslug: string;\n\n\t/**\n\t * The human-readable label for the category.\n\t * @see WP_Ability_Category::get_label()\n\t */\n\tlabel: string;\n\n\t/**\n\t * The detailed description of the category.\n\t * @see WP_Ability_Category::get_description()\n\t */\n\tdescription: string;\n\n\t/**\n\t * Metadata about the category.\n\t */\n\tmeta?: {\n\t\tannotations?: {\n\t\t\tclientRegistered?: boolean;\n\t\t\tserverRegistered?: boolean;\n\t\t};\n\t\t[ key: string ]: any;\n\t};\n}\n\n/**\n * Arguments for registering an ability category.\n * Matches the server-side wp_register_ability_category() $args parameter.\n *\n * @see wp_register_ability_category()\n */\nexport interface AbilityCategoryArgs {\n\t/**\n\t * The human-readable label for the category.\n\t */\n\tlabel: string;\n\n\t/**\n\t * The detailed description of the category.\n\t */\n\tdescription: string;\n\n\t/**\n\t * Optional metadata about the category.\n\t */\n\tmeta?: Record< string, any >;\n}\n\n/**\n * Input parameters for ability execution.\n * Can be any JSON-serializable value: primitive, array, object, or null.\n */\nexport type AbilityInput = any;\n\n/**\n * Result from ability execution.\n * The actual shape depends on the ability's output schema.\n */\nexport type AbilityOutput = any;\n\n/**\n * Validation error - just a message string.\n * The Abilities API wraps this with the appropriate error code.\n */\nexport type ValidationError = string;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress Abilities API Client\n *\n * This package provides a client for interacting with the\n * WordPress Abilities API, allowing you to list, retrieve, and execute\n * abilities from client-side code.\n *\n * @package\n */\n\n/**\n * Public API functions\n */\nexport {\n\tgetAbilities,\n\tgetAbility,\n\tgetAbilityCategories,\n\tgetAbilityCategory,\n\texecuteAbility,\n\tregisterAbility,\n\tunregisterAbility,\n\tregisterAbilityCategory,\n\tunregisterAbilityCategory,\n} from './api';\n\n/**\n * The store can be used directly with @wordpress/data via selectors\n * in React components with useSelect.\n *\n * @example\n * ```js\n * import { useSelect } from '@wordpress/data';\n * import { store as abilitiesStore } from '@wordpress/abilities';\n *\n * function MyComponent() {\n * const abilities = useSelect(\n * (select) => select(abilitiesStore).getAbilities(),\n * []\n * );\n * // Use abilities...\n * }\n * ```\n */\nexport { store } from './store';\n\n/**\n * Type definitions\n */\nexport type {\n\tAbility,\n\tAbilityCategory,\n\tAbilityCategoryArgs,\n\tAbilitiesQueryArgs,\n\tAbilityCallback,\n\tPermissionCallback,\n\tAbilityInput,\n\tAbilityOutput,\n\tValidationError,\n} from './types';\n\n/**\n * Validation utilities\n */\nexport { validateValueFromSchema } from './validation';\n"],
|
|
5
|
-
"mappings": ";AAaA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAoBP,SAAS,aAAa;AAoBtB,SAAS,+BAA+B;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|