@civitai/orchestration-client 0.2.1 → 0.2.3

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.
@@ -123,7 +123,7 @@ export const FileFormat = {
123
123
  ONNX: 'onnx',
124
124
  TAR: 'tar',
125
125
  };
126
- export const GeminiOmniModel = { '1_1_FLASH': '1.1-flash' };
126
+ export const GeminiOmniModel = { '1_1_FLASH': '1.1-flash', '1_2_FLASH': '1.2-flash' };
127
127
  export const GeminiOmniResolution = {
128
128
  '360P': '360p',
129
129
  '720P': '720p',
@@ -163,6 +163,8 @@ export const ImageGenOutputFormat = {
163
163
  JPEG: 'jpeg',
164
164
  PNG: 'png',
165
165
  WEB_P: 'webP',
166
+ GIF: 'gif',
167
+ SVG: 'svg',
166
168
  };
167
169
  export const ImageResouceTrainingModerationStatus = {
168
170
  EVALUATING: 'evaluating',
@@ -306,6 +308,8 @@ export const ModelClamScanStatus = {
306
308
  INFECTED: 'infected',
307
309
  TIMEOUT: 'timeout',
308
310
  ERROR: 'error',
311
+ ENCRYPTED: 'encrypted',
312
+ LIMITS_EXCEEDED: 'limitsExceeded',
309
313
  };
310
314
  export const ModelPickleScanStatus = {
311
315
  CLEAN: 'clean',
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './generated/index.js';
2
+ export * from './generated/services.gen.js';
2
3
  export * from './utils/index.js';
3
4
  export * from './client/CivitaiClient.js';
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './generated/index.js';
2
+ export * from './generated/services.gen.js';
2
3
  export * from './utils/index.js';
3
4
  export * from './client/CivitaiClient.js';
@@ -2,3 +2,4 @@ export * from './Air.js';
2
2
  export * from './TimeSpan.js';
3
3
  export * from './patch-json.js';
4
4
  export * from './handleError.js';
5
+ export * from './services.js';
@@ -2,3 +2,4 @@ export * from './Air.js';
2
2
  export * from './TimeSpan.js';
3
3
  export * from './patch-json.js';
4
4
  export * from './handleError.js';
5
+ export * from './services.js';
@@ -0,0 +1,31 @@
1
+ import {
2
+ type ServiceCategory,
3
+ type ServiceHosting,
4
+ type ServiceName,
5
+ } from '../generated/services.gen.js';
6
+ export type ServiceInfo = {
7
+ name: ServiceName;
8
+ category: ServiceCategory;
9
+ hosting: ServiceHosting;
10
+ /** WorkflowStep `$type` this input is used with. */
11
+ stepType?: string;
12
+ /** Discriminator values on the input that select this schema (e.g. engine/model/operation). */
13
+ discriminators: Readonly<Record<string, string>>;
14
+ };
15
+ type StepLike = {
16
+ $type?: string;
17
+ input?: unknown;
18
+ };
19
+ /**
20
+ * Resolves the service (category + hosting) a workflow step will run on, based on its
21
+ * `$type` and the discriminator values in its input (engine, model, operation, ...).
22
+ * Returns the most specific match, or undefined when the step isn't in the catalog.
23
+ *
24
+ * @example
25
+ * getServiceInfo({ $type: 'imageGen', input: { engine: 'flux2', model: 'pro', operation: 'createImage' } })
26
+ * // => { name: 'Flux2ProCreateImageInput', category: 'image', hosting: 'partner', ... }
27
+ */
28
+ export declare function getServiceInfo(step: StepLike): ServiceInfo | undefined;
29
+ export declare function getServiceHosting(step: StepLike): ServiceHosting | undefined;
30
+ export declare function isPartnerService(step: StepLike): boolean;
31
+ export {};
@@ -0,0 +1,36 @@
1
+ import { services, } from '../generated/services.gen.js';
2
+ /**
3
+ * Resolves the service (category + hosting) a workflow step will run on, based on its
4
+ * `$type` and the discriminator values in its input (engine, model, operation, ...).
5
+ * Returns the most specific match, or undefined when the step isn't in the catalog.
6
+ *
7
+ * @example
8
+ * getServiceInfo({ $type: 'imageGen', input: { engine: 'flux2', model: 'pro', operation: 'createImage' } })
9
+ * // => { name: 'Flux2ProCreateImageInput', category: 'image', hosting: 'partner', ... }
10
+ */
11
+ export function getServiceInfo(step) {
12
+ var _a;
13
+ if (!step.$type)
14
+ return undefined;
15
+ const input = ((_a = step.input) !== null && _a !== void 0 ? _a : {});
16
+ let best;
17
+ for (const [name, entry] of Object.entries(services)) {
18
+ const [category, hosting, stepType, discriminators = {}] = entry;
19
+ if (stepType !== step.$type)
20
+ continue;
21
+ const pairs = Object.entries(discriminators);
22
+ if (!pairs.every(([key, value]) => input[key] === value))
23
+ continue;
24
+ if (!best || pairs.length > Object.keys(best.discriminators).length) {
25
+ best = { name, category, hosting, stepType, discriminators };
26
+ }
27
+ }
28
+ return best;
29
+ }
30
+ export function getServiceHosting(step) {
31
+ var _a;
32
+ return (_a = getServiceInfo(step)) === null || _a === void 0 ? void 0 : _a.hosting;
33
+ }
34
+ export function isPartnerService(step) {
35
+ return getServiceHosting(step) === 'partner';
36
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@civitai/orchestration-client",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Civitai's javascript client for generating ai content",
5
5
  "packageManager": "pnpm@10.34.4",
6
6
  "main": "dist/index.js",
@@ -25,7 +25,7 @@
25
25
  "yarn": ">=1.7.0"
26
26
  },
27
27
  "scripts": {
28
- "generate": "openapi-ts && node scripts/fix-discriminators.mjs",
28
+ "generate": "openapi-ts && node scripts/fix-discriminators.mjs && node scripts/generate-services.mjs",
29
29
  "build": "tsc && eslint --fix dist",
30
30
  "test": "jest",
31
31
  "prepublishOnly": "pnpm test && pnpm build",