@lostgradient/mcp 0.2.6 → 0.3.0
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/LICENSE +1 -1
- package/README.md +15 -173
- package/dist/http.d.ts +35 -0
- package/dist/http.js +251 -0
- package/dist/internal/cryptography/encryption.d.ts +108 -0
- package/dist/internal/cryptography/encryption.js +241 -0
- package/dist/internal/cryptography/hash.d.ts +72 -0
- package/dist/internal/cryptography/hash.js +233 -0
- package/dist/internal/cryptography/index.d.ts +4 -0
- package/dist/internal/cryptography/index.js +2 -0
- package/dist/oauth/canonicalize-ip-address.d.ts +0 -6
- package/dist/oauth/canonicalize-ip-address.js +113 -0
- package/dist/oauth/client-metadata-documents.d.ts +2 -22
- package/dist/oauth/client-metadata-documents.js +205 -19
- package/dist/oauth/index.d.ts +9 -213
- package/dist/oauth/index.js +6 -69
- package/dist/oauth/issuer.d.ts +103 -0
- package/dist/oauth/issuer.js +564 -0
- package/dist/oauth/postgres.d.ts +12 -0
- package/dist/oauth/postgres.js +76 -0
- package/dist/oauth/safe-public-https-fetch.d.ts +3 -5
- package/dist/oauth/safe-public-https-fetch.js +114 -0
- package/dist/oauth/security-utilities.d.ts +0 -3
- package/dist/oauth/security-utilities.js +93 -0
- package/dist/oauth-store.d.ts +108 -0
- package/dist/oauth-store.js +321 -0
- package/package.json +50 -124
- package/dist/chunk-3ek3knfm.js +0 -73
- package/dist/chunk-3rr24vhh.js +0 -28
- package/dist/chunk-5444sx3n.js +0 -916
- package/dist/chunk-6ekjtvcq.js +0 -273
- package/dist/chunk-k6fm3cmk.js +0 -132
- package/dist/chunk-r9atew6b.js +0 -449
- package/dist/chunk-rxnyn7tf.js +0 -19
- package/dist/chunk-taxyscge.js +0 -67
- package/dist/chunk-tkn6m6az.js +0 -1107
- package/dist/chunk-xcf742mf.js +0 -14
- package/dist/chunk-zrrf78wj.js +0 -4
- package/dist/conformance-fixture-registration.d.ts +0 -30
- package/dist/conformance-server.d.ts +0 -1
- package/dist/conformance.d.ts +0 -43
- package/dist/env.d.ts +0 -59
- package/dist/env.js +0 -9
- package/dist/environment-schema.d.ts +0 -29
- package/dist/environment-schema.js +0 -6
- package/dist/golden-prompts.d.ts +0 -42
- package/dist/handler-context.d.ts +0 -16
- package/dist/http/authenticate.d.ts +0 -35
- package/dist/http/authorization-header.d.ts +0 -5
- package/dist/http/grant-revocation-channel.d.ts +0 -24
- package/dist/http/handler.d.ts +0 -32
- package/dist/http/index.d.ts +0 -27
- package/dist/http/index.js +0 -870
- package/dist/http/listen-inspection.d.ts +0 -11
- package/dist/http/request-context.d.ts +0 -17
- package/dist/http/responses.d.ts +0 -13
- package/dist/http/serving-layer.d.ts +0 -25
- package/dist/http/user-handler-cache.d.ts +0 -37
- package/dist/http/user-server-event-bus.d.ts +0 -35
- package/dist/index.d.ts +0 -29
- package/dist/index.js +0 -616
- package/dist/localhost-request-validation.d.ts +0 -2
- package/dist/logger.d.ts +0 -59
- package/dist/logger.js +0 -18
- package/dist/long-running-operation-support.d.ts +0 -34
- package/dist/metrics.d.ts +0 -64
- package/dist/metrics.js +0 -6
- package/dist/oauth/authorize-endpoint.d.ts +0 -5
- package/dist/oauth/client-authentication.d.ts +0 -10
- package/dist/oauth/discovery-metadata.d.ts +0 -19
- package/dist/oauth/endpoint-rate-limits.d.ts +0 -10
- package/dist/oauth/endpoint-responses.d.ts +0 -10
- package/dist/oauth/network-identity.d.ts +0 -32
- package/dist/oauth/pkce-validation.d.ts +0 -2
- package/dist/oauth/postgres/client-store.d.ts +0 -12
- package/dist/oauth/postgres/code-store.d.ts +0 -14
- package/dist/oauth/postgres/database.d.ts +0 -59
- package/dist/oauth/postgres/index.d.ts +0 -11
- package/dist/oauth/postgres/index.js +0 -616
- package/dist/oauth/postgres/schema.d.ts +0 -1476
- package/dist/oauth/postgres/token-store.d.ts +0 -16
- package/dist/oauth/postgres/transaction-store.d.ts +0 -14
- package/dist/oauth/redirect-uri-matching.d.ts +0 -2
- package/dist/oauth/registration-endpoint.d.ts +0 -2
- package/dist/oauth/request-body.d.ts +0 -14
- package/dist/oauth/revocation-endpoint.d.ts +0 -2
- package/dist/oauth/scope-utilities.d.ts +0 -15
- package/dist/oauth/stores.d.ts +0 -225
- package/dist/oauth/stores.js +0 -0
- package/dist/oauth/testing/contract-fixtures.d.ts +0 -134
- package/dist/oauth/testing/index.d.ts +0 -56
- package/dist/oauth/testing/index.js +0 -330
- package/dist/oauth/token-endpoint.d.ts +0 -2
- package/dist/oauth-scope-configuration.d.ts +0 -3
- package/dist/prompts/index.d.ts +0 -5
- package/dist/prompts/summarize.d.ts +0 -4
- package/dist/rate-limit/in-memory-sliding-window-store.d.ts +0 -3
- package/dist/rate-limit/index.d.ts +0 -23
- package/dist/rate-limit/index.js +0 -29
- package/dist/rate-limit/mcp-concurrency-limiter.d.ts +0 -26
- package/dist/rate-limit/rate-limit-response.d.ts +0 -1
- package/dist/rate-limit/redis-sliding-window-store.d.ts +0 -2
- package/dist/rate-limit/request-rate-limiter.d.ts +0 -10
- package/dist/rate-limit/sliding-window-rate-limiter.d.ts +0 -16
- package/dist/resources/index.d.ts +0 -4
- package/dist/resources/user-profile.d.ts +0 -1
- package/dist/scope-vocabulary.d.ts +0 -127
- package/dist/scopes.d.ts +0 -49
- package/dist/server.d.ts +0 -113
- package/dist/supported-scopes.d.ts +0 -25
- package/dist/sveltekit-mount-state.d.ts +0 -4
- package/dist/sveltekit-mount.d.ts +0 -43
- package/dist/sveltekit-mount.js +0 -344
- package/dist/template-registry.d.ts +0 -16
- package/dist/tool-response.d.ts +0 -100
- package/dist/tools/get-user-profile.d.ts +0 -8
- package/dist/tools/index.d.ts +0 -16
- package/dist/tools/list-audit-events.d.ts +0 -11
- package/dist/type-assertions.d.ts +0 -1
- package/dist/types/primitives.d.ts +0 -130
- package/dist/ui-extension-support.d.ts +0 -20
- package/dist/version.d.ts +0 -23
- package/dist/version.js +0 -6
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SEC-004: "a timeout must abort the underlying operation rather than
|
|
3
|
-
* merely reject a wrapper promise." The previous implementation raced
|
|
4
|
-
* `operation()` against a timer with `Promise.race` — once the timer won,
|
|
5
|
-
* the wrapper promise rejected, but `operation()` itself kept running with
|
|
6
|
-
* nothing left to observe it: no caller awaiting its result, no signal
|
|
7
|
-
* telling it to stop, and no way to know its eventual resolution (or
|
|
8
|
-
* rejection, which becomes an unhandled rejection) was ever handled. For a
|
|
9
|
-
* fetch, a database query, or any operation that accepts a signal, that
|
|
10
|
-
* means the timeout only stopped *waiting* — it never stopped the work.
|
|
11
|
-
*
|
|
12
|
-
* This still races against a timer, so a caller is guaranteed a result (or
|
|
13
|
-
* rejection) by the deadline even if `operation` ignores cancellation
|
|
14
|
-
* entirely. What's new: `operation` now receives the `AbortSignal` this
|
|
15
|
-
* function creates and aborts on timeout (or on the caller's own
|
|
16
|
-
* `abortSignal` firing), so a caller that threads it into
|
|
17
|
-
* `fetch`/a query/etc. gets genuine cancellation of the underlying work,
|
|
18
|
-
* not just an abandoned promise racing in the background.
|
|
19
|
-
*/
|
|
20
|
-
export declare function runWithStandardizedTimeout<T>(input: {
|
|
21
|
-
operation: (signal: AbortSignal) => Promise<T>;
|
|
22
|
-
timeoutMilliseconds?: number;
|
|
23
|
-
abortSignal?: AbortSignal;
|
|
24
|
-
}): Promise<T>;
|
|
25
|
-
export declare function emitRequestProgress(input: {
|
|
26
|
-
sendNotification?: (notification: {
|
|
27
|
-
method: string;
|
|
28
|
-
params: Record<string, unknown>;
|
|
29
|
-
}) => Promise<void>;
|
|
30
|
-
progressToken?: string | number;
|
|
31
|
-
progress: number;
|
|
32
|
-
total?: number;
|
|
33
|
-
message?: string;
|
|
34
|
-
}): Promise<void>;
|
package/dist/metrics.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
export type ToolMetricEntry = {
|
|
2
|
-
invocations: number;
|
|
3
|
-
errors: number;
|
|
4
|
-
durations: number[];
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* OBS-001: outcome counters for the OAuth and MCP surfaces the roadmap
|
|
8
|
-
* names — discovery, authorization, token exchange, refresh, revocation,
|
|
9
|
-
* registration, MCP method dispatch, stream disconnects, version
|
|
10
|
-
* negotiation, and conformance failures. Deliberately a flat
|
|
11
|
-
* `category -> outcome -> count` map rather than one field per category:
|
|
12
|
-
* every category has the same shape (a set of named, mutually exclusive
|
|
13
|
-
* outcomes), and this lets a new outcome or category be added at a call
|
|
14
|
-
* site with no change here. `tools` above stays its own typed field
|
|
15
|
-
* because it also carries latency percentiles, which events do not.
|
|
16
|
-
*/
|
|
17
|
-
export type EventOutcomeCounts = Record<string, Record<string, number>>;
|
|
18
|
-
export type MetricsSnapshot = {
|
|
19
|
-
tools: Record<string, {
|
|
20
|
-
invocations: number;
|
|
21
|
-
errors: number;
|
|
22
|
-
p50: number;
|
|
23
|
-
p95: number;
|
|
24
|
-
p99: number;
|
|
25
|
-
}>;
|
|
26
|
-
events: EventOutcomeCounts;
|
|
27
|
-
uptimeSeconds: number;
|
|
28
|
-
collectedAt: string;
|
|
29
|
-
};
|
|
30
|
-
declare class MetricsCollector {
|
|
31
|
-
private tools;
|
|
32
|
-
private events;
|
|
33
|
-
private startedAt;
|
|
34
|
-
recordToolInvocation(name: string, durationMs: number, isError: boolean): void;
|
|
35
|
-
/**
|
|
36
|
-
* OBS-001: increments the counter for one `(category, outcome)` pair —
|
|
37
|
-
* e.g. `recordEvent('registration', 'success')`,
|
|
38
|
-
* `recordEvent('token_exchange', 'invalid_client')`,
|
|
39
|
-
* `recordEvent('authorization', 'user_denied')`. Never pass a secret,
|
|
40
|
-
* token, or user-identifying value as `outcome` — this is a metric
|
|
41
|
-
* label, not a log field, and stays in memory for the life of the
|
|
42
|
-
* process.
|
|
43
|
-
*/
|
|
44
|
-
recordEvent(category: string, outcome: string): void;
|
|
45
|
-
/**
|
|
46
|
-
* Review round 4 / P2: this previously cleared `entry.durations` after
|
|
47
|
-
* computing percentiles, on the mistaken assumption that a snapshot is a
|
|
48
|
-
* one-shot read. `/metrics` (`metrics-routes.ts`) is a Prometheus-style
|
|
49
|
-
* scrape endpoint -- polled repeatedly by one or more scrapers -- and a
|
|
50
|
-
* scrape must be idempotent: reading it must never change what the next
|
|
51
|
-
* reader sees. Clearing the samples here meant a second scraper, or the
|
|
52
|
-
* same scraper on its next interval before another tool invocation, saw
|
|
53
|
-
* `p50`/`p95`/`p99` reset to `0` while `invocations`/`errors` kept
|
|
54
|
-
* climbing -- an internally inconsistent snapshot, and one reader
|
|
55
|
-
* silently consuming data before another could see it. The bounded
|
|
56
|
-
* last-`MAX_DURATIONS` window in `recordToolInvocation` already keeps
|
|
57
|
-
* memory bounded, so nothing here needs to clear it -- the window
|
|
58
|
-
* naturally ages out old samples as new ones arrive.
|
|
59
|
-
*/
|
|
60
|
-
snapshot(): MetricsSnapshot;
|
|
61
|
-
reset(): void;
|
|
62
|
-
}
|
|
63
|
-
export declare const metricsCollector: MetricsCollector;
|
|
64
|
-
export {};
|
package/dist/metrics.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { OAuthHostSeams, OAuthRequestContext } from './index.js';
|
|
2
|
-
export declare const authorizeFormParameterNames: readonly ["transaction_id", "csrf_token"];
|
|
3
|
-
export declare function handleOauthAuthorizeGet<Scope extends string>(context: OAuthRequestContext, seams: OAuthHostSeams<Scope>): Promise<Response>;
|
|
4
|
-
export declare function handleOauthAuthorizeApprove<Scope extends string>(context: OAuthRequestContext, seams: OAuthHostSeams<Scope>): Promise<Response>;
|
|
5
|
-
export declare function handleOauthAuthorizeDeny<Scope extends string>(context: OAuthRequestContext, seams: OAuthHostSeams<Scope>): Promise<Response>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { RegisteredClient } from './stores.js';
|
|
2
|
-
import type { OAuthStatelessHostSeams } from './index.js';
|
|
3
|
-
export type OauthClientAuthenticationResult = {
|
|
4
|
-
ok: true;
|
|
5
|
-
client: RegisteredClient;
|
|
6
|
-
} | {
|
|
7
|
-
ok: false;
|
|
8
|
-
};
|
|
9
|
-
/** Sole client-authentication choke point shared by token and revocation endpoints. */
|
|
10
|
-
export declare function authenticateOauthClient<Scope extends string>(clientId: string, clientSecret: string | undefined, seams: OAuthStatelessHostSeams<Scope>): Promise<OauthClientAuthenticationResult>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { McpRegistry } from '../scope-vocabulary.js';
|
|
2
|
-
import type { OAuthConfiguration, OAuthRequestContext } from './index.js';
|
|
3
|
-
export type OAuthDiscoveryConfiguration = Pick<OAuthConfiguration, 'issuer' | 'baseUrl' | 'mcpUiExtension'> & {
|
|
4
|
-
resource: URL;
|
|
5
|
-
serverName: string;
|
|
6
|
-
mcpProtocolVersion: string;
|
|
7
|
-
serviceDocumentation?: URL;
|
|
8
|
-
privacyPolicy?: URL;
|
|
9
|
-
termsOfService?: URL;
|
|
10
|
-
};
|
|
11
|
-
export declare const oauthCorsHeaders: {
|
|
12
|
-
'Access-Control-Allow-Origin': string;
|
|
13
|
-
'Access-Control-Allow-Methods': string;
|
|
14
|
-
'Access-Control-Allow-Headers': string;
|
|
15
|
-
'Access-Control-Expose-Headers': string;
|
|
16
|
-
};
|
|
17
|
-
export declare function handleOauthAuthorizationMetadataGet(_context: OAuthRequestContext, configuration: OAuthDiscoveryConfiguration, registry: McpRegistry): Response;
|
|
18
|
-
export declare function handleOauthProtectedResourceMetadataGet(_context: OAuthRequestContext, configuration: OAuthDiscoveryConfiguration, registry: McpRegistry): Response;
|
|
19
|
-
export declare function handleOauthProtectedResourceMcpMetadataGet(_context: OAuthRequestContext, configuration: OAuthDiscoveryConfiguration, registry: McpRegistry): Response;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { OAuthRateLimitCategory, OAuthRequestContext, OAuthStatelessHostSeams } from './index.js';
|
|
2
|
-
export declare function networkIdentity<Scope extends string>(context: OAuthRequestContext, seams: OAuthStatelessHostSeams<Scope>): string;
|
|
3
|
-
export declare function rateLimitResponse<Scope extends string>(input: {
|
|
4
|
-
context: OAuthRequestContext;
|
|
5
|
-
seams: OAuthStatelessHostSeams<Scope>;
|
|
6
|
-
category: OAuthRateLimitCategory;
|
|
7
|
-
identifier?: string;
|
|
8
|
-
}): Promise<Response | undefined>;
|
|
9
|
-
export declare function isAuthenticationLockedOut<Scope extends string>(context: OAuthRequestContext, seams: OAuthStatelessHostSeams<Scope>): Promise<boolean>;
|
|
10
|
-
export declare function recordFailedAuthentication<Scope extends string>(context: OAuthRequestContext, seams: OAuthStatelessHostSeams<Scope>): Promise<void>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const oauthNoStoreHeaders: {
|
|
2
|
-
'Cache-Control': string;
|
|
3
|
-
Pragma: string;
|
|
4
|
-
'Access-Control-Allow-Origin': string;
|
|
5
|
-
'Access-Control-Allow-Methods': string;
|
|
6
|
-
'Access-Control-Allow-Headers': string;
|
|
7
|
-
'Access-Control-Expose-Headers': string;
|
|
8
|
-
};
|
|
9
|
-
export declare function oauthJson(body: unknown, status?: number, headers?: HeadersInit): Response;
|
|
10
|
-
export declare function oauthBodyError(error: unknown): Response;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export type TrustedProxyHeader = 'x-forwarded-for' | 'forwarded' | 'cf-connecting-ip' | 'fly-client-ip';
|
|
2
|
-
export type TrustedProxyConfiguration = {
|
|
3
|
-
/** CIDR blocks (IPv4 or IPv6) whose immediate socket peer is trusted to supply a forwarding header. Empty means nothing is trusted. */
|
|
4
|
-
trustedProxyCidrs: string[];
|
|
5
|
-
/** Which forwarding header to trust, once the peer is verified trusted. `undefined` means never trust any header. */
|
|
6
|
-
trustedProxyHeader: TrustedProxyHeader | undefined;
|
|
7
|
-
/** How many trusted proxy hops precede the real client in a multi-value header. */
|
|
8
|
-
trustedProxyHopCount: number;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Whether the immediate socket peer is one of the configured trusted
|
|
12
|
-
* proxies -- exported so any caller that needs to decide "can I trust a
|
|
13
|
-
* self-reported header from whoever is directly connected to me" can reuse
|
|
14
|
-
* this exact check, rather than re-deriving it (see
|
|
15
|
-
* `bearer-credential-authentication.ts`'s `isPlaintextTransport`, which
|
|
16
|
-
* uses this to decide whether `X-Forwarded-Proto` is trustworthy, the same
|
|
17
|
-
* way `resolveNetworkIdentity` below uses it to decide whether a
|
|
18
|
-
* forwarded-for-style header is).
|
|
19
|
-
*/
|
|
20
|
-
export declare function isSocketPeerTrusted(canonicalSocketAddress: string, configuration: TrustedProxyConfiguration): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Resolves the network identity of a request: the socket address, unless
|
|
23
|
-
* that socket address is itself a trusted proxy, in which case the
|
|
24
|
-
* configured forwarding header (read only from the trusted side of the
|
|
25
|
-
* chain) is trusted instead. Every result is canonicalized so IPv4,
|
|
26
|
-
* IPv4-mapped IPv6, and alternate IPv6 spellings collapse to one identity.
|
|
27
|
-
*/
|
|
28
|
-
export declare function resolveOauthNetworkIdentity(input: {
|
|
29
|
-
socketAddress: string | undefined;
|
|
30
|
-
headers: Headers;
|
|
31
|
-
configuration: TrustedProxyConfiguration;
|
|
32
|
-
}): string;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ClientStore, RegisteredClient } from '../stores.js';
|
|
2
|
-
import { type PostgresOAuthDatabase } from './database.js';
|
|
3
|
-
import type { PostgresOAuthSchema } from './schema.js';
|
|
4
|
-
export declare class PostgresClientStore implements ClientStore {
|
|
5
|
-
private readonly database;
|
|
6
|
-
private readonly schema;
|
|
7
|
-
constructor(database: PostgresOAuthDatabase, schema: PostgresOAuthSchema);
|
|
8
|
-
register(record: RegisteredClient): Promise<void>;
|
|
9
|
-
upsert(record: RegisteredClient): Promise<void>;
|
|
10
|
-
findById(clientId: string): Promise<RegisteredClient | null>;
|
|
11
|
-
update(clientId: string, patch: Partial<RegisteredClient>): Promise<void>;
|
|
12
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { AuthorizationCode, CodeStore, ConsumedAuthorizationCode } from '../stores.js';
|
|
2
|
-
import { type PostgresOAuthDatabase } from './database.js';
|
|
3
|
-
import type { PostgresOAuthSchema } from './schema.js';
|
|
4
|
-
export declare class PostgresCodeStore implements CodeStore {
|
|
5
|
-
private readonly database;
|
|
6
|
-
private readonly schema;
|
|
7
|
-
constructor(database: PostgresOAuthDatabase, schema: PostgresOAuthSchema);
|
|
8
|
-
issue(record: AuthorizationCode): Promise<void>;
|
|
9
|
-
findByHash(codeHash: string): Promise<AuthorizationCode | null>;
|
|
10
|
-
consume(codeHash: string, now: Date): Promise<ConsumedAuthorizationCode | null>;
|
|
11
|
-
unconsume(codeHash: string, usedAt: Date): Promise<boolean>;
|
|
12
|
-
deleteAllForUser(userId: string): Promise<number>;
|
|
13
|
-
purgeExpired(now: Date): Promise<number>;
|
|
14
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { sql, type SQL } from 'drizzle-orm';
|
|
2
|
-
export type PostgresOAuthExecutor = {
|
|
3
|
-
execute(query: SQL): Promise<unknown>;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Database connection for the Postgres OAuth stores.
|
|
7
|
-
*
|
|
8
|
-
* Token revocation and rotation require interactive transactions and advisory
|
|
9
|
-
* transaction locks. Use a driver that supports `database.transaction(...)`,
|
|
10
|
-
* such as node-postgres or a Neon serverless WebSocket pool; neon-http is not
|
|
11
|
-
* sufficient because it does not support interactive transactions.
|
|
12
|
-
*/
|
|
13
|
-
export type PostgresOAuthDatabase = PostgresOAuthExecutor & {
|
|
14
|
-
transaction<T>(callback: (transaction: PostgresOAuthExecutor) => Promise<T>): Promise<T>;
|
|
15
|
-
};
|
|
16
|
-
export declare function hashOpaqueValue(value: string): string;
|
|
17
|
-
export declare function resultRows<T>(result: unknown): T[];
|
|
18
|
-
/**
|
|
19
|
-
* Coerces a driver timestamp value to a Date.
|
|
20
|
-
*
|
|
21
|
-
* The read paths in these stores call `database.execute(sql`…`)`, which bypasses
|
|
22
|
-
* drizzle's typed column mapping. Every drizzle pg-family driver — node-postgres,
|
|
23
|
-
* neon-serverless, and pglite alike — overrides the `timestamptz`/`timestamp`/
|
|
24
|
-
* `date` type parser to return the raw string so that its column `mode` can do
|
|
25
|
-
* the conversion, but `execute` never reaches that mapping. So these columns
|
|
26
|
-
* arrive as strings even though the store types declare `Date`, and a consumer
|
|
27
|
-
* calling a `Date` method on one (for example the resource-server auth building
|
|
28
|
-
* `expiresAt.getTime()`, or the client-secret expiry check) throws in
|
|
29
|
-
* production. A value already a `Date` (a driver without the override) passes
|
|
30
|
-
* through unchanged.
|
|
31
|
-
*
|
|
32
|
-
* Fails loudly rather than coercing silently: a `NOT NULL` column that comes
|
|
33
|
-
* back null would make `new Date(null)` the Unix epoch, and an unparseable
|
|
34
|
-
* string would make an `Invalid Date` — both still `Date` instances that would
|
|
35
|
-
* corrupt `expiresAt`/`createdAt` or propagate `NaN` downstream. So null,
|
|
36
|
-
* undefined, and unparseable values throw here instead.
|
|
37
|
-
*/
|
|
38
|
-
export declare function toDate(value: unknown): Date;
|
|
39
|
-
/**
|
|
40
|
-
* Null-safe {@link toDate} for nullable timestamp columns: null and undefined
|
|
41
|
-
* map to null, and any present value is validated by {@link toDate}.
|
|
42
|
-
*/
|
|
43
|
-
export declare function toNullableDate(value: unknown): Date | null;
|
|
44
|
-
/**
|
|
45
|
-
* Coerces the named timestamp columns on a result row to `Date` in place and
|
|
46
|
-
* returns the row. `required` columns are `NOT NULL`; `nullable` columns may be
|
|
47
|
-
* null. Keeps the raw-SQL read paths' declared return types honest without
|
|
48
|
-
* threading a bespoke mapper through every store.
|
|
49
|
-
*/
|
|
50
|
-
export declare function coerceRowDates<T>(row: T, required: readonly (keyof T)[], nullable?: readonly (keyof T)[]): T;
|
|
51
|
-
export declare function affectedRows(result: unknown): number;
|
|
52
|
-
export declare function countRows(result: unknown): number;
|
|
53
|
-
export declare function columnIdentifier(column: {
|
|
54
|
-
name: string;
|
|
55
|
-
}): import("drizzle-orm").Name;
|
|
56
|
-
export declare function qualifiedColumnIdentifier(alias: string, column: {
|
|
57
|
-
name: string;
|
|
58
|
-
}): SQL;
|
|
59
|
-
export { sql };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { createPostgresOAuthSchema } from './schema.js';
|
|
2
|
-
export type { PostgresOAuthSchema, PostgresOAuthSchemaOptions } from './schema.js';
|
|
3
|
-
export type { PostgresOAuthDatabase } from './database.js';
|
|
4
|
-
export { PostgresTransactionStore } from './transaction-store.js';
|
|
5
|
-
export { PostgresCodeStore } from './code-store.js';
|
|
6
|
-
export { PostgresTokenStore } from './token-store.js';
|
|
7
|
-
export { PostgresClientStore } from './client-store.js';
|
|
8
|
-
import type { OAuthStores } from '../stores.js';
|
|
9
|
-
import type { PostgresOAuthDatabase } from './database.js';
|
|
10
|
-
import type { PostgresOAuthSchema } from './schema.js';
|
|
11
|
-
export declare function createPostgresOAuthStores<TSchema extends PostgresOAuthSchema>(database: PostgresOAuthDatabase, schema: TSchema): OAuthStores;
|