@wordpress/core-data 7.32.0 → 7.32.1-next.ff1cebbba.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/actions.js +375 -632
- package/build/actions.js.map +7 -1
- package/build/batch/create-batch.js +49 -62
- package/build/batch/create-batch.js.map +7 -1
- package/build/batch/default-processor.js +43 -39
- package/build/batch/default-processor.js.map +7 -1
- package/build/batch/index.js +38 -17
- package/build/batch/index.js.map +7 -1
- package/build/dynamic-entities.js +30 -32
- package/build/dynamic-entities.js.map +7 -1
- package/build/entities.js +298 -410
- package/build/entities.js.map +7 -1
- package/build/entity-context.js +29 -12
- package/build/entity-context.js.map +7 -1
- package/build/entity-provider.js +38 -46
- package/build/entity-provider.js.map +7 -1
- package/build/entity-types/attachment.js +16 -5
- package/build/entity-types/attachment.js.map +7 -1
- package/build/entity-types/base-entity-records.js +16 -42
- package/build/entity-types/base-entity-records.js.map +7 -1
- package/build/entity-types/base.js +16 -5
- package/build/entity-types/base.js.map +7 -1
- package/build/entity-types/comment.js +16 -5
- package/build/entity-types/comment.js.map +7 -1
- package/build/entity-types/global-styles-revision.js +16 -5
- package/build/entity-types/global-styles-revision.js.map +7 -1
- package/build/entity-types/helpers.js +16 -5
- package/build/entity-types/helpers.js.map +7 -1
- package/build/entity-types/index.js +16 -5
- package/build/entity-types/index.js.map +7 -1
- package/build/entity-types/menu-location.js +16 -5
- package/build/entity-types/menu-location.js.map +7 -1
- package/build/entity-types/nav-menu-item.js +16 -5
- package/build/entity-types/nav-menu-item.js.map +7 -1
- package/build/entity-types/nav-menu.js +16 -5
- package/build/entity-types/nav-menu.js.map +7 -1
- package/build/entity-types/page.js +16 -5
- package/build/entity-types/page.js.map +7 -1
- package/build/entity-types/plugin.js +16 -5
- package/build/entity-types/plugin.js.map +7 -1
- package/build/entity-types/post-revision.js +16 -5
- package/build/entity-types/post-revision.js.map +7 -1
- package/build/entity-types/post-status.js +16 -5
- package/build/entity-types/post-status.js.map +7 -1
- package/build/entity-types/post.js +16 -5
- package/build/entity-types/post.js.map +7 -1
- package/build/entity-types/settings.js +16 -5
- package/build/entity-types/settings.js.map +7 -1
- package/build/entity-types/sidebar.js +16 -5
- package/build/entity-types/sidebar.js.map +7 -1
- package/build/entity-types/taxonomy.js +16 -5
- package/build/entity-types/taxonomy.js.map +7 -1
- package/build/entity-types/term.js +16 -5
- package/build/entity-types/term.js.map +7 -1
- package/build/entity-types/theme.js +16 -5
- package/build/entity-types/theme.js.map +7 -1
- package/build/entity-types/type.js +16 -5
- package/build/entity-types/type.js.map +7 -1
- package/build/entity-types/user.js +16 -5
- package/build/entity-types/user.js.map +7 -1
- package/build/entity-types/widget-type.js +16 -5
- package/build/entity-types/widget-type.js.map +7 -1
- package/build/entity-types/widget.js +16 -5
- package/build/entity-types/widget.js.map +7 -1
- package/build/entity-types/wp-template-part.js +16 -5
- package/build/entity-types/wp-template-part.js.map +7 -1
- package/build/entity-types/wp-template.js +16 -5
- package/build/entity-types/wp-template.js.map +7 -1
- package/build/fetch/__experimental-fetch-link-suggestions.js +141 -154
- package/build/fetch/__experimental-fetch-link-suggestions.js.map +7 -1
- package/build/fetch/__experimental-fetch-url-data.js +47 -59
- package/build/fetch/__experimental-fetch-url-data.js.map +7 -1
- package/build/fetch/index.js +53 -32
- package/build/fetch/index.js.map +7 -1
- package/build/footnotes/get-footnotes-order.js +38 -25
- package/build/footnotes/get-footnotes-order.js.map +7 -1
- package/build/footnotes/get-rich-text-values-cached.js +26 -27
- package/build/footnotes/get-rich-text-values-cached.js.map +7 -1
- package/build/footnotes/index.js +68 -55
- package/build/footnotes/index.js.map +7 -1
- package/build/hooks/constants.js +33 -12
- package/build/hooks/constants.js.map +7 -1
- package/build/hooks/index.js +59 -68
- package/build/hooks/index.js.map +7 -1
- package/build/hooks/memoize.js +34 -12
- package/build/hooks/memoize.js.map +7 -1
- package/build/hooks/use-entity-block-editor.js +111 -119
- package/build/hooks/use-entity-block-editor.js.map +7 -1
- package/build/hooks/use-entity-id.js +25 -23
- package/build/hooks/use-entity-id.js.map +7 -1
- package/build/hooks/use-entity-prop.js +59 -60
- package/build/hooks/use-entity-prop.js.map +7 -1
- package/build/hooks/use-entity-record.js +95 -155
- package/build/hooks/use-entity-record.js.map +7 -1
- package/build/hooks/use-entity-records.js +131 -139
- package/build/hooks/use-entity-records.js.map +7 -1
- package/build/hooks/use-query-select.js +65 -84
- package/build/hooks/use-query-select.js.map +7 -1
- package/build/hooks/use-resource-permissions.js +92 -145
- package/build/hooks/use-resource-permissions.js.map +7 -1
- package/build/index.js +96 -153
- package/build/index.js.map +7 -1
- package/build/lock-unlock.js +31 -14
- package/build/lock-unlock.js.map +7 -1
- package/build/locks/actions.js +36 -19
- package/build/locks/actions.js.map +7 -1
- package/build/locks/engine.js +48 -47
- package/build/locks/engine.js.map +7 -1
- package/build/locks/reducer.js +54 -63
- package/build/locks/reducer.js.map +7 -1
- package/build/locks/selectors.js +35 -30
- package/build/locks/selectors.js.map +7 -1
- package/build/locks/utils.js +37 -16
- package/build/locks/utils.js.map +7 -1
- package/build/name.js +27 -12
- package/build/name.js.map +7 -1
- package/build/private-actions.js +67 -75
- package/build/private-actions.js.map +7 -1
- package/build/private-apis.js +33 -16
- package/build/private-apis.js.map +7 -1
- package/build/private-selectors.js +204 -184
- package/build/private-selectors.js.map +7 -1
- package/build/queried-data/actions.js +32 -41
- package/build/queried-data/actions.js.map +7 -1
- package/build/queried-data/get-query-parts.js +41 -79
- package/build/queried-data/get-query-parts.js.map +7 -1
- package/build/queried-data/index.js +39 -36
- package/build/queried-data/index.js.map +7 -1
- package/build/queried-data/reducer.js +162 -193
- package/build/queried-data/reducer.js.map +7 -1
- package/build/queried-data/selectors.js +57 -85
- package/build/queried-data/selectors.js.map +7 -1
- package/build/reducer.js +279 -404
- package/build/reducer.js.map +7 -1
- package/build/resolvers.js +553 -600
- package/build/resolvers.js.map +7 -1
- package/build/selectors.js +456 -981
- package/build/selectors.js.map +7 -1
- package/build/sync.js +34 -22
- package/build/sync.js.map +7 -1
- package/build/types.js +16 -5
- package/build/types.js.map +7 -1
- package/build/utils/conservative-map-item.js +34 -27
- package/build/utils/conservative-map-item.js.map +7 -1
- package/build/utils/crdt-blocks.js +289 -0
- package/build/utils/crdt-blocks.js.map +7 -0
- package/build/utils/crdt.js +202 -0
- package/build/utils/crdt.js.map +7 -0
- package/build/utils/forward-resolver.js +24 -16
- package/build/utils/forward-resolver.js.map +7 -1
- package/build/utils/get-nested-value.js +26 -21
- package/build/utils/get-nested-value.js.map +7 -1
- package/build/utils/get-normalized-comma-separable.js +25 -17
- package/build/utils/get-normalized-comma-separable.js.map +7 -1
- package/build/utils/if-matching-action.js +25 -19
- package/build/utils/if-matching-action.js.map +7 -1
- package/build/utils/index.js +77 -108
- package/build/utils/index.js.map +7 -1
- package/build/utils/is-numeric-id.js +22 -12
- package/build/utils/is-numeric-id.js.map +7 -1
- package/build/utils/is-raw-attribute.js +22 -13
- package/build/utils/is-raw-attribute.js.map +7 -1
- package/build/utils/log-entity-deprecation.js +37 -38
- package/build/utils/log-entity-deprecation.js.map +7 -1
- package/build/utils/on-sub-key.js +30 -24
- package/build/utils/on-sub-key.js.map +7 -1
- package/build/utils/receive-intermediate-results.js +29 -6
- package/build/utils/receive-intermediate-results.js.map +7 -1
- package/build/utils/replace-action.js +24 -17
- package/build/utils/replace-action.js.map +7 -1
- package/build/utils/set-nested-value.js +25 -30
- package/build/utils/set-nested-value.js.map +7 -1
- package/build/utils/user-permissions.js +41 -13
- package/build/utils/user-permissions.js.map +7 -1
- package/build/utils/with-weak-map-cache.js +26 -22
- package/build/utils/with-weak-map-cache.js.map +7 -1
- package/build-module/actions.js +322 -601
- package/build-module/actions.js.map +7 -1
- package/build-module/batch/create-batch.js +21 -57
- package/build-module/batch/create-batch.js.map +7 -1
- package/build-module/batch/default-processor.js +14 -33
- package/build-module/batch/default-processor.js.map +7 -1
- package/build-module/batch/index.js +7 -3
- package/build-module/batch/index.js.map +7 -1
- package/build-module/dynamic-entities.js +7 -28
- package/build-module/dynamic-entities.js.map +7 -1
- package/build-module/entities.js +263 -399
- package/build-module/entities.js.map +7 -1
- package/build-module/entity-context.js +7 -7
- package/build-module/entity-context.js.map +7 -1
- package/build-module/entity-provider.js +19 -42
- package/build-module/entity-provider.js.map +7 -1
- package/build-module/entity-types/attachment.js +1 -2
- package/build-module/entity-types/attachment.js.map +7 -1
- package/build-module/entity-types/base-entity-records.js +1 -37
- package/build-module/entity-types/base-entity-records.js.map +7 -1
- package/build-module/entity-types/base.js +1 -2
- package/build-module/entity-types/base.js.map +7 -1
- package/build-module/entity-types/comment.js +1 -2
- package/build-module/entity-types/comment.js.map +7 -1
- package/build-module/entity-types/global-styles-revision.js +1 -2
- package/build-module/entity-types/global-styles-revision.js.map +7 -1
- package/build-module/entity-types/helpers.js +1 -2
- package/build-module/entity-types/helpers.js.map +7 -1
- package/build-module/entity-types/index.js +1 -2
- package/build-module/entity-types/index.js.map +7 -1
- package/build-module/entity-types/menu-location.js +1 -2
- package/build-module/entity-types/menu-location.js.map +7 -1
- package/build-module/entity-types/nav-menu-item.js +1 -2
- package/build-module/entity-types/nav-menu-item.js.map +7 -1
- package/build-module/entity-types/nav-menu.js +1 -2
- package/build-module/entity-types/nav-menu.js.map +7 -1
- package/build-module/entity-types/page.js +1 -2
- package/build-module/entity-types/page.js.map +7 -1
- package/build-module/entity-types/plugin.js +1 -2
- package/build-module/entity-types/plugin.js.map +7 -1
- package/build-module/entity-types/post-revision.js +1 -2
- package/build-module/entity-types/post-revision.js.map +7 -1
- package/build-module/entity-types/post-status.js +1 -2
- package/build-module/entity-types/post-status.js.map +7 -1
- package/build-module/entity-types/post.js +1 -2
- package/build-module/entity-types/post.js.map +7 -1
- package/build-module/entity-types/settings.js +1 -2
- package/build-module/entity-types/settings.js.map +7 -1
- package/build-module/entity-types/sidebar.js +1 -2
- package/build-module/entity-types/sidebar.js.map +7 -1
- package/build-module/entity-types/taxonomy.js +1 -2
- package/build-module/entity-types/taxonomy.js.map +7 -1
- package/build-module/entity-types/term.js +1 -2
- package/build-module/entity-types/term.js.map +7 -1
- package/build-module/entity-types/theme.js +1 -2
- package/build-module/entity-types/theme.js.map +7 -1
- package/build-module/entity-types/type.js +1 -2
- package/build-module/entity-types/type.js.map +7 -1
- package/build-module/entity-types/user.js +1 -2
- package/build-module/entity-types/user.js.map +7 -1
- package/build-module/entity-types/widget-type.js +1 -2
- package/build-module/entity-types/widget-type.js.map +7 -1
- package/build-module/entity-types/widget.js +1 -2
- package/build-module/entity-types/widget.js.map +7 -1
- package/build-module/entity-types/wp-template-part.js +1 -2
- package/build-module/entity-types/wp-template-part.js.map +7 -1
- package/build-module/entity-types/wp-template.js +1 -2
- package/build-module/entity-types/wp-template.js.map +7 -1
- package/build-module/fetch/__experimental-fetch-link-suggestions.js +111 -149
- package/build-module/fetch/__experimental-fetch-link-suggestions.js.map +7 -1
- package/build-module/fetch/__experimental-fetch-url-data.js +20 -49
- package/build-module/fetch/__experimental-fetch-url-data.js.map +7 -1
- package/build-module/fetch/index.js +20 -15
- package/build-module/fetch/index.js.map +7 -1
- package/build-module/footnotes/get-footnotes-order.js +10 -19
- package/build-module/footnotes/get-footnotes-order.js.map +7 -1
- package/build-module/footnotes/get-rich-text-values-cached.js +8 -23
- package/build-module/footnotes/get-rich-text-values-cached.js.map +7 -1
- package/build-module/footnotes/index.js +34 -47
- package/build-module/footnotes/index.js.map +7 -1
- package/build-module/hooks/constants.js +11 -8
- package/build-module/hooks/constants.js.map +7 -1
- package/build-module/hooks/index.js +27 -15
- package/build-module/hooks/index.js.map +7 -1
- package/build-module/hooks/memoize.js +6 -8
- package/build-module/hooks/memoize.js.map +7 -1
- package/build-module/hooks/use-entity-block-editor.js +80 -110
- package/build-module/hooks/use-entity-block-editor.js.map +7 -1
- package/build-module/hooks/use-entity-id.js +7 -19
- package/build-module/hooks/use-entity-id.js.map +7 -1
- package/build-module/hooks/use-entity-prop.js +31 -55
- package/build-module/hooks/use-entity-prop.js.map +7 -1
- package/build-module/hooks/use-entity-record.js +63 -148
- package/build-module/hooks/use-entity-record.js.map +7 -1
- package/build-module/hooks/use-entity-records.js +98 -131
- package/build-module/hooks/use-entity-records.js.map +7 -1
- package/build-module/hooks/use-query-select.js +27 -71
- package/build-module/hooks/use-query-select.js.map +7 -1
- package/build-module/hooks/use-resource-permissions.js +57 -136
- package/build-module/hooks/use-resource-permissions.js.map +7 -1
- package/build-module/index.js +49 -71
- package/build-module/index.js.map +7 -1
- package/build-module/lock-unlock.js +8 -7
- package/build-module/lock-unlock.js.map +7 -1
- package/build-module/locks/actions.js +8 -13
- package/build-module/locks/actions.js.map +7 -1
- package/build-module/locks/engine.js +17 -38
- package/build-module/locks/engine.js.map +7 -1
- package/build-module/locks/reducer.js +37 -59
- package/build-module/locks/reducer.js.map +7 -1
- package/build-module/locks/selectors.js +16 -23
- package/build-module/locks/selectors.js.map +7 -1
- package/build-module/locks/utils.js +15 -12
- package/build-module/locks/utils.js.map +7 -1
- package/build-module/name.js +5 -8
- package/build-module/name.js.map +7 -1
- package/build-module/private-actions.js +35 -69
- package/build-module/private-actions.js.map +7 -1
- package/build-module/private-apis.js +8 -8
- package/build-module/private-apis.js.map +7 -1
- package/build-module/private-selectors.js +167 -174
- package/build-module/private-selectors.js.map +7 -1
- package/build-module/queried-data/actions.js +11 -38
- package/build-module/queried-data/actions.js.map +7 -1
- package/build-module/queried-data/get-query-parts.js +20 -75
- package/build-module/queried-data/get-query-parts.js.map +7 -1
- package/build-module/queried-data/index.js +7 -4
- package/build-module/queried-data/index.js.map +7 -1
- package/build-module/queried-data/reducer.js +134 -185
- package/build-module/queried-data/reducer.js.map +7 -1
- package/build-module/queried-data/selectors.js +23 -78
- package/build-module/queried-data/selectors.js.map +7 -1
- package/build-module/reducer.js +243 -393
- package/build-module/reducer.js.map +7 -1
- package/build-module/resolvers.js +478 -549
- package/build-module/resolvers.js.map +7 -1
- package/build-module/selectors.js +410 -953
- package/build-module/selectors.js.map +7 -1
- package/build-module/sync.js +14 -17
- package/build-module/sync.js.map +7 -1
- package/build-module/types.js +1 -2
- package/build-module/types.js.map +7 -1
- package/build-module/utils/conservative-map-item.js +6 -22
- package/build-module/utils/conservative-map-item.js.map +7 -1
- package/build-module/utils/crdt-blocks.js +255 -0
- package/build-module/utils/crdt-blocks.js.map +7 -0
- package/build-module/utils/crdt.js +167 -0
- package/build-module/utils/crdt.js.map +7 -0
- package/build-module/utils/forward-resolver.js +6 -12
- package/build-module/utils/forward-resolver.js.map +7 -1
- package/build-module/utils/get-nested-value.js +9 -18
- package/build-module/utils/get-nested-value.js.map +7 -1
- package/build-module/utils/get-normalized-comma-separable.js +7 -13
- package/build-module/utils/get-normalized-comma-separable.js.map +7 -1
- package/build-module/utils/if-matching-action.js +7 -15
- package/build-module/utils/if-matching-action.js.map +7 -1
- package/build-module/utils/index.js +35 -14
- package/build-module/utils/index.js.map +7 -1
- package/build-module/utils/is-numeric-id.js +5 -9
- package/build-module/utils/is-numeric-id.js.map +7 -1
- package/build-module/utils/is-raw-attribute.js +5 -10
- package/build-module/utils/is-raw-attribute.js.map +7 -1
- package/build-module/utils/log-entity-deprecation.js +8 -31
- package/build-module/utils/log-entity-deprecation.js.map +7 -1
- package/build-module/utils/on-sub-key.js +8 -19
- package/build-module/utils/on-sub-key.js.map +7 -1
- package/build-module/utils/receive-intermediate-results.js +7 -2
- package/build-module/utils/receive-intermediate-results.js.map +7 -1
- package/build-module/utils/replace-action.js +6 -13
- package/build-module/utils/replace-action.js.map +7 -1
- package/build-module/utils/set-nested-value.js +8 -27
- package/build-module/utils/set-nested-value.js.map +7 -1
- package/build-module/utils/user-permissions.js +19 -9
- package/build-module/utils/user-permissions.js.map +7 -1
- package/build-module/utils/with-weak-map-cache.js +8 -18
- package/build-module/utils/with-weak-map-cache.js.map +7 -1
- package/build-types/actions.d.ts.map +1 -1
- package/build-types/entities.d.ts +0 -56
- package/build-types/entities.d.ts.map +1 -1
- package/build-types/index.d.ts.map +1 -1
- package/build-types/private-selectors.d.ts.map +1 -1
- package/build-types/resolvers.d.ts +3 -0
- package/build-types/resolvers.d.ts.map +1 -1
- package/build-types/selectors.d.ts.map +1 -1
- package/build-types/sync.d.ts +6 -1
- package/build-types/sync.d.ts.map +1 -1
- package/build-types/types.d.ts +9 -0
- package/build-types/types.d.ts.map +1 -1
- package/build-types/utils/crdt-blocks.d.ts +30 -0
- package/build-types/utils/crdt-blocks.d.ts.map +1 -0
- package/build-types/utils/crdt.d.ts +49 -0
- package/build-types/utils/crdt.d.ts.map +1 -0
- package/package.json +26 -19
- package/src/actions.js +56 -74
- package/src/entities.js +59 -113
- package/src/private-selectors.ts +32 -7
- package/src/resolvers.js +173 -120
- package/src/selectors.ts +0 -13
- package/src/sync.ts +12 -0
- package/src/test/resolvers.js +183 -0
- package/src/types.ts +12 -0
- package/src/utils/crdt-blocks.ts +503 -0
- package/src/utils/crdt.ts +310 -0
- package/src/utils/test/crdt-blocks.ts +375 -0
- package/src/utils/test/crdt.ts +254 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/sync.js +0 -27
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/if-matching-action.js"],
|
|
4
|
+
"sourcesContent": ["/** @typedef {import('../types').AnyFunction} AnyFunction */\n\n/**\n * A higher-order reducer creator which invokes the original reducer only if\n * the dispatching action matches the given predicate, **OR** if state is\n * initializing (undefined).\n *\n * @param {AnyFunction} isMatch Function predicate for allowing reducer call.\n *\n * @return {AnyFunction} Higher-order reducer.\n */\nconst ifMatchingAction = ( isMatch ) => ( reducer ) => ( state, action ) => {\n\tif ( state === undefined || isMatch( action ) ) {\n\t\treturn reducer( state, action );\n\t}\n\n\treturn state;\n};\n\nexport default ifMatchingAction;\n"],
|
|
5
|
+
"mappings": "AAWA,MAAM,mBAAmB,CAAE,YAAa,CAAE,YAAa,CAAE,OAAO,WAAY;AAC3E,MAAK,UAAU,UAAa,QAAS,MAAO,GAAI;AAC/C,WAAO,QAAS,OAAO,MAAO;AAAA,EAC/B;AAEA,SAAO;AACR;AAEA,IAAO,6BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,14 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { default as default2 } from "./conservative-map-item";
|
|
2
|
+
import { default as default3 } from "./get-normalized-comma-separable";
|
|
3
|
+
import { default as default4 } from "./if-matching-action";
|
|
4
|
+
import { default as default5 } from "./forward-resolver";
|
|
5
|
+
import { default as default6 } from "./on-sub-key";
|
|
6
|
+
import { default as default7 } from "./replace-action";
|
|
7
|
+
import { default as default8 } from "./with-weak-map-cache";
|
|
8
|
+
import { default as default9 } from "./is-raw-attribute";
|
|
9
|
+
import { default as default10 } from "./set-nested-value";
|
|
10
|
+
import { default as default11 } from "./get-nested-value";
|
|
11
|
+
import { default as default12 } from "./is-numeric-id";
|
|
12
|
+
import {
|
|
13
|
+
getUserPermissionCacheKey,
|
|
14
|
+
getUserPermissionsFromAllowHeader,
|
|
15
|
+
ALLOWED_RESOURCE_ACTIONS
|
|
16
|
+
} from "./user-permissions";
|
|
17
|
+
import { RECEIVE_INTERMEDIATE_RESULTS } from "./receive-intermediate-results";
|
|
18
|
+
export {
|
|
19
|
+
ALLOWED_RESOURCE_ACTIONS,
|
|
20
|
+
RECEIVE_INTERMEDIATE_RESULTS,
|
|
21
|
+
default2 as conservativeMapItem,
|
|
22
|
+
default5 as forwardResolver,
|
|
23
|
+
default11 as getNestedValue,
|
|
24
|
+
default3 as getNormalizedCommaSeparable,
|
|
25
|
+
getUserPermissionCacheKey,
|
|
26
|
+
getUserPermissionsFromAllowHeader,
|
|
27
|
+
default4 as ifMatchingAction,
|
|
28
|
+
default12 as isNumericID,
|
|
29
|
+
default9 as isRawAttribute,
|
|
30
|
+
default6 as onSubKey,
|
|
31
|
+
default7 as replaceAction,
|
|
32
|
+
default10 as setNestedValue,
|
|
33
|
+
default8 as withWeakMapCache
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/index.js"],
|
|
4
|
+
"sourcesContent": ["export { default as conservativeMapItem } from './conservative-map-item';\nexport { default as getNormalizedCommaSeparable } from './get-normalized-comma-separable';\nexport { default as ifMatchingAction } from './if-matching-action';\nexport { default as forwardResolver } from './forward-resolver';\nexport { default as onSubKey } from './on-sub-key';\nexport { default as replaceAction } from './replace-action';\nexport { default as withWeakMapCache } from './with-weak-map-cache';\nexport { default as isRawAttribute } from './is-raw-attribute';\nexport { default as setNestedValue } from './set-nested-value';\nexport { default as getNestedValue } from './get-nested-value';\nexport { default as isNumericID } from './is-numeric-id';\nexport {\n\tgetUserPermissionCacheKey,\n\tgetUserPermissionsFromAllowHeader,\n\tALLOWED_RESOURCE_ACTIONS,\n} from './user-permissions';\nexport { RECEIVE_INTERMEDIATE_RESULTS } from './receive-intermediate-results';\n"],
|
|
5
|
+
"mappings": "AAAA,SAAoB,WAAXA,gBAAsC;AAC/C,SAAoB,WAAXA,gBAA8C;AACvD,SAAoB,WAAXA,gBAAmC;AAC5C,SAAoB,WAAXA,gBAAkC;AAC3C,SAAoB,WAAXA,gBAA2B;AACpC,SAAoB,WAAXA,gBAAgC;AACzC,SAAoB,WAAXA,gBAAmC;AAC5C,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAA8B;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,oCAAoC;",
|
|
6
|
+
"names": ["default"]
|
|
7
|
+
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
* Checks argument to determine if it's a numeric ID.
|
|
3
|
-
* For example, '123' is a numeric ID, but '123abc' is not.
|
|
4
|
-
*
|
|
5
|
-
* @param {any} id the argument to determine if it's a numeric ID.
|
|
6
|
-
* @return {boolean} true if the string is a numeric ID, false otherwise.
|
|
7
|
-
*/
|
|
8
|
-
export default function isNumericID(id) {
|
|
1
|
+
function isNumericID(id) {
|
|
9
2
|
return /^\s*\d+\s*$/.test(id);
|
|
10
3
|
}
|
|
11
|
-
|
|
4
|
+
export {
|
|
5
|
+
isNumericID as default
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=is-numeric-id.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/is-numeric-id.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Checks argument to determine if it's a numeric ID.\n * For example, '123' is a numeric ID, but '123abc' is not.\n *\n * @param {any} id the argument to determine if it's a numeric ID.\n * @return {boolean} true if the string is a numeric ID, false otherwise.\n */\nexport default function isNumericID( id ) {\n\treturn /^\\s*\\d+\\s*$/.test( id );\n}\n"],
|
|
5
|
+
"mappings": "AAOe,SAAR,YAA8B,IAAK;AACzC,SAAO,cAAc,KAAM,EAAG;AAC/B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
* Checks whether the attribute is a "raw" attribute or not.
|
|
3
|
-
*
|
|
4
|
-
* @param {Object} entity Entity record.
|
|
5
|
-
* @param {string} attribute Attribute name.
|
|
6
|
-
*
|
|
7
|
-
* @return {boolean} Is the attribute raw
|
|
8
|
-
*/
|
|
9
|
-
export default function isRawAttribute(entity, attribute) {
|
|
1
|
+
function isRawAttribute(entity, attribute) {
|
|
10
2
|
return (entity.rawAttributes || []).includes(attribute);
|
|
11
3
|
}
|
|
12
|
-
|
|
4
|
+
export {
|
|
5
|
+
isRawAttribute as default
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=is-raw-attribute.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/is-raw-attribute.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Checks whether the attribute is a \"raw\" attribute or not.\n *\n * @param {Object} entity Entity record.\n * @param {string} attribute Attribute name.\n *\n * @return {boolean} Is the attribute raw\n */\nexport default function isRawAttribute( entity, attribute ) {\n\treturn ( entity.rawAttributes || [] ).includes( attribute );\n}\n"],
|
|
5
|
+
"mappings": "AAQe,SAAR,eAAiC,QAAQ,WAAY;AAC3D,UAAS,OAAO,iBAAiB,CAAC,GAAI,SAAU,SAAU;AAC3D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,25 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import deprecated from '@wordpress/deprecated';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { deprecatedEntities } from '../entities';
|
|
1
|
+
import deprecated from "@wordpress/deprecated";
|
|
2
|
+
import { deprecatedEntities } from "../entities";
|
|
10
3
|
let loggedAlready = false;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Logs a deprecation warning for an entity, if it's deprecated.
|
|
14
|
-
*
|
|
15
|
-
* @param kind The kind of the entity.
|
|
16
|
-
* @param name The name of the entity.
|
|
17
|
-
* @param functionName The name of the function that was called with a deprecated entity.
|
|
18
|
-
* @param options The options for the deprecation warning.
|
|
19
|
-
* @param options.alternativeFunctionName The name of the alternative function that should be used instead.
|
|
20
|
-
* @param options.isShorthandSelector Whether the function is a shorthand selector.
|
|
21
|
-
*/
|
|
22
|
-
export default function logEntityDeprecation(kind, name, functionName, {
|
|
4
|
+
function logEntityDeprecation(kind, name, functionName, {
|
|
23
5
|
alternativeFunctionName,
|
|
24
6
|
isShorthandSelector = false
|
|
25
7
|
} = {}) {
|
|
@@ -28,9 +10,7 @@ export default function logEntityDeprecation(kind, name, functionName, {
|
|
|
28
10
|
return;
|
|
29
11
|
}
|
|
30
12
|
if (!loggedAlready) {
|
|
31
|
-
const {
|
|
32
|
-
alternative
|
|
33
|
-
} = deprecation;
|
|
13
|
+
const { alternative } = deprecation;
|
|
34
14
|
const message = isShorthandSelector ? `'${functionName}'` : `The '${kind}', '${name}' entity (used via '${functionName}')`;
|
|
35
15
|
let alternativeMessage = `the '${alternative.kind}', '${alternative.name}' entity`;
|
|
36
16
|
if (alternativeFunctionName) {
|
|
@@ -41,15 +21,12 @@ export default function logEntityDeprecation(kind, name, functionName, {
|
|
|
41
21
|
alternative: alternativeMessage
|
|
42
22
|
});
|
|
43
23
|
}
|
|
44
|
-
|
|
45
|
-
// Only log an entity deprecation once per call stack,
|
|
46
|
-
// else there's spurious logging when selections or actions call through to other selectors or actions.
|
|
47
|
-
// Note: this won't prevent the deprecation warning being logged if a selector or action makes an async call
|
|
48
|
-
// to another selector or action, but this is probably the best we can do.
|
|
49
24
|
loggedAlready = true;
|
|
50
|
-
// At the end of the call stack, reset the flag.
|
|
51
25
|
setTimeout(() => {
|
|
52
26
|
loggedAlready = false;
|
|
53
27
|
}, 0);
|
|
54
28
|
}
|
|
55
|
-
|
|
29
|
+
export {
|
|
30
|
+
logEntityDeprecation as default
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=log-entity-deprecation.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/log-entity-deprecation.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { deprecatedEntities } from '../entities';\n\nlet loggedAlready = false;\n\n/**\n * Logs a deprecation warning for an entity, if it's deprecated.\n *\n * @param kind The kind of the entity.\n * @param name The name of the entity.\n * @param functionName The name of the function that was called with a deprecated entity.\n * @param options The options for the deprecation warning.\n * @param options.alternativeFunctionName The name of the alternative function that should be used instead.\n * @param options.isShorthandSelector Whether the function is a shorthand selector.\n */\nexport default function logEntityDeprecation(\n\tkind: string,\n\tname: string,\n\tfunctionName: string,\n\t{\n\t\talternativeFunctionName,\n\t\tisShorthandSelector = false,\n\t}: {\n\t\talternativeFunctionName?: string;\n\t\tisShorthandSelector?: boolean;\n\t} = {}\n) {\n\tconst deprecation = deprecatedEntities[ kind ]?.[ name ];\n\tif ( ! deprecation ) {\n\t\treturn;\n\t}\n\n\tif ( ! loggedAlready ) {\n\t\tconst { alternative } = deprecation;\n\n\t\tconst message = isShorthandSelector\n\t\t\t? `'${ functionName }'`\n\t\t\t: `The '${ kind }', '${ name }' entity (used via '${ functionName }')`;\n\n\t\tlet alternativeMessage = `the '${ alternative.kind }', '${ alternative.name }' entity`;\n\t\tif ( alternativeFunctionName ) {\n\t\t\talternativeMessage += ` via the '${ alternativeFunctionName }' function`;\n\t\t}\n\n\t\tdeprecated( message, {\n\t\t\t...deprecation,\n\t\t\talternative: alternativeMessage,\n\t\t} );\n\t}\n\n\t// Only log an entity deprecation once per call stack,\n\t// else there's spurious logging when selections or actions call through to other selectors or actions.\n\t// Note: this won't prevent the deprecation warning being logged if a selector or action makes an async call\n\t// to another selector or action, but this is probably the best we can do.\n\tloggedAlready = true;\n\t// At the end of the call stack, reset the flag.\n\tsetTimeout( () => {\n\t\tloggedAlready = false;\n\t}, 0 );\n}\n"],
|
|
5
|
+
"mappings": "AAGA,OAAO,gBAAgB;AAKvB,SAAS,0BAA0B;AAEnC,IAAI,gBAAgB;AAYL,SAAR,qBACN,MACA,MACA,cACA;AAAA,EACC;AAAA,EACA,sBAAsB;AACvB,IAGI,CAAC,GACJ;AACD,QAAM,cAAc,mBAAoB,IAAK,IAAK,IAAK;AACvD,MAAK,CAAE,aAAc;AACpB;AAAA,EACD;AAEA,MAAK,CAAE,eAAgB;AACtB,UAAM,EAAE,YAAY,IAAI;AAExB,UAAM,UAAU,sBACb,IAAK,YAAa,MAClB,QAAS,IAAK,OAAQ,IAAK,uBAAwB,YAAa;AAEnE,QAAI,qBAAqB,QAAS,YAAY,IAAK,OAAQ,YAAY,IAAK;AAC5E,QAAK,yBAA0B;AAC9B,4BAAsB,aAAc,uBAAwB;AAAA,IAC7D;AAEA,eAAY,SAAS;AAAA,MACpB,GAAG;AAAA,MACH,aAAa;AAAA,IACd,CAAE;AAAA,EACH;AAMA,kBAAgB;AAEhB,aAAY,MAAM;AACjB,oBAAgB;AAAA,EACjB,GAAG,CAAE;AACN;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Higher-order reducer creator which creates a combined reducer object, keyed
|
|
5
|
-
* by a property on the action object.
|
|
6
|
-
*
|
|
7
|
-
* @param {string} actionProperty Action property by which to key object.
|
|
8
|
-
*
|
|
9
|
-
* @return {AnyFunction} Higher-order reducer.
|
|
10
|
-
*/
|
|
11
|
-
export const onSubKey = actionProperty => reducer => (state = {}, action) => {
|
|
12
|
-
// Retrieve subkey from action. Do not track if undefined; useful for cases
|
|
13
|
-
// where reducer is scoped by action shape.
|
|
1
|
+
const onSubKey = (actionProperty) => (reducer) => (state = {}, action) => {
|
|
14
2
|
const key = action[actionProperty];
|
|
15
|
-
if (key ===
|
|
3
|
+
if (key === void 0) {
|
|
16
4
|
return state;
|
|
17
5
|
}
|
|
18
|
-
|
|
19
|
-
// Avoid updating state if unchanged. Note that this also accounts for a
|
|
20
|
-
// reducer which returns undefined on a key which is not yet tracked.
|
|
21
6
|
const nextKeyState = reducer(state[key], action);
|
|
22
7
|
if (nextKeyState === state[key]) {
|
|
23
8
|
return state;
|
|
@@ -27,5 +12,9 @@ export const onSubKey = actionProperty => reducer => (state = {}, action) => {
|
|
|
27
12
|
[key]: nextKeyState
|
|
28
13
|
};
|
|
29
14
|
};
|
|
30
|
-
|
|
31
|
-
|
|
15
|
+
var on_sub_key_default = onSubKey;
|
|
16
|
+
export {
|
|
17
|
+
on_sub_key_default as default,
|
|
18
|
+
onSubKey
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=on-sub-key.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/on-sub-key.js"],
|
|
4
|
+
"sourcesContent": ["/** @typedef {import('../types').AnyFunction} AnyFunction */\n\n/**\n * Higher-order reducer creator which creates a combined reducer object, keyed\n * by a property on the action object.\n *\n * @param {string} actionProperty Action property by which to key object.\n *\n * @return {AnyFunction} Higher-order reducer.\n */\nexport const onSubKey =\n\t( actionProperty ) =>\n\t( reducer ) =>\n\t( state = {}, action ) => {\n\t\t// Retrieve subkey from action. Do not track if undefined; useful for cases\n\t\t// where reducer is scoped by action shape.\n\t\tconst key = action[ actionProperty ];\n\t\tif ( key === undefined ) {\n\t\t\treturn state;\n\t\t}\n\n\t\t// Avoid updating state if unchanged. Note that this also accounts for a\n\t\t// reducer which returns undefined on a key which is not yet tracked.\n\t\tconst nextKeyState = reducer( state[ key ], action );\n\t\tif ( nextKeyState === state[ key ] ) {\n\t\t\treturn state;\n\t\t}\n\n\t\treturn {\n\t\t\t...state,\n\t\t\t[ key ]: nextKeyState,\n\t\t};\n\t};\n\nexport default onSubKey;\n"],
|
|
5
|
+
"mappings": "AAUO,MAAM,WACZ,CAAE,mBACF,CAAE,YACF,CAAE,QAAQ,CAAC,GAAG,WAAY;AAGzB,QAAM,MAAM,OAAQ,cAAe;AACnC,MAAK,QAAQ,QAAY;AACxB,WAAO;AAAA,EACR;AAIA,QAAM,eAAe,QAAS,MAAO,GAAI,GAAG,MAAO;AACnD,MAAK,iBAAiB,MAAO,GAAI,GAAI;AACpC,WAAO;AAAA,EACR;AAEA,SAAO;AAAA,IACN,GAAG;AAAA,IACH,CAAE,GAAI,GAAG;AAAA,EACV;AACD;AAED,IAAO,qBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const RECEIVE_INTERMEDIATE_RESULTS = Symbol(
|
|
2
|
+
"RECEIVE_INTERMEDIATE_RESULTS"
|
|
3
|
+
);
|
|
4
|
+
export {
|
|
5
|
+
RECEIVE_INTERMEDIATE_RESULTS
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=receive-intermediate-results.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/receive-intermediate-results.js"],
|
|
4
|
+
"sourcesContent": ["export const RECEIVE_INTERMEDIATE_RESULTS = Symbol(\n\t'RECEIVE_INTERMEDIATE_RESULTS'\n);\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,+BAA+B;AAAA,EAC3C;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Higher-order reducer creator which substitutes the action object before
|
|
5
|
-
* passing to the original reducer.
|
|
6
|
-
*
|
|
7
|
-
* @param {AnyFunction} replacer Function mapping original action to replacement.
|
|
8
|
-
*
|
|
9
|
-
* @return {AnyFunction} Higher-order reducer.
|
|
10
|
-
*/
|
|
11
|
-
const replaceAction = replacer => reducer => (state, action) => {
|
|
1
|
+
const replaceAction = (replacer) => (reducer) => (state, action) => {
|
|
12
2
|
return reducer(state, replacer(action));
|
|
13
3
|
};
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
var replace_action_default = replaceAction;
|
|
5
|
+
export {
|
|
6
|
+
replace_action_default as default
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=replace-action.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/replace-action.js"],
|
|
4
|
+
"sourcesContent": ["/** @typedef {import('../types').AnyFunction} AnyFunction */\n\n/**\n * Higher-order reducer creator which substitutes the action object before\n * passing to the original reducer.\n *\n * @param {AnyFunction} replacer Function mapping original action to replacement.\n *\n * @return {AnyFunction} Higher-order reducer.\n */\nconst replaceAction = ( replacer ) => ( reducer ) => ( state, action ) => {\n\treturn reducer( state, replacer( action ) );\n};\n\nexport default replaceAction;\n"],
|
|
5
|
+
"mappings": "AAUA,MAAM,gBAAgB,CAAE,aAAc,CAAE,YAAa,CAAE,OAAO,WAAY;AACzE,SAAO,QAAS,OAAO,SAAU,MAAO,CAAE;AAC3C;AAEA,IAAO,yBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,32 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* If a portion of path doesn’t exist, it’s created.
|
|
4
|
-
* Arrays are created for missing index properties while objects are created
|
|
5
|
-
* for all other missing properties.
|
|
6
|
-
*
|
|
7
|
-
* Path is specified as either:
|
|
8
|
-
* - a string of properties, separated by dots, for example: "x.y".
|
|
9
|
-
* - an array of properties, for example `[ 'x', 'y' ]`.
|
|
10
|
-
*
|
|
11
|
-
* This function intentionally mutates the input object.
|
|
12
|
-
*
|
|
13
|
-
* Inspired by _.set().
|
|
14
|
-
*
|
|
15
|
-
* @see https://lodash.com/docs/4.17.15#set
|
|
16
|
-
*
|
|
17
|
-
* @todo Needs to be deduplicated with its copy in `@wordpress/edit-site`.
|
|
18
|
-
*
|
|
19
|
-
* @param {Object} object Object to modify
|
|
20
|
-
* @param {Array|string} path Path of the property to set.
|
|
21
|
-
* @param {*} value Value to set.
|
|
22
|
-
*/
|
|
23
|
-
export default function setNestedValue(object, path, value) {
|
|
24
|
-
if (!object || typeof object !== 'object') {
|
|
1
|
+
function setNestedValue(object, path, value) {
|
|
2
|
+
if (!object || typeof object !== "object") {
|
|
25
3
|
return object;
|
|
26
4
|
}
|
|
27
|
-
const normalizedPath = Array.isArray(path) ? path : path.split(
|
|
5
|
+
const normalizedPath = Array.isArray(path) ? path : path.split(".");
|
|
28
6
|
normalizedPath.reduce((acc, key, idx) => {
|
|
29
|
-
if (acc[key] ===
|
|
7
|
+
if (acc[key] === void 0) {
|
|
30
8
|
if (Number.isInteger(normalizedPath[idx + 1])) {
|
|
31
9
|
acc[key] = [];
|
|
32
10
|
} else {
|
|
@@ -40,4 +18,7 @@ export default function setNestedValue(object, path, value) {
|
|
|
40
18
|
}, object);
|
|
41
19
|
return object;
|
|
42
20
|
}
|
|
43
|
-
|
|
21
|
+
export {
|
|
22
|
+
setNestedValue as default
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=set-nested-value.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/set-nested-value.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Sets the value at path of object.\n * If a portion of path doesn\u2019t exist, it\u2019s created.\n * Arrays are created for missing index properties while objects are created\n * for all other missing properties.\n *\n * Path is specified as either:\n * - a string of properties, separated by dots, for example: \"x.y\".\n * - an array of properties, for example `[ 'x', 'y' ]`.\n *\n * This function intentionally mutates the input object.\n *\n * Inspired by _.set().\n *\n * @see https://lodash.com/docs/4.17.15#set\n *\n * @todo Needs to be deduplicated with its copy in `@wordpress/edit-site`.\n *\n * @param {Object} object Object to modify\n * @param {Array|string} path Path of the property to set.\n * @param {*} value Value to set.\n */\nexport default function setNestedValue( object, path, value ) {\n\tif ( ! object || typeof object !== 'object' ) {\n\t\treturn object;\n\t}\n\n\tconst normalizedPath = Array.isArray( path ) ? path : path.split( '.' );\n\n\tnormalizedPath.reduce( ( acc, key, idx ) => {\n\t\tif ( acc[ key ] === undefined ) {\n\t\t\tif ( Number.isInteger( normalizedPath[ idx + 1 ] ) ) {\n\t\t\t\tacc[ key ] = [];\n\t\t\t} else {\n\t\t\t\tacc[ key ] = {};\n\t\t\t}\n\t\t}\n\t\tif ( idx === normalizedPath.length - 1 ) {\n\t\t\tacc[ key ] = value;\n\t\t}\n\t\treturn acc[ key ];\n\t}, object );\n\n\treturn object;\n}\n"],
|
|
5
|
+
"mappings": "AAsBe,SAAR,eAAiC,QAAQ,MAAM,OAAQ;AAC7D,MAAK,CAAE,UAAU,OAAO,WAAW,UAAW;AAC7C,WAAO;AAAA,EACR;AAEA,QAAM,iBAAiB,MAAM,QAAS,IAAK,IAAI,OAAO,KAAK,MAAO,GAAI;AAEtE,iBAAe,OAAQ,CAAE,KAAK,KAAK,QAAS;AAC3C,QAAK,IAAK,GAAI,MAAM,QAAY;AAC/B,UAAK,OAAO,UAAW,eAAgB,MAAM,CAAE,CAAE,GAAI;AACpD,YAAK,GAAI,IAAI,CAAC;AAAA,MACf,OAAO;AACN,YAAK,GAAI,IAAI,CAAC;AAAA,MACf;AAAA,IACD;AACA,QAAK,QAAQ,eAAe,SAAS,GAAI;AACxC,UAAK,GAAI,IAAI;AAAA,IACd;AACA,WAAO,IAAK,GAAI;AAAA,EACjB,GAAG,MAAO;AAEV,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,22 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const ALLOWED_RESOURCE_ACTIONS = [
|
|
2
|
+
"create",
|
|
3
|
+
"read",
|
|
4
|
+
"update",
|
|
5
|
+
"delete"
|
|
6
|
+
];
|
|
7
|
+
function getUserPermissionsFromAllowHeader(allowedMethods) {
|
|
3
8
|
const permissions = {};
|
|
4
9
|
if (!allowedMethods) {
|
|
5
10
|
return permissions;
|
|
6
11
|
}
|
|
7
12
|
const methods = {
|
|
8
|
-
create:
|
|
9
|
-
read:
|
|
10
|
-
update:
|
|
11
|
-
delete:
|
|
13
|
+
create: "POST",
|
|
14
|
+
read: "GET",
|
|
15
|
+
update: "PUT",
|
|
16
|
+
delete: "DELETE"
|
|
12
17
|
};
|
|
13
18
|
for (const [actionName, methodName] of Object.entries(methods)) {
|
|
14
19
|
permissions[actionName] = allowedMethods.includes(methodName);
|
|
15
20
|
}
|
|
16
21
|
return permissions;
|
|
17
22
|
}
|
|
18
|
-
|
|
19
|
-
const key = (typeof resource ===
|
|
23
|
+
function getUserPermissionCacheKey(action, resource, id) {
|
|
24
|
+
const key = (typeof resource === "object" ? [action, resource.kind, resource.name, resource.id] : [action, resource, id]).filter(Boolean).join("/");
|
|
20
25
|
return key;
|
|
21
26
|
}
|
|
22
|
-
|
|
27
|
+
export {
|
|
28
|
+
ALLOWED_RESOURCE_ACTIONS,
|
|
29
|
+
getUserPermissionCacheKey,
|
|
30
|
+
getUserPermissionsFromAllowHeader
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=user-permissions.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/user-permissions.js"],
|
|
4
|
+
"sourcesContent": ["export const ALLOWED_RESOURCE_ACTIONS = [\n\t'create',\n\t'read',\n\t'update',\n\t'delete',\n];\n\nexport function getUserPermissionsFromAllowHeader( allowedMethods ) {\n\tconst permissions = {};\n\tif ( ! allowedMethods ) {\n\t\treturn permissions;\n\t}\n\n\tconst methods = {\n\t\tcreate: 'POST',\n\t\tread: 'GET',\n\t\tupdate: 'PUT',\n\t\tdelete: 'DELETE',\n\t};\n\tfor ( const [ actionName, methodName ] of Object.entries( methods ) ) {\n\t\tpermissions[ actionName ] = allowedMethods.includes( methodName );\n\t}\n\n\treturn permissions;\n}\n\nexport function getUserPermissionCacheKey( action, resource, id ) {\n\tconst key = (\n\t\ttypeof resource === 'object'\n\t\t\t? [ action, resource.kind, resource.name, resource.id ]\n\t\t\t: [ action, resource, id ]\n\t)\n\t\t.filter( Boolean )\n\t\t.join( '/' );\n\n\treturn key;\n}\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,2BAA2B;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEO,SAAS,kCAAmC,gBAAiB;AACnE,QAAM,cAAc,CAAC;AACrB,MAAK,CAAE,gBAAiB;AACvB,WAAO;AAAA,EACR;AAEA,QAAM,UAAU;AAAA,IACf,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,EACT;AACA,aAAY,CAAE,YAAY,UAAW,KAAK,OAAO,QAAS,OAAQ,GAAI;AACrE,gBAAa,UAAW,IAAI,eAAe,SAAU,UAAW;AAAA,EACjE;AAEA,SAAO;AACR;AAEO,SAAS,0BAA2B,QAAQ,UAAU,IAAK;AACjE,QAAM,OACL,OAAO,aAAa,WACjB,CAAE,QAAQ,SAAS,MAAM,SAAS,MAAM,SAAS,EAAG,IACpD,CAAE,QAAQ,UAAU,EAAG,GAEzB,OAAQ,OAAQ,EAChB,KAAM,GAAI;AAEZ,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,30 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Given a function, returns an enhanced function which caches the result and
|
|
3
|
-
* tracks in WeakMap. The result is only cached if the original function is
|
|
4
|
-
* passed a valid object-like argument (requirement for WeakMap key).
|
|
5
|
-
*
|
|
6
|
-
* @param {Function} fn Original function.
|
|
7
|
-
*
|
|
8
|
-
* @return {Function} Enhanced caching function.
|
|
9
|
-
*/
|
|
10
1
|
function withWeakMapCache(fn) {
|
|
11
|
-
const cache = new WeakMap();
|
|
12
|
-
return key => {
|
|
2
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
return (key) => {
|
|
13
4
|
let value;
|
|
14
5
|
if (cache.has(key)) {
|
|
15
6
|
value = cache.get(key);
|
|
16
7
|
} else {
|
|
17
8
|
value = fn(key);
|
|
18
|
-
|
|
19
|
-
// Can reach here if key is not valid for WeakMap, since `has`
|
|
20
|
-
// will return false for invalid key. Since `set` will throw,
|
|
21
|
-
// ensure that key is valid before setting into cache.
|
|
22
|
-
if (key !== null && typeof key === 'object') {
|
|
9
|
+
if (key !== null && typeof key === "object") {
|
|
23
10
|
cache.set(key, value);
|
|
24
11
|
}
|
|
25
12
|
}
|
|
26
13
|
return value;
|
|
27
14
|
};
|
|
28
15
|
}
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
var with_weak_map_cache_default = withWeakMapCache;
|
|
17
|
+
export {
|
|
18
|
+
with_weak_map_cache_default as default
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=with-weak-map-cache.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/with-weak-map-cache.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Given a function, returns an enhanced function which caches the result and\n * tracks in WeakMap. The result is only cached if the original function is\n * passed a valid object-like argument (requirement for WeakMap key).\n *\n * @param {Function} fn Original function.\n *\n * @return {Function} Enhanced caching function.\n */\nfunction withWeakMapCache( fn ) {\n\tconst cache = new WeakMap();\n\n\treturn ( key ) => {\n\t\tlet value;\n\t\tif ( cache.has( key ) ) {\n\t\t\tvalue = cache.get( key );\n\t\t} else {\n\t\t\tvalue = fn( key );\n\n\t\t\t// Can reach here if key is not valid for WeakMap, since `has`\n\t\t\t// will return false for invalid key. Since `set` will throw,\n\t\t\t// ensure that key is valid before setting into cache.\n\t\t\tif ( key !== null && typeof key === 'object' ) {\n\t\t\t\tcache.set( key, value );\n\t\t\t}\n\t\t}\n\n\t\treturn value;\n\t};\n}\n\nexport default withWeakMapCache;\n"],
|
|
5
|
+
"mappings": "AASA,SAAS,iBAAkB,IAAK;AAC/B,QAAM,QAAQ,oBAAI,QAAQ;AAE1B,SAAO,CAAE,QAAS;AACjB,QAAI;AACJ,QAAK,MAAM,IAAK,GAAI,GAAI;AACvB,cAAQ,MAAM,IAAK,GAAI;AAAA,IACxB,OAAO;AACN,cAAQ,GAAI,GAAI;AAKhB,UAAK,QAAQ,QAAQ,OAAO,QAAQ,UAAW;AAC9C,cAAM,IAAK,KAAK,KAAM;AAAA,MACvB;AAAA,IACD;AAEA,WAAO;AAAA,EACR;AACD;AAEA,IAAO,8BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.js"],"names":[],"mappings":"AAwBA;;;;;;;;;;GAUG;AACH,0CALW,MAAM,SACN,WAAY,OAUtB;AAED;;;;;;;;;GASG;AACH,0DAKC;AAED;;;;;;GAMG;AACH,kDAKC;AAED;;;;;;;;;;;GAWG;AACH,2CATW,MAAM,QACN,MAAM,WACN,WAAY,SACZ,UAAO,oBACN,OAAO,OAAA,sBACR,UAAO,QACP,UAAO,OA6CjB;AAED;;;;;;;;;GASG;AACH,4DAKC;AAED;;;;;;;;;GASG;AACH,kFAJW,MAAM,OAWhB;AAED;;;;;;;;;;GAUG;AACH,uEALW,MAAM,0BAchB;AAED;;;;;;;;;;GAUG;AACH,4EALW,MAAM,0BAchB;AAED;;;;;;GAMG;AACH,4CAQC;AAED;;;;;;;;;;;;GAYG;AACH,4DALW,MAAM,yBAkBhB;AAED;;;;;;;;;;;GAWG;AACH,yCALW,MAAM,WACN,GAAC,OAUX;
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.js"],"names":[],"mappings":"AAwBA;;;;;;;;;;GAUG;AACH,0CALW,MAAM,SACN,WAAY,OAUtB;AAED;;;;;;;;;GASG;AACH,0DAKC;AAED;;;;;;GAMG;AACH,kDAKC;AAED;;;;;;;;;;;GAWG;AACH,2CATW,MAAM,QACN,MAAM,WACN,WAAY,SACZ,UAAO,oBACN,OAAO,OAAA,sBACR,UAAO,QACP,UAAO,OA6CjB;AAED;;;;;;;;;GASG;AACH,4DAKC;AAED;;;;;;;;;GASG;AACH,kFAJW,MAAM,OAWhB;AAED;;;;;;;;;;GAUG;AACH,uEALW,MAAM,0BAchB;AAED;;;;;;;;;;GAUG;AACH,4EALW,MAAM,0BAchB;AAED;;;;;;GAMG;AACH,4CAQC;AAED;;;;;;;;;;;;GAYG;AACH,4DALW,MAAM,yBAkBhB;AAED;;;;;;;;;;;GAWG;AACH,yCALW,MAAM,WACN,GAAC,OAUX;AAknBD;;;;;;;;GAQG;AACH,+DAJW,OAAO,OAWjB;AAED;;;;;;;;;;;GAWG;AACH,2CALW,MAAM,aACN,OAAO,OAUjB;AAED;;;;;;;;;;;;;;GAcG;AACH;;QAKC;AAED;;;;;;;;;;;GAWG;AACH,yCALW,MAAM,aACN,WAAY,OAUtB;AAED;;;;;;GAMG;AACH,wDAHW,OAAO,OAQjB;AAED;;;;;;;GAOG;AACH,iEAJW,MAAM,OAUhB;AA7sBM,yCAZI,MAAM,QACN,MAAM,YACN,MAAM,GAAC,MAAM,SACb,UAAO,sCAGf;IAAgC,eAAe;IAGf,YAAY;CAE9C;;;mCAkFC;AAeK,uCATI,MAAM,QACN,MAAM,YACN,MAAM,GAAC,MAAM,wBAGrB;IAAgC,UAAU;CAE1C,OAwED;AAMK;;;WAWL;AAMK;;;WAWL;AAOK,iDAIL;AAgBK,uCAXI,MAAM,QACN,MAAM,gEAGd;IAA2B,UAAU;IACV,eAAe;IAGf,YAAY;CAEzC;;;;mBA2OC;AAwBK,sDAHK,CAAC,SAAS,KAAQ,iBAAY,CAuCxC;AAUK,6CALI,MAAM,QACN,MAAM,2BAEN,eAAO;;;;mBAyBhB;AAWK,6DANI,MAAM,QACN,MAAM,YACN,MAAM,GAAC,MAAM;;;;mBA8CtB;AA2HK,uCARI,MAAM,QACN,MAAM,aACN,MAAM,GAAC,MAAM,WACb,WAAY,SACZ,UAAO,oBACN,OAAO,OAAA,qBACR,UAAO;;;oBA0BhB"}
|