@dyne/interfacer-client 0.2.7 → 0.2.9
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/dist/index.cjs +12 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -6
- package/dist/index.d.ts +18 -6
- package/dist/index.js +12 -11
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1486,8 +1486,8 @@ async function getInstanceVariables(client) {
|
|
|
1486
1486
|
if (!d) throw new Error("No instance variables returned.");
|
|
1487
1487
|
cachedVars = {
|
|
1488
1488
|
projectDesign: d.specs.specProjectDesign,
|
|
1489
|
-
projectProduct: d.specs.specProjectProduct,
|
|
1490
|
-
projectService: d.specs.specProjectService,
|
|
1489
|
+
projectProduct: d.specs.specProjectProduct ?? void 0,
|
|
1490
|
+
projectService: d.specs.specProjectService ?? void 0,
|
|
1491
1491
|
dpp: d.specs.specDpp ?? void 0,
|
|
1492
1492
|
machine: d.specs.specMachine ?? void 0,
|
|
1493
1493
|
material: d.specs.specMaterial ?? void 0,
|
|
@@ -1521,13 +1521,13 @@ var ResourceClient = class {
|
|
|
1521
1521
|
// ─── Helpers ───────────────────────────────────────────────────────
|
|
1522
1522
|
specIdForType(vars, type) {
|
|
1523
1523
|
switch (type) {
|
|
1524
|
-
case "
|
|
1524
|
+
case "Design" /* DESIGN */:
|
|
1525
1525
|
return vars.projectDesign.id;
|
|
1526
|
-
case "
|
|
1527
|
-
return vars.projectProduct.
|
|
1528
|
-
case "
|
|
1529
|
-
return vars.projectService.
|
|
1530
|
-
case "
|
|
1526
|
+
case "Product" /* PRODUCT */:
|
|
1527
|
+
return vars.projectProduct?.id || this.config.specs?.product || "";
|
|
1528
|
+
case "Service" /* SERVICE */:
|
|
1529
|
+
return vars.projectService?.id || this.config.specs?.service || "";
|
|
1530
|
+
case "Machine" /* MACHINE */:
|
|
1531
1531
|
return vars.machine?.id || this.config.specs?.machine || "";
|
|
1532
1532
|
case "DPP" /* DPP */:
|
|
1533
1533
|
return vars.dpp?.id || this.config.specs?.dpp || "";
|
|
@@ -1557,9 +1557,10 @@ var ResourceClient = class {
|
|
|
1557
1557
|
async createProject(params) {
|
|
1558
1558
|
const vars = await this.getInstanceVars();
|
|
1559
1559
|
const specId = this.specIdForType(vars, params.projectType);
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1560
|
+
if (!specId) throw new Error(`${params.projectType} spec ID not found in instance variables or config`);
|
|
1561
|
+
const processId = params.processId || await this.createProcess(`creation of ${params.name} by owner`);
|
|
1562
|
+
let locationId = params.locationId;
|
|
1563
|
+
if (!locationId && params.location) {
|
|
1563
1564
|
const loc = await this.createLocation(params.location);
|
|
1564
1565
|
locationId = loc.id;
|
|
1565
1566
|
}
|