Skip to content

Commit

Permalink
mandatory client for services
Browse files Browse the repository at this point in the history
  • Loading branch information
aboutphilippe committed Sep 12, 2024
1 parent 00a6012 commit 270f867
Show file tree
Hide file tree
Showing 16 changed files with 22 additions and 52 deletions.
2 changes: 1 addition & 1 deletion azure-speech/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@restackio/integrations-azurespeech",
"version": "0.0.4",
"version": "0.0.5",
"main": "dist/service.js",
"types": "dist/service.d.ts",
"scripts": {
Expand Down
8 changes: 2 additions & 6 deletions azure-speech/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,16 @@ export async function azureSpeechService({
maxConcurrentFunctionRuns: 1,
},
}: {
client?: Restack;
client: Restack;
options?: ServiceInput["options"];
}) {
if (!client) {
client = new Restack();
}

await client.startService({
taskQueue: azureSpeechTaskQueue,
functions: { azureSpeech },
options,
});
}

azureSpeechService({}).catch((err) => {
azureSpeechService({ client: new Restack() }).catch((err) => {
console.error("Error service:", err);
});
2 changes: 1 addition & 1 deletion cartesia/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@restackio/integrations-cartesia",
"version": "0.0.3",
"version": "0.0.4",
"main": "dist/service.js",
"types": "dist/service.d.ts",
"scripts": {
Expand Down
8 changes: 3 additions & 5 deletions cartesia/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,16 @@ export async function cartesiaService({
maxConcurrentFunctionRuns: 3,
},
}: {
client?: Restack;
client: Restack;
options?: ServiceInput["options"];
}) {
const restack = new Restack();

await restack.startService({
await client.startService({
taskQueue: cartesiaTaskQueue,
functions: { cartesiaTtsBytes },
options,
});
}

cartesiaService({}).catch((err) => {
cartesiaService({ client: new Restack() }).catch((err) => {
console.error("Error service:", err);
});
2 changes: 1 addition & 1 deletion deepgram/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@restackio/integrations-deepgram",
"version": "0.0.6",
"version": "0.0.7",
"main": "dist/service.js",
"types": "dist/service.d.ts",
"scripts": {
Expand Down
8 changes: 2 additions & 6 deletions deepgram/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,16 @@ export async function deepgramService({
maxConcurrentFunctionRuns: 100,
},
}: {
client?: Restack;
client: Restack;
options?: ServiceInput["options"];
}) {
if (!client) {
client = new Restack();
}

await client.startService({
taskQueue: deepgramTaskQueue,
functions: { deepgramListen, deepgramSpeak },
options,
});
}

deepgramService({}).catch((err) => {
deepgramService({ client: new Restack() }).catch((err) => {
console.error("Error service:", err);
});
2 changes: 1 addition & 1 deletion elevenlabs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@restackio/integrations-elevenlabs",
"version": "0.0.3",
"version": "0.0.4",
"main": "dist/service.js",
"types": "dist/service.d.ts",
"scripts": {
Expand Down
8 changes: 2 additions & 6 deletions elevenlabs/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,16 @@ export async function elevenlabsService({
maxConcurrentFunctionRuns: 2,
},
}: {
client?: Restack;
client: Restack;
options?: ServiceInput["options"];
}) {
if (!client) {
client = new Restack();
}

await client.startService({
taskQueue: elevenlabsTaskQueue,
functions: { elevenlabsConvert },
options,
});
}

elevenlabsService({}).catch((err) => {
elevenlabsService({ client: new Restack() }).catch((err) => {
console.error("Error service:", err);
});
2 changes: 1 addition & 1 deletion fal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@restackio/integrations-fal",
"version": "0.0.2",
"version": "0.0.3",
"main": "dist/service.js",
"types": "dist/service.d.ts",
"scripts": {
Expand Down
6 changes: 1 addition & 5 deletions fal/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ export async function falService({
client,
options,
}: {
client?: Restack;
client: Restack;
options?: ServiceInput["options"];
}) {
if (!client) {
client = new Restack();
}

await client.startService({
taskQueue: falTaskQueue,
functions: { falRun },
Expand Down
2 changes: 1 addition & 1 deletion openai/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@restackio/integrations-openai",
"version": "0.0.17",
"version": "0.0.18",
"main": "dist/service.js",
"types": "dist/service.d.ts",
"scripts": {
Expand Down
6 changes: 1 addition & 5 deletions openai/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@ export async function openaiService({
rateLimit: rpmToSecond(5000),
},
}: {
client?: Restack;
client: Restack;
options?: ServiceInput["options"];
}) {
if (!client) {
client = new Restack();
}

await client.startService({
taskQueue: openaiTaskQueue,
functions: { openaiChatCompletionsBase, openaiChatCompletionsStream },
Expand Down
2 changes: 1 addition & 1 deletion twilio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@restackio/integrations-twilio",
"version": "0.0.3",
"version": "0.0.4",
"main": "dist/service.js",
"types": "dist/service.d.ts",
"scripts": {
Expand Down
8 changes: 2 additions & 6 deletions twilio/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,16 @@ export async function twilioService({
rateLimit: 1,
},
}: {
client?: Restack;
client: Restack;
options?: ServiceInput["options"];
}) {
if (!client) {
client = new Restack();
}

await client.startService({
taskQueue: twilioTaskQueue,
functions: { twilioCall },
options,
});
}

twilioService({}).catch((err) => {
twilioService({ client: new Restack() }).catch((err) => {
console.error("Error service:", err);
});
2 changes: 1 addition & 1 deletion websocket/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@restackio/integrations-websocket",
"version": "0.0.10",
"version": "0.0.11",
"main": "dist/service.js",
"types": "dist/service.d.ts",
"scripts": {
Expand Down
6 changes: 1 addition & 5 deletions websocket/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ export async function websocketService({
client,
options,
}: {
client?: Restack;
client: Restack;
options?: ServiceInput["options"];
}) {
if (!client) {
client = new Restack();
}

await client.startService({
taskQueue: websocketTaskQueue,
functions: { websocketListen, websocketSend },
Expand Down

0 comments on commit 270f867

Please sign in to comment.