@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
package/transform.js
CHANGED
|
@@ -24,15 +24,44 @@ __export(transform_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(transform_exports);
|
|
26
26
|
|
|
27
|
-
// ../../node_modules/.pnpm/effect@
|
|
28
|
-
var
|
|
27
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/Pipeable.js
|
|
28
|
+
var pipeArguments = (self, args3) => {
|
|
29
|
+
switch (args3.length) {
|
|
30
|
+
case 0:
|
|
31
|
+
return self;
|
|
32
|
+
case 1:
|
|
33
|
+
return args3[0](self);
|
|
34
|
+
case 2:
|
|
35
|
+
return args3[1](args3[0](self));
|
|
36
|
+
case 3:
|
|
37
|
+
return args3[2](args3[1](args3[0](self)));
|
|
38
|
+
case 4:
|
|
39
|
+
return args3[3](args3[2](args3[1](args3[0](self))));
|
|
40
|
+
case 5:
|
|
41
|
+
return args3[4](args3[3](args3[2](args3[1](args3[0](self)))));
|
|
42
|
+
case 6:
|
|
43
|
+
return args3[5](args3[4](args3[3](args3[2](args3[1](args3[0](self))))));
|
|
44
|
+
case 7:
|
|
45
|
+
return args3[6](args3[5](args3[4](args3[3](args3[2](args3[1](args3[0](self)))))));
|
|
46
|
+
case 8:
|
|
47
|
+
return args3[7](args3[6](args3[5](args3[4](args3[3](args3[2](args3[1](args3[0](self))))))));
|
|
48
|
+
case 9:
|
|
49
|
+
return args3[8](args3[7](args3[6](args3[5](args3[4](args3[3](args3[2](args3[1](args3[0](self)))))))));
|
|
50
|
+
default: {
|
|
51
|
+
let ret = self;
|
|
52
|
+
for (let i = 0, len = args3.length; i < len; i++) {
|
|
53
|
+
ret = args3[i](ret);
|
|
54
|
+
}
|
|
55
|
+
return ret;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/Function.js
|
|
29
61
|
var dual = function(arity, body) {
|
|
30
62
|
if (typeof arity === "function") {
|
|
31
63
|
return function() {
|
|
32
|
-
|
|
33
|
-
return body.apply(this, arguments);
|
|
34
|
-
}
|
|
35
|
-
return (self) => body(self, ...arguments);
|
|
64
|
+
return arity(arguments) ? body.apply(this, arguments) : (self) => body(self, ...arguments);
|
|
36
65
|
};
|
|
37
66
|
}
|
|
38
67
|
switch (arity) {
|
|
@@ -57,32 +86,14 @@ var dual = function(arity, body) {
|
|
|
57
86
|
return body(self, a, b);
|
|
58
87
|
};
|
|
59
88
|
};
|
|
60
|
-
case 4:
|
|
61
|
-
return function(a, b, c, d) {
|
|
62
|
-
if (arguments.length >= 4) {
|
|
63
|
-
return body(a, b, c, d);
|
|
64
|
-
}
|
|
65
|
-
return function(self) {
|
|
66
|
-
return body(self, a, b, c);
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
case 5:
|
|
70
|
-
return function(a, b, c, d, e) {
|
|
71
|
-
if (arguments.length >= 5) {
|
|
72
|
-
return body(a, b, c, d, e);
|
|
73
|
-
}
|
|
74
|
-
return function(self) {
|
|
75
|
-
return body(self, a, b, c, d);
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
89
|
default:
|
|
79
90
|
return function() {
|
|
80
91
|
if (arguments.length >= arity) {
|
|
81
92
|
return body.apply(this, arguments);
|
|
82
93
|
}
|
|
83
|
-
const
|
|
94
|
+
const args3 = arguments;
|
|
84
95
|
return function(self) {
|
|
85
|
-
return body(self, ...
|
|
96
|
+
return body(self, ...args3);
|
|
86
97
|
};
|
|
87
98
|
};
|
|
88
99
|
}
|
|
@@ -90,189 +101,57 @@ var dual = function(arity, body) {
|
|
|
90
101
|
var identity = (a) => a;
|
|
91
102
|
var constant = (value) => () => value;
|
|
92
103
|
var constUndefined = /* @__PURE__ */ constant(void 0);
|
|
93
|
-
function pipe(a,
|
|
94
|
-
|
|
95
|
-
case 1:
|
|
96
|
-
return a;
|
|
97
|
-
case 2:
|
|
98
|
-
return ab(a);
|
|
99
|
-
case 3:
|
|
100
|
-
return bc(ab(a));
|
|
101
|
-
case 4:
|
|
102
|
-
return cd(bc(ab(a)));
|
|
103
|
-
case 5:
|
|
104
|
-
return de(cd(bc(ab(a))));
|
|
105
|
-
case 6:
|
|
106
|
-
return ef(de(cd(bc(ab(a)))));
|
|
107
|
-
case 7:
|
|
108
|
-
return fg(ef(de(cd(bc(ab(a))))));
|
|
109
|
-
case 8:
|
|
110
|
-
return gh(fg(ef(de(cd(bc(ab(a)))))));
|
|
111
|
-
case 9:
|
|
112
|
-
return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
|
|
113
|
-
default: {
|
|
114
|
-
let ret = arguments[0];
|
|
115
|
-
for (let i = 1; i < arguments.length; i++) {
|
|
116
|
-
ret = arguments[i](ret);
|
|
117
|
-
}
|
|
118
|
-
return ret;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
104
|
+
function pipe(a, ...args3) {
|
|
105
|
+
return pipeArguments(a, args3);
|
|
121
106
|
}
|
|
122
107
|
|
|
123
|
-
// ../../node_modules/.pnpm/effect@
|
|
124
|
-
var
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
108
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/internal/equal.js
|
|
109
|
+
var getAllObjectKeys = (obj) => {
|
|
110
|
+
const keys2 = new Set(Reflect.ownKeys(obj));
|
|
111
|
+
if (obj.constructor === Object) return keys2;
|
|
112
|
+
if (obj instanceof Error) {
|
|
113
|
+
keys2.delete("stack");
|
|
114
|
+
}
|
|
115
|
+
const proto = Object.getPrototypeOf(obj);
|
|
116
|
+
let current = proto;
|
|
117
|
+
while (current !== null && current !== Object.prototype) {
|
|
118
|
+
const ownKeys = Reflect.ownKeys(current);
|
|
119
|
+
for (let i = 0; i < ownKeys.length; i++) {
|
|
120
|
+
keys2.add(ownKeys[i]);
|
|
121
|
+
}
|
|
122
|
+
current = Object.getPrototypeOf(current);
|
|
123
|
+
}
|
|
124
|
+
if (keys2.has("constructor") && typeof obj.constructor === "function" && proto === obj.constructor.prototype) {
|
|
125
|
+
keys2.delete("constructor");
|
|
126
|
+
}
|
|
127
|
+
return keys2;
|
|
135
128
|
};
|
|
129
|
+
var byReferenceInstances = /* @__PURE__ */ new WeakSet();
|
|
136
130
|
|
|
137
|
-
// ../../node_modules/.pnpm/effect@
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
get _F() {
|
|
158
|
-
return identity;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* @since 2.0.0
|
|
162
|
-
*/
|
|
163
|
-
get _R() {
|
|
164
|
-
return (_) => _;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* @since 2.0.0
|
|
168
|
-
*/
|
|
169
|
-
get _O() {
|
|
170
|
-
return (_) => _;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* @since 2.0.0
|
|
174
|
-
*/
|
|
175
|
-
get _E() {
|
|
176
|
-
return (_) => _;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* @since 2.0.0
|
|
180
|
-
*/
|
|
181
|
-
[GenKindTypeId] = GenKindTypeId;
|
|
182
|
-
/**
|
|
183
|
-
* @since 2.0.0
|
|
184
|
-
*/
|
|
185
|
-
[Symbol.iterator]() {
|
|
186
|
-
return new SingleShotGen(this);
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
var SingleShotGen = class _SingleShotGen {
|
|
190
|
-
self;
|
|
191
|
-
called = false;
|
|
192
|
-
constructor(self) {
|
|
193
|
-
this.self = self;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* @since 2.0.0
|
|
197
|
-
*/
|
|
198
|
-
next(a) {
|
|
199
|
-
return this.called ? {
|
|
200
|
-
value: a,
|
|
201
|
-
done: true
|
|
202
|
-
} : (this.called = true, {
|
|
203
|
-
value: this.self,
|
|
204
|
-
done: false
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* @since 2.0.0
|
|
209
|
-
*/
|
|
210
|
-
return(a) {
|
|
211
|
-
return {
|
|
212
|
-
value: a,
|
|
213
|
-
done: true
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* @since 2.0.0
|
|
218
|
-
*/
|
|
219
|
-
throw(e) {
|
|
220
|
-
throw e;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* @since 2.0.0
|
|
224
|
-
*/
|
|
225
|
-
[Symbol.iterator]() {
|
|
226
|
-
return new _SingleShotGen(this.self);
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
var MUL_HI = 1481765933 >>> 0;
|
|
230
|
-
var MUL_LO = 1284865837 >>> 0;
|
|
231
|
-
var YieldWrapTypeId = /* @__PURE__ */ Symbol.for("effect/Utils/YieldWrap");
|
|
232
|
-
var YieldWrap = class {
|
|
233
|
-
/**
|
|
234
|
-
* @since 3.0.6
|
|
235
|
-
*/
|
|
236
|
-
#value;
|
|
237
|
-
constructor(value) {
|
|
238
|
-
this.#value = value;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* @since 3.0.6
|
|
242
|
-
*/
|
|
243
|
-
[YieldWrapTypeId]() {
|
|
244
|
-
return this.#value;
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
var structuralRegionState = /* @__PURE__ */ globalValue("effect/Utils/isStructuralRegion", () => ({
|
|
248
|
-
enabled: false,
|
|
249
|
-
tester: void 0
|
|
250
|
-
}));
|
|
251
|
-
var standard = {
|
|
252
|
-
effect_internal_function: (body) => {
|
|
253
|
-
return body();
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
var forced = {
|
|
257
|
-
effect_internal_function: (body) => {
|
|
258
|
-
try {
|
|
259
|
-
return body();
|
|
260
|
-
} finally {
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
var isNotOptimizedAway = /* @__PURE__ */ standard.effect_internal_function(() => new Error().stack)?.includes("effect_internal_function") === true;
|
|
265
|
-
var internalCall = isNotOptimizedAway ? standard.effect_internal_function : forced.effect_internal_function;
|
|
266
|
-
var genConstructor = function* () {
|
|
267
|
-
}.constructor;
|
|
131
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/Predicate.js
|
|
132
|
+
function isString(input) {
|
|
133
|
+
return typeof input === "string";
|
|
134
|
+
}
|
|
135
|
+
function isNumber(input) {
|
|
136
|
+
return typeof input === "number";
|
|
137
|
+
}
|
|
138
|
+
function isBoolean(input) {
|
|
139
|
+
return typeof input === "boolean";
|
|
140
|
+
}
|
|
141
|
+
function isFunction(input) {
|
|
142
|
+
return typeof input === "function";
|
|
143
|
+
}
|
|
144
|
+
function isObject(input) {
|
|
145
|
+
return typeof input === "object" && input !== null && !Array.isArray(input);
|
|
146
|
+
}
|
|
147
|
+
function isObjectKeyword(input) {
|
|
148
|
+
return typeof input === "object" && input !== null || isFunction(input);
|
|
149
|
+
}
|
|
150
|
+
var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObjectKeyword(self) && property in self);
|
|
268
151
|
|
|
269
|
-
// ../../node_modules/.pnpm/effect@
|
|
270
|
-
var
|
|
271
|
-
var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
|
|
152
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/Hash.js
|
|
153
|
+
var symbol = "~effect/interfaces/Hash";
|
|
272
154
|
var hash = (self) => {
|
|
273
|
-
if (structuralRegionState.enabled === true) {
|
|
274
|
-
return 0;
|
|
275
|
-
}
|
|
276
155
|
switch (typeof self) {
|
|
277
156
|
case "number":
|
|
278
157
|
return number(self);
|
|
@@ -291,16 +170,32 @@ var hash = (self) => {
|
|
|
291
170
|
if (self === null) {
|
|
292
171
|
return string("null");
|
|
293
172
|
} else if (self instanceof Date) {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
return hash(self.toISOString());
|
|
298
|
-
} else if (self instanceof URL) {
|
|
299
|
-
return hash(self.href);
|
|
300
|
-
} else if (isHash(self)) {
|
|
301
|
-
return self[symbol]();
|
|
173
|
+
return string(self.toISOString());
|
|
174
|
+
} else if (self instanceof RegExp) {
|
|
175
|
+
return string(self.toString());
|
|
302
176
|
} else {
|
|
303
|
-
|
|
177
|
+
if (byReferenceInstances.has(self)) {
|
|
178
|
+
return random(self);
|
|
179
|
+
}
|
|
180
|
+
if (hashCache.has(self)) {
|
|
181
|
+
return hashCache.get(self);
|
|
182
|
+
}
|
|
183
|
+
const h = withVisitedTracking(self, () => {
|
|
184
|
+
if (isHash(self)) {
|
|
185
|
+
return self[symbol]();
|
|
186
|
+
} else if (typeof self === "function") {
|
|
187
|
+
return random(self);
|
|
188
|
+
} else if (Array.isArray(self)) {
|
|
189
|
+
return array(self);
|
|
190
|
+
} else if (self instanceof Map) {
|
|
191
|
+
return hashMap(self);
|
|
192
|
+
} else if (self instanceof Set) {
|
|
193
|
+
return hashSet(self);
|
|
194
|
+
}
|
|
195
|
+
return structure(self);
|
|
196
|
+
});
|
|
197
|
+
hashCache.set(self, h);
|
|
198
|
+
return h;
|
|
304
199
|
}
|
|
305
200
|
}
|
|
306
201
|
default:
|
|
@@ -313,12 +208,18 @@ var random = (self) => {
|
|
|
313
208
|
}
|
|
314
209
|
return randomHashCache.get(self);
|
|
315
210
|
};
|
|
316
|
-
var combine =
|
|
211
|
+
var combine = /* @__PURE__ */ dual(2, (self, b) => self * 53 ^ b);
|
|
317
212
|
var optimize = (n) => n & 3221225471 | n >>> 1 & 1073741824;
|
|
318
213
|
var isHash = (u) => hasProperty(u, symbol);
|
|
319
214
|
var number = (n) => {
|
|
320
|
-
if (n !== n
|
|
321
|
-
return
|
|
215
|
+
if (n !== n) {
|
|
216
|
+
return string("NaN");
|
|
217
|
+
}
|
|
218
|
+
if (n === Infinity) {
|
|
219
|
+
return string("Infinity");
|
|
220
|
+
}
|
|
221
|
+
if (n === -Infinity) {
|
|
222
|
+
return string("-Infinity");
|
|
322
223
|
}
|
|
323
224
|
let h = n | 0;
|
|
324
225
|
if (h !== n) {
|
|
@@ -338,38 +239,37 @@ var string = (str) => {
|
|
|
338
239
|
};
|
|
339
240
|
var structureKeys = (o, keys2) => {
|
|
340
241
|
let h = 12289;
|
|
341
|
-
for (
|
|
342
|
-
h ^=
|
|
242
|
+
for (const key of keys2) {
|
|
243
|
+
h ^= combine(hash(key), hash(o[key]));
|
|
343
244
|
}
|
|
344
245
|
return optimize(h);
|
|
345
246
|
};
|
|
346
|
-
var structure = (o) => structureKeys(o,
|
|
347
|
-
var
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
Object.defineProperty(self2, symbol, {
|
|
352
|
-
value() {
|
|
353
|
-
return hash3;
|
|
354
|
-
},
|
|
355
|
-
enumerable: false
|
|
356
|
-
});
|
|
357
|
-
return hash3;
|
|
358
|
-
};
|
|
247
|
+
var structure = (o) => structureKeys(o, getAllObjectKeys(o));
|
|
248
|
+
var iterableWith = (seed, f) => (iter) => {
|
|
249
|
+
let h = seed;
|
|
250
|
+
for (const element of iter) {
|
|
251
|
+
h ^= f(element);
|
|
359
252
|
}
|
|
360
|
-
|
|
361
|
-
const hash2 = arguments[1];
|
|
362
|
-
Object.defineProperty(self, symbol, {
|
|
363
|
-
value() {
|
|
364
|
-
return hash2;
|
|
365
|
-
},
|
|
366
|
-
enumerable: false
|
|
367
|
-
});
|
|
368
|
-
return hash2;
|
|
253
|
+
return optimize(h);
|
|
369
254
|
};
|
|
255
|
+
var array = /* @__PURE__ */ iterableWith(6151, hash);
|
|
256
|
+
var hashMap = /* @__PURE__ */ iterableWith(/* @__PURE__ */ string("Map"), ([k, v]) => combine(hash(k), hash(v)));
|
|
257
|
+
var hashSet = /* @__PURE__ */ iterableWith(/* @__PURE__ */ string("Set"), hash);
|
|
258
|
+
var randomHashCache = /* @__PURE__ */ new WeakMap();
|
|
259
|
+
var hashCache = /* @__PURE__ */ new WeakMap();
|
|
260
|
+
var visitedObjects = /* @__PURE__ */ new WeakSet();
|
|
261
|
+
function withVisitedTracking(obj, fn2) {
|
|
262
|
+
if (visitedObjects.has(obj)) {
|
|
263
|
+
return string("[Circular]");
|
|
264
|
+
}
|
|
265
|
+
visitedObjects.add(obj);
|
|
266
|
+
const result = fn2();
|
|
267
|
+
visitedObjects.delete(obj);
|
|
268
|
+
return result;
|
|
269
|
+
}
|
|
370
270
|
|
|
371
|
-
// ../../node_modules/.pnpm/effect@
|
|
372
|
-
var symbol2 =
|
|
271
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/Equal.js
|
|
272
|
+
var symbol2 = "~effect/interfaces/Equal";
|
|
373
273
|
function equals() {
|
|
374
274
|
if (arguments.length === 1) {
|
|
375
275
|
return (self) => compareBoth(self, arguments[0]);
|
|
@@ -377,71 +277,274 @@ function equals() {
|
|
|
377
277
|
return compareBoth(arguments[0], arguments[1]);
|
|
378
278
|
}
|
|
379
279
|
function compareBoth(self, that) {
|
|
380
|
-
if (self === that)
|
|
381
|
-
|
|
382
|
-
}
|
|
280
|
+
if (self === that) return true;
|
|
281
|
+
if (self == null || that == null) return false;
|
|
383
282
|
const selfType = typeof self;
|
|
384
283
|
if (selfType !== typeof that) {
|
|
385
284
|
return false;
|
|
386
285
|
}
|
|
387
|
-
if (selfType === "
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
286
|
+
if (selfType === "number" && self !== self && that !== that) {
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
if (selfType !== "object" && selfType !== "function") {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
if (byReferenceInstances.has(self) || byReferenceInstances.has(that)) {
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
return withCache(self, that, compareObjects);
|
|
296
|
+
}
|
|
297
|
+
function withVisitedTracking2(self, that, fn2) {
|
|
298
|
+
const hasLeft = visitedLeft.has(self);
|
|
299
|
+
const hasRight = visitedRight.has(that);
|
|
300
|
+
if (hasLeft && hasRight) {
|
|
301
|
+
return true;
|
|
302
|
+
}
|
|
303
|
+
if (hasLeft || hasRight) {
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
visitedLeft.add(self);
|
|
307
|
+
visitedRight.add(that);
|
|
308
|
+
const result = fn2();
|
|
309
|
+
visitedLeft.delete(self);
|
|
310
|
+
visitedRight.delete(that);
|
|
311
|
+
return result;
|
|
312
|
+
}
|
|
313
|
+
var visitedLeft = /* @__PURE__ */ new WeakSet();
|
|
314
|
+
var visitedRight = /* @__PURE__ */ new WeakSet();
|
|
315
|
+
function compareObjects(self, that) {
|
|
316
|
+
if (hash(self) !== hash(that)) {
|
|
317
|
+
return false;
|
|
318
|
+
} else if (self instanceof Date) {
|
|
319
|
+
if (!(that instanceof Date)) return false;
|
|
320
|
+
return self.toISOString() === that.toISOString();
|
|
321
|
+
} else if (self instanceof RegExp) {
|
|
322
|
+
if (!(that instanceof RegExp)) return false;
|
|
323
|
+
return self.toString() === that.toString();
|
|
324
|
+
}
|
|
325
|
+
const selfIsEqual = isEqual(self);
|
|
326
|
+
const thatIsEqual = isEqual(that);
|
|
327
|
+
if (selfIsEqual !== thatIsEqual) return false;
|
|
328
|
+
const bothEquals = selfIsEqual && thatIsEqual;
|
|
329
|
+
if (typeof self === "function" && !bothEquals) {
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
332
|
+
return withVisitedTracking2(self, that, () => {
|
|
333
|
+
if (bothEquals) {
|
|
334
|
+
return self[symbol2](that);
|
|
335
|
+
} else if (Array.isArray(self)) {
|
|
336
|
+
if (!Array.isArray(that) || self.length !== that.length) {
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
return compareArrays(self, that);
|
|
340
|
+
} else if (self instanceof Map) {
|
|
341
|
+
if (!(that instanceof Map) || self.size !== that.size) {
|
|
342
|
+
return false;
|
|
418
343
|
}
|
|
419
|
-
return
|
|
344
|
+
return compareMaps(self, that);
|
|
345
|
+
} else if (self instanceof Set) {
|
|
346
|
+
if (!(that instanceof Set) || self.size !== that.size) {
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
return compareSets(self, that);
|
|
350
|
+
}
|
|
351
|
+
return compareRecords(self, that);
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
function withCache(self, that, f) {
|
|
355
|
+
let selfMap = equalityCache.get(self);
|
|
356
|
+
if (!selfMap) {
|
|
357
|
+
selfMap = /* @__PURE__ */ new WeakMap();
|
|
358
|
+
equalityCache.set(self, selfMap);
|
|
359
|
+
} else if (selfMap.has(that)) {
|
|
360
|
+
return selfMap.get(that);
|
|
361
|
+
}
|
|
362
|
+
const result = f(self, that);
|
|
363
|
+
selfMap.set(that, result);
|
|
364
|
+
let thatMap = equalityCache.get(that);
|
|
365
|
+
if (!thatMap) {
|
|
366
|
+
thatMap = /* @__PURE__ */ new WeakMap();
|
|
367
|
+
equalityCache.set(that, thatMap);
|
|
368
|
+
}
|
|
369
|
+
thatMap.set(self, result);
|
|
370
|
+
return result;
|
|
371
|
+
}
|
|
372
|
+
var equalityCache = /* @__PURE__ */ new WeakMap();
|
|
373
|
+
function compareArrays(self, that) {
|
|
374
|
+
for (let i = 0; i < self.length; i++) {
|
|
375
|
+
if (!compareBoth(self[i], that[i])) {
|
|
376
|
+
return false;
|
|
420
377
|
}
|
|
421
378
|
}
|
|
422
|
-
return
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
function compareRecords(self, that) {
|
|
382
|
+
const selfKeys = getAllObjectKeys(self);
|
|
383
|
+
const thatKeys = getAllObjectKeys(that);
|
|
384
|
+
if (selfKeys.size !== thatKeys.size) {
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
for (const key of selfKeys) {
|
|
388
|
+
if (!thatKeys.has(key) || !compareBoth(self[key], that[key])) {
|
|
389
|
+
return false;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return true;
|
|
393
|
+
}
|
|
394
|
+
function makeCompareMap(keyEquivalence, valueEquivalence) {
|
|
395
|
+
return function compareMaps2(self, that) {
|
|
396
|
+
for (const [selfKey, selfValue] of self) {
|
|
397
|
+
let found = false;
|
|
398
|
+
for (const [thatKey, thatValue] of that) {
|
|
399
|
+
if (keyEquivalence(selfKey, thatKey) && valueEquivalence(selfValue, thatValue)) {
|
|
400
|
+
found = true;
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
if (!found) {
|
|
405
|
+
return false;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return true;
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
var compareMaps = /* @__PURE__ */ makeCompareMap(compareBoth, compareBoth);
|
|
412
|
+
function makeCompareSet(equivalence) {
|
|
413
|
+
return function compareSets2(self, that) {
|
|
414
|
+
for (const selfValue of self) {
|
|
415
|
+
let found = false;
|
|
416
|
+
for (const thatValue of that) {
|
|
417
|
+
if (equivalence(selfValue, thatValue)) {
|
|
418
|
+
found = true;
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
if (!found) {
|
|
423
|
+
return false;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return true;
|
|
427
|
+
};
|
|
423
428
|
}
|
|
429
|
+
var compareSets = /* @__PURE__ */ makeCompareSet(compareBoth);
|
|
424
430
|
var isEqual = (u) => hasProperty(u, symbol2);
|
|
425
|
-
var
|
|
431
|
+
var asEquivalence = () => equals;
|
|
432
|
+
|
|
433
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/Redactable.js
|
|
434
|
+
var symbolRedactable = /* @__PURE__ */ Symbol.for("~effect/Inspectable/redactable");
|
|
435
|
+
var isRedactable = (u) => hasProperty(u, symbolRedactable);
|
|
436
|
+
function redact(u) {
|
|
437
|
+
if (isRedactable(u)) return getRedacted(u);
|
|
438
|
+
return u;
|
|
439
|
+
}
|
|
440
|
+
function getRedacted(redactable) {
|
|
441
|
+
return redactable[symbolRedactable](globalThis[currentFiberTypeId]?.services ?? emptyServiceMap);
|
|
442
|
+
}
|
|
443
|
+
var currentFiberTypeId = "~effect/Fiber/currentFiber";
|
|
444
|
+
var emptyServiceMap = {
|
|
445
|
+
"~effect/ServiceMap": {},
|
|
446
|
+
mapUnsafe: /* @__PURE__ */ new Map(),
|
|
447
|
+
pipe() {
|
|
448
|
+
return pipeArguments(this, arguments);
|
|
449
|
+
}
|
|
450
|
+
};
|
|
426
451
|
|
|
427
|
-
// ../../node_modules/.pnpm/effect@
|
|
452
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/Formatter.js
|
|
453
|
+
function format(input, options) {
|
|
454
|
+
const space = options?.space ?? 0;
|
|
455
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
456
|
+
const gap = !space ? "" : typeof space === "number" ? " ".repeat(space) : space;
|
|
457
|
+
const ind = (d) => gap.repeat(d);
|
|
458
|
+
const wrap = (v, body) => {
|
|
459
|
+
const ctor = v?.constructor;
|
|
460
|
+
return ctor && ctor !== Object.prototype.constructor && ctor.name ? `${ctor.name}(${body})` : body;
|
|
461
|
+
};
|
|
462
|
+
const ownKeys = (o) => {
|
|
463
|
+
try {
|
|
464
|
+
return Reflect.ownKeys(o);
|
|
465
|
+
} catch {
|
|
466
|
+
return ["[ownKeys threw]"];
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
function recur(v, d = 0) {
|
|
470
|
+
if (Array.isArray(v)) {
|
|
471
|
+
if (seen.has(v)) return CIRCULAR;
|
|
472
|
+
seen.add(v);
|
|
473
|
+
if (!gap || v.length <= 1) return `[${v.map((x) => recur(x, d)).join(",")}]`;
|
|
474
|
+
const inner = v.map((x) => recur(x, d + 1)).join(",\n" + ind(d + 1));
|
|
475
|
+
return `[
|
|
476
|
+
${ind(d + 1)}${inner}
|
|
477
|
+
${ind(d)}]`;
|
|
478
|
+
}
|
|
479
|
+
if (v instanceof Date) return formatDate(v);
|
|
480
|
+
if (!options?.ignoreToString && hasProperty(v, "toString") && typeof v["toString"] === "function" && v["toString"] !== Object.prototype.toString && v["toString"] !== Array.prototype.toString) {
|
|
481
|
+
const s = safeToString(v);
|
|
482
|
+
if (v instanceof Error && v.cause) {
|
|
483
|
+
return `${s} (cause: ${recur(v.cause, d)})`;
|
|
484
|
+
}
|
|
485
|
+
return s;
|
|
486
|
+
}
|
|
487
|
+
if (typeof v === "string") return JSON.stringify(v);
|
|
488
|
+
if (typeof v === "number" || v == null || typeof v === "boolean" || typeof v === "symbol") return String(v);
|
|
489
|
+
if (typeof v === "bigint") return String(v) + "n";
|
|
490
|
+
if (typeof v === "object" || typeof v === "function") {
|
|
491
|
+
if (seen.has(v)) return CIRCULAR;
|
|
492
|
+
seen.add(v);
|
|
493
|
+
if (symbolRedactable in v) return format(getRedacted(v));
|
|
494
|
+
if (Symbol.iterator in v) {
|
|
495
|
+
return `${v.constructor.name}(${recur(Array.from(v), d)})`;
|
|
496
|
+
}
|
|
497
|
+
const keys2 = ownKeys(v);
|
|
498
|
+
if (!gap || keys2.length <= 1) {
|
|
499
|
+
const body2 = `{${keys2.map((k) => `${formatPropertyKey(k)}:${recur(v[k], d)}`).join(",")}}`;
|
|
500
|
+
return wrap(v, body2);
|
|
501
|
+
}
|
|
502
|
+
const body = `{
|
|
503
|
+
${keys2.map((k) => `${ind(d + 1)}${formatPropertyKey(k)}: ${recur(v[k], d + 1)}`).join(",\n")}
|
|
504
|
+
${ind(d)}}`;
|
|
505
|
+
return wrap(v, body);
|
|
506
|
+
}
|
|
507
|
+
return String(v);
|
|
508
|
+
}
|
|
509
|
+
return recur(input, 0);
|
|
510
|
+
}
|
|
511
|
+
var CIRCULAR = "[Circular]";
|
|
512
|
+
function formatPropertyKey(name) {
|
|
513
|
+
return typeof name === "string" ? JSON.stringify(name) : String(name);
|
|
514
|
+
}
|
|
515
|
+
function formatDate(date) {
|
|
516
|
+
try {
|
|
517
|
+
return date.toISOString();
|
|
518
|
+
} catch {
|
|
519
|
+
return "Invalid Date";
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
function safeToString(input) {
|
|
523
|
+
try {
|
|
524
|
+
const s = input.toString();
|
|
525
|
+
return typeof s === "string" ? s : String(s);
|
|
526
|
+
} catch {
|
|
527
|
+
return "[toString threw]";
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/Inspectable.js
|
|
428
532
|
var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
429
|
-
var
|
|
533
|
+
var toJson = (input) => {
|
|
430
534
|
try {
|
|
431
|
-
if (hasProperty(
|
|
432
|
-
return
|
|
433
|
-
} else if (Array.isArray(
|
|
434
|
-
return
|
|
535
|
+
if (hasProperty(input, "toJSON") && isFunction(input["toJSON"]) && input["toJSON"].length === 0) {
|
|
536
|
+
return input.toJSON();
|
|
537
|
+
} else if (Array.isArray(input)) {
|
|
538
|
+
return input.map(toJson);
|
|
435
539
|
}
|
|
436
540
|
} catch {
|
|
437
|
-
return
|
|
541
|
+
return "[toJSON threw]";
|
|
438
542
|
}
|
|
439
|
-
return redact(
|
|
543
|
+
return redact(input);
|
|
440
544
|
};
|
|
441
|
-
var format = (x) => JSON.stringify(x, null, 2);
|
|
442
545
|
var BaseProto = {
|
|
443
546
|
toJSON() {
|
|
444
|
-
return
|
|
547
|
+
return toJson(this);
|
|
445
548
|
},
|
|
446
549
|
[NodeInspectSymbol]() {
|
|
447
550
|
return this.toJSON();
|
|
@@ -452,171 +555,447 @@ var BaseProto = {
|
|
|
452
555
|
};
|
|
453
556
|
var Class = class {
|
|
454
557
|
/**
|
|
558
|
+
* Node.js custom inspection method.
|
|
559
|
+
*
|
|
455
560
|
* @since 2.0.0
|
|
456
561
|
*/
|
|
457
562
|
[NodeInspectSymbol]() {
|
|
458
563
|
return this.toJSON();
|
|
459
564
|
}
|
|
460
565
|
/**
|
|
566
|
+
* Returns a formatted string representation of this object.
|
|
567
|
+
*
|
|
461
568
|
* @since 2.0.0
|
|
462
569
|
*/
|
|
463
570
|
toString() {
|
|
464
571
|
return format(this.toJSON());
|
|
465
572
|
}
|
|
466
573
|
};
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
var
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
574
|
+
|
|
575
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/Utils.js
|
|
576
|
+
var GenKindTypeId = "~effect/Utils/GenKind";
|
|
577
|
+
var GenKindImpl = class {
|
|
578
|
+
value;
|
|
579
|
+
constructor(value) {
|
|
580
|
+
this.value = value;
|
|
581
|
+
}
|
|
582
|
+
get _F() {
|
|
583
|
+
return identity;
|
|
584
|
+
}
|
|
585
|
+
get _R() {
|
|
586
|
+
return (_) => _;
|
|
587
|
+
}
|
|
588
|
+
get _O() {
|
|
589
|
+
return (_) => _;
|
|
590
|
+
}
|
|
591
|
+
get _E() {
|
|
592
|
+
return (_) => _;
|
|
593
|
+
}
|
|
594
|
+
[GenKindTypeId] = GenKindTypeId;
|
|
595
|
+
[Symbol.iterator]() {
|
|
596
|
+
return new SingleShotGen(this);
|
|
475
597
|
}
|
|
476
|
-
return u;
|
|
477
598
|
};
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
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
|
-
|
|
599
|
+
var SingleShotGen = class _SingleShotGen {
|
|
600
|
+
called = false;
|
|
601
|
+
self;
|
|
602
|
+
constructor(self) {
|
|
603
|
+
this.self = self;
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* @since 2.0.0
|
|
607
|
+
*/
|
|
608
|
+
next(a) {
|
|
609
|
+
return this.called ? {
|
|
610
|
+
value: a,
|
|
611
|
+
done: true
|
|
612
|
+
} : (this.called = true, {
|
|
613
|
+
value: this.self,
|
|
614
|
+
done: false
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* @since 2.0.0
|
|
619
|
+
*/
|
|
620
|
+
[Symbol.iterator]() {
|
|
621
|
+
return new _SingleShotGen(this.self);
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
var InternalTypeId = "~effect/Effect/internal";
|
|
625
|
+
var standard = {
|
|
626
|
+
[InternalTypeId]: (body) => {
|
|
627
|
+
return body();
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
var forced = {
|
|
631
|
+
[InternalTypeId]: (body) => {
|
|
632
|
+
try {
|
|
633
|
+
return body();
|
|
634
|
+
} finally {
|
|
508
635
|
}
|
|
509
636
|
}
|
|
510
637
|
};
|
|
638
|
+
var isNotOptimizedAway = /* @__PURE__ */ standard[InternalTypeId](() => new Error().stack)?.includes(InternalTypeId) === true;
|
|
639
|
+
var internalCall = isNotOptimizedAway ? standard[InternalTypeId] : forced[InternalTypeId];
|
|
640
|
+
var genConstructor = function* () {
|
|
641
|
+
}.constructor;
|
|
511
642
|
|
|
512
|
-
// ../../node_modules/.pnpm/effect@
|
|
513
|
-
var
|
|
514
|
-
|
|
515
|
-
// ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/version.js
|
|
516
|
-
var moduleVersion = "3.19.14";
|
|
517
|
-
var getCurrentVersion = () => moduleVersion;
|
|
518
|
-
|
|
519
|
-
// ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/effectable.js
|
|
520
|
-
var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
|
|
521
|
-
var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
|
|
522
|
-
var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
|
|
523
|
-
var ChannelTypeId = /* @__PURE__ */ Symbol.for("effect/Channel");
|
|
643
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/internal/core.js
|
|
644
|
+
var EffectTypeId = `~effect/Effect`;
|
|
645
|
+
var ExitTypeId = `~effect/Exit`;
|
|
524
646
|
var effectVariance = {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
_E: (_) => _,
|
|
529
|
-
/* c8 ignore next */
|
|
530
|
-
_A: (_) => _,
|
|
531
|
-
_V: /* @__PURE__ */ getCurrentVersion()
|
|
532
|
-
};
|
|
533
|
-
var sinkVariance = {
|
|
534
|
-
/* c8 ignore next */
|
|
535
|
-
_A: (_) => _,
|
|
536
|
-
/* c8 ignore next */
|
|
537
|
-
_In: (_) => _,
|
|
538
|
-
/* c8 ignore next */
|
|
539
|
-
_L: (_) => _,
|
|
540
|
-
/* c8 ignore next */
|
|
541
|
-
_E: (_) => _,
|
|
542
|
-
/* c8 ignore next */
|
|
543
|
-
_R: (_) => _
|
|
647
|
+
_A: identity,
|
|
648
|
+
_E: identity,
|
|
649
|
+
_R: identity
|
|
544
650
|
};
|
|
545
|
-
var
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
/* c8 ignore next */
|
|
555
|
-
_OutErr: (_) => _,
|
|
556
|
-
/* c8 ignore next */
|
|
557
|
-
_OutElem: (_) => _,
|
|
558
|
-
/* c8 ignore next */
|
|
559
|
-
_OutDone: (_) => _
|
|
560
|
-
};
|
|
561
|
-
var EffectPrototype = {
|
|
562
|
-
[EffectTypeId]: effectVariance,
|
|
563
|
-
[StreamTypeId]: effectVariance,
|
|
564
|
-
[SinkTypeId]: sinkVariance,
|
|
565
|
-
[ChannelTypeId]: channelVariance,
|
|
566
|
-
[symbol2](that) {
|
|
567
|
-
return this === that;
|
|
651
|
+
var identifier = `${EffectTypeId}/identifier`;
|
|
652
|
+
var args = `${EffectTypeId}/args`;
|
|
653
|
+
var evaluate = `${EffectTypeId}/evaluate`;
|
|
654
|
+
var contA = `${EffectTypeId}/successCont`;
|
|
655
|
+
var contE = `${EffectTypeId}/failureCont`;
|
|
656
|
+
var contAll = `${EffectTypeId}/ensureCont`;
|
|
657
|
+
var PipeInspectableProto = {
|
|
658
|
+
pipe() {
|
|
659
|
+
return pipeArguments(this, arguments);
|
|
568
660
|
},
|
|
569
|
-
|
|
570
|
-
return
|
|
661
|
+
toJSON() {
|
|
662
|
+
return {
|
|
663
|
+
...this
|
|
664
|
+
};
|
|
571
665
|
},
|
|
572
|
-
|
|
573
|
-
return
|
|
666
|
+
toString() {
|
|
667
|
+
return format(this.toJSON(), {
|
|
668
|
+
ignoreToString: true,
|
|
669
|
+
space: 2
|
|
670
|
+
});
|
|
574
671
|
},
|
|
575
|
-
|
|
576
|
-
return
|
|
672
|
+
[NodeInspectSymbol]() {
|
|
673
|
+
return this.toJSON();
|
|
577
674
|
}
|
|
578
675
|
};
|
|
579
|
-
var
|
|
676
|
+
var StructuralProto = {
|
|
580
677
|
[symbol]() {
|
|
581
|
-
return
|
|
678
|
+
return structureKeys(this, Object.keys(this));
|
|
582
679
|
},
|
|
583
680
|
[symbol2](that) {
|
|
584
681
|
const selfKeys = Object.keys(this);
|
|
585
682
|
const thatKeys = Object.keys(that);
|
|
586
|
-
if (selfKeys.length !== thatKeys.length)
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
for (const key of selfKeys) {
|
|
590
|
-
if (!(key in that && equals(this[key], that[key]))) {
|
|
683
|
+
if (selfKeys.length !== thatKeys.length) return false;
|
|
684
|
+
for (let i = 0; i < selfKeys.length; i++) {
|
|
685
|
+
if (selfKeys[i] !== thatKeys[i] && !equals(this[selfKeys[i]], that[selfKeys[i]])) {
|
|
591
686
|
return false;
|
|
592
687
|
}
|
|
593
688
|
}
|
|
594
689
|
return true;
|
|
595
690
|
}
|
|
596
691
|
};
|
|
597
|
-
var
|
|
598
|
-
|
|
599
|
-
|
|
692
|
+
var YieldableProto = {
|
|
693
|
+
[Symbol.iterator]() {
|
|
694
|
+
return new SingleShotGen(this);
|
|
695
|
+
}
|
|
600
696
|
};
|
|
601
|
-
var
|
|
602
|
-
...
|
|
603
|
-
|
|
697
|
+
var YieldableErrorProto = {
|
|
698
|
+
...YieldableProto,
|
|
699
|
+
pipe() {
|
|
700
|
+
return pipeArguments(this, arguments);
|
|
701
|
+
}
|
|
604
702
|
};
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
[TypeId]: {
|
|
611
|
-
_A: (_) => _
|
|
703
|
+
var EffectProto = {
|
|
704
|
+
[EffectTypeId]: effectVariance,
|
|
705
|
+
...PipeInspectableProto,
|
|
706
|
+
[Symbol.iterator]() {
|
|
707
|
+
return new SingleShotGen(this);
|
|
612
708
|
},
|
|
709
|
+
asEffect() {
|
|
710
|
+
return this;
|
|
711
|
+
},
|
|
712
|
+
toJSON() {
|
|
713
|
+
return {
|
|
714
|
+
_id: "Effect",
|
|
715
|
+
op: this[identifier],
|
|
716
|
+
...args in this ? {
|
|
717
|
+
args: this[args]
|
|
718
|
+
} : void 0
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
var isExit = (u) => hasProperty(u, ExitTypeId);
|
|
723
|
+
var CauseTypeId = "~effect/Cause";
|
|
724
|
+
var CauseReasonTypeId = "~effect/Cause/Reason";
|
|
725
|
+
var isCause = (self) => hasProperty(self, CauseTypeId);
|
|
726
|
+
var CauseImpl = class {
|
|
727
|
+
[CauseTypeId];
|
|
728
|
+
reasons;
|
|
729
|
+
constructor(failures) {
|
|
730
|
+
this[CauseTypeId] = CauseTypeId;
|
|
731
|
+
this.reasons = failures;
|
|
732
|
+
}
|
|
733
|
+
pipe() {
|
|
734
|
+
return pipeArguments(this, arguments);
|
|
735
|
+
}
|
|
736
|
+
toJSON() {
|
|
737
|
+
return {
|
|
738
|
+
_id: "Cause",
|
|
739
|
+
failures: this.reasons.map((f) => f.toJSON())
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
toString() {
|
|
743
|
+
return `Cause(${format(this.reasons)})`;
|
|
744
|
+
}
|
|
613
745
|
[NodeInspectSymbol]() {
|
|
614
746
|
return this.toJSON();
|
|
615
|
-
}
|
|
747
|
+
}
|
|
748
|
+
[symbol2](that) {
|
|
749
|
+
return isCause(that) && this.reasons.length === that.reasons.length && this.reasons.every((e, i) => equals(e, that.reasons[i]));
|
|
750
|
+
}
|
|
751
|
+
[symbol]() {
|
|
752
|
+
return array(this.reasons);
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
var annotationsMap = /* @__PURE__ */ new WeakMap();
|
|
756
|
+
var ReasonBase = class {
|
|
757
|
+
[CauseReasonTypeId];
|
|
758
|
+
annotations;
|
|
759
|
+
_tag;
|
|
760
|
+
constructor(_tag, annotations, originalError) {
|
|
761
|
+
this[CauseReasonTypeId] = CauseReasonTypeId;
|
|
762
|
+
this._tag = _tag;
|
|
763
|
+
if (annotations !== constEmptyAnnotations && typeof originalError === "object" && originalError !== null && annotations.size > 0) {
|
|
764
|
+
const prevAnnotations = annotationsMap.get(originalError);
|
|
765
|
+
if (prevAnnotations) {
|
|
766
|
+
annotations = new Map([...prevAnnotations, ...annotations]);
|
|
767
|
+
}
|
|
768
|
+
annotationsMap.set(originalError, annotations);
|
|
769
|
+
}
|
|
770
|
+
this.annotations = annotations;
|
|
771
|
+
}
|
|
772
|
+
annotate(annotations, options) {
|
|
773
|
+
if (annotations.mapUnsafe.size === 0) return this;
|
|
774
|
+
const newAnnotations = new Map(this.annotations);
|
|
775
|
+
annotations.mapUnsafe.forEach((value, key) => {
|
|
776
|
+
if (options?.overwrite !== true && newAnnotations.has(key)) return;
|
|
777
|
+
newAnnotations.set(key, value);
|
|
778
|
+
});
|
|
779
|
+
const self = Object.assign(Object.create(Object.getPrototypeOf(this)), this);
|
|
780
|
+
self.annotations = newAnnotations;
|
|
781
|
+
return self;
|
|
782
|
+
}
|
|
783
|
+
pipe() {
|
|
784
|
+
return pipeArguments(this, arguments);
|
|
785
|
+
}
|
|
616
786
|
toString() {
|
|
617
|
-
return format(this
|
|
787
|
+
return format(this);
|
|
788
|
+
}
|
|
789
|
+
[NodeInspectSymbol]() {
|
|
790
|
+
return this.toString();
|
|
791
|
+
}
|
|
792
|
+
};
|
|
793
|
+
var constEmptyAnnotations = /* @__PURE__ */ new Map();
|
|
794
|
+
var Fail = class extends ReasonBase {
|
|
795
|
+
error;
|
|
796
|
+
constructor(error, annotations = constEmptyAnnotations) {
|
|
797
|
+
super("Fail", annotations, error);
|
|
798
|
+
this.error = error;
|
|
799
|
+
}
|
|
800
|
+
toString() {
|
|
801
|
+
return `Fail(${format(this.error)})`;
|
|
802
|
+
}
|
|
803
|
+
toJSON() {
|
|
804
|
+
return {
|
|
805
|
+
_tag: "Fail",
|
|
806
|
+
error: this.error
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
[symbol2](that) {
|
|
810
|
+
return isFailReason(that) && equals(this.error, that.error) && equals(this.annotations, that.annotations);
|
|
811
|
+
}
|
|
812
|
+
[symbol]() {
|
|
813
|
+
return combine(string(this._tag))(combine(hash(this.error))(hash(this.annotations)));
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
var causeFail = (error) => new CauseImpl([new Fail(error)]);
|
|
817
|
+
var Die = class extends ReasonBase {
|
|
818
|
+
defect;
|
|
819
|
+
constructor(defect, annotations = constEmptyAnnotations) {
|
|
820
|
+
super("Die", annotations, defect);
|
|
821
|
+
this.defect = defect;
|
|
822
|
+
}
|
|
823
|
+
toString() {
|
|
824
|
+
return `Die(${format(this.defect)})`;
|
|
825
|
+
}
|
|
826
|
+
toJSON() {
|
|
827
|
+
return {
|
|
828
|
+
_tag: "Die",
|
|
829
|
+
defect: this.defect
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
[symbol2](that) {
|
|
833
|
+
return isDieReason(that) && equals(this.defect, that.defect) && equals(this.annotations, that.annotations);
|
|
834
|
+
}
|
|
835
|
+
[symbol]() {
|
|
836
|
+
return combine(string(this._tag))(combine(hash(this.defect))(hash(this.annotations)));
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
var causeDie = (defect) => new CauseImpl([new Die(defect)]);
|
|
840
|
+
var causeAnnotate = /* @__PURE__ */ dual((args3) => isCause(args3[0]), (self, annotations, options) => {
|
|
841
|
+
if (annotations.mapUnsafe.size === 0) return self;
|
|
842
|
+
return new CauseImpl(self.reasons.map((f) => f.annotate(annotations, options)));
|
|
843
|
+
});
|
|
844
|
+
var isFailReason = (self) => self._tag === "Fail";
|
|
845
|
+
var isDieReason = (self) => self._tag === "Die";
|
|
846
|
+
function defaultEvaluate(_fiber) {
|
|
847
|
+
return exitDie(`Effect.evaluate: Not implemented`);
|
|
848
|
+
}
|
|
849
|
+
var makePrimitiveProto = (options) => ({
|
|
850
|
+
...EffectProto,
|
|
851
|
+
[identifier]: options.op,
|
|
852
|
+
[evaluate]: options[evaluate] ?? defaultEvaluate,
|
|
853
|
+
[contA]: options[contA],
|
|
854
|
+
[contE]: options[contE],
|
|
855
|
+
[contAll]: options[contAll]
|
|
856
|
+
});
|
|
857
|
+
var makePrimitive = (options) => {
|
|
858
|
+
const Proto = makePrimitiveProto(options);
|
|
859
|
+
return function() {
|
|
860
|
+
const self = Object.create(Proto);
|
|
861
|
+
self[args] = options.single === false ? arguments : arguments[0];
|
|
862
|
+
return self;
|
|
863
|
+
};
|
|
864
|
+
};
|
|
865
|
+
var makeExit = (options) => {
|
|
866
|
+
const Proto = {
|
|
867
|
+
...makePrimitiveProto(options),
|
|
868
|
+
[ExitTypeId]: ExitTypeId,
|
|
869
|
+
_tag: options.op,
|
|
870
|
+
get [options.prop]() {
|
|
871
|
+
return this[args];
|
|
872
|
+
},
|
|
873
|
+
toString() {
|
|
874
|
+
return `${options.op}(${format(this[args])})`;
|
|
875
|
+
},
|
|
876
|
+
toJSON() {
|
|
877
|
+
return {
|
|
878
|
+
_id: "Exit",
|
|
879
|
+
_tag: options.op,
|
|
880
|
+
[options.prop]: this[args]
|
|
881
|
+
};
|
|
882
|
+
},
|
|
883
|
+
[symbol2](that) {
|
|
884
|
+
return isExit(that) && that._tag === this._tag && equals(this[args], that[args]);
|
|
885
|
+
},
|
|
886
|
+
[symbol]() {
|
|
887
|
+
return combine(string(options.op), hash(this[args]));
|
|
888
|
+
}
|
|
889
|
+
};
|
|
890
|
+
return function(value) {
|
|
891
|
+
const self = Object.create(Proto);
|
|
892
|
+
self[args] = value;
|
|
893
|
+
return self;
|
|
894
|
+
};
|
|
895
|
+
};
|
|
896
|
+
var exitSucceed = /* @__PURE__ */ makeExit({
|
|
897
|
+
op: "Success",
|
|
898
|
+
prop: "value",
|
|
899
|
+
[evaluate](fiber) {
|
|
900
|
+
const cont = fiber.getCont(contA);
|
|
901
|
+
return cont ? cont[contA](this[args], fiber, this) : fiber.yieldWith(this);
|
|
902
|
+
}
|
|
903
|
+
});
|
|
904
|
+
var StackTraceKey = {
|
|
905
|
+
key: "effect/Cause/StackTrace"
|
|
906
|
+
};
|
|
907
|
+
var exitFailCause = /* @__PURE__ */ makeExit({
|
|
908
|
+
op: "Failure",
|
|
909
|
+
prop: "cause",
|
|
910
|
+
[evaluate](fiber) {
|
|
911
|
+
let cause = this[args];
|
|
912
|
+
let annotated = false;
|
|
913
|
+
if (fiber.currentStackFrame) {
|
|
914
|
+
cause = causeAnnotate(cause, {
|
|
915
|
+
mapUnsafe: /* @__PURE__ */ new Map([[StackTraceKey.key, fiber.currentStackFrame]])
|
|
916
|
+
});
|
|
917
|
+
annotated = true;
|
|
918
|
+
}
|
|
919
|
+
let cont = fiber.getCont(contE);
|
|
920
|
+
while (fiber.interruptible && fiber._interruptedCause && cont) {
|
|
921
|
+
cont = fiber.getCont(contE);
|
|
922
|
+
}
|
|
923
|
+
return cont ? cont[contE](cause, fiber, annotated ? void 0 : this) : fiber.yieldWith(annotated ? this : exitFailCause(cause));
|
|
924
|
+
}
|
|
925
|
+
});
|
|
926
|
+
var exitFail = (e) => exitFailCause(causeFail(e));
|
|
927
|
+
var exitDie = (defect) => exitFailCause(causeDie(defect));
|
|
928
|
+
var withFiber = /* @__PURE__ */ makePrimitive({
|
|
929
|
+
op: "WithFiber",
|
|
930
|
+
[evaluate](fiber) {
|
|
931
|
+
return this[args](fiber);
|
|
932
|
+
}
|
|
933
|
+
});
|
|
934
|
+
var YieldableError = /* @__PURE__ */ (function() {
|
|
935
|
+
class YieldableError2 extends globalThis.Error {
|
|
936
|
+
asEffect() {
|
|
937
|
+
return exitFail(this);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
Object.assign(YieldableError2.prototype, YieldableErrorProto);
|
|
941
|
+
return YieldableError2;
|
|
942
|
+
})();
|
|
943
|
+
var Error2 = /* @__PURE__ */ (function() {
|
|
944
|
+
const plainArgsSymbol = /* @__PURE__ */ Symbol.for("effect/Data/Error/plainArgs");
|
|
945
|
+
return class Base extends YieldableError {
|
|
946
|
+
constructor(args3) {
|
|
947
|
+
super(args3?.message, args3?.cause ? {
|
|
948
|
+
cause: args3.cause
|
|
949
|
+
} : void 0);
|
|
950
|
+
if (args3) {
|
|
951
|
+
Object.assign(this, args3);
|
|
952
|
+
Object.defineProperty(this, plainArgsSymbol, {
|
|
953
|
+
value: args3,
|
|
954
|
+
enumerable: false
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
toJSON() {
|
|
959
|
+
return {
|
|
960
|
+
...this[plainArgsSymbol],
|
|
961
|
+
...this
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
};
|
|
965
|
+
})();
|
|
966
|
+
var TaggedError = (tag) => {
|
|
967
|
+
class Base extends Error2 {
|
|
968
|
+
_tag = tag;
|
|
969
|
+
}
|
|
970
|
+
;
|
|
971
|
+
Base.prototype.name = tag;
|
|
972
|
+
return Base;
|
|
973
|
+
};
|
|
974
|
+
var NoSuchElementErrorTypeId = "~effect/Cause/NoSuchElementError";
|
|
975
|
+
var NoSuchElementError = class extends (/* @__PURE__ */ TaggedError("NoSuchElementError")) {
|
|
976
|
+
[NoSuchElementErrorTypeId] = NoSuchElementErrorTypeId;
|
|
977
|
+
constructor(message) {
|
|
978
|
+
super({
|
|
979
|
+
message
|
|
980
|
+
});
|
|
618
981
|
}
|
|
619
982
|
};
|
|
983
|
+
var DoneTypeId = "~effect/Cause/Done";
|
|
984
|
+
var DoneVoid = {
|
|
985
|
+
[DoneTypeId]: DoneTypeId,
|
|
986
|
+
_tag: "Done",
|
|
987
|
+
value: void 0
|
|
988
|
+
};
|
|
989
|
+
|
|
990
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/internal/option.js
|
|
991
|
+
var TypeId = "~effect/data/Option";
|
|
992
|
+
var CommonProto = {
|
|
993
|
+
[TypeId]: {
|
|
994
|
+
_A: (_) => _
|
|
995
|
+
},
|
|
996
|
+
...PipeInspectableProto,
|
|
997
|
+
...YieldableProto
|
|
998
|
+
};
|
|
620
999
|
var SomeProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto), {
|
|
621
1000
|
_tag: "Some",
|
|
622
1001
|
_op: "Some",
|
|
@@ -624,14 +1003,20 @@ var SomeProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(Comm
|
|
|
624
1003
|
return isOption(that) && isSome(that) && equals(this.value, that.value);
|
|
625
1004
|
},
|
|
626
1005
|
[symbol]() {
|
|
627
|
-
return
|
|
1006
|
+
return combine(hash(this._tag))(hash(this.value));
|
|
1007
|
+
},
|
|
1008
|
+
toString() {
|
|
1009
|
+
return `some(${format(this.value)})`;
|
|
628
1010
|
},
|
|
629
1011
|
toJSON() {
|
|
630
1012
|
return {
|
|
631
1013
|
_id: "Option",
|
|
632
1014
|
_tag: this._tag,
|
|
633
|
-
value:
|
|
1015
|
+
value: toJson(this.value)
|
|
634
1016
|
};
|
|
1017
|
+
},
|
|
1018
|
+
asEffect() {
|
|
1019
|
+
return exitSucceed(this.value);
|
|
635
1020
|
}
|
|
636
1021
|
});
|
|
637
1022
|
var NoneHash = /* @__PURE__ */ hash("None");
|
|
@@ -644,11 +1029,17 @@ var NoneProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(Comm
|
|
|
644
1029
|
[symbol]() {
|
|
645
1030
|
return NoneHash;
|
|
646
1031
|
},
|
|
1032
|
+
toString() {
|
|
1033
|
+
return `none()`;
|
|
1034
|
+
},
|
|
647
1035
|
toJSON() {
|
|
648
1036
|
return {
|
|
649
1037
|
_id: "Option",
|
|
650
1038
|
_tag: this._tag
|
|
651
1039
|
};
|
|
1040
|
+
},
|
|
1041
|
+
asEffect() {
|
|
1042
|
+
return exitFail(new NoSuchElementError());
|
|
652
1043
|
}
|
|
653
1044
|
});
|
|
654
1045
|
var isOption = (input) => hasProperty(input, TypeId);
|
|
@@ -661,94 +1052,113 @@ var some = (value) => {
|
|
|
661
1052
|
return a;
|
|
662
1053
|
};
|
|
663
1054
|
|
|
664
|
-
// ../../node_modules/.pnpm/effect@
|
|
665
|
-
var TypeId2 =
|
|
1055
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/internal/result.js
|
|
1056
|
+
var TypeId2 = "~effect/data/Result";
|
|
666
1057
|
var CommonProto2 = {
|
|
667
|
-
...EffectPrototype,
|
|
668
1058
|
[TypeId2]: {
|
|
669
|
-
|
|
1059
|
+
/* v8 ignore next 2 */
|
|
1060
|
+
_A: (_) => _,
|
|
1061
|
+
_E: (_) => _
|
|
670
1062
|
},
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
},
|
|
674
|
-
toString() {
|
|
675
|
-
return format(this.toJSON());
|
|
676
|
-
}
|
|
1063
|
+
...PipeInspectableProto,
|
|
1064
|
+
...YieldableProto
|
|
677
1065
|
};
|
|
678
|
-
var
|
|
679
|
-
_tag: "
|
|
680
|
-
_op: "
|
|
1066
|
+
var SuccessProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto2), {
|
|
1067
|
+
_tag: "Success",
|
|
1068
|
+
_op: "Success",
|
|
681
1069
|
[symbol2](that) {
|
|
682
|
-
return
|
|
1070
|
+
return isResult(that) && isSuccess(that) && equals(this.success, that.success);
|
|
683
1071
|
},
|
|
684
1072
|
[symbol]() {
|
|
685
|
-
return combine(hash(this._tag))(hash(this.
|
|
1073
|
+
return combine(hash(this._tag))(hash(this.success));
|
|
1074
|
+
},
|
|
1075
|
+
toString() {
|
|
1076
|
+
return `success(${format(this.success)})`;
|
|
686
1077
|
},
|
|
687
1078
|
toJSON() {
|
|
688
1079
|
return {
|
|
689
|
-
_id: "
|
|
1080
|
+
_id: "Result",
|
|
690
1081
|
_tag: this._tag,
|
|
691
|
-
|
|
1082
|
+
value: toJson(this.success)
|
|
692
1083
|
};
|
|
1084
|
+
},
|
|
1085
|
+
asEffect() {
|
|
1086
|
+
return exitSucceed(this.success);
|
|
693
1087
|
}
|
|
694
1088
|
});
|
|
695
|
-
var
|
|
696
|
-
_tag: "
|
|
697
|
-
_op: "
|
|
1089
|
+
var FailureProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto2), {
|
|
1090
|
+
_tag: "Failure",
|
|
1091
|
+
_op: "Failure",
|
|
698
1092
|
[symbol2](that) {
|
|
699
|
-
return
|
|
1093
|
+
return isResult(that) && isFailure(that) && equals(this.failure, that.failure);
|
|
700
1094
|
},
|
|
701
1095
|
[symbol]() {
|
|
702
|
-
return combine(hash(this._tag))(hash(this.
|
|
1096
|
+
return combine(hash(this._tag))(hash(this.failure));
|
|
1097
|
+
},
|
|
1098
|
+
toString() {
|
|
1099
|
+
return `failure(${format(this.failure)})`;
|
|
703
1100
|
},
|
|
704
1101
|
toJSON() {
|
|
705
1102
|
return {
|
|
706
|
-
_id: "
|
|
1103
|
+
_id: "Result",
|
|
707
1104
|
_tag: this._tag,
|
|
708
|
-
|
|
1105
|
+
failure: toJson(this.failure)
|
|
709
1106
|
};
|
|
1107
|
+
},
|
|
1108
|
+
asEffect() {
|
|
1109
|
+
return exitFail(this.failure);
|
|
710
1110
|
}
|
|
711
1111
|
});
|
|
712
|
-
var
|
|
713
|
-
var
|
|
714
|
-
var
|
|
715
|
-
var
|
|
716
|
-
const a = Object.create(
|
|
717
|
-
a.
|
|
1112
|
+
var isResult = (input) => hasProperty(input, TypeId2);
|
|
1113
|
+
var isFailure = (result) => result._tag === "Failure";
|
|
1114
|
+
var isSuccess = (result) => result._tag === "Success";
|
|
1115
|
+
var fail = (failure) => {
|
|
1116
|
+
const a = Object.create(FailureProto);
|
|
1117
|
+
a.failure = failure;
|
|
718
1118
|
return a;
|
|
719
1119
|
};
|
|
720
|
-
var
|
|
721
|
-
const a = Object.create(
|
|
722
|
-
a.
|
|
1120
|
+
var succeed = (success) => {
|
|
1121
|
+
const a = Object.create(SuccessProto);
|
|
1122
|
+
a.success = success;
|
|
723
1123
|
return a;
|
|
724
1124
|
};
|
|
725
1125
|
|
|
726
|
-
// ../../node_modules/.pnpm/effect@
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
var
|
|
731
|
-
var map = /* @__PURE__ */ dual(2, (self, f) => isRight2(self) ? right2(f(self.right)) : left2(self.left));
|
|
732
|
-
var getOrElse = /* @__PURE__ */ dual(2, (self, onLeft) => isLeft2(self) ? onLeft(self.left) : self.right);
|
|
733
|
-
|
|
734
|
-
// ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/array.js
|
|
735
|
-
var isNonEmptyArray = (self) => self.length > 0;
|
|
736
|
-
|
|
737
|
-
// ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Order.js
|
|
738
|
-
var make = (compare) => (self, that) => self === that ? 0 : compare(self, that);
|
|
739
|
-
var string2 = /* @__PURE__ */ make((self, that) => self < that ? -1 : 1);
|
|
1126
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/Order.js
|
|
1127
|
+
function make(compare) {
|
|
1128
|
+
return (self, that) => self === that ? 0 : compare(self, that);
|
|
1129
|
+
}
|
|
1130
|
+
var String2 = /* @__PURE__ */ make((self, that) => self < that ? -1 : 1);
|
|
740
1131
|
|
|
741
|
-
// ../../node_modules/.pnpm/effect@
|
|
1132
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/Option.js
|
|
742
1133
|
var none2 = () => none;
|
|
743
1134
|
var some2 = some;
|
|
744
1135
|
var isNone2 = isNone;
|
|
745
1136
|
var isSome2 = isSome;
|
|
746
|
-
var
|
|
1137
|
+
var getOrElse = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? onNone() : self.value);
|
|
747
1138
|
var orElse = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self);
|
|
748
|
-
var
|
|
749
|
-
var getOrUndefined = /* @__PURE__ */
|
|
1139
|
+
var fromNullishOr = (a) => a == null ? none2() : some2(a);
|
|
1140
|
+
var getOrUndefined = /* @__PURE__ */ getOrElse(constUndefined);
|
|
1141
|
+
|
|
1142
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/Result.js
|
|
1143
|
+
var succeed2 = succeed;
|
|
1144
|
+
var fail2 = fail;
|
|
1145
|
+
var isFailure2 = isFailure;
|
|
1146
|
+
var isSuccess2 = isSuccess;
|
|
1147
|
+
var map = /* @__PURE__ */ dual(2, (self, f) => isSuccess2(self) ? succeed2(f(self.success)) : fail2(self.failure));
|
|
1148
|
+
var getOrElse2 = /* @__PURE__ */ dual(2, (self, onFailure) => isFailure2(self) ? onFailure(self.failure) : self.success);
|
|
750
1149
|
|
|
751
|
-
// ../../node_modules/.pnpm/effect@
|
|
1150
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/Filter.js
|
|
1151
|
+
var apply = (filter2, input, ...args3) => {
|
|
1152
|
+
const result = filter2(input, ...args3);
|
|
1153
|
+
if (result === true) return succeed2(input);
|
|
1154
|
+
if (result === false) return fail2(input);
|
|
1155
|
+
return result;
|
|
1156
|
+
};
|
|
1157
|
+
|
|
1158
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/internal/array.js
|
|
1159
|
+
var isArrayNonEmpty = (self) => self.length > 0;
|
|
1160
|
+
|
|
1161
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/Record.js
|
|
752
1162
|
var map2 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
753
1163
|
const out = {
|
|
754
1164
|
...self
|
|
@@ -760,31 +1170,34 @@ var map2 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
760
1170
|
});
|
|
761
1171
|
var keys = (self) => Object.keys(self);
|
|
762
1172
|
|
|
763
|
-
// ../../node_modules/.pnpm/effect@
|
|
764
|
-
var
|
|
1173
|
+
// ../../node_modules/.pnpm/effect@4.0.0-beta.12/node_modules/effect/dist/Array.js
|
|
1174
|
+
var Array2 = globalThis.Array;
|
|
1175
|
+
var fromIterable = (collection) => Array2.isArray(collection) ? collection : Array2.from(collection);
|
|
765
1176
|
var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
|
|
766
1177
|
var appendAll = /* @__PURE__ */ dual(2, (self, that) => fromIterable(self).concat(fromIterable(that)));
|
|
767
|
-
var isArray =
|
|
768
|
-
var
|
|
769
|
-
var
|
|
770
|
-
var
|
|
771
|
-
|
|
1178
|
+
var isArray = Array2.isArray;
|
|
1179
|
+
var isArrayEmpty = (self) => self.length === 0;
|
|
1180
|
+
var isReadonlyArrayEmpty = isArrayEmpty;
|
|
1181
|
+
var isReadonlyArrayNonEmpty = isArrayNonEmpty;
|
|
1182
|
+
function isOutOfBounds(i, as) {
|
|
1183
|
+
return i < 0 || i >= as.length;
|
|
1184
|
+
}
|
|
772
1185
|
var get = /* @__PURE__ */ dual(2, (self, index) => {
|
|
773
1186
|
const i = Math.floor(index);
|
|
774
1187
|
return isOutOfBounds(i, self) ? none2() : some2(self[i]);
|
|
775
1188
|
});
|
|
776
|
-
var
|
|
1189
|
+
var getUnsafe = /* @__PURE__ */ dual(2, (self, index) => {
|
|
777
1190
|
const i = Math.floor(index);
|
|
778
1191
|
if (isOutOfBounds(i, self)) {
|
|
779
|
-
throw new Error(`Index
|
|
1192
|
+
throw new Error(`Index out of bounds: ${i}`);
|
|
780
1193
|
}
|
|
781
1194
|
return self[i];
|
|
782
1195
|
});
|
|
783
1196
|
var head = /* @__PURE__ */ get(0);
|
|
784
|
-
var headNonEmpty = /* @__PURE__ */
|
|
1197
|
+
var headNonEmpty = /* @__PURE__ */ getUnsafe(0);
|
|
785
1198
|
var tailNonEmpty = (self) => self.slice(1);
|
|
786
1199
|
var sort = /* @__PURE__ */ dual(2, (self, O) => {
|
|
787
|
-
const out =
|
|
1200
|
+
const out = Array2.from(self);
|
|
788
1201
|
out.sort(O);
|
|
789
1202
|
return out;
|
|
790
1203
|
});
|
|
@@ -796,19 +1209,18 @@ var containsWith = (isEquivalent) => dual(2, (self, a) => {
|
|
|
796
1209
|
}
|
|
797
1210
|
return false;
|
|
798
1211
|
});
|
|
799
|
-
var _equivalence = /* @__PURE__ */ equivalence();
|
|
800
1212
|
var intersectionWith = (isEquivalent) => {
|
|
801
1213
|
const has = containsWith(isEquivalent);
|
|
802
1214
|
return dual(2, (self, that) => {
|
|
803
|
-
const
|
|
804
|
-
return fromIterable(self).filter((a) => has(
|
|
1215
|
+
const thatArray = fromIterable(that);
|
|
1216
|
+
return fromIterable(self).filter((a) => has(thatArray, a));
|
|
805
1217
|
});
|
|
806
1218
|
};
|
|
807
|
-
var intersection = /* @__PURE__ */ intersectionWith(
|
|
1219
|
+
var intersection = /* @__PURE__ */ intersectionWith(/* @__PURE__ */ asEquivalence());
|
|
808
1220
|
var empty = () => [];
|
|
809
1221
|
var map3 = /* @__PURE__ */ dual(2, (self, f) => self.map(f));
|
|
810
1222
|
var flatMap = /* @__PURE__ */ dual(2, (self, f) => {
|
|
811
|
-
if (
|
|
1223
|
+
if (isReadonlyArrayEmpty(self)) {
|
|
812
1224
|
return [];
|
|
813
1225
|
}
|
|
814
1226
|
const out = [];
|
|
@@ -821,19 +1233,20 @@ var flatMap = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
821
1233
|
return out;
|
|
822
1234
|
});
|
|
823
1235
|
var flatten = /* @__PURE__ */ flatMap(identity);
|
|
824
|
-
var filter = /* @__PURE__ */ dual(2, (self,
|
|
1236
|
+
var filter = /* @__PURE__ */ dual(2, (self, f) => {
|
|
825
1237
|
const as = fromIterable(self);
|
|
826
1238
|
const out = [];
|
|
827
1239
|
for (let i = 0; i < as.length; i++) {
|
|
828
|
-
|
|
829
|
-
|
|
1240
|
+
const result = apply(f, as[i], i);
|
|
1241
|
+
if (!isFailure2(result)) {
|
|
1242
|
+
out.push(result.success);
|
|
830
1243
|
}
|
|
831
1244
|
}
|
|
832
1245
|
return out;
|
|
833
1246
|
});
|
|
834
1247
|
var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
|
|
835
1248
|
const input = fromIterable(self);
|
|
836
|
-
if (
|
|
1249
|
+
if (isReadonlyArrayNonEmpty(input)) {
|
|
837
1250
|
const out = [headNonEmpty(input)];
|
|
838
1251
|
const rest = tailNonEmpty(input);
|
|
839
1252
|
for (const r of rest) {
|
|
@@ -845,7 +1258,7 @@ var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
|
|
|
845
1258
|
}
|
|
846
1259
|
return [];
|
|
847
1260
|
});
|
|
848
|
-
var dedupe = (self) => dedupeWith(self,
|
|
1261
|
+
var dedupe = (self) => dedupeWith(self, asEquivalence());
|
|
849
1262
|
var join = /* @__PURE__ */ dual(2, (self, sep) => fromIterable(self).join(sep));
|
|
850
1263
|
|
|
851
1264
|
// src/core/Nano.ts
|
|
@@ -855,7 +1268,7 @@ var NanoTag = class {
|
|
|
855
1268
|
this.key = key;
|
|
856
1269
|
}
|
|
857
1270
|
};
|
|
858
|
-
var Tag = (
|
|
1271
|
+
var Tag = (identifier2) => new NanoTag(identifier2);
|
|
859
1272
|
var SingleShotGen2 = class _SingleShotGen {
|
|
860
1273
|
called = false;
|
|
861
1274
|
self;
|
|
@@ -881,12 +1294,12 @@ var SingleShotGen2 = class _SingleShotGen {
|
|
|
881
1294
|
return new _SingleShotGen(this.self);
|
|
882
1295
|
}
|
|
883
1296
|
};
|
|
884
|
-
var
|
|
885
|
-
var
|
|
886
|
-
var
|
|
887
|
-
var
|
|
1297
|
+
var evaluate2 = /* @__PURE__ */ Symbol.for("Nano.evaluate");
|
|
1298
|
+
var contA2 = /* @__PURE__ */ Symbol.for("Nano.contA");
|
|
1299
|
+
var contE2 = /* @__PURE__ */ Symbol.for("Nano.contE");
|
|
1300
|
+
var contAll2 = /* @__PURE__ */ Symbol.for("Nano.contAll");
|
|
888
1301
|
var NanoYield = /* @__PURE__ */ Symbol.for("Nano.yield");
|
|
889
|
-
var
|
|
1302
|
+
var args2 = /* @__PURE__ */ Symbol.for("Nano.args");
|
|
890
1303
|
var NanoDefectException = class {
|
|
891
1304
|
constructor(message, lastSpan) {
|
|
892
1305
|
this.message = message;
|
|
@@ -903,43 +1316,43 @@ var SucceedProto = {
|
|
|
903
1316
|
...PrimitiveProto,
|
|
904
1317
|
_tag: "Success",
|
|
905
1318
|
get value() {
|
|
906
|
-
return this[
|
|
1319
|
+
return this[args2];
|
|
907
1320
|
},
|
|
908
|
-
[
|
|
909
|
-
const cont = fiber.getCont(
|
|
910
|
-
return cont ? cont[
|
|
1321
|
+
[evaluate2](fiber) {
|
|
1322
|
+
const cont = fiber.getCont(contA2);
|
|
1323
|
+
return cont ? cont[contA2](this[args2], fiber) : fiber.yieldWith(this);
|
|
911
1324
|
}
|
|
912
1325
|
};
|
|
913
|
-
var
|
|
1326
|
+
var succeed3 = (value) => {
|
|
914
1327
|
const nano = Object.create(SucceedProto);
|
|
915
|
-
nano[
|
|
1328
|
+
nano[args2] = value;
|
|
916
1329
|
return nano;
|
|
917
1330
|
};
|
|
918
|
-
var
|
|
1331
|
+
var FailureProto2 = {
|
|
919
1332
|
...PrimitiveProto,
|
|
920
1333
|
_tag: "Failure",
|
|
921
1334
|
get value() {
|
|
922
|
-
return this[
|
|
1335
|
+
return this[args2];
|
|
923
1336
|
},
|
|
924
|
-
[
|
|
925
|
-
const cont = fiber.getCont(
|
|
926
|
-
return cont ? cont[
|
|
1337
|
+
[evaluate2](fiber) {
|
|
1338
|
+
const cont = fiber.getCont(contE2);
|
|
1339
|
+
return cont ? cont[contE2](this[args2], fiber) : fiber.yieldWith(this);
|
|
927
1340
|
}
|
|
928
1341
|
};
|
|
929
|
-
var
|
|
930
|
-
const nano = Object.create(
|
|
931
|
-
nano[
|
|
1342
|
+
var fail3 = (error) => {
|
|
1343
|
+
const nano = Object.create(FailureProto2);
|
|
1344
|
+
nano[args2] = error;
|
|
932
1345
|
return nano;
|
|
933
1346
|
};
|
|
934
1347
|
var SuspendProto = {
|
|
935
1348
|
...PrimitiveProto,
|
|
936
|
-
[
|
|
937
|
-
return this[
|
|
1349
|
+
[evaluate2]() {
|
|
1350
|
+
return this[args2]();
|
|
938
1351
|
}
|
|
939
1352
|
};
|
|
940
1353
|
var suspend = (fn2) => {
|
|
941
1354
|
const nano = Object.create(SuspendProto);
|
|
942
|
-
nano[
|
|
1355
|
+
nano[args2] = fn2;
|
|
943
1356
|
return nano;
|
|
944
1357
|
};
|
|
945
1358
|
var NanoFiber = class {
|
|
@@ -951,7 +1364,7 @@ var NanoFiber = class {
|
|
|
951
1364
|
runLoop(nano) {
|
|
952
1365
|
let current = nano;
|
|
953
1366
|
while (true) {
|
|
954
|
-
current = current[
|
|
1367
|
+
current = current[evaluate2](this);
|
|
955
1368
|
if (current === NanoYield) {
|
|
956
1369
|
return this._yielded;
|
|
957
1370
|
}
|
|
@@ -961,7 +1374,7 @@ var NanoFiber = class {
|
|
|
961
1374
|
while (true) {
|
|
962
1375
|
const op = this._stack.pop();
|
|
963
1376
|
if (!op) return void 0;
|
|
964
|
-
const cont = op[
|
|
1377
|
+
const cont = op[contAll2] && op[contAll2](this);
|
|
965
1378
|
if (cont) return { [symbol3]: cont };
|
|
966
1379
|
if (op[symbol3]) return op;
|
|
967
1380
|
}
|
|
@@ -975,8 +1388,8 @@ var timings = {};
|
|
|
975
1388
|
var timingsCount = {};
|
|
976
1389
|
var WithSpanProto = {
|
|
977
1390
|
...PrimitiveProto,
|
|
978
|
-
[
|
|
979
|
-
const [fa, name] = this[
|
|
1391
|
+
[evaluate2](fiber) {
|
|
1392
|
+
const [fa, name] = this[args2];
|
|
980
1393
|
if (!debugPerformance) return fa;
|
|
981
1394
|
const previousSpan = fiber._lastSpan;
|
|
982
1395
|
fiber._lastSpan = name;
|
|
@@ -987,20 +1400,20 @@ var WithSpanProto = {
|
|
|
987
1400
|
const end = performance.now();
|
|
988
1401
|
timings[name] = (timings[name] || 0) + (end - start);
|
|
989
1402
|
fiber._lastSpan = previousSpan;
|
|
990
|
-
return
|
|
1403
|
+
return succeed3(_);
|
|
991
1404
|
},
|
|
992
1405
|
onFailure: (_) => {
|
|
993
1406
|
const end = performance.now();
|
|
994
1407
|
timings[name] = (timings[name] || 0) + (end - start);
|
|
995
1408
|
fiber._lastSpan = previousSpan;
|
|
996
|
-
return
|
|
1409
|
+
return fail3(_);
|
|
997
1410
|
}
|
|
998
1411
|
});
|
|
999
1412
|
}
|
|
1000
1413
|
};
|
|
1001
1414
|
var withSpan = (name) => (fa) => {
|
|
1002
1415
|
const nano = Object.create(WithSpanProto);
|
|
1003
|
-
nano[
|
|
1416
|
+
nano[args2] = [fa, name];
|
|
1004
1417
|
return nano;
|
|
1005
1418
|
};
|
|
1006
1419
|
var run = (nano) => {
|
|
@@ -1008,86 +1421,86 @@ var run = (nano) => {
|
|
|
1008
1421
|
try {
|
|
1009
1422
|
const result = fiber.runLoop(nano);
|
|
1010
1423
|
if (result._tag === "Success") {
|
|
1011
|
-
return
|
|
1424
|
+
return succeed2(result.value);
|
|
1012
1425
|
}
|
|
1013
|
-
return
|
|
1426
|
+
return fail2(result.value);
|
|
1014
1427
|
} catch (e) {
|
|
1015
|
-
return
|
|
1428
|
+
return fail2(new NanoDefectException(e, fiber._lastSpan));
|
|
1016
1429
|
}
|
|
1017
1430
|
};
|
|
1018
1431
|
var OnSuccessProto = {
|
|
1019
1432
|
...PrimitiveProto,
|
|
1020
|
-
[
|
|
1433
|
+
[evaluate2](fiber) {
|
|
1021
1434
|
fiber._stack.push(this);
|
|
1022
|
-
return this[
|
|
1435
|
+
return this[args2];
|
|
1023
1436
|
}
|
|
1024
1437
|
};
|
|
1025
1438
|
var flatMap2 = dual(2, (fa, f) => {
|
|
1026
1439
|
const nano = Object.create(OnSuccessProto);
|
|
1027
|
-
nano[
|
|
1028
|
-
nano[
|
|
1440
|
+
nano[args2] = fa;
|
|
1441
|
+
nano[contA2] = f;
|
|
1029
1442
|
return nano;
|
|
1030
1443
|
});
|
|
1031
|
-
var map4 = dual(2, (fa, f) => flatMap2(fa, (_) =>
|
|
1444
|
+
var map4 = dual(2, (fa, f) => flatMap2(fa, (_) => succeed3(f(_))));
|
|
1032
1445
|
var SyncProto = {
|
|
1033
1446
|
...PrimitiveProto,
|
|
1034
|
-
[
|
|
1035
|
-
const value = this[
|
|
1036
|
-
const cont = fiber.getCont(
|
|
1037
|
-
return cont ? cont[
|
|
1447
|
+
[evaluate2](fiber) {
|
|
1448
|
+
const value = this[args2]();
|
|
1449
|
+
const cont = fiber.getCont(contA2);
|
|
1450
|
+
return cont ? cont[contA2](value, fiber) : fiber.yieldWith(succeed3(value));
|
|
1038
1451
|
}
|
|
1039
1452
|
};
|
|
1040
1453
|
var sync = (f) => {
|
|
1041
1454
|
const nano = Object.create(SyncProto);
|
|
1042
|
-
nano[
|
|
1455
|
+
nano[args2] = f;
|
|
1043
1456
|
return nano;
|
|
1044
1457
|
};
|
|
1045
|
-
var void_ =
|
|
1458
|
+
var void_ = succeed3(void 0);
|
|
1046
1459
|
var FromIteratorProto = {
|
|
1047
1460
|
...PrimitiveProto,
|
|
1048
|
-
[
|
|
1049
|
-
const state = this[
|
|
1050
|
-
if (state.done) return
|
|
1461
|
+
[contA2](value, fiber) {
|
|
1462
|
+
const state = this[args2][0].next(value);
|
|
1463
|
+
if (state.done) return succeed3(state.value);
|
|
1051
1464
|
fiber._stack.push(this);
|
|
1052
1465
|
return state.value;
|
|
1053
1466
|
},
|
|
1054
|
-
[
|
|
1055
|
-
return this[
|
|
1467
|
+
[evaluate2](fiber) {
|
|
1468
|
+
return this[contA2](this[args2][1], fiber);
|
|
1056
1469
|
}
|
|
1057
1470
|
};
|
|
1058
1471
|
var unsafeFromIterator = (iterator, initial) => {
|
|
1059
1472
|
const nano = Object.create(FromIteratorProto);
|
|
1060
|
-
nano[
|
|
1473
|
+
nano[args2] = [iterator, initial];
|
|
1061
1474
|
return nano;
|
|
1062
1475
|
};
|
|
1063
|
-
var gen = (...
|
|
1064
|
-
var fn = (_) => (body) => (...
|
|
1476
|
+
var gen = (...args3) => suspend(() => unsafeFromIterator(args3[0]()));
|
|
1477
|
+
var fn = (_) => (body) => (...args3) => withSpan(_)(suspend(() => unsafeFromIterator(body(...args3))));
|
|
1065
1478
|
var MatchProto = {
|
|
1066
1479
|
...PrimitiveProto,
|
|
1067
|
-
[
|
|
1480
|
+
[evaluate2](fiber) {
|
|
1068
1481
|
fiber._stack.push(this);
|
|
1069
|
-
return this[
|
|
1482
|
+
return this[args2];
|
|
1070
1483
|
}
|
|
1071
1484
|
};
|
|
1072
1485
|
var match = (fa, opts) => {
|
|
1073
1486
|
const nano = Object.create(MatchProto);
|
|
1074
|
-
nano[
|
|
1075
|
-
nano[
|
|
1076
|
-
nano[
|
|
1487
|
+
nano[args2] = fa;
|
|
1488
|
+
nano[contA2] = opts.onSuccess;
|
|
1489
|
+
nano[contE2] = opts.onFailure;
|
|
1077
1490
|
return nano;
|
|
1078
1491
|
};
|
|
1079
1492
|
var orElse2 = (f) => (fa) => {
|
|
1080
1493
|
const nano = Object.create(MatchProto);
|
|
1081
|
-
nano[
|
|
1082
|
-
nano[
|
|
1494
|
+
nano[args2] = fa;
|
|
1495
|
+
nano[contE2] = (_) => _ instanceof NanoDefectException ? fail3(_) : f(_);
|
|
1083
1496
|
return nano;
|
|
1084
1497
|
};
|
|
1085
1498
|
var firstSuccessOf = (arr) => arr.slice(1).reduce((arr2, fa) => orElse2(() => fa)(arr2), arr[0]);
|
|
1086
1499
|
var ProvideServiceProto = {
|
|
1087
1500
|
...PrimitiveProto,
|
|
1088
|
-
[
|
|
1501
|
+
[evaluate2](fiber) {
|
|
1089
1502
|
const prevServices = fiber._services;
|
|
1090
|
-
const [fa, tag, value] = this[
|
|
1503
|
+
const [fa, tag, value] = this[args2];
|
|
1091
1504
|
fiber._services = {
|
|
1092
1505
|
...fiber._services,
|
|
1093
1506
|
[tag.key]: value
|
|
@@ -1095,54 +1508,54 @@ var ProvideServiceProto = {
|
|
|
1095
1508
|
return match(fa, {
|
|
1096
1509
|
onSuccess: (_) => {
|
|
1097
1510
|
fiber._services = prevServices;
|
|
1098
|
-
return
|
|
1511
|
+
return succeed3(_);
|
|
1099
1512
|
},
|
|
1100
1513
|
onFailure: (_) => {
|
|
1101
1514
|
fiber._services = prevServices;
|
|
1102
|
-
return
|
|
1515
|
+
return fail3(_);
|
|
1103
1516
|
}
|
|
1104
1517
|
});
|
|
1105
1518
|
}
|
|
1106
1519
|
};
|
|
1107
1520
|
var provideService = (tag, value) => (fa) => {
|
|
1108
1521
|
const nano = Object.create(ProvideServiceProto);
|
|
1109
|
-
nano[
|
|
1522
|
+
nano[args2] = [fa, tag, value];
|
|
1110
1523
|
return nano;
|
|
1111
1524
|
};
|
|
1112
1525
|
var ServiceProto = {
|
|
1113
1526
|
...PrimitiveProto,
|
|
1114
|
-
[
|
|
1115
|
-
const tag = this[
|
|
1527
|
+
[evaluate2](fiber) {
|
|
1528
|
+
const tag = this[args2];
|
|
1116
1529
|
if (tag.key in fiber._services) {
|
|
1117
1530
|
const value = fiber._services[tag.key];
|
|
1118
|
-
const cont2 = fiber.getCont(
|
|
1119
|
-
return cont2 ? cont2[
|
|
1531
|
+
const cont2 = fiber.getCont(contA2);
|
|
1532
|
+
return cont2 ? cont2[contA2](value, fiber) : fiber.yieldWith(succeed3(value));
|
|
1120
1533
|
}
|
|
1121
|
-
const cont = fiber.getCont(
|
|
1122
|
-
return cont ? cont[
|
|
1534
|
+
const cont = fiber.getCont(contE2);
|
|
1535
|
+
return cont ? cont[contE2](tag, fiber) : fiber.yieldWith(fail3(new NanoDefectException(`Service ${tag.key} not found`, fiber._lastSpan)));
|
|
1123
1536
|
}
|
|
1124
1537
|
};
|
|
1125
1538
|
var service = (tag) => {
|
|
1126
1539
|
const nano = Object.create(ServiceProto);
|
|
1127
|
-
nano[
|
|
1540
|
+
nano[args2] = tag;
|
|
1128
1541
|
return nano;
|
|
1129
1542
|
};
|
|
1130
1543
|
var CachedProto = {
|
|
1131
1544
|
...PrimitiveProto,
|
|
1132
|
-
[
|
|
1133
|
-
const [fa, type, key] = this[
|
|
1545
|
+
[evaluate2](fiber) {
|
|
1546
|
+
const [fa, type, key] = this[args2];
|
|
1134
1547
|
const cache = fiber._cache[type] || /* @__PURE__ */ new WeakMap();
|
|
1135
1548
|
fiber._cache[type] = cache;
|
|
1136
|
-
const
|
|
1137
|
-
if (
|
|
1549
|
+
const cached = cache.get(key);
|
|
1550
|
+
if (cached) return cached;
|
|
1138
1551
|
return match(fa, {
|
|
1139
1552
|
onSuccess: (_) => {
|
|
1140
|
-
cache.set(key,
|
|
1141
|
-
return
|
|
1553
|
+
cache.set(key, succeed3(_));
|
|
1554
|
+
return succeed3(_);
|
|
1142
1555
|
},
|
|
1143
1556
|
onFailure: (_) => {
|
|
1144
|
-
cache.set(key,
|
|
1145
|
-
return
|
|
1557
|
+
cache.set(key, fail3(_));
|
|
1558
|
+
return fail3(_);
|
|
1146
1559
|
}
|
|
1147
1560
|
});
|
|
1148
1561
|
}
|
|
@@ -1150,35 +1563,35 @@ var CachedProto = {
|
|
|
1150
1563
|
function cachedBy(fa, type, lookupKey) {
|
|
1151
1564
|
return (...p) => {
|
|
1152
1565
|
const nano = Object.create(CachedProto);
|
|
1153
|
-
nano[
|
|
1566
|
+
nano[args2] = [fa(...p), type, lookupKey(...p)];
|
|
1154
1567
|
return nano;
|
|
1155
1568
|
};
|
|
1156
1569
|
}
|
|
1157
1570
|
var option = (fa) => {
|
|
1158
1571
|
const nano = Object.create(MatchProto);
|
|
1159
|
-
nano[
|
|
1160
|
-
nano[
|
|
1161
|
-
nano[
|
|
1572
|
+
nano[args2] = fa;
|
|
1573
|
+
nano[contA2] = (_) => succeed3(some2(_));
|
|
1574
|
+
nano[contE2] = (_) => _ instanceof NanoDefectException ? fail3(_) : succeed3(none2());
|
|
1162
1575
|
return nano;
|
|
1163
1576
|
};
|
|
1164
1577
|
var orUndefined = (fa) => {
|
|
1165
1578
|
const nano = Object.create(MatchProto);
|
|
1166
|
-
nano[
|
|
1167
|
-
nano[
|
|
1168
|
-
nano[
|
|
1579
|
+
nano[args2] = fa;
|
|
1580
|
+
nano[contA2] = (_) => succeed3(_);
|
|
1581
|
+
nano[contE2] = (_) => _ instanceof NanoDefectException ? fail3(_) : succeed3(void 0);
|
|
1169
1582
|
return nano;
|
|
1170
1583
|
};
|
|
1171
1584
|
var ignore = (fa) => {
|
|
1172
1585
|
const nano = Object.create(MatchProto);
|
|
1173
|
-
nano[
|
|
1174
|
-
nano[
|
|
1175
|
-
nano[
|
|
1586
|
+
nano[args2] = fa;
|
|
1587
|
+
nano[contA2] = (_) => void_;
|
|
1588
|
+
nano[contE2] = (_) => _ instanceof NanoDefectException ? fail3(_) : void_;
|
|
1176
1589
|
return nano;
|
|
1177
1590
|
};
|
|
1178
1591
|
var all = fn("all")(
|
|
1179
|
-
function* (...
|
|
1592
|
+
function* (...args3) {
|
|
1180
1593
|
const results = [];
|
|
1181
|
-
for (const fa of
|
|
1594
|
+
for (const fa of args3) {
|
|
1182
1595
|
const result = yield* fa;
|
|
1183
1596
|
results.push(result);
|
|
1184
1597
|
}
|
|
@@ -1192,7 +1605,7 @@ function isValidSeverityLevel(value) {
|
|
|
1192
1605
|
return value === "off" || value === "error" || value === "warning" || value === "message" || value === "suggestion";
|
|
1193
1606
|
}
|
|
1194
1607
|
function parseDiagnosticSeverity(config) {
|
|
1195
|
-
if (!
|
|
1608
|
+
if (!isObject(config)) return {};
|
|
1196
1609
|
return Object.fromEntries(
|
|
1197
1610
|
pipe(
|
|
1198
1611
|
Object.entries(config),
|
|
@@ -1255,7 +1668,7 @@ function parse(config) {
|
|
|
1255
1668
|
return {
|
|
1256
1669
|
refactors: isObject(config) && hasProperty(config, "refactors") && isBoolean(config.refactors) ? config.refactors : defaults.refactors,
|
|
1257
1670
|
diagnostics: isObject(config) && hasProperty(config, "diagnostics") && isBoolean(config.diagnostics) ? config.diagnostics : defaults.diagnostics,
|
|
1258
|
-
diagnosticSeverity: isObject(config) && hasProperty(config, "diagnosticSeverity") &&
|
|
1671
|
+
diagnosticSeverity: isObject(config) && hasProperty(config, "diagnosticSeverity") && isObject(config.diagnosticSeverity) ? parseDiagnosticSeverity(config.diagnosticSeverity) : defaults.diagnosticSeverity,
|
|
1259
1672
|
diagnosticsName: isObject(config) && hasProperty(config, "diagnosticsName") && isBoolean(config.diagnosticsName) ? config.diagnosticsName : defaults.diagnosticsName,
|
|
1260
1673
|
missingDiagnosticNextLine: isObject(config) && hasProperty(config, "missingDiagnosticNextLine") && isString(config.missingDiagnosticNextLine) && isValidSeverityLevel(config.missingDiagnosticNextLine) ? config.missingDiagnosticNextLine : defaults.missingDiagnosticNextLine,
|
|
1261
1674
|
includeSuggestionsInTsc: isObject(config) && hasProperty(config, "includeSuggestionsInTsc") && isBoolean(config.includeSuggestionsInTsc) ? config.includeSuggestionsInTsc : defaults.includeSuggestionsInTsc,
|
|
@@ -1270,7 +1683,7 @@ function parse(config) {
|
|
|
1270
1683
|
allowedDuplicatedPackages: isObject(config) && hasProperty(config, "allowedDuplicatedPackages") && isArray(config.allowedDuplicatedPackages) && config.allowedDuplicatedPackages.every(isString) ? config.allowedDuplicatedPackages.map((_) => _.toLowerCase()) : defaults.allowedDuplicatedPackages,
|
|
1271
1684
|
namespaceImportPackages: isObject(config) && hasProperty(config, "namespaceImportPackages") && isArray(config.namespaceImportPackages) && config.namespaceImportPackages.every(isString) ? config.namespaceImportPackages.map((_) => _.toLowerCase()) : defaults.namespaceImportPackages,
|
|
1272
1685
|
barrelImportPackages: isObject(config) && hasProperty(config, "barrelImportPackages") && isArray(config.barrelImportPackages) && config.barrelImportPackages.every(isString) ? config.barrelImportPackages.map((_) => _.toLowerCase()) : defaults.barrelImportPackages,
|
|
1273
|
-
importAliases: isObject(config) && hasProperty(config, "importAliases") &&
|
|
1686
|
+
importAliases: isObject(config) && hasProperty(config, "importAliases") && isObject(config.importAliases) ? map2(config.importAliases, (value) => String(value)) : defaults.importAliases,
|
|
1274
1687
|
topLevelNamedReexports: isObject(config) && hasProperty(config, "topLevelNamedReexports") && isString(config.topLevelNamedReexports) && ["ignore", "follow"].includes(config.topLevelNamedReexports.toLowerCase()) ? config.topLevelNamedReexports.toLowerCase() : defaults.topLevelNamedReexports,
|
|
1275
1688
|
renames: isObject(config) && hasProperty(config, "renames") && isBoolean(config.renames) ? config.renames : defaults.renames,
|
|
1276
1689
|
noExternal: isObject(config) && hasProperty(config, "noExternal") && isBoolean(config.noExternal) ? config.noExternal : defaults.noExternal,
|
|
@@ -1289,9 +1702,9 @@ var TypeScriptProgram = Tag("TypeScriptProgram");
|
|
|
1289
1702
|
var ChangeTracker = Tag("ChangeTracker");
|
|
1290
1703
|
function getPackageJsonInfoCache(program) {
|
|
1291
1704
|
try {
|
|
1292
|
-
if (hasProperty(program, "getModuleResolutionCache") &&
|
|
1705
|
+
if (hasProperty(program, "getModuleResolutionCache") && isFunction(program.getModuleResolutionCache)) {
|
|
1293
1706
|
const moduleResolutionCache = program.getModuleResolutionCache();
|
|
1294
|
-
if (hasProperty(moduleResolutionCache, "getPackageJsonInfoCache") &&
|
|
1707
|
+
if (hasProperty(moduleResolutionCache, "getPackageJsonInfoCache") && isFunction(moduleResolutionCache.getPackageJsonInfoCache)) {
|
|
1295
1708
|
return moduleResolutionCache.getPackageJsonInfoCache();
|
|
1296
1709
|
}
|
|
1297
1710
|
}
|
|
@@ -1302,7 +1715,7 @@ function getPackageJsonInfoCache(program) {
|
|
|
1302
1715
|
}
|
|
1303
1716
|
function getDirectoryPath(ts, path) {
|
|
1304
1717
|
try {
|
|
1305
|
-
if (hasProperty(ts, "getDirectoryPath") &&
|
|
1718
|
+
if (hasProperty(ts, "getDirectoryPath") && isFunction(ts.getDirectoryPath)) {
|
|
1306
1719
|
return ts.getDirectoryPath(path);
|
|
1307
1720
|
}
|
|
1308
1721
|
return path;
|
|
@@ -1311,7 +1724,7 @@ function getDirectoryPath(ts, path) {
|
|
|
1311
1724
|
}
|
|
1312
1725
|
}
|
|
1313
1726
|
function makeGetModuleSpecifier(ts) {
|
|
1314
|
-
if (!(hasProperty(ts, "moduleSpecifiers") && hasProperty(ts.moduleSpecifiers, "getModuleSpecifier") &&
|
|
1727
|
+
if (!(hasProperty(ts, "moduleSpecifiers") && hasProperty(ts.moduleSpecifiers, "getModuleSpecifier") && isFunction(ts.moduleSpecifiers.getModuleSpecifier))) return;
|
|
1315
1728
|
const _internal = ts.moduleSpecifiers.getModuleSpecifier;
|
|
1316
1729
|
return (compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, options) => {
|
|
1317
1730
|
return _internal(
|
|
@@ -1325,14 +1738,14 @@ function makeGetModuleSpecifier(ts) {
|
|
|
1325
1738
|
};
|
|
1326
1739
|
}
|
|
1327
1740
|
function makeGetTemporaryModuleResolutionState(ts) {
|
|
1328
|
-
if (hasProperty(ts, "getTemporaryModuleResolutionState") &&
|
|
1741
|
+
if (hasProperty(ts, "getTemporaryModuleResolutionState") && isFunction(ts.getTemporaryModuleResolutionState)) {
|
|
1329
1742
|
const _internal = ts.getTemporaryModuleResolutionState;
|
|
1330
1743
|
return (cache, program, compilerOptions) => _internal(cache, program, compilerOptions);
|
|
1331
1744
|
}
|
|
1332
1745
|
return void 0;
|
|
1333
1746
|
}
|
|
1334
1747
|
function makeGetPackageScopeForPath(ts) {
|
|
1335
|
-
if (hasProperty(ts, "getPackageScopeForPath") &&
|
|
1748
|
+
if (hasProperty(ts, "getPackageScopeForPath") && isFunction(ts.getPackageScopeForPath)) {
|
|
1336
1749
|
const _internal = ts.getPackageScopeForPath;
|
|
1337
1750
|
return (path, state) => _internal(path, state);
|
|
1338
1751
|
}
|
|
@@ -1590,7 +2003,7 @@ function makeTypeScriptUtils(ts) {
|
|
|
1590
2003
|
}
|
|
1591
2004
|
} else if (ts.isNamedImports(namedBindings)) {
|
|
1592
2005
|
for (const importSpecifier of namedBindings.elements) {
|
|
1593
|
-
const importProperty =
|
|
2006
|
+
const importProperty = fromNullishOr(importSpecifier.propertyName).pipe(
|
|
1594
2007
|
orElse(() => some2(importSpecifier.name))
|
|
1595
2008
|
);
|
|
1596
2009
|
if (test(importSpecifier.name, statement.moduleSpecifier, importProperty)) {
|
|
@@ -1943,7 +2356,7 @@ var codeFixesToApplicableRefactor = fn("LSP.codeFixesToApplicableRefactor")(func
|
|
|
1943
2356
|
var getEditsForRefactor = fn("LSP.getEditsForRefactor")(function* (refactors, sourceFile, positionOrRange, refactorName) {
|
|
1944
2357
|
const refactor = refactors.find((refactor2) => refactorNameToFullyQualifiedName(refactor2.name) === refactorName);
|
|
1945
2358
|
if (!refactor) {
|
|
1946
|
-
return yield*
|
|
2359
|
+
return yield* fail3(new RefactorNotApplicableError());
|
|
1947
2360
|
}
|
|
1948
2361
|
const textRange = typeof positionOrRange === "number" ? { pos: positionOrRange, end: positionOrRange } : positionOrRange;
|
|
1949
2362
|
return yield* refactor.apply(sourceFile, textRange);
|
|
@@ -1954,7 +2367,7 @@ var getEditsForCodeFixes = fn("LSP.getEditsForCodeFixes")(function* (codeFixes,
|
|
|
1954
2367
|
(_) => codeFixNameToFullyQualifiedName(_.fixName) === refactorName && _.start <= textRange.pos && _.end >= textRange.end
|
|
1955
2368
|
);
|
|
1956
2369
|
if (!fixToRun) {
|
|
1957
|
-
return yield*
|
|
2370
|
+
return yield* fail3(new RefactorNotApplicableError());
|
|
1958
2371
|
}
|
|
1959
2372
|
return fixToRun;
|
|
1960
2373
|
});
|
|
@@ -2209,7 +2622,7 @@ var getEditsForCodegen = fn("LSP.getEditsForCodegen")(function* (codegens2, sour
|
|
|
2209
2622
|
(codegen2) => codegen2.range.pos <= textRange.pos && codegen2.range.end >= textRange.end
|
|
2210
2623
|
);
|
|
2211
2624
|
if (inRangeCodegens.length !== 1) {
|
|
2212
|
-
return yield*
|
|
2625
|
+
return yield* fail3(new CodegenNotApplicableError("zero or multiple codegens in range"));
|
|
2213
2626
|
}
|
|
2214
2627
|
const { codegen, range } = inRangeCodegens[0];
|
|
2215
2628
|
const edit = yield* codegen.apply(sourceFile, range);
|
|
@@ -2408,8 +2821,8 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
|
|
|
2408
2821
|
};
|
|
2409
2822
|
const expectedAndRealTypeCache = /* @__PURE__ */ new WeakMap();
|
|
2410
2823
|
const expectedAndRealType = (sourceFile) => {
|
|
2411
|
-
const
|
|
2412
|
-
if (
|
|
2824
|
+
const cached = expectedAndRealTypeCache.get(sourceFile);
|
|
2825
|
+
if (cached) return cached;
|
|
2413
2826
|
const result = [];
|
|
2414
2827
|
const nodeToVisit = [sourceFile];
|
|
2415
2828
|
const appendNodeToVisit = (node) => {
|
|
@@ -2626,7 +3039,7 @@ var nanoLayer3 = (fa) => gen(function* () {
|
|
|
2626
3039
|
});
|
|
2627
3040
|
var TypeParserIssue = class _TypeParserIssue {
|
|
2628
3041
|
_tag = "@effect/language-service/TypeParserIssue";
|
|
2629
|
-
static issue =
|
|
3042
|
+
static issue = fail3(new _TypeParserIssue());
|
|
2630
3043
|
};
|
|
2631
3044
|
function typeParserIssue(_message, _type, _node) {
|
|
2632
3045
|
return TypeParserIssue.issue;
|
|
@@ -2825,7 +3238,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
2825
3238
|
if (signatures[0].typeParameters && signatures[0].typeParameters.length > 0) {
|
|
2826
3239
|
return typeParserIssue("Invariant type should not have type parameters", type);
|
|
2827
3240
|
}
|
|
2828
|
-
return
|
|
3241
|
+
return succeed3(typeChecker.getReturnTypeOfSignature(signatures[0]));
|
|
2829
3242
|
}
|
|
2830
3243
|
function contravariantTypeArgument(type) {
|
|
2831
3244
|
const signatures = typeChecker.getSignaturesOfType(type, ts.SignatureKind.Call);
|
|
@@ -2835,7 +3248,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
2835
3248
|
if (signatures[0].typeParameters && signatures[0].typeParameters.length > 0) {
|
|
2836
3249
|
return typeParserIssue("Invariant type should not have type parameters", type);
|
|
2837
3250
|
}
|
|
2838
|
-
return
|
|
3251
|
+
return succeed3(typeCheckerUtils.getTypeParameterAtPosition(signatures[0], 0));
|
|
2839
3252
|
}
|
|
2840
3253
|
function invariantTypeArgument(type) {
|
|
2841
3254
|
const signatures = typeChecker.getSignaturesOfType(type, ts.SignatureKind.Call);
|
|
@@ -2845,7 +3258,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
2845
3258
|
if (signatures[0].typeParameters && signatures[0].typeParameters.length > 0) {
|
|
2846
3259
|
return typeParserIssue("Invariant type should not have type parameters", type);
|
|
2847
3260
|
}
|
|
2848
|
-
return
|
|
3261
|
+
return succeed3(typeChecker.getReturnTypeOfSignature(signatures[0]));
|
|
2849
3262
|
}
|
|
2850
3263
|
const pipeableType = cachedBy(
|
|
2851
3264
|
function(type, atLocation) {
|
|
@@ -2858,7 +3271,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
2858
3271
|
if (signatures.length === 0) {
|
|
2859
3272
|
return typeParserIssue("'pipe' property is not callable", type, atLocation);
|
|
2860
3273
|
}
|
|
2861
|
-
return
|
|
3274
|
+
return succeed3(type);
|
|
2862
3275
|
},
|
|
2863
3276
|
"TypeParser.pipeableType",
|
|
2864
3277
|
(type) => type
|
|
@@ -3322,7 +3735,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
3322
3735
|
const type = typeCheckerUtils.getTypeAtLocation(yieldedExpression);
|
|
3323
3736
|
if (!type) continue;
|
|
3324
3737
|
const { A: successType } = yield* effectType(type, yieldedExpression);
|
|
3325
|
-
let replacementNode =
|
|
3738
|
+
let replacementNode = succeed3(yieldedExpression);
|
|
3326
3739
|
if (!explicitReturn && !(successType.flags & ts.TypeFlags.VoidLike)) {
|
|
3327
3740
|
replacementNode = pipe(
|
|
3328
3741
|
gen(function* () {
|
|
@@ -3533,15 +3946,15 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
3533
3946
|
if (node.arguments.length === 0) {
|
|
3534
3947
|
return typeParserIssue("Node is not a pipe call", void 0, node);
|
|
3535
3948
|
}
|
|
3536
|
-
const [subject, ...
|
|
3537
|
-
return
|
|
3949
|
+
const [subject, ...args3] = node.arguments;
|
|
3950
|
+
return succeed3({
|
|
3538
3951
|
node,
|
|
3539
3952
|
subject,
|
|
3540
|
-
args:
|
|
3953
|
+
args: args3,
|
|
3541
3954
|
kind: "pipe"
|
|
3542
3955
|
});
|
|
3543
3956
|
}
|
|
3544
|
-
return
|
|
3957
|
+
return succeed3({
|
|
3545
3958
|
node,
|
|
3546
3959
|
subject: baseExpression,
|
|
3547
3960
|
args: Array.from(node.arguments),
|
|
@@ -3551,8 +3964,8 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
3551
3964
|
);
|
|
3552
3965
|
}
|
|
3553
3966
|
if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && ts.idText(node.expression) === "pipe" && node.arguments.length > 0) {
|
|
3554
|
-
const [subject, ...
|
|
3555
|
-
return
|
|
3967
|
+
const [subject, ...args3] = node.arguments;
|
|
3968
|
+
return succeed3({ node, subject, args: args3, kind: "pipe" });
|
|
3556
3969
|
}
|
|
3557
3970
|
return typeParserIssue("Node is not a pipe call", void 0, node);
|
|
3558
3971
|
},
|
|
@@ -3567,7 +3980,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
3567
3980
|
if (node.arguments.length !== 1) {
|
|
3568
3981
|
return typeParserIssue("Node must have exactly one argument", void 0, node);
|
|
3569
3982
|
}
|
|
3570
|
-
return
|
|
3983
|
+
return succeed3({
|
|
3571
3984
|
node,
|
|
3572
3985
|
callee: node.expression,
|
|
3573
3986
|
subject: node.arguments[0]
|
|
@@ -3629,7 +4042,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
3629
4042
|
if (!callbackParameterType) {
|
|
3630
4043
|
continue;
|
|
3631
4044
|
}
|
|
3632
|
-
return
|
|
4045
|
+
return succeed3({
|
|
3633
4046
|
type: callbackParameterType
|
|
3634
4047
|
});
|
|
3635
4048
|
}
|
|
@@ -4041,9 +4454,9 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
4041
4454
|
let accessors2 = void 0;
|
|
4042
4455
|
let dependencies = void 0;
|
|
4043
4456
|
if (wholeCall.arguments.length >= 2) {
|
|
4044
|
-
const
|
|
4045
|
-
if (ts.isObjectLiteralExpression(
|
|
4046
|
-
for (const property of
|
|
4457
|
+
const args3 = wholeCall.arguments[1];
|
|
4458
|
+
if (ts.isObjectLiteralExpression(args3)) {
|
|
4459
|
+
for (const property of args3.properties) {
|
|
4047
4460
|
if (ts.isPropertyAssignment(property) && property.name && ts.isIdentifier(property.name) && ts.idText(property.name) === "accessors" && property.initializer && property.initializer.kind === ts.SyntaxKind.TrueKeyword) {
|
|
4048
4461
|
accessors2 = true;
|
|
4049
4462
|
}
|
|
@@ -4248,7 +4661,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
4248
4661
|
const body = node.body;
|
|
4249
4662
|
const returnType = node.type;
|
|
4250
4663
|
if (ts.isArrowFunction(node) && !ts.isBlock(body)) {
|
|
4251
|
-
return
|
|
4664
|
+
return succeed3({
|
|
4252
4665
|
node,
|
|
4253
4666
|
body,
|
|
4254
4667
|
expression: body,
|
|
@@ -4266,7 +4679,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
4266
4679
|
if (!stmt.expression) {
|
|
4267
4680
|
return typeParserIssue("Return statement must have an expression", void 0, node);
|
|
4268
4681
|
}
|
|
4269
|
-
return
|
|
4682
|
+
return succeed3({
|
|
4270
4683
|
node,
|
|
4271
4684
|
body,
|
|
4272
4685
|
expression: stmt.expression,
|
|
@@ -4291,7 +4704,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
4291
4704
|
if (body.statements.length !== 0) {
|
|
4292
4705
|
return typeParserIssue("Block must have zero statements", void 0, node);
|
|
4293
4706
|
}
|
|
4294
|
-
return
|
|
4707
|
+
return succeed3({
|
|
4295
4708
|
node,
|
|
4296
4709
|
body,
|
|
4297
4710
|
returnType
|
|
@@ -4988,10 +5401,10 @@ var getOrMakeKeyBuilder = fn("getOrMakeKeyBuilder")(function* (sourceFile) {
|
|
|
4988
5401
|
keyBuilderCache.set(sourceFile.fileName, keyBuilder);
|
|
4989
5402
|
return keyBuilder;
|
|
4990
5403
|
});
|
|
4991
|
-
function createString(sourceFile,
|
|
5404
|
+
function createString(sourceFile, identifier2, kind) {
|
|
4992
5405
|
return map4(
|
|
4993
5406
|
getOrMakeKeyBuilder(sourceFile),
|
|
4994
|
-
(identifierBuilder) => identifierBuilder.createString(
|
|
5407
|
+
(identifierBuilder) => identifierBuilder.createString(identifier2, kind)
|
|
4995
5408
|
);
|
|
4996
5409
|
}
|
|
4997
5410
|
|
|
@@ -5043,7 +5456,7 @@ var deterministicKeys = createDiagnostic({
|
|
|
5043
5456
|
const parameterSourceFile = typeScriptUtils.getSourceFileOfNode(declaration);
|
|
5044
5457
|
const paramText = parameterSourceFile.text.substring(declaration.pos, declaration.end);
|
|
5045
5458
|
if (paramText.toLowerCase().includes("@effect-identifier")) {
|
|
5046
|
-
return
|
|
5459
|
+
return succeed3({ className, keyStringLiteral: arg, target: "custom" });
|
|
5047
5460
|
}
|
|
5048
5461
|
}
|
|
5049
5462
|
}
|
|
@@ -5338,7 +5751,7 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
5338
5751
|
const isWithSpan = yield* pipe(
|
|
5339
5752
|
typeParser.isNodeReferenceToEffectModuleApi("withSpan")(callee),
|
|
5340
5753
|
map4(() => true),
|
|
5341
|
-
orElse2(() =>
|
|
5754
|
+
orElse2(() => succeed3(false))
|
|
5342
5755
|
);
|
|
5343
5756
|
if (!isWithSpan) return void 0;
|
|
5344
5757
|
if (expr.arguments.length === 0) return void 0;
|
|
@@ -5351,8 +5764,8 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
5351
5764
|
if (!bodyExpression) return yield* TypeParserIssue.issue;
|
|
5352
5765
|
const { pipeArguments: pipeArguments2, subject } = yield* pipe(
|
|
5353
5766
|
typeParser.pipeCall(bodyExpression),
|
|
5354
|
-
map4(({ args:
|
|
5355
|
-
orElse2(() =>
|
|
5767
|
+
map4(({ args: args3, subject: subject2 }) => ({ subject: subject2, pipeArguments: args3 })),
|
|
5768
|
+
orElse2(() => succeed3({ subject: bodyExpression, pipeArguments: [] }))
|
|
5356
5769
|
);
|
|
5357
5770
|
const { effectModule, generatorFunction } = yield* typeParser.effectGen(subject);
|
|
5358
5771
|
const effectModuleName = ts.isIdentifier(effectModule) ? ts.idText(effectModule) : sourceEffectModuleName;
|
|
@@ -5369,17 +5782,17 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
5369
5782
|
const isInsideEffectFn = (fnNode) => {
|
|
5370
5783
|
const parent = fnNode.parent;
|
|
5371
5784
|
if (!parent || !ts.isCallExpression(parent)) {
|
|
5372
|
-
return
|
|
5785
|
+
return succeed3(false);
|
|
5373
5786
|
}
|
|
5374
5787
|
if (parent.arguments[0] !== fnNode) {
|
|
5375
|
-
return
|
|
5788
|
+
return succeed3(false);
|
|
5376
5789
|
}
|
|
5377
5790
|
return pipe(
|
|
5378
5791
|
typeParser.effectFn(parent),
|
|
5379
5792
|
orElse2(() => typeParser.effectFnGen(parent)),
|
|
5380
5793
|
orElse2(() => typeParser.effectFnUntracedGen(parent)),
|
|
5381
5794
|
map4(() => true),
|
|
5382
|
-
orElse2(() =>
|
|
5795
|
+
orElse2(() => succeed3(false))
|
|
5383
5796
|
);
|
|
5384
5797
|
};
|
|
5385
5798
|
const parseEffectFnOpportunityTargetGen = fn("effectFnOpportunity.parseEffectFnOpportunityTarget")(
|
|
@@ -5399,7 +5812,7 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
5399
5812
|
if (!body || !ts.isBlock(body) || body.statements.length <= 5) {
|
|
5400
5813
|
return TypeParserIssue.issue;
|
|
5401
5814
|
}
|
|
5402
|
-
return
|
|
5815
|
+
return succeed3({
|
|
5403
5816
|
effectModuleName: sourceEffectModuleName,
|
|
5404
5817
|
pipeArguments: [],
|
|
5405
5818
|
generatorFunction: void 0,
|
|
@@ -5598,7 +6011,7 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
5598
6011
|
}).join(", ");
|
|
5599
6012
|
const fnSignature = `function*${typeParamNames}(${paramNames}) { ... }`;
|
|
5600
6013
|
const pipeArgsForWithSpan = pipeArguments2.slice(0, -1);
|
|
5601
|
-
const pipeArgsSuffix = (
|
|
6014
|
+
const pipeArgsSuffix = (args3) => args3.length > 0 ? ", ...pipeTransformations" : "";
|
|
5602
6015
|
switch (firstFix.fixName) {
|
|
5603
6016
|
case "effectFnOpportunity_toEffectFnWithSpan": {
|
|
5604
6017
|
const traceName = explicitTraceExpression ? sourceFile.text.slice(explicitTraceExpression.pos, explicitTraceExpression.end).trim() : void 0;
|
|
@@ -5744,7 +6157,7 @@ var effectMapVoid = createDiagnostic({
|
|
|
5744
6157
|
() => pipe(
|
|
5745
6158
|
typeParser.lazyExpression(callback),
|
|
5746
6159
|
flatMap2(
|
|
5747
|
-
(lazy) => tsUtils.isVoidExpression(lazy.expression) ?
|
|
6160
|
+
(lazy) => tsUtils.isVoidExpression(lazy.expression) ? succeed3(lazy) : typeParserIssue("Expression is not void")
|
|
5748
6161
|
)
|
|
5749
6162
|
)
|
|
5750
6163
|
),
|
|
@@ -6405,11 +6818,11 @@ var leakingRequirements = createDiagnostic({
|
|
|
6405
6818
|
memory,
|
|
6406
6819
|
effectContextType,
|
|
6407
6820
|
(type) => {
|
|
6408
|
-
if (type.flags & ts.TypeFlags.Never) return
|
|
6821
|
+
if (type.flags & ts.TypeFlags.Never) return succeed3(true);
|
|
6409
6822
|
return pipe(
|
|
6410
6823
|
typeParser.scopeType(type, atLocation),
|
|
6411
6824
|
map4(() => true),
|
|
6412
|
-
orElse2(() =>
|
|
6825
|
+
orElse2(() => succeed3(false))
|
|
6413
6826
|
);
|
|
6414
6827
|
}
|
|
6415
6828
|
);
|
|
@@ -6824,7 +7237,7 @@ var missingEffectError = createDiagnostic({
|
|
|
6824
7237
|
map3((_) => _.literal),
|
|
6825
7238
|
filter((_) => ts.isLiteralExpression(_)),
|
|
6826
7239
|
map3((_) => _.text),
|
|
6827
|
-
sort(
|
|
7240
|
+
sort(String2),
|
|
6828
7241
|
map3(
|
|
6829
7242
|
(_) => ts.factory.createPropertyAssignment(
|
|
6830
7243
|
ts.factory.createIdentifier(_),
|
|
@@ -6917,7 +7330,7 @@ var missingEffectServiceDependency = createDiagnostic({
|
|
|
6917
7330
|
);
|
|
6918
7331
|
if (layerResult) {
|
|
6919
7332
|
const servicesMemory = /* @__PURE__ */ new Map();
|
|
6920
|
-
const excludeNever = (type) =>
|
|
7333
|
+
const excludeNever = (type) => succeed3((type.flags & ts.TypeFlags.Never) !== 0);
|
|
6921
7334
|
const { allIndexes: requiredIndexes } = yield* typeCheckerUtils.appendToUniqueTypesMap(
|
|
6922
7335
|
servicesMemory,
|
|
6923
7336
|
layerResult.RIn,
|
|
@@ -7433,13 +7846,13 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
|
|
|
7433
7846
|
atLocation2,
|
|
7434
7847
|
ts.NodeBuilderFlags.NoTruncation
|
|
7435
7848
|
);
|
|
7436
|
-
if (!successType) return
|
|
7849
|
+
if (!successType) return fail3("error generating success type");
|
|
7437
7850
|
const failureType = typeChecker.typeToTypeNode(
|
|
7438
7851
|
returnedEffect.E,
|
|
7439
7852
|
atLocation2,
|
|
7440
7853
|
ts.NodeBuilderFlags.NoTruncation
|
|
7441
7854
|
);
|
|
7442
|
-
if (!failureType) return
|
|
7855
|
+
if (!failureType) return fail3("error generating failure type");
|
|
7443
7856
|
const typeNode = ts.factory.createTypeReferenceNode(
|
|
7444
7857
|
ts.factory.createQualifiedName(
|
|
7445
7858
|
ts.factory.createIdentifier(effectIdentifier),
|
|
@@ -7447,7 +7860,7 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
|
|
|
7447
7860
|
),
|
|
7448
7861
|
[successType, failureType, contextType]
|
|
7449
7862
|
);
|
|
7450
|
-
return
|
|
7863
|
+
return succeed3(typeNode);
|
|
7451
7864
|
}),
|
|
7452
7865
|
orElse2(
|
|
7453
7866
|
() => pipe(
|
|
@@ -7458,8 +7871,8 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
|
|
|
7458
7871
|
atLocation2,
|
|
7459
7872
|
ts.NodeBuilderFlags.NoTruncation
|
|
7460
7873
|
);
|
|
7461
|
-
if (!successType) return
|
|
7462
|
-
return
|
|
7874
|
+
if (!successType) return fail3("error generating success type");
|
|
7875
|
+
return succeed3(ts.factory.createTypeReferenceNode(
|
|
7463
7876
|
ts.factory.createQualifiedName(
|
|
7464
7877
|
ts.factory.createIdentifier(effectIdentifier),
|
|
7465
7878
|
ts.factory.createIdentifier("Effect")
|
|
@@ -7480,7 +7893,7 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
|
|
|
7480
7893
|
),
|
|
7481
7894
|
orElse2(() => {
|
|
7482
7895
|
const successType = typeChecker.typeToTypeNode(type, atLocation2, ts.NodeBuilderFlags.NoTruncation);
|
|
7483
|
-
if (!successType) return
|
|
7896
|
+
if (!successType) return fail3("error generating success type");
|
|
7484
7897
|
const typeNode = ts.factory.createTypeReferenceNode(
|
|
7485
7898
|
ts.factory.createQualifiedName(
|
|
7486
7899
|
ts.factory.createIdentifier(effectIdentifier),
|
|
@@ -7492,7 +7905,7 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
|
|
|
7492
7905
|
ts.factory.createTypeReferenceNode(ts.idText(className2))
|
|
7493
7906
|
]
|
|
7494
7907
|
);
|
|
7495
|
-
return
|
|
7908
|
+
return succeed3(typeNode);
|
|
7496
7909
|
})
|
|
7497
7910
|
);
|
|
7498
7911
|
const proxySignature = fn("writeTagClassAccessors.proxySignature")(
|
|
@@ -7503,7 +7916,7 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
|
|
|
7503
7916
|
atLocation2,
|
|
7504
7917
|
ts.NodeBuilderFlags.NoTruncation
|
|
7505
7918
|
);
|
|
7506
|
-
if (!signatureDeclaration) return yield*
|
|
7919
|
+
if (!signatureDeclaration) return yield* fail3("error generating signature");
|
|
7507
7920
|
const returnType = yield* generateReturnType(
|
|
7508
7921
|
typeChecker.getReturnTypeOfSignature(signature),
|
|
7509
7922
|
atLocation2,
|
|
@@ -7552,21 +7965,21 @@ var parse2 = fn("writeTagClassAccessors.parse")(function* (node) {
|
|
|
7552
7965
|
const typeChecker = yield* service(TypeCheckerApi);
|
|
7553
7966
|
const typeParser = yield* service(TypeParser);
|
|
7554
7967
|
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
7555
|
-
if (typeParser.supportedEffect() === "v4") return yield*
|
|
7556
|
-
if (!ts.isClassDeclaration(node)) return yield*
|
|
7968
|
+
if (typeParser.supportedEffect() === "v4") return yield* fail3("not applicable to Effect v4");
|
|
7969
|
+
if (!ts.isClassDeclaration(node)) return yield* fail3("not a class declaration");
|
|
7557
7970
|
const { Service, accessors: accessors2, className, kind } = yield* pipe(
|
|
7558
7971
|
map4(typeParser.extendsEffectService(node), (_) => ({ kind: "effectService", ..._ })),
|
|
7559
7972
|
orElse2(
|
|
7560
7973
|
() => map4(typeParser.extendsEffectTag(node), (_) => ({ kind: "effectTag", accessors: true, ..._ }))
|
|
7561
7974
|
),
|
|
7562
|
-
orElse2(() =>
|
|
7975
|
+
orElse2(() => fail3("not a class extending Effect.Service call"))
|
|
7563
7976
|
);
|
|
7564
|
-
if (accessors2 !== true) return yield*
|
|
7977
|
+
if (accessors2 !== true) return yield* fail3("accessors are not enabled in the Effect.Service call");
|
|
7565
7978
|
const involvedMembers = [];
|
|
7566
7979
|
const nonPrimitiveServices = typeCheckerUtils.unrollUnionMembers(Service).filter(
|
|
7567
7980
|
(_) => !(_.flags & ts.TypeFlags.Number || _.flags & ts.TypeFlags.String || _.flags & ts.TypeFlags.Boolean || _.flags & ts.TypeFlags.Literal)
|
|
7568
7981
|
);
|
|
7569
|
-
if (nonPrimitiveServices.length === 0) return yield*
|
|
7982
|
+
if (nonPrimitiveServices.length === 0) return yield* fail3("Service type is a primitive type");
|
|
7570
7983
|
for (const serviceShape of nonPrimitiveServices) {
|
|
7571
7984
|
for (const property of typeChecker.getPropertiesOfType(serviceShape)) {
|
|
7572
7985
|
const propertyType = typeChecker.getTypeOfSymbolAtLocation(property, node);
|
|
@@ -7607,7 +8020,7 @@ var writeTagClassAccessors = createRefactor({
|
|
|
7607
8020
|
const parentNodes = tsUtils.getAncestorNodesInRange(sourceFile, textRange);
|
|
7608
8021
|
return yield* pipe(
|
|
7609
8022
|
firstSuccessOf(parentNodes.map(parseNode)),
|
|
7610
|
-
orElse2(() =>
|
|
8023
|
+
orElse2(() => fail3(new RefactorNotApplicableError()))
|
|
7611
8024
|
);
|
|
7612
8025
|
})
|
|
7613
8026
|
});
|
|
@@ -7622,7 +8035,7 @@ var accessors = createCodegen({
|
|
|
7622
8035
|
const typeParser = yield* service(TypeParser);
|
|
7623
8036
|
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
7624
8037
|
const nodeAndCommentRange = tsUtils.findNodeWithLeadingCommentAtPosition(sourceFile, textRange.pos);
|
|
7625
|
-
if (!nodeAndCommentRange) return yield*
|
|
8038
|
+
if (!nodeAndCommentRange) return yield* fail3(new CodegenNotApplicableError("no node and comment range"));
|
|
7626
8039
|
return yield* pipe(
|
|
7627
8040
|
parse2(nodeAndCommentRange.node),
|
|
7628
8041
|
map4(
|
|
@@ -7639,7 +8052,7 @@ var accessors = createCodegen({
|
|
|
7639
8052
|
)
|
|
7640
8053
|
})
|
|
7641
8054
|
),
|
|
7642
|
-
orElse2((cause) =>
|
|
8055
|
+
orElse2((cause) => fail3(new CodegenNotApplicableError(cause)))
|
|
7643
8056
|
);
|
|
7644
8057
|
})
|
|
7645
8058
|
});
|
|
@@ -7663,14 +8076,14 @@ var annotate = createCodegen({
|
|
|
7663
8076
|
variableDeclarations = [...variableDeclarations, node];
|
|
7664
8077
|
}
|
|
7665
8078
|
if (variableDeclarations.length === 0) {
|
|
7666
|
-
return yield*
|
|
8079
|
+
return yield* fail3(new CodegenNotApplicableError("not a variable declaration"));
|
|
7667
8080
|
}
|
|
7668
8081
|
for (const variableDeclaration of variableDeclarations) {
|
|
7669
8082
|
if (!variableDeclaration.initializer) continue;
|
|
7670
8083
|
const initializerType = typeCheckerUtils.getTypeAtLocation(variableDeclaration.initializer);
|
|
7671
8084
|
if (!initializerType) continue;
|
|
7672
8085
|
const enclosingNode = ts.findAncestor(variableDeclaration, (_) => tsUtils.isDeclarationKind(_.kind)) || sourceFile;
|
|
7673
|
-
const initializerTypeNode =
|
|
8086
|
+
const initializerTypeNode = fromNullishOr(typeCheckerUtils.typeToSimplifiedTypeNode(
|
|
7674
8087
|
initializerType,
|
|
7675
8088
|
enclosingNode,
|
|
7676
8089
|
ts.NodeBuilderFlags.NoTruncation | ts.NodeBuilderFlags.IgnoreErrors
|
|
@@ -7683,7 +8096,7 @@ var annotate = createCodegen({
|
|
|
7683
8096
|
result.push({ variableDeclaration, initializerTypeNode, hash: hash3 });
|
|
7684
8097
|
}
|
|
7685
8098
|
if (result.length === 0) {
|
|
7686
|
-
return yield*
|
|
8099
|
+
return yield* fail3(new CodegenNotApplicableError("no variable declarations with initializers"));
|
|
7687
8100
|
}
|
|
7688
8101
|
const hash2 = cyrb53(result.map((_) => _.hash).join("/"));
|
|
7689
8102
|
return {
|
|
@@ -7692,7 +8105,7 @@ var annotate = createCodegen({
|
|
|
7692
8105
|
};
|
|
7693
8106
|
});
|
|
7694
8107
|
const nodeAndCommentRange = tsUtils.findNodeWithLeadingCommentAtPosition(sourceFile, textRange.pos);
|
|
7695
|
-
if (!nodeAndCommentRange) return yield*
|
|
8108
|
+
if (!nodeAndCommentRange) return yield* fail3(new CodegenNotApplicableError("no node and comment range"));
|
|
7696
8109
|
return yield* pipe(
|
|
7697
8110
|
parse3(nodeAndCommentRange.node),
|
|
7698
8111
|
map4(
|
|
@@ -7753,13 +8166,13 @@ var makeStructuralSchemaGenContext = fn("StructuralSchemaGen.makeContext")(
|
|
|
7753
8166
|
ts.factory.createIdentifier(effectSchemaIdentifier),
|
|
7754
8167
|
apiName
|
|
7755
8168
|
),
|
|
7756
|
-
createApiCall: (apiName,
|
|
8169
|
+
createApiCall: (apiName, args3) => ts.factory.createCallExpression(
|
|
7757
8170
|
ts.factory.createPropertyAccessExpression(
|
|
7758
8171
|
ts.factory.createIdentifier(effectSchemaIdentifier),
|
|
7759
8172
|
apiName
|
|
7760
8173
|
),
|
|
7761
8174
|
[],
|
|
7762
|
-
|
|
8175
|
+
args3
|
|
7763
8176
|
),
|
|
7764
8177
|
hoistedSchemas: /* @__PURE__ */ new Map(),
|
|
7765
8178
|
typeToStatementIndex: /* @__PURE__ */ new Map(),
|
|
@@ -7809,7 +8222,7 @@ var processType = fn(
|
|
|
7809
8222
|
StructuralSchemaGenContext
|
|
7810
8223
|
);
|
|
7811
8224
|
if (processingContext.depth >= processingContext.maxDepth) {
|
|
7812
|
-
return yield*
|
|
8225
|
+
return yield* fail3(new UnsupportedTypeError(type, "Maximum depth exceeded"));
|
|
7813
8226
|
}
|
|
7814
8227
|
let hoistName = fromIterable(nameToType.entries()).find(([_, existingType]) => existingType === type)?.[0];
|
|
7815
8228
|
if (!hoistName && type && type.symbol && type.symbol.declarations && type.symbol.declarations.length === 1) {
|
|
@@ -7923,7 +8336,7 @@ var processTypeImpl = fn(
|
|
|
7923
8336
|
const objectType = type;
|
|
7924
8337
|
return yield* processObjectType(objectType, context);
|
|
7925
8338
|
}
|
|
7926
|
-
return yield*
|
|
8339
|
+
return yield* fail3(
|
|
7927
8340
|
new UnsupportedTypeError(
|
|
7928
8341
|
type,
|
|
7929
8342
|
`Type with flags ${type.flags} is not supported`
|
|
@@ -8003,7 +8416,7 @@ var processArrayType = fn(
|
|
|
8003
8416
|
const { createApiCall, typeChecker, typeCheckerUtils } = yield* service(StructuralSchemaGenContext);
|
|
8004
8417
|
const typeArgs = typeChecker.getTypeArguments(type);
|
|
8005
8418
|
if (typeArgs.length === 0) {
|
|
8006
|
-
return yield*
|
|
8419
|
+
return yield* fail3(new UnsupportedTypeError(type, "Array type has no type arguments"));
|
|
8007
8420
|
}
|
|
8008
8421
|
const elementSchema = yield* processType(typeArgs[0], context);
|
|
8009
8422
|
const expr = createApiCall("Array", [elementSchema]);
|
|
@@ -8079,7 +8492,7 @@ var processObjectType = fn(
|
|
|
8079
8492
|
);
|
|
8080
8493
|
}
|
|
8081
8494
|
const indexInfos = typeChecker.getIndexInfosOfType(type);
|
|
8082
|
-
const
|
|
8495
|
+
const args3 = [
|
|
8083
8496
|
ts.factory.createObjectLiteralExpression(propertyAssignments, propertyAssignments.length > 0)
|
|
8084
8497
|
];
|
|
8085
8498
|
const records = [];
|
|
@@ -8094,7 +8507,7 @@ var processObjectType = fn(
|
|
|
8094
8507
|
if (records.length > 0) {
|
|
8095
8508
|
return [
|
|
8096
8509
|
createApiCall("StructWithRest", [
|
|
8097
|
-
createApiCall("Struct",
|
|
8510
|
+
createApiCall("Struct", args3),
|
|
8098
8511
|
ts.factory.createArrayLiteralExpression(
|
|
8099
8512
|
records.map(({ key, value }) => createApiCall("Record", [key, value]))
|
|
8100
8513
|
)
|
|
@@ -8126,7 +8539,7 @@ var processObjectType = fn(
|
|
|
8126
8539
|
[ts.factory.createStringLiteral(context.hoistName)]
|
|
8127
8540
|
),
|
|
8128
8541
|
[],
|
|
8129
|
-
|
|
8542
|
+
args3
|
|
8130
8543
|
),
|
|
8131
8544
|
[]
|
|
8132
8545
|
)
|
|
@@ -8139,14 +8552,14 @@ var processObjectType = fn(
|
|
|
8139
8552
|
return [ctx.hoistedSchemas.get(type)(), true];
|
|
8140
8553
|
}
|
|
8141
8554
|
for (const { key, value } of records) {
|
|
8142
|
-
|
|
8555
|
+
args3.push(
|
|
8143
8556
|
ts.factory.createObjectLiteralExpression([
|
|
8144
8557
|
ts.factory.createPropertyAssignment("key", key),
|
|
8145
8558
|
ts.factory.createPropertyAssignment("value", value)
|
|
8146
8559
|
])
|
|
8147
8560
|
);
|
|
8148
8561
|
}
|
|
8149
|
-
return [createApiCall("Struct",
|
|
8562
|
+
return [createApiCall("Struct", args3), propertyAssignments.length === 0];
|
|
8150
8563
|
}
|
|
8151
8564
|
);
|
|
8152
8565
|
var findNodeToProcess = fn("StructuralSchemaGen.findNodeToProcess")(
|
|
@@ -8233,7 +8646,7 @@ var process = fn("StructuralSchemaGen.process")(
|
|
|
8233
8646
|
([name, type]) => pipe(
|
|
8234
8647
|
processType(type, createProcessingContext(typeParser.supportedEffect())),
|
|
8235
8648
|
orElse2(
|
|
8236
|
-
(error) =>
|
|
8649
|
+
(error) => succeed3(ts.addSyntheticLeadingComment(
|
|
8237
8650
|
ts.factory.createIdentifier(""),
|
|
8238
8651
|
ts.SyntaxKind.MultiLineCommentTrivia,
|
|
8239
8652
|
" " + String(error) + " ",
|
|
@@ -8306,10 +8719,10 @@ var process = fn("StructuralSchemaGen.process")(
|
|
|
8306
8719
|
}
|
|
8307
8720
|
);
|
|
8308
8721
|
var applyAtNode = fn("StructuralSchemaGen.applyAtNode")(
|
|
8309
|
-
function* (sourceFile, node,
|
|
8722
|
+
function* (sourceFile, node, identifier2, type, isExported) {
|
|
8310
8723
|
const changeTracker = yield* service(ChangeTracker);
|
|
8311
8724
|
const ts = yield* service(TypeScriptApi);
|
|
8312
|
-
const ctx = yield* process(sourceFile, node, /* @__PURE__ */ new Map([[ts.idText(
|
|
8725
|
+
const ctx = yield* process(sourceFile, node, /* @__PURE__ */ new Map([[ts.idText(identifier2), type]]), isExported, false);
|
|
8313
8726
|
for (const statement of ctx.schemaStatements) {
|
|
8314
8727
|
changeTracker.insertNodeAt(sourceFile, node.pos, statement, { prefix: "\n", suffix: "\n" });
|
|
8315
8728
|
}
|
|
@@ -8328,13 +8741,13 @@ var typeToSchema = createCodegen({
|
|
|
8328
8741
|
const program = yield* service(TypeScriptProgram);
|
|
8329
8742
|
const inThisFile = yield* getCodegensForSourceFile([typeToSchema], sourceFile);
|
|
8330
8743
|
if (inThisFile.length > 1) {
|
|
8331
|
-
return yield*
|
|
8744
|
+
return yield* fail3(
|
|
8332
8745
|
new CodegenNotApplicableError("the typeToSchema codegen can be used only once per file")
|
|
8333
8746
|
);
|
|
8334
8747
|
}
|
|
8335
8748
|
const parse3 = fn("typeToSchema.parse")(function* (node) {
|
|
8336
8749
|
if (!ts.isTypeAliasDeclaration(node)) {
|
|
8337
|
-
return yield*
|
|
8750
|
+
return yield* fail3(
|
|
8338
8751
|
new CodegenNotApplicableError(
|
|
8339
8752
|
"this codegen is applicable only to a type alias where each object member is a schema to generate. e.g. `type ToGenerate = { UserSchema: User, TodoSchema: Todo}`"
|
|
8340
8753
|
)
|
|
@@ -8342,7 +8755,7 @@ var typeToSchema = createCodegen({
|
|
|
8342
8755
|
}
|
|
8343
8756
|
const type = typeCheckerUtils.getTypeAtLocation(node.name);
|
|
8344
8757
|
if (!type) {
|
|
8345
|
-
return yield*
|
|
8758
|
+
return yield* fail3(
|
|
8346
8759
|
new CodegenNotApplicableError(
|
|
8347
8760
|
"error getting the type to process"
|
|
8348
8761
|
)
|
|
@@ -8375,7 +8788,7 @@ var typeToSchema = createCodegen({
|
|
|
8375
8788
|
});
|
|
8376
8789
|
const nodeAndCommentRange = tsUtils.findNodeWithLeadingCommentAtPosition(sourceFile, textRange.pos);
|
|
8377
8790
|
if (!nodeAndCommentRange) {
|
|
8378
|
-
return yield*
|
|
8791
|
+
return yield* fail3(new CodegenNotApplicableError("no node and comment range affected"));
|
|
8379
8792
|
}
|
|
8380
8793
|
return yield* pipe(
|
|
8381
8794
|
parse3(nodeAndCommentRange.node),
|
|
@@ -8511,7 +8924,7 @@ var overriddenSchemaConstructor = createDiagnostic({
|
|
|
8511
8924
|
const isSchema = yield* pipe(
|
|
8512
8925
|
typeParser.effectSchemaType(typeAtLocation, type.expression),
|
|
8513
8926
|
map4(() => true),
|
|
8514
|
-
orElse2(() =>
|
|
8927
|
+
orElse2(() => succeed3(false))
|
|
8515
8928
|
);
|
|
8516
8929
|
if (isSchema) {
|
|
8517
8930
|
extendsSchema = true;
|
|
@@ -9118,11 +9531,11 @@ var schemaUnionOfLiterals = createDiagnostic({
|
|
|
9118
9531
|
orElse2(() => void_)
|
|
9119
9532
|
);
|
|
9120
9533
|
if (isSchemaUnionCall) {
|
|
9121
|
-
const
|
|
9122
|
-
if (
|
|
9123
|
-
const allAreCallExpressions =
|
|
9534
|
+
const args3 = fromIterable(node.arguments);
|
|
9535
|
+
if (args3.length >= 2) {
|
|
9536
|
+
const allAreCallExpressions = args3.every((arg) => ts.isCallExpression(arg));
|
|
9124
9537
|
if (allAreCallExpressions) {
|
|
9125
|
-
const literalChecks =
|
|
9538
|
+
const literalChecks = args3.map((arg) => {
|
|
9126
9539
|
const callArg = arg;
|
|
9127
9540
|
return pipe(
|
|
9128
9541
|
typeParser.isNodeReferenceToEffectSchemaModuleApi("Literal")(callArg.expression),
|
|
@@ -9628,8 +10041,8 @@ var unnecessaryPipe = createDiagnostic({
|
|
|
9628
10041
|
if (ts.isCallExpression(node)) {
|
|
9629
10042
|
yield* pipe(
|
|
9630
10043
|
typeParser.pipeCall(node),
|
|
9631
|
-
map4(({ args:
|
|
9632
|
-
if (
|
|
10044
|
+
map4(({ args: args3, subject }) => {
|
|
10045
|
+
if (args3.length === 0) {
|
|
9633
10046
|
report({
|
|
9634
10047
|
location: node,
|
|
9635
10048
|
messageText: `This pipe call contains no arguments.`,
|
|
@@ -9748,7 +10161,7 @@ var unsupportedServiceAccessors = createDiagnostic({
|
|
|
9748
10161
|
if (ts.isClassDeclaration(node)) {
|
|
9749
10162
|
const parseResult = yield* pipe(
|
|
9750
10163
|
parse2(node),
|
|
9751
|
-
orElse2(() =>
|
|
10164
|
+
orElse2(() => succeed3(null))
|
|
9752
10165
|
);
|
|
9753
10166
|
if (parseResult && parseResult.involvedMembers.length > 0) {
|
|
9754
10167
|
const existingStaticMembers = /* @__PURE__ */ new Set();
|
|
@@ -9860,7 +10273,7 @@ function transform_default(program, pluginConfig, { addDiagnostic, ts: tsInstanc
|
|
|
9860
10273
|
(_2) => _2.category === tsInstance.DiagnosticCategory.Error || _2.category === tsInstance.DiagnosticCategory.Warning
|
|
9861
10274
|
)
|
|
9862
10275
|
),
|
|
9863
|
-
|
|
10276
|
+
getOrElse2(() => []),
|
|
9864
10277
|
map3(addDiagnostic)
|
|
9865
10278
|
);
|
|
9866
10279
|
return sourceFile;
|