@kinotic-ai/core 1.9.1 → 2.0.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.
package/dist/index.cjs CHANGED
@@ -64,6 +64,7 @@ var __export = (target, all) => {
64
64
  // packages/core/src/index.ts
65
65
  var exports_src = {};
66
66
  __export(exports_src, {
67
+ receivesContext: () => receivesContext,
67
68
  createCRI: () => createCRI,
68
69
  createAuthenticatedWebSocketFactory: () => createAuthenticatedWebSocketFactory,
69
70
  Version: () => Version,
@@ -95,7 +96,6 @@ __export(exports_src, {
95
96
  Context: () => Context,
96
97
  ConnectionInfo: () => ConnectionInfo,
97
98
  ConnectedInfo: () => ConnectedInfo,
98
- CONTEXT_METADATA_KEY: () => CONTEXT_METADATA_KEY,
99
99
  BearerTokenAuthProvider: () => BearerTokenAuthProvider,
100
100
  BasicAuthProvider: () => BasicAuthProvider,
101
101
  AbstractIterablePage: () => AbstractIterablePage
@@ -779,9 +779,6 @@ function createDebugLogger(namespace) {
779
779
  };
780
780
  }
781
781
 
782
- // packages/core/src/api/KinoticDecorators.ts
783
- var import_reflect_metadata = require("reflect-metadata");
784
-
785
782
  // packages/core/src/api/ServiceIdentifier.ts
786
783
  class ServiceIdentifier {
787
784
  namespace;
@@ -805,47 +802,74 @@ class ServiceIdentifier {
805
802
  }
806
803
 
807
804
  // packages/core/src/api/KinoticDecorators.ts
808
- var SCOPE_METADATA_KEY = Symbol("scope");
809
- var VERSION_METADATA_KEY = Symbol("version");
810
- var CONTEXT_METADATA_KEY = Symbol("context");
811
- function Scope(target, propertyKey, descriptor) {
812
- Reflect.defineMetadata(SCOPE_METADATA_KEY, propertyKey, target);
805
+ var scopeFunctions = new WeakSet;
806
+ var versionRegistry = new WeakMap;
807
+ var contextMarkedFunctions = new WeakSet;
808
+ function findInConstructorChain(registry, constructor) {
809
+ let current = constructor;
810
+ while (current) {
811
+ const value = registry.get(current);
812
+ if (value !== undefined) {
813
+ return value;
814
+ }
815
+ current = Object.getPrototypeOf(current);
816
+ }
817
+ return;
818
+ }
819
+ function resolveScope(instance) {
820
+ let proto = Object.getPrototypeOf(instance);
821
+ while (proto && proto !== Object.prototype) {
822
+ for (const key of Object.getOwnPropertyNames(proto)) {
823
+ if (key === "constructor") {
824
+ continue;
825
+ }
826
+ const descriptor = Object.getOwnPropertyDescriptor(proto, key);
827
+ if (descriptor?.get && scopeFunctions.has(descriptor.get)) {
828
+ return descriptor.get.call(instance);
829
+ }
830
+ if (typeof descriptor?.value === "function" && scopeFunctions.has(descriptor.value)) {
831
+ return descriptor.value.call(instance);
832
+ }
833
+ }
834
+ proto = Object.getPrototypeOf(proto);
835
+ }
836
+ return;
837
+ }
838
+ function Scope(value, _context) {
839
+ scopeFunctions.add(value);
813
840
  }
814
841
  function Version(version) {
815
842
  if (!/^\d+\.\d+\.\d+(-[a-zA-Z0-9]+)?$/.test(version)) {
816
843
  throw new Error(`Invalid semantic version: ${version}. Must follow X.Y.Z[-optional] format.`);
817
844
  }
818
- return function(target) {
819
- Reflect.defineMetadata(VERSION_METADATA_KEY, version, target);
845
+ return function(value, _context) {
846
+ versionRegistry.set(value, version);
820
847
  };
821
848
  }
822
- function Context() {
823
- return function(target, propertyKey, parameterIndex) {
824
- const existingContexts = Reflect.getMetadata(CONTEXT_METADATA_KEY, target, propertyKey) || [];
825
- existingContexts.push(parameterIndex);
826
- Reflect.defineMetadata(CONTEXT_METADATA_KEY, existingContexts, target, propertyKey);
827
- };
849
+ function Context(value, _context) {
850
+ contextMarkedFunctions.add(value);
851
+ }
852
+ function receivesContext(serviceInstance, methodName) {
853
+ const method = serviceInstance[methodName];
854
+ return typeof method === "function" && contextMarkedFunctions.has(method);
828
855
  }
829
856
  function Publish(namespace, name) {
830
- return function(target) {
831
- const original = target;
832
- const serviceIdentifier = new ServiceIdentifier(namespace, name || target.name);
833
- const version = Reflect.getMetadata(VERSION_METADATA_KEY, target);
834
- if (version) {
835
- serviceIdentifier.version = version;
836
- }
837
- const newConstructor = function(...args) {
838
- const instance = Reflect.construct(original, args);
839
- const scopeProperty = Reflect.getMetadata(SCOPE_METADATA_KEY, target.prototype);
840
- if (scopeProperty) {
841
- const scopeValue = instance[scopeProperty];
842
- serviceIdentifier.scope = typeof scopeValue === "function" ? scopeValue.call(instance) : scopeValue;
857
+ return function(value, _context) {
858
+ return class extends value {
859
+ constructor(...args) {
860
+ super(...args);
861
+ const serviceIdentifier = new ServiceIdentifier(namespace, name || value.name);
862
+ const version = findInConstructorChain(versionRegistry, this.constructor);
863
+ if (version) {
864
+ serviceIdentifier.version = version;
865
+ }
866
+ const scope = resolveScope(this);
867
+ if (scope !== undefined) {
868
+ serviceIdentifier.scope = scope;
869
+ }
870
+ Kinotic.serviceRegistry.register(serviceIdentifier, this);
843
871
  }
844
- Kinotic.serviceRegistry.register(serviceIdentifier, instance);
845
- return instance;
846
872
  };
847
- newConstructor.prototype = original.prototype;
848
- return newConstructor;
849
873
  };
850
874
  }
851
875
 
@@ -925,11 +949,15 @@ class ServiceInvocationSupervisor {
925
949
  }
926
950
  buildMethodMap(serviceInstance) {
927
951
  const methodMap = {};
928
- for (const key of Object.getOwnPropertyNames(Object.getPrototypeOf(serviceInstance))) {
929
- const method = serviceInstance[key];
930
- if (typeof method === "function" && key !== "constructor") {
931
- methodMap[key] = method.bind(serviceInstance);
952
+ let proto = Object.getPrototypeOf(serviceInstance);
953
+ while (proto && proto !== Object.prototype) {
954
+ for (const key of Object.getOwnPropertyNames(proto)) {
955
+ const descriptor = Object.getOwnPropertyDescriptor(proto, key);
956
+ if (typeof descriptor?.value === "function" && key !== "constructor" && !methodMap[key]) {
957
+ methodMap[key] = descriptor.value.bind(serviceInstance);
958
+ }
932
959
  }
960
+ proto = Object.getPrototypeOf(proto);
933
961
  }
934
962
  return methodMap;
935
963
  }
@@ -969,7 +997,7 @@ class ServiceInvocationSupervisor {
969
997
  }
970
998
  const methodName = path;
971
999
  const args = this.argumentResolver.resolveArguments(event);
972
- const contextIndices = Reflect.getMetadata(CONTEXT_METADATA_KEY, this.serviceInstance, methodName) || [];
1000
+ const injectContext = receivesContext(this.serviceInstance, methodName);
973
1001
  let context2 = {};
974
1002
  const interceptor = this.interceptorProvider();
975
1003
  if (interceptor) {
@@ -981,8 +1009,8 @@ class ServiceInvocationSupervisor {
981
1009
  return;
982
1010
  }
983
1011
  }
984
- for (const index of contextIndices) {
985
- args[index] = context2;
1012
+ if (injectContext) {
1013
+ args.push(context2);
986
1014
  }
987
1015
  const expectedArgsCount = handlerMethod.length;
988
1016
  if (args.length !== expectedArgsCount) {
@@ -1036,7 +1064,7 @@ var import_operators2 = require("rxjs/operators");
1036
1064
  // packages/core/package.json
1037
1065
  var package_default = {
1038
1066
  name: "@kinotic-ai/core",
1039
- version: "1.9.1",
1067
+ version: "2.0.0",
1040
1068
  type: "module",
1041
1069
  files: [
1042
1070
  "dist"
@@ -1098,7 +1126,6 @@ var package_default = {
1098
1126
  "@types/debug": "^4.1.13",
1099
1127
  debug: "^4.4.3",
1100
1128
  "p-tap": "^4.0.0",
1101
- "reflect-metadata": "^0.2.2",
1102
1129
  rxjs: "^7.8.2",
1103
1130
  "typescript-optional": "3.0.0-alpha.3",
1104
1131
  uuid: "^13.0.0"
package/dist/index.d.cts CHANGED
@@ -648,11 +648,37 @@ declare class KinoticSingleton implements IKinotic {
648
648
  * The default {@link IKinotic} instance that can be used to access Kinotic services
649
649
  */
650
650
  declare const Kinotic: KinoticSingleton;
651
- declare const CONTEXT_METADATA_KEY: unique symbol;
652
- declare function Scope(target: any, propertyKey: string, descriptor?: PropertyDescriptor): void;
653
- declare function Version(version: string): (target: Function) => void;
654
- declare function Context(): (target: any, propertyKey: string, parameterIndex: number) => void;
655
- declare function Publish(namespace: string, name?: string): (target: Function) => any;
651
+ /**
652
+ * Marks the getter or method that provides the service's scope, which targets requests at one
653
+ * specific instance of the service, such as the copy running on a particular node. It is
654
+ * invoked on each instance when the instance registers with the ServiceRegistry.
655
+ */
656
+ declare function Scope(value: Function, _context: ClassGetterDecoratorContext | ClassMethodDecoratorContext): void;
657
+ /**
658
+ * Sets the semantic version a service registers under.
659
+ * @param version the version in X.Y.Z[-optional] format
660
+ */
661
+ declare function Version(version: string): (value: Function, _context: ClassDecoratorContext<any>) => void;
662
+ /**
663
+ * Marks a service method that receives the {@link ServiceContext} produced by the registered
664
+ * {@link ContextInterceptor}. The context parameter MUST be the method's final parameter:
665
+ * callers do not pass it, and the platform appends it after the caller-supplied arguments.
666
+ */
667
+ declare function Context(value: Function, _context: ClassMethodDecoratorContext): void;
668
+ /**
669
+ * Returns whether the given method of a service instance is marked with {@link Context}.
670
+ * @param serviceInstance the service instance to inspect
671
+ * @param methodName the method to look up
672
+ */
673
+ declare function receivesContext(serviceInstance: object, methodName: string): boolean;
674
+ /**
675
+ * Registers each instance of the decorated class with the Kinotic ServiceRegistry under the
676
+ * given namespace. The service name defaults to the class name; {@link Version} and
677
+ * {@link Scope} on the same class refine the registration.
678
+ * @param namespace the namespace the service is published under
679
+ * @param name the service name, defaults to the class name
680
+ */
681
+ declare function Publish(namespace: string, name?: string): <T extends new (...args: any[]) => object>(value: T, _context: ClassDecoratorContext<any>) => T;
656
682
  /**
657
683
  * A page is a sublist of a list of objects.
658
684
  * @author Navid Mitchell
@@ -1171,4 +1197,4 @@ declare class ParticipantConstants {
1171
1197
  static readonly PARTICIPANT_TYPE_NODE: string;
1172
1198
  static readonly CLI_PARTICIPANT_ID: string;
1173
1199
  }
1174
- export { createCRI, createAuthenticatedWebSocketFactory, WebSocketFactory, Version, TextEventFactory, Sort, SessionKeepAliveMode, ServiceRegistry, ServiceContext, ServerInfo, Scope, Publish, ParticipantConstants, Participant, Pageable, Page, Order, OffsetPageable, NullHandling, KinoticSingleton, KinoticPlugin, Kinotic, JsonEventFactory, IterablePage, Identifiable, IWebSocket, IServiceRegistry, IServiceProxy, IParticipant, IKinotic, IEventFactory, IEventBus, IEvent, IEditableDataSource, IDataSource, ICrudServiceProxyFactory, ICrudServiceProxy, IAuthProvider, FunctionalIterablePage, EventConstants, EventBus, Event, Direction, DefaultCRI, DataSourceUtils, CursorPageable, CrudServiceProxyFactory, CrudServiceProxy, ContextInterceptor, Context, ConnectionInfo, ConnectedInfo, CRI, CONTEXT_METADATA_KEY, BearerTokenAuthProvider, BasicAuthProvider, AbstractIterablePage };
1200
+ export { receivesContext, createCRI, createAuthenticatedWebSocketFactory, WebSocketFactory, Version, TextEventFactory, Sort, SessionKeepAliveMode, ServiceRegistry, ServiceContext, ServerInfo, Scope, Publish, ParticipantConstants, Participant, Pageable, Page, Order, OffsetPageable, NullHandling, KinoticSingleton, KinoticPlugin, Kinotic, JsonEventFactory, IterablePage, Identifiable, IWebSocket, IServiceRegistry, IServiceProxy, IParticipant, IKinotic, IEventFactory, IEventBus, IEvent, IEditableDataSource, IDataSource, ICrudServiceProxyFactory, ICrudServiceProxy, IAuthProvider, FunctionalIterablePage, EventConstants, EventBus, Event, Direction, DefaultCRI, DataSourceUtils, CursorPageable, CrudServiceProxyFactory, CrudServiceProxy, ContextInterceptor, Context, ConnectionInfo, ConnectedInfo, CRI, BearerTokenAuthProvider, BasicAuthProvider, AbstractIterablePage };
package/dist/index.d.ts CHANGED
@@ -648,11 +648,37 @@ declare class KinoticSingleton implements IKinotic {
648
648
  * The default {@link IKinotic} instance that can be used to access Kinotic services
649
649
  */
650
650
  declare const Kinotic: KinoticSingleton;
651
- declare const CONTEXT_METADATA_KEY: unique symbol;
652
- declare function Scope(target: any, propertyKey: string, descriptor?: PropertyDescriptor): void;
653
- declare function Version(version: string): (target: Function) => void;
654
- declare function Context(): (target: any, propertyKey: string, parameterIndex: number) => void;
655
- declare function Publish(namespace: string, name?: string): (target: Function) => any;
651
+ /**
652
+ * Marks the getter or method that provides the service's scope, which targets requests at one
653
+ * specific instance of the service, such as the copy running on a particular node. It is
654
+ * invoked on each instance when the instance registers with the ServiceRegistry.
655
+ */
656
+ declare function Scope(value: Function, _context: ClassGetterDecoratorContext | ClassMethodDecoratorContext): void;
657
+ /**
658
+ * Sets the semantic version a service registers under.
659
+ * @param version the version in X.Y.Z[-optional] format
660
+ */
661
+ declare function Version(version: string): (value: Function, _context: ClassDecoratorContext<any>) => void;
662
+ /**
663
+ * Marks a service method that receives the {@link ServiceContext} produced by the registered
664
+ * {@link ContextInterceptor}. The context parameter MUST be the method's final parameter:
665
+ * callers do not pass it, and the platform appends it after the caller-supplied arguments.
666
+ */
667
+ declare function Context(value: Function, _context: ClassMethodDecoratorContext): void;
668
+ /**
669
+ * Returns whether the given method of a service instance is marked with {@link Context}.
670
+ * @param serviceInstance the service instance to inspect
671
+ * @param methodName the method to look up
672
+ */
673
+ declare function receivesContext(serviceInstance: object, methodName: string): boolean;
674
+ /**
675
+ * Registers each instance of the decorated class with the Kinotic ServiceRegistry under the
676
+ * given namespace. The service name defaults to the class name; {@link Version} and
677
+ * {@link Scope} on the same class refine the registration.
678
+ * @param namespace the namespace the service is published under
679
+ * @param name the service name, defaults to the class name
680
+ */
681
+ declare function Publish(namespace: string, name?: string): <T extends new (...args: any[]) => object>(value: T, _context: ClassDecoratorContext<any>) => T;
656
682
  /**
657
683
  * A page is a sublist of a list of objects.
658
684
  * @author Navid Mitchell
@@ -1171,4 +1197,4 @@ declare class ParticipantConstants {
1171
1197
  static readonly PARTICIPANT_TYPE_NODE: string;
1172
1198
  static readonly CLI_PARTICIPANT_ID: string;
1173
1199
  }
1174
- export { createCRI, createAuthenticatedWebSocketFactory, WebSocketFactory, Version, TextEventFactory, Sort, SessionKeepAliveMode, ServiceRegistry, ServiceContext, ServerInfo, Scope, Publish, ParticipantConstants, Participant, Pageable, Page, Order, OffsetPageable, NullHandling, KinoticSingleton, KinoticPlugin, Kinotic, JsonEventFactory, IterablePage, Identifiable, IWebSocket, IServiceRegistry, IServiceProxy, IParticipant, IKinotic, IEventFactory, IEventBus, IEvent, IEditableDataSource, IDataSource, ICrudServiceProxyFactory, ICrudServiceProxy, IAuthProvider, FunctionalIterablePage, EventConstants, EventBus, Event, Direction, DefaultCRI, DataSourceUtils, CursorPageable, CrudServiceProxyFactory, CrudServiceProxy, ContextInterceptor, Context, ConnectionInfo, ConnectedInfo, CRI, CONTEXT_METADATA_KEY, BearerTokenAuthProvider, BasicAuthProvider, AbstractIterablePage };
1200
+ export { receivesContext, createCRI, createAuthenticatedWebSocketFactory, WebSocketFactory, Version, TextEventFactory, Sort, SessionKeepAliveMode, ServiceRegistry, ServiceContext, ServerInfo, Scope, Publish, ParticipantConstants, Participant, Pageable, Page, Order, OffsetPageable, NullHandling, KinoticSingleton, KinoticPlugin, Kinotic, JsonEventFactory, IterablePage, Identifiable, IWebSocket, IServiceRegistry, IServiceProxy, IParticipant, IKinotic, IEventFactory, IEventBus, IEvent, IEditableDataSource, IDataSource, ICrudServiceProxyFactory, ICrudServiceProxy, IAuthProvider, FunctionalIterablePage, EventConstants, EventBus, Event, Direction, DefaultCRI, DataSourceUtils, CursorPageable, CrudServiceProxyFactory, CrudServiceProxy, ContextInterceptor, Context, ConnectionInfo, ConnectedInfo, CRI, BearerTokenAuthProvider, BasicAuthProvider, AbstractIterablePage };
package/dist/index.js CHANGED
@@ -678,9 +678,6 @@ function createDebugLogger(namespace) {
678
678
  };
679
679
  }
680
680
 
681
- // packages/core/src/api/KinoticDecorators.ts
682
- import"reflect-metadata";
683
-
684
681
  // packages/core/src/api/ServiceIdentifier.ts
685
682
  class ServiceIdentifier {
686
683
  namespace;
@@ -704,47 +701,74 @@ class ServiceIdentifier {
704
701
  }
705
702
 
706
703
  // packages/core/src/api/KinoticDecorators.ts
707
- var SCOPE_METADATA_KEY = Symbol("scope");
708
- var VERSION_METADATA_KEY = Symbol("version");
709
- var CONTEXT_METADATA_KEY = Symbol("context");
710
- function Scope(target, propertyKey, descriptor) {
711
- Reflect.defineMetadata(SCOPE_METADATA_KEY, propertyKey, target);
704
+ var scopeFunctions = new WeakSet;
705
+ var versionRegistry = new WeakMap;
706
+ var contextMarkedFunctions = new WeakSet;
707
+ function findInConstructorChain(registry, constructor) {
708
+ let current = constructor;
709
+ while (current) {
710
+ const value = registry.get(current);
711
+ if (value !== undefined) {
712
+ return value;
713
+ }
714
+ current = Object.getPrototypeOf(current);
715
+ }
716
+ return;
717
+ }
718
+ function resolveScope(instance) {
719
+ let proto = Object.getPrototypeOf(instance);
720
+ while (proto && proto !== Object.prototype) {
721
+ for (const key of Object.getOwnPropertyNames(proto)) {
722
+ if (key === "constructor") {
723
+ continue;
724
+ }
725
+ const descriptor = Object.getOwnPropertyDescriptor(proto, key);
726
+ if (descriptor?.get && scopeFunctions.has(descriptor.get)) {
727
+ return descriptor.get.call(instance);
728
+ }
729
+ if (typeof descriptor?.value === "function" && scopeFunctions.has(descriptor.value)) {
730
+ return descriptor.value.call(instance);
731
+ }
732
+ }
733
+ proto = Object.getPrototypeOf(proto);
734
+ }
735
+ return;
736
+ }
737
+ function Scope(value, _context) {
738
+ scopeFunctions.add(value);
712
739
  }
713
740
  function Version(version) {
714
741
  if (!/^\d+\.\d+\.\d+(-[a-zA-Z0-9]+)?$/.test(version)) {
715
742
  throw new Error(`Invalid semantic version: ${version}. Must follow X.Y.Z[-optional] format.`);
716
743
  }
717
- return function(target) {
718
- Reflect.defineMetadata(VERSION_METADATA_KEY, version, target);
744
+ return function(value, _context) {
745
+ versionRegistry.set(value, version);
719
746
  };
720
747
  }
721
- function Context() {
722
- return function(target, propertyKey, parameterIndex) {
723
- const existingContexts = Reflect.getMetadata(CONTEXT_METADATA_KEY, target, propertyKey) || [];
724
- existingContexts.push(parameterIndex);
725
- Reflect.defineMetadata(CONTEXT_METADATA_KEY, existingContexts, target, propertyKey);
726
- };
748
+ function Context(value, _context) {
749
+ contextMarkedFunctions.add(value);
750
+ }
751
+ function receivesContext(serviceInstance, methodName) {
752
+ const method = serviceInstance[methodName];
753
+ return typeof method === "function" && contextMarkedFunctions.has(method);
727
754
  }
728
755
  function Publish(namespace, name) {
729
- return function(target) {
730
- const original = target;
731
- const serviceIdentifier = new ServiceIdentifier(namespace, name || target.name);
732
- const version = Reflect.getMetadata(VERSION_METADATA_KEY, target);
733
- if (version) {
734
- serviceIdentifier.version = version;
735
- }
736
- const newConstructor = function(...args) {
737
- const instance = Reflect.construct(original, args);
738
- const scopeProperty = Reflect.getMetadata(SCOPE_METADATA_KEY, target.prototype);
739
- if (scopeProperty) {
740
- const scopeValue = instance[scopeProperty];
741
- serviceIdentifier.scope = typeof scopeValue === "function" ? scopeValue.call(instance) : scopeValue;
756
+ return function(value, _context) {
757
+ return class extends value {
758
+ constructor(...args) {
759
+ super(...args);
760
+ const serviceIdentifier = new ServiceIdentifier(namespace, name || value.name);
761
+ const version = findInConstructorChain(versionRegistry, this.constructor);
762
+ if (version) {
763
+ serviceIdentifier.version = version;
764
+ }
765
+ const scope = resolveScope(this);
766
+ if (scope !== undefined) {
767
+ serviceIdentifier.scope = scope;
768
+ }
769
+ Kinotic.serviceRegistry.register(serviceIdentifier, this);
742
770
  }
743
- Kinotic.serviceRegistry.register(serviceIdentifier, instance);
744
- return instance;
745
771
  };
746
- newConstructor.prototype = original.prototype;
747
- return newConstructor;
748
772
  };
749
773
  }
750
774
 
@@ -824,11 +848,15 @@ class ServiceInvocationSupervisor {
824
848
  }
825
849
  buildMethodMap(serviceInstance) {
826
850
  const methodMap = {};
827
- for (const key of Object.getOwnPropertyNames(Object.getPrototypeOf(serviceInstance))) {
828
- const method = serviceInstance[key];
829
- if (typeof method === "function" && key !== "constructor") {
830
- methodMap[key] = method.bind(serviceInstance);
851
+ let proto = Object.getPrototypeOf(serviceInstance);
852
+ while (proto && proto !== Object.prototype) {
853
+ for (const key of Object.getOwnPropertyNames(proto)) {
854
+ const descriptor = Object.getOwnPropertyDescriptor(proto, key);
855
+ if (typeof descriptor?.value === "function" && key !== "constructor" && !methodMap[key]) {
856
+ methodMap[key] = descriptor.value.bind(serviceInstance);
857
+ }
831
858
  }
859
+ proto = Object.getPrototypeOf(proto);
832
860
  }
833
861
  return methodMap;
834
862
  }
@@ -868,7 +896,7 @@ class ServiceInvocationSupervisor {
868
896
  }
869
897
  const methodName = path;
870
898
  const args = this.argumentResolver.resolveArguments(event);
871
- const contextIndices = Reflect.getMetadata(CONTEXT_METADATA_KEY, this.serviceInstance, methodName) || [];
899
+ const injectContext = receivesContext(this.serviceInstance, methodName);
872
900
  let context2 = {};
873
901
  const interceptor = this.interceptorProvider();
874
902
  if (interceptor) {
@@ -880,8 +908,8 @@ class ServiceInvocationSupervisor {
880
908
  return;
881
909
  }
882
910
  }
883
- for (const index of contextIndices) {
884
- args[index] = context2;
911
+ if (injectContext) {
912
+ args.push(context2);
885
913
  }
886
914
  const expectedArgsCount = handlerMethod.length;
887
915
  if (args.length !== expectedArgsCount) {
@@ -938,7 +966,7 @@ import { first, map as map2 } from "rxjs/operators";
938
966
  // packages/core/package.json
939
967
  var package_default = {
940
968
  name: "@kinotic-ai/core",
941
- version: "1.9.1",
969
+ version: "2.0.0",
942
970
  type: "module",
943
971
  files: [
944
972
  "dist"
@@ -1000,7 +1028,6 @@ var package_default = {
1000
1028
  "@types/debug": "^4.1.13",
1001
1029
  debug: "^4.4.3",
1002
1030
  "p-tap": "^4.0.0",
1003
- "reflect-metadata": "^0.2.2",
1004
1031
  rxjs: "^7.8.2",
1005
1032
  "typescript-optional": "3.0.0-alpha.3",
1006
1033
  uuid: "^13.0.0"
@@ -1464,6 +1491,7 @@ class ParticipantConstants {
1464
1491
  static CLI_PARTICIPANT_ID = "-42-Kinotic-CLI-42-";
1465
1492
  }
1466
1493
  export {
1494
+ receivesContext,
1467
1495
  createCRI,
1468
1496
  createAuthenticatedWebSocketFactory,
1469
1497
  Version,
@@ -1495,7 +1523,6 @@ export {
1495
1523
  Context,
1496
1524
  ConnectionInfo,
1497
1525
  ConnectedInfo,
1498
- CONTEXT_METADATA_KEY,
1499
1526
  BearerTokenAuthProvider,
1500
1527
  BasicAuthProvider,
1501
1528
  AbstractIterablePage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kinotic-ai/core",
3
- "version": "1.9.1",
3
+ "version": "2.0.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -62,7 +62,6 @@
62
62
  "@types/debug": "^4.1.13",
63
63
  "debug": "^4.4.3",
64
64
  "p-tap": "^4.0.0",
65
- "reflect-metadata": "^0.2.2",
66
65
  "rxjs": "^7.8.2",
67
66
  "typescript-optional": "3.0.0-alpha.3",
68
67
  "uuid": "^13.0.0"