@1auth/store-sql 0.0.0-alpha.53 → 0.0.0-alpha.55

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.
Files changed (2) hide show
  1. package/index.js +14 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -89,8 +89,14 @@ export const insertList = async (table, rows = []) => {
89
89
  const insertValues = []
90
90
  let insertParameters = []
91
91
  for (let i = 0, l = rows.length; i < l; i++) {
92
- const values = rows[i]
93
- const { insert, parameters } = makeSqlParts({}, values)
92
+ const values = structuredClone(rows[i])
93
+ normalizeValues(values)
94
+ const { insert, parameters } = makeSqlParts(
95
+ {},
96
+ values,
97
+ [],
98
+ i * Object.keys(values).length + 1
99
+ )
94
100
  if (i) {
95
101
  insertValues.push(insert.split('VALUES')[1]) // (?)
96
102
  } else {
@@ -149,9 +155,13 @@ const parseValues = (values) => {
149
155
  export const getPlaceholder = (idx) => {
150
156
  return options.placeholder === '$' ? '$' + idx : options.placeholder
151
157
  }
152
- export const makeSqlParts = (filters = {}, values = {}, fields = []) => {
158
+ export const makeSqlParts = (
159
+ filters = {},
160
+ values = {},
161
+ fields = [],
162
+ idx = 1
163
+ ) => {
153
164
  let parameters = []
154
- let idx = 1
155
165
  const keys = Object.keys(values)
156
166
 
157
167
  const select = fields.length ? '"' + fields.join('", "') + '"' : '*'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1auth/store-sql",
3
- "version": "0.0.0-alpha.53",
3
+ "version": "0.0.0-alpha.55",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "engines": {