@usehercules/convex 0.0.0

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 (67) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +478 -0
  3. package/dist/_generated/component.d.ts +184 -0
  4. package/dist/_generated/component.d.ts.map +1 -0
  5. package/dist/_generated/component.js +11 -0
  6. package/dist/_generated/component.js.map +1 -0
  7. package/dist/checker/cli.d.ts +3 -0
  8. package/dist/checker/cli.d.ts.map +1 -0
  9. package/dist/checker/cli.js +71 -0
  10. package/dist/checker/cli.js.map +1 -0
  11. package/dist/checker/index.d.ts +28 -0
  12. package/dist/checker/index.d.ts.map +1 -0
  13. package/dist/checker/index.js +1928 -0
  14. package/dist/checker/index.js.map +1 -0
  15. package/dist/client/access-admin.d.ts +818 -0
  16. package/dist/client/access-admin.d.ts.map +1 -0
  17. package/dist/client/access-admin.js +1830 -0
  18. package/dist/client/access-admin.js.map +1 -0
  19. package/dist/client/http.d.ts +19 -0
  20. package/dist/client/http.d.ts.map +1 -0
  21. package/dist/client/http.js +76 -0
  22. package/dist/client/http.js.map +1 -0
  23. package/dist/client/index.d.ts +440 -0
  24. package/dist/client/index.d.ts.map +1 -0
  25. package/dist/client/index.js +654 -0
  26. package/dist/client/index.js.map +1 -0
  27. package/dist/component/authz.d.ts +114 -0
  28. package/dist/component/authz.d.ts.map +1 -0
  29. package/dist/component/authz.js +168 -0
  30. package/dist/component/authz.js.map +1 -0
  31. package/dist/component/checks.d.ts +86 -0
  32. package/dist/component/checks.d.ts.map +1 -0
  33. package/dist/component/checks.js +184 -0
  34. package/dist/component/checks.js.map +1 -0
  35. package/dist/component/convex.config.d.ts +3 -0
  36. package/dist/component/convex.config.d.ts.map +1 -0
  37. package/dist/component/convex.config.js +3 -0
  38. package/dist/component/convex.config.js.map +1 -0
  39. package/dist/component/effective.d.ts +82 -0
  40. package/dist/component/effective.d.ts.map +1 -0
  41. package/dist/component/effective.js +757 -0
  42. package/dist/component/effective.js.map +1 -0
  43. package/dist/component/queries.d.ts +170 -0
  44. package/dist/component/queries.d.ts.map +1 -0
  45. package/dist/component/queries.js +633 -0
  46. package/dist/component/queries.js.map +1 -0
  47. package/dist/component/schema.d.ts +258 -0
  48. package/dist/component/schema.d.ts.map +1 -0
  49. package/dist/component/schema.js +222 -0
  50. package/dist/component/schema.js.map +1 -0
  51. package/dist/component/sync.d.ts +85 -0
  52. package/dist/component/sync.d.ts.map +1 -0
  53. package/dist/component/sync.js +851 -0
  54. package/dist/component/sync.js.map +1 -0
  55. package/dist/shared/projection-protocol.d.ts +1624 -0
  56. package/dist/shared/projection-protocol.d.ts.map +1 -0
  57. package/dist/shared/projection-protocol.js +561 -0
  58. package/dist/shared/projection-protocol.js.map +1 -0
  59. package/dist/shared/sync.d.ts +24 -0
  60. package/dist/shared/sync.d.ts.map +1 -0
  61. package/dist/shared/sync.js +18 -0
  62. package/dist/shared/sync.js.map +1 -0
  63. package/dist/shared/token.d.ts +5 -0
  64. package/dist/shared/token.d.ts.map +1 -0
  65. package/dist/shared/token.js +19 -0
  66. package/dist/shared/token.js.map +1 -0
  67. package/package.json +89 -0
@@ -0,0 +1,18 @@
1
+ // Access Control projection sync — v3 wire contract.
2
+ //
3
+ // This module is the consumer-side entry point for the signed projection sync
4
+ // channel. The wire shapes themselves live in `./projection-protocol` (the zod
5
+ // mirror of the producer's source of truth); this file re-exports them and adds
6
+ // the non-wire pieces the HTTP handler and the Convex component need:
7
+ // • ACCESS_CONTROL_SYNC_PATH — the webhook route the producer posts to.
8
+ // • SyncResponse — the mutation's response contract (mapped to HTTP statuses
9
+ // by client/http.ts and consumed by the producer's reconciler).
10
+ //
11
+ // There is NO v2 compatibility: the old per-scope `scopes[].entities` + composite
12
+ // `changes` wire schema is gone. v3 carries a deployment-wide catalog + users at
13
+ // the top level and per-scope runtime state, with typed discriminated change
14
+ // identities (see projection-protocol.ts).
15
+ export const ACCESS_CONTROL_SYNC_PATH = "/_hercules/access-control/sync";
16
+ // ── v3 wire schema + types (re-exported from the protocol mirror) ────────────
17
+ export { accessProjectionSyncPayloadSchema, accessProjectionSnapshotSchema, accessProjectionEventSchema, accessProjectionEffectSchema, accessProjectionApplicabilitySchema, accessProjectionWildcardModeSchema, accessProjectionPermissionClassificationSchema, accessProjectionScopeKindSchema, accessProjectionScopeStatusSchema, accessProjectionAccountEntryModeSchema, accessProjectionPrincipalStatusSchema, projectionUserSchema, projectionCatalogRoleSchema, projectionCatalogPermissionSchema, projectionCatalogRolePermissionSchema, projectionCatalogSchema, projectionScopeMetadataSchema, projectionPrincipalSchema, projectionPrincipalMembershipSchema, projectionScopeTenantRoleSchema, projectionScopeRolePermissionOverrideSchema, projectionScopeRoleBindingSchema, projectionScopePermissionBindingSchema, projectionScopeSchema, projectionScopeDeltaSchema, projectionCatalogDeltaSchema, projectionUserDeltaSchema, } from "./projection-protocol";
18
+ //# sourceMappingURL=sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/shared/sync.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,gFAAgF;AAChF,sEAAsE;AACtE,0EAA0E;AAC1E,+EAA+E;AAC/E,oEAAoE;AACpE,EAAE;AACF,kFAAkF;AAClF,iFAAiF;AACjF,6EAA6E;AAC7E,2CAA2C;AAE3C,MAAM,CAAC,MAAM,wBAAwB,GAAG,gCAAgC,CAAC;AAEzE,gFAAgF;AAChF,OAAO,EACL,iCAAiC,EACjC,8BAA8B,EAC9B,2BAA2B,EAC3B,4BAA4B,EAC5B,mCAAmC,EACnC,kCAAkC,EAClC,8CAA8C,EAC9C,+BAA+B,EAC/B,iCAAiC,EACjC,sCAAsC,EACtC,qCAAqC,EACrC,oBAAoB,EACpB,2BAA2B,EAC3B,iCAAiC,EACjC,qCAAqC,EACrC,uBAAuB,EACvB,6BAA6B,EAC7B,yBAAyB,EACzB,mCAAmC,EACnC,+BAA+B,EAC/B,2CAA2C,EAC3C,gCAAgC,EAChC,sCAAsC,EACtC,qBAAqB,EACrB,0BAA0B,EAC1B,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare function parseTokenIdentifier(tokenIdentifier: string): {
2
+ issuer: string;
3
+ subject: string;
4
+ } | null;
5
+ //# sourceMappingURL=token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/shared/token.ts"],"names":[],"mappings":"AAQA,wBAAgB,oBAAoB,CAAC,eAAe,EAAE,MAAM;;;SAS3D"}
@@ -0,0 +1,19 @@
1
+ // Canonical Convex `tokenIdentifier` parser, shared by the component-side
2
+ // authorization paths (effective.ts, checks.ts, queries.ts).
3
+ //
4
+ // Convex composes a verified identity's `tokenIdentifier` as `${issuer}|${subject}`.
5
+ // This split is security-load-bearing: the evaluator resolves a caller to a
6
+ // principal by `subject` and fences on `issuer`, so every consumer MUST agree on
7
+ // the exact parse. Keep it in one place so the issuer/subject boundary cannot
8
+ // drift between call sites.
9
+ export function parseTokenIdentifier(tokenIdentifier) {
10
+ const separatorIndex = tokenIdentifier.lastIndexOf("|");
11
+ if (separatorIndex <= 0 || separatorIndex === tokenIdentifier.length - 1) {
12
+ return null;
13
+ }
14
+ return {
15
+ issuer: tokenIdentifier.slice(0, separatorIndex),
16
+ subject: tokenIdentifier.slice(separatorIndex + 1),
17
+ };
18
+ }
19
+ //# sourceMappingURL=token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.js","sourceRoot":"","sources":["../../src/shared/token.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6DAA6D;AAC7D,EAAE;AACF,qFAAqF;AACrF,4EAA4E;AAC5E,iFAAiF;AACjF,8EAA8E;AAC9E,4BAA4B;AAC5B,MAAM,UAAU,oBAAoB,CAAC,eAAuB;IAC1D,MAAM,cAAc,GAAG,eAAe,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACxD,IAAI,cAAc,IAAI,CAAC,IAAI,cAAc,KAAK,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO;QACL,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC;QAChD,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC;KACnD,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,89 @@
1
+ {
2
+ "name": "@usehercules/convex",
3
+ "version": "0.0.0",
4
+ "description": "Convex Access Control utilities for Hercules applications",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/client/index.d.ts",
10
+ "default": "./dist/client/index.js"
11
+ },
12
+ "./access-admin": {
13
+ "types": "./dist/client/access-admin.d.ts",
14
+ "default": "./dist/client/access-admin.js"
15
+ },
16
+ "./access-admin.js": {
17
+ "types": "./dist/client/access-admin.d.ts",
18
+ "default": "./dist/client/access-admin.js"
19
+ },
20
+ "./http": {
21
+ "types": "./dist/client/http.d.ts",
22
+ "default": "./dist/client/http.js"
23
+ },
24
+ "./checker": {
25
+ "types": "./dist/checker/index.d.ts",
26
+ "default": "./dist/checker/index.js"
27
+ },
28
+ "./convex.config.js": {
29
+ "types": "./dist/component/convex.config.d.ts",
30
+ "default": "./dist/component/convex.config.js"
31
+ },
32
+ "./convex.config": {
33
+ "types": "./dist/component/convex.config.d.ts",
34
+ "default": "./dist/component/convex.config.js"
35
+ },
36
+ "./_generated/component.js": {
37
+ "types": "./dist/_generated/component.d.ts",
38
+ "default": "./dist/_generated/component.js"
39
+ },
40
+ "./_generated/component": {
41
+ "types": "./dist/_generated/component.d.ts",
42
+ "default": "./dist/_generated/component.js"
43
+ },
44
+ "./package.json": "./package.json"
45
+ },
46
+ "bin": {
47
+ "hercules-convex-access-check": "./dist/checker/cli.js"
48
+ },
49
+ "author": "Hercules Team",
50
+ "license": "MIT",
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "git+https://github.com/withzeusai/hercules-js.git",
54
+ "directory": "packages/convex"
55
+ },
56
+ "files": [
57
+ "dist"
58
+ ],
59
+ "publishConfig": {
60
+ "access": "public"
61
+ },
62
+ "dependencies": {
63
+ "@usehercules/sdk": "^1.14.5",
64
+ "convex-helpers": "0.1.119",
65
+ "standardwebhooks": "^1.0.0",
66
+ "tslib": "^2.8.1",
67
+ "typescript": "^5.9.3",
68
+ "zod": "^4.3.6"
69
+ },
70
+ "peerDependencies": {
71
+ "convex": "^1.34.0"
72
+ },
73
+ "devDependencies": {
74
+ "@edge-runtime/vm": "^5.0.0",
75
+ "@types/node": "^24.10.15",
76
+ "convex": "^1.34.1",
77
+ "convex-test": "^0.0.53",
78
+ "typescript": "^5.9.3",
79
+ "vitest": "^4.1.0"
80
+ },
81
+ "main": "./dist/client/index.js",
82
+ "module": "./dist/client/index.js",
83
+ "types": "./dist/client/index.d.ts",
84
+ "scripts": {
85
+ "build": "tsc --project ./tsconfig.build.json",
86
+ "dev": "tsc --project ./tsconfig.build.json --watch",
87
+ "test": "vitest --run"
88
+ }
89
+ }