@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.
Files changed (55) hide show
  1. package/README.md +62 -0
  2. package/dist/src/csv_emitter.d.ts +14 -0
  3. package/dist/src/csv_emitter.js +493 -0
  4. package/dist/src/csv_emitter.js.map +1 -0
  5. package/dist/src/decorators.d.ts +284 -0
  6. package/dist/src/decorators.js +437 -0
  7. package/dist/src/decorators.js.map +1 -0
  8. package/dist/src/index.d.ts +6 -0
  9. package/dist/src/index.js +16 -0
  10. package/dist/src/index.js.map +1 -0
  11. package/dist/src/lib.d.ts +214 -0
  12. package/dist/src/lib.js +124 -0
  13. package/dist/src/lib.js.map +1 -0
  14. package/dist/src/linter.d.ts +1 -0
  15. package/dist/src/linter.js +47 -0
  16. package/dist/src/linter.js.map +1 -0
  17. package/dist/src/rules/no-function.rule.d.ts +3 -0
  18. package/dist/src/rules/no-function.rule.js +17 -0
  19. package/dist/src/rules/no-function.rule.js.map +1 -0
  20. package/dist/src/rules/no-interface.rule.d.ts +3 -0
  21. package/dist/src/rules/no-interface.rule.js +17 -0
  22. package/dist/src/rules/no-interface.rule.js.map +1 -0
  23. package/dist/src/rules/no-intrinsic.rule.d.ts +3 -0
  24. package/dist/src/rules/no-intrinsic.rule.js +19 -0
  25. package/dist/src/rules/no-intrinsic.rule.js.map +1 -0
  26. package/dist/src/rules/no-literal.rule.d.ts +3 -0
  27. package/dist/src/rules/no-literal.rule.js +20 -0
  28. package/dist/src/rules/no-literal.rule.js.map +1 -0
  29. package/dist/src/rules/no-object.rule.d.ts +3 -0
  30. package/dist/src/rules/no-object.rule.js +17 -0
  31. package/dist/src/rules/no-object.rule.js.map +1 -0
  32. package/dist/src/rules/no-operation.rule.d.ts +3 -0
  33. package/dist/src/rules/no-operation.rule.js +19 -0
  34. package/dist/src/rules/no-operation.rule.js.map +1 -0
  35. package/dist/src/rules/no-projection.rule.d.ts +3 -0
  36. package/dist/src/rules/no-projection.rule.js +17 -0
  37. package/dist/src/rules/no-projection.rule.js.map +1 -0
  38. package/dist/src/rules/no-template.rule.d.ts +3 -0
  39. package/dist/src/rules/no-template.rule.js +20 -0
  40. package/dist/src/rules/no-template.rule.js.map +1 -0
  41. package/dist/src/rules/no-tuple.rule.d.ts +3 -0
  42. package/dist/src/rules/no-tuple.rule.js +17 -0
  43. package/dist/src/rules/no-tuple.rule.js.map +1 -0
  44. package/dist/src/rules/no-union.rule.d.ts +3 -0
  45. package/dist/src/rules/no-union.rule.js +20 -0
  46. package/dist/src/rules/no-union.rule.js.map +1 -0
  47. package/dist/src/testing/index.d.ts +2 -0
  48. package/dist/src/testing/index.js +6 -0
  49. package/dist/src/testing/index.js.map +1 -0
  50. package/docs.md +453 -0
  51. package/lib/decorators.tsp +127 -0
  52. package/lib/main.tsp +3 -0
  53. package/lib/models.tsp +61 -0
  54. package/lib/types.tsp +169 -0
  55. package/package.json +61 -0
@@ -0,0 +1,214 @@
1
+ import { type JSONSchemaType } from "@typespec/compiler";
2
+ export type FileType = "csv";
3
+ export interface EbusdEmitterOptions {
4
+ /**
5
+ * Serialize the schema as either csv, yaml, or json.
6
+ * @default csv
7
+ */
8
+ "file-type"?: FileType;
9
+ /** Emit includes files as includes instead of inline (incomplete!). */
10
+ includes?: boolean;
11
+ }
12
+ export declare const EmitterOptionsSchema: JSONSchemaType<EbusdEmitterOptions>;
13
+ export declare const $lib: import("@typespec/compiler").TypeSpecLibrary<{
14
+ "banned-source-address": {
15
+ default: import("@typespec/compiler").CallableMessage<[string]>;
16
+ };
17
+ "banned-target-address": {
18
+ default: import("@typespec/compiler").CallableMessage<[string]>;
19
+ };
20
+ "banned-auth": {
21
+ default: import("@typespec/compiler").CallableMessage<[string]>;
22
+ };
23
+ "banned-divisor": {
24
+ default: import("@typespec/compiler").CallableMessage<[string]>;
25
+ };
26
+ "banned-factor": {
27
+ default: import("@typespec/compiler").CallableMessage<[string]>;
28
+ };
29
+ "banned-values": {
30
+ default: import("@typespec/compiler").CallableMessage<[string]>;
31
+ };
32
+ "banned-type": {
33
+ default: import("@typespec/compiler").CallableMessage<[string, string]>;
34
+ };
35
+ "banned-length": {
36
+ default: import("@typespec/compiler").CallableMessage<[string, string]>;
37
+ };
38
+ "banned-in": {
39
+ default: import("@typespec/compiler").CallableMessage<[]>;
40
+ };
41
+ "duplicate-id": {
42
+ default: import("@typespec/compiler").CallableMessage<[string]>;
43
+ };
44
+ "short-id": {
45
+ default: import("@typespec/compiler").CallableMessage<[string]>;
46
+ };
47
+ "banned-inheritance": {
48
+ default: import("@typespec/compiler").CallableMessage<[]>;
49
+ };
50
+ "duplicate-name": {
51
+ default: import("@typespec/compiler").CallableMessage<[string]>;
52
+ };
53
+ }, EbusdEmitterOptions, "values" | "reverse" | "unit" | "id" | "condition" | "write" | "passive" | "auth" | "qq" | "zz" | "inherit" | "bcd" | "hex" | "maxBits" | "out" | "divisor">;
54
+ export declare const reportDiagnostic: <C extends "banned-source-address" | "banned-target-address" | "banned-auth" | "banned-divisor" | "banned-factor" | "banned-values" | "banned-type" | "banned-length" | "banned-in" | "duplicate-id" | "short-id" | "banned-inheritance" | "duplicate-name", M extends keyof {
55
+ "banned-source-address": {
56
+ default: import("@typespec/compiler").CallableMessage<[string]>;
57
+ };
58
+ "banned-target-address": {
59
+ default: import("@typespec/compiler").CallableMessage<[string]>;
60
+ };
61
+ "banned-auth": {
62
+ default: import("@typespec/compiler").CallableMessage<[string]>;
63
+ };
64
+ "banned-divisor": {
65
+ default: import("@typespec/compiler").CallableMessage<[string]>;
66
+ };
67
+ "banned-factor": {
68
+ default: import("@typespec/compiler").CallableMessage<[string]>;
69
+ };
70
+ "banned-values": {
71
+ default: import("@typespec/compiler").CallableMessage<[string]>;
72
+ };
73
+ "banned-type": {
74
+ default: import("@typespec/compiler").CallableMessage<[string, string]>;
75
+ };
76
+ "banned-length": {
77
+ default: import("@typespec/compiler").CallableMessage<[string, string]>;
78
+ };
79
+ "banned-in": {
80
+ default: import("@typespec/compiler").CallableMessage<[]>;
81
+ };
82
+ "duplicate-id": {
83
+ default: import("@typespec/compiler").CallableMessage<[string]>;
84
+ };
85
+ "short-id": {
86
+ default: import("@typespec/compiler").CallableMessage<[string]>;
87
+ };
88
+ "banned-inheritance": {
89
+ default: import("@typespec/compiler").CallableMessage<[]>;
90
+ };
91
+ "duplicate-name": {
92
+ default: import("@typespec/compiler").CallableMessage<[string]>;
93
+ };
94
+ }[C]>(program: import("@typespec/compiler").Program, diag: import("@typespec/compiler").DiagnosticReport<{
95
+ "banned-source-address": {
96
+ default: import("@typespec/compiler").CallableMessage<[string]>;
97
+ };
98
+ "banned-target-address": {
99
+ default: import("@typespec/compiler").CallableMessage<[string]>;
100
+ };
101
+ "banned-auth": {
102
+ default: import("@typespec/compiler").CallableMessage<[string]>;
103
+ };
104
+ "banned-divisor": {
105
+ default: import("@typespec/compiler").CallableMessage<[string]>;
106
+ };
107
+ "banned-factor": {
108
+ default: import("@typespec/compiler").CallableMessage<[string]>;
109
+ };
110
+ "banned-values": {
111
+ default: import("@typespec/compiler").CallableMessage<[string]>;
112
+ };
113
+ "banned-type": {
114
+ default: import("@typespec/compiler").CallableMessage<[string, string]>;
115
+ };
116
+ "banned-length": {
117
+ default: import("@typespec/compiler").CallableMessage<[string, string]>;
118
+ };
119
+ "banned-in": {
120
+ default: import("@typespec/compiler").CallableMessage<[]>;
121
+ };
122
+ "duplicate-id": {
123
+ default: import("@typespec/compiler").CallableMessage<[string]>;
124
+ };
125
+ "short-id": {
126
+ default: import("@typespec/compiler").CallableMessage<[string]>;
127
+ };
128
+ "banned-inheritance": {
129
+ default: import("@typespec/compiler").CallableMessage<[]>;
130
+ };
131
+ "duplicate-name": {
132
+ default: import("@typespec/compiler").CallableMessage<[string]>;
133
+ };
134
+ }, C, M>) => void, createDiagnostic: <C extends "banned-source-address" | "banned-target-address" | "banned-auth" | "banned-divisor" | "banned-factor" | "banned-values" | "banned-type" | "banned-length" | "banned-in" | "duplicate-id" | "short-id" | "banned-inheritance" | "duplicate-name", M extends keyof {
135
+ "banned-source-address": {
136
+ default: import("@typespec/compiler").CallableMessage<[string]>;
137
+ };
138
+ "banned-target-address": {
139
+ default: import("@typespec/compiler").CallableMessage<[string]>;
140
+ };
141
+ "banned-auth": {
142
+ default: import("@typespec/compiler").CallableMessage<[string]>;
143
+ };
144
+ "banned-divisor": {
145
+ default: import("@typespec/compiler").CallableMessage<[string]>;
146
+ };
147
+ "banned-factor": {
148
+ default: import("@typespec/compiler").CallableMessage<[string]>;
149
+ };
150
+ "banned-values": {
151
+ default: import("@typespec/compiler").CallableMessage<[string]>;
152
+ };
153
+ "banned-type": {
154
+ default: import("@typespec/compiler").CallableMessage<[string, string]>;
155
+ };
156
+ "banned-length": {
157
+ default: import("@typespec/compiler").CallableMessage<[string, string]>;
158
+ };
159
+ "banned-in": {
160
+ default: import("@typespec/compiler").CallableMessage<[]>;
161
+ };
162
+ "duplicate-id": {
163
+ default: import("@typespec/compiler").CallableMessage<[string]>;
164
+ };
165
+ "short-id": {
166
+ default: import("@typespec/compiler").CallableMessage<[string]>;
167
+ };
168
+ "banned-inheritance": {
169
+ default: import("@typespec/compiler").CallableMessage<[]>;
170
+ };
171
+ "duplicate-name": {
172
+ default: import("@typespec/compiler").CallableMessage<[string]>;
173
+ };
174
+ }[C]>(diag: import("@typespec/compiler").DiagnosticReport<{
175
+ "banned-source-address": {
176
+ default: import("@typespec/compiler").CallableMessage<[string]>;
177
+ };
178
+ "banned-target-address": {
179
+ default: import("@typespec/compiler").CallableMessage<[string]>;
180
+ };
181
+ "banned-auth": {
182
+ default: import("@typespec/compiler").CallableMessage<[string]>;
183
+ };
184
+ "banned-divisor": {
185
+ default: import("@typespec/compiler").CallableMessage<[string]>;
186
+ };
187
+ "banned-factor": {
188
+ default: import("@typespec/compiler").CallableMessage<[string]>;
189
+ };
190
+ "banned-values": {
191
+ default: import("@typespec/compiler").CallableMessage<[string]>;
192
+ };
193
+ "banned-type": {
194
+ default: import("@typespec/compiler").CallableMessage<[string, string]>;
195
+ };
196
+ "banned-length": {
197
+ default: import("@typespec/compiler").CallableMessage<[string, string]>;
198
+ };
199
+ "banned-in": {
200
+ default: import("@typespec/compiler").CallableMessage<[]>;
201
+ };
202
+ "duplicate-id": {
203
+ default: import("@typespec/compiler").CallableMessage<[string]>;
204
+ };
205
+ "short-id": {
206
+ default: import("@typespec/compiler").CallableMessage<[string]>;
207
+ };
208
+ "banned-inheritance": {
209
+ default: import("@typespec/compiler").CallableMessage<[]>;
210
+ };
211
+ "duplicate-name": {
212
+ default: import("@typespec/compiler").CallableMessage<[string]>;
213
+ };
214
+ }, C, M>) => import("@typespec/compiler").Diagnostic, StateKeys: Record<"values" | "reverse" | "unit" | "id" | "condition" | "write" | "passive" | "auth" | "qq" | "zz" | "inherit" | "bcd" | "hex" | "maxBits" | "out" | "divisor", symbol>;
@@ -0,0 +1,124 @@
1
+ import { createTypeSpecLibrary, paramMessage } from "@typespec/compiler";
2
+ export const EmitterOptionsSchema = {
3
+ type: "object",
4
+ additionalProperties: false,
5
+ properties: {
6
+ "file-type": {
7
+ type: "string",
8
+ enum: ["csv"], //, "yaml", "json"],
9
+ nullable: true,
10
+ description: "Serialize the schema as csv", //either csv, yaml, or json.",
11
+ },
12
+ includes: {
13
+ type: "boolean",
14
+ nullable: true,
15
+ description: "Emit includes files as includes instead of inline (incomplete!)",
16
+ }
17
+ },
18
+ };
19
+ export const $lib = createTypeSpecLibrary({
20
+ name: "ebus",
21
+ diagnostics: {
22
+ "banned-source-address": {
23
+ severity: "error",
24
+ messages: {
25
+ default: paramMessage `Invalid source address "${"value"}".`,
26
+ },
27
+ },
28
+ "banned-target-address": {
29
+ severity: "error",
30
+ messages: {
31
+ default: paramMessage `Invalid target address "${"value"}".`,
32
+ },
33
+ },
34
+ "banned-auth": {
35
+ severity: "error",
36
+ messages: {
37
+ default: paramMessage `Invalid auth "${"value"}".`,
38
+ },
39
+ },
40
+ "banned-divisor": {
41
+ severity: "error",
42
+ messages: {
43
+ default: paramMessage `Invalid divisor value "${"value"}".`,
44
+ },
45
+ },
46
+ "banned-factor": {
47
+ severity: "error",
48
+ messages: {
49
+ default: paramMessage `Invalid factor value "${"value"}".`,
50
+ },
51
+ },
52
+ "banned-values": {
53
+ severity: "error",
54
+ messages: {
55
+ default: paramMessage `Invalid values ${"detail"}.`,
56
+ },
57
+ },
58
+ "banned-type": {
59
+ severity: "error",
60
+ messages: {
61
+ default: paramMessage `Invalid type ${"type"} with name "${"name"}".`,
62
+ },
63
+ },
64
+ "banned-length": {
65
+ severity: "error",
66
+ messages: {
67
+ default: paramMessage `Invalid @${"which"} exceeding ${"value"}.`,
68
+ },
69
+ },
70
+ "banned-in": {
71
+ severity: "error",
72
+ messages: {
73
+ default: paramMessage `Invalid @in with broadcast target.`,
74
+ },
75
+ },
76
+ "duplicate-id": {
77
+ severity: "error",
78
+ messages: {
79
+ default: paramMessage `There are multiple models with the same id "${"id"}".`,
80
+ },
81
+ },
82
+ "short-id": {
83
+ severity: "error",
84
+ messages: {
85
+ default: paramMessage `The id "${"id"}" is too short.`,
86
+ },
87
+ },
88
+ "banned-inheritance": {
89
+ severity: "error",
90
+ messages: {
91
+ default: paramMessage `The inheritance is too deep.`,
92
+ },
93
+ },
94
+ "duplicate-name": {
95
+ severity: "error",
96
+ messages: {
97
+ default: paramMessage `There are multiple models types with the same id "${"id"}".`,
98
+ },
99
+ },
100
+ },
101
+ emitter: {
102
+ options: EmitterOptionsSchema,
103
+ },
104
+ state: {
105
+ condition: { description: "message condition(s)" },
106
+ write: { description: "write direction" },
107
+ passive: { description: "passive only" },
108
+ auth: { description: "authentication level" },
109
+ qq: { description: "source address QQ" },
110
+ zz: { description: "target address ZZ" },
111
+ id: { description: "message ID" },
112
+ inherit: { description: "inherited model(s)" },
113
+ bcd: { description: 'BCD encoding' },
114
+ hex: { description: 'HEX encoding' },
115
+ maxBits: { description: 'max number of bits' },
116
+ out: { description: 'outbound/inbound message part' },
117
+ reverse: { description: "reverse representation" },
118
+ unit: { description: "unit" },
119
+ divisor: { description: "divisor" },
120
+ values: { description: "known values" },
121
+ },
122
+ });
123
+ export const { reportDiagnostic, createDiagnostic, stateKeys: StateKeys } = $lib;
124
+ //# sourceMappingURL=lib.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,qBAAqB,EAAE,YAAY,EAAsB,MAAM,oBAAoB,CAAC;AAc5F,MAAM,CAAC,MAAM,oBAAoB,GAAwC;IACvE,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,KAAK,CAAC,EAAC,oBAAoB;YAClC,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,6BAA6B,EAAE,8BAA8B;SAC3E;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,iEAAiE;SAC/E;KACF;CACF,CAAA;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,qBAAqB,CAAC;IACxC,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE;QACX,uBAAuB,EAAE;YACvB,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,2BAA2B,OAAO,IAAI;aAC5D;SACF;QACD,uBAAuB,EAAE;YACvB,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,2BAA2B,OAAO,IAAI;aAC5D;SACF;QACD,aAAa,EAAE;YACb,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,iBAAiB,OAAO,IAAI;aAClD;SACF;QACD,gBAAgB,EAAE;YAChB,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR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ACL,SAAS,EAAE,EAAE,WAAW,EAAE,sBAAsB,EAAE;QAClD,KAAK,EAAE,EAAE,WAAW,EAAE,iBAAiB,EAAE;QACzC,OAAO,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE;QACxC,IAAI,EAAE,EAAE,WAAW,EAAE,sBAAsB,EAAE;QAC7C,EAAE,EAAE,EAAE,WAAW,EAAE,mBAAmB,EAAE;QACxC,EAAE,EAAE,EAAE,WAAW,EAAE,mBAAmB,EAAE;QACxC,EAAE,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE;QACjC,OAAO,EAAE,EAAE,WAAW,EAAE,oBAAoB,EAAE;QAC9C,GAAG,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE;QACpC,GAAG,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE;QACpC,OAAO,EAAE,EAAE,WAAW,EAAE,oBAAoB,EAAE;QAC9C,GAAG,EAAE,EAAE,WAAW,EAAE,+BAA+B,EAAE;QACrD,OAAO,EAAE,EAAE,WAAW,EAAE,wBAAwB,EAAE;QAClD,IAAI,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE;QAC7B,OAAO,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE;QACnC,MAAM,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE;KACxC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const $linter: import("@typespec/compiler").LinterDefinition;
@@ -0,0 +1,47 @@
1
+ import { defineLinter } from "@typespec/compiler";
2
+ import { noFunctionRule } from "./rules/no-function.rule.js";
3
+ import { noInterfaceRule } from "./rules/no-interface.rule.js";
4
+ import { noIntrinsicRule } from "./rules/no-intrinsic.rule.js";
5
+ import { noLiteralRule } from "./rules/no-literal.rule.js";
6
+ import { noObjectRule } from "./rules/no-object.rule.js";
7
+ import { noOperationRule } from "./rules/no-operation.rule.js";
8
+ import { noProjectionRule } from "./rules/no-projection.rule.js";
9
+ import { noTemplateRule } from "./rules/no-template.rule.js";
10
+ import { noTupleRule } from "./rules/no-tuple.rule.js";
11
+ import { noUnionRule } from "./rules/no-union.rule.js";
12
+ export const $linter = defineLinter({
13
+ rules: [noFunctionRule, noInterfaceRule, noIntrinsicRule, noLiteralRule,
14
+ noObjectRule, noOperationRule, noProjectionRule, noTemplateRule,
15
+ noTupleRule, noUnionRule],
16
+ ruleSets: {
17
+ recommended: {
18
+ enable: {
19
+ [`ebus/${noFunctionRule.name}`]: true,
20
+ [`ebus/${noInterfaceRule.name}`]: true,
21
+ [`ebus/${noIntrinsicRule.name}`]: true,
22
+ [`ebus/${noLiteralRule.name}`]: true,
23
+ [`ebus/${noObjectRule.name}`]: true,
24
+ [`ebus/${noOperationRule.name}`]: true,
25
+ [`ebus/${noProjectionRule.name}`]: true,
26
+ [`ebus/${noTemplateRule.name}`]: true,
27
+ [`ebus/${noTupleRule.name}`]: true,
28
+ [`ebus/${noUnionRule.name}`]: true,
29
+ },
30
+ },
31
+ all: {
32
+ enable: {
33
+ [`ebus/${noFunctionRule.name}`]: true,
34
+ [`ebus/${noInterfaceRule.name}`]: true,
35
+ [`ebus/${noIntrinsicRule.name}`]: true,
36
+ [`ebus/${noLiteralRule.name}`]: true,
37
+ [`ebus/${noObjectRule.name}`]: true,
38
+ [`ebus/${noOperationRule.name}`]: true,
39
+ [`ebus/${noProjectionRule.name}`]: true,
40
+ [`ebus/${noTemplateRule.name}`]: true,
41
+ [`ebus/${noTupleRule.name}`]: true,
42
+ [`ebus/${noUnionRule.name}`]: true,
43
+ },
44
+ },
45
+ },
46
+ });
47
+ //# sourceMappingURL=linter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linter.js","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAC,cAAc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EAAE,IAAI;gBACrC,CAAC,QAAQ,WAAW,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;gBAClC,CAAC,QAAQ,WAAW,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;aACnC;SACF;QACD,GAAG,EAAE;YACH,MAAM,EAAE;gBACN,CAAC,QAAQ,cAAc,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;gBACrC,CAAC,QAAQ,eAAe,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;gBACtC,CAAC,QAAQ,eAAe,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;gBACtC,CAAC,QAAQ,aAAa,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;gBACpC,CAAC,QAAQ,YAAY,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;gBACnC,CAAC,QAAQ,eAAe,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;gBACtC,CAAC,QAAQ,gBAAgB,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;gBACvC,CAAC,QAAQ,cAAc,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;gBACrC,CAAC,QAAQ,WAAW,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;gBAClC,CAAC,QAAQ,WAAW,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;aACnC;SACF;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const noFunctionRule: import("@typespec/compiler").LinterRuleDefinition<"no-function", {
2
+ readonly default: "Function shouldn't be used with this library.";
3
+ }>;
@@ -0,0 +1,17 @@
1
+ import { createRule } from "@typespec/compiler";
2
+ export const noFunctionRule = createRule({
3
+ name: "no-function",
4
+ severity: "warning",
5
+ description: "Make sure function is not used.",
6
+ messages: {
7
+ default: "Function shouldn't be used with this library.",
8
+ },
9
+ create: (context) => {
10
+ return {
11
+ function: (target) => {
12
+ context.reportDiagnostic({ target });
13
+ },
14
+ };
15
+ },
16
+ });
17
+ //# sourceMappingURL=no-function.rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-function.rule.js","sourceRoot":"","sources":["../../../src/rules/no-function.rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAE9C,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,IAAI,EAAE,aAAa;IACnB,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,iCAAiC;IAC9C,QAAQ,EAAE;QACR,OAAO,EAAE,+CAA+C;KACzD;IACD,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE;gBACnB,OAAO,CAAC,gBAAgB,CAAC,EAAC,MAAM,EAAC,CAAC,CAAC;YACrC,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const noInterfaceRule: import("@typespec/compiler").LinterRuleDefinition<"no-interface", {
2
+ readonly default: "Interface shouldn't be used with this library.";
3
+ }>;
@@ -0,0 +1,17 @@
1
+ import { createRule } from "@typespec/compiler";
2
+ export const noInterfaceRule = createRule({
3
+ name: "no-interface",
4
+ severity: "warning",
5
+ description: "Make sure interface is not used.",
6
+ messages: {
7
+ default: "Interface shouldn't be used with this library.",
8
+ },
9
+ create: (context) => {
10
+ return {
11
+ interface: (target) => {
12
+ context.reportDiagnostic({ target });
13
+ },
14
+ };
15
+ },
16
+ });
17
+ //# sourceMappingURL=no-interface.rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-interface.rule.js","sourceRoot":"","sources":["../../../src/rules/no-interface.rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAE9C,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;IACxC,IAAI,EAAE,cAAc;IACpB,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,kCAAkC;IAC/C,QAAQ,EAAE;QACR,OAAO,EAAE,gDAAgD;KAC1D;IACD,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE;gBACpB,OAAO,CAAC,gBAAgB,CAAC,EAAC,MAAM,EAAC,CAAC,CAAC;YACrC,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const noIntrinsicRule: import("@typespec/compiler").LinterRuleDefinition<"no-intrinsic", {
2
+ readonly default: "Intrinsic shouldn't be used with this library.";
3
+ }>;
@@ -0,0 +1,19 @@
1
+ import { createRule } from "@typespec/compiler";
2
+ export const noIntrinsicRule = createRule({
3
+ name: "no-intrinsic",
4
+ severity: "warning",
5
+ description: "Make sure intrinsic is not used.",
6
+ messages: {
7
+ default: "Intrinsic shouldn't be used with this library.",
8
+ },
9
+ create: (context) => {
10
+ return {
11
+ intrinsic: (op) => {
12
+ context.reportDiagnostic({
13
+ target: op,
14
+ });
15
+ },
16
+ };
17
+ },
18
+ });
19
+ //# sourceMappingURL=no-intrinsic.rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-intrinsic.rule.js","sourceRoot":"","sources":["../../../src/rules/no-intrinsic.rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA4B,MAAM,oBAAoB,CAAC;AAEzE,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;IACxC,IAAI,EAAE,cAAc;IACpB,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,kCAAkC;IAC/C,QAAQ,EAAE;QACR,OAAO,EAAE,gDAAgD;KAC1D;IACD,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE;gBAChB,OAAO,CAAC,gBAAgB,CAAC;oBACvB,MAAM,EAAE,EAAE;iBACX,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const noLiteralRule: import("@typespec/compiler").LinterRuleDefinition<"no-literal", {
2
+ readonly default: "Literal shouldn't be used with this library.";
3
+ }>;
@@ -0,0 +1,20 @@
1
+ import { createRule } from "@typespec/compiler";
2
+ export const noLiteralRule = createRule({
3
+ name: "no-literal",
4
+ severity: "warning",
5
+ description: "Make sure literal is not used.",
6
+ messages: {
7
+ default: "Literal shouldn't be used with this library.",
8
+ },
9
+ create: (context) => {
10
+ return {
11
+ string: (target) => {
12
+ context.reportDiagnostic({ target });
13
+ },
14
+ number: (target) => {
15
+ context.reportDiagnostic({ target });
16
+ },
17
+ };
18
+ },
19
+ });
20
+ //# sourceMappingURL=no-literal.rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-literal.rule.js","sourceRoot":"","sources":["../../../src/rules/no-literal.rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAE9C,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;IACtC,IAAI,EAAE,YAAY;IAClB,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,gCAAgC;IAC7C,QAAQ,EAAE;QACR,OAAO,EAAE,8CAA8C;KACxD;IACD,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;gBACjB,OAAO,CAAC,gBAAgB,CAAC,EAAC,MAAM,EAAC,CAAC,CAAC;YACrC,CAAC;YACD,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;gBACjB,OAAO,CAAC,gBAAgB,CAAC,EAAC,MAAM,EAAC,CAAC,CAAC;YACrC,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const noObjectRule: import("@typespec/compiler").LinterRuleDefinition<"no-object", {
2
+ readonly default: "Object shouldn't be used with this library.";
3
+ }>;
@@ -0,0 +1,17 @@
1
+ import { createRule } from "@typespec/compiler";
2
+ export const noObjectRule = createRule({
3
+ name: "no-object",
4
+ severity: "warning",
5
+ description: "Make sure object is not used.",
6
+ messages: {
7
+ default: "Object shouldn't be used with this library.",
8
+ },
9
+ create: (context) => {
10
+ return {
11
+ object: (target) => {
12
+ context.reportDiagnostic({ target });
13
+ },
14
+ };
15
+ },
16
+ });
17
+ //# sourceMappingURL=no-object.rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-object.rule.js","sourceRoot":"","sources":["../../../src/rules/no-object.rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAE9C,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;IACrC,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,+BAA+B;IAC5C,QAAQ,EAAE;QACR,OAAO,EAAE,6CAA6C;KACvD;IACD,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;gBACjB,OAAO,CAAC,gBAAgB,CAAC,EAAC,MAAM,EAAC,CAAC,CAAC;YACrC,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const noOperationRule: import("@typespec/compiler").LinterRuleDefinition<"no-operation", {
2
+ readonly default: "Operation shouldn't be used with this library.";
3
+ }>;
@@ -0,0 +1,19 @@
1
+ import { createRule } from "@typespec/compiler";
2
+ export const noOperationRule = createRule({
3
+ name: "no-operation",
4
+ severity: "warning",
5
+ description: "Make sure operation is not used.",
6
+ messages: {
7
+ default: "Operation shouldn't be used with this library.",
8
+ },
9
+ create: (context) => {
10
+ return {
11
+ operation: (op) => {
12
+ context.reportDiagnostic({
13
+ target: op,
14
+ });
15
+ },
16
+ };
17
+ },
18
+ });
19
+ //# sourceMappingURL=no-operation.rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-operation.rule.js","sourceRoot":"","sources":["../../../src/rules/no-operation.rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA4B,MAAM,oBAAoB,CAAC;AAEzE,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;IACxC,IAAI,EAAE,cAAc;IACpB,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,kCAAkC;IAC/C,QAAQ,EAAE;QACR,OAAO,EAAE,gDAAgD;KAC1D;IACD,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE;gBAChB,OAAO,CAAC,gBAAgB,CAAC;oBACvB,MAAM,EAAE,EAAE;iBACX,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const noProjectionRule: import("@typespec/compiler").LinterRuleDefinition<"no-projection", {
2
+ readonly default: "Projection shouldn't be used with this library.";
3
+ }>;
@@ -0,0 +1,17 @@
1
+ import { createRule } from "@typespec/compiler";
2
+ export const noProjectionRule = createRule({
3
+ name: "no-projection",
4
+ severity: "warning",
5
+ description: "Make sure projection is not used.",
6
+ messages: {
7
+ default: "Projection shouldn't be used with this library.",
8
+ },
9
+ create: (context) => {
10
+ return {
11
+ projection: (target) => {
12
+ context.reportDiagnostic({ target });
13
+ },
14
+ };
15
+ },
16
+ });
17
+ //# sourceMappingURL=no-projection.rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-projection.rule.js","sourceRoot":"","sources":["../../../src/rules/no-projection.rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAE9C,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC;IACzC,IAAI,EAAE,eAAe;IACrB,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,mCAAmC;IAChD,QAAQ,EAAE;QACR,OAAO,EAAE,iDAAiD;KAC3D;IACD,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE;gBACrB,OAAO,CAAC,gBAAgB,CAAC,EAAC,MAAM,EAAC,CAAC,CAAC;YACrC,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const noTemplateRule: import("@typespec/compiler").LinterRuleDefinition<"no-template", {
2
+ readonly default: "Template shouldn't be used with this library.";
3
+ }>;
@@ -0,0 +1,20 @@
1
+ import { createRule } from "@typespec/compiler";
2
+ export const noTemplateRule = createRule({
3
+ name: "no-template",
4
+ severity: "warning",
5
+ description: "Make sure template is not used.",
6
+ messages: {
7
+ default: "Template shouldn't be used with this library.",
8
+ },
9
+ create: (context) => {
10
+ return {
11
+ templateParameter: (target) => {
12
+ context.reportDiagnostic({ target });
13
+ },
14
+ stringTemplate: (target) => {
15
+ context.reportDiagnostic({ target });
16
+ },
17
+ };
18
+ },
19
+ });
20
+ //# sourceMappingURL=no-template.rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-template.rule.js","sourceRoot":"","sources":["../../../src/rules/no-template.rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAE9C,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,IAAI,EAAE,aAAa;IACnB,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,iCAAiC;IAC9C,QAAQ,EAAE;QACR,OAAO,EAAE,+CAA+C;KACzD;IACD,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,iBAAiB,EAAE,CAAC,MAAM,EAAE,EAAE;gBAC5B,OAAO,CAAC,gBAAgB,CAAC,EAAC,MAAM,EAAC,CAAC,CAAC;YACrC,CAAC;YACD,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE;gBACzB,OAAO,CAAC,gBAAgB,CAAC,EAAC,MAAM,EAAC,CAAC,CAAC;YACrC,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const noTupleRule: import("@typespec/compiler").LinterRuleDefinition<"no-tuple", {
2
+ readonly default: "Tuple shouldn't be used with this library.";
3
+ }>;