@cosmicdrift/kumiko-types 0.338.0 → 0.340.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.
@@ -16,6 +16,8 @@ export type AggregateSpec = {
16
16
  readonly measure: AggregateMeasure;
17
17
  readonly groupBy?: readonly AggregateDimension[];
18
18
  readonly orderByValue?: "asc" | "desc";
19
+ /** Direction of the group-key ordering (default asc). orderByValue stays the primary key when set. */
20
+ readonly orderByKeys?: "asc" | "desc";
19
21
  readonly limit?: number;
20
22
  };
21
23
  export type AggregateKey = string | number | boolean | null;
@@ -12,6 +12,7 @@ export type WriteHandlerDefinition<TName extends string = string, TSchema extend
12
12
  readonly unsafeSkipTransitionGuard?: boolean;
13
13
  readonly rateLimit?: RateLimitDeclaration;
14
14
  readonly escapeHatch?: EscapeHatchDeclaration;
15
+ readonly tenantlessAnonymous?: boolean;
15
16
  readonly handler: (event: WriteEvent<z.infer<TSchema>>, context: HandlerContext<TMap>) => Promise<WriteResult<TData>>;
16
17
  readonly perform?: PipelineDef<z.infer<TSchema>, TData>;
17
18
  };
@@ -24,6 +25,7 @@ export type WriteHandlerInput<TName extends string = string, TSchema extends Zod
24
25
  readonly unsafeSkipTransitionGuard?: boolean;
25
26
  readonly rateLimit?: RateLimitDeclaration;
26
27
  readonly escapeHatch?: EscapeHatchDeclaration;
28
+ readonly tenantlessAnonymous?: boolean;
27
29
  } & ({
28
30
  readonly handler: (event: WriteEvent<z.infer<TSchema>>, context: HandlerContext<TMap>) => Promise<WriteResult<TData>>;
29
31
  readonly perform?: never;
@@ -473,6 +473,10 @@ export type WriteHandlerDef = {
473
473
  readonly unsafeSkipTransitionGuard?: boolean;
474
474
  readonly rateLimit?: RateLimitDeclaration;
475
475
  readonly escapeHatch?: EscapeHatchDeclaration;
476
+ /** Lets an anonymous `POST /api/write` for this handler proceed under
477
+ * SYSTEM_TENANT_ID when the host resolves no tenant. Boot requires
478
+ * `access.roles: ["anonymous"]` and a real `rateLimit`. */
479
+ readonly tenantlessAnonymous?: boolean;
476
480
  readonly perform?: import("./step.js").PipelineDef;
477
481
  };
478
482
  export declare const ENTITY_CONVENTION_QUERY_BRAND = "__kumikoEntityConventionQuery";
package/dist/step.js CHANGED
@@ -1,4 +1,4 @@
1
- // Step-Vocabulary Types — see docs/plans/architecture/intern/step-vocabulary.md
1
+ // Step-Vocabulary Types — see kumiko-platform/docs/archive/plans/architecture/intern/step-vocabulary.md
2
2
  //
3
3
  // M.1 minimal scope:
4
4
  // - Steps execute against the existing HandlerContext (no per-step subset).
@@ -34,9 +34,9 @@ export type TenantDb = {
34
34
  readonly mode: TenantDbMode;
35
35
  /**
36
36
  * Unfiltered DbRunner escape hatch for handlers/hooks that declare `escapeHatch: { reason }`.
37
- * Throws `AccessDeniedError` when ungranted, or `Error` when `reason` is empty.
37
+ * Throws `AccessDeniedError` when ungranted. The audit entry carries the declared escapeHatch reason.
38
38
  */
39
- unsafeRaw(reason: string): DbRunner;
39
+ unsafeRaw(): DbRunner;
40
40
  /**
41
41
  * Reach a "global" table with the tenant filter lifted — reads always work; writes
42
42
  * reject unless the write handler declared `escapeHatch: { reason }`. "tenant"-tenancy is a compile error here.
@@ -1,3 +1,8 @@
1
+ export type JsonTextMatch = {
2
+ /** Top-level keys, tried in order; the first non-null text value is compared (COALESCE). */
3
+ readonly keys: readonly [string, ...string[]];
4
+ readonly eq: string;
5
+ };
1
6
  export type WhereOperator = {
2
7
  readonly gt?: unknown;
3
8
  readonly gte?: unknown;
@@ -6,6 +11,8 @@ export type WhereOperator = {
6
11
  readonly ne?: unknown;
7
12
  readonly in?: readonly unknown[];
8
13
  readonly like?: string;
14
+ /** jsonb columns only; cannot be combined with other operators in the same object. */
15
+ readonly jsonText?: JsonTextMatch | readonly JsonTextMatch[];
9
16
  };
10
17
  export type WherePrimitive = string | number | boolean | bigint | Date | null | undefined;
11
18
  export type WhereValue = WherePrimitive | readonly WherePrimitive[] | WhereOperator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-types",
3
- "version": "0.338.0",
3
+ "version": "0.340.0",
4
4
  "description": "Framework-Type-Definitions für Kumiko — FeatureDefinition, BootCheck-Types und die reinen Engine-Types. Erlaubt Downstream-Konsumenten, gegen die Type-Contracts zu bauen, ohne das ganze Framework-Package zu importieren. Enthaelt keine identitaets-sensitiven Runtime-Werte mehr (Error-Klassen leben seit #1629 in kumiko-framework, Brand-Symbole nutzen Symbol.for) und ist deshalb eine plain dependency, keine peerDependency.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
package/src/changes.json CHANGED
@@ -1,4 +1,11 @@
1
1
  [
2
+ {
3
+ "version": "0.340.0",
4
+ "type": "improvement",
5
+ "title": "Where clauses and aggregate options describe jsonb text matches and key ordering",
6
+ "detail": "`WhereOperator` gains `jsonText?: JsonTextMatch | readonly JsonTextMatch[]` with `JsonTextMatch = { keys: readonly [string, ...string[]]; eq: string }`, and the aggregate options gain `orderByKeys?: \"asc\" | \"desc\"`.",
7
+ "migration": "keine"
8
+ },
2
9
  {
3
10
  "version": "0.338.0",
4
11
  "type": "improvement",