@shaxpir/duiduidui-models 1.9.6 → 1.9.7
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/util/Database.d.ts +16 -1
- package/dist/util/Database.js +9 -0
- package/package.json +1 -1
package/dist/util/Database.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ declare enum DatabaseVersionBrand {
|
|
|
7
7
|
*/
|
|
8
8
|
export type DatabaseVersion = string & DatabaseVersionBrand;
|
|
9
9
|
/**
|
|
10
|
-
* Describes a version of the built-in database available for download
|
|
10
|
+
* Describes a version of the built-in database available for download.
|
|
11
|
+
* Stored in S3 as `duiduidui-{version}.json` alongside `duiduidui-{version}.sqlite.gz`.
|
|
11
12
|
*/
|
|
12
13
|
export interface BuiltInDbMetadata {
|
|
13
14
|
version: DatabaseVersion;
|
|
@@ -18,6 +19,14 @@ export interface BuiltInDbMetadata {
|
|
|
18
19
|
published_at: CompactDateTime;
|
|
19
20
|
min_app_version: string;
|
|
20
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Top-level pointer to the current database version.
|
|
24
|
+
* Stored in S3 as `meta.json`.
|
|
25
|
+
* Clients fetch this first, then fetch the version-specific manifest.
|
|
26
|
+
*/
|
|
27
|
+
export interface DatabaseVersionPointer {
|
|
28
|
+
database_version: DatabaseVersion;
|
|
29
|
+
}
|
|
21
30
|
/**
|
|
22
31
|
* Tracks the state of the built-in database on a device
|
|
23
32
|
* Stored in Device model's payload.builtin_db field
|
|
@@ -121,4 +130,10 @@ export declare const BUILTIN_DB_CONSTANTS: {
|
|
|
121
130
|
* getBuiltInDbFilename("20250118a", false) -> "duiduidui-20250118a.sqlite"
|
|
122
131
|
*/
|
|
123
132
|
export declare function getBuiltInDbFilename(version: DatabaseVersion, compressed?: boolean): string;
|
|
133
|
+
/**
|
|
134
|
+
* Helper to generate metadata filename for a database version
|
|
135
|
+
* Examples:
|
|
136
|
+
* getBuiltInDbMetadataFilename("20250118a") -> "duiduidui-20250118a.json"
|
|
137
|
+
*/
|
|
138
|
+
export declare function getBuiltInDbMetadataFilename(version: DatabaseVersion): string;
|
|
124
139
|
export {};
|
package/dist/util/Database.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.BUILTIN_DB_CONSTANTS = exports.DatabaseVersionModel = exports.Checksum = void 0;
|
|
5
5
|
exports.getBuiltInDbFilename = getBuiltInDbFilename;
|
|
6
|
+
exports.getBuiltInDbMetadataFilename = getBuiltInDbMetadataFilename;
|
|
6
7
|
var DatabaseVersionBrand;
|
|
7
8
|
(function (DatabaseVersionBrand) {
|
|
8
9
|
})(DatabaseVersionBrand || (DatabaseVersionBrand = {}));
|
|
@@ -133,3 +134,11 @@ function getBuiltInDbFilename(version, compressed = true) {
|
|
|
133
134
|
const base = `${exports.BUILTIN_DB_CONSTANTS.FILE_PREFIX}${version}${exports.BUILTIN_DB_CONSTANTS.FILE_EXTENSION}`;
|
|
134
135
|
return compressed ? `${base}.gz` : base;
|
|
135
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Helper to generate metadata filename for a database version
|
|
139
|
+
* Examples:
|
|
140
|
+
* getBuiltInDbMetadataFilename("20250118a") -> "duiduidui-20250118a.json"
|
|
141
|
+
*/
|
|
142
|
+
function getBuiltInDbMetadataFilename(version) {
|
|
143
|
+
return `${exports.BUILTIN_DB_CONSTANTS.FILE_PREFIX}${version}.json`;
|
|
144
|
+
}
|