@effect/language-service 0.76.0 → 0.78.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/README.md +3 -1
- package/cli.js +2504 -890
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +1233 -118
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +1277 -142
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +1233 -118
- package/transform.js.map +1 -1
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
3
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/Pipeable.js
|
|
4
4
|
var pipeArguments = (self, args3) => {
|
|
5
5
|
switch (args3.length) {
|
|
6
6
|
case 0:
|
|
@@ -44,7 +44,7 @@ var Class = /* @__PURE__ */ (function() {
|
|
|
44
44
|
return PipeableBase;
|
|
45
45
|
})();
|
|
46
46
|
|
|
47
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
47
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/Function.js
|
|
48
48
|
var dual = function(arity, body) {
|
|
49
49
|
if (typeof arity === "function") {
|
|
50
50
|
return function() {
|
|
@@ -92,7 +92,7 @@ function pipe(a, ...args3) {
|
|
|
92
92
|
return pipeArguments(a, args3);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
95
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/Equivalence.js
|
|
96
96
|
var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
|
|
97
97
|
function Array2(item) {
|
|
98
98
|
return make((self, that) => {
|
|
@@ -104,7 +104,7 @@ function Array2(item) {
|
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
107
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/internal/equal.js
|
|
108
108
|
var getAllObjectKeys = (obj) => {
|
|
109
109
|
const keys2 = new Set(Reflect.ownKeys(obj));
|
|
110
110
|
if (obj.constructor === Object) return keys2;
|
|
@@ -127,7 +127,7 @@ var getAllObjectKeys = (obj) => {
|
|
|
127
127
|
};
|
|
128
128
|
var byReferenceInstances = /* @__PURE__ */ new WeakSet();
|
|
129
129
|
|
|
130
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
130
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/Predicate.js
|
|
131
131
|
function isString(input) {
|
|
132
132
|
return typeof input === "string";
|
|
133
133
|
}
|
|
@@ -148,7 +148,7 @@ function isObjectKeyword(input) {
|
|
|
148
148
|
}
|
|
149
149
|
var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObjectKeyword(self) && property in self);
|
|
150
150
|
|
|
151
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
151
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/Hash.js
|
|
152
152
|
var symbol = "~effect/interfaces/Hash";
|
|
153
153
|
var hash = (self) => {
|
|
154
154
|
switch (typeof self) {
|
|
@@ -267,7 +267,7 @@ function withVisitedTracking(obj, fn2) {
|
|
|
267
267
|
return result;
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
270
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/Equal.js
|
|
271
271
|
var symbol2 = "~effect/interfaces/Equal";
|
|
272
272
|
function equals() {
|
|
273
273
|
if (arguments.length === 1) {
|
|
@@ -429,7 +429,7 @@ var compareSets = /* @__PURE__ */ makeCompareSet(compareBoth);
|
|
|
429
429
|
var isEqual = (u) => hasProperty(u, symbol2);
|
|
430
430
|
var asEquivalence = () => equals;
|
|
431
431
|
|
|
432
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
432
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/Redactable.js
|
|
433
433
|
var symbolRedactable = /* @__PURE__ */ Symbol.for("~effect/Inspectable/redactable");
|
|
434
434
|
var isRedactable = (u) => hasProperty(u, symbolRedactable);
|
|
435
435
|
function redact(u) {
|
|
@@ -448,7 +448,7 @@ var emptyServiceMap = {
|
|
|
448
448
|
}
|
|
449
449
|
};
|
|
450
450
|
|
|
451
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
451
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/Formatter.js
|
|
452
452
|
function format(input, options) {
|
|
453
453
|
const space = options?.space ?? 0;
|
|
454
454
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
@@ -527,7 +527,7 @@ function safeToString(input) {
|
|
|
527
527
|
}
|
|
528
528
|
}
|
|
529
529
|
|
|
530
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
530
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/Inspectable.js
|
|
531
531
|
var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
532
532
|
var toJson = (input) => {
|
|
533
533
|
try {
|
|
@@ -571,7 +571,7 @@ var Class2 = class {
|
|
|
571
571
|
}
|
|
572
572
|
};
|
|
573
573
|
|
|
574
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
574
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/Utils.js
|
|
575
575
|
var GenKindTypeId = "~effect/Utils/GenKind";
|
|
576
576
|
var GenKindImpl = class {
|
|
577
577
|
value;
|
|
@@ -639,7 +639,7 @@ var internalCall = isNotOptimizedAway ? standard[InternalTypeId] : forced[Intern
|
|
|
639
639
|
var genConstructor = function* () {
|
|
640
640
|
}.constructor;
|
|
641
641
|
|
|
642
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
642
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/internal/core.js
|
|
643
643
|
var EffectTypeId = `~effect/Effect`;
|
|
644
644
|
var ExitTypeId = `~effect/Exit`;
|
|
645
645
|
var effectVariance = {
|
|
@@ -986,7 +986,7 @@ var DoneVoid = {
|
|
|
986
986
|
value: void 0
|
|
987
987
|
};
|
|
988
988
|
|
|
989
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
989
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/internal/option.js
|
|
990
990
|
var TypeId = "~effect/data/Option";
|
|
991
991
|
var CommonProto = {
|
|
992
992
|
[TypeId]: {
|
|
@@ -1051,7 +1051,7 @@ var some = (value) => {
|
|
|
1051
1051
|
return a;
|
|
1052
1052
|
};
|
|
1053
1053
|
|
|
1054
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
1054
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/internal/result.js
|
|
1055
1055
|
var TypeId2 = "~effect/data/Result";
|
|
1056
1056
|
var CommonProto2 = {
|
|
1057
1057
|
[TypeId2]: {
|
|
@@ -1122,7 +1122,7 @@ var succeed = (success) => {
|
|
|
1122
1122
|
return a;
|
|
1123
1123
|
};
|
|
1124
1124
|
|
|
1125
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
1125
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/Result.js
|
|
1126
1126
|
var succeed2 = succeed;
|
|
1127
1127
|
var fail2 = fail;
|
|
1128
1128
|
var isFailure2 = isFailure;
|
|
@@ -1130,7 +1130,10 @@ var isSuccess2 = isSuccess;
|
|
|
1130
1130
|
var map = /* @__PURE__ */ dual(2, (self, f) => isSuccess2(self) ? succeed2(f(self.success)) : fail2(self.failure));
|
|
1131
1131
|
var getOrElse = /* @__PURE__ */ dual(2, (self, onFailure) => isFailure2(self) ? onFailure(self.failure) : self.success);
|
|
1132
1132
|
|
|
1133
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
1133
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/internal/array.js
|
|
1134
|
+
var isArrayNonEmpty = (self) => self.length > 0;
|
|
1135
|
+
|
|
1136
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/Order.js
|
|
1134
1137
|
function make2(compare) {
|
|
1135
1138
|
return (self, that) => self === that ? 0 : compare(self, that);
|
|
1136
1139
|
}
|
|
@@ -1153,7 +1156,7 @@ var combine2 = /* @__PURE__ */ dual(2, (self, that) => make2((a1, a2) => {
|
|
|
1153
1156
|
}));
|
|
1154
1157
|
var mapInput = /* @__PURE__ */ dual(2, (self, f) => make2((b1, b2) => self(f(b1), f(b2))));
|
|
1155
1158
|
|
|
1156
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
1159
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/Option.js
|
|
1157
1160
|
var none2 = () => none;
|
|
1158
1161
|
var some2 = some;
|
|
1159
1162
|
var isNone2 = isNone;
|
|
@@ -1164,18 +1167,7 @@ var fromNullishOr = (a) => a == null ? none2() : some2(a);
|
|
|
1164
1167
|
var getOrUndefined = /* @__PURE__ */ getOrElse2(constUndefined);
|
|
1165
1168
|
var map2 = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : some2(f(self.value)));
|
|
1166
1169
|
|
|
1167
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
1168
|
-
var apply = (filter2, input, ...args3) => {
|
|
1169
|
-
const result = filter2(input, ...args3);
|
|
1170
|
-
if (result === true) return succeed2(input);
|
|
1171
|
-
if (result === false) return fail2(input);
|
|
1172
|
-
return result;
|
|
1173
|
-
};
|
|
1174
|
-
|
|
1175
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/internal/array.js
|
|
1176
|
-
var isArrayNonEmpty = (self) => self.length > 0;
|
|
1177
|
-
|
|
1178
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/Record.js
|
|
1170
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/Record.js
|
|
1179
1171
|
var map3 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
1180
1172
|
const out = {
|
|
1181
1173
|
...self
|
|
@@ -1187,7 +1179,7 @@ var map3 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
1187
1179
|
});
|
|
1188
1180
|
var keys = (self) => Object.keys(self);
|
|
1189
1181
|
|
|
1190
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
1182
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/Array.js
|
|
1191
1183
|
var Array3 = globalThis.Array;
|
|
1192
1184
|
var fromIterable = (collection) => Array3.isArray(collection) ? collection : Array3.from(collection);
|
|
1193
1185
|
var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
|
|
@@ -1250,30 +1242,16 @@ var flatMap = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
1250
1242
|
return out;
|
|
1251
1243
|
});
|
|
1252
1244
|
var flatten = /* @__PURE__ */ flatMap(identity);
|
|
1253
|
-
var filter = /* @__PURE__ */ dual(2, (self,
|
|
1245
|
+
var filter = /* @__PURE__ */ dual(2, (self, predicate) => {
|
|
1254
1246
|
const as = fromIterable(self);
|
|
1255
1247
|
const out = [];
|
|
1256
1248
|
for (let i = 0; i < as.length; i++) {
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
out.push(result.success);
|
|
1249
|
+
if (predicate(as[i], i)) {
|
|
1250
|
+
out.push(as[i]);
|
|
1260
1251
|
}
|
|
1261
1252
|
}
|
|
1262
1253
|
return out;
|
|
1263
1254
|
});
|
|
1264
|
-
var partition = /* @__PURE__ */ dual(2, (self, f) => {
|
|
1265
|
-
const excluded = [];
|
|
1266
|
-
const satisfying = [];
|
|
1267
|
-
const as = fromIterable(self);
|
|
1268
|
-
for (let i = 0; i < as.length; i++) {
|
|
1269
|
-
const result = f(as[i], i);
|
|
1270
|
-
if (result === true) satisfying.push(as[i]);
|
|
1271
|
-
else if (result === false) excluded.push(as[i]);
|
|
1272
|
-
else if (isSuccess2(result)) satisfying.push(result.success);
|
|
1273
|
-
else excluded.push(result.failure);
|
|
1274
|
-
}
|
|
1275
|
-
return [excluded, satisfying];
|
|
1276
|
-
});
|
|
1277
1255
|
var every = /* @__PURE__ */ dual(2, (self, refinement) => self.every(refinement));
|
|
1278
1256
|
var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
|
|
1279
1257
|
const input = fromIterable(self);
|
|
@@ -1292,7 +1270,7 @@ var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
|
|
|
1292
1270
|
var dedupe = (self) => dedupeWith(self, asEquivalence());
|
|
1293
1271
|
var join = /* @__PURE__ */ dual(2, (self, sep) => fromIterable(self).join(sep));
|
|
1294
1272
|
|
|
1295
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
1273
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/Data.js
|
|
1296
1274
|
var Class3 = class extends Class {
|
|
1297
1275
|
constructor(props) {
|
|
1298
1276
|
super();
|
|
@@ -1303,7 +1281,7 @@ var Class3 = class extends Class {
|
|
|
1303
1281
|
};
|
|
1304
1282
|
var TaggedError2 = TaggedError;
|
|
1305
1283
|
|
|
1306
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
1284
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/Encoding.js
|
|
1307
1285
|
var EncodingErrorTypeId = "~effect/encoding/EncodingError";
|
|
1308
1286
|
var EncodingError = class extends (/* @__PURE__ */ TaggedError2("EncodingError")) {
|
|
1309
1287
|
/**
|
|
@@ -1339,7 +1317,7 @@ var base64EncodeUint8Array = (bytes) => {
|
|
|
1339
1317
|
var base64abc = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/"];
|
|
1340
1318
|
var base64UrlEncodeUint8Array = (data) => base64EncodeUint8Array(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
1341
1319
|
|
|
1342
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.
|
|
1320
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.27/node_modules/effect/dist/Graph.js
|
|
1343
1321
|
var TypeId3 = "~effect/collections/Graph";
|
|
1344
1322
|
var Edge = class extends Class3 {
|
|
1345
1323
|
};
|
|
@@ -2263,7 +2241,9 @@ function parse(config) {
|
|
|
2263
2241
|
keyPatterns: isObject(config) && hasProperty(config, "keyPatterns") && isArray(config.keyPatterns) ? parseKeyPatterns(config.keyPatterns) : defaults.keyPatterns,
|
|
2264
2242
|
extendedKeyDetection: isObject(config) && hasProperty(config, "extendedKeyDetection") && isBoolean(config.extendedKeyDetection) ? config.extendedKeyDetection : defaults.extendedKeyDetection,
|
|
2265
2243
|
pipeableMinArgCount: isObject(config) && hasProperty(config, "pipeableMinArgCount") && isNumber(config.pipeableMinArgCount) ? config.pipeableMinArgCount : defaults.pipeableMinArgCount,
|
|
2266
|
-
effectFn: isObject(config) && hasProperty(config, "effectFn") && isArray(config.effectFn) && config.effectFn.every(isString) ? config.effectFn.map(
|
|
2244
|
+
effectFn: isObject(config) && hasProperty(config, "effectFn") && isArray(config.effectFn) && config.effectFn.every(isString) ? config.effectFn.map(
|
|
2245
|
+
(_) => _.toLowerCase()
|
|
2246
|
+
) : defaults.effectFn,
|
|
2267
2247
|
layerGraphFollowDepth: isObject(config) && hasProperty(config, "layerGraphFollowDepth") && isNumber(config.layerGraphFollowDepth) ? config.layerGraphFollowDepth : defaults.layerGraphFollowDepth,
|
|
2268
2248
|
mermaidProvider: isObject(config) && hasProperty(config, "mermaidProvider") && isString(config.mermaidProvider) ? config.mermaidProvider : defaults.mermaidProvider
|
|
2269
2249
|
};
|
|
@@ -4043,6 +4023,14 @@ function make3(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
4043
4023
|
const layerType = cachedBy(
|
|
4044
4024
|
fn("TypeParser.layerType")(function* (type, atLocation) {
|
|
4045
4025
|
yield* pipeableType(type, atLocation);
|
|
4026
|
+
if (supportedEffect() === "v4") {
|
|
4027
|
+
const typeIdSymbol = typeChecker.getPropertyOfType(type, "~effect/Layer");
|
|
4028
|
+
if (typeIdSymbol) {
|
|
4029
|
+
const typeIdType = typeChecker.getTypeOfSymbolAtLocation(typeIdSymbol, atLocation);
|
|
4030
|
+
return yield* layerVarianceStruct(typeIdType, atLocation);
|
|
4031
|
+
}
|
|
4032
|
+
return yield* typeParserIssue("Type is not a layer", type, atLocation);
|
|
4033
|
+
}
|
|
4046
4034
|
const propertiesSymbols = typeChecker.getPropertiesOfType(type).filter(
|
|
4047
4035
|
(_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
|
|
4048
4036
|
);
|
|
@@ -4092,6 +4080,34 @@ function make3(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
4092
4080
|
"TypeParser.effectSubtype",
|
|
4093
4081
|
(type) => type
|
|
4094
4082
|
);
|
|
4083
|
+
const effectYieldableType = cachedBy(
|
|
4084
|
+
fn("TypeParser.effectYieldableType")(function* (type, atLocation) {
|
|
4085
|
+
if (supportedEffect() === "v3") {
|
|
4086
|
+
return yield* effectType(type, atLocation);
|
|
4087
|
+
}
|
|
4088
|
+
return yield* firstSuccessOf([
|
|
4089
|
+
effectType(type, atLocation),
|
|
4090
|
+
gen(function* () {
|
|
4091
|
+
const asEffectSymbol = typeChecker.getPropertyOfType(type, "asEffect");
|
|
4092
|
+
if (!asEffectSymbol) {
|
|
4093
|
+
return yield* typeParserIssue("Type has no 'asEffect' property", type, atLocation);
|
|
4094
|
+
}
|
|
4095
|
+
const asEffectType = typeChecker.getTypeOfSymbolAtLocation(asEffectSymbol, atLocation);
|
|
4096
|
+
const asEffectSignatures = typeChecker.getSignaturesOfType(asEffectType, ts.SignatureKind.Call);
|
|
4097
|
+
if (asEffectSignatures.length === 0) {
|
|
4098
|
+
return yield* typeParserIssue("'asEffect' property is not callable", type, atLocation);
|
|
4099
|
+
}
|
|
4100
|
+
return yield* firstSuccessOf(
|
|
4101
|
+
asEffectSignatures.map(
|
|
4102
|
+
(signature) => effectType(typeChecker.getReturnTypeOfSignature(signature), atLocation)
|
|
4103
|
+
)
|
|
4104
|
+
);
|
|
4105
|
+
})
|
|
4106
|
+
]);
|
|
4107
|
+
}),
|
|
4108
|
+
"TypeParser.effectYieldableType",
|
|
4109
|
+
(type) => type
|
|
4110
|
+
);
|
|
4095
4111
|
const isEffectContextSourceFile = cachedBy(
|
|
4096
4112
|
fn("TypeParser.isEffectContextSourceFile")(function* (sourceFile) {
|
|
4097
4113
|
const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
|
|
@@ -5270,6 +5286,73 @@ function make3(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
5270
5286
|
"TypeParser.extendsEffectSqlModelClass",
|
|
5271
5287
|
(atLocation) => atLocation
|
|
5272
5288
|
);
|
|
5289
|
+
const isEffectSchemaModelTypeSourceFile = cachedBy(
|
|
5290
|
+
fn("TypeParser.isEffectSchemaModelTypeSourceFile")(function* (sourceFile) {
|
|
5291
|
+
const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
|
|
5292
|
+
if (!moduleSymbol) return yield* typeParserIssue("Node has no symbol", void 0, sourceFile);
|
|
5293
|
+
const classSymbol = typeChecker.tryGetMemberInModuleExports("Class", moduleSymbol);
|
|
5294
|
+
if (!classSymbol) return yield* typeParserIssue("Model's Class type not found", void 0, sourceFile);
|
|
5295
|
+
const generatedSymbol = typeChecker.tryGetMemberInModuleExports("Generated", moduleSymbol);
|
|
5296
|
+
if (!generatedSymbol) {
|
|
5297
|
+
return yield* typeParserIssue("Model's Generated type not found", void 0, sourceFile);
|
|
5298
|
+
}
|
|
5299
|
+
const fieldOptionSymbol = typeChecker.tryGetMemberInModuleExports("FieldOption", moduleSymbol);
|
|
5300
|
+
if (!fieldOptionSymbol) {
|
|
5301
|
+
return yield* typeParserIssue("Model's FieldOption type not found", void 0, sourceFile);
|
|
5302
|
+
}
|
|
5303
|
+
return sourceFile;
|
|
5304
|
+
}),
|
|
5305
|
+
"TypeParser.isEffectSchemaModelTypeSourceFile",
|
|
5306
|
+
(sourceFile) => sourceFile
|
|
5307
|
+
);
|
|
5308
|
+
const isNodeReferenceToEffectSchemaModelModuleApi = (memberName) => cachedBy(
|
|
5309
|
+
fn("TypeParser.isNodeReferenceToEffectSchemaModelModuleApi")(function* (node) {
|
|
5310
|
+
return yield* isNodeReferenceToExportOfPackageModule(
|
|
5311
|
+
node,
|
|
5312
|
+
"effect",
|
|
5313
|
+
isEffectSchemaModelTypeSourceFile,
|
|
5314
|
+
memberName
|
|
5315
|
+
);
|
|
5316
|
+
}),
|
|
5317
|
+
`TypeParser.isNodeReferenceToEffectSchemaModelModuleApi(${memberName})`,
|
|
5318
|
+
(node) => node
|
|
5319
|
+
);
|
|
5320
|
+
const extendsEffectSchemaModelClass = cachedBy(
|
|
5321
|
+
fn("TypeParser.extendsEffectSchemaModelClass")(function* (atLocation) {
|
|
5322
|
+
if (!atLocation.name) {
|
|
5323
|
+
return yield* typeParserIssue("Class has no name", void 0, atLocation);
|
|
5324
|
+
}
|
|
5325
|
+
const heritageClauses = atLocation.heritageClauses;
|
|
5326
|
+
if (!heritageClauses) {
|
|
5327
|
+
return yield* typeParserIssue("Class has no heritage clauses", void 0, atLocation);
|
|
5328
|
+
}
|
|
5329
|
+
for (const heritageClause of heritageClauses) {
|
|
5330
|
+
for (const typeX of heritageClause.types) {
|
|
5331
|
+
if (ts.isExpressionWithTypeArguments(typeX)) {
|
|
5332
|
+
const expression = typeX.expression;
|
|
5333
|
+
if (ts.isCallExpression(expression)) {
|
|
5334
|
+
const schemaCall = expression.expression;
|
|
5335
|
+
if (ts.isCallExpression(schemaCall) && schemaCall.typeArguments && schemaCall.typeArguments.length > 0) {
|
|
5336
|
+
const isEffectSchemaModelModuleApi = yield* pipe(
|
|
5337
|
+
isNodeReferenceToEffectSchemaModelModuleApi("Class")(schemaCall.expression),
|
|
5338
|
+
orUndefined
|
|
5339
|
+
);
|
|
5340
|
+
if (isEffectSchemaModelModuleApi) {
|
|
5341
|
+
return {
|
|
5342
|
+
className: atLocation.name,
|
|
5343
|
+
selfTypeNode: schemaCall.typeArguments[0]
|
|
5344
|
+
};
|
|
5345
|
+
}
|
|
5346
|
+
}
|
|
5347
|
+
}
|
|
5348
|
+
}
|
|
5349
|
+
}
|
|
5350
|
+
}
|
|
5351
|
+
return yield* typeParserIssue("Class does not extend effect's Model.Class", void 0, atLocation);
|
|
5352
|
+
}),
|
|
5353
|
+
"TypeParser.extendsEffectSchemaModelClass",
|
|
5354
|
+
(atLocation) => atLocation
|
|
5355
|
+
);
|
|
5273
5356
|
const isEffectLayerTypeSourceFile = cachedBy(
|
|
5274
5357
|
fn("TypeParser.isEffectLayerTypeSourceFile")(function* (sourceFile) {
|
|
5275
5358
|
const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
|
|
@@ -5642,6 +5725,7 @@ function make3(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
5642
5725
|
isNodeReferenceToEffectDataModuleApi,
|
|
5643
5726
|
isNodeReferenceToEffectContextModuleApi,
|
|
5644
5727
|
isNodeReferenceToEffectSqlModelModuleApi,
|
|
5728
|
+
isNodeReferenceToEffectSchemaModelModuleApi,
|
|
5645
5729
|
isNodeReferenceToEffectLayerModuleApi,
|
|
5646
5730
|
isNodeReferenceToEffectSchemaParserModuleApi,
|
|
5647
5731
|
isServiceMapTypeSourceFile,
|
|
@@ -5651,6 +5735,7 @@ function make3(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
5651
5735
|
layerType,
|
|
5652
5736
|
fiberType,
|
|
5653
5737
|
effectSubtype,
|
|
5738
|
+
effectYieldableType,
|
|
5654
5739
|
importedEffectModule,
|
|
5655
5740
|
effectGen,
|
|
5656
5741
|
effectFnUntracedGen,
|
|
@@ -5679,6 +5764,7 @@ function make3(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
5679
5764
|
extendsSchemaTaggedRequest,
|
|
5680
5765
|
extendsSchemaRequestClass,
|
|
5681
5766
|
extendsEffectSqlModelClass,
|
|
5767
|
+
extendsEffectSchemaModelClass,
|
|
5682
5768
|
lazyExpression,
|
|
5683
5769
|
emptyFunction,
|
|
5684
5770
|
pipingFlows,
|
|
@@ -7200,6 +7286,7 @@ var classSelfMismatch = createDiagnostic({
|
|
|
7200
7286
|
)
|
|
7201
7287
|
),
|
|
7202
7288
|
orElse2(() => typeParser.extendsEffectSqlModelClass(node)),
|
|
7289
|
+
orElse2(() => typeParser.extendsEffectSchemaModelClass(node)),
|
|
7203
7290
|
orElse2(() => void_)
|
|
7204
7291
|
);
|
|
7205
7292
|
if (result) {
|
|
@@ -7526,16 +7613,16 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
7526
7613
|
if (ts.isFunctionDeclaration(node) && node.name) {
|
|
7527
7614
|
return node.name;
|
|
7528
7615
|
}
|
|
7529
|
-
if (node.parent && ts.isVariableDeclaration(node.parent) && ts.isIdentifier(node.parent.name)) {
|
|
7616
|
+
if (node.parent && ts.isVariableDeclaration(node.parent) && ts.isIdentifier(node.parent.name) && node.parent.initializer === node) {
|
|
7530
7617
|
return node.parent.name;
|
|
7531
7618
|
}
|
|
7532
|
-
if (node.parent && ts.isPropertyAssignment(node.parent)) {
|
|
7619
|
+
if (node.parent && ts.isPropertyAssignment(node.parent) && node.parent.initializer === node) {
|
|
7533
7620
|
const name = node.parent.name;
|
|
7534
7621
|
if (ts.isIdentifier(name) || ts.isStringLiteral(name)) {
|
|
7535
7622
|
return name;
|
|
7536
7623
|
}
|
|
7537
7624
|
}
|
|
7538
|
-
if (node.parent && ts.isPropertyDeclaration(node.parent)) {
|
|
7625
|
+
if (node.parent && ts.isPropertyDeclaration(node.parent) && node.parent.initializer === node) {
|
|
7539
7626
|
const name = node.parent.name;
|
|
7540
7627
|
if (ts.isIdentifier(name)) {
|
|
7541
7628
|
return name;
|
|
@@ -7543,6 +7630,190 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
7543
7630
|
}
|
|
7544
7631
|
return void 0;
|
|
7545
7632
|
};
|
|
7633
|
+
const hasExportModifier = (node) => {
|
|
7634
|
+
if (!ts.canHaveModifiers(node)) return false;
|
|
7635
|
+
const modifiers = ts.getModifiers(node);
|
|
7636
|
+
return modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword) ?? false;
|
|
7637
|
+
};
|
|
7638
|
+
const layerServiceNameFromExpression = (expression) => {
|
|
7639
|
+
if (expression.kind === ts.SyntaxKind.ThisKeyword) {
|
|
7640
|
+
const enclosingClass = ts.findAncestor(
|
|
7641
|
+
expression,
|
|
7642
|
+
(node) => ts.isClassDeclaration(node)
|
|
7643
|
+
);
|
|
7644
|
+
if (enclosingClass?.name) {
|
|
7645
|
+
return ts.idText(enclosingClass.name);
|
|
7646
|
+
}
|
|
7647
|
+
}
|
|
7648
|
+
if (ts.isIdentifier(expression)) return ts.idText(expression);
|
|
7649
|
+
return sourceFile.text.slice(expression.pos, expression.end).trim();
|
|
7650
|
+
};
|
|
7651
|
+
const tryGetLayerApiMethod = (node) => pipe(
|
|
7652
|
+
typeParser.isNodeReferenceToEffectLayerModuleApi("effect")(node),
|
|
7653
|
+
map5(() => "effect"),
|
|
7654
|
+
orElse2(
|
|
7655
|
+
() => pipe(
|
|
7656
|
+
typeParser.isNodeReferenceToEffectLayerModuleApi("succeed")(node),
|
|
7657
|
+
map5(() => "succeed"),
|
|
7658
|
+
orElse2(
|
|
7659
|
+
() => pipe(
|
|
7660
|
+
typeParser.isNodeReferenceToEffectLayerModuleApi("sync")(node),
|
|
7661
|
+
map5(() => "sync"),
|
|
7662
|
+
orElse2(() => succeed3(void 0))
|
|
7663
|
+
)
|
|
7664
|
+
)
|
|
7665
|
+
)
|
|
7666
|
+
)
|
|
7667
|
+
);
|
|
7668
|
+
const verifyLayerMethodAtCall = fn("effectFnOpportunity.verifyLayerMethodAtCall")(
|
|
7669
|
+
function* (callExpression, method, implementationExpression) {
|
|
7670
|
+
const directMethod = yield* tryGetLayerApiMethod(callExpression.expression);
|
|
7671
|
+
if (directMethod === method && callExpression.arguments.length >= 2 && callExpression.arguments[1] === implementationExpression) {
|
|
7672
|
+
return layerServiceNameFromExpression(callExpression.arguments[0]);
|
|
7673
|
+
}
|
|
7674
|
+
if (ts.isCallExpression(callExpression.expression)) {
|
|
7675
|
+
const innerCall = callExpression.expression;
|
|
7676
|
+
const innerMethod = yield* tryGetLayerApiMethod(innerCall.expression);
|
|
7677
|
+
if (innerMethod === method && innerCall.arguments.length >= 1 && callExpression.arguments.length >= 1 && callExpression.arguments[0] === implementationExpression) {
|
|
7678
|
+
return layerServiceNameFromExpression(innerCall.arguments[0]);
|
|
7679
|
+
}
|
|
7680
|
+
}
|
|
7681
|
+
return void 0;
|
|
7682
|
+
}
|
|
7683
|
+
);
|
|
7684
|
+
const tryMatchLayerSucceedInference = fn("effectFnOpportunity.tryMatchLayerSucceedInference")(
|
|
7685
|
+
function* (objectLiteral) {
|
|
7686
|
+
const callExpression = objectLiteral.parent;
|
|
7687
|
+
if (!callExpression || !ts.isCallExpression(callExpression)) return void 0;
|
|
7688
|
+
return yield* verifyLayerMethodAtCall(callExpression, "succeed", objectLiteral);
|
|
7689
|
+
}
|
|
7690
|
+
);
|
|
7691
|
+
const tryMatchLayerSyncInference = fn("effectFnOpportunity.tryMatchLayerSyncInference")(
|
|
7692
|
+
function* (objectLiteral) {
|
|
7693
|
+
const returnStatement = objectLiteral.parent;
|
|
7694
|
+
if (!returnStatement || !ts.isReturnStatement(returnStatement)) return void 0;
|
|
7695
|
+
const functionBody = returnStatement.parent;
|
|
7696
|
+
if (!functionBody || !ts.isBlock(functionBody)) return void 0;
|
|
7697
|
+
const lazyFunction = functionBody.parent;
|
|
7698
|
+
if (!lazyFunction || !ts.isArrowFunction(lazyFunction) && !ts.isFunctionExpression(lazyFunction)) {
|
|
7699
|
+
return void 0;
|
|
7700
|
+
}
|
|
7701
|
+
const callExpression = lazyFunction.parent;
|
|
7702
|
+
if (!callExpression || !ts.isCallExpression(callExpression)) return void 0;
|
|
7703
|
+
return yield* verifyLayerMethodAtCall(callExpression, "sync", lazyFunction);
|
|
7704
|
+
}
|
|
7705
|
+
);
|
|
7706
|
+
const tryMatchLayerEffectInference = fn("effectFnOpportunity.tryMatchLayerEffectInference")(
|
|
7707
|
+
function* (objectLiteral) {
|
|
7708
|
+
const returnStatement = objectLiteral.parent;
|
|
7709
|
+
if (!returnStatement || !ts.isReturnStatement(returnStatement)) return void 0;
|
|
7710
|
+
const generatorBody = returnStatement.parent;
|
|
7711
|
+
if (!generatorBody || !ts.isBlock(generatorBody)) return void 0;
|
|
7712
|
+
const generatorFunction = generatorBody.parent;
|
|
7713
|
+
if (!generatorFunction || !ts.isFunctionExpression(generatorFunction) || !generatorFunction.asteriskToken) {
|
|
7714
|
+
return void 0;
|
|
7715
|
+
}
|
|
7716
|
+
const genCall = generatorFunction.parent;
|
|
7717
|
+
if (!genCall || !ts.isCallExpression(genCall)) return void 0;
|
|
7718
|
+
const parsedEffectGen = yield* option(typeParser.effectGen(genCall));
|
|
7719
|
+
if (parsedEffectGen._tag === "None" || parsedEffectGen.value.generatorFunction !== generatorFunction) {
|
|
7720
|
+
return void 0;
|
|
7721
|
+
}
|
|
7722
|
+
const layerCall = genCall.parent;
|
|
7723
|
+
if (!layerCall || !ts.isCallExpression(layerCall)) return void 0;
|
|
7724
|
+
return yield* verifyLayerMethodAtCall(layerCall, "effect", genCall);
|
|
7725
|
+
}
|
|
7726
|
+
);
|
|
7727
|
+
const tryMatchOfInference = fn("effectFnOpportunity.tryMatchOfInference")(
|
|
7728
|
+
function* (objectLiteral) {
|
|
7729
|
+
const callExpression = objectLiteral.parent;
|
|
7730
|
+
if (!callExpression || !ts.isCallExpression(callExpression)) return void 0;
|
|
7731
|
+
if (callExpression.arguments.length < 1 || callExpression.arguments[0] !== objectLiteral) return void 0;
|
|
7732
|
+
if (!ts.isPropertyAccessExpression(callExpression.expression)) return void 0;
|
|
7733
|
+
if (ts.idText(callExpression.expression.name) !== "of") return void 0;
|
|
7734
|
+
const serviceTagExpression = callExpression.expression.expression;
|
|
7735
|
+
const serviceTagType = typeCheckerUtils.getTypeAtLocation(serviceTagExpression);
|
|
7736
|
+
if (!serviceTagType) return void 0;
|
|
7737
|
+
const isTagLike = yield* pipe(
|
|
7738
|
+
typeParser.contextTag(serviceTagType, serviceTagExpression),
|
|
7739
|
+
orElse2(() => typeParser.serviceType(serviceTagType, serviceTagExpression)),
|
|
7740
|
+
option
|
|
7741
|
+
);
|
|
7742
|
+
if (isTagLike._tag === "None") return void 0;
|
|
7743
|
+
return layerServiceNameFromExpression(serviceTagExpression);
|
|
7744
|
+
}
|
|
7745
|
+
);
|
|
7746
|
+
const tryMatchServiceMapMakeInference = fn("effectFnOpportunity.tryMatchServiceMapMakeInference")(
|
|
7747
|
+
function* (objectLiteral) {
|
|
7748
|
+
const returnStatement = objectLiteral.parent;
|
|
7749
|
+
if (!returnStatement || !ts.isReturnStatement(returnStatement)) return void 0;
|
|
7750
|
+
const generatorBody = returnStatement.parent;
|
|
7751
|
+
if (!generatorBody || !ts.isBlock(generatorBody)) return void 0;
|
|
7752
|
+
const generatorFunction = generatorBody.parent;
|
|
7753
|
+
if (!generatorFunction || !ts.isFunctionExpression(generatorFunction) || !generatorFunction.asteriskToken) {
|
|
7754
|
+
return void 0;
|
|
7755
|
+
}
|
|
7756
|
+
const genCall = generatorFunction.parent;
|
|
7757
|
+
if (!genCall || !ts.isCallExpression(genCall)) return void 0;
|
|
7758
|
+
const parsedEffectGen = yield* option(typeParser.effectGen(genCall));
|
|
7759
|
+
if (parsedEffectGen._tag === "None" || parsedEffectGen.value.generatorFunction !== generatorFunction) {
|
|
7760
|
+
return void 0;
|
|
7761
|
+
}
|
|
7762
|
+
const makeProperty = genCall.parent;
|
|
7763
|
+
if (!makeProperty || !ts.isPropertyAssignment(makeProperty)) return void 0;
|
|
7764
|
+
if (makeProperty.initializer !== genCall) return void 0;
|
|
7765
|
+
if (!ts.isIdentifier(makeProperty.name) || ts.idText(makeProperty.name) !== "make") return void 0;
|
|
7766
|
+
let currentNode = makeProperty.parent;
|
|
7767
|
+
let classDeclaration = void 0;
|
|
7768
|
+
while (currentNode) {
|
|
7769
|
+
if (ts.isClassDeclaration(currentNode)) {
|
|
7770
|
+
classDeclaration = currentNode;
|
|
7771
|
+
break;
|
|
7772
|
+
}
|
|
7773
|
+
currentNode = currentNode.parent;
|
|
7774
|
+
}
|
|
7775
|
+
if (!classDeclaration || !classDeclaration.name) return void 0;
|
|
7776
|
+
const parsedServiceMapService = yield* option(typeParser.extendsServiceMapService(classDeclaration));
|
|
7777
|
+
if (parsedServiceMapService._tag === "None") return void 0;
|
|
7778
|
+
return ts.idText(classDeclaration.name);
|
|
7779
|
+
}
|
|
7780
|
+
);
|
|
7781
|
+
const tryGetLayerInferredTraceName = fn("effectFnOpportunity.tryGetLayerInferredTraceName")(
|
|
7782
|
+
function* (node, suggestedTraceName) {
|
|
7783
|
+
if (!suggestedTraceName) return void 0;
|
|
7784
|
+
if (!(node.parent && ts.isPropertyAssignment(node.parent) && node.parent.initializer === node && node.parent.parent && ts.isObjectLiteralExpression(node.parent.parent))) {
|
|
7785
|
+
return void 0;
|
|
7786
|
+
}
|
|
7787
|
+
const objectLiteral = node.parent.parent;
|
|
7788
|
+
const succeedServiceName = yield* tryMatchLayerSucceedInference(objectLiteral);
|
|
7789
|
+
if (succeedServiceName) return `${succeedServiceName}.${suggestedTraceName}`;
|
|
7790
|
+
const syncServiceName = yield* tryMatchLayerSyncInference(objectLiteral);
|
|
7791
|
+
if (syncServiceName) return `${syncServiceName}.${suggestedTraceName}`;
|
|
7792
|
+
const effectServiceName = yield* tryMatchLayerEffectInference(objectLiteral);
|
|
7793
|
+
if (effectServiceName) return `${effectServiceName}.${suggestedTraceName}`;
|
|
7794
|
+
const ofServiceName = yield* tryMatchOfInference(objectLiteral);
|
|
7795
|
+
if (ofServiceName) return `${ofServiceName}.${suggestedTraceName}`;
|
|
7796
|
+
const serviceMapMakeServiceName = yield* tryMatchServiceMapMakeInference(objectLiteral);
|
|
7797
|
+
return serviceMapMakeServiceName ? `${serviceMapMakeServiceName}.${suggestedTraceName}` : void 0;
|
|
7798
|
+
}
|
|
7799
|
+
);
|
|
7800
|
+
const getInferredTraceName = fn("effectFnOpportunity.getInferredTraceName")(
|
|
7801
|
+
function* (node, suggestedTraceName) {
|
|
7802
|
+
const inferredFromLayer = yield* tryGetLayerInferredTraceName(node, suggestedTraceName);
|
|
7803
|
+
if (inferredFromLayer) return inferredFromLayer;
|
|
7804
|
+
if (ts.isFunctionDeclaration(node) && node.name && hasExportModifier(node)) {
|
|
7805
|
+
return ts.idText(node.name);
|
|
7806
|
+
}
|
|
7807
|
+
if (node.parent && ts.isVariableDeclaration(node.parent) && ts.isIdentifier(node.parent.name) && node.parent.initializer === node) {
|
|
7808
|
+
const variableDeclarationList = node.parent.parent;
|
|
7809
|
+
const variableStatement = variableDeclarationList?.parent;
|
|
7810
|
+
if (variableDeclarationList && ts.isVariableDeclarationList(variableDeclarationList) && variableStatement && ts.isVariableStatement(variableStatement) && hasExportModifier(variableStatement) && (variableDeclarationList.flags & ts.NodeFlags.Const) !== 0) {
|
|
7811
|
+
return ts.idText(node.parent.name);
|
|
7812
|
+
}
|
|
7813
|
+
}
|
|
7814
|
+
return void 0;
|
|
7815
|
+
}
|
|
7816
|
+
);
|
|
7546
7817
|
const areParametersReferencedIn = (fnNode, nodes2) => {
|
|
7547
7818
|
if (fnNode.parameters.length === 0 || nodes2.length === 0) return false;
|
|
7548
7819
|
const firstParam = fnNode.parameters[0];
|
|
@@ -7627,7 +7898,10 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
7627
7898
|
);
|
|
7628
7899
|
};
|
|
7629
7900
|
const parseEffectFnOpportunityTargetGen = fn("effectFnOpportunity.parseEffectFnOpportunityTarget")(
|
|
7630
|
-
function* (node, returnType,
|
|
7901
|
+
function* (node, returnType, nameIdentifier) {
|
|
7902
|
+
const suggestedTraceName = nameIdentifier ? ts.isIdentifier(nameIdentifier) ? ts.idText(nameIdentifier) : nameIdentifier.text : void 0;
|
|
7903
|
+
const inferredTraceName = yield* getInferredTraceName(node, suggestedTraceName);
|
|
7904
|
+
const hasStrictLayerInferredName = inferredTraceName !== void 0 && inferredTraceName !== suggestedTraceName;
|
|
7631
7905
|
if (yield* isInsideEffectFn(node)) {
|
|
7632
7906
|
return yield* TypeParserIssue.issue;
|
|
7633
7907
|
}
|
|
@@ -7636,11 +7910,11 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
7636
7910
|
const opportunity = yield* pipe(
|
|
7637
7911
|
tryParseGenOpportunity(node),
|
|
7638
7912
|
orElse2(() => {
|
|
7639
|
-
if (ts.isArrowFunction(node) && !ts.isBlock(node.body)) {
|
|
7913
|
+
if (ts.isArrowFunction(node) && !ts.isBlock(node.body) && !hasStrictLayerInferredName) {
|
|
7640
7914
|
return TypeParserIssue.issue;
|
|
7641
7915
|
}
|
|
7642
7916
|
const body = ts.isArrowFunction(node) ? node.body : node.body;
|
|
7643
|
-
if (!body || !ts.isBlock(body) || body.statements.length <= 5) {
|
|
7917
|
+
if ((!body || !ts.isBlock(body) || body.statements.length <= 5) && !hasStrictLayerInferredName) {
|
|
7644
7918
|
return TypeParserIssue.issue;
|
|
7645
7919
|
}
|
|
7646
7920
|
return succeed3({
|
|
@@ -7655,7 +7929,8 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
7655
7929
|
node,
|
|
7656
7930
|
nameIdentifier,
|
|
7657
7931
|
effectModuleName: opportunity.effectModuleName,
|
|
7658
|
-
inferredTraceName
|
|
7932
|
+
inferredTraceName,
|
|
7933
|
+
suggestedTraceName,
|
|
7659
7934
|
explicitTraceExpression: opportunity.explicitTraceExpression,
|
|
7660
7935
|
pipeArguments: opportunity.pipeArguments,
|
|
7661
7936
|
generatorFunction: opportunity.generatorFunction,
|
|
@@ -7665,27 +7940,26 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
7665
7940
|
);
|
|
7666
7941
|
const parseEffectFnOpportunityTarget = (node) => {
|
|
7667
7942
|
if (!ts.isFunctionExpression(node) && !ts.isArrowFunction(node) && !ts.isFunctionDeclaration(node)) {
|
|
7668
|
-
return
|
|
7943
|
+
return;
|
|
7669
7944
|
}
|
|
7670
7945
|
if ((ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node)) && node.asteriskToken) {
|
|
7671
|
-
return
|
|
7946
|
+
return;
|
|
7672
7947
|
}
|
|
7673
7948
|
if (ts.isFunctionExpression(node) && node.name) {
|
|
7674
|
-
return
|
|
7949
|
+
return;
|
|
7675
7950
|
}
|
|
7676
7951
|
if (node.type) {
|
|
7677
|
-
return
|
|
7952
|
+
return;
|
|
7678
7953
|
}
|
|
7679
7954
|
const functionType = typeChecker.getTypeAtLocation(node);
|
|
7680
|
-
if (!functionType) return
|
|
7955
|
+
if (!functionType) return;
|
|
7681
7956
|
const callSignatures = typeChecker.getSignaturesOfType(functionType, ts.SignatureKind.Call);
|
|
7682
|
-
if (callSignatures.length !== 1) return
|
|
7957
|
+
if (callSignatures.length !== 1) return;
|
|
7683
7958
|
const signature = callSignatures[0];
|
|
7684
7959
|
const returnType = typeChecker.getReturnTypeOfSignature(signature);
|
|
7685
7960
|
const nameIdentifier = getNameIdentifier(node);
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
return parseEffectFnOpportunityTargetGen(node, returnType, traceName, nameIdentifier);
|
|
7961
|
+
if (!nameIdentifier) return;
|
|
7962
|
+
return parseEffectFnOpportunityTargetGen(node, returnType, nameIdentifier);
|
|
7689
7963
|
};
|
|
7690
7964
|
const getFunctionBodyBlock = (node) => {
|
|
7691
7965
|
if (ts.isArrowFunction(node)) {
|
|
@@ -7759,18 +8033,21 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
7759
8033
|
while (nodeToVisit.length > 0) {
|
|
7760
8034
|
const node = nodeToVisit.shift();
|
|
7761
8035
|
ts.forEachChild(node, appendNodeToVisit);
|
|
7762
|
-
const
|
|
7763
|
-
if (
|
|
7764
|
-
|
|
8036
|
+
const test = parseEffectFnOpportunityTarget(node);
|
|
8037
|
+
if (!test) continue;
|
|
8038
|
+
const target = yield* orUndefined(test);
|
|
8039
|
+
if (!target) continue;
|
|
8040
|
+
if (target.hasParamsInPipeArgs) continue;
|
|
7765
8041
|
const {
|
|
7766
8042
|
effectModuleName,
|
|
7767
8043
|
explicitTraceExpression,
|
|
7768
8044
|
inferredTraceName,
|
|
7769
8045
|
nameIdentifier,
|
|
7770
8046
|
node: targetNode,
|
|
7771
|
-
pipeArguments: pipeArguments2
|
|
7772
|
-
|
|
7773
|
-
|
|
8047
|
+
pipeArguments: pipeArguments2,
|
|
8048
|
+
suggestedTraceName
|
|
8049
|
+
} = target;
|
|
8050
|
+
const innerFunction = target.generatorFunction ?? targetNode;
|
|
7774
8051
|
const fixes = [];
|
|
7775
8052
|
if (pluginOptions.effectFn.includes("span") && explicitTraceExpression) {
|
|
7776
8053
|
fixes.push({
|
|
@@ -7790,7 +8067,7 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
7790
8067
|
})
|
|
7791
8068
|
});
|
|
7792
8069
|
}
|
|
7793
|
-
if (pluginOptions.effectFn.includes("untraced") && target.
|
|
8070
|
+
if (pluginOptions.effectFn.includes("untraced") && target.generatorFunction) {
|
|
7794
8071
|
fixes.push({
|
|
7795
8072
|
fixName: "effectFnOpportunity_toEffectFnUntraced",
|
|
7796
8073
|
description: "Convert to Effect.fnUntraced",
|
|
@@ -7812,22 +8089,41 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
7812
8089
|
})
|
|
7813
8090
|
});
|
|
7814
8091
|
}
|
|
7815
|
-
if (
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
8092
|
+
if (!explicitTraceExpression) {
|
|
8093
|
+
if (pluginOptions.effectFn.includes("inferred-span") && inferredTraceName) {
|
|
8094
|
+
fixes.push({
|
|
8095
|
+
fixName: "effectFnOpportunity_toEffectFnSpanInferred",
|
|
8096
|
+
description: `Convert to Effect.fn("${inferredTraceName}")`,
|
|
8097
|
+
apply: gen(function* () {
|
|
8098
|
+
const changeTracker = yield* service(ChangeTracker);
|
|
8099
|
+
const newNode = createEffectFnNode(
|
|
8100
|
+
targetNode,
|
|
8101
|
+
innerFunction,
|
|
8102
|
+
effectModuleName,
|
|
8103
|
+
inferredTraceName,
|
|
8104
|
+
pipeArguments2
|
|
8105
|
+
);
|
|
8106
|
+
changeTracker.replaceNode(sourceFile, targetNode, newNode);
|
|
8107
|
+
})
|
|
8108
|
+
});
|
|
8109
|
+
}
|
|
8110
|
+
if (pluginOptions.effectFn.includes("suggested-span") && suggestedTraceName && (!pluginOptions.effectFn.includes("inferred-span") || suggestedTraceName !== inferredTraceName)) {
|
|
8111
|
+
fixes.push({
|
|
8112
|
+
fixName: "effectFnOpportunity_toEffectFnSpanSuggested",
|
|
8113
|
+
description: `Convert to Effect.fn("${suggestedTraceName}")`,
|
|
8114
|
+
apply: gen(function* () {
|
|
8115
|
+
const changeTracker = yield* service(ChangeTracker);
|
|
8116
|
+
const newNode = createEffectFnNode(
|
|
8117
|
+
targetNode,
|
|
8118
|
+
innerFunction,
|
|
8119
|
+
effectModuleName,
|
|
8120
|
+
suggestedTraceName,
|
|
8121
|
+
pipeArguments2
|
|
8122
|
+
);
|
|
8123
|
+
changeTracker.replaceNode(sourceFile, targetNode, newNode);
|
|
8124
|
+
})
|
|
8125
|
+
});
|
|
8126
|
+
}
|
|
7831
8127
|
}
|
|
7832
8128
|
if (fixes.length === 0) continue;
|
|
7833
8129
|
const generateExpectedSignature = () => {
|
|
@@ -7840,7 +8136,7 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
7840
8136
|
}
|
|
7841
8137
|
return "_";
|
|
7842
8138
|
}).join(", ");
|
|
7843
|
-
const fnSignature = `function*${typeParamNames}(${paramNames}) { ... }`;
|
|
8139
|
+
const fnSignature = ts.isArrowFunction(innerFunction) ? `${typeParamNames}(${paramNames}) => { ... }` : isGeneratorFunction(innerFunction) ? `function*${typeParamNames}(${paramNames}) { ... }` : `function${typeParamNames}(${paramNames}) { ... }`;
|
|
7844
8140
|
const pipeArgsForWithSpan = pipeArguments2.slice(0, -1);
|
|
7845
8141
|
const pipeArgsSuffix = (args3) => args3.length > 0 ? ", ...pipeTransformations" : "";
|
|
7846
8142
|
switch (firstFix.fixName) {
|
|
@@ -7854,6 +8150,8 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
7854
8150
|
return `${effectModuleName}.fn(${fnSignature}${pipeArgsSuffix(pipeArguments2)})`;
|
|
7855
8151
|
case "effectFnOpportunity_toEffectFnSpanInferred":
|
|
7856
8152
|
return `${effectModuleName}.fn("${inferredTraceName}")(${fnSignature}${pipeArgsSuffix(pipeArguments2)})`;
|
|
8153
|
+
case "effectFnOpportunity_toEffectFnSpanSuggested":
|
|
8154
|
+
return `${effectModuleName}.fn("${suggestedTraceName}")(${fnSignature}${pipeArgsSuffix(pipeArguments2)})`;
|
|
7857
8155
|
default:
|
|
7858
8156
|
return `${effectModuleName}.fn(${fnSignature})`;
|
|
7859
8157
|
}
|
|
@@ -7906,6 +8204,70 @@ var effectGenUsesAdapter = createDiagnostic({
|
|
|
7906
8204
|
})
|
|
7907
8205
|
});
|
|
7908
8206
|
|
|
8207
|
+
// src/diagnostics/effectInFailure.ts
|
|
8208
|
+
var effectInFailure = createDiagnostic({
|
|
8209
|
+
name: "effectInFailure",
|
|
8210
|
+
code: 49,
|
|
8211
|
+
description: "Warns when an Effect is used inside an Effect failure channel",
|
|
8212
|
+
severity: "warning",
|
|
8213
|
+
apply: fn("effectInFailure.apply")(function* (sourceFile, report) {
|
|
8214
|
+
const ts = yield* service(TypeScriptApi);
|
|
8215
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
8216
|
+
const typeParser = yield* service(TypeParser);
|
|
8217
|
+
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
8218
|
+
const isStrictEffectType = cachedBy(
|
|
8219
|
+
fn("effectInFailure.isStrictEffectType")(function* (type, atLocation) {
|
|
8220
|
+
yield* typeParser.strictEffectType(type, atLocation);
|
|
8221
|
+
return true;
|
|
8222
|
+
}),
|
|
8223
|
+
"effectInFailure.isStrictEffectType",
|
|
8224
|
+
(type) => type
|
|
8225
|
+
);
|
|
8226
|
+
const visited = /* @__PURE__ */ new WeakSet();
|
|
8227
|
+
const stack = [sourceFile];
|
|
8228
|
+
const shouldSkipBecauseChildMatched = /* @__PURE__ */ new WeakSet();
|
|
8229
|
+
while (stack.length > 0) {
|
|
8230
|
+
const node = stack.pop();
|
|
8231
|
+
if (!visited.has(node)) {
|
|
8232
|
+
visited.add(node);
|
|
8233
|
+
stack.push(node);
|
|
8234
|
+
ts.forEachChild(node, (child) => {
|
|
8235
|
+
stack.push(child);
|
|
8236
|
+
return void 0;
|
|
8237
|
+
});
|
|
8238
|
+
continue;
|
|
8239
|
+
}
|
|
8240
|
+
if (shouldSkipBecauseChildMatched.has(node)) {
|
|
8241
|
+
if (node.parent) shouldSkipBecauseChildMatched.add(node.parent);
|
|
8242
|
+
continue;
|
|
8243
|
+
}
|
|
8244
|
+
const type = typeCheckerUtils.getTypeAtLocation(node);
|
|
8245
|
+
if (!type) continue;
|
|
8246
|
+
const effect = yield* orUndefined(typeParser.strictEffectType(type, node));
|
|
8247
|
+
if (!effect) continue;
|
|
8248
|
+
const failureMembers = typeCheckerUtils.unrollUnionMembers(effect.E);
|
|
8249
|
+
let memberWithEffect = void 0;
|
|
8250
|
+
for (const member of failureMembers) {
|
|
8251
|
+
const isMemberEffect = yield* orUndefined(isStrictEffectType(member, node));
|
|
8252
|
+
if (isMemberEffect) {
|
|
8253
|
+
memberWithEffect = member;
|
|
8254
|
+
break;
|
|
8255
|
+
}
|
|
8256
|
+
}
|
|
8257
|
+
if (!memberWithEffect) continue;
|
|
8258
|
+
const messageText = `The error channel contains an Effect (${typeChecker.typeToString(memberWithEffect)}). Putting Effect computations in the failure channel is not intended; keep only failure types there.`;
|
|
8259
|
+
report({
|
|
8260
|
+
location: node,
|
|
8261
|
+
messageText,
|
|
8262
|
+
fixes: []
|
|
8263
|
+
});
|
|
8264
|
+
if (node.parent) {
|
|
8265
|
+
shouldSkipBecauseChildMatched.add(node.parent);
|
|
8266
|
+
}
|
|
8267
|
+
}
|
|
8268
|
+
})
|
|
8269
|
+
});
|
|
8270
|
+
|
|
7909
8271
|
// src/diagnostics/effectInVoidSuccess.ts
|
|
7910
8272
|
var effectInVoidSuccess = createDiagnostic({
|
|
7911
8273
|
name: "effectInVoidSuccess",
|
|
@@ -9274,6 +9636,7 @@ var missingReturnYieldStar = createDiagnostic({
|
|
|
9274
9636
|
const ts = yield* service(TypeScriptApi);
|
|
9275
9637
|
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
9276
9638
|
const typeParser = yield* service(TypeParser);
|
|
9639
|
+
const tsUtils = yield* service(TypeScriptUtils);
|
|
9277
9640
|
const nodeToVisit = [];
|
|
9278
9641
|
const appendNodeToVisit = (node) => {
|
|
9279
9642
|
nodeToVisit.push(node);
|
|
@@ -9283,50 +9646,32 @@ var missingReturnYieldStar = createDiagnostic({
|
|
|
9283
9646
|
while (nodeToVisit.length > 0) {
|
|
9284
9647
|
const node = nodeToVisit.shift();
|
|
9285
9648
|
ts.forEachChild(node, appendNodeToVisit);
|
|
9286
|
-
if (ts.
|
|
9287
|
-
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
|
|
9291
|
-
|
|
9292
|
-
|
|
9293
|
-
|
|
9294
|
-
|
|
9295
|
-
|
|
9296
|
-
|
|
9297
|
-
|
|
9298
|
-
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
node,
|
|
9313
|
-
ts.factory.createReturnStatement(
|
|
9314
|
-
node
|
|
9315
|
-
)
|
|
9316
|
-
);
|
|
9317
|
-
})
|
|
9318
|
-
}] : [];
|
|
9319
|
-
report({
|
|
9320
|
-
location: node,
|
|
9321
|
-
messageText: `It is recommended to use return yield* for Effects that never succeed to signal a definitive exit point for type narrowing and tooling support.`,
|
|
9322
|
-
fixes: fix
|
|
9323
|
-
});
|
|
9324
|
-
}
|
|
9325
|
-
}
|
|
9326
|
-
}
|
|
9327
|
-
}
|
|
9328
|
-
}
|
|
9329
|
-
}
|
|
9649
|
+
if (!ts.isExpressionStatement(node)) continue;
|
|
9650
|
+
const unwrapped = tsUtils.skipOuterExpressions(node.expression);
|
|
9651
|
+
if (!ts.isYieldExpression(unwrapped) || !unwrapped.expression || !unwrapped.asteriskToken) continue;
|
|
9652
|
+
const type = typeCheckerUtils.getTypeAtLocation(unwrapped.expression);
|
|
9653
|
+
if (!type) continue;
|
|
9654
|
+
const maybeEffect = yield* option(typeParser.effectYieldableType(type, unwrapped.expression));
|
|
9655
|
+
if (!(isSome2(maybeEffect) && maybeEffect.value.A.flags & ts.TypeFlags.Never)) continue;
|
|
9656
|
+
const { effectGen, scopeNode } = yield* typeParser.findEnclosingScopes(node);
|
|
9657
|
+
if (!effectGen || scopeNode && scopeNode !== effectGen.generatorFunction) continue;
|
|
9658
|
+
const fix = [{
|
|
9659
|
+
fixName: "missingReturnYieldStar_fix",
|
|
9660
|
+
description: "Add return statement",
|
|
9661
|
+
apply: gen(function* () {
|
|
9662
|
+
const changeTracker = yield* service(ChangeTracker);
|
|
9663
|
+
changeTracker.replaceNode(
|
|
9664
|
+
sourceFile,
|
|
9665
|
+
node,
|
|
9666
|
+
ts.factory.createReturnStatement(node.expression)
|
|
9667
|
+
);
|
|
9668
|
+
})
|
|
9669
|
+
}];
|
|
9670
|
+
report({
|
|
9671
|
+
location: unwrapped,
|
|
9672
|
+
messageText: `It is recommended to use return yield* for Effects that never succeed to signal a definitive exit point for type narrowing and tooling support.`,
|
|
9673
|
+
fixes: fix
|
|
9674
|
+
});
|
|
9330
9675
|
}
|
|
9331
9676
|
})
|
|
9332
9677
|
});
|
|
@@ -9592,6 +9937,761 @@ var nonObjectEffectServiceType = createDiagnostic({
|
|
|
9592
9937
|
})
|
|
9593
9938
|
});
|
|
9594
9939
|
|
|
9940
|
+
// src/diagnostics/outdatedApi.db.ts
|
|
9941
|
+
var asUnchanged = {
|
|
9942
|
+
_tag: "Unchanged"
|
|
9943
|
+
};
|
|
9944
|
+
var asRenamedSameBehaviour = (newName) => ({
|
|
9945
|
+
_tag: "RenamedSameBehaviour",
|
|
9946
|
+
newName
|
|
9947
|
+
});
|
|
9948
|
+
var asRenamedAndNeedsOptions = (newName, optionsInstructions) => ({
|
|
9949
|
+
_tag: "RenamedAndNeedsOptions",
|
|
9950
|
+
newName,
|
|
9951
|
+
optionsInstructions
|
|
9952
|
+
});
|
|
9953
|
+
var asRemoved = (alternativePattern) => ({
|
|
9954
|
+
_tag: "Removed",
|
|
9955
|
+
alternativePattern
|
|
9956
|
+
});
|
|
9957
|
+
var effectModuleMigrationDb = {
|
|
9958
|
+
// Common APIs (in both v3 and v4, unchanged)
|
|
9959
|
+
"acquireRelease": asUnchanged,
|
|
9960
|
+
"acquireUseRelease": asUnchanged,
|
|
9961
|
+
"addFinalizer": asUnchanged,
|
|
9962
|
+
"all": asUnchanged,
|
|
9963
|
+
"andThen": asUnchanged,
|
|
9964
|
+
"annotateCurrentSpan": asUnchanged,
|
|
9965
|
+
"annotateLogs": asUnchanged,
|
|
9966
|
+
"annotateSpans": asUnchanged,
|
|
9967
|
+
"as": asUnchanged,
|
|
9968
|
+
"asSome": asUnchanged,
|
|
9969
|
+
"asVoid": asUnchanged,
|
|
9970
|
+
"cached": asUnchanged,
|
|
9971
|
+
"cachedInvalidateWithTTL": asUnchanged,
|
|
9972
|
+
"cachedWithTTL": asUnchanged,
|
|
9973
|
+
"catch": asUnchanged,
|
|
9974
|
+
"catchIf": asUnchanged,
|
|
9975
|
+
"catchTag": asUnchanged,
|
|
9976
|
+
"catchTags": asUnchanged,
|
|
9977
|
+
"clockWith": asUnchanged,
|
|
9978
|
+
"currentParentSpan": asUnchanged,
|
|
9979
|
+
"currentSpan": asUnchanged,
|
|
9980
|
+
"delay": asUnchanged,
|
|
9981
|
+
"die": asUnchanged,
|
|
9982
|
+
"ensuring": asUnchanged,
|
|
9983
|
+
"eventually": asUnchanged,
|
|
9984
|
+
"exit": asUnchanged,
|
|
9985
|
+
"fail": asUnchanged,
|
|
9986
|
+
"failCause": asUnchanged,
|
|
9987
|
+
"failCauseSync": asUnchanged,
|
|
9988
|
+
"failSync": asUnchanged,
|
|
9989
|
+
"fiberId": asUnchanged,
|
|
9990
|
+
"filter": asUnchanged,
|
|
9991
|
+
"filterMap": asUnchanged,
|
|
9992
|
+
"filterOrElse": asUnchanged,
|
|
9993
|
+
"filterOrFail": asUnchanged,
|
|
9994
|
+
"flatMap": asUnchanged,
|
|
9995
|
+
"flatten": asUnchanged,
|
|
9996
|
+
"flip": asUnchanged,
|
|
9997
|
+
"fn": asUnchanged,
|
|
9998
|
+
"fnUntraced": asUnchanged,
|
|
9999
|
+
"forEach": asUnchanged,
|
|
10000
|
+
"forever": asUnchanged,
|
|
10001
|
+
"forkIn": asUnchanged,
|
|
10002
|
+
"forkScoped": asUnchanged,
|
|
10003
|
+
"gen": asUnchanged,
|
|
10004
|
+
"ignore": asUnchanged,
|
|
10005
|
+
"interrupt": asUnchanged,
|
|
10006
|
+
"interruptible": asUnchanged,
|
|
10007
|
+
"interruptibleMask": asUnchanged,
|
|
10008
|
+
"isEffect": asUnchanged,
|
|
10009
|
+
"isFailure": asUnchanged,
|
|
10010
|
+
"isSuccess": asUnchanged,
|
|
10011
|
+
"linkSpans": asUnchanged,
|
|
10012
|
+
"log": asUnchanged,
|
|
10013
|
+
"logDebug": asUnchanged,
|
|
10014
|
+
"logError": asUnchanged,
|
|
10015
|
+
"logFatal": asUnchanged,
|
|
10016
|
+
"logInfo": asUnchanged,
|
|
10017
|
+
"logTrace": asUnchanged,
|
|
10018
|
+
"logWarning": asUnchanged,
|
|
10019
|
+
"logWithLevel": asUnchanged,
|
|
10020
|
+
"makeLatch": asRemoved(
|
|
10021
|
+
"Use Latch.make instead of Effect.makeLatch."
|
|
10022
|
+
),
|
|
10023
|
+
"makeSemaphore": asRemoved(
|
|
10024
|
+
"Use Semaphore.make instead of Effect.makeSemaphore."
|
|
10025
|
+
),
|
|
10026
|
+
"makeSpan": asUnchanged,
|
|
10027
|
+
"makeSpanScoped": asUnchanged,
|
|
10028
|
+
"map": asUnchanged,
|
|
10029
|
+
"mapBoth": asUnchanged,
|
|
10030
|
+
"mapError": asUnchanged,
|
|
10031
|
+
"match": asUnchanged,
|
|
10032
|
+
"matchCause": asUnchanged,
|
|
10033
|
+
"matchCauseEffect": asUnchanged,
|
|
10034
|
+
"matchEffect": asUnchanged,
|
|
10035
|
+
"never": asUnchanged,
|
|
10036
|
+
"onError": asUnchanged,
|
|
10037
|
+
"onExit": asUnchanged,
|
|
10038
|
+
"onInterrupt": asUnchanged,
|
|
10039
|
+
"option": asUnchanged,
|
|
10040
|
+
"orDie": asUnchanged,
|
|
10041
|
+
"orElseSucceed": asUnchanged,
|
|
10042
|
+
"promise": asUnchanged,
|
|
10043
|
+
"provide": asUnchanged,
|
|
10044
|
+
"provideService": asUnchanged,
|
|
10045
|
+
"provideServiceEffect": asUnchanged,
|
|
10046
|
+
"race": asUnchanged,
|
|
10047
|
+
"raceAll": asUnchanged,
|
|
10048
|
+
"raceFirst": asUnchanged,
|
|
10049
|
+
"repeat": asUnchanged,
|
|
10050
|
+
"repeatOrElse": asUnchanged,
|
|
10051
|
+
"replicate": asUnchanged,
|
|
10052
|
+
"replicateEffect": asUnchanged,
|
|
10053
|
+
"request": asUnchanged,
|
|
10054
|
+
"retry": asUnchanged,
|
|
10055
|
+
"retryOrElse": asUnchanged,
|
|
10056
|
+
"runCallback": asUnchanged,
|
|
10057
|
+
"runFork": asUnchanged,
|
|
10058
|
+
"runPromise": asUnchanged,
|
|
10059
|
+
"runPromiseExit": asUnchanged,
|
|
10060
|
+
"runSync": asUnchanged,
|
|
10061
|
+
"runSyncExit": asUnchanged,
|
|
10062
|
+
"sandbox": asUnchanged,
|
|
10063
|
+
"schedule": asUnchanged,
|
|
10064
|
+
"scheduleFrom": asUnchanged,
|
|
10065
|
+
"scope": asUnchanged,
|
|
10066
|
+
"scoped": asUnchanged,
|
|
10067
|
+
"scopedWith": asUnchanged,
|
|
10068
|
+
"serviceOption": asUnchanged,
|
|
10069
|
+
"sleep": asUnchanged,
|
|
10070
|
+
"spanAnnotations": asUnchanged,
|
|
10071
|
+
"spanLinks": asUnchanged,
|
|
10072
|
+
"succeed": asUnchanged,
|
|
10073
|
+
"succeedNone": asUnchanged,
|
|
10074
|
+
"succeedSome": asUnchanged,
|
|
10075
|
+
"suspend": asUnchanged,
|
|
10076
|
+
"sync": asUnchanged,
|
|
10077
|
+
"tap": asUnchanged,
|
|
10078
|
+
"tapDefect": asUnchanged,
|
|
10079
|
+
"tapError": asUnchanged,
|
|
10080
|
+
"tapErrorTag": asUnchanged,
|
|
10081
|
+
"timed": asUnchanged,
|
|
10082
|
+
"timeout": asUnchanged,
|
|
10083
|
+
"timeoutOption": asUnchanged,
|
|
10084
|
+
"tracer": asUnchanged,
|
|
10085
|
+
"try": asUnchanged,
|
|
10086
|
+
"tryPromise": asUnchanged,
|
|
10087
|
+
"uninterruptible": asUnchanged,
|
|
10088
|
+
"uninterruptibleMask": asUnchanged,
|
|
10089
|
+
"updateService": asUnchanged,
|
|
10090
|
+
"useSpan": asUnchanged,
|
|
10091
|
+
"void": asUnchanged,
|
|
10092
|
+
"when": asUnchanged,
|
|
10093
|
+
"whileLoop": asUnchanged,
|
|
10094
|
+
"withConcurrency": asUnchanged,
|
|
10095
|
+
"withExecutionPlan": asUnchanged,
|
|
10096
|
+
"withLogSpan": asUnchanged,
|
|
10097
|
+
"withParentSpan": asUnchanged,
|
|
10098
|
+
"withSpan": asUnchanged,
|
|
10099
|
+
"withSpanScoped": asUnchanged,
|
|
10100
|
+
"withTracer": asUnchanged,
|
|
10101
|
+
"withTracerEnabled": asUnchanged,
|
|
10102
|
+
"withTracerTiming": asUnchanged,
|
|
10103
|
+
"yieldNow": asUnchanged,
|
|
10104
|
+
"zip": asUnchanged,
|
|
10105
|
+
"zipWith": asUnchanged,
|
|
10106
|
+
// Renamed APIs (v3 name → v4 name)
|
|
10107
|
+
"catchAll": asRenamedSameBehaviour("catch"),
|
|
10108
|
+
"catchAllCause": asRenamedSameBehaviour("catchCause"),
|
|
10109
|
+
"catchAllDefect": asRenamedSameBehaviour("catchDefect"),
|
|
10110
|
+
"catchSome": asRemoved(
|
|
10111
|
+
"Use Effect.catchIf instead. Note: the API shape changed from returning Option<Effect> to taking a predicate and handler separately."
|
|
10112
|
+
),
|
|
10113
|
+
"catchSomeCause": asRemoved(
|
|
10114
|
+
"Use Effect.catchCauseIf instead. Note: the API shape changed from returning Option<Effect> to taking a predicate and handler separately."
|
|
10115
|
+
),
|
|
10116
|
+
"ensureErrorType": asRenamedSameBehaviour("satisfiesErrorType"),
|
|
10117
|
+
"ensureRequirementsType": asRenamedSameBehaviour("satisfiesServicesType"),
|
|
10118
|
+
"ensureSuccessType": asRenamedSameBehaviour("satisfiesSuccessType"),
|
|
10119
|
+
"fork": asRenamedSameBehaviour("forkChild"),
|
|
10120
|
+
"forkDaemon": asRenamedSameBehaviour("forkDetach"),
|
|
10121
|
+
"scopeWith": asRenamedSameBehaviour("scopedWith"),
|
|
10122
|
+
"serviceOptional": asRenamedSameBehaviour("serviceOption"),
|
|
10123
|
+
"tapErrorCause": asRenamedSameBehaviour("tapCause"),
|
|
10124
|
+
// Removed APIs
|
|
10125
|
+
"annotateLogsScoped": asUnchanged,
|
|
10126
|
+
"awaitAllChildren": asUnchanged,
|
|
10127
|
+
"bind": asUnchanged,
|
|
10128
|
+
"bindTo": asUnchanged,
|
|
10129
|
+
"Do": asUnchanged,
|
|
10130
|
+
"let": asUnchanged,
|
|
10131
|
+
"partition": asUnchanged,
|
|
10132
|
+
"validate": asUnchanged,
|
|
10133
|
+
"catchSomeDefect": asRemoved(
|
|
10134
|
+
"Use Effect.catchDefect or Effect.matchCause to handle specific defects."
|
|
10135
|
+
),
|
|
10136
|
+
"forkAll": asRemoved(
|
|
10137
|
+
"Fork effects individually with Effect.forEach and Effect.forkChild, or use Effect.all with concurrency options."
|
|
10138
|
+
),
|
|
10139
|
+
"forkWithErrorHandler": asRemoved(
|
|
10140
|
+
"Fork the effect with Effect.forkChild and observe the fiber result via Fiber.join or Fiber.await."
|
|
10141
|
+
),
|
|
10142
|
+
"Tag": asRemoved(
|
|
10143
|
+
"Use ServiceMap.Service instead of Effect.Tag."
|
|
10144
|
+
),
|
|
10145
|
+
"Service": asRemoved(
|
|
10146
|
+
"Use ServiceMap.Service instead of Effect.Service."
|
|
10147
|
+
),
|
|
10148
|
+
"runtime": asRemoved(
|
|
10149
|
+
"Runtime has been removed in Effect v4. Use Effect.services to grab services and then run using Effect.runPromiseWith."
|
|
10150
|
+
),
|
|
10151
|
+
"bindAll": asRemoved(
|
|
10152
|
+
"Use Effect.gen instead of Effect.bindAll."
|
|
10153
|
+
),
|
|
10154
|
+
"EffectTypeId": asRemoved(
|
|
10155
|
+
"EffectTypeId has been removed in Effect v4."
|
|
10156
|
+
),
|
|
10157
|
+
"acquireReleaseInterruptible": asRemoved(
|
|
10158
|
+
"Use Effect.acquireRelease instead."
|
|
10159
|
+
),
|
|
10160
|
+
"allSuccesses": asRemoved(
|
|
10161
|
+
"Use Effect.all with the { mode: 'either' } option and filter successes."
|
|
10162
|
+
),
|
|
10163
|
+
"allWith": asRemoved(
|
|
10164
|
+
"Use Effect.all with options instead."
|
|
10165
|
+
),
|
|
10166
|
+
"allowInterrupt": asRemoved(
|
|
10167
|
+
"Use Effect.yieldNow instead."
|
|
10168
|
+
),
|
|
10169
|
+
"ap": asRemoved(
|
|
10170
|
+
"Use Effect.map and Effect.flatMap to apply functions instead."
|
|
10171
|
+
),
|
|
10172
|
+
"asSomeError": asRemoved(
|
|
10173
|
+
"Use Effect.mapError(Option.some) instead."
|
|
10174
|
+
),
|
|
10175
|
+
"async": asRenamedAndNeedsOptions("callback", "Note: in v4 the callback receives a Scheduler as 'this' context."),
|
|
10176
|
+
"asyncEffect": asRemoved(
|
|
10177
|
+
"Use Effect.suspend combined with Effect.promise instead."
|
|
10178
|
+
),
|
|
10179
|
+
"blocked": asRemoved(
|
|
10180
|
+
"The request batching API has been reworked in Effect v4."
|
|
10181
|
+
),
|
|
10182
|
+
"cacheRequestResult": asRemoved(
|
|
10183
|
+
"The request batching API has been reworked in Effect v4."
|
|
10184
|
+
),
|
|
10185
|
+
"cachedFunction": asRemoved(
|
|
10186
|
+
"Use Effect.cached or implement caching with a Ref instead."
|
|
10187
|
+
),
|
|
10188
|
+
"cause": asRemoved(
|
|
10189
|
+
"Use Effect.matchCause or Effect.sandbox to access the cause."
|
|
10190
|
+
),
|
|
10191
|
+
"checkInterruptible": asRemoved(
|
|
10192
|
+
"Interruption checking has been removed in Effect v4."
|
|
10193
|
+
),
|
|
10194
|
+
"clock": asRemoved(
|
|
10195
|
+
"Use Effect.clockWith instead."
|
|
10196
|
+
),
|
|
10197
|
+
"configProviderWith": asRemoved(
|
|
10198
|
+
"ConfigProvider access has been reworked in Effect v4."
|
|
10199
|
+
),
|
|
10200
|
+
"console": asRemoved(
|
|
10201
|
+
"Use Effect.consoleWith or the Console service directly."
|
|
10202
|
+
),
|
|
10203
|
+
"consoleWith": asRemoved(
|
|
10204
|
+
"Console access has been reworked in Effect v4."
|
|
10205
|
+
),
|
|
10206
|
+
"context": asRemoved(
|
|
10207
|
+
"Use Effect.context is removed. Access services directly via yield* or Effect.provideService."
|
|
10208
|
+
),
|
|
10209
|
+
"contextWith": asRemoved(
|
|
10210
|
+
"Use Effect.map with service access instead."
|
|
10211
|
+
),
|
|
10212
|
+
"contextWithEffect": asRemoved(
|
|
10213
|
+
"Use Effect.flatMap with service access instead."
|
|
10214
|
+
),
|
|
10215
|
+
"custom": asRemoved(
|
|
10216
|
+
"Use Effect.suspend or Effect.sync to create custom effects."
|
|
10217
|
+
),
|
|
10218
|
+
"daemonChildren": asRemoved(
|
|
10219
|
+
"Use Effect.forkDetach to fork detached fibers instead."
|
|
10220
|
+
),
|
|
10221
|
+
"descriptor": asRemoved(
|
|
10222
|
+
"Fiber descriptor access has been removed in Effect v4."
|
|
10223
|
+
),
|
|
10224
|
+
"descriptorWith": asRemoved(
|
|
10225
|
+
"Fiber descriptor access has been removed in Effect v4."
|
|
10226
|
+
),
|
|
10227
|
+
"dieMessage": asRemoved(
|
|
10228
|
+
"Use Effect.die(new Error(message)) instead."
|
|
10229
|
+
),
|
|
10230
|
+
"dieSync": asRemoved(
|
|
10231
|
+
"Use Effect.die with a lazily evaluated value instead."
|
|
10232
|
+
),
|
|
10233
|
+
"diffFiberRefs": asRemoved(
|
|
10234
|
+
"FiberRef has been replaced by ServiceMap.Reference in Effect v4."
|
|
10235
|
+
),
|
|
10236
|
+
"disconnect": asRemoved(
|
|
10237
|
+
"Fiber disconnect has been removed in Effect v4."
|
|
10238
|
+
),
|
|
10239
|
+
"dropUntil": asRemoved(
|
|
10240
|
+
"Use Array.dropUntil and Effect.forEach instead."
|
|
10241
|
+
),
|
|
10242
|
+
"dropWhile": asRemoved(
|
|
10243
|
+
"Use Array.dropWhile and Effect.forEach instead."
|
|
10244
|
+
),
|
|
10245
|
+
"either": asRenamedAndNeedsOptions(
|
|
10246
|
+
"result",
|
|
10247
|
+
"Note: returns Result.Result<A, E> instead of Either<E, A>. Use the Result module to work with the result."
|
|
10248
|
+
),
|
|
10249
|
+
"ensuringChild": asRemoved(
|
|
10250
|
+
"Use Effect.onExit to manage child fiber cleanup instead."
|
|
10251
|
+
),
|
|
10252
|
+
"ensuringChildren": asRemoved(
|
|
10253
|
+
"Use Effect.onExit to manage child fiber cleanup instead."
|
|
10254
|
+
),
|
|
10255
|
+
"every": asRemoved(
|
|
10256
|
+
"Use Effect.forEach with a predicate check instead."
|
|
10257
|
+
),
|
|
10258
|
+
"exists": asRemoved(
|
|
10259
|
+
"Use Effect.forEach with a predicate check instead."
|
|
10260
|
+
),
|
|
10261
|
+
"fiberIdWith": asRemoved(
|
|
10262
|
+
"Use Effect.fiberId instead."
|
|
10263
|
+
),
|
|
10264
|
+
"filterEffectOrElse": asRemoved(
|
|
10265
|
+
"Use Effect.filterOrElse with an effectful predicate instead."
|
|
10266
|
+
),
|
|
10267
|
+
"filterEffectOrFail": asRemoved(
|
|
10268
|
+
"Use Effect.filterOrFail with an effectful predicate instead."
|
|
10269
|
+
),
|
|
10270
|
+
"filterOrDie": asRemoved(
|
|
10271
|
+
"Use Effect.filterOrFail and Effect.orDie instead."
|
|
10272
|
+
),
|
|
10273
|
+
"filterOrDieMessage": asRemoved(
|
|
10274
|
+
"Use Effect.filterOrFail and Effect.orDie instead."
|
|
10275
|
+
),
|
|
10276
|
+
"finalizersMask": asRemoved(
|
|
10277
|
+
"Finalizer masking has been removed in Effect v4."
|
|
10278
|
+
),
|
|
10279
|
+
"findFirst": asUnchanged,
|
|
10280
|
+
"firstSuccessOf": asRemoved(
|
|
10281
|
+
"Use Effect.raceAll instead."
|
|
10282
|
+
),
|
|
10283
|
+
"flipWith": asRemoved(
|
|
10284
|
+
"Use Effect.flip combined with the desired transformation instead."
|
|
10285
|
+
),
|
|
10286
|
+
"fromFiber": asRemoved(
|
|
10287
|
+
"Use Fiber.join instead."
|
|
10288
|
+
),
|
|
10289
|
+
"fromFiberEffect": asRemoved(
|
|
10290
|
+
"Use Effect.flatMap with Fiber.join instead."
|
|
10291
|
+
),
|
|
10292
|
+
"fromNullable": asRemoved(
|
|
10293
|
+
"Use Effect.suspend with null checks instead."
|
|
10294
|
+
),
|
|
10295
|
+
"functionWithSpan": asRemoved(
|
|
10296
|
+
"Use Effect.withSpan instead."
|
|
10297
|
+
),
|
|
10298
|
+
"getFiberRefs": asRemoved(
|
|
10299
|
+
"FiberRef has been replaced by ServiceMap.Reference in Effect v4."
|
|
10300
|
+
),
|
|
10301
|
+
"getRuntimeFlags": asRemoved(
|
|
10302
|
+
"Runtime flags have been removed in Effect v4."
|
|
10303
|
+
),
|
|
10304
|
+
"head": asRemoved(
|
|
10305
|
+
"Use Array.head and Effect.flatMap instead."
|
|
10306
|
+
),
|
|
10307
|
+
"if": asRemoved(
|
|
10308
|
+
"Use Effect.when instead of Effect.if."
|
|
10309
|
+
),
|
|
10310
|
+
"ignoreLogged": asRemoved(
|
|
10311
|
+
"Logging configuration has been reworked in Effect v4."
|
|
10312
|
+
),
|
|
10313
|
+
"inheritFiberRefs": asRemoved(
|
|
10314
|
+
"FiberRef has been replaced by ServiceMap.Reference in Effect v4."
|
|
10315
|
+
),
|
|
10316
|
+
"interruptWith": asRemoved(
|
|
10317
|
+
"Use Effect.interrupt instead."
|
|
10318
|
+
),
|
|
10319
|
+
"intoDeferred": asRemoved(
|
|
10320
|
+
"Use Deferred.complete instead."
|
|
10321
|
+
),
|
|
10322
|
+
"iterate": asRemoved(
|
|
10323
|
+
"Use Effect.whileLoop or recursion with Effect.suspend instead."
|
|
10324
|
+
),
|
|
10325
|
+
"labelMetrics": asRemoved(
|
|
10326
|
+
"Metric labeling has been reworked in Effect v4."
|
|
10327
|
+
),
|
|
10328
|
+
"labelMetricsScoped": asRemoved(
|
|
10329
|
+
"Metric labeling has been reworked in Effect v4."
|
|
10330
|
+
),
|
|
10331
|
+
"liftPredicate": asRemoved(
|
|
10332
|
+
"Use Effect.filterOrFail instead."
|
|
10333
|
+
),
|
|
10334
|
+
"linkSpanCurrent": asRemoved(
|
|
10335
|
+
"Use Effect.linkSpans instead."
|
|
10336
|
+
),
|
|
10337
|
+
"locally": asRemoved(
|
|
10338
|
+
"FiberRef.locally has been removed. Use Effect.provideService with ServiceMap.Reference instead."
|
|
10339
|
+
),
|
|
10340
|
+
"locallyScoped": asRemoved(
|
|
10341
|
+
"FiberRef.locally has been removed. Use Effect.provideService with ServiceMap.Reference instead."
|
|
10342
|
+
),
|
|
10343
|
+
"locallyScopedWith": asRemoved(
|
|
10344
|
+
"FiberRef.locally has been removed. Use Effect.provideService with ServiceMap.Reference instead."
|
|
10345
|
+
),
|
|
10346
|
+
"locallyWith": asRemoved(
|
|
10347
|
+
"FiberRef.locally has been removed. Use Effect.provideService with ServiceMap.Reference instead."
|
|
10348
|
+
),
|
|
10349
|
+
"logAnnotations": asRemoved(
|
|
10350
|
+
"Use Effect.annotateLogs instead."
|
|
10351
|
+
),
|
|
10352
|
+
"loop": asRemoved(
|
|
10353
|
+
"Use Effect.whileLoop or recursion with Effect.suspend instead."
|
|
10354
|
+
),
|
|
10355
|
+
"mapAccum": asRemoved(
|
|
10356
|
+
"Use Effect.gen with a mutable accumulator instead."
|
|
10357
|
+
),
|
|
10358
|
+
"mapErrorCause": asRemoved(
|
|
10359
|
+
"Use Effect.sandbox and Effect.mapError instead."
|
|
10360
|
+
),
|
|
10361
|
+
"mapInputContext": asRemoved(
|
|
10362
|
+
"Use Effect.provide with a layer instead."
|
|
10363
|
+
),
|
|
10364
|
+
"merge": asRemoved(
|
|
10365
|
+
"Use Effect.match or Effect.exit instead."
|
|
10366
|
+
),
|
|
10367
|
+
"mergeAll": asRemoved(
|
|
10368
|
+
"Use Effect.forEach with a mutable accumulator instead."
|
|
10369
|
+
),
|
|
10370
|
+
"metricLabels": asRemoved(
|
|
10371
|
+
"Metric labeling has been reworked in Effect v4."
|
|
10372
|
+
),
|
|
10373
|
+
"negate": asRemoved(
|
|
10374
|
+
"Use Effect.map with boolean negation instead."
|
|
10375
|
+
),
|
|
10376
|
+
"none": asRemoved(
|
|
10377
|
+
"Use Effect.filterOrFail or Effect.option instead."
|
|
10378
|
+
),
|
|
10379
|
+
"once": asRemoved(
|
|
10380
|
+
"Use Effect.cached instead."
|
|
10381
|
+
),
|
|
10382
|
+
"optionFromOptional": asRemoved(
|
|
10383
|
+
"Use Effect.option instead."
|
|
10384
|
+
),
|
|
10385
|
+
"orDieWith": asRemoved(
|
|
10386
|
+
"Use Effect.orDie or Effect.mapError combined with Effect.orDie instead."
|
|
10387
|
+
),
|
|
10388
|
+
"orElse": asRemoved(
|
|
10389
|
+
"Use Effect.catch or Effect.matchEffect instead."
|
|
10390
|
+
),
|
|
10391
|
+
"orElseFail": asRemoved(
|
|
10392
|
+
"Use Effect.mapError instead."
|
|
10393
|
+
),
|
|
10394
|
+
"parallelErrors": asRemoved(
|
|
10395
|
+
"Use Effect.all with concurrency options instead."
|
|
10396
|
+
),
|
|
10397
|
+
"parallelFinalizers": asRemoved(
|
|
10398
|
+
"Finalizer ordering configuration has been removed in Effect v4."
|
|
10399
|
+
),
|
|
10400
|
+
"patchFiberRefs": asRemoved(
|
|
10401
|
+
"FiberRef has been replaced by ServiceMap.Reference in Effect v4."
|
|
10402
|
+
),
|
|
10403
|
+
"patchRuntimeFlags": asRemoved(
|
|
10404
|
+
"Runtime flags have been removed in Effect v4."
|
|
10405
|
+
),
|
|
10406
|
+
"raceWith": asRemoved(
|
|
10407
|
+
"Use Effect.race or Effect.raceFirst instead."
|
|
10408
|
+
),
|
|
10409
|
+
"random": asRemoved(
|
|
10410
|
+
"Use Effect.randomWith instead."
|
|
10411
|
+
),
|
|
10412
|
+
"randomWith": asRemoved(
|
|
10413
|
+
"Random access has been reworked in Effect v4."
|
|
10414
|
+
),
|
|
10415
|
+
"reduce": asRemoved(
|
|
10416
|
+
"Use Effect.forEach with a mutable accumulator or Effect.gen instead."
|
|
10417
|
+
),
|
|
10418
|
+
"reduceEffect": asRemoved(
|
|
10419
|
+
"Use Effect.forEach with a mutable accumulator or Effect.gen instead."
|
|
10420
|
+
),
|
|
10421
|
+
"reduceRight": asRemoved(
|
|
10422
|
+
"Use Effect.forEach with a mutable accumulator or Effect.gen instead."
|
|
10423
|
+
),
|
|
10424
|
+
"reduceWhile": asRemoved(
|
|
10425
|
+
"Use Effect.gen with early return instead."
|
|
10426
|
+
),
|
|
10427
|
+
"repeatN": asRemoved(
|
|
10428
|
+
"Use Effect.repeat with a schedule instead."
|
|
10429
|
+
),
|
|
10430
|
+
"runRequestBlock": asRemoved(
|
|
10431
|
+
"The request batching API has been reworked in Effect v4."
|
|
10432
|
+
),
|
|
10433
|
+
"scheduleForked": asRemoved(
|
|
10434
|
+
"Use Effect.schedule combined with Effect.forkChild instead."
|
|
10435
|
+
),
|
|
10436
|
+
"sequentialFinalizers": asRemoved(
|
|
10437
|
+
"Finalizer ordering configuration has been removed in Effect v4."
|
|
10438
|
+
),
|
|
10439
|
+
"serviceConstants": asRemoved(
|
|
10440
|
+
"Service helpers have been removed. Use ServiceMap.Service and yield* to access services."
|
|
10441
|
+
),
|
|
10442
|
+
"serviceFunction": asRemoved(
|
|
10443
|
+
"Service helpers have been removed. Use ServiceMap.Service and yield* to access services."
|
|
10444
|
+
),
|
|
10445
|
+
"serviceFunctionEffect": asRemoved(
|
|
10446
|
+
"Service helpers have been removed. Use ServiceMap.Service and yield* to access services."
|
|
10447
|
+
),
|
|
10448
|
+
"serviceFunctions": asRemoved(
|
|
10449
|
+
"Service helpers have been removed. Use ServiceMap.Service and yield* to access services."
|
|
10450
|
+
),
|
|
10451
|
+
"serviceMembers": asRemoved(
|
|
10452
|
+
"Service helpers have been removed. Use ServiceMap.Service and yield* to access services."
|
|
10453
|
+
),
|
|
10454
|
+
"setFiberRefs": asRemoved(
|
|
10455
|
+
"FiberRef has been replaced by ServiceMap.Reference in Effect v4."
|
|
10456
|
+
),
|
|
10457
|
+
"step": asRemoved(
|
|
10458
|
+
"The request batching API has been reworked in Effect v4."
|
|
10459
|
+
),
|
|
10460
|
+
"summarized": asRemoved(
|
|
10461
|
+
"Use Effect.gen to capture before/after state instead."
|
|
10462
|
+
),
|
|
10463
|
+
"supervised": asRemoved(
|
|
10464
|
+
"Supervision has been reworked in Effect v4."
|
|
10465
|
+
),
|
|
10466
|
+
"tagMetrics": asRemoved(
|
|
10467
|
+
"Metric labeling has been reworked in Effect v4."
|
|
10468
|
+
),
|
|
10469
|
+
"tagMetricsScoped": asRemoved(
|
|
10470
|
+
"Metric labeling has been reworked in Effect v4."
|
|
10471
|
+
),
|
|
10472
|
+
"takeUntil": asRemoved(
|
|
10473
|
+
"Use Array.takeUntil and Effect.forEach instead."
|
|
10474
|
+
),
|
|
10475
|
+
"takeWhile": asRemoved(
|
|
10476
|
+
"Use Array.takeWhile and Effect.forEach instead."
|
|
10477
|
+
),
|
|
10478
|
+
"tapBoth": asRemoved(
|
|
10479
|
+
"Use Effect.tap and Effect.tapError instead."
|
|
10480
|
+
),
|
|
10481
|
+
"timedWith": asRemoved(
|
|
10482
|
+
"Use Effect.timed instead."
|
|
10483
|
+
),
|
|
10484
|
+
"timeoutFail": asRemoved(
|
|
10485
|
+
"Use Effect.timeout combined with Effect.catchTag for TimeoutException instead."
|
|
10486
|
+
),
|
|
10487
|
+
"timeoutFailCause": asRemoved(
|
|
10488
|
+
"Use Effect.timeout combined with Effect.sandbox instead."
|
|
10489
|
+
),
|
|
10490
|
+
"timeoutTo": asRemoved(
|
|
10491
|
+
"Use Effect.timeoutOption and Effect.map instead."
|
|
10492
|
+
),
|
|
10493
|
+
"tracerWith": asRemoved(
|
|
10494
|
+
"Use Effect.tracer instead."
|
|
10495
|
+
),
|
|
10496
|
+
"transplant": asRemoved(
|
|
10497
|
+
"Fiber transplanting has been removed in Effect v4."
|
|
10498
|
+
),
|
|
10499
|
+
"transposeMapOption": asRemoved(
|
|
10500
|
+
"Use Effect.map with Option operations instead."
|
|
10501
|
+
),
|
|
10502
|
+
"transposeOption": asRemoved(
|
|
10503
|
+
"Use Effect.option instead."
|
|
10504
|
+
),
|
|
10505
|
+
"tryMap": asRemoved(
|
|
10506
|
+
"Use Effect.map inside Effect.try instead."
|
|
10507
|
+
),
|
|
10508
|
+
"tryMapPromise": asRemoved(
|
|
10509
|
+
"Use Effect.tryPromise instead."
|
|
10510
|
+
),
|
|
10511
|
+
"unless": asRemoved(
|
|
10512
|
+
"Use Effect.when with a negated condition instead."
|
|
10513
|
+
),
|
|
10514
|
+
"unlessEffect": asRemoved(
|
|
10515
|
+
"Use Effect.when with a negated effectful condition instead."
|
|
10516
|
+
),
|
|
10517
|
+
"unsafeMakeLatch": asRemoved(
|
|
10518
|
+
"Use Effect.makeLatch instead."
|
|
10519
|
+
),
|
|
10520
|
+
"unsafeMakeSemaphore": asRemoved(
|
|
10521
|
+
"Use Effect.makeSemaphore instead."
|
|
10522
|
+
),
|
|
10523
|
+
"unsandbox": asRemoved(
|
|
10524
|
+
"Use Effect.catchCause instead."
|
|
10525
|
+
),
|
|
10526
|
+
"updateFiberRefs": asRemoved(
|
|
10527
|
+
"FiberRef has been replaced by ServiceMap.Reference in Effect v4."
|
|
10528
|
+
),
|
|
10529
|
+
"using": asRemoved(
|
|
10530
|
+
"Use Effect.scoped instead."
|
|
10531
|
+
),
|
|
10532
|
+
"validateAll": asRemoved(
|
|
10533
|
+
"Use Effect.all with { mode: 'validate' } instead."
|
|
10534
|
+
),
|
|
10535
|
+
"validateFirst": asRemoved(
|
|
10536
|
+
"Use Effect.all with { mode: 'validate' } instead."
|
|
10537
|
+
),
|
|
10538
|
+
"validateWith": asRemoved(
|
|
10539
|
+
"Use Effect.all with { mode: 'validate' } instead."
|
|
10540
|
+
),
|
|
10541
|
+
"whenEffect": asRemoved(
|
|
10542
|
+
"Use Effect.when with an effectful condition via Effect.flatMap instead."
|
|
10543
|
+
),
|
|
10544
|
+
"whenFiberRef": asRemoved(
|
|
10545
|
+
"FiberRef has been replaced by ServiceMap.Reference in Effect v4."
|
|
10546
|
+
),
|
|
10547
|
+
"whenLogLevel": asRemoved(
|
|
10548
|
+
"Log level checking has been reworked in Effect v4."
|
|
10549
|
+
),
|
|
10550
|
+
"whenRef": asRemoved(
|
|
10551
|
+
"Use Ref.get and Effect.when instead."
|
|
10552
|
+
),
|
|
10553
|
+
"withClock": asRemoved(
|
|
10554
|
+
"Clock configuration has been reworked in Effect v4."
|
|
10555
|
+
),
|
|
10556
|
+
"withClockScoped": asRemoved(
|
|
10557
|
+
"Clock configuration has been reworked in Effect v4."
|
|
10558
|
+
),
|
|
10559
|
+
"withConfigProvider": asRemoved(
|
|
10560
|
+
"ConfigProvider configuration has been reworked in Effect v4."
|
|
10561
|
+
),
|
|
10562
|
+
"withConfigProviderScoped": asRemoved(
|
|
10563
|
+
"ConfigProvider configuration has been reworked in Effect v4."
|
|
10564
|
+
),
|
|
10565
|
+
"withConsole": asRemoved(
|
|
10566
|
+
"Console configuration has been reworked in Effect v4."
|
|
10567
|
+
),
|
|
10568
|
+
"withConsoleScoped": asRemoved(
|
|
10569
|
+
"Console configuration has been reworked in Effect v4."
|
|
10570
|
+
),
|
|
10571
|
+
"withEarlyRelease": asRemoved(
|
|
10572
|
+
"Use Effect.scoped with manual resource management instead."
|
|
10573
|
+
),
|
|
10574
|
+
"withFiberRuntime": asRenamedAndNeedsOptions(
|
|
10575
|
+
"withFiber",
|
|
10576
|
+
"Note: in v4, only the Fiber is provided (not the full FiberRuntime with status). The callback receives (fiber: Fiber<unknown, unknown>) instead of (fiber: FiberRuntime<A, E>, status: FiberStatus)."
|
|
10577
|
+
),
|
|
10578
|
+
"withMaxOpsBeforeYield": asRemoved(
|
|
10579
|
+
"Use ServiceMap.Reference for MaxOpsBeforeYield configuration instead."
|
|
10580
|
+
),
|
|
10581
|
+
"withMetric": asRemoved(
|
|
10582
|
+
"Metric configuration has been reworked in Effect v4."
|
|
10583
|
+
),
|
|
10584
|
+
"withRandom": asRemoved(
|
|
10585
|
+
"Random configuration has been reworked in Effect v4."
|
|
10586
|
+
),
|
|
10587
|
+
"withRandomFixed": asRemoved(
|
|
10588
|
+
"Random configuration has been reworked in Effect v4."
|
|
10589
|
+
),
|
|
10590
|
+
"withRandomScoped": asRemoved(
|
|
10591
|
+
"Random configuration has been reworked in Effect v4."
|
|
10592
|
+
),
|
|
10593
|
+
"withRequestBatching": asRemoved(
|
|
10594
|
+
"Request batching configuration has been reworked in Effect v4."
|
|
10595
|
+
),
|
|
10596
|
+
"withRequestCache": asRemoved(
|
|
10597
|
+
"Request caching configuration has been reworked in Effect v4."
|
|
10598
|
+
),
|
|
10599
|
+
"withRequestCaching": asRemoved(
|
|
10600
|
+
"Request caching configuration has been reworked in Effect v4."
|
|
10601
|
+
),
|
|
10602
|
+
"withRuntimeFlagsPatch": asRemoved(
|
|
10603
|
+
"Runtime flags have been removed in Effect v4."
|
|
10604
|
+
),
|
|
10605
|
+
"withRuntimeFlagsPatchScoped": asRemoved(
|
|
10606
|
+
"Runtime flags have been removed in Effect v4."
|
|
10607
|
+
),
|
|
10608
|
+
"withScheduler": asRemoved(
|
|
10609
|
+
"Use ServiceMap.Reference for Scheduler configuration instead."
|
|
10610
|
+
),
|
|
10611
|
+
"withSchedulingPriority": asRemoved(
|
|
10612
|
+
"Scheduling priority configuration has been removed in Effect v4."
|
|
10613
|
+
),
|
|
10614
|
+
"withTracerScoped": asRemoved(
|
|
10615
|
+
"Use Effect.withTracer instead."
|
|
10616
|
+
),
|
|
10617
|
+
"withUnhandledErrorLogLevel": asRemoved(
|
|
10618
|
+
"Use ServiceMap.Reference for UnhandledLogLevel configuration instead."
|
|
10619
|
+
),
|
|
10620
|
+
"zipLeft": asRemoved(
|
|
10621
|
+
"Use Effect.tap instead of Effect.zipLeft."
|
|
10622
|
+
),
|
|
10623
|
+
"zipRight": asRemoved(
|
|
10624
|
+
"Use Effect.andThen instead of Effect.zipRight."
|
|
10625
|
+
)
|
|
10626
|
+
};
|
|
10627
|
+
|
|
10628
|
+
// src/diagnostics/outdatedApi.ts
|
|
10629
|
+
var outdatedApi = createDiagnostic({
|
|
10630
|
+
name: "outdatedApi",
|
|
10631
|
+
code: 48,
|
|
10632
|
+
description: "Detects usage of APIs that have been removed or renamed in Effect v4",
|
|
10633
|
+
severity: "warning",
|
|
10634
|
+
apply: fn("outdatedApi.apply")(function* (sourceFile, report) {
|
|
10635
|
+
const typeParser = yield* service(TypeParser);
|
|
10636
|
+
const ts = yield* service(TypeScriptApi);
|
|
10637
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
10638
|
+
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
10639
|
+
if (typeParser.supportedEffect() === "v3") return;
|
|
10640
|
+
let hasReported = false;
|
|
10641
|
+
function reportMigration(propertyAccess, propertyName, _migration) {
|
|
10642
|
+
hasReported = true;
|
|
10643
|
+
report({
|
|
10644
|
+
location: propertyAccess.name,
|
|
10645
|
+
messageText: `${propertyName} is an Effect v3 API, but the project is using Effect v4.`,
|
|
10646
|
+
fixes: []
|
|
10647
|
+
});
|
|
10648
|
+
}
|
|
10649
|
+
const checkPropertyAccessMigration = (propertyAccess, checkRightNode, migrationDb) => {
|
|
10650
|
+
if (!ts.isPropertyAccessExpression(propertyAccess)) return;
|
|
10651
|
+
const identifier2 = propertyAccess.name;
|
|
10652
|
+
if (!ts.isIdentifier(identifier2)) return;
|
|
10653
|
+
const identifierName = ts.idText(identifier2);
|
|
10654
|
+
const migration = migrationDb[identifierName];
|
|
10655
|
+
if (!migration) return;
|
|
10656
|
+
if (migration._tag === "Unchanged") return;
|
|
10657
|
+
const targetType = typeCheckerUtils.getTypeAtLocation(propertyAccess.expression);
|
|
10658
|
+
if (!targetType) return;
|
|
10659
|
+
const targetPropertySymbol = typeChecker.getPropertyOfType(targetType, identifierName);
|
|
10660
|
+
if (targetPropertySymbol) return;
|
|
10661
|
+
return pipe(
|
|
10662
|
+
checkRightNode(propertyAccess.expression),
|
|
10663
|
+
map5(() => reportMigration(propertyAccess, identifierName, migration)),
|
|
10664
|
+
ignore
|
|
10665
|
+
);
|
|
10666
|
+
};
|
|
10667
|
+
const nodeToVisit = [];
|
|
10668
|
+
const appendNodeToVisit = (node) => {
|
|
10669
|
+
nodeToVisit.push(node);
|
|
10670
|
+
return void 0;
|
|
10671
|
+
};
|
|
10672
|
+
ts.forEachChild(sourceFile, appendNodeToVisit);
|
|
10673
|
+
while (nodeToVisit.length > 0) {
|
|
10674
|
+
const node = nodeToVisit.shift();
|
|
10675
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
10676
|
+
const checkEffectMigration = checkPropertyAccessMigration(
|
|
10677
|
+
node,
|
|
10678
|
+
typeParser.importedEffectModule,
|
|
10679
|
+
effectModuleMigrationDb
|
|
10680
|
+
);
|
|
10681
|
+
if (checkEffectMigration) {
|
|
10682
|
+
yield* ignore(checkEffectMigration);
|
|
10683
|
+
}
|
|
10684
|
+
}
|
|
10685
|
+
if (hasReported) {
|
|
10686
|
+
report({
|
|
10687
|
+
location: { pos: 0, end: 0 },
|
|
10688
|
+
messageText: "This project targets Effect v4, but is using Effect v3 APIs. To find the correct API to use, clone and consult the github.com/effect-ts/effect-smol repository for the corresponding v4 replacement.",
|
|
10689
|
+
fixes: []
|
|
10690
|
+
});
|
|
10691
|
+
}
|
|
10692
|
+
})
|
|
10693
|
+
});
|
|
10694
|
+
|
|
9595
10695
|
// src/diagnostics/outdatedEffectCodegen.ts
|
|
9596
10696
|
var outdatedEffectCodegen = createDiagnostic({
|
|
9597
10697
|
name: "outdatedEffectCodegen",
|
|
@@ -10962,6 +12062,7 @@ var unsupportedServiceAccessors = createDiagnostic({
|
|
|
10962
12062
|
|
|
10963
12063
|
// src/diagnostics.ts
|
|
10964
12064
|
var diagnostics = [
|
|
12065
|
+
outdatedApi,
|
|
10965
12066
|
anyUnknownInErrorContext,
|
|
10966
12067
|
instanceOfSchema,
|
|
10967
12068
|
catchAllToMapError,
|
|
@@ -10974,6 +12075,7 @@ var diagnostics = [
|
|
|
10974
12075
|
missingEffectServiceDependency,
|
|
10975
12076
|
missingLayerContext,
|
|
10976
12077
|
floatingEffect,
|
|
12078
|
+
effectInFailure,
|
|
10977
12079
|
missingStarInYieldEffectGen,
|
|
10978
12080
|
unnecessaryEffectGen,
|
|
10979
12081
|
unnecessaryFailYieldableError,
|
|
@@ -11130,7 +12232,7 @@ var effectSchemaSelfInClasses = createCompletion({
|
|
|
11130
12232
|
);
|
|
11131
12233
|
if (hasTaggedErrorCompletion) {
|
|
11132
12234
|
completions2.push({
|
|
11133
|
-
name: `
|
|
12235
|
+
name: `TaggedErrorClass<${name}>`,
|
|
11134
12236
|
kind: ts.ScriptElementKind.constElement,
|
|
11135
12237
|
insertText: isFullyQualified ? `${schemaIdentifier}.TaggedErrorClass<${name}>()("${errorTagKey}", {${"${0}"}}){}` : `TaggedErrorClass<${name}>()("${errorTagKey}", {${"${0}"}}){}`,
|
|
11136
12238
|
replacementSpan,
|
|
@@ -11187,6 +12289,33 @@ var effectSchemaSelfInClasses = createCompletion({
|
|
|
11187
12289
|
});
|
|
11188
12290
|
}
|
|
11189
12291
|
}
|
|
12292
|
+
if (typeParser.supportedEffect() === "v4") {
|
|
12293
|
+
const modelIdentifier = tsUtils.findImportedModuleIdentifierByPackageAndNameOrBarrel(
|
|
12294
|
+
sourceFile,
|
|
12295
|
+
"effect/unstable/schema",
|
|
12296
|
+
"Model"
|
|
12297
|
+
) || tsUtils.findImportedModuleIdentifierByPackageAndNameOrBarrel(
|
|
12298
|
+
sourceFile,
|
|
12299
|
+
"effect/unstable",
|
|
12300
|
+
"Model"
|
|
12301
|
+
) || "Model";
|
|
12302
|
+
const isModelFullyQualified = modelIdentifier === ts.idText(accessedObject);
|
|
12303
|
+
const hasModelClassCompletion = isModelFullyQualified || isSome2(
|
|
12304
|
+
yield* pipe(
|
|
12305
|
+
typeParser.isNodeReferenceToEffectSchemaModelModuleApi("Class")(accessedObject),
|
|
12306
|
+
option
|
|
12307
|
+
)
|
|
12308
|
+
);
|
|
12309
|
+
if (hasModelClassCompletion) {
|
|
12310
|
+
completions2.push({
|
|
12311
|
+
name: `Class<${name}>`,
|
|
12312
|
+
kind: ts.ScriptElementKind.constElement,
|
|
12313
|
+
insertText: isModelFullyQualified ? `${modelIdentifier}.Class<${name}>("${name}")({${"${0}"}}){}` : `Class<${name}>("${name}")({${"${0}"}}){}`,
|
|
12314
|
+
replacementSpan,
|
|
12315
|
+
isSnippet: true
|
|
12316
|
+
});
|
|
12317
|
+
}
|
|
12318
|
+
}
|
|
11190
12319
|
return completions2;
|
|
11191
12320
|
})
|
|
11192
12321
|
});
|
|
@@ -12443,7 +13572,7 @@ function effectTypeArgs(sourceFile, position, quickInfo2) {
|
|
|
12443
13572
|
if (!(data && data.shouldTry)) return quickInfo2;
|
|
12444
13573
|
const { atLocation, label, node, type } = data;
|
|
12445
13574
|
const effectTypeArgsDocumentation = yield* pipe(
|
|
12446
|
-
typeParser.
|
|
13575
|
+
typeParser.effectYieldableType(
|
|
12447
13576
|
type,
|
|
12448
13577
|
atLocation
|
|
12449
13578
|
),
|
|
@@ -18203,13 +19332,19 @@ var layerMagic = createRefactor({
|
|
|
18203
19332
|
map5((_) => _.ROut),
|
|
18204
19333
|
option
|
|
18205
19334
|
);
|
|
18206
|
-
const
|
|
19335
|
+
const sorted = pipe(
|
|
18207
19336
|
fromIterable(layerOutputTypes),
|
|
18208
|
-
sort(typeCheckerUtils.deterministicTypeOrder)
|
|
18209
|
-
partition(
|
|
18210
|
-
(_) => isNone2(previouslyProvided) || typeChecker.isTypeAssignableTo(_, previouslyProvided.value)
|
|
18211
|
-
)
|
|
19337
|
+
sort(typeCheckerUtils.deterministicTypeOrder)
|
|
18212
19338
|
);
|
|
19339
|
+
const existingBefore = [];
|
|
19340
|
+
const newlyIntroduced = [];
|
|
19341
|
+
for (const t of sorted) {
|
|
19342
|
+
if (isNone2(previouslyProvided) || typeChecker.isTypeAssignableTo(t, previouslyProvided.value)) {
|
|
19343
|
+
newlyIntroduced.push(t);
|
|
19344
|
+
} else {
|
|
19345
|
+
existingBefore.push(t);
|
|
19346
|
+
}
|
|
19347
|
+
}
|
|
18213
19348
|
const typeReferences = pipe(
|
|
18214
19349
|
newlyIntroduced,
|
|
18215
19350
|
map4((_) => typeChecker.typeToTypeNode(_, void 0, ts.NodeBuilderFlags.NoTruncation)),
|