@hot-updater/azure 0.0.0-stage → 1.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/LICENSE +33 -0
- package/dist/functions/host.json +8 -0
- package/dist/functions/index.mjs +70656 -0
- package/dist/index.cjs +737 -0
- package/dist/index.d.cts +71 -0
- package/dist/index.d.mts +71 -0
- package/dist/index.mjs +734 -0
- package/dist/init/index.cjs +7829 -0
- package/dist/init/index.d.cts +99 -0
- package/dist/init/index.d.mts +99 -0
- package/dist/init/index.mjs +7821 -0
- package/package.json +59 -3
- package/README.md +0 -3
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { TokenCredential } from "@azure/core-auth";
|
|
2
|
+
import { StorageSharedKeyCredential } from "@azure/storage-blob";
|
|
3
|
+
import { EngineDatabase, PluginTables, StorageAdapter, StorageAdapterWith } from "@hot-updater/plugin-core";
|
|
4
|
+
import { CosmosClientOptions } from "@azure/cosmos";
|
|
5
|
+
//#region src/azureBlobStorage.d.ts
|
|
6
|
+
/** The account to connect to: its connection string, or its Blob endpoint and a credential. */
|
|
7
|
+
type AzureBlobConnection = {
|
|
8
|
+
readonly connectionString: string;
|
|
9
|
+
} | {
|
|
10
|
+
/** The Blob service endpoint, such as `https://<account>.blob.core.windows.net`. */
|
|
11
|
+
readonly accountUrl: string;
|
|
12
|
+
/** An account key, or a Microsoft Entra identity such as `DefaultAzureCredential`. */
|
|
13
|
+
readonly credential: StorageSharedKeyCredential | TokenCredential;
|
|
14
|
+
};
|
|
15
|
+
type AzureBlobStorageConfig = AzureBlobConnection & {
|
|
16
|
+
/** The Blob container that keeps the bundles. */
|
|
17
|
+
readonly containerName: string;
|
|
18
|
+
/** Base path where bundles will be stored in the container. */
|
|
19
|
+
readonly basePath?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The URL devices download an object from, such as a CDN's. Without it, a
|
|
22
|
+
* read-only SAS URL that expires in an hour.
|
|
23
|
+
*/
|
|
24
|
+
readonly getDownloadUrl?: StorageAdapter["getDownloadUrl"];
|
|
25
|
+
};
|
|
26
|
+
type AzureBlobStorageOperations = "put" | "get" | "getDownloadUrl" | "exists" | "delete" | "listObjects" | "deleteObjects";
|
|
27
|
+
/**
|
|
28
|
+
* Bundles in an Azure Blob Storage container. Without `getDownloadUrl`,
|
|
29
|
+
* devices download through SAS URLs: signed with the account key when the
|
|
30
|
+
* connection has one, otherwise with a user delegation key, which needs the
|
|
31
|
+
* identity's Storage Blob Delegator role.
|
|
32
|
+
*/
|
|
33
|
+
declare function azureBlobStorage(config: AzureBlobStorageConfig): StorageAdapterWith<AzureBlobStorageOperations>;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/cosmosDatabase.d.ts
|
|
36
|
+
/**
|
|
37
|
+
* The client's options: the account's `connectionString`, or its
|
|
38
|
+
* `endpoint` with a `key` or Microsoft Entra `aadCredentials`. Reads must
|
|
39
|
+
* be strongly consistent, so `consistencyLevel` takes only `"Strong"`.
|
|
40
|
+
*/
|
|
41
|
+
type CosmosDatabaseConfig = Omit<CosmosClientOptions, "consistencyLevel"> & {
|
|
42
|
+
readonly consistencyLevel?: "Strong";
|
|
43
|
+
/** The database the container lives in. @default "hot-updater" */
|
|
44
|
+
readonly databaseId?: string;
|
|
45
|
+
/** The one container the database keeps its items in. @default "hot_updater_v1" */
|
|
46
|
+
readonly containerId?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Cosmos DB bills each item a write touches, so Insights' aggregates are
|
|
49
|
+
* batched: through log rows a compaction merges (the default), or
|
|
50
|
+
* `{ mode: "memory" }` on a long-lived server. `false` commits them with
|
|
51
|
+
* each event.
|
|
52
|
+
*/
|
|
53
|
+
readonly aggregateBatching?: EngineDatabase["aggregateBatching"] | false;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Creates the database and the container when they are missing, refusing a
|
|
57
|
+
* container of another storage layout or another app's items, and writes
|
|
58
|
+
* the schema settings of core and `plugins`, the plugins the server runs,
|
|
59
|
+
* which the database checks before its first read. `hot-updater init` runs
|
|
60
|
+
* it with the managed server's plugins.
|
|
61
|
+
*/
|
|
62
|
+
declare const migrateCosmosDatabase: (config: CosmosDatabaseConfig, plugins?: readonly PluginTables[]) => Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Hot Updater's database in one Azure Cosmos DB for NoSQL container,
|
|
65
|
+
* through the storage engine. Every item shares one logical partition, so a
|
|
66
|
+
* write commits as one transactional batch; that partition holds at most
|
|
67
|
+
* 20 GB.
|
|
68
|
+
*/
|
|
69
|
+
declare const cosmosDatabase: (config: CosmosDatabaseConfig) => EngineDatabase;
|
|
70
|
+
//#endregion
|
|
71
|
+
export { AzureBlobConnection, AzureBlobStorageConfig, CosmosDatabaseConfig, azureBlobStorage, cosmosDatabase, migrateCosmosDatabase };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { TokenCredential } from "@azure/core-auth";
|
|
2
|
+
import { StorageSharedKeyCredential } from "@azure/storage-blob";
|
|
3
|
+
import { EngineDatabase, PluginTables, StorageAdapter, StorageAdapterWith } from "@hot-updater/plugin-core";
|
|
4
|
+
import { CosmosClientOptions } from "@azure/cosmos";
|
|
5
|
+
//#region src/azureBlobStorage.d.ts
|
|
6
|
+
/** The account to connect to: its connection string, or its Blob endpoint and a credential. */
|
|
7
|
+
type AzureBlobConnection = {
|
|
8
|
+
readonly connectionString: string;
|
|
9
|
+
} | {
|
|
10
|
+
/** The Blob service endpoint, such as `https://<account>.blob.core.windows.net`. */
|
|
11
|
+
readonly accountUrl: string;
|
|
12
|
+
/** An account key, or a Microsoft Entra identity such as `DefaultAzureCredential`. */
|
|
13
|
+
readonly credential: StorageSharedKeyCredential | TokenCredential;
|
|
14
|
+
};
|
|
15
|
+
type AzureBlobStorageConfig = AzureBlobConnection & {
|
|
16
|
+
/** The Blob container that keeps the bundles. */
|
|
17
|
+
readonly containerName: string;
|
|
18
|
+
/** Base path where bundles will be stored in the container. */
|
|
19
|
+
readonly basePath?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The URL devices download an object from, such as a CDN's. Without it, a
|
|
22
|
+
* read-only SAS URL that expires in an hour.
|
|
23
|
+
*/
|
|
24
|
+
readonly getDownloadUrl?: StorageAdapter["getDownloadUrl"];
|
|
25
|
+
};
|
|
26
|
+
type AzureBlobStorageOperations = "put" | "get" | "getDownloadUrl" | "exists" | "delete" | "listObjects" | "deleteObjects";
|
|
27
|
+
/**
|
|
28
|
+
* Bundles in an Azure Blob Storage container. Without `getDownloadUrl`,
|
|
29
|
+
* devices download through SAS URLs: signed with the account key when the
|
|
30
|
+
* connection has one, otherwise with a user delegation key, which needs the
|
|
31
|
+
* identity's Storage Blob Delegator role.
|
|
32
|
+
*/
|
|
33
|
+
declare function azureBlobStorage(config: AzureBlobStorageConfig): StorageAdapterWith<AzureBlobStorageOperations>;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/cosmosDatabase.d.ts
|
|
36
|
+
/**
|
|
37
|
+
* The client's options: the account's `connectionString`, or its
|
|
38
|
+
* `endpoint` with a `key` or Microsoft Entra `aadCredentials`. Reads must
|
|
39
|
+
* be strongly consistent, so `consistencyLevel` takes only `"Strong"`.
|
|
40
|
+
*/
|
|
41
|
+
type CosmosDatabaseConfig = Omit<CosmosClientOptions, "consistencyLevel"> & {
|
|
42
|
+
readonly consistencyLevel?: "Strong";
|
|
43
|
+
/** The database the container lives in. @default "hot-updater" */
|
|
44
|
+
readonly databaseId?: string;
|
|
45
|
+
/** The one container the database keeps its items in. @default "hot_updater_v1" */
|
|
46
|
+
readonly containerId?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Cosmos DB bills each item a write touches, so Insights' aggregates are
|
|
49
|
+
* batched: through log rows a compaction merges (the default), or
|
|
50
|
+
* `{ mode: "memory" }` on a long-lived server. `false` commits them with
|
|
51
|
+
* each event.
|
|
52
|
+
*/
|
|
53
|
+
readonly aggregateBatching?: EngineDatabase["aggregateBatching"] | false;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Creates the database and the container when they are missing, refusing a
|
|
57
|
+
* container of another storage layout or another app's items, and writes
|
|
58
|
+
* the schema settings of core and `plugins`, the plugins the server runs,
|
|
59
|
+
* which the database checks before its first read. `hot-updater init` runs
|
|
60
|
+
* it with the managed server's plugins.
|
|
61
|
+
*/
|
|
62
|
+
declare const migrateCosmosDatabase: (config: CosmosDatabaseConfig, plugins?: readonly PluginTables[]) => Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Hot Updater's database in one Azure Cosmos DB for NoSQL container,
|
|
65
|
+
* through the storage engine. Every item shares one logical partition, so a
|
|
66
|
+
* write commits as one transactional batch; that partition holds at most
|
|
67
|
+
* 20 GB.
|
|
68
|
+
*/
|
|
69
|
+
declare const cosmosDatabase: (config: CosmosDatabaseConfig) => EngineDatabase;
|
|
70
|
+
//#endregion
|
|
71
|
+
export { AzureBlobConnection, AzureBlobStorageConfig, CosmosDatabaseConfig, azureBlobStorage, cosmosDatabase, migrateCosmosDatabase };
|