@lincyaw/kernel 1.0.0-rc.53 → 1.0.0-rc.55
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,15 +91,18 @@ 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
|
}
|
|
98
|
+
const PRODUCTION_DRAFT_KINDS = ['step-timing', 'caption-timing', 'recording-range', 'voice', 'media-clip'] as const
|
|
97
99
|
export interface ClientProductionDraftMetadata {
|
|
98
100
|
draft: string
|
|
99
|
-
kind:
|
|
101
|
+
kind: typeof PRODUCTION_DRAFT_KINDS[number]
|
|
100
102
|
stepId: string
|
|
101
103
|
field?: 'minimumHoldMs' | 'trailingPauseMs'
|
|
102
104
|
assetId?: string
|
|
105
|
+
clipId?: string
|
|
103
106
|
targetAvailable: boolean
|
|
104
107
|
requiresReview: boolean
|
|
105
108
|
storage: 'tab' | 'memory'
|
|
@@ -227,7 +230,7 @@ const nullableComponentReference: Schema = { oneOf: [componentDraftReference, {
|
|
|
227
230
|
const nullableCommentReference: Schema = { oneOf: [draftReference, { type: 'null' }] }
|
|
228
231
|
const commentRestore = object({ composerId: id, expectedCurrent: nullableCommentReference })
|
|
229
232
|
const cursor = object({ after: entity, token: digest })
|
|
230
|
-
const productionMetadata = object({ draft: digest, kind: { enum: [
|
|
233
|
+
const productionMetadata = object({ draft: digest, kind: { enum: [...PRODUCTION_DRAFT_KINDS] }, stepId: entity, field: { enum: ['minimumHoldMs', 'trailingPauseMs'] }, assetId: entity, clipId: entity, targetAvailable: bool, requiresReview: bool, storage: { enum: ['tab', 'memory'] }, discardable: bool }, ['draft', 'kind', 'stepId', 'targetAvailable', 'requiresReview', 'storage', 'discardable'])
|
|
231
234
|
export const AUTHORING_CLIENT_ACTION_RESULT_SCHEMA: Schema = { oneOf: [
|
|
232
235
|
object({ type: { const: 'body-drafts.inspect' }, family: { const: 'body' }, coverage: { enum: ['stored-and-session', 'partial'] }, token: digest,
|
|
233
236
|
drafts: { type: 'array', maxItems: 10, items: bodyMetadata }, next: cursor }, ['type', 'family', 'coverage', 'token', 'drafts']),
|
|
@@ -238,7 +241,7 @@ export const AUTHORING_CLIENT_ACTION_RESULT_SCHEMA: Schema = { oneOf: [
|
|
|
238
241
|
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
242
|
object({ type: { const: 'production-drafts.discard' }, family: { const: 'production' }, draft: digest, discarded: { const: true } }),
|
|
240
243
|
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']),
|
|
244
|
+
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
245
|
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
246
|
object({ type: { const: 'comment-drafts.restore' }, family: { const: 'comment' }, draft: draftReference, composerId: id, restored: draftReference, preservedCurrent: nullableCommentReference, targetState: { enum: ['current', 'changed'] } }),
|
|
244
247
|
object({ type: { const: 'comment-drafts.discard' }, family: { const: 'comment' }, draft: draftReference, discarded: { const: true } }),
|
|
@@ -271,9 +274,12 @@ export const AUTHORING_CLIENT_ACTION_SCHEMA: Schema = { oneOf: [
|
|
|
271
274
|
object({ type: { const: 'production-drafts.inspect' }, cursor, limit: { type: 'integer', minimum: 1, maximum: 10 } }, ['type']),
|
|
272
275
|
object({ type: { const: 'production-drafts.read' }, draft: digest, offset: integer, maxChars: { type: 'integer', minimum: 2, maximum: 2048 } }, ['type', 'draft', 'offset']),
|
|
273
276
|
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']),
|
|
277
|
+
object({ type: { const: 'comment-drafts.inspect' }, cursor, limit: { type: 'integer', minimum: 1, maximum: 10 }, details: bool }, ['type']),
|
|
275
278
|
object({ type: { const: 'comment-drafts.read' }, draft: draftReference, offset: integer, maxChars: { type: 'integer', minimum: 2, maximum: 2048 } }, ['type', 'draft', 'offset']),
|
|
276
|
-
|
|
279
|
+
{ ...object({ type: { const: 'comment-drafts.restore' }, draft: draftReference,
|
|
280
|
+
composerId: { ...id, description: 'Advanced: provide together with expectedCurrent; omit both to select the unique native recovery target.' },
|
|
281
|
+
expectedCurrent: { ...nullableCommentReference, description: 'Advanced: provide together with composerId; null requires no current draft.' } }, ['type', 'draft']),
|
|
282
|
+
oneOf: [{ required: ['composerId', 'expectedCurrent'] }, { not: { anyOf: [{ required: ['composerId'] }, { required: ['expectedCurrent'] }] } }] },
|
|
277
283
|
action('comment-drafts.discard', { draft: draftReference }),
|
|
278
284
|
object({ type: { const: 'body-drafts.inspect' }, cursor, limit: { type: 'integer', minimum: 1, maximum: 10 } }, ['type']),
|
|
279
285
|
object({ type: { const: 'body-drafts.read' }, draft: bodyDraftReference, offset: integer, maxChars: { type: 'integer', minimum: 2, maximum: 2048 } }, ['type', 'draft', 'offset']),
|