@rippling/rippling-sdk 0.2.0-alpha.40 → 0.2.0-alpha.42
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/lib/manifest/_existing-component-fields.d.mts +9 -0
- package/lib/manifest/_existing-component-fields.d.mts.map +1 -0
- package/lib/manifest/_existing-component-fields.d.ts +9 -0
- package/lib/manifest/_existing-component-fields.d.ts.map +1 -0
- package/lib/manifest/_existing-component-fields.js +51 -0
- package/lib/manifest/_existing-component-fields.js.map +1 -0
- package/lib/manifest/_existing-component-fields.mjs +45 -0
- package/lib/manifest/_existing-component-fields.mjs.map +1 -0
- package/lib/manifest/app.d.mts.map +1 -1
- package/lib/manifest/app.d.ts.map +1 -1
- package/lib/manifest/app.js +3 -2
- package/lib/manifest/app.js.map +1 -1
- package/lib/manifest/app.mjs +3 -2
- package/lib/manifest/app.mjs.map +1 -1
- package/lib/manifest/category.d.mts +1 -1
- package/lib/manifest/category.d.mts.map +1 -1
- package/lib/manifest/category.d.ts +1 -1
- package/lib/manifest/category.d.ts.map +1 -1
- package/lib/manifest/category.js +7 -4
- package/lib/manifest/category.js.map +1 -1
- package/lib/manifest/category.mjs +7 -4
- package/lib/manifest/category.mjs.map +1 -1
- package/lib/manifest/custom-object-field-section.d.mts.map +1 -1
- package/lib/manifest/custom-object-field-section.d.ts.map +1 -1
- package/lib/manifest/custom-object-field-section.js +3 -2
- package/lib/manifest/custom-object-field-section.js.map +1 -1
- package/lib/manifest/custom-object-field-section.mjs +3 -2
- package/lib/manifest/custom-object-field-section.mjs.map +1 -1
- package/lib/manifest/custom-object-page-layout.d.mts +3 -3
- package/lib/manifest/custom-object-page-layout.d.mts.map +1 -1
- package/lib/manifest/custom-object-page-layout.d.ts +3 -3
- package/lib/manifest/custom-object-page-layout.d.ts.map +1 -1
- package/lib/manifest/custom-object-page-layout.js +20 -12
- package/lib/manifest/custom-object-page-layout.js.map +1 -1
- package/lib/manifest/custom-object-page-layout.mjs +20 -12
- package/lib/manifest/custom-object-page-layout.mjs.map +1 -1
- package/lib/manifest/custom-object.d.mts +3 -4
- package/lib/manifest/custom-object.d.mts.map +1 -1
- package/lib/manifest/custom-object.d.ts +3 -4
- package/lib/manifest/custom-object.d.ts.map +1 -1
- package/lib/manifest/custom-object.js +11 -5
- package/lib/manifest/custom-object.js.map +1 -1
- package/lib/manifest/custom-object.mjs +11 -5
- package/lib/manifest/custom-object.mjs.map +1 -1
- package/lib/manifest/existing-manifest-context.d.mts +3 -0
- package/lib/manifest/existing-manifest-context.d.mts.map +1 -1
- package/lib/manifest/existing-manifest-context.d.ts +3 -0
- package/lib/manifest/existing-manifest-context.d.ts.map +1 -1
- package/lib/manifest/existing-manifest-context.js +68 -26
- package/lib/manifest/existing-manifest-context.js.map +1 -1
- package/lib/manifest/existing-manifest-context.mjs +68 -26
- package/lib/manifest/existing-manifest-context.mjs.map +1 -1
- package/lib/manifest/field.d.mts +2 -2
- package/lib/manifest/field.d.mts.map +1 -1
- package/lib/manifest/field.d.ts +2 -2
- package/lib/manifest/field.d.ts.map +1 -1
- package/lib/manifest/field.js +27 -14
- package/lib/manifest/field.js.map +1 -1
- package/lib/manifest/field.mjs +27 -14
- package/lib/manifest/field.mjs.map +1 -1
- package/lib/manifest/list-view.d.mts.map +1 -1
- package/lib/manifest/list-view.d.ts.map +1 -1
- package/lib/manifest/list-view.js +5 -4
- package/lib/manifest/list-view.js.map +1 -1
- package/lib/manifest/list-view.mjs +5 -4
- package/lib/manifest/list-view.mjs.map +1 -1
- package/lib/manifest/manifest-function.d.mts.map +1 -1
- package/lib/manifest/manifest-function.d.ts.map +1 -1
- package/lib/manifest/manifest-function.js +3 -2
- package/lib/manifest/manifest-function.js.map +1 -1
- package/lib/manifest/manifest-function.mjs +3 -2
- package/lib/manifest/manifest-function.mjs.map +1 -1
- package/lib/manifest/rule.d.mts.map +1 -1
- package/lib/manifest/rule.d.ts.map +1 -1
- package/lib/manifest/rule.js +4 -3
- package/lib/manifest/rule.js.map +1 -1
- package/lib/manifest/rule.mjs +4 -3
- package/lib/manifest/rule.mjs.map +1 -1
- package/lib/manifest/sdui-page.d.mts +1 -1
- package/lib/manifest/sdui-page.d.mts.map +1 -1
- package/lib/manifest/sdui-page.d.ts +1 -1
- package/lib/manifest/sdui-page.d.ts.map +1 -1
- package/lib/manifest/sdui-page.js +5 -4
- package/lib/manifest/sdui-page.js.map +1 -1
- package/lib/manifest/sdui-page.mjs +5 -4
- package/lib/manifest/sdui-page.mjs.map +1 -1
- package/lib/manifest/validation.d.mts.map +1 -1
- package/lib/manifest/validation.d.ts.map +1 -1
- package/lib/manifest/validation.js +12 -7
- package/lib/manifest/validation.js.map +1 -1
- package/lib/manifest/validation.mjs +12 -7
- package/lib/manifest/validation.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/manifest/_existing-component-fields.ts +73 -0
- package/src/lib/manifest/app.ts +3 -2
- package/src/lib/manifest/category.ts +7 -4
- package/src/lib/manifest/custom-object-field-section.ts +3 -2
- package/src/lib/manifest/custom-object-page-layout.ts +32 -14
- package/src/lib/manifest/custom-object.ts +20 -10
- package/src/lib/manifest/existing-manifest-context.ts +125 -37
- package/src/lib/manifest/field.ts +36 -19
- package/src/lib/manifest/list-view.ts +11 -4
- package/src/lib/manifest/manifest-function.ts +3 -2
- package/src/lib/manifest/rule.ts +4 -3
- package/src/lib/manifest/sdui-page.ts +10 -5
- package/src/lib/manifest/validation.ts +12 -7
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdui-page.mjs","sourceRoot":"","sources":["../../src/lib/manifest/sdui-page.ts"],"names":[],"mappings":"OAAO,EAAE,0BAA0B,EAAuC;
|
|
1
|
+
{"version":3,"file":"sdui-page.mjs","sourceRoot":"","sources":["../../src/lib/manifest/sdui-page.ts"],"names":[],"mappings":"OAAO,EAAE,0BAA0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C,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoB;IAE9C;;;OAGG;gBACS,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe;IAa9D;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,iCAAsC,GAAG,UAAU;IAIpG,6EAA6E;IAC7E,MAAM,CAAC,sBAAsB,CAC3B,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC9B,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,KAAK,GACvC,UAAU;IAkBb;;OAEG;IACH,SAAS,IAAI,MAAM;IAInB;;OAEG;IACH,sBAAsB,IAAI,MAAM;IAIhC;;;;;OAKG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAe9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/lib/manifest/validation.ts"],"names":[],"mappings":"OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE;OAC1D,KAAK,EAAE,YAAY,EAAE;OACrB,EAA8B,KAAK,8BAA8B,EAAE;OACnE,KAAK,EAAE,KAAK,EAAE;OACd,KAAK,EAAE,yBAAyB,EAAE;
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/lib/manifest/validation.ts"],"names":[],"mappings":"OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE;OAC1D,KAAK,EAAE,YAA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,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoB;IAE9C;;;OAGG;gBACS,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe;IAa9D;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,iCAAsC,GAAG,UAAU;IAIpG,6EAA6E;IAC7E,MAAM,CAAC,sBAAsB,CAC3B,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC9B,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,KAAK,GACvC,UAAU;IAkBb;;OAEG;IACH,SAAS,IAAI,MAAM;IAInB;;OAEG;IACH,sBAAsB,IAAI,MAAM;IAIhC;;;;;OAKG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAe9B"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Validation = void 0;
|
|
4
4
|
const _helpers_1 = require("./_helpers.js");
|
|
5
5
|
const existing_manifest_context_1 = require("./existing-manifest-context.js");
|
|
6
|
+
const _existing_component_fields_1 = require("./_existing-component-fields.js");
|
|
6
7
|
/**
|
|
7
8
|
* Defines a validation rule and registers it with the manifest.
|
|
8
9
|
*
|
|
@@ -61,13 +62,17 @@ class Validation {
|
|
|
61
62
|
/** @internal Hydrates a validation rule from existing manifest wire JSON. */
|
|
62
63
|
static _fromExistingComponent(customObject, component, resolveField) {
|
|
63
64
|
const props = {
|
|
64
|
-
ruleId: component
|
|
65
|
-
displayName: component
|
|
66
|
-
rqlFormula: component
|
|
67
|
-
errorMessage: component
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
ruleId: (0, _existing_component_fields_1.requireStringComponentField)(component, 'rule_id', Validation.componentType),
|
|
66
|
+
displayName: (0, _existing_component_fields_1.requireStringComponentField)(component, 'display_name', Validation.componentType),
|
|
67
|
+
rqlFormula: (0, _existing_component_fields_1.requireStringComponentField)(component, 'rql_formula', Validation.componentType),
|
|
68
|
+
errorMessage: (0, _existing_component_fields_1.requireStringComponentField)(component, 'custom_error_message', Validation.componentType, {
|
|
69
|
+
allowEmpty: true,
|
|
70
|
+
}),
|
|
71
|
+
state: (0, _existing_component_fields_1.requireStringComponentField)(component, 'state', Validation.componentType),
|
|
72
|
+
level: (0, _existing_component_fields_1.requireStringComponentField)(component, 'level', Validation.componentType),
|
|
73
|
+
ruleDescription: (0, _existing_component_fields_1.requireStringComponentField)(component, 'rule_description', Validation.componentType, {
|
|
74
|
+
allowEmpty: true,
|
|
75
|
+
}),
|
|
71
76
|
};
|
|
72
77
|
if (component['field_rql_name'] != null)
|
|
73
78
|
props.fieldRef = resolveField(component['field_rql_name']);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/lib/manifest/validation.ts"],"names":[],"mappings":";;;AAAA,4CAAoF;AAEpF,8EAA8G;
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/lib/manifest/validation.ts"],"names":[],"mappings":";;;AAAA,4CAAoF;AAEpF,8EAA8G;AAG9G,gFAA2E;AAoE3E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,UAAU;IAGrB,MAAM,CAAC,oBAAoB,CAAC,UAAwC;QAClE,OAAO;YACL,IAAI,EAAE,UAAU,CAAC,aAAa;YAC9B,OAAO,EAAE,UAAU,CAAC,MAAM;YAC1B,cAAc,EAAE,UAAU,CAAC,YAAY;SACxC,CAAC;IACJ,CAAC;IAYD;;;OAGG;IACH,YAAY,YAA0B,EAAE,KAAsB;QAC5D,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,IAAI,IAAA,qBAAU,EAAC,MAAM,CAAC,CAAC;QAClD,IAAI,CAAC,oBAAoB,GAAG,YAAY,CAAC,UAAU,EAAE,CAAC;QACtD,IA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{ getExistingManifestContext } from "./existing-manifest-context.mjs";
|
|
3
|
+
import { requireStringComponentField } from "./_existing-component-fields.mjs";
|
|
3
4
|
/**
|
|
4
5
|
* Defines a validation rule and registers it with the manifest.
|
|
5
6
|
*
|
|
@@ -58,13 +59,17 @@ export class Validation {
|
|
|
58
59
|
/** @internal Hydrates a validation rule from existing manifest wire JSON. */
|
|
59
60
|
static _fromExistingComponent(customObject, component, resolveField) {
|
|
60
61
|
const props = {
|
|
61
|
-
ruleId: component
|
|
62
|
-
displayName: component
|
|
63
|
-
rqlFormula: component
|
|
64
|
-
errorMessage: component
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
ruleId: requireStringComponentField(component, 'rule_id', Validation.componentType),
|
|
63
|
+
displayName: requireStringComponentField(component, 'display_name', Validation.componentType),
|
|
64
|
+
rqlFormula: requireStringComponentField(component, 'rql_formula', Validation.componentType),
|
|
65
|
+
errorMessage: requireStringComponentField(component, 'custom_error_message', Validation.componentType, {
|
|
66
|
+
allowEmpty: true,
|
|
67
|
+
}),
|
|
68
|
+
state: requireStringComponentField(component, 'state', Validation.componentType),
|
|
69
|
+
level: requireStringComponentField(component, 'level', Validation.componentType),
|
|
70
|
+
ruleDescription: requireStringComponentField(component, 'rule_description', Validation.componentType, {
|
|
71
|
+
allowEmpty: true,
|
|
72
|
+
}),
|
|
68
73
|
};
|
|
69
74
|
if (component['field_rql_name'] != null)
|
|
70
75
|
props.fieldRef = resolveField(component['field_rql_name']);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.mjs","sourceRoot":"","sources":["../../src/lib/manifest/validation.ts"],"names":[],"mappings":"OAAO,EAAE,UAAU,EAA8C;OAE1D,EAAE,0BAA0B,EAAuC;
|
|
1
|
+
{"version":3,"file":"validation.mjs","sourceRoot":"","sources":["../../src/lib/manifest/validation.ts"],"names":[],"mappings":"OAAO,EAAE,UAAU,EAA8C;OAE1D,EAAE,0BAA0B,EAAuC;OAGnE,EAAE,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AY;YAC/B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,oBAAoB,EAAE,IAAI,CAAC,aAAa;YACxC,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC;QACF,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI;YAAE,SAAS,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;QACtF,OAAO,SAAS,CAAC;IACnB,CAAC;;AArGe,wBAAa,GAAG,+BAAwC,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
interface RequiredStringOptions {
|
|
2
|
+
allowEmpty?: boolean;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
function labelComponent(componentType: string, component: Record<string, any>): string {
|
|
6
|
+
const id =
|
|
7
|
+
component['api_name'] ??
|
|
8
|
+
component['layout_id'] ??
|
|
9
|
+
component['view_id'] ??
|
|
10
|
+
component['rule_id'] ??
|
|
11
|
+
component['flow_id'] ??
|
|
12
|
+
component['sdui_page_id'] ??
|
|
13
|
+
component['field_api_name'] ??
|
|
14
|
+
component['section_id'] ??
|
|
15
|
+
'unknown';
|
|
16
|
+
return `${componentType}:${String(id)}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function requiredFieldError(componentType: string, component: Record<string, any>, key: string): Error {
|
|
20
|
+
return new Error(
|
|
21
|
+
`${labelComponent(componentType, component)} is missing required field "${key}". ` +
|
|
22
|
+
'Pass the full existing component extraction to ManifestBuilder.loadFromExistingJson(...).',
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function requireStringComponentField(
|
|
27
|
+
component: Record<string, any>,
|
|
28
|
+
key: string,
|
|
29
|
+
componentType: string,
|
|
30
|
+
options: RequiredStringOptions = {},
|
|
31
|
+
): string {
|
|
32
|
+
const value = component[key];
|
|
33
|
+
if (typeof value !== 'string' || (!options.allowEmpty && value.length === 0)) {
|
|
34
|
+
throw requiredFieldError(componentType, component, key);
|
|
35
|
+
}
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function requireBooleanComponentField(
|
|
40
|
+
component: Record<string, any>,
|
|
41
|
+
key: string,
|
|
42
|
+
componentType: string,
|
|
43
|
+
): boolean {
|
|
44
|
+
const value = component[key];
|
|
45
|
+
if (typeof value !== 'boolean') {
|
|
46
|
+
throw requiredFieldError(componentType, component, key);
|
|
47
|
+
}
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function requireArrayComponentField<T = unknown>(
|
|
52
|
+
component: Record<string, any>,
|
|
53
|
+
key: string,
|
|
54
|
+
componentType: string,
|
|
55
|
+
): T[] {
|
|
56
|
+
const value = component[key];
|
|
57
|
+
if (!Array.isArray(value)) {
|
|
58
|
+
throw requiredFieldError(componentType, component, key);
|
|
59
|
+
}
|
|
60
|
+
return value as T[];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function requireObjectComponentField(
|
|
64
|
+
component: Record<string, any>,
|
|
65
|
+
key: string,
|
|
66
|
+
componentType: string,
|
|
67
|
+
): Record<string, any> {
|
|
68
|
+
const value = component[key];
|
|
69
|
+
if (value == null || typeof value !== 'object' || Array.isArray(value)) {
|
|
70
|
+
throw requiredFieldError(componentType, component, key);
|
|
71
|
+
}
|
|
72
|
+
return value as Record<string, any>;
|
|
73
|
+
}
|
package/src/lib/manifest/app.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { CustomObject } from './custom-object';
|
|
|
2
2
|
import { getExistingManifestContext, type ExistingManifestContextOptions } from './existing-manifest-context';
|
|
3
3
|
import type { ManifestComponentDeletion, ManifestScope } from './manifest-builder';
|
|
4
4
|
import { SduiPage } from './sdui-page';
|
|
5
|
+
import { requireStringComponentField } from './_existing-component-fields';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* A single page entry in an {@link App}.
|
|
@@ -153,8 +154,8 @@ export class App {
|
|
|
153
154
|
static _fromExistingComponent(scope: ManifestScope, component: Record<string, any>): App {
|
|
154
155
|
const app = Object.create(App.prototype) as App;
|
|
155
156
|
Object.assign(app as Record<string, any>, {
|
|
156
|
-
_apiName: component
|
|
157
|
-
_name: component
|
|
157
|
+
_apiName: requireStringComponentField(component, 'api_name', App.componentType),
|
|
158
|
+
_name: requireStringComponentField(component, 'name', App.componentType),
|
|
158
159
|
_description: component['description'],
|
|
159
160
|
_appType: component['app_type'],
|
|
160
161
|
_icon: App.appIconFromExistingComponent(component['icon']),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getExistingManifestContext, type ExistingManifestContextOptions } from './existing-manifest-context';
|
|
2
2
|
import type { ManifestComponentDeletion, ManifestScope } from './manifest-builder';
|
|
3
|
+
import { requireStringComponentField } from './_existing-component-fields';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Initialization properties for {@link Category}.
|
|
@@ -55,7 +56,7 @@ export interface CategoryProps {
|
|
|
55
56
|
* });
|
|
56
57
|
* ```
|
|
57
58
|
*
|
|
58
|
-
* @see {@link CustomObject} — references this category via instance
|
|
59
|
+
* @see {@link CustomObject} — references this category via instance.
|
|
59
60
|
*/
|
|
60
61
|
export class Category {
|
|
61
62
|
static readonly componentType = 'CUSTOM_CATEGORY' as const;
|
|
@@ -92,9 +93,11 @@ export class Category {
|
|
|
92
93
|
/** @internal Hydrates a category from existing manifest wire JSON. */
|
|
93
94
|
static _fromExistingComponent(scope: ManifestScope, component: Record<string, any>): Category {
|
|
94
95
|
return new Category(scope, {
|
|
95
|
-
apiName: component
|
|
96
|
-
name: component
|
|
97
|
-
description: component
|
|
96
|
+
apiName: requireStringComponentField(component, 'api_name', Category.componentType),
|
|
97
|
+
name: requireStringComponentField(component, 'name', Category.componentType),
|
|
98
|
+
description: requireStringComponentField(component, 'description', Category.componentType, {
|
|
99
|
+
allowEmpty: true,
|
|
100
|
+
}),
|
|
98
101
|
});
|
|
99
102
|
}
|
|
100
103
|
|
|
@@ -2,6 +2,7 @@ import { generateId } from './_helpers';
|
|
|
2
2
|
import type { CustomObject } from './custom-object';
|
|
3
3
|
import { getExistingManifestContext, type ExistingManifestContextOptions } from './existing-manifest-context';
|
|
4
4
|
import type { ManifestComponentDeletion } from './manifest-builder';
|
|
5
|
+
import { requireStringComponentField } from './_existing-component-fields';
|
|
5
6
|
|
|
6
7
|
export interface CustomObjectFieldSectionLoadFromExistingOptions extends ExistingManifestContextOptions {
|
|
7
8
|
customObjectApiName?: string;
|
|
@@ -91,8 +92,8 @@ export class CustomObjectFieldSection {
|
|
|
91
92
|
component: Record<string, any>,
|
|
92
93
|
): CustomObjectFieldSection {
|
|
93
94
|
return new CustomObjectFieldSection(customObject, {
|
|
94
|
-
sectionId: component
|
|
95
|
-
name: component
|
|
95
|
+
sectionId: requireStringComponentField(component, 'section_id', CustomObjectFieldSection.componentType),
|
|
96
|
+
name: requireStringComponentField(component, 'name', CustomObjectFieldSection.componentType),
|
|
96
97
|
});
|
|
97
98
|
}
|
|
98
99
|
|
|
@@ -4,6 +4,7 @@ import type { CustomObject } from './custom-object';
|
|
|
4
4
|
import { getExistingManifestContext, type ExistingManifestContextOptions } from './existing-manifest-context';
|
|
5
5
|
import type { Field } from './field';
|
|
6
6
|
import type { ManifestComponentDeletion } from './manifest-builder';
|
|
7
|
+
import { requireStringComponentField } from './_existing-component-fields';
|
|
7
8
|
|
|
8
9
|
export interface PageLayoutDeletionIdentifier {
|
|
9
10
|
layoutId: string;
|
|
@@ -241,7 +242,7 @@ export interface AddPageLayoutFieldOptions extends SectionFieldOptions {
|
|
|
241
242
|
* Existing layouts often use layout section keys that differ from field section
|
|
242
243
|
* ids. Pass this when the field was not constructed with a `section`.
|
|
243
244
|
*/
|
|
244
|
-
fieldSection?: CustomObjectFieldSection
|
|
245
|
+
fieldSection?: CustomObjectFieldSection;
|
|
245
246
|
/** Insert position inside the section field list. Optional. @default `'end'` */
|
|
246
247
|
position?: PageLayoutMutationPosition;
|
|
247
248
|
/** Allow the same field to appear twice in the same section. Optional. @default false */
|
|
@@ -790,10 +791,14 @@ export class CustomObjectPageLayout {
|
|
|
790
791
|
): CustomObjectPageLayout {
|
|
791
792
|
const layout = Object.create(CustomObjectPageLayout.prototype) as CustomObjectPageLayout;
|
|
792
793
|
Object.assign(layout as Record<string, any>, {
|
|
793
|
-
_layoutId: component
|
|
794
|
-
_apiName: component
|
|
795
|
-
_customObjectApiName:
|
|
796
|
-
|
|
794
|
+
_layoutId: requireStringComponentField(component, 'layout_id', CustomObjectPageLayout.componentType),
|
|
795
|
+
_apiName: requireStringComponentField(component, 'api_name', CustomObjectPageLayout.componentType),
|
|
796
|
+
_customObjectApiName: requireStringComponentField(
|
|
797
|
+
component,
|
|
798
|
+
'object_rql_name',
|
|
799
|
+
CustomObjectPageLayout.componentType,
|
|
800
|
+
),
|
|
801
|
+
_name: requireStringComponentField(component, 'name', CustomObjectPageLayout.componentType),
|
|
797
802
|
_tabEdits: cloneJson(component['tab_edits'] ?? {}),
|
|
798
803
|
_headerEdits: cloneJson(component['header_edits'] ?? {}),
|
|
799
804
|
_visibilityConditions: cloneJson(component['visibility_conditions'] ?? {}),
|
|
@@ -838,8 +843,8 @@ export class CustomObjectPageLayout {
|
|
|
838
843
|
* Adds multiple fields to an existing layout section.
|
|
839
844
|
*
|
|
840
845
|
* Fields are inserted in the order provided. If a field does not already have
|
|
841
|
-
* field-section metadata,
|
|
842
|
-
*
|
|
846
|
+
* field-section metadata, pass `options.fieldSection` so the corresponding
|
|
847
|
+
* `CUSTOM_OBJECT_FIELD_SECTION` component is registered in the manifest.
|
|
843
848
|
*/
|
|
844
849
|
addFields(fields: Field[], options: AddPageLayoutFieldsOptions): this {
|
|
845
850
|
if (fields.length === 0) return this;
|
|
@@ -1196,21 +1201,34 @@ export class CustomObjectPageLayout {
|
|
|
1196
1201
|
private assignFieldSectionForMutation(
|
|
1197
1202
|
field: Field,
|
|
1198
1203
|
fallbackSectionKey: string,
|
|
1199
|
-
fieldSection: CustomObjectFieldSection |
|
|
1204
|
+
fieldSection: CustomObjectFieldSection | undefined,
|
|
1200
1205
|
): void {
|
|
1201
|
-
|
|
1202
|
-
|
|
1206
|
+
const rawFieldSection = fieldSection as CustomObjectFieldSection | string | undefined;
|
|
1207
|
+
if (rawFieldSection != null) {
|
|
1208
|
+
if (typeof rawFieldSection === 'string') {
|
|
1209
|
+
throw new TypeError(
|
|
1210
|
+
`CustomObjectPageLayout fieldSection must be a CustomObjectFieldSection object; ` +
|
|
1211
|
+
`received raw section id "${rawFieldSection}". Load/include the existing field section first.`,
|
|
1212
|
+
);
|
|
1213
|
+
}
|
|
1214
|
+
if (rawFieldSection.getModelApiName() !== this._customObjectApiName) {
|
|
1203
1215
|
throw new Error(
|
|
1204
|
-
`CustomObjectPageLayout field section "${
|
|
1205
|
-
`"${
|
|
1216
|
+
`CustomObjectPageLayout field section "${rawFieldSection.getSectionId()}" belongs to ` +
|
|
1217
|
+
`"${rawFieldSection.getModelApiName()}", but the layout belongs to "${
|
|
1218
|
+
this._customObjectApiName
|
|
1219
|
+
}".`,
|
|
1206
1220
|
);
|
|
1207
1221
|
}
|
|
1208
|
-
field._assignSection(
|
|
1222
|
+
field._assignSection(rawFieldSection);
|
|
1209
1223
|
return;
|
|
1210
1224
|
}
|
|
1211
1225
|
|
|
1212
1226
|
if (field.getSectionId() == null) {
|
|
1213
|
-
|
|
1227
|
+
throw new Error(
|
|
1228
|
+
`CustomObjectPageLayout field "${field.getApiName()}" is missing field-section metadata. ` +
|
|
1229
|
+
`Construct the field with a CustomObjectFieldSection or pass fieldSection when adding it to ` +
|
|
1230
|
+
`section "${fallbackSectionKey}".`,
|
|
1231
|
+
);
|
|
1214
1232
|
}
|
|
1215
1233
|
}
|
|
1216
1234
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Category } from './category';
|
|
2
2
|
import { getExistingManifestContext, type ExistingManifestContextOptions } from './existing-manifest-context';
|
|
3
3
|
import type { ManifestComponent, ManifestComponentDeletion, ManifestScope } from './manifest-builder';
|
|
4
|
+
import { requireStringComponentField } from './_existing-component-fields';
|
|
4
5
|
|
|
5
6
|
// ────────────────────────────────────────────────────────────────────────
|
|
6
7
|
// Platform-managed standard fields — mirrors
|
|
@@ -192,10 +193,9 @@ export interface CustomObjectProps {
|
|
|
192
193
|
/**
|
|
193
194
|
* The category this object belongs to.
|
|
194
195
|
*
|
|
195
|
-
* Required. Pass a {@link Category} instance defined in the same manifest
|
|
196
|
-
* api_name string for categories defined outside this manifest.
|
|
196
|
+
* Required. Pass a {@link Category} instance defined or loaded in the same manifest.
|
|
197
197
|
*/
|
|
198
|
-
category: Category
|
|
198
|
+
category: Category;
|
|
199
199
|
/**
|
|
200
200
|
* Human-readable description of what this entity represents.
|
|
201
201
|
*
|
|
@@ -312,7 +312,7 @@ export class CustomObject implements ManifestScope {
|
|
|
312
312
|
private readonly _scope: ManifestScope;
|
|
313
313
|
private readonly _apiName: string;
|
|
314
314
|
private readonly _name: string;
|
|
315
|
-
private readonly _category: Category
|
|
315
|
+
private readonly _category: Category;
|
|
316
316
|
private _description: string | null | undefined;
|
|
317
317
|
private _icon: IconConfig | null | undefined;
|
|
318
318
|
private _pluralLabel: string | null | undefined;
|
|
@@ -328,6 +328,12 @@ export class CustomObject implements ManifestScope {
|
|
|
328
328
|
if (!props.apiName.endsWith('__c')) {
|
|
329
329
|
throw new Error(`Custom object api_name must end with __c: ${props.apiName}`);
|
|
330
330
|
}
|
|
331
|
+
if (!(props.category instanceof Category)) {
|
|
332
|
+
throw new TypeError(
|
|
333
|
+
'CustomObject category must be a Category object; raw category api_name strings are not supported. ' +
|
|
334
|
+
'Define or load the category first.',
|
|
335
|
+
);
|
|
336
|
+
}
|
|
331
337
|
this._scope = scope;
|
|
332
338
|
this._apiName = props.apiName;
|
|
333
339
|
this._name = props.name;
|
|
@@ -356,13 +362,17 @@ export class CustomObject implements ManifestScope {
|
|
|
356
362
|
static _fromExistingComponent(
|
|
357
363
|
scope: ManifestScope,
|
|
358
364
|
component: Record<string, any>,
|
|
359
|
-
resolveCategory: (apiName: string) => Category
|
|
365
|
+
resolveCategory: (apiName: string) => Category,
|
|
360
366
|
): CustomObject {
|
|
361
|
-
const categoryApiName =
|
|
367
|
+
const categoryApiName = requireStringComponentField(
|
|
368
|
+
component,
|
|
369
|
+
'category_api_name',
|
|
370
|
+
CustomObject.componentType,
|
|
371
|
+
);
|
|
362
372
|
const props: CustomObjectProps = {
|
|
363
|
-
apiName: component
|
|
364
|
-
name: component
|
|
365
|
-
category:
|
|
373
|
+
apiName: requireStringComponentField(component, 'api_name', CustomObject.componentType),
|
|
374
|
+
name: requireStringComponentField(component, 'name', CustomObject.componentType),
|
|
375
|
+
category: resolveCategory(categoryApiName),
|
|
366
376
|
};
|
|
367
377
|
if (component['description'] !== undefined) props.description = component['description'];
|
|
368
378
|
if (component['plural_label'] !== undefined) props.pluralLabel = component['plural_label'];
|
|
@@ -421,7 +431,7 @@ export class CustomObject implements ManifestScope {
|
|
|
421
431
|
api_name: this._apiName,
|
|
422
432
|
name: this._name,
|
|
423
433
|
description: this._description ?? null,
|
|
424
|
-
category_api_name:
|
|
434
|
+
category_api_name: this._category.getApiName(),
|
|
425
435
|
};
|
|
426
436
|
if (this._icon != null) {
|
|
427
437
|
const iconDict: Record<string, any> = {};
|