document-drive 1.29.4-dev.2 → 1.29.4-dev.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.
@@ -18,11 +18,13 @@ export default class SynchronizationManager {
18
18
  }
19
19
  async getSynchronizationUnits(driveId, documentId, scope, branch, documentType) {
20
20
  const synchronizationUnitsQuery = await this.getSynchronizationUnitsIds(driveId, documentId, scope, branch, documentType);
21
+ this.logger.verbose(`getSynchronizationUnits query: ${JSON.stringify(synchronizationUnitsQuery)}`);
21
22
  return this.getSynchronizationUnitsRevision(driveId, synchronizationUnitsQuery);
22
23
  }
23
24
  async getSynchronizationUnitsRevision(driveId, syncUnitsQuery) {
24
25
  const drive = await this.getDrive(driveId);
25
26
  const revisions = await this.storage.getSynchronizationUnitsRevision(syncUnitsQuery);
27
+ this.logger.verbose(`getSynchronizationUnitsRevision: ${JSON.stringify(revisions)}`);
26
28
  return syncUnitsQuery.map((s) => ({
27
29
  ...s,
28
30
  lastUpdated: drive.created,
@@ -121,24 +123,40 @@ export default class SynchronizationManager {
121
123
  };
122
124
  }
123
125
  async getOperationData(driveId, syncId, filter) {
126
+ this.logger.verbose(`[SYNC DEBUG] SynchronizationManager.getOperationData called for drive: ${driveId}, syncId: ${syncId}, filter: ${JSON.stringify(filter)}`);
124
127
  const syncUnit = syncId === "0"
125
128
  ? { documentId: "", scope: "global" }
126
129
  : await this.getSynchronizationUnitIdInfo(driveId, syncId);
127
130
  if (!syncUnit) {
131
+ this.logger.error(`SYNC DEBUG] Invalid Sync Id ${syncId} in drive ${driveId}`);
128
132
  throw new Error(`Invalid Sync Id ${syncId} in drive ${driveId}`);
129
133
  }
134
+ this.logger.verbose(`[SYNC DEBUG] Found sync unit: documentId: ${syncUnit.documentId}, scope: ${syncUnit.scope}`);
130
135
  const document = syncId === "0"
131
136
  ? await this.getDrive(driveId)
132
137
  : await this.getDocument(driveId, syncUnit.documentId); // TODO replace with getDocumentOperations
138
+ this.logger.verbose(`[SYNC DEBUG] Retrieved document ${syncUnit.documentId} with type: ${document.documentType}`);
133
139
  const operations = document.operations[syncUnit.scope] ?? []; // TODO filter by branch also
140
+ this.logger.verbose(`[SYNC DEBUG] Found ${operations.length} total operations in scope ${syncUnit.scope}`);
134
141
  const filteredOperations = operations.filter((operation) => Object.keys(filter).length === 0 ||
135
142
  ((filter.since === undefined ||
136
143
  isBefore(filter.since, operation.timestamp)) &&
137
144
  (filter.fromRevision === undefined ||
138
145
  operation.index > filter.fromRevision)));
146
+ this.logger.verbose(`[SYNC DEBUG] Filtered to ${filteredOperations.length} operations based on filter criteria` +
147
+ (filter.fromRevision !== undefined
148
+ ? ` (fromRevision: ${filter.fromRevision})`
149
+ : ""));
139
150
  const limitedOperations = filter.limit
140
151
  ? filteredOperations.slice(0, filter.limit)
141
152
  : filteredOperations;
153
+ this.logger.verbose(`[SYNC DEBUG] Returning ${limitedOperations.length} operations after applying limit`);
154
+ if (limitedOperations.length > 0) {
155
+ const firstOp = limitedOperations[0];
156
+ const lastOp = limitedOperations[limitedOperations.length - 1];
157
+ this.logger.verbose(`[SYNC DEBUG] First operation: index=${firstOp.index}, type=${firstOp.type}`);
158
+ this.logger.verbose(`[SYNC DEBUG] Last operation: index=${lastOp.index}, type=${lastOp.type}`);
159
+ }
142
160
  return limitedOperations.map((operation) => ({
143
161
  hash: operation.hash,
144
162
  index: operation.index,
@@ -0,0 +1 @@
1
+ export * from './index'
@@ -0,0 +1 @@
1
+ export * from './default'