@push.rocks/containerarchive 0.0.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.
- package/dist_rust/containerarchive_linux_amd64 +0 -0
- package/dist_rust/containerarchive_linux_arm64 +0 -0
- package/dist_ts/00_commitinfo_data.d.ts +8 -0
- package/dist_ts/00_commitinfo_data.js +9 -0
- package/dist_ts/classes.containerarchive.d.ts +87 -0
- package/dist_ts/classes.containerarchive.js +305 -0
- package/dist_ts/index.d.ts +2 -0
- package/dist_ts/index.js +3 -0
- package/dist_ts/interfaces.d.ts +184 -0
- package/dist_ts/interfaces.js +2 -0
- package/dist_ts/plugins.d.ts +12 -0
- package/dist_ts/plugins.js +15 -0
- package/license +21 -0
- package/npmextra.json +40 -0
- package/package.json +59 -0
- package/ts/00_commitinfo_data.ts +8 -0
- package/ts/classes.containerarchive.ts +419 -0
- package/ts/index.ts +2 -0
- package/ts/interfaces.ts +227 -0
- package/ts/plugins.ts +17 -0
package/ts/interfaces.ts
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import type { ICommandDefinition } from '@push.rocks/smartrust';
|
|
2
|
+
|
|
3
|
+
// ==================== Repository Config ====================
|
|
4
|
+
|
|
5
|
+
export interface IRepositoryConfig {
|
|
6
|
+
version: number;
|
|
7
|
+
id: string;
|
|
8
|
+
createdAt: string;
|
|
9
|
+
chunking: IChunkingConfig;
|
|
10
|
+
compression: string;
|
|
11
|
+
encryption?: IEncryptionConfig;
|
|
12
|
+
packTargetSize: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface IChunkingConfig {
|
|
16
|
+
algorithm: string;
|
|
17
|
+
minSize: number;
|
|
18
|
+
avgSize: number;
|
|
19
|
+
maxSize: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface IEncryptionConfig {
|
|
23
|
+
algorithm: string;
|
|
24
|
+
kdf: string;
|
|
25
|
+
kdfParams: IKdfParams;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface IKdfParams {
|
|
29
|
+
memory: number;
|
|
30
|
+
iterations: number;
|
|
31
|
+
parallelism: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ==================== Snapshots ====================
|
|
35
|
+
|
|
36
|
+
export interface ISnapshot {
|
|
37
|
+
id: string;
|
|
38
|
+
version: number;
|
|
39
|
+
createdAt: string;
|
|
40
|
+
tags: Record<string, string>;
|
|
41
|
+
originalSize: number;
|
|
42
|
+
storedSize: number;
|
|
43
|
+
chunkCount: number;
|
|
44
|
+
newChunks: number;
|
|
45
|
+
reusedChunks: number;
|
|
46
|
+
items: ISnapshotItem[];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface ISnapshotItem {
|
|
50
|
+
name: string;
|
|
51
|
+
type: string;
|
|
52
|
+
size: number;
|
|
53
|
+
chunks: string[];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface ISnapshotFilter {
|
|
57
|
+
tags?: Record<string, string>;
|
|
58
|
+
after?: string;
|
|
59
|
+
before?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ==================== Ingest ====================
|
|
63
|
+
|
|
64
|
+
export interface IInitOptions {
|
|
65
|
+
passphrase?: string;
|
|
66
|
+
chunking?: Partial<IChunkingConfig>;
|
|
67
|
+
packTargetSize?: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface IOpenOptions {
|
|
71
|
+
passphrase?: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface IIngestOptions {
|
|
75
|
+
tags?: Record<string, string>;
|
|
76
|
+
items?: IIngestItemOptions[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface IIngestItemOptions {
|
|
80
|
+
name: string;
|
|
81
|
+
type?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface IIngestItem {
|
|
85
|
+
stream: NodeJS.ReadableStream;
|
|
86
|
+
name: string;
|
|
87
|
+
type?: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// ==================== Restore ====================
|
|
91
|
+
|
|
92
|
+
export interface IRestoreOptions {
|
|
93
|
+
item?: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// ==================== Maintenance ====================
|
|
97
|
+
|
|
98
|
+
export interface IVerifyOptions {
|
|
99
|
+
level?: 'quick' | 'standard' | 'full';
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface IVerifyResult {
|
|
103
|
+
ok: boolean;
|
|
104
|
+
errors: IVerifyError[];
|
|
105
|
+
stats: {
|
|
106
|
+
packsChecked: number;
|
|
107
|
+
chunksChecked: number;
|
|
108
|
+
snapshotsChecked: number;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface IVerifyError {
|
|
113
|
+
pack?: string;
|
|
114
|
+
chunk?: string;
|
|
115
|
+
snapshot?: string;
|
|
116
|
+
error: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface IRetentionPolicy {
|
|
120
|
+
keepLast?: number;
|
|
121
|
+
keepDays?: number;
|
|
122
|
+
keepWeeks?: number;
|
|
123
|
+
keepMonths?: number;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface IPruneResult {
|
|
127
|
+
removedSnapshots: number;
|
|
128
|
+
removedPacks: number;
|
|
129
|
+
freedBytes: number;
|
|
130
|
+
dryRun: boolean;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface IRepairResult {
|
|
134
|
+
indexRebuilt: boolean;
|
|
135
|
+
indexedChunks: number;
|
|
136
|
+
staleLocksRemoved: number;
|
|
137
|
+
packsRepaired: number;
|
|
138
|
+
errors: string[];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface IUnlockOptions {
|
|
142
|
+
force?: boolean;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ==================== Events ====================
|
|
146
|
+
|
|
147
|
+
export interface IIngestProgress {
|
|
148
|
+
operation: string;
|
|
149
|
+
percentage: number;
|
|
150
|
+
message: string;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface IIngestComplete {
|
|
154
|
+
snapshotId: string;
|
|
155
|
+
originalSize: number;
|
|
156
|
+
storedSize: number;
|
|
157
|
+
newChunks: number;
|
|
158
|
+
reusedChunks: number;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// ==================== IPC Command Map ====================
|
|
162
|
+
|
|
163
|
+
export type TContainerArchiveCommands = {
|
|
164
|
+
init: ICommandDefinition<
|
|
165
|
+
{ path: string; passphrase?: string },
|
|
166
|
+
IRepositoryConfig
|
|
167
|
+
>;
|
|
168
|
+
open: ICommandDefinition<
|
|
169
|
+
{ path: string; passphrase?: string },
|
|
170
|
+
IRepositoryConfig
|
|
171
|
+
>;
|
|
172
|
+
close: ICommandDefinition<
|
|
173
|
+
Record<string, never>,
|
|
174
|
+
Record<string, never>
|
|
175
|
+
>;
|
|
176
|
+
ingest: ICommandDefinition<
|
|
177
|
+
{
|
|
178
|
+
socketPath: string;
|
|
179
|
+
tags?: Record<string, string>;
|
|
180
|
+
items?: IIngestItemOptions[];
|
|
181
|
+
},
|
|
182
|
+
{ snapshot: ISnapshot }
|
|
183
|
+
>;
|
|
184
|
+
ingestMulti: ICommandDefinition<
|
|
185
|
+
{
|
|
186
|
+
tags?: Record<string, string>;
|
|
187
|
+
items: Array<{ name: string; type: string; socketPath: string }>;
|
|
188
|
+
},
|
|
189
|
+
{ snapshot: ISnapshot }
|
|
190
|
+
>;
|
|
191
|
+
restore: ICommandDefinition<
|
|
192
|
+
{
|
|
193
|
+
snapshotId: string;
|
|
194
|
+
socketPath: string;
|
|
195
|
+
item?: string;
|
|
196
|
+
},
|
|
197
|
+
Record<string, never>
|
|
198
|
+
>;
|
|
199
|
+
listSnapshots: ICommandDefinition<
|
|
200
|
+
{ filter?: ISnapshotFilter },
|
|
201
|
+
{ snapshots: ISnapshot[] }
|
|
202
|
+
>;
|
|
203
|
+
getSnapshot: ICommandDefinition<
|
|
204
|
+
{ snapshotId: string },
|
|
205
|
+
{ snapshot: ISnapshot }
|
|
206
|
+
>;
|
|
207
|
+
verify: ICommandDefinition<
|
|
208
|
+
{ level: string },
|
|
209
|
+
IVerifyResult
|
|
210
|
+
>;
|
|
211
|
+
repair: ICommandDefinition<
|
|
212
|
+
Record<string, never>,
|
|
213
|
+
IRepairResult
|
|
214
|
+
>;
|
|
215
|
+
prune: ICommandDefinition<
|
|
216
|
+
{ retention: IRetentionPolicy; dryRun?: boolean },
|
|
217
|
+
IPruneResult
|
|
218
|
+
>;
|
|
219
|
+
reindex: ICommandDefinition<
|
|
220
|
+
Record<string, never>,
|
|
221
|
+
{ indexedChunks: number }
|
|
222
|
+
>;
|
|
223
|
+
unlock: ICommandDefinition<
|
|
224
|
+
{ force?: boolean },
|
|
225
|
+
{ removedLocks: number }
|
|
226
|
+
>;
|
|
227
|
+
};
|
package/ts/plugins.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// node native scope
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import * as fs from 'node:fs';
|
|
4
|
+
import * as net from 'node:net';
|
|
5
|
+
import * as os from 'node:os';
|
|
6
|
+
import * as stream from 'node:stream';
|
|
7
|
+
import * as crypto from 'node:crypto';
|
|
8
|
+
|
|
9
|
+
export { path, fs, net, os, stream, crypto };
|
|
10
|
+
|
|
11
|
+
// @push.rocks scope
|
|
12
|
+
import * as smartrust from '@push.rocks/smartrust';
|
|
13
|
+
import * as smartrx from '@push.rocks/smartrx';
|
|
14
|
+
import * as smartpromise from '@push.rocks/smartpromise';
|
|
15
|
+
import * as lik from '@push.rocks/lik';
|
|
16
|
+
|
|
17
|
+
export { smartrust, smartrx, smartpromise, lik };
|