@hot-updater/standalone 1.0.0-rc.2 → 1.0.0-rc.21

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/index.d.cts CHANGED
@@ -1,23 +1,22 @@
1
- import { BundleRepository, StorageDeleteInput, StorageExistsInput, StorageGetInput, StoragePutInput } from "@hot-updater/plugin-core";
1
+ import { HotUpdaterCoreApi, RemoteDatabase, StorageDeleteInput, StorageExistsInput, StorageGetInput, StoragePutInput } from "@hot-updater/plugin-core";
2
2
  //#region src/standaloneRoutes.d.ts
3
- interface RouteConfig {
4
- readonly path: string;
5
- readonly headers?: Readonly<Record<string, string>>;
6
- }
7
- interface Routes {
8
- readonly create?: () => RouteConfig;
9
- readonly update?: (bundleId: string) => RouteConfig;
10
- readonly list?: () => RouteConfig;
11
- readonly retrieve?: (bundleId: string) => RouteConfig;
12
- readonly delete?: (bundleId: string) => RouteConfig;
13
- }
14
3
  interface StandaloneRepositoryConfig {
15
4
  /** Base URL of the Hot Updater admin handler. */
16
5
  readonly baseUrl: string;
6
+ /** Headers sent with every admin request, such as its authorization. */
17
7
  readonly commonHeaders?: Readonly<Record<string, string>>;
18
- readonly routes?: Routes;
19
8
  }
20
9
  //#endregion
10
+ //#region src/standaloneCore.d.ts
11
+ /** The admin API protocol this client speaks; the server's `/version` must report it or a later one. */
12
+ declare const STANDALONE_ADMIN_PROTOCOL = 2;
13
+ /**
14
+ * Core's API over a self-hosted server's admin handler, protocol 2: the CLI's
15
+ * path to a database it cannot open itself. The first call checks that the
16
+ * server speaks protocol 2, so an older server fails fast.
17
+ */
18
+ declare const createStandaloneCoreApi: (config: StandaloneRepositoryConfig) => HotUpdaterCoreApi;
19
+ //#endregion
21
20
  //#region src/standaloneHttp.d.ts
22
21
  type StandaloneDatabaseErrorCode = "invalid-response" | "request-failed";
23
22
  declare class StandaloneDatabaseError extends Error {
@@ -28,15 +27,22 @@ declare class StandaloneDatabaseError extends Error {
28
27
  }
29
28
  //#endregion
30
29
  //#region src/standaloneRepository.d.ts
30
+ /** A self-hosted server's database, reached over its admin handler. */
31
+ type StandaloneRepository = RemoteDatabase;
31
32
  /**
32
- * Bundle-only HTTP repository used by the CLI for a self-hosted server.
33
- *
34
- * This is intentionally not a database plugin: insights and access-key
35
- * persistence belong to the server's database provider.
33
+ * A self-hosted server's database for the CLI and console: core's API over
34
+ * the server's admin API protocol 2, and GETs on its admin handler for the
35
+ * routes core does not cover, which its plugins serve. Plugins' tables belong
36
+ * to the server's own database.
36
37
  */
37
- declare const standaloneRepository: (config: StandaloneRepositoryConfig) => BundleRepository;
38
+ declare const standaloneRepository: (config: StandaloneRepositoryConfig) => StandaloneRepository;
38
39
  //#endregion
39
40
  //#region src/standaloneStorage.d.ts
41
+ /** A storage route: its path, and headers added to the common ones. */
42
+ interface RouteConfig {
43
+ readonly path: string;
44
+ readonly headers?: Readonly<Record<string, string>>;
45
+ }
40
46
  interface StorageRoutes {
41
47
  put: (input: Omit<StoragePutInput, "body">) => RouteConfig;
42
48
  get: (input: StorageGetInput) => RouteConfig;
@@ -67,4 +73,4 @@ declare const standaloneStorage: (config: StandaloneStorageConfig) => {
67
73
  }>;
68
74
  };
69
75
  //#endregion
70
- export { type RouteConfig, type Routes, StandaloneDatabaseError, type StandaloneRepositoryConfig, StandaloneStorageConfig, StorageRoutes, standaloneRepository, standaloneStorage };
76
+ export { RouteConfig, STANDALONE_ADMIN_PROTOCOL, StandaloneDatabaseError, StandaloneRepository, type StandaloneRepositoryConfig, StandaloneStorageConfig, StorageRoutes, createStandaloneCoreApi, standaloneRepository, standaloneStorage };
package/dist/index.d.mts CHANGED
@@ -1,23 +1,22 @@
1
- import { BundleRepository, StorageDeleteInput, StorageExistsInput, StorageGetInput, StoragePutInput } from "@hot-updater/plugin-core";
1
+ import { HotUpdaterCoreApi, RemoteDatabase, StorageDeleteInput, StorageExistsInput, StorageGetInput, StoragePutInput } from "@hot-updater/plugin-core";
2
2
  //#region src/standaloneRoutes.d.ts
3
- interface RouteConfig {
4
- readonly path: string;
5
- readonly headers?: Readonly<Record<string, string>>;
6
- }
7
- interface Routes {
8
- readonly create?: () => RouteConfig;
9
- readonly update?: (bundleId: string) => RouteConfig;
10
- readonly list?: () => RouteConfig;
11
- readonly retrieve?: (bundleId: string) => RouteConfig;
12
- readonly delete?: (bundleId: string) => RouteConfig;
13
- }
14
3
  interface StandaloneRepositoryConfig {
15
4
  /** Base URL of the Hot Updater admin handler. */
16
5
  readonly baseUrl: string;
6
+ /** Headers sent with every admin request, such as its authorization. */
17
7
  readonly commonHeaders?: Readonly<Record<string, string>>;
18
- readonly routes?: Routes;
19
8
  }
20
9
  //#endregion
10
+ //#region src/standaloneCore.d.ts
11
+ /** The admin API protocol this client speaks; the server's `/version` must report it or a later one. */
12
+ declare const STANDALONE_ADMIN_PROTOCOL = 2;
13
+ /**
14
+ * Core's API over a self-hosted server's admin handler, protocol 2: the CLI's
15
+ * path to a database it cannot open itself. The first call checks that the
16
+ * server speaks protocol 2, so an older server fails fast.
17
+ */
18
+ declare const createStandaloneCoreApi: (config: StandaloneRepositoryConfig) => HotUpdaterCoreApi;
19
+ //#endregion
21
20
  //#region src/standaloneHttp.d.ts
22
21
  type StandaloneDatabaseErrorCode = "invalid-response" | "request-failed";
23
22
  declare class StandaloneDatabaseError extends Error {
@@ -28,15 +27,22 @@ declare class StandaloneDatabaseError extends Error {
28
27
  }
29
28
  //#endregion
30
29
  //#region src/standaloneRepository.d.ts
30
+ /** A self-hosted server's database, reached over its admin handler. */
31
+ type StandaloneRepository = RemoteDatabase;
31
32
  /**
32
- * Bundle-only HTTP repository used by the CLI for a self-hosted server.
33
- *
34
- * This is intentionally not a database plugin: insights and access-key
35
- * persistence belong to the server's database provider.
33
+ * A self-hosted server's database for the CLI and console: core's API over
34
+ * the server's admin API protocol 2, and GETs on its admin handler for the
35
+ * routes core does not cover, which its plugins serve. Plugins' tables belong
36
+ * to the server's own database.
36
37
  */
37
- declare const standaloneRepository: (config: StandaloneRepositoryConfig) => BundleRepository;
38
+ declare const standaloneRepository: (config: StandaloneRepositoryConfig) => StandaloneRepository;
38
39
  //#endregion
39
40
  //#region src/standaloneStorage.d.ts
41
+ /** A storage route: its path, and headers added to the common ones. */
42
+ interface RouteConfig {
43
+ readonly path: string;
44
+ readonly headers?: Readonly<Record<string, string>>;
45
+ }
40
46
  interface StorageRoutes {
41
47
  put: (input: Omit<StoragePutInput, "body">) => RouteConfig;
42
48
  get: (input: StorageGetInput) => RouteConfig;
@@ -67,4 +73,4 @@ declare const standaloneStorage: (config: StandaloneStorageConfig) => {
67
73
  }>;
68
74
  };
69
75
  //#endregion
70
- export { type RouteConfig, type Routes, StandaloneDatabaseError, type StandaloneRepositoryConfig, StandaloneStorageConfig, StorageRoutes, standaloneRepository, standaloneStorage };
76
+ export { RouteConfig, STANDALONE_ADMIN_PROTOCOL, StandaloneDatabaseError, StandaloneRepository, type StandaloneRepositoryConfig, StandaloneStorageConfig, StorageRoutes, createStandaloneCoreApi, standaloneRepository, standaloneStorage };