@1auth/authn 0.0.0-alpha.51 → 0.0.0-alpha.53

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 +16 -2
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -90,7 +90,7 @@ export const list = async (credentialOptions, sub, params, fields) => {
90
90
  return list
91
91
  }
92
92
 
93
- export const create = async (
93
+ const createCredential = async (
94
94
  credentialOptions,
95
95
  sub,
96
96
  { id, value, ...values }
@@ -125,8 +125,22 @@ export const create = async (
125
125
  if (options.idGenerate) {
126
126
  params.id = id
127
127
  }
128
+ return params
129
+ }
130
+
131
+ export const create = async (credentialOptions, sub, values) => {
132
+ const params = await createCredential(credentialOptions, sub, values)
128
133
  const row = await options.store.insert(options.table, params)
129
- return { type, id: row.id, value, otp, expire }
134
+ return { ...params, id: row.id }
135
+ }
136
+
137
+ export const createList = async (credentialOptions, sub, list) => {
138
+ const rows = await Promise.all(
139
+ list.map((values) => createCredential(credentialOptions, sub, values))
140
+ )
141
+ const params = rows[0]
142
+ const res = await options.store.insertList(options.table, rows)
143
+ return { ...params, id: res }
130
144
  }
131
145
 
132
146
  export const update = async (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1auth/authn",
3
- "version": "0.0.0-alpha.51",
3
+ "version": "0.0.0-alpha.53",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "engines": {
@@ -50,6 +50,6 @@
50
50
  "homepage": "https://github.com/willfarrell/1auth",
51
51
  "gitHead": "7a6c0fbb8ab71d6a2171e678697de9f237568431",
52
52
  "dependencies": {
53
- "@1auth/crypto": "0.0.0-alpha.51"
53
+ "@1auth/crypto": "0.0.0-alpha.53"
54
54
  }
55
55
  }