@salesforce/lds-drafts 1.124.2 → 1.124.3
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/dist/ldsDrafts.js +1713 -1713
- package/dist/{DraftAwareAdapter.d.ts → types/DraftAwareAdapter.d.ts} +6 -6
- package/dist/{DraftFetchResponse.d.ts → types/DraftFetchResponse.d.ts} +28 -28
- package/dist/{DraftIdMapping.d.ts → types/DraftIdMapping.d.ts} +12 -12
- package/dist/{DraftManager.d.ts → types/DraftManager.d.ts} +161 -161
- package/dist/{DraftQueue.d.ts → types/DraftQueue.d.ts} +233 -233
- package/dist/{DraftStore.d.ts → types/DraftStore.d.ts} +12 -12
- package/dist/{DraftSynthesisError.d.ts → types/DraftSynthesisError.d.ts} +6 -6
- package/dist/{DurableDraftQueue.d.ts → types/DurableDraftQueue.d.ts} +52 -52
- package/dist/{DurableDraftStore.d.ts → types/DurableDraftStore.d.ts} +44 -44
- package/dist/{actionHandlers → types/actionHandlers}/AbstractResourceRequestActionHandler.d.ts +53 -53
- package/dist/{actionHandlers → types/actionHandlers}/ActionHandler.d.ts +149 -149
- package/dist/{actionHandlers → types/actionHandlers}/CustomActionHandler.d.ts +33 -33
- package/dist/{main.d.ts → types/main.d.ts} +15 -15
- package/dist/{makeEnvironmentDraftAware.d.ts → types/makeEnvironmentDraftAware.d.ts} +4 -4
- package/dist/{utils → types/utils}/adapter.d.ts +2 -2
- package/dist/{utils → types/utils}/clone.d.ts +1 -1
- package/dist/{utils → types/utils}/id.d.ts +5 -5
- package/dist/{utils → types/utils}/language.d.ts +24 -24
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { DispatchResourceRequestContext, Luvio, Snapshot } from '@luvio/engine';
|
|
2
|
-
import type { AbstractResourceRequestActionHandler } from './actionHandlers/AbstractResourceRequestActionHandler';
|
|
3
|
-
export type AdapterBuildNetworkSnapshot<Config, Response> = (luvio: Luvio, config: Config, dispatchResourceRequestContext?: DispatchResourceRequestContext) => Promise<Snapshot<Response>>;
|
|
4
|
-
export declare function buildLuvioOverrideForDraftAdapters<ResponseType = unknown, DraftMetadata = unknown>(luvio: Luvio, handler: AbstractResourceRequestActionHandler<ResponseType, DraftMetadata>, extractTargetIdFromCacheKey: (cacheKey: string) => string | undefined, options?: {
|
|
5
|
-
forDeleteAdapter?: boolean;
|
|
6
|
-
}): Luvio;
|
|
1
|
+
import type { DispatchResourceRequestContext, Luvio, Snapshot } from '@luvio/engine';
|
|
2
|
+
import type { AbstractResourceRequestActionHandler } from './actionHandlers/AbstractResourceRequestActionHandler';
|
|
3
|
+
export type AdapterBuildNetworkSnapshot<Config, Response> = (luvio: Luvio, config: Config, dispatchResourceRequestContext?: DispatchResourceRequestContext) => Promise<Snapshot<Response>>;
|
|
4
|
+
export declare function buildLuvioOverrideForDraftAdapters<ResponseType = unknown, DraftMetadata = unknown>(luvio: Luvio, handler: AbstractResourceRequestActionHandler<ResponseType, DraftMetadata>, extractTargetIdFromCacheKey: (cacheKey: string) => string | undefined, options?: {
|
|
5
|
+
forDeleteAdapter?: boolean;
|
|
6
|
+
}): Luvio;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import type { FetchErrorResponse, FetchResponse, Headers } from '@luvio/engine';
|
|
2
|
-
import { HttpStatusCode } from '@luvio/engine';
|
|
3
|
-
import type { DraftSynthesisErrorType, DraftSynthesisError } from './DraftSynthesisError';
|
|
4
|
-
export declare const DRAFT_ERROR_CODE = "DRAFT_ERROR";
|
|
5
|
-
export declare class DraftFetchResponse<T> implements FetchResponse<T> {
|
|
6
|
-
status: HttpStatusCode;
|
|
7
|
-
body: T;
|
|
8
|
-
headers: Headers;
|
|
9
|
-
constructor(status: HttpStatusCode, body: T);
|
|
10
|
-
get statusText(): string;
|
|
11
|
-
get ok(): boolean;
|
|
12
|
-
}
|
|
13
|
-
export declare class DraftErrorFetchResponse implements FetchErrorResponse {
|
|
14
|
-
status: HttpStatusCode;
|
|
15
|
-
body: unknown;
|
|
16
|
-
ok: boolean;
|
|
17
|
-
headers: Headers;
|
|
18
|
-
errorType: 'fetchResponse';
|
|
19
|
-
constructor(status: HttpStatusCode.BadRequest | HttpStatusCode.ServerError | HttpStatusCode.NotFound, body: unknown);
|
|
20
|
-
get statusText(): string;
|
|
21
|
-
}
|
|
22
|
-
export declare function createOkResponse<T>(body: T): DraftFetchResponse<T>;
|
|
23
|
-
export declare function createBadRequestResponse(body: unknown): DraftErrorFetchResponse;
|
|
24
|
-
export declare function createNotFoundResponse(body: unknown): DraftErrorFetchResponse;
|
|
25
|
-
export declare function transformErrorToDraftSynthesisError(error: Error | DraftSynthesisError<unknown>): DraftErrorFetchResponse;
|
|
26
|
-
export declare function createDraftSynthesisErrorResponse(message?: string, errorType?: DraftSynthesisErrorType): DraftErrorFetchResponse;
|
|
27
|
-
export declare function createDeletedResponse(): DraftFetchResponse<void>;
|
|
28
|
-
export declare function createInternalErrorResponse(): DraftErrorFetchResponse;
|
|
1
|
+
import type { FetchErrorResponse, FetchResponse, Headers } from '@luvio/engine';
|
|
2
|
+
import { HttpStatusCode } from '@luvio/engine';
|
|
3
|
+
import type { DraftSynthesisErrorType, DraftSynthesisError } from './DraftSynthesisError';
|
|
4
|
+
export declare const DRAFT_ERROR_CODE = "DRAFT_ERROR";
|
|
5
|
+
export declare class DraftFetchResponse<T> implements FetchResponse<T> {
|
|
6
|
+
status: HttpStatusCode;
|
|
7
|
+
body: T;
|
|
8
|
+
headers: Headers;
|
|
9
|
+
constructor(status: HttpStatusCode, body: T);
|
|
10
|
+
get statusText(): string;
|
|
11
|
+
get ok(): boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare class DraftErrorFetchResponse implements FetchErrorResponse {
|
|
14
|
+
status: HttpStatusCode;
|
|
15
|
+
body: unknown;
|
|
16
|
+
ok: boolean;
|
|
17
|
+
headers: Headers;
|
|
18
|
+
errorType: 'fetchResponse';
|
|
19
|
+
constructor(status: HttpStatusCode.BadRequest | HttpStatusCode.ServerError | HttpStatusCode.NotFound, body: unknown);
|
|
20
|
+
get statusText(): string;
|
|
21
|
+
}
|
|
22
|
+
export declare function createOkResponse<T>(body: T): DraftFetchResponse<T>;
|
|
23
|
+
export declare function createBadRequestResponse(body: unknown): DraftErrorFetchResponse;
|
|
24
|
+
export declare function createNotFoundResponse(body: unknown): DraftErrorFetchResponse;
|
|
25
|
+
export declare function transformErrorToDraftSynthesisError(error: Error | DraftSynthesisError<unknown>): DraftErrorFetchResponse;
|
|
26
|
+
export declare function createDraftSynthesisErrorResponse(message?: string, errorType?: DraftSynthesisErrorType): DraftErrorFetchResponse;
|
|
27
|
+
export declare function createDeletedResponse(): DraftFetchResponse<void>;
|
|
28
|
+
export declare function createInternalErrorResponse(): DraftErrorFetchResponse;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { DurableStore } from '@luvio/environments';
|
|
2
|
-
export interface DraftKeyMapping {
|
|
3
|
-
draftKey: string;
|
|
4
|
-
canonicalKey: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const DRAFT_ID_MAPPINGS_SEGMENT = "DRAFT_ID_MAPPINGS";
|
|
7
|
-
export declare function generateDraftIdMappingKey(draftIdMapping: DraftKeyMapping): string;
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* @param mappingIds (optional) requested mapping ids, if undefined all will be retrieved
|
|
11
|
-
*/
|
|
12
|
-
export declare function getDraftIdMappings(durableStore: DurableStore, mappingIds?: string[]): Promise<DraftKeyMapping[]>;
|
|
1
|
+
import type { DurableStore } from '@luvio/environments';
|
|
2
|
+
export interface DraftKeyMapping {
|
|
3
|
+
draftKey: string;
|
|
4
|
+
canonicalKey: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const DRAFT_ID_MAPPINGS_SEGMENT = "DRAFT_ID_MAPPINGS";
|
|
7
|
+
export declare function generateDraftIdMappingKey(draftIdMapping: DraftKeyMapping): string;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param mappingIds (optional) requested mapping ids, if undefined all will be retrieved
|
|
11
|
+
*/
|
|
12
|
+
export declare function getDraftIdMappings(durableStore: DurableStore, mappingIds?: string[]): Promise<DraftKeyMapping[]>;
|
|
@@ -1,161 +1,161 @@
|
|
|
1
|
-
import type { CustomActionResult } from './actionHandlers/CustomActionHandler';
|
|
2
|
-
import type { DraftActionStatus, DraftQueue, DraftActionMetadata } from './DraftQueue';
|
|
3
|
-
import { DraftQueueState } from './DraftQueue';
|
|
4
|
-
/**
|
|
5
|
-
* Representation of the current state of the draft queue.
|
|
6
|
-
* Includes the overall state as well as a list of draft
|
|
7
|
-
* items that are currently in the queue.
|
|
8
|
-
*/
|
|
9
|
-
export interface DraftManagerState {
|
|
10
|
-
queueState: DraftQueueState;
|
|
11
|
-
items: DraftQueueItem[];
|
|
12
|
-
}
|
|
13
|
-
export type DraftQueueItemMetadata = {
|
|
14
|
-
[key: string]: string;
|
|
15
|
-
};
|
|
16
|
-
export type DraftManagerCustomActionExecutor = (item: DraftQueueItem, completed: (result: CustomActionResult) => void) => void;
|
|
17
|
-
/**
|
|
18
|
-
* An item in the draft queue that loosely maps to
|
|
19
|
-
* a DraftAction
|
|
20
|
-
*/
|
|
21
|
-
export interface DraftQueueItem {
|
|
22
|
-
/** The id of the Draft Action Item */
|
|
23
|
-
id: string;
|
|
24
|
-
/** The unique id of the target item */
|
|
25
|
-
targetId?: string;
|
|
26
|
-
/** The current status of this item */
|
|
27
|
-
state: DraftActionStatus;
|
|
28
|
-
/** The type of operation this item represents */
|
|
29
|
-
operationType: DraftActionOperationType;
|
|
30
|
-
/** Timestamp as unix epoch time */
|
|
31
|
-
timestamp: number;
|
|
32
|
-
/** undefined unless item is in an error state */
|
|
33
|
-
error?: undefined | DraftQueueItemError;
|
|
34
|
-
/** The stored metadata for the draft queue item */
|
|
35
|
-
metadata: DraftQueueItemMetadata;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* An error of a draft action that was submitted and failed
|
|
39
|
-
*/
|
|
40
|
-
export interface DraftQueueItemError {
|
|
41
|
-
/** The status code of the response */
|
|
42
|
-
status: number;
|
|
43
|
-
/** The headers of the response */
|
|
44
|
-
headers: {
|
|
45
|
-
[key: string]: string;
|
|
46
|
-
};
|
|
47
|
-
/** A flag representing the status of the response */
|
|
48
|
-
ok: boolean;
|
|
49
|
-
/** A summary of the response */
|
|
50
|
-
statusText: string;
|
|
51
|
-
/** A stringified object representing the body of the response */
|
|
52
|
-
bodyString: string;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Denotes what kind of operation a DraftQueueItem represents.
|
|
56
|
-
*/
|
|
57
|
-
export declare enum DraftActionOperationType {
|
|
58
|
-
Create = "create",
|
|
59
|
-
Update = "update",
|
|
60
|
-
Delete = "delete",
|
|
61
|
-
Custom = "custom"
|
|
62
|
-
}
|
|
63
|
-
export declare enum DraftQueueOperationType {
|
|
64
|
-
ItemAdded = "added",
|
|
65
|
-
ItemDeleted = "deleted",
|
|
66
|
-
ItemCompleted = "completed",
|
|
67
|
-
ItemFailed = "failed",
|
|
68
|
-
ItemUpdated = "updated",
|
|
69
|
-
QueueStarted = "started",
|
|
70
|
-
QueueStopped = "stopped"
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* A closure that draft queue change listeners pass to
|
|
74
|
-
* receive updates when the draft queue changes.
|
|
75
|
-
*/
|
|
76
|
-
export declare type DraftQueueListener = (state: DraftManagerState, operationType: DraftQueueOperationType, queueItem?: DraftQueueItem) => void;
|
|
77
|
-
export declare class DraftManager {
|
|
78
|
-
private draftQueue;
|
|
79
|
-
private listeners;
|
|
80
|
-
constructor(draftQueue: DraftQueue);
|
|
81
|
-
private shouldEmitDraftEvent;
|
|
82
|
-
private draftQueueEventTypeToOperationType;
|
|
83
|
-
private draftQueueStateToOperationType;
|
|
84
|
-
/**
|
|
85
|
-
* Enqueue a custom action on the DraftQueue for a handler
|
|
86
|
-
* @param handler the handler's id
|
|
87
|
-
* @param targetId
|
|
88
|
-
* @param tag - the key to group with in durable store
|
|
89
|
-
* @param metadata
|
|
90
|
-
* @returns
|
|
91
|
-
*/
|
|
92
|
-
addCustomAction(handler: string, targetId: string, tag: string, metadata: DraftActionMetadata): Promise<DraftQueueItem>;
|
|
93
|
-
/**
|
|
94
|
-
* Get the current state of each of the DraftActions in the DraftQueue
|
|
95
|
-
* @returns A promise of an array of the state of each item in the DraftQueue
|
|
96
|
-
*/
|
|
97
|
-
getQueue(): Promise<DraftManagerState>;
|
|
98
|
-
/**
|
|
99
|
-
* Starts the draft queue and begins processing the first item in the queue.
|
|
100
|
-
*/
|
|
101
|
-
startQueue(): Promise<void>;
|
|
102
|
-
/**
|
|
103
|
-
* Stops the draft queue from processing more draft items after any current
|
|
104
|
-
* in progress items are finished.
|
|
105
|
-
*/
|
|
106
|
-
stopQueue(): Promise<void>;
|
|
107
|
-
/**
|
|
108
|
-
* Subscribes the listener to changes to the draft queue.
|
|
109
|
-
*
|
|
110
|
-
* Returns a closure to invoke in order to unsubscribe the listener
|
|
111
|
-
* from changes to the draft queue.
|
|
112
|
-
*
|
|
113
|
-
* @param listener The listener closure to subscribe to changes
|
|
114
|
-
*/
|
|
115
|
-
registerDraftQueueChangedListener(listener: DraftQueueListener): () => Promise<void>;
|
|
116
|
-
/**
|
|
117
|
-
* Creates a custom action handler for the given handler
|
|
118
|
-
* @param handlerId
|
|
119
|
-
* @param executor
|
|
120
|
-
* @returns
|
|
121
|
-
*/
|
|
122
|
-
setCustomActionExecutor(handlerId: string, executor: DraftManagerCustomActionExecutor): Promise<() => Promise<void>>;
|
|
123
|
-
private buildDraftQueueItem;
|
|
124
|
-
private callListeners;
|
|
125
|
-
/**
|
|
126
|
-
* Removes the draft action identified by actionId from the draft queue.
|
|
127
|
-
*
|
|
128
|
-
* @param actionId The action identifier
|
|
129
|
-
*
|
|
130
|
-
* @returns The current state of the draft queue
|
|
131
|
-
*/
|
|
132
|
-
removeDraftAction(actionId: string): Promise<DraftManagerState>;
|
|
133
|
-
/**
|
|
134
|
-
* Replaces the resource request of `withAction` for the resource request
|
|
135
|
-
* of `actionId`. Action ids cannot be equal. Both actions must be acting
|
|
136
|
-
* on the same target object, and neither can currently be in progress.
|
|
137
|
-
*
|
|
138
|
-
* @param actionId The id of the draft action to replace
|
|
139
|
-
* @param withActionId The id of the draft action that will replace the other
|
|
140
|
-
*/
|
|
141
|
-
replaceAction(actionId: string, withActionId: string): Promise<DraftQueueItem>;
|
|
142
|
-
/**
|
|
143
|
-
* Merges two actions into a single target action. The target action maintains
|
|
144
|
-
* its position in the queue, while the source action is removed from the queue.
|
|
145
|
-
* Action ids cannot be equal. Both actions must be acting on the same target
|
|
146
|
-
* object, and neither can currently be in progress.
|
|
147
|
-
*
|
|
148
|
-
* @param targetActionId The draft action id of the target action. This action
|
|
149
|
-
* will be replaced with the merged result.
|
|
150
|
-
* @param sourceActionId The draft action id to merge onto the target. This
|
|
151
|
-
* action will be removed after the merge.
|
|
152
|
-
*/
|
|
153
|
-
mergeActions(targetActionId: string, sourceActionId: string): Promise<DraftQueueItem>;
|
|
154
|
-
/**
|
|
155
|
-
* Sets the metadata object of the specified action to the
|
|
156
|
-
* provided metadata
|
|
157
|
-
* @param actionId The id of the action to set the metadata on
|
|
158
|
-
* @param metadata The metadata to set on the specified action
|
|
159
|
-
*/
|
|
160
|
-
setMetadata(actionId: string, metadata: DraftQueueItemMetadata): Promise<DraftQueueItem>;
|
|
161
|
-
}
|
|
1
|
+
import type { CustomActionResult } from './actionHandlers/CustomActionHandler';
|
|
2
|
+
import type { DraftActionStatus, DraftQueue, DraftActionMetadata } from './DraftQueue';
|
|
3
|
+
import { DraftQueueState } from './DraftQueue';
|
|
4
|
+
/**
|
|
5
|
+
* Representation of the current state of the draft queue.
|
|
6
|
+
* Includes the overall state as well as a list of draft
|
|
7
|
+
* items that are currently in the queue.
|
|
8
|
+
*/
|
|
9
|
+
export interface DraftManagerState {
|
|
10
|
+
queueState: DraftQueueState;
|
|
11
|
+
items: DraftQueueItem[];
|
|
12
|
+
}
|
|
13
|
+
export type DraftQueueItemMetadata = {
|
|
14
|
+
[key: string]: string;
|
|
15
|
+
};
|
|
16
|
+
export type DraftManagerCustomActionExecutor = (item: DraftQueueItem, completed: (result: CustomActionResult) => void) => void;
|
|
17
|
+
/**
|
|
18
|
+
* An item in the draft queue that loosely maps to
|
|
19
|
+
* a DraftAction
|
|
20
|
+
*/
|
|
21
|
+
export interface DraftQueueItem {
|
|
22
|
+
/** The id of the Draft Action Item */
|
|
23
|
+
id: string;
|
|
24
|
+
/** The unique id of the target item */
|
|
25
|
+
targetId?: string;
|
|
26
|
+
/** The current status of this item */
|
|
27
|
+
state: DraftActionStatus;
|
|
28
|
+
/** The type of operation this item represents */
|
|
29
|
+
operationType: DraftActionOperationType;
|
|
30
|
+
/** Timestamp as unix epoch time */
|
|
31
|
+
timestamp: number;
|
|
32
|
+
/** undefined unless item is in an error state */
|
|
33
|
+
error?: undefined | DraftQueueItemError;
|
|
34
|
+
/** The stored metadata for the draft queue item */
|
|
35
|
+
metadata: DraftQueueItemMetadata;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* An error of a draft action that was submitted and failed
|
|
39
|
+
*/
|
|
40
|
+
export interface DraftQueueItemError {
|
|
41
|
+
/** The status code of the response */
|
|
42
|
+
status: number;
|
|
43
|
+
/** The headers of the response */
|
|
44
|
+
headers: {
|
|
45
|
+
[key: string]: string;
|
|
46
|
+
};
|
|
47
|
+
/** A flag representing the status of the response */
|
|
48
|
+
ok: boolean;
|
|
49
|
+
/** A summary of the response */
|
|
50
|
+
statusText: string;
|
|
51
|
+
/** A stringified object representing the body of the response */
|
|
52
|
+
bodyString: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Denotes what kind of operation a DraftQueueItem represents.
|
|
56
|
+
*/
|
|
57
|
+
export declare enum DraftActionOperationType {
|
|
58
|
+
Create = "create",
|
|
59
|
+
Update = "update",
|
|
60
|
+
Delete = "delete",
|
|
61
|
+
Custom = "custom"
|
|
62
|
+
}
|
|
63
|
+
export declare enum DraftQueueOperationType {
|
|
64
|
+
ItemAdded = "added",
|
|
65
|
+
ItemDeleted = "deleted",
|
|
66
|
+
ItemCompleted = "completed",
|
|
67
|
+
ItemFailed = "failed",
|
|
68
|
+
ItemUpdated = "updated",
|
|
69
|
+
QueueStarted = "started",
|
|
70
|
+
QueueStopped = "stopped"
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A closure that draft queue change listeners pass to
|
|
74
|
+
* receive updates when the draft queue changes.
|
|
75
|
+
*/
|
|
76
|
+
export declare type DraftQueueListener = (state: DraftManagerState, operationType: DraftQueueOperationType, queueItem?: DraftQueueItem) => void;
|
|
77
|
+
export declare class DraftManager {
|
|
78
|
+
private draftQueue;
|
|
79
|
+
private listeners;
|
|
80
|
+
constructor(draftQueue: DraftQueue);
|
|
81
|
+
private shouldEmitDraftEvent;
|
|
82
|
+
private draftQueueEventTypeToOperationType;
|
|
83
|
+
private draftQueueStateToOperationType;
|
|
84
|
+
/**
|
|
85
|
+
* Enqueue a custom action on the DraftQueue for a handler
|
|
86
|
+
* @param handler the handler's id
|
|
87
|
+
* @param targetId
|
|
88
|
+
* @param tag - the key to group with in durable store
|
|
89
|
+
* @param metadata
|
|
90
|
+
* @returns
|
|
91
|
+
*/
|
|
92
|
+
addCustomAction(handler: string, targetId: string, tag: string, metadata: DraftActionMetadata): Promise<DraftQueueItem>;
|
|
93
|
+
/**
|
|
94
|
+
* Get the current state of each of the DraftActions in the DraftQueue
|
|
95
|
+
* @returns A promise of an array of the state of each item in the DraftQueue
|
|
96
|
+
*/
|
|
97
|
+
getQueue(): Promise<DraftManagerState>;
|
|
98
|
+
/**
|
|
99
|
+
* Starts the draft queue and begins processing the first item in the queue.
|
|
100
|
+
*/
|
|
101
|
+
startQueue(): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Stops the draft queue from processing more draft items after any current
|
|
104
|
+
* in progress items are finished.
|
|
105
|
+
*/
|
|
106
|
+
stopQueue(): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Subscribes the listener to changes to the draft queue.
|
|
109
|
+
*
|
|
110
|
+
* Returns a closure to invoke in order to unsubscribe the listener
|
|
111
|
+
* from changes to the draft queue.
|
|
112
|
+
*
|
|
113
|
+
* @param listener The listener closure to subscribe to changes
|
|
114
|
+
*/
|
|
115
|
+
registerDraftQueueChangedListener(listener: DraftQueueListener): () => Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Creates a custom action handler for the given handler
|
|
118
|
+
* @param handlerId
|
|
119
|
+
* @param executor
|
|
120
|
+
* @returns
|
|
121
|
+
*/
|
|
122
|
+
setCustomActionExecutor(handlerId: string, executor: DraftManagerCustomActionExecutor): Promise<() => Promise<void>>;
|
|
123
|
+
private buildDraftQueueItem;
|
|
124
|
+
private callListeners;
|
|
125
|
+
/**
|
|
126
|
+
* Removes the draft action identified by actionId from the draft queue.
|
|
127
|
+
*
|
|
128
|
+
* @param actionId The action identifier
|
|
129
|
+
*
|
|
130
|
+
* @returns The current state of the draft queue
|
|
131
|
+
*/
|
|
132
|
+
removeDraftAction(actionId: string): Promise<DraftManagerState>;
|
|
133
|
+
/**
|
|
134
|
+
* Replaces the resource request of `withAction` for the resource request
|
|
135
|
+
* of `actionId`. Action ids cannot be equal. Both actions must be acting
|
|
136
|
+
* on the same target object, and neither can currently be in progress.
|
|
137
|
+
*
|
|
138
|
+
* @param actionId The id of the draft action to replace
|
|
139
|
+
* @param withActionId The id of the draft action that will replace the other
|
|
140
|
+
*/
|
|
141
|
+
replaceAction(actionId: string, withActionId: string): Promise<DraftQueueItem>;
|
|
142
|
+
/**
|
|
143
|
+
* Merges two actions into a single target action. The target action maintains
|
|
144
|
+
* its position in the queue, while the source action is removed from the queue.
|
|
145
|
+
* Action ids cannot be equal. Both actions must be acting on the same target
|
|
146
|
+
* object, and neither can currently be in progress.
|
|
147
|
+
*
|
|
148
|
+
* @param targetActionId The draft action id of the target action. This action
|
|
149
|
+
* will be replaced with the merged result.
|
|
150
|
+
* @param sourceActionId The draft action id to merge onto the target. This
|
|
151
|
+
* action will be removed after the merge.
|
|
152
|
+
*/
|
|
153
|
+
mergeActions(targetActionId: string, sourceActionId: string): Promise<DraftQueueItem>;
|
|
154
|
+
/**
|
|
155
|
+
* Sets the metadata object of the specified action to the
|
|
156
|
+
* provided metadata
|
|
157
|
+
* @param actionId The id of the action to set the metadata on
|
|
158
|
+
* @param metadata The metadata to set on the specified action
|
|
159
|
+
*/
|
|
160
|
+
setMetadata(actionId: string, metadata: DraftQueueItemMetadata): Promise<DraftQueueItem>;
|
|
161
|
+
}
|