@printhive/api 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,10 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.1
4
+
5
+ - Document print-job creation's 503 `catalog_store_failed` response, including optional per-slot failure details, in the generated OpenAPI contract. Runtime behavior is unchanged.
6
+ - Global filament search results now have `acceptedByCreate: true` when the organization's global-filament setting and shared catalog admission allow creation. Disabled global IDs remain unavailable to create and are excluded from search. Search and create use one admission operation.
7
+ - Accept enabled global filament IDs on print-job creation and normalize single-color catalog choices with the shared material color rules. Reject ambiguous colors and failed setting reads. Return `merged_into` on merged-filament slot errors. Existing catalog CRUD routes can still return merge tombstones.
8
+
3
9
  ## 0.4.0
4
10
 
5
11
  - Add typed `printers.search` and `filaments.search`, with bounded integer pagination and catalog `filamentId` values.
6
12
  - Reuse the web palette printer matcher and the filament picker ranking through narrow partner routes.
7
- - Add `acceptedByCreate` using the same catalog lookup and admission predicate as print-job creation. Global, unsynced, and invalid-color rows remain searchable with the flag false.
13
+ - Add `acceptedByCreate` for the catalog admission rules in 0.4.0. At that release, global, unsynced, and invalid-color rows were flagged false. Global support is added in 0.4.1.
8
14
  - Require Read scope on the existing `/v1/search` and `/v1/materials/command-search` API-key routes. Empty-scope keys receive 403.
9
15
 
10
16
  ## 0.3.2
package/README.md CHANGED
@@ -240,20 +240,40 @@ Errors include 400 `invalid_catalog_input`, 400 `conflicting_color_hex`, 403 `AP
240
240
  and 500 `catalog_store_failed`. Invalid bodies return the API validation error.
241
241
  Pass the returned `id` as `filaments[].filamentId` in JSON or multipart print-job
242
242
  creation. A slot can contain only `{ sourceSlot, filamentId }`, plus an optional
243
- `targetSlot`. Hive derives material and color from that organization catalog row.
243
+ `targetSlot`. Hive derives material and color from the catalog row.
244
244
  Explicit `material` and `color` must agree with the row. Material comparisons
245
245
  ignore case, and colors accept a leading `#` and either case.
246
246
 
247
+ Create also accepts global filament IDs. Global filaments are platform-managed
248
+ `materials` rows with no organization owner. Search reports their
249
+ `organization_id` as `"global"`. The organization's `materials.global_filaments_enabled`
250
+ setting must be enabled. The setting defaults to enabled when absent, as in the
251
+ web material picker and Smart Queue. Organization-owned rows still require a
252
+ `partner-catalog:` import source. Other organization materials are not admitted
253
+ through this catalog contract.
254
+
247
255
  A contradiction returns 422 `filament_catalog_conflict` with the `sourceSlot` in
248
- `filaments[]`. An unknown or foreign catalog ID returns 422
256
+ `filaments[]`. An unknown or foreign catalog ID, a merge tombstone, an organization
257
+ row outside the partner catalog, or a global ID when globals are disabled returns 422
249
258
  `catalog_filament_not_found` with the slot. Catalog rows without a material or a
250
- six-digit hex color return 422 `invalid_catalog_filament`.
259
+ readable color return 422 `invalid_catalog_filament`. The material must be at most
260
+ 100 characters. Hive reads `metadata.colors`, falling back to `color`, and normalizes
261
+ named colors and 8-digit hex colors to `#RRGGBB`. Multiple distinct colors, unreadable
262
+ colors, or disagreement between `metadata.colors` and `color` are rejected. Duplicate
263
+ representations of the same RGB color are accepted; alpha is discarded.
264
+
265
+ For an accessible merge tombstone, the slot error includes `merged_into`, the
266
+ replacement material ID. A setting read error returns 503 `catalog_store_failed`;
267
+ only a missing setting defaults to enabled.
251
268
 
252
269
  Stored requirements, waiting reasons, and load-step requirements retain
253
270
  `filamentId`, `brand`, `name`, `colorName`, `material`, and `colorHex`. Catalog
254
271
  identity is a snapshot. Multipart retries reuse the first saved catalog snapshot,
255
272
  even if the catalog changes. Matching still uses material and color proximity.
256
273
  Requests and stored jobs without `filamentId` keep their existing shape.
274
+ Catalog diameter is intentionally outside the typed requirement snapshot. Global,
275
+ partner-catalog, and manual requirements continue to match by material and color;
276
+ this change does not add an exact-product or filament-diameter constraint.
257
277
 
258
278
  Catalog validation errors in JSON or multipart creation do not reserve a new
259
279
  idempotency key or `externalId`. For JSON requests that include `filamentId`,
@@ -316,18 +336,27 @@ readiness; `printers.get(id)` returns stored printer details.
316
336
  `originalQuery`. Each `FilamentSearchResult` includes `id`, `filamentId`, name,
317
337
  brand, material type, color, diameter, category, organization, and optional SKU.
318
338
  `filamentId` equals the catalog material row's `id`. It is not an inventory item
319
- ID. `acceptedByCreate` reports whether the row satisfies the current partner
320
- catalog identity and material checks. It does not promise that a print job
339
+ ID. `acceptedByCreate` reports whether the row satisfies the same catalog
340
+ admission operation used by creation, including the organization's global-filament
341
+ setting, ownership, material, and normalized color checks. It does not promise that a print job
321
342
  passes file, plate, target, or dispatch admission.
322
343
 
323
344
  Filament search reuses the web Material Command Search picker, including its
324
345
  ranked database query and the organization's global-filament setting. It can
325
346
  return organization filaments and enabled global catalog filaments. Global
326
- rows have `organization_id: "global"`. Results also include unsynced organization
327
- rows and rows without a color. These rows do not satisfy the current partner
328
- catalog contract for `filaments[].filamentId` on `POST /v1/print-jobs/create`.
329
- These rows have `acceptedByCreate: false`. The contract requires an organization-owned partner catalog row, a material
330
- family, and a six-digit hex color. Search does not filter out other rows.
347
+ rows have `organization_id: "global"`. In SDK 0.4.1, eligible global rows have
348
+ `acceptedByCreate: true` and their IDs can be used in `filaments[].filamentId` on
349
+ `POST /v1/print-jobs/create`. When globals are disabled, search excludes those
350
+ rows and creation rejects their IDs with `catalog_filament_not_found`.
351
+
352
+ Organization-owned rows require `partner-catalog:` provenance. Unsynced rows,
353
+ merge tombstones, rows without a usable material or color, and rows with ambiguous
354
+ or conflicting colors have `acceptedByCreate: false` when returned by search.
355
+ The material must be at most 100 characters, and the color must normalize to one
356
+ RGB hex value under the shared material color rules. Named and 8-digit colors
357
+ are supported. Search does not otherwise filter out ineligible catalog rows.
358
+ An admission-setting read error returns 503; only a missing setting defaults to
359
+ enabled.
331
360
 
332
361
  Queries contain at most 100 characters. An empty query browses the catalog.
333
362
  Set the next offset to the previous offset plus the returned filament count
package/dist/index.d.cts CHANGED
@@ -1983,7 +1983,7 @@ interface paths {
1983
1983
  sourceSlot: number;
1984
1984
  /**
1985
1985
  * Format: uuid
1986
- * @description Organization catalog filament ID. Derives material and color; explicit values must agree.
1986
+ * @description Organization partner-catalog filament ID, or a global filament ID when materials.global_filaments_enabled is enabled (default true only when absent). Requires a material of at most 100 characters and one unambiguous color, normalized to #RRGGBB using shared material color rules. Named and 8-digit colors are supported; metadata.colors must agree with color. Merge tombstones are unavailable and include a merged_into replacement hint. Explicit material and color must agree.
1987
1987
  */
1988
1988
  filamentId?: string;
1989
1989
  material?: string;
@@ -2027,7 +2027,7 @@ interface paths {
2027
2027
  sourceSlot: number;
2028
2028
  /**
2029
2029
  * Format: uuid
2030
- * @description Organization catalog filament ID. Derives material and color; explicit values must agree.
2030
+ * @description Organization partner-catalog filament ID, or a global filament ID when materials.global_filaments_enabled is enabled (default true only when absent). Requires a material of at most 100 characters and one unambiguous color, normalized to #RRGGBB using shared material color rules. Named and 8-digit colors are supported; metadata.colors must agree with color. Merge tombstones are unavailable and include a merged_into replacement hint. Explicit material and color must agree.
2031
2031
  */
2032
2032
  filamentId?: string;
2033
2033
  material?: string;
@@ -2289,6 +2289,11 @@ interface paths {
2289
2289
  message?: string;
2290
2290
  filaments?: {
2291
2291
  sourceSlot?: number;
2292
+ /**
2293
+ * Format: uuid
2294
+ * @description Replacement material ID when an accessible catalog filament was merged.
2295
+ */
2296
+ merged_into?: string;
2292
2297
  /** @enum {string} */
2293
2298
  reason?: "filament_catalog_conflict" | "catalog_filament_not_found" | "invalid_catalog_filament" | "missing_material" | "color_distance" | "slot_empty" | "slot_conflict";
2294
2299
  }[];
@@ -2307,6 +2312,28 @@ interface paths {
2307
2312
  };
2308
2313
  };
2309
2314
  };
2315
+ /** @description Print creation is temporarily unavailable. catalog_store_failed indicates a failed organization-setting or catalog read and can include the affected source slot. */
2316
+ 503: {
2317
+ headers: {
2318
+ [name: string]: unknown;
2319
+ };
2320
+ content: {
2321
+ "application/json": {
2322
+ /** @description catalog_store_failed for catalog availability failures, or another existing print-creation availability error code. */
2323
+ error: string;
2324
+ message: string;
2325
+ filaments?: ({
2326
+ sourceSlot: number;
2327
+ /** @enum {string} */
2328
+ reason: "catalog_store_failed";
2329
+ } & {
2330
+ [key: string]: unknown;
2331
+ })[];
2332
+ } & {
2333
+ [key: string]: unknown;
2334
+ };
2335
+ };
2336
+ };
2310
2337
  };
2311
2338
  };
2312
2339
  delete?: never;
package/dist/index.d.ts CHANGED
@@ -1983,7 +1983,7 @@ interface paths {
1983
1983
  sourceSlot: number;
1984
1984
  /**
1985
1985
  * Format: uuid
1986
- * @description Organization catalog filament ID. Derives material and color; explicit values must agree.
1986
+ * @description Organization partner-catalog filament ID, or a global filament ID when materials.global_filaments_enabled is enabled (default true only when absent). Requires a material of at most 100 characters and one unambiguous color, normalized to #RRGGBB using shared material color rules. Named and 8-digit colors are supported; metadata.colors must agree with color. Merge tombstones are unavailable and include a merged_into replacement hint. Explicit material and color must agree.
1987
1987
  */
1988
1988
  filamentId?: string;
1989
1989
  material?: string;
@@ -2027,7 +2027,7 @@ interface paths {
2027
2027
  sourceSlot: number;
2028
2028
  /**
2029
2029
  * Format: uuid
2030
- * @description Organization catalog filament ID. Derives material and color; explicit values must agree.
2030
+ * @description Organization partner-catalog filament ID, or a global filament ID when materials.global_filaments_enabled is enabled (default true only when absent). Requires a material of at most 100 characters and one unambiguous color, normalized to #RRGGBB using shared material color rules. Named and 8-digit colors are supported; metadata.colors must agree with color. Merge tombstones are unavailable and include a merged_into replacement hint. Explicit material and color must agree.
2031
2031
  */
2032
2032
  filamentId?: string;
2033
2033
  material?: string;
@@ -2289,6 +2289,11 @@ interface paths {
2289
2289
  message?: string;
2290
2290
  filaments?: {
2291
2291
  sourceSlot?: number;
2292
+ /**
2293
+ * Format: uuid
2294
+ * @description Replacement material ID when an accessible catalog filament was merged.
2295
+ */
2296
+ merged_into?: string;
2292
2297
  /** @enum {string} */
2293
2298
  reason?: "filament_catalog_conflict" | "catalog_filament_not_found" | "invalid_catalog_filament" | "missing_material" | "color_distance" | "slot_empty" | "slot_conflict";
2294
2299
  }[];
@@ -2307,6 +2312,28 @@ interface paths {
2307
2312
  };
2308
2313
  };
2309
2314
  };
2315
+ /** @description Print creation is temporarily unavailable. catalog_store_failed indicates a failed organization-setting or catalog read and can include the affected source slot. */
2316
+ 503: {
2317
+ headers: {
2318
+ [name: string]: unknown;
2319
+ };
2320
+ content: {
2321
+ "application/json": {
2322
+ /** @description catalog_store_failed for catalog availability failures, or another existing print-creation availability error code. */
2323
+ error: string;
2324
+ message: string;
2325
+ filaments?: ({
2326
+ sourceSlot: number;
2327
+ /** @enum {string} */
2328
+ reason: "catalog_store_failed";
2329
+ } & {
2330
+ [key: string]: unknown;
2331
+ })[];
2332
+ } & {
2333
+ [key: string]: unknown;
2334
+ };
2335
+ };
2336
+ };
2310
2337
  };
2311
2338
  };
2312
2339
  delete?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@printhive/api",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Print Hive REST API client",