any2orca 0.9.1 → 0.10.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.
@@ -18,6 +18,7 @@
18
18
  import "../zodSetup.js";
19
19
  import { z } from "zod";
20
20
  import { labelOf } from "../diff/diffSettings.js";
21
+ import { settingLimits } from "../diff/settingLimits.js";
21
22
  import { SETTINGS_CATALOG } from "../diff/settingsCatalog.js";
22
23
  import { machineLimitFor } from "../engine/aboveStock.js";
23
24
  import { VARIANT_PROCESS_KEYS } from "../engine/applyHighFlowHotends.js";
@@ -37,8 +38,9 @@ const FORBIDDEN_KEYS = new Set(["__proto__", "constructor", "prototype"]);
37
38
  /** Text shown to people: no control characters and no line breaks. */
38
39
  const plainLine = (s) => !UNSAFE_TEXT.test(s) && !/[\n\t]/.test(s);
39
40
  /** Checks one entry against the setting's type and limits; returns why it's invalid, or null. */
40
- function entryProblem(key, entry) {
41
+ function entryProblem(key, entry, release) {
41
42
  const info = SETTINGS_CATALOG[key];
43
+ const limits = settingLimits(key, release) ?? info;
42
44
  if (entry === "nil")
43
45
  return "has no value";
44
46
  if (entry.length > MAX_VALUE_LENGTH || UNSAFE_TEXT.test(entry))
@@ -49,10 +51,10 @@ function entryProblem(key, entry) {
49
51
  if (!NUMBER.test(text))
50
52
  return `isn't a number ("${entry}")`;
51
53
  const n = Number(text);
52
- if (info.min !== null && n < info.min)
53
- return `is below Snapmaker Orca's minimum of ${info.min} ("${entry}")`;
54
- if (info.max !== null && n > info.max)
55
- return `is above Snapmaker Orca's maximum of ${info.max} ("${entry}")`;
54
+ if (limits.min !== null && n < limits.min)
55
+ return `is below Snapmaker Orca's minimum of ${limits.min} ("${entry}")`;
56
+ if (limits.max !== null && n > limits.max)
57
+ return `is above Snapmaker Orca's maximum of ${limits.max} ("${entry}")`;
56
58
  return null;
57
59
  };
58
60
  switch (type) {
@@ -66,8 +68,8 @@ function entryProblem(key, entry) {
66
68
  case "coFloatOrPercent":
67
69
  return numeric(true);
68
70
  case "coEnum":
69
- if (info.choices)
70
- return info.choices.includes(entry) ? null : `isn't one of Snapmaker Orca's choices ("${entry}")`;
71
+ if (limits.choices)
72
+ return limits.choices.includes(entry) ? null : `isn't one of Snapmaker Orca's choices ("${entry}")`;
71
73
  return /^[A-Za-z0-9_-]{1,64}$/.test(entry) ? null : `isn't a valid choice ("${entry}")`;
72
74
  default:
73
75
  return null;
@@ -78,7 +80,7 @@ function entryProblem(key, entry) {
78
80
  * why it can't be stored. A setting Snapmaker Orca keeps per hotend type
79
81
  * (`[standard, high_flow]`) stores only the standard entry.
80
82
  */
81
- function presetValue(key, raw) {
83
+ function presetValue(key, raw, release) {
82
84
  const info = SETTINGS_CATALOG[key];
83
85
  const isList = LIST_TYPES.has(info.type ?? "") && !VARIANT_KEYS.has(key);
84
86
  const source = VARIANT_KEYS.has(key) && Array.isArray(raw) ? raw[0] : raw;
@@ -88,7 +90,7 @@ function presetValue(key, raw) {
88
90
  return { problem: "isn't a list of values" };
89
91
  }
90
92
  for (const entry of source) {
91
- const problem = entryProblem(key, entry);
93
+ const problem = entryProblem(key, entry, release);
92
94
  if (problem)
93
95
  return { problem };
94
96
  }
@@ -96,7 +98,7 @@ function presetValue(key, raw) {
96
98
  }
97
99
  if (typeof source !== "string")
98
100
  return { problem: "isn't a single value" };
99
- const problem = entryProblem(key, source);
101
+ const problem = entryProblem(key, source, release);
100
102
  return problem ? { problem } : { value: source };
101
103
  }
102
104
  /** The stock value a preset value is compared with: the standard entry for a per-hotend-type setting. */
@@ -129,7 +131,7 @@ export function describeChanges(changes, stock, machine) {
129
131
  });
130
132
  }
131
133
  /** The changes a preset can apply on a base profile: allowed keys the profile has, with valid values. Notes say what was left out. */
132
- export function checkedChanges(changes, stock, notes) {
134
+ export function checkedChanges(changes, stock, notes, release) {
133
135
  const out = {};
134
136
  for (const key of Object.keys(changes).sort()) {
135
137
  if (!isPresetKey(key)) {
@@ -141,7 +143,7 @@ export function checkedChanges(changes, stock, notes) {
141
143
  notes.push(`Left out ${labelOf(key)}: the base profile doesn't have this setting.`);
142
144
  continue;
143
145
  }
144
- const checked = presetValue(key, changes[key]);
146
+ const checked = presetValue(key, changes[key], release);
145
147
  if ("problem" in checked) {
146
148
  notes.push(`Left out ${labelOf(key)}: the value ${checked.problem}.`);
147
149
  continue;
@@ -171,7 +173,7 @@ export async function resolvePreset(preset, catalog) {
171
173
  throw new Any2orcaError("invalid_preset", `The preset's base profile "${profileId}" isn't in the profile catalog.`);
172
174
  const loaded = await catalogEngine(catalog).load(profileId);
173
175
  const stock = loaded.convertProfile.profile.baselineProjectSettings;
174
- const changes = checkedChanges(parsed.data.changes, stock, notes);
176
+ const changes = checkedChanges(parsed.data.changes, stock, notes, loaded.convertProfile.profile.release);
175
177
  return { profileId, changes, described: describeChanges(changes, stock, loaded.convertProfile.printer.machineSettingsConfig), notes };
176
178
  }
177
179
  /**
@@ -43,6 +43,13 @@ export interface ProfileSource {
43
43
  * then converted with every mapped setting treated as changed.
44
44
  */
45
45
  readSource?(path: string): Promise<unknown>;
46
+ /**
47
+ * The catalog's filament presets file (`filament-presets.json`, named by the index): the settings of every
48
+ * filament preset Snapmaker Orca installs for each printer, which the Snapmaker and Generic filament options
49
+ * write. Only called when a conversion uses one of those options. Leave it out for a source without the file:
50
+ * those options then change filament names only.
51
+ */
52
+ readFilamentPresets?(): Promise<unknown>;
46
53
  }
47
54
  /** True for a path a {@link ProfileSource.release} may be asked for. */
48
55
  export declare function isReleasePath(path: string): boolean;
@@ -52,6 +59,10 @@ export declare const MAX_INDEX_BYTES: number;
52
59
  export declare const MAX_PROFILE_BYTES: number;
53
60
  /** A source-slicer bundle file (a vendor's print presets, unresolved) is a few hundred KB; this bounds a hostile one. */
54
61
  export declare const MAX_SOURCE_BYTES: number;
62
+ /** A filament presets file is a few hundred KB; this bounds a hostile one. */
63
+ export declare const MAX_FILAMENT_PRESETS_BYTES: number;
64
+ /** The only name the index may give the filament presets file. */
65
+ export declare const FILAMENT_PRESETS_PATH = "filament-presets.json";
55
66
  /** Where the index may point for source-slicer data: `sources/prusaslicer/<Vendor>.json` only. */
56
67
  export declare const SOURCE_PATH: RegExp;
57
68
  export declare function isSourcePath(path: string): boolean;
@@ -113,6 +124,7 @@ export declare const ProfileIndexSchema: z.ZodObject<{
113
124
  }, z.core.$strip>>;
114
125
  }, z.core.$strip>>;
115
126
  }, z.core.$strip>>;
127
+ filamentPresets: z.ZodOptional<z.ZodLiteral<"filament-presets.json">>;
116
128
  releases: z.ZodOptional<z.ZodArray<z.ZodObject<{
117
129
  version: z.ZodString;
118
130
  application: z.ZodString;
@@ -129,6 +141,17 @@ export declare const ProfileIndexSchema: z.ZodObject<{
129
141
  }, z.core.$strip>>;
130
142
  }, z.core.$strip>>;
131
143
  }, z.core.$strip>;
144
+ export declare const FilamentPresetsSchema: z.ZodObject<{
145
+ printers: z.ZodRecord<z.ZodString, z.ZodObject<{
146
+ shared: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
147
+ presets: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
148
+ }, z.core.$strip>>;
149
+ }, z.core.$strip>;
150
+ /** One printer's filament presets: the values they share, and each preset's own, by preset name. */
151
+ export interface PrinterFilamentPresets {
152
+ shared: Record<string, string[]>;
153
+ presets: Record<string, Record<string, string[]>>;
154
+ }
132
155
  /** A printer the catalog has profiles for. */
133
156
  export interface ProfileIndexPrinter {
134
157
  id: string;
@@ -182,6 +205,8 @@ export interface ProfileIndex {
182
205
  retired: RetiredProfile[];
183
206
  /** Filament preset names for the Snapmaker/Generic naming options, per printer. */
184
207
  filamentNames?: FilamentNameTable;
208
+ /** The filament presets file, when the catalog has one: always `filament-presets.json`. */
209
+ filamentPresets?: "filament-presets.json";
185
210
  /** Every Snapmaker Orca release this catalog holds, newest first. Absent in a catalog with one release. */
186
211
  releases?: ProfileIndexRelease[];
187
212
  /** Source-slicer data the catalog holds, independent of the Snapmaker Orca release. Absent in older data. */
@@ -250,6 +275,8 @@ export interface LoadedProfile {
250
275
  export interface CatalogEngine {
251
276
  load(id: string): Promise<LoadedProfile>;
252
277
  prusaBundle(vendor: string, slicerVersion: string): Promise<PrusaBundle | null>;
278
+ /** The filament presets, by printer id; null when the catalog or its source has none. */
279
+ filamentPresets(): Promise<Record<string, PrinterFilamentPresets> | null>;
253
280
  }
254
281
  /** For tests: gives a stand-in catalog an engine side. */
255
282
  export declare function withCatalogEngine<T extends object>(catalog: T, engine: Partial<CatalogEngine>): T;
@@ -272,6 +299,7 @@ export declare class ProfileCatalog {
272
299
  private readonly cache;
273
300
  private readonly releaseCatalogs;
274
301
  private readonly bundles;
302
+ private filamentPresetsPending;
275
303
  constructor(index: ProfileIndex, source: ProfileSource);
276
304
  /** Every profile, or only one nozzle size's, sorted by nozzle size and then layer height (finest first). */
277
305
  list(filter?: {
@@ -291,6 +319,8 @@ export declare class ProfileCatalog {
291
319
  * catalog doesn't list it or its source can't read source data.
292
320
  */
293
321
  private prusaBundle;
322
+ /** The filament presets, loaded and checked once; null when the index names none or the source can't read it. */
323
+ private filamentPresets;
294
324
  /** The live profile that replaced a retired id, if `id` was retired. */
295
325
  retiredSuccessor(id: string): RetiredProfile | undefined;
296
326
  /** The Snapmaker Orca releases this catalog holds, newest first. The first is the default. */
@@ -330,6 +360,8 @@ export interface MemoryCatalogData {
330
360
  releases?: Record<string, MemoryCatalogData>;
331
361
  /** Source-slicer data files by their index path (`sources/prusaslicer/<Vendor>.json`). */
332
362
  sources?: Record<string, unknown>;
363
+ /** The filament presets file's contents, when the index names one. */
364
+ filamentPresets?: unknown;
333
365
  }
334
366
  /** A catalog already in memory, e.g. for tests or a bundler that inlines the JSON. */
335
367
  export declare function memoryProfileSource(data: MemoryCatalogData): ProfileSource;
package/dist/profiles.js CHANGED
@@ -37,6 +37,10 @@ export const MAX_INDEX_BYTES = 1024 * 1024;
37
37
  export const MAX_PROFILE_BYTES = 8 * 1024 * 1024;
38
38
  /** A source-slicer bundle file (a vendor's print presets, unresolved) is a few hundred KB; this bounds a hostile one. */
39
39
  export const MAX_SOURCE_BYTES = 8 * 1024 * 1024;
40
+ /** A filament presets file is a few hundred KB; this bounds a hostile one. */
41
+ export const MAX_FILAMENT_PRESETS_BYTES = 8 * 1024 * 1024;
42
+ /** The only name the index may give the filament presets file. */
43
+ export const FILAMENT_PRESETS_PATH = "filament-presets.json";
40
44
  /** Where the index may point for source-slicer data: `sources/prusaslicer/<Vendor>.json` only. */
41
45
  export const SOURCE_PATH = /^sources\/prusaslicer\/[A-Za-z0-9]{1,64}-\d+\.\d+\.\d+\.json$/;
42
46
  export function isSourcePath(path) {
@@ -99,6 +103,8 @@ export const ProfileIndexSchema = z.object({
99
103
  retired: z.array(z.object({ id: ID, successorId: ID, displayName: NAME })).max(5000),
100
104
  /** Filament preset names for the Snapmaker/Generic naming options, per printer. */
101
105
  filamentNames: FilamentNamesSchema.optional(),
106
+ /** The filament presets file, when the catalog has one: always `filament-presets.json`. */
107
+ filamentPresets: z.literal(FILAMENT_PRESETS_PATH).optional(),
102
108
  /**
103
109
  * Every Snapmaker Orca release this catalog holds, newest first: this
104
110
  * index's own (`path` ".") and each older one's folder. Absent in a
@@ -126,6 +132,20 @@ export const ProfileIndexSchema = z.object({
126
132
  })
127
133
  .optional(),
128
134
  });
135
+ /** Keys that could reach an object's prototype when the shared values are merged into a preset. */
136
+ const UNSAFE_KEYS = new Set(["__proto__", "constructor", "prototype"]);
137
+ const safeKey = (max, pattern) => z.string().max(max).regex(pattern).refine((k) => !UNSAFE_KEYS.has(k), "not a usable key");
138
+ const presetSettings = z
139
+ .record(safeKey(100, /^[A-Za-z0-9_]{1,100}$/), z.array(z.string().max(20_000)).max(64))
140
+ .refine((r) => Object.keys(r).length <= 1000, "too many settings");
141
+ export const FilamentPresetsSchema = z.object({
142
+ printers: z
143
+ .record(ID.refine((k) => !UNSAFE_KEYS.has(k), "not a usable key"), z.object({
144
+ shared: presetSettings,
145
+ presets: z.record(presetText(200).refine((k) => !UNSAFE_KEYS.has(k), "not a usable key"), presetSettings).refine((r) => Object.keys(r).length <= 2000, "too many presets"),
146
+ }))
147
+ .refine((r) => Object.keys(r).length <= 500, "too many printers"),
148
+ });
129
149
  export const ProfileFileSchema = z.object({
130
150
  schema: z.literal(1),
131
151
  id: ID,
@@ -144,7 +164,7 @@ export const ProfileFileSchema = z.object({
144
164
  const ENGINES = new WeakMap();
145
165
  /** For tests: gives a stand-in catalog an engine side. */
146
166
  export function withCatalogEngine(catalog, engine) {
147
- ENGINES.set(catalog, { load: () => Promise.reject(new ProfileDataError("No profiles in this stand-in.")), prusaBundle: () => Promise.resolve(null), ...engine });
167
+ ENGINES.set(catalog, { load: () => Promise.reject(new ProfileDataError("No profiles in this stand-in.")), prusaBundle: () => Promise.resolve(null), filamentPresets: () => Promise.resolve(null), ...engine });
148
168
  return catalog;
149
169
  }
150
170
  /** The engine's access to a catalog. Kept off the class, so the public API holds only what a UI needs. */
@@ -179,8 +199,9 @@ export class ProfileCatalog {
179
199
  cache = new Map();
180
200
  releaseCatalogs = new Map();
181
201
  bundles = new Map();
202
+ filamentPresetsPending;
182
203
  constructor(index, source) {
183
- ENGINES.set(this, { load: (id) => this.load(id), prusaBundle: (vendor, slicerVersion) => this.prusaBundle(vendor, slicerVersion) });
204
+ ENGINES.set(this, { load: (id) => this.load(id), prusaBundle: (vendor, slicerVersion) => this.prusaBundle(vendor, slicerVersion), filamentPresets: () => this.filamentPresets() });
184
205
  this.index = index;
185
206
  this.source = source;
186
207
  if (index.releases) {
@@ -263,6 +284,20 @@ export class ProfileCatalog {
263
284
  }
264
285
  return pending;
265
286
  }
287
+ /** The filament presets, loaded and checked once; null when the index names none or the source can't read it. */
288
+ filamentPresets() {
289
+ if (this.index.filamentPresets !== FILAMENT_PRESETS_PATH || !this.source.readFilamentPresets)
290
+ return Promise.resolve(null);
291
+ this.filamentPresetsPending ??= this.source.readFilamentPresets().then((raw) => {
292
+ const parsed = FilamentPresetsSchema.safeParse(raw);
293
+ if (!parsed.success)
294
+ throw new ProfileDataError(`Profile catalog's ${FILAMENT_PRESETS_PATH} is malformed: ${describeIssues(parsed.error)}`);
295
+ return parsed.data.printers;
296
+ });
297
+ // A failed read isn't kept, so a transient fetch error can be retried.
298
+ this.filamentPresetsPending.catch(() => (this.filamentPresetsPending = undefined));
299
+ return this.filamentPresetsPending;
300
+ }
266
301
  /** The live profile that replaced a retired id, if `id` was retired. */
267
302
  retiredSuccessor(id) {
268
303
  if (this.byId.has(id))
@@ -312,7 +347,7 @@ export class ProfileCatalog {
312
347
  return Promise.reject(new Any2orcaError("profile_not_found", `No profile found for id "${id}".`));
313
348
  let pending = this.cache.get(id);
314
349
  if (!pending) {
315
- pending = this.source.readProfile(id).then((raw) => toLoadedProfile(raw, summary, this.index.filamentNames));
350
+ pending = this.source.readProfile(id).then((raw) => toLoadedProfile(raw, summary, this.index.filamentNames, this.index.slicer.version));
316
351
  // A failed read isn't cached, so a transient fetch error can be retried.
317
352
  pending.catch(() => this.cache.delete(id));
318
353
  this.cache.set(id, pending);
@@ -320,7 +355,7 @@ export class ProfileCatalog {
320
355
  return pending;
321
356
  }
322
357
  }
323
- function toLoadedProfile(raw, summary, filamentNames) {
358
+ function toLoadedProfile(raw, summary, filamentNames, release) {
324
359
  const parsed = ProfileFileSchema.safeParse(raw);
325
360
  if (!parsed.success)
326
361
  throw new ProfileDataError(`Profile ${summary.id} is malformed: ${describeIssues(parsed.error)}`);
@@ -343,6 +378,7 @@ function toLoadedProfile(raw, summary, filamentNames) {
343
378
  },
344
379
  profile: {
345
380
  id: file.id,
381
+ release,
346
382
  baselineProjectSettings: file.baselineProjectSettings,
347
383
  filamentShapeConfig: file.filamentShape,
348
384
  blocklist: new Set([
@@ -460,6 +496,7 @@ export function fetchProfileSource(baseUrl, options = {}) {
460
496
  throw new ProfileDataError(`Not a source data file: ${JSON.stringify(path.slice(0, 60))}.`);
461
497
  return read(path, MAX_SOURCE_BYTES);
462
498
  },
499
+ readFilamentPresets: () => read(FILAMENT_PRESETS_PATH, MAX_FILAMENT_PRESETS_BYTES),
463
500
  };
464
501
  }
465
502
  /** A catalog already in memory, e.g. for tests or a bundler that inlines the JSON. */
@@ -480,6 +517,7 @@ export function memoryProfileSource(data) {
480
517
  },
481
518
  }
482
519
  : {}),
520
+ ...(data.filamentPresets !== undefined ? { readFilamentPresets: async () => data.filamentPresets } : {}),
483
521
  release: (path) => {
484
522
  if (!isReleasePath(path) || !data.releases || !Object.hasOwn(data.releases, path))
485
523
  throw new ProfileDataError(`No catalog data for ${plainVersion(path)}.`);
package/dist/project.d.ts CHANGED
@@ -113,6 +113,12 @@ export interface ConvertReport {
113
113
  filamentComplianceFallback?: string[];
114
114
  /** Product lines (or materials) whose names stayed as the creator had them under `filamentComplianceMode`, because no Snapmaker or Generic preset fits. */
115
115
  filamentComplianceUnchanged?: string[];
116
+ /**
117
+ * Under `filamentComplianceMode`: each filament slot (1-based) set to a preset Snapmaker Orca ships, with that
118
+ * preset's own settings, and the creator's values it replaced (each setting's standard value, before and after).
119
+ * {@link filamentNotes} says it in words.
120
+ */
121
+ filamentPresets?: ReportFilamentPreset[];
116
122
  /** How far each object was moved, by object id. */
117
123
  shifts: Shifts;
118
124
  /**
@@ -137,6 +143,19 @@ export interface ConvertReport {
137
143
  notes: string[];
138
144
  };
139
145
  }
146
+ /** A filament slot set to a preset Snapmaker Orca ships, and the creator's values the preset replaced. */
147
+ export interface ReportFilamentPreset {
148
+ /** The slot, counting from 1 as slicers show them. */
149
+ slot: number;
150
+ /** The preset, e.g. "Snapmaker PLA SnapSpeed @U1". */
151
+ preset: string;
152
+ /** Each setting whose standard value differs from the creator's: the key, the creator's value, the preset's. */
153
+ changed: Array<{
154
+ key: string;
155
+ before: string;
156
+ after: string;
157
+ }>;
158
+ }
140
159
  export interface ConvertResult {
141
160
  /** The converted .3mf. */
142
161
  output: Uint8Array;
package/dist/project.js CHANGED
@@ -245,6 +245,8 @@ export class Project {
245
245
  }
246
246
  progress("loading-profile");
247
247
  const loaded = await catalogEngine(catalog).load(profileId);
248
+ // The Snapmaker and Generic filament options write the chosen presets' own settings, loaded only for them.
249
+ const filamentPresets = options.filamentComplianceMode ? (await catalogEngine(catalog).filamentPresets())?.[loaded.convertProfile.printer.id] : undefined;
248
250
  progress("merging");
249
251
  if (preset) {
250
252
  const sourceNozzle = detectNozzleDiameter(this.request.projectSettings);
@@ -260,7 +262,8 @@ export class Project {
260
262
  ...(highFlowHotends !== false ? { highFlowHotends } : {}),
261
263
  ...(options.hardenedNozzles === true ? { hardenedNozzles: true } : {}),
262
264
  };
263
- const pipeline = runConvertPipeline(loaded.convertProfile, request, catalog.index.slicer.application, {
265
+ const convertProfile = filamentPresets ? { ...loaded.convertProfile, printer: { ...loaded.convertProfile.printer, filamentPresets } } : loaded.convertProfile;
266
+ const pipeline = runConvertPipeline(convertProfile, request, catalog.index.slicer.application, {
264
267
  carrySourceLayerHeight,
265
268
  ...(preset ? { presetChanges: preset.changes } : {}),
266
269
  ...(aboveStock.keep.size + aboveStock.stock.size > 0 ? { aboveStock } : {}),
@@ -320,6 +323,7 @@ export class Project {
320
323
  log: [...this.parsed.warnings, ...routeWarnings, ...pipeline.warnings, ...applyWarnings].map((w) => w.trim()).filter(Boolean),
321
324
  ...(response.filamentComplianceFallback ? { filamentComplianceFallback: response.filamentComplianceFallback } : {}),
322
325
  ...(response.filamentComplianceUnchanged ? { filamentComplianceUnchanged: response.filamentComplianceUnchanged } : {}),
326
+ ...(response.filamentPresets ? { filamentPresets: response.filamentPresets } : {}),
323
327
  shifts: response.shifts,
324
328
  ...(response.plateOrigins ? { plateOrigins: Object.fromEntries(Object.entries(response.plateOrigins).map(([plate, origin]) => [Number(plate), origin])) } : {}),
325
329
  plates: Math.max(1, this.request.plateCount ?? 0, ...inspection.plates),
package/dist/schema.d.ts CHANGED
@@ -128,6 +128,15 @@ export declare const ConvertResponseSchema: z.ZodObject<{
128
128
  }, z.core.$strip>>;
129
129
  filamentComplianceFallback: z.ZodOptional<z.ZodArray<z.ZodString>>;
130
130
  filamentComplianceUnchanged: z.ZodOptional<z.ZodArray<z.ZodString>>;
131
+ filamentPresets: z.ZodOptional<z.ZodArray<z.ZodObject<{
132
+ slot: z.ZodNumber;
133
+ preset: z.ZodString;
134
+ changed: z.ZodArray<z.ZodObject<{
135
+ key: z.ZodString;
136
+ before: z.ZodString;
137
+ after: z.ZodString;
138
+ }, z.core.$strip>>;
139
+ }, z.core.$strip>>>;
131
140
  warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
132
141
  }, z.core.$strip>;
133
142
  export type ConvertResponse = z.infer<typeof ConvertResponseSchema>;
package/dist/schema.js CHANGED
@@ -92,6 +92,9 @@ export const ConvertResponseSchema = z.object({
92
92
  filamentComplianceFallback: z.array(z.string()).optional(),
93
93
  /** Product lines (or materials) whose names stayed as the creator had them under `filamentComplianceMode`, because no Snapmaker or Generic preset fits at this nozzle size. */
94
94
  filamentComplianceUnchanged: z.array(z.string()).optional(),
95
+ filamentPresets: z
96
+ .array(z.object({ slot: z.number().int().min(1), preset: z.string(), changed: z.array(z.object({ key: z.string(), before: z.string(), after: z.string() })) }))
97
+ .optional(),
95
98
  /** Notes worth showing the user (each contains "WARN"). */
96
99
  warnings: z.array(z.string()).optional(),
97
100
  });
@@ -11,6 +11,7 @@
11
11
  * what the creator changed, so every mapped print setting is marked as
12
12
  * changed, and the pipeline's own rules decide what the U1 keeps.
13
13
  */
14
+ import { settingLimits } from "../../diff/settingLimits.js";
14
15
  import { SETTINGS_CATALOG } from "../../diff/settingsCatalog.js";
15
16
  import { splitNumberList, splitStringList } from "./ini.js";
16
17
  import { PRUSA_KEY_MAP } from "./keyMap.js";
@@ -285,7 +286,8 @@ export function convertPrusaSettings(ini) {
285
286
  return;
286
287
  // A value under Snapmaker Orca's minimum: PrusaSlicer's 0 for "automatic" on a speed it requires to be 1 or
287
288
  // more, say. Snapmaker Orca refuses the whole file for it, so the stock value stands.
288
- const min = SETTINGS_CATALOG[target]?.min;
289
+ // Read before a Snapmaker Orca release is chosen, so it's what every supported release accepts.
290
+ const min = settingLimits(target)?.min;
289
291
  if (min !== null && min !== undefined && list.some((entry) => /^-?\d+(\.\d+)?$/.test(entry) && Number(entry) < min)) {
290
292
  dropped.push({ key: target, why: `${list.join(",")} is below Snapmaker Orca's minimum of ${min}` });
291
293
  return;
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  // Written by scripts/sync-version.mjs from package.json; a test checks they match.
3
3
  // Typed as string, so a release doesn't change the public API's shape.
4
- export const VERSION = "0.9.1";
4
+ export const VERSION = "0.10.0";
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "any2orca",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
+ "outputAffecting": "The Snapmaker and Generic filament options set each filament to its preset's own settings, and every option keeps what the file says when Snapmaker Orca opens it",
4
5
  "description": "Convert Bambu Studio, Creality Print, Anycubic Slicer Next, ElegooSlicer, Flash Studio, QIDI Studio and PrusaSlicer 3MF projects for the Snapmaker U1 (Snapmaker Orca), entirely on your own machine. Library, CLI and Web Worker in one package.",
5
6
  "keywords": [
6
7
  "3mf",
@@ -66,12 +67,12 @@
66
67
  "api": "node scripts/api-report.mjs"
67
68
  },
68
69
  "dependencies": {
69
- "any2orca-profiles": "0.3.1",
70
+ "any2orca-profiles": "0.4.0",
70
71
  "fflate": "0.8.3",
71
72
  "zod": "4.6.7"
72
73
  },
73
74
  "devDependencies": {
74
- "@microsoft/api-extractor": "7.59.4",
75
+ "@microsoft/api-extractor": "7.60.1",
75
76
  "@types/node": "22.20.1",
76
77
  "typedoc": "0.28.20",
77
78
  "typescript": "5.9.3",