@teamflojo/floimg 0.13.0 → 0.14.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 +10 -3
- package/dist/cli/utils/plugin-loader.d.ts.map +1 -1
- package/dist/cli/utils/plugin-loader.js +4 -1
- package/dist/cli/utils/plugin-loader.js.map +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +3 -6
- package/dist/config/index.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +12 -10
- package/dist/config/loader.js.map +1 -1
- package/dist/core/errors.d.ts +236 -12
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +340 -32
- package/dist/core/errors.js.map +1 -1
- package/dist/core/fluent.d.ts.map +1 -1
- package/dist/core/fluent.js +13 -5
- package/dist/core/fluent.js.map +1 -1
- package/dist/core/pipeline-runner.d.ts.map +1 -1
- package/dist/core/pipeline-runner.js +3 -2
- package/dist/core/pipeline-runner.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/providers/transform/presets.d.ts.map +1 -1
- package/dist/providers/transform/presets.js +7 -21
- package/dist/providers/transform/presets.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,6 @@ The core FloImg package provides the pipeline engine, built-in image transforms,
|
|
|
14
14
|
- **Save Providers** — Filesystem and S3-compatible storage
|
|
15
15
|
- **CLI** — Command-line interface with plugin auto-install
|
|
16
16
|
- **Fluent API** — Chainable syntax for building pipelines
|
|
17
|
-
- **MCP Server** — Model Context Protocol for AI agent integration
|
|
18
17
|
|
|
19
18
|
## Installation
|
|
20
19
|
|
|
@@ -120,19 +119,27 @@ See [QUICK_START.md](./QUICK_START.md) for full CLI documentation.
|
|
|
120
119
|
|
|
121
120
|
## MCP (AI Agents)
|
|
122
121
|
|
|
123
|
-
Use FloImg with Claude and other AI agents via MCP:
|
|
122
|
+
Use FloImg with Claude and other AI agents via MCP. Install the separate MCP package:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
npm install -g @teamflojo/floimg-mcp
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Configure your MCP client:
|
|
124
129
|
|
|
125
130
|
```json
|
|
126
131
|
{
|
|
127
132
|
"mcpServers": {
|
|
128
133
|
"floimg": {
|
|
129
134
|
"command": "npx",
|
|
130
|
-
"args": ["-y", "@teamflojo/floimg-
|
|
135
|
+
"args": ["-y", "@teamflojo/floimg-mcp"]
|
|
131
136
|
}
|
|
132
137
|
}
|
|
133
138
|
}
|
|
134
139
|
```
|
|
135
140
|
|
|
141
|
+
See [@teamflojo/floimg-mcp](https://www.npmjs.com/package/@teamflojo/floimg-mcp) for full documentation.
|
|
142
|
+
|
|
136
143
|
## Documentation
|
|
137
144
|
|
|
138
145
|
- **[Getting Started](https://floimg.com/docs/getting-started/quick-start)** — Installation and first steps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-loader.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/plugin-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-loader.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/plugin-loader.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CA0BtD,CAAC;AAwBF;;GAEG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAOzC;AA0FD;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,CAAC,GAAG,OAAO,EAC1C,SAAS,EAAE,MAAM,EACjB,WAAW,UAAO,GACjB,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAsDnB;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAIjC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { execSync } from "child_process";
|
|
2
2
|
import { createInterface } from "readline";
|
|
3
|
+
import { ConfigurationError } from "../../core/errors.js";
|
|
3
4
|
/**
|
|
4
5
|
* Registry of known plugins and their packages
|
|
5
6
|
*/
|
|
@@ -96,7 +97,9 @@ async function tryImportPackage(packageName) {
|
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
|
-
throw new
|
|
100
|
+
throw new ConfigurationError(`Cannot find package '${packageName}'`, {
|
|
101
|
+
operation: "loadPlugin",
|
|
102
|
+
});
|
|
100
103
|
}
|
|
101
104
|
/**
|
|
102
105
|
* Detect the package manager being used
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-loader.js","sourceRoot":"","sources":["../../../src/cli/utils/plugin-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin-loader.js","sourceRoot":"","sources":["../../../src/cli/utils/plugin-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAc1D;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAA+B;IACzD,EAAE,EAAE;QACF,OAAO,EAAE,sBAAsB;QAC/B,WAAW,EAAE,mBAAmB;QAChC,aAAa,EAAE,IAAI;KACpB;IACD,UAAU,EAAE;QACV,OAAO,EAAE,8BAA8B;QACvC,WAAW,EAAE,sBAAsB;QACnC,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AAE,CAAC;QACf,OAAO,CAAC,KAAK,CACX,yBAAyB,IAAI,CAAC,OAAO,GAAG,EACxC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAC/C,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,2CAA2C,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QACvE,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,IAAI,eAAe,EAAE,EAAE,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,yEAAyE,CAAC,CAAC;IACzF,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAE/D;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CA2BvF"}
|
package/dist/config/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ConfigurationError } from "../core/errors.js";
|
|
1
2
|
/**
|
|
2
3
|
* Helper to define floimg configuration with TypeScript support
|
|
3
4
|
*/
|
|
@@ -10,11 +11,7 @@ export function defineConfig(config) {
|
|
|
10
11
|
export async function loadConfig(configPath) {
|
|
11
12
|
if (!configPath) {
|
|
12
13
|
// Try to find config in common locations
|
|
13
|
-
const possiblePaths = [
|
|
14
|
-
"./floimg.config.ts",
|
|
15
|
-
"./floimg.config.js",
|
|
16
|
-
"./floimg.config.mjs",
|
|
17
|
-
];
|
|
14
|
+
const possiblePaths = ["./floimg.config.ts", "./floimg.config.js", "./floimg.config.mjs"];
|
|
18
15
|
for (const path of possiblePaths) {
|
|
19
16
|
try {
|
|
20
17
|
const module = await import(path);
|
|
@@ -32,7 +29,7 @@ export async function loadConfig(configPath) {
|
|
|
32
29
|
return module.default || module;
|
|
33
30
|
}
|
|
34
31
|
catch (error) {
|
|
35
|
-
throw new
|
|
32
|
+
throw new ConfigurationError(`Failed to load config from ${configPath}: ${error instanceof Error ? error.message : String(error)}`, { cause: error instanceof Error ? error : undefined });
|
|
36
33
|
}
|
|
37
34
|
}
|
|
38
35
|
//# sourceMappingURL=index.js.map
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAAoB;IAC/C,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,UAAmB;IAClD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,yCAAyC;QACzC,MAAM,aAAa,GAAG,CAAC,oBAAoB,EAAE,oBAAoB,EAAE,qBAAqB,CAAC,CAAC;QAE1F,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;YACjC,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;gBAClC,OAAO,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC;YAClC,CAAC;YAAC,MAAM,CAAC;gBACP,wBAAwB;YAC1B,CAAC;QACH,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC;QACxC,OAAO,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,kBAAkB,CAC1B,8BAA8B,UAAU,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EACrG,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,EAAE,CACtD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAmBrD;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CA0C7E;AAoGD;;GAEG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE;IACP,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,GACA,YAAY,CAwBd;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAO1E"}
|
package/dist/config/loader.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFile, access } from "fs/promises";
|
|
2
2
|
import { join } from "path";
|
|
3
3
|
import { homedir } from "os";
|
|
4
|
+
import { ConfigurationError } from "../core/errors.js";
|
|
4
5
|
/**
|
|
5
6
|
* Configuration search paths (in order of priority)
|
|
6
7
|
*/
|
|
@@ -31,7 +32,7 @@ export async function loadConfig(explicitPath) {
|
|
|
31
32
|
Object.assign(config, loadedConfig);
|
|
32
33
|
}
|
|
33
34
|
catch (error) {
|
|
34
|
-
throw new
|
|
35
|
+
throw new ConfigurationError(`Failed to load config from ${explicitPath}: ${error instanceof Error ? error.message : String(error)}`, { cause: error instanceof Error ? error : undefined });
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
else {
|
|
@@ -65,12 +66,12 @@ export async function loadConfig(explicitPath) {
|
|
|
65
66
|
* Load config from a specific file
|
|
66
67
|
*/
|
|
67
68
|
async function loadConfigFile(path) {
|
|
68
|
-
if (path.endsWith(
|
|
69
|
+
if (path.endsWith(".json")) {
|
|
69
70
|
// JSON config
|
|
70
|
-
const content = await readFile(path,
|
|
71
|
+
const content = await readFile(path, "utf-8");
|
|
71
72
|
return JSON.parse(content);
|
|
72
73
|
}
|
|
73
|
-
else if (path.endsWith(
|
|
74
|
+
else if (path.endsWith(".ts") || path.endsWith(".js") || path.endsWith(".mjs")) {
|
|
74
75
|
// TypeScript/JavaScript config - convert to absolute file:// URL for import()
|
|
75
76
|
const { resolve } = await import("path");
|
|
76
77
|
const absolutePath = resolve(process.cwd(), path);
|
|
@@ -81,7 +82,7 @@ async function loadConfigFile(path) {
|
|
|
81
82
|
else {
|
|
82
83
|
// Try as JSON first
|
|
83
84
|
try {
|
|
84
|
-
const content = await readFile(path,
|
|
85
|
+
const content = await readFile(path, "utf-8");
|
|
85
86
|
return JSON.parse(content);
|
|
86
87
|
}
|
|
87
88
|
catch {
|
|
@@ -108,18 +109,19 @@ function loadEnvConfig() {
|
|
|
108
109
|
process.env.TIGRIS_ACCESS_KEY_ID;
|
|
109
110
|
if (hasS3Config) {
|
|
110
111
|
const bucket = process.env.TIGRIS_BUCKET_NAME || process.env.S3_BUCKET;
|
|
111
|
-
const region = process.env.TIGRIS_REGION || process.env.AWS_REGION ||
|
|
112
|
+
const region = process.env.TIGRIS_REGION || process.env.AWS_REGION || "auto";
|
|
112
113
|
const accessKeyId = process.env.TIGRIS_ACCESS_KEY_ID || process.env.AWS_ACCESS_KEY_ID;
|
|
113
114
|
const secretAccessKey = process.env.TIGRIS_SECRET_ACCESS_KEY || process.env.AWS_SECRET_ACCESS_KEY;
|
|
114
115
|
const endpoint = process.env.S3_ENDPOINT ||
|
|
115
|
-
(process.env.TIGRIS_BUCKET_NAME ?
|
|
116
|
+
(process.env.TIGRIS_BUCKET_NAME ? "https://fly.storage.tigris.dev" : undefined);
|
|
116
117
|
config.save = {
|
|
117
|
-
default:
|
|
118
|
+
default: "s3",
|
|
118
119
|
s3: {
|
|
119
120
|
bucket,
|
|
120
121
|
region,
|
|
121
122
|
...(endpoint && { endpoint }),
|
|
122
|
-
...(accessKeyId &&
|
|
123
|
+
...(accessKeyId &&
|
|
124
|
+
secretAccessKey && {
|
|
123
125
|
credentials: {
|
|
124
126
|
accessKeyId,
|
|
125
127
|
secretAccessKey,
|
|
@@ -131,7 +133,7 @@ function loadEnvConfig() {
|
|
|
131
133
|
// AI configuration
|
|
132
134
|
if (process.env.OPENAI_API_KEY) {
|
|
133
135
|
config.ai = {
|
|
134
|
-
default:
|
|
136
|
+
default: "openai",
|
|
135
137
|
openai: {
|
|
136
138
|
apiKey: process.env.OPENAI_API_KEY,
|
|
137
139
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,aAAa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IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACxE,CAAC"}
|
package/dist/core/errors.d.ts
CHANGED
|
@@ -1,38 +1,262 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* FloImg Error System
|
|
3
|
+
*
|
|
4
|
+
* Structured error types for better debugging and error handling.
|
|
5
|
+
* All errors include:
|
|
6
|
+
* - message: Human-readable description
|
|
7
|
+
* - code: Machine-readable error code (e.g., "TRANSFORM_ERROR")
|
|
8
|
+
* - category: Error classification for handling strategies
|
|
9
|
+
* - retryable: Whether the operation can be retried
|
|
10
|
+
*
|
|
11
|
+
* Optional context:
|
|
12
|
+
* - provider: Which provider failed (e.g., "openai", "sharp")
|
|
13
|
+
* - operation: What operation was being performed
|
|
14
|
+
* - cause: The underlying error (for error chaining)
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Error categories for classification and handling strategies.
|
|
18
|
+
*
|
|
19
|
+
* - user_input: Invalid user-provided values (bad params, missing fields)
|
|
20
|
+
* - provider_error: External API failures (rate limit, timeout, service down)
|
|
21
|
+
* - provider_config: Missing/invalid credentials or configuration
|
|
22
|
+
* - validation: Pre-execution validation failures (circular deps, missing inputs)
|
|
23
|
+
* - execution: Runtime failures during image processing
|
|
24
|
+
* - network: Connectivity issues reaching providers
|
|
25
|
+
* - internal: Unexpected internal errors (bugs)
|
|
26
|
+
*/
|
|
27
|
+
export type ErrorCategory = "user_input" | "provider_error" | "provider_config" | "validation" | "execution" | "network" | "internal";
|
|
28
|
+
/**
|
|
29
|
+
* Options for creating a FloImg error
|
|
30
|
+
*/
|
|
31
|
+
export interface FloimgErrorOptions {
|
|
32
|
+
/** Machine-readable error code */
|
|
33
|
+
code?: string;
|
|
34
|
+
/** Error category for handling strategies */
|
|
35
|
+
category?: ErrorCategory;
|
|
36
|
+
/** Whether the operation can be retried */
|
|
37
|
+
retryable?: boolean;
|
|
38
|
+
/** Which provider failed (e.g., "openai", "sharp") */
|
|
39
|
+
provider?: string;
|
|
40
|
+
/** What operation was being performed */
|
|
41
|
+
operation?: string;
|
|
42
|
+
/** The underlying error that caused this one */
|
|
43
|
+
cause?: Error;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Base error class for all floimg errors.
|
|
47
|
+
*
|
|
48
|
+
* Provides structured error information for better debugging:
|
|
49
|
+
* - Categorization for handling strategies
|
|
50
|
+
* - Retryable flag for recovery logic
|
|
51
|
+
* - Provider/operation context for debugging
|
|
52
|
+
* - Error chaining via cause
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* throw new FloimgError("Failed to process image", {
|
|
57
|
+
* code: "PROCESSING_FAILED",
|
|
58
|
+
* category: "execution",
|
|
59
|
+
* retryable: false,
|
|
60
|
+
* provider: "sharp",
|
|
61
|
+
* operation: "resize",
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
3
64
|
*/
|
|
4
65
|
export declare class FloimgError extends Error {
|
|
5
|
-
|
|
6
|
-
|
|
66
|
+
/** Machine-readable error code */
|
|
67
|
+
readonly code: string;
|
|
68
|
+
/** Error category for handling strategies */
|
|
69
|
+
readonly category: ErrorCategory;
|
|
70
|
+
/** Whether the operation can be retried */
|
|
71
|
+
readonly retryable: boolean;
|
|
72
|
+
/** Which provider failed */
|
|
73
|
+
readonly provider?: string;
|
|
74
|
+
/** What operation was being performed */
|
|
75
|
+
readonly operation?: string;
|
|
76
|
+
/** The underlying error */
|
|
77
|
+
readonly cause?: Error;
|
|
78
|
+
constructor(message: string, options?: FloimgErrorOptions | string);
|
|
79
|
+
/**
|
|
80
|
+
* Convert to a plain object for serialization
|
|
81
|
+
*/
|
|
82
|
+
toJSON(): Record<string, unknown>;
|
|
7
83
|
}
|
|
8
84
|
/**
|
|
9
|
-
* Error thrown when a provider is not found
|
|
85
|
+
* Error thrown when a provider is not found.
|
|
86
|
+
*
|
|
87
|
+
* Category: provider_config (missing provider registration)
|
|
88
|
+
* Retryable: false
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* throw new ProviderNotFoundError("save", "s3");
|
|
93
|
+
* // Message includes helpful setup instructions
|
|
94
|
+
* ```
|
|
10
95
|
*/
|
|
11
96
|
export declare class ProviderNotFoundError extends FloimgError {
|
|
12
97
|
constructor(providerType: string, providerName: string);
|
|
13
98
|
}
|
|
14
99
|
/**
|
|
15
|
-
* Error thrown when provider configuration is invalid
|
|
100
|
+
* Error thrown when provider configuration is invalid.
|
|
101
|
+
*
|
|
102
|
+
* Category: provider_config
|
|
103
|
+
* Retryable: false (requires configuration change)
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* throw new ConfigurationError("Missing API key for OpenAI", {
|
|
108
|
+
* provider: "openai",
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
16
111
|
*/
|
|
17
112
|
export declare class ConfigurationError extends FloimgError {
|
|
18
|
-
constructor(message: string);
|
|
113
|
+
constructor(message: string, options?: Omit<FloimgErrorOptions, "code" | "category">);
|
|
19
114
|
}
|
|
20
115
|
/**
|
|
21
|
-
* Error thrown when an image transformation fails
|
|
116
|
+
* Error thrown when an image transformation fails.
|
|
117
|
+
*
|
|
118
|
+
* Category: execution (runtime failure)
|
|
119
|
+
* Retryable: depends on the cause (default: false)
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* throw new TransformError("Failed to resize image: invalid dimensions", {
|
|
124
|
+
* provider: "sharp",
|
|
125
|
+
* operation: "resize",
|
|
126
|
+
* cause: originalError,
|
|
127
|
+
* });
|
|
128
|
+
* ```
|
|
22
129
|
*/
|
|
23
130
|
export declare class TransformError extends FloimgError {
|
|
24
|
-
constructor(message: string);
|
|
131
|
+
constructor(message: string, options?: Omit<FloimgErrorOptions, "code" | "category">);
|
|
25
132
|
}
|
|
26
133
|
/**
|
|
27
|
-
* Error thrown when an upload operation fails
|
|
134
|
+
* Error thrown when an upload/save operation fails.
|
|
135
|
+
*
|
|
136
|
+
* Category: execution (or network if connectivity issue)
|
|
137
|
+
* Retryable: often true for transient failures
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```typescript
|
|
141
|
+
* throw new UploadError("Failed to upload to S3: timeout", {
|
|
142
|
+
* provider: "s3",
|
|
143
|
+
* operation: "putObject",
|
|
144
|
+
* retryable: true,
|
|
145
|
+
* });
|
|
146
|
+
* ```
|
|
28
147
|
*/
|
|
29
148
|
export declare class UploadError extends FloimgError {
|
|
30
|
-
constructor(message: string);
|
|
149
|
+
constructor(message: string, options?: Omit<FloimgErrorOptions, "code">);
|
|
31
150
|
}
|
|
32
151
|
/**
|
|
33
|
-
* Error thrown when image generation fails
|
|
152
|
+
* Error thrown when image generation fails.
|
|
153
|
+
*
|
|
154
|
+
* Category: provider_error (for AI providers) or execution
|
|
155
|
+
* Retryable: depends on the cause
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```typescript
|
|
159
|
+
* throw new GenerationError("OpenAI rate limit exceeded", {
|
|
160
|
+
* provider: "openai",
|
|
161
|
+
* operation: "dall-e-3",
|
|
162
|
+
* retryable: true,
|
|
163
|
+
* cause: apiError,
|
|
164
|
+
* });
|
|
165
|
+
* ```
|
|
34
166
|
*/
|
|
35
167
|
export declare class GenerationError extends FloimgError {
|
|
36
|
-
constructor(message: string);
|
|
168
|
+
constructor(message: string, options?: Omit<FloimgErrorOptions, "code">);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Error thrown when user input validation fails.
|
|
172
|
+
*
|
|
173
|
+
* Category: user_input
|
|
174
|
+
* Retryable: false (requires user to fix input)
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```typescript
|
|
178
|
+
* throw new ValidationError("Width must be a positive number", {
|
|
179
|
+
* operation: "resize",
|
|
180
|
+
* });
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
export declare class ValidationError extends FloimgError {
|
|
184
|
+
constructor(message: string, options?: Omit<FloimgErrorOptions, "code" | "category">);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Error thrown when a network request fails.
|
|
188
|
+
*
|
|
189
|
+
* Category: network
|
|
190
|
+
* Retryable: usually true
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```typescript
|
|
194
|
+
* throw new NetworkError("Failed to connect to OpenAI API", {
|
|
195
|
+
* provider: "openai",
|
|
196
|
+
* retryable: true,
|
|
197
|
+
* cause: fetchError,
|
|
198
|
+
* });
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
export declare class NetworkError extends FloimgError {
|
|
202
|
+
constructor(message: string, options?: Omit<FloimgErrorOptions, "code" | "category">);
|
|
37
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Error thrown when an external provider returns an error.
|
|
206
|
+
*
|
|
207
|
+
* Category: provider_error
|
|
208
|
+
* Retryable: depends on error type (rate limits: yes, invalid request: no)
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```typescript
|
|
212
|
+
* throw new ProviderError("OpenAI API error: content policy violation", {
|
|
213
|
+
* provider: "openai",
|
|
214
|
+
* operation: "dall-e-3",
|
|
215
|
+
* retryable: false,
|
|
216
|
+
* });
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
export declare class ProviderError extends FloimgError {
|
|
220
|
+
constructor(message: string, options?: Omit<FloimgErrorOptions, "code" | "category">);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Error thrown when pipeline validation fails.
|
|
224
|
+
*
|
|
225
|
+
* Category: validation
|
|
226
|
+
* Retryable: false (requires workflow fix)
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```typescript
|
|
230
|
+
* throw new PipelineError("Circular dependency detected between nodes A and B");
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
export declare class PipelineError extends FloimgError {
|
|
234
|
+
constructor(message: string, options?: Omit<FloimgErrorOptions, "code" | "category">);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Check if an error is retryable
|
|
238
|
+
*/
|
|
239
|
+
export declare function isRetryable(error: unknown): boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Get the error category, defaulting to "internal" for unknown errors
|
|
242
|
+
*/
|
|
243
|
+
export declare function getErrorCategory(error: unknown): ErrorCategory;
|
|
244
|
+
/**
|
|
245
|
+
* Wrap an unknown error in a FloimgError if it isn't already one.
|
|
246
|
+
* Useful for catch blocks that need to normalize errors.
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* ```typescript
|
|
250
|
+
* try {
|
|
251
|
+
* await riskyOperation();
|
|
252
|
+
* } catch (error) {
|
|
253
|
+
* throw wrapError(error, {
|
|
254
|
+
* code: "OPERATION_FAILED",
|
|
255
|
+
* category: "execution",
|
|
256
|
+
* provider: "myProvider",
|
|
257
|
+
* });
|
|
258
|
+
* }
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
export declare function wrapError(error: unknown, options?: FloimgErrorOptions): FloimgError;
|
|
38
262
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,aAAa,GACrB,YAAY,GACZ,gBAAgB,GAChB,iBAAiB,GACjB,YAAY,GACZ,WAAW,GACX,SAAS,GACT,UAAU,CAAC;AAEf;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,kCAAkC;IAClC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