@kinotic-ai/core 5.0.0-beta.20 → 5.0.0-beta.21
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 +3 -1
- package/dist/index.d.cts +86 -29
- package/dist/index.d.ts +86 -29
- package/dist/index.js +3 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -111,6 +111,7 @@ __export(exports_src, {
|
|
|
111
111
|
ChainedCredentialsResolver: () => ChainedCredentialsResolver,
|
|
112
112
|
BearerCredentialsResolver: () => BearerCredentialsResolver,
|
|
113
113
|
BasicCredentialsResolver: () => BasicCredentialsResolver,
|
|
114
|
+
AuthzUnchecked: () => AuthzUnchecked,
|
|
114
115
|
AuthzResource: () => AuthzResource,
|
|
115
116
|
AuthzCheck: () => AuthzCheck,
|
|
116
117
|
AuthorizationException: () => AuthorizationException,
|
|
@@ -1283,6 +1284,7 @@ function AuthzResource(declaration) {
|
|
|
1283
1284
|
function AuthzCheck(declaration) {
|
|
1284
1285
|
return function(_value, _context) {};
|
|
1285
1286
|
}
|
|
1287
|
+
function AuthzUnchecked(_value, _context) {}
|
|
1286
1288
|
function declaresAuthzResource(serviceInstance) {
|
|
1287
1289
|
let ret = false;
|
|
1288
1290
|
let current = serviceInstance.constructor;
|
|
@@ -1319,7 +1321,7 @@ var import_api2 = __toESM(require("@opentelemetry/api"));
|
|
|
1319
1321
|
// packages/core/package.json
|
|
1320
1322
|
var package_default = {
|
|
1321
1323
|
name: "@kinotic-ai/core",
|
|
1322
|
-
version: "5.0.0-beta.
|
|
1324
|
+
version: "5.0.0-beta.21",
|
|
1323
1325
|
type: "module",
|
|
1324
1326
|
files: [
|
|
1325
1327
|
"dist"
|
package/dist/index.d.cts
CHANGED
|
@@ -788,45 +788,77 @@ declare class KinoticSingleton implements IKinotic {
|
|
|
788
788
|
*/
|
|
789
789
|
declare const Kinotic: KinoticSingleton;
|
|
790
790
|
/**
|
|
791
|
-
* A role a service declares for its resource type
|
|
791
|
+
* A role a service declares for its resource type beside the built-in `viewer`, `editor` and `admin`: a bundle
|
|
792
|
+
* of the type's own permissions, defined by the generated model, named like a built-in role and granted the
|
|
793
|
+
* same way.
|
|
792
794
|
*/
|
|
793
795
|
interface AuthzRoleDeclaration {
|
|
794
|
-
/** The role's id, `<type>.<level
|
|
796
|
+
/** The role's id, `<type>.<level>`, with a lowercase identifier no built-in role of the type uses as the level. */
|
|
795
797
|
id: string;
|
|
796
|
-
/** The short names of the
|
|
798
|
+
/** The short names of the permissions the role bundles, each one a permission a function of the type needs. */
|
|
797
799
|
permissions: string[];
|
|
798
800
|
}
|
|
799
801
|
/**
|
|
800
802
|
* What a service declares about the resource its functions act on, as {@link AuthzResource} declares it.
|
|
801
803
|
*/
|
|
802
804
|
interface AuthzResourceDeclaration {
|
|
803
|
-
/**
|
|
805
|
+
/**
|
|
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 object every
|
|
808
|
+
* function is checked on unless the function names another with {@link AuthzCheck}.
|
|
809
|
+
*/
|
|
804
810
|
value: string;
|
|
805
|
-
/**
|
|
811
|
+
/**
|
|
812
|
+
* The type that contains this one, such as `tenant` for `report`: a grant made on an object of the parent type
|
|
813
|
+
* inherits to every object of this type inside it, and a function naming no object of its own, such as a
|
|
814
|
+
* listing or a create, is checked on the parent. Absent for a root type.
|
|
815
|
+
*/
|
|
806
816
|
parent?: string | null;
|
|
807
|
-
/**
|
|
817
|
+
/**
|
|
818
|
+
* The object every function of the service is checked on, for a service whose functions act on one object 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 object with {@link AuthzCheck} is unaffected.
|
|
821
|
+
*/
|
|
808
822
|
objectId?: string | null;
|
|
809
|
-
/**
|
|
823
|
+
/**
|
|
824
|
+
* The permission every function of the service needs, as a short name such as `can_manage`, for a service whose
|
|
825
|
+
* functions all need the one permission whatever their names. A function declaring a permission of its own with
|
|
826
|
+
* {@link AuthzCheck} keeps it. Name the service's strictest permission.
|
|
827
|
+
*/
|
|
810
828
|
permission?: string | null;
|
|
811
|
-
/**
|
|
829
|
+
/** Roles of this type beside the built-in ones, each bundling permissions the type's functions need. */
|
|
812
830
|
roles?: AuthzRoleDeclaration[] | null;
|
|
813
831
|
}
|
|
814
832
|
/**
|
|
815
833
|
* What a function declares about its check, as {@link AuthzCheck} declares it; whatever is left out is derived
|
|
816
|
-
* from the function's name and parameters.
|
|
834
|
+
* from the function's name and parameters, as described on {@link AuthzResource}.
|
|
817
835
|
*/
|
|
818
836
|
interface AuthzCheckDeclaration {
|
|
819
|
-
/**
|
|
837
|
+
/**
|
|
838
|
+
* The permission the function needs, as a short name such as `can_generate`. In the model it is prefixed by
|
|
839
|
+
* the type it is about, so `can_generate` on a `report` service is `report_can_generate`.
|
|
840
|
+
*/
|
|
820
841
|
permission?: string | null;
|
|
821
|
-
/**
|
|
842
|
+
/**
|
|
843
|
+
* The type of the object 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.
|
|
845
|
+
*/
|
|
822
846
|
resource?: string | null;
|
|
823
|
-
/**
|
|
847
|
+
/**
|
|
848
|
+
* The id of the object the check is made on, as a template over the function's parameters and the caller's
|
|
849
|
+
* scope: `{reportId}` is a parameter's value, `{registration.id}` a property of an object parameter, and
|
|
850
|
+
* `{@applicationId}` or `{@tenantId}` the matching id of the caller's scope.
|
|
851
|
+
*/
|
|
824
852
|
objectId?: string | null;
|
|
825
|
-
/**
|
|
853
|
+
/**
|
|
854
|
+
* Short names of permissions on the same type that this permission also grants, so a role bundling
|
|
855
|
+
* `can_generate` declared with `implies: ['can_view']` views what it generates.
|
|
856
|
+
*/
|
|
826
857
|
implies?: string[] | null;
|
|
827
|
-
/**
|
|
828
|
-
|
|
829
|
-
|
|
858
|
+
/**
|
|
859
|
+
* True for a function whose check must not be answered from the engine's caches, because a stale allow would
|
|
860
|
+
* be a security event.
|
|
861
|
+
*/
|
|
830
862
|
consistent?: boolean;
|
|
831
863
|
}
|
|
832
864
|
/**
|
|
@@ -881,26 +913,51 @@ declare function Context(value: Function, _context: ClassMethodDecoratorContext)
|
|
|
881
913
|
*/
|
|
882
914
|
declare function receivesContext(serviceInstance: object, methodName: string): boolean;
|
|
883
915
|
/**
|
|
884
|
-
*
|
|
916
|
+
* Marks a published service as acting on one type of resource, which `kinotic sync` reads from the class's
|
|
885
917
|
* source into the service's definition, which the runtime registers in the platform's service directory when
|
|
886
|
-
* the service comes online, so every request to the service is
|
|
887
|
-
*
|
|
888
|
-
*
|
|
889
|
-
*
|
|
890
|
-
*
|
|
891
|
-
*
|
|
892
|
-
*
|
|
918
|
+
* the service comes online, so every request to the service is authorized before the service sees it. The type
|
|
919
|
+
* and the permissions its functions need become part of the application's authorization model, where roles
|
|
920
|
+
* bundle permissions and grants bind roles to callers.
|
|
921
|
+
*
|
|
922
|
+
* A function's check has three parts: the permission it needs, the type of the object it is checked on, and
|
|
923
|
+
* the id of that object. Each part is derived from the function's name and parameters where it can be;
|
|
924
|
+
* {@link AuthzCheck} states a part derivation gets wrong or cannot know, and {@link AuthzUnchecked} marks a
|
|
925
|
+
* function served with no check. A function left with no check and no marker fails the service's registration.
|
|
926
|
+
*
|
|
927
|
+
* The permission is derived from the first word of the function's name: `find`, `get`, `count`, `search` and
|
|
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 object's id is the parameter named `id` or
|
|
930
|
+
* `<type>Id` (`reportId` for the type `report`), else the `id` of the first object parameter; a function with
|
|
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
|
+
* own scope.
|
|
933
|
+
*
|
|
934
|
+
* Example: with `@AuthzResource({value: 'report', parent: 'tenant'})`, `findById(id: string)` is checked for
|
|
935
|
+
* `report_can_view` on the report `id` names, `save(report: Report)` for `report_can_edit` on the report
|
|
936
|
+
* `report.id` names, and `findReports()` for `report_can_view` on the caller's tenant, with nothing declared on
|
|
937
|
+
* them. A runtime holding no definition for a service declaring a resource refuses to serve it.
|
|
893
938
|
* @param declaration the resource type, or the type with its parent, object, permission and roles
|
|
894
939
|
*/
|
|
895
940
|
declare function AuthzResource(declaration: AuthzResourceDeclaration | string): (value: Function, _context: ClassDecoratorContext<any>) => void;
|
|
896
941
|
/**
|
|
897
|
-
*
|
|
898
|
-
* service's definition:
|
|
899
|
-
* the
|
|
900
|
-
*
|
|
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 object, or its id. Every part left out keeps
|
|
944
|
+
* the derived value, or the one the service declares with {@link AuthzResource}, so a function states only the
|
|
945
|
+
* part derivation misses. A function served with no check is marked {@link AuthzUnchecked} instead.
|
|
946
|
+
*
|
|
947
|
+
* Example: `@AuthzCheck({permission: 'can_report', objectId: '{registration.id}'})` on
|
|
948
|
+
* `heartbeat(registration: Registration)`, whose name derives no permission and whose id is inside the body.
|
|
949
|
+
* @param declaration the parts of the check derivation cannot read from the function's name and parameters
|
|
901
950
|
*/
|
|
902
951
|
declare function AuthzCheck(declaration: AuthzCheckDeclaration): (_value: Function, _context: ClassMethodDecoratorContext) => void;
|
|
903
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 object 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.
|
|
958
|
+
*/
|
|
959
|
+
declare function AuthzUnchecked(_value: Function, _context: ClassMethodDecoratorContext): void;
|
|
960
|
+
/**
|
|
904
961
|
* Returns whether the given service instance's class, or a class it extends, declares an {@link AuthzResource}.
|
|
905
962
|
* @param serviceInstance the service instance to inspect
|
|
906
963
|
*/
|
|
@@ -1541,4 +1598,4 @@ declare class ParticipantConstants {
|
|
|
1541
1598
|
/** The clientId the test server's TestSecurityService maps to the ANONYMOUS role in core package tests. */
|
|
1542
1599
|
static readonly CLI_PARTICIPANT_ID: string;
|
|
1543
1600
|
}
|
|
1544
|
-
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, AuthzRoleDeclaration, AuthzResourceDeclaration, AuthzResource, AuthzCheckDeclaration, AuthzCheck, AuthorizationException, AbstractIterablePage };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -788,45 +788,77 @@ declare class KinoticSingleton implements IKinotic {
|
|
|
788
788
|
*/
|
|
789
789
|
declare const Kinotic: KinoticSingleton;
|
|
790
790
|
/**
|
|
791
|
-
* A role a service declares for its resource type
|
|
791
|
+
* A role a service declares for its resource type beside the built-in `viewer`, `editor` and `admin`: a bundle
|
|
792
|
+
* of the type's own permissions, defined by the generated model, named like a built-in role and granted the
|
|
793
|
+
* same way.
|
|
792
794
|
*/
|
|
793
795
|
interface AuthzRoleDeclaration {
|
|
794
|
-
/** The role's id, `<type>.<level
|
|
796
|
+
/** The role's id, `<type>.<level>`, with a lowercase identifier no built-in role of the type uses as the level. */
|
|
795
797
|
id: string;
|
|
796
|
-
/** The short names of the
|
|
798
|
+
/** The short names of the permissions the role bundles, each one a permission a function of the type needs. */
|
|
797
799
|
permissions: string[];
|
|
798
800
|
}
|
|
799
801
|
/**
|
|
800
802
|
* What a service declares about the resource its functions act on, as {@link AuthzResource} declares it.
|
|
801
803
|
*/
|
|
802
804
|
interface AuthzResourceDeclaration {
|
|
803
|
-
/**
|
|
805
|
+
/**
|
|
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 object every
|
|
808
|
+
* function is checked on unless the function names another with {@link AuthzCheck}.
|
|
809
|
+
*/
|
|
804
810
|
value: string;
|
|
805
|
-
/**
|
|
811
|
+
/**
|
|
812
|
+
* The type that contains this one, such as `tenant` for `report`: a grant made on an object of the parent type
|
|
813
|
+
* inherits to every object of this type inside it, and a function naming no object of its own, such as a
|
|
814
|
+
* listing or a create, is checked on the parent. Absent for a root type.
|
|
815
|
+
*/
|
|
806
816
|
parent?: string | null;
|
|
807
|
-
/**
|
|
817
|
+
/**
|
|
818
|
+
* The object every function of the service is checked on, for a service whose functions act on one object 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 object with {@link AuthzCheck} is unaffected.
|
|
821
|
+
*/
|
|
808
822
|
objectId?: string | null;
|
|
809
|
-
/**
|
|
823
|
+
/**
|
|
824
|
+
* The permission every function of the service needs, as a short name such as `can_manage`, for a service whose
|
|
825
|
+
* functions all need the one permission whatever their names. A function declaring a permission of its own with
|
|
826
|
+
* {@link AuthzCheck} keeps it. Name the service's strictest permission.
|
|
827
|
+
*/
|
|
810
828
|
permission?: string | null;
|
|
811
|
-
/**
|
|
829
|
+
/** Roles of this type beside the built-in ones, each bundling permissions the type's functions need. */
|
|
812
830
|
roles?: AuthzRoleDeclaration[] | null;
|
|
813
831
|
}
|
|
814
832
|
/**
|
|
815
833
|
* What a function declares about its check, as {@link AuthzCheck} declares it; whatever is left out is derived
|
|
816
|
-
* from the function's name and parameters.
|
|
834
|
+
* from the function's name and parameters, as described on {@link AuthzResource}.
|
|
817
835
|
*/
|
|
818
836
|
interface AuthzCheckDeclaration {
|
|
819
|
-
/**
|
|
837
|
+
/**
|
|
838
|
+
* The permission the function needs, as a short name such as `can_generate`. In the model it is prefixed by
|
|
839
|
+
* the type it is about, so `can_generate` on a `report` service is `report_can_generate`.
|
|
840
|
+
*/
|
|
820
841
|
permission?: string | null;
|
|
821
|
-
/**
|
|
842
|
+
/**
|
|
843
|
+
* The type of the object 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.
|
|
845
|
+
*/
|
|
822
846
|
resource?: string | null;
|
|
823
|
-
/**
|
|
847
|
+
/**
|
|
848
|
+
* The id of the object the check is made on, as a template over the function's parameters and the caller's
|
|
849
|
+
* scope: `{reportId}` is a parameter's value, `{registration.id}` a property of an object parameter, and
|
|
850
|
+
* `{@applicationId}` or `{@tenantId}` the matching id of the caller's scope.
|
|
851
|
+
*/
|
|
824
852
|
objectId?: string | null;
|
|
825
|
-
/**
|
|
853
|
+
/**
|
|
854
|
+
* Short names of permissions on the same type that this permission also grants, so a role bundling
|
|
855
|
+
* `can_generate` declared with `implies: ['can_view']` views what it generates.
|
|
856
|
+
*/
|
|
826
857
|
implies?: string[] | null;
|
|
827
|
-
/**
|
|
828
|
-
|
|
829
|
-
|
|
858
|
+
/**
|
|
859
|
+
* True for a function whose check must not be answered from the engine's caches, because a stale allow would
|
|
860
|
+
* be a security event.
|
|
861
|
+
*/
|
|
830
862
|
consistent?: boolean;
|
|
831
863
|
}
|
|
832
864
|
/**
|
|
@@ -881,26 +913,51 @@ declare function Context(value: Function, _context: ClassMethodDecoratorContext)
|
|
|
881
913
|
*/
|
|
882
914
|
declare function receivesContext(serviceInstance: object, methodName: string): boolean;
|
|
883
915
|
/**
|
|
884
|
-
*
|
|
916
|
+
* Marks a published service as acting on one type of resource, which `kinotic sync` reads from the class's
|
|
885
917
|
* source into the service's definition, which the runtime registers in the platform's service directory when
|
|
886
|
-
* the service comes online, so every request to the service is
|
|
887
|
-
*
|
|
888
|
-
*
|
|
889
|
-
*
|
|
890
|
-
*
|
|
891
|
-
*
|
|
892
|
-
*
|
|
918
|
+
* the service comes online, so every request to the service is authorized before the service sees it. The type
|
|
919
|
+
* and the permissions its functions need become part of the application's authorization model, where roles
|
|
920
|
+
* bundle permissions and grants bind roles to callers.
|
|
921
|
+
*
|
|
922
|
+
* A function's check has three parts: the permission it needs, the type of the object it is checked on, and
|
|
923
|
+
* the id of that object. Each part is derived from the function's name and parameters where it can be;
|
|
924
|
+
* {@link AuthzCheck} states a part derivation gets wrong or cannot know, and {@link AuthzUnchecked} marks a
|
|
925
|
+
* function served with no check. A function left with no check and no marker fails the service's registration.
|
|
926
|
+
*
|
|
927
|
+
* The permission is derived from the first word of the function's name: `find`, `get`, `count`, `search` and
|
|
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 object's id is the parameter named `id` or
|
|
930
|
+
* `<type>Id` (`reportId` for the type `report`), else the `id` of the first object parameter; a function with
|
|
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
|
+
* own scope.
|
|
933
|
+
*
|
|
934
|
+
* Example: with `@AuthzResource({value: 'report', parent: 'tenant'})`, `findById(id: string)` is checked for
|
|
935
|
+
* `report_can_view` on the report `id` names, `save(report: Report)` for `report_can_edit` on the report
|
|
936
|
+
* `report.id` names, and `findReports()` for `report_can_view` on the caller's tenant, with nothing declared on
|
|
937
|
+
* them. A runtime holding no definition for a service declaring a resource refuses to serve it.
|
|
893
938
|
* @param declaration the resource type, or the type with its parent, object, permission and roles
|
|
894
939
|
*/
|
|
895
940
|
declare function AuthzResource(declaration: AuthzResourceDeclaration | string): (value: Function, _context: ClassDecoratorContext<any>) => void;
|
|
896
941
|
/**
|
|
897
|
-
*
|
|
898
|
-
* service's definition:
|
|
899
|
-
* the
|
|
900
|
-
*
|
|
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 object, or its id. Every part left out keeps
|
|
944
|
+
* the derived value, or the one the service declares with {@link AuthzResource}, so a function states only the
|
|
945
|
+
* part derivation misses. A function served with no check is marked {@link AuthzUnchecked} instead.
|
|
946
|
+
*
|
|
947
|
+
* Example: `@AuthzCheck({permission: 'can_report', objectId: '{registration.id}'})` on
|
|
948
|
+
* `heartbeat(registration: Registration)`, whose name derives no permission and whose id is inside the body.
|
|
949
|
+
* @param declaration the parts of the check derivation cannot read from the function's name and parameters
|
|
901
950
|
*/
|
|
902
951
|
declare function AuthzCheck(declaration: AuthzCheckDeclaration): (_value: Function, _context: ClassMethodDecoratorContext) => void;
|
|
903
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 object 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.
|
|
958
|
+
*/
|
|
959
|
+
declare function AuthzUnchecked(_value: Function, _context: ClassMethodDecoratorContext): void;
|
|
960
|
+
/**
|
|
904
961
|
* Returns whether the given service instance's class, or a class it extends, declares an {@link AuthzResource}.
|
|
905
962
|
* @param serviceInstance the service instance to inspect
|
|
906
963
|
*/
|
|
@@ -1541,4 +1598,4 @@ declare class ParticipantConstants {
|
|
|
1541
1598
|
/** The clientId the test server's TestSecurityService maps to the ANONYMOUS role in core package tests. */
|
|
1542
1599
|
static readonly CLI_PARTICIPANT_ID: string;
|
|
1543
1600
|
}
|
|
1544
|
-
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, AuthzRoleDeclaration, AuthzResourceDeclaration, AuthzResource, AuthzCheckDeclaration, AuthzCheck, AuthorizationException, AbstractIterablePage };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1163,6 +1163,7 @@ function AuthzResource(declaration) {
|
|
|
1163
1163
|
function AuthzCheck(declaration) {
|
|
1164
1164
|
return function(_value, _context) {};
|
|
1165
1165
|
}
|
|
1166
|
+
function AuthzUnchecked(_value, _context) {}
|
|
1166
1167
|
function declaresAuthzResource(serviceInstance) {
|
|
1167
1168
|
let ret = false;
|
|
1168
1169
|
let current = serviceInstance.constructor;
|
|
@@ -1199,7 +1200,7 @@ import opentelemetry, { context as context2, propagation as propagation2, trace,
|
|
|
1199
1200
|
// packages/core/package.json
|
|
1200
1201
|
var package_default = {
|
|
1201
1202
|
name: "@kinotic-ai/core",
|
|
1202
|
-
version: "5.0.0-beta.
|
|
1203
|
+
version: "5.0.0-beta.21",
|
|
1203
1204
|
type: "module",
|
|
1204
1205
|
files: [
|
|
1205
1206
|
"dist"
|
|
@@ -2177,6 +2178,7 @@ export {
|
|
|
2177
2178
|
ChainedCredentialsResolver,
|
|
2178
2179
|
BearerCredentialsResolver,
|
|
2179
2180
|
BasicCredentialsResolver,
|
|
2181
|
+
AuthzUnchecked,
|
|
2180
2182
|
AuthzResource,
|
|
2181
2183
|
AuthzCheck,
|
|
2182
2184
|
AuthorizationException,
|
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.21",
|
|
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.3",
|
|
73
73
|
"@opentelemetry/api": "^1.9.1",
|
|
74
74
|
"@opentelemetry/semantic-conventions": "^1.40.0",
|
|
75
75
|
"@stomp/rx-stomp": "^2.4.0",
|