@researchdatabox/sails-hook-redbox-storage-mongo 5.0.4 → 5.1.0-beta.12568
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/README.md +41 -0
- package/dist/config/storage.d.ts +52 -0
- package/dist/config/storage.js +18 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/migrations/index.d.ts +5 -0
- package/dist/migrations/index.js +26 -0
- package/dist/migrations/recordRevisionBackfill.d.ts +26 -0
- package/dist/migrations/recordRevisionBackfill.js +115 -0
- package/dist/models/DeletedRecord.d.ts +8 -0
- package/dist/models/DeletedRecord.js +55 -1
- package/dist/models/Record.d.ts +5 -0
- package/dist/models/Record.js +43 -1
- package/dist/models/RecordAudit.d.ts +2 -0
- package/dist/models/RecordAudit.js +11 -1
- package/dist/models/RecordSchemaArtifact.d.ts +14 -0
- package/dist/models/RecordSchemaArtifact.js +75 -0
- package/dist/models/RecordSchemaReference.d.ts +25 -0
- package/dist/models/RecordSchemaReference.js +128 -0
- package/dist/models/index.d.ts +4 -0
- package/dist/models/index.js +7 -1
- package/dist/services/MongoStorageService.d.ts +174 -11
- package/dist/services/MongoStorageService.js +1901 -271
- package/dist/services/recordSchemaPersistence.d.ts +27 -0
- package/dist/services/recordSchemaPersistence.js +258 -0
- package/package.json +4 -3
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import type { ContractJsonObject, RecordContractCompleteness, RecordContractFormat } from '@researchdatabox/redbox-core';
|
|
3
|
+
export declare const RECORD_SCHEMA_DIGEST_PATTERN: RegExp;
|
|
4
|
+
export declare class RecordSchemaArtifactClass {
|
|
5
|
+
digest: string;
|
|
6
|
+
document: ContractJsonObject;
|
|
7
|
+
contractFormat: RecordContractFormat;
|
|
8
|
+
completeness: RecordContractCompleteness;
|
|
9
|
+
byteLength: number;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
updatedAt: string;
|
|
12
|
+
lastAccessedAt?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const RecordSchemaArtifactWLDef: import("@researchdatabox/redbox-core").WaterlineModelDefinition;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RecordSchemaArtifactWLDef = exports.RecordSchemaArtifactClass = exports.RECORD_SCHEMA_DIGEST_PATTERN = void 0;
|
|
13
|
+
require("reflect-metadata");
|
|
14
|
+
const redbox_core_1 = require("@researchdatabox/redbox-core");
|
|
15
|
+
exports.RECORD_SCHEMA_DIGEST_PATTERN = /^[a-f0-9]{64}$/;
|
|
16
|
+
let RecordSchemaArtifactClass = class RecordSchemaArtifactClass {
|
|
17
|
+
digest;
|
|
18
|
+
document;
|
|
19
|
+
contractFormat;
|
|
20
|
+
completeness;
|
|
21
|
+
byteLength;
|
|
22
|
+
createdAt;
|
|
23
|
+
updatedAt;
|
|
24
|
+
lastAccessedAt;
|
|
25
|
+
};
|
|
26
|
+
exports.RecordSchemaArtifactClass = RecordSchemaArtifactClass;
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, redbox_core_1.Attr)({
|
|
29
|
+
type: 'string',
|
|
30
|
+
required: true,
|
|
31
|
+
unique: true,
|
|
32
|
+
validations: { regex: exports.RECORD_SCHEMA_DIGEST_PATTERN },
|
|
33
|
+
}),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], RecordSchemaArtifactClass.prototype, "digest", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, redbox_core_1.Attr)({ type: 'json', required: true }),
|
|
38
|
+
__metadata("design:type", Object)
|
|
39
|
+
], RecordSchemaArtifactClass.prototype, "document", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, redbox_core_1.Attr)({
|
|
42
|
+
type: 'string',
|
|
43
|
+
required: true,
|
|
44
|
+
isIn: [redbox_core_1.RECORD_CONTRACT_FORMAT_V1],
|
|
45
|
+
}),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], RecordSchemaArtifactClass.prototype, "contractFormat", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, redbox_core_1.Attr)({ type: 'string', required: true, isIn: ['complete', 'partial'] }),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], RecordSchemaArtifactClass.prototype, "completeness", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, redbox_core_1.Attr)({ type: 'number', required: true, min: 1 }),
|
|
54
|
+
__metadata("design:type", Number)
|
|
55
|
+
], RecordSchemaArtifactClass.prototype, "byteLength", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, redbox_core_1.Attr)({ type: 'string', columnType: 'datetime', autoCreatedAt: true }),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], RecordSchemaArtifactClass.prototype, "createdAt", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, redbox_core_1.Attr)({ type: 'string', columnType: 'datetime', autoUpdatedAt: true }),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], RecordSchemaArtifactClass.prototype, "updatedAt", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, redbox_core_1.Attr)({ type: 'string', columnType: 'datetime' }),
|
|
66
|
+
__metadata("design:type", String)
|
|
67
|
+
], RecordSchemaArtifactClass.prototype, "lastAccessedAt", void 0);
|
|
68
|
+
exports.RecordSchemaArtifactClass = RecordSchemaArtifactClass = __decorate([
|
|
69
|
+
(0, redbox_core_1.Entity)('recordschemaartifact', {
|
|
70
|
+
datastore: 'redboxStorage',
|
|
71
|
+
indexes: [{ attributes: { digest: 1 }, unique: true }],
|
|
72
|
+
})
|
|
73
|
+
], RecordSchemaArtifactClass);
|
|
74
|
+
exports.RecordSchemaArtifactWLDef = (0, redbox_core_1.toWaterlineModelDef)(RecordSchemaArtifactClass);
|
|
75
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUmVjb3JkU2NoZW1hQXJ0aWZhY3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbW9kZWxzL1JlY29yZFNjaGVtYUFydGlmYWN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7OztBQUFBLDRCQUEwQjtBQUUxQiw4REFBNEc7QUFPL0YsUUFBQSw0QkFBNEIsR0FBRyxnQkFBZ0IsQ0FBQztBQU10RCxJQUFNLHlCQUF5QixHQUEvQixNQUFNLHlCQUF5QjtJQU83QixNQUFNLENBQVU7SUFHaEIsUUFBUSxDQUFzQjtJQU85QixjQUFjLENBQXdCO0lBR3RDLFlBQVksQ0FBOEI7SUFHMUMsVUFBVSxDQUFVO0lBR3BCLFNBQVMsQ0FBVTtJQUduQixTQUFTLENBQVU7SUFHbkIsY0FBYyxDQUFVO0NBQ2hDLENBQUE7QUFqQ1ksOERBQXlCO0FBTzdCO0lBTk4sSUFBQSxrQkFBSSxFQUFDO1FBQ0osSUFBSSxFQUFFLFFBQVE7UUFDZCxRQUFRLEVBQUUsSUFBSTtRQUNkLE1BQU0sRUFBRSxJQUFJO1F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UFBQSxvQkFBTSxFQUFDLHNCQUFzQixFQUFFO1FBQzlCLFNBQVMsRUFBRSxlQUFlO1FBQzFCLE9BQU8sRUFBRSxDQUFDLEVBQUUsVUFBVSxFQUFFLEVBQUUsTUFBTSxFQUFFLENBQUMsRUFBRSxFQUFFLE1BQU0sRUFBRSxJQUFJLEVBQUUsQ0FBQztLQUN2RCxDQUFDO0dBQ1cseUJBQXlCLENBaUNyQztBQUVZLFFBQUEseUJBQXlCLEdBQUcsSUFBQSxpQ0FBbUIsRUFBQyx5QkFBeUIsQ0FBQyxDQUFDIn0=
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import type { RecordContractSchemaKind } from '@researchdatabox/redbox-core';
|
|
3
|
+
export declare const RECORD_SCHEMA_REFERENCE_KEY_PATTERN: RegExp;
|
|
4
|
+
export declare class RecordSchemaReferenceClass {
|
|
5
|
+
referenceKey: string;
|
|
6
|
+
digest: string;
|
|
7
|
+
kind: 'grant' | 'save' | 'pin';
|
|
8
|
+
brand: string;
|
|
9
|
+
portal: string;
|
|
10
|
+
schemaKind: RecordContractSchemaKind;
|
|
11
|
+
recordType: string;
|
|
12
|
+
oid?: string;
|
|
13
|
+
operation: string;
|
|
14
|
+
owner?: string;
|
|
15
|
+
purpose?: string;
|
|
16
|
+
expiresAt?: string;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Runtime persistence enforces the discriminated rules that Waterline cannot:
|
|
22
|
+
* create grants have no OID, update grants and saves require one, and only pins
|
|
23
|
+
* may carry owner, purpose, or expiry fields.
|
|
24
|
+
*/
|
|
25
|
+
export declare const RecordSchemaReferenceWLDef: import("@researchdatabox/redbox-core").WaterlineModelDefinition;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RecordSchemaReferenceWLDef = exports.RecordSchemaReferenceClass = exports.RECORD_SCHEMA_REFERENCE_KEY_PATTERN = void 0;
|
|
13
|
+
require("reflect-metadata");
|
|
14
|
+
const redbox_core_1 = require("@researchdatabox/redbox-core");
|
|
15
|
+
const RecordSchemaArtifact_1 = require("./RecordSchemaArtifact");
|
|
16
|
+
exports.RECORD_SCHEMA_REFERENCE_KEY_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,511}$/;
|
|
17
|
+
let RecordSchemaReferenceClass = class RecordSchemaReferenceClass {
|
|
18
|
+
referenceKey;
|
|
19
|
+
digest;
|
|
20
|
+
kind;
|
|
21
|
+
brand;
|
|
22
|
+
portal;
|
|
23
|
+
schemaKind;
|
|
24
|
+
recordType;
|
|
25
|
+
oid;
|
|
26
|
+
operation;
|
|
27
|
+
owner;
|
|
28
|
+
purpose;
|
|
29
|
+
expiresAt;
|
|
30
|
+
createdAt;
|
|
31
|
+
updatedAt;
|
|
32
|
+
};
|
|
33
|
+
exports.RecordSchemaReferenceClass = RecordSchemaReferenceClass;
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, redbox_core_1.Attr)({
|
|
36
|
+
type: 'string',
|
|
37
|
+
required: true,
|
|
38
|
+
unique: true,
|
|
39
|
+
validations: { regex: exports.RECORD_SCHEMA_REFERENCE_KEY_PATTERN },
|
|
40
|
+
}),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], RecordSchemaReferenceClass.prototype, "referenceKey", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, redbox_core_1.Attr)({
|
|
45
|
+
type: 'string',
|
|
46
|
+
required: true,
|
|
47
|
+
validations: { regex: RecordSchemaArtifact_1.RECORD_SCHEMA_DIGEST_PATTERN },
|
|
48
|
+
}),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], RecordSchemaReferenceClass.prototype, "digest", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, redbox_core_1.Attr)({ type: 'string', required: true, isIn: ['grant', 'save', 'pin'] }),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], RecordSchemaReferenceClass.prototype, "kind", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, redbox_core_1.Attr)({ type: 'string', required: true, validations: { maxLength: 512 } }),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], RecordSchemaReferenceClass.prototype, "brand", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, redbox_core_1.Attr)({ type: 'string', required: true, validations: { maxLength: 512 } }),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], RecordSchemaReferenceClass.prototype, "portal", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, redbox_core_1.Attr)({ type: 'string', required: true, isIn: ['create', 'update'] }),
|
|
65
|
+
__metadata("design:type", String)
|
|
66
|
+
], RecordSchemaReferenceClass.prototype, "schemaKind", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, redbox_core_1.Attr)({ type: 'string', required: true, validations: { maxLength: 512 } }),
|
|
69
|
+
__metadata("design:type", String)
|
|
70
|
+
], RecordSchemaReferenceClass.prototype, "recordType", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, redbox_core_1.Attr)({ type: 'string', validations: { maxLength: 512 } }),
|
|
73
|
+
__metadata("design:type", String)
|
|
74
|
+
], RecordSchemaReferenceClass.prototype, "oid", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, redbox_core_1.Attr)({ type: 'string', required: true, validations: { maxLength: 512 } }),
|
|
77
|
+
__metadata("design:type", String)
|
|
78
|
+
], RecordSchemaReferenceClass.prototype, "operation", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, redbox_core_1.Attr)({ type: 'string', validations: { maxLength: 512 } }),
|
|
81
|
+
__metadata("design:type", String)
|
|
82
|
+
], RecordSchemaReferenceClass.prototype, "owner", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, redbox_core_1.Attr)({ type: 'string', validations: { maxLength: 2_048 } }),
|
|
85
|
+
__metadata("design:type", String)
|
|
86
|
+
], RecordSchemaReferenceClass.prototype, "purpose", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, redbox_core_1.Attr)({ type: 'string', columnType: 'datetime' }),
|
|
89
|
+
__metadata("design:type", String)
|
|
90
|
+
], RecordSchemaReferenceClass.prototype, "expiresAt", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
(0, redbox_core_1.Attr)({ type: 'string', columnType: 'datetime', autoCreatedAt: true }),
|
|
93
|
+
__metadata("design:type", String)
|
|
94
|
+
], RecordSchemaReferenceClass.prototype, "createdAt", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
(0, redbox_core_1.Attr)({ type: 'string', columnType: 'datetime', autoUpdatedAt: true }),
|
|
97
|
+
__metadata("design:type", String)
|
|
98
|
+
], RecordSchemaReferenceClass.prototype, "updatedAt", void 0);
|
|
99
|
+
exports.RecordSchemaReferenceClass = RecordSchemaReferenceClass = __decorate([
|
|
100
|
+
(0, redbox_core_1.Entity)('recordschemareference', {
|
|
101
|
+
datastore: 'redboxStorage',
|
|
102
|
+
indexes: [
|
|
103
|
+
{ attributes: { referenceKey: 1 }, unique: true },
|
|
104
|
+
{ attributes: { digest: 1, kind: 1 } },
|
|
105
|
+
{
|
|
106
|
+
attributes: {
|
|
107
|
+
digest: 1,
|
|
108
|
+
kind: 1,
|
|
109
|
+
brand: 1,
|
|
110
|
+
portal: 1,
|
|
111
|
+
schemaKind: 1,
|
|
112
|
+
recordType: 1,
|
|
113
|
+
operation: 1,
|
|
114
|
+
oid: 1,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
{ attributes: { oid: 1, kind: 1 } },
|
|
118
|
+
{ attributes: { kind: 1, expiresAt: 1 } },
|
|
119
|
+
],
|
|
120
|
+
})
|
|
121
|
+
], RecordSchemaReferenceClass);
|
|
122
|
+
/**
|
|
123
|
+
* Runtime persistence enforces the discriminated rules that Waterline cannot:
|
|
124
|
+
* create grants have no OID, update grants and saves require one, and only pins
|
|
125
|
+
* may carry owner, purpose, or expiry fields.
|
|
126
|
+
*/
|
|
127
|
+
exports.RecordSchemaReferenceWLDef = (0, redbox_core_1.toWaterlineModelDef)(RecordSchemaReferenceClass);
|
|
128
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUmVjb3JkU2NoZW1hUmVmZXJlbmNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL21vZGVscy9SZWNvcmRTY2hlbWFSZWZlcmVuY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0FBQUEsNEJBQTBCO0FBRTFCLDhEQUFpRjtBQUVqRixpRUFBc0U7QUFFekQsUUFBQSxtQ0FBbUMsR0FBRyxxQ0FBcUMsQ0FBQztBQXVCbEYsSUFBTSwwQkFBMEIsR0FBaEMsTUFBTSwwQkFBMEI7SUFPOUIsWUFBWSxDQUFVO0lBT3RCLE1BQU0sQ0FBVTtJQUdoQixJQUFJLENBQTRCO0lBR2hDLEtBQUssQ0FBVTtJQUdmLE1BQU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UFFLFNBQVMsRUFBRSxDQUFDLEVBQUUsRUFBRTtTQUMxQztLQUNGLENBQUM7R0FDVywwQkFBMEIsQ0FtRHRDO0FBRUQ7Ozs7R0FJRztBQUNVLFFBQUEsMEJBQTBCLEdBQUcsSUFBQSxpQ0FBbUIsRUFBQywwQkFBMEIsQ0FBQyxDQUFDIn0=
|
package/dist/models/index.d.ts
CHANGED
|
@@ -2,9 +2,13 @@ export * from './Record';
|
|
|
2
2
|
export * from './DeletedRecord';
|
|
3
3
|
export * from './RecordAudit';
|
|
4
4
|
export * from './IntegrationAudit';
|
|
5
|
+
export * from './RecordSchemaArtifact';
|
|
6
|
+
export * from './RecordSchemaReference';
|
|
5
7
|
export declare const MongoModels: {
|
|
6
8
|
Record: import("@researchdatabox/redbox-core").WaterlineModelDefinition;
|
|
7
9
|
DeletedRecord: import("@researchdatabox/redbox-core").WaterlineModelDefinition;
|
|
8
10
|
RecordAudit: import("@researchdatabox/redbox-core").WaterlineModelDefinition;
|
|
9
11
|
IntegrationAudit: import("@researchdatabox/redbox-core").WaterlineModelDefinition;
|
|
12
|
+
RecordSchemaArtifact: import("@researchdatabox/redbox-core").WaterlineModelDefinition;
|
|
13
|
+
RecordSchemaReference: import("@researchdatabox/redbox-core").WaterlineModelDefinition;
|
|
10
14
|
};
|
package/dist/models/index.js
CHANGED
|
@@ -19,14 +19,20 @@ const Record_1 = require("./Record");
|
|
|
19
19
|
const DeletedRecord_1 = require("./DeletedRecord");
|
|
20
20
|
const RecordAudit_1 = require("./RecordAudit");
|
|
21
21
|
const IntegrationAudit_1 = require("./IntegrationAudit");
|
|
22
|
+
const RecordSchemaArtifact_1 = require("./RecordSchemaArtifact");
|
|
23
|
+
const RecordSchemaReference_1 = require("./RecordSchemaReference");
|
|
22
24
|
__exportStar(require("./Record"), exports);
|
|
23
25
|
__exportStar(require("./DeletedRecord"), exports);
|
|
24
26
|
__exportStar(require("./RecordAudit"), exports);
|
|
25
27
|
__exportStar(require("./IntegrationAudit"), exports);
|
|
28
|
+
__exportStar(require("./RecordSchemaArtifact"), exports);
|
|
29
|
+
__exportStar(require("./RecordSchemaReference"), exports);
|
|
26
30
|
exports.MongoModels = {
|
|
27
31
|
Record: Record_1.RecordWLDef,
|
|
28
32
|
DeletedRecord: DeletedRecord_1.DeletedRecordWLDef,
|
|
29
33
|
RecordAudit: RecordAudit_1.RecordAuditWLDef,
|
|
30
34
|
IntegrationAudit: IntegrationAudit_1.IntegrationAuditWLDef,
|
|
35
|
+
RecordSchemaArtifact: RecordSchemaArtifact_1.RecordSchemaArtifactWLDef,
|
|
36
|
+
RecordSchemaReference: RecordSchemaReference_1.RecordSchemaReferenceWLDef,
|
|
31
37
|
};
|
|
32
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
38
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbW9kZWxzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEscUNBQXVDO0FBQ3ZDLG1EQUFxRDtBQUNyRCwrQ0FBaUQ7QUFDakQseURBQTJEO0FBQzNELGlFQUFtRTtBQUNuRSxtRUFBcUU7QUFFckUsMkNBQXlCO0FBQ3pCLGtEQUFnQztBQUNoQyxnREFBOEI7QUFDOUIscURBQW1DO0FBQ25DLHlEQUF1QztBQUN2QywwREFBd0M7QUFFM0IsUUFBQSxXQUFXLEdBQUc7SUFDekIsTUFBTSxFQUFFLG9CQUFXO0lBQ25CLGFBQWEsRUFBRSxrQ0FBa0I7SUFDakMsV0FBVyxFQUFFLDhCQUFnQjtJQUM3QixnQkFBZ0IsRUFBRSx3Q0FBcUI7SUFDdkMsb0JBQW9CLEVBQUUsZ0RBQXlCO0lBQy9DLHFCQUFxQixFQUFFLGtEQUEwQjtDQUNsRCxDQUFDIn0=
|
|
@@ -2,7 +2,8 @@ import { Observable } from 'rxjs';
|
|
|
2
2
|
import mongodb = require('mongodb');
|
|
3
3
|
import type { Collection, Db, Document, FindCursor, FindOptions, GridFSFile } from 'mongodb';
|
|
4
4
|
import stream = require('node:stream');
|
|
5
|
-
import { Services as services, StorageManagerService as StorageManagerServiceTypes, DatastreamService, StorageService, StorageServiceResponse, DatastreamServiceResponse, Datastream, RecordAuditModel, RecordAuditParams, IntegrationAuditModel, IntegrationAuditParams, RecordModel,
|
|
5
|
+
import { Services as services, StorageManagerService as StorageManagerServiceTypes, DatastreamService, StorageService, StorageServiceResponse, StorageMutationResponse, DatastreamServiceResponse, Datastream, RecordAuditModel, RecordAuditParams, IntegrationAuditModel, IntegrationAuditParams, RecordModel, type DeletedRecordModel, type RecordFieldWriteResult, BrandingModel, UserModel, RoleModel, RecordRelationshipExpandOptions, RecordRelationshipGraph, type RecordStorageMutationOptions, type StorageServiceCapabilities } from '@researchdatabox/redbox-core';
|
|
6
|
+
import type { RecordSchemaArtifactInput, RecordSchemaArtifactModel, RecordSchemaArtifactQuery, RecordSchemaArtifactSummary, RecordSchemaAuthorizationGrantQuery, RecordSchemaReferenceInput, RecordSchemaReferenceModel, RecordSchemaReferenceQuery } from '@researchdatabox/redbox-core';
|
|
6
7
|
type JsonMap = Record<string, unknown>;
|
|
7
8
|
type StorageRecord = RecordModel;
|
|
8
9
|
type MongoRecordDocument = Document;
|
|
@@ -10,24 +11,184 @@ type DatastreamContent = {
|
|
|
10
11
|
readstream?: NodeJS.ReadableStream;
|
|
11
12
|
body?: Buffer | string;
|
|
12
13
|
} & Record<string, unknown>;
|
|
14
|
+
export declare const RECORD_SCHEMA_ARTIFACT_INDEXES: mongodb.IndexDescription[];
|
|
15
|
+
export declare const RECORD_SCHEMA_AUTHORIZATION_CURSOR_INDEX_NAME = "record_schema_reference_authorization_cursor_lookup";
|
|
16
|
+
export declare const RECORD_SCHEMA_AUTHORIZATION_CURSOR_INDEX_KEY: {
|
|
17
|
+
readonly digest: 1;
|
|
18
|
+
readonly kind: 1;
|
|
19
|
+
readonly brand: 1;
|
|
20
|
+
readonly portal: 1;
|
|
21
|
+
readonly schemaKind: 1;
|
|
22
|
+
readonly recordType: 1;
|
|
23
|
+
readonly operation: 1;
|
|
24
|
+
readonly referenceKey: 1;
|
|
25
|
+
};
|
|
26
|
+
export declare const RECORD_SCHEMA_REFERENCE_INDEXES: mongodb.IndexDescription[];
|
|
27
|
+
/**
|
|
28
|
+
* Authorization lookups fail as unavailable instead of consuming an
|
|
29
|
+
* unbounded database work budget. This is a time/availability boundary, not
|
|
30
|
+
* a result cap: a query that cannot complete is never reported as a denial.
|
|
31
|
+
*/
|
|
32
|
+
export declare const RECORD_SCHEMA_AUTHORIZATION_LOOKUP_MAX_TIME_MS = 1000;
|
|
13
33
|
export declare namespace Services {
|
|
14
34
|
class MongoStorageService extends services.Core.Service implements StorageService, DatastreamService {
|
|
15
35
|
gridFsBucket: mongodb.GridFSBucket;
|
|
16
36
|
db: Db;
|
|
17
37
|
recordCol: Collection<MongoRecordDocument>;
|
|
18
38
|
deletedRecordCol: Collection<MongoRecordDocument>;
|
|
39
|
+
recordIdentityCol: Collection<MongoRecordDocument>;
|
|
40
|
+
recordSchemaArtifactCol: Collection<MongoRecordDocument>;
|
|
41
|
+
recordSchemaReferenceCol: Collection<MongoRecordDocument>;
|
|
19
42
|
private _readyHookRegistered;
|
|
43
|
+
private _requiredIndicesReady;
|
|
44
|
+
private _initializationPromise?;
|
|
20
45
|
protected _exportedMethods: string[];
|
|
21
46
|
constructor();
|
|
22
47
|
private getUuid;
|
|
23
48
|
private getErrorMessage;
|
|
24
|
-
|
|
49
|
+
private classifyStorageInitializationError;
|
|
50
|
+
/**
|
|
51
|
+
* Resolve the native driver collection behind a Waterline model. Strict
|
|
52
|
+
* concurrency needs `findOneAndUpdate`/`findOneAndDelete` facts that
|
|
53
|
+
* Waterline cannot certify, so the compare-and-set paths talk to the
|
|
54
|
+
* driver directly. Discovery never throws: an adapter that cannot supply a
|
|
55
|
+
* native collection is simply unsupported.
|
|
56
|
+
*/
|
|
57
|
+
private getNativeCollection;
|
|
58
|
+
private getNativeRecordCollection;
|
|
59
|
+
private getNativeTombstoneCollection;
|
|
60
|
+
private getNativeRecordIdentityCollection;
|
|
61
|
+
private supportsAtomicMutation;
|
|
62
|
+
getCapabilities(): StorageServiceCapabilities;
|
|
63
|
+
private createMutationResponse;
|
|
64
|
+
private notApplied;
|
|
65
|
+
private unknownMutation;
|
|
66
|
+
/**
|
|
67
|
+
* Normalize the caller's precondition. Returning `null` means the response
|
|
68
|
+
* already carries a certified non-application: a malformed precondition is
|
|
69
|
+
* a caller defect, and answering it with a definite no-write is safer than
|
|
70
|
+
* guessing which revision was meant.
|
|
71
|
+
*/
|
|
72
|
+
private expectedRevision;
|
|
73
|
+
/**
|
|
74
|
+
* The lazy compatibility clause matches only a genuinely absent revision.
|
|
75
|
+
* An explicit null is corrupt state: `$inc` cannot advance it and must not
|
|
76
|
+
* be made to look like a safe first revision.
|
|
77
|
+
*/
|
|
78
|
+
private revisionSelector;
|
|
79
|
+
private mutationSelector;
|
|
80
|
+
private lifecycleMutationSelector;
|
|
81
|
+
private isDuplicateKeyError;
|
|
82
|
+
/**
|
|
83
|
+
* Whether the driver fact proves that `insertOne` did not commit. Local
|
|
84
|
+
* argument rejection and a server command error without retry/write-
|
|
85
|
+
* concern ambiguity are definitive. Network, selection, timeout, and
|
|
86
|
+
* write-concern failures retain the reservation for later reconciliation.
|
|
87
|
+
*/
|
|
88
|
+
private isCertifiedCreateNonApplication;
|
|
89
|
+
private storedIncarnationId;
|
|
90
|
+
/**
|
|
91
|
+
* Establish the permanent OID owner for a state that already exists. The
|
|
92
|
+
* ledger outlives active records and tombstones, so purge cannot reopen a
|
|
93
|
+
* revision-zero alias. Duplicate insertion is an ordinary concurrent
|
|
94
|
+
* winner; its durable identity is re-read and adopted.
|
|
95
|
+
*/
|
|
96
|
+
private ensureRecordIdentity;
|
|
97
|
+
/** Claim a never-before-used OID. Any durable owner or active/tombstone state is a collision. */
|
|
98
|
+
private claimNewRecordIdentity;
|
|
99
|
+
/**
|
|
100
|
+
* Compensate an ownership claim this call made but never used.
|
|
101
|
+
*
|
|
102
|
+
* The ledger is otherwise permanent, and deliberately so: a purge must not
|
|
103
|
+
* let an old revision-zero tag alias a recreated incarnation. Releasing is
|
|
104
|
+
* only safe — and only necessary — for a row that still carries the
|
|
105
|
+
* incarnation this call minted and that no active record or tombstone
|
|
106
|
+
* refers to. That is exactly the state a create leaves behind when its
|
|
107
|
+
* insert never reached the collection, and without this the caller-selected
|
|
108
|
+
* OID would be permanently unusable with no operator recovery path. While
|
|
109
|
+
* this row exists its unique index prevents another ordinary create from
|
|
110
|
+
* becoming owner; the exact incarnation selector also cannot remove a row
|
|
111
|
+
* replaced during an operator recovery race.
|
|
112
|
+
*/
|
|
113
|
+
private releaseUnusedRecordIdentity;
|
|
114
|
+
/**
|
|
115
|
+
* Interpret a `findOneAndUpdate`/`findOneAndDelete` result issued with
|
|
116
|
+
* `includeResultMetadata: false`: `null` is a certified no-match and a
|
|
117
|
+
* document is the committed state. Anything else is an unrecognized driver
|
|
118
|
+
* fact that must stay `unknown` rather than being certified either way.
|
|
119
|
+
*/
|
|
120
|
+
private mutationDocument;
|
|
121
|
+
private committed;
|
|
122
|
+
private brandIdOf;
|
|
123
|
+
private activeIdentity;
|
|
124
|
+
private tombstoneIdentity;
|
|
125
|
+
private static readonly BRAND_ID_PATHS;
|
|
126
|
+
private storedBrandId;
|
|
127
|
+
/**
|
|
128
|
+
* Reject candidate keys the driver would read as update operators or
|
|
129
|
+
* dotted paths. Waterline rejected them before the compare-and-set paths
|
|
130
|
+
* started building `$set` documents directly, and honouring them would let
|
|
131
|
+
* a candidate reach fields — such as the stored brand — that the explicit
|
|
132
|
+
* checks above deliberately guard.
|
|
133
|
+
*/
|
|
134
|
+
private unsafeCandidateField;
|
|
135
|
+
/**
|
|
136
|
+
* Read the current state behind a certified no-match so the caller can be
|
|
137
|
+
* told why nothing was written. Cross-brand state is never returned: the
|
|
138
|
+
* reason alone is bounded, and callers outside the brand map it onto the
|
|
139
|
+
* same not-found answer an absent record produces.
|
|
140
|
+
*/
|
|
141
|
+
private readCurrentState;
|
|
142
|
+
private isRequestedBrand;
|
|
143
|
+
private classifyActiveNoMatch;
|
|
144
|
+
private classifyLifecycleTombstoneNoMatch;
|
|
145
|
+
init(): Promise<void>;
|
|
25
146
|
private registerReadyHook;
|
|
26
147
|
private collectionExists;
|
|
27
148
|
private performInit;
|
|
28
149
|
private createIndices;
|
|
29
|
-
|
|
30
|
-
|
|
150
|
+
private createRecordSchemaIndices;
|
|
151
|
+
private createRequiredIndexes;
|
|
152
|
+
private recordSchemaSuccess;
|
|
153
|
+
private recordSchemaFailure;
|
|
154
|
+
private recordSchemaFailureFromError;
|
|
155
|
+
private throwRecordSchemaReadFailure;
|
|
156
|
+
private artifactCollection;
|
|
157
|
+
private referenceCollection;
|
|
158
|
+
private recordSchemaReferenceDocument;
|
|
159
|
+
private existingArtifactMatches;
|
|
160
|
+
putRecordSchemaArtifact(artifact: RecordSchemaArtifactInput): Promise<StorageServiceResponse>;
|
|
161
|
+
getRecordSchemaArtifact(digest: string): Promise<RecordSchemaArtifactModel | null>;
|
|
162
|
+
listRecordSchemaArtifacts(query: RecordSchemaArtifactQuery): Promise<RecordSchemaArtifactSummary[]>;
|
|
163
|
+
touchRecordSchemaArtifact(digest: string): Promise<StorageServiceResponse>;
|
|
164
|
+
private storeRecordSchemaReference;
|
|
165
|
+
putRecordSchemaReference(reference: RecordSchemaReferenceInput): Promise<StorageServiceResponse>;
|
|
166
|
+
private recordSchemaQueryString;
|
|
167
|
+
private recordSchemaQueryLimit;
|
|
168
|
+
findRecordSchemaGrantForAuthorization(query: RecordSchemaAuthorizationGrantQuery): Promise<RecordSchemaReferenceModel | null>;
|
|
169
|
+
listRecordSchemaReferences(query: RecordSchemaReferenceQuery): Promise<RecordSchemaReferenceModel[]>;
|
|
170
|
+
private storedRecordSchemaDate;
|
|
171
|
+
create(_brand: BrandingModel, record: JsonMap, _recordType: unknown, _user?: unknown, options?: RecordStorageMutationOptions): Promise<StorageMutationResponse>;
|
|
172
|
+
updateMeta(brand: BrandingModel | null | undefined, oid: string, record: JsonMap, user?: UserModel, options?: RecordStorageMutationOptions): Promise<StorageMutationResponse>;
|
|
173
|
+
/**
|
|
174
|
+
* Dispatch one atomic conditional mutation and turn its single driver fact
|
|
175
|
+
* into a mutation response.
|
|
176
|
+
*
|
|
177
|
+
* The three outcomes are deliberately distinct: a returned document is an
|
|
178
|
+
* applied commit, `null` certifies that the selector matched nothing and
|
|
179
|
+
* therefore that no write happened, and anything else — including a throw
|
|
180
|
+
* after dispatch — stays `unknown`. A failed follow-up classification only
|
|
181
|
+
* costs the precise reason; it never turns a certified no-match into a
|
|
182
|
+
* write, and it never issues one.
|
|
183
|
+
*/
|
|
184
|
+
private commitConditionalMutation;
|
|
185
|
+
removeActiveRecord(brand: BrandingModel | null | undefined, oid: string, options?: RecordStorageMutationOptions): Promise<StorageMutationResponse>;
|
|
186
|
+
createTombstone(brand: BrandingModel | null | undefined, oid: string, record: JsonMap, options?: RecordStorageMutationOptions): Promise<StorageMutationResponse>;
|
|
187
|
+
updateTombstone(brand: BrandingModel | null | undefined, oid: string, record: JsonMap, options?: RecordStorageMutationOptions): Promise<StorageMutationResponse>;
|
|
188
|
+
removeTombstone(brand: BrandingModel | null | undefined, oid: string, options?: RecordStorageMutationOptions): Promise<StorageMutationResponse>;
|
|
189
|
+
createActiveRecordFromTombstone(brand: BrandingModel | null | undefined, oid: string, record: JsonMap, options?: RecordStorageMutationOptions): Promise<StorageMutationResponse>;
|
|
190
|
+
getTombstone(brand: BrandingModel | null | undefined, oid: string): Promise<DeletedRecordModel | null>;
|
|
191
|
+
getLifecycleTombstones(states: readonly string[], limit?: number): Promise<DeletedRecordModel[]>;
|
|
31
192
|
scanFigshareRecords(afterOid: string, limit: number): Promise<RecordModel[]>;
|
|
32
193
|
findFigshareArticleRecords(path: string, articleId: string): Promise<RecordModel[]>;
|
|
33
194
|
setRecordFields(oid: string, fields: JsonMap, expectedVersion: number, allowedPaths: string[]): Promise<RecordFieldWriteResult>;
|
|
@@ -38,8 +199,8 @@ export declare namespace Services {
|
|
|
38
199
|
acknowledgeFigshareIntent(oid: string, generation: number): Promise<boolean>;
|
|
39
200
|
getMeta(oid: string): Promise<RecordModel>;
|
|
40
201
|
getDeletedRecordMeta(oid: string): Promise<RecordModel | null>;
|
|
41
|
-
createBatch(type: string, data: JsonMap[], harvestIdFldName: string): Promise<
|
|
42
|
-
provideUserAccessAndRemovePendingAccess(oid:
|
|
202
|
+
createBatch(type: string, data: JsonMap[], harvestIdFldName: string): Promise<StorageMutationResponse>;
|
|
203
|
+
provideUserAccessAndRemovePendingAccess(oid: string, _userid: unknown, _pendingValue: unknown): Promise<StorageMutationResponse>;
|
|
43
204
|
getRelatedRecords(oid: string, brand: BrandingModel, options?: RecordRelationshipExpandOptions): Promise<RecordRelationshipGraph>;
|
|
44
205
|
private walkRelatedRecords;
|
|
45
206
|
private addRelatedObject;
|
|
@@ -47,12 +208,12 @@ export declare namespace Services {
|
|
|
47
208
|
private buildRelationshipCriteria;
|
|
48
209
|
private findRelatedRecords;
|
|
49
210
|
private buildRelationshipEdge;
|
|
50
|
-
delete(oid: string,
|
|
211
|
+
delete(oid: string, _permanentlyDelete?: boolean, options?: RecordStorageMutationOptions): Promise<StorageServiceResponse>;
|
|
51
212
|
updateNotificationLog(oid: string, record: JsonMap, options: JsonMap): Promise<unknown>;
|
|
52
213
|
private getSortDirection;
|
|
53
214
|
private getRecordSort;
|
|
54
|
-
getDeletedRecords(workflowState: string, recordType: any, start: number, rows: number, username: string, roles: RoleModel[], brand: BrandingModel, _editAccessOnly?: any, packageType?: any, sort?: any, filterFields?: any, filterString?: any, filterMode?: string, secondarySort?: any): Promise<StorageServiceResponse
|
|
55
|
-
getRecords(workflowState: string, recordType: string, start: number, rows: number, username: string, roles: RoleModel[], brand: BrandingModel, _editAccessOnly?: any, packageType?: any, sort?: any, filterFields?: any, filterString?: any, filterMode?: any, secondarySort?: any): Promise<StorageServiceResponse
|
|
215
|
+
getDeletedRecords(workflowState: string, recordType: any, start: number, rows: number, username: string, roles: RoleModel[], brand: BrandingModel, _editAccessOnly?: any, packageType?: any, sort?: any, filterFields?: any, filterString?: any, filterMode?: string, secondarySort?: any): Promise<StorageServiceResponse<unknown>>;
|
|
216
|
+
getRecords(workflowState: string, recordType: string, start: number, rows: number, username: string, roles: RoleModel[], brand: BrandingModel, _editAccessOnly?: any, packageType?: any, sort?: any, filterFields?: any, filterString?: any, filterMode?: any, secondarySort?: any): Promise<StorageServiceResponse<unknown>>;
|
|
56
217
|
private escapeRegExp;
|
|
57
218
|
protected runRecordQuery(colName: any, query: any, options: any): Promise<{
|
|
58
219
|
items: mongodb.WithId<mongodb.BSON.Document>[];
|
|
@@ -69,6 +230,7 @@ export declare namespace Services {
|
|
|
69
230
|
addDatastreams(oid: string, fileIds: Datastream[]): Promise<DatastreamServiceResponse>;
|
|
70
231
|
updateDatastream(oid: string, record: StorageRecord, newMetadata: JsonMap, fileRoot: string | StorageManagerServiceTypes.Services.IDisk | null, fileIdsAdded: Datastream[]): Observable<Promise<unknown>[]>;
|
|
71
232
|
removeDatastream(oid: any, datastream: Datastream): Promise<void>;
|
|
233
|
+
removeStagedDatastream(fileId: string): Promise<void>;
|
|
72
234
|
addDatastream(oid: any, datastream: Datastream, stagingDisk?: StorageManagerServiceTypes.Services.IDisk): Promise<void>;
|
|
73
235
|
private streamFileToBucket;
|
|
74
236
|
addAndRemoveDatastreams(oid: any, addIds: Datastream[], removeIds: Datastream[], stagingDisk?: StorageManagerServiceTypes.Services.IDisk): Promise<void>;
|
|
@@ -76,6 +238,7 @@ export declare namespace Services {
|
|
|
76
238
|
private getDatastreamAsync;
|
|
77
239
|
listDatastreams(oid: string, fileId?: string | null): Promise<Record<string, unknown>[]>;
|
|
78
240
|
private toJsonSafe;
|
|
241
|
+
private sanitizeRecordHookExecutionSummary;
|
|
79
242
|
private sanitizeRecordAudit;
|
|
80
243
|
private sanitizeIntegrationAudit;
|
|
81
244
|
createRecordAudit(recordAudit: RecordAuditModel): Promise<StorageServiceResponse>;
|
|
@@ -84,8 +247,8 @@ export declare namespace Services {
|
|
|
84
247
|
private buildIntegrationAuditStartedAtCriteria;
|
|
85
248
|
getIntegrationAudit(params: IntegrationAuditParams): Promise<unknown>;
|
|
86
249
|
countIntegrationAudit(params: IntegrationAuditParams): Promise<number>;
|
|
87
|
-
restoreRecord(oid: string): Promise<StorageServiceResponse>;
|
|
88
|
-
destroyDeletedRecord(oid: string): Promise<StorageServiceResponse>;
|
|
250
|
+
restoreRecord(oid: string, options?: RecordStorageMutationOptions): Promise<StorageServiceResponse>;
|
|
251
|
+
destroyDeletedRecord(oid: string, options?: RecordStorageMutationOptions): Promise<StorageServiceResponse>;
|
|
89
252
|
protected getFileWithName(fileName: string, options?: FindOptions): FindCursor<GridFSFile>;
|
|
90
253
|
exists(oid: string): Promise<boolean>;
|
|
91
254
|
}
|