@middlewr/contracts 0.0.14 → 0.0.15
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/dist/cjs/analytics.schema.d.ts +54 -0
- package/dist/cjs/analytics.schema.d.ts.map +1 -1
- package/dist/cjs/index.d.ts +162 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +293 -251
- package/dist/esm/analytics.schema.d.ts +54 -0
- package/dist/esm/analytics.schema.d.ts.map +1 -1
- package/dist/esm/index.d.ts +162 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +287 -251
- package/package.json +1 -1
- package/src/analytics.schema.ts +30 -0
- package/src/index.ts +15 -0
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { ContractRouterClient } from '@orpc/contract';
|
|
|
2
2
|
import { oc } from '@orpc/contract';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
+
import { AnalyticsOutputSchema, AnalyticsQuerySchema } from './analytics.schema';
|
|
5
6
|
import { ApiKeySchema, CreateApiKeyInputSchema, CreateApiKeyResponseSchema } from './api-keys.schema';
|
|
6
7
|
import { BillingStatusSchema, CheckoutSessionSchema, CreateCheckoutInputSchema, CustomerPortalSchema } from './billing.schema';
|
|
7
8
|
import {
|
|
@@ -42,6 +43,19 @@ export * from './tags.schema';
|
|
|
42
43
|
export * from './users.schema';
|
|
43
44
|
export * from './workspaces.schema';
|
|
44
45
|
|
|
46
|
+
// Analytics contract
|
|
47
|
+
export const analyticsContract = {
|
|
48
|
+
workspace: oc
|
|
49
|
+
.route({ method: 'GET', path: '/api/workspaces/{workspace_id}/analytics' })
|
|
50
|
+
.input(WorkspaceIdParamSchema.merge(AnalyticsQuerySchema))
|
|
51
|
+
.output(AnalyticsOutputSchema),
|
|
52
|
+
|
|
53
|
+
link: oc
|
|
54
|
+
.route({ method: 'GET', path: '/api/workspaces/{workspace_id}/links/{link_id}/analytics' })
|
|
55
|
+
.input(LinkIdParamSchema.merge(AnalyticsQuerySchema))
|
|
56
|
+
.output(AnalyticsOutputSchema),
|
|
57
|
+
};
|
|
58
|
+
|
|
45
59
|
// Users contract
|
|
46
60
|
export const usersContract = {
|
|
47
61
|
me: oc.route({ method: 'GET', path: '/api/users/me' }).output(z.object({ user: UserSchema })),
|
|
@@ -229,6 +243,7 @@ export const billingContract = {
|
|
|
229
243
|
|
|
230
244
|
// Full contract
|
|
231
245
|
export const contract = {
|
|
246
|
+
analytics: analyticsContract,
|
|
232
247
|
users: usersContract,
|
|
233
248
|
apiKeys: apiKeysContract,
|
|
234
249
|
workspaces: workspacesContract,
|