@instantdb/core
Advanced tools
Comparing version 0.10.3 to 0.10.4
import { QueryResponse } from "./queryTypes"; | ||
export type User = { | ||
export declare type User = { | ||
id: string; | ||
@@ -7,3 +7,3 @@ email: string; | ||
}; | ||
export type AuthState = { | ||
export declare type AuthState = { | ||
isLoading: true; | ||
@@ -26,3 +26,3 @@ error: undefined; | ||
*/ | ||
export type QueryState<Q, Schema = {}> = { | ||
export declare type QueryState<Q, Schema = {}> = { | ||
isLoading: true; | ||
@@ -29,0 +29,0 @@ error: undefined; |
@@ -10,3 +10,3 @@ import Reactor from "./Reactor"; | ||
import { PresenceOpts, PresenceResponse, PresenceSlice, RoomSchemaShape } from "./presence"; | ||
export type Config = { | ||
export declare type Config = { | ||
appId: string; | ||
@@ -16,7 +16,7 @@ websocketURI?: string; | ||
}; | ||
export type TransactionResult = { | ||
export declare type TransactionResult = { | ||
status: "synced" | "enqueued"; | ||
clientId: string; | ||
}; | ||
export type RoomHandle<PresenceShape, TopicsByKey> = { | ||
export declare type RoomHandle<PresenceShape, TopicsByKey> = { | ||
leaveRoom: () => void; | ||
@@ -29,4 +29,4 @@ publishTopic: <Key extends keyof TopicsByKey>(topic: Key, data: TopicsByKey[Key]) => void; | ||
}; | ||
type AuthToken = string; | ||
type SubscriptionState<Q, Schema> = { | ||
declare type AuthToken = string; | ||
declare type SubscriptionState<Q, Schema> = { | ||
error: { | ||
@@ -40,3 +40,3 @@ message: string; | ||
}; | ||
type LifecycleSubscriptionState<Q, Schema> = SubscriptionState<Q, Schema> & { | ||
declare type LifecycleSubscriptionState<Q, Schema> = SubscriptionState<Q, Schema> & { | ||
isLoading: boolean; | ||
@@ -43,0 +43,0 @@ }; |
@@ -1,6 +0,6 @@ | ||
type Action = "update" | "link" | "unlink" | "delete"; | ||
type EType = string; | ||
type Id = string; | ||
type Args = any; | ||
export type Op = [Action, EType, Id, Args]; | ||
declare type Action = "update" | "link" | "unlink" | "delete"; | ||
declare type EType = string; | ||
declare type Id = string; | ||
declare type Args = any; | ||
export declare type Op = [Action, EType, Id, Args]; | ||
export interface TransactionChunk { | ||
@@ -7,0 +7,0 @@ __ops: Op[]; |
import { QueryResponse } from "./queryTypes"; | ||
export type User = { | ||
export declare type User = { | ||
id: string; | ||
@@ -7,3 +7,3 @@ email: string; | ||
}; | ||
export type AuthState = { | ||
export declare type AuthState = { | ||
isLoading: true; | ||
@@ -26,3 +26,3 @@ error: undefined; | ||
*/ | ||
export type QueryState<Q, Schema = {}> = { | ||
export declare type QueryState<Q, Schema = {}> = { | ||
isLoading: true; | ||
@@ -29,0 +29,0 @@ error: undefined; |
@@ -10,3 +10,3 @@ import Reactor from "./Reactor"; | ||
import { PresenceOpts, PresenceResponse, PresenceSlice, RoomSchemaShape } from "./presence"; | ||
export type Config = { | ||
export declare type Config = { | ||
appId: string; | ||
@@ -16,7 +16,7 @@ websocketURI?: string; | ||
}; | ||
export type TransactionResult = { | ||
export declare type TransactionResult = { | ||
status: "synced" | "enqueued"; | ||
clientId: string; | ||
}; | ||
export type RoomHandle<PresenceShape, TopicsByKey> = { | ||
export declare type RoomHandle<PresenceShape, TopicsByKey> = { | ||
leaveRoom: () => void; | ||
@@ -29,4 +29,4 @@ publishTopic: <Key extends keyof TopicsByKey>(topic: Key, data: TopicsByKey[Key]) => void; | ||
}; | ||
type AuthToken = string; | ||
type SubscriptionState<Q, Schema> = { | ||
declare type AuthToken = string; | ||
declare type SubscriptionState<Q, Schema> = { | ||
error: { | ||
@@ -40,3 +40,3 @@ message: string; | ||
}; | ||
type LifecycleSubscriptionState<Q, Schema> = SubscriptionState<Q, Schema> & { | ||
declare type LifecycleSubscriptionState<Q, Schema> = SubscriptionState<Q, Schema> & { | ||
isLoading: boolean; | ||
@@ -43,0 +43,0 @@ }; |
@@ -1,6 +0,6 @@ | ||
type Action = "update" | "link" | "unlink" | "delete"; | ||
type EType = string; | ||
type Id = string; | ||
type Args = any; | ||
export type Op = [Action, EType, Id, Args]; | ||
declare type Action = "update" | "link" | "unlink" | "delete"; | ||
declare type EType = string; | ||
declare type Id = string; | ||
declare type Args = any; | ||
export declare type Op = [Action, EType, Id, Args]; | ||
export interface TransactionChunk { | ||
@@ -7,0 +7,0 @@ __ops: Op[]; |
@@ -1,2 +0,2 @@ | ||
export type RoomSchemaShape = { | ||
export declare type RoomSchemaShape = { | ||
[k: string]: { | ||
@@ -13,3 +13,3 @@ presence?: { | ||
}; | ||
export type PresenceOpts<PresenceShape, Keys extends keyof PresenceShape> = { | ||
export declare type PresenceOpts<PresenceShape, Keys extends keyof PresenceShape> = { | ||
user?: boolean; | ||
@@ -19,3 +19,3 @@ peers?: string[]; | ||
}; | ||
export type PresenceSlice<PresenceShape, Keys extends keyof PresenceShape> = { | ||
export declare type PresenceSlice<PresenceShape, Keys extends keyof PresenceShape> = { | ||
user?: Pick<PresenceShape, Keys>; | ||
@@ -26,3 +26,3 @@ peers: { | ||
}; | ||
export type PresenceResponse<PresenceShape, Keys extends keyof PresenceShape> = PresenceSlice<PresenceShape, Keys> & { | ||
export declare type PresenceResponse<PresenceShape, Keys extends keyof PresenceShape> = PresenceSlice<PresenceShape, Keys> & { | ||
isLoading: boolean; | ||
@@ -29,0 +29,0 @@ error?: string; |
@@ -1,5 +0,5 @@ | ||
type WhereClause = { | ||
declare type WhereClause = { | ||
[key: string]: string | number | boolean; | ||
}; | ||
type $Option = { | ||
declare type $Option = { | ||
$?: { | ||
@@ -9,24 +9,24 @@ where: WhereClause; | ||
}; | ||
type Subquery = { | ||
declare type Subquery = { | ||
[namespace: string]: NamespaceVal; | ||
}; | ||
type NamespaceVal = $Option | ($Option & Subquery); | ||
declare type NamespaceVal = $Option | ($Option & Subquery); | ||
interface Query { | ||
[namespace: string]: NamespaceVal; | ||
} | ||
type InstantObject = { | ||
declare type InstantObject = { | ||
id: string; | ||
[prop: string]: any; | ||
}; | ||
type ResponseObject<K, Schema> = K extends keyof Schema ? { | ||
declare type ResponseObject<K, Schema> = K extends keyof Schema ? { | ||
id: string; | ||
} & Schema[K] : InstantObject; | ||
type IsEmptyObject<T> = T extends Record<string, never> ? true : false; | ||
type ResponseOf<Q, Schema> = { | ||
declare type IsEmptyObject<T> = T extends Record<string, never> ? true : false; | ||
declare type ResponseOf<Q, Schema> = { | ||
[K in keyof Q]: IsEmptyObject<Q[K]> extends true ? ResponseObject<K, Schema>[] : (ResponseOf<Q[K], Schema> & ResponseObject<K, Schema>)[]; | ||
}; | ||
type Remove$<T> = T extends object ? { | ||
declare type Remove$<T> = T extends object ? { | ||
[K in keyof T as Exclude<K, "$">]: Remove$<T[K]>; | ||
} : T; | ||
type QueryResponse<T, Schema> = ResponseOf<{ | ||
declare type QueryResponse<T, Schema> = ResponseOf<{ | ||
[K in keyof T]: Remove$<T[K]>; | ||
@@ -56,3 +56,3 @@ }, Schema>; | ||
* */ | ||
type Exactly<Parent, Child extends Parent> = Parent & { | ||
declare type Exactly<Parent, Child extends Parent> = Parent & { | ||
[K in keyof Child]: K extends keyof Parent ? Child[K] : never; | ||
@@ -59,0 +59,0 @@ }; |
@@ -58,11 +58,2 @@ // Query | ||
const r14 = dummyQuery({ users: { foo: 1 } }); | ||
const r15 = dummyQuery({ | ||
users: { | ||
$: { where: { foo: 1 } }, | ||
posts: { | ||
// @ts-expect-error | ||
$: { far: {} }, | ||
}, | ||
}, | ||
}); | ||
}; | ||
@@ -69,0 +60,0 @@ const sanityCheckSchemalessResponses = () => { |
@@ -1,2 +0,2 @@ | ||
export type RoomSchemaShape = { | ||
export declare type RoomSchemaShape = { | ||
[k: string]: { | ||
@@ -13,3 +13,3 @@ presence?: { | ||
}; | ||
export type PresenceOpts<PresenceShape, Keys extends keyof PresenceShape> = { | ||
export declare type PresenceOpts<PresenceShape, Keys extends keyof PresenceShape> = { | ||
user?: boolean; | ||
@@ -19,3 +19,3 @@ peers?: string[]; | ||
}; | ||
export type PresenceSlice<PresenceShape, Keys extends keyof PresenceShape> = { | ||
export declare type PresenceSlice<PresenceShape, Keys extends keyof PresenceShape> = { | ||
user?: Pick<PresenceShape, Keys>; | ||
@@ -26,3 +26,3 @@ peers: { | ||
}; | ||
export type PresenceResponse<PresenceShape, Keys extends keyof PresenceShape> = PresenceSlice<PresenceShape, Keys> & { | ||
export declare type PresenceResponse<PresenceShape, Keys extends keyof PresenceShape> = PresenceSlice<PresenceShape, Keys> & { | ||
isLoading: boolean; | ||
@@ -29,0 +29,0 @@ error?: string; |
@@ -1,5 +0,5 @@ | ||
type WhereClause = { | ||
declare type WhereClause = { | ||
[key: string]: string | number | boolean; | ||
}; | ||
type $Option = { | ||
declare type $Option = { | ||
$?: { | ||
@@ -9,24 +9,24 @@ where: WhereClause; | ||
}; | ||
type Subquery = { | ||
declare type Subquery = { | ||
[namespace: string]: NamespaceVal; | ||
}; | ||
type NamespaceVal = $Option | ($Option & Subquery); | ||
declare type NamespaceVal = $Option | ($Option & Subquery); | ||
interface Query { | ||
[namespace: string]: NamespaceVal; | ||
} | ||
type InstantObject = { | ||
declare type InstantObject = { | ||
id: string; | ||
[prop: string]: any; | ||
}; | ||
type ResponseObject<K, Schema> = K extends keyof Schema ? { | ||
declare type ResponseObject<K, Schema> = K extends keyof Schema ? { | ||
id: string; | ||
} & Schema[K] : InstantObject; | ||
type IsEmptyObject<T> = T extends Record<string, never> ? true : false; | ||
type ResponseOf<Q, Schema> = { | ||
declare type IsEmptyObject<T> = T extends Record<string, never> ? true : false; | ||
declare type ResponseOf<Q, Schema> = { | ||
[K in keyof Q]: IsEmptyObject<Q[K]> extends true ? ResponseObject<K, Schema>[] : (ResponseOf<Q[K], Schema> & ResponseObject<K, Schema>)[]; | ||
}; | ||
type Remove$<T> = T extends object ? { | ||
declare type Remove$<T> = T extends object ? { | ||
[K in keyof T as Exclude<K, "$">]: Remove$<T[K]>; | ||
} : T; | ||
type QueryResponse<T, Schema> = ResponseOf<{ | ||
declare type QueryResponse<T, Schema> = ResponseOf<{ | ||
[K in keyof T]: Remove$<T[K]>; | ||
@@ -56,3 +56,3 @@ }, Schema>; | ||
* */ | ||
type Exactly<Parent, Child extends Parent> = Parent & { | ||
declare type Exactly<Parent, Child extends Parent> = Parent & { | ||
[K in keyof Child]: K extends keyof Parent ? Child[K] : never; | ||
@@ -59,0 +59,0 @@ }; |
@@ -60,11 +60,2 @@ "use strict"; | ||
const r14 = dummyQuery({ users: { foo: 1 } }); | ||
const r15 = dummyQuery({ | ||
users: { | ||
$: { where: { foo: 1 } }, | ||
posts: { | ||
// @ts-expect-error | ||
$: { far: {} }, | ||
}, | ||
}, | ||
}); | ||
}; | ||
@@ -71,0 +62,0 @@ const sanityCheckSchemalessResponses = () => { |
{ | ||
"name": "@instantdb/core", | ||
"version": "0.10.3", | ||
"version": "0.10.4", | ||
"description": "Instant's core local abstraction", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -158,12 +158,2 @@ // Query | ||
const r14 = dummyQuery({ users: { foo: 1 } }); | ||
const r15 = dummyQuery({ | ||
users: { | ||
$: { where: { foo: 1 } }, | ||
posts: { | ||
// @ts-expect-error | ||
$: { far: {} }, | ||
}, | ||
}, | ||
}); | ||
}; | ||
@@ -170,0 +160,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1553467
34881