@owlmeans/auth 0.1.18-rc.39 → 0.1.18-rc.40

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 (87) hide show
  1. package/README.md +33 -32
  2. package/agent-meta/manifest.json +2 -2
  3. package/agent-meta/skills/auth/SKILL.md +17 -17
  4. package/agent-meta/skills/auth-protocol/SKILL.md +28 -25
  5. package/build/allowance/index.d.ts +1 -1
  6. package/build/allowance/index.d.ts.map +1 -1
  7. package/build/allowance/index.js +1 -1
  8. package/build/allowance/index.js.map +1 -1
  9. package/build/allowance/{model.d.ts → schemas.d.ts} +1 -1
  10. package/build/allowance/schemas.d.ts.map +1 -0
  11. package/build/allowance/{model.js → schemas.js} +3 -3
  12. package/build/allowance/schemas.js.map +1 -0
  13. package/build/auth/index.d.ts +1 -1
  14. package/build/auth/index.d.ts.map +1 -1
  15. package/build/auth/index.js +1 -1
  16. package/build/auth/index.js.map +1 -1
  17. package/build/auth/{model.d.ts → schemas.d.ts} +1 -1
  18. package/build/auth/schemas.d.ts.map +1 -0
  19. package/build/auth/{model.js → schemas.js} +2 -2
  20. package/build/auth/schemas.js.map +1 -0
  21. package/build/consts.d.ts +1 -0
  22. package/build/consts.d.ts.map +1 -1
  23. package/build/consts.js +1 -0
  24. package/build/consts.js.map +1 -1
  25. package/build/entity/index.d.ts +1 -1
  26. package/build/entity/index.js +1 -1
  27. package/build/entity/{profile.d.ts → schemas.d.ts} +1 -1
  28. package/build/entity/schemas.d.ts.map +1 -0
  29. package/build/entity/{profile.js → schemas.js} +2 -2
  30. package/build/entity/{profile.js.map → schemas.js.map} +1 -1
  31. package/build/helper/types.d.ts +22 -0
  32. package/build/helper/types.d.ts.map +1 -0
  33. package/build/helper/types.js +2 -0
  34. package/build/helper/types.js.map +1 -0
  35. package/build/helper.d.ts +7 -11
  36. package/build/helper.d.ts.map +1 -1
  37. package/build/helper.js +30 -27
  38. package/build/helper.js.map +1 -1
  39. package/build/index.d.ts +1 -1
  40. package/build/index.d.ts.map +1 -1
  41. package/build/index.js +0 -1
  42. package/build/index.js.map +1 -1
  43. package/build/permission/index.d.ts +1 -1
  44. package/build/permission/index.d.ts.map +1 -1
  45. package/build/permission/index.js +1 -1
  46. package/build/permission/index.js.map +1 -1
  47. package/build/permission/{model.d.ts → schemas.d.ts} +1 -1
  48. package/build/permission/schemas.d.ts.map +1 -0
  49. package/build/permission/{model.js → schemas.js} +1 -1
  50. package/build/permission/schemas.js.map +1 -0
  51. package/build/rely/index.d.ts +1 -1
  52. package/build/rely/index.d.ts.map +1 -1
  53. package/build/rely/index.js +1 -1
  54. package/build/rely/index.js.map +1 -1
  55. package/build/rely/{model.d.ts → schemas.d.ts} +1 -1
  56. package/build/rely/schemas.d.ts.map +1 -0
  57. package/build/rely/{model.js → schemas.js} +1 -1
  58. package/build/rely/schemas.js.map +1 -0
  59. package/package.json +2 -2
  60. package/src/allowance/index.ts +1 -1
  61. package/src/allowance/{model.ts → schemas.ts} +2 -2
  62. package/src/auth/index.ts +1 -1
  63. package/src/auth/{model.ts → schemas.ts} +1 -1
  64. package/src/consts.ts +1 -0
  65. package/src/entity/index.ts +1 -1
  66. package/src/entity/{profile.ts → schemas.ts} +1 -1
  67. package/src/helper/types.ts +22 -0
  68. package/src/helper.ts +44 -33
  69. package/src/index.ts +1 -1
  70. package/src/permission/index.ts +1 -1
  71. package/src/rely/index.ts +1 -1
  72. package/build/allowance/model.d.ts.map +0 -1
  73. package/build/allowance/model.js.map +0 -1
  74. package/build/auth/model.d.ts.map +0 -1
  75. package/build/auth/model.js.map +0 -1
  76. package/build/entity/profile.d.ts.map +0 -1
  77. package/build/permission/model.d.ts.map +0 -1
  78. package/build/permission/model.js.map +0 -1
  79. package/build/rely/model.d.ts.map +0 -1
  80. package/build/rely/model.js.map +0 -1
  81. package/build/utils.d.ts +0 -2
  82. package/build/utils.d.ts.map +0 -1
  83. package/build/utils.js +0 -3
  84. package/build/utils.js.map +0 -1
  85. package/src/utils.ts +0 -3
  86. /package/src/permission/{model.ts → schemas.ts} +0 -0
  87. /package/src/rely/{model.ts → schemas.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/entity/profile.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAEhF,MAAM,CAAC,MAAM,aAAa,GAA4B;IACpD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,EAAE,EAAE,aAAa;QACjB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE;QACtD,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC9C,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC1C,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;QACpE,UAAU,EAAE,EAAC,GAAG,qBAAqB,EAAE,QAAQ,EAAE,IAAI,EAAC;QACtD,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QACpD,WAAW,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC1E,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,IAAI,EAAE;QACxE,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE;QACjD,YAAY,EAAE,EA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AI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE;QACjD,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE;KAClD;IACD,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC;IAClC,oBAAoB,EAAE,KAAK;CAC5B,CAAA"}
@@ -0,0 +1,22 @@
1
+ import type { Auth, AuthCredentials, AuthToken, Authorization } from '../types.js';
2
+ /** Checks of the authentication payloads that cross the wire. */
3
+ export interface AuthHelper {
4
+ /** Whether a value satisfies the `Auth` schema. */
5
+ verifyAuth: (auth: Auth) => boolean;
6
+ /** Whether a value satisfies the `AuthCredentials` schema. */
7
+ verifyAuthCredentials: (auth: AuthCredentials) => boolean;
8
+ isAuth: (auth: unknown) => auth is Auth;
9
+ isAuthCredentials: (auth: unknown) => auth is AuthCredentials;
10
+ isAuthToken: (auth: unknown) => auth is AuthToken;
11
+ /**
12
+ * The organization slug carried by an auth payload, tolerating tokens minted before the field
13
+ * was named.
14
+ *
15
+ * Tokens outlive deployments: one signed with the previous release still arrives with the value
16
+ * under `entityId`, and it stays valid until it expires. Everything that reads the organization
17
+ * off a payload goes through here so that window needs no second code path — and so the day the
18
+ * fallback can be deleted is a single-line change rather than an audit.
19
+ */
20
+ entitySlugOf: (payload?: Partial<Authorization> | null) => string | undefined;
21
+ }
22
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/helper/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAElF,iEAAiE;AACjE,MAAM,WAAW,UAAU;IACzB,mDAAmD;IACnD,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAA;IACnC,8DAA8D;IAC9D,qBAAqB,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAA;IACzD,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,IAAI,IAAI,CAAA;IACvC,iBAAiB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,IAAI,eAAe,CAAA;IAC7D,WAAW,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,IAAI,SAAS,CAAA;IACjD;;;;;;;;OAQG;IACH,YAAY,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,KAAK,MAAM,GAAG,SAAS,CAAA;CAC9E"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/helper/types.ts"],"names":[],"mappings":""}
package/build/helper.d.ts CHANGED
@@ -1,17 +1,13 @@
1
1
  import type { Auth, AuthCredentials, AuthToken, Authorization } from './types.js';
2
- export declare const verifyAuth: (auth: Auth) => boolean;
3
- export declare const verifyAuthCredentials: (auth: AuthCredentials) => boolean;
2
+ import type { AuthHelper } from './helper/types.js';
3
+ export declare const createAuthHelper: () => AuthHelper;
4
+ export declare const authHelper: AuthHelper;
5
+ /** @deprecated compat:factory-refactor — use `authHelper.isAuth(…)` */
4
6
  export declare const isAuth: (auth: unknown) => auth is Auth;
7
+ /** @deprecated compat:factory-refactor — use `authHelper.isAuthCredentials(…)` */
5
8
  export declare const isAuthCredentials: (auth: unknown) => auth is AuthCredentials;
9
+ /** @deprecated compat:factory-refactor — use `authHelper.isAuthToken(…)` */
6
10
  export declare const isAuthToken: (auth: unknown) => auth is AuthToken;
7
- /**
8
- * The organization slug carried by an auth payload, tolerating tokens minted before the field
9
- * was named.
10
- *
11
- * Tokens outlive deployments: one signed with the previous release still arrives with the value
12
- * under `entityId`, and it stays valid until it expires. Everything that reads the organization
13
- * off a payload goes through here so that window needs no second code path — and so the day the
14
- * fallback can be deleted is a single-line change rather than an audit.
15
- */
11
+ /** @deprecated compat:factory-refactor — use `authHelper.entitySlugOf(…)` */
16
12
  export declare const entitySlugOf: (payload?: Partial<Authorization> | null) => string | undefined;
17
13
  //# sourceMappingURL=helper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AASjF,eAAO,MAAM,UAAU,SAAU,IAAI,KAAG,OAIvC,CAAA;AAED,eAAO,MAAM,qBAAqB,SAAU,eAAe,KAAG,OAI7D,CAAA;AAED,eAAO,MAAM,MAAM,SAAU,OAAO,KAAG,IAAI,IAAI,IAEH,CAAA;AAE5C,eAAO,MAAM,iBAAiB,SAAU,OAAO,KAAG,IAAI,IAAI,eAEN,CAAA;AAEpD,eAAO,MAAM,WAAW,SAAU,OAAO,KAAG,IAAI,IAAI,SAEI,CAAA;AAExD;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,aAAc,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,KAAG,MAAM,GAAG,SACQ,CAAA"}
1
+ {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAIjF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,eAAO,MAAM,gBAAgB,QAAO,UAiCnC,CAAA;AAED,eAAO,MAAM,UAAU,YAAqB,CAAA;AAE5C,uEAAuE;AACvE,eAAO,MAAM,MAAM,SAAU,OAAO,KAAG,IAAI,IAAI,IAA+B,CAAA;AAE9E,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,SAAU,OAAO,KAAG,IAAI,IAAI,eAAqD,CAAA;AAE/G,4EAA4E;AAC5E,eAAO,MAAM,WAAW,SAAU,OAAO,KAAG,IAAI,IAAI,SAAyC,CAAA;AAE7F,6EAA6E;AAC7E,eAAO,MAAM,YAAY,aAAc,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,KAAG,MAAM,GAAG,SAC9C,CAAA"}
package/build/helper.js CHANGED
@@ -1,31 +1,34 @@
1
1
  import { Ajv } from 'ajv';
2
2
  import formatsPlugin from 'ajv-formats';
3
- import { AuthCredentialsSchema, AuthSchema } from './allowance/model.js';
4
- const ajv = new Ajv({ strict: false });
5
- // @TODO There is some serious type mismatch probably because of wrong versions resolution
6
- formatsPlugin(ajv);
7
- export const verifyAuth = (auth) => {
8
- const validate = ajv.compile(AuthSchema);
9
- return validate(auth);
3
+ import { AuthCredentialsSchema, AuthSchema } from './allowance/schemas.js';
4
+ export const createAuthHelper = () => {
5
+ const ajv = new Ajv({ strict: false });
6
+ // @TODO There is some serious type mismatch probably because of wrong versions resolution
7
+ formatsPlugin(ajv);
8
+ const verifyAuth = (auth) => {
9
+ const validate = ajv.compile(AuthSchema);
10
+ return validate(auth);
11
+ };
12
+ const verifyAuthCredentials = (auth) => {
13
+ const validate = ajv.compile(AuthCredentialsSchema);
14
+ return validate(auth);
15
+ };
16
+ const isAuth = (auth) => typeof auth === 'object' && auth != null
17
+ && ("token" in auth) && ("isUser" in auth);
18
+ const isAuthCredentials = (auth) => typeof auth === 'object' && auth != null
19
+ && ("challenge" in auth) && ("credential" in auth);
20
+ const isAuthToken = (auth) => typeof auth === 'object' && auth != null
21
+ && ("token" in auth) && typeof auth.token === 'string';
22
+ const entitySlugOf = (payload) => payload?.entitySlug ?? payload?.entityId;
23
+ return { verifyAuth, verifyAuthCredentials, isAuth, isAuthCredentials, isAuthToken, entitySlugOf };
10
24
  };
11
- export const verifyAuthCredentials = (auth) => {
12
- const validate = ajv.compile(AuthCredentialsSchema);
13
- return validate(auth);
14
- };
15
- export const isAuth = (auth) => typeof auth === 'object' && auth != null
16
- && ("token" in auth) && ("isUser" in auth);
17
- export const isAuthCredentials = (auth) => typeof auth === 'object' && auth != null
18
- && ("challenge" in auth) && ("credential" in auth);
19
- export const isAuthToken = (auth) => typeof auth === 'object' && auth != null
20
- && ("token" in auth) && typeof auth.token === 'string';
21
- /**
22
- * The organization slug carried by an auth payload, tolerating tokens minted before the field
23
- * was named.
24
- *
25
- * Tokens outlive deployments: one signed with the previous release still arrives with the value
26
- * under `entityId`, and it stays valid until it expires. Everything that reads the organization
27
- * off a payload goes through here so that window needs no second code path — and so the day the
28
- * fallback can be deleted is a single-line change rather than an audit.
29
- */
30
- export const entitySlugOf = (payload) => payload?.entitySlug ?? payload?.entityId;
25
+ export const authHelper = createAuthHelper();
26
+ /** @deprecated compat:factory-refactor — use `authHelper.isAuth(…)` */
27
+ export const isAuth = (auth) => authHelper.isAuth(auth);
28
+ /** @deprecated compat:factory-refactor — use `authHelper.isAuthCredentials(…)` */
29
+ export const isAuthCredentials = (auth) => authHelper.isAuthCredentials(auth);
30
+ /** @deprecated compat:factory-refactor — use `authHelper.isAuthToken(…)` */
31
+ export const isAuthToken = (auth) => authHelper.isAuthToken(auth);
32
+ /** @deprecated compat:factory-refactor — use `authHelper.entitySlugOf(…)` */
33
+ export const entitySlugOf = (payload) => authHelper.entitySlugOf(payload);
31
34
  //# sourceMappingURL=helper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AACzB,OAAO,aAAa,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAExE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;AACtC,0FAA0F;AAC1F,aAAa,CAAC,GAAU,CAAC,CAAA;AAEzB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAA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O,EAAE,UAAU,IAAK,OAAoD,EAAE,QAAQ,CAAA;IAExF,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,EAAE,iBAAiB,EAAE,WAAW,EAAE,YAAY,EAAE,CAAA;AACpG,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,EAAE,CAAA;AAE5C,uEAAuE;AACvE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAa,EAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;AAE9E,kFAAkF;AAClF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAa,EAA2B,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAA;AAE/G,4EAA4E;AAC5E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAa,EAAqB,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;AAE7F,6EAA6E;AAC7E,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAuC,EAAsB,EAAE,CAC1F,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA"}
package/build/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export type * from './types.js';
2
+ export type * from './helper/types.js';
2
3
  export * from './errors.js';
3
4
  export * from './consts.js';
4
- export * from './utils.js';
5
5
  export * from './helper.js';
6
6
  export * from './supervisor.js';
7
7
  export * from './allowance/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,mBAAmB,YAAY,CAAA;AAC/B,mBAAmB,mBAAmB,CAAA;AACtC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA"}
package/build/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  export * from './errors.js';
2
2
  export * from './consts.js';
3
- export * from './utils.js';
4
3
  export * from './helper.js';
5
4
  export * from './supervisor.js';
6
5
  export * from './allowance/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA"}
@@ -1,2 +1,2 @@
1
- export * from './model.js';
1
+ export * from './schemas.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/permission/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/permission/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAA"}
@@ -1,2 +1,2 @@
1
- export * from './model.js';
1
+ export * from './schemas.js';
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/permission/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/permission/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAA"}
@@ -3,4 +3,4 @@ import { AttributeSet, Capabilties, PermissionSet } from '../types.js';
3
3
  export declare const CapabiltiesSchema: JSONSchemaType<Capabilties>;
4
4
  export declare const PermissionSetSchema: JSONSchemaType<PermissionSet>;
5
5
  export declare const AttributeSetSchema: JSONSchemaType<AttributeSet>;
6
- //# sourceMappingURL=model.d.ts.map
6
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/permission/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAGtE,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAAC,WAAW,CAIzD,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,cAAc,CAAC,aAAa,CAU7D,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,YAAY,CAQ3D,CAAA"}
@@ -24,4 +24,4 @@ export const AttributeSetSchema = {
24
24
  required: ['scope', 'attributes'],
25
25
  additionalProperties: false,
26
26
  };
27
- //# sourceMappingURL=model.js.map
27
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/permission/schemas.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE1F,MAAM,CAAC,MAAM,iBAAiB,GAAgC;IAC5D,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;IACrE,QAAQ,EAAE,EAAE;CACb,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAkC;IAChE,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE;QACvE,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,iBAAiB;QAC9B,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,IAAI,EAAE;KACzE;IACD,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC;IAClC,oBAAoB,EAAE,KAAK;CAC5B,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAiC;IAC9D,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE,gBAAgB;QACvB,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE;KAC3D;IACD,QAAQ,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC;IACjC,oBAAoB,EAAE,KAAK;CAC5B,CAAA"}
@@ -1,3 +1,3 @@
1
1
  export type * from './types.js';
2
- export * from './model.js';
2
+ export * from './schemas.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rely/index.ts"],"names":[],"mappings":"AACA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rely/index.ts"],"names":[],"mappings":"AACA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,cAAc,CAAA"}
@@ -1,2 +1,2 @@
1
- export * from './model.js';
1
+ export * from './schemas.js';
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rely/index.ts"],"names":[],"mappings":"AAEA,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rely/index.ts"],"names":[],"mappings":"AAEA,cAAc,cAAc,CAAA"}
@@ -1,4 +1,4 @@
1
1
  import type { JSONSchemaType } from 'ajv';
2
2
  import type { RelyToken } from './types.js';
3
3
  export declare const RelyChallengeSchema: JSONSchemaType<RelyToken>;
4
- //# sourceMappingURL=model.d.ts.map
4
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/rely/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,eAAO,MAAM,mBAAmB,EAAE,cAAc,CAAC,SAAS,CAUzD,CAAA"}
@@ -9,4 +9,4 @@ export const RelyChallengeSchema = {
9
9
  required: ['nonce'],
10
10
  additionalProperties: false,
11
11
  };
12
- //# sourceMappingURL=model.js.map
12
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/rely/schemas.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,mBAAmB,GAA8B;IAC5D,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;QACpE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;QACtE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE;QACrE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;KACvD;IACD,QAAQ,EAAE,CAAC,OAAO,CAAC;IACnB,oBAAoB,EAAE,KAAK;CAC5B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owlmeans/auth",
3
- "version": "0.1.18-rc.39",
3
+ "version": "0.1.18-rc.40",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -22,7 +22,7 @@
22
22
  }
23
23
  },
24
24
  "dependencies": {
25
- "@owlmeans/error": "^0.1.18-rc.37",
25
+ "@owlmeans/error": "^0.1.18-rc.38",
26
26
  "ajv-formats": "^3.0.1"
27
27
  },
28
28
  "peerDependencies": {
@@ -1,2 +1,2 @@
1
1
 
2
- export * from './model.js'
2
+ export * from './schemas.js'
@@ -4,8 +4,8 @@ import {
4
4
  AuthRoleSchema, EntitySlugValueSchema, GroupValueSchema, IdValueSchema, DateSchema,
5
5
  ScopeValueSchema, TypeNameSchema
6
6
  } from '../consts.js'
7
- import { AuthPayloadSchema } from '../auth/model.js'
8
- import { AttributeSetSchema, PermissionSetSchema } from '../permission/model.js'
7
+ import { AuthPayloadSchema } from '../auth/schemas.js'
8
+ import { AttributeSetSchema, PermissionSetSchema } from '../permission/schemas.js'
9
9
 
10
10
  export const PartialAuthPayloadSchema: JSONSchemaType<Omit<Partial<AuthPayload>, "type">> = {
11
11
  type: 'object',
package/src/auth/index.ts CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- export * from './model.js'
2
+ export * from './schemas.js'
@@ -4,7 +4,7 @@ import {
4
4
  EntitySlugValueSchema, EnumValueSchema, GroupValueSchema, IdValueSchema, DateSchema, ScopeValueSchema,
5
5
  TypeNameSchema
6
6
  } from '../consts.js'
7
- import { AttributeSetSchema, PermissionSetSchema } from '../permission/model.js'
7
+ import { AttributeSetSchema, PermissionSetSchema } from '../permission/schemas.js'
8
8
 
9
9
  export const AuthorizationSchema: JSONSchemaType<Authorization> = {
10
10
  type: 'object',
package/src/consts.ts CHANGED
@@ -135,6 +135,7 @@ export const ENTITY_QUERY = 'entitySlug'
135
135
  export const PROFILE_QUERY = 'profile'
136
136
 
137
137
  export const MOD_RECAPTCHA = '_external:re-captcha'
138
+ export const CMOD_RECAPTCHA = `_client-${MOD_RECAPTCHA.slice(1)}`
138
139
 
139
140
  export const GUEST_ID = '__guest'
140
141
  export const RELY_3RD = 'rely'
@@ -1,2 +1,2 @@
1
1
 
2
- export * from './profile.js'
2
+ export * from './schemas.js'
@@ -2,7 +2,7 @@
2
2
  import type { JSONSchemaType } from 'ajv'
3
3
  import type { Profile } from '../types.js'
4
4
  import { EntitySlugValueSchema, IdValueSchema } from '../consts.js'
5
- import { PermissionSetSchema, AttributeSetSchema } from '../permission/model.js'
5
+ import { PermissionSetSchema, AttributeSetSchema } from '../permission/schemas.js'
6
6
 
7
7
  export const ProfileSchema: JSONSchemaType<Profile> = {
8
8
  type: 'object',
@@ -0,0 +1,22 @@
1
+ import type { Auth, AuthCredentials, AuthToken, Authorization } from '../types.js'
2
+
3
+ /** Checks of the authentication payloads that cross the wire. */
4
+ export interface AuthHelper {
5
+ /** Whether a value satisfies the `Auth` schema. */
6
+ verifyAuth: (auth: Auth) => boolean
7
+ /** Whether a value satisfies the `AuthCredentials` schema. */
8
+ verifyAuthCredentials: (auth: AuthCredentials) => boolean
9
+ isAuth: (auth: unknown) => auth is Auth
10
+ isAuthCredentials: (auth: unknown) => auth is AuthCredentials
11
+ isAuthToken: (auth: unknown) => auth is AuthToken
12
+ /**
13
+ * The organization slug carried by an auth payload, tolerating tokens minted before the field
14
+ * was named.
15
+ *
16
+ * Tokens outlive deployments: one signed with the previous release still arrives with the value
17
+ * under `entityId`, and it stays valid until it expires. Everything that reads the organization
18
+ * off a payload goes through here so that window needs no second code path — and so the day the
19
+ * fallback can be deleted is a single-line change rather than an audit.
20
+ */
21
+ entitySlugOf: (payload?: Partial<Authorization> | null) => string | undefined
22
+ }
package/src/helper.ts CHANGED
@@ -1,44 +1,55 @@
1
1
  import type { Auth, AuthCredentials, AuthToken, Authorization } from './types.js'
2
2
  import { Ajv } from 'ajv'
3
3
  import formatsPlugin from 'ajv-formats'
4
- import { AuthCredentialsSchema, AuthSchema } from './allowance/model.js'
4
+ import { AuthCredentialsSchema, AuthSchema } from './allowance/schemas.js'
5
+ import type { AuthHelper } from './helper/types.js'
5
6
 
6
- const ajv = new Ajv({ strict: false })
7
- // @TODO There is some serious type mismatch probably because of wrong versions resolution
8
- formatsPlugin(ajv as any)
7
+ export const createAuthHelper = (): AuthHelper => {
8
+ const ajv = new Ajv({ strict: false })
9
+ // @TODO There is some serious type mismatch probably because of wrong versions resolution
10
+ formatsPlugin(ajv as any)
9
11
 
10
- export const verifyAuth = (auth: Auth): boolean => {
11
- const validate = ajv.compile(AuthSchema)
12
+ const verifyAuth = (auth: Auth): boolean => {
13
+ const validate = ajv.compile(AuthSchema)
12
14
 
13
- return validate(auth)
14
- }
15
+ return validate(auth)
16
+ }
17
+
18
+ const verifyAuthCredentials = (auth: AuthCredentials): boolean => {
19
+ const validate = ajv.compile(AuthCredentialsSchema)
20
+
21
+ return validate(auth)
22
+ }
23
+
24
+ const isAuth = (auth: unknown): auth is Auth =>
25
+ typeof auth === 'object' && auth != null
26
+ && ("token" in auth) && ("isUser" in auth)
27
+
28
+ const isAuthCredentials = (auth: unknown): auth is AuthCredentials =>
29
+ typeof auth === 'object' && auth != null
30
+ && ("challenge" in auth) && ("credential" in auth)
15
31
 
16
- export const verifyAuthCredentials = (auth: AuthCredentials): boolean => {
17
- const validate = ajv.compile(AuthCredentialsSchema)
32
+ const isAuthToken = (auth: unknown): auth is AuthToken =>
33
+ typeof auth === 'object' && auth != null
34
+ && ("token" in auth) && typeof auth.token === 'string'
18
35
 
19
- return validate(auth)
36
+ const entitySlugOf = (payload?: Partial<Authorization> | null): string | undefined =>
37
+ payload?.entitySlug ?? (payload as { entityId?: string } | null | undefined)?.entityId
38
+
39
+ return { verifyAuth, verifyAuthCredentials, isAuth, isAuthCredentials, isAuthToken, entitySlugOf }
20
40
  }
21
41
 
22
- export const isAuth = (auth: unknown): auth is Auth =>
23
- typeof auth === 'object' && auth != null
24
- && ("token" in auth) && ("isUser" in auth)
25
-
26
- export const isAuthCredentials = (auth: unknown): auth is AuthCredentials =>
27
- typeof auth === 'object' && auth != null
28
- && ("challenge" in auth) && ("credential" in auth)
29
-
30
- export const isAuthToken = (auth: unknown): auth is AuthToken =>
31
- typeof auth === 'object' && auth != null
32
- && ("token" in auth) && typeof auth.token === 'string'
33
-
34
- /**
35
- * The organization slug carried by an auth payload, tolerating tokens minted before the field
36
- * was named.
37
- *
38
- * Tokens outlive deployments: one signed with the previous release still arrives with the value
39
- * under `entityId`, and it stays valid until it expires. Everything that reads the organization
40
- * off a payload goes through here so that window needs no second code path — and so the day the
41
- * fallback can be deleted is a single-line change rather than an audit.
42
- */
42
+ export const authHelper = createAuthHelper()
43
+
44
+ /** @deprecated compat:factory-refactor — use `authHelper.isAuth(…)` */
45
+ export const isAuth = (auth: unknown): auth is Auth => authHelper.isAuth(auth)
46
+
47
+ /** @deprecated compat:factory-refactor — use `authHelper.isAuthCredentials(…)` */
48
+ export const isAuthCredentials = (auth: unknown): auth is AuthCredentials => authHelper.isAuthCredentials(auth)
49
+
50
+ /** @deprecated compat:factory-refactor — use `authHelper.isAuthToken(…)` */
51
+ export const isAuthToken = (auth: unknown): auth is AuthToken => authHelper.isAuthToken(auth)
52
+
53
+ /** @deprecated compat:factory-refactor — use `authHelper.entitySlugOf(…)` */
43
54
  export const entitySlugOf = (payload?: Partial<Authorization> | null): string | undefined =>
44
- payload?.entitySlug ?? (payload as { entityId?: string } | null | undefined)?.entityId
55
+ authHelper.entitySlugOf(payload)
package/src/index.ts CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  export type * from './types.js'
3
+ export type * from './helper/types.js'
3
4
  export * from './errors.js'
4
5
  export * from './consts.js'
5
- export * from './utils.js'
6
6
  export * from './helper.js'
7
7
  export * from './supervisor.js'
8
8
  export * from './allowance/index.js'
@@ -1,2 +1,2 @@
1
1
 
2
- export * from './model.js'
2
+ export * from './schemas.js'
package/src/rely/index.ts CHANGED
@@ -1,3 +1,3 @@
1
1
 
2
2
  export type * from './types.js'
3
- export * from './model.js'
3
+ export * from './schemas.js'
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/allowance/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAQvF,eAAO,MAAM,wBAAwB,EAAE,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,CAkBvF,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,cAAc,CAAC,gBAAgB,CAQnE,CAAA;AAED,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,eAAe,CAajE,CAAA;AAED,eAAO,MAA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AK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAI1C,eAAO,MAAM,aAAa,EAAE,cAAc,CAAC,OAAO,CAiBjD,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/permission/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAGtE,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAAC,WAAW,CAIzD,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,cAAc,CAAC,aAAa,CAU7D,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,YAAY,CAQ3D,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/permission/model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE1F,MAAM,CAAC,MAAM,iBAAiB,GAAgC;IAC5D,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;IACrE,QAAQ,EAAE,EAAE;CACb,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAkC;IAChE,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE;QACvE,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,iBAAiB;QAC9B,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,IAAI,EAAE;KACzE;IACD,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC;IAClC,oBAAoB,EAAE,KAAK;CAC5B,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAiC;IAC9D,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE,gBAAgB;QACvB,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE;KAC3D;IACD,QAAQ,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC;IACjC,oBAAoB,EAAE,KAAK;CAC5B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/rely/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,eAAO,MAAM,mBAAmB,EAAE,cAAc,CAAC,SAAS,CAUzD,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/rely/model.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,mBAAmB,GAA8B;IAC5D,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;QACpE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;QACtE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE;QACrE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;KACvD;IACD,QAAQ,EAAE,CAAC,OAAO,CAAC;IACnB,oBAAoB,EAAE,KAAK;CAC5B,CAAA"}
package/build/utils.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const CMOD_RECAPTCHA: string;
2
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,QAAsC,CAAA"}
package/build/utils.js DELETED
@@ -1,3 +0,0 @@
1
- import { MOD_RECAPTCHA } from './consts.js';
2
- export const CMOD_RECAPTCHA = `_client-${MOD_RECAPTCHA.slice(1)}`;
3
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA"}
package/src/utils.ts DELETED
@@ -1,3 +0,0 @@
1
- import { MOD_RECAPTCHA } from './consts.js'
2
-
3
- export const CMOD_RECAPTCHA = `_client-${MOD_RECAPTCHA.slice(1)}`
File without changes
File without changes