@ebusd/ebus-typespec 0.1.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/README.md +62 -0
- package/dist/src/csv_emitter.d.ts +14 -0
- package/dist/src/csv_emitter.js +493 -0
- package/dist/src/csv_emitter.js.map +1 -0
- package/dist/src/decorators.d.ts +284 -0
- package/dist/src/decorators.js +437 -0
- package/dist/src/decorators.js.map +1 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.js +16 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib.d.ts +214 -0
- package/dist/src/lib.js +124 -0
- package/dist/src/lib.js.map +1 -0
- package/dist/src/linter.d.ts +1 -0
- package/dist/src/linter.js +47 -0
- package/dist/src/linter.js.map +1 -0
- package/dist/src/rules/no-function.rule.d.ts +3 -0
- package/dist/src/rules/no-function.rule.js +17 -0
- package/dist/src/rules/no-function.rule.js.map +1 -0
- package/dist/src/rules/no-interface.rule.d.ts +3 -0
- package/dist/src/rules/no-interface.rule.js +17 -0
- package/dist/src/rules/no-interface.rule.js.map +1 -0
- package/dist/src/rules/no-intrinsic.rule.d.ts +3 -0
- package/dist/src/rules/no-intrinsic.rule.js +19 -0
- package/dist/src/rules/no-intrinsic.rule.js.map +1 -0
- package/dist/src/rules/no-literal.rule.d.ts +3 -0
- package/dist/src/rules/no-literal.rule.js +20 -0
- package/dist/src/rules/no-literal.rule.js.map +1 -0
- package/dist/src/rules/no-object.rule.d.ts +3 -0
- package/dist/src/rules/no-object.rule.js +17 -0
- package/dist/src/rules/no-object.rule.js.map +1 -0
- package/dist/src/rules/no-operation.rule.d.ts +3 -0
- package/dist/src/rules/no-operation.rule.js +19 -0
- package/dist/src/rules/no-operation.rule.js.map +1 -0
- package/dist/src/rules/no-projection.rule.d.ts +3 -0
- package/dist/src/rules/no-projection.rule.js +17 -0
- package/dist/src/rules/no-projection.rule.js.map +1 -0
- package/dist/src/rules/no-template.rule.d.ts +3 -0
- package/dist/src/rules/no-template.rule.js +20 -0
- package/dist/src/rules/no-template.rule.js.map +1 -0
- package/dist/src/rules/no-tuple.rule.d.ts +3 -0
- package/dist/src/rules/no-tuple.rule.js +17 -0
- package/dist/src/rules/no-tuple.rule.js.map +1 -0
- package/dist/src/rules/no-union.rule.d.ts +3 -0
- package/dist/src/rules/no-union.rule.js +20 -0
- package/dist/src/rules/no-union.rule.js.map +1 -0
- package/dist/src/testing/index.d.ts +2 -0
- package/dist/src/testing/index.js +6 -0
- package/dist/src/testing/index.js.map +1 -0
- package/docs.md +453 -0
- package/lib/decorators.tsp +127 -0
- package/lib/main.tsp +3 -0
- package/lib/models.tsp +61 -0
- package/lib/types.tsp +169 -0
- package/package.json +61 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { type DecoratorContext, type Enum, type Model, type ModelProperty, type Namespace, type Program, type Scalar, type UnionVariant } from "@typespec/compiler";
|
|
2
|
+
export declare const namespace = "Ebus";
|
|
3
|
+
/**
|
|
4
|
+
* Implementation of the `@condition` decorator.
|
|
5
|
+
*
|
|
6
|
+
* @param context Decorator context.
|
|
7
|
+
* @param target Decorator target.
|
|
8
|
+
* @param value the value to set.
|
|
9
|
+
*/
|
|
10
|
+
export declare function $condition(context: DecoratorContext, target: Model | Namespace | UnionVariant, property: ModelProperty | Model, ...values: string[]): void;
|
|
11
|
+
/**
|
|
12
|
+
* Accessor for the `@condition` decorator.
|
|
13
|
+
*
|
|
14
|
+
* @param program TypeSpec program.
|
|
15
|
+
* @param target Decorator target.
|
|
16
|
+
* @returns value if provided on the given target or undefined.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getConditions(program: Program, target: Model | Namespace | UnionVariant): [ModelProperty | Model, ...string[]][];
|
|
19
|
+
/**
|
|
20
|
+
* Implementation of the `@write` decorator.
|
|
21
|
+
*
|
|
22
|
+
* @param context Decorator context.
|
|
23
|
+
* @param target Decorator target.
|
|
24
|
+
*/
|
|
25
|
+
export declare function $write(context: DecoratorContext, target: Model): void;
|
|
26
|
+
/**
|
|
27
|
+
* Accessor for the `@write` decorator.
|
|
28
|
+
*
|
|
29
|
+
* @param program TypeSpec program.
|
|
30
|
+
* @param target Decorator target.
|
|
31
|
+
* @returns value if provided on the given target or undefined.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getWrite(program: Program, target: Model): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Implementation of the `@passive` decorator.
|
|
36
|
+
*
|
|
37
|
+
* @param context Decorator context.
|
|
38
|
+
* @param target Decorator target.
|
|
39
|
+
*/
|
|
40
|
+
export declare function $passive(context: DecoratorContext, target: Model): void;
|
|
41
|
+
/**
|
|
42
|
+
* Accessor for the `@passive` decorator.
|
|
43
|
+
*
|
|
44
|
+
* @param program TypeSpec program.
|
|
45
|
+
* @param target Decorator target.
|
|
46
|
+
* @returns value if provided on the given target or undefined.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getPassive(program: Program, target: Model): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Implementation of the `@auth` decorator.
|
|
51
|
+
*
|
|
52
|
+
* @param context Decorator context.
|
|
53
|
+
* @param target Decorator target.
|
|
54
|
+
* @param value the value to set.
|
|
55
|
+
*/
|
|
56
|
+
export declare function $auth(context: DecoratorContext, target: Model, value: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Accessor for the `@auth` decorator.
|
|
59
|
+
*
|
|
60
|
+
* @param program TypeSpec program.
|
|
61
|
+
* @param target Decorator target.
|
|
62
|
+
* @returns value if provided on the given target or undefined.
|
|
63
|
+
*/
|
|
64
|
+
export declare function getAuth(program: Program, target: Model): string | undefined;
|
|
65
|
+
export declare const isSourceAddr: (qq?: number) => boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Implementation of the `@qq` decorator.
|
|
68
|
+
*
|
|
69
|
+
* @param context Decorator context.
|
|
70
|
+
* @param target Decorator target.
|
|
71
|
+
* @param value the value to set.
|
|
72
|
+
*/
|
|
73
|
+
export declare function $qq(context: DecoratorContext, target: Model, value?: number): void;
|
|
74
|
+
/**
|
|
75
|
+
* Accessor for the `@qq` decorator.
|
|
76
|
+
*
|
|
77
|
+
* @param program TypeSpec program.
|
|
78
|
+
* @param target Decorator target.
|
|
79
|
+
* @returns value if provided on the given target or undefined.
|
|
80
|
+
*/
|
|
81
|
+
export declare function getQq(program: Program, target: Model): number | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Implementation of the `@zz` decorator.
|
|
84
|
+
*
|
|
85
|
+
* @param context Decorator context.
|
|
86
|
+
* @param target Decorator target.
|
|
87
|
+
* @param value the value to set.
|
|
88
|
+
*/
|
|
89
|
+
export declare function $zz(context: DecoratorContext, target: Model | Namespace, value?: number): void;
|
|
90
|
+
/**
|
|
91
|
+
* Accessor for the `@zz` decorator.
|
|
92
|
+
*
|
|
93
|
+
* @param program TypeSpec program.
|
|
94
|
+
* @param target Decorator target.
|
|
95
|
+
* @returns value if provided on the given target or undefined.
|
|
96
|
+
*/
|
|
97
|
+
export declare function getZz(program: Program, target: Model | Namespace): number | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Implementation of the `@id` decorator.
|
|
100
|
+
*
|
|
101
|
+
* @param context Decorator context.
|
|
102
|
+
* @param target Decorator target.
|
|
103
|
+
* @param value the value to set.
|
|
104
|
+
*/
|
|
105
|
+
export declare function $id(context: DecoratorContext, target: Model, pb: number, sb: number, ...dd: number[]): void;
|
|
106
|
+
/**
|
|
107
|
+
* Implementation of the `@base` decorator.
|
|
108
|
+
*
|
|
109
|
+
* @param context Decorator context.
|
|
110
|
+
* @param target Decorator target.
|
|
111
|
+
* @param value the value to set.
|
|
112
|
+
*/
|
|
113
|
+
export declare function $base(context: DecoratorContext, target: Model, pb: number, sb: number, ...dd: number[]): void;
|
|
114
|
+
/**
|
|
115
|
+
* Implementation of the `@ext` decorator.
|
|
116
|
+
*
|
|
117
|
+
* @param context Decorator context.
|
|
118
|
+
* @param target Decorator target.
|
|
119
|
+
* @param value the value to set.
|
|
120
|
+
*/
|
|
121
|
+
export declare function $ext(context: DecoratorContext, target: Model, ...dd: number[]): void;
|
|
122
|
+
/**
|
|
123
|
+
* Accessor for the `@id` decorator.
|
|
124
|
+
*
|
|
125
|
+
* @param program TypeSpec program.
|
|
126
|
+
* @param target Decorator target.
|
|
127
|
+
* @returns value if provided on the given target or undefined.
|
|
128
|
+
*/
|
|
129
|
+
export declare function getId(program: Program, target: Model): number[] | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* Implementation of the `@inherit` decorator.
|
|
132
|
+
*
|
|
133
|
+
* @param context Decorator context.
|
|
134
|
+
* @param target Decorator target.
|
|
135
|
+
* @param value the inherited models.
|
|
136
|
+
*/
|
|
137
|
+
export declare function $inherit(context: DecoratorContext, target: Model, first: Model, ...other: Model[]): void;
|
|
138
|
+
/**
|
|
139
|
+
* Accessor for the `@inherit` decorator.
|
|
140
|
+
*
|
|
141
|
+
* @param program TypeSpec program.
|
|
142
|
+
* @param target Decorator target.
|
|
143
|
+
* @returns value if provided on the given target or undefined.
|
|
144
|
+
*/
|
|
145
|
+
export declare function getInherit(program: Program, target: Model): Model[];
|
|
146
|
+
/**
|
|
147
|
+
* Implementation of the `@reverse` decorator.
|
|
148
|
+
*
|
|
149
|
+
* @param context Decorator context.
|
|
150
|
+
* @param target Decorator target.
|
|
151
|
+
*/
|
|
152
|
+
export declare function $reverse(context: DecoratorContext, target: Scalar): void;
|
|
153
|
+
/**
|
|
154
|
+
* Accessor for the `@reverse` decorator.
|
|
155
|
+
*
|
|
156
|
+
* @param program TypeSpec program.
|
|
157
|
+
* @param target Decorator target.
|
|
158
|
+
* @returns value if provided on the given target or undefined.
|
|
159
|
+
*/
|
|
160
|
+
export declare function getReverse(program: Program, target: Scalar): boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Implementation of the `@bcd` decorator.
|
|
163
|
+
*
|
|
164
|
+
* @param context Decorator context.
|
|
165
|
+
* @param target Decorator target.
|
|
166
|
+
*/
|
|
167
|
+
export declare function $bcd(context: DecoratorContext, target: Scalar): void;
|
|
168
|
+
/**
|
|
169
|
+
* Accessor for the `@bcd` decorator.
|
|
170
|
+
*
|
|
171
|
+
* @param program TypeSpec program.
|
|
172
|
+
* @param target Decorator target.
|
|
173
|
+
* @returns value if provided on the given target or undefined.
|
|
174
|
+
*/
|
|
175
|
+
export declare function getBcd(program: Program, target: Scalar): boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Implementation of the `@hex` decorator.
|
|
178
|
+
*
|
|
179
|
+
* @param context Decorator context.
|
|
180
|
+
* @param target Decorator target.
|
|
181
|
+
*/
|
|
182
|
+
export declare function $hex(context: DecoratorContext, target: Scalar): void;
|
|
183
|
+
/**
|
|
184
|
+
* Accessor for the `@hex` decorator.
|
|
185
|
+
*
|
|
186
|
+
* @param program TypeSpec program.
|
|
187
|
+
* @param target Decorator target.
|
|
188
|
+
* @returns value if provided on the given target or undefined.
|
|
189
|
+
*/
|
|
190
|
+
export declare function getHex(program: Program, target: Scalar): boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Implementation of the `@maxBits` decorator.
|
|
193
|
+
*
|
|
194
|
+
* @param context Decorator context.
|
|
195
|
+
* @param target Decorator target.
|
|
196
|
+
* @param value the value to set.
|
|
197
|
+
*/
|
|
198
|
+
export declare function $maxBits(context: DecoratorContext, target: Scalar, value: number): void;
|
|
199
|
+
/**
|
|
200
|
+
* Accessor for the `@maxBits` decorator.
|
|
201
|
+
*
|
|
202
|
+
* @param program TypeSpec program.
|
|
203
|
+
* @param target Decorator target.
|
|
204
|
+
* @returns value if provided on the given target or undefined.
|
|
205
|
+
*/
|
|
206
|
+
export declare function getMaxBits(program: Program, target: Scalar): number | undefined;
|
|
207
|
+
/**
|
|
208
|
+
* Implementation of the `@in` decorator.
|
|
209
|
+
*
|
|
210
|
+
* @param context Decorator context.
|
|
211
|
+
* @param target Decorator target.
|
|
212
|
+
*/
|
|
213
|
+
export declare function $in(context: DecoratorContext, target: ModelProperty): void;
|
|
214
|
+
/**
|
|
215
|
+
* Implementation of the `@out` decorator.
|
|
216
|
+
*
|
|
217
|
+
* @param context Decorator context.
|
|
218
|
+
* @param target Decorator target.
|
|
219
|
+
*/
|
|
220
|
+
export declare function $out(context: DecoratorContext, target: ModelProperty): void;
|
|
221
|
+
/**
|
|
222
|
+
* Accessor for the `@in`/`@out` decorators.
|
|
223
|
+
*
|
|
224
|
+
* @param program TypeSpec program.
|
|
225
|
+
* @param target Decorator target.
|
|
226
|
+
* @returns value if provided on the given target (true when `out`, false when `in`), or undefined.
|
|
227
|
+
*/
|
|
228
|
+
export declare function getOut(program: Program, target: ModelProperty): boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Implementation of the `@unit` decorator.
|
|
231
|
+
*
|
|
232
|
+
* @param context Decorator context.
|
|
233
|
+
* @param target Decorator target.
|
|
234
|
+
* @param value the value to set.
|
|
235
|
+
*/
|
|
236
|
+
export declare function $unit(context: DecoratorContext, target: Scalar | ModelProperty, value?: string): void;
|
|
237
|
+
/**
|
|
238
|
+
* Accessor for the `@unit` decorator.
|
|
239
|
+
*
|
|
240
|
+
* @param program TypeSpec program.
|
|
241
|
+
* @param target Decorator target.
|
|
242
|
+
* @returns value if provided on the given target or undefined.
|
|
243
|
+
*/
|
|
244
|
+
export declare function getUnit(program: Program, target: Scalar | ModelProperty): string | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* Implementation of the `@divisor` decorator.
|
|
247
|
+
*
|
|
248
|
+
* @param context Decorator context.
|
|
249
|
+
* @param target Decorator target.
|
|
250
|
+
* @param value the value to set.
|
|
251
|
+
*/
|
|
252
|
+
export declare function $divisor(context: DecoratorContext, target: Scalar | ModelProperty, value: number): void;
|
|
253
|
+
/**
|
|
254
|
+
* Implementation of the `@factor` decorator.
|
|
255
|
+
*
|
|
256
|
+
* @param context Decorator context.
|
|
257
|
+
* @param target Decorator target.
|
|
258
|
+
* @param value the value to set.
|
|
259
|
+
*/
|
|
260
|
+
export declare function $factor(context: DecoratorContext, target: Scalar | ModelProperty, value: number): void;
|
|
261
|
+
/**
|
|
262
|
+
* Accessor for the `@divisor` decorator.
|
|
263
|
+
*
|
|
264
|
+
* @param program TypeSpec program.
|
|
265
|
+
* @param target Decorator target.
|
|
266
|
+
* @returns value if provided on the given target or undefined.
|
|
267
|
+
*/
|
|
268
|
+
export declare function getDivisor(program: Program, target: Scalar | ModelProperty): number | undefined;
|
|
269
|
+
/**
|
|
270
|
+
* Implementation of the `@values` decorator.
|
|
271
|
+
*
|
|
272
|
+
* @param context Decorator context.
|
|
273
|
+
* @param target Decorator target.
|
|
274
|
+
* @param value the value to set.
|
|
275
|
+
*/
|
|
276
|
+
export declare function $values(context: DecoratorContext, target: Scalar | ModelProperty, value: Enum): void;
|
|
277
|
+
/**
|
|
278
|
+
* Accessor for the `@values` decorator.
|
|
279
|
+
*
|
|
280
|
+
* @param program TypeSpec program.
|
|
281
|
+
* @param target Decorator target.
|
|
282
|
+
* @returns value if provided on the given target or undefined.
|
|
283
|
+
*/
|
|
284
|
+
export declare function getValues(program: Program, target: Scalar | ModelProperty): Enum | undefined;
|