@checkdigit/eslint-plugin 7.17.1 → 7.18.0-PR.143-8290
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-mjs/athena/api-locator.mjs +30 -0
- package/dist-mjs/athena/api-matcher.mjs +108 -0
- package/dist-mjs/athena/athena.mjs +331 -0
- package/dist-mjs/athena/column.mjs +1 -0
- package/dist-mjs/athena/context.mjs +21 -0
- package/dist-mjs/athena/index.mjs +1 -0
- package/dist-mjs/athena/service-table.mjs +32 -0
- package/dist-mjs/athena/types.mjs +1 -0
- package/dist-mjs/athena/visitor.mjs +258 -0
- package/dist-mjs/index.mjs +8 -4
- package/dist-mjs/no-status-code-assert.mjs +1 -1
- package/dist-mjs/openapi/deref-schema.mjs +14 -0
- package/dist-mjs/openapi/generate-schema.mjs +273 -0
- package/dist-mjs/openapi/service-schema-generator.mjs +147 -0
- package/dist-mjs/peggy/athena-peggy.mjs +20629 -0
- package/dist-types/athena/api-locator.d.ts +2 -0
- package/dist-types/athena/api-matcher.d.ts +14 -0
- package/dist-types/athena/athena.d.ts +6 -0
- package/dist-types/athena/column.d.ts +1 -0
- package/dist-types/athena/context.d.ts +21 -0
- package/dist-types/athena/index.d.ts +8 -0
- package/dist-types/athena/service-table.d.ts +8 -0
- package/dist-types/athena/types.d.ts +474 -0
- package/dist-types/athena/visitor.d.ts +63 -0
- package/dist-types/no-status-code-assert.d.ts +1 -1
- package/dist-types/openapi/deref-schema.d.ts +1 -0
- package/dist-types/openapi/generate-schema.d.ts +33 -0
- package/dist-types/openapi/service-schema-generator.d.ts +5 -0
- package/dist-types/peggy/athena-peggy.d.ts +13 -0
- package/package.json +1 -96
- package/src/athena/ATHENA.md +387 -0
- package/src/athena/PLAN.md +355 -0
- package/src/athena/api-locator.ts +39 -0
- package/src/athena/api-matcher.ts +169 -0
- package/src/athena/athena.ts +491 -0
- package/src/athena/column.ts +2 -0
- package/src/athena/context.ts +47 -0
- package/src/athena/index.ts +11 -0
- package/src/athena/service-table.ts +55 -0
- package/src/athena/types.ts +526 -0
- package/src/athena/visitor.ts +365 -0
- package/src/index.ts +4 -0
- package/src/no-side-effects.ts +1 -1
- package/src/no-status-code-assert.ts +2 -2
- package/src/openapi/deref-schema.ts +14 -0
- package/src/openapi/generate-schema.ts +422 -0
- package/src/openapi/service-schema-generator.ts +189 -0
- package/src/peggy/athena-chat.peggy +608 -0
- package/src/peggy/athena-peggy.ts +22078 -0
- package/src/peggy/athena.peggy +2967 -0
- package/src/require-service-call-response-declaration.ts +2 -2
- package/src/services/interchange/v1/swagger.schema.deref.json +849 -0
- package/src/services/interchange/v1/swagger.schema.json +473 -0
- package/src/services/interchange/v1/swagger.yml +414 -0
- package/src/services/ledger/v1/swagger.schema.deref.json +6694 -0
- package/src/services/ledger/v1/swagger.schema.json +1820 -0
- package/src/services/ledger/v1/swagger.yml +1094 -0
- package/src/services/link/v1/swagger.schema.deref.json +648 -0
- package/src/services/link/v1/swagger.schema.json +444 -0
- package/src/services/link/v1/swagger.yml +343 -0
- package/src/services/message/v1/swagger.schema.deref.json +22049 -0
- package/src/services/message/v1/swagger.schema.json +3470 -0
- package/src/services/message/v1/swagger.yml +2798 -0
- package/src/services/message/v2/swagger.schema.deref.json +72221 -0
- package/src/services/message/v2/swagger.schema.json +3558 -0
- package/src/services/message/v2/swagger.yml +3009 -0
- package/src/services/paymentCard/v1/swagger.schema.deref.json +4346 -0
- package/src/services/paymentCard/v1/swagger.schema.json +2181 -0
- package/src/services/paymentCard/v1/swagger.yml +1161 -0
- package/src/services/paymentCard/v2/swagger.schema.deref.json +4336 -0
- package/src/services/paymentCard/v2/swagger.schema.json +2155 -0
- package/src/services/paymentCard/v2/swagger.yml +1149 -0
- package/src/services/person/v1/swagger.schema.deref.json +6786 -0
- package/src/services/person/v1/swagger.schema.json +1445 -0
- package/src/services/person/v1/swagger.yml +1157 -0
- package/src/services/teampayApproval/v1/swagger.schema.deref.json +9898 -0
- package/src/services/teampayCardManagement/v1/swagger.schema.deref.json +6187 -0
- package/src/services/teampayClientManagement/v1/swagger.schema.deref.json +4914 -0
- package/src/services/teampayClientManagement/v1/swagger.schema.json +1964 -0
- package/src/services/teampayClientManagement/v1/swagger.yml +1376 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SchemaObject } from 'ajv/dist/2020';
|
|
2
|
+
import type { ApiSchemas, OperationSchemas } from '../openapi/generate-schema';
|
|
3
|
+
export interface OperationToMatch {
|
|
4
|
+
path: string;
|
|
5
|
+
method: string;
|
|
6
|
+
operationSchemas: OperationSchemas;
|
|
7
|
+
}
|
|
8
|
+
export interface MatchedOperation {
|
|
9
|
+
path: string;
|
|
10
|
+
method: string;
|
|
11
|
+
request: SchemaObject;
|
|
12
|
+
response: SchemaObject;
|
|
13
|
+
}
|
|
14
|
+
export declare function matchApi(selectAST: object, tableAST: object, apiSchemas: ApiSchemas[]): MatchedOperation[] | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
export declare const ruleId = "athena";
|
|
3
|
+
declare const SYNTEXT_ERROR = "SyntextError";
|
|
4
|
+
declare const ATHENA_ERROR = "AthenaError";
|
|
5
|
+
declare const rule: ESLintUtils.RuleModule<typeof SYNTEXT_ERROR | typeof ATHENA_ERROR>;
|
|
6
|
+
export default rule;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ResolvedColumn } from './context';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { OpenAPIV3_1 as v3 } from 'openapi-types';
|
|
2
|
+
import type { ApiSchemas } from '../openapi/generate-schema';
|
|
3
|
+
import type { MatchedOperation } from './api-matcher';
|
|
4
|
+
export interface ResolvedColumn {
|
|
5
|
+
name: string;
|
|
6
|
+
schema: v3.SchemaObject;
|
|
7
|
+
ast?: object;
|
|
8
|
+
}
|
|
9
|
+
export interface ResolvedTable {
|
|
10
|
+
name?: string;
|
|
11
|
+
columns: Map<string, ResolvedColumn[]>;
|
|
12
|
+
apiOperation?: MatchedOperation[];
|
|
13
|
+
}
|
|
14
|
+
export interface VisitContext {
|
|
15
|
+
tables: Map<string, ResolvedTable[]>;
|
|
16
|
+
aliases: Map<string, string>;
|
|
17
|
+
apiSchemas: Map<string, ApiSchemas[]>;
|
|
18
|
+
parent?: VisitContext;
|
|
19
|
+
}
|
|
20
|
+
export declare function createRootContext(): VisitContext;
|
|
21
|
+
export declare function createChildContext(parent: VisitContext): VisitContext;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { OpenAPIV3_1 as v3 } from 'openapi-types';
|
|
2
|
+
export interface ServiceEndpoint {
|
|
3
|
+
path: string;
|
|
4
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
5
|
+
requestBody?: v3.SchemaObject;
|
|
6
|
+
responses: Record<string, v3.SchemaObject>;
|
|
7
|
+
}
|
|
8
|
+
export type Service = Record<string, ServiceEndpoint>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MatchedOperation } from './api-matcher';
|
|
2
|
+
import type { ResolvedTable } from './context';
|
|
3
|
+
/**
|
|
4
|
+
* Create one ResolvedTable per matched API operation.
|
|
5
|
+
* Multiple operations may match (e.g. GET + POST for the same service), so the
|
|
6
|
+
* caller receives an array and stores all of them under the same table name.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildServiceTables(tableName: string, operations: MatchedOperation[]): ResolvedTable[];
|
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
export interface With {
|
|
2
|
+
name: {
|
|
3
|
+
value: string;
|
|
4
|
+
};
|
|
5
|
+
stmt: {
|
|
6
|
+
_parentheses?: boolean;
|
|
7
|
+
tableList: string[];
|
|
8
|
+
columnList: string[];
|
|
9
|
+
ast: Select;
|
|
10
|
+
};
|
|
11
|
+
columns?: any[];
|
|
12
|
+
}
|
|
13
|
+
interface Location {
|
|
14
|
+
line: number;
|
|
15
|
+
column: number;
|
|
16
|
+
offset: number;
|
|
17
|
+
}
|
|
18
|
+
interface LocationRange {
|
|
19
|
+
start: Location;
|
|
20
|
+
end: Location;
|
|
21
|
+
}
|
|
22
|
+
export type WhilteListCheckMode = 'table' | 'column';
|
|
23
|
+
export interface ParseOptions {
|
|
24
|
+
includeLocations?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface Option {
|
|
27
|
+
database?: string;
|
|
28
|
+
type?: string;
|
|
29
|
+
trimQuery?: boolean;
|
|
30
|
+
parseOptions?: ParseOptions;
|
|
31
|
+
}
|
|
32
|
+
export interface TableColumnAst {
|
|
33
|
+
tableList: string[];
|
|
34
|
+
columnList: string[];
|
|
35
|
+
ast: AST[] | AST;
|
|
36
|
+
loc?: LocationRange;
|
|
37
|
+
}
|
|
38
|
+
export interface BaseFrom {
|
|
39
|
+
db: string | null;
|
|
40
|
+
table: string;
|
|
41
|
+
as: string | null;
|
|
42
|
+
schema?: string;
|
|
43
|
+
loc?: LocationRange;
|
|
44
|
+
}
|
|
45
|
+
export interface Join extends BaseFrom {
|
|
46
|
+
join: 'INNER JOIN' | 'LEFT JOIN' | 'RIGHT JOIN';
|
|
47
|
+
using?: string[];
|
|
48
|
+
on?: Binary;
|
|
49
|
+
}
|
|
50
|
+
export interface TableExpr {
|
|
51
|
+
expr: {
|
|
52
|
+
ast: Select;
|
|
53
|
+
};
|
|
54
|
+
as?: string | null;
|
|
55
|
+
parentheses: boolean | {
|
|
56
|
+
length: number;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export interface Dual {
|
|
60
|
+
type: 'dual';
|
|
61
|
+
loc?: LocationRange;
|
|
62
|
+
}
|
|
63
|
+
export type From = BaseFrom | Join | TableExpr | Dual;
|
|
64
|
+
export interface LimitValue {
|
|
65
|
+
type: string;
|
|
66
|
+
value: number;
|
|
67
|
+
loc?: LocationRange;
|
|
68
|
+
}
|
|
69
|
+
export interface Limit {
|
|
70
|
+
seperator: string;
|
|
71
|
+
value: LimitValue[];
|
|
72
|
+
loc?: LocationRange;
|
|
73
|
+
}
|
|
74
|
+
export interface OrderBy {
|
|
75
|
+
type: 'ASC' | 'DESC';
|
|
76
|
+
expr: any;
|
|
77
|
+
loc?: LocationRange;
|
|
78
|
+
}
|
|
79
|
+
export interface ValueExpr<T = string | number | boolean> {
|
|
80
|
+
type: 'backticks_quote_string' | 'string' | 'regex_string' | 'hex_string' | 'full_hex_string' | 'natural_string' | 'bit_string' | 'double_quote_string' | 'single_quote_string' | 'boolean' | 'bool' | 'null' | 'star' | 'param' | 'origin' | 'date' | 'datetime' | 'default' | 'time' | 'timestamp' | 'var_string';
|
|
81
|
+
value: T;
|
|
82
|
+
}
|
|
83
|
+
export interface ColumnRefItem {
|
|
84
|
+
type: 'column_ref';
|
|
85
|
+
table: string | null;
|
|
86
|
+
column: string | {
|
|
87
|
+
expr: ValueExpr;
|
|
88
|
+
};
|
|
89
|
+
options?: ExprList;
|
|
90
|
+
loc?: LocationRange;
|
|
91
|
+
}
|
|
92
|
+
export interface ColumnRefExpr {
|
|
93
|
+
type: 'expr';
|
|
94
|
+
expr: ColumnRefItem;
|
|
95
|
+
as: string | null;
|
|
96
|
+
}
|
|
97
|
+
export type ColumnRef = ColumnRefItem | ColumnRefExpr;
|
|
98
|
+
export interface SetList {
|
|
99
|
+
column: string;
|
|
100
|
+
value: any;
|
|
101
|
+
table: string | null;
|
|
102
|
+
loc?: LocationRange;
|
|
103
|
+
}
|
|
104
|
+
export interface InsertReplaceValue {
|
|
105
|
+
type: 'expr_list';
|
|
106
|
+
value: any[];
|
|
107
|
+
loc?: LocationRange;
|
|
108
|
+
}
|
|
109
|
+
export interface Star {
|
|
110
|
+
type: 'star';
|
|
111
|
+
value: '*' | '';
|
|
112
|
+
loc?: LocationRange;
|
|
113
|
+
}
|
|
114
|
+
export interface Case {
|
|
115
|
+
type: 'case';
|
|
116
|
+
expr: null;
|
|
117
|
+
args: ({
|
|
118
|
+
cond: Binary;
|
|
119
|
+
result: ExpressionValue;
|
|
120
|
+
type: 'when';
|
|
121
|
+
} | {
|
|
122
|
+
result: ExpressionValue;
|
|
123
|
+
type: 'else';
|
|
124
|
+
})[];
|
|
125
|
+
}
|
|
126
|
+
export interface Cast {
|
|
127
|
+
type: 'cast';
|
|
128
|
+
keyword: 'cast';
|
|
129
|
+
expr: ExpressionValue;
|
|
130
|
+
symbol: 'as';
|
|
131
|
+
target: {
|
|
132
|
+
dataType: string;
|
|
133
|
+
suffix: unknown[];
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
export interface AggrFunc {
|
|
137
|
+
type: 'aggr_func';
|
|
138
|
+
name: string;
|
|
139
|
+
args: {
|
|
140
|
+
expr: ExpressionValue;
|
|
141
|
+
distinct: 'DISTINCT' | null;
|
|
142
|
+
orderby: OrderBy[] | null;
|
|
143
|
+
parentheses?: boolean;
|
|
144
|
+
};
|
|
145
|
+
loc?: LocationRange;
|
|
146
|
+
}
|
|
147
|
+
export interface FunctionName {
|
|
148
|
+
schema?: {
|
|
149
|
+
value: string;
|
|
150
|
+
type: string;
|
|
151
|
+
};
|
|
152
|
+
name: ValueExpr<string>[];
|
|
153
|
+
}
|
|
154
|
+
export interface Function {
|
|
155
|
+
type: 'function';
|
|
156
|
+
name: FunctionName;
|
|
157
|
+
args?: ExprList;
|
|
158
|
+
suffix?: any;
|
|
159
|
+
loc?: LocationRange;
|
|
160
|
+
}
|
|
161
|
+
export interface Column {
|
|
162
|
+
expr: ExpressionValue;
|
|
163
|
+
as: ValueExpr<string> | string | null;
|
|
164
|
+
type?: string;
|
|
165
|
+
loc?: LocationRange;
|
|
166
|
+
}
|
|
167
|
+
export interface Interval {
|
|
168
|
+
type: 'interval';
|
|
169
|
+
unit: string;
|
|
170
|
+
expr: ValueExpr & {
|
|
171
|
+
loc?: LocationRange;
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
export interface Param {
|
|
175
|
+
type: 'param';
|
|
176
|
+
value: string;
|
|
177
|
+
loc?: LocationRange;
|
|
178
|
+
}
|
|
179
|
+
export interface Value {
|
|
180
|
+
type: string;
|
|
181
|
+
value: any;
|
|
182
|
+
loc?: LocationRange;
|
|
183
|
+
}
|
|
184
|
+
export interface Binary {
|
|
185
|
+
type: 'binary_expr';
|
|
186
|
+
operator: string;
|
|
187
|
+
left: ExpressionValue | ExprList;
|
|
188
|
+
right: ExpressionValue | ExprList;
|
|
189
|
+
loc?: LocationRange;
|
|
190
|
+
parentheses?: boolean;
|
|
191
|
+
}
|
|
192
|
+
export type Expr = Binary;
|
|
193
|
+
export type ExpressionValue = ColumnRef | Param | Function | Case | AggrFunc | Value | Binary | Cast | Interval;
|
|
194
|
+
export interface ExprList {
|
|
195
|
+
type: 'expr_list';
|
|
196
|
+
value: ExpressionValue[];
|
|
197
|
+
loc?: LocationRange;
|
|
198
|
+
parentheses?: boolean;
|
|
199
|
+
separator?: string;
|
|
200
|
+
}
|
|
201
|
+
export type PartitionBy = {
|
|
202
|
+
type: 'expr';
|
|
203
|
+
expr: ColumnRef[];
|
|
204
|
+
}[];
|
|
205
|
+
export interface WindowSpec {
|
|
206
|
+
name: null;
|
|
207
|
+
partitionby: PartitionBy;
|
|
208
|
+
orderby: OrderBy[] | null;
|
|
209
|
+
window_frame_clause: string | null;
|
|
210
|
+
}
|
|
211
|
+
export type AsWindowSpec = string | {
|
|
212
|
+
window_specification: WindowSpec;
|
|
213
|
+
parentheses: boolean;
|
|
214
|
+
};
|
|
215
|
+
export interface NamedWindowExpr {
|
|
216
|
+
name: string;
|
|
217
|
+
as_window_specification: AsWindowSpec;
|
|
218
|
+
}
|
|
219
|
+
export interface WindowExpr {
|
|
220
|
+
keyword: 'window';
|
|
221
|
+
type: 'window';
|
|
222
|
+
expr: NamedWindowExpr[];
|
|
223
|
+
}
|
|
224
|
+
export interface Select {
|
|
225
|
+
with: With[] | null;
|
|
226
|
+
type: 'select';
|
|
227
|
+
options: any[] | null;
|
|
228
|
+
distinct: 'DISTINCT' | null;
|
|
229
|
+
columns: any[] | Column[];
|
|
230
|
+
from: From[] | TableExpr | null;
|
|
231
|
+
where: Binary | Function | null;
|
|
232
|
+
groupby: {
|
|
233
|
+
columns: ColumnRef[] | null;
|
|
234
|
+
modifiers: ValueExpr<string>[];
|
|
235
|
+
};
|
|
236
|
+
having: any[] | null;
|
|
237
|
+
orderby: OrderBy[] | null;
|
|
238
|
+
limit: Limit | null;
|
|
239
|
+
window?: WindowExpr;
|
|
240
|
+
qualify?: any[] | null;
|
|
241
|
+
_orderby?: OrderBy[] | null;
|
|
242
|
+
_limit?: Limit | null;
|
|
243
|
+
parentheses_symbol?: boolean;
|
|
244
|
+
_parentheses?: boolean;
|
|
245
|
+
loc?: LocationRange;
|
|
246
|
+
_next?: Select;
|
|
247
|
+
set_op?: string;
|
|
248
|
+
}
|
|
249
|
+
export interface Insert_Replace {
|
|
250
|
+
type: 'replace' | 'insert';
|
|
251
|
+
table: any;
|
|
252
|
+
columns: string[] | null;
|
|
253
|
+
values: InsertReplaceValue[] | Select;
|
|
254
|
+
partition: any[];
|
|
255
|
+
prefix: string;
|
|
256
|
+
on_duplicate_update: {
|
|
257
|
+
keyword: 'on duplicate key update';
|
|
258
|
+
set: SetList[];
|
|
259
|
+
};
|
|
260
|
+
loc?: LocationRange;
|
|
261
|
+
}
|
|
262
|
+
export interface Update {
|
|
263
|
+
type: 'update';
|
|
264
|
+
db: string | null;
|
|
265
|
+
table: (From | Dual)[] | null;
|
|
266
|
+
set: SetList[];
|
|
267
|
+
where: Binary | Function | null;
|
|
268
|
+
loc?: LocationRange;
|
|
269
|
+
}
|
|
270
|
+
export interface Delete {
|
|
271
|
+
type: 'delete';
|
|
272
|
+
table: any;
|
|
273
|
+
from: (From | Dual)[];
|
|
274
|
+
where: Binary | Function | null;
|
|
275
|
+
loc?: LocationRange;
|
|
276
|
+
}
|
|
277
|
+
export interface Alter {
|
|
278
|
+
type: 'alter';
|
|
279
|
+
table: From[];
|
|
280
|
+
expr: any;
|
|
281
|
+
loc?: LocationRange;
|
|
282
|
+
}
|
|
283
|
+
export interface Use {
|
|
284
|
+
type: 'use';
|
|
285
|
+
db: string;
|
|
286
|
+
loc?: LocationRange;
|
|
287
|
+
}
|
|
288
|
+
type KW_UNSIGNED = 'UNSIGNED';
|
|
289
|
+
type KW_ZEROFILL = 'ZEROFILL';
|
|
290
|
+
type Timezone = ['WITHOUT' | 'WITH', 'TIME', 'ZONE'];
|
|
291
|
+
interface KeywordComment {
|
|
292
|
+
type: 'comment';
|
|
293
|
+
keyword: 'comment';
|
|
294
|
+
symbol?: '=';
|
|
295
|
+
value: string;
|
|
296
|
+
}
|
|
297
|
+
interface CollateExpr {
|
|
298
|
+
type: 'collate';
|
|
299
|
+
symbol?: '=';
|
|
300
|
+
value: string;
|
|
301
|
+
}
|
|
302
|
+
interface DataType {
|
|
303
|
+
dataType: string;
|
|
304
|
+
length?: number;
|
|
305
|
+
parentheses?: true;
|
|
306
|
+
suffix?: Timezone | (KW_UNSIGNED | KW_ZEROFILL)[];
|
|
307
|
+
array?: 'one' | 'two';
|
|
308
|
+
}
|
|
309
|
+
interface LiteralNotNull {
|
|
310
|
+
type: 'not null';
|
|
311
|
+
value: 'not null';
|
|
312
|
+
}
|
|
313
|
+
interface LiteralNull {
|
|
314
|
+
type: 'null';
|
|
315
|
+
value: null;
|
|
316
|
+
}
|
|
317
|
+
type LiteralNumeric = number | {
|
|
318
|
+
type: 'bigint';
|
|
319
|
+
value: string;
|
|
320
|
+
};
|
|
321
|
+
interface ColumnConstraint {
|
|
322
|
+
default_val: {
|
|
323
|
+
type: 'default';
|
|
324
|
+
value: any;
|
|
325
|
+
};
|
|
326
|
+
nullable: LiteralNotNull | LiteralNull;
|
|
327
|
+
}
|
|
328
|
+
interface ColumnDefinitionOptList {
|
|
329
|
+
nullable?: ColumnConstraint['nullable'];
|
|
330
|
+
default_val?: ColumnConstraint['default_val'];
|
|
331
|
+
auto_increment?: 'auto_increment';
|
|
332
|
+
unique?: 'unique' | 'unique key';
|
|
333
|
+
primary?: 'key' | 'primary key';
|
|
334
|
+
comment?: KeywordComment;
|
|
335
|
+
collate?: {
|
|
336
|
+
collate: CollateExpr;
|
|
337
|
+
};
|
|
338
|
+
column_format?: {
|
|
339
|
+
column_format: any;
|
|
340
|
+
};
|
|
341
|
+
storage?: {
|
|
342
|
+
storage: any;
|
|
343
|
+
};
|
|
344
|
+
reference_definition?: {
|
|
345
|
+
reference_definition: any;
|
|
346
|
+
};
|
|
347
|
+
character_set?: {
|
|
348
|
+
type: 'CHARACTER SET';
|
|
349
|
+
value: string;
|
|
350
|
+
symbol?: '=';
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
type CreateColumnDefinition = {
|
|
354
|
+
column: ColumnRef;
|
|
355
|
+
definition: DataType;
|
|
356
|
+
resource: 'column';
|
|
357
|
+
} & ColumnDefinitionOptList;
|
|
358
|
+
interface IndexType {
|
|
359
|
+
keyword: 'using';
|
|
360
|
+
type: 'btree' | 'hash' | 'gist' | 'gin';
|
|
361
|
+
}
|
|
362
|
+
interface IndexOption {
|
|
363
|
+
type: 'key_block_size';
|
|
364
|
+
symbol?: '=';
|
|
365
|
+
expr: LiteralNumeric;
|
|
366
|
+
}
|
|
367
|
+
interface CreateIndexDefinition {
|
|
368
|
+
index?: string;
|
|
369
|
+
definition: ColumnRef[];
|
|
370
|
+
keyword: 'index' | 'key';
|
|
371
|
+
index_type?: IndexType;
|
|
372
|
+
resource: 'index';
|
|
373
|
+
index_options?: IndexOption[];
|
|
374
|
+
}
|
|
375
|
+
interface CreateFulltextSpatialIndexDefinition {
|
|
376
|
+
index?: string;
|
|
377
|
+
definition: ColumnRef[];
|
|
378
|
+
keyword?: 'fulltext' | 'spatial' | 'fulltext key' | 'spatial key' | 'fulltext index' | 'spatial index';
|
|
379
|
+
index_options?: IndexOption[];
|
|
380
|
+
resource: 'index';
|
|
381
|
+
}
|
|
382
|
+
interface ConstraintName {
|
|
383
|
+
keyword: 'constraint';
|
|
384
|
+
constraint: string;
|
|
385
|
+
}
|
|
386
|
+
interface CreateConstraintPrimary {
|
|
387
|
+
constraint?: ConstraintName['constraint'];
|
|
388
|
+
definition: ColumnRef[];
|
|
389
|
+
constraint_type: 'primary key';
|
|
390
|
+
keyword?: ConstraintName['keyword'];
|
|
391
|
+
index_type?: IndexType;
|
|
392
|
+
resource: 'constraint';
|
|
393
|
+
index_options?: IndexOption[];
|
|
394
|
+
}
|
|
395
|
+
interface CreateConstraintUnique {
|
|
396
|
+
constraint?: ConstraintName['constraint'];
|
|
397
|
+
definition: ColumnRef[];
|
|
398
|
+
constraint_type: 'unique key' | 'unique' | 'unique index';
|
|
399
|
+
keyword?: ConstraintName['keyword'];
|
|
400
|
+
index_type?: IndexType;
|
|
401
|
+
index?: string;
|
|
402
|
+
resource: 'constraint';
|
|
403
|
+
index_options?: IndexOption[];
|
|
404
|
+
}
|
|
405
|
+
interface CreateConstraintForeign {
|
|
406
|
+
constraint?: ConstraintName['constraint'];
|
|
407
|
+
definition: ColumnRef[];
|
|
408
|
+
constraint_type: 'FOREIGN KEY';
|
|
409
|
+
keyword?: ConstraintName['keyword'];
|
|
410
|
+
index?: string;
|
|
411
|
+
resource: 'constraint';
|
|
412
|
+
reference_definition?: any;
|
|
413
|
+
}
|
|
414
|
+
interface CreateConstraintCheck {
|
|
415
|
+
constraint?: ConstraintName['constraint'];
|
|
416
|
+
definition: any[];
|
|
417
|
+
constraint_type: 'check';
|
|
418
|
+
keyword?: ConstraintName['keyword'];
|
|
419
|
+
resource: 'constraint';
|
|
420
|
+
}
|
|
421
|
+
type CreateConstraintDefinition = CreateConstraintPrimary | CreateConstraintUnique | CreateConstraintForeign | CreateConstraintCheck;
|
|
422
|
+
type CreateDefinition = CreateColumnDefinition | CreateIndexDefinition | CreateFulltextSpatialIndexDefinition | CreateConstraintDefinition;
|
|
423
|
+
export interface Create {
|
|
424
|
+
type: 'create';
|
|
425
|
+
keyword: 'table' | 'index' | 'database';
|
|
426
|
+
temporary?: 'temporary' | null;
|
|
427
|
+
table?: {
|
|
428
|
+
db: string;
|
|
429
|
+
table: string;
|
|
430
|
+
}[];
|
|
431
|
+
if_not_exists?: 'if not exists' | null;
|
|
432
|
+
like?: {
|
|
433
|
+
type: 'like';
|
|
434
|
+
table: string;
|
|
435
|
+
parentheses?: boolean;
|
|
436
|
+
} | null;
|
|
437
|
+
ignore_replace?: 'ignore' | 'replace' | null;
|
|
438
|
+
as?: string | null;
|
|
439
|
+
query_expr?: any | null;
|
|
440
|
+
create_definitions?: CreateDefinition[] | null;
|
|
441
|
+
table_options?: any[] | null;
|
|
442
|
+
index_using?: {
|
|
443
|
+
keyword: 'using';
|
|
444
|
+
type: 'btree' | 'hash';
|
|
445
|
+
} | null;
|
|
446
|
+
index?: string | null;
|
|
447
|
+
on_kw?: 'on' | null;
|
|
448
|
+
index_columns?: any[] | null;
|
|
449
|
+
index_type?: 'unique' | 'fulltext' | 'spatial' | null;
|
|
450
|
+
index_options?: any[] | null;
|
|
451
|
+
algorithm_option?: {
|
|
452
|
+
type: 'alter';
|
|
453
|
+
keyword: 'algorithm';
|
|
454
|
+
resource: 'algorithm';
|
|
455
|
+
symbol: '=' | null;
|
|
456
|
+
algorithm: 'default' | 'instant' | 'inplace' | 'copy';
|
|
457
|
+
} | null;
|
|
458
|
+
lock_option?: {
|
|
459
|
+
type: 'alter';
|
|
460
|
+
keyword: 'lock';
|
|
461
|
+
resource: 'lock';
|
|
462
|
+
symbol: '=' | null;
|
|
463
|
+
lock: 'default' | 'none' | 'shared' | 'exclusive';
|
|
464
|
+
} | null;
|
|
465
|
+
database?: string;
|
|
466
|
+
loc?: LocationRange;
|
|
467
|
+
}
|
|
468
|
+
export interface Drop {
|
|
469
|
+
type: 'drop';
|
|
470
|
+
keyword: string;
|
|
471
|
+
name: any[];
|
|
472
|
+
}
|
|
473
|
+
export type AST = Use | Select | Insert_Replace | Update | Delete | Alter | Create | Drop;
|
|
474
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { AggrFunc, BaseFrom, Binary, Case, Cast, Column, ColumnRefItem, Dual, ExpressionValue, ExprList, Function, Join, Select, TableExpr, With } from './types';
|
|
2
|
+
export interface UnnestFrom {
|
|
3
|
+
type: 'unnest';
|
|
4
|
+
expr: ColumnRefItem;
|
|
5
|
+
parentheses: boolean;
|
|
6
|
+
as: {
|
|
7
|
+
type: 'function';
|
|
8
|
+
name: {
|
|
9
|
+
name: {
|
|
10
|
+
type: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
args: ExprList;
|
|
15
|
+
} | null;
|
|
16
|
+
}
|
|
17
|
+
export interface ColumnRefWithIndex extends ColumnRefItem {
|
|
18
|
+
array_index: {
|
|
19
|
+
brackets: true;
|
|
20
|
+
index: {
|
|
21
|
+
type: string;
|
|
22
|
+
value: unknown;
|
|
23
|
+
};
|
|
24
|
+
}[];
|
|
25
|
+
}
|
|
26
|
+
export interface VisitorMap {
|
|
27
|
+
visitSelect?(node: Select): void;
|
|
28
|
+
visitWith?(node: With): void;
|
|
29
|
+
visitBaseFrom?(node: BaseFrom): void;
|
|
30
|
+
visitJoin?(node: Join): void;
|
|
31
|
+
visitTableExpr?(node: TableExpr): void;
|
|
32
|
+
visitUnnest?(node: UnnestFrom): void;
|
|
33
|
+
visitColumn?(node: Column): void;
|
|
34
|
+
visitColumnRef?(node: ColumnRefItem): void;
|
|
35
|
+
visitFunction?(node: Function): void;
|
|
36
|
+
visitBinary?(node: Binary): void;
|
|
37
|
+
visitAggrFunc?(node: AggrFunc): void;
|
|
38
|
+
visitCast?(node: Cast): void;
|
|
39
|
+
visitCase?(node: Case): void;
|
|
40
|
+
visitExprList?(node: ExprList): void;
|
|
41
|
+
visitValue?(node: ExpressionValue): void;
|
|
42
|
+
}
|
|
43
|
+
export declare function isUnnestFrom(node: unknown): node is UnnestFrom;
|
|
44
|
+
export declare function isDual(node: unknown): node is Dual;
|
|
45
|
+
export declare function isTableExpr(node: unknown): node is TableExpr;
|
|
46
|
+
export declare function isJoin(node: unknown): node is Join;
|
|
47
|
+
export declare function isBaseFrom(node: unknown): node is BaseFrom;
|
|
48
|
+
export declare function hasArrayIndex(node: ColumnRefItem): node is ColumnRefWithIndex;
|
|
49
|
+
export declare function walk(node: unknown, visitor: VisitorMap): void;
|
|
50
|
+
/** Collect all column_ref nodes within an expression subtree. */
|
|
51
|
+
export declare function extractColumnRefs(expr: unknown): ColumnRefItem[];
|
|
52
|
+
/** Return the path string from the first json_extract_scalar / json_extract call found. */
|
|
53
|
+
export declare function extractJsonExtractPath(expr: unknown): string | undefined;
|
|
54
|
+
export interface JsonExtractCall {
|
|
55
|
+
ref: ColumnRefItem;
|
|
56
|
+
path: string;
|
|
57
|
+
}
|
|
58
|
+
/** Collect ALL json_extract / json_extract_scalar calls as (source column_ref, path) pairs. */
|
|
59
|
+
export declare function extractJsonExtractCalls(expr: unknown): JsonExtractCall[];
|
|
60
|
+
/** Return the JSONPath-style string from a bracket accessor (col['key']), or undefined. */
|
|
61
|
+
export declare function extractBracketAccessorPath(expr: unknown): string | undefined;
|
|
62
|
+
/** Return true if the expression tree contains any function or aggregate call. */
|
|
63
|
+
export declare function hasFunctionCalls(expr: unknown): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TSESLint } from '@typescript-eslint/utils';
|
|
1
|
+
import { type TSESLint } from '@typescript-eslint/utils';
|
|
2
2
|
export declare const ruleId = "no-status-code-assert";
|
|
3
3
|
declare const NO_STATUS_CODE_ASSERT = "NO_STATUS_CODE_ASSERT";
|
|
4
4
|
declare const rule: TSESLint.RuleModule<typeof NO_STATUS_CODE_ASSERT>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function derefSchema(schemaFileName: string): Promise<void>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { SchemaObject } from 'ajv/dist/2020';
|
|
2
|
+
export declare const commandName = "generate-schema";
|
|
3
|
+
export { generateSchemasForService } from './service-schema-generator.ts';
|
|
4
|
+
declare const ALL_OPERATION_METHODS: readonly ["get", "put", "post", "head", "trace", "patch", "delete", "options"];
|
|
5
|
+
export declare const SWAGGER_SCHEMA_FILENAME = "swagger.schema.json";
|
|
6
|
+
export type HttpMethod = (typeof ALL_OPERATION_METHODS)[number];
|
|
7
|
+
export interface RequestContext {
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
body?: unknown;
|
|
10
|
+
params?: unknown;
|
|
11
|
+
query?: unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface ResponseContext {
|
|
14
|
+
headers?: Record<string, string>;
|
|
15
|
+
body?: unknown;
|
|
16
|
+
}
|
|
17
|
+
export interface ApiOperation {
|
|
18
|
+
path: string;
|
|
19
|
+
method: string;
|
|
20
|
+
operationId: string;
|
|
21
|
+
request: RequestContext;
|
|
22
|
+
responses: Record<string, ResponseContext>;
|
|
23
|
+
}
|
|
24
|
+
export interface OperationSchemas {
|
|
25
|
+
request: SchemaObject;
|
|
26
|
+
responses: Record<string, SchemaObject>;
|
|
27
|
+
}
|
|
28
|
+
export interface ApiSchemas {
|
|
29
|
+
apis: Record<string, Record<string, OperationSchemas>>;
|
|
30
|
+
definitions?: Record<string, SchemaObject>;
|
|
31
|
+
}
|
|
32
|
+
export declare function buildApiSchemaFromYaml(yamlContent: string, organization: string, serviceName: string): ApiSchemas | null;
|
|
33
|
+
export declare function generateSchemas(): Promise<void>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare function peg$SyntaxError(message: any, expected: any, found: any, location: any): Error;
|
|
2
|
+
declare namespace peg$SyntaxError {
|
|
3
|
+
var buildMessage: (expected: any, found: any) => string;
|
|
4
|
+
}
|
|
5
|
+
declare namespace peg$SyntaxError {
|
|
6
|
+
var buildMessage: (expected: any, found: any) => string;
|
|
7
|
+
}
|
|
8
|
+
declare namespace peg$SyntaxError {
|
|
9
|
+
var buildMessage: (expected: any, found: any) => string;
|
|
10
|
+
}
|
|
11
|
+
declare function peg$parse(input: any, options: any): any;
|
|
12
|
+
declare const peg$allowedStartRules: string[];
|
|
13
|
+
export { peg$allowedStartRules as StartRules, peg$SyntaxError as SyntaxError, peg$parse as parse };
|