@sogni-ai/sogni-client 4.0.0-alpha.44 → 4.0.0-alpha.46
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/CHANGELOG.md +21 -0
- package/README.md +32 -27
- package/dist/Projects/createJobRequestMessage.d.ts +2 -1
- package/dist/Projects/createJobRequestMessage.js +27 -29
- package/dist/Projects/createJobRequestMessage.js.map +1 -1
- package/dist/Projects/index.d.ts +4 -2
- package/dist/Projects/index.js +41 -14
- package/dist/Projects/index.js.map +1 -1
- package/dist/Projects/types/ComfySamplerParams.d.ts +0 -28
- package/dist/Projects/types/ComfySamplerParams.js +0 -34
- package/dist/Projects/types/ComfySamplerParams.js.map +1 -1
- package/dist/Projects/types/ModelOptions.d.ts +31 -0
- package/dist/Projects/types/ModelOptions.js +56 -0
- package/dist/Projects/types/ModelOptions.js.map +1 -0
- package/dist/Projects/types/ModelTiersRaw.d.ts +67 -0
- package/dist/Projects/types/ModelTiersRaw.js +15 -0
- package/dist/Projects/types/ModelTiersRaw.js.map +1 -0
- package/dist/Projects/types/index.d.ts +15 -24
- package/dist/Projects/types/index.js +0 -9
- package/dist/Projects/types/index.js.map +1 -1
- package/dist/Projects/{utils.d.ts → utils/index.d.ts} +1 -1
- package/dist/Projects/{utils.js → utils/index.js} +1 -1
- package/dist/Projects/utils/index.js.map +1 -0
- package/dist/Projects/utils/samplers.d.ts +2 -0
- package/dist/Projects/{types/ForgeSamplerParams.js → utils/samplers.js} +9 -10
- package/dist/Projects/utils/samplers.js.map +1 -0
- package/dist/Projects/utils/scheduler.d.ts +2 -0
- package/dist/Projects/utils/scheduler.js +27 -0
- package/dist/Projects/utils/scheduler.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -6
- package/dist/index.js.map +1 -1
- package/dist/lib/{utils.js → utils/index.js} +1 -1
- package/dist/lib/utils/index.js.map +1 -0
- package/dist/lib/validation.d.ts +3 -14
- package/dist/lib/validation.js +23 -66
- package/dist/lib/validation.js.map +1 -1
- package/package.json +1 -1
- package/src/Projects/createJobRequestMessage.ts +43 -34
- package/src/Projects/index.ts +47 -22
- package/src/Projects/types/ComfySamplerParams.ts +0 -34
- package/src/Projects/types/ModelOptions.ts +92 -0
- package/src/Projects/types/ModelTiersRaw.ts +86 -0
- package/src/Projects/types/index.ts +17 -32
- package/src/Projects/{utils.ts → utils/index.ts} +1 -1
- package/src/Projects/{types/ForgeSamplerParams.ts → utils/samplers.ts} +9 -8
- package/src/Projects/utils/scheduler.ts +27 -0
- package/src/index.ts +1 -26
- package/src/lib/validation.ts +33 -82
- package/dist/Projects/types/ComfySchedulerParams.d.ts +0 -17
- package/dist/Projects/types/ComfySchedulerParams.js +0 -23
- package/dist/Projects/types/ComfySchedulerParams.js.map +0 -1
- package/dist/Projects/types/ForgeSamplerParams.d.ts +0 -27
- package/dist/Projects/types/ForgeSamplerParams.js.map +0 -1
- package/dist/Projects/types/ForgeSchedulerParams.d.ts +0 -17
- package/dist/Projects/types/ForgeSchedulerParams.js +0 -28
- package/dist/Projects/types/ForgeSchedulerParams.js.map +0 -1
- package/dist/Projects/utils.js.map +0 -1
- package/dist/lib/utils.js.map +0 -1
- package/src/Projects/types/ComfySchedulerParams.ts +0 -21
- package/src/Projects/types/ForgeSchedulerParams.ts +0 -26
- /package/dist/lib/{utils.d.ts → utils/index.d.ts} +0 -0
- /package/src/lib/{utils.ts → utils/index.ts} +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapImageTier = mapImageTier;
|
|
4
|
+
exports.mapComfyImageTier = mapComfyImageTier;
|
|
5
|
+
exports.mapVideoTier = mapVideoTier;
|
|
6
|
+
const samplers_1 = require("../utils/samplers");
|
|
7
|
+
const scheduler_1 = require("../utils/scheduler");
|
|
8
|
+
function mapRange(data) {
|
|
9
|
+
return {
|
|
10
|
+
min: data.min,
|
|
11
|
+
max: data.max,
|
|
12
|
+
step: data.decimals ? Math.pow(10, 0 - data.decimals) : data.step || 1,
|
|
13
|
+
default: data.default
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function mapOptions(data, mapper = (value) => value) {
|
|
17
|
+
if (!data) {
|
|
18
|
+
return {
|
|
19
|
+
allowed: [],
|
|
20
|
+
default: null
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
allowed: data.allowed.map(mapper),
|
|
25
|
+
default: data.default !== null ? mapper(data.default) : null
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function mapImageTier(tier) {
|
|
29
|
+
return {
|
|
30
|
+
type: 'image',
|
|
31
|
+
steps: mapRange(tier.steps),
|
|
32
|
+
guidance: mapRange(tier.guidance),
|
|
33
|
+
scheduler: mapOptions(tier.scheduler, scheduler_1.schedulerValueToAlias),
|
|
34
|
+
sampler: mapOptions(tier.sampler, samplers_1.samplerValueToAlias)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function mapComfyImageTier(tier) {
|
|
38
|
+
return {
|
|
39
|
+
type: 'image',
|
|
40
|
+
steps: mapRange(tier.steps),
|
|
41
|
+
guidance: mapRange(tier.guidance),
|
|
42
|
+
scheduler: mapOptions(tier.comfyScheduler, scheduler_1.schedulerValueToAlias),
|
|
43
|
+
sampler: mapOptions(tier.comfySampler, samplers_1.samplerValueToAlias)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function mapVideoTier(tier) {
|
|
47
|
+
return {
|
|
48
|
+
type: 'video',
|
|
49
|
+
steps: mapRange(tier.steps),
|
|
50
|
+
guidance: mapRange(tier.guidance),
|
|
51
|
+
scheduler: mapOptions(tier.comfyScheduler, scheduler_1.schedulerValueToAlias),
|
|
52
|
+
sampler: mapOptions(tier.comfySampler, samplers_1.samplerValueToAlias),
|
|
53
|
+
fps: tier.fps
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=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EAAE,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,8BAAmB,CAAC;KACvD,CAAC;AACJ,CAAC;AAED,SAAgB,iBAAiB,CAAC,IAAoB;IACpD,OAAO;QACL,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;QAC3B,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;QACjC,SAAS,EAAE,UAAU,CAAC,IAAI,CAAC,cAAc,EAAE,iCAAqB,CAAC;QACjE,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,YAAY,EAAE,8BAAmB,CAAC;KAC5D,CAAC;AACJ,CAAC;AAED,SAAgB,YAAY,CAAC,IAAe;IAC1C,OAAO;QACL,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;QAC3B,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;QACjC,SAAS,EAAE,UAAU,CAAC,IAAI,CAAC,cAAc,EAAE,iCAAqB,CAAC;QACjE,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,YAAY,EAAE,8BAAmB,CAAC;QAC3D,GAAG,EAAE,IAAI,CAAC,GAAG;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export type ModelTiersRaw = Record<string, ModelTier>;
|
|
2
|
+
export type ModelTier = ImageTier | VideoTier | ComfyImageTier;
|
|
3
|
+
export interface ComfyImageTier {
|
|
4
|
+
benchmark: Benchmark;
|
|
5
|
+
comfySampler: StringDefaults;
|
|
6
|
+
comfyScheduler?: StringDefaults;
|
|
7
|
+
defaultSize: number;
|
|
8
|
+
guidance: NumericDefaults;
|
|
9
|
+
steps: NumericDefaults;
|
|
10
|
+
type: 'image';
|
|
11
|
+
}
|
|
12
|
+
export declare function isComfyImageTier(t: ModelTier): t is ComfyImageTier;
|
|
13
|
+
export interface StringDefaults {
|
|
14
|
+
allowed: string[];
|
|
15
|
+
default: string;
|
|
16
|
+
}
|
|
17
|
+
export interface NumericDefaults {
|
|
18
|
+
min: number;
|
|
19
|
+
max: number;
|
|
20
|
+
decimals?: number;
|
|
21
|
+
default: number;
|
|
22
|
+
step?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ImageTier {
|
|
25
|
+
benchmark: Benchmark;
|
|
26
|
+
guidance: NumericDefaults;
|
|
27
|
+
modelFeeUSD?: number;
|
|
28
|
+
nickname?: string;
|
|
29
|
+
scheduler: StringDefaults;
|
|
30
|
+
steps: NumericDefaults;
|
|
31
|
+
sampler: StringDefaults;
|
|
32
|
+
}
|
|
33
|
+
export declare function isImageTier(t: ModelTier): t is ImageTier;
|
|
34
|
+
export interface Benchmark {
|
|
35
|
+
sec: number;
|
|
36
|
+
secContext1?: number;
|
|
37
|
+
secContext2?: number;
|
|
38
|
+
secContext3?: number;
|
|
39
|
+
secCN: number;
|
|
40
|
+
secMaxPreviews: number;
|
|
41
|
+
}
|
|
42
|
+
export interface VideoTier {
|
|
43
|
+
audioDuration?: DurationDefaults;
|
|
44
|
+
audioStart?: DurationDefaults;
|
|
45
|
+
benchmark: Benchmark;
|
|
46
|
+
comfySampler: StringDefaults;
|
|
47
|
+
comfyScheduler: StringDefaults;
|
|
48
|
+
fps: NumericOptions;
|
|
49
|
+
frames: NumericDefaults;
|
|
50
|
+
guidance: NumericDefaults;
|
|
51
|
+
height: NumericDefaults;
|
|
52
|
+
shift: NumericDefaults;
|
|
53
|
+
steps: NumericDefaults;
|
|
54
|
+
type: 'video';
|
|
55
|
+
videoStart?: DurationDefaults;
|
|
56
|
+
width: NumericDefaults;
|
|
57
|
+
}
|
|
58
|
+
export declare function isVideoTier(t: ModelTier): t is VideoTier;
|
|
59
|
+
export interface DurationDefaults {
|
|
60
|
+
min: number;
|
|
61
|
+
default: number;
|
|
62
|
+
}
|
|
63
|
+
export interface NumericOptions {
|
|
64
|
+
allowed: number[];
|
|
65
|
+
default: number;
|
|
66
|
+
}
|
|
67
|
+
export default ModelTiersRaw;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isComfyImageTier = isComfyImageTier;
|
|
4
|
+
exports.isImageTier = isImageTier;
|
|
5
|
+
exports.isVideoTier = isVideoTier;
|
|
6
|
+
function isComfyImageTier(t) {
|
|
7
|
+
return 'type' in t && t.type === 'image';
|
|
8
|
+
}
|
|
9
|
+
function isImageTier(t) {
|
|
10
|
+
return !Object.prototype.hasOwnProperty.call(t, 'type');
|
|
11
|
+
}
|
|
12
|
+
function isVideoTier(t) {
|
|
13
|
+
return 'type' in t && t.type === 'video';
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ModelTiersRaw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelTiersRaw.js","sourceRoot":"","sources":["../../../src/Projects/types/ModelTiersRaw.ts"],"names":[],"mappings":";;AAcA,4CAEC;AAyBD,kCAEC;AA4BD,kCAEC;AA3DD,SAAgB,gBAAgB,CAAC,CAAY;IAC3C,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC;AAC3C,CAAC;AAyBD,SAAgB,WAAW,CAAC,CAAY;IACtC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAC1D,CAAC;AA4BD,SAAgB,WAAW,CAAC,CAAY;IACtC,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC;AAC3C,CAAC"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { SupernetType } from '../../ApiClient/WebSocketClient/types';
|
|
2
2
|
import { ControlNetParams } from './ControlNetParams';
|
|
3
3
|
import { TokenType } from '../../types/token';
|
|
4
|
-
import { ForgeSampler, SupportedForgeSamplers } from './ForgeSamplerParams';
|
|
5
|
-
import { ForgeScheduler, SupportedForgeSchedulers } from './ForgeSchedulerParams';
|
|
6
|
-
import { ComfySampler, SupportedComfySamplers } from './ComfySamplerParams';
|
|
7
|
-
import { ComfyScheduler, SupportedComfySchedulers } from './ComfySchedulerParams';
|
|
8
4
|
export interface SupportedModel {
|
|
9
5
|
id: string;
|
|
10
6
|
name: string;
|
|
11
7
|
SID: number;
|
|
8
|
+
tier: string;
|
|
12
9
|
/**
|
|
13
10
|
* Media type produced by this model: 'image' or 'video'
|
|
14
11
|
*/
|
|
@@ -31,10 +28,6 @@ export interface SizePreset {
|
|
|
31
28
|
ratio: string;
|
|
32
29
|
aspect: string;
|
|
33
30
|
}
|
|
34
|
-
export type Sampler = ForgeSampler | ComfySampler;
|
|
35
|
-
export type Scheduler = ForgeScheduler | ComfyScheduler;
|
|
36
|
-
export type { ForgeSampler, ForgeScheduler, ComfySampler, ComfyScheduler };
|
|
37
|
-
export { SupportedForgeSamplers, SupportedForgeSchedulers, SupportedComfySamplers, SupportedComfySchedulers };
|
|
38
31
|
export type ImageOutputFormat = 'png' | 'jpg';
|
|
39
32
|
export type VideoOutputFormat = 'mp4';
|
|
40
33
|
export interface BaseProjectParams {
|
|
@@ -166,17 +159,15 @@ export interface VideoProjectParams extends BaseProjectParams {
|
|
|
166
159
|
*/
|
|
167
160
|
height?: number;
|
|
168
161
|
/**
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
* Default: euler (or uni_pc for s2v models)
|
|
162
|
+
* Sampler, available options depend on the model. Use `sogni.projects.getModelOptions(modelId)`
|
|
163
|
+
* to get the list of available samplers.
|
|
172
164
|
*/
|
|
173
|
-
sampler?:
|
|
165
|
+
sampler?: string;
|
|
174
166
|
/**
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
* Default: simple
|
|
167
|
+
* Scheduler, available options depend on the model. Use `sogni.projects.getModelOptions(modelId)`
|
|
168
|
+
* to get the list of available schedulers.
|
|
178
169
|
*/
|
|
179
|
-
scheduler?:
|
|
170
|
+
scheduler?: string;
|
|
180
171
|
/**
|
|
181
172
|
* Output video format. For now only 'mp4' is supported, defaults to 'mp4'.
|
|
182
173
|
*/
|
|
@@ -208,15 +199,15 @@ export interface ImageProjectParams extends BaseProjectParams {
|
|
|
208
199
|
*/
|
|
209
200
|
contextImages?: InputMedia[];
|
|
210
201
|
/**
|
|
211
|
-
*
|
|
212
|
-
*
|
|
202
|
+
* Sampler, available options depend on the model. Use `sogni.projects.getModelOptions(modelId)`
|
|
203
|
+
* to get the list of available samplers.
|
|
213
204
|
*/
|
|
214
|
-
sampler?:
|
|
205
|
+
sampler?: string;
|
|
215
206
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
207
|
+
* Scheduler, available options depend on the model. Use `sogni.projects.getModelOptions(modelId)`
|
|
208
|
+
* to get the list of available schedulers.
|
|
218
209
|
*/
|
|
219
|
-
scheduler?:
|
|
210
|
+
scheduler?: string;
|
|
220
211
|
/**
|
|
221
212
|
* Size preset ID to use. You can query available size presets
|
|
222
213
|
* from `sogni.projects.sizePresets(network, modelId)`
|
|
@@ -256,7 +247,7 @@ export type VideoFormat = 'mp4' | 'mov';
|
|
|
256
247
|
export type ImageUrlParams = {
|
|
257
248
|
imageId: string;
|
|
258
249
|
jobId: string;
|
|
259
|
-
type: 'preview' | 'complete' | 'startingImage' | 'cnImage' | 'contextImage1' | 'contextImage2' | 'contextImage3' | 'referenceImage' | 'referenceImageEnd';
|
|
250
|
+
type: 'preview' | 'complete' | 'startingImage' | 'cnImage' | 'contextImage1' | 'contextImage2' | 'contextImage3' | 'contextImage4' | 'contextImage5' | 'contextImage6' | 'referenceImage' | 'referenceImageEnd';
|
|
260
251
|
startContentType?: string;
|
|
261
252
|
};
|
|
262
253
|
/**
|
|
@@ -321,7 +312,7 @@ export interface EstimateRequest {
|
|
|
321
312
|
/**
|
|
322
313
|
* Sampler
|
|
323
314
|
*/
|
|
324
|
-
sampler?:
|
|
315
|
+
sampler?: string;
|
|
325
316
|
/**
|
|
326
317
|
* Number of context images to use (for Flux Kontext).
|
|
327
318
|
* Note that this parameter is ignored if `scheduler` is not provided
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SupportedComfySchedulers = exports.SupportedComfySamplers = exports.SupportedForgeSchedulers = exports.SupportedForgeSamplers = void 0;
|
|
4
3
|
exports.isVideoParams = isVideoParams;
|
|
5
4
|
exports.isImageParams = isImageParams;
|
|
6
|
-
const ForgeSamplerParams_1 = require("./ForgeSamplerParams");
|
|
7
|
-
Object.defineProperty(exports, "SupportedForgeSamplers", { enumerable: true, get: function () { return ForgeSamplerParams_1.SupportedForgeSamplers; } });
|
|
8
|
-
const ForgeSchedulerParams_1 = require("./ForgeSchedulerParams");
|
|
9
|
-
Object.defineProperty(exports, "SupportedForgeSchedulers", { enumerable: true, get: function () { return ForgeSchedulerParams_1.SupportedForgeSchedulers; } });
|
|
10
|
-
const ComfySamplerParams_1 = require("./ComfySamplerParams");
|
|
11
|
-
Object.defineProperty(exports, "SupportedComfySamplers", { enumerable: true, get: function () { return ComfySamplerParams_1.SupportedComfySamplers; } });
|
|
12
|
-
const ComfySchedulerParams_1 = require("./ComfySchedulerParams");
|
|
13
|
-
Object.defineProperty(exports, "SupportedComfySchedulers", { enumerable: true, get: function () { return ComfySchedulerParams_1.SupportedComfySchedulers; } });
|
|
14
5
|
function isVideoParams(params) {
|
|
15
6
|
return params.type === 'video';
|
|
16
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Projects/types/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Projects/types/index.ts"],"names":[],"mappings":";;AAmPA,sCAEC;AAED,sCAEC;AAND,SAAgB,aAAa,CAAC,MAAqB;IACjD,OAAO,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC;AACjC,CAAC;AAED,SAAgB,aAAa,CAAC,MAAqB;IACjD,OAAO,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC;AACjC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssetRequirement, EnhancementStrength, VideoAssetKey, VideoWorkflowType } from '
|
|
1
|
+
import { AssetRequirement, EnhancementStrength, VideoAssetKey, VideoWorkflowType } from '../types';
|
|
2
2
|
export declare function getEnhacementStrength(strength: EnhancementStrength): number;
|
|
3
3
|
/**
|
|
4
4
|
* Check if a model ID is for a video workflow.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Projects/utils/index.ts"],"names":[],"mappings":";;;AAEA,sDASC;AAOD,oCAEC;AAMD,oDAQC;AAhCD,SAAgB,qBAAqB,CAAC,QAA6B;IACjE,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,OAAO;YACV,OAAO,IAAI,CAAC;QACd,KAAK,OAAO;YACV,OAAO,IAAI,CAAC;QACd;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,OAAe;IAC1C,OAAO,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,OAAe;IAClD,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IACzD,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3C,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3C,IAAI,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC;QAAE,OAAO,cAAc,CAAC;IAC7D,IAAI,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QAAE,OAAO,iBAAiB,CAAC;IACnE,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACU,QAAA,qBAAqB,GAG9B;IACF,GAAG,EAAE;QACH,cAAc,EAAE,WAAW;QAC3B,iBAAiB,EAAE,WAAW;QAC9B,cAAc,EAAE,WAAW;QAC3B,cAAc,EAAE,WAAW;KAC5B;IACD,GAAG,EAAE;QACH,cAAc,EAAE,UAAU;QAC1B,iBAAiB,EAAE,UAAU;QAC7B,cAAc,EAAE,WAAW;QAC3B,cAAc,EAAE,WAAW;KAC5B;IACD,GAAG,EAAE;QACH,cAAc,EAAE,UAAU;QAC1B,cAAc,EAAE,UAAU;QAC1B,iBAAiB,EAAE,WAAW;QAC9B,cAAc,EAAE,WAAW;KAC5B;IACD,cAAc,EAAE;QACd,cAAc,EAAE,UAAU;QAC1B,cAAc,EAAE,UAAU;QAC1B,iBAAiB,EAAE,WAAW;QAC9B,cAAc,EAAE,WAAW;KAC5B;IACD,iBAAiB,EAAE;QACjB,cAAc,EAAE,UAAU;QAC1B,cAAc,EAAE,UAAU;QAC1B,iBAAiB,EAAE,WAAW;QAC9B,cAAc,EAAE,WAAW;KAC5B;CACF,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
|
|
6
|
-
exports.SupportedForgeSamplers = {
|
|
3
|
+
exports.samplerAliasToValue = samplerAliasToValue;
|
|
4
|
+
exports.samplerValueToAlias = samplerValueToAlias;
|
|
5
|
+
const SamplerAliases = {
|
|
7
6
|
euler: 'Euler',
|
|
8
7
|
euler_ancestral: 'Euler Ancestral',
|
|
9
8
|
heun: 'Heun',
|
|
@@ -29,11 +28,11 @@ exports.SupportedForgeSamplers = {
|
|
|
29
28
|
euler_a: 'Euler a',
|
|
30
29
|
pndm_plms: 'PNDM (Pseudo-linear multi-step)'
|
|
31
30
|
};
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const SamplerValueToAlias = Object.fromEntries(Object.entries(SamplerAliases).map(([k, v]) => [v, k]));
|
|
32
|
+
function samplerAliasToValue(alias) {
|
|
33
|
+
return SamplerAliases[alias] || alias;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
return samplers.includes(sampler);
|
|
35
|
+
function samplerValueToAlias(value) {
|
|
36
|
+
return SamplerValueToAlias[value] || value;
|
|
38
37
|
}
|
|
39
|
-
//# sourceMappingURL=
|
|
38
|
+
//# sourceMappingURL=samplers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"samplers.js","sourceRoot":"","sources":["../../../src/Projects/utils/samplers.ts"],"names":[],"mappings":";;AA+BA,kDAEC;AAED,kDAEC;AArCD,MAAM,cAAc,GAA2B;IAC7C,KAAK,EAAE,OAAO;IACd,eAAe,EAAE,iBAAiB;IAClC,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,cAAc;IAC5B,SAAS,EAAE,WAAW;IACtB,YAAY,EAAE,cAAc;IAC5B,MAAM,EAAE,OAAO;IACf,GAAG,EAAE,gCAAgC;IACrC,kCAAkC;IAClC,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,eAAe,EAAE,iBAAiB;IAClC,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,cAAc;IAC5B,kBAAkB,EAAE,oBAAoB;IACxC,IAAI,EAAE,MAAM;IACZ,4BAA4B;IAC5B,OAAO,EAAE,+BAA+B;IACxC,MAAM,EAAE,qCAAqC;IAC7C,UAAU,EAAE,WAAW;IACvB,SAAS,EAAE,UAAU;IACrB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,iCAAiC;CAC7C,CAAC;AAEF,MAAM,mBAAmB,GAAG,MAAM,CAAC,WAAW,CAC5C,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CACvD,CAAC;AAEF,SAAgB,mBAAmB,CAAC,KAAa;IAC/C,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;AACxC,CAAC;AAED,SAAgB,mBAAmB,CAAC,KAAa;IAC/C,OAAO,mBAAmB,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schedulerAliasToValue = schedulerAliasToValue;
|
|
4
|
+
exports.schedulerValueToAlias = schedulerValueToAlias;
|
|
5
|
+
const SchedulerAliases = {
|
|
6
|
+
simple: 'Simple',
|
|
7
|
+
normal: 'Normal',
|
|
8
|
+
karras: 'Karras',
|
|
9
|
+
exponential: 'Exponential',
|
|
10
|
+
sgm_uniform: 'SGM Uniform',
|
|
11
|
+
ddim_uniform: 'DDIM Uniform',
|
|
12
|
+
beta: 'Beta',
|
|
13
|
+
linear_quadratic: 'Linear Quadratic',
|
|
14
|
+
kl_optimal: 'KL Optimal',
|
|
15
|
+
// Legacy aliases
|
|
16
|
+
ddim: 'DDIM',
|
|
17
|
+
leading: 'Leading',
|
|
18
|
+
linear: 'Linear'
|
|
19
|
+
};
|
|
20
|
+
const SchedulerValueToAlias = Object.fromEntries(Object.entries(SchedulerAliases).map(([k, v]) => [v, k]));
|
|
21
|
+
function schedulerAliasToValue(alias) {
|
|
22
|
+
return SchedulerAliases[alias] || alias;
|
|
23
|
+
}
|
|
24
|
+
function schedulerValueToAlias(value) {
|
|
25
|
+
return SchedulerValueToAlias[value] || value;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=scheduler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.js","sourceRoot":"","sources":["../../../src/Projects/utils/scheduler.ts"],"names":[],"mappings":";;AAoBA,sDAEC;AAED,sDAEC;AA1BD,MAAM,gBAAgB,GAA2B;IAC/C,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,cAAc;IAC5B,IAAI,EAAE,MAAM;IACZ,gBAAgB,EAAE,kBAAkB;IACpC,UAAU,EAAE,YAAY;IACxB,iBAAiB;IACjB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;CACjB,CAAC;AAEF,MAAM,qBAAqB,GAAG,MAAM,CAAC,WAAW,CAC9C,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CACzD,CAAC;AAEF,SAAgB,qBAAqB,CAAC,KAAa;IACjD,OAAO,gBAAgB,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;AAC1C,CAAC;AAED,SAAgB,qBAAqB,CAAC,KAAa;IACjD,OAAO,qBAAqB,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;AAC/C,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,13 +6,13 @@ import { Logger, LogLevel } from './lib/DefaultLogger';
|
|
|
6
6
|
import ProjectsApi from './Projects';
|
|
7
7
|
import Job, { JobStatus } from './Projects/Job';
|
|
8
8
|
import Project, { ProjectStatus } from './Projects/Project';
|
|
9
|
-
import { AvailableModel, ImageProjectParams, ImageOutputFormat, ProjectParams,
|
|
9
|
+
import { AvailableModel, ImageProjectParams, ImageOutputFormat, ProjectParams, VideoProjectParams, AudioFormat, VideoFormat, VideoOutputFormat, VideoWorkflowType } from './Projects/types';
|
|
10
10
|
import StatsApi from './Stats';
|
|
11
11
|
import ErrorData from './types/ErrorData';
|
|
12
12
|
import { TokenType } from './types/token';
|
|
13
13
|
import { TokenAuthData } from './lib/AuthManager';
|
|
14
|
-
export type { AudioFormat, AvailableModel, ErrorData, ImageProjectParams, ImageOutputFormat, JobStatus, Logger, LogLevel, ProjectParams, ProjectStatus,
|
|
15
|
-
export { ApiError, CurrentAccount, Job, Project
|
|
14
|
+
export type { AudioFormat, AvailableModel, ErrorData, ImageProjectParams, ImageOutputFormat, JobStatus, Logger, LogLevel, ProjectParams, ProjectStatus, SupernetType, TokenType, VideoFormat, VideoOutputFormat, VideoProjectParams, VideoWorkflowType };
|
|
15
|
+
export { ApiError, CurrentAccount, Job, Project };
|
|
16
16
|
export interface SogniClientConfig {
|
|
17
17
|
/**
|
|
18
18
|
* The application ID string. Must be unique, multiple connections with the same ID will be rejected.
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.SogniClient = exports.
|
|
38
|
+
exports.SogniClient = exports.Project = exports.Job = exports.CurrentAccount = exports.ApiError = void 0;
|
|
39
39
|
// Account API
|
|
40
40
|
const Account_1 = __importDefault(require("./Account"));
|
|
41
41
|
const CurrentAccount_1 = __importDefault(require("./Account/CurrentAccount"));
|
|
@@ -52,11 +52,6 @@ const Job_1 = __importDefault(require("./Projects/Job"));
|
|
|
52
52
|
exports.Job = Job_1.default;
|
|
53
53
|
const Project_1 = __importDefault(require("./Projects/Project"));
|
|
54
54
|
exports.Project = Project_1.default;
|
|
55
|
-
const types_1 = require("./Projects/types");
|
|
56
|
-
Object.defineProperty(exports, "SupportedForgeSamplers", { enumerable: true, get: function () { return types_1.SupportedForgeSamplers; } });
|
|
57
|
-
Object.defineProperty(exports, "SupportedForgeSchedulers", { enumerable: true, get: function () { return types_1.SupportedForgeSchedulers; } });
|
|
58
|
-
Object.defineProperty(exports, "SupportedComfySamplers", { enumerable: true, get: function () { return types_1.SupportedComfySamplers; } });
|
|
59
|
-
Object.defineProperty(exports, "SupportedComfySchedulers", { enumerable: true, get: function () { return types_1.SupportedComfySchedulers; } });
|
|
60
55
|
// Stats API
|
|
61
56
|
const Stats_1 = __importDefault(require("./Stats"));
|
|
62
57
|
const AuthManager_1 = require("./lib/AuthManager");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,wDAAmC;AACnC,8EAAsD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,wDAAmC;AACnC,8EAAsD;AAkDnC,yBAlDZ,wBAAc,CAkDY;AAjDjC,YAAY;AACZ,yDAA+D;AAgDtD,yFAhDW,oBAAQ,OAgDX;AA7CjB,QAAQ;AACR,uDAAsE;AACtE,sEAA8C;AAC9C,eAAe;AACf,0DAAqC;AACrC,yDAAgD;AAwCb,cAxC5B,aAAG,CAwC4B;AAvCtC,iEAA4D;AAuCpB,kBAvCjC,iBAAO,CAuCiC;AA3B/C,YAAY;AACZ,oDAA+B;AAI/B,mDAAuF;AAmFvF,MAAa,WAAW;IAOtB,YAAoB,MAAiB;QACnC,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAU,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,IAAI,kBAAW,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,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0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,kCAMC;AAED,gDAMC;AAED,sBAEC;AApBD,2CAAuC;AAEvC,SAAgB,WAAW,CAAC,KAAa;IACvC,MAAM,IAAI,GAAG,IAAA,sBAAS,EAA0D,KAAK,CAAC,CAAC;IACvF,OAAO;QACL,aAAa,EAAE,IAAI,CAAC,IAAI;QACxB,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;KACrC,CAAC;AACJ,CAAC;AAED,SAAgB,kBAAkB,CAAC,KAAa;IAC9C,MAAM,IAAI,GAAG,IAAA,sBAAS,EAA0D,KAAK,CAAC,CAAC;IACvF,OAAO;QACL,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;KACrC,CAAC;AACJ,CAAC;AAED,SAAsB,KAAK,CAAC,EAAU;;QACpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;CAAA"}
|
package/dist/lib/validation.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ModelOptions } from '../Projects/types/ModelOptions';
|
|
1
2
|
export declare function validateCustomImageSize(value: any): number;
|
|
2
3
|
/**
|
|
3
4
|
* Validate video dimensions for Wan 2.2 models.
|
|
@@ -12,24 +13,12 @@ interface NumberValidationOptions {
|
|
|
12
13
|
defaultValue?: number;
|
|
13
14
|
}
|
|
14
15
|
export declare function validateNumber(value: any, { min, max, propertyName, defaultValue }?: NumberValidationOptions): number;
|
|
15
|
-
export declare function validateForgeSampler(value?: string): string | null;
|
|
16
|
-
export declare function validateForgeScheduler(value?: string): string | null;
|
|
17
16
|
/**
|
|
18
17
|
* Validate teacacheThreshold for T2V and I2V models.
|
|
19
18
|
* Range: 0.0-1.0. 0.0 = disabled.
|
|
20
19
|
*/
|
|
21
20
|
export declare function validateTeacacheThreshold(value?: number): number | undefined;
|
|
22
|
-
/**
|
|
23
|
-
* Validate ComfyUI sampler for video models.
|
|
24
|
-
* Returns the sampler string directly (no mapping needed).
|
|
25
|
-
*/
|
|
26
|
-
export declare function validateComfySampler(value?: string): string | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* Validate ComfyUI scheduler for video models.
|
|
29
|
-
* Returns the scheduler string directly (no mapping needed).
|
|
30
|
-
*/
|
|
31
|
-
export declare function validateComfyScheduler(value?: string): string | undefined;
|
|
32
21
|
export declare function isComfyModel(modelId: string): boolean;
|
|
33
|
-
export declare function validateSampler(
|
|
34
|
-
export declare function validateScheduler(
|
|
22
|
+
export declare function validateSampler(value: string | undefined, options: ModelOptions): string | null;
|
|
23
|
+
export declare function validateScheduler(value: string | undefined, options: ModelOptions): string | null;
|
|
35
24
|
export {};
|
package/dist/lib/validation.js
CHANGED
|
@@ -4,18 +4,13 @@ exports.validateCustomImageSize = validateCustomImageSize;
|
|
|
4
4
|
exports.validateVideoSize = validateVideoSize;
|
|
5
5
|
exports.validateVideoDuration = validateVideoDuration;
|
|
6
6
|
exports.validateNumber = validateNumber;
|
|
7
|
-
exports.validateForgeSampler = validateForgeSampler;
|
|
8
|
-
exports.validateForgeScheduler = validateForgeScheduler;
|
|
9
7
|
exports.validateTeacacheThreshold = validateTeacacheThreshold;
|
|
10
|
-
exports.validateComfySampler = validateComfySampler;
|
|
11
|
-
exports.validateComfyScheduler = validateComfyScheduler;
|
|
12
8
|
exports.isComfyModel = isComfyModel;
|
|
13
9
|
exports.validateSampler = validateSampler;
|
|
14
10
|
exports.validateScheduler = validateScheduler;
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const ComfySchedulerParams_1 = require("../Projects/types/ComfySchedulerParams");
|
|
11
|
+
const ApiClient_1 = require("../ApiClient");
|
|
12
|
+
const scheduler_1 = require("../Projects/utils/scheduler");
|
|
13
|
+
const samplers_1 = require("../Projects/utils/samplers");
|
|
19
14
|
function validateCustomImageSize(value) {
|
|
20
15
|
return validateNumber(value, { min: 256, max: 2048, propertyName: 'Width and height' });
|
|
21
16
|
}
|
|
@@ -55,30 +50,6 @@ function validateNumber(value, { min, max, propertyName, defaultValue } = {}) {
|
|
|
55
50
|
}
|
|
56
51
|
return number;
|
|
57
52
|
}
|
|
58
|
-
function validateForgeSampler(value) {
|
|
59
|
-
if (!value) {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
if ((0, ForgeSamplerParams_1.isRawForgeSampler)(value)) {
|
|
63
|
-
return value;
|
|
64
|
-
}
|
|
65
|
-
if ((0, ForgeSamplerParams_1.isForgeSampler)(value)) {
|
|
66
|
-
return ForgeSamplerParams_1.SupportedForgeSamplers[value];
|
|
67
|
-
}
|
|
68
|
-
throw new Error(`Invalid sampler: ${value}. Supported options: ${Object.keys(ForgeSamplerParams_1.SupportedForgeSamplers).join(', ')}`);
|
|
69
|
-
}
|
|
70
|
-
function validateForgeScheduler(value) {
|
|
71
|
-
if (!value) {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
if ((0, ForgeSchedulerParams_1.isRawForgeScheduler)(value)) {
|
|
75
|
-
return value;
|
|
76
|
-
}
|
|
77
|
-
if ((0, ForgeSchedulerParams_1.isForgeScheduler)(value)) {
|
|
78
|
-
return ForgeSchedulerParams_1.SupportedForgeSchedulers[value];
|
|
79
|
-
}
|
|
80
|
-
throw new Error(`Invalid scheduler: ${value}. Supported options: ${Object.keys(ForgeSchedulerParams_1.SupportedForgeSchedulers).join(', ')}`);
|
|
81
|
-
}
|
|
82
53
|
/**
|
|
83
54
|
* Validate teacacheThreshold for T2V and I2V models.
|
|
84
55
|
* Range: 0.0-1.0. 0.0 = disabled.
|
|
@@ -96,46 +67,32 @@ function validateTeacacheThreshold(value) {
|
|
|
96
67
|
}
|
|
97
68
|
return num;
|
|
98
69
|
}
|
|
99
|
-
/**
|
|
100
|
-
* Validate ComfyUI sampler for video models.
|
|
101
|
-
* Returns the sampler string directly (no mapping needed).
|
|
102
|
-
*/
|
|
103
|
-
function validateComfySampler(value) {
|
|
104
|
-
if (!value) {
|
|
105
|
-
return undefined;
|
|
106
|
-
}
|
|
107
|
-
if ((0, ComfySamplerParams_1.isComfySampler)(value)) {
|
|
108
|
-
return ComfySamplerParams_1.SupportedComfySamplers[value];
|
|
109
|
-
}
|
|
110
|
-
throw new Error(`Invalid comfySampler: ${value}. Supported options: ${Object.keys(ComfySamplerParams_1.SupportedComfySamplers).join(', ')}`);
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Validate ComfyUI scheduler for video models.
|
|
114
|
-
* Returns the scheduler string directly (no mapping needed).
|
|
115
|
-
*/
|
|
116
|
-
function validateComfyScheduler(value) {
|
|
117
|
-
if (!value) {
|
|
118
|
-
return undefined;
|
|
119
|
-
}
|
|
120
|
-
if ((0, ComfySchedulerParams_1.isComfyScheduler)(value)) {
|
|
121
|
-
return ComfySchedulerParams_1.SupportedComfySchedulers[value];
|
|
122
|
-
}
|
|
123
|
-
throw new Error(`Invalid comfyScheduler: ${value}. Supported options: ${Object.keys(ComfySchedulerParams_1.SupportedComfySchedulers).join(', ')}`);
|
|
124
|
-
}
|
|
125
70
|
function isComfyModel(modelId) {
|
|
126
71
|
const COMFY_PREFIXES = ['z_image_', 'qwen_image_', 'flux2_', 'wan_'];
|
|
127
72
|
return COMFY_PREFIXES.some((prefix) => modelId.startsWith(prefix));
|
|
128
73
|
}
|
|
129
|
-
function
|
|
130
|
-
if (
|
|
131
|
-
|
|
74
|
+
function validateOption(value, options, errorMessage) {
|
|
75
|
+
if (!options.includes(value)) {
|
|
76
|
+
throw new ApiClient_1.ApiError(400, {
|
|
77
|
+
status: 'error',
|
|
78
|
+
errorCode: 0,
|
|
79
|
+
message: errorMessage
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return value;
|
|
83
|
+
}
|
|
84
|
+
function validateSampler(value, options) {
|
|
85
|
+
if (!options.sampler.allowed.length || !value) {
|
|
86
|
+
return null;
|
|
132
87
|
}
|
|
133
|
-
|
|
88
|
+
const option = validateOption(value, options.sampler.allowed, `Invalid sampler ${value}. Must be one of "${options.sampler.allowed.join('", "')}".`);
|
|
89
|
+
return (0, samplers_1.samplerAliasToValue)(option);
|
|
134
90
|
}
|
|
135
|
-
function validateScheduler(
|
|
136
|
-
if (
|
|
137
|
-
return
|
|
91
|
+
function validateScheduler(value, options) {
|
|
92
|
+
if (!options.scheduler.allowed.length || !value) {
|
|
93
|
+
return null;
|
|
138
94
|
}
|
|
139
|
-
|
|
95
|
+
const option = validateOption(value, options.scheduler.allowed, `Invalid scheduler ${value}. Must be one of "${options.scheduler.allowed.join('", "')}".`);
|
|
96
|
+
return (0, scheduler_1.schedulerAliasToValue)(option);
|
|
140
97
|
}
|
|
141
98
|
//# sourceMappingURL=validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/lib/validation.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/lib/validation.ts"],"names":[],"mappings":";;AAKA,0DAEC;AAMD,8CAEC;AAED,sDAEC;AASD,wCA4BC;AAMD,8DAYC;AAED,oCAGC;AAaD,0CAUC;AAED,8CAUC;AAlHD,4CAAwC;AAExC,2DAAoE;AACpE,yDAAiE;AAEjE,SAAgB,uBAAuB,CAAC,KAAU;IAChD,OAAO,cAAc,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,kBAAkB,EAAE,CAAC,CAAC;AAC1F,CAAC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,KAAU,EAAE,YAAgC;IAC5E,OAAO,cAAc,CAAC,KAAK,EAA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