From d986ef347a9356254fb0e98d4ea7b0b620eace21 Mon Sep 17 00:00:00 2001 From: Youngteac Hong Date: Thu, 7 Nov 2024 16:39:31 +0900 Subject: [PATCH] Clean up codes --- packages/sdk/src/client/client.ts | 32 ++++++------ .../sdk/src/document/change/change_pack.ts | 2 +- packages/sdk/src/document/document.ts | 49 ++++++++++--------- packages/sdk/src/yorkie.ts | 4 +- packages/sdk/test/bench/document.bench.ts | 8 +-- packages/sdk/test/integration/client_test.ts | 32 ++++++------ .../sdk/test/integration/document_test.ts | 42 ++++++++-------- packages/sdk/test/integration/webhook_test.ts | 6 +-- pnpm-lock.yaml | 4 -- 9 files changed, 88 insertions(+), 91 deletions(-) diff --git a/packages/sdk/src/client/client.ts b/packages/sdk/src/client/client.ts index 8f430bedf..9e1aa1c93 100644 --- a/packages/sdk/src/client/client.ts +++ b/packages/sdk/src/client/client.ts @@ -36,12 +36,12 @@ import { uuid } from '@yorkie-js-sdk/src/util/uuid'; import { Attachment, WatchStream } from '@yorkie-js-sdk/src/client/attachment'; import { Document, - DocumentKey, - DocumentStatus, + DocKey, + DocStatus, Indexable, DocEventType, StreamConnectionStatus, - DocumentSyncStatus, + DocSyncStatus, } from '@yorkie-js-sdk/src/document/document'; import { OpSource } from '@yorkie-js-sdk/src/document/operation/operation'; import { createAuthInterceptor } from '@yorkie-js-sdk/src/client/auth_interceptor'; @@ -186,7 +186,7 @@ export class Client { private id?: ActorID; private key: string; private status: ClientStatus; - private attachmentMap: Map>; + private attachmentMap: Map>; private apiKey: string; private authTokenInjector?: (reason?: string) => Promise; @@ -320,7 +320,7 @@ export class Client { `${this.key} is not active`, ); } - if (doc.getStatus() !== DocumentStatus.Detached) { + if (doc.getStatus() !== DocStatus.Detached) { throw new YorkieError( Code.ErrDocumentNotDetached, `${doc.getKey()} is not detached`, @@ -358,11 +358,11 @@ export class Client { .then(async (res) => { const pack = converter.fromChangePack

(res.changePack!); doc.applyChangePack(pack); - if (doc.getStatus() === DocumentStatus.Removed) { + if (doc.getStatus() === DocStatus.Removed) { return doc; } - doc.applyStatus(DocumentStatus.Attached); + doc.applyStatus(DocStatus.Attached); this.attachmentMap.set( doc.getKey(), new Attachment( @@ -446,8 +446,8 @@ export class Client { .then((res) => { const pack = converter.fromChangePack

(res.changePack!); doc.applyChangePack(pack); - if (doc.getStatus() !== DocumentStatus.Removed) { - doc.applyStatus(DocumentStatus.Detached); + if (doc.getStatus() !== DocStatus.Removed) { + doc.applyStatus(DocStatus.Detached); } this.detachInternal(doc.getKey()); @@ -646,7 +646,7 @@ export class Client { * `broadcast` broadcasts the given payload to the given topic. */ public broadcast( - docKey: DocumentKey, + docKey: DocKey, topic: string, payload: Json, options?: BroadcastOptions, @@ -792,7 +792,7 @@ export class Client { * `runWatchLoop` runs the watch loop for the given document. The watch loop * listens to the events of the given document from the server. */ - private async runWatchLoop(docKey: DocumentKey): Promise { + private async runWatchLoop(docKey: DocKey): Promise { const attachment = this.attachmentMap.get(docKey); if (!attachment) { throw new YorkieError( @@ -913,11 +913,11 @@ export class Client { for (const [key, attachment] of this.attachmentMap) { this.detachInternal(key); - attachment.doc.applyStatus(DocumentStatus.Detached); + attachment.doc.applyStatus(DocStatus.Detached); } } - private detachInternal(docKey: DocumentKey) { + private detachInternal(docKey: DocKey) { // NOTE(hackerwins): If attachment is not found, it means that the document // has been already detached by another routine. // This can happen when detach or remove is called while the watch loop is @@ -966,12 +966,12 @@ export class Client { attachment.doc.publish([ { type: DocEventType.SyncStatusChanged, - value: DocumentSyncStatus.Synced, + value: DocSyncStatus.Synced, }, ]); // NOTE(chacha912): If a document has been removed, watchStream should // be disconnected to not receive an event for that document. - if (doc.getStatus() === DocumentStatus.Removed) { + if (doc.getStatus() === DocStatus.Removed) { this.detachInternal(doc.getKey()); } @@ -988,7 +988,7 @@ export class Client { doc.publish([ { type: DocEventType.SyncStatusChanged, - value: DocumentSyncStatus.SyncFailed, + value: DocSyncStatus.SyncFailed, }, ]); logger.error(`[PP] c:"${this.getKey()}" err :`, err); diff --git a/packages/sdk/src/document/change/change_pack.ts b/packages/sdk/src/document/change/change_pack.ts index 15a0e104c..e752025b0 100644 --- a/packages/sdk/src/document/change/change_pack.ts +++ b/packages/sdk/src/document/change/change_pack.ts @@ -99,7 +99,7 @@ export class ChangePack

{ } /** - * `getKey` returns the document key of this pack. + * `getDocumentKey` returns the document key of this pack. */ public getDocumentKey(): string { return this.documentKey; diff --git a/packages/sdk/src/document/document.ts b/packages/sdk/src/document/document.ts index 7de1150e4..a1087b1af 100644 --- a/packages/sdk/src/document/document.ts +++ b/packages/sdk/src/document/document.ts @@ -113,10 +113,10 @@ export interface DocumentOptions { } /** - * `DocumentStatus` represents the status of the document. + * `DocStatus` represents the status of the document. * @public */ -export enum DocumentStatus { +export enum DocStatus { /** * Detached means that the document is not attached to the client. * The actor of the ticket is created without being assigned. @@ -254,9 +254,9 @@ export interface StatusChangedEvent extends BaseDocEvent { type: DocEventType.StatusChanged; source: OpSource; value: - | { status: DocumentStatus.Attached; actorID: string } - | { status: DocumentStatus.Detached } - | { status: DocumentStatus.Removed }; + | { status: DocStatus.Attached; actorID: string } + | { status: DocStatus.Detached } + | { status: DocStatus.Removed }; } /** @@ -288,10 +288,10 @@ export interface ConnectionChangedEvent extends BaseDocEvent { } /** - * `DocumentSyncStatus` represents the result of synchronizing the document with the server. + * `DocSyncStatus` represents the result of synchronizing the document with the server. * @public */ -export enum DocumentSyncStatus { +export enum DocSyncStatus { /** * `Synced` means that document synced successfully. */ @@ -312,7 +312,7 @@ export interface SyncStatusChangedEvent extends BaseDocEvent { * enum {@link DocEventType}.SyncStatusChanged */ type: DocEventType.SyncStatusChanged; - value: DocumentSyncStatus; + value: DocSyncStatus; } /** @@ -474,10 +474,10 @@ type JsonObject = { [key: string]: Json | undefined }; export type Indexable = Record; /** - * `DocumentKey` represents the key of the document. + * `DocKey` represents the key of the document. * @public */ -export type DocumentKey = string; +export type DocKey = string; /** * `OperationInfoOfElement` represents the type of the operation info of the given element. @@ -619,8 +619,8 @@ type PathOf = PathOfInternal< * @public */ export class Document { - private key: DocumentKey; - private status: DocumentStatus; + private key: DocKey; + private status: DocStatus; private opts: DocumentOptions; private changeID: ChangeID; @@ -666,7 +666,7 @@ export class Document { this.opts = opts || {}; this.key = key; - this.status = DocumentStatus.Detached; + this.status = DocStatus.Detached; this.root = CRDTRoot.create(); this.changeID = InitialChangeID; @@ -699,7 +699,7 @@ export class Document { updater: (root: JSONObject, presence: Presence

) => void, message?: string, ): void { - if (this.getStatus() === DocumentStatus.Removed) { + if (this.getStatus() === DocStatus.Removed) { throw new YorkieError(Code.ErrDocumentRemoved, `${this.key} is removed`); } @@ -1240,7 +1240,7 @@ export class Document { // 05. Update the status. if (pack.getIsRemoved()) { - this.applyStatus(DocumentStatus.Removed); + this.applyStatus(DocStatus.Removed); } if (logger.isEnabled(LogLevel.Trivial)) { @@ -1340,7 +1340,7 @@ export class Document { /** * `getStatus` returns the status of this document. */ - public getStatus(): DocumentStatus { + public getStatus(): DocStatus { return this.status; } @@ -1700,20 +1700,19 @@ export class Document { /** * `applyStatus` applies the document status into this document. */ - public applyStatus(status: DocumentStatus) { + public applyStatus(status: DocStatus) { this.status = status; - if (status === DocumentStatus.Detached) { + if (status === DocStatus.Detached) { this.setActor(InitialActorID); } this.publish([ { - source: - status === DocumentStatus.Removed ? OpSource.Remote : OpSource.Local, + source: status === DocStatus.Removed ? OpSource.Remote : OpSource.Local, type: DocEventType.StatusChanged, value: - status === DocumentStatus.Attached + status === DocStatus.Attached ? { status, actorID: this.changeID.getActorID() } : { status }, }, @@ -1726,7 +1725,7 @@ export class Document { public applyDocEvent(event: DocEvent

) { if (event.type === DocEventType.StatusChanged) { this.applyStatus(event.value.status); - if (event.value.status === DocumentStatus.Attached) { + if (event.value.status === DocStatus.Attached) { this.setActor(event.value.actorID); } return; @@ -1735,7 +1734,9 @@ export class Document { if (event.type === DocEventType.Snapshot) { const { snapshot, serverSeq, snapshotVector } = event.value; if (!snapshot) return; - // TODO(hackerwins): We need to check the clientSeq of the snapshot. + + // TODO(hackerwins): We need to check version vector and lamport clock + // of the snapshot is valid. this.applySnapshot( BigInt(serverSeq), converter.hexToVersionVector(snapshotVector), @@ -1862,7 +1863,7 @@ export class Document { public getMyPresence(): P { // TODO(chacha912): After resolving the presence initialization issue, // remove default presence.(#608) - if (this.status !== DocumentStatus.Attached) { + if (this.status !== DocStatus.Attached) { return {} as P; } diff --git a/packages/sdk/src/yorkie.ts b/packages/sdk/src/yorkie.ts index 7bce1537b..ae1aff558 100644 --- a/packages/sdk/src/yorkie.ts +++ b/packages/sdk/src/yorkie.ts @@ -41,8 +41,8 @@ export { type PresenceChangedEvent, type InitializedEvent, StreamConnectionStatus, - DocumentSyncStatus, - DocumentStatus, + DocSyncStatus, + DocStatus, type Indexable, type DocEvent, type TransactionEvent, diff --git a/packages/sdk/test/bench/document.bench.ts b/packages/sdk/test/bench/document.bench.ts index 17f53231c..512ad4e3b 100644 --- a/packages/sdk/test/bench/document.bench.ts +++ b/packages/sdk/test/bench/document.bench.ts @@ -1,6 +1,6 @@ import { Document, JSONArray } from '@yorkie-js-sdk/src/yorkie'; import { InitialCheckpoint } from '@yorkie-js-sdk/src/document/change/checkpoint'; -import { DocumentStatus } from '@yorkie-js-sdk/src/document/document'; +import { DocStatus } from '@yorkie-js-sdk/src/document/document'; import { describe, bench, assert } from 'vitest'; import { MaxVersionVector } from '../helper/helper'; @@ -56,9 +56,9 @@ describe('Document', () => { bench('status', () => { const doc = new Document<{ text: JSONArray }>(`test-doc`); - assert.equal(doc.getStatus(), DocumentStatus.Detached); - doc.applyStatus(DocumentStatus.Attached); - assert.equal(doc.getStatus(), DocumentStatus.Attached); + assert.equal(doc.getStatus(), DocStatus.Detached); + doc.applyStatus(DocStatus.Attached); + assert.equal(doc.getStatus(), DocStatus.Attached); }); bench('equals', () => { diff --git a/packages/sdk/test/integration/client_test.ts b/packages/sdk/test/integration/client_test.ts index ce9ac6cf7..535202976 100644 --- a/packages/sdk/test/integration/client_test.ts +++ b/packages/sdk/test/integration/client_test.ts @@ -21,7 +21,7 @@ import yorkie, { SyncMode, ClientCondition, DocEventType, - DocumentSyncStatus, + DocSyncStatus, Tree, Text, } from '@yorkie-js-sdk/src/yorkie'; @@ -224,12 +224,12 @@ describe.sequential('Client', function () { }); await eventCollectorD2.waitAndVerifyNthEvent(2, DocEventType.LocalChange); - await eventCollectorSync2.waitFor(DocumentSyncStatus.SyncFailed); // c2 should fail to sync + await eventCollectorSync2.waitFor(DocSyncStatus.SyncFailed); // c2 should fail to sync await c1.sync().catch((err) => { assert.equal(err.message, '[unknown] Failed to fetch'); // c1 should also fail to sync }); - await eventCollectorSync1.waitFor(DocumentSyncStatus.SyncFailed); + await eventCollectorSync1.waitFor(DocSyncStatus.SyncFailed); assert.equal(d1.toSortedJSON(), '{"k1":"undefined"}'); assert.equal(d2.toSortedJSON(), '{"k1":"v1"}'); @@ -238,8 +238,8 @@ describe.sequential('Client', function () { eventCollectorSync2.reset(); vi.unstubAllGlobals(); - await eventCollectorSync1.waitFor(DocumentSyncStatus.Synced); // wait for c1 to sync - await eventCollectorSync2.waitFor(DocumentSyncStatus.Synced); + await eventCollectorSync1.waitFor(DocSyncStatus.Synced); // wait for c1 to sync + await eventCollectorSync2.waitFor(DocSyncStatus.Synced); await eventCollectorD1.waitAndVerifyNthEvent(2, DocEventType.RemoteChange); assert.equal(d1.toSortedJSON(), '{"k1":"v1"}'); // d1 should be able to receive d2's update @@ -284,7 +284,7 @@ describe.sequential('Client', function () { eventCollector.add(event.value); }); await c2.changeSyncMode(d2, SyncMode.Realtime); - await eventCollector.waitFor(DocumentSyncStatus.Synced); // sync occurs when resuming + await eventCollector.waitFor(DocSyncStatus.Synced); // sync occurs when resuming eventCollector.reset(); d1.update((root) => { @@ -292,7 +292,7 @@ describe.sequential('Client', function () { }); await c1.sync(); - await eventCollector.waitFor(DocumentSyncStatus.Synced); // c2 should sync automatically + await eventCollector.waitFor(DocSyncStatus.Synced); // c2 should sync automatically assert.equal(d1.toSortedJSON(), `{"version":"v2"}`, 'd1'); assert.equal(d2.toSortedJSON(), `{"version":"v2"}`, 'd2'); unsub1(); @@ -470,7 +470,7 @@ describe.sequential('Client', function () { }); await c1.sync(); assert.equal(d1.toSortedJSON(), `{"version":"v1"}`, 'd1'); - await eventCollector.waitFor(DocumentSyncStatus.Synced); + await eventCollector.waitFor(DocSyncStatus.Synced); assert.equal(d2.toSortedJSON(), `{"version":"v1"}`, 'd2'); // 02. c2 is changed to manual sync. So, c2 doesn't get the changes of c1. @@ -487,7 +487,7 @@ describe.sequential('Client', function () { eventCollector.reset(); await c2.changeSyncMode(d2, SyncMode.Realtime); - await eventCollector.waitFor(DocumentSyncStatus.Synced); + await eventCollector.waitFor(DocSyncStatus.Synced); assert.equal(d2.toSortedJSON(), `{"version":"v2"}`, 'd2'); // 04. c2 should automatically synchronize changes. @@ -497,7 +497,7 @@ describe.sequential('Client', function () { }); await c1.sync(); - await eventCollector.waitFor(DocumentSyncStatus.Synced); + await eventCollector.waitFor(DocSyncStatus.Synced); assert.equal(d1.toSortedJSON(), `{"version":"v3"}`, 'd1'); assert.equal(d2.toSortedJSON(), `{"version":"v3"}`, 'd2'); unsub1(); @@ -544,7 +544,7 @@ describe.sequential('Client', function () { let changePack = d1.createChangePack(); assert.equal(changePack.getChangeSize(), 1); await c1.changeSyncMode(d1, SyncMode.RealtimePushOnly); - await eventCollector.waitFor(DocumentSyncStatus.Synced); + await eventCollector.waitFor(DocSyncStatus.Synced); checkpoint = d1.getCheckpoint(); assert.equal(checkpoint.getClientSeq(), 3); assert.equal(checkpoint.getServerSeq(), 2n); @@ -760,13 +760,13 @@ describe.sequential('Client', function () { await c1.attach(d1); await c2.attach(d2); - await eventCollectorD1.waitAndVerifyNthEvent(1, DocumentSyncStatus.Synced); + await eventCollectorD1.waitAndVerifyNthEvent(1, DocSyncStatus.Synced); d1.update((root) => { root.t = new Text(); root.t.edit(0, 0, 'a'); }); - await eventCollectorD2.waitAndVerifyNthEvent(1, DocumentSyncStatus.Synced); + await eventCollectorD2.waitAndVerifyNthEvent(1, DocSyncStatus.Synced); assert.equal(d1.getRoot().t.toString(), 'a'); assert.equal(d2.getRoot().t.toString(), 'a'); @@ -776,15 +776,15 @@ describe.sequential('Client', function () { d2.update((root) => { root.t.edit(1, 1, 'b'); }); - await eventCollectorD2.waitAndVerifyNthEvent(2, DocumentSyncStatus.Synced); + await eventCollectorD2.waitAndVerifyNthEvent(2, DocSyncStatus.Synced); d2.update((root) => { root.t.edit(2, 2, 'c'); }); - await eventCollectorD2.waitAndVerifyNthEvent(3, DocumentSyncStatus.Synced); + await eventCollectorD2.waitAndVerifyNthEvent(3, DocSyncStatus.Synced); assert.equal(eventCollectorD1.getLength(), 0); await c1.changeSyncMode(d1, SyncMode.Realtime); - await eventCollectorD1.waitAndVerifyNthEvent(1, DocumentSyncStatus.Synced); + await eventCollectorD1.waitAndVerifyNthEvent(1, DocSyncStatus.Synced); assert.equal(d1.getRoot().t.toString(), 'abc'); assert.equal(d2.getRoot().t.toString(), 'abc'); diff --git a/packages/sdk/test/integration/document_test.ts b/packages/sdk/test/integration/document_test.ts index b3df7b787..ed03cfbb8 100644 --- a/packages/sdk/test/integration/document_test.ts +++ b/packages/sdk/test/integration/document_test.ts @@ -18,7 +18,7 @@ import { } from '@yorkie-js-sdk/test/helper/helper'; import type { CRDTElement } from '@yorkie-js-sdk/src/document/crdt/element'; import { - DocumentStatus, + DocStatus, DocEventType, StatusChangedEvent, } from '@yorkie-js-sdk/src/document/document'; @@ -91,12 +91,12 @@ describe('Document', function () { // 3. client1 detaches the document. // The document is not removed as client2 is still attached to it. await client1.detach(doc1, { removeIfNotAttached: true }); - assert.equal(doc1.getStatus(), DocumentStatus.Detached); + assert.equal(doc1.getStatus(), DocStatus.Detached); // 4. client2 detaches the document. // Since no client is attached to the document, it gets removed. await client2.detach(doc2, { removeIfNotAttached: true }); - assert.equal(doc2.getStatus(), DocumentStatus.Removed); + assert.equal(doc2.getStatus(), DocStatus.Removed); // 5. client3 attaches the document. // The content of the removed document should not be exposed. @@ -612,12 +612,12 @@ describe('Document', function () { }); await c1.remove(d1); assert.equal(d1.toSortedJSON(), '{"k1":[1,2,3]}', 'd1'); - assert.equal(d1.getStatus(), DocumentStatus.Removed); + assert.equal(d1.getStatus(), DocStatus.Removed); // 03. c2 syncs and checks that d2 is removed. await c2.sync(); assert.equal(d2.toSortedJSON(), '{"k1":[1,2,3]}', 'd2'); - assert.equal(d2.getStatus(), DocumentStatus.Removed); + assert.equal(d2.getStatus(), DocStatus.Removed); await c1.deactivate(); await c2.deactivate(); @@ -652,8 +652,8 @@ describe('Document', function () { await c1.sync(); await c2.sync(); - assert.equal(d1.getStatus(), DocumentStatus.Removed); - assert.equal(d2.getStatus(), DocumentStatus.Removed); + assert.equal(d1.getStatus(), DocStatus.Removed); + assert.equal(d2.getStatus(), DocStatus.Removed); await c1.deactivate(); await c2.deactivate(); @@ -686,8 +686,8 @@ describe('Document', function () { await c1.sync(); await c2.sync(); - assert.equal(d1.getStatus(), DocumentStatus.Removed); - assert.equal(d2.getStatus(), DocumentStatus.Removed); + assert.equal(d1.getStatus(), DocStatus.Removed); + assert.equal(d2.getStatus(), DocStatus.Removed); await c1.deactivate(); await c2.deactivate(); @@ -794,24 +794,24 @@ describe('Document', function () { await c2.attach(d2); await eventCollectorD1.waitAndVerifyNthEvent(1, { - status: DocumentStatus.Attached, + status: DocStatus.Attached, actorID: c1ID, }); await eventCollectorD2.waitAndVerifyNthEvent(1, { - status: DocumentStatus.Attached, + status: DocStatus.Attached, actorID: c2ID, }); // 2. When c1 detaches a document, it receives a detached event. await c1.detach(d1); await eventCollectorD1.waitAndVerifyNthEvent(2, { - status: DocumentStatus.Detached, + status: DocStatus.Detached, }); // 3. When c2 deactivates, it should also receive a detached event. await c2.deactivate(); await eventCollectorD2.waitAndVerifyNthEvent(2, { - status: DocumentStatus.Detached, + status: DocStatus.Detached, }); // 4. When other document is attached, it receives an attached event. @@ -828,7 +828,7 @@ describe('Document', function () { }); await c1.attach(d3, { syncMode: SyncMode.Manual }); await eventCollectorD3.waitAndVerifyNthEvent(1, { - status: DocumentStatus.Attached, + status: DocStatus.Attached, actorID: c1ID, }); @@ -836,20 +836,20 @@ describe('Document', function () { c2ID = c2.getID()!; await c2.attach(d4, { syncMode: SyncMode.Manual }); await eventCollectorD4.waitAndVerifyNthEvent(1, { - status: DocumentStatus.Attached, + status: DocStatus.Attached, actorID: c2ID, }); // 5. When c1 removes a document, it receives a removed event. await c1.remove(d3); await eventCollectorD3.waitAndVerifyNthEvent(2, { - status: DocumentStatus.Removed, + status: DocStatus.Removed, }); // 6. When c2 syncs, it should also receive a removed event. await c2.sync(); await eventCollectorD4.waitAndVerifyNthEvent(2, { - status: DocumentStatus.Removed, + status: DocStatus.Removed, }); // 7. If the document is in the removed state, a detached event should not occur when deactivating. @@ -897,18 +897,18 @@ describe('Document', function () { }); await eventCollectorD1.waitAndVerifyNthEvent(1, { - status: DocumentStatus.Attached, + status: DocStatus.Attached, actorID: c1ID, }); await eventCollectorD2.waitAndVerifyNthEvent(1, { - status: DocumentStatus.Attached, + status: DocStatus.Attached, actorID: c2ID, }); // 2. When c1 removes a document, it receives a removed event. await c1.remove(d1); await eventCollectorD1.waitAndVerifyNthEvent(2, { - status: DocumentStatus.Removed, + status: DocStatus.Removed, }); // 3. When c2 deactivates, it should also receive a removed event. @@ -916,7 +916,7 @@ describe('Document', function () { // NOTE(chacha912): For now, document status changes to `Detached` when deactivating. // This behavior may change in the future. await eventCollectorD2.waitAndVerifyNthEvent(2, { - status: DocumentStatus.Detached, + status: DocStatus.Detached, }); await c1.deactivate(); diff --git a/packages/sdk/test/integration/webhook_test.ts b/packages/sdk/test/integration/webhook_test.ts index e42291df7..af58177f3 100644 --- a/packages/sdk/test/integration/webhook_test.ts +++ b/packages/sdk/test/integration/webhook_test.ts @@ -18,7 +18,7 @@ import { describe, it, vi, beforeAll, afterAll, expect } from 'vitest'; import yorkie, { SyncMode, - DocumentSyncStatus, + DocSyncStatus, DocEventType, } from '@yorkie-js-sdk/src/yorkie'; import { @@ -364,7 +364,7 @@ describe('Auth Webhook', () => { root.k1 = 'v1'; }); - await syncEventCollector.waitFor(DocumentSyncStatus.Synced); + await syncEventCollector.waitFor(DocSyncStatus.Synced); await authErrorEventCollector.waitFor({ reason: ExpiredTokenErrorMessage, method: 'PushPull', @@ -465,7 +465,7 @@ describe('Auth Webhook', () => { doc2.update((root) => { root.k1 = 'v1'; }); - await syncEventCollector.waitFor(DocumentSyncStatus.Synced); + await syncEventCollector.waitFor(DocSyncStatus.Synced); expect(doc.getRoot().k1).toBe('v1'); await client.detach(doc); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e6e9adc0d..080f35fe1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -67,10 +67,6 @@ importers: specifier: 5.3.3 version: 5.3.3 - examples/nextjs-scheduler/dist: {} - - examples/nextjs-scheduler/dist/types: {} - examples/profile-stack: dependencies: yorkie-js-sdk: