@effect/language-service 0.75.1 → 0.76.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 +1 -0
- package/cli.js +26495 -31923
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +1084 -671
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +1855 -2911
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +1085 -672
- 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.12/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.12/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.12/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.12/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.12/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.12/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,71 +280,274 @@ 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;
|
|
421
346
|
}
|
|
422
|
-
return
|
|
347
|
+
return compareMaps(self, that);
|
|
348
|
+
} else if (self instanceof Set) {
|
|
349
|
+
if (!(that instanceof Set) || self.size !== that.size) {
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
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;
|
|
423
380
|
}
|
|
424
381
|
}
|
|
425
|
-
return
|
|
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;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
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.12/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.12/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.12/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
|
|
550
|
+
return toJson(this);
|
|
448
551
|
},
|
|
449
552
|
[NodeInspectSymbol]() {
|
|
450
553
|
return this.toJSON();
|
|
@@ -455,171 +558,447 @@ var BaseProto = {
|
|
|
455
558
|
};
|
|
456
559
|
var Class = class {
|
|
457
560
|
/**
|
|
561
|
+
* Node.js custom inspection method.
|
|
562
|
+
*
|
|
458
563
|
* @since 2.0.0
|
|
459
564
|
*/
|
|
460
565
|
[NodeInspectSymbol]() {
|
|
461
566
|
return this.toJSON();
|
|
462
567
|
}
|
|
463
568
|
/**
|
|
569
|
+
* Returns a formatted string representation of this object.
|
|
570
|
+
*
|
|
464
571
|
* @since 2.0.0
|
|
465
572
|
*/
|
|
466
573
|
toString() {
|
|
467
574
|
return format(this.toJSON());
|
|
468
575
|
}
|
|
469
576
|
};
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
var
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
577
|
+
|
|
578
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/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);
|
|
478
600
|
}
|
|
479
|
-
return u;
|
|
480
601
|
};
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
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 {
|
|
511
638
|
}
|
|
512
639
|
}
|
|
513
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;
|
|
514
645
|
|
|
515
|
-
// ../../node_modules/.pnpm/effect@
|
|
516
|
-
var
|
|
517
|
-
|
|
518
|
-
// ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/version.js
|
|
519
|
-
var moduleVersion = "3.19.14";
|
|
520
|
-
var getCurrentVersion = () => moduleVersion;
|
|
521
|
-
|
|
522
|
-
// ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/effectable.js
|
|
523
|
-
var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
|
|
524
|
-
var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
|
|
525
|
-
var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
|
|
526
|
-
var ChannelTypeId = /* @__PURE__ */ Symbol.for("effect/Channel");
|
|
646
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/internal/core.js
|
|
647
|
+
var EffectTypeId = `~effect/Effect`;
|
|
648
|
+
var ExitTypeId = `~effect/Exit`;
|
|
527
649
|
var effectVariance = {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
_E: (_) => _,
|
|
532
|
-
/* c8 ignore next */
|
|
533
|
-
_A: (_) => _,
|
|
534
|
-
_V: /* @__PURE__ */ getCurrentVersion()
|
|
535
|
-
};
|
|
536
|
-
var sinkVariance = {
|
|
537
|
-
/* c8 ignore next */
|
|
538
|
-
_A: (_) => _,
|
|
539
|
-
/* c8 ignore next */
|
|
540
|
-
_In: (_) => _,
|
|
541
|
-
/* c8 ignore next */
|
|
542
|
-
_L: (_) => _,
|
|
543
|
-
/* c8 ignore next */
|
|
544
|
-
_E: (_) => _,
|
|
545
|
-
/* c8 ignore next */
|
|
546
|
-
_R: (_) => _
|
|
650
|
+
_A: identity,
|
|
651
|
+
_E: identity,
|
|
652
|
+
_R: identity
|
|
547
653
|
};
|
|
548
|
-
var
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
/* c8 ignore next */
|
|
558
|
-
_OutErr: (_) => _,
|
|
559
|
-
/* c8 ignore next */
|
|
560
|
-
_OutElem: (_) => _,
|
|
561
|
-
/* c8 ignore next */
|
|
562
|
-
_OutDone: (_) => _
|
|
563
|
-
};
|
|
564
|
-
var EffectPrototype = {
|
|
565
|
-
[EffectTypeId]: effectVariance,
|
|
566
|
-
[StreamTypeId]: effectVariance,
|
|
567
|
-
[SinkTypeId]: sinkVariance,
|
|
568
|
-
[ChannelTypeId]: channelVariance,
|
|
569
|
-
[symbol2](that) {
|
|
570
|
-
return this === that;
|
|
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);
|
|
571
663
|
},
|
|
572
|
-
|
|
573
|
-
return
|
|
664
|
+
toJSON() {
|
|
665
|
+
return {
|
|
666
|
+
...this
|
|
667
|
+
};
|
|
574
668
|
},
|
|
575
|
-
|
|
576
|
-
return
|
|
669
|
+
toString() {
|
|
670
|
+
return format(this.toJSON(), {
|
|
671
|
+
ignoreToString: true,
|
|
672
|
+
space: 2
|
|
673
|
+
});
|
|
577
674
|
},
|
|
578
|
-
|
|
579
|
-
return
|
|
675
|
+
[NodeInspectSymbol]() {
|
|
676
|
+
return this.toJSON();
|
|
580
677
|
}
|
|
581
678
|
};
|
|
582
|
-
var
|
|
679
|
+
var StructuralProto = {
|
|
583
680
|
[symbol]() {
|
|
584
|
-
return
|
|
681
|
+
return structureKeys(this, Object.keys(this));
|
|
585
682
|
},
|
|
586
683
|
[symbol2](that) {
|
|
587
684
|
const selfKeys = Object.keys(this);
|
|
588
685
|
const thatKeys = Object.keys(that);
|
|
589
|
-
if (selfKeys.length !== thatKeys.length)
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
for (const key of selfKeys) {
|
|
593
|
-
if (!(key in that && equals(this[key], that[key]))) {
|
|
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]])) {
|
|
594
689
|
return false;
|
|
595
690
|
}
|
|
596
691
|
}
|
|
597
692
|
return true;
|
|
598
693
|
}
|
|
599
694
|
};
|
|
600
|
-
var
|
|
601
|
-
|
|
602
|
-
|
|
695
|
+
var YieldableProto = {
|
|
696
|
+
[Symbol.iterator]() {
|
|
697
|
+
return new SingleShotGen(this);
|
|
698
|
+
}
|
|
603
699
|
};
|
|
604
|
-
var
|
|
605
|
-
...
|
|
606
|
-
|
|
700
|
+
var YieldableErrorProto = {
|
|
701
|
+
...YieldableProto,
|
|
702
|
+
pipe() {
|
|
703
|
+
return pipeArguments(this, arguments);
|
|
704
|
+
}
|
|
607
705
|
};
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
[TypeId]: {
|
|
614
|
-
_A: (_) => _
|
|
706
|
+
var EffectProto = {
|
|
707
|
+
[EffectTypeId]: effectVariance,
|
|
708
|
+
...PipeInspectableProto,
|
|
709
|
+
[Symbol.iterator]() {
|
|
710
|
+
return new SingleShotGen(this);
|
|
615
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
|
+
}
|
|
745
|
+
toString() {
|
|
746
|
+
return `Cause(${format(this.reasons)})`;
|
|
747
|
+
}
|
|
616
748
|
[NodeInspectSymbol]() {
|
|
617
749
|
return this.toJSON();
|
|
618
|
-
}
|
|
750
|
+
}
|
|
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);
|
|
756
|
+
}
|
|
757
|
+
};
|
|
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
|
+
}
|
|
619
789
|
toString() {
|
|
620
|
-
return format(this
|
|
790
|
+
return format(this);
|
|
791
|
+
}
|
|
792
|
+
[NodeInspectSymbol]() {
|
|
793
|
+
return this.toString();
|
|
794
|
+
}
|
|
795
|
+
};
|
|
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)));
|
|
817
|
+
}
|
|
818
|
+
};
|
|
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
|
+
}
|
|
841
|
+
};
|
|
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
|
+
};
|
|
867
|
+
};
|
|
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
|
+
};
|
|
898
|
+
};
|
|
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);
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
var StackTraceKey = {
|
|
908
|
+
key: "effect/Cause/StackTrace"
|
|
909
|
+
};
|
|
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;
|
|
921
|
+
}
|
|
922
|
+
let cont = fiber.getCont(contE);
|
|
923
|
+
while (fiber.interruptible && fiber._interruptedCause && cont) {
|
|
924
|
+
cont = fiber.getCont(contE);
|
|
925
|
+
}
|
|
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);
|
|
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;
|
|
976
|
+
};
|
|
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
|
+
});
|
|
621
984
|
}
|
|
622
985
|
};
|
|
986
|
+
var DoneTypeId = "~effect/Cause/Done";
|
|
987
|
+
var DoneVoid = {
|
|
988
|
+
[DoneTypeId]: DoneTypeId,
|
|
989
|
+
_tag: "Done",
|
|
990
|
+
value: void 0
|
|
991
|
+
};
|
|
992
|
+
|
|
993
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/internal/option.js
|
|
994
|
+
var TypeId = "~effect/data/Option";
|
|
995
|
+
var CommonProto = {
|
|
996
|
+
[TypeId]: {
|
|
997
|
+
_A: (_) => _
|
|
998
|
+
},
|
|
999
|
+
...PipeInspectableProto,
|
|
1000
|
+
...YieldableProto
|
|
1001
|
+
};
|
|
623
1002
|
var SomeProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto), {
|
|
624
1003
|
_tag: "Some",
|
|
625
1004
|
_op: "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.12/node_modules/effect/dist/internal/result.js
|
|
1059
|
+
var TypeId2 = "~effect/data/Result";
|
|
669
1060
|
var CommonProto2 = {
|
|
670
|
-
...EffectPrototype,
|
|
671
1061
|
[TypeId2]: {
|
|
672
|
-
|
|
1062
|
+
/* v8 ignore next 2 */
|
|
1063
|
+
_A: (_) => _,
|
|
1064
|
+
_E: (_) => _
|
|
673
1065
|
},
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
},
|
|
677
|
-
toString() {
|
|
678
|
-
return format(this.toJSON());
|
|
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.12/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.12/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.12/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.12/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.12/node_modules/effect/dist/internal/array.js
|
|
1162
|
+
var isArrayNonEmpty = (self) => self.length > 0;
|
|
1163
|
+
|
|
1164
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/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.12/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
|
}
|
|
@@ -4252,7 +4665,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
4252
4665
|
const body = node.body;
|
|
4253
4666
|
const returnType = node.type;
|
|
4254
4667
|
if (ts.isArrowFunction(node) && !ts.isBlock(body)) {
|
|
4255
|
-
return
|
|
4668
|
+
return succeed3({
|
|
4256
4669
|
node,
|
|
4257
4670
|
body,
|
|
4258
4671
|
expression: body,
|
|
@@ -4270,7 +4683,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
4270
4683
|
if (!stmt.expression) {
|
|
4271
4684
|
return typeParserIssue("Return statement must have an expression", void 0, node);
|
|
4272
4685
|
}
|
|
4273
|
-
return
|
|
4686
|
+
return succeed3({
|
|
4274
4687
|
node,
|
|
4275
4688
|
body,
|
|
4276
4689
|
expression: stmt.expression,
|
|
@@ -4295,7 +4708,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
4295
4708
|
if (body.statements.length !== 0) {
|
|
4296
4709
|
return typeParserIssue("Block must have zero statements", void 0, node);
|
|
4297
4710
|
}
|
|
4298
|
-
return
|
|
4711
|
+
return succeed3({
|
|
4299
4712
|
node,
|
|
4300
4713
|
body,
|
|
4301
4714
|
returnType
|
|
@@ -4992,10 +5405,10 @@ var getOrMakeKeyBuilder = fn("getOrMakeKeyBuilder")(function* (sourceFile) {
|
|
|
4992
5405
|
keyBuilderCache.set(sourceFile.fileName, keyBuilder);
|
|
4993
5406
|
return keyBuilder;
|
|
4994
5407
|
});
|
|
4995
|
-
function createString(sourceFile,
|
|
5408
|
+
function createString(sourceFile, identifier2, kind) {
|
|
4996
5409
|
return map4(
|
|
4997
5410
|
getOrMakeKeyBuilder(sourceFile),
|
|
4998
|
-
(identifierBuilder) => identifierBuilder.createString(
|
|
5411
|
+
(identifierBuilder) => identifierBuilder.createString(identifier2, kind)
|
|
4999
5412
|
);
|
|
5000
5413
|
}
|
|
5001
5414
|
|
|
@@ -5047,7 +5460,7 @@ var deterministicKeys = createDiagnostic({
|
|
|
5047
5460
|
const parameterSourceFile = typeScriptUtils.getSourceFileOfNode(declaration);
|
|
5048
5461
|
const paramText = parameterSourceFile.text.substring(declaration.pos, declaration.end);
|
|
5049
5462
|
if (paramText.toLowerCase().includes("@effect-identifier")) {
|
|
5050
|
-
return
|
|
5463
|
+
return succeed3({ className, keyStringLiteral: arg, target: "custom" });
|
|
5051
5464
|
}
|
|
5052
5465
|
}
|
|
5053
5466
|
}
|
|
@@ -5342,7 +5755,7 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
5342
5755
|
const isWithSpan = yield* pipe(
|
|
5343
5756
|
typeParser.isNodeReferenceToEffectModuleApi("withSpan")(callee),
|
|
5344
5757
|
map4(() => true),
|
|
5345
|
-
orElse2(() =>
|
|
5758
|
+
orElse2(() => succeed3(false))
|
|
5346
5759
|
);
|
|
5347
5760
|
if (!isWithSpan) return void 0;
|
|
5348
5761
|
if (expr.arguments.length === 0) return void 0;
|
|
@@ -5355,8 +5768,8 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
5355
5768
|
if (!bodyExpression) return yield* TypeParserIssue.issue;
|
|
5356
5769
|
const { pipeArguments: pipeArguments2, subject } = yield* pipe(
|
|
5357
5770
|
typeParser.pipeCall(bodyExpression),
|
|
5358
|
-
map4(({ args:
|
|
5359
|
-
orElse2(() =>
|
|
5771
|
+
map4(({ args: args3, subject: subject2 }) => ({ subject: subject2, pipeArguments: args3 })),
|
|
5772
|
+
orElse2(() => succeed3({ subject: bodyExpression, pipeArguments: [] }))
|
|
5360
5773
|
);
|
|
5361
5774
|
const { effectModule, generatorFunction } = yield* typeParser.effectGen(subject);
|
|
5362
5775
|
const effectModuleName = ts.isIdentifier(effectModule) ? ts.idText(effectModule) : sourceEffectModuleName;
|
|
@@ -5373,17 +5786,17 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
5373
5786
|
const isInsideEffectFn = (fnNode) => {
|
|
5374
5787
|
const parent = fnNode.parent;
|
|
5375
5788
|
if (!parent || !ts.isCallExpression(parent)) {
|
|
5376
|
-
return
|
|
5789
|
+
return succeed3(false);
|
|
5377
5790
|
}
|
|
5378
5791
|
if (parent.arguments[0] !== fnNode) {
|
|
5379
|
-
return
|
|
5792
|
+
return succeed3(false);
|
|
5380
5793
|
}
|
|
5381
5794
|
return pipe(
|
|
5382
5795
|
typeParser.effectFn(parent),
|
|
5383
5796
|
orElse2(() => typeParser.effectFnGen(parent)),
|
|
5384
5797
|
orElse2(() => typeParser.effectFnUntracedGen(parent)),
|
|
5385
5798
|
map4(() => true),
|
|
5386
|
-
orElse2(() =>
|
|
5799
|
+
orElse2(() => succeed3(false))
|
|
5387
5800
|
);
|
|
5388
5801
|
};
|
|
5389
5802
|
const parseEffectFnOpportunityTargetGen = fn("effectFnOpportunity.parseEffectFnOpportunityTarget")(
|
|
@@ -5403,7 +5816,7 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
5403
5816
|
if (!body || !ts.isBlock(body) || body.statements.length <= 5) {
|
|
5404
5817
|
return TypeParserIssue.issue;
|
|
5405
5818
|
}
|
|
5406
|
-
return
|
|
5819
|
+
return succeed3({
|
|
5407
5820
|
effectModuleName: sourceEffectModuleName,
|
|
5408
5821
|
pipeArguments: [],
|
|
5409
5822
|
generatorFunction: void 0,
|
|
@@ -5602,7 +6015,7 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
5602
6015
|
}).join(", ");
|
|
5603
6016
|
const fnSignature = `function*${typeParamNames}(${paramNames}) { ... }`;
|
|
5604
6017
|
const pipeArgsForWithSpan = pipeArguments2.slice(0, -1);
|
|
5605
|
-
const pipeArgsSuffix = (
|
|
6018
|
+
const pipeArgsSuffix = (args3) => args3.length > 0 ? ", ...pipeTransformations" : "";
|
|
5606
6019
|
switch (firstFix.fixName) {
|
|
5607
6020
|
case "effectFnOpportunity_toEffectFnWithSpan": {
|
|
5608
6021
|
const traceName = explicitTraceExpression ? sourceFile.text.slice(explicitTraceExpression.pos, explicitTraceExpression.end).trim() : void 0;
|
|
@@ -5748,7 +6161,7 @@ var effectMapVoid = createDiagnostic({
|
|
|
5748
6161
|
() => pipe(
|
|
5749
6162
|
typeParser.lazyExpression(callback),
|
|
5750
6163
|
flatMap2(
|
|
5751
|
-
(lazy) => tsUtils.isVoidExpression(lazy.expression) ?
|
|
6164
|
+
(lazy) => tsUtils.isVoidExpression(lazy.expression) ? succeed3(lazy) : typeParserIssue("Expression is not void")
|
|
5752
6165
|
)
|
|
5753
6166
|
)
|
|
5754
6167
|
),
|
|
@@ -6409,11 +6822,11 @@ var leakingRequirements = createDiagnostic({
|
|
|
6409
6822
|
memory,
|
|
6410
6823
|
effectContextType,
|
|
6411
6824
|
(type) => {
|
|
6412
|
-
if (type.flags & ts.TypeFlags.Never) return
|
|
6825
|
+
if (type.flags & ts.TypeFlags.Never) return succeed3(true);
|
|
6413
6826
|
return pipe(
|
|
6414
6827
|
typeParser.scopeType(type, atLocation),
|
|
6415
6828
|
map4(() => true),
|
|
6416
|
-
orElse2(() =>
|
|
6829
|
+
orElse2(() => succeed3(false))
|
|
6417
6830
|
);
|
|
6418
6831
|
}
|
|
6419
6832
|
);
|
|
@@ -6828,7 +7241,7 @@ var missingEffectError = createDiagnostic({
|
|
|
6828
7241
|
map3((_) => _.literal),
|
|
6829
7242
|
filter((_) => ts.isLiteralExpression(_)),
|
|
6830
7243
|
map3((_) => _.text),
|
|
6831
|
-
sort(
|
|
7244
|
+
sort(String2),
|
|
6832
7245
|
map3(
|
|
6833
7246
|
(_) => ts.factory.createPropertyAssignment(
|
|
6834
7247
|
ts.factory.createIdentifier(_),
|
|
@@ -6921,7 +7334,7 @@ var missingEffectServiceDependency = createDiagnostic({
|
|
|
6921
7334
|
);
|
|
6922
7335
|
if (layerResult) {
|
|
6923
7336
|
const servicesMemory = /* @__PURE__ */ new Map();
|
|
6924
|
-
const excludeNever = (type) =>
|
|
7337
|
+
const excludeNever = (type) => succeed3((type.flags & ts.TypeFlags.Never) !== 0);
|
|
6925
7338
|
const { allIndexes: requiredIndexes } = yield* typeCheckerUtils.appendToUniqueTypesMap(
|
|
6926
7339
|
servicesMemory,
|
|
6927
7340
|
layerResult.RIn,
|
|
@@ -7437,13 +7850,13 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
|
|
|
7437
7850
|
atLocation2,
|
|
7438
7851
|
ts.NodeBuilderFlags.NoTruncation
|
|
7439
7852
|
);
|
|
7440
|
-
if (!successType) return
|
|
7853
|
+
if (!successType) return fail3("error generating success type");
|
|
7441
7854
|
const failureType = typeChecker.typeToTypeNode(
|
|
7442
7855
|
returnedEffect.E,
|
|
7443
7856
|
atLocation2,
|
|
7444
7857
|
ts.NodeBuilderFlags.NoTruncation
|
|
7445
7858
|
);
|
|
7446
|
-
if (!failureType) return
|
|
7859
|
+
if (!failureType) return fail3("error generating failure type");
|
|
7447
7860
|
const typeNode = ts.factory.createTypeReferenceNode(
|
|
7448
7861
|
ts.factory.createQualifiedName(
|
|
7449
7862
|
ts.factory.createIdentifier(effectIdentifier),
|
|
@@ -7451,7 +7864,7 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
|
|
|
7451
7864
|
),
|
|
7452
7865
|
[successType, failureType, contextType]
|
|
7453
7866
|
);
|
|
7454
|
-
return
|
|
7867
|
+
return succeed3(typeNode);
|
|
7455
7868
|
}),
|
|
7456
7869
|
orElse2(
|
|
7457
7870
|
() => pipe(
|
|
@@ -7462,8 +7875,8 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
|
|
|
7462
7875
|
atLocation2,
|
|
7463
7876
|
ts.NodeBuilderFlags.NoTruncation
|
|
7464
7877
|
);
|
|
7465
|
-
if (!successType) return
|
|
7466
|
-
return
|
|
7878
|
+
if (!successType) return fail3("error generating success type");
|
|
7879
|
+
return succeed3(ts.factory.createTypeReferenceNode(
|
|
7467
7880
|
ts.factory.createQualifiedName(
|
|
7468
7881
|
ts.factory.createIdentifier(effectIdentifier),
|
|
7469
7882
|
ts.factory.createIdentifier("Effect")
|
|
@@ -7484,7 +7897,7 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
|
|
|
7484
7897
|
),
|
|
7485
7898
|
orElse2(() => {
|
|
7486
7899
|
const successType = typeChecker.typeToTypeNode(type, atLocation2, ts.NodeBuilderFlags.NoTruncation);
|
|
7487
|
-
if (!successType) return
|
|
7900
|
+
if (!successType) return fail3("error generating success type");
|
|
7488
7901
|
const typeNode = ts.factory.createTypeReferenceNode(
|
|
7489
7902
|
ts.factory.createQualifiedName(
|
|
7490
7903
|
ts.factory.createIdentifier(effectIdentifier),
|
|
@@ -7496,7 +7909,7 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
|
|
|
7496
7909
|
ts.factory.createTypeReferenceNode(ts.idText(className2))
|
|
7497
7910
|
]
|
|
7498
7911
|
);
|
|
7499
|
-
return
|
|
7912
|
+
return succeed3(typeNode);
|
|
7500
7913
|
})
|
|
7501
7914
|
);
|
|
7502
7915
|
const proxySignature = fn("writeTagClassAccessors.proxySignature")(
|
|
@@ -7507,7 +7920,7 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
|
|
|
7507
7920
|
atLocation2,
|
|
7508
7921
|
ts.NodeBuilderFlags.NoTruncation
|
|
7509
7922
|
);
|
|
7510
|
-
if (!signatureDeclaration) return yield*
|
|
7923
|
+
if (!signatureDeclaration) return yield* fail3("error generating signature");
|
|
7511
7924
|
const returnType = yield* generateReturnType(
|
|
7512
7925
|
typeChecker.getReturnTypeOfSignature(signature),
|
|
7513
7926
|
atLocation2,
|
|
@@ -7556,21 +7969,21 @@ var parse2 = fn("writeTagClassAccessors.parse")(function* (node) {
|
|
|
7556
7969
|
const typeChecker = yield* service(TypeCheckerApi);
|
|
7557
7970
|
const typeParser = yield* service(TypeParser);
|
|
7558
7971
|
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
7559
|
-
if (typeParser.supportedEffect() === "v4") return yield*
|
|
7560
|
-
if (!ts.isClassDeclaration(node)) return yield*
|
|
7972
|
+
if (typeParser.supportedEffect() === "v4") return yield* fail3("not applicable to Effect v4");
|
|
7973
|
+
if (!ts.isClassDeclaration(node)) return yield* fail3("not a class declaration");
|
|
7561
7974
|
const { Service, accessors: accessors2, className, kind } = yield* pipe(
|
|
7562
7975
|
map4(typeParser.extendsEffectService(node), (_) => ({ kind: "effectService", ..._ })),
|
|
7563
7976
|
orElse2(
|
|
7564
7977
|
() => map4(typeParser.extendsEffectTag(node), (_) => ({ kind: "effectTag", accessors: true, ..._ }))
|
|
7565
7978
|
),
|
|
7566
|
-
orElse2(() =>
|
|
7979
|
+
orElse2(() => fail3("not a class extending Effect.Service call"))
|
|
7567
7980
|
);
|
|
7568
|
-
if (accessors2 !== true) return yield*
|
|
7981
|
+
if (accessors2 !== true) return yield* fail3("accessors are not enabled in the Effect.Service call");
|
|
7569
7982
|
const involvedMembers = [];
|
|
7570
7983
|
const nonPrimitiveServices = typeCheckerUtils.unrollUnionMembers(Service).filter(
|
|
7571
7984
|
(_) => !(_.flags & ts.TypeFlags.Number || _.flags & ts.TypeFlags.String || _.flags & ts.TypeFlags.Boolean || _.flags & ts.TypeFlags.Literal)
|
|
7572
7985
|
);
|
|
7573
|
-
if (nonPrimitiveServices.length === 0) return yield*
|
|
7986
|
+
if (nonPrimitiveServices.length === 0) return yield* fail3("Service type is a primitive type");
|
|
7574
7987
|
for (const serviceShape of nonPrimitiveServices) {
|
|
7575
7988
|
for (const property of typeChecker.getPropertiesOfType(serviceShape)) {
|
|
7576
7989
|
const propertyType = typeChecker.getTypeOfSymbolAtLocation(property, node);
|
|
@@ -7611,7 +8024,7 @@ var writeTagClassAccessors = createRefactor({
|
|
|
7611
8024
|
const parentNodes = tsUtils.getAncestorNodesInRange(sourceFile, textRange);
|
|
7612
8025
|
return yield* pipe(
|
|
7613
8026
|
firstSuccessOf(parentNodes.map(parseNode)),
|
|
7614
|
-
orElse2(() =>
|
|
8027
|
+
orElse2(() => fail3(new RefactorNotApplicableError()))
|
|
7615
8028
|
);
|
|
7616
8029
|
})
|
|
7617
8030
|
});
|
|
@@ -7626,7 +8039,7 @@ var accessors = createCodegen({
|
|
|
7626
8039
|
const typeParser = yield* service(TypeParser);
|
|
7627
8040
|
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
7628
8041
|
const nodeAndCommentRange = tsUtils.findNodeWithLeadingCommentAtPosition(sourceFile, textRange.pos);
|
|
7629
|
-
if (!nodeAndCommentRange) return yield*
|
|
8042
|
+
if (!nodeAndCommentRange) return yield* fail3(new CodegenNotApplicableError("no node and comment range"));
|
|
7630
8043
|
return yield* pipe(
|
|
7631
8044
|
parse2(nodeAndCommentRange.node),
|
|
7632
8045
|
map4(
|
|
@@ -7643,7 +8056,7 @@ var accessors = createCodegen({
|
|
|
7643
8056
|
)
|
|
7644
8057
|
})
|
|
7645
8058
|
),
|
|
7646
|
-
orElse2((cause) =>
|
|
8059
|
+
orElse2((cause) => fail3(new CodegenNotApplicableError(cause)))
|
|
7647
8060
|
);
|
|
7648
8061
|
})
|
|
7649
8062
|
});
|
|
@@ -7667,14 +8080,14 @@ var annotate = createCodegen({
|
|
|
7667
8080
|
variableDeclarations = [...variableDeclarations, node];
|
|
7668
8081
|
}
|
|
7669
8082
|
if (variableDeclarations.length === 0) {
|
|
7670
|
-
return yield*
|
|
8083
|
+
return yield* fail3(new CodegenNotApplicableError("not a variable declaration"));
|
|
7671
8084
|
}
|
|
7672
8085
|
for (const variableDeclaration of variableDeclarations) {
|
|
7673
8086
|
if (!variableDeclaration.initializer) continue;
|
|
7674
8087
|
const initializerType = typeCheckerUtils.getTypeAtLocation(variableDeclaration.initializer);
|
|
7675
8088
|
if (!initializerType) continue;
|
|
7676
8089
|
const enclosingNode = ts.findAncestor(variableDeclaration, (_) => tsUtils.isDeclarationKind(_.kind)) || sourceFile;
|
|
7677
|
-
const initializerTypeNode =
|
|
8090
|
+
const initializerTypeNode = fromNullishOr(typeCheckerUtils.typeToSimplifiedTypeNode(
|
|
7678
8091
|
initializerType,
|
|
7679
8092
|
enclosingNode,
|
|
7680
8093
|
ts.NodeBuilderFlags.NoTruncation | ts.NodeBuilderFlags.IgnoreErrors
|
|
@@ -7687,7 +8100,7 @@ var annotate = createCodegen({
|
|
|
7687
8100
|
result.push({ variableDeclaration, initializerTypeNode, hash: hash3 });
|
|
7688
8101
|
}
|
|
7689
8102
|
if (result.length === 0) {
|
|
7690
|
-
return yield*
|
|
8103
|
+
return yield* fail3(new CodegenNotApplicableError("no variable declarations with initializers"));
|
|
7691
8104
|
}
|
|
7692
8105
|
const hash2 = cyrb53(result.map((_) => _.hash).join("/"));
|
|
7693
8106
|
return {
|
|
@@ -7696,7 +8109,7 @@ var annotate = createCodegen({
|
|
|
7696
8109
|
};
|
|
7697
8110
|
});
|
|
7698
8111
|
const nodeAndCommentRange = tsUtils.findNodeWithLeadingCommentAtPosition(sourceFile, textRange.pos);
|
|
7699
|
-
if (!nodeAndCommentRange) return yield*
|
|
8112
|
+
if (!nodeAndCommentRange) return yield* fail3(new CodegenNotApplicableError("no node and comment range"));
|
|
7700
8113
|
return yield* pipe(
|
|
7701
8114
|
parse3(nodeAndCommentRange.node),
|
|
7702
8115
|
map4(
|
|
@@ -7757,13 +8170,13 @@ var makeStructuralSchemaGenContext = fn("StructuralSchemaGen.makeContext")(
|
|
|
7757
8170
|
ts.factory.createIdentifier(effectSchemaIdentifier),
|
|
7758
8171
|
apiName
|
|
7759
8172
|
),
|
|
7760
|
-
createApiCall: (apiName,
|
|
8173
|
+
createApiCall: (apiName, args3) => ts.factory.createCallExpression(
|
|
7761
8174
|
ts.factory.createPropertyAccessExpression(
|
|
7762
8175
|
ts.factory.createIdentifier(effectSchemaIdentifier),
|
|
7763
8176
|
apiName
|
|
7764
8177
|
),
|
|
7765
8178
|
[],
|
|
7766
|
-
|
|
8179
|
+
args3
|
|
7767
8180
|
),
|
|
7768
8181
|
hoistedSchemas: /* @__PURE__ */ new Map(),
|
|
7769
8182
|
typeToStatementIndex: /* @__PURE__ */ new Map(),
|
|
@@ -7813,7 +8226,7 @@ var processType = fn(
|
|
|
7813
8226
|
StructuralSchemaGenContext
|
|
7814
8227
|
);
|
|
7815
8228
|
if (processingContext.depth >= processingContext.maxDepth) {
|
|
7816
|
-
return yield*
|
|
8229
|
+
return yield* fail3(new UnsupportedTypeError(type, "Maximum depth exceeded"));
|
|
7817
8230
|
}
|
|
7818
8231
|
let hoistName = fromIterable(nameToType.entries()).find(([_, existingType]) => existingType === type)?.[0];
|
|
7819
8232
|
if (!hoistName && type && type.symbol && type.symbol.declarations && type.symbol.declarations.length === 1) {
|
|
@@ -7927,7 +8340,7 @@ var processTypeImpl = fn(
|
|
|
7927
8340
|
const objectType = type;
|
|
7928
8341
|
return yield* processObjectType(objectType, context);
|
|
7929
8342
|
}
|
|
7930
|
-
return yield*
|
|
8343
|
+
return yield* fail3(
|
|
7931
8344
|
new UnsupportedTypeError(
|
|
7932
8345
|
type,
|
|
7933
8346
|
`Type with flags ${type.flags} is not supported`
|
|
@@ -8007,7 +8420,7 @@ var processArrayType = fn(
|
|
|
8007
8420
|
const { createApiCall, typeChecker, typeCheckerUtils } = yield* service(StructuralSchemaGenContext);
|
|
8008
8421
|
const typeArgs = typeChecker.getTypeArguments(type);
|
|
8009
8422
|
if (typeArgs.length === 0) {
|
|
8010
|
-
return yield*
|
|
8423
|
+
return yield* fail3(new UnsupportedTypeError(type, "Array type has no type arguments"));
|
|
8011
8424
|
}
|
|
8012
8425
|
const elementSchema = yield* processType(typeArgs[0], context);
|
|
8013
8426
|
const expr = createApiCall("Array", [elementSchema]);
|
|
@@ -8083,7 +8496,7 @@ var processObjectType = fn(
|
|
|
8083
8496
|
);
|
|
8084
8497
|
}
|
|
8085
8498
|
const indexInfos = typeChecker.getIndexInfosOfType(type);
|
|
8086
|
-
const
|
|
8499
|
+
const args3 = [
|
|
8087
8500
|
ts.factory.createObjectLiteralExpression(propertyAssignments, propertyAssignments.length > 0)
|
|
8088
8501
|
];
|
|
8089
8502
|
const records = [];
|
|
@@ -8098,7 +8511,7 @@ var processObjectType = fn(
|
|
|
8098
8511
|
if (records.length > 0) {
|
|
8099
8512
|
return [
|
|
8100
8513
|
createApiCall("StructWithRest", [
|
|
8101
|
-
createApiCall("Struct",
|
|
8514
|
+
createApiCall("Struct", args3),
|
|
8102
8515
|
ts.factory.createArrayLiteralExpression(
|
|
8103
8516
|
records.map(({ key, value }) => createApiCall("Record", [key, value]))
|
|
8104
8517
|
)
|
|
@@ -8130,7 +8543,7 @@ var processObjectType = fn(
|
|
|
8130
8543
|
[ts.factory.createStringLiteral(context.hoistName)]
|
|
8131
8544
|
),
|
|
8132
8545
|
[],
|
|
8133
|
-
|
|
8546
|
+
args3
|
|
8134
8547
|
),
|
|
8135
8548
|
[]
|
|
8136
8549
|
)
|
|
@@ -8143,14 +8556,14 @@ var processObjectType = fn(
|
|
|
8143
8556
|
return [ctx.hoistedSchemas.get(type)(), true];
|
|
8144
8557
|
}
|
|
8145
8558
|
for (const { key, value } of records) {
|
|
8146
|
-
|
|
8559
|
+
args3.push(
|
|
8147
8560
|
ts.factory.createObjectLiteralExpression([
|
|
8148
8561
|
ts.factory.createPropertyAssignment("key", key),
|
|
8149
8562
|
ts.factory.createPropertyAssignment("value", value)
|
|
8150
8563
|
])
|
|
8151
8564
|
);
|
|
8152
8565
|
}
|
|
8153
|
-
return [createApiCall("Struct",
|
|
8566
|
+
return [createApiCall("Struct", args3), propertyAssignments.length === 0];
|
|
8154
8567
|
}
|
|
8155
8568
|
);
|
|
8156
8569
|
var findNodeToProcess = fn("StructuralSchemaGen.findNodeToProcess")(
|
|
@@ -8237,7 +8650,7 @@ var process = fn("StructuralSchemaGen.process")(
|
|
|
8237
8650
|
([name, type]) => pipe(
|
|
8238
8651
|
processType(type, createProcessingContext(typeParser.supportedEffect())),
|
|
8239
8652
|
orElse2(
|
|
8240
|
-
(error) =>
|
|
8653
|
+
(error) => succeed3(ts.addSyntheticLeadingComment(
|
|
8241
8654
|
ts.factory.createIdentifier(""),
|
|
8242
8655
|
ts.SyntaxKind.MultiLineCommentTrivia,
|
|
8243
8656
|
" " + String(error) + " ",
|
|
@@ -8310,10 +8723,10 @@ var process = fn("StructuralSchemaGen.process")(
|
|
|
8310
8723
|
}
|
|
8311
8724
|
);
|
|
8312
8725
|
var applyAtNode = fn("StructuralSchemaGen.applyAtNode")(
|
|
8313
|
-
function* (sourceFile, node,
|
|
8726
|
+
function* (sourceFile, node, identifier2, type, isExported) {
|
|
8314
8727
|
const changeTracker = yield* service(ChangeTracker);
|
|
8315
8728
|
const ts = yield* service(TypeScriptApi);
|
|
8316
|
-
const ctx = yield* process(sourceFile, node, /* @__PURE__ */ new Map([[ts.idText(
|
|
8729
|
+
const ctx = yield* process(sourceFile, node, /* @__PURE__ */ new Map([[ts.idText(identifier2), type]]), isExported, false);
|
|
8317
8730
|
for (const statement of ctx.schemaStatements) {
|
|
8318
8731
|
changeTracker.insertNodeAt(sourceFile, node.pos, statement, { prefix: "\n", suffix: "\n" });
|
|
8319
8732
|
}
|
|
@@ -8332,13 +8745,13 @@ var typeToSchema = createCodegen({
|
|
|
8332
8745
|
const program = yield* service(TypeScriptProgram);
|
|
8333
8746
|
const inThisFile = yield* getCodegensForSourceFile([typeToSchema], sourceFile);
|
|
8334
8747
|
if (inThisFile.length > 1) {
|
|
8335
|
-
return yield*
|
|
8748
|
+
return yield* fail3(
|
|
8336
8749
|
new CodegenNotApplicableError("the typeToSchema codegen can be used only once per file")
|
|
8337
8750
|
);
|
|
8338
8751
|
}
|
|
8339
8752
|
const parse3 = fn("typeToSchema.parse")(function* (node) {
|
|
8340
8753
|
if (!ts.isTypeAliasDeclaration(node)) {
|
|
8341
|
-
return yield*
|
|
8754
|
+
return yield* fail3(
|
|
8342
8755
|
new CodegenNotApplicableError(
|
|
8343
8756
|
"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
8757
|
)
|
|
@@ -8346,7 +8759,7 @@ var typeToSchema = createCodegen({
|
|
|
8346
8759
|
}
|
|
8347
8760
|
const type = typeCheckerUtils.getTypeAtLocation(node.name);
|
|
8348
8761
|
if (!type) {
|
|
8349
|
-
return yield*
|
|
8762
|
+
return yield* fail3(
|
|
8350
8763
|
new CodegenNotApplicableError(
|
|
8351
8764
|
"error getting the type to process"
|
|
8352
8765
|
)
|
|
@@ -8379,7 +8792,7 @@ var typeToSchema = createCodegen({
|
|
|
8379
8792
|
});
|
|
8380
8793
|
const nodeAndCommentRange = tsUtils.findNodeWithLeadingCommentAtPosition(sourceFile, textRange.pos);
|
|
8381
8794
|
if (!nodeAndCommentRange) {
|
|
8382
|
-
return yield*
|
|
8795
|
+
return yield* fail3(new CodegenNotApplicableError("no node and comment range affected"));
|
|
8383
8796
|
}
|
|
8384
8797
|
return yield* pipe(
|
|
8385
8798
|
parse3(nodeAndCommentRange.node),
|
|
@@ -8515,7 +8928,7 @@ var overriddenSchemaConstructor = createDiagnostic({
|
|
|
8515
8928
|
const isSchema = yield* pipe(
|
|
8516
8929
|
typeParser.effectSchemaType(typeAtLocation, type.expression),
|
|
8517
8930
|
map4(() => true),
|
|
8518
|
-
orElse2(() =>
|
|
8931
|
+
orElse2(() => succeed3(false))
|
|
8519
8932
|
);
|
|
8520
8933
|
if (isSchema) {
|
|
8521
8934
|
extendsSchema = true;
|
|
@@ -9122,11 +9535,11 @@ var schemaUnionOfLiterals = createDiagnostic({
|
|
|
9122
9535
|
orElse2(() => void_)
|
|
9123
9536
|
);
|
|
9124
9537
|
if (isSchemaUnionCall) {
|
|
9125
|
-
const
|
|
9126
|
-
if (
|
|
9127
|
-
const allAreCallExpressions =
|
|
9538
|
+
const args3 = fromIterable(node.arguments);
|
|
9539
|
+
if (args3.length >= 2) {
|
|
9540
|
+
const allAreCallExpressions = args3.every((arg) => ts.isCallExpression(arg));
|
|
9128
9541
|
if (allAreCallExpressions) {
|
|
9129
|
-
const literalChecks =
|
|
9542
|
+
const literalChecks = args3.map((arg) => {
|
|
9130
9543
|
const callArg = arg;
|
|
9131
9544
|
return pipe(
|
|
9132
9545
|
typeParser.isNodeReferenceToEffectSchemaModuleApi("Literal")(callArg.expression),
|
|
@@ -9632,8 +10045,8 @@ var unnecessaryPipe = createDiagnostic({
|
|
|
9632
10045
|
if (ts.isCallExpression(node)) {
|
|
9633
10046
|
yield* pipe(
|
|
9634
10047
|
typeParser.pipeCall(node),
|
|
9635
|
-
map4(({ args:
|
|
9636
|
-
if (
|
|
10048
|
+
map4(({ args: args3, subject }) => {
|
|
10049
|
+
if (args3.length === 0) {
|
|
9637
10050
|
report({
|
|
9638
10051
|
location: node,
|
|
9639
10052
|
messageText: `This pipe call contains no arguments.`,
|
|
@@ -9752,7 +10165,7 @@ var unsupportedServiceAccessors = createDiagnostic({
|
|
|
9752
10165
|
if (ts.isClassDeclaration(node)) {
|
|
9753
10166
|
const parseResult = yield* pipe(
|
|
9754
10167
|
parse2(node),
|
|
9755
|
-
orElse2(() =>
|
|
10168
|
+
orElse2(() => succeed3(null))
|
|
9756
10169
|
);
|
|
9757
10170
|
if (parseResult && parseResult.involvedMembers.length > 0) {
|
|
9758
10171
|
const existingStaticMembers = /* @__PURE__ */ new Set();
|
|
@@ -9896,7 +10309,7 @@ function checkSourceFileWorker(tsInstance, program, sourceFile, compilerOptions,
|
|
|
9896
10309
|
return _;
|
|
9897
10310
|
})
|
|
9898
10311
|
),
|
|
9899
|
-
|
|
10312
|
+
getOrElse2((e) => {
|
|
9900
10313
|
console.error(e.message, "at", e.lastSpan);
|
|
9901
10314
|
return [];
|
|
9902
10315
|
}),
|