@instantdb/platform 1.0.60 → 1.0.61
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/.turbo/turbo-build.log +9 -9
- package/__tests__/src/backupDownload.test.ts +193 -0
- package/__tests__/src/backups.test.ts +168 -0
- package/dist/commonjs/api.d.ts +7 -0
- package/dist/commonjs/api.d.ts.map +1 -1
- package/dist/commonjs/api.js +10 -0
- package/dist/commonjs/api.js.map +1 -1
- package/dist/commonjs/backupDownload.d.ts +74 -0
- package/dist/commonjs/backupDownload.d.ts.map +1 -0
- package/dist/commonjs/backupDownload.js +255 -0
- package/dist/commonjs/backupDownload.js.map +1 -0
- package/dist/commonjs/backups.d.ts +146 -0
- package/dist/commonjs/backups.d.ts.map +1 -0
- package/dist/commonjs/backups.js +248 -0
- package/dist/commonjs/backups.js.map +1 -0
- package/dist/commonjs/index.d.ts +2 -0
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +7 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/esm/api.d.ts +7 -0
- package/dist/esm/api.d.ts.map +1 -1
- package/dist/esm/api.js +10 -0
- package/dist/esm/api.js.map +1 -1
- package/dist/esm/backupDownload.d.ts +74 -0
- package/dist/esm/backupDownload.d.ts.map +1 -0
- package/dist/esm/backupDownload.js +252 -0
- package/dist/esm/backupDownload.js.map +1 -0
- package/dist/esm/backups.d.ts +146 -0
- package/dist/esm/backups.d.ts.map +1 -0
- package/dist/esm/backups.js +237 -0
- package/dist/esm/backups.js.map +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/standalone/index.js +1929 -1610
- package/dist/standalone/index.umd.cjs +24 -22
- package/package.json +4 -4
- package/src/api.ts +15 -0
- package/src/backupDownload.ts +364 -0
- package/src/backups.ts +342 -0
- package/src/index.ts +18 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BackupsManager = void 0;
|
|
7
|
+
exports.toAppBackup = toAppBackup;
|
|
8
|
+
exports.backupZipName = backupZipName;
|
|
9
|
+
exports.formatFileSize = formatFileSize;
|
|
10
|
+
exports.estimateZipSize = estimateZipSize;
|
|
11
|
+
const core_1 = require("@instantdb/core");
|
|
12
|
+
const version_ts_1 = __importDefault(require("./version.js"));
|
|
13
|
+
const backupDownload_ts_1 = require("./backupDownload.js");
|
|
14
|
+
/** Converts a backup row as the server sends it into an {@link AppBackup}. */
|
|
15
|
+
function toAppBackup(row) {
|
|
16
|
+
return {
|
|
17
|
+
id: row.id,
|
|
18
|
+
isn: row.isn,
|
|
19
|
+
backupAt: new Date(row.backup_at),
|
|
20
|
+
filesSize: row.files_size,
|
|
21
|
+
dbSize: row.db_size,
|
|
22
|
+
uncompressedSize: row.uncompressed_size,
|
|
23
|
+
description: row.description,
|
|
24
|
+
expiresAt: row.expires_at ? new Date(row.expires_at) : null,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/** Suggested filename for a backup archive. */
|
|
28
|
+
function backupZipName(backup) {
|
|
29
|
+
const safe = backup.backupAt.toISOString().replace(/[:.]/g, '-');
|
|
30
|
+
return `instant-backup-${safe}.zip`;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Formats a byte count the way macOS/Finder reports file sizes: decimal
|
|
34
|
+
* (1000-based) units with SI labels, so the number lines up with what lands
|
|
35
|
+
* on disk.
|
|
36
|
+
*/
|
|
37
|
+
function formatFileSize(n) {
|
|
38
|
+
if (n < 1000)
|
|
39
|
+
return `${n} B`;
|
|
40
|
+
const units = ['KB', 'MB', 'GB', 'TB'];
|
|
41
|
+
let i = -1;
|
|
42
|
+
let v = n;
|
|
43
|
+
do {
|
|
44
|
+
v /= 1000;
|
|
45
|
+
i++;
|
|
46
|
+
} while (v >= 1000 && i < units.length - 1);
|
|
47
|
+
let digits = v < 10 ? 2 : v < 100 ? 1 : 0;
|
|
48
|
+
// Rounding can cross a unit boundary (999,500 would read "1000 KB");
|
|
49
|
+
// promote to the next unit instead.
|
|
50
|
+
if (Number(v.toFixed(digits)) >= 1000 && i < units.length - 1) {
|
|
51
|
+
v /= 1000;
|
|
52
|
+
i++;
|
|
53
|
+
digits = 2;
|
|
54
|
+
}
|
|
55
|
+
return `${v.toFixed(digits)} ${units[i]}`;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Estimated size range for a backup's zip archive, or null when the backup
|
|
59
|
+
* row carries no sizes. Upper bound: everything stored uncompressed (STORE
|
|
60
|
+
* mode and/or files that don't compress). Lower bound: everything compressed
|
|
61
|
+
* at a ~4x DEFLATE ratio, best case for text/JSON, but storage files vary
|
|
62
|
+
* wildly (raw text compresses well, already-compressed images/videos don't).
|
|
63
|
+
* The same divisor applies to both since the file types aren't visible from
|
|
64
|
+
* here; the actual zip lands somewhere inside the range.
|
|
65
|
+
*/
|
|
66
|
+
function estimateZipSize(backup) {
|
|
67
|
+
const backupBytes = backup.uncompressedSize ?? backup.dbSize;
|
|
68
|
+
if (backupBytes == null || backup.filesSize == null)
|
|
69
|
+
return null;
|
|
70
|
+
const max = backupBytes + backup.filesSize;
|
|
71
|
+
return { min: Math.round(max / 4), max };
|
|
72
|
+
}
|
|
73
|
+
function authHeaders(token) {
|
|
74
|
+
return {
|
|
75
|
+
authorization: `Bearer ${token}`,
|
|
76
|
+
'Instant-Platform-Version': version_ts_1.default,
|
|
77
|
+
'Instant-Core-Version': core_1.version,
|
|
78
|
+
'X-Instant-Source': 'platform-sdk',
|
|
79
|
+
'X-Instant-Version': version_ts_1.default,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
async function apiError(res) {
|
|
83
|
+
const body = await res.text();
|
|
84
|
+
try {
|
|
85
|
+
return new core_1.InstantAPIError({ status: res.status, body: JSON.parse(body) });
|
|
86
|
+
}
|
|
87
|
+
catch (_e) {
|
|
88
|
+
return new core_1.InstantAPIError({
|
|
89
|
+
status: res.status,
|
|
90
|
+
body: { type: undefined, message: body },
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
async function* ndjsonLines(body) {
|
|
95
|
+
const reader = body.getReader();
|
|
96
|
+
try {
|
|
97
|
+
const decoder = new TextDecoder();
|
|
98
|
+
let buf = '';
|
|
99
|
+
while (true) {
|
|
100
|
+
const { done, value } = await reader.read();
|
|
101
|
+
if (done)
|
|
102
|
+
break;
|
|
103
|
+
buf += decoder.decode(value, { stream: true });
|
|
104
|
+
let nl = buf.indexOf('\n');
|
|
105
|
+
while (nl !== -1) {
|
|
106
|
+
const line = buf.slice(0, nl).trim();
|
|
107
|
+
buf = buf.slice(nl + 1);
|
|
108
|
+
if (line.length > 0) {
|
|
109
|
+
yield JSON.parse(line);
|
|
110
|
+
}
|
|
111
|
+
nl = buf.indexOf('\n');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const line = buf.trim();
|
|
115
|
+
if (line.length > 0) {
|
|
116
|
+
yield JSON.parse(line);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
finally {
|
|
120
|
+
// Also releases the connection when the consumer stops iterating early.
|
|
121
|
+
await reader.cancel().catch(() => { });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Read-only API for an app's backups.
|
|
126
|
+
*
|
|
127
|
+
* A backup archive has a canonical entry order that restore relies on:
|
|
128
|
+
* `config.json` first, then every `entities/<etype>.jsonl` shard, then the
|
|
129
|
+
* `files/<locationId>` storage blobs. In particular ALL entity files must
|
|
130
|
+
* come before ANY storage file, so a restore can process the archive in a
|
|
131
|
+
* single streaming pass: `config.json` sets up the schema, the `$files`
|
|
132
|
+
* entities register file metadata, and only then can each blob be matched
|
|
133
|
+
* to its entity. {@link downloadArchive} implements that order end to end;
|
|
134
|
+
* {@link listFiles} (which returns the entity files already in write order)
|
|
135
|
+
* and {@link streamStorageFiles} are the pieces for building a custom
|
|
136
|
+
* pipeline.
|
|
137
|
+
*/
|
|
138
|
+
class BackupsManager {
|
|
139
|
+
#appId;
|
|
140
|
+
#apiURI;
|
|
141
|
+
#withAuth;
|
|
142
|
+
constructor(opts) {
|
|
143
|
+
this.#appId = opts.appId;
|
|
144
|
+
this.#apiURI = opts.apiURI;
|
|
145
|
+
this.#withAuth = opts.withAuth;
|
|
146
|
+
}
|
|
147
|
+
#getJson(path, signal) {
|
|
148
|
+
return this.#withAuth(async (token) => {
|
|
149
|
+
const res = await fetch(`${this.#apiURI}${path}`, {
|
|
150
|
+
headers: authHeaders(token),
|
|
151
|
+
signal,
|
|
152
|
+
});
|
|
153
|
+
if (res.status !== 200) {
|
|
154
|
+
throw await apiError(res);
|
|
155
|
+
}
|
|
156
|
+
return res.json();
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Returns the app's downloadable (non-expired) backups, newest first.
|
|
161
|
+
*/
|
|
162
|
+
async list(opts) {
|
|
163
|
+
const res = await this.#getJson(`/dash/apps/${this.#appId}/backups`, opts?.signal);
|
|
164
|
+
return (res.backups || []).map(toAppBackup);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Returns the backup's entity files (`config.json` and the
|
|
168
|
+
* `entities/<etype>.jsonl` shards) in archive write order. Storage blobs
|
|
169
|
+
* are not included; discover those with {@link streamStorageFiles}.
|
|
170
|
+
*/
|
|
171
|
+
async listFiles(backupId, opts) {
|
|
172
|
+
const res = await this.#getJson(`/dash/apps/${this.#appId}/backups/${backupId}/files`, opts?.signal);
|
|
173
|
+
return (res.files || []);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Returns a presigned download URL for one of the backup's entity files.
|
|
177
|
+
* The URL expires after 1 hour, so fetch it right before downloading.
|
|
178
|
+
*
|
|
179
|
+
* The entity files are stored zstd-compressed (the response carries
|
|
180
|
+
* `Content-Encoding: zstd`); decompress to get the raw JSON/JSONL.
|
|
181
|
+
*/
|
|
182
|
+
async getFileUrl(backupId, name, opts) {
|
|
183
|
+
const res = await this.#getJson(`/dash/apps/${this.#appId}/backups/${backupId}/file-url?name=${encodeURIComponent(name)}`, opts?.signal);
|
|
184
|
+
return res.url;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Streams every storage file captured in the backup, each with a presigned
|
|
188
|
+
* download URL. Completes without yielding anything when the app has no
|
|
189
|
+
* storage files.
|
|
190
|
+
*
|
|
191
|
+
* The server ends a healthy stream with a terminal sentinel; if the stream
|
|
192
|
+
* closes without it (a server-side failure truncated the listing), this
|
|
193
|
+
* throws instead of silently under-reporting files.
|
|
194
|
+
*/
|
|
195
|
+
async *streamStorageFiles(backupId, opts) {
|
|
196
|
+
const res = await this.#withAuth(async (token) => {
|
|
197
|
+
const res = await fetch(`${this.#apiURI}/dash/apps/${this.#appId}/backups/${backupId}/storage-files`, { headers: authHeaders(token), signal: opts?.signal });
|
|
198
|
+
if (res.status !== 200) {
|
|
199
|
+
throw await apiError(res);
|
|
200
|
+
}
|
|
201
|
+
return res;
|
|
202
|
+
});
|
|
203
|
+
if (!res.body) {
|
|
204
|
+
throw new Error('Storage file listing returned no body.');
|
|
205
|
+
}
|
|
206
|
+
let complete = false;
|
|
207
|
+
for await (const line of ndjsonLines(res.body)) {
|
|
208
|
+
if (line.done === true) {
|
|
209
|
+
complete = true;
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
// A file record always carries a locationId and url; anything else is
|
|
213
|
+
// corruption, and skipping it would silently omit a file from the
|
|
214
|
+
// archive.
|
|
215
|
+
if (typeof line.locationId !== 'string' ||
|
|
216
|
+
line.locationId.length === 0 ||
|
|
217
|
+
// The locationId becomes the archive entry path `files/<locationId>`;
|
|
218
|
+
// reject separators and control characters that could escape it.
|
|
219
|
+
/[/\\\u0000-\u001f\u007f]/.test(line.locationId) ||
|
|
220
|
+
line.locationId === '.' ||
|
|
221
|
+
line.locationId === '..' ||
|
|
222
|
+
typeof line.url !== 'string' ||
|
|
223
|
+
line.url.length === 0) {
|
|
224
|
+
throw new Error('Storage file listing returned a malformed record. Please retry the download.');
|
|
225
|
+
}
|
|
226
|
+
yield {
|
|
227
|
+
locationId: line.locationId,
|
|
228
|
+
path: line.path ?? null,
|
|
229
|
+
url: line.url,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
if (!complete) {
|
|
233
|
+
throw new Error('Storage file listing ended before it finished. Please retry the download.');
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Downloads the backup into a single zip archive written to `opts.sink`,
|
|
238
|
+
* entries in the canonical restore order described above. The caller
|
|
239
|
+
* supplies the runtime-specific pieces — how to fetch a presigned URL,
|
|
240
|
+
* where the bytes go, and the archive encoder (e.g. zip.js's `ZipWriter`);
|
|
241
|
+
* see {@link DownloadBackupArchiveOpts}.
|
|
242
|
+
*/
|
|
243
|
+
downloadArchive(opts) {
|
|
244
|
+
return (0, backupDownload_ts_1.downloadBackupArchive)({ manager: this, ...opts });
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
exports.BackupsManager = BackupsManager;
|
|
248
|
+
//# sourceMappingURL=backups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backups.js","sourceRoot":"","sources":["../../src/backups.ts"],"names":[],"mappings":";;;;;;AAmEA,kCAWC;AAGD,sCAGC;AAOD,wCAkBC;AAWD,0CAOC;AA/HD,0CAA0E;AAE1E,8DAAmC;AACnC,2DAI6B;AA2D7B,8EAA8E;AAC9E,SAAgB,WAAW,CAAC,GAAsB;IAChD,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,QAAQ,EAAE,IA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M,IAAI,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/C,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;gBACvB,QAAQ,GAAG,IAAI,CAAC;gBAChB,MAAM;YACR,CAAC;YACD,sEAAsE;YACtE,kEAAkE;YAClE,WAAW;YACX,IACE,OAAO,IAAI,CAAC,UAAU,KAAK,QAAQ;gBACnC,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;gBAC5B,sEAAsE;gBACtE,iEAAiE;gBACjE,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;gBAChD,IAAI,CAAC,UAAU,KAAK,GAAG;gBACvB,IAAI,CAAC,UAAU,KAAK,IAAI;gBACxB,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ;gBAC5B,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC,EACrB,CAAC;gBACD,MAAM,IAAI,KAAK,CACb,8EAA8E,CAC/E,CAAC;YACJ,CAAC;YACD,MAAM;gBACJ,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI;gBACvB,GAAG,EAAE,IAAI,CAAC,GAAG;aACd,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CACb,2EAA2E,CAC5E,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,eAAe,CACb,IAA+B;QAE/B,OAAO,IAAA,yCAAqB,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;CACF;AAjJD,wCAiJC","sourcesContent":["import { InstantAPIError, version as coreVersion } from '@instantdb/core';\nimport type { WithAuth } from '@instantdb/webhooks';\nimport version from './version.ts';\nimport {\n downloadBackupArchive,\n type BackupDownloadResult,\n type DownloadBackupArchiveOpts,\n} from './backupDownload.ts';\n\n/** A point-in-time snapshot of an app. */\nexport type AppBackup = {\n /** Unique identifier for the backup. */\n id: string;\n /** Instant sequence number the snapshot was taken at. */\n isn: string;\n /** When the snapshot was taken. */\n backupAt: Date;\n /** Total size in bytes of the app's storage files at backup time, if known. */\n filesSize: number | null;\n /** Size in bytes of the app's database at backup time, if known. */\n dbSize: number | null;\n /**\n * Total uncompressed size in bytes of the backup's entity files (what they\n * take up unpacked on disk), if known.\n */\n uncompressedSize: number | null;\n /** Human-readable label, e.g. \"Automated Daily Snapshot\". */\n description: string | null;\n /** When the backup stops being available for download. */\n expiresAt: Date | null;\n};\n\n/**\n * A file that makes up the backup payload: `config.json` or an\n * `entities/<etype>.jsonl` shard.\n */\nexport type AppBackupFile = {\n name: string;\n /** Size in bytes as stored (the entity shards are stored compressed). */\n size: number;\n};\n\n/** A storage file captured in a backup, with a presigned download URL. */\nexport type AppBackupStorageFile = {\n /**\n * Stable id of the file's blob. A backup archive stores the blob at\n * `files/<locationId>`.\n */\n locationId: string;\n /** The path the user uploaded the file to. */\n path: string | null;\n /** Presigned URL for the file's contents. Expires after 12 hours. */\n url: string;\n};\n\ntype AppBackupResponse = {\n id: string;\n isn: string;\n backup_at: string;\n files_size: number | null;\n db_size: number | null;\n uncompressed_size: number | null;\n description: string | null;\n expires_at: string | null;\n};\n\n/** Converts a backup row as the server sends it into an {@link AppBackup}. */\nexport function toAppBackup(row: AppBackupResponse): AppBackup {\n return {\n id: row.id,\n isn: row.isn,\n backupAt: new Date(row.backup_at),\n filesSize: row.files_size,\n dbSize: row.db_size,\n uncompressedSize: row.uncompressed_size,\n description: row.description,\n expiresAt: row.expires_at ? new Date(row.expires_at) : null,\n };\n}\n\n/** Suggested filename for a backup archive. */\nexport function backupZipName(backup: AppBackup): string {\n const safe = backup.backupAt.toISOString().replace(/[:.]/g, '-');\n return `instant-backup-${safe}.zip`;\n}\n\n/**\n * Formats a byte count the way macOS/Finder reports file sizes: decimal\n * (1000-based) units with SI labels, so the number lines up with what lands\n * on disk.\n */\nexport function formatFileSize(n: number): string {\n if (n < 1000) return `${n} B`;\n const units = ['KB', 'MB', 'GB', 'TB'];\n let i = -1;\n let v = n;\n do {\n v /= 1000;\n i++;\n } while (v >= 1000 && i < units.length - 1);\n let digits = v < 10 ? 2 : v < 100 ? 1 : 0;\n // Rounding can cross a unit boundary (999,500 would read \"1000 KB\");\n // promote to the next unit instead.\n if (Number(v.toFixed(digits)) >= 1000 && i < units.length - 1) {\n v /= 1000;\n i++;\n digits = 2;\n }\n return `${v.toFixed(digits)} ${units[i]}`;\n}\n\n/**\n * Estimated size range for a backup's zip archive, or null when the backup\n * row carries no sizes. Upper bound: everything stored uncompressed (STORE\n * mode and/or files that don't compress). Lower bound: everything compressed\n * at a ~4x DEFLATE ratio, best case for text/JSON, but storage files vary\n * wildly (raw text compresses well, already-compressed images/videos don't).\n * The same divisor applies to both since the file types aren't visible from\n * here; the actual zip lands somewhere inside the range.\n */\nexport function estimateZipSize(\n backup: AppBackup,\n): { min: number; max: number } | null {\n const backupBytes = backup.uncompressedSize ?? backup.dbSize;\n if (backupBytes == null || backup.filesSize == null) return null;\n const max = backupBytes + backup.filesSize;\n return { min: Math.round(max / 4), max };\n}\n\nfunction authHeaders(token: string): Record<string, string> {\n return {\n authorization: `Bearer ${token}`,\n 'Instant-Platform-Version': version,\n 'Instant-Core-Version': coreVersion,\n 'X-Instant-Source': 'platform-sdk',\n 'X-Instant-Version': version,\n };\n}\n\nasync function apiError(res: Response): Promise<InstantAPIError> {\n const body = await res.text();\n try {\n return new InstantAPIError({ status: res.status, body: JSON.parse(body) });\n } catch (_e) {\n return new InstantAPIError({\n status: res.status,\n body: { type: undefined, message: body },\n });\n }\n}\n\nasync function* ndjsonLines(\n body: ReadableStream<Uint8Array>,\n): AsyncGenerator<any, void, void> {\n const reader = body.getReader();\n try {\n const decoder = new TextDecoder();\n let buf = '';\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n buf += decoder.decode(value, { stream: true });\n let nl = buf.indexOf('\\n');\n while (nl !== -1) {\n const line = buf.slice(0, nl).trim();\n buf = buf.slice(nl + 1);\n if (line.length > 0) {\n yield JSON.parse(line);\n }\n nl = buf.indexOf('\\n');\n }\n }\n const line = buf.trim();\n if (line.length > 0) {\n yield JSON.parse(line);\n }\n } finally {\n // Also releases the connection when the consumer stops iterating early.\n await reader.cancel().catch(() => {});\n }\n}\n\n/**\n * Read-only API for an app's backups.\n *\n * A backup archive has a canonical entry order that restore relies on:\n * `config.json` first, then every `entities/<etype>.jsonl` shard, then the\n * `files/<locationId>` storage blobs. In particular ALL entity files must\n * come before ANY storage file, so a restore can process the archive in a\n * single streaming pass: `config.json` sets up the schema, the `$files`\n * entities register file metadata, and only then can each blob be matched\n * to its entity. {@link downloadArchive} implements that order end to end;\n * {@link listFiles} (which returns the entity files already in write order)\n * and {@link streamStorageFiles} are the pieces for building a custom\n * pipeline.\n */\nexport class BackupsManager {\n #appId: string;\n #apiURI: string;\n #withAuth: WithAuth;\n\n constructor(opts: { appId: string; apiURI: string; withAuth: WithAuth }) {\n this.#appId = opts.appId;\n this.#apiURI = opts.apiURI;\n this.#withAuth = opts.withAuth;\n }\n\n #getJson(path: string, signal?: AbortSignal): Promise<any> {\n return this.#withAuth(async (token) => {\n const res = await fetch(`${this.#apiURI}${path}`, {\n headers: authHeaders(token),\n signal,\n });\n if (res.status !== 200) {\n throw await apiError(res);\n }\n return res.json();\n });\n }\n\n /**\n * Returns the app's downloadable (non-expired) backups, newest first.\n */\n async list(opts?: { signal?: AbortSignal }): Promise<AppBackup[]> {\n const res = await this.#getJson(\n `/dash/apps/${this.#appId}/backups`,\n opts?.signal,\n );\n return ((res.backups || []) as AppBackupResponse[]).map(toAppBackup);\n }\n\n /**\n * Returns the backup's entity files (`config.json` and the\n * `entities/<etype>.jsonl` shards) in archive write order. Storage blobs\n * are not included; discover those with {@link streamStorageFiles}.\n */\n async listFiles(\n backupId: string,\n opts?: { signal?: AbortSignal },\n ): Promise<AppBackupFile[]> {\n const res = await this.#getJson(\n `/dash/apps/${this.#appId}/backups/${backupId}/files`,\n opts?.signal,\n );\n return (res.files || []) as AppBackupFile[];\n }\n\n /**\n * Returns a presigned download URL for one of the backup's entity files.\n * The URL expires after 1 hour, so fetch it right before downloading.\n *\n * The entity files are stored zstd-compressed (the response carries\n * `Content-Encoding: zstd`); decompress to get the raw JSON/JSONL.\n */\n async getFileUrl(\n backupId: string,\n name: string,\n opts?: { signal?: AbortSignal },\n ): Promise<string> {\n const res = await this.#getJson(\n `/dash/apps/${this.#appId}/backups/${backupId}/file-url?name=${encodeURIComponent(name)}`,\n opts?.signal,\n );\n return res.url as string;\n }\n\n /**\n * Streams every storage file captured in the backup, each with a presigned\n * download URL. Completes without yielding anything when the app has no\n * storage files.\n *\n * The server ends a healthy stream with a terminal sentinel; if the stream\n * closes without it (a server-side failure truncated the listing), this\n * throws instead of silently under-reporting files.\n */\n async *streamStorageFiles(\n backupId: string,\n opts?: { signal?: AbortSignal },\n ): AsyncGenerator<AppBackupStorageFile, void, void> {\n const res = await this.#withAuth(async (token) => {\n const res = await fetch(\n `${this.#apiURI}/dash/apps/${this.#appId}/backups/${backupId}/storage-files`,\n { headers: authHeaders(token), signal: opts?.signal },\n );\n if (res.status !== 200) {\n throw await apiError(res);\n }\n return res;\n });\n if (!res.body) {\n throw new Error('Storage file listing returned no body.');\n }\n let complete = false;\n for await (const line of ndjsonLines(res.body)) {\n if (line.done === true) {\n complete = true;\n break;\n }\n // A file record always carries a locationId and url; anything else is\n // corruption, and skipping it would silently omit a file from the\n // archive.\n if (\n typeof line.locationId !== 'string' ||\n line.locationId.length === 0 ||\n // The locationId becomes the archive entry path `files/<locationId>`;\n // reject separators and control characters that could escape it.\n /[/\\\\\\u0000-\\u001f\\u007f]/.test(line.locationId) ||\n line.locationId === '.' ||\n line.locationId === '..' ||\n typeof line.url !== 'string' ||\n line.url.length === 0\n ) {\n throw new Error(\n 'Storage file listing returned a malformed record. Please retry the download.',\n );\n }\n yield {\n locationId: line.locationId,\n path: line.path ?? null,\n url: line.url,\n };\n }\n if (!complete) {\n throw new Error(\n 'Storage file listing ended before it finished. Please retry the download.',\n );\n }\n }\n\n /**\n * Downloads the backup into a single zip archive written to `opts.sink`,\n * entries in the canonical restore order described above. The caller\n * supplies the runtime-specific pieces — how to fetch a presigned URL,\n * where the bytes go, and the archive encoder (e.g. zip.js's `ZipWriter`);\n * see {@link DownloadBackupArchiveOpts}.\n */\n downloadArchive(\n opts: DownloadBackupArchiveOpts,\n ): Promise<BackupDownloadResult> {\n return downloadBackupArchive({ manager: this, ...opts });\n }\n}\n"]}
|
package/dist/commonjs/index.d.ts
CHANGED
|
@@ -12,5 +12,7 @@ import { clerkDomainFromPublishableKey } from './clerk.ts';
|
|
|
12
12
|
import { Webhooks, type WebhookAction, type WebhookStatus, type WebhookEventStatus, type WebhookInfo, type WebhookAttempt, type WebhookEventInfo, type WebhookEventsPage, type WebhookBody, type WebhookEntity, type WebhookPayload, type WebhookPayloadRecord, type WebhookPayloadRecordFor, type WebhookHandlerFn, type WebhookHandlers, type WebhookHelpers, type CreateWebhookParams, type UpdateWebhookParams, WebhooksManager } from '@instantdb/webhooks';
|
|
13
13
|
export { type InstantAPIPlatformSchema, type InstantDBOAuthAccessToken, type OAuthHandlerConfig, type OAuthScope, type InstantRules, type InstantRouteHandlerPayloadByType, type InstantRouteHandlerType, type InstantRouteHandlerBody, OAuthHandler, InstantOAuthError, generateSchemaTypescriptFile, collectSystemCatalogIdentNames, validateSchema, SchemaValidationError, generatePermsTypescriptFile, permsTypescriptFileToCode, apiSchemaToInstantSchemaDef, schemaTypescriptFileToInstantSchema, version, translatePlanSteps, PlatformApi, ProgressPromise, exchangeCodeForToken, exchangeRefreshToken, clerkDomainFromPublishableKey, i, Webhooks, WebhooksManager, type WebhookAction, type WebhookStatus, type WebhookEventStatus, type WebhookInfo, type WebhookAttempt, type WebhookEventInfo, type WebhookEventsPage, type WebhookBody, type WebhookEntity, type WebhookPayload, type WebhookPayloadRecord, type WebhookPayloadRecordFor, type WebhookHandlerFn, type WebhookHandlers, type WebhookHelpers, type CreateWebhookParams, type UpdateWebhookParams, };
|
|
14
14
|
export { diffSchemas, convertTxSteps, isRenamePromptItem, buildAutoRenameSelector, type RenameResolveFn, type MigrationTx, type MigrationTxSpecific, type MigrationTxTypes, type Identifier, } from './migrations.ts';
|
|
15
|
+
export { BackupsManager, backupZipName, estimateZipSize, formatFileSize, toAppBackup, type AppBackup, type AppBackupFile, type AppBackupStorageFile, } from './backups.ts';
|
|
16
|
+
export { type DownloadBackupArchiveOpts, type BackupArchiveWriter, type BackupDownloadProgress, type BackupDownloadResult, } from './backupDownload.ts';
|
|
15
17
|
export { DEFAULT_OAUTH_CALLBACK_URL, oauthCallbackURL, GOOGLE_AUTHORIZATION_ENDPOINT, GOOGLE_DISCOVERY_ENDPOINT, GOOGLE_TOKEN_ENDPOINT, APPLE_AUTHORIZATION_ENDPOINT, APPLE_DISCOVERY_ENDPOINT, APPLE_TOKEN_ENDPOINT, LINKEDIN_AUTHORIZATION_ENDPOINT, LINKEDIN_DISCOVERY_ENDPOINT, LINKEDIN_TOKEN_ENDPOINT, } from './consts.ts';
|
|
16
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,YAAY,EACb,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,wBAAwB,EAC7B,4BAA4B,EAC5B,8BAA8B,EAC9B,cAAc,EACd,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,2BAA2B,EA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6B,EAC7B,CAAC,EACD,QAAQ,EACR,eAAe,EACf,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB,CAAC;AAEF,OAAO,EACL,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,UAAU,GAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,6BAA6B,EAC7B,yBAAyB,EACzB,qBAAqB,EACrB,4BAA4B,EAC5B,wBAAwB,EACxB,oBAAoB,EACpB,+BAA+B,EAC/B,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,YAAY,EACb,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,wBAAwB,EAC7B,4BAA4B,EAC5B,8BAA8B,EAC9B,cAAc,EACd,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,2BAA2B,EAC3B,WAAW,EACX,kBAAkB,EACnB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EACR,eAAe,EACf,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB,CAAC;AAEF,OAAO,EACL,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,UAAU,GAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,cAAc,EACd,aAAa,EACb,eAAe,EACf,cAAc,EACd,WAAW,EACX,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,oBAAoB,GAC1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,GAC1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,6BAA6B,EAC7B,yBAAyB,EACzB,qBAAqB,EACrB,4BAA4B,EAC5B,wBAAwB,EACxB,oBAAoB,EACpB,+BAA+B,EAC/B,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,aAAa,CAAC"}
|
package/dist/commonjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.LINKEDIN_TOKEN_ENDPOINT = exports.LINKEDIN_DISCOVERY_ENDPOINT = exports.LINKEDIN_AUTHORIZATION_ENDPOINT = exports.APPLE_TOKEN_ENDPOINT = exports.APPLE_DISCOVERY_ENDPOINT = exports.APPLE_AUTHORIZATION_ENDPOINT = exports.GOOGLE_TOKEN_ENDPOINT = exports.GOOGLE_DISCOVERY_ENDPOINT = exports.GOOGLE_AUTHORIZATION_ENDPOINT = exports.oauthCallbackURL = exports.DEFAULT_OAUTH_CALLBACK_URL = exports.buildAutoRenameSelector = exports.isRenamePromptItem = exports.convertTxSteps = exports.diffSchemas = exports.WebhooksManager = exports.Webhooks = exports.i = exports.clerkDomainFromPublishableKey = exports.exchangeRefreshToken = exports.exchangeCodeForToken = exports.ProgressPromise = exports.PlatformApi = exports.translatePlanSteps = exports.version = exports.schemaTypescriptFileToInstantSchema = exports.apiSchemaToInstantSchemaDef = exports.permsTypescriptFileToCode = exports.generatePermsTypescriptFile = exports.SchemaValidationError = exports.validateSchema = exports.collectSystemCatalogIdentNames = exports.generateSchemaTypescriptFile = exports.InstantOAuthError = exports.OAuthHandler = void 0;
|
|
6
|
+
exports.LINKEDIN_TOKEN_ENDPOINT = exports.LINKEDIN_DISCOVERY_ENDPOINT = exports.LINKEDIN_AUTHORIZATION_ENDPOINT = exports.APPLE_TOKEN_ENDPOINT = exports.APPLE_DISCOVERY_ENDPOINT = exports.APPLE_AUTHORIZATION_ENDPOINT = exports.GOOGLE_TOKEN_ENDPOINT = exports.GOOGLE_DISCOVERY_ENDPOINT = exports.GOOGLE_AUTHORIZATION_ENDPOINT = exports.oauthCallbackURL = exports.DEFAULT_OAUTH_CALLBACK_URL = exports.toAppBackup = exports.formatFileSize = exports.estimateZipSize = exports.backupZipName = exports.BackupsManager = exports.buildAutoRenameSelector = exports.isRenamePromptItem = exports.convertTxSteps = exports.diffSchemas = exports.WebhooksManager = exports.Webhooks = exports.i = exports.clerkDomainFromPublishableKey = exports.exchangeRefreshToken = exports.exchangeCodeForToken = exports.ProgressPromise = exports.PlatformApi = exports.translatePlanSteps = exports.version = exports.schemaTypescriptFileToInstantSchema = exports.apiSchemaToInstantSchemaDef = exports.permsTypescriptFileToCode = exports.generatePermsTypescriptFile = exports.SchemaValidationError = exports.validateSchema = exports.collectSystemCatalogIdentNames = exports.generateSchemaTypescriptFile = exports.InstantOAuthError = exports.OAuthHandler = void 0;
|
|
7
7
|
const oauthCommon_ts_1 = require("./oauthCommon.js");
|
|
8
8
|
Object.defineProperty(exports, "InstantOAuthError", { enumerable: true, get: function () { return oauthCommon_ts_1.InstantOAuthError; } });
|
|
9
9
|
const oauth_ts_1 = require("./oauth.js");
|
|
@@ -41,6 +41,12 @@ Object.defineProperty(exports, "diffSchemas", { enumerable: true, get: function
|
|
|
41
41
|
Object.defineProperty(exports, "convertTxSteps", { enumerable: true, get: function () { return migrations_ts_1.convertTxSteps; } });
|
|
42
42
|
Object.defineProperty(exports, "isRenamePromptItem", { enumerable: true, get: function () { return migrations_ts_1.isRenamePromptItem; } });
|
|
43
43
|
Object.defineProperty(exports, "buildAutoRenameSelector", { enumerable: true, get: function () { return migrations_ts_1.buildAutoRenameSelector; } });
|
|
44
|
+
var backups_ts_1 = require("./backups.js");
|
|
45
|
+
Object.defineProperty(exports, "BackupsManager", { enumerable: true, get: function () { return backups_ts_1.BackupsManager; } });
|
|
46
|
+
Object.defineProperty(exports, "backupZipName", { enumerable: true, get: function () { return backups_ts_1.backupZipName; } });
|
|
47
|
+
Object.defineProperty(exports, "estimateZipSize", { enumerable: true, get: function () { return backups_ts_1.estimateZipSize; } });
|
|
48
|
+
Object.defineProperty(exports, "formatFileSize", { enumerable: true, get: function () { return backups_ts_1.formatFileSize; } });
|
|
49
|
+
Object.defineProperty(exports, "toAppBackup", { enumerable: true, get: function () { return backups_ts_1.toAppBackup; } });
|
|
44
50
|
var consts_ts_1 = require("./consts.js");
|
|
45
51
|
Object.defineProperty(exports, "DEFAULT_OAUTH_CALLBACK_URL", { enumerable: true, get: function () { return consts_ts_1.DEFAULT_OAUTH_CALLBACK_URL; } });
|
|
46
52
|
Object.defineProperty(exports, "oauthCallbackURL", { enumerable: true, get: function () { return consts_ts_1.oauthCallbackURL; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,qDAAsE;AAmEpE,kGAnEO,kCAAiB,OAmEP;AAlEnB,yCAIoB;AA6DlB,6FA9DA,uBAAY,OA8DA;AA5Dd,yCAGoB;AA+DlB,4GAjEA,sCAA2B,OAiEA;AAC3B,0GAjEA,oCAAyB,OAiEA;AA/D3B,2CAMqB;AAoDnB,6GAxDA,wCAA4B,OAwDA;AAC5B,+GAxDA,0CAA8B,OAwDA;AAC9B,+FAxDA,0BAAc,OAwDA;AACd,sGAxDA,iCAAqB,OAwDA;AAtDvB,qCAIkB;AAqDhB,4GAxDA,oCAA2B,OAwDA;AAI3B,4FA3DA,oBAAW,OA2DA;AADX,mGAzDA,2BAAkB,OAyDA;AAvDpB,iEAA6E;AAqD3E,oHArDO,0DAAmC,OAqDP;AAnDrC,8DAAmC;AAoDjC,kBApDK,oBAAO,CAoDL;AAnDT,6DAAuD;AAsDrD,gGAtDO,oCAAe,OAsDP;AArDjB,0CAMyB;AAmDvB,kFAxDA,QAAC,OAwDA;AAlDH,qDAA8E;AA+C5E,qGA/CO,qCAAoB,OA+CP;AACpB,qGAhD6B,qCAAoB,OAgD7B;AA/CtB,yCAA2D;AAgDzD,8GAhDO,wCAA6B,OAgDP;AA/C/B,kDAoB6B;AA6B3B,yFAhDA,mBAAQ,OAgDA;AACR,gGA/BA,0BAAe,OA+BA;AAoBjB,iDAUyB;AATvB,4GAAA,WAAW,OAAA;AACX,+GAAA,cAAc,OAAA;AACd,mHAAA,kBAAkB,OAAA;AAClB,wHAAA,uBAAuB,OAAA;AAQzB,yCAYqB;AAXnB,uHAAA,0BAA0B,OAAA;AAC1B,6GAAA,gBAAgB,OAAA;AAChB,0HAAA,6BAA6B,OAAA;AAC7B,sHAAA,yBAAyB,OAAA;AACzB,kHAAA,qBAAqB,OAAA;AACrB,yHAAA,4BAA4B,OAAA;AAC5B,qHAAA,wBAAwB,OAAA;AACxB,iHAAA,oBAAoB,OAAA;AACpB,4HAAA,+BAA+B,OAAA;AAC/B,wHAAA,2BAA2B,OAAA;AAC3B,oHAAA,uBAAuB,OAAA","sourcesContent":["import { InstantOAuthError, type OAuthScope } from './oauthCommon.ts';\nimport {\n type InstantDBOAuthAccessToken,\n type OAuthHandlerConfig,\n OAuthHandler,\n} from './oauth.ts';\nimport {\n generatePermsTypescriptFile,\n permsTypescriptFileToCode,\n} from './perms.ts';\nimport {\n type InstantAPIPlatformSchema,\n generateSchemaTypescriptFile,\n collectSystemCatalogIdentNames,\n validateSchema,\n SchemaValidationError,\n} from './schema.ts';\nimport {\n apiSchemaToInstantSchemaDef,\n PlatformApi,\n translatePlanSteps,\n} from './api.ts';\nimport { schemaTypescriptFileToInstantSchema } from './typescript-schema.ts';\n\nimport version from './version.ts';\nimport { ProgressPromise } from './ProgressPromise.ts';\nimport {\n i,\n type InstantRules,\n type InstantRouteHandlerPayloadByType,\n type InstantRouteHandlerType,\n type InstantRouteHandlerBody,\n} from '@instantdb/core';\nimport { exchangeCodeForToken, exchangeRefreshToken } from './serverOAuth.ts';\nimport { clerkDomainFromPublishableKey } from './clerk.ts';\nimport {\n Webhooks,\n type WebhookAction,\n type WebhookStatus,\n type WebhookEventStatus,\n type WebhookInfo,\n type WebhookAttempt,\n type WebhookEventInfo,\n type WebhookEventsPage,\n type WebhookBody,\n type WebhookEntity,\n type WebhookPayload,\n type WebhookPayloadRecord,\n type WebhookPayloadRecordFor,\n type WebhookHandlerFn,\n type WebhookHandlers,\n type WebhookHelpers,\n type CreateWebhookParams,\n type UpdateWebhookParams,\n WebhooksManager,\n} from '@instantdb/webhooks';\n\nexport {\n type InstantAPIPlatformSchema,\n type InstantDBOAuthAccessToken,\n type OAuthHandlerConfig,\n type OAuthScope,\n type InstantRules,\n type InstantRouteHandlerPayloadByType,\n type InstantRouteHandlerType,\n type InstantRouteHandlerBody,\n OAuthHandler,\n InstantOAuthError,\n generateSchemaTypescriptFile,\n collectSystemCatalogIdentNames,\n validateSchema,\n SchemaValidationError,\n generatePermsTypescriptFile,\n permsTypescriptFileToCode,\n apiSchemaToInstantSchemaDef,\n schemaTypescriptFileToInstantSchema,\n version,\n translatePlanSteps,\n PlatformApi,\n ProgressPromise,\n exchangeCodeForToken,\n exchangeRefreshToken,\n clerkDomainFromPublishableKey,\n i,\n Webhooks,\n WebhooksManager,\n type WebhookAction,\n type WebhookStatus,\n type WebhookEventStatus,\n type WebhookInfo,\n type WebhookAttempt,\n type WebhookEventInfo,\n type WebhookEventsPage,\n type WebhookBody,\n type WebhookEntity,\n type WebhookPayload,\n type WebhookPayloadRecord,\n type WebhookPayloadRecordFor,\n type WebhookHandlerFn,\n type WebhookHandlers,\n type WebhookHelpers,\n type CreateWebhookParams,\n type UpdateWebhookParams,\n};\n\nexport {\n diffSchemas,\n convertTxSteps,\n isRenamePromptItem,\n buildAutoRenameSelector,\n type RenameResolveFn,\n type MigrationTx,\n type MigrationTxSpecific,\n type MigrationTxTypes,\n type Identifier,\n} from './migrations.ts';\n\nexport {\n DEFAULT_OAUTH_CALLBACK_URL,\n oauthCallbackURL,\n GOOGLE_AUTHORIZATION_ENDPOINT,\n GOOGLE_DISCOVERY_ENDPOINT,\n GOOGLE_TOKEN_ENDPOINT,\n APPLE_AUTHORIZATION_ENDPOINT,\n APPLE_DISCOVERY_ENDPOINT,\n APPLE_TOKEN_ENDPOINT,\n LINKEDIN_AUTHORIZATION_ENDPOINT,\n LINKEDIN_DISCOVERY_ENDPOINT,\n LINKEDIN_TOKEN_ENDPOINT,\n} from './consts.ts';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,qDAAsE;AAmEpE,kGAnEO,kCAAiB,OAmEP;AAlEnB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;AACxB,iHAAA,oBAAoB,OAAA;AACpB,4HAAA,+BAA+B,OAAA;AAC/B,wHAAA,2BAA2B,OAAA;AAC3B,oHAAA,uBAAuB,OAAA","sourcesContent":["import { InstantOAuthError, type OAuthScope } from './oauthCommon.ts';\nimport {\n type InstantDBOAuthAccessToken,\n type OAuthHandlerConfig,\n OAuthHandler,\n} from './oauth.ts';\nimport {\n generatePermsTypescriptFile,\n permsTypescriptFileToCode,\n} from './perms.ts';\nimport {\n type InstantAPIPlatformSchema,\n generateSchemaTypescriptFile,\n collectSystemCatalogIdentNames,\n validateSchema,\n SchemaValidationError,\n} from './schema.ts';\nimport {\n apiSchemaToInstantSchemaDef,\n PlatformApi,\n translatePlanSteps,\n} from './api.ts';\nimport { schemaTypescriptFileToInstantSchema } from './typescript-schema.ts';\n\nimport version from './version.ts';\nimport { ProgressPromise } from './ProgressPromise.ts';\nimport {\n i,\n type InstantRules,\n type InstantRouteHandlerPayloadByType,\n type InstantRouteHandlerType,\n type InstantRouteHandlerBody,\n} from '@instantdb/core';\nimport { exchangeCodeForToken, exchangeRefreshToken } from './serverOAuth.ts';\nimport { clerkDomainFromPublishableKey } from './clerk.ts';\nimport {\n Webhooks,\n type WebhookAction,\n type WebhookStatus,\n type WebhookEventStatus,\n type WebhookInfo,\n type WebhookAttempt,\n type WebhookEventInfo,\n type WebhookEventsPage,\n type WebhookBody,\n type WebhookEntity,\n type WebhookPayload,\n type WebhookPayloadRecord,\n type WebhookPayloadRecordFor,\n type WebhookHandlerFn,\n type WebhookHandlers,\n type WebhookHelpers,\n type CreateWebhookParams,\n type UpdateWebhookParams,\n WebhooksManager,\n} from '@instantdb/webhooks';\n\nexport {\n type InstantAPIPlatformSchema,\n type InstantDBOAuthAccessToken,\n type OAuthHandlerConfig,\n type OAuthScope,\n type InstantRules,\n type InstantRouteHandlerPayloadByType,\n type InstantRouteHandlerType,\n type InstantRouteHandlerBody,\n OAuthHandler,\n InstantOAuthError,\n generateSchemaTypescriptFile,\n collectSystemCatalogIdentNames,\n validateSchema,\n SchemaValidationError,\n generatePermsTypescriptFile,\n permsTypescriptFileToCode,\n apiSchemaToInstantSchemaDef,\n schemaTypescriptFileToInstantSchema,\n version,\n translatePlanSteps,\n PlatformApi,\n ProgressPromise,\n exchangeCodeForToken,\n exchangeRefreshToken,\n clerkDomainFromPublishableKey,\n i,\n Webhooks,\n WebhooksManager,\n type WebhookAction,\n type WebhookStatus,\n type WebhookEventStatus,\n type WebhookInfo,\n type WebhookAttempt,\n type WebhookEventInfo,\n type WebhookEventsPage,\n type WebhookBody,\n type WebhookEntity,\n type WebhookPayload,\n type WebhookPayloadRecord,\n type WebhookPayloadRecordFor,\n type WebhookHandlerFn,\n type WebhookHandlers,\n type WebhookHelpers,\n type CreateWebhookParams,\n type UpdateWebhookParams,\n};\n\nexport {\n diffSchemas,\n convertTxSteps,\n isRenamePromptItem,\n buildAutoRenameSelector,\n type RenameResolveFn,\n type MigrationTx,\n type MigrationTxSpecific,\n type MigrationTxTypes,\n type Identifier,\n} from './migrations.ts';\n\nexport {\n BackupsManager,\n backupZipName,\n estimateZipSize,\n formatFileSize,\n toAppBackup,\n type AppBackup,\n type AppBackupFile,\n type AppBackupStorageFile,\n} from './backups.ts';\n\nexport {\n type DownloadBackupArchiveOpts,\n type BackupArchiveWriter,\n type BackupDownloadProgress,\n type BackupDownloadResult,\n} from './backupDownload.ts';\n\nexport {\n DEFAULT_OAUTH_CALLBACK_URL,\n oauthCallbackURL,\n GOOGLE_AUTHORIZATION_ENDPOINT,\n GOOGLE_DISCOVERY_ENDPOINT,\n GOOGLE_TOKEN_ENDPOINT,\n APPLE_AUTHORIZATION_ENDPOINT,\n APPLE_DISCOVERY_ENDPOINT,\n APPLE_TOKEN_ENDPOINT,\n LINKEDIN_AUTHORIZATION_ENDPOINT,\n LINKEDIN_DISCOVERY_ENDPOINT,\n LINKEDIN_TOKEN_ENDPOINT,\n} from './consts.ts';\n"]}
|
package/dist/esm/api.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { InstantRules, InstantSchemaDef, InstantUnknownSchema, EntitiesDef, LinksDef, RoomsDef, InstantDBAttr, InstantDBIdent, InstantDBCheckedDataType } from '@instantdb/core';
|
|
2
2
|
import { Webhooks } from '@instantdb/webhooks';
|
|
3
|
+
import { BackupsManager } from './backups.ts';
|
|
3
4
|
import { InstantAPIPlatformSchema, InstantAPISchemaPlanStep, InstantAPISchemaPushStep } from './schema.ts';
|
|
4
5
|
import { ProgressPromise } from './ProgressPromise.ts';
|
|
5
6
|
import { RenameCommand } from './migrations.ts';
|
|
@@ -464,6 +465,12 @@ export declare class PlatformApi {
|
|
|
464
465
|
webhooks<Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema>(appId: string, opts?: {
|
|
465
466
|
schema?: Schema;
|
|
466
467
|
}): Webhooks<Schema>;
|
|
468
|
+
/**
|
|
469
|
+
* Returns a {@link BackupsManager} scoped to `appId` for listing an app's
|
|
470
|
+
* backups and downloading their contents. Calls are routed through
|
|
471
|
+
* {@link withRetry}, so an expired access token is transparently refreshed.
|
|
472
|
+
*/
|
|
473
|
+
backups(appId: string): BackupsManager;
|
|
467
474
|
}
|
|
468
475
|
export {};
|
|
469
476
|
//# sourceMappingURL=api.d.ts.map
|
package/dist/esm/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,cAAc,EACd,wBAAwB,EAIzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAiB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,gBAAgB,EAChB,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AK,EAAE,MAAM,EACb,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,2BAA2B,CAAC;IAOjC,SAAS,IAAI,OAAO,CAAC,2BAA2B,CAAC;IAOvD;;;;;;;;;OASG;IACH,QAAQ,CACN,MAAM,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,oBAAoB,EACrE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,QAAQ,CAAC,MAAM,CAAC;IAc9D;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc;CAQvC"}
|
package/dist/esm/api.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { InstantAPIError, version as coreVersion, i, } from '@instantdb/core';
|
|
2
2
|
import { Webhooks } from '@instantdb/webhooks';
|
|
3
|
+
import { BackupsManager } from "./backups.js";
|
|
3
4
|
import version from "./version.js";
|
|
4
5
|
import { attrFwdLabel, attrFwdName, attrRevName, collectSystemCatalogIdentNames, identName, validateSchema, } from "./schema.js";
|
|
5
6
|
import { ProgressPromise } from "./ProgressPromise.js";
|
|
@@ -1101,5 +1102,14 @@ export class PlatformApi {
|
|
|
1101
1102
|
withAuth,
|
|
1102
1103
|
});
|
|
1103
1104
|
}
|
|
1105
|
+
/**
|
|
1106
|
+
* Returns a {@link BackupsManager} scoped to `appId` for listing an app's
|
|
1107
|
+
* backups and downloading their contents. Calls are routed through
|
|
1108
|
+
* {@link withRetry}, so an expired access token is transparently refreshed.
|
|
1109
|
+
*/
|
|
1110
|
+
backups(appId) {
|
|
1111
|
+
const withAuth = (operation) => this.withRetry((_apiURI, token) => operation(token), [this.#apiURI, this.token()]);
|
|
1112
|
+
return new BackupsManager({ appId, apiURI: this.#apiURI, withAuth });
|
|
1113
|
+
}
|
|
1104
1114
|
}
|
|
1105
1115
|
//# sourceMappingURL=api.js.map
|