@wordpress/data-controls 4.33.1 → 4.34.1-next.2f1c7c01b.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/CHANGELOG.md +2 -0
- package/build/index.js +4 -2
- package/build/index.js.map +1 -1
- package/build-module/index.js +3 -2
- package/build-module/index.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
package/build/index.js
CHANGED
|
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/data-controls/src/index.ts
|
|
29
31
|
var index_exports = {};
|
|
30
32
|
__export(index_exports, {
|
|
31
33
|
__unstableAwaitPromise: () => __unstableAwaitPromise,
|
|
@@ -70,13 +72,13 @@ function dispatch(storeNameOrDescriptor, actionName, ...args) {
|
|
|
70
72
|
});
|
|
71
73
|
return import_data.controls.dispatch(storeNameOrDescriptor, actionName, ...args);
|
|
72
74
|
}
|
|
73
|
-
|
|
75
|
+
var __unstableAwaitPromise = function(promise) {
|
|
74
76
|
return {
|
|
75
77
|
type: "AWAIT_PROMISE",
|
|
76
78
|
promise
|
|
77
79
|
};
|
|
78
80
|
};
|
|
79
|
-
|
|
81
|
+
var controls = {
|
|
80
82
|
AWAIT_PROMISE({ promise }) {
|
|
81
83
|
return promise;
|
|
82
84
|
},
|
package/build/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport triggerFetch from '@wordpress/api-fetch';\nimport { controls as dataControls } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport type { StoreDescriptor } from '@wordpress/data';\nimport type { APIFetchOptions } from '@wordpress/api-fetch';\n\n/**\n * Dispatches a control action for triggering an api fetch call.\n *\n * @param {Object} request Arguments for the fetch request.\n *\n * @example\n * ```js\n * import { apiFetch } from '@wordpress/data-controls';\n *\n * // Action generator using apiFetch\n * export function* myAction() {\n * \tconst path = '/v2/my-api/items';\n * \tconst items = yield apiFetch( { path } );\n * \t// do something with the items.\n * }\n * ```\n *\n * @return {Object} The control descriptor.\n */\nexport function apiFetch( request: APIFetchOptions ) {\n\treturn {\n\t\ttype: 'API_FETCH',\n\t\trequest,\n\t};\n}\n\n/**\n * Control for resolving a selector in a registered data store.\n * Alias for the `resolveSelect` built-in control in the `@wordpress/data` package.\n *\n * @param storeNameOrDescriptor The store object or identifier.\n * @param selectorName The selector name.\n * @param args Arguments passed without change to the `@wordpress/data` control.\n */\nexport function select(\n\tstoreNameOrDescriptor: string | StoreDescriptor,\n\tselectorName: string,\n\t...args: any[]\n) {\n\tdeprecated( '`select` control in `@wordpress/data-controls`', {\n\t\tsince: '5.7',\n\t\talternative: 'built-in `resolveSelect` control in `@wordpress/data`',\n\t} );\n\n\treturn dataControls.resolveSelect(\n\t\tstoreNameOrDescriptor,\n\t\tselectorName,\n\t\t...args\n\t);\n}\n\n/**\n * Control for calling a selector in a registered data store.\n * Alias for the `select` built-in control in the `@wordpress/data` package.\n *\n * @param storeNameOrDescriptor The store object or identifier.\n * @param selectorName The selector name.\n * @param args Arguments passed without change to the `@wordpress/data` control.\n */\nexport function syncSelect(\n\tstoreNameOrDescriptor: string | StoreDescriptor,\n\tselectorName: string,\n\t...args: any[]\n) {\n\tdeprecated( '`syncSelect` control in `@wordpress/data-controls`', {\n\t\tsince: '5.7',\n\t\talternative: 'built-in `select` control in `@wordpress/data`',\n\t} );\n\n\treturn dataControls.select( storeNameOrDescriptor, selectorName, ...args );\n}\n\n/**\n * Control for dispatching an action in a registered data store.\n * Alias for the `dispatch` control in the `@wordpress/data` package.\n *\n * @param storeNameOrDescriptor The store object or identifier.\n * @param actionName The action name.\n * @param args Arguments passed without change to the `@wordpress/data` control.\n */\nexport function dispatch(\n\tstoreNameOrDescriptor: string | StoreDescriptor,\n\tactionName: string,\n\t...args: any[]\n) {\n\tdeprecated( '`dispatch` control in `@wordpress/data-controls`', {\n\t\tsince: '5.7',\n\t\talternative: 'built-in `dispatch` control in `@wordpress/data`',\n\t} );\n\n\treturn dataControls.dispatch( storeNameOrDescriptor, actionName, ...args );\n}\n\n/**\n * Dispatches a control action for awaiting on a promise to be resolved.\n *\n * @param {Object} promise Promise to wait for.\n *\n * @example\n * ```js\n * import { __unstableAwaitPromise } from '@wordpress/data-controls';\n *\n * // Action generator using apiFetch\n * export function* myAction() {\n * \tconst promise = getItemsAsync();\n * \tconst items = yield __unstableAwaitPromise( promise );\n * \t// do something with the items.\n * }\n * ```\n *\n * @return {Object} The control descriptor.\n */\nexport const __unstableAwaitPromise = function < T >( promise: Promise< T > ) {\n\treturn {\n\t\ttype: 'AWAIT_PROMISE',\n\t\tpromise,\n\t};\n};\n\n/**\n * The default export is what you use to register the controls with your custom\n * store.\n *\n * @example\n * ```js\n * // WordPress dependencies\n * import { controls } from '@wordpress/data-controls';\n * import { registerStore } from '@wordpress/data';\n *\n * // Internal dependencies\n * import reducer from './reducer';\n * import * as selectors from './selectors';\n * import * as actions from './actions';\n * import * as resolvers from './resolvers';\n *\n * registerStore( 'my-custom-store', {\n * reducer,\n * controls,\n * actions,\n * selectors,\n * resolvers,\n * } );\n * ```\n * @return {Object} An object for registering the default controls with the\n * store.\n */\nexport const controls = {\n\tAWAIT_PROMISE< T >( { promise }: { promise: Promise< T > } ) {\n\t\treturn promise;\n\t},\n\tAPI_FETCH( { request }: { request: APIFetchOptions } ) {\n\t\treturn triggerFetch( request );\n\t},\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAyB;AACzB,kBAAyC;AACzC,wBAAuB;AAuBhB,SAAS,SAAU,SAA2B;AACpD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAUO,SAAS,OACf,uBACA,iBACG,MACF;AACD,wBAAAA,SAAY,kDAAkD;AAAA,IAC7D,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAE;AAEF,SAAO,YAAAC,SAAa;AAAA,IACnB;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACJ;AACD;AAUO,SAAS,WACf,uBACA,iBACG,MACF;AACD,wBAAAD,SAAY,sDAAsD;AAAA,IACjE,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAE;AAEF,SAAO,YAAAC,SAAa,OAAQ,uBAAuB,cAAc,GAAG,IAAK;AAC1E;AAUO,SAAS,SACf,uBACA,eACG,MACF;AACD,wBAAAD,SAAY,oDAAoD;AAAA,IAC/D,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAE;AAEF,SAAO,YAAAC,SAAa,SAAU,uBAAuB,YAAY,GAAG,IAAK;AAC1E;AAqBO,IAAM,yBAAyB,SAAgB,SAAwB;AAC7E,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AA6BO,IAAM,WAAW;AAAA,EACvB,cAAoB,EAAE,QAAQ,GAA+B;AAC5D,WAAO;AAAA,EACR;AAAA,EACA,UAAW,EAAE,QAAQ,GAAkC;AACtD,eAAO,iBAAAC,SAAc,OAAQ;AAAA,EAC9B;AACD;",
|
|
6
6
|
"names": ["deprecated", "dataControls", "triggerFetch"]
|
|
7
7
|
}
|
package/build-module/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// packages/data-controls/src/index.ts
|
|
1
2
|
import triggerFetch from "@wordpress/api-fetch";
|
|
2
3
|
import { controls as dataControls } from "@wordpress/data";
|
|
3
4
|
import deprecated from "@wordpress/deprecated";
|
|
@@ -32,13 +33,13 @@ function dispatch(storeNameOrDescriptor, actionName, ...args) {
|
|
|
32
33
|
});
|
|
33
34
|
return dataControls.dispatch(storeNameOrDescriptor, actionName, ...args);
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
+
var __unstableAwaitPromise = function(promise) {
|
|
36
37
|
return {
|
|
37
38
|
type: "AWAIT_PROMISE",
|
|
38
39
|
promise
|
|
39
40
|
};
|
|
40
41
|
};
|
|
41
|
-
|
|
42
|
+
var controls = {
|
|
42
43
|
AWAIT_PROMISE({ promise }) {
|
|
43
44
|
return promise;
|
|
44
45
|
},
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport triggerFetch from '@wordpress/api-fetch';\nimport { controls as dataControls } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport type { StoreDescriptor } from '@wordpress/data';\nimport type { APIFetchOptions } from '@wordpress/api-fetch';\n\n/**\n * Dispatches a control action for triggering an api fetch call.\n *\n * @param {Object} request Arguments for the fetch request.\n *\n * @example\n * ```js\n * import { apiFetch } from '@wordpress/data-controls';\n *\n * // Action generator using apiFetch\n * export function* myAction() {\n * \tconst path = '/v2/my-api/items';\n * \tconst items = yield apiFetch( { path } );\n * \t// do something with the items.\n * }\n * ```\n *\n * @return {Object} The control descriptor.\n */\nexport function apiFetch( request: APIFetchOptions ) {\n\treturn {\n\t\ttype: 'API_FETCH',\n\t\trequest,\n\t};\n}\n\n/**\n * Control for resolving a selector in a registered data store.\n * Alias for the `resolveSelect` built-in control in the `@wordpress/data` package.\n *\n * @param storeNameOrDescriptor The store object or identifier.\n * @param selectorName The selector name.\n * @param args Arguments passed without change to the `@wordpress/data` control.\n */\nexport function select(\n\tstoreNameOrDescriptor: string | StoreDescriptor,\n\tselectorName: string,\n\t...args: any[]\n) {\n\tdeprecated( '`select` control in `@wordpress/data-controls`', {\n\t\tsince: '5.7',\n\t\talternative: 'built-in `resolveSelect` control in `@wordpress/data`',\n\t} );\n\n\treturn dataControls.resolveSelect(\n\t\tstoreNameOrDescriptor,\n\t\tselectorName,\n\t\t...args\n\t);\n}\n\n/**\n * Control for calling a selector in a registered data store.\n * Alias for the `select` built-in control in the `@wordpress/data` package.\n *\n * @param storeNameOrDescriptor The store object or identifier.\n * @param selectorName The selector name.\n * @param args Arguments passed without change to the `@wordpress/data` control.\n */\nexport function syncSelect(\n\tstoreNameOrDescriptor: string | StoreDescriptor,\n\tselectorName: string,\n\t...args: any[]\n) {\n\tdeprecated( '`syncSelect` control in `@wordpress/data-controls`', {\n\t\tsince: '5.7',\n\t\talternative: 'built-in `select` control in `@wordpress/data`',\n\t} );\n\n\treturn dataControls.select( storeNameOrDescriptor, selectorName, ...args );\n}\n\n/**\n * Control for dispatching an action in a registered data store.\n * Alias for the `dispatch` control in the `@wordpress/data` package.\n *\n * @param storeNameOrDescriptor The store object or identifier.\n * @param actionName The action name.\n * @param args Arguments passed without change to the `@wordpress/data` control.\n */\nexport function dispatch(\n\tstoreNameOrDescriptor: string | StoreDescriptor,\n\tactionName: string,\n\t...args: any[]\n) {\n\tdeprecated( '`dispatch` control in `@wordpress/data-controls`', {\n\t\tsince: '5.7',\n\t\talternative: 'built-in `dispatch` control in `@wordpress/data`',\n\t} );\n\n\treturn dataControls.dispatch( storeNameOrDescriptor, actionName, ...args );\n}\n\n/**\n * Dispatches a control action for awaiting on a promise to be resolved.\n *\n * @param {Object} promise Promise to wait for.\n *\n * @example\n * ```js\n * import { __unstableAwaitPromise } from '@wordpress/data-controls';\n *\n * // Action generator using apiFetch\n * export function* myAction() {\n * \tconst promise = getItemsAsync();\n * \tconst items = yield __unstableAwaitPromise( promise );\n * \t// do something with the items.\n * }\n * ```\n *\n * @return {Object} The control descriptor.\n */\nexport const __unstableAwaitPromise = function < T >( promise: Promise< T > ) {\n\treturn {\n\t\ttype: 'AWAIT_PROMISE',\n\t\tpromise,\n\t};\n};\n\n/**\n * The default export is what you use to register the controls with your custom\n * store.\n *\n * @example\n * ```js\n * // WordPress dependencies\n * import { controls } from '@wordpress/data-controls';\n * import { registerStore } from '@wordpress/data';\n *\n * // Internal dependencies\n * import reducer from './reducer';\n * import * as selectors from './selectors';\n * import * as actions from './actions';\n * import * as resolvers from './resolvers';\n *\n * registerStore( 'my-custom-store', {\n * reducer,\n * controls,\n * actions,\n * selectors,\n * resolvers,\n * } );\n * ```\n * @return {Object} An object for registering the default controls with the\n * store.\n */\nexport const controls = {\n\tAWAIT_PROMISE< T >( { promise }: { promise: Promise< T > } ) {\n\t\treturn promise;\n\t},\n\tAPI_FETCH( { request }: { request: APIFetchOptions } ) {\n\t\treturn triggerFetch( request );\n\t},\n};\n"],
|
|
5
|
-
"mappings": "AAGA,OAAO,kBAAkB;AACzB,SAAS,YAAY,oBAAoB;AACzC,OAAO,gBAAgB;AAuBhB,SAAS,SAAU,SAA2B;AACpD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAUO,SAAS,OACf,uBACA,iBACG,MACF;AACD,aAAY,kDAAkD;AAAA,IAC7D,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAE;AAEF,SAAO,aAAa;AAAA,IACnB;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACJ;AACD;AAUO,SAAS,WACf,uBACA,iBACG,MACF;AACD,aAAY,sDAAsD;AAAA,IACjE,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAE;AAEF,SAAO,aAAa,OAAQ,uBAAuB,cAAc,GAAG,IAAK;AAC1E;AAUO,SAAS,SACf,uBACA,eACG,MACF;AACD,aAAY,oDAAoD;AAAA,IAC/D,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAE;AAEF,SAAO,aAAa,SAAU,uBAAuB,YAAY,GAAG,IAAK;AAC1E;AAqBO,
|
|
5
|
+
"mappings": ";AAGA,OAAO,kBAAkB;AACzB,SAAS,YAAY,oBAAoB;AACzC,OAAO,gBAAgB;AAuBhB,SAAS,SAAU,SAA2B;AACpD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAUO,SAAS,OACf,uBACA,iBACG,MACF;AACD,aAAY,kDAAkD;AAAA,IAC7D,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAE;AAEF,SAAO,aAAa;AAAA,IACnB;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACJ;AACD;AAUO,SAAS,WACf,uBACA,iBACG,MACF;AACD,aAAY,sDAAsD;AAAA,IACjE,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAE;AAEF,SAAO,aAAa,OAAQ,uBAAuB,cAAc,GAAG,IAAK;AAC1E;AAUO,SAAS,SACf,uBACA,eACG,MACF;AACD,aAAY,oDAAoD;AAAA,IAC/D,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAE;AAEF,SAAO,aAAa,SAAU,uBAAuB,YAAY,GAAG,IAAK;AAC1E;AAqBO,IAAM,yBAAyB,SAAgB,SAAwB;AAC7E,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AA6BO,IAAM,WAAW;AAAA,EACvB,cAAoB,EAAE,QAAQ,GAA+B;AAC5D,WAAO;AAAA,EACR;AAAA,EACA,UAAW,EAAE,QAAQ,GAAkC;AACtD,WAAO,aAAc,OAAQ;AAAA,EAC9B;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/data-controls",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.34.1-next.2f1c7c01b.0",
|
|
4
4
|
"description": "A set of common controls for the @wordpress/data api.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"wpScript": true,
|
|
38
38
|
"types": "build-types",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@wordpress/api-fetch": "^7.
|
|
41
|
-
"@wordpress/data": "^10.
|
|
42
|
-
"@wordpress/deprecated": "^4.
|
|
40
|
+
"@wordpress/api-fetch": "^7.34.1-next.2f1c7c01b.0",
|
|
41
|
+
"@wordpress/data": "^10.34.1-next.2f1c7c01b.0",
|
|
42
|
+
"@wordpress/deprecated": "^4.34.1-next.2f1c7c01b.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"react": "^18.0.0"
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "c6ddcdf455bc02567a2c9e03de6862a2061b85e8"
|
|
51
51
|
}
|