@cosmicdrift/kumiko-types 0.326.1 → 0.328.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/action-icon.d.ts +3 -0
- package/dist/action-icon.js +51 -0
- package/{src/agent-exposure.ts → dist/agent-exposure.d.ts} +8 -15
- package/dist/agent-exposure.js +16 -0
- package/dist/concurrency-mode.d.ts +1 -0
- package/dist/config-scope.d.ts +1 -0
- package/dist/config-scope.js +1 -0
- package/dist/config.d.ts +234 -0
- package/dist/config.js +1 -0
- package/dist/cursor-types.d.ts +16 -0
- package/dist/cursor-types.js +1 -0
- package/dist/db-connection.d.ts +14 -0
- package/dist/db-connection.js +1 -0
- package/dist/define-handler.d.ts +58 -0
- package/dist/define-handler.js +1 -0
- package/dist/derivatives-types.d.ts +53 -0
- package/dist/derivatives-types.js +3 -0
- package/dist/entity-cache.d.ts +16 -0
- package/dist/entity-cache.js +1 -0
- package/dist/entity-handlers.d.ts +54 -0
- package/dist/entity-handlers.js +1 -0
- package/dist/entity-table-meta-types.d.ts +44 -0
- package/dist/entity-table-meta-types.js +6 -0
- package/dist/envelope-cipher-types.d.ts +5 -0
- package/dist/envelope-cipher-types.js +1 -0
- package/dist/event-store-executor-types.d.ts +86 -0
- package/dist/event-store-executor-types.js +1 -0
- package/dist/event-store-types.d.ts +37 -0
- package/dist/event-store-types.js +7 -0
- package/dist/event-type-map.d.ts +8 -0
- package/{src/event-type-map.ts → dist/event-type-map.js} +1 -16
- package/dist/executor-brand.d.ts +8 -0
- package/dist/executor-brand.js +1 -0
- package/dist/extension-options-map.d.ts +9 -0
- package/dist/extension-options-map.js +4 -0
- package/dist/feature.d.ts +518 -0
- package/dist/feature.js +1 -0
- package/dist/field-icon.d.ts +1 -0
- package/dist/field-icon.js +1 -0
- package/dist/fields.d.ts +729 -0
- package/dist/fields.js +50 -0
- package/dist/file-handle-types.d.ts +12 -0
- package/dist/file-handle-types.js +1 -0
- package/dist/file-provider-resolver-types.d.ts +3 -0
- package/dist/file-provider-resolver-types.js +1 -0
- package/dist/file-storage-provider-types.d.ts +17 -0
- package/dist/file-storage-provider-types.js +1 -0
- package/dist/geo-tz.d.ts +17 -0
- package/{src/geo-tz.ts → dist/geo-tz.js} +1 -20
- package/dist/handlers.d.ts +493 -0
- package/dist/handlers.js +49 -0
- package/dist/hook-phase.d.ts +1 -0
- package/dist/hook-phase.js +1 -0
- package/dist/hooks.d.ts +75 -0
- package/dist/hooks.js +1 -0
- package/dist/http-route.d.ts +52 -0
- package/dist/http-route.js +13 -0
- package/dist/identifiers.d.ts +8 -0
- package/{src/identifiers.ts → dist/identifiers.js} +7 -24
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/kms-adapter-types.d.ts +68 -0
- package/dist/kms-adapter-types.js +49 -0
- package/dist/logger.d.ts +7 -0
- package/dist/logger.js +1 -0
- package/dist/multi-stream-apply-context-types.d.ts +18 -0
- package/dist/multi-stream-apply-context-types.js +1 -0
- package/dist/nav-icon.d.ts +3 -0
- package/dist/nav-icon.js +100 -0
- package/dist/nav.d.ts +39 -0
- package/dist/nav.js +1 -0
- package/dist/observability/index.d.ts +3 -0
- package/dist/observability/index.js +2 -0
- package/dist/observability/metric.d.ts +34 -0
- package/dist/observability/metric.js +3 -0
- package/dist/observability/provider.d.ts +24 -0
- package/dist/observability/provider.js +4 -0
- package/dist/observability/span.d.ts +32 -0
- package/dist/observability/span.js +4 -0
- package/dist/ownership.d.ts +33 -0
- package/dist/ownership.js +5 -0
- package/dist/projection.d.ts +38 -0
- package/dist/projection.js +1 -0
- package/dist/rate-limit-types.d.ts +19 -0
- package/dist/rate-limit-types.js +1 -0
- package/dist/relations.d.ts +25 -0
- package/dist/relations.js +1 -0
- package/dist/schema-table-types.d.ts +15 -0
- package/{src/schema-table-types.ts → dist/schema-table-types.js} +0 -20
- package/dist/screen.d.ts +1265 -0
- package/dist/screen.js +3 -0
- package/dist/search-adapter.d.ts +32 -0
- package/dist/search-adapter.js +1 -0
- package/dist/secrets-types.d.ts +52 -0
- package/dist/secrets-types.js +30 -0
- package/dist/snapshot-types.d.ts +13 -0
- package/dist/snapshot-types.js +1 -0
- package/dist/step.d.ts +304 -0
- package/dist/step.js +11 -0
- package/dist/target-ref.d.ts +5 -0
- package/{src/target-ref.ts → dist/target-ref.js} +1 -6
- package/dist/tenancy-brand.d.ts +6 -0
- package/dist/tenancy-brand.js +1 -0
- package/dist/tenant-db-types.d.ts +67 -0
- package/dist/tenant-db-types.js +5 -0
- package/dist/tree-node.d.ts +26 -0
- package/dist/tree-node.js +22 -0
- package/dist/tz-context.d.ts +48 -0
- package/dist/tz-context.js +6 -0
- package/dist/websocket-route.d.ts +46 -0
- package/dist/websocket-route.js +10 -0
- package/dist/where-clause-types.d.ts +20 -0
- package/dist/where-clause-types.js +1 -0
- package/dist/workspace.d.ts +10 -0
- package/dist/workspace.js +1 -0
- package/dist/write-error-info-types.d.ts +12 -0
- package/dist/write-error-info-types.js +1 -0
- package/package.json +362 -119
- package/src/changes.json +12 -0
- package/src/__tests__/handlers.test.ts +0 -40
- package/src/__tests__/plural-forms.test.ts +0 -18
- package/src/action-icon.ts +0 -57
- package/src/concurrency-mode.ts +0 -5
- package/src/config-scope.ts +0 -5
- package/src/config.ts +0 -563
- package/src/cursor-types.ts +0 -18
- package/src/db-connection.ts +0 -25
- package/src/define-handler.ts +0 -138
- package/src/derivatives-types.ts +0 -106
- package/src/entity-cache.ts +0 -35
- package/src/entity-handlers.ts +0 -68
- package/src/entity-table-meta-types.ts +0 -101
- package/src/envelope-cipher-types.ts +0 -6
- package/src/event-store-executor-types.ts +0 -163
- package/src/event-store-types.ts +0 -85
- package/src/executor-brand.ts +0 -19
- package/src/extension-options-map.ts +0 -21
- package/src/feature.ts +0 -1132
- package/src/field-icon.ts +0 -23
- package/src/fields.ts +0 -1114
- package/src/file-handle-types.ts +0 -20
- package/src/file-provider-resolver-types.ts +0 -7
- package/src/file-storage-provider-types.ts +0 -54
- package/src/handlers.ts +0 -1246
- package/src/hook-phase.ts +0 -2
- package/src/hooks.ts +0 -170
- package/src/http-route.ts +0 -78
- package/src/kms-adapter-types.ts +0 -128
- package/src/logger.ts +0 -7
- package/src/multi-stream-apply-context-types.ts +0 -52
- package/src/nav-icon.ts +0 -105
- package/src/nav.ts +0 -139
- package/src/observability/index.ts +0 -28
- package/src/observability/metric.ts +0 -56
- package/src/observability/provider.ts +0 -32
- package/src/observability/span.ts +0 -58
- package/src/ownership.ts +0 -83
- package/src/projection.ts +0 -170
- package/src/rate-limit-types.ts +0 -32
- package/src/relations.ts +0 -52
- package/src/screen.ts +0 -1593
- package/src/search-adapter.ts +0 -45
- package/src/secrets-types.ts +0 -182
- package/src/snapshot-types.ts +0 -36
- package/src/step.ts +0 -390
- package/src/tenancy-brand.ts +0 -9
- package/src/tenant-db-types.ts +0 -116
- package/src/tree-node.ts +0 -134
- package/src/tz-context.ts +0 -63
- package/src/where-clause-types.ts +0 -31
- package/src/workspace.ts +0 -42
- package/src/write-error-info-types.ts +0 -20
- /package/{src/index.ts → dist/concurrency-mode.js} +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Meter } from "./metric.js";
|
|
2
|
+
import type { Tracer } from "./span.js";
|
|
3
|
+
export type SamplingConfig = {
|
|
4
|
+
readonly tracing?: number;
|
|
5
|
+
readonly alwaysOnError?: boolean;
|
|
6
|
+
readonly alwaysOnSlow?: {
|
|
7
|
+
readonly thresholdMs: number;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export type SensitiveFilterConfig = {
|
|
11
|
+
readonly redactedHeaders: readonly string[];
|
|
12
|
+
readonly redactedQueryParams: readonly string[];
|
|
13
|
+
readonly redactedAttributeKeyPatterns: readonly RegExp[];
|
|
14
|
+
};
|
|
15
|
+
export type ObservabilityOptions = {
|
|
16
|
+
readonly sampling?: SamplingConfig;
|
|
17
|
+
readonly sensitiveFilter?: Partial<SensitiveFilterConfig>;
|
|
18
|
+
};
|
|
19
|
+
export interface ObservabilityProvider {
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly tracer: Tracer;
|
|
22
|
+
readonly meter: Meter;
|
|
23
|
+
shutdown(): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type SpanAttributeValue = string | number | boolean;
|
|
2
|
+
export type SpanAttributes = Record<string, SpanAttributeValue>;
|
|
3
|
+
export type SpanStatus = "unset" | "ok" | "error";
|
|
4
|
+
export type SpanKind = "internal" | "server" | "client" | "producer" | "consumer";
|
|
5
|
+
export type SerializedTraceContext = {
|
|
6
|
+
readonly traceId: string;
|
|
7
|
+
readonly spanId: string;
|
|
8
|
+
readonly baggage?: Readonly<Record<string, string>>;
|
|
9
|
+
};
|
|
10
|
+
export type StartSpanOptions = {
|
|
11
|
+
readonly parent?: Span | SerializedTraceContext;
|
|
12
|
+
readonly attributes?: SpanAttributes;
|
|
13
|
+
readonly kind?: SpanKind;
|
|
14
|
+
readonly startTime?: number;
|
|
15
|
+
};
|
|
16
|
+
export interface Span {
|
|
17
|
+
readonly traceId: string;
|
|
18
|
+
readonly spanId: string;
|
|
19
|
+
readonly parentSpanId: string | undefined;
|
|
20
|
+
readonly name: string;
|
|
21
|
+
setAttribute(key: string, value: SpanAttributeValue): void;
|
|
22
|
+
setAttributes(attrs: SpanAttributes): void;
|
|
23
|
+
setStatus(status: SpanStatus, message?: string): void;
|
|
24
|
+
recordException(error: Error): void;
|
|
25
|
+
end(endTime?: number): void;
|
|
26
|
+
readonly ended: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface Tracer {
|
|
29
|
+
startSpan(name: string, options?: StartSpanOptions): Span;
|
|
30
|
+
withSpan<T>(name: string, optionsOrFn: StartSpanOptions | ((span: Span) => Promise<T>), fn?: (span: Span) => Promise<T>): Promise<T>;
|
|
31
|
+
getActiveSpan(): Span | undefined;
|
|
32
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { SessionUser } from "./handlers.js";
|
|
2
|
+
export type SqlFragment = {
|
|
3
|
+
readonly sqlText: string;
|
|
4
|
+
readonly params: readonly unknown[];
|
|
5
|
+
};
|
|
6
|
+
export type OwnershipRef = string;
|
|
7
|
+
export type FromRuleKind = "user" | "claim";
|
|
8
|
+
export type FromRule = {
|
|
9
|
+
readonly kind: "from";
|
|
10
|
+
readonly refKind: FromRuleKind;
|
|
11
|
+
readonly refPath: string;
|
|
12
|
+
readonly column: string;
|
|
13
|
+
};
|
|
14
|
+
export type WhereRuleContext<TTable = unknown> = {
|
|
15
|
+
readonly table: TTable;
|
|
16
|
+
readonly tableName: string;
|
|
17
|
+
readonly paramStart: number;
|
|
18
|
+
};
|
|
19
|
+
export type WhereRule<TTable = unknown> = {
|
|
20
|
+
readonly kind: "where";
|
|
21
|
+
readonly where: (user: SessionUser, ctx: WhereRuleContext<TTable>) => SqlFragment;
|
|
22
|
+
};
|
|
23
|
+
export type OwnershipRule = "all" | FromRule | WhereRule;
|
|
24
|
+
export type OwnershipMap = Readonly<Record<string, OwnershipRule>>;
|
|
25
|
+
export type OwnershipClause = {
|
|
26
|
+
readonly kind: "pass";
|
|
27
|
+
} | {
|
|
28
|
+
readonly kind: "empty";
|
|
29
|
+
} | {
|
|
30
|
+
readonly kind: "sql";
|
|
31
|
+
readonly sqlText: string;
|
|
32
|
+
readonly params: readonly unknown[];
|
|
33
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { RunIn } from "./config.js";
|
|
2
|
+
import type { DbRunner } from "./db-connection.js";
|
|
3
|
+
import type { StoredEvent } from "./event-store-types.js";
|
|
4
|
+
import type { EntityDefinition } from "./fields.js";
|
|
5
|
+
import type { MultiStreamApplyContext } from "./multi-stream-apply-context-types.js";
|
|
6
|
+
import type { SchemaTable } from "./schema-table-types.js";
|
|
7
|
+
export type ProjectionTable = SchemaTable;
|
|
8
|
+
export type SingleStreamApplyFn<TPayload = Record<string, unknown>> = (event: StoredEvent<TPayload>, tx: DbRunner, table: ProjectionTable) => Promise<void>;
|
|
9
|
+
export type MultiStreamApplyFn<TPayload = Record<string, unknown>> = (event: StoredEvent<TPayload>, tx: DbRunner, ctx: MultiStreamApplyContext) => Promise<void>;
|
|
10
|
+
export type ProjectionDefinition = {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly source: string | readonly string[];
|
|
13
|
+
readonly extraSources?: readonly string[];
|
|
14
|
+
readonly table: ProjectionTable;
|
|
15
|
+
readonly entity?: EntityDefinition;
|
|
16
|
+
readonly apply: Readonly<Record<string, SingleStreamApplyFn>>;
|
|
17
|
+
readonly isImplicit?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type EntityProjectionExtension = {
|
|
20
|
+
readonly sources?: readonly string[];
|
|
21
|
+
readonly apply: Readonly<Record<string, SingleStreamApplyFn>>;
|
|
22
|
+
};
|
|
23
|
+
export type MspErrorPolicy = {
|
|
24
|
+
readonly skipApplyErrors?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export type MspErrorMode = {
|
|
27
|
+
readonly continuous?: MspErrorPolicy;
|
|
28
|
+
readonly rebuild?: MspErrorPolicy;
|
|
29
|
+
};
|
|
30
|
+
export type MultiStreamProjectionDefinition = {
|
|
31
|
+
readonly name: string;
|
|
32
|
+
readonly table?: ProjectionTable;
|
|
33
|
+
readonly apply: Readonly<Record<string, MultiStreamApplyFn>>;
|
|
34
|
+
readonly errorMode?: MspErrorMode;
|
|
35
|
+
readonly runIn?: RunIn;
|
|
36
|
+
readonly delivery?: "shared" | "per-instance";
|
|
37
|
+
readonly startFrom?: "beginning" | "now";
|
|
38
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Temporal } from "temporal-polyfill";
|
|
2
|
+
export type RateLimitDecision = {
|
|
3
|
+
readonly allowed: boolean;
|
|
4
|
+
readonly limit: number;
|
|
5
|
+
readonly remaining: number;
|
|
6
|
+
readonly retryAfterSeconds: number;
|
|
7
|
+
readonly windowSeconds: number;
|
|
8
|
+
readonly resetAt: Temporal.Instant;
|
|
9
|
+
};
|
|
10
|
+
export type RateLimitConfig = {
|
|
11
|
+
readonly limit: number;
|
|
12
|
+
readonly windowSeconds: number;
|
|
13
|
+
readonly cost?: number;
|
|
14
|
+
};
|
|
15
|
+
export type RateLimitResolver = {
|
|
16
|
+
check(bucket: string, config: RateLimitConfig): Promise<RateLimitDecision>;
|
|
17
|
+
enforce(bucket: string, config: RateLimitConfig): Promise<RateLimitDecision>;
|
|
18
|
+
peek(bucket: string, config: Omit<RateLimitConfig, "cost">): Promise<RateLimitDecision>;
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type OnDeleteStrategy = "cascade" | "restrict" | "setNull" | "nothing";
|
|
2
|
+
export type BelongsToRelation = {
|
|
3
|
+
readonly type: "belongsTo";
|
|
4
|
+
readonly target: string;
|
|
5
|
+
readonly foreignKey: string;
|
|
6
|
+
};
|
|
7
|
+
export type HasManyRelation = {
|
|
8
|
+
readonly type: "hasMany";
|
|
9
|
+
readonly target: string;
|
|
10
|
+
readonly foreignKey: string;
|
|
11
|
+
readonly onDelete?: OnDeleteStrategy;
|
|
12
|
+
readonly nestedWrite?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type ManyToManyRelation = {
|
|
15
|
+
readonly type: "manyToMany";
|
|
16
|
+
readonly target: string;
|
|
17
|
+
readonly through: {
|
|
18
|
+
readonly table: string;
|
|
19
|
+
readonly sourceKey: string;
|
|
20
|
+
readonly targetKey: string;
|
|
21
|
+
};
|
|
22
|
+
readonly onDelete?: OnDeleteStrategy;
|
|
23
|
+
};
|
|
24
|
+
export type RelationDefinition = BelongsToRelation | HasManyRelation | ManyToManyRelation;
|
|
25
|
+
export type EntityRelations = Readonly<Record<string, RelationDefinition>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { EntityTableMeta, PgType } from "./entity-table-meta-types.js";
|
|
2
|
+
export declare const KUMIKO_NAME_SYMBOL: unique symbol;
|
|
3
|
+
export declare const KUMIKO_COLUMNS_SYMBOL: unique symbol;
|
|
4
|
+
export declare const KUMIKO_META_SYMBOL: unique symbol;
|
|
5
|
+
export type ColumnHandle = {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly pgType: PgType;
|
|
8
|
+
readonly getSQLType: () => string;
|
|
9
|
+
};
|
|
10
|
+
export type SchemaTable = EntityTableMeta & {
|
|
11
|
+
readonly [KUMIKO_NAME_SYMBOL]: string;
|
|
12
|
+
readonly [KUMIKO_COLUMNS_SYMBOL]: Record<string, ColumnHandle>;
|
|
13
|
+
readonly [KUMIKO_META_SYMBOL]: EntityTableMeta;
|
|
14
|
+
readonly [field: string]: unknown;
|
|
15
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { EntityTableMeta, PgType } from "./entity-table-meta-types";
|
|
2
|
-
|
|
3
1
|
// Global-registry symbols the native dialect stamps onto every SchemaTable —
|
|
4
2
|
// shared identity so downstream introspection (Symbol.for lookups) matches
|
|
5
3
|
// exactly the same unique-symbol type as the one used to construct the table.
|
|
@@ -10,21 +8,3 @@ export const KUMIKO_COLUMNS_SYMBOL = Symbol.for("kumiko:schema:Columns");
|
|
|
10
8
|
// field named `source`/`columns`/`tableName`/… could shadow; readers that
|
|
11
9
|
// need the canonical meta regardless of shadowing use this symbol instead.
|
|
12
10
|
export const KUMIKO_META_SYMBOL = Symbol.for("kumiko:schema:Meta");
|
|
13
|
-
|
|
14
|
-
// Column handle exposed on the SchemaTable. The `name` is the SQL column
|
|
15
|
-
// name (snake_case); legacy code accesses `table.fieldName.name` to
|
|
16
|
-
// produce raw SQL.
|
|
17
|
-
export type ColumnHandle = {
|
|
18
|
-
readonly name: string;
|
|
19
|
-
readonly pgType: PgType;
|
|
20
|
-
readonly getSQLType: () => string;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// SchemaTable — opaque shape with both EntityTableMeta + Symbol-based
|
|
24
|
-
// introspection. Returned by `table(...)`.
|
|
25
|
-
export type SchemaTable = EntityTableMeta & {
|
|
26
|
-
readonly [KUMIKO_NAME_SYMBOL]: string;
|
|
27
|
-
readonly [KUMIKO_COLUMNS_SYMBOL]: Record<string, ColumnHandle>;
|
|
28
|
-
readonly [KUMIKO_META_SYMBOL]: EntityTableMeta;
|
|
29
|
-
readonly [field: string]: unknown;
|
|
30
|
-
};
|