@middlewr/contracts 0.0.40 → 0.0.42
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/common.schema.d.ts +4 -0
- package/dist/cjs/common.schema.d.ts.map +1 -1
- package/dist/cjs/index.d.ts +1807 -548
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +295 -226
- package/dist/cjs/link-templates.schema.d.ts +373 -0
- package/dist/cjs/link-templates.schema.d.ts.map +1 -0
- package/dist/cjs/links.schema.d.ts +35 -3
- package/dist/cjs/links.schema.d.ts.map +1 -1
- package/dist/cjs/rules.schema.d.ts +16 -0
- package/dist/cjs/rules.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 +1807 -548
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +288 -226
- package/dist/esm/link-templates.schema.d.ts +373 -0
- package/dist/esm/link-templates.schema.d.ts.map +1 -0
- package/dist/esm/links.schema.d.ts +35 -3
- package/dist/esm/links.schema.d.ts.map +1 -1
- package/dist/esm/rules.schema.d.ts +16 -0
- package/dist/esm/rules.schema.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common.schema.ts +5 -0
- package/src/index.ts +38 -0
- package/src/link-templates.schema.ts +39 -0
- package/src/rules.schema.ts +8 -0
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { oc } from "@orpc/contract";
|
|
3
|
-
import { z as
|
|
3
|
+
import { z as z12 } from "zod";
|
|
4
4
|
|
|
5
5
|
// src/analytics.schema.ts
|
|
6
6
|
import { z } from "zod";
|
|
@@ -160,6 +160,10 @@ var WorkspaceApiKeyIdParamSchema = z4.object({
|
|
|
160
160
|
workspace_id: z4.string().uuid(),
|
|
161
161
|
api_key_id: z4.string().uuid()
|
|
162
162
|
});
|
|
163
|
+
var LinkTemplateIdParamSchema = z4.object({
|
|
164
|
+
workspace_id: z4.string().uuid(),
|
|
165
|
+
link_template_id: z4.string().uuid()
|
|
166
|
+
});
|
|
163
167
|
var TokenParamSchema = z4.object({
|
|
164
168
|
token: z4.string()
|
|
165
169
|
});
|
|
@@ -194,8 +198,8 @@ var UpdateDomainInputSchema = z5.object({
|
|
|
194
198
|
}).optional()
|
|
195
199
|
});
|
|
196
200
|
|
|
197
|
-
// src/
|
|
198
|
-
import { z as
|
|
201
|
+
// src/link-templates.schema.ts
|
|
202
|
+
import { z as z7 } from "zod";
|
|
199
203
|
|
|
200
204
|
// src/rules.schema.ts
|
|
201
205
|
import { z as z6 } from "zod";
|
|
@@ -262,11 +266,18 @@ var TransformNodeSchema = z6.object({
|
|
|
262
266
|
}),
|
|
263
267
|
next: z6.string().nullable()
|
|
264
268
|
});
|
|
269
|
+
var PasswordNodeSchema = z6.object({
|
|
270
|
+
id: z6.string(),
|
|
271
|
+
type: z6.literal("password"),
|
|
272
|
+
position: PositionSchema,
|
|
273
|
+
next: z6.string().nullable()
|
|
274
|
+
});
|
|
265
275
|
var RuleGraphNodeSchema = z6.discriminatedUnion("type", [
|
|
266
276
|
ConditionNodeSchema,
|
|
267
277
|
SplitNodeSchema,
|
|
268
278
|
DestinationNodeSchema,
|
|
269
|
-
TransformNodeSchema
|
|
279
|
+
TransformNodeSchema,
|
|
280
|
+
PasswordNodeSchema
|
|
270
281
|
]);
|
|
271
282
|
var RuleGraphSchema = z6.object({
|
|
272
283
|
entry: z6.string(),
|
|
@@ -276,251 +287,287 @@ var RuleGraphSchema = z6.object({
|
|
|
276
287
|
path: ["entry"]
|
|
277
288
|
}).nullable();
|
|
278
289
|
|
|
279
|
-
// src/
|
|
280
|
-
|
|
281
|
-
var TagSchema = z7.object({
|
|
290
|
+
// src/link-templates.schema.ts
|
|
291
|
+
var LinkTemplateSchema = z7.object({
|
|
282
292
|
id: z7.string().uuid(),
|
|
283
293
|
workspace_id: z7.string().uuid(),
|
|
284
|
-
|
|
285
|
-
|
|
294
|
+
title: z7.string(),
|
|
295
|
+
description: z7.string().nullable(),
|
|
296
|
+
rule_graph: RuleGraphSchema,
|
|
286
297
|
created_at: z7.coerce.date(),
|
|
287
298
|
updated_at: z7.coerce.date().nullable()
|
|
288
299
|
});
|
|
289
|
-
var
|
|
290
|
-
|
|
291
|
-
|
|
300
|
+
var CreateLinkTemplateInputSchema = z7.object({
|
|
301
|
+
title: z7.string().min(1).max(255),
|
|
302
|
+
description: z7.string().max(2e3).optional(),
|
|
303
|
+
rule_graph: RuleGraphSchema
|
|
304
|
+
});
|
|
305
|
+
var UpdateLinkTemplateInputSchema = z7.object({
|
|
306
|
+
title: z7.string().min(1).max(255).optional(),
|
|
307
|
+
description: z7.string().max(2e3).nullable().optional(),
|
|
308
|
+
rule_graph: RuleGraphSchema.optional()
|
|
309
|
+
});
|
|
310
|
+
var LinkTemplateFiltersSchema = z7.object({
|
|
311
|
+
search: z7.string().optional(),
|
|
312
|
+
page: z7.coerce.number().int().min(1).default(1),
|
|
313
|
+
per_page: z7.coerce.number().int().min(1).max(100).default(20)
|
|
292
314
|
});
|
|
293
|
-
var
|
|
294
|
-
|
|
295
|
-
|
|
315
|
+
var PaginatedLinkTemplatesSchema = z7.object({
|
|
316
|
+
link_templates: z7.array(LinkTemplateSchema),
|
|
317
|
+
total: z7.number().int(),
|
|
318
|
+
page: z7.number().int(),
|
|
319
|
+
per_page: z7.number().int(),
|
|
320
|
+
total_pages: z7.number().int()
|
|
296
321
|
});
|
|
297
322
|
|
|
298
323
|
// src/links.schema.ts
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
324
|
+
import { z as z9 } from "zod";
|
|
325
|
+
|
|
326
|
+
// src/tags.schema.ts
|
|
327
|
+
import { z as z8 } from "zod";
|
|
328
|
+
var TagSchema = z8.object({
|
|
329
|
+
id: z8.string().uuid(),
|
|
330
|
+
workspace_id: z8.string().uuid(),
|
|
331
|
+
name: z8.string(),
|
|
332
|
+
color: z8.string().nullable(),
|
|
333
|
+
created_at: z8.coerce.date(),
|
|
334
|
+
updated_at: z8.coerce.date().nullable()
|
|
335
|
+
});
|
|
336
|
+
var CreateTagInputSchema = z8.object({
|
|
337
|
+
name: z8.string().min(1).max(50),
|
|
338
|
+
color: z8.string().regex(/^#[0-9A-Fa-f]{6}$/).optional()
|
|
339
|
+
});
|
|
340
|
+
var UpdateTagInputSchema = z8.object({
|
|
341
|
+
name: z8.string().min(1).max(50).optional(),
|
|
342
|
+
color: z8.string().regex(/^#[0-9A-Fa-f]{6}$/).nullable().optional()
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
// src/links.schema.ts
|
|
346
|
+
var DotStyleSchema = z9.enum(["square", "dots", "rounded", "classy", "classy-rounded", "extra-rounded"]);
|
|
347
|
+
var EyeOuterStyleSchema = z9.enum(["square", "dot", "extra-rounded"]);
|
|
348
|
+
var EyeInnerStyleSchema = z9.enum(["square", "dot"]);
|
|
349
|
+
var QrCodeSettingsSchema = z9.object({
|
|
350
|
+
fg_color: z9.string().max(20),
|
|
351
|
+
bg_color: z9.string().max(20),
|
|
305
352
|
dot_style: DotStyleSchema,
|
|
306
353
|
eye_outer_style: EyeOuterStyleSchema,
|
|
307
354
|
eye_inner_style: EyeInnerStyleSchema,
|
|
308
|
-
frame_enabled:
|
|
309
|
-
frame_text:
|
|
310
|
-
frame_color:
|
|
311
|
-
frame_text_color:
|
|
312
|
-
logo_size:
|
|
355
|
+
frame_enabled: z9.boolean(),
|
|
356
|
+
frame_text: z9.string().max(255),
|
|
357
|
+
frame_color: z9.string().max(20),
|
|
358
|
+
frame_text_color: z9.string().max(20),
|
|
359
|
+
logo_size: z9.number().int().min(1).nullable().optional()
|
|
313
360
|
});
|
|
314
|
-
var LinkSchema =
|
|
315
|
-
id:
|
|
316
|
-
workspace_id:
|
|
317
|
-
domain_id:
|
|
318
|
-
created_by_id:
|
|
319
|
-
original_url:
|
|
320
|
-
short_code:
|
|
321
|
-
title:
|
|
322
|
-
description:
|
|
323
|
-
utm_source:
|
|
324
|
-
utm_medium:
|
|
325
|
-
utm_campaign:
|
|
326
|
-
utm_term:
|
|
327
|
-
utm_content:
|
|
328
|
-
password:
|
|
329
|
-
starts_at:
|
|
330
|
-
expires_at:
|
|
331
|
-
fallback_url:
|
|
332
|
-
is_active:
|
|
333
|
-
redirect_type:
|
|
334
|
-
click_count:
|
|
335
|
-
click_count_updated_at:
|
|
336
|
-
created_at:
|
|
337
|
-
updated_at:
|
|
361
|
+
var LinkSchema = z9.object({
|
|
362
|
+
id: z9.string().uuid(),
|
|
363
|
+
workspace_id: z9.string().uuid(),
|
|
364
|
+
domain_id: z9.string().uuid(),
|
|
365
|
+
created_by_id: z9.string().uuid(),
|
|
366
|
+
original_url: z9.string().url(),
|
|
367
|
+
short_code: z9.string(),
|
|
368
|
+
title: z9.string().nullable(),
|
|
369
|
+
description: z9.string().nullable(),
|
|
370
|
+
utm_source: z9.string().nullable(),
|
|
371
|
+
utm_medium: z9.string().nullable(),
|
|
372
|
+
utm_campaign: z9.string().nullable(),
|
|
373
|
+
utm_term: z9.string().nullable(),
|
|
374
|
+
utm_content: z9.string().nullable(),
|
|
375
|
+
password: z9.string().nullable(),
|
|
376
|
+
starts_at: z9.coerce.date().nullable(),
|
|
377
|
+
expires_at: z9.coerce.date().nullable(),
|
|
378
|
+
fallback_url: z9.string().nullable(),
|
|
379
|
+
is_active: z9.boolean(),
|
|
380
|
+
redirect_type: z9.number().int(),
|
|
381
|
+
click_count: z9.coerce.number().int(),
|
|
382
|
+
click_count_updated_at: z9.coerce.date().nullable(),
|
|
383
|
+
created_at: z9.coerce.date(),
|
|
384
|
+
updated_at: z9.coerce.date().nullable(),
|
|
338
385
|
qr_code_settings: QrCodeSettingsSchema.nullable(),
|
|
339
|
-
qr_logo_key:
|
|
340
|
-
logo_url:
|
|
341
|
-
link_type:
|
|
386
|
+
qr_logo_key: z9.string().nullable(),
|
|
387
|
+
logo_url: z9.string().nullable(),
|
|
388
|
+
link_type: z9.enum(["redirect", "rules"]).default("redirect"),
|
|
342
389
|
rule_graph: RuleGraphSchema.optional(),
|
|
343
|
-
tags:
|
|
344
|
-
});
|
|
345
|
-
var CreateLinkInputSchema =
|
|
346
|
-
original_url:
|
|
347
|
-
domain_id:
|
|
348
|
-
short_code:
|
|
349
|
-
title:
|
|
350
|
-
description:
|
|
351
|
-
utm_source:
|
|
352
|
-
utm_medium:
|
|
353
|
-
utm_campaign:
|
|
354
|
-
utm_term:
|
|
355
|
-
utm_content:
|
|
356
|
-
password:
|
|
357
|
-
starts_at:
|
|
358
|
-
expires_at:
|
|
359
|
-
fallback_url:
|
|
360
|
-
redirect_type:
|
|
390
|
+
tags: z9.array(TagSchema)
|
|
391
|
+
});
|
|
392
|
+
var CreateLinkInputSchema = z9.object({
|
|
393
|
+
original_url: z9.string().url().max(2048),
|
|
394
|
+
domain_id: z9.string().uuid().optional(),
|
|
395
|
+
short_code: z9.string().min(3).max(50).regex(/^[a-zA-Z0-9-]+$/).optional(),
|
|
396
|
+
title: z9.string().max(255).optional(),
|
|
397
|
+
description: z9.string().max(2e3).optional(),
|
|
398
|
+
utm_source: z9.string().max(255).optional(),
|
|
399
|
+
utm_medium: z9.string().max(255).optional(),
|
|
400
|
+
utm_campaign: z9.string().max(255).optional(),
|
|
401
|
+
utm_term: z9.string().max(255).optional(),
|
|
402
|
+
utm_content: z9.string().max(255).optional(),
|
|
403
|
+
password: z9.string().min(4).max(100).optional(),
|
|
404
|
+
starts_at: z9.coerce.date().optional(),
|
|
405
|
+
expires_at: z9.coerce.date().optional(),
|
|
406
|
+
fallback_url: z9.string().url().max(2048).optional(),
|
|
407
|
+
redirect_type: z9.coerce.number().refine((v) => [301, 302, 307, 308].includes(v)).optional(),
|
|
361
408
|
qr_code_settings: QrCodeSettingsSchema.nullable().optional(),
|
|
362
|
-
tag_ids:
|
|
363
|
-
link_type:
|
|
409
|
+
tag_ids: z9.array(z9.string().uuid()).optional(),
|
|
410
|
+
link_type: z9.enum(["redirect", "rules"]).optional(),
|
|
364
411
|
rule_graph: RuleGraphSchema.optional()
|
|
365
412
|
}).refine((data) => data.link_type !== "rules" || data.rule_graph != null, {
|
|
366
413
|
message: 'rule_graph is required when link_type is "rules"',
|
|
367
414
|
path: ["rule_graph"]
|
|
368
415
|
});
|
|
369
|
-
var UpdateLinkInputSchema =
|
|
370
|
-
original_url:
|
|
371
|
-
domain_id:
|
|
372
|
-
short_code:
|
|
373
|
-
title:
|
|
374
|
-
description:
|
|
375
|
-
utm_source:
|
|
376
|
-
utm_medium:
|
|
377
|
-
utm_campaign:
|
|
378
|
-
utm_term:
|
|
379
|
-
utm_content:
|
|
380
|
-
password:
|
|
381
|
-
starts_at:
|
|
382
|
-
expires_at:
|
|
383
|
-
fallback_url:
|
|
384
|
-
is_active:
|
|
385
|
-
redirect_type:
|
|
416
|
+
var UpdateLinkInputSchema = z9.object({
|
|
417
|
+
original_url: z9.string().url().max(2048).optional(),
|
|
418
|
+
domain_id: z9.string().uuid().optional(),
|
|
419
|
+
short_code: z9.string().min(3).max(50).regex(/^[a-zA-Z0-9-]+$/).optional(),
|
|
420
|
+
title: z9.string().max(255).nullable().optional(),
|
|
421
|
+
description: z9.string().max(2e3).nullable().optional(),
|
|
422
|
+
utm_source: z9.string().max(255).nullable().optional(),
|
|
423
|
+
utm_medium: z9.string().max(255).nullable().optional(),
|
|
424
|
+
utm_campaign: z9.string().max(255).nullable().optional(),
|
|
425
|
+
utm_term: z9.string().max(255).nullable().optional(),
|
|
426
|
+
utm_content: z9.string().max(255).nullable().optional(),
|
|
427
|
+
password: z9.string().min(4).max(100).nullable().optional(),
|
|
428
|
+
starts_at: z9.coerce.date().nullable().optional(),
|
|
429
|
+
expires_at: z9.coerce.date().nullable().optional(),
|
|
430
|
+
fallback_url: z9.string().url().max(2048).nullable().optional(),
|
|
431
|
+
is_active: z9.boolean().optional(),
|
|
432
|
+
redirect_type: z9.coerce.number().refine((v) => [301, 302, 307, 308].includes(v)).optional(),
|
|
386
433
|
qr_code_settings: QrCodeSettingsSchema.nullable().optional(),
|
|
387
|
-
tag_ids:
|
|
388
|
-
link_type:
|
|
434
|
+
tag_ids: z9.array(z9.string().uuid()).optional(),
|
|
435
|
+
link_type: z9.enum(["redirect", "rules"]).optional(),
|
|
389
436
|
rule_graph: RuleGraphSchema.optional()
|
|
390
437
|
}).refine((data) => data.link_type !== "rules" || data.rule_graph != null, {
|
|
391
438
|
message: 'rule_graph is required when link_type is "rules"',
|
|
392
439
|
path: ["rule_graph"]
|
|
393
440
|
});
|
|
394
|
-
var stringToBoolean =
|
|
395
|
-
var LinkFiltersSchema =
|
|
396
|
-
search:
|
|
397
|
-
domain_ids:
|
|
441
|
+
var stringToBoolean = z9.union([z9.boolean(), z9.enum(["true", "false"])]).transform((val) => typeof val === "string" ? val === "true" : val);
|
|
442
|
+
var LinkFiltersSchema = z9.object({
|
|
443
|
+
search: z9.string().optional(),
|
|
444
|
+
domain_ids: z9.array(z9.string().uuid()).optional(),
|
|
398
445
|
is_active: stringToBoolean.optional(),
|
|
399
446
|
has_expiration: stringToBoolean.optional(),
|
|
400
447
|
expired: stringToBoolean.optional(),
|
|
401
|
-
created_from:
|
|
402
|
-
created_to:
|
|
403
|
-
expires_from:
|
|
404
|
-
expires_to:
|
|
405
|
-
tag_ids:
|
|
406
|
-
sort_by:
|
|
407
|
-
sort_order:
|
|
408
|
-
page:
|
|
409
|
-
per_page:
|
|
448
|
+
created_from: z9.coerce.date().optional(),
|
|
449
|
+
created_to: z9.coerce.date().optional(),
|
|
450
|
+
expires_from: z9.coerce.date().optional(),
|
|
451
|
+
expires_to: z9.coerce.date().optional(),
|
|
452
|
+
tag_ids: z9.array(z9.string().uuid()).optional(),
|
|
453
|
+
sort_by: z9.enum(["created_at", "title", "click_count", "original_url"]).default("created_at"),
|
|
454
|
+
sort_order: z9.enum(["asc", "desc"]).default("desc"),
|
|
455
|
+
page: z9.coerce.number().int().min(1).default(1),
|
|
456
|
+
per_page: z9.coerce.number().int().min(1).max(100).default(20)
|
|
410
457
|
});
|
|
411
458
|
var ExportLinksFiltersSchema = LinkFiltersSchema.omit({ page: true, per_page: true });
|
|
412
|
-
var PaginatedLinksSchema =
|
|
413
|
-
links:
|
|
414
|
-
total:
|
|
415
|
-
page:
|
|
416
|
-
per_page:
|
|
417
|
-
total_pages:
|
|
418
|
-
});
|
|
419
|
-
var LinkJobSchema =
|
|
420
|
-
id: z8.string().uuid(),
|
|
421
|
-
workspace_id: z8.string().uuid(),
|
|
422
|
-
type: z8.string(),
|
|
423
|
-
status: z8.enum(["pending", "processing", "completed", "failed"]),
|
|
424
|
-
total_rows: z8.number().int(),
|
|
425
|
-
succeeded_count: z8.number().int(),
|
|
426
|
-
failed_count: z8.number().int(),
|
|
427
|
-
error: z8.string().nullable(),
|
|
428
|
-
created_by_id: z8.string().uuid(),
|
|
429
|
-
created_at: z8.date(),
|
|
430
|
-
completed_at: z8.date().nullable()
|
|
431
|
-
});
|
|
432
|
-
var LinkJobIdParamSchema = z8.object({
|
|
433
|
-
workspace_id: z8.string().uuid(),
|
|
434
|
-
job_id: z8.string().uuid()
|
|
435
|
-
});
|
|
436
|
-
|
|
437
|
-
// src/users.schema.ts
|
|
438
|
-
import { z as z9 } from "zod";
|
|
439
|
-
var UserSchema = z9.object({
|
|
459
|
+
var PaginatedLinksSchema = z9.object({
|
|
460
|
+
links: z9.array(LinkSchema),
|
|
461
|
+
total: z9.number().int(),
|
|
462
|
+
page: z9.number().int(),
|
|
463
|
+
per_page: z9.number().int(),
|
|
464
|
+
total_pages: z9.number().int()
|
|
465
|
+
});
|
|
466
|
+
var LinkJobSchema = z9.object({
|
|
440
467
|
id: z9.string().uuid(),
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
last_name: z9.string().min(1).max(100).optional()
|
|
468
|
+
workspace_id: z9.string().uuid(),
|
|
469
|
+
type: z9.string(),
|
|
470
|
+
status: z9.enum(["pending", "processing", "completed", "failed"]),
|
|
471
|
+
total_rows: z9.number().int(),
|
|
472
|
+
succeeded_count: z9.number().int(),
|
|
473
|
+
failed_count: z9.number().int(),
|
|
474
|
+
error: z9.string().nullable(),
|
|
475
|
+
created_by_id: z9.string().uuid(),
|
|
476
|
+
created_at: z9.date(),
|
|
477
|
+
completed_at: z9.date().nullable()
|
|
478
|
+
});
|
|
479
|
+
var LinkJobIdParamSchema = z9.object({
|
|
480
|
+
workspace_id: z9.string().uuid(),
|
|
481
|
+
job_id: z9.string().uuid()
|
|
456
482
|
});
|
|
457
483
|
|
|
458
|
-
// src/
|
|
484
|
+
// src/users.schema.ts
|
|
459
485
|
import { z as z10 } from "zod";
|
|
460
|
-
var
|
|
486
|
+
var UserSchema = z10.object({
|
|
461
487
|
id: z10.string().uuid(),
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
billing_cancel_at_period_end: z10.boolean(),
|
|
488
|
+
external_id: z10.string(),
|
|
489
|
+
email: z10.string().email(),
|
|
490
|
+
email_verified_at: z10.coerce.date().nullable(),
|
|
491
|
+
first_name: z10.string().nullable(),
|
|
492
|
+
last_name: z10.string().nullable(),
|
|
468
493
|
created_at: z10.coerce.date(),
|
|
469
494
|
updated_at: z10.coerce.date().nullable()
|
|
470
495
|
});
|
|
471
|
-
var
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
var CreateWorkspaceInputSchema = z10.object({
|
|
475
|
-
name: z10.string().min(1).max(100)
|
|
476
|
-
});
|
|
477
|
-
var UpdateWorkspaceInputSchema = z10.object({
|
|
478
|
-
name: z10.string().min(1).max(100).optional(),
|
|
479
|
-
billing_email: z10.string().email().nullish()
|
|
496
|
+
var SignInInputSchema = z10.object({
|
|
497
|
+
first_name: z10.string().min(1).max(100).optional(),
|
|
498
|
+
last_name: z10.string().min(1).max(100).optional()
|
|
480
499
|
});
|
|
481
|
-
var
|
|
482
|
-
|
|
500
|
+
var UpdateUserInputSchema = z10.object({
|
|
501
|
+
first_name: z10.string().min(1).max(100).optional(),
|
|
502
|
+
last_name: z10.string().min(1).max(100).optional()
|
|
483
503
|
});
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
504
|
+
|
|
505
|
+
// src/workspaces.schema.ts
|
|
506
|
+
import { z as z11 } from "zod";
|
|
507
|
+
var WorkspaceSchema = z11.object({
|
|
508
|
+
id: z11.string().uuid(),
|
|
509
|
+
name: z11.string(),
|
|
510
|
+
billing_plan: z11.string(),
|
|
511
|
+
billing_status: z11.string(),
|
|
512
|
+
billing_email: z11.string().nullable(),
|
|
513
|
+
billing_current_period_end: z11.coerce.date().nullable(),
|
|
514
|
+
billing_cancel_at_period_end: z11.boolean(),
|
|
515
|
+
created_at: z11.coerce.date(),
|
|
516
|
+
updated_at: z11.coerce.date().nullable()
|
|
489
517
|
});
|
|
490
|
-
var
|
|
491
|
-
|
|
492
|
-
workspace_id: z10.string().uuid(),
|
|
493
|
-
user_id: z10.string().uuid(),
|
|
494
|
-
user: WorkspaceMemberUserSchema,
|
|
495
|
-
permissions: z10.number().int(),
|
|
496
|
-
joined_at: z10.coerce.date(),
|
|
497
|
-
created_at: z10.coerce.date(),
|
|
498
|
-
updated_at: z10.coerce.date().nullable()
|
|
518
|
+
var WorkspaceWithCountSchema = WorkspaceSchema.extend({
|
|
519
|
+
member_count: z11.number().int()
|
|
499
520
|
});
|
|
500
|
-
var
|
|
501
|
-
|
|
521
|
+
var CreateWorkspaceInputSchema = z11.object({
|
|
522
|
+
name: z11.string().min(1).max(100)
|
|
502
523
|
});
|
|
503
|
-
var
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
email: z10.string().email(),
|
|
507
|
-
token: z10.string(),
|
|
508
|
-
permissions: z10.number().int(),
|
|
509
|
-
invited_by_id: z10.string().uuid(),
|
|
510
|
-
expires_at: z10.coerce.date(),
|
|
511
|
-
created_at: z10.coerce.date()
|
|
524
|
+
var UpdateWorkspaceInputSchema = z11.object({
|
|
525
|
+
name: z11.string().min(1).max(100).optional(),
|
|
526
|
+
billing_email: z11.string().email().nullish()
|
|
512
527
|
});
|
|
513
|
-
var
|
|
514
|
-
|
|
515
|
-
permissions: z10.number().int().min(1)
|
|
528
|
+
var TransferOwnershipInputSchema = z11.object({
|
|
529
|
+
to_user_id: z11.string().uuid()
|
|
516
530
|
});
|
|
517
|
-
var
|
|
518
|
-
|
|
531
|
+
var WorkspaceMemberUserSchema = z11.object({
|
|
532
|
+
id: z11.string().uuid(),
|
|
533
|
+
email: z11.string().email(),
|
|
534
|
+
first_name: z11.string().nullable(),
|
|
535
|
+
last_name: z11.string().nullable()
|
|
519
536
|
});
|
|
520
|
-
var
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
537
|
+
var WorkspaceMemberSchema = z11.object({
|
|
538
|
+
id: z11.string().uuid(),
|
|
539
|
+
workspace_id: z11.string().uuid(),
|
|
540
|
+
user_id: z11.string().uuid(),
|
|
541
|
+
user: WorkspaceMemberUserSchema,
|
|
542
|
+
permissions: z11.number().int(),
|
|
543
|
+
joined_at: z11.coerce.date(),
|
|
544
|
+
created_at: z11.coerce.date(),
|
|
545
|
+
updated_at: z11.coerce.date().nullable()
|
|
546
|
+
});
|
|
547
|
+
var UpdateMemberInputSchema = z11.object({
|
|
548
|
+
permissions: z11.number().int().min(1)
|
|
549
|
+
});
|
|
550
|
+
var WorkspaceInvitationSchema = z11.object({
|
|
551
|
+
id: z11.string().uuid(),
|
|
552
|
+
workspace_id: z11.string().uuid(),
|
|
553
|
+
email: z11.string().email(),
|
|
554
|
+
token: z11.string(),
|
|
555
|
+
permissions: z11.number().int(),
|
|
556
|
+
invited_by_id: z11.string().uuid(),
|
|
557
|
+
expires_at: z11.coerce.date(),
|
|
558
|
+
created_at: z11.coerce.date()
|
|
559
|
+
});
|
|
560
|
+
var CreateInvitationInputSchema = z11.object({
|
|
561
|
+
email: z11.string().email(),
|
|
562
|
+
permissions: z11.number().int().min(1)
|
|
563
|
+
});
|
|
564
|
+
var WorkspaceStatsSchema = z11.object({
|
|
565
|
+
links_count: z11.number().int()
|
|
566
|
+
});
|
|
567
|
+
var WorkspaceRoleSchema = z11.object({
|
|
568
|
+
name: z11.string(),
|
|
569
|
+
description: z11.string(),
|
|
570
|
+
permissions: z11.number().int()
|
|
524
571
|
});
|
|
525
572
|
|
|
526
573
|
// src/index.ts
|
|
@@ -529,70 +576,77 @@ var analyticsContract = {
|
|
|
529
576
|
link: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/links/{link_id}/analytics" }).input(LinkIdParamSchema.merge(AnalyticsQuerySchema)).output(AnalyticsOutputSchema)
|
|
530
577
|
};
|
|
531
578
|
var usersContract = {
|
|
532
|
-
me: oc.route({ method: "GET", path: "/api/users/me" }).output(
|
|
533
|
-
signIn: oc.route({ method: "POST", path: "/api/users" }).input(SignInInputSchema).output(
|
|
534
|
-
update: oc.route({ method: "PATCH", path: "/api/users/me" }).input(UpdateUserInputSchema).output(
|
|
579
|
+
me: oc.route({ method: "GET", path: "/api/users/me" }).output(z12.object({ user: UserSchema })),
|
|
580
|
+
signIn: oc.route({ method: "POST", path: "/api/users" }).input(SignInInputSchema).output(z12.object({ user: UserSchema, status: z12.enum(["created", "existing"]) })),
|
|
581
|
+
update: oc.route({ method: "PATCH", path: "/api/users/me" }).input(UpdateUserInputSchema).output(z12.object({ user: UserSchema }))
|
|
535
582
|
};
|
|
536
583
|
var apiKeysContract = {
|
|
537
584
|
create: oc.route({ method: "POST", path: "/api/api-keys" }).input(CreateApiKeyInputSchema).output(CreateApiKeyResponseSchema),
|
|
538
|
-
list: oc.route({ method: "GET", path: "/api/api-keys" }).output(
|
|
539
|
-
delete: oc.route({ method: "DELETE", path: "/api/api-keys/{api_key_id}" }).input(ApiKeyIdParamSchema).output(
|
|
585
|
+
list: oc.route({ method: "GET", path: "/api/api-keys" }).output(z12.array(ApiKeySchema)),
|
|
586
|
+
delete: oc.route({ method: "DELETE", path: "/api/api-keys/{api_key_id}" }).input(ApiKeyIdParamSchema).output(z12.void())
|
|
540
587
|
};
|
|
541
588
|
var workspaceApiKeysContract = {
|
|
542
589
|
create: oc.route({ method: "POST", path: "/api/workspaces/{workspace_id}/api-keys" }).input(WorkspaceIdParamSchema.merge(CreateWorkspaceApiKeyInputSchema)).output(CreateWorkspaceApiKeyResponseSchema),
|
|
543
|
-
list: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/api-keys" }).input(WorkspaceIdParamSchema).output(
|
|
544
|
-
delete: oc.route({ method: "DELETE", path: "/api/workspaces/{workspace_id}/api-keys/{api_key_id}" }).input(WorkspaceApiKeyIdParamSchema).output(
|
|
590
|
+
list: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/api-keys" }).input(WorkspaceIdParamSchema).output(z12.array(ApiKeySchema)),
|
|
591
|
+
delete: oc.route({ method: "DELETE", path: "/api/workspaces/{workspace_id}/api-keys/{api_key_id}" }).input(WorkspaceApiKeyIdParamSchema).output(z12.void())
|
|
545
592
|
};
|
|
546
593
|
var workspacesContract = {
|
|
547
594
|
create: oc.route({ method: "POST", path: "/api/workspaces" }).input(CreateWorkspaceInputSchema).output(WorkspaceSchema),
|
|
548
|
-
list: oc.route({ method: "GET", path: "/api/workspaces" }).output(
|
|
595
|
+
list: oc.route({ method: "GET", path: "/api/workspaces" }).output(z12.array(WorkspaceWithCountSchema)),
|
|
549
596
|
get: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}" }).input(WorkspaceIdParamSchema).output(WorkspaceWithCountSchema),
|
|
550
597
|
update: oc.route({ method: "PATCH", path: "/api/workspaces/{workspace_id}" }).input(WorkspaceIdParamSchema.merge(UpdateWorkspaceInputSchema)).output(WorkspaceSchema),
|
|
551
|
-
delete: oc.route({ method: "DELETE", path: "/api/workspaces/{workspace_id}" }).input(WorkspaceIdParamSchema).output(
|
|
552
|
-
transfer: oc.route({ method: "POST", path: "/api/workspaces/{workspace_id}/transfer" }).input(WorkspaceIdParamSchema.merge(TransferOwnershipInputSchema)).output(
|
|
598
|
+
delete: oc.route({ method: "DELETE", path: "/api/workspaces/{workspace_id}" }).input(WorkspaceIdParamSchema).output(z12.void()),
|
|
599
|
+
transfer: oc.route({ method: "POST", path: "/api/workspaces/{workspace_id}/transfer" }).input(WorkspaceIdParamSchema.merge(TransferOwnershipInputSchema)).output(z12.void()),
|
|
553
600
|
stats: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/stats" }).input(WorkspaceIdParamSchema).output(WorkspaceStatsSchema),
|
|
554
601
|
// Roles
|
|
555
|
-
listRoles: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/roles" }).input(WorkspaceIdParamSchema).output(
|
|
602
|
+
listRoles: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/roles" }).input(WorkspaceIdParamSchema).output(z12.array(WorkspaceRoleSchema)),
|
|
556
603
|
// Members
|
|
557
|
-
listMembers: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/members" }).input(WorkspaceIdParamSchema).output(
|
|
604
|
+
listMembers: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/members" }).input(WorkspaceIdParamSchema).output(z12.array(WorkspaceMemberSchema)),
|
|
558
605
|
updateMember: oc.route({ method: "PATCH", path: "/api/workspaces/{workspace_id}/members/{user_id}" }).input(MemberIdParamSchema.merge(UpdateMemberInputSchema)).output(WorkspaceMemberSchema),
|
|
559
|
-
removeMember: oc.route({ method: "DELETE", path: "/api/workspaces/{workspace_id}/members/{user_id}" }).input(MemberIdParamSchema).output(
|
|
606
|
+
removeMember: oc.route({ method: "DELETE", path: "/api/workspaces/{workspace_id}/members/{user_id}" }).input(MemberIdParamSchema).output(z12.void()),
|
|
560
607
|
// Invitations
|
|
561
|
-
listInvitations: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/invitations" }).input(WorkspaceIdParamSchema).output(
|
|
608
|
+
listInvitations: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/invitations" }).input(WorkspaceIdParamSchema).output(z12.array(WorkspaceInvitationSchema)),
|
|
562
609
|
createInvitation: oc.route({ method: "POST", path: "/api/workspaces/{workspace_id}/invitations" }).input(WorkspaceIdParamSchema.merge(CreateInvitationInputSchema)).output(WorkspaceInvitationSchema),
|
|
563
|
-
revokeInvitation: oc.route({ method: "DELETE", path: "/api/workspaces/{workspace_id}/invitations/{invitation_id}" }).input(InvitationIdParamSchema).output(
|
|
610
|
+
revokeInvitation: oc.route({ method: "DELETE", path: "/api/workspaces/{workspace_id}/invitations/{invitation_id}" }).input(InvitationIdParamSchema).output(z12.void())
|
|
564
611
|
};
|
|
565
612
|
var invitationsContract = {
|
|
566
613
|
get: oc.route({ method: "GET", path: "/api/invitations/{token}" }).input(TokenParamSchema).output(WorkspaceInvitationSchema),
|
|
567
614
|
accept: oc.route({ method: "POST", path: "/api/invitations/{token}/accept" }).input(TokenParamSchema).output(WorkspaceMemberSchema)
|
|
568
615
|
};
|
|
616
|
+
var linkTemplatesContract = {
|
|
617
|
+
create: oc.route({ method: "POST", path: "/api/workspaces/{workspace_id}/link-templates" }).input(WorkspaceIdParamSchema.merge(CreateLinkTemplateInputSchema)).output(LinkTemplateSchema),
|
|
618
|
+
list: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/link-templates" }).input(WorkspaceIdParamSchema.merge(LinkTemplateFiltersSchema)).output(PaginatedLinkTemplatesSchema),
|
|
619
|
+
get: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/link-templates/{link_template_id}" }).input(LinkTemplateIdParamSchema).output(LinkTemplateSchema),
|
|
620
|
+
update: oc.route({ method: "PATCH", path: "/api/workspaces/{workspace_id}/link-templates/{link_template_id}" }).input(LinkTemplateIdParamSchema.merge(UpdateLinkTemplateInputSchema)).output(LinkTemplateSchema),
|
|
621
|
+
delete: oc.route({ method: "DELETE", path: "/api/workspaces/{workspace_id}/link-templates/{link_template_id}" }).input(LinkTemplateIdParamSchema).output(z12.void())
|
|
622
|
+
};
|
|
569
623
|
var linksContract = {
|
|
570
624
|
create: oc.route({ method: "POST", path: "/api/workspaces/{workspace_id}/links" }).input(WorkspaceIdParamSchema.merge(CreateLinkInputSchema)).output(LinkSchema),
|
|
571
625
|
list: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/links" }).input(WorkspaceIdParamSchema.merge(LinkFiltersSchema)).output(PaginatedLinksSchema),
|
|
572
|
-
exportCsv: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/links/export" }).input(WorkspaceIdParamSchema.merge(ExportLinksFiltersSchema)).output(
|
|
626
|
+
exportCsv: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/links/export" }).input(WorkspaceIdParamSchema.merge(ExportLinksFiltersSchema)).output(z12.instanceof(File)),
|
|
573
627
|
get: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/links/{link_id}" }).input(LinkIdParamSchema).output(LinkSchema),
|
|
574
628
|
update: oc.route({ method: "PATCH", path: "/api/workspaces/{workspace_id}/links/{link_id}" }).input(LinkIdParamSchema.merge(UpdateLinkInputSchema)).output(LinkSchema),
|
|
575
|
-
delete: oc.route({ method: "DELETE", path: "/api/workspaces/{workspace_id}/links/{link_id}" }).input(LinkIdParamSchema).output(
|
|
576
|
-
edgeSync: oc.route({ method: "POST", path: "/api/workspaces/{workspace_id}/links/{link_id}/edge/sync" }).input(LinkIdParamSchema).output(
|
|
577
|
-
edgeStatus: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/links/{link_id}/edge/status" }).input(LinkIdParamSchema).output(
|
|
578
|
-
uploadLogo: oc.route({ method: "POST", path: "/api/workspaces/{workspace_id}/links/{link_id}/logo" }).input(LinkIdParamSchema.merge(
|
|
629
|
+
delete: oc.route({ method: "DELETE", path: "/api/workspaces/{workspace_id}/links/{link_id}" }).input(LinkIdParamSchema).output(z12.void()),
|
|
630
|
+
edgeSync: oc.route({ method: "POST", path: "/api/workspaces/{workspace_id}/links/{link_id}/edge/sync" }).input(LinkIdParamSchema).output(z12.void()),
|
|
631
|
+
edgeStatus: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/links/{link_id}/edge/status" }).input(LinkIdParamSchema).output(z12.object({ synced: z12.boolean() })),
|
|
632
|
+
uploadLogo: oc.route({ method: "POST", path: "/api/workspaces/{workspace_id}/links/{link_id}/logo" }).input(LinkIdParamSchema.merge(z12.object({ file: z12.file().mime(["image/png", "image/jpeg", "image/svg+xml", "image/webp"]) }))).output(LinkSchema),
|
|
579
633
|
deleteLogo: oc.route({ method: "DELETE", path: "/api/workspaces/{workspace_id}/links/{link_id}/logo" }).input(LinkIdParamSchema).output(LinkSchema),
|
|
580
634
|
getJob: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/jobs/{job_id}" }).input(LinkJobIdParamSchema).output(LinkJobSchema),
|
|
581
|
-
jobResults: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/jobs/{job_id}/results" }).input(LinkJobIdParamSchema).output(
|
|
635
|
+
jobResults: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/jobs/{job_id}/results" }).input(LinkJobIdParamSchema).output(z12.object({ url: z12.string() }))
|
|
582
636
|
};
|
|
583
637
|
var tagsContract = {
|
|
584
638
|
create: oc.route({ method: "POST", path: "/api/workspaces/{workspace_id}/tags" }).input(WorkspaceIdParamSchema.merge(CreateTagInputSchema)).output(TagSchema),
|
|
585
|
-
list: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/tags" }).input(WorkspaceIdParamSchema).output(
|
|
639
|
+
list: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/tags" }).input(WorkspaceIdParamSchema).output(z12.array(TagSchema)),
|
|
586
640
|
get: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/tags/{tag_id}" }).input(TagIdParamSchema).output(TagSchema),
|
|
587
641
|
update: oc.route({ method: "PATCH", path: "/api/workspaces/{workspace_id}/tags/{tag_id}" }).input(TagIdParamSchema.merge(UpdateTagInputSchema)).output(TagSchema),
|
|
588
|
-
delete: oc.route({ method: "DELETE", path: "/api/workspaces/{workspace_id}/tags/{tag_id}" }).input(TagIdParamSchema).output(
|
|
642
|
+
delete: oc.route({ method: "DELETE", path: "/api/workspaces/{workspace_id}/tags/{tag_id}" }).input(TagIdParamSchema).output(z12.void())
|
|
589
643
|
};
|
|
590
644
|
var domainsContract = {
|
|
591
645
|
create: oc.route({ method: "POST", path: "/api/workspaces/{workspace_id}/domains" }).input(WorkspaceIdParamSchema.merge(CreateDomainInputSchema)).output(DomainSchema),
|
|
592
|
-
list: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/domains" }).input(WorkspaceIdParamSchema).output(
|
|
646
|
+
list: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/domains" }).input(WorkspaceIdParamSchema).output(z12.array(DomainSchema)),
|
|
593
647
|
get: oc.route({ method: "GET", path: "/api/workspaces/{workspace_id}/domains/{domain_id}" }).input(DomainIdParamSchema).output(DomainSchema),
|
|
594
648
|
update: oc.route({ method: "PATCH", path: "/api/workspaces/{workspace_id}/domains/{domain_id}" }).input(DomainIdParamSchema.merge(UpdateDomainInputSchema)).output(DomainSchema),
|
|
595
|
-
delete: oc.route({ method: "DELETE", path: "/api/workspaces/{workspace_id}/domains/{domain_id}" }).input(DomainIdParamSchema).output(
|
|
649
|
+
delete: oc.route({ method: "DELETE", path: "/api/workspaces/{workspace_id}/domains/{domain_id}" }).input(DomainIdParamSchema).output(z12.void()),
|
|
596
650
|
verify: oc.route({ method: "POST", path: "/api/workspaces/{workspace_id}/domains/{domain_id}/verify" }).input(DomainIdParamSchema).output(DomainSchema)
|
|
597
651
|
};
|
|
598
652
|
var billingContract = {
|
|
@@ -608,6 +662,7 @@ var contract = {
|
|
|
608
662
|
workspaceApiKeys: workspaceApiKeysContract,
|
|
609
663
|
workspaces: workspacesContract,
|
|
610
664
|
invitations: invitationsContract,
|
|
665
|
+
linkTemplates: linkTemplatesContract,
|
|
611
666
|
links: linksContract,
|
|
612
667
|
tags: tagsContract,
|
|
613
668
|
domains: domainsContract,
|
|
@@ -628,6 +683,7 @@ export {
|
|
|
628
683
|
CreateDomainInputSchema,
|
|
629
684
|
CreateInvitationInputSchema,
|
|
630
685
|
CreateLinkInputSchema,
|
|
686
|
+
CreateLinkTemplateInputSchema,
|
|
631
687
|
CreateTagInputSchema,
|
|
632
688
|
CreateWorkspaceApiKeyInputSchema,
|
|
633
689
|
CreateWorkspaceApiKeyResponseSchema,
|
|
@@ -643,7 +699,11 @@ export {
|
|
|
643
699
|
LinkJobIdParamSchema,
|
|
644
700
|
LinkJobSchema,
|
|
645
701
|
LinkSchema,
|
|
702
|
+
LinkTemplateFiltersSchema,
|
|
703
|
+
LinkTemplateIdParamSchema,
|
|
704
|
+
LinkTemplateSchema,
|
|
646
705
|
MemberIdParamSchema,
|
|
706
|
+
PaginatedLinkTemplatesSchema,
|
|
647
707
|
PaginatedLinksSchema,
|
|
648
708
|
PlanSchema,
|
|
649
709
|
PlansOutputSchema,
|
|
@@ -658,6 +718,7 @@ export {
|
|
|
658
718
|
TransferOwnershipInputSchema,
|
|
659
719
|
UpdateDomainInputSchema,
|
|
660
720
|
UpdateLinkInputSchema,
|
|
721
|
+
UpdateLinkTemplateInputSchema,
|
|
661
722
|
UpdateMemberInputSchema,
|
|
662
723
|
UpdateTagInputSchema,
|
|
663
724
|
UpdateUserInputSchema,
|
|
@@ -679,6 +740,7 @@ export {
|
|
|
679
740
|
contract,
|
|
680
741
|
domainsContract,
|
|
681
742
|
invitationsContract,
|
|
743
|
+
linkTemplatesContract,
|
|
682
744
|
linksContract,
|
|
683
745
|
tagsContract,
|
|
684
746
|
usersContract,
|