@lunora/platform 1.0.0-alpha.27 → 1.0.0-alpha.29
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/index.d.mts +51 -14
- package/dist/index.d.ts +51 -14
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -163,6 +163,7 @@ interface AnalyticsEngineDataPointLike {
|
|
|
163
163
|
}
|
|
164
164
|
interface D1PreparedStatementLike {
|
|
165
165
|
all: <T = unknown>() => Promise<{
|
|
166
|
+
meta?: Record<string, unknown>;
|
|
166
167
|
results: T[];
|
|
167
168
|
success: boolean;
|
|
168
169
|
}>;
|
|
@@ -292,30 +293,53 @@ type KvNamespaceListResult<Metadata = unknown> = {
|
|
|
292
293
|
list_complete: true;
|
|
293
294
|
};
|
|
294
295
|
/**
|
|
295
|
-
* Minimal structural projection of `
|
|
296
|
+
* Minimal structural projection of `Vectorize` so unit tests can pass a
|
|
296
297
|
* plain-object double and the real Cloudflare binding satisfies the same shape.
|
|
297
298
|
* Mirrors the surface documented at
|
|
298
299
|
* https://developers.cloudflare.com/vectorize/reference/client-api/.
|
|
300
|
+
*
|
|
301
|
+
* **Method** syntax, not arrow properties: `ReadonlyArray` is the correct (wider)
|
|
302
|
+
* parameter type, but an arrow property makes parameters strictly contravariant
|
|
303
|
+
* under `strictFunctionTypes`, and Cloudflare declares `deleteByIds(ids: string[])`
|
|
304
|
+
* — so the real binding did not satisfy this interface at all. Methods are checked
|
|
305
|
+
* bivariantly, which admits both it and a `readonly`-clean double.
|
|
306
|
+
* `binding-assignability.test-d.ts` in `@lunora/bindings` pins that against the
|
|
307
|
+
* published types. `this: void` keeps the members usable as bare references, which
|
|
308
|
+
* is what every `expect(double.query)` assertion in those tests does.
|
|
299
309
|
*/
|
|
300
310
|
interface VectorizeIndexLike {
|
|
301
|
-
deleteByIds:
|
|
302
|
-
describe
|
|
303
|
-
getByIds:
|
|
304
|
-
insert:
|
|
305
|
-
query:
|
|
306
|
-
upsert:
|
|
311
|
+
deleteByIds(this: void, ids: ReadonlyArray<string>): Promise<VectorizeDeleteMutation>;
|
|
312
|
+
describe?(this: void): Promise<VectorizeIndexDetails>;
|
|
313
|
+
getByIds(this: void, ids: ReadonlyArray<string>): Promise<ReadonlyArray<VectorizeVector>>;
|
|
314
|
+
insert(this: void, vectors: ReadonlyArray<VectorizeVector>): Promise<VectorizeUpsertMutation>;
|
|
315
|
+
query(this: void, vector: VectorValues, options?: VectorizeQueryOptions): Promise<VectorizeMatches>;
|
|
316
|
+
upsert(this: void, vectors: ReadonlyArray<VectorizeVector>): Promise<VectorizeUpsertMutation>;
|
|
307
317
|
}
|
|
308
318
|
type VectorMetric = "cosine" | "euclidean" | "dot-product";
|
|
319
|
+
/**
|
|
320
|
+
* An embedding, as either a plain array or one of the typed arrays Vectorize
|
|
321
|
+
* accepts. The typed-array arms are not a convenience: Cloudflare's own
|
|
322
|
+
* `VectorizeVector.values` is `VectorFloatArray | number[]`, so a projection
|
|
323
|
+
* limited to `ReadonlyArray<number>` excluded every vector the real binding
|
|
324
|
+
* returns. Read one with `Array.from(...)` rather than an array method.
|
|
325
|
+
*/
|
|
326
|
+
type VectorValues = Float32Array | Float64Array | ReadonlyArray<number>;
|
|
309
327
|
interface VectorizeVector {
|
|
310
328
|
id: string;
|
|
311
329
|
metadata?: Record<string, unknown>;
|
|
312
330
|
namespace?: string;
|
|
313
|
-
values:
|
|
331
|
+
values: VectorValues;
|
|
314
332
|
}
|
|
333
|
+
/**
|
|
334
|
+
* Query options, kept a superset of Cloudflare's own `VectorizeQueryOptions` so
|
|
335
|
+
* the real binding satisfies {@link VectorizeIndexLike}. `returnMetadata` carries
|
|
336
|
+
* the legacy `boolean` arm for that reason - pass one of the three levels; the
|
|
337
|
+
* boolean is what Cloudflare still accepts, not what callers should write.
|
|
338
|
+
*/
|
|
315
339
|
interface VectorizeQueryOptions {
|
|
316
340
|
filter?: Record<string, unknown>;
|
|
317
341
|
namespace?: string;
|
|
318
|
-
returnMetadata?: "none" | "indexed" | "all";
|
|
342
|
+
returnMetadata?: "none" | "indexed" | "all" | boolean;
|
|
319
343
|
returnValues?: boolean;
|
|
320
344
|
topK?: number;
|
|
321
345
|
}
|
|
@@ -324,7 +348,7 @@ interface VectorizeMatch {
|
|
|
324
348
|
metadata?: Record<string, unknown>;
|
|
325
349
|
namespace?: string;
|
|
326
350
|
score: number;
|
|
327
|
-
values?:
|
|
351
|
+
values?: VectorValues;
|
|
328
352
|
}
|
|
329
353
|
interface VectorizeMatches {
|
|
330
354
|
count: number;
|
|
@@ -337,11 +361,24 @@ interface VectorizeDeleteMutation {
|
|
|
337
361
|
count?: number;
|
|
338
362
|
mutationId: string;
|
|
339
363
|
}
|
|
364
|
+
/**
|
|
365
|
+
* What `describe()` reports. Both spellings of the row count are optional because
|
|
366
|
+
* Cloudflare renamed it between API generations — the beta `VectorizeIndex`
|
|
367
|
+
* returns `vectorsCount`, the current `Vectorize` returns `vectorCount` — and a
|
|
368
|
+
* projection that required either one excluded a real binding. Read them as
|
|
369
|
+
* `vectorCount ?? vectorsCount`.
|
|
370
|
+
*
|
|
371
|
+
* `processedUpTo*` are typed loosely for the same reason: documented as ISO 8601
|
|
372
|
+
* strings, typed as `number` in `@cloudflare/workers-types`.
|
|
373
|
+
*/
|
|
340
374
|
interface VectorizeIndexDetails {
|
|
341
375
|
dimensions: number;
|
|
342
|
-
processedUpToDatetime?: string;
|
|
343
|
-
processedUpToMutation?: string;
|
|
344
|
-
|
|
376
|
+
processedUpToDatetime?: number | string;
|
|
377
|
+
processedUpToMutation?: number | string;
|
|
378
|
+
/** The current `Vectorize.describe()` spelling. */
|
|
379
|
+
vectorCount?: number;
|
|
380
|
+
/** The beta `VectorizeIndex.describe()` spelling. */
|
|
381
|
+
vectorsCount?: number;
|
|
345
382
|
}
|
|
346
383
|
/**
|
|
347
384
|
* A single-range read against R2: an `{ offset, length }` window (at least one
|
|
@@ -906,4 +943,4 @@ export { type AnalyticsEngineDataPoint, type AnalyticsEngineDataPointLike, type
|
|
|
906
943
|
* workerd, Node). It is intended to be the leaf dependency every other
|
|
907
944
|
* `@lunora/*` package can import without creating cycles.
|
|
908
945
|
*/
|
|
909
|
-
type ExecutionContextLike, type HttpCacheLike, type HttpCacheQueryOptions, type KVNamespaceLike, type KvGetOptions, type KvListKey, type KvNamespaceListResult, type KvNamespacePutOptions, type KvValue, type KvValueType, type MessageBatchLike, type MessageLike, type MessageSendRequestLike, NODE_CAPABILITIES, NOOP_EXECUTION_CONTEXT, type PlatformCapabilities, type QueueBindingLike, type QueueContentType, type QueueMessageLike, type QueueRetryOptions, type QueueSendBatchOptions, type QueueSendOptions, type QueueSendOptionsLike, type QueueSendRequestLike, type R2BucketLike, type R2MultipartUploadLike, type R2ObjectBodyLike, type R2ObjectLike, type R2RangeLike, type R2UploadedPartLike, type VectorMatchLike, type VectorMetric, type VectorRecordLike, type VectorizeDeleteMutation, type VectorizeIndexDetails, type VectorizeIndexLike, type VectorizeMatch, type VectorizeMatches, type VectorizeQueryOptions, type VectorizeUpsertMutation, type VectorizeVector };
|
|
946
|
+
type ExecutionContextLike, type HttpCacheLike, type HttpCacheQueryOptions, type KVNamespaceLike, type KvGetOptions, type KvListKey, type KvNamespaceListResult, type KvNamespacePutOptions, type KvValue, type KvValueType, type MessageBatchLike, type MessageLike, type MessageSendRequestLike, NODE_CAPABILITIES, NOOP_EXECUTION_CONTEXT, type PlatformCapabilities, type QueueBindingLike, type QueueContentType, type QueueMessageLike, type QueueRetryOptions, type QueueSendBatchOptions, type QueueSendOptions, type QueueSendOptionsLike, type QueueSendRequestLike, type R2BucketLike, type R2MultipartUploadLike, type R2ObjectBodyLike, type R2ObjectLike, type R2RangeLike, type R2UploadedPartLike, type VectorMatchLike, type VectorMetric, type VectorRecordLike, type VectorValues, type VectorizeDeleteMutation, type VectorizeIndexDetails, type VectorizeIndexLike, type VectorizeMatch, type VectorizeMatches, type VectorizeQueryOptions, type VectorizeUpsertMutation, type VectorizeVector };
|
package/dist/index.d.ts
CHANGED
|
@@ -163,6 +163,7 @@ interface AnalyticsEngineDataPointLike {
|
|
|
163
163
|
}
|
|
164
164
|
interface D1PreparedStatementLike {
|
|
165
165
|
all: <T = unknown>() => Promise<{
|
|
166
|
+
meta?: Record<string, unknown>;
|
|
166
167
|
results: T[];
|
|
167
168
|
success: boolean;
|
|
168
169
|
}>;
|
|
@@ -292,30 +293,53 @@ type KvNamespaceListResult<Metadata = unknown> = {
|
|
|
292
293
|
list_complete: true;
|
|
293
294
|
};
|
|
294
295
|
/**
|
|
295
|
-
* Minimal structural projection of `
|
|
296
|
+
* Minimal structural projection of `Vectorize` so unit tests can pass a
|
|
296
297
|
* plain-object double and the real Cloudflare binding satisfies the same shape.
|
|
297
298
|
* Mirrors the surface documented at
|
|
298
299
|
* https://developers.cloudflare.com/vectorize/reference/client-api/.
|
|
300
|
+
*
|
|
301
|
+
* **Method** syntax, not arrow properties: `ReadonlyArray` is the correct (wider)
|
|
302
|
+
* parameter type, but an arrow property makes parameters strictly contravariant
|
|
303
|
+
* under `strictFunctionTypes`, and Cloudflare declares `deleteByIds(ids: string[])`
|
|
304
|
+
* — so the real binding did not satisfy this interface at all. Methods are checked
|
|
305
|
+
* bivariantly, which admits both it and a `readonly`-clean double.
|
|
306
|
+
* `binding-assignability.test-d.ts` in `@lunora/bindings` pins that against the
|
|
307
|
+
* published types. `this: void` keeps the members usable as bare references, which
|
|
308
|
+
* is what every `expect(double.query)` assertion in those tests does.
|
|
299
309
|
*/
|
|
300
310
|
interface VectorizeIndexLike {
|
|
301
|
-
deleteByIds:
|
|
302
|
-
describe
|
|
303
|
-
getByIds:
|
|
304
|
-
insert:
|
|
305
|
-
query:
|
|
306
|
-
upsert:
|
|
311
|
+
deleteByIds(this: void, ids: ReadonlyArray<string>): Promise<VectorizeDeleteMutation>;
|
|
312
|
+
describe?(this: void): Promise<VectorizeIndexDetails>;
|
|
313
|
+
getByIds(this: void, ids: ReadonlyArray<string>): Promise<ReadonlyArray<VectorizeVector>>;
|
|
314
|
+
insert(this: void, vectors: ReadonlyArray<VectorizeVector>): Promise<VectorizeUpsertMutation>;
|
|
315
|
+
query(this: void, vector: VectorValues, options?: VectorizeQueryOptions): Promise<VectorizeMatches>;
|
|
316
|
+
upsert(this: void, vectors: ReadonlyArray<VectorizeVector>): Promise<VectorizeUpsertMutation>;
|
|
307
317
|
}
|
|
308
318
|
type VectorMetric = "cosine" | "euclidean" | "dot-product";
|
|
319
|
+
/**
|
|
320
|
+
* An embedding, as either a plain array or one of the typed arrays Vectorize
|
|
321
|
+
* accepts. The typed-array arms are not a convenience: Cloudflare's own
|
|
322
|
+
* `VectorizeVector.values` is `VectorFloatArray | number[]`, so a projection
|
|
323
|
+
* limited to `ReadonlyArray<number>` excluded every vector the real binding
|
|
324
|
+
* returns. Read one with `Array.from(...)` rather than an array method.
|
|
325
|
+
*/
|
|
326
|
+
type VectorValues = Float32Array | Float64Array | ReadonlyArray<number>;
|
|
309
327
|
interface VectorizeVector {
|
|
310
328
|
id: string;
|
|
311
329
|
metadata?: Record<string, unknown>;
|
|
312
330
|
namespace?: string;
|
|
313
|
-
values:
|
|
331
|
+
values: VectorValues;
|
|
314
332
|
}
|
|
333
|
+
/**
|
|
334
|
+
* Query options, kept a superset of Cloudflare's own `VectorizeQueryOptions` so
|
|
335
|
+
* the real binding satisfies {@link VectorizeIndexLike}. `returnMetadata` carries
|
|
336
|
+
* the legacy `boolean` arm for that reason - pass one of the three levels; the
|
|
337
|
+
* boolean is what Cloudflare still accepts, not what callers should write.
|
|
338
|
+
*/
|
|
315
339
|
interface VectorizeQueryOptions {
|
|
316
340
|
filter?: Record<string, unknown>;
|
|
317
341
|
namespace?: string;
|
|
318
|
-
returnMetadata?: "none" | "indexed" | "all";
|
|
342
|
+
returnMetadata?: "none" | "indexed" | "all" | boolean;
|
|
319
343
|
returnValues?: boolean;
|
|
320
344
|
topK?: number;
|
|
321
345
|
}
|
|
@@ -324,7 +348,7 @@ interface VectorizeMatch {
|
|
|
324
348
|
metadata?: Record<string, unknown>;
|
|
325
349
|
namespace?: string;
|
|
326
350
|
score: number;
|
|
327
|
-
values?:
|
|
351
|
+
values?: VectorValues;
|
|
328
352
|
}
|
|
329
353
|
interface VectorizeMatches {
|
|
330
354
|
count: number;
|
|
@@ -337,11 +361,24 @@ interface VectorizeDeleteMutation {
|
|
|
337
361
|
count?: number;
|
|
338
362
|
mutationId: string;
|
|
339
363
|
}
|
|
364
|
+
/**
|
|
365
|
+
* What `describe()` reports. Both spellings of the row count are optional because
|
|
366
|
+
* Cloudflare renamed it between API generations — the beta `VectorizeIndex`
|
|
367
|
+
* returns `vectorsCount`, the current `Vectorize` returns `vectorCount` — and a
|
|
368
|
+
* projection that required either one excluded a real binding. Read them as
|
|
369
|
+
* `vectorCount ?? vectorsCount`.
|
|
370
|
+
*
|
|
371
|
+
* `processedUpTo*` are typed loosely for the same reason: documented as ISO 8601
|
|
372
|
+
* strings, typed as `number` in `@cloudflare/workers-types`.
|
|
373
|
+
*/
|
|
340
374
|
interface VectorizeIndexDetails {
|
|
341
375
|
dimensions: number;
|
|
342
|
-
processedUpToDatetime?: string;
|
|
343
|
-
processedUpToMutation?: string;
|
|
344
|
-
|
|
376
|
+
processedUpToDatetime?: number | string;
|
|
377
|
+
processedUpToMutation?: number | string;
|
|
378
|
+
/** The current `Vectorize.describe()` spelling. */
|
|
379
|
+
vectorCount?: number;
|
|
380
|
+
/** The beta `VectorizeIndex.describe()` spelling. */
|
|
381
|
+
vectorsCount?: number;
|
|
345
382
|
}
|
|
346
383
|
/**
|
|
347
384
|
* A single-range read against R2: an `{ offset, length }` window (at least one
|
|
@@ -906,4 +943,4 @@ export { type AnalyticsEngineDataPoint, type AnalyticsEngineDataPointLike, type
|
|
|
906
943
|
* workerd, Node). It is intended to be the leaf dependency every other
|
|
907
944
|
* `@lunora/*` package can import without creating cycles.
|
|
908
945
|
*/
|
|
909
|
-
type ExecutionContextLike, type HttpCacheLike, type HttpCacheQueryOptions, type KVNamespaceLike, type KvGetOptions, type KvListKey, type KvNamespaceListResult, type KvNamespacePutOptions, type KvValue, type KvValueType, type MessageBatchLike, type MessageLike, type MessageSendRequestLike, NODE_CAPABILITIES, NOOP_EXECUTION_CONTEXT, type PlatformCapabilities, type QueueBindingLike, type QueueContentType, type QueueMessageLike, type QueueRetryOptions, type QueueSendBatchOptions, type QueueSendOptions, type QueueSendOptionsLike, type QueueSendRequestLike, type R2BucketLike, type R2MultipartUploadLike, type R2ObjectBodyLike, type R2ObjectLike, type R2RangeLike, type R2UploadedPartLike, type VectorMatchLike, type VectorMetric, type VectorRecordLike, type VectorizeDeleteMutation, type VectorizeIndexDetails, type VectorizeIndexLike, type VectorizeMatch, type VectorizeMatches, type VectorizeQueryOptions, type VectorizeUpsertMutation, type VectorizeVector };
|
|
946
|
+
type ExecutionContextLike, type HttpCacheLike, type HttpCacheQueryOptions, type KVNamespaceLike, type KvGetOptions, type KvListKey, type KvNamespaceListResult, type KvNamespacePutOptions, type KvValue, type KvValueType, type MessageBatchLike, type MessageLike, type MessageSendRequestLike, NODE_CAPABILITIES, NOOP_EXECUTION_CONTEXT, type PlatformCapabilities, type QueueBindingLike, type QueueContentType, type QueueMessageLike, type QueueRetryOptions, type QueueSendBatchOptions, type QueueSendOptions, type QueueSendOptionsLike, type QueueSendRequestLike, type R2BucketLike, type R2MultipartUploadLike, type R2ObjectBodyLike, type R2ObjectLike, type R2RangeLike, type R2UploadedPartLike, type VectorMatchLike, type VectorMetric, type VectorRecordLike, type VectorValues, type VectorizeDeleteMutation, type VectorizeIndexDetails, type VectorizeIndexLike, type VectorizeMatch, type VectorizeMatches, type VectorizeQueryOptions, type VectorizeUpsertMutation, type VectorizeVector };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/platform",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.29",
|
|
4
4
|
"description": "Provider-neutral host contracts for Lunora: shard/socket/directory/scheduler interfaces, binding projections, and the platform capability matrix",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|