clefbase 1.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.
@@ -0,0 +1,87 @@
1
+ export interface ClefbaseConfig {
2
+ /** Base URL of your Clefbase server, e.g. "https://your-server.com" */
3
+ serverUrl: string;
4
+ /** Project ID (database ID) from your Clefbase dashboard */
5
+ projectId: string;
6
+ /** API key generated for this project */
7
+ apiKey: string;
8
+ }
9
+ export interface ClefbaseDocument {
10
+ _id: string;
11
+ _createdAt: string;
12
+ _updatedAt: string;
13
+ [key: string]: unknown;
14
+ }
15
+ export interface QueryResult<T = ClefbaseDocument> {
16
+ data: T[];
17
+ total: number;
18
+ limit: number;
19
+ offset: number;
20
+ }
21
+ export interface QueryOptions {
22
+ filter?: Record<string, unknown>;
23
+ sort?: {
24
+ field: string;
25
+ dir: "asc" | "desc";
26
+ };
27
+ limit?: number;
28
+ offset?: number;
29
+ }
30
+ /** Mongo-style comparison operators supported by the server */
31
+ export type FilterOperator = {
32
+ $gt: number;
33
+ } | {
34
+ $gte: number;
35
+ } | {
36
+ $lt: number;
37
+ } | {
38
+ $lte: number;
39
+ } | {
40
+ $ne: unknown;
41
+ } | {
42
+ $contains: string;
43
+ };
44
+ /** A value in a where() clause — either a literal or an operator object */
45
+ export type WhereValue = string | number | boolean | null | FilterOperator;
46
+ /** Map of field names to filter values, passed to .where() */
47
+ export interface WhereClause {
48
+ [field: string]: WhereValue;
49
+ }
50
+ export interface AuthUser {
51
+ uid: string;
52
+ email: string;
53
+ displayName?: string;
54
+ photoUrl?: string;
55
+ emailVerified: boolean;
56
+ disabled: boolean;
57
+ createdAt: string;
58
+ lastSignInAt?: string;
59
+ metadata?: Record<string, unknown>;
60
+ }
61
+ export interface AuthSession {
62
+ token: string;
63
+ expiresAt: string;
64
+ }
65
+ export interface AuthResult {
66
+ user: AuthUser;
67
+ session: AuthSession;
68
+ /** Shorthand for session.token — convenience field */
69
+ token: string;
70
+ }
71
+ export interface StorageFile {
72
+ id: string;
73
+ name: string;
74
+ bucket: string;
75
+ path: string;
76
+ size: number;
77
+ mimeType: string;
78
+ url: string;
79
+ createdAt: string;
80
+ metadata?: Record<string, unknown>;
81
+ }
82
+ export declare class ClefbaseError extends Error {
83
+ readonly code?: string | undefined;
84
+ readonly status?: number | undefined;
85
+ constructor(message: string, code?: string | undefined, status?: number | undefined);
86
+ }
87
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;CAChB;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,GAAG,EAAE,MAAM,CAAA;CAAE,GACf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AS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAID,qBAAa,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;CASlC"}
package/dist/types.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ // ─── Config ───────────────────────────────────────────────────────────────────
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ClefbaseError = void 0;
5
+ // ─── Error ────────────────────────────────────────────────────────────────────
6
+ class ClefbaseError extends Error {
7
+ constructor(message, code, status) {
8
+ super(message);
9
+ this.code = code;
10
+ this.status = status;
11
+ this.name = "ClefbaseError";
12
+ // Maintain proper stack trace in V8
13
+ if (Error.captureStackTrace) {
14
+ Error.captureStackTrace(this, ClefbaseError);
15
+ }
16
+ }
17
+ }
18
+ exports.ClefbaseError = ClefbaseError;
19
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,iFAAiF;;;AA2FjF,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,oCAAoC;QACpC,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;CACF;AAbD,sCAaC"}
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "clefbase",
3
+ "version": "1.0.0",
4
+ "description": "Firebase-style SDK for Clefbase — database, auth, and storage in one package",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "require": "./dist/index.js",
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md"
17
+ ],
18
+ "engines": {
19
+ "node": ">=16.0.0"
20
+ },
21
+ "scripts": {
22
+ "build": "tsc",
23
+ "dev": "tsc --watch",
24
+ "typecheck": "tsc --noEmit",
25
+ "prepublishOnly": "npm run build"
26
+ },
27
+ "keywords": [
28
+ "clefbase",
29
+ "database",
30
+ "auth",
31
+ "storage",
32
+ "firebase-alternative"
33
+ ],
34
+ "author": "",
35
+ "license": "MIT",
36
+ "dependencies": {
37
+ "form-data": "^4.0.0",
38
+ "node-fetch": "^3.3.2"
39
+ },
40
+ "devDependencies": {
41
+ "@types/node": "^20.0.0",
42
+ "typescript": "^5.0.0"
43
+ }
44
+ }