@sidekickdb/solidjs 2.0.0 → 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/.turbo/turbo-build.log +8 -8
- package/README.md +4 -4
- package/dist/commonjs/{InstantSolidDatabase.d.ts → SidekickSolidDatabase.d.ts} +27 -27
- package/dist/commonjs/SidekickSolidDatabase.d.ts.map +1 -0
- package/dist/commonjs/{InstantSolidDatabase.js → SidekickSolidDatabase.js} +17 -17
- package/dist/commonjs/SidekickSolidDatabase.js.map +1 -0
- package/dist/{esm/InstantSolidRoom.d.ts → commonjs/SidekickSolidRoom.d.ts} +10 -10
- package/dist/commonjs/SidekickSolidRoom.d.ts.map +1 -0
- package/dist/commonjs/{InstantSolidRoom.js → SidekickSolidRoom.js} +4 -4
- package/dist/commonjs/SidekickSolidRoom.js.map +1 -0
- package/dist/commonjs/index.d.ts +5 -5
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +10 -10
- package/dist/commonjs/index.js.map +1 -1
- package/dist/esm/{InstantSolidDatabase.d.ts → SidekickSolidDatabase.d.ts} +27 -27
- package/dist/esm/SidekickSolidDatabase.d.ts.map +1 -0
- package/dist/esm/{InstantSolidDatabase.js → SidekickSolidDatabase.js} +15 -15
- package/dist/esm/SidekickSolidDatabase.js.map +1 -0
- package/dist/{commonjs/InstantSolidRoom.d.ts → esm/SidekickSolidRoom.d.ts} +10 -10
- package/dist/esm/SidekickSolidRoom.d.ts.map +1 -0
- package/dist/esm/{InstantSolidRoom.js → SidekickSolidRoom.js} +2 -2
- package/dist/esm/SidekickSolidRoom.js.map +1 -0
- package/dist/esm/index.d.ts +5 -5
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +8 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/standalone/index.js +1378 -1478
- package/dist/standalone/index.umd.cjs +9 -6
- package/package.json +4 -4
- package/src/{InstantSolidDatabase.ts → SidekickSolidDatabase.ts} +40 -40
- package/src/{InstantSolidRoom.ts → SidekickSolidRoom.ts} +11 -11
- package/src/index.ts +51 -51
- package/vite.config.ts +1 -1
- package/dist/commonjs/InstantSolidDatabase.d.ts.map +0 -1
- package/dist/commonjs/InstantSolidDatabase.js.map +0 -1
- package/dist/commonjs/InstantSolidRoom.d.ts.map +0 -1
- package/dist/commonjs/InstantSolidRoom.js.map +0 -1
- package/dist/esm/InstantSolidDatabase.d.ts.map +0 -1
- package/dist/esm/InstantSolidDatabase.js.map +0 -1
- package/dist/esm/InstantSolidRoom.d.ts.map +0 -1
- package/dist/esm/InstantSolidRoom.js.map +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
|
|
2
|
-
> @sidekickdb/solidjs@
|
|
2
|
+
> @sidekickdb/solidjs@3.0.0 build /home/runner/work/sidekick/sidekick/client/packages/solidjs
|
|
3
3
|
> rm -rf dist; npm run build:tshy && npm run build:standalone && npm run check-exports
|
|
4
4
|
|
|
5
5
|
npm warn Unknown env config "verify-deps-before-run". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.
|
|
6
6
|
|
|
7
|
-
> @sidekickdb/solidjs@
|
|
7
|
+
> @sidekickdb/solidjs@3.0.0 build:tshy
|
|
8
8
|
> tshy
|
|
9
9
|
|
|
10
10
|
npm warn Unknown env config "verify-deps-before-run". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.
|
|
11
11
|
|
|
12
|
-
> @sidekickdb/solidjs@
|
|
12
|
+
> @sidekickdb/solidjs@3.0.0 build:standalone
|
|
13
13
|
> vite build
|
|
14
14
|
|
|
15
15
|
[36mvite v5.4.14 [32mbuilding for production...[36m[39m
|
|
@@ -17,16 +17,16 @@ transforming...
|
|
|
17
17
|
[32m✓[39m 74 modules transformed.
|
|
18
18
|
rendering chunks...
|
|
19
19
|
computing gzip size...
|
|
20
|
-
[2mdist/standalone/[22m[36mindex.umd.cjs [39m[1m[
|
|
21
|
-
[2mdist/standalone/[22m[36mindex.js [39m[1m[
|
|
22
|
-
[32m✓ built in 1.
|
|
20
|
+
[2mdist/standalone/[22m[36mindex.umd.cjs [39m[1m[2m168.27 kB[22m[1m[22m[2m │ gzip: 51.62 kB[22m
|
|
21
|
+
[2mdist/standalone/[22m[36mindex.js [39m[1m[2m256.99 kB[22m[1m[22m[2m │ gzip: 67.04 kB[22m
|
|
22
|
+
[32m✓ built in 1.47s[39m
|
|
23
23
|
npm warn Unknown env config "verify-deps-before-run". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.
|
|
24
24
|
|
|
25
|
-
> @sidekickdb/solidjs@
|
|
25
|
+
> @sidekickdb/solidjs@3.0.0 check-exports
|
|
26
26
|
> attw --pack .
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
@sidekickdb/solidjs
|
|
29
|
+
@sidekickdb/solidjs v3.0.0
|
|
30
30
|
|
|
31
31
|
Build tools:
|
|
32
32
|
- @arethetypeswrong/cli@^0.18.5
|
package/README.md
CHANGED
|
@@ -9,15 +9,15 @@ Welcome to SidekickDB's SolidJS 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
|
|
|
16
16
|
import { init, id } from '@sidekickdb/solidjs';
|
|
17
17
|
|
|
18
18
|
const db = init({
|
|
19
|
-
appId: import.meta.env.
|
|
20
|
-
apiURI: import.meta.env.
|
|
19
|
+
appId: import.meta.env.VITE_SIDEKICK_APP_ID,
|
|
20
|
+
apiURI: import.meta.env.VITE_SIDEKICK_API_URI,
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
function Chat() {
|
|
@@ -36,7 +36,7 @@ function Chat() {
|
|
|
36
36
|
|
|
37
37
|
# Get Started
|
|
38
38
|
|
|
39
|
-
Follow the [getting started](https://
|
|
39
|
+
Follow the [getting started](https://sidekickdb.co/docs/start-solidjs) tutorial to set up a live SolidJS app in under 5 minutes!
|
|
40
40
|
|
|
41
41
|
# Questions?
|
|
42
42
|
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { type AuthState, type User, type ConnectionStatus, type TransactionChunk, type RoomSchemaShape, type
|
|
1
|
+
import { type AuthState, type User, type ConnectionStatus, type TransactionChunk, type RoomSchemaShape, type SideQLOptions, type SidekickConfig, type PageInfoResponse, type SideQLLifecycleState, type SideQLResponse, type ValidQuery, Auth, Storage, Streams, SidekickCoreDatabase, SidekickSchemaDef, RoomsOf, ISidekickDatabase } from '@sidekickdb/core';
|
|
2
2
|
import type { Accessor } from 'solid-js';
|
|
3
|
-
import {
|
|
4
|
-
export type InfiniteQueryState<Schema extends
|
|
3
|
+
import { SidekickSolidRoom } from './SidekickSolidRoom.js';
|
|
4
|
+
export type InfiniteQueryState<Schema extends SidekickSchemaDef<any, any, any>, Q extends ValidQuery<Q, Schema>, UseDates extends boolean> = {
|
|
5
5
|
isLoading: boolean;
|
|
6
6
|
error: {
|
|
7
7
|
message: string;
|
|
8
8
|
} | undefined;
|
|
9
|
-
data:
|
|
9
|
+
data: SideQLResponse<Schema, Q, UseDates> | undefined;
|
|
10
10
|
canLoadNextPage: boolean;
|
|
11
11
|
loadNextPage: () => void;
|
|
12
12
|
};
|
|
13
|
-
export declare class
|
|
13
|
+
export declare class SidekickSolidDatabase<Schema extends SidekickSchemaDef<any, any, any>, UseDates extends boolean = false, Rooms extends RoomSchemaShape = RoomsOf<Schema>> implements ISidekickDatabase<Schema> {
|
|
14
14
|
tx: import("@sidekickdb/core").TxChunk<Schema>;
|
|
15
15
|
auth: Auth;
|
|
16
16
|
storage: Storage;
|
|
17
17
|
streams: Streams;
|
|
18
|
-
core:
|
|
19
|
-
constructor(core:
|
|
18
|
+
core: SidekickCoreDatabase<Schema, UseDates>;
|
|
19
|
+
constructor(core: SidekickCoreDatabase<Schema, UseDates>);
|
|
20
20
|
/**
|
|
21
21
|
* Returns a unique ID for a given `name`. It's stored in local storage,
|
|
22
22
|
* so you will get the same ID across sessions.
|
|
@@ -28,7 +28,7 @@ export declare class InstantSolidDatabase<Schema extends InstantSchemaDef<any, a
|
|
|
28
28
|
/**
|
|
29
29
|
* Use this to write data! You can create, update, delete, and link objects
|
|
30
30
|
*
|
|
31
|
-
* @see https://sidekickdb.co/docs/
|
|
31
|
+
* @see https://sidekickdb.co/docs/sideml
|
|
32
32
|
*
|
|
33
33
|
* @example
|
|
34
34
|
* const goalId = id();
|
|
@@ -48,32 +48,32 @@ export declare class InstantSolidDatabase<Schema extends InstantSchemaDef<any, a
|
|
|
48
48
|
* Use this for one-off queries.
|
|
49
49
|
* Returns local data if available, otherwise fetches from the server.
|
|
50
50
|
*
|
|
51
|
-
* @see https://sidekickdb.co/docs/
|
|
51
|
+
* @see https://sidekickdb.co/docs/sideql
|
|
52
52
|
*
|
|
53
53
|
* @example
|
|
54
54
|
* const resp = await db.queryOnce({ goals: {} });
|
|
55
55
|
* console.log(resp.data.goals)
|
|
56
56
|
*/
|
|
57
|
-
queryOnce: <Q extends ValidQuery<Q, Schema>>(query: Q, opts?:
|
|
58
|
-
data:
|
|
57
|
+
queryOnce: <Q extends ValidQuery<Q, Schema>>(query: Q, opts?: SideQLOptions) => Promise<{
|
|
58
|
+
data: SideQLResponse<Schema, Q, UseDates>;
|
|
59
59
|
pageInfo: PageInfoResponse<Q>;
|
|
60
60
|
}>;
|
|
61
61
|
/**
|
|
62
62
|
* Use this to query your data!
|
|
63
63
|
*
|
|
64
|
-
* @see https://sidekickdb.co/docs/
|
|
64
|
+
* @see https://sidekickdb.co/docs/sideql
|
|
65
65
|
*
|
|
66
66
|
* @example
|
|
67
67
|
* const state = db.useQuery({ goals: {} });
|
|
68
68
|
* // state().isLoading, state().error, state().data
|
|
69
69
|
*/
|
|
70
|
-
useQuery: <Q extends ValidQuery<Q, Schema>>(query: (() => null | Q) | null | Q, opts?:
|
|
70
|
+
useQuery: <Q extends ValidQuery<Q, Schema>>(query: (() => null | Q) | null | Q, opts?: SideQLOptions) => Accessor<SideQLLifecycleState<Schema, Q, UseDates>>;
|
|
71
71
|
/**
|
|
72
72
|
* Subscribe to a query and incrementally load more items.
|
|
73
73
|
*
|
|
74
74
|
* Only one top level namespace in the query is allowed.
|
|
75
75
|
*
|
|
76
|
-
* @see https://sidekickdb.co/docs/
|
|
76
|
+
* @see https://sidekickdb.co/docs/sideql
|
|
77
77
|
*
|
|
78
78
|
* @example
|
|
79
79
|
* const state = db.useInfiniteQuery({
|
|
@@ -87,7 +87,7 @@ export declare class InstantSolidDatabase<Schema extends InstantSchemaDef<any, a
|
|
|
87
87
|
* // state().data, state().isLoading, state().error,
|
|
88
88
|
* // state().canLoadNextPage, state().loadNextPage()
|
|
89
89
|
*/
|
|
90
|
-
useInfiniteQuery: <Q extends ValidQuery<Q, Schema>>(query: (() => null | Q) | null | Q, opts?:
|
|
90
|
+
useInfiniteQuery: <Q extends ValidQuery<Q, Schema>>(query: (() => null | Q) | null | Q, opts?: SideQLOptions) => Accessor<InfiniteQueryState<Schema, Q, UseDates>>;
|
|
91
91
|
/**
|
|
92
92
|
* Listen for the logged in state. This is useful
|
|
93
93
|
* for deciding when to show a login screen.
|
|
@@ -113,9 +113,9 @@ export declare class InstantSolidDatabase<Schema extends InstantSchemaDef<any, a
|
|
|
113
113
|
*/
|
|
114
114
|
useUser: () => Accessor<User>;
|
|
115
115
|
/**
|
|
116
|
-
* Listen for connection status changes to
|
|
116
|
+
* Listen for connection status changes to SidekickDB.
|
|
117
117
|
*
|
|
118
|
-
* @see https://sidekickdb.co/docs/patterns#connection-status
|
|
118
|
+
* @see https://sidekickdb.co/docs/patterns#listen-to-sidekick-db-connection-status
|
|
119
119
|
* @example
|
|
120
120
|
* function App() {
|
|
121
121
|
* const status = db.useConnectionStatus();
|
|
@@ -143,7 +143,7 @@ export declare class InstantSolidDatabase<Schema extends InstantSchemaDef<any, a
|
|
|
143
143
|
* const room = db.room('chat', roomId);
|
|
144
144
|
* const presence = db.rooms.usePresence(room);
|
|
145
145
|
*/
|
|
146
|
-
room<RoomType extends keyof Rooms>(type?: RoomType, id?: string):
|
|
146
|
+
room<RoomType extends keyof Rooms>(type?: RoomType, id?: string): SidekickSolidRoom<Schema, Rooms, RoomType>;
|
|
147
147
|
/**
|
|
148
148
|
* Hooks for working with rooms
|
|
149
149
|
*
|
|
@@ -155,11 +155,11 @@ export declare class InstantSolidDatabase<Schema extends InstantSchemaDef<any, a
|
|
|
155
155
|
* const publish = db.rooms.usePublishTopic(room, 'emoji');
|
|
156
156
|
*/
|
|
157
157
|
rooms: {
|
|
158
|
-
useTopicEffect: typeof import("./
|
|
159
|
-
usePublishTopic: typeof import("./
|
|
160
|
-
usePresence: typeof import("./
|
|
161
|
-
useSyncPresence: typeof import("./
|
|
162
|
-
useTypingIndicator: typeof import("./
|
|
158
|
+
useTopicEffect: typeof import("./SidekickSolidRoom.js").useTopicEffect;
|
|
159
|
+
usePublishTopic: typeof import("./SidekickSolidRoom.js").usePublishTopic;
|
|
160
|
+
usePresence: typeof import("./SidekickSolidRoom.js").usePresence;
|
|
161
|
+
useSyncPresence: typeof import("./SidekickSolidRoom.js").useSyncPresence;
|
|
162
|
+
useTypingIndicator: typeof import("./SidekickSolidRoom.js").useTypingIndicator;
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
165
|
/**
|
|
@@ -175,11 +175,11 @@ export declare class InstantSolidDatabase<Schema extends InstantSchemaDef<any, a
|
|
|
175
175
|
* // You can also provide a schema for type safety and editor autocomplete!
|
|
176
176
|
*
|
|
177
177
|
* import { init } from "@sidekickdb/solidjs"
|
|
178
|
-
* import schema from "../
|
|
178
|
+
* import schema from "../sidekick.schema.ts";
|
|
179
179
|
*
|
|
180
180
|
* const db = init({ appId: "my-app-id", apiURI: "https://sidekick.example.com", schema })
|
|
181
181
|
*/
|
|
182
|
-
export declare function init<Schema extends
|
|
182
|
+
export declare function init<Schema extends SidekickSchemaDef<any, any, any>, UseDates extends boolean = false>(config: Omit<SidekickConfig<Schema, UseDates>, 'useDateObjects'> & {
|
|
183
183
|
useDateObjects?: UseDates;
|
|
184
|
-
}):
|
|
185
|
-
//# sourceMappingURL=
|
|
184
|
+
}): SidekickSolidDatabase<Schema, UseDates>;
|
|
185
|
+
//# sourceMappingURL=SidekickSolidDatabase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidekickSolidDatabase.d.ts","sourceRoot":"","sources":["../../src/SidekickSolidDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EAEnB,KAAK,UAAU,EAEf,IAAI,EACJ,OAAO,EACP,OAAO,EAEP,oBAAoB,EAIpB,iBAAiB,EACjB,OAAO,EAEP,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAS,MAAM,wBAAwB,CAAC;AAUlE,MAAM,MAAM,kBAAkB,CAC5B,MAAM,SAAS,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC/C,CAAC,SAAS,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,EAC/B,QAAQ,SAAS,OAAO,IACtB;IACF,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IACvC,IAAI,EAAE,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC;IACtD,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,IAAI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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.
|
|
6
|
+
exports.SidekickSolidDatabase = void 0;
|
|
7
7
|
exports.init = init;
|
|
8
8
|
const core_1 = require("@sidekickdb/core");
|
|
9
9
|
const solid_js_1 = require("solid-js");
|
|
10
|
-
const
|
|
10
|
+
const SidekickSolidRoom_js_1 = require("./SidekickSolidRoom.js");
|
|
11
11
|
const version_js_1 = __importDefault(require("./version.js"));
|
|
12
12
|
const defaultState = {
|
|
13
13
|
isLoading: true,
|
|
@@ -29,7 +29,7 @@ function stateForResult(result) {
|
|
|
29
29
|
...(result ? result : {}),
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
class
|
|
32
|
+
class SidekickSolidDatabase {
|
|
33
33
|
tx = (0, core_1.txInit)();
|
|
34
34
|
auth;
|
|
35
35
|
storage;
|
|
@@ -54,7 +54,7 @@ class InstantSolidDatabase {
|
|
|
54
54
|
/**
|
|
55
55
|
* Use this to write data! You can create, update, delete, and link objects
|
|
56
56
|
*
|
|
57
|
-
* @see https://sidekickdb.co/docs/
|
|
57
|
+
* @see https://sidekickdb.co/docs/sideml
|
|
58
58
|
*
|
|
59
59
|
* @example
|
|
60
60
|
* const goalId = id();
|
|
@@ -78,7 +78,7 @@ class InstantSolidDatabase {
|
|
|
78
78
|
* Use this for one-off queries.
|
|
79
79
|
* Returns local data if available, otherwise fetches from the server.
|
|
80
80
|
*
|
|
81
|
-
* @see https://sidekickdb.co/docs/
|
|
81
|
+
* @see https://sidekickdb.co/docs/sideql
|
|
82
82
|
*
|
|
83
83
|
* @example
|
|
84
84
|
* const resp = await db.queryOnce({ goals: {} });
|
|
@@ -92,7 +92,7 @@ class InstantSolidDatabase {
|
|
|
92
92
|
/**
|
|
93
93
|
* Use this to query your data!
|
|
94
94
|
*
|
|
95
|
-
* @see https://sidekickdb.co/docs/
|
|
95
|
+
* @see https://sidekickdb.co/docs/sideql
|
|
96
96
|
*
|
|
97
97
|
* @example
|
|
98
98
|
* const state = db.useQuery({ goals: {} });
|
|
@@ -132,7 +132,7 @@ class InstantSolidDatabase {
|
|
|
132
132
|
*
|
|
133
133
|
* Only one top level namespace in the query is allowed.
|
|
134
134
|
*
|
|
135
|
-
* @see https://sidekickdb.co/docs/
|
|
135
|
+
* @see https://sidekickdb.co/docs/sideql
|
|
136
136
|
*
|
|
137
137
|
* @example
|
|
138
138
|
* const state = db.useInfiniteQuery({
|
|
@@ -226,15 +226,15 @@ class InstantSolidDatabase {
|
|
|
226
226
|
return (0, solid_js_1.createMemo)(() => {
|
|
227
227
|
const { user } = auth();
|
|
228
228
|
if (!user) {
|
|
229
|
-
throw new core_1.
|
|
229
|
+
throw new core_1.SidekickError('useUser must be used within an auth-protected route');
|
|
230
230
|
}
|
|
231
231
|
return user;
|
|
232
232
|
});
|
|
233
233
|
};
|
|
234
234
|
/**
|
|
235
|
-
* Listen for connection status changes to
|
|
235
|
+
* Listen for connection status changes to SidekickDB.
|
|
236
236
|
*
|
|
237
|
-
* @see https://sidekickdb.co/docs/patterns#connection-status
|
|
237
|
+
* @see https://sidekickdb.co/docs/patterns#listen-to-sidekick-db-connection-status
|
|
238
238
|
* @example
|
|
239
239
|
* function App() {
|
|
240
240
|
* const status = db.useConnectionStatus();
|
|
@@ -286,7 +286,7 @@ class InstantSolidDatabase {
|
|
|
286
286
|
* const presence = db.rooms.usePresence(room);
|
|
287
287
|
*/
|
|
288
288
|
room(type = '_defaultRoomType', id = '_defaultRoomId') {
|
|
289
|
-
return new
|
|
289
|
+
return new SidekickSolidRoom_js_1.SidekickSolidRoom(this.core, type, id);
|
|
290
290
|
}
|
|
291
291
|
/**
|
|
292
292
|
* Hooks for working with rooms
|
|
@@ -298,9 +298,9 @@ class InstantSolidDatabase {
|
|
|
298
298
|
* const presence = db.rooms.usePresence(room);
|
|
299
299
|
* const publish = db.rooms.usePublishTopic(room, 'emoji');
|
|
300
300
|
*/
|
|
301
|
-
rooms =
|
|
301
|
+
rooms = SidekickSolidRoom_js_1.rooms;
|
|
302
302
|
}
|
|
303
|
-
exports.
|
|
303
|
+
exports.SidekickSolidDatabase = SidekickSolidDatabase;
|
|
304
304
|
// -----------
|
|
305
305
|
// init
|
|
306
306
|
/**
|
|
@@ -316,14 +316,14 @@ exports.InstantSolidDatabase = InstantSolidDatabase;
|
|
|
316
316
|
* // You can also provide a schema for type safety and editor autocomplete!
|
|
317
317
|
*
|
|
318
318
|
* import { init } from "@sidekickdb/solidjs"
|
|
319
|
-
* import schema from "../
|
|
319
|
+
* import schema from "../sidekick.schema.ts";
|
|
320
320
|
*
|
|
321
321
|
* const db = init({ appId: "my-app-id", apiURI: "https://sidekick.example.com", schema })
|
|
322
322
|
*/
|
|
323
323
|
function init(config) {
|
|
324
324
|
const coreDb = (0, core_1.init)(config, undefined, undefined, {
|
|
325
|
-
'@
|
|
325
|
+
'@sidekickdb/solidjs': version_js_1.default,
|
|
326
326
|
});
|
|
327
|
-
return new
|
|
327
|
+
return new SidekickSolidDatabase(coreDb);
|
|
328
328
|
}
|
|
329
|
-
//# sourceMappingURL=
|
|
329
|
+
//# sourceMappingURL=SidekickSolidDatabase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidekickSolidDatabase.js","sourceRoot":"","sources":["../../src/SidekickSolidDatabase.ts"],"names":[],"mappings":";;;;;;AAkcA,oBAYC;AA9cD,2CA2B0B;AAE1B,uCAA6E;AAG7E,iEAAkE;AAClE,8DAAmC;AAEnC,MAAM,YAAY,GAAG;IACnB,SAAS,EAAE,IAAI;IACf,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,SAAS;IACnB,KAAK,EAAE,SAAS;CACR,CAAC;AAcX,MAAM,gBAAgB,GAAc;IAClC,SAAS,EAAE,IAAI;IACf,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;CACj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B,OAAO,IAAI,wCAAiB,CAA0B,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,GAAG,4BAAK,CAAC;CACf;AAtWD,sDAsWC;AAED,cAAc;AACd,OAAO;AAEP;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,IAAI,CAIlB,MAEC;IAED,MAAM,MAAM,GAAG,IAAA,WAAS,EAAmB,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE;QACvE,qBAAqB,EAAE,oBAAO;KAC/B,CAAC,CAAC;IACH,OAAO,IAAI,qBAAqB,CAAmB,MAAM,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import {\n // types\n type AuthState,\n type User,\n type ConnectionStatus,\n type TransactionChunk,\n type RoomSchemaShape,\n type SideQLOptions,\n type SidekickConfig,\n type PageInfoResponse,\n type SideQLLifecycleState,\n type SideQLResponse,\n type InfiniteQuerySubscription,\n type ValidQuery,\n // classes\n Auth,\n Storage,\n Streams,\n txInit,\n SidekickCoreDatabase,\n init as core_init,\n coerceQuery,\n getInfiniteQueryInitialSnapshot,\n SidekickSchemaDef,\n RoomsOf,\n SidekickError,\n ISidekickDatabase,\n} from '@sidekickdb/core';\n\nimport { createSignal, createEffect, onCleanup, createMemo } from 'solid-js';\nimport type { Accessor } from 'solid-js';\n\nimport { SidekickSolidRoom, rooms } from './SidekickSolidRoom.js';\nimport version from './version.js';\n\nconst defaultState = {\n isLoading: true,\n data: undefined,\n pageInfo: undefined,\n error: undefined,\n} as const;\n\nexport type InfiniteQueryState<\n Schema extends SidekickSchemaDef<any, any, any>,\n Q extends ValidQuery<Q, Schema>,\n UseDates extends boolean,\n> = {\n isLoading: boolean;\n error: { message: string } | undefined;\n data: SideQLResponse<Schema, Q, UseDates> | undefined;\n canLoadNextPage: boolean;\n loadNextPage: () => void;\n};\n\nconst defaultAuthState: AuthState = {\n isLoading: true,\n user: undefined,\n error: undefined,\n};\n\nfunction stateForResult(result: any) {\n return {\n isLoading: !Boolean(result),\n data: undefined,\n pageInfo: undefined,\n error: undefined,\n ...(result ? result : {}),\n };\n}\n\nexport class SidekickSolidDatabase<\n Schema extends SidekickSchemaDef<any, any, any>,\n UseDates extends boolean = false,\n Rooms extends RoomSchemaShape = RoomsOf<Schema>,\n> implements ISidekickDatabase<Schema>\n{\n public tx = txInit<Schema>();\n\n public auth: Auth;\n public storage: Storage;\n public streams: Streams;\n public core: SidekickCoreDatabase<Schema, UseDates>;\n\n constructor(core: SidekickCoreDatabase<Schema, UseDates>) {\n this.core = core;\n this.auth = this.core.auth;\n this.storage = this.core.storage;\n this.streams = this.core.streams;\n }\n\n /**\n * Returns a unique ID for a given `name`. It's stored in local storage,\n * so you will get the same ID across sessions.\n *\n * @example\n * const deviceId = await db.getLocalId('device');\n */\n getLocalId = (name: string): Promise<string> => {\n return this.core.getLocalId(name);\n };\n\n /**\n * Use this to write data! You can create, update, delete, and link objects\n *\n * @see https://sidekickdb.co/docs/sideml\n *\n * @example\n * const goalId = id();\n * db.transact(db.tx.goals[goalId].update({title: \"Get fit\"}))\n */\n transact = (\n chunks: TransactionChunk<any, any> | TransactionChunk<any, any>[],\n ) => {\n return this.core.transact(chunks);\n };\n\n /**\n * One time query for the logged in state.\n *\n * @see https://sidekickdb.co/docs/auth\n * @example\n * const user = await db.getAuth();\n * console.log('logged in as', user.email)\n */\n getAuth(): Promise<User | null> {\n return this.core.getAuth();\n }\n\n /**\n * Use this for one-off queries.\n * Returns local data if available, otherwise fetches from the server.\n *\n * @see https://sidekickdb.co/docs/sideql\n *\n * @example\n * const resp = await db.queryOnce({ goals: {} });\n * console.log(resp.data.goals)\n */\n queryOnce = <Q extends ValidQuery<Q, Schema>>(\n query: Q,\n opts?: SideQLOptions,\n ): Promise<{\n data: SideQLResponse<Schema, Q, UseDates>;\n pageInfo: PageInfoResponse<Q>;\n }> => {\n return this.core.queryOnce(query, opts);\n };\n\n // -----------\n // Solid reactive hooks\n\n /**\n * Use this to query your data!\n *\n * @see https://sidekickdb.co/docs/sideql\n *\n * @example\n * const state = db.useQuery({ goals: {} });\n * // state().isLoading, state().error, state().data\n */\n useQuery = <Q extends ValidQuery<Q, Schema>>(\n query: (() => null | Q) | null | Q,\n opts?: SideQLOptions,\n ): Accessor<SideQLLifecycleState<Schema, Q, UseDates>> => {\n const [state, setState] = createSignal<\n SideQLLifecycleState<Schema, Q, UseDates>\n >(defaultState as SideQLLifecycleState<Schema, Q, UseDates>);\n\n createEffect(() => {\n const resolvedQuery = typeof query === 'function' ? query() : query;\n\n if (!resolvedQuery) {\n setState(\n () => defaultState as SideQLLifecycleState<Schema, Q, UseDates>,\n );\n return;\n }\n\n let q = resolvedQuery;\n if (opts && 'ruleParams' in opts) {\n q = { $$ruleParams: (opts as any)['ruleParams'], ...q };\n }\n\n const coerced = coerceQuery(q);\n const prev = this.core._reactor.getPreviousResult(coerced);\n if (prev) {\n setState(\n () =>\n stateForResult(prev) as SideQLLifecycleState<Schema, Q, UseDates>,\n );\n }\n\n const unsub = this.core.subscribeQuery<Q, UseDates>(coerced, (result) => {\n setState(\n () =>\n Object.assign(\n {\n isLoading: false,\n data: undefined,\n pageInfo: undefined,\n error: undefined,\n },\n result,\n ) as SideQLLifecycleState<Schema, Q, UseDates>,\n );\n });\n\n onCleanup(unsub);\n });\n\n return state;\n };\n\n /**\n * Subscribe to a query and incrementally load more items.\n *\n * Only one top level namespace in the query is allowed.\n *\n * @see https://sidekickdb.co/docs/sideql\n *\n * @example\n * const state = db.useInfiniteQuery({\n * posts: {\n * $: {\n * limit: 20,\n * order: { createdAt: 'desc' },\n * },\n * },\n * });\n * // state().data, state().isLoading, state().error,\n * // state().canLoadNextPage, state().loadNextPage()\n */\n useInfiniteQuery = <Q extends ValidQuery<Q, Schema>>(\n query: (() => null | Q) | null | Q,\n opts?: SideQLOptions,\n ): Accessor<InfiniteQueryState<Schema, Q, UseDates>> => {\n let sub: InfiniteQuerySubscription | null = null;\n const loadNextPage = () => sub?.loadNextPage();\n\n const [state, setState] = createSignal<\n InfiniteQueryState<Schema, Q, UseDates>\n >({\n isLoading: true,\n error: undefined,\n data: undefined,\n canLoadNextPage: false,\n loadNextPage,\n });\n\n createEffect(() => {\n const resolvedQuery = typeof query === 'function' ? query() : query;\n\n if (!resolvedQuery) {\n sub = null;\n setState(() => ({\n isLoading: true,\n error: undefined,\n data: undefined,\n canLoadNextPage: false,\n loadNextPage,\n }));\n return;\n }\n\n const snapshot = getInfiniteQueryInitialSnapshot<Schema, Q, UseDates>(\n this.core,\n resolvedQuery,\n opts,\n );\n setState(() => ({\n ...snapshot,\n isLoading: !snapshot.data && !snapshot.error,\n loadNextPage,\n }));\n\n sub = this.core.subscribeInfiniteQuery<Q>(\n resolvedQuery,\n (resp) => {\n setState(() => ({\n ...resp,\n isLoading: false,\n loadNextPage,\n }));\n },\n opts,\n );\n\n onCleanup(() => {\n sub?.unsubscribe();\n sub = null;\n });\n });\n\n return state;\n };\n\n /**\n * Listen for the logged in state. This is useful\n * for deciding when to show a login screen.\n *\n * @see https://sidekickdb.co/docs/auth\n * @example\n * function App() {\n * const auth = db.useAuth();\n * // auth().isLoading, auth().user, auth().error\n * }\n */\n useAuth = (): Accessor<AuthState> => {\n const [state, setState] = createSignal<AuthState>(\n this.core._reactor._currentUserCached ?? defaultAuthState,\n );\n\n createEffect(() => {\n const unsub = this.core.subscribeAuth((auth) => {\n setState({ isLoading: false, ...auth });\n });\n\n onCleanup(unsub);\n });\n\n return state;\n };\n\n /**\n * Subscribe to the currently logged in user.\n * If the user is not logged in, this will throw an Error.\n *\n * @see https://sidekickdb.co/docs/auth\n * @example\n * function UserDisplay() {\n * const user = db.useUser();\n * return <div>Logged in as: {user().email}</div>\n * }\n */\n useUser = (): Accessor<User> => {\n const auth = this.useAuth();\n return createMemo(() => {\n const { user } = auth();\n if (!user) {\n throw new SidekickError(\n 'useUser must be used within an auth-protected route',\n );\n }\n return user;\n });\n };\n\n /**\n * Listen for connection status changes to SidekickDB.\n *\n * @see https://sidekickdb.co/docs/patterns#listen-to-sidekick-db-connection-status\n * @example\n * function App() {\n * const status = db.useConnectionStatus();\n * return <div>Connection state: {status()}</div>\n * }\n */\n useConnectionStatus = (): Accessor<ConnectionStatus> => {\n const [status, setStatus] = createSignal<ConnectionStatus>(\n this.core._reactor.status as ConnectionStatus,\n );\n\n createEffect(() => {\n const unsub = this.core.subscribeConnectionStatus((newStatus) => {\n setStatus(() => newStatus);\n });\n\n onCleanup(unsub);\n });\n\n return status;\n };\n\n /**\n * A hook that returns a unique ID for a given `name`. localIds are\n * stored in local storage, so you will get the same ID across sessions.\n *\n * Initially returns `null`, and then loads the localId.\n *\n * @example\n * const deviceId = db.useLocalId('device');\n * // deviceId() is null initially, then the ID string\n */\n useLocalId = (name: string): Accessor<string | null> => {\n const [localId, setLocalId] = createSignal<string | null>(null);\n\n createEffect(() => {\n let mounted = true;\n this.getLocalId(name).then((id) => {\n if (mounted) {\n setLocalId(() => id);\n }\n });\n onCleanup(() => {\n mounted = false;\n });\n });\n\n return localId;\n };\n\n /**\n * Obtain a handle to a room, which allows you to listen to topics and presence data\n *\n * @see https://sidekickdb.co/docs/presence-and-topics\n *\n * @example\n * const room = db.room('chat', roomId);\n * const presence = db.rooms.usePresence(room);\n */\n room<RoomType extends keyof Rooms>(\n type: RoomType = '_defaultRoomType' as RoomType,\n id: string = '_defaultRoomId',\n ) {\n return new SidekickSolidRoom<Schema, Rooms, RoomType>(this.core, type, id);\n }\n\n /**\n * Hooks for working with rooms\n *\n * @see https://sidekickdb.co/docs/presence-and-topics\n *\n * @example\n * const room = db.room('chat', roomId);\n * const presence = db.rooms.usePresence(room);\n * const publish = db.rooms.usePublishTopic(room, 'emoji');\n */\n rooms = rooms;\n}\n\n// -----------\n// init\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/solidjs\"\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/solidjs\"\n * import schema from \"../sidekick.schema.ts\";\n *\n * const db = init({ appId: \"my-app-id\", apiURI: \"https://sidekick.example.com\", schema })\n */\nexport function init<\n Schema extends SidekickSchemaDef<any, any, any>,\n UseDates extends boolean = false,\n>(\n config: Omit<SidekickConfig<Schema, UseDates>, 'useDateObjects'> & {\n useDateObjects?: UseDates;\n },\n): SidekickSolidDatabase<Schema, UseDates> {\n const coreDb = core_init<Schema, UseDates>(config, undefined, undefined, {\n '@sidekickdb/solidjs': version,\n });\n return new SidekickSolidDatabase<Schema, UseDates>(coreDb);\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PresenceOpts, type PresenceResponse, type RoomSchemaShape,
|
|
1
|
+
import { type PresenceOpts, type PresenceResponse, type RoomSchemaShape, SidekickCoreDatabase, SidekickSchemaDef } from '@sidekickdb/core';
|
|
2
2
|
import type { Accessor } from 'solid-js';
|
|
3
3
|
export type PresenceHandle<PresenceShape, Keys extends keyof PresenceShape> = PresenceResponse<PresenceShape, Keys> & {
|
|
4
4
|
publishPresence: (data: Partial<PresenceShape>) => void;
|
|
@@ -30,7 +30,7 @@ export declare const defaultActivityStopTimeout = 1000;
|
|
|
30
30
|
* // ...
|
|
31
31
|
* }
|
|
32
32
|
*/
|
|
33
|
-
export declare function useTopicEffect<RoomSchema extends RoomSchemaShape, RoomType extends keyof RoomSchema, TopicType extends keyof RoomSchema[RoomType]['topics']>(room:
|
|
33
|
+
export declare function useTopicEffect<RoomSchema extends RoomSchemaShape, RoomType extends keyof RoomSchema, TopicType extends keyof RoomSchema[RoomType]['topics']>(room: SidekickSolidRoom<any, RoomSchema, RoomType>, topic: TopicType, onEvent: (event: RoomSchema[RoomType]['topics'][TopicType], peer: RoomSchema[RoomType]['presence']) => any): void;
|
|
34
34
|
/**
|
|
35
35
|
* Broadcast an event to a room.
|
|
36
36
|
*
|
|
@@ -46,7 +46,7 @@ export declare function useTopicEffect<RoomSchema extends RoomSchemaShape, RoomT
|
|
|
46
46
|
* }
|
|
47
47
|
*
|
|
48
48
|
*/
|
|
49
|
-
export declare function usePublishTopic<RoomSchema extends RoomSchemaShape, RoomType extends keyof RoomSchema, TopicType extends keyof RoomSchema[RoomType]['topics']>(room:
|
|
49
|
+
export declare function usePublishTopic<RoomSchema extends RoomSchemaShape, RoomType extends keyof RoomSchema, TopicType extends keyof RoomSchema[RoomType]['topics']>(room: SidekickSolidRoom<any, RoomSchema, RoomType>, topic: TopicType): (data: RoomSchema[RoomType]['topics'][TopicType]) => void;
|
|
50
50
|
/**
|
|
51
51
|
* Listen for peer's presence data in a room, and publish the current user's presence.
|
|
52
52
|
*
|
|
@@ -57,7 +57,7 @@ export declare function usePublishTopic<RoomSchema extends RoomSchemaShape, Room
|
|
|
57
57
|
* // presence().peers, presence().isLoading, presence().publishPresence
|
|
58
58
|
* }
|
|
59
59
|
*/
|
|
60
|
-
export declare function usePresence<RoomSchema extends RoomSchemaShape, RoomType extends keyof RoomSchema, Keys extends keyof RoomSchema[RoomType]['presence']>(room:
|
|
60
|
+
export declare function usePresence<RoomSchema extends RoomSchemaShape, RoomType extends keyof RoomSchema, Keys extends keyof RoomSchema[RoomType]['presence']>(room: SidekickSolidRoom<any, RoomSchema, RoomType>, opts?: PresenceOpts<RoomSchema[RoomType]['presence'], Keys>): Accessor<PresenceHandle<RoomSchema[RoomType]['presence'], Keys>>;
|
|
61
61
|
/**
|
|
62
62
|
* Publishes presence data to a room
|
|
63
63
|
*
|
|
@@ -68,7 +68,7 @@ export declare function usePresence<RoomSchema extends RoomSchemaShape, RoomType
|
|
|
68
68
|
* db.rooms.useSyncPresence(room, { nickname });
|
|
69
69
|
* }
|
|
70
70
|
*/
|
|
71
|
-
export declare function useSyncPresence<RoomSchema extends RoomSchemaShape, RoomType extends keyof RoomSchema>(room:
|
|
71
|
+
export declare function useSyncPresence<RoomSchema extends RoomSchemaShape, RoomType extends keyof RoomSchema>(room: SidekickSolidRoom<any, RoomSchema, RoomType>, data: Partial<RoomSchema[RoomType]['presence']>, deps?: any[]): void;
|
|
72
72
|
/**
|
|
73
73
|
* Manage typing indicator state
|
|
74
74
|
*
|
|
@@ -80,7 +80,7 @@ export declare function useSyncPresence<RoomSchema extends RoomSchemaShape, Room
|
|
|
80
80
|
* // typing.active(), typing.setActive(bool), typing.inputProps
|
|
81
81
|
* }
|
|
82
82
|
*/
|
|
83
|
-
export declare function useTypingIndicator<RoomSchema extends RoomSchemaShape, RoomType extends keyof RoomSchema>(room:
|
|
83
|
+
export declare function useTypingIndicator<RoomSchema extends RoomSchemaShape, RoomType extends keyof RoomSchema>(room: SidekickSolidRoom<any, RoomSchema, RoomType>, inputName: string, opts?: TypingIndicatorOpts): TypingIndicatorHandle<RoomSchema[RoomType]['presence']>;
|
|
84
84
|
export declare const rooms: {
|
|
85
85
|
useTopicEffect: typeof useTopicEffect;
|
|
86
86
|
usePublishTopic: typeof usePublishTopic;
|
|
@@ -88,10 +88,10 @@ export declare const rooms: {
|
|
|
88
88
|
useSyncPresence: typeof useSyncPresence;
|
|
89
89
|
useTypingIndicator: typeof useTypingIndicator;
|
|
90
90
|
};
|
|
91
|
-
export declare class
|
|
92
|
-
core:
|
|
91
|
+
export declare class SidekickSolidRoom<Schema extends SidekickSchemaDef<any, any, any>, RoomSchema extends RoomSchemaShape, RoomType extends keyof RoomSchema> {
|
|
92
|
+
core: SidekickCoreDatabase<Schema, boolean>;
|
|
93
93
|
type: RoomType;
|
|
94
94
|
id: string;
|
|
95
|
-
constructor(core:
|
|
95
|
+
constructor(core: SidekickCoreDatabase<Schema, boolean>, type: RoomType, id: string);
|
|
96
96
|
}
|
|
97
|
-
//# sourceMappingURL=
|
|
97
|
+
//# sourceMappingURL=SidekickSolidRoom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidekickSolidRoom.d.ts","sourceRoot":"","sources":["../../src/Sid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CAmBN;AAKD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,SAAS,eAAe,EAClC,QAAQ,SAAS,MAAM,UAAU,EAEjC,IAAI,EAAE,iBAAiB,CAAC,GAAG,EAAE,UAAU,EAAE,QAAQ,CAAC,EAClD,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE,mBAAwB,GAC7B,qBAAqB,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,CAAC,CAgEzD;AAKD,eAAO,MAAM,KAAK;;;;;;CAMjB,CAAC;AAKF,qBAAa,iBAAiB,CAC5B,MAAM,SAAS,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC/C,UAAU,SAAS,eAAe,EAClC,QAAQ,SAAS,MAAM,UAAU;IAEjC,IAAI,EAAE,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,IAAI,EAAE,QAAQ,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;gBAGT,IAAI,EAAE,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3C,IAAI,EAAE,QAAQ,EACd,EAAE,EAAE,MAAM;CAMb"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SidekickSolidRoom = exports.rooms = exports.defaultActivityStopTimeout = void 0;
|
|
4
4
|
exports.useTopicEffect = useTopicEffect;
|
|
5
5
|
exports.usePublishTopic = usePublishTopic;
|
|
6
6
|
exports.usePresence = usePresence;
|
|
@@ -195,7 +195,7 @@ exports.rooms = {
|
|
|
195
195
|
};
|
|
196
196
|
// ------------
|
|
197
197
|
// Class
|
|
198
|
-
class
|
|
198
|
+
class SidekickSolidRoom {
|
|
199
199
|
core;
|
|
200
200
|
type;
|
|
201
201
|
id;
|
|
@@ -205,5 +205,5 @@ class InstantSolidRoom {
|
|
|
205
205
|
this.id = id;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
exports.
|
|
209
|
-
//# sourceMappingURL=
|
|
208
|
+
exports.SidekickSolidRoom = SidekickSolidRoom;
|
|
209
|
+
//# sourceMappingURL=SidekickSolidRoom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidekickSolidRoom.js","sourceRoot":"","sources":["../../src/SidekickSolidRoom.ts"],"names":[],"mappings":";;;AAuDA,wCAwBC;AAiBD,0CAqBC;AAeD,kCAsCC;AAYD,0CA0BC;AAgBD,gDAuEC;AA/RD,uCAA6E;AA6BhE,QAAA,0BAA0B,GAAG,KAAK,CAAC;AAEhD,SAAS;AACT,SAAS;AAET;;;;;;;;;;;;GAYG;AACH,SAAgB,cAAc,CAK5B,IAAkD,EAClD,KAAgB,EAChB,OAGQ;IAER,IAAA,uBAAY,EAAC,GAAG,EAAE;QAChB,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAC7C,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,EAAE,EACP,KAAK,EACL,CAAC,KAAU,EAAE,IAAS,EAAE,EAAE;YACxB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACvB,CAAC,CACF,CAAC;QAEF,IAAA,oBAAS,EAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,eAAe,CAK7B,IAAkD,EAClD,KAAgB;IAEhB,IAAA,uBAAY,EAAC,GAAG,EAAE;QAChB,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAc,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QACxE,IAAA,oBAAS,EAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,IAA+C,EAAE,EAAE;QACzD,I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;QAC3D,SAAS,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,CAAC,CAAgB,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,IAAI,EAAE,WAAW,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,CAAC;QACvD,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC;QAC1B,SAAS,CAAC,QAAQ,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,SAAS,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO;QACL,MAAM;QACN,SAAS;QACT,UAAU,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE;KAClC,CAAC;AACJ,CAAC;AAED,iBAAiB;AACjB,kBAAkB;AAEL,QAAA,KAAK,GAAG;IACnB,cAAc;IACd,eAAe;IACf,WAAW;IACX,eAAe;IACf,kBAAkB;CACnB,CAAC;AAEF,eAAe;AACf,QAAQ;AAER,MAAa,iBAAiB;IAK5B,IAAI,CAAwC;IAC5C,IAAI,CAAW;IACf,EAAE,CAAS;IAEX,YACE,IAA2C,EAC3C,IAAc,EACd,EAAU;QAEV,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;CACF;AAlBD,8CAkBC","sourcesContent":["import {\n type PresenceOpts,\n type PresenceResponse,\n type RoomSchemaShape,\n SidekickCoreDatabase,\n SidekickSchemaDef,\n} from '@sidekickdb/core';\n\nimport { createSignal, createEffect, onCleanup, createMemo } from 'solid-js';\nimport type { Accessor } from 'solid-js';\n\n// ------\n// Types\n\nexport type PresenceHandle<\n PresenceShape,\n Keys extends keyof PresenceShape,\n> = PresenceResponse<PresenceShape, Keys> & {\n publishPresence: (data: Partial<PresenceShape>) => void;\n};\n\nexport type TypingIndicatorOpts = {\n timeout?: number | null;\n stopOnEnter?: boolean;\n // Perf opt - `active` will always be an empty array\n writeOnly?: boolean;\n};\n\nexport type TypingIndicatorHandle<PresenceShape> = {\n active: Accessor<PresenceShape[]>;\n setActive(active: boolean): void;\n inputProps: {\n onKeyDown: (e: KeyboardEvent) => void;\n onBlur: () => void;\n };\n};\n\nexport const defaultActivityStopTimeout = 1_000;\n\n// ------\n// Topics\n\n/**\n * Listen for broadcasted events given a room and topic.\n *\n * @see https://sidekickdb.co/docs/presence-and-topics\n * @example\n * function App({ roomId }) {\n * const room = db.room('chats', roomId);\n * db.rooms.useTopicEffect(room, 'emoji', (message, peer) => {\n * console.log(peer.name, 'sent', message);\n * });\n * // ...\n * }\n */\nexport function useTopicEffect<\n RoomSchema extends RoomSchemaShape,\n RoomType extends keyof RoomSchema,\n TopicType extends keyof RoomSchema[RoomType]['topics'],\n>(\n room: SidekickSolidRoom<any, RoomSchema, RoomType>,\n topic: TopicType,\n onEvent: (\n event: RoomSchema[RoomType]['topics'][TopicType],\n peer: RoomSchema[RoomType]['presence'],\n ) => any,\n): void {\n createEffect(() => {\n const unsub = room.core._reactor.subscribeTopic(\n room.type,\n room.id,\n topic,\n (event: any, peer: any) => {\n onEvent(event, peer);\n },\n );\n\n onCleanup(unsub);\n });\n}\n\n/**\n * Broadcast an event to a room.\n *\n * @see https://sidekickdb.co/docs/presence-and-topics\n * @example\n * function App({ roomId }) {\n * const room = db.room('chat', roomId);\n * const publishTopic = db.rooms.usePublishTopic(room, \"emoji\");\n *\n * return (\n * <button onClick={() => publishTopic({ emoji: \"🔥\" })}>Send emoji</button>\n * );\n * }\n *\n */\nexport function usePublishTopic<\n RoomSchema extends RoomSchemaShape,\n RoomType extends keyof RoomSchema,\n TopicType extends keyof RoomSchema[RoomType]['topics'],\n>(\n room: SidekickSolidRoom<any, RoomSchema, RoomType>,\n topic: TopicType,\n): (data: RoomSchema[RoomType]['topics'][TopicType]) => void {\n createEffect(() => {\n const unsub = room.core._reactor.joinRoom(room.type as string, room.id);\n onCleanup(unsub);\n });\n\n return (data: RoomSchema[RoomType]['topics'][TopicType]) => {\n room.core._reactor.publishTopic({\n roomType: room.type,\n roomId: room.id,\n topic,\n data,\n });\n };\n}\n\n// ---------\n// Presence\n\n/**\n * Listen for peer's presence data in a room, and publish the current user's presence.\n *\n * @see https://sidekickdb.co/docs/presence-and-topics\n * @example\n * function App({ roomId }) {\n * const presence = db.rooms.usePresence(room, { keys: [\"name\", \"avatar\"] });\n * // presence().peers, presence().isLoading, presence().publishPresence\n * }\n */\nexport function usePresence<\n RoomSchema extends RoomSchemaShape,\n RoomType extends keyof RoomSchema,\n Keys extends keyof RoomSchema[RoomType]['presence'],\n>(\n room: SidekickSolidRoom<any, RoomSchema, RoomType>,\n opts: PresenceOpts<RoomSchema[RoomType]['presence'], Keys> = {},\n): Accessor<PresenceHandle<RoomSchema[RoomType]['presence'], Keys>> {\n const [state, setState] = createSignal<\n PresenceResponse<RoomSchema[RoomType]['presence'], Keys>\n >(\n (room.core._reactor.getPresence(room.type, room.id, opts) ?? {\n peers: {},\n isLoading: true,\n }) as PresenceResponse<RoomSchema[RoomType]['presence'], Keys>,\n );\n\n createEffect(() => {\n const unsub = room.core._reactor.subscribePresence(\n room.type,\n room.id,\n opts,\n (data: any) => {\n setState(data);\n },\n );\n\n onCleanup(unsub);\n });\n\n const publishPresence = (data: Partial<RoomSchema[RoomType]['presence']>) => {\n room.core._reactor.publishPresence(room.type, room.id, data);\n };\n\n return createMemo(() => ({\n ...state(),\n publishPresence,\n }));\n}\n\n/**\n * Publishes presence data to a room\n *\n * @see https://sidekickdb.co/docs/presence-and-topics\n * @example\n * function App({ roomId, nickname }) {\n * const room = db.room('chat', roomId);\n * db.rooms.useSyncPresence(room, { nickname });\n * }\n */\nexport function useSyncPresence<\n RoomSchema extends RoomSchemaShape,\n RoomType extends keyof RoomSchema,\n>(\n room: SidekickSolidRoom<any, RoomSchema, RoomType>,\n data: Partial<RoomSchema[RoomType]['presence']>,\n deps?: any[],\n): void {\n createEffect(() => {\n const unsub = room.core._reactor.joinRoom(\n room.type as string,\n room.id,\n data,\n );\n onCleanup(unsub);\n });\n\n createEffect(() => {\n // Track deps if provided, otherwise track serialized data\n if (deps) {\n deps.forEach((d) => (typeof d === 'function' ? d() : d));\n } else {\n JSON.stringify(data);\n }\n room.core._reactor.publishPresence(room.type, room.id, data);\n });\n}\n\n// -----------------\n// Typing Indicator\n\n/**\n * Manage typing indicator state\n *\n * @see https://sidekickdb.co/docs/presence-and-topics\n * @example\n * function App({ roomId }) {\n * const room = db.room('chat', roomId);\n * const typing = db.rooms.useTypingIndicator(room, \"chat-input\");\n * // typing.active(), typing.setActive(bool), typing.inputProps\n * }\n */\nexport function useTypingIndicator<\n RoomSchema extends RoomSchemaShape,\n RoomType extends keyof RoomSchema,\n>(\n room: SidekickSolidRoom<any, RoomSchema, RoomType>,\n inputName: string,\n opts: TypingIndicatorOpts = {},\n): TypingIndicatorHandle<RoomSchema[RoomType]['presence']> {\n let timeoutId: ReturnType<typeof setTimeout> | null = null;\n\n const presence = rooms.usePresence(room, {\n keys: [inputName] as (keyof RoomSchema[RoomType]['presence'])[],\n });\n\n const active = createMemo(() => {\n if (opts?.writeOnly) return [];\n // Access presence to track it\n presence();\n const presenceSnapshot = room.core._reactor.getPresence(room.type, room.id);\n return Object.values(presenceSnapshot?.peers ?? {}).filter(\n (p: any) => p[inputName] === true,\n );\n });\n\n const setActive = (isActive: boolean) => {\n room.core._reactor.publishPresence(room.type, room.id, {\n [inputName]: isActive ? true : null,\n } as Partial<RoomSchema[RoomType]['presence']>);\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n\n if (!isActive) return;\n\n if (opts?.timeout === null || opts?.timeout === 0) return;\n\n timeoutId = setTimeout(() => {\n room.core._reactor.publishPresence(room.type, room.id, {\n [inputName]: null,\n } as Partial<RoomSchema[RoomType]['presence']>);\n }, opts?.timeout ?? defaultActivityStopTimeout);\n };\n\n onCleanup(() => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n\n // Ensure we don't leave a sticky typing state behind on unmount,\n // even when opts.timeout is null/0 (i.e. no auto-timeout).\n setActive(false);\n });\n\n const onKeyDown = (e: KeyboardEvent) => {\n const isEnter = opts?.stopOnEnter && e.key === 'Enter';\n const isActive = !isEnter;\n setActive(isActive);\n };\n\n const onBlur = () => {\n setActive(false);\n };\n\n return {\n active,\n setActive,\n inputProps: { onKeyDown, onBlur },\n };\n}\n\n// --------------\n// Hooks namespace\n\nexport const rooms = {\n useTopicEffect,\n usePublishTopic,\n usePresence,\n useSyncPresence,\n useTypingIndicator,\n};\n\n// ------------\n// Class\n\nexport class SidekickSolidRoom<\n Schema extends SidekickSchemaDef<any, any, any>,\n RoomSchema extends RoomSchemaShape,\n RoomType extends keyof RoomSchema,\n> {\n core: SidekickCoreDatabase<Schema, boolean>;\n type: RoomType;\n id: string;\n\n constructor(\n core: SidekickCoreDatabase<Schema, boolean>,\n type: RoomType,\n id: string,\n ) {\n this.core = core;\n this.type = type;\n this.id = id;\n }\n}\n"]}
|
package/dist/commonjs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { id, tx, lookup, i,
|
|
2
|
-
import {
|
|
3
|
-
import { init } from './
|
|
4
|
-
import {
|
|
5
|
-
export { id, tx, lookup, init,
|
|
1
|
+
import { id, tx, lookup, i, SidekickAPIError, SyncTableCallbackEventType, type QueryResponse, type SidekickQuery, type SidekickQueryResult, type SidekickSchema, type SidekickObject, type SidekickEntity, type SidekickSchemaDatabase, type SidekickUnknownSchemaDef, type ISidekickDatabase, type User, type AuthState, type Query, type Config, type SideQLParams, type ConnectionStatus, type ValidQuery, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type SidekickGraph, type SidekickConfig, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type SideQLEntity, type SideQLFields, type SideQLResult, type SideQLEntitySubquery, type RoomsOf, type RoomsDef, type PresenceOf, type TopicsOf, type TopicOf, type RoomHandle, type TransactionChunk, type SidekickUnknownSchema, type SidekickSchemaDef, type BackwardsCompatibleSchema, type SidekickRules, type UpdateParams, type LinkParams, type CreateParams, 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, createSidekickRouteHandler, type SidekickRouteHandlerPayloadByType, type SidekickRouteHandlerType, type SidekickRouteHandlerBody, type StoreInterfaceStoreName, type Logger } from '@sidekickdb/core';
|
|
2
|
+
import { SidekickSolidDatabase } from './SidekickSolidDatabase.js';
|
|
3
|
+
import { init } from './SidekickSolidDatabase.js';
|
|
4
|
+
import { SidekickSolidRoom } from './SidekickSolidRoom.js';
|
|
5
|
+
export { id, tx, lookup, init, SidekickSolidDatabase, SidekickSolidRoom, i, SidekickAPIError, SyncTableCallbackEventType, type Config, type SidekickConfig, type SidekickUnknownSchemaDef, type Query, type QueryResponse, type SidekickObject, type User, type AuthState, type ConnectionStatus, type SidekickQuery, type SidekickQueryResult, type SidekickSchema, type SidekickEntity, type SidekickSchemaDatabase, type ISidekickDatabase, type SideQLParams, type ValidQuery, type SideQLFields, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type SidekickGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type SideQLEntity, type SideQLResult, type SideQLEntitySubquery, type RoomsOf, type RoomsDef, type TransactionChunk, type PresenceOf, type TopicsOf, type TopicOf, type RoomHandle, type SidekickUnknownSchema, type SidekickSchemaDef, type BackwardsCompatibleSchema, type SidekickRules, type UpdateParams, type LinkParams, type CreateParams, type CheckMagicCodeParams, type CheckMagicCodeResponse, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, StoreInterface, type StoreInterfaceStoreName, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, createSidekickRouteHandler, type SidekickRouteHandlerPayloadByType, type SidekickRouteHandlerType, type SidekickRouteHandlerBody, type Logger, };
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,EAAE,EACF,EAAE,EACF,MAAM,EACN,CAAC,EAGD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,EAAE,EACF,EAAE,EACF,MAAM,EACN,CAAC,EAGD,gBAAgB,EAGhB,0BAA0B,EAG1B,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAGf,KAAK,YAAY,EAGjB,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,SAAS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AsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EAGxB,0BAA0B,EAC1B,KAAK,iCAAiC,EACtC,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAG7B,KAAK,MAAM,GACZ,CAAC"}
|
package/dist/commonjs/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createSidekickRouteHandler = exports.StoreInterface = exports.SyncTableCallbackEventType = exports.SidekickAPIError = exports.i = exports.SidekickSolidRoom = exports.SidekickSolidDatabase = exports.init = exports.lookup = exports.tx = exports.id = void 0;
|
|
4
4
|
const core_1 = require("@sidekickdb/core");
|
|
5
5
|
Object.defineProperty(exports, "id", { enumerable: true, get: function () { return core_1.id; } });
|
|
6
6
|
Object.defineProperty(exports, "tx", { enumerable: true, get: function () { return core_1.tx; } });
|
|
7
7
|
Object.defineProperty(exports, "lookup", { enumerable: true, get: function () { return core_1.lookup; } });
|
|
8
8
|
Object.defineProperty(exports, "i", { enumerable: true, get: function () { return core_1.i; } });
|
|
9
|
-
Object.defineProperty(exports, "
|
|
9
|
+
Object.defineProperty(exports, "SidekickAPIError", { enumerable: true, get: function () { return
|
|
10
10
|
// error
|
|
11
|
-
core_1.
|
|
11
|
+
core_1.SidekickAPIError; } });
|
|
12
12
|
Object.defineProperty(exports, "SyncTableCallbackEventType", { enumerable: true, get: function () { return
|
|
13
13
|
// sync table enums
|
|
14
14
|
core_1.SyncTableCallbackEventType; } });
|
|
15
15
|
Object.defineProperty(exports, "StoreInterface", { enumerable: true, get: function () { return core_1.StoreInterface; } });
|
|
16
|
-
Object.defineProperty(exports, "
|
|
17
|
-
const
|
|
18
|
-
Object.defineProperty(exports, "
|
|
19
|
-
const
|
|
20
|
-
Object.defineProperty(exports, "init", { enumerable: true, get: function () { return
|
|
21
|
-
const
|
|
22
|
-
Object.defineProperty(exports, "
|
|
16
|
+
Object.defineProperty(exports, "createSidekickRouteHandler", { enumerable: true, get: function () { return core_1.createSidekickRouteHandler; } });
|
|
17
|
+
const SidekickSolidDatabase_js_1 = require("./SidekickSolidDatabase.js");
|
|
18
|
+
Object.defineProperty(exports, "SidekickSolidDatabase", { enumerable: true, get: function () { return SidekickSolidDatabase_js_1.SidekickSolidDatabase; } });
|
|
19
|
+
const SidekickSolidDatabase_js_2 = require("./SidekickSolidDatabase.js");
|
|
20
|
+
Object.defineProperty(exports, "init", { enumerable: true, get: function () { return SidekickSolidDatabase_js_2.init; } });
|
|
21
|
+
const SidekickSolidRoom_js_1 = require("./SidekickSolidRoom.js");
|
|
22
|
+
Object.defineProperty(exports, "SidekickSolidRoom", { enumerable: true, get: function () { return SidekickSolidRoom_js_1.SidekickSolidRoom; } });
|
|
23
23
|
//# sourceMappingURL=index.js.map
|