@funcd-dev/shim 0.20.0 → 0.22.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/dist/lake.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ export interface LakeEndpoint {
2
+ url: string;
3
+ token: string;
4
+ }
5
+ /** A function's lake bindings by alias (funcd ADR-0245). */
6
+ export interface LakeClient {
7
+ /** Throws an Error naming the alias when it is not bound. */
8
+ get(alias: string): LakeEndpoint;
9
+ }
10
+ export declare function makeLake(env?: NodeJS.ProcessEnv): LakeClient;
package/dist/lake.js ADDED
@@ -0,0 +1,14 @@
1
+ // context.lake — a lake binding's proxy URL and this function's token (funcd ADR-0245, ADR-0091, ADR-0137), from
2
+ // FUNCD_LAKE_<ALIAS>_URL and _TOKEN at call time.
3
+ export function makeLake(env = process.env) {
4
+ return {
5
+ get(alias) {
6
+ const prefix = `FUNCD_LAKE_${alias.toUpperCase()}_`;
7
+ const url = env[`${prefix}URL`];
8
+ const token = env[`${prefix}TOKEN`];
9
+ if (!url || !token)
10
+ throw new Error(`context.lake.get: lake "${alias}" is not bound`);
11
+ return { url, token };
12
+ },
13
+ };
14
+ }
package/dist/types.d.ts CHANGED
@@ -3,13 +3,13 @@ import type { BlobClient } from './blob.ts';
3
3
  import type { SQLClient } from './sql.ts';
4
4
  import type { ConfigClient } from './config.ts';
5
5
  import type { SecretClient } from './secret.ts';
6
- import type { CatalogClient } from './catalog.ts';
6
+ import type { LakeClient } from './lake.ts';
7
7
  export type { KVClient } from './kv.ts';
8
8
  export type { BlobClient, SignOptions } from './blob.ts';
9
9
  export type { SQLClient, SQLExecResult, SQLParam, SQLParams, SQLRow, SQLStatement, SQLValues, } from './sql.ts';
10
10
  export type { ConfigClient } from './config.ts';
11
11
  export type { SecretClient } from './secret.ts';
12
- export type { CatalogClient, CatalogEndpoint } from './catalog.ts';
12
+ export type { LakeClient, LakeEndpoint } from './lake.ts';
13
13
  /** A CloudEvent — the normalized trigger envelope (ADR-0023). */
14
14
  export interface CloudEvent<T = unknown> {
15
15
  id: string;
@@ -53,8 +53,8 @@ export interface FunctionContext {
53
53
  config: ConfigClient;
54
54
  /** The keys and values of the Secrets a function binds, read from funcd on every call (funcd ADR-0249). */
55
55
  secret: SecretClient;
56
- /** A bound catalog's proxy URL and this function's token, by spec.bindings.catalog alias (funcd ADR-0245). */
57
- catalog: CatalogClient;
56
+ /** A bound lake's proxy URL and this function's token, by spec.bindings.lake alias (funcd ADR-0245). */
57
+ lake: LakeClient;
58
58
  /** Milliseconds left before the call's deadline (X-Funcd-Timeout-Ms), floored at 0; null without one (ADR-0226). */
59
59
  remainingMs(): number | null;
60
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funcd-dev/shim",
3
- "version": "0.20.0",
3
+ "version": "0.22.0",
4
4
  "type": "module",
5
5
  "description": "Types and the contract build for writing funcd functions in TypeScript",
6
6
  "license": "Apache-2.0",
package/dist/catalog.d.ts DELETED
@@ -1,10 +0,0 @@
1
- export interface CatalogEndpoint {
2
- url: string;
3
- token: string;
4
- }
5
- /** A function's catalog bindings by alias (funcd ADR-0245). */
6
- export interface CatalogClient {
7
- /** Throws an Error naming the alias when it is not bound. */
8
- get(alias: string): CatalogEndpoint;
9
- }
10
- export declare function makeCatalog(env?: NodeJS.ProcessEnv): CatalogClient;
package/dist/catalog.js DELETED
@@ -1,14 +0,0 @@
1
- // context.catalog — a catalog binding's proxy URL and this function's token (funcd ADR-0245, ADR-0091, ADR-0137), from
2
- // FUNCD_CATALOG_<ALIAS>_URL and _TOKEN at call time.
3
- export function makeCatalog(env = process.env) {
4
- return {
5
- get(alias) {
6
- const prefix = `FUNCD_CATALOG_${alias.toUpperCase()}_`;
7
- const url = env[`${prefix}URL`];
8
- const token = env[`${prefix}TOKEN`];
9
- if (!url || !token)
10
- throw new Error(`context.catalog.get: catalog "${alias}" is not bound`);
11
- return { url, token };
12
- },
13
- };
14
- }