@rljson/fs-agent 0.0.2 → 0.0.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.
@@ -13,6 +13,10 @@ found in the LICENSE file in the root of this package.
13
13
  - [Administrate](#administrate)
14
14
  - [Fast Coding](#fast-coding)
15
15
 
16
+ ## ⚠️ Important: ESLint Version
17
+
18
+ **Do NOT update ESLint to v10.x** - The package is pinned to `eslint ~9.39.2` because `eslint-plugin-tsdoc@0.5.0` is incompatible with ESLint v10's API changes (specifically `context.getSourceCode()` was removed). Updating to v10 will break the build.
19
+
16
20
  ## Prepare
17
21
 
18
22
  Read [prepare.md](doc/prepare.md)
@@ -13,6 +13,10 @@ found in the LICENSE file in the root of this package.
13
13
  - [Administrate](#administrate)
14
14
  - [Fast Coding](#fast-coding)
15
15
 
16
+ ## ⚠️ Important: ESLint Version
17
+
18
+ **Do NOT update ESLint to v10.x** - The package is pinned to `eslint ~9.39.2` because `eslint-plugin-tsdoc@0.5.0` is incompatible with ESLint v10's API changes (specifically `context.getSourceCode()` was removed). Updating to v10 will break the build.
19
+
16
20
  ## Prepare
17
21
 
18
22
  Read [prepare.md](doc/prepare.md)
@@ -0,0 +1 @@
1
+ export {};
@@ -173,6 +173,32 @@ export declare class FsAgent {
173
173
  * @returns Function to stop watching
174
174
  */
175
175
  syncFromDb(db: Db, connector: Connector, treeKey: string, restoreOptions?: RestoreOptions): Promise<() => void>;
176
+ /**
177
+ * Creates a fully configured FsAgent from a Client instance.
178
+ * This factory method provides a simplified API where sync methods don't require
179
+ * db, connector, and treeKey parameters - they are stored internally.
180
+ * @param filePath - Directory path to sync
181
+ * @param treeKey - Tree table key (route will be `/${treeKey}`)
182
+ * @param client - Client instance with io and bs properties
183
+ * @param socket - Socket instance for connector communication
184
+ * @param options - Optional FsAgent options (db and treeKey are set automatically)
185
+ * @returns Configured FsAgent instance with simplified sync API
186
+ * @example
187
+ * ```typescript
188
+ * const agent = await FsAgent.fromClient('./my-folder', 'sharedTree', client, socket);
189
+ * // Simplified sync methods - no db/connector/treeKey needed
190
+ * await agent.syncToDbSimple({ notify: true });
191
+ * await agent.syncFromDbSimple({ cleanTarget: true });
192
+ * // Original methods still work
193
+ * await agent.syncToDb(db, connector, treeKey, { notify: true });
194
+ * ```
195
+ */
196
+ static fromClient(filePath: string, treeKey: string, client: any, // Client type from \@rljson/server
197
+ socket: any, // Socket type from \@rljson/io
198
+ options?: Omit<FsAgentOptions, 'db' | 'treeKey'>): Promise<FsAgent & {
199
+ syncToDbSimple: (options?: StoreFsTreeOptions) => Promise<() => void>;
200
+ syncFromDbSimple: (options?: RestoreOptions) => Promise<() => void>;
201
+ }>;
176
202
  /** Example instance for test purposes */
177
203
  static get example(): FsAgent;
178
204
  }