@api-client/core 0.18.58 → 0.18.60
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/decorators/observed.d.ts.map +1 -1
- package/build/src/decorators/observed.js +15 -1
- package/build/src/decorators/observed.js.map +1 -1
- package/build/src/modeling/ApiModel.d.ts.map +1 -1
- package/build/src/modeling/ApiModel.js +2 -2
- package/build/src/modeling/ApiModel.js.map +1 -1
- package/build/src/modeling/ExposedEntity.d.ts.map +1 -1
- package/build/src/modeling/ExposedEntity.js +4 -4
- package/build/src/modeling/ExposedEntity.js.map +1 -1
- package/build/src/modeling/actions/Action.d.ts.map +1 -1
- package/build/src/modeling/actions/Action.js +2 -2
- package/build/src/modeling/actions/Action.js.map +1 -1
- package/build/src/modeling/actions/CreateAction.d.ts +2 -0
- package/build/src/modeling/actions/CreateAction.d.ts.map +1 -1
- package/build/src/modeling/actions/CreateAction.js +6 -0
- package/build/src/modeling/actions/CreateAction.js.map +1 -1
- package/build/src/modeling/actions/DeleteAction.d.ts +2 -0
- package/build/src/modeling/actions/DeleteAction.d.ts.map +1 -1
- package/build/src/modeling/actions/DeleteAction.js +6 -0
- package/build/src/modeling/actions/DeleteAction.js.map +1 -1
- package/build/src/modeling/actions/ListAction.d.ts +2 -0
- package/build/src/modeling/actions/ListAction.d.ts.map +1 -1
- package/build/src/modeling/actions/ListAction.js +8 -2
- package/build/src/modeling/actions/ListAction.js.map +1 -1
- package/build/src/modeling/actions/ReadAction.d.ts +2 -0
- package/build/src/modeling/actions/ReadAction.d.ts.map +1 -1
- package/build/src/modeling/actions/ReadAction.js +6 -0
- package/build/src/modeling/actions/ReadAction.js.map +1 -1
- package/build/src/modeling/actions/SearchAction.d.ts +2 -0
- package/build/src/modeling/actions/SearchAction.d.ts.map +1 -1
- package/build/src/modeling/actions/SearchAction.js +6 -0
- package/build/src/modeling/actions/SearchAction.js.map +1 -1
- package/build/src/modeling/actions/UpdateAction.d.ts +2 -0
- package/build/src/modeling/actions/UpdateAction.d.ts.map +1 -1
- package/build/src/modeling/actions/UpdateAction.js +6 -0
- package/build/src/modeling/actions/UpdateAction.js.map +1 -1
- package/build/src/modeling/actions/index.d.ts +10 -0
- package/build/src/modeling/actions/index.d.ts.map +1 -1
- package/build/src/modeling/actions/index.js +30 -0
- package/build/src/modeling/actions/index.js.map +1 -1
- package/build/src/modeling/rules/AllowAuthenticated.d.ts +2 -2
- package/build/src/modeling/rules/AllowAuthenticated.d.ts.map +1 -1
- package/build/src/modeling/rules/AllowAuthenticated.js +1 -1
- package/build/src/modeling/rules/AllowAuthenticated.js.map +1 -1
- package/build/src/modeling/rules/AllowPublic.d.ts +2 -2
- package/build/src/modeling/rules/AllowPublic.d.ts.map +1 -1
- package/build/src/modeling/rules/AllowPublic.js +1 -1
- package/build/src/modeling/rules/AllowPublic.js.map +1 -1
- package/build/src/modeling/rules/MatchResourceOwner.d.ts +2 -2
- package/build/src/modeling/rules/MatchResourceOwner.d.ts.map +1 -1
- package/build/src/modeling/rules/MatchResourceOwner.js +1 -1
- package/build/src/modeling/rules/MatchResourceOwner.js.map +1 -1
- package/build/src/modeling/rules/index.d.ts +14 -2
- package/build/src/modeling/rules/index.d.ts.map +1 -1
- package/build/src/modeling/rules/index.js +32 -1
- package/build/src/modeling/rules/index.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/data/models/example-generator-api.json +25 -25
- package/package.json +1 -1
- package/src/decorators/observed.ts +15 -1
- package/src/modeling/ApiModel.ts +2 -1
- package/src/modeling/ExposedEntity.ts +4 -2
- package/src/modeling/actions/Action.ts +2 -1
- package/src/modeling/actions/CreateAction.ts +8 -0
- package/src/modeling/actions/DeleteAction.ts +8 -0
- package/src/modeling/actions/ListAction.ts +10 -2
- package/src/modeling/actions/ReadAction.ts +8 -0
- package/src/modeling/actions/SearchAction.ts +8 -0
- package/src/modeling/actions/UpdateAction.ts +8 -0
- package/src/modeling/rules/AllowAuthenticated.ts +3 -3
- package/src/modeling/rules/AllowPublic.ts +3 -3
- package/src/modeling/rules/MatchResourceOwner.ts +3 -3
- package/tests/unit/decorators/observed.spec.ts +42 -0
- package/tests/unit/modeling/actions/Action.spec.ts +10 -10
- package/tests/unit/modeling/actions/CreateAction.spec.ts +8 -8
- package/tests/unit/modeling/actions/DeleteAction.spec.ts +5 -5
- package/tests/unit/modeling/actions/ReadAction.spec.ts +9 -9
- package/tests/unit/modeling/api_model.spec.ts +3 -3
- package/tests/unit/modeling/exposed_entity.spec.ts +8 -8
- package/tests/unit/modeling/exposed_entity_actions.spec.ts +182 -0
- package/tests/unit/modeling/rules/AllowAuthenticated.spec.ts +2 -2
- package/tests/unit/modeling/rules/AllowPublic.spec.ts +2 -2
- package/tests/unit/modeling/rules/MatchResourceOwner.spec.ts +3 -3
- package/tests/unit/modeling/rules/restoring_rules.spec.ts +121 -0
|
@@ -30,5 +30,7 @@ export declare class DeleteAction extends Action implements DeleteActionSchema {
|
|
|
30
30
|
accessor retentionPeriod: number;
|
|
31
31
|
constructor(state?: Partial<DeleteActionSchema>);
|
|
32
32
|
toJSON(): DeleteActionSchema;
|
|
33
|
+
static isDeleteAction(action: Action): action is DeleteAction;
|
|
34
|
+
static isDeleteActionSchema(schema: ActionSchema): schema is DeleteActionSchema;
|
|
33
35
|
}
|
|
34
36
|
//# sourceMappingURL=DeleteAction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteAction.d.ts","sourceRoot":"","sources":["../../../../src/modeling/actions/DeleteAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAGvD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAA;AAE5C;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,IAAI,EAAE,QAAQ,CAAA;IACd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED;;;GAGG;AACH,qBAAa,YAAa,SAAQ,MAAO,YAAW,kBAAkB;IACpE,SAA8B,IAAI,EAAE,QAAQ,CAAA;IAChC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAA;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;gBAEhC,KAAK,GAAE,OAAO,CAAC,kBAAkB,CAAM;IAO1C,MAAM,IAAI,kBAAkB;
|
|
1
|
+
{"version":3,"file":"DeleteAction.d.ts","sourceRoot":"","sources":["../../../../src/modeling/actions/DeleteAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAGvD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAA;AAE5C;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,IAAI,EAAE,QAAQ,CAAA;IACd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED;;;GAGG;AACH,qBAAa,YAAa,SAAQ,MAAO,YAAW,kBAAkB;IACpE,SAA8B,IAAI,EAAE,QAAQ,CAAA;IAChC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAA;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;gBAEhC,KAAK,GAAE,OAAO,CAAC,kBAAkB,CAAM;IAO1C,MAAM,IAAI,kBAAkB;IASrC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,YAAY;IAI7D,MAAM,CAAC,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,kBAAkB;CAGhF"}
|
|
@@ -51,6 +51,12 @@ let DeleteAction = (() => {
|
|
|
51
51
|
retentionPeriod: this.retentionPeriod,
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
+
static isDeleteAction(action) {
|
|
55
|
+
return action.kind === 'delete';
|
|
56
|
+
}
|
|
57
|
+
static isDeleteActionSchema(schema) {
|
|
58
|
+
return schema.kind === 'delete';
|
|
59
|
+
}
|
|
54
60
|
};
|
|
55
61
|
})();
|
|
56
62
|
export { DeleteAction };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteAction.js","sourceRoot":"","sources":["../../../../src/modeling/actions/DeleteAction.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAyBvD;;;GAGG;IACU,YAAY;sBAAS,MAAM;;;;;;;;;;iBAA3B,YAAa,SAAQ,WAAM;;;gCACrC,QAAQ,EAAE;oCACV,QAAQ,EAAE;2CACV,QAAQ,EAAE;YAFC,iKAAkB,IAAI,6BAAJ,IAAI,mFAAU;YAChC,6KAAS,QAAQ,6BAAR,QAAQ,2FAAgB;YACjC,kMAAS,eAAe,6BAAf,eAAe,yGAAQ;;;QAFhC,6EAAgC;QAAhC,IAAkB,IAAI,0CAAU;QAAhC,IAAkB,IAAI,gDAAU;QAChC,yIAAiC;QAAjC,IAAS,QAAQ,8CAAgB;QAAjC,IAAS,QAAQ,oDAAgB;QACjC,2JAAgC;QAAhC,IAAS,eAAe,qDAAQ;QAAhC,IAAS,eAAe,2DAAQ;QAE5C,YAAY,QAAqC,EAAE;YACjD,KAAK,CAAC,KAAK,CAAC,CAAA;;YACZ,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAA;YACpB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,MAAM,CAAA;YACxC,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,IAAI,EAAE,CAAA;SACnD;QAEQ,MAAM;YACb,OAAO;gBACL,GAAI,KAAK,CAAC,MAAM,EAAyB;gBACzC,IAAI,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AAM,CAAC,cAAc,CAAC,MAAc;YAClC,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAA;QACjC,CAAC;QAED,MAAM,CAAC,oBAAoB,CAAC,MAAoB;YAC9C,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAA;QACjC,CAAC;;;SA3BU,YAAY","sourcesContent":["import { Action, type ActionSchema } from './Action.js'\nimport { observed } from '../../decorators/observed.js'\n\nexport type DeleteStrategy = 'soft' | 'hard'\n\n/**\n * Enables removing an existing resource.\n * Endpoint: DELETE /[entity-collection-name]/{id}\n */\nexport interface DeleteActionSchema extends ActionSchema {\n kind: 'delete'\n /**\n * The strategy for deletion. Default: Soft Delete.\n *\n * @default 'soft'\n */\n strategy?: DeleteStrategy\n /**\n * The data retention period (in days) for soft-deleted resources.\n * This defines how long the data should be kept before it is permanently deleted.\n *\n * @default 30\n */\n retentionPeriod?: number\n}\n\n/**\n * Enables removing an existing resource.\n * Endpoint: DELETE /[entity-collection-name]/{id}\n */\nexport class DeleteAction extends Action implements DeleteActionSchema {\n @observed() override accessor kind: 'delete'\n @observed() accessor strategy: DeleteStrategy\n @observed() accessor retentionPeriod: number\n\n constructor(state: Partial<DeleteActionSchema> = {}) {\n super(state)\n this.kind = 'delete'\n this.strategy = state.strategy || 'soft'\n this.retentionPeriod = state.retentionPeriod ?? 30\n }\n\n override toJSON(): DeleteActionSchema {\n return {\n ...(super.toJSON() as DeleteActionSchema),\n kind: 'delete',\n strategy: this.strategy,\n retentionPeriod: this.retentionPeriod,\n }\n }\n\n static isDeleteAction(action: Action): action is DeleteAction {\n return action.kind === 'delete'\n }\n\n static isDeleteActionSchema(schema: ActionSchema): schema is DeleteActionSchema {\n return schema.kind === 'delete'\n }\n}\n"]}
|
|
@@ -33,5 +33,7 @@ export declare class ListAction extends Action implements ListActionSchema {
|
|
|
33
33
|
accessor sortableFields: string[];
|
|
34
34
|
constructor(state?: Partial<ListActionSchema>);
|
|
35
35
|
toJSON(): ListActionSchema;
|
|
36
|
+
static isListAction(action: Action): action is ListAction;
|
|
37
|
+
static isListActionSchema(schema: ActionSchema): schema is ListActionSchema;
|
|
36
38
|
}
|
|
37
39
|
//# sourceMappingURL=ListAction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListAction.d.ts","sourceRoot":"","sources":["../../../../src/modeling/actions/ListAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAGvD;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,UAAU,EAAE,kBAAkB,CAAA;IAC9B;;;OAGG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B;;OAEG;IACH,cAAc,EAAE,MAAM,EAAE,CAAA;CACzB;AAED;;;GAGG;AACH,qBAAa,UAAW,SAAQ,MAAO,YAAW,gBAAgB;IAChE,SAA8B,IAAI,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAA;IACvC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"ListAction.d.ts","sourceRoot":"","sources":["../../../../src/modeling/actions/ListAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAGvD;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,UAAU,EAAE,kBAAkB,CAAA;IAC9B;;;OAGG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B;;OAEG;IACH,cAAc,EAAE,MAAM,EAAE,CAAA;CACzB;AAED;;;GAGG;AACH,qBAAa,UAAW,SAAQ,MAAO,YAAW,gBAAgB;IAChE,SAA8B,IAAI,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAA;IACvC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,EAAE,CAAK;IACxC,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,CAAK;gBAEpD,KAAK,GAAE,OAAO,CAAC,gBAAgB,CAAM;IAYxC,MAAM,IAAI,gBAAgB;IASnC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,UAAU;IAIzD,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,gBAAgB;CAG5E"}
|
|
@@ -38,10 +38,10 @@ let ListAction = (() => {
|
|
|
38
38
|
#pagination_accessor_storage = (__runInitializers(this, _kind_extraInitializers), __runInitializers(this, _pagination_initializers, void 0));
|
|
39
39
|
get pagination() { return this.#pagination_accessor_storage; }
|
|
40
40
|
set pagination(value) { this.#pagination_accessor_storage = value; }
|
|
41
|
-
#filterableFields_accessor_storage = (__runInitializers(this, _pagination_extraInitializers), __runInitializers(this, _filterableFields_initializers,
|
|
41
|
+
#filterableFields_accessor_storage = (__runInitializers(this, _pagination_extraInitializers), __runInitializers(this, _filterableFields_initializers, []));
|
|
42
42
|
get filterableFields() { return this.#filterableFields_accessor_storage; }
|
|
43
43
|
set filterableFields(value) { this.#filterableFields_accessor_storage = value; }
|
|
44
|
-
#sortableFields_accessor_storage = (__runInitializers(this, _filterableFields_extraInitializers), __runInitializers(this, _sortableFields_initializers,
|
|
44
|
+
#sortableFields_accessor_storage = (__runInitializers(this, _filterableFields_extraInitializers), __runInitializers(this, _sortableFields_initializers, []));
|
|
45
45
|
get sortableFields() { return this.#sortableFields_accessor_storage; }
|
|
46
46
|
set sortableFields(value) { this.#sortableFields_accessor_storage = value; }
|
|
47
47
|
constructor(state = {}) {
|
|
@@ -64,6 +64,12 @@ let ListAction = (() => {
|
|
|
64
64
|
sortableFields: structuredClone(toRaw(this, this.sortableFields)),
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
+
static isListAction(action) {
|
|
68
|
+
return action.kind === 'list';
|
|
69
|
+
}
|
|
70
|
+
static isListActionSchema(schema) {
|
|
71
|
+
return schema.kind === 'list';
|
|
72
|
+
}
|
|
67
73
|
};
|
|
68
74
|
})();
|
|
69
75
|
export { ListAction };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListAction.js","sourceRoot":"","sources":["../../../../src/modeling/actions/ListAction.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAyB9D;;;GAGG;IACU,UAAU;sBAAS,MAAM;;;;;;;;;;;;;iBAAzB,UAAW,SAAQ,WAAM;;;gCACnC,QAAQ,EAAE;sCACV,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;4CACxB,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;0CACxB,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;YAHb,iKAAkB,IAAI,6BAAJ,IAAI,mFAAQ;YAChB,mLAAS,UAAU,6BAAV,UAAU,+FAAoB;YACvC,qMAAS,gBAAgB,6BAAhB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"ListAction.js","sourceRoot":"","sources":["../../../../src/modeling/actions/ListAction.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAyB9D;;;GAGG;IACU,UAAU;sBAAS,MAAM;;;;;;;;;;;;;iBAAzB,UAAW,SAAQ,WAAM;;;gCACnC,QAAQ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MAAM;YACb,OAAO;gBACL,GAAI,KAAK,CAAC,MAAM,EAAuB;gBACvC,UAAU,EAAE,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAuB;gBAC/E,gBAAgB,EAAE,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAa;gBACjF,cAAc,EAAE,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,CAAa;aAC9E,CAAA;QACH,CAAC;QAED,MAAM,CAAC,YAAY,CAAC,MAAc;YAChC,OAAO,MAAM,CAAC,IAAI,KAAK,MAAM,CAAA;QAC/B,CAAC;QAED,MAAM,CAAC,kBAAkB,CAAC,MAAoB;YAC5C,OAAO,MAAM,CAAC,IAAI,KAAK,MAAM,CAAA;QAC/B,CAAC;;;SAjCU,UAAU","sourcesContent":["import type { PaginationStrategy } from '../types.js'\nimport { Action, type ActionSchema } from './Action.js'\nimport { observed, toRaw } from '../../decorators/observed.js'\n\n/**\n * Enables retrieving a collection of resources.\n * Endpoint: GET /[entity-collection-name]\n */\nexport interface ListActionSchema extends ActionSchema {\n kind: 'list'\n /**\n * The pagination strategy used for this action.\n * This defines how the results are paginated when retrieving a collection of resources.\n * It can be either 'cursor' or 'offset'.\n */\n pagination: PaginationStrategy\n /**\n * Fields from the entity that can be used for filtering.\n * Must be marked as \"indexable\" in the Data Model.\n */\n filterableFields: string[]\n /**\n * Fields from the entity that can be used for sorting.\n */\n sortableFields: string[]\n}\n\n/**\n * Enables retrieving a collection of resources.\n * Endpoint: GET /[entity-collection-name]\n */\nexport class ListAction extends Action implements ListActionSchema {\n @observed() override accessor kind: 'list'\n @observed({ deep: true }) accessor pagination: PaginationStrategy\n @observed({ deep: true }) accessor filterableFields: string[] = []\n @observed({ deep: true }) accessor sortableFields: string[] = []\n\n constructor(state: Partial<ListActionSchema> = {}) {\n super(state)\n this.kind = state.kind || 'list'\n this.pagination = state.pagination\n ? { ...state.pagination }\n : {\n kind: 'offset',\n }\n this.filterableFields = state.filterableFields ? [...state.filterableFields] : []\n this.sortableFields = state.sortableFields ? [...state.sortableFields] : []\n }\n\n override toJSON(): ListActionSchema {\n return {\n ...(super.toJSON() as ListActionSchema),\n pagination: structuredClone(toRaw(this, this.pagination)) as PaginationStrategy,\n filterableFields: structuredClone(toRaw(this, this.filterableFields)) as string[],\n sortableFields: structuredClone(toRaw(this, this.sortableFields)) as string[],\n }\n }\n\n static isListAction(action: Action): action is ListAction {\n return action.kind === 'list'\n }\n\n static isListActionSchema(schema: ActionSchema): schema is ListActionSchema {\n return schema.kind === 'list'\n }\n}\n"]}
|
|
@@ -14,5 +14,7 @@ export declare class ReadAction extends Action implements ReadActionSchema {
|
|
|
14
14
|
accessor kind: 'read';
|
|
15
15
|
constructor(state?: Partial<ReadActionSchema>);
|
|
16
16
|
toJSON(): ReadActionSchema;
|
|
17
|
+
static isReadAction(action: Action): action is ReadAction;
|
|
18
|
+
static isReadActionSchema(schema: ActionSchema): schema is ReadActionSchema;
|
|
17
19
|
}
|
|
18
20
|
//# sourceMappingURL=ReadAction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadAction.d.ts","sourceRoot":"","sources":["../../../../src/modeling/actions/ReadAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAGvD;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,IAAI,EAAE,MAAM,CAAA;CAGb;AAED;;;GAGG;AACH,qBAAa,UAAW,SAAQ,MAAO,YAAW,gBAAgB;IAChE,SAA8B,IAAI,EAAE,MAAM,CAAA;gBAE9B,KAAK,GAAE,OAAO,CAAC,gBAAgB,CAAM;IAKxC,MAAM,IAAI,gBAAgB;
|
|
1
|
+
{"version":3,"file":"ReadAction.d.ts","sourceRoot":"","sources":["../../../../src/modeling/actions/ReadAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAGvD;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,IAAI,EAAE,MAAM,CAAA;CAGb;AAED;;;GAGG;AACH,qBAAa,UAAW,SAAQ,MAAO,YAAW,gBAAgB;IAChE,SAA8B,IAAI,EAAE,MAAM,CAAA;gBAE9B,KAAK,GAAE,OAAO,CAAC,gBAAgB,CAAM;IAKxC,MAAM,IAAI,gBAAgB;IAOnC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,UAAU;IAIzD,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,gBAAgB;CAG5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadAction.js","sourceRoot":"","sources":["../../../../src/modeling/actions/ReadAction.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAYvD;;;GAGG;IACU,UAAU;sBAAS,MAAM;;;;iBAAzB,UAAW,SAAQ,WAAM;;;gCACnC,QAAQ,EAAE;YAAC,iKAAkB,IAAI,6BAAJ,IAAI,mFAAQ;;;QAA9B,6EAA8B;QAA9B,IAAkB,IAAI,0CAAQ;QAA9B,IAAkB,IAAI,gDAAQ;QAE1C,YAAY,QAAmC,EAAE;YAC/C,KAAK,CAAC,KAAK,CAAC,CAAA;;YACZ,IAAI,CAAC,IAAI,GAAG,MAAM,CAAA;SACnB;QAEQ,MAAM;YACb,OAAO;gBACL,GAAI,KAAK,CAAC,MAAM,EAAuB;gBACvC,IAAI,EAAE,MAAM;aACb,CAAA;QACH,CAAC;;;
|
|
1
|
+
{"version":3,"file":"ReadAction.js","sourceRoot":"","sources":["../../../../src/modeling/actions/ReadAction.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAYvD;;;GAGG;IACU,UAAU;sBAAS,MAAM;;;;iBAAzB,UAAW,SAAQ,WAAM;;;gCACnC,QAAQ,EAAE;YAAC,iKAAkB,IAAI,6BAAJ,IAAI,mFAAQ;;;QAA9B,6EAA8B;QAA9B,IAAkB,IAAI,0CAAQ;QAA9B,IAAkB,IAAI,gDAAQ;QAE1C,YAAY,QAAmC,EAAE;YAC/C,KAAK,CAAC,KAAK,CAAC,CAAA;;YACZ,IAAI,CAAC,IAAI,GAAG,MAAM,CAAA;SACnB;QAEQ,MAAM;YACb,OAAO;gBACL,GAAI,KAAK,CAAC,MAAM,EAAuB;gBACvC,IAAI,EAAE,MAAM;aACb,CAAA;QACH,CAAC;QAED,MAAM,CAAC,YAAY,CAAC,MAAc;YAChC,OAAO,MAAM,CAAC,IAAI,KAAK,MAAM,CAAA;QAC/B,CAAC;QAED,MAAM,CAAC,kBAAkB,CAAC,MAAoB;YAC5C,OAAO,MAAM,CAAC,IAAI,KAAK,MAAM,CAAA;QAC/B,CAAC;;;SArBU,UAAU","sourcesContent":["import { Action, type ActionSchema } from './Action.js'\nimport { observed } from '../../decorators/observed.js'\n\n/**\n * Enables retrieving a single resource by its ID.\n * Endpoint: GET /[entity-collection-name]/{id}\n */\nexport interface ReadActionSchema extends ActionSchema {\n kind: 'read'\n // Association handling (Link IDs vs. Embed) is defined on the\n // data association itself in the Data Modeler.\n}\n\n/**\n * Enables retrieving a single resource by its ID.\n * Endpoint: GET /[entity-collection-name]/{id}\n */\nexport class ReadAction extends Action implements ReadActionSchema {\n @observed() override accessor kind: 'read'\n\n constructor(state: Partial<ReadActionSchema> = {}) {\n super(state)\n this.kind = 'read'\n }\n\n override toJSON(): ReadActionSchema {\n return {\n ...(super.toJSON() as ReadActionSchema),\n kind: 'read',\n }\n }\n\n static isReadAction(action: Action): action is ReadAction {\n return action.kind === 'read'\n }\n\n static isReadActionSchema(schema: ActionSchema): schema is ReadActionSchema {\n return schema.kind === 'read'\n }\n}\n"]}
|
|
@@ -20,5 +20,7 @@ export declare class SearchAction extends Action implements SearchActionSchema {
|
|
|
20
20
|
accessor fields: string[];
|
|
21
21
|
constructor(state?: Partial<SearchActionSchema>);
|
|
22
22
|
toJSON(): SearchActionSchema;
|
|
23
|
+
static isSearchActionSchema(schema: ActionSchema): schema is SearchActionSchema;
|
|
24
|
+
static isSearchAction(action: Action): action is SearchAction;
|
|
23
25
|
}
|
|
24
26
|
//# sourceMappingURL=SearchAction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchAction.d.ts","sourceRoot":"","sources":["../../../../src/modeling/actions/SearchAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAGvD;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,IAAI,EAAE,QAAQ,CAAA;IACd;;;OAGG;IACH,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB;AAED;;;GAGG;AACH,qBAAa,YAAa,SAAQ,MAAO,YAAW,kBAAkB;IACpE,SAA8B,IAAI,EAAE,QAAQ,CAAA;IAClB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAA;gBAEvC,KAAK,GAAE,OAAO,CAAC,kBAAkB,CAAM;IAM1C,MAAM,IAAI,kBAAkB;
|
|
1
|
+
{"version":3,"file":"SearchAction.d.ts","sourceRoot":"","sources":["../../../../src/modeling/actions/SearchAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAGvD;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,IAAI,EAAE,QAAQ,CAAA;IACd;;;OAGG;IACH,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB;AAED;;;GAGG;AACH,qBAAa,YAAa,SAAQ,MAAO,YAAW,kBAAkB;IACpE,SAA8B,IAAI,EAAE,QAAQ,CAAA;IAClB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAA;gBAEvC,KAAK,GAAE,OAAO,CAAC,kBAAkB,CAAM;IAM1C,MAAM,IAAI,kBAAkB;IAQrC,MAAM,CAAC,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,kBAAkB;IAI/E,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,YAAY;CAG9D"}
|
|
@@ -41,6 +41,12 @@ let SearchAction = (() => {
|
|
|
41
41
|
fields: structuredClone(toRaw(this, this.fields)),
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
+
static isSearchActionSchema(schema) {
|
|
45
|
+
return schema.kind === 'search';
|
|
46
|
+
}
|
|
47
|
+
static isSearchAction(action) {
|
|
48
|
+
return action.kind === 'search';
|
|
49
|
+
}
|
|
44
50
|
};
|
|
45
51
|
})();
|
|
46
52
|
export { SearchAction };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchAction.js","sourceRoot":"","sources":["../../../../src/modeling/actions/SearchAction.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAe9D;;;GAGG;IACU,YAAY;sBAAS,MAAM;;;;;;;iBAA3B,YAAa,SAAQ,WAAM;;;gCACrC,QAAQ,EAAE;kCACV,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;YADb,iKAAkB,IAAI,6BAAJ,IAAI,mFAAU;YAClB,uKAAS,MAAM,6BAAN,MAAM,uFAAU;;;QADvC,6EAAgC;QAAhC,IAAkB,IAAI,0CAAU;QAAhC,IAAkB,IAAI,gDA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AK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;SACpD;QAEQ,MAAM;YACb,OAAO;gBACL,GAAI,KAAK,CAAC,MAAM,EAAyB;gBACzC,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAa;aAC9D,CAAA;QACH,CAAC;QAED,MAAM,CAAC,oBAAoB,CAAC,MAAoB;YAC9C,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAA;QACjC,CAAC;QAED,MAAM,CAAC,cAAc,CAAC,MAAc;YAClC,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAA;QACjC,CAAC;;;SAxBU,YAAY","sourcesContent":["import { Action, type ActionSchema } from './Action.js'\nimport { observed, toRaw } from '../../decorators/observed.js'\n\n/**\n * Enables keyword-based search across specified fields.\n * Endpoint: GET /[entity-collection-name]/search\n */\nexport interface SearchActionSchema extends ActionSchema {\n kind: 'search'\n /**\n * The fields within the entity to be included in the search scope.\n * Must be \"indexable\" and typically text-based.\n */\n fields: string[]\n}\n\n/**\n * Enables keyword-based search across specified fields.\n * Endpoint: GET /[entity-collection-name]/search\n */\nexport class SearchAction extends Action implements SearchActionSchema {\n @observed() override accessor kind: 'search'\n @observed({ deep: true }) accessor fields: string[]\n\n constructor(state: Partial<SearchActionSchema> = {}) {\n super(state)\n this.kind = 'search'\n this.fields = state.fields ? [...state.fields] : []\n }\n\n override toJSON(): SearchActionSchema {\n return {\n ...(super.toJSON() as SearchActionSchema),\n kind: 'search',\n fields: structuredClone(toRaw(this, this.fields)) as string[],\n }\n }\n\n static isSearchActionSchema(schema: ActionSchema): schema is SearchActionSchema {\n return schema.kind === 'search'\n }\n\n static isSearchAction(action: Action): action is SearchAction {\n return action.kind === 'search'\n }\n}\n"]}
|
|
@@ -23,5 +23,7 @@ export declare class UpdateAction extends Action implements UpdateActionSchema {
|
|
|
23
23
|
accessor allowedMethods: ('PUT' | 'PATCH')[];
|
|
24
24
|
constructor(state?: Partial<UpdateActionSchema>);
|
|
25
25
|
toJSON(): UpdateActionSchema;
|
|
26
|
+
static isUpdateAction(action: Action): action is UpdateAction;
|
|
27
|
+
static isUpdateActionSchema(schema: ActionSchema): schema is UpdateActionSchema;
|
|
26
28
|
}
|
|
27
29
|
//# sourceMappingURL=UpdateAction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateAction.d.ts","sourceRoot":"","sources":["../../../../src/modeling/actions/UpdateAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAGvD;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,IAAI,EAAE,QAAQ,CAAA;IACd;;;;;;OAMG;IACH,cAAc,EAAE,CAAC,KAAK,GAAG,OAAO,CAAC,EAAE,CAAA;CACpC;AAED;;;GAGG;AACH,qBAAa,YAAa,SAAQ,MAAO,YAAW,kBAAkB;IACpE,SAA8B,IAAI,EAAE,QAAQ,CAAA;IAClB,QAAQ,CAAC,cAAc,EAAE,CAAC,KAAK,GAAG,OAAO,CAAC,EAAE,CAAA;gBAE1D,KAAK,GAAE,OAAO,CAAC,kBAAkB,CAAM;IAM1C,MAAM,IAAI,kBAAkB;
|
|
1
|
+
{"version":3,"file":"UpdateAction.d.ts","sourceRoot":"","sources":["../../../../src/modeling/actions/UpdateAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAGvD;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,IAAI,EAAE,QAAQ,CAAA;IACd;;;;;;OAMG;IACH,cAAc,EAAE,CAAC,KAAK,GAAG,OAAO,CAAC,EAAE,CAAA;CACpC;AAED;;;GAGG;AACH,qBAAa,YAAa,SAAQ,MAAO,YAAW,kBAAkB;IACpE,SAA8B,IAAI,EAAE,QAAQ,CAAA;IAClB,QAAQ,CAAC,cAAc,EAAE,CAAC,KAAK,GAAG,OAAO,CAAC,EAAE,CAAA;gBAE1D,KAAK,GAAE,OAAO,CAAC,kBAAkB,CAAM;IAM1C,MAAM,IAAI,kBAAkB;IAQrC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,YAAY;IAI7D,MAAM,CAAC,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,kBAAkB;CAGhF"}
|
|
@@ -41,6 +41,12 @@ let UpdateAction = (() => {
|
|
|
41
41
|
allowedMethods: structuredClone(toRaw(this, this.allowedMethods)),
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
+
static isUpdateAction(action) {
|
|
45
|
+
return action.kind === 'update';
|
|
46
|
+
}
|
|
47
|
+
static isUpdateActionSchema(schema) {
|
|
48
|
+
return schema.kind === 'update';
|
|
49
|
+
}
|
|
44
50
|
};
|
|
45
51
|
})();
|
|
46
52
|
export { UpdateAction };
|
|
@@ -1 +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,IAA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AA;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;QAED,MAAM,CAAC,cAAc,CAAC,MAAc;YAClC,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAA;QACjC,CAAC;QAED,MAAM,CAAC,oBAAoB,CAAC,MAAoB;YAC9C,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAA;QACjC,CAAC;;;SAxBU,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 static isUpdateAction(action: Action): action is UpdateAction {\n return action.kind === 'update'\n }\n\n static isUpdateActionSchema(schema: ActionSchema): schema is UpdateActionSchema {\n return schema.kind === 'update'\n }\n}\n"]}
|
|
@@ -5,6 +5,7 @@ import { ListAction, type ListActionSchema } from './ListAction.js';
|
|
|
5
5
|
import { ReadAction, type ReadActionSchema } from './ReadAction.js';
|
|
6
6
|
import { SearchAction, type SearchActionSchema } from './SearchAction.js';
|
|
7
7
|
import { UpdateAction, type UpdateActionSchema } from './UpdateAction.js';
|
|
8
|
+
import type { ActionSchema } from './Action.js';
|
|
8
9
|
export { CreateAction, DeleteAction, ListAction, ReadAction, SearchAction, UpdateAction };
|
|
9
10
|
export type { CreateActionSchema, DeleteActionSchema, ListActionSchema, ReadActionSchema, SearchActionSchema, UpdateActionSchema, };
|
|
10
11
|
/**
|
|
@@ -21,4 +22,13 @@ export type ApiActionSchema = CreateActionSchema | DeleteActionSchema | ListActi
|
|
|
21
22
|
* The kind of action to perform.
|
|
22
23
|
*/
|
|
23
24
|
export type ActionKind = 'list' | 'read' | 'create' | 'update' | 'delete' | 'search';
|
|
25
|
+
/**
|
|
26
|
+
* Restores an action from a schema.
|
|
27
|
+
*
|
|
28
|
+
* It is a helper function to restore actions from schema.
|
|
29
|
+
*
|
|
30
|
+
* @param schema The schema to restore the action from.
|
|
31
|
+
* @returns The restored action.
|
|
32
|
+
*/
|
|
33
|
+
export declare function restoreAction(schema: ActionSchema): ApiAction;
|
|
24
34
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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,KAA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,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,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,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;AAEpF;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAoB7D"}
|
|
@@ -5,5 +5,35 @@ import { ListAction } from './ListAction.js';
|
|
|
5
5
|
import { ReadAction } from './ReadAction.js';
|
|
6
6
|
import { SearchAction } from './SearchAction.js';
|
|
7
7
|
import { UpdateAction } from './UpdateAction.js';
|
|
8
|
+
import { Exception } from '../../exceptions/exception.js';
|
|
8
9
|
export { CreateAction, DeleteAction, ListAction, ReadAction, SearchAction, UpdateAction };
|
|
10
|
+
/**
|
|
11
|
+
* Restores an action from a schema.
|
|
12
|
+
*
|
|
13
|
+
* It is a helper function to restore actions from schema.
|
|
14
|
+
*
|
|
15
|
+
* @param schema The schema to restore the action from.
|
|
16
|
+
* @returns The restored action.
|
|
17
|
+
*/
|
|
18
|
+
export function restoreAction(schema) {
|
|
19
|
+
switch (schema.kind) {
|
|
20
|
+
case 'list':
|
|
21
|
+
return new ListAction(schema);
|
|
22
|
+
case 'read':
|
|
23
|
+
return new ReadAction(schema);
|
|
24
|
+
case 'create':
|
|
25
|
+
return new CreateAction(schema);
|
|
26
|
+
case 'update':
|
|
27
|
+
return new UpdateAction(schema);
|
|
28
|
+
case 'delete':
|
|
29
|
+
return new DeleteAction(schema);
|
|
30
|
+
case 'search':
|
|
31
|
+
return new SearchAction(schema);
|
|
32
|
+
default:
|
|
33
|
+
throw new Exception('Unknown action kind', {
|
|
34
|
+
code: 'E_UNKNOWN_ACTION_KIND',
|
|
35
|
+
status: 422,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
9
39
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +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;
|
|
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;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAGzD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,CAAA;AAiCzF;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,MAAoB;IAChD,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,MAAM;YACT,OAAO,IAAI,UAAU,CAAC,MAA0B,CAAC,CAAA;QACnD,KAAK,MAAM;YACT,OAAO,IAAI,UAAU,CAAC,MAA0B,CAAC,CAAA;QACnD,KAAK,QAAQ;YACX,OAAO,IAAI,YAAY,CAAC,MAA4B,CAAC,CAAA;QACvD,KAAK,QAAQ;YACX,OAAO,IAAI,YAAY,CAAC,MAA4B,CAAC,CAAA;QACvD,KAAK,QAAQ;YACX,OAAO,IAAI,YAAY,CAAC,MAA4B,CAAC,CAAA;QACvD,KAAK,QAAQ;YACX,OAAO,IAAI,YAAY,CAAC,MAA4B,CAAC,CAAA;QACvD;YACE,MAAM,IAAI,SAAS,CAAC,qBAAqB,EAAE;gBACzC,IAAI,EAAE,uBAAuB;gBAC7B,MAAM,EAAE,GAAG;aACZ,CAAC,CAAA;IACN,CAAC;AACH,CAAC","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'\nimport { Exception } from '../../exceptions/exception.js'\nimport type { ActionSchema } from './Action.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\n/**\n * Restores an action from a schema.\n *\n * It is a helper function to restore actions from schema.\n *\n * @param schema The schema to restore the action from.\n * @returns The restored action.\n */\nexport function restoreAction(schema: ActionSchema): ApiAction {\n switch (schema.kind) {\n case 'list':\n return new ListAction(schema as ListActionSchema)\n case 'read':\n return new ReadAction(schema as ReadActionSchema)\n case 'create':\n return new CreateAction(schema as CreateActionSchema)\n case 'update':\n return new UpdateAction(schema as UpdateActionSchema)\n case 'delete':\n return new DeleteAction(schema as DeleteActionSchema)\n case 'search':\n return new SearchAction(schema as SearchActionSchema)\n default:\n throw new Exception('Unknown action kind', {\n code: 'E_UNKNOWN_ACTION_KIND',\n status: 422,\n })\n }\n}\n"]}
|
|
@@ -5,7 +5,7 @@ import { AccessRule, type AccessRuleSchema } from './AccessRule.js';
|
|
|
5
5
|
* It is used for resources that should be accessible to all logged-in users.
|
|
6
6
|
*/
|
|
7
7
|
export interface AllowAuthenticatedAccessRuleSchema extends AccessRuleSchema {
|
|
8
|
-
type: '
|
|
8
|
+
type: 'allowAuthenticated';
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* The action is allowed for any authenticated user.
|
|
@@ -13,7 +13,7 @@ export interface AllowAuthenticatedAccessRuleSchema extends AccessRuleSchema {
|
|
|
13
13
|
* It is used for resources that should be accessible to all logged-in users.
|
|
14
14
|
*/
|
|
15
15
|
export declare class AllowAuthenticatedAccessRule extends AccessRule implements AllowAuthenticatedAccessRuleSchema {
|
|
16
|
-
readonly type: '
|
|
16
|
+
readonly type: 'allowAuthenticated';
|
|
17
17
|
constructor(state?: Partial<AllowAuthenticatedAccessRuleSchema>);
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=AllowAuthenticated.d.ts.map
|
|
@@ -1 +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,
|
|
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,oBAAoB,CAAA;CAC3B;AAED;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,UAAW,YAAW,kCAAkC;IACxG,SAAkB,IAAI,EAAE,oBAAoB,CAAA;gBAEhC,KAAK,GAAE,OAAO,CAAC,kCAAkC,CAAM;CAIpE"}
|
|
@@ -1 +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,
|
|
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,CAAsB;IAE5C,YAAY,QAAqD,EAAE;QACjE,KAAK,CAAC,KAAK,CAAC,CAAA;QACZ,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAA;IAClC,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: 'allowAuthenticated'\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: 'allowAuthenticated'\n\n constructor(state: Partial<AllowAuthenticatedAccessRuleSchema> = {}) {\n super(state)\n this.type = 'allowAuthenticated'\n }\n}\n"]}
|
|
@@ -5,7 +5,7 @@ import { AccessRule, type AccessRuleSchema } from './AccessRule.js';
|
|
|
5
5
|
* It is the most permissive rule and should be used with caution.
|
|
6
6
|
*/
|
|
7
7
|
export interface AllowPublicAccessRuleSchema extends AccessRuleSchema {
|
|
8
|
-
type: '
|
|
8
|
+
type: 'allowPublic';
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* The action is allowed for all users, including unauthenticated ones.
|
|
@@ -13,7 +13,7 @@ export interface AllowPublicAccessRuleSchema extends AccessRuleSchema {
|
|
|
13
13
|
* It is the most permissive rule and should be used with caution.
|
|
14
14
|
*/
|
|
15
15
|
export declare class AllowPublicAccessRule extends AccessRule implements AllowPublicAccessRuleSchema {
|
|
16
|
-
readonly type: '
|
|
16
|
+
readonly type: 'allowPublic';
|
|
17
17
|
constructor(state?: Partial<AllowPublicAccessRuleSchema>);
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=AllowPublic.d.ts.map
|
|
@@ -1 +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,
|
|
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,aAAa,CAAA;CACpB;AAED;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,UAAW,YAAW,2BAA2B;IAC1F,SAAkB,IAAI,EAAE,aAAa,CAAA;gBAEzB,KAAK,GAAE,OAAO,CAAC,2BAA2B,CAAM;CAI7D"}
|
|
@@ -1 +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,
|
|
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,CAAe;IAErC,YAAY,QAA8C,EAAE;QAC1D,KAAK,CAAC,KAAK,CAAC,CAAA;QACZ,IAAI,CAAC,IAAI,GAAG,aAAa,CAAA;IAC3B,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: 'allowPublic'\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: 'allowPublic'\n\n constructor(state: Partial<AllowPublicAccessRuleSchema> = {}) {\n super(state)\n this.type = 'allowPublic'\n }\n}\n"]}
|
|
@@ -5,7 +5,7 @@ import { AccessRule, type AccessRuleSchema } from './AccessRule.js';
|
|
|
5
5
|
* For example, a user can only access their own profile or documents.
|
|
6
6
|
*/
|
|
7
7
|
export interface MatchResourceOwnerAccessRuleSchema extends AccessRuleSchema {
|
|
8
|
-
type: '
|
|
8
|
+
type: 'matchResourceOwner';
|
|
9
9
|
/**
|
|
10
10
|
* The property on the resource that should match the authenticated user's ID.
|
|
11
11
|
* This is typically the ID of the user who owns the resource.
|
|
@@ -21,7 +21,7 @@ export interface MatchResourceOwnerAccessRuleSchema extends AccessRuleSchema {
|
|
|
21
21
|
* For example, a user can only access their own profile or documents.
|
|
22
22
|
*/
|
|
23
23
|
export declare class MatchResourceOwnerAccessRule extends AccessRule implements MatchResourceOwnerAccessRuleSchema {
|
|
24
|
-
readonly type: '
|
|
24
|
+
readonly type: 'matchResourceOwner';
|
|
25
25
|
accessor property: string;
|
|
26
26
|
constructor(state?: Partial<MatchResourceOwnerAccessRuleSchema>);
|
|
27
27
|
toJSON(): MatchResourceOwnerAccessRuleSchema;
|
|
@@ -1 +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,
|
|
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,oBAAoB,CAAA;IAC1B;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,UAAW,YAAW,kCAAkC;IACxG,SAAkB,IAAI,EAAE,oBAAoB,CAAA;IAEhC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;gBAEzB,KAAK,GAAE,OAAO,CAAC,kCAAkC,CAAM;IAM1D,MAAM,IAAI,kCAAkC;CAMtD"}
|
|
@@ -25,7 +25,7 @@ let MatchResourceOwnerAccessRule = (() => {
|
|
|
25
25
|
constructor(state = {}) {
|
|
26
26
|
super(state);
|
|
27
27
|
__runInitializers(this, _property_extraInitializers);
|
|
28
|
-
this.type = '
|
|
28
|
+
this.type = 'matchResourceOwner';
|
|
29
29
|
this.property = state.property ?? '';
|
|
30
30
|
}
|
|
31
31
|
toJSON() {
|
|
@@ -1 +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,
|
|
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,CAAsB;QAEhC,qFAAyB;QAAzB,IAAS,QAAQ,8CAAQ;QAAzB,IAAS,QAAQ,oDAAQ;QAErC,YAAY,QAAqD,EAAE;YACjE,KAAK,CAAC,KAAK,CAAC,CAAA;;YACZ,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAA;YAChC,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: 'matchResourceOwner'\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: 'matchResourceOwner'\n\n @observed() accessor property: string\n\n constructor(state: Partial<MatchResourceOwnerAccessRuleSchema> = {}) {\n super(state)\n this.type = 'matchResourceOwner'\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"]}
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
export { AccessRule, type AccessRuleSchema } from './AccessRule.js';
|
|
2
2
|
export { RateLimitingConfiguration, type RateLimitingConfigurationSchema } from './RateLimitingConfiguration.js';
|
|
3
|
+
import { AccessRuleSchema } from './AccessRule.js';
|
|
3
4
|
import { AllowAuthenticatedAccessRule, type AllowAuthenticatedAccessRuleSchema } from './AllowAuthenticated.js';
|
|
4
5
|
import { AllowPublicAccessRule, type AllowPublicAccessRuleSchema } from './AllowPublic.js';
|
|
5
6
|
import { MatchEmailDomainAccessRule, type MatchEmailDomainAccessRuleSchema } from './MatchEmailDomain.js';
|
|
6
7
|
import { MatchResourceOwnerAccessRule, type MatchResourceOwnerAccessRuleSchema } from './MatchResourceOwner.js';
|
|
7
8
|
import { MatchUserPropertyAccessRule, type MatchUserPropertyAccessRuleSchema } from './MatchUserProperty.js';
|
|
8
9
|
import { MatchUserRoleAccessRule, type MatchUserRoleAccessRuleSchema } from './MatchUserRole.js';
|
|
9
|
-
|
|
10
|
-
export
|
|
10
|
+
import { RateLimitRule, type RateLimitRuleSchema } from './RateLimitRule.js';
|
|
11
|
+
export { AllowAuthenticatedAccessRule, AllowPublicAccessRule, MatchEmailDomainAccessRule, MatchResourceOwnerAccessRule, MatchUserPropertyAccessRule, MatchUserRoleAccessRule, RateLimitRule, };
|
|
12
|
+
export type { AllowAuthenticatedAccessRuleSchema, AllowPublicAccessRuleSchema, MatchEmailDomainAccessRuleSchema, MatchResourceOwnerAccessRuleSchema, MatchUserPropertyAccessRuleSchema, MatchUserRoleAccessRuleSchema, RateLimitRuleSchema, };
|
|
11
13
|
export type ApiAccessRule = AllowAuthenticatedAccessRule | AllowPublicAccessRule | MatchEmailDomainAccessRule | MatchResourceOwnerAccessRule | MatchUserPropertyAccessRule | MatchUserRoleAccessRule;
|
|
12
14
|
export type ApiAccessRuleSchema = AllowAuthenticatedAccessRuleSchema | AllowPublicAccessRuleSchema | MatchEmailDomainAccessRuleSchema | MatchResourceOwnerAccessRuleSchema | MatchUserPropertyAccessRuleSchema | MatchUserRoleAccessRuleSchema;
|
|
15
|
+
export type RuleType = 'allowAuthenticated' | 'allowPublic' | 'matchEmailDomain' | 'matchResourceOwner' | 'matchUserProperty' | 'matchUserRole';
|
|
16
|
+
/**
|
|
17
|
+
* Restores an access rule from a schema.
|
|
18
|
+
*
|
|
19
|
+
* It is a helper function to restore access rules from a schema.
|
|
20
|
+
*
|
|
21
|
+
* @param schema The schema to restore the access rule from.
|
|
22
|
+
* @returns The restored access rule.
|
|
23
|
+
*/
|
|
24
|
+
export declare function restoreAccessRule(schema: AccessRuleSchema): ApiAccessRule;
|
|
13
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modeling/rules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,yBAAyB,EAAE,KAAK,+BAA+B,EAAE,MAAM,gCAAgC,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modeling/rules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,yBAAyB,EAAE,KAAK,+BAA+B,EAAE,MAAM,gCAAgC,CAAA;AAEhH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,4BAA4B,EAAE,KAAK,kCAAkC,EAAE,MAAM,yBAAyB,CAAA;AAC/G,OAAO,EAAE,qBAAqB,EAAE,KAAK,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AAC1F,OAAO,EAAE,0BAA0B,EAAE,KAAK,gCAAgC,EAAE,MAAM,uBAAuB,CAAA;AACzG,OAAO,EAAE,4BAA4B,EAAE,KAAK,kCAAkC,EAAE,MAAM,yBAAyB,CAAA;AAC/G,OAAO,EAAE,2BAA2B,EAAE,KAAK,iCAAiC,EAAE,MAAM,wBAAwB,CAAA;AAC5G,OAAO,EAAE,uBAAuB,EAAE,KAAK,6BAA6B,EAAE,MAAM,oBAAoB,CAAA;AAChG,OAAO,EAAE,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE5E,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,EACrB,0BAA0B,EAC1B,4BAA4B,EAC5B,2BAA2B,EAC3B,uBAAuB,EACvB,aAAa,GACd,CAAA;AACD,YAAY,EACV,kCAAkC,EAClC,2BAA2B,EAC3B,gCAAgC,EAChC,kCAAkC,EAClC,iCAAiC,EACjC,6BAA6B,EAC7B,mBAAmB,GACpB,CAAA;AAED,MAAM,MAAM,aAAa,GACrB,4BAA4B,GAC5B,qBAAqB,GACrB,0BAA0B,GAC1B,4BAA4B,GAC5B,2BAA2B,GAC3B,uBAAuB,CAAA;AAC3B,MAAM,MAAM,mBAAmB,GAC3B,kCAAkC,GAClC,2BAA2B,GAC3B,gCAAgC,GAChC,kCAAkC,GAClC,iCAAiC,GACjC,6BAA6B,CAAA;AAEjC,MAAM,MAAM,QAAQ,GAChB,oBAAoB,GACpB,aAAa,GACb,kBAAkB,GAClB,oBAAoB,GACpB,mBAAmB,GACnB,eAAe,CAAA;AAEnB;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,aAAa,CAoBzE"}
|
|
@@ -1,10 +1,41 @@
|
|
|
1
1
|
export { AccessRule } from './AccessRule.js';
|
|
2
2
|
export { RateLimitingConfiguration } from './RateLimitingConfiguration.js';
|
|
3
|
+
import { Exception } from '../../exceptions/exception.js';
|
|
3
4
|
import { AllowAuthenticatedAccessRule } from './AllowAuthenticated.js';
|
|
4
5
|
import { AllowPublicAccessRule } from './AllowPublic.js';
|
|
5
6
|
import { MatchEmailDomainAccessRule } from './MatchEmailDomain.js';
|
|
6
7
|
import { MatchResourceOwnerAccessRule } from './MatchResourceOwner.js';
|
|
7
8
|
import { MatchUserPropertyAccessRule } from './MatchUserProperty.js';
|
|
8
9
|
import { MatchUserRoleAccessRule } from './MatchUserRole.js';
|
|
9
|
-
|
|
10
|
+
import { RateLimitRule } from './RateLimitRule.js';
|
|
11
|
+
export { AllowAuthenticatedAccessRule, AllowPublicAccessRule, MatchEmailDomainAccessRule, MatchResourceOwnerAccessRule, MatchUserPropertyAccessRule, MatchUserRoleAccessRule, RateLimitRule, };
|
|
12
|
+
/**
|
|
13
|
+
* Restores an access rule from a schema.
|
|
14
|
+
*
|
|
15
|
+
* It is a helper function to restore access rules from a schema.
|
|
16
|
+
*
|
|
17
|
+
* @param schema The schema to restore the access rule from.
|
|
18
|
+
* @returns The restored access rule.
|
|
19
|
+
*/
|
|
20
|
+
export function restoreAccessRule(schema) {
|
|
21
|
+
switch (schema.type) {
|
|
22
|
+
case 'allowAuthenticated':
|
|
23
|
+
return new AllowAuthenticatedAccessRule(schema);
|
|
24
|
+
case 'allowPublic':
|
|
25
|
+
return new AllowPublicAccessRule(schema);
|
|
26
|
+
case 'matchEmailDomain':
|
|
27
|
+
return new MatchEmailDomainAccessRule(schema);
|
|
28
|
+
case 'matchResourceOwner':
|
|
29
|
+
return new MatchResourceOwnerAccessRule(schema);
|
|
30
|
+
case 'matchUserProperty':
|
|
31
|
+
return new MatchUserPropertyAccessRule(schema);
|
|
32
|
+
case 'matchUserRole':
|
|
33
|
+
return new MatchUserRoleAccessRule(schema);
|
|
34
|
+
default:
|
|
35
|
+
throw new Exception('Unknown access rule kind', {
|
|
36
|
+
code: 'E_UNKNOWN_ACCESS_RULE_KIND',
|
|
37
|
+
status: 422,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
10
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modeling/rules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,yBAAyB,EAAwC,MAAM,gCAAgC,CAAA;AAChH,OAAO,EAAE,4BAA4B,EAA2C,MAAM,yBAAyB,CAAA;AAC/G,OAAO,EAAE,qBAAqB,EAAoC,MAAM,kBAAkB,CAAA;AAC1F,OAAO,EAAE,0BAA0B,EAAyC,MA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C,CAAC,CAAA;QACnF,KAAK,oBAAoB;YACvB,OAAO,IAAI,4BAA4B,CAAC,MAA4C,CAAC,CAAA;QACvF,KAAK,mBAAmB;YACtB,OAAO,IAAI,2BAA2B,CAAC,MAA2C,CAAC,CAAA;QACrF,KAAK,eAAe;YAClB,OAAO,IAAI,uBAAuB,CAAC,MAAuC,CAAC,CAAA;QAC7E;YACE,MAAM,IAAI,SAAS,CAAC,0BAA0B,EAAE;gBAC9C,IAAI,EAAE,4BAA4B;gBAClC,MAAM,EAAE,GAAG;aACZ,CAAC,CAAA;IACN,CAAC;AACH,CAAC","sourcesContent":["export { AccessRule, type AccessRuleSchema } from './AccessRule.js'\nexport { RateLimitingConfiguration, type RateLimitingConfigurationSchema } from './RateLimitingConfiguration.js'\nimport { Exception } from '../../exceptions/exception.js'\nimport { AccessRuleSchema } from './AccessRule.js'\nimport { AllowAuthenticatedAccessRule, type AllowAuthenticatedAccessRuleSchema } from './AllowAuthenticated.js'\nimport { AllowPublicAccessRule, type AllowPublicAccessRuleSchema } from './AllowPublic.js'\nimport { MatchEmailDomainAccessRule, type MatchEmailDomainAccessRuleSchema } from './MatchEmailDomain.js'\nimport { MatchResourceOwnerAccessRule, type MatchResourceOwnerAccessRuleSchema } from './MatchResourceOwner.js'\nimport { MatchUserPropertyAccessRule, type MatchUserPropertyAccessRuleSchema } from './MatchUserProperty.js'\nimport { MatchUserRoleAccessRule, type MatchUserRoleAccessRuleSchema } from './MatchUserRole.js'\nimport { RateLimitRule, type RateLimitRuleSchema } from './RateLimitRule.js'\n\nexport {\n AllowAuthenticatedAccessRule,\n AllowPublicAccessRule,\n MatchEmailDomainAccessRule,\n MatchResourceOwnerAccessRule,\n MatchUserPropertyAccessRule,\n MatchUserRoleAccessRule,\n RateLimitRule,\n}\nexport type {\n AllowAuthenticatedAccessRuleSchema,\n AllowPublicAccessRuleSchema,\n MatchEmailDomainAccessRuleSchema,\n MatchResourceOwnerAccessRuleSchema,\n MatchUserPropertyAccessRuleSchema,\n MatchUserRoleAccessRuleSchema,\n RateLimitRuleSchema,\n}\n\nexport type ApiAccessRule =\n | AllowAuthenticatedAccessRule\n | AllowPublicAccessRule\n | MatchEmailDomainAccessRule\n | MatchResourceOwnerAccessRule\n | MatchUserPropertyAccessRule\n | MatchUserRoleAccessRule\nexport type ApiAccessRuleSchema =\n | AllowAuthenticatedAccessRuleSchema\n | AllowPublicAccessRuleSchema\n | MatchEmailDomainAccessRuleSchema\n | MatchResourceOwnerAccessRuleSchema\n | MatchUserPropertyAccessRuleSchema\n | MatchUserRoleAccessRuleSchema\n\nexport type RuleType =\n | 'allowAuthenticated'\n | 'allowPublic'\n | 'matchEmailDomain'\n | 'matchResourceOwner'\n | 'matchUserProperty'\n | 'matchUserRole'\n\n/**\n * Restores an access rule from a schema.\n *\n * It is a helper function to restore access rules from a schema.\n *\n * @param schema The schema to restore the access rule from.\n * @returns The restored access rule.\n */\nexport function restoreAccessRule(schema: AccessRuleSchema): ApiAccessRule {\n switch (schema.type) {\n case 'allowAuthenticated':\n return new AllowAuthenticatedAccessRule(schema as AllowAuthenticatedAccessRuleSchema)\n case 'allowPublic':\n return new AllowPublicAccessRule(schema as AllowPublicAccessRuleSchema)\n case 'matchEmailDomain':\n return new MatchEmailDomainAccessRule(schema as MatchEmailDomainAccessRuleSchema)\n case 'matchResourceOwner':\n return new MatchResourceOwnerAccessRule(schema as MatchResourceOwnerAccessRuleSchema)\n case 'matchUserProperty':\n return new MatchUserPropertyAccessRule(schema as MatchUserPropertyAccessRuleSchema)\n case 'matchUserRole':\n return new MatchUserRoleAccessRule(schema as MatchUserRoleAccessRuleSchema)\n default:\n throw new Exception('Unknown access rule kind', {\n code: 'E_UNKNOWN_ACCESS_RULE_KIND',\n status: 422,\n })\n }\n}\n"]}
|