@sidekickdb/react-native 2.0.1 → 3.0.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 +2 -2
- package/__tests__/Storage.native.test.ts +35 -0
- package/dist/Storage.native.js +1 -1
- package/dist/Storage.native.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/module/Storage.native.js +1 -1
- package/dist/module/Storage.native.js.map +1 -1
- package/dist/module/index.d.ts +7 -7
- package/dist/module/index.d.ts.map +1 -1
- package/dist/module/index.js +10 -10
- package/dist/module/index.js.map +1 -1
- package/package.json +6 -6
- package/src/Storage.native.ts +1 -1
- package/src/index.ts +57 -57
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Welcome to SidekickDB's React Native SDK.
|
|
|
9
9
|
```javascript
|
|
10
10
|
// ༼ つ ◕_◕ ༽つ Real-time Chat
|
|
11
11
|
// ----------------------------------
|
|
12
|
-
// * Updates
|
|
12
|
+
// * Updates in real time
|
|
13
13
|
// * Multiplayer
|
|
14
14
|
// * Works offline
|
|
15
15
|
|
|
@@ -17,7 +17,7 @@ import { init, id } from '@sidekickdb/react-native';
|
|
|
17
17
|
|
|
18
18
|
const db = init({
|
|
19
19
|
appId: process.env.NEXT_PUBLIC_APP_ID,
|
|
20
|
-
apiURI: process.env.
|
|
20
|
+
apiURI: process.env.NEXT_PUBLIC_SIDEKICK_API_URI,
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
function Chat() {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// SidekickDB: the store's key names.
|
|
2
|
+
import { beforeEach, expect, test, vi } from 'vitest';
|
|
3
|
+
|
|
4
|
+
const data = new Map<string, string>();
|
|
5
|
+
|
|
6
|
+
// The installed async-storage package runs its web build here, on
|
|
7
|
+
// window.localStorage; back that with `data`.
|
|
8
|
+
(globalThis as any).window = {
|
|
9
|
+
localStorage: {
|
|
10
|
+
getItem: (k: string) => data.get(k) ?? null,
|
|
11
|
+
setItem: (k: string, v: string) => void data.set(k, v),
|
|
12
|
+
removeItem: (k: string) => void data.delete(k),
|
|
13
|
+
key: (i: number) => [...data.keys()][i] ?? null,
|
|
14
|
+
get length() {
|
|
15
|
+
return data.size;
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
async function loadStore() {
|
|
21
|
+
vi.resetModules();
|
|
22
|
+
return (await import('../src/Storage.native')).AsyncStorageStore;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
data.clear();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('stores under the new name', async () => {
|
|
30
|
+
const Store = await loadStore();
|
|
31
|
+
const kv = new Store('a', 'kv');
|
|
32
|
+
await kv.setItem('currentUser', { id: 'u' });
|
|
33
|
+
expect(await kv.getItem('currentUser')).toEqual({ id: 'u' });
|
|
34
|
+
expect([...data.keys()]).toEqual(['sidekick_a_5_kv_currentUser']);
|
|
35
|
+
});
|
package/dist/Storage.native.js
CHANGED
|
@@ -26,7 +26,7 @@ class AsyncStorageStore extends core_1.StoreInterface {
|
|
|
26
26
|
this.dbName = dbName;
|
|
27
27
|
}
|
|
28
28
|
makeKey(k) {
|
|
29
|
-
return `
|
|
29
|
+
return `sidekick_${this.appId}_${version}_${this.dbName}_${k}`;
|
|
30
30
|
}
|
|
31
31
|
async getItem(k) {
|
|
32
32
|
const res = await AsyncStorage.getItem(this.makeKey(k));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Storage.native.js","sourceRoot":"","sources":["../src/Storage.native.ts"],"names":[],"mappings":";;;AAAA,2CAA2E;AAE3E,MAAM,OAAO,GAAG,CAAC,CAAC;AAElB,sEAAsE;AACtE,wEAAwE;AACxE,2EAA2E;AAC3E,2EAA2E;AAC3E,2EAA2E;AAC3E,mDAAmD;AACnD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,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CACpE,CAAC;IACJ,CAAC;CACF;AA5CD,8CA4CC;AAED,MAAM,YAAa,SAAQ,qBAAc;IACvC,YAAY,KAAa,EAAE,MAA+B;QACxD,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,MAAM,IAAI,KAAK,CACb,sDAAsD;YACpD,uDAAuD;YACvD,uGAAuG;YACvG,CAAC,qBAAqB;gBACpB,CAAC,CAAC,0CAA0C,qBAAqB,EAAE;gBACnE,CAAC,CAAC,EAAE,CAAC,CACV,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,EAAU;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU,IAAkB,CAAC;IAE9C,KAAK,CAAC,QAAQ,CAAC,cAAoC,IAAkB,CAAC;IAEtE,KAAK,CAAC,UAAU;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAED,kBAAe,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,YAAY,CAAC","sourcesContent":["import { StoreInterface, StoreInterfaceStoreName } from '@sidekickdb/core';\n\nconst version = 5;\n\n// AsyncStorage is an optional peer dependency. The `require` must sit\n// directly inside a `try` block: that's what makes Metro treat it as an\n// optional dependency (`transformer.allowOptionalDependencies`, enabled by\n// default in the Expo and React Native metro configs), so bundling doesn't\n// fail when it isn't installed. When it can't be loaded, `init` surfaces a\n// helpful error unless a custom `Store` is passed.\nlet AsyncStorage: any = null;\nlet asyncStorageLoadError: unknown = null;\ntry {\n AsyncStorage = require('@react-native-async-storage/async-storage').default;\n} catch (e) {\n asyncStorageLoadError = e;\n}\n\nexport class AsyncStorageStore extends StoreInterface {\n private appId: string;\n private dbName: StoreInterfaceStoreName;\n constructor(appId: string, dbName: StoreInterfaceStoreName) {\n super(appId, dbName);\n this.appId = appId;\n this.dbName = dbName;\n }\n\n private makeKey(k: string): string {\n return `sidekick_${this.appId}_${version}_${this.dbName}_${k}`;\n }\n\n async getItem(k) {\n const res = await AsyncStorage.getItem(this.makeKey(k));\n if (res === null) return res;\n return JSON.parse(res);\n }\n\n async setItem(k, v) {\n await AsyncStorage.setItem(this.makeKey(k), JSON.stringify(v));\n }\n\n async removeItem(k: string): Promise<void> {\n await AsyncStorage.removeItem(this.makeKey(k));\n }\n\n async getAllKeys(): Promise<string[]> {\n const allKeys = await AsyncStorage.getAllKeys();\n const keys: string[] = [];\n const keyPrefix = this.makeKey('');\n for (const key of allKeys) {\n if (key.startsWith(keyPrefix)) {\n keys.push(key.substring(keyPrefix.length));\n }\n }\n return keys;\n }\n\n async multiSet(keyValuePairs: Array<[string, any]>): Promise<void> {\n await AsyncStorage.multiSet(\n keyValuePairs.map(([k, v]) => [this.makeKey(k), JSON.stringify(v)]),\n );\n }\n}\n\nclass MissingStore extends StoreInterface {\n constructor(appId: string, dbName: StoreInterfaceStoreName) {\n super(appId, dbName);\n throw new Error(\n 'SidekickDB needs a store to persist data on device. ' +\n 'Install `@react-native-async-storage/async-storage`, ' +\n 'or pass a `Store` to `init` (e.g. from `@sidekickdb/react-native-mmkv` or `@sidekickdb/expo-sqlite`).' +\n (asyncStorageLoadError\n ? `\\n\\nLoading async-storage failed with: ${asyncStorageLoadError}`\n : ''),\n );\n }\n\n async getItem(_k: string): Promise<any> {\n return null;\n }\n\n async removeItem(_k: string): Promise<void> {}\n\n async multiSet(_keyValuePairs: Array<[string, any]>): Promise<void> {}\n\n async getAllKeys(): Promise<string[]> {\n return [];\n }\n}\n\nexport default AsyncStorage ? AsyncStorageStore : MissingStore;\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'react-native-get-random-values';
|
|
2
2
|
import Store from './Storage';
|
|
3
3
|
import NetworkListener from './NetworkListener';
|
|
4
|
-
import {
|
|
5
|
-
import { i, id, tx, lookup,
|
|
4
|
+
import { SidekickReactAbstractDatabase } from '@sidekickdb/react-common';
|
|
5
|
+
import { i, id, tx, lookup, SidekickAPIError, setSidekickWarningsEnabled, SyncTableCallbackEventType, createSidekickRouteHandler, type RoomSchemaShape, type SidekickQuery, type SidekickQueryResult, type SidekickSchema, type SidekickSchemaDatabase, type ConnectionStatus, type BackwardsCompatibleSchema, type ISidekickDatabase, type Config, type Query, type QueryResponse, type SidekickObject, type AuthState, type User, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type SidekickGraph, type SidekickUnknownSchemaDef, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type SidekickEntity, type SideQLEntity, type SideQLResult, type SideQLEntitySubquery, type RoomsOf, type RoomsDef, type PresenceOf, type TopicsOf, type TopicOf, type RoomHandle, type CreateParams, type SidekickConfig, type SidekickSchemaDef, type SidekickUnknownSchema, type TransactionChunk, type SidekickRules, type UpdateParams, type LinkParams, type ValidQuery, type CheckMagicCodeParams, type CheckMagicCodeResponse, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, StoreInterface, type StoreInterfaceStoreName, CreateReadStreamOpts, CreateWriteStreamOpts, SidekickWritableStream, SidekickReadableStream, type Logger } from '@sidekickdb/core';
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
8
|
* The first step: init your application!
|
|
@@ -17,15 +17,15 @@ import { i, id, tx, lookup, InstantAPIError, setInstantWarningsEnabled, SyncTabl
|
|
|
17
17
|
* // You can also provide a schema for type safety and editor autocomplete!
|
|
18
18
|
*
|
|
19
19
|
* import { init } from "@sidekickdb/react-native"
|
|
20
|
-
* import schema from ""../
|
|
20
|
+
* import schema from ""../sidekick.schema.ts";
|
|
21
21
|
*
|
|
22
22
|
* const db = init({ appId: "my-app-id", apiURI: "https://sidekick.example.com", schema })
|
|
23
23
|
*
|
|
24
24
|
* // To learn more: https://sidekickdb.co/docs/modeling-data
|
|
25
25
|
*/
|
|
26
|
-
declare function init<Schema extends
|
|
26
|
+
declare function init<Schema extends SidekickSchemaDef<any, any, any> = SidekickUnknownSchema, UseDates extends boolean = false>(config: Omit<SidekickConfig<Schema, UseDates>, 'useDateObjects'> & {
|
|
27
27
|
useDateObjects?: UseDates;
|
|
28
|
-
}):
|
|
28
|
+
}): SidekickReactNativeDatabase<Schema, UseDates, SidekickConfig<Schema, UseDates>>;
|
|
29
29
|
/**
|
|
30
30
|
* @deprecated
|
|
31
31
|
* `init_experimental` is deprecated. You can replace it with `init`.
|
|
@@ -41,7 +41,7 @@ declare function init<Schema extends InstantSchemaDef<any, any, any> = InstantUn
|
|
|
41
41
|
* const db = init({ ... });
|
|
42
42
|
*/
|
|
43
43
|
declare const init_experimental: typeof init;
|
|
44
|
-
declare class
|
|
44
|
+
declare class SidekickReactNativeDatabase<Schema extends SidekickSchemaDef<any, any, any>, UseDates extends boolean, Config extends SidekickConfig<Schema, UseDates> = SidekickConfig<Schema, UseDates>> extends SidekickReactAbstractDatabase<Schema, UseDates, Config> {
|
|
45
45
|
static Store: typeof Store;
|
|
46
46
|
static NetworkListener: typeof NetworkListener;
|
|
47
47
|
static EventSourceImpl: {
|
|
@@ -52,5 +52,5 @@ declare class InstantReactNativeDatabase<Schema extends InstantSchemaDef<any, an
|
|
|
52
52
|
readonly CLOSED: 2;
|
|
53
53
|
} | typeof import("./EventSourceShim").default;
|
|
54
54
|
}
|
|
55
|
-
export { init, init_experimental, id, tx, lookup, i,
|
|
55
|
+
export { init, init_experimental, id, tx, lookup, i, createSidekickRouteHandler, SidekickReactNativeDatabase, SidekickAPIError, setSidekickWarningsEnabled, SyncTableCallbackEventType, type Config, type Query, type QueryResponse, type SidekickObject, type User, type AuthState, type ConnectionStatus, type SidekickQuery, type SidekickQueryResult, type SidekickSchema, type SidekickSchemaDatabase, type ISidekickDatabase, type SidekickEntity, type RoomSchemaShape, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type SidekickGraph, type CreateParams, type LinkAttrDef, type SidekickConfig, type LinkDef, type SidekickUnknownSchemaDef, type LinksDef, type RoomsOf, type RoomsDef, type RoomHandle, type PresenceOf, type TopicsOf, type TopicOf, type ResolveAttrs, type ValueTypes, type SideQLEntity, type SideQLResult, type SideQLEntitySubquery, type SidekickSchemaDef, type SidekickUnknownSchema, type BackwardsCompatibleSchema, type SidekickRules, type UpdateParams, type LinkParams, type ValidQuery, type CheckMagicCodeParams, type CheckMagicCodeResponse, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type TransactionChunk, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type CreateReadStreamOpts, type CreateWriteStreamOpts, type SidekickWritableStream, type SidekickReadableStream, StoreInterface, type StoreInterfaceStoreName, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, type Logger, };
|
|
56
56
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AAExC,OAAO,KAAK,MAAM,WAAW,CAAC;AAE9B,OAAO,eAAe,MAAM,mBAAmB,CAAC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ACxB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EAGnB,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EAGvB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAG3B,cAAc,EACd,KAAK,uBAAuB,EAG5B,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EAGxB,KAAK,MAAM,GACZ,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.StoreInterface = exports.SyncTableCallbackEventType = exports.
|
|
6
|
+
exports.StoreInterface = exports.SyncTableCallbackEventType = exports.setSidekickWarningsEnabled = exports.SidekickAPIError = exports.SidekickReactNativeDatabase = exports.createSidekickRouteHandler = exports.i = exports.lookup = exports.tx = exports.id = exports.init_experimental = void 0;
|
|
7
7
|
exports.init = init;
|
|
8
8
|
require("react-native-get-random-values");
|
|
9
9
|
const Storage_1 = __importDefault(require("./Storage"));
|
|
@@ -17,16 +17,16 @@ Object.defineProperty(exports, "i", { enumerable: true, get: function () { retur
|
|
|
17
17
|
Object.defineProperty(exports, "id", { enumerable: true, get: function () { return core_1.id; } });
|
|
18
18
|
Object.defineProperty(exports, "tx", { enumerable: true, get: function () { return core_1.tx; } });
|
|
19
19
|
Object.defineProperty(exports, "lookup", { enumerable: true, get: function () { return core_1.lookup; } });
|
|
20
|
-
Object.defineProperty(exports, "
|
|
20
|
+
Object.defineProperty(exports, "SidekickAPIError", { enumerable: true, get: function () { return
|
|
21
21
|
// error
|
|
22
|
-
core_1.
|
|
23
|
-
Object.defineProperty(exports, "
|
|
22
|
+
core_1.SidekickAPIError; } });
|
|
23
|
+
Object.defineProperty(exports, "setSidekickWarningsEnabled", { enumerable: true, get: function () { return core_1.setSidekickWarningsEnabled; } });
|
|
24
24
|
Object.defineProperty(exports, "SyncTableCallbackEventType", { enumerable: true, get: function () { return
|
|
25
25
|
// sync table enums
|
|
26
26
|
core_1.SyncTableCallbackEventType; } });
|
|
27
|
-
Object.defineProperty(exports, "
|
|
27
|
+
Object.defineProperty(exports, "createSidekickRouteHandler", { enumerable: true, get: function () { return
|
|
28
28
|
// types
|
|
29
|
-
core_1.
|
|
29
|
+
core_1.createSidekickRouteHandler; } });
|
|
30
30
|
Object.defineProperty(exports, "StoreInterface", { enumerable: true, get: function () { return core_1.StoreInterface; } });
|
|
31
31
|
/**
|
|
32
32
|
*
|
|
@@ -42,7 +42,7 @@ Object.defineProperty(exports, "StoreInterface", { enumerable: true, get: functi
|
|
|
42
42
|
* // You can also provide a schema for type safety and editor autocomplete!
|
|
43
43
|
*
|
|
44
44
|
* import { init } from "@sidekickdb/react-native"
|
|
45
|
-
* import schema from ""../
|
|
45
|
+
* import schema from ""../sidekick.schema.ts";
|
|
46
46
|
*
|
|
47
47
|
* const db = init({ appId: "my-app-id", apiURI: "https://sidekick.example.com", schema })
|
|
48
48
|
*
|
|
@@ -50,7 +50,7 @@ Object.defineProperty(exports, "StoreInterface", { enumerable: true, get: functi
|
|
|
50
50
|
*/
|
|
51
51
|
function init(
|
|
52
52
|
// Allows config with missing `useDateObjects`, but keeps `UseDates`
|
|
53
|
-
// as a non-nullable in the
|
|
53
|
+
// as a non-nullable in the SidekickConfig type.
|
|
54
54
|
config) {
|
|
55
55
|
const configStrict = {
|
|
56
56
|
ReadableStream: Streams_1.streamConstructors.ReadableStream,
|
|
@@ -58,8 +58,8 @@ config) {
|
|
|
58
58
|
...config,
|
|
59
59
|
useDateObjects: (config.useDateObjects ?? false),
|
|
60
60
|
};
|
|
61
|
-
return new
|
|
62
|
-
'@
|
|
61
|
+
return new SidekickReactNativeDatabase(configStrict, {
|
|
62
|
+
'@sidekickdb/react': version_1.default,
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
@@ -78,10 +78,10 @@ config) {
|
|
|
78
78
|
*/
|
|
79
79
|
const init_experimental = init;
|
|
80
80
|
exports.init_experimental = init_experimental;
|
|
81
|
-
class
|
|
81
|
+
class SidekickReactNativeDatabase extends react_common_1.SidekickReactAbstractDatabase {
|
|
82
82
|
static Store = Storage_1.default;
|
|
83
83
|
static NetworkListener = NetworkListener_1.default;
|
|
84
84
|
static EventSourceImpl = EventSourceImpl_1.default;
|
|
85
85
|
}
|
|
86
|
-
exports.
|
|
86
|
+
exports.SidekickReactNativeDatabase = SidekickReactNativeDatabase;
|
|
87
87
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AA0LE,oBAAI;AA1LN,0CAAwC;AAExC,wDAA8B;AAC9B,wEAAgD;AAChD,wEAAgD;AAChD,wDAAgC;AAChC,uCAA+C;AAE/C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AA0LE,oBAAI;AA1LN,0CAAwC;AAExC,wDAA8B;AAC9B,wEAAgD;AAChD,wEAAgD;AAChD,wDAAgC;AAChC,uCAA+C;AAE/C,2DAAyE;AAEzE,2CA+F0B;AAsFxB,kFApLA,QAAC,OAoLA;AAHD,mFAhLA,SAAE,OAgLA;AACF,mFAhLA,SAAE,OAgLA;AACF,uFAhLA,aAAM,OAgLA;AAMN;IArLA,QAAQ;IACR,uBAAgB,OAoLA;AAChB,2GApLA,iCAA0B,OAoLA;AAG1B;IArLA,mBAAmB;IACnB,iCAA0B,OAoLA;AAR1B;IA1KA,QAAQ;IACR,iCAA0B,OAyKA;AAmF1B,+FAjLA,qBAAc,OAiLA;AAxKhB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAS,IAAI;AAIX,oEAAoE;AACpE,gDAAgD;AAChD,MAEC;IAMD,MAAM,YAAY,GAAG;QACnB,cAAc,EAAE,4BAAkB,CAAC,cAAc;QACjD,cAAc,EAAE,4BAAkB,CAAC,cAAc;QACjD,GAAG,MAAM;QACT,cAAc,EAAE,CAAC,MAAM,CAAC,cAAc,IAAI,KAAK,CAAa;KAC7D,CAAC;IACF,OAAO,IAAI,2BAA2B,CAIpC,YAAY,EAAE;QACd,mBAAmB,EAAE,iBAAO;KAC7B,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAiB7B,8CAAiB;AAfnB,MAAM,2BAOJ,SAAQ,4CAAuD;IAC/D,MAAM,CAAC,KAAK,GAAG,iBAAK,CAAC;IACrB,MAAM,CAAC,eAAe,GAAG,yBAAe,CAAC;IACzC,MAAM,CAAC,eAAe,GAAG,yBAAe,CAAC;;AAWzC,kEAA2B","sourcesContent":["import 'react-native-get-random-values';\n\nimport Store from './Storage';\nimport EventSourceImpl from './EventSourceImpl';\nimport NetworkListener from './NetworkListener';\nimport version from './version';\nimport { streamConstructors } from './Streams';\n\nimport { SidekickReactAbstractDatabase } from '@sidekickdb/react-common';\n\nimport {\n i,\n id,\n tx,\n lookup,\n // error\n SidekickAPIError,\n setSidekickWarningsEnabled,\n\n // sync table enums\n SyncTableCallbackEventType,\n\n // types\n createSidekickRouteHandler,\n type RoomSchemaShape,\n type SidekickQuery,\n type SidekickQueryResult,\n type SidekickSchema,\n type SidekickSchemaDatabase,\n type ConnectionStatus,\n type BackwardsCompatibleSchema,\n type ISidekickDatabase,\n type Config,\n type Query,\n type QueryResponse,\n type SidekickObject,\n type AuthState,\n type User,\n\n // presence types\n type PresencePeer,\n\n // schema types\n type AttrsDefs,\n type CardinalityKind,\n type DataAttrDef,\n type EntitiesDef,\n type EntitiesWithLinks,\n type EntityDef,\n type SidekickGraph,\n type SidekickUnknownSchemaDef,\n type LinkAttrDef,\n type LinkDef,\n type LinksDef,\n type ResolveAttrs,\n type ValueTypes,\n type SidekickEntity,\n type ConfigWithSchema,\n type SideQLEntity,\n type SideQLResult,\n type SideQLEntitySubquery,\n type RoomsOf,\n type RoomsDef,\n type PresenceOf,\n type TopicsOf,\n type TopicOf,\n type RoomHandle,\n type CreateParams,\n type SidekickConfig,\n type SidekickSchemaDef,\n type SidekickUnknownSchema,\n type TransactionChunk,\n type SidekickRules,\n type UpdateParams,\n type LinkParams,\n type ValidQuery,\n type CheckMagicCodeParams,\n type CheckMagicCodeResponse,\n type ExchangeCodeForTokenParams,\n type SendMagicCodeParams,\n type SendMagicCodeResponse,\n type SignInWithIdTokenParams,\n type VerifyMagicCodeParams,\n type VerifyResponse,\n\n // storage types\n type FileOpts,\n type UploadFileResponse,\n type DeleteFileResponse,\n\n // sync table types\n type SyncTableCallback,\n type SyncTableCallbackEvent,\n type SyncTableInitialSyncBatch,\n type SyncTableInitialSyncComplete,\n type SyncTableSyncTransaction,\n type SyncTableLoadFromStorage,\n type SyncTableSetupError,\n StoreInterface,\n type StoreInterfaceStoreName,\n CreateReadStreamOpts,\n CreateWriteStreamOpts,\n SidekickWritableStream,\n SidekickReadableStream,\n type Logger,\n} from '@sidekickdb/core';\n\n/**\n *\n * The first step: init your application!\n *\n * Find your `appId` in your SidekickDB dashboard.\n *\n * @example\n * import { init } from \"@sidekickdb/react-native\"\n *\n * const db = init({ appId: \"my-app-id\", apiURI: \"https://sidekick.example.com\" })\n *\n * // You can also provide a schema for type safety and editor autocomplete!\n *\n * import { init } from \"@sidekickdb/react-native\"\n * import schema from \"\"../sidekick.schema.ts\";\n *\n * const db = init({ appId: \"my-app-id\", apiURI: \"https://sidekick.example.com\", schema })\n *\n * // To learn more: https://sidekickdb.co/docs/modeling-data\n */\nfunction init<\n Schema extends SidekickSchemaDef<any, any, any> = SidekickUnknownSchema,\n UseDates extends boolean = false,\n>(\n // Allows config with missing `useDateObjects`, but keeps `UseDates`\n // as a non-nullable in the SidekickConfig type.\n config: Omit<SidekickConfig<Schema, UseDates>, 'useDateObjects'> & {\n useDateObjects?: UseDates;\n },\n): SidekickReactNativeDatabase<\n Schema,\n UseDates,\n SidekickConfig<Schema, UseDates>\n> {\n const configStrict = {\n ReadableStream: streamConstructors.ReadableStream,\n WritableStream: streamConstructors.WritableStream,\n ...config,\n useDateObjects: (config.useDateObjects ?? false) as UseDates,\n };\n return new SidekickReactNativeDatabase<\n Schema,\n UseDates,\n SidekickConfig<Schema, UseDates>\n >(configStrict, {\n '@sidekickdb/react': version,\n });\n}\n\n/**\n * @deprecated\n * `init_experimental` is deprecated. You can replace it with `init`.\n *\n * @example\n *\n * // Before\n * import { init_experimental } from \"@sidekickdb/react-native\"\n * const db = init_experimental({ ... });\n *\n * // After\n * import { init } from \"@sidekickdb/react-native\"\n * const db = init({ ... });\n */\nconst init_experimental = init;\n\nclass SidekickReactNativeDatabase<\n Schema extends SidekickSchemaDef<any, any, any>,\n UseDates extends boolean,\n Config extends SidekickConfig<Schema, UseDates> = SidekickConfig<\n Schema,\n UseDates\n >,\n> extends SidekickReactAbstractDatabase<Schema, UseDates, Config> {\n static Store = Store;\n static NetworkListener = NetworkListener;\n static EventSourceImpl = EventSourceImpl;\n}\n\nexport {\n init,\n init_experimental,\n id,\n tx,\n lookup,\n i,\n createSidekickRouteHandler,\n SidekickReactNativeDatabase,\n\n // error\n SidekickAPIError,\n setSidekickWarningsEnabled,\n\n // sync table enums\n SyncTableCallbackEventType,\n\n // types\n type Config,\n type Query,\n type QueryResponse,\n type SidekickObject,\n type User,\n type AuthState,\n type ConnectionStatus,\n type SidekickQuery,\n type SidekickQueryResult,\n type SidekickSchema,\n type SidekickSchemaDatabase,\n type ISidekickDatabase,\n type SidekickEntity,\n type RoomSchemaShape,\n\n // presence types\n type PresencePeer,\n\n // schema types\n type AttrsDefs,\n type CardinalityKind,\n type DataAttrDef,\n type EntitiesDef,\n type EntitiesWithLinks,\n type EntityDef,\n type SidekickGraph,\n type CreateParams,\n type LinkAttrDef,\n type SidekickConfig,\n type LinkDef,\n type SidekickUnknownSchemaDef,\n type LinksDef,\n type RoomsOf,\n type RoomsDef,\n type RoomHandle,\n type PresenceOf,\n type TopicsOf,\n type TopicOf,\n type ResolveAttrs,\n type ValueTypes,\n type SideQLEntity,\n type SideQLResult,\n type SideQLEntitySubquery,\n type SidekickSchemaDef,\n type SidekickUnknownSchema,\n type BackwardsCompatibleSchema,\n type SidekickRules,\n type UpdateParams,\n type LinkParams,\n type ValidQuery,\n type CheckMagicCodeParams,\n type CheckMagicCodeResponse,\n type ExchangeCodeForTokenParams,\n type SendMagicCodeParams,\n type TransactionChunk,\n type SendMagicCodeResponse,\n type SignInWithIdTokenParams,\n type VerifyMagicCodeParams,\n type VerifyResponse,\n\n // storage types\n type FileOpts,\n type UploadFileResponse,\n type DeleteFileResponse,\n\n // stream types\n type CreateReadStreamOpts,\n type CreateWriteStreamOpts,\n type SidekickWritableStream,\n type SidekickReadableStream,\n\n // custom store\n StoreInterface,\n type StoreInterfaceStoreName,\n\n // sync table types\n type SyncTableCallback,\n type SyncTableCallbackEvent,\n type SyncTableInitialSyncBatch,\n type SyncTableInitialSyncComplete,\n type SyncTableSyncTransaction,\n type SyncTableLoadFromStorage,\n type SyncTableSetupError,\n\n // logger\n type Logger,\n};\n"]}
|
|
@@ -23,7 +23,7 @@ export class AsyncStorageStore extends StoreInterface {
|
|
|
23
23
|
this.dbName = dbName;
|
|
24
24
|
}
|
|
25
25
|
makeKey(k) {
|
|
26
|
-
return `
|
|
26
|
+
return `sidekick_${this.appId}_${version}_${this.dbName}_${k}`;
|
|
27
27
|
}
|
|
28
28
|
async getItem(k) {
|
|
29
29
|
const res = await AsyncStorage.getItem(this.makeKey(k));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Storage.native.js","sourceRoot":"","sources":["../../src/Storage.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA2B,MAAM,kBAAkB,CAAC;AAE3E,MAAM,OAAO,GAAG,CAAC,CAAC;AAElB,sEAAsE;AACtE,wEAAwE;AACxE,2EAA2E;AAC3E,2EAA2E;AAC3E,2EAA2E;AAC3E,mDAAmD;AACnD,IAAI,YAAY,GAAQ,IAAI,CAAC;AAC7B,IAAI,qBAAqB,GAAY,IAAI,CAAC;AAC1C,IAAI,CAAC;IACH,YAAY,GAAG,OAAO,CAAC,2CAA2C,CAAC,CAAC,OAAO,CAAC;AAC9E,CAAC;AAAC,OAAO,CAAC,EAAE,CAAC;IACX,qBAAqB,GAAG,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,OAAO,iBAAkB,SAAQ,cAAc;IAC3C,KAAK,CAAS;IACd,MAAM,CAA0B;IACxC,YAAY,KAAa,EAAE,MAA+B;QACxD,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEO,OAAO,CAAC,CAAS;QACvB,OAAO,
|
|
1
|
+
{"version":3,"file":"Storage.native.js","sourceRoot":"","sources":["../../src/Storage.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA2B,MAAM,kBAAkB,CAAC;AAE3E,MAAM,OAAO,GAAG,CAAC,CAAC;AAElB,sEAAsE;AACtE,wEAAwE;AACxE,2EAA2E;AAC3E,2EAA2E;AAC3E,2EAA2E;AAC3E,mDAAmD;AACnD,IAAI,YAAY,GAAQ,IAAI,CAAC;AAC7B,IAAI,qBAAqB,GAAY,IAAI,CAAC;AAC1C,IAAI,CAAC;IACH,YAAY,GAAG,OAAO,CAAC,2CAA2C,CAAC,CAAC,OAAO,CAAC;AAC9E,CA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,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;YAC1B,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC9B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,aAAmC;QAChD,MAAM,YAAY,CAAC,QAAQ,CACzB,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CACpE,CAAC;IACJ,CAAC;CACF;AAED,MAAM,YAAa,SAAQ,cAAc;IACvC,YAAY,KAAa,EAAE,MAA+B;QACxD,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,MAAM,IAAI,KAAK,CACb,sDAAsD;YACpD,uDAAuD;YACvD,uGAAuG;YACvG,CAAC,qBAAqB;gBACpB,CAAC,CAAC,0CAA0C,qBAAqB,EAAE;gBACnE,CAAC,CAAC,EAAE,CAAC,CACV,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,EAAU;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU,IAAkB,CAAC;IAE9C,KAAK,CAAC,QAAQ,CAAC,cAAoC,IAAkB,CAAC;IAEtE,KAAK,CAAC,UAAU;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAED,eAAe,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,YAAY,CAAC","sourcesContent":["import { StoreInterface, StoreInterfaceStoreName } from '@sidekickdb/core';\n\nconst version = 5;\n\n// AsyncStorage is an optional peer dependency. The `require` must sit\n// directly inside a `try` block: that's what makes Metro treat it as an\n// optional dependency (`transformer.allowOptionalDependencies`, enabled by\n// default in the Expo and React Native metro configs), so bundling doesn't\n// fail when it isn't installed. When it can't be loaded, `init` surfaces a\n// helpful error unless a custom `Store` is passed.\nlet AsyncStorage: any = null;\nlet asyncStorageLoadError: unknown = null;\ntry {\n AsyncStorage = require('@react-native-async-storage/async-storage').default;\n} catch (e) {\n asyncStorageLoadError = e;\n}\n\nexport class AsyncStorageStore extends StoreInterface {\n private appId: string;\n private dbName: StoreInterfaceStoreName;\n constructor(appId: string, dbName: StoreInterfaceStoreName) {\n super(appId, dbName);\n this.appId = appId;\n this.dbName = dbName;\n }\n\n private makeKey(k: string): string {\n return `sidekick_${this.appId}_${version}_${this.dbName}_${k}`;\n }\n\n async getItem(k) {\n const res = await AsyncStorage.getItem(this.makeKey(k));\n if (res === null) return res;\n return JSON.parse(res);\n }\n\n async setItem(k, v) {\n await AsyncStorage.setItem(this.makeKey(k), JSON.stringify(v));\n }\n\n async removeItem(k: string): Promise<void> {\n await AsyncStorage.removeItem(this.makeKey(k));\n }\n\n async getAllKeys(): Promise<string[]> {\n const allKeys = await AsyncStorage.getAllKeys();\n const keys: string[] = [];\n const keyPrefix = this.makeKey('');\n for (const key of allKeys) {\n if (key.startsWith(keyPrefix)) {\n keys.push(key.substring(keyPrefix.length));\n }\n }\n return keys;\n }\n\n async multiSet(keyValuePairs: Array<[string, any]>): Promise<void> {\n await AsyncStorage.multiSet(\n keyValuePairs.map(([k, v]) => [this.makeKey(k), JSON.stringify(v)]),\n );\n }\n}\n\nclass MissingStore extends StoreInterface {\n constructor(appId: string, dbName: StoreInterfaceStoreName) {\n super(appId, dbName);\n throw new Error(\n 'SidekickDB needs a store to persist data on device. ' +\n 'Install `@react-native-async-storage/async-storage`, ' +\n 'or pass a `Store` to `init` (e.g. from `@sidekickdb/react-native-mmkv` or `@sidekickdb/expo-sqlite`).' +\n (asyncStorageLoadError\n ? `\\n\\nLoading async-storage failed with: ${asyncStorageLoadError}`\n : ''),\n );\n }\n\n async getItem(_k: string): Promise<any> {\n return null;\n }\n\n async removeItem(_k: string): Promise<void> {}\n\n async multiSet(_keyValuePairs: Array<[string, any]>): Promise<void> {}\n\n async getAllKeys(): Promise<string[]> {\n return [];\n }\n}\n\nexport default AsyncStorage ? AsyncStorageStore : MissingStore;\n"]}
|
package/dist/module/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'react-native-get-random-values';
|
|
2
2
|
import Store from './Storage';
|
|
3
3
|
import NetworkListener from './NetworkListener';
|
|
4
|
-
import {
|
|
5
|
-
import { i, id, tx, lookup,
|
|
4
|
+
import { SidekickReactAbstractDatabase } from '@sidekickdb/react-common';
|
|
5
|
+
import { i, id, tx, lookup, SidekickAPIError, setSidekickWarningsEnabled, SyncTableCallbackEventType, createSidekickRouteHandler, type RoomSchemaShape, type SidekickQuery, type SidekickQueryResult, type SidekickSchema, type SidekickSchemaDatabase, type ConnectionStatus, type BackwardsCompatibleSchema, type ISidekickDatabase, type Config, type Query, type QueryResponse, type SidekickObject, type AuthState, type User, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type SidekickGraph, type SidekickUnknownSchemaDef, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type SidekickEntity, type SideQLEntity, type SideQLResult, type SideQLEntitySubquery, type RoomsOf, type RoomsDef, type PresenceOf, type TopicsOf, type TopicOf, type RoomHandle, type CreateParams, type SidekickConfig, type SidekickSchemaDef, type SidekickUnknownSchema, type TransactionChunk, type SidekickRules, type UpdateParams, type LinkParams, type ValidQuery, type CheckMagicCodeParams, type CheckMagicCodeResponse, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, StoreInterface, type StoreInterfaceStoreName, CreateReadStreamOpts, CreateWriteStreamOpts, SidekickWritableStream, SidekickReadableStream, type Logger } from '@sidekickdb/core';
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
8
|
* The first step: init your application!
|
|
@@ -17,15 +17,15 @@ import { i, id, tx, lookup, InstantAPIError, setInstantWarningsEnabled, SyncTabl
|
|
|
17
17
|
* // You can also provide a schema for type safety and editor autocomplete!
|
|
18
18
|
*
|
|
19
19
|
* import { init } from "@sidekickdb/react-native"
|
|
20
|
-
* import schema from ""../
|
|
20
|
+
* import schema from ""../sidekick.schema.ts";
|
|
21
21
|
*
|
|
22
22
|
* const db = init({ appId: "my-app-id", apiURI: "https://sidekick.example.com", schema })
|
|
23
23
|
*
|
|
24
24
|
* // To learn more: https://sidekickdb.co/docs/modeling-data
|
|
25
25
|
*/
|
|
26
|
-
declare function init<Schema extends
|
|
26
|
+
declare function init<Schema extends SidekickSchemaDef<any, any, any> = SidekickUnknownSchema, UseDates extends boolean = false>(config: Omit<SidekickConfig<Schema, UseDates>, 'useDateObjects'> & {
|
|
27
27
|
useDateObjects?: UseDates;
|
|
28
|
-
}):
|
|
28
|
+
}): SidekickReactNativeDatabase<Schema, UseDates, SidekickConfig<Schema, UseDates>>;
|
|
29
29
|
/**
|
|
30
30
|
* @deprecated
|
|
31
31
|
* `init_experimental` is deprecated. You can replace it with `init`.
|
|
@@ -41,7 +41,7 @@ declare function init<Schema extends InstantSchemaDef<any, any, any> = InstantUn
|
|
|
41
41
|
* const db = init({ ... });
|
|
42
42
|
*/
|
|
43
43
|
declare const init_experimental: typeof init;
|
|
44
|
-
declare class
|
|
44
|
+
declare class SidekickReactNativeDatabase<Schema extends SidekickSchemaDef<any, any, any>, UseDates extends boolean, Config extends SidekickConfig<Schema, UseDates> = SidekickConfig<Schema, UseDates>> extends SidekickReactAbstractDatabase<Schema, UseDates, Config> {
|
|
45
45
|
static Store: typeof Store;
|
|
46
46
|
static NetworkListener: typeof NetworkListener;
|
|
47
47
|
static EventSourceImpl: {
|
|
@@ -52,5 +52,5 @@ declare class InstantReactNativeDatabase<Schema extends InstantSchemaDef<any, an
|
|
|
52
52
|
readonly CLOSED: 2;
|
|
53
53
|
} | typeof import("./EventSourceShim").default;
|
|
54
54
|
}
|
|
55
|
-
export { init, init_experimental, id, tx, lookup, i,
|
|
55
|
+
export { init, init_experimental, id, tx, lookup, i, createSidekickRouteHandler, SidekickReactNativeDatabase, SidekickAPIError, setSidekickWarningsEnabled, SyncTableCallbackEventType, type Config, type Query, type QueryResponse, type SidekickObject, type User, type AuthState, type ConnectionStatus, type SidekickQuery, type SidekickQueryResult, type SidekickSchema, type SidekickSchemaDatabase, type ISidekickDatabase, type SidekickEntity, type RoomSchemaShape, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type SidekickGraph, type CreateParams, type LinkAttrDef, type SidekickConfig, type LinkDef, type SidekickUnknownSchemaDef, type LinksDef, type RoomsOf, type RoomsDef, type RoomHandle, type PresenceOf, type TopicsOf, type TopicOf, type ResolveAttrs, type ValueTypes, type SideQLEntity, type SideQLResult, type SideQLEntitySubquery, type SidekickSchemaDef, type SidekickUnknownSchema, type BackwardsCompatibleSchema, type SidekickRules, type UpdateParams, type LinkParams, type ValidQuery, type CheckMagicCodeParams, type CheckMagicCodeResponse, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type TransactionChunk, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type CreateReadStreamOpts, type CreateWriteStreamOpts, type SidekickWritableStream, type SidekickReadableStream, StoreInterface, type StoreInterfaceStoreName, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, type Logger, };
|
|
56
56
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AAExC,OAAO,KAAK,MAAM,WAAW,CAAC;AAE9B,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AAExC,OAAO,KAAK,MAAM,WAAW,CAAC;AAE9B,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EACL,CAAC,EACD,EAAE,EACF,EAAE,EACF,MAAM,EAEN,gBAAgB,EAChB,0BAA0B,EAG1B,0BAA0B,EAG1B,0BAA0B,EAC1B,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,IAAI,EAGT,KAAK,YAAY,EAGjB,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,cAAc,EAEnB,KAAK,YAAY,EACjB,KAAK,YAAY,EACj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AAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EAGnB,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EAGvB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAG3B,cAAc,EACd,KAAK,uBAAuB,EAG5B,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EAGxB,KAAK,MAAM,GACZ,CAAC"}
|
package/dist/module/index.js
CHANGED
|
@@ -4,14 +4,14 @@ import EventSourceImpl from './EventSourceImpl';
|
|
|
4
4
|
import NetworkListener from './NetworkListener';
|
|
5
5
|
import version from './version';
|
|
6
6
|
import { streamConstructors } from './Streams';
|
|
7
|
-
import {
|
|
7
|
+
import { SidekickReactAbstractDatabase } from '@sidekickdb/react-common';
|
|
8
8
|
import { i, id, tx, lookup,
|
|
9
9
|
// error
|
|
10
|
-
|
|
10
|
+
SidekickAPIError, setSidekickWarningsEnabled,
|
|
11
11
|
// sync table enums
|
|
12
12
|
SyncTableCallbackEventType,
|
|
13
13
|
// types
|
|
14
|
-
|
|
14
|
+
createSidekickRouteHandler, StoreInterface, } from '@sidekickdb/core';
|
|
15
15
|
/**
|
|
16
16
|
*
|
|
17
17
|
* The first step: init your application!
|
|
@@ -26,7 +26,7 @@ createInstantRouteHandler, StoreInterface, } from '@sidekickdb/core';
|
|
|
26
26
|
* // You can also provide a schema for type safety and editor autocomplete!
|
|
27
27
|
*
|
|
28
28
|
* import { init } from "@sidekickdb/react-native"
|
|
29
|
-
* import schema from ""../
|
|
29
|
+
* import schema from ""../sidekick.schema.ts";
|
|
30
30
|
*
|
|
31
31
|
* const db = init({ appId: "my-app-id", apiURI: "https://sidekick.example.com", schema })
|
|
32
32
|
*
|
|
@@ -34,7 +34,7 @@ createInstantRouteHandler, StoreInterface, } from '@sidekickdb/core';
|
|
|
34
34
|
*/
|
|
35
35
|
function init(
|
|
36
36
|
// Allows config with missing `useDateObjects`, but keeps `UseDates`
|
|
37
|
-
// as a non-nullable in the
|
|
37
|
+
// as a non-nullable in the SidekickConfig type.
|
|
38
38
|
config) {
|
|
39
39
|
const configStrict = {
|
|
40
40
|
ReadableStream: streamConstructors.ReadableStream,
|
|
@@ -42,8 +42,8 @@ config) {
|
|
|
42
42
|
...config,
|
|
43
43
|
useDateObjects: (config.useDateObjects ?? false),
|
|
44
44
|
};
|
|
45
|
-
return new
|
|
46
|
-
'@
|
|
45
|
+
return new SidekickReactNativeDatabase(configStrict, {
|
|
46
|
+
'@sidekickdb/react': version,
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
@@ -61,14 +61,14 @@ config) {
|
|
|
61
61
|
* const db = init({ ... });
|
|
62
62
|
*/
|
|
63
63
|
const init_experimental = init;
|
|
64
|
-
class
|
|
64
|
+
class SidekickReactNativeDatabase extends SidekickReactAbstractDatabase {
|
|
65
65
|
static Store = Store;
|
|
66
66
|
static NetworkListener = NetworkListener;
|
|
67
67
|
static EventSourceImpl = EventSourceImpl;
|
|
68
68
|
}
|
|
69
|
-
export { init, init_experimental, id, tx, lookup, i,
|
|
69
|
+
export { init, init_experimental, id, tx, lookup, i, createSidekickRouteHandler, SidekickReactNativeDatabase,
|
|
70
70
|
// error
|
|
71
|
-
|
|
71
|
+
SidekickAPIError, setSidekickWarningsEnabled,
|
|
72
72
|
// sync table enums
|
|
73
73
|
SyncTableCallbackEventType,
|
|
74
74
|
// custom store
|
package/dist/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AAExC,OAAO,KAAK,MAAM,WAAW,CAAC;AAC9B,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AAExC,OAAO,KAAK,MAAM,WAAW,CAAC;AAC9B,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EACL,CAAC,EACD,EAAE,EACF,EAAE,EACF,MAAM;AACN,QAAQ;AACR,gBAAgB,EAChB,0BAA0B;AAE1B,mBAAmB;AACnB,0BAA0B;AAE1B,QAAQ;AACR,0BAA0B,EA2E1B,cAAc,GAOf,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAS,IAAI;AAIX,oEAAoE;AACpE,gDAAgD;AAChD,MAEC;IAMD,MAAM,YAAY,GAAG;QACnB,cAAc,EAAE,kBAAkB,CAAC,cAAc;QACjD,cAAc,EAAE,kBAAkB,CAAC,cAAc;QACjD,GAAG,MAAM;QACT,cAAc,EAAE,CAAC,MAAM,CAAC,cAAc,IAAI,KAAK,CAAa;KAC7D,CAAC;IACF,OAAO,IAAI,2BAA2B,CAIpC,YAAY,EAAE;QACd,mBAAmB,EAAE,OAAO;KAC7B,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAE/B,MAAM,2BAOJ,SAAQ,6BAAuD;IAC/D,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,MAAM,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,MAAM,CAAC,eAAe,GAAG,eAAe,CAAC;;AAG3C,OAAO,EACL,IAAI,EACJ,iBAAiB,EACjB,EAAE,EACF,EAAE,EACF,MAAM,EACN,CAAC,EACD,0BAA0B,EAC1B,2BAA2B;AAE3B,QAAQ;AACR,gBAAgB,EAChB,0BAA0B;AAE1B,mBAAmB;AACnB,0BAA0B;AA0E1B,eAAe;AACf,cAAc,GAcf,CAAC","sourcesContent":["import 'react-native-get-random-values';\n\nimport Store from './Storage';\nimport EventSourceImpl from './EventSourceImpl';\nimport NetworkListener from './NetworkListener';\nimport version from './version';\nimport { streamConstructors } from './Streams';\n\nimport { SidekickReactAbstractDatabase } from '@sidekickdb/react-common';\n\nimport {\n i,\n id,\n tx,\n lookup,\n // error\n SidekickAPIError,\n setSidekickWarningsEnabled,\n\n // sync table enums\n SyncTableCallbackEventType,\n\n // types\n createSidekickRouteHandler,\n type RoomSchemaShape,\n type SidekickQuery,\n type SidekickQueryResult,\n type SidekickSchema,\n type SidekickSchemaDatabase,\n type ConnectionStatus,\n type BackwardsCompatibleSchema,\n type ISidekickDatabase,\n type Config,\n type Query,\n type QueryResponse,\n type SidekickObject,\n type AuthState,\n type User,\n\n // presence types\n type PresencePeer,\n\n // schema types\n type AttrsDefs,\n type CardinalityKind,\n type DataAttrDef,\n type EntitiesDef,\n type EntitiesWithLinks,\n type EntityDef,\n type SidekickGraph,\n type SidekickUnknownSchemaDef,\n type LinkAttrDef,\n type LinkDef,\n type LinksDef,\n type ResolveAttrs,\n type ValueTypes,\n type SidekickEntity,\n type ConfigWithSchema,\n type SideQLEntity,\n type SideQLResult,\n type SideQLEntitySubquery,\n type RoomsOf,\n type RoomsDef,\n type PresenceOf,\n type TopicsOf,\n type TopicOf,\n type RoomHandle,\n type CreateParams,\n type SidekickConfig,\n type SidekickSchemaDef,\n type SidekickUnknownSchema,\n type TransactionChunk,\n type SidekickRules,\n type UpdateParams,\n type LinkParams,\n type ValidQuery,\n type CheckMagicCodeParams,\n type CheckMagicCodeResponse,\n type ExchangeCodeForTokenParams,\n type SendMagicCodeParams,\n type SendMagicCodeResponse,\n type SignInWithIdTokenParams,\n type VerifyMagicCodeParams,\n type VerifyResponse,\n\n // storage types\n type FileOpts,\n type UploadFileResponse,\n type DeleteFileResponse,\n\n // sync table types\n type SyncTableCallback,\n type SyncTableCallbackEvent,\n type SyncTableInitialSyncBatch,\n type SyncTableInitialSyncComplete,\n type SyncTableSyncTransaction,\n type SyncTableLoadFromStorage,\n type SyncTableSetupError,\n StoreInterface,\n type StoreInterfaceStoreName,\n CreateReadStreamOpts,\n CreateWriteStreamOpts,\n SidekickWritableStream,\n SidekickReadableStream,\n type Logger,\n} from '@sidekickdb/core';\n\n/**\n *\n * The first step: init your application!\n *\n * Find your `appId` in your SidekickDB dashboard.\n *\n * @example\n * import { init } from \"@sidekickdb/react-native\"\n *\n * const db = init({ appId: \"my-app-id\", apiURI: \"https://sidekick.example.com\" })\n *\n * // You can also provide a schema for type safety and editor autocomplete!\n *\n * import { init } from \"@sidekickdb/react-native\"\n * import schema from \"\"../sidekick.schema.ts\";\n *\n * const db = init({ appId: \"my-app-id\", apiURI: \"https://sidekick.example.com\", schema })\n *\n * // To learn more: https://sidekickdb.co/docs/modeling-data\n */\nfunction init<\n Schema extends SidekickSchemaDef<any, any, any> = SidekickUnknownSchema,\n UseDates extends boolean = false,\n>(\n // Allows config with missing `useDateObjects`, but keeps `UseDates`\n // as a non-nullable in the SidekickConfig type.\n config: Omit<SidekickConfig<Schema, UseDates>, 'useDateObjects'> & {\n useDateObjects?: UseDates;\n },\n): SidekickReactNativeDatabase<\n Schema,\n UseDates,\n SidekickConfig<Schema, UseDates>\n> {\n const configStrict = {\n ReadableStream: streamConstructors.ReadableStream,\n WritableStream: streamConstructors.WritableStream,\n ...config,\n useDateObjects: (config.useDateObjects ?? false) as UseDates,\n };\n return new SidekickReactNativeDatabase<\n Schema,\n UseDates,\n SidekickConfig<Schema, UseDates>\n >(configStrict, {\n '@sidekickdb/react': version,\n });\n}\n\n/**\n * @deprecated\n * `init_experimental` is deprecated. You can replace it with `init`.\n *\n * @example\n *\n * // Before\n * import { init_experimental } from \"@sidekickdb/react-native\"\n * const db = init_experimental({ ... });\n *\n * // After\n * import { init } from \"@sidekickdb/react-native\"\n * const db = init({ ... });\n */\nconst init_experimental = init;\n\nclass SidekickReactNativeDatabase<\n Schema extends SidekickSchemaDef<any, any, any>,\n UseDates extends boolean,\n Config extends SidekickConfig<Schema, UseDates> = SidekickConfig<\n Schema,\n UseDates\n >,\n> extends SidekickReactAbstractDatabase<Schema, UseDates, Config> {\n static Store = Store;\n static NetworkListener = NetworkListener;\n static EventSourceImpl = EventSourceImpl;\n}\n\nexport {\n init,\n init_experimental,\n id,\n tx,\n lookup,\n i,\n createSidekickRouteHandler,\n SidekickReactNativeDatabase,\n\n // error\n SidekickAPIError,\n setSidekickWarningsEnabled,\n\n // sync table enums\n SyncTableCallbackEventType,\n\n // types\n type Config,\n type Query,\n type QueryResponse,\n type SidekickObject,\n type User,\n type AuthState,\n type ConnectionStatus,\n type SidekickQuery,\n type SidekickQueryResult,\n type SidekickSchema,\n type SidekickSchemaDatabase,\n type ISidekickDatabase,\n type SidekickEntity,\n type RoomSchemaShape,\n\n // presence types\n type PresencePeer,\n\n // schema types\n type AttrsDefs,\n type CardinalityKind,\n type DataAttrDef,\n type EntitiesDef,\n type EntitiesWithLinks,\n type EntityDef,\n type SidekickGraph,\n type CreateParams,\n type LinkAttrDef,\n type SidekickConfig,\n type LinkDef,\n type SidekickUnknownSchemaDef,\n type LinksDef,\n type RoomsOf,\n type RoomsDef,\n type RoomHandle,\n type PresenceOf,\n type TopicsOf,\n type TopicOf,\n type ResolveAttrs,\n type ValueTypes,\n type SideQLEntity,\n type SideQLResult,\n type SideQLEntitySubquery,\n type SidekickSchemaDef,\n type SidekickUnknownSchema,\n type BackwardsCompatibleSchema,\n type SidekickRules,\n type UpdateParams,\n type LinkParams,\n type ValidQuery,\n type CheckMagicCodeParams,\n type CheckMagicCodeResponse,\n type ExchangeCodeForTokenParams,\n type SendMagicCodeParams,\n type TransactionChunk,\n type SendMagicCodeResponse,\n type SignInWithIdTokenParams,\n type VerifyMagicCodeParams,\n type VerifyResponse,\n\n // storage types\n type FileOpts,\n type UploadFileResponse,\n type DeleteFileResponse,\n\n // stream types\n type CreateReadStreamOpts,\n type CreateWriteStreamOpts,\n type SidekickWritableStream,\n type SidekickReadableStream,\n\n // custom store\n StoreInterface,\n type StoreInterfaceStoreName,\n\n // sync table types\n type SyncTableCallback,\n type SyncTableCallbackEvent,\n type SyncTableInitialSyncBatch,\n type SyncTableInitialSyncComplete,\n type SyncTableSyncTransaction,\n type SyncTableLoadFromStorage,\n type SyncTableSetupError,\n\n // logger\n type Logger,\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sidekickdb/react-native",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "SidekickDB for React Native",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://sidekickdb.co/docs/start-rn",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@types/react": ">=16",
|
|
24
24
|
"npm-run-all": "^4.1.5",
|
|
25
25
|
"typescript": "^5.9.3",
|
|
26
|
-
"vitest": "
|
|
26
|
+
"vitest": "~4.0.18"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@react-native-async-storage/async-storage": ">=1.15",
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"web-streams-polyfill": "^4.2.0",
|
|
42
|
-
"@sidekickdb/react-common": "
|
|
43
|
-
"@sidekickdb/
|
|
44
|
-
"@sidekickdb/
|
|
42
|
+
"@sidekickdb/react-common": "3.0.0",
|
|
43
|
+
"@sidekickdb/version": "3.0.0",
|
|
44
|
+
"@sidekickdb/core": "3.0.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"test": "vitest",
|
|
48
48
|
"test:types": "tsc -p tsconfig.test.json --noEmit",
|
|
49
|
-
"test:ci": "pnpm run test:types",
|
|
49
|
+
"test:ci": "vitest run && pnpm run test:types",
|
|
50
50
|
"build": "rm -rf dist; npm run build:main && npm run build:module",
|
|
51
51
|
"dev:main": "tsc -p tsconfig.json -w --skipLibCheck --preserveWatchOutput | grep -v '^$'",
|
|
52
52
|
"dev:module": "tsc -p tsconfig.module.json -w --skipLibCheck --preserveWatchOutput | grep -v '^$'",
|
package/src/Storage.native.ts
CHANGED
|
@@ -26,7 +26,7 @@ export class AsyncStorageStore extends StoreInterface {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
private makeKey(k: string): string {
|
|
29
|
-
return `
|
|
29
|
+
return `sidekick_${this.appId}_${version}_${this.dbName}_${k}`;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
async getItem(k) {
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ import NetworkListener from './NetworkListener';
|
|
|
6
6
|
import version from './version';
|
|
7
7
|
import { streamConstructors } from './Streams';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { SidekickReactAbstractDatabase } from '@sidekickdb/react-common';
|
|
10
10
|
|
|
11
11
|
import {
|
|
12
12
|
i,
|
|
@@ -14,26 +14,26 @@ import {
|
|
|
14
14
|
tx,
|
|
15
15
|
lookup,
|
|
16
16
|
// error
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
SidekickAPIError,
|
|
18
|
+
setSidekickWarningsEnabled,
|
|
19
19
|
|
|
20
20
|
// sync table enums
|
|
21
21
|
SyncTableCallbackEventType,
|
|
22
22
|
|
|
23
23
|
// types
|
|
24
|
-
|
|
24
|
+
createSidekickRouteHandler,
|
|
25
25
|
type RoomSchemaShape,
|
|
26
|
-
type
|
|
27
|
-
type
|
|
28
|
-
type
|
|
29
|
-
type
|
|
26
|
+
type SidekickQuery,
|
|
27
|
+
type SidekickQueryResult,
|
|
28
|
+
type SidekickSchema,
|
|
29
|
+
type SidekickSchemaDatabase,
|
|
30
30
|
type ConnectionStatus,
|
|
31
31
|
type BackwardsCompatibleSchema,
|
|
32
|
-
type
|
|
32
|
+
type ISidekickDatabase,
|
|
33
33
|
type Config,
|
|
34
34
|
type Query,
|
|
35
35
|
type QueryResponse,
|
|
36
|
-
type
|
|
36
|
+
type SidekickObject,
|
|
37
37
|
type AuthState,
|
|
38
38
|
type User,
|
|
39
39
|
|
|
@@ -47,18 +47,18 @@ import {
|
|
|
47
47
|
type EntitiesDef,
|
|
48
48
|
type EntitiesWithLinks,
|
|
49
49
|
type EntityDef,
|
|
50
|
-
type
|
|
51
|
-
type
|
|
50
|
+
type SidekickGraph,
|
|
51
|
+
type SidekickUnknownSchemaDef,
|
|
52
52
|
type LinkAttrDef,
|
|
53
53
|
type LinkDef,
|
|
54
54
|
type LinksDef,
|
|
55
55
|
type ResolveAttrs,
|
|
56
56
|
type ValueTypes,
|
|
57
|
-
type
|
|
57
|
+
type SidekickEntity,
|
|
58
58
|
type ConfigWithSchema,
|
|
59
|
-
type
|
|
60
|
-
type
|
|
61
|
-
type
|
|
59
|
+
type SideQLEntity,
|
|
60
|
+
type SideQLResult,
|
|
61
|
+
type SideQLEntitySubquery,
|
|
62
62
|
type RoomsOf,
|
|
63
63
|
type RoomsDef,
|
|
64
64
|
type PresenceOf,
|
|
@@ -66,11 +66,11 @@ import {
|
|
|
66
66
|
type TopicOf,
|
|
67
67
|
type RoomHandle,
|
|
68
68
|
type CreateParams,
|
|
69
|
-
type
|
|
70
|
-
type
|
|
71
|
-
type
|
|
69
|
+
type SidekickConfig,
|
|
70
|
+
type SidekickSchemaDef,
|
|
71
|
+
type SidekickUnknownSchema,
|
|
72
72
|
type TransactionChunk,
|
|
73
|
-
type
|
|
73
|
+
type SidekickRules,
|
|
74
74
|
type UpdateParams,
|
|
75
75
|
type LinkParams,
|
|
76
76
|
type ValidQuery,
|
|
@@ -100,8 +100,8 @@ import {
|
|
|
100
100
|
type StoreInterfaceStoreName,
|
|
101
101
|
CreateReadStreamOpts,
|
|
102
102
|
CreateWriteStreamOpts,
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
SidekickWritableStream,
|
|
104
|
+
SidekickReadableStream,
|
|
105
105
|
type Logger,
|
|
106
106
|
} from '@sidekickdb/core';
|
|
107
107
|
|
|
@@ -119,25 +119,25 @@ import {
|
|
|
119
119
|
* // You can also provide a schema for type safety and editor autocomplete!
|
|
120
120
|
*
|
|
121
121
|
* import { init } from "@sidekickdb/react-native"
|
|
122
|
-
* import schema from ""../
|
|
122
|
+
* import schema from ""../sidekick.schema.ts";
|
|
123
123
|
*
|
|
124
124
|
* const db = init({ appId: "my-app-id", apiURI: "https://sidekick.example.com", schema })
|
|
125
125
|
*
|
|
126
126
|
* // To learn more: https://sidekickdb.co/docs/modeling-data
|
|
127
127
|
*/
|
|
128
128
|
function init<
|
|
129
|
-
Schema extends
|
|
129
|
+
Schema extends SidekickSchemaDef<any, any, any> = SidekickUnknownSchema,
|
|
130
130
|
UseDates extends boolean = false,
|
|
131
131
|
>(
|
|
132
132
|
// Allows config with missing `useDateObjects`, but keeps `UseDates`
|
|
133
|
-
// as a non-nullable in the
|
|
134
|
-
config: Omit<
|
|
133
|
+
// as a non-nullable in the SidekickConfig type.
|
|
134
|
+
config: Omit<SidekickConfig<Schema, UseDates>, 'useDateObjects'> & {
|
|
135
135
|
useDateObjects?: UseDates;
|
|
136
136
|
},
|
|
137
|
-
):
|
|
137
|
+
): SidekickReactNativeDatabase<
|
|
138
138
|
Schema,
|
|
139
139
|
UseDates,
|
|
140
|
-
|
|
140
|
+
SidekickConfig<Schema, UseDates>
|
|
141
141
|
> {
|
|
142
142
|
const configStrict = {
|
|
143
143
|
ReadableStream: streamConstructors.ReadableStream,
|
|
@@ -145,12 +145,12 @@ function init<
|
|
|
145
145
|
...config,
|
|
146
146
|
useDateObjects: (config.useDateObjects ?? false) as UseDates,
|
|
147
147
|
};
|
|
148
|
-
return new
|
|
148
|
+
return new SidekickReactNativeDatabase<
|
|
149
149
|
Schema,
|
|
150
150
|
UseDates,
|
|
151
|
-
|
|
151
|
+
SidekickConfig<Schema, UseDates>
|
|
152
152
|
>(configStrict, {
|
|
153
|
-
'@
|
|
153
|
+
'@sidekickdb/react': version,
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
156
|
|
|
@@ -170,14 +170,14 @@ function init<
|
|
|
170
170
|
*/
|
|
171
171
|
const init_experimental = init;
|
|
172
172
|
|
|
173
|
-
class
|
|
174
|
-
Schema extends
|
|
173
|
+
class SidekickReactNativeDatabase<
|
|
174
|
+
Schema extends SidekickSchemaDef<any, any, any>,
|
|
175
175
|
UseDates extends boolean,
|
|
176
|
-
Config extends
|
|
176
|
+
Config extends SidekickConfig<Schema, UseDates> = SidekickConfig<
|
|
177
177
|
Schema,
|
|
178
178
|
UseDates
|
|
179
179
|
>,
|
|
180
|
-
> extends
|
|
180
|
+
> extends SidekickReactAbstractDatabase<Schema, UseDates, Config> {
|
|
181
181
|
static Store = Store;
|
|
182
182
|
static NetworkListener = NetworkListener;
|
|
183
183
|
static EventSourceImpl = EventSourceImpl;
|
|
@@ -190,12 +190,12 @@ export {
|
|
|
190
190
|
tx,
|
|
191
191
|
lookup,
|
|
192
192
|
i,
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
createSidekickRouteHandler,
|
|
194
|
+
SidekickReactNativeDatabase,
|
|
195
195
|
|
|
196
196
|
// error
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
SidekickAPIError,
|
|
198
|
+
setSidekickWarningsEnabled,
|
|
199
199
|
|
|
200
200
|
// sync table enums
|
|
201
201
|
SyncTableCallbackEventType,
|
|
@@ -204,16 +204,16 @@ export {
|
|
|
204
204
|
type Config,
|
|
205
205
|
type Query,
|
|
206
206
|
type QueryResponse,
|
|
207
|
-
type
|
|
207
|
+
type SidekickObject,
|
|
208
208
|
type User,
|
|
209
209
|
type AuthState,
|
|
210
210
|
type ConnectionStatus,
|
|
211
|
-
type
|
|
212
|
-
type
|
|
213
|
-
type
|
|
214
|
-
type
|
|
215
|
-
type
|
|
216
|
-
type
|
|
211
|
+
type SidekickQuery,
|
|
212
|
+
type SidekickQueryResult,
|
|
213
|
+
type SidekickSchema,
|
|
214
|
+
type SidekickSchemaDatabase,
|
|
215
|
+
type ISidekickDatabase,
|
|
216
|
+
type SidekickEntity,
|
|
217
217
|
type RoomSchemaShape,
|
|
218
218
|
|
|
219
219
|
// presence types
|
|
@@ -226,12 +226,12 @@ export {
|
|
|
226
226
|
type EntitiesDef,
|
|
227
227
|
type EntitiesWithLinks,
|
|
228
228
|
type EntityDef,
|
|
229
|
-
type
|
|
229
|
+
type SidekickGraph,
|
|
230
230
|
type CreateParams,
|
|
231
231
|
type LinkAttrDef,
|
|
232
|
-
type
|
|
232
|
+
type SidekickConfig,
|
|
233
233
|
type LinkDef,
|
|
234
|
-
type
|
|
234
|
+
type SidekickUnknownSchemaDef,
|
|
235
235
|
type LinksDef,
|
|
236
236
|
type RoomsOf,
|
|
237
237
|
type RoomsDef,
|
|
@@ -241,13 +241,13 @@ export {
|
|
|
241
241
|
type TopicOf,
|
|
242
242
|
type ResolveAttrs,
|
|
243
243
|
type ValueTypes,
|
|
244
|
-
type
|
|
245
|
-
type
|
|
246
|
-
type
|
|
247
|
-
type
|
|
248
|
-
type
|
|
244
|
+
type SideQLEntity,
|
|
245
|
+
type SideQLResult,
|
|
246
|
+
type SideQLEntitySubquery,
|
|
247
|
+
type SidekickSchemaDef,
|
|
248
|
+
type SidekickUnknownSchema,
|
|
249
249
|
type BackwardsCompatibleSchema,
|
|
250
|
-
type
|
|
250
|
+
type SidekickRules,
|
|
251
251
|
type UpdateParams,
|
|
252
252
|
type LinkParams,
|
|
253
253
|
type ValidQuery,
|
|
@@ -269,8 +269,8 @@ export {
|
|
|
269
269
|
// stream types
|
|
270
270
|
type CreateReadStreamOpts,
|
|
271
271
|
type CreateWriteStreamOpts,
|
|
272
|
-
type
|
|
273
|
-
type
|
|
272
|
+
type SidekickWritableStream,
|
|
273
|
+
type SidekickReadableStream,
|
|
274
274
|
|
|
275
275
|
// custom store
|
|
276
276
|
StoreInterface,
|