@filoz/repair-cli 0.2.1 → 0.3.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.
Files changed (64) hide show
  1. package/dist/package.json +1 -1
  2. package/dist/src/cli.js +2 -0
  3. package/dist/src/cli.js.map +1 -1
  4. package/dist/src/commands/datasets.d.ts +1 -0
  5. package/dist/src/commands/datasets.d.ts.map +1 -1
  6. package/dist/src/commands/datasets.js +5 -5
  7. package/dist/src/commands/datasets.js.map +1 -1
  8. package/dist/src/commands/providers.d.ts +1 -0
  9. package/dist/src/commands/providers.d.ts.map +1 -1
  10. package/dist/src/commands/repair.d.ts +1 -0
  11. package/dist/src/commands/repair.d.ts.map +1 -1
  12. package/dist/src/commands/repair.js +4 -0
  13. package/dist/src/commands/repair.js.map +1 -1
  14. package/dist/src/commands/replicate.d.ts +1 -0
  15. package/dist/src/commands/replicate.d.ts.map +1 -1
  16. package/dist/src/commands/replicate.js +4 -0
  17. package/dist/src/commands/replicate.js.map +1 -1
  18. package/dist/src/commands/session-key.d.ts +25 -0
  19. package/dist/src/commands/session-key.d.ts.map +1 -0
  20. package/dist/src/commands/session-key.js +114 -0
  21. package/dist/src/commands/session-key.js.map +1 -0
  22. package/dist/src/commands/wallet.d.ts +1 -0
  23. package/dist/src/commands/wallet.d.ts.map +1 -1
  24. package/dist/src/commands/wallet.js +75 -26
  25. package/dist/src/commands/wallet.js.map +1 -1
  26. package/dist/src/db/dedupe-cids.d.ts +1 -1
  27. package/dist/src/db/update-operation.d.ts +2 -2
  28. package/dist/src/db/update-operation.d.ts.map +1 -1
  29. package/dist/src/db/update-operation.js +2 -2
  30. package/dist/src/db/upsert-operations.js +1 -1
  31. package/dist/src/local-schema.d.ts +8 -11
  32. package/dist/src/local-schema.d.ts.map +1 -1
  33. package/dist/src/local-schema.js +1 -1
  34. package/dist/src/local-schema.js.map +1 -1
  35. package/dist/src/middleware.d.ts +2 -0
  36. package/dist/src/middleware.d.ts.map +1 -1
  37. package/dist/src/middleware.js +2 -0
  38. package/dist/src/middleware.js.map +1 -1
  39. package/dist/src/pipeline/add-pieces.d.ts.map +1 -1
  40. package/dist/src/pipeline/add-pieces.js +17 -3
  41. package/dist/src/pipeline/add-pieces.js.map +1 -1
  42. package/dist/src/pipeline/create-datasets.d.ts +4 -2
  43. package/dist/src/pipeline/create-datasets.d.ts.map +1 -1
  44. package/dist/src/pipeline/create-datasets.js +5 -5
  45. package/dist/src/pipeline/create-datasets.js.map +1 -1
  46. package/dist/src/utils.d.ts +34 -30
  47. package/dist/src/utils.d.ts.map +1 -1
  48. package/dist/src/utils.js +48 -3
  49. package/dist/src/utils.js.map +1 -1
  50. package/package.json +1 -1
  51. package/readme.md +40 -3
  52. package/src/cli.ts +2 -0
  53. package/src/commands/datasets.ts +7 -5
  54. package/src/commands/repair.ts +4 -0
  55. package/src/commands/replicate.ts +4 -0
  56. package/src/commands/session-key.ts +121 -0
  57. package/src/commands/wallet.ts +75 -26
  58. package/src/db/update-operation.ts +3 -3
  59. package/src/db/upsert-operations.ts +1 -1
  60. package/src/local-schema.ts +1 -7
  61. package/src/middleware.ts +2 -0
  62. package/src/pipeline/add-pieces.ts +19 -3
  63. package/src/pipeline/create-datasets.ts +20 -5
  64. package/src/utils.ts +75 -5
@@ -1,4 +1,3 @@
1
- import type { MetadataObject } from '@filoz/synapse-core';
2
1
  import { type Chain } from '@filoz/synapse-core/chains';
3
2
  import type * as SP from '@filoz/synapse-core/sp';
4
3
  import { type SQL } from 'drizzle-orm';
@@ -6,10 +5,10 @@ import type { PgTable } from 'drizzle-orm/pg-core';
6
5
  import type { SQLiteTable } from 'drizzle-orm/sqlite-core';
7
6
  import { z } from 'incur';
8
7
  import { Conf } from 'iso-conf';
9
- import { type Hex } from 'viem';
8
+ import { type Hash, type Hex } from 'viem';
10
9
  import type { OperationSelect } from './local-schema.ts';
11
10
  import * as schema from './local-schema.ts';
12
- import type { LocalDatabase } from './types.ts';
11
+ import type { LocalDatabase, WalletClient } from './types.ts';
13
12
  export declare const configSchema: z.ZodObject<{
14
13
  privateKey: z.ZodOptional<z.ZodString>;
15
14
  indexerMainnetUrl: z.ZodOptional<z.ZodURL>;
@@ -34,7 +33,7 @@ export declare function getClient(chainId: number): {
34
33
  address: import("viem").Address;
35
34
  nonceManager?: import("viem").NonceManager | undefined;
36
35
  sign: (parameters: {
37
- hash: import("viem").Hash;
36
+ hash: Hash;
38
37
  }) => Promise<Hex>;
39
38
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
40
39
  signMessage: ({ message }: {
@@ -73,7 +72,7 @@ export declare function getClient(chainId: number): {
73
72
  address: import("viem").Address;
74
73
  nonceManager?: import("viem").NonceManager | undefined;
75
74
  sign: (parameters: {
76
- hash: import("viem").Hash;
75
+ hash: Hash;
77
76
  }) => Promise<Hex>;
78
77
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
79
78
  signMessage: ({ message }: {
@@ -501,7 +500,7 @@ export declare function getClient(chainId: number): {
501
500
  address: import("viem").Address;
502
501
  nonceManager?: import("viem").NonceManager | undefined;
503
502
  sign: (parameters: {
504
- hash: import("viem").Hash;
503
+ hash: Hash;
505
504
  }) => Promise<Hex>;
506
505
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
507
506
  signMessage: ({ message }: {
@@ -934,7 +933,7 @@ export declare function getClient(chainId: number): {
934
933
  address: import("viem").Address;
935
934
  nonceManager?: import("viem").NonceManager | undefined;
936
935
  sign: (parameters: {
937
- hash: import("viem").Hash;
936
+ hash: Hash;
938
937
  }) => Promise<Hex>;
939
938
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
940
939
  signMessage: ({ message }: {
@@ -1362,7 +1361,7 @@ export declare function getClient(chainId: number): {
1362
1361
  address: import("viem").Address;
1363
1362
  nonceManager?: import("viem").NonceManager | undefined;
1364
1363
  sign: (parameters: {
1365
- hash: import("viem").Hash;
1364
+ hash: Hash;
1366
1365
  }) => Promise<Hex>;
1367
1366
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
1368
1367
  signMessage: ({ message }: {
@@ -1793,7 +1792,7 @@ export declare function getClient(chainId: number): {
1793
1792
  address: import("viem").Address;
1794
1793
  nonceManager?: import("viem").NonceManager | undefined;
1795
1794
  sign: (parameters: {
1796
- hash: import("viem").Hash;
1795
+ hash: Hash;
1797
1796
  }) => Promise<Hex>;
1798
1797
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
1799
1798
  signMessage: ({ message }: {
@@ -2220,7 +2219,7 @@ export declare function getClient(chainId: number): {
2220
2219
  address: import("viem").Address;
2221
2220
  nonceManager?: import("viem").NonceManager | undefined;
2222
2221
  sign: (parameters: {
2223
- hash: import("viem").Hash;
2222
+ hash: Hash;
2224
2223
  }) => Promise<Hex>;
2225
2224
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
2226
2225
  signMessage: ({ message }: {
@@ -3962,7 +3961,7 @@ export declare function getClient(chainId: number): {
3962
3961
  address: import("viem").Address;
3963
3962
  nonceManager?: import("viem").NonceManager | undefined;
3964
3963
  sign: (parameters: {
3965
- hash: import("viem").Hash;
3964
+ hash: Hash;
3966
3965
  }) => Promise<Hex>;
3967
3966
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
3968
3967
  signMessage: ({ message }: {
@@ -4395,7 +4394,7 @@ export declare function getClient(chainId: number): {
4395
4394
  address: import("viem").Address;
4396
4395
  nonceManager?: import("viem").NonceManager | undefined;
4397
4396
  sign: (parameters: {
4398
- hash: import("viem").Hash;
4397
+ hash: Hash;
4399
4398
  }) => Promise<Hex>;
4400
4399
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
4401
4400
  signMessage: ({ message }: {
@@ -4838,7 +4837,7 @@ export declare function getClient(chainId: number): {
4838
4837
  address: import("viem").Address;
4839
4838
  nonceManager?: import("viem").NonceManager | undefined;
4840
4839
  sign: (parameters: {
4841
- hash: import("viem").Hash;
4840
+ hash: Hash;
4842
4841
  }) => Promise<Hex>;
4843
4842
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
4844
4843
  signMessage: ({ message }: {
@@ -5266,7 +5265,7 @@ export declare function getClient(chainId: number): {
5266
5265
  address: import("viem").Address;
5267
5266
  nonceManager?: import("viem").NonceManager | undefined;
5268
5267
  sign: (parameters: {
5269
- hash: import("viem").Hash;
5268
+ hash: Hash;
5270
5269
  }) => Promise<Hex>;
5271
5270
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
5272
5271
  signMessage: ({ message }: {
@@ -5695,7 +5694,7 @@ export declare function getClient(chainId: number): {
5695
5694
  address: import("viem").Address;
5696
5695
  nonceManager?: import("viem").NonceManager | undefined;
5697
5696
  sign: (parameters: {
5698
- hash: import("viem").Hash;
5697
+ hash: Hash;
5699
5698
  }) => Promise<Hex>;
5700
5699
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
5701
5700
  signMessage: ({ message }: {
@@ -6123,7 +6122,7 @@ export declare function getClient(chainId: number): {
6123
6122
  address: import("viem").Address;
6124
6123
  nonceManager?: import("viem").NonceManager | undefined;
6125
6124
  sign: (parameters: {
6126
- hash: import("viem").Hash;
6125
+ hash: Hash;
6127
6126
  }) => Promise<Hex>;
6128
6127
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
6129
6128
  signMessage: ({ message }: {
@@ -6551,7 +6550,7 @@ export declare function getClient(chainId: number): {
6551
6550
  address: import("viem").Address;
6552
6551
  nonceManager?: import("viem").NonceManager | undefined;
6553
6552
  sign: (parameters: {
6554
- hash: import("viem").Hash;
6553
+ hash: Hash;
6555
6554
  }) => Promise<Hex>;
6556
6555
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
6557
6556
  signMessage: ({ message }: {
@@ -8077,7 +8076,7 @@ export declare function getClient(chainId: number): {
8077
8076
  address: import("viem").Address;
8078
8077
  nonceManager?: import("viem").NonceManager | undefined;
8079
8078
  sign: (parameters: {
8080
- hash: import("viem").Hash;
8079
+ hash: Hash;
8081
8080
  }) => Promise<Hex>;
8082
8081
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
8083
8082
  signMessage: ({ message }: {
@@ -8508,7 +8507,7 @@ export declare function getClient(chainId: number): {
8508
8507
  address: import("viem").Address;
8509
8508
  nonceManager?: import("viem").NonceManager | undefined;
8510
8509
  sign: (parameters: {
8511
- hash: import("viem").Hash;
8510
+ hash: Hash;
8512
8511
  }) => Promise<Hex>;
8513
8512
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
8514
8513
  signMessage: ({ message }: {
@@ -8936,7 +8935,7 @@ export declare function getClient(chainId: number): {
8936
8935
  address: import("viem").Address;
8937
8936
  nonceManager?: import("viem").NonceManager | undefined;
8938
8937
  sign: (parameters: {
8939
- hash: import("viem").Hash;
8938
+ hash: Hash;
8940
8939
  }) => Promise<Hex>;
8941
8940
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
8942
8941
  signMessage: ({ message }: {
@@ -9380,7 +9379,7 @@ export declare function getClient(chainId: number): {
9380
9379
  address: import("viem").Address;
9381
9380
  nonceManager?: import("viem").NonceManager | undefined;
9382
9381
  sign: (parameters: {
9383
- hash: import("viem").Hash;
9382
+ hash: Hash;
9384
9383
  }) => Promise<Hex>;
9385
9384
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
9386
9385
  signMessage: ({ message }: {
@@ -9807,7 +9806,7 @@ export declare function getClient(chainId: number): {
9807
9806
  address: import("viem").Address;
9808
9807
  nonceManager?: import("viem").NonceManager | undefined;
9809
9808
  sign: (parameters: {
9810
- hash: import("viem").Hash;
9809
+ hash: Hash;
9811
9810
  }) => Promise<Hex>;
9812
9811
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
9813
9812
  signMessage: ({ message }: {
@@ -10234,7 +10233,7 @@ export declare function getClient(chainId: number): {
10234
10233
  address: import("viem").Address;
10235
10234
  nonceManager?: import("viem").NonceManager | undefined;
10236
10235
  sign: (parameters: {
10237
- hash: import("viem").Hash;
10236
+ hash: Hash;
10238
10237
  }) => Promise<Hex>;
10239
10238
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
10240
10239
  signMessage: ({ message }: {
@@ -10661,7 +10660,7 @@ export declare function getClient(chainId: number): {
10661
10660
  address: import("viem").Address;
10662
10661
  nonceManager?: import("viem").NonceManager | undefined;
10663
10662
  sign: (parameters: {
10664
- hash: import("viem").Hash;
10663
+ hash: Hash;
10665
10664
  }) => Promise<Hex>;
10666
10665
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
10667
10666
  signMessage: ({ message }: {
@@ -11088,7 +11087,7 @@ export declare function getClient(chainId: number): {
11088
11087
  address: import("viem").Address;
11089
11088
  nonceManager?: import("viem").NonceManager | undefined;
11090
11089
  sign: (parameters: {
11091
- hash: import("viem").Hash;
11090
+ hash: Hash;
11092
11091
  }) => Promise<Hex>;
11093
11092
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
11094
11093
  signMessage: ({ message }: {
@@ -11515,7 +11514,7 @@ export declare function getClient(chainId: number): {
11515
11514
  address: import("viem").Address;
11516
11515
  nonceManager?: import("viem").NonceManager | undefined;
11517
11516
  sign: (parameters: {
11518
- hash: import("viem").Hash;
11517
+ hash: Hash;
11519
11518
  }) => Promise<Hex>;
11520
11519
  signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
11521
11520
  signMessage: ({ message }: {
@@ -11948,6 +11947,11 @@ export declare const globalOptions: z.ZodObject<{
11948
11947
  export declare function createLocalDatabase(dbPath: string): Promise<LocalDatabase>;
11949
11948
  export declare function migrateLocalDatabase(db: LocalDatabase): Promise<void>;
11950
11949
  export declare function hashLink(hash: string, chain: Chain): string;
11950
+ export declare function completeConfirmedOperations({ localDb, client, operations, }: {
11951
+ localDb: LocalDatabase;
11952
+ client: WalletClient;
11953
+ operations: OperationSelect[];
11954
+ }): Promise<OperationSelect[]>;
11951
11955
  export declare function getPiece({ pieceCid, serviceUrl }: {
11952
11956
  pieceCid: string;
11953
11957
  serviceUrl: string;
@@ -11956,7 +11960,7 @@ export declare function findPieceOnProviders(providers: string[], pieceCid: stri
11956
11960
  export declare const buildConflictUpdateColumns: <T extends PgTable | SQLiteTable, Q extends keyof T["_"]["columns"]>(table: T, columns?: Q[]) => Record<Q, SQL<unknown>>;
11957
11961
  export declare function excludeOperationsByCid(operations: OperationSelect[], cid: string): {
11958
11962
  operationToCommit: {
11959
- metadata: MetadataObject;
11963
+ metadata: import("@filoz/synapse-core").MetadataObject;
11960
11964
  cid: string;
11961
11965
  id: number;
11962
11966
  status: schema.OperationStatus;
@@ -11965,11 +11969,11 @@ export declare function excludeOperationsByCid(operations: OperationSelect[], ci
11965
11969
  repairId: number;
11966
11970
  type: schema.OperationType;
11967
11971
  alternateProvider: string;
11968
- result: schema.OperationResult | null;
11972
+ txHash: string | null;
11969
11973
  error: string | null;
11970
11974
  }[];
11971
11975
  operationToFailed: {
11972
- metadata: MetadataObject;
11976
+ metadata: import("@filoz/synapse-core").MetadataObject;
11973
11977
  cid: string;
11974
11978
  id: number;
11975
11979
  status: schema.OperationStatus;
@@ -11978,7 +11982,7 @@ export declare function excludeOperationsByCid(operations: OperationSelect[], ci
11978
11982
  repairId: number;
11979
11983
  type: schema.OperationType;
11980
11984
  alternateProvider: string;
11981
- result: schema.OperationResult | null;
11985
+ txHash: string | null;
11982
11986
  error: string | null;
11983
11987
  }[];
11984
11988
  };
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,KAAK,KAAK,EAAY,MAAM,4BAA4B,CAAA;AAEjE,OAAO,KAAK,KAAK,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAmB,KAAK,GAAG,EAAO,MAAM,aAAa,CAAA;AAE5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAI/B,OAAO,EAAsB,KAAK,GAAG,EAAQ,MAAM,MAAM,CAAA;AAGzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,eAAO,MAAM,YAAY;;;;;;;iBAOvB,CAAA;AAEF,eAAO,MAAM,MAAM;;;;;;;kBAIjB,CAAA;AAEF,eAAO,MAAM,IAAI,QAAmB,CAAA;AACpC,eAAO,MAAM,OAAO,QAAsB,CAAA;AAgB1C,wBAAgB,SAAS,CAAC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O,EAAE,aAAa,CAAA;IACtB,MAAM,EAAE,YAAY,CAAA;IACpB,UAAU,EAAE,eAAe,EAAE,CAAA;CAC9B,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAyC7B;AAKD,wBAAsB,QAAQ,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,mBAehG;AASD,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,+BAe/E;AAED,eAAO,MAAM,0BAA0B,GAAI,CAAC,SAAS,OAAO,GAAG,WAAW,EAAE,CAAC,SAAS,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,EAC3G,OAAO,CAAC,EACR,UAAU,CAAC,EAAE,4BAed,CAAA;AAKD,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,eAAe,EAAE,EAAE,GAAG,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWhF;AAKD,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,eAAe,EAAE,uBAiBnE"}
package/dist/src/utils.js CHANGED
@@ -1,14 +1,15 @@
1
1
  import { getChain } from '@filoz/synapse-core/chains';
2
2
  import * as Piece from '@filoz/synapse-core/piece';
3
- import { getTableColumns, sql } from 'drizzle-orm';
3
+ import { getTableColumns, inArray, sql } from 'drizzle-orm';
4
4
  import { drizzle } from 'drizzle-orm/libsql';
5
5
  import { z } from 'incur';
6
6
  import { Conf } from 'iso-conf';
7
7
  import { request } from 'iso-web/http';
8
8
  import pLocate from 'p-locate';
9
9
  import terminalLink from 'terminal-link';
10
- import { createWalletClient, http } from 'viem';
10
+ import { createWalletClient, http, TransactionReceiptNotFoundError } from 'viem';
11
11
  import { privateKeyToAccount } from 'viem/accounts';
12
+ import { getTransactionReceipt } from 'viem/actions';
12
13
  import packageJson from '../package.json' with { type: 'json' };
13
14
  import * as schema from "./local-schema.js";
14
15
  export const configSchema = z.object({
@@ -88,18 +89,62 @@ export async function migrateLocalDatabase(db) {
88
89
  cid text NOT NULL,
89
90
  metadata text NOT NULL,
90
91
  alternate_provider text NOT NULL,
91
- result text,
92
+ tx_hash text,
92
93
  error text,
93
94
  created_at integer NOT NULL,
94
95
  updated_at integer NOT NULL,
95
96
  FOREIGN KEY (repair_id) REFERENCES repairs(id)
96
97
  )
97
98
  `);
99
+ try {
100
+ await db.$client.execute(`
101
+ ALTER TABLE operations ADD COLUMN tx_hash text
102
+ `);
103
+ }
104
+ catch {
105
+ }
106
+ try {
107
+ await db.$client.execute(`
108
+ ALTER TABLE operations DROP COLUMN result
109
+ `);
110
+ }
111
+ catch {
112
+ }
98
113
  }
99
114
  export function hashLink(hash, chain) {
100
115
  const link = terminalLink(hash, `${chain.blockExplorers?.default?.url}/tx/${hash}`);
101
116
  return link;
102
117
  }
118
+ export async function completeConfirmedOperations({ localDb, client, operations, }) {
119
+ const hashes = new Set(operations.map((operation) => operation.txHash).filter((txHash) => txHash != null));
120
+ const completedHashes = new Set();
121
+ for (const hash of hashes) {
122
+ try {
123
+ const receipt = await getTransactionReceipt(client, { hash });
124
+ if (receipt.status === 'success') {
125
+ completedHashes.add(hash);
126
+ }
127
+ }
128
+ catch (error) {
129
+ if (!(error instanceof TransactionReceiptNotFoundError)) {
130
+ throw error;
131
+ }
132
+ }
133
+ }
134
+ const completedOperations = operations.filter((operation) => operation.txHash != null && completedHashes.has(operation.txHash));
135
+ if (completedOperations.length > 0) {
136
+ await localDb
137
+ .update(schema.operations)
138
+ .set({
139
+ status: 'completed',
140
+ error: null,
141
+ updatedAt: Date.now(),
142
+ })
143
+ .where(inArray(schema.operations.id, completedOperations.map((operation) => operation.id)));
144
+ }
145
+ const completedOperationIds = new Set(completedOperations.map((operation) => operation.id));
146
+ return operations.filter((operation) => operation.status !== 'completed' && !completedOperationIds.has(operation.id));
147
+ }
103
148
  export async function getPiece({ pieceCid, serviceUrl }) {
104
149
  const url = new URL(`/piece/${pieceCid}`, serviceUrl);
105
150
  const response = await request.head(url, {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,KAAK,MAAM,2BAA2B,CAAA;AAElD,OAAO,EAAE,eAAe,EAAY,GAAG,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAG5C,OAAO,EAAE,CAAC,EAAE,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,YAAY,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAY,IAAI,EAAE,MAAM,MAAM,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,WAAW,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AAE/D,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAG3C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,iBAAiB,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACrC,qBAAqB,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACzC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,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I,UAAU,EAAE,CAAC;QACnC,IAAI,SAAS,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;YAC1B,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACnC,CAAC;aAAM,CAAC;YACN,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACnC,CAAC;IACH,CAAC;IACD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,CAAA;AACjD,CAAC;AAKD,MAAM,UAAU,sBAAsB,CAAC,UAA6B;IAClE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;IAC9B,MAAM,MAAM,GAAwB,EAAE,CAAA;IACtC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,IAAI,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5B,SAAQ;QACV,CAAC;QACD,MAAM,CAAC,IAAI,CAAC;YACV,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC;gBACjC,GAAG,EAAE,SAAS,CAAC,GAAG;gBAClB,UAAU,EAAE,SAAS,CAAC,iBAAiB;aACxC,CAAC;YACF,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC;SACpC,CAAC,CAAA;QACF,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IACzB,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@filoz/repair-cli",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Early repair for faulty service providers and datasets",
5
5
  "repository": {
6
6
  "type": "git",
package/readme.md CHANGED
@@ -73,10 +73,11 @@ This command only works on Calibration. It claims faucet tokens, waits for the t
73
73
 
74
74
  ### `repair wallet balance`
75
75
 
76
- Shows wallet and payment account balances.
76
+ Shows wallet and payment account balances for the configured wallet, or for a provided address.
77
77
 
78
78
  ```bash
79
79
  repair wallet balance
80
+ repair wallet balance --address 0x1234567890123456789012345678901234567890
80
81
  ```
81
82
 
82
83
  The output includes the wallet address, FIL balance, USDFC balance, and Filecoin Pay account summary fields such as funds, available funds, debt, lockup rates, lockup totals, runway, and current epoch.
@@ -89,7 +90,7 @@ Deposits USDFC from the configured wallet into the wallet's Filecoin Pay account
89
90
  repair wallet deposit 100
90
91
  ```
91
92
 
92
- `amount` is a positive USDFC amount. The command submits the deposit and approval transaction, then waits for it to be mined.
93
+ `amount` is a positive USDFC amount. The command submits the deposit and approval transaction, waits for it to be mined, and returns the amount and transaction hash when structured output is requested.
93
94
 
94
95
  ### `repair wallet withdraw <amount>`
95
96
 
@@ -99,7 +100,39 @@ Withdraws USDFC from the wallet's Filecoin Pay account.
99
100
  repair wallet withdraw 25
100
101
  ```
101
102
 
102
- `amount` is a positive USDFC amount. The command submits the withdraw transaction and waits for it to be mined.
103
+ `amount` is a positive USDFC amount. The command submits the withdraw transaction, waits for it to be mined, and returns the amount and transaction hash when structured output is requested.
104
+
105
+ ### `repair session-key approve <address>`
106
+
107
+ Approves a session key for storage operations using the configured wallet.
108
+
109
+ ```bash
110
+ repair session-key approve 0x1234567890123456789012345678901234567890
111
+ ```
112
+
113
+ By default, the session key is approved for 100 days. Use `--expires-in-days` to choose a different duration, and `--origin` to override the origin string recorded on-chain.
114
+
115
+ ```bash
116
+ repair session-key approve 0x1234567890123456789012345678901234567890 --expires-in-days 30 --origin early-repair
117
+ ```
118
+
119
+ The command waits for the approval transaction to be mined and returns the session key address, expiry timestamp, and transaction hash when structured output is requested.
120
+
121
+ ### `repair session-key revoke <address>`
122
+
123
+ Revokes a session key for storage operations using the configured wallet.
124
+
125
+ ```bash
126
+ repair session-key revoke 0x1234567890123456789012345678901234567890
127
+ ```
128
+
129
+ Use `--origin` to override the origin string recorded on-chain.
130
+
131
+ ```bash
132
+ repair session-key revoke 0x1234567890123456789012345678901234567890 --origin early-repair
133
+ ```
134
+
135
+ The command waits for the revoke transaction to be mined and returns the session key address and transaction hash when structured output is requested.
103
136
 
104
137
  ### `repair providers list`
105
138
 
@@ -208,11 +241,13 @@ Options:
208
241
 
209
242
  - `--concurrency <number>` controls how many pull batches run at once. Defaults to `4`.
210
243
  - `--batch-size <number>` controls the maximum number of `add_piece` operations per batch. Defaults to `40`.
244
+ - `--payer <address>` overrides the payer address used when creating or finding the target repair dataset. Defaults to the configured wallet address.
211
245
 
212
246
  Example:
213
247
 
214
248
  ```bash
215
249
  repair repair run 1 --concurrency 8 --batch-size 40
250
+ repair repair run 1 --payer 0x1234567890123456789012345678901234567890
216
251
  ```
217
252
 
218
253
  ### `repair repair delete <repairId>`
@@ -270,11 +305,13 @@ Options:
270
305
 
271
306
  - `--concurrency <number>` controls how many pull batches run at once. Defaults to `4`.
272
307
  - `--batch-size <number>` controls the maximum number of `add_piece` operations per batch. Defaults to `40`.
308
+ - `--payer <address>` overrides the payer address used when creating the target replication dataset. Defaults to the configured wallet address.
273
309
 
274
310
  Example:
275
311
 
276
312
  ```bash
277
313
  repair replicate run 1 --concurrency 8 --batch-size 40
314
+ repair replicate run 1 --payer 0x1234567890123456789012345678901234567890
278
315
  ```
279
316
 
280
317
  ### `repair replicate delete <replicateId>`
package/src/cli.ts CHANGED
@@ -4,6 +4,7 @@ import { datasets } from './commands/datasets.ts'
4
4
  import { providers } from './commands/providers.ts'
5
5
  import { repair } from './commands/repair.ts'
6
6
  import { replicate } from './commands/replicate.ts'
7
+ import { sessionKey } from './commands/session-key.ts'
7
8
  import { setup } from './commands/setup.ts'
8
9
  import { wallet } from './commands/wallet.ts'
9
10
  import { version } from './utils.ts'
@@ -19,4 +20,5 @@ cli.command(repair)
19
20
  cli.command(replicate)
20
21
  cli.command(datasets)
21
22
  cli.command(providers)
23
+ cli.command(sessionKey)
22
24
  cli.serve()
@@ -3,8 +3,10 @@ import * as SP from '@filoz/synapse-core/sp'
3
3
  import { getPdpDataSet } from '@filoz/synapse-core/warm-storage'
4
4
  import { and, asc, eq } from 'drizzle-orm'
5
5
  import { Cli, z } from 'incur'
6
+ import { isAddress } from 'viem'
6
7
  import { contextMiddleware, contextSchema } from '../middleware.ts'
7
8
  import { globalOptions, hashLink } from '../utils.ts'
9
+
8
10
  export const datasets = Cli.create('datasets', {
9
11
  description: 'Dataset commands',
10
12
  options: globalOptions,
@@ -15,15 +17,15 @@ datasets.command('list', {
15
17
  description: 'List all datasets owned by the repair wallet',
16
18
  options: globalOptions.extend({
17
19
  providerId: z.coerce.bigint().optional().describe('Filter datasets by provider ID'),
20
+ payer: z.string().refine(isAddress, 'Invalid address').optional().describe('Filter datasets by payer address'),
18
21
  }),
19
22
  middleware: [contextMiddleware],
20
23
  run: async (c) => {
21
24
  try {
22
25
  const schema = c.var.indexerDb._.fullSchema
23
- const conditions = [
24
- eq(schema.dataSets.deleted, false),
25
- eq(schema.dataSets.payer, c.var.client.account.address.toLowerCase()),
26
- ]
26
+ const payer = c.options.payer?.toLowerCase() ?? c.var.client.account.address.toLowerCase()
27
+ const conditions = [eq(schema.dataSets.deleted, false), eq(schema.dataSets.payer, payer)]
28
+
27
29
  if (c.options.providerId != null) {
28
30
  conditions.push(eq(schema.dataSets.providerId, c.options.providerId))
29
31
  }
@@ -76,7 +78,7 @@ datasets.command('terminate', {
76
78
  middleware: [contextMiddleware],
77
79
  outputPolicy: 'agent-only',
78
80
  run: async (c) => {
79
- const isInteractive = !c.agent && !c.formatExplicit
81
+ const { isInteractive } = c.var
80
82
  const spinner = p.spinner()
81
83
  try {
82
84
  if (isInteractive) {
@@ -1,5 +1,6 @@
1
1
  import { and, desc, eq, inArray, isNull } from 'drizzle-orm'
2
2
  import { Cli, z } from 'incur'
3
+ import { isAddress } from 'viem'
3
4
  import { repairCreate } from '../db/repair-create.ts'
4
5
  import { repairDelete } from '../db/repair-delete.ts'
5
6
  import { contextMiddleware, contextSchema } from '../middleware.ts'
@@ -135,11 +136,13 @@ repair.command('run', {
135
136
  options: globalOptions.extend({
136
137
  concurrency: z.coerce.number().min(1).max(10).default(4).describe('Concurrency level'),
137
138
  batchSize: z.coerce.number().min(1).max(40).default(40).describe('Max pieces per batch'),
139
+ payer: z.string().refine(isAddress, 'Invalid address').optional().describe('Payer address'),
138
140
  }),
139
141
  middleware: [contextMiddleware],
140
142
  run: async (c) => {
141
143
  try {
142
144
  const schema = c.var.localDb._.fullSchema
145
+ const payer = c.options.payer ?? c.var.client.account.address
143
146
  const repair = await c.var.localDb.query.repairs.findFirst({
144
147
  where: and(
145
148
  eq(schema.repairs.id, c.args.repairId),
@@ -158,6 +161,7 @@ repair.command('run', {
158
161
  await ensureRepairDataset({
159
162
  ...c.var,
160
163
  repair,
164
+ payer,
161
165
  })
162
166
 
163
167
  await runAddPieces({
@@ -1,5 +1,6 @@
1
1
  import { and, desc, eq, inArray, isNotNull } from 'drizzle-orm'
2
2
  import { Cli, z } from 'incur'
3
+ import { isAddress } from 'viem'
3
4
  import { repairDelete } from '../db/repair-delete.ts'
4
5
  import { replicateCreate } from '../db/replicate-create.ts'
5
6
  import { contextMiddleware, contextSchema } from '../middleware.ts'
@@ -136,11 +137,13 @@ replicate.command('run', {
136
137
  options: globalOptions.extend({
137
138
  concurrency: z.coerce.number().min(1).max(10).default(4).describe('Concurrency level'),
138
139
  batchSize: z.coerce.number().min(1).max(40).default(40).describe('Max pieces per batch'),
140
+ payer: z.string().refine(isAddress, 'Invalid address').optional().describe('Payer address'),
139
141
  }),
140
142
  middleware: [contextMiddleware],
141
143
  run: async (c) => {
142
144
  try {
143
145
  const schema = c.var.localDb._.fullSchema
146
+ const payer = c.options.payer ?? c.var.client.account.address
144
147
  const repair = await c.var.localDb.query.repairs.findFirst({
145
148
  where: and(
146
149
  eq(schema.repairs.id, c.args.replicateId),
@@ -159,6 +162,7 @@ replicate.command('run', {
159
162
  await ensureReplicateDataset({
160
163
  ...c.var,
161
164
  repair,
165
+ payer,
162
166
  source: c.var.source,
163
167
  })
164
168