@codemation/core 0.0.19 → 0.2.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/EngineRuntimeRegistration.types-0sgV2XL2.d.ts +42 -0
  3. package/dist/EngineWorkflowRunnerService-Dx7bJsJR.d.cts +73 -0
  4. package/dist/InMemoryRunDataFactory-qIYQEar7.d.cts +94 -0
  5. package/dist/{InMemoryLiveWorkflowRepository-DxoualoC.d.ts → RunIntentService-BCvGdOSY.d.ts} +438 -9
  6. package/dist/{RunIntentService-C1nu_YwM.js → RunIntentService-BFA48UpH.js} +252 -67
  7. package/dist/RunIntentService-BFA48UpH.js.map +1 -0
  8. package/dist/{InMemoryLiveWorkflowRepository-orY1VsWG.d.cts → RunIntentService-CV8izV8t.d.cts} +214 -7
  9. package/dist/{RunIntentService-ZkjpY7MS.cjs → RunIntentService-DcxXf_AM.cjs} +262 -65
  10. package/dist/RunIntentService-DcxXf_AM.cjs.map +1 -0
  11. package/dist/bootstrap/index.cjs +14 -1135
  12. package/dist/bootstrap/index.d.cts +7 -60
  13. package/dist/bootstrap/index.d.ts +4 -40
  14. package/dist/bootstrap/index.js +3 -1122
  15. package/dist/bootstrap-D67Sf2BF.js +1136 -0
  16. package/dist/bootstrap-D67Sf2BF.js.map +1 -0
  17. package/dist/bootstrap-DoQHAEQJ.cjs +1203 -0
  18. package/dist/bootstrap-DoQHAEQJ.cjs.map +1 -0
  19. package/dist/{index-BIewO9-9.d.ts → index-BHmrZIHp.d.ts} +32 -260
  20. package/dist/index.cjs +98 -223
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +196 -6
  23. package/dist/index.d.ts +3 -3
  24. package/dist/index.js +92 -218
  25. package/dist/index.js.map +1 -1
  26. package/dist/testing.cjs +329 -3
  27. package/dist/testing.cjs.map +1 -1
  28. package/dist/testing.d.cts +181 -4
  29. package/dist/testing.d.ts +181 -3
  30. package/dist/testing.js +319 -2
  31. package/dist/testing.js.map +1 -1
  32. package/dist/workflowActivationPolicy-B8HzTk3o.js +201 -0
  33. package/dist/workflowActivationPolicy-B8HzTk3o.js.map +1 -0
  34. package/dist/workflowActivationPolicy-BzyzXLa_.cjs +231 -0
  35. package/dist/workflowActivationPolicy-BzyzXLa_.cjs.map +1 -0
  36. package/package.json +1 -1
  37. package/src/ai/AgentConnectionNodeCollector.ts +99 -0
  38. package/src/ai/AgentToolFactory.ts +38 -2
  39. package/src/ai/AiHost.ts +1 -1
  40. package/src/browser.ts +11 -0
  41. package/src/contracts/executionPersistenceContracts.ts +186 -0
  42. package/src/contracts/index.ts +1 -0
  43. package/src/contracts/runFinishedAtFactory.ts +5 -2
  44. package/src/contracts/runTypes.ts +10 -0
  45. package/src/contracts/runtimeTypes.ts +6 -2
  46. package/src/contracts/workflowTypes.ts +3 -2
  47. package/src/events/EventPublishingWorkflowExecutionRepository.ts +5 -0
  48. package/src/execution/ActivationEnqueueService.ts +8 -8
  49. package/src/execution/PersistedRunStateTerminalBuilder.ts +3 -0
  50. package/src/index.ts +6 -0
  51. package/src/orchestration/NodeExecutionRequestHandlerService.ts +11 -6
  52. package/src/orchestration/RunContinuationService.ts +94 -24
  53. package/src/runStorage/InMemoryWorkflowExecutionRepository.ts +14 -1
  54. package/src/scheduler/DefaultDrivingScheduler.ts +21 -11
  55. package/src/scheduler/InlineDrivingScheduler.ts +17 -21
  56. package/src/testing/CapturingScheduler.ts +15 -0
  57. package/src/testing/EngineTestKitRunIdFactory.ts +24 -0
  58. package/src/testing/InMemoryTriggerSetupStateRepository.ts +21 -0
  59. package/src/testing/PrefixedSequentialIdGenerator.ts +17 -0
  60. package/src/testing/RegistrarEngineTestKit.types.ts +76 -0
  61. package/src/testing/RegistrarEngineTestKitFactory.ts +154 -0
  62. package/src/testing/SubWorkflowRunnerTestNode.ts +83 -0
  63. package/src/testing/WorkflowTestHarnessManualTrigger.ts +39 -0
  64. package/src/testing/WorkflowTestKit.types.ts +9 -0
  65. package/src/testing/WorkflowTestKitBuilder.ts +77 -0
  66. package/src/testing/WorkflowTestKitNodeRegistrationContextFactory.ts +17 -0
  67. package/src/testing/WorkflowTestKitRunNodeWorkflowFactory.ts +26 -0
  68. package/src/testing.ts +19 -0
  69. package/src/types/index.ts +1 -0
  70. package/src/workflow/definition/ConnectionNodeIdFactory.ts +28 -0
  71. package/dist/InMemoryLiveWorkflowRepository-BTzHpQ6e.cjs +0 -151
  72. package/dist/InMemoryLiveWorkflowRepository-BTzHpQ6e.cjs.map +0 -1
  73. package/dist/InMemoryLiveWorkflowRepository-BoLNnVLg.js +0 -139
  74. package/dist/InMemoryLiveWorkflowRepository-BoLNnVLg.js.map +0 -1
  75. package/dist/RunIntentService-C1nu_YwM.js.map +0 -1
  76. package/dist/RunIntentService-DjbxzBBP.d.cts +0 -288
  77. package/dist/RunIntentService-ZkjpY7MS.cjs.map +0 -1
  78. package/dist/WorkflowSnapshotCodec-DSEzKyt3.d.cts +0 -22
  79. package/dist/bootstrap/index.cjs.map +0 -1
  80. package/dist/bootstrap/index.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
- const require_RunIntentService = require('./RunIntentService-ZkjpY7MS.cjs');
2
- const require_InMemoryLiveWorkflowRepository = require('./InMemoryLiveWorkflowRepository-BTzHpQ6e.cjs');
1
+ const require_RunIntentService = require('./RunIntentService-DcxXf_AM.cjs');
2
+ const require_workflowActivationPolicy = require('./workflowActivationPolicy-BzyzXLa_.cjs');
3
3
  let zod = require("zod");
4
4
  zod = require_RunIntentService.__toESM(zod);
5
5
  let node_crypto = require("node:crypto");
@@ -239,11 +239,48 @@ var NodeBackedToolConfig = class {
239
239
  }
240
240
  };
241
241
 
242
+ //#endregion
243
+ //#region src/ai/AgentConfigInspectorFactory.ts
244
+ var AgentConfigInspector = class {
245
+ static isAgentNodeConfig(config) {
246
+ if (!config) return false;
247
+ const candidate = config;
248
+ return !!candidate.chatModel && this.hasCompatibleMessageConfiguration(candidate);
249
+ }
250
+ static hasCompatibleMessageConfiguration(candidate) {
251
+ const messages = candidate.messages;
252
+ if (messages === void 0 || messages === null) return false;
253
+ if (Array.isArray(messages)) return messages.length > 0;
254
+ if (typeof messages === "object") {
255
+ const o = messages;
256
+ return Array.isArray(o.prompt) && o.prompt.length > 0 || typeof o.buildMessages === "function";
257
+ }
258
+ return false;
259
+ }
260
+ };
261
+
242
262
  //#endregion
243
263
  //#region src/ai/AgentToolFactory.ts
244
264
  var AgentToolFactoryImpl = class {
245
265
  asTool(node$1, options) {
246
- return new NodeBackedToolConfig(options.name ?? node$1.name ?? "tool", node$1, options);
266
+ return new NodeBackedToolConfig(options.name ?? node$1.name ?? "tool", node$1, this.withDefaultAgentInputMapper(node$1, options));
267
+ }
268
+ withDefaultAgentInputMapper(node$1, options) {
269
+ if (options.mapInput || !AgentConfigInspector.isAgentNodeConfig(node$1)) return options;
270
+ return {
271
+ ...options,
272
+ mapInput: ({ input, item }) => this.mergeAgentToolInputWithCurrentItem(input, item)
273
+ };
274
+ }
275
+ mergeAgentToolInputWithCurrentItem(input, item) {
276
+ if (!this.isMergeableRecord(input) || !this.isMergeableRecord(item.json)) return input;
277
+ return {
278
+ ...item.json,
279
+ ...input
280
+ };
281
+ }
282
+ isMergeableRecord(value) {
283
+ return typeof value === "object" && value !== null && !Array.isArray(value);
247
284
  }
248
285
  };
249
286
  const AgentToolFactory = new AgentToolFactoryImpl();
@@ -273,26 +310,6 @@ var AgentMessageConfigNormalizer = class {
273
310
  }
274
311
  };
275
312
 
276
- //#endregion
277
- //#region src/ai/AgentConfigInspectorFactory.ts
278
- var AgentConfigInspector = class {
279
- static isAgentNodeConfig(config) {
280
- if (!config) return false;
281
- const candidate = config;
282
- return !!candidate.chatModel && this.hasCompatibleMessageConfiguration(candidate);
283
- }
284
- static hasCompatibleMessageConfiguration(candidate) {
285
- const messages = candidate.messages;
286
- if (messages === void 0 || messages === null) return false;
287
- if (Array.isArray(messages)) return messages.length > 0;
288
- if (typeof messages === "object") {
289
- const o = messages;
290
- return Array.isArray(o.prompt) && o.prompt.length > 0 || typeof o.buildMessages === "function";
291
- }
292
- return false;
293
- }
294
- };
295
-
296
313
  //#endregion
297
314
  //#region src/ai/AiHost.ts
298
315
  /** Defaults aligned with common tool-agent iteration limits (many products use ~10 max rounds). */
@@ -302,155 +319,57 @@ const AgentGuardrailDefaults = {
302
319
  };
303
320
 
304
321
  //#endregion
305
- //#region src/workflow/dsl/WhenBuilder.ts
306
- var WhenBuilder = class WhenBuilder {
307
- constructor(wf, from, branchPort) {
308
- this.wf = wf;
309
- this.from = from;
310
- this.branchPort = branchPort;
311
- }
312
- addBranch(steps) {
313
- const created = [];
314
- let prev = null;
315
- for (const cfg of steps) {
316
- const ref = this.wf.add(cfg);
317
- created.push(ref);
318
- if (!prev) this.wf.connect(this.from, ref, this.branchPort, "in");
319
- else this.wf.connect(prev, ref, "main", "in");
320
- prev = ref;
321
- }
322
- for (const cfg of steps) {
323
- const maybe = cfg;
324
- if (!Array.isArray(maybe.upstreamRefs) || maybe.upstreamRefs.length === 0) continue;
325
- maybe.upstreamRefs = maybe.upstreamRefs.map((r) => {
326
- if (typeof r !== "string") return r;
327
- const nodeId = created[parseInt(r.slice(1), 10)]?.id;
328
- return nodeId ? { nodeId } : { nodeId: r };
322
+ //#region src/ai/AgentConnectionNodeCollector.ts
323
+ const AgentConnectionNodeCollector = new class {
324
+ collect(parentNodeId, agentConfig) {
325
+ const collected = [];
326
+ this.collectInto(parentNodeId, agentConfig, collected);
327
+ return collected;
328
+ }
329
+ collectInto(parentNodeId, agentConfig, collected) {
330
+ collected.push({
331
+ nodeId: require_RunIntentService.ConnectionNodeIdFactory.languageModelConnectionNodeId(parentNodeId),
332
+ parentNodeId,
333
+ connectionName: "llm",
334
+ role: "languageModel",
335
+ name: agentConfig.chatModel.presentation?.label ?? agentConfig.chatModel.name,
336
+ typeName: agentConfig.chatModel.name,
337
+ icon: agentConfig.chatModel.presentation?.icon,
338
+ credentialSource: agentConfig.chatModel
339
+ });
340
+ for (const tool$1 of agentConfig.tools ?? []) {
341
+ const toolNodeId = require_RunIntentService.ConnectionNodeIdFactory.toolConnectionNodeId(parentNodeId, tool$1.name);
342
+ const isNestedAgent = this.isNodeBackedAgentTool(tool$1);
343
+ collected.push({
344
+ nodeId: toolNodeId,
345
+ parentNodeId,
346
+ connectionName: "tools",
347
+ role: isNestedAgent ? "nestedAgent" : "tool",
348
+ name: tool$1.presentation?.label ?? tool$1.name,
349
+ typeName: tool$1.name,
350
+ icon: tool$1.presentation?.icon,
351
+ credentialSource: tool$1
329
352
  });
353
+ this.collectNestedAgentTools(toolNodeId, tool$1, collected);
330
354
  }
331
- return this;
332
- }
333
- when = (branch, steps, ...more) => {
334
- const list = Array.isArray(steps) ? steps : [steps, ...more];
335
- const port = branch ? "true" : "false";
336
- const b = new WhenBuilder(this.wf, this.from, port);
337
- b.addBranch(list);
338
- return b;
339
- };
340
- build() {
341
- return this.wf.build();
342
355
  }
343
- };
344
-
345
- //#endregion
346
- //#region src/workflow/dsl/ChainCursorResolver.ts
347
- var ChainCursor = class ChainCursor {
348
- constructor(wf, cursor, cursorOutput) {
349
- this.wf = wf;
350
- this.cursor = cursor;
351
- this.cursorOutput = cursorOutput;
352
- }
353
- then(config) {
354
- const next = this.wf.add(config);
355
- this.wf.connect(this.cursor, next, this.cursorOutput);
356
- return new ChainCursor(this.wf, next, "main");
357
- }
358
- when = ((arg1, steps, ...more) => {
359
- if (typeof arg1 === "boolean") {
360
- const list = Array.isArray(steps) ? steps : steps ? [steps, ...more] : more;
361
- const port = arg1 ? "true" : "false";
362
- const b = new WhenBuilder(this.wf, this.cursor, port);
363
- b.addBranch(list);
364
- return b;
365
- }
366
- const branches = arg1;
367
- const makeMerge = this.wf.options?.makeMergeNode;
368
- if (!makeMerge) throw new Error("WorkflowBuilder is missing options.makeMergeNode (required for when({true,false}). Use createWorkflowBuilder from \"@codemation/core-nodes\".");
369
- const wfAny = this.wf;
370
- const buildBranch = (port, branchSteps) => {
371
- const list = branchSteps ?? [];
372
- let prev = null;
373
- for (const cfg of list) {
374
- const ref = wfAny.add(cfg);
375
- if (!prev) wfAny.connect(this.cursor, ref, port, "in");
376
- else wfAny.connect(prev, ref, "main", "in");
377
- prev = ref;
378
- }
379
- if (!prev) return {
380
- end: this.cursor,
381
- endOutput: port
382
- };
383
- return {
384
- end: prev,
385
- endOutput: "main"
386
- };
387
- };
388
- const t = buildBranch("true", branches.true);
389
- const f = buildBranch("false", branches.false);
390
- const merge = wfAny.add(makeMerge("Merge (auto)"));
391
- wfAny.connect(t.end, merge, t.endOutput, "true");
392
- wfAny.connect(f.end, merge, f.endOutput, "false");
393
- return new ChainCursor(this.wf, merge, "main");
394
- });
395
- build() {
396
- return this.wf.build();
397
- }
398
- };
399
-
400
- //#endregion
401
- //#region src/workflow/dsl/WorkflowBuilder.ts
402
- var WorkflowBuilder = class {
403
- nodes = [];
404
- edges = [];
405
- seq = 0;
406
- constructor(meta, options) {
407
- this.meta = meta;
408
- this.options = options;
409
- }
410
- add(config) {
411
- const tokenName = typeof config.type === "function" ? config.type.name : String(config.type);
412
- const id = config.id ?? `${tokenName}:${++this.seq}`;
413
- this.nodes.push({
414
- id,
415
- kind: config.kind,
416
- type: config.type,
417
- name: config.name,
418
- config
419
- });
420
- return {
421
- id,
422
- kind: config.kind,
423
- name: config.name
424
- };
425
- }
426
- connect(from, to, fromOutput = "main", toInput = "in") {
427
- this.edges.push({
428
- from: {
429
- nodeId: from.id,
430
- output: fromOutput
431
- },
432
- to: {
433
- nodeId: to.id,
434
- input: toInput
435
- }
436
- });
437
- }
438
- trigger(config) {
439
- const ref = this.add(config);
440
- return new ChainCursor(this, ref, "main");
441
- }
442
- start(config) {
443
- const ref = this.add(config);
444
- return new ChainCursor(this, ref, "main");
445
- }
446
- build() {
447
- return {
448
- ...this.meta,
449
- nodes: this.nodes,
450
- edges: this.edges
451
- };
452
- }
453
- };
356
+ collectNestedAgentTools(toolNodeId, tool$1, collected) {
357
+ if (!this.isNodeBackedAgentTool(tool$1)) return;
358
+ const innerAgent = tool$1 instanceof NodeBackedToolConfig ? tool$1.node : tool$1.node;
359
+ this.collectInto(toolNodeId, innerAgent, collected);
360
+ }
361
+ /**
362
+ * After JSON round-trip (persisted snapshots), tools are plain objects — `instanceof NodeBackedToolConfig` fails.
363
+ * Detect node-backed tools structurally via {@link NodeBackedToolConfig#toolKind}.
364
+ */
365
+ isNodeBackedAgentTool(tool$1) {
366
+ if (tool$1 instanceof NodeBackedToolConfig) return AgentConfigInspector.isAgentNodeConfig(tool$1.node);
367
+ if (!tool$1 || typeof tool$1 !== "object") return false;
368
+ const t = tool$1;
369
+ if (t.toolKind !== "nodeBacked") return false;
370
+ return AgentConfigInspector.isAgentNodeConfig(t.node);
371
+ }
372
+ }();
454
373
 
455
374
  //#endregion
456
375
  //#region src/workflow/definition/ConnectionInvocationIdFactory.ts
@@ -496,45 +415,6 @@ var DefaultWorkflowGraphFactory = class {
496
415
  }
497
416
  };
498
417
 
499
- //#endregion
500
- //#region src/events/InMemoryRunEventSubscription.ts
501
- var InMemoryRunEventSubscription = class {
502
- constructor(onClose) {
503
- this.onClose = onClose;
504
- }
505
- async close() {
506
- this.onClose();
507
- }
508
- };
509
-
510
- //#endregion
511
- //#region src/events/InMemoryRunEventBusRegistry.ts
512
- var InMemoryRunEventBus = class {
513
- globalListeners = /* @__PURE__ */ new Set();
514
- listenersByWorkflowId = /* @__PURE__ */ new Map();
515
- async publish(event) {
516
- for (const listener of this.globalListeners) listener(event);
517
- for (const listener of this.listenersByWorkflowId.get(event.workflowId) ?? []) listener(event);
518
- }
519
- async subscribe(onEvent) {
520
- this.globalListeners.add(onEvent);
521
- return new InMemoryRunEventSubscription(() => {
522
- this.globalListeners.delete(onEvent);
523
- });
524
- }
525
- async subscribeToWorkflow(workflowId, onEvent) {
526
- const existing = this.listenersByWorkflowId.get(workflowId) ?? /* @__PURE__ */ new Set();
527
- existing.add(onEvent);
528
- this.listenersByWorkflowId.set(workflowId, existing);
529
- return new InMemoryRunEventSubscription(() => {
530
- const listeners = this.listenersByWorkflowId.get(workflowId);
531
- if (!listeners) return;
532
- listeners.delete(onEvent);
533
- if (listeners.size === 0) this.listenersByWorkflowId.delete(workflowId);
534
- });
535
- }
536
- };
537
-
538
418
  //#endregion
539
419
  //#region src/events/EventPublishingWorkflowExecutionRepository.ts
540
420
  var EventPublishingWorkflowExecutionRepository = class {
@@ -556,6 +436,9 @@ var EventPublishingWorkflowExecutionRepository = class {
556
436
  async load(runId) {
557
437
  return await this.inner.load(runId);
558
438
  }
439
+ async loadSchedulingState(runId) {
440
+ return await this.inner.loadSchedulingState(runId);
441
+ }
559
442
  async save(state) {
560
443
  await this.inner.save(state);
561
444
  await this.eventBus.publish({
@@ -680,22 +563,14 @@ var CredentialUnboundError = class CredentialUnboundError extends Error {
680
563
  //#region src/contracts/workflowTypes.ts
681
564
  const branchRef = (index) => `$${index}`;
682
565
 
683
- //#endregion
684
- //#region src/contracts/workflowActivationPolicy.ts
685
- /** Default for tests and harnesses: every workflow is treated as active (legacy behavior). */
686
- var AllWorkflowsActiveWorkflowActivationPolicy = class {
687
- isActive(_workflowId) {
688
- return true;
689
- }
690
- };
691
-
692
566
  //#endregion
693
567
  exports.AgentConfigInspector = AgentConfigInspector;
568
+ exports.AgentConnectionNodeCollector = AgentConnectionNodeCollector;
694
569
  exports.AgentGuardrailDefaults = AgentGuardrailDefaults;
695
570
  exports.AgentMessageConfigNormalizer = AgentMessageConfigNormalizer;
696
571
  exports.AgentToolFactory = AgentToolFactory;
697
- exports.AllWorkflowsActiveWorkflowActivationPolicy = AllWorkflowsActiveWorkflowActivationPolicy;
698
- exports.ChainCursor = ChainCursor;
572
+ exports.AllWorkflowsActiveWorkflowActivationPolicy = require_workflowActivationPolicy.AllWorkflowsActiveWorkflowActivationPolicy;
573
+ exports.ChainCursor = require_workflowActivationPolicy.ChainCursor;
699
574
  exports.ConnectionInvocationIdFactory = ConnectionInvocationIdFactory;
700
575
  exports.ConnectionNodeIdFactory = require_RunIntentService.ConnectionNodeIdFactory;
701
576
  exports.CoreTokens = require_RunIntentService.CoreTokens;
@@ -710,9 +585,9 @@ exports.EngineExecutionLimitsPolicy = require_RunIntentService.EngineExecutionLi
710
585
  exports.EventPublishingWorkflowExecutionRepository = EventPublishingWorkflowExecutionRepository;
711
586
  exports.ExpRetryPolicy = ExpRetryPolicy;
712
587
  exports.InMemoryBinaryStorage = require_RunIntentService.InMemoryBinaryStorage;
713
- exports.InMemoryLiveWorkflowRepository = require_InMemoryLiveWorkflowRepository.InMemoryLiveWorkflowRepository;
588
+ exports.InMemoryLiveWorkflowRepository = require_RunIntentService.InMemoryLiveWorkflowRepository;
714
589
  exports.InMemoryRunDataFactory = require_RunIntentService.InMemoryRunDataFactory;
715
- exports.InMemoryRunEventBus = InMemoryRunEventBus;
590
+ exports.InMemoryRunEventBus = require_workflowActivationPolicy.InMemoryRunEventBus;
716
591
  exports.InProcessRetryRunner = require_RunIntentService.InProcessRetryRunner;
717
592
  exports.InjectableRuntimeDecoratorComposer = require_RunIntentService.InjectableRuntimeDecoratorComposer;
718
593
  Object.defineProperty(exports, 'ItemsInputNormalizer', {
@@ -732,8 +607,8 @@ exports.RunIntentService = require_RunIntentService.RunIntentService;
732
607
  exports.StackTraceCallSitePathResolver = require_RunIntentService.StackTraceCallSitePathResolver;
733
608
  exports.SystemClock = SystemClock;
734
609
  exports.UnavailableBinaryStorage = require_RunIntentService.UnavailableBinaryStorage;
735
- exports.WhenBuilder = WhenBuilder;
736
- exports.WorkflowBuilder = WorkflowBuilder;
610
+ exports.WhenBuilder = require_workflowActivationPolicy.WhenBuilder;
611
+ exports.WorkflowBuilder = require_workflowActivationPolicy.WorkflowBuilder;
737
612
  exports.WorkflowExecutableNodeClassifier = require_RunIntentService.WorkflowExecutableNodeClassifier;
738
613
  exports.WorkflowExecutableNodeClassifierFactory = require_RunIntentService.WorkflowExecutableNodeClassifierFactory;
739
614
  exports.branchRef = branchRef;