@rynko/sdk 1.0.0 → 1.1.1

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 CHANGED
@@ -449,14 +449,22 @@ app.post('/webhooks/rynko', express.raw({ type: 'application/json' }), (req, res
449
449
 
450
450
  switch (event.type) {
451
451
  case 'document.generated':
452
- const { jobId, downloadUrl, templateId } = event.data;
452
+ const { jobId, downloadUrl, templateId, metadata } = event.data;
453
453
  console.log(`Document ${jobId} ready: ${downloadUrl}`);
454
+ // Access metadata you passed during generation
455
+ if (metadata) {
456
+ console.log(`Order ID: ${metadata.orderId}`);
457
+ }
454
458
  // Download or process the document
455
459
  break;
456
460
 
457
461
  case 'document.failed':
458
- const { jobId: failedJobId, error, errorCode } = event.data;
462
+ const { jobId: failedJobId, error, errorCode, metadata: failedMeta } = event.data;
459
463
  console.error(`Document ${failedJobId} failed: ${error}`);
464
+ // Access metadata for correlation
465
+ if (failedMeta) {
466
+ console.log(`Failed order: ${failedMeta.orderId}`);
467
+ }
460
468
  // Handle failure (retry, notify user, etc.)
461
469
  break;
462
470
 
@@ -486,8 +494,8 @@ app.post('/webhooks/rynko', express.raw({ type: 'application/json' }), (req, res
486
494
 
487
495
  | Event | Description | Payload |
488
496
  |-------|-------------|---------|
489
- | `document.generated` | Document successfully generated | `jobId`, `templateId`, `format`, `downloadUrl`, `fileSize` |
490
- | `document.failed` | Document generation failed | `jobId`, `templateId`, `error`, `errorCode` |
497
+ | `document.generated` | Document successfully generated | `jobId`, `templateId`, `format`, `downloadUrl`, `fileSize`, `metadata` |
498
+ | `document.failed` | Document generation failed | `jobId`, `templateId`, `error`, `errorCode`, `metadata` |
491
499
  | `document.downloaded` | Document was downloaded | `jobId`, `downloadedAt` |
492
500
 
493
501
  #### Webhook Headers
@@ -718,6 +726,17 @@ const result: GenerateDocumentResponse = await rynko.documents.generate(options)
718
726
  | `parseSignatureHeader(header)` | `{ timestamp: string; signatures: string[] }` | Parse signature header |
719
727
  | `computeSignature(timestamp, payload, secret)` | `string` | Compute expected signature |
720
728
 
729
+ ## Examples
730
+
731
+ See the [`examples/`](./examples) directory for runnable code samples:
732
+
733
+ - [basic-generate.ts](./examples/basic-generate.ts) - Generate a PDF and wait for completion
734
+ - [batch-generate.ts](./examples/batch-generate.ts) - Generate multiple documents
735
+ - [webhook-handler.ts](./examples/webhook-handler.ts) - Express webhook endpoint
736
+ - [error-handling.ts](./examples/error-handling.ts) - Handle API errors
737
+
738
+ For complete project templates with full setup, see the [developer-resources](https://github.com/rynko-dev/developer-resources) repository.
739
+
721
740
  ## Requirements
722
741
 
723
742
  - Node.js 18.0.0 or higher
@@ -731,5 +750,6 @@ MIT
731
750
 
732
751
  - **Documentation**: https://docs.rynko.dev/sdk/node
733
752
  - **API Reference**: https://docs.rynko.dev/api
734
- - **GitHub Issues**: https://github.com/rynko/sdk-node/issues
753
+ - **Examples**: https://github.com/rynko-dev/developer-resources
754
+ - **GitHub Issues**: https://github.com/rynko-dev/sdk-node/issues
735
755
  - **Email**: support@rynko.dev
package/dist/index.d.mts CHANGED
@@ -25,6 +25,10 @@ interface RynkoConfig {
25
25
  /** Retry configuration for failed requests */
26
26
  retry?: RetryConfig | false;
27
27
  }
28
+ /** Metadata value types (flat structure, no nested objects) */
29
+ type MetadataValue = string | number | boolean | null;
30
+ /** Custom metadata for tracking and correlation */
31
+ type DocumentMetadata = Record<string, MetadataValue>;
28
32
  interface GenerateDocumentOptions {
29
33
  /** Template ID to use */
30
34
  templateId: string;
@@ -36,24 +40,40 @@ interface GenerateDocumentOptions {
36
40
  filename?: string;
37
41
  /** Webhook URL to receive completion notification */
38
42
  webhookUrl?: string;
39
- /** Custom metadata to pass through to webhook */
40
- metadata?: Record<string, unknown>;
43
+ /**
44
+ * Custom metadata to pass through to API responses and webhooks.
45
+ * Must be a flat object (no nested objects). Max size: 10KB.
46
+ * @example { orderId: 'ord_123', customerId: 'cust_456' }
47
+ */
48
+ metadata?: DocumentMetadata;
41
49
  /** Use draft version instead of published version (for testing) */
42
50
  useDraft?: boolean;
43
51
  /** Force use of purchased credits instead of free quota */
44
52
  useCredit?: boolean;
45
53
  }
54
+ /** Document specification for batch generation */
55
+ interface BatchDocumentSpec {
56
+ /** Template variables for this document */
57
+ variables: Record<string, unknown>;
58
+ /** Custom filename (without extension) */
59
+ filename?: string;
60
+ /** Document-specific metadata */
61
+ metadata?: DocumentMetadata;
62
+ }
46
63
  interface GenerateBatchOptions {
47
64
  /** Template ID to use */
48
65
  templateId: string;
49
66
  /** Output format */
50
67
  format: 'pdf' | 'excel' | 'csv';
51
- /** List of variable sets (one per document) - each object contains the variables for that document */
52
- documents: Record<string, unknown>[];
68
+ /** List of document specifications */
69
+ documents: BatchDocumentSpec[];
53
70
  /** Webhook URL to receive batch completion notification */
54
71
  webhookUrl?: string;
55
- /** Custom metadata for the batch */
56
- metadata?: Record<string, unknown>;
72
+ /**
73
+ * Batch-level metadata (applies to the batch).
74
+ * Must be a flat object (no nested objects). Max size: 10KB.
75
+ */
76
+ metadata?: DocumentMetadata;
57
77
  /** Use draft version instead of published version (for testing) */
58
78
  useDraft?: boolean;
59
79
  /** Force use of purchased credits instead of free quota */
@@ -114,8 +134,8 @@ interface DocumentJob {
114
134
  errorMessage?: string;
115
135
  /** Error code (if failed) */
116
136
  errorCode?: string;
117
- /** Custom metadata */
118
- metadata?: Record<string, unknown>;
137
+ /** Custom metadata passed in the generate request */
138
+ metadata?: DocumentMetadata;
119
139
  /** Whether a webhook was configured for this job */
120
140
  hasWebhook?: boolean;
121
141
  /** Whether webhook was successfully delivered */
@@ -185,12 +205,52 @@ interface WebhookSubscription {
185
205
  createdAt: string;
186
206
  updatedAt: string;
187
207
  }
188
- type WebhookEventType = 'document.generated' | 'document.failed' | 'document.downloaded';
189
- interface WebhookEvent {
208
+ type WebhookEventType = 'document.completed' | 'document.failed' | 'batch.completed';
209
+ /** Data payload for document webhook events */
210
+ interface DocumentWebhookData {
211
+ /** Job ID */
212
+ jobId: string;
213
+ /** Job status */
214
+ status: DocumentJobStatus;
215
+ /** Template ID used */
216
+ templateId: string;
217
+ /** Output format */
218
+ format: 'pdf' | 'excel' | 'csv';
219
+ /** Signed download URL (if completed) */
220
+ downloadUrl?: string;
221
+ /** File size in bytes (if completed) */
222
+ fileSize?: number;
223
+ /** Error message (if failed) */
224
+ errorMessage?: string;
225
+ /** Error code (if failed) */
226
+ errorCode?: string;
227
+ /** Custom metadata passed in the generate request */
228
+ metadata?: Record<string, string | number | boolean | null>;
229
+ }
230
+ /** Data payload for batch webhook events */
231
+ interface BatchWebhookData {
232
+ /** Batch ID */
233
+ batchId: string;
234
+ /** Batch status */
235
+ status: string;
236
+ /** Template ID used */
237
+ templateId: string;
238
+ /** Output format */
239
+ format: 'pdf' | 'excel' | 'csv';
240
+ /** Total jobs in batch */
241
+ totalJobs: number;
242
+ /** Completed jobs count */
243
+ completedJobs: number;
244
+ /** Failed jobs count */
245
+ failedJobs: number;
246
+ /** Custom metadata passed in the batch request */
247
+ metadata?: Record<string, string | number | boolean | null>;
248
+ }
249
+ interface WebhookEvent<T = DocumentWebhookData | BatchWebhookData> {
190
250
  id: string;
191
251
  type: WebhookEventType;
192
252
  timestamp: string;
193
- data: Record<string, unknown>;
253
+ data: T;
194
254
  }
195
255
  interface ApiResponse<T> {
196
256
  success: boolean;
@@ -283,9 +343,18 @@ declare class DocumentsResource {
283
343
  * invoiceNumber: 'INV-001',
284
344
  * amount: 150.00,
285
345
  * },
346
+ * // Optional: attach metadata for tracking
347
+ * metadata: {
348
+ * orderId: 'ord_12345',
349
+ * customerId: 'cust_67890',
350
+ * },
286
351
  * });
287
352
  * console.log('Job ID:', result.jobId);
288
- * console.log('Download URL:', result.downloadUrl);
353
+ *
354
+ * // Metadata is returned in job status and webhook payloads
355
+ * const job = await rynko.documents.waitForCompletion(result.jobId);
356
+ * console.log('Download URL:', job.downloadUrl);
357
+ * console.log('Metadata:', job.metadata); // { orderId: 'ord_12345', ... }
289
358
  * ```
290
359
  */
291
360
  generate(options: GenerateDocumentOptions): Promise<GenerateDocumentResponse>;
@@ -327,9 +396,20 @@ declare class DocumentsResource {
327
396
  * const result = await rynko.documents.generateBatch({
328
397
  * templateId: 'tmpl_invoice',
329
398
  * format: 'pdf',
399
+ * // Optional: batch-level metadata
400
+ * metadata: {
401
+ * batchRunId: 'run_20250115',
402
+ * triggeredBy: 'scheduled_job',
403
+ * },
330
404
  * documents: [
331
- * { variables: { invoiceNumber: 'INV-001', total: 99.99 } },
332
- * { variables: { invoiceNumber: 'INV-002', total: 149.99 } },
405
+ * {
406
+ * variables: { invoiceNumber: 'INV-001', total: 99.99 },
407
+ * metadata: { rowNumber: 1 }, // per-document metadata
408
+ * },
409
+ * {
410
+ * variables: { invoiceNumber: 'INV-002', total: 149.99 },
411
+ * metadata: { rowNumber: 2 },
412
+ * },
333
413
  * ],
334
414
  * });
335
415
  * console.log('Batch ID:', result.batchId);
@@ -613,4 +693,4 @@ declare class WebhookSignatureError extends Error {
613
693
  constructor(message: string);
614
694
  }
615
695
 
616
- export { type ApiError, type ApiResponse, type DocumentJob, type DocumentJobStatus, DocumentsResource, type GenerateBatchOptions, type GenerateBatchResponse, type GenerateDocumentOptions, type GenerateDocumentResponse, type ListDocumentJobsOptions, type ListTemplatesOptions, type PaginationMeta, type RetryConfig, Rynko, type RynkoConfig, RynkoError, type Template, type TemplateVariable, TemplatesResource, type User, type VerifyWebhookOptions, type WebhookEvent, type WebhookEventType, WebhookSignatureError, type WebhookSubscription, WebhooksResource, computeSignature, createClient, parseSignatureHeader, verifyWebhookSignature };
696
+ export { type ApiError, type ApiResponse, type BatchDocumentSpec, type BatchWebhookData, type DocumentJob, type DocumentJobStatus, type DocumentMetadata, type DocumentWebhookData, DocumentsResource, type GenerateBatchOptions, type GenerateBatchResponse, type GenerateDocumentOptions, type GenerateDocumentResponse, type ListDocumentJobsOptions, type ListTemplatesOptions, type MetadataValue, type PaginationMeta, type RetryConfig, Rynko, type RynkoConfig, RynkoError, type Template, type TemplateVariable, TemplatesResource, type User, type VerifyWebhookOptions, type WebhookEvent, type WebhookEventType, WebhookSignatureError, type WebhookSubscription, WebhooksResource, computeSignature, createClient, parseSignatureHeader, verifyWebhookSignature };
package/dist/index.d.ts CHANGED
@@ -25,6 +25,10 @@ interface RynkoConfig {
25
25
  /** Retry configuration for failed requests */
26
26
  retry?: RetryConfig | false;
27
27
  }
28
+ /** Metadata value types (flat structure, no nested objects) */
29
+ type MetadataValue = string | number | boolean | null;
30
+ /** Custom metadata for tracking and correlation */
31
+ type DocumentMetadata = Record<string, MetadataValue>;
28
32
  interface GenerateDocumentOptions {
29
33
  /** Template ID to use */
30
34
  templateId: string;
@@ -36,24 +40,40 @@ interface GenerateDocumentOptions {
36
40
  filename?: string;
37
41
  /** Webhook URL to receive completion notification */
38
42
  webhookUrl?: string;
39
- /** Custom metadata to pass through to webhook */
40
- metadata?: Record<string, unknown>;
43
+ /**
44
+ * Custom metadata to pass through to API responses and webhooks.
45
+ * Must be a flat object (no nested objects). Max size: 10KB.
46
+ * @example { orderId: 'ord_123', customerId: 'cust_456' }
47
+ */
48
+ metadata?: DocumentMetadata;
41
49
  /** Use draft version instead of published version (for testing) */
42
50
  useDraft?: boolean;
43
51
  /** Force use of purchased credits instead of free quota */
44
52
  useCredit?: boolean;
45
53
  }
54
+ /** Document specification for batch generation */
55
+ interface BatchDocumentSpec {
56
+ /** Template variables for this document */
57
+ variables: Record<string, unknown>;
58
+ /** Custom filename (without extension) */
59
+ filename?: string;
60
+ /** Document-specific metadata */
61
+ metadata?: DocumentMetadata;
62
+ }
46
63
  interface GenerateBatchOptions {
47
64
  /** Template ID to use */
48
65
  templateId: string;
49
66
  /** Output format */
50
67
  format: 'pdf' | 'excel' | 'csv';
51
- /** List of variable sets (one per document) - each object contains the variables for that document */
52
- documents: Record<string, unknown>[];
68
+ /** List of document specifications */
69
+ documents: BatchDocumentSpec[];
53
70
  /** Webhook URL to receive batch completion notification */
54
71
  webhookUrl?: string;
55
- /** Custom metadata for the batch */
56
- metadata?: Record<string, unknown>;
72
+ /**
73
+ * Batch-level metadata (applies to the batch).
74
+ * Must be a flat object (no nested objects). Max size: 10KB.
75
+ */
76
+ metadata?: DocumentMetadata;
57
77
  /** Use draft version instead of published version (for testing) */
58
78
  useDraft?: boolean;
59
79
  /** Force use of purchased credits instead of free quota */
@@ -114,8 +134,8 @@ interface DocumentJob {
114
134
  errorMessage?: string;
115
135
  /** Error code (if failed) */
116
136
  errorCode?: string;
117
- /** Custom metadata */
118
- metadata?: Record<string, unknown>;
137
+ /** Custom metadata passed in the generate request */
138
+ metadata?: DocumentMetadata;
119
139
  /** Whether a webhook was configured for this job */
120
140
  hasWebhook?: boolean;
121
141
  /** Whether webhook was successfully delivered */
@@ -185,12 +205,52 @@ interface WebhookSubscription {
185
205
  createdAt: string;
186
206
  updatedAt: string;
187
207
  }
188
- type WebhookEventType = 'document.generated' | 'document.failed' | 'document.downloaded';
189
- interface WebhookEvent {
208
+ type WebhookEventType = 'document.completed' | 'document.failed' | 'batch.completed';
209
+ /** Data payload for document webhook events */
210
+ interface DocumentWebhookData {
211
+ /** Job ID */
212
+ jobId: string;
213
+ /** Job status */
214
+ status: DocumentJobStatus;
215
+ /** Template ID used */
216
+ templateId: string;
217
+ /** Output format */
218
+ format: 'pdf' | 'excel' | 'csv';
219
+ /** Signed download URL (if completed) */
220
+ downloadUrl?: string;
221
+ /** File size in bytes (if completed) */
222
+ fileSize?: number;
223
+ /** Error message (if failed) */
224
+ errorMessage?: string;
225
+ /** Error code (if failed) */
226
+ errorCode?: string;
227
+ /** Custom metadata passed in the generate request */
228
+ metadata?: Record<string, string | number | boolean | null>;
229
+ }
230
+ /** Data payload for batch webhook events */
231
+ interface BatchWebhookData {
232
+ /** Batch ID */
233
+ batchId: string;
234
+ /** Batch status */
235
+ status: string;
236
+ /** Template ID used */
237
+ templateId: string;
238
+ /** Output format */
239
+ format: 'pdf' | 'excel' | 'csv';
240
+ /** Total jobs in batch */
241
+ totalJobs: number;
242
+ /** Completed jobs count */
243
+ completedJobs: number;
244
+ /** Failed jobs count */
245
+ failedJobs: number;
246
+ /** Custom metadata passed in the batch request */
247
+ metadata?: Record<string, string | number | boolean | null>;
248
+ }
249
+ interface WebhookEvent<T = DocumentWebhookData | BatchWebhookData> {
190
250
  id: string;
191
251
  type: WebhookEventType;
192
252
  timestamp: string;
193
- data: Record<string, unknown>;
253
+ data: T;
194
254
  }
195
255
  interface ApiResponse<T> {
196
256
  success: boolean;
@@ -283,9 +343,18 @@ declare class DocumentsResource {
283
343
  * invoiceNumber: 'INV-001',
284
344
  * amount: 150.00,
285
345
  * },
346
+ * // Optional: attach metadata for tracking
347
+ * metadata: {
348
+ * orderId: 'ord_12345',
349
+ * customerId: 'cust_67890',
350
+ * },
286
351
  * });
287
352
  * console.log('Job ID:', result.jobId);
288
- * console.log('Download URL:', result.downloadUrl);
353
+ *
354
+ * // Metadata is returned in job status and webhook payloads
355
+ * const job = await rynko.documents.waitForCompletion(result.jobId);
356
+ * console.log('Download URL:', job.downloadUrl);
357
+ * console.log('Metadata:', job.metadata); // { orderId: 'ord_12345', ... }
289
358
  * ```
290
359
  */
291
360
  generate(options: GenerateDocumentOptions): Promise<GenerateDocumentResponse>;
@@ -327,9 +396,20 @@ declare class DocumentsResource {
327
396
  * const result = await rynko.documents.generateBatch({
328
397
  * templateId: 'tmpl_invoice',
329
398
  * format: 'pdf',
399
+ * // Optional: batch-level metadata
400
+ * metadata: {
401
+ * batchRunId: 'run_20250115',
402
+ * triggeredBy: 'scheduled_job',
403
+ * },
330
404
  * documents: [
331
- * { variables: { invoiceNumber: 'INV-001', total: 99.99 } },
332
- * { variables: { invoiceNumber: 'INV-002', total: 149.99 } },
405
+ * {
406
+ * variables: { invoiceNumber: 'INV-001', total: 99.99 },
407
+ * metadata: { rowNumber: 1 }, // per-document metadata
408
+ * },
409
+ * {
410
+ * variables: { invoiceNumber: 'INV-002', total: 149.99 },
411
+ * metadata: { rowNumber: 2 },
412
+ * },
333
413
  * ],
334
414
  * });
335
415
  * console.log('Batch ID:', result.batchId);
@@ -613,4 +693,4 @@ declare class WebhookSignatureError extends Error {
613
693
  constructor(message: string);
614
694
  }
615
695
 
616
- export { type ApiError, type ApiResponse, type DocumentJob, type DocumentJobStatus, DocumentsResource, type GenerateBatchOptions, type GenerateBatchResponse, type GenerateDocumentOptions, type GenerateDocumentResponse, type ListDocumentJobsOptions, type ListTemplatesOptions, type PaginationMeta, type RetryConfig, Rynko, type RynkoConfig, RynkoError, type Template, type TemplateVariable, TemplatesResource, type User, type VerifyWebhookOptions, type WebhookEvent, type WebhookEventType, WebhookSignatureError, type WebhookSubscription, WebhooksResource, computeSignature, createClient, parseSignatureHeader, verifyWebhookSignature };
696
+ export { type ApiError, type ApiResponse, type BatchDocumentSpec, type BatchWebhookData, type DocumentJob, type DocumentJobStatus, type DocumentMetadata, type DocumentWebhookData, DocumentsResource, type GenerateBatchOptions, type GenerateBatchResponse, type GenerateDocumentOptions, type GenerateDocumentResponse, type ListDocumentJobsOptions, type ListTemplatesOptions, type MetadataValue, type PaginationMeta, type RetryConfig, Rynko, type RynkoConfig, RynkoError, type Template, type TemplateVariable, TemplatesResource, type User, type VerifyWebhookOptions, type WebhookEvent, type WebhookEventType, WebhookSignatureError, type WebhookSubscription, WebhooksResource, computeSignature, createClient, parseSignatureHeader, verifyWebhookSignature };
package/dist/index.js CHANGED
@@ -220,9 +220,18 @@ var DocumentsResource = class {
220
220
  * invoiceNumber: 'INV-001',
221
221
  * amount: 150.00,
222
222
  * },
223
+ * // Optional: attach metadata for tracking
224
+ * metadata: {
225
+ * orderId: 'ord_12345',
226
+ * customerId: 'cust_67890',
227
+ * },
223
228
  * });
224
229
  * console.log('Job ID:', result.jobId);
225
- * console.log('Download URL:', result.downloadUrl);
230
+ *
231
+ * // Metadata is returned in job status and webhook payloads
232
+ * const job = await rynko.documents.waitForCompletion(result.jobId);
233
+ * console.log('Download URL:', job.downloadUrl);
234
+ * console.log('Metadata:', job.metadata); // { orderId: 'ord_12345', ... }
226
235
  * ```
227
236
  */
228
237
  async generate(options) {
@@ -273,9 +282,20 @@ var DocumentsResource = class {
273
282
  * const result = await rynko.documents.generateBatch({
274
283
  * templateId: 'tmpl_invoice',
275
284
  * format: 'pdf',
285
+ * // Optional: batch-level metadata
286
+ * metadata: {
287
+ * batchRunId: 'run_20250115',
288
+ * triggeredBy: 'scheduled_job',
289
+ * },
276
290
  * documents: [
277
- * { variables: { invoiceNumber: 'INV-001', total: 99.99 } },
278
- * { variables: { invoiceNumber: 'INV-002', total: 149.99 } },
291
+ * {
292
+ * variables: { invoiceNumber: 'INV-001', total: 99.99 },
293
+ * metadata: { rowNumber: 1 }, // per-document metadata
294
+ * },
295
+ * {
296
+ * variables: { invoiceNumber: 'INV-002', total: 149.99 },
297
+ * metadata: { rowNumber: 2 },
298
+ * },
279
299
  * ],
280
300
  * });
281
301
  * console.log('Batch ID:', result.batchId);
package/dist/index.mjs CHANGED
@@ -185,9 +185,18 @@ var DocumentsResource = class {
185
185
  * invoiceNumber: 'INV-001',
186
186
  * amount: 150.00,
187
187
  * },
188
+ * // Optional: attach metadata for tracking
189
+ * metadata: {
190
+ * orderId: 'ord_12345',
191
+ * customerId: 'cust_67890',
192
+ * },
188
193
  * });
189
194
  * console.log('Job ID:', result.jobId);
190
- * console.log('Download URL:', result.downloadUrl);
195
+ *
196
+ * // Metadata is returned in job status and webhook payloads
197
+ * const job = await rynko.documents.waitForCompletion(result.jobId);
198
+ * console.log('Download URL:', job.downloadUrl);
199
+ * console.log('Metadata:', job.metadata); // { orderId: 'ord_12345', ... }
191
200
  * ```
192
201
  */
193
202
  async generate(options) {
@@ -238,9 +247,20 @@ var DocumentsResource = class {
238
247
  * const result = await rynko.documents.generateBatch({
239
248
  * templateId: 'tmpl_invoice',
240
249
  * format: 'pdf',
250
+ * // Optional: batch-level metadata
251
+ * metadata: {
252
+ * batchRunId: 'run_20250115',
253
+ * triggeredBy: 'scheduled_job',
254
+ * },
241
255
  * documents: [
242
- * { variables: { invoiceNumber: 'INV-001', total: 99.99 } },
243
- * { variables: { invoiceNumber: 'INV-002', total: 149.99 } },
256
+ * {
257
+ * variables: { invoiceNumber: 'INV-001', total: 99.99 },
258
+ * metadata: { rowNumber: 1 }, // per-document metadata
259
+ * },
260
+ * {
261
+ * variables: { invoiceNumber: 'INV-002', total: 149.99 },
262
+ * metadata: { rowNumber: 2 },
263
+ * },
244
264
  * ],
245
265
  * });
246
266
  * console.log('Batch ID:', result.batchId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rynko/sdk",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "Official Node.js SDK for Rynko - Generate PDFs and Excel files from templates",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",