@rippling/rippling-sdk 0.2.0-alpha.40 → 0.2.0-alpha.41

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.
Files changed (31) hide show
  1. package/lib/manifest/custom-object-page-layout.d.mts +3 -3
  2. package/lib/manifest/custom-object-page-layout.d.mts.map +1 -1
  3. package/lib/manifest/custom-object-page-layout.d.ts +3 -3
  4. package/lib/manifest/custom-object-page-layout.d.ts.map +1 -1
  5. package/lib/manifest/custom-object-page-layout.js +15 -8
  6. package/lib/manifest/custom-object-page-layout.js.map +1 -1
  7. package/lib/manifest/custom-object-page-layout.mjs +15 -8
  8. package/lib/manifest/custom-object-page-layout.mjs.map +1 -1
  9. package/lib/manifest/existing-manifest-context.d.mts.map +1 -1
  10. package/lib/manifest/existing-manifest-context.d.ts.map +1 -1
  11. package/lib/manifest/existing-manifest-context.js +1 -0
  12. package/lib/manifest/existing-manifest-context.js.map +1 -1
  13. package/lib/manifest/existing-manifest-context.mjs +1 -0
  14. package/lib/manifest/existing-manifest-context.mjs.map +1 -1
  15. package/lib/manifest/field.d.mts +2 -2
  16. package/lib/manifest/field.d.mts.map +1 -1
  17. package/lib/manifest/field.d.ts +2 -2
  18. package/lib/manifest/field.d.ts.map +1 -1
  19. package/lib/manifest/field.js +14 -7
  20. package/lib/manifest/field.js.map +1 -1
  21. package/lib/manifest/field.mjs +14 -7
  22. package/lib/manifest/field.mjs.map +1 -1
  23. package/package.json +1 -1
  24. package/src/lib/manifest/custom-object-page-layout.ts +23 -10
  25. package/src/lib/manifest/existing-manifest-context.ts +1 -0
  26. package/src/lib/manifest/field.ts +18 -9
  27. package/src/version.ts +1 -1
  28. package/version.d.mts +1 -1
  29. package/version.d.ts +1 -1
  30. package/version.js +1 -1
  31. package/version.mjs +1 -1
@@ -241,7 +241,7 @@ export interface AddPageLayoutFieldOptions extends SectionFieldOptions {
241
241
  * Existing layouts often use layout section keys that differ from field section
242
242
  * ids. Pass this when the field was not constructed with a `section`.
243
243
  */
244
- fieldSection?: CustomObjectFieldSection | string;
244
+ fieldSection?: CustomObjectFieldSection;
245
245
  /** Insert position inside the section field list. Optional. @default `'end'` */
246
246
  position?: PageLayoutMutationPosition;
247
247
  /** Allow the same field to appear twice in the same section. Optional. @default false */
@@ -838,8 +838,8 @@ export class CustomObjectPageLayout {
838
838
  * Adds multiple fields to an existing layout section.
839
839
  *
840
840
  * Fields are inserted in the order provided. If a field does not already have
841
- * field-section metadata, it is assigned to `options.fieldSection` when
842
- * provided, otherwise to `options.sectionKey`.
841
+ * field-section metadata, pass `options.fieldSection` so the corresponding
842
+ * `CUSTOM_OBJECT_FIELD_SECTION` component is registered in the manifest.
843
843
  */
844
844
  addFields(fields: Field[], options: AddPageLayoutFieldsOptions): this {
845
845
  if (fields.length === 0) return this;
@@ -1196,21 +1196,34 @@ export class CustomObjectPageLayout {
1196
1196
  private assignFieldSectionForMutation(
1197
1197
  field: Field,
1198
1198
  fallbackSectionKey: string,
1199
- fieldSection: CustomObjectFieldSection | string | undefined,
1199
+ fieldSection: CustomObjectFieldSection | undefined,
1200
1200
  ): void {
1201
- if (fieldSection != null) {
1202
- if (typeof fieldSection !== 'string' && fieldSection.getModelApiName() !== this._customObjectApiName) {
1201
+ const rawFieldSection = fieldSection as CustomObjectFieldSection | string | undefined;
1202
+ if (rawFieldSection != null) {
1203
+ if (typeof rawFieldSection === 'string') {
1204
+ throw new TypeError(
1205
+ `CustomObjectPageLayout fieldSection must be a CustomObjectFieldSection object; ` +
1206
+ `received raw section id "${rawFieldSection}". Load/include the existing field section first.`,
1207
+ );
1208
+ }
1209
+ if (rawFieldSection.getModelApiName() !== this._customObjectApiName) {
1203
1210
  throw new Error(
1204
- `CustomObjectPageLayout field section "${fieldSection.getSectionId()}" belongs to ` +
1205
- `"${fieldSection.getModelApiName()}", but the layout belongs to "${this._customObjectApiName}".`,
1211
+ `CustomObjectPageLayout field section "${rawFieldSection.getSectionId()}" belongs to ` +
1212
+ `"${rawFieldSection.getModelApiName()}", but the layout belongs to "${
1213
+ this._customObjectApiName
1214
+ }".`,
1206
1215
  );
1207
1216
  }
1208
- field._assignSection(fieldSection);
1217
+ field._assignSection(rawFieldSection);
1209
1218
  return;
1210
1219
  }
1211
1220
 
1212
1221
  if (field.getSectionId() == null) {
1213
- field._assignSection(fallbackSectionKey);
1222
+ throw new Error(
1223
+ `CustomObjectPageLayout field "${field.getApiName()}" is missing field-section metadata. ` +
1224
+ `Construct the field with a CustomObjectFieldSection or pass fieldSection when adding it to ` +
1225
+ `section "${fallbackSectionKey}".`,
1226
+ );
1214
1227
  }
1215
1228
  }
1216
1229
 
@@ -600,6 +600,7 @@ export class ExistingManifestContext {
600
600
  }
601
601
  if (field == null || typeof field !== 'object') return;
602
602
  const record = field as Record<string, any>;
603
+ this.loadFieldSectionIfPresent(customObjectApiName, record['fieldSection'] ?? record['field_section']);
603
604
  this.loadFieldDependencyIfString(customObjectApiName, record['fieldRqlName'] ?? record['field_rql_name']);
604
605
  }
605
606
 
@@ -70,7 +70,7 @@ interface CommonFieldProps {
70
70
  apiName: string;
71
71
  displayName: string;
72
72
  description?: string;
73
- section?: CustomObjectFieldSection | string;
73
+ section?: CustomObjectFieldSection;
74
74
  }
75
75
 
76
76
  /**
@@ -93,7 +93,7 @@ export interface FieldProps {
93
93
  formulaAttrMetas?: Record<string, any> | null | undefined;
94
94
  derivedAggregatedField?: Record<string, any> | null | undefined;
95
95
  derivedFieldFormula?: string | null | undefined;
96
- section?: CustomObjectFieldSection | string | null | undefined;
96
+ section?: CustomObjectFieldSection | null | undefined;
97
97
  maxLength?: number | undefined;
98
98
  decimalPlaces?: number | undefined;
99
99
  currency?: string | undefined;
@@ -106,6 +106,17 @@ export interface FieldLoadFromExistingOptions extends ExistingManifestContextOpt
106
106
  customObjectApiName?: string;
107
107
  }
108
108
 
109
+ function normalizeSectionInput(section: CustomObjectFieldSection | string | null | undefined): string | null {
110
+ if (section == null) return null;
111
+ if (typeof section === 'string') {
112
+ throw new TypeError(
113
+ `Field section must be a CustomObjectFieldSection object; received raw section id "${section}". ` +
114
+ 'Load/include the existing field section first.',
115
+ );
116
+ }
117
+ return section.getSectionId();
118
+ }
119
+
109
120
  class ExistingFieldReference {
110
121
  private _section: string | null;
111
122
 
@@ -240,11 +251,8 @@ export class Field {
240
251
  this._derivedFieldFormula = props.derivedFieldFormula ?? null;
241
252
  this._summarySpec = props.summarySpec ?? null;
242
253
 
243
- const rawSection = props.section;
244
- this._section =
245
- rawSection == null ? null
246
- : typeof rawSection === 'string' ? rawSection
247
- : rawSection.getSectionId();
254
+ const rawSection = props.section as CustomObjectFieldSection | string | null | undefined;
255
+ this._section = normalizeSectionInput(rawSection);
248
256
 
249
257
  customObject._register(this);
250
258
  }
@@ -278,8 +286,9 @@ export class Field {
278
286
  }
279
287
  if (component['derived_field_formula'] !== undefined)
280
288
  props.derivedFieldFormula = component['derived_field_formula'];
281
- if (component['section'] !== undefined) props.section = component['section'];
282
- return new Field(customObject, props);
289
+ const field = new Field(customObject, props);
290
+ if (typeof component['section'] === 'string') field._assignSection(component['section']);
291
+ return field;
283
292
  }
284
293
 
285
294
  /** @internal Creates a non-registered reference for standard or external fields. */
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.2.0-alpha.40'; // x-release-please-version
1
+ export const VERSION = '0.2.0-alpha.41'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.2.0-alpha.40";
1
+ export declare const VERSION = "0.2.0-alpha.41";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.2.0-alpha.40";
1
+ export declare const VERSION = "0.2.0-alpha.41";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.2.0-alpha.40'; // x-release-please-version
4
+ exports.VERSION = '0.2.0-alpha.41'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.2.0-alpha.40'; // x-release-please-version
1
+ export const VERSION = '0.2.0-alpha.41'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map