@squarecloud/blob
Advanced tools
Comparing version 1.0.1 to 1.1.0
# @squarecloud/blob | ||
## 1.1.0 | ||
### Minor Changes | ||
- 93ebe06: New `BlobObject` structure | ||
### Patch Changes | ||
- a86d7dc: Update API schemas | ||
## 1.0.1 | ||
@@ -4,0 +14,0 @@ |
import './managers/api.js'; | ||
export { S as SquareCloudBlob } from './index-BgOX-PBH.js'; | ||
export { S as SquareCloudBlob } from './index-CqC_c6-D.js'; | ||
export { BlobObject } from './structures/object.js'; | ||
export { CreateObjectResponse, CreateObjectType } from './types/create.js'; | ||
@@ -9,4 +10,5 @@ export { ListObjectsResponse } from './types/list.js'; | ||
import './types/api.js'; | ||
import './types/object.js'; | ||
import 'zod'; | ||
import './validation/schemas/create.js'; | ||
import './validation/schemas/list.js'; |
101
lib/index.js
@@ -27,2 +27,3 @@ var __defProp = Object.defineProperty; | ||
__export(src_exports, { | ||
BlobObject: () => BlobObject, | ||
MimeTypeUtil: () => MimeTypeUtil, | ||
@@ -200,3 +201,54 @@ MimeTypes: () => MimeTypes, | ||
// src/utils/pathlike.ts | ||
// src/utils/object-url.ts | ||
var objectUrlRegex = /^(?<url>https:\/\/public-blob\.squarecloud\.dev)?\/?(?<userId>\d+\/)(?<prefix>[\w\d-_]+\/)?(?<name>[\w\d_]+)-(?<hash>[\w\d]+)\.(?<extension>\w+)$/; | ||
function parseObjectUrl(url) { | ||
const match = url.match(objectUrlRegex); | ||
if (!match?.groups) { | ||
throw new SquareCloudBlobError("Invalid object URL"); | ||
} | ||
const payload = { | ||
userId: match.groups.userId.replace("/", ""), | ||
prefix: match.groups.prefix?.replace("/", ""), | ||
name: match.groups.name, | ||
hash: match.groups.hash, | ||
extension: match.groups.extension | ||
}; | ||
return { | ||
id: `${payload.userId}/${payload.prefix ? `${payload.prefix}/` : ""}${payload.name}-${payload.hash}.${payload.extension}`, | ||
...payload | ||
}; | ||
} | ||
// src/structures/object.ts | ||
var BlobObject = class { | ||
constructor(data) { | ||
__publicField(this, "id"); | ||
__publicField(this, "url"); | ||
__publicField(this, "name"); | ||
__publicField(this, "prefix"); | ||
__publicField(this, "hash"); | ||
__publicField(this, "userId"); | ||
__publicField(this, "extension"); | ||
__publicField(this, "mimeType"); | ||
__publicField(this, "size"); | ||
__publicField(this, "expiresAt"); | ||
__publicField(this, "createdAt"); | ||
const { id, name, prefix, hash, userId, extension } = parseObjectUrl( | ||
data.idOrUrl | ||
); | ||
this.id = id; | ||
this.url = `https://public-blob.squarecloud.dev/${id}`; | ||
this.name = name; | ||
this.prefix = prefix; | ||
this.hash = hash; | ||
this.userId = userId; | ||
this.extension = extension; | ||
this.mimeType = MimeTypeUtil.fromExtension(extension); | ||
this.size = data.size; | ||
this.expiresAt = data.expiresAt; | ||
this.createdAt = data.createdAt; | ||
} | ||
}; | ||
// src/utils/path-like.ts | ||
var import_promises = require("fs/promises"); | ||
@@ -235,3 +287,3 @@ async function parsePathLike(pathLike) { | ||
/** A number indicating the expiration period of the file, ranging from 1 to 365 days. */ | ||
expire: import_zod2.z.number().min(1).max(365).optional(), | ||
expiresIn: import_zod2.z.number().min(1).max(365).optional(), | ||
/** Set to true if a security hash is required. */ | ||
@@ -246,6 +298,7 @@ securityHash: import_zod2.z.boolean().optional(), | ||
var createObjectPayloadSchema = createObjectSchema.transform( | ||
({ file, securityHash, autoDownload, ...rest }) => ({ | ||
({ file, securityHash, autoDownload, expiresIn, ...rest }) => ({ | ||
file, | ||
params: { | ||
...rest, | ||
expire: expiresIn, | ||
security_hash: securityHash, | ||
@@ -303,6 +356,6 @@ auto_download: autoDownload | ||
var listObjectSchema = import_zod3.z.object({ | ||
name: import_zod3.z.string(), | ||
id: import_zod3.z.string(), | ||
size: import_zod3.z.number(), | ||
created_at: import_zod3.z.coerce.date(), | ||
expire_at: import_zod3.z.coerce.date().optional() | ||
expires_at: import_zod3.z.coerce.date().optional() | ||
}); | ||
@@ -337,3 +390,14 @@ var listObjectsResponseSchema = import_zod3.z.object({ | ||
const { response } = await this.client.api.request("objects"); | ||
return assertListObjectsResponse(response)?.objects; | ||
const list = assertListObjectsResponse(response); | ||
if (!list.objects) { | ||
return []; | ||
} | ||
return list.objects.map( | ||
(object) => new BlobObject({ | ||
idOrUrl: object.id, | ||
size: object.size, | ||
createdAt: new Date(object.created_at), | ||
expiresAt: object.expires_at ? new Date(object.expires_at) : void 0 | ||
}) | ||
); | ||
} | ||
@@ -364,3 +428,7 @@ /** | ||
); | ||
return assertCreateObjectResponse(response); | ||
const objectData = assertCreateObjectResponse(response); | ||
return new BlobObject({ | ||
idOrUrl: objectData.id, | ||
size: objectData.size | ||
}); | ||
} | ||
@@ -385,20 +453,2 @@ /** | ||
} | ||
/** | ||
* Parses the object URL to extract id, prefix, and name. | ||
* | ||
* @param url - The object URL to parse. | ||
*/ | ||
parseObjectUrl(url) { | ||
const pattern = /^https:\/\/public-blob\.squarecloud\.dev\/([^\/]+)\/([^\/]+\/)?([^_]+)_[\w-]+\.\w+$/; | ||
const match = pattern.exec(url); | ||
if (!match) { | ||
throw new SquareCloudBlobError( | ||
"INVALID_BLOB_URL", | ||
"Invalid blob object URL" | ||
); | ||
} | ||
let [, id, prefix, name] = match; | ||
prefix = prefix ? prefix.slice(0, -1) : ""; | ||
return { id, prefix, name }; | ||
} | ||
}; | ||
@@ -420,2 +470,3 @@ | ||
0 && (module.exports = { | ||
BlobObject, | ||
MimeTypeUtil, | ||
@@ -422,0 +473,0 @@ MimeTypes, |
@@ -31,16 +31,2 @@ var __defProp = Object.defineProperty; | ||
// src/structures/error.ts | ||
var SquareCloudBlobError = class _SquareCloudBlobError extends Error { | ||
constructor(code, message, cause) { | ||
super(message, { cause }); | ||
this.name = _SquareCloudBlobError.name; | ||
this.message = this.getMessage(code); | ||
} | ||
getMessage(rawCode) { | ||
const code = rawCode.replaceAll("_", " ").toLowerCase().replace(/(^|\s)\S/g, (L) => L.toUpperCase()); | ||
const message = this.message ? `: ${this.message}` : ""; | ||
return `${code}${message}`; | ||
} | ||
}; | ||
// src/utils/mimetype/mimetypes.ts | ||
@@ -120,3 +106,68 @@ var mimeTypesWithExtension = { | ||
// src/utils/pathlike.ts | ||
// src/structures/error.ts | ||
var SquareCloudBlobError = class _SquareCloudBlobError extends Error { | ||
constructor(code, message, cause) { | ||
super(message, { cause }); | ||
this.name = _SquareCloudBlobError.name; | ||
this.message = this.getMessage(code); | ||
} | ||
getMessage(rawCode) { | ||
const code = rawCode.replaceAll("_", " ").toLowerCase().replace(/(^|\s)\S/g, (L) => L.toUpperCase()); | ||
const message = this.message ? `: ${this.message}` : ""; | ||
return `${code}${message}`; | ||
} | ||
}; | ||
// src/utils/object-url.ts | ||
var objectUrlRegex = /^(?<url>https:\/\/public-blob\.squarecloud\.dev)?\/?(?<userId>\d+\/)(?<prefix>[\w\d-_]+\/)?(?<name>[\w\d_]+)-(?<hash>[\w\d]+)\.(?<extension>\w+)$/; | ||
function parseObjectUrl(url) { | ||
const match = url.match(objectUrlRegex); | ||
if (!match?.groups) { | ||
throw new SquareCloudBlobError("Invalid object URL"); | ||
} | ||
const payload = { | ||
userId: match.groups.userId.replace("/", ""), | ||
prefix: match.groups.prefix?.replace("/", ""), | ||
name: match.groups.name, | ||
hash: match.groups.hash, | ||
extension: match.groups.extension | ||
}; | ||
return { | ||
id: `${payload.userId}/${payload.prefix ? `${payload.prefix}/` : ""}${payload.name}-${payload.hash}.${payload.extension}`, | ||
...payload | ||
}; | ||
} | ||
// src/structures/object.ts | ||
var BlobObject = class { | ||
constructor(data) { | ||
__publicField(this, "id"); | ||
__publicField(this, "url"); | ||
__publicField(this, "name"); | ||
__publicField(this, "prefix"); | ||
__publicField(this, "hash"); | ||
__publicField(this, "userId"); | ||
__publicField(this, "extension"); | ||
__publicField(this, "mimeType"); | ||
__publicField(this, "size"); | ||
__publicField(this, "expiresAt"); | ||
__publicField(this, "createdAt"); | ||
const { id, name, prefix, hash, userId, extension } = parseObjectUrl( | ||
data.idOrUrl | ||
); | ||
this.id = id; | ||
this.url = `https://public-blob.squarecloud.dev/${id}`; | ||
this.name = name; | ||
this.prefix = prefix; | ||
this.hash = hash; | ||
this.userId = userId; | ||
this.extension = extension; | ||
this.mimeType = MimeTypeUtil.fromExtension(extension); | ||
this.size = data.size; | ||
this.expiresAt = data.expiresAt; | ||
this.createdAt = data.createdAt; | ||
} | ||
}; | ||
// src/utils/path-like.ts | ||
var import_promises = require("fs/promises"); | ||
@@ -155,3 +206,3 @@ async function parsePathLike(pathLike) { | ||
/** A number indicating the expiration period of the file, ranging from 1 to 365 days. */ | ||
expire: import_zod2.z.number().min(1).max(365).optional(), | ||
expiresIn: import_zod2.z.number().min(1).max(365).optional(), | ||
/** Set to true if a security hash is required. */ | ||
@@ -166,6 +217,7 @@ securityHash: import_zod2.z.boolean().optional(), | ||
var createObjectPayloadSchema = createObjectSchema.transform( | ||
({ file, securityHash, autoDownload, ...rest }) => ({ | ||
({ file, securityHash, autoDownload, expiresIn, ...rest }) => ({ | ||
file, | ||
params: { | ||
...rest, | ||
expire: expiresIn, | ||
security_hash: securityHash, | ||
@@ -223,6 +275,6 @@ auto_download: autoDownload | ||
var listObjectSchema = import_zod3.z.object({ | ||
name: import_zod3.z.string(), | ||
id: import_zod3.z.string(), | ||
size: import_zod3.z.number(), | ||
created_at: import_zod3.z.coerce.date(), | ||
expire_at: import_zod3.z.coerce.date().optional() | ||
expires_at: import_zod3.z.coerce.date().optional() | ||
}); | ||
@@ -257,3 +309,14 @@ var listObjectsResponseSchema = import_zod3.z.object({ | ||
const { response } = await this.client.api.request("objects"); | ||
return assertListObjectsResponse(response)?.objects; | ||
const list = assertListObjectsResponse(response); | ||
if (!list.objects) { | ||
return []; | ||
} | ||
return list.objects.map( | ||
(object) => new BlobObject({ | ||
idOrUrl: object.id, | ||
size: object.size, | ||
createdAt: new Date(object.created_at), | ||
expiresAt: object.expires_at ? new Date(object.expires_at) : void 0 | ||
}) | ||
); | ||
} | ||
@@ -284,3 +347,7 @@ /** | ||
); | ||
return assertCreateObjectResponse(response); | ||
const objectData = assertCreateObjectResponse(response); | ||
return new BlobObject({ | ||
idOrUrl: objectData.id, | ||
size: objectData.size | ||
}); | ||
} | ||
@@ -305,20 +372,2 @@ /** | ||
} | ||
/** | ||
* Parses the object URL to extract id, prefix, and name. | ||
* | ||
* @param url - The object URL to parse. | ||
*/ | ||
parseObjectUrl(url) { | ||
const pattern = /^https:\/\/public-blob\.squarecloud\.dev\/([^\/]+)\/([^\/]+\/)?([^_]+)_[\w-]+\.\w+$/; | ||
const match = pattern.exec(url); | ||
if (!match) { | ||
throw new SquareCloudBlobError( | ||
"INVALID_BLOB_URL", | ||
"Invalid blob object URL" | ||
); | ||
} | ||
let [, id, prefix, name] = match; | ||
prefix = prefix ? prefix.slice(0, -1) : ""; | ||
return { id, prefix, name }; | ||
} | ||
}; | ||
@@ -325,0 +374,0 @@ |
@@ -1,2 +0,3 @@ | ||
export { O as ObjectsManager } from '../index-BgOX-PBH.js'; | ||
export { O as ObjectsManager } from '../index-CqC_c6-D.js'; | ||
import '../structures/object.js'; | ||
import '../types/create.js'; | ||
@@ -11,2 +12,3 @@ import './api.js'; | ||
import '../utils/mimetype/enum.js'; | ||
import '../types/object.js'; | ||
import '../validation/schemas/create.js'; |
@@ -31,16 +31,2 @@ var __defProp = Object.defineProperty; | ||
// src/structures/error.ts | ||
var SquareCloudBlobError = class _SquareCloudBlobError extends Error { | ||
constructor(code, message, cause) { | ||
super(message, { cause }); | ||
this.name = _SquareCloudBlobError.name; | ||
this.message = this.getMessage(code); | ||
} | ||
getMessage(rawCode) { | ||
const code = rawCode.replaceAll("_", " ").toLowerCase().replace(/(^|\s)\S/g, (L) => L.toUpperCase()); | ||
const message = this.message ? `: ${this.message}` : ""; | ||
return `${code}${message}`; | ||
} | ||
}; | ||
// src/utils/mimetype/mimetypes.ts | ||
@@ -120,3 +106,68 @@ var mimeTypesWithExtension = { | ||
// src/utils/pathlike.ts | ||
// src/structures/error.ts | ||
var SquareCloudBlobError = class _SquareCloudBlobError extends Error { | ||
constructor(code, message, cause) { | ||
super(message, { cause }); | ||
this.name = _SquareCloudBlobError.name; | ||
this.message = this.getMessage(code); | ||
} | ||
getMessage(rawCode) { | ||
const code = rawCode.replaceAll("_", " ").toLowerCase().replace(/(^|\s)\S/g, (L) => L.toUpperCase()); | ||
const message = this.message ? `: ${this.message}` : ""; | ||
return `${code}${message}`; | ||
} | ||
}; | ||
// src/utils/object-url.ts | ||
var objectUrlRegex = /^(?<url>https:\/\/public-blob\.squarecloud\.dev)?\/?(?<userId>\d+\/)(?<prefix>[\w\d-_]+\/)?(?<name>[\w\d_]+)-(?<hash>[\w\d]+)\.(?<extension>\w+)$/; | ||
function parseObjectUrl(url) { | ||
const match = url.match(objectUrlRegex); | ||
if (!match?.groups) { | ||
throw new SquareCloudBlobError("Invalid object URL"); | ||
} | ||
const payload = { | ||
userId: match.groups.userId.replace("/", ""), | ||
prefix: match.groups.prefix?.replace("/", ""), | ||
name: match.groups.name, | ||
hash: match.groups.hash, | ||
extension: match.groups.extension | ||
}; | ||
return { | ||
id: `${payload.userId}/${payload.prefix ? `${payload.prefix}/` : ""}${payload.name}-${payload.hash}.${payload.extension}`, | ||
...payload | ||
}; | ||
} | ||
// src/structures/object.ts | ||
var BlobObject = class { | ||
constructor(data) { | ||
__publicField(this, "id"); | ||
__publicField(this, "url"); | ||
__publicField(this, "name"); | ||
__publicField(this, "prefix"); | ||
__publicField(this, "hash"); | ||
__publicField(this, "userId"); | ||
__publicField(this, "extension"); | ||
__publicField(this, "mimeType"); | ||
__publicField(this, "size"); | ||
__publicField(this, "expiresAt"); | ||
__publicField(this, "createdAt"); | ||
const { id, name, prefix, hash, userId, extension } = parseObjectUrl( | ||
data.idOrUrl | ||
); | ||
this.id = id; | ||
this.url = `https://public-blob.squarecloud.dev/${id}`; | ||
this.name = name; | ||
this.prefix = prefix; | ||
this.hash = hash; | ||
this.userId = userId; | ||
this.extension = extension; | ||
this.mimeType = MimeTypeUtil.fromExtension(extension); | ||
this.size = data.size; | ||
this.expiresAt = data.expiresAt; | ||
this.createdAt = data.createdAt; | ||
} | ||
}; | ||
// src/utils/path-like.ts | ||
var import_promises = require("fs/promises"); | ||
@@ -155,3 +206,3 @@ async function parsePathLike(pathLike) { | ||
/** A number indicating the expiration period of the file, ranging from 1 to 365 days. */ | ||
expire: import_zod2.z.number().min(1).max(365).optional(), | ||
expiresIn: import_zod2.z.number().min(1).max(365).optional(), | ||
/** Set to true if a security hash is required. */ | ||
@@ -166,6 +217,7 @@ securityHash: import_zod2.z.boolean().optional(), | ||
var createObjectPayloadSchema = createObjectSchema.transform( | ||
({ file, securityHash, autoDownload, ...rest }) => ({ | ||
({ file, securityHash, autoDownload, expiresIn, ...rest }) => ({ | ||
file, | ||
params: { | ||
...rest, | ||
expire: expiresIn, | ||
security_hash: securityHash, | ||
@@ -223,6 +275,6 @@ auto_download: autoDownload | ||
var listObjectSchema = import_zod3.z.object({ | ||
name: import_zod3.z.string(), | ||
id: import_zod3.z.string(), | ||
size: import_zod3.z.number(), | ||
created_at: import_zod3.z.coerce.date(), | ||
expire_at: import_zod3.z.coerce.date().optional() | ||
expires_at: import_zod3.z.coerce.date().optional() | ||
}); | ||
@@ -257,3 +309,14 @@ var listObjectsResponseSchema = import_zod3.z.object({ | ||
const { response } = await this.client.api.request("objects"); | ||
return assertListObjectsResponse(response)?.objects; | ||
const list = assertListObjectsResponse(response); | ||
if (!list.objects) { | ||
return []; | ||
} | ||
return list.objects.map( | ||
(object) => new BlobObject({ | ||
idOrUrl: object.id, | ||
size: object.size, | ||
createdAt: new Date(object.created_at), | ||
expiresAt: object.expires_at ? new Date(object.expires_at) : void 0 | ||
}) | ||
); | ||
} | ||
@@ -284,3 +347,7 @@ /** | ||
); | ||
return assertCreateObjectResponse(response); | ||
const objectData = assertCreateObjectResponse(response); | ||
return new BlobObject({ | ||
idOrUrl: objectData.id, | ||
size: objectData.size | ||
}); | ||
} | ||
@@ -305,20 +372,2 @@ /** | ||
} | ||
/** | ||
* Parses the object URL to extract id, prefix, and name. | ||
* | ||
* @param url - The object URL to parse. | ||
*/ | ||
parseObjectUrl(url) { | ||
const pattern = /^https:\/\/public-blob\.squarecloud\.dev\/([^\/]+)\/([^\/]+\/)?([^_]+)_[\w-]+\.\w+$/; | ||
const match = pattern.exec(url); | ||
if (!match) { | ||
throw new SquareCloudBlobError( | ||
"INVALID_BLOB_URL", | ||
"Invalid blob object URL" | ||
); | ||
} | ||
let [, id, prefix, name] = match; | ||
prefix = prefix ? prefix.slice(0, -1) : ""; | ||
return { id, prefix, name }; | ||
} | ||
}; | ||
@@ -325,0 +374,0 @@ // Annotate the CommonJS export names for ESM import in node: |
@@ -126,3 +126,3 @@ var __defProp = Object.defineProperty; | ||
/** A number indicating the expiration period of the file, ranging from 1 to 365 days. */ | ||
expire: import_zod2.z.number().min(1).max(365).optional(), | ||
expiresIn: import_zod2.z.number().min(1).max(365).optional(), | ||
/** Set to true if a security hash is required. */ | ||
@@ -137,6 +137,7 @@ securityHash: import_zod2.z.boolean().optional(), | ||
var createObjectPayloadSchema = createObjectSchema.transform( | ||
({ file, securityHash, autoDownload, ...rest }) => ({ | ||
({ file, securityHash, autoDownload, expiresIn, ...rest }) => ({ | ||
file, | ||
params: { | ||
...rest, | ||
expire: expiresIn, | ||
security_hash: securityHash, | ||
@@ -143,0 +144,0 @@ auto_download: autoDownload |
@@ -29,6 +29,6 @@ var __defProp = Object.defineProperty; | ||
var listObjectSchema = import_zod.z.object({ | ||
name: import_zod.z.string(), | ||
id: import_zod.z.string(), | ||
size: import_zod.z.number(), | ||
created_at: import_zod.z.coerce.date(), | ||
expire_at: import_zod.z.coerce.date().optional() | ||
expires_at: import_zod.z.coerce.date().optional() | ||
}); | ||
@@ -35,0 +35,0 @@ var listObjectsResponseSchema = import_zod.z.object({ |
@@ -13,3 +13,3 @@ import { z } from 'zod'; | ||
/** A number indicating the expiration period of the file, ranging from 1 to 365 days. */ | ||
expire: z.ZodOptional<z.ZodNumber>; | ||
expiresIn: z.ZodOptional<z.ZodNumber>; | ||
/** Set to true if a security hash is required. */ | ||
@@ -24,3 +24,3 @@ securityHash: z.ZodOptional<z.ZodBoolean>; | ||
prefix?: string | undefined; | ||
expire?: number | undefined; | ||
expiresIn?: number | undefined; | ||
securityHash?: boolean | undefined; | ||
@@ -33,3 +33,3 @@ autoDownload?: boolean | undefined; | ||
prefix?: string | undefined; | ||
expire?: number | undefined; | ||
expiresIn?: number | undefined; | ||
securityHash?: boolean | undefined; | ||
@@ -42,3 +42,3 @@ autoDownload?: boolean | undefined; | ||
prefix?: string | undefined; | ||
expire?: number | undefined; | ||
expiresIn?: number | undefined; | ||
securityHash?: boolean | undefined; | ||
@@ -51,3 +51,3 @@ autoDownload?: boolean | undefined; | ||
prefix?: string | undefined; | ||
expire?: number | undefined; | ||
expiresIn?: number | undefined; | ||
securityHash?: boolean | undefined; | ||
@@ -66,3 +66,3 @@ autoDownload?: boolean | undefined; | ||
/** A number indicating the expiration period of the file, ranging from 1 to 365 days. */ | ||
expire: z.ZodOptional<z.ZodNumber>; | ||
expiresIn: z.ZodOptional<z.ZodNumber>; | ||
/** Set to true if a security hash is required. */ | ||
@@ -77,3 +77,3 @@ securityHash: z.ZodOptional<z.ZodBoolean>; | ||
prefix?: string | undefined; | ||
expire?: number | undefined; | ||
expiresIn?: number | undefined; | ||
securityHash?: boolean | undefined; | ||
@@ -86,3 +86,3 @@ autoDownload?: boolean | undefined; | ||
prefix?: string | undefined; | ||
expire?: number | undefined; | ||
expiresIn?: number | undefined; | ||
securityHash?: boolean | undefined; | ||
@@ -95,3 +95,3 @@ autoDownload?: boolean | undefined; | ||
prefix?: string | undefined; | ||
expire?: number | undefined; | ||
expiresIn?: number | undefined; | ||
securityHash?: boolean | undefined; | ||
@@ -104,3 +104,3 @@ autoDownload?: boolean | undefined; | ||
prefix?: string | undefined; | ||
expire?: number | undefined; | ||
expiresIn?: number | undefined; | ||
securityHash?: boolean | undefined; | ||
@@ -111,2 +111,3 @@ autoDownload?: boolean | undefined; | ||
params: { | ||
expire: number | undefined; | ||
security_hash: boolean | undefined; | ||
@@ -117,3 +118,2 @@ auto_download: boolean | undefined; | ||
prefix?: string | undefined; | ||
expire?: number | undefined; | ||
}; | ||
@@ -125,3 +125,3 @@ }, { | ||
prefix?: string | undefined; | ||
expire?: number | undefined; | ||
expiresIn?: number | undefined; | ||
securityHash?: boolean | undefined; | ||
@@ -128,0 +128,0 @@ autoDownload?: boolean | undefined; |
@@ -126,3 +126,3 @@ var __defProp = Object.defineProperty; | ||
/** A number indicating the expiration period of the file, ranging from 1 to 365 days. */ | ||
expire: import_zod2.z.number().min(1).max(365).optional(), | ||
expiresIn: import_zod2.z.number().min(1).max(365).optional(), | ||
/** Set to true if a security hash is required. */ | ||
@@ -137,6 +137,7 @@ securityHash: import_zod2.z.boolean().optional(), | ||
var createObjectPayloadSchema = createObjectSchema.transform( | ||
({ file, securityHash, autoDownload, ...rest }) => ({ | ||
({ file, securityHash, autoDownload, expiresIn, ...rest }) => ({ | ||
file, | ||
params: { | ||
...rest, | ||
expire: expiresIn, | ||
security_hash: securityHash, | ||
@@ -143,0 +144,0 @@ auto_download: autoDownload |
import { z } from 'zod'; | ||
declare const listObjectSchema: z.ZodObject<{ | ||
name: z.ZodString; | ||
id: z.ZodString; | ||
size: z.ZodNumber; | ||
created_at: z.ZodDate; | ||
expire_at: z.ZodOptional<z.ZodDate>; | ||
expires_at: z.ZodOptional<z.ZodDate>; | ||
}, "strip", z.ZodTypeAny, { | ||
name: string; | ||
id: string; | ||
size: number; | ||
created_at: Date; | ||
expire_at?: Date | undefined; | ||
expires_at?: Date | undefined; | ||
}, { | ||
name: string; | ||
id: string; | ||
size: number; | ||
created_at: Date; | ||
expire_at?: Date | undefined; | ||
expires_at?: Date | undefined; | ||
}>; | ||
declare const listObjectsResponseSchema: z.ZodObject<{ | ||
objects: z.ZodArray<z.ZodObject<{ | ||
name: z.ZodString; | ||
id: z.ZodString; | ||
size: z.ZodNumber; | ||
created_at: z.ZodDate; | ||
expire_at: z.ZodOptional<z.ZodDate>; | ||
expires_at: z.ZodOptional<z.ZodDate>; | ||
}, "strip", z.ZodTypeAny, { | ||
name: string; | ||
id: string; | ||
size: number; | ||
created_at: Date; | ||
expire_at?: Date | undefined; | ||
expires_at?: Date | undefined; | ||
}, { | ||
name: string; | ||
id: string; | ||
size: number; | ||
created_at: Date; | ||
expire_at?: Date | undefined; | ||
expires_at?: Date | undefined; | ||
}>, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
objects: { | ||
name: string; | ||
id: string; | ||
size: number; | ||
created_at: Date; | ||
expire_at?: Date | undefined; | ||
expires_at?: Date | undefined; | ||
}[]; | ||
}, { | ||
objects: { | ||
name: string; | ||
id: string; | ||
size: number; | ||
created_at: Date; | ||
expire_at?: Date | undefined; | ||
expires_at?: Date | undefined; | ||
}[]; | ||
@@ -50,0 +50,0 @@ }>; |
@@ -28,6 +28,6 @@ var __defProp = Object.defineProperty; | ||
var listObjectSchema = import_zod.z.object({ | ||
name: import_zod.z.string(), | ||
id: import_zod.z.string(), | ||
size: import_zod.z.number(), | ||
created_at: import_zod.z.coerce.date(), | ||
expire_at: import_zod.z.coerce.date().optional() | ||
expires_at: import_zod.z.coerce.date().optional() | ||
}); | ||
@@ -34,0 +34,0 @@ var listObjectsResponseSchema = import_zod.z.object({ |
{ | ||
"name": "@squarecloud/blob", | ||
"private": false, | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Official Square Cloud Blob SDK for NodeJS", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
473622
148
5283