@ai-matrx/records 0.73.3 → 0.73.5

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.
@@ -3,6 +3,58 @@ import { T as TemplateSpec } from '../types-F7PcHWG_.cjs';
3
3
  import { P as PgError } from '../field-CugcsP2y.cjs';
4
4
  import '../types-DT_Sk6qp.cjs';
5
5
 
6
+ type Json$1 = Record<string, unknown>;
7
+ /** One presented column, exactly as `platform.drill_describe(...).api.columns[]` says it. */
8
+ interface MemoryEntityColumn {
9
+ api_name: string;
10
+ name: string;
11
+ /** "text" | "number" | "choice" | "date" | "datetime" | "checkbox" | … */
12
+ type: string;
13
+ writable?: boolean;
14
+ choices?: string[];
15
+ /** A column shown as the words another table holds (`replaces`: the id column itself). */
16
+ lookup?: {
17
+ via: string;
18
+ token: string;
19
+ column: string;
20
+ replaces: boolean;
21
+ };
22
+ }
23
+ interface MemoryEntitySpec {
24
+ token: string;
25
+ label: string;
26
+ columns: MemoryEntityColumn[];
27
+ /** Rows as the door returns them: `id` plus api_name → value, lookups and choices in words. */
28
+ rows: Json$1[];
29
+ }
30
+ interface MemoryEntity extends MemoryEntitySpec {
31
+ rows: Json$1[];
32
+ }
33
+ type Answer = {
34
+ data: unknown;
35
+ error: null;
36
+ } | {
37
+ data: null;
38
+ error: {
39
+ code: string;
40
+ message: string;
41
+ details: null;
42
+ hint: string | null;
43
+ };
44
+ };
45
+ /** What `drill_describe` answers for a memory entity (dimensions from its choices, count + sums). */
46
+ declare function memoryEntityDescribe(e: MemoryEntity): Json$1;
47
+ /** What `drill_rows` answers: one page, rows in words. */
48
+ declare function memoryEntityRows(e: MemoryEntity, question: Json$1): Json$1;
49
+ /**
50
+ * What `drill_ask` answers for a memory entity: one row per group of the asked Dimensions (a choice
51
+ * or a lookup, both already words here), then the `total` row; `count`, `sum_<col>` and ad hoc
52
+ * `{op, of}` measures keyed `<op>_<of>` exactly as the live door keys them; `where` narrows first.
53
+ */
54
+ declare function memoryEntityAsk(e: MemoryEntity, question: Json$1): Json$1[];
55
+ /** What `entity_row_write` does: a choice by its word (any case), refused in the door's words otherwise. */
56
+ declare function memoryEntityWrite(e: MemoryEntity, recordId: string, columns: Json$1): Answer;
57
+
6
58
  type Json = Record<string, unknown>;
7
59
  /** The ids the store's kernel tables carry everywhere (custom.table_kernel_id() and its siblings). */
8
60
  declare const MEMORY_KERNEL: {
@@ -78,6 +130,8 @@ interface MemoryWorld {
78
130
  recordTable: Map<string, MemoryTable>;
79
131
  /** Table id → the field key that is its pipeline stage. */
80
132
  stageField: Map<string, string>;
133
+ /** Standard sources (`{ kind: "entity", token }`) this world answers — `withEntities`. */
134
+ entities?: Map<string, MemoryEntity>;
81
135
  }
82
136
  interface TemplateWorldOptions {
83
137
  /** "YYYY-MM-DD" the template's relative dates resolve against. Default: today (UTC). */
@@ -95,6 +149,9 @@ declare function memoryDataSource(world: MemoryWorld): RecordsDataSource & {
95
149
  readonly world: MemoryWorld;
96
150
  };
97
151
 
152
+ /** Add standard sources (`{ kind: "entity", token }`) to a memory world, in the live doors' shapes. */
153
+ declare function withEntities(world: MemoryWorld, specs: MemoryEntitySpec[]): MemoryWorld;
154
+
98
155
  interface TemplatePreview {
99
156
  /** Mount this: `<RecordsMount config={preview.config}>` / `<RecordsProvider config={preview.config}>`. */
100
157
  config: RecordsConfig;
@@ -122,5 +179,12 @@ interface TemplatePreview {
122
179
  }
123
180
  /** A template, installed into memory and ready to mount. Pure for a given spec and day. */
124
181
  declare function templatePreview(spec: TemplateSpec, options?: TemplateWorldOptions): TemplatePreview;
182
+ /** A memory store holding only standard sources — mount it like a template preview. */
183
+ declare function entityStore(specs: MemoryEntitySpec[], options?: {
184
+ today?: string;
185
+ }): {
186
+ config: RecordsConfig;
187
+ world: MemoryWorld;
188
+ };
125
189
 
126
- export { MEMORY_KERNEL, type MemoryDashboard, type MemoryField, type MemoryForm, type MemoryOption, type MemoryTable, type MemoryView, type MemoryWorld, PREVIEW_REFUSAL, type TemplatePreview, type TemplateWorldOptions, memoryDataSource, stableId, templatePreview, templateWorld };
190
+ export { MEMORY_KERNEL, type MemoryDashboard, type MemoryEntity, type MemoryEntityColumn, type MemoryEntitySpec, type MemoryField, type MemoryForm, type MemoryOption, type MemoryTable, type MemoryView, type MemoryWorld, PREVIEW_REFUSAL, type TemplatePreview, type TemplateWorldOptions, entityStore, memoryDataSource, memoryEntityAsk, memoryEntityDescribe, memoryEntityRows, memoryEntityWrite, stableId, templatePreview, templateWorld, withEntities };
@@ -3,6 +3,58 @@ import { T as TemplateSpec } from '../types-DL7FEBKg.js';
3
3
  import { P as PgError } from '../field-CugcsP2y.js';
4
4
  import '../types-DZgTYEVh.js';
5
5
 
6
+ type Json$1 = Record<string, unknown>;
7
+ /** One presented column, exactly as `platform.drill_describe(...).api.columns[]` says it. */
8
+ interface MemoryEntityColumn {
9
+ api_name: string;
10
+ name: string;
11
+ /** "text" | "number" | "choice" | "date" | "datetime" | "checkbox" | … */
12
+ type: string;
13
+ writable?: boolean;
14
+ choices?: string[];
15
+ /** A column shown as the words another table holds (`replaces`: the id column itself). */
16
+ lookup?: {
17
+ via: string;
18
+ token: string;
19
+ column: string;
20
+ replaces: boolean;
21
+ };
22
+ }
23
+ interface MemoryEntitySpec {
24
+ token: string;
25
+ label: string;
26
+ columns: MemoryEntityColumn[];
27
+ /** Rows as the door returns them: `id` plus api_name → value, lookups and choices in words. */
28
+ rows: Json$1[];
29
+ }
30
+ interface MemoryEntity extends MemoryEntitySpec {
31
+ rows: Json$1[];
32
+ }
33
+ type Answer = {
34
+ data: unknown;
35
+ error: null;
36
+ } | {
37
+ data: null;
38
+ error: {
39
+ code: string;
40
+ message: string;
41
+ details: null;
42
+ hint: string | null;
43
+ };
44
+ };
45
+ /** What `drill_describe` answers for a memory entity (dimensions from its choices, count + sums). */
46
+ declare function memoryEntityDescribe(e: MemoryEntity): Json$1;
47
+ /** What `drill_rows` answers: one page, rows in words. */
48
+ declare function memoryEntityRows(e: MemoryEntity, question: Json$1): Json$1;
49
+ /**
50
+ * What `drill_ask` answers for a memory entity: one row per group of the asked Dimensions (a choice
51
+ * or a lookup, both already words here), then the `total` row; `count`, `sum_<col>` and ad hoc
52
+ * `{op, of}` measures keyed `<op>_<of>` exactly as the live door keys them; `where` narrows first.
53
+ */
54
+ declare function memoryEntityAsk(e: MemoryEntity, question: Json$1): Json$1[];
55
+ /** What `entity_row_write` does: a choice by its word (any case), refused in the door's words otherwise. */
56
+ declare function memoryEntityWrite(e: MemoryEntity, recordId: string, columns: Json$1): Answer;
57
+
6
58
  type Json = Record<string, unknown>;
7
59
  /** The ids the store's kernel tables carry everywhere (custom.table_kernel_id() and its siblings). */
8
60
  declare const MEMORY_KERNEL: {
@@ -78,6 +130,8 @@ interface MemoryWorld {
78
130
  recordTable: Map<string, MemoryTable>;
79
131
  /** Table id → the field key that is its pipeline stage. */
80
132
  stageField: Map<string, string>;
133
+ /** Standard sources (`{ kind: "entity", token }`) this world answers — `withEntities`. */
134
+ entities?: Map<string, MemoryEntity>;
81
135
  }
82
136
  interface TemplateWorldOptions {
83
137
  /** "YYYY-MM-DD" the template's relative dates resolve against. Default: today (UTC). */
@@ -95,6 +149,9 @@ declare function memoryDataSource(world: MemoryWorld): RecordsDataSource & {
95
149
  readonly world: MemoryWorld;
96
150
  };
97
151
 
152
+ /** Add standard sources (`{ kind: "entity", token }`) to a memory world, in the live doors' shapes. */
153
+ declare function withEntities(world: MemoryWorld, specs: MemoryEntitySpec[]): MemoryWorld;
154
+
98
155
  interface TemplatePreview {
99
156
  /** Mount this: `<RecordsMount config={preview.config}>` / `<RecordsProvider config={preview.config}>`. */
100
157
  config: RecordsConfig;
@@ -122,5 +179,12 @@ interface TemplatePreview {
122
179
  }
123
180
  /** A template, installed into memory and ready to mount. Pure for a given spec and day. */
124
181
  declare function templatePreview(spec: TemplateSpec, options?: TemplateWorldOptions): TemplatePreview;
182
+ /** A memory store holding only standard sources — mount it like a template preview. */
183
+ declare function entityStore(specs: MemoryEntitySpec[], options?: {
184
+ today?: string;
185
+ }): {
186
+ config: RecordsConfig;
187
+ world: MemoryWorld;
188
+ };
125
189
 
126
- export { MEMORY_KERNEL, type MemoryDashboard, type MemoryField, type MemoryForm, type MemoryOption, type MemoryTable, type MemoryView, type MemoryWorld, PREVIEW_REFUSAL, type TemplatePreview, type TemplateWorldOptions, memoryDataSource, stableId, templatePreview, templateWorld };
190
+ export { MEMORY_KERNEL, type MemoryDashboard, type MemoryEntity, type MemoryEntityColumn, type MemoryEntitySpec, type MemoryField, type MemoryForm, type MemoryOption, type MemoryTable, type MemoryView, type MemoryWorld, PREVIEW_REFUSAL, type TemplatePreview, type TemplateWorldOptions, entityStore, memoryDataSource, memoryEntityAsk, memoryEntityDescribe, memoryEntityRows, memoryEntityWrite, stableId, templatePreview, templateWorld, withEntities };