Skip to content

Commit d889986

Browse files
Expose interfaces in docs. Mark some items as internal.
1 parent 810c6ad commit d889986

File tree

11 files changed

+198
-15
lines changed

11 files changed

+198
-15
lines changed

docs/docusaurus.config.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { themes as prismThemes } from 'prism-react-renderer';
2-
import type { TypeDocOptionMap } from 'typedoc';
3-
import type { Config } from '@docusaurus/types';
41
import type * as Preset from '@docusaurus/preset-classic';
2+
import type { Config } from '@docusaurus/types';
53
import type { PluginOptions } from 'docusaurus-plugin-typedoc';
6-
import { DOC_FOLDER, packageMap } from './utils/packageMap';
74
import 'dotenv/config';
5+
import { themes as prismThemes } from 'prism-react-renderer';
6+
import type { TypeDocOptionMap } from 'typedoc';
7+
import { DOC_FOLDER, packageMap } from './utils/packageMap';
88

99
const PROJECT_NAME = process.env.GH_PROJECT_NAME;
1010

@@ -21,12 +21,13 @@ const plugins = Object.entries(packageMap).map(([id, config]) => [
2121
enumMembersFormat: 'table',
2222
excludeProtected: true,
2323
excludePrivate: true,
24+
excludeInternal: true,
2425
indexFormat: 'table',
2526
disableSources: true,
2627
expandObjects: true,
2728
useCodeBlocks: true,
2829
typeDeclarationFormat: 'table',
29-
membersWithOwnFile: ['Class', 'Enum', 'Function'],
30+
membersWithOwnFile: ['Class', 'Enum', 'Function', 'Interface'],
3031
textContentMappings: {
3132
'title.memberPage': '{name}'
3233
}
@@ -155,8 +156,8 @@ const config: Config = {
155156
darkTheme: prismThemes.dracula
156157
},
157158
future: {
158-
experimental_faster: true,
159-
},
159+
experimental_faster: true
160+
}
160161
} satisfies Preset.ThemeConfig
161162
};
162163

packages/common/src/client/sync/bucket/BucketStorageAdapter.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,64 @@ import { CrudBatch } from './CrudBatch.js';
33
import { CrudEntry, OpId } from './CrudEntry.js';
44
import { SyncDataBatch } from './SyncDataBatch.js';
55

6+
/**
7+
* @internal
8+
*/
69
export interface BucketDescription {
710
name: string;
811
priority: number;
912
}
1013

14+
/**
15+
* @internal
16+
*/
1117
export interface Checkpoint {
1218
last_op_id: OpId;
1319
buckets: BucketChecksum[];
1420
write_checkpoint?: string;
1521
}
1622

23+
/**
24+
* @internal
25+
*/
1726
export interface BucketState {
1827
bucket: string;
1928
op_id: string;
2029
}
2130

31+
/**
32+
* @internal
33+
*/
2234
export interface ChecksumCache {
2335
checksums: Map<string, { checksum: BucketChecksum; last_op_id: OpId }>;
2436
lastOpId: OpId;
2537
}
2638

39+
/**
40+
* @internal
41+
*/
2742
export interface SyncLocalDatabaseResult {
2843
ready: boolean;
2944
checkpointValid: boolean;
3045
checkpointFailures?: string[];
3146
}
3247

48+
/**
49+
* @internal
50+
*/
3351
export type SavedProgress = {
3452
atLast: number;
3553
sinceLast: number;
3654
};
3755

56+
/**
57+
* @internal
58+
*/
3859
export type BucketOperationProgress = Record<string, SavedProgress>;
3960

61+
/**
62+
* @internal
63+
*/
4064
export interface BucketChecksum {
4165
bucket: string;
4266
priority?: number;
@@ -51,6 +75,9 @@ export interface BucketChecksum {
5175
count?: number;
5276
}
5377

78+
/**
79+
* @internal
80+
*/
5481
export enum PSInternalTable {
5582
DATA = 'ps_data',
5683
CRUD = 'ps_crud',
@@ -59,6 +86,9 @@ export enum PSInternalTable {
5986
UNTYPED = 'ps_untyped'
6087
}
6188

89+
/**
90+
* @internal
91+
*/
6292
export enum PowerSyncControlCommand {
6393
PROCESS_TEXT_LINE = 'line_text',
6494
PROCESS_BSON_LINE = 'line_binary',
@@ -68,10 +98,16 @@ export enum PowerSyncControlCommand {
6898
NOTIFY_CRUD_UPLOAD_COMPLETED = 'completed_upload'
6999
}
70100

101+
/**
102+
* @internal
103+
*/
71104
export interface BucketStorageListener extends BaseListener {
72105
crudUpdate: () => void;
73106
}
74107

108+
/**
109+
* @internal
110+
*/
75111
export interface BucketStorageAdapter extends BaseObserver<BucketStorageListener>, Disposable {
76112
init(): Promise<void>;
77113
saveSyncData(batch: SyncDataBatch, fixedKeyFormat?: boolean): Promise<void>;

packages/common/src/client/sync/bucket/OpType.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1+
/**
2+
* @internal
3+
*/
14
export enum OpTypeEnum {
25
CLEAR = 1,
36
MOVE = 2,
47
PUT = 3,
58
REMOVE = 4
69
}
710

11+
/**
12+
* @internal
13+
*/
814
export type OpTypeJSON = string;
915

1016
/**
1117
* Used internally for sync buckets.
18+
* @internal
1219
*/
1320
export class OpType {
1421
static fromJSON(jsonValue: OpTypeJSON) {

packages/common/src/client/sync/bucket/SqliteBucketStorage.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ import { CrudBatch } from './CrudBatch.js';
1717
import { CrudEntry, CrudEntryJSON } from './CrudEntry.js';
1818
import { SyncDataBatch } from './SyncDataBatch.js';
1919

20+
/**
21+
* @internal
22+
*/
2023
export class SqliteBucketStorage extends BaseObserver<BucketStorageListener> implements BucketStorageAdapter {
2124
public tableNames: Set<string>;
2225
private _hasCompletedSync: boolean;

packages/common/src/client/sync/bucket/SyncDataBatch.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { SyncDataBucket } from './SyncDataBucket.js';
22

33
// TODO JSON
44

5+
/**
6+
* @internal
7+
*/
58
export class SyncDataBatch {
69
static fromJSON(json: any) {
710
return new SyncDataBatch(json.buckets.map((bucket: any) => SyncDataBucket.fromRow(bucket)));

packages/common/src/client/sync/bucket/SyncDataBucket.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { OpId } from './CrudEntry.js';
22
import { OplogEntry, OplogEntryJSON } from './OplogEntry.js';
33

4+
/**
5+
* @internal
6+
*/
47
export type SyncDataBucketJSON = {
58
bucket: string;
69
has_more?: boolean;
@@ -9,6 +12,9 @@ export type SyncDataBucketJSON = {
912
data: OplogEntryJSON[];
1013
};
1114

15+
/**
16+
* @internal
17+
*/
1218
export class SyncDataBucket {
1319
static fromRow(row: SyncDataBucketJSON) {
1420
return new SyncDataBucket(

packages/common/src/client/sync/stream/AbstractRemote.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ import PACKAGE from '../../../../package.json' with { type: 'json' };
77
import { AbortOperation } from '../../../utils/AbortOperation.js';
88
import { DataStream } from '../../../utils/DataStream.js';
99
import { PowerSyncCredentials } from '../../connection/PowerSyncCredentials.js';
10-
import {
11-
StreamingSyncLine,
12-
StreamingSyncLineOrCrudUploadComplete,
13-
StreamingSyncRequest
14-
} from './streaming-sync-types.js';
10+
import { StreamingSyncRequest } from './streaming-sync-types.js';
1511
import { WebsocketClientTransport } from './WebsocketClientTransport.js';
1612

13+
/**
14+
* @internal
15+
*/
1716
export type BSONImplementation = typeof BSON;
1817

18+
/**
19+
* @internal
20+
*/
1921
export type RemoteConnector = {
2022
fetchCredentials: () => Promise<PowerSyncCredentials | null>;
2123
invalidateCredentials?: () => void;
@@ -39,6 +41,9 @@ const KEEP_ALIVE_LIFETIME_MS = 90_000;
3941

4042
export const DEFAULT_REMOTE_LOGGER = Logger.get('PowerSyncRemote');
4143

44+
/**
45+
* @internal
46+
*/
4247
export type SyncStreamOptions = {
4348
path: string;
4449
data: StreamingSyncRequest;
@@ -65,20 +70,27 @@ export type SocketSyncStreamOptions = SyncStreamOptions & {
6570
fetchStrategy: FetchStrategy;
6671
};
6772

73+
/**
74+
* @internal
75+
*/
6876
export type FetchImplementation = typeof fetch;
6977

7078
/**
7179
* Class wrapper for providing a fetch implementation.
7280
* The class wrapper is used to distinguish the fetchImplementation
7381
* option in [AbstractRemoteOptions] from the general fetch method
7482
* which is typeof "function"
83+
* @internal
7584
*/
7685
export class FetchImplementationProvider {
7786
getFetch(): FetchImplementation {
7887
throw new Error('Unspecified fetch implementation');
7988
}
8089
}
8190

91+
/**
92+
* @internal
93+
*/
8294
export type AbstractRemoteOptions = {
8395
/**
8496
* Transforms the PowerSync base URL which might contain

packages/common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import Logger, { ILogger } from 'js-logger';
22

3-
import { DataStream } from '../../../utils/DataStream.js';
4-
import { SyncStatus, SyncStatusOptions } from '../../../db/crud/SyncStatus.js';
53
import { FULL_SYNC_PRIORITY, InternalProgressInformation } from '../../../db/crud/SyncProgress.js';
64
import * as sync_status from '../../../db/crud/SyncStatus.js';
5+
import { SyncStatus, SyncStatusOptions } from '../../../db/crud/SyncStatus.js';
76
import { AbortOperation } from '../../../utils/AbortOperation.js';
87
import { BaseListener, BaseObserver, Disposable } from '../../../utils/BaseObserver.js';
8+
import { DataStream } from '../../../utils/DataStream.js';
99
import { throttleLeadingTrailing } from '../../../utils/async.js';
1010
import {
1111
BucketChecksum,
@@ -17,6 +17,7 @@ import {
1717
import { CrudEntry } from '../bucket/CrudEntry.js';
1818
import { SyncDataBucket } from '../bucket/SyncDataBucket.js';
1919
import { AbstractRemote, FetchStrategy, SyncStreamOptions } from './AbstractRemote.js';
20+
import { EstablishSyncStream, Instruction, SyncPriorityStatus } from './core-instruction.js';
2021
import {
2122
BucketRequest,
2223
CrudUploadNotification,
@@ -30,8 +31,10 @@ import {
3031
isStreamingSyncCheckpointPartiallyComplete,
3132
isStreamingSyncData
3233
} from './streaming-sync-types.js';
33-
import { EstablishSyncStream, Instruction, SyncPriorityStatus } from './core-instruction.js';
3434

35+
/**
36+
* @internal
37+
*/
3538
export enum LockType {
3639
CRUD = 'crud',
3740
SYNC = 'sync'
@@ -88,13 +91,18 @@ export const DEFAULT_SYNC_CLIENT_IMPLEMENTATION = SyncClientImplementation.JAVAS
8891

8992
/**
9093
* Abstract Lock to be implemented by various JS environments
94+
*
95+
* @internal
9196
*/
9297
export interface LockOptions<T> {
9398
callback: () => Promise<T>;
9499
type: LockType;
95100
signal?: AbortSignal;
96101
}
97102

103+
/**
104+
* @internal
105+
*/
98106
export interface AbstractStreamingSyncImplementationOptions extends AdditionalConnectionOptions {
99107
adapter: BucketStorageAdapter;
100108
uploadCrud: () => Promise<void>;
@@ -125,6 +133,9 @@ export interface StreamingSyncImplementationListener extends BaseListener {
125133
*/
126134
export type PowerSyncConnectionOptions = Omit<InternalConnectionOptions, 'serializedSchema'>;
127135

136+
/**
137+
* @internal
138+
*/
128139
export interface InternalConnectionOptions extends BaseConnectionOptions, AdditionalConnectionOptions {}
129140

130141
/** @internal */
@@ -208,6 +219,9 @@ export const DEFAULT_STREAMING_SYNC_OPTIONS = {
208219
crudUploadThrottleMs: DEFAULT_CRUD_UPLOAD_THROTTLE_MS
209220
};
210221

222+
/**
223+
* @internal
224+
*/
211225
export type RequiredPowerSyncConnectionOptions = Required<BaseConnectionOptions>;
212226

213227
export const DEFAULT_STREAM_CONNECTION_OPTIONS: RequiredPowerSyncConnectionOptions = {

0 commit comments

Comments
 (0)