@n-dream/builders-sdk 0.2.1 → 0.2.3

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/README.md CHANGED
@@ -13,7 +13,7 @@ Apps import the package as `@builders/sdk`. Use an npm alias in
13
13
 
14
14
  ```json
15
15
  "dependencies": {
16
- "@builders/sdk": "npm:@n-dream/builders-sdk@^0.2.1"
16
+ "@builders/sdk": "npm:@n-dream/builders-sdk@^0.2.2"
17
17
  }
18
18
  ```
19
19
 
@@ -25,6 +25,7 @@ later.
25
25
  ```ts
26
26
  import { currentUser } from "@builders/sdk/next"; // server code only
27
27
  import { db, ai, storage, notify, secrets } from "@builders/sdk";
28
+ import { z } from "zod";
28
29
 
29
30
  const user = await currentUser(); // { email, name }
30
31
  const notes = db.collection<{ text: string; author: string }>("notes");
@@ -1,6 +1,7 @@
1
1
  // ../core/src/identity-token.ts
2
2
  var IDENTITY_HEADER = "x-builders-identity";
3
3
  var DEV_USER_HEADER = "x-builders-dev-user";
4
+ var SIGN_OUT_PATH = "/_builders/sign-out";
4
5
  var IDENTITY_ALG = "ES256";
5
6
  var IDENTITY_TOKEN_TTL_S = 60;
6
7
  var IDENTITY_CLOCK_TOLERANCE_S = 30;
@@ -125,6 +126,7 @@ function readHeader(headers, name) {
125
126
 
126
127
  export {
127
128
  IDENTITY_HEADER,
129
+ SIGN_OUT_PATH,
128
130
  BuildersError,
129
131
  NotSignedInError,
130
132
  NotFoundError,
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ declare const ADDONS: readonly ["ai", "storage", "cron", "notify", "internet"];
6
6
  type AddOn = (typeof ADDONS)[number];
7
7
 
8
8
  declare const IDENTITY_HEADER = "x-builders-identity";
9
+ declare const SIGN_OUT_PATH = "/_builders/sign-out";
9
10
 
10
11
  declare const CLAUDE_MODELS: {
11
12
  readonly fast: "claude-haiku-5-5";
@@ -162,5 +163,5 @@ declare class NotOnBuildersError extends BuildersError {
162
163
  constructor(what: string);
163
164
  }
164
165
 
165
- export { AddOnNotEnabledError, BuildersError, IDENTITY_HEADER, MAX_QUERY_LIMIT, NotFoundError, NotOnBuildersError, NotSignedInError, ai, db, dbMode, notify, secrets, storage };
166
+ export { AddOnNotEnabledError, BuildersError, IDENTITY_HEADER, MAX_QUERY_LIMIT, NotFoundError, NotOnBuildersError, NotSignedInError, SIGN_OUT_PATH, ai, db, dbMode, notify, secrets, storage };
166
167
  export type { AiModel, AskOptions, Attachment, ChatResult, Collection, DbMode, Doc, GeneratedImage, ImageOptions, JsonOptions, Message, Query, SpeakOptions, TranscribeOptions, WhereOp };
package/dist/index.js CHANGED
@@ -4,9 +4,10 @@ import {
4
4
  IDENTITY_HEADER,
5
5
  NotFoundError,
6
6
  NotSignedInError,
7
+ SIGN_OUT_PATH,
7
8
  getUser,
8
9
  nameFromEmail
9
- } from "./chunks/chunk-CSSDKZCY.js";
10
+ } from "./chunks/chunk-RUOQMEEZ.js";
10
11
 
11
12
  // ../core/src/ai.ts
12
13
  var CLAUDE_MODELS = {
@@ -555,7 +556,7 @@ async function googleAccessToken() {
555
556
  }
556
557
  var NotOnBuildersError = class extends BuildersError {
557
558
  constructor(what) {
558
- super(`${what} works only in a saved version or the live app on Builders, not in the Studio preview or on this computer. Save a version and try it there.`, 503);
559
+ super(`${what} works only in a saved version or the live app on Builders, not in the dev preview or on this computer. Save a version and try it there.`, 503);
559
560
  this.name = "NotOnBuildersError";
560
561
  }
561
562
  };
@@ -806,7 +807,7 @@ var secrets = {
806
807
  const bad = secretNameError(name);
807
808
  if (bad) throw new BuildersError(`"${name}" is not a secret name. ${bad}`, 400);
808
809
  if (process.env[APP_ENV.revision] === "preview") {
809
- throw new BuildersError(`Secrets work only in the live app, not in a version preview. Publish the version to use ${name}; until then show a message instead.`, 503);
810
+ throw new BuildersError(`Secrets work only in the live app, not in a version preview. Make the version live to use ${name}; until then show a message instead.`, 503);
810
811
  }
811
812
  const project = process.env[APP_ENV.project];
812
813
  if (!project) {
@@ -843,6 +844,7 @@ export {
843
844
  NotFoundError,
844
845
  NotOnBuildersError,
845
846
  NotSignedInError,
847
+ SIGN_OUT_PATH,
846
848
  ai,
847
849
  db,
848
850
  dbMode,
package/dist/next.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getUser
3
- } from "./chunks/chunk-CSSDKZCY.js";
3
+ } from "./chunks/chunk-RUOQMEEZ.js";
4
4
 
5
5
  // src/next.ts
6
6
  import { headers } from "next/headers.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n-dream/builders-sdk",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Builders platform helpers for app code: signed-in user, database, AI, file storage, notifications.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://builders.n-dream.com",