@dbml/connector 5.1.0 → 5.2.0

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.
@@ -14,6 +14,17 @@ const noSchemaResult = (connectionString: string) => ({
14
14
  schemas: [],
15
15
  });
16
16
 
17
+ // Inputs: schemas string -> Output: schema array string[]
18
+ // schema1, schema2 -> ['schema1', 'schema2']
19
+ // schema3,schema4 -> ['schema3", 'schema4']
20
+ // "schema5,gg", "schema6", schema7 -> ['schema5,gg', 'schema6', 'schema7']
21
+ // schema8 -> ['schema8']
22
+ export const parseSchema = (schemas: string | undefined): string[] => {
23
+ if (!schemas) return [];
24
+ const schemasWithDoubleQuotes = schemas.split(/,(?=(?:[^"]*(?:"[^"]*")*)*$)/).map((s) => s.trim());
25
+ return schemasWithDoubleQuotes.map((s) => s.replace(/"/g, ''));
26
+ };
27
+
17
28
  const parseOdbcSchema = (connectionString: string) => {
18
29
  const connectionParts = connectionString.split(';');
19
30
  const schemasPart = connectionParts.find((part) => haveSchemas(part));
@@ -47,14 +58,3 @@ export const buildSchemaQuery = (columnName: string, schemas: string[], prefix =
47
58
  if (schemas.length === 0) return '';
48
59
  return `${prefix} ${columnName} IN (${schemas.map((schema) => `'${schema}'`).join(', ')})`;
49
60
  };
50
-
51
- // Inputs: schemas string -> Output: schema array string[]
52
- // schema1, schema2 -> ['schema1', 'schema2']
53
- // schema3,schema4 -> ['schema3", 'schema4']
54
- // "schema5,gg", "schema6", schema7 -> ['schema5,gg', 'schema6', 'schema7']
55
- // schema8 -> ['schema8']
56
- export const parseSchema = (schemas: string | undefined): string[] => {
57
- if (!schemas) return [];
58
- const schemasWithDoubleQuotes = schemas.split(/,(?=(?:[^"]*(?:"[^"]*")*)*$)/).map((s) => s.trim());
59
- return schemasWithDoubleQuotes.map((s) => s.replace(/"/g, ''));
60
- };
@@ -0,0 +1,18 @@
1
+
2
+ > @dbml/connector@5.1.0 test
3
+ > jest
4
+
5
+ PASS __tests__/connector.test.ts
6
+ @dbml/connector
7
+ ✓ connectors/mssql (264 ms)
8
+ ✓ connectors/mysql (31 ms)
9
+ ✓ connectors/postgres (55 ms)
10
+
11
+ Test Suites: 1 passed, 1 total
12
+ Tests: 3 passed, 3 total
13
+ Snapshots: 0 total
14
+ Time: 1.208 s, estimated 2 s
15
+ Ran all test suites.
16
+ Jest did not exit one second after the test run has completed.
17
+
18
+ 'This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.
package/tsconfig.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "esModuleInterop": true,
10
10
  "skipLibCheck": true,
11
11
  "forceConsistentCasingInFileNames": true,
12
- "declaration": true, // Generates .d.ts files
12
+ "declaration": true // Generates .d.ts files
13
13
  },
14
14
  "include": ["./src"],
15
15
  "exclude": ["node_modules", "**/*.test.ts"]
package/.eslintrc.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "extends": [
3
- "plugin:@typescript-eslint/recommended"
4
- ],
5
- "parser": "@typescript-eslint/parser",
6
- "parserOptions": {
7
- "sourceType": "module",
8
- "ecmaVersion": 2020,
9
- "project": "./tsconfig.json"
10
- },
11
- "settings": {
12
- "import/resolver": {
13
- "typescript": {
14
- "alwaysTryTypes": true,
15
- "project": "packages/*/{ts,js}config.json"
16
- }
17
- }
18
- },
19
- "plugins": ["@typescript-eslint"],
20
- "ignorePatterns": ["**/*.test.ts"],
21
- "rules": {
22
- "@typescript-eslint/no-explicit-any": "off"
23
- }
24
- }