effect 4.0.0-beta.62 → 4.0.0-beta.64
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/dist/Effect.d.ts +38 -0
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +38 -0
- package/dist/Effect.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/effect.js +2 -0
- package/dist/internal/effect.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +11 -7
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +2 -1
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.d.ts +20 -0
- package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -0
- package/dist/unstable/httpapi/HttpApiTest.js +54 -0
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -0
- package/dist/unstable/httpapi/index.d.ts +4 -0
- package/dist/unstable/httpapi/index.d.ts.map +1 -1
- package/dist/unstable/httpapi/index.js +4 -0
- package/dist/unstable/httpapi/index.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +4 -2
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/SqlModel.js +16 -10
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/package.json +1 -1
- package/src/Effect.ts +41 -0
- package/src/index.ts +1 -1
- package/src/internal/effect.ts +9 -0
- package/src/unstable/httpapi/HttpApiBuilder.ts +14 -8
- package/src/unstable/httpapi/HttpApiClient.ts +4 -3
- package/src/unstable/httpapi/HttpApiTest.ts +95 -0
- package/src/unstable/httpapi/index.ts +5 -0
- package/src/unstable/sql/SqlModel.ts +52 -21
package/dist/Effect.d.ts
CHANGED
|
@@ -11144,6 +11144,44 @@ export declare const scopedWith: <A, E, R>(f: (scope: Scope) => Effect<A, E, R>)
|
|
|
11144
11144
|
export declare const acquireRelease: <A, E, R, R2>(acquire: Effect<A, E, R>, release: (a: A, exit: Exit.Exit<unknown, unknown>) => Effect<unknown, never, R2>, options?: {
|
|
11145
11145
|
readonly interruptible?: boolean;
|
|
11146
11146
|
}) => Effect<A, E, R | R2 | Scope>;
|
|
11147
|
+
/**
|
|
11148
|
+
* This function constructs a scoped resource from an Effect that acquires a
|
|
11149
|
+
* disposable value.
|
|
11150
|
+
*
|
|
11151
|
+
* The resource is automatically disposed when the surrounding
|
|
11152
|
+
* {@link Scope} is closed, using {@link Symbol.dispose} for
|
|
11153
|
+
* synchronous disposables or {@link Symbol.asyncDispose} for asynchronous
|
|
11154
|
+
* disposables.
|
|
11155
|
+
*
|
|
11156
|
+
* This is similar to {@link acquireRelease}, but uses the standard
|
|
11157
|
+
* JavaScript disposal protocal instead of requiring an explicit release
|
|
11158
|
+
* function.
|
|
11159
|
+
*
|
|
11160
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/using}
|
|
11161
|
+
*
|
|
11162
|
+
* @example
|
|
11163
|
+
* ```ts
|
|
11164
|
+
* import sqlite from "node:sqlite";
|
|
11165
|
+
* import { Effect } from "effect";
|
|
11166
|
+
*
|
|
11167
|
+
* const program = Effect.scoped(
|
|
11168
|
+
* Effect.gen(function* () {
|
|
11169
|
+
* // acquire database connection
|
|
11170
|
+
* // database will be closed when the scope is closed
|
|
11171
|
+
* const db = yield* Effect.acquireDisposable(
|
|
11172
|
+
* Effect.sync(() => new sqlite.DatabaseSync(":memory:"))
|
|
11173
|
+
* )
|
|
11174
|
+
*
|
|
11175
|
+
* const row = db.prepare("SELECT 1 AS value").get()
|
|
11176
|
+
* yield* Effect.log(row) // { value: 1 }
|
|
11177
|
+
* })
|
|
11178
|
+
* )
|
|
11179
|
+
* ```
|
|
11180
|
+
*
|
|
11181
|
+
* @since 4.0.0
|
|
11182
|
+
* @category Resource Management & Finalization
|
|
11183
|
+
*/
|
|
11184
|
+
export declare const acquireDisposable: <A extends AsyncDisposable | Disposable, E, R>(acquire: Effect<A, E, R>) => Effect<A, E, R | Scope>;
|
|
11147
11185
|
/**
|
|
11148
11186
|
* This function is used to ensure that an `Effect` value that represents the
|
|
11149
11187
|
* acquisition of a resource (for example, opening a file, launching a thread,
|