@effect-app/vue 2.17.3 → 2.18.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.
package/src/makeClient.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import * as Sentry from "@sentry/browser"
3
3
  import { Cause, Effect, Exit, Match, Option, Runtime, S, Struct } from "effect-app"
4
- import { CauseException, type SupportedErrors } from "effect-app/client"
5
4
  import type { RequestHandler, RequestHandlerWithInput, TaggedRequestClassAny } from "effect-app/client/clientFor"
5
+ import { CauseException, type SupportedErrors } from "effect-app/client/errors"
6
6
  import { constant, pipe, tuple } from "effect-app/Function"
7
7
  import type { OperationFailure } from "effect-app/Operations"
8
8
  import { OperationSuccess } from "effect-app/Operations"
@@ -196,9 +196,10 @@ export const makeClient = <Locale extends string, R>(
196
196
  runtime: ShallowRef<Runtime.Runtime<R> | undefined>,
197
197
  messages: Record<string, string | undefined> = {}
198
198
  ) => {
199
- const useSafeMutation = makeMutation()
200
- const useSafeQuery = makeQuery(runtime)
201
- const useHandleRequestWithToast = () => {
199
+ // making sure names do not collide with auto exports in nuxt apps, please do not rename..
200
+ const _useSafeMutation = makeMutation()
201
+ const _useSafeQuery = makeQuery(runtime)
202
+ const _useHandleRequestWithToast = () => {
202
203
  const toast = useToast()
203
204
  const { intl } = useIntl()
204
205
 
@@ -345,7 +346,7 @@ export const makeClient = <Locale extends string, R>(
345
346
  * Pass a function that returns an Effect, e.g from a client action, give it a name.
346
347
  * Returns a tuple with state ref and execution function which reports success and errors as Toast.
347
348
  */
348
- const useAndHandleMutation: {
349
+ const _useAndHandleMutation: {
349
350
  <
350
351
  I,
351
352
  E extends ResponseErrors,
@@ -390,8 +391,8 @@ export const makeClient = <Locale extends string, R>(
390
391
  action: any,
391
392
  options?: Opts<any, any, any, any, any, any, any, any, any, any, any, any, any>
392
393
  ): any => {
393
- const handleRequestWithToast = useHandleRequestWithToast()
394
- const [a, b] = useSafeMutation({
394
+ const handleRequestWithToast = _useHandleRequestWithToast()
395
+ const [a, b] = _useSafeMutation({
395
396
  ...self,
396
397
  handler: Effect.isEffect(self.handler)
397
398
  ? (pipe(
@@ -415,7 +416,7 @@ export const makeClient = <Locale extends string, R>(
415
416
  * The same as @see useAndHandleMutation, but does not display any toasts by default.
416
417
  * Messages for success, error and defect toasts can be provided in the Options.
417
418
  */
418
- const useAndHandleMutationSilently: {
419
+ const _useAndHandleMutationSilently: {
419
420
  <
420
421
  I,
421
422
  E extends ResponseErrors,
@@ -455,7 +456,7 @@ export const makeClient = <Locale extends string, R>(
455
456
  action: string,
456
457
  options?: Opts<A, E, R, void, A2, E2, R2, ESuccess, RSuccess, EError, RError, EDefect, RDefect>
457
458
  ): ActResp<void, never, R>
458
- } = makeUseAndHandleMutation({
459
+ } = _makeUseAndHandleMutation({
459
460
  successMessage: suppressToast,
460
461
  failMessage: suppressToast,
461
462
  defectMessage: suppressToast
@@ -465,7 +466,7 @@ export const makeClient = <Locale extends string, R>(
465
466
  * The same as @see useAndHandleMutation, but does not act on success, error or defect by default.
466
467
  * Actions for success, error and defect can be provided in the Options.
467
468
  */
468
- const useAndHandleMutationCustom: {
469
+ const _useAndHandleMutationCustom: {
469
470
  <
470
471
  I,
471
472
  E extends ResponseErrors,
@@ -506,7 +507,7 @@ export const makeClient = <Locale extends string, R>(
506
507
  options?: LowOptsOptional<A, E, R, void, A2, E2, R2, ESuccess, RSuccess, EError, RError, EDefect, RDefect>
507
508
  ): ActResp<A2, E2, R2>
508
509
  } = (self: any, action: string, options: any) => {
509
- const [a, b] = useSafeMutation({
510
+ const [a, b] = _useSafeMutation({
510
511
  ...self,
511
512
  handler: Effect.isEffect(self.handler)
512
513
  ? (pipe(
@@ -531,11 +532,11 @@ export const makeClient = <Locale extends string, R>(
531
532
  ) as any
532
533
  }
533
534
 
534
- function makeUseAndHandleMutation(
535
+ function _makeUseAndHandleMutation(
535
536
  defaultOptions?: Opts<any, any, any, any, any, any, any, any, any>
536
537
  ) {
537
538
  return ((self: any, action: any, options: any) => {
538
- return useAndHandleMutation(
539
+ return _useAndHandleMutation(
539
540
  self,
540
541
  action,
541
542
  { ...defaultOptions, ...options }
@@ -582,10 +583,10 @@ export const makeClient = <Locale extends string, R>(
582
583
  }
583
584
  }
584
585
 
585
- const useSafeMutationWithState = <I, E, A, Request extends TaggedRequestClassAny>(
586
+ const _useSafeMutationWithState = <I, E, A, Request extends TaggedRequestClassAny>(
586
587
  self: RequestHandlerWithInput<I, A, E, R, Request>
587
588
  ) => {
588
- const [a, b] = useSafeMutation(self)
589
+ const [a, b] = _useSafeMutation(self)
589
590
 
590
591
  return tuple(
591
592
  computed(() => mutationResultToVue(a.value)),
@@ -593,7 +594,7 @@ export const makeClient = <Locale extends string, R>(
593
594
  )
594
595
  }
595
596
 
596
- const buildFormFromSchema = <
597
+ const _buildFormFromSchema = <
597
598
  From extends Record<PropertyKey, any>,
598
599
  To extends Record<PropertyKey, any>,
599
600
  C extends Record<PropertyKey, any>,
@@ -650,14 +651,14 @@ export const makeClient = <Locale extends string, R>(
650
651
  }
651
652
 
652
653
  return {
653
- useSafeMutationWithState,
654
- useAndHandleMutation,
655
- useAndHandleMutationSilently,
656
- useAndHandleMutationCustom,
657
- makeUseAndHandleMutation,
658
- useHandleRequestWithToast,
659
- buildFormFromSchema,
660
- useSafeQuery,
661
- useSafeMutation
654
+ useSafeMutationWithState: _useSafeMutationWithState,
655
+ useAndHandleMutation: _useAndHandleMutation,
656
+ useAndHandleMutationSilently: _useAndHandleMutationSilently,
657
+ useAndHandleMutationCustom: _useAndHandleMutationCustom,
658
+ makeUseAndHandleMutation: _makeUseAndHandleMutation,
659
+ useHandleRequestWithToast: _useHandleRequestWithToast,
660
+ buildFormFromSchema: _buildFormFromSchema,
661
+ useSafeQuery: _useSafeQuery,
662
+ useSafeMutation: _useSafeMutation
662
663
  }
663
664
  }
package/src/query.ts CHANGED
@@ -13,8 +13,8 @@ import type {
13
13
  } from "@tanstack/vue-query"
14
14
  import { useQuery } from "@tanstack/vue-query"
15
15
  import { Array, Cause, Effect, Option, Runtime, S } from "effect-app"
16
- import { ServiceUnavailableError } from "effect-app/client"
17
16
  import type { RequestHandler, RequestHandlerWithInput, TaggedRequestClassAny } from "effect-app/client/clientFor"
17
+ import { ServiceUnavailableError } from "effect-app/client/errors"
18
18
  import { isHttpRequestError, isHttpResponseError } from "effect-app/http/http-client"
19
19
  import { computed, ref, shallowRef, watch } from "vue"
20
20
  import type { ComputedRef, ShallowRef, WatchSource } from "vue"
@@ -1,73 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.captureException = captureException;
7
- exports.logError = logError;
8
- exports.reportError = reportError;
9
- exports.reportMessage = reportMessage;
10
- var Sentry = _interopRequireWildcard(require("@sentry/browser"));
11
- var _effectApp = require("effect-app");
12
- var _errors = require("effect-app/client/errors");
13
- var _utils = require("effect-app/utils");
14
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
- /* eslint-disable @typescript-eslint/no-explicit-any */
17
- /* eslint-disable @typescript-eslint/no-unsafe-argument */
18
-
19
- function reportError(name) {
20
- return (cause, extras) => _effectApp.Effect.gen(function* () {
21
- if (_effectApp.Cause.isInterruptedOnly(cause)) {
22
- yield* _effectApp.Effect.logDebug("Interrupted").pipe(_effectApp.Effect.annotateLogs("extras", JSON.stringify(extras ?? {})));
23
- return _effectApp.Cause.squash(cause);
24
- }
25
- const error = new _errors.CauseException(cause, name);
26
- yield* reportSentry(error, extras);
27
- yield* _effectApp.Effect.logError("Reporting error", cause).pipe(_effectApp.Effect.annotateLogs((0, _utils.dropUndefined)({
28
- extras,
29
- error: (0, _errors.tryToReport)(error),
30
- cause: (0, _errors.tryToJson)(cause),
31
- __error_name__: name
32
- })));
33
- error[_errors.ErrorReported] = true;
34
- return error;
35
- });
36
- }
37
- function reportSentry(error, extras) {
38
- return _effectApp.Effect.sync(() => {
39
- const scope = new Sentry.Scope();
40
- if (extras) scope.setContext("extras", extras);
41
- scope.setContext("error", (0, _errors.tryToReport)(error));
42
- scope.setContext("cause", (0, _errors.tryToJson)(error.originalCause));
43
- Sentry.captureException(error, scope);
44
- });
45
- }
46
- function logError(name) {
47
- return (cause, extras) => _effectApp.Effect.gen(function* () {
48
- if (_effectApp.Cause.isInterruptedOnly(cause)) {
49
- yield* _effectApp.Effect.logDebug("Interrupted").pipe(_effectApp.Effect.annotateLogs((0, _utils.dropUndefined)({
50
- extras
51
- })));
52
- return;
53
- }
54
- yield* _effectApp.Effect.logWarning("Logging error", cause).pipe(_effectApp.Effect.annotateLogs((0, _utils.dropUndefined)({
55
- extras,
56
- cause: (0, _errors.tryToJson)(cause),
57
- __error_name__: name
58
- })));
59
- });
60
- }
61
- function captureException(error) {
62
- Sentry.captureException(error);
63
- console.error(error);
64
- }
65
- function reportMessage(message, extras) {
66
- return _effectApp.Effect.sync(() => {
67
- const scope = new Sentry.Scope();
68
- if (extras) scope.setContext("extras", extras);
69
- Sentry.captureMessage(message, scope);
70
- console.warn(message);
71
- });
72
- }
73
- //# sourceMappingURL=errorReporter.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errorReporter.cjs","names":["Sentry","_interopRequireWildcard","require","_effectApp","_errors","_utils","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","reportError","name","cause","extras","Effect","gen","Cause","isInterruptedOnly","logDebug","pipe","annotateLogs","JSON","stringify","squash","error","CauseException","reportSentry","logError","dropUndefined","tryToReport","tryToJson","__error_name__","ErrorReported","sync","scope","Scope","setContext","originalCause","captureException","logWarning","console","reportMessage","message","captureMessage","warn"],"sources":["../src/errorReporter.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;AAEA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAgD,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA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,aAAaA,CAACC,OAAe,EAAE7B,MAAgC;EAC7E,OAAOC,iBAAM,CAACmB,IAAI,CAAC,MAAK;IACtB,MAAMC,KAAK,GAAG,IAAIlD,MAAM,CAACmD,KAAK,EAAE;IAChC,IAAItB,MAAM,EAAEqB,KAAK,CAACE,UAAU,CAAC,QAAQ,EAAEvB,MAAM,CAAC;IAC9C7B,MAAM,CAAC2D,cAAc,CAACD,OAAO,EAAER,KAAK,CAAC;IAErCM,OAAO,CAACI,IAAI,CAACF,OAAO,CAAC;EACvB,CAAC,CAAC;AACJ","ignoreList":[]}
package/_cjs/form.cjs DELETED
@@ -1,287 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.buildFieldInfoFromFields = buildFieldInfoFromFields;
7
- exports.buildFieldInfoFromFieldsRoot = buildFieldInfoFromFieldsRoot;
8
- exports.buildFormFromSchema = void 0;
9
- exports.convertIn = convertIn;
10
- exports.convertOut = convertOut;
11
- exports.convertOutInt = convertOutInt;
12
- exports.customSchemaErrors = void 0;
13
- exports.getMetadataFromSchema = getMetadataFromSchema;
14
- exports.translate = void 0;
15
- var _intl = require("@formatjs/intl");
16
- var JSONSchema = _interopRequireWildcard(require("effect/JSONSchema"));
17
- var _effectApp = require("effect-app");
18
- var _vue = require("vue");
19
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
20
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
- // type GetSchemaFromProp<T> = T extends Field<infer S, any, any, any> ? S
22
- // : never
23
- function getTypeLiteralAST(ast) {
24
- switch (ast._tag) {
25
- case "TypeLiteral":
26
- {
27
- return ast;
28
- }
29
- case "Transformation":
30
- {
31
- // this may be not correct for transformations from a type literal to something
32
- // that is not a type literal nor a class because we would prefer the from AST
33
- return getTypeLiteralAST(ast.to) ?? getTypeLiteralAST(ast.from);
34
- }
35
- default:
36
- {
37
- return null;
38
- }
39
- }
40
- }
41
- function convertIn(v, type) {
42
- return v === null ? "" : type === "text" ? v : `${v}`;
43
- }
44
- function convertOutInt(v, type) {
45
- v = v == null ? v : v.trim();
46
- const c = v === "" ? null : type === "float" ? parseFloat(v) : type === "int" ? parseInt(v) : v;
47
- return c;
48
- }
49
- function convertOut(v, set, type) {
50
- return set(convertOutInt(v, type));
51
- }
52
- const f = Symbol();
53
- function handlePropertySignature(propertySignature) {
54
- const schema = _effectApp.S.make(propertySignature.type);
55
- switch (schema.ast._tag) {
56
- case "Transformation":
57
- {
58
- const tl = getTypeLiteralAST(schema.ast);
59
- return tl ? handlePropertySignature(new _effectApp.S.AST.PropertySignature(propertySignature.name, tl, propertySignature.isOptional, propertySignature.isReadonly, propertySignature.annotations)) : buildFieldInfo(propertySignature);
60
- }
61
- case "TypeLiteral":
62
- {
63
- return buildFieldInfoFromFieldsRoot(schema);
64
- }
65
- case "Union":
66
- {
67
- const allTypeLiterals = schema.ast.types.every(getTypeLiteralAST);
68
- if (allTypeLiterals) {
69
- const members = schema.ast.types.map(elAst =>
70
- // syntehtic property signature as if each union member were the only member
71
- new _effectApp.S.AST.PropertySignature(propertySignature.name, elAst, propertySignature.isOptional, propertySignature.isReadonly, propertySignature.annotations)).flatMap(ps => {
72
- // try to retrieve the _tag literal to set _infoTag later
73
- const typeLiteral = getTypeLiteralAST(ps.type);
74
- const tagPropertySignature = typeLiteral?.propertySignatures.find(_ => _.name === "_tag");
75
- const tagLiteral = tagPropertySignature && _effectApp.S.AST.isLiteral(tagPropertySignature.type) && typeof tagPropertySignature.type.literal === "string" ? tagPropertySignature.type.literal : void 0;
76
- const toRet = handlePropertySignature(ps);
77
- if (toRet._tag === "UnionFieldInfo") {
78
- return toRet.members;
79
- } else if (toRet._tag === "NestedFieldInfo") {
80
- return [{
81
- ...toRet,
82
- _infoTag: tagLiteral
83
- }];
84
- } else if (toRet._tag === "DiscriminatedUnionFieldInfo") {
85
- return Object.values(toRet.members);
86
- } else {
87
- return [toRet];
88
- }
89
- });
90
- // support only _tag as discriminating key and it has to be a string
91
- const isDiscriminatedUnion = members.every(_ => _._tag === "NestedFieldInfo" && _._infoTag !== undefined);
92
- if (isDiscriminatedUnion) {
93
- return {
94
- members: members.reduce((acc, cur) => {
95
- // see the definiton of isDiscriminatedUnion
96
- const tag = cur._infoTag;
97
- acc[tag] = cur;
98
- return acc;
99
- }, {}),
100
- _tag: "DiscriminatedUnionFieldInfo"
101
- };
102
- } else {
103
- return {
104
- members,
105
- _tag: "UnionFieldInfo"
106
- };
107
- }
108
- } else {
109
- return buildFieldInfo(propertySignature);
110
- }
111
- }
112
- default:
113
- {
114
- return buildFieldInfo(propertySignature);
115
- }
116
- }
117
- }
118
- function buildFieldInfoFromFields(schema) {
119
- return buildFieldInfoFromFieldsRoot(schema).fields;
120
- }
121
- function buildFieldInfoFromFieldsRoot(schema) {
122
- const ast = getTypeLiteralAST(schema.ast);
123
- if (!ast) throw new Error("not a struct type");
124
- return ast.propertySignatures.reduce((acc, cur) => {
125
- ;
126
- acc.fields[cur.name] = handlePropertySignature(cur);
127
- return acc;
128
- }, {
129
- _tag: "NestedFieldInfo",
130
- fields: {}
131
- });
132
- }
133
- class PhantomTypeParameter {}
134
- const defaultIntl = (0, _intl.createIntl)({
135
- locale: "en"
136
- });
137
- const translate = exports.translate = (0, _vue.ref)(defaultIntl.formatMessage);
138
- const customSchemaErrors = exports.customSchemaErrors = (0, _vue.ref)(new Map());
139
- function buildFieldInfo(property) {
140
- const propertyKey = property.name;
141
- const schema = _effectApp.S.make(property.type);
142
- const metadata = getMetadataFromSchema(property.type); // TODO
143
- const parse = _effectApp.S.decodeUnknownEither(schema);
144
- const nullableOrUndefined = _effectApp.S.AST.isUnion(property.type) && (property.type.types.includes(_effectApp.S.Null.ast) || property.type.types.some(_ => _._tag === "UndefinedKeyword"));
145
- const realSelf = nullableOrUndefined && _effectApp.S.AST.isUnion(property.type) ? property.type.types.filter(_ => _ !== _effectApp.S.Null.ast && _._tag !== "UndefinedKeyword")[0] : property.type;
146
- const id = _effectApp.S.AST.getIdentifierAnnotation(property.type);
147
- const id2 = _effectApp.S.AST.getIdentifierAnnotation(realSelf);
148
- function renderError(e, v) {
149
- const err = e.toString();
150
- const custom = customSchemaErrors.value.get(property.type) ?? customSchemaErrors.value.get(realSelf) ?? (_effectApp.Option.isSome(id) ? customSchemaErrors.value.get(id.value) : undefined) ?? (_effectApp.Option.isSome(id2) ? customSchemaErrors.value.get(id2.value) : undefined);
151
- return custom ? custom(err, e, v) : translate.value({
152
- defaultMessage: "The entered value is not a valid {type}: {message}",
153
- id: "validation.not_a_valid"
154
- }, {
155
- type: translate.value({
156
- defaultMessage: (0, _vue.capitalize)(propertyKey.toString()),
157
- id: `fieldNames.${String(propertyKey)}`
158
- }),
159
- message: metadata.description ? "expected " + metadata.description : err.slice(err.indexOf("Expected")) // TODO: this is not translated.
160
- });
161
- }
162
- const stringRules = [v => v === null || metadata.minLength === undefined || v.length >= metadata.minLength || translate.value({
163
- defaultMessage: "The field requires at least {minLength} characters",
164
- id: "validation.string.minLength"
165
- }, {
166
- minLength: metadata.minLength
167
- }), v => v === null || metadata.maxLength === undefined || v.length <= metadata.maxLength || translate.value({
168
- defaultMessage: "The field cannot have more than {maxLength} characters",
169
- id: "validation.string.maxLength"
170
- }, {
171
- maxLength: metadata.maxLength
172
- })];
173
- const numberRules = [v => v === null || metadata.minimum === undefined && metadata.exclusiveMinimum === undefined || metadata.exclusiveMinimum !== undefined && v > metadata.exclusiveMinimum || metadata.minimum !== undefined && v >= metadata.minimum || translate.value({
174
- defaultMessage: "The value should be {isExclusive, select, true {larger than} other {at least}} {minimum}",
175
- id: "validation.number.min"
176
- }, {
177
- isExclusive: metadata.exclusiveMinimum !== undefined,
178
- minimum: metadata.exclusiveMinimum ?? metadata.minimum
179
- }), v => v === null || metadata.maximum === undefined && metadata.exclusiveMaximum === undefined || metadata.exclusiveMaximum !== undefined && v < metadata.exclusiveMaximum || metadata.maximum !== undefined && v <= metadata.maximum || translate.value({
180
- defaultMessage: "The value should be {isExclusive, select, true {smaller than} other {at most}} {maximum}",
181
- id: "validation.number.max"
182
- }, {
183
- isExclusive: metadata.exclusiveMaximum !== undefined,
184
- maximum: metadata.exclusiveMaximum ?? metadata.maximum
185
- })];
186
- const parseRule = v => (0, _effectApp.pipe)(parse(v), _effectApp.Either.match({
187
- onLeft: _ => renderError(_, v),
188
- onRight: () => true
189
- }));
190
- const rules = [...(metadata.type === "text" ? stringRules : metadata.type === "float" || metadata.type === "int" ? numberRules : []), parseRule];
191
- const info = {
192
- type: metadata.type,
193
- rules: [v => !metadata.required || v !== "" || translate.value({
194
- defaultMessage: "The field cannot be empty",
195
- id: "validation.empty"
196
- }), v => {
197
- const converted = convertOutInt(v, metadata.type);
198
- for (const r of rules) {
199
- const res = r(converted);
200
- if (res !== true) {
201
- return res;
202
- }
203
- }
204
- return true;
205
- }],
206
- metadata,
207
- _tag: "FieldInfo"
208
- };
209
- return info;
210
- }
211
- const buildFormFromSchema = (s, state, onSubmit) => {
212
- const fields = buildFieldInfoFromFieldsRoot(s).fields;
213
- const parse = _effectApp.S.decodeUnknownSync(_effectApp.S.Struct(_effectApp.Struct.omit(s.fields, "_tag")));
214
- const isDirty = (0, _vue.ref)(false);
215
- const isValid = (0, _vue.ref)(true);
216
- const submit1 = onSubmit => async e => {
217
- const r = await e;
218
- if (!r.valid) return;
219
- return onSubmit(new s(parse(state.value)));
220
- };
221
- const submit = submit1(onSubmit);
222
- (0, _vue.watch)(state, v => {
223
- // TODO: do better
224
- isDirty.value = JSON.stringify(v) !== JSON.stringify(state.value);
225
- }, {
226
- deep: true
227
- });
228
- const submitFromState = () => submit(Promise.resolve({
229
- valid: isValid.value
230
- }));
231
- return {
232
- fields,
233
- /** optimized for Vuetify v-form submit callback */
234
- submit,
235
- /** optimized for Native form submit callback or general use */
236
- submitFromState,
237
- isDirty,
238
- isValid
239
- };
240
- };
241
- exports.buildFormFromSchema = buildFormFromSchema;
242
- function getMetadataFromSchema(ast) {
243
- const nullable = _effectApp.S.AST.isUnion(ast) && ast.types.includes(_effectApp.S.Null.ast);
244
- const realSelf = nullable && _effectApp.S.AST.isUnion(ast) ? ast.types.filter(_ => _ !== _effectApp.S.Null.ast)[0] : ast;
245
- let jschema;
246
- try {
247
- jschema = JSONSchema.make(_effectApp.S.make(realSelf));
248
- } catch (err) {
249
- jschema = {};
250
- // console.warn("error getting jsonschema from ", err, ast)
251
- }
252
- while (jschema["$ref"] && jschema["$ref"].startsWith("#/$defs/")) {
253
- const {
254
- $ref: _,
255
- ...rest
256
- } = jschema;
257
- jschema = {
258
- ...jschema["$defs"][jschema["$ref"].replace("#/$defs/", "")],
259
- ...rest
260
- };
261
- }
262
- // or we need to add these info directly in the refinement like the minimum
263
- // or find a jsonschema parser whojoins all of them
264
- // todo, we have to use $ref: "#/$defs/Int"
265
- // and look up
266
- // $defs: {
267
- // "Int": {
268
- // "type": "integer", <--- integer!!
269
- // "description": "an integer",
270
- // "title": "Int"
271
- // }
272
- // }
273
- const isNumber = jschema.type === "number" || jschema.type === "integer";
274
- const isInt = jschema.type === "integer";
275
- return {
276
- type: isInt ? "int" : isNumber ? "float" : "text",
277
- minimum: jschema.minimum,
278
- exclusiveMinimum: jschema.exclusiveMinimum,
279
- maximum: jschema.maximum,
280
- exclusiveMaximum: jschema.exclusiveMaximum,
281
- minLength: jschema.minLength,
282
- maxLength: jschema.maxLength,
283
- description: jschema.description,
284
- required: !nullable
285
- };
286
- }
287
- //# sourceMappingURL=form.cjs.map
package/_cjs/form.cjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"form.cjs","names":["_intl","require","JSONSchema","_interopRequireWildcard","_effectApp","_vue","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","getTypeLiteralAST","ast","_tag","to","from","convertIn","v","type","convertOutInt","trim","c","parseFloat","parseInt","convertOut","f","Symbol","handlePropertySignature","propertySignature","schema","S","make","tl","AST","PropertySignature","name","isOptional","isReadonly","annotations","buildFieldInfo","buildFieldInfoFromFieldsRoot","allTypeLiterals","types","every","members","map","elAst","flatMap","ps","typeLiteral","tagPropertySignature","propertySignatures","find","_","tagLiteral","isLiteral","literal","toRet","_infoTag","values","isDiscriminatedUnion","undefined","reduce","acc","cur","tag","buildFieldInfoFromFields","fields","Error","PhantomTypeParameter","defaultIntl","createIntl","locale","translate","exports","ref","formatMessage","customSchemaErrors","Map","property","propertyKey","metadata","getMetadataFromSchema","parse","decodeUnknownEither","nullableOrUndefined","isUnion","includes","Null","some","realSelf","filter","id","getIdentifierAnnotation","id2","renderError","err","toString","custom","value","Option","isSome","defaultMessage","capitalize","String","message","description","slice","indexOf","stringRules","minLength","length","maxLength","numberRules","minimum","exclusiveMinimum","isExclusive","maximum","exclusiveMaximum","parseRule","pipe","Either","match","onLeft","onRight","rules","info","required","converted","res","buildFormFromSchema","s","state","onSubmit","decodeUnknownSync","Struct","omit","isDirty","isValid","submit1","valid","submit","watch","JSON","stringify","deep","submitFromState","Promise","resolve","nullable","jschema","startsWith","$ref","rest","replace","isNumber","isInt"],"sources":["../src/form.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,uBAAA,CAAAF,OAAA;AAGA,IAAAG,UAAA,GAAAH,OAAA;AAKA,IAAAI,IAAA,GAAAJ,OA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s/index.cjs DELETED
@@ -1,83 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _lib = require("./lib.cjs");
7
- Object.keys(_lib).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _lib[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _lib[key];
14
- }
15
- });
16
- });
17
- var _makeClient = require("./makeClient.cjs");
18
- Object.keys(_makeClient).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _makeClient[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _makeClient[key];
25
- }
26
- });
27
- });
28
- var _makeContext = require("./makeContext.cjs");
29
- Object.keys(_makeContext).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _makeContext[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _makeContext[key];
36
- }
37
- });
38
- });
39
- var _makeIntl = require("./makeIntl.cjs");
40
- Object.keys(_makeIntl).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _makeIntl[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function () {
46
- return _makeIntl[key];
47
- }
48
- });
49
- });
50
- var _mutate = require("./mutate.cjs");
51
- Object.keys(_mutate).forEach(function (key) {
52
- if (key === "default" || key === "__esModule") return;
53
- if (key in exports && exports[key] === _mutate[key]) return;
54
- Object.defineProperty(exports, key, {
55
- enumerable: true,
56
- get: function () {
57
- return _mutate[key];
58
- }
59
- });
60
- });
61
- var _query = require("./query.cjs");
62
- Object.keys(_query).forEach(function (key) {
63
- if (key === "default" || key === "__esModule") return;
64
- if (key in exports && exports[key] === _query[key]) return;
65
- Object.defineProperty(exports, key, {
66
- enumerable: true,
67
- get: function () {
68
- return _query[key];
69
- }
70
- });
71
- });
72
- var _runtime = require("./runtime.cjs");
73
- Object.keys(_runtime).forEach(function (key) {
74
- if (key === "default" || key === "__esModule") return;
75
- if (key in exports && exports[key] === _runtime[key]) return;
76
- Object.defineProperty(exports, key, {
77
- enumerable: true,
78
- get: function () {
79
- return _runtime[key];
80
- }
81
- });
82
- });
83
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":["_lib","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_makeClient","_makeContext","_makeIntl","_mutate","_query","_runtime"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,IAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,IAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,IAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AAEA,IAAAK,WAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,WAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,WAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,WAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,YAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,YAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,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