unified-cdn-api 0.0.0-stage → 1.0.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.
Files changed (50) hide show
  1. package/dist/classes.d.ts +19 -0
  2. package/dist/classes.d.ts.map +1 -0
  3. package/dist/classes.js +37 -0
  4. package/dist/classes.js.map +1 -0
  5. package/dist/errors.d.ts +19 -0
  6. package/dist/errors.d.ts.map +1 -0
  7. package/dist/errors.js +37 -0
  8. package/dist/errors.js.map +1 -0
  9. package/dist/index.d.ts +28 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +46 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/methods/deleteFile.d.ts +3 -0
  14. package/dist/methods/deleteFile.d.ts.map +1 -0
  15. package/dist/methods/deleteFile.js +7 -0
  16. package/dist/methods/deleteFile.js.map +1 -0
  17. package/dist/methods/deleteFiles.d.ts +9 -0
  18. package/dist/methods/deleteFiles.d.ts.map +1 -0
  19. package/dist/methods/deleteFiles.js +11 -0
  20. package/dist/methods/deleteFiles.js.map +1 -0
  21. package/dist/methods/getFileContent.d.ts +3 -0
  22. package/dist/methods/getFileContent.d.ts.map +1 -0
  23. package/dist/methods/getFileContent.js +39 -0
  24. package/dist/methods/getFileContent.js.map +1 -0
  25. package/dist/methods/getFileDetails.d.ts +4 -0
  26. package/dist/methods/getFileDetails.d.ts.map +1 -0
  27. package/dist/methods/getFileDetails.js +7 -0
  28. package/dist/methods/getFileDetails.js.map +1 -0
  29. package/dist/methods/getFiles.d.ts +4 -0
  30. package/dist/methods/getFiles.d.ts.map +1 -0
  31. package/dist/methods/getFiles.js +8 -0
  32. package/dist/methods/getFiles.js.map +1 -0
  33. package/dist/methods/renameFile.d.ts +3 -0
  34. package/dist/methods/renameFile.d.ts.map +1 -0
  35. package/dist/methods/renameFile.js +11 -0
  36. package/dist/methods/renameFile.js.map +1 -0
  37. package/dist/methods/uploadFiles.d.ts +7 -0
  38. package/dist/methods/uploadFiles.d.ts.map +1 -0
  39. package/dist/methods/uploadFiles.js +17 -0
  40. package/dist/methods/uploadFiles.js.map +1 -0
  41. package/dist/request.d.ts +3 -0
  42. package/dist/request.d.ts.map +1 -0
  43. package/dist/request.js +67 -0
  44. package/dist/request.js.map +1 -0
  45. package/dist/types.d.ts +13 -0
  46. package/dist/types.d.ts.map +1 -0
  47. package/dist/types.js +2 -0
  48. package/dist/types.js.map +1 -0
  49. package/package.json +45 -4
  50. package/README.md +0 -3
@@ -0,0 +1,19 @@
1
+ import type { UnifiedCDN } from "./index.js";
2
+ import type { RawUnifiedCDNFile } from "./types.js";
3
+ export declare class UnifiedCDNFile {
4
+ private readonly options;
5
+ private readonly ucdn;
6
+ readonly id: string;
7
+ readonly name: string;
8
+ readonly viewUrl: string;
9
+ readonly contentType: string;
10
+ readonly size: number;
11
+ readonly expiresAt: Date | null;
12
+ readonly createdAt: Date;
13
+ readonly updatedAt: Date;
14
+ constructor(options: RawUnifiedCDNFile, ucdn: UnifiedCDN);
15
+ rename(newName: string): Promise<string>;
16
+ delete(): Promise<any>;
17
+ getContent(): Promise<File>;
18
+ }
19
+ //# sourceMappingURL=classes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classes.d.ts","sourceRoot":"","sources":["../src/classes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,qBAAa,cAAc;IAUV,OAAO,CAAC,QAAQ,CAAC,OAAO;IAAqB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAT/E,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,WAAW,EAAE,MAAM,CAAC;IACpC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvC,SAAgB,SAAS,EAAE,IAAI,CAAC;IAChC,SAAgB,SAAS,EAAE,IAAI,CAAC;IAEhC,YAA8B,OAAO,EAAE,iBAAiB,EAAmB,IAAI,EAAE,UAAU,EAS1F;IACK,MAAM,CAAC,OAAO,EAAE,MAAM,mBAE3B;IACK,MAAM,iBAEX;IACK,UAAU,kBAEf;CACJ"}
@@ -0,0 +1,37 @@
1
+ import deleteFile from "./methods/deleteFile.js";
2
+ import getFileContent from "./methods/getFileContent.js";
3
+ import renameFile from "./methods/renameFile.js";
4
+ export class UnifiedCDNFile {
5
+ options;
6
+ ucdn;
7
+ id;
8
+ name;
9
+ viewUrl;
10
+ contentType;
11
+ size;
12
+ expiresAt;
13
+ createdAt;
14
+ updatedAt;
15
+ constructor(options, ucdn) {
16
+ this.options = options;
17
+ this.ucdn = ucdn;
18
+ this.id = this.options.id;
19
+ this.name = this.options.name;
20
+ this.viewUrl = `${ucdn.apiUrl}/files/${this.options.id}/view`;
21
+ this.contentType = this.options.contentType;
22
+ this.size = this.options.size;
23
+ this.expiresAt = this.options.expiresAt ? new Date(this.options.expiresAt) : null;
24
+ this.createdAt = new Date(this.options.createdAt);
25
+ this.updatedAt = new Date(this.options.updatedAt);
26
+ }
27
+ async rename(newName) {
28
+ return renameFile(this.ucdn, this.id, newName);
29
+ }
30
+ async delete() {
31
+ return deleteFile(this.ucdn, this.id);
32
+ }
33
+ async getContent() {
34
+ return getFileContent(this.ucdn, this.id);
35
+ }
36
+ }
37
+ //# sourceMappingURL=classes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classes.js","sourceRoot":"","sources":["../src/classes.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,yBAAyB,CAAC;AACjD,OAAO,cAAc,MAAM,6BAA6B,CAAC;AACzD,OAAO,UAAU,MAAM,yBAAyB,CAAC;AAGjD,MAAM,OAAO,cAAc;IAUO,OAAO;IAAsC,IAAI;IAT/D,EA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AC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9C,CAAC;CACJ"}
@@ -0,0 +1,19 @@
1
+ export declare abstract class APIError extends Error {
2
+ constructor(message: string);
3
+ }
4
+ export declare class UnauthorisedError extends APIError {
5
+ constructor(message: string);
6
+ }
7
+ export declare class NotFoundError extends APIError {
8
+ constructor(message: string);
9
+ }
10
+ export declare class InsufficientPermissionsError extends APIError {
11
+ constructor(message: string);
12
+ }
13
+ export declare class InvalidConfigurationError extends APIError {
14
+ constructor(message: string);
15
+ }
16
+ export declare class UnknownError extends APIError {
17
+ constructor(message: string);
18
+ }
19
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,8BAAsB,QAAS,SAAQ,KAAK;IAC1C,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,qBAAa,iBAAkB,SAAQ,QAAQ;IAC3C,YAAY,OAAO,EAAE,MAAM,EAG1B;CACJ;AAED,qBAAa,aAAc,SAAQ,QAAQ;IACvC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACJ;AAED,qBAAa,4BAA6B,SAAQ,QAAQ;IACtD,YAAY,OAAO,EAAE,MAAM,EAG1B;CACJ;AAED,qBAAa,yBAA0B,SAAQ,QAAQ;IACnD,YAAY,OAAO,EAAE,MAAM,EAG1B;CACJ;AAED,qBAAa,YAAa,SAAQ,QAAQ;IACtC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACJ"}
package/dist/errors.js ADDED
@@ -0,0 +1,37 @@
1
+ export class APIError extends Error {
2
+ constructor(message) {
3
+ super(message);
4
+ this.name = 'APIError';
5
+ }
6
+ }
7
+ export class UnauthorisedError extends APIError {
8
+ constructor(message) {
9
+ super(message);
10
+ this.name = 'UnauthorisedError';
11
+ }
12
+ }
13
+ export class NotFoundError extends APIError {
14
+ constructor(message) {
15
+ super(message);
16
+ this.name = 'NotFoundError';
17
+ }
18
+ }
19
+ export class InsufficientPermissionsError extends APIError {
20
+ constructor(message) {
21
+ super(message);
22
+ this.name = 'InsufficientPermissionsError';
23
+ }
24
+ }
25
+ export class InvalidConfigurationError extends APIError {
26
+ constructor(message) {
27
+ super(message);
28
+ this.name = 'InvalidConfigurationError';
29
+ }
30
+ }
31
+ export class UnknownError extends APIError {
32
+ constructor(message) {
33
+ super(message);
34
+ this.name = 'UnknownError';
35
+ }
36
+ }
37
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,QAAS,SAAQ,KAAK;IAC1C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,UAAU,CAAA;IACxB,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,QAAQ;IAC3C,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAA;IACnC,CAAC;CACJ;AAED,MAAM,OAAO,aAAc,SAAQ,QAAQ;IACvC,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;IAC/B,CAAC;CACJ;AAED,MAAM,OAAO,4BAA6B,SAAQ,QAAQ;IACtD,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAA;IAC9C,CAAC;CACJ;AAED,MAAM,OAAO,yBAA0B,SAAQ,QAAQ;IACnD,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAA;IAC3C,CAAC;CACJ;AAED,MAAM,OAAO,YAAa,SAAQ,QAAQ;IACtC,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,cAAc,CAAA;IAC9B,CAAC;CACJ"}
@@ -0,0 +1,28 @@
1
+ export declare class UnifiedCDN {
2
+ private readonly options;
3
+ private readonly apiKey;
4
+ readonly apiUrl: string;
5
+ constructor(options: {
6
+ apiKey: string;
7
+ apiUrl: string;
8
+ });
9
+ request(path: string, options?: RequestInit): Promise<Response>;
10
+ requestData(path: string, options?: RequestInit): Promise<any>;
11
+ upload(files: File[]): Promise<{
12
+ uploads: import("./classes.js").UnifiedCDNFile[];
13
+ failed: string[];
14
+ }>;
15
+ delete(fileIds: string[]): Promise<{
16
+ deleted: string[];
17
+ failed: {
18
+ id: string;
19
+ reason: string;
20
+ }[];
21
+ }>;
22
+ get(fileIds: string[]): Promise<import("./classes.js").UnifiedCDNFile[]>;
23
+ getFileDetails(fileId: string): Promise<import("./types.js").RawUnifiedCDNFile>;
24
+ getFileContent(fileId: string): Promise<File>;
25
+ renameFile(fileId: string, newName: string): Promise<string>;
26
+ deleteFile(fileId: string): Promise<any>;
27
+ }
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,qBAAa,UAAU;IAGN,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,YAA8B,OAAO,EAAE;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,EAGtE;IACK,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,qBAEpD;IACK,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,gBAExD;IACK,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE;;;OAEzB;IACK,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE;;;;;;OAE7B;IACK,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,oDAE1B;IACK,cAAc,CAAC,MAAM,EAAE,MAAM,mDAElC;IACK,cAAc,CAAC,MAAM,EAAE,MAAM,iBAElC;IACK,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAE/C;IACK,UAAU,CAAC,MAAM,EAAE,MAAM,gBAE9B;CACJ"}
package/dist/index.js ADDED
@@ -0,0 +1,46 @@
1
+ import deleteFile from "./methods/deleteFile.js";
2
+ import deleteFiles from "./methods/deleteFiles.js";
3
+ import getFileContent from "./methods/getFileContent.js";
4
+ import getFileDetails from "./methods/getFileDetails.js";
5
+ import getFiles from "./methods/getFiles.js";
6
+ import renameFile from "./methods/renameFile.js";
7
+ import uploadFiles from "./methods/uploadFiles.js";
8
+ import { request, requestData } from "./request.js";
9
+ export class UnifiedCDN {
10
+ options;
11
+ apiKey;
12
+ apiUrl;
13
+ constructor(options) {
14
+ this.options = options;
15
+ this.apiKey = this.options.apiKey;
16
+ this.apiUrl = this.options.apiUrl;
17
+ }
18
+ async request(path, options = {}) {
19
+ return request(this.apiUrl, this.apiKey, path, options);
20
+ }
21
+ async requestData(path, options = {}) {
22
+ return requestData(this.apiUrl, this.apiKey, path, options);
23
+ }
24
+ async upload(files) {
25
+ return uploadFiles(this, files);
26
+ }
27
+ async delete(fileIds) {
28
+ return deleteFiles(this, fileIds);
29
+ }
30
+ async get(fileIds) {
31
+ return getFiles(this, fileIds);
32
+ }
33
+ async getFileDetails(fileId) {
34
+ return getFileDetails(this, fileId);
35
+ }
36
+ async getFileContent(fileId) {
37
+ return getFileContent(this, fileId);
38
+ }
39
+ async renameFile(fileId, newName) {
40
+ return renameFile(this, fileId, newName);
41
+ }
42
+ async deleteFile(fileId) {
43
+ return deleteFile(this, fileId);
44
+ }
45
+ }
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,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OAAO,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnC,CAAC;IACD,KAAK,CAAC,cAAc,CAAC,MAAc;QAC/B,OAAO,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;IACD,KAAK,CAAC,cAAc,CAAC,MAAc;QAChC,OAAO,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;IACD,KAAK,CAAC,UAAU,CAAC,MAAc,EAAE,OAAe;QAC5C,OAAO,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IACD,KAAK,CAAC,UAAU,CAAC,MAAc;QAC3B,OAAO,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;CACJ"}
@@ -0,0 +1,3 @@
1
+ import type { UnifiedCDN } from "../index.js";
2
+ export default function deleteFile(ucdn: UnifiedCDN, fileId: string): Promise<any>;
3
+ //# sourceMappingURL=deleteFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteFile.d.ts","sourceRoot":"","sources":["../../src/methods/deleteFile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,wBAA8B,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAKxE"}
@@ -0,0 +1,7 @@
1
+ export default async function deleteFile(ucdn, fileId) {
2
+ const data = await ucdn.requestData(`/files/${fileId}/delete`, {
3
+ method: "DELETE",
4
+ });
5
+ return data;
6
+ }
7
+ //# sourceMappingURL=deleteFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteFile.js","sourceRoot":"","sources":["../../src/methods/deleteFile.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,UAAU,CAAC,IAAgB,EAAE,MAAc;IACrE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,MAAM,SAAS,EAAE;QAC3D,MAAM,EAAE,QAAQ;KACnB,CAAC,CAAA;IACF,OAAO,IAAI,CAAC;AAChB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { UnifiedCDN } from "../index.js";
2
+ export default function deleteFiles(ucdn: UnifiedCDN, fileIds: string[]): Promise<{
3
+ deleted: string[];
4
+ failed: {
5
+ id: string;
6
+ reason: string;
7
+ }[];
8
+ }>;
9
+ //# sourceMappingURL=deleteFiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteFiles.d.ts","sourceRoot":"","sources":["../../src/methods/deleteFiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,wBAA8B,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE;aAQvC,MAAM,EAAE;YAAyB;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,EAAE;GACpG"}
@@ -0,0 +1,11 @@
1
+ export default async function deleteFiles(ucdn, fileIds) {
2
+ const data = await ucdn.requestData(`/files/delete`, {
3
+ method: "DELETE",
4
+ headers: {
5
+ "Content-Type": "application/json"
6
+ },
7
+ body: JSON.stringify({ files: fileIds })
8
+ });
9
+ return { deleted: data.deleted, failed: data.failed };
10
+ }
11
+ //# sourceMappingURL=deleteFiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteFiles.js","sourceRoot":"","sources":["../../src/methods/deleteFiles.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,WAAW,CAAC,IAAgB,EAAE,OAAiB;IACzE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE;QACjD,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE;YACL,cAAc,EAAE,kBAAkB;SACrC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;KAC3C,CAAC,CAAA;IACF,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAmB,EAAE,MAAM,EAAE,IAAI,CAAC,MAAwC,EAAC,CAAC;AACvG,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { UnifiedCDN } from "../index.js";
2
+ export default function getFileContent(ucdn: UnifiedCDN, fileId: string): Promise<File>;
3
+ //# sourceMappingURL=getFileContent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFileContent.d.ts","sourceRoot":"","sources":["../../src/methods/getFileContent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,wBAA8B,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iBAgC5E"}
@@ -0,0 +1,39 @@
1
+ import { APIError, UnknownError } from "../errors.js";
2
+ export default async function getFileContent(ucdn, fileId) {
3
+ try {
4
+ const response = await ucdn.request(`/files/${fileId}/view`, {
5
+ method: "GET",
6
+ });
7
+ const blob = await response.blob();
8
+ const contentType = response.headers.get("content-type") || blob.type || "application/octet-stream";
9
+ const disposition = response.headers.get("content-disposition");
10
+ let filename = fileId;
11
+ if (disposition) {
12
+ const utf8Match = disposition.match(/filename\*=UTF-8''([^;]+)/i);
13
+ const quotedMatch = disposition.match(/filename="([^"]+)"/i);
14
+ const bareMatch = disposition.match(/filename=([^;]+)/i);
15
+ const raw = utf8Match?.[1] ?? quotedMatch?.[1] ?? bareMatch?.[1];
16
+ if (raw) {
17
+ try {
18
+ filename = decodeURIComponent(raw.trim());
19
+ }
20
+ catch {
21
+ filename = raw.trim();
22
+ }
23
+ }
24
+ }
25
+ return new File([blob], filename, { type: contentType });
26
+ }
27
+ catch (error) {
28
+ if (error instanceof APIError) {
29
+ throw error;
30
+ }
31
+ else if (error instanceof Error) {
32
+ throw new UnknownError(`An unknown error occurred: ${error.message}`);
33
+ }
34
+ else {
35
+ throw new UnknownError('An unknown error occurred. No message is available.');
36
+ }
37
+ }
38
+ }
39
+ //# sourceMappingURL=getFileContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFileContent.js","sourceRoot":"","sources":["../../src/methods/getFileContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGtD,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,cAAc,CAAC,IAAgB,EAAE,MAAc;IACzE,IAAI,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,MAAM,OAAO,EAAE;YACzD,MAAM,EAAE,KAAK;SAChB,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,0BAA0B,CAAC;QACpG,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;QAChE,IAAI,QAAQ,GAAG,MAAM,CAAC;QACtB,IAAI,WAAW,EAAE,CAAC;YACd,MAAM,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;YAClE,MAAM,WAAW,GAAG,WAAW,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;YAC7D,MAAM,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;YACzD,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;YACjE,IAAI,GAAG,EAAE,CAAC;gBACN,IAAI,CAAC;oBACD,QAAQ,GAAG,kBAAkB,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;gBAC9C,CAAC;gBAAC,MAAM,CAAC;oBACL,QAAQ,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;gBAC1B,CAAC;YACL,CAAC;QACL,CAAC;QACD,OAAO,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;IAC7D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;YAC5B,MAAM,KAAK,CAAC;QAChB,CAAC;aAAM,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAChC,MAAM,IAAI,YAAY,CAAC,8BAA8B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1E,CAAC;aAAM,CAAC;YACJ,MAAM,IAAI,YAAY,CAAC,qDAAqD,CAAC,CAAC;QAClF,CAAC;IACL,CAAC;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { UnifiedCDN } from "../index.js";
2
+ import type { RawUnifiedCDNFile } from "../types.js";
3
+ export default function getFileDetails(ucdn: UnifiedCDN, fileId: string): Promise<RawUnifiedCDNFile>;
4
+ //# sourceMappingURL=getFileDetails.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFileDetails.d.ts","sourceRoot":"","sources":["../../src/methods/getFileDetails.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,wBAA8B,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,8BAK5E"}
@@ -0,0 +1,7 @@
1
+ export default async function getFileDetails(ucdn, fileId) {
2
+ const data = await ucdn.requestData(`/files/${fileId}/get`, {
3
+ method: "GET",
4
+ });
5
+ return data;
6
+ }
7
+ //# sourceMappingURL=getFileDetails.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFileDetails.js","sourceRoot":"","sources":["../../src/methods/getFileDetails.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,cAAc,CAAC,IAAgB,EAAE,MAAc;IACzE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,MAAM,MAAM,EAAE;QACxD,MAAM,EAAE,KAAK;KAChB,CAAC,CAAA;IACF,OAAO,IAAyB,CAAC;AACrC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { UnifiedCDNFile } from "../classes.js";
2
+ import type { UnifiedCDN } from "../index.js";
3
+ export default function getFiles(ucdn: UnifiedCDN, fileIds: string[]): Promise<UnifiedCDNFile[]>;
4
+ //# sourceMappingURL=getFiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFiles.d.ts","sourceRoot":"","sources":["../../src/methods/getFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,wBAA8B,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,6BAKzE"}
@@ -0,0 +1,8 @@
1
+ import { UnifiedCDNFile } from "../classes.js";
2
+ export default async function getFiles(ucdn, fileIds) {
3
+ const data = await ucdn.requestData(`/files/get?ids=${fileIds.map((uri) => encodeURIComponent(uri)).join(",")}`, {
4
+ method: "GET",
5
+ });
6
+ return data.files.map((file) => new UnifiedCDNFile({ ...file }, ucdn));
7
+ }
8
+ //# sourceMappingURL=getFiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFiles.js","sourceRoot":"","sources":["../../src/methods/getFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAI/C,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAgB,EAAE,OAAiB;IACtE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,kBAAkB,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAC,EAAE,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE;QAC5G,MAAM,EAAE,KAAK;KAChB,CAAC,CAAA;IACF,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAuB,EAAC,EAAE,CAAC,IAAI,cAAc,CAAC,EAAC,GAAG,IAAI,EAAC,EAAE,IAAI,CAAC,CAAqB,CAAC;AAC/G,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { UnifiedCDN } from "../index.js";
2
+ export default function renameFile(ucdn: UnifiedCDN, fileId: string, newName: string): Promise<string>;
3
+ //# sourceMappingURL=renameFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renameFile.d.ts","sourceRoot":"","sources":["../../src/methods/renameFile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,wBAA8B,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBASzF"}
@@ -0,0 +1,11 @@
1
+ export default async function renameFile(ucdn, fileId, newName) {
2
+ const data = await ucdn.requestData(`/files/${fileId}/rename`, {
3
+ method: "PATCH",
4
+ headers: {
5
+ "Content-Type": "application/json"
6
+ },
7
+ body: JSON.stringify({ name: newName })
8
+ });
9
+ return data.newName;
10
+ }
11
+ //# sourceMappingURL=renameFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renameFile.js","sourceRoot":"","sources":["../../src/methods/renameFile.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,UAAU,CAAC,IAAgB,EAAE,MAAc,EAAE,OAAe;IACtF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,MAAM,SAAS,EAAE;QAC3D,MAAM,EAAE,OAAO;QACf,OAAO,EAAE;YACL,cAAc,EAAE,kBAAkB;SACrC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;KAC1C,CAAC,CAAA;IACF,OAAQ,IAA0B,CAAC,OAAO,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { UnifiedCDNFile } from "../classes.js";
2
+ import type { UnifiedCDN } from "../index.js";
3
+ export default function uploadFiles(ucdn: UnifiedCDN, files: File[]): Promise<{
4
+ uploads: UnifiedCDNFile[];
5
+ failed: string[];
6
+ }>;
7
+ //# sourceMappingURL=uploadFiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploadFiles.d.ts","sourceRoot":"","sources":["../../src/methods/uploadFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,wBAA8B,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE;;;GAcxE"}
@@ -0,0 +1,17 @@
1
+ import { UnifiedCDNFile } from "../classes.js";
2
+ export default async function uploadFiles(ucdn, files) {
3
+ const formData = new FormData();
4
+ files.forEach((file) => {
5
+ formData.append("files", file);
6
+ });
7
+ const data = await ucdn.requestData("/files/upload", {
8
+ method: "POST",
9
+ body: formData
10
+ });
11
+ const uploadsTransformed = data.uploads.map((upload) => new UnifiedCDNFile(upload, ucdn));
12
+ return {
13
+ uploads: uploadsTransformed,
14
+ failed: data.failed
15
+ };
16
+ }
17
+ //# sourceMappingURL=uploadFiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploadFiles.js","sourceRoot":"","sources":["../../src/methods/uploadFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,WAAW,CAAC,IAAgB,EAAE,KAAa;IACrE,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAChC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACnB,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IACH,MAAM,IAAI,GAAoG,MAAM,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE;QAClJ,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,QAAQ;KACjB,CAAC,CAAA;IACF,MAAM,kBAAkB,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAC1F,OAAO;QACH,OAAO,EAAE,kBAAkB;QAC3B,MAAM,EAAE,IAAI,CAAC,MAAM;KACtB,CAAA;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function request(apiUrl: string, apiKey: string, path: string, options?: RequestInit): Promise<Response>;
2
+ export declare function requestData(apiUrl: string, apiKey: string, path: string, options?: RequestInit): Promise<any>;
3
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAEA,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,qBAuCpG;AACD,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,gBAaxG"}
@@ -0,0 +1,67 @@
1
+ import { APIError, InsufficientPermissionsError, InvalidConfigurationError, NotFoundError, UnauthorisedError, UnknownError } from "./errors.js";
2
+ export async function request(apiUrl, apiKey, path, options = {}) {
3
+ try {
4
+ const response = await fetch(`${apiUrl}/api${path}`, {
5
+ ...options,
6
+ headers: {
7
+ ...options.headers,
8
+ Authorization: `Bearer ${apiKey}`,
9
+ },
10
+ });
11
+ if (!response.ok) {
12
+ let errorData = null;
13
+ try {
14
+ errorData = await response.json();
15
+ }
16
+ catch (e) {
17
+ throw new UnknownError('An error occurred while fetching the error data.');
18
+ }
19
+ const errorMessage = errorData?.message || 'An error occurred';
20
+ if (response.status === 401) {
21
+ throw new UnauthorisedError(errorMessage);
22
+ }
23
+ else if (response.status === 403) {
24
+ throw new InsufficientPermissionsError(errorMessage);
25
+ }
26
+ else if (response.status === 404) {
27
+ throw new NotFoundError(errorMessage);
28
+ }
29
+ else if (response.status === 400) {
30
+ throw new InvalidConfigurationError(errorMessage);
31
+ }
32
+ else {
33
+ throw new UnknownError(errorMessage);
34
+ }
35
+ }
36
+ return response;
37
+ }
38
+ catch (error) {
39
+ if (error instanceof APIError) {
40
+ throw error;
41
+ }
42
+ else if (error instanceof Error) {
43
+ throw new UnknownError(`An unknown error occurred: ${error.message}`);
44
+ }
45
+ else {
46
+ throw new UnknownError('An unknown error occurred. No message is available.');
47
+ }
48
+ }
49
+ }
50
+ export async function requestData(apiUrl, apiKey, path, options = {}) {
51
+ try {
52
+ const response = await request(apiUrl, apiKey, path, options);
53
+ return await response.json();
54
+ }
55
+ catch (error) {
56
+ if (error instanceof APIError) {
57
+ throw error;
58
+ }
59
+ else if (error instanceof Error) {
60
+ throw new UnknownError(`An unknown error occurred: ${error.message}`);
61
+ }
62
+ else {
63
+ throw new UnknownError('An unknown error occurred. No message is available.');
64
+ }
65
+ }
66
+ }
67
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,Q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M,CAAC;gBACJ,MAAM,IAAI,YAAY,CAAC,YAAY,CAAC,CAAC;YACzC,CAAC;QACL,CAAC;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IAAI,KAAK,YAAY,QAAQ,EAAC,CAAC;YAC3B,MAAM,KAAK,CAAA;QACf,CAAC;aAAM,IAAI,KAAK,YAAY,KAAK,EAAC,CAAC;YAC/B,MAAM,IAAI,YAAY,CAAC,8BAA8B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1E,CAAC;aAAM,CAAC;YACJ,MAAM,IAAI,YAAY,CAAC,qDAAqD,CAAC,CAAC;QAClF,CAAC;IACL,CAAC;AACL,CAAC;AACD,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAc,EAAE,MAAc,EAAE,IAAY,EAAE,OAAO,GAAgB,EAAE;IACrG,IAAI,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAC9D,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACjC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IAAI,KAAK,YAAY,QAAQ,EAAC,CAAC;YAC3B,MAAM,KAAK,CAAA;QACf,CAAC;aAAM,IAAI,KAAK,YAAY,KAAK,EAAC,CAAC;YAC/B,MAAM,IAAI,YAAY,CAAC,8BAA8B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1E,CAAC;aAAM,CAAC;YACJ,MAAM,IAAI,YAAY,CAAC,qDAAqD,CAAC,CAAC;QAClF,CAAC;IACL,CAAC;AACL,CAAC"}
@@ -0,0 +1,13 @@
1
+ export type RawUnifiedCDNFile = {
2
+ id: string;
3
+ applicationId: string;
4
+ databaseId: string;
5
+ key: string;
6
+ name: string;
7
+ contentType: string;
8
+ size: number;
9
+ expiresAt: string | null;
10
+ createdAt: string;
11
+ updatedAt: string;
12
+ };
13
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAA"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,47 @@
1
1
  {
2
2
  "name": "unified-cdn-api",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "API client for UnifiedCDN.",
5
+ "keywords": [
6
+ "cdn",
7
+ "api",
8
+ "client",
9
+ "typescript",
10
+ "upload",
11
+ "files"
12
+ ],
13
+ "license": "ISC",
14
+ "author": "ng-qi-an",
15
+ "type": "module",
16
+ "main": "dist/index.js",
17
+ "types": "dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "default": "./dist/index.js"
22
+ },
23
+ "./errors": {
24
+ "types": "./dist/errors.d.ts",
25
+ "default": "./dist/errors.js"
26
+ },
27
+ "./classes": {
28
+ "types": "./dist/classes.d.ts",
29
+ "default": "./dist/classes.js"
30
+ }
31
+ },
32
+ "files": [
33
+ "dist"
34
+ ],
35
+ "scripts": {
36
+ "build": "tsc",
37
+ "prepare": "npm run build"
38
+ },
39
+ "engines": {
40
+ "node": ">=20"
41
+ },
42
+ "devDependencies": {
43
+ "@types/node": "^26.6.6",
44
+ "tsx": "^4.23.15",
45
+ "typescript": "^7.0.2"
46
+ }
47
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.