@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,256 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed custom-object schema definitions for the procurement approval hub example.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
date,
|
|
7
|
-
defineCustomObject,
|
|
8
|
-
email,
|
|
9
|
-
formula,
|
|
10
|
-
longText,
|
|
11
|
-
lookup,
|
|
12
|
-
number,
|
|
13
|
-
parentChild,
|
|
14
|
-
radio,
|
|
15
|
-
section,
|
|
16
|
-
text,
|
|
17
|
-
} from '@rippling/rippling-sdk/core/platform/custom-objects';
|
|
18
|
-
|
|
19
|
-
/** Logical category shared by the procurement approval hub example. */
|
|
20
|
-
export const PROCUREMENT_CATEGORY = 'procurement';
|
|
21
|
-
|
|
22
|
-
/** Vendor profile schema used for contract and request relationships. */
|
|
23
|
-
export const vendorDefinition = defineCustomObject({
|
|
24
|
-
name: 'pa_vendor',
|
|
25
|
-
displayName: 'Vendor',
|
|
26
|
-
pluralLabel: 'Vendors',
|
|
27
|
-
category: PROCUREMENT_CATEGORY,
|
|
28
|
-
description: 'Vendor profile, risk tier, and compliance owner',
|
|
29
|
-
sections: {
|
|
30
|
-
vendor: section('Vendor', { sectionId: 'sec_pa_vendor' }),
|
|
31
|
-
},
|
|
32
|
-
fields: {
|
|
33
|
-
legal_name: text({
|
|
34
|
-
displayName: 'Legal name',
|
|
35
|
-
description: 'Registered legal vendor name',
|
|
36
|
-
required: true,
|
|
37
|
-
maxLength: 200,
|
|
38
|
-
section: 'vendor',
|
|
39
|
-
}),
|
|
40
|
-
vendor_category: radio({
|
|
41
|
-
displayName: 'Vendor category',
|
|
42
|
-
description: 'Primary spend category',
|
|
43
|
-
options: ['Software', 'Facilities', 'Professional services', 'Marketing', 'Hardware', 'Other'],
|
|
44
|
-
required: true,
|
|
45
|
-
section: 'vendor',
|
|
46
|
-
}),
|
|
47
|
-
risk_tier: radio({
|
|
48
|
-
displayName: 'Risk tier',
|
|
49
|
-
description: 'Risk tier from diligence review',
|
|
50
|
-
options: ['Low', 'Medium', 'High', 'Critical'],
|
|
51
|
-
required: true,
|
|
52
|
-
section: 'vendor',
|
|
53
|
-
}),
|
|
54
|
-
contact_email: email({
|
|
55
|
-
displayName: 'Contact email',
|
|
56
|
-
description: 'Primary vendor contact email',
|
|
57
|
-
section: 'vendor',
|
|
58
|
-
}),
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
/** Contract schema tied to a parent vendor. */
|
|
63
|
-
export const contractDefinition = defineCustomObject({
|
|
64
|
-
name: 'pa_contract',
|
|
65
|
-
displayName: 'Contract',
|
|
66
|
-
pluralLabel: 'Contracts',
|
|
67
|
-
category: PROCUREMENT_CATEGORY,
|
|
68
|
-
description: 'Vendor contract with dates, status, and spend ceiling',
|
|
69
|
-
sections: {
|
|
70
|
-
contract: section('Contract', { sectionId: 'sec_pa_contract' }),
|
|
71
|
-
},
|
|
72
|
-
fields: {
|
|
73
|
-
vendor_ref: parentChild(vendorDefinition, {
|
|
74
|
-
displayName: 'Vendor',
|
|
75
|
-
description: 'Vendor this contract belongs to',
|
|
76
|
-
relatedDataLabel: 'Contracts',
|
|
77
|
-
parentChildType: 'PRIMARY',
|
|
78
|
-
enableParentOwnerInheritance: false,
|
|
79
|
-
section: 'contract',
|
|
80
|
-
}),
|
|
81
|
-
status: radio({
|
|
82
|
-
displayName: 'Status',
|
|
83
|
-
description: 'Contract lifecycle status',
|
|
84
|
-
options: ['Draft', 'In review', 'Active', 'Expired', 'Terminated'],
|
|
85
|
-
required: true,
|
|
86
|
-
section: 'contract',
|
|
87
|
-
}),
|
|
88
|
-
start_date: date({
|
|
89
|
-
displayName: 'Start date',
|
|
90
|
-
description: 'Contract effective date',
|
|
91
|
-
section: 'contract',
|
|
92
|
-
}),
|
|
93
|
-
end_date: date({
|
|
94
|
-
displayName: 'End date',
|
|
95
|
-
description: 'Contract expiration date',
|
|
96
|
-
section: 'contract',
|
|
97
|
-
}),
|
|
98
|
-
spend_ceiling_cents: number({
|
|
99
|
-
displayName: 'Spend ceiling (cents)',
|
|
100
|
-
description: 'Approved maximum spend in cents',
|
|
101
|
-
decimalPlaces: 0,
|
|
102
|
-
section: 'contract',
|
|
103
|
-
}),
|
|
104
|
-
key_terms: longText({
|
|
105
|
-
displayName: 'Key terms',
|
|
106
|
-
description: 'Renewal, data processing, and termination notes',
|
|
107
|
-
maxLength: 6000,
|
|
108
|
-
section: 'contract',
|
|
109
|
-
}),
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
/** Purchase-request schema tied to a vendor and optional contract. */
|
|
114
|
-
export const requestDefinition = defineCustomObject({
|
|
115
|
-
name: 'pa_purchase_request',
|
|
116
|
-
displayName: 'Purchase request',
|
|
117
|
-
pluralLabel: 'Purchase requests',
|
|
118
|
-
category: PROCUREMENT_CATEGORY,
|
|
119
|
-
description: 'Purchase request with business justification and approval state',
|
|
120
|
-
sections: {
|
|
121
|
-
request: section('Purchase request', { sectionId: 'sec_pa_request' }),
|
|
122
|
-
},
|
|
123
|
-
fields: {
|
|
124
|
-
vendor_ref: lookup(vendorDefinition, {
|
|
125
|
-
displayName: 'Vendor',
|
|
126
|
-
description: 'Preferred or selected vendor',
|
|
127
|
-
relatedDataLabel: 'Purchase requests',
|
|
128
|
-
required: true,
|
|
129
|
-
section: 'request',
|
|
130
|
-
}),
|
|
131
|
-
contract_ref: lookup(contractDefinition, {
|
|
132
|
-
displayName: 'Contract',
|
|
133
|
-
description: 'Contract used for this request, if any',
|
|
134
|
-
relatedDataLabel: 'Purchase requests',
|
|
135
|
-
section: 'request',
|
|
136
|
-
}),
|
|
137
|
-
amount_cents: number({
|
|
138
|
-
displayName: 'Amount (cents)',
|
|
139
|
-
description: 'Requested spend amount in cents',
|
|
140
|
-
decimalPlaces: 0,
|
|
141
|
-
required: true,
|
|
142
|
-
section: 'request',
|
|
143
|
-
}),
|
|
144
|
-
status: radio({
|
|
145
|
-
displayName: 'Status',
|
|
146
|
-
description: 'Approval status',
|
|
147
|
-
options: ['Draft', 'Submitted', 'In approval', 'Approved', 'Rejected', 'Ordered'],
|
|
148
|
-
required: true,
|
|
149
|
-
section: 'request',
|
|
150
|
-
}),
|
|
151
|
-
need_by: date({
|
|
152
|
-
displayName: 'Need by',
|
|
153
|
-
description: 'Requested delivery or purchase date',
|
|
154
|
-
section: 'request',
|
|
155
|
-
}),
|
|
156
|
-
business_justification: longText({
|
|
157
|
-
displayName: 'Business justification',
|
|
158
|
-
description: 'Why the purchase is needed',
|
|
159
|
-
maxLength: 6000,
|
|
160
|
-
section: 'request',
|
|
161
|
-
}),
|
|
162
|
-
approval_label: formula.text({
|
|
163
|
-
displayName: 'Approval label',
|
|
164
|
-
description: 'Status and amount for approval queues',
|
|
165
|
-
formula: "CONCATENATE(status__c, ' - ', amount_cents__c)",
|
|
166
|
-
maxLength: 240,
|
|
167
|
-
section: 'request',
|
|
168
|
-
}),
|
|
169
|
-
},
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
/** Approval-step schema tied to a parent purchase request. */
|
|
173
|
-
export const approvalDefinition = defineCustomObject({
|
|
174
|
-
name: 'pa_approval_step',
|
|
175
|
-
displayName: 'Approval step',
|
|
176
|
-
pluralLabel: 'Approval steps',
|
|
177
|
-
category: PROCUREMENT_CATEGORY,
|
|
178
|
-
description: 'Approval routing line tied to a purchase request',
|
|
179
|
-
sections: {
|
|
180
|
-
approval: section('Approval step', { sectionId: 'sec_pa_approval' }),
|
|
181
|
-
},
|
|
182
|
-
fields: {
|
|
183
|
-
purchase_request_ref: parentChild(requestDefinition, {
|
|
184
|
-
displayName: 'Purchase request',
|
|
185
|
-
description: 'Purchase request this approval belongs to',
|
|
186
|
-
relatedDataLabel: 'Approval steps',
|
|
187
|
-
parentChildType: 'PRIMARY',
|
|
188
|
-
enableParentOwnerInheritance: true,
|
|
189
|
-
section: 'approval',
|
|
190
|
-
}),
|
|
191
|
-
sequence: number({
|
|
192
|
-
displayName: 'Sequence',
|
|
193
|
-
description: 'Approval sequence number',
|
|
194
|
-
decimalPlaces: 0,
|
|
195
|
-
required: true,
|
|
196
|
-
section: 'approval',
|
|
197
|
-
}),
|
|
198
|
-
approval_role: radio({
|
|
199
|
-
displayName: 'Approval role',
|
|
200
|
-
description: 'Approval lane',
|
|
201
|
-
options: ['Budget owner', 'Finance', 'Security', 'Legal', 'Procurement'],
|
|
202
|
-
required: true,
|
|
203
|
-
section: 'approval',
|
|
204
|
-
}),
|
|
205
|
-
status: radio({
|
|
206
|
-
displayName: 'Status',
|
|
207
|
-
description: 'Approval step status',
|
|
208
|
-
options: ['Pending', 'Approved', 'Rejected', 'Skipped'],
|
|
209
|
-
required: true,
|
|
210
|
-
section: 'approval',
|
|
211
|
-
}),
|
|
212
|
-
},
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
/** Invoice schema tied to a parent contract. */
|
|
216
|
-
export const invoiceDefinition = defineCustomObject({
|
|
217
|
-
name: 'pa_invoice',
|
|
218
|
-
displayName: 'Invoice',
|
|
219
|
-
pluralLabel: 'Invoices',
|
|
220
|
-
category: PROCUREMENT_CATEGORY,
|
|
221
|
-
description: 'Invoice received against a vendor contract',
|
|
222
|
-
sections: {
|
|
223
|
-
invoice: section('Invoice', { sectionId: 'sec_pa_invoice' }),
|
|
224
|
-
},
|
|
225
|
-
fields: {
|
|
226
|
-
contract_ref: parentChild(contractDefinition, {
|
|
227
|
-
displayName: 'Contract',
|
|
228
|
-
description: 'Contract this invoice is billed against',
|
|
229
|
-
relatedDataLabel: 'Invoices',
|
|
230
|
-
parentChildType: 'PRIMARY',
|
|
231
|
-
enableParentOwnerInheritance: false,
|
|
232
|
-
section: 'invoice',
|
|
233
|
-
}),
|
|
234
|
-
invoice_number: text({
|
|
235
|
-
displayName: 'Invoice number',
|
|
236
|
-
description: 'Vendor invoice number',
|
|
237
|
-
maxLength: 120,
|
|
238
|
-
required: true,
|
|
239
|
-
section: 'invoice',
|
|
240
|
-
}),
|
|
241
|
-
amount_cents: number({
|
|
242
|
-
displayName: 'Amount (cents)',
|
|
243
|
-
description: 'Invoice amount in cents',
|
|
244
|
-
decimalPlaces: 0,
|
|
245
|
-
required: true,
|
|
246
|
-
section: 'invoice',
|
|
247
|
-
}),
|
|
248
|
-
status: radio({
|
|
249
|
-
displayName: 'Status',
|
|
250
|
-
description: 'Invoice processing status',
|
|
251
|
-
options: ['Received', 'Matched', 'Approved', 'Paid', 'Exception'],
|
|
252
|
-
required: true,
|
|
253
|
-
section: 'invoice',
|
|
254
|
-
}),
|
|
255
|
-
},
|
|
256
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed custom-object schema for the simple todo example.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
date,
|
|
7
|
-
defineCustomObject,
|
|
8
|
-
longText,
|
|
9
|
-
radio,
|
|
10
|
-
section,
|
|
11
|
-
select,
|
|
12
|
-
} from '@rippling/rippling-sdk/core/platform/custom-objects';
|
|
13
|
-
|
|
14
|
-
/** Logical category shared by the simple todo custom-object example. */
|
|
15
|
-
export const SIMPLE_TODO_CATEGORY = 'simple_todo';
|
|
16
|
-
|
|
17
|
-
/** Typed schema used by the simple todo manifest and action functions. */
|
|
18
|
-
export const todoDefinition = defineCustomObject({
|
|
19
|
-
name: 'simple_todo',
|
|
20
|
-
displayName: 'Todo',
|
|
21
|
-
pluralLabel: 'Todos',
|
|
22
|
-
category: SIMPLE_TODO_CATEGORY,
|
|
23
|
-
description: 'A single task with status, priority, due date, and notes.',
|
|
24
|
-
icon: { emoji: '✅' },
|
|
25
|
-
sections: {
|
|
26
|
-
details: section('Details', { sectionId: 'sec_todo_details' }),
|
|
27
|
-
},
|
|
28
|
-
fields: {
|
|
29
|
-
status: radio({
|
|
30
|
-
displayName: 'Status',
|
|
31
|
-
description: 'Status field',
|
|
32
|
-
options: ['To Do', 'In Progress', 'Done'],
|
|
33
|
-
required: true,
|
|
34
|
-
section: 'details',
|
|
35
|
-
}),
|
|
36
|
-
priority: radio({
|
|
37
|
-
displayName: 'Priority',
|
|
38
|
-
description: 'Priority field',
|
|
39
|
-
options: ['Low', 'Medium', 'High'],
|
|
40
|
-
section: 'details',
|
|
41
|
-
}),
|
|
42
|
-
labels: select({
|
|
43
|
-
displayName: 'Labels',
|
|
44
|
-
description: 'One or more labels for organizing the task',
|
|
45
|
-
options: ['Personal', 'Work', 'Urgent', 'Follow-up'],
|
|
46
|
-
section: 'details',
|
|
47
|
-
}),
|
|
48
|
-
due_date: date({
|
|
49
|
-
displayName: 'Due date',
|
|
50
|
-
description: 'Due date field',
|
|
51
|
-
section: 'details',
|
|
52
|
-
}),
|
|
53
|
-
notes: longText({
|
|
54
|
-
displayName: 'Notes',
|
|
55
|
-
description: 'Notes field',
|
|
56
|
-
maxLength: 4000,
|
|
57
|
-
section: 'details',
|
|
58
|
-
}),
|
|
59
|
-
},
|
|
60
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed custom-object schema for the custom SDUI todo example.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { boolean, defineCustomObject, section } from '@rippling/rippling-sdk/core/platform/custom-objects';
|
|
6
|
-
|
|
7
|
-
/** Logical category shared by the custom SDUI todo example. */
|
|
8
|
-
export const CUSTOM_TODO_CATEGORY = 'custom_todo_app';
|
|
9
|
-
|
|
10
|
-
/** Typed schema used by the custom SDUI todo manifest and function code. */
|
|
11
|
-
export const todoDefinition = defineCustomObject({
|
|
12
|
-
name: 'todo',
|
|
13
|
-
displayName: 'Todo',
|
|
14
|
-
pluralLabel: 'Todos',
|
|
15
|
-
category: CUSTOM_TODO_CATEGORY,
|
|
16
|
-
description: 'A todo item rendered by a custom SDUI page.',
|
|
17
|
-
icon: { emoji: '✅' },
|
|
18
|
-
sections: {
|
|
19
|
-
details: section('Details', { sectionId: 'sec_custom_todo_details' }),
|
|
20
|
-
},
|
|
21
|
-
fields: {
|
|
22
|
-
completed: boolean({
|
|
23
|
-
displayName: 'Completed',
|
|
24
|
-
description: 'Whether the todo item is complete',
|
|
25
|
-
section: 'details',
|
|
26
|
-
}),
|
|
27
|
-
},
|
|
28
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# `core/platform`
|
|
2
|
-
|
|
3
|
-
This directory holds public, higher-level platform abstractions that sit above the generated REST resources and above low-level manifest classes.
|
|
4
|
-
|
|
5
|
-
Use this layer for SDK capabilities that are:
|
|
6
|
-
|
|
7
|
-
- public and stable enough to be imported by SDK consumers
|
|
8
|
-
- opinionated or cross-cutting rather than raw transport wrappers
|
|
9
|
-
- centered on platform concepts such as custom objects, typed schemas, lifecycle helpers, record managers, or query helpers
|
|
10
|
-
|
|
11
|
-
In practice, the layering is:
|
|
12
|
-
|
|
13
|
-
- `src/resources/*` — generated REST resources and DTOs
|
|
14
|
-
- `src/lib/manifest/*` — low-level manifest authoring classes
|
|
15
|
-
- `src/core/platform/*` — higher-level typed/platform abstractions built on top of those surfaces
|
|
16
|
-
|
|
17
|
-
Current structure:
|
|
18
|
-
|
|
19
|
-
- `custom-objects/` — typed custom-object domain model, validation, provisioning, lifecycle, records, and RQL helpers
|
|
20
|
-
- `manifest/` — typed adapters that materialize platform-domain definitions into low-level manifest authoring surfaces
|
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
import type { RipplingSDK } from '../../../client';
|
|
2
|
-
import type {
|
|
3
|
-
ObjectCategory,
|
|
4
|
-
ObjectCategoryCreateParams,
|
|
5
|
-
ObjectCategoryUpdateParams,
|
|
6
|
-
} from '../../../resources/object-categories';
|
|
7
|
-
import type { CategoryApiName, LogicalCategoryName } from './types';
|
|
8
|
-
import { toCustomCategoryApiName } from './definition';
|
|
9
|
-
import { validateLogicalCategoryName } from './validation';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Author input accepted by {@link defineCustomObjectCategory}.
|
|
13
|
-
*
|
|
14
|
-
* @typeParam TName - Logical category name supplied by the caller.
|
|
15
|
-
*/
|
|
16
|
-
interface CustomObjectCategoryDefinitionInput<TName extends string> {
|
|
17
|
-
/** Logical unsuffixed snake_case category name. */
|
|
18
|
-
readonly name: LogicalCategoryName<TName>;
|
|
19
|
-
/** Human-readable display name applied after creation. */
|
|
20
|
-
readonly displayName: string;
|
|
21
|
-
/** Optional category description. */
|
|
22
|
-
readonly description?: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** Immutable typed category definition used by provisioning and lifecycle helpers. */
|
|
26
|
-
export interface CustomObjectCategoryDefinition<TName extends LogicalCategoryName = LogicalCategoryName> {
|
|
27
|
-
/** Logical unsuffixed snake_case category name. */
|
|
28
|
-
readonly name: TName;
|
|
29
|
-
/** Compiled wire-level category api name. */
|
|
30
|
-
readonly apiName: CategoryApiName<TName>;
|
|
31
|
-
/** Human-readable display name. */
|
|
32
|
-
readonly displayName: string;
|
|
33
|
-
/** Optional category description. */
|
|
34
|
-
readonly description?: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** Result returned by category provisioning helpers. */
|
|
38
|
-
export interface ProvisionedCustomObjectCategory<TName extends LogicalCategoryName = LogicalCategoryName> {
|
|
39
|
-
/** Source typed category definition. */
|
|
40
|
-
readonly definition: CustomObjectCategoryDefinition<TName>;
|
|
41
|
-
/** Response returned by `client.objectCategories.create(...)`. */
|
|
42
|
-
readonly createdCategory: ObjectCategory;
|
|
43
|
-
/** Response returned by `client.objectCategories.update(...)`. */
|
|
44
|
-
readonly updatedCategory: ObjectCategory;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** Lifecycle action emitted by category reconciliation helpers. */
|
|
48
|
-
export type CustomObjectCategoryLifecycleAction = 'created' | 'updated' | 'unchanged';
|
|
49
|
-
|
|
50
|
-
/** Result returned by category reconciliation helpers. */
|
|
51
|
-
export interface ReconciledCustomObjectCategory<TName extends LogicalCategoryName = LogicalCategoryName> {
|
|
52
|
-
/** Source typed category definition. */
|
|
53
|
-
readonly definition: CustomObjectCategoryDefinition<TName>;
|
|
54
|
-
/** Whether the remote category was created, updated, or already matched. */
|
|
55
|
-
readonly action: CustomObjectCategoryLifecycleAction;
|
|
56
|
-
/** Remote category after reconciliation. */
|
|
57
|
-
readonly category: ObjectCategory;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/** Options for category provisioning and reconciliation helpers. */
|
|
61
|
-
export interface CustomObjectCategoryMutationOptions {
|
|
62
|
-
/** Whether to apply the follow-up display-metadata update. Defaults to `true`. */
|
|
63
|
-
readonly updateDisplayMetadata?: boolean;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Creates an immutable typed custom-object category definition.
|
|
68
|
-
*
|
|
69
|
-
* @param definition - Logical category metadata to normalize and freeze.
|
|
70
|
-
* @returns Immutable typed category definition with compiled API name.
|
|
71
|
-
* @typeParam TName - Logical category name supplied by the caller.
|
|
72
|
-
*/
|
|
73
|
-
export function defineCustomObjectCategory<TName extends string>(
|
|
74
|
-
definition: CustomObjectCategoryDefinitionInput<TName>,
|
|
75
|
-
): Readonly<CustomObjectCategoryDefinition<LogicalCategoryName<TName>>> {
|
|
76
|
-
validateLogicalCategoryName(definition.name);
|
|
77
|
-
return Object.freeze({
|
|
78
|
-
name: definition.name,
|
|
79
|
-
apiName: toCustomCategoryApiName(definition.name),
|
|
80
|
-
displayName: definition.displayName,
|
|
81
|
-
...(definition.description != null ? { description: definition.description } : {}),
|
|
82
|
-
}) as Readonly<CustomObjectCategoryDefinition<LogicalCategoryName<TName>>>;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Builds the low-level create payload for an object category.
|
|
87
|
-
*
|
|
88
|
-
* @param definition - Typed category definition to compile.
|
|
89
|
-
* @returns REST create payload using the logical category name.
|
|
90
|
-
* @typeParam TName - Logical category name carried by the definition.
|
|
91
|
-
*/
|
|
92
|
-
export function buildObjectCategoryCreateParams<TName extends LogicalCategoryName>(
|
|
93
|
-
definition: CustomObjectCategoryDefinition<TName>,
|
|
94
|
-
): ObjectCategoryCreateParams {
|
|
95
|
-
return {
|
|
96
|
-
name: definition.name,
|
|
97
|
-
...(definition.description != null ? { description: definition.description } : {}),
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Builds the low-level update payload for an object category.
|
|
103
|
-
*
|
|
104
|
-
* @param definition - Typed category definition to compile.
|
|
105
|
-
* @returns REST update payload using human-facing display metadata.
|
|
106
|
-
* @typeParam TName - Logical category name carried by the definition.
|
|
107
|
-
*/
|
|
108
|
-
export function buildObjectCategoryUpdateParams<TName extends LogicalCategoryName>(
|
|
109
|
-
definition: CustomObjectCategoryDefinition<TName>,
|
|
110
|
-
): ObjectCategoryUpdateParams {
|
|
111
|
-
return {
|
|
112
|
-
name: definition.displayName,
|
|
113
|
-
...(definition.description != null ? { description: definition.description } : {}),
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Returns whether one public category DTO matches the typed category definition by currently visible names.
|
|
119
|
-
*
|
|
120
|
-
* @param category - Public category DTO returned by the REST API.
|
|
121
|
-
* @param definition - Typed category definition being matched.
|
|
122
|
-
* @returns Whether the visible name matches either the logical or display name.
|
|
123
|
-
* @typeParam TName - Logical category name carried by the definition.
|
|
124
|
-
*/
|
|
125
|
-
function isMatchingCategoryName<TName extends LogicalCategoryName>(
|
|
126
|
-
category: ObjectCategory,
|
|
127
|
-
definition: CustomObjectCategoryDefinition<TName>,
|
|
128
|
-
): boolean {
|
|
129
|
-
return category.name === definition.name || category.name === definition.displayName;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Lists all public category DTOs that ambiguously or exactly match one typed definition.
|
|
134
|
-
*
|
|
135
|
-
* @param client - SDK client used to enumerate categories.
|
|
136
|
-
* @param definition - Typed category definition being matched.
|
|
137
|
-
* @returns Frozen list of public categories whose visible names match.
|
|
138
|
-
* @typeParam TName - Logical category name carried by the definition.
|
|
139
|
-
*/
|
|
140
|
-
async function listMatchingCategories<TName extends LogicalCategoryName>(
|
|
141
|
-
client: RipplingSDK,
|
|
142
|
-
definition: CustomObjectCategoryDefinition<TName>,
|
|
143
|
-
): Promise<readonly ObjectCategory[]> {
|
|
144
|
-
const matches: ObjectCategory[] = [];
|
|
145
|
-
for await (const category of client.objectCategories.list()) {
|
|
146
|
-
if (isMatchingCategoryName(category, definition)) {
|
|
147
|
-
matches.push(category);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return Object.freeze(matches);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Returns the single public category matching one typed definition or throws when the match is ambiguous.
|
|
155
|
-
*
|
|
156
|
-
* @param client - SDK client used to enumerate categories.
|
|
157
|
-
* @param definition - Typed category definition being matched.
|
|
158
|
-
* @returns Matching public category, if any.
|
|
159
|
-
* @throws Error when multiple public categories match the visible names.
|
|
160
|
-
* @typeParam TName - Logical category name carried by the definition.
|
|
161
|
-
*/
|
|
162
|
-
async function getSingleMatchingCategory<TName extends LogicalCategoryName>(
|
|
163
|
-
client: RipplingSDK,
|
|
164
|
-
definition: CustomObjectCategoryDefinition<TName>,
|
|
165
|
-
): Promise<ObjectCategory | undefined> {
|
|
166
|
-
const matches = await listMatchingCategories(client, definition);
|
|
167
|
-
if (matches.length <= 1) return matches[0];
|
|
168
|
-
|
|
169
|
-
throw new Error(
|
|
170
|
-
`Ambiguous category match for "${definition.name}" / "${definition.displayName}". ` +
|
|
171
|
-
`Matched ids: ${matches.map((category) => category.id).join(', ')}.`,
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Creates one typed custom-object category through the REST SDK.
|
|
177
|
-
*
|
|
178
|
-
* @param client - SDK client used to call the category APIs.
|
|
179
|
-
* @param definition - Typed category definition to provision.
|
|
180
|
-
* @param options - Provisioning behavior flags for display-metadata updates.
|
|
181
|
-
* @returns Frozen summary of the created and updated backend category DTOs.
|
|
182
|
-
* @typeParam TName - Logical category name carried by the definition.
|
|
183
|
-
*/
|
|
184
|
-
export async function provisionCustomObjectCategoryDefinition<TName extends LogicalCategoryName>(
|
|
185
|
-
client: RipplingSDK,
|
|
186
|
-
definition: CustomObjectCategoryDefinition<TName>,
|
|
187
|
-
options: CustomObjectCategoryMutationOptions = {},
|
|
188
|
-
): Promise<ProvisionedCustomObjectCategory<TName>> {
|
|
189
|
-
const createdCategory = await client.objectCategories.create(buildObjectCategoryCreateParams(definition));
|
|
190
|
-
const updatedCategory =
|
|
191
|
-
options.updateDisplayMetadata ?? true ?
|
|
192
|
-
await client.objectCategories.update(createdCategory.id, buildObjectCategoryUpdateParams(definition))
|
|
193
|
-
: createdCategory;
|
|
194
|
-
|
|
195
|
-
return Object.freeze({ definition, createdCategory, updatedCategory });
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Creates multiple typed custom-object categories through the REST SDK.
|
|
200
|
-
*
|
|
201
|
-
* @param client - SDK client used to call the category APIs.
|
|
202
|
-
* @param definitions - Typed category definitions to provision.
|
|
203
|
-
* @param options - Provisioning behavior flags shared across the batch.
|
|
204
|
-
* @returns Frozen batch of provisioning results in input order.
|
|
205
|
-
*/
|
|
206
|
-
export async function provisionCustomObjectCategoryDefinitions(
|
|
207
|
-
client: RipplingSDK,
|
|
208
|
-
definitions: readonly CustomObjectCategoryDefinition[],
|
|
209
|
-
options: CustomObjectCategoryMutationOptions = {},
|
|
210
|
-
): Promise<readonly ProvisionedCustomObjectCategory[]> {
|
|
211
|
-
const results: ProvisionedCustomObjectCategory[] = [];
|
|
212
|
-
for (const definition of definitions) {
|
|
213
|
-
results.push(await provisionCustomObjectCategoryDefinition(client, definition, options));
|
|
214
|
-
}
|
|
215
|
-
return Object.freeze(results);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Reconciles one typed category definition against the backend by name.
|
|
220
|
-
*
|
|
221
|
-
* @param client - SDK client used to call the category APIs.
|
|
222
|
-
* @param definition - Typed category definition to reconcile.
|
|
223
|
-
* @param options - Reconciliation behavior flags for display-metadata updates.
|
|
224
|
-
* @returns Frozen reconciliation result describing the final backend category state.
|
|
225
|
-
* @typeParam TName - Logical category name carried by the definition.
|
|
226
|
-
*/
|
|
227
|
-
export async function reconcileCustomObjectCategoryDefinition<TName extends LogicalCategoryName>(
|
|
228
|
-
client: RipplingSDK,
|
|
229
|
-
definition: CustomObjectCategoryDefinition<TName>,
|
|
230
|
-
options: CustomObjectCategoryMutationOptions = {},
|
|
231
|
-
): Promise<ReconciledCustomObjectCategory<TName>> {
|
|
232
|
-
const existing = await getSingleMatchingCategory(client, definition);
|
|
233
|
-
if (existing == null) {
|
|
234
|
-
const provisioned = await provisionCustomObjectCategoryDefinition(client, definition, options);
|
|
235
|
-
return Object.freeze({
|
|
236
|
-
definition,
|
|
237
|
-
action: 'created' as const,
|
|
238
|
-
category: provisioned.updatedCategory,
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
const shouldUpdate =
|
|
243
|
-
(options.updateDisplayMetadata ?? true) &&
|
|
244
|
-
(existing.name !== definition.displayName ||
|
|
245
|
-
(existing.description ?? '') !== (definition.description ?? ''));
|
|
246
|
-
|
|
247
|
-
if (!shouldUpdate) {
|
|
248
|
-
return Object.freeze({ definition, action: 'unchanged', category: existing });
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
const updated = await client.objectCategories.update(
|
|
252
|
-
existing.id,
|
|
253
|
-
buildObjectCategoryUpdateParams(definition),
|
|
254
|
-
);
|
|
255
|
-
return Object.freeze({ definition, action: 'updated', category: updated });
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Reconciles multiple typed category definitions against the backend by name.
|
|
260
|
-
*
|
|
261
|
-
* @param client - SDK client used to call the category APIs.
|
|
262
|
-
* @param definitions - Typed category definitions to reconcile.
|
|
263
|
-
* @param options - Reconciliation behavior flags shared across the batch.
|
|
264
|
-
* @returns Frozen batch of reconciliation results in input order.
|
|
265
|
-
*/
|
|
266
|
-
export async function reconcileCustomObjectCategoryDefinitions(
|
|
267
|
-
client: RipplingSDK,
|
|
268
|
-
definitions: readonly CustomObjectCategoryDefinition[],
|
|
269
|
-
options: CustomObjectCategoryMutationOptions = {},
|
|
270
|
-
): Promise<readonly ReconciledCustomObjectCategory[]> {
|
|
271
|
-
const results: ReconciledCustomObjectCategory[] = [];
|
|
272
|
-
for (const definition of definitions) {
|
|
273
|
-
results.push(await reconcileCustomObjectCategoryDefinition(client, definition, options));
|
|
274
|
-
}
|
|
275
|
-
return Object.freeze(results);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Deletes a category that matches the typed definition's logical or display name.
|
|
280
|
-
*
|
|
281
|
-
* @param client - SDK client used to call the category APIs.
|
|
282
|
-
* @param definition - Typed category definition used to find the category to delete.
|
|
283
|
-
* @returns Whether a matching category existed and was deleted.
|
|
284
|
-
* @typeParam TName - Logical category name carried by the definition.
|
|
285
|
-
*/
|
|
286
|
-
export async function deleteCustomObjectCategoryDefinition<TName extends LogicalCategoryName>(
|
|
287
|
-
client: RipplingSDK,
|
|
288
|
-
definition: CustomObjectCategoryDefinition<TName>,
|
|
289
|
-
): Promise<boolean> {
|
|
290
|
-
const existing = await getSingleMatchingCategory(client, definition);
|
|
291
|
-
if (existing == null) return false;
|
|
292
|
-
await client.objectCategories.delete(existing.id);
|
|
293
|
-
return true;
|
|
294
|
-
}
|