glost-core 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/LICENSE +21 -0
  3. package/README.md +199 -0
  4. package/dist/__benchmarks__/document-creation.bench.d.ts +7 -0
  5. package/dist/__benchmarks__/document-creation.bench.d.ts.map +1 -0
  6. package/dist/__benchmarks__/document-creation.bench.js +71 -0
  7. package/dist/__benchmarks__/document-creation.bench.js.map +1 -0
  8. package/dist/__benchmarks__/traversal.bench.d.ts +7 -0
  9. package/dist/__benchmarks__/traversal.bench.d.ts.map +1 -0
  10. package/dist/__benchmarks__/traversal.bench.js +124 -0
  11. package/dist/__benchmarks__/traversal.bench.js.map +1 -0
  12. package/dist/cli/migrate.d.ts +8 -0
  13. package/dist/cli/migrate.d.ts.map +1 -0
  14. package/dist/cli/migrate.js +229 -0
  15. package/dist/cli/migrate.js.map +1 -0
  16. package/dist/errors.d.ts +168 -0
  17. package/dist/errors.d.ts.map +1 -0
  18. package/dist/errors.js +300 -0
  19. package/dist/errors.js.map +1 -0
  20. package/dist/guards.d.ts +103 -0
  21. package/dist/guards.d.ts.map +1 -0
  22. package/dist/guards.js +264 -0
  23. package/dist/guards.js.map +1 -0
  24. package/dist/index.d.ts +9 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +25 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/nodes.d.ts +227 -0
  29. package/dist/nodes.d.ts.map +1 -0
  30. package/dist/nodes.js +243 -0
  31. package/dist/nodes.js.map +1 -0
  32. package/dist/types.d.ts +442 -0
  33. package/dist/types.d.ts.map +1 -0
  34. package/dist/types.js +51 -0
  35. package/dist/types.js.map +1 -0
  36. package/dist/utils.d.ts +247 -0
  37. package/dist/utils.d.ts.map +1 -0
  38. package/dist/utils.js +564 -0
  39. package/dist/utils.js.map +1 -0
  40. package/dist/validators.d.ts +1876 -0
  41. package/dist/validators.d.ts.map +1 -0
  42. package/dist/validators.js +302 -0
  43. package/dist/validators.js.map +1 -0
  44. package/package.json +73 -0
  45. package/src/__benchmarks__/document-creation.bench.ts +92 -0
  46. package/src/__benchmarks__/traversal.bench.ts +152 -0
  47. package/src/__tests__/README.md +20 -0
  48. package/src/__tests__/example.test.ts +43 -0
  49. package/src/__tests__/example.ts +186 -0
  50. package/src/__tests__/helpers.test.ts +178 -0
  51. package/src/__tests__/mock-data.ts +624 -0
  52. package/src/__tests__/performance.test.ts +317 -0
  53. package/src/__tests__/traversal.test.ts +170 -0
  54. package/src/cli/migrate.ts +294 -0
  55. package/src/errors.ts +394 -0
  56. package/src/guards.ts +341 -0
  57. package/src/index.ts +69 -0
  58. package/src/nodes.ts +409 -0
  59. package/src/types.ts +633 -0
  60. package/src/utils.ts +730 -0
  61. package/src/validators.ts +336 -0
  62. package/tsconfig.json +9 -0
package/dist/errors.js ADDED
@@ -0,0 +1,300 @@
1
+ /**
2
+ * GLOST Error Classes
3
+ *
4
+ * Comprehensive error handling with context, suggestions, and helpful messages
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ /**
9
+ * Base class for all GLOST errors
10
+ */
11
+ export class GLOSTError extends Error {
12
+ context;
13
+ constructor(message, context = {}) {
14
+ super(message);
15
+ this.name = 'GLOSTError';
16
+ this.context = context;
17
+ // Maintain proper stack trace
18
+ if (Error.captureStackTrace) {
19
+ Error.captureStackTrace(this, this.constructor);
20
+ }
21
+ }
22
+ /**
23
+ * Format error message with context
24
+ */
25
+ toString() {
26
+ const parts = [];
27
+ // Header
28
+ parts.push(`${this.name}: ${this.message}`);
29
+ parts.push('');
30
+ // Location information
31
+ if (this.context.path) {
32
+ parts.push(` Location: ${this.context.path.join('.')}`);
33
+ }
34
+ if (this.context.file) {
35
+ parts.push(` File: ${this.context.file}`);
36
+ }
37
+ if (this.context.node) {
38
+ parts.push(` Node type: ${this.context.node.type || 'unknown'}`);
39
+ }
40
+ // Suggestion
41
+ if (this.context.suggestion) {
42
+ parts.push('');
43
+ parts.push(` Suggestion: ${this.context.suggestion}`);
44
+ }
45
+ // Documentation link
46
+ if (this.context.docsUrl) {
47
+ parts.push('');
48
+ parts.push(` Documentation: ${this.context.docsUrl}`);
49
+ }
50
+ // Stack trace
51
+ if (this.stack) {
52
+ parts.push('');
53
+ parts.push(' Stack trace:');
54
+ const stackLines = this.stack.split('\n').slice(1); // Skip first line (message)
55
+ parts.push(...stackLines.map(line => ` ${line}`));
56
+ }
57
+ return parts.join('\n');
58
+ }
59
+ /**
60
+ * Get a concise error summary
61
+ */
62
+ toSummary() {
63
+ let summary = `${this.name}: ${this.message}`;
64
+ if (this.context.path) {
65
+ summary += ` (at ${this.context.path.join('.')})`;
66
+ }
67
+ return summary;
68
+ }
69
+ }
70
+ /**
71
+ * Validation error for schema violations
72
+ */
73
+ export class GLOSTValidationError extends GLOSTError {
74
+ constructor(message, context = {}) {
75
+ super(message, context);
76
+ this.name = 'GLOSTValidationError';
77
+ }
78
+ toString() {
79
+ const parts = [];
80
+ parts.push(`${this.name}: ${this.message}`);
81
+ parts.push('');
82
+ // Location
83
+ if (this.context.path) {
84
+ const location = this.context.path.length > 0
85
+ ? this.context.path.join('.')
86
+ : 'root';
87
+ parts.push(` Location: ${location}`);
88
+ }
89
+ if (this.context.node) {
90
+ const node = this.context.node;
91
+ parts.push(` Node type: ${node.type || 'unknown'}`);
92
+ }
93
+ if (this.context.file) {
94
+ parts.push(` File: ${this.context.file}`);
95
+ }
96
+ // Expected vs Received
97
+ if (this.context.expected) {
98
+ parts.push('');
99
+ parts.push(` Expected: ${JSON.stringify(this.context.expected, null, 2)}`);
100
+ }
101
+ if (this.context.received) {
102
+ parts.push(` Received: ${JSON.stringify(this.context.received, null, 2)}`);
103
+ }
104
+ // Problem explanation
105
+ if (this.context.problem) {
106
+ parts.push('');
107
+ parts.push(` Problem: ${this.context.problem}`);
108
+ }
109
+ // Suggestion
110
+ if (this.context.suggestion) {
111
+ parts.push('');
112
+ parts.push(` Suggestion: ${this.context.suggestion}`);
113
+ }
114
+ // Documentation
115
+ if (this.context.docsUrl) {
116
+ parts.push('');
117
+ parts.push(` Documentation: ${this.context.docsUrl}`);
118
+ }
119
+ return parts.join('\n');
120
+ }
121
+ }
122
+ /**
123
+ * Error for missing required fields
124
+ */
125
+ export class GLOSTMissingFieldError extends GLOSTValidationError {
126
+ constructor(fieldName, nodeType, context = {}) {
127
+ const message = `Missing required field '${fieldName}' on ${nodeType}`;
128
+ super(message, {
129
+ ...context,
130
+ problem: `${nodeType} must have a '${fieldName}' field.`,
131
+ docsUrl: context.docsUrl || `https://glost.dev/docs/node-types#${nodeType.toLowerCase()}`,
132
+ });
133
+ this.name = 'GLOSTMissingFieldError';
134
+ }
135
+ }
136
+ /**
137
+ * Error for invalid field types
138
+ */
139
+ export class GLOSTInvalidTypeError extends GLOSTValidationError {
140
+ constructor(fieldName, expectedType, receivedType, context = {}) {
141
+ const message = `Invalid type for field '${fieldName}': expected ${expectedType}, got ${receivedType}`;
142
+ super(message, {
143
+ ...context,
144
+ problem: `Field '${fieldName}' must be of type ${expectedType}.`,
145
+ suggestion: `Convert the value to ${expectedType} or check your data source.`,
146
+ });
147
+ this.name = 'GLOSTInvalidTypeError';
148
+ }
149
+ }
150
+ /**
151
+ * Error for invalid language codes
152
+ */
153
+ export class GLOSTInvalidLanguageCodeError extends GLOSTValidationError {
154
+ constructor(code, context = {}) {
155
+ const message = `Invalid language code: "${code}"`;
156
+ super(message, {
157
+ ...context,
158
+ problem: `Language codes must follow BCP-47 format (e.g., "en-US", "th-TH").`,
159
+ suggestion: `Use normalizeLanguageCode() from glost-common to convert "${code}" to a valid format.`,
160
+ docsUrl: context.docsUrl || 'https://glost.dev/docs/languages#bcp-47',
161
+ });
162
+ this.name = 'GLOSTInvalidLanguageCodeError';
163
+ }
164
+ }
165
+ /**
166
+ * Error for extension processing
167
+ */
168
+ export class GLOSTExtensionError extends GLOSTError {
169
+ constructor(extensionName, message, context = {}) {
170
+ super(`[${extensionName}] ${message}`, context);
171
+ this.name = 'GLOSTExtensionError';
172
+ }
173
+ }
174
+ /**
175
+ * Error for provider issues
176
+ */
177
+ export class GLOSTProviderError extends GLOSTError {
178
+ constructor(providerName, message, context = {}) {
179
+ super(`[${providerName} Provider] ${message}`, context);
180
+ this.name = 'GLOSTProviderError';
181
+ }
182
+ }
183
+ /**
184
+ * Error for document parsing
185
+ */
186
+ export class GLOSTParseError extends GLOSTError {
187
+ constructor(message, context = {}) {
188
+ super(message, context);
189
+ this.name = 'GLOSTParseError';
190
+ }
191
+ }
192
+ /**
193
+ * Error for serialization issues
194
+ */
195
+ export class GLOSTSerializationError extends GLOSTError {
196
+ constructor(message, context = {}) {
197
+ super(message, context);
198
+ this.name = 'GLOSTSerializationError';
199
+ }
200
+ }
201
+ /**
202
+ * Create a validation error with helpful context
203
+ *
204
+ * @param message - Error message
205
+ * @param options - Error options
206
+ * @returns GLOSTValidationError instance
207
+ *
208
+ * @example
209
+ * ```typescript
210
+ * throw createValidationError('Invalid word node', {
211
+ * node: wordNode,
212
+ * path: ['document', 'children', '0'],
213
+ * suggestion: 'Add a "text" field to the word node',
214
+ * docsUrl: 'https://glost.dev/docs/node-types#word'
215
+ * });
216
+ * ```
217
+ */
218
+ export function createValidationError(message, options = {}) {
219
+ return new GLOSTValidationError(message, options);
220
+ }
221
+ /**
222
+ * Format a path array as a readable string
223
+ *
224
+ * @param path - Path array
225
+ * @returns Formatted path string
226
+ *
227
+ * @example
228
+ * ```typescript
229
+ * formatPath(['document', 'children', '0', 'text'])
230
+ * // Returns: "document.children[0].text"
231
+ * ```
232
+ */
233
+ export function formatPath(path) {
234
+ if (path.length === 0)
235
+ return 'root';
236
+ return path.reduce((acc, segment, index) => {
237
+ if (index === 0)
238
+ return String(segment);
239
+ if (typeof segment === 'number' || !isNaN(Number(segment))) {
240
+ return `${acc}[${segment}]`;
241
+ }
242
+ return `${acc}.${segment}`;
243
+ }, '');
244
+ }
245
+ /**
246
+ * Assert that a condition is true, throw validation error if not
247
+ *
248
+ * @param condition - Condition to check
249
+ * @param message - Error message if condition is false
250
+ * @param context - Error context
251
+ *
252
+ * @example
253
+ * ```typescript
254
+ * glostAssert(
255
+ * node.type === 'word',
256
+ * 'Node must be a word node',
257
+ * { node, path: ['document', 'children', '0'] }
258
+ * );
259
+ * ```
260
+ */
261
+ export function glostAssert(condition, message, context) {
262
+ if (!condition) {
263
+ throw new GLOSTValidationError(message, context);
264
+ }
265
+ }
266
+ /**
267
+ * Wrap an error with additional GLOST context
268
+ *
269
+ * @param error - Original error
270
+ * @param context - Additional context
271
+ * @returns GLOST error
272
+ *
273
+ * @example
274
+ * ```typescript
275
+ * try {
276
+ * await processNode(node);
277
+ * } catch (error) {
278
+ * throw wrapError(error, {
279
+ * node,
280
+ * path: ['document', 'children', '0'],
281
+ * suggestion: 'Check that the node has all required fields'
282
+ * });
283
+ * }
284
+ * ```
285
+ */
286
+ export function wrapError(error, context) {
287
+ if (error instanceof GLOSTError) {
288
+ // Merge contexts - create new error with merged context
289
+ return new GLOSTError(error.message, {
290
+ ...error.context,
291
+ ...context,
292
+ });
293
+ }
294
+ // Create new GLOST error
295
+ return new GLOSTError(error.message, {
296
+ ...context,
297
+ originalError: error,
298
+ });
299
+ }
300
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAsBH;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnB,OAAO,CAAoB;IAE3C,YAAY,OAAe,EAAE,UAA6B,EAAE;QAC1D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,8BAA8B;QAC9B,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,I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;QACxD,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE;YACnC,GAAG,KAAK,CAAC,OAAO;YAChB,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED,yBAAyB;IACzB,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE;QACnC,GAAG,OAAO;QACV,aAAa,EAAE,KAAK;KACrB,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,103 @@
1
+ import type { GLOSTParagraph, GLOSTPunctuation, GLOSTRoot, GLOSTSentence, GLOSTSource, GLOSTSymbol, GLOSTText, GLOSTWhiteSpace, GLOSTWord, GLOSTNode } from "./types.js";
2
+ /**
3
+ * Type guard to check if a node is an GLOSTWord
4
+ */
5
+ export declare function isGLOSTWord(node: unknown): node is GLOSTWord;
6
+ /**
7
+ * Type guard to check if a node is an GLOSTSentence
8
+ */
9
+ export declare function isGLOSTSentence(node: unknown): node is GLOSTSentence;
10
+ /**
11
+ * Type guard to check if a node is an GLOSTParagraph
12
+ */
13
+ export declare function isGLOSTParagraph(node: unknown): node is GLOSTParagraph;
14
+ /**
15
+ * Type guard to check if a node is an GLOSTRoot
16
+ */
17
+ export declare function isGLOSTRoot(node: unknown): node is GLOSTRoot;
18
+ /**
19
+ * Type guard to check if a node is an GLOSTText
20
+ */
21
+ export declare function isGLOSTText(node: unknown): node is GLOSTText;
22
+ /**
23
+ * Type guard to check if a node is an GLOSTPunctuation
24
+ */
25
+ export declare function isGLOSTPunctuation(node: unknown): node is GLOSTPunctuation;
26
+ /**
27
+ * Type guard to check if a node is an GLOSTSymbol
28
+ */
29
+ export declare function isGLOSTSymbol(node: unknown): node is GLOSTSymbol;
30
+ /**
31
+ * Type guard to check if a node is an GLOSTWhiteSpace
32
+ */
33
+ export declare function isGLOSTWhiteSpace(node: unknown): node is GLOSTWhiteSpace;
34
+ /**
35
+ * Type guard to check if a node is an GLOSTSource
36
+ */
37
+ export declare function isGLOSTSource(node: unknown): node is GLOSTSource;
38
+ /**
39
+ * Type guard to check if a node is GLOSTNode (any GLOST node)
40
+ */
41
+ export declare function isGLOSTNode(node: unknown): node is GLOSTNode;
42
+ /**
43
+ * Type guard to check if a node is an GLOSTDocument (Root or Content)
44
+ */
45
+ export declare function isGLOSTDocument(node: unknown): node is GLOSTRoot;
46
+ /**
47
+ * Type guard to check if an array contains only GLOSTWord nodes
48
+ */
49
+ export declare function isGLOSTWordArray(nodes: unknown[]): nodes is GLOSTWord[];
50
+ /**
51
+ * Type guard to check if an array contains only GLOSTSentence nodes
52
+ */
53
+ export declare function isGLOSTSentenceArray(nodes: unknown[]): nodes is GLOSTSentence[];
54
+ /**
55
+ * Type guard to check if an array contains only GLOSTParagraph nodes
56
+ */
57
+ export declare function isGLOSTParagraphArray(nodes: unknown[]): nodes is GLOSTParagraph[];
58
+ /**
59
+ * Type guard to check if an array contains only GLOSTContent nodes
60
+ */
61
+ export declare function isGLOSTContentArray(nodes: unknown[]): nodes is (GLOSTWord | GLOSTSentence | GLOSTParagraph | GLOSTText | GLOSTPunctuation | GLOSTSymbol | GLOSTWhiteSpace | GLOSTSource)[];
62
+ /**
63
+ * Type guard to check if a node has children
64
+ */
65
+ export declare function hasChildren(node: unknown): node is {
66
+ children: unknown[];
67
+ };
68
+ /**
69
+ * Type guard to check if a node has metadata
70
+ */
71
+ export declare function hasMetadata(node: unknown): node is {
72
+ metadata: Record<string, unknown>;
73
+ };
74
+ /**
75
+ * Type guard to check if a node has transcription
76
+ */
77
+ export declare function hasTranscription(node: unknown): node is {
78
+ transcription: Record<string, unknown>;
79
+ };
80
+ /**
81
+ * Type guard to check if a node has extras
82
+ */
83
+ export declare function hasExtras(node: unknown): node is {
84
+ extras: Record<string, unknown>;
85
+ };
86
+ /**
87
+ * Check if a node has valid GLOST structure (type guard based validation)
88
+ * For schema-based validation, use validateGLOSTNode from validators.ts
89
+ */
90
+ export declare function isGLOSTNodeWithValidChildren(node: unknown): node is GLOSTNode;
91
+ /**
92
+ * Check if an array contains valid GLOST nodes (type guard based)
93
+ */
94
+ export declare function isGLOSTNodeArrayValid(nodes: unknown[]): nodes is GLOSTNode[];
95
+ /**
96
+ * Check if a node is a leaf node (no children)
97
+ */
98
+ export declare function isLeafNode(node: GLOSTNode): boolean;
99
+ /**
100
+ * Check if a node is a container node (has children)
101
+ */
102
+ export declare function isContainerNode(node: GLOSTNode): boolean;
103
+ //# sourceMappingURL=guards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,WAAW,EACX,WAAW,EACX,SAAS,EACT,eAAe,EACf,SAAS,EACT,SAAS,EACV,MAAM,YAAY,CAAC;AAMpB;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,SAAS,CAc5D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,aAAa,CAYpE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,cAAc,CAYtE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,SAAS,CAY5D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,SAAS,CAS5D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,gBAAgB,CAS1E;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,WAAW,CAShE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,eAAe,CASxE;AAED;;GAEG;AACH,wBAAgB,a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I;IAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAQpF;AAMD;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,SAAS,CAW7E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,KAAK,IAAI,SAAS,EAAE,CAE5E;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAQnD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAOxD"}
package/dist/guards.js ADDED
@@ -0,0 +1,264 @@
1
+ // ============================================================================
2
+ // GLOST Type Guards for Better Developer Experience
3
+ // ============================================================================
4
+ // ============================================================================
5
+ // Core Node Type Guards
6
+ // ============================================================================
7
+ /**
8
+ * Type guard to check if a node is an GLOSTWord
9
+ */
10
+ export function isGLOSTWord(node) {
11
+ return (typeof node === "object" &&
12
+ node !== null &&
13
+ "type" in node &&
14
+ node.type === "WordNode" &&
15
+ "children" in node &&
16
+ "lang" in node &&
17
+ "script" in node &&
18
+ "level" in node &&
19
+ "metadata" in node &&
20
+ "transcription" in node &&
21
+ "extras" in node);
22
+ }
23
+ /**
24
+ * Type guard to check if a node is an GLOSTSentence
25
+ */
26
+ export function isGLOSTSentence(node) {
27
+ return (typeof node === "object" &&
28
+ node !== null &&
29
+ "type" in node &&
30
+ node.type === "SentenceNode" &&
31
+ "children" in node &&
32
+ "lang" in node &&
33
+ "script" in node &&
34
+ "level" in node &&
35
+ "metadata" in node);
36
+ }
37
+ /**
38
+ * Type guard to check if a node is an GLOSTParagraph
39
+ */
40
+ export function isGLOSTParagraph(node) {
41
+ return (typeof node === "object" &&
42
+ node !== null &&
43
+ "type" in node &&
44
+ node.type === "ParagraphNode" &&
45
+ "children" in node &&
46
+ "lang" in node &&
47
+ "script" in node &&
48
+ "level" in node &&
49
+ "metadata" in node);
50
+ }
51
+ /**
52
+ * Type guard to check if a node is an GLOSTRoot
53
+ */
54
+ export function isGLOSTRoot(node) {
55
+ return (typeof node === "object" &&
56
+ node !== null &&
57
+ "type" in node &&
58
+ node.type === "RootNode" &&
59
+ "children" in node &&
60
+ "lang" in node &&
61
+ "script" in node &&
62
+ "level" in node &&
63
+ "metadata" in node);
64
+ }
65
+ /**
66
+ * Type guard to check if a node is an GLOSTText
67
+ */
68
+ export function isGLOSTText(node) {
69
+ return (typeof node === "object" &&
70
+ node !== null &&
71
+ "type" in node &&
72
+ node.type === "TextNode" &&
73
+ "value" in node &&
74
+ typeof node.value === "string");
75
+ }
76
+ /**
77
+ * Type guard to check if a node is an GLOSTPunctuation
78
+ */
79
+ export function isGLOSTPunctuation(node) {
80
+ return (typeof node === "object" &&
81
+ node !== null &&
82
+ "type" in node &&
83
+ node.type === "PunctuationNode" &&
84
+ "value" in node &&
85
+ typeof node.value === "string");
86
+ }
87
+ /**
88
+ * Type guard to check if a node is an GLOSTSymbol
89
+ */
90
+ export function isGLOSTSymbol(node) {
91
+ return (typeof node === "object" &&
92
+ node !== null &&
93
+ "type" in node &&
94
+ node.type === "SymbolNode" &&
95
+ "value" in node &&
96
+ typeof node.value === "string");
97
+ }
98
+ /**
99
+ * Type guard to check if a node is an GLOSTWhiteSpace
100
+ */
101
+ export function isGLOSTWhiteSpace(node) {
102
+ return (typeof node === "object" &&
103
+ node !== null &&
104
+ "type" in node &&
105
+ node.type === "WhiteSpaceNode" &&
106
+ "value" in node &&
107
+ typeof node.value === "string");
108
+ }
109
+ /**
110
+ * Type guard to check if a node is an GLOSTSource
111
+ */
112
+ export function isGLOSTSource(node) {
113
+ return (typeof node === "object" &&
114
+ node !== null &&
115
+ "type" in node &&
116
+ node.type === "SourceNode" &&
117
+ "value" in node &&
118
+ typeof node.value === "string");
119
+ }
120
+ // ============================================================================
121
+ // Content Type Guards
122
+ // ============================================================================
123
+ /**
124
+ * Type guard to check if a node is GLOSTNode (any GLOST node)
125
+ */
126
+ export function isGLOSTNode(node) {
127
+ return (isGLOSTWord(node) ||
128
+ isGLOSTSentence(node) ||
129
+ isGLOSTParagraph(node) ||
130
+ isGLOSTText(node) ||
131
+ isGLOSTPunctuation(node) ||
132
+ isGLOSTSymbol(node) ||
133
+ isGLOSTWhiteSpace(node) ||
134
+ isGLOSTSource(node) ||
135
+ isGLOSTRoot(node));
136
+ }
137
+ // ============================================================================
138
+ // Document Type Guards
139
+ // ============================================================================
140
+ /**
141
+ * Type guard to check if a node is an GLOSTDocument (Root or Content)
142
+ */
143
+ export function isGLOSTDocument(node) {
144
+ return isGLOSTRoot(node);
145
+ }
146
+ // ============================================================================
147
+ // Array Type Guards
148
+ // ============================================================================
149
+ /**
150
+ * Type guard to check if an array contains only GLOSTWord nodes
151
+ */
152
+ export function isGLOSTWordArray(nodes) {
153
+ return nodes.every(isGLOSTWord);
154
+ }
155
+ /**
156
+ * Type guard to check if an array contains only GLOSTSentence nodes
157
+ */
158
+ export function isGLOSTSentenceArray(nodes) {
159
+ return nodes.every(isGLOSTSentence);
160
+ }
161
+ /**
162
+ * Type guard to check if an array contains only GLOSTParagraph nodes
163
+ */
164
+ export function isGLOSTParagraphArray(nodes) {
165
+ return nodes.every(isGLOSTParagraph);
166
+ }
167
+ /**
168
+ * Type guard to check if an array contains only GLOSTContent nodes
169
+ */
170
+ export function isGLOSTContentArray(nodes) {
171
+ return nodes.every(node => isGLOSTWord(node) ||
172
+ isGLOSTSentence(node) ||
173
+ isGLOSTParagraph(node) ||
174
+ isGLOSTText(node) ||
175
+ isGLOSTPunctuation(node) ||
176
+ isGLOSTSymbol(node) ||
177
+ isGLOSTWhiteSpace(node) ||
178
+ isGLOSTSource(node));
179
+ }
180
+ // ============================================================================
181
+ // Utility Type Guards
182
+ // ============================================================================
183
+ /**
184
+ * Type guard to check if a node has children
185
+ */
186
+ export function hasChildren(node) {
187
+ return (typeof node === "object" &&
188
+ node !== null &&
189
+ "children" in node &&
190
+ Array.isArray(node.children));
191
+ }
192
+ /**
193
+ * Type guard to check if a node has metadata
194
+ */
195
+ export function hasMetadata(node) {
196
+ return (typeof node === "object" &&
197
+ node !== null &&
198
+ "metadata" in node &&
199
+ typeof node.metadata === "object" &&
200
+ node.metadata !== null);
201
+ }
202
+ /**
203
+ * Type guard to check if a node has transcription
204
+ */
205
+ export function hasTranscription(node) {
206
+ return (typeof node === "object" &&
207
+ node !== null &&
208
+ "transcription" in node &&
209
+ typeof node.transcription === "object" &&
210
+ node.transcription !== null);
211
+ }
212
+ /**
213
+ * Type guard to check if a node has extras
214
+ */
215
+ export function hasExtras(node) {
216
+ return (typeof node === "object" &&
217
+ node !== null &&
218
+ "extras" in node &&
219
+ typeof node.extras === "object" &&
220
+ node.extras !== null);
221
+ }
222
+ // ============================================================================
223
+ // Validation Helpers
224
+ // ============================================================================
225
+ /**
226
+ * Check if a node has valid GLOST structure (type guard based validation)
227
+ * For schema-based validation, use validateGLOSTNode from validators.ts
228
+ */
229
+ export function isGLOSTNodeWithValidChildren(node) {
230
+ if (!isGLOSTNode(node)) {
231
+ return false;
232
+ }
233
+ // Additional validation for nodes with children
234
+ if (hasChildren(node)) {
235
+ return node.children.every(isGLOSTNode);
236
+ }
237
+ return true;
238
+ }
239
+ /**
240
+ * Check if an array contains valid GLOST nodes (type guard based)
241
+ */
242
+ export function isGLOSTNodeArrayValid(nodes) {
243
+ return nodes.every(isGLOSTNodeWithValidChildren);
244
+ }
245
+ /**
246
+ * Check if a node is a leaf node (no children)
247
+ */
248
+ export function isLeafNode(node) {
249
+ return (isGLOSTText(node) ||
250
+ isGLOSTPunctuation(node) ||
251
+ isGLOSTSymbol(node) ||
252
+ isGLOSTWhiteSpace(node) ||
253
+ isGLOSTSource(node));
254
+ }
255
+ /**
256
+ * Check if a node is a container node (has children)
257
+ */
258
+ export function isContainerNode(node) {
259
+ return (isGLOSTWord(node) ||
260
+ isGLOSTSentence(node) ||
261
+ isGLOSTParagraph(node) ||
262
+ isGLOSTRoot(node));
263
+ }
264
+ //# sourceMappingURL=guards.js.map