@lunora/platform 1.0.0-alpha.27 → 1.0.0-alpha.28

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