@dyne/interfacer-client 0.2.8 → 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.d.cts CHANGED
@@ -40,6 +40,10 @@ interface InterfacerConfig {
40
40
  machine?: string;
41
41
  /** Material spec ID (for material classification) */
42
42
  material?: string;
43
+ /** Product spec ID (for createProject with Product type) */
44
+ product?: string;
45
+ /** Service spec ID (for createProject with Service type) */
46
+ service?: string;
43
47
  };
44
48
  /** Zenflows admin token (needed for sign-up mutations) */
45
49
  zenflowsAdmin?: string;
@@ -105,10 +109,10 @@ declare class GraphQLClient {
105
109
  * hide the complexity of EconomicResources, EconomicEvents, etc.
106
110
  */
107
111
  declare enum ProjectType {
108
- DESIGN = "DESIGN",
109
- PRODUCT = "PRODUCT",
110
- SERVICE = "SERVICE",
111
- MACHINE = "MACHINE",
112
+ DESIGN = "Design",
113
+ PRODUCT = "Product",
114
+ SERVICE = "Service",
115
+ MACHINE = "Machine",
112
116
  DPP = "DPP"
113
117
  }
114
118
  declare enum ProposalStatus {
@@ -643,6 +647,10 @@ interface CreateProjectParams$1 {
643
647
  lat?: number;
644
648
  lng?: number;
645
649
  };
650
+ /** Pre-created location ID (avoids duplicate location creation) */
651
+ locationId?: string;
652
+ /** Pre-created process ID (avoids duplicate process creation) */
653
+ processId?: string;
646
654
  metadata?: Record<string, unknown>;
647
655
  }
648
656
  interface CreateMachineParams {
@@ -976,6 +984,10 @@ interface CreateProjectParams {
976
984
  lat?: number;
977
985
  lng?: number;
978
986
  };
987
+ /** Pre-created location ID (avoids duplicate location creation) */
988
+ locationId?: string;
989
+ /** Pre-created process ID (avoids duplicate process creation) */
990
+ processId?: string;
979
991
  metadata?: Record<string, unknown>;
980
992
  }
981
993
  interface ProjectFilter {
@@ -1037,8 +1049,8 @@ interface SpecInfo {
1037
1049
  }
1038
1050
  interface InstanceVariables {
1039
1051
  projectDesign: SpecInfo;
1040
- projectProduct: SpecInfo;
1041
- projectService: SpecInfo;
1052
+ projectProduct?: SpecInfo;
1053
+ projectService?: SpecInfo;
1042
1054
  dpp?: SpecInfo;
1043
1055
  machine?: SpecInfo;
1044
1056
  material?: SpecInfo;
package/dist/index.d.ts CHANGED
@@ -40,6 +40,10 @@ interface InterfacerConfig {
40
40
  machine?: string;
41
41
  /** Material spec ID (for material classification) */
42
42
  material?: string;
43
+ /** Product spec ID (for createProject with Product type) */
44
+ product?: string;
45
+ /** Service spec ID (for createProject with Service type) */
46
+ service?: string;
43
47
  };
44
48
  /** Zenflows admin token (needed for sign-up mutations) */
45
49
  zenflowsAdmin?: string;
@@ -105,10 +109,10 @@ declare class GraphQLClient {
105
109
  * hide the complexity of EconomicResources, EconomicEvents, etc.
106
110
  */
107
111
  declare enum ProjectType {
108
- DESIGN = "DESIGN",
109
- PRODUCT = "PRODUCT",
110
- SERVICE = "SERVICE",
111
- MACHINE = "MACHINE",
112
+ DESIGN = "Design",
113
+ PRODUCT = "Product",
114
+ SERVICE = "Service",
115
+ MACHINE = "Machine",
112
116
  DPP = "DPP"
113
117
  }
114
118
  declare enum ProposalStatus {
@@ -643,6 +647,10 @@ interface CreateProjectParams$1 {
643
647
  lat?: number;
644
648
  lng?: number;
645
649
  };
650
+ /** Pre-created location ID (avoids duplicate location creation) */
651
+ locationId?: string;
652
+ /** Pre-created process ID (avoids duplicate process creation) */
653
+ processId?: string;
646
654
  metadata?: Record<string, unknown>;
647
655
  }
648
656
  interface CreateMachineParams {
@@ -976,6 +984,10 @@ interface CreateProjectParams {
976
984
  lat?: number;
977
985
  lng?: number;
978
986
  };
987
+ /** Pre-created location ID (avoids duplicate location creation) */
988
+ locationId?: string;
989
+ /** Pre-created process ID (avoids duplicate process creation) */
990
+ processId?: string;
979
991
  metadata?: Record<string, unknown>;
980
992
  }
981
993
  interface ProjectFilter {
@@ -1037,8 +1049,8 @@ interface SpecInfo {
1037
1049
  }
1038
1050
  interface InstanceVariables {
1039
1051
  projectDesign: SpecInfo;
1040
- projectProduct: SpecInfo;
1041
- projectService: SpecInfo;
1052
+ projectProduct?: SpecInfo;
1053
+ projectService?: SpecInfo;
1042
1054
  dpp?: SpecInfo;
1043
1055
  machine?: SpecInfo;
1044
1056
  material?: SpecInfo;
package/dist/index.js CHANGED
@@ -1410,8 +1410,8 @@ async function getInstanceVariables(client) {
1410
1410
  if (!d) throw new Error("No instance variables returned.");
1411
1411
  cachedVars = {
1412
1412
  projectDesign: d.specs.specProjectDesign,
1413
- projectProduct: d.specs.specProjectProduct,
1414
- projectService: d.specs.specProjectService,
1413
+ projectProduct: d.specs.specProjectProduct ?? void 0,
1414
+ projectService: d.specs.specProjectService ?? void 0,
1415
1415
  dpp: d.specs.specDpp ?? void 0,
1416
1416
  machine: d.specs.specMachine ?? void 0,
1417
1417
  material: d.specs.specMaterial ?? void 0,
@@ -1445,13 +1445,13 @@ var ResourceClient = class {
1445
1445
  // ─── Helpers ───────────────────────────────────────────────────────
1446
1446
  specIdForType(vars, type) {
1447
1447
  switch (type) {
1448
- case "DESIGN" /* DESIGN */:
1448
+ case "Design" /* DESIGN */:
1449
1449
  return vars.projectDesign.id;
1450
- case "PRODUCT" /* PRODUCT */:
1451
- return vars.projectProduct.id;
1452
- case "SERVICE" /* SERVICE */:
1453
- return vars.projectService.id;
1454
- case "MACHINE" /* MACHINE */:
1450
+ case "Product" /* PRODUCT */:
1451
+ return vars.projectProduct?.id || this.config.specs?.product || "";
1452
+ case "Service" /* SERVICE */:
1453
+ return vars.projectService?.id || this.config.specs?.service || "";
1454
+ case "Machine" /* MACHINE */:
1455
1455
  return vars.machine?.id || this.config.specs?.machine || "";
1456
1456
  case "DPP" /* DPP */:
1457
1457
  return vars.dpp?.id || this.config.specs?.dpp || "";
@@ -1481,9 +1481,10 @@ var ResourceClient = class {
1481
1481
  async createProject(params) {
1482
1482
  const vars = await this.getInstanceVars();
1483
1483
  const specId = this.specIdForType(vars, params.projectType);
1484
- const processId = await this.createProcess(`creation of ${params.name} by owner`);
1485
- let locationId;
1486
- if (params.location) {
1484
+ if (!specId) throw new Error(`${params.projectType} spec ID not found in instance variables or config`);
1485
+ const processId = params.processId || await this.createProcess(`creation of ${params.name} by owner`);
1486
+ let locationId = params.locationId;
1487
+ if (!locationId && params.location) {
1487
1488
  const loc = await this.createLocation(params.location);
1488
1489
  locationId = loc.id;
1489
1490
  }