@devultur/core 1.3.2 → 1.4.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.d.ts CHANGED
@@ -168,6 +168,18 @@ interface DevulturMedia<V extends Visibility = Visibility> {
168
168
  readonly width?: number;
169
169
  /** Intrinsic height (px). */
170
170
  readonly height?: number;
171
+ /** Display title, set by the app. */
172
+ readonly title?: string;
173
+ /** The image's alternative text, set by the app. `<Image>` uses it when no `alt` is passed. */
174
+ readonly alt?: string;
175
+ /** The app's own labels. */
176
+ readonly tags?: readonly string[];
177
+ /** Stored size in bytes. */
178
+ readonly sizeBytes?: number;
179
+ /** A video's duration, in seconds. */
180
+ readonly duration?: number;
181
+ /** A PDF's page count, as the uploading client reported it. */
182
+ readonly pageCount?: number;
171
183
  }
172
184
  /** Visibility default when not specified at any level: secure-by-default. */
173
185
  declare const DEFAULT_VISIBILITY: Visibility;
@@ -446,6 +458,9 @@ interface FileHead {
446
458
  sha256Verified: boolean;
447
459
  /** Expiration (epoch ms) if the file has a TTL. */
448
460
  expiresAt: number | null;
461
+ /** Intrinsic size (px) of an image the worker read when it was uploaded in a single PUT. */
462
+ width?: number;
463
+ height?: number;
449
464
  }
450
465
  interface DownloadLinkOptions {
451
466
  /** Link lifetime in seconds (default 900, max 7 days). */
@@ -1031,6 +1046,10 @@ declare const SHA256_HEADER = "x-devultur-sha256";
1031
1046
  declare const SHA256_VERIFIED_HEADER = "x-devultur-sha256-verified";
1032
1047
  /** File expiration (epoch ms) if it was uploaded with a TTL. */
1033
1048
  declare const EXPIRES_AT_HEADER = "x-devultur-expires-at";
1049
+ /** Intrinsic width (px) of an image, read by the worker from its header bytes when it was uploaded. */
1050
+ declare const IMAGE_WIDTH_HEADER = "x-devultur-image-width";
1051
+ /** Intrinsic height (px) of an image, read by the worker from its header bytes when it was uploaded. */
1052
+ declare const IMAGE_HEIGHT_HEADER = "x-devultur-image-height";
1034
1053
  /** RFC 9530: `sha-256=:<base64>:`. */
1035
1054
  declare const REPR_DIGEST_HEADER = "Repr-Digest";
1036
1055
  /** Normalizes a hex sha256 (lowercase). `null` if it isn't a 64-character hex sha256. */
@@ -1350,4 +1369,4 @@ declare function createHTTPWebhookHandler(options: {
1350
1369
  }>;
1351
1370
  };
1352
1371
 
1353
- export { AES_BLOCK_BYTES, ASSET_NAMESPACE, type AssetEntry, type AssetListing, type AssetUploadResult, type AssetsClient, BYTES_PER_UNIT, ByteUnit, CACHE_CONTROL_PRESETS, CacheControlPreset, type CacheRule, type CapabilityUploadResult, CaptionLocale, CaptionLocaleLabel, CaptionStatus, type CaptionsJobResult, type CaptionsStatusResult, type CreateUploadTokenOptions, type CreateUploadUrlOptions, DEFAULT_ASSET_CACHE_CONTROL, DEFAULT_PRESIGN_EXPIRY_SECONDS, DEFAULT_RETENTION_DERIVATIVES, DEFAULT_SECURITY, DEFAULT_TOKEN_EXPIRY_SECONDS, DEFAULT_VISIBILITY, type DeleteVideoResult, type DeliveryConfig, DevulturApiError, type DevulturConfig, type DevulturKind, type DevulturMedia, type DirectStorageConfig, type DownloadLink, type DownloadLinkOptions, type DownloadUrlOptions, ENCRYPTION_ALG, ENCRYPTION_VERSION, EXPIRES_AT_HEADER, type EncryptionMeta, FILE_MIMES, type FailureReason, type FetchApi, type FileBuilderConfig, type FileHead, type FilesClient, GENERATED_PRIVATE_CACHE_CONTROL, GENERATED_PUBLIC_CACHE_CONTROL, HOLD_PAGE_SIZE, type HoldPage, type HoldSkip, type HoldTarget, IMAGE_MIMES, type ImageBuilderConfig, ImageFit, ImageFormat, type IssueTokenOptions, type JsonRequest, LEGACY_PRESET_SPECS, type ListAssetsOptions, type LockChange, type LockChangeOptions, type LockChangeReason, type LockClient, type LockInstant, type LockResolution, type LockTiming, type LockValidation, type LockView, MAIN_VARIANT, MAX_ASSET_PATH_DEPTH, MAX_ASSET_PATH_LENGTH, MAX_BITRATE_KBPS, MAX_CACHE_CONTROL_LENGTH, MAX_CACHE_RULES, MAX_RETENTION_PERIOD_SECONDS, MAX_VARIANTS, MIN_BITRATE_KBPS, MULTIPART_PART_SIZE_BYTES, MULTIPART_QUERY, MULTIPART_THRESHOLD_BYTES, type MediaEvent, MediaEventName, type MediaEventNameValue, type MediaEventType, type MediaRouter, type MediaRouterConfig, MediaStatus, type MediaStatusValue, MediaType, type MediaUrlOptions, type Mp4Output, MultipartAction, type MultipartPart, type MultipartSession, type MultipartUploadOptions, type ObjectLock, POSTER_FORMATS, type PartUploader, type PosterAt, type PosterFormat, type PosterUrls, type PresetResolution, type PresetSource, type ProcessingPhase, REPR_DIGEST_HEADER, RETENTION_DERIVATIVES, RETENTION_MODES, type ResolvedLock, type ResolvedRetention, type Retention, type RetentionDerivatives, type RetentionMode, SESSION_HEADER, SHA256_HEADER, SHA256_VERIFIED_HEADER, type ScopeCoverage, SecurityLevel, type SecurityPolicy, type SetLockOptions, type SignOptions, type SpecValidation, type SpeechConnectorConfig, SpeechProvider, type StorageClient, type StorageConfig, type StorageConnectorConfig, StorageProvider, type StoredRendition, TRANSCODE_CROPS, TRANSCODE_RUNGS, TRANSCODE_TEMPLATES, type TokenResult, TokenScope, type TranscodeConnectorConfig, type TranscodeCrop, type TranscodeJobResult, type TranscodeOptions, type TranscodeOutputKeys, type TranscodeOutputUrls, type TranscodeOutputs, TranscodePreset, TranscodeProvider, type TranscodeRendition, type TranscodeRung, type TranscodeSettings, type TranscodeSpec, TranscodeStatus, type TranscodeStatusResult, TranscodeTemplate, type TranscodeVariant, type TranslationConnectorConfig, TranslationProvider, type UploadAssetOptions, type UploadFileOptions, type UploadFileResult, UploadRequestKind, type UploadToken, type UploadUrlResult, type UploadsClient, VIDEO_MIMES, type VideoBuilderConfig, type VideoModuleConfig, type VideoOutputRef, type Visibility, type WebhookVerifyOptions, type WorkerClient, type WorkerConfig, type WorkerTransport, type WorkerUploadResult, assetKey, assetRelativePath, buildMediaUrl, buildPosterUrls, buildStoryboardUrl, buildTranscodeOutputUrls, buildVideoMp4Url, bytesToHex, canChange, captionPath, classifyUploadRequest, computeFingerprint, contentDispositionAttachment, contentDispositionInline, counterForBlock, coversScope, createDecryptStream, createHTTPWebhookHandler, createLockClient, createMediaRouter, createStorageClient, createWorkerClient, createWorkerTransport, decodeEncryptionMeta, decryptChunk, edgeTtlSeconds, effectiveUntil, encodeEncryptionMeta, encryptBytes, exportEncryptionKey, extractId, extractKeyFromUrl, file, filePath, formatSize, generateEncryptionKey, generateId, generateIv, getDownloadUrl, handleWebhook, image, imagePath, importEncryptionKey, isAssetKey, isBearerOf, isIsoInstant, isLocked, isPrefixWithin, isValidMime, isValidOutputName, isVideoRawKey, isWithinPathPrefix, isWorkerUploadUrl, matchCacheRule, mediaCaptionPath, mediaPath, mediaThumbnailPath, mediaUrl, missingScopes, multipartAbortUrl, multipartCompleteUrl, multipartCreateUrl, multipartPartCount, multipartPartRange, multipartPartUrl, normalizeAssetPath, normalizeAssetPrefix, normalizeCacheRules, normalizePathPrefix, normalizeSha256, parseSize, publicUrl, relativeMediaPath, reprDigest, resolveCacheControl, resolveLock, resolveSecurity, resolveTranscodePreset, resolveVisibility, sanitizeFilename, sha256Hex, shouldUseMultipart, signPayload, signUrl, timingSafeEqual, toPrivateCacheControl, uploadMultipart, uploadToCapabilityUrl, validateLock, validateTranscodeSpec, verifySignature, verifySignedUrl, video, videoBasePath, videoHlsPath, videoHlsPlaylistPath, videoMp4Dir, videoMp4Path, videoPosterPath, videoRawPath, videoStoryboardDir, videoStoryboardPath, videoThumbnailPath, visibilityFromKey };
1372
+ export { AES_BLOCK_BYTES, ASSET_NAMESPACE, type AssetEntry, type AssetListing, type AssetUploadResult, type AssetsClient, BYTES_PER_UNIT, ByteUnit, CACHE_CONTROL_PRESETS, CacheControlPreset, type CacheRule, type CapabilityUploadResult, CaptionLocale, CaptionLocaleLabel, CaptionStatus, type CaptionsJobResult, type CaptionsStatusResult, type CreateUploadTokenOptions, type CreateUploadUrlOptions, DEFAULT_ASSET_CACHE_CONTROL, DEFAULT_PRESIGN_EXPIRY_SECONDS, DEFAULT_RETENTION_DERIVATIVES, DEFAULT_SECURITY, DEFAULT_TOKEN_EXPIRY_SECONDS, DEFAULT_VISIBILITY, type DeleteVideoResult, type DeliveryConfig, DevulturApiError, type DevulturConfig, type DevulturKind, type DevulturMedia, type DirectStorageConfig, type DownloadLink, type DownloadLinkOptions, type DownloadUrlOptions, ENCRYPTION_ALG, ENCRYPTION_VERSION, EXPIRES_AT_HEADER, type EncryptionMeta, FILE_MIMES, type FailureReason, type FetchApi, type FileBuilderConfig, type FileHead, type FilesClient, GENERATED_PRIVATE_CACHE_CONTROL, GENERATED_PUBLIC_CACHE_CONTROL, HOLD_PAGE_SIZE, type HoldPage, type HoldSkip, type HoldTarget, IMAGE_HEIGHT_HEADER, IMAGE_MIMES, IMAGE_WIDTH_HEADER, type ImageBuilderConfig, ImageFit, ImageFormat, type IssueTokenOptions, type JsonRequest, LEGACY_PRESET_SPECS, type ListAssetsOptions, type LockChange, type LockChangeOptions, type LockChangeReason, type LockClient, type LockInstant, type LockResolution, type LockTiming, type LockValidation, type LockView, MAIN_VARIANT, MAX_ASSET_PATH_DEPTH, MAX_ASSET_PATH_LENGTH, MAX_BITRATE_KBPS, MAX_CACHE_CONTROL_LENGTH, MAX_CACHE_RULES, MAX_RETENTION_PERIOD_SECONDS, MAX_VARIANTS, MIN_BITRATE_KBPS, MULTIPART_PART_SIZE_BYTES, MULTIPART_QUERY, MULTIPART_THRESHOLD_BYTES, type MediaEvent, MediaEventName, type MediaEventNameValue, type MediaEventType, type MediaRouter, type MediaRouterConfig, MediaStatus, type MediaStatusValue, MediaType, type MediaUrlOptions, type Mp4Output, MultipartAction, type MultipartPart, type MultipartSession, type MultipartUploadOptions, type ObjectLock, POSTER_FORMATS, type PartUploader, type PosterAt, type PosterFormat, type PosterUrls, type PresetResolution, type PresetSource, type ProcessingPhase, REPR_DIGEST_HEADER, RETENTION_DERIVATIVES, RETENTION_MODES, type ResolvedLock, type ResolvedRetention, type Retention, type RetentionDerivatives, type RetentionMode, SESSION_HEADER, SHA256_HEADER, SHA256_VERIFIED_HEADER, type ScopeCoverage, SecurityLevel, type SecurityPolicy, type SetLockOptions, type SignOptions, type SpecValidation, type SpeechConnectorConfig, SpeechProvider, type StorageClient, type StorageConfig, type StorageConnectorConfig, StorageProvider, type StoredRendition, TRANSCODE_CROPS, TRANSCODE_RUNGS, TRANSCODE_TEMPLATES, type TokenResult, TokenScope, type TranscodeConnectorConfig, type TranscodeCrop, type TranscodeJobResult, type TranscodeOptions, type TranscodeOutputKeys, type TranscodeOutputUrls, type TranscodeOutputs, TranscodePreset, TranscodeProvider, type TranscodeRendition, type TranscodeRung, type TranscodeSettings, type TranscodeSpec, TranscodeStatus, type TranscodeStatusResult, TranscodeTemplate, type TranscodeVariant, type TranslationConnectorConfig, TranslationProvider, type UploadAssetOptions, type UploadFileOptions, type UploadFileResult, UploadRequestKind, type UploadToken, type UploadUrlResult, type UploadsClient, VIDEO_MIMES, type VideoBuilderConfig, type VideoModuleConfig, type VideoOutputRef, type Visibility, type WebhookVerifyOptions, type WorkerClient, type WorkerConfig, type WorkerTransport, type WorkerUploadResult, assetKey, assetRelativePath, buildMediaUrl, buildPosterUrls, buildStoryboardUrl, buildTranscodeOutputUrls, buildVideoMp4Url, bytesToHex, canChange, captionPath, classifyUploadRequest, computeFingerprint, contentDispositionAttachment, contentDispositionInline, counterForBlock, coversScope, createDecryptStream, createHTTPWebhookHandler, createLockClient, createMediaRouter, createStorageClient, createWorkerClient, createWorkerTransport, decodeEncryptionMeta, decryptChunk, edgeTtlSeconds, effectiveUntil, encodeEncryptionMeta, encryptBytes, exportEncryptionKey, extractId, extractKeyFromUrl, file, filePath, formatSize, generateEncryptionKey, generateId, generateIv, getDownloadUrl, handleWebhook, image, imagePath, importEncryptionKey, isAssetKey, isBearerOf, isIsoInstant, isLocked, isPrefixWithin, isValidMime, isValidOutputName, isVideoRawKey, isWithinPathPrefix, isWorkerUploadUrl, matchCacheRule, mediaCaptionPath, mediaPath, mediaThumbnailPath, mediaUrl, missingScopes, multipartAbortUrl, multipartCompleteUrl, multipartCreateUrl, multipartPartCount, multipartPartRange, multipartPartUrl, normalizeAssetPath, normalizeAssetPrefix, normalizeCacheRules, normalizePathPrefix, normalizeSha256, parseSize, publicUrl, relativeMediaPath, reprDigest, resolveCacheControl, resolveLock, resolveSecurity, resolveTranscodePreset, resolveVisibility, sanitizeFilename, sha256Hex, shouldUseMultipart, signPayload, signUrl, timingSafeEqual, toPrivateCacheControl, uploadMultipart, uploadToCapabilityUrl, validateLock, validateTranscodeSpec, verifySignature, verifySignedUrl, video, videoBasePath, videoHlsPath, videoHlsPlaylistPath, videoMp4Dir, videoMp4Path, videoPosterPath, videoRawPath, videoStoryboardDir, videoStoryboardPath, videoThumbnailPath, visibilityFromKey };
package/dist/index.js CHANGED
@@ -426,6 +426,8 @@ function contentDispositionAttachment(filename) {
426
426
  var SHA256_HEADER = "x-devultur-sha256";
427
427
  var SHA256_VERIFIED_HEADER = "x-devultur-sha256-verified";
428
428
  var EXPIRES_AT_HEADER = "x-devultur-expires-at";
429
+ var IMAGE_WIDTH_HEADER = "x-devultur-image-width";
430
+ var IMAGE_HEIGHT_HEADER = "x-devultur-image-height";
429
431
  var REPR_DIGEST_HEADER = "Repr-Digest";
430
432
  var SHA256_HEX = /^[0-9a-f]{64}$/;
431
433
  function normalizeSha256(raw) {
@@ -1130,8 +1132,14 @@ var ASSET_PART_CONCURRENCY = 4;
1130
1132
  function encodeKey(key) {
1131
1133
  return key.split("/").map(encodeURIComponent).join("/");
1132
1134
  }
1135
+ function positiveIntHeader(response, name) {
1136
+ const value = Number(response.headers.get(name));
1137
+ return Number.isInteger(value) && value > 0 ? value : void 0;
1138
+ }
1133
1139
  function headFromResponse(key, response) {
1134
1140
  const expiresAt = Number(response.headers.get(EXPIRES_AT_HEADER));
1141
+ const width = positiveIntHeader(response, IMAGE_WIDTH_HEADER);
1142
+ const height = positiveIntHeader(response, IMAGE_HEIGHT_HEADER);
1135
1143
  return {
1136
1144
  key,
1137
1145
  size: Number(response.headers.get("content-length") ?? "0"),
@@ -1139,7 +1147,8 @@ function headFromResponse(key, response) {
1139
1147
  etag: response.headers.get("etag"),
1140
1148
  sha256: response.headers.get(SHA256_HEADER),
1141
1149
  sha256Verified: response.headers.get(SHA256_VERIFIED_HEADER) === "true",
1142
- expiresAt: Number.isFinite(expiresAt) && expiresAt > 0 ? expiresAt : null
1150
+ expiresAt: Number.isFinite(expiresAt) && expiresAt > 0 ? expiresAt : null,
1151
+ ...width && height ? { width, height } : {}
1143
1152
  };
1144
1153
  }
1145
1154
  async function putSingle(uploadUrl, file2, options) {
@@ -1875,7 +1884,9 @@ export {
1875
1884
  GENERATED_PRIVATE_CACHE_CONTROL,
1876
1885
  GENERATED_PUBLIC_CACHE_CONTROL,
1877
1886
  HOLD_PAGE_SIZE,
1887
+ IMAGE_HEIGHT_HEADER,
1878
1888
  IMAGE_MIMES,
1889
+ IMAGE_WIDTH_HEADER,
1879
1890
  ImageFit,
1880
1891
  ImageFormat,
1881
1892
  LEGACY_PRESET_SPECS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devultur/core",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "description": "Shared config, types, storage path conventions, media references and URL signing for the Devultur media SDKs",
5
5
  "keywords": [
6
6
  "media",