@rippling/rippling-sdk 0.2.0-alpha.33 → 0.2.0-alpha.35
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/client.d.mts +8 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +8 -2
- package/client.d.ts.map +1 -1
- package/client.js +17 -0
- package/client.js.map +1 -1
- package/client.mjs +17 -0
- package/client.mjs.map +1 -1
- package/internal/types.d.mts +6 -6
- package/internal/types.d.mts.map +1 -1
- package/internal/types.d.ts +6 -6
- package/internal/types.d.ts.map +1 -1
- package/lib/manifest/_helpers.d.mts +91 -0
- package/lib/manifest/_helpers.d.mts.map +1 -0
- package/lib/manifest/_helpers.d.ts +91 -0
- package/lib/manifest/_helpers.d.ts.map +1 -0
- package/lib/manifest/_helpers.js +65 -0
- package/lib/manifest/_helpers.js.map +1 -0
- package/lib/manifest/_helpers.mjs +61 -0
- package/lib/manifest/_helpers.mjs.map +1 -0
- package/lib/manifest/app.d.mts +113 -0
- package/lib/manifest/app.d.mts.map +1 -0
- package/lib/manifest/app.d.ts +113 -0
- package/lib/manifest/app.d.ts.map +1 -0
- package/lib/manifest/app.js +95 -0
- package/lib/manifest/app.js.map +1 -0
- package/lib/manifest/app.mjs +91 -0
- package/lib/manifest/app.mjs.map +1 -0
- package/lib/manifest/category.d.mts +79 -0
- package/lib/manifest/category.d.mts.map +1 -0
- package/lib/manifest/category.d.ts +79 -0
- package/lib/manifest/category.d.ts.map +1 -0
- package/lib/manifest/category.js +72 -0
- package/lib/manifest/category.js.map +1 -0
- package/lib/manifest/category.mjs +68 -0
- package/lib/manifest/category.mjs.map +1 -0
- package/lib/manifest/custom-object-field-section.d.mts +71 -0
- package/lib/manifest/custom-object-field-section.d.mts.map +1 -0
- package/lib/manifest/custom-object-field-section.d.ts +71 -0
- package/lib/manifest/custom-object-field-section.d.ts.map +1 -0
- package/lib/manifest/custom-object-field-section.js +69 -0
- package/lib/manifest/custom-object-field-section.js.map +1 -0
- package/lib/manifest/custom-object-field-section.mjs +65 -0
- package/lib/manifest/custom-object-field-section.mjs.map +1 -0
- package/lib/manifest/custom-object-page-layout.d.mts +318 -0
- package/lib/manifest/custom-object-page-layout.d.mts.map +1 -0
- package/lib/manifest/custom-object-page-layout.d.ts +318 -0
- package/lib/manifest/custom-object-page-layout.d.ts.map +1 -0
- package/lib/manifest/custom-object-page-layout.js +158 -0
- package/lib/manifest/custom-object-page-layout.js.map +1 -0
- package/lib/manifest/custom-object-page-layout.mjs +154 -0
- package/lib/manifest/custom-object-page-layout.mjs.map +1 -0
- package/lib/manifest/custom-object.d.mts +165 -0
- package/lib/manifest/custom-object.d.mts.map +1 -0
- package/lib/manifest/custom-object.d.ts +165 -0
- package/lib/manifest/custom-object.d.ts.map +1 -0
- package/lib/manifest/custom-object.js +254 -0
- package/lib/manifest/custom-object.js.map +1 -0
- package/lib/manifest/custom-object.mjs +250 -0
- package/lib/manifest/custom-object.mjs.map +1 -0
- package/lib/manifest/field.d.mts +487 -0
- package/lib/manifest/field.d.mts.map +1 -0
- package/lib/manifest/field.d.ts +487 -0
- package/lib/manifest/field.d.ts.map +1 -0
- package/lib/manifest/field.js +461 -0
- package/lib/manifest/field.js.map +1 -0
- package/lib/manifest/field.mjs +438 -0
- package/lib/manifest/field.mjs.map +1 -0
- package/lib/manifest/index.d.mts +15 -0
- package/lib/manifest/index.d.mts.map +1 -0
- package/lib/manifest/index.d.ts +15 -0
- package/lib/manifest/index.d.ts.map +1 -0
- package/lib/manifest/index.js +53 -0
- package/lib/manifest/index.js.map +1 -0
- package/lib/manifest/index.mjs +18 -0
- package/lib/manifest/index.mjs.map +1 -0
- package/lib/manifest/list-view.d.mts +138 -0
- package/lib/manifest/list-view.d.mts.map +1 -0
- package/lib/manifest/list-view.d.ts +138 -0
- package/lib/manifest/list-view.d.ts.map +1 -0
- package/lib/manifest/list-view.js +109 -0
- package/lib/manifest/list-view.js.map +1 -0
- package/lib/manifest/list-view.mjs +105 -0
- package/lib/manifest/list-view.mjs.map +1 -0
- package/lib/manifest/manifest-builder.d.mts +110 -0
- package/lib/manifest/manifest-builder.d.mts.map +1 -0
- package/lib/manifest/manifest-builder.d.ts +110 -0
- package/lib/manifest/manifest-builder.d.ts.map +1 -0
- package/lib/manifest/manifest-builder.js +91 -0
- package/lib/manifest/manifest-builder.js.map +1 -0
- package/lib/manifest/manifest-builder.mjs +87 -0
- package/lib/manifest/manifest-builder.mjs.map +1 -0
- package/lib/manifest/manifest-function.d.mts +119 -0
- package/lib/manifest/manifest-function.d.mts.map +1 -0
- package/lib/manifest/manifest-function.d.ts +119 -0
- package/lib/manifest/manifest-function.d.ts.map +1 -0
- package/lib/manifest/manifest-function.js +85 -0
- package/lib/manifest/manifest-function.js.map +1 -0
- package/lib/manifest/manifest-function.mjs +81 -0
- package/lib/manifest/manifest-function.mjs.map +1 -0
- package/lib/manifest/rule.d.mts +128 -0
- package/lib/manifest/rule.d.mts.map +1 -0
- package/lib/manifest/rule.d.ts +128 -0
- package/lib/manifest/rule.d.ts.map +1 -0
- package/lib/manifest/rule.js +105 -0
- package/lib/manifest/rule.js.map +1 -0
- package/lib/manifest/rule.mjs +101 -0
- package/lib/manifest/rule.mjs.map +1 -0
- package/lib/manifest/sdui-page.d.mts +89 -0
- package/lib/manifest/sdui-page.d.mts.map +1 -0
- package/lib/manifest/sdui-page.d.ts +89 -0
- package/lib/manifest/sdui-page.d.ts.map +1 -0
- package/lib/manifest/sdui-page.js +83 -0
- package/lib/manifest/sdui-page.js.map +1 -0
- package/lib/manifest/sdui-page.mjs +79 -0
- package/lib/manifest/sdui-page.mjs.map +1 -0
- package/lib/manifest/validation.d.mts +116 -0
- package/lib/manifest/validation.d.mts.map +1 -0
- package/lib/manifest/validation.d.ts +116 -0
- package/lib/manifest/validation.d.ts.map +1 -0
- package/lib/manifest/validation.js +83 -0
- package/lib/manifest/validation.js.map +1 -0
- package/lib/manifest/validation.mjs +79 -0
- package/lib/manifest/validation.mjs.map +1 -0
- package/lib/sdui/actions.d.mts +25 -0
- package/lib/sdui/actions.d.mts.map +1 -0
- package/lib/sdui/actions.d.ts +25 -0
- package/lib/sdui/actions.d.ts.map +1 -0
- package/lib/sdui/actions.js +53 -0
- package/lib/sdui/actions.js.map +1 -0
- package/lib/sdui/actions.mjs +42 -0
- package/lib/sdui/actions.mjs.map +1 -0
- package/lib/sdui/component.d.mts +41 -0
- package/lib/sdui/component.d.mts.map +1 -0
- package/lib/sdui/component.d.ts +41 -0
- package/lib/sdui/component.d.ts.map +1 -0
- package/lib/sdui/component.js +95 -0
- package/lib/sdui/component.js.map +1 -0
- package/lib/sdui/component.mjs +91 -0
- package/lib/sdui/component.mjs.map +1 -0
- package/lib/sdui/components.d.mts +149 -0
- package/lib/sdui/components.d.mts.map +1 -0
- package/lib/sdui/components.d.ts +149 -0
- package/lib/sdui/components.d.ts.map +1 -0
- package/lib/sdui/components.js +303 -0
- package/lib/sdui/components.js.map +1 -0
- package/lib/sdui/components.mjs +298 -0
- package/lib/sdui/components.mjs.map +1 -0
- package/lib/sdui/conditions.d.mts +25 -0
- package/lib/sdui/conditions.d.mts.map +1 -0
- package/lib/sdui/conditions.d.ts +25 -0
- package/lib/sdui/conditions.d.ts.map +1 -0
- package/lib/sdui/conditions.js +47 -0
- package/lib/sdui/conditions.js.map +1 -0
- package/lib/sdui/conditions.mjs +35 -0
- package/lib/sdui/conditions.mjs.map +1 -0
- package/lib/sdui/directives.d.mts +18 -0
- package/lib/sdui/directives.d.mts.map +1 -0
- package/lib/sdui/directives.d.ts +18 -0
- package/lib/sdui/directives.d.ts.map +1 -0
- package/lib/sdui/directives.js +28 -0
- package/lib/sdui/directives.js.map +1 -0
- package/lib/sdui/directives.mjs +21 -0
- package/lib/sdui/directives.mjs.map +1 -0
- package/lib/sdui/index.d.mts +362 -0
- package/lib/sdui/index.d.mts.map +1 -0
- package/lib/sdui/index.d.ts +362 -0
- package/lib/sdui/index.d.ts.map +1 -0
- package/lib/sdui/index.js +375 -0
- package/lib/sdui/index.js.map +1 -0
- package/lib/sdui/index.mjs +199 -0
- package/lib/sdui/index.mjs.map +1 -0
- package/lib/sdui/props.d.mts +12 -0
- package/lib/sdui/props.d.mts.map +1 -0
- package/lib/sdui/props.d.ts +12 -0
- package/lib/sdui/props.d.ts.map +1 -0
- package/lib/sdui/props.js +25 -0
- package/lib/sdui/props.js.map +1 -0
- package/lib/sdui/props.mjs +21 -0
- package/lib/sdui/props.mjs.map +1 -0
- package/lib/sdui/render.d.mts +23 -0
- package/lib/sdui/render.d.mts.map +1 -0
- package/lib/sdui/render.d.ts +23 -0
- package/lib/sdui/render.d.ts.map +1 -0
- package/lib/sdui/render.js +40 -0
- package/lib/sdui/render.js.map +1 -0
- package/lib/sdui/render.mjs +37 -0
- package/lib/sdui/render.mjs.map +1 -0
- package/lib/sdui/state.d.mts +22 -0
- package/lib/sdui/state.d.mts.map +1 -0
- package/lib/sdui/state.d.ts +22 -0
- package/lib/sdui/state.d.ts.map +1 -0
- package/lib/sdui/state.js +57 -0
- package/lib/sdui/state.js.map +1 -0
- package/lib/sdui/state.mjs +53 -0
- package/lib/sdui/state.mjs.map +1 -0
- package/package.json +11 -1
- package/resources/draft-hires.d.mts +26 -0
- package/resources/draft-hires.d.mts.map +1 -1
- package/resources/draft-hires.d.ts +26 -0
- package/resources/draft-hires.d.ts.map +1 -1
- package/resources/earnings-inputs.d.mts +99 -1
- package/resources/earnings-inputs.d.mts.map +1 -1
- package/resources/earnings-inputs.d.ts +99 -1
- package/resources/earnings-inputs.d.ts.map +1 -1
- package/resources/earnings-inputs.js +6 -0
- package/resources/earnings-inputs.js.map +1 -1
- package/resources/earnings-inputs.mjs +6 -0
- package/resources/earnings-inputs.mjs.map +1 -1
- package/resources/files.d.mts +164 -0
- package/resources/files.d.mts.map +1 -0
- package/resources/files.d.ts +164 -0
- package/resources/files.d.ts.map +1 -0
- package/resources/files.js +25 -0
- package/resources/files.js.map +1 -0
- package/resources/files.mjs +21 -0
- package/resources/files.mjs.map +1 -0
- package/resources/headcount-positions.d.mts +2 -2
- package/resources/headcount-positions.d.mts.map +1 -1
- package/resources/headcount-positions.d.ts +2 -2
- package/resources/headcount-positions.d.ts.map +1 -1
- package/resources/index.d.mts +2 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +4 -2
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/legal-entities.d.mts +1 -1
- package/resources/legal-entities.d.mts.map +1 -1
- package/resources/legal-entities.d.ts +1 -1
- package/resources/legal-entities.d.ts.map +1 -1
- package/resources/location-factors.d.mts +2 -2
- package/resources/location-factors.d.mts.map +1 -1
- package/resources/location-factors.d.ts +2 -2
- package/resources/location-factors.d.ts.map +1 -1
- package/resources/shared.d.mts +1 -1
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +1 -1
- package/resources/shared.d.ts.map +1 -1
- package/resources/workers.d.mts +2 -2
- package/resources/workers.d.mts.map +1 -1
- package/resources/workers.d.ts +2 -2
- package/resources/workers.d.ts.map +1 -1
- package/src/client.ts +29 -0
- package/src/internal/types.ts +6 -8
- package/src/lib/manifest/_helpers.ts +164 -0
- package/src/lib/manifest/app.ts +163 -0
- package/src/lib/manifest/category.ts +100 -0
- package/src/lib/manifest/custom-object-field-section.ts +93 -0
- package/src/lib/manifest/custom-object-page-layout.ts +427 -0
- package/src/lib/manifest/custom-object.ts +360 -0
- package/src/lib/manifest/field.ts +822 -0
- package/src/lib/manifest/index.ts +114 -0
- package/src/lib/manifest/list-view.ts +183 -0
- package/src/lib/manifest/manifest-builder.ts +140 -0
- package/src/lib/manifest/manifest-function.ts +151 -0
- package/src/lib/manifest/rule.ts +191 -0
- package/src/lib/manifest/sdui-page.ts +118 -0
- package/src/lib/manifest/validation.ts +150 -0
- package/src/lib/sdui/actions.ts +58 -0
- package/src/lib/sdui/component.ts +122 -0
- package/src/lib/sdui/components.ts +308 -0
- package/src/lib/sdui/conditions.ts +59 -0
- package/src/lib/sdui/directives.ts +42 -0
- package/src/lib/sdui/index.ts +365 -0
- package/src/lib/sdui/props.ts +32 -0
- package/src/lib/sdui/render.ts +58 -0
- package/src/lib/sdui/state.ts +60 -0
- package/src/resources/draft-hires.ts +31 -0
- package/src/resources/earnings-inputs.ts +127 -0
- package/src/resources/files.ts +203 -0
- package/src/resources/headcount-positions.ts +2 -0
- package/src/resources/index.ts +3 -0
- package/src/resources/legal-entities.ts +1 -0
- package/src/resources/location-factors.ts +2 -0
- package/src/resources/shared.ts +1 -0
- package/src/resources/workers.ts +2 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { type ObjectScope, type SortOrder } from "./_helpers.mjs";
|
|
2
|
+
import type { CustomObject } from "./custom-object.mjs";
|
|
3
|
+
import type { Field } from "./field.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Initialization properties for {@link ListViewDef}.
|
|
6
|
+
*/
|
|
7
|
+
export interface ListViewDefProps {
|
|
8
|
+
/**
|
|
9
|
+
* Display name of this list view shown in the UI (e.g. `'All members'`).
|
|
10
|
+
*
|
|
11
|
+
* Required.
|
|
12
|
+
*/
|
|
13
|
+
name: string;
|
|
14
|
+
/**
|
|
15
|
+
* Columns to display, as live {@link Field} references. At least one field is required.
|
|
16
|
+
*
|
|
17
|
+
* Required.
|
|
18
|
+
*/
|
|
19
|
+
fields: Field[];
|
|
20
|
+
/**
|
|
21
|
+
* Whether this view is visible to all users (`true`) or only the record owner (`false`).
|
|
22
|
+
*
|
|
23
|
+
* Required.
|
|
24
|
+
*/
|
|
25
|
+
isPublic: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Stable identifier for this view. Pass a human-readable slug
|
|
28
|
+
* (e.g. `'view_gym_all_members'`) to keep it stable across regenerations.
|
|
29
|
+
*
|
|
30
|
+
* Optional. Auto-generated when omitted. @default generateId('view')
|
|
31
|
+
*/
|
|
32
|
+
viewId?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Field to sort by. Required when `sortOrder` is set.
|
|
35
|
+
*
|
|
36
|
+
* Optional.
|
|
37
|
+
*/
|
|
38
|
+
orderBy?: Field;
|
|
39
|
+
/**
|
|
40
|
+
* Sort direction. One of `'ASC'` | `'DESC'`. Requires `orderBy` to be set.
|
|
41
|
+
*
|
|
42
|
+
* Optional.
|
|
43
|
+
*/
|
|
44
|
+
sortOrder?: SortOrder;
|
|
45
|
+
/**
|
|
46
|
+
* Record scope for this view. One of `'all'` | `'my_records'`.
|
|
47
|
+
*
|
|
48
|
+
* Optional. @default `'all'`
|
|
49
|
+
*/
|
|
50
|
+
objectScope?: ObjectScope;
|
|
51
|
+
/**
|
|
52
|
+
* Human-readable description of this view.
|
|
53
|
+
*
|
|
54
|
+
* Optional. @default null
|
|
55
|
+
*/
|
|
56
|
+
description?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Per-column configuration overrides (width, visibility, etc.).
|
|
59
|
+
*
|
|
60
|
+
* Optional. @default `{}`
|
|
61
|
+
*/
|
|
62
|
+
columnConfig?: Record<string, any>;
|
|
63
|
+
/**
|
|
64
|
+
* RQL filter expression to pre-filter records shown in this view
|
|
65
|
+
* (e.g. `'(session_date__c == TODAY())'`).
|
|
66
|
+
*
|
|
67
|
+
* Optional. @default null
|
|
68
|
+
*/
|
|
69
|
+
rqlFilter?: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Defines a list view and registers it with the manifest.
|
|
73
|
+
*
|
|
74
|
+
* A list view defines which fields appear as columns, their sort order, and an
|
|
75
|
+
* optional RQL filter. You can define multiple views per custom object; each
|
|
76
|
+
* appears as a selectable view in the object's list page.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* new ListViewDef(memberObj, {
|
|
81
|
+
* viewId: 'view_gym_all_members',
|
|
82
|
+
* name: 'All members',
|
|
83
|
+
* description: 'Directory with membership status',
|
|
84
|
+
* fields: [memberDisplayName, memberEmail, memberPhone, memberStatusField, memberJoinDate],
|
|
85
|
+
* orderBy: memberLastName,
|
|
86
|
+
* sortOrder: 'ASC',
|
|
87
|
+
* isPublic: true,
|
|
88
|
+
* objectScope: 'all',
|
|
89
|
+
* });
|
|
90
|
+
*
|
|
91
|
+
* // Filtered view example:
|
|
92
|
+
* new ListViewDef(sessionObj, {
|
|
93
|
+
* viewId: 'view_gym_today_sessions',
|
|
94
|
+
* name: 'Today\'s class sessions',
|
|
95
|
+
* fields: [sessionTrainerRef, sessionStartField, sessionClassTypeField],
|
|
96
|
+
* orderBy: sessionStartField,
|
|
97
|
+
* sortOrder: 'ASC',
|
|
98
|
+
* isPublic: true,
|
|
99
|
+
* objectScope: 'all',
|
|
100
|
+
* rqlFilter: '(session_date__c == TODAY())',
|
|
101
|
+
* });
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare class ListViewDef {
|
|
105
|
+
private readonly _viewId;
|
|
106
|
+
private readonly _customObjectApiName;
|
|
107
|
+
private readonly _name;
|
|
108
|
+
private readonly _fields;
|
|
109
|
+
private readonly _isPublic;
|
|
110
|
+
private readonly _orderBy;
|
|
111
|
+
private readonly _sortOrder;
|
|
112
|
+
private readonly _objectScope;
|
|
113
|
+
private readonly _description;
|
|
114
|
+
private readonly _columnConfig;
|
|
115
|
+
private readonly _rqlFilter;
|
|
116
|
+
/**
|
|
117
|
+
* @param customObject - The custom object this view belongs to.
|
|
118
|
+
* @param props - Initialization properties.
|
|
119
|
+
* @throws {Error} If `name` is empty, `fields` is empty, or `sortOrder` is set without `orderBy`.
|
|
120
|
+
*/
|
|
121
|
+
constructor(customObject: CustomObject, props: ListViewDefProps);
|
|
122
|
+
/**
|
|
123
|
+
* Returns the stable identifier for this view (e.g. `'view_gym_all_members'`).
|
|
124
|
+
*/
|
|
125
|
+
getViewId(): string;
|
|
126
|
+
/**
|
|
127
|
+
* Returns the api_name of the custom object this view belongs to.
|
|
128
|
+
*/
|
|
129
|
+
getCustomObjectApiName(): string;
|
|
130
|
+
/**
|
|
131
|
+
* Serializes this list view to the wire format consumed by the manifest install endpoint.
|
|
132
|
+
*
|
|
133
|
+
* @returns A plain object with `type: 'CUSTOM_OBJECT_LIST_VIEW'`.
|
|
134
|
+
* Optional fields are omitted when unset.
|
|
135
|
+
*/
|
|
136
|
+
toDict(): Record<string, any>;
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=list-view.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-view.d.mts","sourceRoot":"","sources":["../../src/lib/manifest/list-view.ts"],"names":[],"mappings":"OAAO,EAAc,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE;OAChD,KAAK,EAAE,YAAY,EAAE;OACrB,KAAK,EAAE,KAAK,EAAE;AAErB;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;IAC9C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAU;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAC7C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAwB;IACnD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA0B;IACvD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqB;IAClD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkC;IAChE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAqB;IAEhD;;;;OAIG;gBACS,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;IAsB/D;;OAEG;IACH,SAAS,IAAI,MAAM;IAInB;;OAEG;IACH,sBAAsB,IAAI,MAAM;IAIhC;;;;;OAKG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAiB9B"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { type ObjectScope, type SortOrder } from "./_helpers.js";
|
|
2
|
+
import type { CustomObject } from "./custom-object.js";
|
|
3
|
+
import type { Field } from "./field.js";
|
|
4
|
+
/**
|
|
5
|
+
* Initialization properties for {@link ListViewDef}.
|
|
6
|
+
*/
|
|
7
|
+
export interface ListViewDefProps {
|
|
8
|
+
/**
|
|
9
|
+
* Display name of this list view shown in the UI (e.g. `'All members'`).
|
|
10
|
+
*
|
|
11
|
+
* Required.
|
|
12
|
+
*/
|
|
13
|
+
name: string;
|
|
14
|
+
/**
|
|
15
|
+
* Columns to display, as live {@link Field} references. At least one field is required.
|
|
16
|
+
*
|
|
17
|
+
* Required.
|
|
18
|
+
*/
|
|
19
|
+
fields: Field[];
|
|
20
|
+
/**
|
|
21
|
+
* Whether this view is visible to all users (`true`) or only the record owner (`false`).
|
|
22
|
+
*
|
|
23
|
+
* Required.
|
|
24
|
+
*/
|
|
25
|
+
isPublic: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Stable identifier for this view. Pass a human-readable slug
|
|
28
|
+
* (e.g. `'view_gym_all_members'`) to keep it stable across regenerations.
|
|
29
|
+
*
|
|
30
|
+
* Optional. Auto-generated when omitted. @default generateId('view')
|
|
31
|
+
*/
|
|
32
|
+
viewId?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Field to sort by. Required when `sortOrder` is set.
|
|
35
|
+
*
|
|
36
|
+
* Optional.
|
|
37
|
+
*/
|
|
38
|
+
orderBy?: Field;
|
|
39
|
+
/**
|
|
40
|
+
* Sort direction. One of `'ASC'` | `'DESC'`. Requires `orderBy` to be set.
|
|
41
|
+
*
|
|
42
|
+
* Optional.
|
|
43
|
+
*/
|
|
44
|
+
sortOrder?: SortOrder;
|
|
45
|
+
/**
|
|
46
|
+
* Record scope for this view. One of `'all'` | `'my_records'`.
|
|
47
|
+
*
|
|
48
|
+
* Optional. @default `'all'`
|
|
49
|
+
*/
|
|
50
|
+
objectScope?: ObjectScope;
|
|
51
|
+
/**
|
|
52
|
+
* Human-readable description of this view.
|
|
53
|
+
*
|
|
54
|
+
* Optional. @default null
|
|
55
|
+
*/
|
|
56
|
+
description?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Per-column configuration overrides (width, visibility, etc.).
|
|
59
|
+
*
|
|
60
|
+
* Optional. @default `{}`
|
|
61
|
+
*/
|
|
62
|
+
columnConfig?: Record<string, any>;
|
|
63
|
+
/**
|
|
64
|
+
* RQL filter expression to pre-filter records shown in this view
|
|
65
|
+
* (e.g. `'(session_date__c == TODAY())'`).
|
|
66
|
+
*
|
|
67
|
+
* Optional. @default null
|
|
68
|
+
*/
|
|
69
|
+
rqlFilter?: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Defines a list view and registers it with the manifest.
|
|
73
|
+
*
|
|
74
|
+
* A list view defines which fields appear as columns, their sort order, and an
|
|
75
|
+
* optional RQL filter. You can define multiple views per custom object; each
|
|
76
|
+
* appears as a selectable view in the object's list page.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* new ListViewDef(memberObj, {
|
|
81
|
+
* viewId: 'view_gym_all_members',
|
|
82
|
+
* name: 'All members',
|
|
83
|
+
* description: 'Directory with membership status',
|
|
84
|
+
* fields: [memberDisplayName, memberEmail, memberPhone, memberStatusField, memberJoinDate],
|
|
85
|
+
* orderBy: memberLastName,
|
|
86
|
+
* sortOrder: 'ASC',
|
|
87
|
+
* isPublic: true,
|
|
88
|
+
* objectScope: 'all',
|
|
89
|
+
* });
|
|
90
|
+
*
|
|
91
|
+
* // Filtered view example:
|
|
92
|
+
* new ListViewDef(sessionObj, {
|
|
93
|
+
* viewId: 'view_gym_today_sessions',
|
|
94
|
+
* name: 'Today\'s class sessions',
|
|
95
|
+
* fields: [sessionTrainerRef, sessionStartField, sessionClassTypeField],
|
|
96
|
+
* orderBy: sessionStartField,
|
|
97
|
+
* sortOrder: 'ASC',
|
|
98
|
+
* isPublic: true,
|
|
99
|
+
* objectScope: 'all',
|
|
100
|
+
* rqlFilter: '(session_date__c == TODAY())',
|
|
101
|
+
* });
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare class ListViewDef {
|
|
105
|
+
private readonly _viewId;
|
|
106
|
+
private readonly _customObjectApiName;
|
|
107
|
+
private readonly _name;
|
|
108
|
+
private readonly _fields;
|
|
109
|
+
private readonly _isPublic;
|
|
110
|
+
private readonly _orderBy;
|
|
111
|
+
private readonly _sortOrder;
|
|
112
|
+
private readonly _objectScope;
|
|
113
|
+
private readonly _description;
|
|
114
|
+
private readonly _columnConfig;
|
|
115
|
+
private readonly _rqlFilter;
|
|
116
|
+
/**
|
|
117
|
+
* @param customObject - The custom object this view belongs to.
|
|
118
|
+
* @param props - Initialization properties.
|
|
119
|
+
* @throws {Error} If `name` is empty, `fields` is empty, or `sortOrder` is set without `orderBy`.
|
|
120
|
+
*/
|
|
121
|
+
constructor(customObject: CustomObject, props: ListViewDefProps);
|
|
122
|
+
/**
|
|
123
|
+
* Returns the stable identifier for this view (e.g. `'view_gym_all_members'`).
|
|
124
|
+
*/
|
|
125
|
+
getViewId(): string;
|
|
126
|
+
/**
|
|
127
|
+
* Returns the api_name of the custom object this view belongs to.
|
|
128
|
+
*/
|
|
129
|
+
getCustomObjectApiName(): string;
|
|
130
|
+
/**
|
|
131
|
+
* Serializes this list view to the wire format consumed by the manifest install endpoint.
|
|
132
|
+
*
|
|
133
|
+
* @returns A plain object with `type: 'CUSTOM_OBJECT_LIST_VIEW'`.
|
|
134
|
+
* Optional fields are omitted when unset.
|
|
135
|
+
*/
|
|
136
|
+
toDict(): Record<string, any>;
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=list-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-view.d.ts","sourceRoot":"","sources":["../../src/lib/manifest/list-view.ts"],"names":[],"mappings":"OAAO,EAAc,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE;OAChD,KAAK,EAAE,YAAY,EAAE;OACrB,KAAK,EAAE,KAAK,EAAE;AAErB;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;IAC9C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAU;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAC7C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAwB;IACnD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA0B;IACvD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqB;IAClD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkC;IAChE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAqB;IAEhD;;;;OAIG;gBACS,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;IAsB/D;;OAEG;IACH,SAAS,IAAI,MAAM;IAInB;;OAEG;IACH,sBAAsB,IAAI,MAAM;IAIhC;;;;;OAKG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAiB9B"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListViewDef = void 0;
|
|
4
|
+
const _helpers_1 = require("./_helpers.js");
|
|
5
|
+
/**
|
|
6
|
+
* Defines a list view and registers it with the manifest.
|
|
7
|
+
*
|
|
8
|
+
* A list view defines which fields appear as columns, their sort order, and an
|
|
9
|
+
* optional RQL filter. You can define multiple views per custom object; each
|
|
10
|
+
* appears as a selectable view in the object's list page.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* new ListViewDef(memberObj, {
|
|
15
|
+
* viewId: 'view_gym_all_members',
|
|
16
|
+
* name: 'All members',
|
|
17
|
+
* description: 'Directory with membership status',
|
|
18
|
+
* fields: [memberDisplayName, memberEmail, memberPhone, memberStatusField, memberJoinDate],
|
|
19
|
+
* orderBy: memberLastName,
|
|
20
|
+
* sortOrder: 'ASC',
|
|
21
|
+
* isPublic: true,
|
|
22
|
+
* objectScope: 'all',
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Filtered view example:
|
|
26
|
+
* new ListViewDef(sessionObj, {
|
|
27
|
+
* viewId: 'view_gym_today_sessions',
|
|
28
|
+
* name: 'Today\'s class sessions',
|
|
29
|
+
* fields: [sessionTrainerRef, sessionStartField, sessionClassTypeField],
|
|
30
|
+
* orderBy: sessionStartField,
|
|
31
|
+
* sortOrder: 'ASC',
|
|
32
|
+
* isPublic: true,
|
|
33
|
+
* objectScope: 'all',
|
|
34
|
+
* rqlFilter: '(session_date__c == TODAY())',
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
class ListViewDef {
|
|
39
|
+
/**
|
|
40
|
+
* @param customObject - The custom object this view belongs to.
|
|
41
|
+
* @param props - Initialization properties.
|
|
42
|
+
* @throws {Error} If `name` is empty, `fields` is empty, or `sortOrder` is set without `orderBy`.
|
|
43
|
+
*/
|
|
44
|
+
constructor(customObject, props) {
|
|
45
|
+
if (!props.name)
|
|
46
|
+
throw new Error('ListViewDef: name cannot be empty');
|
|
47
|
+
if (!props.fields || props.fields.length === 0) {
|
|
48
|
+
throw new Error('ListViewDef: must have at least one field');
|
|
49
|
+
}
|
|
50
|
+
if (props.sortOrder && !props.orderBy) {
|
|
51
|
+
throw new Error('ListViewDef: sortOrder requires orderBy to be set');
|
|
52
|
+
}
|
|
53
|
+
this._viewId = props.viewId ?? (0, _helpers_1.generateId)('view');
|
|
54
|
+
this._customObjectApiName = customObject.getApiName();
|
|
55
|
+
this._name = props.name;
|
|
56
|
+
this._fields = [...props.fields];
|
|
57
|
+
this._isPublic = props.isPublic;
|
|
58
|
+
this._orderBy = props.orderBy;
|
|
59
|
+
this._sortOrder = props.sortOrder;
|
|
60
|
+
this._objectScope = props.objectScope ?? 'all';
|
|
61
|
+
this._description = props.description;
|
|
62
|
+
this._columnConfig = props.columnConfig;
|
|
63
|
+
this._rqlFilter = props.rqlFilter;
|
|
64
|
+
customObject._register(this);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Returns the stable identifier for this view (e.g. `'view_gym_all_members'`).
|
|
68
|
+
*/
|
|
69
|
+
getViewId() {
|
|
70
|
+
return this._viewId;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Returns the api_name of the custom object this view belongs to.
|
|
74
|
+
*/
|
|
75
|
+
getCustomObjectApiName() {
|
|
76
|
+
return this._customObjectApiName;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Serializes this list view to the wire format consumed by the manifest install endpoint.
|
|
80
|
+
*
|
|
81
|
+
* @returns A plain object with `type: 'CUSTOM_OBJECT_LIST_VIEW'`.
|
|
82
|
+
* Optional fields are omitted when unset.
|
|
83
|
+
*/
|
|
84
|
+
toDict() {
|
|
85
|
+
const d = {
|
|
86
|
+
type: 'CUSTOM_OBJECT_LIST_VIEW',
|
|
87
|
+
object_rql_name: this._customObjectApiName,
|
|
88
|
+
view_id: this._viewId,
|
|
89
|
+
name: this._name,
|
|
90
|
+
public: this._isPublic,
|
|
91
|
+
fields: this._fields.map((f) => f.getApiName()),
|
|
92
|
+
};
|
|
93
|
+
if (this._description != null)
|
|
94
|
+
d['description'] = this._description;
|
|
95
|
+
if (this._objectScope != null)
|
|
96
|
+
d['object_scope'] = this._objectScope;
|
|
97
|
+
if (this._sortOrder != null)
|
|
98
|
+
d['sort_order'] = this._sortOrder;
|
|
99
|
+
if (this._orderBy != null)
|
|
100
|
+
d['order_by'] = this._orderBy.getApiName();
|
|
101
|
+
if (this._columnConfig != null)
|
|
102
|
+
d['column_config'] = this._columnConfig;
|
|
103
|
+
if (this._rqlFilter != null)
|
|
104
|
+
d['rql_filter'] = this._rqlFilter;
|
|
105
|
+
return d;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.ListViewDef = ListViewDef;
|
|
109
|
+
//# sourceMappingURL=list-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-view.js","sourceRoot":"","sources":["../../src/lib/manifest/list-view.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { generateId } from "./_helpers.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Defines a list view and registers it with the manifest.
|
|
4
|
+
*
|
|
5
|
+
* A list view defines which fields appear as columns, their sort order, and an
|
|
6
|
+
* optional RQL filter. You can define multiple views per custom object; each
|
|
7
|
+
* appears as a selectable view in the object's list page.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* new ListViewDef(memberObj, {
|
|
12
|
+
* viewId: 'view_gym_all_members',
|
|
13
|
+
* name: 'All members',
|
|
14
|
+
* description: 'Directory with membership status',
|
|
15
|
+
* fields: [memberDisplayName, memberEmail, memberPhone, memberStatusField, memberJoinDate],
|
|
16
|
+
* orderBy: memberLastName,
|
|
17
|
+
* sortOrder: 'ASC',
|
|
18
|
+
* isPublic: true,
|
|
19
|
+
* objectScope: 'all',
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* // Filtered view example:
|
|
23
|
+
* new ListViewDef(sessionObj, {
|
|
24
|
+
* viewId: 'view_gym_today_sessions',
|
|
25
|
+
* name: 'Today\'s class sessions',
|
|
26
|
+
* fields: [sessionTrainerRef, sessionStartField, sessionClassTypeField],
|
|
27
|
+
* orderBy: sessionStartField,
|
|
28
|
+
* sortOrder: 'ASC',
|
|
29
|
+
* isPublic: true,
|
|
30
|
+
* objectScope: 'all',
|
|
31
|
+
* rqlFilter: '(session_date__c == TODAY())',
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export class ListViewDef {
|
|
36
|
+
/**
|
|
37
|
+
* @param customObject - The custom object this view belongs to.
|
|
38
|
+
* @param props - Initialization properties.
|
|
39
|
+
* @throws {Error} If `name` is empty, `fields` is empty, or `sortOrder` is set without `orderBy`.
|
|
40
|
+
*/
|
|
41
|
+
constructor(customObject, props) {
|
|
42
|
+
if (!props.name)
|
|
43
|
+
throw new Error('ListViewDef: name cannot be empty');
|
|
44
|
+
if (!props.fields || props.fields.length === 0) {
|
|
45
|
+
throw new Error('ListViewDef: must have at least one field');
|
|
46
|
+
}
|
|
47
|
+
if (props.sortOrder && !props.orderBy) {
|
|
48
|
+
throw new Error('ListViewDef: sortOrder requires orderBy to be set');
|
|
49
|
+
}
|
|
50
|
+
this._viewId = props.viewId ?? generateId('view');
|
|
51
|
+
this._customObjectApiName = customObject.getApiName();
|
|
52
|
+
this._name = props.name;
|
|
53
|
+
this._fields = [...props.fields];
|
|
54
|
+
this._isPublic = props.isPublic;
|
|
55
|
+
this._orderBy = props.orderBy;
|
|
56
|
+
this._sortOrder = props.sortOrder;
|
|
57
|
+
this._objectScope = props.objectScope ?? 'all';
|
|
58
|
+
this._description = props.description;
|
|
59
|
+
this._columnConfig = props.columnConfig;
|
|
60
|
+
this._rqlFilter = props.rqlFilter;
|
|
61
|
+
customObject._register(this);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Returns the stable identifier for this view (e.g. `'view_gym_all_members'`).
|
|
65
|
+
*/
|
|
66
|
+
getViewId() {
|
|
67
|
+
return this._viewId;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Returns the api_name of the custom object this view belongs to.
|
|
71
|
+
*/
|
|
72
|
+
getCustomObjectApiName() {
|
|
73
|
+
return this._customObjectApiName;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Serializes this list view to the wire format consumed by the manifest install endpoint.
|
|
77
|
+
*
|
|
78
|
+
* @returns A plain object with `type: 'CUSTOM_OBJECT_LIST_VIEW'`.
|
|
79
|
+
* Optional fields are omitted when unset.
|
|
80
|
+
*/
|
|
81
|
+
toDict() {
|
|
82
|
+
const d = {
|
|
83
|
+
type: 'CUSTOM_OBJECT_LIST_VIEW',
|
|
84
|
+
object_rql_name: this._customObjectApiName,
|
|
85
|
+
view_id: this._viewId,
|
|
86
|
+
name: this._name,
|
|
87
|
+
public: this._isPublic,
|
|
88
|
+
fields: this._fields.map((f) => f.getApiName()),
|
|
89
|
+
};
|
|
90
|
+
if (this._description != null)
|
|
91
|
+
d['description'] = this._description;
|
|
92
|
+
if (this._objectScope != null)
|
|
93
|
+
d['object_scope'] = this._objectScope;
|
|
94
|
+
if (this._sortOrder != null)
|
|
95
|
+
d['sort_order'] = this._sortOrder;
|
|
96
|
+
if (this._orderBy != null)
|
|
97
|
+
d['order_by'] = this._orderBy.getApiName();
|
|
98
|
+
if (this._columnConfig != null)
|
|
99
|
+
d['column_config'] = this._columnConfig;
|
|
100
|
+
if (this._rqlFilter != null)
|
|
101
|
+
d['rql_filter'] = this._rqlFilter;
|
|
102
|
+
return d;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=list-view.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-view.mjs","sourceRoot":"","sources":["../../src/lib/manifest/list-view.ts"],"names":[],"mappings":"OAAO,EAAE,UAAU,EAAoC;AAwEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,OAAO,WAAW;IAatB;;;;OAIG;IACH,YAAY,YAA0B,EAAE,KAAuB;QAC7D,IAAI,CAAC,KAAK,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACtE,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC/D,CAAC;QACD,IAAI,KAAK,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;QAClD,IAAI,CAAC,oBAAoB,GAAG,YAAY,CAAC,UAAU,EAAE,CAAC;QACtD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC;QAC/C,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC;QACtC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,YAAY,CAAC;QACxC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC;QAClC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,sBAAsB;QACpB,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,MAAM;QACJ,MAAM,CAAC,GAAwB;YAC7B,IAAI,EAAE,yBAAyB;YAC/B,eAAe,EAAE,IAAI,CAAC,oBAAoB;YAC1C,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,MAAM,EAAE,IAAI,CAAC,SAAS;YACtB,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;SAChD,CAAC;QACF,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI;YAAE,CAAC,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC;QACpE,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI;YAAE,CAAC,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC;QACrE,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI;YAAE,CAAC,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC;QAC/D,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI;YAAE,CAAC,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QACtE,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI;YAAE,CAAC,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC;QACxE,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI;YAAE,CAAC,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC;QAC/D,OAAO,CAAC,CAAC;IACX,CAAC;CACF"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Any object that can be included in a manifest.
|
|
3
|
+
*
|
|
4
|
+
* Implement `toDict()` to return the component's wire-format dict.
|
|
5
|
+
* All built-in SDK classes implement this interface automatically.
|
|
6
|
+
*/
|
|
7
|
+
export interface ManifestComponent {
|
|
8
|
+
toDict(): Record<string, any>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A scope — anything that can accept child component registrations.
|
|
12
|
+
*
|
|
13
|
+
* Implemented by {@link ManifestBuilder} (the root) and by nestable parents
|
|
14
|
+
* like `CustomObject` that forward registrations up to the builder.
|
|
15
|
+
* Pass a scope as the first argument when constructing any manifest component.
|
|
16
|
+
*/
|
|
17
|
+
export interface ManifestScope {
|
|
18
|
+
/** @internal Register a child component; builder-bound scopes forward up. */
|
|
19
|
+
_register(component: ManifestComponent): void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Initialization properties for {@link ManifestBuilder}.
|
|
23
|
+
*/
|
|
24
|
+
export interface ManifestBuilderProps {
|
|
25
|
+
/**
|
|
26
|
+
* Unique project key for this manifest (e.g. `'gym_membership_management'`).
|
|
27
|
+
*
|
|
28
|
+
* Required.
|
|
29
|
+
*/
|
|
30
|
+
key: string;
|
|
31
|
+
/**
|
|
32
|
+
* Display name for this manifest.
|
|
33
|
+
*
|
|
34
|
+
* Optional. Defaults to `key` when not provided.
|
|
35
|
+
*/
|
|
36
|
+
name?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Human-readable description of what this manifest contains.
|
|
39
|
+
*
|
|
40
|
+
* Optional.
|
|
41
|
+
*/
|
|
42
|
+
description?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Root container for a manifest — collects all components and serializes them to JSON.
|
|
46
|
+
*
|
|
47
|
+
* You would normally create one `ManifestBuilder` at the top of your manifest file,
|
|
48
|
+
* then pass it as the scope to all top-level components (categories, custom objects,
|
|
49
|
+
* functions, apps, SDUI pages). Each component auto-registers on construction; there
|
|
50
|
+
* is no separate add or register call.
|
|
51
|
+
*
|
|
52
|
+
* After defining all components, call `preview()` to emit the manifest as a
|
|
53
|
+
* pretty-printed JSON string, or `buildManifest()` to get the plain object.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const manifest = new ManifestBuilder({
|
|
58
|
+
* key: 'gym_membership_management',
|
|
59
|
+
* name: 'Gym Membership Management',
|
|
60
|
+
* description: 'Members, trainers, schedules, and check-in',
|
|
61
|
+
* });
|
|
62
|
+
*
|
|
63
|
+
* const category = new Category(manifest, { apiName: 'gym__c', name: 'Gym' });
|
|
64
|
+
* const memberObj = new CustomObject(manifest, { apiName: 'gym_member__c', name: 'Member', category });
|
|
65
|
+
* // ... define fields, rules, list views, etc. ...
|
|
66
|
+
*
|
|
67
|
+
* console.log(manifest.preview());
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare class ManifestBuilder implements ManifestScope {
|
|
71
|
+
readonly key: string;
|
|
72
|
+
readonly name: string;
|
|
73
|
+
readonly description: string;
|
|
74
|
+
private readonly _components;
|
|
75
|
+
/**
|
|
76
|
+
* @param props - Initialization properties.
|
|
77
|
+
* @throws {Error} If `props.key` is empty or missing.
|
|
78
|
+
*/
|
|
79
|
+
constructor(props: ManifestBuilderProps);
|
|
80
|
+
/**
|
|
81
|
+
* @internal Scope hook invoked by child constructors. Components enter the
|
|
82
|
+
* manifest here — there is no other path.
|
|
83
|
+
*/
|
|
84
|
+
_register(component: ManifestComponent): void;
|
|
85
|
+
/**
|
|
86
|
+
* Returns the manifest as a plain object with `metadata` and a flat `components` array.
|
|
87
|
+
*
|
|
88
|
+
* @returns `{ metadata: { key, name, description? }, components: Record<string, any>[] }`
|
|
89
|
+
*/
|
|
90
|
+
buildManifest(): {
|
|
91
|
+
metadata: Record<string, any>;
|
|
92
|
+
components: Record<string, any>[];
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Returns the flat list of all registered component dicts.
|
|
96
|
+
*
|
|
97
|
+
* @returns An array of wire-format component objects, in registration order.
|
|
98
|
+
*/
|
|
99
|
+
componentsList(): Record<string, any>[];
|
|
100
|
+
/**
|
|
101
|
+
* Returns the full manifest as a pretty-printed JSON string.
|
|
102
|
+
*
|
|
103
|
+
* Typically used as the final line of a manifest file to emit the output:
|
|
104
|
+
* `console.log(manifest.preview())`.
|
|
105
|
+
*
|
|
106
|
+
* @returns Indented JSON string of the complete manifest.
|
|
107
|
+
*/
|
|
108
|
+
preview(): string;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=manifest-builder.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-builder.d.mts","sourceRoot":"","sources":["../../src/lib/manifest/manifest-builder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,6EAA6E;IAC7E,SAAS,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC/C;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,eAAgB,YAAW,aAAa;IACnD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA2B;IAEvD;;;OAGG;gBACS,KAAK,EAAE,oBAAoB;IASvC;;;OAGG;IACH,SAAS,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI;IAO7C;;;;OAIG;IACH,aAAa,IAAI;QAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAA;KAAE;IAYrF;;;;OAIG;IACH,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;IAIvC;;;;;;;OAOG;IACH,OAAO,IAAI,MAAM;CAGlB"}
|