@shop-os/modelkit 0.3.0 → 0.3.1
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 +12 -0
- package/README.md +3 -3
- package/dist/catalog.cjs +26 -5
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.js +26 -5
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +136 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +136 -123
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/catalog.js
CHANGED
|
@@ -2253,6 +2253,10 @@ var ALL_KEY_SET = /* @__PURE__ */ new Set([
|
|
|
2253
2253
|
...IMAGE_INPUT_SPEC_KEYS,
|
|
2254
2254
|
...AUDIO_INPUT_SPEC_KEYS
|
|
2255
2255
|
]);
|
|
2256
|
+
var TYPES_BY_ADAPTER = /* @__PURE__ */ new Map([
|
|
2257
|
+
["replicate", ["video", "image", "audio"]],
|
|
2258
|
+
["fal", ["image"]]
|
|
2259
|
+
]);
|
|
2256
2260
|
var ALLOWED_KEYS_BY_TYPE = /* @__PURE__ */ new Map([
|
|
2257
2261
|
["video", VIDEO_KEY_SET],
|
|
2258
2262
|
["image", IMAGE_KEY_SET],
|
|
@@ -2291,7 +2295,8 @@ var StaticSchema = z2.record(z2.string(), ProviderScalarSchema);
|
|
|
2291
2295
|
var InputSpecSchema = z2.strictObject({
|
|
2292
2296
|
fields: FieldsSchema,
|
|
2293
2297
|
values: ValuesSchema.optional(),
|
|
2294
|
-
static: StaticSchema.optional()
|
|
2298
|
+
static: StaticSchema.optional(),
|
|
2299
|
+
editEndpoint: z2.string().min(1).optional()
|
|
2295
2300
|
}).superRefine((spec, ctx) => {
|
|
2296
2301
|
const mappedNames = new Set(Object.values(spec.fields));
|
|
2297
2302
|
for (const key of Object.keys(spec.static ?? {})) {
|
|
@@ -2316,18 +2321,21 @@ function validateInputSpec(raw, row) {
|
|
|
2316
2321
|
};
|
|
2317
2322
|
}
|
|
2318
2323
|
const spec = parsed.data;
|
|
2319
|
-
|
|
2324
|
+
const supportedTypes = TYPES_BY_ADAPTER.get(row.adapter);
|
|
2325
|
+
if (supportedTypes === void 0) {
|
|
2320
2326
|
return {
|
|
2321
2327
|
ok: false,
|
|
2322
|
-
issues: [
|
|
2328
|
+
issues: [
|
|
2329
|
+
{ path: [], message: "inputSpec is only supported on replicate and fal rows" }
|
|
2330
|
+
]
|
|
2323
2331
|
};
|
|
2324
2332
|
}
|
|
2325
2333
|
const issues = [];
|
|
2326
2334
|
const allowed = ALLOWED_KEYS_BY_TYPE.get(row.type);
|
|
2327
|
-
if (allowed === void 0) {
|
|
2335
|
+
if (allowed === void 0 || !supportedTypes.includes(row.type)) {
|
|
2328
2336
|
issues.push({
|
|
2329
2337
|
path: [],
|
|
2330
|
-
message: `inputSpec is not supported for "${row.type}" rows`
|
|
2338
|
+
message: row.adapter === "fal" ? `inputSpec on fal rows is only supported for image rows, not "${row.type}"` : `inputSpec is not supported for "${row.type}" rows`
|
|
2331
2339
|
});
|
|
2332
2340
|
} else {
|
|
2333
2341
|
for (const key of Object.keys(spec.fields)) {
|
|
@@ -2347,6 +2355,19 @@ function validateInputSpec(raw, row) {
|
|
|
2347
2355
|
}
|
|
2348
2356
|
}
|
|
2349
2357
|
}
|
|
2358
|
+
if (spec.editEndpoint !== void 0) {
|
|
2359
|
+
if (row.adapter !== "fal") {
|
|
2360
|
+
issues.push({
|
|
2361
|
+
path: ["editEndpoint"],
|
|
2362
|
+
message: "inputSpec.editEndpoint is only supported on fal rows"
|
|
2363
|
+
});
|
|
2364
|
+
} else if (!("references" in spec.fields)) {
|
|
2365
|
+
issues.push({
|
|
2366
|
+
path: ["editEndpoint"],
|
|
2367
|
+
message: 'inputSpec.editEndpoint needs a "references" entry in inputSpec.fields'
|
|
2368
|
+
});
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2350
2371
|
const seenNames = /* @__PURE__ */ new Map();
|
|
2351
2372
|
for (const [key, name] of Object.entries(spec.fields)) {
|
|
2352
2373
|
const first = seenNames.get(name);
|