@midsummer-ai/sdk 0.1.0-staging.4612 → 0.1.0-staging.4618

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.
@@ -3,7 +3,7 @@ import { p as Storage } from "../index-CXiY5knc.mjs";
3
3
  import { t as AuthConfig } from "../auth-B7rCtXFQ.mjs";
4
4
  import { a as FileMetadata, c as FunctionReference, d as HttpRouter, n as CronJob, s as FunctionKind, v as RegisteredFunction, y as Row } from "../server-B5HK2Ou9.mjs";
5
5
  import { r as Built } from "../build-DX7RUtzJ.mjs";
6
- import { A as VectorControl, M as VectorEngine } from "../index-5INBK1BU.mjs";
6
+ import { A as VectorControl, M as VectorEngine } from "../index-BrmPAujV.mjs";
7
7
  //#region src/database/stand-in.d.ts
8
8
  /** A Database as its client reaches it: by function name or reference. A refusal throws `DatabaseError`. */
9
9
  interface DatabaseClient {
package/here-C2jhTheQ.mjs CHANGED
@@ -12,7 +12,7 @@ function processEnv() {
12
12
  * This package's version: `0.0.0-dev` here, and in a published package the version it was published at, which the
13
13
  * release writes in its place as it stages the package (`stampSdk` in `scripts/release/packages.ts`).
14
14
  */
15
- const SDK_VERSION = "0.1.0-staging.4612";
15
+ const SDK_VERSION = "0.1.0-staging.4618";
16
16
  /**
17
17
  * The header that tells Midsummer which client made each of this package's calls: `Midsummer-Client: sdk/<version>
18
18
  * <part>`, `part` the product whose client it is (`database`, `storage`, `queues`, ...), so the platform counts which
@@ -442,7 +442,8 @@ interface VectorControl {
442
442
  drop(namespace: string): Promise<void>;
443
443
  }
444
444
  /**
445
- * The namespace the environment binds under `name`, from code in a deployment in any framework.
445
+ * The namespace the environment binds under `name`, from code in a deployment in any framework, or in a CI run whose
446
+ * workflow runs in that environment (`# environment:`).
446
447
  * Tests use `vectorDb(standIn())` instead.
447
448
  */
448
449
  declare function namespace(name: string): Namespace;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midsummer-ai/sdk",
3
- "version": "0.1.0-staging.4612",
3
+ "version": "0.1.0-staging.4618",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "Midsummer's handles for an app's code: its Database, Storage, Queues, Vector DB, AI, Email and Agents, with stand-ins for tests.",
@@ -1,4 +1,4 @@
1
- import { A as VectorControl, M as VectorEngine } from "../index-5INBK1BU.mjs";
1
+ import { A as VectorControl, M as VectorEngine } from "../index-BrmPAujV.mjs";
2
2
  //#region src/vector/contract.d.ts
3
3
  interface VectorContractCase {
4
4
  /** A line of the specification. */
@@ -1,2 +1,2 @@
1
- import { A as VectorControl, B as MAX_METADATA_BYTES, C as QueryOptions, D as ValuesEngine, E as TextVector, F as namespace, H as MAX_TEXT, I as vectorDb, J as direct, K as Transport, L as MAX_BATCH, M as VectorEngine, N as connect, O as ValuesMultiQuery, P as embedded, R as MAX_DIMENSION, S as NamespaceInfo, T as TextSearchOptions, U as MAX_TOP_K, V as MAX_QUERIES, W as MAX_VALUE, _ as Metric, a as Consistency, b as MultiQueryResult, c as EngineMultiQuery, d as EngineTextSearch, et as VectorError, f as Filter, g as MetadataValue, h as Match, i as Condition, j as VectorDb, k as Vector, l as EnginePart, m as Listed, n as AggregateGroup, nt as vectorErrorCodes, o as EngineAggregate, p as ListOptions, r as AggregateOptions, s as EngineList, t as Aggregate, tt as VectorErrorCode, u as EngineQuery, v as MultiQueryOptions, w as Scalar, x as Namespace, y as MultiQueryPart, z as MAX_FULL_TEXT } from "../index-5INBK1BU.mjs";
1
+ import { A as VectorControl, B as MAX_METADATA_BYTES, C as QueryOptions, D as ValuesEngine, E as TextVector, F as namespace, H as MAX_TEXT, I as vectorDb, J as direct, K as Transport, L as MAX_BATCH, M as VectorEngine, N as connect, O as ValuesMultiQuery, P as embedded, R as MAX_DIMENSION, S as NamespaceInfo, T as TextSearchOptions, U as MAX_TOP_K, V as MAX_QUERIES, W as MAX_VALUE, _ as Metric, a as Consistency, b as MultiQueryResult, c as EngineMultiQuery, d as EngineTextSearch, et as VectorError, f as Filter, g as MetadataValue, h as Match, i as Condition, j as VectorDb, k as Vector, l as EnginePart, m as Listed, n as AggregateGroup, nt as vectorErrorCodes, o as EngineAggregate, p as ListOptions, r as AggregateOptions, s as EngineList, t as Aggregate, tt as VectorErrorCode, u as EngineQuery, v as MultiQueryOptions, w as Scalar, x as Namespace, y as MultiQueryPart, z as MAX_FULL_TEXT } from "../index-BrmPAujV.mjs";
2
2
  export { Aggregate, AggregateGroup, AggregateOptions, Condition, Consistency, EngineAggregate, EngineList, EngineMultiQuery, EnginePart, EngineQuery, EngineTextSearch, Filter, ListOptions, Listed, MAX_BATCH, MAX_DIMENSION, MAX_FULL_TEXT, MAX_METADATA_BYTES, MAX_QUERIES, MAX_TEXT, MAX_TOP_K, MAX_VALUE, Match, MetadataValue, Metric, MultiQueryOptions, MultiQueryPart, MultiQueryResult, Namespace, NamespaceInfo, QueryOptions, Scalar, TextSearchOptions, TextVector, type Transport, ValuesEngine, ValuesMultiQuery, Vector, VectorControl, VectorDb, VectorEngine, VectorError, type VectorErrorCode, connect, direct, embedded, namespace, vectorDb, vectorErrorCodes };
package/vector/index.mjs CHANGED
@@ -50,13 +50,19 @@ import { C as Vectors, E as vectorErrorCodes, S as TextSearch, T as VectorError,
50
50
  * `code` tells you which kind, and is the same code the wire carries.
51
51
  */
52
52
  /**
53
- * The namespace the environment binds under `name`, from code in a deployment in any framework.
53
+ * The namespace the environment binds under `name`, from code in a deployment in any framework, or in a CI run whose
54
+ * workflow runs in that environment (`# environment:`).
54
55
  * Tests use `vectorDb(standIn())` instead.
55
56
  */
56
57
  function namespace(name) {
57
58
  return vectorDb(late(() => {
58
59
  const handle = here()?.vector;
59
60
  if (handle) return remote(handle);
61
+ const { MIDSUMMER_VECTOR_KEY: key, MIDSUMMER_VECTOR_ORIGIN: origin } = processEnv();
62
+ if (key && origin) return remote(direct({
63
+ key,
64
+ origin
65
+ }));
60
66
  if (processEnv().MIDSUMMER_DEV === "1" || here()?.env?.MIDSUMMER_DEV === "1") throw new VectorError("forbidden", "midsummer dev has no Vector DB stand-in yet, so namespace() reaches nothing here. Try it on a preview: midsummer ship <team>/<project>. Or reach a real namespace with a Vector key: connect({ key, origin }), the key from midsummer vector key create <team>.");
61
67
  throw new VectorError("forbidden", "This code runs outside a deployment, so no environment binds a Vector DB namespace for it.");
62
68
  })).namespace(name);
@@ -1,4 +1,4 @@
1
- import { A as VectorControl, M as VectorEngine } from "../index-5INBK1BU.mjs";
1
+ import { A as VectorControl, M as VectorEngine } from "../index-BrmPAujV.mjs";
2
2
  //#region src/vector/stand-in.d.ts
3
3
  /**
4
4
  * A text's Stand-in embedding of `dimension` numbers: each word (letters and digits, in lower case)
package/vector/wire.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as serve, G as Places, J as direct, K as Transport, Q as scoped, X as places, Y as encode, Z as remote, q as decode } from "../index-5INBK1BU.mjs";
1
+ import { $ as serve, G as Places, J as direct, K as Transport, Q as scoped, X as places, Y as encode, Z as remote, q as decode } from "../index-BrmPAujV.mjs";
2
2
  export { Places, Transport, decode, direct, encode, places, remote, scoped, serve };