@docstack/pouchdb-adapter-googledrive 0.0.1

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/lib/types.d.ts ADDED
@@ -0,0 +1,89 @@
1
+ /** Google Drive API client type */
2
+ export type DriveClient = any;
3
+ /** Options for configuring the Google Drive adapter */
4
+ export interface GoogleDriveAdapterOptions {
5
+ /** Configured Google Drive client (googleapis) */
6
+ drive: DriveClient;
7
+ /** Specific folder ID to use as the DB root */
8
+ folderId?: string;
9
+ /** Folder name to search/create if no ID provided */
10
+ folderName?: string;
11
+ /** Parent folder IDs for folder creation */
12
+ parents?: string[];
13
+ /** Interval in ms to check for remote changes */
14
+ pollingIntervalMs?: number;
15
+ /** Compaction threshold - number of change entries before auto-compact */
16
+ compactionThreshold?: number;
17
+ /** Compaction threshold - size in bytes before auto-compact */
18
+ compactionSizeThreshold?: number;
19
+ /** Cache size (number of documents) */
20
+ cacheSize?: number;
21
+ }
22
+ /** A single change entry in the append-only log */
23
+ export interface ChangeEntry {
24
+ /** Sequence number of this change */
25
+ seq: number;
26
+ /** Document ID */
27
+ id: string;
28
+ /** New revision */
29
+ rev: string;
30
+ /** Whether document was deleted */
31
+ deleted?: boolean;
32
+ /** The document data (omitted for deletes) */
33
+ doc?: Record<string, any>;
34
+ /** Timestamp of the change */
35
+ timestamp: number;
36
+ }
37
+ /** Location pointer for lazy loading */
38
+ export interface FilePointer {
39
+ fileId: string;
40
+ /** Optional offset/length for future optimization (packed files) */
41
+ offset?: number;
42
+ length?: number;
43
+ }
44
+ /** In-Memory Index Entry */
45
+ export interface IndexEntry {
46
+ /** Current revision */
47
+ rev: string;
48
+ /** Sequence number where this rev was minted */
49
+ seq: number;
50
+ /** Whether it is a deletion marker */
51
+ deleted?: boolean;
52
+ /** Pointer to the file containing the body (changes-*.ndjson or snapshot-data-*.json) */
53
+ location: FilePointer;
54
+ }
55
+ /** Old Legacy Snapshot (Compact + Data) - Kept for migration */
56
+ export interface LegacySnapshotData {
57
+ docs: Record<string, any>;
58
+ seq: number;
59
+ createdAt: number;
60
+ }
61
+ /** New Snapshot Index (Compact Metadata only) */
62
+ export interface SnapshotIndex {
63
+ /** Map of DocID -> IndexEntry */
64
+ entries: Record<string, IndexEntry>;
65
+ /** Sequence number at snapshot time */
66
+ seq: number;
67
+ /** Timestamp */
68
+ createdAt: number;
69
+ }
70
+ /** New Snapshot Data (Bulk Content) */
71
+ export interface SnapshotDataChunk {
72
+ /** Map of DocID -> Document Body */
73
+ docs: Record<string, any>;
74
+ }
75
+ /** Metadata file content */
76
+ export interface MetaData {
77
+ /** Current sequence number */
78
+ seq: number;
79
+ /** List of active change log file IDs */
80
+ changeLogIds: string[];
81
+ /** Snapshot Index file ID */
82
+ snapshotIndexId: string | null;
83
+ /** Last compaction timestamp */
84
+ lastCompaction: number | null;
85
+ /** Database name */
86
+ dbName: string;
87
+ /** Schema Version (for migration) */
88
+ version?: number;
89
+ }
package/lib/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@docstack/pouchdb-adapter-googledrive",
3
+ "version": "0.0.1",
4
+ "description": "PouchDB adapter for Google Drive",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "test": "jest"
10
+ },
11
+ "keywords": [
12
+ "pouchdb",
13
+ "adapter",
14
+ "google-drive"
15
+ ],
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/onyx-ac/docstack-pouchdb-adapter-gdrive.git"
19
+ },
20
+ "author": "Onyx <hello@onyx.ac> (https://onyx.ac)",
21
+ "license": "CC-BY-SA-4.0",
22
+ "bugs": {
23
+ "url": "https://github.com/onyx-ac/docstack-pouchdb-adapter-gdrive/issues"
24
+ },
25
+ "homepage": "https://onyx.ac/docstack",
26
+ "dependencies": {
27
+ "googleapis": "^126.0.0",
28
+ "pouchdb-core": "^7.3.1"
29
+ },
30
+ "devDependencies": {
31
+ "@types/jest": "^30.0.0",
32
+ "@types/node": "^20.0.0",
33
+ "@types/pouchdb-core": "^7.0.15",
34
+ "dotenv": "^17.2.3",
35
+ "jest": "^30.2.0",
36
+ "ts-jest": "^29.4.6",
37
+ "typescript": "^5.0.0"
38
+ }
39
+ }