@fidscript/instant-react-native 0.1.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.
Files changed (96) hide show
  1. package/dist/EventSourceImpl.d.ts +10 -0
  2. package/dist/EventSourceImpl.d.ts.map +1 -0
  3. package/dist/EventSourceImpl.js +9 -0
  4. package/dist/EventSourceImpl.js.map +1 -0
  5. package/dist/EventSourceShim.d.ts +31 -0
  6. package/dist/EventSourceShim.d.ts.map +1 -0
  7. package/dist/EventSourceShim.js +228 -0
  8. package/dist/EventSourceShim.js.map +1 -0
  9. package/dist/NetworkListener.d.ts +5 -0
  10. package/dist/NetworkListener.d.ts.map +1 -0
  11. package/dist/NetworkListener.js +19 -0
  12. package/dist/NetworkListener.js.map +1 -0
  13. package/dist/Storage.d.ts +3 -0
  14. package/dist/Storage.d.ts.map +1 -0
  15. package/dist/Storage.js +5 -0
  16. package/dist/Storage.js.map +1 -0
  17. package/dist/Storage.native.d.ts +22 -0
  18. package/dist/Storage.native.d.ts.map +1 -0
  19. package/dist/Storage.native.js +79 -0
  20. package/dist/Storage.native.js.map +1 -0
  21. package/dist/Streams.d.ts +15 -0
  22. package/dist/Streams.d.ts.map +1 -0
  23. package/dist/Streams.js +9 -0
  24. package/dist/Streams.js.map +1 -0
  25. package/dist/Streams.native.d.ts +6 -0
  26. package/dist/Streams.native.d.ts.map +1 -0
  27. package/dist/Streams.native.js +9 -0
  28. package/dist/Streams.native.js.map +1 -0
  29. package/dist/cli.d.ts +2 -0
  30. package/dist/cli.d.ts.map +1 -0
  31. package/dist/cli.js +18 -0
  32. package/dist/cli.js.map +1 -0
  33. package/dist/index.d.ts +56 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +87 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/module/EventSourceImpl.d.ts +10 -0
  38. package/dist/module/EventSourceImpl.d.ts.map +1 -0
  39. package/dist/module/EventSourceImpl.js +4 -0
  40. package/dist/module/EventSourceImpl.js.map +1 -0
  41. package/dist/module/EventSourceShim.d.ts +31 -0
  42. package/dist/module/EventSourceShim.d.ts.map +1 -0
  43. package/dist/module/EventSourceShim.js +226 -0
  44. package/dist/module/EventSourceShim.js.map +1 -0
  45. package/dist/module/NetworkListener.d.ts +5 -0
  46. package/dist/module/NetworkListener.d.ts.map +1 -0
  47. package/dist/module/NetworkListener.js +13 -0
  48. package/dist/module/NetworkListener.js.map +1 -0
  49. package/dist/module/Storage.d.ts +3 -0
  50. package/dist/module/Storage.d.ts.map +1 -0
  51. package/dist/module/Storage.js +3 -0
  52. package/dist/module/Storage.js.map +1 -0
  53. package/dist/module/Storage.native.d.ts +22 -0
  54. package/dist/module/Storage.native.d.ts.map +1 -0
  55. package/dist/module/Storage.native.js +75 -0
  56. package/dist/module/Storage.native.js.map +1 -0
  57. package/dist/module/Streams.d.ts +15 -0
  58. package/dist/module/Streams.d.ts.map +1 -0
  59. package/dist/module/Streams.js +6 -0
  60. package/dist/module/Streams.js.map +1 -0
  61. package/dist/module/Streams.native.d.ts +6 -0
  62. package/dist/module/Streams.native.d.ts.map +1 -0
  63. package/dist/module/Streams.native.js +6 -0
  64. package/dist/module/Streams.native.js.map +1 -0
  65. package/dist/module/cli.d.ts +2 -0
  66. package/dist/module/cli.d.ts.map +1 -0
  67. package/dist/module/cli.js +2 -0
  68. package/dist/module/cli.js.map +1 -0
  69. package/dist/module/index.d.ts +56 -0
  70. package/dist/module/index.d.ts.map +1 -0
  71. package/dist/module/index.js +76 -0
  72. package/dist/module/index.js.map +1 -0
  73. package/dist/module/version.d.ts +3 -0
  74. package/dist/module/version.d.ts.map +1 -0
  75. package/dist/module/version.js +3 -0
  76. package/dist/module/version.js.map +1 -0
  77. package/dist/version.d.ts +3 -0
  78. package/dist/version.d.ts.map +1 -0
  79. package/dist/version.js +5 -0
  80. package/dist/version.js.map +1 -0
  81. package/package.json +49 -0
  82. package/src/EventSourceImpl.ts +6 -0
  83. package/src/EventSourceShim.ts +285 -0
  84. package/src/NetworkListener.js +13 -0
  85. package/src/Storage.js +3 -0
  86. package/src/Storage.native.ts +91 -0
  87. package/src/Streams.native.ts +6 -0
  88. package/src/Streams.ts +5 -0
  89. package/src/__types__/typeUtils.ts +39 -0
  90. package/src/__types__/typesTests.ts +86 -0
  91. package/src/cli.ts +1 -0
  92. package/src/index.ts +290 -0
  93. package/src/version.ts +2 -0
  94. package/tsconfig.json +16 -0
  95. package/tsconfig.module.json +13 -0
  96. package/tsconfig.test.json +5 -0
@@ -0,0 +1,75 @@
1
+ import { StoreInterface } from '@fidscript/instant-sdk';
2
+ const version = 5;
3
+ // AsyncStorage is an optional peer dependency. The `require` must sit
4
+ // directly inside a `try` block: that's what makes Metro treat it as an
5
+ // optional dependency (`transformer.allowOptionalDependencies`, enabled by
6
+ // default in the Expo and React Native metro configs), so bundling doesn't
7
+ // fail when it isn't installed. When it can't be loaded, `init` surfaces a
8
+ // helpful error unless a custom `Store` is passed.
9
+ let AsyncStorage = null;
10
+ let asyncStorageLoadError = null;
11
+ try {
12
+ AsyncStorage = require('@react-native-async-storage/async-storage').default;
13
+ }
14
+ catch (e) {
15
+ asyncStorageLoadError = e;
16
+ }
17
+ export class AsyncStorageStore extends StoreInterface {
18
+ appId;
19
+ dbName;
20
+ constructor(appId, dbName) {
21
+ super(appId, dbName);
22
+ this.appId = appId;
23
+ this.dbName = dbName;
24
+ }
25
+ makeKey(k) {
26
+ return `instant_${this.appId}_${version}_${this.dbName}_${k}`;
27
+ }
28
+ async getItem(k) {
29
+ const res = await AsyncStorage.getItem(this.makeKey(k));
30
+ if (res === null)
31
+ return res;
32
+ return JSON.parse(res);
33
+ }
34
+ async setItem(k, v) {
35
+ await AsyncStorage.setItem(this.makeKey(k), JSON.stringify(v));
36
+ }
37
+ async removeItem(k) {
38
+ await AsyncStorage.removeItem(this.makeKey(k));
39
+ }
40
+ async getAllKeys() {
41
+ const allKeys = await AsyncStorage.getAllKeys();
42
+ const keys = [];
43
+ const keyPrefix = this.makeKey('');
44
+ for (const key of allKeys) {
45
+ if (key.startsWith(keyPrefix)) {
46
+ keys.push(key.substring(keyPrefix.length));
47
+ }
48
+ }
49
+ return keys;
50
+ }
51
+ async multiSet(keyValuePairs) {
52
+ await AsyncStorage.multiSet(keyValuePairs.map(([k, v]) => [this.makeKey(k), JSON.stringify(v)]));
53
+ }
54
+ }
55
+ class MissingStore extends StoreInterface {
56
+ constructor(appId, dbName) {
57
+ super(appId, dbName);
58
+ throw new Error('Instant needs a store to persist data on device. ' +
59
+ 'Install `@react-native-async-storage/async-storage`, ' +
60
+ 'or pass a `Store` to `init` (e.g. from `@instantdb/react-native-mmkv` or `@instantdb/expo-sqlite`).' +
61
+ (asyncStorageLoadError
62
+ ? `\n\nLoading async-storage failed with: ${asyncStorageLoadError}`
63
+ : ''));
64
+ }
65
+ async getItem(_k) {
66
+ return null;
67
+ }
68
+ async removeItem(_k) { }
69
+ async multiSet(_keyValuePairs) { }
70
+ async getAllKeys() {
71
+ return [];
72
+ }
73
+ }
74
+ export default AsyncStorage ? AsyncStorageStore : MissingStore;
75
+ //# sourceMappingURL=Storage.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Storage.native.js","sourceRoot":"","sources":["../../src/Storage.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA2B,MAAM,wBAAwB,CAAC;AAEjF,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,iBAAk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AC9B,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,mDAAmD;YACjD,uDAAuD;YACvD,qGAAqG;YACrG,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 '@fidscript/instant-sdk';\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 `instant_${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 'Instant 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 `@instantdb/react-native-mmkv` or `@instantdb/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"]}
@@ -0,0 +1,15 @@
1
+ export declare const streamConstructors: {
2
+ ReadableStream: {
3
+ new (underlyingSource: UnderlyingByteSource, strategy?: {
4
+ highWaterMark?: number;
5
+ }): ReadableStream<Uint8Array<ArrayBuffer>>;
6
+ new <R = any>(underlyingSource: UnderlyingDefaultSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
7
+ new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
8
+ prototype: ReadableStream;
9
+ };
10
+ WritableStream: {
11
+ new <W = any>(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>): WritableStream<W>;
12
+ prototype: WritableStream;
13
+ };
14
+ };
15
+ //# sourceMappingURL=Streams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Streams.d.ts","sourceRoot":"","sources":["../../src/Streams.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB;;;yBAIgn5oC,CAAC;;;;;;;;;;CAD/o5oC,CAAC"}
@@ -0,0 +1,6 @@
1
+ // RN may need a polyfill for streams, so we put those in Streams.native.ts
2
+ export const streamConstructors = {
3
+ ReadableStream: ReadableStream,
4
+ WritableStream: WritableStream,
5
+ };
6
+ //# sourceMappingURL=Streams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Streams.js","sourceRoot":"","sources":["../../src/Streams.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,cAAc,EAAE,cAAc;IAC9B,cAAc,EAAE,cAAc;CAC/B,CAAC","sourcesContent":["// RN may need a polyfill for streams, so we put those in Streams.native.ts\nexport const streamConstructors = {\n ReadableStream: ReadableStream,\n WritableStream: WritableStream,\n};\n"]}
@@ -0,0 +1,6 @@
1
+ import { ReadableStream, WritableStream } from 'web-streams-polyfill';
2
+ export declare const streamConstructors: {
3
+ ReadableStream: typeof ReadableStream;
4
+ WritableStream: typeof WritableStream;
5
+ };
6
+ //# sourceMappingURL=Streams.native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Streams.native.d.ts","sourceRoot":"","sources":["../../src/Streams.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtE,eAAO,MAAM,kBAAkB;;;CAG9B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { ReadableStream, WritableStream } from 'web-streams-polyfill';
2
+ export const streamConstructors = {
3
+ ReadableStream: ReadableStream,
4
+ WritableStream: WritableStream,
5
+ };
6
+ //# sourceMappingURL=Streams.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Streams.native.js","sourceRoot":"","sources":["../../src/Streams.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtE,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,cAAc,EAAE,cAAc;IAC9B,cAAc,EAAE,cAAc;CAC/B,CAAC","sourcesContent":["import { ReadableStream, WritableStream } from 'web-streams-polyfill';\n\nexport const streamConstructors = {\n ReadableStream: ReadableStream,\n WritableStream: WritableStream,\n};\n"]}
@@ -0,0 +1,2 @@
1
+ export * from '@fidscript/instant-sdk';
2
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from '@fidscript/instant-sdk';
2
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC","sourcesContent":["export * from '@fidscript/instant-sdk';\n"]}
@@ -0,0 +1,56 @@
1
+ import 'react-native-get-random-values';
2
+ import Store from './Storage';
3
+ import NetworkListener from './NetworkListener';
4
+ import { InstantReactAbstractDatabase } from '@fidscript/instant-react-common';
5
+ import { i, id, tx, lookup, InstantAPIError, setInstantWarningsEnabled, SyncTableCallbackEventType, createInstantRouteHandler, type RoomSchemaShape, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantSchemaDatabase, type ConnectionStatus, type BackwardsCompatibleSchema, type IInstantDatabase, type Config, type Query, type QueryResponse, type InstantObject, type AuthState, type User, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type InstantGraph, type InstantUnknownSchemaDef, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type InstantEntity, type InstaQLEntity, type InstaQLResult, type InstaQLEntitySubquery, type RoomsOf, type RoomsDef, type PresenceOf, type TopicsOf, type TopicOf, type RoomHandle, type CreateParams, type InstantConfig, type InstantSchemaDef, type InstantUnknownSchema, type TransactionChunk, type InstantRules, 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, InstantWritableStream, InstantReadableStream, type Logger } from '@fidscript/instant-sdk';
6
+ /**
7
+ *
8
+ * The first step: init your application!
9
+ *
10
+ * Visit https://instantdb.com/dash to get your `appId` :)
11
+ *
12
+ * @example
13
+ * import { init } from "@instantdb/react-native"
14
+ *
15
+ * const db = init({ appId: "my-app-id" })
16
+ *
17
+ * // You can also provide a schema for type safety and editor autocomplete!
18
+ *
19
+ * import { init } from "@instantdb/react-native"
20
+ * import schema from ""../instant.schema.ts";
21
+ *
22
+ * const db = init({ appId: "my-app-id", schema })
23
+ *
24
+ * // To learn more: https://instantdb.com/docs/modeling-data
25
+ */
26
+ declare function init<Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema, UseDates extends boolean = false>(config: Omit<InstantConfig<Schema, UseDates>, 'useDateObjects'> & {
27
+ useDateObjects?: UseDates;
28
+ }): InstantReactNativeDatabase<Schema, UseDates, InstantConfig<Schema, UseDates>>;
29
+ /**
30
+ * @deprecated
31
+ * `init_experimental` is deprecated. You can replace it with `init`.
32
+ *
33
+ * @example
34
+ *
35
+ * // Before
36
+ * import { init_experimental } from "@instantdb/react-native"
37
+ * const db = init_experimental({ ... });
38
+ *
39
+ * // After
40
+ * import { init } from "@instantdb/react-native"
41
+ * const db = init({ ... });
42
+ */
43
+ declare const init_experimental: typeof init;
44
+ declare class InstantReactNativeDatabase<Schema extends InstantSchemaDef<any, any, any>, UseDates extends boolean, Config extends InstantConfig<Schema, UseDates> = InstantConfig<Schema, UseDates>> extends InstantReactAbstractDatabase<Schema, UseDates, Config> {
45
+ static Store: typeof Store;
46
+ static NetworkListener: typeof NetworkListener;
47
+ static EventSourceImpl: typeof import("./EventSourceShim").default | {
48
+ new (url: string | URL, eventSourceInitDict?: EventSourceInit): EventSource;
49
+ prototype: EventSource;
50
+ readonly CONNECTING: 0;
51
+ readonly OPEN: 1;
52
+ readonly CLOSED: 2;
53
+ };
54
+ }
55
+ export { init, init_experimental, id, tx, lookup, i, createInstantRouteHandler, InstantReactNativeDatabase, InstantAPIError, setInstantWarningsEnabled, SyncTableCallbackEventType, type Config, type Query, type QueryResponse, type InstantObject, type User, type AuthState, type ConnectionStatus, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantSchemaDatabase, type IInstantDatabase, type InstantEntity, type RoomSchemaShape, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type InstantGraph, type CreateParams, type LinkAttrDef, type InstantConfig, type LinkDef, type InstantUnknownSchemaDef, type LinksDef, type RoomsOf, type RoomsDef, type RoomHandle, type PresenceOf, type TopicsOf, type TopicOf, type ResolveAttrs, type ValueTypes, type InstaQLEntity, type InstaQLResult, type InstaQLEntitySubquery, type InstantSchemaDef, type InstantUnknownSchema, type BackwardsCompatibleSchema, type InstantRules, 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 InstantWritableStream, type InstantReadableStream, StoreInterface, type StoreInterfaceStoreName, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, type Logger, };
56
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAE/E,OAAO,EACL,CAAC,EACD,EAAE,EACF,EAAE,EACF,MAAM,EAEN,eAAe,EACf,yBAAyB,EAGzB,0BAA0B,EAG1B,yBAAyB,EACzB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,gBA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import 'react-native-get-random-values';
2
+ import Store from './Storage';
3
+ import EventSourceImpl from './EventSourceImpl';
4
+ import NetworkListener from './NetworkListener';
5
+ import version from './version';
6
+ import { streamConstructors } from './Streams';
7
+ import { InstantReactAbstractDatabase } from '@fidscript/instant-react-common';
8
+ import { i, id, tx, lookup,
9
+ // error
10
+ InstantAPIError, setInstantWarningsEnabled,
11
+ // sync table enums
12
+ SyncTableCallbackEventType,
13
+ // types
14
+ createInstantRouteHandler, StoreInterface, } from '@fidscript/instant-sdk';
15
+ /**
16
+ *
17
+ * The first step: init your application!
18
+ *
19
+ * Visit https://instantdb.com/dash to get your `appId` :)
20
+ *
21
+ * @example
22
+ * import { init } from "@instantdb/react-native"
23
+ *
24
+ * const db = init({ appId: "my-app-id" })
25
+ *
26
+ * // You can also provide a schema for type safety and editor autocomplete!
27
+ *
28
+ * import { init } from "@instantdb/react-native"
29
+ * import schema from ""../instant.schema.ts";
30
+ *
31
+ * const db = init({ appId: "my-app-id", schema })
32
+ *
33
+ * // To learn more: https://instantdb.com/docs/modeling-data
34
+ */
35
+ function init(
36
+ // Allows config with missing `useDateObjects`, but keeps `UseDates`
37
+ // as a non-nullable in the InstantConfig type.
38
+ config) {
39
+ const configStrict = {
40
+ ReadableStream: streamConstructors.ReadableStream,
41
+ WritableStream: streamConstructors.WritableStream,
42
+ ...config,
43
+ useDateObjects: (config.useDateObjects ?? false),
44
+ };
45
+ return new InstantReactNativeDatabase(configStrict, {
46
+ '@fidscript/react-native': version,
47
+ });
48
+ }
49
+ /**
50
+ * @deprecated
51
+ * `init_experimental` is deprecated. You can replace it with `init`.
52
+ *
53
+ * @example
54
+ *
55
+ * // Before
56
+ * import { init_experimental } from "@instantdb/react-native"
57
+ * const db = init_experimental({ ... });
58
+ *
59
+ * // After
60
+ * import { init } from "@instantdb/react-native"
61
+ * const db = init({ ... });
62
+ */
63
+ const init_experimental = init;
64
+ class InstantReactNativeDatabase extends InstantReactAbstractDatabase {
65
+ static Store = Store;
66
+ static NetworkListener = NetworkListener;
67
+ static EventSourceImpl = EventSourceImpl;
68
+ }
69
+ export { init, init_experimental, id, tx, lookup, i, createInstantRouteHandler, InstantReactNativeDatabase,
70
+ // error
71
+ InstantAPIError, setInstantWarningsEnabled,
72
+ // sync table enums
73
+ SyncTableCallbackEventType,
74
+ // custom store
75
+ StoreInterface, };
76
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAE/E,OAAO,EACL,CAAC,EACD,EAAE,EACF,EAAE,EACF,MAAM;AACN,QAAQ;AACR,eAAe,EACf,yBAAyB;AAEzB,mBAAmB;AACnB,0BAA0B;AAE1B,QAAQ;AACR,yBAAyB,EA2EzB,cAAc,GAOf,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAS,IAAI;AAIX,oEAAoE;AACpE,+CAA+C;AAC/C,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,0BAA0B,CAInC,YAAY,EAAE;QACd,yBAAyB,EAAE,OAAO;KACnC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAE/B,MAAM,0BAOJ,SAAQ,4BAAsD;IAC9D,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,yBAAyB,EACzB,0BAA0B;AAE1B,QAAQ;AACR,eAAe,EACf,yBAAyB;AAEzB,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 { InstantReactAbstractDatabase } from '@fidscript/instant-react-common';\n\nimport {\n i,\n id,\n tx,\n lookup,\n // error\n InstantAPIError,\n setInstantWarningsEnabled,\n\n // sync table enums\n SyncTableCallbackEventType,\n\n // types\n createInstantRouteHandler,\n type RoomSchemaShape,\n type InstantQuery,\n type InstantQueryResult,\n type InstantSchema,\n type InstantSchemaDatabase,\n type ConnectionStatus,\n type BackwardsCompatibleSchema,\n type IInstantDatabase,\n type Config,\n type Query,\n type QueryResponse,\n type InstantObject,\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 InstantGraph,\n type InstantUnknownSchemaDef,\n type LinkAttrDef,\n type LinkDef,\n type LinksDef,\n type ResolveAttrs,\n type ValueTypes,\n type InstantEntity,\n type ConfigWithSchema,\n type InstaQLEntity,\n type InstaQLResult,\n type InstaQLEntitySubquery,\n type RoomsOf,\n type RoomsDef,\n type PresenceOf,\n type TopicsOf,\n type TopicOf,\n type RoomHandle,\n type CreateParams,\n type InstantConfig,\n type InstantSchemaDef,\n type InstantUnknownSchema,\n type TransactionChunk,\n type InstantRules,\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 InstantWritableStream,\n InstantReadableStream,\n type Logger,\n} from '@fidscript/instant-sdk';\n\n/**\n *\n * The first step: init your application!\n *\n * Visit https://instantdb.com/dash to get your `appId` :)\n *\n * @example\n * import { init } from \"@instantdb/react-native\"\n *\n * const db = init({ appId: \"my-app-id\" })\n *\n * // You can also provide a schema for type safety and editor autocomplete!\n *\n * import { init } from \"@instantdb/react-native\"\n * import schema from \"\"../instant.schema.ts\";\n *\n * const db = init({ appId: \"my-app-id\", schema })\n *\n * // To learn more: https://instantdb.com/docs/modeling-data\n */\nfunction init<\n Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema,\n UseDates extends boolean = false,\n>(\n // Allows config with missing `useDateObjects`, but keeps `UseDates`\n // as a non-nullable in the InstantConfig type.\n config: Omit<InstantConfig<Schema, UseDates>, 'useDateObjects'> & {\n useDateObjects?: UseDates;\n },\n): InstantReactNativeDatabase<\n Schema,\n UseDates,\n InstantConfig<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 InstantReactNativeDatabase<\n Schema,\n UseDates,\n InstantConfig<Schema, UseDates>\n >(configStrict, {\n '@fidscript/react-native': 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 \"@instantdb/react-native\"\n * const db = init_experimental({ ... });\n *\n * // After\n * import { init } from \"@instantdb/react-native\"\n * const db = init({ ... });\n */\nconst init_experimental = init;\n\nclass InstantReactNativeDatabase<\n Schema extends InstantSchemaDef<any, any, any>,\n UseDates extends boolean,\n Config extends InstantConfig<Schema, UseDates> = InstantConfig<\n Schema,\n UseDates\n >,\n> extends InstantReactAbstractDatabase<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 createInstantRouteHandler,\n InstantReactNativeDatabase,\n\n // error\n InstantAPIError,\n setInstantWarningsEnabled,\n\n // sync table enums\n SyncTableCallbackEventType,\n\n // types\n type Config,\n type Query,\n type QueryResponse,\n type InstantObject,\n type User,\n type AuthState,\n type ConnectionStatus,\n type InstantQuery,\n type InstantQueryResult,\n type InstantSchema,\n type InstantSchemaDatabase,\n type IInstantDatabase,\n type InstantEntity,\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 InstantGraph,\n type CreateParams,\n type LinkAttrDef,\n type InstantConfig,\n type LinkDef,\n type InstantUnknownSchemaDef,\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 InstaQLEntity,\n type InstaQLResult,\n type InstaQLEntitySubquery,\n type InstantSchemaDef,\n type InstantUnknownSchema,\n type BackwardsCompatibleSchema,\n type InstantRules,\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 InstantWritableStream,\n type InstantReadableStream,\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"]}
@@ -0,0 +1,3 @@
1
+ declare const version = "0.1.0";
2
+ export default version;
3
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,OAAO,UAAU,CAAC;AACxB,eAAe,OAAO,CAAC"}
@@ -0,0 +1,3 @@
1
+ const version = '0.1.0';
2
+ export default version;
3
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,OAAO,CAAC;AACxB,eAAe,OAAO,CAAC","sourcesContent":["const version = '0.1.0';\nexport default version;\n"]}
@@ -0,0 +1,3 @@
1
+ declare const version = "0.1.0";
2
+ export default version;
3
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,OAAO,UAAU,CAAC;AACxB,eAAe,OAAO,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const version = '0.1.0';
4
+ exports.default = version;
5
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;AAAA,MAAM,OAAO,GAAG,OAAO,CAAC;AACxB,kBAAe,OAAO,CAAC","sourcesContent":["const version = '0.1.0';\nexport default version;\n"]}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@fidscript/instant-react-native",
3
+ "version": "0.1.0",
4
+ "description": "FIDScript self-hosted InstantDB React Native SDK",
5
+ "license": "Apache-2.0",
6
+ "main": "dist/index.js",
7
+ "module": "dist/module/index.js",
8
+ "types": "dist/module/index.d.ts",
9
+ "unpkg": "dist/index.js",
10
+ "scripts": {
11
+ "test": "vitest",
12
+ "test:types": "tsc -p tsconfig.test.json --noEmit",
13
+ "test:ci": "pnpm run test:types",
14
+ "build": "rm -rf dist; npm run build:main && npm run build:module",
15
+ "dev:main": "tsc -p tsconfig.json -w --skipLibCheck --preserveWatchOutput | grep -v '^$'",
16
+ "dev:module": "tsc -p tsconfig.module.json -w --skipLibCheck --preserveWatchOutput | grep -v '^$'",
17
+ "dev": "run-p dev:main dev:module",
18
+ "clean": "rm -rf dist",
19
+ "build:main": "tsc -p tsconfig.json",
20
+ "build:module": "tsc -p tsconfig.module.json",
21
+ "publish-package": "pnpm pack && npm publish *.tgz --access public"
22
+ },
23
+ "devDependencies": {
24
+ "@babel/core": "^7.17.9",
25
+ "@babel/preset-env": "^7.16.11",
26
+ "@types/node": "^22.6.1",
27
+ "@types/react": ">=16",
28
+ "npm-run-all": "^4.1.5",
29
+ "typescript": "^5.9.3",
30
+ "vitest": "^0.21.0"
31
+ },
32
+ "peerDependencies": {
33
+ "@react-native-async-storage/async-storage": ">=1.15",
34
+ "@react-native-community/netinfo": ">=7.1",
35
+ "react": ">=16",
36
+ "react-native": ">=0.56",
37
+ "react-native-get-random-values": ">=1.5"
38
+ },
39
+ "peerDependenciesMeta": {
40
+ "@react-native-async-storage/async-storage": {
41
+ "optional": true
42
+ }
43
+ },
44
+ "dependencies": {
45
+ "@fidscript/instant-sdk": "^0.1.1",
46
+ "@fidscript/instant-react-common": "^0.1.1",
47
+ "web-streams-polyfill": "^4.2.0"
48
+ }
49
+ }
@@ -0,0 +1,6 @@
1
+ import EventSourceShim from './EventSourceShim';
2
+
3
+ const EventSourceImpl =
4
+ typeof EventSource === 'undefined' ? EventSourceShim : EventSource;
5
+
6
+ export default EventSourceImpl;