@rippling/rippling-sdk 0.2.0-alpha.44 → 0.2.0-alpha.46

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 (61) hide show
  1. package/examples/manifest/dental-practice-management/dental-practice-management.ts +0 -7
  2. package/examples/manifest/dental-practice-management/manifest.json +0 -7
  3. package/examples/manifest/existing-manifest-mutations/existing-manifest-mutations.ts +6 -7
  4. package/examples/manifest/gym-membership-management/gym-membership-management.ts +0 -7
  5. package/examples/manifest/gym-membership-management/manifest.json +0 -7
  6. package/lib/manifest/app.d.mts +2 -2
  7. package/lib/manifest/app.d.mts.map +1 -1
  8. package/lib/manifest/app.d.ts +2 -2
  9. package/lib/manifest/app.d.ts.map +1 -1
  10. package/lib/manifest/app.js +15 -4
  11. package/lib/manifest/app.js.map +1 -1
  12. package/lib/manifest/app.mjs +15 -4
  13. package/lib/manifest/app.mjs.map +1 -1
  14. package/lib/manifest/custom-object-field-section.d.mts +2 -2
  15. package/lib/manifest/custom-object-field-section.d.ts +2 -2
  16. package/lib/manifest/custom-object-field-section.js +2 -2
  17. package/lib/manifest/custom-object-field-section.mjs +2 -2
  18. package/lib/manifest/custom-object-page-layout.d.mts +86 -40
  19. package/lib/manifest/custom-object-page-layout.d.mts.map +1 -1
  20. package/lib/manifest/custom-object-page-layout.d.ts +86 -40
  21. package/lib/manifest/custom-object-page-layout.d.ts.map +1 -1
  22. package/lib/manifest/custom-object-page-layout.js +369 -79
  23. package/lib/manifest/custom-object-page-layout.js.map +1 -1
  24. package/lib/manifest/custom-object-page-layout.mjs +369 -79
  25. package/lib/manifest/custom-object-page-layout.mjs.map +1 -1
  26. package/lib/manifest/custom-object.d.mts +6 -0
  27. package/lib/manifest/custom-object.d.mts.map +1 -1
  28. package/lib/manifest/custom-object.d.ts +6 -0
  29. package/lib/manifest/custom-object.d.ts.map +1 -1
  30. package/lib/manifest/custom-object.js +6 -0
  31. package/lib/manifest/custom-object.js.map +1 -1
  32. package/lib/manifest/custom-object.mjs +6 -0
  33. package/lib/manifest/custom-object.mjs.map +1 -1
  34. package/lib/manifest/existing-manifest-context.d.mts +0 -1
  35. package/lib/manifest/existing-manifest-context.d.mts.map +1 -1
  36. package/lib/manifest/existing-manifest-context.d.ts +0 -1
  37. package/lib/manifest/existing-manifest-context.d.ts.map +1 -1
  38. package/lib/manifest/existing-manifest-context.js +5 -10
  39. package/lib/manifest/existing-manifest-context.js.map +1 -1
  40. package/lib/manifest/existing-manifest-context.mjs +5 -10
  41. package/lib/manifest/existing-manifest-context.mjs.map +1 -1
  42. package/lib/manifest/field.d.mts +6 -3
  43. package/lib/manifest/field.d.mts.map +1 -1
  44. package/lib/manifest/field.d.ts +6 -3
  45. package/lib/manifest/field.d.ts.map +1 -1
  46. package/lib/manifest/field.js +26 -6
  47. package/lib/manifest/field.js.map +1 -1
  48. package/lib/manifest/field.mjs +26 -6
  49. package/lib/manifest/field.mjs.map +1 -1
  50. package/package.json +1 -1
  51. package/src/lib/manifest/app.ts +19 -5
  52. package/src/lib/manifest/custom-object-field-section.ts +2 -2
  53. package/src/lib/manifest/custom-object-page-layout.ts +599 -109
  54. package/src/lib/manifest/custom-object.ts +6 -0
  55. package/src/lib/manifest/existing-manifest-context.ts +5 -12
  56. package/src/lib/manifest/field.ts +45 -9
  57. package/src/version.ts +1 -1
  58. package/version.d.mts +1 -1
  59. package/version.d.ts +1 -1
  60. package/version.js +1 -1
  61. package/version.mjs +1 -1
@@ -58,9 +58,9 @@ export interface AppProps {
58
58
  /**
59
59
  * SDUI pages shown as tabs in the app. Tab order matches the array order.
60
60
  *
61
- * Optional. @default `[]`
61
+ * Required. Must include at least one page.
62
62
  */
63
- pages?: AppPage[];
63
+ pages: AppPage[];
64
64
  }
65
65
 
66
66
  function resolvePage(entry: AppPage): Record<string, any> {
@@ -77,6 +77,20 @@ function resolvePage(entry: AppPage): Record<string, any> {
77
77
  };
78
78
  }
79
79
 
80
+ function resolvePages(pages: AppPage[] | undefined): Record<string, any>[] {
81
+ if (pages == null || pages.length === 0) {
82
+ throw new Error('App pages must include at least one page.');
83
+ }
84
+ return pages.map(resolvePage);
85
+ }
86
+
87
+ function clonePages(value: unknown): Record<string, any>[] {
88
+ if (!Array.isArray(value) || value.length === 0) {
89
+ throw new Error('App pages must include at least one page.');
90
+ }
91
+ return cloneJson(value) as Record<string, any>[];
92
+ }
93
+
80
94
  function cloneJson<T>(value: T): T {
81
95
  if (value == null) return value;
82
96
  return JSON.parse(JSON.stringify(value)) as T;
@@ -130,7 +144,7 @@ export class App {
130
144
  this._description = props.description;
131
145
  this._appType = props.appType;
132
146
  this._icon = props.icon;
133
- this._pages = (props.pages ?? []).map(resolvePage);
147
+ this._pages = resolvePages(props.pages);
134
148
  scope._register(this);
135
149
  }
136
150
 
@@ -150,7 +164,7 @@ export class App {
150
164
  _description: component['description'],
151
165
  _appType: component['app_type'],
152
166
  _icon: App.appIconFromExistingComponent(component['icon']),
153
- _pages: cloneJson(component['pages'] ?? []),
167
+ _pages: clonePages(component['pages']),
154
168
  });
155
169
  scope._register(app);
156
170
  return app;
@@ -193,7 +207,7 @@ export class App {
193
207
  component['icon'] = { s3_bucket: this._icon.s3Bucket, s3_key: this._icon.s3Key };
194
208
  }
195
209
  if (this._appType != null) component['app_type'] = this._appType;
196
- if (this._pages.length > 0) component['pages'] = this._pages.map((p) => ({ ...p }));
210
+ component['pages'] = this._pages.map((p) => ({ ...p }));
197
211
  return component;
198
212
  }
199
213
  }
@@ -32,8 +32,8 @@ export interface CustomObjectFieldSectionProps {
32
32
  * Defines a field section and registers it with the manifest.
33
33
  *
34
34
  * A field section is a named group of fields displayed together on a custom
35
- * object's detail page. After creating a section, pass it as the `section`
36
- * prop on any field that should belong to it.
35
+ * object's detail page. Every custom field must receive one of these sections
36
+ * through its `section` prop.
37
37
  *
38
38
  * @example
39
39
  * ```ts