indobase-js 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.
- package/LICENSE +21 -0
- package/README.md +42 -0
- package/dist/cli.cjs +59 -0
- package/dist/index.cjs +37 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +48 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Indobase
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Indobase JS
|
|
2
|
+
|
|
3
|
+
Official JavaScript client for Indobase.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
**npm:**
|
|
8
|
+
```bash
|
|
9
|
+
npm install indobase-js
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**yarn:**
|
|
13
|
+
```bash
|
|
14
|
+
yarn add indobase-js
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**pnpm:**
|
|
18
|
+
```bash
|
|
19
|
+
pnpm add indobase-js
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { createClient } from "indobase-js"
|
|
26
|
+
|
|
27
|
+
const client = createClient("https://your-project.indobase.co", "public-anon-key")
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
- **Isomorphic**: Works in Node.js, Browsers, Deno, Bun, and React Native.
|
|
32
|
+
- **Type-safe**: Built with TypeScript, offering comprehensive intellisense.
|
|
33
|
+
- **Unified SDK**: Provides access to Authentication, Database, Realtime, Storage, and Edge Functions.
|
|
34
|
+
|
|
35
|
+
## TypeScript Support
|
|
36
|
+
`indobase-js` provides first-class TypeScript support. Types are automatically inferred when you provide your database schema.
|
|
37
|
+
|
|
38
|
+
## Node + Browser Support
|
|
39
|
+
Works in modern browsers, Node.js (>=18), Deno, Bun, Edge Functions (Cloudflare Workers), and React Native.
|
|
40
|
+
|
|
41
|
+
## License
|
|
42
|
+
MIT
|
package/dist/cli.cjs
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// src/cli.ts
|
|
4
|
+
var VERSION = "1.0.0";
|
|
5
|
+
function showHelp() {
|
|
6
|
+
console.log(`
|
|
7
|
+
Indobase SDK CLI
|
|
8
|
+
|
|
9
|
+
Usage:
|
|
10
|
+
indobase [command] [options]
|
|
11
|
+
|
|
12
|
+
Commands:
|
|
13
|
+
init Initialize a new Indobase project
|
|
14
|
+
--version Show the CLI version
|
|
15
|
+
--help Show this help message
|
|
16
|
+
|
|
17
|
+
Examples:
|
|
18
|
+
indobase init my-project
|
|
19
|
+
indobase --version
|
|
20
|
+
`);
|
|
21
|
+
}
|
|
22
|
+
function showVersion() {
|
|
23
|
+
console.log(`indobase-cli v${VERSION}`);
|
|
24
|
+
}
|
|
25
|
+
async function initProject(name) {
|
|
26
|
+
const projectName = name || "indobase-project";
|
|
27
|
+
console.log(`Creating new Indobase project: ${projectName}`);
|
|
28
|
+
console.log("This feature is coming soon!");
|
|
29
|
+
}
|
|
30
|
+
async function main() {
|
|
31
|
+
const args = process.argv.slice(2);
|
|
32
|
+
if (args.length === 0) {
|
|
33
|
+
showHelp();
|
|
34
|
+
process.exit(0);
|
|
35
|
+
}
|
|
36
|
+
const command = args[0];
|
|
37
|
+
switch (command) {
|
|
38
|
+
case "--version":
|
|
39
|
+
case "-v":
|
|
40
|
+
showVersion();
|
|
41
|
+
break;
|
|
42
|
+
case "--help":
|
|
43
|
+
case "-h":
|
|
44
|
+
showHelp();
|
|
45
|
+
break;
|
|
46
|
+
case "init":
|
|
47
|
+
const projectName = args[1];
|
|
48
|
+
await initProject(projectName);
|
|
49
|
+
break;
|
|
50
|
+
default:
|
|
51
|
+
console.error(`Unknown command: ${command}`);
|
|
52
|
+
console.log('Run "indobase --help" for usage information');
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
main().catch((error) => {
|
|
57
|
+
console.error("Error:", error.message);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
});
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
24
|
+
PACKAGE_NAME: () => PACKAGE_NAME,
|
|
25
|
+
SDK_VERSION: () => SDK_VERSION
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
28
|
+
__reExport(index_exports, require("@indobase/indobase-js"), module.exports);
|
|
29
|
+
var SDK_VERSION = "1.0.0";
|
|
30
|
+
var PACKAGE_NAME = "@indobase/js";
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
PACKAGE_NAME,
|
|
34
|
+
SDK_VERSION,
|
|
35
|
+
...require("@indobase/indobase-js")
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Main SDK entry point for @indobase/js\r\n//\r\n// This SDK wraps the core @indobase packages:\r\n// - @indobase/auth-js - Authentication\r\n// - @indobase/postgrest-js - Database queries\r\n// - @indobase/functions-js - Edge functions\r\n// - @indobase/realtime-js - Real-time subscriptions\r\n// - @indobase/storage-js - Storage\r\n//\r\n// Usage:\r\n// import { createIndobaseClient } from '@indobase/js'\r\n// const client = createIndobaseClient('https://your-project.indobase.co', 'your-api-key')\r\n//\r\n// For type definitions, the types are re-exported from the core packages.\r\n\r\n// Re-export the main client creator\r\n// The actual implementation is in @indobase/indobase-js which must be built first\r\nimport type { IndobaseClientOptions, QueryResult, QueryData, QueryError } from './types'\r\n\r\nexport type {\r\n IndobaseClientOptions,\r\n QueryResult,\r\n QueryData,\r\n QueryError\r\n}\r\n\r\nexport * from '@indobase/indobase-js'\r\n\r\n// Version info\r\nexport const SDK_VERSION = '1.0.0'\r\nexport const PACKAGE_NAME = '@indobase/js'\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BA,0BAAc,kCA1Bd;AA6BO,IAAM,cAAc;AACpB,IAAM,eAAe;","names":[]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export * from '@indobase/indobase-js';
|
|
2
|
+
|
|
3
|
+
interface IndobaseClientOptions<SchemaName extends string = 'public'> {
|
|
4
|
+
auth?: {
|
|
5
|
+
persistSession?: boolean;
|
|
6
|
+
storageKey?: string;
|
|
7
|
+
storage?: {
|
|
8
|
+
getItem(key: string): Promise<string | null>;
|
|
9
|
+
setItem(key: string, value: string): Promise<void>;
|
|
10
|
+
removeItem(key: string): Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
autoRefreshToken?: boolean;
|
|
13
|
+
detectSessionInUrl?: boolean;
|
|
14
|
+
headers?: Record<string, string>;
|
|
15
|
+
};
|
|
16
|
+
realtime?: {
|
|
17
|
+
params?: Record<string, unknown>;
|
|
18
|
+
eventsPerSecond?: number;
|
|
19
|
+
};
|
|
20
|
+
db?: {
|
|
21
|
+
schema?: SchemaName;
|
|
22
|
+
};
|
|
23
|
+
global?: {
|
|
24
|
+
fetch?: typeof fetch;
|
|
25
|
+
headers?: Record<string, string>;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
interface QueryResult<T> {
|
|
29
|
+
data: T | null;
|
|
30
|
+
error: Error | null;
|
|
31
|
+
count: number | null;
|
|
32
|
+
status: number;
|
|
33
|
+
statusText: string;
|
|
34
|
+
}
|
|
35
|
+
interface QueryData<T> {
|
|
36
|
+
data: T;
|
|
37
|
+
}
|
|
38
|
+
interface QueryError {
|
|
39
|
+
message: string;
|
|
40
|
+
details: string;
|
|
41
|
+
hint: string;
|
|
42
|
+
code: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare const SDK_VERSION = "1.0.0";
|
|
46
|
+
declare const PACKAGE_NAME = "@indobase/js";
|
|
47
|
+
|
|
48
|
+
export { type IndobaseClientOptions, PACKAGE_NAME, type QueryData, type QueryError, type QueryResult, SDK_VERSION };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export * from '@indobase/indobase-js';
|
|
2
|
+
|
|
3
|
+
interface IndobaseClientOptions<SchemaName extends string = 'public'> {
|
|
4
|
+
auth?: {
|
|
5
|
+
persistSession?: boolean;
|
|
6
|
+
storageKey?: string;
|
|
7
|
+
storage?: {
|
|
8
|
+
getItem(key: string): Promise<string | null>;
|
|
9
|
+
setItem(key: string, value: string): Promise<void>;
|
|
10
|
+
removeItem(key: string): Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
autoRefreshToken?: boolean;
|
|
13
|
+
detectSessionInUrl?: boolean;
|
|
14
|
+
headers?: Record<string, string>;
|
|
15
|
+
};
|
|
16
|
+
realtime?: {
|
|
17
|
+
params?: Record<string, unknown>;
|
|
18
|
+
eventsPerSecond?: number;
|
|
19
|
+
};
|
|
20
|
+
db?: {
|
|
21
|
+
schema?: SchemaName;
|
|
22
|
+
};
|
|
23
|
+
global?: {
|
|
24
|
+
fetch?: typeof fetch;
|
|
25
|
+
headers?: Record<string, string>;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
interface QueryResult<T> {
|
|
29
|
+
data: T | null;
|
|
30
|
+
error: Error | null;
|
|
31
|
+
count: number | null;
|
|
32
|
+
status: number;
|
|
33
|
+
statusText: string;
|
|
34
|
+
}
|
|
35
|
+
interface QueryData<T> {
|
|
36
|
+
data: T;
|
|
37
|
+
}
|
|
38
|
+
interface QueryError {
|
|
39
|
+
message: string;
|
|
40
|
+
details: string;
|
|
41
|
+
hint: string;
|
|
42
|
+
code: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare const SDK_VERSION = "1.0.0";
|
|
46
|
+
declare const PACKAGE_NAME = "@indobase/js";
|
|
47
|
+
|
|
48
|
+
export { type IndobaseClientOptions, PACKAGE_NAME, type QueryData, type QueryError, type QueryResult, SDK_VERSION };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Main SDK entry point for @indobase/js\r\n//\r\n// This SDK wraps the core @indobase packages:\r\n// - @indobase/auth-js - Authentication\r\n// - @indobase/postgrest-js - Database queries\r\n// - @indobase/functions-js - Edge functions\r\n// - @indobase/realtime-js - Real-time subscriptions\r\n// - @indobase/storage-js - Storage\r\n//\r\n// Usage:\r\n// import { createIndobaseClient } from '@indobase/js'\r\n// const client = createIndobaseClient('https://your-project.indobase.co', 'your-api-key')\r\n//\r\n// For type definitions, the types are re-exported from the core packages.\r\n\r\n// Re-export the main client creator\r\n// The actual implementation is in @indobase/indobase-js which must be built first\r\nimport type { IndobaseClientOptions, QueryResult, QueryData, QueryError } from './types'\r\n\r\nexport type {\r\n IndobaseClientOptions,\r\n QueryResult,\r\n QueryData,\r\n QueryError\r\n}\r\n\r\nexport * from '@indobase/indobase-js'\r\n\r\n// Version info\r\nexport const SDK_VERSION = '1.0.0'\r\nexport const PACKAGE_NAME = '@indobase/js'\r\n"],"mappings":";AA0BA,cAAc;AAGP,IAAM,cAAc;AACpB,IAAM,eAAe;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "indobase-js",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Official JavaScript client for Indobase",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/index.mjs",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"bin": {
|
|
11
|
+
"indobase": "dist/cli.js"
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=18"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.mjs",
|
|
24
|
+
"require": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsup",
|
|
30
|
+
"dev": "tsup --watch",
|
|
31
|
+
"prepare": "npm run build",
|
|
32
|
+
"prepublishOnly": "npm run build"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^20.19.9",
|
|
36
|
+
"tsup": "^8.5.1"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@indobase/indobase-js": "*"
|
|
40
|
+
},
|
|
41
|
+
"workspaces": [
|
|
42
|
+
"packages/core/*"
|
|
43
|
+
],
|
|
44
|
+
"private": false,
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "https://github.com/Indobase/Indobase-js.git",
|
|
51
|
+
"directory": "."
|
|
52
|
+
},
|
|
53
|
+
"keywords": [
|
|
54
|
+
"indobase",
|
|
55
|
+
"sdk",
|
|
56
|
+
"database",
|
|
57
|
+
"postgresql",
|
|
58
|
+
"realtime",
|
|
59
|
+
"auth",
|
|
60
|
+
"storage",
|
|
61
|
+
"functions"
|
|
62
|
+
],
|
|
63
|
+
"author": "Indobase",
|
|
64
|
+
"bugs": "https://github.com/Indobase/Indobase-js/issues",
|
|
65
|
+
"homepage": "https://github.com/Indobase/Indobase-js"
|
|
66
|
+
}
|