@cocreate/file 1.14.0 → 1.14.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## [1.14.2](https://github.com/CoCreate-app/CoCreate-file/compare/v1.14.1...v1.14.2) (2024-01-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * await getFilter() ([339a343](https://github.com/CoCreate-app/CoCreate-file/commit/339a34379f51982b1447e5fffb81f4001c40b223))
7
+ * support defining storage and database in config ([bc992c1](https://github.com/CoCreate-app/CoCreate-file/commit/bc992c15dd586bdc3de580557617fc3eddb4a176))
8
+ * update to support new query system ([d3d43dc](https://github.com/CoCreate-app/CoCreate-file/commit/d3d43dc0585e6656167a8072fa3d2d848aca3b14))
9
+
10
+ ## [1.14.1](https://github.com/CoCreate-app/CoCreate-file/compare/v1.14.0...v1.14.1) (2023-12-28)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * typo ([b01a79a](https://github.com/CoCreate-app/CoCreate-file/commit/b01a79aa91dcdcca3d17fda1afa248672c24ad14))
16
+
1
17
  # [1.14.0](https://github.com/CoCreate-app/CoCreate-file/compare/v1.13.0...v1.14.0) (2023-11-25)
2
18
 
3
19
 
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # CoCreate-action
1
+ # CoCreate-file
2
2
 
3
3
  This is a configurable headless file uploader that utilizes HTML5 attributes for easy customization. With this module, users can easily upload files to a server without requiring a formal UI or browser interaction. By leveraging HTML5 attributes, it's easy to customize and fine-tune the behavior of the uploader to fit specific needs. This uploader is perfect for developers looking to implement file uploads in a headless environment. Take it for a spin in our [playground!](https://cocreate.app/docs/file)
4
4
 
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@cocreate/file",
3
- "version": "1.14.0",
3
+ "version": "1.14.2",
4
4
  "description": "A headless file uploader that uses HTML5 attributes for customization. Allows easy upload of files to server.",
5
5
  "keywords": [
6
6
  "file",
7
- "chain-functions",
8
7
  "cocreate",
9
8
  "low-code-framework",
10
9
  "no-code-framework",
package/src/client.js CHANGED
@@ -374,7 +374,7 @@ async function upload(element, data) {
374
374
  let Data = Elements.getObject(input);
375
375
  if (Data.type) {
376
376
  if (input.getFilter)
377
- Data.$filter = input.getFilter()
377
+ Data.$filter = await input.getFilter()
378
378
 
379
379
  let files = await getFiles(input)
380
380
 
@@ -454,7 +454,7 @@ async function Import(element, data) {
454
454
  let Data = Elements.getObject(element[i]);
455
455
  if (Data.type) {
456
456
  if (element[i].getFilter)
457
- Data.$filter = element[i].getFilter()
457
+ Data.$filter = await element[i].getFilter()
458
458
 
459
459
  if (Data.type === 'key')
460
460
  Data.type = 'object'
@@ -504,7 +504,7 @@ async function Export(element, data) {
504
504
  let Data = Elements.getObject(element[i]);
505
505
  if (Data.type) {
506
506
  if (element[i].getFilter)
507
- Data.$filter = element[i].getFilter()
507
+ Data.$filter = await element[i].getFilter()
508
508
 
509
509
  if (Data.type === 'key')
510
510
  Data.type = 'object'
package/src/server.js CHANGED
@@ -127,10 +127,10 @@ module.exports = async function file(CoCreateConfig, configPath, match) {
127
127
  method: 'signIn',
128
128
  array: 'users',
129
129
  $filter: {
130
- query: [
131
- { key: 'email', value: config.email, operator: '$eq' },
132
- { key: 'password', value: config.password, operator: '$eq' }
133
- ]
130
+ query: {
131
+ email: config.email,
132
+ password: config.password
133
+ }
134
134
  },
135
135
  ...config
136
136
  }
@@ -267,6 +267,14 @@ module.exports = async function file(CoCreateConfig, configPath, match) {
267
267
  array: directory.array || 'files',
268
268
  object
269
269
  }
270
+
271
+ if (directory.storage)
272
+ newObject.storage = directory.storage
273
+ if (directory.database)
274
+ newObject.database = directory.database
275
+ if (directory.array)
276
+ newObject.array = directory.array || 'files'
277
+
270
278
  for (const key of Object.keys(directory.object)) {
271
279
  if (typeof directory.object[key] == 'string') {
272
280
 
@@ -284,7 +292,9 @@ module.exports = async function file(CoCreateConfig, configPath, match) {
284
292
  if (skip !== 'directory') {
285
293
  if (!newObject.object._id)
286
294
  newObject.$filter = {
287
- query: [{ key: 'pathname', value: pathname, operator: '$eq' }]
295
+ query: {
296
+ pathname
297
+ }
288
298
  }
289
299
 
290
300
  response = await runStore(newObject);
@@ -396,7 +406,9 @@ module.exports = async function file(CoCreateConfig, configPath, match) {
396
406
  let data = { array, object }
397
407
  if (!object._id && object.pathname)
398
408
  data.$filter = {
399
- query: [{ key: 'pathname', value: object.pathname, operator: '$or' }]
409
+ query: {
410
+ $or: [{ pathname: object.pathname }]
411
+ }
400
412
  }
401
413
 
402
414
  if (match.length && isMatch)