From 079662ac3a3f760c8d395c9a56464ef7ff0d5de5 Mon Sep 17 00:00:00 2001 From: Nihal Gonsalves Date: Fri, 15 Mar 2019 16:22:00 +0100 Subject: [PATCH 1/5] Add .editorconfig --- .editorconfig | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..86a63dc --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true From d6b7e1288a767876ecd797fb230de1fe8e4a2008 Mon Sep 17 00:00:00 2001 From: Nihal Gonsalves Date: Fri, 15 Mar 2019 17:27:25 +0100 Subject: [PATCH 2/5] Add tsconfig.json --- tsconfig.json | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 tsconfig.json diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..439e9ae --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,60 @@ +{ + "compilerOptions": { + /* Basic Options */ + "target": "ES2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ + "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "composite": true, /* Enable project compilation */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + + /* Source Map Options */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + } +} From 24929c3f83eecf4f1c34307492fb83b1a5a3adda Mon Sep 17 00:00:00 2001 From: Nihal Gonsalves Date: Fri, 15 Mar 2019 17:41:09 +0100 Subject: [PATCH 3/5] Add initial script to generate a TypeScript Enum --- bin/sync.ts | 82 +++++++ package-lock.json | 494 +++++++++++++++++++++++++++++++++++++++++- package.json | 13 +- src/PostgresError.ts | 498 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1085 insertions(+), 2 deletions(-) create mode 100644 bin/sync.ts create mode 100644 src/PostgresError.ts diff --git a/bin/sync.ts b/bin/sync.ts new file mode 100644 index 0000000..86e1e39 --- /dev/null +++ b/bin/sync.ts @@ -0,0 +1,82 @@ +import { join } from 'path'; +import { writeFileSync } from 'fs'; +import lodashFlatten from 'lodash.flatten'; +import isomorphicFetch from 'isomorphic-fetch'; + +const sourceUrl = (branch = 'master') => + `https://github.com/postgres/postgres/raw/${branch}/src/backend/utils/errcodes.txt`; + +const getSourceText = (): Promise => + isomorphicFetch(sourceUrl()) + .then(response => response.text()) + .then(text => text.split('\n')); + +const stripCommentsAndEmptyLines = (lines: string[]) => + lines.filter(line => line !== '' && line.charAt(0) !== '#'); + +const sectionRegex = /^Section:\s(?.*)$/; + +const groupBySections = (lines: string[]) => { + const sections: Record = {}; + let currentSection = ''; + + lines.forEach(line => { + const matches = line.match(sectionRegex); + + if (matches) { + currentSection = (matches as any).groups.description; + sections[currentSection] = { + description: currentSection, + lines: [], + }; + } else { + sections[currentSection].lines.push(line); + } + }); + + return Object.values(sections); +} + +const errorLineRegex = + /^(?[A-Z0-9]*)\s*(?[EWS])\s*ERRCODE_(?[A-Z_]*)\s*(?[a-z_]*)$/ + +const parseErrorLine = (line: string) => { + const matches = line.match(errorLineRegex); + + if (!matches) { + throw new Error(`Error parsing error line:\n\t"${line}"`); + } + + const { sqlstate, severity, constant, code } = (matches as any).groups; + + return { sqlstate, severity, constant, code }; +}; + +const parseSectionLines = (data: ReturnType) => + data.map(({ lines, ...otherData }) => ({ errorCodes: lines.map(parseErrorLine), ...otherData })); + +const getEnum = async () => { + const errorSections = + await getSourceText() + .then(stripCommentsAndEmptyLines) + .then(groupBySections) + .then(parseSectionLines); + + const enumEntries = errorSections.map(section => + section.errorCodes.map( + errorCode => ` /** ${section.description}: [${errorCode.severity}] ${errorCode.code} */\n ${errorCode.constant} = '${errorCode.sqlstate}',`, + ), + ); + + const allEntries = lodashFlatten(enumEntries); + + return `export enum PostgresError {\n${ + allEntries.join('\n') + }\n}\n`; +} + +const writeEnum = (enumString: string) => { + writeFileSync(join(__dirname, '../src/PostgresError.ts'), enumString); +} + +getEnum().then(writeEnum); diff --git a/package-lock.json b/package-lock.json index 69413ea..bea84a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,497 @@ { "name": "pg-error-constants-ts", "version": "0.1.0", - "lockfileVersion": 1 + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/isomorphic-fetch": { + "version": "0.0.35", + "resolved": "https://registry.npmjs.org/@types/isomorphic-fetch/-/isomorphic-fetch-0.0.35.tgz", + "integrity": "sha512-DaZNUvLDCAnCTjgwxgiL1eQdxIKEpNLOlTNtAgnZc50bG2copGhRrFN9/PxPBuJe+tZVLCbQ7ls0xveXVRPkvw==", + "dev": true + }, + "@types/lodash": { + "version": "4.14.123", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.123.tgz", + "integrity": "sha512-pQvPkc4Nltyx7G1Ww45OjVqUsJP4UsZm+GWJpigXgkikZqJgRm4c48g027o6tdgubWHwFRF15iFd+Y4Pmqv6+Q==", + "dev": true + }, + "@types/lodash.flatten": { + "version": "4.4.6", + "resolved": "https://registry.npmjs.org/@types/lodash.flatten/-/lodash.flatten-4.4.6.tgz", + "integrity": "sha512-omCBl4M8EJSmf2DZqh4/zwjgXQpzC7YO/PXTcG8rI9r7xun8CohrHeNx8HZRkqWc61uJfIaZop9MwJEXPVssHw==", + "dev": true, + "requires": { + "@types/lodash": "*" + } + }, + "@types/node": { + "version": "10.14.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.1.tgz", + "integrity": "sha512-Rymt08vh1GaW4vYB6QP61/5m/CFLGnFZP++bJpWbiNxceNa6RBipDmb413jvtSf/R1gg5a/jQVl2jY4XVRscEA==", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "arg": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.0.tgz", + "integrity": "sha512-ZWc51jO3qegGkVh8Hwpv636EkbesNV5ZNQPCtRa+0qytRYPEs9IYT9qITY9buezqUH5uqyzlWLcufrzU2rffdg==", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" + }, + "dependencies": { + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + } + } + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "commander": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", + "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "encoding": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", + "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", + "dev": true, + "requires": { + "iconv-lite": "~0.4.13" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "isomorphic-fetch": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", + "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", + "dev": true, + "requires": { + "node-fetch": "^1.0.1", + "whatwg-fetch": ">=0.10.0" + } + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "js-yaml": { + "version": "3.12.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.2.tgz", + "integrity": "sha512-QHn/Lh/7HhZ/Twc7vJYQTkjuCa0kaCcDcjK5Zlk2rvnUpy7DxMJ23+Jc2dcyvltwQVg1nygAVlB2oRDFHoRS5Q==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", + "dev": true + }, + "make-error": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", + "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "node-fetch": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", + "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", + "dev": true, + "requires": { + "encoding": "^0.1.11", + "is-stream": "^1.0.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "resolve": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz", + "integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.11", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.11.tgz", + "integrity": "sha512-//sajEx/fGL3iw6fltKMdPvy8kL3kJ2O3iuYlRoT3k9Kb4BjOoZ+BZzaNHeuaruSt+Kf3Zk9tnfAQg9/AJqUVQ==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + }, + "ts-node": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.0.3.tgz", + "integrity": "sha512-2qayBA4vdtVRuDo11DEFSsD/SFsBXQBRZZhbRGSIkmYmVkWjULn/GGMdG10KVqkaGndljfaTD8dKjWgcejO8YA==", + "dev": true, + "requires": { + "arg": "^4.1.0", + "diff": "^3.1.0", + "make-error": "^1.1.1", + "source-map-support": "^0.5.6", + "yn": "^3.0.0" + } + }, + "tslib": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", + "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", + "dev": true + }, + "tslint": { + "version": "5.14.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.14.0.tgz", + "integrity": "sha512-IUla/ieHVnB8Le7LdQFRGlVJid2T/gaJe5VkjzRVSRR6pA2ODYrnfR1hmxi+5+au9l50jBwpbBL34txgv4NnTQ==", + "dev": true, + "requires": { + "babel-code-frame": "^6.22.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^3.2.0", + "glob": "^7.1.1", + "js-yaml": "^3.7.0", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + } + }, + "tsutils": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, + "typescript": { + "version": "3.3.3333", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.3.3333.tgz", + "integrity": "sha512-JjSKsAfuHBE/fB2oZ8NxtRTk5iGcg6hkYXMnZ3Wc+b2RSqejEqTaem11mHASMnFilHrax3sLK0GDzcJrekZYLw==", + "dev": true + }, + "whatwg-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz", + "integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "yn": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.0.0.tgz", + "integrity": "sha512-+Wo/p5VRfxUgBUGy2j/6KX2mj9AYJWOHuhMjMcbBFc3y54o9/4buK1ksBvuiK01C3kby8DH9lSmJdSxw+4G/2Q==", + "dev": true + } + } } diff --git a/package.json b/package.json index 49e34e5..75fb71d 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "TypeScript Enums for Postgres Errors", "main": "index.js", "scripts": { + "sync": "ts-node --transpile-only bin/sync.ts", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { @@ -15,5 +16,15 @@ "bugs": { "url": "https://github.com/nihalgonsalves/pg-error-constants-ts/issues" }, - "homepage": "https://github.com/nihalgonsalves/pg-error-constants-ts#readme" + "homepage": "https://github.com/nihalgonsalves/pg-error-constants-ts#readme", + "devDependencies": { + "@types/isomorphic-fetch": "0.0.35", + "@types/lodash.flatten": "^4.4.6", + "@types/node": "^10.14.1", + "isomorphic-fetch": "^2.2.1", + "lodash.flatten": "^4.4.0", + "ts-node": "^8.0.3", + "tslint": "^5.14.0", + "typescript": "^3.3.3333" + } } diff --git a/src/PostgresError.ts b/src/PostgresError.ts new file mode 100644 index 0000000..100f090 --- /dev/null +++ b/src/PostgresError.ts @@ -0,0 +1,498 @@ +export enum PostgresError { + /** Class 00 - Successful Completion: [S] successful_completion */ + SUCCESSFUL_COMPLETION = '00000', + /** Class 01 - Warning: [W] warning */ + WARNING = '01000', + /** Class 01 - Warning: [W] dynamic_result_sets_returned */ + WARNING_DYNAMIC_RESULT_SETS_RETURNED = '0100C', + /** Class 01 - Warning: [W] implicit_zero_bit_padding */ + WARNING_IMPLICIT_ZERO_BIT_PADDING = '01008', + /** Class 01 - Warning: [W] null_value_eliminated_in_set_function */ + WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION = '01003', + /** Class 01 - Warning: [W] privilege_not_granted */ + WARNING_PRIVILEGE_NOT_GRANTED = '01007', + /** Class 01 - Warning: [W] privilege_not_revoked */ + WARNING_PRIVILEGE_NOT_REVOKED = '01006', + /** Class 01 - Warning: [W] string_data_right_truncation */ + WARNING_STRING_DATA_RIGHT_TRUNCATION = '01004', + /** Class 01 - Warning: [W] deprecated_feature */ + WARNING_DEPRECATED_FEATURE = '01P01', + /** Class 02 - No Data (this is also a warning class per the SQL standard): [W] no_data */ + NO_DATA = '02000', + /** Class 02 - No Data (this is also a warning class per the SQL standard): [W] no_additional_dynamic_result_sets_returned */ + NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED = '02001', + /** Class 03 - SQL Statement Not Yet Complete: [E] sql_statement_not_yet_complete */ + SQL_STATEMENT_NOT_YET_COMPLETE = '03000', + /** Class 08 - Connection Exception: [E] connection_exception */ + CONNECTION_EXCEPTION = '08000', + /** Class 08 - Connection Exception: [E] connection_does_not_exist */ + CONNECTION_DOES_NOT_EXIST = '08003', + /** Class 08 - Connection Exception: [E] connection_failure */ + CONNECTION_FAILURE = '08006', + /** Class 08 - Connection Exception: [E] sqlclient_unable_to_establish_sqlconnection */ + SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION = '08001', + /** Class 08 - Connection Exception: [E] sqlserver_rejected_establishment_of_sqlconnection */ + SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION = '08004', + /** Class 08 - Connection Exception: [E] transaction_resolution_unknown */ + TRANSACTION_RESOLUTION_UNKNOWN = '08007', + /** Class 08 - Connection Exception: [E] protocol_violation */ + PROTOCOL_VIOLATION = '08P01', + /** Class 09 - Triggered Action Exception: [E] triggered_action_exception */ + TRIGGERED_ACTION_EXCEPTION = '09000', + /** Class 0A - Feature Not Supported: [E] feature_not_supported */ + FEATURE_NOT_SUPPORTED = '0A000', + /** Class 0B - Invalid Transaction Initiation: [E] invalid_transaction_initiation */ + INVALID_TRANSACTION_INITIATION = '0B000', + /** Class 0F - Locator Exception: [E] locator_exception */ + LOCATOR_EXCEPTION = '0F000', + /** Class 0F - Locator Exception: [E] invalid_locator_specification */ + L_E_INVALID_SPECIFICATION = '0F001', + /** Class 0L - Invalid Grantor: [E] invalid_grantor */ + INVALID_GRANTOR = '0L000', + /** Class 0L - Invalid Grantor: [E] invalid_grant_operation */ + INVALID_GRANT_OPERATION = '0LP01', + /** Class 0P - Invalid Role Specification: [E] invalid_role_specification */ + INVALID_ROLE_SPECIFICATION = '0P000', + /** Class 0Z - Diagnostics Exception: [E] diagnostics_exception */ + DIAGNOSTICS_EXCEPTION = '0Z000', + /** Class 0Z - Diagnostics Exception: [E] stacked_diagnostics_accessed_without_active_handler */ + STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER = '0Z002', + /** Class 20 - Case Not Found: [E] case_not_found */ + CASE_NOT_FOUND = '20000', + /** Class 21 - Cardinality Violation: [E] cardinality_violation */ + CARDINALITY_VIOLATION = '21000', + /** Class 22 - Data Exception: [E] data_exception */ + DATA_EXCEPTION = '22000', + /** Class 22 - Data Exception: [E] */ + ARRAY_ELEMENT_ERROR = '2202E', + /** Class 22 - Data Exception: [E] array_subscript_error */ + ARRAY_SUBSCRIPT_ERROR = '2202E', + /** Class 22 - Data Exception: [E] character_not_in_repertoire */ + CHARACTER_NOT_IN_REPERTOIRE = '22021', + /** Class 22 - Data Exception: [E] datetime_field_overflow */ + DATETIME_FIELD_OVERFLOW = '22008', + /** Class 22 - Data Exception: [E] */ + DATETIME_VALUE_OUT_OF_RANGE = '22008', + /** Class 22 - Data Exception: [E] division_by_zero */ + DIVISION_BY_ZERO = '22012', + /** Class 22 - Data Exception: [E] error_in_assignment */ + ERROR_IN_ASSIGNMENT = '22005', + /** Class 22 - Data Exception: [E] escape_character_conflict */ + ESCAPE_CHARACTER_CONFLICT = '2200B', + /** Class 22 - Data Exception: [E] indicator_overflow */ + INDICATOR_OVERFLOW = '22022', + /** Class 22 - Data Exception: [E] interval_field_overflow */ + INTERVAL_FIELD_OVERFLOW = '22015', + /** Class 22 - Data Exception: [E] invalid_argument_for_logarithm */ + INVALID_ARGUMENT_FOR_LOG = '2201E', + /** Class 22 - Data Exception: [E] invalid_argument_for_ntile_function */ + INVALID_ARGUMENT_FOR_NTILE = '22014', + /** Class 22 - Data Exception: [E] invalid_argument_for_nth_value_function */ + INVALID_ARGUMENT_FOR_NTH_VALUE = '22016', + /** Class 22 - Data Exception: [E] invalid_argument_for_power_function */ + INVALID_ARGUMENT_FOR_POWER_FUNCTION = '2201F', + /** Class 22 - Data Exception: [E] invalid_argument_for_width_bucket_function */ + INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION = '2201G', + /** Class 22 - Data Exception: [E] invalid_character_value_for_cast */ + INVALID_CHARACTER_VALUE_FOR_CAST = '22018', + /** Class 22 - Data Exception: [E] invalid_datetime_format */ + INVALID_DATETIME_FORMAT = '22007', + /** Class 22 - Data Exception: [E] invalid_escape_character */ + INVALID_ESCAPE_CHARACTER = '22019', + /** Class 22 - Data Exception: [E] invalid_escape_octet */ + INVALID_ESCAPE_OCTET = '2200D', + /** Class 22 - Data Exception: [E] invalid_escape_sequence */ + INVALID_ESCAPE_SEQUENCE = '22025', + /** Class 22 - Data Exception: [E] nonstandard_use_of_escape_character */ + NONSTANDARD_USE_OF_ESCAPE_CHARACTER = '22P06', + /** Class 22 - Data Exception: [E] invalid_indicator_parameter_value */ + INVALID_INDICATOR_PARAMETER_VALUE = '22010', + /** Class 22 - Data Exception: [E] invalid_parameter_value */ + INVALID_PARAMETER_VALUE = '22023', + /** Class 22 - Data Exception: [E] invalid_preceding_or_following_size */ + INVALID_PRECEDING_OR_FOLLOWING_SIZE = '22013', + /** Class 22 - Data Exception: [E] invalid_regular_expression */ + INVALID_REGULAR_EXPRESSION = '2201B', + /** Class 22 - Data Exception: [E] invalid_row_count_in_limit_clause */ + INVALID_ROW_COUNT_IN_LIMIT_CLAUSE = '2201W', + /** Class 22 - Data Exception: [E] invalid_row_count_in_result_offset_clause */ + INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE = '2201X', + /** Class 22 - Data Exception: [E] invalid_tablesample_argument */ + INVALID_TABLESAMPLE_ARGUMENT = '2202H', + /** Class 22 - Data Exception: [E] invalid_tablesample_repeat */ + INVALID_TABLESAMPLE_REPEAT = '2202G', + /** Class 22 - Data Exception: [E] invalid_time_zone_displacement_value */ + INVALID_TIME_ZONE_DISPLACEMENT_VALUE = '22009', + /** Class 22 - Data Exception: [E] invalid_use_of_escape_character */ + INVALID_USE_OF_ESCAPE_CHARACTER = '2200C', + /** Class 22 - Data Exception: [E] most_specific_type_mismatch */ + MOST_SPECIFIC_TYPE_MISMATCH = '2200G', + /** Class 22 - Data Exception: [E] null_value_not_allowed */ + NULL_VALUE_NOT_ALLOWED = '22004', + /** Class 22 - Data Exception: [E] null_value_no_indicator_parameter */ + NULL_VALUE_NO_INDICATOR_PARAMETER = '22002', + /** Class 22 - Data Exception: [E] numeric_value_out_of_range */ + NUMERIC_VALUE_OUT_OF_RANGE = '22003', + /** Class 22 - Data Exception: [E] sequence_generator_limit_exceeded */ + SEQUENCE_GENERATOR_LIMIT_EXCEEDED = '2200H', + /** Class 22 - Data Exception: [E] string_data_length_mismatch */ + STRING_DATA_LENGTH_MISMATCH = '22026', + /** Class 22 - Data Exception: [E] string_data_right_truncation */ + STRING_DATA_RIGHT_TRUNCATION = '22001', + /** Class 22 - Data Exception: [E] substring_error */ + SUBSTRING_ERROR = '22011', + /** Class 22 - Data Exception: [E] trim_error */ + TRIM_ERROR = '22027', + /** Class 22 - Data Exception: [E] unterminated_c_string */ + UNTERMINATED_C_STRING = '22024', + /** Class 22 - Data Exception: [E] zero_length_character_string */ + ZERO_LENGTH_CHARACTER_STRING = '2200F', + /** Class 22 - Data Exception: [E] floating_point_exception */ + FLOATING_POINT_EXCEPTION = '22P01', + /** Class 22 - Data Exception: [E] invalid_text_representation */ + INVALID_TEXT_REPRESENTATION = '22P02', + /** Class 22 - Data Exception: [E] invalid_binary_representation */ + INVALID_BINARY_REPRESENTATION = '22P03', + /** Class 22 - Data Exception: [E] bad_copy_file_format */ + BAD_COPY_FILE_FORMAT = '22P04', + /** Class 22 - Data Exception: [E] untranslatable_character */ + UNTRANSLATABLE_CHARACTER = '22P05', + /** Class 22 - Data Exception: [E] not_an_xml_document */ + NOT_AN_XML_DOCUMENT = '2200L', + /** Class 22 - Data Exception: [E] invalid_xml_document */ + INVALID_XML_DOCUMENT = '2200M', + /** Class 22 - Data Exception: [E] invalid_xml_content */ + INVALID_XML_CONTENT = '2200N', + /** Class 22 - Data Exception: [E] invalid_xml_comment */ + INVALID_XML_COMMENT = '2200S', + /** Class 22 - Data Exception: [E] invalid_xml_processing_instruction */ + INVALID_XML_PROCESSING_INSTRUCTION = '2200T', + /** Class 23 - Integrity Constraint Violation: [E] integrity_constraint_violation */ + INTEGRITY_CONSTRAINT_VIOLATION = '23000', + /** Class 23 - Integrity Constraint Violation: [E] restrict_violation */ + RESTRICT_VIOLATION = '23001', + /** Class 23 - Integrity Constraint Violation: [E] not_null_violation */ + NOT_NULL_VIOLATION = '23502', + /** Class 23 - Integrity Constraint Violation: [E] foreign_key_violation */ + FOREIGN_KEY_VIOLATION = '23503', + /** Class 23 - Integrity Constraint Violation: [E] unique_violation */ + UNIQUE_VIOLATION = '23505', + /** Class 23 - Integrity Constraint Violation: [E] check_violation */ + CHECK_VIOLATION = '23514', + /** Class 23 - Integrity Constraint Violation: [E] exclusion_violation */ + EXCLUSION_VIOLATION = '23P01', + /** Class 24 - Invalid Cursor State: [E] invalid_cursor_state */ + INVALID_CURSOR_STATE = '24000', + /** Class 25 - Invalid Transaction State: [E] invalid_transaction_state */ + INVALID_TRANSACTION_STATE = '25000', + /** Class 25 - Invalid Transaction State: [E] active_sql_transaction */ + ACTIVE_SQL_TRANSACTION = '25001', + /** Class 25 - Invalid Transaction State: [E] branch_transaction_already_active */ + BRANCH_TRANSACTION_ALREADY_ACTIVE = '25002', + /** Class 25 - Invalid Transaction State: [E] held_cursor_requires_same_isolation_level */ + HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL = '25008', + /** Class 25 - Invalid Transaction State: [E] inappropriate_access_mode_for_branch_transaction */ + INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION = '25003', + /** Class 25 - Invalid Transaction State: [E] inappropriate_isolation_level_for_branch_transaction */ + INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION = '25004', + /** Class 25 - Invalid Transaction State: [E] no_active_sql_transaction_for_branch_transaction */ + NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION = '25005', + /** Class 25 - Invalid Transaction State: [E] read_only_sql_transaction */ + READ_ONLY_SQL_TRANSACTION = '25006', + /** Class 25 - Invalid Transaction State: [E] schema_and_data_statement_mixing_not_supported */ + SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED = '25007', + /** Class 25 - Invalid Transaction State: [E] no_active_sql_transaction */ + NO_ACTIVE_SQL_TRANSACTION = '25P01', + /** Class 25 - Invalid Transaction State: [E] in_failed_sql_transaction */ + IN_FAILED_SQL_TRANSACTION = '25P02', + /** Class 25 - Invalid Transaction State: [E] idle_in_transaction_session_timeout */ + IDLE_IN_TRANSACTION_SESSION_TIMEOUT = '25P03', + /** Class 26 - Invalid SQL Statement Name: [E] invalid_sql_statement_name */ + INVALID_SQL_STATEMENT_NAME = '26000', + /** Class 27 - Triggered Data Change Violation: [E] triggered_data_change_violation */ + TRIGGERED_DATA_CHANGE_VIOLATION = '27000', + /** Class 28 - Invalid Authorization Specification: [E] invalid_authorization_specification */ + INVALID_AUTHORIZATION_SPECIFICATION = '28000', + /** Class 28 - Invalid Authorization Specification: [E] invalid_password */ + INVALID_PASSWORD = '28P01', + /** Class 2B - Dependent Privilege Descriptors Still Exist: [E] dependent_privilege_descriptors_still_exist */ + DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST = '2B000', + /** Class 2B - Dependent Privilege Descriptors Still Exist: [E] dependent_objects_still_exist */ + DEPENDENT_OBJECTS_STILL_EXIST = '2BP01', + /** Class 2D - Invalid Transaction Termination: [E] invalid_transaction_termination */ + INVALID_TRANSACTION_TERMINATION = '2D000', + /** Class 2F - SQL Routine Exception: [E] sql_routine_exception */ + SQL_ROUTINE_EXCEPTION = '2F000', + /** Class 2F - SQL Routine Exception: [E] function_executed_no_return_statement */ + S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT = '2F005', + /** Class 2F - SQL Routine Exception: [E] modifying_sql_data_not_permitted */ + S_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED = '2F002', + /** Class 2F - SQL Routine Exception: [E] prohibited_sql_statement_attempted */ + S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED = '2F003', + /** Class 2F - SQL Routine Exception: [E] reading_sql_data_not_permitted */ + S_R_E_READING_SQL_DATA_NOT_PERMITTED = '2F004', + /** Class 34 - Invalid Cursor Name: [E] invalid_cursor_name */ + INVALID_CURSOR_NAME = '34000', + /** Class 38 - External Routine Exception: [E] external_routine_exception */ + EXTERNAL_ROUTINE_EXCEPTION = '38000', + /** Class 38 - External Routine Exception: [E] containing_sql_not_permitted */ + E_R_E_CONTAINING_SQL_NOT_PERMITTED = '38001', + /** Class 38 - External Routine Exception: [E] modifying_sql_data_not_permitted */ + E_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED = '38002', + /** Class 38 - External Routine Exception: [E] prohibited_sql_statement_attempted */ + E_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED = '38003', + /** Class 38 - External Routine Exception: [E] reading_sql_data_not_permitted */ + E_R_E_READING_SQL_DATA_NOT_PERMITTED = '38004', + /** Class 39 - External Routine Invocation Exception: [E] external_routine_invocation_exception */ + EXTERNAL_ROUTINE_INVOCATION_EXCEPTION = '39000', + /** Class 39 - External Routine Invocation Exception: [E] invalid_sqlstate_returned */ + E_R_I_E_INVALID_SQLSTATE_RETURNED = '39001', + /** Class 39 - External Routine Invocation Exception: [E] null_value_not_allowed */ + E_R_I_E_NULL_VALUE_NOT_ALLOWED = '39004', + /** Class 39 - External Routine Invocation Exception: [E] trigger_protocol_violated */ + E_R_I_E_TRIGGER_PROTOCOL_VIOLATED = '39P01', + /** Class 39 - External Routine Invocation Exception: [E] srf_protocol_violated */ + E_R_I_E_SRF_PROTOCOL_VIOLATED = '39P02', + /** Class 39 - External Routine Invocation Exception: [E] event_trigger_protocol_violated */ + E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED = '39P03', + /** Class 3B - Savepoint Exception: [E] savepoint_exception */ + SAVEPOINT_EXCEPTION = '3B000', + /** Class 3B - Savepoint Exception: [E] invalid_savepoint_specification */ + S_E_INVALID_SPECIFICATION = '3B001', + /** Class 3D - Invalid Catalog Name: [E] invalid_catalog_name */ + INVALID_CATALOG_NAME = '3D000', + /** Class 3F - Invalid Schema Name: [E] invalid_schema_name */ + INVALID_SCHEMA_NAME = '3F000', + /** Class 40 - Transaction Rollback: [E] transaction_rollback */ + TRANSACTION_ROLLBACK = '40000', + /** Class 40 - Transaction Rollback: [E] transaction_integrity_constraint_violation */ + T_R_INTEGRITY_CONSTRAINT_VIOLATION = '40002', + /** Class 40 - Transaction Rollback: [E] serialization_failure */ + T_R_SERIALIZATION_FAILURE = '40001', + /** Class 40 - Transaction Rollback: [E] statement_completion_unknown */ + T_R_STATEMENT_COMPLETION_UNKNOWN = '40003', + /** Class 40 - Transaction Rollback: [E] deadlock_detected */ + T_R_DEADLOCK_DETECTED = '40P01', + /** Class 42 - Syntax Error or Access Rule Violation: [E] syntax_error_or_access_rule_violation */ + SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION = '42000', + /** Class 42 - Syntax Error or Access Rule Violation: [E] syntax_error */ + SYNTAX_ERROR = '42601', + /** Class 42 - Syntax Error or Access Rule Violation: [E] insufficient_privilege */ + INSUFFICIENT_PRIVILEGE = '42501', + /** Class 42 - Syntax Error or Access Rule Violation: [E] cannot_coerce */ + CANNOT_COERCE = '42846', + /** Class 42 - Syntax Error or Access Rule Violation: [E] grouping_error */ + GROUPING_ERROR = '42803', + /** Class 42 - Syntax Error or Access Rule Violation: [E] windowing_error */ + WINDOWING_ERROR = '42P20', + /** Class 42 - Syntax Error or Access Rule Violation: [E] invalid_recursion */ + INVALID_RECURSION = '42P19', + /** Class 42 - Syntax Error or Access Rule Violation: [E] invalid_foreign_key */ + INVALID_FOREIGN_KEY = '42830', + /** Class 42 - Syntax Error or Access Rule Violation: [E] invalid_name */ + INVALID_NAME = '42602', + /** Class 42 - Syntax Error or Access Rule Violation: [E] name_too_long */ + NAME_TOO_LONG = '42622', + /** Class 42 - Syntax Error or Access Rule Violation: [E] reserved_name */ + RESERVED_NAME = '42939', + /** Class 42 - Syntax Error or Access Rule Violation: [E] datatype_mismatch */ + DATATYPE_MISMATCH = '42804', + /** Class 42 - Syntax Error or Access Rule Violation: [E] indeterminate_datatype */ + INDETERMINATE_DATATYPE = '42P18', + /** Class 42 - Syntax Error or Access Rule Violation: [E] collation_mismatch */ + COLLATION_MISMATCH = '42P21', + /** Class 42 - Syntax Error or Access Rule Violation: [E] indeterminate_collation */ + INDETERMINATE_COLLATION = '42P22', + /** Class 42 - Syntax Error or Access Rule Violation: [E] wrong_object_type */ + WRONG_OBJECT_TYPE = '42809', + /** Class 42 - Syntax Error or Access Rule Violation: [E] generated_always */ + GENERATED_ALWAYS = '428C9', + /** Class 42 - Syntax Error or Access Rule Violation: [E] undefined_column */ + UNDEFINED_COLUMN = '42703', + /** Class 42 - Syntax Error or Access Rule Violation: [E] */ + UNDEFINED_CURSOR = '34000', + /** Class 42 - Syntax Error or Access Rule Violation: [E] */ + UNDEFINED_DATABASE = '3D000', + /** Class 42 - Syntax Error or Access Rule Violation: [E] undefined_function */ + UNDEFINED_FUNCTION = '42883', + /** Class 42 - Syntax Error or Access Rule Violation: [E] */ + UNDEFINED_PSTATEMENT = '26000', + /** Class 42 - Syntax Error or Access Rule Violation: [E] */ + UNDEFINED_SCHEMA = '3F000', + /** Class 42 - Syntax Error or Access Rule Violation: [E] undefined_table */ + UNDEFINED_TABLE = '42P01', + /** Class 42 - Syntax Error or Access Rule Violation: [E] undefined_parameter */ + UNDEFINED_PARAMETER = '42P02', + /** Class 42 - Syntax Error or Access Rule Violation: [E] undefined_object */ + UNDEFINED_OBJECT = '42704', + /** Class 42 - Syntax Error or Access Rule Violation: [E] duplicate_column */ + DUPLICATE_COLUMN = '42701', + /** Class 42 - Syntax Error or Access Rule Violation: [E] duplicate_cursor */ + DUPLICATE_CURSOR = '42P03', + /** Class 42 - Syntax Error or Access Rule Violation: [E] duplicate_database */ + DUPLICATE_DATABASE = '42P04', + /** Class 42 - Syntax Error or Access Rule Violation: [E] duplicate_function */ + DUPLICATE_FUNCTION = '42723', + /** Class 42 - Syntax Error or Access Rule Violation: [E] duplicate_prepared_statement */ + DUPLICATE_PSTATEMENT = '42P05', + /** Class 42 - Syntax Error or Access Rule Violation: [E] duplicate_schema */ + DUPLICATE_SCHEMA = '42P06', + /** Class 42 - Syntax Error or Access Rule Violation: [E] duplicate_table */ + DUPLICATE_TABLE = '42P07', + /** Class 42 - Syntax Error or Access Rule Violation: [E] duplicate_alias */ + DUPLICATE_ALIAS = '42712', + /** Class 42 - Syntax Error or Access Rule Violation: [E] duplicate_object */ + DUPLICATE_OBJECT = '42710', + /** Class 42 - Syntax Error or Access Rule Violation: [E] ambiguous_column */ + AMBIGUOUS_COLUMN = '42702', + /** Class 42 - Syntax Error or Access Rule Violation: [E] ambiguous_function */ + AMBIGUOUS_FUNCTION = '42725', + /** Class 42 - Syntax Error or Access Rule Violation: [E] ambiguous_parameter */ + AMBIGUOUS_PARAMETER = '42P08', + /** Class 42 - Syntax Error or Access Rule Violation: [E] ambiguous_alias */ + AMBIGUOUS_ALIAS = '42P09', + /** Class 42 - Syntax Error or Access Rule Violation: [E] invalid_column_reference */ + INVALID_COLUMN_REFERENCE = '42P10', + /** Class 42 - Syntax Error or Access Rule Violation: [E] invalid_column_definition */ + INVALID_COLUMN_DEFINITION = '42611', + /** Class 42 - Syntax Error or Access Rule Violation: [E] invalid_cursor_definition */ + INVALID_CURSOR_DEFINITION = '42P11', + /** Class 42 - Syntax Error or Access Rule Violation: [E] invalid_database_definition */ + INVALID_DATABASE_DEFINITION = '42P12', + /** Class 42 - Syntax Error or Access Rule Violation: [E] invalid_function_definition */ + INVALID_FUNCTION_DEFINITION = '42P13', + /** Class 42 - Syntax Error or Access Rule Violation: [E] invalid_prepared_statement_definition */ + INVALID_PSTATEMENT_DEFINITION = '42P14', + /** Class 42 - Syntax Error or Access Rule Violation: [E] invalid_schema_definition */ + INVALID_SCHEMA_DEFINITION = '42P15', + /** Class 42 - Syntax Error or Access Rule Violation: [E] invalid_table_definition */ + INVALID_TABLE_DEFINITION = '42P16', + /** Class 42 - Syntax Error or Access Rule Violation: [E] invalid_object_definition */ + INVALID_OBJECT_DEFINITION = '42P17', + /** Class 44 - WITH CHECK OPTION Violation: [E] with_check_option_violation */ + WITH_CHECK_OPTION_VIOLATION = '44000', + /** Class 53 - Insufficient Resources: [E] insufficient_resources */ + INSUFFICIENT_RESOURCES = '53000', + /** Class 53 - Insufficient Resources: [E] disk_full */ + DISK_FULL = '53100', + /** Class 53 - Insufficient Resources: [E] out_of_memory */ + OUT_OF_MEMORY = '53200', + /** Class 53 - Insufficient Resources: [E] too_many_connections */ + TOO_MANY_CONNECTIONS = '53300', + /** Class 53 - Insufficient Resources: [E] configuration_limit_exceeded */ + CONFIGURATION_LIMIT_EXCEEDED = '53400', + /** Class 54 - Program Limit Exceeded: [E] program_limit_exceeded */ + PROGRAM_LIMIT_EXCEEDED = '54000', + /** Class 54 - Program Limit Exceeded: [E] statement_too_complex */ + STATEMENT_TOO_COMPLEX = '54001', + /** Class 54 - Program Limit Exceeded: [E] too_many_columns */ + TOO_MANY_COLUMNS = '54011', + /** Class 54 - Program Limit Exceeded: [E] too_many_arguments */ + TOO_MANY_ARGUMENTS = '54023', + /** Class 55 - Object Not In Prerequisite State: [E] object_not_in_prerequisite_state */ + OBJECT_NOT_IN_PREREQUISITE_STATE = '55000', + /** Class 55 - Object Not In Prerequisite State: [E] object_in_use */ + OBJECT_IN_USE = '55006', + /** Class 55 - Object Not In Prerequisite State: [E] cant_change_runtime_param */ + CANT_CHANGE_RUNTIME_PARAM = '55P02', + /** Class 55 - Object Not In Prerequisite State: [E] lock_not_available */ + LOCK_NOT_AVAILABLE = '55P03', + /** Class 55 - Object Not In Prerequisite State: [E] unsafe_new_enum_value_usage */ + UNSAFE_NEW_ENUM_VALUE_USAGE = '55P04', + /** Class 57 - Operator Intervention: [E] operator_intervention */ + OPERATOR_INTERVENTION = '57000', + /** Class 57 - Operator Intervention: [E] query_canceled */ + QUERY_CANCELED = '57014', + /** Class 57 - Operator Intervention: [E] admin_shutdown */ + ADMIN_SHUTDOWN = '57P01', + /** Class 57 - Operator Intervention: [E] crash_shutdown */ + CRASH_SHUTDOWN = '57P02', + /** Class 57 - Operator Intervention: [E] cannot_connect_now */ + CANNOT_CONNECT_NOW = '57P03', + /** Class 57 - Operator Intervention: [E] database_dropped */ + DATABASE_DROPPED = '57P04', + /** Class 58 - System Error (errors external to PostgreSQL itself): [E] system_error */ + SYSTEM_ERROR = '58000', + /** Class 58 - System Error (errors external to PostgreSQL itself): [E] io_error */ + IO_ERROR = '58030', + /** Class 58 - System Error (errors external to PostgreSQL itself): [E] undefined_file */ + UNDEFINED_FILE = '58P01', + /** Class 58 - System Error (errors external to PostgreSQL itself): [E] duplicate_file */ + DUPLICATE_FILE = '58P02', + /** Class 72 - Snapshot Failure: [E] snapshot_too_old */ + SNAPSHOT_TOO_OLD = '72000', + /** Class F0 - Configuration File Error: [E] config_file_error */ + CONFIG_FILE_ERROR = 'F0000', + /** Class F0 - Configuration File Error: [E] lock_file_exists */ + LOCK_FILE_EXISTS = 'F0001', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_error */ + FDW_ERROR = 'HV000', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_column_name_not_found */ + FDW_COLUMN_NAME_NOT_FOUND = 'HV005', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_dynamic_parameter_value_needed */ + FDW_DYNAMIC_PARAMETER_VALUE_NEEDED = 'HV002', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_function_sequence_error */ + FDW_FUNCTION_SEQUENCE_ERROR = 'HV010', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_inconsistent_descriptor_information */ + FDW_INCONSISTENT_DESCRIPTOR_INFORMATION = 'HV021', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_invalid_attribute_value */ + FDW_INVALID_ATTRIBUTE_VALUE = 'HV024', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_invalid_column_name */ + FDW_INVALID_COLUMN_NAME = 'HV007', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_invalid_column_number */ + FDW_INVALID_COLUMN_NUMBER = 'HV008', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_invalid_data_type */ + FDW_INVALID_DATA_TYPE = 'HV004', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_invalid_data_type_descriptors */ + FDW_INVALID_DATA_TYPE_DESCRIPTORS = 'HV006', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_invalid_descriptor_field_identifier */ + FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER = 'HV091', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_invalid_handle */ + FDW_INVALID_HANDLE = 'HV00B', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_invalid_option_index */ + FDW_INVALID_OPTION_INDEX = 'HV00C', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_invalid_option_name */ + FDW_INVALID_OPTION_NAME = 'HV00D', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_invalid_string_length_or_buffer_length */ + FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH = 'HV090', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_invalid_string_format */ + FDW_INVALID_STRING_FORMAT = 'HV00A', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_invalid_use_of_null_pointer */ + FDW_INVALID_USE_OF_NULL_POINTER = 'HV009', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_too_many_handles */ + FDW_TOO_MANY_HANDLES = 'HV014', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_out_of_memory */ + FDW_OUT_OF_MEMORY = 'HV001', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_no_schemas */ + FDW_NO_SCHEMAS = 'HV00P', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_option_name_not_found */ + FDW_OPTION_NAME_NOT_FOUND = 'HV00J', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_reply_handle */ + FDW_REPLY_HANDLE = 'HV00K', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_schema_not_found */ + FDW_SCHEMA_NOT_FOUND = 'HV00Q', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_table_not_found */ + FDW_TABLE_NOT_FOUND = 'HV00R', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_unable_to_create_execution */ + FDW_UNABLE_TO_CREATE_EXECUTION = 'HV00L', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_unable_to_create_reply */ + FDW_UNABLE_TO_CREATE_REPLY = 'HV00M', + /** Class HV - Foreign Data Wrapper Error (SQL/MED): [E] fdw_unable_to_establish_connection */ + FDW_UNABLE_TO_ESTABLISH_CONNECTION = 'HV00N', + /** Class P0 - PL/pgSQL Error: [E] plpgsql_error */ + PLPGSQL_ERROR = 'P0000', + /** Class P0 - PL/pgSQL Error: [E] raise_exception */ + RAISE_EXCEPTION = 'P0001', + /** Class P0 - PL/pgSQL Error: [E] no_data_found */ + NO_DATA_FOUND = 'P0002', + /** Class P0 - PL/pgSQL Error: [E] too_many_rows */ + TOO_MANY_ROWS = 'P0003', + /** Class P0 - PL/pgSQL Error: [E] assert_failure */ + ASSERT_FAILURE = 'P0004', + /** Class XX - Internal Error: [E] internal_error */ + INTERNAL_ERROR = 'XX000', + /** Class XX - Internal Error: [E] data_corrupted */ + DATA_CORRUPTED = 'XX001', + /** Class XX - Internal Error: [E] index_corrupted */ + INDEX_CORRUPTED = 'XX002', +} From 166be6392428a1735b4a9d42e681ade29edb1615 Mon Sep 17 00:00:00 2001 From: Nihal Gonsalves Date: Fri, 15 Mar 2019 22:39:28 +0100 Subject: [PATCH 4/5] Prepare config for publishing --- {src => lib}/PostgresError.ts | 0 lib/index.ts | 1 + {bin => lib}/sync.ts | 2 +- package.json | 6 ++++-- tsconfig.json | 23 ++++++++--------------- 5 files changed, 14 insertions(+), 18 deletions(-) rename {src => lib}/PostgresError.ts (100%) create mode 100644 lib/index.ts rename {bin => lib}/sync.ts (97%) diff --git a/src/PostgresError.ts b/lib/PostgresError.ts similarity index 100% rename from src/PostgresError.ts rename to lib/PostgresError.ts diff --git a/lib/index.ts b/lib/index.ts new file mode 100644 index 0000000..a8d39c0 --- /dev/null +++ b/lib/index.ts @@ -0,0 +1 @@ +export { PostgresError } from './PostgresError'; diff --git a/bin/sync.ts b/lib/sync.ts similarity index 97% rename from bin/sync.ts rename to lib/sync.ts index 86e1e39..d3460f4 100644 --- a/bin/sync.ts +++ b/lib/sync.ts @@ -76,7 +76,7 @@ const getEnum = async () => { } const writeEnum = (enumString: string) => { - writeFileSync(join(__dirname, '../src/PostgresError.ts'), enumString); + writeFileSync(join(__dirname, '../lib/PostgresError.ts'), enumString); } getEnum().then(writeEnum); diff --git a/package.json b/package.json index 75fb71d..3cb47b7 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,11 @@ "name": "pg-error-constants-ts", "version": "0.1.0", "description": "TypeScript Enums for Postgres Errors", - "main": "index.js", + "main": "dist/index.js", "scripts": { - "sync": "ts-node --transpile-only bin/sync.ts", + "sync": "ts-node --transpile-only lib/sync.ts", + "build": "tsc", + "release": "npm run sync && npm run build", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { diff --git a/tsconfig.json b/tsconfig.json index 439e9ae..bdb0e49 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,18 +1,18 @@ { "compilerOptions": { /* Basic Options */ - "target": "ES2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ + "target": "ES5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ + "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + "outDir": "./dist", /* Redirect output structure to the directory. */ + "rootDir": "./lib", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ // "removeComments": true, /* Do not emit comments to output. */ // "noEmit": true, /* Do not emit outputs. */ @@ -22,19 +22,12 @@ /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + "noUnusedLocals": true, /* Report errors on unused locals. */ + "noUnusedParameters": true, /* Report errors on unused parameters. */ + "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ From 1c984e68d6e275041af8f2f80eef41b12d0dd0d0 Mon Sep 17 00:00:00 2001 From: Nihal Gonsalves Date: Fri, 15 Mar 2019 22:40:15 +0100 Subject: [PATCH 5/5] Add .travis.yml --- .travis.yml | 9 +++++++++ package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..635e59f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: + - 8 + - 10 +install: + - npm install +script: + - npm build + - npm test diff --git a/package.json b/package.json index 3cb47b7..5ef7312 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "sync": "ts-node --transpile-only lib/sync.ts", "build": "tsc", "release": "npm run sync && npm run build", - "test": "echo \"Error: no test specified\" && exit 1" + "test": "exit 0" }, "repository": { "type": "git",