@eva_solutions/auth-sdk 0.0.0-stage → 3.0.0-dev-20261107051125
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/CHANGELOG.md +290 -0
- package/LICENSE +21 -0
- package/README.md +481 -2
- package/dist/admin/index.cjs +4 -0
- package/dist/admin/index.d.cts +2 -0
- package/dist/admin/index.d.ts +2 -0
- package/dist/admin/index.js +1 -0
- package/dist/admin-DjvuvuI8.js +408 -0
- package/dist/admin-DjvuvuI8.js.map +1 -0
- package/dist/admin-Q6lbWqLM.cjs +419 -0
- package/dist/admin-Q6lbWqLM.cjs.map +1 -0
- package/dist/api-path-2Ulruz7R.cjs +34 -0
- package/dist/api-path-2Ulruz7R.cjs.map +1 -0
- package/dist/api-path-B-vSkL2H.js +29 -0
- package/dist/api-path-B-vSkL2H.js.map +1 -0
- package/dist/auth-19r-Q6X2.js +84 -0
- package/dist/auth-19r-Q6X2.js.map +1 -0
- package/dist/auth-DX1N5JA4.cjs +131 -0
- package/dist/auth-DX1N5JA4.cjs.map +1 -0
- package/dist/auth-handlers-B3iJaPln.js +343 -0
- package/dist/auth-handlers-B3iJaPln.js.map +1 -0
- package/dist/auth-handlers-BTbXKJms.d.ts +15 -0
- package/dist/auth-handlers-BTbXKJms.d.ts.map +1 -0
- package/dist/auth-handlers-CDzGFDTu.cjs +404 -0
- package/dist/auth-handlers-CDzGFDTu.cjs.map +1 -0
- package/dist/auth-handlers-DRUUTEtW.d.cts +15 -0
- package/dist/auth-handlers-DRUUTEtW.d.cts.map +1 -0
- package/dist/catalog-CHPqldcj.cjs +172 -0
- package/dist/catalog-CHPqldcj.cjs.map +1 -0
- package/dist/catalog-CIqpzgsM.d.cts +75 -0
- package/dist/catalog-CIqpzgsM.d.cts.map +1 -0
- package/dist/catalog-CIqpzgsM.d.ts +75 -0
- package/dist/catalog-CIqpzgsM.d.ts.map +1 -0
- package/dist/catalog-DqPhtCKZ.js +95 -0
- package/dist/catalog-DqPhtCKZ.js.map +1 -0
- package/dist/config-D6Tr7ev6.d.cts +95 -0
- package/dist/config-D6Tr7ev6.d.cts.map +1 -0
- package/dist/config-rl4_-VAq.d.ts +95 -0
- package/dist/config-rl4_-VAq.d.ts.map +1 -0
- package/dist/constants-BE1_9Tod.cjs +52 -0
- package/dist/constants-BE1_9Tod.cjs.map +1 -0
- package/dist/constants-BY7QZokc.js +29 -0
- package/dist/constants-BY7QZokc.js.map +1 -0
- package/dist/constants-CcbhOaAP.cjs +153 -0
- package/dist/constants-CcbhOaAP.cjs.map +1 -0
- package/dist/constants-rNuD5qJn.js +94 -0
- package/dist/constants-rNuD5qJn.js.map +1 -0
- package/dist/contracts/index.cjs +1006 -0
- package/dist/contracts/index.cjs.map +1 -0
- package/dist/contracts/index.d.cts +488 -0
- package/dist/contracts/index.d.cts.map +1 -0
- package/dist/contracts/index.d.ts +488 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +817 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/cookies-DCIcr7uy.cjs +94 -0
- package/dist/cookies-DCIcr7uy.cjs.map +1 -0
- package/dist/cookies-DKEC7AWv.js +71 -0
- package/dist/cookies-DKEC7AWv.js.map +1 -0
- package/dist/delegated-token-CVNbMNfy.js +426 -0
- package/dist/delegated-token-CVNbMNfy.js.map +1 -0
- package/dist/delegated-token-DHSK4rHI.cjs +461 -0
- package/dist/delegated-token-DHSK4rHI.cjs.map +1 -0
- package/dist/error-helpers-BenWu-_u.d.ts +105 -0
- package/dist/error-helpers-BenWu-_u.d.ts.map +1 -0
- package/dist/error-helpers-KBHUbkOM.d.cts +105 -0
- package/dist/error-helpers-KBHUbkOM.d.cts.map +1 -0
- package/dist/error-helpers-XCh4ZJ-g.cjs +282 -0
- package/dist/error-helpers-XCh4ZJ-g.cjs.map +1 -0
- package/dist/error-helpers-lnwgNOw9.js +145 -0
- package/dist/error-helpers-lnwgNOw9.js.map +1 -0
- package/dist/error-messages-CGpW1fsg.d.cts +48 -0
- package/dist/error-messages-CGpW1fsg.d.cts.map +1 -0
- package/dist/error-messages-CGpW1fsg.d.ts +48 -0
- package/dist/error-messages-CGpW1fsg.d.ts.map +1 -0
- package/dist/event-codes-BBJHon-I.cjs +48 -0
- package/dist/event-codes-BBJHon-I.cjs.map +1 -0
- package/dist/event-codes-BgcJWsov.d.cts +42 -0
- package/dist/event-codes-BgcJWsov.d.cts.map +1 -0
- package/dist/event-codes-BgcJWsov.d.ts +42 -0
- package/dist/event-codes-BgcJWsov.d.ts.map +1 -0
- package/dist/event-codes-DR5_VlaR.js +43 -0
- package/dist/event-codes-DR5_VlaR.js.map +1 -0
- package/dist/generic/index.cjs +91 -0
- package/dist/generic/index.cjs.map +1 -0
- package/dist/generic/index.d.cts +27 -0
- package/dist/generic/index.d.cts.map +1 -0
- package/dist/generic/index.d.ts +27 -0
- package/dist/generic/index.d.ts.map +1 -0
- package/dist/generic/index.js +80 -0
- package/dist/generic/index.js.map +1 -0
- package/dist/hono/index.cjs +309 -0
- package/dist/hono/index.cjs.map +1 -0
- package/dist/hono/index.d.cts +272 -0
- package/dist/hono/index.d.cts.map +1 -0
- package/dist/hono/index.d.ts +272 -0
- package/dist/hono/index.d.ts.map +1 -0
- package/dist/hono/index.js +290 -0
- package/dist/hono/index.js.map +1 -0
- package/dist/hono-openapi/index.cjs +326 -0
- package/dist/hono-openapi/index.cjs.map +1 -0
- package/dist/hono-openapi/index.d.cts +14 -0
- package/dist/hono-openapi/index.d.cts.map +1 -0
- package/dist/hono-openapi/index.d.ts +14 -0
- package/dist/hono-openapi/index.d.ts.map +1 -0
- package/dist/hono-openapi/index.js +307 -0
- package/dist/hono-openapi/index.js.map +1 -0
- package/dist/http-client-BVF3iktR.cjs +211 -0
- package/dist/http-client-BVF3iktR.cjs.map +1 -0
- package/dist/http-client-Da0-OMfc.js +206 -0
- package/dist/http-client-Da0-OMfc.js.map +1 -0
- package/dist/index-BYzDaMR9.d.ts +312 -0
- package/dist/index-BYzDaMR9.d.ts.map +1 -0
- package/dist/index-CNNMCrdl.d.ts +66 -0
- package/dist/index-CNNMCrdl.d.ts.map +1 -0
- package/dist/index-DBZoLU4E.d.ts +240 -0
- package/dist/index-DBZoLU4E.d.ts.map +1 -0
- package/dist/index-DcvQWByo.d.cts +66 -0
- package/dist/index-DcvQWByo.d.cts.map +1 -0
- package/dist/index-Dold-Ycb.d.cts +1711 -0
- package/dist/index-Dold-Ycb.d.cts.map +1 -0
- package/dist/index-Dold-Ycb.d.ts +1711 -0
- package/dist/index-Dold-Ycb.d.ts.map +1 -0
- package/dist/index-jAO62-OD.d.cts +240 -0
- package/dist/index-jAO62-OD.d.cts.map +1 -0
- package/dist/index-o7nXcl7z.d.cts +312 -0
- package/dist/index-o7nXcl7z.d.cts.map +1 -0
- package/dist/index.cjs +89 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +114 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +114 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/jwt-BBNqk0TV.cjs +155 -0
- package/dist/jwt-BBNqk0TV.cjs.map +1 -0
- package/dist/jwt-DhqgH94B.js +150 -0
- package/dist/jwt-DhqgH94B.js.map +1 -0
- package/dist/key-resolver-CESqj4-P.cjs +45 -0
- package/dist/key-resolver-CESqj4-P.cjs.map +1 -0
- package/dist/key-resolver-D56I2Zpz.js +34 -0
- package/dist/key-resolver-D56I2Zpz.js.map +1 -0
- package/dist/parse-error-response-6qOQS5y9.cjs +316 -0
- package/dist/parse-error-response-6qOQS5y9.cjs.map +1 -0
- package/dist/parse-error-response-BM9-kjs0.js +239 -0
- package/dist/parse-error-response-BM9-kjs0.js.map +1 -0
- package/dist/path-segment-C25i6aaH.cjs +29 -0
- package/dist/path-segment-C25i6aaH.cjs.map +1 -0
- package/dist/path-segment-CyqnaFrP.js +24 -0
- package/dist/path-segment-CyqnaFrP.js.map +1 -0
- package/dist/react/index.cjs +336 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +151 -0
- package/dist/react/index.d.cts.map +1 -0
- package/dist/react/index.d.ts +151 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +300 -0
- package/dist/react/index.js.map +1 -0
- package/dist/refresh-dedup-CKaHHe7m.js +14 -0
- package/dist/refresh-dedup-CKaHHe7m.js.map +1 -0
- package/dist/refresh-dedup-CLdACQXR.cjs +19 -0
- package/dist/refresh-dedup-CLdACQXR.cjs.map +1 -0
- package/dist/rolldown-runtime-CmQyd0Gu.cjs +27 -0
- package/dist/routes-DpAzgY1V.cjs +424 -0
- package/dist/routes-DpAzgY1V.cjs.map +1 -0
- package/dist/routes-F1g5aVqP.js +347 -0
- package/dist/routes-F1g5aVqP.js.map +1 -0
- package/dist/s2s/index.cjs +24 -0
- package/dist/s2s/index.d.cts +5 -0
- package/dist/s2s/index.d.ts +5 -0
- package/dist/s2s/index.js +5 -0
- package/dist/s2s-6wbotr78.cjs +926 -0
- package/dist/s2s-6wbotr78.cjs.map +1 -0
- package/dist/s2s-B_0SIQzn.js +897 -0
- package/dist/s2s-B_0SIQzn.js.map +1 -0
- package/dist/sign-C7y6xdvT.cjs +324 -0
- package/dist/sign-C7y6xdvT.cjs.map +1 -0
- package/dist/sign-HFtcYwa-.js +259 -0
- package/dist/sign-HFtcYwa-.js.map +1 -0
- package/dist/tokens-C1nzkn21.cjs +232 -0
- package/dist/tokens-C1nzkn21.cjs.map +1 -0
- package/dist/tokens-C3Z40qd7.js +107 -0
- package/dist/tokens-C3Z40qd7.js.map +1 -0
- package/dist/types-B5sf7kKE.d.cts +52 -0
- package/dist/types-B5sf7kKE.d.cts.map +1 -0
- package/dist/types-CLOIHzRu.d.ts +96 -0
- package/dist/types-CLOIHzRu.d.ts.map +1 -0
- package/dist/types-CQTZdZIF.d.ts +52 -0
- package/dist/types-CQTZdZIF.d.ts.map +1 -0
- package/dist/types-DGeQ8j4k.d.cts +538 -0
- package/dist/types-DGeQ8j4k.d.cts.map +1 -0
- package/dist/types-DIUWza9-.d.ts +538 -0
- package/dist/types-DIUWza9-.d.ts.map +1 -0
- package/dist/types-qh6ANBCV.d.cts +96 -0
- package/dist/types-qh6ANBCV.d.cts.map +1 -0
- package/dist/webhooks/index.cjs +8 -0
- package/dist/webhooks/index.d.cts +5 -0
- package/dist/webhooks/index.d.ts +5 -0
- package/dist/webhooks/index.js +4 -0
- package/dist/webhooks-B5sAWC9W.js +74 -0
- package/dist/webhooks-B5sAWC9W.js.map +1 -0
- package/dist/webhooks-Cx11psg1.cjs +79 -0
- package/dist/webhooks-Cx11psg1.cjs.map +1 -0
- package/package.json +192 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-CHPqldcj.cjs","names":[],"sources":["../../auth-contracts/dist/catalog.js"],"sourcesContent":["// src/catalog.ts\n/**\n* PURE module: it must never reference `zod` or any schema module of this package (see\n* `constants.ts`). The closed catalog of service audiences and, for each, its permissions.\n*\n* Apart from `tokens.ts` and `constants.ts` on purpose: the SDK `react` entry is size-budgeted and\n* reaches `constants.ts` (header names), so nothing the browser does not need goes there. The SDK\n* `react` closure imports neither this catalog nor the token vocabulary; Auth uses\n* `isServiceAudience` to keep product slugs and service audiences apart.\n*/\n/**\n* Closed catalog of service audiences and, for each one, the permissions a service client can be\n* granted on it. The service token `aud` is one of these keys and its `scope` a subset of the\n* values. Add a permission here only together with the route that requires it.\n*\n* `admin` is NOT a permission of `auth-api`: the Auth admin surface authenticates with the signed\n* request of a service client flagged `esAdmin`, never with a token. It IS a permission of\n* `whatsapp-api`.\n*/\nconst SERVICE_AUDIENCE_SCOPES = {\n\t\"auth-api\": [\n\t\t\"users:read\",\n\t\t\"webhooks:read\",\n\t\t\"webhooks:write\",\n\t\t\"empresas:leer\",\n\t\t\"empresas:escribir\",\n\t\t\"tokens:exchange\",\n\t\t\"contrataciones:pedir\",\n\t\t\"contrataciones:escribir\",\n\t\t\"contrataciones:leer\",\n\t\t\"empresas:baja\",\n\t\t\"autorizaciones:escribir\",\n\t\t\"autorizaciones:leer\",\n\t\t\"directorio:leer\"\n\t],\n\t\"whatsapp-api\": [\n\t\t\"messages:send:text\",\n\t\t\"messages:send:media\",\n\t\t\"admin\"\n\t]\n};\n/** Service audiences as a tuple, so schemas can build an enum straight from it. */\nconst SERVICE_AUDIENCES = [\"auth-api\", \"whatsapp-api\"];\n/** True when `value` is an audience of the catalog. */\nfunction isServiceAudience(value) {\n\treturn Object.hasOwn(SERVICE_AUDIENCE_SCOPES, value);\n}\n/** True when `scope` is a permission of `audience` in the catalog (an unknown audience is false). */\nfunction isScopeOfAudience(audience, scope) {\n\treturn isServiceAudience(audience) && SERVICE_AUDIENCE_SCOPES[audience].includes(scope);\n}\n/**\n* Permissions a service client can DELEGATE on behalf of a user (token exchange), by destination\n* audience. A delegation edge (`service_client_delegations`) can only carry these.\n*\n* Narrower than {@link SERVICE_AUDIENCE_SCOPES} on purpose: `auth-api` is never a destination (Auth\n* is the issuer, so no delegated token talks to it) and `admin` is never delegable. A test pins both\n* and that every value is in the audience catalog.\n*/\nconst DELEGABLE_AUDIENCE_SCOPES = { \"whatsapp-api\": [\"messages:send:text\", \"messages:send:media\"] };\n/** Delegable audiences as a tuple, so schemas can build an enum straight from it. */\nconst DELEGABLE_AUDIENCES = [\"whatsapp-api\"];\n/** Every delegable permission of every audience, flat (a scope string names its audience's service). */\nconst DELEGABLE_SCOPES = Object.values(DELEGABLE_AUDIENCE_SCOPES).flat();\n/** True when `audience` can be the destination of a delegated token. */\nfunction isDelegableAudience(value) {\n\treturn Object.hasOwn(DELEGABLE_AUDIENCE_SCOPES, value);\n}\n/** True when `scope` can be delegated towards `audience` (an unknown or non-delegable audience is false). */\nfunction isDelegableScope(audience, scope) {\n\treturn isDelegableAudience(audience) && DELEGABLE_AUDIENCE_SCOPES[audience].includes(scope);\n}\n/**\n* Closed catalog of permissions BETWEEN companies (\"company B may do X on the data of company A\"),\n* by the service audience that owns the data. Kept apart from {@link SERVICE_AUDIENCE_SCOPES} on\n* purpose: those say what a service CLIENT can do, these say what a COMPANY authorizes another\n* company to do. They are only for private data; public or shared data needs none.\n*\n* Starts minimal and each owning service adds its own (together with the route that checks it).\n* `auth-api` owns none: it only stores and answers the grants.\n*/\nconst INTER_EMPRESA_PERMISSIONS = { \"whatsapp-api\": [\"whatsapp:mensajes:leer\"] };\n/** Every inter-company permission, flat, so schemas can build an enum straight from it. */\nconst INTER_EMPRESA_PERMISSION_LIST = Object.values(INTER_EMPRESA_PERMISSIONS).flat();\n/** True when `value` is a permission of the inter-company catalog. */\nfunction isInterEmpresaPermission(value) {\n\treturn INTER_EMPRESA_PERMISSION_LIST.includes(value);\n}\n/** The audience that owns `permission` (the only one that may verify it), or `undefined`. */\nfunction interEmpresaPermissionOwner(permission) {\n\treturn Object.keys(INTER_EMPRESA_PERMISSIONS).find((owner) => INTER_EMPRESA_PERMISSIONS[owner].includes(permission));\n}\nexport { DELEGABLE_AUDIENCES, DELEGABLE_AUDIENCE_SCOPES, DELEGABLE_SCOPES, INTER_EMPRESA_PERMISSIONS, INTER_EMPRESA_PERMISSION_LIST, SERVICE_AUDIENCES, SERVICE_AUDIENCE_SCOPES, interEmpresaPermissionOwner, isDelegableAudience, isDelegableScope, isInterEmpresaPermission, isScopeOfAudience, isServiceAudience };\n\n//# sourceMappingURL=catalog.js.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,MAAM,0BAA0B;CAC/B,YAAY;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD;CACA,gBAAgB;EACf;EACA;EACA;CACD;AACD;;AAEA,MAAM,oBAAoB,CAAC,YAAY,cAAc;;AAErD,SAAS,kBAAkB,OAAO;CACjC,OAAO,OAAO,OAAO,yBAAyB,KAAK;AACpD;;AAEA,SAAS,kBAAkB,UAAU,OAAO;CAC3C,OAAO,kBAAkB,QAAQ,KAAK,wBAAwB,SAAS,CAAC,SAAS,KAAK;AACvF;;;;;;;;;AASA,MAAM,4BAA4B,EAAE,gBAAgB,CAAC,sBAAsB,qBAAqB,EAAE;;AAElG,MAAM,sBAAsB,CAAC,cAAc;;AAE3C,MAAM,mBAAmB,OAAO,OAAO,yBAAyB,CAAC,CAAC,KAAK;;AAEvE,SAAS,oBAAoB,OAAO;CACnC,OAAO,OAAO,OAAO,2BAA2B,KAAK;AACtD;;AAEA,SAAS,iBAAiB,UAAU,OAAO;CAC1C,OAAO,oBAAoB,QAAQ,KAAK,0BAA0B,SAAS,CAAC,SAAS,KAAK;AAC3F;;;;;;;;;;AAUA,MAAM,4BAA4B,EAAE,gBAAgB,CAAC,wBAAwB,EAAE;;AAE/E,MAAM,gCAAgC,OAAO,OAAO,yBAAyB,CAAC,CAAC,KAAK;;AAEpF,SAAS,yBAAyB,OAAO;CACxC,OAAO,8BAA8B,SAAS,KAAK;AACpD;;AAEA,SAAS,4BAA4B,YAAY;CAChD,OAAO,OAAO,KAAK,yBAAyB,CAAC,CAAC,MAAM,UAAU,0BAA0B,MAAM,CAAC,SAAS,UAAU,CAAC;AACpH"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PURE module: it must never reference `zod` or any schema module of this package (see
|
|
3
|
+
* `constants.ts`). The closed catalog of service audiences and, for each, its permissions.
|
|
4
|
+
*
|
|
5
|
+
* Apart from `tokens.ts` and `constants.ts` on purpose: the SDK `react` entry is size-budgeted and
|
|
6
|
+
* reaches `constants.ts` (header names), so nothing the browser does not need goes there. The SDK
|
|
7
|
+
* `react` closure imports neither this catalog nor the token vocabulary; Auth uses
|
|
8
|
+
* `isServiceAudience` to keep product slugs and service audiences apart.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Closed catalog of service audiences and, for each one, the permissions a service client can be
|
|
12
|
+
* granted on it. The service token `aud` is one of these keys and its `scope` a subset of the
|
|
13
|
+
* values. Add a permission here only together with the route that requires it.
|
|
14
|
+
*
|
|
15
|
+
* `admin` is NOT a permission of `auth-api`: the Auth admin surface authenticates with the signed
|
|
16
|
+
* request of a service client flagged `esAdmin`, never with a token. It IS a permission of
|
|
17
|
+
* `whatsapp-api`.
|
|
18
|
+
*/
|
|
19
|
+
declare const SERVICE_AUDIENCE_SCOPES: {
|
|
20
|
+
readonly 'auth-api': readonly ["users:read", "webhooks:read", "webhooks:write", "empresas:leer", "empresas:escribir", "tokens:exchange", "contrataciones:pedir", "contrataciones:escribir", "contrataciones:leer", "empresas:baja", "autorizaciones:escribir", "autorizaciones:leer", "directorio:leer"];
|
|
21
|
+
readonly 'whatsapp-api': readonly ["messages:send:text", "messages:send:media", "admin"];
|
|
22
|
+
};
|
|
23
|
+
type ServiceAudience = keyof typeof SERVICE_AUDIENCE_SCOPES;
|
|
24
|
+
/** Service audiences as a tuple, so schemas can build an enum straight from it. */
|
|
25
|
+
declare const SERVICE_AUDIENCES: readonly ["auth-api", "whatsapp-api"];
|
|
26
|
+
type ServiceScope<A extends ServiceAudience = ServiceAudience> = (typeof SERVICE_AUDIENCE_SCOPES)[A][number];
|
|
27
|
+
/** True when `value` is an audience of the catalog. */
|
|
28
|
+
declare function isServiceAudience(value: string): value is ServiceAudience;
|
|
29
|
+
/** True when `scope` is a permission of `audience` in the catalog (an unknown audience is false). */
|
|
30
|
+
declare function isScopeOfAudience(audience: string, scope: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Permissions a service client can DELEGATE on behalf of a user (token exchange), by destination
|
|
33
|
+
* audience. A delegation edge (`service_client_delegations`) can only carry these.
|
|
34
|
+
*
|
|
35
|
+
* Narrower than {@link SERVICE_AUDIENCE_SCOPES} on purpose: `auth-api` is never a destination (Auth
|
|
36
|
+
* is the issuer, so no delegated token talks to it) and `admin` is never delegable. A test pins both
|
|
37
|
+
* and that every value is in the audience catalog.
|
|
38
|
+
*/
|
|
39
|
+
declare const DELEGABLE_AUDIENCE_SCOPES: {
|
|
40
|
+
readonly 'whatsapp-api': readonly ["messages:send:text", "messages:send:media"];
|
|
41
|
+
};
|
|
42
|
+
/** Audiences that can be the destination of a delegated token. */
|
|
43
|
+
type DelegableAudience = keyof typeof DELEGABLE_AUDIENCE_SCOPES;
|
|
44
|
+
/** Delegable audiences as a tuple, so schemas can build an enum straight from it. */
|
|
45
|
+
declare const DELEGABLE_AUDIENCES: readonly ["whatsapp-api"];
|
|
46
|
+
type DelegableScope<A extends DelegableAudience = DelegableAudience> = (typeof DELEGABLE_AUDIENCE_SCOPES)[A][number];
|
|
47
|
+
/** Every delegable permission of every audience, flat (a scope string names its audience's service). */
|
|
48
|
+
declare const DELEGABLE_SCOPES: readonly [DelegableScope, ...DelegableScope[]];
|
|
49
|
+
/** True when `audience` can be the destination of a delegated token. */
|
|
50
|
+
declare function isDelegableAudience(value: string): value is DelegableAudience;
|
|
51
|
+
/** True when `scope` can be delegated towards `audience` (an unknown or non-delegable audience is false). */
|
|
52
|
+
declare function isDelegableScope(audience: string, scope: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Closed catalog of permissions BETWEEN companies ("company B may do X on the data of company A"),
|
|
55
|
+
* by the service audience that owns the data. Kept apart from {@link SERVICE_AUDIENCE_SCOPES} on
|
|
56
|
+
* purpose: those say what a service CLIENT can do, these say what a COMPANY authorizes another
|
|
57
|
+
* company to do. They are only for private data; public or shared data needs none.
|
|
58
|
+
*
|
|
59
|
+
* Starts minimal and each owning service adds its own (together with the route that checks it).
|
|
60
|
+
* `auth-api` owns none: it only stores and answers the grants.
|
|
61
|
+
*/
|
|
62
|
+
declare const INTER_EMPRESA_PERMISSIONS: {
|
|
63
|
+
readonly 'whatsapp-api': readonly ["whatsapp:mensajes:leer"];
|
|
64
|
+
};
|
|
65
|
+
/** Audience that owns a block of inter-company permissions. */
|
|
66
|
+
type InterEmpresaOwner = keyof typeof INTER_EMPRESA_PERMISSIONS;
|
|
67
|
+
type InterEmpresaPermission = (typeof INTER_EMPRESA_PERMISSIONS)[InterEmpresaOwner][number];
|
|
68
|
+
/** Every inter-company permission, flat, so schemas can build an enum straight from it. */
|
|
69
|
+
declare const INTER_EMPRESA_PERMISSION_LIST: readonly [InterEmpresaPermission, ...InterEmpresaPermission[]];
|
|
70
|
+
/** True when `value` is a permission of the inter-company catalog. */
|
|
71
|
+
declare function isInterEmpresaPermission(value: string): value is InterEmpresaPermission;
|
|
72
|
+
/** The audience that owns `permission` (the only one that may verify it), or `undefined`. */
|
|
73
|
+
declare function interEmpresaPermissionOwner(permission: string): InterEmpresaOwner | undefined;
|
|
74
|
+
export { isInterEmpresaPermission as _, DelegableScope as a, InterEmpresaOwner as c, SERVICE_AUDIENCE_SCOPES as d, ServiceAudience as f, isDelegableScope as g, isDelegableAudience as h, DelegableAudience as i, InterEmpresaPermission as l, interEmpresaPermissionOwner as m, DELEGABLE_AUDIENCE_SCOPES as n, INTER_EMPRESA_PERMISSIONS as o, ServiceScope as p, DELEGABLE_SCOPES as r, INTER_EMPRESA_PERMISSION_LIST as s, DELEGABLE_AUDIENCES as t, SERVICE_AUDIENCES as u, isScopeOfAudience as v, isServiceAudience as y };
|
|
75
|
+
//# sourceMappingURL=catalog-CIqpzgsM.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-CIqpzgsM.d.cts","names":[],"sources":["../../auth-contracts/dist/catalog.d.ts"],"mappings":";;;;;;;;;;;;;;;;;;cAkBc;WACH;WACA;;KAEN,+BAA+B;;cAEtB;KACT,aAAa,UAAU,kBAAkB,2BAA2B,yBAAyB;;iBAEjF,kBAAkB,gBAAgB,SAAS;;iBAE3C,kBAAkB,kBAAkB;;;;;;;;;cASvC;WACH;;;KAGN,iCAAiC;;cAExB;KACT,eAAe,UAAU,oBAAoB,6BAA6B,2BAA2B;;cAE5F,4BAA4B,mBAAmB;;iBAE5C,oBAAoB,gBAAgB,SAAS;;iBAE7C,iBAAiB,kBAAkB;;;;;;;;;;cAUtC;WACH;;;KAGN,iCAAiC;KACjC,iCAAiC,2BAA2B;;cAEnD,yCAAyC,2BAA2B;;iBAEjE,yBAAyB,gBAAgB,SAAS;;iBAElD,4BAA4B,qBAAqB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PURE module: it must never reference `zod` or any schema module of this package (see
|
|
3
|
+
* `constants.ts`). The closed catalog of service audiences and, for each, its permissions.
|
|
4
|
+
*
|
|
5
|
+
* Apart from `tokens.ts` and `constants.ts` on purpose: the SDK `react` entry is size-budgeted and
|
|
6
|
+
* reaches `constants.ts` (header names), so nothing the browser does not need goes there. The SDK
|
|
7
|
+
* `react` closure imports neither this catalog nor the token vocabulary; Auth uses
|
|
8
|
+
* `isServiceAudience` to keep product slugs and service audiences apart.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Closed catalog of service audiences and, for each one, the permissions a service client can be
|
|
12
|
+
* granted on it. The service token `aud` is one of these keys and its `scope` a subset of the
|
|
13
|
+
* values. Add a permission here only together with the route that requires it.
|
|
14
|
+
*
|
|
15
|
+
* `admin` is NOT a permission of `auth-api`: the Auth admin surface authenticates with the signed
|
|
16
|
+
* request of a service client flagged `esAdmin`, never with a token. It IS a permission of
|
|
17
|
+
* `whatsapp-api`.
|
|
18
|
+
*/
|
|
19
|
+
declare const SERVICE_AUDIENCE_SCOPES: {
|
|
20
|
+
readonly 'auth-api': readonly ["users:read", "webhooks:read", "webhooks:write", "empresas:leer", "empresas:escribir", "tokens:exchange", "contrataciones:pedir", "contrataciones:escribir", "contrataciones:leer", "empresas:baja", "autorizaciones:escribir", "autorizaciones:leer", "directorio:leer"];
|
|
21
|
+
readonly 'whatsapp-api': readonly ["messages:send:text", "messages:send:media", "admin"];
|
|
22
|
+
};
|
|
23
|
+
type ServiceAudience = keyof typeof SERVICE_AUDIENCE_SCOPES;
|
|
24
|
+
/** Service audiences as a tuple, so schemas can build an enum straight from it. */
|
|
25
|
+
declare const SERVICE_AUDIENCES: readonly ["auth-api", "whatsapp-api"];
|
|
26
|
+
type ServiceScope<A extends ServiceAudience = ServiceAudience> = (typeof SERVICE_AUDIENCE_SCOPES)[A][number];
|
|
27
|
+
/** True when `value` is an audience of the catalog. */
|
|
28
|
+
declare function isServiceAudience(value: string): value is ServiceAudience;
|
|
29
|
+
/** True when `scope` is a permission of `audience` in the catalog (an unknown audience is false). */
|
|
30
|
+
declare function isScopeOfAudience(audience: string, scope: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Permissions a service client can DELEGATE on behalf of a user (token exchange), by destination
|
|
33
|
+
* audience. A delegation edge (`service_client_delegations`) can only carry these.
|
|
34
|
+
*
|
|
35
|
+
* Narrower than {@link SERVICE_AUDIENCE_SCOPES} on purpose: `auth-api` is never a destination (Auth
|
|
36
|
+
* is the issuer, so no delegated token talks to it) and `admin` is never delegable. A test pins both
|
|
37
|
+
* and that every value is in the audience catalog.
|
|
38
|
+
*/
|
|
39
|
+
declare const DELEGABLE_AUDIENCE_SCOPES: {
|
|
40
|
+
readonly 'whatsapp-api': readonly ["messages:send:text", "messages:send:media"];
|
|
41
|
+
};
|
|
42
|
+
/** Audiences that can be the destination of a delegated token. */
|
|
43
|
+
type DelegableAudience = keyof typeof DELEGABLE_AUDIENCE_SCOPES;
|
|
44
|
+
/** Delegable audiences as a tuple, so schemas can build an enum straight from it. */
|
|
45
|
+
declare const DELEGABLE_AUDIENCES: readonly ["whatsapp-api"];
|
|
46
|
+
type DelegableScope<A extends DelegableAudience = DelegableAudience> = (typeof DELEGABLE_AUDIENCE_SCOPES)[A][number];
|
|
47
|
+
/** Every delegable permission of every audience, flat (a scope string names its audience's service). */
|
|
48
|
+
declare const DELEGABLE_SCOPES: readonly [DelegableScope, ...DelegableScope[]];
|
|
49
|
+
/** True when `audience` can be the destination of a delegated token. */
|
|
50
|
+
declare function isDelegableAudience(value: string): value is DelegableAudience;
|
|
51
|
+
/** True when `scope` can be delegated towards `audience` (an unknown or non-delegable audience is false). */
|
|
52
|
+
declare function isDelegableScope(audience: string, scope: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Closed catalog of permissions BETWEEN companies ("company B may do X on the data of company A"),
|
|
55
|
+
* by the service audience that owns the data. Kept apart from {@link SERVICE_AUDIENCE_SCOPES} on
|
|
56
|
+
* purpose: those say what a service CLIENT can do, these say what a COMPANY authorizes another
|
|
57
|
+
* company to do. They are only for private data; public or shared data needs none.
|
|
58
|
+
*
|
|
59
|
+
* Starts minimal and each owning service adds its own (together with the route that checks it).
|
|
60
|
+
* `auth-api` owns none: it only stores and answers the grants.
|
|
61
|
+
*/
|
|
62
|
+
declare const INTER_EMPRESA_PERMISSIONS: {
|
|
63
|
+
readonly 'whatsapp-api': readonly ["whatsapp:mensajes:leer"];
|
|
64
|
+
};
|
|
65
|
+
/** Audience that owns a block of inter-company permissions. */
|
|
66
|
+
type InterEmpresaOwner = keyof typeof INTER_EMPRESA_PERMISSIONS;
|
|
67
|
+
type InterEmpresaPermission = (typeof INTER_EMPRESA_PERMISSIONS)[InterEmpresaOwner][number];
|
|
68
|
+
/** Every inter-company permission, flat, so schemas can build an enum straight from it. */
|
|
69
|
+
declare const INTER_EMPRESA_PERMISSION_LIST: readonly [InterEmpresaPermission, ...InterEmpresaPermission[]];
|
|
70
|
+
/** True when `value` is a permission of the inter-company catalog. */
|
|
71
|
+
declare function isInterEmpresaPermission(value: string): value is InterEmpresaPermission;
|
|
72
|
+
/** The audience that owns `permission` (the only one that may verify it), or `undefined`. */
|
|
73
|
+
declare function interEmpresaPermissionOwner(permission: string): InterEmpresaOwner | undefined;
|
|
74
|
+
export { isInterEmpresaPermission as _, DelegableScope as a, InterEmpresaOwner as c, SERVICE_AUDIENCE_SCOPES as d, ServiceAudience as f, isDelegableScope as g, isDelegableAudience as h, DelegableAudience as i, InterEmpresaPermission as l, interEmpresaPermissionOwner as m, DELEGABLE_AUDIENCE_SCOPES as n, INTER_EMPRESA_PERMISSIONS as o, ServiceScope as p, DELEGABLE_SCOPES as r, INTER_EMPRESA_PERMISSION_LIST as s, DELEGABLE_AUDIENCES as t, SERVICE_AUDIENCES as u, isScopeOfAudience as v, isServiceAudience as y };
|
|
75
|
+
//# sourceMappingURL=catalog-CIqpzgsM.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-CIqpzgsM.d.ts","names":[],"sources":["../../auth-contracts/dist/catalog.d.ts"],"mappings":";;;;;;;;;;;;;;;;;;cAkBc;WACH;WACA;;KAEN,+BAA+B;;cAEtB;KACT,aAAa,UAAU,kBAAkB,2BAA2B,yBAAyB;;iBAEjF,kBAAkB,gBAAgB,SAAS;;iBAE3C,kBAAkB,kBAAkB;;;;;;;;;cASvC;WACH;;;KAGN,iCAAiC;;cAExB;KACT,eAAe,UAAU,oBAAoB,6BAA6B,2BAA2B;;cAE5F,4BAA4B,mBAAmB;;iBAE5C,oBAAoB,gBAAgB,SAAS;;iBAE7C,iBAAiB,kBAAkB;;;;;;;;;;cAUtC;WACH;;;KAGN,iCAAiC;KACjC,iCAAiC,2BAA2B;;cAEnD,yCAAyC,2BAA2B;;iBAEjE,yBAAyB,gBAAgB,SAAS;;iBAElD,4BAA4B,qBAAqB"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// ../auth-contracts/dist/catalog.js
|
|
2
|
+
/**
|
|
3
|
+
* PURE module: it must never reference `zod` or any schema module of this package (see
|
|
4
|
+
* `constants.ts`). The closed catalog of service audiences and, for each, its permissions.
|
|
5
|
+
*
|
|
6
|
+
* Apart from `tokens.ts` and `constants.ts` on purpose: the SDK `react` entry is size-budgeted and
|
|
7
|
+
* reaches `constants.ts` (header names), so nothing the browser does not need goes there. The SDK
|
|
8
|
+
* `react` closure imports neither this catalog nor the token vocabulary; Auth uses
|
|
9
|
+
* `isServiceAudience` to keep product slugs and service audiences apart.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Closed catalog of service audiences and, for each one, the permissions a service client can be
|
|
13
|
+
* granted on it. The service token `aud` is one of these keys and its `scope` a subset of the
|
|
14
|
+
* values. Add a permission here only together with the route that requires it.
|
|
15
|
+
*
|
|
16
|
+
* `admin` is NOT a permission of `auth-api`: the Auth admin surface authenticates with the signed
|
|
17
|
+
* request of a service client flagged `esAdmin`, never with a token. It IS a permission of
|
|
18
|
+
* `whatsapp-api`.
|
|
19
|
+
*/
|
|
20
|
+
const SERVICE_AUDIENCE_SCOPES = {
|
|
21
|
+
"auth-api": [
|
|
22
|
+
"users:read",
|
|
23
|
+
"webhooks:read",
|
|
24
|
+
"webhooks:write",
|
|
25
|
+
"empresas:leer",
|
|
26
|
+
"empresas:escribir",
|
|
27
|
+
"tokens:exchange",
|
|
28
|
+
"contrataciones:pedir",
|
|
29
|
+
"contrataciones:escribir",
|
|
30
|
+
"contrataciones:leer",
|
|
31
|
+
"empresas:baja",
|
|
32
|
+
"autorizaciones:escribir",
|
|
33
|
+
"autorizaciones:leer",
|
|
34
|
+
"directorio:leer"
|
|
35
|
+
],
|
|
36
|
+
"whatsapp-api": [
|
|
37
|
+
"messages:send:text",
|
|
38
|
+
"messages:send:media",
|
|
39
|
+
"admin"
|
|
40
|
+
]
|
|
41
|
+
};
|
|
42
|
+
/** Service audiences as a tuple, so schemas can build an enum straight from it. */
|
|
43
|
+
const SERVICE_AUDIENCES = ["auth-api", "whatsapp-api"];
|
|
44
|
+
/** True when `value` is an audience of the catalog. */
|
|
45
|
+
function isServiceAudience(value) {
|
|
46
|
+
return Object.hasOwn(SERVICE_AUDIENCE_SCOPES, value);
|
|
47
|
+
}
|
|
48
|
+
/** True when `scope` is a permission of `audience` in the catalog (an unknown audience is false). */
|
|
49
|
+
function isScopeOfAudience(audience, scope) {
|
|
50
|
+
return isServiceAudience(audience) && SERVICE_AUDIENCE_SCOPES[audience].includes(scope);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Permissions a service client can DELEGATE on behalf of a user (token exchange), by destination
|
|
54
|
+
* audience. A delegation edge (`service_client_delegations`) can only carry these.
|
|
55
|
+
*
|
|
56
|
+
* Narrower than {@link SERVICE_AUDIENCE_SCOPES} on purpose: `auth-api` is never a destination (Auth
|
|
57
|
+
* is the issuer, so no delegated token talks to it) and `admin` is never delegable. A test pins both
|
|
58
|
+
* and that every value is in the audience catalog.
|
|
59
|
+
*/
|
|
60
|
+
const DELEGABLE_AUDIENCE_SCOPES = { "whatsapp-api": ["messages:send:text", "messages:send:media"] };
|
|
61
|
+
/** Delegable audiences as a tuple, so schemas can build an enum straight from it. */
|
|
62
|
+
const DELEGABLE_AUDIENCES = ["whatsapp-api"];
|
|
63
|
+
/** Every delegable permission of every audience, flat (a scope string names its audience's service). */
|
|
64
|
+
const DELEGABLE_SCOPES = Object.values(DELEGABLE_AUDIENCE_SCOPES).flat();
|
|
65
|
+
/** True when `audience` can be the destination of a delegated token. */
|
|
66
|
+
function isDelegableAudience(value) {
|
|
67
|
+
return Object.hasOwn(DELEGABLE_AUDIENCE_SCOPES, value);
|
|
68
|
+
}
|
|
69
|
+
/** True when `scope` can be delegated towards `audience` (an unknown or non-delegable audience is false). */
|
|
70
|
+
function isDelegableScope(audience, scope) {
|
|
71
|
+
return isDelegableAudience(audience) && DELEGABLE_AUDIENCE_SCOPES[audience].includes(scope);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Closed catalog of permissions BETWEEN companies ("company B may do X on the data of company A"),
|
|
75
|
+
* by the service audience that owns the data. Kept apart from {@link SERVICE_AUDIENCE_SCOPES} on
|
|
76
|
+
* purpose: those say what a service CLIENT can do, these say what a COMPANY authorizes another
|
|
77
|
+
* company to do. They are only for private data; public or shared data needs none.
|
|
78
|
+
*
|
|
79
|
+
* Starts minimal and each owning service adds its own (together with the route that checks it).
|
|
80
|
+
* `auth-api` owns none: it only stores and answers the grants.
|
|
81
|
+
*/
|
|
82
|
+
const INTER_EMPRESA_PERMISSIONS = { "whatsapp-api": ["whatsapp:mensajes:leer"] };
|
|
83
|
+
/** Every inter-company permission, flat, so schemas can build an enum straight from it. */
|
|
84
|
+
const INTER_EMPRESA_PERMISSION_LIST = Object.values(INTER_EMPRESA_PERMISSIONS).flat();
|
|
85
|
+
/** True when `value` is a permission of the inter-company catalog. */
|
|
86
|
+
function isInterEmpresaPermission(value) {
|
|
87
|
+
return INTER_EMPRESA_PERMISSION_LIST.includes(value);
|
|
88
|
+
}
|
|
89
|
+
/** The audience that owns `permission` (the only one that may verify it), or `undefined`. */
|
|
90
|
+
function interEmpresaPermissionOwner(permission) {
|
|
91
|
+
return Object.keys(INTER_EMPRESA_PERMISSIONS).find((owner) => INTER_EMPRESA_PERMISSIONS[owner].includes(permission));
|
|
92
|
+
}
|
|
93
|
+
export { INTER_EMPRESA_PERMISSION_LIST as a, interEmpresaPermissionOwner as c, isInterEmpresaPermission as d, isScopeOfAudience as f, INTER_EMPRESA_PERMISSIONS as i, isDelegableAudience as l, DELEGABLE_AUDIENCE_SCOPES as n, SERVICE_AUDIENCES as o, isServiceAudience as p, DELEGABLE_SCOPES as r, SERVICE_AUDIENCE_SCOPES as s, DELEGABLE_AUDIENCES as t, isDelegableScope as u };
|
|
94
|
+
|
|
95
|
+
//# sourceMappingURL=catalog-DqPhtCKZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-DqPhtCKZ.js","names":[],"sources":["../../auth-contracts/dist/catalog.js"],"sourcesContent":["// src/catalog.ts\n/**\n* PURE module: it must never reference `zod` or any schema module of this package (see\n* `constants.ts`). The closed catalog of service audiences and, for each, its permissions.\n*\n* Apart from `tokens.ts` and `constants.ts` on purpose: the SDK `react` entry is size-budgeted and\n* reaches `constants.ts` (header names), so nothing the browser does not need goes there. The SDK\n* `react` closure imports neither this catalog nor the token vocabulary; Auth uses\n* `isServiceAudience` to keep product slugs and service audiences apart.\n*/\n/**\n* Closed catalog of service audiences and, for each one, the permissions a service client can be\n* granted on it. The service token `aud` is one of these keys and its `scope` a subset of the\n* values. Add a permission here only together with the route that requires it.\n*\n* `admin` is NOT a permission of `auth-api`: the Auth admin surface authenticates with the signed\n* request of a service client flagged `esAdmin`, never with a token. It IS a permission of\n* `whatsapp-api`.\n*/\nconst SERVICE_AUDIENCE_SCOPES = {\n\t\"auth-api\": [\n\t\t\"users:read\",\n\t\t\"webhooks:read\",\n\t\t\"webhooks:write\",\n\t\t\"empresas:leer\",\n\t\t\"empresas:escribir\",\n\t\t\"tokens:exchange\",\n\t\t\"contrataciones:pedir\",\n\t\t\"contrataciones:escribir\",\n\t\t\"contrataciones:leer\",\n\t\t\"empresas:baja\",\n\t\t\"autorizaciones:escribir\",\n\t\t\"autorizaciones:leer\",\n\t\t\"directorio:leer\"\n\t],\n\t\"whatsapp-api\": [\n\t\t\"messages:send:text\",\n\t\t\"messages:send:media\",\n\t\t\"admin\"\n\t]\n};\n/** Service audiences as a tuple, so schemas can build an enum straight from it. */\nconst SERVICE_AUDIENCES = [\"auth-api\", \"whatsapp-api\"];\n/** True when `value` is an audience of the catalog. */\nfunction isServiceAudience(value) {\n\treturn Object.hasOwn(SERVICE_AUDIENCE_SCOPES, value);\n}\n/** True when `scope` is a permission of `audience` in the catalog (an unknown audience is false). */\nfunction isScopeOfAudience(audience, scope) {\n\treturn isServiceAudience(audience) && SERVICE_AUDIENCE_SCOPES[audience].includes(scope);\n}\n/**\n* Permissions a service client can DELEGATE on behalf of a user (token exchange), by destination\n* audience. A delegation edge (`service_client_delegations`) can only carry these.\n*\n* Narrower than {@link SERVICE_AUDIENCE_SCOPES} on purpose: `auth-api` is never a destination (Auth\n* is the issuer, so no delegated token talks to it) and `admin` is never delegable. A test pins both\n* and that every value is in the audience catalog.\n*/\nconst DELEGABLE_AUDIENCE_SCOPES = { \"whatsapp-api\": [\"messages:send:text\", \"messages:send:media\"] };\n/** Delegable audiences as a tuple, so schemas can build an enum straight from it. */\nconst DELEGABLE_AUDIENCES = [\"whatsapp-api\"];\n/** Every delegable permission of every audience, flat (a scope string names its audience's service). */\nconst DELEGABLE_SCOPES = Object.values(DELEGABLE_AUDIENCE_SCOPES).flat();\n/** True when `audience` can be the destination of a delegated token. */\nfunction isDelegableAudience(value) {\n\treturn Object.hasOwn(DELEGABLE_AUDIENCE_SCOPES, value);\n}\n/** True when `scope` can be delegated towards `audience` (an unknown or non-delegable audience is false). */\nfunction isDelegableScope(audience, scope) {\n\treturn isDelegableAudience(audience) && DELEGABLE_AUDIENCE_SCOPES[audience].includes(scope);\n}\n/**\n* Closed catalog of permissions BETWEEN companies (\"company B may do X on the data of company A\"),\n* by the service audience that owns the data. Kept apart from {@link SERVICE_AUDIENCE_SCOPES} on\n* purpose: those say what a service CLIENT can do, these say what a COMPANY authorizes another\n* company to do. They are only for private data; public or shared data needs none.\n*\n* Starts minimal and each owning service adds its own (together with the route that checks it).\n* `auth-api` owns none: it only stores and answers the grants.\n*/\nconst INTER_EMPRESA_PERMISSIONS = { \"whatsapp-api\": [\"whatsapp:mensajes:leer\"] };\n/** Every inter-company permission, flat, so schemas can build an enum straight from it. */\nconst INTER_EMPRESA_PERMISSION_LIST = Object.values(INTER_EMPRESA_PERMISSIONS).flat();\n/** True when `value` is a permission of the inter-company catalog. */\nfunction isInterEmpresaPermission(value) {\n\treturn INTER_EMPRESA_PERMISSION_LIST.includes(value);\n}\n/** The audience that owns `permission` (the only one that may verify it), or `undefined`. */\nfunction interEmpresaPermissionOwner(permission) {\n\treturn Object.keys(INTER_EMPRESA_PERMISSIONS).find((owner) => INTER_EMPRESA_PERMISSIONS[owner].includes(permission));\n}\nexport { DELEGABLE_AUDIENCES, DELEGABLE_AUDIENCE_SCOPES, DELEGABLE_SCOPES, INTER_EMPRESA_PERMISSIONS, INTER_EMPRESA_PERMISSION_LIST, SERVICE_AUDIENCES, SERVICE_AUDIENCE_SCOPES, interEmpresaPermissionOwner, isDelegableAudience, isDelegableScope, isInterEmpresaPermission, isScopeOfAudience, isServiceAudience };\n\n//# sourceMappingURL=catalog.js.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,MAAM,0BAA0B;CAC/B,YAAY;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD;CACA,gBAAgB;EACf;EACA;EACA;CACD;AACD;;AAEA,MAAM,oBAAoB,CAAC,YAAY,cAAc;;AAErD,SAAS,kBAAkB,OAAO;CACjC,OAAO,OAAO,OAAO,yBAAyB,KAAK;AACpD;;AAEA,SAAS,kBAAkB,UAAU,OAAO;CAC3C,OAAO,kBAAkB,QAAQ,KAAK,wBAAwB,SAAS,CAAC,SAAS,KAAK;AACvF;;;;;;;;;AASA,MAAM,4BAA4B,EAAE,gBAAgB,CAAC,sBAAsB,qBAAqB,EAAE;;AAElG,MAAM,sBAAsB,CAAC,cAAc;;AAE3C,MAAM,mBAAmB,OAAO,OAAO,yBAAyB,CAAC,CAAC,KAAK;;AAEvE,SAAS,oBAAoB,OAAO;CACnC,OAAO,OAAO,OAAO,2BAA2B,KAAK;AACtD;;AAEA,SAAS,iBAAiB,UAAU,OAAO;CAC1C,OAAO,oBAAoB,QAAQ,KAAK,0BAA0B,SAAS,CAAC,SAAS,KAAK;AAC3F;;;;;;;;;;AAUA,MAAM,4BAA4B,EAAE,gBAAgB,CAAC,wBAAwB,EAAE;;AAE/E,MAAM,gCAAgC,OAAO,OAAO,yBAAyB,CAAC,CAAC,KAAK;;AAEpF,SAAS,yBAAyB,OAAO;CACxC,OAAO,8BAA8B,SAAS,KAAK;AACpD;;AAEA,SAAS,4BAA4B,YAAY;CAChD,OAAO,OAAO,KAAK,yBAAyB,CAAC,CAAC,MAAM,UAAU,0BAA0B,MAAM,CAAC,SAAS,UAAU,CAAC;AACpH"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import "./index-Dold-Ycb.cjs";
|
|
2
|
+
import { f as TokenPair } from "./types-qh6ANBCV.cjs";
|
|
3
|
+
import { n as EvaErrorMessages } from "./error-messages-CGpW1fsg.cjs";
|
|
4
|
+
declare function readTokensFromCookies(cookieHeader: string | null): Partial<TokenPair>;
|
|
5
|
+
declare function setTokenCookies(tokens: TokenPair): string[];
|
|
6
|
+
declare function clearTokenCookies(): string[];
|
|
7
|
+
/**
|
|
8
|
+
* Nombres de las cookies de sesión del producto configurado: `eva_<producto>_access_token` y
|
|
9
|
+
* `eva_<producto>_refresh_token`. Dos productos bajo el mismo dominio padre no se pisan.
|
|
10
|
+
* @throws Error de configuración (`EvaAuthConfigError`) si falta `configureEvaAuth({ product })`.
|
|
11
|
+
*/
|
|
12
|
+
declare const getCookieNames: () => {
|
|
13
|
+
readonly ACCESS_TOKEN: string;
|
|
14
|
+
readonly REFRESH_TOKEN: string;
|
|
15
|
+
};
|
|
16
|
+
declare const COOKIE_MAX_AGE: {
|
|
17
|
+
readonly ACCESS_TOKEN: number;
|
|
18
|
+
readonly REFRESH_TOKEN: number;
|
|
19
|
+
};
|
|
20
|
+
/** Issuer y algoritmo de los tokens. La audiencia de usuario es el producto configurado. */
|
|
21
|
+
declare const JWT_CONFIG: {
|
|
22
|
+
readonly ISSUER: "auth-service";
|
|
23
|
+
readonly ALGORITHM: "ES256";
|
|
24
|
+
};
|
|
25
|
+
interface ConfigureEvaAuthOptions {
|
|
26
|
+
/**
|
|
27
|
+
* URL base del Auth Service. Obligatoria antes del primer uso que la necesite
|
|
28
|
+
* (`authFetch`, JWKS): si falta, esos usos lanzan `EvaAuthConfigError`.
|
|
29
|
+
* Acepta https, o http solo en loopback (localhost, 127.0.0.1, [::1]); admite path
|
|
30
|
+
* (`https://host/auth`). Rechaza userinfo, query y fragmento (incluidos `?` y `#` solitarios).
|
|
31
|
+
* Se normaliza (host en minúsculas, sin `/` final) y es inmutable: reconfigurar con el mismo
|
|
32
|
+
* valor normalizado es no-op; con otro valor lanza Error.
|
|
33
|
+
* Si se omite (undefined), no valida ni modifica el valor previo.
|
|
34
|
+
* @throws Error si la URL es inválida o difiere de la ya configurada.
|
|
35
|
+
*/
|
|
36
|
+
authUrl?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Slug del producto de este consumidor (`whatsapp-panel`). Obligatorio **solo** si se usan las
|
|
39
|
+
* rutas de login, las cookies de sesión o `verifyAccessToken`: da el nombre de las cookies
|
|
40
|
+
* (`eva_<producto>_access_token`), la audiencia (`aud`) que exige `verifyAccessToken` y el
|
|
41
|
+
* `producto` que viaja en el login. Un servicio que solo verifica tokens de servicio no lo necesita.
|
|
42
|
+
* Debe ser un slug (`^[a-z][a-z0-9-]{2,63}$`).
|
|
43
|
+
* Es inmutable: reconfigurar el mismo valor es no-op; con otro valor lanza Error.
|
|
44
|
+
* Si se omite (undefined), no valida ni modifica el valor previo.
|
|
45
|
+
* @throws Error si el slug es inválido o difiere del ya configurado.
|
|
46
|
+
*/
|
|
47
|
+
product?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Domain para Set-Cookie. Validada contra header injection (;, \r, \n).
|
|
50
|
+
* Si se omite (undefined), NO resetea el valor previo.
|
|
51
|
+
* Recomendado: '.miempresa.com' para compartir entre subdominios.
|
|
52
|
+
*/
|
|
53
|
+
cookieDomain?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Mensajes de error que el SDK escribe en respuestas 4xx.
|
|
56
|
+
* Override granular: keys no provistas mantienen el default.
|
|
57
|
+
* Si se omite (undefined), NO resetea el valor previo.
|
|
58
|
+
* `""` se respeta como override explícito (no cae al default).
|
|
59
|
+
* @throws Error si alguna key es desconocida o si algún valor no es string.
|
|
60
|
+
*/
|
|
61
|
+
errorMessages?: Partial<EvaErrorMessages>;
|
|
62
|
+
/**
|
|
63
|
+
* Shape del wire HTTP que el SDK Hono emite cuando rechaza un request.
|
|
64
|
+
* - 'api' (default): { error: { code: string, message: string } } — consistente con el API.
|
|
65
|
+
* - 'string': { error: string } — legacy, para consumers que esperan mensaje plano.
|
|
66
|
+
* D-13 v2 LOCKED: default='api', configurable para compat con consumers 0.x.
|
|
67
|
+
* @throws Error si se pasa un valor distinto de 'api' o 'string'.
|
|
68
|
+
*/
|
|
69
|
+
errorWire?: 'api' | 'string';
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Configura el SDK en runtime. Llamar al boot del consumidor, antes del primer request;
|
|
73
|
+
* importar el SDK o crear `evaAuth()` no lee la configuración ni lanza.
|
|
74
|
+
*
|
|
75
|
+
* Es atómica: valida todos los campos y recién entonces los confirma; si uno falla, ninguno cambia.
|
|
76
|
+
* `authUrl` es inmutable (re-configurar el mismo valor normalizado es no-op). El resto de los
|
|
77
|
+
* campos provistos sobrescriben el valor previo; los omitidos (undefined) no lo resetean.
|
|
78
|
+
*
|
|
79
|
+
* @throws Error si `authUrl` o `product` son inválidos o distintos de los ya configurados, si cookieDomain contiene
|
|
80
|
+
* caracteres de header injection (;, \r, \n), o si errorMessages / errorWire son inválidos.
|
|
81
|
+
*/
|
|
82
|
+
declare function configureEvaAuth(opts: ConfigureEvaAuthOptions): void;
|
|
83
|
+
/**
|
|
84
|
+
* Retorna la URL del Auth Service configurada vía `configureEvaAuth({ authUrl })`
|
|
85
|
+
* (normalizada, sin `/` final).
|
|
86
|
+
* @throws Error de configuración (`name === 'EvaAuthConfigError'`) si aún no se configuró.
|
|
87
|
+
* `authFetch` y `verifyAccessToken` lo propagan: el consumidor ve un 500, nunca un 401 o un error de red.
|
|
88
|
+
*/
|
|
89
|
+
declare function getAuthUrl(): string;
|
|
90
|
+
/**
|
|
91
|
+
* Retorna el cookieDomain configurado vía configureEvaAuth, o undefined si no se configuró.
|
|
92
|
+
*/
|
|
93
|
+
declare function getCookieDomain(): string | undefined;
|
|
94
|
+
export { COOKIE_MAX_AGE as a, clearTokenCookies as c, getCookieDomain as i, readTokensFromCookies as l, configureEvaAuth as n, JWT_CONFIG as o, getAuthUrl as r, getCookieNames as s, ConfigureEvaAuthOptions as t, setTokenCookies as u };
|
|
95
|
+
//# sourceMappingURL=config-D6Tr7ev6.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-D6Tr7ev6.d.cts","names":[],"sources":["../src/cookies.ts","../src/constants.ts","../src/config.ts"],"mappings":";;;iBAiDgB,sBACd,8BACC,QAAQ;iBA0BK,gBAAgB,QAAQ;iBA4BxB;;;;;;cC3FH;WACF;WACA;;cASE;;;;;cAMA;;;;UCyGI;;;;;;;;;;;EAWf;;;;;;;;;;;EAWA;;;;;;EAMA;;;;;;;;EAQA,gBAAgB,QAAQ;;;;;;;;EAQxB;;;;;;;;;;;;;iBA4Ec,iBAAiB,MAAM;;;;;;;iBAWvB;;;;iBA0BA"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import "./index-Dold-Ycb.js";
|
|
2
|
+
import { f as TokenPair } from "./types-CLOIHzRu.js";
|
|
3
|
+
import { n as EvaErrorMessages } from "./error-messages-CGpW1fsg.js";
|
|
4
|
+
declare function readTokensFromCookies(cookieHeader: string | null): Partial<TokenPair>;
|
|
5
|
+
declare function setTokenCookies(tokens: TokenPair): string[];
|
|
6
|
+
declare function clearTokenCookies(): string[];
|
|
7
|
+
/**
|
|
8
|
+
* Nombres de las cookies de sesión del producto configurado: `eva_<producto>_access_token` y
|
|
9
|
+
* `eva_<producto>_refresh_token`. Dos productos bajo el mismo dominio padre no se pisan.
|
|
10
|
+
* @throws Error de configuración (`EvaAuthConfigError`) si falta `configureEvaAuth({ product })`.
|
|
11
|
+
*/
|
|
12
|
+
declare const getCookieNames: () => {
|
|
13
|
+
readonly ACCESS_TOKEN: string;
|
|
14
|
+
readonly REFRESH_TOKEN: string;
|
|
15
|
+
};
|
|
16
|
+
declare const COOKIE_MAX_AGE: {
|
|
17
|
+
readonly ACCESS_TOKEN: number;
|
|
18
|
+
readonly REFRESH_TOKEN: number;
|
|
19
|
+
};
|
|
20
|
+
/** Issuer y algoritmo de los tokens. La audiencia de usuario es el producto configurado. */
|
|
21
|
+
declare const JWT_CONFIG: {
|
|
22
|
+
readonly ISSUER: "auth-service";
|
|
23
|
+
readonly ALGORITHM: "ES256";
|
|
24
|
+
};
|
|
25
|
+
interface ConfigureEvaAuthOptions {
|
|
26
|
+
/**
|
|
27
|
+
* URL base del Auth Service. Obligatoria antes del primer uso que la necesite
|
|
28
|
+
* (`authFetch`, JWKS): si falta, esos usos lanzan `EvaAuthConfigError`.
|
|
29
|
+
* Acepta https, o http solo en loopback (localhost, 127.0.0.1, [::1]); admite path
|
|
30
|
+
* (`https://host/auth`). Rechaza userinfo, query y fragmento (incluidos `?` y `#` solitarios).
|
|
31
|
+
* Se normaliza (host en minúsculas, sin `/` final) y es inmutable: reconfigurar con el mismo
|
|
32
|
+
* valor normalizado es no-op; con otro valor lanza Error.
|
|
33
|
+
* Si se omite (undefined), no valida ni modifica el valor previo.
|
|
34
|
+
* @throws Error si la URL es inválida o difiere de la ya configurada.
|
|
35
|
+
*/
|
|
36
|
+
authUrl?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Slug del producto de este consumidor (`whatsapp-panel`). Obligatorio **solo** si se usan las
|
|
39
|
+
* rutas de login, las cookies de sesión o `verifyAccessToken`: da el nombre de las cookies
|
|
40
|
+
* (`eva_<producto>_access_token`), la audiencia (`aud`) que exige `verifyAccessToken` y el
|
|
41
|
+
* `producto` que viaja en el login. Un servicio que solo verifica tokens de servicio no lo necesita.
|
|
42
|
+
* Debe ser un slug (`^[a-z][a-z0-9-]{2,63}$`).
|
|
43
|
+
* Es inmutable: reconfigurar el mismo valor es no-op; con otro valor lanza Error.
|
|
44
|
+
* Si se omite (undefined), no valida ni modifica el valor previo.
|
|
45
|
+
* @throws Error si el slug es inválido o difiere del ya configurado.
|
|
46
|
+
*/
|
|
47
|
+
product?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Domain para Set-Cookie. Validada contra header injection (;, \r, \n).
|
|
50
|
+
* Si se omite (undefined), NO resetea el valor previo.
|
|
51
|
+
* Recomendado: '.miempresa.com' para compartir entre subdominios.
|
|
52
|
+
*/
|
|
53
|
+
cookieDomain?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Mensajes de error que el SDK escribe en respuestas 4xx.
|
|
56
|
+
* Override granular: keys no provistas mantienen el default.
|
|
57
|
+
* Si se omite (undefined), NO resetea el valor previo.
|
|
58
|
+
* `""` se respeta como override explícito (no cae al default).
|
|
59
|
+
* @throws Error si alguna key es desconocida o si algún valor no es string.
|
|
60
|
+
*/
|
|
61
|
+
errorMessages?: Partial<EvaErrorMessages>;
|
|
62
|
+
/**
|
|
63
|
+
* Shape del wire HTTP que el SDK Hono emite cuando rechaza un request.
|
|
64
|
+
* - 'api' (default): { error: { code: string, message: string } } — consistente con el API.
|
|
65
|
+
* - 'string': { error: string } — legacy, para consumers que esperan mensaje plano.
|
|
66
|
+
* D-13 v2 LOCKED: default='api', configurable para compat con consumers 0.x.
|
|
67
|
+
* @throws Error si se pasa un valor distinto de 'api' o 'string'.
|
|
68
|
+
*/
|
|
69
|
+
errorWire?: 'api' | 'string';
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Configura el SDK en runtime. Llamar al boot del consumidor, antes del primer request;
|
|
73
|
+
* importar el SDK o crear `evaAuth()` no lee la configuración ni lanza.
|
|
74
|
+
*
|
|
75
|
+
* Es atómica: valida todos los campos y recién entonces los confirma; si uno falla, ninguno cambia.
|
|
76
|
+
* `authUrl` es inmutable (re-configurar el mismo valor normalizado es no-op). El resto de los
|
|
77
|
+
* campos provistos sobrescriben el valor previo; los omitidos (undefined) no lo resetean.
|
|
78
|
+
*
|
|
79
|
+
* @throws Error si `authUrl` o `product` son inválidos o distintos de los ya configurados, si cookieDomain contiene
|
|
80
|
+
* caracteres de header injection (;, \r, \n), o si errorMessages / errorWire son inválidos.
|
|
81
|
+
*/
|
|
82
|
+
declare function configureEvaAuth(opts: ConfigureEvaAuthOptions): void;
|
|
83
|
+
/**
|
|
84
|
+
* Retorna la URL del Auth Service configurada vía `configureEvaAuth({ authUrl })`
|
|
85
|
+
* (normalizada, sin `/` final).
|
|
86
|
+
* @throws Error de configuración (`name === 'EvaAuthConfigError'`) si aún no se configuró.
|
|
87
|
+
* `authFetch` y `verifyAccessToken` lo propagan: el consumidor ve un 500, nunca un 401 o un error de red.
|
|
88
|
+
*/
|
|
89
|
+
declare function getAuthUrl(): string;
|
|
90
|
+
/**
|
|
91
|
+
* Retorna el cookieDomain configurado vía configureEvaAuth, o undefined si no se configuró.
|
|
92
|
+
*/
|
|
93
|
+
declare function getCookieDomain(): string | undefined;
|
|
94
|
+
export { COOKIE_MAX_AGE as a, clearTokenCookies as c, getCookieDomain as i, readTokensFromCookies as l, configureEvaAuth as n, JWT_CONFIG as o, getAuthUrl as r, getCookieNames as s, ConfigureEvaAuthOptions as t, setTokenCookies as u };
|
|
95
|
+
//# sourceMappingURL=config-rl4_-VAq.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-rl4_-VAq.d.ts","names":[],"sources":["../src/cookies.ts","../src/constants.ts","../src/config.ts"],"mappings":";;;iBAiDgB,sBACd,8BACC,QAAQ;iBA0BK,gBAAgB,QAAQ;iBA4BxB;;;;;;cC3FH;WACF;WACA;;cASE;;;;;cAMA;;;;UCyGI;;;;;;;;;;;EAWf;;;;;;;;;;;EAWA;;;;;;EAMA;;;;;;;;EAQA,gBAAgB,QAAQ;;;;;;;;EAQxB;;;;;;;;;;;;;iBA4Ec,iBAAiB,MAAM;;;;;;;iBAWvB;;;;iBA0BA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const require_parse_error_response = require("./parse-error-response-6qOQS5y9.cjs");
|
|
2
|
+
// src/constants.ts
|
|
3
|
+
/**
|
|
4
|
+
* Nombres de las cookies de sesión del producto configurado: `eva_<producto>_access_token` y
|
|
5
|
+
* `eva_<producto>_refresh_token`. Dos productos bajo el mismo dominio padre no se pisan.
|
|
6
|
+
* @throws Error de configuración (`EvaAuthConfigError`) si falta `configureEvaAuth({ product })`.
|
|
7
|
+
*/
|
|
8
|
+
const getCookieNames = () => {
|
|
9
|
+
const product = require_parse_error_response.getProduct();
|
|
10
|
+
return {
|
|
11
|
+
ACCESS_TOKEN: `eva_${product}_access_token`,
|
|
12
|
+
REFRESH_TOKEN: `eva_${product}_refresh_token`
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
const COOKIE_MAX_AGE = {
|
|
16
|
+
ACCESS_TOKEN: 900,
|
|
17
|
+
REFRESH_TOKEN: 2592e3
|
|
18
|
+
};
|
|
19
|
+
/** Issuer y algoritmo de los tokens. La audiencia de usuario es el producto configurado. */
|
|
20
|
+
const JWT_CONFIG = {
|
|
21
|
+
ISSUER: "auth-service",
|
|
22
|
+
ALGORITHM: "ES256"
|
|
23
|
+
};
|
|
24
|
+
const getAuthServiceUrl = () => {
|
|
25
|
+
return require_parse_error_response.getAuthUrl().replace(/\/$/, "");
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "COOKIE_MAX_AGE", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function() {
|
|
30
|
+
return COOKIE_MAX_AGE;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "JWT_CONFIG", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function() {
|
|
36
|
+
return JWT_CONFIG;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, "getAuthServiceUrl", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function() {
|
|
42
|
+
return getAuthServiceUrl;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(exports, "getCookieNames", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function() {
|
|
48
|
+
return getCookieNames;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=constants-BE1_9Tod.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-BE1_9Tod.cjs","names":["getProduct","getAuthUrl"],"sources":["../src/constants.ts"],"sourcesContent":["import { getAuthUrl, getProduct } from './config'\n\n/*\n * `HEADERS` es un re-export del contrato. Este módulo es alcanzable desde `src/react`: de la\n * barrel del contrato solo se importan VALORES de módulos puros (`constants.ts`, `routes.ts`) o\n * `import type`. Un schema importado por valor aquí arrastraría su código al bundle de react.\n */\nexport { HEADERS } from '@eva_solutions/auth-contracts'\n\n/**\n * Nombres de las cookies de sesión del producto configurado: `eva_<producto>_access_token` y\n * `eva_<producto>_refresh_token`. Dos productos bajo el mismo dominio padre no se pisan.\n * @throws Error de configuración (`EvaAuthConfigError`) si falta `configureEvaAuth({ product })`.\n */\nexport const getCookieNames = (): {\n readonly ACCESS_TOKEN: string\n readonly REFRESH_TOKEN: string\n} => {\n const product = getProduct()\n return {\n ACCESS_TOKEN: `eva_${product}_access_token`,\n REFRESH_TOKEN: `eva_${product}_refresh_token`,\n }\n}\n\nexport const COOKIE_MAX_AGE = {\n ACCESS_TOKEN: 15 * 60, // 15 min\n REFRESH_TOKEN: 30 * 24 * 60 * 60, // 30 días\n} as const\n\n/** Issuer y algoritmo de los tokens. La audiencia de usuario es el producto configurado. */\nexport const JWT_CONFIG = {\n // Igual a `TOKEN_ISSUER` del contrato (un test lo fija); literal aquí para no arrastrar el\n // módulo de identidad al bundle de react, que importa este archivo.\n ISSUER: 'auth-service',\n ALGORITHM: 'ES256',\n} as const\n\nexport const getAuthServiceUrl = (): string => {\n return getAuthUrl().replace(/\\/$/, '')\n}\n"],"mappings":";;;;;;;AAcA,MAAa,uBAGR;CACH,MAAM,UAAUA,6BAAAA,WAAW;CAC3B,OAAO;EACL,cAAc,OAAO,QAAQ;EAC7B,eAAe,OAAO,QAAQ;CAChC;AACF;AAEA,MAAa,iBAAiB;CAC5B,cAAc;CACd,eAAe;AACjB;;AAGA,MAAa,aAAa;CAGxB,QAAQ;CACR,WAAW;AACb;AAEA,MAAa,0BAAkC;CAC7C,OAAOC,6BAAAA,WAAW,CAAC,CAAC,QAAQ,OAAO,EAAE;AACvC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { r as getAuthUrl, s as getProduct } from "./parse-error-response-BM9-kjs0.js";
|
|
2
|
+
// src/constants.ts
|
|
3
|
+
/**
|
|
4
|
+
* Nombres de las cookies de sesión del producto configurado: `eva_<producto>_access_token` y
|
|
5
|
+
* `eva_<producto>_refresh_token`. Dos productos bajo el mismo dominio padre no se pisan.
|
|
6
|
+
* @throws Error de configuración (`EvaAuthConfigError`) si falta `configureEvaAuth({ product })`.
|
|
7
|
+
*/
|
|
8
|
+
const getCookieNames = () => {
|
|
9
|
+
const product = getProduct();
|
|
10
|
+
return {
|
|
11
|
+
ACCESS_TOKEN: `eva_${product}_access_token`,
|
|
12
|
+
REFRESH_TOKEN: `eva_${product}_refresh_token`
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
const COOKIE_MAX_AGE = {
|
|
16
|
+
ACCESS_TOKEN: 900,
|
|
17
|
+
REFRESH_TOKEN: 2592e3
|
|
18
|
+
};
|
|
19
|
+
/** Issuer y algoritmo de los tokens. La audiencia de usuario es el producto configurado. */
|
|
20
|
+
const JWT_CONFIG = {
|
|
21
|
+
ISSUER: "auth-service",
|
|
22
|
+
ALGORITHM: "ES256"
|
|
23
|
+
};
|
|
24
|
+
const getAuthServiceUrl = () => {
|
|
25
|
+
return getAuthUrl().replace(/\/$/, "");
|
|
26
|
+
};
|
|
27
|
+
export { getCookieNames as i, JWT_CONFIG as n, getAuthServiceUrl as r, COOKIE_MAX_AGE as t };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=constants-BY7QZokc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-BY7QZokc.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["import { getAuthUrl, getProduct } from './config'\n\n/*\n * `HEADERS` es un re-export del contrato. Este módulo es alcanzable desde `src/react`: de la\n * barrel del contrato solo se importan VALORES de módulos puros (`constants.ts`, `routes.ts`) o\n * `import type`. Un schema importado por valor aquí arrastraría su código al bundle de react.\n */\nexport { HEADERS } from '@eva_solutions/auth-contracts'\n\n/**\n * Nombres de las cookies de sesión del producto configurado: `eva_<producto>_access_token` y\n * `eva_<producto>_refresh_token`. Dos productos bajo el mismo dominio padre no se pisan.\n * @throws Error de configuración (`EvaAuthConfigError`) si falta `configureEvaAuth({ product })`.\n */\nexport const getCookieNames = (): {\n readonly ACCESS_TOKEN: string\n readonly REFRESH_TOKEN: string\n} => {\n const product = getProduct()\n return {\n ACCESS_TOKEN: `eva_${product}_access_token`,\n REFRESH_TOKEN: `eva_${product}_refresh_token`,\n }\n}\n\nexport const COOKIE_MAX_AGE = {\n ACCESS_TOKEN: 15 * 60, // 15 min\n REFRESH_TOKEN: 30 * 24 * 60 * 60, // 30 días\n} as const\n\n/** Issuer y algoritmo de los tokens. La audiencia de usuario es el producto configurado. */\nexport const JWT_CONFIG = {\n // Igual a `TOKEN_ISSUER` del contrato (un test lo fija); literal aquí para no arrastrar el\n // módulo de identidad al bundle de react, que importa este archivo.\n ISSUER: 'auth-service',\n ALGORITHM: 'ES256',\n} as const\n\nexport const getAuthServiceUrl = (): string => {\n return getAuthUrl().replace(/\\/$/, '')\n}\n"],"mappings":";;;;;;;AAcA,MAAa,uBAGR;CACH,MAAM,UAAU,WAAW;CAC3B,OAAO;EACL,cAAc,OAAO,QAAQ;EAC7B,eAAe,OAAO,QAAQ;CAChC;AACF;AAEA,MAAa,iBAAiB;CAC5B,cAAc;CACd,eAAe;AACjB;;AAGA,MAAa,aAAa;CAGxB,QAAQ;CACR,WAAW;AACb;AAEA,MAAa,0BAAkC;CAC7C,OAAO,WAAW,CAAC,CAAC,QAAQ,OAAO,EAAE;AACvC"}
|