@hot-updater/standalone 0.36.7 → 1.0.0-rc.0

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,38 +1,82 @@
1
- import * as _$_hot_updater_plugin_core0 from "@hot-updater/plugin-core";
2
- import { StoragePluginHooks, UniversalStoragePlugin } from "@hot-updater/plugin-core";
1
+ import { BundleRepository, StorageDeleteInput, StorageExistsInput, StorageGetInput, StoragePutInput } from "@hot-updater/plugin-core";
3
2
 
4
- //#region src/standaloneRepository.d.ts
3
+ //#region src/standaloneRoutes.d.ts
5
4
  interface RouteConfig {
6
- path: string;
7
- headers?: Record<string, string>;
5
+ readonly path: string;
6
+ readonly headers?: Readonly<Record<string, string>>;
8
7
  }
9
8
  interface Routes {
10
- create?: () => RouteConfig;
11
- update?: (bundleId: string) => RouteConfig;
12
- list?: () => RouteConfig;
13
- channels?: () => RouteConfig;
14
- retrieve?: (bundleId: string) => RouteConfig;
15
- delete?: (bundleId: string) => RouteConfig;
9
+ readonly create?: () => RouteConfig;
10
+ readonly update?: (bundleId: string) => RouteConfig;
11
+ readonly list?: () => RouteConfig;
12
+ readonly retrieve?: (bundleId: string) => RouteConfig;
13
+ readonly delete?: (bundleId: string) => RouteConfig;
16
14
  }
17
15
  interface StandaloneRepositoryConfig {
18
- baseUrl: string;
19
- commonHeaders?: Record<string, string>;
20
- routes?: Routes;
16
+ /** Base URL of the Hot Updater admin handler. */
17
+ readonly baseUrl: string;
18
+ readonly commonHeaders?: Readonly<Record<string, string>>;
19
+ readonly routes?: Routes;
21
20
  }
22
- declare const standaloneRepository: (config: StandaloneRepositoryConfig, hooks?: _$_hot_updater_plugin_core0.DatabasePluginHooks) => () => _$_hot_updater_plugin_core0.DatabasePlugin<unknown>;
21
+ //#endregion
22
+ //#region src/standaloneHttp.d.ts
23
+ type StandaloneDatabaseErrorCode = "invalid-response" | "request-failed";
24
+ declare class StandaloneDatabaseError extends Error {
25
+ readonly code: StandaloneDatabaseErrorCode;
26
+ readonly status?: number | undefined;
27
+ readonly name = "StandaloneDatabaseError";
28
+ constructor(code: StandaloneDatabaseErrorCode, message: string, status?: number | undefined);
29
+ }
30
+ //#endregion
31
+ //#region src/standaloneRepository.d.ts
32
+ /**
33
+ * Bundle-only HTTP repository used by the CLI for a self-hosted server.
34
+ *
35
+ * This is intentionally not a database plugin: analytics and access-key
36
+ * persistence belong to the server's database provider.
37
+ */
38
+ declare const standaloneRepository: (config: StandaloneRepositoryConfig) => BundleRepository;
23
39
  //#endregion
24
40
  //#region src/standaloneStorage.d.ts
25
41
  interface StorageRoutes {
26
- upload: (key: string, filePath: string) => RouteConfig;
27
- delete: (storageUri: string) => RouteConfig;
28
- readText: (storageUri: string) => RouteConfig;
29
- getDownloadUrl: (storageUri: string) => RouteConfig;
42
+ put: (input: Omit<StoragePutInput, "body">) => RouteConfig;
43
+ get: (input: StorageGetInput) => RouteConfig;
44
+ exists: (input: StorageExistsInput) => RouteConfig;
45
+ delete: (input: StorageDeleteInput) => RouteConfig;
30
46
  }
31
47
  interface StandaloneStorageConfig {
32
48
  baseUrl: string;
49
+ /** Storage URI protocol owned by the remote implementation. */
50
+ protocol: string;
33
51
  commonHeaders?: Record<string, string>;
34
- routes?: StorageRoutes;
52
+ routes?: Partial<StorageRoutes>;
35
53
  }
36
- declare const standaloneStorage: (config: StandaloneStorageConfig, hooks?: StoragePluginHooks) => () => UniversalStoragePlugin;
54
+ declare const standaloneStorage: (config: StandaloneStorageConfig) => {
55
+ readonly name: "standaloneStorage";
56
+ readonly protocol: string;
57
+ readonly put: ({
58
+ key,
59
+ body,
60
+ contentType,
61
+ contentLength
62
+ }: StoragePutInput) => Promise<{
63
+ storageUri: string;
64
+ }>;
65
+ readonly get: ({
66
+ storageUri
67
+ }: StorageGetInput) => Promise<{
68
+ response: Response | null;
69
+ }>;
70
+ readonly exists: ({
71
+ storageUri
72
+ }: StorageExistsInput) => Promise<{
73
+ exists: boolean;
74
+ }>;
75
+ readonly delete: ({
76
+ storageUri
77
+ }: StorageDeleteInput) => Promise<{
78
+ deleted: true;
79
+ }>;
80
+ };
37
81
  //#endregion
38
- export { RouteConfig, Routes, StandaloneRepositoryConfig, StandaloneStorageConfig, StorageRoutes, standaloneRepository, standaloneStorage };
82
+ export { type RouteConfig, type Routes, StandaloneDatabaseError, type StandaloneRepositoryConfig, StandaloneStorageConfig, StorageRoutes, standaloneRepository, standaloneStorage };
package/dist/index.d.mts CHANGED
@@ -1,38 +1,82 @@
1
- import * as _$_hot_updater_plugin_core0 from "@hot-updater/plugin-core";
2
- import { StoragePluginHooks, UniversalStoragePlugin } from "@hot-updater/plugin-core";
1
+ import { BundleRepository, StorageDeleteInput, StorageExistsInput, StorageGetInput, StoragePutInput } from "@hot-updater/plugin-core";
3
2
 
4
- //#region src/standaloneRepository.d.ts
3
+ //#region src/standaloneRoutes.d.ts
5
4
  interface RouteConfig {
6
- path: string;
7
- headers?: Record<string, string>;
5
+ readonly path: string;
6
+ readonly headers?: Readonly<Record<string, string>>;
8
7
  }
9
8
  interface Routes {
10
- create?: () => RouteConfig;
11
- update?: (bundleId: string) => RouteConfig;
12
- list?: () => RouteConfig;
13
- channels?: () => RouteConfig;
14
- retrieve?: (bundleId: string) => RouteConfig;
15
- delete?: (bundleId: string) => RouteConfig;
9
+ readonly create?: () => RouteConfig;
10
+ readonly update?: (bundleId: string) => RouteConfig;
11
+ readonly list?: () => RouteConfig;
12
+ readonly retrieve?: (bundleId: string) => RouteConfig;
13
+ readonly delete?: (bundleId: string) => RouteConfig;
16
14
  }
17
15
  interface StandaloneRepositoryConfig {
18
- baseUrl: string;
19
- commonHeaders?: Record<string, string>;
20
- routes?: Routes;
16
+ /** Base URL of the Hot Updater admin handler. */
17
+ readonly baseUrl: string;
18
+ readonly commonHeaders?: Readonly<Record<string, string>>;
19
+ readonly routes?: Routes;
21
20
  }
22
- declare const standaloneRepository: (config: StandaloneRepositoryConfig, hooks?: _$_hot_updater_plugin_core0.DatabasePluginHooks) => () => _$_hot_updater_plugin_core0.DatabasePlugin<unknown>;
21
+ //#endregion
22
+ //#region src/standaloneHttp.d.ts
23
+ type StandaloneDatabaseErrorCode = "invalid-response" | "request-failed";
24
+ declare class StandaloneDatabaseError extends Error {
25
+ readonly code: StandaloneDatabaseErrorCode;
26
+ readonly status?: number | undefined;
27
+ readonly name = "StandaloneDatabaseError";
28
+ constructor(code: StandaloneDatabaseErrorCode, message: string, status?: number | undefined);
29
+ }
30
+ //#endregion
31
+ //#region src/standaloneRepository.d.ts
32
+ /**
33
+ * Bundle-only HTTP repository used by the CLI for a self-hosted server.
34
+ *
35
+ * This is intentionally not a database plugin: analytics and access-key
36
+ * persistence belong to the server's database provider.
37
+ */
38
+ declare const standaloneRepository: (config: StandaloneRepositoryConfig) => BundleRepository;
23
39
  //#endregion
24
40
  //#region src/standaloneStorage.d.ts
25
41
  interface StorageRoutes {
26
- upload: (key: string, filePath: string) => RouteConfig;
27
- delete: (storageUri: string) => RouteConfig;
28
- readText: (storageUri: string) => RouteConfig;
29
- getDownloadUrl: (storageUri: string) => RouteConfig;
42
+ put: (input: Omit<StoragePutInput, "body">) => RouteConfig;
43
+ get: (input: StorageGetInput) => RouteConfig;
44
+ exists: (input: StorageExistsInput) => RouteConfig;
45
+ delete: (input: StorageDeleteInput) => RouteConfig;
30
46
  }
31
47
  interface StandaloneStorageConfig {
32
48
  baseUrl: string;
49
+ /** Storage URI protocol owned by the remote implementation. */
50
+ protocol: string;
33
51
  commonHeaders?: Record<string, string>;
34
- routes?: StorageRoutes;
52
+ routes?: Partial<StorageRoutes>;
35
53
  }
36
- declare const standaloneStorage: (config: StandaloneStorageConfig, hooks?: StoragePluginHooks) => () => UniversalStoragePlugin;
54
+ declare const standaloneStorage: (config: StandaloneStorageConfig) => {
55
+ readonly name: "standaloneStorage";
56
+ readonly protocol: string;
57
+ readonly put: ({
58
+ key,
59
+ body,
60
+ contentType,
61
+ contentLength
62
+ }: StoragePutInput) => Promise<{
63
+ storageUri: string;
64
+ }>;
65
+ readonly get: ({
66
+ storageUri
67
+ }: StorageGetInput) => Promise<{
68
+ response: Response | null;
69
+ }>;
70
+ readonly exists: ({
71
+ storageUri
72
+ }: StorageExistsInput) => Promise<{
73
+ exists: boolean;
74
+ }>;
75
+ readonly delete: ({
76
+ storageUri
77
+ }: StorageDeleteInput) => Promise<{
78
+ deleted: true;
79
+ }>;
80
+ };
37
81
  //#endregion
38
- export { RouteConfig, Routes, StandaloneRepositoryConfig, StandaloneStorageConfig, StorageRoutes, standaloneRepository, standaloneStorage };
82
+ export { type RouteConfig, type Routes, StandaloneDatabaseError, type StandaloneRepositoryConfig, StandaloneStorageConfig, StorageRoutes, standaloneRepository, standaloneStorage };