Няма описание
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.INVALID_PATH_ERROR = exports.HELP_TEXT = exports.DATABASE_SETTINGS = void 0;
  4. const defaultWriteSizeLimit = {
  5. path: "defaultWriteSizeLimit",
  6. description: `
  7. Set a limit for the size of each write request: small, medium, large or unlimited.
  8. If you choose 'unlimited', any and all write requests will be allowed, potentially
  9. blocking subsequent write requests while the database processes any large write
  10. requests. For example, deleting data at the database's root
  11. can't be reverted and the database will be unavailable until the delete is finished.
  12. To avoid blocking large write requests without running the risk of hanging your
  13. database, you can set this limit to small (target=10s), medium (target=30s), large (target=60s).
  14. Realtime Database estimates the size of each write request and aborts
  15. requests that will take longer than the target time.
  16. `,
  17. parseInput: (input) => {
  18. switch (input) {
  19. case "small":
  20. case "medium":
  21. case "large":
  22. case "unlimited":
  23. return input;
  24. default:
  25. return undefined;
  26. }
  27. },
  28. parseInputErrorMessge: "defaultWriteSizeLimit must be either small, medium, large or unlimited. (tiny is not allowed)",
  29. };
  30. const strictTriggerValidation = {
  31. path: "strictTriggerValidation",
  32. description: `
  33. Strict validation is enabled by default for write operations that trigger
  34. events. Any write operations that trigger more than 1000 Cloud Functions or a
  35. single event greater than 1 MB in size will fail and return an error reporting
  36. the limit that was hit. This might mean that some Cloud Functions aren't
  37. triggered at all if they fail the pre-validation.
  38. If you're performing a larger write operation (for example, deleting your
  39. entire database), you might want to disable this validation, as the errors
  40. themselves might block the operation.
  41. `,
  42. parseInput: (input) => {
  43. switch (input) {
  44. case "true":
  45. return true;
  46. case "false":
  47. return false;
  48. default:
  49. return undefined;
  50. }
  51. },
  52. parseInputErrorMessge: "strictTriggerValidation must be 'true' or 'false'",
  53. };
  54. exports.DATABASE_SETTINGS = new Map();
  55. exports.DATABASE_SETTINGS.set(defaultWriteSizeLimit.path, defaultWriteSizeLimit);
  56. exports.DATABASE_SETTINGS.set(strictTriggerValidation.path, strictTriggerValidation);
  57. exports.HELP_TEXT = "\nAvailable Settings:\n" +
  58. Array.from(exports.DATABASE_SETTINGS.values())
  59. .map((setting) => ` ${setting.path}:${setting.description}`)
  60. .join("");
  61. exports.INVALID_PATH_ERROR = `Path must be one of ${Array.from(exports.DATABASE_SETTINGS.keys()).join(", ")}.`;