@farthershore/farthershore-js 0.0.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/README.md +137 -0
- package/dist/bootstrap.d.ts +6 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +147 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/catalog.d.ts +81 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +281 -0
- package/dist/catalog.js.map +1 -0
- package/dist/client.d.ts +33 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +56 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +53 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +48 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +27 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +47 -0
- package/dist/errors.js.map +1 -0
- package/dist/http.d.ts +22 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +104 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/react/hooks.d.ts +47 -0
- package/dist/react/hooks.d.ts.map +1 -0
- package/dist/react/hooks.js +87 -0
- package/dist/react/hooks.js.map +1 -0
- package/dist/react/index.d.ts +7 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +10 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/provider.d.ts +15 -0
- package/dist/react/provider.d.ts.map +1 -0
- package/dist/react/provider.js +25 -0
- package/dist/react/provider.js.map +1 -0
- package/dist/react/use-async.d.ts +14 -0
- package/dist/react/use-async.d.ts.map +1 -0
- package/dist/react/use-async.js +39 -0
- package/dist/react/use-async.js.map +1 -0
- package/dist/resources/_shared.d.ts +6 -0
- package/dist/resources/_shared.d.ts.map +1 -0
- package/dist/resources/_shared.js +13 -0
- package/dist/resources/_shared.js.map +1 -0
- package/dist/resources/analytics.d.ts +8 -0
- package/dist/resources/analytics.d.ts.map +1 -0
- package/dist/resources/analytics.js +9 -0
- package/dist/resources/analytics.js.map +1 -0
- package/dist/resources/auth.d.ts +18 -0
- package/dist/resources/auth.d.ts.map +1 -0
- package/dist/resources/auth.js +61 -0
- package/dist/resources/auth.js.map +1 -0
- package/dist/resources/billing.d.ts +33 -0
- package/dist/resources/billing.d.ts.map +1 -0
- package/dist/resources/billing.js +61 -0
- package/dist/resources/billing.js.map +1 -0
- package/dist/resources/feature.d.ts +17 -0
- package/dist/resources/feature.d.ts.map +1 -0
- package/dist/resources/feature.js +14 -0
- package/dist/resources/feature.js.map +1 -0
- package/dist/resources/keys.d.ts +15 -0
- package/dist/resources/keys.d.ts.map +1 -0
- package/dist/resources/keys.js +55 -0
- package/dist/resources/keys.js.map +1 -0
- package/dist/resources/plans.d.ts +42 -0
- package/dist/resources/plans.d.ts.map +1 -0
- package/dist/resources/plans.js +43 -0
- package/dist/resources/plans.js.map +1 -0
- package/dist/resources/product.d.ts +7 -0
- package/dist/resources/product.d.ts.map +1 -0
- package/dist/resources/product.js +8 -0
- package/dist/resources/product.js.map +1 -0
- package/dist/resources/usage.d.ts +17 -0
- package/dist/resources/usage.d.ts.map +1 -0
- package/dist/resources/usage.js +35 -0
- package/dist/resources/usage.js.map +1 -0
- package/dist/types.d.ts +206 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,qEAAqE;AACrE,gFAAgF;AAChF,EAAE;AACF,4EAA4E;AAC5E,gFAAgF;AAChF,6EAA6E;AAC7E,0BAA0B;AAI1B,0EAA0E;AAC1E,SAAS,UAAU,CAAC,KAAgB;IAClC,OAAO,KAAK,CAAC,MAAM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C,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type FartherShoreConfig } from "./config.js";
|
|
2
|
+
import { type ProductResource } from "./resources/product.js";
|
|
3
|
+
import { type AuthResource } from "./resources/auth.js";
|
|
4
|
+
import { type KeysResource } from "./resources/keys.js";
|
|
5
|
+
import { type UsageResource } from "./resources/usage.js";
|
|
6
|
+
import { type BillingResource } from "./resources/billing.js";
|
|
7
|
+
import { type PlansResource } from "./resources/plans.js";
|
|
8
|
+
import { type AnalyticsResource } from "./resources/analytics.js";
|
|
9
|
+
import { type FeatureHandle, type GatewayRequestInit } from "./resources/feature.js";
|
|
10
|
+
import type { Bootstrap } from "./types.js";
|
|
11
|
+
export interface FartherShoreClient {
|
|
12
|
+
/** Resolve + cache the product/env/gateway for the current portal host. Safe
|
|
13
|
+
* to call repeatedly (memoized). */
|
|
14
|
+
bootstrap(): Promise<Bootstrap>;
|
|
15
|
+
/** Set the consumer API key used for Gateway feature calls. */
|
|
16
|
+
setApiKey(key: string | null): void;
|
|
17
|
+
/** Set the Core session bearer directly (e.g. from the Clerk browser SDK). */
|
|
18
|
+
setSessionToken(token: string | null): void;
|
|
19
|
+
readonly product: ProductResource;
|
|
20
|
+
readonly auth: AuthResource;
|
|
21
|
+
readonly keys: KeysResource;
|
|
22
|
+
readonly usage: UsageResource;
|
|
23
|
+
readonly billing: BillingResource;
|
|
24
|
+
/** The product's plan catalog + the subscribe/checkout flow. */
|
|
25
|
+
readonly plans: PlansResource;
|
|
26
|
+
readonly analytics: AnalyticsResource;
|
|
27
|
+
/** A handle to a builder-defined feature, routed through the Gateway. */
|
|
28
|
+
feature(name: string): FeatureHandle;
|
|
29
|
+
/** Generic Gateway call (alias for `feature("…").fetch`). */
|
|
30
|
+
invoke(path: string, init?: GatewayRequestInit): Promise<Response>;
|
|
31
|
+
}
|
|
32
|
+
export declare function createFartherShoreClient(config: FartherShoreConfig): FartherShoreClient;
|
|
33
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,kBAAkB,EAGxB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,WAAW,kBAAkB;IACjC;yCACqC;IACrC,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,+DAA+D;IAC/D,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IACpC,8EAA8E;IAC9E,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAE5C,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IAEtC,yEAAyE;IACzE,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC;IACrC,6DAA6D;IAC7D,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACpE;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,kBAAkB,GACzB,kBAAkB,CAwCpB"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// The client factory. Frontend code creates one client (usually with just a
|
|
2
|
+
// coreUrl), then expresses intent — `fs.usage.summary()`, `fs.keys.list()`,
|
|
3
|
+
// `fs.feature("weather").json("/forecast")`. The client owns ALL routing: Core
|
|
4
|
+
// vs Gateway, auth, host/env scoping.
|
|
5
|
+
import { buildContext, } from "./config.js";
|
|
6
|
+
import { resolveBootstrap } from "./bootstrap.js";
|
|
7
|
+
import { gatewayFetch } from "./http.js";
|
|
8
|
+
import { createProductResource, } from "./resources/product.js";
|
|
9
|
+
import { createAuthResource } from "./resources/auth.js";
|
|
10
|
+
import { createKeysResource } from "./resources/keys.js";
|
|
11
|
+
import { createUsageResource } from "./resources/usage.js";
|
|
12
|
+
import { createBillingResource, } from "./resources/billing.js";
|
|
13
|
+
import { createPlansResource } from "./resources/plans.js";
|
|
14
|
+
import { createAnalyticsResource, } from "./resources/analytics.js";
|
|
15
|
+
import { createFeature, } from "./resources/feature.js";
|
|
16
|
+
export function createFartherShoreClient(config) {
|
|
17
|
+
const ctx = buildContext(config);
|
|
18
|
+
let cached = null;
|
|
19
|
+
let inflight = null;
|
|
20
|
+
function ensureBootstrap() {
|
|
21
|
+
if (cached)
|
|
22
|
+
return Promise.resolve(cached);
|
|
23
|
+
if (!inflight) {
|
|
24
|
+
inflight = resolveBootstrap(ctx)
|
|
25
|
+
.then((b) => {
|
|
26
|
+
cached = b;
|
|
27
|
+
inflight = null;
|
|
28
|
+
return b;
|
|
29
|
+
})
|
|
30
|
+
.catch((e) => {
|
|
31
|
+
inflight = null;
|
|
32
|
+
throw e;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return inflight;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
bootstrap: ensureBootstrap,
|
|
39
|
+
setApiKey(key) {
|
|
40
|
+
ctx.apiKey = key;
|
|
41
|
+
},
|
|
42
|
+
setSessionToken(token) {
|
|
43
|
+
ctx.sessionToken = token;
|
|
44
|
+
},
|
|
45
|
+
product: createProductResource(ensureBootstrap),
|
|
46
|
+
auth: createAuthResource(ctx),
|
|
47
|
+
keys: createKeysResource(ctx),
|
|
48
|
+
usage: createUsageResource(ctx),
|
|
49
|
+
billing: createBillingResource(ctx),
|
|
50
|
+
plans: createPlansResource(ctx, ensureBootstrap),
|
|
51
|
+
analytics: createAnalyticsResource(),
|
|
52
|
+
feature: (name) => createFeature(ctx, name),
|
|
53
|
+
invoke: (path, init) => gatewayFetch(ctx, path, init),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,4EAA4E;AAC5E,+EAA+E;AAC/E,sCAAsC;AAEtC,OAAO,EAGL,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,qBAAqB,GAEtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAqB,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAqB,MAAM,qBAAqB,CAAC;AA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AAkB,CAAC,GAAG,CAAC;QAC7B,KAAK,EAAE,mBAAmB,CAAC,GAAG,CAAC;QAC/B,OAAO,EAAE,qBAAqB,CAAC,GAAG,CAAC;QACnC,KAAK,EAAE,mBAAmB,CAAC,GAAG,EAAE,eAAe,CAAC;QAChD,SAAS,EAAE,uBAAuB,EAAE;QACpC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC;QAC3C,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC;KACtD,CAAC;AACJ,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type FetchLike = typeof fetch;
|
|
2
|
+
/** Returns the current session bearer token (Clerk session JWT or persona JWT),
|
|
3
|
+
* or null/undefined when signed out. May be async (e.g. Clerk's getToken). */
|
|
4
|
+
export type TokenProvider = () => string | null | undefined | Promise<string | null | undefined>;
|
|
5
|
+
export interface FartherShoreConfig {
|
|
6
|
+
/** Platform Core base URL (cross-origin from a static portal), e.g.
|
|
7
|
+
* `https://core.farthershore.com`. The only required field. */
|
|
8
|
+
coreUrl: string;
|
|
9
|
+
/** Portal host that identifies the product/env to Core. Defaults to
|
|
10
|
+
* `globalThis.location.host` in the browser. */
|
|
11
|
+
portalHost?: string;
|
|
12
|
+
/** Pin the product id. Usually omitted — `bootstrap()` discovers it from the
|
|
13
|
+
* portal host. */
|
|
14
|
+
productId?: string;
|
|
15
|
+
/** Ephemeral/preview environment id (scopes test-mode + env-branch reads). */
|
|
16
|
+
environmentId?: string | null;
|
|
17
|
+
/** Owning org id for org-owned subscriptions (the `x-fs-organization-id`
|
|
18
|
+
* header / `organizationId` query). */
|
|
19
|
+
organizationId?: string | null;
|
|
20
|
+
/** Override the Gateway origin. Normally derived from the product's
|
|
21
|
+
* `runtimeHostname` discovered at bootstrap. */
|
|
22
|
+
gatewayUrl?: string;
|
|
23
|
+
/** The consumer API key (`fsk_…`) used to authenticate Gateway feature calls.
|
|
24
|
+
* Settable later via `fs.setApiKey()`. */
|
|
25
|
+
apiKey?: string;
|
|
26
|
+
/** Session token provider for Core calls. The host app owns the session (the
|
|
27
|
+
* Clerk browser SDK, or the persona sign-in flow `fs.auth.signIn`). When the
|
|
28
|
+
* persona flow is used, the SDK manages the token itself. */
|
|
29
|
+
getToken?: TokenProvider;
|
|
30
|
+
/** Injectable fetch (tests / non-browser runtimes). Defaults to global fetch. */
|
|
31
|
+
fetch?: FetchLike;
|
|
32
|
+
}
|
|
33
|
+
/** Mutable, per-client runtime context the resources share. Bootstrap fills in
|
|
34
|
+
* the discovered product/env/gateway; sign-in fills in the session token. */
|
|
35
|
+
export interface ClientContext {
|
|
36
|
+
coreUrl: string;
|
|
37
|
+
portalHost: string | null;
|
|
38
|
+
productId: string | null;
|
|
39
|
+
environmentId: string | null;
|
|
40
|
+
organizationId: string | null;
|
|
41
|
+
gatewayUrl: string | null;
|
|
42
|
+
apiKey: string | null;
|
|
43
|
+
/** SDK-managed session token (set by `fs.auth.signIn`), falling back to the
|
|
44
|
+
* configured `getToken` provider. */
|
|
45
|
+
sessionToken: string | null;
|
|
46
|
+
getToken?: TokenProvider;
|
|
47
|
+
fetch: FetchLike;
|
|
48
|
+
}
|
|
49
|
+
export declare function buildContext(config: FartherShoreConfig): ClientContext;
|
|
50
|
+
/** Resolve the bearer token for a Core request: the SDK-managed session token
|
|
51
|
+
* (persona sign-in) wins, else the configured provider. */
|
|
52
|
+
export declare function resolveToken(ctx: ClientContext): Promise<string | null>;
|
|
53
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC;AAErC;+EAC+E;AAC/E,MAAM,MAAM,aAA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AAC,CAO7E"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Client configuration + the shared request context the resources read.
|
|
2
|
+
//
|
|
3
|
+
// The whole point of the SDK: frontend code never sees Core/Gateway URLs, auth
|
|
4
|
+
// endpoints, or routing rules. It configures the client ONCE (usually just a
|
|
5
|
+
// coreUrl) and expresses intent (`fs.usage.summary()`); the SDK owns where the
|
|
6
|
+
// request goes and how it's authenticated.
|
|
7
|
+
function trimTrailingSlash(u) {
|
|
8
|
+
return u.replace(/\/+$/, "");
|
|
9
|
+
}
|
|
10
|
+
export function buildContext(config) {
|
|
11
|
+
if (!config.coreUrl) {
|
|
12
|
+
throw new Error("createFartherShoreClient: `coreUrl` is required");
|
|
13
|
+
}
|
|
14
|
+
const portalHost = config.portalHost ??
|
|
15
|
+
(typeof globalThis !== "undefined" &&
|
|
16
|
+
globalThis.location?.host
|
|
17
|
+
? globalThis.location.host
|
|
18
|
+
: null);
|
|
19
|
+
const fetchImpl = config.fetch ??
|
|
20
|
+
(typeof fetch !== "undefined" ? fetch.bind(globalThis) : undefined);
|
|
21
|
+
if (!fetchImpl) {
|
|
22
|
+
throw new Error("createFartherShoreClient: no global fetch; pass `fetch` in the config");
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
coreUrl: trimTrailingSlash(config.coreUrl),
|
|
26
|
+
portalHost: portalHost ? portalHost.toLowerCase() : null,
|
|
27
|
+
productId: config.productId ?? null,
|
|
28
|
+
environmentId: config.environmentId ?? null,
|
|
29
|
+
organizationId: config.organizationId ?? null,
|
|
30
|
+
gatewayUrl: config.gatewayUrl ? trimTrailingSlash(config.gatewayUrl) : null,
|
|
31
|
+
apiKey: config.apiKey ?? null,
|
|
32
|
+
sessionToken: null,
|
|
33
|
+
getToken: config.getToken,
|
|
34
|
+
fetch: fetchImpl,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** Resolve the bearer token for a Core request: the SDK-managed session token
|
|
38
|
+
* (persona sign-in) wins, else the configured provider. */
|
|
39
|
+
export async function resolveToken(ctx) {
|
|
40
|
+
if (ctx.sessionToken)
|
|
41
|
+
return ctx.sessionToken;
|
|
42
|
+
if (ctx.getToken) {
|
|
43
|
+
const t = await ctx.getToken();
|
|
44
|
+
return t ?? null;
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,+EAA+E;AAC/E,2CAA2C;AA0D3C,SAAS,iBAAiB,CAAC,CAAS;IAClC,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAA0B;IACrD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IACD,MAAM,UAAU,GACd,MAAM,CAAC,UAAU;QACjB,CAAC,OAAO,UAAU,KAAK,WAAW;YACjC,UAA+C,CAAC,QAAQ,EAAE,IAAI;YAC7D,CAAC,CAAE,UAA6C,CAAC,QAAQ,CAAC,IAAI;YAC9D,CAAC,CAAC,IAAI,CAAC,CAAC;IAEZ,MAAM,SAAS,GACb,MAAM,CAAC,KAAK;QACZ,CAAC,OAAO,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACtE,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,uEAAuE,CACxE,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,iBAAiB,CAAC,MAAM,CAAC,OAAO,CAAC;QAC1C,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI;QACxD,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,IAAI;QACnC,aAAa,EAAE,MAAM,CAAC,aAAa,IAAI,IAAI;QAC3C,cAAc,EAAE,MAAM,CAAC,cAAc,IAAI,IAAI;QAC7C,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI;QAC3E,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,IAAI;QAC7B,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,KAAK,EAAE,SAAS;KACjB,CAAC;AACJ,CAAC;AAED;4DAC4D;AAC5D,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAkB;IACnD,IAAI,GAAG,CAAC,YAAY;QAAE,OAAO,GAAG,CAAC,YAAY,CAAC;IAC9C,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;QACjB,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC/B,OAAO,CAAC,IAAI,IAAI,CAAC;IACnB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare class FartherShoreError extends Error {
|
|
2
|
+
constructor(message: string);
|
|
3
|
+
}
|
|
4
|
+
/** A non-2xx response from Core or the Gateway. Carries the platform error
|
|
5
|
+
* envelope `{ error: { code, message } }` when present. */
|
|
6
|
+
export declare class FartherShoreApiError extends FartherShoreError {
|
|
7
|
+
readonly status: number;
|
|
8
|
+
readonly code: string;
|
|
9
|
+
readonly body: unknown;
|
|
10
|
+
constructor(status: number, code: string, message: string, body: unknown);
|
|
11
|
+
}
|
|
12
|
+
/** A network-level failure (DNS, connection, CORS, abort). */
|
|
13
|
+
export declare class FartherShoreNetworkError extends FartherShoreError {
|
|
14
|
+
readonly cause?: unknown;
|
|
15
|
+
constructor(message: string, cause?: unknown);
|
|
16
|
+
}
|
|
17
|
+
/** Thrown when calling a surface that has no platform endpoint yet (an honest
|
|
18
|
+
* stub — the SDK never silently no-ops a missing capability). */
|
|
19
|
+
export declare class FartherShoreNotImplementedError extends FartherShoreError {
|
|
20
|
+
constructor(message: string);
|
|
21
|
+
}
|
|
22
|
+
/** Thrown when the client is used before `bootstrap()` has resolved the product
|
|
23
|
+
* it needs (e.g. a per-product call with no configured productId). */
|
|
24
|
+
export declare class FartherShoreNotReadyError extends FartherShoreError {
|
|
25
|
+
constructor(message: string);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI5B;AAED;4DAC4D;AAC5D,qBAAa,oBAAqB,SAAQ,iBAAiB;IACzD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;gBACX,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;CAOzE;AAED,8DAA8D;AAC9D,qBAAa,wBAAyB,SAAQ,iBAAiB;IAC7D,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;gBACb,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAK7C;AAED;kEACkE;AAClE,qBAAa,+BAAgC,SAAQ,iBAAiB;gBACxD,OAAO,EAAE,MAAM;CAI5B;AAED;uEACuE;AACvE,qBAAa,yBAA0B,SAAQ,iBAAiB;gBAClD,OAAO,EAAE,MAAM;CAI5B"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// SDK error model. Every failure a frontend can catch is one of these.
|
|
2
|
+
export class FartherShoreError extends Error {
|
|
3
|
+
constructor(message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = "FartherShoreError";
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/** A non-2xx response from Core or the Gateway. Carries the platform error
|
|
9
|
+
* envelope `{ error: { code, message } }` when present. */
|
|
10
|
+
export class FartherShoreApiError extends FartherShoreError {
|
|
11
|
+
status;
|
|
12
|
+
code;
|
|
13
|
+
body;
|
|
14
|
+
constructor(status, code, message, body) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.name = "FartherShoreApiError";
|
|
17
|
+
this.status = status;
|
|
18
|
+
this.code = code;
|
|
19
|
+
this.body = body;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** A network-level failure (DNS, connection, CORS, abort). */
|
|
23
|
+
export class FartherShoreNetworkError extends FartherShoreError {
|
|
24
|
+
cause;
|
|
25
|
+
constructor(message, cause) {
|
|
26
|
+
super(message);
|
|
27
|
+
this.name = "FartherShoreNetworkError";
|
|
28
|
+
this.cause = cause;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** Thrown when calling a surface that has no platform endpoint yet (an honest
|
|
32
|
+
* stub — the SDK never silently no-ops a missing capability). */
|
|
33
|
+
export class FartherShoreNotImplementedError extends FartherShoreError {
|
|
34
|
+
constructor(message) {
|
|
35
|
+
super(message);
|
|
36
|
+
this.name = "FartherShoreNotImplementedError";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** Thrown when the client is used before `bootstrap()` has resolved the product
|
|
40
|
+
* it needs (e.g. a per-product call with no configured productId). */
|
|
41
|
+
export class FartherShoreNotReadyError extends FartherShoreError {
|
|
42
|
+
constructor(message) {
|
|
43
|
+
super(message);
|
|
44
|
+
this.name = "FartherShoreNotReadyError";
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,uEAAuE;AAEvE,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED;4DAC4D;AAC5D,MAAM,OAAO,oBAAqB,SAAQ,iBAAiB;IAChD,MAAM,CAAS;IACf,IAAI,CAAS;IACb,IAAI,CAAU;IACvB,YAAY,MAAc,EAAE,IAAY,EAAE,OAAe,EAAE,IAAa;QACtE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,8DAA8D;AAC9D,MAAM,OAAO,wBAAyB,SAAQ,iBAAiB;IACpD,KAAK,CAAW;IACzB,YAAY,OAAe,EAAE,KAAe;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;QACvC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAED;kEACkE;AAClE,MAAM,OAAO,+BAAgC,SAAQ,iBAAiB;IACpE,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iCAAiC,CAAC;IAChD,CAAC;CACF;AAED;uEACuE;AACvE,MAAM,OAAO,yBAA0B,SAAQ,iBAAiB;IAC9D,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF"}
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ClientContext } from "./config.js";
|
|
2
|
+
export interface CoreRequest {
|
|
3
|
+
method: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
|
|
4
|
+
path: string;
|
|
5
|
+
query?: Record<string, string | number | undefined | null>;
|
|
6
|
+
body?: unknown;
|
|
7
|
+
/** "session" attaches the consumer session bearer; "none" is for public
|
|
8
|
+
* endpoints (resolve/discover). Defaults to "session". */
|
|
9
|
+
auth?: "session" | "none";
|
|
10
|
+
}
|
|
11
|
+
/** Issue a Core request, returning the parsed JSON body (typed by the caller).
|
|
12
|
+
* Adds the consumer session bearer + the host/env/org scoping headers Core
|
|
13
|
+
* needs, and maps non-2xx to {@link FartherShoreApiError}. */
|
|
14
|
+
export declare function coreFetch<T>(ctx: ClientContext, req: CoreRequest): Promise<T>;
|
|
15
|
+
/** Issue a Gateway (builder-feature) request. Auth is the consumer API key
|
|
16
|
+
* (`fsk_…`), NOT the session token. Returns the raw `Response` so callers can
|
|
17
|
+
* consume any content type; throws {@link FartherShoreApiError} on non-2xx with
|
|
18
|
+
* the body already read. */
|
|
19
|
+
export declare function gatewayFetch(ctx: ClientContext, path: string, init?: RequestInit & {
|
|
20
|
+
apiKey?: string;
|
|
21
|
+
}): Promise<Response>;
|
|
22
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,aAAa,EAAgB,MAAM,aAAa,CAAC;AAG/D,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;IAC3D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;+DAC2D;IAC3D,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;CAC3B;AAwCD;;+DAE+D;AAC/D,wBAAsB,SAAS,CAAC,CAAC,EAC/B,GAAG,EAAE,aAAa,EAClB,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,CAAC,CAAC,CAmCZ;AAED;;;6BAG6B;AAC7B,wBAAsB,YAAY,CAChC,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAC3C,OAAO,CAAC,QAAQ,CAAC,CA8BnB"}
|
package/dist/http.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Transport. The two destinations the SDK owns — Core (platform APIs) and the
|
|
2
|
+
// Gateway (builder features) — and the auth each one needs. Frontend code never
|
|
3
|
+
// constructs a URL or sets an auth header; it goes through here.
|
|
4
|
+
import { resolveToken } from "./config.js";
|
|
5
|
+
import { FartherShoreApiError, FartherShoreNetworkError } from "./errors.js";
|
|
6
|
+
function buildUrl(base, path, query) {
|
|
7
|
+
const url = new URL(base + path);
|
|
8
|
+
if (query) {
|
|
9
|
+
for (const [k, v] of Object.entries(query)) {
|
|
10
|
+
if (v !== undefined && v !== null)
|
|
11
|
+
url.searchParams.set(k, String(v));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return url.toString();
|
|
15
|
+
}
|
|
16
|
+
async function parseBody(res) {
|
|
17
|
+
const ct = res.headers.get("content-type") ?? "";
|
|
18
|
+
if (ct.includes("application/json")) {
|
|
19
|
+
return res.json().catch(() => null);
|
|
20
|
+
}
|
|
21
|
+
return res.text().catch(() => null);
|
|
22
|
+
}
|
|
23
|
+
function extractError(status, body) {
|
|
24
|
+
if (body && typeof body === "object" && "error" in body) {
|
|
25
|
+
const e = body.error;
|
|
26
|
+
if (e) {
|
|
27
|
+
return {
|
|
28
|
+
code: e.code ?? "unknown",
|
|
29
|
+
message: e.message ?? `Request failed (${status})`,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return { code: "unknown", message: `Request failed (${status})` };
|
|
34
|
+
}
|
|
35
|
+
/** Issue a Core request, returning the parsed JSON body (typed by the caller).
|
|
36
|
+
* Adds the consumer session bearer + the host/env/org scoping headers Core
|
|
37
|
+
* needs, and maps non-2xx to {@link FartherShoreApiError}. */
|
|
38
|
+
export async function coreFetch(ctx, req) {
|
|
39
|
+
const headers = { accept: "application/json" };
|
|
40
|
+
if (req.body !== undefined)
|
|
41
|
+
headers["content-type"] = "application/json";
|
|
42
|
+
if (ctx.portalHost)
|
|
43
|
+
headers["x-portal-host"] = ctx.portalHost;
|
|
44
|
+
if (ctx.environmentId)
|
|
45
|
+
headers["x-environment-id"] = ctx.environmentId;
|
|
46
|
+
if (ctx.organizationId)
|
|
47
|
+
headers["x-fs-organization-id"] = ctx.organizationId;
|
|
48
|
+
if (req.auth !== "none") {
|
|
49
|
+
const token = await resolveToken(ctx);
|
|
50
|
+
if (token)
|
|
51
|
+
headers["authorization"] = `Bearer ${token}`;
|
|
52
|
+
}
|
|
53
|
+
const url = buildUrl(ctx.coreUrl, req.path, req.query);
|
|
54
|
+
let res;
|
|
55
|
+
try {
|
|
56
|
+
res = await ctx.fetch(url, {
|
|
57
|
+
method: req.method,
|
|
58
|
+
headers,
|
|
59
|
+
body: req.body !== undefined ? JSON.stringify(req.body) : undefined,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
throw new FartherShoreNetworkError(`Core request failed: ${err instanceof Error ? err.message : String(err)}`, err);
|
|
64
|
+
}
|
|
65
|
+
if (res.status === 204)
|
|
66
|
+
return undefined;
|
|
67
|
+
const body = await parseBody(res);
|
|
68
|
+
if (!res.ok) {
|
|
69
|
+
const { code, message } = extractError(res.status, body);
|
|
70
|
+
throw new FartherShoreApiError(res.status, code, message, body);
|
|
71
|
+
}
|
|
72
|
+
return body;
|
|
73
|
+
}
|
|
74
|
+
/** Issue a Gateway (builder-feature) request. Auth is the consumer API key
|
|
75
|
+
* (`fsk_…`), NOT the session token. Returns the raw `Response` so callers can
|
|
76
|
+
* consume any content type; throws {@link FartherShoreApiError} on non-2xx with
|
|
77
|
+
* the body already read. */
|
|
78
|
+
export async function gatewayFetch(ctx, path, init = {}) {
|
|
79
|
+
if (!ctx.gatewayUrl) {
|
|
80
|
+
throw new FartherShoreNetworkError("Gateway origin unknown — call fs.bootstrap() first (or set gatewayUrl).");
|
|
81
|
+
}
|
|
82
|
+
const apiKey = init.apiKey ?? ctx.apiKey;
|
|
83
|
+
const headers = new Headers(init.headers);
|
|
84
|
+
if (apiKey && !headers.has("authorization")) {
|
|
85
|
+
headers.set("authorization", `Bearer ${apiKey}`);
|
|
86
|
+
}
|
|
87
|
+
const url = ctx.gatewayUrl + (path.startsWith("/") ? path : `/${path}`);
|
|
88
|
+
const { apiKey: _omit, ...rest } = init;
|
|
89
|
+
void _omit;
|
|
90
|
+
let res;
|
|
91
|
+
try {
|
|
92
|
+
res = await ctx.fetch(url, { ...rest, headers });
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
throw new FartherShoreNetworkError(`Gateway request failed: ${err instanceof Error ? err.message : String(err)}`, err);
|
|
96
|
+
}
|
|
97
|
+
if (!res.ok) {
|
|
98
|
+
const body = await parseBody(res.clone());
|
|
99
|
+
const { code, message } = extractError(res.status, body);
|
|
100
|
+
throw new FartherShoreApiError(res.status, code, message, body);
|
|
101
|
+
}
|
|
102
|
+
return res;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=http.js.map
|
package/dist/http.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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FartherShoreClient } from "./client.js";
|
|
2
|
+
export type { FartherShoreClient } from "./client.js";
|
|
3
|
+
export type { FartherShoreConfig, TokenProvider, FetchLike } from "./config.js";
|
|
4
|
+
export { FartherShoreError, FartherShoreApiError, FartherShoreNetworkError, FartherShoreNotImplementedError, FartherShoreNotReadyError, } from "./errors.js";
|
|
5
|
+
export type { Branding, Product, Meter, AuthStrategy, EnvironmentInfo, Bootstrap, Plan, PlanMeter, PlanLimit, Grant, Subscriber, Session, ApiKey, CreatedApiKey, UsageSummary, UsageEvent, Subscription, SignInResult, } from "./types.js";
|
|
6
|
+
export type { ProductResource } from "./resources/product.js";
|
|
7
|
+
export type { AuthResource } from "./resources/auth.js";
|
|
8
|
+
export type { KeysResource } from "./resources/keys.js";
|
|
9
|
+
export type { UsageResource, UsageRange } from "./resources/usage.js";
|
|
10
|
+
export type { BillingResource, CreditBalance } from "./resources/billing.js";
|
|
11
|
+
export type { PlansResource, SubscribeInput, SubscribeResult, } from "./resources/plans.js";
|
|
12
|
+
export type { AnalyticsResource } from "./resources/analytics.js";
|
|
13
|
+
export type { FeatureHandle, GatewayRequestInit } from "./resources/feature.js";
|
|
14
|
+
export { classifyPlan, isFreePlan, isPayAsYouGoPlan, formatPlanPrice, formatCents, formatPriceFromMicros, summarizeMeterPricing, formatMinimumSpend, synthesizePlanFeatures, effectiveGrants, buildGrantRows, quotaForDimension, computeProgressBar, buildMeterUsageRows, } from "./catalog.js";
|
|
15
|
+
export type { PlanKind, GrantRow, MeterUsageRow } from "./catalog.js";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,SAAS,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2
|
+
//
|
|
3
|
+
// The canonical browser integration layer between a static frontend artifact and
|
|
4
|
+
// the Farther Shore platform. Frontend code expresses intent; the SDK owns where
|
|
5
|
+
// requests go (Core vs Gateway), how they're authenticated, and host/env scoping.
|
|
6
|
+
//
|
|
7
|
+
// import { createFartherShoreClient } from "@farthershore/farthershore-js";
|
|
8
|
+
// const fs = createFartherShoreClient({ coreUrl: "https://core.farthershore.com" });
|
|
9
|
+
// const { product } = await fs.bootstrap();
|
|
10
|
+
// const keys = await fs.keys.list();
|
|
11
|
+
// const forecast = await fs.feature("weather").json("/forecast?city=NYC");
|
|
12
|
+
export { createFartherShoreClient } from "./client.js";
|
|
13
|
+
export { FartherShoreError, FartherShoreApiError, FartherShoreNetworkError, FartherShoreNotImplementedError, FartherShoreNotReadyError, } from "./errors.js";
|
|
14
|
+
// Pure catalog/pricing display helpers (plan classification, price/grant/quota
|
|
15
|
+
// formatting) — port of the SSR portal's renderers so any frontend renders the
|
|
16
|
+
// catalog identically without re-deriving the math.
|
|
17
|
+
export { classifyPlan, isFreePlan, isPayAsYouGoPlan, formatPlanPrice, formatCents, formatPriceFromMicros, summarizeMeterPricing, formatMinimumSpend, synthesizePlanFeatures, effectiveGrants, buildGrantRows, quotaForDimension, computeProgressBar, buildMeterUsageRows, } from "./catalog.js";
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,iFAAiF;AACjF,iFAAiF;AACjF,kFAAkF;AAClF,EAAE;AACF,8EAA8E;AAC9E,uFAAuF;AACvF,8CAA8C;AAC9C,uCAAuC;AACvC,6EAA6E;AAE7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAKvD,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,+BAA+B,EAC/B,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AAoCrB,+EAA+E;AAC/E,+EAA+E;AAC/E,oDAAoD;AACpD,OAAO,EACL,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ApiKey, Bootstrap, CreatedApiKey, CreditBalance, FeatureHandle, Plan, Product, Session, SubscribeInput, SubscribeResult, Subscription, UsageEvent, UsageSummary } from "../index.js";
|
|
2
|
+
import { type AsyncResult } from "./use-async.js";
|
|
3
|
+
export declare function useBootstrap(): AsyncResult<Bootstrap>;
|
|
4
|
+
export declare function useProduct(): AsyncResult<Product>;
|
|
5
|
+
export interface SessionResult extends AsyncResult<Session> {
|
|
6
|
+
signIn(input: {
|
|
7
|
+
apiKey: string;
|
|
8
|
+
}): Promise<void>;
|
|
9
|
+
signOut(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare function useSession(): SessionResult;
|
|
12
|
+
export interface ApiKeysResult extends AsyncResult<ApiKey[]> {
|
|
13
|
+
create(input?: {
|
|
14
|
+
label?: string;
|
|
15
|
+
scopes?: string[];
|
|
16
|
+
}): Promise<CreatedApiKey>;
|
|
17
|
+
revoke(keyId: string): Promise<void>;
|
|
18
|
+
rotate(keyId: string): Promise<CreatedApiKey>;
|
|
19
|
+
}
|
|
20
|
+
export declare function useApiKeys(): ApiKeysResult;
|
|
21
|
+
export interface UsageData {
|
|
22
|
+
summary: UsageSummary;
|
|
23
|
+
events: UsageEvent[];
|
|
24
|
+
}
|
|
25
|
+
export declare function useUsage(range?: {
|
|
26
|
+
from?: string;
|
|
27
|
+
to?: string;
|
|
28
|
+
}): AsyncResult<UsageData>;
|
|
29
|
+
export interface BillingResult extends AsyncResult<Subscription | null> {
|
|
30
|
+
openBillingPortal(input?: {
|
|
31
|
+
returnUrl?: string;
|
|
32
|
+
}): Promise<{
|
|
33
|
+
url: string;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
export declare function useBilling(): BillingResult;
|
|
37
|
+
/** The product's plan catalog + the subscribe/checkout mutation. The data is
|
|
38
|
+
* the same plan list `bootstrap()` resolves; `subscribe()` starts checkout. */
|
|
39
|
+
export interface PlansResult extends AsyncResult<Plan[]> {
|
|
40
|
+
subscribe(input: SubscribeInput): Promise<SubscribeResult>;
|
|
41
|
+
}
|
|
42
|
+
export declare function usePlans(): PlansResult;
|
|
43
|
+
/** Live prepaid/credit balance for the current subscription, or null. */
|
|
44
|
+
export declare function useCreditBalance(): AsyncResult<CreditBalance | null>;
|
|
45
|
+
/** A stable handle to a builder feature (routed through the Gateway). */
|
|
46
|
+
export declare function useFeature(name: string): FeatureHandle;
|
|
47
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/react/hooks.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,MAAM,EACN,SAAS,EACT,aAAa,EACb,aAAa,EACb,aAAa,EACb,IAAI,EACJ,OAAO,EACP,OAAO,EACP,cAAc,EACd,eAAe,EACf,YAAY,EACZ,UAAU,EACV,YAAY,EACb,MAAM,aAAa,CAAC;AAErB,OAAO,EAAY,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE5D,wBAAgB,YAAY,IAAI,WAAW,CAAC,SAAS,CAAC,CAGrD;AAED,wBAAgB,UAAU,IAAI,WAAW,CAAC,OAAO,CAAC,CAGjD;AAED,MAAM,WAAW,aAAc,SAAQ,WAAW,CAAC,OAAO,CAAC;IACzD,MAAM,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,OAAO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