@artinstack/migrator 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/{bundle-uAAHehbv.d.ts → bundle-B3XS20r_.d.ts} +1 -1
- package/dist/{chunk-BOYB6XRA.js → chunk-BONZ3U3I.js} +11 -62
- package/dist/chunk-BONZ3U3I.js.map +1 -0
- package/dist/chunk-EJTWYEAX.js +1 -0
- package/dist/chunk-EJTWYEAX.js.map +1 -0
- package/dist/{chunk-KF7G7DM6.js → chunk-FB3MMCHY.js} +315 -84
- package/dist/chunk-FB3MMCHY.js.map +1 -0
- package/dist/{chunk-HI7JHWZU.js → chunk-KTQGOM45.js} +1 -1
- package/dist/chunk-KTQGOM45.js.map +1 -0
- package/dist/{chunk-MDSY3FEZ.js → chunk-PPT5RIZ4.js} +83 -39
- package/dist/chunk-PPT5RIZ4.js.map +1 -0
- package/dist/{chunk-XYP3VYDH.js → chunk-S4GMDRGX.js} +149 -6
- package/dist/chunk-S4GMDRGX.js.map +1 -0
- package/dist/{chunk-S4XYG4SM.js → chunk-S4SUJT2D.js} +36 -2
- package/dist/chunk-S4SUJT2D.js.map +1 -0
- package/dist/chunk-XRCF73DA.js +24 -0
- package/dist/chunk-XRCF73DA.js.map +1 -0
- package/dist/cli/index.js +8 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +9 -33
- package/dist/index.js +31 -16
- package/dist/lib/index.d.ts +7 -25
- package/dist/lib/index.js +34 -3
- package/dist/media-urls-u49RCyPn.d.ts +88 -0
- package/dist/normalizer/index.d.ts +4 -4
- package/dist/normalizer/index.js +1 -1
- package/dist/{rewrite-inline-images-Bq16bJA5.d.ts → rewrite-inline-images-BsgSquzV.d.ts} +4 -0
- package/dist/sinks/index.d.ts +21 -5
- package/dist/sinks/index.js +7 -4
- package/dist/transformers/index.d.ts +170 -4
- package/dist/transformers/index.js +5 -4
- package/dist/{types-DWOP8Dcy.d.ts → types-Ce4r6zqt.d.ts} +4 -0
- package/package.json +1 -1
- package/dist/chunk-BOYB6XRA.js.map +0 -1
- package/dist/chunk-HI7JHWZU.js.map +0 -1
- package/dist/chunk-KF7G7DM6.js.map +0 -1
- package/dist/chunk-MDSY3FEZ.js.map +0 -1
- package/dist/chunk-S4XYG4SM.js.map +0 -1
- package/dist/chunk-XYP3VYDH.js.map +0 -1
- package/dist/index-Dp6nqBqe.d.ts +0 -177
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,15 @@
|
|
|
1
|
-
import { M as MigrationAdapter, g as MigrationPlatform } from './types-
|
|
2
|
-
export { A as AdapterContext, E as EntityKey, h as EntityType, i as MigrationCursor, b as NormalizedAsset, j as NormalizedAssetExif, d as NormalizedCategory, f as NormalizedEntity, a as NormalizedPage, c as NormalizedPortfolio, N as NormalizedPost, e as NormalizedTag, P as PortfolioMediaLink, k as PublishStatus, S as SourceMetadata, V as ValidationIssue, l as ValidationResult, m as entityKey } from './types-
|
|
1
|
+
import { M as MigrationAdapter, g as MigrationPlatform } from './types-Ce4r6zqt.js';
|
|
2
|
+
export { A as AdapterContext, E as EntityKey, h as EntityType, i as MigrationCursor, b as NormalizedAsset, j as NormalizedAssetExif, d as NormalizedCategory, f as NormalizedEntity, a as NormalizedPage, c as NormalizedPortfolio, N as NormalizedPost, e as NormalizedTag, P as PortfolioMediaLink, k as PublishStatus, S as SourceMetadata, V as ValidationIssue, l as ValidationResult, m as entityKey } from './types-Ce4r6zqt.js';
|
|
3
3
|
export { EntityState, MigrationCheckpoint, TrackedEntity, buildPortfolioMediaLinks, isTerminalState, normalizedAssetExifSchema, normalizedAssetSchema, normalizedCategorySchema, normalizedEntitySchema, normalizedPageSchema, normalizedPortfolioSchema, normalizedPostSchema, normalizedTagSchema, shouldProcessEntity, sourceMetadataSchema, validateNormalizedAsset, validateNormalizedCategory, validateNormalizedEntity, validateNormalizedPage, validateNormalizedPortfolio, validateNormalizedPost, validateNormalizedTag } from './normalizer/index.js';
|
|
4
|
-
export { B as BundleCounts, E as EntityBundle, b as bundleCounts, c as collectEntities, e as emptyBundle } from './bundle-
|
|
5
|
-
export { ConflictReport, DryRunOptions, DryRunResult, FALLBACK_ASSET_BYTES, FilesystemMigrationSink, MIGRATION_WRITE_STAGES, MigrationRedirect, MigrationReport, MigrationRunMode, MigrationRunOptions, MigrationRunResult, MigrationSink, MigrationWriteStage, StorageEstimate, UploadAssetInput, UploadAssetResult, WriteFilesystemOptions, analyzeConflicts, buildMigrationReport, buildRedirectMap, bundleToCombinedJson, createFilesystemMigrationSink, detectRedirectLoops, emptyConflictReport, estimateStorage, hasBlockingConflicts, hasWarnings, portfolioMediaMatchesBundle, runDryRun, runMigration, runMigrationFromBundle, staleUrlsFromEstimate, writeFilesystemExport } from './sinks/index.js';
|
|
6
|
-
export { R as RewriteInlineImageRef, a as RewriteInlineImagesOptions, b as RewriteInlineImagesResult, S as StampMigrationMediaRefsOptions, U as UploadedAssetRef, r as rewriteInlineImages, s as stampMigrationMediaRefs } from './rewrite-inline-images-
|
|
7
|
-
export {
|
|
8
|
-
export { discoverContentAssetUrls, discoverFeaturedAssetCandidateUrls, discoverRawImgSrcs, extractInlineImageSrcs, isLikelyImageUrl, normalizeAssetUrl, resolveFeaturedContentAssetUrl } from './
|
|
4
|
+
export { B as BundleCounts, E as EntityBundle, b as bundleCounts, c as collectEntities, e as emptyBundle } from './bundle-B3XS20r_.js';
|
|
5
|
+
export { AssetDiscoverySummary, ConflictReport, DryRunOptions, DryRunResult, FALLBACK_ASSET_BYTES, FilesystemMigrationSink, MIGRATION_WRITE_STAGES, MigrationRedirect, MigrationReport, MigrationRunMode, MigrationRunOptions, MigrationRunResult, MigrationSink, MigrationWriteStage, StorageEstimate, UploadAssetInput, UploadAssetResult, WriteFilesystemOptions, analyzeConflicts, buildMigrationReport, buildRedirectMap, bundleToCombinedJson, createFilesystemMigrationSink, detectRedirectLoops, emptyConflictReport, estimateStorage, hasBlockingConflicts, hasWarnings, portfolioMediaMatchesBundle, runDryRun, runMigration, runMigrationFromBundle, staleUrlsFromEstimate, summarizeAssetDiscovery, writeFilesystemExport } from './sinks/index.js';
|
|
6
|
+
export { R as RewriteInlineImageRef, a as RewriteInlineImagesOptions, b as RewriteInlineImagesResult, S as StampMigrationMediaRefsOptions, U as UploadedAssetRef, r as rewriteInlineImages, s as stampMigrationMediaRefs } from './rewrite-inline-images-BsgSquzV.js';
|
|
7
|
+
export { ExpandMigrationMediaRefsResult, GrapesComponent, GrapesProjectSnapshot, GrapesStyleRule, HtmlToGrapesOptions, HtmlToTiptapOptions, LayoutKind, LayoutTypeMap, TiptapDoc, TiptapMark, TiptapNode, ValidateGrapesProjectSnapshotOptions, ValidateTiptapDocOptions, cssToStyles, expandMigrationMediaRefs, grapesComponentSchema, grapesProjectSnapshotSchema, grapesStyleRuleSchema, htmlToGrapes, htmlToTiptap, tiptapDocSchema, tiptapMarkSchema, tiptapNodeSchema, validateGrapesProjectSnapshot, validateTiptapDoc } from './transformers/index.js';
|
|
8
|
+
export { C as CanonicalInlineAssetUrl, a as ContentAssetDiscovery, M as MIGRATION_MEDIA_REF_SCHEME, O as OriginUrlRewriteConfig, b as OriginUrlRewriteRule, c as buildContentMediaUrlIndex, d as buildMigrationMediaUrlIndex, e as canonicalizeInlineAssetUrl, f as createMigrationMediaRefReplaceWith, g as createWpContentGatewayRewrite, h as discoverContentAssetUrls, i as discoverContentAssets, j as discoverFeaturedAssetCandidateUrls, k as discoverRawImgSrcs, l as extractInlineImageSrcs, m as formatMigrationMediaRef, n as isLikelyImageUrl, o as isMigrationMediaRef, p as normalizeAssetUrl, q as parseMigrationMediaRef, r as resolveFeaturedContentAssetUrl, s as resolveMigrationMediaSourceId, t as rewriteOriginUrlsInText } from './media-urls-u49RCyPn.js';
|
|
9
|
+
export { linkToPath, sanitizeSlug } from './lib/index.js';
|
|
9
10
|
import { z } from 'zod';
|
|
10
11
|
import 'node:stream';
|
|
11
12
|
|
|
12
|
-
interface OriginUrlRewriteRule {
|
|
13
|
-
/** Literal substring or regex matched against the full text block. */
|
|
14
|
-
match: string | RegExp;
|
|
15
|
-
replace: string;
|
|
16
|
-
}
|
|
17
|
-
interface OriginUrlRewriteConfig {
|
|
18
|
-
rules: OriginUrlRewriteRule[];
|
|
19
|
-
}
|
|
20
|
-
/** Swap legacy gateway/staging host fragments before parse, fetch, or asset discovery. */
|
|
21
|
-
declare function rewriteOriginUrlsInText(text: string, config: OriginUrlRewriteConfig): string;
|
|
22
|
-
/** Build a rule that rewrites API-gateway `/prod/wp-content/` paths to a public origin. */
|
|
23
|
-
declare function createWpContentGatewayRewrite(gatewayBase: string, publicOrigin: string): OriginUrlRewriteConfig;
|
|
24
|
-
|
|
25
13
|
declare const wordpressAdapter: MigrationAdapter;
|
|
26
14
|
|
|
27
15
|
/** Flat relational dump (Folders / Albums / Images tables). */
|
|
@@ -521,16 +509,4 @@ declare const wixAdapter: MigrationAdapter;
|
|
|
521
509
|
|
|
522
510
|
declare function getAdapter(platform: MigrationPlatform): MigrationAdapter;
|
|
523
511
|
|
|
524
|
-
|
|
525
|
-
declare const MIGRATION_MEDIA_REF_SCHEME = "artinstack-migration://asset/";
|
|
526
|
-
/** Build `artinstack-migration://asset/{sourceId}` (percent-encodes the normalizer source id). */
|
|
527
|
-
declare function formatMigrationMediaRef(sourceAssetId: string): string;
|
|
528
|
-
declare function isMigrationMediaRef(value: string): boolean;
|
|
529
|
-
/** Parse a migration media ref back to the normalizer `sourceId`, or `undefined` if not a ref. */
|
|
530
|
-
declare function parseMigrationMediaRef(value: string): string | undefined;
|
|
531
|
-
/** Default `replaceWith` for `rewriteInlineImages` / `stampMigrationMediaRefs` (OSS-14). */
|
|
532
|
-
declare function createMigrationMediaRefReplaceWith(): (ref: {
|
|
533
|
-
sourceAssetId?: string;
|
|
534
|
-
}) => string;
|
|
535
|
-
|
|
536
|
-
export { MIGRATION_MEDIA_REF_SCHEME, MigrationAdapter, MigrationPlatform, type OriginUrlRewriteConfig, type OriginUrlRewriteRule, SMUGMUG_API_BASE, SMUGMUG_OAUTH_ENDPOINTS, SQUARESPACE_JSON_FORMAT, SmugMugApiClient, type SmugMugClientOptions, type SmugMugCredentials, type SquarespaceClientOptions, type SquarespaceCollectTarget, SquarespaceCollectionClient, WixCollectionClient, WixPageSnapshotCollector, buildJsonPrettyUrl, buildSmugMugAuthorizationHeader, createMigrationMediaRefReplaceWith, createWpContentGatewayRewrite, formatMigrationMediaRef, getAdapter, isMigrationMediaRef, mapJsonPrettyWire, parseMigrationMediaRef, readSmugMugCredentialsFromEnv, rewriteOriginUrlsInText, signSmugMugOAuthRequest, smugMugCredentialsSchema, smugmugAdapter, squarespaceAdapter, wixAdapter, wordpressAdapter };
|
|
512
|
+
export { MigrationAdapter, MigrationPlatform, SMUGMUG_API_BASE, SMUGMUG_OAUTH_ENDPOINTS, SQUARESPACE_JSON_FORMAT, SmugMugApiClient, type SmugMugClientOptions, type SmugMugCredentials, type SquarespaceClientOptions, type SquarespaceCollectTarget, SquarespaceCollectionClient, WixCollectionClient, WixPageSnapshotCollector, buildJsonPrettyUrl, buildSmugMugAuthorizationHeader, getAdapter, mapJsonPrettyWire, readSmugMugCredentialsFromEnv, signSmugMugOAuthRequest, smugMugCredentialsSchema, smugmugAdapter, squarespaceAdapter, wixAdapter, wordpressAdapter };
|
package/dist/index.js
CHANGED
|
@@ -5,17 +5,15 @@ import {
|
|
|
5
5
|
WixCollectionClient,
|
|
6
6
|
WixPageSnapshotCollector,
|
|
7
7
|
buildSmugMugAuthorizationHeader,
|
|
8
|
-
createWpContentGatewayRewrite,
|
|
9
8
|
getAdapter,
|
|
10
9
|
readSmugMugCredentialsFromEnv,
|
|
11
|
-
rewriteOriginUrlsInText,
|
|
12
10
|
signSmugMugOAuthRequest,
|
|
13
11
|
smugMugCredentialsSchema,
|
|
14
12
|
smugmugAdapter,
|
|
15
13
|
squarespaceAdapter,
|
|
16
14
|
wixAdapter,
|
|
17
15
|
wordpressAdapter
|
|
18
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-FB3MMCHY.js";
|
|
19
17
|
import {
|
|
20
18
|
normalizedAssetExifSchema,
|
|
21
19
|
normalizedAssetSchema,
|
|
@@ -57,8 +55,9 @@ import {
|
|
|
57
55
|
runMigration,
|
|
58
56
|
runMigrationFromBundle,
|
|
59
57
|
staleUrlsFromEstimate,
|
|
58
|
+
summarizeAssetDiscovery,
|
|
60
59
|
writeFilesystemExport
|
|
61
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-PPT5RIZ4.js";
|
|
62
61
|
import {
|
|
63
62
|
buildPortfolioMediaLinks,
|
|
64
63
|
bundleCounts,
|
|
@@ -67,7 +66,7 @@ import {
|
|
|
67
66
|
entityKey,
|
|
68
67
|
isTerminalState,
|
|
69
68
|
shouldProcessEntity
|
|
70
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-KTQGOM45.js";
|
|
71
70
|
import {
|
|
72
71
|
cssToStyles,
|
|
73
72
|
expandMigrationMediaRefs,
|
|
@@ -81,27 +80,37 @@ import {
|
|
|
81
80
|
tiptapNodeSchema,
|
|
82
81
|
validateGrapesProjectSnapshot,
|
|
83
82
|
validateTiptapDoc
|
|
84
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-S4SUJT2D.js";
|
|
85
84
|
import {
|
|
86
|
-
MIGRATION_MEDIA_REF_SCHEME,
|
|
87
|
-
buildMigrationMediaUrlIndex,
|
|
88
|
-
createMigrationMediaRefReplaceWith,
|
|
89
|
-
formatMigrationMediaRef,
|
|
90
|
-
isMigrationMediaRef,
|
|
91
|
-
parseMigrationMediaRef,
|
|
92
|
-
resolveMigrationMediaSourceId,
|
|
93
85
|
rewriteInlineImages,
|
|
94
86
|
stampMigrationMediaRefs
|
|
95
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-BONZ3U3I.js";
|
|
88
|
+
import "./chunk-EJTWYEAX.js";
|
|
89
|
+
import {
|
|
90
|
+
linkToPath,
|
|
91
|
+
sanitizeSlug
|
|
92
|
+
} from "./chunk-XRCF73DA.js";
|
|
96
93
|
import {
|
|
94
|
+
MIGRATION_MEDIA_REF_SCHEME,
|
|
95
|
+
buildContentMediaUrlIndex,
|
|
96
|
+
buildMigrationMediaUrlIndex,
|
|
97
|
+
canonicalizeInlineAssetUrl,
|
|
98
|
+
createMigrationMediaRefReplaceWith,
|
|
99
|
+
createWpContentGatewayRewrite,
|
|
97
100
|
discoverContentAssetUrls,
|
|
101
|
+
discoverContentAssets,
|
|
98
102
|
discoverFeaturedAssetCandidateUrls,
|
|
99
103
|
discoverRawImgSrcs,
|
|
100
104
|
extractInlineImageSrcs,
|
|
105
|
+
formatMigrationMediaRef,
|
|
101
106
|
isLikelyImageUrl,
|
|
107
|
+
isMigrationMediaRef,
|
|
102
108
|
normalizeAssetUrl,
|
|
103
|
-
|
|
104
|
-
|
|
109
|
+
parseMigrationMediaRef,
|
|
110
|
+
resolveFeaturedContentAssetUrl,
|
|
111
|
+
resolveMigrationMediaSourceId,
|
|
112
|
+
rewriteOriginUrlsInText
|
|
113
|
+
} from "./chunk-S4GMDRGX.js";
|
|
105
114
|
export {
|
|
106
115
|
FALLBACK_ASSET_BYTES,
|
|
107
116
|
FilesystemMigrationSink,
|
|
@@ -115,6 +124,7 @@ export {
|
|
|
115
124
|
WixCollectionClient,
|
|
116
125
|
WixPageSnapshotCollector,
|
|
117
126
|
analyzeConflicts,
|
|
127
|
+
buildContentMediaUrlIndex,
|
|
118
128
|
buildJsonPrettyUrl,
|
|
119
129
|
buildMigrationMediaUrlIndex,
|
|
120
130
|
buildMigrationReport,
|
|
@@ -123,6 +133,7 @@ export {
|
|
|
123
133
|
buildSmugMugAuthorizationHeader,
|
|
124
134
|
bundleCounts,
|
|
125
135
|
bundleToCombinedJson,
|
|
136
|
+
canonicalizeInlineAssetUrl,
|
|
126
137
|
collectEntities,
|
|
127
138
|
createFilesystemMigrationSink,
|
|
128
139
|
createMigrationMediaRefReplaceWith,
|
|
@@ -130,6 +141,7 @@ export {
|
|
|
130
141
|
cssToStyles,
|
|
131
142
|
detectRedirectLoops,
|
|
132
143
|
discoverContentAssetUrls,
|
|
144
|
+
discoverContentAssets,
|
|
133
145
|
discoverFeaturedAssetCandidateUrls,
|
|
134
146
|
discoverRawImgSrcs,
|
|
135
147
|
emptyBundle,
|
|
@@ -150,6 +162,7 @@ export {
|
|
|
150
162
|
isLikelyImageUrl,
|
|
151
163
|
isMigrationMediaRef,
|
|
152
164
|
isTerminalState,
|
|
165
|
+
linkToPath,
|
|
153
166
|
mapJsonPrettyWire,
|
|
154
167
|
normalizeAssetUrl,
|
|
155
168
|
normalizedAssetExifSchema,
|
|
@@ -170,6 +183,7 @@ export {
|
|
|
170
183
|
runDryRun,
|
|
171
184
|
runMigration,
|
|
172
185
|
runMigrationFromBundle,
|
|
186
|
+
sanitizeSlug,
|
|
173
187
|
shouldProcessEntity,
|
|
174
188
|
signSmugMugOAuthRequest,
|
|
175
189
|
smugMugCredentialsSchema,
|
|
@@ -178,6 +192,7 @@ export {
|
|
|
178
192
|
squarespaceAdapter,
|
|
179
193
|
staleUrlsFromEstimate,
|
|
180
194
|
stampMigrationMediaRefs,
|
|
195
|
+
summarizeAssetDiscovery,
|
|
181
196
|
tiptapDocSchema,
|
|
182
197
|
tiptapMarkSchema,
|
|
183
198
|
tiptapNodeSchema,
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
declare function discoverRawImgSrcs(content: string): string[];
|
|
3
|
-
/** Normalize protocol-relative and trim; skip data URIs. */
|
|
4
|
-
declare function normalizeAssetUrl(raw: string): string | undefined;
|
|
5
|
-
/** Heuristic: URL likely points at a raster/vector image asset, not a page link. */
|
|
6
|
-
declare function isLikelyImageUrl(url: string): boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Ordered featured-image candidates when `_thumbnail_id` is missing — heroes
|
|
9
|
-
* (`data-bg-image`, CSS backgrounds, `bg_image=`) before inline assets; within
|
|
10
|
-
* each tier, first in document order wins. Filename tokens (`_w`, `_2048`, …)
|
|
11
|
-
* are not interpreted as quality signals.
|
|
12
|
-
*/
|
|
13
|
-
declare function discoverFeaturedAssetCandidateUrls(content: string): string[];
|
|
14
|
-
/** Best featured-image URL from post/page HTML when attachment id is unavailable. */
|
|
15
|
-
declare function resolveFeaturedContentAssetUrl(content: string): string | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Generic content-discovery pass: collect image URLs from HTML `<img>` tags,
|
|
18
|
-
* section hero markers (`data-bg-image`), inline CSS backgrounds, and common
|
|
19
|
-
* shortcode/builder attributes (`src=`, `image=`, `bg_image=`, …) without
|
|
20
|
-
* parsing builder-specific structure (Tatsu, Elementor, etc.).
|
|
21
|
-
*/
|
|
22
|
-
declare function discoverContentAssetUrls(content: string): string[];
|
|
23
|
-
/** @deprecated Use discoverContentAssetUrls — kept for call-site clarity during transition. */
|
|
24
|
-
declare function extractInlineImageSrcs(content: string): string[];
|
|
1
|
+
export { C as CanonicalInlineAssetUrl, a as ContentAssetDiscovery, M as MIGRATION_MEDIA_REF_SCHEME, O as OriginUrlRewriteConfig, b as OriginUrlRewriteRule, c as buildContentMediaUrlIndex, d as buildMigrationMediaUrlIndex, e as canonicalizeInlineAssetUrl, f as createMigrationMediaRefReplaceWith, g as createWpContentGatewayRewrite, h as discoverContentAssetUrls, i as discoverContentAssets, j as discoverFeaturedAssetCandidateUrls, k as discoverRawImgSrcs, l as extractInlineImageSrcs, m as formatMigrationMediaRef, n as isLikelyImageUrl, o as isMigrationMediaRef, p as normalizeAssetUrl, q as parseMigrationMediaRef, r as resolveFeaturedContentAssetUrl, s as resolveMigrationMediaSourceId, t as rewriteOriginUrlsInText } from '../media-urls-u49RCyPn.js';
|
|
25
2
|
|
|
26
|
-
|
|
3
|
+
/** Lowercase URL-safe slug from WordPress post_name or title. */
|
|
4
|
+
declare function sanitizeSlug(raw: string): string;
|
|
5
|
+
/** Normalize absolute permalink to root-relative path. */
|
|
6
|
+
declare function linkToPath(link: string | undefined): string | undefined;
|
|
7
|
+
|
|
8
|
+
export { linkToPath, sanitizeSlug };
|
package/dist/lib/index.js
CHANGED
|
@@ -1,19 +1,50 @@
|
|
|
1
|
+
import "../chunk-EJTWYEAX.js";
|
|
1
2
|
import {
|
|
3
|
+
linkToPath,
|
|
4
|
+
sanitizeSlug
|
|
5
|
+
} from "../chunk-XRCF73DA.js";
|
|
6
|
+
import {
|
|
7
|
+
MIGRATION_MEDIA_REF_SCHEME,
|
|
8
|
+
buildContentMediaUrlIndex,
|
|
9
|
+
buildMigrationMediaUrlIndex,
|
|
10
|
+
canonicalizeInlineAssetUrl,
|
|
11
|
+
createMigrationMediaRefReplaceWith,
|
|
12
|
+
createWpContentGatewayRewrite,
|
|
2
13
|
discoverContentAssetUrls,
|
|
14
|
+
discoverContentAssets,
|
|
3
15
|
discoverFeaturedAssetCandidateUrls,
|
|
4
16
|
discoverRawImgSrcs,
|
|
5
17
|
extractInlineImageSrcs,
|
|
18
|
+
formatMigrationMediaRef,
|
|
6
19
|
isLikelyImageUrl,
|
|
20
|
+
isMigrationMediaRef,
|
|
7
21
|
normalizeAssetUrl,
|
|
8
|
-
|
|
9
|
-
|
|
22
|
+
parseMigrationMediaRef,
|
|
23
|
+
resolveFeaturedContentAssetUrl,
|
|
24
|
+
resolveMigrationMediaSourceId,
|
|
25
|
+
rewriteOriginUrlsInText
|
|
26
|
+
} from "../chunk-S4GMDRGX.js";
|
|
10
27
|
export {
|
|
28
|
+
MIGRATION_MEDIA_REF_SCHEME,
|
|
29
|
+
buildContentMediaUrlIndex,
|
|
30
|
+
buildMigrationMediaUrlIndex,
|
|
31
|
+
canonicalizeInlineAssetUrl,
|
|
32
|
+
createMigrationMediaRefReplaceWith,
|
|
33
|
+
createWpContentGatewayRewrite,
|
|
11
34
|
discoverContentAssetUrls,
|
|
35
|
+
discoverContentAssets,
|
|
12
36
|
discoverFeaturedAssetCandidateUrls,
|
|
13
37
|
discoverRawImgSrcs,
|
|
14
38
|
extractInlineImageSrcs,
|
|
39
|
+
formatMigrationMediaRef,
|
|
15
40
|
isLikelyImageUrl,
|
|
41
|
+
isMigrationMediaRef,
|
|
42
|
+
linkToPath,
|
|
16
43
|
normalizeAssetUrl,
|
|
17
|
-
|
|
44
|
+
parseMigrationMediaRef,
|
|
45
|
+
resolveFeaturedContentAssetUrl,
|
|
46
|
+
resolveMigrationMediaSourceId,
|
|
47
|
+
rewriteOriginUrlsInText,
|
|
48
|
+
sanitizeSlug
|
|
18
49
|
};
|
|
19
50
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
interface OriginUrlRewriteRule {
|
|
2
|
+
/** Literal substring or regex matched against the full text block. */
|
|
3
|
+
match: string | RegExp;
|
|
4
|
+
replace: string;
|
|
5
|
+
}
|
|
6
|
+
interface OriginUrlRewriteConfig {
|
|
7
|
+
rules: OriginUrlRewriteRule[];
|
|
8
|
+
}
|
|
9
|
+
/** Swap legacy gateway/staging host fragments before parse, fetch, or asset discovery. */
|
|
10
|
+
declare function rewriteOriginUrlsInText(text: string, config: OriginUrlRewriteConfig): string;
|
|
11
|
+
/** Build a rule that rewrites API-gateway `/prod/wp-content/` paths to a public origin. */
|
|
12
|
+
declare function createWpContentGatewayRewrite(gatewayBase: string, publicOrigin: string): OriginUrlRewriteConfig;
|
|
13
|
+
interface ContentAssetDiscovery {
|
|
14
|
+
/** Network-resolvable image paths (`<img>`, backgrounds, shortcode `image=` attrs, …). */
|
|
15
|
+
urls: string[];
|
|
16
|
+
/**
|
|
17
|
+
* WordPress attachment post ids referenced in content without an inline URL in this
|
|
18
|
+
* file context (`data-wp-attachment-id`, `[gallery ids=…]`, `[oshine_gallery ids=…]`, …).
|
|
19
|
+
*/
|
|
20
|
+
unresolvedAttachmentIds: string[];
|
|
21
|
+
}
|
|
22
|
+
/** All `<img src>` values (including those not ingested as vault assets). */
|
|
23
|
+
declare function discoverRawImgSrcs(content: string): string[];
|
|
24
|
+
/** Normalize protocol-relative and trim; skip data URIs. */
|
|
25
|
+
declare function normalizeAssetUrl(raw: string): string | undefined;
|
|
26
|
+
/** Heuristic: URL likely points at a raster/vector image asset, not a page link. */
|
|
27
|
+
declare function isLikelyImageUrl(url: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Ordered featured-image candidates when `_thumbnail_id` is missing — heroes
|
|
30
|
+
* (`data-bg-image`, CSS backgrounds, `bg_image=`) before inline assets; within
|
|
31
|
+
* each tier, first in document order wins. Filename tokens (`_w`, `_2048`, …)
|
|
32
|
+
* are not interpreted as quality signals.
|
|
33
|
+
*/
|
|
34
|
+
declare function discoverFeaturedAssetCandidateUrls(content: string): string[];
|
|
35
|
+
/** Best featured-image URL from post/page HTML when attachment id is unavailable. */
|
|
36
|
+
declare function resolveFeaturedContentAssetUrl(content: string): string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Generic content-discovery pass: collect resolvable image URLs and attachment ids
|
|
39
|
+
* that still need an index / REST / crawl resolution step.
|
|
40
|
+
*/
|
|
41
|
+
declare function discoverContentAssets(content: string): ContentAssetDiscovery;
|
|
42
|
+
/**
|
|
43
|
+
* Generic content-discovery pass: collect image URLs from HTML `<img>` tags,
|
|
44
|
+
* section hero markers (`data-bg-image`), inline CSS backgrounds, and common
|
|
45
|
+
* shortcode/builder attributes (`src=`, `image=`, `bg_image=`, …) without
|
|
46
|
+
* parsing builder-specific structure (Tatsu, Elementor, etc.).
|
|
47
|
+
*/
|
|
48
|
+
declare function discoverContentAssetUrls(content: string): string[];
|
|
49
|
+
/** @deprecated Use discoverContentAssetUrls — kept for call-site clarity during transition. */
|
|
50
|
+
declare function extractInlineImageSrcs(content: string): string[];
|
|
51
|
+
/** Pseudo-URL scheme for portable migration asset pointers (not WordPress shortcodes). */
|
|
52
|
+
declare const MIGRATION_MEDIA_REF_SCHEME = "artinstack-migration://asset/";
|
|
53
|
+
/** Build `artinstack-migration://asset/{sourceId}` (percent-encodes the normalizer source id). */
|
|
54
|
+
declare function formatMigrationMediaRef(sourceAssetId: string): string;
|
|
55
|
+
declare function isMigrationMediaRef(value: string): boolean;
|
|
56
|
+
/** Parse a migration media ref back to the normalizer `sourceId`, or `undefined` if not a ref. */
|
|
57
|
+
declare function parseMigrationMediaRef(value: string): string | undefined;
|
|
58
|
+
/** Default `replaceWith` for `rewriteInlineImages` / `stampMigrationMediaRefs` (OSS-14). */
|
|
59
|
+
declare function createMigrationMediaRefReplaceWith(): (ref: {
|
|
60
|
+
sourceAssetId?: string;
|
|
61
|
+
}) => string;
|
|
62
|
+
interface CanonicalInlineAssetUrl {
|
|
63
|
+
/** Canonical absolute URL stored on `NormalizedAsset.sourceUrl`. */
|
|
64
|
+
canonicalUrl: string;
|
|
65
|
+
/** Normalizer id: `url:{canonicalUrl}`. */
|
|
66
|
+
sourceId: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* OSS-15: one canonical key for inline `url:` assets — apply origin rewrite then
|
|
70
|
+
* `normalizeAssetUrl` so discovery, refs, and vault entities share the same id.
|
|
71
|
+
*/
|
|
72
|
+
declare function canonicalizeInlineAssetUrl(raw: string, originUrlRewrite?: OriginUrlRewriteConfig): CanonicalInlineAssetUrl | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Map normalized upload URLs (and pathnames) → normalizer `sourceId`.
|
|
75
|
+
* Attachment ids are WXR `post_id` strings; inline discoveries use `url:{src}`.
|
|
76
|
+
*/
|
|
77
|
+
declare function buildMigrationMediaUrlIndex(entries: Iterable<{
|
|
78
|
+
sourceUrl: string;
|
|
79
|
+
sourceId: string;
|
|
80
|
+
}>): Map<string, string>;
|
|
81
|
+
declare function resolveMigrationMediaSourceId(src: string, urlIndex: Map<string, string>, originUrlRewrite?: OriginUrlRewriteConfig): string | undefined;
|
|
82
|
+
/** Merge attachment + inline asset rows into one stamp/lookup index (OSS-15). */
|
|
83
|
+
declare function buildContentMediaUrlIndex(entries: Iterable<{
|
|
84
|
+
sourceUrl: string;
|
|
85
|
+
sourceId: string;
|
|
86
|
+
}>, originUrlRewrite?: OriginUrlRewriteConfig): Map<string, string>;
|
|
87
|
+
|
|
88
|
+
export { type CanonicalInlineAssetUrl as C, MIGRATION_MEDIA_REF_SCHEME as M, type OriginUrlRewriteConfig as O, type ContentAssetDiscovery as a, type OriginUrlRewriteRule as b, buildContentMediaUrlIndex as c, buildMigrationMediaUrlIndex as d, canonicalizeInlineAssetUrl as e, createMigrationMediaRefReplaceWith as f, createWpContentGatewayRewrite as g, discoverContentAssetUrls as h, discoverContentAssets as i, discoverFeaturedAssetCandidateUrls as j, discoverRawImgSrcs as k, extractInlineImageSrcs as l, formatMigrationMediaRef as m, isLikelyImageUrl as n, isMigrationMediaRef as o, normalizeAssetUrl as p, parseMigrationMediaRef as q, resolveFeaturedContentAssetUrl as r, resolveMigrationMediaSourceId as s, rewriteOriginUrlsInText as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as MigrationCursor, E as EntityKey, P as PortfolioMediaLink, l as ValidationResult } from '../types-
|
|
2
|
-
export { A as AdapterContext, h as EntityType, M as MigrationAdapter, g as MigrationPlatform, b as NormalizedAsset, j as NormalizedAssetExif, d as NormalizedCategory, f as NormalizedEntity, a as NormalizedPage, c as NormalizedPortfolio, N as NormalizedPost, e as NormalizedTag, k as PublishStatus, S as SourceMetadata, V as ValidationIssue, m as entityKey } from '../types-
|
|
3
|
-
import { E as EntityBundle } from '../bundle-
|
|
4
|
-
export { B as BundleCounts, b as bundleCounts, c as collectEntities, e as emptyBundle } from '../bundle-
|
|
1
|
+
import { i as MigrationCursor, E as EntityKey, P as PortfolioMediaLink, l as ValidationResult } from '../types-Ce4r6zqt.js';
|
|
2
|
+
export { A as AdapterContext, h as EntityType, M as MigrationAdapter, g as MigrationPlatform, b as NormalizedAsset, j as NormalizedAssetExif, d as NormalizedCategory, f as NormalizedEntity, a as NormalizedPage, c as NormalizedPortfolio, N as NormalizedPost, e as NormalizedTag, k as PublishStatus, S as SourceMetadata, V as ValidationIssue, m as entityKey } from '../types-Ce4r6zqt.js';
|
|
3
|
+
import { E as EntityBundle } from '../bundle-B3XS20r_.js';
|
|
4
|
+
export { B as BundleCounts, b as bundleCounts, c as collectEntities, e as emptyBundle } from '../bundle-B3XS20r_.js';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
|
|
7
7
|
/** Portable entity state for resume / idempotency (not Directus field names). */
|
package/dist/normalizer/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { O as OriginUrlRewriteConfig } from './media-urls-u49RCyPn.js';
|
|
2
|
+
|
|
1
3
|
interface RewriteInlineImageRef {
|
|
2
4
|
originalSrc: string;
|
|
3
5
|
sourceAssetId?: string;
|
|
@@ -29,6 +31,8 @@ declare function rewriteInlineImages(html: string, options: RewriteInlineImagesO
|
|
|
29
31
|
interface StampMigrationMediaRefsOptions {
|
|
30
32
|
/** Pre-built url/pathname → sourceId map (from attachments + inline assets). */
|
|
31
33
|
urlToSourceId: Map<string, string>;
|
|
34
|
+
/** Canonicalize lookup keys during stamp (OSS-15). */
|
|
35
|
+
originUrlRewrite?: OriginUrlRewriteConfig;
|
|
32
36
|
replaceWith?: RewriteInlineImagesOptions["replaceWith"];
|
|
33
37
|
requireUploaded?: boolean;
|
|
34
38
|
}
|
package/dist/sinks/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { d as NormalizedCategory, e as NormalizedTag, b as NormalizedAsset, c as NormalizedPortfolio, N as NormalizedPost, a as NormalizedPage, P as PortfolioMediaLink, E as EntityKey, f as NormalizedEntity, g as MigrationPlatform, M as MigrationAdapter } from '../types-
|
|
1
|
+
import { d as NormalizedCategory, e as NormalizedTag, b as NormalizedAsset, c as NormalizedPortfolio, N as NormalizedPost, a as NormalizedPage, P as PortfolioMediaLink, E as EntityKey, f as NormalizedEntity, g as MigrationPlatform, M as MigrationAdapter } from '../types-Ce4r6zqt.js';
|
|
2
2
|
import { Readable } from 'node:stream';
|
|
3
|
-
import { a as RewriteInlineImagesOptions } from '../rewrite-inline-images-
|
|
4
|
-
export { b as RewriteInlineImagesResult, r as rewriteInlineImages } from '../rewrite-inline-images-
|
|
5
|
-
import { E as EntityBundle } from '../bundle-
|
|
3
|
+
import { a as RewriteInlineImagesOptions } from '../rewrite-inline-images-BsgSquzV.js';
|
|
4
|
+
export { b as RewriteInlineImagesResult, r as rewriteInlineImages } from '../rewrite-inline-images-BsgSquzV.js';
|
|
5
|
+
import { E as EntityBundle } from '../bundle-B3XS20r_.js';
|
|
6
|
+
import '../media-urls-u49RCyPn.js';
|
|
6
7
|
|
|
7
8
|
interface CreatePostResult {
|
|
8
9
|
targetId: string;
|
|
@@ -115,6 +116,18 @@ interface RedirectLoopConflict {
|
|
|
115
116
|
toPath: string;
|
|
116
117
|
blocked: boolean;
|
|
117
118
|
}
|
|
119
|
+
interface AssetDiscoverySummary {
|
|
120
|
+
/** Unique resolvable image URLs found in post/page HTML. */
|
|
121
|
+
urlsDiscovered: number;
|
|
122
|
+
/** Unique WordPress attachment ids referenced in content (`data-wp-attachment-id`, gallery `ids=`). */
|
|
123
|
+
attachmentRefs: number;
|
|
124
|
+
/** Attachment ids that resolved to a `media.json` row in this job. */
|
|
125
|
+
attachmentRefsResolved: number;
|
|
126
|
+
/** Attachment ids still lacking a URL in this export context. */
|
|
127
|
+
attachmentRefsUnresolved: number;
|
|
128
|
+
/** Sorted unresolved ids (for scan UI / follow-up REST export). */
|
|
129
|
+
unresolvedAttachmentIds: string[];
|
|
130
|
+
}
|
|
118
131
|
interface ConflictReport {
|
|
119
132
|
duplicatePostSlugs: DuplicateSlugConflict[];
|
|
120
133
|
duplicatePageSlugs: DuplicateSlugConflict[];
|
|
@@ -124,7 +137,9 @@ interface ConflictReport {
|
|
|
124
137
|
unresolvedInlineImages: UnresolvedInlineImageConflict[];
|
|
125
138
|
unsupportedBlocks: UnsupportedBlockConflict[];
|
|
126
139
|
redirectLoops: RedirectLoopConflict[];
|
|
140
|
+
assetDiscovery: AssetDiscoverySummary;
|
|
127
141
|
}
|
|
142
|
+
declare function summarizeAssetDiscovery(bundle: EntityBundle): AssetDiscoverySummary;
|
|
128
143
|
declare function emptyConflictReport(): ConflictReport;
|
|
129
144
|
declare function analyzeConflicts(bundle: EntityBundle, options?: {
|
|
130
145
|
staleAssetUrls?: StaleAssetUrlConflict[];
|
|
@@ -157,6 +172,7 @@ interface MigrationReport {
|
|
|
157
172
|
categories: number;
|
|
158
173
|
tags: number;
|
|
159
174
|
storageBytesEstimated?: number;
|
|
175
|
+
assetDiscovery?: AssetDiscoverySummary;
|
|
160
176
|
};
|
|
161
177
|
warnings: string[];
|
|
162
178
|
errors: string[];
|
|
@@ -259,4 +275,4 @@ declare function staleUrlsFromEstimate(estimate: StorageEstimate): {
|
|
|
259
275
|
reason: string;
|
|
260
276
|
}[];
|
|
261
277
|
|
|
262
|
-
export { type ConflictReport, type DryRunOptions, type DryRunResult, FALLBACK_ASSET_BYTES, FilesystemMigrationSink, MIGRATION_WRITE_STAGES, type MigrationRedirect, type MigrationReport, type MigrationRunMode, type MigrationRunOptions, type MigrationRunResult, type MigrationSink, type MigrationWriteStage, RewriteInlineImagesOptions, type StorageEstimate, type UploadAssetInput, type UploadAssetResult, type WriteFilesystemOptions, analyzeConflicts, buildMigrationReport, buildRedirectMap, bundleToCombinedJson, createFilesystemMigrationSink, detectRedirectLoops, emptyConflictReport, estimateStorage, hasBlockingConflicts, hasWarnings, portfolioMediaMatchesBundle, runDryRun, runMigration, runMigrationFromBundle, staleUrlsFromEstimate, writeFilesystemExport };
|
|
278
|
+
export { type AssetDiscoverySummary, type ConflictReport, type DryRunOptions, type DryRunResult, FALLBACK_ASSET_BYTES, FilesystemMigrationSink, MIGRATION_WRITE_STAGES, type MigrationRedirect, type MigrationReport, type MigrationRunMode, type MigrationRunOptions, type MigrationRunResult, type MigrationSink, type MigrationWriteStage, RewriteInlineImagesOptions, type StorageEstimate, type UploadAssetInput, type UploadAssetResult, type WriteFilesystemOptions, analyzeConflicts, buildMigrationReport, buildRedirectMap, bundleToCombinedJson, createFilesystemMigrationSink, detectRedirectLoops, emptyConflictReport, estimateStorage, hasBlockingConflicts, hasWarnings, portfolioMediaMatchesBundle, runDryRun, runMigration, runMigrationFromBundle, staleUrlsFromEstimate, summarizeAssetDiscovery, writeFilesystemExport };
|
package/dist/sinks/index.js
CHANGED
|
@@ -17,13 +17,15 @@ import {
|
|
|
17
17
|
runMigration,
|
|
18
18
|
runMigrationFromBundle,
|
|
19
19
|
staleUrlsFromEstimate,
|
|
20
|
+
summarizeAssetDiscovery,
|
|
20
21
|
writeFilesystemExport
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
22
|
+
} from "../chunk-PPT5RIZ4.js";
|
|
23
|
+
import "../chunk-KTQGOM45.js";
|
|
23
24
|
import {
|
|
24
25
|
rewriteInlineImages
|
|
25
|
-
} from "../chunk-
|
|
26
|
-
import "../chunk-
|
|
26
|
+
} from "../chunk-BONZ3U3I.js";
|
|
27
|
+
import "../chunk-XRCF73DA.js";
|
|
28
|
+
import "../chunk-S4GMDRGX.js";
|
|
27
29
|
export {
|
|
28
30
|
FALLBACK_ASSET_BYTES,
|
|
29
31
|
FilesystemMigrationSink,
|
|
@@ -44,6 +46,7 @@ export {
|
|
|
44
46
|
runMigration,
|
|
45
47
|
runMigrationFromBundle,
|
|
46
48
|
staleUrlsFromEstimate,
|
|
49
|
+
summarizeAssetDiscovery,
|
|
47
50
|
writeFilesystemExport
|
|
48
51
|
};
|
|
49
52
|
//# sourceMappingURL=index.js.map
|