@middlewr/contracts 0.0.11 → 0.0.12

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/src/index.ts CHANGED
@@ -2,7 +2,9 @@ import type { ContractRouterClient } from '@orpc/contract';
2
2
  import { oc } from '@orpc/contract';
3
3
  import { z } from 'zod';
4
4
 
5
+ import { ApiKeySchema, CreateApiKeyInputSchema, CreateApiKeyResponseSchema } from './api-keys.schema';
5
6
  import {
7
+ ApiKeyIdParamSchema,
6
8
  DomainIdParamSchema,
7
9
  InvitationIdParamSchema,
8
10
  LinkIdParamSchema,
@@ -28,6 +30,8 @@ import {
28
30
  WorkspaceWithCountSchema,
29
31
  } from './workspaces.schema';
30
32
 
33
+ export * from './analytics.schema';
34
+ export * from './api-keys.schema';
31
35
  export * from './common.schema';
32
36
  export * from './domains.schema';
33
37
  export * from './links.schema';
@@ -51,6 +55,15 @@ export const usersContract = {
51
55
  .output(z.object({ user: UserSchema })),
52
56
  };
53
57
 
58
+ // API Keys contract
59
+ export const apiKeysContract = {
60
+ create: oc.route({ method: 'POST', path: '/api/api-keys' }).input(CreateApiKeyInputSchema).output(CreateApiKeyResponseSchema),
61
+
62
+ list: oc.route({ method: 'GET', path: '/api/api-keys' }).output(z.array(ApiKeySchema)),
63
+
64
+ delete: oc.route({ method: 'DELETE', path: '/api/api-keys/{api_key_id}' }).input(ApiKeyIdParamSchema).output(z.void()),
65
+ };
66
+
54
67
  // Workspaces contract
55
68
  export const workspacesContract = {
56
69
  create: oc.route({ method: 'POST', path: '/api/workspaces' }).input(CreateWorkspaceInputSchema).output(WorkspaceSchema),
@@ -197,6 +210,7 @@ export const domainsContract = {
197
210
  // Full contract
198
211
  export const contract = {
199
212
  users: usersContract,
213
+ apiKeys: apiKeysContract,
200
214
  workspaces: workspacesContract,
201
215
  invitations: invitationsContract,
202
216
  links: linksContract,