@middlewr/contracts 0.0.1
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/common.schema.d.ts +24 -0
- package/common.schema.d.ts.map +1 -0
- package/common.schema.js +26 -0
- package/index.d.ts +778 -0
- package/index.d.ts.map +1 -0
- package/index.js +124 -0
- package/links.schema.d.ts +109 -0
- package/links.schema.d.ts.map +1 -0
- package/links.schema.js +98 -0
- package/package.json +20 -0
- package/tags.schema.d.ts +18 -0
- package/tags.schema.d.ts.map +1 -0
- package/tags.schema.js +27 -0
- package/users.schema.d.ts +20 -0
- package/users.schema.d.ts.map +1 -0
- package/users.schema.js +22 -0
- package/workspaces.schema.d.ts +50 -0
- package/workspaces.schema.d.ts.map +1 -0
- package/workspaces.schema.js +50 -0
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/contracts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAyBxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAE9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AAGpC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASzB,CAAC;AAGF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkD9B,CAAC;AAGF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;CAI/B,CAAC;AAGF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmBzB,CAAC;AAGF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBxB,CAAC;AAGF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMpB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC"}
|
package/index.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.contract = exports.tagsContract = exports.linksContract = exports.invitationsContract = exports.workspacesContract = exports.usersContract = void 0;
|
|
18
|
+
const contract_1 = require("@orpc/contract");
|
|
19
|
+
const zod_1 = require("zod");
|
|
20
|
+
const common_schema_1 = require("./common.schema");
|
|
21
|
+
const links_schema_1 = require("./links.schema");
|
|
22
|
+
const tags_schema_1 = require("./tags.schema");
|
|
23
|
+
const users_schema_1 = require("./users.schema");
|
|
24
|
+
const workspaces_schema_1 = require("./workspaces.schema");
|
|
25
|
+
__exportStar(require("./common.schema"), exports);
|
|
26
|
+
__exportStar(require("./links.schema"), exports);
|
|
27
|
+
__exportStar(require("./tags.schema"), exports);
|
|
28
|
+
// Re-export all schemas
|
|
29
|
+
__exportStar(require("./users.schema"), exports);
|
|
30
|
+
__exportStar(require("./workspaces.schema"), exports);
|
|
31
|
+
// Users contract
|
|
32
|
+
exports.usersContract = {
|
|
33
|
+
me: contract_1.oc.route({ method: 'GET', path: '/api/users/me' }).output(users_schema_1.UserSchema),
|
|
34
|
+
signIn: contract_1.oc
|
|
35
|
+
.route({ method: 'POST', path: '/api/users' })
|
|
36
|
+
.input(users_schema_1.SignInInputSchema)
|
|
37
|
+
.output(zod_1.z.object({ user: users_schema_1.UserSchema, status: zod_1.z.enum(['created', 'existing']) })),
|
|
38
|
+
update: contract_1.oc.route({ method: 'PATCH', path: '/api/users/me' }).input(users_schema_1.UpdateUserInputSchema).output(users_schema_1.UserSchema),
|
|
39
|
+
};
|
|
40
|
+
// Workspaces contract
|
|
41
|
+
exports.workspacesContract = {
|
|
42
|
+
create: contract_1.oc.route({ method: 'POST', path: '/api/workspaces' }).input(workspaces_schema_1.CreateWorkspaceInputSchema).output(workspaces_schema_1.WorkspaceSchema),
|
|
43
|
+
list: contract_1.oc.route({ method: 'GET', path: '/api/workspaces' }).output(zod_1.z.array(workspaces_schema_1.WorkspaceWithCountSchema)),
|
|
44
|
+
get: contract_1.oc.route({ method: 'GET', path: '/api/workspaces/{workspaceId}' }).input(common_schema_1.WorkspaceIdParamSchema).output(workspaces_schema_1.WorkspaceWithCountSchema),
|
|
45
|
+
update: contract_1.oc
|
|
46
|
+
.route({ method: 'PATCH', path: '/api/workspaces/{workspaceId}' })
|
|
47
|
+
.input(common_schema_1.WorkspaceIdParamSchema.merge(workspaces_schema_1.UpdateWorkspaceInputSchema))
|
|
48
|
+
.output(workspaces_schema_1.WorkspaceSchema),
|
|
49
|
+
delete: contract_1.oc.route({ method: 'DELETE', path: '/api/workspaces/{workspaceId}' }).input(common_schema_1.WorkspaceIdParamSchema).output(zod_1.z.void()),
|
|
50
|
+
transfer: contract_1.oc
|
|
51
|
+
.route({ method: 'POST', path: '/api/workspaces/{workspaceId}/transfer' })
|
|
52
|
+
.input(common_schema_1.WorkspaceIdParamSchema.merge(workspaces_schema_1.TransferOwnershipInputSchema))
|
|
53
|
+
.output(zod_1.z.void()),
|
|
54
|
+
// Members
|
|
55
|
+
listMembers: contract_1.oc
|
|
56
|
+
.route({ method: 'GET', path: '/api/workspaces/{workspaceId}/members' })
|
|
57
|
+
.input(common_schema_1.WorkspaceIdParamSchema)
|
|
58
|
+
.output(zod_1.z.array(workspaces_schema_1.WorkspaceMemberSchema)),
|
|
59
|
+
updateMember: contract_1.oc
|
|
60
|
+
.route({ method: 'PATCH', path: '/api/workspaces/{workspaceId}/members/{userId}' })
|
|
61
|
+
.input(common_schema_1.MemberIdParamSchema.merge(workspaces_schema_1.UpdateMemberInputSchema))
|
|
62
|
+
.output(workspaces_schema_1.WorkspaceMemberSchema),
|
|
63
|
+
removeMember: contract_1.oc
|
|
64
|
+
.route({ method: 'DELETE', path: '/api/workspaces/{workspaceId}/members/{userId}' })
|
|
65
|
+
.input(common_schema_1.MemberIdParamSchema)
|
|
66
|
+
.output(zod_1.z.void()),
|
|
67
|
+
// Invitations
|
|
68
|
+
listInvitations: contract_1.oc
|
|
69
|
+
.route({ method: 'GET', path: '/api/workspaces/{workspaceId}/invitations' })
|
|
70
|
+
.input(common_schema_1.WorkspaceIdParamSchema)
|
|
71
|
+
.output(zod_1.z.array(workspaces_schema_1.WorkspaceInvitationSchema)),
|
|
72
|
+
createInvitation: contract_1.oc
|
|
73
|
+
.route({ method: 'POST', path: '/api/workspaces/{workspaceId}/invitations' })
|
|
74
|
+
.input(common_schema_1.WorkspaceIdParamSchema.merge(workspaces_schema_1.CreateInvitationInputSchema))
|
|
75
|
+
.output(workspaces_schema_1.WorkspaceInvitationSchema),
|
|
76
|
+
revokeInvitation: contract_1.oc
|
|
77
|
+
.route({ method: 'DELETE', path: '/api/workspaces/{workspaceId}/invitations/{invitationId}' })
|
|
78
|
+
.input(common_schema_1.InvitationIdParamSchema)
|
|
79
|
+
.output(zod_1.z.void()),
|
|
80
|
+
};
|
|
81
|
+
// Invitations contract (public)
|
|
82
|
+
exports.invitationsContract = {
|
|
83
|
+
get: contract_1.oc.route({ method: 'GET', path: '/api/invitations/{token}' }).input(common_schema_1.TokenParamSchema).output(workspaces_schema_1.WorkspaceInvitationSchema),
|
|
84
|
+
accept: contract_1.oc.route({ method: 'POST', path: '/api/invitations/{token}/accept' }).input(common_schema_1.TokenParamSchema).output(workspaces_schema_1.WorkspaceMemberSchema),
|
|
85
|
+
};
|
|
86
|
+
// Links contract
|
|
87
|
+
exports.linksContract = {
|
|
88
|
+
create: contract_1.oc
|
|
89
|
+
.route({ method: 'POST', path: '/api/workspaces/{workspaceId}/links' })
|
|
90
|
+
.input(common_schema_1.WorkspaceIdParamSchema.merge(links_schema_1.CreateLinkInputSchema))
|
|
91
|
+
.output(links_schema_1.LinkSchema),
|
|
92
|
+
list: contract_1.oc
|
|
93
|
+
.route({ method: 'GET', path: '/api/workspaces/{workspaceId}/links' })
|
|
94
|
+
.input(common_schema_1.WorkspaceIdParamSchema.merge(links_schema_1.LinkFiltersSchema))
|
|
95
|
+
.output(links_schema_1.PaginatedLinksSchema),
|
|
96
|
+
get: contract_1.oc.route({ method: 'GET', path: '/api/workspaces/{workspaceId}/links/{linkId}' }).input(common_schema_1.LinkIdParamSchema).output(links_schema_1.LinkSchema),
|
|
97
|
+
update: contract_1.oc
|
|
98
|
+
.route({ method: 'PATCH', path: '/api/workspaces/{workspaceId}/links/{linkId}' })
|
|
99
|
+
.input(common_schema_1.LinkIdParamSchema.merge(links_schema_1.UpdateLinkInputSchema))
|
|
100
|
+
.output(links_schema_1.LinkSchema),
|
|
101
|
+
delete: contract_1.oc.route({ method: 'DELETE', path: '/api/workspaces/{workspaceId}/links/{linkId}' }).input(common_schema_1.LinkIdParamSchema).output(zod_1.z.void()),
|
|
102
|
+
};
|
|
103
|
+
// Tags contract
|
|
104
|
+
exports.tagsContract = {
|
|
105
|
+
create: contract_1.oc
|
|
106
|
+
.route({ method: 'POST', path: '/api/workspaces/{workspaceId}/tags' })
|
|
107
|
+
.input(common_schema_1.WorkspaceIdParamSchema.merge(tags_schema_1.CreateTagInputSchema))
|
|
108
|
+
.output(tags_schema_1.TagSchema),
|
|
109
|
+
list: contract_1.oc.route({ method: 'GET', path: '/api/workspaces/{workspaceId}/tags' }).input(common_schema_1.WorkspaceIdParamSchema).output(zod_1.z.array(tags_schema_1.TagSchema)),
|
|
110
|
+
get: contract_1.oc.route({ method: 'GET', path: '/api/workspaces/{workspaceId}/tags/{tagId}' }).input(common_schema_1.TagIdParamSchema).output(tags_schema_1.TagSchema),
|
|
111
|
+
update: contract_1.oc
|
|
112
|
+
.route({ method: 'PATCH', path: '/api/workspaces/{workspaceId}/tags/{tagId}' })
|
|
113
|
+
.input(common_schema_1.TagIdParamSchema.merge(tags_schema_1.UpdateTagInputSchema))
|
|
114
|
+
.output(tags_schema_1.TagSchema),
|
|
115
|
+
delete: contract_1.oc.route({ method: 'DELETE', path: '/api/workspaces/{workspaceId}/tags/{tagId}' }).input(common_schema_1.TagIdParamSchema).output(zod_1.z.void()),
|
|
116
|
+
};
|
|
117
|
+
// Full contract
|
|
118
|
+
exports.contract = {
|
|
119
|
+
users: exports.usersContract,
|
|
120
|
+
workspaces: exports.workspacesContract,
|
|
121
|
+
invitations: exports.invitationsContract,
|
|
122
|
+
links: exports.linksContract,
|
|
123
|
+
tags: exports.tagsContract,
|
|
124
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const LinkSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
workspace_id: z.ZodString;
|
|
5
|
+
created_by_id: z.ZodString;
|
|
6
|
+
original_url: z.ZodString;
|
|
7
|
+
short_code: z.ZodString;
|
|
8
|
+
title: z.ZodNullable<z.ZodString>;
|
|
9
|
+
description: z.ZodNullable<z.ZodString>;
|
|
10
|
+
utm_source: z.ZodNullable<z.ZodString>;
|
|
11
|
+
utm_medium: z.ZodNullable<z.ZodString>;
|
|
12
|
+
utm_campaign: z.ZodNullable<z.ZodString>;
|
|
13
|
+
utm_term: z.ZodNullable<z.ZodString>;
|
|
14
|
+
utm_content: z.ZodNullable<z.ZodString>;
|
|
15
|
+
password: z.ZodNullable<z.ZodString>;
|
|
16
|
+
starts_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
17
|
+
expires_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
18
|
+
is_active: z.ZodBoolean;
|
|
19
|
+
redirect_type: z.ZodNumber;
|
|
20
|
+
click_count: z.ZodNumber;
|
|
21
|
+
click_count_updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
22
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
23
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export declare const CreateLinkInputSchema: z.ZodObject<{
|
|
26
|
+
original_url: z.ZodString;
|
|
27
|
+
short_code: z.ZodOptional<z.ZodString>;
|
|
28
|
+
title: z.ZodOptional<z.ZodString>;
|
|
29
|
+
description: z.ZodOptional<z.ZodString>;
|
|
30
|
+
utm_source: z.ZodOptional<z.ZodString>;
|
|
31
|
+
utm_medium: z.ZodOptional<z.ZodString>;
|
|
32
|
+
utm_campaign: z.ZodOptional<z.ZodString>;
|
|
33
|
+
utm_term: z.ZodOptional<z.ZodString>;
|
|
34
|
+
utm_content: z.ZodOptional<z.ZodString>;
|
|
35
|
+
password: z.ZodOptional<z.ZodString>;
|
|
36
|
+
starts_at: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
37
|
+
expires_at: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
38
|
+
redirect_type: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
39
|
+
tag_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export declare const UpdateLinkInputSchema: z.ZodObject<{
|
|
42
|
+
original_url: z.ZodOptional<z.ZodString>;
|
|
43
|
+
short_code: z.ZodOptional<z.ZodString>;
|
|
44
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
45
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
|
+
utm_source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
|
+
utm_medium: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
48
|
+
utm_campaign: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
49
|
+
utm_term: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
|
+
utm_content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
51
|
+
password: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
52
|
+
starts_at: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
53
|
+
expires_at: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
54
|
+
is_active: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
redirect_type: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
56
|
+
tag_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
export declare const LinkFiltersSchema: z.ZodObject<{
|
|
59
|
+
search: z.ZodOptional<z.ZodString>;
|
|
60
|
+
is_active: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
|
|
61
|
+
has_expiration: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
|
|
62
|
+
expired: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
|
|
63
|
+
created_from: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
64
|
+
created_to: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
65
|
+
expires_from: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
66
|
+
expires_to: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
67
|
+
tag_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
68
|
+
sort_by: z.ZodDefault<z.ZodEnum<{
|
|
69
|
+
title: "title";
|
|
70
|
+
click_count: "click_count";
|
|
71
|
+
created_at: "created_at";
|
|
72
|
+
}>>;
|
|
73
|
+
sort_order: z.ZodDefault<z.ZodEnum<{
|
|
74
|
+
asc: "asc";
|
|
75
|
+
desc: "desc";
|
|
76
|
+
}>>;
|
|
77
|
+
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
78
|
+
per_page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
export declare const PaginatedLinksSchema: z.ZodObject<{
|
|
81
|
+
links: z.ZodArray<z.ZodObject<{
|
|
82
|
+
id: z.ZodString;
|
|
83
|
+
workspace_id: z.ZodString;
|
|
84
|
+
created_by_id: z.ZodString;
|
|
85
|
+
original_url: z.ZodString;
|
|
86
|
+
short_code: z.ZodString;
|
|
87
|
+
title: z.ZodNullable<z.ZodString>;
|
|
88
|
+
description: z.ZodNullable<z.ZodString>;
|
|
89
|
+
utm_source: z.ZodNullable<z.ZodString>;
|
|
90
|
+
utm_medium: z.ZodNullable<z.ZodString>;
|
|
91
|
+
utm_campaign: z.ZodNullable<z.ZodString>;
|
|
92
|
+
utm_term: z.ZodNullable<z.ZodString>;
|
|
93
|
+
utm_content: z.ZodNullable<z.ZodString>;
|
|
94
|
+
password: z.ZodNullable<z.ZodString>;
|
|
95
|
+
starts_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
96
|
+
expires_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
97
|
+
is_active: z.ZodBoolean;
|
|
98
|
+
redirect_type: z.ZodNumber;
|
|
99
|
+
click_count: z.ZodNumber;
|
|
100
|
+
click_count_updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
101
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
102
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
103
|
+
}, z.core.$strip>>;
|
|
104
|
+
total: z.ZodNumber;
|
|
105
|
+
page: z.ZodNumber;
|
|
106
|
+
per_page: z.ZodNumber;
|
|
107
|
+
total_pages: z.ZodNumber;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
//# sourceMappingURL=links.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"links.schema.d.ts","sourceRoot":"","sources":["../src/contracts/links.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;iBAsBrB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;iBAuBhC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;iBAwBhC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;iBAc5B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAM/B,CAAC"}
|
package/links.schema.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaginatedLinksSchema = exports.LinkFiltersSchema = exports.UpdateLinkInputSchema = exports.CreateLinkInputSchema = exports.LinkSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.LinkSchema = zod_1.z.object({
|
|
6
|
+
id: zod_1.z.string().uuid(),
|
|
7
|
+
workspace_id: zod_1.z.string().uuid(),
|
|
8
|
+
created_by_id: zod_1.z.string().uuid(),
|
|
9
|
+
original_url: zod_1.z.string().url(),
|
|
10
|
+
short_code: zod_1.z.string(),
|
|
11
|
+
title: zod_1.z.string().nullable(),
|
|
12
|
+
description: zod_1.z.string().nullable(),
|
|
13
|
+
utm_source: zod_1.z.string().nullable(),
|
|
14
|
+
utm_medium: zod_1.z.string().nullable(),
|
|
15
|
+
utm_campaign: zod_1.z.string().nullable(),
|
|
16
|
+
utm_term: zod_1.z.string().nullable(),
|
|
17
|
+
utm_content: zod_1.z.string().nullable(),
|
|
18
|
+
password: zod_1.z.string().nullable(),
|
|
19
|
+
starts_at: zod_1.z.coerce.date().nullable(),
|
|
20
|
+
expires_at: zod_1.z.coerce.date().nullable(),
|
|
21
|
+
is_active: zod_1.z.boolean(),
|
|
22
|
+
redirect_type: zod_1.z.number().int(),
|
|
23
|
+
click_count: zod_1.z.number().int(),
|
|
24
|
+
click_count_updated_at: zod_1.z.coerce.date().nullable(),
|
|
25
|
+
created_at: zod_1.z.coerce.date(),
|
|
26
|
+
updated_at: zod_1.z.coerce.date().nullable(),
|
|
27
|
+
});
|
|
28
|
+
exports.CreateLinkInputSchema = zod_1.z.object({
|
|
29
|
+
original_url: zod_1.z.string().url().max(2048),
|
|
30
|
+
short_code: zod_1.z
|
|
31
|
+
.string()
|
|
32
|
+
.min(3)
|
|
33
|
+
.max(50)
|
|
34
|
+
.regex(/^[a-zA-Z0-9-]+$/)
|
|
35
|
+
.optional(),
|
|
36
|
+
title: zod_1.z.string().max(255).optional(),
|
|
37
|
+
description: zod_1.z.string().max(2000).optional(),
|
|
38
|
+
utm_source: zod_1.z.string().max(255).optional(),
|
|
39
|
+
utm_medium: zod_1.z.string().max(255).optional(),
|
|
40
|
+
utm_campaign: zod_1.z.string().max(255).optional(),
|
|
41
|
+
utm_term: zod_1.z.string().max(255).optional(),
|
|
42
|
+
utm_content: zod_1.z.string().max(255).optional(),
|
|
43
|
+
password: zod_1.z.string().min(4).max(100).optional(),
|
|
44
|
+
starts_at: zod_1.z.coerce.date().optional(),
|
|
45
|
+
expires_at: zod_1.z.coerce.date().optional(),
|
|
46
|
+
redirect_type: zod_1.z.coerce
|
|
47
|
+
.number()
|
|
48
|
+
.refine((v) => [301, 302, 307, 308].includes(v))
|
|
49
|
+
.optional(),
|
|
50
|
+
tag_ids: zod_1.z.array(zod_1.z.string().uuid()).optional(),
|
|
51
|
+
});
|
|
52
|
+
exports.UpdateLinkInputSchema = zod_1.z.object({
|
|
53
|
+
original_url: zod_1.z.string().url().max(2048).optional(),
|
|
54
|
+
short_code: zod_1.z
|
|
55
|
+
.string()
|
|
56
|
+
.min(3)
|
|
57
|
+
.max(50)
|
|
58
|
+
.regex(/^[a-zA-Z0-9-]+$/)
|
|
59
|
+
.optional(),
|
|
60
|
+
title: zod_1.z.string().max(255).nullable().optional(),
|
|
61
|
+
description: zod_1.z.string().max(2000).nullable().optional(),
|
|
62
|
+
utm_source: zod_1.z.string().max(255).nullable().optional(),
|
|
63
|
+
utm_medium: zod_1.z.string().max(255).nullable().optional(),
|
|
64
|
+
utm_campaign: zod_1.z.string().max(255).nullable().optional(),
|
|
65
|
+
utm_term: zod_1.z.string().max(255).nullable().optional(),
|
|
66
|
+
utm_content: zod_1.z.string().max(255).nullable().optional(),
|
|
67
|
+
password: zod_1.z.string().min(4).max(100).nullable().optional(),
|
|
68
|
+
starts_at: zod_1.z.coerce.date().nullable().optional(),
|
|
69
|
+
expires_at: zod_1.z.coerce.date().nullable().optional(),
|
|
70
|
+
is_active: zod_1.z.boolean().optional(),
|
|
71
|
+
redirect_type: zod_1.z.coerce
|
|
72
|
+
.number()
|
|
73
|
+
.refine((v) => [301, 302, 307, 308].includes(v))
|
|
74
|
+
.optional(),
|
|
75
|
+
tag_ids: zod_1.z.array(zod_1.z.string().uuid()).optional(),
|
|
76
|
+
});
|
|
77
|
+
exports.LinkFiltersSchema = zod_1.z.object({
|
|
78
|
+
search: zod_1.z.string().optional(),
|
|
79
|
+
is_active: zod_1.z.coerce.boolean().optional(),
|
|
80
|
+
has_expiration: zod_1.z.coerce.boolean().optional(),
|
|
81
|
+
expired: zod_1.z.coerce.boolean().optional(),
|
|
82
|
+
created_from: zod_1.z.coerce.date().optional(),
|
|
83
|
+
created_to: zod_1.z.coerce.date().optional(),
|
|
84
|
+
expires_from: zod_1.z.coerce.date().optional(),
|
|
85
|
+
expires_to: zod_1.z.coerce.date().optional(),
|
|
86
|
+
tag_ids: zod_1.z.array(zod_1.z.string().uuid()).optional(),
|
|
87
|
+
sort_by: zod_1.z.enum(['created_at', 'title', 'click_count']).default('created_at'),
|
|
88
|
+
sort_order: zod_1.z.enum(['asc', 'desc']).default('desc'),
|
|
89
|
+
page: zod_1.z.coerce.number().int().min(1).default(1),
|
|
90
|
+
per_page: zod_1.z.coerce.number().int().min(1).max(100).default(20),
|
|
91
|
+
});
|
|
92
|
+
exports.PaginatedLinksSchema = zod_1.z.object({
|
|
93
|
+
links: zod_1.z.array(exports.LinkSchema),
|
|
94
|
+
total: zod_1.z.number().int(),
|
|
95
|
+
page: zod_1.z.number().int(),
|
|
96
|
+
per_page: zod_1.z.number().int(),
|
|
97
|
+
total_pages: zod_1.z.number().int(),
|
|
98
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@middlewr/contracts",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"types": "index.d.ts",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./index.d.ts",
|
|
10
|
+
"default": "./index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"@orpc/contract": "^1.13",
|
|
15
|
+
"zod": "^4.0.0"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/tags.schema.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const TagSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
workspace_id: z.ZodString;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
color: z.ZodNullable<z.ZodString>;
|
|
7
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
8
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export declare const CreateTagInputSchema: z.ZodObject<{
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
color: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export declare const UpdateTagInputSchema: z.ZodObject<{
|
|
15
|
+
name: z.ZodOptional<z.ZodString>;
|
|
16
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
//# sourceMappingURL=tags.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.schema.d.ts","sourceRoot":"","sources":["../src/contracts/tags.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,SAAS;;;;;;;iBAOpB,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;iBAM/B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;iBAO/B,CAAC"}
|
package/tags.schema.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateTagInputSchema = exports.CreateTagInputSchema = exports.TagSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.TagSchema = zod_1.z.object({
|
|
6
|
+
id: zod_1.z.string().uuid(),
|
|
7
|
+
workspace_id: zod_1.z.string().uuid(),
|
|
8
|
+
name: zod_1.z.string(),
|
|
9
|
+
color: zod_1.z.string().nullable(),
|
|
10
|
+
created_at: zod_1.z.coerce.date(),
|
|
11
|
+
updated_at: zod_1.z.coerce.date().nullable(),
|
|
12
|
+
});
|
|
13
|
+
exports.CreateTagInputSchema = zod_1.z.object({
|
|
14
|
+
name: zod_1.z.string().min(1).max(50),
|
|
15
|
+
color: zod_1.z
|
|
16
|
+
.string()
|
|
17
|
+
.regex(/^#[0-9A-Fa-f]{6}$/)
|
|
18
|
+
.optional(),
|
|
19
|
+
});
|
|
20
|
+
exports.UpdateTagInputSchema = zod_1.z.object({
|
|
21
|
+
name: zod_1.z.string().min(1).max(50).optional(),
|
|
22
|
+
color: zod_1.z
|
|
23
|
+
.string()
|
|
24
|
+
.regex(/^#[0-9A-Fa-f]{6}$/)
|
|
25
|
+
.nullable()
|
|
26
|
+
.optional(),
|
|
27
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const UserSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
external_id: z.ZodString;
|
|
5
|
+
email: z.ZodString;
|
|
6
|
+
email_verified_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
7
|
+
first_name: z.ZodNullable<z.ZodString>;
|
|
8
|
+
last_name: z.ZodNullable<z.ZodString>;
|
|
9
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
10
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export declare const SignInInputSchema: z.ZodObject<{
|
|
13
|
+
first_name: z.ZodOptional<z.ZodString>;
|
|
14
|
+
last_name: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export declare const UpdateUserInputSchema: z.ZodObject<{
|
|
17
|
+
first_name: z.ZodOptional<z.ZodString>;
|
|
18
|
+
last_name: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
//# sourceMappingURL=users.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.schema.d.ts","sourceRoot":"","sources":["../src/contracts/users.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,UAAU;;;;;;;;;iBASrB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;iBAG5B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;iBAGhC,CAAC"}
|
package/users.schema.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateUserInputSchema = exports.SignInInputSchema = exports.UserSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.UserSchema = zod_1.z.object({
|
|
6
|
+
id: zod_1.z.string().uuid(),
|
|
7
|
+
external_id: zod_1.z.string(),
|
|
8
|
+
email: zod_1.z.string().email(),
|
|
9
|
+
email_verified_at: zod_1.z.coerce.date().nullable(),
|
|
10
|
+
first_name: zod_1.z.string().nullable(),
|
|
11
|
+
last_name: zod_1.z.string().nullable(),
|
|
12
|
+
created_at: zod_1.z.coerce.date(),
|
|
13
|
+
updated_at: zod_1.z.coerce.date().nullable(),
|
|
14
|
+
});
|
|
15
|
+
exports.SignInInputSchema = zod_1.z.object({
|
|
16
|
+
first_name: zod_1.z.string().min(1).max(100).optional(),
|
|
17
|
+
last_name: zod_1.z.string().min(1).max(100).optional(),
|
|
18
|
+
});
|
|
19
|
+
exports.UpdateUserInputSchema = zod_1.z.object({
|
|
20
|
+
first_name: zod_1.z.string().min(1).max(100).optional(),
|
|
21
|
+
last_name: zod_1.z.string().min(1).max(100).optional(),
|
|
22
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const WorkspaceSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
6
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export declare const WorkspaceWithCountSchema: z.ZodObject<{
|
|
9
|
+
id: z.ZodString;
|
|
10
|
+
name: z.ZodString;
|
|
11
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
12
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
13
|
+
member_count: z.ZodNumber;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export declare const CreateWorkspaceInputSchema: z.ZodObject<{
|
|
16
|
+
name: z.ZodString;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export declare const UpdateWorkspaceInputSchema: z.ZodObject<{
|
|
19
|
+
name: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export declare const TransferOwnershipInputSchema: z.ZodObject<{
|
|
22
|
+
to_user_id: z.ZodString;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const WorkspaceMemberSchema: z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
workspace_id: z.ZodString;
|
|
27
|
+
user_id: z.ZodString;
|
|
28
|
+
permissions: z.ZodNumber;
|
|
29
|
+
joined_at: z.ZodCoercedDate<unknown>;
|
|
30
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
31
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export declare const UpdateMemberInputSchema: z.ZodObject<{
|
|
34
|
+
permissions: z.ZodNumber;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export declare const WorkspaceInvitationSchema: z.ZodObject<{
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
workspace_id: z.ZodString;
|
|
39
|
+
email: z.ZodString;
|
|
40
|
+
token: z.ZodString;
|
|
41
|
+
permissions: z.ZodNumber;
|
|
42
|
+
invited_by_id: z.ZodString;
|
|
43
|
+
expires_at: z.ZodCoercedDate<unknown>;
|
|
44
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
export declare const CreateInvitationInputSchema: z.ZodObject<{
|
|
47
|
+
email: z.ZodString;
|
|
48
|
+
permissions: z.ZodNumber;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
//# sourceMappingURL=workspaces.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaces.schema.d.ts","sourceRoot":"","sources":["../src/contracts/workspaces.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,eAAe;;;;;iBAK1B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;iBAEnC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;iBAErC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;iBAErC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;iBAEvC,CAAC;AAGH,eAAO,MAAM,qBAAqB;;;;;;;;iBAQhC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;iBAElC,CAAC;AAGH,eAAO,MAAM,yBAAyB;;;;;;;;;iBASpC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;iBAGtC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateInvitationInputSchema = exports.WorkspaceInvitationSchema = exports.UpdateMemberInputSchema = exports.WorkspaceMemberSchema = exports.TransferOwnershipInputSchema = exports.UpdateWorkspaceInputSchema = exports.CreateWorkspaceInputSchema = exports.WorkspaceWithCountSchema = exports.WorkspaceSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.WorkspaceSchema = zod_1.z.object({
|
|
6
|
+
id: zod_1.z.string().uuid(),
|
|
7
|
+
name: zod_1.z.string(),
|
|
8
|
+
created_at: zod_1.z.coerce.date(),
|
|
9
|
+
updated_at: zod_1.z.coerce.date().nullable(),
|
|
10
|
+
});
|
|
11
|
+
exports.WorkspaceWithCountSchema = exports.WorkspaceSchema.extend({
|
|
12
|
+
member_count: zod_1.z.number().int(),
|
|
13
|
+
});
|
|
14
|
+
exports.CreateWorkspaceInputSchema = zod_1.z.object({
|
|
15
|
+
name: zod_1.z.string().min(1).max(100),
|
|
16
|
+
});
|
|
17
|
+
exports.UpdateWorkspaceInputSchema = zod_1.z.object({
|
|
18
|
+
name: zod_1.z.string().min(1).max(100).optional(),
|
|
19
|
+
});
|
|
20
|
+
exports.TransferOwnershipInputSchema = zod_1.z.object({
|
|
21
|
+
to_user_id: zod_1.z.string().uuid(),
|
|
22
|
+
});
|
|
23
|
+
// Workspace member schemas
|
|
24
|
+
exports.WorkspaceMemberSchema = zod_1.z.object({
|
|
25
|
+
id: zod_1.z.string().uuid(),
|
|
26
|
+
workspace_id: zod_1.z.string().uuid(),
|
|
27
|
+
user_id: zod_1.z.string().uuid(),
|
|
28
|
+
permissions: zod_1.z.number().int(),
|
|
29
|
+
joined_at: zod_1.z.coerce.date(),
|
|
30
|
+
created_at: zod_1.z.coerce.date(),
|
|
31
|
+
updated_at: zod_1.z.coerce.date().nullable(),
|
|
32
|
+
});
|
|
33
|
+
exports.UpdateMemberInputSchema = zod_1.z.object({
|
|
34
|
+
permissions: zod_1.z.number().int().min(1),
|
|
35
|
+
});
|
|
36
|
+
// Invitation schemas
|
|
37
|
+
exports.WorkspaceInvitationSchema = zod_1.z.object({
|
|
38
|
+
id: zod_1.z.string().uuid(),
|
|
39
|
+
workspace_id: zod_1.z.string().uuid(),
|
|
40
|
+
email: zod_1.z.string().email(),
|
|
41
|
+
token: zod_1.z.string(),
|
|
42
|
+
permissions: zod_1.z.number().int(),
|
|
43
|
+
invited_by_id: zod_1.z.string().uuid(),
|
|
44
|
+
expires_at: zod_1.z.coerce.date(),
|
|
45
|
+
created_at: zod_1.z.coerce.date(),
|
|
46
|
+
});
|
|
47
|
+
exports.CreateInvitationInputSchema = zod_1.z.object({
|
|
48
|
+
email: zod_1.z.string().email(),
|
|
49
|
+
permissions: zod_1.z.number().int().min(1),
|
|
50
|
+
});
|