@canton-network/core-wallet-store-sql 1.7.1 → 1.8.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/dist/index.cjs +72 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +72 -1
- package/dist/index.js.map +1 -1
- package/dist/migrations/013-add-api-key.d.ts +4 -0
- package/dist/migrations/013-add-api-key.d.ts.map +1 -0
- package/dist/migrations/013-add-api-key.js +18 -0
- package/dist/migrations/014-add-service-account-column.d.ts +5 -0
- package/dist/migrations/014-add-service-account-column.d.ts.map +1 -0
- package/dist/migrations/014-add-service-account-column.js +15 -0
- package/dist/migrations-test/seeds/013-add-api-key.d.ts +13 -0
- package/dist/migrations-test/seeds/013-add-api-key.d.ts.map +1 -0
- package/dist/migrations-test/seeds/014-add-service-account-column.d.ts +15 -0
- package/dist/migrations-test/seeds/014-add-service-account-column.d.ts.map +1 -0
- package/dist/schema.d.ts +15 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +32 -0
- package/dist/store-sql.d.ts +5 -1
- package/dist/store-sql.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/schema.js
CHANGED
|
@@ -57,6 +57,11 @@ export const toNetwork = (table) => {
|
|
|
57
57
|
? JSON.parse(table.adminAuth)
|
|
58
58
|
: table.adminAuth)
|
|
59
59
|
: undefined,
|
|
60
|
+
serviceAccountAuth: table.serviceAccountAuth
|
|
61
|
+
? authSchema.parse(typeof table.serviceAccountAuth === 'string'
|
|
62
|
+
? JSON.parse(table.serviceAccountAuth)
|
|
63
|
+
: table.serviceAccountAuth)
|
|
64
|
+
: undefined,
|
|
60
65
|
};
|
|
61
66
|
};
|
|
62
67
|
export const fromNetwork = (network, userId) => {
|
|
@@ -72,6 +77,9 @@ export const fromNetwork = (network, userId) => {
|
|
|
72
77
|
adminAuth: network.adminAuth
|
|
73
78
|
? JSON.stringify(network.adminAuth)
|
|
74
79
|
: undefined,
|
|
80
|
+
serviceAccountAuth: network.serviceAccountAuth
|
|
81
|
+
? JSON.stringify(network.serviceAccountAuth)
|
|
82
|
+
: undefined,
|
|
75
83
|
};
|
|
76
84
|
};
|
|
77
85
|
export const fromWallet = (wallet, userId) => {
|
|
@@ -215,3 +223,27 @@ export const toMessageRaw = (table) => {
|
|
|
215
223
|
}
|
|
216
224
|
return result;
|
|
217
225
|
};
|
|
226
|
+
export const fromApiKey = (table) => {
|
|
227
|
+
return {
|
|
228
|
+
id: table.id,
|
|
229
|
+
digest: table.digest,
|
|
230
|
+
name: table.name,
|
|
231
|
+
userId: table.userId,
|
|
232
|
+
email: table.email,
|
|
233
|
+
networkId: table.networkId,
|
|
234
|
+
createdAt: new Date(table.createdAt),
|
|
235
|
+
lastUsedAt: table.lastUsedAt ? new Date(table.lastUsedAt) : undefined,
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
export const toApiKey = (apiKey) => {
|
|
239
|
+
return {
|
|
240
|
+
id: apiKey.id,
|
|
241
|
+
digest: apiKey.digest,
|
|
242
|
+
name: apiKey.name,
|
|
243
|
+
userId: apiKey.userId,
|
|
244
|
+
email: apiKey.email,
|
|
245
|
+
networkId: apiKey.networkId,
|
|
246
|
+
createdAt: apiKey.createdAt.toISOString(),
|
|
247
|
+
lastUsedAt: apiKey.lastUsedAt ? apiKey.lastUsedAt.toISOString() : null,
|
|
248
|
+
};
|
|
249
|
+
};
|
package/dist/store-sql.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Logger } from 'pino';
|
|
2
2
|
import { AuthContext, AuthAware, Idp } from '@canton-network/core-wallet-auth';
|
|
3
|
-
import { Store as BaseStore, Wallet, PartyId, Session, WalletFilter, Transaction, MessageRaw, MessageRawStatusUpdate, Network, StoreConfig, UpdateWallet, CurrentNetworkWalletFilter, TransactionStatusUpdate, UserLevelRight } from '@canton-network/core-wallet-store';
|
|
3
|
+
import { Store as BaseStore, Wallet, PartyId, Session, WalletFilter, Transaction, MessageRaw, MessageRawStatusUpdate, Network, StoreConfig, UpdateWallet, CurrentNetworkWalletFilter, TransactionStatusUpdate, UserLevelRight, ApiKey } from '@canton-network/core-wallet-store';
|
|
4
4
|
import { Kysely } from 'kysely';
|
|
5
5
|
import { DB } from './schema.js';
|
|
6
6
|
export declare class StoreSql implements BaseStore, AuthAware<StoreSql> {
|
|
@@ -47,6 +47,10 @@ export declare class StoreSql implements BaseStore, AuthAware<StoreSql> {
|
|
|
47
47
|
getMessageRaw(messageId: string): Promise<MessageRaw | undefined>;
|
|
48
48
|
listMessageRaws(): Promise<Array<MessageRaw>>;
|
|
49
49
|
removeMessageRaw(messageId: string): Promise<void>;
|
|
50
|
+
addApiKey(apiKey: ApiKey): Promise<void>;
|
|
51
|
+
listApiKeys(): Promise<Array<ApiKey>>;
|
|
52
|
+
getApiKey(digest: string): Promise<ApiKey | undefined>;
|
|
53
|
+
removeApiKey(apiKeyId: string): Promise<void>;
|
|
50
54
|
}
|
|
51
55
|
export declare const connection: (config: StoreConfig) => Kysely<DB>;
|
|
52
56
|
//# sourceMappingURL=store-sql.d.ts.map
|
package/dist/store-sql.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-sql.d.ts","sourceRoot":"","sources":["../src/store-sql.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC7B,OAAO,EACH,WAAW,EAEX,SAAS,EAET,GAAG,EACN,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACH,KAAK,IAAI,SAAS,EAClB,MAAM,EACN,OAAO,EACP,OAAO,EACP,YAAY,EACZ,WAAW,EACX,UAAU,EACV,sBAAsB,EACtB,OAAO,EACP,WAAW,EACX,YAAY,EACZ,0BAA0B,EAE1B,uBAAuB,EACvB,cAAc,
|
|
1
|
+
{"version":3,"file":"store-sql.d.ts","sourceRoot":"","sources":["../src/store-sql.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAA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,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CActD;AAED,eAAO,MAAM,UAAU,GAAI,QAAQ,WAAW,eAiC7C,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canton-network/core-wallet-store-sql",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "SQL implementation of the Store API",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"migrations:update-lock": "tsx ../../scripts/src/check-migration-lock.ts --update"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@canton-network/core-ledger-client": "^1.
|
|
32
|
-
"@canton-network/core-rpc-errors": "^1.
|
|
33
|
-
"@canton-network/core-wallet-auth": "^1.
|
|
34
|
-
"@canton-network/core-wallet-store": "^1.
|
|
31
|
+
"@canton-network/core-ledger-client": "^1.7.0",
|
|
32
|
+
"@canton-network/core-rpc-errors": "^1.6.0",
|
|
33
|
+
"@canton-network/core-wallet-auth": "^1.7.0",
|
|
34
|
+
"@canton-network/core-wallet-store": "^1.8.0",
|
|
35
35
|
"better-sqlite3": "^12.10.1",
|
|
36
36
|
"commander": "^14.0.3",
|
|
37
37
|
"kysely": "^0.28.17",
|