@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.
Files changed (66) hide show
  1. package/LICENSE.txt +21 -0
  2. package/README.md +17 -0
  3. package/SECURITY.md +13 -0
  4. package/dist-mjs/athena/api-locator.mjs +66 -0
  5. package/dist-mjs/athena/api-matcher.mjs +206 -0
  6. package/dist-mjs/athena/athena.mjs +165 -0
  7. package/dist-mjs/athena/column.mjs +1 -0
  8. package/dist-mjs/athena/context.mjs +21 -0
  9. package/dist-mjs/athena/index.mjs +1 -0
  10. package/dist-mjs/athena/service-table.mjs +45 -0
  11. package/dist-mjs/athena/sql-file.mjs +123 -0
  12. package/dist-mjs/athena/types.mjs +1 -0
  13. package/dist-mjs/athena/validate.mjs +619 -0
  14. package/dist-mjs/athena/visitor.mjs +291 -0
  15. package/dist-mjs/get-documentation-url.mjs +9 -0
  16. package/dist-mjs/index.mjs +56 -0
  17. package/dist-mjs/openapi/deref-schema.mjs +20 -0
  18. package/dist-mjs/openapi/generate-schema.mjs +375 -0
  19. package/dist-mjs/openapi/service-schema-generator.mjs +176 -0
  20. package/dist-mjs/peggy/athena-peggy.mjs +20700 -0
  21. package/dist-mjs/service.mjs +9 -0
  22. package/dist-mjs/sql-parser.mjs +28 -0
  23. package/dist-types/athena/api-locator.d.ts +2 -0
  24. package/dist-types/athena/api-matcher.d.ts +14 -0
  25. package/dist-types/athena/athena.d.ts +5 -0
  26. package/dist-types/athena/column.d.ts +1 -0
  27. package/dist-types/athena/context.d.ts +21 -0
  28. package/dist-types/athena/index.d.ts +8 -0
  29. package/dist-types/athena/service-table.d.ts +8 -0
  30. package/dist-types/athena/sql-file.d.ts +5 -0
  31. package/dist-types/athena/types.d.ts +493 -0
  32. package/dist-types/athena/validate.d.ts +14 -0
  33. package/dist-types/athena/visitor.d.ts +75 -0
  34. package/dist-types/get-documentation-url.d.ts +1 -0
  35. package/dist-types/index.d.ts +5 -0
  36. package/dist-types/openapi/deref-schema.d.ts +1 -0
  37. package/dist-types/openapi/generate-schema.d.ts +33 -0
  38. package/dist-types/openapi/service-schema-generator.d.ts +5 -0
  39. package/dist-types/peggy/athena-peggy.d.ts +13 -0
  40. package/dist-types/service.d.ts +2 -0
  41. package/dist-types/sql-parser.d.ts +25 -0
  42. package/package.json +1 -0
  43. package/src/api/v1/swagger.yml +619 -0
  44. package/src/api/v2/swagger.yml +477 -0
  45. package/src/athena/api-locator.ts +78 -0
  46. package/src/athena/api-matcher.ts +323 -0
  47. package/src/athena/athena.ts +224 -0
  48. package/src/athena/column.ts +4 -0
  49. package/src/athena/context.ts +47 -0
  50. package/src/athena/index.ts +13 -0
  51. package/src/athena/service-table.ts +78 -0
  52. package/src/athena/sql-file.ts +161 -0
  53. package/src/athena/types.ts +568 -0
  54. package/src/athena/validate.ts +902 -0
  55. package/src/athena/visitor.ts +406 -0
  56. package/src/get-documentation-url.ts +7 -0
  57. package/src/index.ts +67 -0
  58. package/src/openapi/deref-schema.ts +20 -0
  59. package/src/openapi/generate-schema.ts +553 -0
  60. package/src/openapi/service-schema-generator.ts +241 -0
  61. package/src/peggy/athena-peggy.ts +22149 -0
  62. package/src/peggy/athena.peggy +2971 -0
  63. package/src/service.ts +11 -0
  64. package/src/services/eslintAthenaPlugin/v1/swagger.schema.deref.json +1931 -0
  65. package/src/services/eslintAthenaPlugin/v2/swagger.schema.deref.json +978 -0
  66. package/src/sql-parser.ts +53 -0
@@ -0,0 +1 @@
1
+ export default function getDocumentationUrl(ruleId: string): string;
@@ -0,0 +1,5 @@
1
+ import type { TSESLint } from '@typescript-eslint/utils';
2
+ declare const defaultToExport: Exclude<TSESLint.FlatConfig.Plugin, 'config'> & {
3
+ configs: Record<string, TSESLint.FlatConfig.Config[]>;
4
+ };
5
+ export default defaultToExport;
@@ -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,5 @@
1
+ import { type ApiSchemas } from './generate-schema.ts';
2
+ export declare function generateSchemasForService(serviceName: string, outputDir?: string): {
3
+ schema: ApiSchemas;
4
+ endpoint: string;
5
+ }[];
@@ -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,2 @@
1
+ import ts from 'typescript';
2
+ export declare function isServiceResponse(type: ts.Type): boolean;
@@ -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"]}}}