any2orca 0.3.2 → 0.4.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # any2orca
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Features
6
+
7
+ - **The report lists every filament, with the name it had and the name it has.** `report.filaments` has one entry per slot, in the file's order: slot, color, type, the source preset name and the output name (the same, or what the naming option renamed it to). `any2orca convert --verbose` prints the list. Every filament stays, however many: the U1 loads four at a time, but a project can use many more, swapped in at the pauses planned in Snapmaker Orca, and that planning depends on the file's own order; a test now guards that nothing is dropped, merged or reordered.
8
+ - **The report says why a profile was matched.** `report.profileNotes` carries the matcher's sentences when an auto-match wasn't plain (the source nozzle has no U1 profile, say); empty for an exact match, a given profile id or a preset.
9
+ - **A project from a slicer the library doesn't convert has its own error code.** A readable project saved by PrusaSlicer, or a slicer built on it, now fails with `unsupported_slicer`, with the slicer's name in `error.slicer`, instead of `invalid_file`; the message is unchanged. A damaged file stays `invalid_file`, so an app can tell the two apart.
10
+
11
+ ### Other
12
+
13
+ - **The model's own metadata is kept,** as before: designer, license, copyright, title, origin and description in `3D/3dmodel.model` stay as they were, and only `Application` changes. A test now says so, and the README too.
14
+ - **The worker docs say how to go on after a failed worker:** listen for its `error` event, make a new one, and open the other files again.
15
+
3
16
  ## 0.3.2
4
17
 
5
18
  ### Fixes
package/README.md CHANGED
@@ -13,10 +13,30 @@ npx any2orca convert bundle.zip # a zip of several .3mf files is a bat
13
13
  npx any2orca profiles # the profiles --profile accepts
14
14
  ```
15
15
 
16
- Useful options: `--profile <id>`, `--snapmaker-orca-version <x.y.z>` (the Snapmaker Orca release you slice with; default the newest), `--high-flow` or `--high-flow-toolheads 1,3` (which toolheads have the Liber High Flow Hotend), `--hardened-nozzle` (hardened steel nozzles instead of the stock stainless 0.4), `--filament-compliance generic|snapmaker`, `--dry-run`, `--watch <folder>`, `--archive-dir`, `--skip-existing`, `--profiles-dir`. Run `any2orca convert --help` for all of them. The exit code is 1 if any file failed. Full reference, including exit codes, the state file and `telemetry`: [`docs/cli.md`](../../docs/cli.md).
16
+ Useful options:
17
+
18
+ | Option | What it does |
19
+ |---|---|
20
+ | `--profile <id>` | Use this profile instead of matching one |
21
+ | `--snapmaker-orca-version <x.y.z>` | Convert for the Snapmaker Orca release you slice with (default: the newest) |
22
+ | `--high-flow`, `--high-flow-toolheads 1,3` | All toolheads, or only these, have the Liber High Flow Hotend |
23
+ | `--hardened-nozzle` | Your nozzles are hardened steel instead of the stock stainless 0.4 |
24
+ | `--filament-compliance generic\|snapmaker` | Rename filaments for Snapmaker Space |
25
+ | `--dry-run` | Show what would happen, without writing files |
26
+ | `--watch <folder>` | Convert each new file that appears in a folder |
27
+ | `--archive-dir <dir>`, `--skip-existing` | For batches: move finished originals away, or skip files already converted |
28
+ | `--profiles-dir <dir>` | Use your own profile catalog |
29
+
30
+ `any2orca convert --help` lists them all. The exit code is 1 if any file failed.
31
+
32
+ The full reference, with exit codes, the state file and `telemetry`, is in [`docs/cli.md`](https://github.com/KuzuriAo/any2orca/blob/main/docs/cli.md).
17
33
 
18
34
  ## Library
19
35
 
36
+ Every exported function and type is in the [API reference](https://docs.any2orca.com). The common paths:
37
+
38
+ 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
+
20
40
  ```js
21
41
  import { readFile, writeFile } from "node:fs/promises";
22
42
  import { convert } from "any2orca";
@@ -56,11 +76,15 @@ catalog.releases(); // [{ version, application, isDefault }, ...], newest (the d
56
76
  const { output } = await convert(bytes, { profiles: catalog, snapmakerOrcaVersion: "2.4.0" });
57
77
  ```
58
78
 
59
- Pick the release the user slices with: Snapmaker Orca's command line stops at a value an older release doesn't accept. A release the catalog doesn't hold throws `Any2orcaError` with code `release_not_found`. Anything else that reads profiles (`matchProfile`, `extractPreset`, `resolvePreset`, `diffReference`) takes the catalog from `catalog.forRelease(version)`. See [Snapmaker Orca releases](../../docs/snapmaker-orca-releases.md).
79
+ - **Pick the release the user slices with.** Snapmaker Orca's command line stops at a value an older release doesn't accept.
80
+ - **A release the catalog doesn't hold** throws `Any2orcaError` with code `release_not_found`.
81
+ - **Everything else that reads profiles** (`matchProfile`, `extractPreset`, `resolvePreset`, `diffReference`) takes the catalog from `catalog.forRelease(version)`.
82
+
83
+ More in [Snapmaker Orca releases](https://github.com/KuzuriAo/any2orca/blob/main/docs/snapmaker-orca-releases.md).
60
84
 
61
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.
62
86
 
63
- Presets (your own tuned print settings, applied to other files; see [`docs/presets.md`](../../docs/presets.md)):
87
+ Presets (your own tuned print settings, applied to other files; see [`docs/presets.md`](https://github.com/KuzuriAo/any2orca/blob/main/docs/presets.md)):
64
88
 
65
89
  ```js
66
90
  import { extractPreset } from "any2orca";
@@ -69,7 +93,13 @@ const { preset, changes, notes } = await extractPreset(tunedBytes, { profiles })
69
93
  const { output, report } = await project.convert({ profiles, preset: { ...preset, name: "My settings" } });
70
94
  ```
71
95
 
72
- `parsePresetFile()` and `serializePresets()` read and write the `any2orca-presets` file format, with size and count limits. `report.whatChanged` records what the conversion changed, grouped by why (`formatWhatChanged()` for text, `explain: true` to add every difference; see [`docs/what-changed.md`](../../docs/what-changed.md)). `diffSettings()` compares any two sets of settings (see [`docs/compare-settings.md`](../../docs/compare-settings.md)).
96
+ More tools:
97
+
98
+ | Function | What it does | Guide |
99
+ |---|---|---|
100
+ | `parsePresetFile()`, `serializePresets()` | Read and write the `any2orca-presets` file format, with size and count limits | [Presets](https://github.com/KuzuriAo/any2orca/blob/main/docs/presets.md) |
101
+ | `report.whatChanged`, `formatWhatChanged()` | What the conversion changed, grouped by why; as text with `formatWhatChanged()`, and with every difference when you pass `explain: true` | [What changed](https://github.com/KuzuriAo/any2orca/blob/main/docs/what-changed.md) |
102
+ | `diffSettings()` | Compare any two sets of settings | [Compare settings](https://github.com/KuzuriAo/any2orca/blob/main/docs/compare-settings.md) |
73
103
 
74
104
  ## Web Worker
75
105
 
@@ -86,19 +116,34 @@ The converter also compares settings (`converter.diff()`), and makes, checks and
86
116
 
87
117
  Copy `node_modules/any2orca-profiles/data/` to your site's `/profiles/` folder. The worker fetches `index.json` and only the profile files it uses.
88
118
 
89
- If the worker fails to load or stops (out of memory on a very large file, say), every call in flight is rejected with a message saying so, and later calls are refused at once: create a new converter to try again.
119
+ If the worker fails to load or stops (out of memory on a very large file, say), every call in flight is rejected with a message saying so, and later calls are refused at once; the failed worker stays dead. To keep going after one oversized file, listen for the `Worker`'s `error` event, create a new `Worker` and a new converter from it, and open the other files again; nothing from the old one carries over.
90
120
 
91
121
  ## Errors and messages
92
122
 
93
- A call that fails throws `Any2orcaError` with a stable `code` (`invalid_file`, `too_large`, `invalid_project`, `profile_not_found`, `release_not_found`, `profile_data`, `invalid_preset`, `preset_base_unknown`), so a UI can branch on it. Its message, and every entry in `report.warnings`, is written for the person converting and doesn't name the library, so any app can show it as it is.
123
+ A call that fails throws `Any2orcaError`. Its `code` is stable, so a UI can branch on it:
94
124
 
95
- ## Strict content security policies
125
+ | Code | Meaning |
126
+ |---|---|
127
+ | `invalid_file` | Not a readable 3MF: a damaged zip, missing project files, unsafe entries |
128
+ | `unsupported_slicer` | A readable project from a slicer this doesn't convert (PrusaSlicer, say); `error.slicer` names it |
129
+ | `too_large` | The project unpacks to more than the size limit (2 GB by default) |
130
+ | `invalid_project` | A readable 3MF whose settings or objects are malformed or over a limit |
131
+ | `profile_not_found` | The profile id isn't in the catalog and wasn't retired |
132
+ | `release_not_found` | The Snapmaker Orca release isn't one the catalog holds |
133
+ | `profile_data` | The profile catalog itself is missing or malformed |
134
+ | `invalid_preset` | A preset or presets file that is malformed, over a limit, or can't be used with the options given |
135
+ | `preset_base_unknown` | A preset can't be made from this file: it isn't set up for a profile in the catalog |
136
+
137
+ The error's message, and every entry in `report.warnings`, is written for the person converting and doesn't name the library. Any app can show it as it is.
96
138
 
97
- The library evaluates no code, so it runs under a policy without `'unsafe-eval'`: a browser extension's, or a site's like any2orca.com's. It uses zod to check its input, and zod can compile faster parsers with the `Function` constructor, first calling it once to see whether it may. A strict policy refuses that call and reports a violation, so as it loads, before it creates any schema, the library turns zod's compiled parsers off (zod's `jitless` setting). Parsing gives the same results, and conversions take the same time.
139
+ ## Strict content security policies
98
140
 
99
- zod's setting is shared by every copy of zod in the same page or worker, so your own zod schemas parse the plain way too. To keep compiled parsers for them, call `z.config({ jitless: false })` before importing any2orca.
141
+ The library evaluates no code, so it runs under a policy without `'unsafe-eval'`, such as a browser extension's or any2orca.com's.
100
142
 
101
- A store linter that reads the code instead of running it (Firefox's `web-ext lint`) still reports one `DANGEROUS_EVAL` warning in a bundle that includes the library: it finds zod's check, which any2orca never lets run. [`examples/plugin-extension`](../../examples/plugin-extension) removes it with a small Vite plugin that replaces the check with its answer, and explains it for a store's reviewers.
143
+ - **Why this needs care:** the library checks its input with zod. zod can compile faster parsers with the `Function` constructor, and first calls it once to see whether it may. A strict policy refuses that call and reports a violation.
144
+ - **What the library does:** as it loads, before it creates any schema, it turns zod's compiled parsers off (zod's `jitless` setting). Parsing gives the same results, and conversions take the same time.
145
+ - **Your own zod schemas:** the setting is shared by every copy of zod in the same page or worker, so they parse the plain way too. To keep compiled parsers for them, call `z.config({ jitless: false })` before importing any2orca.
146
+ - **Store linters:** a linter that reads the code instead of running it (Firefox's `web-ext lint`) still reports one `DANGEROUS_EVAL` warning, for zod's check, which never runs. [`examples/plugin-extension`](https://github.com/KuzuriAo/any2orca/tree/main/examples/plugin-extension) removes it with a small Vite plugin, and explains it for a store's reviewers.
102
147
 
103
148
  ## What leaves your machine
104
149
 
@@ -113,12 +158,33 @@ Your files never do. The library makes no network requests. The CLI makes at mos
113
158
 
114
159
  ## Output stamp
115
160
 
116
- Every converted file gets a small entry, `Metadata/any2orca.json`, with the any2orca version, the profile catalog version, the profile used and the options chosen. It is there so a file can be recognized later: when a bug is found and fixed, the version inside tells you whether a file came from an affected release, and bug reports get exact details. It holds no file names, paths, times or identifiers, nothing reads it back by itself, and nothing is sent anywhere. To leave it out, pass `stamp: false` to `convert()`, or `--no-stamp` on the command line. `decodeStamp()` reads it back. Details: [`docs/output-stamp.md`](../../docs/output-stamp.md).
161
+ Every converted file gets a small entry, `Metadata/any2orca.json`.
162
+
163
+ - **What's in it:** the any2orca version, the profile catalog version, the profile used and the options chosen.
164
+ - **Why:** so a file can be recognized later. When a bug is fixed, the version inside tells you whether a file came from an affected release, and bug reports get exact details.
165
+ - **What isn't:** no file names, paths, times or identifiers. Nothing reads it back by itself, and nothing is sent anywhere.
166
+ - **To leave it out:** pass `stamp: false` to `convert()`, or `--no-stamp` on the command line. `decodeStamp()` reads it back.
167
+
168
+ Details: [`docs/output-stamp.md`](https://github.com/KuzuriAo/any2orca/blob/main/docs/output-stamp.md).
117
169
 
118
170
  ## Limits
119
171
 
120
- Files are read in memory, with limits that protect your machine from a malicious file: at most 10,000 zip entries and 2 GB unpacked in total by default (`maxUnpackedBytes` in code or `--max-unpacked` on the command line raises it, up to 16 GB; converting needs about twice the unpacked size in memory, and a project over 1 GB comes with a warning saying so), no entry over 10 MB (and no whole file) compressing more than 100:1, entry names of at most 1,024 characters and no unsafe entry paths, a main model file (`3D/3dmodel.model`) of at most 500 MB (projects saved with their meshes as separate part files have no such limit), project settings at most 2 MB and 64 levels deep, and at most 1,000 objects.
172
+ Files are read in memory, with limits that protect your machine from a malicious file:
173
+
174
+ | Limit | Value |
175
+ |---|---|
176
+ | Unpacked size, in total | 2 GB by default. `maxUnpackedBytes` in code or `--max-unpacked` on the command line raises it, up to 16 GB. Converting needs about twice the unpacked size in memory, and a project over 1 GB comes with a warning saying so. |
177
+ | Zip entries | At most 10,000 |
178
+ | Compression | No entry over 10 MB, and no whole file, compressing more than 100:1 |
179
+ | Entry names | At most 1,024 characters, and no unsafe paths |
180
+ | Main model file (`3D/3dmodel.model`) | At most 500 MB. Projects saved with their meshes as separate part files have no such limit. |
181
+ | Project settings | At most 2 MB, and 64 levels deep |
182
+ | Objects | At most 1,000 |
121
183
 
122
184
  ## License
123
185
 
124
- MIT. 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`](NOTICE) credits the data this package includes. any2orca is an independent project, not affiliated with, endorsed by, or sponsored by Snapmaker, Bambu Lab, OrcaSlicer or any printer, slicer or filament maker.
186
+ MIT.
187
+
188
+ 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
+
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.
@@ -52,7 +52,8 @@ export function prepareConvertRequest(fileBytes, maxUnpackedBytes) {
52
52
  // file and format: a project, but not one this converts.
53
53
  const otherFormatSettings = zipEntries[OTHER_FORMAT_SETTINGS_PATH];
54
54
  if (!projectSettingsBytes && otherFormatSettings) {
55
- throw new Any2orcaError("invalid_file", `This project was saved by ${otherFormatSlicer(otherFormatSettings)}, and only projects from Bambu Studio, Creality Print, Anycubic Slicer Next, ElegooSlicer and Flash Studio can be converted.`);
55
+ const slicer = otherFormatSlicer(otherFormatSettings);
56
+ throw new Any2orcaError("unsupported_slicer", `This project was saved by ${slicer}, and only projects from Bambu Studio, Creality Print, Anycubic Slicer Next, ElegooSlicer and Flash Studio can be converted.`, { slicer });
56
57
  }
57
58
  // A zip that isn't a 3MF at all (no model part, no print settings): a bundle of STL files, say.
58
59
  if (!projectSettingsBytes && !zipEntries[TOP_MODEL_PATH]) {
@@ -81,9 +81,13 @@ function logReport(report, verbose, logger) {
81
81
  logger.log(` warning: ${w}`);
82
82
  if (report.retiredProfile)
83
83
  logger.log(' note: run "any2orca profiles" for the current list.');
84
- if (verbose)
84
+ if (verbose) {
85
+ for (const f of report.filaments) {
86
+ logger.log(` filament ${f.slot}: ${f.color} ${f.type} ${f.outputName || "(no preset name)"}${f.outputName !== f.sourceName ? ` (was ${f.sourceName || "unnamed"})` : ""}`);
87
+ }
85
88
  for (const line of report.log)
86
89
  logger.log(` log: ${line}`);
90
+ }
87
91
  }
88
92
  /**
89
93
  * Whether retrying this exact file could give a different result. A
@@ -93,7 +97,7 @@ function logReport(report, verbose, logger) {
93
97
  */
94
98
  export function isPermanentFailure(err) {
95
99
  if (err instanceof Any2orcaError)
96
- return err.code === "invalid_file" || err.code === "too_large" || err.code === "invalid_project" || err.code === "profile_not_found" || err.code === "invalid_preset";
100
+ return err.code === "invalid_file" || err.code === "unsupported_slicer" || err.code === "too_large" || err.code === "invalid_project" || err.code === "profile_not_found" || err.code === "invalid_preset";
97
101
  const code = err?.code;
98
102
  if (typeof code === "string" && /^E[A-Z]+$/.test(code))
99
103
  return false;
package/dist/errors.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * What went wrong, as a stable code a UI can branch on:
3
3
  * - `invalid_file`: not a readable 3MF (corrupt zip, missing project files, unsafe entries).
4
+ * - `unsupported_slicer`: a readable project from a slicer this doesn't convert (PrusaSlicer, say); `slicer` names it.
4
5
  * - `too_large`: a project that unpacks to more than the size limit (2 GB by default; `maxUnpackedBytes` changes it).
5
6
  * - `invalid_project`: a readable 3MF whose settings or objects are malformed or over a limit.
6
7
  * - `profile_not_found`: the requested profile id isn't in the catalog and wasn't retired.
@@ -9,11 +10,14 @@
9
10
  * - `invalid_preset`: a preset or presets file that is malformed, over a limit, or can't be used with the given options.
10
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.
11
12
  */
12
- export type Any2orcaErrorCode = "invalid_file" | "too_large" | "invalid_project" | "profile_not_found" | "release_not_found" | "profile_data" | "invalid_preset" | "preset_base_unknown";
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
14
  export declare class Any2orcaError extends Error {
14
15
  name: string;
15
16
  readonly code: Any2orcaErrorCode;
17
+ /** With `unsupported_slicer`: the slicer the project names, as the message shows it. */
18
+ readonly slicer?: string;
16
19
  constructor(code: Any2orcaErrorCode, message: string, options?: {
17
20
  cause?: unknown;
21
+ slicer?: string;
18
22
  });
19
23
  }
package/dist/errors.js CHANGED
@@ -2,8 +2,12 @@
2
2
  export class Any2orcaError extends Error {
3
3
  name = "Any2orcaError";
4
4
  code;
5
+ /** With `unsupported_slicer`: the slicer the project names, as the message shows it. */
6
+ slicer;
5
7
  constructor(code, message, options) {
6
- super(message, options);
8
+ super(message, options?.cause === undefined ? undefined : { cause: options.cause });
7
9
  this.code = code;
10
+ if (options?.slicer !== undefined)
11
+ this.slicer = options.slicer;
8
12
  }
9
13
  }
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * `any2orca/worker`.
11
11
  */
12
12
  export { convert, inspect, openProject, matchProfile, unwrapBundle, cleanWarnings, Project } from "./project.js";
13
- export type { ConvertOptions, ConvertReport, ConvertResult, ConvertStage, OpenOptions, ProfileChoice } from "./project.js";
13
+ export type { ConvertOptions, ConvertReport, ConvertResult, ConvertStage, 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
15
  export type { FilamentSlotInfo, Inspection, SourceVendor } from "./inspect.js";
16
16
  export { fetchProfileSource, isReleasePath, listProfiles, loadCatalog, memoryProfileSource, ProfileCatalog, ProfileDataError, MAX_INDEX_BYTES, MAX_PROFILE_BYTES, } from "./profiles.js";
package/dist/project.d.ts CHANGED
@@ -71,11 +71,34 @@ export interface ConvertOptions {
71
71
  onProgress?: (stage: ConvertStage) => void;
72
72
  }
73
73
  export type ConvertStage = "matching" | "loading-profile" | "merging" | "writing";
74
+ /**
75
+ * One filament slot of the converted file, in the file's own order. Every
76
+ * filament is kept, however many: the U1 loads four at a time, but a project,
77
+ * even one plate, can use many more, swapped in at pauses the user plans in
78
+ * Snapmaker Orca; that planning depends on this order being the file's.
79
+ */
80
+ export interface ReportFilament {
81
+ /** 1-based slot number, as slicers show it. */
82
+ slot: number;
83
+ /** "#RRGGBB", unchanged from the source. */
84
+ color: string;
85
+ /** Material, e.g. "PLA", unchanged from the source. */
86
+ type: string;
87
+ /** The preset name the source file had, e.g. `"Bambu PLA Matte @BBL X1C"`. Empty if it had none. */
88
+ sourceName: string;
89
+ /** The preset name the converted file has: the same, or what `filamentComplianceMode` renamed it to. */
90
+ outputName: string;
91
+ }
74
92
  export interface ConvertReport {
75
93
  /** The profile the file was converted with. */
76
94
  profile: ProfileSummary;
77
95
  /** How the profile was matched; absent when `profileId` was given. */
78
96
  profileMatch?: ProfileMatch;
97
+ /**
98
+ * Why the profile was chosen, in sentences for the user, when it was auto-matched and the match wasn't plain
99
+ * (the source nozzle has no U1 profile, say). Empty for an exact match, a `profileId` or a preset.
100
+ */
101
+ profileNotes: string[];
79
102
  /** Set when `profileId` named a retired profile and its successor was used. */
80
103
  retiredProfile?: RetiredProfile;
81
104
  /** Notes worth showing the user, cleaned up for display. */
@@ -91,6 +114,8 @@ export interface ConvertReport {
91
114
  plates: number;
92
115
  objects: number;
93
116
  filamentSlots: number;
117
+ /** Every filament slot, in the file's order, with the name each has in the source and in the output. */
118
+ filaments: ReportFilament[];
94
119
  /** The stamp written into the output, or null if `stamp: false`. */
95
120
  stamp: OutputStamp | null;
96
121
  /** What the conversion changed, grouped by why. */
package/dist/project.js CHANGED
@@ -205,6 +205,7 @@ export class Project {
205
205
  const routeWarnings = [];
206
206
  let profileId;
207
207
  let profileMatch;
208
+ let profileNotes = [];
208
209
  let carrySourceLayerHeight = false;
209
210
  let retiredProfile;
210
211
  if (options.preset && options.profileId) {
@@ -228,6 +229,7 @@ export class Project {
228
229
  const choice = await matchProfile(this.request.projectSettings, catalog);
229
230
  profileId = choice.profileId;
230
231
  profileMatch = choice.profileMatch;
232
+ profileNotes = [...choice.notes];
231
233
  carrySourceLayerHeight = choice.carrySourceLayerHeight;
232
234
  routeWarnings.push(...choice.notes.map((note) => ` WARN: ${note}`));
233
235
  }
@@ -284,11 +286,20 @@ export class Project {
284
286
  const applyWarnings = [];
285
287
  const output = applyConvertResponse({ ...this.parsed, warnings: applyWarnings }, response, stamp ? { [STAMP_PATH]: encodeStamp(stamp) } : {});
286
288
  const inspection = this.inspect();
289
+ const outputNames = Array.isArray(response.projectSettings.filament_settings_id) ? response.projectSettings.filament_settings_id : [];
290
+ const filaments = inspection.filaments.map((f) => ({
291
+ slot: f.slot,
292
+ color: f.color,
293
+ type: f.type,
294
+ sourceName: f.presetName,
295
+ outputName: typeof outputNames[f.slot - 1] === "string" ? outputNames[f.slot - 1] : f.presetName,
296
+ }));
287
297
  return {
288
298
  output,
289
299
  report: {
290
300
  profile: loaded.summary,
291
301
  ...(profileMatch ? { profileMatch } : {}),
302
+ profileNotes,
292
303
  ...(retiredProfile ? { retiredProfile } : {}),
293
304
  warnings: cleanWarnings([...this.parsed.warnings, ...(response.warnings ?? []), ...applyWarnings.filter((w) => w.includes("WARN"))]),
294
305
  log: [...this.parsed.warnings, ...routeWarnings, ...pipeline.warnings, ...applyWarnings].map((w) => w.trim()).filter(Boolean),
@@ -298,6 +309,7 @@ export class Project {
298
309
  plates: Math.max(1, inspection.plates.length),
299
310
  objects: inspection.objects.length,
300
311
  filamentSlots: inspection.filaments.length,
312
+ filaments,
301
313
  stamp,
302
314
  whatChanged: toWhatChanged({ id: loaded.summary.id, displayName: loaded.summary.displayName, chosenBy: preset ? "preset" : options.profileId ? "you" : "matched" }, pipeline.changes, options.explain
303
315
  ? diffSettings({ label: "Original file", settings: this.request.projectSettings }, { label: "Converted file", settings: response.projectSettings })
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.3.2";
1
+ export declare const VERSION = "0.4.0";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  // Written by scripts/sync-version.mjs from package.json; a test checks they match.
3
- export const VERSION = "0.3.2";
3
+ export const VERSION = "0.4.0";
@@ -151,6 +151,7 @@ scope.onmessage = (event) => {
151
151
  error: {
152
152
  code: err instanceof Any2orcaError ? err.code : "invalid_file",
153
153
  message: err instanceof Error ? err.message : String(err),
154
+ ...(err instanceof Any2orcaError && err.slicer !== undefined ? { slicer: err.slicer } : {}),
154
155
  },
155
156
  }));
156
157
  };
package/dist/worker.js CHANGED
@@ -47,8 +47,10 @@ export function createConverterWorker(worker, options) {
47
47
  pending.delete(message.id);
48
48
  if (message.ok)
49
49
  entry.resolve(message.result);
50
- else
51
- entry.reject(new Any2orcaError(message.error.code, message.error.message));
50
+ else {
51
+ const slicer = message.error.slicer;
52
+ entry.reject(new Any2orcaError(message.error.code, message.error.message, typeof slicer === "string" ? { slicer } : undefined));
53
+ }
52
54
  });
53
55
  function call(body, transfer = [], onProgress) {
54
56
  if (terminated)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "any2orca",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "description": "Convert Bambu Studio, Creality Print, Anycubic Slicer Next, ElegooSlicer and Flash Studio 3MF projects for the Snapmaker U1 (Snapmaker Orca), entirely on your own machine. Library, CLI and Web Worker in one package.",
5
5
  "keywords": [
6
6
  "3mf",