@oxygen-agent/cli 1.263.0 → 1.274.15

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.
@@ -55,9 +55,16 @@ export function buildImportObjectKey(input) {
55
55
  const safeName = sanitizeFileName(input.fileName) || "import";
56
56
  return `imports/${input.organizationId}/${randomUUID()}/${safeName}`;
57
57
  }
58
+ export function buildPublishingMediaObjectKey(input) {
59
+ const safeName = sanitizeFileName(input.fileName) || "media";
60
+ return `publishing-media/${input.organizationId}/${randomUUID()}/${safeName}`;
61
+ }
58
62
  export function isImportObjectKeyForOrganization(key, organizationId) {
59
63
  return key.startsWith(`imports/${organizationId}/`);
60
64
  }
65
+ export function isPublishingMediaObjectKeyForOrganization(key, organizationId) {
66
+ return key.startsWith(`publishing-media/${organizationId}/`);
67
+ }
61
68
  export async function presignImportUpload(input) {
62
69
  const { client, config } = resolveClient();
63
70
  const storageKey = buildImportObjectKey({
@@ -80,6 +87,28 @@ export async function presignImportUpload(input) {
80
87
  expiresInSeconds: PRESIGN_EXPIRY_SECONDS,
81
88
  };
82
89
  }
90
+ export async function presignPublishingMediaUpload(input) {
91
+ const { client, config } = resolveClient();
92
+ const storageKey = buildPublishingMediaObjectKey({
93
+ organizationId: input.organizationId,
94
+ fileName: input.fileName ?? null,
95
+ });
96
+ const command = new PutObjectCommand({
97
+ Bucket: config.bucket,
98
+ Key: storageKey,
99
+ ContentLength: input.contentLength,
100
+ ...(input.contentType ? { ContentType: input.contentType } : {}),
101
+ });
102
+ const uploadUrl = await getSignedUrl(client, command, { expiresIn: PRESIGN_EXPIRY_SECONDS });
103
+ return {
104
+ uploadUrl,
105
+ bucket: config.bucket,
106
+ storageKey,
107
+ contentLength: input.contentLength,
108
+ provider: "s3",
109
+ expiresInSeconds: PRESIGN_EXPIRY_SECONDS,
110
+ };
111
+ }
83
112
  export async function getImportObjectMetadata(input) {
84
113
  const { client, config } = resolveClient();
85
114
  const result = await client.send(new HeadObjectCommand({ Bucket: config.bucket, Key: input.storageKey }));
@@ -87,6 +116,14 @@ export async function getImportObjectMetadata(input) {
87
116
  contentLength: typeof result.ContentLength === "number" ? result.ContentLength : null,
88
117
  };
89
118
  }
119
+ export async function getPublishingMediaObjectMetadata(input) {
120
+ const { client, config } = resolveClient();
121
+ const result = await client.send(new HeadObjectCommand({ Bucket: config.bucket, Key: input.storageKey }));
122
+ return {
123
+ contentLength: typeof result.ContentLength === "number" ? result.ContentLength : null,
124
+ contentType: typeof result.ContentType === "string" ? result.ContentType : null,
125
+ };
126
+ }
90
127
  export async function openImportObjectStream(input) {
91
128
  const { client, config } = resolveClient();
92
129
  const result = await client.send(new GetObjectCommand({ Bucket: config.bucket, Key: input.storageKey }));
@@ -99,6 +136,25 @@ export async function openImportObjectStream(input) {
99
136
  }
100
137
  return body;
101
138
  }
139
+ export async function openPublishingMediaObjectStream(input) {
140
+ const { client, config } = resolveClient();
141
+ const result = await client.send(new GetObjectCommand({ Bucket: config.bucket, Key: input.storageKey }));
142
+ const body = result.Body;
143
+ if (!body) {
144
+ throw new OxygenError("publishing_media_object_missing", "Publishing media object had no body.", {
145
+ details: { storage_key: input.storageKey },
146
+ exitCode: 1,
147
+ });
148
+ }
149
+ return body;
150
+ }
151
+ export async function presignPublishingMediaDownload(input) {
152
+ const { client, config } = resolveClient();
153
+ const command = new GetObjectCommand({ Bucket: config.bucket, Key: input.storageKey });
154
+ return await getSignedUrl(client, command, {
155
+ expiresIn: input.expiresInSeconds ?? 60 * 60,
156
+ });
157
+ }
102
158
  export async function deleteImportObject(input) {
103
159
  const { client, config } = resolveClient();
104
160
  await client.send(new DeleteObjectCommand({ Bucket: config.bucket, Key: input.storageKey }));
@@ -1,2 +1,2 @@
1
- export declare const OXYGEN_VERSION = "1.263.0";
1
+ export declare const OXYGEN_VERSION = "1.274.15";
2
2
  export declare const OXYGEN_MINIMUM_CLI_VERSION = "1.181.0";
@@ -1,4 +1,4 @@
1
- export const OXYGEN_VERSION = "1.263.0";
1
+ export const OXYGEN_VERSION = "1.274.15";
2
2
  // Bump this only when deployed CLI/API contracts require a newer CLI.
3
3
  // 1.181.0: paid table action runs and background columns run require
4
4
  // approved=true in addition to max_credits; older CLIs cannot send the flag.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxygen-agent/cli",
3
- "version": "1.263.0",
3
+ "version": "1.274.15",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",