@enlitt/sdk 0.0.0-stage → 0.1.1
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/CHANGELOG.md +35 -0
- package/LICENSE +21 -0
- package/README.md +63 -2
- package/dist/browser/auth.d.cts +44 -0
- package/dist/browser/auth.d.ts +45 -0
- package/dist/browser/auth.d.ts.map +1 -0
- package/dist/browser.cjs +35 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.cts +12 -0
- package/dist/browser.d.ts +13 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +32 -0
- package/dist/browser.js.map +1 -0
- package/dist/chunk-2BGWYTJM.cjs +1097 -0
- package/dist/chunk-2BGWYTJM.cjs.map +1 -0
- package/dist/chunk-6OWXYBBT.cjs +146 -0
- package/dist/chunk-6OWXYBBT.cjs.map +1 -0
- package/dist/chunk-NI6WH5FI.js +33 -0
- package/dist/chunk-NI6WH5FI.js.map +1 -0
- package/dist/chunk-O6ASIA3X.js +866 -0
- package/dist/chunk-O6ASIA3X.js.map +1 -0
- package/dist/chunk-PPOUNWNA.cjs +895 -0
- package/dist/chunk-PPOUNWNA.cjs.map +1 -0
- package/dist/chunk-UVZMKGIL.js +1091 -0
- package/dist/chunk-UVZMKGIL.js.map +1 -0
- package/dist/chunk-V5TCSQ7C.js +143 -0
- package/dist/chunk-V5TCSQ7C.js.map +1 -0
- package/dist/chunk-YPA4R65T.cjs +35 -0
- package/dist/chunk-YPA4R65T.cjs.map +1 -0
- package/dist/core/errors.d.cts +262 -0
- package/dist/core/errors.d.ts +263 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/index.d.cts +24 -0
- package/dist/core/index.d.ts +25 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/premium.d.cts +230 -0
- package/dist/core/premium.d.ts +231 -0
- package/dist/core/premium.d.ts.map +1 -0
- package/dist/core/session.d.cts +122 -0
- package/dist/core/session.d.ts +123 -0
- package/dist/core/session.d.ts.map +1 -0
- package/dist/core/sse.d.cts +79 -0
- package/dist/core/sse.d.ts +80 -0
- package/dist/core/sse.d.ts.map +1 -0
- package/dist/core/transport.d.cts +223 -0
- package/dist/core/transport.d.ts +224 -0
- package/dist/core/transport.d.ts.map +1 -0
- package/dist/core/usage.d.cts +35 -0
- package/dist/core/usage.d.ts +36 -0
- package/dist/core/usage.d.ts.map +1 -0
- package/dist/core.cjs +77 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.js +4 -0
- package/dist/core.js.map +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/openai/client.d.cts +72 -0
- package/dist/openai/client.d.ts +73 -0
- package/dist/openai/client.d.ts.map +1 -0
- package/dist/openai/index.d.cts +2 -0
- package/dist/openai/index.d.ts +3 -0
- package/dist/openai/index.d.ts.map +1 -0
- package/dist/openai/media.d.cts +108 -0
- package/dist/openai/media.d.ts +109 -0
- package/dist/openai/media.d.ts.map +1 -0
- package/dist/openai.cjs +623 -0
- package/dist/openai.cjs.map +1 -0
- package/dist/openai.js +617 -0
- package/dist/openai.js.map +1 -0
- package/dist/server/callback.d.cts +107 -0
- package/dist/server/callback.d.ts +108 -0
- package/dist/server/callback.d.ts.map +1 -0
- package/dist/server/client-sign-in.d.cts +77 -0
- package/dist/server/client-sign-in.d.ts +78 -0
- package/dist/server/client-sign-in.d.ts.map +1 -0
- package/dist/server/index.d.cts +20 -0
- package/dist/server/index.d.ts +21 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/secrets.d.cts +46 -0
- package/dist/server/secrets.d.ts +47 -0
- package/dist/server/secrets.d.ts.map +1 -0
- package/dist/server-unavailable.cjs +8 -0
- package/dist/server-unavailable.cjs.map +1 -0
- package/dist/server-unavailable.d.cts +10 -0
- package/dist/server-unavailable.d.ts +11 -0
- package/dist/server-unavailable.d.ts.map +1 -0
- package/dist/server-unavailable.js +6 -0
- package/dist/server-unavailable.js.map +1 -0
- package/dist/server.cjs +880 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.js +795 -0
- package/dist/server.js.map +1 -0
- package/dist/vercel/index.d.cts +17 -0
- package/dist/vercel/index.d.ts +18 -0
- package/dist/vercel/index.d.ts.map +1 -0
- package/dist/vercel/language-model.d.cts +146 -0
- package/dist/vercel/language-model.d.ts +147 -0
- package/dist/vercel/language-model.d.ts.map +1 -0
- package/dist/vercel/premium-language-model.d.cts +127 -0
- package/dist/vercel/premium-language-model.d.ts +128 -0
- package/dist/vercel/premium-language-model.d.ts.map +1 -0
- package/dist/vercel/premium-media-model.d.cts +101 -0
- package/dist/vercel/premium-media-model.d.ts +102 -0
- package/dist/vercel/premium-media-model.d.ts.map +1 -0
- package/dist/vercel/standard-language-model.d.cts +104 -0
- package/dist/vercel/standard-language-model.d.ts +105 -0
- package/dist/vercel/standard-language-model.d.ts.map +1 -0
- package/dist/vercel.cjs +22 -0
- package/dist/vercel.cjs.map +1 -0
- package/dist/vercel.js +5 -0
- package/dist/vercel.js.map +1 -0
- package/package.json +139 -3
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The server-only boundary that turns a business secret into an outgoing
|
|
3
|
+
* authorization header.
|
|
4
|
+
*
|
|
5
|
+
* There is exactly one export. Resolving a key and formatting a header used to
|
|
6
|
+
* be two of them, which made "resolve the key and forget to use it" a
|
|
7
|
+
* reachable mistake at every call site; there is now no way to obtain the
|
|
8
|
+
* secret through this module's public surface without obtaining the header.
|
|
9
|
+
*
|
|
10
|
+
* A missing or unusable secret throws locally, before any network call, and
|
|
11
|
+
* never yields an unauthenticated client or a credential-free request. That
|
|
12
|
+
* local failure is what stops a managed premium call from silently falling
|
|
13
|
+
* through to a direct, business-funded provider call.
|
|
14
|
+
*
|
|
15
|
+
* The resolved value is a secret. It is never logged, never serialized into a
|
|
16
|
+
* thrown error's message or fields, and never returned to a caller: the
|
|
17
|
+
* `browser` condition on the `./server` subpath keeps this file out of every
|
|
18
|
+
* browser bundle, and the environment assertion below is the second net for a
|
|
19
|
+
* bundler or runtime that ignores that condition.
|
|
20
|
+
*
|
|
21
|
+
* Both local failures — a browser environment and an unusable secret — raise
|
|
22
|
+
* `EnlittConfigurationError`. That is what `enlitt()` documents its callers
|
|
23
|
+
* will see for a missing or invalid secret, and the type has to be right here
|
|
24
|
+
* rather than at one caller's boundary: any other caller of this function
|
|
25
|
+
* (`server/callback.ts`'s handlers among them) would otherwise receive a bare
|
|
26
|
+
* `Error` for exactly the same misconfiguration, and a business catching the
|
|
27
|
+
* package's own error class would miss it.
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the business secret and return the one header value that carries it.
|
|
31
|
+
*
|
|
32
|
+
* Resolution order is explicit configuration first, then the `ENLITT_SECRET_KEY`
|
|
33
|
+
* environment fallback. An explicitly supplied key is never abandoned in
|
|
34
|
+
* favour of the environment: a business that passed an empty or malformed
|
|
35
|
+
* value has misconfigured that value, and silently authenticating as whatever
|
|
36
|
+
* the environment happens to hold would be a different identity than the one
|
|
37
|
+
* the call site asked for.
|
|
38
|
+
*
|
|
39
|
+
* @returns a single `Bearer <secret>` header value.
|
|
40
|
+
* @throws {EnlittConfigurationError} in a browser environment, or when no
|
|
41
|
+
* usable secret resolves. Neither the message nor any field of the thrown
|
|
42
|
+
* error carries any part of the secret.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveBusinessAuthorizationHeader(config: {
|
|
45
|
+
secretKey?: string;
|
|
46
|
+
}): string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The server-only boundary that turns a business secret into an outgoing
|
|
3
|
+
* authorization header.
|
|
4
|
+
*
|
|
5
|
+
* There is exactly one export. Resolving a key and formatting a header used to
|
|
6
|
+
* be two of them, which made "resolve the key and forget to use it" a
|
|
7
|
+
* reachable mistake at every call site; there is now no way to obtain the
|
|
8
|
+
* secret through this module's public surface without obtaining the header.
|
|
9
|
+
*
|
|
10
|
+
* A missing or unusable secret throws locally, before any network call, and
|
|
11
|
+
* never yields an unauthenticated client or a credential-free request. That
|
|
12
|
+
* local failure is what stops a managed premium call from silently falling
|
|
13
|
+
* through to a direct, business-funded provider call.
|
|
14
|
+
*
|
|
15
|
+
* The resolved value is a secret. It is never logged, never serialized into a
|
|
16
|
+
* thrown error's message or fields, and never returned to a caller: the
|
|
17
|
+
* `browser` condition on the `./server` subpath keeps this file out of every
|
|
18
|
+
* browser bundle, and the environment assertion below is the second net for a
|
|
19
|
+
* bundler or runtime that ignores that condition.
|
|
20
|
+
*
|
|
21
|
+
* Both local failures — a browser environment and an unusable secret — raise
|
|
22
|
+
* `EnlittConfigurationError`. That is what `enlitt()` documents its callers
|
|
23
|
+
* will see for a missing or invalid secret, and the type has to be right here
|
|
24
|
+
* rather than at one caller's boundary: any other caller of this function
|
|
25
|
+
* (`server/callback.ts`'s handlers among them) would otherwise receive a bare
|
|
26
|
+
* `Error` for exactly the same misconfiguration, and a business catching the
|
|
27
|
+
* package's own error class would miss it.
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the business secret and return the one header value that carries it.
|
|
31
|
+
*
|
|
32
|
+
* Resolution order is explicit configuration first, then the `ENLITT_SECRET_KEY`
|
|
33
|
+
* environment fallback. An explicitly supplied key is never abandoned in
|
|
34
|
+
* favour of the environment: a business that passed an empty or malformed
|
|
35
|
+
* value has misconfigured that value, and silently authenticating as whatever
|
|
36
|
+
* the environment happens to hold would be a different identity than the one
|
|
37
|
+
* the call site asked for.
|
|
38
|
+
*
|
|
39
|
+
* @returns a single `Bearer <secret>` header value.
|
|
40
|
+
* @throws {EnlittConfigurationError} in a browser environment, or when no
|
|
41
|
+
* usable secret resolves. Neither the message nor any field of the thrown
|
|
42
|
+
* error carries any part of the secret.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveBusinessAuthorizationHeader(config: {
|
|
45
|
+
secretKey?: string;
|
|
46
|
+
}): string;
|
|
47
|
+
//# sourceMappingURL=secrets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../src/server/secrets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAmDH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kCAAkC,CAAC,MAAM,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAsBzF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/server-unavailable.ts
|
|
4
|
+
throw new Error(
|
|
5
|
+
"This @enlitt/sdk entry (server, core, vercel, or openai) is a server-only entry point and was resolved in a browser bundle. Import it from server code only; use @enlitt/sdk/browser in code you ship to consumers."
|
|
6
|
+
);
|
|
7
|
+
//# sourceMappingURL=server-unavailable.cjs.map
|
|
8
|
+
//# sourceMappingURL=server-unavailable.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server-unavailable.ts"],"names":[],"mappings":";;;AAUA,MAAM,IAAI,KAAA;AAAA,EACR;AAGF,CAAA","file":"server-unavailable.cjs","sourcesContent":["/**\n * The `browser` condition for `@enlitt/sdk/server`, `@enlitt/sdk/core`, and\n * `@enlitt/sdk/vercel`, and `@enlitt/sdk/openai` resolves here.\n *\n * A bundler that follows browser conditions can therefore never pull the real\n * server module — and with it `process.env.ENLITT_SECRET_KEY` — into a client\n * bundle. Failing at import time makes the mistake loud at build or first\n * load rather than silently shipping a secret read to consumers.\n */\n\nthrow new Error(\n \"This @enlitt/sdk entry (server, core, vercel, or openai) is a server-only entry point and was resolved in a \" +\n \"browser bundle. Import it from server code only; use @enlitt/sdk/browser \" +\n \"in code you ship to consumers.\"\n);\n\nexport {};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `browser` condition for `@enlitt/sdk/server`, `@enlitt/sdk/core`, and
|
|
3
|
+
* `@enlitt/sdk/vercel`, and `@enlitt/sdk/openai` resolves here.
|
|
4
|
+
*
|
|
5
|
+
* A bundler that follows browser conditions can therefore never pull the real
|
|
6
|
+
* server module — and with it `process.env.ENLITT_SECRET_KEY` — into a client
|
|
7
|
+
* bundle. Failing at import time makes the mistake loud at build or first
|
|
8
|
+
* load rather than silently shipping a secret read to consumers.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `browser` condition for `@enlitt/sdk/server`, `@enlitt/sdk/core`, and
|
|
3
|
+
* `@enlitt/sdk/vercel`, and `@enlitt/sdk/openai` resolves here.
|
|
4
|
+
*
|
|
5
|
+
* A bundler that follows browser conditions can therefore never pull the real
|
|
6
|
+
* server module — and with it `process.env.ENLITT_SECRET_KEY` — into a client
|
|
7
|
+
* bundle. Failing at import time makes the mistake loud at build or first
|
|
8
|
+
* load rather than silently shipping a secret read to consumers.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=server-unavailable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-unavailable.d.ts","sourceRoot":"","sources":["../src/server-unavailable.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// src/server-unavailable.ts
|
|
2
|
+
throw new Error(
|
|
3
|
+
"This @enlitt/sdk entry (server, core, vercel, or openai) is a server-only entry point and was resolved in a browser bundle. Import it from server code only; use @enlitt/sdk/browser in code you ship to consumers."
|
|
4
|
+
);
|
|
5
|
+
//# sourceMappingURL=server-unavailable.js.map
|
|
6
|
+
//# sourceMappingURL=server-unavailable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server-unavailable.ts"],"names":[],"mappings":";AAUA,MAAM,IAAI,KAAA;AAAA,EACR;AAGF,CAAA","file":"server-unavailable.js","sourcesContent":["/**\n * The `browser` condition for `@enlitt/sdk/server`, `@enlitt/sdk/core`, and\n * `@enlitt/sdk/vercel`, and `@enlitt/sdk/openai` resolves here.\n *\n * A bundler that follows browser conditions can therefore never pull the real\n * server module — and with it `process.env.ENLITT_SECRET_KEY` — into a client\n * bundle. Failing at import time makes the mistake loud at build or first\n * load rather than silently shipping a secret read to consumers.\n */\n\nthrow new Error(\n \"This @enlitt/sdk entry (server, core, vercel, or openai) is a server-only entry point and was resolved in a \" +\n \"browser bundle. Import it from server code only; use @enlitt/sdk/browser \" +\n \"in code you ship to consumers.\"\n);\n\nexport {};\n"]}
|