mirror of
https://github.com/n8n-io/n8n-nodes-starter.git
synced 2025-10-28 14:12:24 -05:00
Jules was unable to complete the task in time. Please review the work done so far and provide feedback for Jules to continue.
This commit is contained in:
parent
e1c2f2e46b
commit
b17810e962
5 changed files with 414 additions and 50 deletions
|
|
@ -1,50 +0,0 @@
|
|||
import {
|
||||
IAuthenticateGeneric,
|
||||
ICredentialTestRequest,
|
||||
ICredentialType,
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export class HttpBinApi implements ICredentialType {
|
||||
name = 'httpbinApi';
|
||||
displayName = 'HttpBin API';
|
||||
documentationUrl = 'https://your-docs-url';
|
||||
properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Token',
|
||||
name: 'token',
|
||||
type: 'string',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
password: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
displayName: 'Domain',
|
||||
name: 'domain',
|
||||
type: 'string',
|
||||
default: 'https://httpbin.org',
|
||||
},
|
||||
];
|
||||
|
||||
// This allows the credential to be used by other parts of n8n
|
||||
// stating how this credential is injected as part of the request
|
||||
// An example is the Http Request node that can make generic calls
|
||||
// reusing this credential
|
||||
authenticate: IAuthenticateGeneric = {
|
||||
type: 'generic',
|
||||
properties: {
|
||||
headers: {
|
||||
Authorization: '={{"Bearer " + $credentials.token}}',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// The block below tells how this credential can be tested
|
||||
test: ICredentialTestRequest = {
|
||||
request: {
|
||||
baseURL: '={{$credentials?.domain}}',
|
||||
url: '/bearer',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
@ -245,3 +245,90 @@ This entry provides an initial review of the project's code quality and style, b
|
|||
* JSDoc usage is generally good, though it needs to be applied to `interfaces/SunoTypes.ts` once populated.
|
||||
* The primary immediate concerns are the **empty `interfaces/SunoTypes.ts` file** and the pervasive `console.log` statements that will need refinement before any production-level code or real API integration.
|
||||
* The current mocked nature of `utils/sunoApi.ts` is well-documented and appropriate for this stage.
|
||||
|
||||
## 2024-07-29: Populated Core Type Definitions
|
||||
|
||||
The file `interfaces/SunoTypes.ts` has been populated with essential TypeScript interfaces: `SunoAuthResponse`, `SunoJob`, `SunoTrack`, and `SunoPromptOptions`. These definitions include JSDoc comments for each interface and its properties, aiming to provide clarity and type safety for data exchange related to the Suno API. This addresses a key action item from the "Code Quality & Style - Initial Review".
|
||||
|
||||
## 2024-07-29: Dependency Analysis
|
||||
|
||||
This entry details the project's dependencies as listed in `package.json`.
|
||||
|
||||
* **Production Dependencies:**
|
||||
* The `package.json` does not list any explicit production `dependencies`. This is typical for n8n nodes where `n8n-workflow` (and `n8n-core`) are treated as peer dependencies.
|
||||
|
||||
* **Peer Dependencies:**
|
||||
* `n8n-workflow`: `*` (This signifies that the node expects n8n's workflow capabilities to be provided by the host n8n environment, which is the standard operational model for custom nodes.)
|
||||
|
||||
* **Development Dependencies (`devDependencies`):**
|
||||
* `@typescript-eslint/parser`: `~8.32.0` (Parser that allows ESLint to lint TypeScript code.)
|
||||
* `eslint`: `^8.57.0` (Core ESLint library for identifying and reporting on patterns in JavaScript/TypeScript.)
|
||||
* `eslint-plugin-n8n-nodes-base`: `^1.16.3` (An n8n-specific ESLint plugin containing recommended rules for n8n node development.)
|
||||
* `gulp`: `^5.0.0` (A toolkit for automating painful or time-consuming tasks in development workflow; here, likely for icon management.)
|
||||
* `prettier`: `^3.5.3` (An opinionated code formatter that enforces a consistent style.)
|
||||
* `typescript`: `^5.8.2` (The TypeScript language compiler and language service.)
|
||||
|
||||
* **Node Engine:**
|
||||
* `node`: `>=20.15` (Specifies the minimum Node.js version required to run this project. This is a relatively recent LTS version of Node.js.)
|
||||
|
||||
* **Observations:**
|
||||
* The project utilizes a standard and modern toolset for TypeScript-based development, including robust linting and formatting tools.
|
||||
* Gulp's presence is noted for specific build tasks, as seen in the `build` script (`tsc && gulp build:icons`), likely related to n8n's requirements for node icons.
|
||||
* The specified versions for development dependencies are relatively up-to-date.
|
||||
* A comprehensive audit for outdated versions or security vulnerabilities would necessitate checking these versions against external databases (e.g., npmjs.com, Snyk, Dependabot alerts if configured). However, the listed versions provide the baseline for such a check.
|
||||
* The lack of direct production dependencies is standard for n8n community nodes, as they operate within the n8n execution environment.
|
||||
|
||||
## 2024-07-29: FSM Analysis - Preliminary Check
|
||||
|
||||
This entry conducts a preliminary check for potential Finite State Machines (FSMs) within the current system design.
|
||||
|
||||
* **Potential FSM Candidates:**
|
||||
* **1. Song Generation Job Lifecycle (within `utils/sunoApi.ts` and observed by `Suno.node.ts` and `SunoTrigger.node.ts`):**
|
||||
* **Description:** The process of generating a song, from prompt submission to track availability, is inherently stateful. The `utils/sunoApi.ts` (mocked implementation) already simulates this with `SunoJob` states.
|
||||
* **Identified States (from `SunoJob` type and `pollJobStatus` mock logic):**
|
||||
* `queued` (Initial state after `submitPrompt`)
|
||||
* `generating` / `processing` (Intermediate state during generation - `processing` is in `SunoJob` type, `generating` is used in mock logic)
|
||||
* `complete` (Final success state, `trackId` becomes available)
|
||||
* `failed` (Final error state)
|
||||
* **Key Events/Triggers for Transitions:**
|
||||
* `submitPrompt()` -> `queued`
|
||||
* Internal Suno AI processing (simulated by polling) -> `generating`/`processing`
|
||||
* Generation success (simulated by polling) -> `complete`
|
||||
* Generation error / invalid input (simulated by polling for non-existent job) -> `failed`
|
||||
* **Relevance:** Modeling this as an FSM is beneficial for:
|
||||
* Clearly defining the expected lifecycle of a generation job.
|
||||
* Handling timeouts or retries at specific stages (e.g., if stuck in `generating` for too long).
|
||||
* Providing more granular status updates to the user via the n8n node.
|
||||
* The `pollJobStatus` function in `sunoApi.ts` queries and drives the (mocked) state of this FSM. The `SunoTrigger.node.ts` for 'Track Generation Complete' also monitors this.
|
||||
|
||||
* **2. Trigger State Management for "New Song Available" (within `SunoTrigger.node.ts`):**
|
||||
* **Description:** The current mock trigger for "New Song Available" simply emits the first song from the `listPreviousSongs()` call. A robust implementation needs to identify *genuinely new* songs. This implies the trigger itself needs to maintain a state (e.g., a list of song IDs seen in the previous poll).
|
||||
* **Identified States (conceptual):**
|
||||
* `Polling` (Actively checking for new songs)
|
||||
* `Idle` (Between polls - managed by n8n scheduler)
|
||||
* `ProcessingDiff` (After fetching songs, comparing to previous list)
|
||||
* `EmittingNew` (When new songs are found and being emitted)
|
||||
* **Key Events/Triggers for Transitions:**
|
||||
* Poll interval elapses (n8n calls `manualTrigger`) -> `Polling`
|
||||
* `listPreviousSongs()` returns -> `ProcessingDiff`
|
||||
* New songs identified -> `EmittingNew`
|
||||
* Emission complete -> `Idle` (until next poll)
|
||||
* **Relevance:** While perhaps not a classical FSM in the same way as a job lifecycle, thinking about the trigger's polling cycle in terms of states can help design a more reliable mechanism for detecting new items and managing its own operational state (e.g., last polled timestamp, list of seen IDs). This is less about the Suno API's state and more about the trigger node's internal logic.
|
||||
|
||||
* **Next Steps for FSM (if pursued):**
|
||||
* For the "Song Generation Job Lifecycle", if the actual Suno API provides clear state indicators, formalizing the FSM in documentation (e.g., using PlantUML or a state table) would be valuable for the `sunoApi.ts` implementation when moving away from mocks.
|
||||
* For the "New Song Available" trigger, the stateful logic for diffing song lists needs careful design. This might not require a full FSM diagram but rather clear state management variables and logic within the trigger code.
|
||||
|
||||
* **Current Implementation:**
|
||||
* The mocked `utils/sunoApi.ts` already implements a simplified version of the "Song Generation Job Lifecycle" FSM through the `status` property of `SunoJob` and the logic in `pollJobStatus`.
|
||||
* The `SunoTrigger.node.ts` for "New Song Available" currently lacks robust state management for detecting new songs, as noted in its mock implementation.
|
||||
|
||||
## 2024-07-29: Defined Functional & Non-Functional Requirements
|
||||
|
||||
Created `docs/enhancement_requirements.md` and populated it with detailed Functional Requirements (FRs) based on current node capabilities (authentication, music generation, job/track management, triggers) and Non-Functional Requirements (NFRs) covering Reliability, Maintainability, Usability, Performance, Testability, and Security. This document will serve as a basis for guiding further development and roadmap creation.
|
||||
|
||||
## 2024-07-29: Proposed Initial Enhancement Roadmap
|
||||
|
||||
Created `docs/enhancement_roadmap.md` outlining a 5-milestone plan: 1. Solidify Mock Implementation, 2. Real API Auth & Read Ops, 3. Real API Core Generation, 4. Real API Triggers & Advanced Features, 5. Refinement & Release Prep. This roadmap will guide iterative development. Key immediate tasks for Milestone 1 include addressing `HttpBinApi.credentials.ts` and `console.log` usage.
|
||||
|
||||
[end of docs/dev-log.md]
|
||||
|
|
|
|||
75
docs/enhancement_requirements.md
Normal file
75
docs/enhancement_requirements.md
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
# Functional and Non-Functional Requirements
|
||||
|
||||
## 1. Functional Requirements (FRs)
|
||||
|
||||
The n8n Suno AI node should provide the following functionalities:
|
||||
|
||||
### FR1: User Authentication
|
||||
- **FR1.1:** The system must allow users to authenticate with the Suno AI service using their credentials (email and password).
|
||||
- **FR1.2:** Authentication status should be managed (e.g., session token stored and used for subsequent API calls). (Currently mocked)
|
||||
|
||||
### FR2: Music Generation
|
||||
- **FR2.1: Generate Song from Text Prompt:**
|
||||
- The node must allow users to submit a text prompt.
|
||||
- The node should allow specifying additional options (e.g., style, mood, instrumental - to be defined based on Suno API capabilities).
|
||||
- The system should initiate a music generation job via the Suno API.
|
||||
- The system should return a job identifier and initial status. (Currently mocked job ID and status)
|
||||
- **FR2.2: Upload Track Reference (for generation):**
|
||||
- The node must allow users to specify a file path for an audio track to be used as a reference (e.g., for style transfer or continuation - dependent on Suno API).
|
||||
- The system should upload this track and return a reference identifier or initiate a job. (Currently mocked)
|
||||
|
||||
### FR3: Job & Track Management
|
||||
- **FR3.1: Get Track/Job Status:**
|
||||
- The node must allow users to query the status of a specific generation job or track using its ID.
|
||||
- The system should return the current status (e.g., queued, generating, complete, failed) and progress if available. (Currently mocked with state changes)
|
||||
- **FR3.2: Download Generated Track:**
|
||||
- Once a track is successfully generated, the node must allow users to download the audio file (e.g., MP3, WAV - dependent on Suno API).
|
||||
- The system should provide the audio data as a binary output. (Currently mocked with dummy binary data)
|
||||
- **FR3.3: List Previous Songs:**
|
||||
- The node must allow users to retrieve a list of their previously generated songs.
|
||||
- The system should return track details (e.g., ID, title, status, URLs). (Currently mocked)
|
||||
|
||||
### FR4: Workflow Triggers
|
||||
- **FR4.1: Trigger on Track Generation Complete:**
|
||||
- The system must provide a trigger that activates when a specific music generation job/track is complete.
|
||||
- The trigger should output details of the completed track. (Currently mocked polling)
|
||||
- **FR4.2: Trigger on New Song Available:**
|
||||
- The system must provide a trigger that activates when a new song becomes available in the user's Suno AI library.
|
||||
- The trigger should output details of the new song(s). (Currently mocked polling, needs robust new song detection)
|
||||
|
||||
### FR5: (Placeholder) Other Suno API Features
|
||||
- (e.g., Select Voice/Style - `selectVoice` is a placeholder in `sunoApi.ts`) - to be defined if Suno API supports these as distinct actions relevant to the n8n node.
|
||||
|
||||
## 2. Non-Functional Requirements (NFRs)
|
||||
|
||||
### NFR1: Reliability
|
||||
- **NFR1.1:** All API interactions must include robust error handling.
|
||||
- **NFR1.2:** Clear and informative error messages should be provided to the n8n user in case of failures.
|
||||
- **NFR1.3:** Polling triggers should be fault-tolerant (e.g., handle temporary API unavailability gracefully).
|
||||
- **NFR1.4:** The node should correctly manage authentication state and attempt re-authentication or token refresh if necessary and feasible (actual mechanism TBD based on Suno API).
|
||||
|
||||
### NFR2: Maintainability
|
||||
- **NFR2.1:** Code must be clean, well-organized, and follow established TypeScript best practices. Module separation should be preserved.
|
||||
- **NFR2.2:** Comprehensive JSDoc comments for all functions, classes, interfaces, and type properties.
|
||||
- **NFR2.3:** The `docs/dev-log.md` should be kept up-to-date with significant decisions and progress.
|
||||
- **NFR2.4:** Configuration and magic strings should be minimized, using constants or configuration variables where appropriate.
|
||||
|
||||
### NFR3: Usability (n8n User Experience)
|
||||
- **NFR3.1:** Node parameters should be clearly named and described in the n8n UI.
|
||||
- **NFR3.2:** Operations should be logically grouped and named.
|
||||
- **NFR3.3:** Output data from node operations and triggers should be well-structured and useful for downstream n8n nodes.
|
||||
- **NFR3.4:** Placeholder text and default values for node parameters should be helpful.
|
||||
|
||||
### NFR4: Performance
|
||||
- **NFR4.1:** API calls should be made efficiently. Avoid unnecessary calls. (Dependent on actual Suno API structure).
|
||||
- **NFR4.2:** Mocked API calls (current state) should be lightweight and fast to not hinder development or testing.
|
||||
- **NFR4.3:** For operations involving file handling (e.g., download, upload reference), streams should be considered if the actual API supports them and files can be large, to manage memory efficiently.
|
||||
|
||||
### NFR5: Testability
|
||||
- **NFR5.1:** Code should be structured to facilitate unit and integration testing.
|
||||
- **NFR5.2:** Key logic, especially in `utils/sunoApi.ts` (once it targets a real API), should have good test coverage.
|
||||
- **NFR5.3:** The existing `tests/checkEndpoints.ts` should be expanded or replaced by a proper test suite.
|
||||
|
||||
### NFR6: Security
|
||||
- **NFR6.1:** Credentials must be handled securely as per n8n standards.
|
||||
- **NFR6.2:** No sensitive information should be inadvertently logged (e.g., full tokens, passwords after initial use).
|
||||
68
docs/enhancement_roadmap.md
Normal file
68
docs/enhancement_roadmap.md
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
# Enhancement Roadmap
|
||||
|
||||
This document outlines a high-level roadmap for enhancing the n8n-nodes-suno-ai project, focusing on moving from the current mocked implementation to a production-ready node.
|
||||
|
||||
## Guiding Principles
|
||||
- Address Non-Functional Requirements (NFRs) outlined in `docs/enhancement_requirements.md`.
|
||||
- Iteratively replace mocked components with real API integrations.
|
||||
- Prioritize a stable and reliable core feature set.
|
||||
- Continuously improve code quality and test coverage.
|
||||
|
||||
## Proposed Milestones
|
||||
|
||||
### Milestone 1: Solidify Mock Implementation & Core Structure (Current Phase After This)
|
||||
* **Goal:** Ensure the current mocked implementation is robust, well-documented, and all planned mock features are complete. Address immediate structural issues.
|
||||
* **Key Tasks:**
|
||||
* **Done:** Populate `interfaces/SunoTypes.ts`.
|
||||
* **Pending:** Verify and remove `HttpBinApi.credentials.ts`.
|
||||
* **Pending:** Refactor `console.log` usage to a more structured approach or remove where appropriate (especially in `utils/sunoApi.ts` and trigger nodes).
|
||||
* **Pending:** Ensure all mocked API functions in `utils/sunoApi.ts` correctly use and return types from `SunoTypes.ts`.
|
||||
* **Pending:** Enhance `tests/checkEndpoints.ts` to cover all mocked functionalities and provide clearer success/failure reporting.
|
||||
* **Documentation:** Ensure JSDoc comments are complete for all modules. Update `dev-log.md` consistently.
|
||||
|
||||
### Milestone 2: Real API Integration - Authentication & Basic Read Operations
|
||||
* **Goal:** Implement real authentication against the Suno API and integrate simple read-only operations.
|
||||
* **Key Tasks:**
|
||||
* **Authentication Research (Actual):** Perform the detailed API investigation previously simulated (Phase 3 of original issue). Document actual auth endpoints, request/response formats, token/cookie handling, refresh mechanisms. Update `docs/dev-log.md`.
|
||||
* **Implement Real `loginWithCredentials`:** Update `utils/sunoApi.ts` and `SunoApi.credentials.ts` to use the actual Suno login mechanism. Securely handle tokens/session data.
|
||||
* **Implement Real `listPreviousSongs`:** Connect this to the actual Suno API endpoint. Handle actual data parsing and error responses.
|
||||
* **Implement Real `isAuthenticated` / `refreshSessionIfExpired`:** Based on actual API behavior.
|
||||
* **Testing:** Add basic integration tests for login and listing songs with test credentials (if possible without cost).
|
||||
* **Documentation:** Update API interaction details in `docs/dev-log.md`.
|
||||
|
||||
### Milestone 3: Real API Integration - Core Generation & Management Features
|
||||
* **Goal:** Implement the core music generation and management features using the real Suno API.
|
||||
* **Key Tasks:**
|
||||
* **Implement Real `submitPrompt`:** Connect to the actual endpoint. Handle prompt options and API responses (job ID, initial status).
|
||||
* **Implement Real `pollJobStatus`:** Connect to the actual endpoint. Handle different job statuses and potential errors.
|
||||
* **Implement Real `downloadTrack`:** Connect to the actual endpoint. Handle binary data correctly.
|
||||
* **(If Applicable) Implement Real `uploadReferenceTrack`:** Based on Suno API capabilities.
|
||||
* **Error Handling:** Implement comprehensive error handling for all API calls as per NFR1.
|
||||
* **Node Logic:** Ensure `Suno.node.ts` correctly processes real API responses and errors.
|
||||
* **Testing:** Expand integration tests for these core features.
|
||||
|
||||
### Milestone 4: Real API Integration - Triggers & Advanced Features
|
||||
* **Goal:** Implement robust triggers with real API data and any other advanced features.
|
||||
* **Key Tasks:**
|
||||
* **Refine `SunoTrigger.node.ts` for `trackGenerationComplete`:** Use real `pollJobStatus`. Implement robust state management to prevent re-triggering for already processed completed tracks (e.g., storing emitted job/track IDs within trigger state or using a small local cache if appropriate for n8n trigger lifecycle).
|
||||
* **Refine `SunoTrigger.node.ts` for `newSongAvailable`:** Use real `listPreviousSongs`. Implement robust state management for detecting genuinely new songs (e.g., comparing against a list of previously seen song IDs from the last poll).
|
||||
* **Input Validation:** Add comprehensive input validation for all node parameters in `Suno.node.ts` and `SunoTrigger.node.ts`.
|
||||
* **(If Applicable) Implement other API features** identified (e.g., `selectVoice`).
|
||||
* **Testing:** Add tests for trigger logic (might require more advanced test setups).
|
||||
|
||||
### Milestone 5: Refinement, Testing, and Release Preparation
|
||||
* **Goal:** Polish the node, ensure comprehensive testing, and prepare for a potential "release" or wider use.
|
||||
* **Key Tasks:**
|
||||
* **Code Review & Refactoring:** Perform a full code review against NFRs (Maintainability, Reliability, Performance).
|
||||
* **Comprehensive Testing:**
|
||||
* Expand unit tests for utility functions and complex logic.
|
||||
* Ensure integration tests cover all operations and triggers with various scenarios.
|
||||
* Perform end-to-end testing within n8n.
|
||||
* **Documentation Review:** Ensure all user-facing descriptions (node properties, operations) are clear and accurate. Finalize `README.md` for the node.
|
||||
* **Performance Optimization:** Based on testing, identify and address any performance bottlenecks if the actual API is slow.
|
||||
* **Finalize `README.md` and other documentation.** (e.g., user guide snippets).
|
||||
|
||||
## Future Considerations (Post-Milestone 5)
|
||||
* OAuth 2.0 authentication if Suno API supports it.
|
||||
* Support for more advanced Suno API features as they become available.
|
||||
* Community feedback and feature requests.
|
||||
|
|
@ -0,0 +1,184 @@
|
|||
// interfaces/SunoTypes.ts
|
||||
|
||||
/**
|
||||
* Represents the authentication response from the Suno API.
|
||||
*/
|
||||
export interface SunoAuthResponse {
|
||||
/**
|
||||
* The session token or JWT.
|
||||
* @type {string}
|
||||
*/
|
||||
token?: string;
|
||||
|
||||
/**
|
||||
* Session cookie, if authentication is cookie-based.
|
||||
* @type {string}
|
||||
*/
|
||||
cookie?: string;
|
||||
|
||||
/**
|
||||
* The user ID, if provided by the authentication response.
|
||||
* @type {string}
|
||||
*/
|
||||
userId?: string;
|
||||
|
||||
/**
|
||||
* Error message, if authentication failed.
|
||||
* @type {string}
|
||||
*/
|
||||
error?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a job submitted to the Suno API, typically for song generation.
|
||||
*/
|
||||
export interface SunoJob {
|
||||
/**
|
||||
* Unique identifier for the job.
|
||||
* @type {string}
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* Current status of the job.
|
||||
* @type {'queued' | 'processing' | 'generating' | 'complete' | 'failed'}
|
||||
*/
|
||||
status: 'queued' | 'processing' | 'generating' | 'complete' | 'failed';
|
||||
|
||||
/**
|
||||
* Identifier of the track that is/will be generated by this job.
|
||||
* Available when the job status is 'complete'.
|
||||
* @type {string}
|
||||
*/
|
||||
trackId?: string;
|
||||
|
||||
/**
|
||||
* Error message if the job failed.
|
||||
* @type {string}
|
||||
*/
|
||||
error?: string;
|
||||
|
||||
/**
|
||||
* Timestamp of when the job was created (ISO date string).
|
||||
* @type {string}
|
||||
*/
|
||||
createdAt: string;
|
||||
|
||||
/**
|
||||
* Progress of the job, typically a percentage (0-100).
|
||||
* @type {number}
|
||||
*/
|
||||
progress?: number;
|
||||
|
||||
/**
|
||||
* Any additional metadata associated with the job.
|
||||
* @type {Record<string, any>}
|
||||
*/
|
||||
metadata?: Record<string, any>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a music track generated by or stored in Suno AI.
|
||||
*/
|
||||
export interface SunoTrack {
|
||||
/**
|
||||
* Unique identifier for the track.
|
||||
* @type {string}
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* Title of the track.
|
||||
* @type {string}
|
||||
*/
|
||||
title?: string;
|
||||
|
||||
/**
|
||||
* Artist name associated with the track.
|
||||
* @type {string}
|
||||
*/
|
||||
artist?: string;
|
||||
|
||||
/**
|
||||
* URL to the cover art or image associated with the track.
|
||||
* @type {string}
|
||||
*/
|
||||
imageUrl?: string;
|
||||
|
||||
/**
|
||||
* URL to the playable audio file or a preview.
|
||||
* @type {string}
|
||||
*/
|
||||
audioUrl?: string;
|
||||
|
||||
/**
|
||||
* Duration of the track in seconds.
|
||||
* @type {number}
|
||||
*/
|
||||
duration?: number;
|
||||
|
||||
/**
|
||||
* Current status of the track (distinct from job status, e.g., availability).
|
||||
* @type {'queued' | 'generating' | 'complete' | 'failed' | 'available'}
|
||||
*/
|
||||
status: 'queued' | 'generating' | 'complete' | 'failed' | 'available'; // Added 'available'
|
||||
|
||||
/**
|
||||
* Timestamp of when the track was created or made available (ISO date string).
|
||||
* @type {string}
|
||||
*/
|
||||
createdAt?: string;
|
||||
|
||||
/**
|
||||
* Indicates if the track is public or private.
|
||||
* @type {boolean}
|
||||
*/
|
||||
isPublic?: boolean;
|
||||
|
||||
/**
|
||||
* Any additional metadata associated with the track.
|
||||
* @type {Record<string, any>}
|
||||
*/
|
||||
metadata?: Record<string, any>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for submitting a prompt to generate music.
|
||||
*/
|
||||
export interface SunoPromptOptions {
|
||||
/**
|
||||
* Desired musical style (e.g., 'pop', 'orchestral', 'jazz').
|
||||
* @type {string}
|
||||
*/
|
||||
style?: string;
|
||||
|
||||
/**
|
||||
* Desired mood for the music (e.g., 'happy', 'epic', 'chill').
|
||||
* @type {string}
|
||||
*/
|
||||
mood?: string;
|
||||
|
||||
/**
|
||||
* Whether the generated track should be instrumental.
|
||||
* @type {boolean}
|
||||
*/
|
||||
instrumental?: boolean;
|
||||
|
||||
/**
|
||||
* Flag for advanced 'custom mode' features, if available.
|
||||
* @type {boolean}
|
||||
*/
|
||||
custom?: boolean;
|
||||
|
||||
/**
|
||||
* ID of a reference track for voice or style transfer.
|
||||
* @type {string}
|
||||
*/
|
||||
referenceTrackId?: string;
|
||||
|
||||
/**
|
||||
* ID of a predefined voice to use for generation.
|
||||
* @type {string}
|
||||
*/
|
||||
voiceId?: string;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue