@api-client/core 0.18.57 → 0.18.58
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/build/src/modeling/ApiModel.d.ts +7 -5
- package/build/src/modeling/ApiModel.d.ts.map +1 -1
- package/build/src/modeling/ApiModel.js +35 -16
- package/build/src/modeling/ApiModel.js.map +1 -1
- package/build/src/modeling/ExposedEntity.d.ts +5 -2
- package/build/src/modeling/ExposedEntity.d.ts.map +1 -1
- package/build/src/modeling/ExposedEntity.js +11 -8
- package/build/src/modeling/ExposedEntity.js.map +1 -1
- package/build/src/modeling/actions/Action.d.ts +41 -0
- package/build/src/modeling/actions/Action.d.ts.map +1 -0
- package/build/src/modeling/actions/Action.js +64 -0
- package/build/src/modeling/actions/Action.js.map +1 -0
- package/build/src/modeling/actions/CreateAction.d.ts +18 -0
- package/build/src/modeling/actions/CreateAction.d.ts.map +1 -0
- package/build/src/modeling/actions/CreateAction.js +37 -0
- package/build/src/modeling/actions/CreateAction.js.map +1 -0
- package/build/src/modeling/actions/DeleteAction.d.ts +34 -0
- package/build/src/modeling/actions/DeleteAction.d.ts.map +1 -0
- package/build/src/modeling/actions/DeleteAction.js +57 -0
- package/build/src/modeling/actions/DeleteAction.js.map +1 -0
- package/build/src/modeling/actions/ListAction.d.ts +37 -0
- package/build/src/modeling/actions/ListAction.d.ts.map +1 -0
- package/build/src/modeling/actions/ListAction.js +70 -0
- package/build/src/modeling/actions/ListAction.js.map +1 -0
- package/build/src/modeling/actions/ReadAction.d.ts +18 -0
- package/build/src/modeling/actions/ReadAction.d.ts.map +1 -0
- package/build/src/modeling/actions/ReadAction.js +37 -0
- package/build/src/modeling/actions/ReadAction.js.map +1 -0
- package/build/src/modeling/actions/SearchAction.d.ts +24 -0
- package/build/src/modeling/actions/SearchAction.d.ts.map +1 -0
- package/build/src/modeling/actions/SearchAction.js +47 -0
- package/build/src/modeling/actions/SearchAction.js.map +1 -0
- package/build/src/modeling/actions/UpdateAction.d.ts +27 -0
- package/build/src/modeling/actions/UpdateAction.d.ts.map +1 -0
- package/build/src/modeling/actions/UpdateAction.js +47 -0
- package/build/src/modeling/actions/UpdateAction.js.map +1 -0
- package/build/src/modeling/actions/index.d.ts +24 -0
- package/build/src/modeling/actions/index.d.ts.map +1 -0
- package/build/src/modeling/actions/index.js +9 -0
- package/build/src/modeling/actions/index.js.map +1 -0
- package/build/src/modeling/index.d.ts +12 -0
- package/build/src/modeling/index.d.ts.map +1 -0
- package/build/src/modeling/index.js +12 -0
- package/build/src/modeling/index.js.map +1 -0
- package/build/src/modeling/rules/AccessRule.d.ts +17 -0
- package/build/src/modeling/rules/AccessRule.d.ts.map +1 -0
- package/build/src/modeling/rules/AccessRule.js +19 -0
- package/build/src/modeling/rules/AccessRule.js.map +1 -0
- package/build/src/modeling/rules/AllowAuthenticated.d.ts +19 -0
- package/build/src/modeling/rules/AllowAuthenticated.d.ts.map +1 -0
- package/build/src/modeling/rules/AllowAuthenticated.js +14 -0
- package/build/src/modeling/rules/AllowAuthenticated.js.map +1 -0
- package/build/src/modeling/rules/AllowPublic.d.ts +19 -0
- package/build/src/modeling/rules/AllowPublic.d.ts.map +1 -0
- package/build/src/modeling/rules/AllowPublic.js +14 -0
- package/build/src/modeling/rules/AllowPublic.js.map +1 -0
- package/build/src/modeling/rules/MatchEmailDomain.d.ts +25 -0
- package/build/src/modeling/rules/MatchEmailDomain.d.ts.map +1 -0
- package/build/src/modeling/rules/MatchEmailDomain.js +40 -0
- package/build/src/modeling/rules/MatchEmailDomain.js.map +1 -0
- package/build/src/modeling/rules/MatchResourceOwner.d.ts +29 -0
- package/build/src/modeling/rules/MatchResourceOwner.d.ts.map +1 -0
- package/build/src/modeling/rules/MatchResourceOwner.js +40 -0
- package/build/src/modeling/rules/MatchResourceOwner.js.map +1 -0
- package/build/src/modeling/rules/MatchUserProperty.d.ts +28 -0
- package/build/src/modeling/rules/MatchUserProperty.d.ts.map +1 -0
- package/build/src/modeling/rules/MatchUserProperty.js +49 -0
- package/build/src/modeling/rules/MatchUserProperty.js.map +1 -0
- package/build/src/modeling/rules/MatchUserRole.d.ts +29 -0
- package/build/src/modeling/rules/MatchUserRole.d.ts.map +1 -0
- package/build/src/modeling/rules/MatchUserRole.js +40 -0
- package/build/src/modeling/rules/MatchUserRole.js.map +1 -0
- package/build/src/modeling/rules/RateLimitRule.d.ts +61 -0
- package/build/src/modeling/rules/RateLimitRule.d.ts.map +1 -0
- package/build/src/modeling/rules/RateLimitRule.js +101 -0
- package/build/src/modeling/rules/RateLimitRule.js.map +1 -0
- package/build/src/modeling/rules/RateLimitingConfiguration.d.ts +18 -0
- package/build/src/modeling/rules/RateLimitingConfiguration.d.ts.map +1 -0
- package/build/src/modeling/rules/RateLimitingConfiguration.js +35 -0
- package/build/src/modeling/rules/RateLimitingConfiguration.js.map +1 -0
- package/build/src/modeling/rules/index.d.ts +13 -0
- package/build/src/modeling/rules/index.d.ts.map +1 -0
- package/build/src/modeling/rules/index.js +10 -0
- package/build/src/modeling/rules/index.js.map +1 -0
- package/build/src/modeling/types.d.ts +6 -257
- package/build/src/modeling/types.d.ts.map +1 -1
- package/build/src/modeling/types.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/data/models/example-generator-api.json +26 -26
- package/package.json +1 -1
- package/src/modeling/ApiModel.ts +21 -19
- package/src/modeling/ExposedEntity.ts +13 -18
- package/src/modeling/actions/Action.ts +64 -0
- package/src/modeling/actions/CreateAction.ts +30 -0
- package/src/modeling/actions/DeleteAction.ts +51 -0
- package/src/modeling/actions/ListAction.ts +58 -0
- package/src/modeling/actions/ReadAction.ts +32 -0
- package/src/modeling/actions/SearchAction.ts +38 -0
- package/src/modeling/actions/UpdateAction.ts +41 -0
- package/src/modeling/rules/AccessRule.ts +29 -0
- package/src/modeling/rules/AllowAuthenticated.ts +24 -0
- package/src/modeling/rules/AllowPublic.ts +24 -0
- package/src/modeling/rules/MatchEmailDomain.ts +39 -0
- package/src/modeling/rules/MatchResourceOwner.ts +43 -0
- package/src/modeling/rules/MatchUserProperty.ts +44 -0
- package/src/modeling/rules/MatchUserRole.ts +43 -0
- package/src/modeling/rules/RateLimitRule.ts +104 -0
- package/src/modeling/rules/RateLimitingConfiguration.ts +32 -0
- package/src/modeling/types.ts +6 -276
- package/tests/unit/modeling/actions/Action.spec.ts +109 -0
- package/tests/unit/modeling/actions/CreateAction.spec.ts +65 -0
- package/tests/unit/modeling/actions/DeleteAction.spec.ts +78 -0
- package/tests/unit/modeling/actions/ListAction.spec.ts +106 -0
- package/tests/unit/modeling/actions/ReadAction.spec.ts +77 -0
- package/tests/unit/modeling/actions/SearchAction.spec.ts +73 -0
- package/tests/unit/modeling/actions/UpdateAction.spec.ts +73 -0
- package/tests/unit/modeling/api_model.spec.ts +48 -3
- package/tests/unit/modeling/exposed_entity.spec.ts +73 -0
- package/tests/unit/modeling/rules/AccessRule.spec.ts +42 -0
- package/tests/unit/modeling/rules/AllowAuthenticated.spec.ts +28 -0
- package/tests/unit/modeling/rules/AllowPublic.spec.ts +28 -0
- package/tests/unit/modeling/rules/MatchEmailDomain.spec.ts +52 -0
- package/tests/unit/modeling/rules/MatchResourceOwner.spec.ts +37 -0
- package/tests/unit/modeling/rules/MatchUserProperty.spec.ts +58 -0
- package/tests/unit/modeling/rules/MatchUserRole.spec.ts +52 -0
- package/tests/unit/modeling/rules/RateLimitRule.spec.ts +70 -0
- package/tests/unit/modeling/rules/RateLimitingConfiguration.spec.ts +61 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { Action } from './Action.js';
|
|
3
|
+
import { observed, toRaw } from '../../decorators/observed.js';
|
|
4
|
+
/**
|
|
5
|
+
* Enables modifying an existing resource.
|
|
6
|
+
* Endpoints: PUT or PATCH /[entity-collection-name]/{id}
|
|
7
|
+
*/
|
|
8
|
+
let UpdateAction = (() => {
|
|
9
|
+
let _classSuper = Action;
|
|
10
|
+
let _kind_decorators;
|
|
11
|
+
let _kind_initializers = [];
|
|
12
|
+
let _kind_extraInitializers = [];
|
|
13
|
+
let _allowedMethods_decorators;
|
|
14
|
+
let _allowedMethods_initializers = [];
|
|
15
|
+
let _allowedMethods_extraInitializers = [];
|
|
16
|
+
return class UpdateAction extends _classSuper {
|
|
17
|
+
static {
|
|
18
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
19
|
+
_kind_decorators = [observed()];
|
|
20
|
+
_allowedMethods_decorators = [observed({ deep: true })];
|
|
21
|
+
__esDecorate(this, null, _kind_decorators, { kind: "accessor", name: "kind", static: false, private: false, access: { has: obj => "kind" in obj, get: obj => obj.kind, set: (obj, value) => { obj.kind = value; } }, metadata: _metadata }, _kind_initializers, _kind_extraInitializers);
|
|
22
|
+
__esDecorate(this, null, _allowedMethods_decorators, { kind: "accessor", name: "allowedMethods", static: false, private: false, access: { has: obj => "allowedMethods" in obj, get: obj => obj.allowedMethods, set: (obj, value) => { obj.allowedMethods = value; } }, metadata: _metadata }, _allowedMethods_initializers, _allowedMethods_extraInitializers);
|
|
23
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
24
|
+
}
|
|
25
|
+
#kind_accessor_storage = __runInitializers(this, _kind_initializers, void 0);
|
|
26
|
+
get kind() { return this.#kind_accessor_storage; }
|
|
27
|
+
set kind(value) { this.#kind_accessor_storage = value; }
|
|
28
|
+
#allowedMethods_accessor_storage = (__runInitializers(this, _kind_extraInitializers), __runInitializers(this, _allowedMethods_initializers, void 0));
|
|
29
|
+
get allowedMethods() { return this.#allowedMethods_accessor_storage; }
|
|
30
|
+
set allowedMethods(value) { this.#allowedMethods_accessor_storage = value; }
|
|
31
|
+
constructor(state = {}) {
|
|
32
|
+
super(state);
|
|
33
|
+
__runInitializers(this, _allowedMethods_extraInitializers);
|
|
34
|
+
this.kind = 'update';
|
|
35
|
+
this.allowedMethods = state.allowedMethods ? [...state.allowedMethods] : ['PATCH'];
|
|
36
|
+
}
|
|
37
|
+
toJSON() {
|
|
38
|
+
return {
|
|
39
|
+
...super.toJSON(),
|
|
40
|
+
kind: 'update',
|
|
41
|
+
allowedMethods: structuredClone(toRaw(this, this.allowedMethods)),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
export { UpdateAction };
|
|
47
|
+
//# sourceMappingURL=UpdateAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UpdateAction.js","sourceRoot":"","sources":["../../../../src/modeling/actions/UpdateAction.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAkB9D;;;GAGG;IACU,YAAY;sBAAS,MAAM;;;;;;;iBAA3B,YAAa,SAAQ,WAAM;;;gCACrC,QAAQ,EAAE;0CACV,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;YADb,iKAAkB,IAAI,6BAAJ,IAAI,mFAAU;YAClB,+LAAS,cAAc,6BAAd,cAAc,uGAAqB;;;QAD1D,6EAAgC;QAAhC,IAAkB,IAAI,0CAAU;QAAhC,IAAkB,IAAI,gDAAU;QAClB,qJAA4C;QAA5C,IAAS,cAAc,oDAAqB;QAA5C,IAAS,cAAc,0DAAqB;QAEtE,YAAY,QAAqC,EAAE;YACjD,KAAK,CAAC,KAAK,CAAC,CAAA;;YACZ,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAA;YACpB,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;SACnF;QAEQ,MAAM;YACb,OAAO;gBACL,GAAI,KAAK,CAAC,MAAM,EAAyB;gBACzC,IAAI,EAAE,QAAQ;gBACd,cAAc,EAAE,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,CAAwB;aACzF,CAAA;QACH,CAAC;;;SAhBU,YAAY","sourcesContent":["import { Action, type ActionSchema } from './Action.js'\nimport { observed, toRaw } from '../../decorators/observed.js'\n\n/**\n * Enables modifying an existing resource.\n * Endpoints: PUT or PATCH /[entity-collection-name]/{id}\n */\nexport interface UpdateActionSchema extends ActionSchema {\n kind: 'update'\n /**\n * The allowed HTTP methods for updates. Default: PATCH only.\n *\n * These two methods represent the two common ways to update a resource:\n * - PUT: Replaces the entire resource with the provided data.\n * - PATCH: Applies a partial update to the resource, allowing for specific fields to be modified.\n */\n allowedMethods: ('PUT' | 'PATCH')[]\n}\n\n/**\n * Enables modifying an existing resource.\n * Endpoints: PUT or PATCH /[entity-collection-name]/{id}\n */\nexport class UpdateAction extends Action implements UpdateActionSchema {\n @observed() override accessor kind: 'update'\n @observed({ deep: true }) accessor allowedMethods: ('PUT' | 'PATCH')[]\n\n constructor(state: Partial<UpdateActionSchema> = {}) {\n super(state)\n this.kind = 'update'\n this.allowedMethods = state.allowedMethods ? [...state.allowedMethods] : ['PATCH']\n }\n\n override toJSON(): UpdateActionSchema {\n return {\n ...(super.toJSON() as UpdateActionSchema),\n kind: 'update',\n allowedMethods: structuredClone(toRaw(this, this.allowedMethods)) as ('PUT' | 'PATCH')[],\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export { Action, type ActionSchema } from './Action.js';
|
|
2
|
+
import { CreateAction, type CreateActionSchema } from './CreateAction.js';
|
|
3
|
+
import { DeleteAction, type DeleteActionSchema } from './DeleteAction.js';
|
|
4
|
+
import { ListAction, type ListActionSchema } from './ListAction.js';
|
|
5
|
+
import { ReadAction, type ReadActionSchema } from './ReadAction.js';
|
|
6
|
+
import { SearchAction, type SearchActionSchema } from './SearchAction.js';
|
|
7
|
+
import { UpdateAction, type UpdateActionSchema } from './UpdateAction.js';
|
|
8
|
+
export { CreateAction, DeleteAction, ListAction, ReadAction, SearchAction, UpdateAction };
|
|
9
|
+
export type { CreateActionSchema, DeleteActionSchema, ListActionSchema, ReadActionSchema, SearchActionSchema, UpdateActionSchema, };
|
|
10
|
+
/**
|
|
11
|
+
* Represents a specific, configurable API operation applied to a Data Entity.
|
|
12
|
+
* Corresponds to common RESTful interactions.
|
|
13
|
+
*/
|
|
14
|
+
export type ApiAction = CreateAction | DeleteAction | ListAction | ReadAction | SearchAction | UpdateAction;
|
|
15
|
+
/**
|
|
16
|
+
* Schema representation of a specific, configurable API operation applied to a Data Entity.
|
|
17
|
+
* Corresponds to common RESTful interactions.
|
|
18
|
+
*/
|
|
19
|
+
export type ApiActionSchema = CreateActionSchema | DeleteActionSchema | ListActionSchema | ReadActionSchema | SearchActionSchema | UpdateActionSchema;
|
|
20
|
+
/**
|
|
21
|
+
* The kind of action to perform.
|
|
22
|
+
*/
|
|
23
|
+
export type ActionKind = 'list' | 'read' | 'create' | 'update' | 'delete' | 'search';
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modeling/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,CAAA;AACzF,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,GACnB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,YAAY,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,GAAG,YAAY,CAAA;AAE3G;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB,kBAAkB,GAClB,kBAAkB,GAClB,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,CAAA;AAEtB;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Action } from './Action.js';
|
|
2
|
+
import { CreateAction } from './CreateAction.js';
|
|
3
|
+
import { DeleteAction } from './DeleteAction.js';
|
|
4
|
+
import { ListAction } from './ListAction.js';
|
|
5
|
+
import { ReadAction } from './ReadAction.js';
|
|
6
|
+
import { SearchAction } from './SearchAction.js';
|
|
7
|
+
import { UpdateAction } from './UpdateAction.js';
|
|
8
|
+
export { CreateAction, DeleteAction, ListAction, ReadAction, SearchAction, UpdateAction };
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modeling/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,YAAY,EAA2B,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,YAAY,EAA2B,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,UAAU,EAAyB,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,UAAU,EAAyB,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,YAAY,EAA2B,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,YAAY,EAA2B,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,CAAA","sourcesContent":["export { Action, type ActionSchema } from './Action.js'\nimport { CreateAction, type CreateActionSchema } from './CreateAction.js'\nimport { DeleteAction, type DeleteActionSchema } from './DeleteAction.js'\nimport { ListAction, type ListActionSchema } from './ListAction.js'\nimport { ReadAction, type ReadActionSchema } from './ReadAction.js'\nimport { SearchAction, type SearchActionSchema } from './SearchAction.js'\nimport { UpdateAction, type UpdateActionSchema } from './UpdateAction.js'\n\nexport { CreateAction, DeleteAction, ListAction, ReadAction, SearchAction, UpdateAction }\nexport type {\n CreateActionSchema,\n DeleteActionSchema,\n ListActionSchema,\n ReadActionSchema,\n SearchActionSchema,\n UpdateActionSchema,\n}\n\n/**\n * Represents a specific, configurable API operation applied to a Data Entity.\n * Corresponds to common RESTful interactions.\n */\nexport type ApiAction = CreateAction | DeleteAction | ListAction | ReadAction | SearchAction | UpdateAction\n\n/**\n * Schema representation of a specific, configurable API operation applied to a Data Entity.\n * Corresponds to common RESTful interactions.\n */\nexport type ApiActionSchema =\n | CreateActionSchema\n | DeleteActionSchema\n | ListActionSchema\n | ReadActionSchema\n | SearchActionSchema\n | UpdateActionSchema\n\n/**\n * The kind of action to perform.\n */\nexport type ActionKind = 'list' | 'read' | 'create' | 'update' | 'delete' | 'search'\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './actions/index.js';
|
|
2
|
+
export * from './rules/index.js';
|
|
3
|
+
export * from './types.js';
|
|
4
|
+
export { ApiModel, type ApiModelSchema, type ApiContact, type ApiLicense } from './ApiModel.js';
|
|
5
|
+
export { DataDomain, type DataDomainSchema } from './DataDomain.js';
|
|
6
|
+
export { DomainAssociation, type DomainAssociationSchema, type OnDeleteRule } from './DomainAssociation.js';
|
|
7
|
+
export { DomainEntity, type DomainEntitySchema, type EntityOrderedItem } from './DomainEntity.js';
|
|
8
|
+
export { DomainModel, type DomainModelSchema, type ModelOrderedItem } from './DomainModel.js';
|
|
9
|
+
export { DomainNamespace, type DomainNamespaceSchema, type NamespaceOrderedItem } from './DomainNamespace.js';
|
|
10
|
+
export { DomainProperty, type DomainPropertySchema } from './DomainProperty.js';
|
|
11
|
+
export { ExposedEntity } from './ExposedEntity.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modeling/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/F,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,KAAK,uBAAuB,EAAE,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC3G,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACjG,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAC7F,OAAO,EAAE,eAAe,EAAE,KAAK,qBAAqB,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAC7G,OAAO,EAAE,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './actions/index.js';
|
|
2
|
+
export * from './rules/index.js';
|
|
3
|
+
export * from './types.js';
|
|
4
|
+
export { ApiModel } from './ApiModel.js';
|
|
5
|
+
export { DataDomain } from './DataDomain.js';
|
|
6
|
+
export { DomainAssociation } from './DomainAssociation.js';
|
|
7
|
+
export { DomainEntity } from './DomainEntity.js';
|
|
8
|
+
export { DomainModel } from './DomainModel.js';
|
|
9
|
+
export { DomainNamespace } from './DomainNamespace.js';
|
|
10
|
+
export { DomainProperty } from './DomainProperty.js';
|
|
11
|
+
export { ExposedEntity } from './ExposedEntity.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modeling/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,OAAO,EAAE,QAAQ,EAAyD,MAAM,eAAe,CAAA;AAC/F,OAAO,EAAE,UAAU,EAAyB,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAmD,MAAM,wBAAwB,CAAA;AAC3G,OAAO,EAAE,YAAY,EAAmD,MAAM,mBAAmB,CAAA;AACjG,OAAO,EAAE,WAAW,EAAiD,MAAM,kBAAkB,CAAA;AAC7F,OAAO,EAAE,eAAe,EAAyD,MAAM,sBAAsB,CAAA;AAC7G,OAAO,EAAE,cAAc,EAA6B,MAAM,qBAAqB,CAAA;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA","sourcesContent":["export * from './actions/index.js'\nexport * from './rules/index.js'\nexport * from './types.js'\nexport { ApiModel, type ApiModelSchema, type ApiContact, type ApiLicense } from './ApiModel.js'\nexport { DataDomain, type DataDomainSchema } from './DataDomain.js'\nexport { DomainAssociation, type DomainAssociationSchema, type OnDeleteRule } from './DomainAssociation.js'\nexport { DomainEntity, type DomainEntitySchema, type EntityOrderedItem } from './DomainEntity.js'\nexport { DomainModel, type DomainModelSchema, type ModelOrderedItem } from './DomainModel.js'\nexport { DomainNamespace, type DomainNamespaceSchema, type NamespaceOrderedItem } from './DomainNamespace.js'\nexport { DomainProperty, type DomainPropertySchema } from './DomainProperty.js'\nexport { ExposedEntity } from './ExposedEntity.js'\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface AccessRuleSchema {
|
|
2
|
+
/**
|
|
3
|
+
* The unique identifier for the access rule.
|
|
4
|
+
* This is used to reference the rule in the API configuration.
|
|
5
|
+
*/
|
|
6
|
+
type: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Base class for all access rules.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AccessRule extends EventTarget implements AccessRuleSchema {
|
|
12
|
+
readonly type: string;
|
|
13
|
+
constructor(state?: Partial<AccessRuleSchema>);
|
|
14
|
+
toJSON(): AccessRuleSchema;
|
|
15
|
+
notifyChange(): void;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=AccessRule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccessRule.d.ts","sourceRoot":"","sources":["../../../../src/modeling/rules/AccessRule.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,WAAY,YAAW,gBAAgB;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;gBAET,KAAK,GAAE,OAAO,CAAC,gBAAgB,CAAM;IAKjD,MAAM,IAAI,gBAAgB;IAM1B,YAAY;CAGb"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for all access rules.
|
|
3
|
+
*/
|
|
4
|
+
export class AccessRule extends EventTarget {
|
|
5
|
+
type;
|
|
6
|
+
constructor(state = {}) {
|
|
7
|
+
super();
|
|
8
|
+
this.type = state.type ?? '';
|
|
9
|
+
}
|
|
10
|
+
toJSON() {
|
|
11
|
+
return {
|
|
12
|
+
type: this.type,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
notifyChange() {
|
|
16
|
+
this.dispatchEvent(new Event('change'));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=AccessRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccessRule.js","sourceRoot":"","sources":["../../../../src/modeling/rules/AccessRule.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,WAAW;IAChC,IAAI,CAAQ;IAErB,YAAY,QAAmC,EAAE;QAC/C,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,EAAE,CAAA;IAC9B,CAAC;IAED,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAA;IACH,CAAC;IAED,YAAY;QACV,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;IACzC,CAAC;CACF","sourcesContent":["export interface AccessRuleSchema {\n /**\n * The unique identifier for the access rule.\n * This is used to reference the rule in the API configuration.\n */\n type: string\n}\n\n/**\n * Base class for all access rules.\n */\nexport class AccessRule extends EventTarget implements AccessRuleSchema {\n readonly type: string\n\n constructor(state: Partial<AccessRuleSchema> = {}) {\n super()\n this.type = state.type ?? ''\n }\n\n toJSON(): AccessRuleSchema {\n return {\n type: this.type,\n }\n }\n\n notifyChange() {\n this.dispatchEvent(new Event('change'))\n }\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AccessRule, type AccessRuleSchema } from './AccessRule.js';
|
|
2
|
+
/**
|
|
3
|
+
* The action is allowed for any authenticated user.
|
|
4
|
+
* This rule does not impose any additional restrictions based on user properties or resource ownership.
|
|
5
|
+
* It is used for resources that should be accessible to all logged-in users.
|
|
6
|
+
*/
|
|
7
|
+
export interface AllowAuthenticatedAccessRuleSchema extends AccessRuleSchema {
|
|
8
|
+
type: 'authenticated';
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The action is allowed for any authenticated user.
|
|
12
|
+
* This rule does not impose any additional restrictions based on user properties or resource ownership.
|
|
13
|
+
* It is used for resources that should be accessible to all logged-in users.
|
|
14
|
+
*/
|
|
15
|
+
export declare class AllowAuthenticatedAccessRule extends AccessRule implements AllowAuthenticatedAccessRuleSchema {
|
|
16
|
+
readonly type: 'authenticated';
|
|
17
|
+
constructor(state?: Partial<AllowAuthenticatedAccessRuleSchema>);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=AllowAuthenticated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AllowAuthenticated.d.ts","sourceRoot":"","sources":["../../../../src/modeling/rules/AllowAuthenticated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAEnE;;;;GAIG;AACH,MAAM,WAAW,kCAAmC,SAAQ,gBAAgB;IAC1E,IAAI,EAAE,eAAe,CAAA;CACtB;AAED;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,UAAW,YAAW,kCAAkC;IACxG,SAAkB,IAAI,EAAE,eAAe,CAAA;gBAE3B,KAAK,GAAE,OAAO,CAAC,kCAAkC,CAAM;CAIpE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AccessRule } from './AccessRule.js';
|
|
2
|
+
/**
|
|
3
|
+
* The action is allowed for any authenticated user.
|
|
4
|
+
* This rule does not impose any additional restrictions based on user properties or resource ownership.
|
|
5
|
+
* It is used for resources that should be accessible to all logged-in users.
|
|
6
|
+
*/
|
|
7
|
+
export class AllowAuthenticatedAccessRule extends AccessRule {
|
|
8
|
+
type;
|
|
9
|
+
constructor(state = {}) {
|
|
10
|
+
super(state);
|
|
11
|
+
this.type = 'authenticated';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=AllowAuthenticated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AllowAuthenticated.js","sourceRoot":"","sources":["../../../../src/modeling/rules/AllowAuthenticated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,iBAAiB,CAAA;AAWnE;;;;GAIG;AACH,MAAM,OAAO,4BAA6B,SAAQ,UAAU;IACxC,IAAI,CAAiB;IAEvC,YAAY,QAAqD,EAAE;QACjE,KAAK,CAAC,KAAK,CAAC,CAAA;QACZ,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;IAC7B,CAAC;CACF","sourcesContent":["import { AccessRule, type AccessRuleSchema } from './AccessRule.js'\n\n/**\n * The action is allowed for any authenticated user.\n * This rule does not impose any additional restrictions based on user properties or resource ownership.\n * It is used for resources that should be accessible to all logged-in users.\n */\nexport interface AllowAuthenticatedAccessRuleSchema extends AccessRuleSchema {\n type: 'authenticated'\n}\n\n/**\n * The action is allowed for any authenticated user.\n * This rule does not impose any additional restrictions based on user properties or resource ownership.\n * It is used for resources that should be accessible to all logged-in users.\n */\nexport class AllowAuthenticatedAccessRule extends AccessRule implements AllowAuthenticatedAccessRuleSchema {\n override readonly type: 'authenticated'\n\n constructor(state: Partial<AllowAuthenticatedAccessRuleSchema> = {}) {\n super(state)\n this.type = 'authenticated'\n }\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AccessRule, type AccessRuleSchema } from './AccessRule.js';
|
|
2
|
+
/**
|
|
3
|
+
* The action is allowed for all users, including unauthenticated ones.
|
|
4
|
+
* This is typically used for public APIs or resources that do not require authentication.
|
|
5
|
+
* It is the most permissive rule and should be used with caution.
|
|
6
|
+
*/
|
|
7
|
+
export interface AllowPublicAccessRuleSchema extends AccessRuleSchema {
|
|
8
|
+
type: 'public';
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The action is allowed for all users, including unauthenticated ones.
|
|
12
|
+
* This is typically used for public APIs or resources that do not require authentication.
|
|
13
|
+
* It is the most permissive rule and should be used with caution.
|
|
14
|
+
*/
|
|
15
|
+
export declare class AllowPublicAccessRule extends AccessRule implements AllowPublicAccessRuleSchema {
|
|
16
|
+
readonly type: 'public';
|
|
17
|
+
constructor(state?: Partial<AllowPublicAccessRuleSchema>);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=AllowPublic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AllowPublic.d.ts","sourceRoot":"","sources":["../../../../src/modeling/rules/AllowPublic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAEnE;;;;GAIG;AACH,MAAM,WAAW,2BAA4B,SAAQ,gBAAgB;IACnE,IAAI,EAAE,QAAQ,CAAA;CACf;AAED;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,UAAW,YAAW,2BAA2B;IAC1F,SAAkB,IAAI,EAAE,QAAQ,CAAA;gBAEpB,KAAK,GAAE,OAAO,CAAC,2BAA2B,CAAM;CAI7D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AccessRule } from './AccessRule.js';
|
|
2
|
+
/**
|
|
3
|
+
* The action is allowed for all users, including unauthenticated ones.
|
|
4
|
+
* This is typically used for public APIs or resources that do not require authentication.
|
|
5
|
+
* It is the most permissive rule and should be used with caution.
|
|
6
|
+
*/
|
|
7
|
+
export class AllowPublicAccessRule extends AccessRule {
|
|
8
|
+
type;
|
|
9
|
+
constructor(state = {}) {
|
|
10
|
+
super(state);
|
|
11
|
+
this.type = 'public';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=AllowPublic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AllowPublic.js","sourceRoot":"","sources":["../../../../src/modeling/rules/AllowPublic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,iBAAiB,CAAA;AAWnE;;;;GAIG;AACH,MAAM,OAAO,qBAAsB,SAAQ,UAAU;IACjC,IAAI,CAAU;IAEhC,YAAY,QAA8C,EAAE;QAC1D,KAAK,CAAC,KAAK,CAAC,CAAA;QACZ,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAA;IACtB,CAAC;CACF","sourcesContent":["import { AccessRule, type AccessRuleSchema } from './AccessRule.js'\n\n/**\n * The action is allowed for all users, including unauthenticated ones.\n * This is typically used for public APIs or resources that do not require authentication.\n * It is the most permissive rule and should be used with caution.\n */\nexport interface AllowPublicAccessRuleSchema extends AccessRuleSchema {\n type: 'public'\n}\n\n/**\n * The action is allowed for all users, including unauthenticated ones.\n * This is typically used for public APIs or resources that do not require authentication.\n * It is the most permissive rule and should be used with caution.\n */\nexport class AllowPublicAccessRule extends AccessRule implements AllowPublicAccessRuleSchema {\n override readonly type: 'public'\n\n constructor(state: Partial<AllowPublicAccessRuleSchema> = {}) {\n super(state)\n this.type = 'public'\n }\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AccessRule, type AccessRuleSchema } from './AccessRule.js';
|
|
2
|
+
/**
|
|
3
|
+
* The action is allowed if the authenticated user's email domain matches a specific domain.
|
|
4
|
+
* This is used to restrict access based on the user's email address.
|
|
5
|
+
* For example, only users with an email address from "my-company.com" can access certain resources.
|
|
6
|
+
*/
|
|
7
|
+
export interface MatchEmailDomainAccessRuleSchema extends AccessRuleSchema {
|
|
8
|
+
type: 'matchEmailDomain';
|
|
9
|
+
/**
|
|
10
|
+
* The email domains that the authenticated user's email must match.
|
|
11
|
+
*/
|
|
12
|
+
domains: string[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The action is allowed if the authenticated user's email domain matches a specific domain.
|
|
16
|
+
* This is used to restrict access based on the user's email address.
|
|
17
|
+
* For example, only users with an email address from "my-company.com" can access certain resources.
|
|
18
|
+
*/
|
|
19
|
+
export declare class MatchEmailDomainAccessRule extends AccessRule implements MatchEmailDomainAccessRuleSchema {
|
|
20
|
+
readonly type: 'matchEmailDomain';
|
|
21
|
+
accessor domains: string[];
|
|
22
|
+
constructor(state?: Partial<MatchEmailDomainAccessRuleSchema>);
|
|
23
|
+
toJSON(): MatchEmailDomainAccessRuleSchema;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=MatchEmailDomain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MatchEmailDomain.d.ts","sourceRoot":"","sources":["../../../../src/modeling/rules/MatchEmailDomain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAGnE;;;;GAIG;AACH,MAAM,WAAW,gCAAiC,SAAQ,gBAAgB;IACxE,IAAI,EAAE,kBAAkB,CAAA;IACxB;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAED;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,UAAW,YAAW,gCAAgC;IACpG,SAAkB,IAAI,EAAE,kBAAkB,CAAA;IAEhB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAA;gBAExC,KAAK,GAAE,OAAO,CAAC,gCAAgC,CAAM;IAMxD,MAAM,IAAI,gCAAgC;CAMpD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { AccessRule } from './AccessRule.js';
|
|
3
|
+
import { observed, toRaw } from '../../decorators/observed.js';
|
|
4
|
+
/**
|
|
5
|
+
* The action is allowed if the authenticated user's email domain matches a specific domain.
|
|
6
|
+
* This is used to restrict access based on the user's email address.
|
|
7
|
+
* For example, only users with an email address from "my-company.com" can access certain resources.
|
|
8
|
+
*/
|
|
9
|
+
let MatchEmailDomainAccessRule = (() => {
|
|
10
|
+
let _classSuper = AccessRule;
|
|
11
|
+
let _domains_decorators;
|
|
12
|
+
let _domains_initializers = [];
|
|
13
|
+
let _domains_extraInitializers = [];
|
|
14
|
+
return class MatchEmailDomainAccessRule extends _classSuper {
|
|
15
|
+
static {
|
|
16
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
17
|
+
_domains_decorators = [observed({ deep: true })];
|
|
18
|
+
__esDecorate(this, null, _domains_decorators, { kind: "accessor", name: "domains", static: false, private: false, access: { has: obj => "domains" in obj, get: obj => obj.domains, set: (obj, value) => { obj.domains = value; } }, metadata: _metadata }, _domains_initializers, _domains_extraInitializers);
|
|
19
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
20
|
+
}
|
|
21
|
+
type;
|
|
22
|
+
#domains_accessor_storage = __runInitializers(this, _domains_initializers, void 0);
|
|
23
|
+
get domains() { return this.#domains_accessor_storage; }
|
|
24
|
+
set domains(value) { this.#domains_accessor_storage = value; }
|
|
25
|
+
constructor(state = {}) {
|
|
26
|
+
super(state);
|
|
27
|
+
__runInitializers(this, _domains_extraInitializers);
|
|
28
|
+
this.type = 'matchEmailDomain';
|
|
29
|
+
this.domains = state.domains ? [...state.domains] : [];
|
|
30
|
+
}
|
|
31
|
+
toJSON() {
|
|
32
|
+
return {
|
|
33
|
+
...super.toJSON(),
|
|
34
|
+
domains: structuredClone(toRaw(this, this.domains)),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
export { MatchEmailDomainAccessRule };
|
|
40
|
+
//# sourceMappingURL=MatchEmailDomain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MatchEmailDomain.js","sourceRoot":"","sources":["../../../../src/modeling/rules/MatchEmailDomain.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAe9D;;;;GAIG;IACU,0BAA0B;sBAAS,UAAU;;;;iBAA7C,0BAA2B,SAAQ,WAAU;;;mCAGvD,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;YAAC,0KAAS,OAAO,6BAAP,OAAO,yFAAU;;;QAFlC,IAAI,CAAoB;QAEhB,mFAA0B;QAA1B,IAAS,OAAO,6CAAU;QAA1B,IAAS,OAAO,mDAAU;QAEpD,YAAY,QAAmD,EAAE;YAC/D,KAAK,CAAC,KAAK,CAAC,CAAA;;YACZ,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAA;YAC9B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;SACvD;QAEQ,MAAM;YACb,OAAO;gBACL,GAAI,KAAK,CAAC,MAAM,EAAuC;gBACvD,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAa;aAChE,CAAA;QACH,CAAC;;;SAhBU,0BAA0B","sourcesContent":["import { AccessRule, type AccessRuleSchema } from './AccessRule.js'\nimport { observed, toRaw } from '../../decorators/observed.js'\n\n/**\n * The action is allowed if the authenticated user's email domain matches a specific domain.\n * This is used to restrict access based on the user's email address.\n * For example, only users with an email address from \"my-company.com\" can access certain resources.\n */\nexport interface MatchEmailDomainAccessRuleSchema extends AccessRuleSchema {\n type: 'matchEmailDomain'\n /**\n * The email domains that the authenticated user's email must match.\n */\n domains: string[]\n}\n\n/**\n * The action is allowed if the authenticated user's email domain matches a specific domain.\n * This is used to restrict access based on the user's email address.\n * For example, only users with an email address from \"my-company.com\" can access certain resources.\n */\nexport class MatchEmailDomainAccessRule extends AccessRule implements MatchEmailDomainAccessRuleSchema {\n override readonly type: 'matchEmailDomain'\n\n @observed({ deep: true }) accessor domains: string[]\n\n constructor(state: Partial<MatchEmailDomainAccessRuleSchema> = {}) {\n super(state)\n this.type = 'matchEmailDomain'\n this.domains = state.domains ? [...state.domains] : []\n }\n\n override toJSON(): MatchEmailDomainAccessRuleSchema {\n return {\n ...(super.toJSON() as MatchEmailDomainAccessRuleSchema),\n domains: structuredClone(toRaw(this, this.domains)) as string[],\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AccessRule, type AccessRuleSchema } from './AccessRule.js';
|
|
2
|
+
/**
|
|
3
|
+
* The action is allowed if the authenticated user's ID matches a specific property on the resource.
|
|
4
|
+
* This is typically used to restrict access to resources owned by the user.
|
|
5
|
+
* For example, a user can only access their own profile or documents.
|
|
6
|
+
*/
|
|
7
|
+
export interface MatchResourceOwnerAccessRuleSchema extends AccessRuleSchema {
|
|
8
|
+
type: 'resourceOwner';
|
|
9
|
+
/**
|
|
10
|
+
* The property on the resource that should match the authenticated user's ID.
|
|
11
|
+
* This is typically the ID of the user who owns the resource.
|
|
12
|
+
*
|
|
13
|
+
* The domain model should annotate this property with the "ResourceOwnerIdentifier" semantic
|
|
14
|
+
* to indicate that it is used for ownership checks.
|
|
15
|
+
*/
|
|
16
|
+
property: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The action is allowed if the authenticated user's ID matches a specific property on the resource.
|
|
20
|
+
* This is typically used to restrict access to resources owned by the user.
|
|
21
|
+
* For example, a user can only access their own profile or documents.
|
|
22
|
+
*/
|
|
23
|
+
export declare class MatchResourceOwnerAccessRule extends AccessRule implements MatchResourceOwnerAccessRuleSchema {
|
|
24
|
+
readonly type: 'resourceOwner';
|
|
25
|
+
accessor property: string;
|
|
26
|
+
constructor(state?: Partial<MatchResourceOwnerAccessRuleSchema>);
|
|
27
|
+
toJSON(): MatchResourceOwnerAccessRuleSchema;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=MatchResourceOwner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MatchResourceOwner.d.ts","sourceRoot":"","sources":["../../../../src/modeling/rules/MatchResourceOwner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAGnE;;;;GAIG;AACH,MAAM,WAAW,kCAAmC,SAAQ,gBAAgB;IAC1E,IAAI,EAAE,eAAe,CAAA;IACrB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,UAAW,YAAW,kCAAkC;IACxG,SAAkB,IAAI,EAAE,eAAe,CAAA;IAE3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;gBAEzB,KAAK,GAAE,OAAO,CAAC,kCAAkC,CAAM;IAM1D,MAAM,IAAI,kCAAkC;CAMtD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { AccessRule } from './AccessRule.js';
|
|
3
|
+
import { observed } from '../../decorators/observed.js';
|
|
4
|
+
/**
|
|
5
|
+
* The action is allowed if the authenticated user's ID matches a specific property on the resource.
|
|
6
|
+
* This is typically used to restrict access to resources owned by the user.
|
|
7
|
+
* For example, a user can only access their own profile or documents.
|
|
8
|
+
*/
|
|
9
|
+
let MatchResourceOwnerAccessRule = (() => {
|
|
10
|
+
let _classSuper = AccessRule;
|
|
11
|
+
let _property_decorators;
|
|
12
|
+
let _property_initializers = [];
|
|
13
|
+
let _property_extraInitializers = [];
|
|
14
|
+
return class MatchResourceOwnerAccessRule extends _classSuper {
|
|
15
|
+
static {
|
|
16
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
17
|
+
_property_decorators = [observed()];
|
|
18
|
+
__esDecorate(this, null, _property_decorators, { kind: "accessor", name: "property", static: false, private: false, access: { has: obj => "property" in obj, get: obj => obj.property, set: (obj, value) => { obj.property = value; } }, metadata: _metadata }, _property_initializers, _property_extraInitializers);
|
|
19
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
20
|
+
}
|
|
21
|
+
type;
|
|
22
|
+
#property_accessor_storage = __runInitializers(this, _property_initializers, void 0);
|
|
23
|
+
get property() { return this.#property_accessor_storage; }
|
|
24
|
+
set property(value) { this.#property_accessor_storage = value; }
|
|
25
|
+
constructor(state = {}) {
|
|
26
|
+
super(state);
|
|
27
|
+
__runInitializers(this, _property_extraInitializers);
|
|
28
|
+
this.type = 'resourceOwner';
|
|
29
|
+
this.property = state.property ?? '';
|
|
30
|
+
}
|
|
31
|
+
toJSON() {
|
|
32
|
+
return {
|
|
33
|
+
...super.toJSON(),
|
|
34
|
+
property: this.property,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
export { MatchResourceOwnerAccessRule };
|
|
40
|
+
//# sourceMappingURL=MatchResourceOwner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MatchResourceOwner.js","sourceRoot":"","sources":["../../../../src/modeling/rules/MatchResourceOwner.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAmBvD;;;;GAIG;IACU,4BAA4B;sBAAS,UAAU;;;;iBAA/C,4BAA6B,SAAQ,WAAU;;;oCAGzD,QAAQ,EAAE;YAAC,6KAAS,QAAQ,6BAAR,QAAQ,2FAAQ;;;QAFnB,IAAI,CAAiB;QAE3B,qFAAyB;QAAzB,IAAS,QAAQ,8CAAQ;QAAzB,IAAS,QAAQ,oDAAQ;QAErC,YAAY,QAAqD,EAAE;YACjE,KAAK,CAAC,KAAK,CAAC,CAAA;;YACZ,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;YAC3B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAA;SACrC;QAEQ,MAAM;YACb,OAAO;gBACL,GAAI,KAAK,CAAC,MAAM,EAAyC;gBACzD,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB,CAAA;QACH,CAAC;;;SAhBU,4BAA4B","sourcesContent":["import { AccessRule, type AccessRuleSchema } from './AccessRule.js'\nimport { observed } from '../../decorators/observed.js'\n\n/**\n * The action is allowed if the authenticated user's ID matches a specific property on the resource.\n * This is typically used to restrict access to resources owned by the user.\n * For example, a user can only access their own profile or documents.\n */\nexport interface MatchResourceOwnerAccessRuleSchema extends AccessRuleSchema {\n type: 'resourceOwner'\n /**\n * The property on the resource that should match the authenticated user's ID.\n * This is typically the ID of the user who owns the resource.\n *\n * The domain model should annotate this property with the \"ResourceOwnerIdentifier\" semantic\n * to indicate that it is used for ownership checks.\n */\n property: string\n}\n\n/**\n * The action is allowed if the authenticated user's ID matches a specific property on the resource.\n * This is typically used to restrict access to resources owned by the user.\n * For example, a user can only access their own profile or documents.\n */\nexport class MatchResourceOwnerAccessRule extends AccessRule implements MatchResourceOwnerAccessRuleSchema {\n override readonly type: 'resourceOwner'\n\n @observed() accessor property: string\n\n constructor(state: Partial<MatchResourceOwnerAccessRuleSchema> = {}) {\n super(state)\n this.type = 'resourceOwner'\n this.property = state.property ?? ''\n }\n\n override toJSON(): MatchResourceOwnerAccessRuleSchema {\n return {\n ...(super.toJSON() as MatchResourceOwnerAccessRuleSchema),\n property: this.property,\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AccessRule, type AccessRuleSchema } from './AccessRule.js';
|
|
2
|
+
/**
|
|
3
|
+
* The action is allowed if a specific property on the authenticated user matches an expected value.
|
|
4
|
+
* This is used to enforce other user-specific restrictions.
|
|
5
|
+
*/
|
|
6
|
+
export interface MatchUserPropertyAccessRuleSchema extends AccessRuleSchema {
|
|
7
|
+
type: 'matchUserProperty';
|
|
8
|
+
/**
|
|
9
|
+
* The property on the authenticated user that should match the expected value.
|
|
10
|
+
*/
|
|
11
|
+
property: string;
|
|
12
|
+
/**
|
|
13
|
+
* The expected value for the user property.
|
|
14
|
+
*/
|
|
15
|
+
value: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The action is allowed if a specific property on the authenticated user matches an expected value.
|
|
19
|
+
* This is used to enforce other user-specific restrictions.
|
|
20
|
+
*/
|
|
21
|
+
export declare class MatchUserPropertyAccessRule extends AccessRule implements MatchUserPropertyAccessRuleSchema {
|
|
22
|
+
readonly type: 'matchUserProperty';
|
|
23
|
+
accessor property: string;
|
|
24
|
+
accessor value: string;
|
|
25
|
+
constructor(state?: Partial<MatchUserPropertyAccessRuleSchema>);
|
|
26
|
+
toJSON(): MatchUserPropertyAccessRuleSchema;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=MatchUserProperty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MatchUserProperty.d.ts","sourceRoot":"","sources":["../../../../src/modeling/rules/MatchUserProperty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAGnE;;;GAGG;AACH,MAAM,WAAW,iCAAkC,SAAQ,gBAAgB;IACzE,IAAI,EAAE,mBAAmB,CAAA;IACzB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;GAGG;AACH,qBAAa,2BAA4B,SAAQ,UAAW,YAAW,iCAAiC;IACtG,SAAkB,IAAI,EAAE,mBAAmB,CAAA;IAE/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;gBAEtB,KAAK,GAAE,OAAO,CAAC,iCAAiC,CAAM;IAOzD,MAAM,IAAI,iCAAiC;CAOrD"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { AccessRule } from './AccessRule.js';
|
|
3
|
+
import { observed } from '../../decorators/observed.js';
|
|
4
|
+
/**
|
|
5
|
+
* The action is allowed if a specific property on the authenticated user matches an expected value.
|
|
6
|
+
* This is used to enforce other user-specific restrictions.
|
|
7
|
+
*/
|
|
8
|
+
let MatchUserPropertyAccessRule = (() => {
|
|
9
|
+
let _classSuper = AccessRule;
|
|
10
|
+
let _property_decorators;
|
|
11
|
+
let _property_initializers = [];
|
|
12
|
+
let _property_extraInitializers = [];
|
|
13
|
+
let _value_decorators;
|
|
14
|
+
let _value_initializers = [];
|
|
15
|
+
let _value_extraInitializers = [];
|
|
16
|
+
return class MatchUserPropertyAccessRule extends _classSuper {
|
|
17
|
+
static {
|
|
18
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
19
|
+
_property_decorators = [observed()];
|
|
20
|
+
_value_decorators = [observed()];
|
|
21
|
+
__esDecorate(this, null, _property_decorators, { kind: "accessor", name: "property", static: false, private: false, access: { has: obj => "property" in obj, get: obj => obj.property, set: (obj, value) => { obj.property = value; } }, metadata: _metadata }, _property_initializers, _property_extraInitializers);
|
|
22
|
+
__esDecorate(this, null, _value_decorators, { kind: "accessor", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
|
|
23
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
24
|
+
}
|
|
25
|
+
type;
|
|
26
|
+
#property_accessor_storage = __runInitializers(this, _property_initializers, void 0);
|
|
27
|
+
get property() { return this.#property_accessor_storage; }
|
|
28
|
+
set property(value) { this.#property_accessor_storage = value; }
|
|
29
|
+
#value_accessor_storage = (__runInitializers(this, _property_extraInitializers), __runInitializers(this, _value_initializers, void 0));
|
|
30
|
+
get value() { return this.#value_accessor_storage; }
|
|
31
|
+
set value(value) { this.#value_accessor_storage = value; }
|
|
32
|
+
constructor(state = {}) {
|
|
33
|
+
super(state);
|
|
34
|
+
__runInitializers(this, _value_extraInitializers);
|
|
35
|
+
this.type = 'matchUserProperty';
|
|
36
|
+
this.property = state.property ?? '';
|
|
37
|
+
this.value = state.value ?? '';
|
|
38
|
+
}
|
|
39
|
+
toJSON() {
|
|
40
|
+
return {
|
|
41
|
+
...super.toJSON(),
|
|
42
|
+
property: this.property,
|
|
43
|
+
value: this.value,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
})();
|
|
48
|
+
export { MatchUserPropertyAccessRule };
|
|
49
|
+
//# sourceMappingURL=MatchUserProperty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MatchUserProperty.js","sourceRoot":"","sources":["../../../../src/modeling/rules/MatchUserProperty.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAkBvD;;;GAGG;IACU,2BAA2B;sBAAS,UAAU;;;;;;;iBAA9C,2BAA4B,SAAQ,WAAU;;;oCAGxD,QAAQ,EAAE;iCACV,QAAQ,EAAE;YADC,6KAAS,QAAQ,6BAAR,QAAQ,2FAAQ;YACzB,oKAAS,KAAK,6BAAL,KAAK,qFAAQ;;;QAHhB,IAAI,CAAqB;QAE/B,qFAAyB;QAAzB,IAAS,QAAQ,8CAAQ;QAAzB,IAAS,QAAQ,oDAAQ;QACzB,uIAAsB;QAAtB,IAAS,KAAK,2CAAQ;QAAtB,IAAS,KAAK,iDAAQ;QAElC,YAAY,QAAoD,EAAE;YAChE,KAAK,CAAC,KAAK,CAAC,CAAA;;YACZ,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAA;YAC/B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAA;YACpC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,EAAE,CAAA;SAC/B;QAEQ,MAAM;YACb,OAAO;gBACL,GAAI,KAAK,CAAC,MAAM,EAAwC;gBACxD,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,KAAK,EAAE,IAAI,CAAC,KAAK;aAClB,CAAA;QACH,CAAC;;;SAnBU,2BAA2B","sourcesContent":["import { AccessRule, type AccessRuleSchema } from './AccessRule.js'\nimport { observed } from '../../decorators/observed.js'\n\n/**\n * The action is allowed if a specific property on the authenticated user matches an expected value.\n * This is used to enforce other user-specific restrictions.\n */\nexport interface MatchUserPropertyAccessRuleSchema extends AccessRuleSchema {\n type: 'matchUserProperty'\n /**\n * The property on the authenticated user that should match the expected value.\n */\n property: string\n /**\n * The expected value for the user property.\n */\n value: string\n}\n\n/**\n * The action is allowed if a specific property on the authenticated user matches an expected value.\n * This is used to enforce other user-specific restrictions.\n */\nexport class MatchUserPropertyAccessRule extends AccessRule implements MatchUserPropertyAccessRuleSchema {\n override readonly type: 'matchUserProperty'\n\n @observed() accessor property: string\n @observed() accessor value: string\n\n constructor(state: Partial<MatchUserPropertyAccessRuleSchema> = {}) {\n super(state)\n this.type = 'matchUserProperty'\n this.property = state.property ?? ''\n this.value = state.value ?? ''\n }\n\n override toJSON(): MatchUserPropertyAccessRuleSchema {\n return {\n ...(super.toJSON() as MatchUserPropertyAccessRuleSchema),\n property: this.property,\n value: this.value,\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AccessRule, type AccessRuleSchema } from './AccessRule.js';
|
|
2
|
+
/**
|
|
3
|
+
* The action is allowed if the authenticated user has a specific role.
|
|
4
|
+
* This is used to enforce role-based access control (RBAC).
|
|
5
|
+
* For example, only users with the "admin" role can perform certain actions.
|
|
6
|
+
*/
|
|
7
|
+
export interface MatchUserRoleAccessRuleSchema extends AccessRuleSchema {
|
|
8
|
+
type: 'matchUserRole';
|
|
9
|
+
/**
|
|
10
|
+
* The role that the authenticated user must have to access the resource.
|
|
11
|
+
* This is typically a property on the user entity that defines their role.
|
|
12
|
+
*
|
|
13
|
+
* The domain model should annotate this property with the "UserRole" semantic
|
|
14
|
+
* to indicate that it is used for role-based access control.
|
|
15
|
+
*/
|
|
16
|
+
role: string[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The action is allowed if the authenticated user has a specific role.
|
|
20
|
+
* This is used to enforce role-based access control (RBAC).
|
|
21
|
+
* For example, only users with the "admin" role can perform certain actions.
|
|
22
|
+
*/
|
|
23
|
+
export declare class MatchUserRoleAccessRule extends AccessRule implements MatchUserRoleAccessRuleSchema {
|
|
24
|
+
readonly type: 'matchUserRole';
|
|
25
|
+
accessor role: string[];
|
|
26
|
+
constructor(state?: Partial<MatchUserRoleAccessRuleSchema>);
|
|
27
|
+
toJSON(): MatchUserRoleAccessRuleSchema;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=MatchUserRole.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MatchUserRole.d.ts","sourceRoot":"","sources":["../../../../src/modeling/rules/MatchUserRole.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAGnE;;;;GAIG;AACH,MAAM,WAAW,6BAA8B,SAAQ,gBAAgB;IACrE,IAAI,EAAE,eAAe,CAAA;IACrB;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,EAAE,CAAA;CACf;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,UAAW,YAAW,6BAA6B;IAC9F,SAAkB,IAAI,EAAE,eAAe,CAAA;IAEb,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAA;gBAErC,KAAK,GAAE,OAAO,CAAC,6BAA6B,CAAM;IAMrD,MAAM,IAAI,6BAA6B;CAMjD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { AccessRule } from './AccessRule.js';
|
|
3
|
+
import { observed, toRaw } from '../../decorators/observed.js';
|
|
4
|
+
/**
|
|
5
|
+
* The action is allowed if the authenticated user has a specific role.
|
|
6
|
+
* This is used to enforce role-based access control (RBAC).
|
|
7
|
+
* For example, only users with the "admin" role can perform certain actions.
|
|
8
|
+
*/
|
|
9
|
+
let MatchUserRoleAccessRule = (() => {
|
|
10
|
+
let _classSuper = AccessRule;
|
|
11
|
+
let _role_decorators;
|
|
12
|
+
let _role_initializers = [];
|
|
13
|
+
let _role_extraInitializers = [];
|
|
14
|
+
return class MatchUserRoleAccessRule extends _classSuper {
|
|
15
|
+
static {
|
|
16
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
17
|
+
_role_decorators = [observed({ deep: true })];
|
|
18
|
+
__esDecorate(this, null, _role_decorators, { kind: "accessor", name: "role", static: false, private: false, access: { has: obj => "role" in obj, get: obj => obj.role, set: (obj, value) => { obj.role = value; } }, metadata: _metadata }, _role_initializers, _role_extraInitializers);
|
|
19
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
20
|
+
}
|
|
21
|
+
type;
|
|
22
|
+
#role_accessor_storage = __runInitializers(this, _role_initializers, void 0);
|
|
23
|
+
get role() { return this.#role_accessor_storage; }
|
|
24
|
+
set role(value) { this.#role_accessor_storage = value; }
|
|
25
|
+
constructor(state = {}) {
|
|
26
|
+
super(state);
|
|
27
|
+
__runInitializers(this, _role_extraInitializers);
|
|
28
|
+
this.type = 'matchUserRole';
|
|
29
|
+
this.role = state.role ? [...state.role] : [];
|
|
30
|
+
}
|
|
31
|
+
toJSON() {
|
|
32
|
+
return {
|
|
33
|
+
...super.toJSON(),
|
|
34
|
+
role: structuredClone(toRaw(this, this.role)),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
export { MatchUserRoleAccessRule };
|
|
40
|
+
//# sourceMappingURL=MatchUserRole.js.map
|