@blazetrails/activemodel 0.0.0-stage → 0.1.0-alpha0.1

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 (228) hide show
  1. package/LICENSE +21 -0
  2. package/dist/access.d.ts +6 -0
  3. package/dist/access.js +11 -0
  4. package/dist/access.js.map +1 -0
  5. package/dist/api.d.ts +55 -0
  6. package/dist/api.js +28 -0
  7. package/dist/api.js.map +1 -0
  8. package/dist/attribute/user-provided-default.d.ts +13 -0
  9. package/dist/attribute/user-provided-default.js +44 -0
  10. package/dist/attribute/user-provided-default.js.map +1 -0
  11. package/dist/attribute-assignment.d.ts +47 -0
  12. package/dist/attribute-assignment.js +182 -0
  13. package/dist/attribute-assignment.js.map +1 -0
  14. package/dist/attribute-methods.d.ts +231 -0
  15. package/dist/attribute-methods.js +421 -0
  16. package/dist/attribute-methods.js.map +1 -0
  17. package/dist/attribute-mutation-tracker.d.ts +64 -0
  18. package/dist/attribute-mutation-tracker.js +167 -0
  19. package/dist/attribute-mutation-tracker.js.map +1 -0
  20. package/dist/attribute-registration.d.ts +121 -0
  21. package/dist/attribute-registration.js +159 -0
  22. package/dist/attribute-registration.js.map +1 -0
  23. package/dist/attribute-set/builder.d.ts +70 -0
  24. package/dist/attribute-set/builder.js +212 -0
  25. package/dist/attribute-set/builder.js.map +1 -0
  26. package/dist/attribute-set/yaml-encoder.d.ts +12 -0
  27. package/dist/attribute-set/yaml-encoder.js +35 -0
  28. package/dist/attribute-set/yaml-encoder.js.map +1 -0
  29. package/dist/attribute-set.d.ts +40 -0
  30. package/dist/attribute-set.js +106 -0
  31. package/dist/attribute-set.js.map +1 -0
  32. package/dist/attribute.d.ts +93 -0
  33. package/dist/attribute.js +261 -0
  34. package/dist/attribute.js.map +1 -0
  35. package/dist/attributes.d.ts +77 -0
  36. package/dist/attributes.js +78 -0
  37. package/dist/attributes.js.map +1 -0
  38. package/dist/callbacks.d.ts +48 -0
  39. package/dist/callbacks.js +73 -0
  40. package/dist/callbacks.js.map +1 -0
  41. package/dist/constants.generated.d.ts +2 -0
  42. package/dist/constants.generated.js +183 -0
  43. package/dist/constants.generated.js.map +1 -0
  44. package/dist/conversion.d.ts +41 -0
  45. package/dist/conversion.js +40 -0
  46. package/dist/conversion.js.map +1 -0
  47. package/dist/deprecator.d.ts +7 -0
  48. package/dist/deprecator.js +7 -0
  49. package/dist/deprecator.js.map +1 -0
  50. package/dist/dirty.d.ts +79 -0
  51. package/dist/dirty.js +138 -0
  52. package/dist/dirty.js.map +1 -0
  53. package/dist/error.d.ts +27 -0
  54. package/dist/error.js +223 -0
  55. package/dist/error.js.map +1 -0
  56. package/dist/errors.d.ts +81 -0
  57. package/dist/errors.js +215 -0
  58. package/dist/errors.js.map +1 -0
  59. package/dist/forbidden-attributes-protection.d.ts +16 -0
  60. package/dist/forbidden-attributes-protection.js +22 -0
  61. package/dist/forbidden-attributes-protection.js.map +1 -0
  62. package/dist/gem-version.d.ts +10 -0
  63. package/dist/gem-version.js +16 -0
  64. package/dist/gem-version.js.map +1 -0
  65. package/dist/i18n.d.ts +3 -0
  66. package/dist/i18n.js +7 -0
  67. package/dist/i18n.js.map +1 -0
  68. package/dist/index.d.ts +72 -0
  69. package/dist/index.js +59 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/lint.d.ts +60 -0
  72. package/dist/lint.js +58 -0
  73. package/dist/lint.js.map +1 -0
  74. package/dist/locale/en.d.ts +2 -0
  75. package/dist/locale/en.js +41 -0
  76. package/dist/locale/en.js.map +1 -0
  77. package/dist/model.d.ts +90 -0
  78. package/dist/model.js +47 -0
  79. package/dist/model.js.map +1 -0
  80. package/dist/namespaces.d.ts +27 -0
  81. package/dist/namespaces.js +37 -0
  82. package/dist/namespaces.js.map +1 -0
  83. package/dist/naming.d.ts +76 -0
  84. package/dist/naming.js +198 -0
  85. package/dist/naming.js.map +1 -0
  86. package/dist/nested-error.d.ts +18 -0
  87. package/dist/nested-error.js +17 -0
  88. package/dist/nested-error.js.map +1 -0
  89. package/dist/secure-password.d.ts +31 -0
  90. package/dist/secure-password.js +164 -0
  91. package/dist/secure-password.js.map +1 -0
  92. package/dist/serialization.d.ts +40 -0
  93. package/dist/serialization.js +226 -0
  94. package/dist/serialization.js.map +1 -0
  95. package/dist/serializers/json.d.ts +27 -0
  96. package/dist/serializers/json.js +43 -0
  97. package/dist/serializers/json.js.map +1 -0
  98. package/dist/translation.d.ts +27 -0
  99. package/dist/translation.js +64 -0
  100. package/dist/translation.js.map +1 -0
  101. package/dist/type/big-integer.d.ts +6 -0
  102. package/dist/type/big-integer.js +10 -0
  103. package/dist/type/big-integer.js.map +1 -0
  104. package/dist/type/binary.d.ts +19 -0
  105. package/dist/type/binary.js +56 -0
  106. package/dist/type/binary.js.map +1 -0
  107. package/dist/type/boolean.d.ts +10 -0
  108. package/dist/type/boolean.js +38 -0
  109. package/dist/type/boolean.js.map +1 -0
  110. package/dist/type/date-time.d.ts +23 -0
  111. package/dist/type/date-time.js +54 -0
  112. package/dist/type/date-time.js.map +1 -0
  113. package/dist/type/date.d.ts +27 -0
  114. package/dist/type/date.js +78 -0
  115. package/dist/type/date.js.map +1 -0
  116. package/dist/type/decimal.d.ts +28 -0
  117. package/dist/type/decimal.js +71 -0
  118. package/dist/type/decimal.js.map +1 -0
  119. package/dist/type/float.d.ts +19 -0
  120. package/dist/type/float.js +38 -0
  121. package/dist/type/float.js.map +1 -0
  122. package/dist/type/helpers/accepts-multiparameter-time.d.ts +25 -0
  123. package/dist/type/helpers/accepts-multiparameter-time.js +50 -0
  124. package/dist/type/helpers/accepts-multiparameter-time.js.map +1 -0
  125. package/dist/type/helpers/mutable.d.ts +10 -0
  126. package/dist/type/helpers/mutable.js +13 -0
  127. package/dist/type/helpers/mutable.js.map +1 -0
  128. package/dist/type/helpers/numeric.d.ts +23 -0
  129. package/dist/type/helpers/numeric.js +50 -0
  130. package/dist/type/helpers/numeric.js.map +1 -0
  131. package/dist/type/helpers/time-value.d.ts +31 -0
  132. package/dist/type/helpers/time-value.js +100 -0
  133. package/dist/type/helpers/time-value.js.map +1 -0
  134. package/dist/type/helpers/timezone.d.ts +5 -0
  135. package/dist/type/helpers/timezone.js +16 -0
  136. package/dist/type/helpers/timezone.js.map +1 -0
  137. package/dist/type/helpers.d.ts +6 -0
  138. package/dist/type/helpers.js +6 -0
  139. package/dist/type/helpers.js.map +1 -0
  140. package/dist/type/immutable-string.d.ts +19 -0
  141. package/dist/type/immutable-string.js +43 -0
  142. package/dist/type/immutable-string.js.map +1 -0
  143. package/dist/type/integer.d.ts +43 -0
  144. package/dist/type/integer.js +82 -0
  145. package/dist/type/integer.js.map +1 -0
  146. package/dist/type/internal/sentinels.d.ts +12 -0
  147. package/dist/type/internal/sentinels.js +3 -0
  148. package/dist/type/internal/sentinels.js.map +1 -0
  149. package/dist/type/registry.d.ts +19 -0
  150. package/dist/type/registry.js +35 -0
  151. package/dist/type/registry.js.map +1 -0
  152. package/dist/type/serialize-cast-value.d.ts +32 -0
  153. package/dist/type/serialize-cast-value.js +56 -0
  154. package/dist/type/serialize-cast-value.js.map +1 -0
  155. package/dist/type/string.d.ts +8 -0
  156. package/dist/type/string.js +30 -0
  157. package/dist/type/string.js.map +1 -0
  158. package/dist/type/time.d.ts +16 -0
  159. package/dist/type/time.js +62 -0
  160. package/dist/type/time.js.map +1 -0
  161. package/dist/type/value.d.ts +42 -0
  162. package/dist/type/value.js +93 -0
  163. package/dist/type/value.js.map +1 -0
  164. package/dist/type.d.ts +10 -0
  165. package/dist/type.js +47 -0
  166. package/dist/type.js.map +1 -0
  167. package/dist/validations/absence.d.ts +10 -0
  168. package/dist/validations/absence.js +15 -0
  169. package/dist/validations/absence.js.map +1 -0
  170. package/dist/validations/acceptance.d.ts +37 -0
  171. package/dist/validations/acceptance.js +65 -0
  172. package/dist/validations/acceptance.js.map +1 -0
  173. package/dist/validations/callbacks.d.ts +45 -0
  174. package/dist/validations/callbacks.js +42 -0
  175. package/dist/validations/callbacks.js.map +1 -0
  176. package/dist/validations/clusivity.d.ts +37 -0
  177. package/dist/validations/clusivity.js +55 -0
  178. package/dist/validations/clusivity.js.map +1 -0
  179. package/dist/validations/comparability.d.ts +27 -0
  180. package/dist/validations/comparability.js +17 -0
  181. package/dist/validations/comparability.js.map +1 -0
  182. package/dist/validations/comparison.d.ts +15 -0
  183. package/dist/validations/comparison.js +41 -0
  184. package/dist/validations/comparison.js.map +1 -0
  185. package/dist/validations/confirmation.d.ts +29 -0
  186. package/dist/validations/confirmation.js +48 -0
  187. package/dist/validations/confirmation.js.map +1 -0
  188. package/dist/validations/exclusion.d.ts +13 -0
  189. package/dist/validations/exclusion.js +25 -0
  190. package/dist/validations/exclusion.js.map +1 -0
  191. package/dist/validations/format.d.ts +30 -0
  192. package/dist/validations/format.js +80 -0
  193. package/dist/validations/format.js.map +1 -0
  194. package/dist/validations/helper-methods.d.ts +24 -0
  195. package/dist/validations/helper-methods.js +32 -0
  196. package/dist/validations/helper-methods.js.map +1 -0
  197. package/dist/validations/inclusion.d.ts +13 -0
  198. package/dist/validations/inclusion.js +25 -0
  199. package/dist/validations/inclusion.js.map +1 -0
  200. package/dist/validations/length.d.ts +23 -0
  201. package/dist/validations/length.js +106 -0
  202. package/dist/validations/length.js.map +1 -0
  203. package/dist/validations/numericality.d.ts +76 -0
  204. package/dist/validations/numericality.js +196 -0
  205. package/dist/validations/numericality.js.map +1 -0
  206. package/dist/validations/presence.d.ts +10 -0
  207. package/dist/validations/presence.js +15 -0
  208. package/dist/validations/presence.js.map +1 -0
  209. package/dist/validations/resolve-value.d.ts +8 -0
  210. package/dist/validations/resolve-value.js +24 -0
  211. package/dist/validations/resolve-value.js.map +1 -0
  212. package/dist/validations/validates.d.ts +13 -0
  213. package/dist/validations/validates.js +53 -0
  214. package/dist/validations/validates.js.map +1 -0
  215. package/dist/validations/with.d.ts +21 -0
  216. package/dist/validations/with.js +44 -0
  217. package/dist/validations/with.js.map +1 -0
  218. package/dist/validations.d.ts +138 -0
  219. package/dist/validations.js +239 -0
  220. package/dist/validations.js.map +1 -0
  221. package/dist/validator.d.ts +31 -0
  222. package/dist/validator.js +62 -0
  223. package/dist/validator.js.map +1 -0
  224. package/dist/version.d.ts +3 -0
  225. package/dist/version.js +5 -0
  226. package/dist/version.js.map +1 -0
  227. package/package.json +61 -3
  228. package/README.md +0 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Dean Marano and Trails contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ import { type HashWithIndifferentAccess } from "@blazetrails/activesupport";
2
+ export declare class Access {
3
+ slice(...methods: unknown[]): HashWithIndifferentAccess<unknown>;
4
+ valuesAt(...methods: unknown[]): unknown[];
5
+ }
6
+ //# sourceMappingURL=access.d.ts.map
package/dist/access.js ADDED
@@ -0,0 +1,11 @@
1
+ import { indexWith, withIndifferentAccess, } from "@blazetrails/activesupport";
2
+ import { flatten, rbFSend } from "@blazetrails/ruby-compat";
3
+ export class Access {
4
+ slice(...methods) {
5
+ return withIndifferentAccess(indexWith(flatten(methods), (method) => rbFSend(this, method)));
6
+ }
7
+ valuesAt(...methods) {
8
+ return flatten(methods).map((method) => rbFSend(this, method));
9
+ }
10
+ }
11
+ //# sourceMappingURL=access.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.js","sourceRoot":"","sources":["../lib/access.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,qBAAqB,GAEtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAE5D,MAAM,OAAO,MAAM;IACjB,KAAK,CAAC,GAAG,OAAkB;QACzB,OAAO,qBAAqB,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAC/F,CAAC;IAED,QAAQ,CAAC,GAAG,OAAkB;QAC5B,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IACjE,CAAC;CACF"}
package/dist/api.d.ts ADDED
@@ -0,0 +1,55 @@
1
+ import { included } from "@blazetrails/activesupport";
2
+ import { type ValidationContext } from "./validations.js";
3
+ import type { AttrNameArg } from "./validations/helper-methods.js";
4
+ import type { validatesWith as withValidatesWith } from "./validations/with.js";
5
+ import { Conversion } from "./conversion.js";
6
+ type IncludingClass = (new (...args: never[]) => unknown) & {
7
+ prototype: object;
8
+ };
9
+ export declare class API {
10
+ static [included](base: IncludingClass): void;
11
+ isPersisted(): boolean;
12
+ }
13
+ export interface API extends Conversion {
14
+ assignAttributes(newAttributes: unknown): void;
15
+ setAttributes(newAttributes: unknown): Promise<void> | void;
16
+ attributeWriterMissing(name: string, value: unknown): void;
17
+ /** @internal */
18
+ _assignAttributes(attributes: Record<string, unknown> | Map<string, unknown>): Promise<void> | void;
19
+ /** @internal */
20
+ _assignAttribute(k: string, v: unknown): unknown;
21
+ /** @internal */
22
+ sanitizeForMassAssignment(attributes: Record<string, unknown> | Map<string, unknown>): Record<string, unknown> | Map<string, unknown>;
23
+ /** @internal */
24
+ sanitizeForbiddenAttributes(attributes: Record<string, unknown> | Map<string, unknown>): Record<string, unknown> | Map<string, unknown>;
25
+ /** @internal */
26
+ contextForValidation(): ValidationContext;
27
+ /** @internal */
28
+ runValidationsBang(): Promise<boolean>;
29
+ raiseValidationError(): never;
30
+ readAttributeForValidation(attribute: string): unknown;
31
+ isValid(context?: string | string[] | null): Promise<boolean>;
32
+ validate(context?: string | string[] | null): Promise<boolean>;
33
+ isInvalid(context?: string | string[] | null): Promise<boolean>;
34
+ validateBang(context?: string | string[] | null): Promise<true>;
35
+ readonly validationContext: string | string[] | null;
36
+ /** @internal */
37
+ _validationContext: string | string[] | null;
38
+ /** @internal */
39
+ _runValidateCallbacks(block?: () => unknown): unknown;
40
+ freeze(): this;
41
+ validatesWith(...args: Parameters<typeof withValidatesWith>): ReturnType<typeof withValidatesWith>;
42
+ validatesPresenceOf(...attrNames: AttrNameArg[]): Promise<void>;
43
+ validatesAbsenceOf(...attrNames: AttrNameArg[]): Promise<void>;
44
+ validatesLengthOf(...attrNames: AttrNameArg[]): Promise<void>;
45
+ validatesSizeOf(...attrNames: AttrNameArg[]): Promise<void>;
46
+ validatesNumericalityOf(...attrNames: AttrNameArg[]): Promise<void>;
47
+ validatesInclusionOf(...attrNames: AttrNameArg[]): Promise<void>;
48
+ validatesExclusionOf(...attrNames: AttrNameArg[]): Promise<void>;
49
+ validatesFormatOf(...attrNames: AttrNameArg[]): Promise<void>;
50
+ validatesAcceptanceOf(...attrNames: AttrNameArg[]): Promise<void>;
51
+ validatesConfirmationOf(...attrNames: AttrNameArg[]): Promise<void>;
52
+ validatesComparisonOf(...attrNames: AttrNameArg[]): Promise<void>;
53
+ }
54
+ export {};
55
+ //# sourceMappingURL=api.d.ts.map
package/dist/api.js ADDED
@@ -0,0 +1,28 @@
1
+ import { extend, include, included } from "@blazetrails/activesupport";
2
+ import { assignAttributes, setAttributes, attributeWriterMissing, _assignAttributes, _assignAttribute, } from "./attribute-assignment.js";
3
+ import { ForbiddenAttributesProtection } from "./forbidden-attributes-protection.js";
4
+ import { Validations } from "./validations.js";
5
+ import { Conversion } from "./conversion.js";
6
+ import { Naming } from "./naming.js";
7
+ import { Translation } from "./translation.js";
8
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging -- Ruby `include` (api.rb:58); the class/interface merge is how `include()` surfaces on the type side.
9
+ export class API {
10
+ static [included](base) {
11
+ include(base, {
12
+ assignAttributes,
13
+ setAttributes,
14
+ attributeWriterMissing,
15
+ _assignAttributes,
16
+ _assignAttribute,
17
+ });
18
+ include(base, ForbiddenAttributesProtection);
19
+ include(base, Validations);
20
+ include(base, Conversion);
21
+ extend(base, Naming);
22
+ extend(base, Translation);
23
+ }
24
+ isPersisted() {
25
+ return false;
26
+ }
27
+ }
28
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../lib/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAE,WAAW,EAA0B,MAAM,kBAAkB,CAAC;AAGvE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/C,mLAAmL;AACnL,MAAM,OAAO,GAAG;IACd,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAoB;QACpC,OAAO,CAAC,IAAI,EAAE;YACZ,gBAAgB;YAChB,aAAa;YACb,sBAAsB;YACtB,iBAAiB;YACjB,gBAAgB;SACjB,CAAC,CAAC;QAEH,OAAO,CAAC,IAAI,EAAE,6BAA6B,CAAC,CAAC;QAE7C,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAE3B,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAE1B,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACrB,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC5B,CAAC;IAED,WAAW;QACT,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ import { Attribute, FromUser } from "../attribute.js";
2
+ import { ValueType } from "../type/value.js";
3
+ export declare class UserProvidedDefault extends FromUser {
4
+ /** @internal */
5
+ readonly userProvidedValue: unknown;
6
+ private memoizedValueBeforeTypeCast;
7
+ constructor(name: string | null, value: unknown, type: ValueType | null, databaseDefault?: Attribute | null);
8
+ get valueBeforeTypeCast(): unknown;
9
+ withType(type: ValueType | null): Attribute;
10
+ marshalDump(): unknown[];
11
+ marshalLoad(values: unknown[]): unknown;
12
+ }
13
+ //# sourceMappingURL=user-provided-default.d.ts.map
@@ -0,0 +1,44 @@
1
+ import { rtest } from "@blazetrails/ruby-compat";
2
+ import { Attribute, FromUser } from "../attribute.js";
3
+ export class UserProvidedDefault extends FromUser {
4
+ /** @internal */
5
+ userProvidedValue;
6
+ constructor(name, value, type, databaseDefault = null) {
7
+ super(name, value, type, databaseDefault);
8
+ this.userProvidedValue = value;
9
+ }
10
+ get valueBeforeTypeCast() {
11
+ if (typeof this.userProvidedValue === "function") {
12
+ return rtest(this.memoizedValueBeforeTypeCast)
13
+ ? this.memoizedValueBeforeTypeCast
14
+ : (this.memoizedValueBeforeTypeCast = this.userProvidedValue());
15
+ }
16
+ else {
17
+ return this.userProvidedValue;
18
+ }
19
+ }
20
+ withType(type) {
21
+ return new UserProvidedDefault(this.name, this.userProvidedValue, type, this.originalAttribute);
22
+ }
23
+ marshalDump() {
24
+ const result = [this.name, this.valueBeforeTypeCast, this.type, this.originalAttribute];
25
+ if (Object.hasOwn(this, "_value"))
26
+ result.push(this.value());
27
+ return result;
28
+ }
29
+ marshalLoad(values) {
30
+ const [name, userProvidedValue, type, originalAttribute, value] = values;
31
+ const self = this;
32
+ self.name = name;
33
+ self.userProvidedValue = userProvidedValue;
34
+ self.type = type;
35
+ this.originalAttribute = originalAttribute;
36
+ if (values.length === 5) {
37
+ this._value = value;
38
+ return value;
39
+ }
40
+ return null;
41
+ }
42
+ }
43
+ Attribute.UserProvidedDefault = UserProvidedDefault;
44
+ //# sourceMappingURL=user-provided-default.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-provided-default.js","sourceRoot":"","sources":["../../lib/attribute/user-provided-default.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGtD,MAAM,OAAO,mBAAoB,SAAQ,QAAQ;IAC/C,gBAAgB;IACP,iBAAiB,CAAU;IAGpC,YACE,IAAmB,EACnB,KAAc,EACd,IAAsB,EACtB,eAAe,GAAqB,IAAI;QAExC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;QAC1C,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;IACjC,CAAC;IAED,IAAa,mBAAmB;QAC9B,IAAI,OAAO,IAAI,CAAC,iBAAiB,KAAK,UAAU,EAAE,CAAC;YACjD,OAAO,KAAK,CAAC,IAAI,CAAC,2BAA2B,CAAC;gBAC5C,CAAC,C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,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { ArgumentError, NameError, NoMethodError, NotImplementedError, RuntimeError, TypeError } from "@blazetrails/ruby-compat";
2
+ export declare function assignAttributes(this: AttributeAssignment, newAttributes: unknown): void;
3
+ export declare const assigningSynchronously: unique symbol;
4
+ /** @internal */
5
+ export declare function _assignAttributes(this: AttributeAssignment, attributes: Record<string, unknown> | Map<string, unknown>): Promise<void> | void;
6
+ export declare function setAttributes(this: AttributeAssignment, newAttributes: unknown): Promise<void> | void;
7
+ export declare function attributeWriterMissing(this: AttributeAssignment, name: string, _value: unknown): void;
8
+ /** @internal */
9
+ export declare function _assignAttribute(this: AttributeAssignment, k: string, v: unknown): unknown;
10
+ export interface AttributeAssignment {
11
+ [assigningSynchronously]?: boolean;
12
+ attributeWriterMissing(name: string, value: unknown): void;
13
+ /** @internal */
14
+ sanitizeForMassAssignment(attributes: Record<string, unknown> | Map<string, unknown>): Record<string, unknown> | Map<string, unknown>;
15
+ /** @internal */
16
+ _assignAttributes(attributes: Record<string, unknown> | Map<string, unknown>): Promise<void> | void;
17
+ /** @internal */
18
+ _assignAttribute(k: string, v: unknown): unknown;
19
+ }
20
+ export { ArgumentError, TypeError, NameError, NoMethodError, NotImplementedError, RuntimeError };
21
+ /**
22
+ * @internal
23
+ * @noRailsEquivalent CONVERGEABLE update-must-call-assign-attributes-carried-from-0087
24
+ */
25
+ export declare function assertAssignedSynchronously(pending: unknown, methodName: string): void;
26
+ /**
27
+ * @internal
28
+ * @noRailsEquivalent PERMANENT
29
+ */
30
+ export declare function capturingAssignment<R>(build: () => R): [R, Promise<void> | undefined];
31
+ /**
32
+ * @internal
33
+ * @noRailsEquivalent PERMANENT
34
+ */
35
+ export declare function deferringToAssignment(record: object, rest: () => unknown): boolean;
36
+ /**
37
+ * @internal
38
+ * @noRailsEquivalent PERMANENT
39
+ */
40
+ export declare function awaitingAssignment<R, K = never>(attributes: unknown, block: ((record: K) => void | Promise<void>) | undefined, build: (block?: (record: K) => unknown) => R): Promise<R>;
41
+ export declare const AttributeAssignment: {
42
+ assignAttributes: typeof assignAttributes;
43
+ attributeWriterMissing: typeof attributeWriterMissing;
44
+ _assignAttributes: typeof _assignAttributes;
45
+ _assignAttribute: typeof _assignAttribute;
46
+ };
47
+ //# sourceMappingURL=attribute-assignment.d.ts.map
@@ -0,0 +1,182 @@
1
+ import { ArgumentError, NameError, NoMethodError, NotImplementedError, RuntimeError, TypeError, eachPair, isEmpty, rbFSend, rbObjClassname, rbObjRespondTo, } from "@blazetrails/ruby-compat";
2
+ import { UnknownAttributeError } from "./errors.js";
3
+ export function assignAttributes(newAttributes) {
4
+ if (!respondToEachPair(newAttributes)) {
5
+ throw new ArgumentError(`When assigning attributes, you must pass a hash as an argument, ${rbObjClassname(newAttributes)} passed.`);
6
+ }
7
+ const capture = assignmentCapture?.attributes === newAttributes || assignmentCapture?.attributes === undefined
8
+ ? assignmentCapture
9
+ : null;
10
+ if (capture != null) {
11
+ assignmentCapture = null;
12
+ pendingCaptures.set(this, capture);
13
+ }
14
+ if (isEmpty(newAttributes))
15
+ return;
16
+ const outer = this[assigningSynchronously];
17
+ this[assigningSynchronously] = capture == null;
18
+ try {
19
+ const assigned = this._assignAttributes(this.sanitizeForMassAssignment(newAttributes));
20
+ if (capture == null) {
21
+ assertAssignedSynchronously(assigned, "assignAttributes");
22
+ }
23
+ else if (assigned instanceof Promise) {
24
+ capture.assigned = assigned;
25
+ }
26
+ }
27
+ finally {
28
+ this[assigningSynchronously] = outer;
29
+ }
30
+ }
31
+ let assignmentCapture = null;
32
+ const pendingCaptures = new WeakMap();
33
+ export const assigningSynchronously = Symbol.for("@blazetrails/activemodel:assigningSynchronously");
34
+ /** @internal */
35
+ export function _assignAttributes(attributes) {
36
+ let pending;
37
+ eachPair(attributes, (k, v) => {
38
+ if (pending !== undefined) {
39
+ pending = pending.then(() => this._assignAttribute(k, v));
40
+ return;
41
+ }
42
+ const assigned = this._assignAttribute(k, v);
43
+ if (assigned instanceof Promise)
44
+ pending = assigned;
45
+ });
46
+ if (pending !== undefined)
47
+ return pending.then(() => { });
48
+ }
49
+ export function setAttributes(newAttributes) {
50
+ if (!respondToEachPair(newAttributes)) {
51
+ throw new ArgumentError(`When assigning attributes, you must pass a hash as an argument, ${rbObjClassname(newAttributes)} passed.`);
52
+ }
53
+ if (isEmpty(newAttributes))
54
+ return;
55
+ return this._assignAttributes(this.sanitizeForMassAssignment(newAttributes));
56
+ }
57
+ export function attributeWriterMissing(name, _value) {
58
+ throw new UnknownAttributeError(this, name);
59
+ }
60
+ /** @internal */
61
+ export function _assignAttribute(k, v) {
62
+ const setter = `${k}=`;
63
+ try {
64
+ return rbFSend(this, setter, v);
65
+ }
66
+ catch (error) {
67
+ if (!(error instanceof NoMethodError))
68
+ throw error;
69
+ if (rbObjRespondTo(this, setter)) {
70
+ throw error;
71
+ }
72
+ else {
73
+ this.attributeWriterMissing(k, v);
74
+ }
75
+ }
76
+ }
77
+ function respondToEachPair(attrs) {
78
+ if (typeof attrs !== "object" || attrs === null || Array.isArray(attrs))
79
+ return false;
80
+ const proto = Object.getPrototypeOf(attrs);
81
+ if (proto === Object.prototype || proto === null || attrs instanceof Map)
82
+ return true;
83
+ return isParamsLikeWrapper(attrs);
84
+ }
85
+ function isParamsLikeWrapper(attrs) {
86
+ if (typeof attrs !== "object" || attrs === null)
87
+ return false;
88
+ const proto = Object.getPrototypeOf(attrs);
89
+ if (proto === Object.prototype || proto === null)
90
+ return false;
91
+ const wrapper = attrs;
92
+ return "isPermitted" in wrapper || typeof wrapper.toH === "function";
93
+ }
94
+ export { ArgumentError, TypeError, NameError, NoMethodError, NotImplementedError, RuntimeError };
95
+ /**
96
+ * @internal
97
+ * @noRailsEquivalent CONVERGEABLE update-must-call-assign-attributes-carried-from-0087
98
+ */
99
+ export function assertAssignedSynchronously(pending, methodName) {
100
+ if (!(pending instanceof Promise))
101
+ return;
102
+ const error = new RuntimeError(`${methodName} cannot assign this attribute synchronously; use \`await record.setAttributes(...)\` instead.`);
103
+ pending.catch((reason) => {
104
+ error.cause = reason;
105
+ });
106
+ throw error;
107
+ }
108
+ /**
109
+ * @internal
110
+ * @noRailsEquivalent PERMANENT
111
+ */
112
+ export function capturingAssignment(build) {
113
+ const capture = { attributes: undefined };
114
+ assignmentCapture = capture;
115
+ try {
116
+ const record = build();
117
+ return [record, capture.assigned];
118
+ }
119
+ catch (error) {
120
+ capture.assigned?.catch((reason) => {
121
+ if (error instanceof Error)
122
+ error.cause ??= reason;
123
+ });
124
+ throw error;
125
+ }
126
+ finally {
127
+ assignmentCapture = null;
128
+ }
129
+ }
130
+ /**
131
+ * @internal
132
+ * @noRailsEquivalent PERMANENT
133
+ */
134
+ export function deferringToAssignment(record, rest) {
135
+ const capture = pendingCaptures.get(record);
136
+ if (capture === undefined)
137
+ return false;
138
+ pendingCaptures.delete(record);
139
+ if (capture.assigned === undefined) {
140
+ const rested = rest();
141
+ if (rested instanceof Promise)
142
+ capture.assigned = rested.then(() => { });
143
+ }
144
+ else {
145
+ capture.assigned = capture.assigned.then(rest).then(() => { });
146
+ }
147
+ return true;
148
+ }
149
+ /**
150
+ * @internal
151
+ * @noRailsEquivalent PERMANENT
152
+ */
153
+ export async function awaitingAssignment(attributes, block, build) {
154
+ const capture = { attributes };
155
+ let yielded;
156
+ if (attributes != null)
157
+ assignmentCapture = capture;
158
+ let record;
159
+ try {
160
+ record = build(block &&
161
+ ((record) => {
162
+ yielded = block(record);
163
+ if (yielded instanceof Promise && capture.assigned === undefined) {
164
+ capture.assigned = yielded;
165
+ }
166
+ return yielded;
167
+ }));
168
+ }
169
+ finally {
170
+ assignmentCapture = null;
171
+ }
172
+ await capture.assigned;
173
+ await yielded;
174
+ return record;
175
+ }
176
+ export const AttributeAssignment = {
177
+ assignAttributes,
178
+ attributeWriterMissing,
179
+ _assignAttributes,
180
+ _assignAttribute,
181
+ };
182
+ //# sourceMappingURL=attribute-assignment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute-assignment.js","s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