@arcanejs/protocol 0.8.0 → 0.9.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/core.d.mts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/index.d.mts +24 -3
- package/dist/index.d.ts +24 -3
- package/package.json +3 -3
package/dist/core.d.mts
CHANGED
|
@@ -120,9 +120,9 @@ interface CoreComponentCalls {
|
|
|
120
120
|
return: true;
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
|
-
declare const isCoreComponentMessage: <C extends "
|
|
123
|
+
declare const isCoreComponentMessage: <C extends CoreComponentMessage["component"]>(message: BaseClientComponentMessage<string>, component: C) => message is CoreComponentMessage & {
|
|
124
124
|
component: C;
|
|
125
125
|
};
|
|
126
|
-
declare const isCoreComponentCall: <A extends
|
|
126
|
+
declare const isCoreComponentCall: <A extends keyof CoreComponentCalls>(call: BaseClientComponentCall<string, string>, action: A) => call is CoreComponentCalls[A]["call"];
|
|
127
127
|
|
|
128
128
|
export { type ButtonComponent, type ButtonPressMessage, type CoreComponent, type CoreComponentCalls, type CoreComponentMessage, type CoreNamespace, type DefaultGroupCollapsedState, type Gradient, type GroupCollapsedState, type GroupComponent, type GroupHeaderComponent, type GroupTitleChangeMessage, type LabelComponent, type RectComponent, type SliderButtonComponent, type SliderButtonUpdateMessage, type SwitchComponent, type SwitchToggleMessage, type TabComponent, type TabsComponent, type TextInputComponent, type TextInputUpdateMessage, type TimelineComponent, type TimelineState, isCoreComponent, isCoreComponentCall, isCoreComponentMessage };
|
package/dist/core.d.ts
CHANGED
|
@@ -120,9 +120,9 @@ interface CoreComponentCalls {
|
|
|
120
120
|
return: true;
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
|
-
declare const isCoreComponentMessage: <C extends "
|
|
123
|
+
declare const isCoreComponentMessage: <C extends CoreComponentMessage["component"]>(message: BaseClientComponentMessage<string>, component: C) => message is CoreComponentMessage & {
|
|
124
124
|
component: C;
|
|
125
125
|
};
|
|
126
|
-
declare const isCoreComponentCall: <A extends
|
|
126
|
+
declare const isCoreComponentCall: <A extends keyof CoreComponentCalls>(call: BaseClientComponentCall<string, string>, action: A) => call is CoreComponentCalls[A]["call"];
|
|
127
127
|
|
|
128
128
|
export { type ButtonComponent, type ButtonPressMessage, type CoreComponent, type CoreComponentCalls, type CoreComponentMessage, type CoreNamespace, type DefaultGroupCollapsedState, type Gradient, type GroupCollapsedState, type GroupComponent, type GroupHeaderComponent, type GroupTitleChangeMessage, type LabelComponent, type RectComponent, type SliderButtonComponent, type SliderButtonUpdateMessage, type SwitchComponent, type SwitchToggleMessage, type TabComponent, type TabsComponent, type TextInputComponent, type TextInputUpdateMessage, type TimelineComponent, type TimelineState, isCoreComponent, isCoreComponentCall, isCoreComponentMessage };
|
package/dist/index.d.mts
CHANGED
|
@@ -38,6 +38,11 @@ type CallResponseMsg<Namespace extends string, T> = {
|
|
|
38
38
|
success: false;
|
|
39
39
|
errorMessage: string;
|
|
40
40
|
});
|
|
41
|
+
type BaseNotificationMessage<Namespace extends string, Notification extends string> = {
|
|
42
|
+
type: 'notification';
|
|
43
|
+
namespace: Namespace;
|
|
44
|
+
notification: Notification;
|
|
45
|
+
};
|
|
41
46
|
type PongResponseMessage = {
|
|
42
47
|
type: 'pong';
|
|
43
48
|
pingId: number;
|
|
@@ -46,7 +51,7 @@ type PongResponseMessage = {
|
|
|
46
51
|
*/
|
|
47
52
|
serverTimeMillis: number;
|
|
48
53
|
};
|
|
49
|
-
type ServerMessage = MetadataMessage | SendTreeMsg | UpdateTreeMsg | CallResponseMsg<string, unknown> | PongResponseMessage;
|
|
54
|
+
type ServerMessage = MetadataMessage | SendTreeMsg | UpdateTreeMsg | CallResponseMsg<string, unknown> | BaseNotificationMessage<string, string> | PongResponseMessage;
|
|
50
55
|
type BaseClientComponentMessage<Namespace extends string> = {
|
|
51
56
|
type: 'component-message';
|
|
52
57
|
namespace: Namespace;
|
|
@@ -69,12 +74,28 @@ type CallForPair<Namespace extends string, Pairs, Action extends string & keyof
|
|
|
69
74
|
type ReturnForPair<Pairs, Action extends string & keyof Pairs> = Pairs extends Record<Action, {
|
|
70
75
|
return: infer R;
|
|
71
76
|
}> ? R : never;
|
|
77
|
+
type BaseClientComponentCallUpload<Namespace extends string, Action extends string> = {
|
|
78
|
+
type: 'component-call-upload';
|
|
79
|
+
namespace: Namespace;
|
|
80
|
+
componentKey: number;
|
|
81
|
+
requestId: number;
|
|
82
|
+
action: Action;
|
|
83
|
+
};
|
|
84
|
+
type BaseClientComponentCallDownload<Namespace extends string, Action extends string> = {
|
|
85
|
+
type: 'component-call-download';
|
|
86
|
+
namespace: Namespace;
|
|
87
|
+
componentKey: number;
|
|
88
|
+
requestId: number;
|
|
89
|
+
action: Action;
|
|
90
|
+
};
|
|
72
91
|
type AnyClientComponentMessage = BaseClientComponentMessage<string>;
|
|
73
92
|
type AnyClientComponentCall = BaseClientComponentCall<string, string>;
|
|
93
|
+
type AnyClientComponentCallUpload = BaseClientComponentCallUpload<string, string>;
|
|
94
|
+
type AnyClientComponentCallDownload = BaseClientComponentCallDownload<string, string>;
|
|
74
95
|
type PingRequestMessage = {
|
|
75
96
|
type: 'ping';
|
|
76
97
|
pingId: number;
|
|
77
98
|
};
|
|
78
|
-
type ClientMessage = AnyClientComponentMessage | AnyClientComponentCall | PingRequestMessage;
|
|
99
|
+
type ClientMessage = AnyClientComponentMessage | AnyClientComponentCall | AnyClientComponentCallUpload | AnyClientComponentCallDownload | PingRequestMessage;
|
|
79
100
|
|
|
80
|
-
export type { AnyClientComponentCall, AnyClientComponentMessage, AnyComponentProto, BaseClientComponentCall, BaseClientComponentCallPair, BaseClientComponentMessage, BaseComponentProto, CallForPair, CallResponseMsg, ClientMessage, MetadataMessage, PingRequestMessage, PongResponseMessage, ReturnForPair, SendTreeMsg, ServerMessage, UpdateTreeMsg };
|
|
101
|
+
export type { AnyClientComponentCall, AnyClientComponentCallDownload, AnyClientComponentCallUpload, AnyClientComponentMessage, AnyComponentProto, BaseClientComponentCall, BaseClientComponentCallDownload, BaseClientComponentCallPair, BaseClientComponentCallUpload, BaseClientComponentMessage, BaseComponentProto, BaseNotificationMessage, CallForPair, CallResponseMsg, ClientMessage, MetadataMessage, PingRequestMessage, PongResponseMessage, ReturnForPair, SendTreeMsg, ServerMessage, UpdateTreeMsg };
|
package/dist/index.d.ts
CHANGED
|
@@ -38,6 +38,11 @@ type CallResponseMsg<Namespace extends string, T> = {
|
|
|
38
38
|
success: false;
|
|
39
39
|
errorMessage: string;
|
|
40
40
|
});
|
|
41
|
+
type BaseNotificationMessage<Namespace extends string, Notification extends string> = {
|
|
42
|
+
type: 'notification';
|
|
43
|
+
namespace: Namespace;
|
|
44
|
+
notification: Notification;
|
|
45
|
+
};
|
|
41
46
|
type PongResponseMessage = {
|
|
42
47
|
type: 'pong';
|
|
43
48
|
pingId: number;
|
|
@@ -46,7 +51,7 @@ type PongResponseMessage = {
|
|
|
46
51
|
*/
|
|
47
52
|
serverTimeMillis: number;
|
|
48
53
|
};
|
|
49
|
-
type ServerMessage = MetadataMessage | SendTreeMsg | UpdateTreeMsg | CallResponseMsg<string, unknown> | PongResponseMessage;
|
|
54
|
+
type ServerMessage = MetadataMessage | SendTreeMsg | UpdateTreeMsg | CallResponseMsg<string, unknown> | BaseNotificationMessage<string, string> | PongResponseMessage;
|
|
50
55
|
type BaseClientComponentMessage<Namespace extends string> = {
|
|
51
56
|
type: 'component-message';
|
|
52
57
|
namespace: Namespace;
|
|
@@ -69,12 +74,28 @@ type CallForPair<Namespace extends string, Pairs, Action extends string & keyof
|
|
|
69
74
|
type ReturnForPair<Pairs, Action extends string & keyof Pairs> = Pairs extends Record<Action, {
|
|
70
75
|
return: infer R;
|
|
71
76
|
}> ? R : never;
|
|
77
|
+
type BaseClientComponentCallUpload<Namespace extends string, Action extends string> = {
|
|
78
|
+
type: 'component-call-upload';
|
|
79
|
+
namespace: Namespace;
|
|
80
|
+
componentKey: number;
|
|
81
|
+
requestId: number;
|
|
82
|
+
action: Action;
|
|
83
|
+
};
|
|
84
|
+
type BaseClientComponentCallDownload<Namespace extends string, Action extends string> = {
|
|
85
|
+
type: 'component-call-download';
|
|
86
|
+
namespace: Namespace;
|
|
87
|
+
componentKey: number;
|
|
88
|
+
requestId: number;
|
|
89
|
+
action: Action;
|
|
90
|
+
};
|
|
72
91
|
type AnyClientComponentMessage = BaseClientComponentMessage<string>;
|
|
73
92
|
type AnyClientComponentCall = BaseClientComponentCall<string, string>;
|
|
93
|
+
type AnyClientComponentCallUpload = BaseClientComponentCallUpload<string, string>;
|
|
94
|
+
type AnyClientComponentCallDownload = BaseClientComponentCallDownload<string, string>;
|
|
74
95
|
type PingRequestMessage = {
|
|
75
96
|
type: 'ping';
|
|
76
97
|
pingId: number;
|
|
77
98
|
};
|
|
78
|
-
type ClientMessage = AnyClientComponentMessage | AnyClientComponentCall | PingRequestMessage;
|
|
99
|
+
type ClientMessage = AnyClientComponentMessage | AnyClientComponentCall | AnyClientComponentCallUpload | AnyClientComponentCallDownload | PingRequestMessage;
|
|
79
100
|
|
|
80
|
-
export type { AnyClientComponentCall, AnyClientComponentMessage, AnyComponentProto, BaseClientComponentCall, BaseClientComponentCallPair, BaseClientComponentMessage, BaseComponentProto, CallForPair, CallResponseMsg, ClientMessage, MetadataMessage, PingRequestMessage, PongResponseMessage, ReturnForPair, SendTreeMsg, ServerMessage, UpdateTreeMsg };
|
|
101
|
+
export type { AnyClientComponentCall, AnyClientComponentCallDownload, AnyClientComponentCallUpload, AnyClientComponentMessage, AnyComponentProto, BaseClientComponentCall, BaseClientComponentCallDownload, BaseClientComponentCallPair, BaseClientComponentCallUpload, BaseClientComponentMessage, BaseComponentProto, BaseNotificationMessage, CallForPair, CallResponseMsg, ClientMessage, MetadataMessage, PingRequestMessage, PongResponseMessage, ReturnForPair, SendTreeMsg, ServerMessage, UpdateTreeMsg };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcanejs/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The JSON protocol types for the @arcanejs Toolkit",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"./package.json": "./package.json"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@arcanejs/diff": "^0.
|
|
37
|
+
"@arcanejs/diff": "^0.6.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/eslint": "^8.56.5",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"check-export-map": "^1.3.1",
|
|
43
43
|
"eslint": "^8.57.0",
|
|
44
44
|
"tsup": "^8.1.0",
|
|
45
|
-
"typescript": "^5.
|
|
45
|
+
"typescript": "^5.7",
|
|
46
46
|
"@arcanejs/eslint-config": "^0.0.0",
|
|
47
47
|
"@arcanejs/typescript-config": "^0.0.0"
|
|
48
48
|
},
|