@filoz/repair-cli 0.3.0 → 1.0.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/package.json +3 -3
- package/dist/src/api.d.ts +35 -0
- package/dist/src/api.d.ts.map +1 -0
- package/dist/src/api.js +118 -0
- package/dist/src/api.js.map +1 -0
- package/dist/src/cli.js +2 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/datasets.d.ts +3 -5
- package/dist/src/commands/datasets.d.ts.map +1 -1
- package/dist/src/commands/datasets.js +24 -33
- package/dist/src/commands/datasets.js.map +1 -1
- package/dist/src/commands/providers.d.ts +3 -5
- package/dist/src/commands/providers.d.ts.map +1 -1
- package/dist/src/commands/providers.js +32 -33
- package/dist/src/commands/providers.js.map +1 -1
- package/dist/src/commands/repair.d.ts +3 -5
- package/dist/src/commands/repair.d.ts.map +1 -1
- package/dist/src/commands/repair.js +3 -3
- package/dist/src/commands/repair.js.map +1 -1
- package/dist/src/commands/replicate.d.ts +3 -5
- package/dist/src/commands/replicate.d.ts.map +1 -1
- package/dist/src/commands/replicate.js +3 -3
- package/dist/src/commands/replicate.js.map +1 -1
- package/dist/src/commands/second-copy.d.ts +23 -0
- package/dist/src/commands/second-copy.d.ts.map +1 -0
- package/dist/src/commands/second-copy.js +175 -0
- package/dist/src/commands/second-copy.js.map +1 -0
- package/dist/src/commands/session-key.d.ts +3 -5
- package/dist/src/commands/session-key.d.ts.map +1 -1
- package/dist/src/commands/setup.d.ts.map +1 -1
- package/dist/src/commands/setup.js +11 -32
- package/dist/src/commands/setup.js.map +1 -1
- package/dist/src/commands/wallet.d.ts +3 -5
- package/dist/src/commands/wallet.d.ts.map +1 -1
- package/dist/src/db/dedupe-cids.d.ts +6 -7
- package/dist/src/db/dedupe-cids.d.ts.map +1 -1
- package/dist/src/db/dedupe-cids.js +2 -14
- package/dist/src/db/dedupe-cids.js.map +1 -1
- package/dist/src/db/find-repair-dataset.d.ts +3 -3
- package/dist/src/db/find-repair-dataset.d.ts.map +1 -1
- package/dist/src/db/find-repair-dataset.js +16 -14
- package/dist/src/db/find-repair-dataset.js.map +1 -1
- package/dist/src/db/get-active-data-set-ids.d.ts +9 -0
- package/dist/src/db/get-active-data-set-ids.d.ts.map +1 -0
- package/dist/src/db/get-active-data-set-ids.js +9 -0
- package/dist/src/db/get-active-data-set-ids.js.map +1 -0
- package/dist/src/db/get-alternate-provider-urls.d.ts +6 -0
- package/dist/src/db/get-alternate-provider-urls.d.ts.map +1 -0
- package/dist/src/db/get-alternate-provider-urls.js +24 -0
- package/dist/src/db/get-alternate-provider-urls.js.map +1 -0
- package/dist/src/db/get-pieces.d.ts +8 -27
- package/dist/src/db/get-pieces.d.ts.map +1 -1
- package/dist/src/db/get-pieces.js +44 -97
- package/dist/src/db/get-pieces.js.map +1 -1
- package/dist/src/db/get-repair-provider.d.ts +2 -2
- package/dist/src/db/get-repair-provider.d.ts.map +1 -1
- package/dist/src/db/get-repair-provider.js +8 -20
- package/dist/src/db/get-repair-provider.js.map +1 -1
- package/dist/src/db/repair-create.d.ts.map +1 -1
- package/dist/src/db/repair-create.js +5 -3
- package/dist/src/db/repair-create.js.map +1 -1
- package/dist/src/db/replicate-create.d.ts.map +1 -1
- package/dist/src/db/replicate-create.js +15 -21
- package/dist/src/db/replicate-create.js.map +1 -1
- package/dist/src/db/second-copy-create.d.ts +10 -0
- package/dist/src/db/second-copy-create.d.ts.map +1 -0
- package/dist/src/db/second-copy-create.js +104 -0
- package/dist/src/db/second-copy-create.js.map +1 -0
- package/dist/src/local-schema.d.ts +41 -1
- package/dist/src/local-schema.d.ts.map +1 -1
- package/dist/src/local-schema.js +2 -0
- package/dist/src/local-schema.js.map +1 -1
- package/dist/src/middleware.d.ts +7 -11
- package/dist/src/middleware.d.ts.map +1 -1
- package/dist/src/middleware.js +6 -10
- package/dist/src/middleware.js.map +1 -1
- package/dist/src/pipeline/add-pieces.d.ts +3 -3
- package/dist/src/pipeline/add-pieces.d.ts.map +1 -1
- package/dist/src/pipeline/add-pieces.js +15 -7
- package/dist/src/pipeline/add-pieces.js.map +1 -1
- package/dist/src/pipeline/create-datasets.d.ts +4 -4
- package/dist/src/pipeline/create-datasets.d.ts.map +1 -1
- package/dist/src/pipeline/create-datasets.js +7 -14
- package/dist/src/pipeline/create-datasets.js.map +1 -1
- package/dist/src/types.d.ts +6 -7
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils.d.ts +7 -10
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +21 -2
- package/dist/src/utils.js.map +1 -1
- package/package.json +3 -3
- package/readme.md +98 -13
- package/src/api.ts +220 -0
- package/src/cli.ts +2 -0
- package/src/commands/datasets.ts +24 -36
- package/src/commands/providers.ts +34 -42
- package/src/commands/repair.ts +3 -3
- package/src/commands/replicate.ts +3 -3
- package/src/commands/second-copy.ts +187 -0
- package/src/commands/setup.ts +12 -35
- package/src/db/dedupe-cids.ts +7 -24
- package/src/db/find-repair-dataset.ts +17 -28
- package/src/db/get-active-data-set-ids.ts +29 -0
- package/src/db/get-alternate-provider-urls.ts +43 -0
- package/src/db/get-pieces.ts +82 -214
- package/src/db/get-repair-provider.ts +10 -30
- package/src/db/repair-create.ts +5 -3
- package/src/db/replicate-create.ts +15 -21
- package/src/db/second-copy-create.ts +147 -0
- package/src/local-schema.ts +3 -0
- package/src/middleware.ts +7 -11
- package/src/pipeline/add-pieces.ts +21 -11
- package/src/pipeline/create-datasets.ts +9 -29
- package/src/types.ts +9 -7
- package/src/utils.ts +22 -4
- package/dist/src/db/find-providers-by-cid.d.ts +0 -9
- package/dist/src/db/find-providers-by-cid.d.ts.map +0 -1
- package/dist/src/db/find-providers-by-cid.js +0 -43
- package/dist/src/db/find-providers-by-cid.js.map +0 -1
- package/dist/src/indexer-schema.d.ts +0 -549
- package/dist/src/indexer-schema.d.ts.map +0 -1
- package/dist/src/indexer-schema.js +0 -56
- package/dist/src/indexer-schema.js.map +0 -1
- package/src/db/find-providers-by-cid.ts +0 -70
- package/src/indexer-schema.ts +0 -77
package/src/indexer-schema.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { relations } from 'drizzle-orm'
|
|
2
|
-
import { bigint, boolean, index, jsonb, pgSchema, primaryKey, text } from 'drizzle-orm/pg-core'
|
|
3
|
-
import type { Address } from 'viem'
|
|
4
|
-
|
|
5
|
-
export type JsonRecord = Record<string, string>
|
|
6
|
-
|
|
7
|
-
const schema = pgSchema('early-repair')
|
|
8
|
-
|
|
9
|
-
export const providers = schema.table(
|
|
10
|
-
'providers',
|
|
11
|
-
{
|
|
12
|
-
providerId: bigint('provider_id', { mode: 'bigint' }).primaryKey(),
|
|
13
|
-
providerAddress: text('provider_address').$type<Address>(),
|
|
14
|
-
name: text('name'),
|
|
15
|
-
serviceUrl: text('service_url'),
|
|
16
|
-
providerActive: boolean('provider_active').notNull(),
|
|
17
|
-
pdpProductActive: boolean('pdp_product_active').notNull(),
|
|
18
|
-
approved: boolean('approved').notNull().default(false),
|
|
19
|
-
endorsed: boolean('endorsed').notNull().default(false),
|
|
20
|
-
createdAtBlock: bigint('created_at_block', { mode: 'bigint' }),
|
|
21
|
-
updatedAtBlock: bigint('updated_at_block', { mode: 'bigint' }).notNull(),
|
|
22
|
-
},
|
|
23
|
-
(table) => [index('providers_provider_address_idx').on(table.providerAddress)]
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
export const providersRelations = relations(providers, ({ many }) => ({
|
|
27
|
-
dataSets: many(dataSets),
|
|
28
|
-
}))
|
|
29
|
-
|
|
30
|
-
export const dataSets = schema.table(
|
|
31
|
-
'data_sets',
|
|
32
|
-
{
|
|
33
|
-
dataSetId: bigint('data_set_id', { mode: 'bigint' }).primaryKey(),
|
|
34
|
-
providerId: bigint('provider_id', { mode: 'bigint' }).notNull(),
|
|
35
|
-
metadata: jsonb('metadata').$type<JsonRecord | null>(),
|
|
36
|
-
payer: text('payer').notNull(),
|
|
37
|
-
source: text('source'),
|
|
38
|
-
withCdn: boolean('with_cdn').notNull(),
|
|
39
|
-
withIpfsIndexing: boolean('with_ipfs_indexing').notNull(),
|
|
40
|
-
pdpEndEpoch: bigint('pdp_end_epoch', { mode: 'bigint' }).notNull(),
|
|
41
|
-
deleted: boolean('deleted').notNull(),
|
|
42
|
-
createdAtBlock: bigint('created_at_block', { mode: 'bigint' }).notNull(),
|
|
43
|
-
updatedAtBlock: bigint('updated_at_block', { mode: 'bigint' }).notNull(),
|
|
44
|
-
},
|
|
45
|
-
(table) => [index('data_sets_provider_id_idx').on(table.providerId)]
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
export const dataSetsRelations = relations(dataSets, ({ one, many }) => ({
|
|
49
|
-
provider: one(providers, {
|
|
50
|
-
fields: [dataSets.providerId],
|
|
51
|
-
references: [providers.providerId],
|
|
52
|
-
}),
|
|
53
|
-
pieces: many(pieces),
|
|
54
|
-
}))
|
|
55
|
-
|
|
56
|
-
export const pieces = schema.table(
|
|
57
|
-
'pieces',
|
|
58
|
-
{
|
|
59
|
-
dataSetId: bigint('data_set_id', { mode: 'bigint' }).notNull(),
|
|
60
|
-
pieceId: bigint('piece_id', { mode: 'bigint' }).notNull(),
|
|
61
|
-
cid: text('cid').notNull(),
|
|
62
|
-
rawSize: bigint('raw_size', { mode: 'bigint' }).notNull(),
|
|
63
|
-
metadata: jsonb('metadata').$type<JsonRecord | null>(),
|
|
64
|
-
removed: boolean('removed').notNull(),
|
|
65
|
-
addedAtBlock: bigint('added_at_block', { mode: 'bigint' }).notNull(),
|
|
66
|
-
removedAtBlock: bigint('removed_at_block', { mode: 'bigint' }),
|
|
67
|
-
updatedAtBlock: bigint('updated_at_block', { mode: 'bigint' }).notNull(),
|
|
68
|
-
},
|
|
69
|
-
(table) => [primaryKey({ columns: [table.dataSetId, table.pieceId] }), index('pieces_cid_idx').on(table.cid)]
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
export const piecesRelations = relations(pieces, ({ one }) => ({
|
|
73
|
-
dataSet: one(dataSets, {
|
|
74
|
-
fields: [pieces.dataSetId],
|
|
75
|
-
references: [dataSets.dataSetId],
|
|
76
|
-
}),
|
|
77
|
-
}))
|