Skip to content

Commit 7615530

Browse files
committed
Release 0.1.4
1 parent da9b1da commit 7615530

File tree

2 files changed

+2
-136
lines changed

2 files changed

+2
-136
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@outerbase/starbasedb",
3-
"version": "0.1.0",
3+
"version": "0.1.4",
44
"files": [
55
"src",
66
"dist",
@@ -23,6 +23,7 @@
2323
"deploy": "wrangler deploy",
2424
"dev": "wrangler dev",
2525
"start": "wrangler dev",
26+
"publish-npm-module": "npm publish --access public",
2627
"cf-typegen": "wrangler types",
2728
"delete": "wrangler delete",
2829
"prepare": "husky"

src/do.ts

Lines changed: 0 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
import { DurableObject } from 'cloudflare:workers'
2-
// import { OperationQueueItem } from "./operation";
3-
// import { createResponse } from "./utils";
42

53
export class StarbaseDBDurableObject extends DurableObject {
64
// Durable storage for the SQL database
75
public sql: SqlStorage
86
public storage: DurableObjectStorage
97

10-
// // Queue of operations to be processed, with each operation containing a list of queries to be executed
11-
// private operationQueue: Array<OperationQueueItem> = [];
12-
13-
// // Flag to indicate if an operation is currently being processed
14-
// private processingOperation: { value: boolean } = { value: false };
15-
168
/**
179
* The constructor is invoked once upon creation of the Durable Object, i.e. the first call to
1810
* `DurableObjectStub::get` for a given identifier (no-op constructors can be omitted)
@@ -73,44 +65,6 @@ export class StarbaseDBDurableObject extends DurableObject {
7365
}
7466
}
7567

76-
// TODO: Hiding for now as it's not used in the current implementation
77-
// /**
78-
// * Execute a raw SQL query on the database, typically used for external requests
79-
// * from other service bindings (e.g. auth). This serves as an exposed function for
80-
// * other service bindings to query the database without having to have knowledge of
81-
// * the current operation queue or processing state.
82-
// *
83-
// * @param sql - The SQL query to execute.
84-
// * @param params - Optional parameters for the SQL query.
85-
// * @returns A response containing the query result or an error message.
86-
// */
87-
// private async executeExternalQuery(
88-
// sql: string,
89-
// params: any[] | undefined
90-
// ): Promise<any> {
91-
// try {
92-
// const queries = [{ sql, params }];
93-
// const response = await this.enqueueOperation(
94-
// queries,
95-
// false,
96-
// false,
97-
// this.operationQueue,
98-
// () =>
99-
// this.processNextOperation(
100-
// this.sql,
101-
// this.operationQueue,
102-
// this.ctx,
103-
// this.processingOperation
104-
// )
105-
// );
106-
107-
// return response;
108-
// } catch (error: any) {
109-
// console.error("Execute External Query Error:", error);
110-
// return null;
111-
// }
112-
// }
113-
11468
private async executeRawQuery<
11569
T extends Record<string, SqlStorageValue> = Record<
11670
string,
@@ -177,93 +131,4 @@ export class StarbaseDBDurableObject extends DurableObject {
177131
}
178132
})
179133
}
180-
181-
// TODO: Hiding for now as it's not used in the current implementation
182-
// private enqueueOperation(
183-
// queries: { sql: string; params?: any[] }[],
184-
// isTransaction: boolean,
185-
// isRaw: boolean,
186-
// operationQueue: any[],
187-
// processNextOperation: () => Promise<void>
188-
// ): Promise<{ result?: any; error?: string | undefined; status: number }> {
189-
// const MAX_WAIT_TIME = 25000;
190-
// return new Promise((resolve, reject) => {
191-
// const timeout = setTimeout(() => {
192-
// reject(createResponse(undefined, "Operation timed out.", 503));
193-
// }, MAX_WAIT_TIME);
194-
195-
// operationQueue.push({
196-
// queries,
197-
// isTransaction,
198-
// isRaw,
199-
// resolve: (value: any) => {
200-
// clearTimeout(timeout);
201-
202-
// resolve({
203-
// result: value,
204-
// error: undefined,
205-
// status: 200,
206-
// });
207-
// },
208-
// reject: (reason?: any) => {
209-
// clearTimeout(timeout);
210-
211-
// reject({
212-
// result: undefined,
213-
// error: reason ?? "Operation failed.",
214-
// status: 500,
215-
// });
216-
// },
217-
// });
218-
219-
// processNextOperation().catch((err) => {
220-
// console.error("Error processing operation queue:", err);
221-
// });
222-
// });
223-
// }
224-
225-
// TODO: Hiding for now as it's not used in the current implementation
226-
// private async processNextOperation(
227-
// sqlInstance: any,
228-
// operationQueue: OperationQueueItem[],
229-
// ctx: any,
230-
// processingOperation: { value: boolean }
231-
// ) {
232-
// if (processingOperation.value) {
233-
// // Already processing an operation
234-
// return;
235-
// }
236-
237-
// if (operationQueue.length === 0) {
238-
// // No operations remaining to process
239-
// return;
240-
// }
241-
242-
// processingOperation.value = true;
243-
// const { queries, isTransaction, isRaw, resolve, reject } =
244-
// operationQueue.shift()!;
245-
246-
// try {
247-
// let result;
248-
249-
// if (isTransaction) {
250-
// result = await this.executeTransaction(queries, isRaw);
251-
// } else {
252-
// const { sql, params } = queries[0];
253-
// result = this.executeQuery({ sql, params });
254-
// }
255-
256-
// resolve(result);
257-
// } catch (error: any) {
258-
// reject(error.message || "Operation failed.");
259-
// } finally {
260-
// processingOperation.value = false;
261-
// await this.processNextOperation(
262-
// sqlInstance,
263-
// operationQueue,
264-
// ctx,
265-
// processingOperation
266-
// );
267-
// }
268-
// }
269134
}

0 commit comments

Comments
 (0)