zelapi 0.0.1 → 0.0.2

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.
@@ -0,0 +1,2 @@
1
+ export { ZelApi } from "./lib/zelapi.js";
2
+ export * from "./types/index.js";
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { ZelApi } from "./lib/zelapi.js";
2
+ export * from "./types/index.js";
@@ -1,5 +1,5 @@
1
- import { ResponseType, ZelApiOptions } from "../types";
2
- import { UniversalParams } from "./handler";
1
+ import { ResponseType, ZelApiOptions } from "../types/index.js";
2
+ import { UniversalParams } from "./handler.js";
3
3
  export declare class ZelApi {
4
4
  private baseUrl;
5
5
  private headers;
@@ -1,5 +1,5 @@
1
- import { apiRequest } from "../utils/zelclient";
2
- import { handleParams } from "./handler";
1
+ import { apiRequest } from "../utils/zelclient.js";
2
+ import { handleParams } from "./handler.js";
3
3
  export class ZelApi {
4
4
  constructor(options = {}) {
5
5
  this.baseUrl = options.baseUrl || "https://zelapioffciall.koyeb.app";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zelapi",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Universal JavaScript & TypeScript client for ZelApi — simple, secure, and flexible HTTP requests with support for JSON, text, and media responses.",
5
5
  "keywords": [
6
6
  "zelapi",
@@ -40,6 +40,15 @@
40
40
  "type": "module",
41
41
  "main": "dist/index.js",
42
42
  "types": "dist/index.d.ts",
43
+ "files": [
44
+ "dist"
45
+ ],
46
+ "exports": {
47
+ ".": {
48
+ "import": "./dist/index.js",
49
+ "types": "./dist/index.d.ts"
50
+ }
51
+ },
43
52
  "directories": {
44
53
  "example": "examples"
45
54
  },
@@ -47,7 +56,11 @@
47
56
  "build": "tsc -p tsconfig.esm.json",
48
57
  "prepublishOnly": "npm run build"
49
58
  },
59
+ "dependencies": {
60
+ "zod": "^3.23.8"
61
+ },
50
62
  "devDependencies": {
63
+ "@types/node": "^25.0.10",
51
64
  "typescript": "^5.9.3"
52
65
  }
53
66
  }
@@ -1,83 +0,0 @@
1
- [![ZelApi](./media/image.jpg)](https://zelapioffciall.koyeb.app)
2
-
3
- <p align="center">
4
- <a href="https://www.npmjs.com/package/zelapi">
5
- <img src="https://img.shields.io/npm/v/zelapi.svg?style=flat&logo=npm" alt="NPM Version">
6
- </a>
7
- <a href="https://www.npmjs.com/package/zelapi">
8
- <img src="https://img.shields.io/npm/dt/zelapi.svg?style=flat&logo=npm" alt="NPM Downloads">
9
- </a>
10
- <img src="https://img.shields.io/badge/Node.js-339933?style=flat&logo=nodedotjs&logoColor=white" alt="Node.js">
11
- <img src="https://img.shields.io/badge/TypeScript-3178C6?style=flat&logo=typescript&logoColor=white" alt="TypeScript">
12
- </p>
13
-
14
- # ZelApi Code of Conduct
15
-
16
- ## Our Pledge
17
-
18
- We as maintainers and contributors of **ZelApi** pledge to make participation in our community a **safe, welcoming, and harassment-free experience** for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual orientation.
19
-
20
- We are committed to fostering a community that is **open, inclusive, respectful, and professional**.
21
-
22
- ---
23
-
24
- ## Our Standards
25
-
26
- ### ✅ Positive behavior includes:
27
- - Showing empathy and kindness to others
28
- - Respecting different opinions and experiences
29
- - Giving and accepting constructive feedback
30
- - Taking responsibility for mistakes and learning from them
31
- - Prioritizing the health and growth of the community
32
-
33
- ### ❌ Unacceptable behavior includes:
34
- - Harassment, discrimination, or hate speech
35
- - Sexualized language, imagery, or advances
36
- - Trolling, insulting, or derogatory comments
37
- - Publishing private information without consent
38
- - Any conduct that is inappropriate in a professional setting
39
-
40
- ---
41
-
42
- ## Enforcement Responsibilities
43
-
44
- Project maintainers are responsible for **clarifying and enforcing** these standards. They may remove, edit, or reject contributions that violate this Code of Conduct and will communicate moderation decisions when appropriate.
45
-
46
- ---
47
-
48
- ## Scope
49
-
50
- This Code of Conduct applies to:
51
- - All project spaces (GitHub, npm, issues, discussions)
52
- - Public spaces when an individual is representing ZelApi
53
-
54
- ---
55
-
56
- ## Enforcement
57
-
58
- If you experience or witness unacceptable behavior, please report it to:
59
-
60
- 📧 **Contact:** hazelnutoffc@gmail.com
61
- or via **GitHub Issues / Discussions**
62
-
63
- All reports will be reviewed **promptly, fairly, and confidentially**.
64
-
65
- ---
66
-
67
- ## Enforcement Guidelines
68
-
69
- ### 1. Correction
70
- **Impact:** Minor unprofessional behavior
71
- **Action:** Private warning with explanation
72
-
73
- ### 2. Warning
74
- **Impact:** Repeated or notable violation
75
- **Action:** Formal warning and temporary restrictions
76
-
77
- ### 3. Temporary Ban
78
- **Impact:** Serious or sustained violations
79
- **Action:** Temporary ban from community interaction
80
-
81
- ### 4. Permanent Ban
82
- **Impact:** Ongoing harassment or severe misconduct
83
- **Action:** Permanent removal from the community
package/SECURITY.md DELETED
@@ -1,43 +0,0 @@
1
- [![ZelApi](./media/image.jpg)](https://zelapioffciall.koyeb.app)
2
-
3
- <p align="center">
4
- <a href="https://www.npmjs.com/package/zelapi"><img src="https://img.shields.io/npm/v/zelapi.svg?style=flat&logo=npm" alt="NPM Version"></a>
5
- <a href="https://www.npmjs.com/package/zelapi"><img src="https://img.shields.io/npm/dt/zelapi.svg?style=flat&logo=npm" alt="NPM Downloads"></a>
6
- <img src="https://img.shields.io/badge/Node.js-339933?style=flat&logo=nodedotjs&logoColor=white" alt="Node.js">
7
- <img src="https://img.shields.io/badge/TypeScript-3178C6?style=flat&logo=typescript&logoColor=white" alt="TypeScript">
8
- </p>
9
-
10
- # Security Policy
11
-
12
- The security of our users and services is a top priority for the ZelApi team. We welcome contributions from the community to help us maintain a high standard of security.
13
-
14
- ## Reporting a Vulnerability
15
-
16
- If you discover a security vulnerability, please report it to us as soon as possible. We encourage responsible disclosure and will work with you to address the issue promptly.
17
-
18
- **Please do not report security vulnerabilities through public GitHub issues.**
19
-
20
- Instead, please send an email to `hazelnutoffc@gmail.com` with the subject line "Security Vulnerability Report".
21
-
22
- In your report, please include the following information:
23
-
24
- * A detailed description of the vulnerability, including how to reproduce it.
25
- * The version of the package you are using.
26
- * Any relevant logs, screenshots, or other supporting materials.
27
-
28
- ## Our Commitment
29
-
30
- * We will acknowledge receipt of your vulnerability report within 48 hours.
31
- * We will provide you with an estimated timeline for addressing the vulnerability.
32
- * We will keep you informed of our progress and notify you when the vulnerability has been patched.
33
- * We will credit you for your discovery, unless you prefer to remain anonymous.
34
-
35
- ## Scope
36
-
37
- This security policy applies to the `zelapi` npm package and the associated API services.
38
-
39
- ## Safe Harbor
40
-
41
- We will not take legal action against you for discovering and reporting security vulnerabilities in accordance with this policy. We consider activities conducted consistent with this policy to constitute "authorized" conduct under the Computer Fraud and Abuse Act.
42
-
43
- We appreciate your efforts to help us keep our community safe.
package/examples/index.js DELETED
@@ -1,13 +0,0 @@
1
- import { ZelApi } from "../dist/index.js"
2
-
3
- const zel = new ZelApi()
4
-
5
- const ai = await zel.json("/ai/mimo", {
6
- text: "apa itu black hole"
7
- })
8
- console.log(ai)
9
-
10
- const video = await zel.buffer("/download/tiktok", {
11
- url: "https://tiktok.com/xxxx"
12
- })
13
- console.log(video.length)
package/media/image.jpg DELETED
Binary file
package/src/index.js DELETED
@@ -1,2 +0,0 @@
1
- export { ZelApi } from "./lib/zelapi"
2
- export * from "./types"
@@ -1,40 +0,0 @@
1
- import { ZodError, z } from "zod";
2
-
3
- const ParamSchema = z
4
- .object({
5
- apikey: z.string().optional(),
6
- prompt: z.string().optional(),
7
- text: z.string().optional(),
8
- })
9
- .catchall(z.any());
10
-
11
- export type UniversalParams = string | Record<string, any>;
12
-
13
- /**
14
- * Handles and sanitizes API request parameters.
15
- * @param params - The parameters to sanitize.
16
- * @returns The sanitized parameters.
17
- */
18
- export function handleParams(params?: UniversalParams): Record<string, any> {
19
- if (typeof params === "string") {
20
- return { text: params };
21
- }
22
-
23
- if (typeof params === "object" && params !== null) {
24
- try {
25
- const validatedParams = ParamSchema.parse(params);
26
- return validatedParams;
27
- } catch (error) {
28
- if (error instanceof ZodError) {
29
- console.error(
30
- "Parameter validation failed:",
31
- error.issues
32
- );
33
- throw new Error("Invalid parameters provided.");
34
- }
35
- throw error;
36
- }
37
- }
38
-
39
- return {};
40
- }
package/src/lib/zelapi.ts DELETED
@@ -1,70 +0,0 @@
1
-
2
- import { apiRequest } from "../utils/zelclient";
3
- import { ResponseType, ZelApiOptions } from "../types";
4
- import { UniversalParams, handleParams } from "./handler";
5
-
6
- export class ZelApi {
7
- private baseUrl: string;
8
- private headers: Record<string, string>;
9
-
10
- constructor(options: ZelApiOptions = {}) {
11
- this.baseUrl = options.baseUrl || "https://zelapioffciall.koyeb.app";
12
- this.headers = {
13
- "User-Agent": "ZelApi-Client/1.0",
14
- ...options.headers,
15
- };
16
- if (options.apiKey) {
17
- this.headers["Authorization"] = `Bearer ${options.apiKey}`;
18
- }
19
- }
20
-
21
- /**
22
- * Makes a request to the API.
23
- * @param path - The API endpoint path.
24
- * @param params - The request parameters. Can be an object or a single string.
25
- * @param responseType - The expected response type.
26
- * @returns A promise that resolves with the API response.
27
- */
28
- request<T = any>(
29
- path: string,
30
- params?: UniversalParams,
31
- responseType: ResponseType = "json"
32
- ) {
33
- const sanitizedParams = handleParams(params);
34
- return apiRequest<T>(this.baseUrl, path, {
35
- params: sanitizedParams,
36
- responseType,
37
- headers: this.headers,
38
- });
39
- }
40
-
41
- /**
42
- * Makes a request and expects a JSON response.
43
- * @param path - The API endpoint path.
44
- * @param params - The request parameters.
45
- * @returns A promise that resolves with the JSON response.
46
- */
47
- json<T = any>(path: string, params?: UniversalParams) {
48
- return this.request<T>(path, params, "json");
49
- }
50
-
51
- /**
52
- * Makes a request and expects a text response.
53
- * @param path - The API endpoint path.
54
- * @param params - The request parameters.
55
- * @returns A promise that resolves with the text response.
56
- */
57
- text(path: string, params?: UniversalParams) {
58
- return this.request<string>(path, params, "text");
59
- }
60
-
61
- /**
62
- * Makes a request and expects a buffer response (for images, videos, etc.).
63
- * @param path - The API endpoint path.
64
- * @param params - The request parameters.
65
- * @returns A promise that resolves with the buffer response.
66
- */
67
- buffer(path: string, params?: UniversalParams) {
68
- return this.request<Buffer>(path, params, "buffer");
69
- }
70
- }
@@ -1,7 +0,0 @@
1
- export type ResponseType = "json" | "text" | "buffer"
2
-
3
- export interface ZelApiOptions {
4
- baseUrl?: string
5
- headers?: Record<string, string>
6
- apiKey?: string
7
- }
@@ -1,45 +0,0 @@
1
- export type ResponseType = "json" | "text" | "buffer"
2
-
3
- export interface RequestOptions {
4
- params?: Record<string, any>
5
- responseType?: ResponseType
6
- headers?: Record<string, string>
7
- }
8
-
9
- export async function apiRequest<T = any>(
10
- baseUrl: string,
11
- path: string,
12
- options: RequestOptions = {}
13
- ): Promise<T | string | Buffer> {
14
- const url = new URL(baseUrl + path)
15
-
16
- if (options.params) {
17
- for (const [key, value] of Object.entries(options.params)) {
18
- if (value !== undefined && value !== null) {
19
- url.searchParams.append(key, String(value))
20
- }
21
- }
22
- }
23
-
24
- const res = await fetch(url.toString(), {
25
- method: "GET",
26
- headers: options.headers
27
- })
28
-
29
- if (!res.ok) {
30
- const text = await res.text().catch(() => "")
31
- throw new Error(
32
- `ZelApiError ${res.status}: ${text || res.statusText}`
33
- )
34
- }
35
-
36
- const type = options.responseType || "json"
37
-
38
- if (type === "json") return (await res.json()) as T
39
- if (type === "text") return await res.text()
40
- if (type === "buffer") {
41
- return Buffer.from(await res.arrayBuffer())
42
- }
43
-
44
- return await res.text()
45
- }
@@ -1,8 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "strict": true,
5
- "skipLibCheck": true,
6
- "forceConsistentCasingInFileNames": true
7
- }
8
- }
package/tsconfig.cjs.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "./tsconfig-base.json",
3
- "compilerOptions": {
4
- "module": "CommonJS",
5
- "moduleResolution": "Node",
6
- "outDir": "dist/cjs"
7
- },
8
- "include": ["src"]
9
- }
package/tsconfig.esm.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "./tsconfig-base.json",
3
- "compilerOptions": {
4
- "module": "ESNext",
5
- "moduleResolution": "Node",
6
- "outDir": "dist",
7
- "declaration": true
8
- },
9
- "include": ["src"]
10
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "./tsconfig-base.json",
3
- "compilerOptions": {
4
- "emitDeclarationOnly": true,
5
- "declaration": true,
6
- "outDir": "dist/types"
7
- },
8
- "include": ["src"]
9
- }