@osdk/maker 0.11.0-rc.15 → 0.12.0-beta.10
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/CHANGELOG.md +158 -3
- package/README.md +117 -164
- package/build/browser/api/defineAction.js +185 -92
- package/build/browser/api/defineAction.js.map +1 -1
- package/build/browser/api/defineLink.js +3 -3
- package/build/browser/api/defineLink.js.map +1 -1
- package/build/browser/api/defineObject.js +30 -8
- package/build/browser/api/defineObject.js.map +1 -1
- package/build/browser/api/defineOntology.js +64 -30
- package/build/browser/api/defineOntology.js.map +1 -1
- package/build/browser/api/markingconstraint.test.js +108 -0
- package/build/browser/api/markingconstraint.test.js.map +1 -0
- package/build/browser/api/objectStatus.test.js +32 -32
- package/build/browser/api/objectStatus.test.js.map +1 -1
- package/build/browser/api/ontologyUtils.js +163 -0
- package/build/browser/api/ontologyUtils.js.map +1 -0
- package/build/browser/api/overall.test.js +3427 -869
- package/build/browser/api/overall.test.js.map +1 -1
- package/build/browser/api/types.js +2 -0
- package/build/browser/api/types.js.map +1 -1
- package/build/browser/cli/main.js +2 -2
- package/build/browser/cli/main.js.map +1 -1
- package/build/browser/index.js.map +1 -1
- package/build/cjs/index.cjs +452 -167
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +76 -16
- package/build/esm/api/defineAction.js +185 -92
- package/build/esm/api/defineAction.js.map +1 -1
- package/build/esm/api/defineLink.js +3 -3
- package/build/esm/api/defineLink.js.map +1 -1
- package/build/esm/api/defineObject.js +30 -8
- package/build/esm/api/defineObject.js.map +1 -1
- package/build/esm/api/defineOntology.js +64 -30
- package/build/esm/api/defineOntology.js.map +1 -1
- package/build/esm/api/markingconstraint.test.js +108 -0
- package/build/esm/api/markingconstraint.test.js.map +1 -0
- package/build/esm/api/objectStatus.test.js +32 -32
- package/build/esm/api/objectStatus.test.js.map +1 -1
- package/build/esm/api/ontologyUtils.js +163 -0
- package/build/esm/api/ontologyUtils.js.map +1 -0
- package/build/esm/api/overall.test.js +3427 -869
- package/build/esm/api/overall.test.js.map +1 -1
- package/build/esm/api/types.js +2 -0
- package/build/esm/api/types.js.map +1 -1
- package/build/esm/cli/main.js +2 -2
- package/build/esm/cli/main.js.map +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/types/api/defineAction.d.ts +6 -6
- package/build/types/api/defineAction.d.ts.map +1 -1
- package/build/types/api/defineObject.d.ts +3 -3
- package/build/types/api/defineObject.d.ts.map +1 -1
- package/build/types/api/defineOntology.d.ts.map +1 -1
- package/build/types/api/markingconstraint.test.d.ts +1 -0
- package/build/types/api/markingconstraint.test.d.ts.map +1 -0
- package/build/types/api/ontologyUtils.d.ts +5 -0
- package/build/types/api/ontologyUtils.d.ts.map +1 -0
- package/build/types/api/types.d.ts +70 -10
- package/build/types/api/types.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,91 @@
|
|
|
1
1
|
# @osdk/maker
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 0.12.0-beta.10
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 4dffba1: Support extended string params in actions
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [9f4fe9e]
|
|
12
|
+
- @osdk/api@2.4.0-beta.8
|
|
13
|
+
|
|
14
|
+
## 0.12.0-beta.9
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- ac0029e: Improve CRUD actions customization
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- @osdk/api@2.4.0-beta.7
|
|
23
|
+
|
|
24
|
+
## 0.12.0-beta.8
|
|
25
|
+
|
|
26
|
+
### Minor Changes
|
|
27
|
+
|
|
28
|
+
- 764e5f1: Add marking constraints
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- @osdk/api@2.4.0-beta.6
|
|
33
|
+
|
|
34
|
+
## 0.12.0-beta.7
|
|
35
|
+
|
|
36
|
+
### Minor Changes
|
|
37
|
+
|
|
38
|
+
- 75fbd09: Type classes and list validation for object actions
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- @osdk/api@2.4.0-beta.5
|
|
43
|
+
|
|
44
|
+
## 0.12.0-beta.6
|
|
45
|
+
|
|
46
|
+
### Minor Changes
|
|
47
|
+
|
|
48
|
+
- 3dcd9b1: Modify object actions cannot modify pk
|
|
49
|
+
|
|
50
|
+
## 0.12.0-beta.5
|
|
51
|
+
|
|
52
|
+
### Minor Changes
|
|
53
|
+
|
|
54
|
+
- a01b8d4: Revert import block data changes
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- @osdk/api@2.4.0-beta.4
|
|
59
|
+
|
|
60
|
+
## 0.12.0-beta.4
|
|
61
|
+
|
|
62
|
+
### Minor Changes
|
|
63
|
+
|
|
64
|
+
- e647175: Skip struct props for object create + modify actions
|
|
65
|
+
|
|
66
|
+
## 0.12.0-beta.3
|
|
67
|
+
|
|
68
|
+
### Minor Changes
|
|
69
|
+
|
|
70
|
+
- 988bf66: Use block data type for imports
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- @osdk/api@2.4.0-beta.3
|
|
75
|
+
|
|
76
|
+
## 0.12.0-beta.2
|
|
77
|
+
|
|
78
|
+
### Minor Changes
|
|
79
|
+
|
|
80
|
+
- 8bb08eb: Turn on module cache
|
|
81
|
+
- 5994895: Interface struct properties are skipped in crud actions
|
|
4
82
|
|
|
5
83
|
### Patch Changes
|
|
6
84
|
|
|
7
|
-
- Updated dependencies [
|
|
8
|
-
|
|
85
|
+
- Updated dependencies [29d2ada]
|
|
86
|
+
- Updated dependencies [8c95154]
|
|
87
|
+
- Updated dependencies [c32dcf2]
|
|
88
|
+
- @osdk/api@2.4.0-beta.2
|
|
9
89
|
|
|
10
90
|
## 0.11.0-beta.14
|
|
11
91
|
|
|
@@ -138,6 +218,81 @@
|
|
|
138
218
|
|
|
139
219
|
- @osdk/api@2.3.0-beta.2
|
|
140
220
|
|
|
221
|
+
## 0.10.0
|
|
222
|
+
|
|
223
|
+
### Patch Changes
|
|
224
|
+
|
|
225
|
+
- 322c5bc: Simulated release
|
|
226
|
+
- 6eeb423: Simple create and modify actions for interfaces
|
|
227
|
+
- 4a02a1f: Make string more configurable
|
|
228
|
+
- 38ad25b: Make properties nullable
|
|
229
|
+
- 489ea17: Wire through nullability to SPT
|
|
230
|
+
- 1a09a8e: Enforce that struct, mediaReference, and GTSR type SPTs cannot have render hints
|
|
231
|
+
- 12843cb: Add ability to load all underlying properties of an interface.
|
|
232
|
+
- a08bdfb: Support stream datasources in OAC
|
|
233
|
+
- 0a41cec: Support optional interface properties
|
|
234
|
+
- 18ba34f: Adds the ability to generate and execute functions at pinned versions
|
|
235
|
+
- 21e33a5: Upgrade consola to 3.4.0
|
|
236
|
+
- 63b2e63: Update Platform SDK Dependencies
|
|
237
|
+
- 75f6b51: Propagate required/optional fields from interfaces to actions
|
|
238
|
+
- 7416ce4: Update Platform SDK Dependencies
|
|
239
|
+
- 10da391: Links as Code
|
|
240
|
+
- c0aa106: Add visibility field to shared property type in maker
|
|
241
|
+
- 7bb2971: OAC support for actions on objects
|
|
242
|
+
- f1b1188: OAC Imports v0
|
|
243
|
+
- cff551a: Update OAC codegen
|
|
244
|
+
- 5745d3e: Make Object PKs singular
|
|
245
|
+
- ca5d920: Fix marking/list validation
|
|
246
|
+
- e287c5b: Support marking types in SPTs in Interfaces in Actions
|
|
247
|
+
- 5e8e839: Bump OMS API to include links in ontology IR
|
|
248
|
+
- 24c4b12: Add geotime and mediaset datasources to OAC
|
|
249
|
+
- 889e84b: Release
|
|
250
|
+
- 395ae07: Actions as code
|
|
251
|
+
- 94663ab: Change the status definitions for objects and add validation for timestamps.
|
|
252
|
+
- 791e655: Add support for geoshape and geohash action parameters.
|
|
253
|
+
- f12caa4: Fix marking list for modify action
|
|
254
|
+
- 317b555: Release
|
|
255
|
+
- c7f7a99: Export defineOntology method
|
|
256
|
+
- 8f67e1e: OAC Struct Property Field Mapping Support
|
|
257
|
+
- cc380b5: Use the latest Platform APIs
|
|
258
|
+
- 340ba44: Fix test
|
|
259
|
+
- Updated dependencies [322c5bc]
|
|
260
|
+
- Updated dependencies [c6bee50]
|
|
261
|
+
- Updated dependencies [7416ce4]
|
|
262
|
+
- Updated dependencies [7170fd1]
|
|
263
|
+
- Updated dependencies [12843cb]
|
|
264
|
+
- Updated dependencies [18ba34f]
|
|
265
|
+
- Updated dependencies [6abf078]
|
|
266
|
+
- Updated dependencies [f82767c]
|
|
267
|
+
- Updated dependencies [56aa502]
|
|
268
|
+
- Updated dependencies [0e874b1]
|
|
269
|
+
- Updated dependencies [abe4897]
|
|
270
|
+
- Updated dependencies [63b2e63]
|
|
271
|
+
- Updated dependencies [cddfbf9]
|
|
272
|
+
- Updated dependencies [7416ce4]
|
|
273
|
+
- Updated dependencies [23ea0e4]
|
|
274
|
+
- Updated dependencies [26c2d95]
|
|
275
|
+
- Updated dependencies [488b51c]
|
|
276
|
+
- Updated dependencies [71462e9]
|
|
277
|
+
- Updated dependencies [fccd9ac]
|
|
278
|
+
- Updated dependencies [5665b18]
|
|
279
|
+
- Updated dependencies [46cede4]
|
|
280
|
+
- Updated dependencies [761e69d]
|
|
281
|
+
- Updated dependencies [889e84b]
|
|
282
|
+
- Updated dependencies [a6e5f89]
|
|
283
|
+
- Updated dependencies [ed69666]
|
|
284
|
+
- Updated dependencies [4183a55]
|
|
285
|
+
- Updated dependencies [70b4464]
|
|
286
|
+
- Updated dependencies [791e655]
|
|
287
|
+
- Updated dependencies [317b555]
|
|
288
|
+
- Updated dependencies [63b2e63]
|
|
289
|
+
- Updated dependencies [a146ce4]
|
|
290
|
+
- Updated dependencies [3d0ab11]
|
|
291
|
+
- Updated dependencies [805df40]
|
|
292
|
+
- Updated dependencies [5467a0f]
|
|
293
|
+
- Updated dependencies [63b2e63]
|
|
294
|
+
- @osdk/api@2.2.0
|
|
295
|
+
|
|
141
296
|
## 0.10.0-beta.25
|
|
142
297
|
|
|
143
298
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -369,28 +369,12 @@ const personObject = defineObject({
|
|
|
369
369
|
pluralDisplayName: "People",
|
|
370
370
|
titlePropertyApiName: "name", // Property to use as the title
|
|
371
371
|
primaryKeyPropertyApiName: "id", // Property to use as the primary key
|
|
372
|
-
properties:
|
|
373
|
-
{
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
{
|
|
379
|
-
apiName: "name",
|
|
380
|
-
type: "string",
|
|
381
|
-
displayName: "Name",
|
|
382
|
-
},
|
|
383
|
-
{
|
|
384
|
-
apiName: "email",
|
|
385
|
-
type: "string",
|
|
386
|
-
displayName: "Email",
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
apiName: "age",
|
|
390
|
-
type: "integer",
|
|
391
|
-
displayName: "Age",
|
|
392
|
-
},
|
|
393
|
-
],
|
|
372
|
+
properties: {
|
|
373
|
+
"id": { type: "string", displayName: "ID" },
|
|
374
|
+
"name": { type: "string" },
|
|
375
|
+
"email": { type: "string" },
|
|
376
|
+
"age": { type: "integer" },
|
|
377
|
+
},
|
|
394
378
|
});
|
|
395
379
|
```
|
|
396
380
|
|
|
@@ -404,38 +388,14 @@ const employeeObject = defineObject({
|
|
|
404
388
|
pluralDisplayName: "Employees",
|
|
405
389
|
titlePropertyApiName: "name",
|
|
406
390
|
primaryKeyPropertyApiName: "id",
|
|
407
|
-
properties:
|
|
408
|
-
{
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
},
|
|
413
|
-
{
|
|
414
|
-
|
|
415
|
-
type: "string",
|
|
416
|
-
displayName: "Name",
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
apiName: "email",
|
|
420
|
-
type: "string",
|
|
421
|
-
displayName: "Email",
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
apiName: "department",
|
|
425
|
-
type: "string",
|
|
426
|
-
displayName: "Department",
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
apiName: "hireDate",
|
|
430
|
-
type: "date",
|
|
431
|
-
displayName: "Hire Date",
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
apiName: "isActive",
|
|
435
|
-
type: "boolean",
|
|
436
|
-
displayName: "Active",
|
|
437
|
-
},
|
|
438
|
-
],
|
|
391
|
+
properties: {
|
|
392
|
+
"id": { type: "string", displayName: "ID" },
|
|
393
|
+
"name": { type: "string" },
|
|
394
|
+
"email": { type: "string" },
|
|
395
|
+
"department": { type: "string" },
|
|
396
|
+
"hireDate": { type: "date", displayName: "Hire Date" },
|
|
397
|
+
"isActive": { type: "boolean" },
|
|
398
|
+
},
|
|
439
399
|
implementsInterfaces: [
|
|
440
400
|
{
|
|
441
401
|
implements: employeeInterface,
|
|
@@ -461,19 +421,10 @@ const customerObject = defineObject({
|
|
|
461
421
|
pluralDisplayName: "Customers",
|
|
462
422
|
titlePropertyApiName: "name",
|
|
463
423
|
primaryKeyPropertyApiName: "id",
|
|
464
|
-
properties:
|
|
465
|
-
{
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
displayName: "ID",
|
|
469
|
-
},
|
|
470
|
-
{
|
|
471
|
-
apiName: "name",
|
|
472
|
-
type: "string",
|
|
473
|
-
displayName: "Name",
|
|
474
|
-
},
|
|
475
|
-
{
|
|
476
|
-
apiName: "address",
|
|
424
|
+
properties: {
|
|
425
|
+
"id": { type: "string", displayName: "ID" },
|
|
426
|
+
"name": { type: "string" },
|
|
427
|
+
"address": {
|
|
477
428
|
type: {
|
|
478
429
|
type: "struct",
|
|
479
430
|
structDefinition: {
|
|
@@ -486,7 +437,7 @@ const customerObject = defineObject({
|
|
|
486
437
|
},
|
|
487
438
|
displayName: "Address",
|
|
488
439
|
},
|
|
489
|
-
|
|
440
|
+
},
|
|
490
441
|
});
|
|
491
442
|
```
|
|
492
443
|
|
|
@@ -500,23 +451,11 @@ const eventObject = defineObject({
|
|
|
500
451
|
pluralDisplayName: "Events",
|
|
501
452
|
titlePropertyApiName: "eventName",
|
|
502
453
|
primaryKeyPropertyApiName: "eventId",
|
|
503
|
-
properties:
|
|
504
|
-
{
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
},
|
|
509
|
-
{
|
|
510
|
-
apiName: "eventName",
|
|
511
|
-
type: "string",
|
|
512
|
-
displayName: "Event Name",
|
|
513
|
-
},
|
|
514
|
-
{
|
|
515
|
-
apiName: "timestamp",
|
|
516
|
-
type: "timestamp",
|
|
517
|
-
displayName: "Timestamp",
|
|
518
|
-
},
|
|
519
|
-
],
|
|
454
|
+
properties: {
|
|
455
|
+
"eventId": { type: "string", displayName: "Event ID" },
|
|
456
|
+
"eventName": { type: "string", displayName: "Event Name" },
|
|
457
|
+
"timestamp": { type: "timestamp" },
|
|
458
|
+
},
|
|
520
459
|
datasource: {
|
|
521
460
|
type: "stream",
|
|
522
461
|
retentionPeriod: "P90D", // 90 days retention (ISO 8601 duration format)
|
|
@@ -530,23 +469,11 @@ const productObject = defineObject({
|
|
|
530
469
|
pluralDisplayName: "Products",
|
|
531
470
|
titlePropertyApiName: "name",
|
|
532
471
|
primaryKeyPropertyApiName: "id",
|
|
533
|
-
properties:
|
|
534
|
-
{
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
},
|
|
539
|
-
{
|
|
540
|
-
apiName: "name",
|
|
541
|
-
type: "string",
|
|
542
|
-
displayName: "Name",
|
|
543
|
-
},
|
|
544
|
-
{
|
|
545
|
-
apiName: "price",
|
|
546
|
-
type: "decimal",
|
|
547
|
-
displayName: "Price",
|
|
548
|
-
},
|
|
549
|
-
],
|
|
472
|
+
properties: {
|
|
473
|
+
"id": { type: "string", displayName: "ID" },
|
|
474
|
+
"name": { type: "string" },
|
|
475
|
+
"price": { type: "decimal" },
|
|
476
|
+
},
|
|
550
477
|
datasource: {
|
|
551
478
|
type: "dataset",
|
|
552
479
|
},
|
|
@@ -640,72 +567,15 @@ const personToAddressLink = defineInterfaceLinkConstraint({
|
|
|
640
567
|
|
|
641
568
|
Actions define operations that can be performed on objects and interfaces.
|
|
642
569
|
|
|
643
|
-
### Custom Action
|
|
644
|
-
|
|
645
|
-
```typescript
|
|
646
|
-
import { defineAction } from "@osdk/maker";
|
|
647
|
-
|
|
648
|
-
// Define a custom action
|
|
649
|
-
const markAsInactiveAction = defineAction({
|
|
650
|
-
apiName: "mark-as-inactive",
|
|
651
|
-
displayName: "Mark as Inactive",
|
|
652
|
-
parameters: [
|
|
653
|
-
{
|
|
654
|
-
id: "reason",
|
|
655
|
-
displayName: "Reason",
|
|
656
|
-
type: "string",
|
|
657
|
-
validation: {
|
|
658
|
-
required: true,
|
|
659
|
-
allowedValues: { type: "text" },
|
|
660
|
-
},
|
|
661
|
-
},
|
|
662
|
-
{
|
|
663
|
-
id: "effectiveDate",
|
|
664
|
-
displayName: "Effective Date",
|
|
665
|
-
type: "date",
|
|
666
|
-
validation: {
|
|
667
|
-
required: true,
|
|
668
|
-
allowedValues: { type: "datetime" },
|
|
669
|
-
},
|
|
670
|
-
},
|
|
671
|
-
],
|
|
672
|
-
status: "active",
|
|
673
|
-
rules: [
|
|
674
|
-
{
|
|
675
|
-
type: "addOrModifyObjectRuleV2",
|
|
676
|
-
addOrModifyObjectRuleV2: {
|
|
677
|
-
objectToModify: "objectToModifyParameter",
|
|
678
|
-
propertyValues: {
|
|
679
|
-
"isActive": {
|
|
680
|
-
type: "staticValue",
|
|
681
|
-
staticValue: {
|
|
682
|
-
type: "boolean",
|
|
683
|
-
boolean: false,
|
|
684
|
-
},
|
|
685
|
-
},
|
|
686
|
-
"inactiveReason": {
|
|
687
|
-
type: "parameterId",
|
|
688
|
-
parameterId: "reason",
|
|
689
|
-
},
|
|
690
|
-
"inactiveDate": {
|
|
691
|
-
type: "parameterId",
|
|
692
|
-
parameterId: "effectiveDate",
|
|
693
|
-
},
|
|
694
|
-
},
|
|
695
|
-
structFieldValues: {},
|
|
696
|
-
},
|
|
697
|
-
},
|
|
698
|
-
],
|
|
699
|
-
});
|
|
700
|
-
```
|
|
701
|
-
|
|
702
570
|
### Create Object Action
|
|
703
571
|
|
|
704
572
|
```typescript
|
|
705
573
|
import { defineCreateObjectAction } from "@osdk/maker";
|
|
706
574
|
|
|
707
575
|
// Define an action to create an employee
|
|
708
|
-
const createEmployeeAction = defineCreateObjectAction(
|
|
576
|
+
const createEmployeeAction = defineCreateObjectAction({
|
|
577
|
+
objectType: employeeObject,
|
|
578
|
+
});
|
|
709
579
|
```
|
|
710
580
|
|
|
711
581
|
### Modify Object Action
|
|
@@ -714,7 +584,9 @@ const createEmployeeAction = defineCreateObjectAction(employeeObject);
|
|
|
714
584
|
import { defineModifyObjectAction } from "@osdk/maker";
|
|
715
585
|
|
|
716
586
|
// Define an action to modify an employee
|
|
717
|
-
const modifyEmployeeAction = defineModifyObjectAction(
|
|
587
|
+
const modifyEmployeeAction = defineModifyObjectAction({
|
|
588
|
+
objectType: employeeObject,
|
|
589
|
+
});
|
|
718
590
|
```
|
|
719
591
|
|
|
720
592
|
### Delete Object Action
|
|
@@ -723,7 +595,9 @@ const modifyEmployeeAction = defineModifyObjectAction(employeeObject);
|
|
|
723
595
|
import { defineDeleteObjectAction } from "@osdk/maker";
|
|
724
596
|
|
|
725
597
|
// Define an action to delete an employee
|
|
726
|
-
const deleteEmployeeAction = defineDeleteObjectAction(
|
|
598
|
+
const deleteEmployeeAction = defineDeleteObjectAction({
|
|
599
|
+
objectType: employeeObject,
|
|
600
|
+
});
|
|
727
601
|
```
|
|
728
602
|
|
|
729
603
|
### Interface Actions
|
|
@@ -746,3 +620,82 @@ const createEmployeePersonAction = defineCreateInterfaceObjectAction(
|
|
|
746
620
|
// Define an action to modify objects implementing an interface
|
|
747
621
|
const modifyPersonAction = defineModifyInterfaceObjectAction(personInterface);
|
|
748
622
|
```
|
|
623
|
+
|
|
624
|
+
### Custom Action
|
|
625
|
+
|
|
626
|
+
More customization such as security/submission criteria, constraints on parameter values, parameter overrides, etc.
|
|
627
|
+
can also be added.
|
|
628
|
+
|
|
629
|
+
```typescript
|
|
630
|
+
import {
|
|
631
|
+
ActionParameterConditionalOverride,
|
|
632
|
+
ConditionDefinition,
|
|
633
|
+
defineModifyObjectAction,
|
|
634
|
+
defineObject,
|
|
635
|
+
} from "@osdk/maker";
|
|
636
|
+
|
|
637
|
+
const employeeObject = defineObject({
|
|
638
|
+
apiName: "employee",
|
|
639
|
+
displayName: "Employee",
|
|
640
|
+
pluralDisplayName: "Employees",
|
|
641
|
+
titlePropertyApiName: "id",
|
|
642
|
+
primaryKeyPropertyApiName: "id",
|
|
643
|
+
properties: {
|
|
644
|
+
"id": { type: "string", displayName: "ID" },
|
|
645
|
+
"team": { type: "string" },
|
|
646
|
+
"numDeals": { type: "integer" },
|
|
647
|
+
"experience": { type: "integer" },
|
|
648
|
+
},
|
|
649
|
+
});
|
|
650
|
+
|
|
651
|
+
const mustBeManagerCondition: ConditionDefinition = {
|
|
652
|
+
type: "group",
|
|
653
|
+
name: "managerGroup", // Actual group assigned during installation
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
const mustBeInTeamCondition: ConditionDefinition = {
|
|
657
|
+
type: "group",
|
|
658
|
+
name: "teamGroup",
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
const teamEqualsSalesParameterCondition: ConditionDefinition = {
|
|
662
|
+
type: "parameter",
|
|
663
|
+
parameterId: "team",
|
|
664
|
+
matches: {
|
|
665
|
+
type: "staticValue",
|
|
666
|
+
staticValue: {
|
|
667
|
+
type: "string",
|
|
668
|
+
string: "sales",
|
|
669
|
+
},
|
|
670
|
+
},
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
const makeDealsVisible: ActionParameterConditionalOverride = {
|
|
674
|
+
type: "visibility",
|
|
675
|
+
condition: {
|
|
676
|
+
type: "and",
|
|
677
|
+
conditions: [
|
|
678
|
+
mustBeInTeamCondition,
|
|
679
|
+
teamEqualsSalesParameterCondition,
|
|
680
|
+
],
|
|
681
|
+
},
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
const modifyObjectActionType = defineModifyObjectAction(
|
|
685
|
+
{
|
|
686
|
+
objectType: employeeObject,
|
|
687
|
+
actionLevelValidation: {
|
|
688
|
+
condition: mustBeManagerCondition,
|
|
689
|
+
},
|
|
690
|
+
parameterLevelValidations: {
|
|
691
|
+
"numDeals": {
|
|
692
|
+
defaultVisibility: "hidden",
|
|
693
|
+
conditionalOverrides: [
|
|
694
|
+
makeDealsVisible,
|
|
695
|
+
],
|
|
696
|
+
},
|
|
697
|
+
},
|
|
698
|
+
excludedProperties: ["experience"],
|
|
699
|
+
},
|
|
700
|
+
);
|
|
701
|
+
```
|