bazis 0.100.0 → 0.100.1
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/core/infra/connectors/codex/CodexAppServerClient.ts +1 -1
- package/core/infra/connectors/opensearch.ts +3 -2
- package/core/infra/connectors/postgres.ts +3 -2
- package/core/infra/connectors/redis.ts +3 -2
- package/core/orm/OrmHostedPlan.validator.ts +3 -3
- package/core/orm/strictSchemaHostedIdentity.ts +16 -1
- package/package.json +1 -1
|
@@ -232,7 +232,7 @@ export class CodexAppServerClient implements CodexClient {
|
|
|
232
232
|
if (method === "account/updated") this.modelCache = undefined;
|
|
233
233
|
}, () => { this.clearLogin(); this.modelCache = undefined; });
|
|
234
234
|
const initialized = await client.request("initialize", {
|
|
235
|
-
clientInfo: { name: "bazis", title: "Bazis", version: "0.100.
|
|
235
|
+
clientInfo: { name: "bazis", title: "Bazis", version: "0.100.1" }, capabilities: { experimentalApi: true },
|
|
236
236
|
}, 15_000, signal);
|
|
237
237
|
if (resolve(text(initialized.codexHome, 4096)) !== this.paths.home) throw new CodexError("PROTOCOL_ERROR");
|
|
238
238
|
client.notify("initialized");
|
|
@@ -3,6 +3,7 @@ import type { AppConfig, ConfigRegistry, Secret } from "../../kernel";
|
|
|
3
3
|
import { reader, requireValue, settingNames } from "../connectorConfig";
|
|
4
4
|
import { errorMessage, InfraError, type InfraConnector } from "../InfraConnector";
|
|
5
5
|
import { redactSensitive, redactSensitiveText } from "../../../library/redaction";
|
|
6
|
+
import { identifyConnector } from "../connectorIdentity";
|
|
6
7
|
|
|
7
8
|
/** Default cluster request timeout (ms): fail fast instead of hanging. */
|
|
8
9
|
const DEFAULT_OPENSEARCH_TIMEOUT_MS = 5000;
|
|
@@ -295,7 +296,7 @@ export function openSearchConnect<T extends OpenSearchConfigShape>(
|
|
|
295
296
|
options: OpenSearchConnectorOptions = {},
|
|
296
297
|
): InfraConnector<OpenSearchClient> {
|
|
297
298
|
const settings = new WeakMap<OpenSearchClient, string[]>();
|
|
298
|
-
return {
|
|
299
|
+
return identifyConnector({
|
|
299
300
|
token: options.token ?? IOpenSearch,
|
|
300
301
|
config,
|
|
301
302
|
create(configs) {
|
|
@@ -334,5 +335,5 @@ export function openSearchConnect<T extends OpenSearchConfigShape>(
|
|
|
334
335
|
healthCheck(client, signal) {
|
|
335
336
|
return client.ping(signal);
|
|
336
337
|
},
|
|
337
|
-
};
|
|
338
|
+
}, "opensearch");
|
|
338
339
|
}
|
|
@@ -3,6 +3,7 @@ import { createToken, type InjectionToken } from "../../di";
|
|
|
3
3
|
import type { AppConfig, ConfigRegistry, Secret } from "../../kernel";
|
|
4
4
|
import { reader, requireValue, settingNames } from "../connectorConfig";
|
|
5
5
|
import { errorMessage, InfraError, type InfraConnector } from "../InfraConnector";
|
|
6
|
+
import { identifyConnector } from "../connectorIdentity";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* PostgreSQL client (native Bun `SQL`, no external dependencies) of the
|
|
@@ -83,7 +84,7 @@ export function postgres<T extends PostgresConfigShape>(config: AppConfig<T>, op
|
|
|
83
84
|
throw new InfraError("postgres shutdownTimeoutMs must be an integer 0..2147483647");
|
|
84
85
|
}
|
|
85
86
|
const described = new WeakMap<SQL, { options: { hostname?: string; port?: number; database?: string; username?: string; max?: number }; settings: string[] }>();
|
|
86
|
-
return {
|
|
87
|
+
return identifyConnector({
|
|
87
88
|
token: options.token ?? IPostgres,
|
|
88
89
|
config,
|
|
89
90
|
create(configs) {
|
|
@@ -118,7 +119,7 @@ export function postgres<T extends PostgresConfigShape>(config: AppConfig<T>, op
|
|
|
118
119
|
return false;
|
|
119
120
|
}
|
|
120
121
|
},
|
|
121
|
-
};
|
|
122
|
+
}, "postgres");
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
/** `postgres@127.0.0.1:5432/app`: user, host, port and database, never the password. */
|
|
@@ -12,6 +12,7 @@ import { RedisDistributedCacheBackend, type RedisDistributedCacheTuning } from "
|
|
|
12
12
|
import { reader, requireValue, settingNames } from "../connectorConfig";
|
|
13
13
|
import { errorMessage, InfraError, type InfraConnector } from "../InfraConnector";
|
|
14
14
|
import { redactSensitiveText } from "../../../library/redaction";
|
|
15
|
+
import { identifyConnector } from "../connectorIdentity";
|
|
15
16
|
|
|
16
17
|
const DEFAULT_REDIS_CONNECT_TIMEOUT_MS = 5_000;
|
|
17
18
|
|
|
@@ -115,7 +116,7 @@ export function redisConnect<T extends RedisConfigShape>(
|
|
|
115
116
|
? undefined
|
|
116
117
|
: distributedCacheProviders(cache === "distributed" ? {} : withoutMode(cache), token);
|
|
117
118
|
|
|
118
|
-
return {
|
|
119
|
+
return identifyConnector({
|
|
119
120
|
token,
|
|
120
121
|
config,
|
|
121
122
|
providers: cacheProviders,
|
|
@@ -166,7 +167,7 @@ export function redisConnect<T extends RedisConfigShape>(
|
|
|
166
167
|
return false;
|
|
167
168
|
}
|
|
168
169
|
},
|
|
169
|
-
};
|
|
170
|
+
}, "redis");
|
|
170
171
|
}
|
|
171
172
|
|
|
172
173
|
function redisUrl(value: unknown): string {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HostedService, HostedServicePlanValidator } from "../di";
|
|
2
2
|
import { SchemaAdmissionError } from "../../library/orm";
|
|
3
|
-
import { isOrmProviderLifecycle, isStrictSchemaPrerequisiteLifecycle } from "./strictSchemaHostedIdentity";
|
|
3
|
+
import { describePhaseConflict, isOrmProviderLifecycle, isStrictSchemaPrerequisiteLifecycle } from "./strictSchemaHostedIdentity";
|
|
4
4
|
|
|
5
5
|
/** Stateless strategy shared by ORM lifecycles; it owns no connection or application state. */
|
|
6
6
|
export const ormHostedPlanValidator: HostedServicePlanValidator = Object.freeze({ validate: validateOrmHostedPlan });
|
|
@@ -18,7 +18,7 @@ function validateOrmHostedPlan(services: readonly HostedService[]): void {
|
|
|
18
18
|
|| (service as { __bazisOrmOwnedStoreAdmission?: unknown }).__bazisOrmOwnedStoreAdmission === true
|
|
19
19
|
|| (service as { __bazisOrmLegacyLifecycle?: unknown }).__bazisOrmLegacyLifecycle === true
|
|
20
20
|
|| isStrictSchemaPrerequisiteLifecycle(service);
|
|
21
|
-
if (!framework && (service.phase ?? 0) < 0) throw new SchemaAdmissionError("ORM_SCHEMA_HOSTED_PHASE_CONFLICT",
|
|
21
|
+
if (!framework && (service.phase ?? 0) < 0) throw new SchemaAdmissionError("ORM_SCHEMA_HOSTED_PHASE_CONFLICT", `Application hosted services must use phase 0 or later with ORM owned-store admission: ${describePhaseConflict(service)}`);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
const strict = services.filter((service): service is HostedService & { readonly __bazisSchemaAdmission: { readonly owner?: string; readonly unit: readonly string[]; readonly tables: readonly string[]; readonly foreignKeys: readonly { readonly source: string; readonly target: string }[] } } =>
|
|
@@ -59,7 +59,7 @@ function validateOrmHostedPlan(services: readonly HostedService[]): void {
|
|
|
59
59
|
|| (service as { __bazisSchemaAdmission?: unknown }).__bazisSchemaAdmission !== undefined
|
|
60
60
|
|| (service as { __bazisOrmOwnedStoreAdmission?: unknown }).__bazisOrmOwnedStoreAdmission === true;
|
|
61
61
|
if (!framework && (service.phase ?? 0) < 0) {
|
|
62
|
-
throw new SchemaAdmissionError("ORM_SCHEMA_HOSTED_PHASE_CONFLICT",
|
|
62
|
+
throw new SchemaAdmissionError("ORM_SCHEMA_HOSTED_PHASE_CONFLICT", `Application hosted services must use phase 0 or later with schema admission: ${describePhaseConflict(service)}`);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -9,9 +9,24 @@ export function isOrmProviderLifecycle(lifecycle: HostedService): boolean {
|
|
|
9
9
|
return connector?.token === DATABASE_PROVIDER && lifecycle.phase === -110;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Unchanged framework connectors that never touch the schema: they may start
|
|
14
|
+
* at phase -100, after schema admission and before application services.
|
|
15
|
+
*/
|
|
16
|
+
const PREREQUISITE_ROLES = new Set(["llm", "agent-session-checkpoint-protection", "postgres", "redis", "opensearch"]);
|
|
17
|
+
|
|
12
18
|
/** Only these unchanged factory-owned resources may precede application services. */
|
|
13
19
|
export function isStrictSchemaPrerequisiteLifecycle(lifecycle: HostedService): boolean {
|
|
14
20
|
if ((lifecycle.phase ?? 0) !== -100) return false;
|
|
15
21
|
const role = getLifecycleConnectorRole(lifecycle);
|
|
16
|
-
return role
|
|
22
|
+
return role !== undefined && PREREQUISITE_ROLES.has(role);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The service a phase conflict is about and what to do with it. */
|
|
26
|
+
export function describePhaseConflict(service: HostedService): string {
|
|
27
|
+
const name = service.diagnosticName ?? service.constructor?.name ?? "a hosted service";
|
|
28
|
+
const connector = getLifecycleConnector(service) !== undefined;
|
|
29
|
+
return connector
|
|
30
|
+
? `${name} (phase ${service.phase ?? 0}) is not a framework connector; a custom or changed connector starts at phase 0 or later: set phase: 0 on it.`
|
|
31
|
+
: `${name} has phase ${service.phase ?? 0}; use phase 0 or later.`;
|
|
17
32
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bazis",
|
|
3
|
-
"version": "0.100.
|
|
3
|
+
"version": "0.100.1",
|
|
4
4
|
"description": "Modular backend framework for Bun in TypeScript: DI wired by codegen, HTTP, a PostgreSQL ORM, JWT, WebSocket, agents and a CLI.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Alexander Alenin",
|