drizzle-graphql-plus 0.8.6
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/.github/workflows/release.yaml +74 -0
- package/LICENSE +201 -0
- package/README.md +86 -0
- package/dprint.json +31 -0
- package/drizzle.test-config.ts +29 -0
- package/package.json +103 -0
- package/scripts/build.ts +28 -0
- package/src/index.ts +74 -0
- package/src/types.ts +417 -0
- package/src/util/builders/common.ts +840 -0
- package/src/util/builders/index.ts +5 -0
- package/src/util/builders/mysql.ts +482 -0
- package/src/util/builders/pg.ts +517 -0
- package/src/util/builders/sqlite.ts +524 -0
- package/src/util/builders/types.ts +231 -0
- package/src/util/case-ops/index.ts +9 -0
- package/src/util/data-mappers/index.ts +162 -0
- package/src/util/type-converter/index.ts +148 -0
- package/src/util/type-converter/types.ts +54 -0
- package/tests/mysql-custom.test.ts +2009 -0
- package/tests/mysql.test.ts +4600 -0
- package/tests/pg-custom.test.ts +2054 -0
- package/tests/pg.test.ts +4285 -0
- package/tests/schema/mysql.ts +72 -0
- package/tests/schema/pg.ts +83 -0
- package/tests/schema/sqlite.ts +64 -0
- package/tests/sqlite-custom.test.ts +1956 -0
- package/tests/sqlite.test.ts +3749 -0
- package/tests/tsconfig.json +11 -0
- package/tests/util/query/index.ts +30 -0
- package/tsconfig.build.json +4 -0
- package/tsconfig.dts.json +13 -0
- package/tsconfig.json +48 -0
- package/vitest.config.ts +17 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import axios, { AxiosError } from 'axios';
|
|
2
|
+
|
|
3
|
+
export class GraphQLClient {
|
|
4
|
+
constructor(private url: string) {}
|
|
5
|
+
|
|
6
|
+
public queryGql = async (query: string) => {
|
|
7
|
+
try {
|
|
8
|
+
const res = await axios.post(
|
|
9
|
+
this.url,
|
|
10
|
+
JSON.stringify({
|
|
11
|
+
query: query,
|
|
12
|
+
variables: {},
|
|
13
|
+
}),
|
|
14
|
+
{
|
|
15
|
+
headers: {
|
|
16
|
+
accept: 'application/graphql-response+json, application/json',
|
|
17
|
+
'content-type': 'application/json',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
return res.data;
|
|
23
|
+
} catch (e) {
|
|
24
|
+
const err = e as AxiosError<any>;
|
|
25
|
+
|
|
26
|
+
console.warn(err.status, err.response?.data.errors);
|
|
27
|
+
return err.response?.data;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.build.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"composite": false,
|
|
5
|
+
"rootDir": "src",
|
|
6
|
+
"outDir": "dist-dts",
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"noEmit": false,
|
|
9
|
+
"emitDeclarationOnly": true,
|
|
10
|
+
"incremental": false
|
|
11
|
+
},
|
|
12
|
+
"include": ["src"]
|
|
13
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"noEmit": true,
|
|
4
|
+
"isolatedModules": true,
|
|
5
|
+
"composite": false,
|
|
6
|
+
"target": "esnext",
|
|
7
|
+
"module": "esnext",
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"lib": ["es2020", "es2018", "es2017", "es7", "es6", "es5"],
|
|
10
|
+
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
11
|
+
"declarationMap": false,
|
|
12
|
+
"sourceMap": false,
|
|
13
|
+
"allowJs": true,
|
|
14
|
+
"incremental": false,
|
|
15
|
+
"stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
16
|
+
"allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
17
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
18
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
19
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
20
|
+
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
21
|
+
"strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
22
|
+
"strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
23
|
+
"strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
24
|
+
"strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
25
|
+
"noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
26
|
+
"useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
27
|
+
"alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
28
|
+
"exactOptionalPropertyTypes": false, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
29
|
+
"noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
30
|
+
"noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
31
|
+
"noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
32
|
+
"noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
33
|
+
"noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
34
|
+
"allowUnusedLabels": false, /* Disable error reporting for unused labels. */
|
|
35
|
+
"allowUnreachableCode": false, /* Disable error reporting for unreachable code. */
|
|
36
|
+
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
|
|
37
|
+
"noErrorTruncation": true, /* Disable truncating types in error messages. */
|
|
38
|
+
"checkJs": true,
|
|
39
|
+
"allowImportingTsExtensions": true,
|
|
40
|
+
"baseUrl": ".",
|
|
41
|
+
"paths": {
|
|
42
|
+
"@/*": ["src/*"]
|
|
43
|
+
},
|
|
44
|
+
"outDir": "dist"
|
|
45
|
+
},
|
|
46
|
+
"exclude": ["/**/node_modules/**/*", "**/dist"],
|
|
47
|
+
"include": ["src/**/*", "drizzle.config.ts", "Tests/**/*", "Server/**/*"]
|
|
48
|
+
}
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { viteCommonjs } from '@originjs/vite-plugin-commonjs';
|
|
2
|
+
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
3
|
+
import { defineConfig } from 'vitest/config';
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
test: {
|
|
7
|
+
include: ['tests/**/*.test.ts'],
|
|
8
|
+
isolate: true,
|
|
9
|
+
typecheck: {
|
|
10
|
+
tsconfig: 'tsconfig.json',
|
|
11
|
+
},
|
|
12
|
+
testTimeout: 100000,
|
|
13
|
+
hookTimeout: 100000,
|
|
14
|
+
},
|
|
15
|
+
plugins: [viteCommonjs(), tsconfigPaths()],
|
|
16
|
+
resolve: { alias: { graphql: 'graphql/index.js' } },
|
|
17
|
+
});
|