@middlewr/contracts 0.0.29 → 0.0.30
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/api-keys.schema.d.ts +34 -2
- package/dist/cjs/api-keys.schema.d.ts.map +1 -1
- package/dist/cjs/common.schema.d.ts +4 -0
- package/dist/cjs/common.schema.d.ts.map +1 -1
- package/dist/cjs/index.d.ts +114 -4
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +29 -1
- package/dist/esm/api-keys.schema.d.ts +34 -2
- package/dist/esm/api-keys.schema.d.ts.map +1 -1
- package/dist/esm/common.schema.d.ts +4 -0
- package/dist/esm/common.schema.d.ts.map +1 -1
- package/dist/esm/index.d.ts +114 -4
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +25 -1
- package/package.json +1 -1
- package/src/api-keys.schema.ts +13 -1
- package/src/common.schema.ts +5 -0
- package/src/index.ts +27 -1
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const ApiKeySchema: z.ZodObject<{
|
|
3
3
|
id: z.ZodString;
|
|
4
|
-
|
|
4
|
+
owner_type: z.ZodEnum<{
|
|
5
|
+
user: "user";
|
|
6
|
+
workspace: "workspace";
|
|
7
|
+
}>;
|
|
8
|
+
owner_id: z.ZodString;
|
|
9
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
5
10
|
name: z.ZodString;
|
|
6
11
|
key_prefix: z.ZodString;
|
|
12
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
7
13
|
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
8
14
|
created_at: z.ZodCoercedDate<unknown>;
|
|
9
15
|
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
@@ -13,9 +19,35 @@ export declare const CreateApiKeyInputSchema: z.ZodObject<{
|
|
|
13
19
|
}, z.core.$strip>;
|
|
14
20
|
export declare const CreateApiKeyResponseSchema: z.ZodObject<{
|
|
15
21
|
id: z.ZodString;
|
|
16
|
-
|
|
22
|
+
owner_type: z.ZodEnum<{
|
|
23
|
+
user: "user";
|
|
24
|
+
workspace: "workspace";
|
|
25
|
+
}>;
|
|
26
|
+
owner_id: z.ZodString;
|
|
27
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
17
28
|
name: z.ZodString;
|
|
18
29
|
key_prefix: z.ZodString;
|
|
30
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
31
|
+
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
32
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
33
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
34
|
+
key: z.ZodString;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export declare const CreateWorkspaceApiKeyInputSchema: z.ZodObject<{
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
permissions: z.ZodNumber;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
export declare const CreateWorkspaceApiKeyResponseSchema: z.ZodObject<{
|
|
41
|
+
id: z.ZodString;
|
|
42
|
+
owner_type: z.ZodEnum<{
|
|
43
|
+
user: "user";
|
|
44
|
+
workspace: "workspace";
|
|
45
|
+
}>;
|
|
46
|
+
owner_id: z.ZodString;
|
|
47
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
48
|
+
name: z.ZodString;
|
|
49
|
+
key_prefix: z.ZodString;
|
|
50
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
19
51
|
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
20
52
|
created_at: z.ZodCoercedDate<unknown>;
|
|
21
53
|
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.schema.d.ts","sourceRoot":"","sources":["../../src/api-keys.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"api-keys.schema.d.ts","sourceRoot":"","sources":["../../src/api-keys.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;iBAWvB,CAAC;AAEH,eAAO,MAAM,uBAAuB;;iBAElC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;iBAErC,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;iBAG3C,CAAC;AAEH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;iBAE9C,CAAC"}
|
|
@@ -28,6 +28,10 @@ export declare const UserIdParamSchema: z.ZodObject<{
|
|
|
28
28
|
export declare const ApiKeyIdParamSchema: z.ZodObject<{
|
|
29
29
|
api_key_id: z.ZodString;
|
|
30
30
|
}, z.core.$strip>;
|
|
31
|
+
export declare const WorkspaceApiKeyIdParamSchema: z.ZodObject<{
|
|
32
|
+
workspace_id: z.ZodString;
|
|
33
|
+
api_key_id: z.ZodString;
|
|
34
|
+
}, z.core.$strip>;
|
|
31
35
|
export declare const TokenParamSchema: z.ZodObject<{
|
|
32
36
|
token: z.ZodString;
|
|
33
37
|
}, z.core.$strip>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.schema.d.ts","sourceRoot":"","sources":["../../src/common.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB;;iBAEjC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;iBAG5B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;iBAE5B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;iBAE9B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;iBAE3B,CAAC"}
|
|
1
|
+
{"version":3,"file":"common.schema.d.ts","sourceRoot":"","sources":["../../src/common.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB;;iBAEjC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;iBAG5B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;iBAE5B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;iBAE9B,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;iBAGvC,CAAC;AAEH,eAAO,MAAM,gBAAgB;;iBAE3B,CAAC"}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -144,9 +144,15 @@ export declare const apiKeysContract: {
|
|
|
144
144
|
name: z.ZodString;
|
|
145
145
|
}, z.core.$strip>, z.ZodObject<{
|
|
146
146
|
id: z.ZodString;
|
|
147
|
-
|
|
147
|
+
owner_type: z.ZodEnum<{
|
|
148
|
+
user: "user";
|
|
149
|
+
workspace: "workspace";
|
|
150
|
+
}>;
|
|
151
|
+
owner_id: z.ZodString;
|
|
152
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
148
153
|
name: z.ZodString;
|
|
149
154
|
key_prefix: z.ZodString;
|
|
155
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
150
156
|
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
151
157
|
created_at: z.ZodCoercedDate<unknown>;
|
|
152
158
|
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
@@ -154,14 +160,63 @@ export declare const apiKeysContract: {
|
|
|
154
160
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
155
161
|
list: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodArray<z.ZodObject<{
|
|
156
162
|
id: z.ZodString;
|
|
157
|
-
|
|
163
|
+
owner_type: z.ZodEnum<{
|
|
164
|
+
user: "user";
|
|
165
|
+
workspace: "workspace";
|
|
166
|
+
}>;
|
|
167
|
+
owner_id: z.ZodString;
|
|
168
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
169
|
+
name: z.ZodString;
|
|
170
|
+
key_prefix: z.ZodString;
|
|
171
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
172
|
+
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
173
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
174
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
175
|
+
}, z.core.$strip>>, Record<never, never>, Record<never, never>>;
|
|
176
|
+
delete: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
177
|
+
api_key_id: z.ZodString;
|
|
178
|
+
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
179
|
+
};
|
|
180
|
+
export declare const workspaceApiKeysContract: {
|
|
181
|
+
create: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
182
|
+
workspace_id: z.ZodString;
|
|
183
|
+
name: z.ZodString;
|
|
184
|
+
permissions: z.ZodNumber;
|
|
185
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
186
|
+
id: z.ZodString;
|
|
187
|
+
owner_type: z.ZodEnum<{
|
|
188
|
+
user: "user";
|
|
189
|
+
workspace: "workspace";
|
|
190
|
+
}>;
|
|
191
|
+
owner_id: z.ZodString;
|
|
192
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
158
193
|
name: z.ZodString;
|
|
159
194
|
key_prefix: z.ZodString;
|
|
195
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
196
|
+
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
197
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
198
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
199
|
+
key: z.ZodString;
|
|
200
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
201
|
+
list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
202
|
+
workspace_id: z.ZodString;
|
|
203
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
204
|
+
id: z.ZodString;
|
|
205
|
+
owner_type: z.ZodEnum<{
|
|
206
|
+
user: "user";
|
|
207
|
+
workspace: "workspace";
|
|
208
|
+
}>;
|
|
209
|
+
owner_id: z.ZodString;
|
|
210
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
211
|
+
name: z.ZodString;
|
|
212
|
+
key_prefix: z.ZodString;
|
|
213
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
160
214
|
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
161
215
|
created_at: z.ZodCoercedDate<unknown>;
|
|
162
216
|
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
163
217
|
}, z.core.$strip>>, Record<never, never>, Record<never, never>>;
|
|
164
218
|
delete: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
219
|
+
workspace_id: z.ZodString;
|
|
165
220
|
api_key_id: z.ZodString;
|
|
166
221
|
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
167
222
|
};
|
|
@@ -1549,9 +1604,15 @@ export declare const contract: {
|
|
|
1549
1604
|
name: z.ZodString;
|
|
1550
1605
|
}, z.core.$strip>, z.ZodObject<{
|
|
1551
1606
|
id: z.ZodString;
|
|
1552
|
-
|
|
1607
|
+
owner_type: z.ZodEnum<{
|
|
1608
|
+
user: "user";
|
|
1609
|
+
workspace: "workspace";
|
|
1610
|
+
}>;
|
|
1611
|
+
owner_id: z.ZodString;
|
|
1612
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
1553
1613
|
name: z.ZodString;
|
|
1554
1614
|
key_prefix: z.ZodString;
|
|
1615
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
1555
1616
|
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
1556
1617
|
created_at: z.ZodCoercedDate<unknown>;
|
|
1557
1618
|
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
@@ -1559,14 +1620,63 @@ export declare const contract: {
|
|
|
1559
1620
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
1560
1621
|
list: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodArray<z.ZodObject<{
|
|
1561
1622
|
id: z.ZodString;
|
|
1562
|
-
|
|
1623
|
+
owner_type: z.ZodEnum<{
|
|
1624
|
+
user: "user";
|
|
1625
|
+
workspace: "workspace";
|
|
1626
|
+
}>;
|
|
1627
|
+
owner_id: z.ZodString;
|
|
1628
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
1629
|
+
name: z.ZodString;
|
|
1630
|
+
key_prefix: z.ZodString;
|
|
1631
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
1632
|
+
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
1633
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
1634
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
1635
|
+
}, z.core.$strip>>, Record<never, never>, Record<never, never>>;
|
|
1636
|
+
delete: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
1637
|
+
api_key_id: z.ZodString;
|
|
1638
|
+
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
1639
|
+
};
|
|
1640
|
+
workspaceApiKeys: {
|
|
1641
|
+
create: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
1642
|
+
workspace_id: z.ZodString;
|
|
1643
|
+
name: z.ZodString;
|
|
1644
|
+
permissions: z.ZodNumber;
|
|
1645
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1646
|
+
id: z.ZodString;
|
|
1647
|
+
owner_type: z.ZodEnum<{
|
|
1648
|
+
user: "user";
|
|
1649
|
+
workspace: "workspace";
|
|
1650
|
+
}>;
|
|
1651
|
+
owner_id: z.ZodString;
|
|
1652
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
1563
1653
|
name: z.ZodString;
|
|
1564
1654
|
key_prefix: z.ZodString;
|
|
1655
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
1656
|
+
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
1657
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
1658
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
1659
|
+
key: z.ZodString;
|
|
1660
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
1661
|
+
list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
1662
|
+
workspace_id: z.ZodString;
|
|
1663
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
1664
|
+
id: z.ZodString;
|
|
1665
|
+
owner_type: z.ZodEnum<{
|
|
1666
|
+
user: "user";
|
|
1667
|
+
workspace: "workspace";
|
|
1668
|
+
}>;
|
|
1669
|
+
owner_id: z.ZodString;
|
|
1670
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
1671
|
+
name: z.ZodString;
|
|
1672
|
+
key_prefix: z.ZodString;
|
|
1673
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
1565
1674
|
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
1566
1675
|
created_at: z.ZodCoercedDate<unknown>;
|
|
1567
1676
|
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
1568
1677
|
}, z.core.$strip>>, Record<never, never>, Record<never, never>>;
|
|
1569
1678
|
delete: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
1679
|
+
workspace_id: z.ZodString;
|
|
1570
1680
|
api_key_id: z.ZodString;
|
|
1571
1681
|
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
1572
1682
|
};
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA+CxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAE9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AAGpC,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWpB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC;AACvC,MAAM,MAAM,MAAM,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -35,6 +35,8 @@ __export(index_exports, {
|
|
|
35
35
|
CreateInvitationInputSchema: () => CreateInvitationInputSchema,
|
|
36
36
|
CreateLinkInputSchema: () => CreateLinkInputSchema,
|
|
37
37
|
CreateTagInputSchema: () => CreateTagInputSchema,
|
|
38
|
+
CreateWorkspaceApiKeyInputSchema: () => CreateWorkspaceApiKeyInputSchema,
|
|
39
|
+
CreateWorkspaceApiKeyResponseSchema: () => CreateWorkspaceApiKeyResponseSchema,
|
|
38
40
|
CreateWorkspaceInputSchema: () => CreateWorkspaceInputSchema,
|
|
39
41
|
CustomerPortalSchema: () => CustomerPortalSchema,
|
|
40
42
|
DomainIdParamSchema: () => DomainIdParamSchema,
|
|
@@ -65,6 +67,7 @@ __export(index_exports, {
|
|
|
65
67
|
UpdateWorkspaceInputSchema: () => UpdateWorkspaceInputSchema,
|
|
66
68
|
UserIdParamSchema: () => UserIdParamSchema,
|
|
67
69
|
UserSchema: () => UserSchema,
|
|
70
|
+
WorkspaceApiKeyIdParamSchema: () => WorkspaceApiKeyIdParamSchema,
|
|
68
71
|
WorkspaceIdParamSchema: () => WorkspaceIdParamSchema,
|
|
69
72
|
WorkspaceInvitationSchema: () => WorkspaceInvitationSchema,
|
|
70
73
|
WorkspaceMemberSchema: () => WorkspaceMemberSchema,
|
|
@@ -81,6 +84,7 @@ __export(index_exports, {
|
|
|
81
84
|
linksContract: () => linksContract,
|
|
82
85
|
tagsContract: () => tagsContract,
|
|
83
86
|
usersContract: () => usersContract,
|
|
87
|
+
workspaceApiKeysContract: () => workspaceApiKeysContract,
|
|
84
88
|
workspacesContract: () => workspacesContract
|
|
85
89
|
});
|
|
86
90
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -124,9 +128,12 @@ var LinkAnalyticsQuerySchema = import_zod.z.object({
|
|
|
124
128
|
var import_zod2 = require("zod");
|
|
125
129
|
var ApiKeySchema = import_zod2.z.object({
|
|
126
130
|
id: import_zod2.z.string().uuid(),
|
|
127
|
-
|
|
131
|
+
owner_type: import_zod2.z.enum(["user", "workspace"]),
|
|
132
|
+
owner_id: import_zod2.z.string().uuid(),
|
|
133
|
+
created_by_id: import_zod2.z.string().uuid().nullable(),
|
|
128
134
|
name: import_zod2.z.string(),
|
|
129
135
|
key_prefix: import_zod2.z.string(),
|
|
136
|
+
permissions: import_zod2.z.number().int().nullable(),
|
|
130
137
|
last_used_at: import_zod2.z.coerce.date().nullable(),
|
|
131
138
|
created_at: import_zod2.z.coerce.date(),
|
|
132
139
|
updated_at: import_zod2.z.coerce.date().nullable()
|
|
@@ -137,6 +144,13 @@ var CreateApiKeyInputSchema = import_zod2.z.object({
|
|
|
137
144
|
var CreateApiKeyResponseSchema = ApiKeySchema.extend({
|
|
138
145
|
key: import_zod2.z.string()
|
|
139
146
|
});
|
|
147
|
+
var CreateWorkspaceApiKeyInputSchema = import_zod2.z.object({
|
|
148
|
+
name: import_zod2.z.string().min(1).max(255),
|
|
149
|
+
permissions: import_zod2.z.number().int().min(1)
|
|
150
|
+
});
|
|
151
|
+
var CreateWorkspaceApiKeyResponseSchema = ApiKeySchema.extend({
|
|
152
|
+
key: import_zod2.z.string()
|
|
153
|
+
});
|
|
140
154
|
|
|
141
155
|
// src/billing.schema.ts
|
|
142
156
|
var import_zod3 = require("zod");
|
|
@@ -194,6 +208,10 @@ var UserIdParamSchema = import_zod4.z.object({
|
|
|
194
208
|
var ApiKeyIdParamSchema = import_zod4.z.object({
|
|
195
209
|
api_key_id: import_zod4.z.string().uuid()
|
|
196
210
|
});
|
|
211
|
+
var WorkspaceApiKeyIdParamSchema = import_zod4.z.object({
|
|
212
|
+
workspace_id: import_zod4.z.string().uuid(),
|
|
213
|
+
api_key_id: import_zod4.z.string().uuid()
|
|
214
|
+
});
|
|
197
215
|
var TokenParamSchema = import_zod4.z.object({
|
|
198
216
|
token: import_zod4.z.string()
|
|
199
217
|
});
|
|
@@ -565,6 +583,11 @@ var apiKeysContract = {
|
|
|
565
583
|
list: import_contract.oc.route({ method: "GET", path: "/api/api-keys" }).output(import_zod11.z.array(ApiKeySchema)),
|
|
566
584
|
delete: import_contract.oc.route({ method: "DELETE", path: "/api/api-keys/{api_key_id}" }).input(ApiKeyIdParamSchema).output(import_zod11.z.void())
|
|
567
585
|
};
|
|
586
|
+
var workspaceApiKeysContract = {
|
|
587
|
+
create: import_contract.oc.route({ method: "POST", path: "/api/workspaces/{workspace_id}/api-keys" }).input(WorkspaceIdParamSchema.merge(CreateWorkspaceApiKeyInputSchema)).output(CreateWorkspaceApiKeyResponseSchema),
|
|
588
|
+
list: import_contract.oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/api-keys" }).input(WorkspaceIdParamSchema).output(import_zod11.z.array(ApiKeySchema)),
|
|
589
|
+
delete: import_contract.oc.route({ method: "DELETE", path: "/api/workspaces/{workspace_id}/api-keys/{api_key_id}" }).input(WorkspaceApiKeyIdParamSchema).output(import_zod11.z.void())
|
|
590
|
+
};
|
|
568
591
|
var workspacesContract = {
|
|
569
592
|
create: import_contract.oc.route({ method: "POST", path: "/api/workspaces" }).input(CreateWorkspaceInputSchema).output(WorkspaceSchema),
|
|
570
593
|
list: import_contract.oc.route({ method: "GET", path: "/api/workspaces" }).output(import_zod11.z.array(WorkspaceWithCountSchema)),
|
|
@@ -622,6 +645,7 @@ var contract = {
|
|
|
622
645
|
analytics: analyticsContract,
|
|
623
646
|
users: usersContract,
|
|
624
647
|
apiKeys: apiKeysContract,
|
|
648
|
+
workspaceApiKeys: workspaceApiKeysContract,
|
|
625
649
|
workspaces: workspacesContract,
|
|
626
650
|
invitations: invitationsContract,
|
|
627
651
|
links: linksContract,
|
|
@@ -646,6 +670,8 @@ var contract = {
|
|
|
646
670
|
CreateInvitationInputSchema,
|
|
647
671
|
CreateLinkInputSchema,
|
|
648
672
|
CreateTagInputSchema,
|
|
673
|
+
CreateWorkspaceApiKeyInputSchema,
|
|
674
|
+
CreateWorkspaceApiKeyResponseSchema,
|
|
649
675
|
CreateWorkspaceInputSchema,
|
|
650
676
|
CustomerPortalSchema,
|
|
651
677
|
DomainIdParamSchema,
|
|
@@ -676,6 +702,7 @@ var contract = {
|
|
|
676
702
|
UpdateWorkspaceInputSchema,
|
|
677
703
|
UserIdParamSchema,
|
|
678
704
|
UserSchema,
|
|
705
|
+
WorkspaceApiKeyIdParamSchema,
|
|
679
706
|
WorkspaceIdParamSchema,
|
|
680
707
|
WorkspaceInvitationSchema,
|
|
681
708
|
WorkspaceMemberSchema,
|
|
@@ -692,5 +719,6 @@ var contract = {
|
|
|
692
719
|
linksContract,
|
|
693
720
|
tagsContract,
|
|
694
721
|
usersContract,
|
|
722
|
+
workspaceApiKeysContract,
|
|
695
723
|
workspacesContract
|
|
696
724
|
});
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const ApiKeySchema: z.ZodObject<{
|
|
3
3
|
id: z.ZodString;
|
|
4
|
-
|
|
4
|
+
owner_type: z.ZodEnum<{
|
|
5
|
+
user: "user";
|
|
6
|
+
workspace: "workspace";
|
|
7
|
+
}>;
|
|
8
|
+
owner_id: z.ZodString;
|
|
9
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
5
10
|
name: z.ZodString;
|
|
6
11
|
key_prefix: z.ZodString;
|
|
12
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
7
13
|
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
8
14
|
created_at: z.ZodCoercedDate<unknown>;
|
|
9
15
|
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
@@ -13,9 +19,35 @@ export declare const CreateApiKeyInputSchema: z.ZodObject<{
|
|
|
13
19
|
}, z.core.$strip>;
|
|
14
20
|
export declare const CreateApiKeyResponseSchema: z.ZodObject<{
|
|
15
21
|
id: z.ZodString;
|
|
16
|
-
|
|
22
|
+
owner_type: z.ZodEnum<{
|
|
23
|
+
user: "user";
|
|
24
|
+
workspace: "workspace";
|
|
25
|
+
}>;
|
|
26
|
+
owner_id: z.ZodString;
|
|
27
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
17
28
|
name: z.ZodString;
|
|
18
29
|
key_prefix: z.ZodString;
|
|
30
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
31
|
+
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
32
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
33
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
34
|
+
key: z.ZodString;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export declare const CreateWorkspaceApiKeyInputSchema: z.ZodObject<{
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
permissions: z.ZodNumber;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
export declare const CreateWorkspaceApiKeyResponseSchema: z.ZodObject<{
|
|
41
|
+
id: z.ZodString;
|
|
42
|
+
owner_type: z.ZodEnum<{
|
|
43
|
+
user: "user";
|
|
44
|
+
workspace: "workspace";
|
|
45
|
+
}>;
|
|
46
|
+
owner_id: z.ZodString;
|
|
47
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
48
|
+
name: z.ZodString;
|
|
49
|
+
key_prefix: z.ZodString;
|
|
50
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
19
51
|
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
20
52
|
created_at: z.ZodCoercedDate<unknown>;
|
|
21
53
|
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.schema.d.ts","sourceRoot":"","sources":["../../src/api-keys.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"api-keys.schema.d.ts","sourceRoot":"","sources":["../../src/api-keys.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;iBAWvB,CAAC;AAEH,eAAO,MAAM,uBAAuB;;iBAElC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;iBAErC,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;iBAG3C,CAAC;AAEH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;iBAE9C,CAAC"}
|
|
@@ -28,6 +28,10 @@ export declare const UserIdParamSchema: z.ZodObject<{
|
|
|
28
28
|
export declare const ApiKeyIdParamSchema: z.ZodObject<{
|
|
29
29
|
api_key_id: z.ZodString;
|
|
30
30
|
}, z.core.$strip>;
|
|
31
|
+
export declare const WorkspaceApiKeyIdParamSchema: z.ZodObject<{
|
|
32
|
+
workspace_id: z.ZodString;
|
|
33
|
+
api_key_id: z.ZodString;
|
|
34
|
+
}, z.core.$strip>;
|
|
31
35
|
export declare const TokenParamSchema: z.ZodObject<{
|
|
32
36
|
token: z.ZodString;
|
|
33
37
|
}, z.core.$strip>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.schema.d.ts","sourceRoot":"","sources":["../../src/common.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB;;iBAEjC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;iBAG5B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;iBAE5B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;iBAE9B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;iBAE3B,CAAC"}
|
|
1
|
+
{"version":3,"file":"common.schema.d.ts","sourceRoot":"","sources":["../../src/common.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB;;iBAEjC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;iBAG5B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;iBAE5B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;iBAE9B,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;iBAGvC,CAAC;AAEH,eAAO,MAAM,gBAAgB;;iBAE3B,CAAC"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -144,9 +144,15 @@ export declare const apiKeysContract: {
|
|
|
144
144
|
name: z.ZodString;
|
|
145
145
|
}, z.core.$strip>, z.ZodObject<{
|
|
146
146
|
id: z.ZodString;
|
|
147
|
-
|
|
147
|
+
owner_type: z.ZodEnum<{
|
|
148
|
+
user: "user";
|
|
149
|
+
workspace: "workspace";
|
|
150
|
+
}>;
|
|
151
|
+
owner_id: z.ZodString;
|
|
152
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
148
153
|
name: z.ZodString;
|
|
149
154
|
key_prefix: z.ZodString;
|
|
155
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
150
156
|
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
151
157
|
created_at: z.ZodCoercedDate<unknown>;
|
|
152
158
|
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
@@ -154,14 +160,63 @@ export declare const apiKeysContract: {
|
|
|
154
160
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
155
161
|
list: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodArray<z.ZodObject<{
|
|
156
162
|
id: z.ZodString;
|
|
157
|
-
|
|
163
|
+
owner_type: z.ZodEnum<{
|
|
164
|
+
user: "user";
|
|
165
|
+
workspace: "workspace";
|
|
166
|
+
}>;
|
|
167
|
+
owner_id: z.ZodString;
|
|
168
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
169
|
+
name: z.ZodString;
|
|
170
|
+
key_prefix: z.ZodString;
|
|
171
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
172
|
+
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
173
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
174
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
175
|
+
}, z.core.$strip>>, Record<never, never>, Record<never, never>>;
|
|
176
|
+
delete: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
177
|
+
api_key_id: z.ZodString;
|
|
178
|
+
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
179
|
+
};
|
|
180
|
+
export declare const workspaceApiKeysContract: {
|
|
181
|
+
create: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
182
|
+
workspace_id: z.ZodString;
|
|
183
|
+
name: z.ZodString;
|
|
184
|
+
permissions: z.ZodNumber;
|
|
185
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
186
|
+
id: z.ZodString;
|
|
187
|
+
owner_type: z.ZodEnum<{
|
|
188
|
+
user: "user";
|
|
189
|
+
workspace: "workspace";
|
|
190
|
+
}>;
|
|
191
|
+
owner_id: z.ZodString;
|
|
192
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
158
193
|
name: z.ZodString;
|
|
159
194
|
key_prefix: z.ZodString;
|
|
195
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
196
|
+
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
197
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
198
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
199
|
+
key: z.ZodString;
|
|
200
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
201
|
+
list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
202
|
+
workspace_id: z.ZodString;
|
|
203
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
204
|
+
id: z.ZodString;
|
|
205
|
+
owner_type: z.ZodEnum<{
|
|
206
|
+
user: "user";
|
|
207
|
+
workspace: "workspace";
|
|
208
|
+
}>;
|
|
209
|
+
owner_id: z.ZodString;
|
|
210
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
211
|
+
name: z.ZodString;
|
|
212
|
+
key_prefix: z.ZodString;
|
|
213
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
160
214
|
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
161
215
|
created_at: z.ZodCoercedDate<unknown>;
|
|
162
216
|
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
163
217
|
}, z.core.$strip>>, Record<never, never>, Record<never, never>>;
|
|
164
218
|
delete: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
219
|
+
workspace_id: z.ZodString;
|
|
165
220
|
api_key_id: z.ZodString;
|
|
166
221
|
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
167
222
|
};
|
|
@@ -1549,9 +1604,15 @@ export declare const contract: {
|
|
|
1549
1604
|
name: z.ZodString;
|
|
1550
1605
|
}, z.core.$strip>, z.ZodObject<{
|
|
1551
1606
|
id: z.ZodString;
|
|
1552
|
-
|
|
1607
|
+
owner_type: z.ZodEnum<{
|
|
1608
|
+
user: "user";
|
|
1609
|
+
workspace: "workspace";
|
|
1610
|
+
}>;
|
|
1611
|
+
owner_id: z.ZodString;
|
|
1612
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
1553
1613
|
name: z.ZodString;
|
|
1554
1614
|
key_prefix: z.ZodString;
|
|
1615
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
1555
1616
|
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
1556
1617
|
created_at: z.ZodCoercedDate<unknown>;
|
|
1557
1618
|
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
@@ -1559,14 +1620,63 @@ export declare const contract: {
|
|
|
1559
1620
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
1560
1621
|
list: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodArray<z.ZodObject<{
|
|
1561
1622
|
id: z.ZodString;
|
|
1562
|
-
|
|
1623
|
+
owner_type: z.ZodEnum<{
|
|
1624
|
+
user: "user";
|
|
1625
|
+
workspace: "workspace";
|
|
1626
|
+
}>;
|
|
1627
|
+
owner_id: z.ZodString;
|
|
1628
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
1629
|
+
name: z.ZodString;
|
|
1630
|
+
key_prefix: z.ZodString;
|
|
1631
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
1632
|
+
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
1633
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
1634
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
1635
|
+
}, z.core.$strip>>, Record<never, never>, Record<never, never>>;
|
|
1636
|
+
delete: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
1637
|
+
api_key_id: z.ZodString;
|
|
1638
|
+
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
1639
|
+
};
|
|
1640
|
+
workspaceApiKeys: {
|
|
1641
|
+
create: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
1642
|
+
workspace_id: z.ZodString;
|
|
1643
|
+
name: z.ZodString;
|
|
1644
|
+
permissions: z.ZodNumber;
|
|
1645
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1646
|
+
id: z.ZodString;
|
|
1647
|
+
owner_type: z.ZodEnum<{
|
|
1648
|
+
user: "user";
|
|
1649
|
+
workspace: "workspace";
|
|
1650
|
+
}>;
|
|
1651
|
+
owner_id: z.ZodString;
|
|
1652
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
1563
1653
|
name: z.ZodString;
|
|
1564
1654
|
key_prefix: z.ZodString;
|
|
1655
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
1656
|
+
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
1657
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
1658
|
+
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
1659
|
+
key: z.ZodString;
|
|
1660
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
1661
|
+
list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
1662
|
+
workspace_id: z.ZodString;
|
|
1663
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
1664
|
+
id: z.ZodString;
|
|
1665
|
+
owner_type: z.ZodEnum<{
|
|
1666
|
+
user: "user";
|
|
1667
|
+
workspace: "workspace";
|
|
1668
|
+
}>;
|
|
1669
|
+
owner_id: z.ZodString;
|
|
1670
|
+
created_by_id: z.ZodNullable<z.ZodString>;
|
|
1671
|
+
name: z.ZodString;
|
|
1672
|
+
key_prefix: z.ZodString;
|
|
1673
|
+
permissions: z.ZodNullable<z.ZodNumber>;
|
|
1565
1674
|
last_used_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
1566
1675
|
created_at: z.ZodCoercedDate<unknown>;
|
|
1567
1676
|
updated_at: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
1568
1677
|
}, z.core.$strip>>, Record<never, never>, Record<never, never>>;
|
|
1569
1678
|
delete: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
1679
|
+
workspace_id: z.ZodString;
|
|
1570
1680
|
api_key_id: z.ZodString;
|
|
1571
1681
|
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
1572
1682
|
};
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA+CxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAE9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AAGpC,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWpB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC;AACvC,MAAM,MAAM,MAAM,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -39,9 +39,12 @@ var LinkAnalyticsQuerySchema = z.object({
|
|
|
39
39
|
import { z as z2 } from "zod";
|
|
40
40
|
var ApiKeySchema = z2.object({
|
|
41
41
|
id: z2.string().uuid(),
|
|
42
|
-
|
|
42
|
+
owner_type: z2.enum(["user", "workspace"]),
|
|
43
|
+
owner_id: z2.string().uuid(),
|
|
44
|
+
created_by_id: z2.string().uuid().nullable(),
|
|
43
45
|
name: z2.string(),
|
|
44
46
|
key_prefix: z2.string(),
|
|
47
|
+
permissions: z2.number().int().nullable(),
|
|
45
48
|
last_used_at: z2.coerce.date().nullable(),
|
|
46
49
|
created_at: z2.coerce.date(),
|
|
47
50
|
updated_at: z2.coerce.date().nullable()
|
|
@@ -52,6 +55,13 @@ var CreateApiKeyInputSchema = z2.object({
|
|
|
52
55
|
var CreateApiKeyResponseSchema = ApiKeySchema.extend({
|
|
53
56
|
key: z2.string()
|
|
54
57
|
});
|
|
58
|
+
var CreateWorkspaceApiKeyInputSchema = z2.object({
|
|
59
|
+
name: z2.string().min(1).max(255),
|
|
60
|
+
permissions: z2.number().int().min(1)
|
|
61
|
+
});
|
|
62
|
+
var CreateWorkspaceApiKeyResponseSchema = ApiKeySchema.extend({
|
|
63
|
+
key: z2.string()
|
|
64
|
+
});
|
|
55
65
|
|
|
56
66
|
// src/billing.schema.ts
|
|
57
67
|
import { z as z3 } from "zod";
|
|
@@ -109,6 +119,10 @@ var UserIdParamSchema = z4.object({
|
|
|
109
119
|
var ApiKeyIdParamSchema = z4.object({
|
|
110
120
|
api_key_id: z4.string().uuid()
|
|
111
121
|
});
|
|
122
|
+
var WorkspaceApiKeyIdParamSchema = z4.object({
|
|
123
|
+
workspace_id: z4.string().uuid(),
|
|
124
|
+
api_key_id: z4.string().uuid()
|
|
125
|
+
});
|
|
112
126
|
var TokenParamSchema = z4.object({
|
|
113
127
|
token: z4.string()
|
|
114
128
|
});
|
|
@@ -480,6 +494,11 @@ var apiKeysContract = {
|
|
|
480
494
|
list: oc.route({ method: "GET", path: "/api/api-keys" }).output(z11.array(ApiKeySchema)),
|
|
481
495
|
delete: oc.route({ method: "DELETE", path: "/api/api-keys/{api_key_id}" }).input(ApiKeyIdParamSchema).output(z11.void())
|
|
482
496
|
};
|
|
497
|
+
var workspaceApiKeysContract = {
|
|
498
|
+
create: oc.route({ method: "POST", path: "/api/workspaces/{workspace_id}/api-keys" }).input(WorkspaceIdParamSchema.merge(CreateWorkspaceApiKeyInputSchema)).output(CreateWorkspaceApiKeyResponseSchema),
|
|
499
|
+
list: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/api-keys" }).input(WorkspaceIdParamSchema).output(z11.array(ApiKeySchema)),
|
|
500
|
+
delete: oc.route({ method: "DELETE", path: "/api/workspaces/{workspace_id}/api-keys/{api_key_id}" }).input(WorkspaceApiKeyIdParamSchema).output(z11.void())
|
|
501
|
+
};
|
|
483
502
|
var workspacesContract = {
|
|
484
503
|
create: oc.route({ method: "POST", path: "/api/workspaces" }).input(CreateWorkspaceInputSchema).output(WorkspaceSchema),
|
|
485
504
|
list: oc.route({ method: "GET", path: "/api/workspaces" }).output(z11.array(WorkspaceWithCountSchema)),
|
|
@@ -537,6 +556,7 @@ var contract = {
|
|
|
537
556
|
analytics: analyticsContract,
|
|
538
557
|
users: usersContract,
|
|
539
558
|
apiKeys: apiKeysContract,
|
|
559
|
+
workspaceApiKeys: workspaceApiKeysContract,
|
|
540
560
|
workspaces: workspacesContract,
|
|
541
561
|
invitations: invitationsContract,
|
|
542
562
|
links: linksContract,
|
|
@@ -560,6 +580,8 @@ export {
|
|
|
560
580
|
CreateInvitationInputSchema,
|
|
561
581
|
CreateLinkInputSchema,
|
|
562
582
|
CreateTagInputSchema,
|
|
583
|
+
CreateWorkspaceApiKeyInputSchema,
|
|
584
|
+
CreateWorkspaceApiKeyResponseSchema,
|
|
563
585
|
CreateWorkspaceInputSchema,
|
|
564
586
|
CustomerPortalSchema,
|
|
565
587
|
DomainIdParamSchema,
|
|
@@ -590,6 +612,7 @@ export {
|
|
|
590
612
|
UpdateWorkspaceInputSchema,
|
|
591
613
|
UserIdParamSchema,
|
|
592
614
|
UserSchema,
|
|
615
|
+
WorkspaceApiKeyIdParamSchema,
|
|
593
616
|
WorkspaceIdParamSchema,
|
|
594
617
|
WorkspaceInvitationSchema,
|
|
595
618
|
WorkspaceMemberSchema,
|
|
@@ -606,5 +629,6 @@ export {
|
|
|
606
629
|
linksContract,
|
|
607
630
|
tagsContract,
|
|
608
631
|
usersContract,
|
|
632
|
+
workspaceApiKeysContract,
|
|
609
633
|
workspacesContract
|
|
610
634
|
};
|
package/package.json
CHANGED
package/src/api-keys.schema.ts
CHANGED
|
@@ -2,9 +2,12 @@ import { z } from 'zod';
|
|
|
2
2
|
|
|
3
3
|
export const ApiKeySchema = z.object({
|
|
4
4
|
id: z.string().uuid(),
|
|
5
|
-
|
|
5
|
+
owner_type: z.enum(['user', 'workspace']),
|
|
6
|
+
owner_id: z.string().uuid(),
|
|
7
|
+
created_by_id: z.string().uuid().nullable(),
|
|
6
8
|
name: z.string(),
|
|
7
9
|
key_prefix: z.string(),
|
|
10
|
+
permissions: z.number().int().nullable(),
|
|
8
11
|
last_used_at: z.coerce.date().nullable(),
|
|
9
12
|
created_at: z.coerce.date(),
|
|
10
13
|
updated_at: z.coerce.date().nullable(),
|
|
@@ -17,3 +20,12 @@ export const CreateApiKeyInputSchema = z.object({
|
|
|
17
20
|
export const CreateApiKeyResponseSchema = ApiKeySchema.extend({
|
|
18
21
|
key: z.string(),
|
|
19
22
|
});
|
|
23
|
+
|
|
24
|
+
export const CreateWorkspaceApiKeyInputSchema = z.object({
|
|
25
|
+
name: z.string().min(1).max(255),
|
|
26
|
+
permissions: z.number().int().min(1),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const CreateWorkspaceApiKeyResponseSchema = ApiKeySchema.extend({
|
|
30
|
+
key: z.string(),
|
|
31
|
+
});
|
package/src/common.schema.ts
CHANGED
|
@@ -37,6 +37,11 @@ export const ApiKeyIdParamSchema = z.object({
|
|
|
37
37
|
api_key_id: z.string().uuid(),
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
+
export const WorkspaceApiKeyIdParamSchema = z.object({
|
|
41
|
+
workspace_id: z.string().uuid(),
|
|
42
|
+
api_key_id: z.string().uuid(),
|
|
43
|
+
});
|
|
44
|
+
|
|
40
45
|
export const TokenParamSchema = z.object({
|
|
41
46
|
token: z.string(),
|
|
42
47
|
});
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,13 @@ import { oc } from '@orpc/contract';
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
import { AnalyticsOutputSchema, AnalyticsQuerySchema } from './analytics.schema';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
ApiKeySchema,
|
|
8
|
+
CreateApiKeyInputSchema,
|
|
9
|
+
CreateApiKeyResponseSchema,
|
|
10
|
+
CreateWorkspaceApiKeyInputSchema,
|
|
11
|
+
CreateWorkspaceApiKeyResponseSchema,
|
|
12
|
+
} from './api-keys.schema';
|
|
7
13
|
import { BillingStatusSchema, CheckoutSessionSchema, CreateCheckoutInputSchema, CustomerPortalSchema } from './billing.schema';
|
|
8
14
|
import {
|
|
9
15
|
ApiKeyIdParamSchema,
|
|
@@ -13,6 +19,7 @@ import {
|
|
|
13
19
|
MemberIdParamSchema,
|
|
14
20
|
TagIdParamSchema,
|
|
15
21
|
TokenParamSchema,
|
|
22
|
+
WorkspaceApiKeyIdParamSchema,
|
|
16
23
|
WorkspaceIdParamSchema,
|
|
17
24
|
} from './common.schema';
|
|
18
25
|
import { CreateDomainInputSchema, DomainSchema, UpdateDomainInputSchema } from './domains.schema';
|
|
@@ -89,6 +96,24 @@ export const apiKeysContract = {
|
|
|
89
96
|
delete: oc.route({ method: 'DELETE', path: '/api/api-keys/{api_key_id}' }).input(ApiKeyIdParamSchema).output(z.void()),
|
|
90
97
|
};
|
|
91
98
|
|
|
99
|
+
// Workspace API Keys contract
|
|
100
|
+
export const workspaceApiKeysContract = {
|
|
101
|
+
create: oc
|
|
102
|
+
.route({ method: 'POST', path: '/api/workspaces/{workspace_id}/api-keys' })
|
|
103
|
+
.input(WorkspaceIdParamSchema.merge(CreateWorkspaceApiKeyInputSchema))
|
|
104
|
+
.output(CreateWorkspaceApiKeyResponseSchema),
|
|
105
|
+
|
|
106
|
+
list: oc
|
|
107
|
+
.route({ method: 'GET', path: '/api/workspaces/{workspace_id}/api-keys' })
|
|
108
|
+
.input(WorkspaceIdParamSchema)
|
|
109
|
+
.output(z.array(ApiKeySchema)),
|
|
110
|
+
|
|
111
|
+
delete: oc
|
|
112
|
+
.route({ method: 'DELETE', path: '/api/workspaces/{workspace_id}/api-keys/{api_key_id}' })
|
|
113
|
+
.input(WorkspaceApiKeyIdParamSchema)
|
|
114
|
+
.output(z.void()),
|
|
115
|
+
};
|
|
116
|
+
|
|
92
117
|
// Workspaces contract
|
|
93
118
|
export const workspacesContract = {
|
|
94
119
|
create: oc.route({ method: 'POST', path: '/api/workspaces' }).input(CreateWorkspaceInputSchema).output(WorkspaceSchema),
|
|
@@ -275,6 +300,7 @@ export const contract = {
|
|
|
275
300
|
analytics: analyticsContract,
|
|
276
301
|
users: usersContract,
|
|
277
302
|
apiKeys: apiKeysContract,
|
|
303
|
+
workspaceApiKeys: workspaceApiKeysContract,
|
|
278
304
|
workspaces: workspacesContract,
|
|
279
305
|
invitations: invitationsContract,
|
|
280
306
|
links: linksContract,
|