@mcpher/gas-fakes 2.5.2 → 2.5.4

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 +17 -3
  2. package/package.json +1 -1
  3. package/pngs/srv.jpg +0 -0
  4. package/src/cli/app.js +1 -0
  5. package/src/cli/togas.js +23 -14
  6. package/src/index.js +1 -0
  7. package/src/services/advslides/fakeadvslides.js +11 -5
  8. package/src/services/base/app.js +9 -0
  9. package/src/services/base/fakebase.js +28 -0
  10. package/src/services/common/fakeadvresource.js +3 -2
  11. package/src/services/content/contentservice.js +3 -2
  12. package/src/services/enums/baseenums.js +47 -0
  13. package/src/services/enums/contentenums.js +1 -3
  14. package/src/services/enums/scriptenums.js +31 -4
  15. package/src/services/enums/slidesenums.js +3 -1
  16. package/src/services/enums/xmlenums.js +14 -0
  17. package/src/services/html/serverworker.js +1 -1
  18. package/src/services/scriptapp/app.js +14 -7
  19. package/src/services/scriptapp/fakeauthorizationinfo.js +4 -4
  20. package/src/services/slidesapp/app.js +5 -0
  21. package/src/services/slidesapp/fakeautofit.js +1 -1
  22. package/src/services/slidesapp/fakeborder.js +106 -0
  23. package/src/services/slidesapp/fakecolorscheme.js +1 -1
  24. package/src/services/slidesapp/fakefill.js +216 -0
  25. package/src/services/slidesapp/fakegroup.js +35 -0
  26. package/src/services/slidesapp/fakeimage.js +118 -0
  27. package/src/services/slidesapp/fakelayout.js +351 -0
  28. package/src/services/slidesapp/fakeline.js +2 -2
  29. package/src/services/slidesapp/fakelinefill.js +15 -16
  30. package/src/services/slidesapp/fakelink.js +20 -3
  31. package/src/services/slidesapp/fakelist.js +36 -0
  32. package/src/services/slidesapp/fakeliststyle.js +105 -0
  33. package/src/services/slidesapp/fakemaster.js +358 -0
  34. package/src/services/slidesapp/fakenotesmaster.js +125 -0
  35. package/src/services/slidesapp/fakenotespage.js +102 -2
  36. package/src/services/slidesapp/fakepagebackground.js +109 -1
  37. package/src/services/slidesapp/fakepageelement.js +157 -18
  38. package/src/services/slidesapp/fakepageelementrange.js +28 -0
  39. package/src/services/slidesapp/fakepagerange.js +28 -0
  40. package/src/services/slidesapp/fakeparagraphstyle.js +139 -0
  41. package/src/services/slidesapp/fakepicturefill.js +32 -0
  42. package/src/services/slidesapp/fakepresentation.js +126 -2
  43. package/src/services/slidesapp/fakeshape.js +9 -0
  44. package/src/services/slidesapp/fakeslide.js +216 -24
  45. package/src/services/slidesapp/fakesolidfill.js +45 -0
  46. package/src/services/slidesapp/fakespeakerspotlight.js +18 -0
  47. package/src/services/slidesapp/faketable.js +55 -9
  48. package/src/services/slidesapp/faketablecell.js +141 -12
  49. package/src/services/slidesapp/faketablecellrange.js +28 -0
  50. package/src/services/slidesapp/faketablecolumn.js +72 -0
  51. package/src/services/slidesapp/faketablerow.js +31 -0
  52. package/src/services/slidesapp/faketextrange.js +179 -135
  53. package/src/services/slidesapp/faketextstyle.js +158 -0
  54. package/src/services/slidesapp/fakevideo.js +35 -0
  55. package/src/services/slidesapp/fakewordart.js +22 -0
  56. package/src/services/slidesapp/pageelementfactory.js +24 -1
  57. package/src/services/spreadsheetapp/fakeembeddedchartbuilder.js +92 -12
  58. package/src/services/spreadsheetapp/fakespreadsheet.js +360 -62
  59. package/src/services/spreadsheetapp/fakespreadsheettheme.js +53 -0
  60. package/src/services/urlfetchapp/app.js +216 -175
  61. package/src/services/xmlservice/app.js +3 -78
  62. package/src/services/xmlservice/fakeattribute.js +15 -0
  63. package/src/services/xmlservice/fakecdata.js +40 -0
  64. package/src/services/xmlservice/fakecomment.js +34 -0
  65. package/src/services/xmlservice/fakecontent.js +51 -0
  66. package/src/services/xmlservice/fakedoctype.js +68 -0
  67. package/src/services/xmlservice/fakedocument.js +110 -13
  68. package/src/services/xmlservice/fakeelement.js +297 -82
  69. package/src/services/xmlservice/fakeentityref.js +54 -0
  70. package/src/services/xmlservice/fakeformat.js +67 -22
  71. package/src/services/xmlservice/fakeprocessinginstruction.js +44 -0
  72. package/src/services/xmlservice/faketext.js +39 -0
  73. package/src/services/xmlservice/fakexmlservice.js +118 -0
  74. package/src/support/sxfetch.js +60 -0
  75. package/tools/omlx.env.example +6 -0
  76. package/tools/omlx_mcp_server.cjs +157 -0
@@ -292,7 +292,34 @@ export class FakeEmbeddedChartBuilder {
292
292
  return axis;
293
293
  }
294
294
 
295
- reverseCategories() { notYetImplemented('reverseCategories'); return this; }
295
+ __extractTextStyle(textStyle) {
296
+ if (!textStyle || !textStyle.getFontFamily) return textStyle; // fallback if it's not a FakeTextStyle
297
+ const format = {};
298
+ if (textStyle.getFontFamily() !== undefined) format.fontFamily = textStyle.getFontFamily();
299
+ if (textStyle.getFontSize() !== undefined) format.fontSize = textStyle.getFontSize();
300
+ if (textStyle.isBold() !== undefined) format.bold = textStyle.isBold();
301
+ if (textStyle.isItalic() !== undefined) format.italic = textStyle.isItalic();
302
+ if (textStyle.isStrikethrough() !== undefined) format.strikethrough = textStyle.isStrikethrough();
303
+ if (textStyle.isUnderline() !== undefined) format.underline = textStyle.isUnderline();
304
+ const color = textStyle.getForegroundColorObject && textStyle.getForegroundColorObject();
305
+ if (color && color.asRgbColor) {
306
+ const rgb = color.asRgbColor();
307
+ format.foregroundColorStyle = {
308
+ rgbColor: { red: rgb.getRed() / 255, green: rgb.getGreen() / 255, blue: rgb.getBlue() / 255 }
309
+ };
310
+ }
311
+ return format;
312
+ }
313
+
314
+ reverseCategories() {
315
+ ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "reverseCategories");
316
+ const chartType = this.__apiChart.spec.basicChart ? this.__apiChart.spec.basicChart.chartType : null;
317
+ const axisPos = chartType === "BAR" ? "LEFT_AXIS" : "BOTTOM_AXIS";
318
+ const axis = this.__getAxis(axisPos);
319
+ axis.reverseDirection = true;
320
+ return this;
321
+ }
322
+
296
323
  setBackgroundColor(color) { return this.setOption("backgroundColor", color); }
297
324
 
298
325
  setColors(colors) {
@@ -306,8 +333,17 @@ export class FakeEmbeddedChartBuilder {
306
333
  return this;
307
334
  }
308
335
 
309
- setLegendTextStyle(textStyle) { notYetImplemented('setLegendTextStyle'); return this; }
310
- setPointStyle(pointStyle) { notYetImplemented('setPointStyle'); return this; }
336
+ setLegendTextStyle(textStyle) {
337
+ ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setLegendTextStyle");
338
+ if (!this.__apiChart.spec.basicChart) this.__apiChart.spec.basicChart = {};
339
+ this.__apiChart.spec.basicChart.legendTextStyle = this.__extractTextStyle(textStyle);
340
+ return this;
341
+ }
342
+
343
+ setPointStyle(pointStyle) {
344
+ ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setPointStyle");
345
+ return this.setOption("pointStyle", pointStyle ? pointStyle.toString() : "NONE");
346
+ }
311
347
 
312
348
  setRange(min, max) {
313
349
  ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setRange");
@@ -332,8 +368,17 @@ export class FakeEmbeddedChartBuilder {
332
368
  return this;
333
369
  }
334
370
 
335
- setTitleTextStyle(textStyle) { notYetImplemented('setTitleTextStyle'); return this; }
336
- setXAxisTextStyle(textStyle) { notYetImplemented('setXAxisTextStyle'); return this; }
371
+ setTitleTextStyle(textStyle) {
372
+ ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setTitleTextStyle");
373
+ this.__apiChart.spec.titleTextStyle = this.__extractTextStyle(textStyle);
374
+ return this;
375
+ }
376
+
377
+ setXAxisTextStyle(textStyle) {
378
+ ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setXAxisTextStyle");
379
+ this.__getAxis("BOTTOM_AXIS").textStyle = this.__extractTextStyle(textStyle);
380
+ return this;
381
+ }
337
382
 
338
383
  setXAxisTitle(title) {
339
384
  ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setXAxisTitle");
@@ -341,8 +386,17 @@ export class FakeEmbeddedChartBuilder {
341
386
  return this;
342
387
  }
343
388
 
344
- setXAxisTitleTextStyle(textStyle) { notYetImplemented('setXAxisTitleTextStyle'); return this; }
345
- setYAxisTextStyle(textStyle) { notYetImplemented('setYAxisTextStyle'); return this; }
389
+ setXAxisTitleTextStyle(textStyle) {
390
+ ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setXAxisTitleTextStyle");
391
+ this.__getAxis("BOTTOM_AXIS").titleTextStyle = this.__extractTextStyle(textStyle);
392
+ return this;
393
+ }
394
+
395
+ setYAxisTextStyle(textStyle) {
396
+ ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setYAxisTextStyle");
397
+ this.__getAxis("LEFT_AXIS").textStyle = this.__extractTextStyle(textStyle);
398
+ return this;
399
+ }
346
400
 
347
401
  setYAxisTitle(title) {
348
402
  ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setYAxisTitle");
@@ -350,8 +404,21 @@ export class FakeEmbeddedChartBuilder {
350
404
  return this;
351
405
  }
352
406
 
353
- setYAxisTitleTextStyle(textStyle) { notYetImplemented('setYAxisTitleTextStyle'); return this; }
354
- useLogScale() { notYetImplemented('useLogScale'); return this; }
407
+ setYAxisTitleTextStyle(textStyle) {
408
+ ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setYAxisTitleTextStyle");
409
+ this.__getAxis("LEFT_AXIS").titleTextStyle = this.__extractTextStyle(textStyle);
410
+ return this;
411
+ }
412
+
413
+ useLogScale() {
414
+ ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "useLogScale");
415
+ const chartType = this.__apiChart.spec.basicChart ? this.__apiChart.spec.basicChart.chartType : null;
416
+ const axisPos = chartType === "BAR" ? "BOTTOM_AXIS" : "LEFT_AXIS";
417
+ const axis = this.__getAxis(axisPos);
418
+ axis.logScale = true;
419
+ return this;
420
+ }
421
+
355
422
  set3D() { return this.setOption("is3D", true); }
356
423
  enablePaging(enable, pageSize) { notYetImplemented('enablePaging'); return this; }
357
424
  enableRtlTable(enable) { notYetImplemented('enableRtlTable'); return this; }
@@ -361,7 +428,12 @@ export class FakeEmbeddedChartBuilder {
361
428
  setInitialSortingDescending(column) { notYetImplemented('setInitialSortingDescending'); return this; }
362
429
  showRowNumberColumn(show) { notYetImplemented('showRowNumberColumn'); return this; }
363
430
  useAlternatingRowStyle(use) { notYetImplemented('useAlternatingRowStyle'); return this; }
364
- setXAxisLogScale() { notYetImplemented('setXAxisLogScale'); return this; }
431
+
432
+ setXAxisLogScale() {
433
+ ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setXAxisLogScale");
434
+ this.__getAxis("BOTTOM_AXIS").logScale = true;
435
+ return this;
436
+ }
365
437
 
366
438
  setXAxisRange(min, max) {
367
439
  ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setXAxisRange");
@@ -370,7 +442,11 @@ export class FakeEmbeddedChartBuilder {
370
442
  return this;
371
443
  }
372
444
 
373
- setYAxisLogScale() { notYetImplemented('setYAxisLogScale'); return this; }
445
+ setYAxisLogScale() {
446
+ ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setYAxisLogScale");
447
+ this.__getAxis("LEFT_AXIS").logScale = true;
448
+ return this;
449
+ }
374
450
 
375
451
  setYAxisRange(min, max) {
376
452
  ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setYAxisRange");
@@ -379,7 +455,11 @@ export class FakeEmbeddedChartBuilder {
379
455
  return this;
380
456
  }
381
457
 
382
- reverseDirection() { notYetImplemented('reverseDirection'); return this; }
458
+ reverseDirection() {
459
+ ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "reverseDirection");
460
+ this.__getAxis("BOTTOM_AXIS").reverseDirection = true;
461
+ return this;
462
+ }
383
463
 
384
464
  toString() {
385
465
  const type = this.__apiChart.spec.basicChart?.chartType;
@@ -11,6 +11,7 @@ import { newFakeDataSource } from "./fakedatasource.js";
11
11
  import { batchUpdate } from "./sheetrangehelpers.js";
12
12
  import { FakeTextFinder, newFakeTextFinder } from "./faketextfinder.js";
13
13
  import { newFakeNamedRange } from "./fakenamedrange.js";
14
+ import { newFakeSpreadsheetTheme } from "./fakespreadsheettheme.js";
14
15
 
15
16
  // import { newFakeProtection } from "../common/fakeprotection.js";
16
17
  import { newFakeProtection } from "./fakeprotection.js";
@@ -42,108 +43,46 @@ export class FakeSpreadsheet {
42
43
  this.__file = DriveApp.getFileById(file.spreadsheetId);
43
44
 
44
45
  const props = [
45
- "getSpreadsheetTheme",
46
-
47
46
  "getBandings",
48
47
  "getDataSources",
49
48
  "addCollaborator",
50
- "updateMenu",
51
49
  "refreshAllDataSources",
52
- "getSpreadsheetTimeZone",
53
- "setSpreadsheetTimeZone",
54
- "findSheet",
55
50
  "getCollaborators",
56
51
  "getChanges",
57
- // "createTextFinder",
58
-
59
- "findSheetByName",
60
52
  "removeCollaborator",
61
- "getSpreadsheetLocale",
62
53
  "setAnonymousAccess",
63
- "resetSpreadsheetTheme",
64
- "renameActiveSheet",
65
54
  "removeNamedRange",
66
- // "getRangeByName",
67
55
  "moveChartToObjectSheet",
68
- "deleteRows",
69
56
  "addCollaborators",
70
- "deleteSheet",
71
57
  "moveActiveSheet",
72
58
  "isAnonymousView",
73
- "duplicateActiveSheet",
74
59
  "getFormUrl",
75
- // "getNamedRanges",
76
- "deleteActiveSheet",
77
- // "setNamedRange",
78
-
79
- "setSpreadsheetLocale",
80
60
  "getDataSourceSheets",
81
- "setSpreadsheetTheme",
82
61
  "isAnonymousWrite",
83
62
  "addMenu",
84
63
  "removeMenu",
85
64
  "inputBox",
86
- "setMaxIterativeCalculationCycles",
87
- "getMaxIterativeCalculationCycles",
88
65
  "waitForAllDataExecutionsCompletion",
89
66
  "msgBox",
90
- "toast",
91
- "show",
92
- "getIterativeCalculationConvergenceThreshold",
93
- "setIterativeCalculationConvergenceThreshold",
94
- "setRecalculationInterval",
95
- "setIterativeCalculationEnabled",
96
- "isIterativeCalculationEnabled",
97
67
  "insertSheetWithDataSourceTable",
98
68
  "getDataSourceRefreshSchedules",
99
69
  "getPredefinedSpreadsheetThemes",
100
- "setName",
101
70
  "copy",
102
- "rename",
103
71
  "isReadable",
104
72
  "isWritable",
105
- "getSelection",
106
- "getActiveRangeList",
107
- "deleteRow",
108
- "hideRow",
109
- "appendRow",
110
73
  "getSheetProtection",
111
- "unhideRow",
112
- "insertRowsAfter",
113
- "revealRow",
114
74
  "setSheetPermissions",
115
- "insertColumnAfter",
116
- "setFrozenColumns",
117
- "getFrozenRows",
118
- "setFrozenRows",
119
75
  "isRowHiddenByFilter",
120
- "insertRowsBefore",
121
- "isRowHiddenByUser",
122
76
  "setActiveCell",
123
77
  "getSheetValues",
124
78
  "setSheetProtection",
125
79
  "getDataSourceTables",
126
- "insertColumnsAfter",
127
- "hideColumn",
128
- "autoResizeColumn",
129
- "getFrozenColumns",
130
- "unhideColumn",
131
- "insertColumnsBefore",
132
80
  "getDataSourceFormulas",
133
81
  "getSheetPermissions",
134
- "insertColumnBefore",
135
-
136
- "isColumnHiddenByUser",
137
82
  "getRangeList",
138
- "insertRowBefore",
139
- "insertRowAfter",
140
-
141
- "revealColumn",
142
83
  "getActiveCell",
143
84
  "getDataSourcePivotTables",
144
- "deleteColumns",
145
85
  "getActiveSelection",
146
- "deleteColumn",
147
86
  "getImages",
148
87
  "find",
149
88
  "getBlob",
@@ -464,6 +403,365 @@ export class FakeSpreadsheet {
464
403
  return this.__getMetaProps("properties.autoRecalc").properties.autoRecalc;
465
404
  }
466
405
 
406
+ setSpreadsheetLocale(locale) {
407
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.setSpreadsheetLocale");
408
+ if (nargs !== 1) matchThrow();
409
+ this.__meta.properties.locale = locale;
410
+ return this;
411
+ }
412
+
413
+ getSpreadsheetLocale() {
414
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.getSpreadsheetLocale");
415
+ if (nargs) matchThrow();
416
+ return this.__meta.properties.locale;
417
+ }
418
+
419
+ setSpreadsheetTimeZone(timezone) {
420
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.setSpreadsheetTimeZone");
421
+ if (nargs !== 1) matchThrow();
422
+ this.__meta.properties.timeZone = timezone;
423
+ return this;
424
+ }
425
+
426
+ getSpreadsheetTimeZone() {
427
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.getSpreadsheetTimeZone");
428
+ if (nargs) matchThrow();
429
+ return this.__meta.properties.timeZone;
430
+ }
431
+
432
+ setIterativeCalculationEnabled(enabled) {
433
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.setIterativeCalculationEnabled");
434
+ if (nargs !== 1) matchThrow();
435
+ if (!this.__meta.properties.iterativeCalculationSettings) this.__meta.properties.iterativeCalculationSettings = {};
436
+ this.__meta.properties.iterativeCalculationSettings.maxIterativeCalculationCycles = enabled ? (this.__meta.properties.iterativeCalculationSettings.maxIterativeCalculationCycles || 50) : 0;
437
+ return this;
438
+ }
439
+
440
+ isIterativeCalculationEnabled() {
441
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.isIterativeCalculationEnabled");
442
+ if (nargs) matchThrow();
443
+ return (this.__meta.properties.iterativeCalculationSettings?.maxIterativeCalculationCycles || 0) > 0;
444
+ }
445
+
446
+ setMaxIterativeCalculationCycles(cycles) {
447
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.setMaxIterativeCalculationCycles");
448
+ if (nargs !== 1) matchThrow();
449
+ if (!this.__meta.properties.iterativeCalculationSettings) this.__meta.properties.iterativeCalculationSettings = {};
450
+ this.__meta.properties.iterativeCalculationSettings.maxIterativeCalculationCycles = cycles;
451
+ return this;
452
+ }
453
+
454
+ getMaxIterativeCalculationCycles() {
455
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.getMaxIterativeCalculationCycles");
456
+ if (nargs) matchThrow();
457
+ return this.__meta.properties.iterativeCalculationSettings?.maxIterativeCalculationCycles || 50;
458
+ }
459
+
460
+ setIterativeCalculationConvergenceThreshold(threshold) {
461
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.setIterativeCalculationConvergenceThreshold");
462
+ if (nargs !== 1) matchThrow();
463
+ if (!this.__meta.properties.iterativeCalculationSettings) this.__meta.properties.iterativeCalculationSettings = {};
464
+ this.__meta.properties.iterativeCalculationSettings.convergenceThreshold = threshold;
465
+ return this;
466
+ }
467
+
468
+ getIterativeCalculationConvergenceThreshold() {
469
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.getIterativeCalculationConvergenceThreshold");
470
+ if (nargs) matchThrow();
471
+ return this.__meta.properties.iterativeCalculationSettings?.convergenceThreshold || 0.05;
472
+ }
473
+
474
+ setRecalculationInterval(interval) {
475
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.setRecalculationInterval");
476
+ if (nargs !== 1) matchThrow();
477
+ this.__meta.properties.autoRecalc = interval;
478
+ return this;
479
+ }
480
+
481
+ setFrozenRows(rows) {
482
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.setFrozenRows");
483
+ if (nargs !== 1) matchThrow();
484
+ this.getActiveSheet().setFrozenRows(rows);
485
+ return this;
486
+ }
487
+
488
+ getFrozenRows() {
489
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.getFrozenRows");
490
+ if (nargs) matchThrow();
491
+ return this.getActiveSheet().getFrozenRows();
492
+ }
493
+
494
+ setFrozenColumns(columns) {
495
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.setFrozenColumns");
496
+ if (nargs !== 1) matchThrow();
497
+ this.getActiveSheet().setFrozenColumns(columns);
498
+ return this;
499
+ }
500
+
501
+ getFrozenColumns() {
502
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.getFrozenColumns");
503
+ if (nargs) matchThrow();
504
+ return this.getActiveSheet().getFrozenColumns();
505
+ }
506
+
507
+ unhideColumn(range) {
508
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.unhideColumn");
509
+ if (nargs !== 1) matchThrow();
510
+ this.getActiveSheet().unhideColumn(range);
511
+ return this;
512
+ }
513
+
514
+ unhideRow(range) {
515
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.unhideRow");
516
+ if (nargs !== 1) matchThrow();
517
+ this.getActiveSheet().unhideRow(range);
518
+ return this;
519
+ }
520
+
521
+ getActiveRangeList() {
522
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.getActiveRangeList");
523
+ if (nargs) matchThrow();
524
+ return this.getActiveSheet().getActiveRangeList();
525
+ }
526
+
527
+ getSelection() {
528
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.getSelection");
529
+ if (nargs) matchThrow();
530
+ const rangeList = this.getActiveRangeList() || this.getActiveSheet().getRangeList([this.getActiveRange().getA1Notation()]);
531
+ return {
532
+ getActiveRange: () => this.getActiveRange(),
533
+ getActiveRangeList: () => rangeList,
534
+ getActiveSheet: () => this.getActiveSheet(),
535
+ getCurrentCell: () => this.getCurrentCell()
536
+ };
537
+ }
538
+
539
+ toast(msg, title, timeout) {
540
+ return this;
541
+ }
542
+
543
+ show(userInterface) {
544
+ return this;
545
+ }
546
+
547
+ updateMenu(name, menu) {
548
+ return this;
549
+ }
550
+
551
+ getSpreadsheetTheme() {
552
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.getSpreadsheetTheme");
553
+ if (nargs) matchThrow();
554
+ if (!this.__theme) {
555
+ this.__theme = newFakeSpreadsheetTheme(this.__meta.properties.spreadsheetTheme);
556
+ }
557
+ return this.__theme;
558
+ }
559
+
560
+ setSpreadsheetTheme(theme) {
561
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.setSpreadsheetTheme");
562
+ if (nargs !== 1) matchThrow();
563
+ this.__theme = theme;
564
+ return this;
565
+ }
566
+
567
+ resetSpreadsheetTheme() {
568
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.resetSpreadsheetTheme");
569
+ if (nargs) matchThrow();
570
+ this.__theme = newFakeSpreadsheetTheme();
571
+ return this.__theme;
572
+ }
573
+
574
+ deleteRow(rowPosition) {
575
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.deleteRow");
576
+ if (nargs !== 1) matchThrow();
577
+ this.getActiveSheet().deleteRow(rowPosition);
578
+ return this;
579
+ }
580
+
581
+ deleteRows(rowPosition, howMany) {
582
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.deleteRows");
583
+ if (nargs !== 2) matchThrow();
584
+ this.getActiveSheet().deleteRows(rowPosition, howMany);
585
+ return this;
586
+ }
587
+
588
+ hideRow(row) {
589
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.hideRow");
590
+ if (nargs !== 1) matchThrow();
591
+ this.getActiveSheet().hideRow(row);
592
+ return this;
593
+ }
594
+
595
+ appendRow(rowContents) {
596
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.appendRow");
597
+ if (nargs !== 1) matchThrow();
598
+ this.getActiveSheet().appendRow(rowContents);
599
+ return this;
600
+ }
601
+
602
+ insertRowsAfter(afterPosition, howMany) {
603
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.insertRowsAfter");
604
+ if (nargs < 1 || nargs > 2) matchThrow();
605
+ this.getActiveSheet().insertRowsAfter(afterPosition, howMany || 1);
606
+ return this;
607
+ }
608
+
609
+ revealRow(row) {
610
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.revealRow");
611
+ if (nargs !== 1) matchThrow();
612
+ this.getActiveSheet().unhideRow(row);
613
+ return this;
614
+ }
615
+
616
+ insertColumnAfter(afterPosition) {
617
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.insertColumnAfter");
618
+ if (nargs !== 1) matchThrow();
619
+ this.getActiveSheet().insertColumnsAfter(afterPosition, 1);
620
+ return this;
621
+ }
622
+
623
+ isRowHiddenByUser(rowPosition) {
624
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.isRowHiddenByUser");
625
+ if (nargs !== 1) matchThrow();
626
+ return this.getActiveSheet().isRowHiddenByUser(rowPosition);
627
+ }
628
+
629
+ insertRowsBefore(beforePosition, howMany) {
630
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.insertRowsBefore");
631
+ if (nargs < 1 || nargs > 2) matchThrow();
632
+ this.getActiveSheet().insertRowsBefore(beforePosition, howMany || 1);
633
+ return this;
634
+ }
635
+
636
+ insertColumnsAfter(afterPosition, howMany) {
637
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.insertColumnsAfter");
638
+ if (nargs < 1 || nargs > 2) matchThrow();
639
+ this.getActiveSheet().insertColumnsAfter(afterPosition, howMany || 1);
640
+ return this;
641
+ }
642
+
643
+ hideColumn(column) {
644
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.hideColumn");
645
+ if (nargs !== 1) matchThrow();
646
+ this.getActiveSheet().hideColumn(column);
647
+ return this;
648
+ }
649
+
650
+ autoResizeColumn(columnPosition) {
651
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.autoResizeColumn");
652
+ if (nargs !== 1) matchThrow();
653
+ this.getActiveSheet().autoResizeColumn(columnPosition);
654
+ return this;
655
+ }
656
+
657
+ insertColumnsBefore(beforePosition, howMany) {
658
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.insertColumnsBefore");
659
+ if (nargs < 1 || nargs > 2) matchThrow();
660
+ this.getActiveSheet().insertColumnsBefore(beforePosition, howMany || 1);
661
+ return this;
662
+ }
663
+
664
+ insertColumnBefore(beforePosition) {
665
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.insertColumnBefore");
666
+ if (nargs !== 1) matchThrow();
667
+ this.getActiveSheet().insertColumnsBefore(beforePosition, 1);
668
+ return this;
669
+ }
670
+
671
+ isColumnHiddenByUser(columnPosition) {
672
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.isColumnHiddenByUser");
673
+ if (nargs !== 1) matchThrow();
674
+ return this.getActiveSheet().isColumnHiddenByUser(columnPosition);
675
+ }
676
+
677
+ insertRowBefore(beforePosition) {
678
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.insertRowBefore");
679
+ if (nargs !== 1) matchThrow();
680
+ this.getActiveSheet().insertRowsBefore(beforePosition, 1);
681
+ return this;
682
+ }
683
+
684
+ insertRowAfter(afterPosition) {
685
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.insertRowAfter");
686
+ if (nargs !== 1) matchThrow();
687
+ this.getActiveSheet().insertRowsAfter(afterPosition, 1);
688
+ return this;
689
+ }
690
+
691
+ revealColumn(column) {
692
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.revealColumn");
693
+ if (nargs !== 1) matchThrow();
694
+ this.getActiveSheet().unhideColumn(column);
695
+ return this;
696
+ }
697
+
698
+ deleteColumns(columnPosition, howMany) {
699
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.deleteColumns");
700
+ if (nargs !== 2) matchThrow();
701
+ this.getActiveSheet().deleteColumns(columnPosition, howMany);
702
+ return this;
703
+ }
704
+
705
+ deleteColumn(columnPosition) {
706
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.deleteColumn");
707
+ if (nargs !== 1) matchThrow();
708
+ this.getActiveSheet().deleteColumn(columnPosition);
709
+ return this;
710
+ }
711
+
712
+ rename(newName) {
713
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.rename");
714
+ if (nargs !== 1) matchThrow();
715
+ this.__meta.properties.title = newName;
716
+ return this;
717
+ }
718
+
719
+ setName(name) {
720
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.setName");
721
+ if (nargs !== 1) matchThrow();
722
+ return this.rename(name);
723
+ }
724
+
725
+ renameActiveSheet(newName) {
726
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.renameActiveSheet");
727
+ if (nargs !== 1) matchThrow();
728
+ this.getActiveSheet().setName(newName);
729
+ return this;
730
+ }
731
+
732
+ duplicateActiveSheet() {
733
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.duplicateActiveSheet");
734
+ if (nargs) matchThrow();
735
+ const sheet = this.getActiveSheet();
736
+ const newName = "Copy of " + sheet.getName();
737
+ return this.insertSheet(newName);
738
+ }
739
+
740
+ deleteActiveSheet() {
741
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.deleteActiveSheet");
742
+ if (nargs) matchThrow();
743
+ return this.deleteSheet(this.getActiveSheet());
744
+ }
745
+
746
+ deleteSheet(sheet) {
747
+ const { nargs, matchThrow } = signatureArgs(arguments, "Spreadsheet.deleteSheet");
748
+ if (nargs !== 1) matchThrow();
749
+ const id = sheet.getSheetId();
750
+ this.__meta.sheets = this.__meta.sheets.filter(s => s.properties.sheetId !== id);
751
+ if (this.__activeSheet && this.__activeSheet.getSheetId() === id) {
752
+ this.__activeSheet = this.getSheets()[0];
753
+ }
754
+ return this;
755
+ }
756
+
757
+ findSheetByName(name) {
758
+ return this.getSheetByName(name);
759
+ }
760
+
761
+ findSheet(name) {
762
+ return this.getSheetByName(name);
763
+ }
764
+
467
765
  /**
468
766
  * getLastColumn() https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet#getlastcolumn
469
767
  * Returns the position of the last column that has content.
@@ -0,0 +1,53 @@
1
+ import { Proxies } from "../../support/proxies.js";
2
+ import { signatureArgs } from "../../support/helpers.js";
3
+
4
+ export const newFakeSpreadsheetTheme = (...args) => {
5
+ return Proxies.guard(new FakeSpreadsheetTheme(...args));
6
+ };
7
+
8
+ export class FakeSpreadsheetTheme {
9
+ constructor(apiTheme) {
10
+ this.__apiTheme = apiTheme || {
11
+ primaryFontFamily: "Arial",
12
+ themeColors: []
13
+ };
14
+ }
15
+
16
+ getFontFamily() {
17
+ const { nargs, matchThrow } = signatureArgs(arguments, "SpreadsheetTheme.getFontFamily");
18
+ if (nargs) matchThrow();
19
+ return this.__apiTheme.primaryFontFamily || "Arial";
20
+ }
21
+
22
+ setFontFamily(fontFamily) {
23
+ const { nargs, matchThrow } = signatureArgs(arguments, "SpreadsheetTheme.setFontFamily");
24
+ if (nargs !== 1) matchThrow();
25
+ this.__apiTheme.primaryFontFamily = fontFamily;
26
+ return this;
27
+ }
28
+
29
+ getThemeColors() {
30
+ const { nargs, matchThrow } = signatureArgs(arguments, "SpreadsheetTheme.getThemeColors");
31
+ if (nargs) matchThrow();
32
+ const app = global.SpreadsheetApp || {};
33
+ return app.ThemeColorType ? Object.values(app.ThemeColorType) : [];
34
+ }
35
+
36
+ getConcreteColor(themeColorType) {
37
+ const { nargs, matchThrow } = signatureArgs(arguments, "SpreadsheetTheme.getConcreteColor");
38
+ if (nargs !== 1) matchThrow();
39
+ const app = global.SpreadsheetApp || {};
40
+ if (app.newColor) {
41
+ return app.newColor().setRgbColor("#000000").build();
42
+ }
43
+ return null;
44
+ }
45
+
46
+ setConcreteColor(themeColorType, colorOrRed, green, blue) {
47
+ return this;
48
+ }
49
+
50
+ toString() {
51
+ return "SpreadsheetTheme";
52
+ }
53
+ }