@mcpher/gas-fakes 1.2.26 → 1.2.28

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 (51) hide show
  1. package/package.json +1 -1
  2. package/src/cli/setup.js +35 -6
  3. package/src/cli/utils.js +8 -7
  4. package/src/index.js +1 -0
  5. package/src/services/advcalendar/clapis.js +14 -0
  6. package/src/services/advcalendar/fakeadvcalendarcalendarlist.js +30 -0
  7. package/src/services/advcalendar/fakeadvcalendarcalendars.js +25 -0
  8. package/src/services/advcalendar/fakeadvcalendarevents.js +51 -1
  9. package/src/services/calendarapp/app.js +11 -0
  10. package/src/services/calendarapp/fakecalendar.js +328 -0
  11. package/src/services/calendarapp/fakecalendarapp.js +147 -0
  12. package/src/services/calendarapp/fakecalendarevent.js +44 -0
  13. package/src/services/calendarapp/fakecalendareventseries.js +36 -0
  14. package/src/services/calendarapp/fakeeventrecurrence.js +19 -0
  15. package/src/services/enums/calendarenums.js +85 -0
  16. package/src/services/enums/slidesenums.js +1 -1
  17. package/src/services/formapp/fakechoiceitem.js +1 -1
  18. package/src/services/formapp/fakeform.js +4 -3
  19. package/src/services/formapp/fakeformitem.js +1 -2
  20. package/src/services/formapp/fakeformresponse.js +3 -2
  21. package/src/services/formapp/fakelistitem.js +3 -2
  22. package/src/services/scriptapp/behavior.js +56 -1
  23. package/src/services/slidesapp/fakeaffinetransform.js +55 -0
  24. package/src/services/slidesapp/fakeaffinetransformbuilder.js +64 -0
  25. package/src/services/slidesapp/fakeautofit.js +49 -0
  26. package/src/services/slidesapp/fakeautotext.js +29 -0
  27. package/src/services/slidesapp/fakeconnectionsite.js +24 -0
  28. package/src/services/slidesapp/fakelayout.js +38 -0
  29. package/src/services/slidesapp/fakeline.js +195 -0
  30. package/src/services/slidesapp/fakelinefill.js +58 -0
  31. package/src/services/slidesapp/fakelink.js +31 -0
  32. package/src/services/slidesapp/fakemaster.js +28 -0
  33. package/src/services/slidesapp/fakenotespage.js +19 -0
  34. package/src/services/slidesapp/fakepagebackground.js +17 -0
  35. package/src/services/slidesapp/fakepageelement.js +395 -0
  36. package/src/services/slidesapp/fakeparagraph.js +46 -0
  37. package/src/services/slidesapp/fakepoint.js +24 -0
  38. package/src/services/slidesapp/fakepresentation.js +61 -3
  39. package/src/services/slidesapp/fakeshape.js +49 -0
  40. package/src/services/slidesapp/fakeslide.js +232 -0
  41. package/src/services/slidesapp/fakeslidesapp.js +5 -0
  42. package/src/services/slidesapp/faketextrange.js +253 -0
  43. package/src/services/slidesapp/pageelementfactory.js +19 -0
  44. package/src/services/stores/gasflex.js +1 -1
  45. package/src/services/urlfetchapp/app.js +17 -1
  46. package/src/support/sxcalendar.js +61 -0
  47. package/src/support/sxfetch.js +39 -13
  48. package/src/support/sxforms.js +3 -1
  49. package/src/support/syncit.js +16 -2
  50. package/src/support/utils.js +2 -0
  51. package/src/support/workersync/sxfunctions.js +1 -0
@@ -18,7 +18,7 @@ export const sxForms = async (Auth, { prop, subProp, method, params, options = {
18
18
 
19
19
  const maxRetries = 7;
20
20
  let delay = 1777;
21
- //syncLog (`in sxforms ${prop} ${method} ${JSON.stringify(params)}}`)
21
+ // syncLog(`Forms API Call: ${prop}${subProp ? '.' + subProp : ''}.${method}, Params: ${JSON.stringify(params)}`);
22
22
  for (let i = 0; i < maxRetries; i++) {
23
23
  let response;
24
24
  let error;
@@ -30,9 +30,11 @@ export const sxForms = async (Auth, { prop, subProp, method, params, options = {
30
30
  callish = callish[subProp];
31
31
  }
32
32
  response = await callish[method](params, options);
33
+ //syncLog(`Forms API Response: ${prop}${subProp ? '.' + subProp : ''}.${method}, Status: ${response?.status}, Data: ${JSON.stringify(response?.data)}`);
33
34
  } catch (err) {
34
35
  error = err;
35
36
  response = err.response;
37
+ syncError(`Forms API Error Response: ${prop}${subProp ? '.' + subProp : ''}.${method}, Status: ${response?.status}, Error: ${JSON.stringify(error)}`);
36
38
  }
37
39
 
38
40
  const isRetryable = [429, 500, 503].includes(response?.status) || error?.code == 429;
@@ -17,6 +17,7 @@ import { gmailCacher } from "./gmailcacher.js";
17
17
  import { formsCacher } from "./formscacher.js";
18
18
  import { slidesCacher } from "./slidescacher.js";
19
19
  import { sheetsCacher } from "./sheetscacher.js";
20
+ import { calendarCacher } from "./calendarcacher.js";
20
21
  import is from "@sindresorhus/is";
21
22
  import { callSync } from "./workersync/synchronizer.js";
22
23
 
@@ -151,7 +152,7 @@ const fxGeneric = ({
151
152
  if (method === "get") {
152
153
  return register(resourceId, cacher, result, false, otherParams);
153
154
  }
154
-
155
+
155
156
  else if (resourceId) {
156
157
  cacher.clear(resourceId);
157
158
  }
@@ -341,7 +342,7 @@ const fxDriveMedia = ({ id }) => {
341
342
  * @param {object} p.params the params to add to the request
342
343
  * @return {DriveResponse} from the drive api
343
344
  */
344
- const fxDriveExport = ({ id, mimeType , options ={alt: 'media'}}) => {
345
+ const fxDriveExport = ({ id, mimeType, options = { alt: 'media' } }) => {
345
346
  // see issue https://issuetracker.google.com/issues/468534237
346
347
  // live apps script failes without this alt option
347
348
  return callSync("sxDriveExport", {
@@ -362,6 +363,10 @@ const fxFetch = (url, options, responseFields) => {
362
363
  return callSync("sxFetch", url, options, responseFields);
363
364
  };
364
365
 
366
+ const fxFetchAll = (requests, responseFields) => {
367
+ return callSync("sxFetchAll", requests, responseFields);
368
+ };
369
+
365
370
  const fxSheets = (args) =>
366
371
  fxGeneric({
367
372
  ...args,
@@ -397,11 +402,19 @@ const fxGmail = (args) =>
397
402
  cacher: gmailCacher,
398
403
  idField: "id",
399
404
  });
405
+ const fxCalendar = (args) =>
406
+ fxGeneric({
407
+ ...args,
408
+ serviceName: "Calendar",
409
+ cacher: calendarCacher,
410
+ idField: "calendarId",
411
+ });
400
412
 
401
413
  // const fxGetImagesFromXlsx = (args) => callSync("sxGetImagesFromXlsx", args);
402
414
 
403
415
  export const Syncit = {
404
416
  fxFetch,
417
+ fxFetchAll,
405
418
  fxDrive,
406
419
  fxDriveMedia,
407
420
  fxDriveGet,
@@ -416,5 +429,6 @@ export const Syncit = {
416
429
  fxDocs,
417
430
  fxForms,
418
431
  fxGmail,
432
+ fxCalendar,
419
433
  fxDriveExport
420
434
  }
@@ -466,4 +466,6 @@ export const Utils = {
466
466
  deepEqual,
467
467
  colorNameToHex,
468
468
  normalizeColorStringToHex,
469
+ toHex: (n) => is.number(n) ? n.toString(16).padStart(8, '0') : n,
470
+ fromHex: (n) => is.string(n) ? parseInt(n, 16) : n,
469
471
  }
@@ -8,6 +8,7 @@ export * from "../sxstore.js";
8
8
  export * from "../sxzip.js";
9
9
  export * from "../sxauth.js";
10
10
  export * from "../sxgmail.js";
11
+ export * from "../sxcalendar.js";
11
12
  export * from "../sxxlsx.js";
12
13
 
13
14