@checkdigit/eslint-athena-plugin 1.0.0-PR.2-dcdf
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/LICENSE.txt +21 -0
- package/README.md +17 -0
- package/SECURITY.md +13 -0
- package/dist-mjs/athena/api-locator.mjs +66 -0
- package/dist-mjs/athena/api-matcher.mjs +206 -0
- package/dist-mjs/athena/athena.mjs +165 -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 +45 -0
- package/dist-mjs/athena/sql-file.mjs +123 -0
- package/dist-mjs/athena/types.mjs +1 -0
- package/dist-mjs/athena/validate.mjs +619 -0
- package/dist-mjs/athena/visitor.mjs +291 -0
- package/dist-mjs/get-documentation-url.mjs +9 -0
- package/dist-mjs/index.mjs +56 -0
- package/dist-mjs/openapi/deref-schema.mjs +20 -0
- package/dist-mjs/openapi/generate-schema.mjs +375 -0
- package/dist-mjs/openapi/service-schema-generator.mjs +176 -0
- package/dist-mjs/peggy/athena-peggy.mjs +20700 -0
- package/dist-mjs/service.mjs +9 -0
- package/dist-mjs/sql-parser.mjs +28 -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 +5 -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/sql-file.d.ts +5 -0
- package/dist-types/athena/types.d.ts +493 -0
- package/dist-types/athena/validate.d.ts +14 -0
- package/dist-types/athena/visitor.d.ts +75 -0
- package/dist-types/get-documentation-url.d.ts +1 -0
- package/dist-types/index.d.ts +5 -0
- 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/dist-types/service.d.ts +2 -0
- package/dist-types/sql-parser.d.ts +25 -0
- package/package.json +1 -0
- package/src/api/v1/swagger.yml +619 -0
- package/src/api/v2/swagger.yml +477 -0
- package/src/athena/api-locator.ts +78 -0
- package/src/athena/api-matcher.ts +323 -0
- package/src/athena/athena.ts +224 -0
- package/src/athena/column.ts +4 -0
- package/src/athena/context.ts +47 -0
- package/src/athena/index.ts +13 -0
- package/src/athena/service-table.ts +78 -0
- package/src/athena/sql-file.ts +161 -0
- package/src/athena/types.ts +568 -0
- package/src/athena/validate.ts +902 -0
- package/src/athena/visitor.ts +406 -0
- package/src/get-documentation-url.ts +7 -0
- package/src/index.ts +67 -0
- package/src/openapi/deref-schema.ts +20 -0
- package/src/openapi/generate-schema.ts +553 -0
- package/src/openapi/service-schema-generator.ts +241 -0
- package/src/peggy/athena-peggy.ts +22149 -0
- package/src/peggy/athena.peggy +2971 -0
- package/src/service.ts +11 -0
- package/src/services/eslintAthenaPlugin/v1/swagger.schema.deref.json +1931 -0
- package/src/services/eslintAthenaPlugin/v2/swagger.schema.deref.json +978 -0
- package/src/sql-parser.ts +53 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getDocumentationUrl(ruleId: string): string;
|
|
@@ -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 | undefined;
|
|
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 };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
interface SqlParseResult {
|
|
2
|
+
ast: {
|
|
3
|
+
type: 'Program';
|
|
4
|
+
body: never[];
|
|
5
|
+
sourceType: 'module';
|
|
6
|
+
range: [number, number];
|
|
7
|
+
loc: {
|
|
8
|
+
start: {
|
|
9
|
+
line: number;
|
|
10
|
+
column: number;
|
|
11
|
+
};
|
|
12
|
+
end: {
|
|
13
|
+
line: number;
|
|
14
|
+
column: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
tokens: never[];
|
|
18
|
+
comments: never[];
|
|
19
|
+
};
|
|
20
|
+
services: Record<string, never>;
|
|
21
|
+
scopeManager: null;
|
|
22
|
+
visitorKeys: Record<string, string[]>;
|
|
23
|
+
}
|
|
24
|
+
export declare function parseForESLint(code: string): SqlParseResult;
|
|
25
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"@checkdigit/eslint-athena-plugin","version":"1.0.0-PR.2-dcdf","description":"Check Digit eslint plugins to enforce best practices for projects using Athena SQL.","keywords":["eslint","eslintplugin"],"homepage":"https://github.com/checkdigit/eslint-athena-plugin#readme","bugs":{"url":"https://github.com/checkdigit/eslint-athena-plugin/issues"},"repository":{"type":"git","url":"https://github.com/checkdigit/eslint-athena-plugin"},"license":"MIT","author":"Check Digit, LLC","sideEffects":false,"type":"module","exports":{".":{"types":"./dist-types/index.d.ts","import":"./dist-mjs/index.mjs","default":"./dist-mjs/index.mjs"}},"files":["src","dist-types","dist-mjs","!src/**/test/**","!src/**/*.test.ts","!src/**/*.spec.ts","!dist-types/**/test/**","!dist-types/**/*.test.d.ts","!dist-types/**/*.spec.d.ts","!dist-mjs/**/test/**","!dist-mjs/**/*.test.mjs","!dist-mjs/**/*.spec.mjs","SECURITY.md"],"scripts":{"build:dist-mjs":"rimraf dist-mjs && npx builder --type=module --sourceMap --outDir=dist-mjs && node dist-mjs/index.mjs","build:dist-types":"rimraf dist-types && npx builder --type=types --outDir=dist-types","ci:compile":"tsc --noEmit","ci:coverage":"NODE_OPTIONS=\"--disable-warning ExperimentalWarning --experimental-vm-modules\" jest --coverage=true","ci:lint":"npm run lint","ci:style":"npm run prettier","ci:test":"NODE_OPTIONS=\"--disable-warning ExperimentalWarning --experimental-vm-modules\" jest --coverage=false","lint":"eslint --max-warnings 0 .","lint:fix":"eslint --max-warnings 0 --fix .","peggy":"for file in ./src/peggy/*.peggy; do peggy \"$file\" --format es --output \"${file%.peggy}-peggy.ts\"; done","peggy-watch":"for file in ./src/peggy/*.peggy; do peggy \"$file\" --format=es --watch --output=\"${file%.peggy}-peggy.ts\"; done","prepare":"","prepublishOnly":"npm run build:dist-types && npm run build:dist-mjs","prettier":"prettier --ignore-path .gitignore --ignore-path .prettierignore --list-different .","prettier:fix":"prettier --ignore-path .gitignore --ignore-path .prettierignore --write .","test":"npm run ci:compile && npm run ci:test && npm run ci:lint && npm run ci:style"},"prettier":"@checkdigit/prettier-config","jest":{"preset":"@checkdigit/jest-config"},"dependencies":{"@apidevtools/json-schema-ref-parser":"^15.3.6","@typescript-eslint/type-utils":"^8.61.1","@typescript-eslint/utils":"^8.61.1","ajv":"^8.20.0","debug":"^4.4.3","glob":"^13.0.6","http-status-codes":"^2.3.0","js-yaml":"^4.2.0","json-pointer":"^0.6.2","jsonpath-plus":"^10.4.0","ts-api-utils":"^2.5.0"},"devDependencies":{"@checkdigit/jest-config":"^6.0.2","@checkdigit/prettier-config":"^8.0.0","@checkdigit/typescript-config":"10.0.0","@eslint/js":"^9.37.0","@types/debug":"^4.1.13","@types/eslint":"^9.6.1","@types/eslint-config-prettier":"^6.11.3","@types/js-yaml":"^4.0.9","@types/json-pointer":"^1.0.34","@typescript-eslint/parser":"^8.61.1","@typescript-eslint/rule-tester":"^8.61.1","eslint":"^9.37.0","eslint-config-prettier":"^10.1.8","eslint-import-resolver-typescript":"^4.4.5","eslint-plugin-eslint-plugin":"^6.4.0","eslint-plugin-import":"^2.32.0","eslint-plugin-no-only-tests":"^3.4.0","eslint-plugin-no-secrets":"^2.3.3","eslint-plugin-node":"^11.1.0","eslint-plugin-sonarjs":"^1.0.4","openapi-types":"^12.1.3","peggy":"^4.2.0","rimraf":"^6.1.3","typescript-eslint":"^8.61.1"},"peerDependencies":{"eslint":">=9 <10"},"engines":{"node":">=24.14.1"},"service":{"api":{"root":"src","endpoints":["api/v1","api/v2"]}}}
|