clefbase 1.4.1 → 1.5.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.
@@ -0,0 +1,94 @@
1
+ import { HttpClient } from "./http";
2
+ import type { FunctionRuntime, FunctionTrigger, FunctionTriggerType, FunctionDef, FunctionExecution, FunctionsConfig, FunctionStats, DeployFunctionOptions, HttpsCallableResult } from "./types";
3
+ export type { FunctionRuntime, FunctionTrigger, FunctionTriggerType, FunctionDef, FunctionExecution, FunctionsConfig, FunctionStats, DeployFunctionOptions, HttpsCallableResult, };
4
+ /**
5
+ * Create a strongly-typed callable reference to an HTTP-triggered function.
6
+ *
7
+ * @example
8
+ * const add = httpsCallable<{ a: number; b: number }, { sum: number }>(fns, "addNumbers");
9
+ * const { data } = await add({ a: 3, b: 4 });
10
+ * console.log(data.sum); // 7
11
+ */
12
+ export declare function httpsCallable<TInput = unknown, TOutput = unknown>(fns: ClefbaseFunctions, name: string): (data?: TInput) => Promise<HttpsCallableResult<TOutput>>;
13
+ /**
14
+ * Clefbase Functions service.
15
+ *
16
+ * Obtained via `getFunctions(app)`.
17
+ *
18
+ * @example
19
+ * import { initClefbase, getFunctions, httpsCallable } from "clefbase";
20
+ *
21
+ * const app = initClefbase({ serverUrl, projectId, apiKey, adminSecret: "" });
22
+ * const fns = getFunctions(app);
23
+ *
24
+ * // Call an HTTP function
25
+ * const greet = httpsCallable<{ name: string }, { message: string }>(fns, "greetUser");
26
+ * const { data } = await greet({ name: "Alice" });
27
+ *
28
+ * // Deploy from source
29
+ * await fns.deploy({
30
+ * name: "greetUser",
31
+ * runtime: "node",
32
+ * trigger: { type: "http" },
33
+ * source: `export async function handler(ctx) { return { message: "Hi " + ctx.data.name }; }`,
34
+ * });
35
+ */
36
+ export declare class ClefbaseFunctions {
37
+ private readonly _http;
38
+ /** @internal */
39
+ constructor(_http: HttpClient);
40
+ /**
41
+ * Initialise Functions for the project if not already done.
42
+ * Safe to call multiple times — returns the existing config if found.
43
+ * Called automatically by `deploy()` so you rarely need this directly.
44
+ */
45
+ initProject(opts?: {
46
+ maxConcurrentExecutions?: number;
47
+ defaultTimeoutMs?: number;
48
+ }): Promise<FunctionsConfig>;
49
+ /**
50
+ * Deploy (or redeploy) a function from source code.
51
+ * Calling this a second time with the same `name` updates the function in-place.
52
+ *
53
+ * @example
54
+ * await fns.deploy({
55
+ * name: "sendWelcome",
56
+ * runtime: "node",
57
+ * trigger: { type: "onUserCreate" },
58
+ * source: `
59
+ * export async function handler(ctx) {
60
+ * console.log("New user:", ctx.data.email);
61
+ * }
62
+ * `,
63
+ * });
64
+ */
65
+ deploy(options: DeployFunctionOptions): Promise<FunctionDef>;
66
+ /**
67
+ * List all functions deployed to this project.
68
+ * Returns a lightweight summary (no source code).
69
+ */
70
+ list(): Promise<FunctionDef[]>;
71
+ /**
72
+ * Delete a deployed function by name.
73
+ */
74
+ delete(name: string): Promise<{
75
+ deleted: boolean;
76
+ name: string;
77
+ }>;
78
+ /**
79
+ * Call an HTTP-triggered function and return its result.
80
+ * Throws a `ClefbaseError` if the function errors or times out.
81
+ *
82
+ * @example
83
+ * const { data, durationMs } = await fns.call("processOrder", { orderId: "abc" });
84
+ */
85
+ call<TInput = unknown, TOutput = unknown>(name: string, data?: TInput): Promise<HttpsCallableResult<TOutput>>;
86
+ /**
87
+ * Fetch the execution history for a specific function.
88
+ *
89
+ * @param name Function name
90
+ * @param limit Max results to return (default: 20, max: 100)
91
+ */
92
+ executions(name: string, limit?: number): Promise<FunctionExecution[]>;
93
+ }
94
+ //# sourceMappingURL=functions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,qBAAq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AAE,MAAM,EAAE,KAAK,SAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;CAMzE"}
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClefbaseFunctions = void 0;
4
+ exports.httpsCallable = httpsCallable;
5
+ // ─── HttpsCallable ────────────────────────────────────────────────────────────
6
+ /**
7
+ * Create a strongly-typed callable reference to an HTTP-triggered function.
8
+ *
9
+ * @example
10
+ * const add = httpsCallable<{ a: number; b: number }, { sum: number }>(fns, "addNumbers");
11
+ * const { data } = await add({ a: 3, b: 4 });
12
+ * console.log(data.sum); // 7
13
+ */
14
+ function httpsCallable(fns, name) {
15
+ return (data) => fns.call(name, data);
16
+ }
17
+ // ─── ClefbaseFunctions ────────────────────────────────────────────────────────
18
+ /**
19
+ * Clefbase Functions service.
20
+ *
21
+ * Obtained via `getFunctions(app)`.
22
+ *
23
+ * @example
24
+ * import { initClefbase, getFunctions, httpsCallable } from "clefbase";
25
+ *
26
+ * const app = initClefbase({ serverUrl, projectId, apiKey, adminSecret: "" });
27
+ * const fns = getFunctions(app);
28
+ *
29
+ * // Call an HTTP function
30
+ * const greet = httpsCallable<{ name: string }, { message: string }>(fns, "greetUser");
31
+ * const { data } = await greet({ name: "Alice" });
32
+ *
33
+ * // Deploy from source
34
+ * await fns.deploy({
35
+ * name: "greetUser",
36
+ * runtime: "node",
37
+ * trigger: { type: "http" },
38
+ * source: `export async function handler(ctx) { return { message: "Hi " + ctx.data.name }; }`,
39
+ * });
40
+ */
41
+ class ClefbaseFunctions {
42
+ /** @internal */
43
+ constructor(_http) {
44
+ this._http = _http;
45
+ }
46
+ // ─── Config ────────────────────────────────────────────────────────────────
47
+ /**
48
+ * Initialise Functions for the project if not already done.
49
+ * Safe to call multiple times — returns the existing config if found.
50
+ * Called automatically by `deploy()` so you rarely need this directly.
51
+ */
52
+ async initProject(opts) {
53
+ // The external SDK router auto-initialises on deploy, but expose this
54
+ // for explicit setup or config updates.
55
+ return this._http.post("/", opts ?? {});
56
+ }
57
+ // ─── Deploy ────────────────────────────────────────────────────────────────
58
+ /**
59
+ * Deploy (or redeploy) a function from source code.
60
+ * Calling this a second time with the same `name` updates the function in-place.
61
+ *
62
+ * @example
63
+ * await fns.deploy({
64
+ * name: "sendWelcome",
65
+ * runtime: "node",
66
+ * trigger: { type: "onUserCreate" },
67
+ * source: `
68
+ * export async function handler(ctx) {
69
+ * console.log("New user:", ctx.data.email);
70
+ * }
71
+ * `,
72
+ * });
73
+ */
74
+ async deploy(options) {
75
+ return this._http.post("/deploy", options);
76
+ }
77
+ // ─── List ──────────────────────────────────────────────────────────────────
78
+ /**
79
+ * List all functions deployed to this project.
80
+ * Returns a lightweight summary (no source code).
81
+ */
82
+ async list() {
83
+ return this._http.get("/");
84
+ }
85
+ // ─── Delete ────────────────────────────────────────────────────────────────
86
+ /**
87
+ * Delete a deployed function by name.
88
+ */
89
+ async delete(name) {
90
+ return this._http.delete(`/${encodeURIComponent(name)}`);
91
+ }
92
+ // ─── Call ──────────────────────────────────────────────────────────────────
93
+ /**
94
+ * Call an HTTP-triggered function and return its result.
95
+ * Throws a `ClefbaseError` if the function errors or times out.
96
+ *
97
+ * @example
98
+ * const { data, durationMs } = await fns.call("processOrder", { orderId: "abc" });
99
+ */
100
+ async call(name, data) {
101
+ return this._http.post(`/call/${encodeURIComponent(name)}`, { data: data ?? null });
102
+ }
103
+ // ─── Executions ────────────────────────────────────────────────────────────
104
+ /**
105
+ * Fetch the execution history for a specific function.
106
+ *
107
+ * @param name Function name
108
+ * @param limit Max results to return (default: 20, max: 100)
109
+ */
110
+ async executions(name, limit = 20) {
111
+ const l = Math.min(limit, 100);
112
+ return this._http.get(`/${encodeURIComponent(name)}/executions?limit=${l}`);
113
+ }
114
+ }
115
+ exports.ClefbaseFunctions = ClefbaseFunctions;
116
+ //# sourceMappingURL=functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions.js","sourceRoot":"","sources":["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,EAAE,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,CACvB,CAAC;IACJ,CAAC;IAED,8EAA8E;IAE9E;;;;;OAKG;IACH,KAAK,CAAC,UAAU,CAAC,IAAY,EAAE,KAAK,GAAG,EAAE;QACvC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CACnB,IAAI,kBAAkB,CAAC,IAAI,CAAC,qBAAqB,CAAC,EAAE,CACrD,CAAC;IACJ,CAAC;CACF;AA3FD,8CA2FC"}
package/dist/index.d.ts CHANGED
@@ -2,43 +2,50 @@
2
2
  * clefbase — Firebase-style SDK for Clefbase / Cleforyx
3
3
  *
4
4
  * @example
5
- * import { initClefbase, getDatabase, getAuth, getStorage, getHosting, FieldValue } from "clefbase";
5
+ * import { initClefbase, getDatabase, getAuth, getStorage, getHosting, getFunctions, httpsCallable, FieldValue } from "clefbase";
6
6
  *
7
7
  * const app = initClefbase({
8
8
  * serverUrl: "https://api.cleforyx.com",
9
9
  * projectId: "my_project_abc",
10
10
  * apiKey: "cfx_...",
11
- * adminSecret: "...", // only needed for hosting
11
+ * adminSecret: "", // only needed for hosting
12
12
  * });
13
13
  *
14
+ * // ── Functions ──────────────────────────────────────────────────────────────
15
+ * const fns = getFunctions(app);
16
+ *
17
+ * // Deploy a function
18
+ * await fns.deploy({
19
+ * name: "greetUser",
20
+ * runtime: "node",
21
+ * trigger: { type: "http" },
22
+ * source: `
23
+ * export async function handler(ctx) {
24
+ * return { message: "Hello, " + ctx.data.name + "!" };
25
+ * }
26
+ * `,
27
+ * });
28
+ *
29
+ * // Create a typed callable
30
+ * const greet = httpsCallable<{ name: string }, { message: string }>(fns, "greetUser");
31
+ * const { data } = await greet({ name: "Alice" });
32
+ *
33
+ * // Or call directly
34
+ * const { data } = await fns.call("greetUser", { name: "Alice" });
35
+ *
36
+ * // ── Database ────────────────────────────────────────────────────────────────
14
37
  * const db = getDatabase(app);
15
38
  *
16
- * // FieldValue sentinels
17
39
  * await db.collection("posts").doc("p1").update({
18
40
  * views: FieldValue.increment(1),
19
- * score: FieldValue.decrement(0.5),
20
41
  * publishedAt: FieldValue.serverTimestamp(),
21
- * draft: FieldValue.deleteField(),
22
- * tags: FieldValue.arrayUnion("featured"),
23
- * oldTags: FieldValue.arrayRemove("wip"),
24
42
  * });
25
43
  *
26
- * // Batch writes
27
44
  * const batch = db.batch();
28
45
  * batch.update(db.collection("counters").doc("hits"), { n: FieldValue.increment(1) });
29
- * batch.delete(db.collection("sessions").doc("expired"));
30
46
  * await batch.commit();
31
- *
32
- * // Transactions
33
- * await db.runTransaction(async (tx) => {
34
- * const wallet = await tx.get(db.collection("wallets").doc(uid));
35
- * tx.update(db.collection("wallets").doc(uid), { balance: (wallet?.balance as number ?? 0) + 10 });
36
- * });
37
- *
38
- * // Collection-group queries
39
- * const allComments = await db.collectionGroup("comments").where({ approved: true }).getDocs();
40
47
  */
41
- export { ClefbaseApp, initClefbase, getApp, getDatabase, getAuth, getStorage, getHosting, } from "./app";
48
+ export { ClefbaseApp, initClefbase, getApp, getDatabase, getAuth, getStorage, getHosting, getFunctions, } from "./app";
42
49
  export { Database, CollectionReference, CollectionGroup, DocumentReference, Query, WriteBatch, Transaction, runTransaction, } from "./db";
43
50
  export { Auth } from "./auth";
44
51
  export type { GoogleButtonOptions } from "./auth";
@@ -48,6 +55,8 @@ export type { StorageImageStatus } from "./react/StorageImage";
48
55
  export { EmailVerificationCard } from "./react/EmailVerificationCard";
49
56
  export { ClefbaseHosting, SiteReference } from "./hosting";
50
57
  export type { HostingSite, HostingDeploy, HostingFile, DeployResult, DeployOptions, HostingStatus, DeployStatus, } from "./hosting";
58
+ export { ClefbaseFunctions, httpsCallable } from "./functions";
59
+ export type { FunctionRuntime, FunctionTrigger, FunctionTriggerType, FunctionDef, FunctionExecution, FunctionsConfig, FunctionStats, DeployFunctionOptions, HttpsCallableResult, } from "./functions";
51
60
  export { FieldValue, FieldValueSentinel } from "./field_value";
52
61
  export type { FieldValueType } from "./field_value";
53
62
  export type { ClefbaseConfig, ClefbaseDocument, QueryOptions, QueryResult, FilterOperator, WhereClause, WhereValue, AuthUser, AuthSession, AuthResult, } from "./types";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAGH,OAAO,EACL,WAAW,EACX,YAAY,EACZ,MAAM,EACN,WAAW,EACX,OAAO,EACP,UAAU,EACV,UAAU,GACX,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,QAAQ,EACR,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,KAAK,EACL,UAAU,EACV,WAAW,EACX,cAAc,GACf,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC/E,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAQ7C,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC3D,YAAY,EACV,WAAW,EACX,aAAa,EACb,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,GACb,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC/D,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGpD,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,WAAW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AAM,aAAa,CAAC;AAGrB,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC/D,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGpD,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,cAAc,EACd,WAAW,EACX,UAAU,EACV,QAAQ,EACR,WAAW,EACX,UAAU,GACX,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -3,44 +3,51 @@
3
3
  * clefbase — Firebase-style SDK for Clefbase / Cleforyx
4
4
  *
5
5
  * @example
6
- * import { initClefbase, getDatabase, getAuth, getStorage, getHosting, FieldValue } from "clefbase";
6
+ * import { initClefbase, getDatabase, getAuth, getStorage, getHosting, getFunctions, httpsCallable, FieldValue } from "clefbase";
7
7
  *
8
8
  * const app = initClefbase({
9
9
  * serverUrl: "https://api.cleforyx.com",
10
10
  * projectId: "my_project_abc",
11
11
  * apiKey: "cfx_...",
12
- * adminSecret: "...", // only needed for hosting
12
+ * adminSecret: "", // only needed for hosting
13
13
  * });
14
14
  *
15
+ * // ── Functions ──────────────────────────────────────────────────────────────
16
+ * const fns = getFunctions(app);
17
+ *
18
+ * // Deploy a function
19
+ * await fns.deploy({
20
+ * name: "greetUser",
21
+ * runtime: "node",
22
+ * trigger: { type: "http" },
23
+ * source: `
24
+ * export async function handler(ctx) {
25
+ * return { message: "Hello, " + ctx.data.name + "!" };
26
+ * }
27
+ * `,
28
+ * });
29
+ *
30
+ * // Create a typed callable
31
+ * const greet = httpsCallable<{ name: string }, { message: string }>(fns, "greetUser");
32
+ * const { data } = await greet({ name: "Alice" });
33
+ *
34
+ * // Or call directly
35
+ * const { data } = await fns.call("greetUser", { name: "Alice" });
36
+ *
37
+ * // ── Database ────────────────────────────────────────────────────────────────
15
38
  * const db = getDatabase(app);
16
39
  *
17
- * // FieldValue sentinels
18
40
  * await db.collection("posts").doc("p1").update({
19
41
  * views: FieldValue.increment(1),
20
- * score: FieldValue.decrement(0.5),
21
42
  * publishedAt: FieldValue.serverTimestamp(),
22
- * draft: FieldValue.deleteField(),
23
- * tags: FieldValue.arrayUnion("featured"),
24
- * oldTags: FieldValue.arrayRemove("wip"),
25
43
  * });
26
44
  *
27
- * // Batch writes
28
45
  * const batch = db.batch();
29
46
  * batch.update(db.collection("counters").doc("hits"), { n: FieldValue.increment(1) });
30
- * batch.delete(db.collection("sessions").doc("expired"));
31
47
  * await batch.commit();
32
- *
33
- * // Transactions
34
- * await db.runTransaction(async (tx) => {
35
- * const wallet = await tx.get(db.collection("wallets").doc(uid));
36
- * tx.update(db.collection("wallets").doc(uid), { balance: (wallet?.balance as number ?? 0) + 10 });
37
- * });
38
- *
39
- * // Collection-group queries
40
- * const allComments = await db.collectionGroup("comments").where({ approved: true }).getDocs();
41
48
  */
42
49
  Object.defineProperty(exports, "__esModule", { value: true });
43
- exports.ClefbaseError = exports.FieldValueSentinel = exports.FieldValue = exports.SiteReference = exports.ClefbaseHosting = exports.EmailVerificationCard = exports.BucketReference = exports.StorageReference = exports.ClefbaseStorage = exports.Auth = exports.runTransaction = exports.Transaction = exports.WriteBatch = exports.Query = exports.DocumentReference = exports.CollectionGroup = exports.CollectionReference = exports.Database = exports.getHosting = exports.getStorage = exports.getAuth = exports.getDatabase = exports.getApp = exports.initClefbase = exports.ClefbaseApp = void 0;
50
+ exports.ClefbaseError = exports.FieldValueSentinel = exports.FieldValue = exports.httpsCallable = exports.ClefbaseFunctions = exports.SiteReference = exports.ClefbaseHosting = exports.EmailVerificationCard = exports.BucketReference = exports.StorageReference = exports.ClefbaseStorage = exports.Auth = exports.runTransaction = exports.Transaction = exports.WriteBatch = exports.Query = exports.DocumentReference = exports.CollectionGroup = exports.CollectionReference = exports.Database = exports.getFunctions = exports.getHosting = exports.getStorage = exports.getAuth = exports.getDatabase = exports.getApp = exports.initClefbase = exports.ClefbaseApp = void 0;
44
51
  // ─── App ──────────────────────────────────────────────────────────────────────
45
52
  var app_1 = require("./app");
46
53
  Object.defineProperty(exports, "ClefbaseApp", { enumerable: true, get: function () { return app_1.ClefbaseApp; } });
@@ -50,6 +57,7 @@ Object.defineProperty(exports, "getDatabase", { enumerable: true, get: function
50
57
  Object.defineProperty(exports, "getAuth", { enumerable: true, get: function () { return app_1.getAuth; } });
51
58
  Object.defineProperty(exports, "getStorage", { enumerable: true, get: function () { return app_1.getStorage; } });
52
59
  Object.defineProperty(exports, "getHosting", { enumerable: true, get: function () { return app_1.getHosting; } });
60
+ Object.defineProperty(exports, "getFunctions", { enumerable: true, get: function () { return app_1.getFunctions; } });
53
61
  // ─── Database ─────────────────────────────────────────────────────────────────
54
62
  var db_1 = require("./db");
55
63
  Object.defineProperty(exports, "Database", { enumerable: true, get: function () { return db_1.Database; } });
@@ -75,6 +83,10 @@ Object.defineProperty(exports, "EmailVerificationCard", { enumerable: true, get:
75
83
  var hosting_1 = require("./hosting");
76
84
  Object.defineProperty(exports, "ClefbaseHosting", { enumerable: true, get: function () { return hosting_1.ClefbaseHosting; } });
77
85
  Object.defineProperty(exports, "SiteReference", { enumerable: true, get: function () { return hosting_1.SiteReference; } });
86
+ // ─── Functions ────────────────────────────────────────────────────────────────
87
+ var functions_1 = require("./functions");
88
+ Object.defineProperty(exports, "ClefbaseFunctions", { enumerable: true, get: function () { return functions_1.ClefbaseFunctions; } });
89
+ Object.defineProperty(exports, "httpsCallable", { enumerable: true, get: function () { return functions_1.httpsCallable; } });
78
90
  // ─── FieldValue ───────────────────────────────────────────────────────────────
79
91
  var field_value_1 = require("./field_value");
80
92
  Object.defineProperty(exports, "FieldValue", { enumerable: true, get: function () { return field_value_1.FieldValue; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;;;AAEH,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c;AARZ,8FAAA,QAAQ,OAAA;AACR,yGAAA,mBAAmB,OAAA;AACnB,qGAAA,eAAe,OAAA;AACf,uGAAA,iBAAiB,OAAA;AACjB,2FAAA,KAAK,OAAA;AACL,gGAAA,UAAU,OAAA;AACV,iGAAA,WAAW,OAAA;AACX,oGAAA,cAAc,OAAA;AAGhB,iFAAiF;AACjF,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AAGb,iFAAiF;AACjF,qCAA+E;AAAtE,0GAAA,eAAe,OAAA;AAAE,2GAAA,gBAAgB,OAAA;AAAE,0GAAA,eAAe,OAAA;AAM3D,iFAAiF;AACjF,uEAAsE;AAA7D,8HAAA,qBAAqB,OAAA;AAE9B,iFAAiF;AACjF,qCAA2D;AAAlD,0GAAA,eAAe,OAAA;AAAE,wGAAA,aAAa,OAAA;AAWvC,iFAAiF;AACjF,yCAA+D;AAAtD,8GAAA,iBAAiB,OAAA;AAAE,0GAAA,aAAa,OAAA;AAazC,iFAAiF;AACjF,6CAA+D;AAAtD,yGAAA,UAAU,OAAA;AAAE,iHAAA,kBAAkB,OAAA;AAiBvC,iCAAwC;AAA/B,sGAAA,aAAa,OAAA"}
package/dist/types.d.ts CHANGED
@@ -74,6 +74,170 @@ export interface AuthResult {
74
74
  /** Shorthand for session.token */
75
75
  token: string;
76
76
  }
77
+ /**
78
+ * Options for rendering a Google-branded sign-in button.
79
+ * Pass to `auth.signInWithGoogle()` to show a button instead of One Tap.
80
+ */
81
+ export interface GoogleButtonOptions {
82
+ container: HTMLElement;
83
+ theme?: "outline" | "filled_blue" | "filled_black";
84
+ size?: "large" | "medium" | "small";
85
+ text?: "signin_with" | "signup_with" | "continue_with" | "signin";
86
+ shape?: "rectangular" | "pill";
87
+ width?: number;
88
+ locale?: string;
89
+ }
90
+ /** Supported function runtimes */
91
+ export type FunctionRuntime = "node" | "python";
92
+ /**
93
+ * Every trigger type the server supports.
94
+ *
95
+ * | Type | Fires when… |
96
+ * |---------------------|------------------------------------------------|
97
+ * | `http` | `POST /functions/call/:name` |
98
+ * | `schedule` | Cron timer fires |
99
+ * | `onDocumentCreate` | A document is inserted into `collection` |
100
+ * | `onDocumentUpdate` | A document is updated |
101
+ * | `onDocumentDelete` | A document is deleted |
102
+ * | `onDocumentWrite` | Any create / update / delete |
103
+ * | `onUserCreate` | A new user signs up or is created |
104
+ * | `onUserDelete` | A user is deleted |
105
+ * | `onFileUpload` | A file is uploaded to storage |
106
+ * | `onFileDelete` | A file is deleted from storage |
107
+ */
108
+ export type FunctionTriggerType = "http" | "schedule" | "onDocumentWrite" | "onDocumentCreate" | "onDocumentUpdate" | "onDocumentDelete" | "onUserCreate" | "onUserDelete" | "onFileUpload" | "onFileDelete";
109
+ export interface FunctionTrigger {
110
+ type: FunctionTriggerType;
111
+ /**
112
+ * Standard 5-part cron expression. Required for `"schedule"` triggers.
113
+ * @example "0 * * * *" (every hour)
114
+ */
115
+ cron?: string;
116
+ /**
117
+ * Collection path. Required for document triggers.
118
+ * @example "users" or "orders/{orderId}/items"
119
+ */
120
+ collection?: string;
121
+ /**
122
+ * Bucket name filter. Optional for storage triggers.
123
+ * Leave undefined to fire on all buckets.
124
+ */
125
+ bucket?: string;
126
+ }
127
+ /** Options passed to `fns.deploy()` / `deployFunction()` */
128
+ export interface DeployFunctionOptions {
129
+ /**
130
+ * Unique function name within the project.
131
+ * Must start with a letter; only letters, numbers, hyphens, underscores allowed.
132
+ * Max 64 characters.
133
+ */
134
+ name: string;
135
+ description?: string;
136
+ /**
137
+ * Runtime to use for executing this function.
138
+ * - `"node"` — JavaScript / TypeScript (transpiled on-demand, no build step)
139
+ * - `"python"` — Python 3
140
+ */
141
+ runtime: FunctionRuntime;
142
+ /** What event fires this function */
143
+ trigger: FunctionTrigger;
144
+ /**
145
+ * Source code as a plain string.
146
+ *
147
+ * **Node runtime** — export a function with the name matching `entryPoint`:
148
+ * ```js
149
+ * export async function handler(ctx) {
150
+ * const { data, auth, trigger } = ctx;
151
+ * return { ok: true };
152
+ * }
153
+ * ```
154
+ *
155
+ * **Python runtime** — define a function matching `entryPoint`:
156
+ * ```python
157
+ * def handler(ctx):
158
+ * return {"ok": True}
159
+ * ```
160
+ */
161
+ source: string;
162
+ /**
163
+ * Exported function name to invoke inside `source`.
164
+ * @default "handler"
165
+ */
166
+ entryPoint?: string;
167
+ /**
168
+ * Execution timeout in milliseconds.
169
+ * @default 30_000
170
+ * @min 1_000
171
+ * @max 540_000 (9 minutes)
172
+ */
173
+ timeoutMs?: number;
174
+ /** Environment variables injected into the function subprocess */
175
+ env?: Record<string, string>;
176
+ }
177
+ /** A deployed function definition as returned by the server */
178
+ export interface FunctionDef {
179
+ id: string;
180
+ dbId: string;
181
+ name: string;
182
+ description?: string;
183
+ runtime: FunctionRuntime;
184
+ trigger: FunctionTrigger;
185
+ /** Raw source code (omitted from list responses for bandwidth) */
186
+ source?: string;
187
+ entryPoint: string;
188
+ timeoutMs: number;
189
+ env: Record<string, string>;
190
+ status: "active" | "disabled";
191
+ createdAt: string;
192
+ updatedAt: string;
193
+ lastInvokedAt?: string;
194
+ invocationCount: number;
195
+ errorCount: number;
196
+ }
197
+ /** The result of a single function invocation */
198
+ export interface FunctionExecution {
199
+ id: string;
200
+ functionId: string;
201
+ dbId: string;
202
+ functionName: string;
203
+ status: "success" | "error" | "timeout";
204
+ durationMs: number;
205
+ result?: unknown;
206
+ error?: string;
207
+ logs: string[];
208
+ triggeredBy: string;
209
+ startedAt: string;
210
+ finishedAt: string;
211
+ }
212
+ /** Project-level functions configuration */
213
+ export interface FunctionsConfig {
214
+ dbId: string;
215
+ maxConcurrentExecutions: number;
216
+ defaultTimeoutMs: number;
217
+ createdAt: string;
218
+ }
219
+ /** Aggregated stats for a project's functions */
220
+ export interface FunctionStats {
221
+ total: number;
222
+ active: number;
223
+ disabled: number;
224
+ totalInvocations: number;
225
+ totalErrors: number;
226
+ byTrigger: Record<string, number>;
227
+ }
228
+ /**
229
+ * The return type of a callable HTTP function.
230
+ *
231
+ * @example
232
+ * const add = httpsCallable<{ a: number; b: number }, { sum: number }>(fns, "addNumbers");
233
+ * const { data, durationMs } = await add({ a: 3, b: 4 });
234
+ */
235
+ export interface HttpsCallableResult<T = unknown> {
236
+ /** Return value from the function */
237
+ data: T;
238
+ /** Server-side execution time in milliseconds */
239
+ durationMs: number;
240
+ }
77
241
  export declare class ClefbaseError extends Error {
78
242
  readonly code?: string | undefined;
79
243
  readonly status?: number | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,SAAS,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAID,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,gBAAgB;IAC/C,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,+DAA+D;AAC/D,MAAM,MAAM,cAAc,GACtB;IAAE,GAA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aAAc,SAAQ,KAAK;aAGpB,IAAI,CAAC,EAAE,MAAM;aACb,MAAM,CAAC,EAAE,MAAM;gBAF/B,OAAO,EAAE,MAAM,EACC,IAAI,CAAC,EAAE,MAAM,YAAA,EACb,MAAM,CAAC,EAAE,MAAM,YAAA;CAQlC"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,iFAAiF;;;AAmFjF,iFAAiF;AAEjF,MAAa,aAAc,SAAQ,KAAK;IACtC,YACE,OAAe,EACC,IAAa,EACb,MAAe;QAE/B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,SAAI,GAAJ,IAAI,CAAS;QACb,WAAM,GAAN,MAAM,CAAS;QAG/B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;CACF;AAZD,sCAYC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,iFAAiF;;;AA6QjF,iFAAiF;AAEjF,MAAa,aAAc,SAAQ,KAAK;IACtC,YACE,OAAe,EACC,IAAa,EACb,MAAe;QAE/B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,SAAI,GAAJ,IAAI,CAAS;QACb,WAAM,GAAN,MAAM,CAAS;QAG/B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;CACF;AAZD,sCAYC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "clefbase",
3
- "version": "1.4.1",
4
- "description": "Firebase-style SDK and CLI for Clefbase — database, auth, storage, and hosting",
3
+ "version": "1.5.0",
4
+ "description": "Firebase-style SDK and CLI for Clefbase — database, auth, storage, hosting, and functions",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "bin": {
@@ -47,6 +47,8 @@
47
47
  "auth",
48
48
  "storage",
49
49
  "hosting",
50
+ "functions",
51
+ "serverless",
50
52
  "firebase-alternative",
51
53
  "cli"
52
54
  ],