@proteos/sdk 0.46.0 → 0.47.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/{chunk-Y4CEHIRX.js → chunk-5KEJKXO5.js} +38 -15
- package/dist/chunk-5KEJKXO5.js.map +1 -0
- package/dist/{chunk-F5DHWOGW.cjs → chunk-Z7LC3GGU.cjs} +38 -15
- package/dist/chunk-Z7LC3GGU.cjs.map +1 -0
- package/dist/index.cjs +105 -97
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -9
- package/dist/index.d.ts +18 -9
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/meta/index.cjs +57 -57
- package/dist/meta/index.d.cts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/dist/meta/index.js +1 -1
- package/dist/{types-D1PRIsSO.d.cts → types-oECz4xTQ.d.cts} +210 -56
- package/dist/{types-D1PRIsSO.d.ts → types-oECz4xTQ.d.ts} +210 -56
- package/package.json +1 -1
- package/src/functions/actions.ts +29 -0
- package/src/functions/types.ts +6 -4
- package/src/meta/layout/control-registry.json +4 -2
- package/src/meta/layout/elements.ts +86 -0
- package/src/meta/layout/index.ts +2 -0
- package/src/meta/types.ts +85 -39
- package/dist/chunk-F5DHWOGW.cjs.map +0 -1
- package/dist/chunk-Y4CEHIRX.js.map +0 -1
|
@@ -1428,6 +1428,8 @@ declare const LayoutElementType: {
|
|
|
1428
1428
|
readonly Component: "component";
|
|
1429
1429
|
readonly Divider: "divider";
|
|
1430
1430
|
readonly Text: "text";
|
|
1431
|
+
readonly RecordFilter: "record_filter";
|
|
1432
|
+
readonly List: "list";
|
|
1431
1433
|
};
|
|
1432
1434
|
type LayoutElementType = (typeof LayoutElementType)[keyof typeof LayoutElementType];
|
|
1433
1435
|
type RowElement = CommonProps & {
|
|
@@ -1548,6 +1550,70 @@ type ComponentElement = CommonProps & {
|
|
|
1548
1550
|
* to the host's 80px fallback when unset. */
|
|
1549
1551
|
reserved_height?: number;
|
|
1550
1552
|
};
|
|
1553
|
+
/**
|
|
1554
|
+
* A filter builder placed directly on a page. It owns no data of its own: it
|
|
1555
|
+
* publishes the filter (and the chosen subject entity) under its element id,
|
|
1556
|
+
* and every `list` element naming that id in `filter_element_id` renders the
|
|
1557
|
+
* filtered rows.
|
|
1558
|
+
*
|
|
1559
|
+
* `subject_entity` pins which entity the filter is authored against. When it is
|
|
1560
|
+
* absent the element renders a subject picker over the entities its bound lists
|
|
1561
|
+
* offer — one entry per bound list, since a list carries exactly one entity.
|
|
1562
|
+
*
|
|
1563
|
+
* The filter is in-memory: it resets on reload rather than persisting per user.
|
|
1564
|
+
*/
|
|
1565
|
+
type RecordFilterElement = CommonProps & {
|
|
1566
|
+
type: 'record_filter';
|
|
1567
|
+
subject_entity?: string;
|
|
1568
|
+
/** `toolbar` (default) is the Filter button + active chips, matching every
|
|
1569
|
+
* list view. `panel` is the always-open AND/OR editor, for a page whose
|
|
1570
|
+
* point IS the filter. */
|
|
1571
|
+
variant?: 'toolbar' | 'panel';
|
|
1572
|
+
/** Nested AND/OR groups. Defaults to true — the records query carries the
|
|
1573
|
+
* whole tree, so there is no reason to hide the affordance. */
|
|
1574
|
+
is_complex_enabled?: boolean;
|
|
1575
|
+
};
|
|
1576
|
+
/**
|
|
1577
|
+
* Renders records of a configured List — the record-agnostic sibling of
|
|
1578
|
+
* `related_list`, and the only way to show records on a page that has no
|
|
1579
|
+
* record of its own.
|
|
1580
|
+
*
|
|
1581
|
+
* The List supplies everything about presentation and behaviour: columns,
|
|
1582
|
+
* sorting, base filters, toolbar actions, selection mode, and which page a row
|
|
1583
|
+
* opens. Naming more than one list makes the element switchable; the active one
|
|
1584
|
+
* is chosen by the bound filter's subject picker, or by the element's own
|
|
1585
|
+
* switcher when it is unbound.
|
|
1586
|
+
*
|
|
1587
|
+
* `filter_element_id` binds the element to a `record_filter` on the same page.
|
|
1588
|
+
* The bound filter is ANDed with the list's own saved filters — it narrows the
|
|
1589
|
+
* list, it never replaces what the list declared.
|
|
1590
|
+
*/
|
|
1591
|
+
type ListElement = CommonProps & {
|
|
1592
|
+
type: 'list';
|
|
1593
|
+
/** Slugs of the lists this element can render. At least one. */
|
|
1594
|
+
list_slugs: string[];
|
|
1595
|
+
/** Element id of the `record_filter` driving this list. Unbound renders the
|
|
1596
|
+
* list with its own filters only. */
|
|
1597
|
+
filter_element_id?: string;
|
|
1598
|
+
/**
|
|
1599
|
+
* Record-page alternative to `filter_element_id`: the attribute on THIS
|
|
1600
|
+
* page's record holding a saved filter (as written by the `record-filter`
|
|
1601
|
+
* control). The list then renders what the record's own filter selects —
|
|
1602
|
+
* a saved-segment record showing its matches.
|
|
1603
|
+
*
|
|
1604
|
+
* Mutually exclusive with `filter_element_id`: two filters driving one list
|
|
1605
|
+
* has no defined precedence, so the layout validator rejects both at once.
|
|
1606
|
+
* Record pages only — a standalone page has no record to read.
|
|
1607
|
+
*/
|
|
1608
|
+
filter_attribute?: string;
|
|
1609
|
+
/**
|
|
1610
|
+
* Attribute on this page's record naming the subject entity slug. The
|
|
1611
|
+
* element renders whichever of `list_slugs` targets that entity. Without
|
|
1612
|
+
* it the first configured list wins. Pairs with `filter_attribute`.
|
|
1613
|
+
*/
|
|
1614
|
+
subject_entity_attribute?: string;
|
|
1615
|
+
page_size?: number;
|
|
1616
|
+
};
|
|
1551
1617
|
type DividerElement = CommonProps & {
|
|
1552
1618
|
type: 'divider';
|
|
1553
1619
|
};
|
|
@@ -1557,7 +1623,7 @@ type TextElement = CommonProps & {
|
|
|
1557
1623
|
variant: TextVariant;
|
|
1558
1624
|
content: string;
|
|
1559
1625
|
};
|
|
1560
|
-
type LayoutElement = RowElement | ColumnElement | SectionElement | CardElement | TabsElement | FieldElement | RelatedListElement | RelatedRecordElement | ComponentElement | DividerElement | TextElement;
|
|
1626
|
+
type LayoutElement = RowElement | ColumnElement | SectionElement | CardElement | TabsElement | FieldElement | RelatedListElement | RelatedRecordElement | ComponentElement | DividerElement | TextElement | RecordFilterElement | ListElement;
|
|
1561
1627
|
declare const LayoutElementSchema: z.ZodType<LayoutElement>;
|
|
1562
1628
|
|
|
1563
1629
|
/**
|
|
@@ -3051,6 +3117,19 @@ interface UpdateComponentRequest {
|
|
|
3051
3117
|
}
|
|
3052
3118
|
/**
|
|
3053
3119
|
* List column definition.
|
|
3120
|
+
*
|
|
3121
|
+
* `attribute` is an attribute name or a dot path, told apart by the type of
|
|
3122
|
+
* the first segment:
|
|
3123
|
+
*
|
|
3124
|
+
* - `name` — an attribute on the list's own entity.
|
|
3125
|
+
* - `address.city` — a leaf inside one of its `object` attributes.
|
|
3126
|
+
* - `company_id.name` — a field of the RELATED record, reached through a
|
|
3127
|
+
* relation attribute (the first segment is the FK).
|
|
3128
|
+
*
|
|
3129
|
+
* A bare `object` attribute is not a valid column — it carries no value of
|
|
3130
|
+
* its own, only leaves. Sorting follows the same grammar minus the relation
|
|
3131
|
+
* hop: an attribute or an object path can be ordered by, a related field
|
|
3132
|
+
* cannot (it would need a join).
|
|
3054
3133
|
*/
|
|
3055
3134
|
interface Column {
|
|
3056
3135
|
attribute: string;
|
|
@@ -3062,13 +3141,77 @@ interface Column {
|
|
|
3062
3141
|
*/
|
|
3063
3142
|
type SortDirection = 'asc' | 'desc';
|
|
3064
3143
|
/**
|
|
3065
|
-
* Sort configuration.
|
|
3144
|
+
* Sort configuration. `attribute` is an attribute name or an object path
|
|
3145
|
+
* (`address.city`); relation paths are not sortable — ordering by a related
|
|
3146
|
+
* field would need a join the records query doesn't do.
|
|
3066
3147
|
*/
|
|
3067
3148
|
interface SortConfig {
|
|
3068
3149
|
attribute: string;
|
|
3069
3150
|
direction: SortDirection;
|
|
3070
3151
|
}
|
|
3071
3152
|
|
|
3153
|
+
/**
|
|
3154
|
+
* What a page toolbar button invokes. Absent normalizes to `action` (pages
|
|
3155
|
+
* persisted before `kind` existed).
|
|
3156
|
+
*/
|
|
3157
|
+
type PageActionKind = 'action' | 'workflow';
|
|
3158
|
+
/**
|
|
3159
|
+
* Page action definition — one toolbar button. `kind: action` invokes a
|
|
3160
|
+
* function-service Action by slug (`action`) and may prefill its params;
|
|
3161
|
+
* `kind: workflow` starts a manual run of a workflow by key (`workflow`) and
|
|
3162
|
+
* may prefill its manual-trigger inputs. `params` / `inputs` map target field
|
|
3163
|
+
* names to Liquid templates rendered against the page scope
|
|
3164
|
+
* `{ record, entity, params, user }`; a resolved field is locked in the invoke
|
|
3165
|
+
* dialog. `skip_confirmation` fires the target immediately when every required
|
|
3166
|
+
* field resolved from the templates.
|
|
3167
|
+
*/
|
|
3168
|
+
interface PageAction {
|
|
3169
|
+
label: string;
|
|
3170
|
+
icon: string;
|
|
3171
|
+
kind?: PageActionKind;
|
|
3172
|
+
action?: string;
|
|
3173
|
+
workflow?: string;
|
|
3174
|
+
params?: Record<string, string>;
|
|
3175
|
+
inputs?: Record<string, string>;
|
|
3176
|
+
skip_confirmation?: boolean;
|
|
3177
|
+
}
|
|
3178
|
+
declare const PageActionSchema: z.ZodObject<{
|
|
3179
|
+
label: z.ZodString;
|
|
3180
|
+
icon: z.ZodString;
|
|
3181
|
+
kind: z.ZodOptional<z.ZodEnum<["action", "workflow"]>>;
|
|
3182
|
+
action: z.ZodOptional<z.ZodString>;
|
|
3183
|
+
workflow: z.ZodOptional<z.ZodString>;
|
|
3184
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
3185
|
+
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
3186
|
+
skip_confirmation: z.ZodOptional<z.ZodBoolean>;
|
|
3187
|
+
}, "strip", z.ZodTypeAny, {
|
|
3188
|
+
label: string;
|
|
3189
|
+
icon: string;
|
|
3190
|
+
params?: Record<string, string> | undefined;
|
|
3191
|
+
action?: string | undefined;
|
|
3192
|
+
workflow?: string | undefined;
|
|
3193
|
+
kind?: "action" | "workflow" | undefined;
|
|
3194
|
+
inputs?: Record<string, string> | undefined;
|
|
3195
|
+
skip_confirmation?: boolean | undefined;
|
|
3196
|
+
}, {
|
|
3197
|
+
label: string;
|
|
3198
|
+
icon: string;
|
|
3199
|
+
params?: Record<string, string> | undefined;
|
|
3200
|
+
action?: string | undefined;
|
|
3201
|
+
workflow?: string | undefined;
|
|
3202
|
+
kind?: "action" | "workflow" | undefined;
|
|
3203
|
+
inputs?: Record<string, string> | undefined;
|
|
3204
|
+
skip_confirmation?: boolean | undefined;
|
|
3205
|
+
}>;
|
|
3206
|
+
/**
|
|
3207
|
+
* Whether a list's rows can be checked, and whether the checkboxes show from
|
|
3208
|
+
* the start:
|
|
3209
|
+
*
|
|
3210
|
+
* - `on_demand` (default) — a Select toggle in the toolbar reveals them.
|
|
3211
|
+
* - `always` — checkboxes are showing from the start.
|
|
3212
|
+
* - `off` — rows can never be checked, even when the list carries actions.
|
|
3213
|
+
*/
|
|
3214
|
+
type SelectionMode = 'on_demand' | 'always' | 'off';
|
|
3072
3215
|
/**
|
|
3073
3216
|
* List configuration.
|
|
3074
3217
|
* Note: List uses `slug` as its primary identifier, not `id`.
|
|
@@ -3080,6 +3223,15 @@ interface List extends AuditFields {
|
|
|
3080
3223
|
name: string;
|
|
3081
3224
|
entity_slug: string;
|
|
3082
3225
|
columns: Column[];
|
|
3226
|
+
/**
|
|
3227
|
+
* Toolbar buttons on the list, same shape a page carries. They act on the
|
|
3228
|
+
* rows SELECTED in the list, so an `action` button names an `entity_batch`
|
|
3229
|
+
* action (invoked once with every selected record id) and prefill templates
|
|
3230
|
+
* resolve against the list scope `{ selection, entity, user }`.
|
|
3231
|
+
*/
|
|
3232
|
+
actions?: PageAction[];
|
|
3233
|
+
/** Row-selection affordance; absent normalizes to `on_demand`. */
|
|
3234
|
+
selection_mode?: SelectionMode;
|
|
3083
3235
|
/** Record page to open from this list; empty/absent = org default for the entity. */
|
|
3084
3236
|
default_page_slug?: string;
|
|
3085
3237
|
sorting: SortConfig[];
|
|
@@ -3149,6 +3301,35 @@ declare const ListSchema: z.ZodObject<{
|
|
|
3149
3301
|
label: string;
|
|
3150
3302
|
attribute: string;
|
|
3151
3303
|
}>, "many">;
|
|
3304
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
3305
|
+
label: z.ZodString;
|
|
3306
|
+
icon: z.ZodString;
|
|
3307
|
+
kind: z.ZodOptional<z.ZodEnum<["action", "workflow"]>>;
|
|
3308
|
+
action: z.ZodOptional<z.ZodString>;
|
|
3309
|
+
workflow: z.ZodOptional<z.ZodString>;
|
|
3310
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
3311
|
+
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
3312
|
+
skip_confirmation: z.ZodOptional<z.ZodBoolean>;
|
|
3313
|
+
}, "strip", z.ZodTypeAny, {
|
|
3314
|
+
label: string;
|
|
3315
|
+
icon: string;
|
|
3316
|
+
params?: Record<string, string> | undefined;
|
|
3317
|
+
action?: string | undefined;
|
|
3318
|
+
workflow?: string | undefined;
|
|
3319
|
+
kind?: "action" | "workflow" | undefined;
|
|
3320
|
+
inputs?: Record<string, string> | undefined;
|
|
3321
|
+
skip_confirmation?: boolean | undefined;
|
|
3322
|
+
}, {
|
|
3323
|
+
label: string;
|
|
3324
|
+
icon: string;
|
|
3325
|
+
params?: Record<string, string> | undefined;
|
|
3326
|
+
action?: string | undefined;
|
|
3327
|
+
workflow?: string | undefined;
|
|
3328
|
+
kind?: "action" | "workflow" | undefined;
|
|
3329
|
+
inputs?: Record<string, string> | undefined;
|
|
3330
|
+
skip_confirmation?: boolean | undefined;
|
|
3331
|
+
}>, "many">>;
|
|
3332
|
+
selection_mode: z.ZodOptional<z.ZodEnum<["on_demand", "always", "off"]>>;
|
|
3152
3333
|
default_page_slug: z.ZodOptional<z.ZodString>;
|
|
3153
3334
|
sorting: z.ZodArray<z.ZodObject<{
|
|
3154
3335
|
attribute: z.ZodString;
|
|
@@ -3186,6 +3367,17 @@ declare const ListSchema: z.ZodObject<{
|
|
|
3186
3367
|
direction: "asc" | "desc";
|
|
3187
3368
|
}[];
|
|
3188
3369
|
filters: FilterGroup[];
|
|
3370
|
+
actions?: {
|
|
3371
|
+
label: string;
|
|
3372
|
+
icon: string;
|
|
3373
|
+
params?: Record<string, string> | undefined;
|
|
3374
|
+
action?: string | undefined;
|
|
3375
|
+
workflow?: string | undefined;
|
|
3376
|
+
kind?: "action" | "workflow" | undefined;
|
|
3377
|
+
inputs?: Record<string, string> | undefined;
|
|
3378
|
+
skip_confirmation?: boolean | undefined;
|
|
3379
|
+
}[] | undefined;
|
|
3380
|
+
selection_mode?: "on_demand" | "always" | "off" | undefined;
|
|
3189
3381
|
default_page_slug?: string | undefined;
|
|
3190
3382
|
}, {
|
|
3191
3383
|
name: string;
|
|
@@ -3212,6 +3404,17 @@ declare const ListSchema: z.ZodObject<{
|
|
|
3212
3404
|
direction: "asc" | "desc";
|
|
3213
3405
|
}[];
|
|
3214
3406
|
filters: FilterGroup[];
|
|
3407
|
+
actions?: {
|
|
3408
|
+
label: string;
|
|
3409
|
+
icon: string;
|
|
3410
|
+
params?: Record<string, string> | undefined;
|
|
3411
|
+
action?: string | undefined;
|
|
3412
|
+
workflow?: string | undefined;
|
|
3413
|
+
kind?: "action" | "workflow" | undefined;
|
|
3414
|
+
inputs?: Record<string, string> | undefined;
|
|
3415
|
+
skip_confirmation?: boolean | undefined;
|
|
3416
|
+
}[] | undefined;
|
|
3417
|
+
selection_mode?: "on_demand" | "always" | "off" | undefined;
|
|
3215
3418
|
default_page_slug?: string | undefined;
|
|
3216
3419
|
}>;
|
|
3217
3420
|
/**
|
|
@@ -3232,6 +3435,8 @@ interface CreateListRequest {
|
|
|
3232
3435
|
entity_slug: string;
|
|
3233
3436
|
name: string;
|
|
3234
3437
|
columns: Column[];
|
|
3438
|
+
actions?: PageAction[];
|
|
3439
|
+
selection_mode?: SelectionMode;
|
|
3235
3440
|
default_page_slug?: string;
|
|
3236
3441
|
sorting: SortConfig[];
|
|
3237
3442
|
filters: FilterGroup[];
|
|
@@ -3243,6 +3448,8 @@ interface UpdateListRequest {
|
|
|
3243
3448
|
name?: string;
|
|
3244
3449
|
module_slug?: string;
|
|
3245
3450
|
columns?: Column[];
|
|
3451
|
+
actions?: PageAction[];
|
|
3452
|
+
selection_mode?: SelectionMode;
|
|
3246
3453
|
/** Set to '' to clear back to the org default. */
|
|
3247
3454
|
default_page_slug?: string;
|
|
3248
3455
|
sorting?: SortConfig[];
|
|
@@ -3396,59 +3603,6 @@ interface UpdateListViewRequest {
|
|
|
3396
3603
|
sorting?: SortConfig[];
|
|
3397
3604
|
filters?: FilterGroup[];
|
|
3398
3605
|
}
|
|
3399
|
-
/**
|
|
3400
|
-
* What a page toolbar button invokes. Absent normalizes to `action` (pages
|
|
3401
|
-
* persisted before `kind` existed).
|
|
3402
|
-
*/
|
|
3403
|
-
type PageActionKind = 'action' | 'workflow';
|
|
3404
|
-
/**
|
|
3405
|
-
* Page action definition — one toolbar button. `kind: action` invokes a
|
|
3406
|
-
* function-service Action by slug (`action`) and may prefill its params;
|
|
3407
|
-
* `kind: workflow` starts a manual run of a workflow by key (`workflow`) and
|
|
3408
|
-
* may prefill its manual-trigger inputs. `params` / `inputs` map target field
|
|
3409
|
-
* names to Liquid templates rendered against the page scope
|
|
3410
|
-
* `{ record, entity, params, user }`; a resolved field is locked in the invoke
|
|
3411
|
-
* dialog. `skip_confirmation` fires the target immediately when every required
|
|
3412
|
-
* field resolved from the templates.
|
|
3413
|
-
*/
|
|
3414
|
-
interface PageAction {
|
|
3415
|
-
label: string;
|
|
3416
|
-
icon: string;
|
|
3417
|
-
kind?: PageActionKind;
|
|
3418
|
-
action?: string;
|
|
3419
|
-
workflow?: string;
|
|
3420
|
-
params?: Record<string, string>;
|
|
3421
|
-
inputs?: Record<string, string>;
|
|
3422
|
-
skip_confirmation?: boolean;
|
|
3423
|
-
}
|
|
3424
|
-
declare const PageActionSchema: z.ZodObject<{
|
|
3425
|
-
label: z.ZodString;
|
|
3426
|
-
icon: z.ZodString;
|
|
3427
|
-
kind: z.ZodOptional<z.ZodEnum<["action", "workflow"]>>;
|
|
3428
|
-
action: z.ZodOptional<z.ZodString>;
|
|
3429
|
-
workflow: z.ZodOptional<z.ZodString>;
|
|
3430
|
-
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
3431
|
-
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
3432
|
-
skip_confirmation: z.ZodOptional<z.ZodBoolean>;
|
|
3433
|
-
}, "strip", z.ZodTypeAny, {
|
|
3434
|
-
label: string;
|
|
3435
|
-
icon: string;
|
|
3436
|
-
params?: Record<string, string> | undefined;
|
|
3437
|
-
action?: string | undefined;
|
|
3438
|
-
workflow?: string | undefined;
|
|
3439
|
-
kind?: "action" | "workflow" | undefined;
|
|
3440
|
-
inputs?: Record<string, string> | undefined;
|
|
3441
|
-
skip_confirmation?: boolean | undefined;
|
|
3442
|
-
}, {
|
|
3443
|
-
label: string;
|
|
3444
|
-
icon: string;
|
|
3445
|
-
params?: Record<string, string> | undefined;
|
|
3446
|
-
action?: string | undefined;
|
|
3447
|
-
workflow?: string | undefined;
|
|
3448
|
-
kind?: "action" | "workflow" | undefined;
|
|
3449
|
-
inputs?: Record<string, string> | undefined;
|
|
3450
|
-
skip_confirmation?: boolean | undefined;
|
|
3451
|
-
}>;
|
|
3452
3606
|
/**
|
|
3453
3607
|
* Page type — encodes what the page binds to and how it is served (chrome +
|
|
3454
3608
|
* auth posture both follow from it):
|
|
@@ -4101,4 +4255,4 @@ declare function isCurrentUserDefault(value: unknown): value is CurrentUserDefau
|
|
|
4101
4255
|
/** Only the identity-valued attribute types can carry the sentinel. */
|
|
4102
4256
|
declare function acceptsCurrentUserDefault(type: AttributeType): boolean;
|
|
4103
4257
|
|
|
4104
|
-
export { type EntityWithSchema as $, type AuditFields as A, type CreateListViewRequest as B, CURRENT_USER_DEFAULT as C, type CreateMenuConfigurationRequest as D, type CreatePageRequest as E, type FileRef as F, type CreateVariableRequest as G, type CurrencyAttributeMeta as H, CurrencyAttributeMetaSchema as I, type CurrencySymbolSide as J, type CurrencyValue as K, type ListOptions as L, type CurrentUserDefault as M, DEFAULT_OPTIONS as N, DEFAULT_PAGE_SIZE as O, PageIterator as P, DONE as Q, type DeployModuleRequest as R, type DesignReference as S, type DesignReferenceContent as T, type UserRef as U, DesignReferenceSchema as V, type DesignReferenceService as W, type Done as X, type Entity as Y, EntitySchema as Z, type EntityService as _, type Attribute as a, type Timestamps as a$, EntityWithSchemaSchema as a0, type EnumAttributeMeta as a1, type EnumValue as a2, type FileAttributeMeta as a3, FileRefSchema as a4, type FilterElement as a5, FilterElementSchema as a6, type FilterGroup as a7, FilterGroupSchema as a8, type List as a9, ModuleSchema as aA, type ModuleService as aB, type ModuleStatus as aC, type OnDeleteAction as aD, OnDeleteActionSchema as aE, PLATFORM_ATTRIBUTE_NAMES as aF, PLATFORM_USER_ID as aG, type Page as aH, type PageAction as aI, type PageActionKind as aJ, PageActionSchema as aK, type PageLayout as aL, PageLayoutSchema as aM, PageSchema as aN, type PageService as aO, type PageType as aP, type PublicPageComponent as aQ, type PublicPageResponse as aR, type RelationAttributeMeta as aS, RelationAttributeMetaSchema as aT, type RequestOptions as aU, type ResolvedClientOptions as aV, type ResponseMeta as aW, ResponseMetaSchema as aX, type SortConfig as aY, SortConfigSchema as aZ, type SortDirection as a_, type ListAppsOptions as aa, type ListComponentsOptions as ab, type ListDesignReferencesOptions as ac, type ListEntitiesOptions as ad, type ListFn as ae, type ListListViewsOptions as af, type ListListsOptions as ag, type ListMenuConfigurationsOptions as ah, type ListModulesOptions as ai, type ListPagesOptions as aj, ListSchema as ak, type ListService as al, type ListVariablesOptions as am, type ListView as an, ListViewSchema as ao, type ListViewService as ap, type LogicalOperator as aq, type MenuConfiguration as ar, MenuConfigurationSchema as as, type MenuConfigurationService as at, type MenuItem as au, MenuItemSchema as av, MenuItemType as aw, MetaClient as ax, type MetaListOptions as ay, type Module as az, type ListResult as b, type
|
|
4258
|
+
export { type EntityWithSchema as $, type AuditFields as A, type CreateListViewRequest as B, CURRENT_USER_DEFAULT as C, type CreateMenuConfigurationRequest as D, type CreatePageRequest as E, type FileRef as F, type CreateVariableRequest as G, type CurrencyAttributeMeta as H, CurrencyAttributeMetaSchema as I, type CurrencySymbolSide as J, type CurrencyValue as K, type ListOptions as L, type CurrentUserDefault as M, DEFAULT_OPTIONS as N, DEFAULT_PAGE_SIZE as O, PageIterator as P, DONE as Q, type DeployModuleRequest as R, type DesignReference as S, type DesignReferenceContent as T, type UserRef as U, DesignReferenceSchema as V, type DesignReferenceService as W, type Done as X, type Entity as Y, EntitySchema as Z, type EntityService as _, type Attribute as a, type Timestamps as a$, EntityWithSchemaSchema as a0, type EnumAttributeMeta as a1, type EnumValue as a2, type FileAttributeMeta as a3, FileRefSchema as a4, type FilterElement as a5, FilterElementSchema as a6, type FilterGroup as a7, FilterGroupSchema as a8, type List as a9, ModuleSchema as aA, type ModuleService as aB, type ModuleStatus as aC, type OnDeleteAction as aD, OnDeleteActionSchema as aE, PLATFORM_ATTRIBUTE_NAMES as aF, PLATFORM_USER_ID as aG, type Page as aH, type PageAction as aI, type PageActionKind as aJ, PageActionSchema as aK, type PageLayout as aL, PageLayoutSchema as aM, PageSchema as aN, type PageService as aO, type PageType as aP, type PublicPageComponent as aQ, type PublicPageResponse as aR, type RelationAttributeMeta as aS, RelationAttributeMetaSchema as aT, type RequestOptions as aU, type ResolvedClientOptions as aV, type ResponseMeta as aW, ResponseMetaSchema as aX, type SortConfig as aY, SortConfigSchema as aZ, type SortDirection as a_, type ListAppsOptions as aa, type ListComponentsOptions as ab, type ListDesignReferencesOptions as ac, type ListEntitiesOptions as ad, type ListFn as ae, type ListListViewsOptions as af, type ListListsOptions as ag, type ListMenuConfigurationsOptions as ah, type ListModulesOptions as ai, type ListPagesOptions as aj, ListSchema as ak, type ListService as al, type ListVariablesOptions as am, type ListView as an, ListViewSchema as ao, type ListViewService as ap, type LogicalOperator as aq, type MenuConfiguration as ar, MenuConfigurationSchema as as, type MenuConfigurationService as at, type MenuItem as au, MenuItemSchema as av, MenuItemType as aw, MetaClient as ax, type MetaListOptions as ay, type Module as az, type ListResult as b, type PrincipalAttributeMeta as b$, type TokenProvider as b0, type UpdateAppRequest as b1, type UpdateComponentRequest as b2, type UpdateDesignReferenceRequest as b3, type UpdateEntityRequest as b4, type UpdateListRequest as b5, type UpdateListViewRequest as b6, type UpdateMenuConfigurationRequest as b7, type UpdatePageRequest as b8, type UpdateVariableRequest as b9, type BuiltInControlSlug as bA, type CardElement as bB, type ColumnElement as bC, type CommonProps as bD, type ComponentElement as bE, type ControlBucket as bF, type DatetimeAttributeMeta as bG, type DatetimeFormat as bH, type DividerElement as bI, type FieldElement as bJ, FileAttributeMetaSchema as bK, type LayoutAlign as bL, type LayoutElement as bM, LayoutElementSchema as bN, LayoutElementType as bO, type LayoutGap as bP, type LayoutJustify as bQ, type LayoutTab as bR, type ListElement as bS, type NumberAttributeMeta as bT, type ObjectAttributeMeta as bU, PAGE_BACKGROUND_TOKENS as bV, type PageBackgroundToken as bW, type PageLayoutSidePanel as bX, PageLayoutSidePanelSchema as bY, type PageStyle as bZ, PageStyleSchema as b_, UserRefSchema as ba, type UserType as bb, type Variable as bc, VariableSchema as bd, type VariableService as be, acceptsCurrentUserDefault as bf, allCurrencyCodes as bg, createIterator as bh, createListResultSchema as bi, currencyLabel as bj, currencySymbol as bk, currencySymbolSide as bl, formatAmount as bm, formatMoney as bn, isCurrentUserDefault as bo, isPlatformAttributeName as bp, localeNumberSeparators as bq, parseAmount as br, parseCurrencyMeta as bs, parseFileMeta as bt, parseRelationMeta as bu, platformAttributes as bv, resolveOptions as bw, type AttributeForLookup as bx, type AttributeMeta as by, BUILT_IN_CONTROLS as bz, ProteosClient as c, type PrincipalType as c0, type RecordFilterElement as c1, type RelatedListElement as c2, type RelatedRecordElement as c3, type ResponsiveSizing as c4, type RowElement as c5, type SectionElement as c6, type SizeValue as c7, SizeValueSchema as c8, type SizingProps as c9, type StringAttributeMeta as ca, type StringFormat as cb, type TabsElement as cc, type TextElement as cd, type TextVariant as ce, type UserAttributeMeta as cf, UserAttributeMetaSchema as cg, isBuiltInControl as ch, lookupCompatibleControls as ci, lookupControls as cj, lookupPrimaryControl as ck, parsePrincipalMeta as cl, parseUserMeta as cm, type PrincipalRef as d, type PublicAccessOperation as e, type App as f, AppSchema as g, type AppService as h, type ArrayAttributeMeta as i, type AttributeAccessRule as j, type AttributeRestrictions as k, AttributeSchema as l, type AttributeType as m, AuditFieldsSchema as n, type ClientOptions as o, type Column as p, ColumnSchema as q, type ComparisonOperator as r, type Component as s, ComponentSchema as t, type ComponentService as u, type CreateAppRequest as v, type CreateComponentRequest as w, type CreateDesignReferenceRequest as x, type CreateEntityRequest as y, type CreateListRequest as z };
|
package/package.json
CHANGED
package/src/functions/actions.ts
CHANGED
|
@@ -61,6 +61,19 @@ export interface ActionService {
|
|
|
61
61
|
slug: string,
|
|
62
62
|
params: Record<string, unknown>,
|
|
63
63
|
): Promise<unknown>
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Invokes an `entity_batch` action against a SET of records. The whole id
|
|
67
|
+
* array reaches the action in ONE invocation, so the result is a single
|
|
68
|
+
* aggregate payload, not one per record. `recordIds` must be non-empty;
|
|
69
|
+
* the server dedupes it, preserving order. Returns the unwrapped `result`.
|
|
70
|
+
*/
|
|
71
|
+
invokeBatch(
|
|
72
|
+
entitySlug: string,
|
|
73
|
+
slug: string,
|
|
74
|
+
recordIds: string[],
|
|
75
|
+
params: Record<string, unknown>,
|
|
76
|
+
): Promise<unknown>
|
|
64
77
|
}
|
|
65
78
|
|
|
66
79
|
/**
|
|
@@ -117,4 +130,20 @@ export class ActionServiceImpl implements ActionService {
|
|
|
117
130
|
)
|
|
118
131
|
return response.result
|
|
119
132
|
}
|
|
133
|
+
|
|
134
|
+
async invokeBatch(
|
|
135
|
+
entitySlug: string,
|
|
136
|
+
slug: string,
|
|
137
|
+
recordIds: string[],
|
|
138
|
+
params: Record<string, unknown>,
|
|
139
|
+
): Promise<unknown> {
|
|
140
|
+
// The one invoke route whose body is an envelope rather than the params
|
|
141
|
+
// object itself — an id array has nowhere to live in the path.
|
|
142
|
+
const response = await this.client.request<InvokeActionResponse>(
|
|
143
|
+
'POST',
|
|
144
|
+
`/functions/v1/entities/${entitySlug}/actions/${slug}/invoke`,
|
|
145
|
+
{ record_ids: recordIds, params },
|
|
146
|
+
)
|
|
147
|
+
return response.result
|
|
148
|
+
}
|
|
120
149
|
}
|
package/src/functions/types.ts
CHANGED
|
@@ -5,11 +5,13 @@ import { type AuditFields, AuditFieldsSchema } from '../types/common.js'
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Scope of an action. `entity`-scoped actions are invoked against a
|
|
8
|
-
* specific record; `
|
|
8
|
+
* specific record; `entity_batch` actions against a SET of records of one
|
|
9
|
+
* entity (one invocation carrying every id, never one per record — they back
|
|
10
|
+
* a list's toolbar buttons); `global` actions take no record context.
|
|
9
11
|
*/
|
|
10
|
-
export type ActionScope = 'entity' | 'global'
|
|
12
|
+
export type ActionScope = 'entity' | 'entity_batch' | 'global'
|
|
11
13
|
|
|
12
|
-
export const ActionScopeSchema = z.enum(['entity', 'global'])
|
|
14
|
+
export const ActionScopeSchema = z.enum(['entity', 'entity_batch', 'global'])
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* Deployable, user-invokable operation. Mirrors `functionsmodel.Action`
|
|
@@ -21,7 +23,7 @@ export interface Action extends AuditFields {
|
|
|
21
23
|
org_id: string
|
|
22
24
|
module_slug: string
|
|
23
25
|
scope: ActionScope
|
|
24
|
-
/** Present only when `scope
|
|
26
|
+
/** Present only when `scope` is `entity` or `entity_batch`. */
|
|
25
27
|
entity?: string
|
|
26
28
|
name: string
|
|
27
29
|
is_active: boolean
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"currency",
|
|
26
26
|
"knowledge-text",
|
|
27
27
|
"file",
|
|
28
|
-
"file-viewer"
|
|
28
|
+
"file-viewer",
|
|
29
|
+
"record-filter"
|
|
29
30
|
],
|
|
30
31
|
"controls": {
|
|
31
32
|
"string": {
|
|
@@ -33,7 +34,8 @@
|
|
|
33
34
|
"compatible": [
|
|
34
35
|
"text",
|
|
35
36
|
"textarea",
|
|
36
|
-
"password"
|
|
37
|
+
"password",
|
|
38
|
+
"record-filter"
|
|
37
39
|
],
|
|
38
40
|
"byFormat": {
|
|
39
41
|
"email": {
|
|
@@ -20,6 +20,8 @@ export const LayoutElementType = {
|
|
|
20
20
|
Component: 'component',
|
|
21
21
|
Divider: 'divider',
|
|
22
22
|
Text: 'text',
|
|
23
|
+
RecordFilter: 'record_filter',
|
|
24
|
+
List: 'list',
|
|
23
25
|
} as const
|
|
24
26
|
export type LayoutElementType = (typeof LayoutElementType)[keyof typeof LayoutElementType]
|
|
25
27
|
|
|
@@ -151,6 +153,72 @@ export type ComponentElement = CommonProps & {
|
|
|
151
153
|
reserved_height?: number
|
|
152
154
|
}
|
|
153
155
|
|
|
156
|
+
/**
|
|
157
|
+
* A filter builder placed directly on a page. It owns no data of its own: it
|
|
158
|
+
* publishes the filter (and the chosen subject entity) under its element id,
|
|
159
|
+
* and every `list` element naming that id in `filter_element_id` renders the
|
|
160
|
+
* filtered rows.
|
|
161
|
+
*
|
|
162
|
+
* `subject_entity` pins which entity the filter is authored against. When it is
|
|
163
|
+
* absent the element renders a subject picker over the entities its bound lists
|
|
164
|
+
* offer — one entry per bound list, since a list carries exactly one entity.
|
|
165
|
+
*
|
|
166
|
+
* The filter is in-memory: it resets on reload rather than persisting per user.
|
|
167
|
+
*/
|
|
168
|
+
export type RecordFilterElement = CommonProps & {
|
|
169
|
+
type: 'record_filter'
|
|
170
|
+
subject_entity?: string
|
|
171
|
+
/** `toolbar` (default) is the Filter button + active chips, matching every
|
|
172
|
+
* list view. `panel` is the always-open AND/OR editor, for a page whose
|
|
173
|
+
* point IS the filter. */
|
|
174
|
+
variant?: 'toolbar' | 'panel'
|
|
175
|
+
/** Nested AND/OR groups. Defaults to true — the records query carries the
|
|
176
|
+
* whole tree, so there is no reason to hide the affordance. */
|
|
177
|
+
is_complex_enabled?: boolean
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Renders records of a configured List — the record-agnostic sibling of
|
|
182
|
+
* `related_list`, and the only way to show records on a page that has no
|
|
183
|
+
* record of its own.
|
|
184
|
+
*
|
|
185
|
+
* The List supplies everything about presentation and behaviour: columns,
|
|
186
|
+
* sorting, base filters, toolbar actions, selection mode, and which page a row
|
|
187
|
+
* opens. Naming more than one list makes the element switchable; the active one
|
|
188
|
+
* is chosen by the bound filter's subject picker, or by the element's own
|
|
189
|
+
* switcher when it is unbound.
|
|
190
|
+
*
|
|
191
|
+
* `filter_element_id` binds the element to a `record_filter` on the same page.
|
|
192
|
+
* The bound filter is ANDed with the list's own saved filters — it narrows the
|
|
193
|
+
* list, it never replaces what the list declared.
|
|
194
|
+
*/
|
|
195
|
+
export type ListElement = CommonProps & {
|
|
196
|
+
type: 'list'
|
|
197
|
+
/** Slugs of the lists this element can render. At least one. */
|
|
198
|
+
list_slugs: string[]
|
|
199
|
+
/** Element id of the `record_filter` driving this list. Unbound renders the
|
|
200
|
+
* list with its own filters only. */
|
|
201
|
+
filter_element_id?: string
|
|
202
|
+
/**
|
|
203
|
+
* Record-page alternative to `filter_element_id`: the attribute on THIS
|
|
204
|
+
* page's record holding a saved filter (as written by the `record-filter`
|
|
205
|
+
* control). The list then renders what the record's own filter selects —
|
|
206
|
+
* a saved-segment record showing its matches.
|
|
207
|
+
*
|
|
208
|
+
* Mutually exclusive with `filter_element_id`: two filters driving one list
|
|
209
|
+
* has no defined precedence, so the layout validator rejects both at once.
|
|
210
|
+
* Record pages only — a standalone page has no record to read.
|
|
211
|
+
*/
|
|
212
|
+
filter_attribute?: string
|
|
213
|
+
/**
|
|
214
|
+
* Attribute on this page's record naming the subject entity slug. The
|
|
215
|
+
* element renders whichever of `list_slugs` targets that entity. Without
|
|
216
|
+
* it the first configured list wins. Pairs with `filter_attribute`.
|
|
217
|
+
*/
|
|
218
|
+
subject_entity_attribute?: string
|
|
219
|
+
page_size?: number
|
|
220
|
+
}
|
|
221
|
+
|
|
154
222
|
export type DividerElement = CommonProps & {
|
|
155
223
|
type: 'divider'
|
|
156
224
|
}
|
|
@@ -175,6 +243,8 @@ export type LayoutElement =
|
|
|
175
243
|
| ComponentElement
|
|
176
244
|
| DividerElement
|
|
177
245
|
| TextElement
|
|
246
|
+
| RecordFilterElement
|
|
247
|
+
| ListElement
|
|
178
248
|
|
|
179
249
|
// ──────────────────────────────────────────────────────────── Schemas ──
|
|
180
250
|
|
|
@@ -265,6 +335,22 @@ export const LayoutElementSchema: z.ZodType<LayoutElement> = z.lazy(() =>
|
|
|
265
335
|
props: z.record(z.unknown()).optional(),
|
|
266
336
|
reserved_height: z.number().positive().optional(),
|
|
267
337
|
}),
|
|
338
|
+
z.object({
|
|
339
|
+
type: z.literal('record_filter'),
|
|
340
|
+
...commonPropsShape,
|
|
341
|
+
subject_entity: z.string().min(1).optional(),
|
|
342
|
+
variant: z.enum(['toolbar', 'panel']).optional(),
|
|
343
|
+
is_complex_enabled: z.boolean().optional(),
|
|
344
|
+
}),
|
|
345
|
+
z.object({
|
|
346
|
+
type: z.literal('list'),
|
|
347
|
+
...commonPropsShape,
|
|
348
|
+
list_slugs: z.array(z.string().min(1)).min(1),
|
|
349
|
+
filter_element_id: z.string().min(1).optional(),
|
|
350
|
+
filter_attribute: z.string().min(1).optional(),
|
|
351
|
+
subject_entity_attribute: z.string().min(1).optional(),
|
|
352
|
+
page_size: z.number().int().positive().optional(),
|
|
353
|
+
}),
|
|
268
354
|
z.object({
|
|
269
355
|
type: z.literal('divider'),
|
|
270
356
|
...commonPropsShape,
|