@strapi/data-transfer 5.12.1 → 5.12.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/dist/engine/errors.js +39 -0
- package/dist/engine/errors.js.map +1 -0
- package/dist/engine/errors.mjs +34 -0
- package/dist/engine/errors.mjs.map +1 -0
- package/dist/engine/index.js +797 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/index.mjs +792 -0
- package/dist/engine/index.mjs.map +1 -0
- package/dist/engine/validation/provider.js +19 -0
- package/dist/engine/validation/provider.js.map +1 -0
- package/dist/engine/validation/provider.mjs +17 -0
- package/dist/engine/validation/provider.mjs.map +1 -0
- package/dist/engine/validation/schemas/index.js +57 -0
- package/dist/engine/validation/schemas/index.js.map +1 -0
- package/dist/engine/validation/schemas/index.mjs +55 -0
- package/dist/engine/validation/schemas/index.mjs.map +1 -0
- package/dist/errors/base.js +13 -0
- package/dist/errors/base.js.map +1 -0
- package/dist/errors/base.mjs +11 -0
- package/dist/errors/base.mjs.map +1 -0
- package/dist/errors/constants.js +10 -0
- package/dist/errors/constants.js.map +1 -0
- package/dist/errors/constants.mjs +8 -0
- package/dist/errors/constants.mjs.map +1 -0
- package/dist/errors/providers.js +41 -0
- package/dist/errors/providers.js.map +1 -0
- package/dist/errors/providers.mjs +36 -0
- package/dist/errors/providers.mjs.map +1 -0
- package/dist/file/index.js +8 -0
- package/dist/file/index.js.map +1 -0
- package/dist/file/index.mjs +3 -0
- package/dist/file/index.mjs.map +1 -0
- package/dist/file/providers/destination/index.js +248 -0
- package/dist/file/providers/destination/index.js.map +1 -0
- package/dist/file/providers/destination/index.mjs +246 -0
- package/dist/file/providers/destination/index.mjs.map +1 -0
- package/dist/file/providers/destination/utils.js +63 -0
- package/dist/file/providers/destination/utils.js.map +1 -0
- package/dist/file/providers/destination/utils.mjs +60 -0
- package/dist/file/providers/destination/utils.mjs.map +1 -0
- package/dist/file/providers/index.js +10 -0
- package/dist/file/providers/index.js.map +1 -0
- package/dist/file/providers/index.mjs +3 -0
- package/dist/file/providers/index.mjs.map +1 -0
- package/dist/file/providers/source/index.js +288 -0
- package/dist/file/providers/source/index.js.map +1 -0
- package/dist/file/providers/source/index.mjs +286 -0
- package/dist/file/providers/source/index.mjs.map +1 -0
- package/dist/file/providers/source/utils.js +56 -0
- package/dist/file/providers/source/utils.js.map +1 -0
- package/dist/file/providers/source/utils.mjs +52 -0
- package/dist/file/providers/source/utils.mjs.map +1 -0
- package/dist/index.js +8 -5692
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -5674
- package/dist/index.mjs.map +1 -1
- package/dist/strapi/index.js +12 -0
- package/dist/strapi/index.js.map +1 -0
- package/dist/strapi/index.mjs +7 -0
- package/dist/strapi/index.mjs.map +1 -0
- package/dist/strapi/providers/index.js +16 -0
- package/dist/strapi/providers/index.js.map +1 -0
- package/dist/strapi/providers/index.mjs +7 -0
- package/dist/strapi/providers/index.mjs.map +1 -0
- package/dist/strapi/providers/local-destination/index.js +419 -0
- package/dist/strapi/providers/local-destination/index.js.map +1 -0
- package/dist/strapi/providers/local-destination/index.mjs +396 -0
- package/dist/strapi/providers/local-destination/index.mjs.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/configuration.js +52 -0
- package/dist/strapi/providers/local-destination/strategies/restore/configuration.js.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/configuration.mjs +49 -0
- package/dist/strapi/providers/local-destination/strategies/restore/configuration.mjs.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/entities.js +64 -0
- package/dist/strapi/providers/local-destination/strategies/restore/entities.js.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/entities.mjs +62 -0
- package/dist/strapi/providers/local-destination/strategies/restore/entities.mjs.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/index.js +126 -0
- package/dist/strapi/providers/local-destination/strategies/restore/index.js.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/index.mjs +122 -0
- package/dist/strapi/providers/local-destination/strategies/restore/index.mjs.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/links.js +60 -0
- package/dist/strapi/providers/local-destination/strategies/restore/links.js.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/links.mjs +58 -0
- package/dist/strapi/providers/local-destination/strategies/restore/links.mjs.map +1 -0
- package/dist/strapi/providers/local-source/assets.js +123 -0
- package/dist/strapi/providers/local-source/assets.js.map +1 -0
- package/dist/strapi/providers/local-source/assets.mjs +121 -0
- package/dist/strapi/providers/local-source/assets.mjs.map +1 -0
- package/dist/strapi/providers/local-source/configuration.js +39 -0
- package/dist/strapi/providers/local-source/configuration.js.map +1 -0
- package/dist/strapi/providers/local-source/configuration.mjs +37 -0
- package/dist/strapi/providers/local-source/configuration.mjs.map +1 -0
- package/dist/strapi/providers/local-source/entities.js +62 -0
- package/dist/strapi/providers/local-source/entities.js.map +1 -0
- package/dist/strapi/providers/local-source/entities.mjs +59 -0
- package/dist/strapi/providers/local-source/entities.mjs.map +1 -0
- package/dist/strapi/providers/local-source/index.js +154 -0
- package/dist/strapi/providers/local-source/index.js.map +1 -0
- package/dist/strapi/providers/local-source/index.mjs +152 -0
- package/dist/strapi/providers/local-source/index.mjs.map +1 -0
- package/dist/strapi/providers/local-source/links.js +26 -0
- package/dist/strapi/providers/local-source/links.js.map +1 -0
- package/dist/strapi/providers/local-source/links.mjs +24 -0
- package/dist/strapi/providers/local-source/links.mjs.map +1 -0
- package/dist/strapi/providers/remote-destination/index.js +392 -0
- package/dist/strapi/providers/remote-destination/index.js.map +1 -0
- package/dist/strapi/providers/remote-destination/index.mjs +390 -0
- package/dist/strapi/providers/remote-destination/index.mjs.map +1 -0
- package/dist/strapi/providers/remote-source/index.js +405 -0
- package/dist/strapi/providers/remote-source/index.js.map +1 -0
- package/dist/strapi/providers/remote-source/index.mjs +403 -0
- package/dist/strapi/providers/remote-source/index.mjs.map +1 -0
- package/dist/strapi/providers/utils.js +173 -0
- package/dist/strapi/providers/utils.js.map +1 -0
- package/dist/strapi/providers/utils.mjs +169 -0
- package/dist/strapi/providers/utils.mjs.map +1 -0
- package/dist/strapi/queries/entity.js +125 -0
- package/dist/strapi/queries/entity.js.map +1 -0
- package/dist/strapi/queries/entity.mjs +123 -0
- package/dist/strapi/queries/entity.mjs.map +1 -0
- package/dist/strapi/queries/index.js +10 -0
- package/dist/strapi/queries/index.js.map +1 -0
- package/dist/strapi/queries/index.mjs +5 -0
- package/dist/strapi/queries/index.mjs.map +1 -0
- package/dist/strapi/queries/link.js +298 -0
- package/dist/strapi/queries/link.js.map +1 -0
- package/dist/strapi/queries/link.mjs +295 -0
- package/dist/strapi/queries/link.mjs.map +1 -0
- package/dist/strapi/remote/constants.js +11 -0
- package/dist/strapi/remote/constants.js.map +1 -0
- package/dist/strapi/remote/constants.mjs +8 -0
- package/dist/strapi/remote/constants.mjs.map +1 -0
- package/dist/strapi/remote/flows/default.js +43 -0
- package/dist/strapi/remote/flows/default.js.map +1 -0
- package/dist/strapi/remote/flows/default.mjs +41 -0
- package/dist/strapi/remote/flows/default.mjs.map +1 -0
- package/dist/strapi/remote/flows/index.js +54 -0
- package/dist/strapi/remote/flows/index.js.map +1 -0
- package/dist/strapi/remote/flows/index.mjs +52 -0
- package/dist/strapi/remote/flows/index.mjs.map +1 -0
- package/dist/strapi/remote/handlers/constants.js +10 -0
- package/dist/strapi/remote/handlers/constants.js.map +1 -0
- package/dist/strapi/remote/handlers/constants.mjs +8 -0
- package/dist/strapi/remote/handlers/constants.mjs.map +1 -0
- package/dist/strapi/remote/handlers/index.js +12 -0
- package/dist/strapi/remote/handlers/index.js.map +1 -0
- package/dist/strapi/remote/handlers/index.mjs +4 -0
- package/dist/strapi/remote/handlers/index.mjs.map +1 -0
- package/dist/strapi/remote/handlers/pull.js +348 -0
- package/dist/strapi/remote/handlers/pull.js.map +1 -0
- package/dist/strapi/remote/handlers/pull.mjs +346 -0
- package/dist/strapi/remote/handlers/pull.mjs.map +1 -0
- package/dist/strapi/remote/handlers/push.js +400 -0
- package/dist/strapi/remote/handlers/push.js.map +1 -0
- package/dist/strapi/remote/handlers/push.mjs +398 -0
- package/dist/strapi/remote/handlers/push.mjs.map +1 -0
- package/dist/strapi/remote/handlers/utils.js +316 -0
- package/dist/strapi/remote/handlers/utils.js.map +1 -0
- package/dist/strapi/remote/handlers/utils.mjs +310 -0
- package/dist/strapi/remote/handlers/utils.mjs.map +1 -0
- package/dist/strapi/remote/index.js +10 -0
- package/dist/strapi/remote/index.js.map +1 -0
- package/dist/strapi/remote/index.mjs +5 -0
- package/dist/strapi/remote/index.mjs.map +1 -0
- package/dist/utils/components.js +178 -0
- package/dist/utils/components.js.map +1 -0
- package/dist/utils/components.mjs +171 -0
- package/dist/utils/components.mjs.map +1 -0
- package/dist/utils/diagnostic.js +51 -0
- package/dist/utils/diagnostic.js.map +1 -0
- package/dist/utils/diagnostic.mjs +49 -0
- package/dist/utils/diagnostic.mjs.map +1 -0
- package/dist/utils/encryption/decrypt.js +47 -0
- package/dist/utils/encryption/decrypt.js.map +1 -0
- package/dist/utils/encryption/decrypt.mjs +45 -0
- package/dist/utils/encryption/decrypt.mjs.map +1 -0
- package/dist/utils/encryption/encrypt.js +47 -0
- package/dist/utils/encryption/encrypt.js.map +1 -0
- package/dist/utils/encryption/encrypt.mjs +45 -0
- package/dist/utils/encryption/encrypt.mjs.map +1 -0
- package/dist/utils/encryption/index.js +10 -0
- package/dist/utils/encryption/index.js.map +1 -0
- package/dist/utils/encryption/index.mjs +3 -0
- package/dist/utils/encryption/index.mjs.map +1 -0
- package/dist/utils/index.js +20 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +15 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/utils/json.js +96 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/json.mjs +94 -0
- package/dist/utils/json.mjs.map +1 -0
- package/dist/utils/middleware.js +14 -0
- package/dist/utils/middleware.js.map +1 -0
- package/dist/utils/middleware.mjs +12 -0
- package/dist/utils/middleware.mjs.map +1 -0
- package/dist/utils/providers.js +12 -0
- package/dist/utils/providers.js.map +1 -0
- package/dist/utils/providers.mjs +10 -0
- package/dist/utils/providers.mjs.map +1 -0
- package/dist/utils/schema.js +32 -0
- package/dist/utils/schema.js.map +1 -0
- package/dist/utils/schema.mjs +29 -0
- package/dist/utils/schema.mjs.map +1 -0
- package/dist/utils/stream.js +59 -0
- package/dist/utils/stream.js.map +1 -0
- package/dist/utils/stream.mjs +55 -0
- package/dist/utils/stream.mjs.map +1 -0
- package/dist/utils/transaction.js +93 -0
- package/dist/utils/transaction.js.map +1 -0
- package/dist/utils/transaction.mjs +91 -0
- package/dist/utils/transaction.mjs.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import zip from 'zlib';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { PassThrough, pipeline } from 'stream';
|
|
4
|
+
import fse__default from 'fs-extra';
|
|
5
|
+
import tar from 'tar';
|
|
6
|
+
import { isEmpty, keyBy } from 'lodash/fp';
|
|
7
|
+
import { chain } from 'stream-chain';
|
|
8
|
+
import { parser } from 'stream-json/jsonl/Parser';
|
|
9
|
+
import 'crypto';
|
|
10
|
+
import { createDecryptionCipher } from '../../../utils/encryption/decrypt.mjs';
|
|
11
|
+
import { collect } from '../../../utils/stream.mjs';
|
|
12
|
+
import { schemasToValidJSON } from '../../../utils/schema.mjs';
|
|
13
|
+
import 'events';
|
|
14
|
+
import { ProviderInitializationError, ProviderTransferError } from '../../../errors/providers.mjs';
|
|
15
|
+
import { isFilePathInDirname, unknownPathToPosix, isPathEquivalent } from './utils.mjs';
|
|
16
|
+
|
|
17
|
+
function _class_private_field_loose_base(receiver, privateKey) {
|
|
18
|
+
if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {
|
|
19
|
+
throw new TypeError("attempted to use private field on non-instance");
|
|
20
|
+
}
|
|
21
|
+
return receiver;
|
|
22
|
+
}
|
|
23
|
+
var id = 0;
|
|
24
|
+
function _class_private_field_loose_key(name) {
|
|
25
|
+
return "__private_" + id++ + "_" + name;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Constant for the metadata file path
|
|
29
|
+
*/ const METADATA_FILE_PATH = 'metadata.json';
|
|
30
|
+
const createLocalFileSourceProvider = (options)=>{
|
|
31
|
+
return new LocalFileSourceProvider(options);
|
|
32
|
+
};
|
|
33
|
+
var _metadata = /*#__PURE__*/ _class_private_field_loose_key("_metadata"), _diagnostics = /*#__PURE__*/ _class_private_field_loose_key("_diagnostics"), _reportInfo = /*#__PURE__*/ _class_private_field_loose_key("_reportInfo"), _loadMetadata = /*#__PURE__*/ _class_private_field_loose_key("_loadMetadata"), _loadAssetMetadata = /*#__PURE__*/ _class_private_field_loose_key("_loadAssetMetadata"), _getBackupStream = /*#__PURE__*/ _class_private_field_loose_key("_getBackupStream"), // `directory` must be posix formatted path
|
|
34
|
+
_streamJsonlDirectory = /*#__PURE__*/ _class_private_field_loose_key("_streamJsonlDirectory"), _parseJSONFile = /*#__PURE__*/ _class_private_field_loose_key("_parseJSONFile");
|
|
35
|
+
class LocalFileSourceProvider {
|
|
36
|
+
/**
|
|
37
|
+
* Pre flight checks regarding the provided options, making sure that the file can be opened (decrypted, decompressed), etc.
|
|
38
|
+
*/ async bootstrap(diagnostics) {
|
|
39
|
+
_class_private_field_loose_base(this, _diagnostics)[_diagnostics] = diagnostics;
|
|
40
|
+
const { path: filePath } = this.options.file;
|
|
41
|
+
try {
|
|
42
|
+
// Read the metadata to ensure the file can be parsed
|
|
43
|
+
await _class_private_field_loose_base(this, _loadMetadata)[_loadMetadata]();
|
|
44
|
+
// TODO: we might also need to read the schema.jsonl files & implements a custom stream-check
|
|
45
|
+
} catch (e) {
|
|
46
|
+
if (this.options?.encryption?.enabled) {
|
|
47
|
+
throw new ProviderInitializationError(`Key is incorrect or the file '${filePath}' is not a valid Strapi data file.`);
|
|
48
|
+
}
|
|
49
|
+
throw new ProviderInitializationError(`File '${filePath}' is not a valid Strapi data file.`);
|
|
50
|
+
}
|
|
51
|
+
if (!_class_private_field_loose_base(this, _metadata)[_metadata]) {
|
|
52
|
+
throw new ProviderInitializationError('Could not load metadata from Strapi data file.');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async getMetadata() {
|
|
56
|
+
_class_private_field_loose_base(this, _reportInfo)[_reportInfo]('getting metadata');
|
|
57
|
+
if (!_class_private_field_loose_base(this, _metadata)[_metadata]) {
|
|
58
|
+
await _class_private_field_loose_base(this, _loadMetadata)[_loadMetadata]();
|
|
59
|
+
}
|
|
60
|
+
return _class_private_field_loose_base(this, _metadata)[_metadata] ?? null;
|
|
61
|
+
}
|
|
62
|
+
async getSchemas() {
|
|
63
|
+
_class_private_field_loose_base(this, _reportInfo)[_reportInfo]('getting schemas');
|
|
64
|
+
const schemaCollection = await collect(this.createSchemasReadStream());
|
|
65
|
+
if (isEmpty(schemaCollection)) {
|
|
66
|
+
throw new ProviderInitializationError('Could not load schemas from Strapi data file.');
|
|
67
|
+
}
|
|
68
|
+
// Group schema by UID
|
|
69
|
+
const schemas = keyBy('uid', schemaCollection);
|
|
70
|
+
// Transform to valid JSON
|
|
71
|
+
return schemasToValidJSON(schemas);
|
|
72
|
+
}
|
|
73
|
+
createEntitiesReadStream() {
|
|
74
|
+
_class_private_field_loose_base(this, _reportInfo)[_reportInfo]('creating entities read stream');
|
|
75
|
+
return _class_private_field_loose_base(this, _streamJsonlDirectory)[_streamJsonlDirectory]('entities');
|
|
76
|
+
}
|
|
77
|
+
createSchemasReadStream() {
|
|
78
|
+
_class_private_field_loose_base(this, _reportInfo)[_reportInfo]('creating schemas read stream');
|
|
79
|
+
return _class_private_field_loose_base(this, _streamJsonlDirectory)[_streamJsonlDirectory]('schemas');
|
|
80
|
+
}
|
|
81
|
+
createLinksReadStream() {
|
|
82
|
+
_class_private_field_loose_base(this, _reportInfo)[_reportInfo]('creating links read stream');
|
|
83
|
+
return _class_private_field_loose_base(this, _streamJsonlDirectory)[_streamJsonlDirectory]('links');
|
|
84
|
+
}
|
|
85
|
+
createConfigurationReadStream() {
|
|
86
|
+
_class_private_field_loose_base(this, _reportInfo)[_reportInfo]('creating configuration read stream');
|
|
87
|
+
// NOTE: TBD
|
|
88
|
+
return _class_private_field_loose_base(this, _streamJsonlDirectory)[_streamJsonlDirectory]('configuration');
|
|
89
|
+
}
|
|
90
|
+
createAssetsReadStream() {
|
|
91
|
+
const inStream = _class_private_field_loose_base(this, _getBackupStream)[_getBackupStream]();
|
|
92
|
+
const outStream = new PassThrough({
|
|
93
|
+
objectMode: true
|
|
94
|
+
});
|
|
95
|
+
const loadAssetMetadata = _class_private_field_loose_base(this, _loadAssetMetadata)[_loadAssetMetadata].bind(this);
|
|
96
|
+
_class_private_field_loose_base(this, _reportInfo)[_reportInfo]('creating assets read stream');
|
|
97
|
+
pipeline([
|
|
98
|
+
inStream,
|
|
99
|
+
new tar.Parse({
|
|
100
|
+
// find only files in the assets/uploads folder
|
|
101
|
+
filter (filePath, entry) {
|
|
102
|
+
if (entry.type !== 'File') {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
return isFilePathInDirname('assets/uploads', filePath);
|
|
106
|
+
},
|
|
107
|
+
async onentry (entry) {
|
|
108
|
+
const { path: filePath, size = 0 } = entry;
|
|
109
|
+
const normalizedPath = unknownPathToPosix(filePath);
|
|
110
|
+
const file = path.basename(normalizedPath);
|
|
111
|
+
let metadata;
|
|
112
|
+
try {
|
|
113
|
+
metadata = await loadAssetMetadata(`assets/metadata/${file}.json`);
|
|
114
|
+
} catch (error) {
|
|
115
|
+
throw new Error(`Failed to read metadata for ${file}`);
|
|
116
|
+
}
|
|
117
|
+
const asset = {
|
|
118
|
+
metadata,
|
|
119
|
+
filename: file,
|
|
120
|
+
filepath: normalizedPath,
|
|
121
|
+
stats: {
|
|
122
|
+
size
|
|
123
|
+
},
|
|
124
|
+
stream: entry
|
|
125
|
+
};
|
|
126
|
+
outStream.write(asset);
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
], ()=>outStream.end());
|
|
130
|
+
return outStream;
|
|
131
|
+
}
|
|
132
|
+
constructor(options){
|
|
133
|
+
Object.defineProperty(this, _reportInfo, {
|
|
134
|
+
value: reportInfo
|
|
135
|
+
});
|
|
136
|
+
Object.defineProperty(this, _loadMetadata, {
|
|
137
|
+
value: loadMetadata
|
|
138
|
+
});
|
|
139
|
+
Object.defineProperty(this, _loadAssetMetadata, {
|
|
140
|
+
value: loadAssetMetadata
|
|
141
|
+
});
|
|
142
|
+
Object.defineProperty(this, _getBackupStream, {
|
|
143
|
+
value: getBackupStream
|
|
144
|
+
});
|
|
145
|
+
Object.defineProperty(this, _streamJsonlDirectory, {
|
|
146
|
+
value: streamJsonlDirectory
|
|
147
|
+
});
|
|
148
|
+
// For collecting an entire JSON file then parsing it, not for streaming JSONL
|
|
149
|
+
Object.defineProperty(this, _parseJSONFile, {
|
|
150
|
+
value: parseJSONFile
|
|
151
|
+
});
|
|
152
|
+
Object.defineProperty(this, _metadata, {
|
|
153
|
+
writable: true,
|
|
154
|
+
value: void 0
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(this, _diagnostics, {
|
|
157
|
+
writable: true,
|
|
158
|
+
value: void 0
|
|
159
|
+
});
|
|
160
|
+
this.type = 'source';
|
|
161
|
+
this.name = 'source::local-file';
|
|
162
|
+
this.options = options;
|
|
163
|
+
const { encryption } = this.options;
|
|
164
|
+
if (encryption.enabled && encryption.key === undefined) {
|
|
165
|
+
throw new Error('Missing encryption key');
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function reportInfo(message) {
|
|
170
|
+
_class_private_field_loose_base(this, _diagnostics)[_diagnostics]?.report({
|
|
171
|
+
details: {
|
|
172
|
+
createdAt: new Date(),
|
|
173
|
+
message,
|
|
174
|
+
origin: 'file-source-provider'
|
|
175
|
+
},
|
|
176
|
+
kind: 'info'
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
async function loadMetadata() {
|
|
180
|
+
const backupStream = _class_private_field_loose_base(this, _getBackupStream)[_getBackupStream]();
|
|
181
|
+
_class_private_field_loose_base(this, _metadata)[_metadata] = await _class_private_field_loose_base(this, _parseJSONFile)[_parseJSONFile](backupStream, METADATA_FILE_PATH);
|
|
182
|
+
}
|
|
183
|
+
async function loadAssetMetadata(path) {
|
|
184
|
+
const backupStream = _class_private_field_loose_base(this, _getBackupStream)[_getBackupStream]();
|
|
185
|
+
return _class_private_field_loose_base(this, _parseJSONFile)[_parseJSONFile](backupStream, path);
|
|
186
|
+
}
|
|
187
|
+
function getBackupStream() {
|
|
188
|
+
const { file, encryption, compression } = this.options;
|
|
189
|
+
const streams = [];
|
|
190
|
+
try {
|
|
191
|
+
streams.push(fse__default.createReadStream(file.path));
|
|
192
|
+
} catch (e) {
|
|
193
|
+
throw new Error(`Could not read backup file path provided at "${this.options.file.path}"`);
|
|
194
|
+
}
|
|
195
|
+
if (encryption.enabled && encryption.key) {
|
|
196
|
+
streams.push(createDecryptionCipher(encryption.key));
|
|
197
|
+
}
|
|
198
|
+
if (compression.enabled) {
|
|
199
|
+
streams.push(zip.createGunzip());
|
|
200
|
+
}
|
|
201
|
+
return chain(streams);
|
|
202
|
+
}
|
|
203
|
+
function streamJsonlDirectory(directory) {
|
|
204
|
+
const inStream = _class_private_field_loose_base(this, _getBackupStream)[_getBackupStream]();
|
|
205
|
+
const outStream = new PassThrough({
|
|
206
|
+
objectMode: true
|
|
207
|
+
});
|
|
208
|
+
pipeline([
|
|
209
|
+
inStream,
|
|
210
|
+
new tar.Parse({
|
|
211
|
+
filter (filePath, entry) {
|
|
212
|
+
if (entry.type !== 'File') {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
return isFilePathInDirname(directory, filePath);
|
|
216
|
+
},
|
|
217
|
+
async onentry (entry) {
|
|
218
|
+
const transforms = [
|
|
219
|
+
// JSONL parser to read the data chunks one by one (line by line)
|
|
220
|
+
parser({
|
|
221
|
+
checkErrors: true
|
|
222
|
+
}),
|
|
223
|
+
// The JSONL parser returns each line as key/value
|
|
224
|
+
(line)=>line.value
|
|
225
|
+
];
|
|
226
|
+
const stream = entry.pipe(chain(transforms));
|
|
227
|
+
try {
|
|
228
|
+
for await (const chunk of stream){
|
|
229
|
+
outStream.write(chunk);
|
|
230
|
+
}
|
|
231
|
+
} catch (e) {
|
|
232
|
+
outStream.destroy(new ProviderTransferError(`Error parsing backup files from backup file ${entry.path}: ${e.message}`, {
|
|
233
|
+
details: {
|
|
234
|
+
error: e
|
|
235
|
+
}
|
|
236
|
+
}));
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
})
|
|
240
|
+
], async ()=>{
|
|
241
|
+
// Manually send the 'end' event to the out stream
|
|
242
|
+
// once every entry has finished streaming its content
|
|
243
|
+
outStream.end();
|
|
244
|
+
});
|
|
245
|
+
return outStream;
|
|
246
|
+
}
|
|
247
|
+
async function parseJSONFile(fileStream, filePath) {
|
|
248
|
+
return new Promise((resolve, reject)=>{
|
|
249
|
+
pipeline([
|
|
250
|
+
fileStream,
|
|
251
|
+
// Custom backup archive parsing
|
|
252
|
+
new tar.Parse({
|
|
253
|
+
/**
|
|
254
|
+
* Filter the parsed entries to only keep the one that matches the given filepath
|
|
255
|
+
*/ filter (entryPath, entry) {
|
|
256
|
+
if (entry.type !== 'File') {
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
return isPathEquivalent(entryPath, filePath);
|
|
260
|
+
},
|
|
261
|
+
async onentry (entry) {
|
|
262
|
+
// Collect all the content of the entry file
|
|
263
|
+
const content = await entry.collect();
|
|
264
|
+
try {
|
|
265
|
+
// Parse from buffer array to string to JSON
|
|
266
|
+
const parsedContent = JSON.parse(Buffer.concat(content).toString());
|
|
267
|
+
// Resolve the Promise with the parsed content
|
|
268
|
+
resolve(parsedContent);
|
|
269
|
+
} catch (e) {
|
|
270
|
+
reject(e);
|
|
271
|
+
} finally{
|
|
272
|
+
// Cleanup (close the stream associated to the entry)
|
|
273
|
+
entry.destroy();
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
})
|
|
277
|
+
], ()=>{
|
|
278
|
+
// If the promise hasn't been resolved and we've parsed all
|
|
279
|
+
// the archive entries, then the file doesn't exist
|
|
280
|
+
reject(new Error(`File "${filePath}" not found`));
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export { createLocalFileSourceProvider };
|
|
286
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/file/providers/source/index.ts"],"sourcesContent":["import type { Readable } from 'stream';\n\nimport zip from 'zlib';\nimport path from 'path';\nimport { pipeline, PassThrough } from 'stream';\nimport fs from 'fs-extra';\nimport tar from 'tar';\nimport { isEmpty, keyBy } from 'lodash/fp';\nimport { chain } from 'stream-chain';\nimport { parser } from 'stream-json/jsonl/Parser';\nimport type { Struct } from '@strapi/types';\n\nimport type { IAsset, IMetadata, ISourceProvider, ProviderType, IFile } from '../../../../types';\nimport type { IDiagnosticReporter } from '../../../utils/diagnostic';\n\nimport * as utils from '../../../utils';\nimport { ProviderInitializationError, ProviderTransferError } from '../../../errors/providers';\nimport { isFilePathInDirname, isPathEquivalent, unknownPathToPosix } from './utils';\n\ntype StreamItemArray = Parameters<typeof chain>[0];\n\n/**\n * Constant for the metadata file path\n */\nconst METADATA_FILE_PATH = 'metadata.json';\n\n/**\n * Provider options\n */\nexport interface ILocalFileSourceProviderOptions {\n file: {\n path: string; // the file to load\n };\n\n encryption: {\n enabled: boolean; // if the file is encrypted (and should be decrypted)\n key?: string; // the key to decrypt the file\n };\n\n compression: {\n enabled: boolean; // if the file is compressed (and should be decompressed)\n };\n}\n\nexport const createLocalFileSourceProvider = (options: ILocalFileSourceProviderOptions) => {\n return new LocalFileSourceProvider(options);\n};\n\nclass LocalFileSourceProvider implements ISourceProvider {\n type: ProviderType = 'source';\n\n name = 'source::local-file';\n\n options: ILocalFileSourceProviderOptions;\n\n #metadata?: IMetadata;\n\n #diagnostics?: IDiagnosticReporter;\n\n constructor(options: ILocalFileSourceProviderOptions) {\n this.options = options;\n\n const { encryption } = this.options;\n\n if (encryption.enabled && encryption.key === undefined) {\n throw new Error('Missing encryption key');\n }\n }\n\n #reportInfo(message: string) {\n this.#diagnostics?.report({\n details: {\n createdAt: new Date(),\n message,\n origin: 'file-source-provider',\n },\n kind: 'info',\n });\n }\n\n /**\n * Pre flight checks regarding the provided options, making sure that the file can be opened (decrypted, decompressed), etc.\n */\n async bootstrap(diagnostics: IDiagnosticReporter) {\n this.#diagnostics = diagnostics;\n const { path: filePath } = this.options.file;\n\n try {\n // Read the metadata to ensure the file can be parsed\n await this.#loadMetadata();\n // TODO: we might also need to read the schema.jsonl files & implements a custom stream-check\n } catch (e) {\n if (this.options?.encryption?.enabled) {\n throw new ProviderInitializationError(\n `Key is incorrect or the file '${filePath}' is not a valid Strapi data file.`\n );\n }\n throw new ProviderInitializationError(`File '${filePath}' is not a valid Strapi data file.`);\n }\n\n if (!this.#metadata) {\n throw new ProviderInitializationError('Could not load metadata from Strapi data file.');\n }\n }\n\n async #loadMetadata() {\n const backupStream = this.#getBackupStream();\n this.#metadata = await this.#parseJSONFile<IMetadata>(backupStream, METADATA_FILE_PATH);\n }\n\n async #loadAssetMetadata(path: string) {\n const backupStream = this.#getBackupStream();\n return this.#parseJSONFile<IFile>(backupStream, path);\n }\n\n async getMetadata() {\n this.#reportInfo('getting metadata');\n if (!this.#metadata) {\n await this.#loadMetadata();\n }\n\n return this.#metadata ?? null;\n }\n\n async getSchemas() {\n this.#reportInfo('getting schemas');\n const schemaCollection = await utils.stream.collect<Struct.Schema>(\n this.createSchemasReadStream()\n );\n\n if (isEmpty(schemaCollection)) {\n throw new ProviderInitializationError('Could not load schemas from Strapi data file.');\n }\n\n // Group schema by UID\n const schemas = keyBy('uid', schemaCollection);\n\n // Transform to valid JSON\n return utils.schema.schemasToValidJSON(schemas);\n }\n\n createEntitiesReadStream(): Readable {\n this.#reportInfo('creating entities read stream');\n return this.#streamJsonlDirectory('entities');\n }\n\n createSchemasReadStream(): Readable {\n this.#reportInfo('creating schemas read stream');\n return this.#streamJsonlDirectory('schemas');\n }\n\n createLinksReadStream(): Readable {\n this.#reportInfo('creating links read stream');\n return this.#streamJsonlDirectory('links');\n }\n\n createConfigurationReadStream(): Readable {\n this.#reportInfo('creating configuration read stream');\n // NOTE: TBD\n return this.#streamJsonlDirectory('configuration');\n }\n\n createAssetsReadStream(): Readable | Promise<Readable> {\n const inStream = this.#getBackupStream();\n const outStream = new PassThrough({ objectMode: true });\n const loadAssetMetadata = this.#loadAssetMetadata.bind(this);\n this.#reportInfo('creating assets read stream');\n\n pipeline(\n [\n inStream,\n new tar.Parse({\n // find only files in the assets/uploads folder\n filter(filePath, entry) {\n if (entry.type !== 'File') {\n return false;\n }\n return isFilePathInDirname('assets/uploads', filePath);\n },\n async onentry(entry) {\n const { path: filePath, size = 0 } = entry;\n const normalizedPath = unknownPathToPosix(filePath);\n const file = path.basename(normalizedPath);\n let metadata;\n try {\n metadata = await loadAssetMetadata(`assets/metadata/${file}.json`);\n } catch (error) {\n throw new Error(`Failed to read metadata for ${file}`);\n }\n const asset: IAsset = {\n metadata,\n filename: file,\n filepath: normalizedPath,\n stats: { size },\n stream: entry as unknown as Readable,\n };\n outStream.write(asset);\n },\n }),\n ],\n () => outStream.end()\n );\n\n return outStream;\n }\n\n #getBackupStream() {\n const { file, encryption, compression } = this.options;\n\n const streams: StreamItemArray = [];\n\n try {\n streams.push(fs.createReadStream(file.path));\n } catch (e) {\n throw new Error(`Could not read backup file path provided at \"${this.options.file.path}\"`);\n }\n\n if (encryption.enabled && encryption.key) {\n streams.push(utils.encryption.createDecryptionCipher(encryption.key));\n }\n\n if (compression.enabled) {\n streams.push(zip.createGunzip());\n }\n\n return chain(streams);\n }\n\n // `directory` must be posix formatted path\n #streamJsonlDirectory(directory: string) {\n const inStream = this.#getBackupStream();\n\n const outStream = new PassThrough({ objectMode: true });\n\n pipeline(\n [\n inStream,\n new tar.Parse({\n filter(filePath, entry) {\n if (entry.type !== 'File') {\n return false;\n }\n\n return isFilePathInDirname(directory, filePath);\n },\n\n async onentry(entry) {\n const transforms = [\n // JSONL parser to read the data chunks one by one (line by line)\n parser({\n checkErrors: true,\n }),\n // The JSONL parser returns each line as key/value\n (line: { key: string; value: object }) => line.value,\n ];\n\n const stream = entry.pipe(chain(transforms));\n\n try {\n for await (const chunk of stream) {\n outStream.write(chunk);\n }\n } catch (e: unknown) {\n outStream.destroy(\n new ProviderTransferError(\n `Error parsing backup files from backup file ${entry.path}: ${\n (e as Error).message\n }`,\n {\n details: {\n error: e,\n },\n }\n )\n );\n }\n },\n }),\n ],\n async () => {\n // Manually send the 'end' event to the out stream\n // once every entry has finished streaming its content\n outStream.end();\n }\n );\n\n return outStream;\n }\n\n // For collecting an entire JSON file then parsing it, not for streaming JSONL\n async #parseJSONFile<T extends object>(fileStream: Readable, filePath: string): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n pipeline(\n [\n fileStream,\n // Custom backup archive parsing\n new tar.Parse({\n /**\n * Filter the parsed entries to only keep the one that matches the given filepath\n */\n filter(entryPath, entry) {\n if (entry.type !== 'File') {\n return false;\n }\n\n return isPathEquivalent(entryPath, filePath);\n },\n\n async onentry(entry) {\n // Collect all the content of the entry file\n const content = await entry.collect();\n\n try {\n // Parse from buffer array to string to JSON\n const parsedContent = JSON.parse(Buffer.concat(content).toString());\n\n // Resolve the Promise with the parsed content\n resolve(parsedContent);\n } catch (e) {\n reject(e);\n } finally {\n // Cleanup (close the stream associated to the entry)\n entry.destroy();\n }\n },\n }),\n ],\n () => {\n // If the promise hasn't been resolved and we've parsed all\n // the archive entries, then the file doesn't exist\n reject(new Error(`File \"${filePath}\" not found`));\n }\n );\n });\n }\n}\n"],"names":["METADATA_FILE_PATH","createLocalFileSourceProvider","options","LocalFileSourceProvider","bootstrap","diagnostics","path","filePath","file","loadMetadata","e","encryption","enabled","ProviderInitializationError","metadata","getMetadata","reportInfo","getSchemas","schemaCollection","utils","createSchemasReadStream","isEmpty","schemas","keyBy","createEntitiesReadStream","streamJsonlDirectory","createLinksReadStream","createConfigurationReadStream","createAssetsReadStream","inStream","getBackupStream","outStream","PassThrough","objectMode","loadAssetMetadata","bind","pipeline","tar","Parse","filter","entry","type","isFilePathInDirname","onentry","size","normalizedPath","unknownPathToPosix","basename","error","Error","asset","filename","filepath","stats","stream","write","end","constructor","name","key","undefined","message","report","details","createdAt","Date","origin","kind","backupStream","parseJSONFile","compression","streams","push","fs","createReadStream","zip","createGunzip","chain","directory","transforms","parser","checkErrors","line","value","pipe","chunk","destroy","ProviderTransferError","fileStream","Promise","resolve","reject","entryPath","isPathEquivalent","content","collect","parsedContent","JSON","parse","Buffer","concat","toString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA;;AAEC,IACD,MAAMA,kBAAqB,GAAA,eAAA;AAoBpB,MAAMC,gCAAgC,CAACC,OAAAA,GAAAA;AAC5C,IAAA,OAAO,IAAIC,uBAAwBD,CAAAA,OAAAA,CAAAA;AACrC;AASE,IAAA,SAAA,iBAAA,8BAAA,CAAA,WAAA,CAAA,EAEA,YAYA,iBAAA,8BAAA,CAAA,cAAA,CAAA,EAAA,WAAA,iBAAA,8BAAA,CAAA,aAAA,CAAA,EAoCM,aAKA,iBAAA,8BAAA,CAAA,eAAA,CAAA,EAAA,kBAAA,iBAAA,8BAAA,CAAA,oBAAA,CAAA,EAgGN;AAuBA,qBA6DM,iBAAA,8BAAA,CAAA,uBAAA,CAAA,EAAA,cAAA,iBAAA,8BAAA,CAAA,gBAAA,CAAA;AAlPR,MAAMC,uBAAAA,CAAAA;AAgCJ;;MAGA,MAAMC,SAAUC,CAAAA,WAAgC,EAAE;QAChD,+BAAA,CAAA,IAAI,EAAEA,YAAAA,CAAAA,CAAAA,YAAcA,CAAAA,GAAAA,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CAAA,CAAC,MAAM,EAAE1C,QAAAA,CAAS,WAAW,CAAC,CAAA,CAAA;AACjD,SAAA,CAAA;AAEJ,KAAA,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var path = require('path');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Note: in versions of the transfer engine <=4.9.0, exports were generated with windows paths
|
|
7
|
+
* on Windows systems, and posix paths on posix systems.
|
|
8
|
+
*
|
|
9
|
+
* We now store all paths as posix, but need to leave a separator conversion for legacy purposes, and to
|
|
10
|
+
* support manually-created tar files coming from Windows systems (ie, if a user creates a
|
|
11
|
+
* backup file with a windows tar tool rather than using the `export` command)
|
|
12
|
+
*
|
|
13
|
+
* Because of this, export/import files may never contain files with a forward slash in the name, even escaped
|
|
14
|
+
*
|
|
15
|
+
* */ /**
|
|
16
|
+
* Check if the directory of a given filePath (which can be either posix or win32) resolves to the same as the given posix-format path posixDirName
|
|
17
|
+
* We must be able to assume the first argument is a path to a directory and the second is a path to a file, otherwise path.dirname will interpret a path without any slashes as the filename
|
|
18
|
+
*
|
|
19
|
+
* @param {string} posixDirName A posix path pointing to a directory
|
|
20
|
+
* @param {string} filePath an unknown filesystem path pointing to a file
|
|
21
|
+
* @returns {boolean} is the file located in the given directory
|
|
22
|
+
*/ const isFilePathInDirname = (posixDirName, filePath)=>{
|
|
23
|
+
const normalizedDir = path.posix.dirname(unknownPathToPosix(filePath));
|
|
24
|
+
return isPathEquivalent(posixDirName, normalizedDir);
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Check if two paths that can be either in posix or win32 format resolves to the same file
|
|
28
|
+
*
|
|
29
|
+
* @param {string} pathA a path that may be either win32 or posix
|
|
30
|
+
* @param {string} pathB a path that may be either win32 or posix
|
|
31
|
+
*
|
|
32
|
+
* @returns {boolean} do paths point to the same place
|
|
33
|
+
*/ const isPathEquivalent = (pathA, pathB)=>{
|
|
34
|
+
// Check if paths appear to be win32 or posix, and if win32 convert to posix
|
|
35
|
+
const normalizedPathA = path.posix.normalize(unknownPathToPosix(pathA));
|
|
36
|
+
const normalizedPathB = path.posix.normalize(unknownPathToPosix(pathB));
|
|
37
|
+
return !path.posix.relative(normalizedPathB, normalizedPathA).length;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Convert an unknown format path (win32 or posix) to a posix path
|
|
41
|
+
*
|
|
42
|
+
* @param {string} filePath a path that may be either win32 or posix
|
|
43
|
+
*
|
|
44
|
+
* @returns {string} a posix path
|
|
45
|
+
*/ const unknownPathToPosix = (filePath)=>{
|
|
46
|
+
// if it includes a forward slash, it must be posix already -- we will not support win32 with mixed path separators
|
|
47
|
+
if (filePath.includes(path.posix.sep)) {
|
|
48
|
+
return filePath;
|
|
49
|
+
}
|
|
50
|
+
return path.normalize(filePath).split(path.win32.sep).join(path.posix.sep);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
exports.isFilePathInDirname = isFilePathInDirname;
|
|
54
|
+
exports.isPathEquivalent = isPathEquivalent;
|
|
55
|
+
exports.unknownPathToPosix = unknownPathToPosix;
|
|
56
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../src/file/providers/source/utils.ts"],"sourcesContent":["import path from 'path';\n\n/**\n * Note: in versions of the transfer engine <=4.9.0, exports were generated with windows paths\n * on Windows systems, and posix paths on posix systems.\n *\n * We now store all paths as posix, but need to leave a separator conversion for legacy purposes, and to\n * support manually-created tar files coming from Windows systems (ie, if a user creates a\n * backup file with a windows tar tool rather than using the `export` command)\n *\n * Because of this, export/import files may never contain files with a forward slash in the name, even escaped\n *\n * */\n\n/**\n * Check if the directory of a given filePath (which can be either posix or win32) resolves to the same as the given posix-format path posixDirName\n * We must be able to assume the first argument is a path to a directory and the second is a path to a file, otherwise path.dirname will interpret a path without any slashes as the filename\n *\n * @param {string} posixDirName A posix path pointing to a directory\n * @param {string} filePath an unknown filesystem path pointing to a file\n * @returns {boolean} is the file located in the given directory\n */\nexport const isFilePathInDirname = (posixDirName: string, filePath: string) => {\n const normalizedDir = path.posix.dirname(unknownPathToPosix(filePath));\n return isPathEquivalent(posixDirName, normalizedDir);\n};\n\n/**\n * Check if two paths that can be either in posix or win32 format resolves to the same file\n *\n * @param {string} pathA a path that may be either win32 or posix\n * @param {string} pathB a path that may be either win32 or posix\n *\n * @returns {boolean} do paths point to the same place\n */\nexport const isPathEquivalent = (pathA: string, pathB: string) => {\n // Check if paths appear to be win32 or posix, and if win32 convert to posix\n const normalizedPathA = path.posix.normalize(unknownPathToPosix(pathA));\n const normalizedPathB = path.posix.normalize(unknownPathToPosix(pathB));\n\n return !path.posix.relative(normalizedPathB, normalizedPathA).length;\n};\n\n/**\n * Convert an unknown format path (win32 or posix) to a posix path\n *\n * @param {string} filePath a path that may be either win32 or posix\n *\n * @returns {string} a posix path\n */\nexport const unknownPathToPosix = (filePath: string) => {\n // if it includes a forward slash, it must be posix already -- we will not support win32 with mixed path separators\n if (filePath.includes(path.posix.sep)) {\n return filePath;\n }\n\n return path.normalize(filePath).split(path.win32.sep).join(path.posix.sep);\n};\n"],"names":["isFilePathInDirname","posixDirName","filePath","normalizedDir","path","posix","dirname","unknownPathToPosix","isPathEquivalent","pathA","pathB","normalizedPathA","normalize","normalizedPathB","relative","length","includes","sep","split","win32","join"],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;AAmBC,IACM,MAAMA,mBAAsB,GAAA,CAACC,YAAsBC,EAAAA,QAAAA,GAAAA;AACxD,IAAA,MAAMC,gBAAgBC,IAAKC,CAAAA,KAAK,CAACC,OAAO,CAACC,kBAAmBL,CAAAA,QAAAA,CAAAA,CAAAA;AAC5D,IAAA,OAAOM,iBAAiBP,YAAcE,EAAAA,aAAAA,CAAAA;AACxC;AAEA;;;;;;;AAOC,IACM,MAAMK,gBAAmB,GAAA,CAACC,KAAeC,EAAAA,KAAAA,GAAAA;;AAE9C,IAAA,MAAMC,kBAAkBP,IAAKC,CAAAA,KAAK,CAACO,SAAS,CAACL,kBAAmBE,CAAAA,KAAAA,CAAAA,CAAAA;AAChE,IAAA,MAAMI,kBAAkBT,IAAKC,CAAAA,KAAK,CAACO,SAAS,CAACL,kBAAmBG,CAAAA,KAAAA,CAAAA,CAAAA;IAEhE,OAAO,CAACN,KAAKC,KAAK,CAACS,QAAQ,CAACD,eAAAA,EAAiBF,iBAAiBI,MAAM;AACtE;AAEA;;;;;;IAOaR,MAAAA,kBAAAA,GAAqB,CAACL,QAAAA,GAAAA;;AAEjC,IAAA,IAAIA,SAASc,QAAQ,CAACZ,KAAKC,KAAK,CAACY,GAAG,CAAG,EAAA;QACrC,OAAOf,QAAAA;AACT;AAEA,IAAA,OAAOE,KAAKQ,SAAS,CAACV,QAAUgB,CAAAA,CAAAA,KAAK,CAACd,IAAKe,CAAAA,KAAK,CAACF,GAAG,EAAEG,IAAI,CAAChB,IAAKC,CAAAA,KAAK,CAACY,GAAG,CAAA;AAC3E;;;;;;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Note: in versions of the transfer engine <=4.9.0, exports were generated with windows paths
|
|
5
|
+
* on Windows systems, and posix paths on posix systems.
|
|
6
|
+
*
|
|
7
|
+
* We now store all paths as posix, but need to leave a separator conversion for legacy purposes, and to
|
|
8
|
+
* support manually-created tar files coming from Windows systems (ie, if a user creates a
|
|
9
|
+
* backup file with a windows tar tool rather than using the `export` command)
|
|
10
|
+
*
|
|
11
|
+
* Because of this, export/import files may never contain files with a forward slash in the name, even escaped
|
|
12
|
+
*
|
|
13
|
+
* */ /**
|
|
14
|
+
* Check if the directory of a given filePath (which can be either posix or win32) resolves to the same as the given posix-format path posixDirName
|
|
15
|
+
* We must be able to assume the first argument is a path to a directory and the second is a path to a file, otherwise path.dirname will interpret a path without any slashes as the filename
|
|
16
|
+
*
|
|
17
|
+
* @param {string} posixDirName A posix path pointing to a directory
|
|
18
|
+
* @param {string} filePath an unknown filesystem path pointing to a file
|
|
19
|
+
* @returns {boolean} is the file located in the given directory
|
|
20
|
+
*/ const isFilePathInDirname = (posixDirName, filePath)=>{
|
|
21
|
+
const normalizedDir = path.posix.dirname(unknownPathToPosix(filePath));
|
|
22
|
+
return isPathEquivalent(posixDirName, normalizedDir);
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Check if two paths that can be either in posix or win32 format resolves to the same file
|
|
26
|
+
*
|
|
27
|
+
* @param {string} pathA a path that may be either win32 or posix
|
|
28
|
+
* @param {string} pathB a path that may be either win32 or posix
|
|
29
|
+
*
|
|
30
|
+
* @returns {boolean} do paths point to the same place
|
|
31
|
+
*/ const isPathEquivalent = (pathA, pathB)=>{
|
|
32
|
+
// Check if paths appear to be win32 or posix, and if win32 convert to posix
|
|
33
|
+
const normalizedPathA = path.posix.normalize(unknownPathToPosix(pathA));
|
|
34
|
+
const normalizedPathB = path.posix.normalize(unknownPathToPosix(pathB));
|
|
35
|
+
return !path.posix.relative(normalizedPathB, normalizedPathA).length;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Convert an unknown format path (win32 or posix) to a posix path
|
|
39
|
+
*
|
|
40
|
+
* @param {string} filePath a path that may be either win32 or posix
|
|
41
|
+
*
|
|
42
|
+
* @returns {string} a posix path
|
|
43
|
+
*/ const unknownPathToPosix = (filePath)=>{
|
|
44
|
+
// if it includes a forward slash, it must be posix already -- we will not support win32 with mixed path separators
|
|
45
|
+
if (filePath.includes(path.posix.sep)) {
|
|
46
|
+
return filePath;
|
|
47
|
+
}
|
|
48
|
+
return path.normalize(filePath).split(path.win32.sep).join(path.posix.sep);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { isFilePathInDirname, isPathEquivalent, unknownPathToPosix };
|
|
52
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../../../src/file/providers/source/utils.ts"],"sourcesContent":["import path from 'path';\n\n/**\n * Note: in versions of the transfer engine <=4.9.0, exports were generated with windows paths\n * on Windows systems, and posix paths on posix systems.\n *\n * We now store all paths as posix, but need to leave a separator conversion for legacy purposes, and to\n * support manually-created tar files coming from Windows systems (ie, if a user creates a\n * backup file with a windows tar tool rather than using the `export` command)\n *\n * Because of this, export/import files may never contain files with a forward slash in the name, even escaped\n *\n * */\n\n/**\n * Check if the directory of a given filePath (which can be either posix or win32) resolves to the same as the given posix-format path posixDirName\n * We must be able to assume the first argument is a path to a directory and the second is a path to a file, otherwise path.dirname will interpret a path without any slashes as the filename\n *\n * @param {string} posixDirName A posix path pointing to a directory\n * @param {string} filePath an unknown filesystem path pointing to a file\n * @returns {boolean} is the file located in the given directory\n */\nexport const isFilePathInDirname = (posixDirName: string, filePath: string) => {\n const normalizedDir = path.posix.dirname(unknownPathToPosix(filePath));\n return isPathEquivalent(posixDirName, normalizedDir);\n};\n\n/**\n * Check if two paths that can be either in posix or win32 format resolves to the same file\n *\n * @param {string} pathA a path that may be either win32 or posix\n * @param {string} pathB a path that may be either win32 or posix\n *\n * @returns {boolean} do paths point to the same place\n */\nexport const isPathEquivalent = (pathA: string, pathB: string) => {\n // Check if paths appear to be win32 or posix, and if win32 convert to posix\n const normalizedPathA = path.posix.normalize(unknownPathToPosix(pathA));\n const normalizedPathB = path.posix.normalize(unknownPathToPosix(pathB));\n\n return !path.posix.relative(normalizedPathB, normalizedPathA).length;\n};\n\n/**\n * Convert an unknown format path (win32 or posix) to a posix path\n *\n * @param {string} filePath a path that may be either win32 or posix\n *\n * @returns {string} a posix path\n */\nexport const unknownPathToPosix = (filePath: string) => {\n // if it includes a forward slash, it must be posix already -- we will not support win32 with mixed path separators\n if (filePath.includes(path.posix.sep)) {\n return filePath;\n }\n\n return path.normalize(filePath).split(path.win32.sep).join(path.posix.sep);\n};\n"],"names":["isFilePathInDirname","posixDirName","filePath","normalizedDir","path","posix","dirname","unknownPathToPosix","isPathEquivalent","pathA","pathB","normalizedPathA","normalize","normalizedPathB","relative","length","includes","sep","split","win32","join"],"mappings":";;AAEA;;;;;;;;;;;;;;;;;AAmBC,IACM,MAAMA,mBAAsB,GAAA,CAACC,YAAsBC,EAAAA,QAAAA,GAAAA;AACxD,IAAA,MAAMC,gBAAgBC,IAAKC,CAAAA,KAAK,CAACC,OAAO,CAACC,kBAAmBL,CAAAA,QAAAA,CAAAA,CAAAA;AAC5D,IAAA,OAAOM,iBAAiBP,YAAcE,EAAAA,aAAAA,CAAAA;AACxC;AAEA;;;;;;;AAOC,IACM,MAAMK,gBAAmB,GAAA,CAACC,KAAeC,EAAAA,KAAAA,GAAAA;;AAE9C,IAAA,MAAMC,kBAAkBP,IAAKC,CAAAA,KAAK,CAACO,SAAS,CAACL,kBAAmBE,CAAAA,KAAAA,CAAAA,CAAAA;AAChE,IAAA,MAAMI,kBAAkBT,IAAKC,CAAAA,KAAK,CAACO,SAAS,CAACL,kBAAmBG,CAAAA,KAAAA,CAAAA,CAAAA;IAEhE,OAAO,CAACN,KAAKC,KAAK,CAACS,QAAQ,CAACD,eAAAA,EAAiBF,iBAAiBI,MAAM;AACtE;AAEA;;;;;;IAOaR,MAAAA,kBAAAA,GAAqB,CAACL,QAAAA,GAAAA;;AAEjC,IAAA,IAAIA,SAASc,QAAQ,CAACZ,KAAKC,KAAK,CAACY,GAAG,CAAG,EAAA;QACrC,OAAOf,QAAAA;AACT;AAEA,IAAA,OAAOE,KAAKQ,SAAS,CAACV,QAAUgB,CAAAA,CAAAA,KAAK,CAACd,IAAKe,CAAAA,KAAK,CAACF,GAAG,EAAEG,IAAI,CAAChB,IAAKC,CAAAA,KAAK,CAACY,GAAG,CAAA;AAC3E;;;;"}
|