Skip to content

Commit b4436a1

Browse files
committed
Omit worker script in list
1 parent 663f360 commit b4436a1

5 files changed

Lines changed: 6 additions & 7 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish to npm
1+
name: Publish @openworkers/api-types to npm
22

33
on:
44
push:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openworkers-api",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"license": "MIT",
55
"module": "src/index.ts",
66
"type": "module",

src/routes/workers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ workers.get('/', async (c) => {
2828

2929
try {
3030
const workers = await workersService.findAll(userId);
31-
return jsonArrayResponse(c, WorkerSchema, workers);
31+
return jsonArrayResponse(c, WorkerSchema.omit({ script: true }), workers);
3232
} catch (error) {
3333
console.error('Failed to fetch workers:', error);
3434
return c.json({ error: 'Failed to fetch workers' }, 500);

src/services/db/workers.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ interface WorkerRow {
1515
domains?: IWorker['domains'];
1616
}
1717

18-
export async function findAllWorkers(userId: string): Promise<IWorker[]> {
19-
return sql<WorkerRow>(
18+
export async function findAllWorkers(userId: string): Promise<Omit<IWorker, 'script'>[]> {
19+
return sql<Omit<WorkerRow, 'script'>>(
2020
`SELECT
2121
id,
2222
name,
23-
script,
2423
language::text as language,
2524
user_id as "userId",
2625
environment_id as "environmentId",

src/services/workers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as db from './db';
22
import type { IWorker, IWorkerCreateInput, IWorkerUpdateInput } from '../types';
33

44
export class WorkersService {
5-
async findAll(userId: string): Promise<IWorker[]> {
5+
async findAll(userId: string): Promise<Omit<IWorker, 'script'>[]> {
66
return db.findAllWorkers(userId);
77
}
88

0 commit comments

Comments
 (0)