Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core-data] Document and add types for dynamic actions and selectors. #67668

Merged
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d06bc58
[core-data] Document and add types for dynamic actions and selectors.
manzoorwanijk Nov 14, 2024
b3778a3
Now that things are typed, we don't expect an error
manzoorwanijk Nov 14, 2024
0b72ca3
Put definitions first to allow it be overridden
manzoorwanijk Nov 14, 2024
3928817
Use namespaces to avoid direct imports
manzoorwanijk Nov 14, 2024
9280cce
Merge remote-tracking branch 'upstream/trunk' into update/document-dy…
manzoorwanijk Nov 15, 2024
9f6b4e3
Merge branch 'trunk' into update/document-dynamic-actions-selectors-f…
manzoorwanijk Dec 11, 2024
c583805
Remove unnecessary `ts-expect-error`
manzoorwanijk Dec 11, 2024
8bf0ea5
Add notice for new entities
manzoorwanijk Dec 12, 2024
0de4023
Merge branch 'trunk' into update/document-dynamic-actions-selectors-f…
manzoorwanijk Dec 12, 2024
0096e00
Use existing Type instead of new PostType
manzoorwanijk Dec 18, 2024
a6612e6
Dynamically create entity selectors and actions
manzoorwanijk Dec 18, 2024
bea1374
Remove unnecessary comment
manzoorwanijk Dec 18, 2024
5293486
Export base type as UnstableBase
manzoorwanijk Dec 18, 2024
105423a
Add template related types to base
manzoorwanijk Dec 18, 2024
1a45990
Get rid of one more @ts-expect-error
manzoorwanijk Dec 18, 2024
fa2a98b
Fix Site, Status and Revision types
manzoorwanijk Dec 18, 2024
5a09cec
Merge branch 'trunk' into update/document-dynamic-actions-selectors-f…
manzoorwanijk Dec 27, 2024
1f5bd67
Add GlobalStyles
manzoorwanijk Jan 3, 2025
ca6550a
Merge branch 'trunk' into update/document-dynamic-actions-selectors-f…
manzoorwanijk Jan 3, 2025
7b23643
Disable plural for global styles
manzoorwanijk Jan 3, 2025
465521b
Add a note about "GlobalStyles"
manzoorwanijk Jan 3, 2025
a4fea0b
Fix type for gmt_offset
manzoorwanijk Jan 3, 2025
70f681e
Export and use TemplatePartArea
manzoorwanijk Jan 3, 2025
1af6f51
Merge branch 'trunk' into update/document-dynamic-actions-selectors-f…
manzoorwanijk Jan 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions packages/core-data/src/dynamic-actions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/**
* Internal dependencies
*/
import type * as ET from './entity-types';

export namespace DynamicActions {
type DeleteRecordsHttpQuery = Record< string, any >;

type SaveRecordOptions = {
throwOnError?: boolean;
};

type DeleteRecordOptions = {
throwOnError?: boolean;
};

/**
* Save the site settings
*
* @param data The site settings
* @param options
*/
export declare function saveSite(
data: Partial< ET.Settings >,
options?: SaveRecordOptions
): Promise< void >;

/**
* Save comment
*
* @param data The comment data
* @param options
*/
export declare function saveComment(
manzoorwanijk marked this conversation as resolved.
Show resolved Hide resolved
data: { id: number } & Partial< ET.Comment >,
options?: SaveRecordOptions
): Promise< void >;

/**
* Save media item
*
* @param data The media item
* @param options
*/
export declare function saveMedia(
data: { id: number } & Partial< ET.Attachment >,
options?: SaveRecordOptions
): Promise< void >;

/**
* Save user
*
* @param data The user data
* @param options
*/
export declare function saveUser(
data: { id: number } & Partial< ET.User >,
options?: SaveRecordOptions
): Promise< void >;

/**
* Delete a comment
*
* @param id The comment ID
* @param query Special query parameters for the DELETE API call
* @param options Delete options
*/
export declare function deleteComment(
id: number,
query?: DeleteRecordsHttpQuery,
options?: DeleteRecordOptions
): Promise< void >;

/**
* Delete a media item
*
* @param id The media item ID
* @param query Special query parameters for the DELETE API call
* @param options Delete options
*/
export declare function deleteMedia(
id: number,
query?: DeleteRecordsHttpQuery,
options?: DeleteRecordOptions
): Promise< void >;

/**
* Delete a user
*
* @param id The user ID
* @param query Special query parameters for the DELETE API call
* @param options Delete options
*/
export declare function deleteUser(
id: number,
query?: DeleteRecordsHttpQuery,
options?: DeleteRecordOptions
): Promise< void >;
}
Loading
Loading