@rolino/contracts 0.7.1 → 0.9.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,7 +1,7 @@
1
1
  // src/index.ts
2
2
  import { z } from "zod";
3
3
  var API_VERSION = "v1";
4
- var CONTRACT_VERSION = "0.18.0";
4
+ var CONTRACT_VERSION = "0.20.0";
5
5
  var RequestMetadataSchema = z.object({
6
6
  requestId: z.string().min(1)
7
7
  });
@@ -92,6 +92,8 @@ var CapabilityIdSchema = z.enum([
92
92
  "posts:write",
93
93
  "posts:schedule",
94
94
  "posts:publish",
95
+ "storage:read",
96
+ "media:delete",
95
97
  "integrations:read",
96
98
  "calendar:read",
97
99
  "seo:read",
@@ -792,22 +794,49 @@ var MediaAssetSchema = z.object({
792
794
  width: z.number().int().positive().nullable(),
793
795
  height: z.number().int().positive().nullable(),
794
796
  durationMs: z.number().int().nonnegative().nullable(),
795
- createdAt: z.string().datetime()
797
+ createdAt: z.string().datetime(),
798
+ usageCount: z.number().int().nonnegative().optional(),
799
+ deletable: z.boolean().optional(),
800
+ blockedReason: z.enum(["IN_USE"]).nullable().optional(),
801
+ projectId: z.string().min(1).optional(),
802
+ projectName: z.string().min(1).max(200).optional()
803
+ });
804
+ var ListedMediaAssetSchema = MediaAssetSchema.extend({
805
+ usageCount: z.number().int().nonnegative(),
806
+ deletable: z.boolean(),
807
+ blockedReason: z.enum(["IN_USE"]).nullable()
808
+ });
809
+ var WorkspaceListedMediaAssetSchema = ListedMediaAssetSchema.extend({
810
+ projectId: z.string().min(1),
811
+ projectName: z.string().min(1).max(200)
796
812
  });
813
+ var OptionalBooleanQuerySchema = z.union([
814
+ z.boolean(),
815
+ z.enum(["true", "false"]).transform((value) => value === "true")
816
+ ]);
797
817
  var MediaAssetListQuerySchema = z.object({
798
818
  limit: z.coerce.number().int().min(1).max(100).default(50),
799
- cursor: z.string().min(1).optional(),
819
+ cursor: z.string().min(1).max(2048).optional(),
800
820
  type: z.enum(["IMAGE", "VIDEO"]).optional(),
801
- query: z.string().trim().min(1).max(100).optional()
821
+ query: z.string().trim().min(1).max(100).optional(),
822
+ createdBefore: z.string().datetime({ offset: true }).optional(),
823
+ createdAfter: z.string().datetime({ offset: true }).optional(),
824
+ unusedOnly: OptionalBooleanQuerySchema.optional(),
825
+ order: z.enum(["OLDEST_FIRST", "NEWEST_FIRST"]).default("NEWEST_FIRST")
802
826
  });
827
+ var WorkspaceMediaAssetListQuerySchema = MediaAssetListQuerySchema;
803
828
  var MediaAssetListDataSchema = z.object({
804
- items: z.array(MediaAssetSchema),
829
+ items: z.array(ListedMediaAssetSchema),
805
830
  page: z.object({
806
831
  limit: z.number().int().min(1).max(100),
807
832
  nextCursor: z.string().min(1).nullable()
808
833
  })
809
834
  });
810
835
  var MediaAssetListResponseSchema = successEnvelopeSchema(MediaAssetListDataSchema);
836
+ var WorkspaceMediaAssetListDataSchema = MediaAssetListDataSchema.extend({
837
+ items: z.array(WorkspaceListedMediaAssetSchema)
838
+ });
839
+ var WorkspaceMediaAssetListResponseSchema = successEnvelopeSchema(WorkspaceMediaAssetListDataSchema);
811
840
  var MediaAssetUploadInputSchema = z.object({
812
841
  fileName: z.string().trim().min(1).max(255),
813
842
  contentType: z.string().trim().min(1).max(100),
@@ -828,6 +857,166 @@ var MediaAssetUploadCompleteInputSchema = MediaAssetUploadInputSchema.extend({
828
857
  durationMs: z.number().int().nonnegative().max(864e5).nullable().optional()
829
858
  }).strict();
830
859
  var MediaAssetResponseSchema = successEnvelopeSchema(MediaAssetSchema);
860
+ var StorageByteCountSchema = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
861
+ var StorageSourceBreakdownSchema = z.object({
862
+ mediaLibraryOriginalBytes: StorageByteCountSchema,
863
+ transformedSocialMediaBytes: StorageByteCountSchema,
864
+ blogImageBytes: StorageByteCountSchema,
865
+ detachedPendingDeletionBytes: StorageByteCountSchema
866
+ });
867
+ var StorageUsageSchema = z.object({
868
+ storedBytes: StorageByteCountSchema,
869
+ reservedUploadBytes: StorageByteCountSchema,
870
+ uploadCommittedBytes: StorageByteCountSchema,
871
+ limitBytes: StorageByteCountSchema.nullable(),
872
+ availableUploadBytes: StorageByteCountSchema.nullable(),
873
+ storedPercent: z.number().finite().nonnegative().nullable(),
874
+ uploadCommittedPercent: z.number().finite().nonnegative().nullable(),
875
+ unlimited: z.boolean(),
876
+ pendingDeletionBytes: StorageByteCountSchema,
877
+ sources: StorageSourceBreakdownSchema,
878
+ measuredAt: z.string().datetime()
879
+ });
880
+ var StorageUsageResponseSchema = successEnvelopeSchema(StorageUsageSchema);
881
+ var MediaCleanupScopeSchema = z.discriminatedUnion("type", [
882
+ z.object({ type: z.literal("PROJECT"), projectId: z.string().min(1).max(200) }).strict(),
883
+ z.object({ type: z.literal("WORKSPACE") }).strict()
884
+ ]);
885
+ var MediaCleanupAssetIdsSchema = z.array(z.string().min(1).max(200)).min(1).max(100).superRefine((ids, context) => {
886
+ if (new Set(ids).size !== ids.length) {
887
+ context.addIssue({ code: "custom", message: "Asset IDs must be unique." });
888
+ }
889
+ });
890
+ var MediaCleanupSelectionInputSchema = z.discriminatedUnion("mode", [
891
+ z.object({
892
+ mode: z.literal("ASSET_IDS"),
893
+ scope: MediaCleanupScopeSchema,
894
+ assetIds: MediaCleanupAssetIdsSchema
895
+ }).strict(),
896
+ z.object({
897
+ mode: z.literal("FILTER"),
898
+ scope: MediaCleanupScopeSchema,
899
+ createdBefore: z.string().datetime({ offset: true }).optional(),
900
+ olderThanDays: z.number().int().min(1).max(3650).optional(),
901
+ type: z.enum(["IMAGE", "VIDEO"]).optional(),
902
+ query: z.string().trim().min(1).max(100).optional()
903
+ }).strict().superRefine((selection, context) => {
904
+ if (Number(Boolean(selection.createdBefore)) + Number(selection.olderThanDays !== void 0) !== 1) {
905
+ context.addIssue({ code: "custom", message: "Choose exactly one upload-age filter." });
906
+ }
907
+ })
908
+ ]);
909
+ var NormalizedMediaCleanupSelectionSchema = z.discriminatedUnion("mode", [
910
+ z.object({
911
+ mode: z.literal("ASSET_IDS"),
912
+ scope: MediaCleanupScopeSchema,
913
+ assetIds: MediaCleanupAssetIdsSchema
914
+ }).strict(),
915
+ z.object({
916
+ mode: z.literal("FILTER"),
917
+ scope: MediaCleanupScopeSchema,
918
+ createdBefore: z.string().datetime({ offset: true }),
919
+ type: z.enum(["IMAGE", "VIDEO"]).optional(),
920
+ query: z.string().trim().min(1).max(100).optional()
921
+ }).strict()
922
+ ]);
923
+ var MediaCleanupPreviewRequestSchema = z.object({
924
+ selection: MediaCleanupSelectionInputSchema
925
+ }).strict();
926
+ var MediaCleanupCandidateSchema = z.object({
927
+ id: z.string().min(1),
928
+ fileName: z.string().min(1).max(255).nullable(),
929
+ projectId: z.string().min(1),
930
+ projectName: z.string().min(1).max(200),
931
+ type: z.enum(["IMAGE", "VIDEO"]),
932
+ createdAt: z.string().datetime(),
933
+ sizeBytes: StorageByteCountSchema.nullable()
934
+ });
935
+ var MediaCleanupPreviewSchema = z.object({
936
+ selection: NormalizedMediaCleanupSelectionSchema,
937
+ cutoffAt: z.string().datetime().nullable(),
938
+ candidateCount: z.number().int().min(0).max(500),
939
+ candidateIds: z.array(z.string().min(1)).max(500),
940
+ candidates: z.array(MediaCleanupCandidateSchema).max(500),
941
+ estimatedReclaimableBytes: StorageByteCountSchema,
942
+ excludedInUseCount: z.number().int().min(0).max(Number.MAX_SAFE_INTEGER),
943
+ excludedInUseBytes: StorageByteCountSchema,
944
+ unknownSizeCount: z.number().int().min(0).max(500),
945
+ hasMore: z.boolean(),
946
+ candidateDigest: z.string().regex(/^[a-f0-9]{64}$/),
947
+ confirmation: z.object({
948
+ token: z.string().min(1).max(500),
949
+ expiresAt: z.string().datetime()
950
+ })
951
+ });
952
+ var MediaCleanupPreviewResponseSchema = successEnvelopeSchema(MediaCleanupPreviewSchema);
953
+ var MediaCleanupExecuteRequestSchema = z.object({
954
+ selection: NormalizedMediaCleanupSelectionSchema,
955
+ candidateDigest: z.string().regex(/^[a-f0-9]{64}$/),
956
+ confirmationToken: z.string().min(1).max(500)
957
+ }).strict();
958
+ var MediaCleanupOperationStatusSchema = z.enum([
959
+ "QUEUED",
960
+ "RUNNING",
961
+ "COMPLETED",
962
+ "COMPLETED_WITH_SKIPS"
963
+ ]);
964
+ var MediaCleanupItemStatusSchema = z.enum([
965
+ "QUEUED",
966
+ "RETRYING",
967
+ "SKIPPED_IN_USE",
968
+ "SKIPPED_CHANGED",
969
+ "DELETED"
970
+ ]);
971
+ var MediaCleanupExecuteResultSchema = z.object({
972
+ cleanupId: z.string().min(1),
973
+ status: MediaCleanupOperationStatusSchema,
974
+ candidateCount: z.number().int().min(0).max(500),
975
+ queuedCount: z.number().int().min(0).max(500),
976
+ skippedCount: z.number().int().min(0).max(500),
977
+ estimatedReclaimableBytes: StorageByteCountSchema
978
+ });
979
+ var MediaCleanupExecuteResponseSchema = successEnvelopeSchema(MediaCleanupExecuteResultSchema);
980
+ var MediaCleanupStatusQuerySchema = z.object({
981
+ limit: z.coerce.number().int().min(1).max(100).default(50),
982
+ cursor: z.string().min(1).max(2048).optional()
983
+ });
984
+ var MediaCleanupItemResultSchema = z.object({
985
+ id: z.string().min(1),
986
+ assetId: z.string().min(1),
987
+ fileName: z.string().min(1).max(255).nullable(),
988
+ projectId: z.string().min(1),
989
+ projectName: z.string().min(1).max(200),
990
+ type: z.enum(["IMAGE", "VIDEO"]),
991
+ sizeBytes: StorageByteCountSchema.nullable(),
992
+ status: MediaCleanupItemStatusSchema,
993
+ queuedAt: z.string().datetime().nullable(),
994
+ retryingAt: z.string().datetime().nullable(),
995
+ skippedAt: z.string().datetime().nullable(),
996
+ deletedAt: z.string().datetime().nullable(),
997
+ failureSummary: z.string().min(1).max(500).nullable()
998
+ });
999
+ var MediaCleanupStatusSchema = z.object({
1000
+ cleanupId: z.string().min(1),
1001
+ status: MediaCleanupOperationStatusSchema,
1002
+ candidateCount: z.number().int().min(0).max(500),
1003
+ queuedCount: z.number().int().min(0).max(500),
1004
+ retryingCount: z.number().int().min(0).max(500),
1005
+ skippedCount: z.number().int().min(0).max(500),
1006
+ deletedCount: z.number().int().min(0).max(500),
1007
+ unknownSizeCount: z.number().int().min(0).max(500),
1008
+ estimatedReclaimableBytes: StorageByteCountSchema,
1009
+ actualReleasedBytes: StorageByteCountSchema,
1010
+ createdAt: z.string().datetime(),
1011
+ startedAt: z.string().datetime().nullable(),
1012
+ completedAt: z.string().datetime().nullable(),
1013
+ items: z.array(MediaCleanupItemResultSchema).max(100),
1014
+ page: z.object({
1015
+ limit: z.number().int().min(1).max(100),
1016
+ nextCursor: z.string().min(1).max(2048).nullable()
1017
+ })
1018
+ });
1019
+ var MediaCleanupStatusResponseSchema = successEnvelopeSchema(MediaCleanupStatusSchema);
831
1020
  var PublishingProviderSchema = z.enum([
832
1021
  "INSTAGRAM",
833
1022
  "TIKTOK",
@@ -859,6 +1048,9 @@ var PostDestinationSchema = z.object({
859
1048
  scheduledAt: z.string().datetime().nullable(),
860
1049
  publishedAt: z.string().datetime().nullable(),
861
1050
  remoteUrl: z.string().url().nullable(),
1051
+ remotePostId: z.string().nullable().optional(),
1052
+ remoteContainerId: z.string().nullable().optional(),
1053
+ studioUrl: z.string().url().nullable().optional(),
862
1054
  attemptCount: z.number().int().nonnegative()
863
1055
  });
864
1056
  var TikTokPostSettingsSchema = z.object({
@@ -1801,6 +1993,61 @@ var BacklinkContactSchema = z.object({
1801
1993
  var BacklinkContactListDataSchema = z.object({ items: z.array(BacklinkContactSchema).max(50), page: z.object({ limit: z.number().int().min(1).max(50), nextCursor: SeoCursorSchema.nullable() }).strict() }).strict();
1802
1994
  var BacklinkContactListQuerySchema = z.object({ limit: z.coerce.number().int().min(1).max(50).default(20), cursor: SeoCursorSchema.optional() }).strict();
1803
1995
  var BacklinkContactListResponseSchema = successEnvelopeSchema(BacklinkContactListDataSchema);
1996
+ var PostDeliveryCheckInputSchema = z.object({ provider: PublishingProviderSchema }).strict();
1997
+ var PostDeliveryCheckResultSchema = z.object({
1998
+ postId: z.string().min(1),
1999
+ provider: PublishingProviderSchema,
2000
+ kind: z.enum(["PUBLISHED", "SCHEDULED", "PROCESSING", "ACTION_REQUIRED", "UNKNOWN", "BUSY"]),
2001
+ message: z.string(),
2002
+ version: z.number().int().positive(),
2003
+ remotePostId: z.string().nullable(),
2004
+ remoteContainerId: z.string().nullable(),
2005
+ studioUrl: z.string().url().nullable()
2006
+ });
2007
+ var PostDeliveryCheckResponseSchema = successEnvelopeSchema(PostDeliveryCheckResultSchema);
2008
+ var PostRecoveryInputSchema = z.object({
2009
+ provider: z.literal("YOUTUBE"),
2010
+ action: z.enum(["ATTACH", "RESUME"]),
2011
+ videoId: z.string().regex(/^[\w-]{11}$/),
2012
+ publishAt: z.string().datetime({ offset: true }).nullable().optional()
2013
+ }).strict().superRefine((input, context) => {
2014
+ if (input.action === "RESUME" && input.publishAt === void 0) {
2015
+ context.addIssue({ code: "custom", path: ["publishAt"], message: "RESUME requires a future time or explicit null to publish now." });
2016
+ }
2017
+ if (input.action === "ATTACH" && input.publishAt !== void 0) {
2018
+ context.addIssue({ code: "custom", path: ["publishAt"], message: "Attachment cannot change publication time." });
2019
+ }
2020
+ });
2021
+ var PostRecoveryExecuteInputSchema = PostRecoveryInputSchema.safeExtend({
2022
+ confirmationToken: z.string().trim().min(1).max(200)
2023
+ });
2024
+ var PostRecoveryPreviewSchema = z.object({
2025
+ operation: z.literal("posts.recovery.execute"),
2026
+ projectId: z.string().min(1),
2027
+ postId: z.string().min(1),
2028
+ provider: z.literal("YOUTUBE"),
2029
+ action: z.enum(["ATTACH", "RESUME"]),
2030
+ videoId: z.string(),
2031
+ publishAt: z.string().datetime({ offset: true }).nullable().optional(),
2032
+ version: z.number().int().positive(),
2033
+ title: z.string(),
2034
+ description: z.string(),
2035
+ channel: z.string().nullable(),
2036
+ accountId: z.string(),
2037
+ privacy: z.string(),
2038
+ consequence: z.string(),
2039
+ confirmation: z.object({ token: z.string().min(1), expiresAt: z.string().datetime() })
2040
+ });
2041
+ var PostRecoveryPreviewResponseSchema = successEnvelopeSchema(PostRecoveryPreviewSchema);
2042
+ var PostRecoveryResultSchema = z.object({
2043
+ postId: z.string().min(1),
2044
+ provider: z.literal("YOUTUBE"),
2045
+ action: z.enum(["ATTACH", "RESUME"]),
2046
+ videoId: z.string(),
2047
+ kind: z.enum(["ATTACHED", "QUEUED", "PUBLISHED"]),
2048
+ version: z.number().int().positive()
2049
+ });
2050
+ var PostRecoveryResponseSchema = successEnvelopeSchema(PostRecoveryResultSchema);
1804
2051
  export {
1805
2052
  AGENT_CAPABILITIES,
1806
2053
  API_VERSION,
@@ -1964,6 +2211,7 @@ export {
1964
2211
  IntegrationHealthListResponseSchema,
1965
2212
  IntegrationHealthSchema,
1966
2213
  LinkedInDeliveryOptionsSchema,
2214
+ ListedMediaAssetSchema,
1967
2215
  MediaAssetListDataSchema,
1968
2216
  MediaAssetListQuerySchema,
1969
2217
  MediaAssetListResponseSchema,
@@ -1973,8 +2221,27 @@ export {
1973
2221
  MediaAssetUploadInputSchema,
1974
2222
  MediaAssetUploadPreparationResponseSchema,
1975
2223
  MediaAssetUploadPreparationSchema,
2224
+ MediaCleanupCandidateSchema,
2225
+ MediaCleanupExecuteRequestSchema,
2226
+ MediaCleanupExecuteResponseSchema,
2227
+ MediaCleanupExecuteResultSchema,
2228
+ MediaCleanupItemResultSchema,
2229
+ MediaCleanupItemStatusSchema,
2230
+ MediaCleanupOperationStatusSchema,
2231
+ MediaCleanupPreviewRequestSchema,
2232
+ MediaCleanupPreviewResponseSchema,
2233
+ MediaCleanupPreviewSchema,
2234
+ MediaCleanupScopeSchema,
2235
+ MediaCleanupSelectionInputSchema,
2236
+ MediaCleanupStatusQuerySchema,
2237
+ MediaCleanupStatusResponseSchema,
2238
+ MediaCleanupStatusSchema,
2239
+ NormalizedMediaCleanupSelectionSchema,
1976
2240
  PUBLISHING_PROVIDER_COUNT,
1977
2241
  PlatformPostStatusSchema,
2242
+ PostDeliveryCheckInputSchema,
2243
+ PostDeliveryCheckResponseSchema,
2244
+ PostDeliveryCheckResultSchema,
1978
2245
  PostDeliveryModeSchema,
1979
2246
  PostDestinationSchema,
1980
2247
  PostDestinationStageSchema,
@@ -1990,6 +2257,12 @@ export {
1990
2257
  PostReadinessCheckSchema,
1991
2258
  PostReadinessResponseSchema,
1992
2259
  PostReadinessSchema,
2260
+ PostRecoveryExecuteInputSchema,
2261
+ PostRecoveryInputSchema,
2262
+ PostRecoveryPreviewResponseSchema,
2263
+ PostRecoveryPreviewSchema,
2264
+ PostRecoveryResponseSchema,
2265
+ PostRecoveryResultSchema,
1993
2266
  PostResponseSchema,
1994
2267
  PostScheduleExecuteInputSchema,
1995
2268
  PostScheduleExecuteResponseSchema,
@@ -2045,10 +2318,18 @@ export {
2045
2318
  SeoSearchIntentSchema,
2046
2319
  SeoTaskDecisionSchema,
2047
2320
  SeoTaskFormatSchema,
2321
+ StorageByteCountSchema,
2322
+ StorageSourceBreakdownSchema,
2323
+ StorageUsageResponseSchema,
2324
+ StorageUsageSchema,
2048
2325
  TikTokDeliveryOptionsSchema,
2049
2326
  TikTokDraftSettingsSchema,
2050
2327
  TikTokPostSettingsSchema,
2051
2328
  WhoAmIResponseSchema,
2329
+ WorkspaceListedMediaAssetSchema,
2330
+ WorkspaceMediaAssetListDataSchema,
2331
+ WorkspaceMediaAssetListQuerySchema,
2332
+ WorkspaceMediaAssetListResponseSchema,
2052
2333
  YouTubePostSettingsSchema,
2053
2334
  successEnvelopeSchema
2054
2335
  };