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