@scenid/react-formulator 0.5.3 → 0.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 (64) hide show
  1. package/dist/index.cjs.js +31 -35
  2. package/dist/index.esm.js +31 -35
  3. package/package.json +4 -1
  4. package/.babelrc +0 -30
  5. package/.eslintignore +0 -22
  6. package/.eslintrc +0 -70
  7. package/.firebaserc +0 -5
  8. package/.storybook/main.js +0 -12
  9. package/.storybook/preview.js +0 -9
  10. package/firebase.json +0 -22
  11. package/functions/.eslintignore +0 -1
  12. package/functions/.eslintrc.js +0 -29
  13. package/functions/index.js +0 -32
  14. package/functions/package-lock.json +0 -6810
  15. package/functions/package.json +0 -29
  16. package/rollup.config.js +0 -40
  17. package/src/Components/HiddenData.jsx +0 -24
  18. package/src/Components/SelectOrCreate.jsx +0 -156
  19. package/src/Editable/FormAutocomplete/FormAutocomplete.jsx +0 -155
  20. package/src/Editable/FormAutocomplete/useFetchOptions.js +0 -83
  21. package/src/Editable/FormBoolean.jsx +0 -46
  22. package/src/Editable/FormCatalogType.jsx +0 -29
  23. package/src/Editable/FormField.jsx +0 -231
  24. package/src/Editable/FormNumber.jsx +0 -36
  25. package/src/Editable/FormRepeater.jsx +0 -218
  26. package/src/Editable/FormSelect.jsx +0 -52
  27. package/src/Editable/FormText.jsx +0 -20
  28. package/src/FormGroupHeader.jsx +0 -85
  29. package/src/FormHelpers.js +0 -191
  30. package/src/FormSectionBlock.jsx +0 -71
  31. package/src/FormSectionCard.jsx +0 -62
  32. package/src/FormulatorForm.jsx +0 -539
  33. package/src/FormulatorFormSection.jsx +0 -456
  34. package/src/ReadOnly/FormReadOnlyBoolean.jsx +0 -36
  35. package/src/ReadOnly/FormReadOnlyField.jsx +0 -126
  36. package/src/ReadOnly/FormReadOnlyMarkdown.jsx +0 -20
  37. package/src/ReadOnly/FormReadOnlyNumber.jsx +0 -17
  38. package/src/ReadOnly/FormReadOnlyRepeater.jsx +0 -52
  39. package/src/ReadOnly/FormReadOnlySelect.jsx +0 -18
  40. package/src/ReadOnly/FormReadOnlyText.jsx +0 -45
  41. package/src/helpers.js +0 -13
  42. package/src/index.js +0 -20
  43. package/stories/CustomRenderField.jsx +0 -46
  44. package/stories/Forms.stories.jsx +0 -283
  45. package/stories/Introduction.stories.mdx +0 -206
  46. package/stories/StoryBase.jsx +0 -35
  47. package/stories/assets/code-brackets.svg +0 -1
  48. package/stories/assets/colors.svg +0 -1
  49. package/stories/assets/comments.svg +0 -1
  50. package/stories/assets/direction.svg +0 -1
  51. package/stories/assets/flow.svg +0 -1
  52. package/stories/assets/plugin.svg +0 -1
  53. package/stories/assets/repo.svg +0 -1
  54. package/stories/assets/stackalt.svg +0 -1
  55. package/stories/forms/login.render.schema.json +0 -23
  56. package/stories/forms/login.validation.schema.json +0 -29
  57. package/stories/forms/markdown.render.schema.json +0 -30
  58. package/stories/forms/markdown.validation.schema.json +0 -18
  59. package/stories/forms/register.render.schema.json +0 -32
  60. package/stories/forms/register.validation.schema.json +0 -34
  61. package/stories/forms/rlp.render.schema.json +0 -153
  62. package/stories/forms/rlp.translations.json +0 -883
  63. package/stories/forms/rlp.validation.schema.json +0 -1631
  64. package/stories/forms/types.schemas.js +0 -319
package/dist/index.cjs.js CHANGED
@@ -83543,7 +83543,7 @@ var validate = /*#__PURE__*/function () {
83543
83543
  asyncErrors = oldAsyncErrors;
83544
83544
 
83545
83545
  if (!asyncValidators) {
83546
- _context2.next = 13;
83546
+ _context2.next = 12;
83547
83547
  break;
83548
83548
  }
83549
83549
 
@@ -83558,20 +83558,16 @@ var validate = /*#__PURE__*/function () {
83558
83558
  });
83559
83559
 
83560
83560
  if (!(activeValidators.length > 0)) {
83561
- _context2.next = 13;
83561
+ _context2.next = 12;
83562
83562
  break;
83563
83563
  }
83564
83564
 
83565
83565
  newFieldStates = JSON.parse(JSON.stringify(fieldStates));
83566
- activeValidators.forEach(function (_ref4) {
83567
- var path = _ref4.path;
83568
- newFieldStates[path].validating = true;
83569
- });
83570
83566
  ee.emit('fieldStates', newFieldStates);
83571
- _context2.next = 11;
83572
- return Promise.all(activeValidators.map(function (_ref5) {
83573
- var path = _ref5.path,
83574
- func = _ref5.func;
83567
+ _context2.next = 10;
83568
+ return Promise.all(activeValidators.map(function (_ref4) {
83569
+ var path = _ref4.path,
83570
+ func = _ref4.func;
83575
83571
 
83576
83572
  if (data[path]) {
83577
83573
  return asyncValidatorEnvelope(path, function () {
@@ -83582,13 +83578,13 @@ var validate = /*#__PURE__*/function () {
83582
83578
  return Promise.resolve(true);
83583
83579
  }));
83584
83580
 
83585
- case 11:
83581
+ case 10:
83586
83582
  asyncResults = _context2.sent;
83587
83583
  asyncErrors = asyncResults.filter(function (m) {
83588
83584
  return m !== true;
83589
83585
  });
83590
83586
 
83591
- case 13:
83587
+ case 12:
83592
83588
  mergedErrors = [].concat(_toConsumableArray(errors), _toConsumableArray(asyncErrors));
83593
83589
  mergedResults = _objectSpread({}, results);
83594
83590
  asyncErrors.forEach(function (e) {
@@ -83605,7 +83601,7 @@ var validate = /*#__PURE__*/function () {
83605
83601
  fieldStates: fieldStates
83606
83602
  }));
83607
83603
 
83608
- case 17:
83604
+ case 16:
83609
83605
  case "end":
83610
83606
  return _context2.stop();
83611
83607
  }
@@ -83769,14 +83765,14 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
83769
83765
 
83770
83766
  var newFieldStates = _objectSpread({}, fieldStates);
83771
83767
 
83772
- transientData.forEach(function (_ref8) {
83773
- var name = _ref8.name,
83774
- value = _ref8.value;
83768
+ transientData.forEach(function (_ref7) {
83769
+ var name = _ref7.name,
83770
+ value = _ref7.value;
83775
83771
  var finalValue = value;
83776
83772
  if (schema.properties[name].type === 'boolean') finalValue = oldData[name] !== true;
83777
83773
  var isDirty = initData[name] !== value;
83778
- newAsyncErrors = asyncErrors.filter(function (_ref9) {
83779
- var path = _ref9.path;
83774
+ newAsyncErrors = asyncErrors.filter(function (_ref8) {
83775
+ var path = _ref8.path;
83780
83776
  return path !== name;
83781
83777
  }).concat(newAsyncErrors);
83782
83778
  newFieldStates[name] = _objectSpread(_objectSpread({}, fieldStates[name]), {}, {
@@ -83805,8 +83801,8 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
83805
83801
  fieldStates = _this$state3.fieldStates;
83806
83802
  if (preSubmitValidation || disabled) return;
83807
83803
  var isDirty = initData[name] !== value;
83808
- var newAsyncErrors = asyncErrors.filter(function (_ref10) {
83809
- var path = _ref10.path;
83804
+ var newAsyncErrors = asyncErrors.filter(function (_ref9) {
83805
+ var path = _ref9.path;
83810
83806
  return path !== name;
83811
83807
  });
83812
83808
  validate(this.ee, schema, _objectSpread(_objectSpread({}, oldData), {}, _defineProperty({}, name, value)), newAsyncErrors, _objectSpread(_objectSpread({}, fieldStates), {}, _defineProperty({}, name, _objectSpread(_objectSpread({}, fieldStates[name]), {}, {
@@ -83816,11 +83812,11 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
83816
83812
  }
83817
83813
  }, {
83818
83814
  key: "handleValidation",
83819
- value: function handleValidation(_ref11) {
83820
- var hasErrors = _ref11.hasErrors,
83821
- fieldStates = _ref11.fieldStates,
83822
- errors = _ref11.errors,
83823
- result = _objectWithoutProperties(_ref11, _excluded2);
83815
+ value: function handleValidation(_ref10) {
83816
+ var hasErrors = _ref10.hasErrors,
83817
+ fieldStates = _ref10.fieldStates,
83818
+ errors = _ref10.errors,
83819
+ result = _objectWithoutProperties(_ref10, _excluded2);
83824
83820
 
83825
83821
  var _this$props5 = this.props,
83826
83822
  onSubmit = _this$props5.onSubmit,
@@ -83970,11 +83966,11 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
83970
83966
 
83971
83967
  if (_onReset) _onReset();
83972
83968
  }
83973
- }, renderSchema.title && /*#__PURE__*/React__default["default"].createElement("h5", null, renderSchema.title), renderSchema.description && /*#__PURE__*/React__default["default"].createElement("h5", null, renderSchema.description), renderSchema.groups.map(function (_ref12) {
83974
- var sectionId = _ref12.id,
83975
- label = _ref12.label,
83976
- description = _ref12.description,
83977
- fields = _ref12.fields;
83969
+ }, renderSchema.title && /*#__PURE__*/React__default["default"].createElement("h5", null, renderSchema.title), renderSchema.description && /*#__PURE__*/React__default["default"].createElement("h5", null, renderSchema.description), renderSchema.groups.map(function (_ref11) {
83970
+ var sectionId = _ref11.id,
83971
+ label = _ref11.label,
83972
+ description = _ref11.description,
83973
+ fields = _ref11.fields;
83978
83974
 
83979
83975
  if (readOnly && Array.isArray(obscuredGroups) && obscuredGroups.includes(sectionId)) {
83980
83976
  return /*#__PURE__*/React__default["default"].createElement(HiddenData, {
@@ -84011,11 +84007,11 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
84011
84007
  });
84012
84008
  }), listErrors && hasErrors && /*#__PURE__*/React__default["default"].createElement("div", {
84013
84009
  className: "errors"
84014
- }, errors.map(function (_ref13) {
84015
- var path = _ref13.path,
84016
- message = _ref13.message,
84017
- options = _ref13.options,
84018
- eVal = _ref13.validator;
84010
+ }, errors.map(function (_ref12) {
84011
+ var path = _ref12.path,
84012
+ message = _ref12.message,
84013
+ options = _ref12.options,
84014
+ eVal = _ref12.validator;
84019
84015
  var finalMessage = message;
84020
84016
  if (options && options.human) finalMessage = options.human;else if (errorMessages[eVal]) finalMessage = render(errorMessages[eVal], options);
84021
84017
  return /*#__PURE__*/React__default["default"].createElement("div", {
package/dist/index.esm.js CHANGED
@@ -83475,7 +83475,7 @@ var validate = /*#__PURE__*/function () {
83475
83475
  asyncErrors = oldAsyncErrors;
83476
83476
 
83477
83477
  if (!asyncValidators) {
83478
- _context2.next = 13;
83478
+ _context2.next = 12;
83479
83479
  break;
83480
83480
  }
83481
83481
 
@@ -83490,20 +83490,16 @@ var validate = /*#__PURE__*/function () {
83490
83490
  });
83491
83491
 
83492
83492
  if (!(activeValidators.length > 0)) {
83493
- _context2.next = 13;
83493
+ _context2.next = 12;
83494
83494
  break;
83495
83495
  }
83496
83496
 
83497
83497
  newFieldStates = JSON.parse(JSON.stringify(fieldStates));
83498
- activeValidators.forEach(function (_ref4) {
83499
- var path = _ref4.path;
83500
- newFieldStates[path].validating = true;
83501
- });
83502
83498
  ee.emit('fieldStates', newFieldStates);
83503
- _context2.next = 11;
83504
- return Promise.all(activeValidators.map(function (_ref5) {
83505
- var path = _ref5.path,
83506
- func = _ref5.func;
83499
+ _context2.next = 10;
83500
+ return Promise.all(activeValidators.map(function (_ref4) {
83501
+ var path = _ref4.path,
83502
+ func = _ref4.func;
83507
83503
 
83508
83504
  if (data[path]) {
83509
83505
  return asyncValidatorEnvelope(path, function () {
@@ -83514,13 +83510,13 @@ var validate = /*#__PURE__*/function () {
83514
83510
  return Promise.resolve(true);
83515
83511
  }));
83516
83512
 
83517
- case 11:
83513
+ case 10:
83518
83514
  asyncResults = _context2.sent;
83519
83515
  asyncErrors = asyncResults.filter(function (m) {
83520
83516
  return m !== true;
83521
83517
  });
83522
83518
 
83523
- case 13:
83519
+ case 12:
83524
83520
  mergedErrors = [].concat(_toConsumableArray(errors), _toConsumableArray(asyncErrors));
83525
83521
  mergedResults = _objectSpread({}, results);
83526
83522
  asyncErrors.forEach(function (e) {
@@ -83537,7 +83533,7 @@ var validate = /*#__PURE__*/function () {
83537
83533
  fieldStates: fieldStates
83538
83534
  }));
83539
83535
 
83540
- case 17:
83536
+ case 16:
83541
83537
  case "end":
83542
83538
  return _context2.stop();
83543
83539
  }
@@ -83701,14 +83697,14 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
83701
83697
 
83702
83698
  var newFieldStates = _objectSpread({}, fieldStates);
83703
83699
 
83704
- transientData.forEach(function (_ref8) {
83705
- var name = _ref8.name,
83706
- value = _ref8.value;
83700
+ transientData.forEach(function (_ref7) {
83701
+ var name = _ref7.name,
83702
+ value = _ref7.value;
83707
83703
  var finalValue = value;
83708
83704
  if (schema.properties[name].type === 'boolean') finalValue = oldData[name] !== true;
83709
83705
  var isDirty = initData[name] !== value;
83710
- newAsyncErrors = asyncErrors.filter(function (_ref9) {
83711
- var path = _ref9.path;
83706
+ newAsyncErrors = asyncErrors.filter(function (_ref8) {
83707
+ var path = _ref8.path;
83712
83708
  return path !== name;
83713
83709
  }).concat(newAsyncErrors);
83714
83710
  newFieldStates[name] = _objectSpread(_objectSpread({}, fieldStates[name]), {}, {
@@ -83737,8 +83733,8 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
83737
83733
  fieldStates = _this$state3.fieldStates;
83738
83734
  if (preSubmitValidation || disabled) return;
83739
83735
  var isDirty = initData[name] !== value;
83740
- var newAsyncErrors = asyncErrors.filter(function (_ref10) {
83741
- var path = _ref10.path;
83736
+ var newAsyncErrors = asyncErrors.filter(function (_ref9) {
83737
+ var path = _ref9.path;
83742
83738
  return path !== name;
83743
83739
  });
83744
83740
  validate(this.ee, schema, _objectSpread(_objectSpread({}, oldData), {}, _defineProperty({}, name, value)), newAsyncErrors, _objectSpread(_objectSpread({}, fieldStates), {}, _defineProperty({}, name, _objectSpread(_objectSpread({}, fieldStates[name]), {}, {
@@ -83748,11 +83744,11 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
83748
83744
  }
83749
83745
  }, {
83750
83746
  key: "handleValidation",
83751
- value: function handleValidation(_ref11) {
83752
- var hasErrors = _ref11.hasErrors,
83753
- fieldStates = _ref11.fieldStates,
83754
- errors = _ref11.errors,
83755
- result = _objectWithoutProperties(_ref11, _excluded2);
83747
+ value: function handleValidation(_ref10) {
83748
+ var hasErrors = _ref10.hasErrors,
83749
+ fieldStates = _ref10.fieldStates,
83750
+ errors = _ref10.errors,
83751
+ result = _objectWithoutProperties(_ref10, _excluded2);
83756
83752
 
83757
83753
  var _this$props5 = this.props,
83758
83754
  onSubmit = _this$props5.onSubmit,
@@ -83902,11 +83898,11 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
83902
83898
 
83903
83899
  if (_onReset) _onReset();
83904
83900
  }
83905
- }, renderSchema.title && /*#__PURE__*/React__default.createElement("h5", null, renderSchema.title), renderSchema.description && /*#__PURE__*/React__default.createElement("h5", null, renderSchema.description), renderSchema.groups.map(function (_ref12) {
83906
- var sectionId = _ref12.id,
83907
- label = _ref12.label,
83908
- description = _ref12.description,
83909
- fields = _ref12.fields;
83901
+ }, renderSchema.title && /*#__PURE__*/React__default.createElement("h5", null, renderSchema.title), renderSchema.description && /*#__PURE__*/React__default.createElement("h5", null, renderSchema.description), renderSchema.groups.map(function (_ref11) {
83902
+ var sectionId = _ref11.id,
83903
+ label = _ref11.label,
83904
+ description = _ref11.description,
83905
+ fields = _ref11.fields;
83910
83906
 
83911
83907
  if (readOnly && Array.isArray(obscuredGroups) && obscuredGroups.includes(sectionId)) {
83912
83908
  return /*#__PURE__*/React__default.createElement(HiddenData, {
@@ -83943,11 +83939,11 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
83943
83939
  });
83944
83940
  }), listErrors && hasErrors && /*#__PURE__*/React__default.createElement("div", {
83945
83941
  className: "errors"
83946
- }, errors.map(function (_ref13) {
83947
- var path = _ref13.path,
83948
- message = _ref13.message,
83949
- options = _ref13.options,
83950
- eVal = _ref13.validator;
83942
+ }, errors.map(function (_ref12) {
83943
+ var path = _ref12.path,
83944
+ message = _ref12.message,
83945
+ options = _ref12.options,
83946
+ eVal = _ref12.validator;
83951
83947
  var finalMessage = message;
83952
83948
  if (options && options.human) finalMessage = options.human;else if (errorMessages[eVal]) finalMessage = render(errorMessages[eVal], options);
83953
83949
  return /*#__PURE__*/React__default.createElement("div", {
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@scenid/react-formulator",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "repository": "https://dennykoch@bitbucket.org/scenid/react-formulator.git",
7
7
  "author": "Denny Koch <denny.koch@scenid.com>",
8
8
  "license": "UNLICENSED",
9
+ "files": [
10
+ "dist"
11
+ ],
9
12
  "scripts": {
10
13
  "build": "rollup -c",
11
14
  "watch": "cross-env STORYBOOK_NODE_ENV=development start-storybook -p 6006",
package/.babelrc DELETED
@@ -1,30 +0,0 @@
1
- {
2
- "presets": [
3
- "@babel/env",
4
- "@babel/react"
5
- ],
6
- "plugins": [
7
- [
8
- "@babel/transform-runtime",
9
- { "regenerator": true }
10
- ],
11
- [
12
- "babel-plugin-import",
13
- {
14
- "libraryName": "@material-ui/core",
15
- "libraryDirectory": "esm",
16
- "camel2DashComponentName": false
17
- },
18
- "core"
19
- ],
20
- [
21
- "babel-plugin-import",
22
- {
23
- "libraryName": "@material-ui/icons",
24
- "libraryDirectory": "esm",
25
- "camel2DashComponentName": false
26
- },
27
- "icons"
28
- ]
29
- ]
30
- }
package/.eslintignore DELETED
@@ -1,22 +0,0 @@
1
- # Logs
2
- logs
3
- *.log
4
-
5
- coverage
6
- .eslintcache
7
- .stylelintcache
8
- node_modules
9
- build
10
- dist
11
- data
12
- dump
13
- .nyc-output
14
- snapshot
15
- .DS_Store
16
- config.json
17
- test-reports
18
-
19
- webpack.*
20
-
21
- !.storybook
22
- functions
package/.eslintrc DELETED
@@ -1,70 +0,0 @@
1
- {
2
- "parser": "babel-eslint",
3
- "parserOptions": {
4
- "ecmaVersion": 6,
5
- "sourceType": "module",
6
- "allowImportExportEverywhere": true
7
- },
8
- "extends": ["airbnb"],
9
- "env": {
10
- "browser": true,
11
- "node": true
12
- },
13
- "rules": {
14
- "max-len": ["warn", { "code": 200 }],
15
- "no-plusplus": ["warn", { "allowForLoopAfterthoughts": true }],
16
- "object-curly-newline": "off",
17
- "one-var-declaration-per-line": "off",
18
- "prefer-destructuring": [
19
- "warn",
20
- {
21
- "array": false,
22
- "object": true
23
- },
24
- {
25
- "enforceForRenamedProperties": false
26
- }
27
- ],
28
- "one-var": "off",
29
- "func-names": ["warn", "never"],
30
- "arrow-parens": ["off"],
31
- "linebreak-style": ["off"],
32
- "consistent-return": "off",
33
- "comma-dangle": ["error", "never"],
34
- "generator-star-spacing": "off",
35
- "import/no-unresolved": "warn",
36
- "import/no-extraneous-dependencies": "off",
37
- "jsx-a11y/anchor-is-valid": "off",
38
- "jsx-a11y/click-events-have-key-events": "off",
39
- "jsx-a11y/no-static-element-interactions": "off",
40
- "no-console": "off",
41
- "no-use-before-define": "off",
42
- "no-multi-assign": "off",
43
- "promise/param-names": "warn",
44
- "promise/always-return": "warn",
45
- "promise/catch-or-return": "warn",
46
- "react/jsx-wrap-multilines": "off",
47
- "operator-linebreak": "off",
48
- "promise/no-native": "off",
49
- "react/sort-comp": ["warn", {
50
- "order": ["type-annotations", "static-methods", "lifecycle", "everything-else", "render"]
51
- }],
52
- "react/jsx-no-bind": "off",
53
- "react/forbid-prop-types": "off",
54
- "react/require-default-props": "off",
55
- "react/jsx-filename-extension": [
56
- "warn",
57
- { "extensions": [".jsx"] }
58
- ],
59
- "semi": [
60
- 2,
61
- "never"
62
- ]
63
- },
64
- "plugins": [
65
- "import",
66
- "promise",
67
- "compat",
68
- "react"
69
- ]
70
- }
package/.firebaserc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "projects": {
3
- "default": "scenid-cloud-dev"
4
- }
5
- }
@@ -1,12 +0,0 @@
1
- module.exports = {
2
- "stories": [
3
- "../stories/**/*.stories.mdx",
4
- "../stories/**/*.stories.@(js|jsx|ts|tsx)"
5
- ],
6
- "addons": [
7
- "@storybook/addon-links",
8
- "@storybook/addon-essentials",
9
- "@storybook/addon-interactions"
10
- ],
11
- "framework": "@storybook/react"
12
- }
@@ -1,9 +0,0 @@
1
- export const parameters = {
2
- actions: { argTypesRegex: "^on[A-Z].*" },
3
- controls: {
4
- matchers: {
5
- color: /(background|color)$/i,
6
- date: /Date$/,
7
- },
8
- },
9
- }
package/firebase.json DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "hosting": {
3
- "site": "react-formulator",
4
- "public": "storybook-static",
5
- "ignore": [
6
- "firebase.json",
7
- "**/.*",
8
- "**/node_modules/**"
9
- ],
10
- "rewrites": [
11
- {
12
- "source": "**",
13
- "destination": "/index.html"
14
- }
15
- ]
16
- },
17
- "functions": {
18
- "predeploy": [
19
- "npm --prefix \"$RESOURCE_DIR\" run lint"
20
- ]
21
- }
22
- }
@@ -1 +0,0 @@
1
- .eslintrc.js
@@ -1,29 +0,0 @@
1
- module.exports = {
2
- "root": true,
3
- "parser": "babel-eslint",
4
- "parserOptions": {
5
- "ecmaVersion": 6,
6
- "sourceType": "module",
7
- "allowImportExportEverywhere": true
8
- },
9
- "extends": [
10
- "standard"
11
- ],
12
- "env": {
13
- "node": true,
14
- "mocha": true
15
- },
16
- "rules": {
17
- "operator-linebreak": ["error", "before"],
18
- "space-before-function-paren": ["error", {
19
- "anonymous": "always",
20
- "named": "never",
21
- "asyncArrow": "always"
22
- }]
23
- },
24
- "plugins": [
25
- "import",
26
- "promise",
27
- "compat"
28
- ]
29
- }
@@ -1,32 +0,0 @@
1
- const functions = require('firebase-functions')
2
-
3
- const express = require('express')
4
- const cors = require('cors')
5
-
6
- const app = express()
7
-
8
- // Automatically allow cross-origin requests
9
- app.use(cors({ origin: true }))
10
-
11
- app.get('/cats', (req, res) => {
12
- const catalog = [
13
- { entry: 'Abyssinian' },
14
- { entry: 'Bengal' },
15
- { entry: 'Birman' },
16
- { entry: 'Burmese' },
17
- { entry: 'Chartreux' },
18
- { entry: 'Egyptian Mau' },
19
- { entry: 'German Rex' },
20
- { entry: 'Khao Manee' },
21
- { entry: 'Korean Bobtail' },
22
- { entry: 'Maine Coon' },
23
- { entry: 'Nebelung' },
24
- { entry: 'Ocicat' },
25
- { entry: 'Oriental Shorthair' },
26
- { entry: 'Siamese' }
27
- ].map(e => ({ ...e, count: Math.floor(Math.random() * 100) }))
28
-
29
- res.json(catalog)
30
- })
31
-
32
- exports.catalog = functions.https.onRequest(app)