@rebasepro/server 0.9.1-canary.f2f61da → 0.9.1-canary.faee831

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.
@@ -1,5 +1,5 @@
1
1
  import { VectorSearchParams, LogicalCondition, FilterValues } from "@rebasepro/types";
2
- import { AuthResult } from "../auth/middleware";
2
+ import type { AuthResult } from "../auth/middleware";
3
3
  import { DataDriver } from "@rebasepro/types";
4
4
  import type { ApiKeyMasked } from "../auth/api-keys/api-key-types";
5
5
  /**
@@ -9,7 +9,7 @@ import type { ApiKeyMasked } from "../auth/api-keys/api-key-types";
9
9
  export type HonoEnv = {
10
10
  Variables: {
11
11
  user?: AuthResult | {
12
- userId?: string;
12
+ uid?: string;
13
13
  roles?: string[];
14
14
  };
15
15
  driver?: DataDriver;
@@ -4,9 +4,14 @@ export interface JwtConfig {
4
4
  refreshExpiresIn?: string;
5
5
  }
6
6
  export interface AccessTokenPayload {
7
- userId: string;
7
+ /**
8
+ * The user's id — the same spelling the domain model, the auth adapters and
9
+ * the RLS layer (`auth.uid()`) all use. Tokens minted before this rename
10
+ * carry `userId` instead, and older external IdPs may send `sub`;
11
+ * {@link verifyAccessToken} accepts all three and normalises to this.
12
+ */
13
+ uid: string;
8
14
  roles: string[];
9
- uid?: string;
10
15
  /** Authentication Assurance Level: aal1 = password/oauth, aal2 = MFA verified */
11
16
  aal?: "aal1" | "aal2";
12
17
  /** Email claim from the JWT, if present */
@@ -28,7 +33,7 @@ export declare function configureJwt(config: JwtConfig): void;
28
33
  /**
29
34
  * Generate an access token (short-lived, 1 hour by default)
30
35
  */
31
- export declare function generateAccessToken(userId: string, roles: string[], aal?: "aal1" | "aal2", customClaims?: Record<string, unknown>): string;
36
+ export declare function generateAccessToken(uid: string, roles: string[], aal?: "aal1" | "aal2", customClaims?: Record<string, unknown>): string;
32
37
  /**
33
38
  * Get the expiration time of an access token in milliseconds from now
34
39
  */
@@ -1,13 +1,13 @@
1
1
  import { MiddlewareHandler, Context } from "hono";
2
2
  import { DataDriver } from "@rebasepro/types";
3
3
  import { AccessTokenPayload } from "./jwt";
4
- import { HonoEnv } from "../api/types";
4
+ import type { HonoEnv } from "../api/types";
5
5
  import type { ApiKeyStore } from "./api-keys/api-key-store";
6
6
  /**
7
7
  * Result from a custom auth validator.
8
8
  * - `false`/`null`/`undefined` = not authenticated
9
9
  * - `true` = authenticated as default user
10
- * - object with `userId` or `uid` = authenticated with user info
10
+ * - object with `uid` (or legacy `userId`) = authenticated with user info
11
11
  */
12
12
  export type AuthResult = boolean | null | undefined | {
13
13
  userId?: string;
@@ -28,5 +28,23 @@ export interface CronStore {
28
28
  totalFailures: number;
29
29
  lastRunAt?: string;
30
30
  }>>;
31
+ /**
32
+ * Atomically claim a scheduled run slot for a job.
33
+ *
34
+ * `slot` is the *scheduled* fire time (ISO string) derived from the cron
35
+ * expression — deterministic across instances regardless of timer drift,
36
+ * so all instances contend on the same (jobId, slot) key. Exactly one
37
+ * caller wins the insert against the unique constraint and executes;
38
+ * the rest skip.
39
+ *
40
+ * Fails open (returns true) on unexpected store errors, so a broken
41
+ * claims table degrades to uncoordinated execution rather than silently
42
+ * never running jobs.
43
+ *
44
+ * Optional so custom stores written against the pre-claims interface
45
+ * keep working — the scheduler treats a missing implementation as
46
+ * uncoordinated (always run).
47
+ */
48
+ tryClaimRun?(jobId: string, slot: string): Promise<boolean>;
31
49
  }
32
50
  export declare function createCronStore(driver: DataDriver): CronStore | undefined;
package/dist/env.d.ts CHANGED
@@ -55,6 +55,9 @@ declare const rebaseEnvSchema: z.ZodObject<{
55
55
  true: "true";
56
56
  false: "false";
57
57
  }>>, z.ZodTransform<boolean, "" | "true" | "false" | undefined>>;
58
+ GCS_BUCKET: z.ZodOptional<z.ZodString>;
59
+ GCS_PROJECT_ID: z.ZodOptional<z.ZodString>;
60
+ GCS_KEY_FILENAME: z.ZodOptional<z.ZodString>;
58
61
  }, z.core.$strip>;
59
62
  /** Inferred type of the validated environment. */
60
63
  export type RebaseEnv = z.infer<typeof rebaseEnvSchema>;