@kokimoki/app 1.16.2 → 2.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/dist/fields.d.ts +110 -0
- package/dist/fields.js +158 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -2
- package/dist/kokimoki-ai.d.ts +153 -0
- package/dist/kokimoki-ai.js +164 -0
- package/dist/kokimoki-awareness.d.ts +14 -13
- package/dist/kokimoki-awareness.js +41 -33
- package/dist/kokimoki-client-refactored.d.ts +80 -0
- package/dist/kokimoki-client-refactored.js +400 -0
- package/dist/kokimoki-client.d.ts +284 -71
- package/dist/kokimoki-client.js +299 -223
- package/dist/kokimoki-leaderboard.d.ts +175 -0
- package/dist/kokimoki-leaderboard.js +203 -0
- package/dist/kokimoki-schema.d.ts +113 -0
- package/dist/kokimoki-schema.js +162 -0
- package/dist/kokimoki-storage.d.ts +156 -0
- package/dist/kokimoki-storage.js +208 -0
- package/dist/kokimoki.min.d.ts +760 -84
- package/dist/kokimoki.min.js +668 -261
- package/dist/kokimoki.min.js.map +1 -1
- package/dist/llms.txt +649 -0
- package/dist/message-queue.d.ts +8 -0
- package/dist/message-queue.js +19 -0
- package/dist/synced-schema.d.ts +74 -0
- package/dist/synced-schema.js +83 -0
- package/dist/synced-store.d.ts +10 -0
- package/dist/synced-store.js +9 -0
- package/dist/synced-types.d.ts +47 -0
- package/dist/synced-types.js +67 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/ws-message-type copy.d.ts +6 -0
- package/dist/ws-message-type copy.js +7 -0
- package/package.json +2 -2
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export declare abstract class SyncedGeneric<T> {
|
|
2
|
+
abstract get defaultValue(): T;
|
|
3
|
+
abstract set defaultValue(value: T);
|
|
4
|
+
}
|
|
5
|
+
export declare class SyncedNumber extends SyncedGeneric<number> {
|
|
6
|
+
defaultValue: number;
|
|
7
|
+
constructor(defaultValue?: number);
|
|
8
|
+
}
|
|
9
|
+
declare function syncedNumber(defaultValue?: number): SyncedNumber;
|
|
10
|
+
export declare class SyncedString extends SyncedGeneric<string> {
|
|
11
|
+
defaultValue: string;
|
|
12
|
+
constructor(defaultValue?: string);
|
|
13
|
+
}
|
|
14
|
+
declare function syncedString(defaultValue?: string): SyncedString;
|
|
15
|
+
export declare class SyncedBoolean extends SyncedGeneric<boolean> {
|
|
16
|
+
defaultValue: boolean;
|
|
17
|
+
constructor(defaultValue?: boolean);
|
|
18
|
+
}
|
|
19
|
+
declare function syncedBoolean(defaultValue?: boolean): SyncedBoolean;
|
|
20
|
+
export declare class SyncedObject<
|
|
21
|
+
Data extends Record<string, SyncedGeneric<unknown>>,
|
|
22
|
+
> extends SyncedGeneric<{
|
|
23
|
+
[key in keyof Data]: Data[key]["defaultValue"];
|
|
24
|
+
}> {
|
|
25
|
+
fields: Data;
|
|
26
|
+
constructor(fields: Data);
|
|
27
|
+
get defaultValue(): {
|
|
28
|
+
[key in keyof Data]: Data[key]["defaultValue"];
|
|
29
|
+
};
|
|
30
|
+
set defaultValue(value: {
|
|
31
|
+
[key in keyof Data]: Data[key]["defaultValue"];
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
declare function syncedObject<
|
|
35
|
+
Data extends Record<string, SyncedGeneric<unknown>>,
|
|
36
|
+
>(schema: Data): SyncedObject<Data>;
|
|
37
|
+
export declare class SyncedMap<T extends SyncedGeneric<unknown>> {
|
|
38
|
+
schema: T;
|
|
39
|
+
defaultValue: {
|
|
40
|
+
[key: string]: T["defaultValue"];
|
|
41
|
+
};
|
|
42
|
+
constructor(
|
|
43
|
+
schema: T,
|
|
44
|
+
defaultValue?: {
|
|
45
|
+
[key: string]: T["defaultValue"];
|
|
46
|
+
},
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
declare function syncedMap<T extends SyncedGeneric<unknown>>(
|
|
50
|
+
schema: T,
|
|
51
|
+
defaultValue?: {
|
|
52
|
+
[key: string]: T["defaultValue"];
|
|
53
|
+
},
|
|
54
|
+
): SyncedMap<T>;
|
|
55
|
+
export declare class SyncedArray<
|
|
56
|
+
T extends SyncedGeneric<unknown>,
|
|
57
|
+
> extends SyncedGeneric<T["defaultValue"][]> {
|
|
58
|
+
schema: T;
|
|
59
|
+
defaultValue: T["defaultValue"][];
|
|
60
|
+
constructor(schema: T, defaultValue?: T["defaultValue"][]);
|
|
61
|
+
}
|
|
62
|
+
declare function syncedArray<T extends SyncedGeneric<unknown>>(
|
|
63
|
+
schema: T,
|
|
64
|
+
defaultValue?: T["defaultValue"][],
|
|
65
|
+
): SyncedArray<T>;
|
|
66
|
+
export declare const S: {
|
|
67
|
+
number: typeof syncedNumber;
|
|
68
|
+
string: typeof syncedString;
|
|
69
|
+
boolean: typeof syncedBoolean;
|
|
70
|
+
object: typeof syncedObject;
|
|
71
|
+
map: typeof syncedMap;
|
|
72
|
+
array: typeof syncedArray;
|
|
73
|
+
};
|
|
74
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export class SyncedGeneric {}
|
|
2
|
+
export class SyncedNumber extends SyncedGeneric {
|
|
3
|
+
defaultValue;
|
|
4
|
+
constructor(defaultValue = 0) {
|
|
5
|
+
super();
|
|
6
|
+
this.defaultValue = defaultValue;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function syncedNumber(defaultValue = 0) {
|
|
10
|
+
return new SyncedNumber(defaultValue);
|
|
11
|
+
}
|
|
12
|
+
export class SyncedString extends SyncedGeneric {
|
|
13
|
+
defaultValue;
|
|
14
|
+
constructor(defaultValue = "") {
|
|
15
|
+
super();
|
|
16
|
+
this.defaultValue = defaultValue;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function syncedString(defaultValue = "") {
|
|
20
|
+
return new SyncedString(defaultValue);
|
|
21
|
+
}
|
|
22
|
+
export class SyncedBoolean extends SyncedGeneric {
|
|
23
|
+
defaultValue;
|
|
24
|
+
constructor(defaultValue = false) {
|
|
25
|
+
super();
|
|
26
|
+
this.defaultValue = defaultValue;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function syncedBoolean(defaultValue = false) {
|
|
30
|
+
return new SyncedBoolean(defaultValue);
|
|
31
|
+
}
|
|
32
|
+
export class SyncedObject extends SyncedGeneric {
|
|
33
|
+
fields;
|
|
34
|
+
constructor(fields) {
|
|
35
|
+
super();
|
|
36
|
+
this.fields = fields;
|
|
37
|
+
}
|
|
38
|
+
get defaultValue() {
|
|
39
|
+
return Object.entries(this.fields).reduce((acc, [key, field]) => {
|
|
40
|
+
acc[key] = field.defaultValue;
|
|
41
|
+
return acc;
|
|
42
|
+
}, {});
|
|
43
|
+
}
|
|
44
|
+
set defaultValue(value) {
|
|
45
|
+
for (const [key, field] of Object.entries(this.fields)) {
|
|
46
|
+
field.defaultValue = value[key];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function syncedObject(schema) {
|
|
51
|
+
return new SyncedObject(schema);
|
|
52
|
+
}
|
|
53
|
+
export class SyncedMap {
|
|
54
|
+
schema;
|
|
55
|
+
defaultValue;
|
|
56
|
+
constructor(schema, defaultValue = {}) {
|
|
57
|
+
this.schema = schema;
|
|
58
|
+
this.defaultValue = defaultValue;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function syncedMap(schema, defaultValue = {}) {
|
|
62
|
+
return new SyncedMap(schema, defaultValue);
|
|
63
|
+
}
|
|
64
|
+
export class SyncedArray extends SyncedGeneric {
|
|
65
|
+
schema;
|
|
66
|
+
defaultValue;
|
|
67
|
+
constructor(schema, defaultValue = []) {
|
|
68
|
+
super();
|
|
69
|
+
this.schema = schema;
|
|
70
|
+
this.defaultValue = defaultValue;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function syncedArray(schema, defaultValue = []) {
|
|
74
|
+
return new SyncedArray(schema, defaultValue);
|
|
75
|
+
}
|
|
76
|
+
export const S = {
|
|
77
|
+
number: syncedNumber,
|
|
78
|
+
string: syncedString,
|
|
79
|
+
boolean: syncedBoolean,
|
|
80
|
+
object: syncedObject,
|
|
81
|
+
map: syncedMap,
|
|
82
|
+
array: syncedArray,
|
|
83
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as Y from "yjs";
|
|
2
|
+
import type {
|
|
3
|
+
DocTypeDescription,
|
|
4
|
+
MappedTypeDescription,
|
|
5
|
+
} from "@syncedstore/core/types/doc";
|
|
6
|
+
export declare class SyncedStore<T extends DocTypeDescription> {
|
|
7
|
+
readonly data: MappedTypeDescription<T>;
|
|
8
|
+
readonly doc: Y.Doc;
|
|
9
|
+
constructor(initialState: T);
|
|
10
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare abstract class SyncedGeneric<T> {
|
|
2
|
+
abstract get defaultValue(): T;
|
|
3
|
+
abstract set defaultValue(value: T);
|
|
4
|
+
}
|
|
5
|
+
export declare class SyncedNumber extends SyncedGeneric<number> {
|
|
6
|
+
defaultValue: number;
|
|
7
|
+
constructor(defaultValue?: number);
|
|
8
|
+
}
|
|
9
|
+
export declare function syncedNumber(defaultValue?: number): SyncedNumber;
|
|
10
|
+
export declare class SyncedString extends SyncedGeneric<string> {
|
|
11
|
+
defaultValue: string;
|
|
12
|
+
constructor(defaultValue?: string);
|
|
13
|
+
}
|
|
14
|
+
export declare function syncedString(defaultValue?: string): SyncedString;
|
|
15
|
+
export declare class SyncedBoolean extends SyncedGeneric<boolean> {
|
|
16
|
+
defaultValue: boolean;
|
|
17
|
+
constructor(defaultValue?: boolean);
|
|
18
|
+
}
|
|
19
|
+
export declare function syncedBoolean(defaultValue?: boolean): SyncedBoolean;
|
|
20
|
+
export declare class SyncedMap<
|
|
21
|
+
Data extends Record<string, SyncedGeneric<unknown>>,
|
|
22
|
+
> extends SyncedGeneric<{
|
|
23
|
+
[key in keyof Data]: Data[key]["defaultValue"];
|
|
24
|
+
}> {
|
|
25
|
+
fields: Data;
|
|
26
|
+
constructor(fields: Data);
|
|
27
|
+
get defaultValue(): {
|
|
28
|
+
[key in keyof Data]: Data[key]["defaultValue"];
|
|
29
|
+
};
|
|
30
|
+
set defaultValue(value: {
|
|
31
|
+
[key in keyof Data]: Data[key]["defaultValue"];
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export declare function syncedMap<
|
|
35
|
+
T extends Record<string, SyncedGeneric<unknown>>,
|
|
36
|
+
>(schema: T): SyncedMap<T>;
|
|
37
|
+
export declare class SyncedArray<
|
|
38
|
+
T extends SyncedGeneric<unknown>,
|
|
39
|
+
> extends SyncedGeneric<T["defaultValue"][]> {
|
|
40
|
+
schema: T;
|
|
41
|
+
defaultValue: T["defaultValue"][];
|
|
42
|
+
constructor(schema: T, defaultValue?: T["defaultValue"][]);
|
|
43
|
+
}
|
|
44
|
+
export declare function syncedArray<T extends SyncedGeneric<unknown>>(
|
|
45
|
+
schema: T,
|
|
46
|
+
defaultValue?: T["defaultValue"][],
|
|
47
|
+
): SyncedArray<T>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as Y from "yjs";
|
|
2
|
+
import { proxy as yjsProxy } from "valtio";
|
|
3
|
+
import { bind as yjsBind } from "valtio-yjs";
|
|
4
|
+
export class SyncedGeneric {}
|
|
5
|
+
export class SyncedNumber extends SyncedGeneric {
|
|
6
|
+
defaultValue;
|
|
7
|
+
constructor(defaultValue = 0) {
|
|
8
|
+
super();
|
|
9
|
+
this.defaultValue = defaultValue;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export function syncedNumber(defaultValue = 0) {
|
|
13
|
+
return new SyncedNumber(defaultValue);
|
|
14
|
+
}
|
|
15
|
+
export class SyncedString extends SyncedGeneric {
|
|
16
|
+
defaultValue;
|
|
17
|
+
constructor(defaultValue = "") {
|
|
18
|
+
super();
|
|
19
|
+
this.defaultValue = defaultValue;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export function syncedString(defaultValue = "") {
|
|
23
|
+
return new SyncedString(defaultValue);
|
|
24
|
+
}
|
|
25
|
+
export class SyncedBoolean extends SyncedGeneric {
|
|
26
|
+
defaultValue;
|
|
27
|
+
constructor(defaultValue = false) {
|
|
28
|
+
super();
|
|
29
|
+
this.defaultValue = defaultValue;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export function syncedBoolean(defaultValue = false) {
|
|
33
|
+
return new SyncedBoolean(defaultValue);
|
|
34
|
+
}
|
|
35
|
+
export class SyncedMap extends SyncedGeneric {
|
|
36
|
+
fields;
|
|
37
|
+
constructor(fields) {
|
|
38
|
+
super();
|
|
39
|
+
this.fields = fields;
|
|
40
|
+
}
|
|
41
|
+
get defaultValue() {
|
|
42
|
+
return Object.entries(this.fields).reduce((acc, [key, field]) => {
|
|
43
|
+
acc[key] = field.defaultValue;
|
|
44
|
+
return acc;
|
|
45
|
+
}, {});
|
|
46
|
+
}
|
|
47
|
+
set defaultValue(value) {
|
|
48
|
+
for (const [key, field] of Object.entries(this.fields)) {
|
|
49
|
+
field.defaultValue = value[key];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export function syncedMap(schema) {
|
|
54
|
+
return new SyncedMap(schema);
|
|
55
|
+
}
|
|
56
|
+
export class SyncedArray extends SyncedGeneric {
|
|
57
|
+
schema;
|
|
58
|
+
defaultValue;
|
|
59
|
+
constructor(schema, defaultValue = []) {
|
|
60
|
+
super();
|
|
61
|
+
this.schema = schema;
|
|
62
|
+
this.defaultValue = defaultValue;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export function syncedArray(schema, defaultValue = []) {
|
|
66
|
+
return new SyncedArray(schema, defaultValue);
|
|
67
|
+
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const KOKIMOKI_APP_VERSION = "
|
|
1
|
+
export declare const KOKIMOKI_APP_VERSION = "2.0.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const KOKIMOKI_APP_VERSION = "
|
|
1
|
+
export const KOKIMOKI_APP_VERSION = "2.0.0";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var WsMessageType;
|
|
2
|
+
(function (WsMessageType) {
|
|
3
|
+
WsMessageType[(WsMessageType["SubscribeReq"] = 1)] = "SubscribeReq";
|
|
4
|
+
WsMessageType[(WsMessageType["SubscribeRes"] = 2)] = "SubscribeRes";
|
|
5
|
+
WsMessageType[(WsMessageType["Transaction"] = 3)] = "Transaction";
|
|
6
|
+
WsMessageType[(WsMessageType["RoomUpdate"] = 4)] = "RoomUpdate";
|
|
7
|
+
})(WsMessageType || (WsMessageType = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kokimoki/app",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Kokimoki app",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"test": "NODE_OPTIONS='--import tsx' mocha",
|
|
17
17
|
"prebuild": "node -p \"'export const KOKIMOKI_APP_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
|
|
18
18
|
"build": "tsc",
|
|
19
|
-
"postbuild": "rollup --config",
|
|
19
|
+
"postbuild": "rollup --config && cp llms.txt dist/",
|
|
20
20
|
"dev": "tsc -w",
|
|
21
21
|
"docs": "typedoc src/index.ts",
|
|
22
22
|
"rollup": "rollup --config"
|