@canton-network/core-wallet-store-sql 0.1.0 → 0.1.2

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,5 @@
1
+ import { Kysely } from 'kysely';
2
+ import { DB } from '../schema.js';
3
+ export declare function up(db: Kysely<DB>): Promise<void>;
4
+ export declare function down(db: Kysely<DB>): Promise<void>;
5
+ //# sourceMappingURL=001-init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"001-init.d.ts","sourceRoot":"","sources":["../../src/migrations/001-init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AAEjC,wBAAsB,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA2EtD;AAED,wBAAsB,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAMxD"}
@@ -0,0 +1,72 @@
1
+ export async function up(db) {
2
+ console.log('Running initial migration...');
3
+ // --- idps ---
4
+ await db.schema
5
+ .createTable('idps')
6
+ .ifNotExists()
7
+ .addColumn('identity_provider_id', 'text', (col) => col.primaryKey())
8
+ .addColumn('type', 'text', (col) => col.notNull())
9
+ .addColumn('issuer', 'text', (col) => col.notNull())
10
+ .addColumn('config_url', 'text', (col) => col.notNull())
11
+ .addColumn('audience', 'text', (col) => col.notNull())
12
+ .addColumn('token_url', 'text')
13
+ .addColumn('grant_type', 'text')
14
+ .addColumn('scope', 'text', (col) => col.notNull())
15
+ .addColumn('client_id', 'text', (col) => col.notNull())
16
+ .addColumn('client_secret', 'text')
17
+ .addColumn('admin_client_id', 'text')
18
+ .addColumn('admin_client_secret', 'text')
19
+ .execute();
20
+ // --- networks ---
21
+ await db.schema
22
+ .createTable('networks')
23
+ .ifNotExists()
24
+ .addColumn('chain_id', 'text', (col) => col.primaryKey())
25
+ .addColumn('name', 'text', (col) => col.notNull())
26
+ .addColumn('synchronizer_id', 'text', (col) => col.notNull())
27
+ .addColumn('description', 'text')
28
+ .addColumn('ledger_api_base_url', 'text', (col) => col.notNull())
29
+ .addColumn('ledger_api_admin_grpc_url', 'text', (col) => col.notNull())
30
+ .addColumn('user_id', 'text') // optional/global if null
31
+ .addColumn('identity_provider_id', 'text', (col) => col.references('idps.identity_provider_id').onDelete('cascade'))
32
+ .execute();
33
+ // --- wallets ---
34
+ await db.schema
35
+ .createTable('wallets')
36
+ .ifNotExists()
37
+ .addColumn('party_id', 'text', (col) => col.primaryKey())
38
+ .addColumn('primary', 'boolean', (col) => col.notNull().defaultTo(false))
39
+ .addColumn('hint', 'text', (col) => col.notNull())
40
+ .addColumn('public_key', 'text', (col) => col.notNull())
41
+ .addColumn('namespace', 'text', (col) => col.notNull())
42
+ .addColumn('user_id', 'text', (col) => col.notNull())
43
+ .addColumn('chain_id', 'text', (col) => col.references('networks.chain_id').onDelete('cascade'))
44
+ .addColumn('signing_provider_id', 'text', (col) => col.notNull())
45
+ .execute();
46
+ // --- transactions ---
47
+ await db.schema
48
+ .createTable('transactions')
49
+ .ifNotExists()
50
+ .addColumn('command_id', 'text', (col) => col.primaryKey())
51
+ .addColumn('status', 'text', (col) => col.notNull())
52
+ .addColumn('prepared_transaction', 'text', (col) => col.notNull())
53
+ .addColumn('prepared_transaction_hash', 'text', (col) => col.notNull())
54
+ .addColumn('payload', 'text')
55
+ .addColumn('user_id', 'text', (col) => col.notNull())
56
+ .execute();
57
+ // --- sessions ---
58
+ await db.schema
59
+ .createTable('sessions')
60
+ .ifNotExists()
61
+ .addColumn('network', 'text', (col) => col.notNull())
62
+ .addColumn('access_token', 'text', (col) => col.notNull())
63
+ .addColumn('user_id', 'text', (col) => col.notNull())
64
+ .execute();
65
+ }
66
+ export async function down(db) {
67
+ await db.schema.dropTable('transactions').ifExists().execute();
68
+ await db.schema.dropTable('sessions').ifExists().execute();
69
+ await db.schema.dropTable('wallets').ifExists().execute();
70
+ await db.schema.dropTable('networks').ifExists().execute();
71
+ await db.schema.dropTable('idps').ifExists().execute();
72
+ }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@canton-network/core-wallet-store-sql",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
- "repository": "https://github.com/hyperledger-labs/splice-wallet-kernel",
5
+ "repository": "github:hyperledger-labs/splice-wallet-kernel",
6
6
  "description": "SQL implementation of the Store API",
7
7
  "license": "Apache-2.0",
8
8
  "author": "Marc Juchli <marc.juchli@digitalasset.com>",
9
- "packageManager": "yarn@4.9.2",
9
+ "packageManager": "yarn@4.9.4",
10
10
  "main": "./dist/index.js",
11
11
  "types": "./dist/index.d.ts",
12
12
  "scripts": {
@@ -16,9 +16,9 @@
16
16
  "test": "yarn node --experimental-vm-modules $(yarn bin jest)"
17
17
  },
18
18
  "dependencies": {
19
- "@canton-network/core-ledger-client": "^0.1.0",
20
- "@canton-network/core-wallet-auth": "^0.1.0",
21
- "@canton-network/core-wallet-store": "^0.1.0",
19
+ "@canton-network/core-ledger-client": "^0.2.1",
20
+ "@canton-network/core-wallet-auth": "^0.1.1",
21
+ "@canton-network/core-wallet-store": "^0.1.1",
22
22
  "better-sqlite3": "^12.2.0",
23
23
  "commander": "^14.0.0",
24
24
  "kysely": "^0.28.5",
@@ -40,7 +40,7 @@
40
40
  "typescript": "^5.8.3"
41
41
  },
42
42
  "files": [
43
- "dist/*"
43
+ "dist/**"
44
44
  ],
45
45
  "publishConfig": {
46
46
  "access": "public"