@huaqiu/dsh-artifacts 0.3.8 → 0.3.10

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.
@@ -15,7 +15,7 @@
15
15
  * @module
16
16
  */
17
17
  /** Artifact classes that can be placed into an EDA editor. */
18
- declare const PLACEABLE_ARTIFACT_TYPES: readonly ["schematic", "symbol", "footprint"];
18
+ declare const PLACEABLE_ARTIFACT_TYPES: readonly ["schematic", "symbol", "footprint", "pcb"];
19
19
  type PlaceableArtifactType = (typeof PLACEABLE_ARTIFACT_TYPES)[number];
20
20
  /**
21
21
  * Editor contexts an HQ Edge instance may be serving.
@@ -30,7 +30,8 @@ type EditorType = 'sch' | 'pcb' | 'symbol' | 'footprint' | 'generic';
30
30
  declare function canPlaceArtifact(artifactType: PlaceableArtifactType, editorType: EditorType): boolean;
31
31
  /**
32
32
  * Coerce an unknown value to a {@link PlaceableArtifactType}, or `null` when
33
- * it is not placeable (`pcb` and `zip` artifacts have no placement support).
33
+ * it is not placeable (`zip` artifacts have no placement of their own — a zip
34
+ * is expanded into schematics before the RPC).
34
35
  */
35
36
  declare function parsePlaceableArtifactType(value: unknown): PlaceableArtifactType | null;
36
37
  /**
package/lib/placement.mjs CHANGED
@@ -18,24 +18,40 @@
18
18
  const PLACEABLE_ARTIFACT_TYPES = [
19
19
  "schematic",
20
20
  "symbol",
21
- "footprint"
21
+ "footprint",
22
+ "pcb"
22
23
  ];
23
24
  /**
24
25
  * Editors each artifact type may be placed into.
25
26
  *
26
27
  * | Artifact | sch | pcb | symbol | footprint | generic |
27
28
  * |-----------|-----|-----|--------|-----------|---------|
28
- * | schematic | yes | no | no | no | no |
29
- * | symbol | yes | no | yes | no | no |
30
- * | footprint | no | yes | no | yes | no |
29
+ * | schematic | yes | no | no | no | yes |
30
+ * | symbol | yes | no | yes | no | yes |
31
+ * | footprint | no | yes | no | yes | yes |
32
+ * | pcb | no | yes | no | no | yes |
31
33
  *
32
- * `generic` appears in no row: HQ Edge may be inside *some* EDA host without
33
- * knowing which editor, so placement must fail closed.
34
+ * `pcb` rides the same design-block RPC as schematics (`DesignContent.pcb`):
35
+ * the editor-side PCB placement flow is the placement team's work and builds
36
+ * on this channel, so it must not be assumed away. `generic` means the host
37
+ * did not declare a specific editor context, and per the host contract such a
38
+ * deployment supports ALL placement targets by design — the EDA host is the
39
+ * final authority (HQ Edge re-enforces the same matrix server-side). Unknown
40
+ * editor values still fail closed.
34
41
  */
35
42
  const COMPATIBLE_EDITORS = {
36
- schematic: /* @__PURE__ */ new Set(["sch"]),
37
- symbol: /* @__PURE__ */ new Set(["sch", "symbol"]),
38
- footprint: /* @__PURE__ */ new Set(["pcb", "footprint"])
43
+ schematic: /* @__PURE__ */ new Set(["sch", "generic"]),
44
+ symbol: /* @__PURE__ */ new Set([
45
+ "sch",
46
+ "symbol",
47
+ "generic"
48
+ ]),
49
+ footprint: /* @__PURE__ */ new Set([
50
+ "pcb",
51
+ "footprint",
52
+ "generic"
53
+ ]),
54
+ pcb: /* @__PURE__ */ new Set(["pcb", "generic"])
39
55
  };
40
56
  /**
41
57
  * Can `artifactType` be placed into the editor identified by `editorType`?
@@ -48,7 +64,8 @@ function canPlaceArtifact(artifactType, editorType) {
48
64
  }
49
65
  /**
50
66
  * Coerce an unknown value to a {@link PlaceableArtifactType}, or `null` when
51
- * it is not placeable (`pcb` and `zip` artifacts have no placement support).
67
+ * it is not placeable (`zip` artifacts have no placement of their own — a zip
68
+ * is expanded into schematics before the RPC).
52
69
  */
53
70
  function parsePlaceableArtifactType(value) {
54
71
  if (typeof value !== "string") return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huaqiu/dsh-artifacts",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "type": "module",
5
5
  "main": "./lib/index.mjs",
6
6
  "types": "./lib/index.d.mts",
package/src/placement.ts CHANGED
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  /** Artifact classes that can be placed into an EDA editor. */
18
- export const PLACEABLE_ARTIFACT_TYPES = ['schematic', 'symbol', 'footprint'] as const
18
+ export const PLACEABLE_ARTIFACT_TYPES = ['schematic', 'symbol', 'footprint', 'pcb'] as const
19
19
 
20
20
  export type PlaceableArtifactType = (typeof PLACEABLE_ARTIFACT_TYPES)[number]
21
21
 
@@ -30,17 +30,24 @@ export type EditorType = 'sch' | 'pcb' | 'symbol' | 'footprint' | 'generic'
30
30
  *
31
31
  * | Artifact | sch | pcb | symbol | footprint | generic |
32
32
  * |-----------|-----|-----|--------|-----------|---------|
33
- * | schematic | yes | no | no | no | no |
34
- * | symbol | yes | no | yes | no | no |
35
- * | footprint | no | yes | no | yes | no |
33
+ * | schematic | yes | no | no | no | yes |
34
+ * | symbol | yes | no | yes | no | yes |
35
+ * | footprint | no | yes | no | yes | yes |
36
+ * | pcb | no | yes | no | no | yes |
36
37
  *
37
- * `generic` appears in no row: HQ Edge may be inside *some* EDA host without
38
- * knowing which editor, so placement must fail closed.
38
+ * `pcb` rides the same design-block RPC as schematics (`DesignContent.pcb`):
39
+ * the editor-side PCB placement flow is the placement team's work and builds
40
+ * on this channel, so it must not be assumed away. `generic` means the host
41
+ * did not declare a specific editor context, and per the host contract such a
42
+ * deployment supports ALL placement targets by design — the EDA host is the
43
+ * final authority (HQ Edge re-enforces the same matrix server-side). Unknown
44
+ * editor values still fail closed.
39
45
  */
40
46
  const COMPATIBLE_EDITORS: Record<PlaceableArtifactType, ReadonlySet<EditorType>> = {
41
- schematic: new Set<EditorType>(['sch']),
42
- symbol: new Set<EditorType>(['sch', 'symbol']),
43
- footprint: new Set<EditorType>(['pcb', 'footprint']),
47
+ schematic: new Set<EditorType>(['sch', 'generic']),
48
+ symbol: new Set<EditorType>(['sch', 'symbol', 'generic']),
49
+ footprint: new Set<EditorType>(['pcb', 'footprint', 'generic']),
50
+ pcb: new Set<EditorType>(['pcb', 'generic']),
44
51
  }
45
52
 
46
53
  /**
@@ -58,7 +65,8 @@ export function canPlaceArtifact(
58
65
 
59
66
  /**
60
67
  * Coerce an unknown value to a {@link PlaceableArtifactType}, or `null` when
61
- * it is not placeable (`pcb` and `zip` artifacts have no placement support).
68
+ * it is not placeable (`zip` artifacts have no placement of their own — a zip
69
+ * is expanded into schematics before the RPC).
62
70
  */
63
71
  export function parsePlaceableArtifactType(value: unknown): PlaceableArtifactType | null {
64
72
  if (typeof value !== 'string') return null