@researchdatabox/sails-hook-redbox-storage-mongo 1.5.3 → 5.0.0-RC2

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 (37) hide show
  1. package/README.md +20 -5
  2. package/dist/config/record.d.ts +3 -0
  3. package/dist/config/record.js +7 -0
  4. package/dist/config/storage.d.ts +105 -0
  5. package/dist/config/storage.js +25 -0
  6. package/dist/index.d.ts +16 -0
  7. package/dist/index.js +31 -0
  8. package/dist/models/DeletedRecord.d.ts +7 -0
  9. package/dist/models/DeletedRecord.js +37 -0
  10. package/dist/models/IntegrationAudit.d.ts +22 -0
  11. package/dist/models/IntegrationAudit.js +112 -0
  12. package/dist/models/Record.d.ts +13 -0
  13. package/dist/models/Record.js +64 -0
  14. package/dist/models/RecordAudit.d.ts +9 -0
  15. package/dist/models/RecordAudit.js +47 -0
  16. package/dist/models/index.d.ts +10 -0
  17. package/dist/models/index.js +32 -0
  18. package/dist/services/MongoStorageService.d.ts +83 -0
  19. package/dist/services/MongoStorageService.js +1276 -0
  20. package/dist/services/index.d.ts +5 -0
  21. package/dist/services/index.js +51 -0
  22. package/package.json +66 -32
  23. package/.github/dependabot.yml +0 -12
  24. package/api/models/DeletedRecord.js +0 -24
  25. package/api/models/Record.js +0 -41
  26. package/api/models/RecordAudit.js +0 -18
  27. package/api/services/MongoStorageService.js +0 -905
  28. package/config/record.js +0 -3
  29. package/config/storage.js +0 -73
  30. package/index.js +0 -21
  31. package/test/unit/.mocharc.js +0 -21
  32. package/test/unit/bootstrap.js +0 -63
  33. package/test/unit/db/storage.test.js +0 -121
  34. package/transformer/ExportJSONTransformer.js +0 -47
  35. package/tsconfig.json +0 -39
  36. package/typescript/api/services/MongoStorageService.ts +0 -1005
  37. package/typescript/transformer/ExportJSONTransformer.ts +0 -65
@@ -0,0 +1,5 @@
1
+ import * as MongoStorageServiceModule from './MongoStorageService';
2
+ export { MongoStorageServiceModule as MongoStorageService };
3
+ export declare const ServiceExports: {
4
+ readonly MongoStorageService: unknown;
5
+ };
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ServiceExports = exports.MongoStorageService = void 0;
37
+ const MongoStorageServiceModule = __importStar(require("./MongoStorageService"));
38
+ exports.MongoStorageService = MongoStorageServiceModule;
39
+ const serviceCache = {};
40
+ function getOrCreateService(name, factory) {
41
+ if (!serviceCache[name]) {
42
+ serviceCache[name] = factory();
43
+ }
44
+ return serviceCache[name];
45
+ }
46
+ exports.ServiceExports = {
47
+ get MongoStorageService() {
48
+ return getOrCreateService('MongoStorageService', () => new MongoStorageServiceModule.Services.MongoStorageService().exports());
49
+ },
50
+ };
51
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc2VydmljZXMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsaUZBQW1FO0FBWTdCLHdEQUFtQjtBQVZ6RCxNQUFNLFlBQVksR0FBNEIsRUFBRSxDQUFDO0FBRWpELFNBQVMsa0JBQWtCLENBQUMsSUFBWSxFQUFFLE9BQXNCO0lBQzlELElBQUksQ0FBQyxZQUFZLENBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQztRQUN4QixZQUFZLENBQUMsSUFBSSxDQUFDLEdBQUcsT0FBTyxFQUFFLENBQUM7SUFDakMsQ0FBQztJQUVELE9BQU8sWUFBWSxDQUFDLElBQUksQ0FBQyxDQUFDO0FBQzVCLENBQUM7QUFJWSxRQUFBLGNBQWMsR0FBRztJQUM1QixJQUFJLG1CQUFtQjtRQUNyQixPQUFPLGtCQUFrQixDQUFDLHFCQUFxQixFQUFFLEdBQUcsRUFBRSxDQUNwRCxJQUFJLHlCQUF5QixDQUFDLFFBQVEsQ0FBQyxtQkFBbUIsRUFBRSxDQUFDLE9BQU8sRUFBRSxDQUN2RSxDQUFDO0lBQ0osQ0FBQztDQUNGLENBQUMifQ==
package/package.json CHANGED
@@ -1,26 +1,33 @@
1
1
  {
2
2
  "name": "@researchdatabox/sails-hook-redbox-storage-mongo",
3
- "version": "1.5.3",
3
+ "version": "5.0.0-RC2",
4
4
  "description": "A MongoDB storage plugin for ReDBox.",
5
- "main": "index.js",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "README.md"
10
+ ],
6
11
  "sails": {
7
- "isHook": true
12
+ "isHook": true,
13
+ "hasModels": true,
14
+ "hasServices": true,
15
+ "hasConfig": true
8
16
  },
9
17
  "repository": {
10
18
  "type": "git",
11
19
  "url": "https://github.com/redbox-mint/sails-hook-redbox-storage-mongo.git"
12
20
  },
13
21
  "scripts": {
14
- "compile": "./node_modules/typescript/bin/tsc -p tsconfig.json",
15
- "dev:run": "docker compose -f ./support/docker-compose.yml -f ./support/docker-compose.dev.yml up --menu=false --remove-orphans --abort-on-container-exit --exit-code-from rbportal",
16
- "predev:run": "npm install --ignore-scripts && npm run compile",
17
- "dev:clean": "docker compose -f ./support/docker-compose.yml -f ./support/docker-compose.dev.yml down",
18
- "dev:logs": "docker compose -f ./support/docker-compose.yml -f ./support/docker-compose.dev.yml logs",
19
- "dev:removedata": "docker compose -f ./support/docker-compose.yml -f ./support/docker-compose.dev.yml down -v",
20
- "test": "docker compose -f ./support/docker-compose.yml -f ./support/docker-compose.mocha.yml up --menu=false --abort-on-container-exit --exit-code-from rbportal",
21
- "pretest": "npm install --ignore-scripts && npm run compile",
22
- "posttest": "npm run test:clean",
23
- "test:clean": "docker compose -f ./support/docker-compose.yml -f ./support/docker-compose.mocha.yml down -v"
22
+ "compile": "npm run build",
23
+ "build": "tsc -p tsconfig.json",
24
+ "test": "TS_NODE_PROJECT=test/tsconfig.json mocha --require ts-node/register --require test/setup.ts --extension ts --recursive test",
25
+ "test:coverage": "TS_NODE_PROJECT=test/tsconfig.json nyc --no-clean --report-dir ./coverage/storage-mongo --reporter=lcov --reporter=text --exclude-after-remap=false mocha --require ts-node/register --require test/setup.ts --extension ts --recursive test",
26
+ "test:compile": "tsc -p test/tsconfig.json",
27
+ "lint": "cd ../.. && oxlint packages/sails-hook-redbox-storage-mongo/src packages/sails-hook-redbox-storage-mongo/test",
28
+ "lint:fix": "cd ../.. && oxlint packages/sails-hook-redbox-storage-mongo/src packages/sails-hook-redbox-storage-mongo/test --fix",
29
+ "format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
30
+ "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\""
24
31
  },
25
32
  "keywords": [
26
33
  "sails",
@@ -33,32 +40,59 @@
33
40
  "author": "QCIF Engineering dev@redboxresearchdata.com.au",
34
41
  "license": "GPL-3.0",
35
42
  "devDependencies": {
36
- "@researchdatabox/redbox-core-types": "^1.5.0",
37
- "@types/chai": "5.2.2",
38
- "@types/lodash": "4.17.17",
43
+ "@types/chai": "5.2.3",
44
+ "@types/lodash": "4.17.24",
39
45
  "@types/mocha": "10.0.10",
40
- "@types/node": "20.17.51",
41
- "chai": "5.2.0",
42
- "fs": "0.0.1-security",
43
- "luxon": "^3.7.1",
44
- "mocha": "11.7.1",
46
+ "@tsconfig/node24": "24.0.4",
47
+ "@types/sinon": "21.0.1",
48
+ "@types/node": "24.12.4",
49
+ "chai": "6.2.2",
50
+ "luxon": "3.7.2",
51
+ "mocha": "11.7.6",
45
52
  "mocha-junit-reporter": "2.2.1",
46
- "mongodb": "6.16.0",
47
- "sails": "1.5.14",
48
- "stream": "0.0.3",
49
- "typescript": "5.9.2",
50
- "util": "0.12.5"
53
+ "mongodb": "7.2.0",
54
+ "nyc": "18.0.0",
55
+ "sails": "1.5.17",
56
+ "sinon": "22.0.0",
57
+ "serialize-javascript": "7.0.5",
58
+ "ts-node": "10.9.2",
59
+ "typescript": "5.9.3"
51
60
  },
52
61
  "dependencies": {
53
- "json2csv": "^5.0.3",
54
- "lodash": "^4.17.21",
55
- "uuid": "11.1.0"
62
+ "@researchdatabox/redbox-core": "5.0.0-RC2",
63
+ "json2csv": "5.0.7",
64
+ "lodash": "4.18.1",
65
+ "mongodb": "7.2.0",
66
+ "reflect-metadata": "0.2.2",
67
+ "uuid": "14.0.0"
56
68
  },
57
69
  "peerDependencies": {
58
- "luxon": ">=3.0.0",
59
- "rxjs": ">=7.0.0"
70
+ "luxon": "3.7.2",
71
+ "rxjs": "7.8.2"
72
+ },
73
+ "overrides": {
74
+ "on-headers": "1.1.0",
75
+ "serialize-javascript": "7.0.5",
76
+ "uuid": "14.0.0",
77
+ "compression": {
78
+ "on-headers": "1.1.0"
79
+ },
80
+ "express-session": {
81
+ "on-headers": "1.1.0"
82
+ }
60
83
  },
61
84
  "publishConfig": {
62
- "access": "public"
85
+ "access": "public",
86
+ "registry": "https://registry.npmjs.org/"
87
+ },
88
+ "nyc": {
89
+ "all": true,
90
+ "include": [
91
+ "src/**/*.ts"
92
+ ],
93
+ "reporter": [
94
+ "lcov",
95
+ "text"
96
+ ]
63
97
  }
64
98
  }
@@ -1,12 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: "github-actions"
4
- directory: "/"
5
- schedule:
6
- interval: "weekly"
7
- target-branch: "master"
8
- - package-ecosystem: "npm"
9
- directory: "/"
10
- schedule:
11
- interval: "weekly"
12
- target-branch: "master"
@@ -1,24 +0,0 @@
1
- /**
2
- * Record.js
3
- *
4
- * @description :: The Deleted Record Model for ReDBox
5
- * @docs :: http://sailsjs.org/documentation/concepts/models-and-orm/models
6
- */
7
-
8
- module.exports = {
9
- attributes: {
10
- redboxOid: {
11
- type: 'string',
12
- unique: true
13
- },
14
- deletedRecordMetadata: {
15
- type: 'json'
16
- },
17
- dateDeleted: {
18
- type: 'string',
19
- autoCreatedAt: true
20
- }
21
- },
22
- datastore: 'redboxStorage'
23
- };
24
-
@@ -1,41 +0,0 @@
1
- /**
2
- * Record.js
3
- *
4
- * @description :: The Record Model for ReDBox
5
- * @docs :: http://sailsjs.org/documentation/concepts/models-and-orm/models
6
- */
7
-
8
- module.exports = {
9
- attributes: {
10
- redboxOid: {
11
- type: 'string',
12
- unique: true
13
- },
14
- harvestId: {
15
- type: 'string'
16
- },
17
- metaMetadata: {
18
- type: 'json'
19
- },
20
- metadata: {
21
- type: 'json'
22
- },
23
- workflow: {
24
- type: 'json'
25
- },
26
- authorization: {
27
- type: 'json'
28
- },
29
- createdAt: false,
30
- updatedAt: false,
31
- dateCreated: {
32
- type: 'string',
33
- autoCreatedAt: true
34
- },
35
- lastSaveDate: {
36
- type: 'string',
37
- autoUpdatedAt: true
38
- }
39
- },
40
- datastore: 'redboxStorage'
41
- };
@@ -1,18 +0,0 @@
1
- module.exports = {
2
- attributes: {
3
- user: {
4
- type: 'json'
5
- },
6
- record: {
7
- type: 'json'
8
- },
9
- dateCreated: {
10
- type: 'string',
11
- autoCreatedAt: true
12
- },
13
- action: {
14
- type: 'string'
15
- }
16
- },
17
- datastore: 'redboxStorage'
18
- }