@prenta/import 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +686 -0
- package/LICENSE +21 -0
- package/README.md +24 -0
- package/dist/adapter.d.ts +47 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +60 -0
- package/dist/adapter.js.map +1 -0
- package/dist/adapters/contentful/asset.d.ts +47 -0
- package/dist/adapters/contentful/asset.d.ts.map +1 -0
- package/dist/adapters/contentful/asset.js +88 -0
- package/dist/adapters/contentful/asset.js.map +1 -0
- package/dist/adapters/contentful/index.d.ts +24 -0
- package/dist/adapters/contentful/index.d.ts.map +1 -0
- package/dist/adapters/contentful/index.js +242 -0
- package/dist/adapters/contentful/index.js.map +1 -0
- package/dist/adapters/contentful/locale.d.ts +66 -0
- package/dist/adapters/contentful/locale.d.ts.map +1 -0
- package/dist/adapters/contentful/locale.js +125 -0
- package/dist/adapters/contentful/locale.js.map +1 -0
- package/dist/adapters/contentful/map.d.ts +69 -0
- package/dist/adapters/contentful/map.d.ts.map +1 -0
- package/dist/adapters/contentful/map.js +174 -0
- package/dist/adapters/contentful/map.js.map +1 -0
- package/dist/adapters/contentful/rich-text.d.ts +52 -0
- package/dist/adapters/contentful/rich-text.d.ts.map +1 -0
- package/dist/adapters/contentful/rich-text.js +95 -0
- package/dist/adapters/contentful/rich-text.js.map +1 -0
- package/dist/adapters/contentful/types.d.ts +189 -0
- package/dist/adapters/contentful/types.d.ts.map +1 -0
- package/dist/adapters/contentful/types.js +26 -0
- package/dist/adapters/contentful/types.js.map +1 -0
- package/dist/adapters/identity.d.ts +27 -0
- package/dist/adapters/identity.d.ts.map +1 -0
- package/dist/adapters/identity.js +116 -0
- package/dist/adapters/identity.js.map +1 -0
- package/dist/adapters/sanity/asset.d.ts +45 -0
- package/dist/adapters/sanity/asset.d.ts.map +1 -0
- package/dist/adapters/sanity/asset.js +79 -0
- package/dist/adapters/sanity/asset.js.map +1 -0
- package/dist/adapters/sanity/index.d.ts +19 -0
- package/dist/adapters/sanity/index.d.ts.map +1 -0
- package/dist/adapters/sanity/index.js +165 -0
- package/dist/adapters/sanity/index.js.map +1 -0
- package/dist/adapters/sanity/map.d.ts +75 -0
- package/dist/adapters/sanity/map.d.ts.map +1 -0
- package/dist/adapters/sanity/map.js +245 -0
- package/dist/adapters/sanity/map.js.map +1 -0
- package/dist/adapters/sanity/parse.d.ts +64 -0
- package/dist/adapters/sanity/parse.d.ts.map +1 -0
- package/dist/adapters/sanity/parse.js +71 -0
- package/dist/adapters/sanity/parse.js.map +1 -0
- package/dist/adapters/sanity/portable-text.d.ts +64 -0
- package/dist/adapters/sanity/portable-text.d.ts.map +1 -0
- package/dist/adapters/sanity/portable-text.js +112 -0
- package/dist/adapters/sanity/portable-text.js.map +1 -0
- package/dist/adapters/sanity/types.d.ts +182 -0
- package/dist/adapters/sanity/types.d.ts.map +1 -0
- package/dist/adapters/sanity/types.js +17 -0
- package/dist/adapters/sanity/types.js.map +1 -0
- package/dist/adapters/strapi/asset.d.ts +56 -0
- package/dist/adapters/strapi/asset.d.ts.map +1 -0
- package/dist/adapters/strapi/asset.js +94 -0
- package/dist/adapters/strapi/asset.js.map +1 -0
- package/dist/adapters/strapi/index.d.ts +20 -0
- package/dist/adapters/strapi/index.d.ts.map +1 -0
- package/dist/adapters/strapi/index.js +205 -0
- package/dist/adapters/strapi/index.js.map +1 -0
- package/dist/adapters/strapi/links.d.ts +79 -0
- package/dist/adapters/strapi/links.d.ts.map +1 -0
- package/dist/adapters/strapi/links.js +98 -0
- package/dist/adapters/strapi/links.js.map +1 -0
- package/dist/adapters/strapi/loader.d.ts +68 -0
- package/dist/adapters/strapi/loader.d.ts.map +1 -0
- package/dist/adapters/strapi/loader.js +177 -0
- package/dist/adapters/strapi/loader.js.map +1 -0
- package/dist/adapters/strapi/map.d.ts +53 -0
- package/dist/adapters/strapi/map.d.ts.map +1 -0
- package/dist/adapters/strapi/map.js +193 -0
- package/dist/adapters/strapi/map.js.map +1 -0
- package/dist/adapters/strapi/types.d.ts +174 -0
- package/dist/adapters/strapi/types.d.ts.map +1 -0
- package/dist/adapters/strapi/types.js +31 -0
- package/dist/adapters/strapi/types.js.map +1 -0
- package/dist/adapters/strapi/uid.d.ts +44 -0
- package/dist/adapters/strapi/uid.d.ts.map +1 -0
- package/dist/adapters/strapi/uid.js +58 -0
- package/dist/adapters/strapi/uid.js.map +1 -0
- package/dist/adapters/wordpress/attachments.d.ts +37 -0
- package/dist/adapters/wordpress/attachments.d.ts.map +1 -0
- package/dist/adapters/wordpress/attachments.js +134 -0
- package/dist/adapters/wordpress/attachments.js.map +1 -0
- package/dist/adapters/wordpress/authors.d.ts +24 -0
- package/dist/adapters/wordpress/authors.d.ts.map +1 -0
- package/dist/adapters/wordpress/authors.js +40 -0
- package/dist/adapters/wordpress/authors.js.map +1 -0
- package/dist/adapters/wordpress/index.d.ts +19 -0
- package/dist/adapters/wordpress/index.d.ts.map +1 -0
- package/dist/adapters/wordpress/index.js +281 -0
- package/dist/adapters/wordpress/index.js.map +1 -0
- package/dist/adapters/wordpress/map.d.ts +61 -0
- package/dist/adapters/wordpress/map.d.ts.map +1 -0
- package/dist/adapters/wordpress/map.js +265 -0
- package/dist/adapters/wordpress/map.js.map +1 -0
- package/dist/adapters/wordpress/parse.d.ts +50 -0
- package/dist/adapters/wordpress/parse.d.ts.map +1 -0
- package/dist/adapters/wordpress/parse.js +141 -0
- package/dist/adapters/wordpress/parse.js.map +1 -0
- package/dist/adapters/wordpress/terms.d.ts +46 -0
- package/dist/adapters/wordpress/terms.d.ts.map +1 -0
- package/dist/adapters/wordpress/terms.js +87 -0
- package/dist/adapters/wordpress/terms.js.map +1 -0
- package/dist/adapters/wordpress/types.d.ts +201 -0
- package/dist/adapters/wordpress/types.d.ts.map +1 -0
- package/dist/adapters/wordpress/types.js +24 -0
- package/dist/adapters/wordpress/types.js.map +1 -0
- package/dist/cli.d.ts +16 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +266 -0
- package/dist/cli.js.map +1 -0
- package/dist/formatter.d.ts +12 -0
- package/dist/formatter.d.ts.map +1 -0
- package/dist/formatter.js +48 -0
- package/dist/formatter.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/migrate.d.ts +151 -0
- package/dist/migrate.d.ts.map +1 -0
- package/dist/migrate.js +255 -0
- package/dist/migrate.js.map +1 -0
- package/dist/registry.d.ts +39 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +62 -0
- package/dist/registry.js.map +1 -0
- package/dist/runner.d.ts +33 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +61 -0
- package/dist/runner.js.map +1 -0
- package/dist/types.d.ts +173 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +17 -0
- package/dist/types.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `strapi` — adapter for Strapi v4/v5 `data-transfer` datasets.
|
|
3
|
+
*
|
|
4
|
+
* The CLI takes the path to the extracted dataset directory (or a
|
|
5
|
+
* single `entities/*.jsonl` file). The adapter reads:
|
|
6
|
+
*
|
|
7
|
+
* - every `entities/*.jsonl` → entity records
|
|
8
|
+
* - `assets/metadata.jsonl` → asset manifest (URLs, mime, dims)
|
|
9
|
+
* - `links/links.jsonl` → cross-entity relations and i18n joins
|
|
10
|
+
*
|
|
11
|
+
* Two-pass: first pass filters entities (publishedOnly, locale,
|
|
12
|
+
* ignoreTypes, shouldInclude) and seeds the
|
|
13
|
+
* `(type, ref) → collection` map so cross-references resolve in
|
|
14
|
+
* either direction. Second pass walks each entity with the
|
|
15
|
+
* resolved context, weaving sidecar relations onto the right
|
|
16
|
+
* fields.
|
|
17
|
+
*/
|
|
18
|
+
import { existsSync } from 'node:fs';
|
|
19
|
+
import { buildResult } from '../../adapter.js';
|
|
20
|
+
import { buildAssetMap } from './asset.js';
|
|
21
|
+
import { buildLinksIndex, keyFor } from './links.js';
|
|
22
|
+
import { loadDataset } from './loader.js';
|
|
23
|
+
import { mapEntity } from './map.js';
|
|
24
|
+
import { resolveCollectionFromUid } from './uid.js';
|
|
25
|
+
const DEFAULT_IGNORE_TYPES = [
|
|
26
|
+
'admin::user',
|
|
27
|
+
'admin::role',
|
|
28
|
+
'admin::permission',
|
|
29
|
+
'plugin::users-permissions.user',
|
|
30
|
+
'plugin::users-permissions.role',
|
|
31
|
+
'plugin::users-permissions.permission',
|
|
32
|
+
'plugin::i18n.locale',
|
|
33
|
+
'plugin::upload.file',
|
|
34
|
+
'plugin::upload.folder',
|
|
35
|
+
];
|
|
36
|
+
export const strapiAdapter = {
|
|
37
|
+
name: 'strapi',
|
|
38
|
+
description: 'Import a Strapi v4/v5 data-transfer dataset.',
|
|
39
|
+
docsUrl: 'https://github.com/actuate-media/prenta/blob/main/docs/import.md#strapi-adapter',
|
|
40
|
+
run(options) {
|
|
41
|
+
const config = readConfig(options.config);
|
|
42
|
+
const warnings = [];
|
|
43
|
+
const unresolved = [];
|
|
44
|
+
if (!existsSync(options.input)) {
|
|
45
|
+
unresolved.push({
|
|
46
|
+
source: { field: '<input>' },
|
|
47
|
+
code: 'input-missing',
|
|
48
|
+
reason: `Strapi dataset path '${options.input}' does not exist.`,
|
|
49
|
+
hint: 'Pass the extracted dataset directory (the `tar -xzf` target), not the .tar.gz archive itself.',
|
|
50
|
+
});
|
|
51
|
+
return buildResult({
|
|
52
|
+
adapter: strapiAdapter.name,
|
|
53
|
+
documents: [],
|
|
54
|
+
warnings,
|
|
55
|
+
unresolved,
|
|
56
|
+
totals: { totalRead: 0, converted: 0, skipped: 0 },
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const loaded = loadDataset(options.input);
|
|
60
|
+
warnings.push(...loaded.warnings);
|
|
61
|
+
if (loaded.entities.length === 0) {
|
|
62
|
+
unresolved.push({
|
|
63
|
+
source: { field: '<dataset>' },
|
|
64
|
+
code: 'empty-dataset',
|
|
65
|
+
reason: 'No entity records were read from the dataset.',
|
|
66
|
+
hint: 'Verify the directory contains entities/<uid>.jsonl files (post `tar -xzf` extraction).',
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const ignored = new Set([...DEFAULT_IGNORE_TYPES, ...(config.ignoreTypes ?? [])]);
|
|
70
|
+
const publishedOnly = config.publishedOnly !== false;
|
|
71
|
+
const primaryLocale = config.primaryLocale;
|
|
72
|
+
const assetsById = buildAssetMap(loaded.assets, { mediaBaseUrl: config.mediaBaseUrl });
|
|
73
|
+
const { index: linksIndex, unfielded: unfieldedLinks } = buildLinksIndex(loaded.links);
|
|
74
|
+
// Surface every link the export sent without a `left.field`
|
|
75
|
+
// pointer. Strapi emits these for polymorphic relations and a
|
|
76
|
+
// handful of plugin types; swallowing them silently makes them
|
|
77
|
+
// invisible to operators who could otherwise add a typeMap
|
|
78
|
+
// override or fix the export. One warning per orphaned source.
|
|
79
|
+
for (const [sourceKey, targets] of unfieldedLinks) {
|
|
80
|
+
const sep = sourceKey.indexOf('\u0001');
|
|
81
|
+
const type = sep > -1 ? sourceKey.slice(0, sep) : sourceKey;
|
|
82
|
+
const id = sep > -1 ? sourceKey.slice(sep + 1) : '';
|
|
83
|
+
warnings.push({
|
|
84
|
+
source: { type, id },
|
|
85
|
+
code: 'unfielded-link',
|
|
86
|
+
message: `Skipped ${targets.length} relation link(s) on ${type}#${id} that had no left.field attribution.`,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
let skipped = 0;
|
|
90
|
+
const importable = [];
|
|
91
|
+
const collectionByEntity = new Map();
|
|
92
|
+
// First pass: filter + seed collection map.
|
|
93
|
+
for (const entity of loaded.entities) {
|
|
94
|
+
const type = entity.type;
|
|
95
|
+
if (ignored.has(type)) {
|
|
96
|
+
skipped++;
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (publishedOnly && entity.data?.publishedAt === null) {
|
|
100
|
+
skipped++;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
if (primaryLocale !== undefined &&
|
|
104
|
+
typeof entity.data?.locale === 'string' &&
|
|
105
|
+
entity.data.locale !== primaryLocale) {
|
|
106
|
+
skipped++;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (options.shouldInclude && !options.shouldInclude({ type, id: String(entity.id) })) {
|
|
110
|
+
skipped++;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
const { collection } = resolveCollectionFromUid(type, config);
|
|
114
|
+
collectionByEntity.set(keyFor(type, entity.id), collection);
|
|
115
|
+
importable.push(entity);
|
|
116
|
+
}
|
|
117
|
+
const documents = [];
|
|
118
|
+
for (const entity of importable) {
|
|
119
|
+
// `mediaBaseUrl` flows through both the asset map (already
|
|
120
|
+
// built above) and the per-entity context so inline media
|
|
121
|
+
// objects whose `url` is a project-relative `/uploads/...`
|
|
122
|
+
// path get the same base prefixing as the metadata manifest.
|
|
123
|
+
const result = mapEntity(entity, { collectionByEntity, assetsById, linksIndex, mediaBaseUrl: config.mediaBaseUrl }, config);
|
|
124
|
+
warnings.push(...result.warnings);
|
|
125
|
+
unresolved.push(...result.unresolved);
|
|
126
|
+
documents.push({
|
|
127
|
+
collection: result.collection,
|
|
128
|
+
...(result.slug !== undefined ? { slug: result.slug } : {}),
|
|
129
|
+
sourceId: result.sourceId,
|
|
130
|
+
sourceType: result.sourceType,
|
|
131
|
+
data: result.data,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
if (config.importAssets) {
|
|
135
|
+
const assetCollection = config.assetCollection ?? 'assets';
|
|
136
|
+
for (const [id, asset] of assetsById) {
|
|
137
|
+
if (!asset.url) {
|
|
138
|
+
warnings.push({
|
|
139
|
+
source: { type: 'plugin::upload.file', id },
|
|
140
|
+
code: 'asset-without-url',
|
|
141
|
+
message: `Asset '${id}' has no URL in assets/metadata.jsonl — skipping importAssets emission.`,
|
|
142
|
+
});
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
documents.push({
|
|
146
|
+
collection: assetCollection,
|
|
147
|
+
sourceId: id,
|
|
148
|
+
sourceType: 'plugin::upload.file',
|
|
149
|
+
data: {
|
|
150
|
+
url: asset.url,
|
|
151
|
+
...(asset.fileName ? { fileName: asset.fileName } : {}),
|
|
152
|
+
...(asset.contentType ? { contentType: asset.contentType } : {}),
|
|
153
|
+
...(asset.size !== undefined ? { size: asset.size } : {}),
|
|
154
|
+
...(asset.width !== undefined ? { width: asset.width } : {}),
|
|
155
|
+
...(asset.height !== undefined ? { height: asset.height } : {}),
|
|
156
|
+
...(asset.alternativeText ? { alternativeText: asset.alternativeText } : {}),
|
|
157
|
+
...(asset.caption ? { caption: asset.caption } : {}),
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return buildResult({
|
|
163
|
+
adapter: strapiAdapter.name,
|
|
164
|
+
documents,
|
|
165
|
+
warnings,
|
|
166
|
+
unresolved,
|
|
167
|
+
totals: {
|
|
168
|
+
totalRead: loaded.totalEntityLines,
|
|
169
|
+
converted: documents.length,
|
|
170
|
+
skipped,
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
function readConfig(raw) {
|
|
176
|
+
if (raw === null || typeof raw !== 'object' || Array.isArray(raw))
|
|
177
|
+
return {};
|
|
178
|
+
const r = raw;
|
|
179
|
+
const out = {};
|
|
180
|
+
if (r.typeMap && typeof r.typeMap === 'object' && !Array.isArray(r.typeMap)) {
|
|
181
|
+
const map = {};
|
|
182
|
+
for (const [k, v] of Object.entries(r.typeMap)) {
|
|
183
|
+
if (typeof v === 'string')
|
|
184
|
+
map[k] = v;
|
|
185
|
+
}
|
|
186
|
+
out.typeMap = map;
|
|
187
|
+
}
|
|
188
|
+
if (typeof r.primaryLocale === 'string')
|
|
189
|
+
out.primaryLocale = r.primaryLocale;
|
|
190
|
+
if (typeof r.publishedOnly === 'boolean')
|
|
191
|
+
out.publishedOnly = r.publishedOnly;
|
|
192
|
+
if (typeof r.includeSystemFields === 'boolean')
|
|
193
|
+
out.includeSystemFields = r.includeSystemFields;
|
|
194
|
+
if (typeof r.importAssets === 'boolean')
|
|
195
|
+
out.importAssets = r.importAssets;
|
|
196
|
+
if (typeof r.assetCollection === 'string')
|
|
197
|
+
out.assetCollection = r.assetCollection;
|
|
198
|
+
if (typeof r.mediaBaseUrl === 'string')
|
|
199
|
+
out.mediaBaseUrl = r.mediaBaseUrl;
|
|
200
|
+
if (Array.isArray(r.ignoreTypes)) {
|
|
201
|
+
out.ignoreTypes = r.ignoreTypes.filter((s) => typeof s === 'string');
|
|
202
|
+
}
|
|
203
|
+
return out;
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/strapi/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAS9C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA;AAGnD,MAAM,oBAAoB,GAAG;IAC3B,aAAa;IACb,aAAa;IACb,mBAAmB;IACnB,gCAAgC;IAChC,gCAAgC;IAChC,sCAAsC;IACtC,qBAAqB;IACrB,qBAAqB;IACrB,uBAAuB;CACxB,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAkB;IA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C,YAAY,CAAA;IACzE,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,GAAG,CAAC,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAA;IACnF,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sidecar-relation index for the Strapi adapter.
|
|
3
|
+
*
|
|
4
|
+
* Strapi's data-transfer engine emits relational joins in
|
|
5
|
+
* `links/links.jsonl`, not inline on each entity. The shape is:
|
|
6
|
+
*
|
|
7
|
+
* ```json
|
|
8
|
+
* {
|
|
9
|
+
* "kind": "relation.basic",
|
|
10
|
+
* "relation": "oneToMany",
|
|
11
|
+
* "left": { "type": "api::article.article", "ref": 1, "field": "tags" },
|
|
12
|
+
* "right": { "type": "api::tag.tag", "ref": 5 }
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* To map a Strapi entity we have to look up every link where
|
|
17
|
+
* `left = (type, ref)` and weave the targets back onto
|
|
18
|
+
* `entity.data[field]`. This module builds the lookup index up
|
|
19
|
+
* front; the field mapper consults it per entity.
|
|
20
|
+
*
|
|
21
|
+
* The index keys on the **source side**. Strapi also emits the
|
|
22
|
+
* mirror link for many-to-many relations (`right` becomes
|
|
23
|
+
* `left`), but the adapter ignores the mirror because every
|
|
24
|
+
* relation should be owned by exactly one Prenta field.
|
|
25
|
+
*
|
|
26
|
+
* Two specialisations live here:
|
|
27
|
+
*
|
|
28
|
+
* - **`localizations` links** — Strapi i18n produces these
|
|
29
|
+
* automatically. They go into a separate index so the field
|
|
30
|
+
* mapper can either drop them (default) or surface them when
|
|
31
|
+
* `includeSystemFields: true`.
|
|
32
|
+
* - **Self-referential links without a `field`** — happen for
|
|
33
|
+
* polymorphic relations and a few plugin types. We index them
|
|
34
|
+
* under a `__unfielded` key so the mapper can warn instead of
|
|
35
|
+
* silently swallowing them.
|
|
36
|
+
*/
|
|
37
|
+
import type { StrapiLinkRecord, StrapiUid } from './types.js';
|
|
38
|
+
export interface LinkTarget {
|
|
39
|
+
type: StrapiUid;
|
|
40
|
+
ref: string;
|
|
41
|
+
/**
|
|
42
|
+
* Strapi's relation kind for this link — `oneToOne`,
|
|
43
|
+
* `oneToMany`, `manyToOne`, `manyToMany`, etc. Used by the
|
|
44
|
+
* field mapper to decide single-vs-array emission. May be
|
|
45
|
+
* absent on hand-edited link records.
|
|
46
|
+
*/
|
|
47
|
+
relation?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Lookup: `(sourceType, sourceRef) → fieldName → LinkTarget[]`.
|
|
51
|
+
* Refs are stored as strings so the field mapper can hash them
|
|
52
|
+
* without worrying about Strapi's numeric ids vs Prenta's
|
|
53
|
+
* stringified `sourceId`s.
|
|
54
|
+
*/
|
|
55
|
+
export type LinksIndex = Map<string, Map<string, LinkTarget[]>>;
|
|
56
|
+
export interface IndexedLinks {
|
|
57
|
+
index: LinksIndex;
|
|
58
|
+
/** Same lookup, but for Strapi's i18n `localizations` field only. */
|
|
59
|
+
localizations: LinksIndex;
|
|
60
|
+
/**
|
|
61
|
+
* Links the adapter saw but couldn't attribute to a named field
|
|
62
|
+
* (`left.field` was missing or empty). Keyed only on source —
|
|
63
|
+
* surfaced as warnings during mapping.
|
|
64
|
+
*/
|
|
65
|
+
unfielded: Map<string, LinkTarget[]>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Compose the per-entity lookup keys. Exported so tests can
|
|
69
|
+
* exercise the index without reimplementing the encoding.
|
|
70
|
+
*/
|
|
71
|
+
export declare function keyFor(type: StrapiUid, ref: number | string): string;
|
|
72
|
+
export declare function buildLinksIndex(links: readonly StrapiLinkRecord[]): IndexedLinks;
|
|
73
|
+
/**
|
|
74
|
+
* Look up every link this entity owns. Convenience wrapper around
|
|
75
|
+
* the nested-map encoding — the field mapper uses this to weave
|
|
76
|
+
* targets back into `data[field]`.
|
|
77
|
+
*/
|
|
78
|
+
export declare function targetsFor(index: LinksIndex, type: StrapiUid, ref: number | string): Map<string, LinkTarget[]> | undefined;
|
|
79
|
+
//# sourceMappingURL=links.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../../../src/adapters/strapi/links.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE7D,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,SAAS,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,CAAA;AAE/D,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,UAAU,CAAA;IACjB,qEAAqE;IACrE,aAAa,EAAE,UAAU,CAAA;IACzB;;;;OAIG;IACH,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAA;CACrC;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAEpE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,gBAAgB,EAAE,GAAG,YAAY,CAoChF;AAaD;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,SAAS,EACf,GAAG,EAAE,MAAM,GAAG,MAAM,GACnB,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,GAAG,SAAS,CAEvC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sidecar-relation index for the Strapi adapter.
|
|
3
|
+
*
|
|
4
|
+
* Strapi's data-transfer engine emits relational joins in
|
|
5
|
+
* `links/links.jsonl`, not inline on each entity. The shape is:
|
|
6
|
+
*
|
|
7
|
+
* ```json
|
|
8
|
+
* {
|
|
9
|
+
* "kind": "relation.basic",
|
|
10
|
+
* "relation": "oneToMany",
|
|
11
|
+
* "left": { "type": "api::article.article", "ref": 1, "field": "tags" },
|
|
12
|
+
* "right": { "type": "api::tag.tag", "ref": 5 }
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* To map a Strapi entity we have to look up every link where
|
|
17
|
+
* `left = (type, ref)` and weave the targets back onto
|
|
18
|
+
* `entity.data[field]`. This module builds the lookup index up
|
|
19
|
+
* front; the field mapper consults it per entity.
|
|
20
|
+
*
|
|
21
|
+
* The index keys on the **source side**. Strapi also emits the
|
|
22
|
+
* mirror link for many-to-many relations (`right` becomes
|
|
23
|
+
* `left`), but the adapter ignores the mirror because every
|
|
24
|
+
* relation should be owned by exactly one Prenta field.
|
|
25
|
+
*
|
|
26
|
+
* Two specialisations live here:
|
|
27
|
+
*
|
|
28
|
+
* - **`localizations` links** — Strapi i18n produces these
|
|
29
|
+
* automatically. They go into a separate index so the field
|
|
30
|
+
* mapper can either drop them (default) or surface them when
|
|
31
|
+
* `includeSystemFields: true`.
|
|
32
|
+
* - **Self-referential links without a `field`** — happen for
|
|
33
|
+
* polymorphic relations and a few plugin types. We index them
|
|
34
|
+
* under a `__unfielded` key so the mapper can warn instead of
|
|
35
|
+
* silently swallowing them.
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* Compose the per-entity lookup keys. Exported so tests can
|
|
39
|
+
* exercise the index without reimplementing the encoding.
|
|
40
|
+
*/
|
|
41
|
+
export function keyFor(type, ref) {
|
|
42
|
+
return `${type}\u0001${String(ref)}`;
|
|
43
|
+
}
|
|
44
|
+
export function buildLinksIndex(links) {
|
|
45
|
+
const index = new Map();
|
|
46
|
+
const localizations = new Map();
|
|
47
|
+
const unfielded = new Map();
|
|
48
|
+
for (const link of links) {
|
|
49
|
+
if (!link?.left || !link?.right)
|
|
50
|
+
continue;
|
|
51
|
+
const leftType = typeof link.left.type === 'string' ? link.left.type : '';
|
|
52
|
+
const rightType = typeof link.right.type === 'string' ? link.right.type : '';
|
|
53
|
+
const leftRef = link.left.ref;
|
|
54
|
+
const rightRef = link.right.ref;
|
|
55
|
+
if (!leftType || !rightType)
|
|
56
|
+
continue;
|
|
57
|
+
if (leftRef === undefined || leftRef === null)
|
|
58
|
+
continue;
|
|
59
|
+
if (rightRef === undefined || rightRef === null)
|
|
60
|
+
continue;
|
|
61
|
+
const field = typeof link.left.field === 'string' ? link.left.field : '';
|
|
62
|
+
const target = { type: rightType, ref: String(rightRef) };
|
|
63
|
+
if (typeof link.relation === 'string')
|
|
64
|
+
target.relation = link.relation;
|
|
65
|
+
const sourceKey = keyFor(leftType, leftRef);
|
|
66
|
+
if (field === 'localizations') {
|
|
67
|
+
addInto(localizations, sourceKey, field, target);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (field === '') {
|
|
71
|
+
const list = unfielded.get(sourceKey) ?? [];
|
|
72
|
+
list.push(target);
|
|
73
|
+
unfielded.set(sourceKey, list);
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
addInto(index, sourceKey, field, target);
|
|
77
|
+
}
|
|
78
|
+
return { index, localizations, unfielded };
|
|
79
|
+
}
|
|
80
|
+
function addInto(index, sourceKey, field, target) {
|
|
81
|
+
let perField = index.get(sourceKey);
|
|
82
|
+
if (!perField) {
|
|
83
|
+
perField = new Map();
|
|
84
|
+
index.set(sourceKey, perField);
|
|
85
|
+
}
|
|
86
|
+
const list = perField.get(field) ?? [];
|
|
87
|
+
list.push(target);
|
|
88
|
+
perField.set(field, list);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Look up every link this entity owns. Convenience wrapper around
|
|
92
|
+
* the nested-map encoding — the field mapper uses this to weave
|
|
93
|
+
* targets back into `data[field]`.
|
|
94
|
+
*/
|
|
95
|
+
export function targetsFor(index, type, ref) {
|
|
96
|
+
return index.get(keyFor(type, ref));
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"links.js","sourceRoot":"","sources":["../../../src/adapters/strapi/links.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAoCH;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,IAAe,EAAE,GAAoB;IAC1D,OAAO,GAAG,IAAI,SAAS,MAAM,CAAC,GAAG,CAAC,EAAE,CAAA;AACtC,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAkC;IAChE,MAAM,KAAK,GAAe,IAAI,GAAG,EAAE,CAAA;IACnC,MAAM,aAAa,GAAe,IAAI,GAAG,EAAE,CAAA;IAC3C,MAAM,SAAS,GAA8B,IAAI,GAAG,EAAE,CAAA;IAEtD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK;YAAE,SAAQ;QACzC,MAAM,QAAQ,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAA;QACzE,MAAM,SAAS,GAAG,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAA;QAC5E,MAAM,OAAO,GAAG,IAAI,C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AAE,SAAS,EAAE,CAAA;AAC5C,CAAC;AAED,SAAS,OAAO,CAAC,KAAiB,EAAE,SAAiB,EAAE,KAAa,EAAE,MAAkB;IACtF,IAAI,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACnC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAA;QACpB,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;IAChC,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;IACtC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACjB,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;AAC3B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACxB,KAAiB,EACjB,IAAe,EACf,GAAoB;IAEpB,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAA;AACrC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filesystem loader for a Strapi `data-transfer` dataset.
|
|
3
|
+
*
|
|
4
|
+
* The CLI accepts the path to the extracted dataset root (the
|
|
5
|
+
* directory produced by `tar -xzf strapi-export.tar.gz`). The
|
|
6
|
+
* loader inspects that directory and produces the three things
|
|
7
|
+
* the adapter actually consumes:
|
|
8
|
+
*
|
|
9
|
+
* - `entities` — every `entities/*.jsonl` file, joined into a
|
|
10
|
+
* single stream of `StrapiEntityRecord`s.
|
|
11
|
+
* - `assets` — `assets/metadata.jsonl` if present.
|
|
12
|
+
* - `links` — `links/links.jsonl` if present.
|
|
13
|
+
*
|
|
14
|
+
* Single-file convenience: if `input` points at a `.jsonl` file
|
|
15
|
+
* directly (e.g. operators who only have one content-type
|
|
16
|
+
* dump), it's treated as the sole entities source — no assets
|
|
17
|
+
* or links.
|
|
18
|
+
*
|
|
19
|
+
* NDJSON parsing is line-error tolerant; a single malformed line
|
|
20
|
+
* produces a `parse-error` warning, not a hard failure.
|
|
21
|
+
*/
|
|
22
|
+
import type { ImportWarning } from '../../types.js';
|
|
23
|
+
import type { StrapiAssetRecord, StrapiEntityRecord, StrapiLinkRecord } from './types.js';
|
|
24
|
+
export interface LoadedDataset {
|
|
25
|
+
entities: StrapiEntityRecord[];
|
|
26
|
+
assets: StrapiAssetRecord[];
|
|
27
|
+
links: StrapiLinkRecord[];
|
|
28
|
+
warnings: ImportWarning[];
|
|
29
|
+
/**
|
|
30
|
+
* Total number of non-blank lines the loader attempted to read
|
|
31
|
+
* from `entities/*.jsonl` — including lines that failed to parse
|
|
32
|
+
* or that didn't have a recognizable Strapi entity shape. Drives
|
|
33
|
+
* `summary.totalRead` so the adapter reports the read-attempt
|
|
34
|
+
* count, not the post-validation count.
|
|
35
|
+
*/
|
|
36
|
+
totalEntityLines: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Read a dataset rooted at `inputPath`. Returns a defensively-
|
|
40
|
+
* shaped result even when input is missing or partially malformed
|
|
41
|
+
* — the adapter wraps that into `UnresolvedField`s where
|
|
42
|
+
* appropriate.
|
|
43
|
+
*/
|
|
44
|
+
export declare function loadDataset(inputPath: string): LoadedDataset;
|
|
45
|
+
/**
|
|
46
|
+
* Read one NDJSON file. Tolerates blank lines and CRLF; records
|
|
47
|
+
* a `parse-error` warning per malformed line and keeps going.
|
|
48
|
+
*
|
|
49
|
+
* Returns both the parsed records and `totalLines` — the count of
|
|
50
|
+
* non-blank lines the loader actually attempted to read. Callers
|
|
51
|
+
* use `totalLines` for read-attempt tallies (e.g. the entities
|
|
52
|
+
* pass funneling into `summary.totalRead`). For assets / links
|
|
53
|
+
* it's typically ignored.
|
|
54
|
+
*/
|
|
55
|
+
export interface NdjsonReadResult {
|
|
56
|
+
parsed: unknown[];
|
|
57
|
+
/**
|
|
58
|
+
* Non-blank lines attempted, including ones that failed to parse.
|
|
59
|
+
* Blank / whitespace-only lines are not counted because they
|
|
60
|
+
* never represent a record attempt.
|
|
61
|
+
*/
|
|
62
|
+
totalLines: number;
|
|
63
|
+
}
|
|
64
|
+
export declare function readNdjson(filePath: string, warnings: ImportWarning[], context: {
|
|
65
|
+
kind: 'entities' | 'assets' | 'links';
|
|
66
|
+
file: string;
|
|
67
|
+
}): NdjsonReadResult;
|
|
68
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/adapters/strapi/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAEzF,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,kBAAkB,EAAE,CAAA;IAC9B,MAAM,EAAE,iBAAiB,EAAE,CAAA;IAC3B,KAAK,EAAE,gBAAgB,EAAE,CAAA;IACzB,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB;;;;;;OAMG;IACH,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,CA0E5D;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,OAAO,EAAE,CAAA;IACjB;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,UAAU,CACxB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,aAAa,EAAE,EACzB,OAAO,EAAE;IAAE,IAAI,EAAE,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC/D,gBAAgB,CAgClB"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filesystem loader for a Strapi `data-transfer` dataset.
|
|
3
|
+
*
|
|
4
|
+
* The CLI accepts the path to the extracted dataset root (the
|
|
5
|
+
* directory produced by `tar -xzf strapi-export.tar.gz`). The
|
|
6
|
+
* loader inspects that directory and produces the three things
|
|
7
|
+
* the adapter actually consumes:
|
|
8
|
+
*
|
|
9
|
+
* - `entities` — every `entities/*.jsonl` file, joined into a
|
|
10
|
+
* single stream of `StrapiEntityRecord`s.
|
|
11
|
+
* - `assets` — `assets/metadata.jsonl` if present.
|
|
12
|
+
* - `links` — `links/links.jsonl` if present.
|
|
13
|
+
*
|
|
14
|
+
* Single-file convenience: if `input` points at a `.jsonl` file
|
|
15
|
+
* directly (e.g. operators who only have one content-type
|
|
16
|
+
* dump), it's treated as the sole entities source — no assets
|
|
17
|
+
* or links.
|
|
18
|
+
*
|
|
19
|
+
* NDJSON parsing is line-error tolerant; a single malformed line
|
|
20
|
+
* produces a `parse-error` warning, not a hard failure.
|
|
21
|
+
*/
|
|
22
|
+
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
|
23
|
+
import { join } from 'node:path';
|
|
24
|
+
/**
|
|
25
|
+
* Read a dataset rooted at `inputPath`. Returns a defensively-
|
|
26
|
+
* shaped result even when input is missing or partially malformed
|
|
27
|
+
* — the adapter wraps that into `UnresolvedField`s where
|
|
28
|
+
* appropriate.
|
|
29
|
+
*/
|
|
30
|
+
export function loadDataset(inputPath) {
|
|
31
|
+
const warnings = [];
|
|
32
|
+
const entities = [];
|
|
33
|
+
const assets = [];
|
|
34
|
+
const links = [];
|
|
35
|
+
let totalEntityLines = 0;
|
|
36
|
+
if (!existsSync(inputPath)) {
|
|
37
|
+
return { entities, assets, links, warnings, totalEntityLines };
|
|
38
|
+
}
|
|
39
|
+
const stat = statSync(inputPath);
|
|
40
|
+
if (stat.isFile()) {
|
|
41
|
+
// Single-file mode: treat the file as one entities/*.jsonl
|
|
42
|
+
// stream. We can't infer the UID from a filename, so each
|
|
43
|
+
// entry must carry `type` inline (which the data-transfer
|
|
44
|
+
// format does).
|
|
45
|
+
const { parsed, totalLines } = readNdjson(inputPath, warnings, {
|
|
46
|
+
kind: 'entities',
|
|
47
|
+
file: inputPath,
|
|
48
|
+
});
|
|
49
|
+
totalEntityLines += totalLines;
|
|
50
|
+
for (const line of parsed) {
|
|
51
|
+
const entity = coerceEntity(line, inputPath);
|
|
52
|
+
if (entity)
|
|
53
|
+
entities.push(entity);
|
|
54
|
+
}
|
|
55
|
+
return { entities, assets, links, warnings, totalEntityLines };
|
|
56
|
+
}
|
|
57
|
+
// Directory mode — canonical dataset layout.
|
|
58
|
+
const entitiesDir = join(inputPath, 'entities');
|
|
59
|
+
if (existsSync(entitiesDir) && statSync(entitiesDir).isDirectory()) {
|
|
60
|
+
for (const file of readdirSync(entitiesDir)) {
|
|
61
|
+
if (!file.endsWith('.jsonl'))
|
|
62
|
+
continue;
|
|
63
|
+
const full = join(entitiesDir, file);
|
|
64
|
+
const { parsed, totalLines } = readNdjson(full, warnings, { kind: 'entities', file });
|
|
65
|
+
totalEntityLines += totalLines;
|
|
66
|
+
for (const line of parsed) {
|
|
67
|
+
const entity = coerceEntity(line, file);
|
|
68
|
+
if (entity)
|
|
69
|
+
entities.push(entity);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const assetsFile = join(inputPath, 'assets', 'metadata.jsonl');
|
|
74
|
+
if (existsSync(assetsFile)) {
|
|
75
|
+
const { parsed } = readNdjson(assetsFile, warnings, { kind: 'assets', file: 'metadata.jsonl' });
|
|
76
|
+
for (const line of parsed) {
|
|
77
|
+
if (line && typeof line === 'object' && !Array.isArray(line)) {
|
|
78
|
+
const rec = line;
|
|
79
|
+
if (rec.id !== undefined)
|
|
80
|
+
assets.push(rec);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const linksFile = join(inputPath, 'links', 'links.jsonl');
|
|
85
|
+
if (existsSync(linksFile)) {
|
|
86
|
+
const { parsed } = readNdjson(linksFile, warnings, { kind: 'links', file: 'links.jsonl' });
|
|
87
|
+
for (const line of parsed) {
|
|
88
|
+
if (line && typeof line === 'object' && !Array.isArray(line)) {
|
|
89
|
+
const rec = line;
|
|
90
|
+
if (rec.left &&
|
|
91
|
+
rec.right &&
|
|
92
|
+
typeof rec.left === 'object' &&
|
|
93
|
+
typeof rec.right === 'object') {
|
|
94
|
+
links.push(rec);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return { entities, assets, links, warnings, totalEntityLines };
|
|
100
|
+
}
|
|
101
|
+
export function readNdjson(filePath, warnings, context) {
|
|
102
|
+
let raw;
|
|
103
|
+
try {
|
|
104
|
+
raw = readFileSync(filePath, 'utf-8');
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
warnings.push({
|
|
108
|
+
source: {},
|
|
109
|
+
code: 'read-error',
|
|
110
|
+
message: `Failed to read '${context.file}': ${err.message}`,
|
|
111
|
+
});
|
|
112
|
+
return { parsed: [], totalLines: 0 };
|
|
113
|
+
}
|
|
114
|
+
// Strip BOM if present.
|
|
115
|
+
if (raw.charCodeAt(0) === 0xfeff)
|
|
116
|
+
raw = raw.slice(1);
|
|
117
|
+
const parsed = [];
|
|
118
|
+
let totalLines = 0;
|
|
119
|
+
const lines = raw.split(/\r?\n/);
|
|
120
|
+
for (let i = 0; i < lines.length; i++) {
|
|
121
|
+
const line = lines[i];
|
|
122
|
+
if (line.length === 0 || /^\s*$/.test(line))
|
|
123
|
+
continue;
|
|
124
|
+
totalLines++;
|
|
125
|
+
try {
|
|
126
|
+
parsed.push(JSON.parse(line));
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
warnings.push({
|
|
130
|
+
source: {},
|
|
131
|
+
code: 'parse-error',
|
|
132
|
+
message: `Could not parse JSON on line ${i + 1} of '${context.file}': ${err.message}`,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return { parsed, totalLines };
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Defensive entity coercion — Strapi data-transfer always wraps
|
|
140
|
+
* with `{ id, type, data }`, but hand-edited single-file exports
|
|
141
|
+
* sometimes pass the entry's data directly. We support both
|
|
142
|
+
* shapes; the wrapped form takes precedence when both keys are
|
|
143
|
+
* present.
|
|
144
|
+
*/
|
|
145
|
+
function coerceEntity(line, source) {
|
|
146
|
+
if (line === null || typeof line !== 'object' || Array.isArray(line))
|
|
147
|
+
return null;
|
|
148
|
+
const rec = line;
|
|
149
|
+
// Canonical wrapped form: { id, type, data }
|
|
150
|
+
if ((typeof rec.id === 'number' || typeof rec.id === 'string') &&
|
|
151
|
+
typeof rec.type === 'string' &&
|
|
152
|
+
rec.data !== null &&
|
|
153
|
+
typeof rec.data === 'object') {
|
|
154
|
+
return {
|
|
155
|
+
id: rec.id,
|
|
156
|
+
type: rec.type,
|
|
157
|
+
data: rec.data,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
// Unwrapped fallback: assume the whole object is the data, with
|
|
161
|
+
// `id` and `__type` at top level. This matches the Strapi v3
|
|
162
|
+
// bulk-export convention.
|
|
163
|
+
if ((typeof rec.id === 'number' || typeof rec.id === 'string') &&
|
|
164
|
+
typeof rec.__type === 'string') {
|
|
165
|
+
const { __type, ...rest } = rec;
|
|
166
|
+
return {
|
|
167
|
+
id: rec.id,
|
|
168
|
+
type: __type,
|
|
169
|
+
data: rest,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
// Couldn't figure out the shape — silently drop. The adapter
|
|
173
|
+
// will surface a totals discrepancy if the operator notices.
|
|
174
|
+
void source;
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|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