@homebound/form-state 2.33.0 → 3.0.0

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 (57) hide show
  1. package/dist/index.d.ts +437 -9
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +1109 -14
  4. package/dist/index.js.map +1 -0
  5. package/package.json +32 -35
  6. package/dist/FormStateApp.d.ts +0 -5
  7. package/dist/FormStateApp.js +0 -54
  8. package/dist/FormStateApp.test.d.ts +0 -1
  9. package/dist/FormStateApp.test.js +0 -26
  10. package/dist/config.d.ts +0 -78
  11. package/dist/config.js +0 -2
  12. package/dist/configBuilders.d.ts +0 -67
  13. package/dist/configBuilders.js +0 -115
  14. package/dist/configBuilders.test.d.ts +0 -1
  15. package/dist/configBuilders.test.js +0 -65
  16. package/dist/fields/deepEquals.d.ts +0 -7
  17. package/dist/fields/deepEquals.js +0 -53
  18. package/dist/fields/fragmentField.d.ts +0 -4
  19. package/dist/fields/fragmentField.js +0 -58
  20. package/dist/fields/listField.d.ts +0 -11
  21. package/dist/fields/listField.js +0 -355
  22. package/dist/fields/objectField.d.ts +0 -63
  23. package/dist/fields/objectField.js +0 -277
  24. package/dist/fields/valueField.d.ts +0 -81
  25. package/dist/fields/valueField.js +0 -244
  26. package/dist/formState.stories.d.ts +0 -4
  27. package/dist/formState.stories.js +0 -12
  28. package/dist/formState.test.d.ts +0 -11
  29. package/dist/formState.test.js +0 -2109
  30. package/dist/formStateDomain.d.ts +0 -47
  31. package/dist/formStateDomain.js +0 -28
  32. package/dist/mobx-behavior.test.d.ts +0 -1
  33. package/dist/mobx-behavior.test.js +0 -51
  34. package/dist/proxies.d.ts +0 -5
  35. package/dist/proxies.js +0 -20
  36. package/dist/rules.d.ts +0 -10
  37. package/dist/rules.js +0 -11
  38. package/dist/setupTests.d.ts +0 -1
  39. package/dist/setupTests.js +0 -15
  40. package/dist/stackoverlfow.d.ts +0 -17
  41. package/dist/stackoverlfow.js +0 -17
  42. package/dist/temporal.d.ts +0 -6
  43. package/dist/temporal.js +0 -34
  44. package/dist/temporal.test.d.ts +0 -1
  45. package/dist/temporal.test.js +0 -97
  46. package/dist/useFormState.d.ts +0 -82
  47. package/dist/useFormState.js +0 -158
  48. package/dist/useFormState.test.d.ts +0 -1
  49. package/dist/useFormState.test.js +0 -787
  50. package/dist/useFormStates.d.ts +0 -68
  51. package/dist/useFormStates.js +0 -101
  52. package/dist/useFormStates.test.d.ts +0 -1
  53. package/dist/useFormStates.test.js +0 -223
  54. package/dist/utils.d.ts +0 -52
  55. package/dist/utils.js +0 -198
  56. package/dist/utils.test.d.ts +0 -1
  57. package/dist/utils.test.js +0 -102
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const mobx_1 = require("mobx");
4
- const rules_1 = require("./rules");
5
- const utils_1 = require("./utils");
6
- describe("utils", () => {
7
- describe("pickFields", () => {
8
- it("can pick a value field", () => {
9
- const a = (0, utils_1.pickFields)(
10
- //
11
- { firstName: { type: "value" } }, { firstName: "a", b: "ignored" });
12
- expect(a).toMatchInlineSnapshot(`
13
- {
14
- "firstName": "a",
15
- }
16
- `);
17
- });
18
- it("can pick an unset object fields", () => {
19
- const a = (0, utils_1.pickFields)(authorWithAddressConfig, { firstName: "a", b: "ignored" });
20
- expect(a).toMatchInlineSnapshot(`
21
- {
22
- "address": undefined,
23
- "firstName": "a",
24
- "id": undefined,
25
- "lastName": undefined,
26
- }
27
- `);
28
- });
29
- it("can pick a set object field", () => {
30
- const a = (0, utils_1.pickFields)(authorWithAddressConfig, { firstName: "a", b: "ignored", address: {} });
31
- expect(a).toMatchInlineSnapshot(`
32
- {
33
- "address": {
34
- "city": undefined,
35
- "street": undefined,
36
- },
37
- "firstName": "a",
38
- "id": undefined,
39
- "lastName": undefined,
40
- }
41
- `);
42
- });
43
- it("can pick an unset list field", () => {
44
- const a = (0, utils_1.pickFields)(authorWithBooksConfig, { firstName: "a", b: "ignored" });
45
- expect(a).toMatchInlineSnapshot(`
46
- {
47
- "books": undefined,
48
- "firstName": "a",
49
- "id": undefined,
50
- "lastName": undefined,
51
- }
52
- `);
53
- });
54
- it("can pick a set list field", () => {
55
- const a = (0, utils_1.pickFields)(authorWithBooksConfig, { firstName: "a", b: "ignored", books: [{}] });
56
- expect(a).toMatchInlineSnapshot(`
57
- {
58
- "books": [
59
- {
60
- "classification": undefined,
61
- "id": undefined,
62
- "title": undefined,
63
- },
64
- ],
65
- "firstName": "a",
66
- "id": undefined,
67
- "lastName": undefined,
68
- }
69
- `);
70
- });
71
- it("can pick a set observable list field", () => {
72
- const books = (0, mobx_1.observable)([]);
73
- const a = (0, utils_1.pickFields)(authorWithBooksConfig, { firstName: "a", b: "ignored", books });
74
- expect((0, mobx_1.isObservable)(a.books)).toEqual(true);
75
- });
76
- });
77
- });
78
- const authorWithAddressConfig = {
79
- id: { type: "value" },
80
- firstName: { type: "value" },
81
- lastName: { type: "value" },
82
- address: {
83
- type: "object",
84
- config: {
85
- street: { type: "value", rules: [rules_1.required] },
86
- city: { type: "value" },
87
- },
88
- },
89
- };
90
- const authorWithBooksConfig = {
91
- id: { type: "value" },
92
- firstName: { type: "value" },
93
- lastName: { type: "value" },
94
- books: {
95
- type: "list",
96
- config: {
97
- id: { type: "value" },
98
- title: { type: "value", rules: [rules_1.required] },
99
- classification: { type: "value" },
100
- },
101
- },
102
- };