@bridgekitux/generic 0.1.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 +22 -0
- package/dist/src/index.d.ts +51 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +37 -0
- package/dist/src/index.js.map +1 -0
- package/package.json +38 -0
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# @bridgekitux/generic
|
|
2
|
+
|
|
3
|
+
Generic BridgeKit adapter for approved databases, HTTP/HTTPS resources, TCP resources, WebSockets, files, secrets, logs, and processes.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @bridgekitux/client @bridgekitux/generic
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Use
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { bridgekit } from '@bridgekitux/client';
|
|
15
|
+
import { createBridgeGenericResource } from '@bridgekitux/generic';
|
|
16
|
+
|
|
17
|
+
await bridgekit.connect();
|
|
18
|
+
const resource = createBridgeGenericResource('trusted-local-resource');
|
|
19
|
+
const result = await resource.invoke({ capability: 'http.raw', args: { path: '/status' } });
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Use this package when a project needs a flexible approved resource handle instead of a database-specific adapter. Keep approvals scoped and auditable.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type BridgeKitClient, type BridgeKitSubscriptionListener } from '@bridgekitux/client';
|
|
2
|
+
import type { CapabilityName } from '@bridgekitux/protocol';
|
|
3
|
+
export interface GenericInvokeOptions {
|
|
4
|
+
capability: CapabilityName;
|
|
5
|
+
args?: unknown;
|
|
6
|
+
operation?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function createBridgeGenericResource(resourceId: string, client?: BridgeKitClient): {
|
|
9
|
+
invoke: <TResult = unknown>({ capability, args, operation }: GenericInvokeOptions) => Promise<TResult>;
|
|
10
|
+
database: () => import("@bridgekitux/client").BridgeDatabase;
|
|
11
|
+
http: () => import("@bridgekitux/client").BridgeHttpResource;
|
|
12
|
+
tcp: () => import("@bridgekitux/client").BridgeTcpResource;
|
|
13
|
+
websocket: () => import("@bridgekitux/client").BridgeWebSocketResource;
|
|
14
|
+
files: () => import("@bridgekitux/client").BridgeFileStore;
|
|
15
|
+
secret: () => import("@bridgekitux/client").BridgeSecret;
|
|
16
|
+
process: () => import("@bridgekitux/client").BridgeProcessResource;
|
|
17
|
+
logs: () => import("@bridgekitux/client").BridgeLogResource;
|
|
18
|
+
};
|
|
19
|
+
export declare function createBridgeRawDatabase(resourceId: string, client?: BridgeKitClient): {
|
|
20
|
+
raw: (args: unknown) => Promise<any>;
|
|
21
|
+
query: (sql: string, params?: unknown[]) => Promise<any>;
|
|
22
|
+
command: (command: Record<string, unknown>) => Promise<any>;
|
|
23
|
+
};
|
|
24
|
+
export declare function createBridgeRawHttp(resourceId: string, client?: BridgeKitClient): {
|
|
25
|
+
request: (path: string, init?: {
|
|
26
|
+
method?: string;
|
|
27
|
+
headers?: Record<string, string>;
|
|
28
|
+
body?: string;
|
|
29
|
+
}) => Promise<any>;
|
|
30
|
+
raw: (path: string, init?: {
|
|
31
|
+
method?: string;
|
|
32
|
+
headers?: Record<string, string>;
|
|
33
|
+
body?: string;
|
|
34
|
+
}) => Promise<any>;
|
|
35
|
+
stream: (path: string, init: {
|
|
36
|
+
method?: string;
|
|
37
|
+
headers?: Record<string, string>;
|
|
38
|
+
body?: string;
|
|
39
|
+
} | undefined, listener: BridgeKitSubscriptionListener) => Promise<import("@bridgekitux/client").BridgeKitSubscription>;
|
|
40
|
+
rawStream: (path: string, init: {
|
|
41
|
+
method?: string;
|
|
42
|
+
headers?: Record<string, string>;
|
|
43
|
+
body?: string;
|
|
44
|
+
eventMode?: "chunks" | "lines" | "sse";
|
|
45
|
+
idleTimeoutMs?: number;
|
|
46
|
+
} | undefined, listener: BridgeKitSubscriptionListener) => Promise<import("@bridgekitux/client").BridgeKitSubscription>;
|
|
47
|
+
};
|
|
48
|
+
export declare function createBridgeTcpClient(resourceId: string, client?: BridgeKitClient): import("@bridgekitux/client").BridgeTcpResource;
|
|
49
|
+
export declare function createBridgeWebSocketClient(resourceId: string, client?: BridgeKitClient): import("@bridgekitux/client").BridgeWebSocketResource;
|
|
50
|
+
export { bridgekit } from '@bridgekitux/client';
|
|
51
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,eAAe,EAAE,KAAK,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAC1G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,cAAc,CAAC;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,GAAE,eAA2B;aAEtF,OAAO,6CAAsD,oBAAoB;;;;;;;;;EAU7F;AAED,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,GAAE,eAA2B;gBAE/E,OAAO;iBACN,MAAM,WAAW,OAAO,EAAE;uBACpB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;EAE7C;AAED,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,GAAE,eAA2B;oBAEvE,MAAM,SAAQ;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;gBACtF,MAAM,SAAQ;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;mBAC/E,MAAM,QAAQ;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,wBAAiB,6BAA6B;sBAC7H,MAAM,QAAQ;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,wBAAiB,6BAA6B;EAErN;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,GAAE,eAA2B,mDAE5F;AAED,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,GAAE,eAA2B,yDAElG;AAED,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { bridgekit } from '@bridgekitux/client';
|
|
2
|
+
export function createBridgeGenericResource(resourceId, client = bridgekit) {
|
|
3
|
+
return {
|
|
4
|
+
invoke: ({ capability, args, operation = 'full' }) => client.invoke(capability, resourceId, args, operation),
|
|
5
|
+
database: () => client.database(resourceId),
|
|
6
|
+
http: () => client.http(resourceId),
|
|
7
|
+
tcp: () => client.tcp(resourceId),
|
|
8
|
+
websocket: () => client.websocket(resourceId),
|
|
9
|
+
files: () => client.files(resourceId),
|
|
10
|
+
secret: () => client.secret(resourceId),
|
|
11
|
+
process: () => client.process(resourceId),
|
|
12
|
+
logs: () => client.logs(resourceId)
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function createBridgeRawDatabase(resourceId, client = bridgekit) {
|
|
16
|
+
return {
|
|
17
|
+
raw: (args) => client.database(resourceId).raw(args),
|
|
18
|
+
query: (sql, params) => client.database(resourceId).query(sql, params),
|
|
19
|
+
command: (command) => client.database(resourceId).command(command)
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function createBridgeRawHttp(resourceId, client = bridgekit) {
|
|
23
|
+
return {
|
|
24
|
+
request: (path, init = {}) => client.http(resourceId).request(path, init),
|
|
25
|
+
raw: (path, init = {}) => client.http(resourceId).raw(path, init),
|
|
26
|
+
stream: (path, init = {}, listener) => client.http(resourceId).stream(path, init, listener),
|
|
27
|
+
rawStream: (path, init = {}, listener) => client.http(resourceId).rawStream(path, init, listener)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export function createBridgeTcpClient(resourceId, client = bridgekit) {
|
|
31
|
+
return client.tcp(resourceId);
|
|
32
|
+
}
|
|
33
|
+
export function createBridgeWebSocketClient(resourceId, client = bridgekit) {
|
|
34
|
+
return client.websocket(resourceId);
|
|
35
|
+
}
|
|
36
|
+
export { bridgekit } from '@bridgekitux/client';
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA4D,MAAM,qBAAqB,CAAC;AAS1G,MAAM,UAAU,2BAA2B,CAAC,UAAkB,EAAE,SAA0B,SAAS;IACjG,OAAO;QACL,MAAM,EAAE,CAAoB,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,GAAG,MAAM,EAAwB,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAU,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC;QAC9J,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C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AC,IAAY,EAAE,OAA6E,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC;QAC/I,MAAM,EAAE,CAAC,IAAY,EAAE,OAA6E,EAAE,EAAE,QAAuC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC;QACxM,SAAS,EAAE,CAAC,IAAY,EAAE,OAA6I,EAAE,EAAE,QAAuC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC;KAC/Q,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,UAAkB,EAAE,SAA0B,SAAS;IAC3F,OAAO,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,UAAkB,EAAE,SAA0B,SAAS;IACjG,OAAO,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bridgekitux/generic",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"description": "BridgeKit generic full-access adapter for approved databases, HTTP/HTTPS resources, TCP resources, and other capabilities.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/src/index.js",
|
|
8
|
+
"types": "./dist/src/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/src/index.d.ts",
|
|
12
|
+
"import": "./dist/src/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc -b",
|
|
17
|
+
"test": "node --test dist/test/*.test.js"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@bridgekitux/client": "0.1.0"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist/src",
|
|
24
|
+
"README.md"
|
|
25
|
+
],
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"bridgekit",
|
|
31
|
+
"webcontainer",
|
|
32
|
+
"sandbox",
|
|
33
|
+
"capability",
|
|
34
|
+
"local-agent",
|
|
35
|
+
"browser-ide",
|
|
36
|
+
"generic"
|
|
37
|
+
]
|
|
38
|
+
}
|