@photon-ai/flux 0.3.5 → 0.3.7

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.js CHANGED
@@ -51691,20 +51691,20 @@ var require_src32 = __commonJS2({
51691
51691
  })();
51692
51692
  }
51693
51693
  });
51694
- function server() {
51694
+ function bidi() {
51695
51695
  const descriptor = {
51696
- serviceType: "server",
51697
- methodType: "unary"
51696
+ serviceType: "bidi",
51697
+ methodType: "bidi"
51698
51698
  };
51699
- const contextFn = (context) => {
51699
+ const configFn = (config) => {
51700
51700
  descriptor.config = {
51701
- metadata: context.metadata !== void 0,
51702
- ack: false
51701
+ metadata: config.metadata !== void 0,
51702
+ ack: config.ack ?? false
51703
51703
  };
51704
51704
  return descriptor;
51705
51705
  };
51706
- Object.assign(contextFn, descriptor);
51707
- return contextFn;
51706
+ Object.assign(configFn, descriptor);
51707
+ return configFn;
51708
51708
  }
51709
51709
  function client() {
51710
51710
  return {
@@ -51712,20 +51712,20 @@ function client() {
51712
51712
  methodType: "unary"
51713
51713
  };
51714
51714
  }
51715
- function bidi(..._) {
51715
+ function server() {
51716
51716
  const descriptor = {
51717
- serviceType: "bidi",
51718
- methodType: "bidi"
51717
+ serviceType: "server",
51718
+ methodType: "unary"
51719
51719
  };
51720
- const configFn = (config) => {
51720
+ const contextFn = (context) => {
51721
51721
  descriptor.config = {
51722
- metadata: config.metadata !== void 0,
51723
- ack: config.ack ?? false
51722
+ metadata: context.metadata !== void 0,
51723
+ ack: false
51724
51724
  };
51725
51725
  return descriptor;
51726
51726
  };
51727
- Object.assign(configFn, descriptor);
51728
- return configFn;
51727
+ Object.assign(contextFn, descriptor);
51728
+ return contextFn;
51729
51729
  }
51730
51730
  var ServiceImpl = class {
51731
51731
  implementation;
@@ -51843,6 +51843,7 @@ function buildServiceProto(base) {
51843
51843
  }`;
51844
51844
  }
51845
51845
  var GrpcClient = class {
51846
+ clientID;
51846
51847
  address;
51847
51848
  serviceImpls;
51848
51849
  channel;
@@ -51855,6 +51856,7 @@ var GrpcClient = class {
51855
51856
  // bidi that is waiting for context
51856
51857
  pendingBidiAck = /* @__PURE__ */ new Map();
51857
51858
  constructor(address, grpcOptions, serviceImpls) {
51859
+ this.clientID = crypto.randomUUID();
51858
51860
  this.address = address;
51859
51861
  this.serviceImpls = serviceImpls;
51860
51862
  this.proto = loadProtoFromString(buildProtoString(serviceImpls));
@@ -51899,7 +51901,11 @@ var GrpcClient = class {
51899
51901
  switch (`${descriptor.serviceType}:${descriptor.methodType}`) {
51900
51902
  case "client:unary": {
51901
51903
  const incomingStream = pushable({ objectMode: true });
51902
- const incomingMessages = client2[name.toUpperCase()](incomingStream);
51904
+ const incomingMessages = client2[name.toUpperCase()](incomingStream, {
51905
+ metadata: encodeMetadata({
51906
+ BETTER_GRPC_CLIENT_ID: this.clientID
51907
+ })
51908
+ });
51903
51909
  (async () => {
51904
51910
  try {
51905
51911
  for await (const message of incomingMessages) {
@@ -51923,7 +51929,12 @@ var GrpcClient = class {
51923
51929
  outStream
51924
51930
  );
51925
51931
  this.setStream(`${serviceImpl.serviceClass.serviceName}_IN`, name.toUpperCase(), inStream);
51926
- const incomingMessages = context ? client2[name.toUpperCase()](outStream, { metadata: encodeMetadata(context.metadata) }) : client2[name.toUpperCase()](outStream);
51932
+ const incomingMessages = client2[name.toUpperCase()](outStream, {
51933
+ metadata: encodeMetadata({
51934
+ ...context?.metadata ?? {},
51935
+ BETTER_GRPC_CLIENT_ID: this.clientID
51936
+ })
51937
+ });
51927
51938
  (async () => {
51928
51939
  try {
51929
51940
  for await (const message of incomingMessages) {