@dbml/connector 9.1.2-alpha.0 → 10.0.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.
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/__tests__/connector.test.ts +0 -0
- package/__tests__/connectors/mssql/connection.json +0 -0
- package/__tests__/connectors/mssql/expect-out-files/schema.json +0 -0
- package/__tests__/connectors/mysql/connection.json +0 -0
- package/__tests__/connectors/mysql/expect-out-files/schema.json +0 -0
- package/__tests__/connectors/oracle/connection.json +0 -0
- package/__tests__/connectors/oracle/expect-out-files/schema.json +0 -0
- package/__tests__/connectors/postgres/connection.json +0 -0
- package/__tests__/connectors/postgres/expect-out-files/schema.json +0 -0
- package/__tests__/testHelpers.ts +0 -0
- package/dist/connectors/bigquery/index.d.ts +0 -0
- package/dist/connectors/connector.d.ts +0 -0
- package/dist/connectors/mssql/index.d.ts +0 -0
- package/dist/connectors/mysql/index.d.ts +0 -0
- package/dist/connectors/oracle/constraints.d.ts +0 -0
- package/dist/connectors/oracle/index.d.ts +0 -0
- package/dist/connectors/oracle/indexes.d.ts +0 -0
- package/dist/connectors/oracle/refs.d.ts +0 -0
- package/dist/connectors/oracle/tables.d.ts +0 -0
- package/dist/connectors/oracle/utils.d.ts +0 -0
- package/dist/connectors/postgres/index.d.ts +0 -0
- package/dist/connectors/snowflake/index.d.ts +0 -0
- package/dist/connectors/types.d.ts +1 -1
- package/dist/index.d.ts +0 -0
- package/dist/index.js +4 -4
- package/dist/index.mjs +8 -8
- package/dist/utils/credential-loader.d.ts +0 -0
- package/dist/utils/helpers.d.ts +0 -0
- package/dist/utils/parseSchema.d.ts +0 -0
- package/eslint.config.ts +0 -0
- package/package.json +2 -2
- package/src/connectors/bigquery/index.ts +0 -0
- package/src/connectors/connector.ts +0 -0
- package/src/connectors/mssql/index.ts +0 -0
- package/src/connectors/mysql/index.ts +0 -0
- package/src/connectors/oracle/constraints.ts +0 -0
- package/src/connectors/oracle/index.ts +0 -0
- package/src/connectors/oracle/indexes.ts +0 -0
- package/src/connectors/oracle/refs.ts +0 -0
- package/src/connectors/oracle/tables.ts +0 -0
- package/src/connectors/oracle/utils.ts +0 -0
- package/src/connectors/postgres/index.ts +0 -0
- package/src/connectors/snowflake/index.ts +0 -0
- package/src/connectors/types.ts +0 -0
- package/src/ddl_samples/bigquery.sql +0 -0
- package/src/ddl_samples/snowflake.sql +0 -0
- package/src/index.ts +0 -0
- package/src/utils/credential-loader.ts +0 -0
- package/src/utils/helpers.ts +0 -0
- package/src/utils/parseSchema.ts +0 -0
- package/tsconfig.json +0 -0
- package/vite.config.ts +0 -0
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/__tests__/testHelpers.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
@@ -168,7 +168,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
|
|
|
168
168
|
ORDER BY
|
|
169
169
|
s.name,
|
|
170
170
|
t.name;
|
|
171
|
-
`,i=await e.query(r),a=(e,t)=>e.length===t.length?e.every((e,n)=>e.tableName===t[n].tableName&&e.schemaName===t[n].schemaName&&e.fieldNames.length===t[n].fieldNames.length&&e.fieldNames.every((e,r)=>e===t[n].fieldNames[r])):!1;return i.recordset.forEach(e=>{let{table_schema:t,fk_constraint_name:r,table_name:i,column_names:o,foreign_table_schema:s,foreign_table_name:c,foreign_column_names:l,on_delete:u,on_update:d}=e,f={name:r,endpoints:[{tableName:i,schemaName:t,fieldNames:o.split(`,`),relation
|
|
171
|
+
`,i=await e.query(r),a=(e,t)=>e.length===t.length?e.every((e,n)=>e.tableName===t[n].tableName&&e.schemaName===t[n].schemaName&&e.fieldNames.length===t[n].fieldNames.length&&e.fieldNames.every((e,r)=>e===t[n].fieldNames[r])):!1;return i.recordset.forEach(e=>{let{table_schema:t,fk_constraint_name:r,table_name:i,column_names:o,foreign_table_schema:s,foreign_table_name:c,foreign_column_names:l,on_delete:u,on_update:d}=e,f={name:r,endpoints:[{tableName:i,schemaName:t,fieldNames:o.split(`,`),relation:`0..*`},{tableName:c,schemaName:s,fieldNames:l.split(`,`),relation:`0..1`}],onDelete:u===`NO_ACTION`?null:u,onUpdate:d===`NO_ACTION`?null:d};n.some(e=>a(e.endpoints,f.endpoints))||n.push(f)}),n},he=async(e,t)=>{let n=`
|
|
172
172
|
WITH user_tables AS (
|
|
173
173
|
SELECT
|
|
174
174
|
TABLE_SCHEMA,
|
|
@@ -3357,7 +3357,7 @@ sSi6
|
|
|
3357
3357
|
rc.delete_rule
|
|
3358
3358
|
order by
|
|
3359
3359
|
rc.table_name;
|
|
3360
|
-
`,[t]))[0].map(e=>{let{constraintName:t,onDelete:n,onUpdate:r,foreignTableName:i,foreignColumnNames:a,refTableName:o,refColumnNames:s}=e;return{name:t,endpoints:[{tableName:i,fieldNames:a.split(`,`),relation
|
|
3360
|
+
`,[t]))[0].map(e=>{let{constraintName:t,onDelete:n,onUpdate:r,foreignTableName:i,foreignColumnNames:a,refTableName:o,refColumnNames:s}=e;return{name:t,endpoints:[{tableName:i,fieldNames:a.split(`,`),relation:`0..*`},{tableName:o,fieldNames:s.split(`,`),relation:`0..1`}],onDelete:n===`NO ACTION`?null:n,onUpdate:r===`NO ACTION`?null:r}})}function Nr(e,t){let n=Object.assign(e,{});return Object.keys(t).forEach(e=>{let r=t[e];if(!n[e]){n[e]=r;return}n[e].push(...r)}),n}async function Pr(e){let t=await yr(e),{database:n}=t.config;if(!n)throw Error(`Cannot get schema name from the connection`);try{let[{tableList:e,fieldMap:r},i,a,{primaryAndUniqueConstraintMap:o,compositeConstraintMap:s},c,{checks:l,tableConstraints:u}]=await Promise.all([Er(t,n),Dr(t,n),Or(t,n),kr(t,n),Mr(t,n),jr(t,n)]),d=Nr(a,s),f={...o};return Object.keys(u).forEach(e=>{f[e]||(f[e]={}),Object.keys(u[e]).forEach(t=>{f[e][t]||(f[e][t]={checks:[]}),f[e][t].checks.push(...u[e][t].checks)})}),{tables:e,fields:r,refs:c,enums:i,indexes:d,tableConstraints:f,checks:l}}finally{await t.end()}}var $=`@@@@@@@@`,Fr={outFormat:h.default.OUT_FORMAT_OBJECT};function Ir(e){let{username:t,password:n,dbidentifier:r}=e.match(/^(?<username>[^/@:]+)\/(?<password>[^/@:]+)@(\/\/)?(?<dbidentifier>.+)$/)?.groups||{};if(!t||!n||!r)throw Error(`Invalid Easy Connect string. Expect a string of format 'username/password@[//]host[:port][/database]'`);return{username:t,password:n,dbidentifier:r}}async function Lr(e){let t=`
|
|
3361
3361
|
WITH all_constraints AS (
|
|
3362
3362
|
SELECT
|
|
3363
3363
|
c.CONSTRAINT_NAME,
|
|
@@ -3456,7 +3456,7 @@ sSi6
|
|
|
3456
3456
|
obj_child.CREATED,
|
|
3457
3457
|
obj_child.OBJECT_ID,
|
|
3458
3458
|
c.CONSTRAINT_NAME
|
|
3459
|
-
`;return(await e.execute(n,[],Fr)).rows?.forEach(e=>{let{fk_name:n,child_table:r,child_columns:i,parent_table:a,parent_columns:o,delete_rule:s}=e,c={tableName:r,schemaName:``,fieldNames:i.split($),relation
|
|
3459
|
+
`;return(await e.execute(n,[],Fr)).rows?.forEach(e=>{let{fk_name:n,child_table:r,child_columns:i,parent_table:a,parent_columns:o,delete_rule:s}=e,c={tableName:r,schemaName:``,fieldNames:i.split($),relation:`0..*`},l={tableName:a,schemaName:``,fieldNames:o.split($),relation:`0..1`};t.push({name:n,endpoints:[c,l],onDelete:s===`NO ACTION`?null:s,onUpdate:null})}),t}async function Br(e){let t={},n=(await e.execute(`
|
|
3460
3460
|
SELECT
|
|
3461
3461
|
cols.TABLE_NAME AS "table_name",
|
|
3462
3462
|
cols.COLUMN_NAME AS "column_name",
|
|
@@ -3591,7 +3591,7 @@ sSi6
|
|
|
3591
3591
|
ORDER BY
|
|
3592
3592
|
tc.table_schema,
|
|
3593
3593
|
tc.table_name;
|
|
3594
|
-
`;return(await e.query(r)).rows.forEach(e=>{let{table_schema:t,fk_constraint_name:r,table_name:i,column_names:a,foreign_table_schema:o,foreign_table_name:s,foreign_column_names:c,on_delete:l,on_update:u}=e,d={tableName:i,schemaName:t,fieldNames:a.split(`,`),relation
|
|
3594
|
+
`;return(await e.query(r)).rows.forEach(e=>{let{table_schema:t,fk_constraint_name:r,table_name:i,column_names:a,foreign_table_schema:o,foreign_table_name:s,foreign_column_names:c,on_delete:l,on_update:u}=e,d={tableName:i,schemaName:t,fieldNames:a.split(`,`),relation:`0..*`},f={tableName:s,schemaName:o,fieldNames:c.split(`,`),relation:`0..1`};n.push({name:r,endpoints:[d,f],onDelete:l===`NO ACTION`?null:l,onUpdate:u===`NO ACTION`?null:u})}),n},li=async(e,t)=>{let n=`
|
|
3595
3595
|
WITH user_tables AS (
|
|
3596
3596
|
SELECT
|
|
3597
3597
|
schemaname AS tableschema,
|
package/dist/index.mjs
CHANGED
|
@@ -455,12 +455,12 @@ var ie = "schemas=", A = (e) => e.toLowerCase().includes(ie), ae = (e) => e ? e.
|
|
|
455
455
|
tableName: i,
|
|
456
456
|
schemaName: t,
|
|
457
457
|
fieldNames: o.split(","),
|
|
458
|
-
relation: "
|
|
458
|
+
relation: "0..*"
|
|
459
459
|
}, {
|
|
460
460
|
tableName: c,
|
|
461
461
|
schemaName: s,
|
|
462
462
|
fieldNames: l.split(","),
|
|
463
|
-
relation: "1"
|
|
463
|
+
relation: "0..1"
|
|
464
464
|
}],
|
|
465
465
|
onDelete: u === "NO_ACTION" ? null : u,
|
|
466
466
|
onUpdate: d === "NO_ACTION" ? null : d
|
|
@@ -9445,11 +9445,11 @@ async function jr(e, t) {
|
|
|
9445
9445
|
endpoints: [{
|
|
9446
9446
|
tableName: i,
|
|
9447
9447
|
fieldNames: a.split(","),
|
|
9448
|
-
relation: "
|
|
9448
|
+
relation: "0..*"
|
|
9449
9449
|
}, {
|
|
9450
9450
|
tableName: o,
|
|
9451
9451
|
fieldNames: s.split(","),
|
|
9452
|
-
relation: "1"
|
|
9452
|
+
relation: "0..1"
|
|
9453
9453
|
}],
|
|
9454
9454
|
onDelete: n === "NO ACTION" ? null : n,
|
|
9455
9455
|
onUpdate: r === "NO ACTION" ? null : r
|
|
@@ -9677,12 +9677,12 @@ async function Rr(e) {
|
|
|
9677
9677
|
tableName: r,
|
|
9678
9678
|
schemaName: "",
|
|
9679
9679
|
fieldNames: i.split($),
|
|
9680
|
-
relation: "
|
|
9680
|
+
relation: "0..*"
|
|
9681
9681
|
}, l = {
|
|
9682
9682
|
tableName: a,
|
|
9683
9683
|
schemaName: "",
|
|
9684
9684
|
fieldNames: o.split($),
|
|
9685
|
-
relation: "1"
|
|
9685
|
+
relation: "0..1"
|
|
9686
9686
|
};
|
|
9687
9687
|
t.push({
|
|
9688
9688
|
name: n,
|
|
@@ -9984,12 +9984,12 @@ var ti = async (e) => {
|
|
|
9984
9984
|
tableName: i,
|
|
9985
9985
|
schemaName: t,
|
|
9986
9986
|
fieldNames: a.split(","),
|
|
9987
|
-
relation: "
|
|
9987
|
+
relation: "0..*"
|
|
9988
9988
|
}, f = {
|
|
9989
9989
|
tableName: s,
|
|
9990
9990
|
schemaName: o,
|
|
9991
9991
|
fieldNames: c.split(","),
|
|
9992
|
-
relation: "1"
|
|
9992
|
+
relation: "0..1"
|
|
9993
9993
|
};
|
|
9994
9994
|
n.push({
|
|
9995
9995
|
name: r,
|
|
File without changes
|
package/dist/utils/helpers.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/eslint.config.ts
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@dbml/connector",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "10.0.0",
|
|
5
5
|
"description": "This package was created to fetch the schema JSON from many kind of databases.",
|
|
6
6
|
"author": "huy.phung.sw@gmail.com",
|
|
7
7
|
"license": "MIT",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"engines": {
|
|
40
40
|
"node": ">=18"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "399f6352a3cb4f1bffc1cb355301af28f84dc09b"
|
|
43
43
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/connectors/types.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/index.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/src/utils/helpers.ts
CHANGED
|
File without changes
|
package/src/utils/parseSchema.ts
CHANGED
|
File without changes
|
package/tsconfig.json
CHANGED
|
File without changes
|
package/vite.config.ts
CHANGED
|
File without changes
|