@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,375 +0,0 @@
|
|
|
1
|
-
import type { AnyCustomObjectDefinition, FieldNames, FieldValue, LookupReference } from './types';
|
|
2
|
-
|
|
3
|
-
const STANDARD_RQL_FIELD_NAMES = [
|
|
4
|
-
'id',
|
|
5
|
-
'name',
|
|
6
|
-
'created_at',
|
|
7
|
-
'updated_at',
|
|
8
|
-
'system_updated_at',
|
|
9
|
-
'external_id',
|
|
10
|
-
'owner_role',
|
|
11
|
-
'created_by',
|
|
12
|
-
'last_modified_by',
|
|
13
|
-
] as const;
|
|
14
|
-
|
|
15
|
-
type StandardRqlFieldValueByName = {
|
|
16
|
-
id: string;
|
|
17
|
-
name: string;
|
|
18
|
-
created_at: string | null;
|
|
19
|
-
updated_at: string | null;
|
|
20
|
-
system_updated_at: string | null;
|
|
21
|
-
external_id: string | null;
|
|
22
|
-
owner_role: LookupReference<'Employee'> | null;
|
|
23
|
-
created_by: LookupReference<'Employee'> | null;
|
|
24
|
-
last_modified_by: LookupReference<'Employee'> | null;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Standard field-name strings exposed by the typed RQL helper.
|
|
29
|
-
*
|
|
30
|
-
* @typeParam TDefinition - Object definition whose standard fields should be exposed.
|
|
31
|
-
*/
|
|
32
|
-
export type StandardRqlFieldName<TDefinition extends AnyCustomObjectDefinition> =
|
|
33
|
-
(typeof STANDARD_RQL_FIELD_NAMES)[number];
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Field-name strings accepted by the typed RQL helper.
|
|
37
|
-
*
|
|
38
|
-
* @typeParam TDefinition - Object definition whose field-name union should be exposed.
|
|
39
|
-
*/
|
|
40
|
-
export type RqlFieldName<TDefinition extends AnyCustomObjectDefinition> =
|
|
41
|
-
| StandardRqlFieldName<TDefinition>
|
|
42
|
-
| FieldNames<TDefinition>;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Field token used by the RQL helper to preserve type information across string compilation.
|
|
46
|
-
*
|
|
47
|
-
* @typeParam TValue - Runtime value type stored in the field.
|
|
48
|
-
* @typeParam TApiName - Wire-level field api name used when rendering RQL.
|
|
49
|
-
*/
|
|
50
|
-
export interface RqlFieldToken<TValue = unknown, TApiName extends string = string> {
|
|
51
|
-
readonly kind: 'rql-field-token';
|
|
52
|
-
readonly apiName: TApiName;
|
|
53
|
-
readonly logicalName: string;
|
|
54
|
-
readonly __valueType__?: TValue;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Opaque RQL fragment that can be interpolated into {@link CustomObjectRqlHelpers.rql}.
|
|
59
|
-
*/
|
|
60
|
-
export interface RqlFragment {
|
|
61
|
-
readonly kind: 'rql-fragment';
|
|
62
|
-
readonly text: string;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Scope object whose properties autocomplete to the standard and custom fields available on one object definition.
|
|
67
|
-
*
|
|
68
|
-
* @typeParam TDefinition - Object definition whose field tokens should be exposed.
|
|
69
|
-
*/
|
|
70
|
-
export type RqlFieldScope<TDefinition extends AnyCustomObjectDefinition> = {
|
|
71
|
-
readonly [K in StandardRqlFieldName<TDefinition>]: RqlFieldToken<StandardRqlFieldValueByName[K], K>;
|
|
72
|
-
} & {
|
|
73
|
-
readonly [K in FieldNames<TDefinition>]: RqlFieldToken<
|
|
74
|
-
FieldValue<TDefinition['fields'][K]>,
|
|
75
|
-
TDefinition['fields'][K] extends { apiName: infer TApiName extends string } ? TApiName : string
|
|
76
|
-
>;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Input that the RQL helper knows how to encode as a literal value.
|
|
81
|
-
*/
|
|
82
|
-
export type RqlValue = string | number | boolean | null | LookupReference<string> | readonly RqlValue[];
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Runtime surface returned by {@link createRqlHelpers}.
|
|
86
|
-
*
|
|
87
|
-
* @typeParam TDefinition - Object definition whose field tokens should be exposed.
|
|
88
|
-
*/
|
|
89
|
-
export interface CustomObjectRqlHelpers<TDefinition extends AnyCustomObjectDefinition> {
|
|
90
|
-
/** Object-scoped field tokens used for IntelliSense-friendly property access. */
|
|
91
|
-
readonly fields: RqlFieldScope<TDefinition>;
|
|
92
|
-
/** Converts a field-name string into a typed field token. */
|
|
93
|
-
field<TFieldName extends RqlFieldName<TDefinition>>(
|
|
94
|
-
fieldName: TFieldName,
|
|
95
|
-
): RqlFieldScope<TDefinition>[TFieldName];
|
|
96
|
-
/** Renders a tagged template into a backend-ready RQL string. */
|
|
97
|
-
rql(strings: TemplateStringsArray, ...values: readonly RqlInterpolation[]): string;
|
|
98
|
-
/** Renders a fragment built by helper functions into a string. */
|
|
99
|
-
render(fragment: RqlFragment): string;
|
|
100
|
-
/** Wraps a raw RQL snippet as a fragment. Use sparingly. */
|
|
101
|
-
raw(text: string): RqlFragment;
|
|
102
|
-
/** Builds an equality comparison fragment. */
|
|
103
|
-
eq<TValue>(field: RqlFieldToken<TValue>, value: RqlComparableValue<TValue> | null): RqlFragment;
|
|
104
|
-
/** Builds an inequality comparison fragment. */
|
|
105
|
-
ne<TValue>(field: RqlFieldToken<TValue>, value: RqlComparableValue<TValue> | null): RqlFragment;
|
|
106
|
-
/** Builds a less-than comparison fragment. */
|
|
107
|
-
lt<TValue extends string | number>(field: RqlFieldToken<TValue>, value: TValue): RqlFragment;
|
|
108
|
-
/** Builds a less-than-or-equal comparison fragment. */
|
|
109
|
-
lte<TValue extends string | number>(field: RqlFieldToken<TValue>, value: TValue): RqlFragment;
|
|
110
|
-
/** Builds a greater-than comparison fragment. */
|
|
111
|
-
gt<TValue extends string | number>(field: RqlFieldToken<TValue>, value: TValue): RqlFragment;
|
|
112
|
-
/** Builds a greater-than-or-equal comparison fragment. */
|
|
113
|
-
gte<TValue extends string | number>(field: RqlFieldToken<TValue>, value: TValue): RqlFragment;
|
|
114
|
-
/** Builds an `IN` comparison fragment. */
|
|
115
|
-
in<TValue>(field: RqlFieldToken<TValue>, values: readonly RqlComparableValue<TValue>[]): RqlFragment;
|
|
116
|
-
/** Builds a `NOT_IN` comparison fragment. */
|
|
117
|
-
notIn<TValue>(field: RqlFieldToken<TValue>, values: readonly RqlComparableValue<TValue>[]): RqlFragment;
|
|
118
|
-
/** Builds an `IS NULL`-style equality fragment. */
|
|
119
|
-
isNull<TValue>(field: RqlFieldToken<TValue>): RqlFragment;
|
|
120
|
-
/** Builds an `IS NOT NULL`-style inequality fragment. */
|
|
121
|
-
isNotNull<TValue>(field: RqlFieldToken<TValue>): RqlFragment;
|
|
122
|
-
/** Builds a parenthesized `AND` fragment. */
|
|
123
|
-
and(...fragments: readonly RqlFragment[]): RqlFragment;
|
|
124
|
-
/** Builds a parenthesized `OR` fragment. */
|
|
125
|
-
or(...fragments: readonly RqlFragment[]): RqlFragment;
|
|
126
|
-
/** Builds a parenthesized `NOT` fragment. */
|
|
127
|
-
not(fragment: RqlFragment): RqlFragment;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/** Allowed comparison inputs for one field token. */
|
|
131
|
-
export type RqlComparableValue<TValue> = TValue extends LookupReference<string> ? TValue | string : TValue;
|
|
132
|
-
|
|
133
|
-
/** Interpolation values accepted by the tagged-template compiler. */
|
|
134
|
-
export type RqlInterpolation = RqlFieldToken | RqlFragment | RqlValue;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Builds one immutable field token used by the typed RQL helper surface.
|
|
138
|
-
*
|
|
139
|
-
* @param logicalName - Author-facing logical field name.
|
|
140
|
-
* @param apiName - Wire-level field API name used in rendered RQL.
|
|
141
|
-
* @returns Immutable field token carrying value and API-name type information.
|
|
142
|
-
* @typeParam TValue - Runtime value type represented by the field.
|
|
143
|
-
* @typeParam TApiName - Wire-level field API name.
|
|
144
|
-
*/
|
|
145
|
-
function createFieldToken<TValue, TApiName extends string>(
|
|
146
|
-
logicalName: string,
|
|
147
|
-
apiName: TApiName,
|
|
148
|
-
): RqlFieldToken<TValue, TApiName> {
|
|
149
|
-
return Object.freeze({ kind: 'rql-field-token', logicalName, apiName });
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Wraps raw RQL text as an opaque fragment object.
|
|
154
|
-
*
|
|
155
|
-
* @param text - Backend-ready RQL snippet.
|
|
156
|
-
* @returns Immutable fragment wrapper.
|
|
157
|
-
*/
|
|
158
|
-
function createFragment(text: string): RqlFragment {
|
|
159
|
-
return Object.freeze({ kind: 'rql-fragment', text });
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Returns whether one interpolation value looks like a lookup reference object.
|
|
164
|
-
*
|
|
165
|
-
* @param value - Candidate interpolation value.
|
|
166
|
-
* @returns Whether the value is a lookup reference accepted by the helper.
|
|
167
|
-
*/
|
|
168
|
-
function isLookupReference(value: unknown): value is LookupReference<string> {
|
|
169
|
-
return (
|
|
170
|
-
value != null &&
|
|
171
|
-
typeof value === 'object' &&
|
|
172
|
-
!Array.isArray(value) &&
|
|
173
|
-
typeof (value as { id?: unknown }).id === 'string'
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Returns whether one interpolation value is a typed field token.
|
|
179
|
-
*
|
|
180
|
-
* @param value - Candidate interpolation value.
|
|
181
|
-
* @returns Whether the value is a field token produced by {@link createRqlHelpers}.
|
|
182
|
-
*/
|
|
183
|
-
function isFieldToken(value: unknown): value is RqlFieldToken {
|
|
184
|
-
return (
|
|
185
|
-
value != null &&
|
|
186
|
-
typeof value === 'object' &&
|
|
187
|
-
(value as { kind?: unknown }).kind === 'rql-field-token' &&
|
|
188
|
-
typeof (value as { apiName?: unknown }).apiName === 'string'
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Returns whether one interpolation value is an opaque RQL fragment.
|
|
194
|
-
*
|
|
195
|
-
* @param value - Candidate interpolation value.
|
|
196
|
-
* @returns Whether the value is an RQL fragment wrapper.
|
|
197
|
-
*/
|
|
198
|
-
function isFragment(value: unknown): value is RqlFragment {
|
|
199
|
-
return (
|
|
200
|
-
value != null &&
|
|
201
|
-
typeof value === 'object' &&
|
|
202
|
-
(value as { kind?: unknown }).kind === 'rql-fragment' &&
|
|
203
|
-
typeof (value as { text?: unknown }).text === 'string'
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Escapes one string literal into backend-ready single-quoted RQL syntax.
|
|
209
|
-
*
|
|
210
|
-
* @param value - Raw string value to encode.
|
|
211
|
-
* @returns Escaped RQL string literal.
|
|
212
|
-
*/
|
|
213
|
-
function encodeString(value: string): string {
|
|
214
|
-
return `'${value.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Encodes one supported interpolation value into backend-ready RQL text.
|
|
219
|
-
*
|
|
220
|
-
* @param value - Interpolation value to encode.
|
|
221
|
-
* @returns Backend-ready RQL text for the supplied value.
|
|
222
|
-
* @throws Error when the value cannot be encoded as a supported RQL literal.
|
|
223
|
-
*/
|
|
224
|
-
function encodeRqlValue(value: RqlInterpolation): string {
|
|
225
|
-
if (isFieldToken(value)) return value.apiName;
|
|
226
|
-
if (isFragment(value)) return value.text;
|
|
227
|
-
if (value === null) return 'null';
|
|
228
|
-
if (typeof value === 'string') return encodeString(value);
|
|
229
|
-
if (typeof value === 'number') {
|
|
230
|
-
if (!Number.isFinite(value)) {
|
|
231
|
-
throw new Error(`RQL numeric literals must be finite. Received ${String(value)}.`);
|
|
232
|
-
}
|
|
233
|
-
return String(value);
|
|
234
|
-
}
|
|
235
|
-
if (typeof value === 'boolean') return value ? 'True' : 'False';
|
|
236
|
-
if (Array.isArray(value)) return `[${value.map((entry) => encodeRqlValue(entry)).join(', ')}]`;
|
|
237
|
-
if (isLookupReference(value)) return encodeString(value.id);
|
|
238
|
-
throw new Error(`Unsupported RQL interpolation value: ${String(value)}.`);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Renders the `rql` tagged-template inputs into one backend-ready RQL string.
|
|
243
|
-
*
|
|
244
|
-
* @param strings - Static template-string segments.
|
|
245
|
-
* @param values - Dynamic interpolation values to encode and insert.
|
|
246
|
-
* @returns Backend-ready RQL string.
|
|
247
|
-
*/
|
|
248
|
-
function renderTemplate(strings: TemplateStringsArray, values: readonly RqlInterpolation[]): string {
|
|
249
|
-
let rendered = strings[0] ?? '';
|
|
250
|
-
for (let index = 0; index < values.length; index += 1) {
|
|
251
|
-
rendered += encodeRqlValue(values[index] as RqlInterpolation);
|
|
252
|
-
rendered += strings[index + 1] ?? '';
|
|
253
|
-
}
|
|
254
|
-
return rendered;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Joins one or more fragments under a logical operator and wraps the result in parentheses.
|
|
259
|
-
*
|
|
260
|
-
* @param operator - Logical operator to place between fragments.
|
|
261
|
-
* @param fragments - Fragments to join.
|
|
262
|
-
* @returns Parenthesized logical fragment.
|
|
263
|
-
* @throws Error when no fragments are supplied.
|
|
264
|
-
*/
|
|
265
|
-
function joinFragments(operator: 'AND' | 'OR', fragments: readonly RqlFragment[]): RqlFragment {
|
|
266
|
-
if (fragments.length === 0) {
|
|
267
|
-
throw new Error(`RQL ${operator} requires at least one fragment.`);
|
|
268
|
-
}
|
|
269
|
-
return createFragment(`(${fragments.map((fragment) => fragment.text).join(` ${operator} `)})`);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Creates a typed RQL helper surface for one custom-object definition.
|
|
274
|
-
*
|
|
275
|
-
* The helper keeps authoring close to raw RQL by combining a tagged-template
|
|
276
|
-
* compiler with IntelliSense-friendly field tokens. Callers write normal RQL in
|
|
277
|
-
* string segments and interpolate typed field references or JavaScript literal
|
|
278
|
-
* values where they want compiler assistance.
|
|
279
|
-
*
|
|
280
|
-
* @param definition - Typed object definition whose field tokens should be exposed.
|
|
281
|
-
* @returns Typed RQL helper surface bound to the supplied object definition.
|
|
282
|
-
* @typeParam TDefinition - Object definition whose field tokens should be exposed.
|
|
283
|
-
*/
|
|
284
|
-
export function createRqlHelpers<TDefinition extends AnyCustomObjectDefinition>(
|
|
285
|
-
definition: TDefinition,
|
|
286
|
-
): CustomObjectRqlHelpers<TDefinition> {
|
|
287
|
-
const tokens: Record<string, RqlFieldToken> = {};
|
|
288
|
-
|
|
289
|
-
for (const fieldName of STANDARD_RQL_FIELD_NAMES) {
|
|
290
|
-
tokens[fieldName] = createFieldToken(fieldName, fieldName);
|
|
291
|
-
}
|
|
292
|
-
for (const [fieldName, field] of Object.entries(definition.fields)) {
|
|
293
|
-
if (tokens[fieldName] != null) {
|
|
294
|
-
throw new Error(
|
|
295
|
-
`Custom field name "${fieldName}" on "${definition.apiName}" conflicts with a standard RQL field token.`,
|
|
296
|
-
);
|
|
297
|
-
}
|
|
298
|
-
tokens[fieldName] = createFieldToken(fieldName, field.apiName);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
const fields = Object.freeze(tokens) as RqlFieldScope<TDefinition>;
|
|
302
|
-
const field = <TFieldName extends RqlFieldName<TDefinition>>(
|
|
303
|
-
fieldName: TFieldName,
|
|
304
|
-
): RqlFieldScope<TDefinition>[TFieldName] => {
|
|
305
|
-
const resolved = fields[fieldName];
|
|
306
|
-
if (resolved == null) {
|
|
307
|
-
throw new Error(
|
|
308
|
-
`Unknown RQL field "${String(fieldName)}" for "${definition.apiName}". ` +
|
|
309
|
-
`Valid fields: ${Object.keys(fields).sort().join(', ')}.`,
|
|
310
|
-
);
|
|
311
|
-
}
|
|
312
|
-
return resolved;
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
return Object.freeze({
|
|
316
|
-
fields,
|
|
317
|
-
field,
|
|
318
|
-
rql(strings: TemplateStringsArray, ...values: readonly RqlInterpolation[]): string {
|
|
319
|
-
return renderTemplate(strings, values);
|
|
320
|
-
},
|
|
321
|
-
render(fragment: RqlFragment): string {
|
|
322
|
-
return fragment.text;
|
|
323
|
-
},
|
|
324
|
-
raw(text: string): RqlFragment {
|
|
325
|
-
return createFragment(text);
|
|
326
|
-
},
|
|
327
|
-
eq<TValue>(currentField: RqlFieldToken<TValue>, value: RqlComparableValue<TValue> | null): RqlFragment {
|
|
328
|
-
return createFragment(`(${currentField.apiName} == ${encodeRqlValue(value as RqlInterpolation)})`);
|
|
329
|
-
},
|
|
330
|
-
ne<TValue>(currentField: RqlFieldToken<TValue>, value: RqlComparableValue<TValue> | null): RqlFragment {
|
|
331
|
-
return createFragment(`(${currentField.apiName} != ${encodeRqlValue(value as RqlInterpolation)})`);
|
|
332
|
-
},
|
|
333
|
-
lt<TValue extends string | number>(currentField: RqlFieldToken<TValue>, value: TValue): RqlFragment {
|
|
334
|
-
return createFragment(`(${currentField.apiName} < ${encodeRqlValue(value)})`);
|
|
335
|
-
},
|
|
336
|
-
lte<TValue extends string | number>(currentField: RqlFieldToken<TValue>, value: TValue): RqlFragment {
|
|
337
|
-
return createFragment(`(${currentField.apiName} <= ${encodeRqlValue(value)})`);
|
|
338
|
-
},
|
|
339
|
-
gt<TValue extends string | number>(currentField: RqlFieldToken<TValue>, value: TValue): RqlFragment {
|
|
340
|
-
return createFragment(`(${currentField.apiName} > ${encodeRqlValue(value)})`);
|
|
341
|
-
},
|
|
342
|
-
gte<TValue extends string | number>(currentField: RqlFieldToken<TValue>, value: TValue): RqlFragment {
|
|
343
|
-
return createFragment(`(${currentField.apiName} >= ${encodeRqlValue(value)})`);
|
|
344
|
-
},
|
|
345
|
-
in<TValue>(
|
|
346
|
-
currentField: RqlFieldToken<TValue>,
|
|
347
|
-
values: readonly RqlComparableValue<TValue>[],
|
|
348
|
-
): RqlFragment {
|
|
349
|
-
return createFragment(`(${currentField.apiName} IN ${encodeRqlValue(values as readonly RqlValue[])})`);
|
|
350
|
-
},
|
|
351
|
-
notIn<TValue>(
|
|
352
|
-
currentField: RqlFieldToken<TValue>,
|
|
353
|
-
values: readonly RqlComparableValue<TValue>[],
|
|
354
|
-
): RqlFragment {
|
|
355
|
-
return createFragment(
|
|
356
|
-
`(${currentField.apiName} NOT_IN ${encodeRqlValue(values as readonly RqlValue[])})`,
|
|
357
|
-
);
|
|
358
|
-
},
|
|
359
|
-
isNull<TValue>(currentField: RqlFieldToken<TValue>): RqlFragment {
|
|
360
|
-
return createFragment(`(${currentField.apiName} == null)`);
|
|
361
|
-
},
|
|
362
|
-
isNotNull<TValue>(currentField: RqlFieldToken<TValue>): RqlFragment {
|
|
363
|
-
return createFragment(`(${currentField.apiName} != null)`);
|
|
364
|
-
},
|
|
365
|
-
and(...fragments: readonly RqlFragment[]): RqlFragment {
|
|
366
|
-
return joinFragments('AND', fragments);
|
|
367
|
-
},
|
|
368
|
-
or(...fragments: readonly RqlFragment[]): RqlFragment {
|
|
369
|
-
return joinFragments('OR', fragments);
|
|
370
|
-
},
|
|
371
|
-
not(fragment: RqlFragment): RqlFragment {
|
|
372
|
-
return createFragment(`(NOT ${fragment.text})`);
|
|
373
|
-
},
|
|
374
|
-
});
|
|
375
|
-
}
|