@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.
Files changed (144) hide show
  1. package/CHANGELOG.md +686 -0
  2. package/LICENSE +21 -0
  3. package/README.md +24 -0
  4. package/dist/adapter.d.ts +47 -0
  5. package/dist/adapter.d.ts.map +1 -0
  6. package/dist/adapter.js +60 -0
  7. package/dist/adapter.js.map +1 -0
  8. package/dist/adapters/contentful/asset.d.ts +47 -0
  9. package/dist/adapters/contentful/asset.d.ts.map +1 -0
  10. package/dist/adapters/contentful/asset.js +88 -0
  11. package/dist/adapters/contentful/asset.js.map +1 -0
  12. package/dist/adapters/contentful/index.d.ts +24 -0
  13. package/dist/adapters/contentful/index.d.ts.map +1 -0
  14. package/dist/adapters/contentful/index.js +242 -0
  15. package/dist/adapters/contentful/index.js.map +1 -0
  16. package/dist/adapters/contentful/locale.d.ts +66 -0
  17. package/dist/adapters/contentful/locale.d.ts.map +1 -0
  18. package/dist/adapters/contentful/locale.js +125 -0
  19. package/dist/adapters/contentful/locale.js.map +1 -0
  20. package/dist/adapters/contentful/map.d.ts +69 -0
  21. package/dist/adapters/contentful/map.d.ts.map +1 -0
  22. package/dist/adapters/contentful/map.js +174 -0
  23. package/dist/adapters/contentful/map.js.map +1 -0
  24. package/dist/adapters/contentful/rich-text.d.ts +52 -0
  25. package/dist/adapters/contentful/rich-text.d.ts.map +1 -0
  26. package/dist/adapters/contentful/rich-text.js +95 -0
  27. package/dist/adapters/contentful/rich-text.js.map +1 -0
  28. package/dist/adapters/contentful/types.d.ts +189 -0
  29. package/dist/adapters/contentful/types.d.ts.map +1 -0
  30. package/dist/adapters/contentful/types.js +26 -0
  31. package/dist/adapters/contentful/types.js.map +1 -0
  32. package/dist/adapters/identity.d.ts +27 -0
  33. package/dist/adapters/identity.d.ts.map +1 -0
  34. package/dist/adapters/identity.js +116 -0
  35. package/dist/adapters/identity.js.map +1 -0
  36. package/dist/adapters/sanity/asset.d.ts +45 -0
  37. package/dist/adapters/sanity/asset.d.ts.map +1 -0
  38. package/dist/adapters/sanity/asset.js +79 -0
  39. package/dist/adapters/sanity/asset.js.map +1 -0
  40. package/dist/adapters/sanity/index.d.ts +19 -0
  41. package/dist/adapters/sanity/index.d.ts.map +1 -0
  42. package/dist/adapters/sanity/index.js +165 -0
  43. package/dist/adapters/sanity/index.js.map +1 -0
  44. package/dist/adapters/sanity/map.d.ts +75 -0
  45. package/dist/adapters/sanity/map.d.ts.map +1 -0
  46. package/dist/adapters/sanity/map.js +245 -0
  47. package/dist/adapters/sanity/map.js.map +1 -0
  48. package/dist/adapters/sanity/parse.d.ts +64 -0
  49. package/dist/adapters/sanity/parse.d.ts.map +1 -0
  50. package/dist/adapters/sanity/parse.js +71 -0
  51. package/dist/adapters/sanity/parse.js.map +1 -0
  52. package/dist/adapters/sanity/portable-text.d.ts +64 -0
  53. package/dist/adapters/sanity/portable-text.d.ts.map +1 -0
  54. package/dist/adapters/sanity/portable-text.js +112 -0
  55. package/dist/adapters/sanity/portable-text.js.map +1 -0
  56. package/dist/adapters/sanity/types.d.ts +182 -0
  57. package/dist/adapters/sanity/types.d.ts.map +1 -0
  58. package/dist/adapters/sanity/types.js +17 -0
  59. package/dist/adapters/sanity/types.js.map +1 -0
  60. package/dist/adapters/strapi/asset.d.ts +56 -0
  61. package/dist/adapters/strapi/asset.d.ts.map +1 -0
  62. package/dist/adapters/strapi/asset.js +94 -0
  63. package/dist/adapters/strapi/asset.js.map +1 -0
  64. package/dist/adapters/strapi/index.d.ts +20 -0
  65. package/dist/adapters/strapi/index.d.ts.map +1 -0
  66. package/dist/adapters/strapi/index.js +205 -0
  67. package/dist/adapters/strapi/index.js.map +1 -0
  68. package/dist/adapters/strapi/links.d.ts +79 -0
  69. package/dist/adapters/strapi/links.d.ts.map +1 -0
  70. package/dist/adapters/strapi/links.js +98 -0
  71. package/dist/adapters/strapi/links.js.map +1 -0
  72. package/dist/adapters/strapi/loader.d.ts +68 -0
  73. package/dist/adapters/strapi/loader.d.ts.map +1 -0
  74. package/dist/adapters/strapi/loader.js +177 -0
  75. package/dist/adapters/strapi/loader.js.map +1 -0
  76. package/dist/adapters/strapi/map.d.ts +53 -0
  77. package/dist/adapters/strapi/map.d.ts.map +1 -0
  78. package/dist/adapters/strapi/map.js +193 -0
  79. package/dist/adapters/strapi/map.js.map +1 -0
  80. package/dist/adapters/strapi/types.d.ts +174 -0
  81. package/dist/adapters/strapi/types.d.ts.map +1 -0
  82. package/dist/adapters/strapi/types.js +31 -0
  83. package/dist/adapters/strapi/types.js.map +1 -0
  84. package/dist/adapters/strapi/uid.d.ts +44 -0
  85. package/dist/adapters/strapi/uid.d.ts.map +1 -0
  86. package/dist/adapters/strapi/uid.js +58 -0
  87. package/dist/adapters/strapi/uid.js.map +1 -0
  88. package/dist/adapters/wordpress/attachments.d.ts +37 -0
  89. package/dist/adapters/wordpress/attachments.d.ts.map +1 -0
  90. package/dist/adapters/wordpress/attachments.js +134 -0
  91. package/dist/adapters/wordpress/attachments.js.map +1 -0
  92. package/dist/adapters/wordpress/authors.d.ts +24 -0
  93. package/dist/adapters/wordpress/authors.d.ts.map +1 -0
  94. package/dist/adapters/wordpress/authors.js +40 -0
  95. package/dist/adapters/wordpress/authors.js.map +1 -0
  96. package/dist/adapters/wordpress/index.d.ts +19 -0
  97. package/dist/adapters/wordpress/index.d.ts.map +1 -0
  98. package/dist/adapters/wordpress/index.js +281 -0
  99. package/dist/adapters/wordpress/index.js.map +1 -0
  100. package/dist/adapters/wordpress/map.d.ts +61 -0
  101. package/dist/adapters/wordpress/map.d.ts.map +1 -0
  102. package/dist/adapters/wordpress/map.js +265 -0
  103. package/dist/adapters/wordpress/map.js.map +1 -0
  104. package/dist/adapters/wordpress/parse.d.ts +50 -0
  105. package/dist/adapters/wordpress/parse.d.ts.map +1 -0
  106. package/dist/adapters/wordpress/parse.js +141 -0
  107. package/dist/adapters/wordpress/parse.js.map +1 -0
  108. package/dist/adapters/wordpress/terms.d.ts +46 -0
  109. package/dist/adapters/wordpress/terms.d.ts.map +1 -0
  110. package/dist/adapters/wordpress/terms.js +87 -0
  111. package/dist/adapters/wordpress/terms.js.map +1 -0
  112. package/dist/adapters/wordpress/types.d.ts +201 -0
  113. package/dist/adapters/wordpress/types.d.ts.map +1 -0
  114. package/dist/adapters/wordpress/types.js +24 -0
  115. package/dist/adapters/wordpress/types.js.map +1 -0
  116. package/dist/cli.d.ts +16 -0
  117. package/dist/cli.d.ts.map +1 -0
  118. package/dist/cli.js +266 -0
  119. package/dist/cli.js.map +1 -0
  120. package/dist/formatter.d.ts +12 -0
  121. package/dist/formatter.d.ts.map +1 -0
  122. package/dist/formatter.js +48 -0
  123. package/dist/formatter.js.map +1 -0
  124. package/dist/index.d.ts +31 -0
  125. package/dist/index.d.ts.map +1 -0
  126. package/dist/index.js +25 -0
  127. package/dist/index.js.map +1 -0
  128. package/dist/migrate.d.ts +151 -0
  129. package/dist/migrate.d.ts.map +1 -0
  130. package/dist/migrate.js +255 -0
  131. package/dist/migrate.js.map +1 -0
  132. package/dist/registry.d.ts +39 -0
  133. package/dist/registry.d.ts.map +1 -0
  134. package/dist/registry.js +62 -0
  135. package/dist/registry.js.map +1 -0
  136. package/dist/runner.d.ts +33 -0
  137. package/dist/runner.d.ts.map +1 -0
  138. package/dist/runner.js +61 -0
  139. package/dist/runner.js.map +1 -0
  140. package/dist/types.d.ts +173 -0
  141. package/dist/types.d.ts.map +1 -0
  142. package/dist/types.js +17 -0
  143. package/dist/types.js.map +1 -0
  144. package/package.json +59 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Actuate Media
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # @prenta/import
2
+
3
+ Migrate content into [Prenta CMS](https://github.com/actuate-media/prenta)
4
+ from external CMSs — Sanity, Contentful, Strapi, WordPress — via pluggable
5
+ adapters.
6
+
7
+ ```bash
8
+ npm install -D @prenta/import
9
+ ```
10
+
11
+ Typically driven through the CLI:
12
+
13
+ ```bash
14
+ prenta import --from wordpress --source export.xml
15
+ ```
16
+
17
+ ## Release notes
18
+
19
+ See [CHANGELOG.md](./CHANGELOG.md) (shipped with the package) or the
20
+ [GitHub releases](https://github.com/actuate-media/prenta/releases).
21
+
22
+ ## License
23
+
24
+ MIT
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Adapter-author helpers. Anything an adapter implementation reaches
3
+ * for that isn't pure framework plumbing lives here, so external
4
+ * adapters (published as their own packages) can compose without
5
+ * pulling in the full CLI surface.
6
+ *
7
+ * The framework re-exports these from the main entry point too — this
8
+ * file is the single source of truth so the public API and the
9
+ * adapter-author API can't drift.
10
+ */
11
+ import type { ImportResult, ImportSummary, ImportedDocument, ImportWarning, UnresolvedField } from './types.js';
12
+ /**
13
+ * Build a complete {@link ImportSummary} from the running totals an
14
+ * adapter has tracked. Centralized so every adapter agrees on the
15
+ * `importedAt` timestamp format and field ordering.
16
+ */
17
+ export declare function buildSummary(adapter: string, totals: {
18
+ totalRead: number;
19
+ converted: number;
20
+ skipped: number;
21
+ }, now?: Date): ImportSummary;
22
+ /**
23
+ * Build a complete {@link ImportResult} from the loose pieces an
24
+ * adapter typically tracks during a run. Keeps adapters from
25
+ * forgetting to set `unresolved: []` etc.
26
+ */
27
+ export declare function buildResult(input: {
28
+ adapter: string;
29
+ documents: ImportedDocument[];
30
+ warnings?: ImportWarning[];
31
+ unresolved?: UnresolvedField[];
32
+ totals: {
33
+ totalRead: number;
34
+ converted: number;
35
+ skipped: number;
36
+ };
37
+ now?: Date;
38
+ }): ImportResult;
39
+ /**
40
+ * Light-weight runtime check that a value structurally matches the
41
+ * `ImportedDocument` contract. Useful for the identity adapter and
42
+ * for adapter tests that want to assert "everything I emit is shaped
43
+ * correctly" without pulling in a full schema library.
44
+ */
45
+ export declare function isImportedDocument(value: unknown): value is ImportedDocument;
46
+ export type { AdapterOptions, ImportAdapter, ImportedDocument, ImportResult, ImportSummary, ImportWarning, UnresolvedField, } from './types.js';
47
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,eAAe,EAChB,MAAM,YAAY,CAAA;AAEnB;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EACjE,GAAG,GAAE,IAAiB,GACrB,aAAa,CAQf;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,gBAAgB,EAAE,CAAA;IAC7B,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAA;IAC1B,UAAU,CAAC,EAAE,eAAe,EAAE,CAAA;IAC9B,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;IACjE,GAAG,CAAC,EAAE,IAAI,CAAA;CACX,GAAG,YAAY,CAOf;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAS5E;AAED,YAAY,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,eAAe,GAChB,MAAM,YAAY,CAAA"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Adapter-author helpers. Anything an adapter implementation reaches
3
+ * for that isn't pure framework plumbing lives here, so external
4
+ * adapters (published as their own packages) can compose without
5
+ * pulling in the full CLI surface.
6
+ *
7
+ * The framework re-exports these from the main entry point too — this
8
+ * file is the single source of truth so the public API and the
9
+ * adapter-author API can't drift.
10
+ */
11
+ /**
12
+ * Build a complete {@link ImportSummary} from the running totals an
13
+ * adapter has tracked. Centralized so every adapter agrees on the
14
+ * `importedAt` timestamp format and field ordering.
15
+ */
16
+ export function buildSummary(adapter, totals, now = new Date()) {
17
+ return {
18
+ adapter,
19
+ totalRead: totals.totalRead,
20
+ converted: totals.converted,
21
+ skipped: totals.skipped,
22
+ importedAt: now.toISOString(),
23
+ };
24
+ }
25
+ /**
26
+ * Build a complete {@link ImportResult} from the loose pieces an
27
+ * adapter typically tracks during a run. Keeps adapters from
28
+ * forgetting to set `unresolved: []` etc.
29
+ */
30
+ export function buildResult(input) {
31
+ return {
32
+ documents: input.documents,
33
+ warnings: input.warnings ?? [],
34
+ unresolved: input.unresolved ?? [],
35
+ summary: buildSummary(input.adapter, input.totals, input.now),
36
+ };
37
+ }
38
+ /**
39
+ * Light-weight runtime check that a value structurally matches the
40
+ * `ImportedDocument` contract. Useful for the identity adapter and
41
+ * for adapter tests that want to assert "everything I emit is shaped
42
+ * correctly" without pulling in a full schema library.
43
+ */
44
+ export function isImportedDocument(value) {
45
+ if (value === null || typeof value !== 'object' || Array.isArray(value))
46
+ return false;
47
+ const v = value;
48
+ if (typeof v.collection !== 'string' || v.collection.length === 0)
49
+ return false;
50
+ if (v.data === null || typeof v.data !== 'object' || Array.isArray(v.data))
51
+ return false;
52
+ if (v.slug !== undefined && typeof v.slug !== 'string')
53
+ return false;
54
+ if (v.sourceId !== undefined && typeof v.sourceId !== 'string')
55
+ return false;
56
+ if (v.sourceType !== undefined && typeof v.sourceType !== 'string')
57
+ return false;
58
+ return true;
59
+ }
60
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAUH;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAe,EACf,MAAiE,EACjE,MAAY,IAAI,IAAI,EAAE;IAEtB,OAAO;QACL,OAAO;QACP,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,UAAU,EAAE,GAAG,CAAC,WAAW,EAAE;KAC9B,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,KAO3B;IACC,OAAO;QACL,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,EAAE;QAC9B,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,EAAE;QAClC,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC;KAC9D,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IACrF,MAAM,CAAC,GAAG,KAAgC,CAAA;IAC1C,IAAI,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IAC/E,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAA;IACxF,IAAI,CAAC,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IACpE,IAAI,CAAC,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC5E,IAAI,CAAC,CAAC,UAAU,KAAK,SAAS,IAAI,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAChF,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Asset URL resolution for the Contentful adapter.
3
+ *
4
+ * Contentful exports carry every asset as a top-level entry under
5
+ * `assets[]` with the URL declared inline (Contentful hosts media
6
+ * on its own CDN; the export embeds the final URL). The adapter
7
+ * builds an asset map from this once, then the field mapper does
8
+ * an O(1) lookup whenever it encounters an asset link.
9
+ *
10
+ * Contentful URLs in fresh exports often come back protocol-relative
11
+ * (`//images.ctfassets.net/...`). The builder normalizes them to
12
+ * `https://` so downstream consumers don't have to handle the
13
+ * leading-`//` shape.
14
+ */
15
+ import type { ContentfulAsset } from './types.js';
16
+ export interface AssetEntry {
17
+ /** Final URL (always with explicit scheme — `https://...`). */
18
+ url: string;
19
+ fileName?: string;
20
+ contentType?: string;
21
+ size?: number;
22
+ width?: number;
23
+ height?: number;
24
+ /** Asset title (locale-flattened to the primary locale). */
25
+ title?: string;
26
+ description?: string;
27
+ }
28
+ /**
29
+ * Build a `{ assetId → AssetEntry }` map from the export's top-level
30
+ * `assets` array. Locale-wrapped `file` / `title` / `description`
31
+ * fields are flattened to a single value regardless of the outer
32
+ * `localeStrategy`.
33
+ *
34
+ * Why force a single-value flatten here even when the operator picked
35
+ * `localeStrategy: 'all'`? An Prenta asset entry has exactly one URL.
36
+ * Returning the raw `{ [locale]: file }` map (the literal behavior of
37
+ * `'all'`) would set `entry.url` to `undefined` and silently break
38
+ * every downstream image / file link. Asset metadata is not the place
39
+ * to preserve per-locale variants — content fields are.
40
+ */
41
+ export declare function buildAssetMap(assets: readonly ContentfulAsset[] | undefined, ctx: {
42
+ primaryLocale: string;
43
+ strategy: 'primary-only' | 'all' | 'primary-with-fallback';
44
+ fallbackChains: Map<string, string[]>;
45
+ knownLocales: ReadonlySet<string>;
46
+ }): Map<string, AssetEntry>;
47
+ //# sourceMappingURL=asset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset.d.ts","sourceRoot":"","sources":["../../../src/adapters/contentful/asset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAuB,MAAM,YAAY,CAAA;AAEtE,MAAM,WAAW,UAAU;IACzB,+DAA+D;IAC/D,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,SAAS,eAAe,EAAE,GAAG,SAAS,EAC9C,GAAG,EAAE;IACH,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,cAAc,GAAG,KAAK,GAAG,uBAAuB,CAAA;IAC1D,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IACrC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAClC,GACA,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAyCzB"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Asset URL resolution for the Contentful adapter.
3
+ *
4
+ * Contentful exports carry every asset as a top-level entry under
5
+ * `assets[]` with the URL declared inline (Contentful hosts media
6
+ * on its own CDN; the export embeds the final URL). The adapter
7
+ * builds an asset map from this once, then the field mapper does
8
+ * an O(1) lookup whenever it encounters an asset link.
9
+ *
10
+ * Contentful URLs in fresh exports often come back protocol-relative
11
+ * (`//images.ctfassets.net/...`). The builder normalizes them to
12
+ * `https://` so downstream consumers don't have to handle the
13
+ * leading-`//` shape.
14
+ */
15
+ import { pickLocaleValue } from './locale.js';
16
+ /**
17
+ * Build a `{ assetId → AssetEntry }` map from the export's top-level
18
+ * `assets` array. Locale-wrapped `file` / `title` / `description`
19
+ * fields are flattened to a single value regardless of the outer
20
+ * `localeStrategy`.
21
+ *
22
+ * Why force a single-value flatten here even when the operator picked
23
+ * `localeStrategy: 'all'`? An Prenta asset entry has exactly one URL.
24
+ * Returning the raw `{ [locale]: file }` map (the literal behavior of
25
+ * `'all'`) would set `entry.url` to `undefined` and silently break
26
+ * every downstream image / file link. Asset metadata is not the place
27
+ * to preserve per-locale variants — content fields are.
28
+ */
29
+ export function buildAssetMap(assets, ctx) {
30
+ const out = new Map();
31
+ if (!assets)
32
+ return out;
33
+ // Locale-flatten asset fields with a strategy override: even if the
34
+ // outer import is set to `'all'`, asset entries get a single
35
+ // primary-locale-with-fallback value, because an AssetEntry is
36
+ // single-valued by definition. `primary-with-fallback` is the
37
+ // permissive default — it falls back through the chain so that
38
+ // operators who upload an asset in only one locale still see a
39
+ // resolved URL on every entry that links to it.
40
+ const assetCtx = ctx.strategy === 'all' ? { ...ctx, strategy: 'primary-with-fallback' } : ctx;
41
+ for (const asset of assets) {
42
+ if (!asset?.sys?.id)
43
+ continue;
44
+ const file = pickLocaleValue(asset.fields?.file, assetCtx);
45
+ // Even if `file` is missing (sometimes happens for in-progress
46
+ // uploads), we still want a placeholder entry so the field
47
+ // mapper can warn instead of silently dropping the link.
48
+ const entry = { url: '' };
49
+ if (file && typeof file === 'object' && !Array.isArray(file)) {
50
+ entry.url = normalizeUrl(file.url);
51
+ if (typeof file.fileName === 'string')
52
+ entry.fileName = file.fileName;
53
+ if (typeof file.contentType === 'string')
54
+ entry.contentType = file.contentType;
55
+ if (typeof file.details?.size === 'number')
56
+ entry.size = file.details.size;
57
+ if (typeof file.details?.image?.width === 'number')
58
+ entry.width = file.details.image.width;
59
+ if (typeof file.details?.image?.height === 'number')
60
+ entry.height = file.details.image.height;
61
+ }
62
+ const title = pickLocaleValue(asset.fields?.title, assetCtx);
63
+ if (typeof title === 'string')
64
+ entry.title = title;
65
+ const description = pickLocaleValue(asset.fields?.description, assetCtx);
66
+ if (typeof description === 'string')
67
+ entry.description = description;
68
+ out.set(asset.sys.id, entry);
69
+ }
70
+ return out;
71
+ }
72
+ /**
73
+ * Normalize Contentful's protocol-relative URLs to explicit
74
+ * `https://`. Leaves everything else alone — fully-qualified URLs
75
+ * and (rare) absolute paths pass through.
76
+ *
77
+ * Defensive about non-string inputs: a corrupted export or a future
78
+ * caller that passes a locale map by mistake will get an empty string
79
+ * back rather than a `TypeError` from `.startsWith`.
80
+ */
81
+ function normalizeUrl(url) {
82
+ if (typeof url !== 'string' || url.length === 0)
83
+ return '';
84
+ if (url.startsWith('//'))
85
+ return `https:${url}`;
86
+ return url;
87
+ }
88
+ //# sourceMappingURL=asset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset.js","sourceRoot":"","sources":["../../../src/adapters/contentful/asset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAgB7C;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAC3B,MAA8C,EAC9C,GAKC;IAED,MAAM,GAAG,GAAG,IAAI,GAAG,EAAsB,CAAA;IACzC,IAAI,CAAC,MAAM;QAAE,OAAO,GAAG,CAAA;IAEvB,oEAAoE;IACpE,6DAA6D;IAC7D,+DAA+D;IAC/D,8DAA8D;IAC9D,+DAA+D;IAC/D,+DAA+D;IAC/D,gDAAgD;IAChD,MAAM,QAAQ,GACZ,GAAG,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,uBAAgC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA;IAEvF,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAAE,SAAQ;QAC7B,MAAM,IAAI,GAAG,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAoC,CAAA;QAE7F,+DAA+D;QAC/D,2DAA2D;QAC3D,yDAAyD;QACzD,MAAM,KAAK,GAAe,EAAE,GAAG,EAAE,EAAE,EAAE,CAAA;QACrC,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7D,KAAK,CAAC,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YAClC,IAAI,OAAO,IAAI,CAAC,QAAQ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AAO,EAAE,CAAA;IAC1D,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,GAAG,EAAE,CAAA;IAC/C,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * `contentful` — adapter for Contentful `contentful-export` JSON
3
+ * exports.
4
+ *
5
+ * Reads the JSON file produced by `contentful-export` and emits
6
+ * Prenta-shaped `ImportedDocument`s. Two-pass: first pass builds
7
+ * the entry-id → collection map (for forward/backward entry-link
8
+ * resolution) and the asset-id → asset map (for asset-link
9
+ * resolution). Second pass walks each entry with the resolved
10
+ * context.
11
+ *
12
+ * Differences from the Sanity adapter at the framework level:
13
+ *
14
+ * - Single JSON document, not NDJSON, so the parser is just
15
+ * `JSON.parse` with a defensive structural check.
16
+ * - Locale unwrapping happens at the field-mapping stage; the
17
+ * adapter precomputes the primary locale + fallback chains
18
+ * from `locales[]` before invoking the mapper.
19
+ * - Assets carry URLs inline — no `projectId`/`dataset` config
20
+ * required to get image URLs.
21
+ */
22
+ import type { ImportAdapter } from '../../types.js';
23
+ export declare const contentfulAdapter: ImportAdapter;
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/contentful/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAKH,OAAO,KAAK,EAEV,aAAa,EAKd,MAAM,gBAAgB,CAAA;AAOvB,eAAO,MAAM,iBAAiB,EAAE,aA4L/B,CAAA"}
@@ -0,0 +1,242 @@
1
+ /**
2
+ * `contentful` — adapter for Contentful `contentful-export` JSON
3
+ * exports.
4
+ *
5
+ * Reads the JSON file produced by `contentful-export` and emits
6
+ * Prenta-shaped `ImportedDocument`s. Two-pass: first pass builds
7
+ * the entry-id → collection map (for forward/backward entry-link
8
+ * resolution) and the asset-id → asset map (for asset-link
9
+ * resolution). Second pass walks each entry with the resolved
10
+ * context.
11
+ *
12
+ * Differences from the Sanity adapter at the framework level:
13
+ *
14
+ * - Single JSON document, not NDJSON, so the parser is just
15
+ * `JSON.parse` with a defensive structural check.
16
+ * - Locale unwrapping happens at the field-mapping stage; the
17
+ * adapter precomputes the primary locale + fallback chains
18
+ * from `locales[]` before invoking the mapper.
19
+ * - Assets carry URLs inline — no `projectId`/`dataset` config
20
+ * required to get image URLs.
21
+ */
22
+ import { readFileSync } from 'node:fs';
23
+ import { buildResult } from '../../adapter.js';
24
+ import { buildAssetMap } from './asset.js';
25
+ import { buildFallbackChains, resolvePrimaryLocale } from './locale.js';
26
+ import { mapEntry, resolveCollection } from './map.js';
27
+ export const contentfulAdapter = {
28
+ name: 'contentful',
29
+ description: 'Import a Contentful contentful-export JSON dump.',
30
+ docsUrl: 'https://github.com/actuate-media/prenta/blob/main/docs/import.md#contentful-adapter',
31
+ run(options) {
32
+ const config = readConfig(options.config);
33
+ const raw = readFileSync(options.input, 'utf-8');
34
+ const warnings = [];
35
+ const unresolved = [];
36
+ let parsed;
37
+ try {
38
+ parsed = JSON.parse(raw);
39
+ }
40
+ catch (err) {
41
+ unresolved.push({
42
+ source: { field: '<root>' },
43
+ code: 'invalid-json',
44
+ reason: `Input file is not valid JSON: ${err.message}`,
45
+ hint: 'contentful-export emits a single JSON document. Verify the file is the JSON output, not the .tar.gz archive.',
46
+ });
47
+ return buildResult({
48
+ adapter: contentfulAdapter.name,
49
+ documents: [],
50
+ warnings,
51
+ unresolved,
52
+ totals: { totalRead: 0, converted: 0, skipped: 0 },
53
+ });
54
+ }
55
+ if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
56
+ unresolved.push({
57
+ source: { field: '<root>' },
58
+ code: 'invalid-shape',
59
+ reason: 'Top-level JSON must be an object (contentful-export envelope).',
60
+ hint: 'Expected `{ entries: [...], assets: [...], locales: [...] }`.',
61
+ });
62
+ return buildResult({
63
+ adapter: contentfulAdapter.name,
64
+ documents: [],
65
+ warnings,
66
+ unresolved,
67
+ totals: { totalRead: 0, converted: 0, skipped: 0 },
68
+ });
69
+ }
70
+ const entries = Array.isArray(parsed.entries) ? parsed.entries : [];
71
+ const assets = Array.isArray(parsed.assets) ? parsed.assets : [];
72
+ const locales = Array.isArray(parsed.locales) ? parsed.locales : [];
73
+ // Compute the locale-handling primitives once for the whole run.
74
+ const primaryLocale = resolvePrimaryLocale(locales, config);
75
+ const fallbackChains = buildFallbackChains(locales);
76
+ const knownLocales = new Set(locales.map((l) => l.code));
77
+ // Single-locale projects sometimes export without a `locales`
78
+ // array — make sure the primary locale is always recognized as
79
+ // a known locale so the field-unwrap sees the wrapper.
80
+ knownLocales.add(primaryLocale);
81
+ const strategy = config.localeStrategy ?? 'primary-only';
82
+ const ignored = new Set(config.ignoreTypes ?? []);
83
+ const publishedOnly = config.publishedOnly !== false;
84
+ let skipped = 0;
85
+ const importable = [];
86
+ const context = {
87
+ collectionByEntryId: new Map(),
88
+ assetsById: new Map(),
89
+ primaryLocale,
90
+ strategy,
91
+ fallbackChains,
92
+ knownLocales,
93
+ };
94
+ // Pre-populate the asset map. Locale-aware: title/description/file
95
+ // get unwrapped with the same strategy as entry fields.
96
+ context.assetsById = buildAssetMap(assets, {
97
+ primaryLocale,
98
+ strategy,
99
+ fallbackChains,
100
+ knownLocales,
101
+ });
102
+ // First pass — figure out which entries are importable and seed
103
+ // the entry-id → collection map so the second pass can resolve
104
+ // forward + backward references.
105
+ for (const entry of entries) {
106
+ if (!entry?.sys?.id || typeof entry.sys.id !== 'string') {
107
+ unresolved.push({
108
+ source: { field: '<entry>' },
109
+ code: 'invalid-shape',
110
+ reason: 'Entry is missing sys.id.',
111
+ rawValue: entry,
112
+ hint: 'contentful-export always emits sys.id. The source file may be truncated.',
113
+ });
114
+ skipped++;
115
+ continue;
116
+ }
117
+ const contentTypeId = entry.sys.contentType?.sys?.id;
118
+ if (!contentTypeId || typeof contentTypeId !== 'string') {
119
+ unresolved.push({
120
+ source: { id: entry.sys.id, field: 'sys.contentType' },
121
+ code: 'invalid-shape',
122
+ reason: 'Entry is missing sys.contentType.sys.id.',
123
+ rawValue: entry,
124
+ hint: 'The export must reference a content type. Re-run contentful-export with --include-drafts disabled.',
125
+ });
126
+ skipped++;
127
+ continue;
128
+ }
129
+ if (publishedOnly && entry.sys.publishedVersion === undefined) {
130
+ skipped++;
131
+ continue;
132
+ }
133
+ if (ignored.has(contentTypeId)) {
134
+ skipped++;
135
+ continue;
136
+ }
137
+ if (options.shouldInclude &&
138
+ !options.shouldInclude({ type: contentTypeId, id: entry.sys.id })) {
139
+ skipped++;
140
+ continue;
141
+ }
142
+ const { collection } = resolveCollection(contentTypeId, config);
143
+ context.collectionByEntryId.set(entry.sys.id, collection);
144
+ importable.push(entry);
145
+ }
146
+ const documents = [];
147
+ for (const entry of importable) {
148
+ const result = mapEntry(entry, context, config);
149
+ warnings.push(...result.warnings);
150
+ unresolved.push(...result.unresolved);
151
+ documents.push({
152
+ collection: result.collection,
153
+ ...(result.slug !== undefined ? { slug: result.slug } : {}),
154
+ sourceId: result.sourceId,
155
+ sourceType: result.sourceType,
156
+ data: result.data,
157
+ });
158
+ }
159
+ // Optionally emit assets as their own documents. Off by
160
+ // default — most migrations want assets resolved inline on the
161
+ // entries that reference them, not as a separate collection.
162
+ if (config.importAssets) {
163
+ const assetCollection = config.assetCollection ?? 'assets';
164
+ for (const [id, asset] of context.assetsById) {
165
+ if (!asset.url) {
166
+ warnings.push({
167
+ source: { type: 'Asset', id },
168
+ code: 'asset-without-url',
169
+ message: `Asset '${id}' has no file URL — skipping in importAssets emission.`,
170
+ });
171
+ continue;
172
+ }
173
+ documents.push({
174
+ collection: assetCollection,
175
+ sourceId: id,
176
+ sourceType: 'Asset',
177
+ data: {
178
+ url: asset.url,
179
+ ...(asset.fileName ? { fileName: asset.fileName } : {}),
180
+ ...(asset.contentType ? { contentType: asset.contentType } : {}),
181
+ ...(asset.size !== undefined ? { size: asset.size } : {}),
182
+ ...(asset.width !== undefined ? { width: asset.width } : {}),
183
+ ...(asset.height !== undefined ? { height: asset.height } : {}),
184
+ ...(asset.title ? { title: asset.title } : {}),
185
+ ...(asset.description ? { description: asset.description } : {}),
186
+ },
187
+ });
188
+ }
189
+ }
190
+ return buildResult({
191
+ adapter: contentfulAdapter.name,
192
+ documents,
193
+ warnings,
194
+ unresolved,
195
+ totals: {
196
+ totalRead: entries.length,
197
+ converted: documents.length,
198
+ skipped,
199
+ },
200
+ });
201
+ },
202
+ };
203
+ /**
204
+ * Validate the user-supplied `--config` JSON into the
205
+ * adapter-specific shape. Same defensive pattern as the Sanity
206
+ * adapter — unknown keys silently dropped, known keys
207
+ * type-validated.
208
+ */
209
+ function readConfig(raw) {
210
+ if (raw === null || typeof raw !== 'object' || Array.isArray(raw))
211
+ return {};
212
+ const r = raw;
213
+ const out = {};
214
+ if (r.typeMap && typeof r.typeMap === 'object' && !Array.isArray(r.typeMap)) {
215
+ const map = {};
216
+ for (const [k, v] of Object.entries(r.typeMap)) {
217
+ if (typeof v === 'string')
218
+ map[k] = v;
219
+ }
220
+ out.typeMap = map;
221
+ }
222
+ if (typeof r.primaryLocale === 'string')
223
+ out.primaryLocale = r.primaryLocale;
224
+ if (r.localeStrategy === 'primary-only' ||
225
+ r.localeStrategy === 'all' ||
226
+ r.localeStrategy === 'primary-with-fallback') {
227
+ out.localeStrategy = r.localeStrategy;
228
+ }
229
+ if (typeof r.publishedOnly === 'boolean')
230
+ out.publishedOnly = r.publishedOnly;
231
+ if (typeof r.includeSystemFields === 'boolean')
232
+ out.includeSystemFields = r.includeSystemFields;
233
+ if (typeof r.importAssets === 'boolean')
234
+ out.importAssets = r.importAssets;
235
+ if (typeof r.assetCollection === 'string')
236
+ out.assetCollection = r.assetCollection;
237
+ if (Array.isArray(r.ignoreTypes)) {
238
+ out.ignoreTypes = r.ignoreTypes.filter((s) => typeof s === 'string');
239
+ }
240
+ return out;
241
+ }
242
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.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