@lincyaw/kernel 1.0.0-rc.53 → 1.0.0-rc.54
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/package.json
CHANGED
|
@@ -18,7 +18,7 @@ export type AuthoringClientView = 'document' | 'reading' | 'presentation' | 'pro
|
|
|
18
18
|
/** Browser-owned actions that may write the saved source of the same document. */
|
|
19
19
|
export const authoringClientActionChangesSource = (type: AuthoringClientActionType): boolean => ['source.flush', 'native-history.undo', 'native-history.redo', 'recording.save', 'body-drafts.retry'].includes(type)
|
|
20
20
|
/** Local backup operations retain lease/input checks without requiring a readable current source. */
|
|
21
|
-
export const authoringClientActionUsesLocalDraft = (type: AuthoringClientActionType): boolean => ['body-drafts.inspect', 'body-drafts.read', 'body-drafts.restore', 'body-drafts.discard', 'production-drafts.inspect', 'production-drafts.read'].includes(type)
|
|
21
|
+
export const authoringClientActionUsesLocalDraft = (type: AuthoringClientActionType): boolean => ['body-drafts.inspect', 'body-drafts.read', 'body-drafts.restore', 'body-drafts.discard', 'production-drafts.inspect', 'production-drafts.read', 'comment-drafts.inspect', 'comment-drafts.read'].includes(type)
|
|
22
22
|
export const authoringClientActionMutatesDraft = (type: AuthoringClientActionType): boolean => ['production-drafts.discard', 'comment-drafts.restore', 'comment-drafts.discard', 'component-drafts.restore', 'component-drafts.discard', 'body-drafts.restore', 'body-drafts.discard', 'body-drafts.retry'].includes(type)
|
|
23
23
|
export type AuthoringClientAction =
|
|
24
24
|
| { type: 'state.read' }
|
|
@@ -28,9 +28,9 @@ export type AuthoringClientAction =
|
|
|
28
28
|
| { type: 'native-history.undo' | 'native-history.redo' }
|
|
29
29
|
| { type: 'recording.start' | 'recording.stop' | 'recording.cancel' | 'recording.save' | 'recording.listen' | 'recording.pause' }
|
|
30
30
|
| { type: 'recording.discard', confirm: true }
|
|
31
|
-
| { type: 'comment-drafts.inspect', cursor?: { after: string, token: string }, limit?: number }
|
|
31
|
+
| { type: 'comment-drafts.inspect', cursor?: { after: string, token: string }, limit?: number, details?: boolean }
|
|
32
32
|
| { type: 'comment-drafts.read', draft: ClientCommentDraftReference, offset: number, maxChars?: number }
|
|
33
|
-
| { type: 'comment-drafts.restore', draft: ClientCommentDraftReference, composerId
|
|
33
|
+
| { type: 'comment-drafts.restore', draft: ClientCommentDraftReference, composerId?: string, expectedCurrent?: ClientCommentDraftReference | null }
|
|
34
34
|
| { type: 'comment-drafts.discard', draft: ClientCommentDraftReference }
|
|
35
35
|
| { type: 'body-drafts.inspect', cursor?: { after: string, token: string }, limit?: number }
|
|
36
36
|
| { type: 'body-drafts.read', draft: ClientBodyDraftReference, offset: number, maxChars?: number }
|
|
@@ -91,6 +91,7 @@ export interface ClientCommentDraftMetadata {
|
|
|
91
91
|
active: boolean
|
|
92
92
|
discardable: boolean
|
|
93
93
|
restore?: { composerId: string, expectedCurrent: ClientCommentDraftReference | null }
|
|
94
|
+
restorable?: true
|
|
94
95
|
threadId?: string
|
|
95
96
|
commentId?: string
|
|
96
97
|
}
|
|
@@ -238,7 +239,7 @@ export const AUTHORING_CLIENT_ACTION_RESULT_SCHEMA: Schema = { oneOf: [
|
|
|
238
239
|
object({ type: { const: 'production-drafts.read' }, family: { const: 'production' }, draft: digest, format: { const: 'presmium-production-draft-json-v1' }, offset: integer, endOffset: integer, totalUtf16: integer, totalUtf8: integer, sha256: digest, jsonText: { type: 'string', maxLength: 2048 } }),
|
|
239
240
|
object({ type: { const: 'production-drafts.discard' }, family: { const: 'production' }, draft: digest, discarded: { const: true } }),
|
|
240
241
|
object({ type: { const: 'comment-drafts.inspect' }, family: { const: 'comment' }, coverage: { enum: ['stored-and-session', 'session-only'] }, skippedInvalid: integer,
|
|
241
|
-
token: digest, drafts: { type: 'array', maxItems: 10, items: object({ draft: draftReference, kind: { enum: ['create', 'reply', 'edit'] }, storage: { enum: ['durable', 'session'] }, updatedAt: integer, baseVersion: entity, composing: bool, pendingSubmission: bool, ownersKnown: bool, active: bool, discardable: bool, restore: commentRestore, threadId: entity, commentId: entity }, ['draft', 'kind', 'storage', 'updatedAt', 'baseVersion', 'composing', 'pendingSubmission', 'ownersKnown', 'active', 'discardable']) }, next: cursor }, ['type', 'family', 'coverage', 'skippedInvalid', 'token', 'drafts']),
|
|
242
|
+
token: digest, drafts: { type: 'array', maxItems: 10, items: object({ draft: draftReference, kind: { enum: ['create', 'reply', 'edit'] }, storage: { enum: ['durable', 'session'] }, updatedAt: integer, baseVersion: entity, composing: bool, pendingSubmission: bool, ownersKnown: bool, active: bool, discardable: bool, restore: commentRestore, restorable: { const: true }, threadId: entity, commentId: entity }, ['draft', 'kind', 'storage', 'updatedAt', 'baseVersion', 'composing', 'pendingSubmission', 'ownersKnown', 'active', 'discardable']) }, next: cursor }, ['type', 'family', 'coverage', 'skippedInvalid', 'token', 'drafts']),
|
|
242
243
|
object({ type: { const: 'comment-drafts.read' }, family: { const: 'comment' }, draft: draftReference, storage: { enum: ['durable', 'session'] }, format: { const: 'presmium-rich-text-json-v1' }, offset: integer, endOffset: integer, totalUtf16: integer, totalUtf8: integer, sha256: digest, jsonText: { type: 'string', maxLength: 2048 } }),
|
|
243
244
|
object({ type: { const: 'comment-drafts.restore' }, family: { const: 'comment' }, draft: draftReference, composerId: id, restored: draftReference, preservedCurrent: nullableCommentReference, targetState: { enum: ['current', 'changed'] } }),
|
|
244
245
|
object({ type: { const: 'comment-drafts.discard' }, family: { const: 'comment' }, draft: draftReference, discarded: { const: true } }),
|
|
@@ -271,9 +272,12 @@ export const AUTHORING_CLIENT_ACTION_SCHEMA: Schema = { oneOf: [
|
|
|
271
272
|
object({ type: { const: 'production-drafts.inspect' }, cursor, limit: { type: 'integer', minimum: 1, maximum: 10 } }, ['type']),
|
|
272
273
|
object({ type: { const: 'production-drafts.read' }, draft: digest, offset: integer, maxChars: { type: 'integer', minimum: 2, maximum: 2048 } }, ['type', 'draft', 'offset']),
|
|
273
274
|
action('production-drafts.discard', { draft: digest, confirm: { const: true } }),
|
|
274
|
-
object({ type: { const: 'comment-drafts.inspect' }, cursor, limit: { type: 'integer', minimum: 1, maximum: 10 } }, ['type']),
|
|
275
|
+
object({ type: { const: 'comment-drafts.inspect' }, cursor, limit: { type: 'integer', minimum: 1, maximum: 10 }, details: bool }, ['type']),
|
|
275
276
|
object({ type: { const: 'comment-drafts.read' }, draft: draftReference, offset: integer, maxChars: { type: 'integer', minimum: 2, maximum: 2048 } }, ['type', 'draft', 'offset']),
|
|
276
|
-
|
|
277
|
+
{ ...object({ type: { const: 'comment-drafts.restore' }, draft: draftReference,
|
|
278
|
+
composerId: { ...id, description: 'Advanced: provide together with expectedCurrent; omit both to select the unique native recovery target.' },
|
|
279
|
+
expectedCurrent: { ...nullableCommentReference, description: 'Advanced: provide together with composerId; null requires no current draft.' } }, ['type', 'draft']),
|
|
280
|
+
oneOf: [{ required: ['composerId', 'expectedCurrent'] }, { not: { anyOf: [{ required: ['composerId'] }, { required: ['expectedCurrent'] }] } }] },
|
|
277
281
|
action('comment-drafts.discard', { draft: draftReference }),
|
|
278
282
|
object({ type: { const: 'body-drafts.inspect' }, cursor, limit: { type: 'integer', minimum: 1, maximum: 10 } }, ['type']),
|
|
279
283
|
object({ type: { const: 'body-drafts.read' }, draft: bodyDraftReference, offset: integer, maxChars: { type: 'integer', minimum: 2, maximum: 2048 } }, ['type', 'draft', 'offset']),
|