@yorkie-js/sdk 0.6.39 → 0.6.40

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.
@@ -9,6 +9,7 @@ import { PartialMessage } from '@bufbuild/protobuf';
9
9
  import { PlainMessage } from '@bufbuild/protobuf';
10
10
  import { proto3 } from '@bufbuild/protobuf';
11
11
  import { Rule } from '@yorkie-js/schema';
12
+ import { Timestamp } from '@bufbuild/protobuf';
12
13
 
13
14
  /**
14
15
  * `ActorID` is used to identify who is making changes to the document.
@@ -1083,6 +1084,22 @@ export declare class Client {
1083
1084
  * `getCondition` returns the condition of this client.
1084
1085
  */
1085
1086
  getCondition(condition: ClientCondition): boolean;
1087
+ /**
1088
+ * `createRevision` creates a new revision for the given document.
1089
+ */
1090
+ createRevision<R, P extends Indexable>(doc: Document_2<R, P>, label: string, description?: string): Promise<RevisionSummary>;
1091
+ /**
1092
+ * `listRevisions` lists all revisions for the given document.
1093
+ */
1094
+ listRevisions<R, P extends Indexable>(doc: Document_2<R, P>, options?: {
1095
+ pageSize?: number;
1096
+ offset?: number;
1097
+ isForward?: boolean;
1098
+ }): Promise<Array<RevisionSummary>>;
1099
+ /**
1100
+ * `restoreRevision` restores the document to the given revision.
1101
+ */
1102
+ restoreRevision<R, P extends Indexable>(doc: Document_2<R, P>, revisionId: string): Promise<void>;
1086
1103
  /**
1087
1104
  * `broadcast` broadcasts the given payload to the given topic.
1088
1105
  */
@@ -1274,6 +1291,7 @@ export declare const converter: {
1274
1291
  versionVectorToHex: typeof versionVectorToHex;
1275
1292
  hexToVersionVector: typeof hexToVersionVector;
1276
1293
  fromSchemaRules: typeof fromSchemaRules;
1294
+ toRevisionSummary: typeof toRevisionSummary;
1277
1295
  };
1278
1296
 
1279
1297
  /**
@@ -4861,6 +4879,69 @@ declare type RemoveOpInfo_2 = {
4861
4879
  */
4862
4880
  declare type ResourceStatus = 'detached' | 'attached' | 'removed';
4863
4881
 
4882
+ /**
4883
+ * `RevisionSummary` represents a document revision for version management.
4884
+ * It stores a snapshot of document content at a specific point in time,
4885
+ * enabling features like rollback, audit, and version history tracking.
4886
+ */
4887
+ export declare interface RevisionSummary {
4888
+ /**
4889
+ * `id` is the unique identifier of the revision.
4890
+ */
4891
+ id: string;
4892
+ /**
4893
+ * `label` is a user-friendly name for this revision.
4894
+ */
4895
+ label: string;
4896
+ /**
4897
+ * `description` is a detailed explanation of this revision.
4898
+ */
4899
+ description: string;
4900
+ /**
4901
+ * `snapshot` is the serialized document content (JSON format) at this revision point.
4902
+ * This contains only the pure data without CRDT metadata.
4903
+ */
4904
+ snapshot: string;
4905
+ /**
4906
+ * `createdAt` is the time when this revision was created.
4907
+ */
4908
+ createdAt: Date;
4909
+ }
4910
+
4911
+ /**
4912
+ * @generated from message yorkie.v1.RevisionSummary
4913
+ */
4914
+ declare class RevisionSummary_2 extends Message<RevisionSummary_2> {
4915
+ /**
4916
+ * @generated from field: string id = 1;
4917
+ */
4918
+ id: string;
4919
+ /**
4920
+ * @generated from field: string label = 2;
4921
+ */
4922
+ label: string;
4923
+ /**
4924
+ * @generated from field: string description = 3;
4925
+ */
4926
+ description: string;
4927
+ /**
4928
+ * @generated from field: string snapshot = 4;
4929
+ */
4930
+ snapshot: string;
4931
+ /**
4932
+ * @generated from field: google.protobuf.Timestamp created_at = 5;
4933
+ */
4934
+ createdAt?: Timestamp;
4935
+ constructor(data?: PartialMessage<RevisionSummary_2>);
4936
+ static readonly runtime: typeof proto3;
4937
+ static readonly typeName = "yorkie.v1.RevisionSummary";
4938
+ static readonly fields: FieldList;
4939
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RevisionSummary_2;
4940
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): RevisionSummary_2;
4941
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): RevisionSummary_2;
4942
+ static equals(a: RevisionSummary_2 | PlainMessage<RevisionSummary_2> | undefined, b: RevisionSummary_2 | PlainMessage<RevisionSummary_2> | undefined): boolean;
4943
+ }
4944
+
4864
4945
  /**
4865
4946
  * `RGATreeSplit` is a block-based list with improved index-based lookup in RGA.
4866
4947
  * The difference from RGATreeList is that it has data on a block basis to
@@ -6071,6 +6152,11 @@ declare enum TokenType {
6071
6152
  */
6072
6153
  declare function toOperation(operation: Operation): Operation_2;
6073
6154
 
6155
+ /**
6156
+ * `toRevisionSummary` converts a protobuf RevisionSummary to a RevisionSummary.
6157
+ */
6158
+ declare function toRevisionSummary(pbRevision: RevisionSummary_2): RevisionSummary;
6159
+
6074
6160
  /**
6075
6161
  * `toTreeNodes` converts the given model to Protobuf format.
6076
6162
  */