@mcpher/gas-fakes 2.5.3 → 2.5.5

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 (53) hide show
  1. package/.claspignore +1 -1
  2. package/README.md +36 -3
  3. package/exgcp.sh +63 -0
  4. package/package.json +1 -1
  5. package/src/services/content/contentservice.js +3 -2
  6. package/src/services/documentapp/appenderhelpers.js +8 -3
  7. package/src/services/documentapp/elementhelpers.js +148 -7
  8. package/src/services/documentapp/elementoptions.js +40 -0
  9. package/src/services/documentapp/elements.js +7 -0
  10. package/src/services/documentapp/fakebookmark.js +1 -3
  11. package/src/services/documentapp/fakecontainerelement.js +188 -0
  12. package/src/services/documentapp/fakedate.js +92 -0
  13. package/src/services/documentapp/fakedocument.js +51 -0
  14. package/src/services/documentapp/fakedocumenttab.js +9 -25
  15. package/src/services/documentapp/fakeelement.js +453 -90
  16. package/src/services/documentapp/fakeequation.js +28 -0
  17. package/src/services/documentapp/fakeequationfunction.js +37 -0
  18. package/src/services/documentapp/fakeequationfunctionargumentseparator.js +28 -0
  19. package/src/services/documentapp/fakeequationsymbol.js +37 -0
  20. package/src/services/documentapp/fakefootersection.js +64 -1
  21. package/src/services/documentapp/fakeheadersection.js +64 -0
  22. package/src/services/documentapp/fakeperson.js +67 -0
  23. package/src/services/documentapp/fakerangeelement.js +27 -1
  24. package/src/services/documentapp/fakerichlink.js +79 -0
  25. package/src/services/documentapp/fakesectionelement.js +51 -12
  26. package/src/services/documentapp/faketablecell.js +98 -0
  27. package/src/services/documentapp/nrhelpers.js +2 -1
  28. package/src/services/documentapp/shadowdocument.js +19 -2
  29. package/src/services/enums/contentenums.js +1 -3
  30. package/src/services/enums/scriptenums.js +31 -4
  31. package/src/services/enums/xmlenums.js +14 -0
  32. package/src/services/scriptapp/app.js +14 -7
  33. package/src/services/scriptapp/fakeauthorizationinfo.js +4 -4
  34. package/src/services/spreadsheetapp/fakeembeddedchartbuilder.js +87 -12
  35. package/src/services/spreadsheetapp/fakespreadsheet.js +360 -62
  36. package/src/services/spreadsheetapp/fakespreadsheettheme.js +53 -0
  37. package/src/services/urlfetchapp/app.js +216 -175
  38. package/src/services/xmlservice/app.js +3 -78
  39. package/src/services/xmlservice/fakeattribute.js +15 -0
  40. package/src/services/xmlservice/fakecdata.js +40 -0
  41. package/src/services/xmlservice/fakecomment.js +34 -0
  42. package/src/services/xmlservice/fakecontent.js +51 -0
  43. package/src/services/xmlservice/fakedoctype.js +68 -0
  44. package/src/services/xmlservice/fakedocument.js +110 -13
  45. package/src/services/xmlservice/fakeelement.js +297 -82
  46. package/src/services/xmlservice/fakeentityref.js +54 -0
  47. package/src/services/xmlservice/fakeformat.js +67 -22
  48. package/src/services/xmlservice/fakeprocessinginstruction.js +44 -0
  49. package/src/services/xmlservice/faketext.js +39 -0
  50. package/src/services/xmlservice/fakexmlservice.js +118 -0
  51. package/src/support/sxfetch.js +60 -0
  52. package/tools/omlx.env.example +6 -0
  53. package/tools/omlx_mcp_server.cjs +157 -0
@@ -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
+ }