@ariadng/sheets 0.1.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.
@@ -0,0 +1,39 @@
1
+ import { GoogleSheetsCore } from '../core';
2
+ export declare class A1 {
3
+ static columnToIndex(column: string): number;
4
+ static indexToColumn(index: number): string;
5
+ static parse(notation: string): {
6
+ sheet?: string;
7
+ startCol: string;
8
+ startRow: number;
9
+ endCol?: string;
10
+ endRow?: number;
11
+ };
12
+ static build(sheet: string | undefined, startCol: string, startRow: number, endCol?: string, endRow?: number): string;
13
+ static getDimensions(notation: string): {
14
+ rows: number;
15
+ columns: number;
16
+ };
17
+ static offset(notation: string, rowOffset: number, colOffset: number): string;
18
+ }
19
+ export declare class TypedSheets<T = any> {
20
+ private client;
21
+ constructor(client: GoogleSheetsCore);
22
+ read(spreadsheetId: string, range: string, parser?: (data: any[][]) => T): Promise<T>;
23
+ write(spreadsheetId: string, range: string, data: T, serializer?: (data: T) => any[][]): Promise<void>;
24
+ append(spreadsheetId: string, range: string, data: T, serializer?: (data: T) => any[][]): Promise<void>;
25
+ }
26
+ export declare const Parsers: {
27
+ rowsToObjects<T = any>(data: any[][]): T[];
28
+ asNumbers(data: any[][]): number[][];
29
+ asStrings(data: any[][]): string[][];
30
+ asMap<V = any>(data: any[][]): Map<string, V>;
31
+ column<T = any>(data: any[][], columnIndex?: number): T[];
32
+ };
33
+ export declare const Serializers: {
34
+ objectsToRows<T extends Record<string, any>>(objects: T[], headers?: (keyof T)[]): any[][];
35
+ mapToRows<K, V>(map: Map<K, V>): any[][];
36
+ arrayToColumn<T>(array: T[]): any[][];
37
+ transpose(data: any[][]): any[][];
38
+ };
39
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plus/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAK3C,qBAAa,EA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X,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,CAAC,EACP,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,GAAG,EAAE,EAAE,GAC/B,OAAO,CAAC,IAAI,CAAC;CAIhB;AAKD,eAAO,MAAM,OAAO;kBAIL,CAAC,cAAc,GAAG,EAAE,EAAE,GAAG,CAAC,EAAE;oBAgB1B,GAAG,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE;oBAOpB,GAAG,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE;UAO9B,CAAC,cAAc,GAAG,EAAE,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;WAatC,CAAC,cAAc,GAAG,EAAE,EAAE,yBAAoB,CAAC,EAAE;CAGpD,CAAC;AAKF,eAAO,MAAM,WAAW;kBAIT,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,WACjC,CAAC,EAAE,YACF,CAAC,MAAM,CAAC,CAAC,EAAE,GACnB,GAAG,EAAE,EAAE;cAaA,CAAC,EAAE,CAAC,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE;kBAW1B,CAAC,SAAS,CAAC,EAAE,GAAG,GAAG,EAAE,EAAE;oBAOrB,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,EAAE;CAgBjC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "@ariadng/sheets",
3
+ "version": "0.1.0",
4
+ "description": "A pragmatic TypeScript client for Google Sheets API v4",
5
+ "main": "./dist/core/index.js",
6
+ "module": "./dist/core/index.mjs",
7
+ "types": "./dist/core/index.d.ts",
8
+ "exports": {
9
+ "./core": {
10
+ "types": "./dist/core/index.d.ts",
11
+ "import": "./dist/core/index.mjs",
12
+ "require": "./dist/core/index.js"
13
+ },
14
+ "./plus": {
15
+ "types": "./dist/plus/index.d.ts",
16
+ "import": "./dist/plus/index.mjs",
17
+ "require": "./dist/plus/index.js"
18
+ },
19
+ "./advanced": {
20
+ "types": "./dist/advanced/index.d.ts",
21
+ "import": "./dist/advanced/index.mjs",
22
+ "require": "./dist/advanced/index.js"
23
+ }
24
+ },
25
+ "scripts": {
26
+ "build": "npm run clean && npm run build:esm && npm run build:cjs && npm run build:types",
27
+ "build:esm": "esbuild src/*/index.ts --bundle --platform=node --format=esm --outdir=dist --out-extension:.js=.mjs --external:googleapis --external:google-auth-library",
28
+ "build:cjs": "esbuild src/*/index.ts --bundle --platform=node --format=cjs --outdir=dist --external:googleapis --external:google-auth-library",
29
+ "build:types": "tsc --emitDeclarationOnly --declaration",
30
+ "clean": "rm -rf dist",
31
+ "test": "jest",
32
+ "test:unit": "jest --testPathIgnorePatterns=integration.test.ts",
33
+ "test:watch": "jest --watch",
34
+ "test:coverage": "jest --coverage",
35
+ "lint": "eslint src/**/*.ts",
36
+ "format": "prettier --write src/**/*.ts",
37
+ "typecheck": "tsc --noEmit",
38
+ "dev": "npm run build -- --watch",
39
+ "prepublishOnly": "npm run build && npm run test:unit && npm run typecheck"
40
+ },
41
+ "keywords": [
42
+ "google-sheets",
43
+ "google",
44
+ "sheets",
45
+ "spreadsheet",
46
+ "api",
47
+ "typescript"
48
+ ],
49
+ "author": "ariadng",
50
+ "license": "MIT",
51
+ "dependencies": {
52
+ "googleapis": "^144.0.0",
53
+ "google-auth-library": "^9.15.0"
54
+ },
55
+ "devDependencies": {
56
+ "@types/jest": "^29.5.14",
57
+ "@types/node": "^22.10.2",
58
+ "@typescript-eslint/eslint-plugin": "^8.18.0",
59
+ "@typescript-eslint/parser": "^8.18.0",
60
+ "esbuild": "^0.24.0",
61
+ "eslint": "^9.17.0",
62
+ "jest": "^29.7.0",
63
+ "prettier": "^3.4.2",
64
+ "ts-jest": "^29.2.5",
65
+ "ts-node": "^10.9.2",
66
+ "typescript": "^5.7.2"
67
+ },
68
+ "files": [
69
+ "dist",
70
+ "README.md",
71
+ "LICENSE"
72
+ ],
73
+ "repository": {
74
+ "type": "git",
75
+ "url": "https://github.com/ariadng/sheets.git"
76
+ },
77
+ "bugs": {
78
+ "url": "https://github.com/ariadng/sheets/issues"
79
+ },
80
+ "homepage": "https://github.com/ariadng/sheets#readme"
81
+ }