@memberjunction/ai-blackforestlabs 0.0.1 → 3.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/dist/index.d.ts +84 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +334 -0
- package/dist/index.js.map +1 -0
- package/package.json +26 -7
- package/README.md +0 -45
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { BaseImageGenerator, ImageGenerationParams, ImageGenerationResult, ImageEditParams, ImageVariationParams, ImageModelInfo } from "@memberjunction/ai";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for BFL API polling
|
|
4
|
+
*/
|
|
5
|
+
interface BFLPollingConfig {
|
|
6
|
+
/** Maximum time to wait for result in milliseconds (default: 120000 = 2 min) */
|
|
7
|
+
maxWaitTime: number;
|
|
8
|
+
/** Interval between status checks in milliseconds (default: 2000 = 2 sec) */
|
|
9
|
+
pollInterval: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Black Forest Labs FLUX Image Generator implementation.
|
|
13
|
+
* Supports FLUX.2 Pro, FLUX 1.1 Pro, and other FLUX models via the BFL API.
|
|
14
|
+
*
|
|
15
|
+
* BFL uses an async task-based API:
|
|
16
|
+
* 1. Submit generation request -> get task ID
|
|
17
|
+
* 2. Poll for result until ready
|
|
18
|
+
* 3. Retrieve generated image URL
|
|
19
|
+
*/
|
|
20
|
+
export declare class FLUXImageGenerator extends BaseImageGenerator {
|
|
21
|
+
private _baseUrl;
|
|
22
|
+
private _pollingConfig;
|
|
23
|
+
constructor(apiKey: string, baseUrl?: string);
|
|
24
|
+
/**
|
|
25
|
+
* Configure polling behavior for async task completion
|
|
26
|
+
*/
|
|
27
|
+
setPollingConfig(config: Partial<BFLPollingConfig>): void;
|
|
28
|
+
/**
|
|
29
|
+
* Generate image(s) from a text prompt using FLUX models.
|
|
30
|
+
*/
|
|
31
|
+
GenerateImage(params: ImageGenerationParams): Promise<ImageGenerationResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Edit an existing image using FLUX Fill model.
|
|
34
|
+
* BFL offers FLUX.1 Fill [pro] for inpainting/outpainting operations.
|
|
35
|
+
*/
|
|
36
|
+
EditImage(params: ImageEditParams): Promise<ImageGenerationResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Create variations of an existing image.
|
|
39
|
+
* Uses image-to-image generation with the original as a reference.
|
|
40
|
+
*/
|
|
41
|
+
CreateVariation(params: ImageVariationParams): Promise<ImageGenerationResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Get available FLUX models.
|
|
44
|
+
*/
|
|
45
|
+
GetModels(): Promise<ImageModelInfo[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Get supported methods for this provider.
|
|
48
|
+
*/
|
|
49
|
+
GetSupportedMethods(): Promise<string[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Get the API endpoint for a model.
|
|
52
|
+
*/
|
|
53
|
+
private getModelEndpoint;
|
|
54
|
+
/**
|
|
55
|
+
* Build the generation request body.
|
|
56
|
+
*/
|
|
57
|
+
private buildGenerationRequest;
|
|
58
|
+
/**
|
|
59
|
+
* Submit a task to the BFL API.
|
|
60
|
+
*/
|
|
61
|
+
private submitTask;
|
|
62
|
+
/**
|
|
63
|
+
* Poll for task completion.
|
|
64
|
+
*/
|
|
65
|
+
private waitForResult;
|
|
66
|
+
/**
|
|
67
|
+
* Download an image from URL and convert to GeneratedImage.
|
|
68
|
+
*/
|
|
69
|
+
private downloadImage;
|
|
70
|
+
/**
|
|
71
|
+
* Sleep for specified milliseconds.
|
|
72
|
+
*/
|
|
73
|
+
private sleep;
|
|
74
|
+
/**
|
|
75
|
+
* Handle errors and create error result.
|
|
76
|
+
*/
|
|
77
|
+
private handleError;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Prevents tree-shaking from removing this class.
|
|
81
|
+
*/
|
|
82
|
+
export declare function LoadFLUXImageGenerator(): void;
|
|
83
|
+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;;OAEG;IACH,OAAO,CAAC,WAAW;CAWtB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,SAErC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.LoadFLUXImageGenerator = exports.FLUXImageGenerator = void 0;
|
|
10
|
+
const global_1 = require("@memberjunction/global");
|
|
11
|
+
const ai_1 = require("@memberjunction/ai");
|
|
12
|
+
/**
|
|
13
|
+
* Black Forest Labs FLUX Image Generator implementation.
|
|
14
|
+
* Supports FLUX.2 Pro, FLUX 1.1 Pro, and other FLUX models via the BFL API.
|
|
15
|
+
*
|
|
16
|
+
* BFL uses an async task-based API:
|
|
17
|
+
* 1. Submit generation request -> get task ID
|
|
18
|
+
* 2. Poll for result until ready
|
|
19
|
+
* 3. Retrieve generated image URL
|
|
20
|
+
*/
|
|
21
|
+
let FLUXImageGenerator = class FLUXImageGenerator extends ai_1.BaseImageGenerator {
|
|
22
|
+
constructor(apiKey, baseUrl) {
|
|
23
|
+
super(apiKey);
|
|
24
|
+
this._baseUrl = 'https://api.bfl.ai/v1';
|
|
25
|
+
this._pollingConfig = {
|
|
26
|
+
maxWaitTime: 120000, // 2 minutes
|
|
27
|
+
pollInterval: 2000 // 2 seconds
|
|
28
|
+
};
|
|
29
|
+
if (baseUrl && baseUrl.length > 0) {
|
|
30
|
+
this._baseUrl = baseUrl;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Configure polling behavior for async task completion
|
|
35
|
+
*/
|
|
36
|
+
setPollingConfig(config) {
|
|
37
|
+
this._pollingConfig = { ...this._pollingConfig, ...config };
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Generate image(s) from a text prompt using FLUX models.
|
|
41
|
+
*/
|
|
42
|
+
async GenerateImage(params) {
|
|
43
|
+
const startTime = new Date();
|
|
44
|
+
try {
|
|
45
|
+
const modelEndpoint = this.getModelEndpoint(params.model || 'flux-2-pro');
|
|
46
|
+
const requestBody = this.buildGenerationRequest(params);
|
|
47
|
+
// Submit generation task
|
|
48
|
+
const taskResponse = await this.submitTask(modelEndpoint, requestBody);
|
|
49
|
+
if (!taskResponse.id) {
|
|
50
|
+
return this.createErrorResult(startTime, 'No task ID returned from BFL API');
|
|
51
|
+
}
|
|
52
|
+
// Poll for result
|
|
53
|
+
const resultResponse = await this.waitForResult(taskResponse.id);
|
|
54
|
+
if (resultResponse.status === 'Error' || resultResponse.status === 'Request Moderated' ||
|
|
55
|
+
resultResponse.status === 'Content Moderated') {
|
|
56
|
+
return this.createErrorResult(startTime, `Generation failed: ${resultResponse.status}`);
|
|
57
|
+
}
|
|
58
|
+
if (!resultResponse.result?.sample) {
|
|
59
|
+
return this.createErrorResult(startTime, 'No image URL in result');
|
|
60
|
+
}
|
|
61
|
+
// Download image and create result
|
|
62
|
+
const generatedImage = await this.downloadImage(resultResponse.result.sample, 0);
|
|
63
|
+
const result = this.createSuccessResult(startTime, [generatedImage]);
|
|
64
|
+
// Include seed if available for reproducibility in metadata
|
|
65
|
+
if (resultResponse.result.seed !== undefined) {
|
|
66
|
+
result.metadata = { seed: resultResponse.result.seed };
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
return this.handleError(error, startTime);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Edit an existing image using FLUX Fill model.
|
|
76
|
+
* BFL offers FLUX.1 Fill [pro] for inpainting/outpainting operations.
|
|
77
|
+
*/
|
|
78
|
+
async EditImage(params) {
|
|
79
|
+
const startTime = new Date();
|
|
80
|
+
try {
|
|
81
|
+
// Normalize input images
|
|
82
|
+
const imageInput = await this.normalizeImageInput(params.image);
|
|
83
|
+
const maskInput = params.mask ? await this.normalizeImageInput(params.mask) : undefined;
|
|
84
|
+
// Use FLUX Fill for editing
|
|
85
|
+
const endpoint = '/flux-pro-1.1-fill';
|
|
86
|
+
const requestBody = {
|
|
87
|
+
prompt: params.prompt,
|
|
88
|
+
image: imageInput.base64,
|
|
89
|
+
output_format: 'png'
|
|
90
|
+
};
|
|
91
|
+
if (maskInput) {
|
|
92
|
+
requestBody.mask = maskInput.base64;
|
|
93
|
+
}
|
|
94
|
+
// Submit task
|
|
95
|
+
const taskResponse = await this.submitTask(endpoint, requestBody);
|
|
96
|
+
if (!taskResponse.id) {
|
|
97
|
+
return this.createErrorResult(startTime, 'No task ID returned from BFL API');
|
|
98
|
+
}
|
|
99
|
+
// Wait for result
|
|
100
|
+
const resultResponse = await this.waitForResult(taskResponse.id);
|
|
101
|
+
if (resultResponse.status !== 'Ready' || !resultResponse.result?.sample) {
|
|
102
|
+
return this.createErrorResult(startTime, `Edit failed: ${resultResponse.status}`);
|
|
103
|
+
}
|
|
104
|
+
const generatedImage = await this.downloadImage(resultResponse.result.sample, 0);
|
|
105
|
+
return this.createSuccessResult(startTime, [generatedImage]);
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
return this.handleError(error, startTime);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Create variations of an existing image.
|
|
113
|
+
* Uses image-to-image generation with the original as a reference.
|
|
114
|
+
*/
|
|
115
|
+
async CreateVariation(params) {
|
|
116
|
+
const startTime = new Date();
|
|
117
|
+
try {
|
|
118
|
+
const imageInput = await this.normalizeImageInput(params.image);
|
|
119
|
+
// For variations, we use the Kontext model or img2img endpoint
|
|
120
|
+
const endpoint = '/flux-kontext-pro';
|
|
121
|
+
const variationPrompt = params.prompt || 'Create a variation of this image with similar style and content';
|
|
122
|
+
const requestBody = {
|
|
123
|
+
prompt: variationPrompt,
|
|
124
|
+
image: imageInput.base64,
|
|
125
|
+
output_format: 'png'
|
|
126
|
+
};
|
|
127
|
+
// Submit task
|
|
128
|
+
const taskResponse = await this.submitTask(endpoint, requestBody);
|
|
129
|
+
if (!taskResponse.id) {
|
|
130
|
+
return this.createErrorResult(startTime, 'No task ID returned from BFL API');
|
|
131
|
+
}
|
|
132
|
+
// Wait for result
|
|
133
|
+
const resultResponse = await this.waitForResult(taskResponse.id);
|
|
134
|
+
if (resultResponse.status !== 'Ready' || !resultResponse.result?.sample) {
|
|
135
|
+
return this.createErrorResult(startTime, `Variation failed: ${resultResponse.status}`);
|
|
136
|
+
}
|
|
137
|
+
const generatedImage = await this.downloadImage(resultResponse.result.sample, 0);
|
|
138
|
+
return this.createSuccessResult(startTime, [generatedImage]);
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
return this.handleError(error, startTime);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Get available FLUX models.
|
|
146
|
+
*/
|
|
147
|
+
async GetModels() {
|
|
148
|
+
return [
|
|
149
|
+
{
|
|
150
|
+
id: 'flux-2-pro',
|
|
151
|
+
name: 'FLUX.2 Pro',
|
|
152
|
+
description: 'Black Forest Labs\' most capable model. 32B parameter transformer delivering photorealistic 4MP images with exceptional detail accuracy.',
|
|
153
|
+
supportedSizes: ['1024x1024', '1024x768', '768x1024', '1536x1024', '1024x1536', '2048x2048'],
|
|
154
|
+
maxImages: 1, // BFL API generates one image per request
|
|
155
|
+
supportsEditing: true,
|
|
156
|
+
supportsVariations: true,
|
|
157
|
+
supportsNegativePrompt: false,
|
|
158
|
+
supportsSeed: true
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: 'flux-1.1-pro',
|
|
162
|
+
name: 'FLUX 1.1 Pro',
|
|
163
|
+
description: 'Production-ready model with excellent quality and fast generation. Well-suited for high-volume workloads.',
|
|
164
|
+
supportedSizes: ['1024x1024', '1024x768', '768x1024', '1536x1024', '1024x1536'],
|
|
165
|
+
maxImages: 1,
|
|
166
|
+
supportsEditing: true,
|
|
167
|
+
supportsVariations: true,
|
|
168
|
+
supportsNegativePrompt: false,
|
|
169
|
+
supportsSeed: true
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
id: 'flux-dev',
|
|
173
|
+
name: 'FLUX.1 [dev]',
|
|
174
|
+
description: 'Open-weights 12B parameter model for development and testing.',
|
|
175
|
+
supportedSizes: ['1024x1024', '1024x768', '768x1024'],
|
|
176
|
+
maxImages: 1,
|
|
177
|
+
supportsEditing: false,
|
|
178
|
+
supportsVariations: false,
|
|
179
|
+
supportsNegativePrompt: false,
|
|
180
|
+
supportsSeed: true
|
|
181
|
+
}
|
|
182
|
+
];
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Get supported methods for this provider.
|
|
186
|
+
*/
|
|
187
|
+
async GetSupportedMethods() {
|
|
188
|
+
return ['GenerateImage', 'EditImage', 'CreateVariation', 'GetModels'];
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Get the API endpoint for a model.
|
|
192
|
+
*/
|
|
193
|
+
getModelEndpoint(model) {
|
|
194
|
+
const modelEndpoints = {
|
|
195
|
+
'flux-2-pro': '/flux-pro-2',
|
|
196
|
+
'flux-1.1-pro': '/flux-pro-1.1',
|
|
197
|
+
'flux-pro': '/flux-pro',
|
|
198
|
+
'flux-dev': '/flux-dev',
|
|
199
|
+
'flux-schnell': '/flux-schnell',
|
|
200
|
+
'flux-ultra': '/flux-ultra'
|
|
201
|
+
};
|
|
202
|
+
return modelEndpoints[model.toLowerCase()] || '/flux-pro-1.1';
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Build the generation request body.
|
|
206
|
+
*/
|
|
207
|
+
buildGenerationRequest(params) {
|
|
208
|
+
const request = {
|
|
209
|
+
prompt: params.prompt,
|
|
210
|
+
output_format: 'png'
|
|
211
|
+
};
|
|
212
|
+
// Handle size/dimensions
|
|
213
|
+
if (params.size) {
|
|
214
|
+
const [width, height] = params.size.split('x').map(Number);
|
|
215
|
+
if (!isNaN(width) && !isNaN(height)) {
|
|
216
|
+
request.width = width;
|
|
217
|
+
request.height = height;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
request.width = 1024;
|
|
222
|
+
request.height = 1024;
|
|
223
|
+
}
|
|
224
|
+
// Aspect ratio (if dimensions not set)
|
|
225
|
+
if (params.aspectRatio && !params.size) {
|
|
226
|
+
request.aspect_ratio = params.aspectRatio;
|
|
227
|
+
}
|
|
228
|
+
// Seed for reproducibility
|
|
229
|
+
if (params.seed !== undefined) {
|
|
230
|
+
request.seed = params.seed;
|
|
231
|
+
}
|
|
232
|
+
// Steps (if supported by model)
|
|
233
|
+
if (params.providerOptions?.steps) {
|
|
234
|
+
request.steps = params.providerOptions.steps;
|
|
235
|
+
}
|
|
236
|
+
// Guidance scale
|
|
237
|
+
if (params.providerOptions?.guidance) {
|
|
238
|
+
request.guidance = params.providerOptions.guidance;
|
|
239
|
+
}
|
|
240
|
+
return request;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Submit a task to the BFL API.
|
|
244
|
+
*/
|
|
245
|
+
async submitTask(endpoint, body) {
|
|
246
|
+
const response = await fetch(`${this._baseUrl}${endpoint}`, {
|
|
247
|
+
method: 'POST',
|
|
248
|
+
headers: {
|
|
249
|
+
'Content-Type': 'application/json',
|
|
250
|
+
'X-Key': this.apiKey
|
|
251
|
+
},
|
|
252
|
+
body: JSON.stringify(body)
|
|
253
|
+
});
|
|
254
|
+
if (!response.ok) {
|
|
255
|
+
const errorText = await response.text();
|
|
256
|
+
throw new Error(`BFL API error (${response.status}): ${errorText}`);
|
|
257
|
+
}
|
|
258
|
+
return await response.json();
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Poll for task completion.
|
|
262
|
+
*/
|
|
263
|
+
async waitForResult(taskId) {
|
|
264
|
+
const startTime = Date.now();
|
|
265
|
+
while (Date.now() - startTime < this._pollingConfig.maxWaitTime) {
|
|
266
|
+
const response = await fetch(`${this._baseUrl}/get_result?id=${taskId}`, {
|
|
267
|
+
method: 'GET',
|
|
268
|
+
headers: {
|
|
269
|
+
'X-Key': this.apiKey
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
if (!response.ok) {
|
|
273
|
+
throw new Error(`BFL API error checking result: ${response.status}`);
|
|
274
|
+
}
|
|
275
|
+
const result = await response.json();
|
|
276
|
+
if (result.status === 'Ready' || result.status === 'Error' ||
|
|
277
|
+
result.status === 'Request Moderated' || result.status === 'Content Moderated' ||
|
|
278
|
+
result.status === 'Task not found') {
|
|
279
|
+
return result;
|
|
280
|
+
}
|
|
281
|
+
// Wait before next poll
|
|
282
|
+
await this.sleep(this._pollingConfig.pollInterval);
|
|
283
|
+
}
|
|
284
|
+
throw new Error(`Timeout waiting for result after ${this._pollingConfig.maxWaitTime}ms`);
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Download an image from URL and convert to GeneratedImage.
|
|
288
|
+
*/
|
|
289
|
+
async downloadImage(url, index) {
|
|
290
|
+
const response = await fetch(url);
|
|
291
|
+
if (!response.ok) {
|
|
292
|
+
throw new Error(`Failed to download image: ${response.status}`);
|
|
293
|
+
}
|
|
294
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
295
|
+
const buffer = Buffer.from(arrayBuffer);
|
|
296
|
+
const base64 = buffer.toString('base64');
|
|
297
|
+
const generatedImage = new ai_1.GeneratedImage();
|
|
298
|
+
generatedImage.data = buffer;
|
|
299
|
+
generatedImage.base64 = base64;
|
|
300
|
+
generatedImage.url = url;
|
|
301
|
+
generatedImage.format = 'png';
|
|
302
|
+
generatedImage.index = index;
|
|
303
|
+
return generatedImage;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Sleep for specified milliseconds.
|
|
307
|
+
*/
|
|
308
|
+
sleep(ms) {
|
|
309
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Handle errors and create error result.
|
|
313
|
+
*/
|
|
314
|
+
handleError(error, startTime) {
|
|
315
|
+
const errorInfo = ai_1.ErrorAnalyzer.analyzeError(error, 'Black Forest Labs');
|
|
316
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
317
|
+
console.error('FLUX Image Generation error:', errorMessage, errorInfo);
|
|
318
|
+
const result = this.createErrorResult(startTime, errorMessage);
|
|
319
|
+
result.errorInfo = errorInfo;
|
|
320
|
+
return result;
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
exports.FLUXImageGenerator = FLUXImageGenerator;
|
|
324
|
+
exports.FLUXImageGenerator = FLUXImageGenerator = __decorate([
|
|
325
|
+
(0, global_1.RegisterClass)(ai_1.BaseImageGenerator, 'FLUXImageGenerator')
|
|
326
|
+
], FLUXImageGenerator);
|
|
327
|
+
/**
|
|
328
|
+
* Prevents tree-shaking from removing this class.
|
|
329
|
+
*/
|
|
330
|
+
function LoadFLUXImageGenerator() {
|
|
331
|
+
// This function intentionally does nothing
|
|
332
|
+
}
|
|
333
|
+
exports.LoadFLUXImageGenerator = LoadFLUXImageGenerator;
|
|
334
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAuD;AACvD,2CAS4B;AAiC5B;;;;;;;;GAQG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,uBAAkB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C9B,cAAc,CAAC,KAAK,GAAG,KAAK,CAAC;QAE7B,OAAO,cAAc,CAAC;IAC1B,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,EAAU;QACpB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED;;OAEG;IACK,WAAW,CAAC,KAAc,EAAE,SAAe;QAC/C,MAAM,SAAS,GAAG,kBAAa,CAAC,YAAY,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;QACzE,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;QAEvF,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QAEvE,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QAC/D,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;QAE7B,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAA;AA3WY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,sBAAa,EAAC,uBAAkB,EAAE,oBAAoB,CAAC;GAC3C,kBAAkB,CA2W9B;AAED;;GAEG;AACH,SAAgB,sBAAsB;IAClC,2CAA2C;AAC/C,CAAC;AAFD,wDAEC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ai-blackforestlabs",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
]
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"description": "MemberJunction Wrapper for Black Forest Labs FLUX Image Generation Models",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"/dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "ts-node-dev src/index.ts",
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
14
|
+
},
|
|
15
|
+
"author": "MemberJunction.com",
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"ts-node-dev": "^2.0.0",
|
|
19
|
+
"typescript": "^5.4.5"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@memberjunction/ai": "3.1.0",
|
|
23
|
+
"@memberjunction/global": "3.1.0"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/MemberJunction/MJ"
|
|
28
|
+
}
|
|
10
29
|
}
|
package/README.md
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# @memberjunction/ai-blackforestlabs
|
|
2
|
-
|
|
3
|
-
## ⚠️ IMPORTANT NOTICE ⚠️
|
|
4
|
-
|
|
5
|
-
**This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
|
|
6
|
-
|
|
7
|
-
This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
|
|
8
|
-
|
|
9
|
-
## Purpose
|
|
10
|
-
|
|
11
|
-
This package exists to:
|
|
12
|
-
1. Configure OIDC trusted publishing for the package name `@memberjunction/ai-blackforestlabs`
|
|
13
|
-
2. Enable secure, token-less publishing from CI/CD workflows
|
|
14
|
-
3. Establish provenance for packages published under this name
|
|
15
|
-
|
|
16
|
-
## What is OIDC Trusted Publishing?
|
|
17
|
-
|
|
18
|
-
OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
|
|
19
|
-
|
|
20
|
-
## Setup Instructions
|
|
21
|
-
|
|
22
|
-
To properly configure OIDC trusted publishing for this package:
|
|
23
|
-
|
|
24
|
-
1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
|
|
25
|
-
2. Configure the trusted publisher (e.g., GitHub Actions)
|
|
26
|
-
3. Specify the repository and workflow that should be allowed to publish
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
28
|
-
|
|
29
|
-
## DO NOT USE THIS PACKAGE
|
|
30
|
-
|
|
31
|
-
This package is a placeholder for OIDC configuration only. It:
|
|
32
|
-
- Contains no executable code
|
|
33
|
-
- Provides no functionality
|
|
34
|
-
- Should not be installed as a dependency
|
|
35
|
-
- Exists only for administrative purposes
|
|
36
|
-
|
|
37
|
-
## More Information
|
|
38
|
-
|
|
39
|
-
For more details about npm's trusted publishing feature, see:
|
|
40
|
-
- [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
|
|
41
|
-
- [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
**Maintained for OIDC setup purposes only**
|