From ba721507228068e7ef64b569858d83c6a89c27d5 Mon Sep 17 00:00:00 2001 From: alvaro Date: Thu, 23 Oct 2025 14:14:58 +0200 Subject: [PATCH 1/4] Update processes endpoints --- src/api/types.ts | 15 +++++++++++---- src/api/yepcodeApi.ts | 38 ++++++++++++++++++++++++++++++++++++++ src/types/index.ts | 2 ++ 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/src/api/types.ts b/src/api/types.ts index 96df877..ba9c6d4 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -12,8 +12,13 @@ export interface YepCodeApiConfig { export interface CreateProcessInput { name: string; + slug?: string; description?: string; readme?: string; + programmingLanguage?: "JAVASCRIPT" | "PYTHON"; + sourceCode?: string; + parametersSchema?: string; + webhook?: WebhookInput; manifest?: ProcessManifestInput; settings?: SettingsInput; script?: CreateScriptInput; @@ -51,7 +56,7 @@ export interface Execution { id: string; processId: string; scheduledId?: string; - status: "CREATED" | "RUNNING" | "FINISHED" | "KILLED" | "REJECTED" | "ERROR"; + status: "CREATED" | "QUEUED" | "DEQUEUED" | "RUNNING" | "FINISHED" | "KILLED" | "REJECTED" | "ERROR"; timeline?: ExecutionTimeline; parameters?: { [name: string]: { @@ -85,7 +90,7 @@ export interface ExecutionTimeline { events?: ExecutionTimelineEvent[]; } export interface ExecutionTimelineEvent { - status: "CREATED" | "RUNNING" | "FINISHED" | "KILLED" | "REJECTED" | "ERROR"; + status: "CREATED" | "QUEUED" | "DEQUEUED" | "RUNNING" | "FINISHED" | "KILLED" | "REJECTED" | "ERROR"; timestamp: string; explanation?: string; } @@ -226,10 +231,12 @@ export interface TeamVariablesPaginatedResult { data?: TeamVariable[]; } export interface UpdateProcessInput { - name: string; - slug: string; + name?: string; + slug?: string; description?: string; readme?: string; + sourceCode?: string; + parametersSchema?: string; script?: UpdateScriptInput; webhook?: WebhookInput; settings?: SettingsInput; diff --git a/src/api/yepcodeApi.ts b/src/api/yepcodeApi.ts index 10b2064..0660131 100644 --- a/src/api/yepcodeApi.ts +++ b/src/api/yepcodeApi.ts @@ -343,6 +343,20 @@ export class YepCodeApi { return this.request("POST", `/processes/${processId}/versions`, { data }); } + async getProcessVersion( + processId: string, + versionId: string + ): Promise { + return this.request("GET", `/processes/${processId}/versions/${versionId}`); + } + + async deleteProcessVersion( + processId: string, + versionId: string + ): Promise { + return this.request("DELETE", `/processes/${processId}/versions/${versionId}`); + } + async getProcessVersionAliases( processId: string, params: { @@ -361,6 +375,28 @@ export class YepCodeApi { return this.request("POST", `/processes/${processId}/aliases`, { data }); } + async getProcessVersionAlias( + processId: string, + aliasId: string + ): Promise { + return this.request("GET", `/processes/${processId}/aliases/${aliasId}`); + } + + async updateProcessVersionAlias( + processId: string, + aliasId: string, + data: VersionedProcessAliasInput + ): Promise { + return this.request("PATCH", `/processes/${processId}/aliases/${aliasId}`, { data }); + } + + async deleteProcessVersionAlias( + processId: string, + aliasId: string + ): Promise { + return this.request("DELETE", `/processes/${processId}/aliases/${aliasId}`); + } + async getProcesses( params: { keywords?: string; @@ -439,6 +475,8 @@ export class YepCodeApi { processId?: string; status?: | "CREATED" + | "QUEUED" + | "DEQUEUED" | "RUNNING" | "FINISHED" | "KILLED" diff --git a/src/types/index.ts b/src/types/index.ts index 7c68c7c..895f8cc 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -43,6 +43,8 @@ export interface ExecutionData { export type ExecutionStatus = | "CREATED" + | "QUEUED" + | "DEQUEUED" | "RUNNING" | "FINISHED" | "KILLED" From 82766d039ba6f2299500dda0fec5b6d37b6e14e0 Mon Sep 17 00:00:00 2001 From: alvaro Date: Thu, 23 Oct 2025 14:19:26 +0200 Subject: [PATCH 2/4] Add missing updateSchedule --- src/api/yepcodeApi.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/api/yepcodeApi.ts b/src/api/yepcodeApi.ts index 0660131..9225e4e 100644 --- a/src/api/yepcodeApi.ts +++ b/src/api/yepcodeApi.ts @@ -354,7 +354,10 @@ export class YepCodeApi { processId: string, versionId: string ): Promise { - return this.request("DELETE", `/processes/${processId}/versions/${versionId}`); + return this.request( + "DELETE", + `/processes/${processId}/versions/${versionId}` + ); } async getProcessVersionAliases( @@ -387,7 +390,9 @@ export class YepCodeApi { aliasId: string, data: VersionedProcessAliasInput ): Promise { - return this.request("PATCH", `/processes/${processId}/aliases/${aliasId}`, { data }); + return this.request("PATCH", `/processes/${processId}/aliases/${aliasId}`, { + data, + }); } async deleteProcessVersionAlias( @@ -547,6 +552,13 @@ export class YepCodeApi { return this.request("PUT", `/schedules/${id}/resume`); } + async updateSchedule( + id: string, + data: ScheduledProcessInput + ): Promise { + return this.request("PATCH", `/schedules/${id}`, { data }); + } + async getVariables( params: { page?: number; @@ -636,9 +648,7 @@ export class YepCodeApi { return this.request("POST", `/modules/${moduleId}/aliases`, { data }); } - async getObjects( - params: { prefix?: string } = {} - ): Promise { + async getObjects(params: { prefix?: string } = {}): Promise { return this.request("GET", "/storage/objects", { params }); } From 8111c8a65c53628880b1e644b0c5bf6a06dbc4af Mon Sep 17 00:00:00 2001 From: alvaro Date: Thu, 23 Oct 2025 14:24:47 +0200 Subject: [PATCH 3/4] Add missing operations for modules --- src/api/types.ts | 7 +++++++ src/api/yepcodeApi.ts | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/src/api/types.ts b/src/api/types.ts index ba9c6d4..88e83ff 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -320,6 +320,8 @@ export interface Module { export interface CreateModuleInput { name: string; + programmingLanguage?: "JAVASCRIPT" | "PYTHON"; + sourceCode?: string; script?: { programmingLanguage?: string; sourceCode?: string; @@ -328,6 +330,7 @@ export interface CreateModuleInput { export interface UpdateModuleInput { name?: string; + sourceCode?: string; script?: { programmingLanguage?: string; sourceCode?: string; @@ -356,6 +359,10 @@ export interface VersionedModule { export interface PublishModuleInput { tag: string; comment?: string; + sourceCode?: string; + script?: { + sourceCode?: string; + }; } export interface VersionedModulesPaginatedResult { diff --git a/src/api/yepcodeApi.ts b/src/api/yepcodeApi.ts index 9225e4e..5a21d0b 100644 --- a/src/api/yepcodeApi.ts +++ b/src/api/yepcodeApi.ts @@ -630,6 +630,20 @@ export class YepCodeApi { return this.request("POST", `/modules/${moduleId}/versions`, { data }); } + async getModuleVersion( + moduleId: string, + versionId: string + ): Promise { + return this.request("GET", `/modules/${moduleId}/versions/${versionId}`); + } + + async deleteModuleVersion( + moduleId: string, + versionId: string + ): Promise { + return this.request("DELETE", `/modules/${moduleId}/versions/${versionId}`); + } + async getModuleVersionAliases( moduleId: string, params: { @@ -648,6 +662,30 @@ export class YepCodeApi { return this.request("POST", `/modules/${moduleId}/aliases`, { data }); } + async getModuleVersionAlias( + moduleId: string, + aliasId: string + ): Promise { + return this.request("GET", `/modules/${moduleId}/aliases/${aliasId}`); + } + + async updateModuleVersionAlias( + moduleId: string, + aliasId: string, + data: VersionedModuleAliasInput + ): Promise { + return this.request("PATCH", `/modules/${moduleId}/aliases/${aliasId}`, { + data, + }); + } + + async deleteModuleVersionAlias( + moduleId: string, + aliasId: string + ): Promise { + return this.request("DELETE", `/modules/${moduleId}/aliases/${aliasId}`); + } + async getObjects(params: { prefix?: string } = {}): Promise { return this.request("GET", "/storage/objects", { params }); } From 10cb6a1b05cb1e33d7fdefe3c01c8a4ff40ede90 Mon Sep 17 00:00:00 2001 From: alvaro Date: Thu, 23 Oct 2025 14:33:22 +0200 Subject: [PATCH 4/4] Add missing endpoints --- src/api/types.ts | 50 ++++++++++++++++++++++++++++++++++++++++--- src/api/yepcodeApi.ts | 37 +++++++++++++++++++++++++++----- 2 files changed, 79 insertions(+), 8 deletions(-) diff --git a/src/api/types.ts b/src/api/types.ts index 88e83ff..5853059 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -56,7 +56,15 @@ export interface Execution { id: string; processId: string; scheduledId?: string; - status: "CREATED" | "QUEUED" | "DEQUEUED" | "RUNNING" | "FINISHED" | "KILLED" | "REJECTED" | "ERROR"; + status: + | "CREATED" + | "QUEUED" + | "DEQUEUED" + | "RUNNING" + | "FINISHED" + | "KILLED" + | "REJECTED" + | "ERROR"; timeline?: ExecutionTimeline; parameters?: { [name: string]: { @@ -90,7 +98,15 @@ export interface ExecutionTimeline { events?: ExecutionTimelineEvent[]; } export interface ExecutionTimelineEvent { - status: "CREATED" | "QUEUED" | "DEQUEUED" | "RUNNING" | "FINISHED" | "KILLED" | "REJECTED" | "ERROR"; + status: + | "CREATED" + | "QUEUED" + | "DEQUEUED" + | "RUNNING" + | "FINISHED" + | "KILLED" + | "REJECTED" + | "ERROR"; timestamp: string; explanation?: string; } @@ -406,10 +422,38 @@ export type StorageObject = { contentType: string; createdAt: string; updatedAt: string; - link: URL; + link: string; }; export type CreateStorageObjectInput = { name: string; file: File | Blob | Readable; }; + +/** + * Auth + */ +export interface Token { + access_token: string; + expires_in: number; + token_type: string; + scope?: string; +} + +export interface ServiceAccountInput { + name: string; +} + +export interface ServiceAccount { + id: string; + createdAt: string; + updatedAt: string; + name: string; + clientId: string; + clientSecret: string; +} + +export interface ServiceAccountsListResult { + total: number; + data: ServiceAccount[]; +} diff --git a/src/api/yepcodeApi.ts b/src/api/yepcodeApi.ts index 5a21d0b..3b6074d 100644 --- a/src/api/yepcodeApi.ts +++ b/src/api/yepcodeApi.ts @@ -33,6 +33,10 @@ import { VersionedModuleAliasesPaginatedResult, StorageObject, CreateStorageObjectInput, + Token, + ServiceAccountInput, + ServiceAccount, + ServiceAccountsListResult, } from "./types"; import { Readable } from "stream"; @@ -690,8 +694,8 @@ export class YepCodeApi { return this.request("GET", "/storage/objects", { params }); } - async getObject(name: string): Promise { - return this.request("GET", `/storage/objects/${name}`, { + async getObject(filename: string): Promise { + return this.request("GET", `/storage/objects/${filename}`, { responseType: "stream", }); } @@ -728,15 +732,38 @@ export class YepCodeApi { return this.request( "POST", - `/storage/objects?name=${encodeURIComponent(data.name)}`, + `/storage/objects?filename=${encodeURIComponent(data.name)}`, options ); } - async deleteObject(name: string): Promise { + async deleteObject(filename: string): Promise { return this.request( "DELETE", - `/storage/objects/${encodeURIComponent(name)}` + `/storage/objects/${encodeURIComponent(filename)}` ); } + + // Auth endpoints + async getToken(apiToken: string): Promise { + return this.request("POST", "/auth/token", { + headers: { + "x-api-token": apiToken, + }, + }); + } + + async getAllServiceAccounts(): Promise { + return this.request("GET", "/auth/service-accounts"); + } + + async createServiceAccount( + data: ServiceAccountInput + ): Promise { + return this.request("POST", "/auth/service-accounts", { data }); + } + + async deleteServiceAccount(id: string): Promise { + return this.request("DELETE", `/auth/service-accounts/${id}`); + } }