@unchainedshop/plugins 1.2.52 → 1.2.54

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.
@@ -1,19 +1,28 @@
1
1
  import mongodb from 'mongodb';
2
2
  export const configureGridFSFileUploadModule = ({ db }) => {
3
+ // eslint-disable-next-line
4
+ // @ts-ignore
5
+ const isMeteor = typeof Meteor === 'object';
6
+ // eslint-disable-next-line
7
+ let { GridFSBucket } = mongodb;
8
+ if (isMeteor) {
9
+ const { MongoInternals } = require('meteor/mongo'); // eslint-disable-line
10
+ GridFSBucket = MongoInternals.NpmModule.GridFSBucket;
11
+ }
3
12
  return {
4
13
  createWriteStream: async (directoryName, fileId, fileName) => {
5
14
  const options = { bucketName: `file_uploads_${directoryName}`, chunkSizeBytes: 5 * 1024 * 1024 };
6
- const bucket = new mongodb.GridFSBucket(db, options);
15
+ const bucket = new GridFSBucket(db, options);
7
16
  return bucket.openUploadStreamWithId(fileId, fileName);
8
17
  },
9
18
  createReadStream: async (directoryName, fileId) => {
10
19
  const options = { bucketName: `file_uploads_${directoryName}`, chunkSizeBytes: 5 * 1024 * 1024 };
11
- const bucket = new mongodb.GridFSBucket(db, options);
20
+ const bucket = new GridFSBucket(db, options);
12
21
  return bucket.openDownloadStream(fileId);
13
22
  },
14
23
  removeFileFromBucket: async (directoryName, fileId) => {
15
24
  const options = { bucketName: `file_uploads_${directoryName}`, chunkSizeBytes: 5 * 1024 * 1024 };
16
- const bucket = new mongodb.GridFSBucket(db, options);
25
+ const bucket = new GridFSBucket(db, options);
17
26
  return bucket.delete(fileId);
18
27
  },
19
28
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/files/gridfs/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;IACxD,OAAO;QACL,iBAA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I,YAAY,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;YAC7C,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC/B,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unchainedshop/plugins",
3
- "version": "1.2.52",
3
+ "version": "1.2.54",
4
4
  "main": "lib/plugins-index.js",
5
5
  "types": "lib/plugins-index.d.ts",
6
6
  "exports": {
@@ -64,38 +64,38 @@
64
64
  },
65
65
  "homepage": "https://github.com/unchainedshop/unchained#readme",
66
66
  "devDependencies": {
67
- "@types/node": "^16.18.10",
68
- "@unchainedshop/api": "^1.2.52",
67
+ "@types/node": "^16.18.11",
68
+ "@unchainedshop/api": "^1.2.54",
69
69
  "@unchainedshop/client-oauth2": "^4.3.3",
70
- "@unchainedshop/core-delivery": "^1.2.52",
71
- "@unchainedshop/core-enrollments": "^1.2.52",
72
- "@unchainedshop/core-filters": "^1.2.52",
73
- "@unchainedshop/core-messaging": "^1.2.52",
74
- "@unchainedshop/core-orders": "^1.2.52",
75
- "@unchainedshop/core-payment": "^1.2.52",
76
- "@unchainedshop/core-products": "^1.2.52",
77
- "@unchainedshop/core-quotations": "^1.2.52",
78
- "@unchainedshop/core-warehousing": "^1.2.52",
79
- "@unchainedshop/core-worker": "^1.2.52",
80
- "@unchainedshop/events": "^1.2.52",
81
- "@unchainedshop/file-upload": "^1.2.52",
82
- "@unchainedshop/logger": "^1.2.52",
83
- "@unchainedshop/types": "^1.2.52",
84
- "@unchainedshop/utils": "^1.2.52",
70
+ "@unchainedshop/core-delivery": "^1.2.54",
71
+ "@unchainedshop/core-enrollments": "^1.2.54",
72
+ "@unchainedshop/core-filters": "^1.2.54",
73
+ "@unchainedshop/core-messaging": "^1.2.54",
74
+ "@unchainedshop/core-orders": "^1.2.54",
75
+ "@unchainedshop/core-payment": "^1.2.54",
76
+ "@unchainedshop/core-products": "^1.2.54",
77
+ "@unchainedshop/core-quotations": "^1.2.54",
78
+ "@unchainedshop/core-warehousing": "^1.2.54",
79
+ "@unchainedshop/core-worker": "^1.2.54",
80
+ "@unchainedshop/events": "^1.2.54",
81
+ "@unchainedshop/file-upload": "^1.2.54",
82
+ "@unchainedshop/logger": "^1.2.54",
83
+ "@unchainedshop/types": "^1.2.54",
84
+ "@unchainedshop/utils": "^1.2.54",
85
85
  "bluebird": "^3.7.2",
86
86
  "body-parser": "^1.20.0",
87
87
  "event-iterator": "^2.0.0",
88
- "jest": "^29.3.1",
88
+ "jest": "^29.4.1",
89
89
  "JSONStream": "^1.3.5",
90
90
  "minio": "^7.0.32",
91
91
  "mongodb": "^4.13.0",
92
92
  "node-sheets": "^1.2.0",
93
- "nodemailer": "^6.8.0",
93
+ "nodemailer": "^6.9.1",
94
94
  "open": "^8.4.0",
95
- "redis": "^4.5.1",
95
+ "redis": "^4.6.4",
96
96
  "request": "^2.88.2",
97
- "ts-jest": "^29.0.3",
98
- "typescript": "^4.9.4",
97
+ "ts-jest": "^29.0.5",
98
+ "typescript": "^4.9.5",
99
99
  "xml-js": "^1.6.11",
100
100
  "xml2js": "0.4.23"
101
101
  }
@@ -1,20 +1,31 @@
1
1
  import mongodb from 'mongodb';
2
2
 
3
3
  export const configureGridFSFileUploadModule = ({ db }) => {
4
+ // eslint-disable-next-line
5
+ // @ts-ignore
6
+ const isMeteor = typeof Meteor === 'object';
7
+
8
+ // eslint-disable-next-line
9
+ let { GridFSBucket } = mongodb;
10
+ if (isMeteor) {
11
+ const { MongoInternals } = require('meteor/mongo'); // eslint-disable-line
12
+ GridFSBucket = MongoInternals.NpmModule.GridFSBucket;
13
+ }
14
+
4
15
  return {
5
16
  createWriteStream: async (directoryName, fileId, fileName) => {
6
17
  const options = { bucketName: `file_uploads_${directoryName}`, chunkSizeBytes: 5 * 1024 * 1024 };
7
- const bucket = new mongodb.GridFSBucket(db, options);
18
+ const bucket = new GridFSBucket(db, options);
8
19
  return bucket.openUploadStreamWithId(fileId, fileName);
9
20
  },
10
21
  createReadStream: async (directoryName, fileId) => {
11
22
  const options = { bucketName: `file_uploads_${directoryName}`, chunkSizeBytes: 5 * 1024 * 1024 };
12
- const bucket = new mongodb.GridFSBucket(db, options);
23
+ const bucket = new GridFSBucket(db, options);
13
24
  return bucket.openDownloadStream(fileId);
14
25
  },
15
26
  removeFileFromBucket: async (directoryName, fileId) => {
16
27
  const options = { bucketName: `file_uploads_${directoryName}`, chunkSizeBytes: 5 * 1024 * 1024 };
17
- const bucket = new mongodb.GridFSBucket(db, options);
28
+ const bucket = new GridFSBucket(db, options);
18
29
  return bucket.delete(fileId);
19
30
  },
20
31
  };