@kinotic-ai/core 5.0.0-beta.21 → 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 +13 -8
- package/dist/index.d.cts +29 -26
- package/dist/index.d.ts +29 -26
- package/dist/index.js +13 -8
- package/package.json +2 -2
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
|
-
|
|
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(
|
|
1288
|
-
|
|
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.
|
|
1329
|
+
version: "5.0.0-beta.23",
|
|
1325
1330
|
type: "module",
|
|
1326
1331
|
files: [
|
|
1327
1332
|
"dist"
|
|
@@ -1390,7 +1395,7 @@ var package_default = {
|
|
|
1390
1395
|
vitest: "^4.1.4"
|
|
1391
1396
|
},
|
|
1392
1397
|
dependencies: {
|
|
1393
|
-
"@kinotic-ai/idl": "workspace
|
|
1398
|
+
"@kinotic-ai/idl": "workspace:^",
|
|
1394
1399
|
"@opentelemetry/api": "^1.9.1",
|
|
1395
1400
|
"@opentelemetry/semantic-conventions": "^1.40.0",
|
|
1396
1401
|
"@stomp/rx-stomp": "^2.4.0",
|
|
@@ -1825,8 +1830,8 @@ function directoryEntryOf(serviceInstance, serviceIdentifier) {
|
|
|
1825
1830
|
advertised: isAdvertised(serviceInstance),
|
|
1826
1831
|
serviceDefinition: definition
|
|
1827
1832
|
};
|
|
1828
|
-
} else if (
|
|
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
|
@@ -804,22 +804,22 @@ interface AuthzRoleDeclaration {
|
|
|
804
804
|
interface AuthzResourceDeclaration {
|
|
805
805
|
/**
|
|
806
806
|
* The resource type, a single lowercase identifier such as `report`: it names the type in the model, prefixes
|
|
807
|
-
* the type's permissions (`report_can_view`) and roles (`report.editor`), and is the type of the
|
|
807
|
+
* the type's permissions (`report_can_view`) and roles (`report.editor`), and is the type of the resource every
|
|
808
808
|
* function is checked on unless the function names another with {@link AuthzCheck}.
|
|
809
809
|
*/
|
|
810
810
|
value: string;
|
|
811
811
|
/**
|
|
812
|
-
* The type that contains this one, such as `tenant` for `report`: a grant made on
|
|
813
|
-
* inherits to every
|
|
812
|
+
* The type that contains this one, such as `tenant` for `report`: a grant made on a resource of the parent type
|
|
813
|
+
* inherits to every resource of this type inside it, and a function naming no resource of its own, such as a
|
|
814
814
|
* listing or a create, is checked on the parent. Absent for a root type.
|
|
815
815
|
*/
|
|
816
816
|
parent?: string | null;
|
|
817
817
|
/**
|
|
818
|
-
* The
|
|
819
|
-
* request does not name: a template over the caller's scope, `{@applicationId}` or `{@tenantId}`, or a literal
|
|
820
|
-
* id. A function naming its own
|
|
818
|
+
* The resource every function of the service is checked on, for a service whose functions act on one resource
|
|
819
|
+
* the request does not name: a template over the caller's scope, `{@applicationId}` or `{@tenantId}`, or a literal
|
|
820
|
+
* id. A function naming its own resource with {@link AuthzCheck} is unaffected.
|
|
821
821
|
*/
|
|
822
|
-
|
|
822
|
+
resourceId?: string | null;
|
|
823
823
|
/**
|
|
824
824
|
* The permission every function of the service needs, as a short name such as `can_manage`, for a service whose
|
|
825
825
|
* functions all need the one permission whatever their names. A function declaring a permission of its own with
|
|
@@ -840,16 +840,16 @@ interface AuthzCheckDeclaration {
|
|
|
840
840
|
*/
|
|
841
841
|
permission?: string | null;
|
|
842
842
|
/**
|
|
843
|
-
* The type of the
|
|
844
|
-
* create
|
|
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
|
/**
|
|
848
|
-
* The id of the
|
|
848
|
+
* The id of the resource the check is made on, as a template over the function's parameters and the caller's
|
|
849
849
|
* scope: `{reportId}` is a parameter's value, `{registration.id}` a property of an object parameter, and
|
|
850
850
|
* `{@applicationId}` or `{@tenantId}` the matching id of the caller's scope.
|
|
851
851
|
*/
|
|
852
|
-
|
|
852
|
+
resourceId?: string | null;
|
|
853
853
|
/**
|
|
854
854
|
* Short names of permissions on the same type that this permission also grants, so a role bundling
|
|
855
855
|
* `can_generate` declared with `implies: ['can_view']` views what it generates.
|
|
@@ -919,14 +919,14 @@ declare function receivesContext(serviceInstance: object, methodName: string): b
|
|
|
919
919
|
* and the permissions its functions need become part of the application's authorization model, where roles
|
|
920
920
|
* bundle permissions and grants bind roles to callers.
|
|
921
921
|
*
|
|
922
|
-
* A function's check has three parts: the permission it needs, the type of the
|
|
923
|
-
* the id of that
|
|
922
|
+
* A function's check has three parts: the permission it needs, the type of the resource it is checked on, and
|
|
923
|
+
* the id of that resource. Each part is derived from the function's name and parameters where it can be;
|
|
924
924
|
* {@link AuthzCheck} states a part derivation gets wrong or cannot know, and {@link AuthzUnchecked} marks a
|
|
925
925
|
* function served with no check. A function left with no check and no marker fails the service's registration.
|
|
926
926
|
*
|
|
927
927
|
* The permission is derived from the first word of the function's name: `find`, `get`, `count`, `search` and
|
|
928
928
|
* `list` need `can_view`; `save`, `update` and `set` need `can_edit`; `delete` and `remove` need `can_delete`;
|
|
929
|
-
* `create` needs `can_edit` of this type on the parent. The
|
|
929
|
+
* `create` needs `can_edit` of this type on the parent. The resource's id is the parameter named `id` or
|
|
930
930
|
* `<type>Id` (`reportId` for the type `report`), else the `id` of the first object parameter; a function with
|
|
931
931
|
* neither is checked on the parent, whose id is found the same way with the parent's name, else on the caller's
|
|
932
932
|
* own scope.
|
|
@@ -935,33 +935,36 @@ declare function receivesContext(serviceInstance: object, methodName: string): b
|
|
|
935
935
|
* `report_can_view` on the report `id` names, `save(report: Report)` for `report_can_edit` on the report
|
|
936
936
|
* `report.id` names, and `findReports()` for `report_can_view` on the caller's tenant, with nothing declared on
|
|
937
937
|
* them. A runtime holding no definition for a service declaring a resource refuses to serve it.
|
|
938
|
-
* @param declaration the resource type, or the type with its parent,
|
|
938
|
+
* @param declaration the resource type, or the type with its parent, resource id, permission and roles
|
|
939
939
|
*/
|
|
940
940
|
declare function AuthzResource(declaration: AuthzResourceDeclaration | string): (value: Function, _context: ClassDecoratorContext<any>) => void;
|
|
941
941
|
/**
|
|
942
942
|
* States a part of one function's check that derivation gets wrong or cannot know, which `kinotic sync` reads
|
|
943
|
-
* into the service's definition: the permission, the type of the
|
|
943
|
+
* into the service's definition: the permission, the type of the resource, or its id. Every part left out keeps
|
|
944
944
|
* the derived value, or the one the service declares with {@link AuthzResource}, so a function states only the
|
|
945
945
|
* part derivation misses. A function served with no check is marked {@link AuthzUnchecked} instead.
|
|
946
946
|
*
|
|
947
|
-
* Example: `@AuthzCheck({permission: 'can_report',
|
|
947
|
+
* Example: `@AuthzCheck({permission: 'can_report', resourceId: '{registration.id}'})` on
|
|
948
948
|
* `heartbeat(registration: Registration)`, whose name derives no permission and whose id is inside the body.
|
|
949
949
|
* @param declaration the parts of the check derivation cannot read from the function's name and parameters
|
|
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
|
|
954
|
-
* `kinotic sync` reads into the service's definition: any caller the service's
|
|
955
|
-
* service itself is responsible for answering only what the caller may see or
|
|
956
|
-
* no
|
|
957
|
-
*
|
|
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(
|
|
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
|
|
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,
|
|
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
|
@@ -804,22 +804,22 @@ interface AuthzRoleDeclaration {
|
|
|
804
804
|
interface AuthzResourceDeclaration {
|
|
805
805
|
/**
|
|
806
806
|
* The resource type, a single lowercase identifier such as `report`: it names the type in the model, prefixes
|
|
807
|
-
* the type's permissions (`report_can_view`) and roles (`report.editor`), and is the type of the
|
|
807
|
+
* the type's permissions (`report_can_view`) and roles (`report.editor`), and is the type of the resource every
|
|
808
808
|
* function is checked on unless the function names another with {@link AuthzCheck}.
|
|
809
809
|
*/
|
|
810
810
|
value: string;
|
|
811
811
|
/**
|
|
812
|
-
* The type that contains this one, such as `tenant` for `report`: a grant made on
|
|
813
|
-
* inherits to every
|
|
812
|
+
* The type that contains this one, such as `tenant` for `report`: a grant made on a resource of the parent type
|
|
813
|
+
* inherits to every resource of this type inside it, and a function naming no resource of its own, such as a
|
|
814
814
|
* listing or a create, is checked on the parent. Absent for a root type.
|
|
815
815
|
*/
|
|
816
816
|
parent?: string | null;
|
|
817
817
|
/**
|
|
818
|
-
* The
|
|
819
|
-
* request does not name: a template over the caller's scope, `{@applicationId}` or `{@tenantId}`, or a literal
|
|
820
|
-
* id. A function naming its own
|
|
818
|
+
* The resource every function of the service is checked on, for a service whose functions act on one resource
|
|
819
|
+
* the request does not name: a template over the caller's scope, `{@applicationId}` or `{@tenantId}`, or a literal
|
|
820
|
+
* id. A function naming its own resource with {@link AuthzCheck} is unaffected.
|
|
821
821
|
*/
|
|
822
|
-
|
|
822
|
+
resourceId?: string | null;
|
|
823
823
|
/**
|
|
824
824
|
* The permission every function of the service needs, as a short name such as `can_manage`, for a service whose
|
|
825
825
|
* functions all need the one permission whatever their names. A function declaring a permission of its own with
|
|
@@ -840,16 +840,16 @@ interface AuthzCheckDeclaration {
|
|
|
840
840
|
*/
|
|
841
841
|
permission?: string | null;
|
|
842
842
|
/**
|
|
843
|
-
* The type of the
|
|
844
|
-
* create
|
|
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
|
/**
|
|
848
|
-
* The id of the
|
|
848
|
+
* The id of the resource the check is made on, as a template over the function's parameters and the caller's
|
|
849
849
|
* scope: `{reportId}` is a parameter's value, `{registration.id}` a property of an object parameter, and
|
|
850
850
|
* `{@applicationId}` or `{@tenantId}` the matching id of the caller's scope.
|
|
851
851
|
*/
|
|
852
|
-
|
|
852
|
+
resourceId?: string | null;
|
|
853
853
|
/**
|
|
854
854
|
* Short names of permissions on the same type that this permission also grants, so a role bundling
|
|
855
855
|
* `can_generate` declared with `implies: ['can_view']` views what it generates.
|
|
@@ -919,14 +919,14 @@ declare function receivesContext(serviceInstance: object, methodName: string): b
|
|
|
919
919
|
* and the permissions its functions need become part of the application's authorization model, where roles
|
|
920
920
|
* bundle permissions and grants bind roles to callers.
|
|
921
921
|
*
|
|
922
|
-
* A function's check has three parts: the permission it needs, the type of the
|
|
923
|
-
* the id of that
|
|
922
|
+
* A function's check has three parts: the permission it needs, the type of the resource it is checked on, and
|
|
923
|
+
* the id of that resource. Each part is derived from the function's name and parameters where it can be;
|
|
924
924
|
* {@link AuthzCheck} states a part derivation gets wrong or cannot know, and {@link AuthzUnchecked} marks a
|
|
925
925
|
* function served with no check. A function left with no check and no marker fails the service's registration.
|
|
926
926
|
*
|
|
927
927
|
* The permission is derived from the first word of the function's name: `find`, `get`, `count`, `search` and
|
|
928
928
|
* `list` need `can_view`; `save`, `update` and `set` need `can_edit`; `delete` and `remove` need `can_delete`;
|
|
929
|
-
* `create` needs `can_edit` of this type on the parent. The
|
|
929
|
+
* `create` needs `can_edit` of this type on the parent. The resource's id is the parameter named `id` or
|
|
930
930
|
* `<type>Id` (`reportId` for the type `report`), else the `id` of the first object parameter; a function with
|
|
931
931
|
* neither is checked on the parent, whose id is found the same way with the parent's name, else on the caller's
|
|
932
932
|
* own scope.
|
|
@@ -935,33 +935,36 @@ declare function receivesContext(serviceInstance: object, methodName: string): b
|
|
|
935
935
|
* `report_can_view` on the report `id` names, `save(report: Report)` for `report_can_edit` on the report
|
|
936
936
|
* `report.id` names, and `findReports()` for `report_can_view` on the caller's tenant, with nothing declared on
|
|
937
937
|
* them. A runtime holding no definition for a service declaring a resource refuses to serve it.
|
|
938
|
-
* @param declaration the resource type, or the type with its parent,
|
|
938
|
+
* @param declaration the resource type, or the type with its parent, resource id, permission and roles
|
|
939
939
|
*/
|
|
940
940
|
declare function AuthzResource(declaration: AuthzResourceDeclaration | string): (value: Function, _context: ClassDecoratorContext<any>) => void;
|
|
941
941
|
/**
|
|
942
942
|
* States a part of one function's check that derivation gets wrong or cannot know, which `kinotic sync` reads
|
|
943
|
-
* into the service's definition: the permission, the type of the
|
|
943
|
+
* into the service's definition: the permission, the type of the resource, or its id. Every part left out keeps
|
|
944
944
|
* the derived value, or the one the service declares with {@link AuthzResource}, so a function states only the
|
|
945
945
|
* part derivation misses. A function served with no check is marked {@link AuthzUnchecked} instead.
|
|
946
946
|
*
|
|
947
|
-
* Example: `@AuthzCheck({permission: 'can_report',
|
|
947
|
+
* Example: `@AuthzCheck({permission: 'can_report', resourceId: '{registration.id}'})` on
|
|
948
948
|
* `heartbeat(registration: Registration)`, whose name derives no permission and whose id is inside the body.
|
|
949
949
|
* @param declaration the parts of the check derivation cannot read from the function's name and parameters
|
|
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
|
|
954
|
-
* `kinotic sync` reads into the service's definition: any caller the service's
|
|
955
|
-
* service itself is responsible for answering only what the caller may see or
|
|
956
|
-
* no
|
|
957
|
-
*
|
|
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(
|
|
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
|
|
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,
|
|
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(
|
|
1167
|
-
|
|
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.
|
|
1208
|
+
version: "5.0.0-beta.23",
|
|
1204
1209
|
type: "module",
|
|
1205
1210
|
files: [
|
|
1206
1211
|
"dist"
|
|
@@ -1269,7 +1274,7 @@ var package_default = {
|
|
|
1269
1274
|
vitest: "^4.1.4"
|
|
1270
1275
|
},
|
|
1271
1276
|
dependencies: {
|
|
1272
|
-
"@kinotic-ai/idl": "workspace
|
|
1277
|
+
"@kinotic-ai/idl": "workspace:^",
|
|
1273
1278
|
"@opentelemetry/api": "^1.9.1",
|
|
1274
1279
|
"@opentelemetry/semantic-conventions": "^1.40.0",
|
|
1275
1280
|
"@stomp/rx-stomp": "^2.4.0",
|
|
@@ -1707,8 +1712,8 @@ function directoryEntryOf(serviceInstance, serviceIdentifier) {
|
|
|
1707
1712
|
advertised: isAdvertised(serviceInstance),
|
|
1708
1713
|
serviceDefinition: definition
|
|
1709
1714
|
};
|
|
1710
|
-
} else if (
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "5.0.0-beta.23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"vitest": "^4.1.4"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@kinotic-ai/idl": "5.0.0-beta.
|
|
72
|
+
"@kinotic-ai/idl": "^5.0.0-beta.4",
|
|
73
73
|
"@opentelemetry/api": "^1.9.1",
|
|
74
74
|
"@opentelemetry/semantic-conventions": "^1.40.0",
|
|
75
75
|
"@stomp/rx-stomp": "^2.4.0",
|