@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,250 @@
|
|
|
1
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
2
|
+
// Platform-managed standard fields — mirrors
|
|
3
|
+
// `app/hub_platform/custom_objects/constants.py::STANDARD_FIELDS`.
|
|
4
|
+
// Kept here (not in `field.ts`) so the `Field` class stays focused on
|
|
5
|
+
// user-authored `__c` fields with full validation.
|
|
6
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
7
|
+
/** Specs for the 9 standard fields every CO ships with. Order matches the backend constant. */
|
|
8
|
+
const STANDARD_FIELD_SPECS = [
|
|
9
|
+
{
|
|
10
|
+
apiName: 'id',
|
|
11
|
+
displayName: 'ID',
|
|
12
|
+
description: 'The Rippling ID of a record',
|
|
13
|
+
dataType: { field_type: 'TEXT' },
|
|
14
|
+
required: true,
|
|
15
|
+
unique: true,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
apiName: 'created_at',
|
|
19
|
+
displayName: 'Created Date',
|
|
20
|
+
description: 'The date and time a record was created',
|
|
21
|
+
dataType: { field_type: 'DATETIME' },
|
|
22
|
+
required: false,
|
|
23
|
+
unique: false,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
apiName: 'updated_at',
|
|
27
|
+
displayName: 'Last Modified Date',
|
|
28
|
+
description: 'The date and time a record was last updated',
|
|
29
|
+
dataType: { field_type: 'DATETIME' },
|
|
30
|
+
required: false,
|
|
31
|
+
unique: false,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
apiName: 'system_updated_at',
|
|
35
|
+
displayName: 'System Modified At',
|
|
36
|
+
description: 'The date and time a record was last updated by the system',
|
|
37
|
+
dataType: { field_type: 'DATETIME' },
|
|
38
|
+
required: false,
|
|
39
|
+
unique: false,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
apiName: 'external_id',
|
|
43
|
+
displayName: 'External ID',
|
|
44
|
+
description: 'The external identifier for a record used in third party integrations',
|
|
45
|
+
dataType: { field_type: 'TEXT' },
|
|
46
|
+
required: false,
|
|
47
|
+
unique: true,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
apiName: 'name',
|
|
51
|
+
displayName: 'Name',
|
|
52
|
+
description: 'A string used to describe a record. This is used for display purposes as well as search',
|
|
53
|
+
dataType: { field_type: 'TEXT' },
|
|
54
|
+
required: true,
|
|
55
|
+
unique: false,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
apiName: 'owner_role',
|
|
59
|
+
displayName: 'Owner',
|
|
60
|
+
description: 'The Employee responsible for the record. This is used by Permissions to determine who has ability to view, edit, and delete data',
|
|
61
|
+
dataType: {
|
|
62
|
+
field_type: 'NATIVE_EDGE',
|
|
63
|
+
og_model_rql_name: 'Employee',
|
|
64
|
+
db_model_name: 'RoleWithCompany',
|
|
65
|
+
reference_column_storage_type: 'STRING',
|
|
66
|
+
},
|
|
67
|
+
required: false,
|
|
68
|
+
unique: false,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
apiName: 'last_modified_by',
|
|
72
|
+
displayName: 'Last Modified by',
|
|
73
|
+
description: 'The Employee who made the latest change.',
|
|
74
|
+
dataType: {
|
|
75
|
+
field_type: 'NATIVE_EDGE',
|
|
76
|
+
og_model_rql_name: 'Employee',
|
|
77
|
+
db_model_name: 'RoleWithCompany',
|
|
78
|
+
reference_column_storage_type: 'STRING',
|
|
79
|
+
},
|
|
80
|
+
required: false,
|
|
81
|
+
unique: false,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
apiName: 'created_by',
|
|
85
|
+
displayName: 'Created by',
|
|
86
|
+
description: 'The Employee who created the record',
|
|
87
|
+
dataType: {
|
|
88
|
+
field_type: 'NATIVE_EDGE',
|
|
89
|
+
og_model_rql_name: 'Employee',
|
|
90
|
+
db_model_name: 'RoleWithCompany',
|
|
91
|
+
reference_column_storage_type: 'STRING',
|
|
92
|
+
},
|
|
93
|
+
required: false,
|
|
94
|
+
unique: false,
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
/**
|
|
98
|
+
* Minimal `ManifestComponent` that emits a single standard field stub.
|
|
99
|
+
* Intentionally bypasses `Field`'s `__c` validator since standard api_names
|
|
100
|
+
* (`id`, `created_at`, …) don't carry the custom-field suffix.
|
|
101
|
+
*/
|
|
102
|
+
class _StandardField {
|
|
103
|
+
constructor(customObjectApiName, spec) {
|
|
104
|
+
this.customObjectApiName = customObjectApiName;
|
|
105
|
+
this.spec = spec;
|
|
106
|
+
}
|
|
107
|
+
toDict() {
|
|
108
|
+
return {
|
|
109
|
+
type: 'CUSTOM_OBJECT_FIELD',
|
|
110
|
+
custom_object_api_name: this.customObjectApiName,
|
|
111
|
+
field_api_name: this.spec.apiName,
|
|
112
|
+
field_display_name: this.spec.displayName,
|
|
113
|
+
data_type: { options_list: [], supported_types: [], ...this.spec.dataType },
|
|
114
|
+
description: this.spec.description,
|
|
115
|
+
is_required: this.spec.required,
|
|
116
|
+
is_unique: this.spec.unique,
|
|
117
|
+
is_indexed: null,
|
|
118
|
+
rql_formula: null,
|
|
119
|
+
formula_attr_metas: null,
|
|
120
|
+
is_standard: true,
|
|
121
|
+
derived_aggregated_field: null,
|
|
122
|
+
derived_field_formula: null,
|
|
123
|
+
section: null,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Defines a custom object and registers it with the manifest.
|
|
129
|
+
*
|
|
130
|
+
* A custom object is a new entity type with its own fields, validations, rules, list views,
|
|
131
|
+
* and page layouts. You would normally define all custom objects near the top of your manifest
|
|
132
|
+
* file, then define their children (fields, sections, rules, etc.) below. Each child takes
|
|
133
|
+
* the `CustomObject` instance as its first argument and registers automatically.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* const manifest = new ManifestBuilder({
|
|
138
|
+
* key: 'gym_membership_management',
|
|
139
|
+
* name: 'Gym Membership Management',
|
|
140
|
+
* });
|
|
141
|
+
*
|
|
142
|
+
* const gymCategory = new Category(manifest, { apiName: 'gym__c', name: 'Gym' });
|
|
143
|
+
*
|
|
144
|
+
* const memberObj = new CustomObject(manifest, {
|
|
145
|
+
* apiName: 'gym_member__c',
|
|
146
|
+
* name: 'Member',
|
|
147
|
+
* pluralLabel: 'Members',
|
|
148
|
+
* category: gymCategory,
|
|
149
|
+
* description: 'Gym member profile, contact, and membership status',
|
|
150
|
+
* icon: { emoji: '🏋️' },
|
|
151
|
+
* });
|
|
152
|
+
*
|
|
153
|
+
* // The object is now a scope — children register through it:
|
|
154
|
+
* const firstName = new TextField(memberObj, {
|
|
155
|
+
* apiName: 'first_name__c',
|
|
156
|
+
* displayName: 'First name',
|
|
157
|
+
* required: true,
|
|
158
|
+
* });
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
161
|
+
* @remarks
|
|
162
|
+
* **Required: every `CustomObject` must have at least one `CustomObjectPageLayout` in the
|
|
163
|
+
* manifest.** Omitting it passes component-level validation but fails at the package level
|
|
164
|
+
* with `DEPENDENCY_ERROR: Page layout config for CO (api_name=...) not found in package
|
|
165
|
+
* configs. CO requires at least one page layout in the package.`
|
|
166
|
+
* Use {@link CustomObjectPageLayout.basic} for a minimal single-tab layout.
|
|
167
|
+
*/
|
|
168
|
+
export class CustomObject {
|
|
169
|
+
/**
|
|
170
|
+
* @param scope - The manifest or parent scope to register this object with.
|
|
171
|
+
* @param props - Initialization properties.
|
|
172
|
+
* @throws {Error} If `props.apiName` does not end with `__c`.
|
|
173
|
+
*/
|
|
174
|
+
constructor(scope, props) {
|
|
175
|
+
if (!props.apiName.endsWith('__c')) {
|
|
176
|
+
throw new Error(`Custom object api_name must end with __c: ${props.apiName}`);
|
|
177
|
+
}
|
|
178
|
+
this._scope = scope;
|
|
179
|
+
this._apiName = props.apiName;
|
|
180
|
+
this._name = props.name;
|
|
181
|
+
this._category = props.category;
|
|
182
|
+
this._description = props.description;
|
|
183
|
+
this._icon = props.icon;
|
|
184
|
+
this._pluralLabel = props.pluralLabel;
|
|
185
|
+
this._nameFieldDetails = props.nameFieldDetails;
|
|
186
|
+
this._defaultFieldSectionName = props.defaultFieldSectionName;
|
|
187
|
+
scope._register(this);
|
|
188
|
+
// Backend closed-world validation requires these 9 configs for every new CO.
|
|
189
|
+
for (const spec of STANDARD_FIELD_SPECS) {
|
|
190
|
+
scope._register(new _StandardField(this._apiName, spec));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/** @internal Scope hook — forwards child registration up to the root builder. */
|
|
194
|
+
_register(component) {
|
|
195
|
+
this._scope._register(component);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Returns the api_name of this custom object (e.g. `'gym_member__c'`).
|
|
199
|
+
*
|
|
200
|
+
* Use the return value wherever a field or layout needs to reference this object by name.
|
|
201
|
+
*/
|
|
202
|
+
getApiName() {
|
|
203
|
+
return this._apiName;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Returns the singular display name of this custom object (e.g. `'Member'`).
|
|
207
|
+
*/
|
|
208
|
+
getName() {
|
|
209
|
+
return this._name;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Serializes this custom object to the wire format consumed by the manifest install endpoint.
|
|
213
|
+
*
|
|
214
|
+
* @returns A plain object with `type: 'CUSTOM_OBJECT'` and all configured fields.
|
|
215
|
+
* Optional fields are omitted when `null`. An `icon` with no populated keys is omitted entirely.
|
|
216
|
+
*/
|
|
217
|
+
toDict() {
|
|
218
|
+
const component = {
|
|
219
|
+
type: 'CUSTOM_OBJECT',
|
|
220
|
+
api_name: this._apiName,
|
|
221
|
+
name: this._name,
|
|
222
|
+
description: this._description ?? null,
|
|
223
|
+
category_api_name: typeof this._category === 'string' ? this._category : this._category.getApiName(),
|
|
224
|
+
};
|
|
225
|
+
if (this._icon != null) {
|
|
226
|
+
const iconDict = {};
|
|
227
|
+
if (this._icon.emoji != null)
|
|
228
|
+
iconDict['emoji'] = this._icon.emoji;
|
|
229
|
+
if (this._icon.ripplingIcon != null)
|
|
230
|
+
iconDict['rippling_icon'] = this._icon.ripplingIcon;
|
|
231
|
+
if (this._icon.s3Bucket != null)
|
|
232
|
+
iconDict['s3_bucket'] = this._icon.s3Bucket;
|
|
233
|
+
if (this._icon.s3Key != null)
|
|
234
|
+
iconDict['s3_key'] = this._icon.s3Key;
|
|
235
|
+
// Mirror backend `if self.icon:` — empty dict is falsy and gets omitted.
|
|
236
|
+
if (Object.keys(iconDict).length > 0) {
|
|
237
|
+
component['icon'] = iconDict;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (this._pluralLabel != null)
|
|
241
|
+
component['plural_label'] = this._pluralLabel;
|
|
242
|
+
if (this._nameFieldDetails != null)
|
|
243
|
+
component['name_field_details'] = this._nameFieldDetails;
|
|
244
|
+
if (this._defaultFieldSectionName != null) {
|
|
245
|
+
component['default_field_section_name'] = this._defaultFieldSectionName;
|
|
246
|
+
}
|
|
247
|
+
return component;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=custom-object.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-object.mjs","sourceRoot":"","sources":["../../src/lib/manifest/custom-object.ts"],"names":[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