@middlewr/contracts 0.0.3 → 0.0.5
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/cjs/index.d.ts +40 -32
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +2 -2
- package/esm/index.d.ts +40 -32
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +272 -101
- package/package.json +1 -1
- package/esm/common.schema.js +0 -23
- package/esm/links.schema.js +0 -95
- package/esm/tags.schema.js +0 -24
- package/esm/users.schema.js +0 -19
- package/esm/workspaces.schema.js +0 -47
package/cjs/index.d.ts
CHANGED
|
@@ -7,14 +7,16 @@ export * from './users.schema';
|
|
|
7
7
|
export * from './workspaces.schema';
|
|
8
8
|
export declare const usersContract: {
|
|
9
9
|
me: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
user: z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
external_id: z.ZodString;
|
|
13
|
+
email: z.ZodString;
|
|
14
|
+
email_verified_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
15
|
+
first_name: z.ZodNullable<z.ZodString>;
|
|
16
|
+
last_name: z.ZodNullable<z.ZodString>;
|
|
17
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
18
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
19
|
+
}, z.core.$strip>;
|
|
18
20
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
19
21
|
signIn: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
20
22
|
first_name: z.ZodOptional<z.ZodString>;
|
|
@@ -39,14 +41,16 @@ export declare const usersContract: {
|
|
|
39
41
|
first_name: z.ZodOptional<z.ZodString>;
|
|
40
42
|
last_name: z.ZodOptional<z.ZodString>;
|
|
41
43
|
}, z.core.$strip>, z.ZodObject<{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
user: z.ZodObject<{
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
external_id: z.ZodString;
|
|
47
|
+
email: z.ZodString;
|
|
48
|
+
email_verified_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
49
|
+
first_name: z.ZodNullable<z.ZodString>;
|
|
50
|
+
last_name: z.ZodNullable<z.ZodString>;
|
|
51
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
52
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
53
|
+
}, z.core.$strip>;
|
|
50
54
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
51
55
|
};
|
|
52
56
|
export declare const workspacesContract: {
|
|
@@ -392,14 +396,16 @@ export declare const tagsContract: {
|
|
|
392
396
|
export declare const contract: {
|
|
393
397
|
users: {
|
|
394
398
|
me: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
399
|
+
user: z.ZodObject<{
|
|
400
|
+
id: z.ZodString;
|
|
401
|
+
external_id: z.ZodString;
|
|
402
|
+
email: z.ZodString;
|
|
403
|
+
email_verified_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
404
|
+
first_name: z.ZodNullable<z.ZodString>;
|
|
405
|
+
last_name: z.ZodNullable<z.ZodString>;
|
|
406
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
407
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
408
|
+
}, z.core.$strip>;
|
|
403
409
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
404
410
|
signIn: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
405
411
|
first_name: z.ZodOptional<z.ZodString>;
|
|
@@ -424,14 +430,16 @@ export declare const contract: {
|
|
|
424
430
|
first_name: z.ZodOptional<z.ZodString>;
|
|
425
431
|
last_name: z.ZodOptional<z.ZodString>;
|
|
426
432
|
}, z.core.$strip>, z.ZodObject<{
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
433
|
+
user: z.ZodObject<{
|
|
434
|
+
id: z.ZodString;
|
|
435
|
+
external_id: z.ZodString;
|
|
436
|
+
email: z.ZodString;
|
|
437
|
+
email_verified_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
438
|
+
first_name: z.ZodNullable<z.ZodString>;
|
|
439
|
+
last_name: z.ZodNullable<z.ZodString>;
|
|
440
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
441
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
442
|
+
}, z.core.$strip>;
|
|
435
443
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
436
444
|
};
|
|
437
445
|
workspaces: {
|
package/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,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
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,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;AACvC,MAAM,MAAM,MAAM,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC"}
|
package/cjs/index.js
CHANGED
|
@@ -252,9 +252,9 @@ var CreateInvitationInputSchema = import_zod5.z.object({
|
|
|
252
252
|
|
|
253
253
|
// src/contracts/index.ts
|
|
254
254
|
var usersContract = {
|
|
255
|
-
me: import_contract.oc.route({ method: "GET", path: "/api/users/me" }).output(UserSchema),
|
|
255
|
+
me: import_contract.oc.route({ method: "GET", path: "/api/users/me" }).output(import_zod6.z.object({ user: UserSchema })),
|
|
256
256
|
signIn: import_contract.oc.route({ method: "POST", path: "/api/users" }).input(SignInInputSchema).output(import_zod6.z.object({ user: UserSchema, status: import_zod6.z.enum(["created", "existing"]) })),
|
|
257
|
-
update: import_contract.oc.route({ method: "PATCH", path: "/api/users/me" }).input(UpdateUserInputSchema).output(UserSchema)
|
|
257
|
+
update: import_contract.oc.route({ method: "PATCH", path: "/api/users/me" }).input(UpdateUserInputSchema).output(import_zod6.z.object({ user: UserSchema }))
|
|
258
258
|
};
|
|
259
259
|
var workspacesContract = {
|
|
260
260
|
create: import_contract.oc.route({ method: "POST", path: "/api/workspaces" }).input(CreateWorkspaceInputSchema).output(WorkspaceSchema),
|
package/esm/index.d.ts
CHANGED
|
@@ -7,14 +7,16 @@ export * from './users.schema';
|
|
|
7
7
|
export * from './workspaces.schema';
|
|
8
8
|
export declare const usersContract: {
|
|
9
9
|
me: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
user: z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
external_id: z.ZodString;
|
|
13
|
+
email: z.ZodString;
|
|
14
|
+
email_verified_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
15
|
+
first_name: z.ZodNullable<z.ZodString>;
|
|
16
|
+
last_name: z.ZodNullable<z.ZodString>;
|
|
17
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
18
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
19
|
+
}, z.core.$strip>;
|
|
18
20
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
19
21
|
signIn: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
20
22
|
first_name: z.ZodOptional<z.ZodString>;
|
|
@@ -39,14 +41,16 @@ export declare const usersContract: {
|
|
|
39
41
|
first_name: z.ZodOptional<z.ZodString>;
|
|
40
42
|
last_name: z.ZodOptional<z.ZodString>;
|
|
41
43
|
}, z.core.$strip>, z.ZodObject<{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
user: z.ZodObject<{
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
external_id: z.ZodString;
|
|
47
|
+
email: z.ZodString;
|
|
48
|
+
email_verified_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
49
|
+
first_name: z.ZodNullable<z.ZodString>;
|
|
50
|
+
last_name: z.ZodNullable<z.ZodString>;
|
|
51
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
52
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
53
|
+
}, z.core.$strip>;
|
|
50
54
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
51
55
|
};
|
|
52
56
|
export declare const workspacesContract: {
|
|
@@ -392,14 +396,16 @@ export declare const tagsContract: {
|
|
|
392
396
|
export declare const contract: {
|
|
393
397
|
users: {
|
|
394
398
|
me: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
399
|
+
user: z.ZodObject<{
|
|
400
|
+
id: z.ZodString;
|
|
401
|
+
external_id: z.ZodString;
|
|
402
|
+
email: z.ZodString;
|
|
403
|
+
email_verified_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
404
|
+
first_name: z.ZodNullable<z.ZodString>;
|
|
405
|
+
last_name: z.ZodNullable<z.ZodString>;
|
|
406
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
407
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
408
|
+
}, z.core.$strip>;
|
|
403
409
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
404
410
|
signIn: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
405
411
|
first_name: z.ZodOptional<z.ZodString>;
|
|
@@ -424,14 +430,16 @@ export declare const contract: {
|
|
|
424
430
|
first_name: z.ZodOptional<z.ZodString>;
|
|
425
431
|
last_name: z.ZodOptional<z.ZodString>;
|
|
426
432
|
}, z.core.$strip>, z.ZodObject<{
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
433
|
+
user: z.ZodObject<{
|
|
434
|
+
id: z.ZodString;
|
|
435
|
+
external_id: z.ZodString;
|
|
436
|
+
email: z.ZodString;
|
|
437
|
+
email_verified_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
438
|
+
first_name: z.ZodNullable<z.ZodString>;
|
|
439
|
+
last_name: z.ZodNullable<z.ZodString>;
|
|
440
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
441
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
442
|
+
}, z.core.$strip>;
|
|
435
443
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
436
444
|
};
|
|
437
445
|
workspaces: {
|
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,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
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,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;AACvC,MAAM,MAAM,MAAM,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC"}
|
package/esm/index.js
CHANGED
|
@@ -1,107 +1,278 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
// src/contracts/index.ts
|
|
2
|
+
import { oc } from "@orpc/contract";
|
|
3
|
+
import { z as z6 } from "zod";
|
|
4
|
+
|
|
5
|
+
// src/contracts/common.schema.ts
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
var WorkspaceIdParamSchema = z.object({
|
|
8
|
+
workspace_id: z.string().uuid()
|
|
9
|
+
});
|
|
10
|
+
var LinkIdParamSchema = z.object({
|
|
11
|
+
workspace_id: z.string().uuid(),
|
|
12
|
+
link_id: z.string().uuid()
|
|
13
|
+
});
|
|
14
|
+
var TagIdParamSchema = z.object({
|
|
15
|
+
workspace_id: z.string().uuid(),
|
|
16
|
+
tag_id: z.string().uuid()
|
|
17
|
+
});
|
|
18
|
+
var MemberIdParamSchema = z.object({
|
|
19
|
+
workspace_id: z.string().uuid(),
|
|
20
|
+
user_id: z.string().uuid()
|
|
21
|
+
});
|
|
22
|
+
var InvitationIdParamSchema = z.object({
|
|
23
|
+
workspace_id: z.string().uuid(),
|
|
24
|
+
invitation_id: z.string().uuid()
|
|
25
|
+
});
|
|
26
|
+
var TokenParamSchema = z.object({
|
|
27
|
+
token: z.string()
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// src/contracts/links.schema.ts
|
|
31
|
+
import { z as z2 } from "zod";
|
|
32
|
+
var LinkSchema = z2.object({
|
|
33
|
+
id: z2.string().uuid(),
|
|
34
|
+
workspace_id: z2.string().uuid(),
|
|
35
|
+
created_by_id: z2.string().uuid(),
|
|
36
|
+
original_url: z2.string().url(),
|
|
37
|
+
short_code: z2.string(),
|
|
38
|
+
title: z2.string().nullable(),
|
|
39
|
+
description: z2.string().nullable(),
|
|
40
|
+
utm_source: z2.string().nullable(),
|
|
41
|
+
utm_medium: z2.string().nullable(),
|
|
42
|
+
utm_campaign: z2.string().nullable(),
|
|
43
|
+
utm_term: z2.string().nullable(),
|
|
44
|
+
utm_content: z2.string().nullable(),
|
|
45
|
+
password: z2.string().nullable(),
|
|
46
|
+
starts_at: z2.coerce.date().nullable(),
|
|
47
|
+
expires_at: z2.coerce.date().nullable(),
|
|
48
|
+
is_active: z2.boolean(),
|
|
49
|
+
redirect_type: z2.number().int(),
|
|
50
|
+
click_count: z2.number().int(),
|
|
51
|
+
click_count_updated_at: z2.coerce.date().nullable(),
|
|
52
|
+
created_at: z2.coerce.date(),
|
|
53
|
+
updated_at: z2.coerce.date().nullable()
|
|
54
|
+
});
|
|
55
|
+
var CreateLinkInputSchema = z2.object({
|
|
56
|
+
original_url: z2.string().url().max(2048),
|
|
57
|
+
short_code: z2.string().min(3).max(50).regex(/^[a-zA-Z0-9-]+$/).optional(),
|
|
58
|
+
title: z2.string().max(255).optional(),
|
|
59
|
+
description: z2.string().max(2e3).optional(),
|
|
60
|
+
utm_source: z2.string().max(255).optional(),
|
|
61
|
+
utm_medium: z2.string().max(255).optional(),
|
|
62
|
+
utm_campaign: z2.string().max(255).optional(),
|
|
63
|
+
utm_term: z2.string().max(255).optional(),
|
|
64
|
+
utm_content: z2.string().max(255).optional(),
|
|
65
|
+
password: z2.string().min(4).max(100).optional(),
|
|
66
|
+
starts_at: z2.coerce.date().optional(),
|
|
67
|
+
expires_at: z2.coerce.date().optional(),
|
|
68
|
+
redirect_type: z2.coerce.number().refine((v) => [301, 302, 307, 308].includes(v)).optional(),
|
|
69
|
+
tag_ids: z2.array(z2.string().uuid()).optional()
|
|
70
|
+
});
|
|
71
|
+
var UpdateLinkInputSchema = z2.object({
|
|
72
|
+
original_url: z2.string().url().max(2048).optional(),
|
|
73
|
+
short_code: z2.string().min(3).max(50).regex(/^[a-zA-Z0-9-]+$/).optional(),
|
|
74
|
+
title: z2.string().max(255).nullable().optional(),
|
|
75
|
+
description: z2.string().max(2e3).nullable().optional(),
|
|
76
|
+
utm_source: z2.string().max(255).nullable().optional(),
|
|
77
|
+
utm_medium: z2.string().max(255).nullable().optional(),
|
|
78
|
+
utm_campaign: z2.string().max(255).nullable().optional(),
|
|
79
|
+
utm_term: z2.string().max(255).nullable().optional(),
|
|
80
|
+
utm_content: z2.string().max(255).nullable().optional(),
|
|
81
|
+
password: z2.string().min(4).max(100).nullable().optional(),
|
|
82
|
+
starts_at: z2.coerce.date().nullable().optional(),
|
|
83
|
+
expires_at: z2.coerce.date().nullable().optional(),
|
|
84
|
+
is_active: z2.boolean().optional(),
|
|
85
|
+
redirect_type: z2.coerce.number().refine((v) => [301, 302, 307, 308].includes(v)).optional(),
|
|
86
|
+
tag_ids: z2.array(z2.string().uuid()).optional()
|
|
87
|
+
});
|
|
88
|
+
var LinkFiltersSchema = z2.object({
|
|
89
|
+
search: z2.string().optional(),
|
|
90
|
+
is_active: z2.coerce.boolean().optional(),
|
|
91
|
+
has_expiration: z2.coerce.boolean().optional(),
|
|
92
|
+
expired: z2.coerce.boolean().optional(),
|
|
93
|
+
created_from: z2.coerce.date().optional(),
|
|
94
|
+
created_to: z2.coerce.date().optional(),
|
|
95
|
+
expires_from: z2.coerce.date().optional(),
|
|
96
|
+
expires_to: z2.coerce.date().optional(),
|
|
97
|
+
tag_ids: z2.array(z2.string().uuid()).optional(),
|
|
98
|
+
sort_by: z2.enum(["created_at", "title", "click_count"]).default("created_at"),
|
|
99
|
+
sort_order: z2.enum(["asc", "desc"]).default("desc"),
|
|
100
|
+
page: z2.coerce.number().int().min(1).default(1),
|
|
101
|
+
per_page: z2.coerce.number().int().min(1).max(100).default(20)
|
|
102
|
+
});
|
|
103
|
+
var PaginatedLinksSchema = z2.object({
|
|
104
|
+
links: z2.array(LinkSchema),
|
|
105
|
+
total: z2.number().int(),
|
|
106
|
+
page: z2.number().int(),
|
|
107
|
+
per_page: z2.number().int(),
|
|
108
|
+
total_pages: z2.number().int()
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// src/contracts/tags.schema.ts
|
|
112
|
+
import { z as z3 } from "zod";
|
|
113
|
+
var TagSchema = z3.object({
|
|
114
|
+
id: z3.string().uuid(),
|
|
115
|
+
workspace_id: z3.string().uuid(),
|
|
116
|
+
name: z3.string(),
|
|
117
|
+
color: z3.string().nullable(),
|
|
118
|
+
created_at: z3.coerce.date(),
|
|
119
|
+
updated_at: z3.coerce.date().nullable()
|
|
120
|
+
});
|
|
121
|
+
var CreateTagInputSchema = z3.object({
|
|
122
|
+
name: z3.string().min(1).max(50),
|
|
123
|
+
color: z3.string().regex(/^#[0-9A-Fa-f]{6}$/).optional()
|
|
124
|
+
});
|
|
125
|
+
var UpdateTagInputSchema = z3.object({
|
|
126
|
+
name: z3.string().min(1).max(50).optional(),
|
|
127
|
+
color: z3.string().regex(/^#[0-9A-Fa-f]{6}$/).nullable().optional()
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// src/contracts/users.schema.ts
|
|
131
|
+
import { z as z4 } from "zod";
|
|
132
|
+
var UserSchema = z4.object({
|
|
133
|
+
id: z4.string().uuid(),
|
|
134
|
+
external_id: z4.string(),
|
|
135
|
+
email: z4.string().email(),
|
|
136
|
+
email_verified_at: z4.coerce.date().nullable(),
|
|
137
|
+
first_name: z4.string().nullable(),
|
|
138
|
+
last_name: z4.string().nullable(),
|
|
139
|
+
created_at: z4.coerce.date(),
|
|
140
|
+
updated_at: z4.coerce.date().nullable()
|
|
141
|
+
});
|
|
142
|
+
var SignInInputSchema = z4.object({
|
|
143
|
+
first_name: z4.string().min(1).max(100).optional(),
|
|
144
|
+
last_name: z4.string().min(1).max(100).optional()
|
|
145
|
+
});
|
|
146
|
+
var UpdateUserInputSchema = z4.object({
|
|
147
|
+
first_name: z4.string().min(1).max(100).optional(),
|
|
148
|
+
last_name: z4.string().min(1).max(100).optional()
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// src/contracts/workspaces.schema.ts
|
|
152
|
+
import { z as z5 } from "zod";
|
|
153
|
+
var WorkspaceSchema = z5.object({
|
|
154
|
+
id: z5.string().uuid(),
|
|
155
|
+
name: z5.string(),
|
|
156
|
+
created_at: z5.coerce.date(),
|
|
157
|
+
updated_at: z5.coerce.date().nullable()
|
|
158
|
+
});
|
|
159
|
+
var WorkspaceWithCountSchema = WorkspaceSchema.extend({
|
|
160
|
+
member_count: z5.number().int()
|
|
161
|
+
});
|
|
162
|
+
var CreateWorkspaceInputSchema = z5.object({
|
|
163
|
+
name: z5.string().min(1).max(100)
|
|
164
|
+
});
|
|
165
|
+
var UpdateWorkspaceInputSchema = z5.object({
|
|
166
|
+
name: z5.string().min(1).max(100).optional()
|
|
167
|
+
});
|
|
168
|
+
var TransferOwnershipInputSchema = z5.object({
|
|
169
|
+
to_user_id: z5.string().uuid()
|
|
170
|
+
});
|
|
171
|
+
var WorkspaceMemberSchema = z5.object({
|
|
172
|
+
id: z5.string().uuid(),
|
|
173
|
+
workspace_id: z5.string().uuid(),
|
|
174
|
+
user_id: z5.string().uuid(),
|
|
175
|
+
permissions: z5.number().int(),
|
|
176
|
+
joined_at: z5.coerce.date(),
|
|
177
|
+
created_at: z5.coerce.date(),
|
|
178
|
+
updated_at: z5.coerce.date().nullable()
|
|
179
|
+
});
|
|
180
|
+
var UpdateMemberInputSchema = z5.object({
|
|
181
|
+
permissions: z5.number().int().min(1)
|
|
182
|
+
});
|
|
183
|
+
var WorkspaceInvitationSchema = z5.object({
|
|
184
|
+
id: z5.string().uuid(),
|
|
185
|
+
workspace_id: z5.string().uuid(),
|
|
186
|
+
email: z5.string().email(),
|
|
187
|
+
token: z5.string(),
|
|
188
|
+
permissions: z5.number().int(),
|
|
189
|
+
invited_by_id: z5.string().uuid(),
|
|
190
|
+
expires_at: z5.coerce.date(),
|
|
191
|
+
created_at: z5.coerce.date()
|
|
192
|
+
});
|
|
193
|
+
var CreateInvitationInputSchema = z5.object({
|
|
194
|
+
email: z5.string().email(),
|
|
195
|
+
permissions: z5.number().int().min(1)
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// src/contracts/index.ts
|
|
199
|
+
var usersContract = {
|
|
200
|
+
me: oc.route({ method: "GET", path: "/api/users/me" }).output(z6.object({ user: UserSchema })),
|
|
201
|
+
signIn: oc.route({ method: "POST", path: "/api/users" }).input(SignInInputSchema).output(z6.object({ user: UserSchema, status: z6.enum(["created", "existing"]) })),
|
|
202
|
+
update: oc.route({ method: "PATCH", path: "/api/users/me" }).input(UpdateUserInputSchema).output(z6.object({ user: UserSchema }))
|
|
22
203
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
listMembers: oc
|
|
39
|
-
.route({ method: 'GET', path: '/api/workspaces/{workspaceId}/members' })
|
|
40
|
-
.input(WorkspaceIdParamSchema)
|
|
41
|
-
.output(z.array(WorkspaceMemberSchema)),
|
|
42
|
-
updateMember: oc
|
|
43
|
-
.route({ method: 'PATCH', path: '/api/workspaces/{workspaceId}/members/{userId}' })
|
|
44
|
-
.input(MemberIdParamSchema.merge(UpdateMemberInputSchema))
|
|
45
|
-
.output(WorkspaceMemberSchema),
|
|
46
|
-
removeMember: oc
|
|
47
|
-
.route({ method: 'DELETE', path: '/api/workspaces/{workspaceId}/members/{userId}' })
|
|
48
|
-
.input(MemberIdParamSchema)
|
|
49
|
-
.output(z.void()),
|
|
50
|
-
// Invitations
|
|
51
|
-
listInvitations: oc
|
|
52
|
-
.route({ method: 'GET', path: '/api/workspaces/{workspaceId}/invitations' })
|
|
53
|
-
.input(WorkspaceIdParamSchema)
|
|
54
|
-
.output(z.array(WorkspaceInvitationSchema)),
|
|
55
|
-
createInvitation: oc
|
|
56
|
-
.route({ method: 'POST', path: '/api/workspaces/{workspaceId}/invitations' })
|
|
57
|
-
.input(WorkspaceIdParamSchema.merge(CreateInvitationInputSchema))
|
|
58
|
-
.output(WorkspaceInvitationSchema),
|
|
59
|
-
revokeInvitation: oc
|
|
60
|
-
.route({ method: 'DELETE', path: '/api/workspaces/{workspaceId}/invitations/{invitationId}' })
|
|
61
|
-
.input(InvitationIdParamSchema)
|
|
62
|
-
.output(z.void()),
|
|
204
|
+
var workspacesContract = {
|
|
205
|
+
create: oc.route({ method: "POST", path: "/api/workspaces" }).input(CreateWorkspaceInputSchema).output(WorkspaceSchema),
|
|
206
|
+
list: oc.route({ method: "GET", path: "/api/workspaces" }).output(z6.array(WorkspaceWithCountSchema)),
|
|
207
|
+
get: oc.route({ method: "GET", path: "/api/workspaces/{workspaceId}" }).input(WorkspaceIdParamSchema).output(WorkspaceWithCountSchema),
|
|
208
|
+
update: oc.route({ method: "PATCH", path: "/api/workspaces/{workspaceId}" }).input(WorkspaceIdParamSchema.merge(UpdateWorkspaceInputSchema)).output(WorkspaceSchema),
|
|
209
|
+
delete: oc.route({ method: "DELETE", path: "/api/workspaces/{workspaceId}" }).input(WorkspaceIdParamSchema).output(z6.void()),
|
|
210
|
+
transfer: oc.route({ method: "POST", path: "/api/workspaces/{workspaceId}/transfer" }).input(WorkspaceIdParamSchema.merge(TransferOwnershipInputSchema)).output(z6.void()),
|
|
211
|
+
// Members
|
|
212
|
+
listMembers: oc.route({ method: "GET", path: "/api/workspaces/{workspaceId}/members" }).input(WorkspaceIdParamSchema).output(z6.array(WorkspaceMemberSchema)),
|
|
213
|
+
updateMember: oc.route({ method: "PATCH", path: "/api/workspaces/{workspaceId}/members/{userId}" }).input(MemberIdParamSchema.merge(UpdateMemberInputSchema)).output(WorkspaceMemberSchema),
|
|
214
|
+
removeMember: oc.route({ method: "DELETE", path: "/api/workspaces/{workspaceId}/members/{userId}" }).input(MemberIdParamSchema).output(z6.void()),
|
|
215
|
+
// Invitations
|
|
216
|
+
listInvitations: oc.route({ method: "GET", path: "/api/workspaces/{workspaceId}/invitations" }).input(WorkspaceIdParamSchema).output(z6.array(WorkspaceInvitationSchema)),
|
|
217
|
+
createInvitation: oc.route({ method: "POST", path: "/api/workspaces/{workspaceId}/invitations" }).input(WorkspaceIdParamSchema.merge(CreateInvitationInputSchema)).output(WorkspaceInvitationSchema),
|
|
218
|
+
revokeInvitation: oc.route({ method: "DELETE", path: "/api/workspaces/{workspaceId}/invitations/{invitationId}" }).input(InvitationIdParamSchema).output(z6.void())
|
|
63
219
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
accept: oc.route({ method: 'POST', path: '/api/invitations/{token}/accept' }).input(TokenParamSchema).output(WorkspaceMemberSchema),
|
|
220
|
+
var invitationsContract = {
|
|
221
|
+
get: oc.route({ method: "GET", path: "/api/invitations/{token}" }).input(TokenParamSchema).output(WorkspaceInvitationSchema),
|
|
222
|
+
accept: oc.route({ method: "POST", path: "/api/invitations/{token}/accept" }).input(TokenParamSchema).output(WorkspaceMemberSchema)
|
|
68
223
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
list: oc
|
|
76
|
-
.route({ method: 'GET', path: '/api/workspaces/{workspaceId}/links' })
|
|
77
|
-
.input(WorkspaceIdParamSchema.merge(LinkFiltersSchema))
|
|
78
|
-
.output(PaginatedLinksSchema),
|
|
79
|
-
get: oc.route({ method: 'GET', path: '/api/workspaces/{workspaceId}/links/{linkId}' }).input(LinkIdParamSchema).output(LinkSchema),
|
|
80
|
-
update: oc
|
|
81
|
-
.route({ method: 'PATCH', path: '/api/workspaces/{workspaceId}/links/{linkId}' })
|
|
82
|
-
.input(LinkIdParamSchema.merge(UpdateLinkInputSchema))
|
|
83
|
-
.output(LinkSchema),
|
|
84
|
-
delete: oc.route({ method: 'DELETE', path: '/api/workspaces/{workspaceId}/links/{linkId}' }).input(LinkIdParamSchema).output(z.void()),
|
|
224
|
+
var linksContract = {
|
|
225
|
+
create: oc.route({ method: "POST", path: "/api/workspaces/{workspaceId}/links" }).input(WorkspaceIdParamSchema.merge(CreateLinkInputSchema)).output(LinkSchema),
|
|
226
|
+
list: oc.route({ method: "GET", path: "/api/workspaces/{workspaceId}/links" }).input(WorkspaceIdParamSchema.merge(LinkFiltersSchema)).output(PaginatedLinksSchema),
|
|
227
|
+
get: oc.route({ method: "GET", path: "/api/workspaces/{workspaceId}/links/{linkId}" }).input(LinkIdParamSchema).output(LinkSchema),
|
|
228
|
+
update: oc.route({ method: "PATCH", path: "/api/workspaces/{workspaceId}/links/{linkId}" }).input(LinkIdParamSchema.merge(UpdateLinkInputSchema)).output(LinkSchema),
|
|
229
|
+
delete: oc.route({ method: "DELETE", path: "/api/workspaces/{workspaceId}/links/{linkId}" }).input(LinkIdParamSchema).output(z6.void())
|
|
85
230
|
};
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
list: oc.route({ method: 'GET', path: '/api/workspaces/{workspaceId}/tags' }).input(WorkspaceIdParamSchema).output(z.array(TagSchema)),
|
|
93
|
-
get: oc.route({ method: 'GET', path: '/api/workspaces/{workspaceId}/tags/{tagId}' }).input(TagIdParamSchema).output(TagSchema),
|
|
94
|
-
update: oc
|
|
95
|
-
.route({ method: 'PATCH', path: '/api/workspaces/{workspaceId}/tags/{tagId}' })
|
|
96
|
-
.input(TagIdParamSchema.merge(UpdateTagInputSchema))
|
|
97
|
-
.output(TagSchema),
|
|
98
|
-
delete: oc.route({ method: 'DELETE', path: '/api/workspaces/{workspaceId}/tags/{tagId}' }).input(TagIdParamSchema).output(z.void()),
|
|
231
|
+
var tagsContract = {
|
|
232
|
+
create: oc.route({ method: "POST", path: "/api/workspaces/{workspaceId}/tags" }).input(WorkspaceIdParamSchema.merge(CreateTagInputSchema)).output(TagSchema),
|
|
233
|
+
list: oc.route({ method: "GET", path: "/api/workspaces/{workspaceId}/tags" }).input(WorkspaceIdParamSchema).output(z6.array(TagSchema)),
|
|
234
|
+
get: oc.route({ method: "GET", path: "/api/workspaces/{workspaceId}/tags/{tagId}" }).input(TagIdParamSchema).output(TagSchema),
|
|
235
|
+
update: oc.route({ method: "PATCH", path: "/api/workspaces/{workspaceId}/tags/{tagId}" }).input(TagIdParamSchema.merge(UpdateTagInputSchema)).output(TagSchema),
|
|
236
|
+
delete: oc.route({ method: "DELETE", path: "/api/workspaces/{workspaceId}/tags/{tagId}" }).input(TagIdParamSchema).output(z6.void())
|
|
99
237
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
238
|
+
var contract = {
|
|
239
|
+
users: usersContract,
|
|
240
|
+
workspaces: workspacesContract,
|
|
241
|
+
invitations: invitationsContract,
|
|
242
|
+
links: linksContract,
|
|
243
|
+
tags: tagsContract
|
|
244
|
+
};
|
|
245
|
+
export {
|
|
246
|
+
CreateInvitationInputSchema,
|
|
247
|
+
CreateLinkInputSchema,
|
|
248
|
+
CreateTagInputSchema,
|
|
249
|
+
CreateWorkspaceInputSchema,
|
|
250
|
+
InvitationIdParamSchema,
|
|
251
|
+
LinkFiltersSchema,
|
|
252
|
+
LinkIdParamSchema,
|
|
253
|
+
LinkSchema,
|
|
254
|
+
MemberIdParamSchema,
|
|
255
|
+
PaginatedLinksSchema,
|
|
256
|
+
SignInInputSchema,
|
|
257
|
+
TagIdParamSchema,
|
|
258
|
+
TagSchema,
|
|
259
|
+
TokenParamSchema,
|
|
260
|
+
TransferOwnershipInputSchema,
|
|
261
|
+
UpdateLinkInputSchema,
|
|
262
|
+
UpdateMemberInputSchema,
|
|
263
|
+
UpdateTagInputSchema,
|
|
264
|
+
UpdateUserInputSchema,
|
|
265
|
+
UpdateWorkspaceInputSchema,
|
|
266
|
+
UserSchema,
|
|
267
|
+
WorkspaceIdParamSchema,
|
|
268
|
+
WorkspaceInvitationSchema,
|
|
269
|
+
WorkspaceMemberSchema,
|
|
270
|
+
WorkspaceSchema,
|
|
271
|
+
WorkspaceWithCountSchema,
|
|
272
|
+
contract,
|
|
273
|
+
invitationsContract,
|
|
274
|
+
linksContract,
|
|
275
|
+
tagsContract,
|
|
276
|
+
usersContract,
|
|
277
|
+
workspacesContract
|
|
107
278
|
};
|
package/package.json
CHANGED
package/esm/common.schema.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export const WorkspaceIdParamSchema = z.object({
|
|
3
|
-
workspace_id: z.string().uuid(),
|
|
4
|
-
});
|
|
5
|
-
export const LinkIdParamSchema = z.object({
|
|
6
|
-
workspace_id: z.string().uuid(),
|
|
7
|
-
link_id: z.string().uuid(),
|
|
8
|
-
});
|
|
9
|
-
export const TagIdParamSchema = z.object({
|
|
10
|
-
workspace_id: z.string().uuid(),
|
|
11
|
-
tag_id: z.string().uuid(),
|
|
12
|
-
});
|
|
13
|
-
export const MemberIdParamSchema = z.object({
|
|
14
|
-
workspace_id: z.string().uuid(),
|
|
15
|
-
user_id: z.string().uuid(),
|
|
16
|
-
});
|
|
17
|
-
export const InvitationIdParamSchema = z.object({
|
|
18
|
-
workspace_id: z.string().uuid(),
|
|
19
|
-
invitation_id: z.string().uuid(),
|
|
20
|
-
});
|
|
21
|
-
export const TokenParamSchema = z.object({
|
|
22
|
-
token: z.string(),
|
|
23
|
-
});
|
package/esm/links.schema.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export const LinkSchema = z.object({
|
|
3
|
-
id: z.string().uuid(),
|
|
4
|
-
workspace_id: z.string().uuid(),
|
|
5
|
-
created_by_id: z.string().uuid(),
|
|
6
|
-
original_url: z.string().url(),
|
|
7
|
-
short_code: z.string(),
|
|
8
|
-
title: z.string().nullable(),
|
|
9
|
-
description: z.string().nullable(),
|
|
10
|
-
utm_source: z.string().nullable(),
|
|
11
|
-
utm_medium: z.string().nullable(),
|
|
12
|
-
utm_campaign: z.string().nullable(),
|
|
13
|
-
utm_term: z.string().nullable(),
|
|
14
|
-
utm_content: z.string().nullable(),
|
|
15
|
-
password: z.string().nullable(),
|
|
16
|
-
starts_at: z.coerce.date().nullable(),
|
|
17
|
-
expires_at: z.coerce.date().nullable(),
|
|
18
|
-
is_active: z.boolean(),
|
|
19
|
-
redirect_type: z.number().int(),
|
|
20
|
-
click_count: z.number().int(),
|
|
21
|
-
click_count_updated_at: z.coerce.date().nullable(),
|
|
22
|
-
created_at: z.coerce.date(),
|
|
23
|
-
updated_at: z.coerce.date().nullable(),
|
|
24
|
-
});
|
|
25
|
-
export const CreateLinkInputSchema = z.object({
|
|
26
|
-
original_url: z.string().url().max(2048),
|
|
27
|
-
short_code: z
|
|
28
|
-
.string()
|
|
29
|
-
.min(3)
|
|
30
|
-
.max(50)
|
|
31
|
-
.regex(/^[a-zA-Z0-9-]+$/)
|
|
32
|
-
.optional(),
|
|
33
|
-
title: z.string().max(255).optional(),
|
|
34
|
-
description: z.string().max(2000).optional(),
|
|
35
|
-
utm_source: z.string().max(255).optional(),
|
|
36
|
-
utm_medium: z.string().max(255).optional(),
|
|
37
|
-
utm_campaign: z.string().max(255).optional(),
|
|
38
|
-
utm_term: z.string().max(255).optional(),
|
|
39
|
-
utm_content: z.string().max(255).optional(),
|
|
40
|
-
password: z.string().min(4).max(100).optional(),
|
|
41
|
-
starts_at: z.coerce.date().optional(),
|
|
42
|
-
expires_at: z.coerce.date().optional(),
|
|
43
|
-
redirect_type: z.coerce
|
|
44
|
-
.number()
|
|
45
|
-
.refine((v) => [301, 302, 307, 308].includes(v))
|
|
46
|
-
.optional(),
|
|
47
|
-
tag_ids: z.array(z.string().uuid()).optional(),
|
|
48
|
-
});
|
|
49
|
-
export const UpdateLinkInputSchema = z.object({
|
|
50
|
-
original_url: z.string().url().max(2048).optional(),
|
|
51
|
-
short_code: z
|
|
52
|
-
.string()
|
|
53
|
-
.min(3)
|
|
54
|
-
.max(50)
|
|
55
|
-
.regex(/^[a-zA-Z0-9-]+$/)
|
|
56
|
-
.optional(),
|
|
57
|
-
title: z.string().max(255).nullable().optional(),
|
|
58
|
-
description: z.string().max(2000).nullable().optional(),
|
|
59
|
-
utm_source: z.string().max(255).nullable().optional(),
|
|
60
|
-
utm_medium: z.string().max(255).nullable().optional(),
|
|
61
|
-
utm_campaign: z.string().max(255).nullable().optional(),
|
|
62
|
-
utm_term: z.string().max(255).nullable().optional(),
|
|
63
|
-
utm_content: z.string().max(255).nullable().optional(),
|
|
64
|
-
password: z.string().min(4).max(100).nullable().optional(),
|
|
65
|
-
starts_at: z.coerce.date().nullable().optional(),
|
|
66
|
-
expires_at: z.coerce.date().nullable().optional(),
|
|
67
|
-
is_active: z.boolean().optional(),
|
|
68
|
-
redirect_type: z.coerce
|
|
69
|
-
.number()
|
|
70
|
-
.refine((v) => [301, 302, 307, 308].includes(v))
|
|
71
|
-
.optional(),
|
|
72
|
-
tag_ids: z.array(z.string().uuid()).optional(),
|
|
73
|
-
});
|
|
74
|
-
export const LinkFiltersSchema = z.object({
|
|
75
|
-
search: z.string().optional(),
|
|
76
|
-
is_active: z.coerce.boolean().optional(),
|
|
77
|
-
has_expiration: z.coerce.boolean().optional(),
|
|
78
|
-
expired: z.coerce.boolean().optional(),
|
|
79
|
-
created_from: z.coerce.date().optional(),
|
|
80
|
-
created_to: z.coerce.date().optional(),
|
|
81
|
-
expires_from: z.coerce.date().optional(),
|
|
82
|
-
expires_to: z.coerce.date().optional(),
|
|
83
|
-
tag_ids: z.array(z.string().uuid()).optional(),
|
|
84
|
-
sort_by: z.enum(['created_at', 'title', 'click_count']).default('created_at'),
|
|
85
|
-
sort_order: z.enum(['asc', 'desc']).default('desc'),
|
|
86
|
-
page: z.coerce.number().int().min(1).default(1),
|
|
87
|
-
per_page: z.coerce.number().int().min(1).max(100).default(20),
|
|
88
|
-
});
|
|
89
|
-
export const PaginatedLinksSchema = z.object({
|
|
90
|
-
links: z.array(LinkSchema),
|
|
91
|
-
total: z.number().int(),
|
|
92
|
-
page: z.number().int(),
|
|
93
|
-
per_page: z.number().int(),
|
|
94
|
-
total_pages: z.number().int(),
|
|
95
|
-
});
|
package/esm/tags.schema.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export const TagSchema = z.object({
|
|
3
|
-
id: z.string().uuid(),
|
|
4
|
-
workspace_id: z.string().uuid(),
|
|
5
|
-
name: z.string(),
|
|
6
|
-
color: z.string().nullable(),
|
|
7
|
-
created_at: z.coerce.date(),
|
|
8
|
-
updated_at: z.coerce.date().nullable(),
|
|
9
|
-
});
|
|
10
|
-
export const CreateTagInputSchema = z.object({
|
|
11
|
-
name: z.string().min(1).max(50),
|
|
12
|
-
color: z
|
|
13
|
-
.string()
|
|
14
|
-
.regex(/^#[0-9A-Fa-f]{6}$/)
|
|
15
|
-
.optional(),
|
|
16
|
-
});
|
|
17
|
-
export const UpdateTagInputSchema = z.object({
|
|
18
|
-
name: z.string().min(1).max(50).optional(),
|
|
19
|
-
color: z
|
|
20
|
-
.string()
|
|
21
|
-
.regex(/^#[0-9A-Fa-f]{6}$/)
|
|
22
|
-
.nullable()
|
|
23
|
-
.optional(),
|
|
24
|
-
});
|
package/esm/users.schema.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export const UserSchema = z.object({
|
|
3
|
-
id: z.string().uuid(),
|
|
4
|
-
external_id: z.string(),
|
|
5
|
-
email: z.string().email(),
|
|
6
|
-
email_verified_at: z.coerce.date().nullable(),
|
|
7
|
-
first_name: z.string().nullable(),
|
|
8
|
-
last_name: z.string().nullable(),
|
|
9
|
-
created_at: z.coerce.date(),
|
|
10
|
-
updated_at: z.coerce.date().nullable(),
|
|
11
|
-
});
|
|
12
|
-
export const SignInInputSchema = z.object({
|
|
13
|
-
first_name: z.string().min(1).max(100).optional(),
|
|
14
|
-
last_name: z.string().min(1).max(100).optional(),
|
|
15
|
-
});
|
|
16
|
-
export const UpdateUserInputSchema = z.object({
|
|
17
|
-
first_name: z.string().min(1).max(100).optional(),
|
|
18
|
-
last_name: z.string().min(1).max(100).optional(),
|
|
19
|
-
});
|
package/esm/workspaces.schema.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export const WorkspaceSchema = z.object({
|
|
3
|
-
id: z.string().uuid(),
|
|
4
|
-
name: z.string(),
|
|
5
|
-
created_at: z.coerce.date(),
|
|
6
|
-
updated_at: z.coerce.date().nullable(),
|
|
7
|
-
});
|
|
8
|
-
export const WorkspaceWithCountSchema = WorkspaceSchema.extend({
|
|
9
|
-
member_count: z.number().int(),
|
|
10
|
-
});
|
|
11
|
-
export const CreateWorkspaceInputSchema = z.object({
|
|
12
|
-
name: z.string().min(1).max(100),
|
|
13
|
-
});
|
|
14
|
-
export const UpdateWorkspaceInputSchema = z.object({
|
|
15
|
-
name: z.string().min(1).max(100).optional(),
|
|
16
|
-
});
|
|
17
|
-
export const TransferOwnershipInputSchema = z.object({
|
|
18
|
-
to_user_id: z.string().uuid(),
|
|
19
|
-
});
|
|
20
|
-
// Workspace member schemas
|
|
21
|
-
export const WorkspaceMemberSchema = z.object({
|
|
22
|
-
id: z.string().uuid(),
|
|
23
|
-
workspace_id: z.string().uuid(),
|
|
24
|
-
user_id: z.string().uuid(),
|
|
25
|
-
permissions: z.number().int(),
|
|
26
|
-
joined_at: z.coerce.date(),
|
|
27
|
-
created_at: z.coerce.date(),
|
|
28
|
-
updated_at: z.coerce.date().nullable(),
|
|
29
|
-
});
|
|
30
|
-
export const UpdateMemberInputSchema = z.object({
|
|
31
|
-
permissions: z.number().int().min(1),
|
|
32
|
-
});
|
|
33
|
-
// Invitation schemas
|
|
34
|
-
export const WorkspaceInvitationSchema = z.object({
|
|
35
|
-
id: z.string().uuid(),
|
|
36
|
-
workspace_id: z.string().uuid(),
|
|
37
|
-
email: z.string().email(),
|
|
38
|
-
token: z.string(),
|
|
39
|
-
permissions: z.number().int(),
|
|
40
|
-
invited_by_id: z.string().uuid(),
|
|
41
|
-
expires_at: z.coerce.date(),
|
|
42
|
-
created_at: z.coerce.date(),
|
|
43
|
-
});
|
|
44
|
-
export const CreateInvitationInputSchema = z.object({
|
|
45
|
-
email: z.string().email(),
|
|
46
|
-
permissions: z.number().int().min(1),
|
|
47
|
-
});
|