@lokalise/content-conversion-schemas 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/contentObjects.d.ts +112 -328
- package/dist/api/contentObjects.d.ts.map +1 -1
- package/dist/api/contentObjects.js +22 -4
- package/dist/api/contentObjects.js.map +1 -1
- package/dist/api/contentObjectsNew.d.ts +252 -0
- package/dist/api/contentObjectsNew.d.ts.map +1 -0
- package/dist/api/contentObjectsNew.js +79 -0
- package/dist/api/contentObjectsNew.js.map +1 -0
- package/dist/api/enums.d.ts +27 -0
- package/dist/api/enums.d.ts.map +1 -1
- package/dist/api/enums.js +22 -0
- package/dist/api/enums.js.map +1 -1
- package/dist/api/exportObjects.d.ts +237 -1369
- package/dist/api/exportObjects.d.ts.map +1 -1
- package/dist/api/exportObjects.js +37 -38
- package/dist/api/exportObjects.js.map +1 -1
- package/dist/common.d.ts +9 -7
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +9 -10
- package/dist/common.js.map +1 -1
- package/dist/events/conversion.d.ts +488 -0
- package/dist/events/conversion.d.ts.map +1 -0
- package/dist/events/conversion.js +60 -0
- package/dist/events/conversion.js.map +1 -0
- package/dist/events/export.d.ts +51 -4182
- package/dist/events/export.d.ts.map +1 -1
- package/dist/events/export.js +12 -192
- package/dist/events/export.js.map +1 -1
- package/dist/events/upload.d.ts +119 -1063
- package/dist/events/upload.d.ts.map +1 -1
- package/dist/events/upload.js +21 -29
- package/dist/events/upload.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +11 -9
|
@@ -18,36 +18,52 @@
|
|
|
18
18
|
*
|
|
19
19
|
* RawContentItem represents the content item before parsing, while ParsedContentItem represents the content item after parsing.
|
|
20
20
|
*/
|
|
21
|
-
import { z } from 'zod';
|
|
21
|
+
import { z } from 'zod/v4';
|
|
22
|
+
export declare const TextCodeTypeEnum: {
|
|
23
|
+
readonly OPENING: "OPENING";
|
|
24
|
+
readonly CLOSING: "CLOSING";
|
|
25
|
+
readonly PLACEHOLDER: "PLACEHOLDER";
|
|
26
|
+
};
|
|
27
|
+
export type TextCodeType = (typeof TextCodeTypeEnum)[keyof typeof TextCodeTypeEnum];
|
|
28
|
+
export declare const TEXT_CODE_SCHEMA: z.ZodObject<{
|
|
29
|
+
id: z.ZodString;
|
|
30
|
+
type: z.ZodEnum<{
|
|
31
|
+
readonly OPENING: "OPENING";
|
|
32
|
+
readonly CLOSING: "CLOSING";
|
|
33
|
+
readonly PLACEHOLDER: "PLACEHOLDER";
|
|
34
|
+
}>;
|
|
35
|
+
value: z.ZodString;
|
|
36
|
+
attributes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
37
|
+
parser: z.ZodDefault<z.ZodLiteral<"okapi">>;
|
|
38
|
+
}, z.core.$strip>;
|
|
22
39
|
export declare const TEXT_SEGMENT_SCHEMA: z.ZodString;
|
|
23
40
|
export declare const TEXT_UNIT_SCHEMA: z.ZodObject<{
|
|
24
41
|
id: z.ZodString;
|
|
25
42
|
source: z.ZodObject<{
|
|
43
|
+
textCodes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
type: z.ZodEnum<{
|
|
46
|
+
readonly OPENING: "OPENING";
|
|
47
|
+
readonly CLOSING: "CLOSING";
|
|
48
|
+
readonly PLACEHOLDER: "PLACEHOLDER";
|
|
49
|
+
}>;
|
|
50
|
+
value: z.ZodString;
|
|
51
|
+
attributes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
52
|
+
parser: z.ZodDefault<z.ZodLiteral<"okapi">>;
|
|
53
|
+
}, z.core.$strip>>>>;
|
|
26
54
|
hasBeenSegmented: z.ZodBoolean;
|
|
27
|
-
segments: z.ZodArray<z.ZodString
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
segments: string[];
|
|
31
|
-
}, {
|
|
32
|
-
hasBeenSegmented: boolean;
|
|
33
|
-
segments: string[];
|
|
34
|
-
}>;
|
|
35
|
-
}, "strip", z.ZodTypeAny, {
|
|
36
|
-
id: string;
|
|
37
|
-
source: {
|
|
38
|
-
hasBeenSegmented: boolean;
|
|
39
|
-
segments: string[];
|
|
40
|
-
};
|
|
41
|
-
}, {
|
|
42
|
-
id: string;
|
|
43
|
-
source: {
|
|
44
|
-
hasBeenSegmented: boolean;
|
|
45
|
-
segments: string[];
|
|
46
|
-
};
|
|
47
|
-
}>;
|
|
55
|
+
segments: z.ZodArray<z.ZodString>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
}, z.core.$strip>;
|
|
48
58
|
export declare const RAW_CONTENT_UNIT_SCHEMA: z.ZodObject<{
|
|
49
59
|
id: z.ZodString;
|
|
50
|
-
type: z.
|
|
60
|
+
type: z.ZodEnum<{
|
|
61
|
+
readonly HTML_FILE: "HTML_FILE";
|
|
62
|
+
readonly DOCX_FILE: "DOCX_FILE";
|
|
63
|
+
readonly PPTX_FILE: "PPTX_FILE";
|
|
64
|
+
readonly MARKDOWN_FILE: "MARKDOWN_FILE";
|
|
65
|
+
readonly IDML_FILE: "IDML_FILE";
|
|
66
|
+
readonly JSON_FILE: "JSON_FILE";
|
|
51
67
|
readonly TEXT: "TEXT";
|
|
52
68
|
readonly HTML: "HTML";
|
|
53
69
|
readonly JSON: "JSON";
|
|
@@ -57,46 +73,22 @@ export declare const RAW_CONTENT_UNIT_SCHEMA: z.ZodObject<{
|
|
|
57
73
|
context: z.ZodOptional<z.ZodString>;
|
|
58
74
|
characterLimit: z.ZodOptional<z.ZodNumber>;
|
|
59
75
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
60
|
-
},
|
|
61
|
-
id: string;
|
|
62
|
-
type: "TEXT" | "HTML" | "JSON" | "CONTENTFUL_RICH_TEXT";
|
|
63
|
-
source: string;
|
|
64
|
-
context?: string | undefined;
|
|
65
|
-
characterLimit?: number | undefined;
|
|
66
|
-
metadata?: Record<string, any> | undefined;
|
|
67
|
-
}, {
|
|
68
|
-
id: string;
|
|
69
|
-
type: "TEXT" | "HTML" | "JSON" | "CONTENTFUL_RICH_TEXT";
|
|
70
|
-
source: string;
|
|
71
|
-
context?: string | undefined;
|
|
72
|
-
characterLimit?: number | undefined;
|
|
73
|
-
metadata?: Record<string, any> | undefined;
|
|
74
|
-
}>;
|
|
76
|
+
}, z.core.$strip>;
|
|
75
77
|
export declare const PARSED_CONTENT_UNIT_METADATA_SCHEMA: z.ZodObject<{
|
|
76
78
|
pptxAttributes: z.ZodObject<{
|
|
77
79
|
slideNumber: z.ZodNumber;
|
|
78
80
|
slideType: z.ZodString;
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
slideType: string;
|
|
82
|
-
}, {
|
|
83
|
-
slideNumber: number;
|
|
84
|
-
slideType: string;
|
|
85
|
-
}>;
|
|
86
|
-
}, "strip", z.ZodTypeAny, {
|
|
87
|
-
pptxAttributes: {
|
|
88
|
-
slideNumber: number;
|
|
89
|
-
slideType: string;
|
|
90
|
-
};
|
|
91
|
-
}, {
|
|
92
|
-
pptxAttributes: {
|
|
93
|
-
slideNumber: number;
|
|
94
|
-
slideType: string;
|
|
95
|
-
};
|
|
96
|
-
}>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
}, z.core.$strip>;
|
|
97
83
|
export declare const PARSED_CONTENT_UNIT_SCHEMA: z.ZodObject<{
|
|
98
84
|
id: z.ZodString;
|
|
99
|
-
type: z.
|
|
85
|
+
type: z.ZodEnum<{
|
|
86
|
+
readonly HTML_FILE: "HTML_FILE";
|
|
87
|
+
readonly DOCX_FILE: "DOCX_FILE";
|
|
88
|
+
readonly PPTX_FILE: "PPTX_FILE";
|
|
89
|
+
readonly MARKDOWN_FILE: "MARKDOWN_FILE";
|
|
90
|
+
readonly IDML_FILE: "IDML_FILE";
|
|
91
|
+
readonly JSON_FILE: "JSON_FILE";
|
|
100
92
|
readonly TEXT: "TEXT";
|
|
101
93
|
readonly HTML: "HTML";
|
|
102
94
|
readonly JSON: "JSON";
|
|
@@ -105,75 +97,41 @@ export declare const PARSED_CONTENT_UNIT_SCHEMA: z.ZodObject<{
|
|
|
105
97
|
context: z.ZodOptional<z.ZodString>;
|
|
106
98
|
characterLimit: z.ZodOptional<z.ZodNumber>;
|
|
107
99
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
108
|
-
} & {
|
|
109
100
|
source: z.ZodString;
|
|
110
101
|
sourceWordCount: z.ZodNumber;
|
|
111
102
|
textUnits: z.ZodArray<z.ZodObject<{
|
|
112
103
|
id: z.ZodString;
|
|
113
104
|
source: z.ZodObject<{
|
|
105
|
+
textCodes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
106
|
+
id: z.ZodString;
|
|
107
|
+
type: z.ZodEnum<{
|
|
108
|
+
readonly OPENING: "OPENING";
|
|
109
|
+
readonly CLOSING: "CLOSING";
|
|
110
|
+
readonly PLACEHOLDER: "PLACEHOLDER";
|
|
111
|
+
}>;
|
|
112
|
+
value: z.ZodString;
|
|
113
|
+
attributes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
114
|
+
parser: z.ZodDefault<z.ZodLiteral<"okapi">>;
|
|
115
|
+
}, z.core.$strip>>>>;
|
|
114
116
|
hasBeenSegmented: z.ZodBoolean;
|
|
115
|
-
segments: z.ZodArray<z.ZodString
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
segments: string[];
|
|
119
|
-
}, {
|
|
120
|
-
hasBeenSegmented: boolean;
|
|
121
|
-
segments: string[];
|
|
122
|
-
}>;
|
|
123
|
-
}, "strip", z.ZodTypeAny, {
|
|
124
|
-
id: string;
|
|
125
|
-
source: {
|
|
126
|
-
hasBeenSegmented: boolean;
|
|
127
|
-
segments: string[];
|
|
128
|
-
};
|
|
129
|
-
}, {
|
|
130
|
-
id: string;
|
|
131
|
-
source: {
|
|
132
|
-
hasBeenSegmented: boolean;
|
|
133
|
-
segments: string[];
|
|
134
|
-
};
|
|
135
|
-
}>, "many">;
|
|
117
|
+
segments: z.ZodArray<z.ZodString>;
|
|
118
|
+
}, z.core.$strip>;
|
|
119
|
+
}, z.core.$strip>>;
|
|
136
120
|
position: z.ZodNumber;
|
|
137
|
-
},
|
|
138
|
-
id: string;
|
|
139
|
-
type: "TEXT" | "HTML" | "JSON" | "CONTENTFUL_RICH_TEXT";
|
|
140
|
-
source: string;
|
|
141
|
-
sourceWordCount: number;
|
|
142
|
-
textUnits: {
|
|
143
|
-
id: string;
|
|
144
|
-
source: {
|
|
145
|
-
hasBeenSegmented: boolean;
|
|
146
|
-
segments: string[];
|
|
147
|
-
};
|
|
148
|
-
}[];
|
|
149
|
-
position: number;
|
|
150
|
-
context?: string | undefined;
|
|
151
|
-
characterLimit?: number | undefined;
|
|
152
|
-
metadata?: Record<string, any> | undefined;
|
|
153
|
-
}, {
|
|
154
|
-
id: string;
|
|
155
|
-
type: "TEXT" | "HTML" | "JSON" | "CONTENTFUL_RICH_TEXT";
|
|
156
|
-
source: string;
|
|
157
|
-
sourceWordCount: number;
|
|
158
|
-
textUnits: {
|
|
159
|
-
id: string;
|
|
160
|
-
source: {
|
|
161
|
-
hasBeenSegmented: boolean;
|
|
162
|
-
segments: string[];
|
|
163
|
-
};
|
|
164
|
-
}[];
|
|
165
|
-
position: number;
|
|
166
|
-
context?: string | undefined;
|
|
167
|
-
characterLimit?: number | undefined;
|
|
168
|
-
metadata?: Record<string, any> | undefined;
|
|
169
|
-
}>;
|
|
121
|
+
}, z.core.$strip>;
|
|
170
122
|
export declare const RAW_CONTENT_ITEM_SCHEMA: z.ZodObject<{
|
|
171
123
|
id: z.ZodString;
|
|
172
124
|
name: z.ZodOptional<z.ZodString>;
|
|
173
125
|
priority: z.ZodNumber;
|
|
174
126
|
contentUnits: z.ZodArray<z.ZodObject<{
|
|
175
127
|
id: z.ZodString;
|
|
176
|
-
type: z.
|
|
128
|
+
type: z.ZodEnum<{
|
|
129
|
+
readonly HTML_FILE: "HTML_FILE";
|
|
130
|
+
readonly DOCX_FILE: "DOCX_FILE";
|
|
131
|
+
readonly PPTX_FILE: "PPTX_FILE";
|
|
132
|
+
readonly MARKDOWN_FILE: "MARKDOWN_FILE";
|
|
133
|
+
readonly IDML_FILE: "IDML_FILE";
|
|
134
|
+
readonly JSON_FILE: "JSON_FILE";
|
|
177
135
|
readonly TEXT: "TEXT";
|
|
178
136
|
readonly HTML: "HTML";
|
|
179
137
|
readonly JSON: "JSON";
|
|
@@ -183,70 +141,33 @@ export declare const RAW_CONTENT_ITEM_SCHEMA: z.ZodObject<{
|
|
|
183
141
|
context: z.ZodOptional<z.ZodString>;
|
|
184
142
|
characterLimit: z.ZodOptional<z.ZodNumber>;
|
|
185
143
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
186
|
-
},
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
source: string;
|
|
190
|
-
context?: string | undefined;
|
|
191
|
-
characterLimit?: number | undefined;
|
|
192
|
-
metadata?: Record<string, any> | undefined;
|
|
193
|
-
}, {
|
|
194
|
-
id: string;
|
|
195
|
-
type: "TEXT" | "HTML" | "JSON" | "CONTENTFUL_RICH_TEXT";
|
|
196
|
-
source: string;
|
|
197
|
-
context?: string | undefined;
|
|
198
|
-
characterLimit?: number | undefined;
|
|
199
|
-
metadata?: Record<string, any> | undefined;
|
|
200
|
-
}>, "many">;
|
|
201
|
-
categoryHierarchy: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
|
202
|
-
origin: z.ZodNativeEnum<{
|
|
144
|
+
}, z.core.$strip>>;
|
|
145
|
+
categoryHierarchy: z.ZodArray<z.ZodString>;
|
|
146
|
+
origin: z.ZodEnum<{
|
|
203
147
|
readonly SHOPIFY: "SHOPIFY";
|
|
148
|
+
readonly CONTENTFUL: "CONTENTFUL";
|
|
204
149
|
}>;
|
|
205
150
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
206
|
-
},
|
|
207
|
-
id: string;
|
|
208
|
-
priority: number;
|
|
209
|
-
contentUnits: {
|
|
210
|
-
id: string;
|
|
211
|
-
type: "TEXT" | "HTML" | "JSON" | "CONTENTFUL_RICH_TEXT";
|
|
212
|
-
source: string;
|
|
213
|
-
context?: string | undefined;
|
|
214
|
-
characterLimit?: number | undefined;
|
|
215
|
-
metadata?: Record<string, any> | undefined;
|
|
216
|
-
}[];
|
|
217
|
-
categoryHierarchy: string[];
|
|
218
|
-
origin: "SHOPIFY";
|
|
219
|
-
name?: string | undefined;
|
|
220
|
-
metadata?: Record<string, unknown> | undefined;
|
|
221
|
-
}, {
|
|
222
|
-
id: string;
|
|
223
|
-
priority: number;
|
|
224
|
-
contentUnits: {
|
|
225
|
-
id: string;
|
|
226
|
-
type: "TEXT" | "HTML" | "JSON" | "CONTENTFUL_RICH_TEXT";
|
|
227
|
-
source: string;
|
|
228
|
-
context?: string | undefined;
|
|
229
|
-
characterLimit?: number | undefined;
|
|
230
|
-
metadata?: Record<string, any> | undefined;
|
|
231
|
-
}[];
|
|
232
|
-
categoryHierarchy: string[];
|
|
233
|
-
origin: "SHOPIFY";
|
|
234
|
-
name?: string | undefined;
|
|
235
|
-
metadata?: Record<string, unknown> | undefined;
|
|
236
|
-
}>;
|
|
151
|
+
}, z.core.$strip>;
|
|
237
152
|
export declare const PARSED_CONTENT_ITEM_SCHEMA: z.ZodObject<{
|
|
238
153
|
id: z.ZodString;
|
|
239
154
|
name: z.ZodOptional<z.ZodString>;
|
|
240
155
|
priority: z.ZodNumber;
|
|
241
|
-
categoryHierarchy: z.
|
|
242
|
-
origin: z.
|
|
156
|
+
categoryHierarchy: z.ZodArray<z.ZodString>;
|
|
157
|
+
origin: z.ZodEnum<{
|
|
243
158
|
readonly SHOPIFY: "SHOPIFY";
|
|
159
|
+
readonly CONTENTFUL: "CONTENTFUL";
|
|
244
160
|
}>;
|
|
245
161
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
246
|
-
} & {
|
|
247
162
|
contentUnits: z.ZodArray<z.ZodObject<{
|
|
248
163
|
id: z.ZodString;
|
|
249
|
-
type: z.
|
|
164
|
+
type: z.ZodEnum<{
|
|
165
|
+
readonly HTML_FILE: "HTML_FILE";
|
|
166
|
+
readonly DOCX_FILE: "DOCX_FILE";
|
|
167
|
+
readonly PPTX_FILE: "PPTX_FILE";
|
|
168
|
+
readonly MARKDOWN_FILE: "MARKDOWN_FILE";
|
|
169
|
+
readonly IDML_FILE: "IDML_FILE";
|
|
170
|
+
readonly JSON_FILE: "JSON_FILE";
|
|
250
171
|
readonly TEXT: "TEXT";
|
|
251
172
|
readonly HTML: "HTML";
|
|
252
173
|
readonly JSON: "JSON";
|
|
@@ -255,73 +176,39 @@ export declare const PARSED_CONTENT_ITEM_SCHEMA: z.ZodObject<{
|
|
|
255
176
|
context: z.ZodOptional<z.ZodString>;
|
|
256
177
|
characterLimit: z.ZodOptional<z.ZodNumber>;
|
|
257
178
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
258
|
-
} & {
|
|
259
179
|
source: z.ZodString;
|
|
260
180
|
sourceWordCount: z.ZodNumber;
|
|
261
181
|
textUnits: z.ZodArray<z.ZodObject<{
|
|
262
182
|
id: z.ZodString;
|
|
263
183
|
source: z.ZodObject<{
|
|
184
|
+
textCodes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
185
|
+
id: z.ZodString;
|
|
186
|
+
type: z.ZodEnum<{
|
|
187
|
+
readonly OPENING: "OPENING";
|
|
188
|
+
readonly CLOSING: "CLOSING";
|
|
189
|
+
readonly PLACEHOLDER: "PLACEHOLDER";
|
|
190
|
+
}>;
|
|
191
|
+
value: z.ZodString;
|
|
192
|
+
attributes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
193
|
+
parser: z.ZodDefault<z.ZodLiteral<"okapi">>;
|
|
194
|
+
}, z.core.$strip>>>>;
|
|
264
195
|
hasBeenSegmented: z.ZodBoolean;
|
|
265
|
-
segments: z.ZodArray<z.ZodString
|
|
266
|
-
},
|
|
267
|
-
|
|
268
|
-
segments: string[];
|
|
269
|
-
}, {
|
|
270
|
-
hasBeenSegmented: boolean;
|
|
271
|
-
segments: string[];
|
|
272
|
-
}>;
|
|
273
|
-
}, "strip", z.ZodTypeAny, {
|
|
274
|
-
id: string;
|
|
275
|
-
source: {
|
|
276
|
-
hasBeenSegmented: boolean;
|
|
277
|
-
segments: string[];
|
|
278
|
-
};
|
|
279
|
-
}, {
|
|
280
|
-
id: string;
|
|
281
|
-
source: {
|
|
282
|
-
hasBeenSegmented: boolean;
|
|
283
|
-
segments: string[];
|
|
284
|
-
};
|
|
285
|
-
}>, "many">;
|
|
196
|
+
segments: z.ZodArray<z.ZodString>;
|
|
197
|
+
}, z.core.$strip>;
|
|
198
|
+
}, z.core.$strip>>;
|
|
286
199
|
position: z.ZodNumber;
|
|
287
|
-
},
|
|
288
|
-
id: string;
|
|
289
|
-
type: "TEXT" | "HTML" | "JSON" | "CONTENTFUL_RICH_TEXT";
|
|
290
|
-
source: string;
|
|
291
|
-
sourceWordCount: number;
|
|
292
|
-
textUnits: {
|
|
293
|
-
id: string;
|
|
294
|
-
source: {
|
|
295
|
-
hasBeenSegmented: boolean;
|
|
296
|
-
segments: string[];
|
|
297
|
-
};
|
|
298
|
-
}[];
|
|
299
|
-
position: number;
|
|
300
|
-
context?: string | undefined;
|
|
301
|
-
characterLimit?: number | undefined;
|
|
302
|
-
metadata?: Record<string, any> | undefined;
|
|
303
|
-
}, {
|
|
304
|
-
id: string;
|
|
305
|
-
type: "TEXT" | "HTML" | "JSON" | "CONTENTFUL_RICH_TEXT";
|
|
306
|
-
source: string;
|
|
307
|
-
sourceWordCount: number;
|
|
308
|
-
textUnits: {
|
|
309
|
-
id: string;
|
|
310
|
-
source: {
|
|
311
|
-
hasBeenSegmented: boolean;
|
|
312
|
-
segments: string[];
|
|
313
|
-
};
|
|
314
|
-
}[];
|
|
315
|
-
position: number;
|
|
316
|
-
context?: string | undefined;
|
|
317
|
-
characterLimit?: number | undefined;
|
|
318
|
-
metadata?: Record<string, any> | undefined;
|
|
319
|
-
}>, "many">;
|
|
200
|
+
}, z.core.$strip>>;
|
|
320
201
|
failedContentUnits: z.ZodArray<z.ZodObject<{
|
|
321
202
|
error: z.ZodString;
|
|
322
203
|
rawContentUnit: z.ZodObject<{
|
|
323
204
|
id: z.ZodString;
|
|
324
|
-
type: z.
|
|
205
|
+
type: z.ZodEnum<{
|
|
206
|
+
readonly HTML_FILE: "HTML_FILE";
|
|
207
|
+
readonly DOCX_FILE: "DOCX_FILE";
|
|
208
|
+
readonly PPTX_FILE: "PPTX_FILE";
|
|
209
|
+
readonly MARKDOWN_FILE: "MARKDOWN_FILE";
|
|
210
|
+
readonly IDML_FILE: "IDML_FILE";
|
|
211
|
+
readonly JSON_FILE: "JSON_FILE";
|
|
325
212
|
readonly TEXT: "TEXT";
|
|
326
213
|
readonly HTML: "HTML";
|
|
327
214
|
readonly JSON: "JSON";
|
|
@@ -331,118 +218,15 @@ export declare const PARSED_CONTENT_ITEM_SCHEMA: z.ZodObject<{
|
|
|
331
218
|
context: z.ZodOptional<z.ZodString>;
|
|
332
219
|
characterLimit: z.ZodOptional<z.ZodNumber>;
|
|
333
220
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
334
|
-
},
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
source: string;
|
|
338
|
-
context?: string | undefined;
|
|
339
|
-
characterLimit?: number | undefined;
|
|
340
|
-
metadata?: Record<string, any> | undefined;
|
|
341
|
-
}, {
|
|
342
|
-
id: string;
|
|
343
|
-
type: "TEXT" | "HTML" | "JSON" | "CONTENTFUL_RICH_TEXT";
|
|
344
|
-
source: string;
|
|
345
|
-
context?: string | undefined;
|
|
346
|
-
characterLimit?: number | undefined;
|
|
347
|
-
metadata?: Record<string, any> | undefined;
|
|
348
|
-
}>;
|
|
349
|
-
}, "strip", z.ZodTypeAny, {
|
|
350
|
-
error: string;
|
|
351
|
-
rawContentUnit: {
|
|
352
|
-
id: string;
|
|
353
|
-
type: "TEXT" | "HTML" | "JSON" | "CONTENTFUL_RICH_TEXT";
|
|
354
|
-
source: string;
|
|
355
|
-
context?: string | undefined;
|
|
356
|
-
characterLimit?: number | undefined;
|
|
357
|
-
metadata?: Record<string, any> | undefined;
|
|
358
|
-
};
|
|
359
|
-
}, {
|
|
360
|
-
error: string;
|
|
361
|
-
rawContentUnit: {
|
|
362
|
-
id: string;
|
|
363
|
-
type: "TEXT" | "HTML" | "JSON" | "CONTENTFUL_RICH_TEXT";
|
|
364
|
-
source: string;
|
|
365
|
-
context?: string | undefined;
|
|
366
|
-
characterLimit?: number | undefined;
|
|
367
|
-
metadata?: Record<string, any> | undefined;
|
|
368
|
-
};
|
|
369
|
-
}>, "many">;
|
|
370
|
-
}, "strip", z.ZodTypeAny, {
|
|
371
|
-
id: string;
|
|
372
|
-
priority: number;
|
|
373
|
-
contentUnits: {
|
|
374
|
-
id: string;
|
|
375
|
-
type: "TEXT" | "HTML" | "JSON" | "CONTENTFUL_RICH_TEXT";
|
|
376
|
-
source: string;
|
|
377
|
-
sourceWordCount: number;
|
|
378
|
-
textUnits: {
|
|
379
|
-
id: string;
|
|
380
|
-
source: {
|
|
381
|
-
hasBeenSegmented: boolean;
|
|
382
|
-
segments: string[];
|
|
383
|
-
};
|
|
384
|
-
}[];
|
|
385
|
-
position: number;
|
|
386
|
-
context?: string | undefined;
|
|
387
|
-
characterLimit?: number | undefined;
|
|
388
|
-
metadata?: Record<string, any> | undefined;
|
|
389
|
-
}[];
|
|
390
|
-
categoryHierarchy: string[];
|
|
391
|
-
origin: "SHOPIFY";
|
|
392
|
-
failedContentUnits: {
|
|
393
|
-
error: string;
|
|
394
|
-
rawContentUnit: {
|
|
395
|
-
id: string;
|
|
396
|
-
type: "TEXT" | "HTML" | "JSON" | "CONTENTFUL_RICH_TEXT";
|
|
397
|
-
source: string;
|
|
398
|
-
context?: string | undefined;
|
|
399
|
-
characterLimit?: number | undefined;
|
|
400
|
-
metadata?: Record<string, any> | undefined;
|
|
401
|
-
};
|
|
402
|
-
}[];
|
|
403
|
-
name?: string | undefined;
|
|
404
|
-
metadata?: Record<string, unknown> | undefined;
|
|
405
|
-
}, {
|
|
406
|
-
id: string;
|
|
407
|
-
priority: number;
|
|
408
|
-
contentUnits: {
|
|
409
|
-
id: string;
|
|
410
|
-
type: "TEXT" | "HTML" | "JSON" | "CONTENTFUL_RICH_TEXT";
|
|
411
|
-
source: string;
|
|
412
|
-
sourceWordCount: number;
|
|
413
|
-
textUnits: {
|
|
414
|
-
id: string;
|
|
415
|
-
source: {
|
|
416
|
-
hasBeenSegmented: boolean;
|
|
417
|
-
segments: string[];
|
|
418
|
-
};
|
|
419
|
-
}[];
|
|
420
|
-
position: number;
|
|
421
|
-
context?: string | undefined;
|
|
422
|
-
characterLimit?: number | undefined;
|
|
423
|
-
metadata?: Record<string, any> | undefined;
|
|
424
|
-
}[];
|
|
425
|
-
categoryHierarchy: string[];
|
|
426
|
-
origin: "SHOPIFY";
|
|
427
|
-
failedContentUnits: {
|
|
428
|
-
error: string;
|
|
429
|
-
rawContentUnit: {
|
|
430
|
-
id: string;
|
|
431
|
-
type: "TEXT" | "HTML" | "JSON" | "CONTENTFUL_RICH_TEXT";
|
|
432
|
-
source: string;
|
|
433
|
-
context?: string | undefined;
|
|
434
|
-
characterLimit?: number | undefined;
|
|
435
|
-
metadata?: Record<string, any> | undefined;
|
|
436
|
-
};
|
|
437
|
-
}[];
|
|
438
|
-
name?: string | undefined;
|
|
439
|
-
metadata?: Record<string, unknown> | undefined;
|
|
440
|
-
}>;
|
|
221
|
+
}, z.core.$strip>;
|
|
222
|
+
}, z.core.$strip>>;
|
|
223
|
+
}, z.core.$strip>;
|
|
441
224
|
export type RawContentItem = z.infer<typeof RAW_CONTENT_ITEM_SCHEMA>;
|
|
442
225
|
export type RawContentUnit = z.infer<typeof RAW_CONTENT_UNIT_SCHEMA>;
|
|
443
226
|
export type ParsedContentUnitMetadata = z.infer<typeof PARSED_CONTENT_UNIT_METADATA_SCHEMA>;
|
|
444
227
|
export type ParsedContentItem = z.infer<typeof PARSED_CONTENT_ITEM_SCHEMA>;
|
|
445
228
|
export type ParsedContentUnit = z.infer<typeof PARSED_CONTENT_UNIT_SCHEMA>;
|
|
229
|
+
export type TextCode = z.infer<typeof TEXT_CODE_SCHEMA>;
|
|
446
230
|
export type TextUnit = z.infer<typeof TEXT_UNIT_SCHEMA>;
|
|
447
231
|
export type TextSegment = z.infer<typeof TEXT_SEGMENT_SCHEMA>;
|
|
448
232
|
//# sourceMappingURL=contentObjects.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contentObjects.d.ts","sourceRoot":"","sources":["../../src/api/contentObjects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"contentObjects.d.ts","sourceRoot":"","sources":["../../src/api/contentObjects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAG1B,eAAO,MAAM,gBAAgB;;;;CAInB,CAAA;AACV,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAA;AAEnF,eAAO,MAAM,gBAAgB;;;;;;;;;;iBAa1B,CAAA;AAEH,eAAO,MAAM,mBAAmB,aAI/B,CAAA;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;iBAe1B,CAAA;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;iBA0BlC,CAAA;AAEF,eAAO,MAAM,mCAAmC;;;;;iBAO9C,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKrC,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8BlC,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUG,CAAA;AAE1C,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AACpE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AACpE,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAA;AAC3F,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAC1E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAC1E,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AACvD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AACvD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
|
|
@@ -18,8 +18,25 @@
|
|
|
18
18
|
*
|
|
19
19
|
* RawContentItem represents the content item before parsing, while ParsedContentItem represents the content item after parsing.
|
|
20
20
|
*/
|
|
21
|
-
import { z } from 'zod';
|
|
22
|
-
import { ContentUnitTypeEnum, ItemOriginEnum } from
|
|
21
|
+
import { z } from 'zod/v4';
|
|
22
|
+
import { ContentUnitTypeEnum, ItemOriginEnum } from "./enums.js";
|
|
23
|
+
export const TextCodeTypeEnum = {
|
|
24
|
+
OPENING: 'OPENING',
|
|
25
|
+
CLOSING: 'CLOSING',
|
|
26
|
+
PLACEHOLDER: 'PLACEHOLDER',
|
|
27
|
+
};
|
|
28
|
+
export const TEXT_CODE_SCHEMA = z
|
|
29
|
+
.object({
|
|
30
|
+
id: z.string(),
|
|
31
|
+
type: z.enum(TextCodeTypeEnum),
|
|
32
|
+
value: z.string(),
|
|
33
|
+
attributes: z.string().nullish(),
|
|
34
|
+
parser: z
|
|
35
|
+
.literal('okapi')
|
|
36
|
+
.default('okapi')
|
|
37
|
+
.describe('Indicates the parser that generated this text code.'),
|
|
38
|
+
})
|
|
39
|
+
.describe('Represents a text code, which is a special marker in the segment text that can be used for various purposes, such as indicating placeholders.');
|
|
23
40
|
export const TEXT_SEGMENT_SCHEMA = z.string().describe(`Represents a text segment, a smaller part of a larger text.
|
|
24
41
|
Segments are created through segmentation, where a text is broken down into smaller units, such as sentences,
|
|
25
42
|
to facilitate operations like translation and leveraging translation memory.`);
|
|
@@ -27,6 +44,7 @@ export const TEXT_UNIT_SCHEMA = z
|
|
|
27
44
|
.object({
|
|
28
45
|
id: z.string().min(1).describe('Unique identifier of the text unit within a content unit.'),
|
|
29
46
|
source: z.object({
|
|
47
|
+
textCodes: TEXT_CODE_SCHEMA.array().nullish(),
|
|
30
48
|
hasBeenSegmented: z
|
|
31
49
|
.boolean()
|
|
32
50
|
.describe('Indicates whether the segmentation was applied to the text unit.'),
|
|
@@ -40,7 +58,7 @@ export const RAW_CONTENT_UNIT_SCHEMA = z.object({
|
|
|
40
58
|
.min(1)
|
|
41
59
|
.describe('Identifier of the unit, unique across other contentUnits belonging to a single item, usually human-readable, e.g. "welcome_message" or "header.welcome_message.title".'),
|
|
42
60
|
type: z
|
|
43
|
-
.
|
|
61
|
+
.enum(ContentUnitTypeEnum)
|
|
44
62
|
.describe('The type of content, which may determine requirements for processing, storage, or display.'),
|
|
45
63
|
source: z.string().describe('The source text of the unit.'),
|
|
46
64
|
context: z
|
|
@@ -91,7 +109,7 @@ export const RAW_CONTENT_ITEM_SCHEMA = z.object({
|
|
|
91
109
|
const set = new Set(data);
|
|
92
110
|
return set.size === data.length;
|
|
93
111
|
}, 'Category names must be unique'),
|
|
94
|
-
origin: z.
|
|
112
|
+
origin: z.enum(ItemOriginEnum).describe('Source the item was got from.'),
|
|
95
113
|
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
96
114
|
});
|
|
97
115
|
export const PARSED_CONTENT_ITEM_SCHEMA = RAW_CONTENT_ITEM_SCHEMA.extend({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contentObjects.js","sourceRoot":"","sources":["../../src/api/contentObjects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"contentObjects.js","sourceRoot":"","sources":["../../src/api/contentObjects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,WAAW,EAAE,aAAa;CAClB,CAAA;AAGV,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,CAAC;IACN,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAChC,MAAM,EAAE,CAAC;SACN,OAAO,CAAC,OAAO,CAAC;SAChB,OAAO,CAAC,OAAO,CA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