@ketrics/sdk-backend 0.2.0 → 0.4.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/README.md +1311 -127
- package/dist/context.d.ts +7 -5
- package/dist/context.d.ts.map +1 -1
- package/dist/excel-errors.d.ts +77 -0
- package/dist/excel-errors.d.ts.map +1 -0
- package/dist/excel-errors.js +127 -0
- package/dist/excel-errors.js.map +1 -0
- package/dist/excel.d.ts +171 -0
- package/dist/excel.d.ts.map +1 -0
- package/dist/excel.js +8 -0
- package/dist/excel.js.map +1 -0
- package/dist/index.d.ts +282 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -1
- package/dist/index.js.map +1 -1
- package/dist/job-errors.d.ts +157 -0
- package/dist/job-errors.d.ts.map +1 -0
- package/dist/job-errors.js +212 -0
- package/dist/job-errors.js.map +1 -0
- package/dist/job.d.ts +158 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +31 -0
- package/dist/job.js.map +1 -0
- package/dist/pdf-errors.d.ts +77 -0
- package/dist/pdf-errors.d.ts.map +1 -0
- package/dist/pdf-errors.js +127 -0
- package/dist/pdf-errors.js.map +1 -0
- package/dist/pdf.d.ts +268 -0
- package/dist/pdf.d.ts.map +1 -0
- package/dist/pdf.js +8 -0
- package/dist/pdf.js.map +1 -0
- package/package.json +2 -2
package/dist/context.d.ts
CHANGED
|
@@ -37,17 +37,19 @@ export interface ApplicationContext {
|
|
|
37
37
|
/**
|
|
38
38
|
* User Context
|
|
39
39
|
*
|
|
40
|
-
* Information about the user making the request.
|
|
40
|
+
* Information about the user or service account making the request.
|
|
41
41
|
*/
|
|
42
42
|
export interface UserContext {
|
|
43
|
-
/** User UUID */
|
|
43
|
+
/** User UUID or Service Account UUID */
|
|
44
44
|
id: string;
|
|
45
|
-
/** User email address */
|
|
45
|
+
/** User email address (empty for service accounts) */
|
|
46
46
|
email: string;
|
|
47
|
-
/** User full name */
|
|
47
|
+
/** User full name or Service Account display name */
|
|
48
48
|
name: string;
|
|
49
|
-
/** Whether user is tenant admin */
|
|
49
|
+
/** Whether user is tenant admin (false for service accounts) */
|
|
50
50
|
isAdmin: boolean;
|
|
51
|
+
/** Whether this is a service account (non-human identity) */
|
|
52
|
+
isServiceAccount: boolean;
|
|
51
53
|
}
|
|
52
54
|
/**
|
|
53
55
|
* Environment Context
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,kBAAkB;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,kBAAkB;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,OAAO,EAAE,OAAO,CAAC;IACjB,6DAA6D;IAC7D,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,uBAAuB;IACvB,OAAO,EAAE,aAAa,CAAC;IACvB,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Excel SDK Error Classes
|
|
3
|
+
*
|
|
4
|
+
* Error types for Excel operations in tenant applications.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Base error for all Excel operations
|
|
8
|
+
*
|
|
9
|
+
* All Excel-related errors inherit from this class, providing
|
|
10
|
+
* consistent context and structure for error handling.
|
|
11
|
+
*/
|
|
12
|
+
export declare abstract class ExcelError extends Error {
|
|
13
|
+
/** Operation that caused the error */
|
|
14
|
+
readonly operation: string;
|
|
15
|
+
/** Timestamp when the error occurred */
|
|
16
|
+
readonly timestamp: Date;
|
|
17
|
+
constructor(operation: string, message: string);
|
|
18
|
+
/**
|
|
19
|
+
* Convert error to JSON-serializable object
|
|
20
|
+
*/
|
|
21
|
+
toJSON(): Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Error parsing Excel file
|
|
25
|
+
*
|
|
26
|
+
* Thrown when an Excel file cannot be parsed due to invalid format,
|
|
27
|
+
* corrupted data, or unsupported features.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* try {
|
|
32
|
+
* const workbook = await ketrics.Excel.read(buffer);
|
|
33
|
+
* } catch (error) {
|
|
34
|
+
* if (error instanceof ketrics.ExcelParseError) {
|
|
35
|
+
* console.log('Failed to parse Excel file:', error.message);
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare class ExcelParseError extends ExcelError {
|
|
41
|
+
/** The reason for the parse failure */
|
|
42
|
+
readonly reason: string;
|
|
43
|
+
constructor(reason: string);
|
|
44
|
+
toJSON(): Record<string, unknown>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Error writing Excel file
|
|
48
|
+
*
|
|
49
|
+
* Thrown when an Excel file cannot be written due to invalid data
|
|
50
|
+
* or other write errors.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* try {
|
|
55
|
+
* const buffer = await workbook.toBuffer();
|
|
56
|
+
* } catch (error) {
|
|
57
|
+
* if (error instanceof ketrics.ExcelWriteError) {
|
|
58
|
+
* console.log('Failed to write Excel file:', error.message);
|
|
59
|
+
* }
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare class ExcelWriteError extends ExcelError {
|
|
64
|
+
/** The reason for the write failure */
|
|
65
|
+
readonly reason: string;
|
|
66
|
+
constructor(reason: string);
|
|
67
|
+
toJSON(): Record<string, unknown>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Type guard to check if an error is an ExcelError
|
|
71
|
+
*/
|
|
72
|
+
export declare function isExcelError(error: unknown): error is ExcelError;
|
|
73
|
+
/**
|
|
74
|
+
* Type guard to check if an error is a specific Excel error type
|
|
75
|
+
*/
|
|
76
|
+
export declare function isExcelErrorType<T extends ExcelError>(error: unknown, errorClass: new (...args: never[]) => T): error is T;
|
|
77
|
+
//# sourceMappingURL=excel-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"excel-errors.d.ts","sourceRoot":"","sources":["../src/excel-errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;;;GAKG;AACH,8BAAsB,UAAW,SAAQ,KAAK;IAC5C,sCAAsC;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,wCAAwC;IACxC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;gBAEb,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAc9C;;OAEG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAQlC;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,uCAAuC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM;IAK1B,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMlC;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,uCAAuC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM;IAK1B,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMlC;AAMD;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,UAAU,EACnD,KAAK,EAAE,OAAO,EACd,UAAU,EAAE,KAAK,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,GACtC,KAAK,IAAI,CAAC,CAEZ"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Excel SDK Error Classes
|
|
4
|
+
*
|
|
5
|
+
* Error types for Excel operations in tenant applications.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.ExcelWriteError = exports.ExcelParseError = exports.ExcelError = void 0;
|
|
9
|
+
exports.isExcelError = isExcelError;
|
|
10
|
+
exports.isExcelErrorType = isExcelErrorType;
|
|
11
|
+
// ============================================================================
|
|
12
|
+
// Base Excel Error
|
|
13
|
+
// ============================================================================
|
|
14
|
+
/**
|
|
15
|
+
* Base error for all Excel operations
|
|
16
|
+
*
|
|
17
|
+
* All Excel-related errors inherit from this class, providing
|
|
18
|
+
* consistent context and structure for error handling.
|
|
19
|
+
*/
|
|
20
|
+
class ExcelError extends Error {
|
|
21
|
+
constructor(operation, message) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = this.constructor.name;
|
|
24
|
+
this.operation = operation;
|
|
25
|
+
this.timestamp = new Date();
|
|
26
|
+
// Maintain proper stack trace in V8 environments
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
+
if (Error.captureStackTrace) {
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
+
Error.captureStackTrace(this, this.constructor);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Convert error to JSON-serializable object
|
|
35
|
+
*/
|
|
36
|
+
toJSON() {
|
|
37
|
+
return {
|
|
38
|
+
name: this.name,
|
|
39
|
+
message: this.message,
|
|
40
|
+
operation: this.operation,
|
|
41
|
+
timestamp: this.timestamp.toISOString(),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.ExcelError = ExcelError;
|
|
46
|
+
// ============================================================================
|
|
47
|
+
// Excel Parse Error
|
|
48
|
+
// ============================================================================
|
|
49
|
+
/**
|
|
50
|
+
* Error parsing Excel file
|
|
51
|
+
*
|
|
52
|
+
* Thrown when an Excel file cannot be parsed due to invalid format,
|
|
53
|
+
* corrupted data, or unsupported features.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* try {
|
|
58
|
+
* const workbook = await ketrics.Excel.read(buffer);
|
|
59
|
+
* } catch (error) {
|
|
60
|
+
* if (error instanceof ketrics.ExcelParseError) {
|
|
61
|
+
* console.log('Failed to parse Excel file:', error.message);
|
|
62
|
+
* }
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
class ExcelParseError extends ExcelError {
|
|
67
|
+
constructor(reason) {
|
|
68
|
+
super('read', `Failed to parse Excel file: ${reason}`);
|
|
69
|
+
this.reason = reason;
|
|
70
|
+
}
|
|
71
|
+
toJSON() {
|
|
72
|
+
return {
|
|
73
|
+
...super.toJSON(),
|
|
74
|
+
reason: this.reason,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.ExcelParseError = ExcelParseError;
|
|
79
|
+
// ============================================================================
|
|
80
|
+
// Excel Write Error
|
|
81
|
+
// ============================================================================
|
|
82
|
+
/**
|
|
83
|
+
* Error writing Excel file
|
|
84
|
+
*
|
|
85
|
+
* Thrown when an Excel file cannot be written due to invalid data
|
|
86
|
+
* or other write errors.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* try {
|
|
91
|
+
* const buffer = await workbook.toBuffer();
|
|
92
|
+
* } catch (error) {
|
|
93
|
+
* if (error instanceof ketrics.ExcelWriteError) {
|
|
94
|
+
* console.log('Failed to write Excel file:', error.message);
|
|
95
|
+
* }
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
class ExcelWriteError extends ExcelError {
|
|
100
|
+
constructor(reason) {
|
|
101
|
+
super('write', `Failed to write Excel file: ${reason}`);
|
|
102
|
+
this.reason = reason;
|
|
103
|
+
}
|
|
104
|
+
toJSON() {
|
|
105
|
+
return {
|
|
106
|
+
...super.toJSON(),
|
|
107
|
+
reason: this.reason,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.ExcelWriteError = ExcelWriteError;
|
|
112
|
+
// ============================================================================
|
|
113
|
+
// Type Guards
|
|
114
|
+
// ============================================================================
|
|
115
|
+
/**
|
|
116
|
+
* Type guard to check if an error is an ExcelError
|
|
117
|
+
*/
|
|
118
|
+
function isExcelError(error) {
|
|
119
|
+
return error instanceof ExcelError;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Type guard to check if an error is a specific Excel error type
|
|
123
|
+
*/
|
|
124
|
+
function isExcelErrorType(error, errorClass) {
|
|
125
|
+
return error instanceof errorClass;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=excel-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"excel-errors.js","sourceRoot":"","sources":["../src/excel-errors.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAiIH,oCAEC;AAKD,4CAKC;AA3ID,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;;;;GAKG;AACH,MAAsB,UAAW,SAAQ,KAAK;IAO5C,YAAY,SAAiB,EAAE,OAAe;QAC5C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QAE5B,iDAAiD;QACjD,8DAA8D;QAC9D,IAAK,KAAa,CAAC,iBAAiB,EAAE,CAAC;YACrC,8DAA8D;YAC7D,KAAa,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;IAED;;OAEG;IACH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excel.d.ts
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Excel SDK Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for Excel file reading and writing in tenant applications.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Excel cell value types
|
|
8
|
+
*/
|
|
9
|
+
export type ExcelCellValue = null | undefined | number | string | boolean | Date;
|
|
10
|
+
/**
|
|
11
|
+
* Excel row values (array of cell values)
|
|
12
|
+
*/
|
|
13
|
+
export type ExcelRowValues = ExcelCellValue[];
|
|
14
|
+
/**
|
|
15
|
+
* Excel column definition
|
|
16
|
+
*/
|
|
17
|
+
export interface ExcelColumnDefinition {
|
|
18
|
+
/** Column header text */
|
|
19
|
+
header?: string;
|
|
20
|
+
/** Column key (for object-based rows) */
|
|
21
|
+
key?: string;
|
|
22
|
+
/** Column width */
|
|
23
|
+
width?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Options for adding a worksheet
|
|
27
|
+
*/
|
|
28
|
+
export interface AddWorksheetOptions {
|
|
29
|
+
/** Tab color (argb hex) */
|
|
30
|
+
tabColor?: string;
|
|
31
|
+
/** Default row height */
|
|
32
|
+
defaultRowHeight?: number;
|
|
33
|
+
/** Default column width */
|
|
34
|
+
defaultColWidth?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Excel Cell Interface
|
|
38
|
+
*
|
|
39
|
+
* Represents a single cell in a worksheet.
|
|
40
|
+
*/
|
|
41
|
+
export interface IExcelCell {
|
|
42
|
+
/** Cell value */
|
|
43
|
+
value: ExcelCellValue;
|
|
44
|
+
/** Cell text representation */
|
|
45
|
+
readonly text: string;
|
|
46
|
+
/** Cell address (e.g., 'A1') */
|
|
47
|
+
readonly address: string;
|
|
48
|
+
/** Row number */
|
|
49
|
+
readonly row: number;
|
|
50
|
+
/** Column number */
|
|
51
|
+
readonly col: number;
|
|
52
|
+
/** Cell formula if any */
|
|
53
|
+
formula?: string;
|
|
54
|
+
/** Cell type */
|
|
55
|
+
readonly type: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Excel Row Interface
|
|
59
|
+
*
|
|
60
|
+
* Represents a row in a worksheet.
|
|
61
|
+
*/
|
|
62
|
+
export interface IExcelRow {
|
|
63
|
+
/** Row number (1-indexed) */
|
|
64
|
+
readonly number: number;
|
|
65
|
+
/** Number of cells in the row */
|
|
66
|
+
readonly cellCount: number;
|
|
67
|
+
/** Number of cells with values */
|
|
68
|
+
readonly actualCellCount: number;
|
|
69
|
+
/** Row values as array */
|
|
70
|
+
values: ExcelRowValues;
|
|
71
|
+
/** Get a cell by column number or letter */
|
|
72
|
+
getCell(col: number | string): IExcelCell;
|
|
73
|
+
/** Iterate over cells */
|
|
74
|
+
eachCell(callback: (cell: IExcelCell, colNumber: number) => void, options?: {
|
|
75
|
+
includeEmpty?: boolean;
|
|
76
|
+
}): void;
|
|
77
|
+
/** Commit row changes (for streaming) */
|
|
78
|
+
commit(): void;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Excel Worksheet Interface
|
|
82
|
+
*
|
|
83
|
+
* Represents a worksheet in a workbook.
|
|
84
|
+
*/
|
|
85
|
+
export interface IExcelWorksheet {
|
|
86
|
+
/** Worksheet name */
|
|
87
|
+
name: string;
|
|
88
|
+
/** Worksheet ID */
|
|
89
|
+
readonly id: number;
|
|
90
|
+
/** Total row count */
|
|
91
|
+
readonly rowCount: number;
|
|
92
|
+
/** Rows with values */
|
|
93
|
+
readonly actualRowCount: number;
|
|
94
|
+
/** Total column count */
|
|
95
|
+
readonly columnCount: number;
|
|
96
|
+
/** Columns with values */
|
|
97
|
+
readonly actualColumnCount: number;
|
|
98
|
+
/** Column definitions */
|
|
99
|
+
columns: ExcelColumnDefinition[];
|
|
100
|
+
/** Get a row by number (1-indexed) */
|
|
101
|
+
getRow(rowNumber: number): IExcelRow;
|
|
102
|
+
/** Get rows with values */
|
|
103
|
+
getRows(startRow?: number, endRow?: number): IExcelRow[];
|
|
104
|
+
/** Get a cell by address or coordinates */
|
|
105
|
+
getCell(address: string): IExcelCell;
|
|
106
|
+
getCell(row: number, col: number): IExcelCell;
|
|
107
|
+
/** Add a row at the end */
|
|
108
|
+
addRow(values: ExcelRowValues): IExcelRow;
|
|
109
|
+
/** Add multiple rows at the end */
|
|
110
|
+
addRows(rows: ExcelRowValues[]): void;
|
|
111
|
+
/** Insert a row at position */
|
|
112
|
+
insertRow(pos: number, values: ExcelRowValues): IExcelRow;
|
|
113
|
+
/** Insert multiple rows at position */
|
|
114
|
+
insertRows(pos: number, rows: ExcelRowValues[]): void;
|
|
115
|
+
/** Splice rows (delete/insert) */
|
|
116
|
+
spliceRows(start: number, count: number, ...rows: ExcelRowValues[]): void;
|
|
117
|
+
/** Iterate over rows */
|
|
118
|
+
eachRow(callback: (row: IExcelRow, rowNumber: number) => void, options?: {
|
|
119
|
+
includeEmpty?: boolean;
|
|
120
|
+
}): void;
|
|
121
|
+
/** Get all sheet values as 2D array */
|
|
122
|
+
getSheetValues(): ExcelRowValues[];
|
|
123
|
+
/** Merge cells */
|
|
124
|
+
mergeCells(start: string, end: string): void;
|
|
125
|
+
mergeCells(startRow: number, startCol: number, endRow: number, endCol: number): void;
|
|
126
|
+
/** Unmerge cells */
|
|
127
|
+
unMergeCells(start: string, end: string): void;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Excel Workbook Interface
|
|
131
|
+
*
|
|
132
|
+
* Main container for worksheets.
|
|
133
|
+
*/
|
|
134
|
+
export interface IExcelWorkbook {
|
|
135
|
+
/** All worksheets */
|
|
136
|
+
readonly worksheets: IExcelWorksheet[];
|
|
137
|
+
/** Number of worksheets */
|
|
138
|
+
readonly worksheetCount: number;
|
|
139
|
+
/** Get worksheet by index (1-indexed) or name */
|
|
140
|
+
getWorksheet(indexOrName: number | string): IExcelWorksheet | undefined;
|
|
141
|
+
/** Add a new worksheet */
|
|
142
|
+
addWorksheet(name?: string, options?: AddWorksheetOptions): IExcelWorksheet;
|
|
143
|
+
/** Remove a worksheet */
|
|
144
|
+
removeWorksheet(indexOrName: number | string): void;
|
|
145
|
+
/** Write workbook to buffer */
|
|
146
|
+
toBuffer(): Promise<Buffer>;
|
|
147
|
+
/** Convert to CSV string */
|
|
148
|
+
toCsv(worksheetName?: string): Promise<string>;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Excel Manager Interface
|
|
152
|
+
*
|
|
153
|
+
* Static class interface for reading and creating Excel files.
|
|
154
|
+
*/
|
|
155
|
+
export interface ExcelManager {
|
|
156
|
+
/**
|
|
157
|
+
* Read an Excel file from a buffer
|
|
158
|
+
*
|
|
159
|
+
* @param buffer - Buffer containing Excel file data (.xlsx)
|
|
160
|
+
* @returns Parsed workbook
|
|
161
|
+
* @throws ExcelParseError if file cannot be parsed
|
|
162
|
+
*/
|
|
163
|
+
read(buffer: Buffer): Promise<IExcelWorkbook>;
|
|
164
|
+
/**
|
|
165
|
+
* Create a new empty workbook
|
|
166
|
+
*
|
|
167
|
+
* @returns New empty workbook
|
|
168
|
+
*/
|
|
169
|
+
create(): IExcelWorkbook;
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=excel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"excel.d.ts","sourceRoot":"","sources":["../src/excel.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,IAAI,GACJ,SAAS,GACT,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,CAAC;AAET;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,cAAc,EAAE,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,yBAAyB;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAA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