@mshindi-labs/google 1.1.0 → 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.
- package/README.md +9 -4
- package/dist/calendar.cjs +1593 -0
- package/dist/calendar.cjs.map +1 -0
- package/dist/calendar.d.cts +161 -0
- package/dist/calendar.d.ts +161 -0
- package/dist/calendar.js +1593 -0
- package/dist/calendar.js.map +1 -0
- package/dist/chunk-2MJE3WQ5.js +63 -0
- package/dist/chunk-2MJE3WQ5.js.map +1 -0
- package/dist/chunk-4UEM6VO4.cjs +119 -0
- package/dist/chunk-4UEM6VO4.cjs.map +1 -0
- package/dist/{chunk-RWT25QHA.js → chunk-6VGR73PY.js} +87 -2
- package/dist/chunk-6VGR73PY.js.map +1 -0
- package/dist/{chunk-SIDO26T7.js → chunk-7YVRJ3GY.js} +12 -4
- package/dist/chunk-7YVRJ3GY.js.map +1 -0
- package/dist/chunk-7ZLAL7UY.cjs +63 -0
- package/dist/chunk-7ZLAL7UY.cjs.map +1 -0
- package/dist/chunk-BYHOVCN3.cjs +20 -0
- package/dist/chunk-BYHOVCN3.cjs.map +1 -0
- package/dist/chunk-FPEP5FL5.js +87 -0
- package/dist/chunk-FPEP5FL5.js.map +1 -0
- package/dist/chunk-JA2JLBNN.js +119 -0
- package/dist/chunk-JA2JLBNN.js.map +1 -0
- package/dist/{chunk-VN5VWVCT.cjs → chunk-KFQ4O6MT.cjs} +64 -56
- package/dist/chunk-KFQ4O6MT.cjs.map +1 -0
- package/dist/chunk-LWCB3V7V.js +20 -0
- package/dist/chunk-LWCB3V7V.js.map +1 -0
- package/dist/{chunk-KJPQ3DMR.cjs → chunk-RWRVNSQG.cjs} +6 -6
- package/dist/{chunk-KJPQ3DMR.cjs.map → chunk-RWRVNSQG.cjs.map} +1 -1
- package/dist/{chunk-Z7O6GO3C.js → chunk-UR3KSPDZ.js} +2 -2
- package/dist/{chunk-SHDP4A3A.cjs → chunk-UUXXCUIB.cjs} +87 -2
- package/dist/chunk-UUXXCUIB.cjs.map +1 -0
- package/dist/{chunk-V22QP2AM.cjs → chunk-V5Q6XSYZ.cjs} +3 -3
- package/dist/{chunk-V22QP2AM.cjs.map → chunk-V5Q6XSYZ.cjs.map} +1 -1
- package/dist/chunk-X7QL7AQ6.cjs +87 -0
- package/dist/chunk-X7QL7AQ6.cjs.map +1 -0
- package/dist/{chunk-JVP7HHFU.js → chunk-ZPDFK5VR.js} +2 -2
- package/dist/core.cjs +40 -18
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +40 -4
- package/dist/core.d.ts +40 -4
- package/dist/core.js +26 -4
- package/dist/core.js.map +1 -1
- package/dist/{create-google-CPGcK-3G.d.cts → create-google-B0fX1ixG.d.cts} +3 -1
- package/dist/{create-google-nP9f9jd9.d.ts → create-google-CjsKhktN.d.ts} +3 -1
- package/dist/{events-BsWOMtza.d.ts → events-BlC10ISp.d.cts} +31 -0
- package/dist/{events-BsWOMtza.d.cts → events-BlC10ISp.d.ts} +31 -0
- package/dist/gmail.cjs +54 -79
- package/dist/gmail.cjs.map +1 -1
- package/dist/gmail.d.cts +2 -2
- package/dist/gmail.d.ts +2 -2
- package/dist/gmail.js +19 -44
- package/dist/gmail.js.map +1 -1
- package/dist/postgres.cjs +8 -8
- package/dist/postgres.d.cts +1 -1
- package/dist/postgres.d.ts +1 -1
- package/dist/postgres.js +1 -1
- package/dist/sheets.cjs +1317 -0
- package/dist/sheets.cjs.map +1 -0
- package/dist/sheets.d.cts +292 -0
- package/dist/sheets.d.ts +292 -0
- package/dist/sheets.js +1317 -0
- package/dist/sheets.js.map +1 -0
- package/dist/testing.cjs +1119 -39
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +223 -2
- package/dist/testing.d.ts +223 -2
- package/dist/testing.js +1110 -30
- package/dist/testing.js.map +1 -1
- package/dist/transport-DHApc5oq.d.cts +103 -0
- package/dist/transport-DHApc5oq.d.ts +103 -0
- package/dist/transport-uuotQ13Y.d.cts +137 -0
- package/dist/transport-uuotQ13Y.d.ts +137 -0
- package/package.json +35 -4
- package/dist/chunk-RWT25QHA.js.map +0 -1
- package/dist/chunk-SHDP4A3A.cjs.map +0 -1
- package/dist/chunk-SIDO26T7.js.map +0 -1
- package/dist/chunk-VN5VWVCT.cjs.map +0 -1
- /package/dist/{chunk-Z7O6GO3C.js.map → chunk-UR3KSPDZ.js.map} +0 -0
- /package/dist/{chunk-JVP7HHFU.js.map → chunk-ZPDFK5VR.js.map} +0 -0
package/dist/testing.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { S as StaticKeyProvider } from './static-key-provider-BhyRhY6-.js';
|
|
2
|
-
import { C as CredentialStore, O as OAuthClientRecord, a as ConnectionRecord, b as ConnectionStatus, e as OAuthStateRecord, d as EncryptedValueRef, E as EncryptedValue } from './events-
|
|
2
|
+
import { C as CredentialStore, O as OAuthClientRecord, a as ConnectionRecord, b as ConnectionStatus, e as OAuthStateRecord, d as EncryptedValueRef, E as EncryptedValue } from './events-BlC10ISp.js';
|
|
3
3
|
import { O as OAuthGateway } from './key-provider-Cq_14Bh6.js';
|
|
4
4
|
import { G as GmailTransport } from './transport-CVOgr9XP.js';
|
|
5
|
+
import { C as CalendarTransport, G as GEvent, a as GoogleSendUpdates } from './transport-DHApc5oq.js';
|
|
6
|
+
import { S as SheetsTransport, a as GRequest, b as GSpreadsheet, R as RenderOption, G as GValueRange, I as InputOption, d as GResponse } from './transport-uuotQ13Y.js';
|
|
5
7
|
|
|
6
8
|
/** Dev/test key provider (kid `static:local`). Refuses NODE_ENV=production. */
|
|
7
9
|
declare class LocalKeyProvider extends StaticKeyProvider {
|
|
@@ -144,4 +146,223 @@ declare class CaptureTransport implements GmailTransport {
|
|
|
144
146
|
find(pred: (m: CapturedMessage) => boolean): CapturedMessage | undefined;
|
|
145
147
|
}
|
|
146
148
|
|
|
147
|
-
|
|
149
|
+
type Op = "freeBusy" | "insert" | "get" | "patch" | "delete";
|
|
150
|
+
type Busy = {
|
|
151
|
+
start: string;
|
|
152
|
+
end: string;
|
|
153
|
+
};
|
|
154
|
+
type ConferenceBehaviour = "success" | "pending" | "failure";
|
|
155
|
+
type FakeNotification = {
|
|
156
|
+
eventId: string;
|
|
157
|
+
kind: "invite" | "update" | "cancel";
|
|
158
|
+
to: string[];
|
|
159
|
+
};
|
|
160
|
+
type FakeCall = {
|
|
161
|
+
op: string;
|
|
162
|
+
sendUpdates?: string;
|
|
163
|
+
emails?: string[];
|
|
164
|
+
};
|
|
165
|
+
/** In-memory Google Calendar transport for tests (single `primary` calendar). */
|
|
166
|
+
declare class FakeCalendar implements CalendarTransport {
|
|
167
|
+
readonly events: Map<string, GEvent>;
|
|
168
|
+
readonly calls: FakeCall[];
|
|
169
|
+
readonly notifications: FakeNotification[];
|
|
170
|
+
private readonly organizerEmail;
|
|
171
|
+
private readonly busy;
|
|
172
|
+
private readonly failures;
|
|
173
|
+
private conference;
|
|
174
|
+
private pendingGets;
|
|
175
|
+
private readonly pendingLeft;
|
|
176
|
+
private etagN;
|
|
177
|
+
private meetN;
|
|
178
|
+
constructor(opts?: {
|
|
179
|
+
organizerEmail?: string;
|
|
180
|
+
});
|
|
181
|
+
setFreeBusy(email: string, busy: Busy[] | {
|
|
182
|
+
error: "notFound" | "forbidden";
|
|
183
|
+
}): void;
|
|
184
|
+
setConferenceBehaviour(b: ConferenceBehaviour, pendingGets?: number): void;
|
|
185
|
+
failNext(op: Op, error: unknown, opts?: {
|
|
186
|
+
afterApply?: boolean;
|
|
187
|
+
times?: number;
|
|
188
|
+
}): void;
|
|
189
|
+
freeBusy(p: {
|
|
190
|
+
accessToken: string;
|
|
191
|
+
timeMin: string;
|
|
192
|
+
timeMax: string;
|
|
193
|
+
emails: string[];
|
|
194
|
+
}): Promise<Record<string, {
|
|
195
|
+
busy: Busy[];
|
|
196
|
+
errors: {
|
|
197
|
+
reason: string;
|
|
198
|
+
}[];
|
|
199
|
+
}>>;
|
|
200
|
+
insert(p: {
|
|
201
|
+
accessToken: string;
|
|
202
|
+
event: GEvent;
|
|
203
|
+
sendUpdates: GoogleSendUpdates;
|
|
204
|
+
conferenceDataVersion: 0 | 1;
|
|
205
|
+
}): Promise<GEvent>;
|
|
206
|
+
get(p: {
|
|
207
|
+
accessToken: string;
|
|
208
|
+
eventId: string;
|
|
209
|
+
}): Promise<GEvent>;
|
|
210
|
+
patch(p: {
|
|
211
|
+
accessToken: string;
|
|
212
|
+
eventId: string;
|
|
213
|
+
patch: Partial<GEvent>;
|
|
214
|
+
sendUpdates: GoogleSendUpdates;
|
|
215
|
+
conferenceDataVersion: 0 | 1;
|
|
216
|
+
ifMatch?: string;
|
|
217
|
+
}): Promise<GEvent>;
|
|
218
|
+
delete(p: {
|
|
219
|
+
accessToken: string;
|
|
220
|
+
eventId: string;
|
|
221
|
+
sendUpdates: GoogleSendUpdates;
|
|
222
|
+
ifMatch?: string;
|
|
223
|
+
}): Promise<void>;
|
|
224
|
+
clear(): void;
|
|
225
|
+
private run;
|
|
226
|
+
/** Google answers 412 when `If-Match` names an etag other than the current one. */
|
|
227
|
+
private checkIfMatch;
|
|
228
|
+
/** Every applied mutation gets a new etag, as on Google. */
|
|
229
|
+
private stamp;
|
|
230
|
+
private notify;
|
|
231
|
+
/** Resolves a `createRequest` the way Google does; ignored when version is 0. */
|
|
232
|
+
private applyConference;
|
|
233
|
+
private completeConference;
|
|
234
|
+
private addEntryPoint;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
type Target = {
|
|
238
|
+
accessToken: string;
|
|
239
|
+
spreadsheetId: string;
|
|
240
|
+
};
|
|
241
|
+
type FakeSheetsTab = {
|
|
242
|
+
title: string;
|
|
243
|
+
sheetId?: number;
|
|
244
|
+
rows?: (string | number | boolean)[][];
|
|
245
|
+
};
|
|
246
|
+
type FakeSheetsCall = {
|
|
247
|
+
op: keyof SheetsTransport;
|
|
248
|
+
ranges?: string[];
|
|
249
|
+
valueInputOption?: string;
|
|
250
|
+
requests?: number;
|
|
251
|
+
/** The field mask of a `getSpreadsheet` call. */
|
|
252
|
+
fields?: string;
|
|
253
|
+
};
|
|
254
|
+
/** A gaxios-shaped HTTP error, as the googleapis client throws it. */
|
|
255
|
+
declare function sheetsHttpError(status: number, reason: string, message: string): Error;
|
|
256
|
+
/**
|
|
257
|
+
* In-memory Google Sheets transport for tests: one spreadsheet with tabs, cell
|
|
258
|
+
* values and formulas, named and protected ranges. Every operation runs on a
|
|
259
|
+
* copy of the state that is committed only if it succeeds, so a failing
|
|
260
|
+
* `batchUpdate` applies nothing.
|
|
261
|
+
*
|
|
262
|
+
* Simplifications to know about:
|
|
263
|
+
* - `valuesAppend` table detection is "after the last row with any stored cell"
|
|
264
|
+
* (from the range's start column), not Google's full table heuristics.
|
|
265
|
+
* - USER_ENTERED parses only `'`-literals, `=`/`+`/`-` formulas, plain numbers,
|
|
266
|
+
* percents, TRUE/FALSE and `M/D[/Y]` dates (year-less → {@link FIXED_YEAR}).
|
|
267
|
+
* ISO dates, `1,000`, `$5`, `1e5`, times and padded text stay text. Formulas
|
|
268
|
+
* are not evaluated: they read as `""` except under `FORMULA`.
|
|
269
|
+
* - Requests that would change values but are recorded only (cells untouched):
|
|
270
|
+
* copyPaste, cutPaste, moveDimension, insertRange/deleteRange, updateCells,
|
|
271
|
+
* appendCells, appendDimension, autoFill, findReplace, sortRange and the rest
|
|
272
|
+
* outside the structural set.
|
|
273
|
+
*/
|
|
274
|
+
declare class FakeSheets implements SheetsTransport {
|
|
275
|
+
readonly calls: FakeSheetsCall[];
|
|
276
|
+
/** Every request of each committed `batchUpdate`, in order. */
|
|
277
|
+
readonly appliedRequests: GRequest[];
|
|
278
|
+
private readonly spreadsheetId;
|
|
279
|
+
private readonly title;
|
|
280
|
+
private state;
|
|
281
|
+
private readonly failures;
|
|
282
|
+
constructor(opts?: {
|
|
283
|
+
spreadsheetId?: string;
|
|
284
|
+
title?: string;
|
|
285
|
+
tabs?: FakeSheetsTab[];
|
|
286
|
+
});
|
|
287
|
+
tab(title: string): {
|
|
288
|
+
sheetId: number;
|
|
289
|
+
hidden: boolean;
|
|
290
|
+
frozenRows: number;
|
|
291
|
+
frozenColumns: number;
|
|
292
|
+
index: number;
|
|
293
|
+
} | undefined;
|
|
294
|
+
/** The tab's values (formulas read as `""`), trailing empty cells and rows trimmed. */
|
|
295
|
+
values(title: string): (string | number | boolean)[][];
|
|
296
|
+
/** The formula stored at `cell` (e.g. `"C2"`), or null if the cell holds none. */
|
|
297
|
+
formulaAt(title: string, cell: string): string | null;
|
|
298
|
+
failNext(op: keyof SheetsTransport, error: unknown, opts?: {
|
|
299
|
+
afterApply?: boolean;
|
|
300
|
+
}): void;
|
|
301
|
+
getSpreadsheet(p: Target & {
|
|
302
|
+
fields: string;
|
|
303
|
+
}): Promise<GSpreadsheet>;
|
|
304
|
+
valuesGet(p: Target & {
|
|
305
|
+
range: string;
|
|
306
|
+
valueRenderOption: RenderOption;
|
|
307
|
+
}): Promise<GValueRange>;
|
|
308
|
+
valuesBatchGet(p: Target & {
|
|
309
|
+
ranges: string[];
|
|
310
|
+
valueRenderOption: RenderOption;
|
|
311
|
+
}): Promise<{
|
|
312
|
+
valueRanges?: GValueRange[] | null;
|
|
313
|
+
}>;
|
|
314
|
+
valuesUpdate(p: Target & {
|
|
315
|
+
range: string;
|
|
316
|
+
values: unknown[][];
|
|
317
|
+
valueInputOption: InputOption;
|
|
318
|
+
}): Promise<{
|
|
319
|
+
updatedRange?: string | null;
|
|
320
|
+
updatedCells?: number | null;
|
|
321
|
+
}>;
|
|
322
|
+
valuesBatchUpdate(p: Target & {
|
|
323
|
+
data: {
|
|
324
|
+
range: string;
|
|
325
|
+
values: unknown[][];
|
|
326
|
+
}[];
|
|
327
|
+
valueInputOption: InputOption;
|
|
328
|
+
}): Promise<{
|
|
329
|
+
totalUpdatedCells?: number | null;
|
|
330
|
+
}>;
|
|
331
|
+
valuesAppend(p: Target & {
|
|
332
|
+
range: string;
|
|
333
|
+
values: unknown[][];
|
|
334
|
+
valueInputOption: InputOption;
|
|
335
|
+
insertDataOption: "INSERT_ROWS" | "OVERWRITE";
|
|
336
|
+
}): Promise<{
|
|
337
|
+
updates?: {
|
|
338
|
+
updatedRange?: string | null;
|
|
339
|
+
} | null;
|
|
340
|
+
}>;
|
|
341
|
+
valuesBatchClear(p: Target & {
|
|
342
|
+
ranges: string[];
|
|
343
|
+
}): Promise<void>;
|
|
344
|
+
batchUpdate(p: Target & {
|
|
345
|
+
requests: GRequest[];
|
|
346
|
+
}): Promise<{
|
|
347
|
+
replies?: GResponse[] | null;
|
|
348
|
+
}>;
|
|
349
|
+
/** Injected failure, 404 check, then `fn` on a draft that is committed on success. */
|
|
350
|
+
private run;
|
|
351
|
+
private mustTab;
|
|
352
|
+
/**
|
|
353
|
+
* Resolves an A1 ref to its tab and bounds (null bounds = whole tab), as Google
|
|
354
|
+
* does: `'quoted'` or unquoted title (no `'` in it) before `!`; a bare quoted
|
|
355
|
+
* title is the whole tab; a bare ref that parses as A1 addresses the first
|
|
356
|
+
* visible tab; any other bare text is a whole-tab title.
|
|
357
|
+
*/
|
|
358
|
+
private resolve;
|
|
359
|
+
private read;
|
|
360
|
+
private write;
|
|
361
|
+
private writeAt;
|
|
362
|
+
private sheetProps;
|
|
363
|
+
private full;
|
|
364
|
+
private apply;
|
|
365
|
+
private checkSheetIds;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export { CaptureTransport, type CapturedMessage, type ContractTestApi, FakeCalendar, type FakeCall, FakeGoogleOAuth, type FakeNotification, FakeSheets, type FakeSheetsCall, type FakeSheetsTab, InMemoryStore, LocalKeyProvider, runStoreContractTests, sheetsHttpError };
|