@rolino/contracts 0.5.0 → 0.6.0

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/index.js CHANGED
@@ -1,13 +1,14 @@
1
1
  // src/index.ts
2
2
  import { z } from "zod";
3
3
  var API_VERSION = "v1";
4
- var CONTRACT_VERSION = "0.16.0";
4
+ var CONTRACT_VERSION = "0.17.0";
5
5
  var RequestMetadataSchema = z.object({
6
6
  requestId: z.string().min(1)
7
7
  });
8
8
  var ApiErrorCodeSchema = z.enum([
9
9
  "AUTH_REQUIRED",
10
10
  "FORBIDDEN",
11
+ "METHOD_NOT_ALLOWED",
11
12
  "NOT_FOUND",
12
13
  "FEATURE_DISABLED",
13
14
  "BILLING_REQUIRED",
@@ -26,6 +27,9 @@ var ApiProblemSchema = z.object({
26
27
  error: z.object({
27
28
  code: ApiErrorCodeSchema,
28
29
  message: z.string().min(1),
30
+ // Optional while clients can still communicate with older Rolino deployments.
31
+ // Current servers include this field on every API problem response.
32
+ resolution: z.string().min(1).optional(),
29
33
  details: z.record(z.string(), z.unknown()).optional()
30
34
  }),
31
35
  meta: RequestMetadataSchema
@@ -99,6 +103,7 @@ var CapabilityIdSchema = z.enum([
99
103
  ]);
100
104
  var AgentBlogPlanSchema = z.object({
101
105
  id: z.string().min(1),
106
+ version: z.number().int().positive(),
102
107
  state: z.string().min(1),
103
108
  windowStart: z.string().datetime(),
104
109
  windowEnd: z.string().datetime(),
@@ -295,7 +300,7 @@ var AgentBlogScheduleCancelExecuteSchema = AgentBlogScheduleCancelPreviewSchema.
295
300
  var AgentBlogPublishPreviewRequestSchema = z.object({ revisionId: z.string().min(1), destinationIds: AgentBlogDestinationSelectionSchema.optional() });
296
301
  var AgentBlogPublishExecuteRequestSchema = z.object({ revisionId: z.string().min(1), destinationIds: AgentBlogDestinationSelectionSchema.optional(), confirmationToken: z.string().min(1), idempotencyKey: z.string().trim().min(8).max(200) });
297
302
  var AgentBlogPublishingProviderSchema = z.object({ key: z.string(), name: z.string(), description: z.string(), mode: z.string(), rollout: z.enum(["PREVIEW", "VISIBLE"]), capabilities: z.array(z.string()), authorizationStrategy: z.string(), requiresResourceDiscovery: z.boolean(), requiresFieldMapping: z.boolean(), officialDocumentationUrl: z.string().url() }).strict();
298
- var AgentBlogPublishingDestinationSchema = z.object({ id: z.string(), name: z.string(), providerKey: z.string(), mode: z.string(), status: z.string(), isPrimary: z.boolean(), enabled: z.boolean(), externalSiteName: z.string().nullable(), externalSiteUrl: z.string().url().nullable(), lastTestedAt: z.string().datetime().nullable(), lastSucceededAt: z.string().datetime().nullable(), lastErrorCode: z.string().nullable() }).strict();
303
+ var AgentBlogPublishingDestinationSchema = z.object({ id: z.string(), name: z.string(), providerKey: z.string(), mode: z.string(), status: z.string(), isPrimary: z.boolean(), enabled: z.boolean(), capabilities: z.array(z.string()), externalSiteName: z.string().nullable(), externalSiteUrl: z.string().url().nullable(), lastTestedAt: z.string().datetime().nullable(), lastSucceededAt: z.string().datetime().nullable(), lastErrorCode: z.string().nullable() }).strict();
299
304
  var AgentBlogDeliveryAttemptSchema = z.object({ id: z.string(), articleId: z.string().nullable(), revisionId: z.string().nullable(), destinationId: z.string().nullable(), destinationName: z.string().nullable(), operation: z.string().nullable(), state: z.string(), attemptCount: z.number().int().nonnegative(), errorCode: z.string().nullable(), retryAt: z.string().datetime().nullable(), remoteUrl: z.string().url().nullable(), createdAt: z.string().datetime(), deliveredAt: z.string().datetime().nullable() }).strict();
300
305
  var AgentBlogPublishPreviewSchema = z.object({ articleId: z.string(), revisionId: z.string(), contentHash: z.string(), approvalBundleHash: z.string().regex(/^[a-f0-9]{64}$/), approvalSource: z.enum(["USER", "AGENT"]).nullable(), title: z.string(), slug: z.string(), publicUrl: z.string().url(), destinations: z.array(AgentBlogPublishingDestinationSchema), confirmation: z.object({ token: z.string(), expiresAt: z.string().datetime() }) });
301
306
  var AgentBlogReadinessSchema = z.enum([
@@ -345,6 +350,75 @@ var AgentBlogCadenceInputSchema = z.object({
345
350
  var AgentBlogIdempotentRequestSchema = z.object({
346
351
  idempotencyKey: z.string().trim().min(8).max(200)
347
352
  }).strict();
353
+ var AgentBlogPublicationWeekdaysSchema = z.array(z.number().int().min(0).max(6)).min(1).max(7).superRefine((weekdays, context) => {
354
+ if (new Set(weekdays).size !== weekdays.length) {
355
+ context.addIssue({ code: "custom", message: "Weekdays must be unique." });
356
+ }
357
+ });
358
+ var AgentBlogEditorialDateSchema = z.string().regex(/^\d{4}-\d{2}-\d{2}$/);
359
+ var AgentBlogPlanItemStateSchema = z.enum([
360
+ "PLANNED",
361
+ "ACCEPTED",
362
+ "DISMISSED",
363
+ "DRAFTING",
364
+ "IN_REVIEW",
365
+ "APPROVED",
366
+ "SCHEDULED",
367
+ "PUBLISHED",
368
+ "NEEDS_ATTENTION"
369
+ ]);
370
+ var AgentBlogScheduleDigestSchema = z.string().regex(/^[a-f0-9]{64}$/);
371
+ var AgentBlogPlanDateMoveSchema = z.object({
372
+ itemId: z.string().min(1),
373
+ title: z.string().min(1).max(200),
374
+ oldDate: AgentBlogEditorialDateSchema,
375
+ newDate: AgentBlogEditorialDateSchema,
376
+ state: AgentBlogPlanItemStateSchema,
377
+ version: z.number().int().positive()
378
+ }).strict();
379
+ var AgentBlogPlanLockedItemSchema = z.object({
380
+ itemId: z.string().min(1),
381
+ title: z.string().min(1).max(200),
382
+ date: AgentBlogEditorialDateSchema,
383
+ state: z.enum(["SCHEDULED", "PUBLISHED"]),
384
+ version: z.number().int().positive()
385
+ }).strict();
386
+ var AgentBlogPlanCadencePreviewRequestSchema = z.object({
387
+ weekdays: AgentBlogPublicationWeekdaysSchema,
388
+ expectedPlanVersion: z.number().int().positive()
389
+ }).strict();
390
+ var AgentBlogPlanCadencePreviewSchema = z.object({
391
+ planId: z.string().min(1),
392
+ planTitle: z.string().min(1).max(200),
393
+ planVersion: z.number().int().positive(),
394
+ scheduleDigest: AgentBlogScheduleDigestSchema,
395
+ kind: z.enum(["ready", "blocked", "noop"]),
396
+ canExecute: z.boolean(),
397
+ oldWeekdays: AgentBlogPublicationWeekdaysSchema,
398
+ newWeekdays: AgentBlogPublicationWeekdaysSchema,
399
+ moves: z.array(AgentBlogPlanDateMoveSchema).max(30),
400
+ lockedItems: z.array(AgentBlogPlanLockedItemSchema).max(30),
401
+ warnings: z.array(z.string().min(1).max(500)).max(30),
402
+ reason: z.string().min(1).max(500).nullable(),
403
+ confirmation: z.object({ token: z.string().min(1), expiresAt: z.string().datetime() }).strict().nullable()
404
+ }).strict();
405
+ var AgentBlogPlanCadenceExecuteRequestSchema = z.object({
406
+ weekdays: AgentBlogPublicationWeekdaysSchema,
407
+ expectedPlanVersion: z.number().int().positive(),
408
+ expectedScheduleDigest: AgentBlogScheduleDigestSchema,
409
+ confirmationToken: z.string().min(1),
410
+ idempotencyKey: z.string().trim().min(8).max(200)
411
+ }).strict();
412
+ var AgentBlogPlanCadenceExecuteSchema = z.object({
413
+ planId: z.string().min(1),
414
+ planVersion: z.number().int().positive(),
415
+ publicationWeekdays: AgentBlogPublicationWeekdaysSchema,
416
+ cadencePerWeek: z.number().int().min(1).max(7),
417
+ expectedItemCount: z.number().int().nonnegative().max(30),
418
+ moves: z.array(AgentBlogPlanDateMoveSchema).max(30),
419
+ lockedItems: z.array(AgentBlogPlanLockedItemSchema).max(30),
420
+ scheduleDigest: AgentBlogScheduleDigestSchema
421
+ }).strict();
348
422
  var AgentBlogPlanCreateRequestSchema = AgentBlogCadenceInputSchema.and(AgentBlogIdempotentRequestSchema);
349
423
  var AgentBlogPlanRetryRequestSchema = AgentBlogIdempotentRequestSchema;
350
424
  var AgentBlogPlanItemSchema = z.object({
@@ -428,6 +502,67 @@ var AgentBlogConnectionExecuteSchema = z.object({
428
502
  webhookSecret: z.string().min(1).optional(),
429
503
  message: z.string().min(1)
430
504
  }).strict();
505
+ var AgentBlogWebhookSemanticsSchema = z.enum(["DRAFT", "LIVE"]);
506
+ var AgentBlogWebhookDestinationChangeSchema = z.object({
507
+ destinationId: z.string().min(1).optional(),
508
+ siteId: z.string().min(1),
509
+ name: z.string().trim().min(1).max(160),
510
+ endpoint: z.string().url(),
511
+ semantics: AgentBlogWebhookSemanticsSchema
512
+ }).strict();
513
+ var AgentBlogWebhookDestinationPreviewRequestSchema = AgentBlogWebhookDestinationChangeSchema;
514
+ var AgentBlogWebhookDestinationExecuteRequestSchema = AgentBlogWebhookDestinationChangeSchema.extend({
515
+ confirmationToken: z.string().min(1).max(300),
516
+ idempotencyKey: z.string().trim().min(8).max(200)
517
+ }).strict();
518
+ var AgentBlogWebhookDestinationPreviewSchema = AgentBlogWebhookDestinationChangeSchema.extend({
519
+ destinationId: z.string().min(1).nullable(),
520
+ effect: z.string().min(1),
521
+ confirmation: z.object({ token: z.string().min(1), expiresAt: z.string().datetime() }).strict()
522
+ }).strict();
523
+ var AgentBlogWebhookDestinationExecuteSchema = z.object({
524
+ projectId: z.string().min(1),
525
+ siteId: z.string().min(1),
526
+ destinationId: z.string().min(1),
527
+ completed: z.literal(true),
528
+ secretDelivered: z.boolean(),
529
+ alreadyDelivered: z.boolean(),
530
+ webhookSecret: z.string().min(1).optional(),
531
+ message: z.string().min(1)
532
+ }).strict();
533
+ var AgentBlogWebhookTestRequestSchema = z.object({
534
+ siteId: z.string().min(1),
535
+ destinationId: z.string().min(1),
536
+ makePrimary: z.boolean().optional()
537
+ }).strict();
538
+ var AgentBlogWebhookTestSchema = z.object({
539
+ destinationId: z.string().min(1),
540
+ status: z.enum(["CONNECTED", "NEEDS_ATTENTION"]),
541
+ enabled: z.boolean(),
542
+ testedAt: z.string().datetime(),
543
+ errorCode: z.string().nullable()
544
+ }).strict();
545
+ var AgentBlogWebhookRotatePreviewRequestSchema = z.object({
546
+ siteId: z.string().min(1),
547
+ destinationId: z.string().min(1)
548
+ }).strict();
549
+ var AgentBlogWebhookRotateExecuteRequestSchema = AgentBlogWebhookRotatePreviewRequestSchema.extend({
550
+ confirmationToken: z.string().min(1).max(300),
551
+ idempotencyKey: z.string().trim().min(8).max(200)
552
+ }).strict();
553
+ var AgentBlogWebhookRotatePreviewSchema = AgentBlogWebhookRotatePreviewRequestSchema.extend({
554
+ destinationName: z.string().min(1),
555
+ effect: z.string().min(1),
556
+ confirmation: z.object({ token: z.string().min(1), expiresAt: z.string().datetime() }).strict()
557
+ }).strict();
558
+ var AgentBlogWebhookRotateExecuteSchema = z.object({
559
+ destinationId: z.string().min(1),
560
+ completed: z.literal(true),
561
+ secretDelivered: z.boolean(),
562
+ alreadyDelivered: z.boolean(),
563
+ webhookSecret: z.string().min(1).optional(),
564
+ message: z.string().min(1)
565
+ }).strict();
431
566
  var AgentBlogRevalidationTestRequestSchema = AgentBlogIdempotentRequestSchema;
432
567
  var AgentBlogRevalidationTestSchema = z.object({
433
568
  status: z.enum(["VERIFIED", "NEEDS_ATTENTION"]),
@@ -461,6 +596,8 @@ var AgentBlogDeliveryAttemptListResponseSchema = successEnvelopeSchema(z.object(
461
596
  var AgentBlogSetupStatusResponseSchema = successEnvelopeSchema(AgentBlogSetupStatusSchema);
462
597
  var AgentBlogPlanItemsResponseSchema = successEnvelopeSchema(z.object({ items: z.array(AgentBlogPlanItemSchema) }).strict());
463
598
  var AgentBlogPlanItemResponseSchema = successEnvelopeSchema(AgentBlogPlanItemSchema);
599
+ var AgentBlogPlanCadencePreviewResponseSchema = successEnvelopeSchema(AgentBlogPlanCadencePreviewSchema);
600
+ var AgentBlogPlanCadenceExecuteResponseSchema = successEnvelopeSchema(AgentBlogPlanCadenceExecuteSchema);
464
601
  var AgentBlogPlanQueuedResponseSchema = successEnvelopeSchema(z.object({
465
602
  planId: z.string().min(1),
466
603
  job: AgentBlogJobSchema
@@ -473,6 +610,11 @@ var AgentBlogConnectionStatusResponseSchema = successEnvelopeSchema(AgentBlogCon
473
610
  var AgentBlogConnectionPreviewResponseSchema = successEnvelopeSchema(AgentBlogConnectionPreviewSchema);
474
611
  var AgentBlogConnectionExecuteResponseSchema = successEnvelopeSchema(AgentBlogConnectionExecuteSchema);
475
612
  var AgentBlogRevalidationTestResponseSchema = successEnvelopeSchema(AgentBlogRevalidationTestSchema);
613
+ var AgentBlogWebhookDestinationPreviewResponseSchema = successEnvelopeSchema(AgentBlogWebhookDestinationPreviewSchema);
614
+ var AgentBlogWebhookDestinationExecuteResponseSchema = successEnvelopeSchema(AgentBlogWebhookDestinationExecuteSchema);
615
+ var AgentBlogWebhookTestResponseSchema = successEnvelopeSchema(AgentBlogWebhookTestSchema);
616
+ var AgentBlogWebhookRotatePreviewResponseSchema = successEnvelopeSchema(AgentBlogWebhookRotatePreviewSchema);
617
+ var AgentBlogWebhookRotateExecuteResponseSchema = successEnvelopeSchema(AgentBlogWebhookRotateExecuteSchema);
476
618
  var CapabilitySchema = z.object({
477
619
  id: CapabilityIdSchema,
478
620
  available: z.boolean(),
@@ -502,7 +644,7 @@ var ApiMetaSchema = z.object({
502
644
  capabilities: z.array(CapabilitySchema)
503
645
  });
504
646
  var ApiMetaResponseSchema = successEnvelopeSchema(ApiMetaSchema);
505
- var AuthenticationKindSchema = z.enum(["session", "api_key"]);
647
+ var AuthenticationKindSchema = z.enum(["session", "api_key", "oauth"]);
506
648
  var ActorSchema = z.object({
507
649
  user: z.object({
508
650
  id: z.string().min(1),
@@ -521,31 +663,6 @@ var ActorSchema = z.object({
521
663
  capabilities: z.array(CapabilityIdSchema)
522
664
  });
523
665
  var WhoAmIResponseSchema = successEnvelopeSchema(ActorSchema);
524
- var Base64UrlSecretSchema = z.string().min(43).max(128).regex(/^[A-Za-z0-9_-]+$/);
525
- var CLI_BROWSER_AUTHORIZATION_TIMEOUT_MS = 5 * 60 * 1e3;
526
- var CliAuthorizationExchangeRequestSchema = z.object({
527
- code: Base64UrlSecretSchema,
528
- codeVerifier: Base64UrlSecretSchema
529
- });
530
- var CliAuthorizationCredentialSchema = z.object({
531
- token: z.string().min(1),
532
- tokenType: z.literal("Bearer"),
533
- expiresAt: z.string().datetime(),
534
- organization: z.object({
535
- id: z.string().min(1),
536
- name: z.string().min(1)
537
- }),
538
- capabilities: z.array(CapabilityIdSchema)
539
- });
540
- var CliAuthorizationExchangeResponseSchema = successEnvelopeSchema(
541
- CliAuthorizationCredentialSchema
542
- );
543
- var CliAuthorizationRevokeDataSchema = z.object({
544
- revoked: z.literal(true)
545
- });
546
- var CliAuthorizationRevokeResponseSchema = successEnvelopeSchema(
547
- CliAuthorizationRevokeDataSchema
548
- );
549
666
  var CapabilitiesDataSchema = z.object({
550
667
  capabilities: z.array(CapabilitySchema)
551
668
  });
@@ -682,7 +799,8 @@ var PublishingProviderSchema = z.enum([
682
799
  "TIKTOK",
683
800
  "YOUTUBE",
684
801
  "BLUESKY",
685
- "LINKEDIN"
802
+ "LINKEDIN",
803
+ "GOOGLE_BUSINESS_PROFILE"
686
804
  ]);
687
805
  var PUBLISHING_PROVIDER_COUNT = PublishingProviderSchema.options.length;
688
806
  var PostDeliveryModeSchema = z.enum(["IMMEDIATE", "SCHEDULED"]);
@@ -882,7 +1000,8 @@ var DraftCaptionOverridesObjectSchema = z.object({
882
1000
  TIKTOK: z.string().max(2200).nullable().optional(),
883
1001
  YOUTUBE: YouTubeDescriptionSchema.nullable().optional(),
884
1002
  BLUESKY: BlueskyCaptionSchema.nullable().optional(),
885
- LINKEDIN: z.string().max(3e3).nullable().optional()
1003
+ LINKEDIN: z.string().max(3e3).nullable().optional(),
1004
+ GOOGLE_BUSINESS_PROFILE: z.string().max(1500).nullable().optional()
886
1005
  }).strict();
887
1006
  var DraftPlatformsSchema = z.array(PublishingProviderSchema).max(PUBLISHING_PROVIDER_COUNT).refine(
888
1007
  (providers) => new Set(providers).size === providers.length,
@@ -1602,12 +1721,20 @@ export {
1602
1721
  AgentBlogImageUploadPrepareRequestSchema,
1603
1722
  AgentBlogJobResponseSchema,
1604
1723
  AgentBlogJobSchema,
1724
+ AgentBlogPlanCadenceExecuteRequestSchema,
1725
+ AgentBlogPlanCadenceExecuteResponseSchema,
1726
+ AgentBlogPlanCadenceExecuteSchema,
1727
+ AgentBlogPlanCadencePreviewRequestSchema,
1728
+ AgentBlogPlanCadencePreviewResponseSchema,
1729
+ AgentBlogPlanCadencePreviewSchema,
1605
1730
  AgentBlogPlanCreateRequestSchema,
1731
+ AgentBlogPlanDateMoveSchema,
1606
1732
  AgentBlogPlanItemResponseSchema,
1607
1733
  AgentBlogPlanItemSchema,
1608
1734
  AgentBlogPlanItemStateRequestSchema,
1609
1735
  AgentBlogPlanItemsResponseSchema,
1610
1736
  AgentBlogPlanListResponseSchema,
1737
+ AgentBlogPlanLockedItemSchema,
1611
1738
  AgentBlogPlanQueuedResponseSchema,
1612
1739
  AgentBlogPlanRetryRequestSchema,
1613
1740
  AgentBlogPlanSchema,
@@ -1637,6 +1764,23 @@ export {
1637
1764
  AgentBlogSchedulePreviewSchema,
1638
1765
  AgentBlogSetupStatusResponseSchema,
1639
1766
  AgentBlogSetupStatusSchema,
1767
+ AgentBlogWebhookDestinationChangeSchema,
1768
+ AgentBlogWebhookDestinationExecuteRequestSchema,
1769
+ AgentBlogWebhookDestinationExecuteResponseSchema,
1770
+ AgentBlogWebhookDestinationExecuteSchema,
1771
+ AgentBlogWebhookDestinationPreviewRequestSchema,
1772
+ AgentBlogWebhookDestinationPreviewResponseSchema,
1773
+ AgentBlogWebhookDestinationPreviewSchema,
1774
+ AgentBlogWebhookRotateExecuteRequestSchema,
1775
+ AgentBlogWebhookRotateExecuteResponseSchema,
1776
+ AgentBlogWebhookRotateExecuteSchema,
1777
+ AgentBlogWebhookRotatePreviewRequestSchema,
1778
+ AgentBlogWebhookRotatePreviewResponseSchema,
1779
+ AgentBlogWebhookRotatePreviewSchema,
1780
+ AgentBlogWebhookSemanticsSchema,
1781
+ AgentBlogWebhookTestRequestSchema,
1782
+ AgentBlogWebhookTestResponseSchema,
1783
+ AgentBlogWebhookTestSchema,
1640
1784
  ApiErrorCodeSchema,
1641
1785
  ApiMetaResponseSchema,
1642
1786
  ApiMetaSchema,
@@ -1647,7 +1791,6 @@ export {
1647
1791
  BlogMetadataSchema,
1648
1792
  BlogSitemapEntrySchema,
1649
1793
  BlogSlugRedirectSchema,
1650
- CLI_BROWSER_AUTHORIZATION_TIMEOUT_MS,
1651
1794
  CONTRACT_VERSION,
1652
1795
  CalendarEventSchema,
1653
1796
  CalendarListDataSchema,
@@ -1657,11 +1800,6 @@ export {
1657
1800
  CapabilitiesResponseSchema,
1658
1801
  CapabilityIdSchema,
1659
1802
  CapabilitySchema,
1660
- CliAuthorizationCredentialSchema,
1661
- CliAuthorizationExchangeRequestSchema,
1662
- CliAuthorizationExchangeResponseSchema,
1663
- CliAuthorizationRevokeDataSchema,
1664
- CliAuthorizationRevokeResponseSchema,
1665
1803
  DraftPostInputSchema,
1666
1804
  DraftPostUpdateInputSchema,
1667
1805
  IntegrationConnectionStatusSchema,