korajs 0.5.0 → 0.6.0
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/README.md +20 -17
- package/dist/index.cjs +554 -539
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -52
- package/dist/index.d.ts +9 -52
- package/dist/index.js +538 -528
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +47 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +3 -0
- package/dist/react.d.ts +3 -0
- package/dist/react.js +24 -0
- package/dist/react.js.map +1 -0
- package/dist/svelte.cjs +71 -0
- package/dist/svelte.cjs.map +1 -0
- package/dist/svelte.d.cts +1 -0
- package/dist/svelte.d.ts +1 -0
- package/dist/svelte.js +48 -0
- package/dist/svelte.js.map +1 -0
- package/dist/vue.cjs +57 -0
- package/dist/vue.cjs.map +1 -0
- package/dist/vue.d.cts +1 -0
- package/dist/vue.d.ts +1 -0
- package/dist/vue.js +34 -0
- package/dist/vue.js.map +1 -0
- package/package.json +71 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as _korajs_core from '@korajs/core';
|
|
2
2
|
import { KoraEventEmitter, SequenceConfig, Operation, SchemaDefinition, KoraEvent, SchemaInput, FieldBuilder, InferRecord, InferInsertInput, InferUpdateInput } from '@korajs/core';
|
|
3
|
-
export { AtomicOp, AtomicOpType, CollectionDefinition, ConnectionQuality, Constraint, FieldDescriptor, FieldKindToType, HLCTimestamp, HybridLogicalClock, InferFieldType, InferInsertInput, InferRecord, InferUpdateInput, KoraError, KoraEvent, KoraEventEmitter, KoraEventListener, KoraEventType, MergeStrategy, MergeTrace, MigrationDefinition, MigrationStep, Operation, SchemaDefinition, SchemaInput, SequenceConfig, SyncRuleDefinition, TypedSchemaDefinition, VersionVector, createOperation, defineSchema, generateUUIDv7, migrate, op, t } from '@korajs/core';
|
|
3
|
+
export { AppNotReadyError, AtomicOp, AtomicOpType, CollectionDefinition, ConnectionQuality, Constraint, FieldDescriptor, FieldKindToType, HLCTimestamp, HybridLogicalClock, InferFieldType, InferInsertInput, InferRecord, InferUpdateInput, KoraError, KoraEvent, KoraEventEmitter, KoraEventListener, KoraEventType, MergeStrategy, MergeTrace, MigrationDefinition, MigrationStep, Operation, SchemaDefinition, SchemaInput, SequenceConfig, SyncRuleDefinition, TypedSchemaDefinition, VersionVector, createOperation, defineSchema, generateUUIDv7, migrate, op, t } from '@korajs/core';
|
|
4
4
|
import * as _korajs_sync from '@korajs/sync';
|
|
5
5
|
import { SyncStatusInfo, SyncEngine } from '@korajs/sync';
|
|
6
6
|
export { SyncConfig, SyncDiagnostics, SyncEncryptionConfig, SyncEngine, SyncState, SyncStatus, SyncStatusInfo, SyncStore, WebSocketTransport } from '@korajs/sync';
|
|
7
7
|
import * as _korajs_store from '@korajs/store';
|
|
8
8
|
import { CollectionRecord, BackupOptions, RestoreOptions, RestoreResult, ReplaySnapshot, AuditExportOptions, QueryBuilder, CollectionAccessor } from '@korajs/store';
|
|
9
9
|
export { AuditExportManifest, AuditExportOptions, AuditExportPayload, BackupManifest, BackupOptions, BackupProgress, CollectionAccessor, CollectionRecord, PersistedAuditTrace, ReplaySnapshot, RestoreOptions, RestoreResult, SequenceManager, StorageAdapter, Store, StoreConfig, TransactionCollectionAccessor, TransactionContext, TransactionContextConfig, decodeAuditExport, exportBackup, readAuditExportManifest, readBackupManifest, restoreBackup, verifyAuditExportChecksum, verifyBackupChecksum } from '@korajs/store';
|
|
10
|
+
import { AuthSyncBinding } from '@korajs/core/bindings';
|
|
11
|
+
export { AuthSyncBinding } from '@korajs/core/bindings';
|
|
10
12
|
export { MergeEngine, MergeInput, MergeResult } from '@korajs/merge';
|
|
11
13
|
|
|
12
14
|
/**
|
|
@@ -37,25 +39,7 @@ interface StoreOptions {
|
|
|
37
39
|
/** Max wait for a worker RPC (e.g. `open`). Defaults to 30000ms. */
|
|
38
40
|
workerResponseTimeoutMs?: number;
|
|
39
41
|
}
|
|
40
|
-
|
|
41
|
-
* Pre-built auth binding from `createKoraAuthSync()` in `@korajs/auth`.
|
|
42
|
-
* Wires token refresh, JWT scope maps, and device-bound sync node ids.
|
|
43
|
-
*/
|
|
44
|
-
interface AuthSyncBinding {
|
|
45
|
-
/** Returns the access token for sync handshake (empty string when signed out). */
|
|
46
|
-
auth: () => Promise<{
|
|
47
|
-
token: string;
|
|
48
|
-
}>;
|
|
49
|
-
/** Builds a scope map from the current token and schema. */
|
|
50
|
-
resolveScopeMap?: () => Promise<Record<string, Record<string, unknown>> | undefined>;
|
|
51
|
-
/**
|
|
52
|
-
* Returns the device-bound sync node id from the token `dev` claim.
|
|
53
|
-
* Separate from the user id (`sub`).
|
|
54
|
-
*/
|
|
55
|
-
resolveNodeId?: () => Promise<string | undefined>;
|
|
56
|
-
/** Notifies when auth state changes so sync can refresh scope or reconnect. */
|
|
57
|
-
subscribe?: (listener: () => void) => () => void;
|
|
58
|
-
}
|
|
42
|
+
|
|
59
43
|
/**
|
|
60
44
|
* Sync configuration within createApp.
|
|
61
45
|
*/
|
|
@@ -250,6 +234,8 @@ interface KoraApp {
|
|
|
250
234
|
getStore(): _korajs_store.Store;
|
|
251
235
|
/** Get the underlying SyncEngine instance. Null if sync not configured. */
|
|
252
236
|
getSyncEngine(): SyncEngine | null;
|
|
237
|
+
/** Per-app reference-counted cache for framework query subscriptions. */
|
|
238
|
+
getQueryStoreCache(): _korajs_store.QueryStoreCache;
|
|
253
239
|
/** Gracefully close the app: stop sync, close store. */
|
|
254
240
|
close(): Promise<void>;
|
|
255
241
|
/**
|
|
@@ -344,6 +330,8 @@ type TypedKoraApp<S extends SchemaInput> = {
|
|
|
344
330
|
getStore(): _korajs_store.Store;
|
|
345
331
|
/** Get the underlying SyncEngine instance. Null if sync not configured. */
|
|
346
332
|
getSyncEngine(): SyncEngine | null;
|
|
333
|
+
/** Per-app reference-counted cache for framework query subscriptions. */
|
|
334
|
+
getQueryStoreCache(): _korajs_store.QueryStoreCache;
|
|
347
335
|
/** Gracefully close the app: stop sync, close store. */
|
|
348
336
|
close(): Promise<void>;
|
|
349
337
|
/** Execute multiple mutations atomically within a transaction. */
|
|
@@ -370,39 +358,8 @@ type TypedKoraApp<S extends SchemaInput> = {
|
|
|
370
358
|
* Wires together store, merge engine, event emitter, and optionally sync
|
|
371
359
|
* into a single developer-facing `KoraApp` object. Collection accessors
|
|
372
360
|
* (e.g. `app.todos`) are defined as properties for immediate use after `await app.ready`.
|
|
373
|
-
*
|
|
374
|
-
* @param config - Application configuration including schema and optional sync settings
|
|
375
|
-
* @returns A KoraApp instance with reactive collections ready for use
|
|
376
|
-
*
|
|
377
|
-
* @example
|
|
378
|
-
* ```typescript
|
|
379
|
-
* const app = createApp({
|
|
380
|
-
* schema: defineSchema({
|
|
381
|
-
* version: 1,
|
|
382
|
-
* collections: {
|
|
383
|
-
* todos: {
|
|
384
|
-
* fields: {
|
|
385
|
-
* title: t.string(),
|
|
386
|
-
* completed: t.boolean().default(false)
|
|
387
|
-
* }
|
|
388
|
-
* }
|
|
389
|
-
* }
|
|
390
|
-
* })
|
|
391
|
-
* })
|
|
392
|
-
*
|
|
393
|
-
* await app.ready
|
|
394
|
-
* const todo = await app.todos.insert({ title: 'Hello' })
|
|
395
|
-
* ```
|
|
396
|
-
*/
|
|
397
|
-
/**
|
|
398
|
-
* Creates a new typed Kora application instance.
|
|
399
|
-
* When the schema is created with `defineSchema()`, full type inference flows through
|
|
400
|
-
* to collection accessors, providing autocomplete and type checking for all CRUD operations.
|
|
401
361
|
*/
|
|
402
362
|
declare function createApp<const S extends SchemaInput>(config: TypedKoraConfig<S>): TypedKoraApp<S>;
|
|
403
|
-
/**
|
|
404
|
-
* Creates a new Kora application instance (untyped fallback).
|
|
405
|
-
*/
|
|
406
363
|
declare function createApp(config: KoraConfig): KoraApp;
|
|
407
364
|
|
|
408
|
-
export { type AdapterType, type
|
|
365
|
+
export { type AdapterType, type KoraApp, type KoraConfig, type SequenceAccessor, type StoreOptions, type SyncControl, type SyncOptions, type TransactionCollectionProxy, type TransactionProxy, type TypedCollectionAccessor, type TypedKoraApp, type TypedKoraConfig, createApp };
|