@kinotic-ai/core 5.0.0-beta.22 → 5.0.0-beta.23

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
@@ -69,7 +69,7 @@ __export(exports_src, {
69
69
  scopeOptionalMethodNames: () => scopeOptionalMethodNames,
70
70
  receivesContext: () => receivesContext,
71
71
  isAdvertised: () => isAdvertised,
72
- declaresAuthzResource: () => declaresAuthzResource,
72
+ declaresAuthz: () => declaresAuthz,
73
73
  declareServiceDefinitions: () => declareServiceDefinitions,
74
74
  createCRI: () => createCRI,
75
75
  buildServerUrl: () => buildServerUrl,
@@ -1186,6 +1186,7 @@ var zonesRegistry = new WeakMap;
1186
1186
  var advertisedRegistry = new WeakMap;
1187
1187
  var contextMarkedFunctions = new WeakSet;
1188
1188
  var authzResourceClasses = new WeakSet;
1189
+ var authzUncheckedClasses = new WeakSet;
1189
1190
  function findInConstructorChain(registry, constructor) {
1190
1191
  let current = constructor;
1191
1192
  while (current) {
@@ -1284,12 +1285,16 @@ function AuthzResource(declaration) {
1284
1285
  function AuthzCheck(declaration) {
1285
1286
  return function(_value, _context) {};
1286
1287
  }
1287
- function AuthzUnchecked(_value, _context) {}
1288
- function declaresAuthzResource(serviceInstance) {
1288
+ function AuthzUnchecked(value, context2) {
1289
+ if (context2.kind === "class") {
1290
+ authzUncheckedClasses.add(value);
1291
+ }
1292
+ }
1293
+ function declaresAuthz(serviceInstance) {
1289
1294
  let ret = false;
1290
1295
  let current = serviceInstance.constructor;
1291
1296
  while (current && !ret) {
1292
- ret = authzResourceClasses.has(current);
1297
+ ret = authzResourceClasses.has(current) || authzUncheckedClasses.has(current);
1293
1298
  current = Object.getPrototypeOf(current);
1294
1299
  }
1295
1300
  return ret;
@@ -1321,7 +1326,7 @@ var import_api2 = __toESM(require("@opentelemetry/api"));
1321
1326
  // packages/core/package.json
1322
1327
  var package_default = {
1323
1328
  name: "@kinotic-ai/core",
1324
- version: "5.0.0-beta.22",
1329
+ version: "5.0.0-beta.23",
1325
1330
  type: "module",
1326
1331
  files: [
1327
1332
  "dist"
@@ -1825,8 +1830,8 @@ function directoryEntryOf(serviceInstance, serviceIdentifier) {
1825
1830
  advertised: isAdvertised(serviceInstance),
1826
1831
  serviceDefinition: definition
1827
1832
  };
1828
- } else if (declaresAuthzResource(serviceInstance)) {
1829
- throw new Error(`${qualifiedName} declares a resource but the project declares no definition for it;` + " run kinotic sync and import the generated ServiceDefinitions module");
1833
+ } else if (declaresAuthz(serviceInstance)) {
1834
+ throw new Error(`${qualifiedName} declares a resource or is marked unchecked, but the project declares no definition for it;` + " run kinotic sync and import the generated ServiceDefinitions module");
1830
1835
  }
1831
1836
  }
1832
1837
  return ret;
package/dist/index.d.cts CHANGED
@@ -840,8 +840,8 @@ interface AuthzCheckDeclaration {
840
840
  */
841
841
  permission?: string | null;
842
842
  /**
843
- * The type of the resource the check is made on, when it is not the service's own type: the parent for a
844
- * create, or a template such as `{definitionId}` for a function whose type is an argument.
843
+ * The type of the resource the check is made on, when it is not the service's own type, such as the parent for a
844
+ * create. A type name, never a template.
845
845
  */
846
846
  resource?: string | null;
847
847
  /**
@@ -950,18 +950,21 @@ declare function AuthzResource(declaration: AuthzResourceDeclaration | string):
950
950
  */
951
951
  declare function AuthzCheck(declaration: AuthzCheckDeclaration): (_value: Function, _context: ClassMethodDecoratorContext) => void;
952
952
  /**
953
- * Marks a function of an {@link AuthzResource} service that is served with no authorization check, which
954
- * `kinotic sync` reads into the service's definition: any caller the service's zone admits may call it, and the
955
- * service itself is responsible for answering only what the caller may see or do. It is for a function that has
956
- * no resource to check, such as a listing of the caller's own grants. A function carrying this and
957
- * {@link AuthzCheck} fails the service's registration.
953
+ * Marks a function of an {@link AuthzResource} service, or a whole class declaring no resource, as served with
954
+ * no authorization check, which `kinotic sync` reads into the service's definition: any caller the service's
955
+ * zone admits may call it, and the service itself is responsible for answering only what the caller may see or
956
+ * do. It is for a function that has no resource to check, such as a listing of the caller's own grants, and for a
957
+ * service whose every function answers for the caller alone. The mark is the only way a function is served
958
+ * unchecked: a function the definition neither checks nor marks is refused. A function carrying this and
959
+ * {@link AuthzCheck} fails the service's registration, as does a class carrying this and {@link AuthzResource}.
958
960
  */
959
- declare function AuthzUnchecked(_value: Function, _context: ClassMethodDecoratorContext): void;
961
+ declare function AuthzUnchecked(value: Function, context: ClassDecoratorContext<any> | ClassMethodDecoratorContext): void;
960
962
  /**
961
- * Returns whether the given service instance's class, or a class it extends, declares an {@link AuthzResource}.
963
+ * Returns whether the given service instance's class, or a class it extends, declares an {@link AuthzResource} or
964
+ * is marked {@link AuthzUnchecked}: either way the service's definition carries what the platform serves it by.
962
965
  * @param serviceInstance the service instance to inspect
963
966
  */
964
- declare function declaresAuthzResource(serviceInstance: object): boolean;
967
+ declare function declaresAuthz(serviceInstance: object): boolean;
965
968
  /**
966
969
  * Registers each instance of the decorated class with the Kinotic ServiceRegistry.
967
970
  * The service name defaults to the class name; {@link Version}, {@link Scope}, and {@link Zone}
@@ -1598,4 +1601,4 @@ declare class ParticipantConstants {
1598
1601
  /** The clientId the test server's TestSecurityService maps to the ANONYMOUS role in core package tests. */
1599
1602
  static readonly CLI_PARTICIPANT_ID: string;
1600
1603
  }
1601
- export { validateZone, validateLabel, scopeOptionalMethodNames, receivesContext, isAdvertised, declaresAuthzResource, declareServiceDefinitions, createCRI, buildServerUrl, buildBrokerUrl, Zone, WebSocketFactory, Version, TextEventFactory, Sort, SessionKeepAliveMode, SessionCredentialsResolver, ServiceRegistry, ServiceIdentifier, ServiceDirectoryEntry, ServiceContext, ServerInfo, ScopeOptional, Scope, RpcError, ResolvedCredentials, 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, FunctionalIterablePage, EventConstants, EventBus, Event, EnvCredentialsResolver, Direction, DefaultCRI, DataSourceUtils, CursorPageable, CrudServiceProxyFactory, CrudServiceProxy, CredentialsResolver, ContextInterceptor, Context, ConnectedInfo, ConnectOptions, ChainedCredentialsResolver, CRI, BearerCredentialsResolver, BasicCredentialsResolver, AuthzUnchecked, AuthzRoleDeclaration, AuthzResourceDeclaration, AuthzResource, AuthzCheckDeclaration, AuthzCheck, AuthorizationException, AbstractIterablePage };
1604
+ export { validateZone, validateLabel, scopeOptionalMethodNames, receivesContext, isAdvertised, declaresAuthz, declareServiceDefinitions, createCRI, buildServerUrl, buildBrokerUrl, Zone, WebSocketFactory, Version, TextEventFactory, Sort, SessionKeepAliveMode, SessionCredentialsResolver, ServiceRegistry, ServiceIdentifier, ServiceDirectoryEntry, ServiceContext, ServerInfo, ScopeOptional, Scope, RpcError, ResolvedCredentials, 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, FunctionalIterablePage, EventConstants, EventBus, Event, EnvCredentialsResolver, Direction, DefaultCRI, DataSourceUtils, CursorPageable, CrudServiceProxyFactory, CrudServiceProxy, CredentialsResolver, ContextInterceptor, Context, ConnectedInfo, ConnectOptions, ChainedCredentialsResolver, CRI, BearerCredentialsResolver, BasicCredentialsResolver, AuthzUnchecked, AuthzRoleDeclaration, AuthzResourceDeclaration, AuthzResource, AuthzCheckDeclaration, AuthzCheck, AuthorizationException, AbstractIterablePage };
package/dist/index.d.ts CHANGED
@@ -840,8 +840,8 @@ interface AuthzCheckDeclaration {
840
840
  */
841
841
  permission?: string | null;
842
842
  /**
843
- * The type of the resource the check is made on, when it is not the service's own type: the parent for a
844
- * create, or a template such as `{definitionId}` for a function whose type is an argument.
843
+ * The type of the resource the check is made on, when it is not the service's own type, such as the parent for a
844
+ * create. A type name, never a template.
845
845
  */
846
846
  resource?: string | null;
847
847
  /**
@@ -950,18 +950,21 @@ declare function AuthzResource(declaration: AuthzResourceDeclaration | string):
950
950
  */
951
951
  declare function AuthzCheck(declaration: AuthzCheckDeclaration): (_value: Function, _context: ClassMethodDecoratorContext) => void;
952
952
  /**
953
- * Marks a function of an {@link AuthzResource} service that is served with no authorization check, which
954
- * `kinotic sync` reads into the service's definition: any caller the service's zone admits may call it, and the
955
- * service itself is responsible for answering only what the caller may see or do. It is for a function that has
956
- * no resource to check, such as a listing of the caller's own grants. A function carrying this and
957
- * {@link AuthzCheck} fails the service's registration.
953
+ * Marks a function of an {@link AuthzResource} service, or a whole class declaring no resource, as served with
954
+ * no authorization check, which `kinotic sync` reads into the service's definition: any caller the service's
955
+ * zone admits may call it, and the service itself is responsible for answering only what the caller may see or
956
+ * do. It is for a function that has no resource to check, such as a listing of the caller's own grants, and for a
957
+ * service whose every function answers for the caller alone. The mark is the only way a function is served
958
+ * unchecked: a function the definition neither checks nor marks is refused. A function carrying this and
959
+ * {@link AuthzCheck} fails the service's registration, as does a class carrying this and {@link AuthzResource}.
958
960
  */
959
- declare function AuthzUnchecked(_value: Function, _context: ClassMethodDecoratorContext): void;
961
+ declare function AuthzUnchecked(value: Function, context: ClassDecoratorContext<any> | ClassMethodDecoratorContext): void;
960
962
  /**
961
- * Returns whether the given service instance's class, or a class it extends, declares an {@link AuthzResource}.
963
+ * Returns whether the given service instance's class, or a class it extends, declares an {@link AuthzResource} or
964
+ * is marked {@link AuthzUnchecked}: either way the service's definition carries what the platform serves it by.
962
965
  * @param serviceInstance the service instance to inspect
963
966
  */
964
- declare function declaresAuthzResource(serviceInstance: object): boolean;
967
+ declare function declaresAuthz(serviceInstance: object): boolean;
965
968
  /**
966
969
  * Registers each instance of the decorated class with the Kinotic ServiceRegistry.
967
970
  * The service name defaults to the class name; {@link Version}, {@link Scope}, and {@link Zone}
@@ -1598,4 +1601,4 @@ declare class ParticipantConstants {
1598
1601
  /** The clientId the test server's TestSecurityService maps to the ANONYMOUS role in core package tests. */
1599
1602
  static readonly CLI_PARTICIPANT_ID: string;
1600
1603
  }
1601
- export { validateZone, validateLabel, scopeOptionalMethodNames, receivesContext, isAdvertised, declaresAuthzResource, declareServiceDefinitions, createCRI, buildServerUrl, buildBrokerUrl, Zone, WebSocketFactory, Version, TextEventFactory, Sort, SessionKeepAliveMode, SessionCredentialsResolver, ServiceRegistry, ServiceIdentifier, ServiceDirectoryEntry, ServiceContext, ServerInfo, ScopeOptional, Scope, RpcError, ResolvedCredentials, 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, FunctionalIterablePage, EventConstants, EventBus, Event, EnvCredentialsResolver, Direction, DefaultCRI, DataSourceUtils, CursorPageable, CrudServiceProxyFactory, CrudServiceProxy, CredentialsResolver, ContextInterceptor, Context, ConnectedInfo, ConnectOptions, ChainedCredentialsResolver, CRI, BearerCredentialsResolver, BasicCredentialsResolver, AuthzUnchecked, AuthzRoleDeclaration, AuthzResourceDeclaration, AuthzResource, AuthzCheckDeclaration, AuthzCheck, AuthorizationException, AbstractIterablePage };
1604
+ export { validateZone, validateLabel, scopeOptionalMethodNames, receivesContext, isAdvertised, declaresAuthz, declareServiceDefinitions, createCRI, buildServerUrl, buildBrokerUrl, Zone, WebSocketFactory, Version, TextEventFactory, Sort, SessionKeepAliveMode, SessionCredentialsResolver, ServiceRegistry, ServiceIdentifier, ServiceDirectoryEntry, ServiceContext, ServerInfo, ScopeOptional, Scope, RpcError, ResolvedCredentials, 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, FunctionalIterablePage, EventConstants, EventBus, Event, EnvCredentialsResolver, Direction, DefaultCRI, DataSourceUtils, CursorPageable, CrudServiceProxyFactory, CrudServiceProxy, CredentialsResolver, ContextInterceptor, Context, ConnectedInfo, ConnectOptions, ChainedCredentialsResolver, CRI, BearerCredentialsResolver, BasicCredentialsResolver, AuthzUnchecked, AuthzRoleDeclaration, AuthzResourceDeclaration, AuthzResource, AuthzCheckDeclaration, AuthzCheck, AuthorizationException, AbstractIterablePage };
package/dist/index.js CHANGED
@@ -1065,6 +1065,7 @@ var zonesRegistry = new WeakMap;
1065
1065
  var advertisedRegistry = new WeakMap;
1066
1066
  var contextMarkedFunctions = new WeakSet;
1067
1067
  var authzResourceClasses = new WeakSet;
1068
+ var authzUncheckedClasses = new WeakSet;
1068
1069
  function findInConstructorChain(registry, constructor) {
1069
1070
  let current = constructor;
1070
1071
  while (current) {
@@ -1163,12 +1164,16 @@ function AuthzResource(declaration) {
1163
1164
  function AuthzCheck(declaration) {
1164
1165
  return function(_value, _context) {};
1165
1166
  }
1166
- function AuthzUnchecked(_value, _context) {}
1167
- function declaresAuthzResource(serviceInstance) {
1167
+ function AuthzUnchecked(value, context2) {
1168
+ if (context2.kind === "class") {
1169
+ authzUncheckedClasses.add(value);
1170
+ }
1171
+ }
1172
+ function declaresAuthz(serviceInstance) {
1168
1173
  let ret = false;
1169
1174
  let current = serviceInstance.constructor;
1170
1175
  while (current && !ret) {
1171
- ret = authzResourceClasses.has(current);
1176
+ ret = authzResourceClasses.has(current) || authzUncheckedClasses.has(current);
1172
1177
  current = Object.getPrototypeOf(current);
1173
1178
  }
1174
1179
  return ret;
@@ -1200,7 +1205,7 @@ import opentelemetry, { context as context2, propagation as propagation2, trace,
1200
1205
  // packages/core/package.json
1201
1206
  var package_default = {
1202
1207
  name: "@kinotic-ai/core",
1203
- version: "5.0.0-beta.22",
1208
+ version: "5.0.0-beta.23",
1204
1209
  type: "module",
1205
1210
  files: [
1206
1211
  "dist"
@@ -1707,8 +1712,8 @@ function directoryEntryOf(serviceInstance, serviceIdentifier) {
1707
1712
  advertised: isAdvertised(serviceInstance),
1708
1713
  serviceDefinition: definition
1709
1714
  };
1710
- } else if (declaresAuthzResource(serviceInstance)) {
1711
- throw new Error(`${qualifiedName} declares a resource but the project declares no definition for it;` + " run kinotic sync and import the generated ServiceDefinitions module");
1715
+ } else if (declaresAuthz(serviceInstance)) {
1716
+ throw new Error(`${qualifiedName} declares a resource or is marked unchecked, but the project declares no definition for it;` + " run kinotic sync and import the generated ServiceDefinitions module");
1712
1717
  }
1713
1718
  }
1714
1719
  return ret;
@@ -2136,7 +2141,7 @@ export {
2136
2141
  scopeOptionalMethodNames,
2137
2142
  receivesContext,
2138
2143
  isAdvertised,
2139
- declaresAuthzResource,
2144
+ declaresAuthz,
2140
2145
  declareServiceDefinitions,
2141
2146
  createCRI,
2142
2147
  buildServerUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kinotic-ai/core",
3
- "version": "5.0.0-beta.22",
3
+ "version": "5.0.0-beta.23",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"