@classytic/arc 2.7.3 → 2.8.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 (114) hide show
  1. package/README.md +2 -2
  2. package/dist/{HookSystem-D7lfx--K.mjs → HookSystem-BjFu7zf1.mjs} +3 -2
  3. package/dist/adapters/index.d.mts +2 -2
  4. package/dist/audit/index.d.mts +1 -1
  5. package/dist/audit/index.mjs +1 -1
  6. package/dist/audit/mongodb.d.mts +1 -1
  7. package/dist/audit/mongodb.mjs +1 -1
  8. package/dist/auth/index.d.mts +4 -4
  9. package/dist/auth/index.mjs +2 -2
  10. package/dist/auth/redis-session.d.mts +1 -1
  11. package/dist/{betterAuthOpenApi-CCw3YX0g.mjs → betterAuthOpenApi-CHCIuA-p.mjs} +1 -1
  12. package/dist/cache/index.d.mts +2 -2
  13. package/dist/cache/index.mjs +1 -1
  14. package/dist/cli/commands/docs.mjs +2 -2
  15. package/dist/cli/commands/generate.mjs +1 -1
  16. package/dist/cli/commands/introspect.mjs +1 -1
  17. package/dist/core/index.d.mts +2 -2
  18. package/dist/core/index.mjs +3 -2
  19. package/dist/core-BfrfxNqO.mjs +34 -0
  20. package/dist/{core-BWekSEju.mjs → createActionRouter-CbkIAaGh.mjs} +6 -36
  21. package/dist/{createApp-D7e77m8C.mjs → createApp-Cy8eUNKQ.mjs} +10 -10
  22. package/dist/{defineResource-DZzyl4a4.mjs → defineResource-CovBXvTB.mjs} +75 -9
  23. package/dist/docs/index.d.mts +2 -2
  24. package/dist/docs/index.mjs +1 -1
  25. package/dist/dynamic/index.d.mts +2 -2
  26. package/dist/dynamic/index.mjs +1 -1
  27. package/dist/{elevation-By_p2lnn.mjs → elevation-BBGFjzIP.mjs} +1 -1
  28. package/dist/{errorHandler-pCpEtNd7.d.mts → errorHandler-BeN-ERN7.d.mts} +1 -1
  29. package/dist/{eventPlugin-CdvUoUna.d.mts → eventPlugin-CAOWMQS8.d.mts} +1 -1
  30. package/dist/events/index.d.mts +3 -3
  31. package/dist/events/index.mjs +1 -1
  32. package/dist/events/transports/redis-stream-entry.d.mts +1 -1
  33. package/dist/events/transports/redis.d.mts +1 -1
  34. package/dist/factory/index.d.mts +1 -1
  35. package/dist/factory/index.mjs +7 -6
  36. package/dist/hooks/index.d.mts +1 -1
  37. package/dist/hooks/index.mjs +1 -1
  38. package/dist/idempotency/index.d.mts +3 -3
  39. package/dist/idempotency/mongodb.d.mts +1 -1
  40. package/dist/idempotency/mongodb.mjs +1 -3
  41. package/dist/idempotency/redis.d.mts +1 -1
  42. package/dist/{index-C9eYNjGR.d.mts → index-BpMhrFgn.d.mts} +1 -1
  43. package/dist/{index-B0extFr4.d.mts → index-CBru2y5Y.d.mts} +3 -3
  44. package/dist/{index-BjShrzoj.d.mts → index-qct60lnl.d.mts} +14 -14
  45. package/dist/index.d.mts +7 -7
  46. package/dist/index.mjs +4 -4
  47. package/dist/integrations/event-gateway.d.mts +1 -1
  48. package/dist/integrations/event-gateway.mjs +1 -1
  49. package/dist/integrations/index.d.mts +1 -1
  50. package/dist/integrations/mcp/index.d.mts +2 -2
  51. package/dist/integrations/mcp/index.mjs +1 -1
  52. package/dist/integrations/mcp/testing.d.mts +1 -1
  53. package/dist/integrations/mcp/testing.mjs +1 -1
  54. package/dist/integrations/streamline.d.mts +39 -7
  55. package/dist/integrations/streamline.mjs +106 -4
  56. package/dist/{interface-B91alUzq.d.mts → interface-IJqN3pXK.d.mts} +145 -4
  57. package/dist/{mongodb-Cgu9F1Nd.d.mts → mongodb-B1eVtFhw.d.mts} +1 -1
  58. package/dist/{mongodb-B7zupyck.d.mts → mongodb-NShVZDMr.d.mts} +1 -1
  59. package/dist/{openapi-BBSTVcMm.mjs → openapi-AYLVjqVe.mjs} +1 -1
  60. package/dist/org/index.d.mts +2 -2
  61. package/dist/permissions/index.d.mts +3 -3
  62. package/dist/plugins/index.d.mts +4 -4
  63. package/dist/plugins/index.mjs +8 -8
  64. package/dist/plugins/tracing-entry.d.mts +1 -1
  65. package/dist/plugins/tracing-entry.mjs +1 -1
  66. package/dist/policies/index.d.mts +1 -1
  67. package/dist/presets/index.d.mts +1 -1
  68. package/dist/presets/multiTenant.d.mts +1 -1
  69. package/dist/{queryCachePlugin-Ckl71mkc.d.mts → queryCachePlugin-BCFVXnxK.d.mts} +1 -1
  70. package/dist/{redis-3TQxm2VZ.d.mts → redis-Bunu3qWg.d.mts} +1 -1
  71. package/dist/{redis-stream-Dag5LFa9.d.mts → redis-stream-CF1lrKVk.d.mts} +1 -1
  72. package/dist/registry/index.d.mts +1 -1
  73. package/dist/registry/index.mjs +2 -2
  74. package/dist/{resourceToTools-BJkoQoUP.mjs → resourceToTools-C_1SMiCz.mjs} +1 -1
  75. package/dist/rpc/index.d.mts +1 -1
  76. package/dist/{schemaConverter-0TyONAwM.mjs → schemaConverter-Y5EejTnJ.mjs} +1 -4
  77. package/dist/scope/index.d.mts +2 -2
  78. package/dist/scope/index.mjs +1 -1
  79. package/dist/{sse-6W0hjVS_.mjs → sse-CD5Hghpu.mjs} +1 -1
  80. package/dist/testing/index.d.mts +2 -2
  81. package/dist/testing/index.mjs +1 -1
  82. package/dist/types/index.d.mts +5 -5
  83. package/dist/{types-B4BNthET.d.mts → types-BoaZHr-2.d.mts} +1 -1
  84. package/dist/{types-C5g2oRC7.d.mts → types-Ct0PUUSp.d.mts} +1 -1
  85. package/dist/{types-2FlNl0mL.d.mts → types-gUxAIZHp.d.mts} +13 -9
  86. package/dist/utils/index.d.mts +3 -3
  87. package/dist/utils/index.mjs +1 -1
  88. package/package.json +8 -7
  89. package/skills/arc/SKILL.md +23 -4
  90. package/skills/arc/references/integrations.md +1 -1
  91. package/skills/arc/references/mcp.md +2 -0
  92. /package/dist/{EventTransport-C4VheKeC.d.mts → EventTransport-n1KBxC_N.d.mts} +0 -0
  93. /package/dist/{ResourceRegistry-DsHiG9cL.mjs → ResourceRegistry-BOtJuRCs.mjs} +0 -0
  94. /package/dist/{caching-5DtLwIqb.mjs → caching-CHH-iHs3.mjs} +0 -0
  95. /package/dist/{circuitBreaker-BBPDt-J_.d.mts → circuitBreaker-BGVoB1hD.d.mts} +0 -0
  96. /package/dist/{elevation-D7WK0RXq.d.mts → elevation-UJO3-NvX.d.mts} +0 -0
  97. /package/dist/{errorHandler-CH8wk1eD.mjs → errorHandler-BW08lEiy.mjs} +0 -0
  98. /package/dist/{errors-BS6lZvWy.d.mts → errors-BI8kEKsO.d.mts} +0 -0
  99. /package/dist/{eventPlugin-B6U_nCFU.mjs → eventPlugin-x4jo3sG0.mjs} +0 -0
  100. /package/dist/{externalPaths-iba7jD3d.d.mts → externalPaths-BQ8QijNH.d.mts} +0 -0
  101. /package/dist/{fields-D4nMDqnK.d.mts → fields-DoeDgh2b.d.mts} +0 -0
  102. /package/dist/{interface-CSbZdv_3.d.mts → interface-CkkWm5uR.d.mts} +0 -0
  103. /package/dist/{interface-CG7oRZjX.d.mts → interface-bpoLKKqx.d.mts} +0 -0
  104. /package/dist/{logger-DLg8-Ueg.mjs → logger-CDjpjySd.mjs} +0 -0
  105. /package/dist/{metrics-Qnvwc-LQ.mjs → metrics-DuhiSEZI.mjs} +0 -0
  106. /package/dist/{mongodb-B7X7P1P8.mjs → mongodb-5Ff3w8jy.mjs} +0 -0
  107. /package/dist/{pluralize-Dckfq6US.mjs → pluralize-BneOJkpi.mjs} +0 -0
  108. /package/dist/{queryCachePlugin-CwTpR04-.mjs → queryCachePlugin-D0iIVhW_.mjs} +0 -0
  109. /package/dist/{registry-B3lRFBWo.mjs → registry-B0Wl7uVV.mjs} +0 -0
  110. /package/dist/{replyHelpers-uDUIYh7u.mjs → replyHelpers-CXtJDAZ0.mjs} +0 -0
  111. /package/dist/{sessionManager-CEo9jwPI.d.mts → sessionManager-BkzVU8h2.d.mts} +0 -0
  112. /package/dist/{tracing-DEqdGkr-.d.mts → tracing-xqXzWeaf.d.mts} +0 -0
  113. /package/dist/{types--D3vvfdt.d.mts → types-CN6JvmYz.d.mts} +0 -0
  114. /package/dist/{versioning-CdBbFefk.mjs → versioning-CPU_5Xfs.mjs} +0 -0
@@ -8,11 +8,11 @@ description: |
8
8
  Triggers: arc, fastify resource, defineResource, createApp, BaseController, arc preset,
9
9
  arc auth, arc events, arc jobs, arc websocket, arc mcp, arc plugin, arc testing, arc cli,
10
10
  arc permissions, arc hooks, arc pipeline, arc factory, arc cache, arc QueryCache.
11
- version: 2.7.3
11
+ version: 2.8.0
12
12
  license: MIT
13
13
  metadata:
14
14
  author: Classytic
15
- version: "2.7.1"
15
+ version: "2.8.0"
16
16
  tags:
17
17
  - fastify
18
18
  - rest-api
@@ -91,6 +91,23 @@ const productResource = defineResource({
91
91
  additionalRoutes: [
92
92
  { method: 'GET', path: '/featured', handler: 'getFeatured', permissions: allowPublic(), wrapHandler: true },
93
93
  ],
94
+
95
+ // v2.8: routes (replaces additionalRoutes — additionalRoutes still works but is deprecated)
96
+ routes: [
97
+ { method: 'GET', path: '/stats', handler: 'getStats', permissions: auth() },
98
+ { method: 'POST', path: '/webhook', handler: webhookFn, raw: true, permissions: auth() },
99
+ ],
100
+
101
+ // v2.8: actions (replaces onRegister + createActionRouter)
102
+ actions: {
103
+ approve: async (id, data, req) => service.approve(id, req.user._id),
104
+ cancel: {
105
+ handler: async (id, data, req) => service.cancel(id, data.reason, req.user._id),
106
+ permissions: roles('admin'),
107
+ schema: { reason: { type: 'string' } },
108
+ },
109
+ },
110
+ actionPermissions: auth(),
94
111
  });
95
112
 
96
113
  await fastify.register(productResource.toPlugin());
@@ -867,7 +884,8 @@ permissions: {
867
884
  **DX helpers:**
868
885
 
869
886
  ```typescript
870
- // Typed request for wrapHandler: false routes — no more (req as any).user
887
+ // Typed request for raw routes — no more (req as any).user
888
+ // v2.8: `raw: true` replaces `wrapHandler: false` (wrapHandler still works but is deprecated)
871
889
  import type { ArcRequest } from '@classytic/arc';
872
890
  handler: async (req: ArcRequest, reply) => { req.user?.id; req.scope; req.signal; }
873
891
 
@@ -884,6 +902,7 @@ import { createDomainError } from '@classytic/arc';
884
902
  throw createDomainError('SELF_REFERRAL', 'Cannot refer yourself', 422);
885
903
 
886
904
  // Resource lifecycle hook — wire singletons during registration
905
+ // v2.8: for action routes, use `actions` config instead of onRegister + createActionRouter
887
906
  defineResource({ name: 'notification', onRegister: (f) => setSseManager(f.sseManager) });
888
907
 
889
908
  // SSE auth — preAuth runs BEFORE auth middleware (EventSource can't set headers)
@@ -893,7 +912,7 @@ additionalRoutes: [{ preAuth: [(req) => { req.headers.authorization = `Bearer ${
893
912
  additionalRoutes: [{ streamResponse: true, handler: async (req, reply) => reply.send(stream) }]
894
913
  ```
895
914
 
896
- ## DX Helpers (v2.7.3)
915
+ ## DX Helpers (v2.7.3+)
897
916
 
898
917
  **Reply helpers** — consistent response envelopes (opt-in via `createApp({ replyHelpers: true })`):
899
918
 
@@ -3,7 +3,7 @@
3
3
  Pluggable adapters for BullMQ jobs, WebSocket real-time, Streamline workflows, and MCP tools.
4
4
  All are separate subpath imports — only loaded when explicitly used.
5
5
 
6
- > **MCP** has its own dedicated reference: [mcp.md](mcp.md) — auto-generate tools from resources, custom tools, Better Auth OAuth 2.1.
6
+ > **MCP** has its own dedicated reference: [mcp.md](mcp.md) — auto-generate tools from resources (including actions, v2.8), custom tools, Better Auth OAuth 2.1.
7
7
 
8
8
  ## Job Queue (BullMQ)
9
9
 
@@ -46,6 +46,8 @@ await app.register(mcpPlugin, {
46
46
 
47
47
  Per resource, generates up to 5 tools: `list_{plural}`, `get_{name}`, `create_{name}`, `update_{name}`, `delete_{name}`.
48
48
 
49
+ Resource `actions` (v2.8) also auto-generate MCP tools — each action becomes a tool named `{action}_{name}` with the action's input schema.
50
+
49
51
  Tool handlers call `BaseController` — same pipeline as REST (auth, org-scoping, hooks, field permissions, cache).
50
52
 
51
53
  ### McpPluginOptions