@dusted/anqst 0.1.2 → 1.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/src/app.js +86 -103
- package/dist/src/build-stamp.js +5 -0
- package/dist/src/emit.js +530 -89
- package/dist/src/parser.js +159 -8
- package/dist/src/verify.js +6 -1
- package/package.json +3 -2
- package/spec/AnQst-Spec-DSL.d.ts +323 -213
package/spec/AnQst-Spec-DSL.d.ts
CHANGED
|
@@ -1,217 +1,327 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AnQst-Spec Language - Canonical source of truth for the language.
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
* - DSL for Widget generation, transported as TypeScript definition.
|
|
6
|
-
* - For AnQSt Widget Specifications only.
|
|
7
|
-
* - Exactly one toplevel namespace must be declared: It names the Widget.
|
|
8
|
-
* - Service interfaces are optional. Namespace-local type declarations are valid generation roots.
|
|
9
|
-
* - Imported/external types are generation-relevant when transitively reachable from namespace declarations.
|
|
10
|
-
* - This is not an input file to the generator, it is the description of the language that describes the widget.
|
|
11
|
-
* Not for use by TypeScript application implementation.
|
|
12
|
-
* @example
|
|
1
|
+
/**
|
|
2
|
+
* AnQst-Spec Language - Canonical source of truth for the language.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* - DSL for Widget generation, transported as TypeScript definition.
|
|
6
|
+
* - For AnQSt Widget Specifications only.
|
|
7
|
+
* - Exactly one toplevel namespace must be declared: It names the Widget.
|
|
8
|
+
* - Service interfaces are optional. Namespace-local type declarations are valid generation roots.
|
|
9
|
+
* - Imported/external types are generation-relevant when transitively reachable from namespace declarations.
|
|
10
|
+
* - This is not an input file to the generator, it is the description of the language that describes the widget.
|
|
11
|
+
* Not for use by TypeScript application implementation.
|
|
12
|
+
* @example
|
|
13
13
|
* package.json:
|
|
14
14
|
* - "AnQst": "./AnQst/MyUserMgmtWidget.settings.json"
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
export namespace AnQst {
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Declare service `InterfaceName`
|
|
21
|
-
*
|
|
22
|
-
* @remarks
|
|
23
|
-
* Multiple allowed.
|
|
24
|
-
* Affords developers of advanced widgets the ability to create domain-informed categories.
|
|
25
|
-
* - Duplicate method declarations with identical parameter lists are invalid in normative AnQst-Spec input.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* export interface UserService extends Widget.Service { }
|
|
29
|
-
* // Generates UserService.
|
|
30
|
-
*/
|
|
31
|
-
interface Service { }
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Declare service `InterfaceName` as development-mode capable transport service.
|
|
35
|
-
*
|
|
36
|
-
* @remarks
|
|
37
|
-
* - Extends the same method/property semantics as `AnQst.Service`.
|
|
38
|
-
* - Signals to the generator/runtime that this widget should emit dual-transport bridge support
|
|
39
|
-
* (Qt WebChannel + HTTP/WebSocket development bridge).
|
|
40
|
-
* - Existing generated service APIs remain unchanged.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* export interface UserService extends AnQst.AngularHTTPBaseServerClass { }
|
|
44
|
-
*/
|
|
45
|
-
interface AngularHTTPBaseServerClass extends Service { }
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* -
|
|
53
|
-
*
|
|
54
|
-
* - Widget:
|
|
55
|
-
* -
|
|
56
|
-
* - Parent:
|
|
57
|
-
* - Widget: Promise resolves with
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export namespace AnQst {
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Declare service `InterfaceName`
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* Multiple allowed.
|
|
24
|
+
* Affords developers of advanced widgets the ability to create domain-informed categories.
|
|
25
|
+
* - Duplicate method declarations with identical parameter lists are invalid in normative AnQst-Spec input.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* export interface UserService extends Widget.Service { }
|
|
29
|
+
* // Generates UserService.
|
|
30
|
+
*/
|
|
31
|
+
interface Service { }
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Declare service `InterfaceName` as development-mode capable transport service.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* - Extends the same method/property semantics as `AnQst.Service`.
|
|
38
|
+
* - Signals to the generator/runtime that this widget should emit dual-transport bridge support
|
|
39
|
+
* (Qt WebChannel + HTTP/WebSocket development bridge).
|
|
40
|
+
* - Existing generated service APIs remain unchanged.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* export interface UserService extends AnQst.AngularHTTPBaseServerClass { }
|
|
44
|
+
*/
|
|
45
|
+
interface AngularHTTPBaseServerClass extends Service { }
|
|
46
|
+
|
|
47
|
+
type CallConfig = { timeoutSeconds: number } | { timeoutMilliseconds: number } | {};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Declare non-blocking service method `MethodName`(`MethodArguments`): Promise<`MethodReturnType`>.
|
|
51
|
+
* @remarks
|
|
52
|
+
* - **Widget** -> Parent
|
|
53
|
+
* - Flow:
|
|
54
|
+
* - Widget: Call to service method `MethodName`(`MethodArguments`).
|
|
55
|
+
* - Widget: Returns Promise<`MethodReturnType`>.
|
|
56
|
+
* - Parent: Registered callback receives args and returns `T` synchronously.
|
|
57
|
+
* - Widget: Promise resolves with payload `T` or rejects with plain error object.
|
|
58
|
+
* - Optional config supports timeout tuning:
|
|
59
|
+
* - `AnQst.Call<T, { timeoutSeconds: N }>`
|
|
60
|
+
* - `AnQst.Call<T, { timeoutMilliseconds: N }>`
|
|
61
|
+
* - Exactly one timeout key is allowed. Value must be integer >= 0.
|
|
62
|
+
* - Default timeout is 120s. `0` means wait forever.
|
|
63
|
+
* @example
|
|
64
|
+
* // AnQst spec:
|
|
65
|
+
* getUserById(userId: string): AnQst.Call<User>
|
|
66
|
+
* //Angular app:
|
|
67
|
+
* const user: User = await this.userService.getUserById("abc");
|
|
68
|
+
*/
|
|
69
|
+
interface Call<T, Config extends CallConfig = {}> { dummy: T; config?: Config }
|
|
70
|
+
|
|
66
71
|
/**
|
|
67
72
|
* Declare blocking service method onSlot.`MethodName`( handler(`MethodArguments`):`MethodReturnType` ): void
|
|
68
|
-
* @remarks
|
|
69
|
-
* - **Parent** -> Widget
|
|
70
|
-
* - Impl note: Autogenerated stub handler queues until handler is set (set method calls spools queue through handler)
|
|
71
|
-
* - Flow:
|
|
72
|
-
* - Parent: Call to generated widget method `MethodName`(`MethodArguments`).
|
|
73
|
-
* - Widget: Registered handler(`MethodArguments`)
|
|
74
|
-
* - Widget: Handler
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
73
|
+
* @remarks
|
|
74
|
+
* - **Parent** -> Widget
|
|
75
|
+
* - Impl note: Autogenerated stub handler queues until handler is set (set method calls spools queue through handler)
|
|
76
|
+
* - Flow:
|
|
77
|
+
* - Parent: Call to generated widget method `MethodName`(`MethodArguments`).
|
|
78
|
+
* - Widget: Registered handler(`MethodArguments`) is called.
|
|
79
|
+
* - Widget: Handler return forms:
|
|
80
|
+
* - `T` -> success payload
|
|
81
|
+
* - `Promise<T>` -> awaited, success payload on resolve
|
|
82
|
+
* - `Error` -> failure
|
|
83
|
+
* - throw -> failure
|
|
84
|
+
* - rejected promise -> failure
|
|
85
|
+
* - Parent: `MethodName` call returns with result.
|
|
86
|
+
* - Default Slot timeout is 1000ms.
|
|
87
|
+
* Note: One active handler, calling will replace existing and is valid and allowed.
|
|
88
|
+
* @example
|
|
89
|
+
* // AnQst spec:
|
|
90
|
+
* getUsernameSubstring(from: number, to:number ): AnQst.Slot<string>
|
|
91
|
+
* //Angular app:
|
|
92
|
+
* this.userService.onSlot.getUsername( provider );
|
|
93
|
+
* //Parent:
|
|
94
|
+
* auto currentFormUsername = userMgmt.getUsername();
|
|
95
|
+
*/
|
|
96
|
+
interface Slot<T> { dummy: T }
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Declare message emission method `MethodName`(`MethodArguments`): void
|
|
102
|
+
* @remarks
|
|
103
|
+
* - **Widget** -> ?Parent
|
|
104
|
+
* True Qt signal semantics (Message is emitted, no return path, no registration requirement)
|
|
105
|
+
* - Flow:
|
|
106
|
+
* - Widget: Call to service method `MethodName`(`MethodArguments`).
|
|
107
|
+
* - Widget: Returns void.
|
|
108
|
+
* - Parent: Might have something connected to the signal, might not.
|
|
109
|
+
* - If no listener is connected, event is dropped.
|
|
110
|
+
* @example
|
|
111
|
+
* // AnQst spec:
|
|
112
|
+
* complain(whine: string): AnQst.Emitter;
|
|
113
|
+
* //Angular app:
|
|
114
|
+
* this.userService.complain("Why won't you LISTEN!");
|
|
115
|
+
*/
|
|
116
|
+
interface Emitter { }
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Declare reactive `PropertyName`:`OutputType` and set.`PropertyName`(arg: `OutputType`)
|
|
121
|
+
* @remarks
|
|
122
|
+
* - **Parent** -> Widget
|
|
123
|
+
* True Angular signal semantics (Property updates, signal emits, no return path, no registration requirement)
|
|
124
|
+
* - Flow:
|
|
125
|
+
* - Parent: Sets generated widget property `PropertyName`.
|
|
126
|
+
* - Widget: Service updates readonly property `PropertyName` and emits signal.
|
|
127
|
+
* @example
|
|
128
|
+
* // AnQst spec:
|
|
129
|
+
* activeUsers: AnQst.Output<number>;
|
|
130
|
+
* //Angular app template:
|
|
131
|
+
* <p>{{ userService.activeUsers() }}</p>
|
|
132
|
+
* //Parent:
|
|
133
|
+
* int users = userMgmt.activeUsers;
|
|
134
|
+
* userMgmt.activeUsers = 99;
|
|
135
|
+
*/
|
|
136
|
+
interface Output<OutputType> {}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Declare Input bindable set.`PropertyName`(input:`InputType`): void and `PropertyName`:`InputType`
|
|
141
|
+
* @remarks
|
|
142
|
+
* - **Widget** -> Parent
|
|
143
|
+
* - Convenience method, for symmetry with Output.
|
|
144
|
+
* - Flow:
|
|
145
|
+
* - Widget: Calls service set.`PropertyName`(`InputType`) to publish current value.
|
|
146
|
+
* - Parent: Mirrored generated widget property `PropertyName` is updated and emits change notification.
|
|
147
|
+
* @example
|
|
148
|
+
* // AnQst spec:
|
|
149
|
+
* currentUsername: AnQst.Input<string>;
|
|
150
|
+
* //Angular app template:
|
|
151
|
+
* <input type="text" placeholder="Your Name Here" (input)="userService.set.currentUsername(($event.target as HTMLInputElement).value)" />
|
|
152
|
+
* //Parent:
|
|
153
|
+
* QString userName = userMgmt.currentUsername;
|
|
154
|
+
*/
|
|
155
|
+
interface Input<InputType> {}
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Declare drop-target `PropertyName`:`PayloadType`
|
|
160
|
+
* @remarks
|
|
161
|
+
* - **Parent** -> Widget (framework-mediated)
|
|
162
|
+
* - True Angular signal semantics.
|
|
163
|
+
* - Flow:
|
|
164
|
+
* - External: A Qt widget initiates a QDrag carrying QMimeData.
|
|
165
|
+
* - Parent: AnQstWebHostBase intercepts the drop via event filter on the
|
|
166
|
+
* embedded QWebEngineView's rendering surface.
|
|
167
|
+
* - Parent: QMimeData for the accepted format is deserialized (JSON) into
|
|
168
|
+
* the generated C++ struct and forwarded through the bridge.
|
|
169
|
+
* - Widget: Service updates signal `PropertyName` with the deserialized
|
|
170
|
+
* payload and drop coordinates. Angular components react via effect() / template binding.
|
|
171
|
+
* - MIME type is convention-derived: `application/anqst-dragdropevent_<ServiceName>-<TypeName>`.
|
|
172
|
+
* - The source QWidget must serialize the drag payload as JSON under the same MIME type.
|
|
173
|
+
* - Multiple DropTarget members per service are allowed (each accepting a different type).
|
|
174
|
+
* @example
|
|
175
|
+
* // AnQst spec:
|
|
176
|
+
* trackDropped: AnQst.DropTarget<Track>;
|
|
177
|
+
* // Angular app:
|
|
178
|
+
* effect(() => {
|
|
179
|
+
* const drop = this.service.trackDropped();
|
|
180
|
+
* if (drop !== null) { console.log(drop.payload, drop.x, drop.y); }
|
|
181
|
+
* });
|
|
182
|
+
*/
|
|
183
|
+
interface DropTarget<T> { dummy: T }
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Declare hover-target `PropertyName`:`PayloadType`
|
|
188
|
+
* @remarks
|
|
189
|
+
* - **Parent** -> Widget (framework-mediated)
|
|
190
|
+
* - True Angular signal semantics.
|
|
191
|
+
* - Flow:
|
|
192
|
+
* - External: A Qt widget initiates a QDrag carrying QMimeData.
|
|
193
|
+
* - Parent: AnQstWebHostBase intercepts drag-move events via event filter on the
|
|
194
|
+
* embedded QWebEngineView's rendering surface. Events are throttled (trailing edge).
|
|
195
|
+
* - Parent: Payload is deserialized once on DragEnter; subsequent DragMove events
|
|
196
|
+
* forward only the updated position.
|
|
197
|
+
* - Widget: Service updates signal `PropertyName` with the payload and current
|
|
198
|
+
* coordinates. Signal becomes null on DragLeave.
|
|
199
|
+
* - Shares the same MIME type convention as DropTarget: `application/anqst-dragdropevent_<ServiceName>-<TypeName>`.
|
|
200
|
+
* - A HoverTarget without a corresponding DropTarget means "show previews but reject the drop".
|
|
201
|
+
* - Optional config supports throttle tuning:
|
|
202
|
+
* - `AnQst.HoverTarget<T, { maxRateHz: N }>` — maximum rate of hover position updates
|
|
203
|
+
* forwarded across the bridge, in hertz. The generator converts this to a millisecond
|
|
204
|
+
* interval at build time (e.g. 60 Hz -> 17 ms, 10 Hz -> 100 ms).
|
|
205
|
+
* - Default is 60 Hz (~17 ms throttle interval).
|
|
206
|
+
* - `0` means no throttling: every QDragMoveEvent is forwarded immediately.
|
|
207
|
+
* - There is no upper bound on the value.
|
|
208
|
+
* @example
|
|
209
|
+
* // AnQst spec (default 60 Hz throttle):
|
|
210
|
+
* trackHovering: AnQst.HoverTarget<Track>;
|
|
211
|
+
* // AnQst spec (custom 10 Hz throttle):
|
|
212
|
+
* trackHovering: AnQst.HoverTarget<Track, { maxRateHz: 10 }>;
|
|
213
|
+
* // AnQst spec (no throttling):
|
|
214
|
+
* trackHovering: AnQst.HoverTarget<Track, { maxRateHz: 0 }>;
|
|
215
|
+
* // Angular app:
|
|
216
|
+
* effect(() => {
|
|
217
|
+
* const hover = this.service.trackHovering();
|
|
218
|
+
* if (hover !== null) { highlight(document.elementFromPoint(hover.x, hover.y)); }
|
|
219
|
+
* });
|
|
220
|
+
*/
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Configuration for HoverTarget throttle behavior.
|
|
224
|
+
* @remarks
|
|
225
|
+
* - `maxRateHz` — Maximum rate in hertz at which hover position updates are forwarded.
|
|
226
|
+
* - Default (omitted or `{}`): 60 Hz.
|
|
227
|
+
* - `0`: No throttling; every QDragMoveEvent is forwarded.
|
|
228
|
+
* - No upper bound.
|
|
229
|
+
* - Value must be a numeric literal >= 0.
|
|
230
|
+
*/
|
|
231
|
+
type HoverTargetConfig = { maxRateHz: number } | {};
|
|
232
|
+
interface HoverTarget<T, Config extends HoverTargetConfig = {}> { dummy: T; config?: Config }
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* AnQst-Spec type mapping overview and control.
|
|
238
|
+
*
|
|
239
|
+
* @remarks
|
|
240
|
+
* Any Type that be mapped between TypeScript and Qt, C++ standard types or
|
|
241
|
+
* Plain Old Data (POD) types (in that order of preference) will be mapped by default.
|
|
242
|
+
*
|
|
243
|
+
* Canonical mapping directive namespace is AnQst.Type.<type>.
|
|
244
|
+
* To express advisory mapping preference, use AnQst.Type.<type>.
|
|
245
|
+
* Advisory means generator SHOULD honor it, but MAY fall back to inferred/default mapping and emit diagnostic.
|
|
246
|
+
* Array forms are equivalent: T[] == Array<T>, and AnQst.Type.X[] == Array<AnQst.Type.X>.
|
|
247
|
+
*
|
|
248
|
+
* TypeScript definitions+classes and C++ structs are generated for each
|
|
249
|
+
* structured TypeScript type ( type = {...} or interface { ... } )
|
|
250
|
+
* referenced in an AnQst spec.
|
|
251
|
+
*
|
|
252
|
+
*/
|
|
253
|
+
enum Type {
|
|
254
|
+
object = "JavaScript Object <-> QVariantMap (JSON.stringify/parse semantics)",
|
|
255
|
+
json = "JavaScript Object <-> QJsonObject (JSON.stringify/parse semantics)",
|
|
256
|
+
string = "JavaScript String <-> QString",
|
|
257
|
+
stringArray = "JavaScript String[] <-> QStringList",
|
|
258
|
+
number = "JavaScript Number <-> double",
|
|
259
|
+
qint64 = "JavaScript BigInt <-> qint64 (Default, for symmetry, same as direct use of <BigInt> which is allowed.)",
|
|
260
|
+
quint64 = "JavaScript BigInt <-> quint64",
|
|
261
|
+
qint32 = "JavaScript Number <-> qint32",
|
|
262
|
+
quint32 = "JavaScript Number <-> quint32",
|
|
263
|
+
qint16 = "JavaScript Number <-> qint16",
|
|
264
|
+
quint16 = "JavaScript Number <-> quint16",
|
|
265
|
+
qint8 = "JavaScript Number <-> qint8",
|
|
266
|
+
quint8 = "JavaScript Number <-> quint8",
|
|
267
|
+
int32 = "JavaScript Number <-> int32_t",
|
|
268
|
+
uint32 = "JavaScript Number <-> uint32_t",
|
|
269
|
+
int16 = "JavaScript Number <-> int16_t",
|
|
270
|
+
uint16 = "JavaScript Number <-> uint16_t",
|
|
271
|
+
int8 = "JavaScript Number <-> int8_t",
|
|
272
|
+
uint8 = "JavaScript Number <-> uint8_t",
|
|
273
|
+
buffer = "JavaScript ArrayBuffer <-> QByteArray (Default, for symmetry, same as direct use of <ArrayBuffer> which is allowed.)",
|
|
274
|
+
blob = "JavaScript ArrayBuffer <-> QByteArray",
|
|
275
|
+
typedArray = "JavaScript TypedArray <-> QByteArray",
|
|
276
|
+
uint8Array = "JavaScript Uint8Array <-> QByteArray",
|
|
277
|
+
int8Array = "JavaScript Int8Array <-> QByteArray",
|
|
278
|
+
uint16Array = "JavaScript Uint16Array <-> QByteArray",
|
|
279
|
+
int16Array = "JavaScript Int16Array <-> QByteArray",
|
|
280
|
+
uint32Array = "JavaScript Uint32Array <-> QByteArray",
|
|
281
|
+
int32Array = "JavaScript Int32Array <-> QByteArray",
|
|
282
|
+
float32Array = "JavaScript Float32Array <-> QByteArray",
|
|
283
|
+
float64Array = "JavaScript Float64Array <-> QByteArray",
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* These are explicitly forbidden argument/return types.
|
|
289
|
+
*
|
|
290
|
+
* @remarks
|
|
291
|
+
* - They may not be referenced in AnQst specs or imported types.
|
|
292
|
+
* - Service methods cannot accept them as arguments
|
|
293
|
+
* - Service methods cannot return them.
|
|
294
|
+
* - Service properties of their type cannot be declared.
|
|
295
|
+
*
|
|
296
|
+
* - For Objects/Maps/Sets use AnQst.Type.<Type> instead.
|
|
297
|
+
*/
|
|
298
|
+
export enum ForbiddenType {
|
|
299
|
+
Function = "Passing callbacks across the boundary is not allowed.",
|
|
300
|
+
Class = "Passing classes across the boundary is not allowed.",
|
|
301
|
+
Type = "Passing types across the boundary is not allowed.",
|
|
302
|
+
Promise = "Passing Promises across the boundary is not allowed",
|
|
303
|
+
Callable = "Passing Callable objects across the boundary is not allowed",
|
|
304
|
+
any = "Passing 'any' type across the boundary is not allowed",
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* JS/TS Error instances can be returned, but they have special meaning.
|
|
309
|
+
*
|
|
310
|
+
* @remarks
|
|
311
|
+
* AnQst is opinionated, Errors are not for control flow. They are for signalling unrecoverable and unhandled circumstance.
|
|
312
|
+
* Use: To indicate unrecoverable program error/wrong use.
|
|
313
|
+
* Don't use: To communicate expected and/or ignorable/handable situations, define a domain-specific transport type instad.
|
|
314
|
+
* When else encountered: Unhandled Errors.
|
|
315
|
+
* Effect: The receiving end throws an exception with message `<service>.<member> emitted error: <WidgetStackTrace>`
|
|
316
|
+
* AnQst internal behavior:
|
|
317
|
+
* When AnQst type translation/mapping encounters a true Error object instance, the Error object is not transported, instead
|
|
318
|
+
* the sending AnQst code signals to the receiving AnQst code a message, and the receiving AnQst code throws a runtime exception on
|
|
319
|
+
* the call or callback site in the Parent.
|
|
320
|
+
|
|
321
|
+
*/
|
|
322
|
+
export enum ExceptionalType {
|
|
323
|
+
Error = "AnQst will not transport an Error object, but will cause an exception to be thrown on reception site."
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
}
|
|
327
|
+
|