@rolino/contracts 0.7.1 → 0.8.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.19.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()
796
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)
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",
@@ -1964,6 +2153,7 @@ export {
1964
2153
  IntegrationHealthListResponseSchema,
1965
2154
  IntegrationHealthSchema,
1966
2155
  LinkedInDeliveryOptionsSchema,
2156
+ ListedMediaAssetSchema,
1967
2157
  MediaAssetListDataSchema,
1968
2158
  MediaAssetListQuerySchema,
1969
2159
  MediaAssetListResponseSchema,
@@ -1973,6 +2163,22 @@ export {
1973
2163
  MediaAssetUploadInputSchema,
1974
2164
  MediaAssetUploadPreparationResponseSchema,
1975
2165
  MediaAssetUploadPreparationSchema,
2166
+ MediaCleanupCandidateSchema,
2167
+ MediaCleanupExecuteRequestSchema,
2168
+ MediaCleanupExecuteResponseSchema,
2169
+ MediaCleanupExecuteResultSchema,
2170
+ MediaCleanupItemResultSchema,
2171
+ MediaCleanupItemStatusSchema,
2172
+ MediaCleanupOperationStatusSchema,
2173
+ MediaCleanupPreviewRequestSchema,
2174
+ MediaCleanupPreviewResponseSchema,
2175
+ MediaCleanupPreviewSchema,
2176
+ MediaCleanupScopeSchema,
2177
+ MediaCleanupSelectionInputSchema,
2178
+ MediaCleanupStatusQuerySchema,
2179
+ MediaCleanupStatusResponseSchema,
2180
+ MediaCleanupStatusSchema,
2181
+ NormalizedMediaCleanupSelectionSchema,
1976
2182
  PUBLISHING_PROVIDER_COUNT,
1977
2183
  PlatformPostStatusSchema,
1978
2184
  PostDeliveryModeSchema,
@@ -2045,10 +2251,18 @@ export {
2045
2251
  SeoSearchIntentSchema,
2046
2252
  SeoTaskDecisionSchema,
2047
2253
  SeoTaskFormatSchema,
2254
+ StorageByteCountSchema,
2255
+ StorageSourceBreakdownSchema,
2256
+ StorageUsageResponseSchema,
2257
+ StorageUsageSchema,
2048
2258
  TikTokDeliveryOptionsSchema,
2049
2259
  TikTokDraftSettingsSchema,
2050
2260
  TikTokPostSettingsSchema,
2051
2261
  WhoAmIResponseSchema,
2262
+ WorkspaceListedMediaAssetSchema,
2263
+ WorkspaceMediaAssetListDataSchema,
2264
+ WorkspaceMediaAssetListQuerySchema,
2265
+ WorkspaceMediaAssetListResponseSchema,
2052
2266
  YouTubePostSettingsSchema,
2053
2267
  successEnvelopeSchema
2054
2268
  };