@tstdl/base 0.93.139 → 0.93.141
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 +166 -0
- package/ai/genkit/multi-region.plugin.js +5 -3
- package/ai/genkit/tests/multi-region.test.d.ts +1 -0
- package/ai/genkit/tests/multi-region.test.js +5 -2
- package/ai/parser/parser.js +2 -2
- package/ai/prompts/build.js +1 -0
- package/ai/prompts/instructions-formatter.d.ts +15 -2
- package/ai/prompts/instructions-formatter.js +36 -31
- package/ai/prompts/prompt-builder.js +5 -5
- package/ai/prompts/steering.d.ts +3 -2
- package/ai/prompts/steering.js +3 -1
- package/ai/tests/instructions-formatter.test.js +1 -0
- package/api/README.md +403 -0
- package/api/client/client.js +7 -13
- package/api/client/tests/api-client.test.js +10 -10
- package/api/default-error-handlers.js +1 -1
- package/api/response.d.ts +2 -2
- package/api/response.js +22 -33
- package/api/server/api-controller.d.ts +1 -1
- package/api/server/api-controller.js +3 -3
- package/api/server/api-request-token.provider.d.ts +1 -0
- package/api/server/api-request-token.provider.js +1 -0
- package/api/server/middlewares/allowed-methods.middleware.js +2 -1
- package/api/server/middlewares/content-type.middleware.js +2 -1
- package/api/types.d.ts +3 -2
- package/application/README.md +240 -0
- package/application/application.d.ts +1 -1
- package/application/application.js +3 -3
- package/application/providers.d.ts +20 -2
- package/application/providers.js +34 -7
- package/audit/README.md +267 -0
- package/audit/module.d.ts +5 -0
- package/audit/module.js +9 -1
- package/authentication/README.md +288 -0
- package/authentication/client/authentication.service.d.ts +12 -11
- package/authentication/client/authentication.service.js +21 -21
- package/authentication/client/http-client.middleware.js +2 -2
- package/authentication/server/module.d.ts +5 -0
- package/authentication/server/module.js +9 -1
- package/authentication/tests/authentication.api-controller.test.js +1 -1
- package/authentication/tests/authentication.api-request-token.provider.test.js +1 -1
- package/authentication/tests/authentication.client-error-handling.test.js +2 -1
- package/authentication/tests/authentication.client-service-refresh.test.js +5 -3
- package/authentication/tests/authentication.client-service.test.js +1 -1
- package/browser/README.md +401 -0
- package/cancellation/README.md +156 -0
- package/cancellation/tests/coverage.test.d.ts +1 -0
- package/cancellation/tests/coverage.test.js +49 -0
- package/cancellation/tests/leak.test.js +24 -29
- package/cancellation/tests/token.test.d.ts +1 -0
- package/cancellation/tests/token.test.js +136 -0
- package/cancellation/token.d.ts +53 -177
- package/cancellation/token.js +132 -208
- package/circuit-breaker/postgres/module.d.ts +1 -0
- package/circuit-breaker/postgres/module.js +5 -1
- package/context/README.md +174 -0
- package/cookie/README.md +161 -0
- package/css/README.md +157 -0
- package/data-structures/README.md +320 -0
- package/decorators/README.md +140 -0
- package/distributed-loop/README.md +231 -0
- package/distributed-loop/distributed-loop.js +1 -1
- package/document-management/README.md +403 -0
- package/document-management/server/configure.js +5 -1
- package/document-management/server/module.d.ts +1 -1
- package/document-management/server/module.js +1 -1
- package/document-management/server/services/document-management-ancillary.service.js +1 -1
- package/document-management/server/services/document-management.service.js +9 -7
- package/document-management/tests/ai-config-hierarchy.test.js +0 -5
- package/document-management/tests/document-management-ai-overrides.test.js +0 -1
- package/document-management/tests/document-management-core.test.js +2 -7
- package/document-management/tests/document-management.api.test.js +6 -7
- package/document-management/tests/document-statistics.service.test.js +11 -12
- package/document-management/tests/document-validation-ai-overrides.test.js +0 -1
- package/document-management/tests/document.service.test.js +3 -3
- package/document-management/tests/enum-helpers.test.js +2 -3
- package/dom/README.md +213 -0
- package/enumerable/README.md +259 -0
- package/enumeration/README.md +121 -0
- package/errors/README.md +267 -0
- package/examples/document-management/main.d.ts +1 -0
- package/examples/document-management/main.js +14 -11
- package/file/README.md +191 -0
- package/formats/README.md +210 -0
- package/function/README.md +144 -0
- package/http/README.md +318 -0
- package/http/client/adapters/undici.adapter.js +1 -1
- package/http/client/http-client-request.d.ts +6 -5
- package/http/client/http-client-request.js +8 -9
- package/http/server/node/node-http-server.js +1 -2
- package/image-service/README.md +137 -0
- package/injector/README.md +491 -0
- package/intl/README.md +113 -0
- package/json-path/README.md +182 -0
- package/jsx/README.md +154 -0
- package/key-value-store/README.md +191 -0
- package/key-value-store/postgres/module.d.ts +1 -0
- package/key-value-store/postgres/module.js +5 -1
- package/lock/README.md +249 -0
- package/lock/postgres/module.d.ts +1 -0
- package/lock/postgres/module.js +5 -1
- package/lock/web/web-lock.js +119 -47
- package/logger/README.md +287 -0
- package/mail/README.md +256 -0
- package/mail/module.d.ts +5 -1
- package/mail/module.js +11 -6
- package/memory/README.md +144 -0
- package/message-bus/README.md +244 -0
- package/message-bus/message-bus-base.js +1 -1
- package/module/README.md +182 -0
- package/module/module.d.ts +1 -1
- package/module/module.js +77 -17
- package/module/modules/web-server.module.js +3 -4
- package/notification/server/module.d.ts +1 -0
- package/notification/server/module.js +5 -1
- package/notification/tests/notification-flow.test.js +2 -2
- package/notification/tests/notification-type.service.test.js +24 -15
- package/object-storage/README.md +300 -0
- package/openid-connect/README.md +274 -0
- package/orm/README.md +423 -0
- package/orm/decorators.d.ts +5 -1
- package/orm/decorators.js +1 -1
- package/orm/server/drizzle/schema-converter.js +17 -30
- package/orm/server/encryption.d.ts +0 -1
- package/orm/server/encryption.js +1 -4
- package/orm/server/index.d.ts +1 -6
- package/orm/server/index.js +1 -6
- package/orm/server/migration.d.ts +19 -0
- package/orm/server/migration.js +72 -0
- package/orm/server/repository.d.ts +1 -1
- package/orm/server/transaction.d.ts +5 -10
- package/orm/server/transaction.js +22 -26
- package/orm/server/transactional.js +3 -3
- package/orm/tests/database-migration.test.d.ts +1 -0
- package/orm/tests/database-migration.test.js +82 -0
- package/orm/tests/encryption.test.js +3 -4
- package/orm/utils.d.ts +17 -2
- package/orm/utils.js +49 -1
- package/package.json +9 -6
- package/password/README.md +164 -0
- package/pdf/README.md +246 -0
- package/polyfills.js +1 -0
- package/pool/README.md +198 -0
- package/process/README.md +237 -0
- package/promise/README.md +252 -0
- package/promise/cancelable-promise.js +1 -1
- package/random/README.md +193 -0
- package/rate-limit/postgres/module.d.ts +1 -0
- package/rate-limit/postgres/module.js +5 -1
- package/reflection/README.md +305 -0
- package/reflection/decorator-data.js +11 -12
- package/rpc/README.md +386 -0
- package/rxjs-utils/README.md +262 -0
- package/schema/README.md +342 -0
- package/serializer/README.md +342 -0
- package/signals/implementation/README.md +134 -0
- package/sse/README.md +278 -0
- package/task-queue/README.md +293 -0
- package/task-queue/postgres/drizzle/{0000_simple_invisible_woman.sql → 0000_wakeful_sunspot.sql} +22 -14
- package/task-queue/postgres/drizzle/meta/0000_snapshot.json +160 -82
- package/task-queue/postgres/drizzle/meta/_journal.json +2 -2
- package/task-queue/postgres/module.d.ts +1 -0
- package/task-queue/postgres/module.js +5 -1
- package/task-queue/postgres/schemas.d.ts +9 -6
- package/task-queue/postgres/schemas.js +4 -3
- package/task-queue/postgres/task-queue.d.ts +4 -13
- package/task-queue/postgres/task-queue.js +462 -355
- package/task-queue/postgres/task.model.d.ts +12 -5
- package/task-queue/postgres/task.model.js +51 -25
- package/task-queue/task-context.d.ts +2 -2
- package/task-queue/task-context.js +8 -8
- package/task-queue/task-queue.d.ts +53 -19
- package/task-queue/task-queue.js +121 -55
- package/task-queue/tests/cascading-cancellations.test.d.ts +1 -0
- package/task-queue/tests/cascading-cancellations.test.js +38 -0
- package/task-queue/tests/complex.test.js +45 -229
- package/task-queue/tests/coverage-branch.test.d.ts +1 -0
- package/task-queue/tests/coverage-branch.test.js +407 -0
- package/task-queue/tests/coverage-enhancement.test.d.ts +1 -0
- package/task-queue/tests/coverage-enhancement.test.js +144 -0
- package/task-queue/tests/dag-dependencies.test.d.ts +1 -0
- package/task-queue/tests/dag-dependencies.test.js +41 -0
- package/task-queue/tests/dependencies.test.js +28 -26
- package/task-queue/tests/extensive-dependencies.test.js +64 -139
- package/task-queue/tests/fan-out-spawning.test.d.ts +1 -0
- package/task-queue/tests/fan-out-spawning.test.js +53 -0
- package/task-queue/tests/idempotent-replacement.test.d.ts +1 -0
- package/task-queue/tests/idempotent-replacement.test.js +61 -0
- package/task-queue/tests/missing-idempotent-tasks.test.d.ts +1 -0
- package/task-queue/tests/missing-idempotent-tasks.test.js +38 -0
- package/task-queue/tests/queue.test.js +128 -8
- package/task-queue/tests/worker.test.js +39 -16
- package/task-queue/tests/zombie-parent.test.d.ts +1 -0
- package/task-queue/tests/zombie-parent.test.js +45 -0
- package/task-queue/tests/zombie-recovery.test.d.ts +1 -0
- package/task-queue/tests/zombie-recovery.test.js +51 -0
- package/templates/README.md +287 -0
- package/test5.js +5 -5
- package/testing/README.md +157 -0
- package/testing/integration-setup.d.ts +4 -4
- package/testing/integration-setup.js +54 -29
- package/text/README.md +346 -0
- package/text/localization.service.js +2 -2
- package/threading/README.md +238 -0
- package/types/README.md +311 -0
- package/utils/README.md +322 -0
- package/utils/async-iterable-helpers/observable-iterable.d.ts +1 -1
- package/utils/async-iterable-helpers/observable-iterable.js +4 -8
- package/utils/async-iterable-helpers/take-until.js +4 -4
- package/utils/backoff.js +89 -30
- package/utils/file-reader.js +1 -2
- package/utils/retry-with-backoff.js +1 -1
- package/utils/timer.d.ts +1 -1
- package/utils/timer.js +5 -7
- package/utils/timing.d.ts +1 -1
- package/utils/timing.js +2 -4
- package/utils/z-base32.d.ts +1 -0
- package/utils/z-base32.js +1 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CancellationSignal } from '../../cancellation/index.js';
|
|
1
|
+
import { type CancellationSignal, type CancellationSource } from '../../cancellation/index.js';
|
|
2
2
|
import type { OneOrMany, Record, TypedOmit, UndefinableJson, UndefinableJsonObject } from '../../types/index.js';
|
|
3
3
|
import { HttpForm, type HttpFormObject } from '../http-form.js';
|
|
4
4
|
import { HttpHeaders, type HttpHeadersObject } from '../http-headers.js';
|
|
@@ -23,7 +23,7 @@ export type HttpRequestAuthorization = {
|
|
|
23
23
|
};
|
|
24
24
|
export type HttpFormDataObjectValue = string | number | boolean | Uint8Array<ArrayBuffer> | Blob;
|
|
25
25
|
export type HttpFormDataObject = Record<string, OneOrMany<HttpFormDataObjectValue>>;
|
|
26
|
-
export type HttpClientRequestOptions = Partial<TypedOmit<HttpClientRequest, 'url' | 'method' | '
|
|
26
|
+
export type HttpClientRequestOptions = Partial<TypedOmit<HttpClientRequest, 'url' | 'method' | 'cancellationSignal' | 'abort' | 'headers' | 'query' | 'body'>> & {
|
|
27
27
|
urlParameter?: HttpUrlParametersObject | HttpUrlParameters;
|
|
28
28
|
headers?: HttpHeadersObject | HttpHeaders;
|
|
29
29
|
query?: HttpQueryObject | HttpQuery;
|
|
@@ -33,7 +33,7 @@ export type HttpClientRequestOptions = Partial<TypedOmit<HttpClientRequest, 'url
|
|
|
33
33
|
form?: HttpFormObject | HttpForm;
|
|
34
34
|
formData?: HttpFormDataObject | FormData;
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
cancellationSignal?: CancellationSource;
|
|
37
37
|
priority?: RequestPriority;
|
|
38
38
|
};
|
|
39
39
|
export type HttpRequestCredentials = 'omit' | 'same-origin' | 'include';
|
|
@@ -110,9 +110,10 @@ export declare class HttpClientRequest implements Disposable {
|
|
|
110
110
|
*/
|
|
111
111
|
context: Record;
|
|
112
112
|
/**
|
|
113
|
-
* Can be used to cancel the request.
|
|
113
|
+
* Can be used to cancel the request.
|
|
114
|
+
* Must throw HttpError.
|
|
114
115
|
*/
|
|
115
|
-
get
|
|
116
|
+
get cancellationSignal(): CancellationSignal;
|
|
116
117
|
constructor(url: string, method?: HttpMethod, options?: HttpClientRequestOptions);
|
|
117
118
|
constructor(requestObject: HttpClientRequestObject);
|
|
118
119
|
[Symbol.dispose](): void;
|
|
@@ -7,7 +7,7 @@ import { HttpHeaders } from '../http-headers.js';
|
|
|
7
7
|
import { HttpQuery } from '../http-query.js';
|
|
8
8
|
import { HttpUrlParameters } from '../http-url-parameters.js';
|
|
9
9
|
export class HttpClientRequest {
|
|
10
|
-
#
|
|
10
|
+
#cancellationToken;
|
|
11
11
|
url;
|
|
12
12
|
method;
|
|
13
13
|
headers;
|
|
@@ -75,10 +75,11 @@ export class HttpClientRequest {
|
|
|
75
75
|
*/
|
|
76
76
|
context;
|
|
77
77
|
/**
|
|
78
|
-
* Can be used to cancel the request.
|
|
78
|
+
* Can be used to cancel the request.
|
|
79
|
+
* Must throw HttpError.
|
|
79
80
|
*/
|
|
80
|
-
get
|
|
81
|
-
return this.#
|
|
81
|
+
get cancellationSignal() {
|
|
82
|
+
return this.#cancellationToken.signal;
|
|
82
83
|
}
|
|
83
84
|
constructor(urlOrObject, method, options = {}) {
|
|
84
85
|
if (isString(urlOrObject)) {
|
|
@@ -106,16 +107,14 @@ export class HttpClientRequest {
|
|
|
106
107
|
this.timeout = requestOptions.timeout ?? 30000;
|
|
107
108
|
this.throwOnNon200 = requestOptions.throwOnNon200 ?? true;
|
|
108
109
|
this.context = requestOptions.context ?? {};
|
|
109
|
-
this.#
|
|
110
|
+
this.#cancellationToken = new CancellationToken(requestOptions.cancellationSignal);
|
|
110
111
|
}
|
|
111
112
|
[Symbol.dispose]() {
|
|
112
|
-
this.#
|
|
113
|
-
this.#abortToken.complete();
|
|
113
|
+
this.#cancellationToken[Symbol.dispose]();
|
|
114
114
|
}
|
|
115
115
|
/** Abort the request */
|
|
116
116
|
abort() {
|
|
117
|
-
this.#
|
|
118
|
-
this.#abortToken.complete();
|
|
117
|
+
this.#cancellationToken.set();
|
|
119
118
|
}
|
|
120
119
|
clone() {
|
|
121
120
|
const request = new HttpClientRequest(this);
|
|
@@ -10,7 +10,6 @@ import * as Http from 'node:http';
|
|
|
10
10
|
import { Writable } from 'node:stream';
|
|
11
11
|
import { bindNodeCallback, share } from 'rxjs';
|
|
12
12
|
import { match, P } from 'ts-pattern';
|
|
13
|
-
import { CancellationToken } from '../../../cancellation/index.js';
|
|
14
13
|
import { HttpHeaders } from '../../../http/http-headers.js';
|
|
15
14
|
import { HttpQuery } from '../../../http/http-query.js';
|
|
16
15
|
import { afterResolve, inject, Singleton } from '../../../injector/index.js';
|
|
@@ -88,7 +87,7 @@ let NodeHttpServer = NodeHttpServer_1 = class NodeHttpServer extends HttpServer
|
|
|
88
87
|
}
|
|
89
88
|
if (connections > 0) {
|
|
90
89
|
this.#logger.info(`Waiting for ${connections} connections to end`);
|
|
91
|
-
await cancelableTimeout(250,
|
|
90
|
+
await cancelableTimeout(250, close$);
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
93
|
this.#requestIterable.end();
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Image Service
|
|
2
|
+
|
|
3
|
+
A robust module for generating signed, manipulated image URLs, providing an abstract interface for image processing services with a concrete implementation for [imgproxy](https://imgproxy.net/).
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [✨ Features](#-features)
|
|
8
|
+
- [Core Concepts](#core-concepts)
|
|
9
|
+
- [🚀 Basic Usage](#-basic-usage)
|
|
10
|
+
- [🔧 Advanced Topics](#-advanced-topics)
|
|
11
|
+
- [Image Options](#image-options)
|
|
12
|
+
- [Manual Instantiation](#manual-instantiation)
|
|
13
|
+
- [📚 API](#-api)
|
|
14
|
+
|
|
15
|
+
## ✨ Features
|
|
16
|
+
|
|
17
|
+
- **Abstract Interface**: `ImageService` base class allows for dependency injection and easy swapping of image providers.
|
|
18
|
+
- **Imgproxy Support**: Full implementation for generating signed imgproxy URLs.
|
|
19
|
+
- **Secure Signing**: Automatically handles HMAC-SHA256 signature generation using your key and salt.
|
|
20
|
+
- **Rich Manipulations**: Supports resizing, cropping (gravity/origin), formatting, quality adjustment, and cache busting.
|
|
21
|
+
- **Type-Safe Options**: Fully typed configuration and options using TypeScript enums and classes.
|
|
22
|
+
|
|
23
|
+
## Core Concepts
|
|
24
|
+
|
|
25
|
+
The module revolves around the `ImageService` abstract class. By depending on this abstraction in your application, you decouple your code from the specific image processing backend.
|
|
26
|
+
|
|
27
|
+
The primary implementation provided is `ImgproxyImageService`. It generates URLs that point to an imgproxy server. These URLs include:
|
|
28
|
+
|
|
29
|
+
1. **Processing Options**: Instructions for resizing, formatting, etc.
|
|
30
|
+
2. **Encoded Source URL**: The original image URL, Base64 encoded.
|
|
31
|
+
3. **Signature**: A cryptographic signature ensuring the URL parameters haven't been tampered with, preventing denial-of-service attacks via image processing.
|
|
32
|
+
|
|
33
|
+
## 🚀 Basic Usage
|
|
34
|
+
|
|
35
|
+
### 1. Configuration
|
|
36
|
+
|
|
37
|
+
First, configure the service during your application bootstrap. This registers `ImgproxyImageService` as the implementation for `ImageService` in the dependency injection container.
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { configureImgproxyImageService } from '@tstdl/base/image-service';
|
|
41
|
+
|
|
42
|
+
// In your bootstrap or configuration file
|
|
43
|
+
configureImgproxyImageService({
|
|
44
|
+
endpoint: 'https://images.yourdomain.com',
|
|
45
|
+
key: 'your-hex-encoded-key',
|
|
46
|
+
salt: 'your-hex-encoded-salt',
|
|
47
|
+
signatureSize: 32,
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 2. Generating URLs
|
|
52
|
+
|
|
53
|
+
Inject the `ImageService` and use `getUrl` to generate signed URLs for your images.
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { ImageService, ImageResizeMode } from '@tstdl/base/image-service';
|
|
57
|
+
import { inject } from '@tstdl/base/injector';
|
|
58
|
+
|
|
59
|
+
class UserProfileController {
|
|
60
|
+
// Inject the abstract service
|
|
61
|
+
readonly #imageService = inject(ImageService);
|
|
62
|
+
|
|
63
|
+
async getAvatarUrl(originalUrl: string): Promise<string> {
|
|
64
|
+
// Generate a signed URL
|
|
65
|
+
const signedUrl = await this.#imageService.getUrl(originalUrl, {
|
|
66
|
+
width: 150,
|
|
67
|
+
height: 150,
|
|
68
|
+
resizeMode: ImageResizeMode.Fill,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
return signedUrl;
|
|
72
|
+
// Output example:
|
|
73
|
+
// https://images.yourdomain.com/SIGNATURE/rs:fill:150:150/aHR0cHM6Ly9leGFtcGxlLmNvbS9pbWFnZS5qcGc
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 🔧 Advanced Topics
|
|
79
|
+
|
|
80
|
+
### Image Options
|
|
81
|
+
|
|
82
|
+
The `ImageOptions` class provides granular control over the output image.
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import { ImageService, ImageResizeMode, ImageOrigin, ImageFormat } from '@tstdl/base/image-service';
|
|
86
|
+
import { inject } from '@tstdl/base/injector';
|
|
87
|
+
|
|
88
|
+
const imageService = inject(ImageService);
|
|
89
|
+
|
|
90
|
+
const url = await imageService.getUrl('https://example.com/banner.png', {
|
|
91
|
+
// Resize strategy
|
|
92
|
+
resizeMode: ImageResizeMode.Fit, // 'fit' or 'fill'
|
|
93
|
+
width: 800,
|
|
94
|
+
height: 400,
|
|
95
|
+
|
|
96
|
+
// Gravity / Origin (where to focus when cropping)
|
|
97
|
+
origin: ImageOrigin.Smart, // Uses smart detection if supported, or center
|
|
98
|
+
|
|
99
|
+
// Output format and quality
|
|
100
|
+
format: ImageFormat.Webp,
|
|
101
|
+
quality: 80,
|
|
102
|
+
|
|
103
|
+
// Cache busting string (appended to processing options)
|
|
104
|
+
cacheBuster: 'v1.2.3',
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Manual Instantiation
|
|
109
|
+
|
|
110
|
+
If you need to instantiate `ImgproxyImageService` directly (outside of the DI container) or manage multiple instances with different configurations:
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
import { ImgproxyImageService } from '@tstdl/base/image-service';
|
|
114
|
+
|
|
115
|
+
const imgproxy = new ImgproxyImageService(
|
|
116
|
+
'https://img.example.com', // endpoint
|
|
117
|
+
'aabbcc...', // key (hex)
|
|
118
|
+
'112233...', // salt (hex)
|
|
119
|
+
32, // signature size
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const url = await imgproxy.getUrl('http://source.com/img.jpg', { width: 100 });
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## 📚 API
|
|
126
|
+
|
|
127
|
+
| Export | Type | Description |
|
|
128
|
+
| :------------------------------ | :--------------- | :----------------------------------------------------------------------------------------- |
|
|
129
|
+
| `ImageService` | `abstract class` | The base contract for image services. Defines `getUrl`. |
|
|
130
|
+
| `ImgproxyImageService` | `class` | Concrete implementation for imgproxy. |
|
|
131
|
+
| `configureImgproxyImageService` | `function` | Helper to register the imgproxy service and config in the injector. |
|
|
132
|
+
| `ImageOptions` | `class` | Configuration object for image manipulation (width, height, etc.). |
|
|
133
|
+
| `ImageResizeMode` | `enum` | Resize strategies: `Fit`, `Fill`. |
|
|
134
|
+
| `ImageFormat` | `enum` | Output formats: `Png`, `Jpg`, `Webp`, `Avif`, etc. |
|
|
135
|
+
| `ImageOrigin` | `enum` | Gravity/Origin for cropping: `Center`, `Smart`, `Top`, `TopLeft`, etc. |
|
|
136
|
+
| `IMGPROXY_IMAGE_SERVICE_CONFIG` | `InjectionToken` | Token used to inject the configuration object. |
|
|
137
|
+
| `ImgproxyImageServiceConfig` | `type` | Type definition for the configuration object (`endpoint`, `key`, `salt`, `signatureSize`). |
|