@imolko/ultra-ddd 3.0.1-beta → 3.0.2-beta

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.
Files changed (99) hide show
  1. package/dist-browser/authorization/errors/authorization.error.d.ts +21 -7
  2. package/dist-browser/authorization/errors/authorization.error.d.ts.map +1 -1
  3. package/dist-browser/authorization/errors/authorization.error.js +26 -7
  4. package/dist-browser/authorization/errors/authorization.error.js.map +1 -1
  5. package/dist-browser/authorization/index.d.ts +1 -0
  6. package/dist-browser/authorization/index.d.ts.map +1 -1
  7. package/dist-browser/authorization/index.js +1 -0
  8. package/dist-browser/authorization/index.js.map +1 -1
  9. package/dist-browser/authorization/ports/authorization.port.d.ts +14 -3
  10. package/dist-browser/authorization/ports/authorization.port.d.ts.map +1 -1
  11. package/dist-browser/authorization/ports/authorization.port.js.map +1 -1
  12. package/dist-browser/authorization/resource-scope/conditions.d.ts +26 -0
  13. package/dist-browser/authorization/resource-scope/conditions.d.ts.map +1 -0
  14. package/dist-browser/authorization/resource-scope/conditions.js +27 -0
  15. package/dist-browser/authorization/resource-scope/conditions.js.map +1 -0
  16. package/dist-browser/authorization/resource-scope/definition.d.ts +23 -0
  17. package/dist-browser/authorization/resource-scope/definition.d.ts.map +1 -0
  18. package/dist-browser/authorization/resource-scope/definition.js +34 -0
  19. package/dist-browser/authorization/resource-scope/definition.js.map +1 -0
  20. package/dist-browser/authorization/resource-scope/errors.d.ts +3 -0
  21. package/dist-browser/authorization/resource-scope/errors.d.ts.map +1 -0
  22. package/dist-browser/authorization/resource-scope/errors.js +2 -0
  23. package/dist-browser/authorization/resource-scope/errors.js.map +1 -0
  24. package/dist-browser/authorization/resource-scope/index.d.ts +5 -0
  25. package/dist-browser/authorization/resource-scope/index.d.ts.map +1 -0
  26. package/dist-browser/authorization/resource-scope/index.js +2 -0
  27. package/dist-browser/authorization/resource-scope/index.js.map +1 -0
  28. package/dist-browser/authorization/resource-scope/payload.d.ts +4 -0
  29. package/dist-browser/authorization/resource-scope/payload.d.ts.map +1 -0
  30. package/dist-browser/authorization/resource-scope/payload.js +2 -0
  31. package/dist-browser/authorization/resource-scope/payload.js.map +1 -0
  32. package/dist-browser/authorization/resource-scope/primitive.d.ts +2 -0
  33. package/dist-browser/authorization/resource-scope/primitive.d.ts.map +1 -0
  34. package/dist-browser/authorization/resource-scope/primitive.js +2 -0
  35. package/dist-browser/authorization/resource-scope/primitive.js.map +1 -0
  36. package/dist-browser/authorization/resource-scope/props.d.ts +7 -0
  37. package/dist-browser/authorization/resource-scope/props.d.ts.map +1 -0
  38. package/dist-browser/authorization/resource-scope/props.js +2 -0
  39. package/dist-browser/authorization/resource-scope/props.js.map +1 -0
  40. package/dist-browser/authorization/resource-scope/value-object.d.ts +102 -0
  41. package/dist-browser/authorization/resource-scope/value-object.d.ts.map +1 -0
  42. package/dist-browser/authorization/resource-scope/value-object.js +17 -0
  43. package/dist-browser/authorization/resource-scope/value-object.js.map +1 -0
  44. package/dist-browser/authorization/secured-use-case/secured-use-case.mixin.d.ts +6 -4
  45. package/dist-browser/authorization/secured-use-case/secured-use-case.mixin.d.ts.map +1 -1
  46. package/dist-browser/authorization/secured-use-case/secured-use-case.mixin.js +93 -11
  47. package/dist-browser/authorization/secured-use-case/secured-use-case.mixin.js.map +1 -1
  48. package/dist-browser/authorization/secured-use-case/secured-use-case.types.d.ts +28 -0
  49. package/dist-browser/authorization/secured-use-case/secured-use-case.types.d.ts.map +1 -1
  50. package/dist-node/authorization/errors/authorization.error.d.ts +21 -7
  51. package/dist-node/authorization/errors/authorization.error.d.ts.map +1 -1
  52. package/dist-node/authorization/errors/authorization.error.js +26 -7
  53. package/dist-node/authorization/errors/authorization.error.js.map +1 -1
  54. package/dist-node/authorization/index.d.ts +1 -0
  55. package/dist-node/authorization/index.d.ts.map +1 -1
  56. package/dist-node/authorization/index.js +1 -0
  57. package/dist-node/authorization/index.js.map +1 -1
  58. package/dist-node/authorization/ports/authorization.port.d.ts +14 -3
  59. package/dist-node/authorization/ports/authorization.port.d.ts.map +1 -1
  60. package/dist-node/authorization/ports/authorization.port.js.map +1 -1
  61. package/dist-node/authorization/resource-scope/conditions.d.ts +26 -0
  62. package/dist-node/authorization/resource-scope/conditions.d.ts.map +1 -0
  63. package/dist-node/authorization/resource-scope/conditions.js +30 -0
  64. package/dist-node/authorization/resource-scope/conditions.js.map +1 -0
  65. package/dist-node/authorization/resource-scope/definition.d.ts +23 -0
  66. package/dist-node/authorization/resource-scope/definition.d.ts.map +1 -0
  67. package/dist-node/authorization/resource-scope/definition.js +37 -0
  68. package/dist-node/authorization/resource-scope/definition.js.map +1 -0
  69. package/dist-node/authorization/resource-scope/errors.d.ts +3 -0
  70. package/dist-node/authorization/resource-scope/errors.d.ts.map +1 -0
  71. package/dist-node/authorization/resource-scope/errors.js +3 -0
  72. package/dist-node/authorization/resource-scope/errors.js.map +1 -0
  73. package/dist-node/authorization/resource-scope/index.d.ts +5 -0
  74. package/dist-node/authorization/resource-scope/index.d.ts.map +1 -0
  75. package/dist-node/authorization/resource-scope/index.js +6 -0
  76. package/dist-node/authorization/resource-scope/index.js.map +1 -0
  77. package/dist-node/authorization/resource-scope/payload.d.ts +4 -0
  78. package/dist-node/authorization/resource-scope/payload.d.ts.map +1 -0
  79. package/dist-node/authorization/resource-scope/payload.js +3 -0
  80. package/dist-node/authorization/resource-scope/payload.js.map +1 -0
  81. package/dist-node/authorization/resource-scope/primitive.d.ts +2 -0
  82. package/dist-node/authorization/resource-scope/primitive.d.ts.map +1 -0
  83. package/dist-node/authorization/resource-scope/primitive.js +3 -0
  84. package/dist-node/authorization/resource-scope/primitive.js.map +1 -0
  85. package/dist-node/authorization/resource-scope/props.d.ts +7 -0
  86. package/dist-node/authorization/resource-scope/props.d.ts.map +1 -0
  87. package/dist-node/authorization/resource-scope/props.js +3 -0
  88. package/dist-node/authorization/resource-scope/props.js.map +1 -0
  89. package/dist-node/authorization/resource-scope/value-object.d.ts +102 -0
  90. package/dist-node/authorization/resource-scope/value-object.d.ts.map +1 -0
  91. package/dist-node/authorization/resource-scope/value-object.js +20 -0
  92. package/dist-node/authorization/resource-scope/value-object.js.map +1 -0
  93. package/dist-node/authorization/secured-use-case/secured-use-case.mixin.d.ts +6 -4
  94. package/dist-node/authorization/secured-use-case/secured-use-case.mixin.d.ts.map +1 -1
  95. package/dist-node/authorization/secured-use-case/secured-use-case.mixin.js +93 -11
  96. package/dist-node/authorization/secured-use-case/secured-use-case.mixin.js.map +1 -1
  97. package/dist-node/authorization/secured-use-case/secured-use-case.types.d.ts +28 -0
  98. package/dist-node/authorization/secured-use-case/secured-use-case.types.d.ts.map +1 -1
  99. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  import { DomainBaseError } from '../../domain-base-error';
2
2
  import { PermissionPrimitive } from '../permission';
3
+ import { ResourceScope } from '../resource-scope';
3
4
  /** Primitiva de la identidad de un sujeto autenticado. */
4
5
  export type AuthorizationSubjectId = string | number;
5
6
  /**
@@ -20,21 +21,27 @@ export type AuthorizationPermissionLike = PermissionPrimitive | HasPrimitive<Per
20
21
  * Datos extendidos del error de autorización.
21
22
  *
22
23
  * `subjectId` es `null` cuando la denegación ocurre por ausencia de sujeto;
23
- * `permission` es `null` cuando no se llegó a evaluar un permiso concreto.
24
+ * `permission` es `null` cuando no se llegó a evaluar un permiso concreto;
25
+ * `scopes` es `null` cuando la denegación ocurrió antes de que el puerto
26
+ * viera alcances resueltos, y la copia de sus primitivas cuando el puerto
27
+ * denegó con alcances presentados.
24
28
  */
25
29
  export type AuthorizationErrorData = {
26
30
  /** Identidad del sujeto autenticado, o `null` si no hay sujeto. */
27
31
  subjectId: AuthorizationSubjectId | null;
28
32
  /** Permiso evaluado, o `null` si la denegación fue por autenticación. */
29
33
  permission: PermissionPrimitive | null;
34
+ /** Primitivas de los alcances presentados al puerto, o `null`. */
35
+ scopes: string[] | null;
30
36
  };
31
37
  /**
32
38
  * Error de dominio de autorización.
33
39
  *
34
40
  * Viaja por el canal de error del caso de uso seguro cuando el enforcement
35
- * deniega: sujeto ausente cuando se requiere, o el puerto de autorización
36
- * devuelve `denied`. Lleva la identidad del sujeto y el permiso evaluado.
37
- * La traducción a `403` queda en la capa de aplicación.
41
+ * deniega: sujeto ausente cuando se requiere, `security` o `securityScope` no
42
+ * validados, o el puerto de autorización devuelve `denied`. Lleva la identidad
43
+ * del sujeto, el permiso evaluado y, cuando el puerto vio alcances, sus
44
+ * primitivas. La traducción a `403` queda en la capa de aplicación.
38
45
  */
39
46
  export declare class AuthorizationError extends DomainBaseError<AuthorizationErrorData> {
40
47
  /** Identidad estable del error para los traductores de la app. */
@@ -45,7 +52,12 @@ export declare class AuthorizationError extends DomainBaseError<AuthorizationErr
45
52
  readonly subjectId: AuthorizationSubjectId | null;
46
53
  /** Permiso evaluado, o `null` si la denegación fue por autenticación. */
47
54
  readonly permission: PermissionPrimitive | null;
48
- constructor(subjectId: AuthorizationSubjectIdLike, permission: AuthorizationPermissionLike);
55
+ /**
56
+ * Primitivas de los alcances presentados al puerto, o `null` cuando la
57
+ * denegación ocurrió antes de que el puerto los viera.
58
+ */
59
+ readonly scopes: string[] | null;
60
+ constructor(subjectId: AuthorizationSubjectIdLike, permission: AuthorizationPermissionLike, scopes?: readonly ResourceScope[] | null);
49
61
  /**
50
62
  * Construye el error de autenticación requerida sin sujeto.
51
63
  *
@@ -61,8 +73,10 @@ export declare class AuthorizationError extends DomainBaseError<AuthorizationErr
61
73
  *
62
74
  * @param subject Sujeto autenticado al que se le denegó el permiso
63
75
  * @param permission Permiso denegado
64
- * @returns Error de autorización con la identidad y el permiso
76
+ * @param scopes Alcances presentados al puerto, o `null` si el puerto no los
77
+ * vio
78
+ * @returns Error de autorización con la identidad, el permiso y los alcances
65
79
  */
66
- static denied(subject: HasPrimitive<AuthorizationSubjectId>, permission: HasPrimitive<PermissionPrimitive>): AuthorizationError;
80
+ static denied(subject: HasPrimitive<AuthorizationSubjectId>, permission: HasPrimitive<PermissionPrimitive>, scopes?: readonly ResourceScope[] | null): AuthorizationError;
67
81
  }
68
82
  //# sourceMappingURL=authorization.error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authorization.error.d.ts","sourceRoot":"","sources":["../../../src/authorization/errors/authorization.error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,0DAA0D;AAC1D,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,MAAM,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,WAAW,YAAY,CAAC,SAAS;IACrC,YAAY,IAAI,SAAS,CAAC;CAC3B;AAED,oEAAoE;AACpE,MAAM,MAAM,0BAA0B,GAClC,sBAAsB,GACtB,YAAY,CAAC,sBAAsB,CAAC,GACpC,IAAI,CAAC;AAET,8DAA8D;AAC9D,MAAM,MAAM,2BAA2B,GACnC,mBAAmB,GACnB,YAAY,CAAC,mBAAmB,CAAC,GACjC,IAAI,CAAC;AAoBT;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,mEAAmE;IACnE,SAAS,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACzC,yEAAyE;IACzE,UAAU,EAAE,mBAAmB,GAAG,IAAI,CAAC;CACxC,CAAC;AAsBF;;;;;;;GAOG;AACH,qBAAa,kBAAmB,SAAQ,eAAe,CAAC,sBAAsB,CAAC;IAC7E,kEAAkE;IAClE,gBAAuB,UAAU,yBAAyB;IAE1D,+DAA+D;IAC/D,gBAAuB,IAAI,yBAAiC;IAE5D,mEAAmE;IACnE,SAAgB,SAAS,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAEzD,yEAAyE;IACzE,SAAgB,UAAU,EAAE,mBAAmB,GAAG,IAAI,CAAC;gBAGrD,SAAS,EAAE,0BAA0B,EACrC,UAAU,EAAE,2BAA2B;IAezC;;;;;;;;OAQG;WACW,cAAc,IAAI,kBAAkB;IAIlD;;;;;;OAMG;WACW,MAAM,CAClB,OAAO,EAAE,YAAY,CAAC,sBAAsB,CAAC,EAC7C,UAAU,EAAE,YAAY,CAAC,mBAAmB,CAAC,GAC5C,kBAAkB;CAGtB"}
1
+ {"version":3,"file":"authorization.error.d.ts","sourceRoot":"","sources":["../../../src/authorization/errors/authorization.error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,0DAA0D;AAC1D,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,MAAM,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,WAAW,YAAY,CAAC,SAAS;IACrC,YAAY,IAAI,SAAS,CAAC;CAC3B;AAED,oEAAoE;AACpE,MAAM,MAAM,0BAA0B,GAClC,sBAAsB,GACtB,YAAY,CAAC,sBAAsB,CAAC,GACpC,IAAI,CAAC;AAET,8DAA8D;AAC9D,MAAM,MAAM,2BAA2B,GACnC,mBAAmB,GACnB,YAAY,CAAC,mBAAmB,CAAC,GACjC,IAAI,CAAC;AAoCT;;;;;;;;GAQG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,mEAAmE;IACnE,SAAS,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACzC,yEAAyE;IACzE,UAAU,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACvC,kEAAkE;IAClE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CACzB,CAAC;AAsBF;;;;;;;;GAQG;AACH,qBAAa,kBAAmB,SAAQ,eAAe,CAAC,sBAAsB,CAAC;IAC7E,kEAAkE;IAClE,gBAAuB,UAAU,yBAAyB;IAE1D,+DAA+D;IAC/D,gBAAuB,IAAI,yBAAiC;IAE5D,mEAAmE;IACnE,SAAgB,SAAS,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAEzD,yEAAyE;IACzE,SAAgB,UAAU,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAEvD;;;OAGG;IACH,SAAgB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;gBAGtC,SAAS,EAAE,0BAA0B,EACrC,UAAU,EAAE,2BAA2B,EACvC,MAAM,CAAC,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI;IAkB1C;;;;;;;;OAQG;WACW,cAAc,IAAI,kBAAkB;IAIlD;;;;;;;;OAQG;WACW,MAAM,CAClB,OAAO,EAAE,YAAY,CAAC,sBAAsB,CAAC,EAC7C,UAAU,EAAE,YAAY,CAAC,mBAAmB,CAAC,EAC7C,MAAM,CAAC,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,GACvC,kBAAkB;CAGtB"}
@@ -14,6 +14,19 @@ const toPrimitive = (value) => {
14
14
  }
15
15
  return value;
16
16
  };
17
+ /**
18
+ * Normaliza los alcances presentados al puerto a sus primitivas.
19
+ *
20
+ * @param scopes Alcances resueltos, o `null` cuando la denegación ocurrió
21
+ * antes de que el puerto viera alcances
22
+ * @returns Copia de las primitivas, o `null`
23
+ */
24
+ const toScopePrimitives = (scopes) => {
25
+ if (scopes === null || scopes === undefined) {
26
+ return null;
27
+ }
28
+ return scopes.map((scope) => scope.getPrimitive());
29
+ };
17
30
  /**
18
31
  * Construye el detalle legible de la denegación.
19
32
  *
@@ -34,22 +47,26 @@ const buildDetail = (subjectId, permission) => {
34
47
  * Error de dominio de autorización.
35
48
  *
36
49
  * Viaja por el canal de error del caso de uso seguro cuando el enforcement
37
- * deniega: sujeto ausente cuando se requiere, o el puerto de autorización
38
- * devuelve `denied`. Lleva la identidad del sujeto y el permiso evaluado.
39
- * La traducción a `403` queda en la capa de aplicación.
50
+ * deniega: sujeto ausente cuando se requiere, `security` o `securityScope` no
51
+ * validados, o el puerto de autorización devuelve `denied`. Lleva la identidad
52
+ * del sujeto, el permiso evaluado y, cuando el puerto vio alcances, sus
53
+ * primitivas. La traducción a `403` queda en la capa de aplicación.
40
54
  */
41
55
  export class AuthorizationError extends DomainBaseError {
42
- constructor(subjectId, permission) {
56
+ constructor(subjectId, permission, scopes) {
43
57
  const normalizedSubjectId = toPrimitive(subjectId);
44
58
  const normalizedPermission = toPrimitive(permission);
59
+ const normalizedScopes = toScopePrimitives(scopes);
45
60
  const title = 'Authorization error';
46
61
  const detail = buildDetail(normalizedSubjectId, normalizedPermission);
47
62
  super('authorization', AuthorizationError.IDENTIFIER, detail, title, {
48
63
  subjectId: normalizedSubjectId,
49
64
  permission: normalizedPermission,
65
+ scopes: normalizedScopes,
50
66
  });
51
67
  this.subjectId = normalizedSubjectId;
52
68
  this.permission = normalizedPermission;
69
+ this.scopes = normalizedScopes;
53
70
  }
54
71
  /**
55
72
  * Construye el error de autenticación requerida sin sujeto.
@@ -68,10 +85,12 @@ export class AuthorizationError extends DomainBaseError {
68
85
  *
69
86
  * @param subject Sujeto autenticado al que se le denegó el permiso
70
87
  * @param permission Permiso denegado
71
- * @returns Error de autorización con la identidad y el permiso
88
+ * @param scopes Alcances presentados al puerto, o `null` si el puerto no los
89
+ * vio
90
+ * @returns Error de autorización con la identidad, el permiso y los alcances
72
91
  */
73
- static denied(subject, permission) {
74
- return new AuthorizationError(subject, permission);
92
+ static denied(subject, permission, scopes) {
93
+ return new AuthorizationError(subject, permission, scopes);
75
94
  }
76
95
  }
77
96
  /** Identidad estable del error para los traductores de la app. */
@@ -1 +1 @@
1
- {"version":3,"file":"authorization.error.js","sourceRoot":"","sources":["../../../src/authorization/errors/authorization.error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AA6B1D;;;;;GAKG;AACH,MAAM,WAAW,GAAG,CAClB,KAAiD,EAC/B,EAAE;IACpB,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAQ,KAAiC,CAAC,YAAY,EAAE,CAAC;IAC3D,CAAC;IACD,OAAO,KAAkB,CAAC;AAC5B,CAAC,CAAC;AAeF;;;;;;GAMG;AACH,MAAM,WAAW,GAAG,CAClB,SAAwC,EACxC,UAAsC,EAC9B,EAAE;IACV,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACvB,OAAO,2DAA2D,CAAC;IACrE,CAAC;IACD,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;QACxB,OAAO,YAAY,SAAS,qBAAqB,CAAC;IACpD,CAAC;IACD,OAAO,YAAY,SAAS,uCAAuC,UAAU,GAAG,CAAC;AACnF,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,OAAO,kBAAmB,SAAQ,eAAuC;IAa7E,YACE,SAAqC,EACrC,UAAuC;QAEvC,MAAM,mBAAmB,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;QACnD,MAAM,oBAAoB,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;QACrD,MAAM,KAAK,GAAG,qBAAqB,CAAC;QACpC,MAAM,MAAM,GAAG,WAAW,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;QACtE,KAAK,CAAC,eAAe,EAAE,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE;YACnE,SAAS,EAAE,mBAAmB;YAC9B,UAAU,EAAE,oBAAoB;SACjC,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,oBAAoB,CAAC;IACzC,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,cAAc;QAC1B,OAAO,IAAI,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAClB,OAA6C,EAC7C,UAA6C;QAE7C,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IACrD,CAAC;;AAtDD,kEAAkE;AAC3C,6BAAU,GAAG,qBAAqB,CAAC;AAE1D,+DAA+D;AACxC,uBAAI,GAAG,kBAAkB,CAAC,UAAU,CAAC"}
1
+ {"version":3,"file":"authorization.error.js","sourceRoot":"","sources":["../../../src/authorization/errors/authorization.error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AA8B1D;;;;;GAKG;AACH,MAAM,WAAW,GAAG,CAClB,KAAiD,EAC/B,EAAE;IACpB,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAQ,KAAiC,CAAC,YAAY,EAAE,CAAC;IAC3D,CAAC;IACD,OAAO,KAAkB,CAAC;AAC5B,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,CACxB,MAAmD,EAClC,EAAE;IACnB,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC;AACrD,CAAC,CAAC;AAoBF;;;;;;GAMG;AACH,MAAM,WAAW,GAAG,CAClB,SAAwC,EACxC,UAAsC,EAC9B,EAAE;IACV,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACvB,OAAO,2DAA2D,CAAC;IACrE,CAAC;IACD,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;QACxB,OAAO,YAAY,SAAS,qBAAqB,CAAC;IACpD,CAAC;IACD,OAAO,YAAY,SAAS,uCAAuC,UAAU,GAAG,CAAC;AACnF,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,OAAO,kBAAmB,SAAQ,eAAuC;IAmB7E,YACE,SAAqC,EACrC,UAAuC,EACvC,MAAwC;QAExC,MAAM,mBAAmB,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;QACnD,MAAM,oBAAoB,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;QACrD,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACnD,MAAM,KAAK,GAAG,qBAAqB,CAAC;QACpC,MAAM,MAAM,GAAG,WAAW,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;QACtE,KAAK,CAAC,eAAe,EAAE,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE;YACnE,SAAS,EAAE,mBAAmB;YAC9B,UAAU,EAAE,oBAAoB;YAChC,MAAM,EAAE,gBAAgB;SACzB,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,oBAAoB,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,gBAAgB,CAAC;IACjC,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,cAAc;QAC1B,OAAO,IAAI,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,MAAM,CAClB,OAA6C,EAC7C,UAA6C,EAC7C,MAAwC;QAExC,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAC7D,CAAC;;AAnED,kEAAkE;AAC3C,6BAAU,GAAG,qBAAqB,CAAC;AAE1D,+DAA+D;AACxC,uBAAI,GAAG,kBAAkB,CAAC,UAAU,CAAC"}
@@ -2,6 +2,7 @@ export * from './authenticated-subject';
2
2
  export * from './errors';
3
3
  export * from './permission';
4
4
  export * from './ports';
5
+ export * from './resource-scope';
5
6
  export * from './secured-use-case';
6
7
  export * from './security';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC"}
@@ -2,6 +2,7 @@ export * from './authenticated-subject';
2
2
  export * from './errors';
3
3
  export * from './permission';
4
4
  export * from './ports';
5
+ export * from './resource-scope';
5
6
  export * from './secured-use-case';
6
7
  export * from './security';
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { Identifiable, SubjectId } from '../../entity/identity';
2
2
  import { AuthenticatedSubject } from '../authenticated-subject';
3
3
  import { Permission } from '../permission';
4
+ import { ResourceScope } from '../resource-scope';
4
5
  /**
5
6
  * Decisiones que puede devolver un puerto de autorización.
6
7
  *
@@ -14,8 +15,13 @@ export type AuthorizationDecision = (typeof AUTHORIZATION_DECISIONS)[number];
14
15
  * Puerto genérico de autorización del caso de uso seguro.
15
16
  *
16
17
  * Es independiente de la tecnología y del modelo de autorización (RBAC, ABAC,
17
- * ReBAC, PDP): recibe el sujeto autenticado y el permiso exigido, y decide.
18
- * El adaptador concreto vive en la aplicación.
18
+ * ReBAC, PDP): recibe el sujeto autenticado, el permiso exigido y, cuando el
19
+ * caso de uso lo declara, los alcances del recurso sobre el que se pide el
20
+ * permiso, y decide.
21
+ *
22
+ * Los alcances son opcionales y **no interpretados** por la librería: decide el
23
+ * adaptador si la concesión exige alguno de ellos, todos o una combinación del
24
+ * modelo del consumidor. El adaptador concreto vive en la aplicación.
19
25
  *
20
26
  * @template Id Tipo de identidad del sujeto
21
27
  */
@@ -23,10 +29,15 @@ export interface AuthorizationPort<Id extends Identifiable = SubjectId> {
23
29
  /**
24
30
  * Decide si el sujeto tiene el permiso indicado.
25
31
  *
32
+ * El tercer parámetro es opcional: una implementación escrita contra 3.0.0
33
+ * (dos parámetros) sigue satisfaciendo esta interfaz sin cambios.
34
+ *
26
35
  * @param subject Sujeto ya autenticado
27
36
  * @param permission Permiso exigido por el caso de uso
37
+ * @param scopes Alcances del recurso resueltos por el caso de uso, o
38
+ * ausentes cuando el caso de uso no declara `securityScope`
28
39
  * @returns `granted` si autoriza; `denied` si deniega
29
40
  */
30
- authorize(subject: AuthenticatedSubject<Id>, permission: Permission): AuthorizationDecision | Promise<AuthorizationDecision>;
41
+ authorize(subject: AuthenticatedSubject<Id>, permission: Permission, scopes?: readonly ResourceScope[]): AuthorizationDecision | Promise<AuthorizationDecision>;
31
42
  }
32
43
  //# sourceMappingURL=authorization.port.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authorization.port.d.ts","sourceRoot":"","sources":["../../../src/authorization/ports/authorization.port.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,gCAAiC,CAAC;AAEtE,0DAA0D;AAC1D,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB,CAAC,EAAE,SAAS,YAAY,GAAG,SAAS;IACpE;;;;;;OAMG;IACH,SAAS,CACP,OAAO,EAAE,oBAAoB,CAAC,EAAE,CAAC,EACjC,UAAU,EAAE,UAAU,GACrB,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAC3D"}
1
+ {"version":3,"file":"authorization.port.d.ts","sourceRoot":"","sources":["../../../src/authorization/ports/authorization.port.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,gCAAiC,CAAC;AAEtE,0DAA0D;AAC1D,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,iBAAiB,CAAC,EAAE,SAAS,YAAY,GAAG,SAAS;IACpE;;;;;;;;;;;OAWG;IACH,SAAS,CACP,OAAO,EAAE,oBAAoB,CAAC,EAAE,CAAC,EACjC,UAAU,EAAE,UAAU,EACtB,MAAM,CAAC,EAAE,SAAS,aAAa,EAAE,GAChC,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAC3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"authorization.port.js","sourceRoot":"","sources":["../../../src/authorization/ports/authorization.port.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAU,CAAC"}
1
+ {"version":3,"file":"authorization.port.js","sourceRoot":"","sources":["../../../src/authorization/ports/authorization.port.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAU,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { z } from '@imolko/ultra-v8n';
2
+ /**
3
+ * Longitud máxima de un alcance de recurso.
4
+ *
5
+ * Es la única fuente de la longitud: `PATTERN` y el mensaje de error se
6
+ * derivan de aquí. La cota vive en el patrón y no en un `.max()` para que el
7
+ * vocabulario de errores del seam se quede en `InvalidTypeError` e
8
+ * `InvalidStringError`.
9
+ */
10
+ export declare const MAX_LENGTH = 128;
11
+ /**
12
+ * Gramática de un alcance de recurso.
13
+ *
14
+ * Es el conjunto `unreserved` de RFC 3986 (`A-Z a-z 0-9 - . _ ~`) más `/`,
15
+ * con primer carácter alfanumérico y longitud máxima de `MAX_LENGTH`. Excluir
16
+ * `:` es deliberado: un `Permission` válido (`<contexto>:<acción>`) nunca es
17
+ * un alcance válido. Todo valor admitido es un `scope-token` legal de OAuth
18
+ * 2.0.
19
+ */
20
+ export declare const PATTERN: RegExp;
21
+ /** Mensaje de error para un alcance de recurso fuera de la gramática. */
22
+ export declare const PATTERN_ERROR = "Resource scope must start with an alphanumeric character and contain only letters, digits, \".\", \"_\", \"~\", \"/\" or \"-\" (1-128 characters, no \":\")";
23
+ export declare const conditions: z.ZodPipe<z.ZodString, z.ZodTransform<{
24
+ value: string;
25
+ }, string>>;
26
+ //# sourceMappingURL=conditions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditions.d.ts","sourceRoot":"","sources":["../../../src/authorization/resource-scope/conditions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAEtC;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,MAAM,CAAC;AAE9B;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,QAEnB,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,aAAa,gKAA8J,CAAC;AAEzL,eAAO,MAAM,UAAU;;WAGa,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { z } from '@imolko/ultra-v8n';
2
+ /**
3
+ * Longitud máxima de un alcance de recurso.
4
+ *
5
+ * Es la única fuente de la longitud: `PATTERN` y el mensaje de error se
6
+ * derivan de aquí. La cota vive en el patrón y no en un `.max()` para que el
7
+ * vocabulario de errores del seam se quede en `InvalidTypeError` e
8
+ * `InvalidStringError`.
9
+ */
10
+ export const MAX_LENGTH = 128;
11
+ /**
12
+ * Gramática de un alcance de recurso.
13
+ *
14
+ * Es el conjunto `unreserved` de RFC 3986 (`A-Z a-z 0-9 - . _ ~`) más `/`,
15
+ * con primer carácter alfanumérico y longitud máxima de `MAX_LENGTH`. Excluir
16
+ * `:` es deliberado: un `Permission` válido (`<contexto>:<acción>`) nunca es
17
+ * un alcance válido. Todo valor admitido es un `scope-token` legal de OAuth
18
+ * 2.0.
19
+ */
20
+ export const PATTERN = new RegExp(`^[A-Za-z0-9][A-Za-z0-9._~/-]{0,${MAX_LENGTH - 1}}$`);
21
+ /** Mensaje de error para un alcance de recurso fuera de la gramática. */
22
+ export const PATTERN_ERROR = `Resource scope must start with an alphanumeric character and contain only letters, digits, ".", "_", "~", "/" or "-" (1-${MAX_LENGTH} characters, no ":")`;
23
+ export const conditions = z
24
+ .string()
25
+ .regex(PATTERN, { error: PATTERN_ERROR })
26
+ .transform((value) => ({ value }));
27
+ //# sourceMappingURL=conditions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditions.js","sourceRoot":"","sources":["../../../src/authorization/resource-scope/conditions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAEtC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAC;AAE9B;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,MAAM,CAC/B,kCAAkC,UAAU,GAAG,CAAC,IAAI,CACrD,CAAC;AAEF,yEAAyE;AACzE,MAAM,CAAC,MAAM,aAAa,GAAG,2HAA2H,UAAU,sBAAsB,CAAC;AAEzL,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC;KACxB,MAAM,EAAE;KACR,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;KACxC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { ZodType } from '@imolko/ultra-v8n';
2
+ import { ValueObjectBase } from '../../value-object';
3
+ import { Payload } from './payload';
4
+ import { Primitive } from './primitive';
5
+ import { Props } from './props';
6
+ export declare class Definition extends ValueObjectBase<Props, Primitive, Payload> {
7
+ /**
8
+ * Miembros estáticos
9
+ */
10
+ static readonly NAME = "resource-scope";
11
+ static readonly conditions: ZodType<Props, Payload>;
12
+ /**
13
+ * Devuelve las propiedades serializadas para exponer en la aplicación
14
+ * @returns {Primitive}
15
+ */
16
+ getPrimitive(): Primitive;
17
+ /**
18
+ * Devuelve las propiedades serializadas que permiten la reconstrucción
19
+ * @returns {Payload}
20
+ */
21
+ getPayload(): Payload;
22
+ }
23
+ //# sourceMappingURL=definition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/authorization/resource-scope/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAgB,MAAM,oBAAoB,CAAC;AAEnE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,qBACa,UAAW,SAAQ,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC;IACxE;;OAEG;IACH,gBAAuB,IAAI,oBAAoB;IAC/C,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAc;IACjE;;;OAGG;IACI,YAAY,IAAI,SAAS;IAGhC;;;OAGG;IACI,UAAU,IAAI,OAAO;CAG7B"}
@@ -0,0 +1,34 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { ValueObjectBase, isVOComplete } from '../../value-object';
8
+ import { conditions } from './conditions';
9
+ let Definition = class Definition extends ValueObjectBase {
10
+ /**
11
+ * Devuelve las propiedades serializadas para exponer en la aplicación
12
+ * @returns {Primitive}
13
+ */
14
+ getPrimitive() {
15
+ return this.props.value;
16
+ }
17
+ /**
18
+ * Devuelve las propiedades serializadas que permiten la reconstrucción
19
+ * @returns {Payload}
20
+ */
21
+ getPayload() {
22
+ return this.props.value;
23
+ }
24
+ };
25
+ /**
26
+ * Miembros estáticos
27
+ */
28
+ Definition.NAME = 'resource-scope';
29
+ Definition.conditions = conditions;
30
+ Definition = __decorate([
31
+ isVOComplete()
32
+ ], Definition);
33
+ export { Definition };
34
+ //# sourceMappingURL=definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/authorization/resource-scope/definition.ts"],"names":[],"mappings":";;;;;;AAEA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAMnC,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,eAA0C;IAMxE;;;OAGG;IACI,YAAY;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IAC1B,CAAC;IACD;;;OAGG;IACI,UAAU;QACf,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IAC1B,CAAC;;AAlBD;;GAEG;AACoB,eAAI,GAAG,gBAAgB,AAAnB,CAAoB;AAC/B,qBAAU,GAA4B,UAAU,AAAtC,CAAuC;AALtD,UAAU;IADtB,YAAY,EAAE;GACF,UAAU,CAoBtB"}
@@ -0,0 +1,3 @@
1
+ import { InvalidStringError, InvalidTypeError } from '@imolko/ultra-v8n';
2
+ export type Errors = InvalidTypeError | InvalidStringError;
3
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/authorization/resource-scope/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEzE,MAAM,MAAM,MAAM,GAAG,gBAAgB,GAAG,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/authorization/resource-scope/errors.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export { ResourceScope } from './value-object';
2
+ export { Errors as ResourceScopeErrors } from './errors';
3
+ export { Payload as ResourceScopePayload } from './payload';
4
+ export { Primitive as ResourceScopePrimitive } from './primitive';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/authorization/resource-scope/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,MAAM,IAAI,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,SAAS,IAAI,sBAAsB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { ResourceScope } from './value-object';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/authorization/resource-scope/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { z } from '@imolko/ultra-v8n';
2
+ import { conditions } from './conditions';
3
+ export type Payload = z.input<typeof conditions>;
4
+ //# sourceMappingURL=payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../src/authorization/resource-scope/payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=payload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payload.js","sourceRoot":"","sources":["../../../src/authorization/resource-scope/payload.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export type Primitive = string;
2
+ //# sourceMappingURL=primitive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitive.d.ts","sourceRoot":"","sources":["../../../src/authorization/resource-scope/primitive.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=primitive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitive.js","sourceRoot":"","sources":["../../../src/authorization/resource-scope/primitive.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @property {string} value Alcance del recurso sobre el que se ejerce un permiso
3
+ */
4
+ export interface Props {
5
+ value: string;
6
+ }
7
+ //# sourceMappingURL=props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/authorization/resource-scope/props.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.js","sourceRoot":"","sources":["../../../src/authorization/resource-scope/props.ts"],"names":[],"mappings":""}
@@ -0,0 +1,102 @@
1
+ import { Definition } from './definition';
2
+ import { Errors } from './errors';
3
+ import { Props } from './props';
4
+ declare const ResourceScope_base: ((abstract new (...args: any[]) => {
5
+ clone(changes: Partial<Props>): /*elided*/ any;
6
+ readonly props: Readonly<Props>;
7
+ equals<Implemented extends import("../..").ValueObjectBase<Props, string, string>>(this: Implemented, other?: Implemented | undefined): boolean;
8
+ getPrimitive(): string;
9
+ getPayload(): string;
10
+ }) & {
11
+ factoryUsed: boolean;
12
+ rules<Implemented extends /*elided*/ any & {
13
+ new (...args: any[]): {
14
+ readonly props: Readonly<Props>;
15
+ equals<Implemented_1 extends import("../..").ValueObjectBase<Props, string, string>>(this: Implemented_1, other?: Implemented_1 | undefined): boolean;
16
+ clone(changes: Partial<Props>): /*elided*/ any;
17
+ getPrimitive(): string;
18
+ getPayload(): string;
19
+ } & Props;
20
+ prototype: {
21
+ readonly props: Readonly<Props>;
22
+ equals<Implemented_1 extends import("../..").ValueObjectBase<Props, string, string>>(this: Implemented_1, other?: Implemented_1 | undefined): boolean;
23
+ clone(changes: Partial<Props>): /*elided*/ any;
24
+ getPrimitive(): string;
25
+ getPayload(): string;
26
+ } & Props;
27
+ } & ((abstract new (...args: any[]) => {
28
+ readonly props: Readonly<Props>;
29
+ equals<Implemented_1 extends import("../..").ValueObjectBase<Props, string, string>>(this: Implemented_1, other?: Implemented_1 | undefined): boolean;
30
+ clone(changes: Partial<Props>): /*elided*/ any;
31
+ getPrimitive(): string;
32
+ getPayload(): string;
33
+ }) & {
34
+ conditions: import("zod").ZodType;
35
+ builder?(value: Props): import("../..").ValueObjectBase<Props, string, string>;
36
+ NAME: string;
37
+ }) & typeof Definition>(this: Implemented): import("zod").ZodType<InstanceType<Implemented>, string, import("zod/v4/core").$ZodTypeInternals<InstanceType<Implemented>, string>>;
38
+ of<Implemented extends /*elided*/ any & {
39
+ new (...args: any[]): {
40
+ readonly props: Readonly<Props>;
41
+ equals<Implemented_1 extends import("../..").ValueObjectBase<Props, string, string>>(this: Implemented_1, other?: Implemented_1 | undefined): boolean;
42
+ clone(changes: Partial<Props>): /*elided*/ any;
43
+ getPrimitive(): string;
44
+ getPayload(): string;
45
+ } & Props;
46
+ prototype: {
47
+ readonly props: Readonly<Props>;
48
+ equals<Implemented_1 extends import("../..").ValueObjectBase<Props, string, string>>(this: Implemented_1, other?: Implemented_1 | undefined): boolean;
49
+ clone(changes: Partial<Props>): /*elided*/ any;
50
+ getPrimitive(): string;
51
+ getPayload(): string;
52
+ } & Props;
53
+ } & ((abstract new (...args: any[]) => {
54
+ readonly props: Readonly<Props>;
55
+ equals<Implemented_1 extends import("../..").ValueObjectBase<Props, string, string>>(this: Implemented_1, other?: Implemented_1 | undefined): boolean;
56
+ clone(changes: Partial<Props>): /*elided*/ any;
57
+ getPrimitive(): string;
58
+ getPayload(): string;
59
+ }) & {
60
+ conditions: import("zod").ZodType;
61
+ builder?(value: Props): import("../..").ValueObjectBase<Props, string, string>;
62
+ NAME: string;
63
+ }) & typeof Definition>(this: Implemented, payload: string): import("@imolko/ultra-result").Validation<Errors, InstanceType<Implemented>>;
64
+ builder(props: Props): {
65
+ clone(changes: Partial<Props>): /*elided*/ any;
66
+ readonly props: Readonly<Props>;
67
+ equals<Implemented extends import("../..").ValueObjectBase<Props, string, string>>(this: Implemented, other?: Implemented | undefined): boolean;
68
+ getPrimitive(): string;
69
+ getPayload(): string;
70
+ };
71
+ conditions: import("zod").ZodType;
72
+ NAME: string;
73
+ }) & {
74
+ new (...args: any[]): {
75
+ readonly props: Readonly<Props>;
76
+ equals<Implemented extends import("../..").ValueObjectBase<Props, string, string>>(this: Implemented, other?: Implemented | undefined): boolean;
77
+ clone(changes: Partial<Props>): /*elided*/ any;
78
+ getPrimitive(): string;
79
+ getPayload(): string;
80
+ } & Props;
81
+ prototype: {
82
+ readonly props: Readonly<Props>;
83
+ equals<Implemented extends import("../..").ValueObjectBase<Props, string, string>>(this: Implemented, other?: Implemented | undefined): boolean;
84
+ clone(changes: Partial<Props>): /*elided*/ any;
85
+ getPrimitive(): string;
86
+ getPayload(): string;
87
+ } & Props;
88
+ } & ((abstract new (...args: any[]) => {
89
+ readonly props: Readonly<Props>;
90
+ equals<Implemented extends import("../..").ValueObjectBase<Props, string, string>>(this: Implemented, other?: Implemented | undefined): boolean;
91
+ clone(changes: Partial<Props>): /*elided*/ any;
92
+ getPrimitive(): string;
93
+ getPayload(): string;
94
+ }) & {
95
+ conditions: import("zod").ZodType;
96
+ builder?(value: Props): import("../..").ValueObjectBase<Props, string, string>;
97
+ NAME: string;
98
+ }) & typeof Definition;
99
+ export declare class ResourceScope extends ResourceScope_base {
100
+ }
101
+ export {};
102
+ //# sourceMappingURL=value-object.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-object.d.ts","sourceRoot":"","sources":["../../../src/authorization/resource-scope/value-object.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhC,qBAIa,aAAc,SAAQ,kBAMtB;CAAG"}
@@ -0,0 +1,17 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { RegisterValueObject, ValueObjectWithPublicApi, } from '../../value-object';
8
+ import { Definition } from './definition';
9
+ let ResourceScope = class ResourceScope extends ValueObjectWithPublicApi(Definition) {
10
+ };
11
+ ResourceScope = __decorate([
12
+ RegisterValueObject({
13
+ description: 'Alcance opaco del recurso sobre el que el caso de uso seguro ejerce un permiso',
14
+ })
15
+ ], ResourceScope);
16
+ export { ResourceScope };
17
+ //# sourceMappingURL=value-object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-object.js","sourceRoot":"","sources":["../../../src/authorization/resource-scope/value-object.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAUnC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,wBAAwB,CAMzD,UAAU,CAAC;CAAG,CAAA;AANH,aAAa;IAJzB,mBAAmB,CAAC;QACnB,WAAW,EACT,gFAAgF;KACnF,CAAC;GACW,aAAa,CAMV"}
@@ -2,10 +2,12 @@ import { SecuredUseCaseConstructor, SecuredUseCaseDefinition } from './secured-u
2
2
  /**
3
3
  * Mixin de caso de uso seguro.
4
4
  *
5
- * Exige `security` en el tipo de la definición, expone `run` como único camino
6
- * público y oculta `execute` en el tipo (no en el runtime). `run` aplica el
7
- * enforcement fail-closed y preserva el canal del caso de uso, uniendo
8
- * `AuthorizationError` a su tipo de error sin anidar resultados.
5
+ * Exige `security` en el tipo de la definición, acepta `securityScope` como
6
+ * estático opcional para resolver los alcances del recurso a partir de la
7
+ * petición, expone `run` como único camino público y oculta `execute` en el
8
+ * tipo (no en el runtime). `run` aplica el enforcement fail-closed y preserva
9
+ * el canal del caso de uso, uniendo `AuthorizationError` a su tipo de error sin
10
+ * anidar resultados.
9
11
  *
10
12
  * @param Source Definición del caso de uso con `security` y `execute`
11
13
  * @returns Constructor cuyo tipo público sólo ofrece `run`
@@ -1 +1 @@
1
- {"version":3,"file":"secured-use-case.mixin.d.ts","sourceRoot":"","sources":["../../../src/authorization/secured-use-case/secured-use-case.mixin.ts"],"names":[],"mappings":"AAOA,OAAO,EAGL,yBAAyB,EAEzB,wBAAwB,EACzB,MAAM,0BAA0B,CAAC;AA8ElC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,SAAS,wBAAwB,EACxE,QAAQ,UAAU,KACjB,yBAAyB,CAAC,UAAU,CAgCtC,CAAC"}
1
+ {"version":3,"file":"secured-use-case.mixin.d.ts","sourceRoot":"","sources":["../../../src/authorization/secured-use-case/secured-use-case.mixin.ts"],"names":[],"mappings":"AAQA,OAAO,EAGL,yBAAyB,EAEzB,wBAAwB,EAEzB,MAAM,0BAA0B,CAAC;AAmLlC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,SAAS,wBAAwB,EACxE,QAAQ,UAAU,KACjB,yBAAyB,CAAC,UAAU,CAqCtC,CAAC"}