@ai-matrx/records 0.60.6 → 0.60.9
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/CHANGELOG.md +43 -0
- package/README.md +26 -0
- package/dist/core/index.cjs +19 -7
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +41 -3
- package/dist/core/index.d.ts +41 -3
- package/dist/core/index.js +19 -7
- package/dist/core/index.js.map +1 -1
- package/dist/react/index.cjs +5 -4
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +11 -3
- package/dist/react/index.d.ts +11 -3
- package/dist/react/index.js +5 -4
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/core/index.d.cts
CHANGED
|
@@ -2120,18 +2120,26 @@ interface RecordsClient {
|
|
|
2120
2120
|
limit?: number;
|
|
2121
2121
|
}): Promise<RecordsResult<IoExportPage>>;
|
|
2122
2122
|
/** G5. That page as an .xlsx; a withheld column is named on its own sheet. */
|
|
2123
|
-
/**
|
|
2124
|
-
|
|
2123
|
+
/**
|
|
2124
|
+
* G9. Every table a picker may offer here, from BOTH stores, each saying which store opens it.
|
|
2125
|
+
* A table the app keeps out of default lists (`custom.table_kept_out_of_lists`: an agent's
|
|
2126
|
+
* outputs) is left out unless `include_app_tables` is true — the "Show app tables" switch.
|
|
2127
|
+
*/
|
|
2128
|
+
tableListEverywhere(args?: {
|
|
2129
|
+
include_app_tables?: boolean;
|
|
2130
|
+
}): Promise<RecordsResult<{
|
|
2125
2131
|
success: boolean;
|
|
2126
2132
|
tables: TableListEntry[];
|
|
2127
2133
|
}>>;
|
|
2128
2134
|
/**
|
|
2129
2135
|
* Every table the person reaches (`custom.data_home_tables`), as the data home lists them.
|
|
2130
2136
|
* `organization_id` names one organization; `null` asks for every organization the person
|
|
2131
|
-
* reaches — never the client's bound organization by default.
|
|
2137
|
+
* reaches — never the client's bound organization by default. A table the app keeps out of
|
|
2138
|
+
* default lists (an agent's outputs) is answered only with `include_app_tables: true`.
|
|
2132
2139
|
*/
|
|
2133
2140
|
dataHomeTables(args: {
|
|
2134
2141
|
organization_id: Uuid | null;
|
|
2142
|
+
include_app_tables?: boolean;
|
|
2135
2143
|
}): Promise<RecordsResult<DataHomeTable[]>>;
|
|
2136
2144
|
/**
|
|
2137
2145
|
* G10. Refresh a synced source (a sheet tab) into ONE Table under `home_id`: new rows added,
|
|
@@ -2541,6 +2549,18 @@ interface NewFieldSpec {
|
|
|
2541
2549
|
* `recordUpsert` finds a record by must carry it.
|
|
2542
2550
|
*/
|
|
2543
2551
|
unique?: boolean;
|
|
2552
|
+
/**
|
|
2553
|
+
* An EXISTING choice list's Table — the column uses those very option records instead of making a
|
|
2554
|
+
* new list (a drafts table copying its source table's column keeps the same choices). Sent as
|
|
2555
|
+
* `config.options_table_id`.
|
|
2556
|
+
*/
|
|
2557
|
+
optionsTableId?: Uuid;
|
|
2558
|
+
/**
|
|
2559
|
+
* Anything else `custom.field_declare` accepts, passed through verbatim and applied LAST (a stored
|
|
2560
|
+
* Field document copied key for key, `format`, `sensitivity`, `via` / `pick` / `agg` / `of`, …).
|
|
2561
|
+
* The store judges every key; a word it does not take is refused by name.
|
|
2562
|
+
*/
|
|
2563
|
+
declaration?: Partial<NewFieldDeclaration> & Record<string, unknown>;
|
|
2544
2564
|
}
|
|
2545
2565
|
interface NewTableSpec {
|
|
2546
2566
|
name: string;
|
|
@@ -2551,6 +2571,24 @@ interface NewTableSpec {
|
|
|
2551
2571
|
/** The Field whose value is the record's title (REC-2). Defaults to the first Field. */
|
|
2552
2572
|
titleField?: string;
|
|
2553
2573
|
fields?: NewFieldSpec[];
|
|
2574
|
+
/**
|
|
2575
|
+
* `ensureTable` only: put a NEW table in this existing Home (one the caller may change, in this
|
|
2576
|
+
* organization) instead of making a Home for it. A table that already exists stays where it is.
|
|
2577
|
+
*/
|
|
2578
|
+
homeId?: Uuid;
|
|
2579
|
+
/** SC-1 placement: the app (one of its features) keeps this table, not the organization. */
|
|
2580
|
+
keptByTheApp?: boolean;
|
|
2581
|
+
/**
|
|
2582
|
+
* WHICH feature keeps it, one lower-case word (`agent_output`, `context`, …). `ensureTable` finds a
|
|
2583
|
+
* table by slug AND this word: a person's table of the same slug is a different table.
|
|
2584
|
+
*/
|
|
2585
|
+
keptFor?: string;
|
|
2586
|
+
/** The content kind whose outputs this table holds. */
|
|
2587
|
+
kind?: string;
|
|
2588
|
+
/** A drafts table: the Table its records are drafts of. */
|
|
2589
|
+
draftsFor?: Uuid;
|
|
2590
|
+
/** A drafts table: that Table's stamp when the drafts table last matched it. */
|
|
2591
|
+
draftsStamp?: string;
|
|
2554
2592
|
}
|
|
2555
2593
|
/**
|
|
2556
2594
|
* What `ensureTable` answers: `declareTable`'s answer, plus whether this call MADE the table and
|
package/dist/core/index.d.ts
CHANGED
|
@@ -2120,18 +2120,26 @@ interface RecordsClient {
|
|
|
2120
2120
|
limit?: number;
|
|
2121
2121
|
}): Promise<RecordsResult<IoExportPage>>;
|
|
2122
2122
|
/** G5. That page as an .xlsx; a withheld column is named on its own sheet. */
|
|
2123
|
-
/**
|
|
2124
|
-
|
|
2123
|
+
/**
|
|
2124
|
+
* G9. Every table a picker may offer here, from BOTH stores, each saying which store opens it.
|
|
2125
|
+
* A table the app keeps out of default lists (`custom.table_kept_out_of_lists`: an agent's
|
|
2126
|
+
* outputs) is left out unless `include_app_tables` is true — the "Show app tables" switch.
|
|
2127
|
+
*/
|
|
2128
|
+
tableListEverywhere(args?: {
|
|
2129
|
+
include_app_tables?: boolean;
|
|
2130
|
+
}): Promise<RecordsResult<{
|
|
2125
2131
|
success: boolean;
|
|
2126
2132
|
tables: TableListEntry[];
|
|
2127
2133
|
}>>;
|
|
2128
2134
|
/**
|
|
2129
2135
|
* Every table the person reaches (`custom.data_home_tables`), as the data home lists them.
|
|
2130
2136
|
* `organization_id` names one organization; `null` asks for every organization the person
|
|
2131
|
-
* reaches — never the client's bound organization by default.
|
|
2137
|
+
* reaches — never the client's bound organization by default. A table the app keeps out of
|
|
2138
|
+
* default lists (an agent's outputs) is answered only with `include_app_tables: true`.
|
|
2132
2139
|
*/
|
|
2133
2140
|
dataHomeTables(args: {
|
|
2134
2141
|
organization_id: Uuid | null;
|
|
2142
|
+
include_app_tables?: boolean;
|
|
2135
2143
|
}): Promise<RecordsResult<DataHomeTable[]>>;
|
|
2136
2144
|
/**
|
|
2137
2145
|
* G10. Refresh a synced source (a sheet tab) into ONE Table under `home_id`: new rows added,
|
|
@@ -2541,6 +2549,18 @@ interface NewFieldSpec {
|
|
|
2541
2549
|
* `recordUpsert` finds a record by must carry it.
|
|
2542
2550
|
*/
|
|
2543
2551
|
unique?: boolean;
|
|
2552
|
+
/**
|
|
2553
|
+
* An EXISTING choice list's Table — the column uses those very option records instead of making a
|
|
2554
|
+
* new list (a drafts table copying its source table's column keeps the same choices). Sent as
|
|
2555
|
+
* `config.options_table_id`.
|
|
2556
|
+
*/
|
|
2557
|
+
optionsTableId?: Uuid;
|
|
2558
|
+
/**
|
|
2559
|
+
* Anything else `custom.field_declare` accepts, passed through verbatim and applied LAST (a stored
|
|
2560
|
+
* Field document copied key for key, `format`, `sensitivity`, `via` / `pick` / `agg` / `of`, …).
|
|
2561
|
+
* The store judges every key; a word it does not take is refused by name.
|
|
2562
|
+
*/
|
|
2563
|
+
declaration?: Partial<NewFieldDeclaration> & Record<string, unknown>;
|
|
2544
2564
|
}
|
|
2545
2565
|
interface NewTableSpec {
|
|
2546
2566
|
name: string;
|
|
@@ -2551,6 +2571,24 @@ interface NewTableSpec {
|
|
|
2551
2571
|
/** The Field whose value is the record's title (REC-2). Defaults to the first Field. */
|
|
2552
2572
|
titleField?: string;
|
|
2553
2573
|
fields?: NewFieldSpec[];
|
|
2574
|
+
/**
|
|
2575
|
+
* `ensureTable` only: put a NEW table in this existing Home (one the caller may change, in this
|
|
2576
|
+
* organization) instead of making a Home for it. A table that already exists stays where it is.
|
|
2577
|
+
*/
|
|
2578
|
+
homeId?: Uuid;
|
|
2579
|
+
/** SC-1 placement: the app (one of its features) keeps this table, not the organization. */
|
|
2580
|
+
keptByTheApp?: boolean;
|
|
2581
|
+
/**
|
|
2582
|
+
* WHICH feature keeps it, one lower-case word (`agent_output`, `context`, …). `ensureTable` finds a
|
|
2583
|
+
* table by slug AND this word: a person's table of the same slug is a different table.
|
|
2584
|
+
*/
|
|
2585
|
+
keptFor?: string;
|
|
2586
|
+
/** The content kind whose outputs this table holds. */
|
|
2587
|
+
kind?: string;
|
|
2588
|
+
/** A drafts table: the Table its records are drafts of. */
|
|
2589
|
+
draftsFor?: Uuid;
|
|
2590
|
+
/** A drafts table: that Table's stamp when the drafts table last matched it. */
|
|
2591
|
+
draftsStamp?: string;
|
|
2554
2592
|
}
|
|
2555
2593
|
/**
|
|
2556
2594
|
* What `ensureTable` answers: `declareTable`'s answer, plus whether this call MADE the table and
|
package/dist/core/index.js
CHANGED
|
@@ -44109,17 +44109,18 @@ function createRecordsClient(given) {
|
|
|
44109
44109
|
"tableFromExample"
|
|
44110
44110
|
);
|
|
44111
44111
|
},
|
|
44112
|
-
async tableListEverywhere() {
|
|
44112
|
+
async tableListEverywhere(args) {
|
|
44113
44113
|
return callDoor(
|
|
44114
44114
|
DOORS.tableListEverywhere,
|
|
44115
|
-
|
|
44115
|
+
// The two-argument overload is chosen by naming both arguments (CHAIR-DOORS-2, N-C8).
|
|
44116
|
+
args?.include_app_tables ? { p_organization_id: org, p_include_app_tables: true } : { p_organization_id: org },
|
|
44116
44117
|
"tableListEverywhere"
|
|
44117
44118
|
);
|
|
44118
44119
|
},
|
|
44119
|
-
async dataHomeTables({ organization_id }) {
|
|
44120
|
+
async dataHomeTables({ organization_id, include_app_tables }) {
|
|
44120
44121
|
return callDoor(
|
|
44121
44122
|
DOORS.dataHomeTables,
|
|
44122
|
-
{ p_organization_id: organization_id },
|
|
44123
|
+
include_app_tables ? { p_organization_id: organization_id, p_include_app_tables: true } : { p_organization_id: organization_id },
|
|
44123
44124
|
"dataHomeTables"
|
|
44124
44125
|
);
|
|
44125
44126
|
},
|
|
@@ -44263,7 +44264,9 @@ function fieldDeclarationFor(field) {
|
|
|
44263
44264
|
...field.unit ? { unit: field.unit } : {},
|
|
44264
44265
|
...field.kind ? { kind: field.kind } : {},
|
|
44265
44266
|
...field.allowedTypes ? { allowed_types: field.allowedTypes } : {},
|
|
44266
|
-
...field.unique ? { rules: [{ kind: "unique" }] } : {}
|
|
44267
|
+
...field.unique ? { rules: [{ kind: "unique" }] } : {},
|
|
44268
|
+
...field.optionsTableId ? { config: { ...field.config ?? {}, options_table_id: field.optionsTableId } } : {},
|
|
44269
|
+
...field.declaration ?? {}
|
|
44267
44270
|
};
|
|
44268
44271
|
}
|
|
44269
44272
|
function tableSpecFor(spec, fields, slug) {
|
|
@@ -44283,14 +44286,23 @@ function tableSpecFor(spec, fields, slug) {
|
|
|
44283
44286
|
// AGT-1: a table a person made is agent-writable by declaration; the
|
|
44284
44287
|
// organization turns it off, never this package.
|
|
44285
44288
|
agent_writable: true,
|
|
44286
|
-
default_sort: [{ field: titleField, direction: "asc" }]
|
|
44289
|
+
default_sort: [{ field: titleField, direction: "asc" }],
|
|
44290
|
+
...spec.keptByTheApp !== void 0 ? { kept_by_the_app: spec.keptByTheApp } : {},
|
|
44291
|
+
...spec.keptFor ? { kept_for: spec.keptFor } : {},
|
|
44292
|
+
...spec.kind ? { kind: spec.kind } : {},
|
|
44293
|
+
...spec.draftsFor ? { drafts_for: spec.draftsFor } : {},
|
|
44294
|
+
...spec.draftsStamp ? { drafts_stamp: spec.draftsStamp } : {}
|
|
44287
44295
|
};
|
|
44288
44296
|
}
|
|
44289
44297
|
async function ensureTable(client, spec) {
|
|
44290
44298
|
const fields = spec.fields && spec.fields.length > 0 ? spec.fields : DEFAULT_FIELDS;
|
|
44291
44299
|
const slug = spec.slug ?? tokenFor(spec.name);
|
|
44292
44300
|
const ensured = await client.tableEnsure({
|
|
44293
|
-
spec: {
|
|
44301
|
+
spec: {
|
|
44302
|
+
...tableSpecFor(spec, fields, slug),
|
|
44303
|
+
...spec.homeId ? { home_id: spec.homeId } : {},
|
|
44304
|
+
fields: fields.map(fieldDeclarationFor)
|
|
44305
|
+
}
|
|
44294
44306
|
});
|
|
44295
44307
|
if (!ensured.ok) return ensured;
|
|
44296
44308
|
return {
|