@axi-engine/fields 0.3.4 → 0.3.6

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 (157) hide show
  1. package/dist/index.d.ts +997 -18
  2. package/dist/index.js +1228 -18
  3. package/package.json +3 -3
  4. package/dist/core-field-tree-factory.d.ts +0 -13
  5. package/dist/core-field-tree-factory.d.ts.map +0 -1
  6. package/dist/core-field-tree-factory.js +0 -14
  7. package/dist/core-field-tree-factory.js.map +0 -1
  8. package/dist/core-field-tree.d.ts +0 -5
  9. package/dist/core-field-tree.d.ts.map +0 -1
  10. package/dist/core-field-tree.js +0 -4
  11. package/dist/core-field-tree.js.map +0 -1
  12. package/dist/core-fields-factory.d.ts +0 -10
  13. package/dist/core-fields-factory.d.ts.map +0 -1
  14. package/dist/core-fields-factory.js +0 -14
  15. package/dist/core-fields-factory.js.map +0 -1
  16. package/dist/core-fields.d.ts +0 -47
  17. package/dist/core-fields.d.ts.map +0 -1
  18. package/dist/core-fields.js +0 -8
  19. package/dist/core-fields.js.map +0 -1
  20. package/dist/data-store-field-resolver.d.ts +0 -26
  21. package/dist/data-store-field-resolver.d.ts.map +0 -1
  22. package/dist/data-store-field-resolver.js +0 -21
  23. package/dist/data-store-field-resolver.js.map +0 -1
  24. package/dist/data-store.d.ts +0 -38
  25. package/dist/data-store.d.ts.map +0 -1
  26. package/dist/data-store.js +0 -141
  27. package/dist/data-store.js.map +0 -1
  28. package/dist/field-definitions/core-boolean-field.d.ts +0 -11
  29. package/dist/field-definitions/core-boolean-field.d.ts.map +0 -1
  30. package/dist/field-definitions/core-boolean-field.js +0 -13
  31. package/dist/field-definitions/core-boolean-field.js.map +0 -1
  32. package/dist/field-definitions/core-field.d.ts +0 -51
  33. package/dist/field-definitions/core-field.d.ts.map +0 -1
  34. package/dist/field-definitions/core-field.js +0 -74
  35. package/dist/field-definitions/core-field.js.map +0 -1
  36. package/dist/field-definitions/core-numeric-field.d.ts +0 -18
  37. package/dist/field-definitions/core-numeric-field.d.ts.map +0 -1
  38. package/dist/field-definitions/core-numeric-field.js +0 -45
  39. package/dist/field-definitions/core-numeric-field.js.map +0 -1
  40. package/dist/field-definitions/core-string-field.d.ts +0 -15
  41. package/dist/field-definitions/core-string-field.d.ts.map +0 -1
  42. package/dist/field-definitions/core-string-field.js +0 -27
  43. package/dist/field-definitions/core-string-field.js.map +0 -1
  44. package/dist/field-definitions/index.d.ts +0 -5
  45. package/dist/field-definitions/index.d.ts.map +0 -1
  46. package/dist/field-definitions/index.js +0 -5
  47. package/dist/field-definitions/index.js.map +0 -1
  48. package/dist/field-registry.d.ts +0 -5
  49. package/dist/field-registry.d.ts.map +0 -1
  50. package/dist/field-registry.js +0 -4
  51. package/dist/field-registry.js.map +0 -1
  52. package/dist/field-tree-factory.d.ts +0 -12
  53. package/dist/field-tree-factory.d.ts.map +0 -1
  54. package/dist/field-tree-factory.js +0 -2
  55. package/dist/field-tree-factory.js.map +0 -1
  56. package/dist/field-tree.d.ts +0 -171
  57. package/dist/field-tree.d.ts.map +0 -1
  58. package/dist/field-tree.js +0 -248
  59. package/dist/field-tree.js.map +0 -1
  60. package/dist/field.d.ts +0 -34
  61. package/dist/field.d.ts.map +0 -1
  62. package/dist/field.js +0 -2
  63. package/dist/field.js.map +0 -1
  64. package/dist/fields-factory.d.ts +0 -5
  65. package/dist/fields-factory.d.ts.map +0 -1
  66. package/dist/fields-factory.js +0 -2
  67. package/dist/fields-factory.js.map +0 -1
  68. package/dist/fields.d.ts +0 -101
  69. package/dist/fields.d.ts.map +0 -1
  70. package/dist/fields.js +0 -143
  71. package/dist/fields.js.map +0 -1
  72. package/dist/index.d.ts.map +0 -1
  73. package/dist/index.js.map +0 -1
  74. package/dist/mixins/mixin-factory.d.ts +0 -29
  75. package/dist/mixins/mixin-factory.d.ts.map +0 -1
  76. package/dist/mixins/mixin-factory.js +0 -32
  77. package/dist/mixins/mixin-factory.js.map +0 -1
  78. package/dist/mixins/with-boolean-fields.mixin.d.ts +0 -9
  79. package/dist/mixins/with-boolean-fields.mixin.d.ts.map +0 -1
  80. package/dist/mixins/with-boolean-fields.mixin.js +0 -4
  81. package/dist/mixins/with-boolean-fields.mixin.js.map +0 -1
  82. package/dist/mixins/with-default-generic-fields.mixin.d.ts +0 -31
  83. package/dist/mixins/with-default-generic-fields.mixin.d.ts.map +0 -1
  84. package/dist/mixins/with-default-generic-fields.mixin.js +0 -15
  85. package/dist/mixins/with-default-generic-fields.mixin.js.map +0 -1
  86. package/dist/mixins/with-numeric-fields.mixin.d.ts +0 -9
  87. package/dist/mixins/with-numeric-fields.mixin.d.ts.map +0 -1
  88. package/dist/mixins/with-numeric-fields.mixin.js +0 -4
  89. package/dist/mixins/with-numeric-fields.mixin.js.map +0 -1
  90. package/dist/mixins/with-string-fields.mixin.d.ts +0 -9
  91. package/dist/mixins/with-string-fields.mixin.d.ts.map +0 -1
  92. package/dist/mixins/with-string-fields.mixin.js +0 -4
  93. package/dist/mixins/with-string-fields.mixin.js.map +0 -1
  94. package/dist/policies/clamp-max-policy.d.ts +0 -11
  95. package/dist/policies/clamp-max-policy.d.ts.map +0 -1
  96. package/dist/policies/clamp-max-policy.js +0 -18
  97. package/dist/policies/clamp-max-policy.js.map +0 -1
  98. package/dist/policies/clamp-min-policy.d.ts +0 -11
  99. package/dist/policies/clamp-min-policy.d.ts.map +0 -1
  100. package/dist/policies/clamp-min-policy.js +0 -18
  101. package/dist/policies/clamp-min-policy.js.map +0 -1
  102. package/dist/policies/clamp-policy.d.ts +0 -12
  103. package/dist/policies/clamp-policy.d.ts.map +0 -1
  104. package/dist/policies/clamp-policy.js +0 -21
  105. package/dist/policies/clamp-policy.js.map +0 -1
  106. package/dist/policies/index.d.ts +0 -6
  107. package/dist/policies/index.d.ts.map +0 -1
  108. package/dist/policies/index.js +0 -6
  109. package/dist/policies/index.js.map +0 -1
  110. package/dist/policies/policies.d.ts +0 -38
  111. package/dist/policies/policies.d.ts.map +0 -1
  112. package/dist/policies/policies.js +0 -62
  113. package/dist/policies/policies.js.map +0 -1
  114. package/dist/policies/policy.d.ts +0 -6
  115. package/dist/policies/policy.d.ts.map +0 -1
  116. package/dist/policies/policy.js +0 -2
  117. package/dist/policies/policy.js.map +0 -1
  118. package/dist/serializer/field-serializer.d.ts +0 -52
  119. package/dist/serializer/field-serializer.d.ts.map +0 -1
  120. package/dist/serializer/field-serializer.js +0 -66
  121. package/dist/serializer/field-serializer.js.map +0 -1
  122. package/dist/serializer/field-tree-serializer.d.ts +0 -50
  123. package/dist/serializer/field-tree-serializer.d.ts.map +0 -1
  124. package/dist/serializer/field-tree-serializer.js +0 -68
  125. package/dist/serializer/field-tree-serializer.js.map +0 -1
  126. package/dist/serializer/fields-serializer.d.ts +0 -49
  127. package/dist/serializer/fields-serializer.d.ts.map +0 -1
  128. package/dist/serializer/fields-serializer.js +0 -57
  129. package/dist/serializer/fields-serializer.js.map +0 -1
  130. package/dist/serializer/index.d.ts +0 -8
  131. package/dist/serializer/index.d.ts.map +0 -1
  132. package/dist/serializer/index.js +0 -8
  133. package/dist/serializer/index.js.map +0 -1
  134. package/dist/serializer/policies/clamp-max-policy-serializer-handler.d.ts +0 -13
  135. package/dist/serializer/policies/clamp-max-policy-serializer-handler.d.ts.map +0 -1
  136. package/dist/serializer/policies/clamp-max-policy-serializer-handler.js +0 -10
  137. package/dist/serializer/policies/clamp-max-policy-serializer-handler.js.map +0 -1
  138. package/dist/serializer/policies/clamp-min-policy-serializer-handler.d.ts +0 -13
  139. package/dist/serializer/policies/clamp-min-policy-serializer-handler.d.ts.map +0 -1
  140. package/dist/serializer/policies/clamp-min-policy-serializer-handler.js +0 -10
  141. package/dist/serializer/policies/clamp-min-policy-serializer-handler.js.map +0 -1
  142. package/dist/serializer/policies/clamp-policy-serializer-handler.d.ts +0 -16
  143. package/dist/serializer/policies/clamp-policy-serializer-handler.d.ts.map +0 -1
  144. package/dist/serializer/policies/clamp-policy-serializer-handler.js +0 -10
  145. package/dist/serializer/policies/clamp-policy-serializer-handler.js.map +0 -1
  146. package/dist/serializer/policy-serializer.d.ts +0 -41
  147. package/dist/serializer/policy-serializer.d.ts.map +0 -1
  148. package/dist/serializer/policy-serializer.js +0 -43
  149. package/dist/serializer/policy-serializer.js.map +0 -1
  150. package/dist/setup.d.ts +0 -41
  151. package/dist/setup.d.ts.map +0 -1
  152. package/dist/setup.js +0 -57
  153. package/dist/setup.js.map +0 -1
  154. package/dist/store.d.ts +0 -137
  155. package/dist/store.d.ts.map +0 -1
  156. package/dist/store.js +0 -2
  157. package/dist/store.js.map +0 -1
@@ -1,6 +0,0 @@
1
- export * from './policy';
2
- export * from './clamp-policy';
3
- export * from './clamp-max-policy';
4
- export * from './clamp-min-policy';
5
- export * from './policies';
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/policies/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AAEzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,YAAY,CAAC"}
@@ -1,38 +0,0 @@
1
- import { Policy } from './policy';
2
- export declare class Policies<T> {
3
- private readonly policies;
4
- get items(): Map<string, Policy<T>>;
5
- /**
6
- * Retrieves a specific policy instance by its ID.
7
- * Useful for accessing a policy's internal state or methods.
8
- * @template P The expected type of the policy.
9
- * @param id The unique ID of the policy to retrieve.
10
- * @returns The policy instance, or `undefined` if not found.
11
- */
12
- get<P extends Policy<T>>(id: string): P | undefined;
13
- /**
14
- * Adds a new policy to the field or replaces an existing one with the same ID.
15
- * The new policy will be applied on the next `set()` operation.
16
- * If a policy with the same ID already exists, its `destroy` method will be called before it is replaced.
17
- * @param policy The policy instance to add.
18
- */
19
- add(policy: Policy<T>): this;
20
- /**
21
- * Removes a policy from the field by its ID and call `destroy` method.
22
- * @param policyId The unique ID of the policy to remove.
23
- * @returns `true` if the policy was found and removed, otherwise `false`.
24
- */
25
- remove(policyId: string): boolean;
26
- isEmpty(): boolean;
27
- /**
28
- * Removes all policies from the field.
29
- * After this, `set()` will no longer apply any transformations to the value until new policies are added.
30
- */
31
- clear(): void;
32
- /**
33
- * Forces the current value to be re-processed by all policies.
34
- * Useful if a policy's logic has changed and you need to re-evaluate the current state.
35
- */
36
- apply(val: T): T;
37
- }
38
- //# sourceMappingURL=policies.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../../src/policies/policies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,qBAAa,QAAQ,CAAC,CAAC;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgC;IAEzD,IAAI,KAAK,2BAER;IAED;;;;;;OAMG;IACH,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAInD;;;;;OAKG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAQrB;;;;OAIG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IASjC,OAAO;IAIP;;;OAGG;IACH,KAAK,IAAI,IAAI;IAKb;;;OAGG;IACH,KAAK,CAAC,GAAG,EAAE,CAAC;CAKb"}
@@ -1,62 +0,0 @@
1
- export class Policies {
2
- policies = new Map();
3
- get items() {
4
- return this.policies;
5
- }
6
- /**
7
- * Retrieves a specific policy instance by its ID.
8
- * Useful for accessing a policy's internal state or methods.
9
- * @template P The expected type of the policy.
10
- * @param id The unique ID of the policy to retrieve.
11
- * @returns The policy instance, or `undefined` if not found.
12
- */
13
- get(id) {
14
- return this.policies.get(id);
15
- }
16
- /**
17
- * Adds a new policy to the field or replaces an existing one with the same ID.
18
- * The new policy will be applied on the next `set()` operation.
19
- * If a policy with the same ID already exists, its `destroy` method will be called before it is replaced.
20
- * @param policy The policy instance to add.
21
- */
22
- add(policy) {
23
- const existed = this.policies.get(policy.id);
24
- existed?.destroy?.();
25
- this.policies.set(policy.id, policy);
26
- return this;
27
- }
28
- /**
29
- * Removes a policy from the field by its ID and call `destroy` method.
30
- * @param policyId The unique ID of the policy to remove.
31
- * @returns `true` if the policy was found and removed, otherwise `false`.
32
- */
33
- remove(policyId) {
34
- const policyToRemove = this.policies.get(policyId);
35
- if (!policyToRemove) {
36
- return false;
37
- }
38
- policyToRemove.destroy?.();
39
- return this.policies.delete(policyId);
40
- }
41
- isEmpty() {
42
- return this.policies.size === 0;
43
- }
44
- /**
45
- * Removes all policies from the field.
46
- * After this, `set()` will no longer apply any transformations to the value until new policies are added.
47
- */
48
- clear() {
49
- this.policies.forEach(policy => policy.destroy?.());
50
- this.policies.clear();
51
- }
52
- /**
53
- * Forces the current value to be re-processed by all policies.
54
- * Useful if a policy's logic has changed and you need to re-evaluate the current state.
55
- */
56
- apply(val) {
57
- let finalVal = val;
58
- this.policies.forEach(policy => finalVal = policy.apply(finalVal));
59
- return finalVal;
60
- }
61
- }
62
- //# sourceMappingURL=policies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"policies.js","sourceRoot":"","sources":["../../src/policies/policies.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,QAAQ;IACF,QAAQ,GAAG,IAAI,GAAG,EAAqB,CAAC;IAEzD,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;;;OAMG;IACH,GAAG,CAAsB,EAAU;QACjC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAM,CAAC;IACpC,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,MAAiB;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC7C,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC;QACrB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QAErC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,QAAgB;QACrB,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,CAAC;IAClC,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACpD,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,GAAM;QACV,IAAI,QAAQ,GAAG,GAAG,CAAC;QACnB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;QACnE,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
@@ -1,6 +0,0 @@
1
- export interface Policy<T> {
2
- readonly id: string;
3
- apply: (val: T) => T;
4
- destroy?: () => void;
5
- }
6
- //# sourceMappingURL=policy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/policies/policy.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM,CAAC,CAAC;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=policy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/policies/policy.ts"],"names":[],"mappings":""}
@@ -1,52 +0,0 @@
1
- import { PolicySerializer } from './policy-serializer';
2
- import { FieldRegistry } from '../field-registry';
3
- import { Field } from '../field';
4
- /**
5
- * A plain object representation of a Field's state for serialization.
6
- */
7
- export interface FieldSnapshot {
8
- __type: string;
9
- name: string;
10
- value: any;
11
- policies?: object[];
12
- }
13
- /**
14
- * Orchestrates the serialization and deserialization of Field instances.
15
- *
16
- * This class acts as a central point for converting complex Field objects into
17
- * plain, storable data (snapshots) and vice-versa. It uses a `FieldRegistry`
18
- * to resolve class constructors and a `PolicySerializer` to handle the state
19
- * of any attached policies.
20
- *
21
- * @todo Implement a `patch(field, snapshot)` method.
22
- * Unlike `hydrate`, which creates a new
23
- * instance, `patch` should update the state of an *existing* field instance
24
- * without breaking external references to it.
25
- */
26
- export declare class FieldSerializer {
27
- private readonly fieldRegistry;
28
- private readonly policySerializer;
29
- /**
30
- * Creates an instance of FieldSerializer.
31
- * @param {FieldRegistry} fieldRegistry - A registry that maps string type names to Field constructors.
32
- * @param {PolicySerializer} policySerializer - A serializer dedicated to handling Policy instances.
33
- */
34
- constructor(fieldRegistry: FieldRegistry, policySerializer: PolicySerializer);
35
- /**
36
- * Creates a serializable snapshot of a Field instance.
37
- * The snapshot includes the field's type, name, current value, and the state of all its policies.
38
- * @param {Field<any>} field - The Field instance to serialize.
39
- * @returns {FieldSnapshot} A plain object ready for JSON serialization.
40
- */
41
- snapshot(field: Field<any>): FieldSnapshot;
42
- /**
43
- * Restores a Field instance from its snapshot representation.
44
- * It uses the `__type` property to find the correct constructor and hydrates
45
- * the field with its value and all its policies.
46
- * @param {FieldSnapshot} snapshot - The plain object snapshot to deserialize.
47
- * @returns {Field<any>} A new, fully functional Field instance.
48
- * @throws If the snapshot is invalid, missing a `__type`, or if the type is not registered.
49
- */
50
- hydrate(snapshot: FieldSnapshot): Field<any>;
51
- }
52
- //# sourceMappingURL=field-serializer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-serializer.d.ts","sourceRoot":"","sources":["../../src/serializer/field-serializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAI/B;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,GAAG,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,eAAe;IAQxB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAPnC;;;;OAIG;gBAEgB,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB;IAIrD;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,aAAa;IAgB1C;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,EAAE,aAAa,GAAG,KAAK,CAAC,GAAG,CAAC;CAa7C"}
@@ -1,66 +0,0 @@
1
- import { isNullOrUndefined, throwIfEmpty } from '@axi-engine/utils';
2
- /**
3
- * Orchestrates the serialization and deserialization of Field instances.
4
- *
5
- * This class acts as a central point for converting complex Field objects into
6
- * plain, storable data (snapshots) and vice-versa. It uses a `FieldRegistry`
7
- * to resolve class constructors and a `PolicySerializer` to handle the state
8
- * of any attached policies.
9
- *
10
- * @todo Implement a `patch(field, snapshot)` method.
11
- * Unlike `hydrate`, which creates a new
12
- * instance, `patch` should update the state of an *existing* field instance
13
- * without breaking external references to it.
14
- */
15
- export class FieldSerializer {
16
- fieldRegistry;
17
- policySerializer;
18
- /**
19
- * Creates an instance of FieldSerializer.
20
- * @param {FieldRegistry} fieldRegistry - A registry that maps string type names to Field constructors.
21
- * @param {PolicySerializer} policySerializer - A serializer dedicated to handling Policy instances.
22
- */
23
- constructor(fieldRegistry, policySerializer) {
24
- this.fieldRegistry = fieldRegistry;
25
- this.policySerializer = policySerializer;
26
- }
27
- /**
28
- * Creates a serializable snapshot of a Field instance.
29
- * The snapshot includes the field's type, name, current value, and the state of all its policies.
30
- * @param {Field<any>} field - The Field instance to serialize.
31
- * @returns {FieldSnapshot} A plain object ready for JSON serialization.
32
- */
33
- snapshot(field) {
34
- let snapshot = {
35
- __type: field.typeName,
36
- name: field.name,
37
- value: field.value,
38
- };
39
- if (!field.policies.isEmpty()) {
40
- const serializedPolicies = [];
41
- field.policies.items.forEach(policy => serializedPolicies.push(this.policySerializer.snapshot(policy)));
42
- snapshot.policies = serializedPolicies;
43
- }
44
- return snapshot;
45
- }
46
- /**
47
- * Restores a Field instance from its snapshot representation.
48
- * It uses the `__type` property to find the correct constructor and hydrates
49
- * the field with its value and all its policies.
50
- * @param {FieldSnapshot} snapshot - The plain object snapshot to deserialize.
51
- * @returns {Field<any>} A new, fully functional Field instance.
52
- * @throws If the snapshot is invalid, missing a `__type`, or if the type is not registered.
53
- */
54
- hydrate(snapshot) {
55
- const fieldType = snapshot.__type;
56
- throwIfEmpty(fieldType, 'Invalid field snapshot: missing "__type" identifier.');
57
- const Ctor = this.fieldRegistry.get(fieldType);
58
- let policies;
59
- if (!isNullOrUndefined(snapshot.policies)) {
60
- policies = [];
61
- snapshot.policies.forEach((p) => policies.push(this.policySerializer.hydrate(p)));
62
- }
63
- return new Ctor(snapshot.name, snapshot.value, { policies });
64
- }
65
- }
66
- //# sourceMappingURL=field-serializer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-serializer.js","sourceRoot":"","sources":["../../src/serializer/field-serializer.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAgBlE;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,eAAe;IAQP;IACA;IAPnB;;;;OAIG;IACH,YACmB,aAA4B,EAC5B,gBAAkC;QADlC,kBAAa,GAAb,aAAa,CAAe;QAC5B,qBAAgB,GAAhB,gBAAgB,CAAkB;IAErD,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,KAAiB;QACxB,IAAI,QAAQ,GAAQ;YAClB,MAAM,EAAE,KAAK,CAAC,QAAQ;YACtB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB,CAAA;QAED,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC;YAC9B,MAAM,kBAAkB,GAAa,EAAE,CAAC;YACxC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACxG,QAAQ,CAAC,QAAQ,GAAG,kBAAkB,CAAC;QACzC,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,QAAuB;QAC7B,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC;QAClC,YAAY,CAAC,SAAS,EAAE,sDAAsD,CAAC,CAAC;QAChF,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAE/C,IAAI,QAAmC,CAAC;QACxC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1C,QAAQ,GAAG,EAAE,CAAC;YACd,QAAQ,CAAC,QAAS,CAAC,OAAO,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,QAAS,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3F,CAAC;QAED,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,EAAE,EAAC,QAAQ,EAAC,CAAe,CAAC;IAC3E,CAAC;CACF"}
@@ -1,50 +0,0 @@
1
- import { FieldsSerializer, FieldsSnapshot } from './fields-serializer';
2
- import { Fields } from '../fields';
3
- import { FieldTreeFactory } from '../field-tree-factory';
4
- import { FieldTree } from '../field-tree';
5
- /**
6
- * Represents the serializable state of a `FieldTree` container.
7
- *
8
- * This type describes a plain object that has:
9
- * 1. A required `__type` property to identify the tree's class.
10
- * 2. An arbitrary number of other properties, where each key is the `name`
11
- * of a child node, and the value is the snapshot of that child node.
12
- * The `| string` is included to ensure compatibility with the `__type` property.
13
- */
14
- export interface FieldTreeSnapshot {
15
- __type: string;
16
- [fieldName: string]: FieldsSnapshot | FieldTreeSnapshot | string;
17
- }
18
- /**
19
- * Orchestrates the recursive serialization and deserialization of `FieldTree` instances.
20
- *
21
- * This class handles the conversion of an entire `FieldTree` object graph into a
22
- * plain, storable snapshot and vice-versa. It delegates the processing of `Fields`
23
- * leaf nodes to a dedicated `FieldsSerializer`.
24
- * @todo Refactoring: The current implementation uses `if/else` logic in `snapshot` and `hydrate`
25
- * to process different node types. A more extensible approach would be to use a
26
- * registry of dedicated handlers for each node type.
27
- * This would allow new node types to be supported without
28
- * modifying this class, adhering to the Open/Closed Principle.
29
- *
30
- * @todo Implement a `patch(tree, snapshot)` method for recursive, non-destructive
31
- * updates. This method should traverse the existing tree and the snapshot,
32
- * patching nodes in place to maintain object references.
33
- */
34
- export declare class FieldTreeSerializer<TFields extends Fields> {
35
- private readonly fieldTreeNodeFactory;
36
- private readonly fieldsSerializer;
37
- constructor(fieldTreeNodeFactory: FieldTreeFactory<TFields>, fieldsSerializer: FieldsSerializer<TFields>);
38
- /**
39
- * Creates a serializable snapshot of the entire tree and its contained fields.
40
- * @returns A plain JavaScript object representing the complete state managed by this tree.
41
- */
42
- snapshot(tree: FieldTree<TFields>): FieldTreeSnapshot;
43
- /**
44
- * Restores the state of the tree from a snapshot.
45
- * It intelligently creates missing nodes based on `__type` metadata and delegates hydration to child nodes.
46
- * @param snapshot The snapshot object to load.
47
- */
48
- hydrate(snapshot: FieldTreeSnapshot): FieldTree<TFields>;
49
- }
50
- //# sourceMappingURL=field-tree-serializer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-tree-serializer.d.ts","sourceRoot":"","sources":["../../src/serializer/field-tree-serializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAErE,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAC,SAAS,EAAW,MAAM,eAAe,CAAC;AAGlD;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,GAAG,iBAAiB,GAAG,MAAM,CAAC;CAClE;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,mBAAmB,CAAC,OAAO,SAAS,MAAM;IAGnD,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IACrC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBADhB,oBAAoB,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAC/C,gBAAgB,EAAE,gBAAgB,CAAC,OAAO,CAAC;IAI9D;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,iBAAiB;IAerD;;;;OAIG;IACH,OAAO,CAAC,QAAQ,EAAE,iBAAiB,GAAG,SAAS,CAAC,OAAO,CAAC;CAkBzD"}
@@ -1,68 +0,0 @@
1
- import { isString } from '@axi-engine/utils';
2
- import { Fields } from '../fields';
3
- import { FieldTree } from '../field-tree';
4
- /**
5
- * Orchestrates the recursive serialization and deserialization of `FieldTree` instances.
6
- *
7
- * This class handles the conversion of an entire `FieldTree` object graph into a
8
- * plain, storable snapshot and vice-versa. It delegates the processing of `Fields`
9
- * leaf nodes to a dedicated `FieldsSerializer`.
10
- * @todo Refactoring: The current implementation uses `if/else` logic in `snapshot` and `hydrate`
11
- * to process different node types. A more extensible approach would be to use a
12
- * registry of dedicated handlers for each node type.
13
- * This would allow new node types to be supported without
14
- * modifying this class, adhering to the Open/Closed Principle.
15
- *
16
- * @todo Implement a `patch(tree, snapshot)` method for recursive, non-destructive
17
- * updates. This method should traverse the existing tree and the snapshot,
18
- * patching nodes in place to maintain object references.
19
- */
20
- export class FieldTreeSerializer {
21
- fieldTreeNodeFactory;
22
- fieldsSerializer;
23
- constructor(fieldTreeNodeFactory, fieldsSerializer) {
24
- this.fieldTreeNodeFactory = fieldTreeNodeFactory;
25
- this.fieldsSerializer = fieldsSerializer;
26
- }
27
- /**
28
- * Creates a serializable snapshot of the entire tree and its contained fields.
29
- * @returns A plain JavaScript object representing the complete state managed by this tree.
30
- */
31
- snapshot(tree) {
32
- const res = {
33
- __type: tree.typeName
34
- };
35
- tree.nodes.forEach((node, key) => {
36
- if (node.typeName === tree.typeName) {
37
- res[key] = this.snapshot(node);
38
- }
39
- else if (node.typeName === Fields.typeName) {
40
- res[key] = this.fieldsSerializer.snapshot(node);
41
- }
42
- });
43
- return res;
44
- }
45
- /**
46
- * Restores the state of the tree from a snapshot.
47
- * It intelligently creates missing nodes based on `__type` metadata and delegates hydration to child nodes.
48
- * @param snapshot The snapshot object to load.
49
- */
50
- hydrate(snapshot) {
51
- const { __type, ...nodes } = snapshot;
52
- const tree = this.fieldTreeNodeFactory.tree();
53
- for (const key in nodes) {
54
- const nodeData = nodes[key];
55
- if (isString(nodeData)) {
56
- continue;
57
- }
58
- if (nodeData.__type === FieldTree.typeName) {
59
- tree.addNode(key, this.hydrate(nodeData));
60
- }
61
- else if (nodeData.__type === Fields.typeName) {
62
- tree.addNode(key, this.fieldsSerializer.hydrate(nodeData));
63
- }
64
- }
65
- return tree;
66
- }
67
- }
68
- //# sourceMappingURL=field-tree-serializer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-tree-serializer.js","sourceRoot":"","sources":["../../src/serializer/field-tree-serializer.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAC,SAAS,EAAW,MAAM,eAAe,CAAC;AAiBlD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,mBAAmB;IAGX;IACA;IAFnB,YACmB,oBAA+C,EAC/C,gBAA2C;QAD3C,yBAAoB,GAApB,oBAAoB,CAA2B;QAC/C,qBAAgB,GAAhB,gBAAgB,CAA2B;IAE9D,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,IAAwB;QAC/B,MAAM,GAAG,GAAwB;YAC/B,MAAM,EAAE,IAAI,CAAC,QAAQ;SACtB,CAAC;QAEF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAuB,EAAE,GAAW,EAAE,EAAE;YAC1D,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACpC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACjC,CAAC;iBAAM,IAAI,IAAI,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,EAAE,CAAC;gBAC7C,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAClD,CAAC;QACH,CAAC,CAAC,CAAC;QACH,OAAO,GAAwB,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,QAA2B;QACjC,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,QAAQ,CAAC;QACtC,MAAM,IAAI,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,CAAC;QAE9C,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;YACxB,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5B,IAAI,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACvB,SAAS;YACX,CAAC;YACD,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,CAAC,QAAQ,EAAE,CAAC;gBAC3C,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,QAA6B,CAAC,CAAC,CAAA;YAChE,CAAC;iBAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,MAAM,CAAC,QAAQ,EAAE,CAAC;gBAC/C,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAA0B,CAAC,CAAC,CAAA;YAC9E,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -1,49 +0,0 @@
1
- import { FieldSerializer, FieldSnapshot } from './field-serializer';
2
- import { Fields } from '../fields';
3
- import { FieldsFactory } from '../fields-factory';
4
- /**
5
- * A plain object representation of a Fields container's state for serialization.
6
- */
7
- export interface FieldsSnapshot {
8
- __type: string;
9
- [fieldName: string]: FieldSnapshot | string;
10
- }
11
- /**
12
- * Orchestrates the serialization and deserialization of `Fields` container instances.
13
- *
14
- * This class acts as a high-level composer, responsible for converting an entire `Fields` object
15
- * into a storable snapshot and back.
16
- * It delegates the actual serialization of each `Field` and `Policy` to their respective serializers.
17
- *
18
- * @todo Implement a `patch(fields, snapshot)` method. It should perform a non-destructive
19
- * update, creating new fields, removing missing ones, and patching existing ones
20
- * in place, preserving the container instance itself.
21
- */
22
- export declare class FieldsSerializer<TFields extends Fields> {
23
- private readonly fieldsFactory;
24
- private readonly fieldSerializer;
25
- /**
26
- * Creates an instance of FieldsSerializer.
27
- * @param {FieldsFactory} fieldsFactory - A registry that maps string type names to Field constructors.
28
- * @param {FieldSerializer} fieldSerializer - A serializer of field instances.
29
- */
30
- constructor(fieldsFactory: FieldsFactory<TFields>, fieldSerializer: FieldSerializer);
31
- /**
32
- * Creates a serializable snapshot of a `Fields` container.
33
- *
34
- * The snapshot includes a `__type` identifier (currently hardcoded) and an array of snapshots
35
- * for each `Field` within the container.
36
- * @param {Fields} fields - The `Fields` instance to serialize.
37
- * @returns {FieldsSnapshot} A plain object ready for JSON serialization.
38
- */
39
- snapshot(fields: Fields): FieldsSnapshot;
40
- /**
41
- * Restores a `Fields` container instance from its snapshot representation.
42
- *
43
- * It iterates through the field snapshots and hydrates them individually, adding them to the new container.
44
- * @param {FieldsSnapshot} snapshot - The plain object snapshot to deserialize.
45
- * @returns {Fields} A new `DefaultFields` instance populated with the restored fields.
46
- */
47
- hydrate(snapshot: FieldsSnapshot): TFields;
48
- }
49
- //# sourceMappingURL=fields-serializer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fields-serializer.d.ts","sourceRoot":"","sources":["../../src/serializer/fields-serializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,MAAM,CAAC;CAC7C;AAED;;;;;;;;;;GAUG;AACH,qBAAa,gBAAgB,CAAC,OAAO,SAAS,MAAM;IAOhD,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAPlC;;;;OAIG;gBAEgB,aAAa,EAAE,aAAa,CAAC,OAAO,CAAC,EACrC,eAAe,EAAE,eAAe;IAInD;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc;IASxC;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO;CAY3C"}
@@ -1,57 +0,0 @@
1
- /**
2
- * Orchestrates the serialization and deserialization of `Fields` container instances.
3
- *
4
- * This class acts as a high-level composer, responsible for converting an entire `Fields` object
5
- * into a storable snapshot and back.
6
- * It delegates the actual serialization of each `Field` and `Policy` to their respective serializers.
7
- *
8
- * @todo Implement a `patch(fields, snapshot)` method. It should perform a non-destructive
9
- * update, creating new fields, removing missing ones, and patching existing ones
10
- * in place, preserving the container instance itself.
11
- */
12
- export class FieldsSerializer {
13
- fieldsFactory;
14
- fieldSerializer;
15
- /**
16
- * Creates an instance of FieldsSerializer.
17
- * @param {FieldsFactory} fieldsFactory - A registry that maps string type names to Field constructors.
18
- * @param {FieldSerializer} fieldSerializer - A serializer of field instances.
19
- */
20
- constructor(fieldsFactory, fieldSerializer) {
21
- this.fieldsFactory = fieldsFactory;
22
- this.fieldSerializer = fieldSerializer;
23
- }
24
- /**
25
- * Creates a serializable snapshot of a `Fields` container.
26
- *
27
- * The snapshot includes a `__type` identifier (currently hardcoded) and an array of snapshots
28
- * for each `Field` within the container.
29
- * @param {Fields} fields - The `Fields` instance to serialize.
30
- * @returns {FieldsSnapshot} A plain object ready for JSON serialization.
31
- */
32
- snapshot(fields) {
33
- const res = {
34
- __type: fields.typeName,
35
- };
36
- fields.fields.forEach(field => res[field.name] = this.fieldSerializer.snapshot(field));
37
- return res;
38
- }
39
- /**
40
- * Restores a `Fields` container instance from its snapshot representation.
41
- *
42
- * It iterates through the field snapshots and hydrates them individually, adding them to the new container.
43
- * @param {FieldsSnapshot} snapshot - The plain object snapshot to deserialize.
44
- * @returns {Fields} A new `DefaultFields` instance populated with the restored fields.
45
- */
46
- hydrate(snapshot) {
47
- const { __type, ...fieldsData } = snapshot;
48
- const fields = this.fieldsFactory.fields();
49
- for (const fieldName in fieldsData) {
50
- const fieldSnapshot = fieldsData[fieldName];
51
- const restoredField = this.fieldSerializer.hydrate(fieldSnapshot);
52
- fields.add(restoredField);
53
- }
54
- return fields;
55
- }
56
- }
57
- //# sourceMappingURL=fields-serializer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fields-serializer.js","sourceRoot":"","sources":["../../src/serializer/fields-serializer.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;GAUG;AACH,MAAM,OAAO,gBAAgB;IAOR;IACA;IAPnB;;;;OAIG;IACH,YACmB,aAAqC,EACrC,eAAgC;QADhC,kBAAa,GAAb,aAAa,CAAwB;QACrC,oBAAe,GAAf,eAAe,CAAiB;IAEnD,CAAC;IAED;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAc;QACrB,MAAM,GAAG,GAAmB;YAC1B,MAAM,EAAE,MAAM,CAAC,QAAQ;SACxB,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QACvF,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;;;;OAMG;IACH,OAAO,CAAC,QAAwB;QAC9B,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,GAAG,QAAQ,CAAC;QAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;QAE3C,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;YAC5C,MAAM,aAAa,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,aAA8B,CAAC,CAAC;YACnF,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAC5B,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -1,8 +0,0 @@
1
- export * from './policies/clamp-policy-serializer-handler';
2
- export * from './policies/clamp-max-policy-serializer-handler';
3
- export * from './policies/clamp-min-policy-serializer-handler';
4
- export * from './policy-serializer';
5
- export * from './field-serializer';
6
- export * from './fields-serializer';
7
- export * from './field-tree-serializer';
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/serializer/index.ts"],"names":[],"mappings":"AAAA,cAAc,4CAA4C,CAAA;AAC1D,cAAc,gDAAgD,CAAA;AAC9D,cAAc,gDAAgD,CAAA;AAE9D,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,yBAAyB,CAAA"}
@@ -1,8 +0,0 @@
1
- export * from './policies/clamp-policy-serializer-handler';
2
- export * from './policies/clamp-max-policy-serializer-handler';
3
- export * from './policies/clamp-min-policy-serializer-handler';
4
- export * from './policy-serializer';
5
- export * from './field-serializer';
6
- export * from './fields-serializer';
7
- export * from './field-tree-serializer';
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/serializer/index.ts"],"names":[],"mappings":"AAAA,cAAc,4CAA4C,CAAA;AAC1D,cAAc,gDAAgD,CAAA;AAC9D,cAAc,gDAAgD,CAAA;AAE9D,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,yBAAyB,CAAA"}
@@ -1,13 +0,0 @@
1
- import { PolicySerializerHandler } from '../policy-serializer';
2
- import { ClampMaxPolicy } from '../../policies';
3
- export declare class ClampMaxPolicySerializerHandler implements PolicySerializerHandler<ClampMaxPolicy, {
4
- max: number;
5
- }> {
6
- snapshot(policy: ClampMaxPolicy): {
7
- max: number;
8
- };
9
- hydrate(data: {
10
- max: number;
11
- }): ClampMaxPolicy;
12
- }
13
- //# sourceMappingURL=clamp-max-policy-serializer-handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clamp-max-policy-serializer-handler.d.ts","sourceRoot":"","sources":["../../../src/serializer/policies/clamp-max-policy-serializer-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAE9C,qBAAa,+BAAgC,YAAW,uBAAuB,CAAC,cAAc,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;IAC9G,QAAQ,CAAC,MAAM,EAAE,cAAc;;;IAI/B,OAAO,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE;CAG9B"}
@@ -1,10 +0,0 @@
1
- import { ClampMaxPolicy } from '../../policies';
2
- export class ClampMaxPolicySerializerHandler {
3
- snapshot(policy) {
4
- return { max: policy.max };
5
- }
6
- hydrate(data) {
7
- return new ClampMaxPolicy(data.max);
8
- }
9
- }
10
- //# sourceMappingURL=clamp-max-policy-serializer-handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clamp-max-policy-serializer-handler.js","sourceRoot":"","sources":["../../../src/serializer/policies/clamp-max-policy-serializer-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAE9C,MAAM,OAAO,+BAA+B;IAC1C,QAAQ,CAAC,MAAsB;QAC7B,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC;IAC7B,CAAC;IAED,OAAO,CAAC,IAAqB;QAC3B,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;CACF"}
@@ -1,13 +0,0 @@
1
- import { PolicySerializerHandler } from '../policy-serializer';
2
- import { ClampMinPolicy } from '../../policies';
3
- export declare class ClampMinPolicySerializerHandler implements PolicySerializerHandler<ClampMinPolicy, {
4
- min: number;
5
- }> {
6
- snapshot(policy: ClampMinPolicy): {
7
- min: number;
8
- };
9
- hydrate(data: {
10
- min: number;
11
- }): ClampMinPolicy;
12
- }
13
- //# sourceMappingURL=clamp-min-policy-serializer-handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clamp-min-policy-serializer-handler.d.ts","sourceRoot":"","sources":["../../../src/serializer/policies/clamp-min-policy-serializer-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAG9C,qBAAa,+BAAgC,YAAW,uBAAuB,CAAC,cAAc,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;IAC9G,QAAQ,CAAC,MAAM,EAAE,cAAc;;;IAI/B,OAAO,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE;CAG9B"}
@@ -1,10 +0,0 @@
1
- import { ClampMinPolicy } from '../../policies';
2
- export class ClampMinPolicySerializerHandler {
3
- snapshot(policy) {
4
- return { min: policy.min };
5
- }
6
- hydrate(data) {
7
- return new ClampMinPolicy(data.min);
8
- }
9
- }
10
- //# sourceMappingURL=clamp-min-policy-serializer-handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clamp-min-policy-serializer-handler.js","sourceRoot":"","sources":["../../../src/serializer/policies/clamp-min-policy-serializer-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAG9C,MAAM,OAAO,+BAA+B;IAC1C,QAAQ,CAAC,MAAsB;QAC7B,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC;IAC7B,CAAC;IAED,OAAO,CAAC,IAAqB;QAC3B,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;CACF"}
@@ -1,16 +0,0 @@
1
- import { PolicySerializerHandler } from '../policy-serializer';
2
- import { ClampPolicy } from '../../policies';
3
- export declare class ClampPolicySerializerHandler implements PolicySerializerHandler<ClampPolicy, {
4
- min: number;
5
- max: number;
6
- }> {
7
- snapshot(policy: ClampPolicy): {
8
- min: number;
9
- max: number;
10
- };
11
- hydrate(data: {
12
- min: number;
13
- max: number;
14
- }): ClampPolicy;
15
- }
16
- //# sourceMappingURL=clamp-policy-serializer-handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clamp-policy-serializer-handler.d.ts","sourceRoot":"","sources":["../../../src/serializer/policies/clamp-policy-serializer-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAG3C,qBAAa,4BAA6B,YAAW,uBAAuB,CAAC,WAAW,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;IACrH,QAAQ,CAAC,MAAM,EAAE,WAAW;;;;IAI5B,OAAO,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;CAG3C"}