@clockworklabs/spacetimedb-typescript-sdk
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -1,2 +0,2 @@ | ||
import { ProductType, SumType, AlgebraicType, BuiltinType } from './algebraic_type'; | ||
import { ProductType, SumType, AlgebraicType, BuiltinType } from './algebraic_type.js'; | ||
export declare class SumValue { | ||
@@ -3,0 +3,0 @@ tag: number; |
@@ -1,2 +0,2 @@ | ||
import { AlgebraicType, BuiltinType } from './algebraic_type'; | ||
import { AlgebraicType, BuiltinType } from './algebraic_type.js'; | ||
export class SumValue { | ||
@@ -3,0 +3,0 @@ tag; |
@@ -1,1 +0,1 @@ | ||
export * from './spacetimedb'; | ||
export * from './spacetimedb.js'; |
@@ -1,1 +0,1 @@ | ||
export * from './spacetimedb'; | ||
export * from './spacetimedb.js'; |
/// <reference types="node" /> | ||
import { EventEmitter } from "events"; | ||
import { ProductValue, AlgebraicValue } from "./algebraic_value"; | ||
import { AlgebraicType, ProductType, ProductTypeElement, SumType, SumTypeVariant, BuiltinType } from "./algebraic_type"; | ||
import { ProductValue, AlgebraicValue } from "./algebraic_value.js"; | ||
import { AlgebraicType, ProductType, ProductTypeElement, SumType, SumTypeVariant, BuiltinType } from "./algebraic_type.js"; | ||
export { ProductValue, AlgebraicValue, AlgebraicType, ProductType, ProductTypeElement, SumType, SumTypeVariant, BuiltinType }; | ||
@@ -18,2 +18,3 @@ type SpacetimeDBGlobals = { | ||
} | ||
var __SPACETIMEDB__: SpacetimeDBGlobals; | ||
} | ||
@@ -44,3 +45,3 @@ export declare class Reducer { | ||
getEntries(): IterableIterator<AlgebraicValue>; | ||
getInstances(): IterableIterator<IDatabaseTable>; | ||
getInstances(): IterableIterator<any>; | ||
applyOperations: (operations: { | ||
@@ -88,1 +89,2 @@ op: string; | ||
} | ||
export declare const __SPACETIMEDB__: SpacetimeDBGlobals; |
import { EventEmitter } from "events"; | ||
import { w3cwebsocket as WSClient } from 'websocket'; | ||
import { ProductValue, AlgebraicValue } from "./algebraic_value"; | ||
import { AlgebraicType, ProductType, ProductTypeElement, SumType, SumTypeVariant, BuiltinType } from "./algebraic_type"; | ||
import WS from 'websocket'; | ||
import { ProductValue, AlgebraicValue } from "./algebraic_value.js"; | ||
import { AlgebraicType, ProductType, ProductTypeElement, SumType, SumTypeVariant, BuiltinType } from "./algebraic_type.js"; | ||
export { ProductValue, AlgebraicValue, AlgebraicType, ProductType, ProductTypeElement, SumType, SumTypeVariant, BuiltinType }; | ||
const g = (typeof window === 'undefined' ? global : window); | ||
export class Reducer { | ||
@@ -151,3 +152,3 @@ } | ||
constructor(host, name_or_address, credentials) { | ||
const global = window.__SPACETIMEDB__; | ||
const global = g.__SPACETIMEDB__; | ||
this.db = global.clientDB; | ||
@@ -179,3 +180,3 @@ // I don't really like it, but it seems like the only way to | ||
this.emitter = new EventEmitter(); | ||
this.ws = new WSClient(`ws://${host}/database/subscribe?name_or_address=${name_or_address}`, 'v1.text.spacetimedb', undefined, headers, undefined, { | ||
this.ws = new WS.w3cwebsocket(`ws://${host}/database/subscribe?name_or_address=${name_or_address}`, 'v1.text.spacetimedb', undefined, headers, undefined, { | ||
maxReceivedFrameSize: 100000000, | ||
@@ -278,3 +279,3 @@ maxReceivedMessageSize: 100000000, | ||
} | ||
window.__SPACETIMEDB__ = { | ||
g.__SPACETIMEDB__ = { | ||
components: new Map(), | ||
@@ -284,3 +285,3 @@ clientDB: new ClientDB(), | ||
registerReducer: function (name, reducer) { | ||
let global = window.__SPACETIMEDB__; | ||
let global = g.__SPACETIMEDB__; | ||
global.reducers.set(name, reducer); | ||
@@ -292,3 +293,3 @@ if (global.spacetimeDBClient) { | ||
registerComponent: function (name, component) { | ||
let global = window.__SPACETIMEDB__; | ||
let global = g.__SPACETIMEDB__; | ||
global.components.set(name, component); | ||
@@ -301,1 +302,2 @@ if (global.spacetimeDBClient) { | ||
}; | ||
export const __SPACETIMEDB__ = (typeof (window) === 'undefined' ? global.__SPACETIMEDB__ : window.__SPACETIMEDB__); |
{ | ||
"name": "@clockworklabs/spacetimedb-typescript-sdk", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "A client for use in the EnglishAuction", | ||
@@ -39,3 +39,6 @@ "author": { | ||
"websocket": "^1.0.34" | ||
} | ||
}, | ||
"files": [ | ||
"/dist" | ||
] | ||
} |
51500
14
888