@rippling/rippling-sdk 0.2.0-alpha.83 → 0.2.0-alpha.85
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/examples/manifest/custom-object-creation-workflow/custom-object-creation-workflow.ts +44 -26
- package/examples/manifest/dental-practice-management/dental-practice-management.ts +470 -142
- package/examples/manifest/dental-practice-management/functions/chair-schedule.ts +23 -13
- package/examples/manifest/dental-practice-management/functions/complete-visit.ts +55 -32
- package/examples/manifest/dental-practice-management/functions/operatory-list.ts +23 -13
- package/examples/manifest/dental-practice-management/functions/patient-list.ts +23 -13
- package/examples/manifest/dental-practice-management/functions/treatment-plan-list.ts +23 -13
- package/examples/manifest/existing-manifest-mutations/existing-manifest-mutations.ts +23 -68
- package/examples/manifest/field-service-dispatch/field-service-dispatch.ts +375 -102
- package/examples/manifest/grant-program-management/grant-program-management.ts +419 -125
- package/examples/manifest/gym-membership-management/functions/check-in-desk.ts +23 -13
- package/examples/manifest/gym-membership-management/functions/member-list.ts +23 -13
- package/examples/manifest/gym-membership-management/functions/today-schedule.ts +23 -13
- package/examples/manifest/gym-membership-management/functions/trainer-list.ts +23 -13
- package/examples/manifest/gym-membership-management/gym-membership-management.ts +442 -92
- package/examples/manifest/procurement-approval-hub/procurement-approval-hub.ts +408 -122
- package/examples/manifest/simple-todo-app/functions/mark-done.ts +12 -16
- package/examples/manifest/simple-todo-app/functions/todo-list.ts +23 -13
- package/examples/manifest/simple-todo-app/simple-todo-app.ts +109 -40
- package/examples/manifest/todo-app-without-object-list-view/functions/todo-page.ts +193 -166
- package/examples/manifest/todo-app-without-object-list-view/todo-app-without-object-list-view.ts +47 -24
- package/package.json +13 -7
- package/resources/custom-objects/custom-objects.d.mts +0 -7
- package/resources/custom-objects/custom-objects.d.mts.map +1 -1
- package/resources/custom-objects/custom-objects.d.ts +0 -7
- package/resources/custom-objects/custom-objects.d.ts.map +1 -1
- package/resources/custom-objects/custom-objects.js.map +1 -1
- package/resources/custom-objects/custom-objects.mjs.map +1 -1
- package/resources/custom-objects/fields.d.mts +14 -128
- package/resources/custom-objects/fields.d.mts.map +1 -1
- package/resources/custom-objects/fields.d.ts +14 -128
- package/resources/custom-objects/fields.d.ts.map +1 -1
- package/src/resources/custom-objects/custom-objects.ts +0 -8
- package/src/resources/custom-objects/fields.ts +13 -191
- package/src/tsconfig.json +1 -1
- 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
- package/core/platform/custom-objects/category.d.mts +0 -125
- package/core/platform/custom-objects/category.d.mts.map +0 -1
- package/core/platform/custom-objects/category.d.ts +0 -125
- package/core/platform/custom-objects/category.d.ts.map +0 -1
- package/core/platform/custom-objects/category.js +0 -188
- package/core/platform/custom-objects/category.js.map +0 -1
- package/core/platform/custom-objects/category.mjs +0 -178
- package/core/platform/custom-objects/category.mjs.map +0 -1
- package/core/platform/custom-objects/definition.d.mts +0 -147
- package/core/platform/custom-objects/definition.d.mts.map +0 -1
- package/core/platform/custom-objects/definition.d.ts +0 -147
- package/core/platform/custom-objects/definition.d.ts.map +0 -1
- package/core/platform/custom-objects/definition.js +0 -200
- package/core/platform/custom-objects/definition.js.map +0 -1
- package/core/platform/custom-objects/definition.mjs +0 -190
- package/core/platform/custom-objects/definition.mjs.map +0 -1
- package/core/platform/custom-objects/fields.d.mts +0 -302
- package/core/platform/custom-objects/fields.d.mts.map +0 -1
- package/core/platform/custom-objects/fields.d.ts +0 -302
- package/core/platform/custom-objects/fields.d.ts.map +0 -1
- package/core/platform/custom-objects/fields.js +0 -369
- package/core/platform/custom-objects/fields.js.map +0 -1
- package/core/platform/custom-objects/fields.mjs +0 -347
- package/core/platform/custom-objects/fields.mjs.map +0 -1
- package/core/platform/custom-objects/function-runtime.d.mts +0 -42
- package/core/platform/custom-objects/function-runtime.d.mts.map +0 -1
- package/core/platform/custom-objects/function-runtime.d.ts +0 -42
- package/core/platform/custom-objects/function-runtime.d.ts.map +0 -1
- package/core/platform/custom-objects/function-runtime.js +0 -38
- package/core/platform/custom-objects/function-runtime.js.map +0 -1
- package/core/platform/custom-objects/function-runtime.mjs +0 -35
- package/core/platform/custom-objects/function-runtime.mjs.map +0 -1
- package/core/platform/custom-objects/lifecycle.d.mts +0 -83
- package/core/platform/custom-objects/lifecycle.d.mts.map +0 -1
- package/core/platform/custom-objects/lifecycle.d.ts +0 -83
- package/core/platform/custom-objects/lifecycle.d.ts.map +0 -1
- package/core/platform/custom-objects/lifecycle.js +0 -372
- package/core/platform/custom-objects/lifecycle.js.map +0 -1
- package/core/platform/custom-objects/lifecycle.mjs +0 -367
- package/core/platform/custom-objects/lifecycle.mjs.map +0 -1
- package/core/platform/custom-objects/manager.d.mts +0 -354
- package/core/platform/custom-objects/manager.d.mts.map +0 -1
- package/core/platform/custom-objects/manager.d.ts +0 -354
- package/core/platform/custom-objects/manager.d.ts.map +0 -1
- package/core/platform/custom-objects/manager.js +0 -646
- package/core/platform/custom-objects/manager.js.map +0 -1
- package/core/platform/custom-objects/manager.mjs +0 -637
- package/core/platform/custom-objects/manager.mjs.map +0 -1
- package/core/platform/custom-objects/provisioning.d.mts +0 -138
- package/core/platform/custom-objects/provisioning.d.mts.map +0 -1
- package/core/platform/custom-objects/provisioning.d.ts +0 -138
- package/core/platform/custom-objects/provisioning.d.ts.map +0 -1
- package/core/platform/custom-objects/provisioning.js +0 -455
- package/core/platform/custom-objects/provisioning.js.map +0 -1
- package/core/platform/custom-objects/provisioning.mjs +0 -447
- package/core/platform/custom-objects/provisioning.mjs.map +0 -1
- package/core/platform/custom-objects/rql.d.mts +0 -122
- package/core/platform/custom-objects/rql.d.mts.map +0 -1
- package/core/platform/custom-objects/rql.d.ts +0 -122
- package/core/platform/custom-objects/rql.d.ts.map +0 -1
- package/core/platform/custom-objects/rql.js +0 -225
- package/core/platform/custom-objects/rql.js.map +0 -1
- package/core/platform/custom-objects/rql.mjs +0 -222
- package/core/platform/custom-objects/rql.mjs.map +0 -1
- package/core/platform/custom-objects/schema-manager.d.mts +0 -203
- package/core/platform/custom-objects/schema-manager.d.mts.map +0 -1
- package/core/platform/custom-objects/schema-manager.d.ts +0 -203
- package/core/platform/custom-objects/schema-manager.d.ts.map +0 -1
- package/core/platform/custom-objects/schema-manager.js +0 -256
- package/core/platform/custom-objects/schema-manager.js.map +0 -1
- package/core/platform/custom-objects/schema-manager.mjs +0 -249
- package/core/platform/custom-objects/schema-manager.mjs.map +0 -1
- package/core/platform/custom-objects/typed-rql.d.mts +0 -157
- package/core/platform/custom-objects/typed-rql.d.mts.map +0 -1
- package/core/platform/custom-objects/typed-rql.d.ts +0 -157
- package/core/platform/custom-objects/typed-rql.d.ts.map +0 -1
- package/core/platform/custom-objects/typed-rql.js +0 -583
- package/core/platform/custom-objects/typed-rql.js.map +0 -1
- package/core/platform/custom-objects/typed-rql.mjs +0 -580
- package/core/platform/custom-objects/typed-rql.mjs.map +0 -1
- package/core/platform/custom-objects/types.d.mts +0 -549
- package/core/platform/custom-objects/types.d.mts.map +0 -1
- package/core/platform/custom-objects/types.d.ts +0 -549
- package/core/platform/custom-objects/types.d.ts.map +0 -1
- package/core/platform/custom-objects/types.js +0 -20
- package/core/platform/custom-objects/types.js.map +0 -1
- package/core/platform/custom-objects/types.mjs +0 -17
- package/core/platform/custom-objects/types.mjs.map +0 -1
- package/core/platform/custom-objects/validation.d.mts +0 -97
- package/core/platform/custom-objects/validation.d.mts.map +0 -1
- package/core/platform/custom-objects/validation.d.ts +0 -97
- package/core/platform/custom-objects/validation.d.ts.map +0 -1
- package/core/platform/custom-objects/validation.js +0 -477
- package/core/platform/custom-objects/validation.js.map +0 -1
- package/core/platform/custom-objects/validation.mjs +0 -465
- package/core/platform/custom-objects/validation.mjs.map +0 -1
- package/core/platform/custom-objects.d.mts +0 -67
- package/core/platform/custom-objects.d.mts.map +0 -1
- package/core/platform/custom-objects.d.ts +0 -67
- package/core/platform/custom-objects.d.ts.map +0 -1
- package/core/platform/custom-objects.js +0 -118
- package/core/platform/custom-objects.js.map +0 -1
- package/core/platform/custom-objects.mjs +0 -45
- package/core/platform/custom-objects.mjs.map +0 -1
- package/core/platform/manifest/custom-objects/action.d.mts +0 -58
- package/core/platform/manifest/custom-objects/action.d.mts.map +0 -1
- package/core/platform/manifest/custom-objects/action.d.ts +0 -58
- package/core/platform/manifest/custom-objects/action.d.ts.map +0 -1
- package/core/platform/manifest/custom-objects/action.js +0 -44
- package/core/platform/manifest/custom-objects/action.js.map +0 -1
- package/core/platform/manifest/custom-objects/action.mjs +0 -40
- package/core/platform/manifest/custom-objects/action.mjs.map +0 -1
- package/core/platform/manifest/custom-objects/conditions.d.mts +0 -240
- package/core/platform/manifest/custom-objects/conditions.d.mts.map +0 -1
- package/core/platform/manifest/custom-objects/conditions.d.ts +0 -240
- package/core/platform/manifest/custom-objects/conditions.d.ts.map +0 -1
- package/core/platform/manifest/custom-objects/conditions.js +0 -326
- package/core/platform/manifest/custom-objects/conditions.js.map +0 -1
- package/core/platform/manifest/custom-objects/conditions.mjs +0 -321
- package/core/platform/manifest/custom-objects/conditions.mjs.map +0 -1
- package/core/platform/manifest/custom-objects/existing.d.mts +0 -87
- package/core/platform/manifest/custom-objects/existing.d.mts.map +0 -1
- package/core/platform/manifest/custom-objects/existing.d.ts +0 -87
- package/core/platform/manifest/custom-objects/existing.d.ts.map +0 -1
- package/core/platform/manifest/custom-objects/existing.js +0 -113
- package/core/platform/manifest/custom-objects/existing.js.map +0 -1
- package/core/platform/manifest/custom-objects/existing.mjs +0 -109
- package/core/platform/manifest/custom-objects/existing.mjs.map +0 -1
- package/core/platform/manifest/custom-objects/field-resolution.d.mts +0 -48
- package/core/platform/manifest/custom-objects/field-resolution.d.mts.map +0 -1
- package/core/platform/manifest/custom-objects/field-resolution.d.ts +0 -48
- package/core/platform/manifest/custom-objects/field-resolution.d.ts.map +0 -1
- package/core/platform/manifest/custom-objects/field-resolution.js +0 -61
- package/core/platform/manifest/custom-objects/field-resolution.js.map +0 -1
- package/core/platform/manifest/custom-objects/field-resolution.mjs +0 -58
- package/core/platform/manifest/custom-objects/field-resolution.mjs.map +0 -1
- package/core/platform/manifest/custom-objects/function-file.d.mts +0 -87
- package/core/platform/manifest/custom-objects/function-file.d.mts.map +0 -1
- package/core/platform/manifest/custom-objects/function-file.d.ts +0 -87
- package/core/platform/manifest/custom-objects/function-file.d.ts.map +0 -1
- package/core/platform/manifest/custom-objects/function-file.js +0 -76
- package/core/platform/manifest/custom-objects/function-file.js.map +0 -1
- package/core/platform/manifest/custom-objects/function-file.mjs +0 -69
- package/core/platform/manifest/custom-objects/function-file.mjs.map +0 -1
- package/core/platform/manifest/custom-objects/list-view.d.mts +0 -65
- package/core/platform/manifest/custom-objects/list-view.d.mts.map +0 -1
- package/core/platform/manifest/custom-objects/list-view.d.ts +0 -65
- package/core/platform/manifest/custom-objects/list-view.d.ts.map +0 -1
- package/core/platform/manifest/custom-objects/list-view.js +0 -33
- package/core/platform/manifest/custom-objects/list-view.js.map +0 -1
- package/core/platform/manifest/custom-objects/list-view.mjs +0 -30
- package/core/platform/manifest/custom-objects/list-view.mjs.map +0 -1
- package/core/platform/manifest/custom-objects/object-list-page.d.mts +0 -43
- package/core/platform/manifest/custom-objects/object-list-page.d.mts.map +0 -1
- package/core/platform/manifest/custom-objects/object-list-page.d.ts +0 -43
- package/core/platform/manifest/custom-objects/object-list-page.d.ts.map +0 -1
- package/core/platform/manifest/custom-objects/object-list-page.js +0 -54
- package/core/platform/manifest/custom-objects/object-list-page.js.map +0 -1
- package/core/platform/manifest/custom-objects/object-list-page.mjs +0 -50
- package/core/platform/manifest/custom-objects/object-list-page.mjs.map +0 -1
- package/core/platform/manifest/custom-objects/page-layout.d.mts +0 -142
- package/core/platform/manifest/custom-objects/page-layout.d.mts.map +0 -1
- package/core/platform/manifest/custom-objects/page-layout.d.ts +0 -142
- package/core/platform/manifest/custom-objects/page-layout.d.ts.map +0 -1
- package/core/platform/manifest/custom-objects/page-layout.js +0 -184
- package/core/platform/manifest/custom-objects/page-layout.js.map +0 -1
- package/core/platform/manifest/custom-objects/page-layout.mjs +0 -180
- package/core/platform/manifest/custom-objects/page-layout.mjs.map +0 -1
- package/core/platform/manifest/custom-objects/register.d.mts +0 -87
- package/core/platform/manifest/custom-objects/register.d.mts.map +0 -1
- package/core/platform/manifest/custom-objects/register.d.ts +0 -87
- package/core/platform/manifest/custom-objects/register.d.ts.map +0 -1
- package/core/platform/manifest/custom-objects/register.js +0 -395
- package/core/platform/manifest/custom-objects/register.js.map +0 -1
- package/core/platform/manifest/custom-objects/register.mjs +0 -391
- package/core/platform/manifest/custom-objects/register.mjs.map +0 -1
- package/core/platform/manifest/custom-objects/rule.d.mts +0 -113
- package/core/platform/manifest/custom-objects/rule.d.mts.map +0 -1
- package/core/platform/manifest/custom-objects/rule.d.ts +0 -113
- package/core/platform/manifest/custom-objects/rule.d.ts.map +0 -1
- package/core/platform/manifest/custom-objects/rule.js +0 -49
- package/core/platform/manifest/custom-objects/rule.js.map +0 -1
- package/core/platform/manifest/custom-objects/rule.mjs +0 -45
- package/core/platform/manifest/custom-objects/rule.mjs.map +0 -1
- package/core/platform/manifest/custom-objects/sdui-page.d.mts +0 -214
- package/core/platform/manifest/custom-objects/sdui-page.d.mts.map +0 -1
- package/core/platform/manifest/custom-objects/sdui-page.d.ts +0 -214
- package/core/platform/manifest/custom-objects/sdui-page.d.ts.map +0 -1
- package/core/platform/manifest/custom-objects/sdui-page.js +0 -194
- package/core/platform/manifest/custom-objects/sdui-page.js.map +0 -1
- package/core/platform/manifest/custom-objects/sdui-page.mjs +0 -182
- package/core/platform/manifest/custom-objects/sdui-page.mjs.map +0 -1
- package/core/platform/manifest/custom-objects/typed-condition.d.mts +0 -28
- package/core/platform/manifest/custom-objects/typed-condition.d.mts.map +0 -1
- package/core/platform/manifest/custom-objects/typed-condition.d.ts +0 -28
- package/core/platform/manifest/custom-objects/typed-condition.d.ts.map +0 -1
- package/core/platform/manifest/custom-objects/typed-condition.js +0 -434
- package/core/platform/manifest/custom-objects/typed-condition.js.map +0 -1
- package/core/platform/manifest/custom-objects/typed-condition.mjs +0 -431
- package/core/platform/manifest/custom-objects/typed-condition.mjs.map +0 -1
- package/core/platform/manifest/custom-objects/types.d.mts +0 -29
- package/core/platform/manifest/custom-objects/types.d.mts.map +0 -1
- package/core/platform/manifest/custom-objects/types.d.ts +0 -29
- package/core/platform/manifest/custom-objects/types.d.ts.map +0 -1
- package/core/platform/manifest/custom-objects/types.js +0 -3
- package/core/platform/manifest/custom-objects/types.js.map +0 -1
- package/core/platform/manifest/custom-objects/types.mjs +0 -2
- package/core/platform/manifest/custom-objects/types.mjs.map +0 -1
- package/core/platform/manifest/custom-objects/validation.d.mts +0 -44
- package/core/platform/manifest/custom-objects/validation.d.mts.map +0 -1
- package/core/platform/manifest/custom-objects/validation.d.ts +0 -44
- package/core/platform/manifest/custom-objects/validation.d.ts.map +0 -1
- package/core/platform/manifest/custom-objects/validation.js +0 -30
- package/core/platform/manifest/custom-objects/validation.js.map +0 -1
- package/core/platform/manifest/custom-objects/validation.mjs +0 -27
- package/core/platform/manifest/custom-objects/validation.mjs.map +0 -1
- package/core/platform/manifest/custom-objects/workflow.d.mts +0 -47
- package/core/platform/manifest/custom-objects/workflow.d.mts.map +0 -1
- package/core/platform/manifest/custom-objects/workflow.d.ts +0 -47
- package/core/platform/manifest/custom-objects/workflow.d.ts.map +0 -1
- package/core/platform/manifest/custom-objects/workflow.js +0 -38
- package/core/platform/manifest/custom-objects/workflow.js.map +0 -1
- package/core/platform/manifest/custom-objects/workflow.mjs +0 -34
- package/core/platform/manifest/custom-objects/workflow.mjs.map +0 -1
- package/core/platform/manifest/custom-objects.d.mts +0 -85
- package/core/platform/manifest/custom-objects.d.mts.map +0 -1
- package/core/platform/manifest/custom-objects.d.ts +0 -85
- package/core/platform/manifest/custom-objects.d.ts.map +0 -1
- package/core/platform/manifest/custom-objects.js +0 -84
- package/core/platform/manifest/custom-objects.js.map +0 -1
- package/core/platform/manifest/custom-objects.mjs +0 -55
- package/core/platform/manifest/custom-objects.mjs.map +0 -1
- package/examples/manifest/custom-object-creation-workflow/functions/intake-request-created.ts +0 -20
- package/examples/manifest/custom-object-creation-workflow/schema.ts +0 -29
- package/examples/manifest/dental-practice-management/schema.ts +0 -298
- package/examples/manifest/field-service-dispatch/schema.ts +0 -248
- package/examples/manifest/grant-program-management/schema.ts +0 -269
- package/examples/manifest/gym-membership-management/schema.ts +0 -266
- package/examples/manifest/procurement-approval-hub/functions/route-purchase-request.ts +0 -20
- package/examples/manifest/procurement-approval-hub/schema.ts +0 -256
- package/examples/manifest/simple-todo-app/schema.ts +0 -60
- package/examples/manifest/todo-app-without-object-list-view/schema.ts +0 -28
- package/src/core/platform/README.md +0 -20
- package/src/core/platform/custom-objects/category.ts +0 -294
- package/src/core/platform/custom-objects/definition.ts +0 -373
- package/src/core/platform/custom-objects/fields.ts +0 -653
- package/src/core/platform/custom-objects/function-runtime.ts +0 -76
- package/src/core/platform/custom-objects/lifecycle.ts +0 -557
- package/src/core/platform/custom-objects/manager.ts +0 -959
- package/src/core/platform/custom-objects/provisioning.ts +0 -672
- package/src/core/platform/custom-objects/rql.ts +0 -375
- package/src/core/platform/custom-objects/schema-manager.ts +0 -351
- package/src/core/platform/custom-objects/typed-rql.ts +0 -1273
- package/src/core/platform/custom-objects/types.ts +0 -753
- package/src/core/platform/custom-objects/validation.ts +0 -573
- package/src/core/platform/custom-objects.ts +0 -269
- package/src/core/platform/manifest/README.md +0 -26
- package/src/core/platform/manifest/custom-objects/action.ts +0 -87
- package/src/core/platform/manifest/custom-objects/conditions.ts +0 -762
- package/src/core/platform/manifest/custom-objects/existing.ts +0 -221
- package/src/core/platform/manifest/custom-objects/field-resolution.ts +0 -116
- package/src/core/platform/manifest/custom-objects/function-file.ts +0 -149
- package/src/core/platform/manifest/custom-objects/list-view.ts +0 -95
- package/src/core/platform/manifest/custom-objects/object-list-page.ts +0 -87
- package/src/core/platform/manifest/custom-objects/page-layout.ts +0 -380
- package/src/core/platform/manifest/custom-objects/register.ts +0 -555
- package/src/core/platform/manifest/custom-objects/rule.ts +0 -192
- package/src/core/platform/manifest/custom-objects/sdui-page.ts +0 -515
- package/src/core/platform/manifest/custom-objects/typed-condition.ts +0 -617
- package/src/core/platform/manifest/custom-objects/types.ts +0 -92
- package/src/core/platform/manifest/custom-objects/validation.ts +0 -70
- package/src/core/platform/manifest/custom-objects/workflow.ts +0 -71
- package/src/core/platform/manifest/custom-objects.ts +0 -203
- package/src/pebble-sdui-web-custom-apps-shim.d.ts +0 -3
|
@@ -1,555 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BooleanField,
|
|
3
|
-
Category,
|
|
4
|
-
CurrencyField,
|
|
5
|
-
CustomObject,
|
|
6
|
-
CustomObjectFieldSection,
|
|
7
|
-
DateField,
|
|
8
|
-
DatetimeField,
|
|
9
|
-
EmailField,
|
|
10
|
-
FileField,
|
|
11
|
-
FormulaField,
|
|
12
|
-
LongTextField,
|
|
13
|
-
LookupField,
|
|
14
|
-
NumberField,
|
|
15
|
-
ParentChildField,
|
|
16
|
-
PercentageField,
|
|
17
|
-
PhoneField,
|
|
18
|
-
RadioField,
|
|
19
|
-
SelectField,
|
|
20
|
-
TextField,
|
|
21
|
-
TimeField,
|
|
22
|
-
UrlField,
|
|
23
|
-
type ManifestScope,
|
|
24
|
-
} from '../../../../lib/manifest';
|
|
25
|
-
import type { AnyCustomObjectDefinition, AnyFieldDefinition } from '../../custom-objects/types';
|
|
26
|
-
import type { ManifestFieldForDefinition, ManifestRegistration } from './types';
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Options for {@link registerManifestCustomObject}.
|
|
30
|
-
*
|
|
31
|
-
* @typeParam TDefinition - Object definition being materialized into manifest classes.
|
|
32
|
-
*/
|
|
33
|
-
export interface RegisterManifestCustomObjectOptions<TDefinition extends AnyCustomObjectDefinition> {
|
|
34
|
-
/** Custom-object definition authored through the typed schema layer. */
|
|
35
|
-
readonly definition: TDefinition;
|
|
36
|
-
/** Category instance already registered in the manifest. */
|
|
37
|
-
readonly category: Category;
|
|
38
|
-
/**
|
|
39
|
-
* Optional fallback section used by fields that omit an explicit section key.
|
|
40
|
-
*
|
|
41
|
-
* Manifest field classes require a concrete `CustomObjectFieldSection`. The
|
|
42
|
-
* typed definition layer keeps sections optional so teams can reuse schemas in
|
|
43
|
-
* contexts that do not care about page-layout concerns. When materializing the
|
|
44
|
-
* schema into manifest components, use this fallback to place section-less
|
|
45
|
-
* fields somewhere deterministic.
|
|
46
|
-
*/
|
|
47
|
-
readonly defaultSection?: {
|
|
48
|
-
readonly name: string;
|
|
49
|
-
readonly sectionId?: string;
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Resolver used for relationship fields that target another custom object.
|
|
53
|
-
*
|
|
54
|
-
* Lookup fields can compile from the target api name alone, but parent-child
|
|
55
|
-
* fields need the concrete manifest {@link CustomObject} instance.
|
|
56
|
-
*/
|
|
57
|
-
readonly resolveCustomObjectTarget?: (apiName: string) => CustomObject;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Options for {@link registerManifestCustomObjects}.
|
|
62
|
-
*
|
|
63
|
-
* @typeParam TDefinitions - Ordered tuple of object definitions being materialized.
|
|
64
|
-
*/
|
|
65
|
-
export interface RegisterManifestCustomObjectsOptions<
|
|
66
|
-
TDefinitions extends readonly AnyCustomObjectDefinition[],
|
|
67
|
-
> {
|
|
68
|
-
/** Ordered tuple of typed custom-object definitions to register. */
|
|
69
|
-
readonly definitions: TDefinitions;
|
|
70
|
-
/** Category instance already registered in the manifest. */
|
|
71
|
-
readonly category: Category;
|
|
72
|
-
/** Shared fallback section applied to any definition field that omits `section`. */
|
|
73
|
-
readonly defaultSection?: {
|
|
74
|
-
readonly name: string;
|
|
75
|
-
readonly sectionId?: string;
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
interface ManifestRegistrationScaffold<TDefinition extends AnyCustomObjectDefinition> {
|
|
80
|
-
readonly definition: TDefinition;
|
|
81
|
-
readonly category: Category;
|
|
82
|
-
readonly object: CustomObject;
|
|
83
|
-
readonly sections: ManifestRegistration<TDefinition>['sections'];
|
|
84
|
-
readonly defaultSection: CustomObjectFieldSection | undefined;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Registration tuple returned by {@link registerManifestCustomObjects}.
|
|
89
|
-
*
|
|
90
|
-
* @typeParam TDefinitions - Ordered tuple of object definitions that were registered.
|
|
91
|
-
*/
|
|
92
|
-
export type ManifestRegistrationTuple<TDefinitions extends readonly AnyCustomObjectDefinition[]> = {
|
|
93
|
-
readonly [TIndex in keyof TDefinitions]: TDefinitions[TIndex] extends AnyCustomObjectDefinition ?
|
|
94
|
-
ManifestRegistration<TDefinitions[TIndex]>
|
|
95
|
-
: never;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Throws when the provided manifest category does not match the typed definition.
|
|
100
|
-
*
|
|
101
|
-
* @param definition - Typed object definition being materialized.
|
|
102
|
-
* @param category - Concrete manifest category provided by the caller.
|
|
103
|
-
*/
|
|
104
|
-
function assertMatchingCategory(definition: AnyCustomObjectDefinition, category: Category): void {
|
|
105
|
-
if (category.getApiName() !== definition.categoryApiName) {
|
|
106
|
-
throw new Error(
|
|
107
|
-
`Category mismatch while registering "${definition.name}": ` +
|
|
108
|
-
`definition expects "${
|
|
109
|
-
definition.categoryApiName
|
|
110
|
-
}", but the provided Category is "${category.getApiName()}".`,
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Creates the manifest object instance and concrete sections for one typed definition.
|
|
117
|
-
*
|
|
118
|
-
* Field registration is intentionally deferred so multi-object registration can
|
|
119
|
-
* create every manifest object up front and then resolve parent-child targets in
|
|
120
|
-
* a second pass.
|
|
121
|
-
*
|
|
122
|
-
* @param scope - Manifest scope that should own the created manifest components.
|
|
123
|
-
* @param options - Typed object definition plus manifest-specific registration options.
|
|
124
|
-
* @returns Scaffold containing the object instance, concrete sections, and fallback section.
|
|
125
|
-
* @typeParam TDefinition - Object definition being materialized into manifest classes.
|
|
126
|
-
*/
|
|
127
|
-
function createRegistrationScaffold<TDefinition extends AnyCustomObjectDefinition>(
|
|
128
|
-
scope: ManifestScope,
|
|
129
|
-
options: Pick<
|
|
130
|
-
RegisterManifestCustomObjectOptions<TDefinition>,
|
|
131
|
-
'definition' | 'category' | 'defaultSection'
|
|
132
|
-
>,
|
|
133
|
-
): ManifestRegistrationScaffold<TDefinition> {
|
|
134
|
-
const { definition } = options;
|
|
135
|
-
|
|
136
|
-
assertMatchingCategory(definition, options.category);
|
|
137
|
-
|
|
138
|
-
const objectInstance = new CustomObject(scope, {
|
|
139
|
-
apiName: definition.apiName,
|
|
140
|
-
name: definition.displayName,
|
|
141
|
-
...(definition.pluralLabel != null ? { pluralLabel: definition.pluralLabel } : {}),
|
|
142
|
-
category: options.category,
|
|
143
|
-
description: definition.description,
|
|
144
|
-
...(definition.icon != null ? { icon: definition.icon } : {}),
|
|
145
|
-
...(definition.nameField.kind === 'autonumber' ?
|
|
146
|
-
{
|
|
147
|
-
nameFieldDetails: {
|
|
148
|
-
is_autonumber_field: true,
|
|
149
|
-
autonumber_format: definition.nameField.format,
|
|
150
|
-
...(definition.nameField.startingNumber != null ?
|
|
151
|
-
{ starting_number: definition.nameField.startingNumber }
|
|
152
|
-
: {}),
|
|
153
|
-
},
|
|
154
|
-
}
|
|
155
|
-
: {}),
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
const sectionMap = Object.fromEntries(
|
|
159
|
-
Object.entries(definition.sections).map(([key, sectionDef]) => [
|
|
160
|
-
key,
|
|
161
|
-
new CustomObjectFieldSection(objectInstance, {
|
|
162
|
-
name: sectionDef.name,
|
|
163
|
-
...(sectionDef.sectionId != null ? { sectionId: sectionDef.sectionId } : {}),
|
|
164
|
-
}),
|
|
165
|
-
]),
|
|
166
|
-
) as ManifestRegistration<TDefinition>['sections'];
|
|
167
|
-
|
|
168
|
-
const defaultSection =
|
|
169
|
-
options.defaultSection == null ?
|
|
170
|
-
undefined
|
|
171
|
-
: new CustomObjectFieldSection(objectInstance, {
|
|
172
|
-
name: options.defaultSection.name,
|
|
173
|
-
...(options.defaultSection.sectionId != null ? { sectionId: options.defaultSection.sectionId } : {}),
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
return {
|
|
177
|
-
definition,
|
|
178
|
-
category: options.category,
|
|
179
|
-
object: objectInstance,
|
|
180
|
-
sections: sectionMap,
|
|
181
|
-
defaultSection,
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Registers the concrete manifest fields for one typed definition.
|
|
187
|
-
*
|
|
188
|
-
* @param scaffold - Previously created registration scaffold.
|
|
189
|
-
* @param resolveCustomObjectTarget - Optional resolver for parent-child targets that need manifest objects.
|
|
190
|
-
* @returns Concrete manifest fields keyed by logical field name.
|
|
191
|
-
* @typeParam TDefinition - Object definition whose fields should be materialized.
|
|
192
|
-
*/
|
|
193
|
-
function registerFieldsForScaffold<TDefinition extends AnyCustomObjectDefinition>(
|
|
194
|
-
scaffold: ManifestRegistrationScaffold<TDefinition>,
|
|
195
|
-
resolveCustomObjectTarget: ((apiName: string) => CustomObject) | undefined,
|
|
196
|
-
): ManifestRegistration<TDefinition>['fields'] {
|
|
197
|
-
return Object.fromEntries(
|
|
198
|
-
Object.entries(scaffold.definition.fields).map(([fieldLogicalName, field]) => [
|
|
199
|
-
fieldLogicalName,
|
|
200
|
-
registerField(
|
|
201
|
-
scaffold.object,
|
|
202
|
-
fieldLogicalName,
|
|
203
|
-
field as unknown as AnyFieldDefinition,
|
|
204
|
-
scaffold.sections,
|
|
205
|
-
scaffold.defaultSection,
|
|
206
|
-
resolveCustomObjectTarget,
|
|
207
|
-
),
|
|
208
|
-
]),
|
|
209
|
-
) as ManifestRegistration<TDefinition>['fields'];
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Translates one typed formula-field discriminant into the low-level manifest formula output type.
|
|
214
|
-
*
|
|
215
|
-
* @param kind - Typed field-kind discriminant already known to be a formula variant.
|
|
216
|
-
* @returns Manifest formula output-type token.
|
|
217
|
-
*/
|
|
218
|
-
function formulaFieldType(
|
|
219
|
-
kind: AnyFieldDefinition['kind'],
|
|
220
|
-
): 'TEXT' | 'NUMBER' | 'BOOLEAN' | 'CURRENCY' | 'PERCENTAGE' | 'DATE' | 'URL' {
|
|
221
|
-
switch (kind) {
|
|
222
|
-
case 'formula-text':
|
|
223
|
-
return 'TEXT';
|
|
224
|
-
case 'formula-number':
|
|
225
|
-
return 'NUMBER';
|
|
226
|
-
case 'formula-boolean':
|
|
227
|
-
return 'BOOLEAN';
|
|
228
|
-
case 'formula-currency':
|
|
229
|
-
return 'CURRENCY';
|
|
230
|
-
case 'formula-percentage':
|
|
231
|
-
return 'PERCENTAGE';
|
|
232
|
-
case 'formula-date':
|
|
233
|
-
return 'DATE';
|
|
234
|
-
case 'formula-url':
|
|
235
|
-
return 'URL';
|
|
236
|
-
default:
|
|
237
|
-
throw new Error(`Unsupported formula field kind: ${String(kind)}.`);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Resolves the concrete manifest section instance for one field definition.
|
|
243
|
-
*
|
|
244
|
-
* @param objectInstance - Manifest custom-object instance that owns the field.
|
|
245
|
-
* @param sectionKey - Optional typed section key referenced by the field definition.
|
|
246
|
-
* @param sections - Concrete manifest sections keyed by typed section aliases.
|
|
247
|
-
* @param defaultSection - Optional fallback section for fields that omit `section`.
|
|
248
|
-
* @param fieldLogicalName - Logical field name used for error messages.
|
|
249
|
-
* @returns Concrete manifest section instance.
|
|
250
|
-
* @throws Error when the field has no resolvable section.
|
|
251
|
-
*/
|
|
252
|
-
function resolveSection(
|
|
253
|
-
objectInstance: CustomObject,
|
|
254
|
-
sectionKey: string | undefined,
|
|
255
|
-
sections: Readonly<Record<string, CustomObjectFieldSection>>,
|
|
256
|
-
defaultSection: CustomObjectFieldSection | undefined,
|
|
257
|
-
fieldLogicalName: string,
|
|
258
|
-
): CustomObjectFieldSection {
|
|
259
|
-
if (sectionKey != null) {
|
|
260
|
-
const found = sections[sectionKey];
|
|
261
|
-
if (found != null) return found;
|
|
262
|
-
throw new Error(`Unknown section key "${sectionKey}" while registering field "${fieldLogicalName}".`);
|
|
263
|
-
}
|
|
264
|
-
if (defaultSection != null) return defaultSection;
|
|
265
|
-
throw new Error(
|
|
266
|
-
`Field "${fieldLogicalName}" on "${objectInstance.getApiName()}" has no section. ` +
|
|
267
|
-
'Either assign a section key in the definition or provide defaultSection when registering the manifest object.',
|
|
268
|
-
);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Instantiates the concrete manifest field class for one typed field definition.
|
|
273
|
-
*
|
|
274
|
-
* @param objectInstance - Manifest custom-object instance that will own the field.
|
|
275
|
-
* @param fieldLogicalName - Logical field name used for error messages.
|
|
276
|
-
* @param field - Typed field definition to materialize.
|
|
277
|
-
* @param sections - Concrete manifest sections keyed by typed section aliases.
|
|
278
|
-
* @param defaultSection - Optional fallback section for fields that omit `section`.
|
|
279
|
-
* @param resolveCustomObjectTarget - Optional resolver for parent-child targets that need manifest objects.
|
|
280
|
-
* @returns Concrete manifest field instance matching the typed field definition.
|
|
281
|
-
*/
|
|
282
|
-
function registerField(
|
|
283
|
-
objectInstance: CustomObject,
|
|
284
|
-
fieldLogicalName: string,
|
|
285
|
-
field: AnyFieldDefinition,
|
|
286
|
-
sections: Readonly<Record<string, CustomObjectFieldSection>>,
|
|
287
|
-
defaultSection: CustomObjectFieldSection | undefined,
|
|
288
|
-
resolveCustomObjectTarget: ((apiName: string) => CustomObject) | undefined,
|
|
289
|
-
): ManifestFieldForDefinition<AnyFieldDefinition> {
|
|
290
|
-
const section = resolveSection(objectInstance, field.section, sections, defaultSection, fieldLogicalName);
|
|
291
|
-
const apiName = field.apiName ?? `${fieldLogicalName}__c`;
|
|
292
|
-
|
|
293
|
-
switch (field.kind) {
|
|
294
|
-
case 'text':
|
|
295
|
-
return new TextField(objectInstance, {
|
|
296
|
-
apiName,
|
|
297
|
-
displayName: field.displayName,
|
|
298
|
-
description: field.description,
|
|
299
|
-
required: field.required,
|
|
300
|
-
...(field.unique != null ? { unique: field.unique } : {}),
|
|
301
|
-
...(field.maxLength != null ? { maxLength: field.maxLength } : {}),
|
|
302
|
-
section,
|
|
303
|
-
});
|
|
304
|
-
case 'long-text':
|
|
305
|
-
return new LongTextField(objectInstance, {
|
|
306
|
-
apiName,
|
|
307
|
-
displayName: field.displayName,
|
|
308
|
-
description: field.description,
|
|
309
|
-
required: field.required,
|
|
310
|
-
...(field.maxLength != null ? { maxLength: field.maxLength } : {}),
|
|
311
|
-
section,
|
|
312
|
-
});
|
|
313
|
-
case 'email':
|
|
314
|
-
return new EmailField(objectInstance, {
|
|
315
|
-
apiName,
|
|
316
|
-
displayName: field.displayName,
|
|
317
|
-
description: field.description,
|
|
318
|
-
required: field.required,
|
|
319
|
-
...(field.unique != null ? { unique: field.unique } : {}),
|
|
320
|
-
section,
|
|
321
|
-
});
|
|
322
|
-
case 'url':
|
|
323
|
-
return new UrlField(objectInstance, {
|
|
324
|
-
apiName,
|
|
325
|
-
displayName: field.displayName,
|
|
326
|
-
description: field.description,
|
|
327
|
-
required: field.required,
|
|
328
|
-
section,
|
|
329
|
-
});
|
|
330
|
-
case 'phone':
|
|
331
|
-
return new PhoneField(objectInstance, {
|
|
332
|
-
apiName,
|
|
333
|
-
displayName: field.displayName,
|
|
334
|
-
description: field.description,
|
|
335
|
-
required: field.required,
|
|
336
|
-
section,
|
|
337
|
-
});
|
|
338
|
-
case 'number':
|
|
339
|
-
return new NumberField(objectInstance, {
|
|
340
|
-
apiName,
|
|
341
|
-
displayName: field.displayName,
|
|
342
|
-
description: field.description,
|
|
343
|
-
required: field.required,
|
|
344
|
-
...(field.unique != null ? { unique: field.unique } : {}),
|
|
345
|
-
...(field.decimalPlaces != null ? { decimalPlaces: field.decimalPlaces } : {}),
|
|
346
|
-
section,
|
|
347
|
-
});
|
|
348
|
-
case 'currency':
|
|
349
|
-
return new CurrencyField(objectInstance, {
|
|
350
|
-
apiName,
|
|
351
|
-
displayName: field.displayName,
|
|
352
|
-
description: field.description,
|
|
353
|
-
required: field.required,
|
|
354
|
-
...(field.currency != null ? { currency: field.currency } : {}),
|
|
355
|
-
...(field.decimalPlaces != null ? { decimalPlaces: field.decimalPlaces } : {}),
|
|
356
|
-
section,
|
|
357
|
-
});
|
|
358
|
-
case 'percentage':
|
|
359
|
-
return new PercentageField(objectInstance, {
|
|
360
|
-
apiName,
|
|
361
|
-
displayName: field.displayName,
|
|
362
|
-
description: field.description,
|
|
363
|
-
required: field.required,
|
|
364
|
-
section,
|
|
365
|
-
});
|
|
366
|
-
case 'date':
|
|
367
|
-
return new DateField(objectInstance, {
|
|
368
|
-
apiName,
|
|
369
|
-
displayName: field.displayName,
|
|
370
|
-
description: field.description,
|
|
371
|
-
required: field.required,
|
|
372
|
-
section,
|
|
373
|
-
});
|
|
374
|
-
case 'datetime':
|
|
375
|
-
return new DatetimeField(objectInstance, {
|
|
376
|
-
apiName,
|
|
377
|
-
displayName: field.displayName,
|
|
378
|
-
description: field.description,
|
|
379
|
-
required: field.required,
|
|
380
|
-
section,
|
|
381
|
-
});
|
|
382
|
-
case 'time':
|
|
383
|
-
return new TimeField(objectInstance, {
|
|
384
|
-
apiName,
|
|
385
|
-
displayName: field.displayName,
|
|
386
|
-
description: field.description,
|
|
387
|
-
required: field.required,
|
|
388
|
-
section,
|
|
389
|
-
});
|
|
390
|
-
case 'select':
|
|
391
|
-
return new SelectField(objectInstance, {
|
|
392
|
-
apiName,
|
|
393
|
-
displayName: field.displayName,
|
|
394
|
-
description: field.description,
|
|
395
|
-
required: field.required,
|
|
396
|
-
options: [...field.options],
|
|
397
|
-
section,
|
|
398
|
-
});
|
|
399
|
-
case 'radio':
|
|
400
|
-
return new RadioField(objectInstance, {
|
|
401
|
-
apiName,
|
|
402
|
-
displayName: field.displayName,
|
|
403
|
-
description: field.description,
|
|
404
|
-
required: field.required,
|
|
405
|
-
options: [...field.options],
|
|
406
|
-
section,
|
|
407
|
-
});
|
|
408
|
-
case 'boolean':
|
|
409
|
-
return new BooleanField(objectInstance, {
|
|
410
|
-
apiName,
|
|
411
|
-
displayName: field.displayName,
|
|
412
|
-
description: field.description,
|
|
413
|
-
required: field.required,
|
|
414
|
-
section,
|
|
415
|
-
});
|
|
416
|
-
case 'file':
|
|
417
|
-
return new FileField(objectInstance, {
|
|
418
|
-
apiName,
|
|
419
|
-
displayName: field.displayName,
|
|
420
|
-
description: field.description,
|
|
421
|
-
required: field.required,
|
|
422
|
-
allowedType: field.allowedType,
|
|
423
|
-
section,
|
|
424
|
-
});
|
|
425
|
-
case 'lookup':
|
|
426
|
-
return new LookupField(objectInstance, {
|
|
427
|
-
apiName,
|
|
428
|
-
displayName: field.displayName,
|
|
429
|
-
description: field.description,
|
|
430
|
-
target: field.target.apiName,
|
|
431
|
-
...(field.relatedDataLabel != null ? { relatedDataLabel: field.relatedDataLabel } : {}),
|
|
432
|
-
...(field.lookupFilterRqlCondition != null ?
|
|
433
|
-
{ lookup_filter_rql_condition: field.lookupFilterRqlCondition }
|
|
434
|
-
: {}),
|
|
435
|
-
required: field.required,
|
|
436
|
-
section,
|
|
437
|
-
});
|
|
438
|
-
case 'parent-child': {
|
|
439
|
-
const target =
|
|
440
|
-
field.target.apiName === objectInstance.getApiName() ?
|
|
441
|
-
objectInstance
|
|
442
|
-
: resolveCustomObjectTarget?.(field.target.apiName);
|
|
443
|
-
if (target == null) {
|
|
444
|
-
throw new Error(
|
|
445
|
-
`Parent-child field "${fieldLogicalName}" targets "${field.target.apiName}", but no manifest CustomObject resolver was provided.`,
|
|
446
|
-
);
|
|
447
|
-
}
|
|
448
|
-
return new ParentChildField(objectInstance, {
|
|
449
|
-
apiName,
|
|
450
|
-
displayName: field.displayName,
|
|
451
|
-
description: field.description,
|
|
452
|
-
target,
|
|
453
|
-
...(field.relatedDataLabel != null ? { relatedDataLabel: field.relatedDataLabel } : {}),
|
|
454
|
-
...(field.parentChildType != null ? { parentChildType: field.parentChildType } : {}),
|
|
455
|
-
...(field.enableParentOwnerInheritance != null ?
|
|
456
|
-
{ enableParentOwnerInheritance: field.enableParentOwnerInheritance }
|
|
457
|
-
: {}),
|
|
458
|
-
section,
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
case 'formula-text':
|
|
462
|
-
case 'formula-number':
|
|
463
|
-
case 'formula-boolean':
|
|
464
|
-
case 'formula-currency':
|
|
465
|
-
case 'formula-percentage':
|
|
466
|
-
case 'formula-date':
|
|
467
|
-
case 'formula-url':
|
|
468
|
-
return new FormulaField(objectInstance, {
|
|
469
|
-
apiName,
|
|
470
|
-
displayName: field.displayName,
|
|
471
|
-
description: field.description,
|
|
472
|
-
formula: field.formula,
|
|
473
|
-
fieldType: formulaFieldType(field.kind),
|
|
474
|
-
...(field.kind === 'formula-text' ? { maxLength: field.maxLength } : {}),
|
|
475
|
-
section,
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
/**
|
|
481
|
-
* Materializes a typed custom-object definition into the existing manifest API.
|
|
482
|
-
*
|
|
483
|
-
* The returned value preserves logical field keys, but each field becomes a
|
|
484
|
-
* concrete manifest class instance (`TextField`, `LookupField`, ...). This lets
|
|
485
|
-
* existing page-layout, list-view, and rule APIs keep working while authors use
|
|
486
|
-
* a cleaner logical-name authoring model.
|
|
487
|
-
*
|
|
488
|
-
* @param scope - Manifest scope that should own the created manifest components.
|
|
489
|
-
* @param options - Typed object definition plus manifest-specific registration options.
|
|
490
|
-
* @returns Frozen manifest registration preserving both typed logical keys and concrete manifest instances.
|
|
491
|
-
* @typeParam TDefinition - Object definition being materialized into manifest classes.
|
|
492
|
-
*/
|
|
493
|
-
export function registerManifestCustomObject<TDefinition extends AnyCustomObjectDefinition>(
|
|
494
|
-
scope: ManifestScope,
|
|
495
|
-
options: RegisterManifestCustomObjectOptions<TDefinition>,
|
|
496
|
-
): ManifestRegistration<TDefinition> {
|
|
497
|
-
const scaffold = createRegistrationScaffold(scope, options);
|
|
498
|
-
const registeredFields = registerFieldsForScaffold(scaffold, options.resolveCustomObjectTarget);
|
|
499
|
-
|
|
500
|
-
return Object.freeze({
|
|
501
|
-
definition: scaffold.definition,
|
|
502
|
-
category: scaffold.category,
|
|
503
|
-
object: scaffold.object,
|
|
504
|
-
sections: Object.freeze(scaffold.sections),
|
|
505
|
-
fields: Object.freeze(registeredFields),
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
/**
|
|
510
|
-
* Materializes multiple typed custom-object definitions into manifest classes in one pass.
|
|
511
|
-
*
|
|
512
|
-
* This helper is the higher-level golden path for multi-object examples: it
|
|
513
|
-
* creates every manifest object and section first, then registers fields in a
|
|
514
|
-
* second pass so parent-child relationships can target objects declared earlier
|
|
515
|
-
* or later in the input tuple.
|
|
516
|
-
*
|
|
517
|
-
* @param scope - Manifest scope that should own the created manifest components.
|
|
518
|
-
* @param options - Ordered tuple of typed object definitions plus shared manifest registration options.
|
|
519
|
-
* @returns Ordered tuple of manifest registrations matching the input definition order.
|
|
520
|
-
* @typeParam TDefinitions - Ordered tuple of object definitions being materialized.
|
|
521
|
-
*/
|
|
522
|
-
export function registerManifestCustomObjects<TDefinitions extends readonly AnyCustomObjectDefinition[]>(
|
|
523
|
-
scope: ManifestScope,
|
|
524
|
-
options: RegisterManifestCustomObjectsOptions<TDefinitions>,
|
|
525
|
-
): ManifestRegistrationTuple<TDefinitions> {
|
|
526
|
-
const scaffolds = options.definitions.map((definition) =>
|
|
527
|
-
createRegistrationScaffold(scope, {
|
|
528
|
-
definition,
|
|
529
|
-
category: options.category,
|
|
530
|
-
...(options.defaultSection != null ? { defaultSection: options.defaultSection } : {}),
|
|
531
|
-
}),
|
|
532
|
-
);
|
|
533
|
-
|
|
534
|
-
const objectsByApiName = new Map<string, CustomObject>(
|
|
535
|
-
scaffolds.map((scaffold) => [scaffold.definition.apiName, scaffold.object]),
|
|
536
|
-
);
|
|
537
|
-
const resolveCustomObjectTarget = (apiName: string) => {
|
|
538
|
-
const objectInstance = objectsByApiName.get(apiName);
|
|
539
|
-
if (objectInstance == null) {
|
|
540
|
-
throw new Error(`Missing manifest registration for custom-object target "${apiName}".`);
|
|
541
|
-
}
|
|
542
|
-
return objectInstance;
|
|
543
|
-
};
|
|
544
|
-
|
|
545
|
-
return scaffolds.map((scaffold) => {
|
|
546
|
-
const registeredFields = registerFieldsForScaffold(scaffold, resolveCustomObjectTarget);
|
|
547
|
-
return Object.freeze({
|
|
548
|
-
definition: scaffold.definition,
|
|
549
|
-
category: scaffold.category,
|
|
550
|
-
object: scaffold.object,
|
|
551
|
-
sections: Object.freeze(scaffold.sections),
|
|
552
|
-
fields: Object.freeze(registeredFields),
|
|
553
|
-
});
|
|
554
|
-
}) as ManifestRegistrationTuple<TDefinitions>;
|
|
555
|
-
}
|