@objectstack/core 15.1.1 → 16.0.0-rc.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/dist/index.cjs +241 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -6
- package/dist/index.d.ts +99 -6
- package/dist/index.js +238 -29
- package/dist/index.js.map +1 -1
- package/dist/logger.cjs +82 -23
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.d.cts +12 -0
- package/dist/logger.d.ts +12 -0
- package/dist/logger.js +82 -23
- package/dist/logger.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -257,6 +257,17 @@ declare class ObjectKernel {
|
|
|
257
257
|
* Get plugin startup metrics
|
|
258
258
|
*/
|
|
259
259
|
getPluginMetrics(): Map<string, number>;
|
|
260
|
+
/**
|
|
261
|
+
* Whether a plugin with the given name has been registered on this kernel.
|
|
262
|
+
*
|
|
263
|
+
* Registration happens synchronously in `use()` before any plugin's
|
|
264
|
+
* `start()` runs, so a plugin may use this during its own start() to make
|
|
265
|
+
* composition-dependent decisions deterministically — e.g. the dispatcher
|
|
266
|
+
* bridge cedes `${prefix}/discovery` to `com.objectstack.rest.api` when
|
|
267
|
+
* both are mounted (ADR-0076 D11: single owner per route, not
|
|
268
|
+
* first-registration-wins).
|
|
269
|
+
*/
|
|
270
|
+
hasPlugin(name: string): boolean;
|
|
260
271
|
/**
|
|
261
272
|
* Get a service (sync helper)
|
|
262
273
|
*/
|
|
@@ -2030,6 +2041,47 @@ declare function calendarPartsInTz(d: Date, tz: string): CalendarParts;
|
|
|
2030
2041
|
* must degrade to the historical UTC behavior rather than error.
|
|
2031
2042
|
*/
|
|
2032
2043
|
declare function calendarPartsInTzOrUtc(d: Date, tz?: string): CalendarParts;
|
|
2044
|
+
/**
|
|
2045
|
+
* The UTC instant (epoch ms) at which calendar day `ymd` (`YYYY-MM-DD`) *begins*
|
|
2046
|
+
* in reference timezone `tz` — i.e. local **midnight** of that day rendered as a
|
|
2047
|
+
* UTC instant. The inverse direction of {@link calendarPartsInTz}.
|
|
2048
|
+
*
|
|
2049
|
+
* DST-safe: the zone offset is read from the platform tz database via
|
|
2050
|
+
* `Intl.DateTimeFormat` (never hand-computed), and a two-pass resolution settles
|
|
2051
|
+
* the rare case where the offset differs side-to-side of the target instant. An
|
|
2052
|
+
* unset, `'UTC'`, invalid, or unparseable input returns plain UTC midnight.
|
|
2053
|
+
*
|
|
2054
|
+
* Used by date-bucket drill ranges (#1752): a `datetime` field buckets on the
|
|
2055
|
+
* reference-tz calendar, so its bucket boundary is that tz's midnight instant.
|
|
2056
|
+
*/
|
|
2057
|
+
declare function zonedDateStartToUtcMs(ymd: string, tz?: string): number;
|
|
2058
|
+
/**
|
|
2059
|
+
* Granularity of a canonical date-bucket key. Mirrors `@objectstack/spec`'s
|
|
2060
|
+
* `DateGranularity` enum but kept as a local literal union so this low-level
|
|
2061
|
+
* package needs no dependency on spec.
|
|
2062
|
+
*/
|
|
2063
|
+
type BucketGranularity = 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
2064
|
+
/**
|
|
2065
|
+
* The half-open calendar span `[start, end)` of a canonical date-bucket KEY,
|
|
2066
|
+
* as `YYYY-MM-DD` strings (`start` inclusive, `end` exclusive — the next
|
|
2067
|
+
* bucket's first day).
|
|
2068
|
+
*
|
|
2069
|
+
* The input MUST be the canonical key produced by `bucketDateValue` /
|
|
2070
|
+
* `buildDateBucketExpr` (`2026`, `2026-Q2`, `2026-06`, `2026-06-15`,
|
|
2071
|
+
* `2026-W23`) — NEVER a localized / humanized display label. The span is pure,
|
|
2072
|
+
* timezone-naive calendar arithmetic; a caller that needs instant bounds for a
|
|
2073
|
+
* `datetime` field in a reference timezone layers that on top (and, per
|
|
2074
|
+
* ADR-0053, a `date` field compares against these `YYYY-MM-DD` bounds directly).
|
|
2075
|
+
*
|
|
2076
|
+
* Returns `null` for the null/empty bucket, an unparseable key, or a key that
|
|
2077
|
+
* is shape-valid but out of range (e.g. `2026-13`, a `-W53` in a 52-week year,
|
|
2078
|
+
* `2026-02-30`). Callers drop the range and fall back to an unscoped (superset)
|
|
2079
|
+
* drill rather than emit a wrong bound.
|
|
2080
|
+
*/
|
|
2081
|
+
declare function bucketKeyToCalendarRange(key: string, granularity: BucketGranularity): {
|
|
2082
|
+
start: string;
|
|
2083
|
+
end: string;
|
|
2084
|
+
} | null;
|
|
2033
2085
|
|
|
2034
2086
|
/**
|
|
2035
2087
|
* `bulkWrite` — the shared batched-write helper used by BOTH the seed loader
|
|
@@ -2057,6 +2109,17 @@ declare function calendarPartsInTzOrUtc(d: Date, tz?: string): CalendarParts;
|
|
|
2057
2109
|
* can reassemble output in input order even though rows are processed in
|
|
2058
2110
|
* batches (and a batch's flush may be interleaved with other, immediate,
|
|
2059
2111
|
* per-row work such as updates).
|
|
2112
|
+
*
|
|
2113
|
+
* Delivery semantics: **at-least-once**. Transient retry and per-row
|
|
2114
|
+
* degradation both RE-RUN a write whose outcome was unknown — e.g. a turso
|
|
2115
|
+
* `fetch failed` that arrived *after* the row was already committed
|
|
2116
|
+
* (framework#3149), or a result-count mismatch that voids the batch
|
|
2117
|
+
* (framework#3151). A caller that needs exactly-once must make its
|
|
2118
|
+
* `writeBatch`/`writeOne` idempotent; both receive an `attempt` counter for
|
|
2119
|
+
* exactly this — see the natural-key recheck the seed loader and import
|
|
2120
|
+
* runner perform on `attempt > 1`. `writeBatch` MUST also resolve exactly one
|
|
2121
|
+
* record per input row, in input order: a short / long / non-array return is
|
|
2122
|
+
* rejected as a failed batch (framework#3151), never silently backfilled.
|
|
2060
2123
|
*/
|
|
2061
2124
|
interface BulkWriteRowResult<TRecord = any> {
|
|
2062
2125
|
/** Index into the original `rows` array passed to {@link bulkWrite}. */
|
|
@@ -2084,10 +2147,40 @@ interface BulkWriteOptions<TRow, TRecord = any> extends RetryOptions {
|
|
|
2084
2147
|
* `batch[i]` positionally (this is how every `bulkCreate` implementation in
|
|
2085
2148
|
* this repo already behaves: sql's single `INSERT ... VALUES (...), (...)
|
|
2086
2149
|
* RETURNING *`, memory's `Promise.all`, mongodb's ordered `insertMany`).
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2150
|
+
*
|
|
2151
|
+
* `ctx.attempt` is the 1-based attempt number. `attempt > 1` means a prior
|
|
2152
|
+
* attempt's outcome is UNKNOWN (a transient blip that may have landed after
|
|
2153
|
+
* commit) — an exactly-once caller should recheck by natural key and skip
|
|
2154
|
+
* rows already present before re-writing (framework#3149).
|
|
2155
|
+
*/
|
|
2156
|
+
writeBatch: (batch: TRow[], ctx: {
|
|
2157
|
+
attempt: number;
|
|
2158
|
+
}) => Promise<TRecord[]>;
|
|
2159
|
+
/**
|
|
2160
|
+
* Write a single row — used only to degrade a failed batch. `ctx.attempt`
|
|
2161
|
+
* carries the same recheck signal as {@link writeBatch}.
|
|
2162
|
+
*/
|
|
2163
|
+
writeOne: (row: TRow, ctx: {
|
|
2164
|
+
attempt: number;
|
|
2165
|
+
}) => Promise<TRecord>;
|
|
2166
|
+
/**
|
|
2167
|
+
* Partial-success batch write (framework#3172). When provided it is used
|
|
2168
|
+
* INSTEAD of {@link writeBatch}: it must resolve one outcome per input row,
|
|
2169
|
+
* in input order — `{ ok: true, record }` for written rows, `{ ok: false,
|
|
2170
|
+
* error }` for rows that failed individually (e.g. validation). Per-row
|
|
2171
|
+
* failures are final verdicts: bulkWrite records them as-is and does NOT
|
|
2172
|
+
* degrade to `writeOne` for them — that is the whole point (a degradation
|
|
2173
|
+
* re-run would re-fire beforeInsert hooks on the good rows). Only a THROWN
|
|
2174
|
+
* error (a transient infra failure, a result-count mismatch) falls back to
|
|
2175
|
+
* the per-row `writeOne` degradation, exactly like `writeBatch`.
|
|
2176
|
+
*/
|
|
2177
|
+
writeBatchPartial?: (batch: TRow[], ctx: {
|
|
2178
|
+
attempt: number;
|
|
2179
|
+
}) => Promise<Array<{
|
|
2180
|
+
ok: boolean;
|
|
2181
|
+
record?: TRecord;
|
|
2182
|
+
error?: unknown;
|
|
2183
|
+
}>>;
|
|
2091
2184
|
}
|
|
2092
2185
|
declare function defaultIsTransientError(err: unknown): boolean;
|
|
2093
2186
|
/**
|
|
@@ -2096,7 +2189,7 @@ declare function defaultIsTransientError(err: unknown): boolean;
|
|
|
2096
2189
|
* transient-error backoff {@link bulkWrite} applies to batches — so a
|
|
2097
2190
|
* network blip doesn't drop an update the way it used to drop an insert.
|
|
2098
2191
|
*/
|
|
2099
|
-
declare function withTransientRetry<T>(fn: () => Promise<T>, opts?: RetryOptions): Promise<T>;
|
|
2192
|
+
declare function withTransientRetry<T>(fn: (attempt: number) => Promise<T>, opts?: RetryOptions): Promise<T>;
|
|
2100
2193
|
/**
|
|
2101
2194
|
* Write `rows` through `opts.writeBatch` in chunks of `opts.batchSize`,
|
|
2102
2195
|
* retrying a whole-batch transient failure with backoff, and degrading to
|
|
@@ -2544,4 +2637,4 @@ declare class NamespaceResolver {
|
|
|
2544
2637
|
private suggestAlternative;
|
|
2545
2638
|
}
|
|
2546
2639
|
|
|
2547
|
-
export { ANONYMOUS_DENY_BODY, ANONYMOUS_DENY_CODE, ANONYMOUS_DENY_MESSAGE, ANONYMOUS_DENY_STATUS, API_KEY_PREFIX, type AnonymousDenyInput, type ApiKeyPrincipal, ApiRegistry, type ApiRegistryPluginConfig, type AuthGate, type BulkWriteOptions, type BulkWriteRowResult, CORE_FALLBACK_FACTORIES, type CalendarParts, DependencyResolver, type GeneratedApiKey, type GrantValidityWindow, HotReloadManager, type KernelState, type KeyInput, type LadderPrincipal, type LadderRow, LiteKernel, type NamespaceCheckResult, type NamespaceConflict, type NamespaceEntry, NamespaceResolver, ObjectKernel, ObjectKernelBase, type ObjectKernelConfig, ObjectLogger, POSTURE_INJECTION_RULE, POSTURE_LADDER, POSTURE_RANK, type ParsedSignature, type PermissionCheckResult$1 as PermissionCheckResult, type PermissionGrant, type Plugin, type PluginArtifactVerifyResult, PluginConfigValidator, type PluginContext, PluginHealthMonitor, type PluginHealthStatus, type PluginLoadResult, PluginLoader, type PluginMetadata, type PermissionCheckResult as PluginPermissionCheckResult, PluginPermissionEnforcer, PluginPermissionManager, type PluginPermissions, PluginSandboxRuntime, PluginSecurityScanner, type PluginSignatureConfig, PluginSignatureVerifier, type PluginStartupResult, type PostureEvidence, type PublisherVerifyResult, index as QA, type ResolveAuthzInput, type ResolveLocalizationInput, type ResolvedAuthzContext, type ResourceUsage, type RetryOptions, SIGNATURE_ALG, type SandboxContext, type ScanTarget, SecurePluginContext, type SecurityIssue, SemanticVersionManager, type ServiceFactory, ServiceLifecycle, type ServiceRegistration, type SignatureVerificationResult, type VersionCompatibility, buildPermissionsFromGrants, bulkWrite, calendarPartsInTz, calendarPartsInTzOrUtc, counterSignPayload, createApiRegistryPlugin, createMemoryCache, createMemoryI18n, createMemoryJob, createMemoryMetadata, createMemoryQueue, createPluginConfigValidator, createPluginPermissionEnforcer, deepMerge, defaultIsTransientError, derivePosture, evaluateAuthGate, extractApiKey, generateApiKey, generateEd25519KeyPair, getEnv, getMemoryUsage, hashApiKey, isAuthGateAllowlisted, isExpired, isGrantActive, isGrantExpired, isNode, parseScopes, parseSignature, postureVisibleRows, readAuthoredTranslationLayer, resolveApiKeyPrincipal, resolveAuthzContext, resolveLocale, resolveLocalizationContext, safeExit, shouldDenyAnonymous, signPayload, verifyPayload, verifyPlatformSignature, verifyPluginArtifact, verifyPublisherSignature, wireAuthoredTranslationSync, withTransientRetry };
|
|
2640
|
+
export { ANONYMOUS_DENY_BODY, ANONYMOUS_DENY_CODE, ANONYMOUS_DENY_MESSAGE, ANONYMOUS_DENY_STATUS, API_KEY_PREFIX, type AnonymousDenyInput, type ApiKeyPrincipal, ApiRegistry, type ApiRegistryPluginConfig, type AuthGate, type BucketGranularity, type BulkWriteOptions, type BulkWriteRowResult, CORE_FALLBACK_FACTORIES, type CalendarParts, DependencyResolver, type GeneratedApiKey, type GrantValidityWindow, HotReloadManager, type KernelState, type KeyInput, type LadderPrincipal, type LadderRow, LiteKernel, type NamespaceCheckResult, type NamespaceConflict, type NamespaceEntry, NamespaceResolver, ObjectKernel, ObjectKernelBase, type ObjectKernelConfig, ObjectLogger, POSTURE_INJECTION_RULE, POSTURE_LADDER, POSTURE_RANK, type ParsedSignature, type PermissionCheckResult$1 as PermissionCheckResult, type PermissionGrant, type Plugin, type PluginArtifactVerifyResult, PluginConfigValidator, type PluginContext, PluginHealthMonitor, type PluginHealthStatus, type PluginLoadResult, PluginLoader, type PluginMetadata, type PermissionCheckResult as PluginPermissionCheckResult, PluginPermissionEnforcer, PluginPermissionManager, type PluginPermissions, PluginSandboxRuntime, PluginSecurityScanner, type PluginSignatureConfig, PluginSignatureVerifier, type PluginStartupResult, type PostureEvidence, type PublisherVerifyResult, index as QA, type ResolveAuthzInput, type ResolveLocalizationInput, type ResolvedAuthzContext, type ResourceUsage, type RetryOptions, SIGNATURE_ALG, type SandboxContext, type ScanTarget, SecurePluginContext, type SecurityIssue, SemanticVersionManager, type ServiceFactory, ServiceLifecycle, type ServiceRegistration, type SignatureVerificationResult, type VersionCompatibility, bucketKeyToCalendarRange, buildPermissionsFromGrants, bulkWrite, calendarPartsInTz, calendarPartsInTzOrUtc, counterSignPayload, createApiRegistryPlugin, createMemoryCache, createMemoryI18n, createMemoryJob, createMemoryMetadata, createMemoryQueue, createPluginConfigValidator, createPluginPermissionEnforcer, deepMerge, defaultIsTransientError, derivePosture, evaluateAuthGate, extractApiKey, generateApiKey, generateEd25519KeyPair, getEnv, getMemoryUsage, hashApiKey, isAuthGateAllowlisted, isExpired, isGrantActive, isGrantExpired, isNode, parseScopes, parseSignature, postureVisibleRows, readAuthoredTranslationLayer, resolveApiKeyPrincipal, resolveAuthzContext, resolveLocale, resolveLocalizationContext, safeExit, shouldDenyAnonymous, signPayload, verifyPayload, verifyPlatformSignature, verifyPluginArtifact, verifyPublisherSignature, wireAuthoredTranslationSync, withTransientRetry, zonedDateStartToUtcMs };
|
package/dist/index.d.ts
CHANGED
|
@@ -257,6 +257,17 @@ declare class ObjectKernel {
|
|
|
257
257
|
* Get plugin startup metrics
|
|
258
258
|
*/
|
|
259
259
|
getPluginMetrics(): Map<string, number>;
|
|
260
|
+
/**
|
|
261
|
+
* Whether a plugin with the given name has been registered on this kernel.
|
|
262
|
+
*
|
|
263
|
+
* Registration happens synchronously in `use()` before any plugin's
|
|
264
|
+
* `start()` runs, so a plugin may use this during its own start() to make
|
|
265
|
+
* composition-dependent decisions deterministically — e.g. the dispatcher
|
|
266
|
+
* bridge cedes `${prefix}/discovery` to `com.objectstack.rest.api` when
|
|
267
|
+
* both are mounted (ADR-0076 D11: single owner per route, not
|
|
268
|
+
* first-registration-wins).
|
|
269
|
+
*/
|
|
270
|
+
hasPlugin(name: string): boolean;
|
|
260
271
|
/**
|
|
261
272
|
* Get a service (sync helper)
|
|
262
273
|
*/
|
|
@@ -2030,6 +2041,47 @@ declare function calendarPartsInTz(d: Date, tz: string): CalendarParts;
|
|
|
2030
2041
|
* must degrade to the historical UTC behavior rather than error.
|
|
2031
2042
|
*/
|
|
2032
2043
|
declare function calendarPartsInTzOrUtc(d: Date, tz?: string): CalendarParts;
|
|
2044
|
+
/**
|
|
2045
|
+
* The UTC instant (epoch ms) at which calendar day `ymd` (`YYYY-MM-DD`) *begins*
|
|
2046
|
+
* in reference timezone `tz` — i.e. local **midnight** of that day rendered as a
|
|
2047
|
+
* UTC instant. The inverse direction of {@link calendarPartsInTz}.
|
|
2048
|
+
*
|
|
2049
|
+
* DST-safe: the zone offset is read from the platform tz database via
|
|
2050
|
+
* `Intl.DateTimeFormat` (never hand-computed), and a two-pass resolution settles
|
|
2051
|
+
* the rare case where the offset differs side-to-side of the target instant. An
|
|
2052
|
+
* unset, `'UTC'`, invalid, or unparseable input returns plain UTC midnight.
|
|
2053
|
+
*
|
|
2054
|
+
* Used by date-bucket drill ranges (#1752): a `datetime` field buckets on the
|
|
2055
|
+
* reference-tz calendar, so its bucket boundary is that tz's midnight instant.
|
|
2056
|
+
*/
|
|
2057
|
+
declare function zonedDateStartToUtcMs(ymd: string, tz?: string): number;
|
|
2058
|
+
/**
|
|
2059
|
+
* Granularity of a canonical date-bucket key. Mirrors `@objectstack/spec`'s
|
|
2060
|
+
* `DateGranularity` enum but kept as a local literal union so this low-level
|
|
2061
|
+
* package needs no dependency on spec.
|
|
2062
|
+
*/
|
|
2063
|
+
type BucketGranularity = 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
2064
|
+
/**
|
|
2065
|
+
* The half-open calendar span `[start, end)` of a canonical date-bucket KEY,
|
|
2066
|
+
* as `YYYY-MM-DD` strings (`start` inclusive, `end` exclusive — the next
|
|
2067
|
+
* bucket's first day).
|
|
2068
|
+
*
|
|
2069
|
+
* The input MUST be the canonical key produced by `bucketDateValue` /
|
|
2070
|
+
* `buildDateBucketExpr` (`2026`, `2026-Q2`, `2026-06`, `2026-06-15`,
|
|
2071
|
+
* `2026-W23`) — NEVER a localized / humanized display label. The span is pure,
|
|
2072
|
+
* timezone-naive calendar arithmetic; a caller that needs instant bounds for a
|
|
2073
|
+
* `datetime` field in a reference timezone layers that on top (and, per
|
|
2074
|
+
* ADR-0053, a `date` field compares against these `YYYY-MM-DD` bounds directly).
|
|
2075
|
+
*
|
|
2076
|
+
* Returns `null` for the null/empty bucket, an unparseable key, or a key that
|
|
2077
|
+
* is shape-valid but out of range (e.g. `2026-13`, a `-W53` in a 52-week year,
|
|
2078
|
+
* `2026-02-30`). Callers drop the range and fall back to an unscoped (superset)
|
|
2079
|
+
* drill rather than emit a wrong bound.
|
|
2080
|
+
*/
|
|
2081
|
+
declare function bucketKeyToCalendarRange(key: string, granularity: BucketGranularity): {
|
|
2082
|
+
start: string;
|
|
2083
|
+
end: string;
|
|
2084
|
+
} | null;
|
|
2033
2085
|
|
|
2034
2086
|
/**
|
|
2035
2087
|
* `bulkWrite` — the shared batched-write helper used by BOTH the seed loader
|
|
@@ -2057,6 +2109,17 @@ declare function calendarPartsInTzOrUtc(d: Date, tz?: string): CalendarParts;
|
|
|
2057
2109
|
* can reassemble output in input order even though rows are processed in
|
|
2058
2110
|
* batches (and a batch's flush may be interleaved with other, immediate,
|
|
2059
2111
|
* per-row work such as updates).
|
|
2112
|
+
*
|
|
2113
|
+
* Delivery semantics: **at-least-once**. Transient retry and per-row
|
|
2114
|
+
* degradation both RE-RUN a write whose outcome was unknown — e.g. a turso
|
|
2115
|
+
* `fetch failed` that arrived *after* the row was already committed
|
|
2116
|
+
* (framework#3149), or a result-count mismatch that voids the batch
|
|
2117
|
+
* (framework#3151). A caller that needs exactly-once must make its
|
|
2118
|
+
* `writeBatch`/`writeOne` idempotent; both receive an `attempt` counter for
|
|
2119
|
+
* exactly this — see the natural-key recheck the seed loader and import
|
|
2120
|
+
* runner perform on `attempt > 1`. `writeBatch` MUST also resolve exactly one
|
|
2121
|
+
* record per input row, in input order: a short / long / non-array return is
|
|
2122
|
+
* rejected as a failed batch (framework#3151), never silently backfilled.
|
|
2060
2123
|
*/
|
|
2061
2124
|
interface BulkWriteRowResult<TRecord = any> {
|
|
2062
2125
|
/** Index into the original `rows` array passed to {@link bulkWrite}. */
|
|
@@ -2084,10 +2147,40 @@ interface BulkWriteOptions<TRow, TRecord = any> extends RetryOptions {
|
|
|
2084
2147
|
* `batch[i]` positionally (this is how every `bulkCreate` implementation in
|
|
2085
2148
|
* this repo already behaves: sql's single `INSERT ... VALUES (...), (...)
|
|
2086
2149
|
* RETURNING *`, memory's `Promise.all`, mongodb's ordered `insertMany`).
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2150
|
+
*
|
|
2151
|
+
* `ctx.attempt` is the 1-based attempt number. `attempt > 1` means a prior
|
|
2152
|
+
* attempt's outcome is UNKNOWN (a transient blip that may have landed after
|
|
2153
|
+
* commit) — an exactly-once caller should recheck by natural key and skip
|
|
2154
|
+
* rows already present before re-writing (framework#3149).
|
|
2155
|
+
*/
|
|
2156
|
+
writeBatch: (batch: TRow[], ctx: {
|
|
2157
|
+
attempt: number;
|
|
2158
|
+
}) => Promise<TRecord[]>;
|
|
2159
|
+
/**
|
|
2160
|
+
* Write a single row — used only to degrade a failed batch. `ctx.attempt`
|
|
2161
|
+
* carries the same recheck signal as {@link writeBatch}.
|
|
2162
|
+
*/
|
|
2163
|
+
writeOne: (row: TRow, ctx: {
|
|
2164
|
+
attempt: number;
|
|
2165
|
+
}) => Promise<TRecord>;
|
|
2166
|
+
/**
|
|
2167
|
+
* Partial-success batch write (framework#3172). When provided it is used
|
|
2168
|
+
* INSTEAD of {@link writeBatch}: it must resolve one outcome per input row,
|
|
2169
|
+
* in input order — `{ ok: true, record }` for written rows, `{ ok: false,
|
|
2170
|
+
* error }` for rows that failed individually (e.g. validation). Per-row
|
|
2171
|
+
* failures are final verdicts: bulkWrite records them as-is and does NOT
|
|
2172
|
+
* degrade to `writeOne` for them — that is the whole point (a degradation
|
|
2173
|
+
* re-run would re-fire beforeInsert hooks on the good rows). Only a THROWN
|
|
2174
|
+
* error (a transient infra failure, a result-count mismatch) falls back to
|
|
2175
|
+
* the per-row `writeOne` degradation, exactly like `writeBatch`.
|
|
2176
|
+
*/
|
|
2177
|
+
writeBatchPartial?: (batch: TRow[], ctx: {
|
|
2178
|
+
attempt: number;
|
|
2179
|
+
}) => Promise<Array<{
|
|
2180
|
+
ok: boolean;
|
|
2181
|
+
record?: TRecord;
|
|
2182
|
+
error?: unknown;
|
|
2183
|
+
}>>;
|
|
2091
2184
|
}
|
|
2092
2185
|
declare function defaultIsTransientError(err: unknown): boolean;
|
|
2093
2186
|
/**
|
|
@@ -2096,7 +2189,7 @@ declare function defaultIsTransientError(err: unknown): boolean;
|
|
|
2096
2189
|
* transient-error backoff {@link bulkWrite} applies to batches — so a
|
|
2097
2190
|
* network blip doesn't drop an update the way it used to drop an insert.
|
|
2098
2191
|
*/
|
|
2099
|
-
declare function withTransientRetry<T>(fn: () => Promise<T>, opts?: RetryOptions): Promise<T>;
|
|
2192
|
+
declare function withTransientRetry<T>(fn: (attempt: number) => Promise<T>, opts?: RetryOptions): Promise<T>;
|
|
2100
2193
|
/**
|
|
2101
2194
|
* Write `rows` through `opts.writeBatch` in chunks of `opts.batchSize`,
|
|
2102
2195
|
* retrying a whole-batch transient failure with backoff, and degrading to
|
|
@@ -2544,4 +2637,4 @@ declare class NamespaceResolver {
|
|
|
2544
2637
|
private suggestAlternative;
|
|
2545
2638
|
}
|
|
2546
2639
|
|
|
2547
|
-
export { ANONYMOUS_DENY_BODY, ANONYMOUS_DENY_CODE, ANONYMOUS_DENY_MESSAGE, ANONYMOUS_DENY_STATUS, API_KEY_PREFIX, type AnonymousDenyInput, type ApiKeyPrincipal, ApiRegistry, type ApiRegistryPluginConfig, type AuthGate, type BulkWriteOptions, type BulkWriteRowResult, CORE_FALLBACK_FACTORIES, type CalendarParts, DependencyResolver, type GeneratedApiKey, type GrantValidityWindow, HotReloadManager, type KernelState, type KeyInput, type LadderPrincipal, type LadderRow, LiteKernel, type NamespaceCheckResult, type NamespaceConflict, type NamespaceEntry, NamespaceResolver, ObjectKernel, ObjectKernelBase, type ObjectKernelConfig, ObjectLogger, POSTURE_INJECTION_RULE, POSTURE_LADDER, POSTURE_RANK, type ParsedSignature, type PermissionCheckResult$1 as PermissionCheckResult, type PermissionGrant, type Plugin, type PluginArtifactVerifyResult, PluginConfigValidator, type PluginContext, PluginHealthMonitor, type PluginHealthStatus, type PluginLoadResult, PluginLoader, type PluginMetadata, type PermissionCheckResult as PluginPermissionCheckResult, PluginPermissionEnforcer, PluginPermissionManager, type PluginPermissions, PluginSandboxRuntime, PluginSecurityScanner, type PluginSignatureConfig, PluginSignatureVerifier, type PluginStartupResult, type PostureEvidence, type PublisherVerifyResult, index as QA, type ResolveAuthzInput, type ResolveLocalizationInput, type ResolvedAuthzContext, type ResourceUsage, type RetryOptions, SIGNATURE_ALG, type SandboxContext, type ScanTarget, SecurePluginContext, type SecurityIssue, SemanticVersionManager, type ServiceFactory, ServiceLifecycle, type ServiceRegistration, type SignatureVerificationResult, type VersionCompatibility, buildPermissionsFromGrants, bulkWrite, calendarPartsInTz, calendarPartsInTzOrUtc, counterSignPayload, createApiRegistryPlugin, createMemoryCache, createMemoryI18n, createMemoryJob, createMemoryMetadata, createMemoryQueue, createPluginConfigValidator, createPluginPermissionEnforcer, deepMerge, defaultIsTransientError, derivePosture, evaluateAuthGate, extractApiKey, generateApiKey, generateEd25519KeyPair, getEnv, getMemoryUsage, hashApiKey, isAuthGateAllowlisted, isExpired, isGrantActive, isGrantExpired, isNode, parseScopes, parseSignature, postureVisibleRows, readAuthoredTranslationLayer, resolveApiKeyPrincipal, resolveAuthzContext, resolveLocale, resolveLocalizationContext, safeExit, shouldDenyAnonymous, signPayload, verifyPayload, verifyPlatformSignature, verifyPluginArtifact, verifyPublisherSignature, wireAuthoredTranslationSync, withTransientRetry };
|
|
2640
|
+
export { ANONYMOUS_DENY_BODY, ANONYMOUS_DENY_CODE, ANONYMOUS_DENY_MESSAGE, ANONYMOUS_DENY_STATUS, API_KEY_PREFIX, type AnonymousDenyInput, type ApiKeyPrincipal, ApiRegistry, type ApiRegistryPluginConfig, type AuthGate, type BucketGranularity, type BulkWriteOptions, type BulkWriteRowResult, CORE_FALLBACK_FACTORIES, type CalendarParts, DependencyResolver, type GeneratedApiKey, type GrantValidityWindow, HotReloadManager, type KernelState, type KeyInput, type LadderPrincipal, type LadderRow, LiteKernel, type NamespaceCheckResult, type NamespaceConflict, type NamespaceEntry, NamespaceResolver, ObjectKernel, ObjectKernelBase, type ObjectKernelConfig, ObjectLogger, POSTURE_INJECTION_RULE, POSTURE_LADDER, POSTURE_RANK, type ParsedSignature, type PermissionCheckResult$1 as PermissionCheckResult, type PermissionGrant, type Plugin, type PluginArtifactVerifyResult, PluginConfigValidator, type PluginContext, PluginHealthMonitor, type PluginHealthStatus, type PluginLoadResult, PluginLoader, type PluginMetadata, type PermissionCheckResult as PluginPermissionCheckResult, PluginPermissionEnforcer, PluginPermissionManager, type PluginPermissions, PluginSandboxRuntime, PluginSecurityScanner, type PluginSignatureConfig, PluginSignatureVerifier, type PluginStartupResult, type PostureEvidence, type PublisherVerifyResult, index as QA, type ResolveAuthzInput, type ResolveLocalizationInput, type ResolvedAuthzContext, type ResourceUsage, type RetryOptions, SIGNATURE_ALG, type SandboxContext, type ScanTarget, SecurePluginContext, type SecurityIssue, SemanticVersionManager, type ServiceFactory, ServiceLifecycle, type ServiceRegistration, type SignatureVerificationResult, type VersionCompatibility, bucketKeyToCalendarRange, buildPermissionsFromGrants, bulkWrite, calendarPartsInTz, calendarPartsInTzOrUtc, counterSignPayload, createApiRegistryPlugin, createMemoryCache, createMemoryI18n, createMemoryJob, createMemoryMetadata, createMemoryQueue, createPluginConfigValidator, createPluginPermissionEnforcer, deepMerge, defaultIsTransientError, derivePosture, evaluateAuthGate, extractApiKey, generateApiKey, generateEd25519KeyPair, getEnv, getMemoryUsage, hashApiKey, isAuthGateAllowlisted, isExpired, isGrantActive, isGrantExpired, isNode, parseScopes, parseSignature, postureVisibleRows, readAuthoredTranslationLayer, resolveApiKeyPrincipal, resolveAuthzContext, resolveLocale, resolveLocalizationContext, safeExit, shouldDenyAnonymous, signPayload, verifyPayload, verifyPlatformSignature, verifyPluginArtifact, verifyPublisherSignature, wireAuthoredTranslationSync, withTransientRetry, zonedDateStartToUtcMs };
|