@hot-updater/server 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/LICENSE +12 -14
- package/dist/adapters/drizzle.cjs +32 -75
- package/dist/adapters/drizzle.d.cts +13 -5
- package/dist/adapters/drizzle.d.mts +13 -5
- package/dist/adapters/drizzle.mjs +32 -77
- package/dist/adapters/drizzleExecutor.cjs +114 -0
- package/dist/adapters/drizzleExecutor.d.cts +9 -0
- package/dist/adapters/drizzleExecutor.d.mts +9 -0
- package/dist/adapters/drizzleExecutor.mjs +112 -0
- package/dist/adapters/kysely.cjs +22 -31
- package/dist/adapters/kysely.d.cts +10 -6
- package/dist/adapters/kysely.d.mts +10 -6
- package/dist/adapters/kysely.mjs +23 -33
- package/dist/adapters/kyselyExecutor.cjs +32 -0
- package/dist/adapters/kyselyExecutor.d.cts +11 -0
- package/dist/adapters/kyselyExecutor.d.mts +11 -0
- package/dist/adapters/kyselyExecutor.mjs +32 -0
- package/dist/adapters/mongodb.cjs +18 -54
- package/dist/adapters/mongodb.d.cts +10 -5
- package/dist/adapters/mongodb.d.mts +10 -5
- package/dist/adapters/mongodb.mjs +19 -56
- package/dist/adapters/mongodbAdapter.cjs +192 -0
- package/dist/adapters/mongodbAdapter.d.cts +9 -0
- package/dist/adapters/mongodbAdapter.d.mts +9 -0
- package/dist/adapters/mongodbAdapter.mjs +191 -0
- package/dist/adapters/prisma.cjs +35 -267
- package/dist/adapters/prisma.d.cts +12 -7
- package/dist/adapters/prisma.d.mts +12 -7
- package/dist/adapters/prisma.mjs +36 -268
- package/dist/adapters/prismaExecutor.cjs +63 -0
- package/dist/adapters/prismaExecutor.mjs +63 -0
- package/dist/adapters/sqlProviders.cjs +14 -0
- package/dist/adapters/sqlProviders.mjs +14 -0
- package/dist/assembly/assemblePlugins.cjs +144 -0
- package/dist/assembly/assemblePlugins.d.cts +5 -0
- package/dist/assembly/assemblePlugins.d.mts +5 -0
- package/dist/assembly/assemblePlugins.mjs +139 -0
- package/dist/assembly/clientPlugins.cjs +88 -0
- package/dist/assembly/clientPlugins.mjs +88 -0
- package/dist/assembly/configError.d.cts +2 -0
- package/dist/assembly/configError.d.mts +2 -0
- package/dist/assembly/configError.mjs +2 -0
- package/dist/core/api.cjs +51 -0
- package/dist/core/api.d.cts +54 -0
- package/dist/core/api.d.mts +54 -0
- package/dist/core/api.mjs +51 -0
- package/dist/core/baseCandidates.cjs +28 -0
- package/dist/core/baseCandidates.mjs +28 -0
- package/dist/core/operations.cjs +351 -0
- package/dist/core/operations.mjs +351 -0
- package/dist/core/reads.cjs +273 -0
- package/dist/core/reads.d.cts +9 -0
- package/dist/core/reads.d.mts +9 -0
- package/dist/core/reads.mjs +267 -0
- package/dist/core/releases.cjs +193 -0
- package/dist/core/releases.mjs +190 -0
- package/dist/core/writes.cjs +96 -0
- package/dist/core/writes.mjs +91 -0
- package/dist/createHotUpdaterCore.cjs +72 -91
- package/dist/createHotUpdaterCore.d.cts +106 -38
- package/dist/createHotUpdaterCore.d.mts +106 -38
- package/dist/createHotUpdaterCore.mjs +74 -89
- package/dist/db/engineDrizzleSchema.cjs +53 -0
- package/dist/db/engineDrizzleSchema.mjs +53 -0
- package/dist/db/enginePrismaSchema.cjs +84 -0
- package/dist/db/enginePrismaSchema.d.cts +5 -0
- package/dist/db/enginePrismaSchema.d.mts +5 -0
- package/dist/db/enginePrismaSchema.mjs +83 -0
- package/dist/db/releaseCatalog.cjs +24 -47
- package/dist/db/releaseCatalog.mjs +20 -44
- package/dist/db/updateArtifacts.cjs +43 -72
- package/dist/db/updateArtifacts.mjs +40 -69
- package/dist/handler.cjs +59 -43
- package/dist/handler.d.cts +3 -5
- package/dist/handler.d.mts +3 -5
- package/dist/handler.mjs +61 -43
- package/dist/handlerAdminRoutes.cjs +374 -0
- package/dist/handlerAdminRoutes.mjs +372 -0
- package/dist/handlerParameters.cjs +6 -11
- package/dist/handlerParameters.mjs +6 -10
- package/dist/handlerReleaseCatalogRoutes.cjs +32 -15
- package/dist/handlerReleaseCatalogRoutes.mjs +32 -15
- package/dist/handlerTypes.d.cts +2 -55
- package/dist/handlerTypes.d.mts +2 -55
- package/dist/handlerVersionRoutes.cjs +20 -4
- package/dist/handlerVersionRoutes.mjs +20 -4
- package/dist/index.cjs +9 -9
- package/dist/index.d.cts +8 -9
- package/dist/index.d.mts +8 -9
- package/dist/index.mjs +3 -4
- package/dist/node.cjs +3 -6
- package/dist/node.d.cts +2 -2
- package/dist/node.d.mts +2 -2
- package/dist/node.mjs +4 -4
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/plugins/api-keys/index.cjs +9 -0
- package/dist/plugins/api-keys/index.d.cts +1 -0
- package/dist/plugins/api-keys/index.d.mts +1 -0
- package/dist/plugins/api-keys/index.mjs +2 -0
- package/dist/plugins/definePlugin.d.cts +2 -0
- package/dist/plugins/definePlugin.d.mts +2 -0
- package/dist/plugins/insights/index.cjs +9 -0
- package/dist/plugins/insights/index.d.cts +1 -0
- package/dist/plugins/insights/index.d.mts +1 -0
- package/dist/plugins/insights/index.mjs +2 -0
- package/dist/plugins/official.cjs +30 -0
- package/dist/plugins/official.mjs +29 -0
- package/dist/storageAccess.cjs +13 -10
- package/dist/storageAccess.mjs +13 -10
- package/dist/types/index.d.cts +2 -28
- package/dist/types/index.d.mts +2 -28
- package/package.json +26 -14
- package/dist/_virtual/_rolldown/runtime.cjs +0 -23
- package/dist/adapters/databaseConstraintErrors.cjs +0 -22
- package/dist/adapters/databaseConstraintErrors.mjs +0 -21
- package/dist/adapters/databasePluginUtils.cjs +0 -116
- package/dist/adapters/databasePluginUtils.mjs +0 -106
- package/dist/adapters/drizzleCrud.cjs +0 -311
- package/dist/adapters/drizzleCrud.mjs +0 -308
- package/dist/adapters/drizzleLazyDB.cjs +0 -106
- package/dist/adapters/drizzleLazyDB.mjs +0 -106
- package/dist/adapters/drizzleQuery.cjs +0 -69
- package/dist/adapters/drizzleQuery.mjs +0 -69
- package/dist/adapters/insightsTransaction.cjs +0 -22
- package/dist/adapters/insightsTransaction.mjs +0 -22
- package/dist/adapters/kyselyCrud.cjs +0 -305
- package/dist/adapters/kyselyCrud.mjs +0 -304
- package/dist/adapters/kyselyQuery.cjs +0 -56
- package/dist/adapters/kyselyQuery.mjs +0 -56
- package/dist/adapters/mongodbCollections.cjs +0 -38
- package/dist/adapters/mongodbCollections.mjs +0 -32
- package/dist/adapters/mongodbQuery.cjs +0 -94
- package/dist/adapters/mongodbQuery.mjs +0 -86
- package/dist/adapters/mongodbReads.cjs +0 -210
- package/dist/adapters/mongodbReads.mjs +0 -210
- package/dist/adapters/mongodbWrites.cjs +0 -148
- package/dist/adapters/mongodbWrites.mjs +0 -148
- package/dist/adapters/prismaQuery.cjs +0 -57
- package/dist/adapters/prismaQuery.mjs +0 -56
- package/dist/adapters/prismaRows.cjs +0 -219
- package/dist/adapters/prismaRows.mjs +0 -209
- package/dist/apiKeys.cjs +0 -143
- package/dist/apiKeys.d.cts +0 -49
- package/dist/apiKeys.d.mts +0 -49
- package/dist/apiKeys.mjs +0 -133
- package/dist/db/createBundleDiff.cjs +0 -144
- package/dist/db/createBundleDiff.d.cts +0 -16
- package/dist/db/createBundleDiff.d.mts +0 -16
- package/dist/db/createBundleDiff.mjs +0 -141
- package/dist/db/databasePluginCore.cjs +0 -137
- package/dist/db/databasePluginCore.mjs +0 -137
- package/dist/db/fixedMigrator.cjs +0 -79
- package/dist/db/fixedMigrator.mjs +0 -78
- package/dist/db/fixedMigratorMongo.cjs +0 -321
- package/dist/db/fixedMigratorMongo.mjs +0 -321
- package/dist/db/fixedMigratorShared.cjs +0 -23
- package/dist/db/fixedMigratorShared.mjs +0 -18
- package/dist/db/index.cjs +0 -27
- package/dist/db/index.d.cts +0 -12
- package/dist/db/index.d.mts +0 -12
- package/dist/db/index.mjs +0 -22
- package/dist/db/mongoMigrationExecution.cjs +0 -11
- package/dist/db/mongoMigrationExecution.mjs +0 -11
- package/dist/db/releaseCatalog.d.cts +0 -16
- package/dist/db/releaseCatalog.d.mts +0 -16
- package/dist/db/schema/insightsCollation.cjs +0 -14
- package/dist/db/schema/insightsCollation.mjs +0 -14
- package/dist/db/schema/mongodb.cjs +0 -25
- package/dist/db/schema/mongodb.mjs +0 -25
- package/dist/db/schema/registry.cjs +0 -21
- package/dist/db/schema/registry.mjs +0 -17
- package/dist/db/schema/sql.cjs +0 -105
- package/dist/db/schema/sql.mjs +0 -97
- package/dist/db/schema/sqlOperations.cjs +0 -27
- package/dist/db/schema/sqlOperations.mjs +0 -26
- package/dist/db/schemaGenerators.cjs +0 -275
- package/dist/db/schemaGenerators.mjs +0 -273
- package/dist/db/schemaReadiness.cjs +0 -26
- package/dist/db/schemaReadiness.d.cts +0 -9
- package/dist/db/schemaReadiness.d.mts +0 -9
- package/dist/db/schemaReadiness.mjs +0 -25
- package/dist/db/sqlMigrationExecution.cjs +0 -67
- package/dist/db/sqlMigrationExecution.mjs +0 -67
- package/dist/db/types.cjs +0 -22
- package/dist/db/types.d.cts +0 -118
- package/dist/db/types.d.mts +0 -118
- package/dist/db/types.mjs +0 -19
- package/dist/handlerBundleRoutes.cjs +0 -155
- package/dist/handlerBundleRoutes.mjs +0 -155
- package/dist/handlerReleaseManagementRoutes.cjs +0 -124
- package/dist/handlerReleaseManagementRoutes.mjs +0 -124
- package/dist/insights/domain.d.cts +0 -89
- package/dist/insights/domain.d.mts +0 -89
- package/dist/insights/errors.cjs +0 -15
- package/dist/insights/errors.mjs +0 -14
- package/dist/insights/eventInput.cjs +0 -155
- package/dist/insights/eventInput.mjs +0 -153
- package/dist/insights/provider.cjs +0 -314
- package/dist/insights/provider.d.cts +0 -6
- package/dist/insights/provider.d.mts +0 -6
- package/dist/insights/provider.mjs +0 -314
- package/dist/insights/queryInput.cjs +0 -93
- package/dist/insights/queryInput.mjs +0 -91
- package/dist/insights/routes.cjs +0 -58
- package/dist/insights/routes.mjs +0 -56
- package/dist/insights/types.d.cts +0 -32
- package/dist/insights/types.d.mts +0 -32
- package/dist/schema/dsl.cjs +0 -103
- package/dist/schema/dsl.mjs +0 -87
- package/dist/schema/index.cjs +0 -20
- package/dist/schema/index.mjs +0 -7
- package/dist/schema/settings.cjs +0 -9
- package/dist/schema/settings.mjs +0 -9
- package/dist/schema/types.cjs +0 -8
- package/dist/schema/types.mjs +0 -6
- package/dist/schema/v1_0_0.cjs +0 -406
- package/dist/schema/v1_0_0.mjs +0 -398
- package/src/adapters/databaseConstraintErrors.ts +0 -25
- package/src/adapters/databasePluginTestDatabase.ts +0 -120
- package/src/adapters/databasePluginUtils.spec.ts +0 -29
- package/src/adapters/databasePluginUtils.ts +0 -214
- package/src/adapters/drizzle.spec.ts +0 -336
- package/src/adapters/drizzle.ts +0 -162
- package/src/adapters/drizzleCrud.ts +0 -571
- package/src/adapters/drizzleLazyDB.ts +0 -271
- package/src/adapters/drizzleQuery.ts +0 -164
- package/src/adapters/insightsTransaction.ts +0 -32
- package/src/adapters/kysely.spec.ts +0 -174
- package/src/adapters/kysely.ts +0 -110
- package/src/adapters/kyselyCrud.ts +0 -709
- package/src/adapters/kyselyQuery.ts +0 -128
- package/src/adapters/mongodb.integration.spec.ts +0 -210
- package/src/adapters/mongodb.spec.ts +0 -209
- package/src/adapters/mongodb.ts +0 -138
- package/src/adapters/mongodbCollections.ts +0 -67
- package/src/adapters/mongodbQuery.ts +0 -255
- package/src/adapters/mongodbReads.ts +0 -380
- package/src/adapters/mongodbRows.spec.ts +0 -64
- package/src/adapters/mongodbRows.ts +0 -118
- package/src/adapters/mongodbTestClient.ts +0 -377
- package/src/adapters/mongodbTestFilter.ts +0 -169
- package/src/adapters/mongodbWrites.ts +0 -287
- package/src/adapters/prisma.spec.ts +0 -293
- package/src/adapters/prisma.ts +0 -565
- package/src/adapters/prismaQuery.ts +0 -129
- package/src/adapters/prismaRows.spec.ts +0 -98
- package/src/adapters/prismaRows.ts +0 -337
- package/src/adapters/prismaTestClient.ts +0 -413
- package/src/apiKeys.integration.spec.ts +0 -192
- package/src/apiKeys.spec.ts +0 -162
- package/src/apiKeys.ts +0 -220
- package/src/calculatePagination.ts +0 -34
- package/src/createHotUpdaterCore.ts +0 -246
- package/src/db/bundleRows.spec.ts +0 -164
- package/src/db/bundleRows.ts +0 -10
- package/src/db/createBundleDiff.spec.ts +0 -450
- package/src/db/createBundleDiff.ts +0 -364
- package/src/db/databasePluginCore.spec.ts +0 -62
- package/src/db/databasePluginCore.testFixtures.ts +0 -76
- package/src/db/databasePluginCore.ts +0 -185
- package/src/db/databasePluginUpdateCheck.bench.ts +0 -110
- package/src/db/fixedMigrator.spec.ts +0 -296
- package/src/db/fixedMigrator.ts +0 -147
- package/src/db/fixedMigratorMongo.spec.ts +0 -239
- package/src/db/fixedMigratorMongo.ts +0 -425
- package/src/db/fixedMigratorShared.ts +0 -36
- package/src/db/hotUpdaterSchema.ts +0 -5
- package/src/db/index.spec.ts +0 -1269
- package/src/db/index.ts +0 -47
- package/src/db/mongoMigrationExecution.ts +0 -23
- package/src/db/node-sqlite.d.ts +0 -25
- package/src/db/releaseCatalog.ts +0 -148
- package/src/db/schema/definitions.ts +0 -1
- package/src/db/schema/insightsCollation.ts +0 -21
- package/src/db/schema/mongodb.ts +0 -40
- package/src/db/schema/registry.ts +0 -55
- package/src/db/schema/sql.ts +0 -244
- package/src/db/schema/sqlOperations.ts +0 -63
- package/src/db/schema/types.ts +0 -1
- package/src/db/schemaGenerators.ts +0 -494
- package/src/db/schemaReadiness.ts +0 -34
- package/src/db/sqlMigrationExecution.spec.ts +0 -65
- package/src/db/sqlMigrationExecution.ts +0 -108
- package/src/db/types.spec.ts +0 -63
- package/src/db/types.ts +0 -228
- package/src/db/updateArtifacts.spec.ts +0 -359
- package/src/db/updateArtifacts.ts +0 -541
- package/src/handler-standalone.integration.spec.ts +0 -528
- package/src/handler.spec.ts +0 -190
- package/src/handler.testFixtures.ts +0 -30
- package/src/handler.ts +0 -245
- package/src/handlerAuth.integration.spec.ts +0 -33
- package/src/handlerBundleRoutes.ts +0 -259
- package/src/handlerErrors.ts +0 -7
- package/src/handlerManagement.spec.ts +0 -262
- package/src/handlerParameters.ts +0 -105
- package/src/handlerReleaseCatalogRoutes.ts +0 -154
- package/src/handlerReleaseManagementRoutes.ts +0 -213
- package/src/handlerTypes.ts +0 -96
- package/src/handlerVersionRoutes.ts +0 -12
- package/src/index.ts +0 -30
- package/src/insights/domain.ts +0 -103
- package/src/insights/errors.ts +0 -11
- package/src/insights/eventInput.ts +0 -225
- package/src/insights/insights.integration.spec.ts +0 -381
- package/src/insights/provider.spec.ts +0 -385
- package/src/insights/provider.ts +0 -591
- package/src/insights/queryInput.ts +0 -141
- package/src/insights/routes.ts +0 -104
- package/src/insights/types.ts +0 -55
- package/src/internalRouter.ts +0 -104
- package/src/node.spec.ts +0 -119
- package/src/node.ts +0 -111
- package/src/releaseCatalogRoutes.integration.spec.ts +0 -238
- package/src/runtime.spec.ts +0 -194
- package/src/runtime.testFixtures.ts +0 -71
- package/src/schema/dsl-all-versions.spec.ts +0 -37
- package/src/schema/dsl.ts +0 -187
- package/src/schema/index.ts +0 -10
- package/src/schema/settings.ts +0 -15
- package/src/schema/types.ts +0 -79
- package/src/schema/v1_0_0.spec.ts +0 -220
- package/src/schema/v1_0_0.ts +0 -529
- package/src/storageAccess.spec.ts +0 -152
- package/src/storageAccess.ts +0 -141
- package/src/types/index.ts +0 -34
- package/src/version.ts +0 -3
|
@@ -1,103 +1,84 @@
|
|
|
1
|
+
const require_clientPlugins = require("./assembly/clientPlugins.cjs");
|
|
2
|
+
const require_assemblePlugins = require("./assembly/assemblePlugins.cjs");
|
|
1
3
|
const require_handler = require("./handler.cjs");
|
|
2
|
-
const require_provider = require("./insights/provider.cjs");
|
|
3
|
-
const require_apiKeys = require("./apiKeys.cjs");
|
|
4
|
-
const require_databasePluginCore = require("./db/databasePluginCore.cjs");
|
|
5
|
-
const require_schemaReadiness = require("./db/schemaReadiness.cjs");
|
|
6
|
-
const require_types = require("./db/types.cjs");
|
|
7
4
|
const require_storageAccess = require("./storageAccess.cjs");
|
|
8
5
|
let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
|
|
9
6
|
//#region src/createHotUpdaterCore.ts
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
const isRecord = (value) => typeof value === "object" && value !== null;
|
|
8
|
+
const isAdapter = (value) => isRecord(value) && [
|
|
9
|
+
"fits",
|
|
10
|
+
"get",
|
|
11
|
+
"query",
|
|
12
|
+
"write"
|
|
13
|
+
].every((method) => typeof value[method] === "function");
|
|
14
|
+
/** The configured database, when it runs on the storage engine. */
|
|
15
|
+
const databaseOf = (value) => {
|
|
16
|
+
if (isRecord(value) && typeof value.name === "string") {
|
|
17
|
+
if (isAdapter(value.adapter)) return value;
|
|
18
|
+
if ("core" in value && "fetchAdmin" in value) throw new _hot_updater_plugin_core.HotUpdaterConfigError("standaloneRepository reaches a server's admin API from the CLI and console. createHotUpdater needs the server's own database, such as kyselyAdapter(...).");
|
|
19
|
+
}
|
|
20
|
+
throw new _hot_updater_plugin_core.HotUpdaterConfigError("database must be a Hot Updater 1.0 database, such as kyselyAdapter(...) or postgres(...). Upgrade the provider package that created it.");
|
|
19
21
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
/** `"public"`, or nothing; a `clientAccess` object says what replaced it. */
|
|
23
|
+
const isPublic = (value) => {
|
|
24
|
+
if (value === void 0) return false;
|
|
25
|
+
if (value === "public") return true;
|
|
26
|
+
throw new _hot_updater_plugin_core.HotUpdaterConfigError(isRecord(value) ? "clientAccess objects were removed in 1.0. Set clientAccess: \"public\", or add a plugin that provides clientAuth to plugins." : "clientAccess must be \"public\"; to protect client routes, add a plugin that provides clientAuth to plugins.");
|
|
27
|
+
};
|
|
28
|
+
function createHotUpdater(options) {
|
|
25
29
|
for (const key of ["authorityId", "catalogId"]) if (Object.hasOwn(options, key)) throw new TypeError(`Remove ${key} from createHotUpdater options. Catalog identity is managed internally.`);
|
|
26
|
-
const database = options.database;
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
async findInstallations(input) {
|
|
52
|
-
await assertSchemaReady();
|
|
53
|
-
return plugin.models.insights.findInstallations(input);
|
|
54
|
-
},
|
|
55
|
-
async countInstallations(input) {
|
|
56
|
-
await assertSchemaReady();
|
|
57
|
-
return plugin.models.insights.countInstallations(input);
|
|
58
|
-
},
|
|
59
|
-
async countEvents(input) {
|
|
60
|
-
await assertSchemaReady();
|
|
61
|
-
return plugin.models.insights.countEvents(input);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
const apiKeys = require_apiKeys.createApiKeyManagement({
|
|
65
|
-
apiKeys: plugin.models.apiKeys,
|
|
66
|
-
beforeOperation: assertSchemaReady
|
|
67
|
-
});
|
|
68
|
-
const handlers = require_handler.createHotUpdaterHandlers(core.api, insights, clientAccess.type === "api-key" ? {
|
|
69
|
-
authenticate: (request) => require_apiKeys.authenticateApiKey({
|
|
70
|
-
apiKeys: plugin.models.apiKeys,
|
|
71
|
-
beforeLookup: assertSchemaReady,
|
|
72
|
-
headerName: clientAccess.headerName,
|
|
73
|
-
request
|
|
74
|
-
}),
|
|
75
|
-
headerName: clientAccess.headerName
|
|
76
|
-
} : void 0, downloadStorageObject);
|
|
77
|
-
const api = Object.assign({
|
|
78
|
-
adapterName: adapterCapabilities.adapterName ?? core.adapterName,
|
|
79
|
-
insights,
|
|
80
|
-
apiKeys,
|
|
81
|
-
handlers
|
|
82
|
-
}, core.api);
|
|
83
|
-
Object.defineProperty(api, hotUpdaterCoreMetadata, {
|
|
84
|
-
enumerable: false,
|
|
85
|
-
value: {
|
|
86
|
-
adapterCapabilities,
|
|
87
|
-
core
|
|
88
|
-
}
|
|
30
|
+
const database = databaseOf(options.database);
|
|
31
|
+
const storage = Object.freeze([...options.storage ?? []]);
|
|
32
|
+
const { downloadStorageObject, readStorageText, resolveFileUrl } = require_storageAccess.createStorageAccess(storage);
|
|
33
|
+
const publicClients = isPublic(options.clientAccess);
|
|
34
|
+
const configured = Object.freeze([...options.plugins ?? []]);
|
|
35
|
+
const plugins = require_assemblePlugins.assemblePlugins(configured, database, { storage: {
|
|
36
|
+
readStorageText,
|
|
37
|
+
resolveFileUrl
|
|
38
|
+
} });
|
|
39
|
+
const clientPlugins = Object.freeze(require_clientPlugins.clientPluginsOf(configured));
|
|
40
|
+
const clientAuth = plugins.clientAuth;
|
|
41
|
+
if (clientAuth !== void 0 && publicClients) throw new _hot_updater_plugin_core.HotUpdaterConfigError(`Plugin "${clientAuth.plugin}" provides clientAuth, so remove clientAccess.`);
|
|
42
|
+
if (clientAuth === void 0 && !publicClients) throw new _hot_updater_plugin_core.HotUpdaterConfigError("Set clientAccess to \"public\", or add a plugin that provides clientAuth.");
|
|
43
|
+
const varyHeaders = Object.freeze((clientAuth?.varyHeaders ?? []).map((header) => header.toLowerCase()));
|
|
44
|
+
const clientPolicy = clientAuth === void 0 ? void 0 : {
|
|
45
|
+
varyHeaders,
|
|
46
|
+
authenticate: (request) => clientAuth.authenticate(request.headers)
|
|
47
|
+
};
|
|
48
|
+
const handlers = require_handler.createHotUpdaterHandlers({
|
|
49
|
+
api: { core: plugins.core },
|
|
50
|
+
...clientPolicy === void 0 ? {} : { clientPolicy },
|
|
51
|
+
downloadStorageObject,
|
|
52
|
+
endpoints: plugins.endpoints,
|
|
53
|
+
plugins: Object.keys(plugins.api)
|
|
89
54
|
});
|
|
55
|
+
let serving = false;
|
|
90
56
|
return {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
57
|
+
adapterName: database.name,
|
|
58
|
+
get handlers() {
|
|
59
|
+
if (!serving) {
|
|
60
|
+
for (const adapter of storage) (0, _hot_updater_plugin_core.assertStorageOperations)(adapter, ["get", "getDownloadUrl"]);
|
|
61
|
+
serving = true;
|
|
62
|
+
}
|
|
63
|
+
return handlers;
|
|
64
|
+
},
|
|
65
|
+
core: plugins.core,
|
|
66
|
+
api: plugins.api,
|
|
67
|
+
flush: plugins.flush,
|
|
68
|
+
database,
|
|
69
|
+
storage,
|
|
70
|
+
plugins: configured,
|
|
71
|
+
clientPlugins,
|
|
72
|
+
clientEndpoints: Object.freeze(plugins.endpoints.filter((endpoint) => endpoint.access === "client").map(({ plugin, method, path }) => Object.freeze({
|
|
73
|
+
plugin,
|
|
74
|
+
method,
|
|
75
|
+
path
|
|
76
|
+
}))),
|
|
77
|
+
...clientAuth === void 0 ? {} : { clientAuth: Object.freeze({
|
|
78
|
+
plugin: clientAuth.plugin,
|
|
79
|
+
varyHeaders
|
|
80
|
+
}) }
|
|
94
81
|
};
|
|
95
82
|
}
|
|
96
|
-
function createHotUpdater(options) {
|
|
97
|
-
return createHotUpdaterCore(options).api;
|
|
98
|
-
}
|
|
99
83
|
//#endregion
|
|
100
84
|
exports.createHotUpdater = createHotUpdater;
|
|
101
|
-
exports.createHotUpdaterCore = createHotUpdaterCore;
|
|
102
|
-
exports.getHotUpdaterCoreMetadata = getHotUpdaterCoreMetadata;
|
|
103
|
-
exports.hotUpdaterCoreMetadata = hotUpdaterCoreMetadata;
|
|
@@ -1,57 +1,125 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CoreApi } from "./core/api.cjs";
|
|
2
|
+
import { AnyHotUpdaterPlugin, PluginApis } from "./plugins/definePlugin.cjs";
|
|
2
3
|
import { HotUpdaterHandlers } from "./handlerTypes.cjs";
|
|
3
|
-
import { InsightsProvider } from "./insights/types.cjs";
|
|
4
4
|
import "./handler.cjs";
|
|
5
|
-
import {
|
|
6
|
-
import { StoragePlugin } from "@hot-updater/plugin-core";
|
|
5
|
+
import { PluginClientPlugin, StorageAdapter, ToolingDatabase } from "@hot-updater/plugin-core";
|
|
7
6
|
//#region src/createHotUpdaterCore.d.ts
|
|
8
|
-
|
|
7
|
+
/** A plugin's endpoint on `handlers.client`. */
|
|
8
|
+
interface ClientEndpoint {
|
|
9
|
+
/** The id of the plugin that adds it. */
|
|
10
|
+
readonly plugin: string;
|
|
11
|
+
readonly method: string;
|
|
12
|
+
/** Relative to the handler's mount; `:name` segments are parameters. */
|
|
13
|
+
readonly path: string;
|
|
14
|
+
}
|
|
15
|
+
/** The plugin that decides who may call client routes. */
|
|
16
|
+
interface ClientAuthProvider {
|
|
17
|
+
/** Its id. */
|
|
18
|
+
readonly plugin: string;
|
|
19
|
+
/**
|
|
20
|
+
* The request headers its decision reads, lowercase: what a cache in
|
|
21
|
+
* front of the server, such as a CDN, keys client routes on.
|
|
22
|
+
*/
|
|
23
|
+
readonly varyHeaders: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
type RuntimeHotUpdaterAPI<TPlugins extends readonly AnyHotUpdaterPlugin[] = readonly AnyHotUpdaterPlugin[]> = {
|
|
26
|
+
/**
|
|
27
|
+
* The routes a host mounts. On first access every storage adapter must
|
|
28
|
+
* serve downloads (`get` and `getDownloadUrl`), so a server fails where it
|
|
29
|
+
* mounts them, while tooling that only reads the definition, such as the
|
|
30
|
+
* CLI, can list storage that only uploads.
|
|
31
|
+
*/
|
|
9
32
|
readonly handlers: HotUpdaterHandlers;
|
|
10
|
-
readonly adapterName: string;
|
|
11
33
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
34
|
+
* Core's reads and typed writes: bundles, Releases, Catalogs, and
|
|
35
|
+
* channels. The CLI and the console write through it, so their writes
|
|
36
|
+
* take the server's path: the plugins' schema fence, pruning during
|
|
37
|
+
* writes, the storage's file URLs, and the database's CDN purge.
|
|
15
38
|
*/
|
|
16
|
-
readonly
|
|
39
|
+
readonly core: CoreApi;
|
|
40
|
+
/** Each plugin's API by plugin id, which the CLI's and the console's plugin features call. */
|
|
41
|
+
readonly api: PluginApis<TPlugins>;
|
|
42
|
+
/** The database's name, which `hot-updater db` commands read. */
|
|
43
|
+
readonly adapterName: string;
|
|
17
44
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
45
|
+
* Applies aggregate changes the database batches that are still pending:
|
|
46
|
+
* this process's buffer, and the log rows no compaction has merged yet.
|
|
47
|
+
* A long-lived server with `aggregateBatching: { mode: "memory" }` calls
|
|
48
|
+
* it before it exits.
|
|
21
49
|
*/
|
|
22
|
-
readonly
|
|
23
|
-
};
|
|
24
|
-
type HotUpdaterAPI = RuntimeHotUpdaterAPI;
|
|
25
|
-
type ClientAccessPolicy = {
|
|
50
|
+
readonly flush: () => Promise<void>;
|
|
26
51
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
52
|
+
* The database as configured. `hot-updater db` runs its tooling
|
|
53
|
+
* (`createMigrator`, `generateSchema`), and tooling done with the server
|
|
54
|
+
* closes it (`dispose`).
|
|
29
55
|
*/
|
|
30
|
-
readonly
|
|
31
|
-
|
|
56
|
+
readonly database: ToolingDatabase;
|
|
57
|
+
/** The storage as configured, in order, as a frozen copy. */
|
|
58
|
+
readonly storage: readonly StorageAdapter[];
|
|
59
|
+
/** The plugins as configured, as a frozen copy, whose tables tooling creates. */
|
|
60
|
+
readonly plugins: TPlugins;
|
|
32
61
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
62
|
+
* The client plugins an app adds to `HotUpdater.init`'s `plugins` for
|
|
63
|
+
* these plugins, each once, in plugin order: what init prints.
|
|
35
64
|
*/
|
|
36
|
-
readonly
|
|
65
|
+
readonly clientPlugins: readonly PluginClientPlugin[];
|
|
37
66
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* responses include it in `Vary` to preserve cache isolation.
|
|
67
|
+
* The plugins' endpoints on `handlers.client`, which a host that routes
|
|
68
|
+
* by path, such as a CDN in front of the server, sends to it.
|
|
41
69
|
*/
|
|
70
|
+
readonly clientEndpoints: readonly ClientEndpoint[];
|
|
71
|
+
/** The plugin that guards client routes; absent when they are public. */
|
|
72
|
+
readonly clientAuth?: ClientAuthProvider;
|
|
73
|
+
};
|
|
74
|
+
type HotUpdaterAPI = RuntimeHotUpdaterAPI;
|
|
75
|
+
declare const REMOVED_CLIENT_ACCESS = "clientAccess objects were removed in 1.0: set clientAccess: \"public\", or add a plugin that provides clientAuth";
|
|
76
|
+
/**
|
|
77
|
+
* A `clientAccess` object from before 1.0. Its `type` names the fix, so
|
|
78
|
+
* TypeScript reports it where the object is written.
|
|
79
|
+
*/
|
|
80
|
+
interface RemovedClientAccess {
|
|
81
|
+
readonly type: typeof REMOVED_CLIENT_ACCESS;
|
|
42
82
|
readonly headerName?: string;
|
|
83
|
+
}
|
|
84
|
+
type ClientAccessPolicy =
|
|
85
|
+
/** Leaves client routes public; required when no plugin provides clientAuth. */
|
|
86
|
+
"public" | RemovedClientAccess;
|
|
87
|
+
type ProvidesClientAuth<TPlugin> = TPlugin extends {
|
|
88
|
+
readonly provides?: infer TProvides;
|
|
89
|
+
} ? TProvides extends {
|
|
90
|
+
readonly clientAuth: true;
|
|
91
|
+
} ? true : false : false;
|
|
92
|
+
type ClientAuthIds<TPlugins extends readonly unknown[], TFound extends string[] = []> = TPlugins extends readonly [infer THead, ...infer TTail] ? ClientAuthIds<TTail, ProvidesClientAuth<THead> extends true ? [...TFound, THead extends {
|
|
93
|
+
readonly id: infer TId extends string;
|
|
94
|
+
} ? TId : string] : TFound> : TFound;
|
|
95
|
+
type JoinIds<TIds extends string[]> = TIds extends [infer TFirst extends string, ...infer TRest extends string[]] ? TRest extends [] ? `"${TFirst}"` : `"${TFirst}", ${JoinIds<TRest>}` : "";
|
|
96
|
+
/**
|
|
97
|
+
* Client routes have one policy source: exactly one plugin that provides
|
|
98
|
+
* clientAuth, or an explicit `clientAccess`. Tuples are counted here; an
|
|
99
|
+
* untyped list that may hold a clientAuth plugin is left to startup.
|
|
100
|
+
*/
|
|
101
|
+
type ClientAccessRule<TPlugins extends readonly AnyHotUpdaterPlugin[]> = number extends TPlugins["length"] ? true extends ProvidesClientAuth<TPlugins[number]> ? {
|
|
102
|
+
readonly clientAccess?: "Remove clientAccess: a plugin in this list may provide clientAuth";
|
|
103
|
+
} : {
|
|
104
|
+
readonly clientAccess: ClientAccessPolicy;
|
|
105
|
+
} : ClientAuthIds<TPlugins> extends [] ? {
|
|
106
|
+
readonly clientAccess: ClientAccessPolicy;
|
|
107
|
+
} : ClientAuthIds<TPlugins> extends [infer TId extends string] ? {
|
|
108
|
+
readonly clientAccess?: `Remove clientAccess: plugin "${TId}" provides clientAuth`;
|
|
109
|
+
} : {
|
|
110
|
+
readonly clientAuth: `Keep one clientAuth plugin: ${JoinIds<ClientAuthIds<TPlugins>>} all provide it`;
|
|
43
111
|
};
|
|
44
|
-
|
|
45
|
-
|
|
112
|
+
type CreateHotUpdaterOptions<TPlugins extends readonly AnyHotUpdaterPlugin[] = readonly []> = {
|
|
113
|
+
/** A provider's database on the storage engine, such as `kyselyAdapter(...)` or `postgres(...)`. */
|
|
114
|
+
readonly database: ToolingDatabase;
|
|
46
115
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* `/version`, storage downloads, and admin-handler routes are unaffected.
|
|
116
|
+
* Where bundles are stored: the server reads and signs the URIs of each
|
|
117
|
+
* adapter's protocol.
|
|
50
118
|
*/
|
|
51
|
-
readonly
|
|
52
|
-
/**
|
|
53
|
-
readonly
|
|
54
|
-
}
|
|
55
|
-
declare function createHotUpdater(options: CreateHotUpdaterOptions): RuntimeHotUpdaterAPI
|
|
119
|
+
readonly storage?: readonly StorageAdapter[];
|
|
120
|
+
/** The plugins the server runs; at most one provides clientAuth. Defaults to none. */
|
|
121
|
+
readonly plugins?: TPlugins;
|
|
122
|
+
} & ClientAccessRule<TPlugins>;
|
|
123
|
+
declare function createHotUpdater<const TPlugins extends readonly AnyHotUpdaterPlugin[] = readonly []>(options: CreateHotUpdaterOptions<TPlugins>): RuntimeHotUpdaterAPI<NoInfer<TPlugins>>;
|
|
56
124
|
//#endregion
|
|
57
|
-
export { ClientAccessPolicy, CreateHotUpdaterOptions, HotUpdaterAPI, RuntimeHotUpdaterAPI, createHotUpdater };
|
|
125
|
+
export { ClientAccessPolicy, ClientAccessRule, ClientAuthProvider, ClientEndpoint, CreateHotUpdaterOptions, HotUpdaterAPI, RemovedClientAccess, RuntimeHotUpdaterAPI, createHotUpdater };
|
|
@@ -1,57 +1,125 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CoreApi } from "./core/api.mjs";
|
|
2
|
+
import { AnyHotUpdaterPlugin, PluginApis } from "./plugins/definePlugin.mjs";
|
|
2
3
|
import { HotUpdaterHandlers } from "./handlerTypes.mjs";
|
|
3
|
-
import { InsightsProvider } from "./insights/types.mjs";
|
|
4
4
|
import "./handler.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import { StoragePlugin } from "@hot-updater/plugin-core";
|
|
5
|
+
import { PluginClientPlugin, StorageAdapter, ToolingDatabase } from "@hot-updater/plugin-core";
|
|
7
6
|
//#region src/createHotUpdaterCore.d.ts
|
|
8
|
-
|
|
7
|
+
/** A plugin's endpoint on `handlers.client`. */
|
|
8
|
+
interface ClientEndpoint {
|
|
9
|
+
/** The id of the plugin that adds it. */
|
|
10
|
+
readonly plugin: string;
|
|
11
|
+
readonly method: string;
|
|
12
|
+
/** Relative to the handler's mount; `:name` segments are parameters. */
|
|
13
|
+
readonly path: string;
|
|
14
|
+
}
|
|
15
|
+
/** The plugin that decides who may call client routes. */
|
|
16
|
+
interface ClientAuthProvider {
|
|
17
|
+
/** Its id. */
|
|
18
|
+
readonly plugin: string;
|
|
19
|
+
/**
|
|
20
|
+
* The request headers its decision reads, lowercase: what a cache in
|
|
21
|
+
* front of the server, such as a CDN, keys client routes on.
|
|
22
|
+
*/
|
|
23
|
+
readonly varyHeaders: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
type RuntimeHotUpdaterAPI<TPlugins extends readonly AnyHotUpdaterPlugin[] = readonly AnyHotUpdaterPlugin[]> = {
|
|
26
|
+
/**
|
|
27
|
+
* The routes a host mounts. On first access every storage adapter must
|
|
28
|
+
* serve downloads (`get` and `getDownloadUrl`), so a server fails where it
|
|
29
|
+
* mounts them, while tooling that only reads the definition, such as the
|
|
30
|
+
* CLI, can list storage that only uploads.
|
|
31
|
+
*/
|
|
9
32
|
readonly handlers: HotUpdaterHandlers;
|
|
10
|
-
readonly adapterName: string;
|
|
11
33
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
34
|
+
* Core's reads and typed writes: bundles, Releases, Catalogs, and
|
|
35
|
+
* channels. The CLI and the console write through it, so their writes
|
|
36
|
+
* take the server's path: the plugins' schema fence, pruning during
|
|
37
|
+
* writes, the storage's file URLs, and the database's CDN purge.
|
|
15
38
|
*/
|
|
16
|
-
readonly
|
|
39
|
+
readonly core: CoreApi;
|
|
40
|
+
/** Each plugin's API by plugin id, which the CLI's and the console's plugin features call. */
|
|
41
|
+
readonly api: PluginApis<TPlugins>;
|
|
42
|
+
/** The database's name, which `hot-updater db` commands read. */
|
|
43
|
+
readonly adapterName: string;
|
|
17
44
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
45
|
+
* Applies aggregate changes the database batches that are still pending:
|
|
46
|
+
* this process's buffer, and the log rows no compaction has merged yet.
|
|
47
|
+
* A long-lived server with `aggregateBatching: { mode: "memory" }` calls
|
|
48
|
+
* it before it exits.
|
|
21
49
|
*/
|
|
22
|
-
readonly
|
|
23
|
-
};
|
|
24
|
-
type HotUpdaterAPI = RuntimeHotUpdaterAPI;
|
|
25
|
-
type ClientAccessPolicy = {
|
|
50
|
+
readonly flush: () => Promise<void>;
|
|
26
51
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
52
|
+
* The database as configured. `hot-updater db` runs its tooling
|
|
53
|
+
* (`createMigrator`, `generateSchema`), and tooling done with the server
|
|
54
|
+
* closes it (`dispose`).
|
|
29
55
|
*/
|
|
30
|
-
readonly
|
|
31
|
-
|
|
56
|
+
readonly database: ToolingDatabase;
|
|
57
|
+
/** The storage as configured, in order, as a frozen copy. */
|
|
58
|
+
readonly storage: readonly StorageAdapter[];
|
|
59
|
+
/** The plugins as configured, as a frozen copy, whose tables tooling creates. */
|
|
60
|
+
readonly plugins: TPlugins;
|
|
32
61
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
62
|
+
* The client plugins an app adds to `HotUpdater.init`'s `plugins` for
|
|
63
|
+
* these plugins, each once, in plugin order: what init prints.
|
|
35
64
|
*/
|
|
36
|
-
readonly
|
|
65
|
+
readonly clientPlugins: readonly PluginClientPlugin[];
|
|
37
66
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* responses include it in `Vary` to preserve cache isolation.
|
|
67
|
+
* The plugins' endpoints on `handlers.client`, which a host that routes
|
|
68
|
+
* by path, such as a CDN in front of the server, sends to it.
|
|
41
69
|
*/
|
|
70
|
+
readonly clientEndpoints: readonly ClientEndpoint[];
|
|
71
|
+
/** The plugin that guards client routes; absent when they are public. */
|
|
72
|
+
readonly clientAuth?: ClientAuthProvider;
|
|
73
|
+
};
|
|
74
|
+
type HotUpdaterAPI = RuntimeHotUpdaterAPI;
|
|
75
|
+
declare const REMOVED_CLIENT_ACCESS = "clientAccess objects were removed in 1.0: set clientAccess: \"public\", or add a plugin that provides clientAuth";
|
|
76
|
+
/**
|
|
77
|
+
* A `clientAccess` object from before 1.0. Its `type` names the fix, so
|
|
78
|
+
* TypeScript reports it where the object is written.
|
|
79
|
+
*/
|
|
80
|
+
interface RemovedClientAccess {
|
|
81
|
+
readonly type: typeof REMOVED_CLIENT_ACCESS;
|
|
42
82
|
readonly headerName?: string;
|
|
83
|
+
}
|
|
84
|
+
type ClientAccessPolicy =
|
|
85
|
+
/** Leaves client routes public; required when no plugin provides clientAuth. */
|
|
86
|
+
"public" | RemovedClientAccess;
|
|
87
|
+
type ProvidesClientAuth<TPlugin> = TPlugin extends {
|
|
88
|
+
readonly provides?: infer TProvides;
|
|
89
|
+
} ? TProvides extends {
|
|
90
|
+
readonly clientAuth: true;
|
|
91
|
+
} ? true : false : false;
|
|
92
|
+
type ClientAuthIds<TPlugins extends readonly unknown[], TFound extends string[] = []> = TPlugins extends readonly [infer THead, ...infer TTail] ? ClientAuthIds<TTail, ProvidesClientAuth<THead> extends true ? [...TFound, THead extends {
|
|
93
|
+
readonly id: infer TId extends string;
|
|
94
|
+
} ? TId : string] : TFound> : TFound;
|
|
95
|
+
type JoinIds<TIds extends string[]> = TIds extends [infer TFirst extends string, ...infer TRest extends string[]] ? TRest extends [] ? `"${TFirst}"` : `"${TFirst}", ${JoinIds<TRest>}` : "";
|
|
96
|
+
/**
|
|
97
|
+
* Client routes have one policy source: exactly one plugin that provides
|
|
98
|
+
* clientAuth, or an explicit `clientAccess`. Tuples are counted here; an
|
|
99
|
+
* untyped list that may hold a clientAuth plugin is left to startup.
|
|
100
|
+
*/
|
|
101
|
+
type ClientAccessRule<TPlugins extends readonly AnyHotUpdaterPlugin[]> = number extends TPlugins["length"] ? true extends ProvidesClientAuth<TPlugins[number]> ? {
|
|
102
|
+
readonly clientAccess?: "Remove clientAccess: a plugin in this list may provide clientAuth";
|
|
103
|
+
} : {
|
|
104
|
+
readonly clientAccess: ClientAccessPolicy;
|
|
105
|
+
} : ClientAuthIds<TPlugins> extends [] ? {
|
|
106
|
+
readonly clientAccess: ClientAccessPolicy;
|
|
107
|
+
} : ClientAuthIds<TPlugins> extends [infer TId extends string] ? {
|
|
108
|
+
readonly clientAccess?: `Remove clientAccess: plugin "${TId}" provides clientAuth`;
|
|
109
|
+
} : {
|
|
110
|
+
readonly clientAuth: `Keep one clientAuth plugin: ${JoinIds<ClientAuthIds<TPlugins>>} all provide it`;
|
|
43
111
|
};
|
|
44
|
-
|
|
45
|
-
|
|
112
|
+
type CreateHotUpdaterOptions<TPlugins extends readonly AnyHotUpdaterPlugin[] = readonly []> = {
|
|
113
|
+
/** A provider's database on the storage engine, such as `kyselyAdapter(...)` or `postgres(...)`. */
|
|
114
|
+
readonly database: ToolingDatabase;
|
|
46
115
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* `/version`, storage downloads, and admin-handler routes are unaffected.
|
|
116
|
+
* Where bundles are stored: the server reads and signs the URIs of each
|
|
117
|
+
* adapter's protocol.
|
|
50
118
|
*/
|
|
51
|
-
readonly
|
|
52
|
-
/**
|
|
53
|
-
readonly
|
|
54
|
-
}
|
|
55
|
-
declare function createHotUpdater(options: CreateHotUpdaterOptions): RuntimeHotUpdaterAPI
|
|
119
|
+
readonly storage?: readonly StorageAdapter[];
|
|
120
|
+
/** The plugins the server runs; at most one provides clientAuth. Defaults to none. */
|
|
121
|
+
readonly plugins?: TPlugins;
|
|
122
|
+
} & ClientAccessRule<TPlugins>;
|
|
123
|
+
declare function createHotUpdater<const TPlugins extends readonly AnyHotUpdaterPlugin[] = readonly []>(options: CreateHotUpdaterOptions<TPlugins>): RuntimeHotUpdaterAPI<NoInfer<TPlugins>>;
|
|
56
124
|
//#endregion
|
|
57
|
-
export { ClientAccessPolicy, CreateHotUpdaterOptions, HotUpdaterAPI, RuntimeHotUpdaterAPI, createHotUpdater };
|
|
125
|
+
export { ClientAccessPolicy, ClientAccessRule, ClientAuthProvider, ClientEndpoint, CreateHotUpdaterOptions, HotUpdaterAPI, RemovedClientAccess, RuntimeHotUpdaterAPI, createHotUpdater };
|