@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.
- package/.claspignore +1 -1
- package/README.md +36 -3
- package/exgcp.sh +63 -0
- package/package.json +1 -1
- package/src/services/content/contentservice.js +3 -2
- package/src/services/documentapp/appenderhelpers.js +8 -3
- package/src/services/documentapp/elementhelpers.js +148 -7
- package/src/services/documentapp/elementoptions.js +40 -0
- package/src/services/documentapp/elements.js +7 -0
- package/src/services/documentapp/fakebookmark.js +1 -3
- package/src/services/documentapp/fakecontainerelement.js +188 -0
- package/src/services/documentapp/fakedate.js +92 -0
- package/src/services/documentapp/fakedocument.js +51 -0
- package/src/services/documentapp/fakedocumenttab.js +9 -25
- package/src/services/documentapp/fakeelement.js +453 -90
- package/src/services/documentapp/fakeequation.js +28 -0
- package/src/services/documentapp/fakeequationfunction.js +37 -0
- package/src/services/documentapp/fakeequationfunctionargumentseparator.js +28 -0
- package/src/services/documentapp/fakeequationsymbol.js +37 -0
- package/src/services/documentapp/fakefootersection.js +64 -1
- package/src/services/documentapp/fakeheadersection.js +64 -0
- package/src/services/documentapp/fakeperson.js +67 -0
- package/src/services/documentapp/fakerangeelement.js +27 -1
- package/src/services/documentapp/fakerichlink.js +79 -0
- package/src/services/documentapp/fakesectionelement.js +51 -12
- package/src/services/documentapp/faketablecell.js +98 -0
- package/src/services/documentapp/nrhelpers.js +2 -1
- package/src/services/documentapp/shadowdocument.js +19 -2
- package/src/services/enums/contentenums.js +1 -3
- package/src/services/enums/scriptenums.js +31 -4
- package/src/services/enums/xmlenums.js +14 -0
- package/src/services/scriptapp/app.js +14 -7
- package/src/services/scriptapp/fakeauthorizationinfo.js +4 -4
- package/src/services/spreadsheetapp/fakeembeddedchartbuilder.js +87 -12
- package/src/services/spreadsheetapp/fakespreadsheet.js +360 -62
- package/src/services/spreadsheetapp/fakespreadsheettheme.js +53 -0
- package/src/services/urlfetchapp/app.js +216 -175
- package/src/services/xmlservice/app.js +3 -78
- package/src/services/xmlservice/fakeattribute.js +15 -0
- package/src/services/xmlservice/fakecdata.js +40 -0
- package/src/services/xmlservice/fakecomment.js +34 -0
- package/src/services/xmlservice/fakecontent.js +51 -0
- package/src/services/xmlservice/fakedoctype.js +68 -0
- package/src/services/xmlservice/fakedocument.js +110 -13
- package/src/services/xmlservice/fakeelement.js +297 -82
- package/src/services/xmlservice/fakeentityref.js +54 -0
- package/src/services/xmlservice/fakeformat.js +67 -22
- package/src/services/xmlservice/fakeprocessinginstruction.js +44 -0
- package/src/services/xmlservice/faketext.js +39 -0
- package/src/services/xmlservice/fakexmlservice.js +118 -0
- package/src/support/sxfetch.js +60 -0
- package/tools/omlx.env.example +6 -0
- package/tools/omlx_mcp_server.cjs +157 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { newFakeGasenum } from "@mcpher/fake-gasenum";
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
MimeType: newFakeGasenum([
|
|
3
|
+
export const MimeType = newFakeGasenum([
|
|
5
4
|
"ATOM",
|
|
6
5
|
"CSV",
|
|
7
6
|
"ICAL",
|
|
@@ -12,4 +11,3 @@ export const ContentEnums = {
|
|
|
12
11
|
"VCARD",
|
|
13
12
|
"XML"
|
|
14
13
|
])
|
|
15
|
-
}
|
|
@@ -1,6 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { newFakeGasenum } from "@mcpher/fake-gasenum";
|
|
2
|
+
|
|
3
|
+
export const AuthorizationStatus = newFakeGasenum({
|
|
3
4
|
REQUIRED: 'REQUIRED',
|
|
4
5
|
NOT_REQUIRED: 'NOT_REQUIRED'
|
|
5
|
-
}
|
|
6
|
-
|
|
6
|
+
})
|
|
7
|
+
export const TriggerSource = newFakeGasenum( {
|
|
8
|
+
CALENDAR: 'CALENDAR',
|
|
9
|
+
CLOCK: 'CLOCK',
|
|
10
|
+
DOCUMENTS: 'DOCUMENTS',
|
|
11
|
+
FORMS: 'FORMS',
|
|
12
|
+
SPREADSHEETS: 'SPREADSHEETS'
|
|
13
|
+
})
|
|
14
|
+
export const AuthMode = newFakeGasenum( {
|
|
15
|
+
NONE: 'NONE',
|
|
16
|
+
CUSTOM_FUNCTION: 'CUSTOM_FUNCTION',
|
|
17
|
+
LIMITED: 'LIMITED',
|
|
18
|
+
FULL: 'FULL'
|
|
19
|
+
})
|
|
20
|
+
export const EventType = newFakeGasenum( {
|
|
21
|
+
CLOCK: 'CLOCK',
|
|
22
|
+
ON_OPEN: 'ON_OPEN',
|
|
23
|
+
ON_EDIT: 'ON_EDIT',
|
|
24
|
+
ON_FORM_SUBMIT: 'ON_FORM_SUBMIT',
|
|
25
|
+
ON_CHANGE: 'ON_CHANGE',
|
|
26
|
+
ON_EVENT_UPDATED: 'ON_EVENT_UPDATED'
|
|
27
|
+
})
|
|
28
|
+
export const InstallationSource = newFakeGasenum({
|
|
29
|
+
APPS_MARKETPLACE_DOMAIN_ADD_ON: 'APPS_MARKETPLACE_DOMAIN_ADD_ON',
|
|
30
|
+
NONE: 'NONE',
|
|
31
|
+
WEB_STORE_ADD_ON: 'WEB_STORE_ADD_ON'
|
|
32
|
+
})
|
|
33
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { newFakeGasenum } from "@mcpher/fake-gasenum";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Enum representing the possible content types found in XML.
|
|
5
|
+
*/
|
|
6
|
+
export const ContentTypes = newFakeGasenum([
|
|
7
|
+
"CDATA",
|
|
8
|
+
"COMMENT",
|
|
9
|
+
"DOCTYPE",
|
|
10
|
+
"ELEMENT",
|
|
11
|
+
"ENTITYREF",
|
|
12
|
+
"PROCESSINGINSTRUCTION",
|
|
13
|
+
"TEXT"
|
|
14
|
+
]);
|
|
@@ -7,7 +7,13 @@ import { Auth } from '../../support/auth.js'
|
|
|
7
7
|
import { Proxies } from '../../support/proxies.js'
|
|
8
8
|
import { newFakeBehavior } from './behavior.js'
|
|
9
9
|
import { newFakeAuthorizationInfo } from './fakeauthorizationinfo.js'
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
AuthMode,
|
|
12
|
+
AuthorizationStatus,
|
|
13
|
+
TriggerSource,
|
|
14
|
+
EventType,
|
|
15
|
+
InstallationSource
|
|
16
|
+
} from '../enums/scriptenums.js'
|
|
11
17
|
import { newCacheDropin } from '@mcpher/gas-flex-cache'
|
|
12
18
|
import { slogger } from "../../support/slogger.js";
|
|
13
19
|
import fs from 'fs';
|
|
@@ -48,8 +54,8 @@ const getSourceOAuthToken = () => {
|
|
|
48
54
|
|
|
49
55
|
|
|
50
56
|
const limitMode = (mode) => {
|
|
51
|
-
if (mode !== ScriptApp.AuthMode.FULL) {
|
|
52
|
-
throw new Error(`only ${ScriptApp.AuthMode.FULL} is supported as mode for now`)
|
|
57
|
+
if (mode !== ScriptApp.AuthMode.FULL.toString()) {
|
|
58
|
+
throw new Error(`only ${ScriptApp.AuthMode.FULL.toString()} is supported as mode for now`)
|
|
53
59
|
}
|
|
54
60
|
|
|
55
61
|
return mode
|
|
@@ -234,10 +240,11 @@ if (typeof globalThis[name] === typeof undefined) {
|
|
|
234
240
|
ensureInit()
|
|
235
241
|
return Auth.getActiveUser()?.id
|
|
236
242
|
},
|
|
237
|
-
AuthMode
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
243
|
+
AuthMode,
|
|
244
|
+
AuthorizationStatus,
|
|
245
|
+
TriggerSource,
|
|
246
|
+
EventType,
|
|
247
|
+
InstallationSource,
|
|
241
248
|
getAuthorizationInfo: (authMode) => {
|
|
242
249
|
ensureInit();
|
|
243
250
|
return newFakeAuthorizationInfo(authMode);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AuthorizationStatus } from '../enums/scriptenums.js';
|
|
2
2
|
|
|
3
3
|
export class FakeAuthorizationInfo {
|
|
4
4
|
constructor(authMode) {
|
|
@@ -8,12 +8,12 @@ export class FakeAuthorizationInfo {
|
|
|
8
8
|
getAuthorizationStatus() {
|
|
9
9
|
// gas-fakes always handles auth out-of-band via CLI,
|
|
10
10
|
// so during script execution, we assume auth is not required.
|
|
11
|
-
return
|
|
11
|
+
return AuthorizationStatus.NOT_REQUIRED;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
getAuthorizationUrl() {
|
|
15
|
-
// Return
|
|
16
|
-
return
|
|
15
|
+
// Return empty string since we don't require inline authorization, matching live Apps Script parity
|
|
16
|
+
return "";
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -292,7 +292,30 @@ export class FakeEmbeddedChartBuilder {
|
|
|
292
292
|
return axis;
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
|
|
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
|
+
return notYetImplemented('ChartBuilder.reverseCategories');
|
|
317
|
+
}
|
|
318
|
+
|
|
296
319
|
setBackgroundColor(color) { return this.setOption("backgroundColor", color); }
|
|
297
320
|
|
|
298
321
|
setColors(colors) {
|
|
@@ -306,8 +329,17 @@ export class FakeEmbeddedChartBuilder {
|
|
|
306
329
|
return this;
|
|
307
330
|
}
|
|
308
331
|
|
|
309
|
-
setLegendTextStyle(textStyle) {
|
|
310
|
-
|
|
332
|
+
setLegendTextStyle(textStyle) {
|
|
333
|
+
ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setLegendTextStyle");
|
|
334
|
+
if (!this.__apiChart.spec.basicChart) this.__apiChart.spec.basicChart = {};
|
|
335
|
+
this.__apiChart.spec.basicChart.legendTextStyle = this.__extractTextStyle(textStyle);
|
|
336
|
+
return this;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
setPointStyle(pointStyle) {
|
|
340
|
+
ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setPointStyle");
|
|
341
|
+
return this.setOption("pointStyle", pointStyle ? pointStyle.toString() : "NONE");
|
|
342
|
+
}
|
|
311
343
|
|
|
312
344
|
setRange(min, max) {
|
|
313
345
|
ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setRange");
|
|
@@ -332,8 +364,17 @@ export class FakeEmbeddedChartBuilder {
|
|
|
332
364
|
return this;
|
|
333
365
|
}
|
|
334
366
|
|
|
335
|
-
setTitleTextStyle(textStyle) {
|
|
336
|
-
|
|
367
|
+
setTitleTextStyle(textStyle) {
|
|
368
|
+
ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setTitleTextStyle");
|
|
369
|
+
this.__apiChart.spec.titleTextStyle = this.__extractTextStyle(textStyle);
|
|
370
|
+
return this;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
setXAxisTextStyle(textStyle) {
|
|
374
|
+
ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setXAxisTextStyle");
|
|
375
|
+
this.__getAxis("BOTTOM_AXIS").textStyle = this.__extractTextStyle(textStyle);
|
|
376
|
+
return this;
|
|
377
|
+
}
|
|
337
378
|
|
|
338
379
|
setXAxisTitle(title) {
|
|
339
380
|
ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setXAxisTitle");
|
|
@@ -341,8 +382,17 @@ export class FakeEmbeddedChartBuilder {
|
|
|
341
382
|
return this;
|
|
342
383
|
}
|
|
343
384
|
|
|
344
|
-
setXAxisTitleTextStyle(textStyle) {
|
|
345
|
-
|
|
385
|
+
setXAxisTitleTextStyle(textStyle) {
|
|
386
|
+
ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setXAxisTitleTextStyle");
|
|
387
|
+
this.__getAxis("BOTTOM_AXIS").titleTextStyle = this.__extractTextStyle(textStyle);
|
|
388
|
+
return this;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
setYAxisTextStyle(textStyle) {
|
|
392
|
+
ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setYAxisTextStyle");
|
|
393
|
+
this.__getAxis("LEFT_AXIS").textStyle = this.__extractTextStyle(textStyle);
|
|
394
|
+
return this;
|
|
395
|
+
}
|
|
346
396
|
|
|
347
397
|
setYAxisTitle(title) {
|
|
348
398
|
ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setYAxisTitle");
|
|
@@ -350,8 +400,21 @@ export class FakeEmbeddedChartBuilder {
|
|
|
350
400
|
return this;
|
|
351
401
|
}
|
|
352
402
|
|
|
353
|
-
setYAxisTitleTextStyle(textStyle) {
|
|
354
|
-
|
|
403
|
+
setYAxisTitleTextStyle(textStyle) {
|
|
404
|
+
ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setYAxisTitleTextStyle");
|
|
405
|
+
this.__getAxis("LEFT_AXIS").titleTextStyle = this.__extractTextStyle(textStyle);
|
|
406
|
+
return this;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
useLogScale() {
|
|
410
|
+
ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "useLogScale");
|
|
411
|
+
const chartType = this.__apiChart.spec.basicChart ? this.__apiChart.spec.basicChart.chartType : null;
|
|
412
|
+
const axisPos = chartType === "BAR" ? "BOTTOM_AXIS" : "LEFT_AXIS";
|
|
413
|
+
const axis = this.__getAxis(axisPos);
|
|
414
|
+
axis.logScale = true;
|
|
415
|
+
return this;
|
|
416
|
+
}
|
|
417
|
+
|
|
355
418
|
set3D() { return this.setOption("is3D", true); }
|
|
356
419
|
enablePaging(enable, pageSize) { notYetImplemented('enablePaging'); return this; }
|
|
357
420
|
enableRtlTable(enable) { notYetImplemented('enableRtlTable'); return this; }
|
|
@@ -361,7 +424,12 @@ export class FakeEmbeddedChartBuilder {
|
|
|
361
424
|
setInitialSortingDescending(column) { notYetImplemented('setInitialSortingDescending'); return this; }
|
|
362
425
|
showRowNumberColumn(show) { notYetImplemented('showRowNumberColumn'); return this; }
|
|
363
426
|
useAlternatingRowStyle(use) { notYetImplemented('useAlternatingRowStyle'); return this; }
|
|
364
|
-
|
|
427
|
+
|
|
428
|
+
setXAxisLogScale() {
|
|
429
|
+
ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setXAxisLogScale");
|
|
430
|
+
this.__getAxis("BOTTOM_AXIS").logScale = true;
|
|
431
|
+
return this;
|
|
432
|
+
}
|
|
365
433
|
|
|
366
434
|
setXAxisRange(min, max) {
|
|
367
435
|
ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setXAxisRange");
|
|
@@ -370,7 +438,11 @@ export class FakeEmbeddedChartBuilder {
|
|
|
370
438
|
return this;
|
|
371
439
|
}
|
|
372
440
|
|
|
373
|
-
setYAxisLogScale() {
|
|
441
|
+
setYAxisLogScale() {
|
|
442
|
+
ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setYAxisLogScale");
|
|
443
|
+
this.__getAxis("LEFT_AXIS").logScale = true;
|
|
444
|
+
return this;
|
|
445
|
+
}
|
|
374
446
|
|
|
375
447
|
setYAxisRange(min, max) {
|
|
376
448
|
ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "setYAxisRange");
|
|
@@ -379,7 +451,10 @@ export class FakeEmbeddedChartBuilder {
|
|
|
379
451
|
return this;
|
|
380
452
|
}
|
|
381
453
|
|
|
382
|
-
reverseDirection() {
|
|
454
|
+
reverseDirection() {
|
|
455
|
+
ScriptApp.__behavior.checkMethod("EmbeddedChartBuilder", "reverseDirection");
|
|
456
|
+
return notYetImplemented('ChartBuilder.reverseDirection');
|
|
457
|
+
}
|
|
383
458
|
|
|
384
459
|
toString() {
|
|
385
460
|
const type = this.__apiChart.spec.basicChart?.chartType;
|