@concavejs/runtime-cf-base 0.0.1-alpha.5 → 0.0.1-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/env.d.ts +19 -0
- package/dist/env.js +6 -0
- package/dist/http/dx-http.d.ts +16 -1
- package/dist/http/dx-http.js +21 -0
- package/dist/http/http-api.d.ts +6 -0
- package/dist/http/http-api.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/udf/executor/index.d.ts +0 -1
- package/dist/udf/executor/index.js +0 -1
- package/dist/worker/udf-worker.d.ts +11 -0
- package/package.json +7 -6
package/dist/env.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical environment type definitions for Concave Cloudflare Workers runtimes.
|
|
3
|
+
*
|
|
4
|
+
* Users can extend these interfaces via intersection types to add their own bindings.
|
|
5
|
+
*/
|
|
6
|
+
/** Core bindings required by every Concave Cloudflare worker. */
|
|
7
|
+
export interface ConcaveEnv {
|
|
8
|
+
CONCAVE_DO: DurableObjectNamespace;
|
|
9
|
+
SYNC_DO: DurableObjectNamespace;
|
|
10
|
+
}
|
|
11
|
+
/** Bindings for R2-backed blob storage. */
|
|
12
|
+
export interface ConcaveStorageEnv {
|
|
13
|
+
STORAGE_BUCKET: R2Bucket;
|
|
14
|
+
R2_PUBLIC_URL?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Bindings for D1-backed docstore. */
|
|
17
|
+
export interface ConcaveD1Env {
|
|
18
|
+
DB: D1Database;
|
|
19
|
+
}
|
package/dist/env.js
ADDED
package/dist/http/dx-http.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DocStore, DocumentLogEntry, DatabaseIndexUpdate, InternalDocumentId, Interval, Order, TimestampRange, GlobalKey, DocumentPrevTsQuery, LatestDocument, IndexKeyBytes,
|
|
1
|
+
import type { DocStore, DocumentLogEntry, DatabaseIndexUpdate, InternalDocumentId, Interval, Order, TimestampRange, GlobalKey, DocumentPrevTsQuery, LatestDocument, IndexKeyBytes, SearchIndexDefinition, VectorIndexDefinition } from "@concavejs/core/docstore";
|
|
2
2
|
import type { JSONValue as JsonValue } from "convex/values";
|
|
3
3
|
export declare class HttpDocStore implements DocStore {
|
|
4
4
|
private readonly url;
|
|
@@ -24,5 +24,20 @@ export declare class HttpDocStore implements DocStore {
|
|
|
24
24
|
get(id: InternalDocumentId, readTimestamp?: bigint): Promise<LatestDocument | null>;
|
|
25
25
|
count(table: string): Promise<number>;
|
|
26
26
|
scan(table: string, readTimestamp?: bigint): Promise<LatestDocument[]>;
|
|
27
|
+
scanPaginated(tableId: string, cursor: string | null, limit: number, order: Order, readTimestamp?: bigint): Promise<{
|
|
28
|
+
documents: LatestDocument[];
|
|
29
|
+
nextCursor: string | null;
|
|
30
|
+
hasMore: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
search(indexId: string, searchQuery: string, filters: Map<string, unknown>, options?: {
|
|
33
|
+
limit?: number;
|
|
34
|
+
}): Promise<{
|
|
35
|
+
doc: LatestDocument;
|
|
36
|
+
score: number;
|
|
37
|
+
}[]>;
|
|
38
|
+
vectorSearch(indexId: string, vector: number[], limit: number, filters: Map<string, string>): Promise<{
|
|
39
|
+
doc: LatestDocument;
|
|
40
|
+
score: number;
|
|
41
|
+
}[]>;
|
|
27
42
|
}
|
|
28
43
|
export declare function handleRequest(docstore: DocStore, request: Request): Promise<Response>;
|
package/dist/http/dx-http.js
CHANGED
|
@@ -191,6 +191,27 @@ export class HttpDocStore {
|
|
|
191
191
|
}
|
|
192
192
|
return deserialize(await response.text());
|
|
193
193
|
}
|
|
194
|
+
async scanPaginated(tableId, cursor, limit, order, readTimestamp) {
|
|
195
|
+
const response = await this.post("scanPaginated", { tableId, cursor, limit, order, readTimestamp });
|
|
196
|
+
if (!response.ok) {
|
|
197
|
+
throw new Error(`scanPaginated failed: ${await response.text()}`);
|
|
198
|
+
}
|
|
199
|
+
return deserialize(await response.text());
|
|
200
|
+
}
|
|
201
|
+
async search(indexId, searchQuery, filters, options) {
|
|
202
|
+
const response = await this.post("search", { indexId, searchQuery, filters, options });
|
|
203
|
+
if (!response.ok) {
|
|
204
|
+
throw new Error(`search failed: ${await response.text()}`);
|
|
205
|
+
}
|
|
206
|
+
return deserialize(await response.text());
|
|
207
|
+
}
|
|
208
|
+
async vectorSearch(indexId, vector, limit, filters) {
|
|
209
|
+
const response = await this.post("vectorSearch", { indexId, vector, limit, filters });
|
|
210
|
+
if (!response.ok) {
|
|
211
|
+
throw new Error(`vectorSearch failed: ${await response.text()}`);
|
|
212
|
+
}
|
|
213
|
+
return deserialize(await response.text());
|
|
214
|
+
}
|
|
194
215
|
}
|
|
195
216
|
// Server-side request handler
|
|
196
217
|
export async function handleRequest(docstore, request) {
|
package/dist/http/http-api.d.ts
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
+
/** Minimal Env shape needed by the HTTP API handler */
|
|
2
|
+
interface Env {
|
|
3
|
+
CONCAVE_DO: DurableObjectNamespace;
|
|
4
|
+
SYNC_DO: DurableObjectNamespace;
|
|
5
|
+
}
|
|
1
6
|
export declare function handleHttpApiRequest(request: Request, env: Env, ctx: ExecutionContext, instance?: string): Promise<Response>;
|
|
7
|
+
export {};
|
package/dist/http/http-api.js
CHANGED
|
@@ -217,7 +217,7 @@ export async function handleHttpApiRequest(request, env, ctx, instance = "single
|
|
|
217
217
|
}
|
|
218
218
|
const result = await adapter.executeUdf(udfPath, mergedArgs, udfType, authForExecution);
|
|
219
219
|
if ((udfType === "mutation" || udfType === "action") && result.writtenRanges?.length) {
|
|
220
|
-
await notifyWrites(result.writtenRanges, result.
|
|
220
|
+
await notifyWrites(result.writtenRanges, writtenTablesFromRanges(result.writtenRanges));
|
|
221
221
|
}
|
|
222
222
|
return apply(Response.json({
|
|
223
223
|
status: "success",
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "@concavejs/core";
|
|
2
|
+
export type { ConcaveEnv, ConcaveStorageEnv, ConcaveD1Env } from "./env";
|
|
2
3
|
export { UdfExecutorRpc } from "./worker/udf-worker";
|
|
3
4
|
export { createConcaveWorker, resolveNamespaceBinding, createScopedNamespace, type ConcaveWorkerOptions, type ConcaveWorkerBindings, type ConcaveWorker, } from "./worker/create-concave-worker";
|
|
4
5
|
export { DEFAULT_INSTANCE_KEY, DEFAULT_INSTANCE_VALUE, DEFAULT_INSTANCE_COOKIE_PATH, resolveInstanceFromRequest, maybeAttachInstanceCookie, readCookieValue, buildInstanceCookie, type InstanceResolution, type InstanceResolutionOptions, type InstanceCookieOptions, } from "./routing/instance";
|
|
@@ -12,4 +13,5 @@ export { ConcaveDOUdfExecutor } from "./sync/concave-do-udf-executor";
|
|
|
12
13
|
export { SHIM_SOURCE } from "./udf/executor/shim-content";
|
|
13
14
|
export { DODocStore } from "@concavejs/docstore-cf-do";
|
|
14
15
|
export { D1DocStore } from "@concavejs/docstore-cf-d1";
|
|
16
|
+
export { HyperdriveDocStore } from "@concavejs/docstore-cf-hyperdrive";
|
|
15
17
|
export { R2BlobStore } from "@concavejs/blobstore-cf-r2";
|
package/dist/index.js
CHANGED
|
@@ -22,4 +22,5 @@ export { SHIM_SOURCE } from "./udf/executor/shim-content";
|
|
|
22
22
|
// Export CF-specific DocStore implementations
|
|
23
23
|
export { DODocStore } from "@concavejs/docstore-cf-do";
|
|
24
24
|
export { D1DocStore } from "@concavejs/docstore-cf-d1";
|
|
25
|
+
export { HyperdriveDocStore } from "@concavejs/docstore-cf-hyperdrive";
|
|
25
26
|
export { R2BlobStore } from "@concavejs/blobstore-cf-r2";
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { WorkerEntrypoint } from "cloudflare:workers";
|
|
2
|
+
/** Minimal Env shape needed by the UDF Worker */
|
|
3
|
+
interface Env {
|
|
4
|
+
CONCAVE_DO?: DurableObjectNamespace;
|
|
5
|
+
SYNC_DO?: DurableObjectNamespace;
|
|
6
|
+
DB: D1Database;
|
|
7
|
+
VECTORIZE_INDEX?: VectorizeIndex;
|
|
8
|
+
STORAGE_BUCKET?: R2Bucket;
|
|
9
|
+
R2_PUBLIC_URL?: string;
|
|
10
|
+
CONCAVE_INSTANCE?: string;
|
|
11
|
+
}
|
|
2
12
|
/**
|
|
3
13
|
* RPC entrypoint for executing UDFs in an isolated worker.
|
|
4
14
|
*
|
|
@@ -12,3 +22,4 @@ export declare class UdfExecutorRpc extends WorkerEntrypoint {
|
|
|
12
22
|
execute(path: string, args: Record<string, any>, type: "query" | "mutation" | "action", auth?: any, componentPath?: string, requestId?: string, _instance?: string, _projectId?: string): Promise<import("@concavejs/core").UdfResult>;
|
|
13
23
|
executeHttp(request: Request, auth?: any, requestId?: string, _instance?: string, _projectId?: string): Promise<Response>;
|
|
14
24
|
}
|
|
25
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@concavejs/runtime-cf-base",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.6",
|
|
4
4
|
"license": "FSL-1.1-Apache-2.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -81,11 +81,12 @@
|
|
|
81
81
|
"test": "bun test --run --passWithNoTests || true"
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@concavejs/core": "0.0.1-alpha.
|
|
85
|
-
"@concavejs/runtime-base": "0.0.1-alpha.
|
|
86
|
-
"@concavejs/docstore-cf-do": "0.0.1-alpha.
|
|
87
|
-
"@concavejs/docstore-cf-d1": "0.0.1-alpha.
|
|
88
|
-
"@concavejs/
|
|
84
|
+
"@concavejs/core": "0.0.1-alpha.6",
|
|
85
|
+
"@concavejs/runtime-base": "0.0.1-alpha.6",
|
|
86
|
+
"@concavejs/docstore-cf-do": "0.0.1-alpha.6",
|
|
87
|
+
"@concavejs/docstore-cf-d1": "0.0.1-alpha.6",
|
|
88
|
+
"@concavejs/docstore-cf-hyperdrive": "0.0.1-alpha.6",
|
|
89
|
+
"@concavejs/blobstore-cf-r2": "0.0.1-alpha.6",
|
|
89
90
|
"convex": "^1.27.3"
|
|
90
91
|
},
|
|
91
92
|
"devDependencies": {
|