@arkstack/database 0.1.1
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 +3 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/package.json +38 -0
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/index.d.ts
|
|
2
|
+
interface AdapterFactoryOptions {
|
|
3
|
+
connectionString: string;
|
|
4
|
+
}
|
|
5
|
+
interface DatabaseAdapterFactory<TAdapter> {
|
|
6
|
+
(options: AdapterFactoryOptions): TAdapter;
|
|
7
|
+
}
|
|
8
|
+
interface DatabaseClientFactory<TAdapter, TClient> {
|
|
9
|
+
(options: {
|
|
10
|
+
adapter: TAdapter;
|
|
11
|
+
}): TClient;
|
|
12
|
+
}
|
|
13
|
+
interface CreateDatabaseClientOptions<TAdapter, TClient> {
|
|
14
|
+
connectionString?: string;
|
|
15
|
+
createAdapter: DatabaseAdapterFactory<TAdapter>;
|
|
16
|
+
createClient: DatabaseClientFactory<TAdapter, TClient>;
|
|
17
|
+
}
|
|
18
|
+
declare const createDatabaseClient: <TAdapter, TClient>(options: CreateDatabaseClientOptions<TAdapter, TClient>) => TClient;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { AdapterFactoryOptions, CreateDatabaseClientOptions, DatabaseAdapterFactory, DatabaseClientFactory, createDatabaseClient };
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/index.ts
|
|
2
|
+
const createDatabaseClient = (options) => {
|
|
3
|
+
const connectionString = options.connectionString ?? process.env.DATABASE_URL ?? "";
|
|
4
|
+
const adapter = options.createAdapter({ connectionString });
|
|
5
|
+
return options.createClient({ adapter });
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createDatabaseClient };
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["export interface AdapterFactoryOptions {\n connectionString: string;\n}\n\nexport interface DatabaseAdapterFactory<TAdapter> {\n (options: AdapterFactoryOptions): TAdapter;\n}\n\nexport interface DatabaseClientFactory<TAdapter, TClient> {\n (options: { adapter: TAdapter }): TClient;\n}\n\nexport interface CreateDatabaseClientOptions<TAdapter, TClient> {\n connectionString?: string;\n createAdapter: DatabaseAdapterFactory<TAdapter>;\n createClient: DatabaseClientFactory<TAdapter, TClient>;\n}\n\nexport const createDatabaseClient = <TAdapter, TClient> (\n options: CreateDatabaseClientOptions<TAdapter, TClient>,\n): TClient => {\n const connectionString = options.connectionString ?? process.env.DATABASE_URL ?? \"\";\n const adapter = options.createAdapter({ connectionString });\n\n return options.createClient({ adapter });\n};\n"],"mappings":";AAkBA,MAAa,wBACT,YACU;CACV,MAAM,mBAAmB,QAAQ,oBAAoB,QAAQ,IAAI,gBAAgB;CACjF,MAAM,UAAU,QAAQ,cAAc,EAAE,kBAAkB,CAAC;AAE3D,QAAO,QAAQ,aAAa,EAAE,SAAS,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@arkstack/database",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Database package for Arkstack providing database-specific implementations of core Arkstack features such as routing, middleware, and database integration.",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/arkstack-hq/arkstack.git",
|
|
9
|
+
"directory": "packages/database"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"database",
|
|
13
|
+
"integration",
|
|
14
|
+
"client",
|
|
15
|
+
"connection",
|
|
16
|
+
"query",
|
|
17
|
+
"execution",
|
|
18
|
+
"arkstack",
|
|
19
|
+
"prisma",
|
|
20
|
+
"typeorm",
|
|
21
|
+
"mongoose",
|
|
22
|
+
"sequelize"
|
|
23
|
+
],
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"exports": {
|
|
31
|
+
".": "./dist/index.js",
|
|
32
|
+
"./package.json": "./package.json"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsdown --config-loader unconfig",
|
|
36
|
+
"version:patch": "pnpm version patch --no-git-tag-version"
|
|
37
|
+
}
|
|
38
|
+
}
|