@origints/xlsx 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.
@@ -72,6 +72,15 @@ export type XlsxStep = {
72
72
  readonly kind: 'rowWhere';
73
73
  readonly headerRef: Spec;
74
74
  readonly predicate: CellPredicateSpec;
75
+ } | {
76
+ readonly kind: 'fromRef';
77
+ readonly ref: string;
78
+ readonly path?: readonly (string | number)[];
79
+ } | {
80
+ readonly kind: 'colAtRef';
81
+ readonly ref: string;
82
+ readonly path?: readonly (string | number)[];
83
+ readonly component: 'col' | 'row';
75
84
  } | {
76
85
  readonly kind: 'range';
77
86
  readonly ref: string;
@@ -103,6 +112,32 @@ export interface EachSliceExtract {
103
112
  readonly kind: 'eachSlice';
104
113
  readonly direction: Direction;
105
114
  readonly while: RowPredicateSpec;
115
+ readonly groupSize?: number;
116
+ }
117
+ /**
118
+ * Position of a cell in a workbook, used as a variable-bound value
119
+ * from findAll for dynamic navigation.
120
+ */
121
+ export interface CellPosition {
122
+ readonly row: number;
123
+ readonly col: number;
124
+ readonly sheetName?: string;
125
+ }
126
+ /**
127
+ * Specification for finding all cells matching a predicate.
128
+ * Returns CellPosition[] at runtime.
129
+ */
130
+ export interface FindAllExtract {
131
+ readonly kind: 'findAll';
132
+ readonly predicate: CellPredicateSpec;
133
+ readonly constraints?: {
134
+ readonly inRow?: number;
135
+ readonly inCol?: number;
136
+ readonly startRow?: number;
137
+ readonly endRow?: number;
138
+ readonly startCol?: number;
139
+ readonly endCol?: number;
140
+ };
106
141
  }
107
142
  /**
108
143
  * The terminal extraction type for an XLSX value.
@@ -111,7 +146,7 @@ export interface EachSliceExtract {
111
146
  * - Range-level (produce arrays): 'rows', 'cells'
112
147
  * - Cell-level (produce arrays): EachCellExtract, EachSliceExtract
113
148
  */
114
- export type XlsxExtract = 'string' | 'number' | 'boolean' | 'date' | 'value' | 'formula' | 'rows' | 'cells' | EachCellExtract | EachSliceExtract;
149
+ export type XlsxExtract = 'string' | 'number' | 'boolean' | 'date' | 'value' | 'formula' | 'rows' | 'cells' | EachCellExtract | EachSliceExtract | FindAllExtract;
115
150
  /**
116
151
  * A complete XLSX extraction spec.
117
152
  *
@@ -1,5 +1,4 @@
1
1
  import { TYPE_LABEL } from '@origints/core';
2
- import { Workbook } from 'exceljs';
3
2
  import { XlsxSheet } from './xlsx-sheet';
4
3
  import { XlsxResult, XlsxPath } from './xlsx-result';
5
4
  /**
@@ -18,22 +17,23 @@ export interface WorkbookProperties {
18
17
  readonly modified?: Date;
19
18
  }
20
19
  /**
21
- * A wrapper around ExcelJS Workbook with navigation and query capabilities.
20
+ * A wrapper around workbook data with navigation and query capabilities.
22
21
  *
23
22
  * XlsxWorkbook provides access to sheets, workbook properties, and
24
23
  * supports predicate-based queries for finding sheets.
25
24
  */
26
25
  export declare class XlsxWorkbook {
27
- private readonly workbook;
28
26
  private readonly _path;
29
27
  get [TYPE_LABEL](): string;
30
- private readonly sheetsCache;
28
+ private readonly _sheets;
29
+ private readonly _sheetsByName;
30
+ private readonly _props;
31
31
  private constructor();
32
32
  /**
33
- * Creates an XlsxWorkbook from an ExcelJS workbook.
33
+ * Creates an XlsxWorkbook from internal data.
34
34
  * @internal
35
35
  */
36
- static fromExcelJS(workbook: Workbook, file?: string): XlsxWorkbook;
36
+ static create(sheets: XlsxSheet[], props: WorkbookProperties, file?: string): XlsxWorkbook;
37
37
  /**
38
38
  * Returns the path for lineage tracking.
39
39
  */
@@ -122,9 +122,4 @@ export declare class XlsxWorkbook {
122
122
  * Map over all sheets.
123
123
  */
124
124
  map<T>(fn: (sheet: XlsxSheet, index: number) => T): T[];
125
- /**
126
- * Get the underlying ExcelJS workbook.
127
- * @internal
128
- */
129
- getWorkbook(): Workbook;
130
125
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@origints/xlsx",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "XLSX parsing for Origins with full traceability to sheets, ranges, and cells.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -20,6 +20,13 @@
20
20
  "publishConfig": {
21
21
  "access": "public"
22
22
  },
23
+ "scripts": {
24
+ "build": "vite build",
25
+ "test": "vitest run",
26
+ "test:coverage": "vitest run --coverage",
27
+ "lint": "eslint \"{src,tests}/**/*.{ts,tsx}\" --max-warnings 0",
28
+ "typecheck": "tsc -p tsconfig.json --noEmit"
29
+ },
23
30
  "repository": {
24
31
  "type": "git",
25
32
  "url": "https://github.com/fponticelli/origints.git",
@@ -40,26 +47,20 @@
40
47
  "node": ">=18"
41
48
  },
42
49
  "dependencies": {
43
- "exceljs": "^4.4.0"
50
+ "xlsx": "^0.18.5"
44
51
  },
45
52
  "peerDependencies": {
46
- "@origints/core": "^0.2.0"
53
+ "@origints/core": "^0.4.0"
47
54
  },
48
55
  "devDependencies": {
56
+ "@origints/core": "workspace:*",
57
+ "exceljs": "^4.4.0",
49
58
  "@types/node": "25.0.6",
50
59
  "@vitest/coverage-v8": "^4.0.16",
51
60
  "eslint": "9.39.2",
52
61
  "typescript": "5.9.3",
53
62
  "vite": "7.3.1",
54
63
  "vite-plugin-dts": "4.5.4",
55
- "vitest": "4.0.16",
56
- "@origints/core": "0.2.0"
57
- },
58
- "scripts": {
59
- "build": "vite build",
60
- "test": "vitest run",
61
- "test:coverage": "vitest run --coverage",
62
- "lint": "eslint \"{src,tests}/**/*.{ts,tsx}\" --max-warnings 0",
63
- "typecheck": "tsc -p tsconfig.json --noEmit"
64
+ "vitest": "4.0.16"
64
65
  }
65
- }
66
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Franco Ponticelli
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.