any2orca 0.7.3 → 0.9.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/NOTICE +11 -5
  3. package/README.md +5 -3
  4. package/dist/archive/lookupFilamentColorName.d.ts +4 -1
  5. package/dist/archive/zip.js +1 -1
  6. package/dist/cli/commands/diff.js +5 -4
  7. package/dist/cli/main.js +1 -1
  8. package/dist/diff/diffSettings.d.ts +9 -2
  9. package/dist/diff/diffSettings.js +9 -0
  10. package/dist/diff/reference.d.ts +8 -1
  11. package/dist/diff/reference.js +11 -2
  12. package/dist/diff/valueLayout.d.ts +5 -2
  13. package/dist/diff/valueLayout.js +7 -2
  14. package/dist/engine/detectNozzleDiameter.d.ts +3 -1
  15. package/dist/errors.d.ts +4 -1
  16. package/dist/errors.js +23 -0
  17. package/dist/explain/whatChanged.d.ts +5 -1
  18. package/dist/explain/whatChanged.js +2 -0
  19. package/dist/index.d.ts +29 -30
  20. package/dist/index.js +16 -19
  21. package/dist/inspect.d.ts +9 -3
  22. package/dist/inspect.js +11 -5
  23. package/dist/presets/extractPreset.js +2 -2
  24. package/dist/presets/preset.d.ts +1 -1
  25. package/dist/presets/preset.js +7 -1
  26. package/dist/profiles.d.ts +74 -5
  27. package/dist/profiles.js +14 -0
  28. package/dist/project.d.ts +5 -1
  29. package/dist/project.js +4 -2
  30. package/dist/schema.d.ts +32 -5
  31. package/dist/schema.js +3 -1
  32. package/dist/sources/bambuFamily.js +1 -1
  33. package/dist/sources/prusa/policyB.d.ts +1 -1
  34. package/dist/sources/prusa/policyB.js +2 -1
  35. package/dist/sources/reader.d.ts +5 -2
  36. package/dist/sources/reader.js +2 -1
  37. package/dist/stamp.d.ts +40 -1
  38. package/dist/stamp.js +5 -3
  39. package/dist/telemetry.d.ts +37 -3
  40. package/dist/telemetry.js +32 -6
  41. package/dist/version.d.ts +1 -1
  42. package/dist/version.js +1 -1
  43. package/dist/worker-entry.js +2 -3
  44. package/package.json +5 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # any2orca
2
2
 
3
+ ## 0.9.0
4
+
5
+ ### Breaking
6
+
7
+ - **The public API is now the documented one, and from here on it only grows.** This release removes what was never meant to be public and opens the lists of values the library returns, so that adding a slicer, an error code or a conversion step never breaks code built on any2orca again. A check in CI compares the API's shape with a committed report. Everything that changed, and what to use instead:
8
+
9
+ - **Lists of values the library returns can gain values.** `SourceVendor`, `Any2orcaErrorCode`, `ChangeReason`, `ConvertStage`, `MatchSource`, `DiffStatus`, `DiffAttention`, `ValueLayout`, `SourceFormat` and `SupportedNozzleDiameter` are now the known values or any other string. Code that maps every value, such as a `Record<SourceVendor, string>` or an exhaustive `switch`, needs a fallback for a value it doesn't recognize. The known values are exported next to each type: `SOURCE_VENDORS`, `ANY2ORCA_ERROR_CODES`, `CHANGE_REASONS`, `CONVERT_STAGES`, `MATCH_SOURCES`, `DIFF_STATUSES`, `DIFF_ATTENTIONS`, `VALUE_LAYOUTS`, `SOURCE_FORMATS` and `SUPPORTED_NOZZLE_DIAMETERS`, with a `Known...` type for each.
10
+ - **The validation schemas are no longer exported,** so the library's types mention no validation library: `StatsEventSchema` is replaced by `parseStatsEvent()` (what a sender may send, exactly) and `receiveStatsEvent()` (what a collector stores: the same event, with a maker or match source the collector doesn't know yet stored as `"other"` instead of refused, so a collector a few releases behind still counts every conversion); `PresetSchema` and `PresetFileSchema` by `parsePresetFile()`, which already existed; `OutputStampSchema` by `decodeStamp()`, likewise. The types those schemas produced (`OutputStamp`, `ConvertObject`, `HighFlowHotends`, `Shifts`, `ProfileMatch`, `ProfileIndex`, `StatsEvent`) are plain interfaces now, with the same fields.
11
+ - **Internal helpers are no longer exported:** `cleanWarnings`, `detectNozzleDiameter`, `isReleasePath`, `labelOf`, `lookupFilamentColorName`, `parseFilamentType`, `matchFilamentLine`, `normalizeTierName`, `parseTierName`, `pickProfile`, `presetFingerprint`, `recordStatsChoice`, `valueLayout`, and the constants `ABOVE_STOCK_DEFAULTS`, `BOOKKEEPING_KEYS`, `MAX_DIFF_KEYS`, `MAX_INDEX_BYTES`, `MAX_PROFILE_BYTES`, `NEVER_SENT`, `NO_STATS_CHOICE`, `PRESET_KEYS`, `PRESET_EXCLUDED_KEYS`, `REF_PATTERN`, `SETTINGS_CATALOG`, `SETTINGS_CATALOG_SOURCE` and `VALUE_LAYOUT_TEXT`, with the types `PickProfileResult`, `TierAwareProfileCandidate` and `LoadedProfile`. Use `matchProfile()` to pick a profile, as the docs always said. A catalog's `load()` and `prusaBundle()` methods, which the engine used, are no longer reachable either; for Snapmaker's stock settings as a diff side, use the new `stockDiffSide(profileId, catalog)`, the counterpart of `presetDiffSide()`; `listProfiles()`, `get()`, `list()`, `releases()`, `forRelease()`, `retiredSuccessor()` and `prusaBundles()` stay. If you used one of these, open an issue: adding one back is not a breaking change.
12
+ - **A stamp from a newer any2orca still reads.** `decodeStamp()` accepts a source format it doesn't know, instead of reading the file as unstamped. Converted files don't change.
13
+
14
+ ### Fixes
15
+
16
+ - **A partner link whose download stalls stops after 60 seconds, and you can cancel it.** When a site's `?manifest=` link points to a server that stops sending, the web app used to wait forever; it now stops after 60 seconds with nothing received and says so, and a Cancel button stops the download at any time and returns to the start screen. While it downloads, the heading says "Downloading files..." instead of "Inspecting 3MF archive...", and while it waits for a partner site's hand-off, "Waiting for the partner site...". Converted files don't change.
17
+
18
+ ### Other
19
+
20
+ - **The NOTICE says what the settings catalog holds.** It now says plainly that the settings catalog includes Snapmaker Orca's setting labels and the names of its settings pages and sections, alongside facts about each setting. No code or converted file changes.
21
+
22
+ ## 0.8.0
23
+
24
+ ### Breaking
25
+
26
+ - **`SourceVendor` has a new value, `"qidi"`.** Code that maps every value, such as a `Record<SourceVendor, string>` or an exhaustive `switch`, needs an entry for it.
27
+
28
+ ### Features
29
+
30
+ - **QIDI Studio projects are a supported source.** QIDI Studio saves in Bambu Studio's format, so its projects already converted; now they're tested (a QIDI Studio 2.7.2.73 save of the shared scene is a fixture) and named in the help, the README and the package description. The inspection's `sourceVendor` is `"qidi"` for them, read from the printer a filament preset names, since QIDI Studio writes its printer as "Q1 Pro". Converted files don't change.
31
+
3
32
  ## 0.7.3
4
33
 
5
34
  ### Output-affecting
package/NOTICE CHANGED
@@ -7,11 +7,17 @@ reference data compiled from public sources. This file is not legal advice.
7
7
 
8
8
  The names, settings-page locations, types, limits and choices of Snapmaker
9
9
  Orca's settings, used to label and group settings in comparisons, presets and
10
- "What changed?". They are generated from the setting definitions in
11
- Snapmaker Orca's source
12
- (github.com/Snapmaker/OrcaSlicer, src/libslic3r/PrintConfig.cpp), at the
13
- release named at the top of the generated file. Snapmaker Orca is
14
- AGPL-3.0-or-later; the catalog records facts about its settings, not its code.
10
+ "What changed?". They are generated from Snapmaker Orca's source
11
+ (github.com/Snapmaker/OrcaSlicer: src/libslic3r/PrintConfig.cpp,
12
+ src/libslic3r/Preset.cpp and src/slic3r/GUI/Tab.cpp), at the release named at
13
+ the top of the generated file. Snapmaker Orca is AGPL-3.0-or-later.
14
+
15
+ Besides facts about each setting (its key, value type, limits, choices and the
16
+ preset it belongs to), the catalog includes Snapmaker Orca's short label for
17
+ each setting and the names of its settings pages and sections, in the order
18
+ Snapmaker Orca shows them. They are there so that any2orca names each setting
19
+ the way Snapmaker Orca does. The catalog includes no tooltips or other help
20
+ text, and none of Snapmaker Orca's code.
15
21
 
16
22
  ## Filament color data (src/archive/filamentColorNames.ts)
17
23
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # any2orca
2
2
 
3
- Convert Bambu Studio, Creality Print, Anycubic Slicer Next, ElegooSlicer, Flash Studio and PrusaSlicer `.3mf` projects to Snapmaker U1 / Orca format, entirely on your own machine. One package: a command-line tool, a library for Node and browsers, and a ready-made Web Worker.
3
+ Convert Bambu Studio, Creality Print, Anycubic Slicer Next, ElegooSlicer, Flash Studio, QIDI Studio and PrusaSlicer `.3mf` projects to Snapmaker U1 / Orca format, entirely on your own machine. One package: a command-line tool, a library for Node and browsers, and a ready-made Web Worker.
4
4
 
5
5
  Formerly bambu2orca and the `@kuzuri.ao/b2o` CLI. Same conversion, now local: no account, no API key, no quota, and nothing you convert is sent anywhere.
6
6
 
@@ -35,6 +35,8 @@ The full reference, with exit codes, the state file and `telemetry`, is in [`doc
35
35
 
36
36
  Every exported function and type is in the [API reference](https://docs.any2orca.com). The common paths:
37
37
 
38
+ What stays stable: everything the library exports is supported, and a release only adds to it. A new option is optional, a result can gain fields, and a list of values the library returns (a source maker, an error code, a change reason, a conversion stage, a diff status) can gain values, so handle one you don't recognize; each list's known values are exported next to its type, for example `SOURCE_VENDORS` beside `SourceVendor`. A file format (the output stamp, a presets file, the profile catalog, the stats event) changes shape only with a new version number, and older ones keep being read. Nothing is removed or renamed outside a major release, and only after a deprecation notice. The same holds for the CLI's commands, flags, exit codes and JSON output, and for the partner hand-off. A check in CI compares the API's shape with a committed report, so a change to it is deliberate.
39
+
38
40
  Every filament in the source stays in the output: all of them, with their colors, brands, types and order, however many. The U1 loads four at a time, but a project can use many more, swapped in at the pauses the user plans in Snapmaker Orca, and that planning depends on the file's own order. `report.filaments` lists each slot with the name it had and the name it has. The model's own metadata in `3D/3dmodel.model` (designer, license, copyright, title, description) stays as it was; only `Application` changes, to the Snapmaker Orca release the file is made for.
39
41
 
40
42
  ```js
@@ -82,7 +84,7 @@ const { output } = await convert(bytes, { profiles: catalog, snapmakerOrcaVersio
82
84
 
83
85
  More in [Snapmaker Orca releases](https://github.com/KuzuriAo/any2orca/blob/main/docs/snapmaker-orca-releases.md).
84
86
 
85
- Never re-implement profile matching in a UI: use `matchProfile()` (or `pickProfile()` and `parseTierName()`), so every UI picks the same profile for the same file.
87
+ Never re-implement profile matching in a UI: use `matchProfile()`, so every UI picks the same profile for the same file.
86
88
 
87
89
  Presets (your own tuned print settings, applied to other files; see [`docs/presets.md`](https://github.com/KuzuriAo/any2orca/blob/main/docs/presets.md)):
88
90
 
@@ -187,4 +189,4 @@ MIT.
187
189
 
188
190
  The profile data (`any2orca-profiles`) is AGPL-3.0-or-later, since it is derived from Snapmaker's AGPL presets. It is a separate package, loaded at runtime. [`NOTICE`](https://github.com/KuzuriAo/any2orca/blob/main/packages/core/NOTICE) credits the data this package includes.
189
191
 
190
- any2orca is an independent project, not affiliated with, endorsed by, or sponsored by Snapmaker, Bambu Lab, OrcaSlicer or any printer, slicer or filament maker.
192
+ any2orca is an independent project, not affiliated with, endorsed by, or sponsored by Snapmaker, Bambu Lab, Creality, Anycubic, ELEGOO, Flashforge, Prusa Research, OrcaSlicer or any other brand or vendor of printers, slicers or filament.
@@ -6,8 +6,11 @@ export interface FilamentColorEntry {
6
6
  hex: string;
7
7
  name: string;
8
8
  }
9
+ /** The filament makers the color library covers today; a later any2orca release may add one. */
10
+ export type FilamentColorVendor = "bambu" | "polymaker" | (string & {});
11
+ /** The real product color name a slot's preset and hex match. */
9
12
  export interface FilamentColorMatch {
10
- vendor: FilamentColorEntry["vendor"];
13
+ vendor: FilamentColorVendor;
11
14
  name: string;
12
15
  }
13
16
  /**
@@ -49,7 +49,7 @@ export function prepareConvertRequest(fileBytes, maxUnpackedBytes) {
49
49
  const otherFormatSettings = zipEntries[OTHER_FORMAT_SETTINGS_PATH];
50
50
  if (otherFormatSettings) {
51
51
  const slicer = otherFormatSlicer(otherFormatSettings);
52
- throw new Any2orcaError("unsupported_slicer", `This project was saved by ${slicer}, and only projects from Bambu Studio, Creality Print, Anycubic Slicer Next, ElegooSlicer, Flash Studio and PrusaSlicer can be converted.`, { slicer });
52
+ throw new Any2orcaError("unsupported_slicer", `This project was saved by ${slicer}, and only projects from Bambu Studio, Creality Print, Anycubic Slicer Next, ElegooSlicer, Flash Studio, QIDI Studio and PrusaSlicer can be converted.`, { slicer });
53
53
  }
54
54
  // A zip that isn't a 3MF at all (no model part, no print settings): a bundle of STL files, say.
55
55
  if (!zipEntries[TOP_MODEL_PATH]) {
@@ -2,7 +2,7 @@
2
2
  import { readFileSync, statSync } from "node:fs";
3
3
  import { basename } from "node:path";
4
4
  import { diffSettings } from "../../diff/diffSettings.js";
5
- import { diffReference, presetDiffSide } from "../../diff/reference.js";
5
+ import { diffReference, presetDiffSide, stockDiffSide } from "../../diff/reference.js";
6
6
  import { valueLayoutNotes } from "../../diff/valueLayout.js";
7
7
  import { Project } from "../../project.js";
8
8
  import { formatTable } from "../table.js";
@@ -45,12 +45,13 @@ const ATTENTION_TEXT = {
45
45
  "above-limit": "above the U1's limit (capped)",
46
46
  "above-stock": "above stock",
47
47
  };
48
+ // A kind or status a later release adds sorts with the ones worth a look.
48
49
  const ATTENTION_RANK = { "above-limit": 0, "above-stock": 1 };
49
50
  const STATUS_RANK = { changed: 0, "only-a": 1, "only-b": 2, unmatched: 3, same: 4 };
50
51
  /** Rows in the chosen order. The diff's own order (Snapmaker Orca's page order) breaks ties. */
51
52
  function ordered(rows, sort) {
52
53
  const position = new Map(rows.map((r, i) => [r, i]));
53
- const rank = (r) => (sort === "attention" ? (r.attention ? ATTENTION_RANK[r.attention] : 2) : sort === "status" ? STATUS_RANK[r.status] : 0);
54
+ const rank = (r) => (sort === "attention" ? (r.attention ? (ATTENTION_RANK[r.attention] ?? 1) : 2) : sort === "status" ? (STATUS_RANK[r.status] ?? 0) : 0);
54
55
  return [...rows].sort((x, y) => rank(x) - rank(y) || (position.get(x) ?? 0) - (position.get(y) ?? 0));
55
56
  }
56
57
  /** The text report: a heading per group, then setting, first value, second value, status, and a note on values above stock or the U1's limits. */
@@ -93,8 +94,8 @@ export async function runDiff(options, out) {
93
94
  const [file] = options.files;
94
95
  const project = openFile(file);
95
96
  const profileId = options.againstStock === true ? (await project.matchProfile(options.catalog)).profileId : options.againstStock;
96
- const loaded = await options.catalog.load(profileId);
97
- diff = diffSettings({ label: basename(file), settings: project.settings() }, { label: `Snapmaker's stock ${loaded.summary.displayName} profile`, settings: loaded.convertProfile.profile.baselineProjectSettings },
97
+ const stock = await stockDiffSide(profileId, options.catalog);
98
+ diff = diffSettings({ label: basename(file), settings: project.settings() }, { label: stock.label, settings: stock.settings },
98
99
  // Filament settings come from the creator, not the stock profile, so they're only compared when asked for.
99
100
  { groups: options.groups ?? ["print", "machine"], includeUnchanged: options.all, reference: await diffReference(options.catalog, profileId) });
100
101
  }
package/dist/cli/main.js CHANGED
@@ -45,7 +45,7 @@ function wrapText(text, width) {
45
45
  lines.push(line);
46
46
  return lines;
47
47
  }
48
- const TOP_LEVEL_HELP = `any2orca ${VERSION}: convert Bambu Studio, Creality Print, Anycubic Slicer Next, ElegooSlicer, Flash Studio and PrusaSlicer .3mf projects to Snapmaker U1 / Orca format, entirely on this machine.
48
+ const TOP_LEVEL_HELP = `any2orca ${VERSION}: convert Bambu Studio, Creality Print, Anycubic Slicer Next, ElegooSlicer, Flash Studio, QIDI Studio and PrusaSlicer .3mf projects to Snapmaker U1 / Orca format, entirely on this machine.
49
49
 
50
50
  Usage: any2orca <command> [options]
51
51
 
@@ -1,14 +1,21 @@
1
1
  import { type SettingGroup } from "./settingsCatalog.js";
2
2
  import { type ValueLayout } from "./valueLayout.js";
3
3
  export type DiffGroupName = SettingGroup | "other";
4
- export type DiffStatus = "same" | "changed" | "only-a" | "only-b" | "unmatched";
4
+ /** How a setting compares between the two sides. */
5
+ export declare const DIFF_STATUSES: readonly ["same", "changed", "only-a", "only-b", "unmatched"];
6
+ export type KnownDiffStatus = (typeof DIFF_STATUSES)[number];
7
+ /** One of {@link DIFF_STATUSES}, or a status a later any2orca release added: show a row you don't recognize as changed. */
8
+ export type DiffStatus = KnownDiffStatus | (string & {});
5
9
  /**
6
10
  * A value worth a look, when the diff was given a reference profile: a speed
7
11
  * or acceleration above the printer's machine limits (it will be capped), or
8
12
  * a speed, acceleration or filament max volumetric speed above Snapmaker's
9
13
  * stock value (22/40 mm³/s for max volumetric speed).
10
14
  */
11
- export type DiffAttention = "above-limit" | "above-stock";
15
+ export declare const DIFF_ATTENTIONS: readonly ["above-limit", "above-stock"];
16
+ export type KnownDiffAttention = (typeof DIFF_ATTENTIONS)[number];
17
+ /** One of {@link DIFF_ATTENTIONS}, or a kind a later any2orca release added: mark a row you don't recognize as worth a look. */
18
+ export type DiffAttention = KnownDiffAttention | (string & {});
12
19
  export interface DiffRow {
13
20
  key: string;
14
21
  /** Where Snapmaker Orca shows the setting, for example "Speed > Acceleration > Outer wall", or the key itself. */
@@ -22,6 +22,15 @@ import { ABOVE_STOCK_DEFAULTS, machineLimitFor } from "../engine/aboveStock.js";
22
22
  import { FILAMENT_FLOW_VARIANT_KEYS, MAX_VOLUMETRIC_SPEED } from "../engine/applyFilamentFlowVariants.js";
23
23
  import { SETTINGS_CATALOG, SETTINGS_CATALOG_SOURCE } from "./settingsCatalog.js";
24
24
  import { isOtherPrinter, valueLayout } from "./valueLayout.js";
25
+ /** How a setting compares between the two sides. */
26
+ export const DIFF_STATUSES = ["same", "changed", "only-a", "only-b", "unmatched"];
27
+ /**
28
+ * A value worth a look, when the diff was given a reference profile: a speed
29
+ * or acceleration above the printer's machine limits (it will be capped), or
30
+ * a speed, acceleration or filament max volumetric speed above Snapmaker's
31
+ * stock value (22/40 mm³/s for max volumetric speed).
32
+ */
33
+ export const DIFF_ATTENTIONS = ["above-limit", "above-stock"];
25
34
  /** Entries that describe how a file was saved rather than how it prints. */
26
35
  export const BOOKKEEPING_KEYS = new Set([
27
36
  "different_settings_to_system",
@@ -1,8 +1,15 @@
1
- import type { ProfileCatalog } from "../profiles.js";
1
+ import { type ProfileCatalog } from "../profiles.js";
2
2
  import { type Preset } from "../presets/preset.js";
3
3
  import type { DiffOptions, SettingsSide } from "./diffSettings.js";
4
4
  /** A profile as a diff's reference: its stock project settings and its printer's machine settings (see DiffOptions.reference). */
5
5
  export declare function diffReference(catalog: ProfileCatalog, profileId: string): Promise<NonNullable<DiffOptions["reference"]>>;
6
+ /**
7
+ * Snapmaker's stock profile as a diff side: its project settings, labeled with its name. Shared by the CLI's
8
+ * `diff --against-stock` and the worker's stock side, so both compare the same thing.
9
+ */
10
+ export declare function stockDiffSide(profileId: string, catalog: ProfileCatalog): Promise<SettingsSide & {
11
+ profileId: string;
12
+ }>;
6
13
  /**
7
14
  * A preset as a diff side, the way it converts: its base profile's stock
8
15
  * settings with its changes written over them. Shared by the CLI's
@@ -1,11 +1,20 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  import { applyPresetChanges } from "../engine/applyPresetChanges.js";
3
+ import { catalogEngine } from "../profiles.js";
3
4
  import { resolvePreset } from "../presets/preset.js";
4
5
  /** A profile as a diff's reference: its stock project settings and its printer's machine settings (see DiffOptions.reference). */
5
6
  export async function diffReference(catalog, profileId) {
6
- const loaded = await catalog.load(profileId);
7
+ const loaded = await catalogEngine(catalog).load(profileId);
7
8
  return { stock: loaded.convertProfile.profile.baselineProjectSettings, machine: loaded.convertProfile.printer.machineSettingsConfig };
8
9
  }
10
+ /**
11
+ * Snapmaker's stock profile as a diff side: its project settings, labeled with its name. Shared by the CLI's
12
+ * `diff --against-stock` and the worker's stock side, so both compare the same thing.
13
+ */
14
+ export async function stockDiffSide(profileId, catalog) {
15
+ const loaded = await catalogEngine(catalog).load(profileId);
16
+ return { label: `Snapmaker's stock ${loaded.summary.displayName} profile`, settings: loaded.convertProfile.profile.baselineProjectSettings, profileId: loaded.summary.id };
17
+ }
9
18
  /**
10
19
  * A preset as a diff side, the way it converts: its base profile's stock
11
20
  * settings with its changes written over them. Shared by the CLI's
@@ -14,7 +23,7 @@ export async function diffReference(catalog, profileId) {
14
23
  */
15
24
  export async function presetDiffSide(preset, catalog) {
16
25
  const resolved = await resolvePreset(preset, catalog);
17
- const loaded = await catalog.load(resolved.profileId);
26
+ const loaded = await catalogEngine(catalog).load(resolved.profileId);
18
27
  const settings = structuredClone(loaded.convertProfile.profile.baselineProjectSettings);
19
28
  applyPresetChanges(settings, resolved.changes, []);
20
29
  const name = typeof preset.name === "string" ? preset.name.slice(0, 40) : "";
@@ -3,9 +3,12 @@
3
3
  * - `flow-variants`: two values, another printer's standard nozzle, then its high-flow nozzle.
4
4
  * - `nozzle-variants`: one value per nozzle of a two-nozzle printer, standard then high flow for each.
5
5
  */
6
- export type ValueLayout = "u1-hotends" | "flow-variants" | "nozzle-variants";
6
+ export declare const VALUE_LAYOUTS: readonly ["u1-hotends", "flow-variants", "nozzle-variants"];
7
+ export type KnownValueLayout = (typeof VALUE_LAYOUTS)[number];
8
+ /** One of {@link VALUE_LAYOUTS}, or a layout a later any2orca release added: show the values of one you don't recognize as they are. */
9
+ export type ValueLayout = KnownValueLayout | (string & {});
7
10
  /** One sentence per layout, for a note above a table of values. The web app and the CLI both use these. */
8
- export declare const VALUE_LAYOUT_TEXT: Readonly<Record<ValueLayout, string>>;
11
+ export declare const VALUE_LAYOUT_TEXT: Readonly<Record<KnownValueLayout, string>>;
9
12
  /** Settings for a printer other than the U1 (a missing model counts as the U1: stock profiles and presets). */
10
13
  export declare function isOtherPrinter(settings: Readonly<Record<string, unknown>>): boolean;
11
14
  /**
@@ -14,13 +14,18 @@
14
14
  */
15
15
  import { FILAMENT_FLOW_VARIANT_KEYS } from "../engine/applyFilamentFlowVariants.js";
16
16
  import { NOZZLE_VARIANT_KEYS } from "../engine/collapseNozzleVariants.js";
17
+ /**
18
+ * - `u1-hotends`: two values, the U1's standard hotend, then the Liber High Flow Hotend.
19
+ * - `flow-variants`: two values, another printer's standard nozzle, then its high-flow nozzle.
20
+ * - `nozzle-variants`: one value per nozzle of a two-nozzle printer, standard then high flow for each.
21
+ */
22
+ export const VALUE_LAYOUTS = ["u1-hotends", "flow-variants", "nozzle-variants"];
17
23
  /** One sentence per layout, for a note above a table of values. The web app and the CLI both use these. */
18
24
  export const VALUE_LAYOUT_TEXT = {
19
25
  "u1-hotends": "Two values: standard hotend, then Liber High Flow Hotend.",
20
26
  "flow-variants": "Two values: the original printer's standard nozzle, then its high-flow nozzle.",
21
27
  "nozzle-variants": "One value per nozzle of the original printer, standard then high flow for each.",
22
28
  };
23
- const LAYOUT_ORDER = ["u1-hotends", "flow-variants", "nozzle-variants"];
24
29
  const FILAMENT_PAIRS = new Set(FILAMENT_FLOW_VARIANT_KEYS);
25
30
  /** Settings for a printer other than the U1 (a missing model counts as the U1: stock profiles and presets). */
26
31
  export function isOtherPrinter(settings) {
@@ -61,5 +66,5 @@ export function valueLayoutNotes(rows) {
61
66
  for (const layout of Object.values(row.layout ?? {}))
62
67
  if (layout)
63
68
  used.add(layout);
64
- return LAYOUT_ORDER.filter((l) => used.has(l)).map((l) => VALUE_LAYOUT_TEXT[l]);
69
+ return VALUE_LAYOUTS.filter((l) => used.has(l)).map((l) => VALUE_LAYOUT_TEXT[l]);
65
70
  }
@@ -1,7 +1,9 @@
1
1
  import type { JsonRecord } from "./types.js";
2
2
  /** Nozzle diameters we carry a Snapmaker U1 profile for, smallest first. */
3
3
  export declare const SUPPORTED_NOZZLE_DIAMETERS: readonly ["0.2", "0.4", "0.6", "0.8"];
4
- export type SupportedNozzleDiameter = (typeof SUPPORTED_NOZZLE_DIAMETERS)[number];
4
+ export type KnownNozzleDiameter = (typeof SUPPORTED_NOZZLE_DIAMETERS)[number];
5
+ /** One of {@link SUPPORTED_NOZZLE_DIAMETERS}, or a size a later catalog added. */
6
+ export type SupportedNozzleDiameter = KnownNozzleDiameter | (string & {});
5
7
  /**
6
8
  * Reads the Bambu source's own `nozzle_diameter` (blocklisted from the
7
9
  * merge itself, but still present in the raw uploaded project settings)
package/dist/errors.d.ts CHANGED
@@ -10,7 +10,10 @@
10
10
  * - `invalid_preset`: a preset or presets file that is malformed, over a limit, or can't be used with the given options.
11
11
  * - `preset_base_unknown`: a file a preset can't be made from, because it isn't set up for a profile in the catalog.
12
12
  */
13
- export type Any2orcaErrorCode = "invalid_file" | "unsupported_slicer" | "too_large" | "invalid_project" | "profile_not_found" | "release_not_found" | "profile_data" | "invalid_preset" | "preset_base_unknown";
13
+ export declare const ANY2ORCA_ERROR_CODES: readonly ["invalid_file", "unsupported_slicer", "too_large", "invalid_project", "profile_not_found", "release_not_found", "profile_data", "invalid_preset", "preset_base_unknown"];
14
+ export type KnownAny2orcaErrorCode = (typeof ANY2ORCA_ERROR_CODES)[number];
15
+ /** One of {@link ANY2ORCA_ERROR_CODES}, or a code a later any2orca release added: treat one you don't recognize as a failure of the same kind as `invalid_file`. */
16
+ export type Any2orcaErrorCode = KnownAny2orcaErrorCode | (string & {});
14
17
  export declare class Any2orcaError extends Error {
15
18
  name: string;
16
19
  readonly code: Any2orcaErrorCode;
package/dist/errors.js CHANGED
@@ -1,4 +1,27 @@
1
1
  // SPDX-License-Identifier: MIT
2
+ /**
3
+ * What went wrong, as a stable code a UI can branch on:
4
+ * - `invalid_file`: not a readable 3MF (corrupt zip, missing project files, unsafe entries).
5
+ * - `unsupported_slicer`: a readable project from a slicer this doesn't convert (SuperSlicer, say, or an older AnycubicSlicer, both built on PrusaSlicer); `slicer` names it.
6
+ * - `too_large`: a project that unpacks to more than the size limit (2 GB by default; `maxUnpackedBytes` changes it).
7
+ * - `invalid_project`: a readable 3MF whose settings or objects are malformed or over a limit.
8
+ * - `profile_not_found`: the requested profile id isn't in the catalog and wasn't retired.
9
+ * - `release_not_found`: the requested Snapmaker Orca release isn't one the profile catalog holds.
10
+ * - `profile_data`: the profile catalog itself is missing or malformed.
11
+ * - `invalid_preset`: a preset or presets file that is malformed, over a limit, or can't be used with the given options.
12
+ * - `preset_base_unknown`: a file a preset can't be made from, because it isn't set up for a profile in the catalog.
13
+ */
14
+ export const ANY2ORCA_ERROR_CODES = [
15
+ "invalid_file",
16
+ "unsupported_slicer",
17
+ "too_large",
18
+ "invalid_project",
19
+ "profile_not_found",
20
+ "release_not_found",
21
+ "profile_data",
22
+ "invalid_preset",
23
+ "preset_base_unknown",
24
+ ];
2
25
  export class Any2orcaError extends Error {
3
26
  name = "Any2orcaError";
4
27
  code;
@@ -15,7 +15,11 @@
15
15
  import { type SettingsDiff } from "../diff/diffSettings.js";
16
16
  import { type ValueLayout } from "../diff/valueLayout.js";
17
17
  import type { JsonRecord } from "../engine/types.js";
18
- export type ChangeReason = "creator" | "stock" | "capped" | "firmware" | "layout" | "yours";
18
+ /** Why a setting changed, in the order the explanation lists them. */
19
+ export declare const CHANGE_REASONS: readonly ["creator", "stock", "capped", "firmware", "layout", "yours"];
20
+ export type KnownChangeReason = (typeof CHANGE_REASONS)[number];
21
+ /** One of {@link CHANGE_REASONS}, or a reason a later any2orca release added: show one you don't recognize as it is. */
22
+ export type ChangeReason = KnownChangeReason | (string & {});
19
23
  export interface ChangeItem {
20
24
  /** The setting's key, or absent for an item that isn't one setting (an object moved, a summary). */
21
25
  key?: string;
@@ -16,6 +16,8 @@
16
16
  import { BOOKKEEPING_KEYS, labelOf, sameSetting } from "../diff/diffSettings.js";
17
17
  import { SETTINGS_CATALOG, SETTINGS_CATALOG_SOURCE } from "../diff/settingsCatalog.js";
18
18
  import { valueLayout, valueLayoutNotes } from "../diff/valueLayout.js";
19
+ /** Why a setting changed, in the order the explanation lists them. */
20
+ export const CHANGE_REASONS = ["creator", "stock", "capped", "firmware", "layout", "yours"];
19
21
  const GROUPS = [
20
22
  { reason: "creator", title: "From the creator's file", description: "Settings the creator changed, carried into the converted file. Before: Snapmaker's stock value. After: the creator's." },
21
23
  { reason: "stock", title: "Kept at Snapmaker's stock value", description: "Settings the creator's file has with another value, which the converted file doesn't use. Before: the creator's file. After: Snapmaker's stock value." },
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * any2orca: convert Bambu Studio, Creality Print, Anycubic Slicer Next,
3
- * ElegooSlicer, Flash Studio and PrusaSlicer 3MF projects for the Snapmaker U1
3
+ * ElegooSlicer, Flash Studio, QIDI Studio and PrusaSlicer 3MF projects for the Snapmaker U1
4
4
  * (Snapmaker Orca), entirely in the caller's own process. The library makes no network
5
5
  * requests of its own; profile data comes from a {@link ProfileSource} the
6
6
  * caller provides.
@@ -9,42 +9,41 @@
9
9
  * sources see `any2orca/node`; for a ready-made Web Worker see
10
10
  * `any2orca/worker`.
11
11
  */
12
- export { convert, inspect, openProject, matchProfile, unwrapBundle, cleanWarnings, Project } from "./project.js";
13
- export type { ConvertOptions, ConvertReport, ConvertResult, ConvertStage, OpenOptions, ProfileChoice, ReportFilament } from "./project.js";
12
+ export { convert, inspect, openProject, matchProfile, unwrapBundle, Project, CONVERT_STAGES } from "./project.js";
13
+ export type { ConvertOptions, ConvertReport, ConvertResult, ConvertStage, KnownConvertStage, OpenOptions, ProfileChoice, ReportFilament } from "./project.js";
14
14
  export { DEFAULT_MAX_UNPACKED_BYTES, LARGE_PROJECT_BYTES, MAX_UNPACKED_BYTES_LIMIT } from "./archive/safeUnzip.js";
15
- export type { FilamentSlotInfo, Inspection, SourceVendor } from "./inspect.js";
16
- export { fetchProfileSource, isReleasePath, listProfiles, loadCatalog, memoryProfileSource, ProfileCatalog, ProfileDataError, MAX_INDEX_BYTES, MAX_PROFILE_BYTES, } from "./profiles.js";
17
- export type { LoadedProfile, MemoryCatalogData, ProfileIndex, ProfileSource, ProfileSummary, RetiredProfile, SlicerRelease } from "./profiles.js";
18
- export { parseTierName, normalizeTierName } from "./engine/parseTierName.js";
19
- export { pickProfile } from "./engine/pickProfile.js";
20
- export type { PickProfileResult, TierAwareProfileCandidate } from "./engine/pickProfile.js";
21
- export { detectNozzleDiameter, SUPPORTED_NOZZLE_DIAMETERS } from "./engine/detectNozzleDiameter.js";
22
- export { matchFilamentLine, resolveFilamentName } from "./engine/filamentComplianceNames.js";
15
+ export { SOURCE_VENDORS } from "./inspect.js";
16
+ export type { FilamentSlotInfo, Inspection, KnownSourceVendor, SourceVendor } from "./inspect.js";
17
+ export { SOURCE_FORMATS } from "./sources/reader.js";
18
+ export type { KnownSourceFormat, SourceFormat } from "./sources/reader.js";
19
+ export { SUPPORTED_NOZZLE_DIAMETERS } from "./engine/detectNozzleDiameter.js";
20
+ export type { KnownNozzleDiameter, SupportedNozzleDiameter } from "./engine/detectNozzleDiameter.js";
21
+ export { fetchProfileSource, listProfiles, loadCatalog, memoryProfileSource, ProfileCatalog, ProfileDataError } from "./profiles.js";
22
+ export type { MemoryCatalogData, ProfileIndex, ProfileIndexPrinter, ProfileIndexProfile, ProfileIndexRelease, ProfileIndexSource, ProfileSource, ProfileSummary, RetiredProfile, SlicerRelease, } from "./profiles.js";
23
+ export { resolveFilamentName } from "./engine/filamentComplianceNames.js";
23
24
  export type { FilamentComplianceMode, FilamentLine, FilamentNameResult, FilamentNameTable, FilamentPresetEntry, } from "./engine/filamentComplianceNames.js";
24
- export { lookupFilamentColorName, parseFilamentType } from "./archive/lookupFilamentColorName.js";
25
- export type { FilamentColorMatch } from "./archive/lookupFilamentColorName.js";
25
+ export type { FilamentColorMatch, FilamentColorVendor } from "./archive/lookupFilamentColorName.js";
26
26
  export type { BundleEntry } from "./archive/unwrapBundle.js";
27
- export { Any2orcaError } from "./errors.js";
28
- export type { Any2orcaErrorCode } from "./errors.js";
29
- export { decodeStamp, OutputStampSchema, STAMP_PATH } from "./stamp.js";
30
- export { diffSettings, labelOf, BOOKKEEPING_KEYS, MAX_DIFF_KEYS } from "./diff/diffSettings.js";
31
- export { valueLayout, valueLayoutNotes, VALUE_LAYOUT_TEXT } from "./diff/valueLayout.js";
32
- export type { ValueLayout } from "./diff/valueLayout.js";
33
- export type { DiffAttention, DiffGroup, DiffGroupName, DiffOptions, DiffRow, DiffStatus, SettingsDiff, SettingsSide } from "./diff/diffSettings.js";
34
- export { diffReference, presetDiffSide } from "./diff/reference.js";
35
- export { SETTINGS_CATALOG, SETTINGS_CATALOG_SOURCE } from "./diff/settingsCatalog.js";
27
+ export { Any2orcaError, ANY2ORCA_ERROR_CODES } from "./errors.js";
28
+ export type { Any2orcaErrorCode, KnownAny2orcaErrorCode } from "./errors.js";
29
+ export { decodeStamp, STAMP_PATH } from "./stamp.js";
30
+ export type { OutputStampAboveStock, OutputStampPreset } from "./stamp.js";
31
+ export { diffSettings, DIFF_ATTENTIONS, DIFF_STATUSES } from "./diff/diffSettings.js";
32
+ export { valueLayoutNotes, VALUE_LAYOUTS } from "./diff/valueLayout.js";
33
+ export type { KnownValueLayout, ValueLayout } from "./diff/valueLayout.js";
34
+ export type { DiffAttention, DiffGroup, DiffGroupName, DiffOptions, DiffRow, DiffStatus, KnownDiffAttention, KnownDiffStatus, SettingsDiff, SettingsSide, } from "./diff/diffSettings.js";
35
+ export { diffReference, presetDiffSide, stockDiffSide } from "./diff/reference.js";
36
36
  export type { SettingGroup, SettingInfo } from "./diff/settingsCatalog.js";
37
- export { formatWhatChanged } from "./explain/whatChanged.js";
38
- export type { ChangeGroup, ChangeItem, ChangeReason, WhatChanged } from "./explain/whatChanged.js";
37
+ export { formatWhatChanged, CHANGE_REASONS } from "./explain/whatChanged.js";
38
+ export type { ChangeGroup, ChangeItem, ChangeReason, KnownChangeReason, WhatChanged } from "./explain/whatChanged.js";
39
39
  export { extractPreset } from "./presets/extractPreset.js";
40
- export { parsePresetFile, serializePresets, resolvePreset, presetFingerprint, withoutChanges, PresetSchema, PresetFileSchema, MAX_PRESET_NAME_LENGTH, MAX_PRESETS_PER_FILE, MAX_PRESETS_FILE_BYTES, } from "./presets/preset.js";
40
+ export { parsePresetFile, serializePresets, resolvePreset, withoutChanges, MAX_PRESET_NAME_LENGTH, MAX_PRESETS_PER_FILE, MAX_PRESETS_FILE_BYTES } from "./presets/preset.js";
41
41
  export type { ExtractedPreset, Preset, PresetChange, PresetFile, PresetValue, ResolvedPreset } from "./presets/preset.js";
42
- export { PRESET_KEYS, PRESET_EXCLUDED_KEYS } from "./presets/presetKeys.js";
43
- export { ABOVE_STOCK_DEFAULTS } from "./engine/aboveStock.js";
44
42
  export type { AboveStockChoice, AboveStockDefault } from "./engine/aboveStock.js";
45
43
  export type { OutputStamp } from "./stamp.js";
46
- export { buildStatsEvent, NEVER_SENT, NO_STATS_CHOICE, recordStatsChoice, REF_PATTERN, resolveStatsConsent, StatsEventSchema, } from "./telemetry.js";
47
- export type { StatsConsent, StatsConsentState, StatsEvent, StatsEventInput } from "./telemetry.js";
48
- export type { ConvertObject, HighFlowHotends, MatchSource, ProfileMatch, Shifts } from "./schema.js";
44
+ export { buildStatsEvent, parseStatsEvent, receiveStatsEvent, resolveStatsConsent, STATS_MATCH_SOURCES } from "./telemetry.js";
45
+ export type { KnownStatsMatchSource, StatsConsent, StatsConsentState, StatsEvent, StatsEventInput, StatsMatchSource } from "./telemetry.js";
46
+ export { MATCH_SOURCES } from "./schema.js";
47
+ export type { ConvertObject, HighFlowHotends, KnownMatchSource, MatchSource, ProfileMatch, Shifts } from "./schema.js";
49
48
  export { plainText } from "./plainText.js";
50
49
  export { VERSION } from "./version.js";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  /**
3
3
  * any2orca: convert Bambu Studio, Creality Print, Anycubic Slicer Next,
4
- * ElegooSlicer, Flash Studio and PrusaSlicer 3MF projects for the Snapmaker U1
4
+ * ElegooSlicer, Flash Studio, QIDI Studio and PrusaSlicer 3MF projects for the Snapmaker U1
5
5
  * (Snapmaker Orca), entirely in the caller's own process. The library makes no network
6
6
  * requests of its own; profile data comes from a {@link ProfileSource} the
7
7
  * caller provides.
@@ -10,25 +10,22 @@
10
10
  * sources see `any2orca/node`; for a ready-made Web Worker see
11
11
  * `any2orca/worker`.
12
12
  */
13
- export { convert, inspect, openProject, matchProfile, unwrapBundle, cleanWarnings, Project } from "./project.js";
13
+ export { convert, inspect, openProject, matchProfile, unwrapBundle, Project, CONVERT_STAGES } from "./project.js";
14
14
  export { DEFAULT_MAX_UNPACKED_BYTES, LARGE_PROJECT_BYTES, MAX_UNPACKED_BYTES_LIMIT } from "./archive/safeUnzip.js";
15
- export { fetchProfileSource, isReleasePath, listProfiles, loadCatalog, memoryProfileSource, ProfileCatalog, ProfileDataError, MAX_INDEX_BYTES, MAX_PROFILE_BYTES, } from "./profiles.js";
16
- export { parseTierName, normalizeTierName } from "./engine/parseTierName.js";
17
- export { pickProfile } from "./engine/pickProfile.js";
18
- export { detectNozzleDiameter, SUPPORTED_NOZZLE_DIAMETERS } from "./engine/detectNozzleDiameter.js";
19
- export { matchFilamentLine, resolveFilamentName } from "./engine/filamentComplianceNames.js";
20
- export { lookupFilamentColorName, parseFilamentType } from "./archive/lookupFilamentColorName.js";
21
- export { Any2orcaError } from "./errors.js";
22
- export { decodeStamp, OutputStampSchema, STAMP_PATH } from "./stamp.js";
23
- export { diffSettings, labelOf, BOOKKEEPING_KEYS, MAX_DIFF_KEYS } from "./diff/diffSettings.js";
24
- export { valueLayout, valueLayoutNotes, VALUE_LAYOUT_TEXT } from "./diff/valueLayout.js";
25
- export { diffReference, presetDiffSide } from "./diff/reference.js";
26
- export { SETTINGS_CATALOG, SETTINGS_CATALOG_SOURCE } from "./diff/settingsCatalog.js";
27
- export { formatWhatChanged } from "./explain/whatChanged.js";
15
+ export { SOURCE_VENDORS } from "./inspect.js";
16
+ export { SOURCE_FORMATS } from "./sources/reader.js";
17
+ export { SUPPORTED_NOZZLE_DIAMETERS } from "./engine/detectNozzleDiameter.js";
18
+ export { fetchProfileSource, listProfiles, loadCatalog, memoryProfileSource, ProfileCatalog, ProfileDataError } from "./profiles.js";
19
+ export { resolveFilamentName } from "./engine/filamentComplianceNames.js";
20
+ export { Any2orcaError, ANY2ORCA_ERROR_CODES } from "./errors.js";
21
+ export { decodeStamp, STAMP_PATH } from "./stamp.js";
22
+ export { diffSettings, DIFF_ATTENTIONS, DIFF_STATUSES } from "./diff/diffSettings.js";
23
+ export { valueLayoutNotes, VALUE_LAYOUTS } from "./diff/valueLayout.js";
24
+ export { diffReference, presetDiffSide, stockDiffSide } from "./diff/reference.js";
25
+ export { formatWhatChanged, CHANGE_REASONS } from "./explain/whatChanged.js";
28
26
  export { extractPreset } from "./presets/extractPreset.js";
29
- export { parsePresetFile, serializePresets, resolvePreset, presetFingerprint, withoutChanges, PresetSchema, PresetFileSchema, MAX_PRESET_NAME_LENGTH, MAX_PRESETS_PER_FILE, MAX_PRESETS_FILE_BYTES, } from "./presets/preset.js";
30
- export { PRESET_KEYS, PRESET_EXCLUDED_KEYS } from "./presets/presetKeys.js";
31
- export { ABOVE_STOCK_DEFAULTS } from "./engine/aboveStock.js";
32
- export { buildStatsEvent, NEVER_SENT, NO_STATS_CHOICE, recordStatsChoice, REF_PATTERN, resolveStatsConsent, StatsEventSchema, } from "./telemetry.js";
27
+ export { parsePresetFile, serializePresets, resolvePreset, withoutChanges, MAX_PRESET_NAME_LENGTH, MAX_PRESETS_PER_FILE, MAX_PRESETS_FILE_BYTES } from "./presets/preset.js";
28
+ export { buildStatsEvent, parseStatsEvent, receiveStatsEvent, resolveStatsConsent, STATS_MATCH_SOURCES } from "./telemetry.js";
29
+ export { MATCH_SOURCES } from "./schema.js";
33
30
  export { plainText } from "./plainText.js";
34
31
  export { VERSION } from "./version.js";
package/dist/inspect.d.ts CHANGED
@@ -8,8 +8,14 @@
8
8
  import { type FilamentColorMatch } from "./archive/lookupFilamentColorName.js";
9
9
  import { type SupportedNozzleDiameter } from "./engine/detectNozzleDiameter.js";
10
10
  import type { ConvertObject } from "./schema.js";
11
- /** The printer maker a source file was set up for, from its `printer_model`. */
12
- export type SourceVendor = "bambu" | "creality" | "anycubic" | "snapmaker" | "elegoo" | "prusa" | "flashforge" | "other";
11
+ /** The printer makers any2orca recognizes, from a project's printer and preset names; "other" for any it doesn't. */
12
+ export declare const SOURCE_VENDORS: readonly ["bambu", "creality", "anycubic", "snapmaker", "elegoo", "prusa", "flashforge", "qidi", "other"];
13
+ export type KnownSourceVendor = (typeof SOURCE_VENDORS)[number];
14
+ /**
15
+ * The printer maker a source file was set up for: one of {@link SOURCE_VENDORS}, or a maker a later any2orca
16
+ * release added. Treat a value you don't recognize like "other".
17
+ */
18
+ export type SourceVendor = KnownSourceVendor | (string & {});
13
19
  export interface FilamentSlotInfo {
14
20
  /** 1-based slot number, as slicers show it. */
15
21
  slot: number;
@@ -64,6 +70,6 @@ export interface Inspection {
64
70
  */
65
71
  unpackedBytes: number;
66
72
  }
67
- export declare function detectSourceVendor(printerModel: string | null, sourcePresetName?: string | null, printerNotes?: string | null, printerPresetName?: string | null): SourceVendor;
73
+ export declare function detectSourceVendor(printerModel: string | null, sourcePresetName?: string | null, printerNotes?: string | null, printerPresetName?: string | null, filamentPresetName?: string | null): SourceVendor;
68
74
  /** Builds an {@link Inspection} from a parsed project's settings and objects. */
69
75
  export declare function inspectProject(projectSettings: Record<string, unknown>, objects: ConvertObject[], warnings: readonly string[], unpackedBytes: number, sourcePlateOrigins?: Readonly<Record<number, readonly [number, number]>>, plateCount?: number): Inspection;
package/dist/inspect.js CHANGED
@@ -10,6 +10,8 @@ import { lookupFilamentColorName } from "./archive/lookupFilamentColorName.js";
10
10
  import { detectNozzleDiameter } from "./engine/detectNozzleDiameter.js";
11
11
  import { parseTierName } from "./engine/parseTierName.js";
12
12
  import { plainText } from "./plainText.js";
13
+ /** The printer makers any2orca recognizes, from a project's printer and preset names; "other" for any it doesn't. */
14
+ export const SOURCE_VENDORS = ["bambu", "creality", "anycubic", "snapmaker", "elegoo", "prusa", "flashforge", "qidi", "other"];
13
15
  const VENDOR_PATTERNS = [
14
16
  { vendor: "bambu", pattern: /^(bambu\s*lab|bbl)\b/i },
15
17
  { vendor: "creality", pattern: /^creality\b/i },
@@ -18,6 +20,7 @@ const VENDOR_PATTERNS = [
18
20
  { vendor: "elegoo", pattern: /^elegoo\b/i },
19
21
  { vendor: "prusa", pattern: /^(original\s+)?prusa\b/i },
20
22
  { vendor: "flashforge", pattern: /^flashforge\b/i },
23
+ { vendor: "qidi", pattern: /^qidi\b/i },
21
24
  ];
22
25
  const MAX_DISPLAY_STRING = 500;
23
26
  function asDisplayString(value) {
@@ -42,18 +45,21 @@ function guessMaterial(presetName) {
42
45
  /**
43
46
  * The source printer's maker, from `printer_model` (e.g. "Creality K2 Plus"),
44
47
  * falling back to the printer named after "@" in the process preset (e.g.
45
- * "0.20mm Standard @BBL X1C"). Not the 3MF's Application tag: Anycubic
46
- * Slicer Next writes "BambuStudio" there.
48
+ * "0.20mm Standard @BBL X1C"), then in the first filament preset (QIDI
49
+ * Studio's printer model and process preset say only "Q1 Pro"; its filament
50
+ * presets say "@Qidi Q1 Pro 0.4 nozzle"). Not the 3MF's Application tag:
51
+ * Anycubic Slicer Next writes "BambuStudio" there.
47
52
  */
48
53
  /** PrusaSlicer's printer profiles name their maker in `printer_notes` ("PRINTER_VENDOR_PRUSA3D"), where the model name doesn't. */
49
54
  const NOTES_VENDORS = { PRUSA3D: "prusa", CREALITY: "creality", ANYCUBIC: "anycubic", ELEGOO: "elegoo", FLASHFORGE: "flashforge", SNAPMAKER: "snapmaker", BBL: "bambu" };
50
- export function detectSourceVendor(printerModel, sourcePresetName = null, printerNotes = null, printerPresetName = null) {
55
+ export function detectSourceVendor(printerModel, sourcePresetName = null, printerNotes = null, printerPresetName = null, filamentPresetName = null) {
51
56
  const presetPrinter = sourcePresetName?.split("@")[1]?.trim() ?? null;
57
+ const filamentPrinter = filamentPresetName?.split("@")[1]?.trim() ?? null;
52
58
  const notesVendor = /\bPRINTER_VENDOR_([A-Z0-9]{1,20})\b/.exec(printerNotes ?? "")?.[1];
53
59
  if (notesVendor && Object.hasOwn(NOTES_VENDORS, notesVendor))
54
60
  return NOTES_VENDORS[notesVendor];
55
61
  // The printer preset's name last: PrusaSlicer's `printer_model` is a code ("COREONE"), its preset name says "Prusa CORE One".
56
- for (const candidate of [printerModel, presetPrinter, printerPresetName]) {
62
+ for (const candidate of [printerModel, presetPrinter, printerPresetName, filamentPrinter]) {
57
63
  if (!candidate)
58
64
  continue;
59
65
  const match = VENDOR_PATTERNS.find(({ pattern }) => pattern.test(candidate));
@@ -99,7 +105,7 @@ export function inspectProject(projectSettings, objects, warnings, unpackedBytes
99
105
  sourcePresetName,
100
106
  tierName: typeof projectSettings.print_settings_id === "string" ? parseTierName(projectSettings.print_settings_id) : null,
101
107
  printerModel,
102
- sourceVendor: detectSourceVendor(printerModel, sourcePresetName, typeof projectSettings.printer_notes === "string" ? projectSettings.printer_notes.slice(0, 4000) : null, asDisplayString(projectSettings.printer_settings_id)),
108
+ sourceVendor: detectSourceVendor(printerModel, sourcePresetName, typeof projectSettings.printer_notes === "string" ? projectSettings.printer_notes.slice(0, 4000) : null, asDisplayString(projectSettings.printer_settings_id), names[0]?.slice(0, 200) ?? null),
103
109
  slicerVersion: asDisplayString(projectSettings.version),
104
110
  sourcePrintableArea: Array.isArray(printableArea) && printableArea.length <= 64 && printableArea.every((p) => typeof p === "string")
105
111
  ? printableArea.slice()