@mshindi-labs/google 1.2.1 → 1.3.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 (76) hide show
  1. package/README.md +4 -2
  2. package/dist/calendar.cjs +114 -162
  3. package/dist/calendar.cjs.map +1 -1
  4. package/dist/calendar.d.cts +1 -1
  5. package/dist/calendar.d.ts +1 -1
  6. package/dist/calendar.js +45 -93
  7. package/dist/calendar.js.map +1 -1
  8. package/dist/chunk-2MJE3WQ5.js +63 -0
  9. package/dist/chunk-2MJE3WQ5.js.map +1 -0
  10. package/dist/chunk-4UEM6VO4.cjs +119 -0
  11. package/dist/chunk-4UEM6VO4.cjs.map +1 -0
  12. package/dist/{chunk-FCHXM22B.js → chunk-6VGR73PY.js} +45 -2
  13. package/dist/{chunk-FCHXM22B.js.map → chunk-6VGR73PY.js.map} +1 -1
  14. package/dist/{chunk-6RDWEYXZ.js → chunk-7YVRJ3GY.js} +5 -4
  15. package/dist/chunk-7YVRJ3GY.js.map +1 -0
  16. package/dist/chunk-7ZLAL7UY.cjs +63 -0
  17. package/dist/chunk-7ZLAL7UY.cjs.map +1 -0
  18. package/dist/chunk-BYHOVCN3.cjs +20 -0
  19. package/dist/chunk-BYHOVCN3.cjs.map +1 -0
  20. package/dist/chunk-FPEP5FL5.js +87 -0
  21. package/dist/chunk-FPEP5FL5.js.map +1 -0
  22. package/dist/chunk-JA2JLBNN.js +119 -0
  23. package/dist/chunk-JA2JLBNN.js.map +1 -0
  24. package/dist/{chunk-DPAPYMB3.cjs → chunk-KFQ4O6MT.cjs} +57 -56
  25. package/dist/chunk-KFQ4O6MT.cjs.map +1 -0
  26. package/dist/chunk-LWCB3V7V.js +20 -0
  27. package/dist/chunk-LWCB3V7V.js.map +1 -0
  28. package/dist/{chunk-6PMJ6VB6.cjs → chunk-RWRVNSQG.cjs} +6 -6
  29. package/dist/{chunk-6PMJ6VB6.cjs.map → chunk-RWRVNSQG.cjs.map} +1 -1
  30. package/dist/{chunk-SXD5K23S.js → chunk-UR3KSPDZ.js} +2 -2
  31. package/dist/{chunk-JZVDD4DL.cjs → chunk-UUXXCUIB.cjs} +45 -2
  32. package/dist/chunk-UUXXCUIB.cjs.map +1 -0
  33. package/dist/{chunk-JDA3ZRUY.cjs → chunk-V5Q6XSYZ.cjs} +3 -3
  34. package/dist/{chunk-JDA3ZRUY.cjs.map → chunk-V5Q6XSYZ.cjs.map} +1 -1
  35. package/dist/{chunk-S357VL5V.cjs → chunk-X7QL7AQ6.cjs} +48 -17
  36. package/dist/chunk-X7QL7AQ6.cjs.map +1 -0
  37. package/dist/{chunk-4V5ZJNPI.js → chunk-ZPDFK5VR.js} +2 -2
  38. package/dist/core.cjs +28 -18
  39. package/dist/core.cjs.map +1 -1
  40. package/dist/core.d.cts +19 -2
  41. package/dist/core.d.ts +19 -2
  42. package/dist/core.js +14 -4
  43. package/dist/core.js.map +1 -1
  44. package/dist/{create-google-Bo8_Nc1C.d.cts → create-google-B0fX1ixG.d.cts} +1 -0
  45. package/dist/{create-google-snvkHaEk.d.ts → create-google-CjsKhktN.d.ts} +1 -0
  46. package/dist/gmail.cjs +43 -41
  47. package/dist/gmail.cjs.map +1 -1
  48. package/dist/gmail.d.cts +1 -1
  49. package/dist/gmail.d.ts +1 -1
  50. package/dist/gmail.js +9 -7
  51. package/dist/gmail.js.map +1 -1
  52. package/dist/postgres.cjs +8 -8
  53. package/dist/postgres.js +1 -1
  54. package/dist/sheets.cjs +1317 -0
  55. package/dist/sheets.cjs.map +1 -0
  56. package/dist/sheets.d.cts +292 -0
  57. package/dist/sheets.d.ts +292 -0
  58. package/dist/sheets.js +1317 -0
  59. package/dist/sheets.js.map +1 -0
  60. package/dist/testing.cjs +905 -38
  61. package/dist/testing.cjs.map +1 -1
  62. package/dist/testing.d.cts +133 -1
  63. package/dist/testing.d.ts +133 -1
  64. package/dist/testing.js +897 -30
  65. package/dist/testing.js.map +1 -1
  66. package/dist/transport-uuotQ13Y.d.cts +137 -0
  67. package/dist/transport-uuotQ13Y.d.ts +137 -0
  68. package/package.json +17 -1
  69. package/dist/chunk-6RDWEYXZ.js.map +0 -1
  70. package/dist/chunk-AMBBE4TW.js +0 -56
  71. package/dist/chunk-AMBBE4TW.js.map +0 -1
  72. package/dist/chunk-DPAPYMB3.cjs.map +0 -1
  73. package/dist/chunk-JZVDD4DL.cjs.map +0 -1
  74. package/dist/chunk-S357VL5V.cjs.map +0 -1
  75. /package/dist/{chunk-SXD5K23S.js.map → chunk-UR3KSPDZ.js.map} +0 -0
  76. /package/dist/{chunk-4V5ZJNPI.js.map → chunk-ZPDFK5VR.js.map} +0 -0
@@ -0,0 +1,292 @@
1
+ import { G as GoogleCore } from './create-google-CjsKhktN.js';
2
+ import { S as SheetsTransport } from './transport-uuotQ13Y.js';
3
+ export { G as GValueRange, c as createSheetsApiTransport } from './transport-uuotQ13Y.js';
4
+ import { sheets_v4 } from '@googleapis/sheets';
5
+ import './key-provider-Cq_14Bh6.js';
6
+ import './events-BlC10ISp.js';
7
+
8
+ /** A tab by title, or by its numeric `sheetId` (`0` is the default first tab). */
9
+ type TabRef = string | {
10
+ sheetId: number;
11
+ };
12
+ /**
13
+ * An A1 string that includes the tab (`"'Q1 2026'!A1:C10"`), or a tab plus an
14
+ * optional range inside it. Omitting `range` means the whole tab.
15
+ */
16
+ type RangeRef = string | {
17
+ tab: TabRef;
18
+ range?: string;
19
+ };
20
+ /**
21
+ * A cell to write. Plain strings are stored literally under the default `raw`
22
+ * mode; `{ formula }` (starting with `=`) is the only way to write a formula.
23
+ * `null` clears the cell.
24
+ */
25
+ type CellInput = string | number | boolean | null | {
26
+ formula: string;
27
+ };
28
+ /** A cell as read back from Google. */
29
+ type CellValue = string | number | boolean;
30
+ type ValueRender = "formatted" | "unformatted" | "formula";
31
+ type InputMode = "raw" | "user_entered";
32
+ type OpenInput = {
33
+ tenantId: string;
34
+ connectionId: string;
35
+ spreadsheetId: string;
36
+ };
37
+ type TabInfo = {
38
+ sheetId: number;
39
+ title: string;
40
+ index: number;
41
+ hidden: boolean;
42
+ rowCount: number;
43
+ columnCount: number;
44
+ frozenRows: number;
45
+ frozenColumns: number;
46
+ };
47
+ type SpreadsheetInfo = {
48
+ spreadsheetId: string;
49
+ title: string;
50
+ locale: string | null;
51
+ timeZone: string | null;
52
+ tabs: TabInfo[];
53
+ /** `range` is a quoted A1 reference, e.g. `'Q1 2026'!A1:C10`. */
54
+ namedRanges: {
55
+ namedRangeId: string;
56
+ name: string;
57
+ range: string;
58
+ }[];
59
+ protectedRanges: {
60
+ protectedRangeId: number;
61
+ range: string;
62
+ description: string | null;
63
+ warningOnly: boolean;
64
+ }[];
65
+ };
66
+ /** One row under the header, keyed by header text. `rowNumber` is the 1-based sheet row. */
67
+ type RowObject = {
68
+ rowNumber: number;
69
+ data: Record<string, CellValue | null>;
70
+ };
71
+ type FoundRow = {
72
+ rowNumber: number;
73
+ values: (CellValue | null)[];
74
+ };
75
+ /** A column letter such as `"C"`, or a header name in the header row. */
76
+ type ColumnRef = string | {
77
+ header: string;
78
+ };
79
+ /**
80
+ * Where `append` wrote: Google's `updatedRange` and its 1-based first and last
81
+ * rows. `firstRow` and `lastRow` are `0` when that range cannot be parsed (the
82
+ * rows were still written).
83
+ */
84
+ type AppendResult = {
85
+ range: string;
86
+ firstRow: number;
87
+ lastRow: number;
88
+ };
89
+ /** 1-based inclusive bounds; `null` means open on that side. */
90
+ type GridBounds = {
91
+ startRow: number | null;
92
+ endRow: number | null;
93
+ startColumn: number | null;
94
+ endColumn: number | null;
95
+ };
96
+ /** Resolves a tab reference to its `sheetId`; throws `SheetTabNotFoundError`. */
97
+ interface ResolveCtx {
98
+ sheetId(tab: TabRef): number;
99
+ }
100
+ declare const SHEETS_REQUEST: unique symbol;
101
+ /** An opaque request from a `req.*` builder; nothing is sent until `batch()`. */
102
+ type SheetsRequest = {
103
+ readonly [SHEETS_REQUEST]: true;
104
+ /** Tabs that must resolve before `build` runs. */
105
+ readonly refs: readonly TabRef[];
106
+ /** Set only by `req.addTab`. */
107
+ readonly adds?: {
108
+ title: string;
109
+ sheetId?: number;
110
+ };
111
+ build(ctx: ResolveCtx, assignedSheetId?: number): sheets_v4.Schema$Request;
112
+ };
113
+ interface SpreadsheetHandle {
114
+ readonly spreadsheetId: string;
115
+ getInfo(): Promise<SpreadsheetInfo>;
116
+ getValues(range: RangeRef, opts?: {
117
+ valueRender?: ValueRender;
118
+ }): Promise<CellValue[][]>;
119
+ getValuesBatch(ranges: RangeRef[], opts?: {
120
+ valueRender?: ValueRender;
121
+ }): Promise<CellValue[][][]>;
122
+ getRows(tab: TabRef, opts?: {
123
+ headerRow?: number;
124
+ columns?: string;
125
+ valueRender?: ValueRender;
126
+ }): Promise<RowObject[]>;
127
+ findRows(tab: TabRef, opts: {
128
+ column: ColumnRef;
129
+ where: (value: CellValue | null, row: (CellValue | null)[]) => boolean;
130
+ headerRow?: number;
131
+ valueRender?: ValueRender;
132
+ }): Promise<FoundRow[]>;
133
+ update(range: RangeRef, values: CellInput[][], opts?: {
134
+ input?: InputMode;
135
+ }): Promise<{
136
+ updatedRange: string;
137
+ updatedCells: number;
138
+ }>;
139
+ updateBatch(entries: {
140
+ range: RangeRef;
141
+ values: CellInput[][];
142
+ }[], opts?: {
143
+ input?: InputMode;
144
+ }): Promise<{
145
+ updatedCells: number;
146
+ }>;
147
+ clear(range: RangeRef | RangeRef[]): Promise<void>;
148
+ append(tab: TabRef, rows: CellInput[][], opts?: {
149
+ input?: InputMode;
150
+ insert?: "insert_rows" | "overwrite";
151
+ }): Promise<AppendResult>;
152
+ /**
153
+ * Sends `req.*` requests in one atomic `spreadsheets.batchUpdate` (not
154
+ * idempotent: see I10) and returns one reply per request. Tab titles resolve
155
+ * against the spreadsheet, plus tabs an earlier `req.addTab` in the same batch
156
+ * creates; a title made by `renameTab` or `duplicateTab` in the same batch does
157
+ * not resolve and throws `SheetTabNotFoundError` before anything is sent (use a
158
+ * second batch, or `{ sheetId }`).
159
+ */
160
+ batch(requests: SheetsRequest[]): Promise<sheets_v4.Schema$Response[]>;
161
+ }
162
+
163
+ type SheetsOptions = {
164
+ transport?: SheetsTransport;
165
+ sleep?: (ms: number) => Promise<void>;
166
+ random?: () => number;
167
+ /** Attempts per Google call under the retry policy (default 3). */
168
+ maxAttempts?: number;
169
+ };
170
+ type SheetsApi = {
171
+ open(input: OpenInput): SpreadsheetHandle;
172
+ };
173
+ /**
174
+ * Creates the Sheets service. `open()` returns a handle on one spreadsheet as one
175
+ * of a tenant's connections; every handle call fetches its own token, checks the
176
+ * Sheets scope, and throws only `GoogleLibError`s.
177
+ */
178
+ declare function createSheets(google: GoogleCore, opts?: SheetsOptions): SheetsApi;
179
+
180
+ /**
181
+ * Batch request builders. Pure: they validate arguments and return an opaque
182
+ * request; nothing is sent until the service's `batch()` runs them.
183
+ *
184
+ * Row and column positions are 1-based (like the Sheets UI); tab `index`
185
+ * values are 0-based (like Google's tab order).
186
+ */
187
+ declare const req: {
188
+ /** `index` is the 0-based tab position. */
189
+ addTab(tabTitle: string, o?: {
190
+ index?: number;
191
+ rows?: number;
192
+ columns?: number;
193
+ sheetId?: number;
194
+ }): SheetsRequest;
195
+ deleteTab(tab: TabRef): SheetsRequest;
196
+ renameTab(tab: TabRef, newTitle: string): SheetsRequest;
197
+ /** `o.index` is the 0-based position of the copy. */
198
+ duplicateTab(tab: TabRef, newTitle: string, o?: {
199
+ index?: number;
200
+ }): SheetsRequest;
201
+ /**
202
+ * `index` counts tab positions BEFORE the move (Google's semantics), 0-based.
203
+ * Moving left, it is the tab's new position. Moving right, it is one more
204
+ * than the new position: with tabs `[A, B, C]`, `moveTab("A", 2)` gives
205
+ * `[B, A, C]` and `moveTab("A", 3)` gives `[B, C, A]`.
206
+ */
207
+ moveTab(tab: TabRef, index: number): SheetsRequest;
208
+ hideTab(tab: TabRef): SheetsRequest;
209
+ showTab(tab: TabRef): SheetsRequest;
210
+ /** Inserts `count` blank rows BEFORE 1-based row `at`. */
211
+ insertRows(tab: TabRef, at: number, count: number): SheetsRequest;
212
+ /** Inserts `count` blank columns BEFORE column `at` (`"C"` or `3`). */
213
+ insertColumns(tab: TabRef, at: number | string, count: number): SheetsRequest;
214
+ /** Deletes `count` rows starting at 1-based row `from`. */
215
+ deleteRows(tab: TabRef, from: number, count: number): SheetsRequest;
216
+ /** Deletes `count` columns starting at column `from` (`"C"` or `3`). */
217
+ deleteColumns(tab: TabRef, from: number | string, count: number): SheetsRequest;
218
+ /** `columns` is `"B:D"` or a 1-based inclusive pair `[2, 4]`. */
219
+ setColumnWidth(tab: TabRef, columns: string | [number, number], pixels: number): SheetsRequest;
220
+ /** `rows` is a 1-based inclusive pair `[1, 3]`. */
221
+ setRowHeight(tab: TabRef, rows: [number, number], pixels: number): SheetsRequest;
222
+ /** `columns` is `"B:D"` or a 1-based inclusive pair `[2, 4]`. */
223
+ autoResizeColumns(tab: TabRef, columns: string | [number, number]): SheetsRequest;
224
+ /** Freezes the first N rows/columns; `0` unfreezes. */
225
+ freeze(tab: TabRef, o: {
226
+ rows?: number;
227
+ columns?: number;
228
+ }): SheetsRequest;
229
+ merge(tab: TabRef, range: string, type?: "all" | "columns" | "rows"): SheetsRequest;
230
+ unmerge(tab: TabRef, range: string): SheetsRequest;
231
+ /** `fields` is the field mask; defaults to `"userEnteredFormat"`. */
232
+ format(tab: TabRef, range: string, cellFormat: sheets_v4.Schema$CellFormat, fields?: string): SheetsRequest;
233
+ copyPaste(from: {
234
+ tab: TabRef;
235
+ range: string;
236
+ }, to: {
237
+ tab: TabRef;
238
+ range: string;
239
+ }, pasteType?: "normal" | "values" | "format" | "formula"): SheetsRequest;
240
+ /** `column` letters are absolute sheet columns, not relative to `range`. */
241
+ sort(tab: TabRef, range: string, specs: {
242
+ column: string;
243
+ ascending?: boolean;
244
+ }[]): SheetsRequest;
245
+ setBasicFilter(tab: TabRef, range: string): SheetsRequest;
246
+ clearBasicFilter(tab: TabRef): SheetsRequest;
247
+ /**
248
+ * `name`: letters, digits and underscores, starting with a letter or `_`;
249
+ * names that read as a cell (`A1`, `R1C1`) or `TRUE`/`FALSE` are rejected.
250
+ */
251
+ addNamedRange(name: string, tab: TabRef, range: string): SheetsRequest;
252
+ /**
253
+ * Takes the range's `namedRangeId` (from `getInfo().namedRanges`), not its
254
+ * name: Google's `deleteNamedRange` deletes by id only.
255
+ */
256
+ deleteNamedRange(namedRangeId: string): SheetsRequest;
257
+ /** Without `range`, protects the whole tab. */
258
+ protect(tab: TabRef, o?: {
259
+ range?: string;
260
+ description?: string;
261
+ warningOnly?: boolean;
262
+ editors?: string[];
263
+ }): SheetsRequest;
264
+ unprotect(protectedRangeId: number): SheetsRequest;
265
+ /** Passes a Google request through untouched (one key, e.g. `addChart`). */
266
+ raw(request: sheets_v4.Schema$Request): SheetsRequest;
267
+ };
268
+
269
+ declare function quoteTab(title: string): string;
270
+ declare function range(tab: string, rangePart?: string): string;
271
+ declare function split(ref: string): {
272
+ tab: string;
273
+ range: string | null;
274
+ };
275
+ declare function columnToIndex(col: string): number;
276
+ declare function indexToColumn(n: number): string;
277
+ /**
278
+ * 1-based bounds of `B2`, `A1:C10`, `B:D`, `2:5` or `A2:C` (a cell to a column:
279
+ * open-ended rows). Other mixed pairs such as `2:A` or `A1:5` are rejected:
280
+ * Google cannot parse them either.
281
+ */
282
+ declare function parse(rangeText: string): GridBounds;
283
+ declare const a1: {
284
+ quoteTab: typeof quoteTab;
285
+ range: typeof range;
286
+ split: typeof split;
287
+ columnToIndex: typeof columnToIndex;
288
+ indexToColumn: typeof indexToColumn;
289
+ parse: typeof parse;
290
+ };
291
+
292
+ export { type AppendResult, type CellInput, type CellValue, type ColumnRef, type FoundRow, type GridBounds, type InputMode, type OpenInput, type RangeRef, type RowObject, type SheetsApi, type SheetsOptions, type SheetsRequest, SheetsTransport, type SpreadsheetHandle, type SpreadsheetInfo, type TabInfo, type TabRef, type ValueRender, a1, createSheets, req };