@dbml/connector 9.0.0-optional-ref.2 → 9.0.0-optional-ref.8

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.
@@ -1721,7 +1721,7 @@
1721
1721
  "AuthorID",
1722
1722
  "NationalityID"
1723
1723
  ],
1724
- "relation": "*"
1724
+ "relation": "0..*"
1725
1725
  },
1726
1726
  {
1727
1727
  "tableName": "Authors",
@@ -1730,7 +1730,7 @@
1730
1730
  "AuthorID",
1731
1731
  "NationalityID"
1732
1732
  ],
1733
- "relation": "1"
1733
+ "relation": "0..1"
1734
1734
  }
1735
1735
  ],
1736
1736
  "onDelete": null,
@@ -1745,7 +1745,7 @@
1745
1745
  "fieldNames": [
1746
1746
  "product_id"
1747
1747
  ],
1748
- "relation": "*"
1748
+ "relation": "0..*"
1749
1749
  },
1750
1750
  {
1751
1751
  "tableName": "products",
@@ -1753,7 +1753,7 @@
1753
1753
  "fieldNames": [
1754
1754
  "product_id"
1755
1755
  ],
1756
- "relation": "1"
1756
+ "relation": "0..1"
1757
1757
  }
1758
1758
  ],
1759
1759
  "onDelete": null,
@@ -1768,7 +1768,7 @@
1768
1768
  "fieldNames": [
1769
1769
  "order_id"
1770
1770
  ],
1771
- "relation": "*"
1771
+ "relation": "0..*"
1772
1772
  },
1773
1773
  {
1774
1774
  "tableName": "orders",
@@ -1776,7 +1776,7 @@
1776
1776
  "fieldNames": [
1777
1777
  "order_id"
1778
1778
  ],
1779
- "relation": "1"
1779
+ "relation": "0..1"
1780
1780
  }
1781
1781
  ],
1782
1782
  "onDelete": "CASCADE",
@@ -1791,7 +1791,7 @@
1791
1791
  "fieldNames": [
1792
1792
  "user_id"
1793
1793
  ],
1794
- "relation": "*"
1794
+ "relation": "0..*"
1795
1795
  },
1796
1796
  {
1797
1797
  "tableName": "users",
@@ -1799,7 +1799,7 @@
1799
1799
  "fieldNames": [
1800
1800
  "user_id"
1801
1801
  ],
1802
- "relation": "1"
1802
+ "relation": "0..1"
1803
1803
  }
1804
1804
  ],
1805
1805
  "onDelete": "CASCADE",
@@ -1814,7 +1814,7 @@
1814
1814
  "fieldNames": [
1815
1815
  "gender"
1816
1816
  ],
1817
- "relation": "*"
1817
+ "relation": "0..*"
1818
1818
  },
1819
1819
  {
1820
1820
  "tableName": "gender_reference",
@@ -1822,7 +1822,7 @@
1822
1822
  "fieldNames": [
1823
1823
  "value"
1824
1824
  ],
1825
- "relation": "1"
1825
+ "relation": "0..1"
1826
1826
  }
1827
1827
  ],
1828
1828
  "onDelete": null,
@@ -1094,7 +1094,7 @@
1094
1094
  "id1_1",
1095
1095
  "id1_2"
1096
1096
  ],
1097
- "relation": "*"
1097
+ "relation": "0..*"
1098
1098
  },
1099
1099
  {
1100
1100
  "tableName": "composite_key_2",
@@ -1102,7 +1102,7 @@
1102
1102
  "id2_1",
1103
1103
  "id2_2"
1104
1104
  ],
1105
- "relation": "1"
1105
+ "relation": "0..1"
1106
1106
  }
1107
1107
  ],
1108
1108
  "onDelete": null,
@@ -1116,14 +1116,14 @@
1116
1116
  "fieldNames": [
1117
1117
  "order_id"
1118
1118
  ],
1119
- "relation": "*"
1119
+ "relation": "0..*"
1120
1120
  },
1121
1121
  {
1122
1122
  "tableName": "orders",
1123
1123
  "fieldNames": [
1124
1124
  "order_id"
1125
1125
  ],
1126
- "relation": "1"
1126
+ "relation": "0..1"
1127
1127
  }
1128
1128
  ],
1129
1129
  "onDelete": "CASCADE",
@@ -1137,14 +1137,14 @@
1137
1137
  "fieldNames": [
1138
1138
  "product_id"
1139
1139
  ],
1140
- "relation": "*"
1140
+ "relation": "0..*"
1141
1141
  },
1142
1142
  {
1143
1143
  "tableName": "products",
1144
1144
  "fieldNames": [
1145
1145
  "id"
1146
1146
  ],
1147
- "relation": "1"
1147
+ "relation": "0..1"
1148
1148
  }
1149
1149
  ],
1150
1150
  "onDelete": null,
@@ -1158,14 +1158,14 @@
1158
1158
  "fieldNames": [
1159
1159
  "user_id"
1160
1160
  ],
1161
- "relation": "*"
1161
+ "relation": "0..*"
1162
1162
  },
1163
1163
  {
1164
1164
  "tableName": "users",
1165
1165
  "fieldNames": [
1166
1166
  "user_id"
1167
1167
  ],
1168
- "relation": "1"
1168
+ "relation": "0..1"
1169
1169
  }
1170
1170
  ],
1171
1171
  "onDelete": "SET NULL",
@@ -2921,7 +2921,7 @@
2921
2921
  "fieldNames": [
2922
2922
  "PARENT_ID"
2923
2923
  ],
2924
- "relation": "*"
2924
+ "relation": "0..*"
2925
2925
  },
2926
2926
  {
2927
2927
  "tableName": "SELF_REF_FK",
@@ -2929,7 +2929,7 @@
2929
2929
  "fieldNames": [
2930
2930
  "ID"
2931
2931
  ],
2932
- "relation": "1"
2932
+ "relation": "0..1"
2933
2933
  }
2934
2934
  ],
2935
2935
  "onDelete": "SET NULL",
@@ -2944,7 +2944,7 @@
2944
2944
  "fieldNames": [
2945
2945
  "PARENT_ID"
2946
2946
  ],
2947
- "relation": "*"
2947
+ "relation": "0..*"
2948
2948
  },
2949
2949
  {
2950
2950
  "tableName": "FK_PARENT",
@@ -2952,7 +2952,7 @@
2952
2952
  "fieldNames": [
2953
2953
  "ID"
2954
2954
  ],
2955
- "relation": "1"
2955
+ "relation": "0..1"
2956
2956
  }
2957
2957
  ],
2958
2958
  "onDelete": "CASCADE",
@@ -2968,7 +2968,7 @@
2968
2968
  "PARENT_DEPT_ID",
2969
2969
  "PARENT_EMP_ID"
2970
2970
  ],
2971
- "relation": "*"
2971
+ "relation": "0..*"
2972
2972
  },
2973
2973
  {
2974
2974
  "tableName": "COMPOSITE_SELF_REF",
@@ -2977,7 +2977,7 @@
2977
2977
  "DEPT_ID",
2978
2978
  "EMP_ID"
2979
2979
  ],
2980
- "relation": "1"
2980
+ "relation": "0..1"
2981
2981
  }
2982
2982
  ],
2983
2983
  "onDelete": "SET NULL",
@@ -2992,7 +2992,7 @@
2992
2992
  "fieldNames": [
2993
2993
  "PARENT_ID"
2994
2994
  ],
2995
- "relation": "*"
2995
+ "relation": "0..*"
2996
2996
  },
2997
2997
  {
2998
2998
  "tableName": "ALTER_FK_PARENT",
@@ -3000,7 +3000,7 @@
3000
3000
  "fieldNames": [
3001
3001
  "ID"
3002
3002
  ],
3003
- "relation": "1"
3003
+ "relation": "0..1"
3004
3004
  }
3005
3005
  ],
3006
3006
  "onDelete": "CASCADE",
@@ -3015,7 +3015,7 @@
3015
3015
  "fieldNames": [
3016
3016
  "PARENT_ID"
3017
3017
  ],
3018
- "relation": "*"
3018
+ "relation": "0..*"
3019
3019
  },
3020
3020
  {
3021
3021
  "tableName": "ALTER_SELF_REF",
@@ -3023,7 +3023,7 @@
3023
3023
  "fieldNames": [
3024
3024
  "ID"
3025
3025
  ],
3026
- "relation": "1"
3026
+ "relation": "0..1"
3027
3027
  }
3028
3028
  ],
3029
3029
  "onDelete": "SET NULL",
@@ -3039,7 +3039,7 @@
3039
3039
  "REF_DEPT_ID",
3040
3040
  "REF_EMP_ID"
3041
3041
  ],
3042
- "relation": "*"
3042
+ "relation": "0..*"
3043
3043
  },
3044
3044
  {
3045
3045
  "tableName": "ALTER_COMPOSITE_FK_PARENT",
@@ -3048,7 +3048,7 @@
3048
3048
  "DEPT_ID",
3049
3049
  "EMP_ID"
3050
3050
  ],
3051
- "relation": "1"
3051
+ "relation": "0..1"
3052
3052
  }
3053
3053
  ],
3054
3054
  "onDelete": null,
@@ -3063,7 +3063,7 @@
3063
3063
  "fieldNames": [
3064
3064
  "PARENT_ID"
3065
3065
  ],
3066
- "relation": "*"
3066
+ "relation": "0..*"
3067
3067
  },
3068
3068
  {
3069
3069
  "tableName": "REF_SIMPLE_PARENT",
@@ -3071,7 +3071,7 @@
3071
3071
  "fieldNames": [
3072
3072
  "ID"
3073
3073
  ],
3074
- "relation": "1"
3074
+ "relation": "0..1"
3075
3075
  }
3076
3076
  ],
3077
3077
  "onDelete": null,
@@ -3087,7 +3087,7 @@
3087
3087
  "FK1",
3088
3088
  "FK2"
3089
3089
  ],
3090
- "relation": "*"
3090
+ "relation": "0..*"
3091
3091
  },
3092
3092
  {
3093
3093
  "tableName": "REF_COMPOSITE_PARENT",
@@ -3096,7 +3096,7 @@
3096
3096
  "KEY1",
3097
3097
  "KEY2"
3098
3098
  ],
3099
- "relation": "1"
3099
+ "relation": "0..1"
3100
3100
  }
3101
3101
  ],
3102
3102
  "onDelete": null,
@@ -3112,7 +3112,7 @@
3112
3112
  "PARENT_DEPT_ID",
3113
3113
  "PARENT_EMP_ID"
3114
3114
  ],
3115
- "relation": "*"
3115
+ "relation": "0..*"
3116
3116
  },
3117
3117
  {
3118
3118
  "tableName": "ALTER_COMP_SELF_REF",
@@ -3121,7 +3121,7 @@
3121
3121
  "DEPT_ID",
3122
3122
  "EMP_ID"
3123
3123
  ],
3124
- "relation": "1"
3124
+ "relation": "0..1"
3125
3125
  }
3126
3126
  ],
3127
3127
  "onDelete": null,
@@ -1344,7 +1344,7 @@
1344
1344
  "authorid",
1345
1345
  "nationalityid"
1346
1346
  ],
1347
- "relation": "*"
1347
+ "relation": "0..*"
1348
1348
  },
1349
1349
  {
1350
1350
  "tableName": "authors",
@@ -1353,7 +1353,7 @@
1353
1353
  "authorid",
1354
1354
  "nationalityid"
1355
1355
  ],
1356
- "relation": "1"
1356
+ "relation": "0..1"
1357
1357
  }
1358
1358
  ],
1359
1359
  "onDelete": "CASCADE",
@@ -1368,7 +1368,7 @@
1368
1368
  "fieldNames": [
1369
1369
  "order_id"
1370
1370
  ],
1371
- "relation": "*"
1371
+ "relation": "0..*"
1372
1372
  },
1373
1373
  {
1374
1374
  "tableName": "orders",
@@ -1376,7 +1376,7 @@
1376
1376
  "fieldNames": [
1377
1377
  "order_id"
1378
1378
  ],
1379
- "relation": "1"
1379
+ "relation": "0..1"
1380
1380
  }
1381
1381
  ],
1382
1382
  "onDelete": "CASCADE",
@@ -1391,7 +1391,7 @@
1391
1391
  "fieldNames": [
1392
1392
  "product_id"
1393
1393
  ],
1394
- "relation": "*"
1394
+ "relation": "0..*"
1395
1395
  },
1396
1396
  {
1397
1397
  "tableName": "products",
@@ -1399,7 +1399,7 @@
1399
1399
  "fieldNames": [
1400
1400
  "product_id"
1401
1401
  ],
1402
- "relation": "1"
1402
+ "relation": "0..1"
1403
1403
  }
1404
1404
  ],
1405
1405
  "onDelete": "CASCADE",
@@ -1414,7 +1414,7 @@
1414
1414
  "fieldNames": [
1415
1415
  "user_id"
1416
1416
  ],
1417
- "relation": "*"
1417
+ "relation": "0..*"
1418
1418
  },
1419
1419
  {
1420
1420
  "tableName": "users",
@@ -1422,7 +1422,7 @@
1422
1422
  "fieldNames": [
1423
1423
  "user_id"
1424
1424
  ],
1425
- "relation": "1"
1425
+ "relation": "0..1"
1426
1426
  }
1427
1427
  ],
1428
1428
  "onDelete": "CASCADE",
@@ -49,7 +49,7 @@ interface RefEndpoint {
49
49
  tableName: string;
50
50
  schemaName: string;
51
51
  fieldNames: string[];
52
- relation: '*' | '1';
52
+ relation: string;
53
53
  }
54
54
  interface Ref {
55
55
  name: string;
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:`*`},{tableName:c,schemaName:s,fieldNames:l.split(`,`),relation:`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=`
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:`*`},{tableName:o,fieldNames:s.split(`,`),relation:`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=`
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:`*`},l={tableName:a,schemaName:``,fieldNames:o.split($),relation:`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(`
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:`*`},f={tableName:s,schemaName:o,fieldNames:c.split(`,`),relation:`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=`
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,
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": "9.0.0-optional-ref.2",
4
+ "version": "9.0.0-optional-ref.8",
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",
@@ -38,5 +38,5 @@
38
38
  "engines": {
39
39
  "node": ">=18"
40
40
  },
41
- "gitHead": "3fc818b8e6033e2de577d012722d86a7509e4af3"
41
+ "gitHead": "f70d4bfbf56addaab11a3877928897be44c157a7"
42
42
  }
@@ -315,14 +315,14 @@ const generateRefs = async (client: sql.ConnectionPool, schemas: string[]): Prom
315
315
  tableName: table_name,
316
316
  schemaName: table_schema,
317
317
  fieldNames: column_names.split(','),
318
- relation: '*',
318
+ relation: '0..*',
319
319
  };
320
320
 
321
321
  const ep2: RefEndpoint = {
322
322
  tableName: foreign_table_name,
323
323
  schemaName: foreign_table_schema,
324
324
  fieldNames: foreign_column_names.split(','),
325
- relation: '1',
325
+ relation: '0..1',
326
326
  };
327
327
 
328
328
  const newRef = {
@@ -486,13 +486,13 @@ async function generateForeignKeys (client: Connection, schemaName: string): Pro
486
486
  const endpoint1 = {
487
487
  tableName: foreignTableName,
488
488
  fieldNames: foreignColumnNames.split(','),
489
- relation: '*',
489
+ relation: '0..*',
490
490
  };
491
491
 
492
492
  const endpoint2 = {
493
493
  tableName: refTableName,
494
494
  fieldNames: refColumnNames.split(','),
495
- relation: '1',
495
+ relation: '0..1',
496
496
  };
497
497
 
498
498
  return {
@@ -51,14 +51,14 @@ export async function generateRawRefs (client: Connection): Promise<Ref[]> {
51
51
  tableName: child_table,
52
52
  schemaName: '',
53
53
  fieldNames: child_columns.split(LIST_SEPARATOR),
54
- relation: '*',
54
+ relation: '0..*',
55
55
  };
56
56
 
57
57
  const ep2: RefEndpoint = {
58
58
  tableName: parent_table,
59
59
  schemaName: '',
60
60
  fieldNames: parent_columns.split(LIST_SEPARATOR),
61
- relation: '1',
61
+ relation: '0..1',
62
62
  };
63
63
 
64
64
  refs.push({
@@ -282,14 +282,14 @@ const generateRawRefs = async (client: Client, schemas: string[]): Promise<Ref[]
282
282
  tableName: table_name,
283
283
  schemaName: table_schema,
284
284
  fieldNames: column_names.split(','),
285
- relation: '*',
285
+ relation: '0..*',
286
286
  };
287
287
 
288
288
  const ep2: RefEndpoint = {
289
289
  tableName: foreign_table_name,
290
290
  schemaName: foreign_table_schema,
291
291
  fieldNames: foreign_column_names.split(','),
292
- relation: '1',
292
+ relation: '0..1',
293
293
  };
294
294
 
295
295
  refs.push({
@@ -60,7 +60,7 @@ interface RefEndpoint {
60
60
  tableName: string; // Parent table or child table
61
61
  schemaName: string;
62
62
  fieldNames: string[]; // The parent fields or the child fields (foreign key fields)
63
- relation: '*' | '1'; // The parent endpoint is '*' and the child endpoint is '1'
63
+ relation: string; // The parent endpoint is '0..*' and the child endpoint is '0..1'
64
64
  }
65
65
 
66
66
  interface Ref {