@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,221 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CustomObjectAction,
|
|
3
|
-
CustomObjectPageLayout,
|
|
4
|
-
ExistingManifestContext,
|
|
5
|
-
type ExistingManifestContextOptions,
|
|
6
|
-
ListViewDef,
|
|
7
|
-
Rule,
|
|
8
|
-
Validation,
|
|
9
|
-
} from '../../../../lib/manifest';
|
|
10
|
-
import type { AnyCustomObjectDefinition, FieldNames } from '../../custom-objects/types';
|
|
11
|
-
import { getExistingManifestContext } from '../../../../lib/manifest/existing-manifest-context';
|
|
12
|
-
import type { ManifestRegistration } from './types';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Typed binding result for one custom object loaded from an existing manifest.
|
|
16
|
-
*
|
|
17
|
-
* This mirrors the registration shape produced by `registerManifestCustomObject(...)`
|
|
18
|
-
* while pointing at already-existing manifest components instead of creating new ones.
|
|
19
|
-
* It is the typed anchor for existing-manifest extension work: callers can keep
|
|
20
|
-
* using typed fields, sections, layouts, rules, validations, and actions that
|
|
21
|
-
* already exist in the manifest, then drop to raw `lib/manifest` classes only
|
|
22
|
-
* when they intentionally need an escape hatch for brand-new manifest-only
|
|
23
|
-
* components that do not yet have a dedicated typed helper.
|
|
24
|
-
*
|
|
25
|
-
* @typeParam TDefinition - Typed custom-object definition bound to the loaded manifest components.
|
|
26
|
-
*/
|
|
27
|
-
export interface ExistingManifestRegistration<TDefinition extends AnyCustomObjectDefinition>
|
|
28
|
-
extends ManifestRegistration<TDefinition> {
|
|
29
|
-
/** Existing-manifest context that resolved this binding. */
|
|
30
|
-
readonly context: ExistingManifestContext;
|
|
31
|
-
/** Loads one existing list view scoped to this custom object. */
|
|
32
|
-
loadListView(viewId: string): ListViewDef;
|
|
33
|
-
/** Loads one existing page layout scoped to this custom object. */
|
|
34
|
-
loadPageLayout(layoutIdOrApiName: string): CustomObjectPageLayout;
|
|
35
|
-
/** Loads one existing validation rule scoped to this custom object. */
|
|
36
|
-
loadValidation(ruleId: string): Validation;
|
|
37
|
-
/** Loads one existing record-triggered rule scoped to this custom object. */
|
|
38
|
-
loadRule(flowId: string): Rule;
|
|
39
|
-
/** Loads one existing object action scoped to this custom object. */
|
|
40
|
-
loadAction(actionId: string): CustomObjectAction;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Options for {@link bindExistingManifestCustomObject}.
|
|
45
|
-
*
|
|
46
|
-
* @typeParam TDefinition - Typed custom-object definition being bound.
|
|
47
|
-
*/
|
|
48
|
-
export interface BindExistingManifestCustomObjectOptions<TDefinition extends AnyCustomObjectDefinition>
|
|
49
|
-
extends ExistingManifestContextOptions {
|
|
50
|
-
/** Optional override for the custom-object API name to load. Defaults to `definition.apiName`. */
|
|
51
|
-
readonly customObjectApiName?: TDefinition['apiName'];
|
|
52
|
-
/** Optional override for the category API name to load. Defaults to `definition.categoryApiName`. */
|
|
53
|
-
readonly categoryApiName?: TDefinition['categoryApiName'];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Options for {@link bindExistingManifestCustomObjects}.
|
|
58
|
-
*
|
|
59
|
-
* @typeParam TDefinitions - Ordered tuple of typed custom-object definitions being bound.
|
|
60
|
-
*/
|
|
61
|
-
export interface BindExistingManifestCustomObjectsOptions<
|
|
62
|
-
TDefinitions extends readonly AnyCustomObjectDefinition[],
|
|
63
|
-
> extends ExistingManifestContextOptions {
|
|
64
|
-
/** Ordered tuple of typed custom-object definitions to bind. */
|
|
65
|
-
readonly definitions: TDefinitions;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Registration tuple returned by {@link bindExistingManifestCustomObjects}.
|
|
70
|
-
*
|
|
71
|
-
* @typeParam TDefinitions - Ordered tuple of object definitions that were bound.
|
|
72
|
-
*/
|
|
73
|
-
export type ExistingManifestRegistrationTuple<TDefinitions extends readonly AnyCustomObjectDefinition[]> = {
|
|
74
|
-
readonly [TIndex in keyof TDefinitions]: TDefinitions[TIndex] extends AnyCustomObjectDefinition ?
|
|
75
|
-
ExistingManifestRegistration<TDefinitions[TIndex]>
|
|
76
|
-
: never;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
function resolveSectionId<TDefinition extends AnyCustomObjectDefinition>(
|
|
80
|
-
definition: TDefinition,
|
|
81
|
-
sectionKey: Extract<keyof TDefinition['sections'], string>,
|
|
82
|
-
customObjectApiName: string,
|
|
83
|
-
context: ExistingManifestContext,
|
|
84
|
-
): string {
|
|
85
|
-
const section = definition.sections[sectionKey];
|
|
86
|
-
if (section?.sectionId != null) {
|
|
87
|
-
return section.sectionId;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const fieldSectionIds = new Set<string>();
|
|
91
|
-
for (const fieldName of Object.keys(definition.fields) as FieldNames<TDefinition>[]) {
|
|
92
|
-
const field = definition.fields[fieldName];
|
|
93
|
-
if (field == null || field.section !== sectionKey) continue;
|
|
94
|
-
const loadedField = context.loadField(field.apiName, { customObjectApiName });
|
|
95
|
-
const sectionId = loadedField.getSectionId();
|
|
96
|
-
if (typeof sectionId === 'string' && sectionId.length > 0) {
|
|
97
|
-
fieldSectionIds.add(sectionId);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (fieldSectionIds.size === 1) {
|
|
102
|
-
return [...fieldSectionIds][0]!;
|
|
103
|
-
}
|
|
104
|
-
if (fieldSectionIds.size > 1) {
|
|
105
|
-
throw new Error(
|
|
106
|
-
`Could not resolve one existing manifest section for key "${sectionKey}" on "${customObjectApiName}". ` +
|
|
107
|
-
`Fields in that section resolved to multiple section ids: ${[...fieldSectionIds]
|
|
108
|
-
.sort()
|
|
109
|
-
.join(', ')}. ` +
|
|
110
|
-
'Add a stable sectionId to the typed definition to disambiguate.',
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
throw new Error(
|
|
115
|
-
`Could not resolve existing manifest section key "${sectionKey}" for "${customObjectApiName}". ` +
|
|
116
|
-
'Add a stable sectionId to the typed definition or ensure at least one field in that section already exists in the manifest.',
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Binds one typed custom-object definition to components already present in an existing manifest.
|
|
122
|
-
*
|
|
123
|
-
* Use this helper when you want to mutate an installed or pre-authored manifest
|
|
124
|
-
* through the typed custom-object lane instead of manually loading raw fields,
|
|
125
|
-
* sections, layouts, and actions one by one.
|
|
126
|
-
*
|
|
127
|
-
* Current boundary: this helper rebinds the existing manifest back onto the
|
|
128
|
-
* typed definition so downstream code can stay in logical typed names for the
|
|
129
|
-
* common path, but it does not yet provide a fully typed builder for creating
|
|
130
|
-
* brand-new fields or sections during an existing-manifest edit. When you need
|
|
131
|
-
* that today, use this binding as the typed anchor and then drop to
|
|
132
|
-
* `@rippling/rippling-sdk/lib/manifest` as the explicit escape hatch.
|
|
133
|
-
*
|
|
134
|
-
* @param definition - Typed custom-object definition that should bind to existing manifest components.
|
|
135
|
-
* @param options - Existing-manifest context plus optional API-name overrides.
|
|
136
|
-
* @returns Typed registration-like handle backed by existing manifest components.
|
|
137
|
-
* @typeParam TDefinition - Object definition whose fields and sections should be bound.
|
|
138
|
-
*/
|
|
139
|
-
export function bindExistingManifestCustomObject<TDefinition extends AnyCustomObjectDefinition>(
|
|
140
|
-
definition: TDefinition,
|
|
141
|
-
options: BindExistingManifestCustomObjectOptions<TDefinition> = {},
|
|
142
|
-
): ExistingManifestRegistration<TDefinition> {
|
|
143
|
-
const context = getExistingManifestContext(options);
|
|
144
|
-
const customObjectApiName = options.customObjectApiName ?? definition.apiName;
|
|
145
|
-
const categoryApiName = options.categoryApiName ?? definition.categoryApiName;
|
|
146
|
-
const category = context.loadCategory(categoryApiName);
|
|
147
|
-
const object = context.loadCustomObject(customObjectApiName);
|
|
148
|
-
|
|
149
|
-
const sections = Object.freeze(
|
|
150
|
-
Object.fromEntries(
|
|
151
|
-
Object.keys(definition.sections).map((sectionKey) => {
|
|
152
|
-
const sectionId = resolveSectionId(
|
|
153
|
-
definition,
|
|
154
|
-
sectionKey as Extract<keyof TDefinition['sections'], string>,
|
|
155
|
-
customObjectApiName,
|
|
156
|
-
context,
|
|
157
|
-
);
|
|
158
|
-
return [
|
|
159
|
-
sectionKey,
|
|
160
|
-
context.loadFieldSection(sectionId, {
|
|
161
|
-
customObjectApiName,
|
|
162
|
-
}),
|
|
163
|
-
];
|
|
164
|
-
}),
|
|
165
|
-
),
|
|
166
|
-
) as ExistingManifestRegistration<TDefinition>['sections'];
|
|
167
|
-
|
|
168
|
-
const fields = Object.freeze(
|
|
169
|
-
Object.fromEntries(
|
|
170
|
-
Object.keys(definition.fields).map((fieldName) => [
|
|
171
|
-
fieldName,
|
|
172
|
-
context.loadField(definition.fields[fieldName as FieldNames<TDefinition>]!.apiName, {
|
|
173
|
-
customObjectApiName,
|
|
174
|
-
}),
|
|
175
|
-
]),
|
|
176
|
-
),
|
|
177
|
-
) as ExistingManifestRegistration<TDefinition>['fields'];
|
|
178
|
-
|
|
179
|
-
return Object.freeze({
|
|
180
|
-
context,
|
|
181
|
-
definition,
|
|
182
|
-
category,
|
|
183
|
-
object,
|
|
184
|
-
sections,
|
|
185
|
-
fields,
|
|
186
|
-
loadListView(viewId: string) {
|
|
187
|
-
return context.loadListView(viewId, { customObjectApiName });
|
|
188
|
-
},
|
|
189
|
-
loadPageLayout(layoutIdOrApiName: string) {
|
|
190
|
-
return context.loadPageLayout(layoutIdOrApiName, { customObjectApiName });
|
|
191
|
-
},
|
|
192
|
-
loadValidation(ruleId: string) {
|
|
193
|
-
return context.loadValidation(ruleId, { customObjectApiName });
|
|
194
|
-
},
|
|
195
|
-
loadRule(flowId: string) {
|
|
196
|
-
return context.loadRule(flowId, { customObjectApiName });
|
|
197
|
-
},
|
|
198
|
-
loadAction(actionId: string) {
|
|
199
|
-
return context.loadCustomObjectAction(actionId, { customObjectApiName });
|
|
200
|
-
},
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Binds multiple typed custom-object definitions to components already present in an existing manifest.
|
|
206
|
-
*
|
|
207
|
-
* @param options - Existing-manifest context plus the ordered tuple of definitions to bind.
|
|
208
|
-
* @returns Ordered tuple of typed registration-like handles backed by existing manifest components.
|
|
209
|
-
* @typeParam TDefinitions - Ordered tuple of object definitions to bind.
|
|
210
|
-
*/
|
|
211
|
-
export function bindExistingManifestCustomObjects<TDefinitions extends readonly AnyCustomObjectDefinition[]>(
|
|
212
|
-
options: BindExistingManifestCustomObjectsOptions<TDefinitions>,
|
|
213
|
-
): ExistingManifestRegistrationTuple<TDefinitions> {
|
|
214
|
-
return options.definitions.map((definition) =>
|
|
215
|
-
options.context != null ?
|
|
216
|
-
bindExistingManifestCustomObject(definition, {
|
|
217
|
-
context: options.context,
|
|
218
|
-
})
|
|
219
|
-
: bindExistingManifestCustomObject(definition),
|
|
220
|
-
) as ExistingManifestRegistrationTuple<TDefinitions>;
|
|
221
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import type { CustomObjectStandardFieldApiName, Field } from '../../../../lib/manifest';
|
|
2
|
-
import type { AnyCustomObjectDefinition, FieldNames, StandardRecordFields } from '../../custom-objects/types';
|
|
3
|
-
import type { ManifestRegistration } from './types';
|
|
4
|
-
|
|
5
|
-
const STANDARD_TYPED_MANIFEST_FIELD_NAMES = [
|
|
6
|
-
'id',
|
|
7
|
-
'name',
|
|
8
|
-
'created_at',
|
|
9
|
-
'updated_at',
|
|
10
|
-
'system_updated_at',
|
|
11
|
-
'external_id',
|
|
12
|
-
'owner_role',
|
|
13
|
-
'created_by',
|
|
14
|
-
'last_modified_by',
|
|
15
|
-
] as const satisfies readonly StandardManifestFieldName<AnyCustomObjectDefinition>[];
|
|
16
|
-
|
|
17
|
-
const STANDARD_TYPED_MANIFEST_FIELD_NAME_SET = new Set<string>(STANDARD_TYPED_MANIFEST_FIELD_NAMES);
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Standard field-name strings accepted by typed manifest helpers.
|
|
21
|
-
*
|
|
22
|
-
* These names intentionally use the record-shape snake_case surface rather than
|
|
23
|
-
* the low-level manifest layer's camelCase aliases so authoring stays aligned
|
|
24
|
-
* with typed records, validators, and create/update payload helpers.
|
|
25
|
-
*
|
|
26
|
-
* @typeParam TDefinition - Object definition whose standard record fields should be exposed.
|
|
27
|
-
*/
|
|
28
|
-
export type StandardManifestFieldName<TDefinition extends AnyCustomObjectDefinition> = Extract<
|
|
29
|
-
keyof StandardRecordFields<TDefinition>,
|
|
30
|
-
string
|
|
31
|
-
>;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Field-name strings accepted by typed manifest helpers.
|
|
35
|
-
*
|
|
36
|
-
* The union combines the standard per-record fields present on every custom
|
|
37
|
-
* object with the logical custom-field names declared in the typed schema.
|
|
38
|
-
*
|
|
39
|
-
* @typeParam TDefinition - Object definition whose valid field-name strings should be exposed.
|
|
40
|
-
*/
|
|
41
|
-
export type TypedManifestFieldName<TDefinition extends AnyCustomObjectDefinition> =
|
|
42
|
-
| StandardManifestFieldName<TDefinition>
|
|
43
|
-
| FieldNames<TDefinition>;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Field inputs accepted by typed manifest helpers.
|
|
47
|
-
*
|
|
48
|
-
* Strings provide object-specific IntelliSense for standard and custom fields.
|
|
49
|
-
* Concrete manifest {@link Field} references remain allowed for computed fields
|
|
50
|
-
* such as summary fields that are created after the base schema is registered.
|
|
51
|
-
*
|
|
52
|
-
* @typeParam TDefinition - Object definition whose manifest field inputs are being authored.
|
|
53
|
-
*/
|
|
54
|
-
export type TypedManifestFieldInput<TDefinition extends AnyCustomObjectDefinition> =
|
|
55
|
-
| TypedManifestFieldName<TDefinition>
|
|
56
|
-
| Field;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Type-safe `hasOwnProperty` helper for typed manifest field resolution.
|
|
60
|
-
*
|
|
61
|
-
* @param value - Object whose own properties should be checked.
|
|
62
|
-
* @param key - Candidate property key.
|
|
63
|
-
* @returns Whether the object owns that property.
|
|
64
|
-
* @typeParam TObject - Object type being narrowed.
|
|
65
|
-
*/
|
|
66
|
-
function hasOwn<TObject extends object>(
|
|
67
|
-
value: TObject,
|
|
68
|
-
key: PropertyKey,
|
|
69
|
-
): key is Extract<keyof TObject, string | number | symbol> {
|
|
70
|
-
return Object.prototype.hasOwnProperty.call(value, key);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Resolves one typed manifest field input into the concrete manifest {@link Field} instance.
|
|
75
|
-
*
|
|
76
|
-
* Assumptions:
|
|
77
|
-
* - standard field names should autocomplete as snake_case strings
|
|
78
|
-
* - custom typed fields should resolve from the manifest registration returned by
|
|
79
|
-
* the typed manifest registration helper
|
|
80
|
-
* - computed fields like summary fields may still be passed directly as manifest field objects
|
|
81
|
-
*
|
|
82
|
-
* @param registration - Manifest registration produced from the typed object definition.
|
|
83
|
-
* @param field - Typed field input to resolve.
|
|
84
|
-
* @returns Concrete manifest field instance suitable for low-level manifest APIs.
|
|
85
|
-
* @typeParam TDefinition - Object definition whose field reference is being resolved.
|
|
86
|
-
*/
|
|
87
|
-
export function resolveTypedManifestField<TDefinition extends AnyCustomObjectDefinition>(
|
|
88
|
-
registration: ManifestRegistration<TDefinition>,
|
|
89
|
-
field: TypedManifestFieldInput<TDefinition>,
|
|
90
|
-
): Field {
|
|
91
|
-
if (typeof field !== 'string') return field;
|
|
92
|
-
|
|
93
|
-
const matchesCustomField = hasOwn(registration.fields, field);
|
|
94
|
-
const matchesStandardField = STANDARD_TYPED_MANIFEST_FIELD_NAME_SET.has(field);
|
|
95
|
-
|
|
96
|
-
if (matchesCustomField && matchesStandardField) {
|
|
97
|
-
throw new Error(
|
|
98
|
-
`Field name "${field}" is ambiguous on "${registration.definition.apiName}" because it matches both a standard field and a custom field. ` +
|
|
99
|
-
'Pass an explicit manifest field reference instead.',
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
if (matchesCustomField) return registration.fields[field as FieldNames<TDefinition>] as unknown as Field;
|
|
103
|
-
if (matchesStandardField) {
|
|
104
|
-
return registration.object.standardField(field as CustomObjectStandardFieldApiName);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const validFieldNames = [
|
|
108
|
-
...STANDARD_TYPED_MANIFEST_FIELD_NAMES,
|
|
109
|
-
...Object.keys(registration.fields).sort(),
|
|
110
|
-
];
|
|
111
|
-
throw new Error(
|
|
112
|
-
`Unknown field name "${field}" for "${
|
|
113
|
-
registration.definition.apiName
|
|
114
|
-
}". Valid field names: ${validFieldNames.join(', ')}.`,
|
|
115
|
-
);
|
|
116
|
-
}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import * as fs from 'node:fs';
|
|
2
|
-
import * as path from 'node:path';
|
|
3
|
-
import {
|
|
4
|
-
ManifestFunction,
|
|
5
|
-
type ManifestFunctionProps,
|
|
6
|
-
SduiPage,
|
|
7
|
-
type SduiPageProps,
|
|
8
|
-
type Workflow,
|
|
9
|
-
} from '../../../../lib/manifest';
|
|
10
|
-
import type { ManifestScope } from '../../../../lib/manifest/manifest-builder';
|
|
11
|
-
import type { AnyCustomObjectDefinition } from '../../custom-objects/types';
|
|
12
|
-
import { defineTypedWorkflow, type TypedWorkflowProps } from './workflow';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Shared properties for helpers that load manifest function source code from a
|
|
16
|
-
* file on disk.
|
|
17
|
-
*/
|
|
18
|
-
export interface ManifestFunctionFileSource {
|
|
19
|
-
/** Directory containing the function source file. */
|
|
20
|
-
readonly codeDirectory: string;
|
|
21
|
-
/** File name to read from {@link codeDirectory}. */
|
|
22
|
-
readonly codeFilename: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Initialization properties for {@link defineManifestFunctionFromFile}.
|
|
27
|
-
*/
|
|
28
|
-
export interface ManifestFunctionFromFileProps
|
|
29
|
-
extends Omit<ManifestFunctionProps, 'code'>,
|
|
30
|
-
ManifestFunctionFileSource {}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Initialization properties for {@link defineSduiPageFromFunctionFile}.
|
|
34
|
-
*/
|
|
35
|
-
export interface SduiPageFromFunctionFileProps
|
|
36
|
-
extends Omit<SduiPageProps, 'function' | 'name' | 'sduiPageId'>,
|
|
37
|
-
ManifestFunctionFromFileProps {
|
|
38
|
-
/** Unique identifier for the SDUI page. */
|
|
39
|
-
readonly pageId: string;
|
|
40
|
-
/** Display name shown as the app tab label. */
|
|
41
|
-
readonly pageName: string;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** Result returned by {@link defineSduiPageFromFunctionFile}. */
|
|
45
|
-
export interface SduiPageFromFunctionFileResult {
|
|
46
|
-
/** Manifest function created from the provided source file. */
|
|
47
|
-
readonly function: ManifestFunction;
|
|
48
|
-
/** SDUI page wired to the created manifest function. */
|
|
49
|
-
readonly page: SduiPage;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Initialization properties for {@link defineTypedWorkflowFromFunctionFile}.
|
|
54
|
-
*
|
|
55
|
-
* @typeParam TDefinition - Typed custom-object definition carried by the workflow trigger.
|
|
56
|
-
*/
|
|
57
|
-
export interface TypedWorkflowFromFunctionFileProps<
|
|
58
|
-
TDefinition extends AnyCustomObjectDefinition = AnyCustomObjectDefinition,
|
|
59
|
-
> extends Omit<TypedWorkflowProps<TDefinition>, 'function'> {
|
|
60
|
-
/** Function metadata and source-file location for the workflow handler. */
|
|
61
|
-
readonly function: ManifestFunctionFromFileProps;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/** Result returned by {@link defineTypedWorkflowFromFunctionFile}. */
|
|
65
|
-
export interface TypedWorkflowFromFunctionFileResult {
|
|
66
|
-
/** Manifest function created from the provided source file. */
|
|
67
|
-
readonly function: ManifestFunction;
|
|
68
|
-
/** Workflow wired to the created manifest function. */
|
|
69
|
-
readonly workflow: Workflow;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Loads one manifest function source file from disk.
|
|
74
|
-
*
|
|
75
|
-
* @param source - Directory + file-name pair describing the source file to read.
|
|
76
|
-
* @returns UTF-8 TypeScript handler source.
|
|
77
|
-
*/
|
|
78
|
-
export function loadManifestFunctionCode(source: ManifestFunctionFileSource): string {
|
|
79
|
-
return fs.readFileSync(path.join(source.codeDirectory, source.codeFilename), 'utf-8');
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Defines one manifest function by loading its handler source code from disk.
|
|
84
|
-
*
|
|
85
|
-
* @param scope - Manifest scope that should own the function.
|
|
86
|
-
* @param props - Function properties plus the source-file location.
|
|
87
|
-
* @returns Manifest function registered in the provided scope.
|
|
88
|
-
*/
|
|
89
|
-
export function defineManifestFunctionFromFile(
|
|
90
|
-
scope: ManifestScope,
|
|
91
|
-
props: ManifestFunctionFromFileProps,
|
|
92
|
-
): ManifestFunction {
|
|
93
|
-
const { codeDirectory, codeFilename, ...rest } = props;
|
|
94
|
-
return new ManifestFunction(scope, {
|
|
95
|
-
...rest,
|
|
96
|
-
code: loadManifestFunctionCode({ codeDirectory, codeFilename }),
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Defines one SDUI page and its backing manifest function from a source file.
|
|
102
|
-
*
|
|
103
|
-
* @param scope - Manifest scope that should own the function and page.
|
|
104
|
-
* @param props - Function properties, source-file location, and page wiring metadata.
|
|
105
|
-
* @returns Created manifest function plus the SDUI page wired to it.
|
|
106
|
-
*/
|
|
107
|
-
export function defineSduiPageFromFunctionFile(
|
|
108
|
-
scope: ManifestScope,
|
|
109
|
-
props: SduiPageFromFunctionFileProps,
|
|
110
|
-
): SduiPageFromFunctionFileResult {
|
|
111
|
-
const { pageId, pageName, ...functionProps } = props;
|
|
112
|
-
const createdFunction = defineManifestFunctionFromFile(scope, functionProps);
|
|
113
|
-
return {
|
|
114
|
-
function: createdFunction,
|
|
115
|
-
page: new SduiPage(scope, {
|
|
116
|
-
sduiPageId: pageId,
|
|
117
|
-
name: pageName,
|
|
118
|
-
function: createdFunction,
|
|
119
|
-
}),
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Defines one workflow and its backing manifest function from a source file.
|
|
125
|
-
*
|
|
126
|
-
* Prefer this helper when one workflow owns one colocated handler file and the
|
|
127
|
-
* caller wants the file loading plus workflow wiring in one step.
|
|
128
|
-
*
|
|
129
|
-
* @param scope - Manifest scope that should own the function and workflow.
|
|
130
|
-
* @param props - Workflow properties plus the function source-file location.
|
|
131
|
-
* @returns Created manifest function plus the workflow wired to it.
|
|
132
|
-
* @typeParam TDefinition - Typed custom-object definition carried by the workflow trigger.
|
|
133
|
-
*/
|
|
134
|
-
export function defineTypedWorkflowFromFunctionFile<
|
|
135
|
-
TDefinition extends AnyCustomObjectDefinition = AnyCustomObjectDefinition,
|
|
136
|
-
>(
|
|
137
|
-
scope: ManifestScope,
|
|
138
|
-
props: TypedWorkflowFromFunctionFileProps<TDefinition>,
|
|
139
|
-
): TypedWorkflowFromFunctionFileResult {
|
|
140
|
-
const { function: functionProps, ...workflowProps } = props;
|
|
141
|
-
const createdFunction = defineManifestFunctionFromFile(scope, functionProps);
|
|
142
|
-
return {
|
|
143
|
-
function: createdFunction,
|
|
144
|
-
workflow: defineTypedWorkflow(scope, {
|
|
145
|
-
...workflowProps,
|
|
146
|
-
function: createdFunction,
|
|
147
|
-
}),
|
|
148
|
-
};
|
|
149
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { ListViewDef, type ListViewDefProps } from '../../../../lib/manifest';
|
|
2
|
-
import type { AnyCustomObjectDefinition } from '../../custom-objects/types';
|
|
3
|
-
import type { ManifestConditionInput } from './conditions';
|
|
4
|
-
import { resolveManifestConditionInput } from './conditions';
|
|
5
|
-
import type { ManifestRegistration } from './types';
|
|
6
|
-
import type {
|
|
7
|
-
StandardManifestFieldName,
|
|
8
|
-
TypedManifestFieldInput,
|
|
9
|
-
TypedManifestFieldName,
|
|
10
|
-
} from './field-resolution';
|
|
11
|
-
import { resolveTypedManifestField } from './field-resolution';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Standard field-name strings accepted by the typed list-view helper.
|
|
15
|
-
*
|
|
16
|
-
* @typeParam TDefinition - Object definition whose standard field-name strings should be exposed.
|
|
17
|
-
*/
|
|
18
|
-
export type StandardListViewFieldName<TDefinition extends AnyCustomObjectDefinition> =
|
|
19
|
-
StandardManifestFieldName<TDefinition>;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Field-name strings accepted by the typed list-view helper.
|
|
23
|
-
*
|
|
24
|
-
* @typeParam TDefinition - Object definition whose valid list-view field-name strings should be exposed.
|
|
25
|
-
*/
|
|
26
|
-
export type TypedListViewFieldName<TDefinition extends AnyCustomObjectDefinition> =
|
|
27
|
-
TypedManifestFieldName<TDefinition>;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Field inputs accepted by the typed list-view helper.
|
|
31
|
-
*
|
|
32
|
-
* @typeParam TDefinition - Object definition whose list-view field inputs are being authored.
|
|
33
|
-
*/
|
|
34
|
-
export type TypedListViewFieldInput<TDefinition extends AnyCustomObjectDefinition> =
|
|
35
|
-
TypedManifestFieldInput<TDefinition>;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Initialization properties for {@link defineTypedListView}.
|
|
39
|
-
*
|
|
40
|
-
* @typeParam TDefinition - Object definition whose valid list-view fields should be enforced.
|
|
41
|
-
*/
|
|
42
|
-
export interface TypedListViewDefProps<TDefinition extends AnyCustomObjectDefinition>
|
|
43
|
-
extends Omit<ListViewDefProps, 'fields' | 'orderBy' | 'rqlFilter'> {
|
|
44
|
-
/**
|
|
45
|
-
* Optional typed manifest-condition used to filter the list view.
|
|
46
|
-
*
|
|
47
|
-
* This is rendered into the underlying low-level `rqlFilter` string.
|
|
48
|
-
*/
|
|
49
|
-
readonly filter?: ManifestConditionInput<TDefinition>;
|
|
50
|
-
/**
|
|
51
|
-
* Optional low-level filter string retained for escape hatches.
|
|
52
|
-
*
|
|
53
|
-
* Prefer `filter` for typed custom-object conditions when possible.
|
|
54
|
-
*/
|
|
55
|
-
readonly rqlFilter?: string;
|
|
56
|
-
/**
|
|
57
|
-
* Columns to display, expressed as typed field-name strings or concrete manifest field references.
|
|
58
|
-
*/
|
|
59
|
-
readonly fields: readonly TypedListViewFieldInput<TDefinition>[];
|
|
60
|
-
/**
|
|
61
|
-
* Optional field used for sorting. Accepts the same typed field inputs as `fields`.
|
|
62
|
-
*/
|
|
63
|
-
readonly orderBy?: TypedListViewFieldInput<TDefinition>;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Registers a typed list view for a manifest custom object.
|
|
68
|
-
*
|
|
69
|
-
* This helper sits on top of the low-level {@link ListViewDef} manifest class.
|
|
70
|
-
* It preserves the runtime behavior of that class while replacing the untyped
|
|
71
|
-
* `Field | string` authoring surface with an object-specific string-literal
|
|
72
|
-
* union that powers IntelliSense for valid field names.
|
|
73
|
-
*
|
|
74
|
-
* @param registration - Manifest registration produced from the typed object definition.
|
|
75
|
-
* @param props - Typed list-view properties to materialize into the manifest class.
|
|
76
|
-
* @returns Low-level manifest list-view instance with typed fields resolved.
|
|
77
|
-
* @typeParam TDefinition - Object definition whose valid list-view fields should be enforced.
|
|
78
|
-
*/
|
|
79
|
-
export function defineTypedListView<TDefinition extends AnyCustomObjectDefinition>(
|
|
80
|
-
registration: ManifestRegistration<TDefinition>,
|
|
81
|
-
props: TypedListViewDefProps<TDefinition>,
|
|
82
|
-
): ListViewDef {
|
|
83
|
-
const { fields, orderBy, filter, rqlFilter, ...rest } = props;
|
|
84
|
-
if (filter != null && rqlFilter != null) {
|
|
85
|
-
throw new Error('defineTypedListView(...): use either filter or rqlFilter, not both.');
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return new ListViewDef(registration.object, {
|
|
89
|
-
...rest,
|
|
90
|
-
fields: fields.map((field) => resolveTypedManifestField(registration, field)),
|
|
91
|
-
...(orderBy != null ? { orderBy: resolveTypedManifestField(registration, orderBy) } : {}),
|
|
92
|
-
...(filter != null ? { rqlFilter: resolveManifestConditionInput(registration, filter) } : {}),
|
|
93
|
-
...(rqlFilter != null ? { rqlFilter } : {}),
|
|
94
|
-
});
|
|
95
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { ObjectListView, render } from '@rippling/pebble-sdui-web/catalogs/custom-apps';
|
|
2
|
-
import { FunctionResponse, type FunctionContext, type SduiPageFunctionEvent } from '../../../../functions';
|
|
3
|
-
|
|
4
|
-
/*
|
|
5
|
-
* This helper intentionally depends on Pebble SDUI rendering. Consumers who use
|
|
6
|
-
* this module should install `@rippling/pebble-sdui-web` alongside the SDK.
|
|
7
|
-
*/
|
|
8
|
-
import type { AnyCustomObjectDefinition } from '../../custom-objects/types';
|
|
9
|
-
import type { ManifestCustomObjectTarget } from './conditions';
|
|
10
|
-
import type { ManifestRegistration } from './types';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Standard input shape for object-list page functions that only render their
|
|
14
|
-
* initial SDUI page.
|
|
15
|
-
*/
|
|
16
|
-
export type TypedObjectListPageInput = SduiPageFunctionEvent<{ action: 'init' }>;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Standard output body for object-list page functions that return one rendered
|
|
20
|
-
* SDUI spec.
|
|
21
|
-
*/
|
|
22
|
-
export interface TypedObjectListPageOutput {
|
|
23
|
-
/** JSON-serialized SDUI spec payload returned to the platform. */
|
|
24
|
-
readonly spec: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function isManifestRegistration<TDefinition extends AnyCustomObjectDefinition>(
|
|
28
|
-
target: ManifestCustomObjectTarget<TDefinition>,
|
|
29
|
-
): target is ManifestRegistration<TDefinition> {
|
|
30
|
-
return typeof target === 'object' && target != null && 'definition' in target && 'object' in target;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function resolveObjectApiName<TDefinition extends AnyCustomObjectDefinition>(
|
|
34
|
-
target: ManifestCustomObjectTarget<TDefinition>,
|
|
35
|
-
): string {
|
|
36
|
-
return isManifestRegistration(target) ? target.definition.apiName : target.apiName;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Builds the standard SDUI function response for a custom-object-backed object
|
|
41
|
-
* list page.
|
|
42
|
-
*
|
|
43
|
-
* @param target - Typed custom-object definition or manifest registration that owns the object list page.
|
|
44
|
-
* @returns Function response containing the rendered ObjectListView spec.
|
|
45
|
-
* @typeParam TDefinition - Typed custom-object definition whose API name should back the list page.
|
|
46
|
-
*/
|
|
47
|
-
export function createTypedObjectListPageResponse<TDefinition extends AnyCustomObjectDefinition>(
|
|
48
|
-
target: ManifestCustomObjectTarget<TDefinition>,
|
|
49
|
-
): FunctionResponse<TypedObjectListPageOutput> {
|
|
50
|
-
const spec = render({
|
|
51
|
-
root: ObjectListView({
|
|
52
|
-
props: { objectApiName: resolveObjectApiName(target) },
|
|
53
|
-
}),
|
|
54
|
-
state: {},
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
return new FunctionResponse<TypedObjectListPageOutput>({
|
|
58
|
-
body: { spec: JSON.stringify(spec) },
|
|
59
|
-
statusCode: 200,
|
|
60
|
-
headers: {},
|
|
61
|
-
message: '',
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Handles the standard custom-object object-list page event shape.
|
|
67
|
-
*
|
|
68
|
-
* The event and context are accepted so callers can keep an exported
|
|
69
|
-
* `onRipplingEvent(event, context)` signature that matches backend IO-contract
|
|
70
|
-
* derivation expectations, while delegating the repetitive response plumbing to
|
|
71
|
-
* this helper.
|
|
72
|
-
*
|
|
73
|
-
* @param event - Incoming SDUI page event, expected to be the standard init-only object-list shape.
|
|
74
|
-
* @param context - Function context supplied by the platform.
|
|
75
|
-
* @param target - Typed custom-object definition or manifest registration that owns the object list page.
|
|
76
|
-
* @returns Function response containing the rendered ObjectListView spec.
|
|
77
|
-
* @typeParam TDefinition - Typed custom-object definition whose API name should back the list page.
|
|
78
|
-
*/
|
|
79
|
-
export async function handleTypedObjectListPageEvent<TDefinition extends AnyCustomObjectDefinition>(
|
|
80
|
-
event: TypedObjectListPageInput,
|
|
81
|
-
context: FunctionContext,
|
|
82
|
-
target: ManifestCustomObjectTarget<TDefinition>,
|
|
83
|
-
): Promise<FunctionResponse<TypedObjectListPageOutput>> {
|
|
84
|
-
void event;
|
|
85
|
-
void context;
|
|
86
|
-
return createTypedObjectListPageResponse(target);
|
|
87
|
-
}
|