effect-app 0.152.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/.eslintrc.cjs +11 -0
- package/.prettierignore +6 -0
- package/CHANGELOG.md +4106 -0
- package/_cjs/Config/SecretURL.cjs +58 -0
- package/_cjs/Config/SecretURL.cjs.map +1 -0
- package/_cjs/Config/internal/configSecretURL.cjs +88 -0
- package/_cjs/Config/internal/configSecretURL.cjs.map +1 -0
- package/_cjs/Inputify.type.cjs +6 -0
- package/_cjs/Inputify.type.cjs.map +1 -0
- package/_cjs/Operations.cjs +76 -0
- package/_cjs/Operations.cjs.map +1 -0
- package/_cjs/Pure.cjs +201 -0
- package/_cjs/Pure.cjs.map +1 -0
- package/_cjs/Request.cjs +76 -0
- package/_cjs/Request.cjs.map +1 -0
- package/_cjs/Widen.type.cjs +6 -0
- package/_cjs/Widen.type.cjs.map +1 -0
- package/_cjs/_ext/date.cjs +64 -0
- package/_cjs/_ext/date.cjs.map +1 -0
- package/_cjs/_ext/misc.cjs +121 -0
- package/_cjs/_ext/misc.cjs.map +1 -0
- package/_cjs/_global.cjs +24 -0
- package/_cjs/_global.cjs.map +1 -0
- package/_cjs/_global.ext.cjs +5 -0
- package/_cjs/_global.ext.cjs.map +1 -0
- package/_cjs/_global.schema.cjs +4 -0
- package/_cjs/_global.schema.cjs.map +1 -0
- package/_cjs/client/QueryResult.cjs +116 -0
- package/_cjs/client/QueryResult.cjs.map +1 -0
- package/_cjs/client/clientFor.cjs +159 -0
- package/_cjs/client/clientFor.cjs.map +1 -0
- package/_cjs/client/config.cjs +21 -0
- package/_cjs/client/config.cjs.map +1 -0
- package/_cjs/client/errors.cjs +116 -0
- package/_cjs/client/errors.cjs.map +1 -0
- package/_cjs/client/fetch.cjs +178 -0
- package/_cjs/client/fetch.cjs.map +1 -0
- package/_cjs/client.cjs +61 -0
- package/_cjs/client.cjs.map +1 -0
- package/_cjs/faker.cjs +31 -0
- package/_cjs/faker.cjs.map +1 -0
- package/_cjs/ids.cjs +24 -0
- package/_cjs/ids.cjs.map +1 -0
- package/_cjs/index.cjs +27 -0
- package/_cjs/index.cjs.map +1 -0
- package/_cjs/refinements.cjs +97 -0
- package/_cjs/refinements.cjs.map +1 -0
- package/_cjs/schema.cjs +50 -0
- package/_cjs/schema.cjs.map +1 -0
- package/_cjs/schema.test.cjs +9 -0
- package/_cjs/schema.test.cjs.map +1 -0
- package/_cjs/service.cjs +97 -0
- package/_cjs/service.cjs.map +1 -0
- package/_cjs/utils.cjs +17 -0
- package/_cjs/utils.cjs.map +1 -0
- package/_src/Config/SecretURL.ts +103 -0
- package/_src/Config/internal/configSecretURL.ts +85 -0
- package/_src/Inputify.type.ts +13 -0
- package/_src/Operations.ts +70 -0
- package/_src/Pure.ts +525 -0
- package/_src/Request.ts +106 -0
- package/_src/Widen.type.ts +28 -0
- package/_src/_ext/date.ts +84 -0
- package/_src/_ext/misc.ts +161 -0
- package/_src/_global/stm.ts.bak +35 -0
- package/_src/_global.ext.ts +3 -0
- package/_src/_global.schema.ts +106 -0
- package/_src/_global.ts +119 -0
- package/_src/client/QueryResult.ts +120 -0
- package/_src/client/clientFor.ts +260 -0
- package/_src/client/config.ts +13 -0
- package/_src/client/errors.ts +129 -0
- package/_src/client/fetch.ts +253 -0
- package/_src/client.ts +7 -0
- package/_src/faker.ts +32 -0
- package/_src/ids.ts +35 -0
- package/_src/index.ts +4 -0
- package/_src/refinements.ts +92 -0
- package/_src/schema/_schema.ts.bak +208 -0
- package/_src/schema/api/date.ts.bak +78 -0
- package/_src/schema/api.ts.bak +20 -0
- package/_src/schema/overrides.ts.bak +76 -0
- package/_src/schema/shared.ts.bak +334 -0
- package/_src/schema.test.ts +3 -0
- package/_src/schema.ts +37 -0
- package/_src/service.ts +119 -0
- package/_src/utils.ts +1 -0
- package/dist/Config/SecretURL.d.ts +82 -0
- package/dist/Config/SecretURL.d.ts.map +1 -0
- package/dist/Config/SecretURL.js +49 -0
- package/dist/Config/internal/configSecretURL.d.ts +24 -0
- package/dist/Config/internal/configSecretURL.d.ts.map +1 -0
- package/dist/Config/internal/configSecretURL.js +75 -0
- package/dist/Inputify.type.d.ts +10 -0
- package/dist/Inputify.type.d.ts.map +1 -0
- package/dist/Inputify.type.js +2 -0
- package/dist/Operations.d.ts +170 -0
- package/dist/Operations.d.ts.map +1 -0
- package/dist/Operations.js +87 -0
- package/dist/Pure.d.ts +169 -0
- package/dist/Pure.d.ts.map +1 -0
- package/dist/Pure.js +167 -0
- package/dist/Request.d.ts +49 -0
- package/dist/Request.d.ts.map +1 -0
- package/dist/Request.js +58 -0
- package/dist/Widen.type.d.ts +19 -0
- package/dist/Widen.type.d.ts.map +1 -0
- package/dist/Widen.type.js +2 -0
- package/dist/_ext/date.d.ts +71 -0
- package/dist/_ext/date.d.ts.map +1 -0
- package/dist/_ext/date.js +58 -0
- package/dist/_ext/misc.d.ts +77 -0
- package/dist/_ext/misc.d.ts.map +1 -0
- package/dist/_ext/misc.js +98 -0
- package/dist/_global.d.ts +70 -0
- package/dist/_global.d.ts.map +1 -0
- package/dist/_global.ext.d.ts +3 -0
- package/dist/_global.ext.d.ts.map +1 -0
- package/dist/_global.ext.js +4 -0
- package/dist/_global.js +76 -0
- package/dist/_global.schema.d.ts +6 -0
- package/dist/_global.schema.d.ts.map +1 -0
- package/dist/_global.schema.js +6 -0
- package/dist/client/QueryResult.d.ts +85 -0
- package/dist/client/QueryResult.d.ts.map +1 -0
- package/dist/client/QueryResult.js +85 -0
- package/dist/client/clientFor.d.ts +44 -0
- package/dist/client/clientFor.d.ts.map +1 -0
- package/dist/client/clientFor.js +144 -0
- package/dist/client/config.d.ts +14 -0
- package/dist/client/config.d.ts.map +1 -0
- package/dist/client/config.js +11 -0
- package/dist/client/errors.d.ts +206 -0
- package/dist/client/errors.d.ts.map +1 -0
- package/dist/client/errors.js +130 -0
- package/dist/client/fetch.d.ts +61 -0
- package/dist/client/fetch.d.ts.map +1 -0
- package/dist/client/fetch.js +127 -0
- package/dist/client.d.ts +6 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +7 -0
- package/dist/faker.d.ts +7 -0
- package/dist/faker.d.ts.map +1 -0
- package/dist/faker.js +24 -0
- package/dist/ids.d.ts +32 -0
- package/dist/ids.d.ts.map +1 -0
- package/dist/ids.js +17 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/refinements.d.ts +57 -0
- package/dist/refinements.d.ts.map +1 -0
- package/dist/refinements.js +85 -0
- package/dist/schema.d.ts +7 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +22 -0
- package/dist/schema.test.d.ts.map +1 -0
- package/dist/service.d.ts +47 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +83 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +2 -0
- package/package.json +315 -0
- package/tsconfig.json +114 -0
- package/tsconfig.json.bak +47 -0
- package/tsplus.config.json +7 -0
- package/vitest.config.ts +5 -0
- package/wallaby.cjs +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.cjs","names":["_dateFns","require","DateAddDays","exports","addDays","DateSubDays","subDays","DateAddHours","addHours","DateSubHours","subHours","DateAddMinutes","addMinutes","DateSubMinutes","subMinutes","DateAddSeconds","addSeconds","DateSubSeconds","subSeconds","DateAddYears","addYears","DateSubYears","subYears","DateAddMonths","addMonths","DateSubMonths","subMonths","DateAddWeeks","addWeeks","DateSubWeeks","subWeeks"],"sources":["../../_src/_ext/date.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAiBA;;;AAGO,MAAMC,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAyCE,gBAAO;AACxE;;;AAGO,MAAMC,WAAW,GAAAF,OAAA,CAAAE,WAAA,GAAyCC,gBAAO;AAExE;;;AAGO,MAAMC,YAAY,GAAAJ,OAAA,CAAAI,YAAA,GAAyCC,iBAAQ;AAC1E;;;AAGO,MAAMC,YAAY,GAAAN,OAAA,CAAAM,YAAA,GAAyCC,iBAAQ;AAE1E;;;AAGO,MAAMC,cAAc,GAAAR,OAAA,CAAAQ,cAAA,GAAyCC,mBAAU;AAE9E;;;AAGO,MAAMC,cAAc,GAAAV,OAAA,CAAAU,cAAA,GAAyCC,mBAAU;AAE9E;;;AAGO,MAAMC,cAAc,GAAAZ,OAAA,CAAAY,cAAA,GAAyCC,mBAAU;AAE9E;;;AAGO,MAAMC,cAAc,GAAAd,OAAA,CAAAc,cAAA,GAAyCC,mBAAU;AAE9E;;;AAGO,MAAMC,YAAY,GAAAhB,OAAA,CAAAgB,YAAA,GAAyCC,iBAAQ;AAE1E;;;AAGO,MAAMC,YAAY,GAAAlB,OAAA,CAAAkB,YAAA,GAAyCC,iBAAQ;AAE1E;;;AAGO,MAAMC,aAAa,GAAApB,OAAA,CAAAoB,aAAA,GAAyCC,kBAAS;AAE5E;;;AAGO,MAAMC,aAAa,GAAAtB,OAAA,CAAAsB,aAAA,GAAyCC,kBAAS;AAE5E;;;AAGO,MAAMC,YAAY,GAAAxB,OAAA,CAAAwB,YAAA,GAAyCC,iBAAQ;AAE1E;;;AAGO,MAAMC,YAAY,GAAA1B,OAAA,CAAA0B,YAAA,GAAyCC,iBAAQ"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.annotateLogs = annotateLogs;
|
|
7
|
+
exports.annotateLogsScoped = annotateLogsScoped;
|
|
8
|
+
exports.annotateLogscoped = annotateLogscoped;
|
|
9
|
+
exports.catchAllMap = catchAllMap;
|
|
10
|
+
exports.client = void 0;
|
|
11
|
+
exports.encaseMaybeEither_ = encaseMaybeEither_;
|
|
12
|
+
exports.encaseMaybeInEffect_ = encaseMaybeInEffect_;
|
|
13
|
+
exports.flatMapScoped = flatMapScoped;
|
|
14
|
+
exports.flow = flow;
|
|
15
|
+
exports.scope = scope;
|
|
16
|
+
exports.toNullable = toNullable;
|
|
17
|
+
var tsplus_module_1 = _interopRequireWildcard(require("effect/Effect"));
|
|
18
|
+
var tsplus_module_2 = _interopRequireWildcard(require("effect/Option"));
|
|
19
|
+
var tsplus_module_3 = _interopRequireWildcard(require("@effect-app/core/utils"));
|
|
20
|
+
var tsplus_module_4 = _interopRequireWildcard(require("effect/HashMap"));
|
|
21
|
+
var tsplus_module_5 = _interopRequireWildcard(require("effect/FiberRef"));
|
|
22
|
+
var tsplus_module_6 = _interopRequireWildcard(require("@effect-app/core/Function"));
|
|
23
|
+
var Either = _interopRequireWildcard(require("effect/Either"));
|
|
24
|
+
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); }
|
|
25
|
+
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 && Object.prototype.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; }
|
|
26
|
+
/**
|
|
27
|
+
* @tsplus fluent effect/data/Option encaseInEffect
|
|
28
|
+
*/
|
|
29
|
+
function encaseMaybeInEffect_(o, onError) {
|
|
30
|
+
return tsplus_module_2.match(o, {
|
|
31
|
+
onNone: () => tsplus_module_1.fail(onError()),
|
|
32
|
+
onSome: tsplus_module_1.succeed
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @tsplus fluent effect/data/Option encaseInEither
|
|
37
|
+
*/
|
|
38
|
+
function encaseMaybeEither_(o, onError) {
|
|
39
|
+
return tsplus_module_2.match(o, {
|
|
40
|
+
onNone: () => Either.left(onError()),
|
|
41
|
+
onSome: Either.right
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @tsplus getter effect/io/Effect toNullable
|
|
46
|
+
*/
|
|
47
|
+
function toNullable(self) {
|
|
48
|
+
return tsplus_module_1.map(self, _ => tsplus_module_2.getOrNull(_));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @tsplus fluent effect/io/Effect scope
|
|
52
|
+
*/
|
|
53
|
+
function scope(scopedEffect, effect) {
|
|
54
|
+
return tsplus_module_1.scoped(tsplus_module_1.zipRight(scopedEffect, effect));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @tsplus fluent effect/io/Effect flatMapScoped
|
|
58
|
+
*/
|
|
59
|
+
function flatMapScoped(scopedEffect, effect) {
|
|
60
|
+
return tsplus_module_1.scoped(tsplus_module_1.flatMap(scopedEffect, effect));
|
|
61
|
+
}
|
|
62
|
+
// /**
|
|
63
|
+
// * @tsplus fluent effect/io/Effect withScoped
|
|
64
|
+
// */
|
|
65
|
+
// export function withScoped<R, E, A, R2, E2, A2>(
|
|
66
|
+
// effect: Effect<R2, E2, A2>,
|
|
67
|
+
// scopedEffect: Effect<R | Scope, E, A>
|
|
68
|
+
// ): Effect<Exclude<R | R2, Scope>, E | E2, A2> {
|
|
69
|
+
// return scopedEffect.zipRight(effect).scoped
|
|
70
|
+
// }
|
|
71
|
+
// /**
|
|
72
|
+
// * @tsplus fluent effect/io/Effect withScoped
|
|
73
|
+
// */
|
|
74
|
+
// export function withScopedFlatMap<R, E, A, R2, E2, A2>(
|
|
75
|
+
// effect: (a: A) => Effect<R2, E2, A2>,
|
|
76
|
+
// scopedEffect: Effect<R | Scope, E, A>
|
|
77
|
+
// ): Effect<Exclude<R | R2, Scope>, E | E2, A2> {
|
|
78
|
+
// return scopedEffect.flatMap(effect).scoped
|
|
79
|
+
// }
|
|
80
|
+
/**
|
|
81
|
+
* Recovers from all errors.
|
|
82
|
+
*
|
|
83
|
+
* @tsplus static effect/io/Effect.Ops catchAllMap
|
|
84
|
+
* @tsplus pipeable effect/io/Effect catchAllMap
|
|
85
|
+
*/
|
|
86
|
+
function catchAllMap(f) {
|
|
87
|
+
return self => tsplus_module_1.catchAll(self, err => tsplus_module_1.sync(() => f(err)));
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Annotates each log in this effect with the specified log annotations.
|
|
91
|
+
* @tsplus static effect/io/Effect.Ops annotateLogs
|
|
92
|
+
*/
|
|
93
|
+
function annotateLogs(kvps) {
|
|
94
|
+
return effect => tsplus_module_1.flatMap(tsplus_module_5.get(tsplus_module_5.currentLogAnnotations), annotations => tsplus_module_1.suspend(() => tsplus_module_6.pipe(effect, tsplus_module_1.locally(tsplus_module_5.currentLogAnnotations, tsplus_module_4.fromIterable([...annotations, ...tsplus_module_3.RecordEntries(tsplus_module_3.object$(kvps))])))));
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Annotates each log in this scope with the specified log annotation.
|
|
98
|
+
*
|
|
99
|
+
* @tsplus static effect/io/Effect.Ops annotateLogscoped
|
|
100
|
+
*/
|
|
101
|
+
function annotateLogscoped(key, value) {
|
|
102
|
+
return tsplus_module_1.flatMap(tsplus_module_5.get(tsplus_module_5.currentLogAnnotations), annotations => tsplus_module_1.suspend(() => tsplus_module_1.locallyScoped(tsplus_module_5.currentLogAnnotations, tsplus_module_4.set(annotations, key, value))));
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Annotates each log in this scope with the specified log annotations.
|
|
106
|
+
*
|
|
107
|
+
* @tsplus static effect/io/Effect.Ops annotateLogsScoped
|
|
108
|
+
*/
|
|
109
|
+
function annotateLogsScoped(kvps) {
|
|
110
|
+
return tsplus_module_1.flatMap(tsplus_module_5.get(tsplus_module_5.currentLogAnnotations), annotations => tsplus_module_1.suspend(() => tsplus_module_1.locallyScoped(tsplus_module_5.currentLogAnnotations, tsplus_module_4.fromIterable([...annotations, ...tsplus_module_3.RecordEntries(tsplus_module_3.object$(kvps))]))));
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* @tsplus fluent function flow
|
|
114
|
+
*/
|
|
115
|
+
function flow(f, g) {
|
|
116
|
+
return (...args) => g(f(...args));
|
|
117
|
+
}
|
|
118
|
+
/** @tsplus fluent effect/platform/Http/Client request */
|
|
119
|
+
const client = (client, req) => tsplus_module_1.isEffect(req) ? tsplus_module_1.flatMap(req, client) : client(req);
|
|
120
|
+
exports.client = client;
|
|
121
|
+
//# sourceMappingURL=misc.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"misc.cjs","names":["Either","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","encaseMaybeInEffect_","o","onError","tsplus_module_2","match","onNone","tsplus_module_1","fail","onSome","succeed","encaseMaybeEither_","left","right","toNullable","self","map","_","getOrNull","scope","scopedEffect","effect","scoped","zipRight","flatMapScoped","flatMap","catchAllMap","f","catchAll","err","sync","annotateLogs","kvps","tsplus_module_5","currentLogAnnotations","annotations","suspend","tsplus_module_6","pipe","locally","tsplus_module_4","fromIterable","tsplus_module_3","RecordEntries","object$","annotateLogscoped","key","value","locallyScoped","annotateLogsScoped","flow","g","args","client","req","isEffect","exports"],"sources":["../../_src/_ext/misc.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAuC,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,C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AgD,QAAA,CAAgBD,GAAG,CAAC,GAChB/C,eAAA,CAAAkB,OAAA,CAAA6B,GAAG,EAASD,MAAM,CAAC,GACnBA,MAAM,CAACC,GAAG,CAAC;AAAAE,OAAA,CAAAH,MAAA,GAAAA,MAAA"}
|
package/_cjs/_global.cjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("effect/Runtime");
|
|
4
|
+
require("effect/Config");
|
|
5
|
+
require("effect-app/Config/SecretURL");
|
|
6
|
+
require("effect/Secret");
|
|
7
|
+
require("effect/ConfigError");
|
|
8
|
+
require("effect/ConfigProvider");
|
|
9
|
+
require("effect/Cache");
|
|
10
|
+
require("effect/Request");
|
|
11
|
+
require("@effect/platform/Http/ClientRequest");
|
|
12
|
+
require("effect-app/Request");
|
|
13
|
+
require("effect/RequestResolver");
|
|
14
|
+
require("effect-app/Pure");
|
|
15
|
+
require("effect-app/utils");
|
|
16
|
+
require("effect-app");
|
|
17
|
+
require("effect-app/service");
|
|
18
|
+
require("ts-pattern");
|
|
19
|
+
require("@effect-app/core/_global");
|
|
20
|
+
require("@effect-app/core/Prelude");
|
|
21
|
+
require("@effect-app/schema/_global");
|
|
22
|
+
require("./_global.ext.cjs");
|
|
23
|
+
require("./refinements.cjs");
|
|
24
|
+
//# sourceMappingURL=_global.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_global.cjs","names":["require"],"sources":["../_src/_global.ts"],"sourcesContent":[null],"mappings":";;AASAA,OAAA;AAKAA,OAAA;AAKAA,OAAA;AAKAA,OAAA;AAKAA,OAAA;AAKAA,OAAA;AAKAA,OAAA;AAKAA,OAAA;AAKAA,OAAA;AAKAA,OAAA;AAKAA,OAAA;AAOAA,OAAA;AAKAA,OAAA;AAIAA,OAAA;AA+BAA,OAAA;AAKAA,OAAA;AAEAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEAA,OAAA;AACAA,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_global.ext.cjs","names":["require"],"sources":["../_src/_global.ext.ts"],"sourcesContent":[null],"mappings":";;AACAA,OAAA;AACAA,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_global.schema.cjs","names":["require"],"sources":["../_src/_global.schema.ts"],"sourcesContent":[null],"mappings":";;AAKAA,OAAA"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isDone = exports.hasValue = exports.fail = exports.Refreshing = exports.Loading = exports.Initial = exports.Done = void 0;
|
|
7
|
+
exports.isFailed = isFailed;
|
|
8
|
+
exports.isInitializing = isInitializing;
|
|
9
|
+
exports.isRefreshing = void 0;
|
|
10
|
+
exports.isSuccess = isSuccess;
|
|
11
|
+
exports.queryResult = queryResult;
|
|
12
|
+
exports.succeed = void 0;
|
|
13
|
+
var tsplus_module_1 = _interopRequireWildcard(require("effect"));
|
|
14
|
+
var tsplus_module_2 = _interopRequireWildcard(require("effect/Option"));
|
|
15
|
+
var tsplus_module_3 = _interopRequireWildcard(require("effect/Effect"));
|
|
16
|
+
var Either = _interopRequireWildcard(require("effect/Either"));
|
|
17
|
+
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); }
|
|
18
|
+
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 && Object.prototype.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; }
|
|
19
|
+
const hasValue = exports.hasValue = hasValue_1;
|
|
20
|
+
const isRefreshing = exports.isRefreshing = isRefreshing_1;
|
|
21
|
+
const isDone = exports.isDone = isDone_1;
|
|
22
|
+
// TODO: Convert to effect/core
|
|
23
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
24
|
+
|
|
25
|
+
class Initial extends tsplus_module_1.Data.TaggedClass("Initial") {}
|
|
26
|
+
exports.Initial = Initial;
|
|
27
|
+
class Loading extends tsplus_module_1.Data.TaggedClass("Loading") {}
|
|
28
|
+
exports.Loading = Loading;
|
|
29
|
+
class Refreshing extends tsplus_module_1.Data.TaggedClass("Refreshing") {
|
|
30
|
+
static succeed(a) {
|
|
31
|
+
return new Refreshing({
|
|
32
|
+
current: Either.right(a),
|
|
33
|
+
previous: tsplus_module_2.none()
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
static fail(e, previous) {
|
|
37
|
+
return new Refreshing({
|
|
38
|
+
current: Either.left(e),
|
|
39
|
+
previous: previous === undefined ? tsplus_module_2.none() : tsplus_module_2.some(previous)
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
static fromDone(d) {
|
|
43
|
+
return new Refreshing(d);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.Refreshing = Refreshing;
|
|
47
|
+
class Done extends tsplus_module_1.Data.TaggedClass("Done") {
|
|
48
|
+
static succeed(a) {
|
|
49
|
+
return new Done({
|
|
50
|
+
current: Either.right(a),
|
|
51
|
+
previous: tsplus_module_2.none()
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
static fail(e, previous) {
|
|
55
|
+
return new Done({
|
|
56
|
+
current: Either.left(e),
|
|
57
|
+
previous: previous === undefined ? tsplus_module_2.none() : tsplus_module_2.some(previous)
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
static refresh(d) {
|
|
61
|
+
return new Refreshing(d);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @tsplus fluent QueryResult isSuccess
|
|
66
|
+
*/
|
|
67
|
+
exports.Done = Done;
|
|
68
|
+
function isSuccess(qr) {
|
|
69
|
+
return hasValue_1(qr) && Either.isRight(qr.current);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @tsplus fluent QueryResult hasValue
|
|
73
|
+
*/
|
|
74
|
+
function hasValue_1(qr) {
|
|
75
|
+
return isDone_1(qr) || isRefreshing_1(qr);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @tsplus fluent QueryResult isRefreshing
|
|
79
|
+
*/
|
|
80
|
+
function isRefreshing_1(qr) {
|
|
81
|
+
return qr._tag === "Refreshing";
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @tsplus fluent QueryResult isDone
|
|
85
|
+
*/
|
|
86
|
+
function isDone_1(qr) {
|
|
87
|
+
return qr._tag === "Done";
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @tsplus fluent QueryResult isInitializing
|
|
91
|
+
*/
|
|
92
|
+
function isInitializing(qr) {
|
|
93
|
+
return qr._tag === "Initial" || qr._tag === "Loading";
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* @tsplus fluent QueryResult isFailed
|
|
97
|
+
*/
|
|
98
|
+
function isFailed(qr) {
|
|
99
|
+
return hasValue_1(qr) && Either.isLeft(qr.current);
|
|
100
|
+
}
|
|
101
|
+
const {
|
|
102
|
+
fail,
|
|
103
|
+
succeed
|
|
104
|
+
} = Done;
|
|
105
|
+
/**
|
|
106
|
+
* @tsplus getter effect/io/Effect asQueryResult
|
|
107
|
+
*/
|
|
108
|
+
exports.succeed = succeed;
|
|
109
|
+
exports.fail = fail;
|
|
110
|
+
function queryResult(self) {
|
|
111
|
+
return tsplus_module_3.match(self, {
|
|
112
|
+
onFailure: fail,
|
|
113
|
+
onSuccess: succeed
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=QueryResult.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryResult.cjs","names":["Either","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","hasValue","exports","hasValue_1","isRefreshing","isRefreshing_1","isDone","isDone_1","Initial","tsplus_module_1","Data","TaggedClass","Loading","Refreshing","succeed","current","right","previous","tsplus_module_2","none","fail","left","undefined","some","fromDone","d","Done","refresh","isSuccess","qr","isRight","_tag","isInitializing","isFailed","isLeft","queryResult","self","tsplus_module_3","match","onFailure","onSuccess"],"sources":["../../_src/client/QueryResult.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;AAGA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAuC,SAAAC,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,SAAAH,wBAAAG,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,IAAAH,MAAA,CAA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AA,CAAAwB,EAAE,CAAe;AACzC;AAEA;;;AAGA,SAAAxB,eACEwB,EAAqB;EAErB,OAAOA,EAAE,CAACE,IAAI,KAAK,YAAY;AACjC;AAEA;;;AAGA,SAAAxB,SACEsB,EAAqB;EAErB,OAAOA,EAAE,CAACE,IAAI,KAAK,MAAM;AAC3B;AAEA;;;AAGM,SAAUC,cAAcA,CAC5BH,EAAqB;EAErB,OAAOA,EAAE,CAACE,IAAI,KAAK,SAAS,IAAIF,EAAE,CAACE,IAAI,KAAK,SAAS;AACvD;AAEA;;;AAGM,SAAUE,QAAQA,CACtBJ,EAAqB;EAErB,OAAO1B,UAAA,CAAA0B,EAAE,CAAW,IAAIpD,MArGR,CAAAyD,MAAA,CAqGQL,EAAE,CAACd,OAAO,CAAS;AAC7C;AAKO,MAAM;EAAEK,IAAI;EAAEN;AAAO,CAAE,GAAGY,IAAI;AAErC;;;AAAAxB,OAAA,CAAAY,OAAA,GAAAA,OAAA;AAAAZ,OAAA,CAAAkB,IAAA,GAAAA,IAAA;AAGM,SAAUe,WAAWA,CACzBC,IAAqB;EAErB,OAAOC,eAAA,CAAAC,KAAA,CAAAF,IAAI,EAAO;IAAEG,SAAS,EAAEnB,IAAI;IAAEoB,SAAS,EAAE1B;EAAO,CAAE,CAAC;AAC5D"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
clientFor: true
|
|
8
|
+
};
|
|
9
|
+
exports.clientFor = clientFor;
|
|
10
|
+
var tsplus_module_1 = _interopRequireWildcard(require("@effect/schema/Schema"));
|
|
11
|
+
var tsplus_module_2 = _interopRequireWildcard(require("effect/Effect"));
|
|
12
|
+
var tsplus_module_3 = _interopRequireWildcard(require("@effect-app/core/Function"));
|
|
13
|
+
var tsplus_module_4 = _interopRequireWildcard(require("@effect/schema/Parser"));
|
|
14
|
+
var tsplus_module_5 = _interopRequireWildcard(require("@effect-app/core/utils"));
|
|
15
|
+
var _schema = require("effect-app/schema");
|
|
16
|
+
var utils = _interopRequireWildcard(require("effect-app/utils"));
|
|
17
|
+
var _pathParser = require("path-parser");
|
|
18
|
+
var _fetch = require("./fetch.cjs");
|
|
19
|
+
var _config = require("./config.cjs");
|
|
20
|
+
Object.keys(_config).forEach(function (key) {
|
|
21
|
+
if (key === "default" || key === "__esModule") return;
|
|
22
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
23
|
+
if (key in exports && exports[key] === _config[key]) return;
|
|
24
|
+
Object.defineProperty(exports, key, {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _config[key];
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
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); }
|
|
32
|
+
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 && Object.prototype.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; }
|
|
33
|
+
var __setFunctionName = void 0 && (void 0).__setFunctionName || function (f, name, prefix) {
|
|
34
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
35
|
+
return Object.defineProperty(f, "name", {
|
|
36
|
+
configurable: true,
|
|
37
|
+
value: prefix ? "".concat(prefix, " ", name) : name
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
42
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
43
|
+
|
|
44
|
+
const cache = new Map();
|
|
45
|
+
function clientFor(models) {
|
|
46
|
+
const found = cache.get(models);
|
|
47
|
+
if (found) {
|
|
48
|
+
return found;
|
|
49
|
+
}
|
|
50
|
+
const m = clientFor_(models);
|
|
51
|
+
cache.set(models, m);
|
|
52
|
+
return m;
|
|
53
|
+
}
|
|
54
|
+
function clientFor_(models) {
|
|
55
|
+
return tsplus_module_5.RecordKeys(tsplus_module_5.object$(models)).filter(x => x !== "default" && x !== "meta").reduce((prev, cur) => {
|
|
56
|
+
var _a;
|
|
57
|
+
const h = models[cur];
|
|
58
|
+
const Request_ = _schema.REST.extractRequest(h);
|
|
59
|
+
const Response = _schema.REST.extractResponse(h);
|
|
60
|
+
// @ts-expect-error doc
|
|
61
|
+
const actionName = utils.uncapitalize(cur);
|
|
62
|
+
const m = models.meta;
|
|
63
|
+
if (!m) throw new Error("No meta defined in Resource!");
|
|
64
|
+
const requestName = `${m.moduleName}.${cur}`.replaceAll(".js", "");
|
|
65
|
+
const Request = (_a = class extends Request_ {}, __setFunctionName(_a, "Request"), _a.path = "/" + requestName + (Request_.path === "/" ? "" : Request_.path), _a.method = Request_.method === "AUTO" ? _schema.REST.determineMethod(cur, Request_) : Request_.method, _a);
|
|
66
|
+
if (Request_.method === "AUTO") {
|
|
67
|
+
Object.assign(Request, {
|
|
68
|
+
[Request.method === "GET" || Request.method === "DELETE" ? "Query" : "Body"]: Request_.Auto
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const b = Object.assign({}, h, {
|
|
72
|
+
Request,
|
|
73
|
+
Response
|
|
74
|
+
});
|
|
75
|
+
const meta = {
|
|
76
|
+
Request,
|
|
77
|
+
Response,
|
|
78
|
+
mapPath: Request.path
|
|
79
|
+
};
|
|
80
|
+
const res = Response;
|
|
81
|
+
const parseResponse = tsplus_module_3.flow(tsplus_module_1.decodeUnknown(res), _ => tsplus_module_2.mapError(_, err => new _fetch.ResponseError(err)));
|
|
82
|
+
const parseResponseE = tsplus_module_3.flow(parseResponse, x => x.andThen(tsplus_module_1.encode(res)));
|
|
83
|
+
const path = new _pathParser.Path(Request.path);
|
|
84
|
+
// TODO: look into ast, look for propertySignatures, etc.
|
|
85
|
+
// TODO: and fix type wise
|
|
86
|
+
// if we don't need fields, then also dont require an argument.
|
|
87
|
+
const fields = [Request.Body, Request.Query, Request.Path].filter(x => x)
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
89
|
+
.flatMap(x => x.ast.propertySignatures);
|
|
90
|
+
// @ts-expect-error doc
|
|
91
|
+
prev[actionName] = Request.method === "GET" ? fields.length === 0 ? {
|
|
92
|
+
handler: tsplus_module_2.withSpan(tsplus_module_2.flatMap((0, _fetch.fetchApi)(Request.method, Request.path), (0, _fetch.mapResponseM)(parseResponse)), "client.request", {
|
|
93
|
+
attributes: {
|
|
94
|
+
"request.name": requestName
|
|
95
|
+
}
|
|
96
|
+
}),
|
|
97
|
+
...meta
|
|
98
|
+
} : {
|
|
99
|
+
handler: req => tsplus_module_2.withSpan(tsplus_module_2.flatMap((0, _fetch.fetchApi)(Request.method, (0, _fetch.makePathWithQuery)(path, tsplus_module_4.encodeSync(Request)(req))), (0, _fetch.mapResponseM)(parseResponse)), "client.request", {
|
|
100
|
+
attributes: {
|
|
101
|
+
"request.name": requestName
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
104
|
+
...meta,
|
|
105
|
+
mapPath: req => req ? (0, _fetch.makePathWithQuery)(path, tsplus_module_4.encodeSync(Request)(req)) : Request.path
|
|
106
|
+
} : fields.length === 0 ? {
|
|
107
|
+
handler: tsplus_module_2.withSpan((0, _fetch.fetchApi3S)(b)({}), "client.request", {
|
|
108
|
+
attributes: {
|
|
109
|
+
"request.name": requestName
|
|
110
|
+
}
|
|
111
|
+
}),
|
|
112
|
+
...meta
|
|
113
|
+
} : {
|
|
114
|
+
handler: req => tsplus_module_2.withSpan((0, _fetch.fetchApi3S)(b)(req), "client.request", {
|
|
115
|
+
attributes: {
|
|
116
|
+
"request.name": requestName
|
|
117
|
+
}
|
|
118
|
+
}),
|
|
119
|
+
...meta,
|
|
120
|
+
mapPath: req => req ? Request.method === "DELETE" ? (0, _fetch.makePathWithQuery)(path, tsplus_module_4.encodeSync(Request)(req)) : (0, _fetch.makePathWithBody)(path, tsplus_module_4.encodeSync(Request)(req)) : Request.path
|
|
121
|
+
};
|
|
122
|
+
// generate handler
|
|
123
|
+
// @ts-expect-error doc
|
|
124
|
+
prev[`${actionName}E`] = Request.method === "GET" ? fields.length === 0 ? {
|
|
125
|
+
handler: tsplus_module_2.withSpan(tsplus_module_2.flatMap((0, _fetch.fetchApi)(Request.method, Request.path), (0, _fetch.mapResponseM)(parseResponseE)), "client.request", {
|
|
126
|
+
attributes: {
|
|
127
|
+
"request.name": requestName
|
|
128
|
+
}
|
|
129
|
+
}),
|
|
130
|
+
...meta
|
|
131
|
+
} : {
|
|
132
|
+
handler: req => tsplus_module_2.withSpan(tsplus_module_2.flatMap((0, _fetch.fetchApi)(Request.method, (0, _fetch.makePathWithQuery)(path, tsplus_module_4.encodeSync(Request)(req))), (0, _fetch.mapResponseM)(parseResponseE)), "client.request", {
|
|
133
|
+
attributes: {
|
|
134
|
+
"request.name": requestName
|
|
135
|
+
}
|
|
136
|
+
}),
|
|
137
|
+
...meta,
|
|
138
|
+
mapPath: req => req ? (0, _fetch.makePathWithQuery)(path, tsplus_module_4.encodeSync(Request)(req)) : Request.path
|
|
139
|
+
} : fields.length === 0 ? {
|
|
140
|
+
handler: tsplus_module_2.withSpan((0, _fetch.fetchApi3SE)(b)({}), "client.request", {
|
|
141
|
+
attributes: {
|
|
142
|
+
"request.name": requestName
|
|
143
|
+
}
|
|
144
|
+
}),
|
|
145
|
+
...meta
|
|
146
|
+
} : {
|
|
147
|
+
handler: req => tsplus_module_2.withSpan((0, _fetch.fetchApi3SE)(b)(req), "client.request", {
|
|
148
|
+
attributes: {
|
|
149
|
+
"request.name": requestName
|
|
150
|
+
}
|
|
151
|
+
}),
|
|
152
|
+
...meta,
|
|
153
|
+
mapPath: req => req ? Request.method === "DELETE" ? (0, _fetch.makePathWithQuery)(path, tsplus_module_4.encodeSync(Request)(req)) : (0, _fetch.makePathWithBody)(path, tsplus_module_4.encodeSync(Request)(req)) : Request.path
|
|
154
|
+
};
|
|
155
|
+
// generate handler
|
|
156
|
+
return prev;
|
|
157
|
+
}, {});
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=clientFor.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clientFor.cjs","names":["_schema","require","utils","_interopRequireWildcard","_pathParser","_fetch","_config","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","cache","Map","clientFor","models","found","m","clientFor_","tsplus_module_5","RecordKeys","object$","filter","x","reduce","prev","cur","h","Request_","REST","extractRequest","Response","extractResponse","actionName","uncapitalize","meta","Error","requestName","moduleName","replaceAll","Request","_a","path","method","determineMethod","assign","Auto","b","mapPath","res","parseResponse","tsplus_module_3","flow","tsplus_module_1","decodeUnknown","_","tsplus_module_2","mapError","err","ResponseError","parseResponseE","andThen","encode","Path","fields","Body","Query","flatMap","ast","propertySignatures","length","handler","withSpan","fetchApi","mapResponseM","attributes","req","makePathWithQuery","tsplus_module_4","encodeSync","fetchApi3S","makePathWithBody","fetchApi3SE"],"sources":["../../_src/client/clientFor.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAIA,IAAAI,MAAA,GAAAJ,OAAA;AAUA,IAAA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ACzB,IAAAkC,wBAAiB,EAACnC,IAAI,EAAEoC,eAAA,CAAAC,UAAA,CAAAvC,OAAO,EAAYoC,GAAG,CAAC,CAAC,GAChD,IAAAK,uBAAgB,EAACvC,IAAI,EAAEoC,eAAA,CAAAC,UAAA,CAAAvC,OAAO,EAAYoC,GAAG,CAAC,CAAC,GACjDpC,OAAO,CAACE;KACf;IACH;IAEA,OAAOjB,IAAI;EACb,CAAC,EAAE,EAAe,CAAC;AACvB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.layer = exports.getConfig = exports.ApiConfig = void 0;
|
|
7
|
+
var tsplus_module_1 = _interopRequireWildcard(require("effect/Context"));
|
|
8
|
+
var tsplus_module_2 = _interopRequireWildcard(require("@effect-app/core/Tag"));
|
|
9
|
+
var tsplus_module_3 = _interopRequireWildcard(require("effect/Effect"));
|
|
10
|
+
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); }
|
|
11
|
+
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 && Object.prototype.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; }
|
|
12
|
+
const tag = tsplus_module_1.GenericTag("@services/tag");
|
|
13
|
+
const layer = config => tsplus_module_2.makeLayer(tag, config);
|
|
14
|
+
exports.layer = layer;
|
|
15
|
+
const ApiConfig = exports.ApiConfig = {
|
|
16
|
+
Tag: tag,
|
|
17
|
+
layer
|
|
18
|
+
};
|
|
19
|
+
const getConfig = self => tsplus_module_3.flatMap(tag, self);
|
|
20
|
+
exports.getConfig = getConfig;
|
|
21
|
+
//# sourceMappingURL=config.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.cjs","names":["tag","tsplus_module_1","GenericTag","layer","config","tsplus_module_2","makeLayer","exports","ApiConfig","Tag","getConfig","self","tsplus_module_3","flatMap"],"sources":["../../_src/client/config.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;AAKA,MAAMA,GAAG,GAAGC,eAAA,CAAAC,UAAU,CAAY,eAAe,CAAC;AAC3C,MAAMC,KAAK,GAAIC,MAAiB,IAAKC,eAAA,CAAAC,SAAA,CAAAN,GAAG,EAAWI,MAAM,CAAC;AAAAG,OAAA,CAAAJ,KAAA,GAAAA,KAAA;AAC1D,MAAMK,SAAS,GAAAD,OAAA,CAAAC,SAAA,GAAG;EACvBC,GAAG,EAAET,GAAG;EACRG;CACD;AAEM,MAAMO,SAAS,GAAaC,IAAyC,IAAKC,eAAA,CAAAC,OAAA,CAAAb,GAAG,EAASW,IAAI,CAAC;AAAAJ,OAAA,CAAAG,SAAA,GAAAA,SAAA"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ValidationError = exports.UnauthorizedError = exports.SupportedErrors = exports.QueryErrors = exports.OptimisticConcurrencyException = exports.NotLoggedInError = exports.NotFoundError = exports.MutationErrors = exports.LoginError = exports.InvalidStateError = void 0;
|
|
7
|
+
var _schema = _interopRequireWildcard(require("effect-app/schema"));
|
|
8
|
+
var tsplus_module_1 = _schema;
|
|
9
|
+
var tsplus_module_2 = _interopRequireWildcard(require("@effect/schema/Schema"));
|
|
10
|
+
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); }
|
|
11
|
+
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 && Object.prototype.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; }
|
|
12
|
+
var __decorate = void 0 && (void 0).__decorate || function (decorators, target, key, desc) {
|
|
13
|
+
var c = arguments.length,
|
|
14
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
15
|
+
d;
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
17
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
|
+
};
|
|
19
|
+
var __metadata = void 0 && (void 0).__metadata || function (k, v) {
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
21
|
+
};
|
|
22
|
+
/** @tsplus type NotFoundError */
|
|
23
|
+
let NotFoundError = exports.NotFoundError = class NotFoundError extends (0, _schema.TaggedError)()("NotFoundError", {
|
|
24
|
+
type: tsplus_module_1.string,
|
|
25
|
+
id: tsplus_module_1.unknown
|
|
26
|
+
}) {
|
|
27
|
+
get message() {
|
|
28
|
+
return `Didn't find ${this.type}#${JSON.stringify(this.id)}`;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.NotFoundError = NotFoundError = __decorate([tsplus_module_1.useClassFeaturesForSchema], NotFoundError);
|
|
32
|
+
/** @tsplus type InvalidStateError */
|
|
33
|
+
let InvalidStateError = exports.InvalidStateError = class InvalidStateError extends (0, _schema.TaggedError)()("InvalidStateError", {
|
|
34
|
+
message: tsplus_module_1.string
|
|
35
|
+
}) {
|
|
36
|
+
constructor(messageOrObject, disableValidation = false) {
|
|
37
|
+
super(typeof messageOrObject === "object" ? messageOrObject : {
|
|
38
|
+
message: messageOrObject
|
|
39
|
+
}, disableValidation);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
exports.InvalidStateError = InvalidStateError = __decorate([tsplus_module_1.useClassFeaturesForSchema, __metadata("design:paramtypes", [Object, Object])], InvalidStateError);
|
|
43
|
+
/** @tsplus type ValidationError */
|
|
44
|
+
let ValidationError = exports.ValidationError = class ValidationError extends (0, _schema.TaggedError)()("ValidationError", {
|
|
45
|
+
errors: tsplus_module_1.array(tsplus_module_1.unknown) // meh
|
|
46
|
+
}) {
|
|
47
|
+
get message() {
|
|
48
|
+
return `Validation failed: ${this.errors.map(e => JSON.stringify(e)).join(", ")}`;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
exports.ValidationError = ValidationError = __decorate([tsplus_module_1.useClassFeaturesForSchema], ValidationError);
|
|
52
|
+
/** @tsplus type NotLoggedInError */
|
|
53
|
+
let NotLoggedInError = exports.NotLoggedInError = class NotLoggedInError extends (0, _schema.TaggedError)()("NotLoggedInError", {
|
|
54
|
+
message: tsplus_module_2.optional(tsplus_module_1.string)
|
|
55
|
+
}) {
|
|
56
|
+
constructor(messageOrObject, disableValidation = false) {
|
|
57
|
+
super(typeof messageOrObject === "object" ? messageOrObject : {
|
|
58
|
+
message: messageOrObject
|
|
59
|
+
}, disableValidation);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
exports.NotLoggedInError = NotLoggedInError = __decorate([tsplus_module_1.useClassFeaturesForSchema, __metadata("design:paramtypes", [Object, Object])], NotLoggedInError);
|
|
63
|
+
/**
|
|
64
|
+
* The user carries a valid Userprofile, but there is a problem with the login none the less.
|
|
65
|
+
*/
|
|
66
|
+
/** @tsplus type LoginError */
|
|
67
|
+
let LoginError = exports.LoginError = class LoginError extends (0, _schema.TaggedError)()("NotLoggedInError", {
|
|
68
|
+
message: tsplus_module_2.optional(tsplus_module_1.string)
|
|
69
|
+
}) {
|
|
70
|
+
constructor(messageOrObject, disableValidation = false) {
|
|
71
|
+
super(typeof messageOrObject === "object" ? messageOrObject : {
|
|
72
|
+
message: messageOrObject
|
|
73
|
+
}, disableValidation);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
exports.LoginError = LoginError = __decorate([tsplus_module_1.useClassFeaturesForSchema, __metadata("design:paramtypes", [Object, Object])], LoginError);
|
|
77
|
+
/** @tsplus type UnauthorizedError */
|
|
78
|
+
let UnauthorizedError = exports.UnauthorizedError = class UnauthorizedError extends (0, _schema.TaggedError)()("UnauthorizedError", {
|
|
79
|
+
message: tsplus_module_2.optional(tsplus_module_1.string)
|
|
80
|
+
}) {
|
|
81
|
+
constructor(messageOrObject, disableValidation = false) {
|
|
82
|
+
super(typeof messageOrObject === "object" ? messageOrObject : {
|
|
83
|
+
message: messageOrObject
|
|
84
|
+
}, disableValidation);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
exports.UnauthorizedError = UnauthorizedError = __decorate([tsplus_module_1.useClassFeaturesForSchema, __metadata("design:paramtypes", [Object, Object])], UnauthorizedError);
|
|
88
|
+
/** @tsplus type OptimisticConcurrencyException */
|
|
89
|
+
let OptimisticConcurrencyException = exports.OptimisticConcurrencyException = class OptimisticConcurrencyException extends (0, _schema.TaggedError)()("OptimisticConcurrencyException", {
|
|
90
|
+
message: tsplus_module_1.string
|
|
91
|
+
}) {
|
|
92
|
+
constructor(args, disableValidation = false) {
|
|
93
|
+
super("message" in args ? args : {
|
|
94
|
+
message: `Existing ${args.type} ${args.id} record changed`
|
|
95
|
+
}, disableValidation);
|
|
96
|
+
if (!("message" in args)) {
|
|
97
|
+
this.details = args;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
exports.OptimisticConcurrencyException = OptimisticConcurrencyException = __decorate([tsplus_module_1.useClassFeaturesForSchema, __metadata("design:paramtypes", [Object, Object])], OptimisticConcurrencyException);
|
|
102
|
+
const MutationOnlyErrors = [InvalidStateError, OptimisticConcurrencyException];
|
|
103
|
+
const GeneralErrors = [NotFoundError, NotLoggedInError, LoginError, UnauthorizedError, ValidationError];
|
|
104
|
+
const SupportedErrors = exports.SupportedErrors = tsplus_module_1.union(...MutationOnlyErrors, ...GeneralErrors);
|
|
105
|
+
// ideal?
|
|
106
|
+
// export const QueryErrors = union({ ...GeneralErrors })
|
|
107
|
+
// .pipe(named("QueryErrors"))
|
|
108
|
+
// .pipe(withDefaults)
|
|
109
|
+
// export type QueryErrors = Schema.To<typeof QueryErrors>
|
|
110
|
+
// export const MutationErrors = union({ ...GeneralErrors, ...GeneralErrors })
|
|
111
|
+
// .pipe(named("MutationErrors"))
|
|
112
|
+
// .pipe(withDefaults)
|
|
113
|
+
// export type MutationErrors = Schema.To<typeof MutationErrors>
|
|
114
|
+
const MutationErrors = exports.MutationErrors = SupportedErrors;
|
|
115
|
+
const QueryErrors = exports.QueryErrors = SupportedErrors;
|
|
116
|
+
//# sourceMappingURL=errors.cjs.map
|