@effect/language-service 0.75.1 → 0.77.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 +2 -0
- package/cli.js +27277 -31777
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +1940 -697
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +2679 -2878
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +1941 -698
- package/transform.js.map +1 -1
package/transform.js
CHANGED
|
@@ -24,15 +24,44 @@ __export(transform_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(transform_exports);
|
|
26
26
|
|
|
27
|
-
// ../../node_modules/.pnpm/effect@
|
|
28
|
-
var
|
|
27
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/Pipeable.js
|
|
28
|
+
var pipeArguments = (self, args3) => {
|
|
29
|
+
switch (args3.length) {
|
|
30
|
+
case 0:
|
|
31
|
+
return self;
|
|
32
|
+
case 1:
|
|
33
|
+
return args3[0](self);
|
|
34
|
+
case 2:
|
|
35
|
+
return args3[1](args3[0](self));
|
|
36
|
+
case 3:
|
|
37
|
+
return args3[2](args3[1](args3[0](self)));
|
|
38
|
+
case 4:
|
|
39
|
+
return args3[3](args3[2](args3[1](args3[0](self))));
|
|
40
|
+
case 5:
|
|
41
|
+
return args3[4](args3[3](args3[2](args3[1](args3[0](self)))));
|
|
42
|
+
case 6:
|
|
43
|
+
return args3[5](args3[4](args3[3](args3[2](args3[1](args3[0](self))))));
|
|
44
|
+
case 7:
|
|
45
|
+
return args3[6](args3[5](args3[4](args3[3](args3[2](args3[1](args3[0](self)))))));
|
|
46
|
+
case 8:
|
|
47
|
+
return args3[7](args3[6](args3[5](args3[4](args3[3](args3[2](args3[1](args3[0](self))))))));
|
|
48
|
+
case 9:
|
|
49
|
+
return args3[8](args3[7](args3[6](args3[5](args3[4](args3[3](args3[2](args3[1](args3[0](self)))))))));
|
|
50
|
+
default: {
|
|
51
|
+
let ret = self;
|
|
52
|
+
for (let i = 0, len = args3.length; i < len; i++) {
|
|
53
|
+
ret = args3[i](ret);
|
|
54
|
+
}
|
|
55
|
+
return ret;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/Function.js
|
|
29
61
|
var dual = function(arity, body) {
|
|
30
62
|
if (typeof arity === "function") {
|
|
31
63
|
return function() {
|
|
32
|
-
|
|
33
|
-
return body.apply(this, arguments);
|
|
34
|
-
}
|
|
35
|
-
return (self) => body(self, ...arguments);
|
|
64
|
+
return arity(arguments) ? body.apply(this, arguments) : (self) => body(self, ...arguments);
|
|
36
65
|
};
|
|
37
66
|
}
|
|
38
67
|
switch (arity) {
|
|
@@ -57,32 +86,14 @@ var dual = function(arity, body) {
|
|
|
57
86
|
return body(self, a, b);
|
|
58
87
|
};
|
|
59
88
|
};
|
|
60
|
-
case 4:
|
|
61
|
-
return function(a, b, c, d) {
|
|
62
|
-
if (arguments.length >= 4) {
|
|
63
|
-
return body(a, b, c, d);
|
|
64
|
-
}
|
|
65
|
-
return function(self) {
|
|
66
|
-
return body(self, a, b, c);
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
case 5:
|
|
70
|
-
return function(a, b, c, d, e) {
|
|
71
|
-
if (arguments.length >= 5) {
|
|
72
|
-
return body(a, b, c, d, e);
|
|
73
|
-
}
|
|
74
|
-
return function(self) {
|
|
75
|
-
return body(self, a, b, c, d);
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
89
|
default:
|
|
79
90
|
return function() {
|
|
80
91
|
if (arguments.length >= arity) {
|
|
81
92
|
return body.apply(this, arguments);
|
|
82
93
|
}
|
|
83
|
-
const
|
|
94
|
+
const args3 = arguments;
|
|
84
95
|
return function(self) {
|
|
85
|
-
return body(self, ...
|
|
96
|
+
return body(self, ...args3);
|
|
86
97
|
};
|
|
87
98
|
};
|
|
88
99
|
}
|
|
@@ -90,189 +101,57 @@ var dual = function(arity, body) {
|
|
|
90
101
|
var identity = (a) => a;
|
|
91
102
|
var constant = (value) => () => value;
|
|
92
103
|
var constUndefined = /* @__PURE__ */ constant(void 0);
|
|
93
|
-
function pipe(a,
|
|
94
|
-
|
|
95
|
-
case 1:
|
|
96
|
-
return a;
|
|
97
|
-
case 2:
|
|
98
|
-
return ab(a);
|
|
99
|
-
case 3:
|
|
100
|
-
return bc(ab(a));
|
|
101
|
-
case 4:
|
|
102
|
-
return cd(bc(ab(a)));
|
|
103
|
-
case 5:
|
|
104
|
-
return de(cd(bc(ab(a))));
|
|
105
|
-
case 6:
|
|
106
|
-
return ef(de(cd(bc(ab(a)))));
|
|
107
|
-
case 7:
|
|
108
|
-
return fg(ef(de(cd(bc(ab(a))))));
|
|
109
|
-
case 8:
|
|
110
|
-
return gh(fg(ef(de(cd(bc(ab(a)))))));
|
|
111
|
-
case 9:
|
|
112
|
-
return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
|
|
113
|
-
default: {
|
|
114
|
-
let ret = arguments[0];
|
|
115
|
-
for (let i = 1; i < arguments.length; i++) {
|
|
116
|
-
ret = arguments[i](ret);
|
|
117
|
-
}
|
|
118
|
-
return ret;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
104
|
+
function pipe(a, ...args3) {
|
|
105
|
+
return pipeArguments(a, args3);
|
|
121
106
|
}
|
|
122
107
|
|
|
123
|
-
// ../../node_modules/.pnpm/effect@
|
|
124
|
-
var
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
108
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/internal/equal.js
|
|
109
|
+
var getAllObjectKeys = (obj) => {
|
|
110
|
+
const keys2 = new Set(Reflect.ownKeys(obj));
|
|
111
|
+
if (obj.constructor === Object) return keys2;
|
|
112
|
+
if (obj instanceof Error) {
|
|
113
|
+
keys2.delete("stack");
|
|
114
|
+
}
|
|
115
|
+
const proto = Object.getPrototypeOf(obj);
|
|
116
|
+
let current = proto;
|
|
117
|
+
while (current !== null && current !== Object.prototype) {
|
|
118
|
+
const ownKeys = Reflect.ownKeys(current);
|
|
119
|
+
for (let i = 0; i < ownKeys.length; i++) {
|
|
120
|
+
keys2.add(ownKeys[i]);
|
|
121
|
+
}
|
|
122
|
+
current = Object.getPrototypeOf(current);
|
|
123
|
+
}
|
|
124
|
+
if (keys2.has("constructor") && typeof obj.constructor === "function" && proto === obj.constructor.prototype) {
|
|
125
|
+
keys2.delete("constructor");
|
|
126
|
+
}
|
|
127
|
+
return keys2;
|
|
135
128
|
};
|
|
129
|
+
var byReferenceInstances = /* @__PURE__ */ new WeakSet();
|
|
136
130
|
|
|
137
|
-
// ../../node_modules/.pnpm/effect@
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
get _F() {
|
|
158
|
-
return identity;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* @since 2.0.0
|
|
162
|
-
*/
|
|
163
|
-
get _R() {
|
|
164
|
-
return (_) => _;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* @since 2.0.0
|
|
168
|
-
*/
|
|
169
|
-
get _O() {
|
|
170
|
-
return (_) => _;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* @since 2.0.0
|
|
174
|
-
*/
|
|
175
|
-
get _E() {
|
|
176
|
-
return (_) => _;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* @since 2.0.0
|
|
180
|
-
*/
|
|
181
|
-
[GenKindTypeId] = GenKindTypeId;
|
|
182
|
-
/**
|
|
183
|
-
* @since 2.0.0
|
|
184
|
-
*/
|
|
185
|
-
[Symbol.iterator]() {
|
|
186
|
-
return new SingleShotGen(this);
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
var SingleShotGen = class _SingleShotGen {
|
|
190
|
-
self;
|
|
191
|
-
called = false;
|
|
192
|
-
constructor(self) {
|
|
193
|
-
this.self = self;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* @since 2.0.0
|
|
197
|
-
*/
|
|
198
|
-
next(a) {
|
|
199
|
-
return this.called ? {
|
|
200
|
-
value: a,
|
|
201
|
-
done: true
|
|
202
|
-
} : (this.called = true, {
|
|
203
|
-
value: this.self,
|
|
204
|
-
done: false
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* @since 2.0.0
|
|
209
|
-
*/
|
|
210
|
-
return(a) {
|
|
211
|
-
return {
|
|
212
|
-
value: a,
|
|
213
|
-
done: true
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* @since 2.0.0
|
|
218
|
-
*/
|
|
219
|
-
throw(e) {
|
|
220
|
-
throw e;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* @since 2.0.0
|
|
224
|
-
*/
|
|
225
|
-
[Symbol.iterator]() {
|
|
226
|
-
return new _SingleShotGen(this.self);
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
var MUL_HI = 1481765933 >>> 0;
|
|
230
|
-
var MUL_LO = 1284865837 >>> 0;
|
|
231
|
-
var YieldWrapTypeId = /* @__PURE__ */ Symbol.for("effect/Utils/YieldWrap");
|
|
232
|
-
var YieldWrap = class {
|
|
233
|
-
/**
|
|
234
|
-
* @since 3.0.6
|
|
235
|
-
*/
|
|
236
|
-
#value;
|
|
237
|
-
constructor(value) {
|
|
238
|
-
this.#value = value;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* @since 3.0.6
|
|
242
|
-
*/
|
|
243
|
-
[YieldWrapTypeId]() {
|
|
244
|
-
return this.#value;
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
var structuralRegionState = /* @__PURE__ */ globalValue("effect/Utils/isStructuralRegion", () => ({
|
|
248
|
-
enabled: false,
|
|
249
|
-
tester: void 0
|
|
250
|
-
}));
|
|
251
|
-
var standard = {
|
|
252
|
-
effect_internal_function: (body) => {
|
|
253
|
-
return body();
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
var forced = {
|
|
257
|
-
effect_internal_function: (body) => {
|
|
258
|
-
try {
|
|
259
|
-
return body();
|
|
260
|
-
} finally {
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
var isNotOptimizedAway = /* @__PURE__ */ standard.effect_internal_function(() => new Error().stack)?.includes("effect_internal_function") === true;
|
|
265
|
-
var internalCall = isNotOptimizedAway ? standard.effect_internal_function : forced.effect_internal_function;
|
|
266
|
-
var genConstructor = function* () {
|
|
267
|
-
}.constructor;
|
|
131
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/Predicate.js
|
|
132
|
+
function isString(input) {
|
|
133
|
+
return typeof input === "string";
|
|
134
|
+
}
|
|
135
|
+
function isNumber(input) {
|
|
136
|
+
return typeof input === "number";
|
|
137
|
+
}
|
|
138
|
+
function isBoolean(input) {
|
|
139
|
+
return typeof input === "boolean";
|
|
140
|
+
}
|
|
141
|
+
function isFunction(input) {
|
|
142
|
+
return typeof input === "function";
|
|
143
|
+
}
|
|
144
|
+
function isObject(input) {
|
|
145
|
+
return typeof input === "object" && input !== null && !Array.isArray(input);
|
|
146
|
+
}
|
|
147
|
+
function isObjectKeyword(input) {
|
|
148
|
+
return typeof input === "object" && input !== null || isFunction(input);
|
|
149
|
+
}
|
|
150
|
+
var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObjectKeyword(self) && property in self);
|
|
268
151
|
|
|
269
|
-
// ../../node_modules/.pnpm/effect@
|
|
270
|
-
var
|
|
271
|
-
var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
|
|
152
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/Hash.js
|
|
153
|
+
var symbol = "~effect/interfaces/Hash";
|
|
272
154
|
var hash = (self) => {
|
|
273
|
-
if (structuralRegionState.enabled === true) {
|
|
274
|
-
return 0;
|
|
275
|
-
}
|
|
276
155
|
switch (typeof self) {
|
|
277
156
|
case "number":
|
|
278
157
|
return number(self);
|
|
@@ -291,16 +170,32 @@ var hash = (self) => {
|
|
|
291
170
|
if (self === null) {
|
|
292
171
|
return string("null");
|
|
293
172
|
} else if (self instanceof Date) {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
return hash(self.toISOString());
|
|
298
|
-
} else if (self instanceof URL) {
|
|
299
|
-
return hash(self.href);
|
|
300
|
-
} else if (isHash(self)) {
|
|
301
|
-
return self[symbol]();
|
|
173
|
+
return string(self.toISOString());
|
|
174
|
+
} else if (self instanceof RegExp) {
|
|
175
|
+
return string(self.toString());
|
|
302
176
|
} else {
|
|
303
|
-
|
|
177
|
+
if (byReferenceInstances.has(self)) {
|
|
178
|
+
return random(self);
|
|
179
|
+
}
|
|
180
|
+
if (hashCache.has(self)) {
|
|
181
|
+
return hashCache.get(self);
|
|
182
|
+
}
|
|
183
|
+
const h = withVisitedTracking(self, () => {
|
|
184
|
+
if (isHash(self)) {
|
|
185
|
+
return self[symbol]();
|
|
186
|
+
} else if (typeof self === "function") {
|
|
187
|
+
return random(self);
|
|
188
|
+
} else if (Array.isArray(self)) {
|
|
189
|
+
return array(self);
|
|
190
|
+
} else if (self instanceof Map) {
|
|
191
|
+
return hashMap(self);
|
|
192
|
+
} else if (self instanceof Set) {
|
|
193
|
+
return hashSet(self);
|
|
194
|
+
}
|
|
195
|
+
return structure(self);
|
|
196
|
+
});
|
|
197
|
+
hashCache.set(self, h);
|
|
198
|
+
return h;
|
|
304
199
|
}
|
|
305
200
|
}
|
|
306
201
|
default:
|
|
@@ -313,12 +208,18 @@ var random = (self) => {
|
|
|
313
208
|
}
|
|
314
209
|
return randomHashCache.get(self);
|
|
315
210
|
};
|
|
316
|
-
var combine =
|
|
211
|
+
var combine = /* @__PURE__ */ dual(2, (self, b) => self * 53 ^ b);
|
|
317
212
|
var optimize = (n) => n & 3221225471 | n >>> 1 & 1073741824;
|
|
318
213
|
var isHash = (u) => hasProperty(u, symbol);
|
|
319
214
|
var number = (n) => {
|
|
320
|
-
if (n !== n
|
|
321
|
-
return
|
|
215
|
+
if (n !== n) {
|
|
216
|
+
return string("NaN");
|
|
217
|
+
}
|
|
218
|
+
if (n === Infinity) {
|
|
219
|
+
return string("Infinity");
|
|
220
|
+
}
|
|
221
|
+
if (n === -Infinity) {
|
|
222
|
+
return string("-Infinity");
|
|
322
223
|
}
|
|
323
224
|
let h = n | 0;
|
|
324
225
|
if (h !== n) {
|
|
@@ -338,38 +239,37 @@ var string = (str) => {
|
|
|
338
239
|
};
|
|
339
240
|
var structureKeys = (o, keys2) => {
|
|
340
241
|
let h = 12289;
|
|
341
|
-
for (
|
|
342
|
-
h ^=
|
|
242
|
+
for (const key of keys2) {
|
|
243
|
+
h ^= combine(hash(key), hash(o[key]));
|
|
343
244
|
}
|
|
344
245
|
return optimize(h);
|
|
345
246
|
};
|
|
346
|
-
var structure = (o) => structureKeys(o,
|
|
347
|
-
var
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
Object.defineProperty(self2, symbol, {
|
|
352
|
-
value() {
|
|
353
|
-
return hash3;
|
|
354
|
-
},
|
|
355
|
-
enumerable: false
|
|
356
|
-
});
|
|
357
|
-
return hash3;
|
|
358
|
-
};
|
|
247
|
+
var structure = (o) => structureKeys(o, getAllObjectKeys(o));
|
|
248
|
+
var iterableWith = (seed, f) => (iter) => {
|
|
249
|
+
let h = seed;
|
|
250
|
+
for (const element of iter) {
|
|
251
|
+
h ^= f(element);
|
|
359
252
|
}
|
|
360
|
-
|
|
361
|
-
const hash2 = arguments[1];
|
|
362
|
-
Object.defineProperty(self, symbol, {
|
|
363
|
-
value() {
|
|
364
|
-
return hash2;
|
|
365
|
-
},
|
|
366
|
-
enumerable: false
|
|
367
|
-
});
|
|
368
|
-
return hash2;
|
|
253
|
+
return optimize(h);
|
|
369
254
|
};
|
|
255
|
+
var array = /* @__PURE__ */ iterableWith(6151, hash);
|
|
256
|
+
var hashMap = /* @__PURE__ */ iterableWith(/* @__PURE__ */ string("Map"), ([k, v]) => combine(hash(k), hash(v)));
|
|
257
|
+
var hashSet = /* @__PURE__ */ iterableWith(/* @__PURE__ */ string("Set"), hash);
|
|
258
|
+
var randomHashCache = /* @__PURE__ */ new WeakMap();
|
|
259
|
+
var hashCache = /* @__PURE__ */ new WeakMap();
|
|
260
|
+
var visitedObjects = /* @__PURE__ */ new WeakSet();
|
|
261
|
+
function withVisitedTracking(obj, fn2) {
|
|
262
|
+
if (visitedObjects.has(obj)) {
|
|
263
|
+
return string("[Circular]");
|
|
264
|
+
}
|
|
265
|
+
visitedObjects.add(obj);
|
|
266
|
+
const result = fn2();
|
|
267
|
+
visitedObjects.delete(obj);
|
|
268
|
+
return result;
|
|
269
|
+
}
|
|
370
270
|
|
|
371
|
-
// ../../node_modules/.pnpm/effect@
|
|
372
|
-
var symbol2 =
|
|
271
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/Equal.js
|
|
272
|
+
var symbol2 = "~effect/interfaces/Equal";
|
|
373
273
|
function equals() {
|
|
374
274
|
if (arguments.length === 1) {
|
|
375
275
|
return (self) => compareBoth(self, arguments[0]);
|
|
@@ -377,245 +277,724 @@ function equals() {
|
|
|
377
277
|
return compareBoth(arguments[0], arguments[1]);
|
|
378
278
|
}
|
|
379
279
|
function compareBoth(self, that) {
|
|
380
|
-
if (self === that)
|
|
381
|
-
|
|
382
|
-
}
|
|
280
|
+
if (self === that) return true;
|
|
281
|
+
if (self == null || that == null) return false;
|
|
383
282
|
const selfType = typeof self;
|
|
384
283
|
if (selfType !== typeof that) {
|
|
385
284
|
return false;
|
|
386
285
|
}
|
|
387
|
-
if (selfType === "
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
286
|
+
if (selfType === "number" && self !== self && that !== that) {
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
if (selfType !== "object" && selfType !== "function") {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
if (byReferenceInstances.has(self) || byReferenceInstances.has(that)) {
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
return withCache(self, that, compareObjects);
|
|
296
|
+
}
|
|
297
|
+
function withVisitedTracking2(self, that, fn2) {
|
|
298
|
+
const hasLeft = visitedLeft.has(self);
|
|
299
|
+
const hasRight = visitedRight.has(that);
|
|
300
|
+
if (hasLeft && hasRight) {
|
|
301
|
+
return true;
|
|
302
|
+
}
|
|
303
|
+
if (hasLeft || hasRight) {
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
visitedLeft.add(self);
|
|
307
|
+
visitedRight.add(that);
|
|
308
|
+
const result = fn2();
|
|
309
|
+
visitedLeft.delete(self);
|
|
310
|
+
visitedRight.delete(that);
|
|
311
|
+
return result;
|
|
312
|
+
}
|
|
313
|
+
var visitedLeft = /* @__PURE__ */ new WeakSet();
|
|
314
|
+
var visitedRight = /* @__PURE__ */ new WeakSet();
|
|
315
|
+
function compareObjects(self, that) {
|
|
316
|
+
if (hash(self) !== hash(that)) {
|
|
317
|
+
return false;
|
|
318
|
+
} else if (self instanceof Date) {
|
|
319
|
+
if (!(that instanceof Date)) return false;
|
|
320
|
+
return self.toISOString() === that.toISOString();
|
|
321
|
+
} else if (self instanceof RegExp) {
|
|
322
|
+
if (!(that instanceof RegExp)) return false;
|
|
323
|
+
return self.toString() === that.toString();
|
|
324
|
+
}
|
|
325
|
+
const selfIsEqual = isEqual(self);
|
|
326
|
+
const thatIsEqual = isEqual(that);
|
|
327
|
+
if (selfIsEqual !== thatIsEqual) return false;
|
|
328
|
+
const bothEquals = selfIsEqual && thatIsEqual;
|
|
329
|
+
if (typeof self === "function" && !bothEquals) {
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
332
|
+
return withVisitedTracking2(self, that, () => {
|
|
333
|
+
if (bothEquals) {
|
|
334
|
+
return self[symbol2](that);
|
|
335
|
+
} else if (Array.isArray(self)) {
|
|
336
|
+
if (!Array.isArray(that) || self.length !== that.length) {
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
return compareArrays(self, that);
|
|
340
|
+
} else if (self instanceof Map) {
|
|
341
|
+
if (!(that instanceof Map) || self.size !== that.size) {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
return compareMaps(self, that);
|
|
345
|
+
} else if (self instanceof Set) {
|
|
346
|
+
if (!(that instanceof Set) || self.size !== that.size) {
|
|
347
|
+
return false;
|
|
418
348
|
}
|
|
419
|
-
return
|
|
349
|
+
return compareSets(self, that);
|
|
350
|
+
}
|
|
351
|
+
return compareRecords(self, that);
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
function withCache(self, that, f) {
|
|
355
|
+
let selfMap = equalityCache.get(self);
|
|
356
|
+
if (!selfMap) {
|
|
357
|
+
selfMap = /* @__PURE__ */ new WeakMap();
|
|
358
|
+
equalityCache.set(self, selfMap);
|
|
359
|
+
} else if (selfMap.has(that)) {
|
|
360
|
+
return selfMap.get(that);
|
|
361
|
+
}
|
|
362
|
+
const result = f(self, that);
|
|
363
|
+
selfMap.set(that, result);
|
|
364
|
+
let thatMap = equalityCache.get(that);
|
|
365
|
+
if (!thatMap) {
|
|
366
|
+
thatMap = /* @__PURE__ */ new WeakMap();
|
|
367
|
+
equalityCache.set(that, thatMap);
|
|
368
|
+
}
|
|
369
|
+
thatMap.set(self, result);
|
|
370
|
+
return result;
|
|
371
|
+
}
|
|
372
|
+
var equalityCache = /* @__PURE__ */ new WeakMap();
|
|
373
|
+
function compareArrays(self, that) {
|
|
374
|
+
for (let i = 0; i < self.length; i++) {
|
|
375
|
+
if (!compareBoth(self[i], that[i])) {
|
|
376
|
+
return false;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
function compareRecords(self, that) {
|
|
382
|
+
const selfKeys = getAllObjectKeys(self);
|
|
383
|
+
const thatKeys = getAllObjectKeys(that);
|
|
384
|
+
if (selfKeys.size !== thatKeys.size) {
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
for (const key of selfKeys) {
|
|
388
|
+
if (!thatKeys.has(key) || !compareBoth(self[key], that[key])) {
|
|
389
|
+
return false;
|
|
420
390
|
}
|
|
421
391
|
}
|
|
422
|
-
return
|
|
392
|
+
return true;
|
|
393
|
+
}
|
|
394
|
+
function makeCompareMap(keyEquivalence, valueEquivalence) {
|
|
395
|
+
return function compareMaps2(self, that) {
|
|
396
|
+
for (const [selfKey, selfValue] of self) {
|
|
397
|
+
let found = false;
|
|
398
|
+
for (const [thatKey, thatValue] of that) {
|
|
399
|
+
if (keyEquivalence(selfKey, thatKey) && valueEquivalence(selfValue, thatValue)) {
|
|
400
|
+
found = true;
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
if (!found) {
|
|
405
|
+
return false;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return true;
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
var compareMaps = /* @__PURE__ */ makeCompareMap(compareBoth, compareBoth);
|
|
412
|
+
function makeCompareSet(equivalence) {
|
|
413
|
+
return function compareSets2(self, that) {
|
|
414
|
+
for (const selfValue of self) {
|
|
415
|
+
let found = false;
|
|
416
|
+
for (const thatValue of that) {
|
|
417
|
+
if (equivalence(selfValue, thatValue)) {
|
|
418
|
+
found = true;
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
if (!found) {
|
|
423
|
+
return false;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return true;
|
|
427
|
+
};
|
|
423
428
|
}
|
|
429
|
+
var compareSets = /* @__PURE__ */ makeCompareSet(compareBoth);
|
|
424
430
|
var isEqual = (u) => hasProperty(u, symbol2);
|
|
425
|
-
var
|
|
431
|
+
var asEquivalence = () => equals;
|
|
432
|
+
|
|
433
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/Redactable.js
|
|
434
|
+
var symbolRedactable = /* @__PURE__ */ Symbol.for("~effect/Inspectable/redactable");
|
|
435
|
+
var isRedactable = (u) => hasProperty(u, symbolRedactable);
|
|
436
|
+
function redact(u) {
|
|
437
|
+
if (isRedactable(u)) return getRedacted(u);
|
|
438
|
+
return u;
|
|
439
|
+
}
|
|
440
|
+
function getRedacted(redactable) {
|
|
441
|
+
return redactable[symbolRedactable](globalThis[currentFiberTypeId]?.services ?? emptyServiceMap);
|
|
442
|
+
}
|
|
443
|
+
var currentFiberTypeId = "~effect/Fiber/currentFiber";
|
|
444
|
+
var emptyServiceMap = {
|
|
445
|
+
"~effect/ServiceMap": {},
|
|
446
|
+
mapUnsafe: /* @__PURE__ */ new Map(),
|
|
447
|
+
pipe() {
|
|
448
|
+
return pipeArguments(this, arguments);
|
|
449
|
+
}
|
|
450
|
+
};
|
|
426
451
|
|
|
427
|
-
// ../../node_modules/.pnpm/effect@
|
|
452
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/Formatter.js
|
|
453
|
+
function format(input, options) {
|
|
454
|
+
const space = options?.space ?? 0;
|
|
455
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
456
|
+
const gap = !space ? "" : typeof space === "number" ? " ".repeat(space) : space;
|
|
457
|
+
const ind = (d) => gap.repeat(d);
|
|
458
|
+
const wrap = (v, body) => {
|
|
459
|
+
const ctor = v?.constructor;
|
|
460
|
+
return ctor && ctor !== Object.prototype.constructor && ctor.name ? `${ctor.name}(${body})` : body;
|
|
461
|
+
};
|
|
462
|
+
const ownKeys = (o) => {
|
|
463
|
+
try {
|
|
464
|
+
return Reflect.ownKeys(o);
|
|
465
|
+
} catch {
|
|
466
|
+
return ["[ownKeys threw]"];
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
function recur(v, d = 0) {
|
|
470
|
+
if (Array.isArray(v)) {
|
|
471
|
+
if (seen.has(v)) return CIRCULAR;
|
|
472
|
+
seen.add(v);
|
|
473
|
+
if (!gap || v.length <= 1) return `[${v.map((x) => recur(x, d)).join(",")}]`;
|
|
474
|
+
const inner = v.map((x) => recur(x, d + 1)).join(",\n" + ind(d + 1));
|
|
475
|
+
return `[
|
|
476
|
+
${ind(d + 1)}${inner}
|
|
477
|
+
${ind(d)}]`;
|
|
478
|
+
}
|
|
479
|
+
if (v instanceof Date) return formatDate(v);
|
|
480
|
+
if (!options?.ignoreToString && hasProperty(v, "toString") && typeof v["toString"] === "function" && v["toString"] !== Object.prototype.toString && v["toString"] !== Array.prototype.toString) {
|
|
481
|
+
const s = safeToString(v);
|
|
482
|
+
if (v instanceof Error && v.cause) {
|
|
483
|
+
return `${s} (cause: ${recur(v.cause, d)})`;
|
|
484
|
+
}
|
|
485
|
+
return s;
|
|
486
|
+
}
|
|
487
|
+
if (typeof v === "string") return JSON.stringify(v);
|
|
488
|
+
if (typeof v === "number" || v == null || typeof v === "boolean" || typeof v === "symbol") return String(v);
|
|
489
|
+
if (typeof v === "bigint") return String(v) + "n";
|
|
490
|
+
if (typeof v === "object" || typeof v === "function") {
|
|
491
|
+
if (seen.has(v)) return CIRCULAR;
|
|
492
|
+
seen.add(v);
|
|
493
|
+
if (symbolRedactable in v) return format(getRedacted(v));
|
|
494
|
+
if (Symbol.iterator in v) {
|
|
495
|
+
return `${v.constructor.name}(${recur(Array.from(v), d)})`;
|
|
496
|
+
}
|
|
497
|
+
const keys2 = ownKeys(v);
|
|
498
|
+
if (!gap || keys2.length <= 1) {
|
|
499
|
+
const body2 = `{${keys2.map((k) => `${formatPropertyKey(k)}:${recur(v[k], d)}`).join(",")}}`;
|
|
500
|
+
return wrap(v, body2);
|
|
501
|
+
}
|
|
502
|
+
const body = `{
|
|
503
|
+
${keys2.map((k) => `${ind(d + 1)}${formatPropertyKey(k)}: ${recur(v[k], d + 1)}`).join(",\n")}
|
|
504
|
+
${ind(d)}}`;
|
|
505
|
+
return wrap(v, body);
|
|
506
|
+
}
|
|
507
|
+
return String(v);
|
|
508
|
+
}
|
|
509
|
+
return recur(input, 0);
|
|
510
|
+
}
|
|
511
|
+
var CIRCULAR = "[Circular]";
|
|
512
|
+
function formatPropertyKey(name) {
|
|
513
|
+
return typeof name === "string" ? JSON.stringify(name) : String(name);
|
|
514
|
+
}
|
|
515
|
+
function formatDate(date) {
|
|
516
|
+
try {
|
|
517
|
+
return date.toISOString();
|
|
518
|
+
} catch {
|
|
519
|
+
return "Invalid Date";
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
function safeToString(input) {
|
|
523
|
+
try {
|
|
524
|
+
const s = input.toString();
|
|
525
|
+
return typeof s === "string" ? s : String(s);
|
|
526
|
+
} catch {
|
|
527
|
+
return "[toString threw]";
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/Inspectable.js
|
|
428
532
|
var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
429
|
-
var
|
|
533
|
+
var toJson = (input) => {
|
|
430
534
|
try {
|
|
431
|
-
if (hasProperty(
|
|
432
|
-
return
|
|
433
|
-
} else if (Array.isArray(
|
|
434
|
-
return
|
|
535
|
+
if (hasProperty(input, "toJSON") && isFunction(input["toJSON"]) && input["toJSON"].length === 0) {
|
|
536
|
+
return input.toJSON();
|
|
537
|
+
} else if (Array.isArray(input)) {
|
|
538
|
+
return input.map(toJson);
|
|
435
539
|
}
|
|
436
540
|
} catch {
|
|
437
|
-
return
|
|
541
|
+
return "[toJSON threw]";
|
|
438
542
|
}
|
|
439
|
-
return redact(
|
|
543
|
+
return redact(input);
|
|
440
544
|
};
|
|
441
|
-
var format = (x) => JSON.stringify(x, null, 2);
|
|
442
545
|
var BaseProto = {
|
|
443
546
|
toJSON() {
|
|
444
|
-
return
|
|
445
|
-
},
|
|
446
|
-
[NodeInspectSymbol]() {
|
|
447
|
-
return this.toJSON();
|
|
448
|
-
},
|
|
547
|
+
return toJson(this);
|
|
548
|
+
},
|
|
549
|
+
[NodeInspectSymbol]() {
|
|
550
|
+
return this.toJSON();
|
|
551
|
+
},
|
|
552
|
+
toString() {
|
|
553
|
+
return format(this.toJSON());
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
var Class = class {
|
|
557
|
+
/**
|
|
558
|
+
* Node.js custom inspection method.
|
|
559
|
+
*
|
|
560
|
+
* @since 2.0.0
|
|
561
|
+
*/
|
|
562
|
+
[NodeInspectSymbol]() {
|
|
563
|
+
return this.toJSON();
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Returns a formatted string representation of this object.
|
|
567
|
+
*
|
|
568
|
+
* @since 2.0.0
|
|
569
|
+
*/
|
|
570
|
+
toString() {
|
|
571
|
+
return format(this.toJSON());
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/Utils.js
|
|
576
|
+
var GenKindTypeId = "~effect/Utils/GenKind";
|
|
577
|
+
var GenKindImpl = class {
|
|
578
|
+
value;
|
|
579
|
+
constructor(value) {
|
|
580
|
+
this.value = value;
|
|
581
|
+
}
|
|
582
|
+
get _F() {
|
|
583
|
+
return identity;
|
|
584
|
+
}
|
|
585
|
+
get _R() {
|
|
586
|
+
return (_) => _;
|
|
587
|
+
}
|
|
588
|
+
get _O() {
|
|
589
|
+
return (_) => _;
|
|
590
|
+
}
|
|
591
|
+
get _E() {
|
|
592
|
+
return (_) => _;
|
|
593
|
+
}
|
|
594
|
+
[GenKindTypeId] = GenKindTypeId;
|
|
595
|
+
[Symbol.iterator]() {
|
|
596
|
+
return new SingleShotGen(this);
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
var SingleShotGen = class _SingleShotGen {
|
|
600
|
+
called = false;
|
|
601
|
+
self;
|
|
602
|
+
constructor(self) {
|
|
603
|
+
this.self = self;
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* @since 2.0.0
|
|
607
|
+
*/
|
|
608
|
+
next(a) {
|
|
609
|
+
return this.called ? {
|
|
610
|
+
value: a,
|
|
611
|
+
done: true
|
|
612
|
+
} : (this.called = true, {
|
|
613
|
+
value: this.self,
|
|
614
|
+
done: false
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* @since 2.0.0
|
|
619
|
+
*/
|
|
620
|
+
[Symbol.iterator]() {
|
|
621
|
+
return new _SingleShotGen(this.self);
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
var InternalTypeId = "~effect/Effect/internal";
|
|
625
|
+
var standard = {
|
|
626
|
+
[InternalTypeId]: (body) => {
|
|
627
|
+
return body();
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
var forced = {
|
|
631
|
+
[InternalTypeId]: (body) => {
|
|
632
|
+
try {
|
|
633
|
+
return body();
|
|
634
|
+
} finally {
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
var isNotOptimizedAway = /* @__PURE__ */ standard[InternalTypeId](() => new Error().stack)?.includes(InternalTypeId) === true;
|
|
639
|
+
var internalCall = isNotOptimizedAway ? standard[InternalTypeId] : forced[InternalTypeId];
|
|
640
|
+
var genConstructor = function* () {
|
|
641
|
+
}.constructor;
|
|
642
|
+
|
|
643
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/internal/core.js
|
|
644
|
+
var EffectTypeId = `~effect/Effect`;
|
|
645
|
+
var ExitTypeId = `~effect/Exit`;
|
|
646
|
+
var effectVariance = {
|
|
647
|
+
_A: identity,
|
|
648
|
+
_E: identity,
|
|
649
|
+
_R: identity
|
|
650
|
+
};
|
|
651
|
+
var identifier = `${EffectTypeId}/identifier`;
|
|
652
|
+
var args = `${EffectTypeId}/args`;
|
|
653
|
+
var evaluate = `${EffectTypeId}/evaluate`;
|
|
654
|
+
var contA = `${EffectTypeId}/successCont`;
|
|
655
|
+
var contE = `${EffectTypeId}/failureCont`;
|
|
656
|
+
var contAll = `${EffectTypeId}/ensureCont`;
|
|
657
|
+
var PipeInspectableProto = {
|
|
658
|
+
pipe() {
|
|
659
|
+
return pipeArguments(this, arguments);
|
|
660
|
+
},
|
|
661
|
+
toJSON() {
|
|
662
|
+
return {
|
|
663
|
+
...this
|
|
664
|
+
};
|
|
665
|
+
},
|
|
666
|
+
toString() {
|
|
667
|
+
return format(this.toJSON(), {
|
|
668
|
+
ignoreToString: true,
|
|
669
|
+
space: 2
|
|
670
|
+
});
|
|
671
|
+
},
|
|
672
|
+
[NodeInspectSymbol]() {
|
|
673
|
+
return this.toJSON();
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
var StructuralProto = {
|
|
677
|
+
[symbol]() {
|
|
678
|
+
return structureKeys(this, Object.keys(this));
|
|
679
|
+
},
|
|
680
|
+
[symbol2](that) {
|
|
681
|
+
const selfKeys = Object.keys(this);
|
|
682
|
+
const thatKeys = Object.keys(that);
|
|
683
|
+
if (selfKeys.length !== thatKeys.length) return false;
|
|
684
|
+
for (let i = 0; i < selfKeys.length; i++) {
|
|
685
|
+
if (selfKeys[i] !== thatKeys[i] && !equals(this[selfKeys[i]], that[selfKeys[i]])) {
|
|
686
|
+
return false;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
return true;
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
var YieldableProto = {
|
|
693
|
+
[Symbol.iterator]() {
|
|
694
|
+
return new SingleShotGen(this);
|
|
695
|
+
}
|
|
696
|
+
};
|
|
697
|
+
var YieldableErrorProto = {
|
|
698
|
+
...YieldableProto,
|
|
699
|
+
pipe() {
|
|
700
|
+
return pipeArguments(this, arguments);
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
var EffectProto = {
|
|
704
|
+
[EffectTypeId]: effectVariance,
|
|
705
|
+
...PipeInspectableProto,
|
|
706
|
+
[Symbol.iterator]() {
|
|
707
|
+
return new SingleShotGen(this);
|
|
708
|
+
},
|
|
709
|
+
asEffect() {
|
|
710
|
+
return this;
|
|
711
|
+
},
|
|
712
|
+
toJSON() {
|
|
713
|
+
return {
|
|
714
|
+
_id: "Effect",
|
|
715
|
+
op: this[identifier],
|
|
716
|
+
...args in this ? {
|
|
717
|
+
args: this[args]
|
|
718
|
+
} : void 0
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
var isExit = (u) => hasProperty(u, ExitTypeId);
|
|
723
|
+
var CauseTypeId = "~effect/Cause";
|
|
724
|
+
var CauseReasonTypeId = "~effect/Cause/Reason";
|
|
725
|
+
var isCause = (self) => hasProperty(self, CauseTypeId);
|
|
726
|
+
var CauseImpl = class {
|
|
727
|
+
[CauseTypeId];
|
|
728
|
+
reasons;
|
|
729
|
+
constructor(failures) {
|
|
730
|
+
this[CauseTypeId] = CauseTypeId;
|
|
731
|
+
this.reasons = failures;
|
|
732
|
+
}
|
|
733
|
+
pipe() {
|
|
734
|
+
return pipeArguments(this, arguments);
|
|
735
|
+
}
|
|
736
|
+
toJSON() {
|
|
737
|
+
return {
|
|
738
|
+
_id: "Cause",
|
|
739
|
+
failures: this.reasons.map((f) => f.toJSON())
|
|
740
|
+
};
|
|
741
|
+
}
|
|
449
742
|
toString() {
|
|
450
|
-
return format(this.
|
|
743
|
+
return `Cause(${format(this.reasons)})`;
|
|
451
744
|
}
|
|
452
|
-
};
|
|
453
|
-
var Class = class {
|
|
454
|
-
/**
|
|
455
|
-
* @since 2.0.0
|
|
456
|
-
*/
|
|
457
745
|
[NodeInspectSymbol]() {
|
|
458
746
|
return this.toJSON();
|
|
459
747
|
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
return
|
|
748
|
+
[symbol2](that) {
|
|
749
|
+
return isCause(that) && this.reasons.length === that.reasons.length && this.reasons.every((e, i) => equals(e, that.reasons[i]));
|
|
750
|
+
}
|
|
751
|
+
[symbol]() {
|
|
752
|
+
return array(this.reasons);
|
|
465
753
|
}
|
|
466
754
|
};
|
|
467
|
-
var
|
|
468
|
-
var
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
755
|
+
var annotationsMap = /* @__PURE__ */ new WeakMap();
|
|
756
|
+
var ReasonBase = class {
|
|
757
|
+
[CauseReasonTypeId];
|
|
758
|
+
annotations;
|
|
759
|
+
_tag;
|
|
760
|
+
constructor(_tag, annotations, originalError) {
|
|
761
|
+
this[CauseReasonTypeId] = CauseReasonTypeId;
|
|
762
|
+
this._tag = _tag;
|
|
763
|
+
if (annotations !== constEmptyAnnotations && typeof originalError === "object" && originalError !== null && annotations.size > 0) {
|
|
764
|
+
const prevAnnotations = annotationsMap.get(originalError);
|
|
765
|
+
if (prevAnnotations) {
|
|
766
|
+
annotations = new Map([...prevAnnotations, ...annotations]);
|
|
767
|
+
}
|
|
768
|
+
annotationsMap.set(originalError, annotations);
|
|
769
|
+
}
|
|
770
|
+
this.annotations = annotations;
|
|
771
|
+
}
|
|
772
|
+
annotate(annotations, options) {
|
|
773
|
+
if (annotations.mapUnsafe.size === 0) return this;
|
|
774
|
+
const newAnnotations = new Map(this.annotations);
|
|
775
|
+
annotations.mapUnsafe.forEach((value, key) => {
|
|
776
|
+
if (options?.overwrite !== true && newAnnotations.has(key)) return;
|
|
777
|
+
newAnnotations.set(key, value);
|
|
778
|
+
});
|
|
779
|
+
const self = Object.assign(Object.create(Object.getPrototypeOf(this)), this);
|
|
780
|
+
self.annotations = newAnnotations;
|
|
781
|
+
return self;
|
|
782
|
+
}
|
|
783
|
+
pipe() {
|
|
784
|
+
return pipeArguments(this, arguments);
|
|
785
|
+
}
|
|
786
|
+
toString() {
|
|
787
|
+
return format(this);
|
|
788
|
+
}
|
|
789
|
+
[NodeInspectSymbol]() {
|
|
790
|
+
return this.toString();
|
|
475
791
|
}
|
|
476
|
-
return u;
|
|
477
792
|
};
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
return args2[7](args2[6](args2[5](args2[4](args2[3](args2[2](args2[1](args2[0](self))))))));
|
|
500
|
-
case 9:
|
|
501
|
-
return args2[8](args2[7](args2[6](args2[5](args2[4](args2[3](args2[2](args2[1](args2[0](self)))))))));
|
|
502
|
-
default: {
|
|
503
|
-
let ret = self;
|
|
504
|
-
for (let i = 0, len = args2.length; i < len; i++) {
|
|
505
|
-
ret = args2[i](ret);
|
|
506
|
-
}
|
|
507
|
-
return ret;
|
|
508
|
-
}
|
|
793
|
+
var constEmptyAnnotations = /* @__PURE__ */ new Map();
|
|
794
|
+
var Fail = class extends ReasonBase {
|
|
795
|
+
error;
|
|
796
|
+
constructor(error, annotations = constEmptyAnnotations) {
|
|
797
|
+
super("Fail", annotations, error);
|
|
798
|
+
this.error = error;
|
|
799
|
+
}
|
|
800
|
+
toString() {
|
|
801
|
+
return `Fail(${format(this.error)})`;
|
|
802
|
+
}
|
|
803
|
+
toJSON() {
|
|
804
|
+
return {
|
|
805
|
+
_tag: "Fail",
|
|
806
|
+
error: this.error
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
[symbol2](that) {
|
|
810
|
+
return isFailReason(that) && equals(this.error, that.error) && equals(this.annotations, that.annotations);
|
|
811
|
+
}
|
|
812
|
+
[symbol]() {
|
|
813
|
+
return combine(string(this._tag))(combine(hash(this.error))(hash(this.annotations)));
|
|
509
814
|
}
|
|
510
815
|
};
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
816
|
+
var causeFail = (error) => new CauseImpl([new Fail(error)]);
|
|
817
|
+
var Die = class extends ReasonBase {
|
|
818
|
+
defect;
|
|
819
|
+
constructor(defect, annotations = constEmptyAnnotations) {
|
|
820
|
+
super("Die", annotations, defect);
|
|
821
|
+
this.defect = defect;
|
|
822
|
+
}
|
|
823
|
+
toString() {
|
|
824
|
+
return `Die(${format(this.defect)})`;
|
|
825
|
+
}
|
|
826
|
+
toJSON() {
|
|
827
|
+
return {
|
|
828
|
+
_tag: "Die",
|
|
829
|
+
defect: this.defect
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
[symbol2](that) {
|
|
833
|
+
return isDieReason(that) && equals(this.defect, that.defect) && equals(this.annotations, that.annotations);
|
|
834
|
+
}
|
|
835
|
+
[symbol]() {
|
|
836
|
+
return combine(string(this._tag))(combine(hash(this.defect))(hash(this.annotations)));
|
|
837
|
+
}
|
|
532
838
|
};
|
|
533
|
-
var
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
839
|
+
var causeDie = (defect) => new CauseImpl([new Die(defect)]);
|
|
840
|
+
var causeAnnotate = /* @__PURE__ */ dual((args3) => isCause(args3[0]), (self, annotations, options) => {
|
|
841
|
+
if (annotations.mapUnsafe.size === 0) return self;
|
|
842
|
+
return new CauseImpl(self.reasons.map((f) => f.annotate(annotations, options)));
|
|
843
|
+
});
|
|
844
|
+
var isFailReason = (self) => self._tag === "Fail";
|
|
845
|
+
var isDieReason = (self) => self._tag === "Die";
|
|
846
|
+
function defaultEvaluate(_fiber) {
|
|
847
|
+
return exitDie(`Effect.evaluate: Not implemented`);
|
|
848
|
+
}
|
|
849
|
+
var makePrimitiveProto = (options) => ({
|
|
850
|
+
...EffectProto,
|
|
851
|
+
[identifier]: options.op,
|
|
852
|
+
[evaluate]: options[evaluate] ?? defaultEvaluate,
|
|
853
|
+
[contA]: options[contA],
|
|
854
|
+
[contE]: options[contE],
|
|
855
|
+
[contAll]: options[contAll]
|
|
856
|
+
});
|
|
857
|
+
var makePrimitive = (options) => {
|
|
858
|
+
const Proto = makePrimitiveProto(options);
|
|
859
|
+
return function() {
|
|
860
|
+
const self = Object.create(Proto);
|
|
861
|
+
self[args] = options.single === false ? arguments : arguments[0];
|
|
862
|
+
return self;
|
|
863
|
+
};
|
|
544
864
|
};
|
|
545
|
-
var
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
865
|
+
var makeExit = (options) => {
|
|
866
|
+
const Proto = {
|
|
867
|
+
...makePrimitiveProto(options),
|
|
868
|
+
[ExitTypeId]: ExitTypeId,
|
|
869
|
+
_tag: options.op,
|
|
870
|
+
get [options.prop]() {
|
|
871
|
+
return this[args];
|
|
872
|
+
},
|
|
873
|
+
toString() {
|
|
874
|
+
return `${options.op}(${format(this[args])})`;
|
|
875
|
+
},
|
|
876
|
+
toJSON() {
|
|
877
|
+
return {
|
|
878
|
+
_id: "Exit",
|
|
879
|
+
_tag: options.op,
|
|
880
|
+
[options.prop]: this[args]
|
|
881
|
+
};
|
|
882
|
+
},
|
|
883
|
+
[symbol2](that) {
|
|
884
|
+
return isExit(that) && that._tag === this._tag && equals(this[args], that[args]);
|
|
885
|
+
},
|
|
886
|
+
[symbol]() {
|
|
887
|
+
return combine(string(options.op), hash(this[args]));
|
|
888
|
+
}
|
|
889
|
+
};
|
|
890
|
+
return function(value) {
|
|
891
|
+
const self = Object.create(Proto);
|
|
892
|
+
self[args] = value;
|
|
893
|
+
return self;
|
|
894
|
+
};
|
|
560
895
|
};
|
|
561
|
-
var
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
[
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
return this === that;
|
|
568
|
-
},
|
|
569
|
-
[symbol]() {
|
|
570
|
-
return cached(this, random(this));
|
|
571
|
-
},
|
|
572
|
-
[Symbol.iterator]() {
|
|
573
|
-
return new SingleShotGen(new YieldWrap(this));
|
|
574
|
-
},
|
|
575
|
-
pipe() {
|
|
576
|
-
return pipeArguments(this, arguments);
|
|
896
|
+
var exitSucceed = /* @__PURE__ */ makeExit({
|
|
897
|
+
op: "Success",
|
|
898
|
+
prop: "value",
|
|
899
|
+
[evaluate](fiber) {
|
|
900
|
+
const cont = fiber.getCont(contA);
|
|
901
|
+
return cont ? cont[contA](this[args], fiber, this) : fiber.yieldWith(this);
|
|
577
902
|
}
|
|
903
|
+
});
|
|
904
|
+
var StackTraceKey = {
|
|
905
|
+
key: "effect/Cause/StackTrace"
|
|
578
906
|
};
|
|
579
|
-
var
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
907
|
+
var exitFailCause = /* @__PURE__ */ makeExit({
|
|
908
|
+
op: "Failure",
|
|
909
|
+
prop: "cause",
|
|
910
|
+
[evaluate](fiber) {
|
|
911
|
+
let cause = this[args];
|
|
912
|
+
let annotated = false;
|
|
913
|
+
if (fiber.currentStackFrame) {
|
|
914
|
+
cause = causeAnnotate(cause, {
|
|
915
|
+
mapUnsafe: /* @__PURE__ */ new Map([[StackTraceKey.key, fiber.currentStackFrame]])
|
|
916
|
+
});
|
|
917
|
+
annotated = true;
|
|
588
918
|
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}
|
|
919
|
+
let cont = fiber.getCont(contE);
|
|
920
|
+
while (fiber.interruptible && fiber._interruptedCause && cont) {
|
|
921
|
+
cont = fiber.getCont(contE);
|
|
593
922
|
}
|
|
594
|
-
return
|
|
923
|
+
return cont ? cont[contE](cause, fiber, annotated ? void 0 : this) : fiber.yieldWith(annotated ? this : exitFailCause(cause));
|
|
924
|
+
}
|
|
925
|
+
});
|
|
926
|
+
var exitFail = (e) => exitFailCause(causeFail(e));
|
|
927
|
+
var exitDie = (defect) => exitFailCause(causeDie(defect));
|
|
928
|
+
var withFiber = /* @__PURE__ */ makePrimitive({
|
|
929
|
+
op: "WithFiber",
|
|
930
|
+
[evaluate](fiber) {
|
|
931
|
+
return this[args](fiber);
|
|
595
932
|
}
|
|
933
|
+
});
|
|
934
|
+
var YieldableError = /* @__PURE__ */ (function() {
|
|
935
|
+
class YieldableError2 extends globalThis.Error {
|
|
936
|
+
asEffect() {
|
|
937
|
+
return exitFail(this);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
Object.assign(YieldableError2.prototype, YieldableErrorProto);
|
|
941
|
+
return YieldableError2;
|
|
942
|
+
})();
|
|
943
|
+
var Error2 = /* @__PURE__ */ (function() {
|
|
944
|
+
const plainArgsSymbol = /* @__PURE__ */ Symbol.for("effect/Data/Error/plainArgs");
|
|
945
|
+
return class Base extends YieldableError {
|
|
946
|
+
constructor(args3) {
|
|
947
|
+
super(args3?.message, args3?.cause ? {
|
|
948
|
+
cause: args3.cause
|
|
949
|
+
} : void 0);
|
|
950
|
+
if (args3) {
|
|
951
|
+
Object.assign(this, args3);
|
|
952
|
+
Object.defineProperty(this, plainArgsSymbol, {
|
|
953
|
+
value: args3,
|
|
954
|
+
enumerable: false
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
toJSON() {
|
|
959
|
+
return {
|
|
960
|
+
...this[plainArgsSymbol],
|
|
961
|
+
...this
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
};
|
|
965
|
+
})();
|
|
966
|
+
var TaggedError = (tag) => {
|
|
967
|
+
class Base extends Error2 {
|
|
968
|
+
_tag = tag;
|
|
969
|
+
}
|
|
970
|
+
;
|
|
971
|
+
Base.prototype.name = tag;
|
|
972
|
+
return Base;
|
|
596
973
|
};
|
|
597
|
-
var
|
|
598
|
-
|
|
599
|
-
|
|
974
|
+
var NoSuchElementErrorTypeId = "~effect/Cause/NoSuchElementError";
|
|
975
|
+
var NoSuchElementError = class extends (/* @__PURE__ */ TaggedError("NoSuchElementError")) {
|
|
976
|
+
[NoSuchElementErrorTypeId] = NoSuchElementErrorTypeId;
|
|
977
|
+
constructor(message) {
|
|
978
|
+
super({
|
|
979
|
+
message
|
|
980
|
+
});
|
|
981
|
+
}
|
|
600
982
|
};
|
|
601
|
-
var
|
|
602
|
-
|
|
603
|
-
|
|
983
|
+
var DoneTypeId = "~effect/Cause/Done";
|
|
984
|
+
var DoneVoid = {
|
|
985
|
+
[DoneTypeId]: DoneTypeId,
|
|
986
|
+
_tag: "Done",
|
|
987
|
+
value: void 0
|
|
604
988
|
};
|
|
605
989
|
|
|
606
|
-
// ../../node_modules/.pnpm/effect@
|
|
607
|
-
var TypeId =
|
|
990
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/internal/option.js
|
|
991
|
+
var TypeId = "~effect/data/Option";
|
|
608
992
|
var CommonProto = {
|
|
609
|
-
...EffectPrototype,
|
|
610
993
|
[TypeId]: {
|
|
611
994
|
_A: (_) => _
|
|
612
995
|
},
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
},
|
|
616
|
-
toString() {
|
|
617
|
-
return format(this.toJSON());
|
|
618
|
-
}
|
|
996
|
+
...PipeInspectableProto,
|
|
997
|
+
...YieldableProto
|
|
619
998
|
};
|
|
620
999
|
var SomeProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto), {
|
|
621
1000
|
_tag: "Some",
|
|
@@ -624,14 +1003,20 @@ var SomeProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(Comm
|
|
|
624
1003
|
return isOption(that) && isSome(that) && equals(this.value, that.value);
|
|
625
1004
|
},
|
|
626
1005
|
[symbol]() {
|
|
627
|
-
return
|
|
1006
|
+
return combine(hash(this._tag))(hash(this.value));
|
|
1007
|
+
},
|
|
1008
|
+
toString() {
|
|
1009
|
+
return `some(${format(this.value)})`;
|
|
628
1010
|
},
|
|
629
1011
|
toJSON() {
|
|
630
1012
|
return {
|
|
631
1013
|
_id: "Option",
|
|
632
1014
|
_tag: this._tag,
|
|
633
|
-
value:
|
|
1015
|
+
value: toJson(this.value)
|
|
634
1016
|
};
|
|
1017
|
+
},
|
|
1018
|
+
asEffect() {
|
|
1019
|
+
return exitSucceed(this.value);
|
|
635
1020
|
}
|
|
636
1021
|
});
|
|
637
1022
|
var NoneHash = /* @__PURE__ */ hash("None");
|
|
@@ -644,11 +1029,17 @@ var NoneProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(Comm
|
|
|
644
1029
|
[symbol]() {
|
|
645
1030
|
return NoneHash;
|
|
646
1031
|
},
|
|
1032
|
+
toString() {
|
|
1033
|
+
return `none()`;
|
|
1034
|
+
},
|
|
647
1035
|
toJSON() {
|
|
648
1036
|
return {
|
|
649
1037
|
_id: "Option",
|
|
650
1038
|
_tag: this._tag
|
|
651
1039
|
};
|
|
1040
|
+
},
|
|
1041
|
+
asEffect() {
|
|
1042
|
+
return exitFail(new NoSuchElementError());
|
|
652
1043
|
}
|
|
653
1044
|
});
|
|
654
1045
|
var isOption = (input) => hasProperty(input, TypeId);
|
|
@@ -661,94 +1052,113 @@ var some = (value) => {
|
|
|
661
1052
|
return a;
|
|
662
1053
|
};
|
|
663
1054
|
|
|
664
|
-
// ../../node_modules/.pnpm/effect@
|
|
665
|
-
var TypeId2 =
|
|
1055
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/internal/result.js
|
|
1056
|
+
var TypeId2 = "~effect/data/Result";
|
|
666
1057
|
var CommonProto2 = {
|
|
667
|
-
...EffectPrototype,
|
|
668
1058
|
[TypeId2]: {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
return this.toJSON();
|
|
1059
|
+
/* v8 ignore next 2 */
|
|
1060
|
+
_A: (_) => _,
|
|
1061
|
+
_E: (_) => _
|
|
673
1062
|
},
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
}
|
|
1063
|
+
...PipeInspectableProto,
|
|
1064
|
+
...YieldableProto
|
|
677
1065
|
};
|
|
678
|
-
var
|
|
679
|
-
_tag: "
|
|
680
|
-
_op: "
|
|
1066
|
+
var SuccessProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto2), {
|
|
1067
|
+
_tag: "Success",
|
|
1068
|
+
_op: "Success",
|
|
681
1069
|
[symbol2](that) {
|
|
682
|
-
return
|
|
1070
|
+
return isResult(that) && isSuccess(that) && equals(this.success, that.success);
|
|
683
1071
|
},
|
|
684
1072
|
[symbol]() {
|
|
685
|
-
return combine(hash(this._tag))(hash(this.
|
|
1073
|
+
return combine(hash(this._tag))(hash(this.success));
|
|
1074
|
+
},
|
|
1075
|
+
toString() {
|
|
1076
|
+
return `success(${format(this.success)})`;
|
|
686
1077
|
},
|
|
687
1078
|
toJSON() {
|
|
688
1079
|
return {
|
|
689
|
-
_id: "
|
|
1080
|
+
_id: "Result",
|
|
690
1081
|
_tag: this._tag,
|
|
691
|
-
|
|
1082
|
+
value: toJson(this.success)
|
|
692
1083
|
};
|
|
1084
|
+
},
|
|
1085
|
+
asEffect() {
|
|
1086
|
+
return exitSucceed(this.success);
|
|
693
1087
|
}
|
|
694
1088
|
});
|
|
695
|
-
var
|
|
696
|
-
_tag: "
|
|
697
|
-
_op: "
|
|
1089
|
+
var FailureProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto2), {
|
|
1090
|
+
_tag: "Failure",
|
|
1091
|
+
_op: "Failure",
|
|
698
1092
|
[symbol2](that) {
|
|
699
|
-
return
|
|
1093
|
+
return isResult(that) && isFailure(that) && equals(this.failure, that.failure);
|
|
700
1094
|
},
|
|
701
1095
|
[symbol]() {
|
|
702
|
-
return combine(hash(this._tag))(hash(this.
|
|
1096
|
+
return combine(hash(this._tag))(hash(this.failure));
|
|
1097
|
+
},
|
|
1098
|
+
toString() {
|
|
1099
|
+
return `failure(${format(this.failure)})`;
|
|
703
1100
|
},
|
|
704
1101
|
toJSON() {
|
|
705
1102
|
return {
|
|
706
|
-
_id: "
|
|
1103
|
+
_id: "Result",
|
|
707
1104
|
_tag: this._tag,
|
|
708
|
-
|
|
1105
|
+
failure: toJson(this.failure)
|
|
709
1106
|
};
|
|
1107
|
+
},
|
|
1108
|
+
asEffect() {
|
|
1109
|
+
return exitFail(this.failure);
|
|
710
1110
|
}
|
|
711
1111
|
});
|
|
712
|
-
var
|
|
713
|
-
var
|
|
714
|
-
var
|
|
715
|
-
var
|
|
716
|
-
const a = Object.create(
|
|
717
|
-
a.
|
|
1112
|
+
var isResult = (input) => hasProperty(input, TypeId2);
|
|
1113
|
+
var isFailure = (result) => result._tag === "Failure";
|
|
1114
|
+
var isSuccess = (result) => result._tag === "Success";
|
|
1115
|
+
var fail = (failure) => {
|
|
1116
|
+
const a = Object.create(FailureProto);
|
|
1117
|
+
a.failure = failure;
|
|
718
1118
|
return a;
|
|
719
1119
|
};
|
|
720
|
-
var
|
|
721
|
-
const a = Object.create(
|
|
722
|
-
a.
|
|
1120
|
+
var succeed = (success) => {
|
|
1121
|
+
const a = Object.create(SuccessProto);
|
|
1122
|
+
a.success = success;
|
|
723
1123
|
return a;
|
|
724
1124
|
};
|
|
725
1125
|
|
|
726
|
-
// ../../node_modules/.pnpm/effect@
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
var
|
|
731
|
-
var map = /* @__PURE__ */ dual(2, (self, f) => isRight2(self) ? right2(f(self.right)) : left2(self.left));
|
|
732
|
-
var getOrElse = /* @__PURE__ */ dual(2, (self, onLeft) => isLeft2(self) ? onLeft(self.left) : self.right);
|
|
733
|
-
|
|
734
|
-
// ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/array.js
|
|
735
|
-
var isNonEmptyArray = (self) => self.length > 0;
|
|
736
|
-
|
|
737
|
-
// ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Order.js
|
|
738
|
-
var make = (compare) => (self, that) => self === that ? 0 : compare(self, that);
|
|
739
|
-
var string2 = /* @__PURE__ */ make((self, that) => self < that ? -1 : 1);
|
|
1126
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/Order.js
|
|
1127
|
+
function make(compare) {
|
|
1128
|
+
return (self, that) => self === that ? 0 : compare(self, that);
|
|
1129
|
+
}
|
|
1130
|
+
var String2 = /* @__PURE__ */ make((self, that) => self < that ? -1 : 1);
|
|
740
1131
|
|
|
741
|
-
// ../../node_modules/.pnpm/effect@
|
|
1132
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/Option.js
|
|
742
1133
|
var none2 = () => none;
|
|
743
1134
|
var some2 = some;
|
|
744
1135
|
var isNone2 = isNone;
|
|
745
1136
|
var isSome2 = isSome;
|
|
746
|
-
var
|
|
1137
|
+
var getOrElse = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? onNone() : self.value);
|
|
747
1138
|
var orElse = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self);
|
|
748
|
-
var
|
|
749
|
-
var getOrUndefined = /* @__PURE__ */
|
|
1139
|
+
var fromNullishOr = (a) => a == null ? none2() : some2(a);
|
|
1140
|
+
var getOrUndefined = /* @__PURE__ */ getOrElse(constUndefined);
|
|
1141
|
+
|
|
1142
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/Result.js
|
|
1143
|
+
var succeed2 = succeed;
|
|
1144
|
+
var fail2 = fail;
|
|
1145
|
+
var isFailure2 = isFailure;
|
|
1146
|
+
var isSuccess2 = isSuccess;
|
|
1147
|
+
var map = /* @__PURE__ */ dual(2, (self, f) => isSuccess2(self) ? succeed2(f(self.success)) : fail2(self.failure));
|
|
1148
|
+
var getOrElse2 = /* @__PURE__ */ dual(2, (self, onFailure) => isFailure2(self) ? onFailure(self.failure) : self.success);
|
|
750
1149
|
|
|
751
|
-
// ../../node_modules/.pnpm/effect@
|
|
1150
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/Filter.js
|
|
1151
|
+
var apply = (filter2, input, ...args3) => {
|
|
1152
|
+
const result = filter2(input, ...args3);
|
|
1153
|
+
if (result === true) return succeed2(input);
|
|
1154
|
+
if (result === false) return fail2(input);
|
|
1155
|
+
return result;
|
|
1156
|
+
};
|
|
1157
|
+
|
|
1158
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/internal/array.js
|
|
1159
|
+
var isArrayNonEmpty = (self) => self.length > 0;
|
|
1160
|
+
|
|
1161
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/Record.js
|
|
752
1162
|
var map2 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
753
1163
|
const out = {
|
|
754
1164
|
...self
|
|
@@ -760,31 +1170,34 @@ var map2 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
760
1170
|
});
|
|
761
1171
|
var keys = (self) => Object.keys(self);
|
|
762
1172
|
|
|
763
|
-
// ../../node_modules/.pnpm/effect@
|
|
764
|
-
var
|
|
1173
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.14/node_modules/effect/dist/Array.js
|
|
1174
|
+
var Array2 = globalThis.Array;
|
|
1175
|
+
var fromIterable = (collection) => Array2.isArray(collection) ? collection : Array2.from(collection);
|
|
765
1176
|
var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
|
|
766
1177
|
var appendAll = /* @__PURE__ */ dual(2, (self, that) => fromIterable(self).concat(fromIterable(that)));
|
|
767
|
-
var isArray =
|
|
768
|
-
var
|
|
769
|
-
var
|
|
770
|
-
var
|
|
771
|
-
|
|
1178
|
+
var isArray = Array2.isArray;
|
|
1179
|
+
var isArrayEmpty = (self) => self.length === 0;
|
|
1180
|
+
var isReadonlyArrayEmpty = isArrayEmpty;
|
|
1181
|
+
var isReadonlyArrayNonEmpty = isArrayNonEmpty;
|
|
1182
|
+
function isOutOfBounds(i, as) {
|
|
1183
|
+
return i < 0 || i >= as.length;
|
|
1184
|
+
}
|
|
772
1185
|
var get = /* @__PURE__ */ dual(2, (self, index) => {
|
|
773
1186
|
const i = Math.floor(index);
|
|
774
1187
|
return isOutOfBounds(i, self) ? none2() : some2(self[i]);
|
|
775
1188
|
});
|
|
776
|
-
var
|
|
1189
|
+
var getUnsafe = /* @__PURE__ */ dual(2, (self, index) => {
|
|
777
1190
|
const i = Math.floor(index);
|
|
778
1191
|
if (isOutOfBounds(i, self)) {
|
|
779
|
-
throw new Error(`Index
|
|
1192
|
+
throw new Error(`Index out of bounds: ${i}`);
|
|
780
1193
|
}
|
|
781
1194
|
return self[i];
|
|
782
1195
|
});
|
|
783
1196
|
var head = /* @__PURE__ */ get(0);
|
|
784
|
-
var headNonEmpty = /* @__PURE__ */
|
|
1197
|
+
var headNonEmpty = /* @__PURE__ */ getUnsafe(0);
|
|
785
1198
|
var tailNonEmpty = (self) => self.slice(1);
|
|
786
1199
|
var sort = /* @__PURE__ */ dual(2, (self, O) => {
|
|
787
|
-
const out =
|
|
1200
|
+
const out = Array2.from(self);
|
|
788
1201
|
out.sort(O);
|
|
789
1202
|
return out;
|
|
790
1203
|
});
|
|
@@ -796,19 +1209,18 @@ var containsWith = (isEquivalent) => dual(2, (self, a) => {
|
|
|
796
1209
|
}
|
|
797
1210
|
return false;
|
|
798
1211
|
});
|
|
799
|
-
var _equivalence = /* @__PURE__ */ equivalence();
|
|
800
1212
|
var intersectionWith = (isEquivalent) => {
|
|
801
1213
|
const has = containsWith(isEquivalent);
|
|
802
1214
|
return dual(2, (self, that) => {
|
|
803
|
-
const
|
|
804
|
-
return fromIterable(self).filter((a) => has(
|
|
1215
|
+
const thatArray = fromIterable(that);
|
|
1216
|
+
return fromIterable(self).filter((a) => has(thatArray, a));
|
|
805
1217
|
});
|
|
806
1218
|
};
|
|
807
|
-
var intersection = /* @__PURE__ */ intersectionWith(
|
|
1219
|
+
var intersection = /* @__PURE__ */ intersectionWith(/* @__PURE__ */ asEquivalence());
|
|
808
1220
|
var empty = () => [];
|
|
809
1221
|
var map3 = /* @__PURE__ */ dual(2, (self, f) => self.map(f));
|
|
810
1222
|
var flatMap = /* @__PURE__ */ dual(2, (self, f) => {
|
|
811
|
-
if (
|
|
1223
|
+
if (isReadonlyArrayEmpty(self)) {
|
|
812
1224
|
return [];
|
|
813
1225
|
}
|
|
814
1226
|
const out = [];
|
|
@@ -821,19 +1233,20 @@ var flatMap = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
821
1233
|
return out;
|
|
822
1234
|
});
|
|
823
1235
|
var flatten = /* @__PURE__ */ flatMap(identity);
|
|
824
|
-
var filter = /* @__PURE__ */ dual(2, (self,
|
|
1236
|
+
var filter = /* @__PURE__ */ dual(2, (self, f) => {
|
|
825
1237
|
const as = fromIterable(self);
|
|
826
1238
|
const out = [];
|
|
827
1239
|
for (let i = 0; i < as.length; i++) {
|
|
828
|
-
|
|
829
|
-
|
|
1240
|
+
const result = apply(f, as[i], i);
|
|
1241
|
+
if (!isFailure2(result)) {
|
|
1242
|
+
out.push(result.success);
|
|
830
1243
|
}
|
|
831
1244
|
}
|
|
832
1245
|
return out;
|
|
833
1246
|
});
|
|
834
1247
|
var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
|
|
835
1248
|
const input = fromIterable(self);
|
|
836
|
-
if (
|
|
1249
|
+
if (isReadonlyArrayNonEmpty(input)) {
|
|
837
1250
|
const out = [headNonEmpty(input)];
|
|
838
1251
|
const rest = tailNonEmpty(input);
|
|
839
1252
|
for (const r of rest) {
|
|
@@ -845,7 +1258,7 @@ var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
|
|
|
845
1258
|
}
|
|
846
1259
|
return [];
|
|
847
1260
|
});
|
|
848
|
-
var dedupe = (self) => dedupeWith(self,
|
|
1261
|
+
var dedupe = (self) => dedupeWith(self, asEquivalence());
|
|
849
1262
|
var join = /* @__PURE__ */ dual(2, (self, sep) => fromIterable(self).join(sep));
|
|
850
1263
|
|
|
851
1264
|
// src/core/Nano.ts
|
|
@@ -855,7 +1268,7 @@ var NanoTag = class {
|
|
|
855
1268
|
this.key = key;
|
|
856
1269
|
}
|
|
857
1270
|
};
|
|
858
|
-
var Tag = (
|
|
1271
|
+
var Tag = (identifier2) => new NanoTag(identifier2);
|
|
859
1272
|
var SingleShotGen2 = class _SingleShotGen {
|
|
860
1273
|
called = false;
|
|
861
1274
|
self;
|
|
@@ -881,12 +1294,12 @@ var SingleShotGen2 = class _SingleShotGen {
|
|
|
881
1294
|
return new _SingleShotGen(this.self);
|
|
882
1295
|
}
|
|
883
1296
|
};
|
|
884
|
-
var
|
|
885
|
-
var
|
|
886
|
-
var
|
|
887
|
-
var
|
|
1297
|
+
var evaluate2 = /* @__PURE__ */ Symbol.for("Nano.evaluate");
|
|
1298
|
+
var contA2 = /* @__PURE__ */ Symbol.for("Nano.contA");
|
|
1299
|
+
var contE2 = /* @__PURE__ */ Symbol.for("Nano.contE");
|
|
1300
|
+
var contAll2 = /* @__PURE__ */ Symbol.for("Nano.contAll");
|
|
888
1301
|
var NanoYield = /* @__PURE__ */ Symbol.for("Nano.yield");
|
|
889
|
-
var
|
|
1302
|
+
var args2 = /* @__PURE__ */ Symbol.for("Nano.args");
|
|
890
1303
|
var NanoDefectException = class {
|
|
891
1304
|
constructor(message, lastSpan) {
|
|
892
1305
|
this.message = message;
|
|
@@ -903,43 +1316,43 @@ var SucceedProto = {
|
|
|
903
1316
|
...PrimitiveProto,
|
|
904
1317
|
_tag: "Success",
|
|
905
1318
|
get value() {
|
|
906
|
-
return this[
|
|
1319
|
+
return this[args2];
|
|
907
1320
|
},
|
|
908
|
-
[
|
|
909
|
-
const cont = fiber.getCont(
|
|
910
|
-
return cont ? cont[
|
|
1321
|
+
[evaluate2](fiber) {
|
|
1322
|
+
const cont = fiber.getCont(contA2);
|
|
1323
|
+
return cont ? cont[contA2](this[args2], fiber) : fiber.yieldWith(this);
|
|
911
1324
|
}
|
|
912
1325
|
};
|
|
913
|
-
var
|
|
1326
|
+
var succeed3 = (value) => {
|
|
914
1327
|
const nano = Object.create(SucceedProto);
|
|
915
|
-
nano[
|
|
1328
|
+
nano[args2] = value;
|
|
916
1329
|
return nano;
|
|
917
1330
|
};
|
|
918
|
-
var
|
|
1331
|
+
var FailureProto2 = {
|
|
919
1332
|
...PrimitiveProto,
|
|
920
1333
|
_tag: "Failure",
|
|
921
1334
|
get value() {
|
|
922
|
-
return this[
|
|
1335
|
+
return this[args2];
|
|
923
1336
|
},
|
|
924
|
-
[
|
|
925
|
-
const cont = fiber.getCont(
|
|
926
|
-
return cont ? cont[
|
|
1337
|
+
[evaluate2](fiber) {
|
|
1338
|
+
const cont = fiber.getCont(contE2);
|
|
1339
|
+
return cont ? cont[contE2](this[args2], fiber) : fiber.yieldWith(this);
|
|
927
1340
|
}
|
|
928
1341
|
};
|
|
929
|
-
var
|
|
930
|
-
const nano = Object.create(
|
|
931
|
-
nano[
|
|
1342
|
+
var fail3 = (error) => {
|
|
1343
|
+
const nano = Object.create(FailureProto2);
|
|
1344
|
+
nano[args2] = error;
|
|
932
1345
|
return nano;
|
|
933
1346
|
};
|
|
934
1347
|
var SuspendProto = {
|
|
935
1348
|
...PrimitiveProto,
|
|
936
|
-
[
|
|
937
|
-
return this[
|
|
1349
|
+
[evaluate2]() {
|
|
1350
|
+
return this[args2]();
|
|
938
1351
|
}
|
|
939
1352
|
};
|
|
940
1353
|
var suspend = (fn2) => {
|
|
941
1354
|
const nano = Object.create(SuspendProto);
|
|
942
|
-
nano[
|
|
1355
|
+
nano[args2] = fn2;
|
|
943
1356
|
return nano;
|
|
944
1357
|
};
|
|
945
1358
|
var NanoFiber = class {
|
|
@@ -951,7 +1364,7 @@ var NanoFiber = class {
|
|
|
951
1364
|
runLoop(nano) {
|
|
952
1365
|
let current = nano;
|
|
953
1366
|
while (true) {
|
|
954
|
-
current = current[
|
|
1367
|
+
current = current[evaluate2](this);
|
|
955
1368
|
if (current === NanoYield) {
|
|
956
1369
|
return this._yielded;
|
|
957
1370
|
}
|
|
@@ -961,7 +1374,7 @@ var NanoFiber = class {
|
|
|
961
1374
|
while (true) {
|
|
962
1375
|
const op = this._stack.pop();
|
|
963
1376
|
if (!op) return void 0;
|
|
964
|
-
const cont = op[
|
|
1377
|
+
const cont = op[contAll2] && op[contAll2](this);
|
|
965
1378
|
if (cont) return { [symbol3]: cont };
|
|
966
1379
|
if (op[symbol3]) return op;
|
|
967
1380
|
}
|
|
@@ -975,8 +1388,8 @@ var timings = {};
|
|
|
975
1388
|
var timingsCount = {};
|
|
976
1389
|
var WithSpanProto = {
|
|
977
1390
|
...PrimitiveProto,
|
|
978
|
-
[
|
|
979
|
-
const [fa, name] = this[
|
|
1391
|
+
[evaluate2](fiber) {
|
|
1392
|
+
const [fa, name] = this[args2];
|
|
980
1393
|
if (!debugPerformance) return fa;
|
|
981
1394
|
const previousSpan = fiber._lastSpan;
|
|
982
1395
|
fiber._lastSpan = name;
|
|
@@ -987,20 +1400,20 @@ var WithSpanProto = {
|
|
|
987
1400
|
const end = performance.now();
|
|
988
1401
|
timings[name] = (timings[name] || 0) + (end - start);
|
|
989
1402
|
fiber._lastSpan = previousSpan;
|
|
990
|
-
return
|
|
1403
|
+
return succeed3(_);
|
|
991
1404
|
},
|
|
992
1405
|
onFailure: (_) => {
|
|
993
1406
|
const end = performance.now();
|
|
994
1407
|
timings[name] = (timings[name] || 0) + (end - start);
|
|
995
1408
|
fiber._lastSpan = previousSpan;
|
|
996
|
-
return
|
|
1409
|
+
return fail3(_);
|
|
997
1410
|
}
|
|
998
1411
|
});
|
|
999
1412
|
}
|
|
1000
1413
|
};
|
|
1001
1414
|
var withSpan = (name) => (fa) => {
|
|
1002
1415
|
const nano = Object.create(WithSpanProto);
|
|
1003
|
-
nano[
|
|
1416
|
+
nano[args2] = [fa, name];
|
|
1004
1417
|
return nano;
|
|
1005
1418
|
};
|
|
1006
1419
|
var run = (nano) => {
|
|
@@ -1008,86 +1421,86 @@ var run = (nano) => {
|
|
|
1008
1421
|
try {
|
|
1009
1422
|
const result = fiber.runLoop(nano);
|
|
1010
1423
|
if (result._tag === "Success") {
|
|
1011
|
-
return
|
|
1424
|
+
return succeed2(result.value);
|
|
1012
1425
|
}
|
|
1013
|
-
return
|
|
1426
|
+
return fail2(result.value);
|
|
1014
1427
|
} catch (e) {
|
|
1015
|
-
return
|
|
1428
|
+
return fail2(new NanoDefectException(e, fiber._lastSpan));
|
|
1016
1429
|
}
|
|
1017
1430
|
};
|
|
1018
1431
|
var OnSuccessProto = {
|
|
1019
1432
|
...PrimitiveProto,
|
|
1020
|
-
[
|
|
1433
|
+
[evaluate2](fiber) {
|
|
1021
1434
|
fiber._stack.push(this);
|
|
1022
|
-
return this[
|
|
1435
|
+
return this[args2];
|
|
1023
1436
|
}
|
|
1024
1437
|
};
|
|
1025
1438
|
var flatMap2 = dual(2, (fa, f) => {
|
|
1026
1439
|
const nano = Object.create(OnSuccessProto);
|
|
1027
|
-
nano[
|
|
1028
|
-
nano[
|
|
1440
|
+
nano[args2] = fa;
|
|
1441
|
+
nano[contA2] = f;
|
|
1029
1442
|
return nano;
|
|
1030
1443
|
});
|
|
1031
|
-
var map4 = dual(2, (fa, f) => flatMap2(fa, (_) =>
|
|
1444
|
+
var map4 = dual(2, (fa, f) => flatMap2(fa, (_) => succeed3(f(_))));
|
|
1032
1445
|
var SyncProto = {
|
|
1033
1446
|
...PrimitiveProto,
|
|
1034
|
-
[
|
|
1035
|
-
const value = this[
|
|
1036
|
-
const cont = fiber.getCont(
|
|
1037
|
-
return cont ? cont[
|
|
1447
|
+
[evaluate2](fiber) {
|
|
1448
|
+
const value = this[args2]();
|
|
1449
|
+
const cont = fiber.getCont(contA2);
|
|
1450
|
+
return cont ? cont[contA2](value, fiber) : fiber.yieldWith(succeed3(value));
|
|
1038
1451
|
}
|
|
1039
1452
|
};
|
|
1040
1453
|
var sync = (f) => {
|
|
1041
1454
|
const nano = Object.create(SyncProto);
|
|
1042
|
-
nano[
|
|
1455
|
+
nano[args2] = f;
|
|
1043
1456
|
return nano;
|
|
1044
1457
|
};
|
|
1045
|
-
var void_ =
|
|
1458
|
+
var void_ = succeed3(void 0);
|
|
1046
1459
|
var FromIteratorProto = {
|
|
1047
1460
|
...PrimitiveProto,
|
|
1048
|
-
[
|
|
1049
|
-
const state = this[
|
|
1050
|
-
if (state.done) return
|
|
1461
|
+
[contA2](value, fiber) {
|
|
1462
|
+
const state = this[args2][0].next(value);
|
|
1463
|
+
if (state.done) return succeed3(state.value);
|
|
1051
1464
|
fiber._stack.push(this);
|
|
1052
1465
|
return state.value;
|
|
1053
1466
|
},
|
|
1054
|
-
[
|
|
1055
|
-
return this[
|
|
1467
|
+
[evaluate2](fiber) {
|
|
1468
|
+
return this[contA2](this[args2][1], fiber);
|
|
1056
1469
|
}
|
|
1057
1470
|
};
|
|
1058
1471
|
var unsafeFromIterator = (iterator, initial) => {
|
|
1059
1472
|
const nano = Object.create(FromIteratorProto);
|
|
1060
|
-
nano[
|
|
1473
|
+
nano[args2] = [iterator, initial];
|
|
1061
1474
|
return nano;
|
|
1062
1475
|
};
|
|
1063
|
-
var gen = (...
|
|
1064
|
-
var fn = (_) => (body) => (...
|
|
1476
|
+
var gen = (...args3) => suspend(() => unsafeFromIterator(args3[0]()));
|
|
1477
|
+
var fn = (_) => (body) => (...args3) => withSpan(_)(suspend(() => unsafeFromIterator(body(...args3))));
|
|
1065
1478
|
var MatchProto = {
|
|
1066
1479
|
...PrimitiveProto,
|
|
1067
|
-
[
|
|
1480
|
+
[evaluate2](fiber) {
|
|
1068
1481
|
fiber._stack.push(this);
|
|
1069
|
-
return this[
|
|
1482
|
+
return this[args2];
|
|
1070
1483
|
}
|
|
1071
1484
|
};
|
|
1072
1485
|
var match = (fa, opts) => {
|
|
1073
1486
|
const nano = Object.create(MatchProto);
|
|
1074
|
-
nano[
|
|
1075
|
-
nano[
|
|
1076
|
-
nano[
|
|
1487
|
+
nano[args2] = fa;
|
|
1488
|
+
nano[contA2] = opts.onSuccess;
|
|
1489
|
+
nano[contE2] = opts.onFailure;
|
|
1077
1490
|
return nano;
|
|
1078
1491
|
};
|
|
1079
1492
|
var orElse2 = (f) => (fa) => {
|
|
1080
1493
|
const nano = Object.create(MatchProto);
|
|
1081
|
-
nano[
|
|
1082
|
-
nano[
|
|
1494
|
+
nano[args2] = fa;
|
|
1495
|
+
nano[contE2] = (_) => _ instanceof NanoDefectException ? fail3(_) : f(_);
|
|
1083
1496
|
return nano;
|
|
1084
1497
|
};
|
|
1085
1498
|
var firstSuccessOf = (arr) => arr.slice(1).reduce((arr2, fa) => orElse2(() => fa)(arr2), arr[0]);
|
|
1086
1499
|
var ProvideServiceProto = {
|
|
1087
1500
|
...PrimitiveProto,
|
|
1088
|
-
[
|
|
1501
|
+
[evaluate2](fiber) {
|
|
1089
1502
|
const prevServices = fiber._services;
|
|
1090
|
-
const [fa, tag, value] = this[
|
|
1503
|
+
const [fa, tag, value] = this[args2];
|
|
1091
1504
|
fiber._services = {
|
|
1092
1505
|
...fiber._services,
|
|
1093
1506
|
[tag.key]: value
|
|
@@ -1095,54 +1508,54 @@ var ProvideServiceProto = {
|
|
|
1095
1508
|
return match(fa, {
|
|
1096
1509
|
onSuccess: (_) => {
|
|
1097
1510
|
fiber._services = prevServices;
|
|
1098
|
-
return
|
|
1511
|
+
return succeed3(_);
|
|
1099
1512
|
},
|
|
1100
1513
|
onFailure: (_) => {
|
|
1101
1514
|
fiber._services = prevServices;
|
|
1102
|
-
return
|
|
1515
|
+
return fail3(_);
|
|
1103
1516
|
}
|
|
1104
1517
|
});
|
|
1105
1518
|
}
|
|
1106
1519
|
};
|
|
1107
1520
|
var provideService = (tag, value) => (fa) => {
|
|
1108
1521
|
const nano = Object.create(ProvideServiceProto);
|
|
1109
|
-
nano[
|
|
1522
|
+
nano[args2] = [fa, tag, value];
|
|
1110
1523
|
return nano;
|
|
1111
1524
|
};
|
|
1112
1525
|
var ServiceProto = {
|
|
1113
1526
|
...PrimitiveProto,
|
|
1114
|
-
[
|
|
1115
|
-
const tag = this[
|
|
1527
|
+
[evaluate2](fiber) {
|
|
1528
|
+
const tag = this[args2];
|
|
1116
1529
|
if (tag.key in fiber._services) {
|
|
1117
1530
|
const value = fiber._services[tag.key];
|
|
1118
|
-
const cont2 = fiber.getCont(
|
|
1119
|
-
return cont2 ? cont2[
|
|
1531
|
+
const cont2 = fiber.getCont(contA2);
|
|
1532
|
+
return cont2 ? cont2[contA2](value, fiber) : fiber.yieldWith(succeed3(value));
|
|
1120
1533
|
}
|
|
1121
|
-
const cont = fiber.getCont(
|
|
1122
|
-
return cont ? cont[
|
|
1534
|
+
const cont = fiber.getCont(contE2);
|
|
1535
|
+
return cont ? cont[contE2](tag, fiber) : fiber.yieldWith(fail3(new NanoDefectException(`Service ${tag.key} not found`, fiber._lastSpan)));
|
|
1123
1536
|
}
|
|
1124
1537
|
};
|
|
1125
1538
|
var service = (tag) => {
|
|
1126
1539
|
const nano = Object.create(ServiceProto);
|
|
1127
|
-
nano[
|
|
1540
|
+
nano[args2] = tag;
|
|
1128
1541
|
return nano;
|
|
1129
1542
|
};
|
|
1130
1543
|
var CachedProto = {
|
|
1131
1544
|
...PrimitiveProto,
|
|
1132
|
-
[
|
|
1133
|
-
const [fa, type, key] = this[
|
|
1545
|
+
[evaluate2](fiber) {
|
|
1546
|
+
const [fa, type, key] = this[args2];
|
|
1134
1547
|
const cache = fiber._cache[type] || /* @__PURE__ */ new WeakMap();
|
|
1135
1548
|
fiber._cache[type] = cache;
|
|
1136
|
-
const
|
|
1137
|
-
if (
|
|
1549
|
+
const cached = cache.get(key);
|
|
1550
|
+
if (cached) return cached;
|
|
1138
1551
|
return match(fa, {
|
|
1139
1552
|
onSuccess: (_) => {
|
|
1140
|
-
cache.set(key,
|
|
1141
|
-
return
|
|
1553
|
+
cache.set(key, succeed3(_));
|
|
1554
|
+
return succeed3(_);
|
|
1142
1555
|
},
|
|
1143
1556
|
onFailure: (_) => {
|
|
1144
|
-
cache.set(key,
|
|
1145
|
-
return
|
|
1557
|
+
cache.set(key, fail3(_));
|
|
1558
|
+
return fail3(_);
|
|
1146
1559
|
}
|
|
1147
1560
|
});
|
|
1148
1561
|
}
|
|
@@ -1150,35 +1563,35 @@ var CachedProto = {
|
|
|
1150
1563
|
function cachedBy(fa, type, lookupKey) {
|
|
1151
1564
|
return (...p) => {
|
|
1152
1565
|
const nano = Object.create(CachedProto);
|
|
1153
|
-
nano[
|
|
1566
|
+
nano[args2] = [fa(...p), type, lookupKey(...p)];
|
|
1154
1567
|
return nano;
|
|
1155
1568
|
};
|
|
1156
1569
|
}
|
|
1157
1570
|
var option = (fa) => {
|
|
1158
1571
|
const nano = Object.create(MatchProto);
|
|
1159
|
-
nano[
|
|
1160
|
-
nano[
|
|
1161
|
-
nano[
|
|
1572
|
+
nano[args2] = fa;
|
|
1573
|
+
nano[contA2] = (_) => succeed3(some2(_));
|
|
1574
|
+
nano[contE2] = (_) => _ instanceof NanoDefectException ? fail3(_) : succeed3(none2());
|
|
1162
1575
|
return nano;
|
|
1163
1576
|
};
|
|
1164
1577
|
var orUndefined = (fa) => {
|
|
1165
1578
|
const nano = Object.create(MatchProto);
|
|
1166
|
-
nano[
|
|
1167
|
-
nano[
|
|
1168
|
-
nano[
|
|
1579
|
+
nano[args2] = fa;
|
|
1580
|
+
nano[contA2] = (_) => succeed3(_);
|
|
1581
|
+
nano[contE2] = (_) => _ instanceof NanoDefectException ? fail3(_) : succeed3(void 0);
|
|
1169
1582
|
return nano;
|
|
1170
1583
|
};
|
|
1171
1584
|
var ignore = (fa) => {
|
|
1172
1585
|
const nano = Object.create(MatchProto);
|
|
1173
|
-
nano[
|
|
1174
|
-
nano[
|
|
1175
|
-
nano[
|
|
1586
|
+
nano[args2] = fa;
|
|
1587
|
+
nano[contA2] = (_) => void_;
|
|
1588
|
+
nano[contE2] = (_) => _ instanceof NanoDefectException ? fail3(_) : void_;
|
|
1176
1589
|
return nano;
|
|
1177
1590
|
};
|
|
1178
1591
|
var all = fn("all")(
|
|
1179
|
-
function* (...
|
|
1592
|
+
function* (...args3) {
|
|
1180
1593
|
const results = [];
|
|
1181
|
-
for (const fa of
|
|
1594
|
+
for (const fa of args3) {
|
|
1182
1595
|
const result = yield* fa;
|
|
1183
1596
|
results.push(result);
|
|
1184
1597
|
}
|
|
@@ -1192,7 +1605,7 @@ function isValidSeverityLevel(value) {
|
|
|
1192
1605
|
return value === "off" || value === "error" || value === "warning" || value === "message" || value === "suggestion";
|
|
1193
1606
|
}
|
|
1194
1607
|
function parseDiagnosticSeverity(config) {
|
|
1195
|
-
if (!
|
|
1608
|
+
if (!isObject(config)) return {};
|
|
1196
1609
|
return Object.fromEntries(
|
|
1197
1610
|
pipe(
|
|
1198
1611
|
Object.entries(config),
|
|
@@ -1255,7 +1668,7 @@ function parse(config) {
|
|
|
1255
1668
|
return {
|
|
1256
1669
|
refactors: isObject(config) && hasProperty(config, "refactors") && isBoolean(config.refactors) ? config.refactors : defaults.refactors,
|
|
1257
1670
|
diagnostics: isObject(config) && hasProperty(config, "diagnostics") && isBoolean(config.diagnostics) ? config.diagnostics : defaults.diagnostics,
|
|
1258
|
-
diagnosticSeverity: isObject(config) && hasProperty(config, "diagnosticSeverity") &&
|
|
1671
|
+
diagnosticSeverity: isObject(config) && hasProperty(config, "diagnosticSeverity") && isObject(config.diagnosticSeverity) ? parseDiagnosticSeverity(config.diagnosticSeverity) : defaults.diagnosticSeverity,
|
|
1259
1672
|
diagnosticsName: isObject(config) && hasProperty(config, "diagnosticsName") && isBoolean(config.diagnosticsName) ? config.diagnosticsName : defaults.diagnosticsName,
|
|
1260
1673
|
missingDiagnosticNextLine: isObject(config) && hasProperty(config, "missingDiagnosticNextLine") && isString(config.missingDiagnosticNextLine) && isValidSeverityLevel(config.missingDiagnosticNextLine) ? config.missingDiagnosticNextLine : defaults.missingDiagnosticNextLine,
|
|
1261
1674
|
includeSuggestionsInTsc: isObject(config) && hasProperty(config, "includeSuggestionsInTsc") && isBoolean(config.includeSuggestionsInTsc) ? config.includeSuggestionsInTsc : defaults.includeSuggestionsInTsc,
|
|
@@ -1270,7 +1683,7 @@ function parse(config) {
|
|
|
1270
1683
|
allowedDuplicatedPackages: isObject(config) && hasProperty(config, "allowedDuplicatedPackages") && isArray(config.allowedDuplicatedPackages) && config.allowedDuplicatedPackages.every(isString) ? config.allowedDuplicatedPackages.map((_) => _.toLowerCase()) : defaults.allowedDuplicatedPackages,
|
|
1271
1684
|
namespaceImportPackages: isObject(config) && hasProperty(config, "namespaceImportPackages") && isArray(config.namespaceImportPackages) && config.namespaceImportPackages.every(isString) ? config.namespaceImportPackages.map((_) => _.toLowerCase()) : defaults.namespaceImportPackages,
|
|
1272
1685
|
barrelImportPackages: isObject(config) && hasProperty(config, "barrelImportPackages") && isArray(config.barrelImportPackages) && config.barrelImportPackages.every(isString) ? config.barrelImportPackages.map((_) => _.toLowerCase()) : defaults.barrelImportPackages,
|
|
1273
|
-
importAliases: isObject(config) && hasProperty(config, "importAliases") &&
|
|
1686
|
+
importAliases: isObject(config) && hasProperty(config, "importAliases") && isObject(config.importAliases) ? map2(config.importAliases, (value) => String(value)) : defaults.importAliases,
|
|
1274
1687
|
topLevelNamedReexports: isObject(config) && hasProperty(config, "topLevelNamedReexports") && isString(config.topLevelNamedReexports) && ["ignore", "follow"].includes(config.topLevelNamedReexports.toLowerCase()) ? config.topLevelNamedReexports.toLowerCase() : defaults.topLevelNamedReexports,
|
|
1275
1688
|
renames: isObject(config) && hasProperty(config, "renames") && isBoolean(config.renames) ? config.renames : defaults.renames,
|
|
1276
1689
|
noExternal: isObject(config) && hasProperty(config, "noExternal") && isBoolean(config.noExternal) ? config.noExternal : defaults.noExternal,
|
|
@@ -1289,9 +1702,9 @@ var TypeScriptProgram = Tag("TypeScriptProgram");
|
|
|
1289
1702
|
var ChangeTracker = Tag("ChangeTracker");
|
|
1290
1703
|
function getPackageJsonInfoCache(program) {
|
|
1291
1704
|
try {
|
|
1292
|
-
if (hasProperty(program, "getModuleResolutionCache") &&
|
|
1705
|
+
if (hasProperty(program, "getModuleResolutionCache") && isFunction(program.getModuleResolutionCache)) {
|
|
1293
1706
|
const moduleResolutionCache = program.getModuleResolutionCache();
|
|
1294
|
-
if (hasProperty(moduleResolutionCache, "getPackageJsonInfoCache") &&
|
|
1707
|
+
if (hasProperty(moduleResolutionCache, "getPackageJsonInfoCache") && isFunction(moduleResolutionCache.getPackageJsonInfoCache)) {
|
|
1295
1708
|
return moduleResolutionCache.getPackageJsonInfoCache();
|
|
1296
1709
|
}
|
|
1297
1710
|
}
|
|
@@ -1302,7 +1715,7 @@ function getPackageJsonInfoCache(program) {
|
|
|
1302
1715
|
}
|
|
1303
1716
|
function getDirectoryPath(ts, path) {
|
|
1304
1717
|
try {
|
|
1305
|
-
if (hasProperty(ts, "getDirectoryPath") &&
|
|
1718
|
+
if (hasProperty(ts, "getDirectoryPath") && isFunction(ts.getDirectoryPath)) {
|
|
1306
1719
|
return ts.getDirectoryPath(path);
|
|
1307
1720
|
}
|
|
1308
1721
|
return path;
|
|
@@ -1311,7 +1724,7 @@ function getDirectoryPath(ts, path) {
|
|
|
1311
1724
|
}
|
|
1312
1725
|
}
|
|
1313
1726
|
function makeGetModuleSpecifier(ts) {
|
|
1314
|
-
if (!(hasProperty(ts, "moduleSpecifiers") && hasProperty(ts.moduleSpecifiers, "getModuleSpecifier") &&
|
|
1727
|
+
if (!(hasProperty(ts, "moduleSpecifiers") && hasProperty(ts.moduleSpecifiers, "getModuleSpecifier") && isFunction(ts.moduleSpecifiers.getModuleSpecifier))) return;
|
|
1315
1728
|
const _internal = ts.moduleSpecifiers.getModuleSpecifier;
|
|
1316
1729
|
return (compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, options) => {
|
|
1317
1730
|
return _internal(
|
|
@@ -1325,14 +1738,14 @@ function makeGetModuleSpecifier(ts) {
|
|
|
1325
1738
|
};
|
|
1326
1739
|
}
|
|
1327
1740
|
function makeGetTemporaryModuleResolutionState(ts) {
|
|
1328
|
-
if (hasProperty(ts, "getTemporaryModuleResolutionState") &&
|
|
1741
|
+
if (hasProperty(ts, "getTemporaryModuleResolutionState") && isFunction(ts.getTemporaryModuleResolutionState)) {
|
|
1329
1742
|
const _internal = ts.getTemporaryModuleResolutionState;
|
|
1330
1743
|
return (cache, program, compilerOptions) => _internal(cache, program, compilerOptions);
|
|
1331
1744
|
}
|
|
1332
1745
|
return void 0;
|
|
1333
1746
|
}
|
|
1334
1747
|
function makeGetPackageScopeForPath(ts) {
|
|
1335
|
-
if (hasProperty(ts, "getPackageScopeForPath") &&
|
|
1748
|
+
if (hasProperty(ts, "getPackageScopeForPath") && isFunction(ts.getPackageScopeForPath)) {
|
|
1336
1749
|
const _internal = ts.getPackageScopeForPath;
|
|
1337
1750
|
return (path, state) => _internal(path, state);
|
|
1338
1751
|
}
|
|
@@ -1590,7 +2003,7 @@ function makeTypeScriptUtils(ts) {
|
|
|
1590
2003
|
}
|
|
1591
2004
|
} else if (ts.isNamedImports(namedBindings)) {
|
|
1592
2005
|
for (const importSpecifier of namedBindings.elements) {
|
|
1593
|
-
const importProperty =
|
|
2006
|
+
const importProperty = fromNullishOr(importSpecifier.propertyName).pipe(
|
|
1594
2007
|
orElse(() => some2(importSpecifier.name))
|
|
1595
2008
|
);
|
|
1596
2009
|
if (test(importSpecifier.name, statement.moduleSpecifier, importProperty)) {
|
|
@@ -1943,7 +2356,7 @@ var codeFixesToApplicableRefactor = fn("LSP.codeFixesToApplicableRefactor")(func
|
|
|
1943
2356
|
var getEditsForRefactor = fn("LSP.getEditsForRefactor")(function* (refactors, sourceFile, positionOrRange, refactorName) {
|
|
1944
2357
|
const refactor = refactors.find((refactor2) => refactorNameToFullyQualifiedName(refactor2.name) === refactorName);
|
|
1945
2358
|
if (!refactor) {
|
|
1946
|
-
return yield*
|
|
2359
|
+
return yield* fail3(new RefactorNotApplicableError());
|
|
1947
2360
|
}
|
|
1948
2361
|
const textRange = typeof positionOrRange === "number" ? { pos: positionOrRange, end: positionOrRange } : positionOrRange;
|
|
1949
2362
|
return yield* refactor.apply(sourceFile, textRange);
|
|
@@ -1954,7 +2367,7 @@ var getEditsForCodeFixes = fn("LSP.getEditsForCodeFixes")(function* (codeFixes,
|
|
|
1954
2367
|
(_) => codeFixNameToFullyQualifiedName(_.fixName) === refactorName && _.start <= textRange.pos && _.end >= textRange.end
|
|
1955
2368
|
);
|
|
1956
2369
|
if (!fixToRun) {
|
|
1957
|
-
return yield*
|
|
2370
|
+
return yield* fail3(new RefactorNotApplicableError());
|
|
1958
2371
|
}
|
|
1959
2372
|
return fixToRun;
|
|
1960
2373
|
});
|
|
@@ -2209,7 +2622,7 @@ var getEditsForCodegen = fn("LSP.getEditsForCodegen")(function* (codegens2, sour
|
|
|
2209
2622
|
(codegen2) => codegen2.range.pos <= textRange.pos && codegen2.range.end >= textRange.end
|
|
2210
2623
|
);
|
|
2211
2624
|
if (inRangeCodegens.length !== 1) {
|
|
2212
|
-
return yield*
|
|
2625
|
+
return yield* fail3(new CodegenNotApplicableError("zero or multiple codegens in range"));
|
|
2213
2626
|
}
|
|
2214
2627
|
const { codegen, range } = inRangeCodegens[0];
|
|
2215
2628
|
const edit = yield* codegen.apply(sourceFile, range);
|
|
@@ -2408,8 +2821,8 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
|
|
|
2408
2821
|
};
|
|
2409
2822
|
const expectedAndRealTypeCache = /* @__PURE__ */ new WeakMap();
|
|
2410
2823
|
const expectedAndRealType = (sourceFile) => {
|
|
2411
|
-
const
|
|
2412
|
-
if (
|
|
2824
|
+
const cached = expectedAndRealTypeCache.get(sourceFile);
|
|
2825
|
+
if (cached) return cached;
|
|
2413
2826
|
const result = [];
|
|
2414
2827
|
const nodeToVisit = [sourceFile];
|
|
2415
2828
|
const appendNodeToVisit = (node) => {
|
|
@@ -2626,7 +3039,7 @@ var nanoLayer3 = (fa) => gen(function* () {
|
|
|
2626
3039
|
});
|
|
2627
3040
|
var TypeParserIssue = class _TypeParserIssue {
|
|
2628
3041
|
_tag = "@effect/language-service/TypeParserIssue";
|
|
2629
|
-
static issue =
|
|
3042
|
+
static issue = fail3(new _TypeParserIssue());
|
|
2630
3043
|
};
|
|
2631
3044
|
function typeParserIssue(_message, _type, _node) {
|
|
2632
3045
|
return TypeParserIssue.issue;
|
|
@@ -2825,7 +3238,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
2825
3238
|
if (signatures[0].typeParameters && signatures[0].typeParameters.length > 0) {
|
|
2826
3239
|
return typeParserIssue("Invariant type should not have type parameters", type);
|
|
2827
3240
|
}
|
|
2828
|
-
return
|
|
3241
|
+
return succeed3(typeChecker.getReturnTypeOfSignature(signatures[0]));
|
|
2829
3242
|
}
|
|
2830
3243
|
function contravariantTypeArgument(type) {
|
|
2831
3244
|
const signatures = typeChecker.getSignaturesOfType(type, ts.SignatureKind.Call);
|
|
@@ -2835,7 +3248,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
2835
3248
|
if (signatures[0].typeParameters && signatures[0].typeParameters.length > 0) {
|
|
2836
3249
|
return typeParserIssue("Invariant type should not have type parameters", type);
|
|
2837
3250
|
}
|
|
2838
|
-
return
|
|
3251
|
+
return succeed3(typeCheckerUtils.getTypeParameterAtPosition(signatures[0], 0));
|
|
2839
3252
|
}
|
|
2840
3253
|
function invariantTypeArgument(type) {
|
|
2841
3254
|
const signatures = typeChecker.getSignaturesOfType(type, ts.SignatureKind.Call);
|
|
@@ -2845,7 +3258,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
2845
3258
|
if (signatures[0].typeParameters && signatures[0].typeParameters.length > 0) {
|
|
2846
3259
|
return typeParserIssue("Invariant type should not have type parameters", type);
|
|
2847
3260
|
}
|
|
2848
|
-
return
|
|
3261
|
+
return succeed3(typeChecker.getReturnTypeOfSignature(signatures[0]));
|
|
2849
3262
|
}
|
|
2850
3263
|
const pipeableType = cachedBy(
|
|
2851
3264
|
function(type, atLocation) {
|
|
@@ -2858,7 +3271,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
2858
3271
|
if (signatures.length === 0) {
|
|
2859
3272
|
return typeParserIssue("'pipe' property is not callable", type, atLocation);
|
|
2860
3273
|
}
|
|
2861
|
-
return
|
|
3274
|
+
return succeed3(type);
|
|
2862
3275
|
},
|
|
2863
3276
|
"TypeParser.pipeableType",
|
|
2864
3277
|
(type) => type
|
|
@@ -3322,7 +3735,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
3322
3735
|
const type = typeCheckerUtils.getTypeAtLocation(yieldedExpression);
|
|
3323
3736
|
if (!type) continue;
|
|
3324
3737
|
const { A: successType } = yield* effectType(type, yieldedExpression);
|
|
3325
|
-
let replacementNode =
|
|
3738
|
+
let replacementNode = succeed3(yieldedExpression);
|
|
3326
3739
|
if (!explicitReturn && !(successType.flags & ts.TypeFlags.VoidLike)) {
|
|
3327
3740
|
replacementNode = pipe(
|
|
3328
3741
|
gen(function* () {
|
|
@@ -3533,15 +3946,15 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
3533
3946
|
if (node.arguments.length === 0) {
|
|
3534
3947
|
return typeParserIssue("Node is not a pipe call", void 0, node);
|
|
3535
3948
|
}
|
|
3536
|
-
const [subject, ...
|
|
3537
|
-
return
|
|
3949
|
+
const [subject, ...args3] = node.arguments;
|
|
3950
|
+
return succeed3({
|
|
3538
3951
|
node,
|
|
3539
3952
|
subject,
|
|
3540
|
-
args:
|
|
3953
|
+
args: args3,
|
|
3541
3954
|
kind: "pipe"
|
|
3542
3955
|
});
|
|
3543
3956
|
}
|
|
3544
|
-
return
|
|
3957
|
+
return succeed3({
|
|
3545
3958
|
node,
|
|
3546
3959
|
subject: baseExpression,
|
|
3547
3960
|
args: Array.from(node.arguments),
|
|
@@ -3551,8 +3964,8 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
3551
3964
|
);
|
|
3552
3965
|
}
|
|
3553
3966
|
if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && ts.idText(node.expression) === "pipe" && node.arguments.length > 0) {
|
|
3554
|
-
const [subject, ...
|
|
3555
|
-
return
|
|
3967
|
+
const [subject, ...args3] = node.arguments;
|
|
3968
|
+
return succeed3({ node, subject, args: args3, kind: "pipe" });
|
|
3556
3969
|
}
|
|
3557
3970
|
return typeParserIssue("Node is not a pipe call", void 0, node);
|
|
3558
3971
|
},
|
|
@@ -3567,7 +3980,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
3567
3980
|
if (node.arguments.length !== 1) {
|
|
3568
3981
|
return typeParserIssue("Node must have exactly one argument", void 0, node);
|
|
3569
3982
|
}
|
|
3570
|
-
return
|
|
3983
|
+
return succeed3({
|
|
3571
3984
|
node,
|
|
3572
3985
|
callee: node.expression,
|
|
3573
3986
|
subject: node.arguments[0]
|
|
@@ -3629,7 +4042,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
3629
4042
|
if (!callbackParameterType) {
|
|
3630
4043
|
continue;
|
|
3631
4044
|
}
|
|
3632
|
-
return
|
|
4045
|
+
return succeed3({
|
|
3633
4046
|
type: callbackParameterType
|
|
3634
4047
|
});
|
|
3635
4048
|
}
|
|
@@ -4041,9 +4454,9 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
4041
4454
|
let accessors2 = void 0;
|
|
4042
4455
|
let dependencies = void 0;
|
|
4043
4456
|
if (wholeCall.arguments.length >= 2) {
|
|
4044
|
-
const
|
|
4045
|
-
if (ts.isObjectLiteralExpression(
|
|
4046
|
-
for (const property of
|
|
4457
|
+
const args3 = wholeCall.arguments[1];
|
|
4458
|
+
if (ts.isObjectLiteralExpression(args3)) {
|
|
4459
|
+
for (const property of args3.properties) {
|
|
4047
4460
|
if (ts.isPropertyAssignment(property) && property.name && ts.isIdentifier(property.name) && ts.idText(property.name) === "accessors" && property.initializer && property.initializer.kind === ts.SyntaxKind.TrueKeyword) {
|
|
4048
4461
|
accessors2 = true;
|
|
4049
4462
|
}
|
|
@@ -4191,6 +4604,73 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
4191
4604
|
"TypeParser.extendsEffectSqlModelClass",
|
|
4192
4605
|
(atLocation) => atLocation
|
|
4193
4606
|
);
|
|
4607
|
+
const isEffectSchemaModelTypeSourceFile = cachedBy(
|
|
4608
|
+
fn("TypeParser.isEffectSchemaModelTypeSourceFile")(function* (sourceFile) {
|
|
4609
|
+
const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
|
|
4610
|
+
if (!moduleSymbol) return yield* typeParserIssue("Node has no symbol", void 0, sourceFile);
|
|
4611
|
+
const classSymbol = typeChecker.tryGetMemberInModuleExports("Class", moduleSymbol);
|
|
4612
|
+
if (!classSymbol) return yield* typeParserIssue("Model's Class type not found", void 0, sourceFile);
|
|
4613
|
+
const generatedSymbol = typeChecker.tryGetMemberInModuleExports("Generated", moduleSymbol);
|
|
4614
|
+
if (!generatedSymbol) {
|
|
4615
|
+
return yield* typeParserIssue("Model's Generated type not found", void 0, sourceFile);
|
|
4616
|
+
}
|
|
4617
|
+
const fieldOptionSymbol = typeChecker.tryGetMemberInModuleExports("FieldOption", moduleSymbol);
|
|
4618
|
+
if (!fieldOptionSymbol) {
|
|
4619
|
+
return yield* typeParserIssue("Model's FieldOption type not found", void 0, sourceFile);
|
|
4620
|
+
}
|
|
4621
|
+
return sourceFile;
|
|
4622
|
+
}),
|
|
4623
|
+
"TypeParser.isEffectSchemaModelTypeSourceFile",
|
|
4624
|
+
(sourceFile) => sourceFile
|
|
4625
|
+
);
|
|
4626
|
+
const isNodeReferenceToEffectSchemaModelModuleApi = (memberName) => cachedBy(
|
|
4627
|
+
fn("TypeParser.isNodeReferenceToEffectSchemaModelModuleApi")(function* (node) {
|
|
4628
|
+
return yield* isNodeReferenceToExportOfPackageModule(
|
|
4629
|
+
node,
|
|
4630
|
+
"effect",
|
|
4631
|
+
isEffectSchemaModelTypeSourceFile,
|
|
4632
|
+
memberName
|
|
4633
|
+
);
|
|
4634
|
+
}),
|
|
4635
|
+
`TypeParser.isNodeReferenceToEffectSchemaModelModuleApi(${memberName})`,
|
|
4636
|
+
(node) => node
|
|
4637
|
+
);
|
|
4638
|
+
const extendsEffectSchemaModelClass = cachedBy(
|
|
4639
|
+
fn("TypeParser.extendsEffectSchemaModelClass")(function* (atLocation) {
|
|
4640
|
+
if (!atLocation.name) {
|
|
4641
|
+
return yield* typeParserIssue("Class has no name", void 0, atLocation);
|
|
4642
|
+
}
|
|
4643
|
+
const heritageClauses = atLocation.heritageClauses;
|
|
4644
|
+
if (!heritageClauses) {
|
|
4645
|
+
return yield* typeParserIssue("Class has no heritage clauses", void 0, atLocation);
|
|
4646
|
+
}
|
|
4647
|
+
for (const heritageClause of heritageClauses) {
|
|
4648
|
+
for (const typeX of heritageClause.types) {
|
|
4649
|
+
if (ts.isExpressionWithTypeArguments(typeX)) {
|
|
4650
|
+
const expression = typeX.expression;
|
|
4651
|
+
if (ts.isCallExpression(expression)) {
|
|
4652
|
+
const schemaCall = expression.expression;
|
|
4653
|
+
if (ts.isCallExpression(schemaCall) && schemaCall.typeArguments && schemaCall.typeArguments.length > 0) {
|
|
4654
|
+
const isEffectSchemaModelModuleApi = yield* pipe(
|
|
4655
|
+
isNodeReferenceToEffectSchemaModelModuleApi("Class")(schemaCall.expression),
|
|
4656
|
+
orUndefined
|
|
4657
|
+
);
|
|
4658
|
+
if (isEffectSchemaModelModuleApi) {
|
|
4659
|
+
return {
|
|
4660
|
+
className: atLocation.name,
|
|
4661
|
+
selfTypeNode: schemaCall.typeArguments[0]
|
|
4662
|
+
};
|
|
4663
|
+
}
|
|
4664
|
+
}
|
|
4665
|
+
}
|
|
4666
|
+
}
|
|
4667
|
+
}
|
|
4668
|
+
}
|
|
4669
|
+
return yield* typeParserIssue("Class does not extend effect's Model.Class", void 0, atLocation);
|
|
4670
|
+
}),
|
|
4671
|
+
"TypeParser.extendsEffectSchemaModelClass",
|
|
4672
|
+
(atLocation) => atLocation
|
|
4673
|
+
);
|
|
4194
4674
|
const isEffectLayerTypeSourceFile = cachedBy(
|
|
4195
4675
|
fn("TypeParser.isEffectLayerTypeSourceFile")(function* (sourceFile) {
|
|
4196
4676
|
const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
|
|
@@ -4248,7 +4728,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
4248
4728
|
const body = node.body;
|
|
4249
4729
|
const returnType = node.type;
|
|
4250
4730
|
if (ts.isArrowFunction(node) && !ts.isBlock(body)) {
|
|
4251
|
-
return
|
|
4731
|
+
return succeed3({
|
|
4252
4732
|
node,
|
|
4253
4733
|
body,
|
|
4254
4734
|
expression: body,
|
|
@@ -4266,7 +4746,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
4266
4746
|
if (!stmt.expression) {
|
|
4267
4747
|
return typeParserIssue("Return statement must have an expression", void 0, node);
|
|
4268
4748
|
}
|
|
4269
|
-
return
|
|
4749
|
+
return succeed3({
|
|
4270
4750
|
node,
|
|
4271
4751
|
body,
|
|
4272
4752
|
expression: stmt.expression,
|
|
@@ -4291,7 +4771,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
4291
4771
|
if (body.statements.length !== 0) {
|
|
4292
4772
|
return typeParserIssue("Block must have zero statements", void 0, node);
|
|
4293
4773
|
}
|
|
4294
|
-
return
|
|
4774
|
+
return succeed3({
|
|
4295
4775
|
node,
|
|
4296
4776
|
body,
|
|
4297
4777
|
returnType
|
|
@@ -4563,6 +5043,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
4563
5043
|
isNodeReferenceToEffectDataModuleApi,
|
|
4564
5044
|
isNodeReferenceToEffectContextModuleApi,
|
|
4565
5045
|
isNodeReferenceToEffectSqlModelModuleApi,
|
|
5046
|
+
isNodeReferenceToEffectSchemaModelModuleApi,
|
|
4566
5047
|
isNodeReferenceToEffectLayerModuleApi,
|
|
4567
5048
|
isNodeReferenceToEffectSchemaParserModuleApi,
|
|
4568
5049
|
isServiceMapTypeSourceFile,
|
|
@@ -4600,6 +5081,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
4600
5081
|
extendsSchemaTaggedRequest,
|
|
4601
5082
|
extendsSchemaRequestClass,
|
|
4602
5083
|
extendsEffectSqlModelClass,
|
|
5084
|
+
extendsEffectSchemaModelClass,
|
|
4603
5085
|
lazyExpression,
|
|
4604
5086
|
emptyFunction,
|
|
4605
5087
|
pipingFlows,
|
|
@@ -4890,6 +5372,7 @@ var classSelfMismatch = createDiagnostic({
|
|
|
4890
5372
|
)
|
|
4891
5373
|
),
|
|
4892
5374
|
orElse2(() => typeParser.extendsEffectSqlModelClass(node)),
|
|
5375
|
+
orElse2(() => typeParser.extendsEffectSchemaModelClass(node)),
|
|
4893
5376
|
orElse2(() => void_)
|
|
4894
5377
|
);
|
|
4895
5378
|
if (result) {
|
|
@@ -4988,10 +5471,10 @@ var getOrMakeKeyBuilder = fn("getOrMakeKeyBuilder")(function* (sourceFile) {
|
|
|
4988
5471
|
keyBuilderCache.set(sourceFile.fileName, keyBuilder);
|
|
4989
5472
|
return keyBuilder;
|
|
4990
5473
|
});
|
|
4991
|
-
function createString(sourceFile,
|
|
5474
|
+
function createString(sourceFile, identifier2, kind) {
|
|
4992
5475
|
return map4(
|
|
4993
5476
|
getOrMakeKeyBuilder(sourceFile),
|
|
4994
|
-
(identifierBuilder) => identifierBuilder.createString(
|
|
5477
|
+
(identifierBuilder) => identifierBuilder.createString(identifier2, kind)
|
|
4995
5478
|
);
|
|
4996
5479
|
}
|
|
4997
5480
|
|
|
@@ -5043,7 +5526,7 @@ var deterministicKeys = createDiagnostic({
|
|
|
5043
5526
|
const parameterSourceFile = typeScriptUtils.getSourceFileOfNode(declaration);
|
|
5044
5527
|
const paramText = parameterSourceFile.text.substring(declaration.pos, declaration.end);
|
|
5045
5528
|
if (paramText.toLowerCase().includes("@effect-identifier")) {
|
|
5046
|
-
return
|
|
5529
|
+
return succeed3({ className, keyStringLiteral: arg, target: "custom" });
|
|
5047
5530
|
}
|
|
5048
5531
|
}
|
|
5049
5532
|
}
|
|
@@ -5338,7 +5821,7 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
5338
5821
|
const isWithSpan = yield* pipe(
|
|
5339
5822
|
typeParser.isNodeReferenceToEffectModuleApi("withSpan")(callee),
|
|
5340
5823
|
map4(() => true),
|
|
5341
|
-
orElse2(() =>
|
|
5824
|
+
orElse2(() => succeed3(false))
|
|
5342
5825
|
);
|
|
5343
5826
|
if (!isWithSpan) return void 0;
|
|
5344
5827
|
if (expr.arguments.length === 0) return void 0;
|
|
@@ -5351,8 +5834,8 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
5351
5834
|
if (!bodyExpression) return yield* TypeParserIssue.issue;
|
|
5352
5835
|
const { pipeArguments: pipeArguments2, subject } = yield* pipe(
|
|
5353
5836
|
typeParser.pipeCall(bodyExpression),
|
|
5354
|
-
map4(({ args:
|
|
5355
|
-
orElse2(() =>
|
|
5837
|
+
map4(({ args: args3, subject: subject2 }) => ({ subject: subject2, pipeArguments: args3 })),
|
|
5838
|
+
orElse2(() => succeed3({ subject: bodyExpression, pipeArguments: [] }))
|
|
5356
5839
|
);
|
|
5357
5840
|
const { effectModule, generatorFunction } = yield* typeParser.effectGen(subject);
|
|
5358
5841
|
const effectModuleName = ts.isIdentifier(effectModule) ? ts.idText(effectModule) : sourceEffectModuleName;
|
|
@@ -5369,17 +5852,17 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
5369
5852
|
const isInsideEffectFn = (fnNode) => {
|
|
5370
5853
|
const parent = fnNode.parent;
|
|
5371
5854
|
if (!parent || !ts.isCallExpression(parent)) {
|
|
5372
|
-
return
|
|
5855
|
+
return succeed3(false);
|
|
5373
5856
|
}
|
|
5374
5857
|
if (parent.arguments[0] !== fnNode) {
|
|
5375
|
-
return
|
|
5858
|
+
return succeed3(false);
|
|
5376
5859
|
}
|
|
5377
5860
|
return pipe(
|
|
5378
5861
|
typeParser.effectFn(parent),
|
|
5379
5862
|
orElse2(() => typeParser.effectFnGen(parent)),
|
|
5380
5863
|
orElse2(() => typeParser.effectFnUntracedGen(parent)),
|
|
5381
5864
|
map4(() => true),
|
|
5382
|
-
orElse2(() =>
|
|
5865
|
+
orElse2(() => succeed3(false))
|
|
5383
5866
|
);
|
|
5384
5867
|
};
|
|
5385
5868
|
const parseEffectFnOpportunityTargetGen = fn("effectFnOpportunity.parseEffectFnOpportunityTarget")(
|
|
@@ -5399,7 +5882,7 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
5399
5882
|
if (!body || !ts.isBlock(body) || body.statements.length <= 5) {
|
|
5400
5883
|
return TypeParserIssue.issue;
|
|
5401
5884
|
}
|
|
5402
|
-
return
|
|
5885
|
+
return succeed3({
|
|
5403
5886
|
effectModuleName: sourceEffectModuleName,
|
|
5404
5887
|
pipeArguments: [],
|
|
5405
5888
|
generatorFunction: void 0,
|
|
@@ -5598,7 +6081,7 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
5598
6081
|
}).join(", ");
|
|
5599
6082
|
const fnSignature = `function*${typeParamNames}(${paramNames}) { ... }`;
|
|
5600
6083
|
const pipeArgsForWithSpan = pipeArguments2.slice(0, -1);
|
|
5601
|
-
const pipeArgsSuffix = (
|
|
6084
|
+
const pipeArgsSuffix = (args3) => args3.length > 0 ? ", ...pipeTransformations" : "";
|
|
5602
6085
|
switch (firstFix.fixName) {
|
|
5603
6086
|
case "effectFnOpportunity_toEffectFnWithSpan": {
|
|
5604
6087
|
const traceName = explicitTraceExpression ? sourceFile.text.slice(explicitTraceExpression.pos, explicitTraceExpression.end).trim() : void 0;
|
|
@@ -5744,7 +6227,7 @@ var effectMapVoid = createDiagnostic({
|
|
|
5744
6227
|
() => pipe(
|
|
5745
6228
|
typeParser.lazyExpression(callback),
|
|
5746
6229
|
flatMap2(
|
|
5747
|
-
(lazy) => tsUtils.isVoidExpression(lazy.expression) ?
|
|
6230
|
+
(lazy) => tsUtils.isVoidExpression(lazy.expression) ? succeed3(lazy) : typeParserIssue("Expression is not void")
|
|
5748
6231
|
)
|
|
5749
6232
|
)
|
|
5750
6233
|
),
|
|
@@ -6405,11 +6888,11 @@ var leakingRequirements = createDiagnostic({
|
|
|
6405
6888
|
memory,
|
|
6406
6889
|
effectContextType,
|
|
6407
6890
|
(type) => {
|
|
6408
|
-
if (type.flags & ts.TypeFlags.Never) return
|
|
6891
|
+
if (type.flags & ts.TypeFlags.Never) return succeed3(true);
|
|
6409
6892
|
return pipe(
|
|
6410
6893
|
typeParser.scopeType(type, atLocation),
|
|
6411
6894
|
map4(() => true),
|
|
6412
|
-
orElse2(() =>
|
|
6895
|
+
orElse2(() => succeed3(false))
|
|
6413
6896
|
);
|
|
6414
6897
|
}
|
|
6415
6898
|
);
|
|
@@ -6824,7 +7307,7 @@ var missingEffectError = createDiagnostic({
|
|
|
6824
7307
|
map3((_) => _.literal),
|
|
6825
7308
|
filter((_) => ts.isLiteralExpression(_)),
|
|
6826
7309
|
map3((_) => _.text),
|
|
6827
|
-
sort(
|
|
7310
|
+
sort(String2),
|
|
6828
7311
|
map3(
|
|
6829
7312
|
(_) => ts.factory.createPropertyAssignment(
|
|
6830
7313
|
ts.factory.createIdentifier(_),
|
|
@@ -6917,7 +7400,7 @@ var missingEffectServiceDependency = createDiagnostic({
|
|
|
6917
7400
|
);
|
|
6918
7401
|
if (layerResult) {
|
|
6919
7402
|
const servicesMemory = /* @__PURE__ */ new Map();
|
|
6920
|
-
const excludeNever = (type) =>
|
|
7403
|
+
const excludeNever = (type) => succeed3((type.flags & ts.TypeFlags.Never) !== 0);
|
|
6921
7404
|
const { allIndexes: requiredIndexes } = yield* typeCheckerUtils.appendToUniqueTypesMap(
|
|
6922
7405
|
servicesMemory,
|
|
6923
7406
|
layerResult.RIn,
|
|
@@ -7348,6 +7831,765 @@ var nonObjectEffectServiceType = createDiagnostic({
|
|
|
7348
7831
|
})
|
|
7349
7832
|
});
|
|
7350
7833
|
|
|
7834
|
+
// src/diagnostics/outdatedApi.db.ts
|
|
7835
|
+
var asUnchanged = {
|
|
7836
|
+
_tag: "Unchanged"
|
|
7837
|
+
};
|
|
7838
|
+
var asRenamedSameBehaviour = (newName) => ({
|
|
7839
|
+
_tag: "RenamedSameBehaviour",
|
|
7840
|
+
newName
|
|
7841
|
+
});
|
|
7842
|
+
var asRenamedAndNeedsOptions = (newName, optionsInstructions) => ({
|
|
7843
|
+
_tag: "RenamedAndNeedsOptions",
|
|
7844
|
+
newName,
|
|
7845
|
+
optionsInstructions
|
|
7846
|
+
});
|
|
7847
|
+
var asRemoved = (alternativePattern) => ({
|
|
7848
|
+
_tag: "Removed",
|
|
7849
|
+
alternativePattern
|
|
7850
|
+
});
|
|
7851
|
+
var effectModuleMigrationDb = {
|
|
7852
|
+
// Common APIs (in both v3 and v4, unchanged)
|
|
7853
|
+
"acquireRelease": asUnchanged,
|
|
7854
|
+
"acquireUseRelease": asUnchanged,
|
|
7855
|
+
"addFinalizer": asUnchanged,
|
|
7856
|
+
"all": asUnchanged,
|
|
7857
|
+
"andThen": asUnchanged,
|
|
7858
|
+
"annotateCurrentSpan": asUnchanged,
|
|
7859
|
+
"annotateLogs": asUnchanged,
|
|
7860
|
+
"annotateSpans": asUnchanged,
|
|
7861
|
+
"as": asUnchanged,
|
|
7862
|
+
"asSome": asUnchanged,
|
|
7863
|
+
"asVoid": asUnchanged,
|
|
7864
|
+
"cached": asUnchanged,
|
|
7865
|
+
"cachedInvalidateWithTTL": asUnchanged,
|
|
7866
|
+
"cachedWithTTL": asUnchanged,
|
|
7867
|
+
"catch": asUnchanged,
|
|
7868
|
+
"catchIf": asUnchanged,
|
|
7869
|
+
"catchTag": asUnchanged,
|
|
7870
|
+
"catchTags": asUnchanged,
|
|
7871
|
+
"clockWith": asUnchanged,
|
|
7872
|
+
"currentParentSpan": asUnchanged,
|
|
7873
|
+
"currentSpan": asUnchanged,
|
|
7874
|
+
"delay": asUnchanged,
|
|
7875
|
+
"die": asUnchanged,
|
|
7876
|
+
"ensuring": asUnchanged,
|
|
7877
|
+
"eventually": asUnchanged,
|
|
7878
|
+
"exit": asUnchanged,
|
|
7879
|
+
"fail": asUnchanged,
|
|
7880
|
+
"failCause": asUnchanged,
|
|
7881
|
+
"failCauseSync": asUnchanged,
|
|
7882
|
+
"failSync": asUnchanged,
|
|
7883
|
+
"fiberId": asUnchanged,
|
|
7884
|
+
"filter": asUnchanged,
|
|
7885
|
+
"filterMap": asRemoved(
|
|
7886
|
+
"Use Effect.filter or Effect.map with Option instead."
|
|
7887
|
+
),
|
|
7888
|
+
"filterOrElse": asUnchanged,
|
|
7889
|
+
"filterOrFail": asUnchanged,
|
|
7890
|
+
"flatMap": asUnchanged,
|
|
7891
|
+
"flatten": asUnchanged,
|
|
7892
|
+
"flip": asUnchanged,
|
|
7893
|
+
"fn": asUnchanged,
|
|
7894
|
+
"fnUntraced": asUnchanged,
|
|
7895
|
+
"forEach": asUnchanged,
|
|
7896
|
+
"forever": asUnchanged,
|
|
7897
|
+
"forkIn": asUnchanged,
|
|
7898
|
+
"forkScoped": asUnchanged,
|
|
7899
|
+
"gen": asUnchanged,
|
|
7900
|
+
"ignore": asUnchanged,
|
|
7901
|
+
"interrupt": asUnchanged,
|
|
7902
|
+
"interruptible": asUnchanged,
|
|
7903
|
+
"interruptibleMask": asUnchanged,
|
|
7904
|
+
"isEffect": asUnchanged,
|
|
7905
|
+
"isFailure": asUnchanged,
|
|
7906
|
+
"isSuccess": asUnchanged,
|
|
7907
|
+
"linkSpans": asUnchanged,
|
|
7908
|
+
"log": asUnchanged,
|
|
7909
|
+
"logDebug": asUnchanged,
|
|
7910
|
+
"logError": asUnchanged,
|
|
7911
|
+
"logFatal": asUnchanged,
|
|
7912
|
+
"logInfo": asUnchanged,
|
|
7913
|
+
"logTrace": asUnchanged,
|
|
7914
|
+
"logWarning": asUnchanged,
|
|
7915
|
+
"logWithLevel": asUnchanged,
|
|
7916
|
+
"makeLatch": asRemoved(
|
|
7917
|
+
"Use Latch.make instead of Effect.makeLatch."
|
|
7918
|
+
),
|
|
7919
|
+
"makeSemaphore": asRemoved(
|
|
7920
|
+
"Use Semaphore.make instead of Effect.makeSemaphore."
|
|
7921
|
+
),
|
|
7922
|
+
"makeSpan": asUnchanged,
|
|
7923
|
+
"makeSpanScoped": asUnchanged,
|
|
7924
|
+
"map": asUnchanged,
|
|
7925
|
+
"mapBoth": asUnchanged,
|
|
7926
|
+
"mapError": asUnchanged,
|
|
7927
|
+
"match": asUnchanged,
|
|
7928
|
+
"matchCause": asUnchanged,
|
|
7929
|
+
"matchCauseEffect": asUnchanged,
|
|
7930
|
+
"matchEffect": asUnchanged,
|
|
7931
|
+
"never": asUnchanged,
|
|
7932
|
+
"onError": asUnchanged,
|
|
7933
|
+
"onExit": asUnchanged,
|
|
7934
|
+
"onInterrupt": asUnchanged,
|
|
7935
|
+
"option": asUnchanged,
|
|
7936
|
+
"orDie": asUnchanged,
|
|
7937
|
+
"orElseSucceed": asUnchanged,
|
|
7938
|
+
"promise": asUnchanged,
|
|
7939
|
+
"provide": asUnchanged,
|
|
7940
|
+
"provideService": asUnchanged,
|
|
7941
|
+
"provideServiceEffect": asUnchanged,
|
|
7942
|
+
"race": asUnchanged,
|
|
7943
|
+
"raceAll": asUnchanged,
|
|
7944
|
+
"raceFirst": asUnchanged,
|
|
7945
|
+
"repeat": asUnchanged,
|
|
7946
|
+
"repeatOrElse": asUnchanged,
|
|
7947
|
+
"replicate": asUnchanged,
|
|
7948
|
+
"replicateEffect": asUnchanged,
|
|
7949
|
+
"request": asUnchanged,
|
|
7950
|
+
"retry": asUnchanged,
|
|
7951
|
+
"retryOrElse": asUnchanged,
|
|
7952
|
+
"runCallback": asUnchanged,
|
|
7953
|
+
"runFork": asUnchanged,
|
|
7954
|
+
"runPromise": asUnchanged,
|
|
7955
|
+
"runPromiseExit": asUnchanged,
|
|
7956
|
+
"runSync": asUnchanged,
|
|
7957
|
+
"runSyncExit": asUnchanged,
|
|
7958
|
+
"sandbox": asUnchanged,
|
|
7959
|
+
"schedule": asUnchanged,
|
|
7960
|
+
"scheduleFrom": asUnchanged,
|
|
7961
|
+
"scope": asUnchanged,
|
|
7962
|
+
"scoped": asUnchanged,
|
|
7963
|
+
"scopedWith": asUnchanged,
|
|
7964
|
+
"serviceOption": asUnchanged,
|
|
7965
|
+
"sleep": asUnchanged,
|
|
7966
|
+
"spanAnnotations": asUnchanged,
|
|
7967
|
+
"spanLinks": asUnchanged,
|
|
7968
|
+
"succeed": asUnchanged,
|
|
7969
|
+
"succeedNone": asUnchanged,
|
|
7970
|
+
"succeedSome": asUnchanged,
|
|
7971
|
+
"suspend": asUnchanged,
|
|
7972
|
+
"sync": asUnchanged,
|
|
7973
|
+
"tap": asUnchanged,
|
|
7974
|
+
"tapDefect": asUnchanged,
|
|
7975
|
+
"tapError": asUnchanged,
|
|
7976
|
+
"tapErrorTag": asUnchanged,
|
|
7977
|
+
"timed": asUnchanged,
|
|
7978
|
+
"timeout": asUnchanged,
|
|
7979
|
+
"timeoutOption": asUnchanged,
|
|
7980
|
+
"tracer": asUnchanged,
|
|
7981
|
+
"try": asUnchanged,
|
|
7982
|
+
"tryPromise": asUnchanged,
|
|
7983
|
+
"uninterruptible": asUnchanged,
|
|
7984
|
+
"uninterruptibleMask": asUnchanged,
|
|
7985
|
+
"updateService": asUnchanged,
|
|
7986
|
+
"useSpan": asUnchanged,
|
|
7987
|
+
"void": asUnchanged,
|
|
7988
|
+
"when": asUnchanged,
|
|
7989
|
+
"whileLoop": asUnchanged,
|
|
7990
|
+
"withConcurrency": asUnchanged,
|
|
7991
|
+
"withExecutionPlan": asUnchanged,
|
|
7992
|
+
"withLogSpan": asUnchanged,
|
|
7993
|
+
"withParentSpan": asUnchanged,
|
|
7994
|
+
"withSpan": asUnchanged,
|
|
7995
|
+
"withSpanScoped": asUnchanged,
|
|
7996
|
+
"withTracer": asUnchanged,
|
|
7997
|
+
"withTracerEnabled": asUnchanged,
|
|
7998
|
+
"withTracerTiming": asUnchanged,
|
|
7999
|
+
"yieldNow": asUnchanged,
|
|
8000
|
+
"zip": asUnchanged,
|
|
8001
|
+
"zipWith": asUnchanged,
|
|
8002
|
+
// Renamed APIs (v3 name → v4 name)
|
|
8003
|
+
"catchAll": asRenamedSameBehaviour("catch"),
|
|
8004
|
+
"catchAllCause": asRenamedSameBehaviour("catchCause"),
|
|
8005
|
+
"catchAllDefect": asRenamedSameBehaviour("catchDefect"),
|
|
8006
|
+
"catchSome": asRemoved(
|
|
8007
|
+
"Use Effect.catchIf instead. Note: the API shape changed from returning Option<Effect> to taking a predicate and handler separately."
|
|
8008
|
+
),
|
|
8009
|
+
"catchSomeCause": asRemoved(
|
|
8010
|
+
"Use Effect.catchCauseIf instead. Note: the API shape changed from returning Option<Effect> to taking a predicate and handler separately."
|
|
8011
|
+
),
|
|
8012
|
+
"ensureErrorType": asRenamedSameBehaviour("satisfiesErrorType"),
|
|
8013
|
+
"ensureRequirementsType": asRenamedSameBehaviour("satisfiesServicesType"),
|
|
8014
|
+
"ensureSuccessType": asRenamedSameBehaviour("satisfiesSuccessType"),
|
|
8015
|
+
"fork": asRenamedSameBehaviour("forkChild"),
|
|
8016
|
+
"forkDaemon": asRenamedSameBehaviour("forkDetach"),
|
|
8017
|
+
"scopeWith": asRenamedSameBehaviour("scopedWith"),
|
|
8018
|
+
"serviceOptional": asRenamedSameBehaviour("serviceOption"),
|
|
8019
|
+
"tapErrorCause": asRenamedSameBehaviour("tapCause"),
|
|
8020
|
+
// Removed APIs
|
|
8021
|
+
"annotateLogsScoped": asUnchanged,
|
|
8022
|
+
"awaitAllChildren": asUnchanged,
|
|
8023
|
+
"bind": asUnchanged,
|
|
8024
|
+
"bindTo": asUnchanged,
|
|
8025
|
+
"Do": asUnchanged,
|
|
8026
|
+
"let": asUnchanged,
|
|
8027
|
+
"partition": asUnchanged,
|
|
8028
|
+
"validate": asUnchanged,
|
|
8029
|
+
"catchSomeDefect": asRemoved(
|
|
8030
|
+
"Use Effect.catchDefect or Effect.matchCause to handle specific defects."
|
|
8031
|
+
),
|
|
8032
|
+
"forkAll": asRemoved(
|
|
8033
|
+
"Fork effects individually with Effect.forEach and Effect.forkChild, or use Effect.all with concurrency options."
|
|
8034
|
+
),
|
|
8035
|
+
"forkWithErrorHandler": asRemoved(
|
|
8036
|
+
"Fork the effect with Effect.forkChild and observe the fiber result via Fiber.join or Fiber.await."
|
|
8037
|
+
),
|
|
8038
|
+
"Tag": asRemoved(
|
|
8039
|
+
"Use ServiceMap.Service instead of Effect.Tag."
|
|
8040
|
+
),
|
|
8041
|
+
"Service": asRemoved(
|
|
8042
|
+
"Use ServiceMap.Service instead of Effect.Service."
|
|
8043
|
+
),
|
|
8044
|
+
"runtime": asRemoved(
|
|
8045
|
+
"Runtime has been removed in Effect v4. Use Effect.services to grab services and then run using Effect.runPromiseWith."
|
|
8046
|
+
),
|
|
8047
|
+
"bindAll": asRemoved(
|
|
8048
|
+
"Use Effect.gen instead of Effect.bindAll."
|
|
8049
|
+
),
|
|
8050
|
+
"EffectTypeId": asRemoved(
|
|
8051
|
+
"EffectTypeId has been removed in Effect v4."
|
|
8052
|
+
),
|
|
8053
|
+
"acquireReleaseInterruptible": asRemoved(
|
|
8054
|
+
"Use Effect.acquireRelease instead."
|
|
8055
|
+
),
|
|
8056
|
+
"allSuccesses": asRemoved(
|
|
8057
|
+
"Use Effect.all with the { mode: 'either' } option and filter successes."
|
|
8058
|
+
),
|
|
8059
|
+
"allWith": asRemoved(
|
|
8060
|
+
"Use Effect.all with options instead."
|
|
8061
|
+
),
|
|
8062
|
+
"allowInterrupt": asRemoved(
|
|
8063
|
+
"Use Effect.yieldNow instead."
|
|
8064
|
+
),
|
|
8065
|
+
"ap": asRemoved(
|
|
8066
|
+
"Use Effect.map and Effect.flatMap to apply functions instead."
|
|
8067
|
+
),
|
|
8068
|
+
"asSomeError": asRemoved(
|
|
8069
|
+
"Use Effect.mapError(Option.some) instead."
|
|
8070
|
+
),
|
|
8071
|
+
"async": asRenamedAndNeedsOptions("callback", "Note: in v4 the callback receives a Scheduler as 'this' context."),
|
|
8072
|
+
"asyncEffect": asRemoved(
|
|
8073
|
+
"Use Effect.suspend combined with Effect.promise instead."
|
|
8074
|
+
),
|
|
8075
|
+
"blocked": asRemoved(
|
|
8076
|
+
"The request batching API has been reworked in Effect v4."
|
|
8077
|
+
),
|
|
8078
|
+
"cacheRequestResult": asRemoved(
|
|
8079
|
+
"The request batching API has been reworked in Effect v4."
|
|
8080
|
+
),
|
|
8081
|
+
"cachedFunction": asRemoved(
|
|
8082
|
+
"Use Effect.cached or implement caching with a Ref instead."
|
|
8083
|
+
),
|
|
8084
|
+
"cause": asRemoved(
|
|
8085
|
+
"Use Effect.matchCause or Effect.sandbox to access the cause."
|
|
8086
|
+
),
|
|
8087
|
+
"checkInterruptible": asRemoved(
|
|
8088
|
+
"Interruption checking has been removed in Effect v4."
|
|
8089
|
+
),
|
|
8090
|
+
"clock": asRemoved(
|
|
8091
|
+
"Use Effect.clockWith instead."
|
|
8092
|
+
),
|
|
8093
|
+
"configProviderWith": asRemoved(
|
|
8094
|
+
"ConfigProvider access has been reworked in Effect v4."
|
|
8095
|
+
),
|
|
8096
|
+
"console": asRemoved(
|
|
8097
|
+
"Use Effect.consoleWith or the Console service directly."
|
|
8098
|
+
),
|
|
8099
|
+
"consoleWith": asRemoved(
|
|
8100
|
+
"Console access has been reworked in Effect v4."
|
|
8101
|
+
),
|
|
8102
|
+
"context": asRemoved(
|
|
8103
|
+
"Use Effect.context is removed. Access services directly via yield* or Effect.provideService."
|
|
8104
|
+
),
|
|
8105
|
+
"contextWith": asRemoved(
|
|
8106
|
+
"Use Effect.map with service access instead."
|
|
8107
|
+
),
|
|
8108
|
+
"contextWithEffect": asRemoved(
|
|
8109
|
+
"Use Effect.flatMap with service access instead."
|
|
8110
|
+
),
|
|
8111
|
+
"custom": asRemoved(
|
|
8112
|
+
"Use Effect.suspend or Effect.sync to create custom effects."
|
|
8113
|
+
),
|
|
8114
|
+
"daemonChildren": asRemoved(
|
|
8115
|
+
"Use Effect.forkDetach to fork detached fibers instead."
|
|
8116
|
+
),
|
|
8117
|
+
"descriptor": asRemoved(
|
|
8118
|
+
"Fiber descriptor access has been removed in Effect v4."
|
|
8119
|
+
),
|
|
8120
|
+
"descriptorWith": asRemoved(
|
|
8121
|
+
"Fiber descriptor access has been removed in Effect v4."
|
|
8122
|
+
),
|
|
8123
|
+
"dieMessage": asRemoved(
|
|
8124
|
+
"Use Effect.die(new Error(message)) instead."
|
|
8125
|
+
),
|
|
8126
|
+
"dieSync": asRemoved(
|
|
8127
|
+
"Use Effect.die with a lazily evaluated value instead."
|
|
8128
|
+
),
|
|
8129
|
+
"diffFiberRefs": asRemoved(
|
|
8130
|
+
"FiberRef has been replaced by ServiceMap.Reference in Effect v4."
|
|
8131
|
+
),
|
|
8132
|
+
"disconnect": asRemoved(
|
|
8133
|
+
"Fiber disconnect has been removed in Effect v4."
|
|
8134
|
+
),
|
|
8135
|
+
"dropUntil": asRemoved(
|
|
8136
|
+
"Use Array.dropUntil and Effect.forEach instead."
|
|
8137
|
+
),
|
|
8138
|
+
"dropWhile": asRemoved(
|
|
8139
|
+
"Use Array.dropWhile and Effect.forEach instead."
|
|
8140
|
+
),
|
|
8141
|
+
"either": asRenamedAndNeedsOptions(
|
|
8142
|
+
"result",
|
|
8143
|
+
"Note: returns Result.Result<A, E> instead of Either<E, A>. Use the Result module to work with the result."
|
|
8144
|
+
),
|
|
8145
|
+
"ensuringChild": asRemoved(
|
|
8146
|
+
"Use Effect.onExit to manage child fiber cleanup instead."
|
|
8147
|
+
),
|
|
8148
|
+
"ensuringChildren": asRemoved(
|
|
8149
|
+
"Use Effect.onExit to manage child fiber cleanup instead."
|
|
8150
|
+
),
|
|
8151
|
+
"every": asRemoved(
|
|
8152
|
+
"Use Effect.forEach with a predicate check instead."
|
|
8153
|
+
),
|
|
8154
|
+
"exists": asRemoved(
|
|
8155
|
+
"Use Effect.forEach with a predicate check instead."
|
|
8156
|
+
),
|
|
8157
|
+
"fiberIdWith": asRemoved(
|
|
8158
|
+
"Use Effect.fiberId instead."
|
|
8159
|
+
),
|
|
8160
|
+
"filterEffectOrElse": asRemoved(
|
|
8161
|
+
"Use Effect.filterOrElse with an effectful predicate instead."
|
|
8162
|
+
),
|
|
8163
|
+
"filterEffectOrFail": asRemoved(
|
|
8164
|
+
"Use Effect.filterOrFail with an effectful predicate instead."
|
|
8165
|
+
),
|
|
8166
|
+
"filterOrDie": asRemoved(
|
|
8167
|
+
"Use Effect.filterOrFail and Effect.orDie instead."
|
|
8168
|
+
),
|
|
8169
|
+
"filterOrDieMessage": asRemoved(
|
|
8170
|
+
"Use Effect.filterOrFail and Effect.orDie instead."
|
|
8171
|
+
),
|
|
8172
|
+
"finalizersMask": asRemoved(
|
|
8173
|
+
"Finalizer masking has been removed in Effect v4."
|
|
8174
|
+
),
|
|
8175
|
+
"findFirst": asRemoved(
|
|
8176
|
+
"Use Effect.forEach with early return instead."
|
|
8177
|
+
),
|
|
8178
|
+
"firstSuccessOf": asRemoved(
|
|
8179
|
+
"Use Effect.raceAll instead."
|
|
8180
|
+
),
|
|
8181
|
+
"flipWith": asRemoved(
|
|
8182
|
+
"Use Effect.flip combined with the desired transformation instead."
|
|
8183
|
+
),
|
|
8184
|
+
"fromFiber": asRemoved(
|
|
8185
|
+
"Use Fiber.join instead."
|
|
8186
|
+
),
|
|
8187
|
+
"fromFiberEffect": asRemoved(
|
|
8188
|
+
"Use Effect.flatMap with Fiber.join instead."
|
|
8189
|
+
),
|
|
8190
|
+
"fromNullable": asRemoved(
|
|
8191
|
+
"Use Effect.suspend with null checks instead."
|
|
8192
|
+
),
|
|
8193
|
+
"functionWithSpan": asRemoved(
|
|
8194
|
+
"Use Effect.withSpan instead."
|
|
8195
|
+
),
|
|
8196
|
+
"getFiberRefs": asRemoved(
|
|
8197
|
+
"FiberRef has been replaced by ServiceMap.Reference in Effect v4."
|
|
8198
|
+
),
|
|
8199
|
+
"getRuntimeFlags": asRemoved(
|
|
8200
|
+
"Runtime flags have been removed in Effect v4."
|
|
8201
|
+
),
|
|
8202
|
+
"head": asRemoved(
|
|
8203
|
+
"Use Array.head and Effect.flatMap instead."
|
|
8204
|
+
),
|
|
8205
|
+
"if": asRemoved(
|
|
8206
|
+
"Use Effect.when instead of Effect.if."
|
|
8207
|
+
),
|
|
8208
|
+
"ignoreLogged": asRemoved(
|
|
8209
|
+
"Logging configuration has been reworked in Effect v4."
|
|
8210
|
+
),
|
|
8211
|
+
"inheritFiberRefs": asRemoved(
|
|
8212
|
+
"FiberRef has been replaced by ServiceMap.Reference in Effect v4."
|
|
8213
|
+
),
|
|
8214
|
+
"interruptWith": asRemoved(
|
|
8215
|
+
"Use Effect.interrupt instead."
|
|
8216
|
+
),
|
|
8217
|
+
"intoDeferred": asRemoved(
|
|
8218
|
+
"Use Deferred.complete instead."
|
|
8219
|
+
),
|
|
8220
|
+
"iterate": asRemoved(
|
|
8221
|
+
"Use Effect.whileLoop or recursion with Effect.suspend instead."
|
|
8222
|
+
),
|
|
8223
|
+
"labelMetrics": asRemoved(
|
|
8224
|
+
"Metric labeling has been reworked in Effect v4."
|
|
8225
|
+
),
|
|
8226
|
+
"labelMetricsScoped": asRemoved(
|
|
8227
|
+
"Metric labeling has been reworked in Effect v4."
|
|
8228
|
+
),
|
|
8229
|
+
"liftPredicate": asRemoved(
|
|
8230
|
+
"Use Effect.filterOrFail instead."
|
|
8231
|
+
),
|
|
8232
|
+
"linkSpanCurrent": asRemoved(
|
|
8233
|
+
"Use Effect.linkSpans instead."
|
|
8234
|
+
),
|
|
8235
|
+
"locally": asRemoved(
|
|
8236
|
+
"FiberRef.locally has been removed. Use Effect.provideService with ServiceMap.Reference instead."
|
|
8237
|
+
),
|
|
8238
|
+
"locallyScoped": asRemoved(
|
|
8239
|
+
"FiberRef.locally has been removed. Use Effect.provideService with ServiceMap.Reference instead."
|
|
8240
|
+
),
|
|
8241
|
+
"locallyScopedWith": asRemoved(
|
|
8242
|
+
"FiberRef.locally has been removed. Use Effect.provideService with ServiceMap.Reference instead."
|
|
8243
|
+
),
|
|
8244
|
+
"locallyWith": asRemoved(
|
|
8245
|
+
"FiberRef.locally has been removed. Use Effect.provideService with ServiceMap.Reference instead."
|
|
8246
|
+
),
|
|
8247
|
+
"logAnnotations": asRemoved(
|
|
8248
|
+
"Use Effect.annotateLogs instead."
|
|
8249
|
+
),
|
|
8250
|
+
"loop": asRemoved(
|
|
8251
|
+
"Use Effect.whileLoop or recursion with Effect.suspend instead."
|
|
8252
|
+
),
|
|
8253
|
+
"mapAccum": asRemoved(
|
|
8254
|
+
"Use Effect.gen with a mutable accumulator instead."
|
|
8255
|
+
),
|
|
8256
|
+
"mapErrorCause": asRemoved(
|
|
8257
|
+
"Use Effect.sandbox and Effect.mapError instead."
|
|
8258
|
+
),
|
|
8259
|
+
"mapInputContext": asRemoved(
|
|
8260
|
+
"Use Effect.provide with a layer instead."
|
|
8261
|
+
),
|
|
8262
|
+
"merge": asRemoved(
|
|
8263
|
+
"Use Effect.match or Effect.exit instead."
|
|
8264
|
+
),
|
|
8265
|
+
"mergeAll": asRemoved(
|
|
8266
|
+
"Use Effect.forEach with a mutable accumulator instead."
|
|
8267
|
+
),
|
|
8268
|
+
"metricLabels": asRemoved(
|
|
8269
|
+
"Metric labeling has been reworked in Effect v4."
|
|
8270
|
+
),
|
|
8271
|
+
"negate": asRemoved(
|
|
8272
|
+
"Use Effect.map with boolean negation instead."
|
|
8273
|
+
),
|
|
8274
|
+
"none": asRemoved(
|
|
8275
|
+
"Use Effect.filterOrFail or Effect.option instead."
|
|
8276
|
+
),
|
|
8277
|
+
"once": asRemoved(
|
|
8278
|
+
"Use Effect.cached instead."
|
|
8279
|
+
),
|
|
8280
|
+
"optionFromOptional": asRemoved(
|
|
8281
|
+
"Use Effect.option instead."
|
|
8282
|
+
),
|
|
8283
|
+
"orDieWith": asRemoved(
|
|
8284
|
+
"Use Effect.orDie or Effect.mapError combined with Effect.orDie instead."
|
|
8285
|
+
),
|
|
8286
|
+
"orElse": asRemoved(
|
|
8287
|
+
"Use Effect.catch or Effect.matchEffect instead."
|
|
8288
|
+
),
|
|
8289
|
+
"orElseFail": asRemoved(
|
|
8290
|
+
"Use Effect.mapError instead."
|
|
8291
|
+
),
|
|
8292
|
+
"parallelErrors": asRemoved(
|
|
8293
|
+
"Use Effect.all with concurrency options instead."
|
|
8294
|
+
),
|
|
8295
|
+
"parallelFinalizers": asRemoved(
|
|
8296
|
+
"Finalizer ordering configuration has been removed in Effect v4."
|
|
8297
|
+
),
|
|
8298
|
+
"patchFiberRefs": asRemoved(
|
|
8299
|
+
"FiberRef has been replaced by ServiceMap.Reference in Effect v4."
|
|
8300
|
+
),
|
|
8301
|
+
"patchRuntimeFlags": asRemoved(
|
|
8302
|
+
"Runtime flags have been removed in Effect v4."
|
|
8303
|
+
),
|
|
8304
|
+
"raceWith": asRemoved(
|
|
8305
|
+
"Use Effect.race or Effect.raceFirst instead."
|
|
8306
|
+
),
|
|
8307
|
+
"random": asRemoved(
|
|
8308
|
+
"Use Effect.randomWith instead."
|
|
8309
|
+
),
|
|
8310
|
+
"randomWith": asRemoved(
|
|
8311
|
+
"Random access has been reworked in Effect v4."
|
|
8312
|
+
),
|
|
8313
|
+
"reduce": asRemoved(
|
|
8314
|
+
"Use Effect.forEach with a mutable accumulator or Effect.gen instead."
|
|
8315
|
+
),
|
|
8316
|
+
"reduceEffect": asRemoved(
|
|
8317
|
+
"Use Effect.forEach with a mutable accumulator or Effect.gen instead."
|
|
8318
|
+
),
|
|
8319
|
+
"reduceRight": asRemoved(
|
|
8320
|
+
"Use Effect.forEach with a mutable accumulator or Effect.gen instead."
|
|
8321
|
+
),
|
|
8322
|
+
"reduceWhile": asRemoved(
|
|
8323
|
+
"Use Effect.gen with early return instead."
|
|
8324
|
+
),
|
|
8325
|
+
"repeatN": asRemoved(
|
|
8326
|
+
"Use Effect.repeat with a schedule instead."
|
|
8327
|
+
),
|
|
8328
|
+
"runRequestBlock": asRemoved(
|
|
8329
|
+
"The request batching API has been reworked in Effect v4."
|
|
8330
|
+
),
|
|
8331
|
+
"scheduleForked": asRemoved(
|
|
8332
|
+
"Use Effect.schedule combined with Effect.forkChild instead."
|
|
8333
|
+
),
|
|
8334
|
+
"sequentialFinalizers": asRemoved(
|
|
8335
|
+
"Finalizer ordering configuration has been removed in Effect v4."
|
|
8336
|
+
),
|
|
8337
|
+
"serviceConstants": asRemoved(
|
|
8338
|
+
"Service helpers have been removed. Use ServiceMap.Service and yield* to access services."
|
|
8339
|
+
),
|
|
8340
|
+
"serviceFunction": asRemoved(
|
|
8341
|
+
"Service helpers have been removed. Use ServiceMap.Service and yield* to access services."
|
|
8342
|
+
),
|
|
8343
|
+
"serviceFunctionEffect": asRemoved(
|
|
8344
|
+
"Service helpers have been removed. Use ServiceMap.Service and yield* to access services."
|
|
8345
|
+
),
|
|
8346
|
+
"serviceFunctions": asRemoved(
|
|
8347
|
+
"Service helpers have been removed. Use ServiceMap.Service and yield* to access services."
|
|
8348
|
+
),
|
|
8349
|
+
"serviceMembers": asRemoved(
|
|
8350
|
+
"Service helpers have been removed. Use ServiceMap.Service and yield* to access services."
|
|
8351
|
+
),
|
|
8352
|
+
"setFiberRefs": asRemoved(
|
|
8353
|
+
"FiberRef has been replaced by ServiceMap.Reference in Effect v4."
|
|
8354
|
+
),
|
|
8355
|
+
"step": asRemoved(
|
|
8356
|
+
"The request batching API has been reworked in Effect v4."
|
|
8357
|
+
),
|
|
8358
|
+
"summarized": asRemoved(
|
|
8359
|
+
"Use Effect.gen to capture before/after state instead."
|
|
8360
|
+
),
|
|
8361
|
+
"supervised": asRemoved(
|
|
8362
|
+
"Supervision has been reworked in Effect v4."
|
|
8363
|
+
),
|
|
8364
|
+
"tagMetrics": asRemoved(
|
|
8365
|
+
"Metric labeling has been reworked in Effect v4."
|
|
8366
|
+
),
|
|
8367
|
+
"tagMetricsScoped": asRemoved(
|
|
8368
|
+
"Metric labeling has been reworked in Effect v4."
|
|
8369
|
+
),
|
|
8370
|
+
"takeUntil": asRemoved(
|
|
8371
|
+
"Use Array.takeUntil and Effect.forEach instead."
|
|
8372
|
+
),
|
|
8373
|
+
"takeWhile": asRemoved(
|
|
8374
|
+
"Use Array.takeWhile and Effect.forEach instead."
|
|
8375
|
+
),
|
|
8376
|
+
"tapBoth": asRemoved(
|
|
8377
|
+
"Use Effect.tap and Effect.tapError instead."
|
|
8378
|
+
),
|
|
8379
|
+
"timedWith": asRemoved(
|
|
8380
|
+
"Use Effect.timed instead."
|
|
8381
|
+
),
|
|
8382
|
+
"timeoutFail": asRemoved(
|
|
8383
|
+
"Use Effect.timeout combined with Effect.catchTag for TimeoutException instead."
|
|
8384
|
+
),
|
|
8385
|
+
"timeoutFailCause": asRemoved(
|
|
8386
|
+
"Use Effect.timeout combined with Effect.sandbox instead."
|
|
8387
|
+
),
|
|
8388
|
+
"timeoutTo": asRemoved(
|
|
8389
|
+
"Use Effect.timeoutOption and Effect.map instead."
|
|
8390
|
+
),
|
|
8391
|
+
"tracerWith": asRemoved(
|
|
8392
|
+
"Use Effect.tracer instead."
|
|
8393
|
+
),
|
|
8394
|
+
"transplant": asRemoved(
|
|
8395
|
+
"Fiber transplanting has been removed in Effect v4."
|
|
8396
|
+
),
|
|
8397
|
+
"transposeMapOption": asRemoved(
|
|
8398
|
+
"Use Effect.map with Option operations instead."
|
|
8399
|
+
),
|
|
8400
|
+
"transposeOption": asRemoved(
|
|
8401
|
+
"Use Effect.option instead."
|
|
8402
|
+
),
|
|
8403
|
+
"tryMap": asRemoved(
|
|
8404
|
+
"Use Effect.map inside Effect.try instead."
|
|
8405
|
+
),
|
|
8406
|
+
"tryMapPromise": asRemoved(
|
|
8407
|
+
"Use Effect.tryPromise instead."
|
|
8408
|
+
),
|
|
8409
|
+
"unless": asRemoved(
|
|
8410
|
+
"Use Effect.when with a negated condition instead."
|
|
8411
|
+
),
|
|
8412
|
+
"unlessEffect": asRemoved(
|
|
8413
|
+
"Use Effect.when with a negated effectful condition instead."
|
|
8414
|
+
),
|
|
8415
|
+
"unsafeMakeLatch": asRemoved(
|
|
8416
|
+
"Use Effect.makeLatch instead."
|
|
8417
|
+
),
|
|
8418
|
+
"unsafeMakeSemaphore": asRemoved(
|
|
8419
|
+
"Use Effect.makeSemaphore instead."
|
|
8420
|
+
),
|
|
8421
|
+
"unsandbox": asRemoved(
|
|
8422
|
+
"Use Effect.catchCause instead."
|
|
8423
|
+
),
|
|
8424
|
+
"updateFiberRefs": asRemoved(
|
|
8425
|
+
"FiberRef has been replaced by ServiceMap.Reference in Effect v4."
|
|
8426
|
+
),
|
|
8427
|
+
"using": asRemoved(
|
|
8428
|
+
"Use Effect.scoped instead."
|
|
8429
|
+
),
|
|
8430
|
+
"validateAll": asRemoved(
|
|
8431
|
+
"Use Effect.all with { mode: 'validate' } instead."
|
|
8432
|
+
),
|
|
8433
|
+
"validateFirst": asRemoved(
|
|
8434
|
+
"Use Effect.all with { mode: 'validate' } instead."
|
|
8435
|
+
),
|
|
8436
|
+
"validateWith": asRemoved(
|
|
8437
|
+
"Use Effect.all with { mode: 'validate' } instead."
|
|
8438
|
+
),
|
|
8439
|
+
"whenEffect": asRemoved(
|
|
8440
|
+
"Use Effect.when with an effectful condition via Effect.flatMap instead."
|
|
8441
|
+
),
|
|
8442
|
+
"whenFiberRef": asRemoved(
|
|
8443
|
+
"FiberRef has been replaced by ServiceMap.Reference in Effect v4."
|
|
8444
|
+
),
|
|
8445
|
+
"whenLogLevel": asRemoved(
|
|
8446
|
+
"Log level checking has been reworked in Effect v4."
|
|
8447
|
+
),
|
|
8448
|
+
"whenRef": asRemoved(
|
|
8449
|
+
"Use Ref.get and Effect.when instead."
|
|
8450
|
+
),
|
|
8451
|
+
"withClock": asRemoved(
|
|
8452
|
+
"Clock configuration has been reworked in Effect v4."
|
|
8453
|
+
),
|
|
8454
|
+
"withClockScoped": asRemoved(
|
|
8455
|
+
"Clock configuration has been reworked in Effect v4."
|
|
8456
|
+
),
|
|
8457
|
+
"withConfigProvider": asRemoved(
|
|
8458
|
+
"ConfigProvider configuration has been reworked in Effect v4."
|
|
8459
|
+
),
|
|
8460
|
+
"withConfigProviderScoped": asRemoved(
|
|
8461
|
+
"ConfigProvider configuration has been reworked in Effect v4."
|
|
8462
|
+
),
|
|
8463
|
+
"withConsole": asRemoved(
|
|
8464
|
+
"Console configuration has been reworked in Effect v4."
|
|
8465
|
+
),
|
|
8466
|
+
"withConsoleScoped": asRemoved(
|
|
8467
|
+
"Console configuration has been reworked in Effect v4."
|
|
8468
|
+
),
|
|
8469
|
+
"withEarlyRelease": asRemoved(
|
|
8470
|
+
"Use Effect.scoped with manual resource management instead."
|
|
8471
|
+
),
|
|
8472
|
+
"withFiberRuntime": asRenamedAndNeedsOptions(
|
|
8473
|
+
"withFiber",
|
|
8474
|
+
"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)."
|
|
8475
|
+
),
|
|
8476
|
+
"withMaxOpsBeforeYield": asRemoved(
|
|
8477
|
+
"Use ServiceMap.Reference for MaxOpsBeforeYield configuration instead."
|
|
8478
|
+
),
|
|
8479
|
+
"withMetric": asRemoved(
|
|
8480
|
+
"Metric configuration has been reworked in Effect v4."
|
|
8481
|
+
),
|
|
8482
|
+
"withRandom": asRemoved(
|
|
8483
|
+
"Random configuration has been reworked in Effect v4."
|
|
8484
|
+
),
|
|
8485
|
+
"withRandomFixed": asRemoved(
|
|
8486
|
+
"Random configuration has been reworked in Effect v4."
|
|
8487
|
+
),
|
|
8488
|
+
"withRandomScoped": asRemoved(
|
|
8489
|
+
"Random configuration has been reworked in Effect v4."
|
|
8490
|
+
),
|
|
8491
|
+
"withRequestBatching": asRemoved(
|
|
8492
|
+
"Request batching configuration has been reworked in Effect v4."
|
|
8493
|
+
),
|
|
8494
|
+
"withRequestCache": asRemoved(
|
|
8495
|
+
"Request caching configuration has been reworked in Effect v4."
|
|
8496
|
+
),
|
|
8497
|
+
"withRequestCaching": asRemoved(
|
|
8498
|
+
"Request caching configuration has been reworked in Effect v4."
|
|
8499
|
+
),
|
|
8500
|
+
"withRuntimeFlagsPatch": asRemoved(
|
|
8501
|
+
"Runtime flags have been removed in Effect v4."
|
|
8502
|
+
),
|
|
8503
|
+
"withRuntimeFlagsPatchScoped": asRemoved(
|
|
8504
|
+
"Runtime flags have been removed in Effect v4."
|
|
8505
|
+
),
|
|
8506
|
+
"withScheduler": asRemoved(
|
|
8507
|
+
"Use ServiceMap.Reference for Scheduler configuration instead."
|
|
8508
|
+
),
|
|
8509
|
+
"withSchedulingPriority": asRemoved(
|
|
8510
|
+
"Scheduling priority configuration has been removed in Effect v4."
|
|
8511
|
+
),
|
|
8512
|
+
"withTracerScoped": asRemoved(
|
|
8513
|
+
"Use Effect.withTracer instead."
|
|
8514
|
+
),
|
|
8515
|
+
"withUnhandledErrorLogLevel": asRemoved(
|
|
8516
|
+
"Use ServiceMap.Reference for UnhandledLogLevel configuration instead."
|
|
8517
|
+
),
|
|
8518
|
+
"zipLeft": asRemoved(
|
|
8519
|
+
"Use Effect.tap instead of Effect.zipLeft."
|
|
8520
|
+
),
|
|
8521
|
+
"zipRight": asRemoved(
|
|
8522
|
+
"Use Effect.andThen instead of Effect.zipRight."
|
|
8523
|
+
)
|
|
8524
|
+
};
|
|
8525
|
+
|
|
8526
|
+
// src/diagnostics/outdatedApi.ts
|
|
8527
|
+
var outdatedApi = createDiagnostic({
|
|
8528
|
+
name: "outdatedApi",
|
|
8529
|
+
code: 48,
|
|
8530
|
+
description: "Detects usage of APIs that have been removed or renamed in Effect v4",
|
|
8531
|
+
severity: "warning",
|
|
8532
|
+
apply: fn("outdatedApi.apply")(function* (sourceFile, report) {
|
|
8533
|
+
const typeParser = yield* service(TypeParser);
|
|
8534
|
+
const ts = yield* service(TypeScriptApi);
|
|
8535
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
8536
|
+
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
8537
|
+
if (typeParser.supportedEffect() === "v3") return;
|
|
8538
|
+
let hasReported = false;
|
|
8539
|
+
function reportMigration(propertyAccess, propertyName, _migration) {
|
|
8540
|
+
hasReported = true;
|
|
8541
|
+
report({
|
|
8542
|
+
location: propertyAccess.name,
|
|
8543
|
+
messageText: `${propertyName} is an Effect v3 API, but the project is using Effect v4.`,
|
|
8544
|
+
fixes: []
|
|
8545
|
+
});
|
|
8546
|
+
}
|
|
8547
|
+
const checkPropertyAccessMigration = (propertyAccess, checkRightNode, migrationDb) => {
|
|
8548
|
+
if (!ts.isPropertyAccessExpression(propertyAccess)) return;
|
|
8549
|
+
const identifier2 = propertyAccess.name;
|
|
8550
|
+
if (!ts.isIdentifier(identifier2)) return;
|
|
8551
|
+
const identifierName = ts.idText(identifier2);
|
|
8552
|
+
const migration = migrationDb[identifierName];
|
|
8553
|
+
if (!migration) return;
|
|
8554
|
+
if (migration._tag === "Unchanged") return;
|
|
8555
|
+
const targetType = typeCheckerUtils.getTypeAtLocation(propertyAccess.expression);
|
|
8556
|
+
if (!targetType) return;
|
|
8557
|
+
const targetPropertySymbol = typeChecker.getPropertyOfType(targetType, identifierName);
|
|
8558
|
+
if (targetPropertySymbol) return;
|
|
8559
|
+
return pipe(
|
|
8560
|
+
checkRightNode(propertyAccess.expression),
|
|
8561
|
+
map4(() => reportMigration(propertyAccess, identifierName, migration)),
|
|
8562
|
+
ignore
|
|
8563
|
+
);
|
|
8564
|
+
};
|
|
8565
|
+
const nodeToVisit = [];
|
|
8566
|
+
const appendNodeToVisit = (node) => {
|
|
8567
|
+
nodeToVisit.push(node);
|
|
8568
|
+
return void 0;
|
|
8569
|
+
};
|
|
8570
|
+
ts.forEachChild(sourceFile, appendNodeToVisit);
|
|
8571
|
+
while (nodeToVisit.length > 0) {
|
|
8572
|
+
const node = nodeToVisit.shift();
|
|
8573
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
8574
|
+
const checkEffectMigration = checkPropertyAccessMigration(
|
|
8575
|
+
node,
|
|
8576
|
+
typeParser.importedEffectModule,
|
|
8577
|
+
effectModuleMigrationDb
|
|
8578
|
+
);
|
|
8579
|
+
if (checkEffectMigration) {
|
|
8580
|
+
yield* ignore(checkEffectMigration);
|
|
8581
|
+
}
|
|
8582
|
+
}
|
|
8583
|
+
if (hasReported) {
|
|
8584
|
+
report({
|
|
8585
|
+
location: { pos: 0, end: 0 },
|
|
8586
|
+
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.",
|
|
8587
|
+
fixes: []
|
|
8588
|
+
});
|
|
8589
|
+
}
|
|
8590
|
+
})
|
|
8591
|
+
});
|
|
8592
|
+
|
|
7351
8593
|
// src/refactors/writeTagClassAccessors.ts
|
|
7352
8594
|
var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, service2, className, atLocation, involvedMembers) {
|
|
7353
8595
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -7433,13 +8675,13 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
|
|
|
7433
8675
|
atLocation2,
|
|
7434
8676
|
ts.NodeBuilderFlags.NoTruncation
|
|
7435
8677
|
);
|
|
7436
|
-
if (!successType) return
|
|
8678
|
+
if (!successType) return fail3("error generating success type");
|
|
7437
8679
|
const failureType = typeChecker.typeToTypeNode(
|
|
7438
8680
|
returnedEffect.E,
|
|
7439
8681
|
atLocation2,
|
|
7440
8682
|
ts.NodeBuilderFlags.NoTruncation
|
|
7441
8683
|
);
|
|
7442
|
-
if (!failureType) return
|
|
8684
|
+
if (!failureType) return fail3("error generating failure type");
|
|
7443
8685
|
const typeNode = ts.factory.createTypeReferenceNode(
|
|
7444
8686
|
ts.factory.createQualifiedName(
|
|
7445
8687
|
ts.factory.createIdentifier(effectIdentifier),
|
|
@@ -7447,7 +8689,7 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
|
|
|
7447
8689
|
),
|
|
7448
8690
|
[successType, failureType, contextType]
|
|
7449
8691
|
);
|
|
7450
|
-
return
|
|
8692
|
+
return succeed3(typeNode);
|
|
7451
8693
|
}),
|
|
7452
8694
|
orElse2(
|
|
7453
8695
|
() => pipe(
|
|
@@ -7458,8 +8700,8 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
|
|
|
7458
8700
|
atLocation2,
|
|
7459
8701
|
ts.NodeBuilderFlags.NoTruncation
|
|
7460
8702
|
);
|
|
7461
|
-
if (!successType) return
|
|
7462
|
-
return
|
|
8703
|
+
if (!successType) return fail3("error generating success type");
|
|
8704
|
+
return succeed3(ts.factory.createTypeReferenceNode(
|
|
7463
8705
|
ts.factory.createQualifiedName(
|
|
7464
8706
|
ts.factory.createIdentifier(effectIdentifier),
|
|
7465
8707
|
ts.factory.createIdentifier("Effect")
|
|
@@ -7480,7 +8722,7 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
|
|
|
7480
8722
|
),
|
|
7481
8723
|
orElse2(() => {
|
|
7482
8724
|
const successType = typeChecker.typeToTypeNode(type, atLocation2, ts.NodeBuilderFlags.NoTruncation);
|
|
7483
|
-
if (!successType) return
|
|
8725
|
+
if (!successType) return fail3("error generating success type");
|
|
7484
8726
|
const typeNode = ts.factory.createTypeReferenceNode(
|
|
7485
8727
|
ts.factory.createQualifiedName(
|
|
7486
8728
|
ts.factory.createIdentifier(effectIdentifier),
|
|
@@ -7492,7 +8734,7 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
|
|
|
7492
8734
|
ts.factory.createTypeReferenceNode(ts.idText(className2))
|
|
7493
8735
|
]
|
|
7494
8736
|
);
|
|
7495
|
-
return
|
|
8737
|
+
return succeed3(typeNode);
|
|
7496
8738
|
})
|
|
7497
8739
|
);
|
|
7498
8740
|
const proxySignature = fn("writeTagClassAccessors.proxySignature")(
|
|
@@ -7503,7 +8745,7 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
|
|
|
7503
8745
|
atLocation2,
|
|
7504
8746
|
ts.NodeBuilderFlags.NoTruncation
|
|
7505
8747
|
);
|
|
7506
|
-
if (!signatureDeclaration) return yield*
|
|
8748
|
+
if (!signatureDeclaration) return yield* fail3("error generating signature");
|
|
7507
8749
|
const returnType = yield* generateReturnType(
|
|
7508
8750
|
typeChecker.getReturnTypeOfSignature(signature),
|
|
7509
8751
|
atLocation2,
|
|
@@ -7552,21 +8794,21 @@ var parse2 = fn("writeTagClassAccessors.parse")(function* (node) {
|
|
|
7552
8794
|
const typeChecker = yield* service(TypeCheckerApi);
|
|
7553
8795
|
const typeParser = yield* service(TypeParser);
|
|
7554
8796
|
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
7555
|
-
if (typeParser.supportedEffect() === "v4") return yield*
|
|
7556
|
-
if (!ts.isClassDeclaration(node)) return yield*
|
|
8797
|
+
if (typeParser.supportedEffect() === "v4") return yield* fail3("not applicable to Effect v4");
|
|
8798
|
+
if (!ts.isClassDeclaration(node)) return yield* fail3("not a class declaration");
|
|
7557
8799
|
const { Service, accessors: accessors2, className, kind } = yield* pipe(
|
|
7558
8800
|
map4(typeParser.extendsEffectService(node), (_) => ({ kind: "effectService", ..._ })),
|
|
7559
8801
|
orElse2(
|
|
7560
8802
|
() => map4(typeParser.extendsEffectTag(node), (_) => ({ kind: "effectTag", accessors: true, ..._ }))
|
|
7561
8803
|
),
|
|
7562
|
-
orElse2(() =>
|
|
8804
|
+
orElse2(() => fail3("not a class extending Effect.Service call"))
|
|
7563
8805
|
);
|
|
7564
|
-
if (accessors2 !== true) return yield*
|
|
8806
|
+
if (accessors2 !== true) return yield* fail3("accessors are not enabled in the Effect.Service call");
|
|
7565
8807
|
const involvedMembers = [];
|
|
7566
8808
|
const nonPrimitiveServices = typeCheckerUtils.unrollUnionMembers(Service).filter(
|
|
7567
8809
|
(_) => !(_.flags & ts.TypeFlags.Number || _.flags & ts.TypeFlags.String || _.flags & ts.TypeFlags.Boolean || _.flags & ts.TypeFlags.Literal)
|
|
7568
8810
|
);
|
|
7569
|
-
if (nonPrimitiveServices.length === 0) return yield*
|
|
8811
|
+
if (nonPrimitiveServices.length === 0) return yield* fail3("Service type is a primitive type");
|
|
7570
8812
|
for (const serviceShape of nonPrimitiveServices) {
|
|
7571
8813
|
for (const property of typeChecker.getPropertiesOfType(serviceShape)) {
|
|
7572
8814
|
const propertyType = typeChecker.getTypeOfSymbolAtLocation(property, node);
|
|
@@ -7607,7 +8849,7 @@ var writeTagClassAccessors = createRefactor({
|
|
|
7607
8849
|
const parentNodes = tsUtils.getAncestorNodesInRange(sourceFile, textRange);
|
|
7608
8850
|
return yield* pipe(
|
|
7609
8851
|
firstSuccessOf(parentNodes.map(parseNode)),
|
|
7610
|
-
orElse2(() =>
|
|
8852
|
+
orElse2(() => fail3(new RefactorNotApplicableError()))
|
|
7611
8853
|
);
|
|
7612
8854
|
})
|
|
7613
8855
|
});
|
|
@@ -7622,7 +8864,7 @@ var accessors = createCodegen({
|
|
|
7622
8864
|
const typeParser = yield* service(TypeParser);
|
|
7623
8865
|
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
7624
8866
|
const nodeAndCommentRange = tsUtils.findNodeWithLeadingCommentAtPosition(sourceFile, textRange.pos);
|
|
7625
|
-
if (!nodeAndCommentRange) return yield*
|
|
8867
|
+
if (!nodeAndCommentRange) return yield* fail3(new CodegenNotApplicableError("no node and comment range"));
|
|
7626
8868
|
return yield* pipe(
|
|
7627
8869
|
parse2(nodeAndCommentRange.node),
|
|
7628
8870
|
map4(
|
|
@@ -7639,7 +8881,7 @@ var accessors = createCodegen({
|
|
|
7639
8881
|
)
|
|
7640
8882
|
})
|
|
7641
8883
|
),
|
|
7642
|
-
orElse2((cause) =>
|
|
8884
|
+
orElse2((cause) => fail3(new CodegenNotApplicableError(cause)))
|
|
7643
8885
|
);
|
|
7644
8886
|
})
|
|
7645
8887
|
});
|
|
@@ -7663,14 +8905,14 @@ var annotate = createCodegen({
|
|
|
7663
8905
|
variableDeclarations = [...variableDeclarations, node];
|
|
7664
8906
|
}
|
|
7665
8907
|
if (variableDeclarations.length === 0) {
|
|
7666
|
-
return yield*
|
|
8908
|
+
return yield* fail3(new CodegenNotApplicableError("not a variable declaration"));
|
|
7667
8909
|
}
|
|
7668
8910
|
for (const variableDeclaration of variableDeclarations) {
|
|
7669
8911
|
if (!variableDeclaration.initializer) continue;
|
|
7670
8912
|
const initializerType = typeCheckerUtils.getTypeAtLocation(variableDeclaration.initializer);
|
|
7671
8913
|
if (!initializerType) continue;
|
|
7672
8914
|
const enclosingNode = ts.findAncestor(variableDeclaration, (_) => tsUtils.isDeclarationKind(_.kind)) || sourceFile;
|
|
7673
|
-
const initializerTypeNode =
|
|
8915
|
+
const initializerTypeNode = fromNullishOr(typeCheckerUtils.typeToSimplifiedTypeNode(
|
|
7674
8916
|
initializerType,
|
|
7675
8917
|
enclosingNode,
|
|
7676
8918
|
ts.NodeBuilderFlags.NoTruncation | ts.NodeBuilderFlags.IgnoreErrors
|
|
@@ -7683,7 +8925,7 @@ var annotate = createCodegen({
|
|
|
7683
8925
|
result.push({ variableDeclaration, initializerTypeNode, hash: hash3 });
|
|
7684
8926
|
}
|
|
7685
8927
|
if (result.length === 0) {
|
|
7686
|
-
return yield*
|
|
8928
|
+
return yield* fail3(new CodegenNotApplicableError("no variable declarations with initializers"));
|
|
7687
8929
|
}
|
|
7688
8930
|
const hash2 = cyrb53(result.map((_) => _.hash).join("/"));
|
|
7689
8931
|
return {
|
|
@@ -7692,7 +8934,7 @@ var annotate = createCodegen({
|
|
|
7692
8934
|
};
|
|
7693
8935
|
});
|
|
7694
8936
|
const nodeAndCommentRange = tsUtils.findNodeWithLeadingCommentAtPosition(sourceFile, textRange.pos);
|
|
7695
|
-
if (!nodeAndCommentRange) return yield*
|
|
8937
|
+
if (!nodeAndCommentRange) return yield* fail3(new CodegenNotApplicableError("no node and comment range"));
|
|
7696
8938
|
return yield* pipe(
|
|
7697
8939
|
parse3(nodeAndCommentRange.node),
|
|
7698
8940
|
map4(
|
|
@@ -7753,13 +8995,13 @@ var makeStructuralSchemaGenContext = fn("StructuralSchemaGen.makeContext")(
|
|
|
7753
8995
|
ts.factory.createIdentifier(effectSchemaIdentifier),
|
|
7754
8996
|
apiName
|
|
7755
8997
|
),
|
|
7756
|
-
createApiCall: (apiName,
|
|
8998
|
+
createApiCall: (apiName, args3) => ts.factory.createCallExpression(
|
|
7757
8999
|
ts.factory.createPropertyAccessExpression(
|
|
7758
9000
|
ts.factory.createIdentifier(effectSchemaIdentifier),
|
|
7759
9001
|
apiName
|
|
7760
9002
|
),
|
|
7761
9003
|
[],
|
|
7762
|
-
|
|
9004
|
+
args3
|
|
7763
9005
|
),
|
|
7764
9006
|
hoistedSchemas: /* @__PURE__ */ new Map(),
|
|
7765
9007
|
typeToStatementIndex: /* @__PURE__ */ new Map(),
|
|
@@ -7809,7 +9051,7 @@ var processType = fn(
|
|
|
7809
9051
|
StructuralSchemaGenContext
|
|
7810
9052
|
);
|
|
7811
9053
|
if (processingContext.depth >= processingContext.maxDepth) {
|
|
7812
|
-
return yield*
|
|
9054
|
+
return yield* fail3(new UnsupportedTypeError(type, "Maximum depth exceeded"));
|
|
7813
9055
|
}
|
|
7814
9056
|
let hoistName = fromIterable(nameToType.entries()).find(([_, existingType]) => existingType === type)?.[0];
|
|
7815
9057
|
if (!hoistName && type && type.symbol && type.symbol.declarations && type.symbol.declarations.length === 1) {
|
|
@@ -7923,7 +9165,7 @@ var processTypeImpl = fn(
|
|
|
7923
9165
|
const objectType = type;
|
|
7924
9166
|
return yield* processObjectType(objectType, context);
|
|
7925
9167
|
}
|
|
7926
|
-
return yield*
|
|
9168
|
+
return yield* fail3(
|
|
7927
9169
|
new UnsupportedTypeError(
|
|
7928
9170
|
type,
|
|
7929
9171
|
`Type with flags ${type.flags} is not supported`
|
|
@@ -8003,7 +9245,7 @@ var processArrayType = fn(
|
|
|
8003
9245
|
const { createApiCall, typeChecker, typeCheckerUtils } = yield* service(StructuralSchemaGenContext);
|
|
8004
9246
|
const typeArgs = typeChecker.getTypeArguments(type);
|
|
8005
9247
|
if (typeArgs.length === 0) {
|
|
8006
|
-
return yield*
|
|
9248
|
+
return yield* fail3(new UnsupportedTypeError(type, "Array type has no type arguments"));
|
|
8007
9249
|
}
|
|
8008
9250
|
const elementSchema = yield* processType(typeArgs[0], context);
|
|
8009
9251
|
const expr = createApiCall("Array", [elementSchema]);
|
|
@@ -8079,7 +9321,7 @@ var processObjectType = fn(
|
|
|
8079
9321
|
);
|
|
8080
9322
|
}
|
|
8081
9323
|
const indexInfos = typeChecker.getIndexInfosOfType(type);
|
|
8082
|
-
const
|
|
9324
|
+
const args3 = [
|
|
8083
9325
|
ts.factory.createObjectLiteralExpression(propertyAssignments, propertyAssignments.length > 0)
|
|
8084
9326
|
];
|
|
8085
9327
|
const records = [];
|
|
@@ -8094,7 +9336,7 @@ var processObjectType = fn(
|
|
|
8094
9336
|
if (records.length > 0) {
|
|
8095
9337
|
return [
|
|
8096
9338
|
createApiCall("StructWithRest", [
|
|
8097
|
-
createApiCall("Struct",
|
|
9339
|
+
createApiCall("Struct", args3),
|
|
8098
9340
|
ts.factory.createArrayLiteralExpression(
|
|
8099
9341
|
records.map(({ key, value }) => createApiCall("Record", [key, value]))
|
|
8100
9342
|
)
|
|
@@ -8126,7 +9368,7 @@ var processObjectType = fn(
|
|
|
8126
9368
|
[ts.factory.createStringLiteral(context.hoistName)]
|
|
8127
9369
|
),
|
|
8128
9370
|
[],
|
|
8129
|
-
|
|
9371
|
+
args3
|
|
8130
9372
|
),
|
|
8131
9373
|
[]
|
|
8132
9374
|
)
|
|
@@ -8139,14 +9381,14 @@ var processObjectType = fn(
|
|
|
8139
9381
|
return [ctx.hoistedSchemas.get(type)(), true];
|
|
8140
9382
|
}
|
|
8141
9383
|
for (const { key, value } of records) {
|
|
8142
|
-
|
|
9384
|
+
args3.push(
|
|
8143
9385
|
ts.factory.createObjectLiteralExpression([
|
|
8144
9386
|
ts.factory.createPropertyAssignment("key", key),
|
|
8145
9387
|
ts.factory.createPropertyAssignment("value", value)
|
|
8146
9388
|
])
|
|
8147
9389
|
);
|
|
8148
9390
|
}
|
|
8149
|
-
return [createApiCall("Struct",
|
|
9391
|
+
return [createApiCall("Struct", args3), propertyAssignments.length === 0];
|
|
8150
9392
|
}
|
|
8151
9393
|
);
|
|
8152
9394
|
var findNodeToProcess = fn("StructuralSchemaGen.findNodeToProcess")(
|
|
@@ -8233,7 +9475,7 @@ var process = fn("StructuralSchemaGen.process")(
|
|
|
8233
9475
|
([name, type]) => pipe(
|
|
8234
9476
|
processType(type, createProcessingContext(typeParser.supportedEffect())),
|
|
8235
9477
|
orElse2(
|
|
8236
|
-
(error) =>
|
|
9478
|
+
(error) => succeed3(ts.addSyntheticLeadingComment(
|
|
8237
9479
|
ts.factory.createIdentifier(""),
|
|
8238
9480
|
ts.SyntaxKind.MultiLineCommentTrivia,
|
|
8239
9481
|
" " + String(error) + " ",
|
|
@@ -8306,10 +9548,10 @@ var process = fn("StructuralSchemaGen.process")(
|
|
|
8306
9548
|
}
|
|
8307
9549
|
);
|
|
8308
9550
|
var applyAtNode = fn("StructuralSchemaGen.applyAtNode")(
|
|
8309
|
-
function* (sourceFile, node,
|
|
9551
|
+
function* (sourceFile, node, identifier2, type, isExported) {
|
|
8310
9552
|
const changeTracker = yield* service(ChangeTracker);
|
|
8311
9553
|
const ts = yield* service(TypeScriptApi);
|
|
8312
|
-
const ctx = yield* process(sourceFile, node, /* @__PURE__ */ new Map([[ts.idText(
|
|
9554
|
+
const ctx = yield* process(sourceFile, node, /* @__PURE__ */ new Map([[ts.idText(identifier2), type]]), isExported, false);
|
|
8313
9555
|
for (const statement of ctx.schemaStatements) {
|
|
8314
9556
|
changeTracker.insertNodeAt(sourceFile, node.pos, statement, { prefix: "\n", suffix: "\n" });
|
|
8315
9557
|
}
|
|
@@ -8328,13 +9570,13 @@ var typeToSchema = createCodegen({
|
|
|
8328
9570
|
const program = yield* service(TypeScriptProgram);
|
|
8329
9571
|
const inThisFile = yield* getCodegensForSourceFile([typeToSchema], sourceFile);
|
|
8330
9572
|
if (inThisFile.length > 1) {
|
|
8331
|
-
return yield*
|
|
9573
|
+
return yield* fail3(
|
|
8332
9574
|
new CodegenNotApplicableError("the typeToSchema codegen can be used only once per file")
|
|
8333
9575
|
);
|
|
8334
9576
|
}
|
|
8335
9577
|
const parse3 = fn("typeToSchema.parse")(function* (node) {
|
|
8336
9578
|
if (!ts.isTypeAliasDeclaration(node)) {
|
|
8337
|
-
return yield*
|
|
9579
|
+
return yield* fail3(
|
|
8338
9580
|
new CodegenNotApplicableError(
|
|
8339
9581
|
"this codegen is applicable only to a type alias where each object member is a schema to generate. e.g. `type ToGenerate = { UserSchema: User, TodoSchema: Todo}`"
|
|
8340
9582
|
)
|
|
@@ -8342,7 +9584,7 @@ var typeToSchema = createCodegen({
|
|
|
8342
9584
|
}
|
|
8343
9585
|
const type = typeCheckerUtils.getTypeAtLocation(node.name);
|
|
8344
9586
|
if (!type) {
|
|
8345
|
-
return yield*
|
|
9587
|
+
return yield* fail3(
|
|
8346
9588
|
new CodegenNotApplicableError(
|
|
8347
9589
|
"error getting the type to process"
|
|
8348
9590
|
)
|
|
@@ -8375,7 +9617,7 @@ var typeToSchema = createCodegen({
|
|
|
8375
9617
|
});
|
|
8376
9618
|
const nodeAndCommentRange = tsUtils.findNodeWithLeadingCommentAtPosition(sourceFile, textRange.pos);
|
|
8377
9619
|
if (!nodeAndCommentRange) {
|
|
8378
|
-
return yield*
|
|
9620
|
+
return yield* fail3(new CodegenNotApplicableError("no node and comment range affected"));
|
|
8379
9621
|
}
|
|
8380
9622
|
return yield* pipe(
|
|
8381
9623
|
parse3(nodeAndCommentRange.node),
|
|
@@ -8511,7 +9753,7 @@ var overriddenSchemaConstructor = createDiagnostic({
|
|
|
8511
9753
|
const isSchema = yield* pipe(
|
|
8512
9754
|
typeParser.effectSchemaType(typeAtLocation, type.expression),
|
|
8513
9755
|
map4(() => true),
|
|
8514
|
-
orElse2(() =>
|
|
9756
|
+
orElse2(() => succeed3(false))
|
|
8515
9757
|
);
|
|
8516
9758
|
if (isSchema) {
|
|
8517
9759
|
extendsSchema = true;
|
|
@@ -9118,11 +10360,11 @@ var schemaUnionOfLiterals = createDiagnostic({
|
|
|
9118
10360
|
orElse2(() => void_)
|
|
9119
10361
|
);
|
|
9120
10362
|
if (isSchemaUnionCall) {
|
|
9121
|
-
const
|
|
9122
|
-
if (
|
|
9123
|
-
const allAreCallExpressions =
|
|
10363
|
+
const args3 = fromIterable(node.arguments);
|
|
10364
|
+
if (args3.length >= 2) {
|
|
10365
|
+
const allAreCallExpressions = args3.every((arg) => ts.isCallExpression(arg));
|
|
9124
10366
|
if (allAreCallExpressions) {
|
|
9125
|
-
const literalChecks =
|
|
10367
|
+
const literalChecks = args3.map((arg) => {
|
|
9126
10368
|
const callArg = arg;
|
|
9127
10369
|
return pipe(
|
|
9128
10370
|
typeParser.isNodeReferenceToEffectSchemaModuleApi("Literal")(callArg.expression),
|
|
@@ -9628,8 +10870,8 @@ var unnecessaryPipe = createDiagnostic({
|
|
|
9628
10870
|
if (ts.isCallExpression(node)) {
|
|
9629
10871
|
yield* pipe(
|
|
9630
10872
|
typeParser.pipeCall(node),
|
|
9631
|
-
map4(({ args:
|
|
9632
|
-
if (
|
|
10873
|
+
map4(({ args: args3, subject }) => {
|
|
10874
|
+
if (args3.length === 0) {
|
|
9633
10875
|
report({
|
|
9634
10876
|
location: node,
|
|
9635
10877
|
messageText: `This pipe call contains no arguments.`,
|
|
@@ -9748,7 +10990,7 @@ var unsupportedServiceAccessors = createDiagnostic({
|
|
|
9748
10990
|
if (ts.isClassDeclaration(node)) {
|
|
9749
10991
|
const parseResult = yield* pipe(
|
|
9750
10992
|
parse2(node),
|
|
9751
|
-
orElse2(() =>
|
|
10993
|
+
orElse2(() => succeed3(null))
|
|
9752
10994
|
);
|
|
9753
10995
|
if (parseResult && parseResult.involvedMembers.length > 0) {
|
|
9754
10996
|
const existingStaticMembers = /* @__PURE__ */ new Set();
|
|
@@ -9787,6 +11029,7 @@ var unsupportedServiceAccessors = createDiagnostic({
|
|
|
9787
11029
|
|
|
9788
11030
|
// src/diagnostics.ts
|
|
9789
11031
|
var diagnostics = [
|
|
11032
|
+
outdatedApi,
|
|
9790
11033
|
anyUnknownInErrorContext,
|
|
9791
11034
|
instanceOfSchema,
|
|
9792
11035
|
catchAllToMapError,
|
|
@@ -9860,7 +11103,7 @@ function transform_default(program, pluginConfig, { addDiagnostic, ts: tsInstanc
|
|
|
9860
11103
|
(_2) => _2.category === tsInstance.DiagnosticCategory.Error || _2.category === tsInstance.DiagnosticCategory.Warning
|
|
9861
11104
|
)
|
|
9862
11105
|
),
|
|
9863
|
-
|
|
11106
|
+
getOrElse2(() => []),
|
|
9864
11107
|
map3(addDiagnostic)
|
|
9865
11108
|
);
|
|
9866
11109
|
return sourceFile;
|