@artinstack/migrator 0.1.25 → 0.1.26

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.
@@ -1,7 +1,7 @@
1
- import { i as MigrationCursor, E as EntityKey, l as PortfolioMediaLink, n as ValidationResult } from '../types-Bicgdp4Z.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, P as PageHeroSliderHint, k as PageLayoutHints, m as PublishStatus, S as SourceMetadata, V as ValidationIssue, W as WxrImportSummary, o as entityKey } from '../types-Bicgdp4Z.js';
3
- import { E as EntityBundle } from '../bundle-BgoXkWMy.js';
4
- export { B as BundleCounts, b as bundleCounts, c as collectEntities, e as emptyBundle } from '../bundle-BgoXkWMy.js';
1
+ import { j as MigrationCursor, E as EntityKey, m as PortfolioMediaLink, o as ValidationResult } from '../types-Bhi-0uKs.js';
2
+ export { A as AdapterContext, C as CommentModerationStatus, i as EntityType, M as MigrationAdapter, h as MigrationPlatform, b as NormalizedAsset, k as NormalizedAssetExif, d as NormalizedCategory, f as NormalizedComment, g as NormalizedEntity, a as NormalizedPage, c as NormalizedPortfolio, N as NormalizedPost, e as NormalizedTag, P as PageHeroSliderHint, l as PageLayoutHints, n as PublishStatus, S as SourceMetadata, V as ValidationIssue, W as WxrImportSummary, p as entityKey } from '../types-Bhi-0uKs.js';
3
+ import { E as EntityBundle } from '../bundle-CtVh_LGP.js';
4
+ export { B as BundleCounts, b as bundleCounts, c as collectEntities, e as emptyBundle } from '../bundle-CtVh_LGP.js';
5
5
  import { z } from 'zod';
6
6
 
7
7
  /** Portable entity state for resume / idempotency (not Directus field names). */
@@ -76,6 +76,7 @@ declare const normalizedPostSchema: z.ZodObject<{
76
76
  featuredAssetSourceId: z.ZodOptional<z.ZodString>;
77
77
  seoTitle: z.ZodOptional<z.ZodString>;
78
78
  seoDescription: z.ZodOptional<z.ZodString>;
79
+ sourceLikeCount: z.ZodOptional<z.ZodNumber>;
79
80
  }, "strip", z.ZodTypeAny, {
80
81
  type: "post";
81
82
  status: "draft" | "published" | "archived";
@@ -98,6 +99,7 @@ declare const normalizedPostSchema: z.ZodObject<{
98
99
  featuredAssetSourceId?: string | undefined;
99
100
  seoTitle?: string | undefined;
100
101
  seoDescription?: string | undefined;
102
+ sourceLikeCount?: number | undefined;
101
103
  }, {
102
104
  type: "post";
103
105
  status: "draft" | "published" | "archived";
@@ -120,6 +122,77 @@ declare const normalizedPostSchema: z.ZodObject<{
120
122
  featuredAssetSourceId?: string | undefined;
121
123
  seoTitle?: string | undefined;
122
124
  seoDescription?: string | undefined;
125
+ sourceLikeCount?: number | undefined;
126
+ }>;
127
+ declare const normalizedCommentSchema: z.ZodObject<{
128
+ type: z.ZodLiteral<"comment">;
129
+ source: z.ZodObject<{
130
+ platform: z.ZodEnum<["wordpress", "smugmug", "squarespace", "wix"]>;
131
+ id: z.ZodString;
132
+ url: z.ZodOptional<z.ZodString>;
133
+ path: z.ZodOptional<z.ZodString>;
134
+ exportedAt: z.ZodOptional<z.ZodString>;
135
+ }, "strip", z.ZodTypeAny, {
136
+ platform: "wordpress" | "smugmug" | "squarespace" | "wix";
137
+ id: string;
138
+ url?: string | undefined;
139
+ path?: string | undefined;
140
+ exportedAt?: string | undefined;
141
+ }, {
142
+ platform: "wordpress" | "smugmug" | "squarespace" | "wix";
143
+ id: string;
144
+ url?: string | undefined;
145
+ path?: string | undefined;
146
+ exportedAt?: string | undefined;
147
+ }>;
148
+ sourceId: z.ZodString;
149
+ postSourceId: z.ZodString;
150
+ parentSourceId: z.ZodOptional<z.ZodString>;
151
+ contentHtml: z.ZodString;
152
+ status: z.ZodEnum<["approved", "pending", "spam", "rejected"]>;
153
+ authorType: z.ZodLiteral<"guest">;
154
+ authorName: z.ZodOptional<z.ZodString>;
155
+ authorEmail: z.ZodOptional<z.ZodString>;
156
+ authorUrl: z.ZodOptional<z.ZodString>;
157
+ publishedAt: z.ZodOptional<z.ZodString>;
158
+ }, "strip", z.ZodTypeAny, {
159
+ type: "comment";
160
+ status: "approved" | "pending" | "spam" | "rejected";
161
+ source: {
162
+ platform: "wordpress" | "smugmug" | "squarespace" | "wix";
163
+ id: string;
164
+ url?: string | undefined;
165
+ path?: string | undefined;
166
+ exportedAt?: string | undefined;
167
+ };
168
+ sourceId: string;
169
+ contentHtml: string;
170
+ postSourceId: string;
171
+ authorType: "guest";
172
+ publishedAt?: string | undefined;
173
+ parentSourceId?: string | undefined;
174
+ authorName?: string | undefined;
175
+ authorEmail?: string | undefined;
176
+ authorUrl?: string | undefined;
177
+ }, {
178
+ type: "comment";
179
+ status: "approved" | "pending" | "spam" | "rejected";
180
+ source: {
181
+ platform: "wordpress" | "smugmug" | "squarespace" | "wix";
182
+ id: string;
183
+ url?: string | undefined;
184
+ path?: string | undefined;
185
+ exportedAt?: string | undefined;
186
+ };
187
+ sourceId: string;
188
+ contentHtml: string;
189
+ postSourceId: string;
190
+ authorType: "guest";
191
+ publishedAt?: string | undefined;
192
+ parentSourceId?: string | undefined;
193
+ authorName?: string | undefined;
194
+ authorEmail?: string | undefined;
195
+ authorUrl?: string | undefined;
123
196
  }>;
124
197
  declare const normalizedPageSchema: z.ZodObject<{
125
198
  type: z.ZodLiteral<"page">;
@@ -388,8 +461,8 @@ declare const normalizedPortfolioSchema: z.ZodObject<{
388
461
  sourceId: string;
389
462
  title: string;
390
463
  slug: string;
391
- description?: string | undefined;
392
464
  parentSourceId?: string | undefined;
465
+ description?: string | undefined;
393
466
  }, {
394
467
  type: "portfolio";
395
468
  source: {
@@ -402,8 +475,8 @@ declare const normalizedPortfolioSchema: z.ZodObject<{
402
475
  sourceId: string;
403
476
  title: string;
404
477
  slug: string;
405
- description?: string | undefined;
406
478
  parentSourceId?: string | undefined;
479
+ description?: string | undefined;
407
480
  }>;
408
481
  declare const normalizedCategorySchema: z.ZodObject<{
409
482
  type: z.ZodLiteral<"category">;
@@ -537,6 +610,7 @@ declare const normalizedEntitySchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
537
610
  featuredAssetSourceId: z.ZodOptional<z.ZodString>;
538
611
  seoTitle: z.ZodOptional<z.ZodString>;
539
612
  seoDescription: z.ZodOptional<z.ZodString>;
613
+ sourceLikeCount: z.ZodOptional<z.ZodNumber>;
540
614
  }, "strip", z.ZodTypeAny, {
541
615
  type: "post";
542
616
  status: "draft" | "published" | "archived";
@@ -559,6 +633,7 @@ declare const normalizedEntitySchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
559
633
  featuredAssetSourceId?: string | undefined;
560
634
  seoTitle?: string | undefined;
561
635
  seoDescription?: string | undefined;
636
+ sourceLikeCount?: number | undefined;
562
637
  }, {
563
638
  type: "post";
564
639
  status: "draft" | "published" | "archived";
@@ -581,6 +656,7 @@ declare const normalizedEntitySchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
581
656
  featuredAssetSourceId?: string | undefined;
582
657
  seoTitle?: string | undefined;
583
658
  seoDescription?: string | undefined;
659
+ sourceLikeCount?: number | undefined;
584
660
  }>, z.ZodObject<{
585
661
  type: z.ZodLiteral<"page">;
586
662
  source: z.ZodObject<{
@@ -830,8 +906,8 @@ declare const normalizedEntitySchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
830
906
  sourceId: string;
831
907
  title: string;
832
908
  slug: string;
833
- description?: string | undefined;
834
909
  parentSourceId?: string | undefined;
910
+ description?: string | undefined;
835
911
  }, {
836
912
  type: "portfolio";
837
913
  source: {
@@ -844,8 +920,8 @@ declare const normalizedEntitySchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
844
920
  sourceId: string;
845
921
  title: string;
846
922
  slug: string;
847
- description?: string | undefined;
848
923
  parentSourceId?: string | undefined;
924
+ description?: string | undefined;
849
925
  }>, z.ZodObject<{
850
926
  type: z.ZodLiteral<"category">;
851
927
  source: z.ZodObject<{
@@ -942,6 +1018,75 @@ declare const normalizedEntitySchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
942
1018
  sourceId: string;
943
1019
  slug: string;
944
1020
  name: string;
1021
+ }>, z.ZodObject<{
1022
+ type: z.ZodLiteral<"comment">;
1023
+ source: z.ZodObject<{
1024
+ platform: z.ZodEnum<["wordpress", "smugmug", "squarespace", "wix"]>;
1025
+ id: z.ZodString;
1026
+ url: z.ZodOptional<z.ZodString>;
1027
+ path: z.ZodOptional<z.ZodString>;
1028
+ exportedAt: z.ZodOptional<z.ZodString>;
1029
+ }, "strip", z.ZodTypeAny, {
1030
+ platform: "wordpress" | "smugmug" | "squarespace" | "wix";
1031
+ id: string;
1032
+ url?: string | undefined;
1033
+ path?: string | undefined;
1034
+ exportedAt?: string | undefined;
1035
+ }, {
1036
+ platform: "wordpress" | "smugmug" | "squarespace" | "wix";
1037
+ id: string;
1038
+ url?: string | undefined;
1039
+ path?: string | undefined;
1040
+ exportedAt?: string | undefined;
1041
+ }>;
1042
+ sourceId: z.ZodString;
1043
+ postSourceId: z.ZodString;
1044
+ parentSourceId: z.ZodOptional<z.ZodString>;
1045
+ contentHtml: z.ZodString;
1046
+ status: z.ZodEnum<["approved", "pending", "spam", "rejected"]>;
1047
+ authorType: z.ZodLiteral<"guest">;
1048
+ authorName: z.ZodOptional<z.ZodString>;
1049
+ authorEmail: z.ZodOptional<z.ZodString>;
1050
+ authorUrl: z.ZodOptional<z.ZodString>;
1051
+ publishedAt: z.ZodOptional<z.ZodString>;
1052
+ }, "strip", z.ZodTypeAny, {
1053
+ type: "comment";
1054
+ status: "approved" | "pending" | "spam" | "rejected";
1055
+ source: {
1056
+ platform: "wordpress" | "smugmug" | "squarespace" | "wix";
1057
+ id: string;
1058
+ url?: string | undefined;
1059
+ path?: string | undefined;
1060
+ exportedAt?: string | undefined;
1061
+ };
1062
+ sourceId: string;
1063
+ contentHtml: string;
1064
+ postSourceId: string;
1065
+ authorType: "guest";
1066
+ publishedAt?: string | undefined;
1067
+ parentSourceId?: string | undefined;
1068
+ authorName?: string | undefined;
1069
+ authorEmail?: string | undefined;
1070
+ authorUrl?: string | undefined;
1071
+ }, {
1072
+ type: "comment";
1073
+ status: "approved" | "pending" | "spam" | "rejected";
1074
+ source: {
1075
+ platform: "wordpress" | "smugmug" | "squarespace" | "wix";
1076
+ id: string;
1077
+ url?: string | undefined;
1078
+ path?: string | undefined;
1079
+ exportedAt?: string | undefined;
1080
+ };
1081
+ sourceId: string;
1082
+ contentHtml: string;
1083
+ postSourceId: string;
1084
+ authorType: "guest";
1085
+ publishedAt?: string | undefined;
1086
+ parentSourceId?: string | undefined;
1087
+ authorName?: string | undefined;
1088
+ authorEmail?: string | undefined;
1089
+ authorUrl?: string | undefined;
945
1090
  }>]>;
946
1091
  /** Opt-in structural check for a normalized post DTO (no cross-entity FK validation). */
947
1092
  declare function validateNormalizedPost(post: unknown): ValidationResult;
@@ -955,7 +1100,9 @@ declare function validateNormalizedPortfolio(portfolio: unknown): ValidationResu
955
1100
  declare function validateNormalizedCategory(category: unknown): ValidationResult;
956
1101
  /** Opt-in structural check for a normalized tag DTO. */
957
1102
  declare function validateNormalizedTag(tag: unknown): ValidationResult;
1103
+ /** Opt-in structural check for a normalized comment DTO. */
1104
+ declare function validateNormalizedComment(comment: unknown): ValidationResult;
958
1105
  /** Opt-in structural check for any normalized entity discriminated by `type`. */
959
1106
  declare function validateNormalizedEntity(entity: unknown): ValidationResult;
960
1107
 
961
- export { EntityBundle, EntityKey, type EntityState, type MigrationCheckpoint, MigrationCursor, PortfolioMediaLink, type TrackedEntity, ValidationResult, buildPortfolioMediaLinks, isTerminalState, normalizedAssetExifSchema, normalizedAssetSchema, normalizedCategorySchema, normalizedEntitySchema, normalizedPageSchema, normalizedPortfolioSchema, normalizedPostSchema, normalizedTagSchema, shouldProcessEntity, sourceMetadataSchema, validateNormalizedAsset, validateNormalizedCategory, validateNormalizedEntity, validateNormalizedPage, validateNormalizedPortfolio, validateNormalizedPost, validateNormalizedTag };
1108
+ export { EntityBundle, EntityKey, type EntityState, type MigrationCheckpoint, MigrationCursor, PortfolioMediaLink, type TrackedEntity, ValidationResult, buildPortfolioMediaLinks, isTerminalState, normalizedAssetExifSchema, normalizedAssetSchema, normalizedCategorySchema, normalizedCommentSchema, normalizedEntitySchema, normalizedPageSchema, normalizedPortfolioSchema, normalizedPostSchema, normalizedTagSchema, shouldProcessEntity, sourceMetadataSchema, validateNormalizedAsset, validateNormalizedCategory, validateNormalizedComment, validateNormalizedEntity, validateNormalizedPage, validateNormalizedPortfolio, validateNormalizedPost, validateNormalizedTag };
@@ -2,6 +2,7 @@ import {
2
2
  normalizedAssetExifSchema,
3
3
  normalizedAssetSchema,
4
4
  normalizedCategorySchema,
5
+ normalizedCommentSchema,
5
6
  normalizedEntitySchema,
6
7
  normalizedPageSchema,
7
8
  normalizedPortfolioSchema,
@@ -10,12 +11,13 @@ import {
10
11
  sourceMetadataSchema,
11
12
  validateNormalizedAsset,
12
13
  validateNormalizedCategory,
14
+ validateNormalizedComment,
13
15
  validateNormalizedEntity,
14
16
  validateNormalizedPage,
15
17
  validateNormalizedPortfolio,
16
18
  validateNormalizedPost,
17
19
  validateNormalizedTag
18
- } from "../chunk-373TTCG7.js";
20
+ } from "../chunk-YTLMN7HO.js";
19
21
  import {
20
22
  buildPortfolioMediaLinks,
21
23
  bundleCounts,
@@ -24,7 +26,7 @@ import {
24
26
  entityKey,
25
27
  isTerminalState,
26
28
  shouldProcessEntity
27
- } from "../chunk-PD5AZX3B.js";
29
+ } from "../chunk-FEDV5UFR.js";
28
30
  export {
29
31
  buildPortfolioMediaLinks,
30
32
  bundleCounts,
@@ -35,6 +37,7 @@ export {
35
37
  normalizedAssetExifSchema,
36
38
  normalizedAssetSchema,
37
39
  normalizedCategorySchema,
40
+ normalizedCommentSchema,
38
41
  normalizedEntitySchema,
39
42
  normalizedPageSchema,
40
43
  normalizedPortfolioSchema,
@@ -44,6 +47,7 @@ export {
44
47
  sourceMetadataSchema,
45
48
  validateNormalizedAsset,
46
49
  validateNormalizedCategory,
50
+ validateNormalizedComment,
47
51
  validateNormalizedEntity,
48
52
  validateNormalizedPage,
49
53
  validateNormalizedPortfolio,
@@ -1,8 +1,8 @@
1
- import { d as NormalizedCategory, e as NormalizedTag, b as NormalizedAsset, c as NormalizedPortfolio, N as NormalizedPost, a as NormalizedPage, l as PortfolioMediaLink, E as EntityKey, f as NormalizedEntity, g as MigrationPlatform, W as WxrImportSummary, M as MigrationAdapter } from '../types-Bicgdp4Z.js';
1
+ import { d as NormalizedCategory, e as NormalizedTag, b as NormalizedAsset, c as NormalizedPortfolio, N as NormalizedPost, a as NormalizedPage, f as NormalizedComment, m as PortfolioMediaLink, E as EntityKey, g as NormalizedEntity, h as MigrationPlatform, W as WxrImportSummary, M as MigrationAdapter } from '../types-Bhi-0uKs.js';
2
2
  import { Readable } from 'node:stream';
3
3
  import { a as RewriteInlineImagesOptions } from '../rewrite-inline-images-escjz3gT.js';
4
4
  export { b as RewriteInlineImagesResult, r as rewriteInlineImages } from '../rewrite-inline-images-escjz3gT.js';
5
- import { E as EntityBundle } from '../bundle-BgoXkWMy.js';
5
+ import { E as EntityBundle } from '../bundle-CtVh_LGP.js';
6
6
  import '../media-urls-ScJvYI7b.js';
7
7
 
8
8
  interface CreatePostResult {
@@ -13,6 +13,9 @@ interface CreatePageResult {
13
13
  targetId: string;
14
14
  publicPath: string;
15
15
  }
16
+ interface CreateCommentResult {
17
+ targetId: string;
18
+ }
16
19
  interface UploadAssetInput {
17
20
  asset: NormalizedAsset;
18
21
  /** Byte stream from source URL or local file. Optional for metadata-only sinks. */
@@ -50,6 +53,8 @@ interface MigrationSink {
50
53
  }>;
51
54
  createPost(post: NormalizedPost): Promise<CreatePostResult>;
52
55
  createPage(page: NormalizedPage): Promise<CreatePageResult>;
56
+ /** M-engagement — optional until host implements comment import. */
57
+ createComment?(comment: NormalizedComment): Promise<CreateCommentResult>;
53
58
  linkPortfolioMedia?(link: PortfolioMediaLink): Promise<void>;
54
59
  writeRedirect?(redirect: MigrationRedirect): Promise<void>;
55
60
  reportProgress?(progress: MigrationProgress): Promise<void>;
@@ -75,7 +80,7 @@ interface MigrationRunResult {
75
80
  failed: number;
76
81
  skipped: number;
77
82
  }
78
- declare const MIGRATION_WRITE_STAGES: readonly ["taxonomy", "assets", "portfolios", "content", "bindings", "redirects"];
83
+ declare const MIGRATION_WRITE_STAGES: readonly ["taxonomy", "assets", "portfolios", "content", "engagement", "bindings", "redirects"];
79
84
  type MigrationWriteStage = (typeof MIGRATION_WRITE_STAGES)[number];
80
85
 
81
86
  declare function runMigration(options: MigrationRunOptions): Promise<MigrationRunResult>;
@@ -177,6 +182,7 @@ interface MigrationReport {
177
182
  portfolios: number;
178
183
  categories: number;
179
184
  tags: number;
185
+ comments: number;
180
186
  storageBytesEstimated?: number;
181
187
  assetDiscovery?: AssetDiscoverySummary;
182
188
  importableItemCount?: number;
@@ -236,6 +242,7 @@ declare class FilesystemMigrationSink implements MigrationSink {
236
242
  }>;
237
243
  createPost(post: NormalizedPost): Promise<CreatePostResult>;
238
244
  createPage(page: NormalizedPage): Promise<CreatePageResult>;
245
+ createComment(comment: NormalizedComment): Promise<CreateCommentResult>;
239
246
  linkPortfolioMedia(link: PortfolioMediaLink): Promise<void>;
240
247
  writeRedirect(redirect: MigrationRedirect): Promise<void>;
241
248
  flush(options: WriteFilesystemOptions): Promise<void>;
@@ -20,8 +20,8 @@ import {
20
20
  staleUrlsFromEstimate,
21
21
  summarizeAssetDiscovery,
22
22
  writeFilesystemExport
23
- } from "../chunk-FS3KQJCE.js";
24
- import "../chunk-PD5AZX3B.js";
23
+ } from "../chunk-XJDLJM7Q.js";
24
+ import "../chunk-FEDV5UFR.js";
25
25
  import {
26
26
  rewriteInlineImages
27
27
  } from "../chunk-M6NY4OT7.js";
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { n as ValidationResult } from '../types-Bicgdp4Z.js';
2
+ import { o as ValidationResult } from '../types-Bhi-0uKs.js';
3
3
  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-escjz3gT.js';
4
4
  export { d as buildMigrationMediaUrlIndex } from '../media-urls-ScJvYI7b.js';
5
5
 
@@ -1,6 +1,8 @@
1
1
  type MigrationPlatform = "wordpress" | "smugmug" | "squarespace" | "wix";
2
- type EntityType = "post" | "page" | "asset" | "portfolio" | "category" | "tag";
2
+ type EntityType = "post" | "page" | "asset" | "portfolio" | "category" | "tag" | "comment";
3
3
  type PublishStatus = "draft" | "published" | "archived";
4
+ /** AIS comment moderation statuses — import maps legacy values into this set only. */
5
+ type CommentModerationStatus = "approved" | "pending" | "spam" | "rejected";
4
6
  interface SourceMetadata {
5
7
  platform: MigrationPlatform;
6
8
  id: string;
@@ -28,6 +30,11 @@ interface NormalizedPost {
28
30
  featuredAssetSourceId?: string;
29
31
  seoTitle?: string;
30
32
  seoDescription?: string;
33
+ /**
34
+ * Unambiguous like total from the source export (M-engagement).
35
+ * Host may opt in to seed `posts.likes_count`; never invents engagement_likes rows.
36
+ */
37
+ sourceLikeCount?: number;
31
38
  }
32
39
  /** RevSlider / MasterSlider reference from theme hero meta (OSS-27) — alias only, no slide payloads in WXR. */
33
40
  interface PageHeroSliderHint {
@@ -108,7 +115,27 @@ interface NormalizedTag {
108
115
  name: string;
109
116
  slug: string;
110
117
  }
111
- type NormalizedEntity = NormalizedPost | NormalizedPage | NormalizedAsset | NormalizedPortfolio | NormalizedCategory | NormalizedTag;
118
+ /**
119
+ * Independent comment entity (M-engagement) — not nested under NormalizedPost.
120
+ * Authors are always guest provenance; host resolves post/parent via source ids.
121
+ */
122
+ interface NormalizedComment {
123
+ type: "comment";
124
+ source: SourceMetadata;
125
+ sourceId: string;
126
+ /** Source id of the parent post (`NormalizedPost.sourceId`). */
127
+ postSourceId: string;
128
+ /** Source id of the parent comment when threaded; omit for roots. */
129
+ parentSourceId?: string;
130
+ contentHtml: string;
131
+ status: CommentModerationStatus;
132
+ authorType: "guest";
133
+ authorName?: string;
134
+ authorEmail?: string;
135
+ authorUrl?: string;
136
+ publishedAt?: string;
137
+ }
138
+ type NormalizedEntity = NormalizedPost | NormalizedPage | NormalizedAsset | NormalizedPortfolio | NormalizedCategory | NormalizedTag | NormalizedComment;
112
139
  interface ValidationIssue {
113
140
  code: string;
114
141
  message: string;
@@ -126,6 +153,7 @@ interface ValidationResult {
126
153
  portfolioCpt?: number;
127
154
  categories?: number;
128
155
  tags?: number;
156
+ comments?: number;
129
157
  /** WXR rows the parser would emit (OSS-19). */
130
158
  importableItemCount?: number;
131
159
  unsupportedOnly?: boolean;
@@ -160,4 +188,4 @@ interface EntityKey {
160
188
  }
161
189
  declare function entityKey(entity: NormalizedEntity, platform: MigrationPlatform): EntityKey;
162
190
 
163
- export { type AdapterContext as A, type EntityKey as E, type MigrationAdapter as M, type NormalizedPost as N, type PageHeroSliderHint as P, type SourceMetadata as S, type ValidationIssue as V, type WxrImportSummary as W, type NormalizedPage as a, type NormalizedAsset as b, type NormalizedPortfolio as c, type NormalizedCategory as d, type NormalizedTag as e, type NormalizedEntity as f, type MigrationPlatform as g, type EntityType as h, type MigrationCursor as i, type NormalizedAssetExif as j, type PageLayoutHints as k, type PortfolioMediaLink as l, type PublishStatus as m, type ValidationResult as n, entityKey as o };
191
+ export { type AdapterContext as A, type CommentModerationStatus as C, type EntityKey as E, type MigrationAdapter as M, type NormalizedPost as N, type PageHeroSliderHint as P, type SourceMetadata as S, type ValidationIssue as V, type WxrImportSummary as W, type NormalizedPage as a, type NormalizedAsset as b, type NormalizedPortfolio as c, type NormalizedCategory as d, type NormalizedTag as e, type NormalizedComment as f, type NormalizedEntity as g, type MigrationPlatform as h, type EntityType as i, type MigrationCursor as j, type NormalizedAssetExif as k, type PageLayoutHints as l, type PortfolioMediaLink as m, type PublishStatus as n, type ValidationResult as o, entityKey as p };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artinstack/migrator",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "MIT OSS migration framework — WordPress, SmugMug, Squarespace, Wix to portable DTOs. CLI + MigrationSink for any host; also powers import on artinstack.com",
5
5
  "license": "MIT",
6
6
  "author": "ArtInStack",
@@ -64,16 +64,16 @@
64
64
  "node": ">=20"
65
65
  },
66
66
  "dependencies": {
67
- "cheerio": "^1.0.0",
67
+ "cheerio": "^1.2.0",
68
68
  "domhandler": "^5.0.3",
69
- "fast-xml-parser": "^5.8.0",
70
- "zod": "^3.23.8"
69
+ "fast-xml-parser": "^5.11.2",
70
+ "zod": "^3.25.76"
71
71
  },
72
72
  "devDependencies": {
73
- "@types/node": "^20.0.0",
74
- "tsup": "^8.4.0",
75
- "typescript": "^5.4.5",
76
- "vitest": "^3.0.0"
73
+ "@types/node": "^20.19.43",
74
+ "tsup": "^8.5.1",
75
+ "typescript": "^5.9.3",
76
+ "vitest": "^3.2.7"
77
77
  },
78
78
  "scripts": {
79
79
  "build": "tsup",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/normalizer/validate.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport type { ValidationIssue, ValidationResult } from \"./types.js\";\n\nconst migrationPlatformSchema = z.enum([\"wordpress\", \"smugmug\", \"squarespace\", \"wix\"]);\nconst publishStatusSchema = z.enum([\"draft\", \"published\", \"archived\"]);\n\nexport const sourceMetadataSchema = z.object({\n platform: migrationPlatformSchema,\n id: z.string().min(1),\n url: z.string().optional(),\n path: z.string().optional(),\n exportedAt: z.string().optional(),\n});\n\nexport const normalizedPostSchema = z.object({\n type: z.literal(\"post\"),\n source: sourceMetadataSchema,\n sourceId: z.string().min(1),\n title: z.string().min(1),\n slug: z.string().min(1),\n excerpt: z.string().optional(),\n contentHtml: z.string(),\n publishedAt: z.string().optional(),\n status: publishStatusSchema,\n categorySlugs: z.array(z.string().min(1)).optional(),\n tagSlugs: z.array(z.string().min(1)).optional(),\n sourceFeaturedMediaId: z.string().optional(),\n featuredAssetSourceId: z.string().optional(),\n seoTitle: z.string().optional(),\n seoDescription: z.string().optional(),\n});\n\nconst pageHeroSliderHintSchema = z.object({\n plugin: z.enum([\"revslider\", \"masterslider\"]),\n alias: z.string().min(1),\n slidertitle: z.string().optional(),\n source: z.enum([\"meta-shortcode\", \"meta-slider-field\", \"tatsu-json\"]).optional(),\n});\n\nconst pageLayoutHintsSchema = z.object({\n heroSlider: pageHeroSliderHintSchema.optional(),\n});\n\nexport const normalizedPageSchema = z.object({\n type: z.literal(\"page\"),\n source: sourceMetadataSchema,\n sourceId: z.string().min(1),\n title: z.string().min(1),\n slug: z.string().min(1),\n contentHtml: z.string(),\n contentCss: z.string().optional(),\n isHomePage: z.boolean().optional(),\n isPortfolioPage: z.boolean().optional(),\n layoutHints: pageLayoutHintsSchema.optional(),\n status: publishStatusSchema,\n seoTitle: z.string().optional(),\n seoDescription: z.string().optional(),\n});\n\nexport const normalizedAssetExifSchema = z.object({\n iso: z.number().optional(),\n aperture: z.number().optional(),\n shutter: z.string().optional(),\n focalLength: z.number().optional(),\n});\n\nexport const normalizedAssetSchema = z.object({\n type: z.literal(\"asset\"),\n source: sourceMetadataSchema,\n sourceId: z.string().min(1),\n sourceUrl: z.string().min(1),\n filename: z.string().min(1),\n mimeType: z.string().optional(),\n caption: z.string().optional(),\n altText: z.string().optional(),\n keywords: z.array(z.string()).optional(),\n exif: normalizedAssetExifSchema.optional(),\n portfolioSourceId: z.string().optional(),\n sort: z.number().optional(),\n});\n\nexport const normalizedPortfolioSchema = z.object({\n type: z.literal(\"portfolio\"),\n source: sourceMetadataSchema,\n sourceId: z.string().min(1),\n title: z.string().min(1),\n slug: z.string().min(1),\n description: z.string().optional(),\n parentSourceId: z.string().optional(),\n});\n\nexport const normalizedCategorySchema = z.object({\n type: z.literal(\"category\"),\n source: sourceMetadataSchema,\n sourceId: z.string().min(1),\n name: z.string().min(1),\n slug: z.string().min(1),\n});\n\nexport const normalizedTagSchema = z.object({\n type: z.literal(\"tag\"),\n source: sourceMetadataSchema,\n sourceId: z.string().min(1),\n name: z.string().min(1),\n slug: z.string().min(1),\n});\n\nexport const normalizedEntitySchema = z.discriminatedUnion(\"type\", [\n normalizedPostSchema,\n normalizedPageSchema,\n normalizedAssetSchema,\n normalizedPortfolioSchema,\n normalizedCategorySchema,\n normalizedTagSchema,\n]);\n\nfunction zodIssuesToValidationIssues(issues: z.ZodIssue[]): ValidationIssue[] {\n return issues.map((issue) => ({\n code: issue.code,\n message: issue.message,\n path: issue.path.length > 0 ? issue.path.join(\".\") : undefined,\n }));\n}\n\nfunction parseToValidationResult(schema: z.ZodTypeAny, value: unknown): ValidationResult {\n const result = schema.safeParse(value);\n if (result.success) {\n return { ok: true, issues: [] };\n }\n return { ok: false, issues: zodIssuesToValidationIssues(result.error.issues) };\n}\n\n/** Opt-in structural check for a normalized post DTO (no cross-entity FK validation). */\nexport function validateNormalizedPost(post: unknown): ValidationResult {\n return parseToValidationResult(normalizedPostSchema, post);\n}\n\n/** Opt-in structural check for a normalized page DTO (no cross-entity FK validation). */\nexport function validateNormalizedPage(page: unknown): ValidationResult {\n return parseToValidationResult(normalizedPageSchema, page);\n}\n\n/** Opt-in structural check for a normalized asset DTO. */\nexport function validateNormalizedAsset(asset: unknown): ValidationResult {\n return parseToValidationResult(normalizedAssetSchema, asset);\n}\n\n/** Opt-in structural check for a normalized portfolio DTO. */\nexport function validateNormalizedPortfolio(portfolio: unknown): ValidationResult {\n return parseToValidationResult(normalizedPortfolioSchema, portfolio);\n}\n\n/** Opt-in structural check for a normalized category DTO. */\nexport function validateNormalizedCategory(category: unknown): ValidationResult {\n return parseToValidationResult(normalizedCategorySchema, category);\n}\n\n/** Opt-in structural check for a normalized tag DTO. */\nexport function validateNormalizedTag(tag: unknown): ValidationResult {\n return parseToValidationResult(normalizedTagSchema, tag);\n}\n\n/** Opt-in structural check for any normalized entity discriminated by `type`. */\nexport function validateNormalizedEntity(entity: unknown): ValidationResult {\n return parseToValidationResult(normalizedEntitySchema, entity);\n}\n"],"mappings":";AAAA,SAAS,SAAS;AAIlB,IAAM,0BAA0B,EAAE,KAAK,CAAC,aAAa,WAAW,eAAe,KAAK,CAAC;AACrF,IAAM,sBAAsB,EAAE,KAAK,CAAC,SAAS,aAAa,UAAU,CAAC;AAE9D,IAAM,uBAAuB,EAAE,OAAO;AAAA,EAC3C,UAAU;AAAA,EACV,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACpB,KAAK,EAAE,OAAO,EAAE,SAAS;AAAA,EACzB,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,YAAY,EAAE,OAAO,EAAE,SAAS;AAClC,CAAC;AAEM,IAAM,uBAAuB,EAAE,OAAO;AAAA,EAC3C,MAAM,EAAE,QAAQ,MAAM;AAAA,EACtB,QAAQ;AAAA,EACR,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAC1B,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACvB,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,aAAa,EAAE,OAAO;AAAA,EACtB,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,QAAQ;AAAA,EACR,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE,SAAS;AAAA,EACnD,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE,SAAS;AAAA,EAC9C,uBAAuB,EAAE,OAAO,EAAE,SAAS;AAAA,EAC3C,uBAAuB,EAAE,OAAO,EAAE,SAAS;AAAA,EAC3C,UAAU,EAAE,OAAO,EAAE,SAAS;AAAA,EAC9B,gBAAgB,EAAE,OAAO,EAAE,SAAS;AACtC,CAAC;AAED,IAAM,2BAA2B,EAAE,OAAO;AAAA,EACx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