@akterjs/cli 0.0.0-stage → 0.1.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/LICENSE +201 -0
- package/README.md +47 -2
- package/dist/Argument-D81dqizB.mjs +57 -0
- package/dist/Array-B4kuTQeW.mjs +2323 -0
- package/dist/Boolean-kILIvmhE.mjs +26 -0
- package/dist/ChildProcess-BCIwxPGc.mjs +577 -0
- package/dist/CliError-Cf5xqkkj.mjs +633 -0
- package/dist/Command-Dzq9KM-h.mjs +5135 -0
- package/dist/Config-B6OND9WR.mjs +854 -0
- package/dist/Console-BKHUkH6a.mjs +141 -0
- package/dist/Data-CeCULr0-.mjs +251 -0
- package/dist/Digest-CBd3uv5B.mjs +348 -0
- package/dist/Duration-EH9Vy4U6.mjs +791 -0
- package/dist/Effect-CKFpqbmw.mjs +12911 -0
- package/dist/FileSystem-4pPcEb_i.mjs +1366 -0
- package/dist/HttpClientError-BUeMWx70.mjs +303 -0
- package/dist/HttpClientResponse-D5ZKICVV.mjs +855 -0
- package/dist/Match-CGPLZYrV.mjs +434 -0
- package/dist/MutableHashMap-f8nW8AJR.mjs +376 -0
- package/dist/MutableHashSet-_HI572Ya.mjs +155 -0
- package/dist/MutableRef-D4Qv592C.mjs +107 -0
- package/dist/Number-BvkRkfc-.mjs +137 -0
- package/dist/Option-DkxSnBhp.mjs +3967 -0
- package/dist/Order-C1JC991I.mjs +481 -0
- package/dist/Path-Djdv_eF5.mjs +130 -0
- package/dist/Queue-CO5UQ6os.mjs +1394 -0
- package/dist/Redacted-RkJrG5Me.mjs +160 -0
- package/dist/Ref-BIPOxJNH.mjs +267 -0
- package/dist/Runtime-BInIAwK3.mjs +297 -0
- package/dist/Schema-MiKt5K1v.mjs +10999 -0
- package/dist/SecureRandom-B_U4ysO3.mjs +279 -0
- package/dist/Semaphore-DOVJ4ZGS.mjs +177 -0
- package/dist/Stdio-KylmOBX_.mjs +74 -0
- package/dist/Stream-bK9QIETN.mjs +4012 -0
- package/dist/String-q5dcsVe4.mjs +351 -0
- package/dist/TerminalCapabilities-w_44MAca.mjs +1769 -0
- package/dist/WebCrypto-ZI_GNVlw.mjs +33 -0
- package/dist/actor-call.service-CGM_vD9u.mjs +1269 -0
- package/dist/actor-client.adapter-Coem7gF1.mjs +3691 -0
- package/dist/akter-program.config-C4cXx4Fr.mjs +7034 -0
- package/dist/akter.cli.mjs +5 -0
- package/dist/app-cli.config.mjs +49 -0
- package/dist/app-entry.pure.mjs +31 -0
- package/dist/archive/akter-archive.schema.mjs +65 -0
- package/dist/archive/akter-archive.service.mjs +309 -0
- package/dist/archive/archive-cli.config.mjs +45 -0
- package/dist/archive/archive-invalid.errors.mjs +5 -0
- package/dist/archive/archived-lineage.pure.mjs +13 -0
- package/dist/archive/tar.pure.mjs +291 -0
- package/dist/archive/zstd.adapter.mjs +46 -0
- package/dist/bench/bench-report.pure.mjs +120 -0
- package/dist/bench/bench-runner.pure.mjs +89 -0
- package/dist/bench/bench.service.mjs +301 -0
- package/dist/cli-runtime.layer-BqK2mmVL.mjs +1191 -0
- package/dist/cli-runtime.layer.mjs +1 -0
- package/dist/cloud-client.adapter-Cy1BjDbG.mjs +3186 -0
- package/dist/cloud-client.adapter-DOVMoYAj.mjs +304 -0
- package/dist/command/akter-commands.config.mjs +32 -0
- package/dist/command/akter-program.config.mjs +1 -0
- package/dist/credentials/credentials.service.mjs +226 -0
- package/dist/credentials/keychain.adapter.mjs +92 -0
- package/dist/credentials/login.config.mjs +251 -0
- package/dist/deploy/auth/api-attempt.service.mjs +30 -0
- package/dist/deploy/auth/token-refresh.errors.mjs +4 -0
- package/dist/deploy/build-bundle.adapter.mjs +133 -0
- package/dist/deploy/build-manifest.pure.mjs +44 -0
- package/dist/deploy/cloud-client.adapter.mjs +1 -0
- package/dist/deploy/cloud-url.pure.mjs +17 -0
- package/dist/deploy/deploy-failed.errors.mjs +17 -0
- package/dist/deploy/deploy.service.mjs +156 -0
- package/dist/deploy/request-failure.pure.mjs +87 -0
- package/dist/dev-runner.pure.mjs +30 -0
- package/dist/docs/doc-topics.pure.mjs +21 -0
- package/dist/docs/docs.config.mjs +1 -0
- package/dist/docs.config-_21Xi6HU.mjs +190 -0
- package/dist/export/actor-export.service.mjs +267 -0
- package/dist/export/export-failed.errors.mjs +4 -0
- package/dist/export/export-failure.pure.mjs +18 -0
- package/dist/export/ordered-lines.pure.mjs +43 -0
- package/dist/export/ranged-download.pure.mjs +66 -0
- package/dist/export/snapshot-download.pure.mjs +86 -0
- package/dist/history-runner.pure.mjs +186 -0
- package/dist/history-since.pure.mjs +17 -0
- package/dist/hosted-runtime.layer-Cx3IPsEd.mjs +16358 -0
- package/dist/local/environment-cli.config.mjs +90 -0
- package/dist/local/environment-runner.pure.mjs +75 -0
- package/dist/local/local-cli.config.mjs +159 -0
- package/dist/logs/log-follow.config.mjs +21 -0
- package/dist/logs/log-follow.service.mjs +87 -0
- package/dist/logs/log-lines.pure.mjs +44 -0
- package/dist/migrate-runner.pure.mjs +28 -0
- package/dist/operation-input.pure-CS9iUhqK.mjs +1383 -0
- package/dist/operation-registry.pure-DVC8EDgj.mjs +283 -0
- package/dist/registry/actor-call.service.mjs +1 -0
- package/dist/registry/actor-commands.config.mjs +127 -0
- package/dist/registry/actor-refusal.pure.mjs +34 -0
- package/dist/registry/approval.service.mjs +80 -0
- package/dist/registry/cloud-commands.config.mjs +151 -0
- package/dist/registry/cloud-served.pure.mjs +31 -0
- package/dist/registry/operation-call.service.mjs +262 -0
- package/dist/registry/operation-input.pure.mjs +1 -0
- package/dist/registry/operation-output.pure.mjs +91 -0
- package/dist/registry/served-command.config.mjs +57 -0
- package/dist/runner-exited.errors.mjs +10 -0
- package/dist/terminal/cli-exit.errors.mjs +38 -0
- package/dist/terminal/cli-failure.pure.mjs +31 -0
- package/dist/terminal/confirm.adapter.mjs +27 -0
- package/package.json +61 -3
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
import { bn as dual } from "./Option-DkxSnBhp.mjs";
|
|
2
|
+
// ../../node_modules/.pnpm/effect@4.1.2_patch_hash=0e61176203bb1256381ce1c5b488d7951983ce38ff698647d3f4617383abbf07/node_modules/effect/dist/Order.js
|
|
3
|
+
/**
|
|
4
|
+
* Defines comparison functions for ordered values.
|
|
5
|
+
*
|
|
6
|
+
* An `Order<A>` compares two `A` values and returns whether the first is less
|
|
7
|
+
* than, equal to, or greater than the second. Orders are used for sorting,
|
|
8
|
+
* choosing minimum or maximum values, checking ranges, and building ordered data
|
|
9
|
+
* structures. This module includes built-in orders, constructors for custom
|
|
10
|
+
* orders, tools for reversing and combining comparisons, tuple and struct
|
|
11
|
+
* helpers, comparison predicates, clamping, and reducer support.
|
|
12
|
+
*
|
|
13
|
+
* @stability stable
|
|
14
|
+
* @since 2.0.0
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new `Order` instance from a comparison function.
|
|
18
|
+
*
|
|
19
|
+
* **When to use**
|
|
20
|
+
*
|
|
21
|
+
* Use when you need a sorting rule not covered by the built-in orders or input
|
|
22
|
+
* mapping helpers, and you can provide a total comparison.
|
|
23
|
+
*
|
|
24
|
+
* **Details**
|
|
25
|
+
*
|
|
26
|
+
* Uses reference equality (`===`) as a shortcut: if `self === that`, it returns
|
|
27
|
+
* `0` without calling the comparison function. The comparison function should
|
|
28
|
+
* return `-1`, `0`, or `1`, and the returned order satisfies total ordering
|
|
29
|
+
* laws when the comparison function does.
|
|
30
|
+
*
|
|
31
|
+
* **Example** (Creating an Order)
|
|
32
|
+
*
|
|
33
|
+
* ```ts import.meta.vitest
|
|
34
|
+
* import { Order } from "effect"
|
|
35
|
+
*
|
|
36
|
+
* const byAge = Order.make<{ name: string; age: number }>((self, that) => {
|
|
37
|
+
* if (self.age < that.age) return -1
|
|
38
|
+
* if (self.age > that.age) return 1
|
|
39
|
+
* return 0
|
|
40
|
+
* })
|
|
41
|
+
*
|
|
42
|
+
* byAge({ name: "Alice", age: 30 }, { name: "Bob", age: 25 }) // => 1
|
|
43
|
+
* byAge({ name: "Alice", age: 25 }, { name: "Bob", age: 30 }) // => -1
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @see {@link mapInput} to transform an order by mapping the input type
|
|
47
|
+
* @see {@link combine} to combine multiple orders
|
|
48
|
+
* @stability stable
|
|
49
|
+
* @category constructors
|
|
50
|
+
* @since 2.0.0
|
|
51
|
+
*/
|
|
52
|
+
function make(compare) {
|
|
53
|
+
return (self, that) => self === that ? 0 : compare(self, that);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Order instance for strings that compares them lexicographically using JavaScript's `<` operator.
|
|
57
|
+
*
|
|
58
|
+
* **When to use**
|
|
59
|
+
*
|
|
60
|
+
* Use when you need lexicographic string ordering.
|
|
61
|
+
*
|
|
62
|
+
* **Details**
|
|
63
|
+
*
|
|
64
|
+
* Uses lexicographic dictionary ordering. The empty string is less than any
|
|
65
|
+
* non-empty string, and comparisons are case-sensitive.
|
|
66
|
+
*
|
|
67
|
+
* **Example** (Ordering strings)
|
|
68
|
+
*
|
|
69
|
+
* ```ts import.meta.vitest
|
|
70
|
+
* import { Order } from "effect"
|
|
71
|
+
*
|
|
72
|
+
* Order.String("apple", "banana") // => -1
|
|
73
|
+
* Order.String("banana", "apple") // => 1
|
|
74
|
+
* Order.String("apple", "apple") // => 0
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @see {@link mapInput} to compare objects by a string property
|
|
78
|
+
* @see {@link Struct} to combine with other orders for struct comparison
|
|
79
|
+
* @stability stable
|
|
80
|
+
* @category instances
|
|
81
|
+
* @since 4.0.0
|
|
82
|
+
*/
|
|
83
|
+
const String = /*#__PURE__*/ make((self, that) => self < that ? -1 : 1);
|
|
84
|
+
/**
|
|
85
|
+
* Order instance for numbers that compares them numerically.
|
|
86
|
+
*
|
|
87
|
+
* **When to use**
|
|
88
|
+
*
|
|
89
|
+
* Use when you need numeric ordering for numbers.
|
|
90
|
+
*
|
|
91
|
+
* **Details**
|
|
92
|
+
*
|
|
93
|
+
* `0` is considered equal to `-0`. All `NaN` values are considered equal to
|
|
94
|
+
* each other, and any `NaN` is considered less than any non-`NaN` number. All
|
|
95
|
+
* other values use standard numeric comparison.
|
|
96
|
+
*
|
|
97
|
+
* **Example** (Ordering numbers)
|
|
98
|
+
*
|
|
99
|
+
* ```ts import.meta.vitest
|
|
100
|
+
* import { Order } from "effect"
|
|
101
|
+
*
|
|
102
|
+
* Order.Number(1, 1) // => 0
|
|
103
|
+
* Order.Number(1, 2) // => -1
|
|
104
|
+
* Order.Number(2, 1) // => 1
|
|
105
|
+
*
|
|
106
|
+
* Order.Number(0, -0) // => 0
|
|
107
|
+
* Order.Number(NaN, 1) // => -1
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @see {@link mapInput} to compare objects by a number property
|
|
111
|
+
* @see {@link BigInt} for bigint comparisons
|
|
112
|
+
* @stability stable
|
|
113
|
+
* @category instances
|
|
114
|
+
* @since 4.0.0
|
|
115
|
+
*/
|
|
116
|
+
const Number = /*#__PURE__*/ make((self, that) => {
|
|
117
|
+
if (globalThis.Number.isNaN(self) && globalThis.Number.isNaN(that)) return 0;
|
|
118
|
+
if (globalThis.Number.isNaN(self)) return -1;
|
|
119
|
+
if (globalThis.Number.isNaN(that)) return 1;
|
|
120
|
+
return self < that ? -1 : 1;
|
|
121
|
+
});
|
|
122
|
+
/**
|
|
123
|
+
* Order instance for booleans where `false` is considered less than `true`.
|
|
124
|
+
*
|
|
125
|
+
* **When to use**
|
|
126
|
+
*
|
|
127
|
+
* Use when you need boolean ordering where `false` comes before `true`.
|
|
128
|
+
*
|
|
129
|
+
* **Details**
|
|
130
|
+
*
|
|
131
|
+
* `false` is less than `true`, and equal values return `0`.
|
|
132
|
+
*
|
|
133
|
+
* **Example** (Ordering booleans)
|
|
134
|
+
*
|
|
135
|
+
* ```ts import.meta.vitest
|
|
136
|
+
* import { Order } from "effect"
|
|
137
|
+
*
|
|
138
|
+
* Order.Boolean(false, true) // => -1
|
|
139
|
+
* Order.Boolean(true, false) // => 1
|
|
140
|
+
* Order.Boolean(true, true) // => 0
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* @see {@link mapInput} to compare objects by a boolean property
|
|
144
|
+
* @stability stable
|
|
145
|
+
* @category instances
|
|
146
|
+
* @since 4.0.0
|
|
147
|
+
*/
|
|
148
|
+
const Boolean = /*#__PURE__*/ make((self, that) => self < that ? -1 : 1);
|
|
149
|
+
/**
|
|
150
|
+
* Order instance for bigints that compares them numerically.
|
|
151
|
+
*
|
|
152
|
+
* **When to use**
|
|
153
|
+
*
|
|
154
|
+
* Use when you need numeric ordering for `bigint` values.
|
|
155
|
+
*
|
|
156
|
+
* **Details**
|
|
157
|
+
*
|
|
158
|
+
* Uses standard numeric comparison for bigint values and handles arbitrarily
|
|
159
|
+
* large integers.
|
|
160
|
+
*
|
|
161
|
+
* **Example** (Ordering BigInts)
|
|
162
|
+
*
|
|
163
|
+
* ```ts import.meta.vitest
|
|
164
|
+
* import { Order } from "effect"
|
|
165
|
+
*
|
|
166
|
+
* Order.BigInt(1n, 2n) // => -1
|
|
167
|
+
* Order.BigInt(2n, 1n) // => 1
|
|
168
|
+
* Order.BigInt(1n, 1n) // => 0
|
|
169
|
+
* ```
|
|
170
|
+
*
|
|
171
|
+
* @see {@link Number} for regular number comparisons
|
|
172
|
+
* @see {@link mapInput} to compare objects by a bigint property
|
|
173
|
+
* @stability stable
|
|
174
|
+
* @category instances
|
|
175
|
+
* @since 4.0.0
|
|
176
|
+
*/
|
|
177
|
+
const BigInt = /*#__PURE__*/ make((self, that) => self < that ? -1 : 1);
|
|
178
|
+
/**
|
|
179
|
+
* Combines two `Order` instances to create a new `Order` that first compares using the first `Order`,
|
|
180
|
+
* and if the values are equal, then compares using the second `Order`.
|
|
181
|
+
*
|
|
182
|
+
* **When to use**
|
|
183
|
+
*
|
|
184
|
+
* Use when you need tie-breaking with exactly two orders.
|
|
185
|
+
*
|
|
186
|
+
* **Details**
|
|
187
|
+
*
|
|
188
|
+
* First applies the first order. If the result is non-zero, that result is
|
|
189
|
+
* returned; otherwise, the second order is applied. The result is the first
|
|
190
|
+
* non-zero comparison result, or `0` if both orders return `0`.
|
|
191
|
+
*
|
|
192
|
+
* **Example** (Combining two Orders)
|
|
193
|
+
*
|
|
194
|
+
* ```ts import.meta.vitest
|
|
195
|
+
* import { Order } from "effect"
|
|
196
|
+
*
|
|
197
|
+
* const byAge = Order.mapInput(
|
|
198
|
+
* Order.Number,
|
|
199
|
+
* (person: { name: string; age: number }) => person.age
|
|
200
|
+
* )
|
|
201
|
+
* const byName = Order.mapInput(
|
|
202
|
+
* Order.String,
|
|
203
|
+
* (person: { name: string; age: number }) => person.name
|
|
204
|
+
* )
|
|
205
|
+
* const byAgeAndName = Order.combine(byAge, byName)
|
|
206
|
+
*
|
|
207
|
+
* const person1 = { name: "Alice", age: 30 }
|
|
208
|
+
* const person2 = { name: "Bob", age: 30 }
|
|
209
|
+
* const person3 = { name: "Charlie", age: 25 }
|
|
210
|
+
*
|
|
211
|
+
* byAgeAndName(person1, person2) // => -1
|
|
212
|
+
* byAgeAndName(person1, person3) // => 1
|
|
213
|
+
* ```
|
|
214
|
+
*
|
|
215
|
+
* @see {@link combineAll} to combine multiple orders from a collection
|
|
216
|
+
* @see {@link mapInput} to transform orders to work with different types
|
|
217
|
+
* @stability stable
|
|
218
|
+
* @category combining
|
|
219
|
+
* @since 2.0.0
|
|
220
|
+
*/
|
|
221
|
+
const combine = /*#__PURE__*/ dual(2, (self, that) => make((a1, a2) => {
|
|
222
|
+
const out = self(a1, a2);
|
|
223
|
+
if (out !== 0) return out;
|
|
224
|
+
return that(a1, a2);
|
|
225
|
+
}));
|
|
226
|
+
/**
|
|
227
|
+
* Transforms an `Order` on type `A` into an `Order` on type `B` by providing a function that
|
|
228
|
+
* maps values of type `B` to values of type `A`.
|
|
229
|
+
*
|
|
230
|
+
* **When to use**
|
|
231
|
+
*
|
|
232
|
+
* Use when you need to adapt an `Order` to compare a larger value by one
|
|
233
|
+
* derived property.
|
|
234
|
+
*
|
|
235
|
+
* **Details**
|
|
236
|
+
*
|
|
237
|
+
* Applies the mapping function to both values before comparison. The mapping
|
|
238
|
+
* function should be pure and not have side effects so the ordering properties
|
|
239
|
+
* of the original order are preserved.
|
|
240
|
+
*
|
|
241
|
+
* **Example** (Mapping Input)
|
|
242
|
+
*
|
|
243
|
+
* ```ts import.meta.vitest
|
|
244
|
+
* import { Order } from "effect"
|
|
245
|
+
*
|
|
246
|
+
* const byLength = Order.mapInput(Order.Number, (s: string) => s.length)
|
|
247
|
+
*
|
|
248
|
+
* byLength("a", "bb") // => -1
|
|
249
|
+
* byLength("bb", "a") // => 1
|
|
250
|
+
* byLength("aa", "bb") // => 0
|
|
251
|
+
* ```
|
|
252
|
+
*
|
|
253
|
+
* @see {@link combine} to combine mapped orders for multi-criteria comparison
|
|
254
|
+
* @see {@link Struct} to create orders for structs with multiple fields
|
|
255
|
+
* @stability stable
|
|
256
|
+
* @category mapping
|
|
257
|
+
* @since 2.0.0
|
|
258
|
+
*/
|
|
259
|
+
const mapInput = /*#__PURE__*/ dual(2, (self, f) => make((b1, b2) => self(f(b1), f(b2))));
|
|
260
|
+
/**
|
|
261
|
+
* Order instance for `Date` objects that compares them chronologically by their timestamp.
|
|
262
|
+
*
|
|
263
|
+
* **When to use**
|
|
264
|
+
*
|
|
265
|
+
* Use when you need chronological ordering for JavaScript date values.
|
|
266
|
+
*
|
|
267
|
+
* **Details**
|
|
268
|
+
*
|
|
269
|
+
* Compares dates by their underlying timestamp in milliseconds since the epoch.
|
|
270
|
+
* Earlier dates are less than later dates. Invalid dates are compared through
|
|
271
|
+
* their `getTime()` result.
|
|
272
|
+
*
|
|
273
|
+
* **Example** (Ordering Dates)
|
|
274
|
+
*
|
|
275
|
+
* ```ts import.meta.vitest
|
|
276
|
+
* import { Order } from "effect"
|
|
277
|
+
*
|
|
278
|
+
* const date1 = new Date("2023-01-01")
|
|
279
|
+
* const date2 = new Date("2023-01-02")
|
|
280
|
+
*
|
|
281
|
+
* Order.Date(date1, date2) // => -1
|
|
282
|
+
* Order.Date(date2, date1) // => 1
|
|
283
|
+
* Order.Date(date1, date1) // => 0
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* @see {@link mapInput} to compare objects by a date property
|
|
287
|
+
* @stability stable
|
|
288
|
+
* @category instances
|
|
289
|
+
* @since 2.0.0
|
|
290
|
+
*/
|
|
291
|
+
const Date = /*#__PURE__*/ mapInput(Number, (date) => date.getTime());
|
|
292
|
+
/**
|
|
293
|
+
* Checks whether one value is strictly less than another according to the given order.
|
|
294
|
+
*
|
|
295
|
+
* **When to use**
|
|
296
|
+
*
|
|
297
|
+
* Use when you need a boolean less-than predicate using an `Order`.
|
|
298
|
+
*
|
|
299
|
+
* **Details**
|
|
300
|
+
*
|
|
301
|
+
* Returns `true` if the order returns `-1`, meaning the first value is less
|
|
302
|
+
* than the second. Equal or greater values return `false`.
|
|
303
|
+
*
|
|
304
|
+
* **Example** (Checking less-than comparisons)
|
|
305
|
+
*
|
|
306
|
+
* ```ts import.meta.vitest
|
|
307
|
+
* import { Order } from "effect"
|
|
308
|
+
*
|
|
309
|
+
* const isLessThanNumber = Order.isLessThan(Order.Number)
|
|
310
|
+
*
|
|
311
|
+
* isLessThanNumber(1, 2) // => true
|
|
312
|
+
* isLessThanNumber(2, 1) // => false
|
|
313
|
+
* isLessThanNumber(1, 1) // => false
|
|
314
|
+
* ```
|
|
315
|
+
*
|
|
316
|
+
* @see {@link isLessThanOrEqualTo} for non-strict less than or equal
|
|
317
|
+
* @see {@link isGreaterThan} for strict greater than
|
|
318
|
+
* @stability stable
|
|
319
|
+
* @category predicates
|
|
320
|
+
* @since 4.0.0
|
|
321
|
+
*/
|
|
322
|
+
const isLessThan = (O) => dual(2, (self, that) => O(self, that) === -1);
|
|
323
|
+
/**
|
|
324
|
+
* Checks whether one value is strictly greater than another according to the given order.
|
|
325
|
+
*
|
|
326
|
+
* **When to use**
|
|
327
|
+
*
|
|
328
|
+
* Use when you need a boolean greater-than predicate using an `Order`.
|
|
329
|
+
*
|
|
330
|
+
* **Details**
|
|
331
|
+
*
|
|
332
|
+
* Returns `true` if the order returns `1`, meaning the first value is greater
|
|
333
|
+
* than the second. Equal or lesser values return `false`.
|
|
334
|
+
*
|
|
335
|
+
* **Example** (Checking greater-than comparisons)
|
|
336
|
+
*
|
|
337
|
+
* ```ts import.meta.vitest
|
|
338
|
+
* import { Order } from "effect"
|
|
339
|
+
*
|
|
340
|
+
* const isGreaterThanNumber = Order.isGreaterThan(Order.Number)
|
|
341
|
+
*
|
|
342
|
+
* isGreaterThanNumber(2, 1) // => true
|
|
343
|
+
* isGreaterThanNumber(1, 2) // => false
|
|
344
|
+
* isGreaterThanNumber(1, 1) // => false
|
|
345
|
+
* ```
|
|
346
|
+
*
|
|
347
|
+
* @see {@link isGreaterThanOrEqualTo} for non-strict greater than or equal
|
|
348
|
+
* @see {@link isLessThan} for strict less than
|
|
349
|
+
* @stability stable
|
|
350
|
+
* @category predicates
|
|
351
|
+
* @since 4.0.0
|
|
352
|
+
*/
|
|
353
|
+
const isGreaterThan = (O) => dual(2, (self, that) => O(self, that) === 1);
|
|
354
|
+
/**
|
|
355
|
+
* Checks whether one value is less than or equal to another according to the given order.
|
|
356
|
+
*
|
|
357
|
+
* **When to use**
|
|
358
|
+
*
|
|
359
|
+
* Use when you need a boolean less-than-or-equal predicate using an `Order`.
|
|
360
|
+
*
|
|
361
|
+
* **Details**
|
|
362
|
+
*
|
|
363
|
+
* Returns `true` if the order returns `-1` or `0`, and returns `false` only if
|
|
364
|
+
* the order returns `1`.
|
|
365
|
+
*
|
|
366
|
+
* **Example** (Checking less-than-or-equal comparisons)
|
|
367
|
+
*
|
|
368
|
+
* ```ts import.meta.vitest
|
|
369
|
+
* import { Order } from "effect"
|
|
370
|
+
*
|
|
371
|
+
* const isLessThanOrEqualToNumber = Order.isLessThanOrEqualTo(Order.Number)
|
|
372
|
+
*
|
|
373
|
+
* isLessThanOrEqualToNumber(1, 2) // => true
|
|
374
|
+
* isLessThanOrEqualToNumber(1, 1) // => true
|
|
375
|
+
* isLessThanOrEqualToNumber(2, 1) // => false
|
|
376
|
+
* ```
|
|
377
|
+
*
|
|
378
|
+
* @see {@link isLessThan} for strict less than
|
|
379
|
+
* @see {@link isGreaterThan} for strict greater than
|
|
380
|
+
* @stability stable
|
|
381
|
+
* @category predicates
|
|
382
|
+
* @since 4.0.0
|
|
383
|
+
*/
|
|
384
|
+
const isLessThanOrEqualTo = (O) => dual(2, (self, that) => O(self, that) !== 1);
|
|
385
|
+
/**
|
|
386
|
+
* Checks whether one value is greater than or equal to another according to the given order.
|
|
387
|
+
*
|
|
388
|
+
* **When to use**
|
|
389
|
+
*
|
|
390
|
+
* Use when you need a boolean greater-than-or-equal predicate using an
|
|
391
|
+
* `Order`.
|
|
392
|
+
*
|
|
393
|
+
* **Details**
|
|
394
|
+
*
|
|
395
|
+
* Returns `true` if the order returns `1` or `0`, and returns `false` only if
|
|
396
|
+
* the order returns `-1`.
|
|
397
|
+
*
|
|
398
|
+
* **Example** (Checking greater-than-or-equal comparisons)
|
|
399
|
+
*
|
|
400
|
+
* ```ts import.meta.vitest
|
|
401
|
+
* import { Order } from "effect"
|
|
402
|
+
*
|
|
403
|
+
* const isGreaterThanOrEqualToNumber = Order.isGreaterThanOrEqualTo(Order.Number)
|
|
404
|
+
*
|
|
405
|
+
* isGreaterThanOrEqualToNumber(2, 1) // => true
|
|
406
|
+
* isGreaterThanOrEqualToNumber(1, 1) // => true
|
|
407
|
+
* isGreaterThanOrEqualToNumber(1, 2) // => false
|
|
408
|
+
* ```
|
|
409
|
+
*
|
|
410
|
+
* @see {@link isGreaterThan} for strict greater than
|
|
411
|
+
* @see {@link isLessThanOrEqualTo} for less than or equal
|
|
412
|
+
* @stability stable
|
|
413
|
+
* @category predicates
|
|
414
|
+
* @since 4.0.0
|
|
415
|
+
*/
|
|
416
|
+
const isGreaterThanOrEqualTo = (O) => dual(2, (self, that) => O(self, that) !== -1);
|
|
417
|
+
/**
|
|
418
|
+
* Returns the minimum of two values according to the given order. If they are equal, returns the first argument.
|
|
419
|
+
*
|
|
420
|
+
* **When to use**
|
|
421
|
+
*
|
|
422
|
+
* Use when you need to select the smaller of two values according to an
|
|
423
|
+
* `Order`.
|
|
424
|
+
*
|
|
425
|
+
* **Details**
|
|
426
|
+
*
|
|
427
|
+
* Returns the value that compares as less than or equal to the other value. If
|
|
428
|
+
* values are equal, the first argument is returned.
|
|
429
|
+
*
|
|
430
|
+
* **Example** (Selecting the minimum value)
|
|
431
|
+
*
|
|
432
|
+
* ```ts import.meta.vitest
|
|
433
|
+
* import { Order } from "effect"
|
|
434
|
+
*
|
|
435
|
+
* const minNumber = Order.min(Order.Number)
|
|
436
|
+
*
|
|
437
|
+
* minNumber(1, 2) // => 1
|
|
438
|
+
* minNumber(2, 1) // => 1
|
|
439
|
+
* minNumber(1, 1) // => 1
|
|
440
|
+
* ```
|
|
441
|
+
*
|
|
442
|
+
* @see {@link max} for the maximum of two values
|
|
443
|
+
* @see {@link clamp} to clamp a value between min and max
|
|
444
|
+
* @stability stable
|
|
445
|
+
* @category comparisons
|
|
446
|
+
* @since 2.0.0
|
|
447
|
+
*/
|
|
448
|
+
const min = (O) => dual(2, (self, that) => self === that || O(self, that) < 1 ? self : that);
|
|
449
|
+
/**
|
|
450
|
+
* Returns the maximum of two values according to the given order. If they are equal, returns the first argument.
|
|
451
|
+
*
|
|
452
|
+
* **When to use**
|
|
453
|
+
*
|
|
454
|
+
* Use when you need to select the larger of two values according to an
|
|
455
|
+
* `Order`.
|
|
456
|
+
*
|
|
457
|
+
* **Details**
|
|
458
|
+
*
|
|
459
|
+
* Returns the value that compares as greater than or equal to the other value.
|
|
460
|
+
* If values are equal, the first argument is returned.
|
|
461
|
+
*
|
|
462
|
+
* **Example** (Selecting the maximum value)
|
|
463
|
+
*
|
|
464
|
+
* ```ts import.meta.vitest
|
|
465
|
+
* import { Order } from "effect"
|
|
466
|
+
*
|
|
467
|
+
* const maxNumber = Order.max(Order.Number)
|
|
468
|
+
*
|
|
469
|
+
* maxNumber(1, 2) // => 2
|
|
470
|
+
* maxNumber(2, 1) // => 2
|
|
471
|
+
* maxNumber(1, 1) // => 1
|
|
472
|
+
* ```
|
|
473
|
+
*
|
|
474
|
+
* @see {@link min} for the minimum of two values
|
|
475
|
+
* @see {@link clamp} to clamp a value between min and max
|
|
476
|
+
* @stability stable
|
|
477
|
+
* @category comparisons
|
|
478
|
+
* @since 2.0.0
|
|
479
|
+
*/
|
|
480
|
+
const max = (O) => dual(2, (self, that) => self === that || O(self, that) > -1 ? self : that);
|
|
481
|
+
export { String as a, isGreaterThanOrEqualTo as c, make as d, mapInput as f, Number as i, isLessThan as l, min as m, Boolean as n, combine as o, max as p, Date as r, isGreaterThan as s, BigInt as t, isLessThanOrEqualTo as u };
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { aa as Service } from "./Effect-CKFpqbmw.mjs";
|
|
2
|
+
import { S as none, w as some } from "./Option-DkxSnBhp.mjs";
|
|
3
|
+
// ../../node_modules/.pnpm/effect@4.1.2_patch_hash=0e61176203bb1256381ce1c5b488d7951983ce38ff698647d3f4617383abbf07/node_modules/effect/dist/Path.js
|
|
4
|
+
/**
|
|
5
|
+
* Provides path operations through the Effect environment.
|
|
6
|
+
*
|
|
7
|
+
* The `Path` service works with file system paths without tying code to one
|
|
8
|
+
* concrete platform module. It exposes common operations such as joining,
|
|
9
|
+
* normalizing, parsing, formatting, resolving, and converting paths to or from
|
|
10
|
+
* file URLs. This module includes the service interface, parsed path type,
|
|
11
|
+
* service tag, runtime marker, and built-in POSIX path layer.
|
|
12
|
+
*
|
|
13
|
+
* @stability unstable
|
|
14
|
+
* @since 4.0.0
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Runtime type identifier used to mark implementations of the `Path` service.
|
|
18
|
+
*
|
|
19
|
+
* **Details**
|
|
20
|
+
*
|
|
21
|
+
* The marker is the exact string stored on `Path` service implementations.
|
|
22
|
+
* Most code should depend on the `Path` service instead of inspecting this
|
|
23
|
+
* value directly.
|
|
24
|
+
*
|
|
25
|
+
* @see {@link layer} for the built-in POSIX `Path` service layer
|
|
26
|
+
*
|
|
27
|
+
* @stability unstable
|
|
28
|
+
* @category type IDs
|
|
29
|
+
* @since 4.0.0
|
|
30
|
+
*/
|
|
31
|
+
const TypeId = "~effect/Path";
|
|
32
|
+
/**
|
|
33
|
+
* Service tag for accessing the current `Path` implementation.
|
|
34
|
+
*
|
|
35
|
+
* **When to use**
|
|
36
|
+
*
|
|
37
|
+
* Use when you need path operations supplied by an effect's environment.
|
|
38
|
+
*
|
|
39
|
+
* **Example** (Providing a custom Path service)
|
|
40
|
+
*
|
|
41
|
+
* ```ts import.meta.vitest
|
|
42
|
+
* import { Effect, Layer, Path } from "effect"
|
|
43
|
+
*
|
|
44
|
+
* // Create a custom path implementation
|
|
45
|
+
* const customPath = Path.make({
|
|
46
|
+
* sep: "/",
|
|
47
|
+
* basename: (path: string, suffix?: string) => {
|
|
48
|
+
* const base = path.split("/").pop() || ""
|
|
49
|
+
* return suffix && base.endsWith(suffix)
|
|
50
|
+
* ? base.slice(0, -suffix.length)
|
|
51
|
+
* : base
|
|
52
|
+
* },
|
|
53
|
+
* dirname: (path: string) => path.split("/").slice(0, -1).join("/") || "/",
|
|
54
|
+
* extname: (path: string) => {
|
|
55
|
+
* const match = path.match(/\.[^.]*$/)
|
|
56
|
+
* return match ? match[0] : ""
|
|
57
|
+
* },
|
|
58
|
+
* format: (pathObject) => {
|
|
59
|
+
* const dir = pathObject.dir || ""
|
|
60
|
+
* const name = pathObject.name || ""
|
|
61
|
+
* const ext = pathObject.ext || ""
|
|
62
|
+
* return dir ? `${dir}/${name}${ext}` : `${name}${ext}`
|
|
63
|
+
* },
|
|
64
|
+
* fromFileUrl: (url: URL) => Effect.succeed(url.pathname),
|
|
65
|
+
* isAbsolute: (path: string) => path.startsWith("/"),
|
|
66
|
+
* join: (...paths: ReadonlyArray<string>) => paths.join("/"),
|
|
67
|
+
* normalize: (path: string) => path.replace(/\/+/g, "/"),
|
|
68
|
+
* parse: (path: string) => ({
|
|
69
|
+
* root: path.startsWith("/") ? "/" : "",
|
|
70
|
+
* dir: path.split("/").slice(0, -1).join("/") || "/",
|
|
71
|
+
* base: path.split("/").pop() || "",
|
|
72
|
+
* ext: path.match(/\.[^.]*$/)?.[0] || "",
|
|
73
|
+
* name: path.split("/").pop()?.replace(/\.[^.]*$/, "") || ""
|
|
74
|
+
* }),
|
|
75
|
+
* relative: (from: string, to: string) => to.replace(from, ""),
|
|
76
|
+
* resolve: (...pathSegments: ReadonlyArray<string>) => pathSegments.join("/"),
|
|
77
|
+
* toFileUrl: (path: string) => Effect.succeed(new URL(`file://${path}`)),
|
|
78
|
+
* toNamespacedPath: (path: string) => path
|
|
79
|
+
* })
|
|
80
|
+
*
|
|
81
|
+
* // Provide the path service
|
|
82
|
+
* const customPathLayer = Layer.succeed(Path.Path)(customPath)
|
|
83
|
+
*
|
|
84
|
+
* const program = Effect.gen(function*() {
|
|
85
|
+
* const path = yield* Path.Path
|
|
86
|
+
* return path.join("home", "user", "file.txt")
|
|
87
|
+
* })
|
|
88
|
+
*
|
|
89
|
+
* // Run with custom path implementation
|
|
90
|
+
* Effect.runSync(Effect.provide(program, customPathLayer)) // => "home/user/file.txt"
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @stability unstable
|
|
94
|
+
* @category services
|
|
95
|
+
* @since 4.0.0
|
|
96
|
+
*/
|
|
97
|
+
const Path = /*#__PURE__*/ Service("effect/Path");
|
|
98
|
+
/**
|
|
99
|
+
* Creates a `Path` service from platform path operations.
|
|
100
|
+
*
|
|
101
|
+
* **When to use**
|
|
102
|
+
*
|
|
103
|
+
* Use to build a `Path` implementation, such as a platform layer or a test
|
|
104
|
+
* double, without implementing the operations that can be derived from the
|
|
105
|
+
* others.
|
|
106
|
+
*
|
|
107
|
+
* **Details**
|
|
108
|
+
*
|
|
109
|
+
* Adds the `Path` type marker and derives `resolveWithin` from the provided
|
|
110
|
+
* `parse`, `resolve`, `relative`, `isAbsolute`, and `sep`, so containment
|
|
111
|
+
* follows the same platform rules as those operations.
|
|
112
|
+
*
|
|
113
|
+
* @see {@link layer} for the built-in POSIX `Path` service layer
|
|
114
|
+
*
|
|
115
|
+
* @stability unstable
|
|
116
|
+
* @category constructors
|
|
117
|
+
* @since 4.0.0
|
|
118
|
+
*/
|
|
119
|
+
const make = (impl) => Path.of({
|
|
120
|
+
...impl,
|
|
121
|
+
[TypeId]: TypeId,
|
|
122
|
+
resolveWithin(root, input) {
|
|
123
|
+
if (impl.parse(input).root !== "") return none();
|
|
124
|
+
const base = impl.resolve(root);
|
|
125
|
+
const candidate = impl.resolve(base, input);
|
|
126
|
+
const relative = impl.relative(base, candidate);
|
|
127
|
+
return relative === ".." || relative.startsWith(`..${impl.sep}`) || impl.isAbsolute(relative) ? none() : some(candidate);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
export { make as n, Path as t };
|