@atscript/ui 0.1.139 → 0.1.141
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 +10 -9
- package/dist/index.d.cts +8 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.mjs +10 -9
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -2271,12 +2271,9 @@ function createTableDef(meta, preDeserializedType) {
|
|
|
2271
2271
|
for (const [path, prop] of flatMap.entries()) {
|
|
2272
2272
|
if (path === "") continue;
|
|
2273
2273
|
if (path === meta.versionColumn) continue;
|
|
2274
|
-
if (!(path in meta.fields)) {
|
|
2275
|
-
const kind = prop.type.kind;
|
|
2276
|
-
if (path.includes(".") || kind === "object" || kind === "array") continue;
|
|
2277
|
-
}
|
|
2278
|
-
if (getFieldMeta(prop, "ui.table.exclude") !== void 0) continue;
|
|
2279
2274
|
const fieldMeta = meta.fields[path];
|
|
2275
|
+
if (!isReadable(fieldMeta)) continue;
|
|
2276
|
+
if (getFieldMeta(prop, "ui.table.exclude") !== void 0) continue;
|
|
2280
2277
|
const options = extractLiteralOptions(prop);
|
|
2281
2278
|
const valueHelpInfo = extractValueHelp(prop);
|
|
2282
2279
|
const maxLengthMeta = getFieldMeta(prop, EXPECT_MAX_LENGTH);
|
|
@@ -2289,9 +2286,9 @@ function createTableDef(meta, preDeserializedType) {
|
|
|
2289
2286
|
type: tableType ?? sharedType ?? (valueHelpInfo ? "ref" : inferDisplayType(prop, options)),
|
|
2290
2287
|
component: tableComponent,
|
|
2291
2288
|
selectWith: getFieldMeta(prop, UI_TABLE_SELECT_WITH),
|
|
2292
|
-
sortable: fieldMeta
|
|
2293
|
-
filterable: fieldMeta
|
|
2294
|
-
...fieldMeta
|
|
2289
|
+
sortable: fieldMeta.sortable ?? false,
|
|
2290
|
+
filterable: fieldMeta.filterable ?? false,
|
|
2291
|
+
...fieldMeta.filterOps && { filterOps: [...fieldMeta.filterOps] },
|
|
2295
2292
|
nullable: prop.optional === true,
|
|
2296
2293
|
width: getFieldMeta(prop, UI_TABLE_WIDTH),
|
|
2297
2294
|
maxLen: maxLengthMeta?.length,
|
|
@@ -2308,7 +2305,7 @@ function createTableDef(meta, preDeserializedType) {
|
|
|
2308
2305
|
type,
|
|
2309
2306
|
columns,
|
|
2310
2307
|
flatMap,
|
|
2311
|
-
fetchableFields: new Set(Object.keys(meta.fields)),
|
|
2308
|
+
fetchableFields: new Set(Object.keys(meta.fields).filter((p) => isReadable(meta.fields[p]))),
|
|
2312
2309
|
primaryKeys: meta.primaryKeys,
|
|
2313
2310
|
preferredId: meta.preferredId ?? meta.primaryKeys,
|
|
2314
2311
|
versionColumn: meta.versionColumn,
|
|
@@ -2321,6 +2318,10 @@ function createTableDef(meta, preDeserializedType) {
|
|
|
2321
2318
|
relations: meta.relations
|
|
2322
2319
|
};
|
|
2323
2320
|
}
|
|
2321
|
+
/** A field the caller may read: listed in `meta.fields` and not write-only. */
|
|
2322
|
+
function isReadable(field) {
|
|
2323
|
+
return field !== void 0 && field.writeOnly !== true;
|
|
2324
|
+
}
|
|
2324
2325
|
/** Sort by (order ?? 0). `toSorted` is stable per spec, so ties preserve declaration order. */
|
|
2325
2326
|
function byOrder(xs) {
|
|
2326
2327
|
return xs.toSorted((x, y) => (x.order ?? 0) - (y.order ?? 0));
|
package/dist/index.d.cts
CHANGED
|
@@ -1028,6 +1028,13 @@ interface FieldMeta {
|
|
|
1028
1028
|
* Needs `@atscript/moost-db` 0.1.132+. Since 0.1.139.
|
|
1029
1029
|
*/
|
|
1030
1030
|
filterOps?: string[];
|
|
1031
|
+
/**
|
|
1032
|
+
* The caller may write this field but not read it (an access-control
|
|
1033
|
+
* projection kept it in `/meta` for forms). The server rejects it in
|
|
1034
|
+
* `$select`, filters and `$sort`, so it is never a table column and never
|
|
1035
|
+
* fetchable. Since 0.1.141.
|
|
1036
|
+
*/
|
|
1037
|
+
writeOnly?: boolean;
|
|
1031
1038
|
}
|
|
1032
1039
|
/** Meta response from moost-db `/meta` endpoint. */
|
|
1033
1040
|
interface MetaResponse {
|
|
@@ -1087,6 +1094,7 @@ interface TableDef {
|
|
|
1087
1094
|
/**
|
|
1088
1095
|
* Server-returnable field paths (from meta.fields) — the gate for
|
|
1089
1096
|
* @ui.table.selectWith targets, includes @ui.table.exclude fields.
|
|
1097
|
+
* `writeOnly` fields are not readable, so they are left out (since 0.1.141).
|
|
1090
1098
|
*/
|
|
1091
1099
|
fetchableFields: Set<string>;
|
|
1092
1100
|
primaryKeys: string[];
|
package/dist/index.d.mts
CHANGED
|
@@ -1028,6 +1028,13 @@ interface FieldMeta {
|
|
|
1028
1028
|
* Needs `@atscript/moost-db` 0.1.132+. Since 0.1.139.
|
|
1029
1029
|
*/
|
|
1030
1030
|
filterOps?: string[];
|
|
1031
|
+
/**
|
|
1032
|
+
* The caller may write this field but not read it (an access-control
|
|
1033
|
+
* projection kept it in `/meta` for forms). The server rejects it in
|
|
1034
|
+
* `$select`, filters and `$sort`, so it is never a table column and never
|
|
1035
|
+
* fetchable. Since 0.1.141.
|
|
1036
|
+
*/
|
|
1037
|
+
writeOnly?: boolean;
|
|
1031
1038
|
}
|
|
1032
1039
|
/** Meta response from moost-db `/meta` endpoint. */
|
|
1033
1040
|
interface MetaResponse {
|
|
@@ -1087,6 +1094,7 @@ interface TableDef {
|
|
|
1087
1094
|
/**
|
|
1088
1095
|
* Server-returnable field paths (from meta.fields) — the gate for
|
|
1089
1096
|
* @ui.table.selectWith targets, includes @ui.table.exclude fields.
|
|
1097
|
+
* `writeOnly` fields are not readable, so they are left out (since 0.1.141).
|
|
1090
1098
|
*/
|
|
1091
1099
|
fetchableFields: Set<string>;
|
|
1092
1100
|
primaryKeys: string[];
|
package/dist/index.mjs
CHANGED
|
@@ -2270,12 +2270,9 @@ function createTableDef(meta, preDeserializedType) {
|
|
|
2270
2270
|
for (const [path, prop] of flatMap.entries()) {
|
|
2271
2271
|
if (path === "") continue;
|
|
2272
2272
|
if (path === meta.versionColumn) continue;
|
|
2273
|
-
if (!(path in meta.fields)) {
|
|
2274
|
-
const kind = prop.type.kind;
|
|
2275
|
-
if (path.includes(".") || kind === "object" || kind === "array") continue;
|
|
2276
|
-
}
|
|
2277
|
-
if (getFieldMeta(prop, "ui.table.exclude") !== void 0) continue;
|
|
2278
2273
|
const fieldMeta = meta.fields[path];
|
|
2274
|
+
if (!isReadable(fieldMeta)) continue;
|
|
2275
|
+
if (getFieldMeta(prop, "ui.table.exclude") !== void 0) continue;
|
|
2279
2276
|
const options = extractLiteralOptions(prop);
|
|
2280
2277
|
const valueHelpInfo = extractValueHelp(prop);
|
|
2281
2278
|
const maxLengthMeta = getFieldMeta(prop, EXPECT_MAX_LENGTH);
|
|
@@ -2288,9 +2285,9 @@ function createTableDef(meta, preDeserializedType) {
|
|
|
2288
2285
|
type: tableType ?? sharedType ?? (valueHelpInfo ? "ref" : inferDisplayType(prop, options)),
|
|
2289
2286
|
component: tableComponent,
|
|
2290
2287
|
selectWith: getFieldMeta(prop, UI_TABLE_SELECT_WITH),
|
|
2291
|
-
sortable: fieldMeta
|
|
2292
|
-
filterable: fieldMeta
|
|
2293
|
-
...fieldMeta
|
|
2288
|
+
sortable: fieldMeta.sortable ?? false,
|
|
2289
|
+
filterable: fieldMeta.filterable ?? false,
|
|
2290
|
+
...fieldMeta.filterOps && { filterOps: [...fieldMeta.filterOps] },
|
|
2294
2291
|
nullable: prop.optional === true,
|
|
2295
2292
|
width: getFieldMeta(prop, UI_TABLE_WIDTH),
|
|
2296
2293
|
maxLen: maxLengthMeta?.length,
|
|
@@ -2307,7 +2304,7 @@ function createTableDef(meta, preDeserializedType) {
|
|
|
2307
2304
|
type,
|
|
2308
2305
|
columns,
|
|
2309
2306
|
flatMap,
|
|
2310
|
-
fetchableFields: new Set(Object.keys(meta.fields)),
|
|
2307
|
+
fetchableFields: new Set(Object.keys(meta.fields).filter((p) => isReadable(meta.fields[p]))),
|
|
2311
2308
|
primaryKeys: meta.primaryKeys,
|
|
2312
2309
|
preferredId: meta.preferredId ?? meta.primaryKeys,
|
|
2313
2310
|
versionColumn: meta.versionColumn,
|
|
@@ -2320,6 +2317,10 @@ function createTableDef(meta, preDeserializedType) {
|
|
|
2320
2317
|
relations: meta.relations
|
|
2321
2318
|
};
|
|
2322
2319
|
}
|
|
2320
|
+
/** A field the caller may read: listed in `meta.fields` and not write-only. */
|
|
2321
|
+
function isReadable(field) {
|
|
2322
|
+
return field !== void 0 && field.writeOnly !== true;
|
|
2323
|
+
}
|
|
2323
2324
|
/** Sort by (order ?? 0). `toSorted` is stable per spec, so ties preserve declaration order. */
|
|
2324
2325
|
function byOrder(xs) {
|
|
2325
2326
|
return xs.toSorted((x, y) => (x.order ?? 0) - (y.order ?? 0));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atscript/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.141",
|
|
4
4
|
"description": "Framework-agnostic runtime for form and table definitions from atscript annotated types",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"annotations",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@atscript/db-client": "^0.1.
|
|
50
|
+
"@atscript/db-client": "^0.1.133"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@atscript/core": "^0.1.93",
|
|
54
|
-
"@atscript/db": "^0.1.
|
|
54
|
+
"@atscript/db": "^0.1.133",
|
|
55
55
|
"@atscript/typescript": "^0.1.93",
|
|
56
56
|
"unplugin-atscript": "^0.1.93",
|
|
57
57
|
"vitest": "npm:@voidzero-dev/vite-plus-test@0.1.14"
|