@rippling/rippling-sdk 0.2.0-alpha.33 → 0.2.0-alpha.35
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/client.d.mts +8 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +8 -2
- package/client.d.ts.map +1 -1
- package/client.js +17 -0
- package/client.js.map +1 -1
- package/client.mjs +17 -0
- package/client.mjs.map +1 -1
- package/internal/types.d.mts +6 -6
- package/internal/types.d.mts.map +1 -1
- package/internal/types.d.ts +6 -6
- package/internal/types.d.ts.map +1 -1
- package/lib/manifest/_helpers.d.mts +91 -0
- package/lib/manifest/_helpers.d.mts.map +1 -0
- package/lib/manifest/_helpers.d.ts +91 -0
- package/lib/manifest/_helpers.d.ts.map +1 -0
- package/lib/manifest/_helpers.js +65 -0
- package/lib/manifest/_helpers.js.map +1 -0
- package/lib/manifest/_helpers.mjs +61 -0
- package/lib/manifest/_helpers.mjs.map +1 -0
- package/lib/manifest/app.d.mts +113 -0
- package/lib/manifest/app.d.mts.map +1 -0
- package/lib/manifest/app.d.ts +113 -0
- package/lib/manifest/app.d.ts.map +1 -0
- package/lib/manifest/app.js +95 -0
- package/lib/manifest/app.js.map +1 -0
- package/lib/manifest/app.mjs +91 -0
- package/lib/manifest/app.mjs.map +1 -0
- package/lib/manifest/category.d.mts +79 -0
- package/lib/manifest/category.d.mts.map +1 -0
- package/lib/manifest/category.d.ts +79 -0
- package/lib/manifest/category.d.ts.map +1 -0
- package/lib/manifest/category.js +72 -0
- package/lib/manifest/category.js.map +1 -0
- package/lib/manifest/category.mjs +68 -0
- package/lib/manifest/category.mjs.map +1 -0
- package/lib/manifest/custom-object-field-section.d.mts +71 -0
- package/lib/manifest/custom-object-field-section.d.mts.map +1 -0
- package/lib/manifest/custom-object-field-section.d.ts +71 -0
- package/lib/manifest/custom-object-field-section.d.ts.map +1 -0
- package/lib/manifest/custom-object-field-section.js +69 -0
- package/lib/manifest/custom-object-field-section.js.map +1 -0
- package/lib/manifest/custom-object-field-section.mjs +65 -0
- package/lib/manifest/custom-object-field-section.mjs.map +1 -0
- package/lib/manifest/custom-object-page-layout.d.mts +318 -0
- package/lib/manifest/custom-object-page-layout.d.mts.map +1 -0
- package/lib/manifest/custom-object-page-layout.d.ts +318 -0
- package/lib/manifest/custom-object-page-layout.d.ts.map +1 -0
- package/lib/manifest/custom-object-page-layout.js +158 -0
- package/lib/manifest/custom-object-page-layout.js.map +1 -0
- package/lib/manifest/custom-object-page-layout.mjs +154 -0
- package/lib/manifest/custom-object-page-layout.mjs.map +1 -0
- package/lib/manifest/custom-object.d.mts +165 -0
- package/lib/manifest/custom-object.d.mts.map +1 -0
- package/lib/manifest/custom-object.d.ts +165 -0
- package/lib/manifest/custom-object.d.ts.map +1 -0
- package/lib/manifest/custom-object.js +254 -0
- package/lib/manifest/custom-object.js.map +1 -0
- package/lib/manifest/custom-object.mjs +250 -0
- package/lib/manifest/custom-object.mjs.map +1 -0
- package/lib/manifest/field.d.mts +487 -0
- package/lib/manifest/field.d.mts.map +1 -0
- package/lib/manifest/field.d.ts +487 -0
- package/lib/manifest/field.d.ts.map +1 -0
- package/lib/manifest/field.js +461 -0
- package/lib/manifest/field.js.map +1 -0
- package/lib/manifest/field.mjs +438 -0
- package/lib/manifest/field.mjs.map +1 -0
- package/lib/manifest/index.d.mts +15 -0
- package/lib/manifest/index.d.mts.map +1 -0
- package/lib/manifest/index.d.ts +15 -0
- package/lib/manifest/index.d.ts.map +1 -0
- package/lib/manifest/index.js +53 -0
- package/lib/manifest/index.js.map +1 -0
- package/lib/manifest/index.mjs +18 -0
- package/lib/manifest/index.mjs.map +1 -0
- package/lib/manifest/list-view.d.mts +138 -0
- package/lib/manifest/list-view.d.mts.map +1 -0
- package/lib/manifest/list-view.d.ts +138 -0
- package/lib/manifest/list-view.d.ts.map +1 -0
- package/lib/manifest/list-view.js +109 -0
- package/lib/manifest/list-view.js.map +1 -0
- package/lib/manifest/list-view.mjs +105 -0
- package/lib/manifest/list-view.mjs.map +1 -0
- package/lib/manifest/manifest-builder.d.mts +110 -0
- package/lib/manifest/manifest-builder.d.mts.map +1 -0
- package/lib/manifest/manifest-builder.d.ts +110 -0
- package/lib/manifest/manifest-builder.d.ts.map +1 -0
- package/lib/manifest/manifest-builder.js +91 -0
- package/lib/manifest/manifest-builder.js.map +1 -0
- package/lib/manifest/manifest-builder.mjs +87 -0
- package/lib/manifest/manifest-builder.mjs.map +1 -0
- package/lib/manifest/manifest-function.d.mts +119 -0
- package/lib/manifest/manifest-function.d.mts.map +1 -0
- package/lib/manifest/manifest-function.d.ts +119 -0
- package/lib/manifest/manifest-function.d.ts.map +1 -0
- package/lib/manifest/manifest-function.js +85 -0
- package/lib/manifest/manifest-function.js.map +1 -0
- package/lib/manifest/manifest-function.mjs +81 -0
- package/lib/manifest/manifest-function.mjs.map +1 -0
- package/lib/manifest/rule.d.mts +128 -0
- package/lib/manifest/rule.d.mts.map +1 -0
- package/lib/manifest/rule.d.ts +128 -0
- package/lib/manifest/rule.d.ts.map +1 -0
- package/lib/manifest/rule.js +105 -0
- package/lib/manifest/rule.js.map +1 -0
- package/lib/manifest/rule.mjs +101 -0
- package/lib/manifest/rule.mjs.map +1 -0
- package/lib/manifest/sdui-page.d.mts +89 -0
- package/lib/manifest/sdui-page.d.mts.map +1 -0
- package/lib/manifest/sdui-page.d.ts +89 -0
- package/lib/manifest/sdui-page.d.ts.map +1 -0
- package/lib/manifest/sdui-page.js +83 -0
- package/lib/manifest/sdui-page.js.map +1 -0
- package/lib/manifest/sdui-page.mjs +79 -0
- package/lib/manifest/sdui-page.mjs.map +1 -0
- package/lib/manifest/validation.d.mts +116 -0
- package/lib/manifest/validation.d.mts.map +1 -0
- package/lib/manifest/validation.d.ts +116 -0
- package/lib/manifest/validation.d.ts.map +1 -0
- package/lib/manifest/validation.js +83 -0
- package/lib/manifest/validation.js.map +1 -0
- package/lib/manifest/validation.mjs +79 -0
- package/lib/manifest/validation.mjs.map +1 -0
- package/lib/sdui/actions.d.mts +25 -0
- package/lib/sdui/actions.d.mts.map +1 -0
- package/lib/sdui/actions.d.ts +25 -0
- package/lib/sdui/actions.d.ts.map +1 -0
- package/lib/sdui/actions.js +53 -0
- package/lib/sdui/actions.js.map +1 -0
- package/lib/sdui/actions.mjs +42 -0
- package/lib/sdui/actions.mjs.map +1 -0
- package/lib/sdui/component.d.mts +41 -0
- package/lib/sdui/component.d.mts.map +1 -0
- package/lib/sdui/component.d.ts +41 -0
- package/lib/sdui/component.d.ts.map +1 -0
- package/lib/sdui/component.js +95 -0
- package/lib/sdui/component.js.map +1 -0
- package/lib/sdui/component.mjs +91 -0
- package/lib/sdui/component.mjs.map +1 -0
- package/lib/sdui/components.d.mts +149 -0
- package/lib/sdui/components.d.mts.map +1 -0
- package/lib/sdui/components.d.ts +149 -0
- package/lib/sdui/components.d.ts.map +1 -0
- package/lib/sdui/components.js +303 -0
- package/lib/sdui/components.js.map +1 -0
- package/lib/sdui/components.mjs +298 -0
- package/lib/sdui/components.mjs.map +1 -0
- package/lib/sdui/conditions.d.mts +25 -0
- package/lib/sdui/conditions.d.mts.map +1 -0
- package/lib/sdui/conditions.d.ts +25 -0
- package/lib/sdui/conditions.d.ts.map +1 -0
- package/lib/sdui/conditions.js +47 -0
- package/lib/sdui/conditions.js.map +1 -0
- package/lib/sdui/conditions.mjs +35 -0
- package/lib/sdui/conditions.mjs.map +1 -0
- package/lib/sdui/directives.d.mts +18 -0
- package/lib/sdui/directives.d.mts.map +1 -0
- package/lib/sdui/directives.d.ts +18 -0
- package/lib/sdui/directives.d.ts.map +1 -0
- package/lib/sdui/directives.js +28 -0
- package/lib/sdui/directives.js.map +1 -0
- package/lib/sdui/directives.mjs +21 -0
- package/lib/sdui/directives.mjs.map +1 -0
- package/lib/sdui/index.d.mts +362 -0
- package/lib/sdui/index.d.mts.map +1 -0
- package/lib/sdui/index.d.ts +362 -0
- package/lib/sdui/index.d.ts.map +1 -0
- package/lib/sdui/index.js +375 -0
- package/lib/sdui/index.js.map +1 -0
- package/lib/sdui/index.mjs +199 -0
- package/lib/sdui/index.mjs.map +1 -0
- package/lib/sdui/props.d.mts +12 -0
- package/lib/sdui/props.d.mts.map +1 -0
- package/lib/sdui/props.d.ts +12 -0
- package/lib/sdui/props.d.ts.map +1 -0
- package/lib/sdui/props.js +25 -0
- package/lib/sdui/props.js.map +1 -0
- package/lib/sdui/props.mjs +21 -0
- package/lib/sdui/props.mjs.map +1 -0
- package/lib/sdui/render.d.mts +23 -0
- package/lib/sdui/render.d.mts.map +1 -0
- package/lib/sdui/render.d.ts +23 -0
- package/lib/sdui/render.d.ts.map +1 -0
- package/lib/sdui/render.js +40 -0
- package/lib/sdui/render.js.map +1 -0
- package/lib/sdui/render.mjs +37 -0
- package/lib/sdui/render.mjs.map +1 -0
- package/lib/sdui/state.d.mts +22 -0
- package/lib/sdui/state.d.mts.map +1 -0
- package/lib/sdui/state.d.ts +22 -0
- package/lib/sdui/state.d.ts.map +1 -0
- package/lib/sdui/state.js +57 -0
- package/lib/sdui/state.js.map +1 -0
- package/lib/sdui/state.mjs +53 -0
- package/lib/sdui/state.mjs.map +1 -0
- package/package.json +11 -1
- package/resources/draft-hires.d.mts +26 -0
- package/resources/draft-hires.d.mts.map +1 -1
- package/resources/draft-hires.d.ts +26 -0
- package/resources/draft-hires.d.ts.map +1 -1
- package/resources/earnings-inputs.d.mts +99 -1
- package/resources/earnings-inputs.d.mts.map +1 -1
- package/resources/earnings-inputs.d.ts +99 -1
- package/resources/earnings-inputs.d.ts.map +1 -1
- package/resources/earnings-inputs.js +6 -0
- package/resources/earnings-inputs.js.map +1 -1
- package/resources/earnings-inputs.mjs +6 -0
- package/resources/earnings-inputs.mjs.map +1 -1
- package/resources/files.d.mts +164 -0
- package/resources/files.d.mts.map +1 -0
- package/resources/files.d.ts +164 -0
- package/resources/files.d.ts.map +1 -0
- package/resources/files.js +25 -0
- package/resources/files.js.map +1 -0
- package/resources/files.mjs +21 -0
- package/resources/files.mjs.map +1 -0
- package/resources/headcount-positions.d.mts +2 -2
- package/resources/headcount-positions.d.mts.map +1 -1
- package/resources/headcount-positions.d.ts +2 -2
- package/resources/headcount-positions.d.ts.map +1 -1
- package/resources/index.d.mts +2 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +4 -2
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/legal-entities.d.mts +1 -1
- package/resources/legal-entities.d.mts.map +1 -1
- package/resources/legal-entities.d.ts +1 -1
- package/resources/legal-entities.d.ts.map +1 -1
- package/resources/location-factors.d.mts +2 -2
- package/resources/location-factors.d.mts.map +1 -1
- package/resources/location-factors.d.ts +2 -2
- package/resources/location-factors.d.ts.map +1 -1
- package/resources/shared.d.mts +1 -1
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +1 -1
- package/resources/shared.d.ts.map +1 -1
- package/resources/workers.d.mts +2 -2
- package/resources/workers.d.mts.map +1 -1
- package/resources/workers.d.ts +2 -2
- package/resources/workers.d.ts.map +1 -1
- package/src/client.ts +29 -0
- package/src/internal/types.ts +6 -8
- package/src/lib/manifest/_helpers.ts +164 -0
- package/src/lib/manifest/app.ts +163 -0
- package/src/lib/manifest/category.ts +100 -0
- package/src/lib/manifest/custom-object-field-section.ts +93 -0
- package/src/lib/manifest/custom-object-page-layout.ts +427 -0
- package/src/lib/manifest/custom-object.ts +360 -0
- package/src/lib/manifest/field.ts +822 -0
- package/src/lib/manifest/index.ts +114 -0
- package/src/lib/manifest/list-view.ts +183 -0
- package/src/lib/manifest/manifest-builder.ts +140 -0
- package/src/lib/manifest/manifest-function.ts +151 -0
- package/src/lib/manifest/rule.ts +191 -0
- package/src/lib/manifest/sdui-page.ts +118 -0
- package/src/lib/manifest/validation.ts +150 -0
- package/src/lib/sdui/actions.ts +58 -0
- package/src/lib/sdui/component.ts +122 -0
- package/src/lib/sdui/components.ts +308 -0
- package/src/lib/sdui/conditions.ts +59 -0
- package/src/lib/sdui/directives.ts +42 -0
- package/src/lib/sdui/index.ts +365 -0
- package/src/lib/sdui/props.ts +32 -0
- package/src/lib/sdui/render.ts +58 -0
- package/src/lib/sdui/state.ts +60 -0
- package/src/resources/draft-hires.ts +31 -0
- package/src/resources/earnings-inputs.ts +127 -0
- package/src/resources/files.ts +203 -0
- package/src/resources/headcount-positions.ts +2 -0
- package/src/resources/index.ts +3 -0
- package/src/resources/legal-entities.ts +1 -0
- package/src/resources/location-factors.ts +2 -0
- package/src/resources/shared.ts +1 -0
- package/src/resources/workers.ts +2 -0
- 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
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Any object that can be included in a manifest.
|
|
3
|
+
*
|
|
4
|
+
* Implement `toDict()` to return the component's wire-format dict.
|
|
5
|
+
* All built-in SDK classes implement this interface automatically.
|
|
6
|
+
*/
|
|
7
|
+
export interface ManifestComponent {
|
|
8
|
+
toDict(): Record<string, any>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A scope — anything that can accept child component registrations.
|
|
12
|
+
*
|
|
13
|
+
* Implemented by {@link ManifestBuilder} (the root) and by nestable parents
|
|
14
|
+
* like `CustomObject` that forward registrations up to the builder.
|
|
15
|
+
* Pass a scope as the first argument when constructing any manifest component.
|
|
16
|
+
*/
|
|
17
|
+
export interface ManifestScope {
|
|
18
|
+
/** @internal Register a child component; builder-bound scopes forward up. */
|
|
19
|
+
_register(component: ManifestComponent): void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Initialization properties for {@link ManifestBuilder}.
|
|
23
|
+
*/
|
|
24
|
+
export interface ManifestBuilderProps {
|
|
25
|
+
/**
|
|
26
|
+
* Unique project key for this manifest (e.g. `'gym_membership_management'`).
|
|
27
|
+
*
|
|
28
|
+
* Required.
|
|
29
|
+
*/
|
|
30
|
+
key: string;
|
|
31
|
+
/**
|
|
32
|
+
* Display name for this manifest.
|
|
33
|
+
*
|
|
34
|
+
* Optional. Defaults to `key` when not provided.
|
|
35
|
+
*/
|
|
36
|
+
name?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Human-readable description of what this manifest contains.
|
|
39
|
+
*
|
|
40
|
+
* Optional.
|
|
41
|
+
*/
|
|
42
|
+
description?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Root container for a manifest — collects all components and serializes them to JSON.
|
|
46
|
+
*
|
|
47
|
+
* You would normally create one `ManifestBuilder` at the top of your manifest file,
|
|
48
|
+
* then pass it as the scope to all top-level components (categories, custom objects,
|
|
49
|
+
* functions, apps, SDUI pages). Each component auto-registers on construction; there
|
|
50
|
+
* is no separate add or register call.
|
|
51
|
+
*
|
|
52
|
+
* After defining all components, call `preview()` to emit the manifest as a
|
|
53
|
+
* pretty-printed JSON string, or `buildManifest()` to get the plain object.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const manifest = new ManifestBuilder({
|
|
58
|
+
* key: 'gym_membership_management',
|
|
59
|
+
* name: 'Gym Membership Management',
|
|
60
|
+
* description: 'Members, trainers, schedules, and check-in',
|
|
61
|
+
* });
|
|
62
|
+
*
|
|
63
|
+
* const category = new Category(manifest, { apiName: 'gym__c', name: 'Gym' });
|
|
64
|
+
* const memberObj = new CustomObject(manifest, { apiName: 'gym_member__c', name: 'Member', category });
|
|
65
|
+
* // ... define fields, rules, list views, etc. ...
|
|
66
|
+
*
|
|
67
|
+
* console.log(manifest.preview());
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare class ManifestBuilder implements ManifestScope {
|
|
71
|
+
readonly key: string;
|
|
72
|
+
readonly name: string;
|
|
73
|
+
readonly description: string;
|
|
74
|
+
private readonly _components;
|
|
75
|
+
/**
|
|
76
|
+
* @param props - Initialization properties.
|
|
77
|
+
* @throws {Error} If `props.key` is empty or missing.
|
|
78
|
+
*/
|
|
79
|
+
constructor(props: ManifestBuilderProps);
|
|
80
|
+
/**
|
|
81
|
+
* @internal Scope hook invoked by child constructors. Components enter the
|
|
82
|
+
* manifest here — there is no other path.
|
|
83
|
+
*/
|
|
84
|
+
_register(component: ManifestComponent): void;
|
|
85
|
+
/**
|
|
86
|
+
* Returns the manifest as a plain object with `metadata` and a flat `components` array.
|
|
87
|
+
*
|
|
88
|
+
* @returns `{ metadata: { key, name, description? }, components: Record<string, any>[] }`
|
|
89
|
+
*/
|
|
90
|
+
buildManifest(): {
|
|
91
|
+
metadata: Record<string, any>;
|
|
92
|
+
components: Record<string, any>[];
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Returns the flat list of all registered component dicts.
|
|
96
|
+
*
|
|
97
|
+
* @returns An array of wire-format component objects, in registration order.
|
|
98
|
+
*/
|
|
99
|
+
componentsList(): Record<string, any>[];
|
|
100
|
+
/**
|
|
101
|
+
* Returns the full manifest as a pretty-printed JSON string.
|
|
102
|
+
*
|
|
103
|
+
* Typically used as the final line of a manifest file to emit the output:
|
|
104
|
+
* `console.log(manifest.preview())`.
|
|
105
|
+
*
|
|
106
|
+
* @returns Indented JSON string of the complete manifest.
|
|
107
|
+
*/
|
|
108
|
+
preview(): string;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=manifest-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-builder.d.ts","sourceRoot":"","sources":["../../src/lib/manifest/manifest-builder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,6EAA6E;IAC7E,SAAS,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC/C;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,eAAgB,YAAW,aAAa;IACnD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA2B;IAEvD;;;OAGG;gBACS,KAAK,EAAE,oBAAoB;IASvC;;;OAGG;IACH,SAAS,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI;IAO7C;;;;OAIG;IACH,aAAa,IAAI;QAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAA;KAAE;IAYrF;;;;OAIG;IACH,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;IAIvC;;;;;;;OAOG;IACH,OAAO,IAAI,MAAM;CAGlB"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ManifestBuilder = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Root container for a manifest — collects all components and serializes them to JSON.
|
|
6
|
+
*
|
|
7
|
+
* You would normally create one `ManifestBuilder` at the top of your manifest file,
|
|
8
|
+
* then pass it as the scope to all top-level components (categories, custom objects,
|
|
9
|
+
* functions, apps, SDUI pages). Each component auto-registers on construction; there
|
|
10
|
+
* is no separate add or register call.
|
|
11
|
+
*
|
|
12
|
+
* After defining all components, call `preview()` to emit the manifest as a
|
|
13
|
+
* pretty-printed JSON string, or `buildManifest()` to get the plain object.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const manifest = new ManifestBuilder({
|
|
18
|
+
* key: 'gym_membership_management',
|
|
19
|
+
* name: 'Gym Membership Management',
|
|
20
|
+
* description: 'Members, trainers, schedules, and check-in',
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* const category = new Category(manifest, { apiName: 'gym__c', name: 'Gym' });
|
|
24
|
+
* const memberObj = new CustomObject(manifest, { apiName: 'gym_member__c', name: 'Member', category });
|
|
25
|
+
* // ... define fields, rules, list views, etc. ...
|
|
26
|
+
*
|
|
27
|
+
* console.log(manifest.preview());
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
class ManifestBuilder {
|
|
31
|
+
/**
|
|
32
|
+
* @param props - Initialization properties.
|
|
33
|
+
* @throws {Error} If `props.key` is empty or missing.
|
|
34
|
+
*/
|
|
35
|
+
constructor(props) {
|
|
36
|
+
this._components = [];
|
|
37
|
+
if (!props.key) {
|
|
38
|
+
throw new Error('key is required');
|
|
39
|
+
}
|
|
40
|
+
this.key = props.key;
|
|
41
|
+
this.name = props.name || props.key;
|
|
42
|
+
this.description = props.description ?? '';
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @internal Scope hook invoked by child constructors. Components enter the
|
|
46
|
+
* manifest here — there is no other path.
|
|
47
|
+
*/
|
|
48
|
+
_register(component) {
|
|
49
|
+
if (typeof component.toDict !== 'function') {
|
|
50
|
+
throw new TypeError('Component must have a toDict() method');
|
|
51
|
+
}
|
|
52
|
+
this._components.push(component);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Returns the manifest as a plain object with `metadata` and a flat `components` array.
|
|
56
|
+
*
|
|
57
|
+
* @returns `{ metadata: { key, name, description? }, components: Record<string, any>[] }`
|
|
58
|
+
*/
|
|
59
|
+
buildManifest() {
|
|
60
|
+
const metadata = {
|
|
61
|
+
key: this.key,
|
|
62
|
+
name: this.name,
|
|
63
|
+
};
|
|
64
|
+
if (this.description) {
|
|
65
|
+
metadata['description'] = this.description;
|
|
66
|
+
}
|
|
67
|
+
const components = this._components.map((c) => c.toDict());
|
|
68
|
+
return { metadata, components };
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Returns the flat list of all registered component dicts.
|
|
72
|
+
*
|
|
73
|
+
* @returns An array of wire-format component objects, in registration order.
|
|
74
|
+
*/
|
|
75
|
+
componentsList() {
|
|
76
|
+
return this._components.map((c) => c.toDict());
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Returns the full manifest as a pretty-printed JSON string.
|
|
80
|
+
*
|
|
81
|
+
* Typically used as the final line of a manifest file to emit the output:
|
|
82
|
+
* `console.log(manifest.preview())`.
|
|
83
|
+
*
|
|
84
|
+
* @returns Indented JSON string of the complete manifest.
|
|
85
|
+
*/
|
|
86
|
+
preview() {
|
|
87
|
+
return JSON.stringify(this.buildManifest(), null, 2);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.ManifestBuilder = ManifestBuilder;
|
|
91
|
+
//# sourceMappingURL=manifest-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-builder.js","sourceRoot":"","sources":["../../src/lib/manifest/manifest-builder.ts"],"names":[],"mappings":";;;AA8CA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAa,eAAe;IAM1B;;;OAGG;IACH,YAAY,KAA2B;QANtB,gBAAW,GAAwB,EAAE,CAAC;QAOrD,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;QACrC,CAAC;QACD,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,GAAG,CAAC;QACpC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,SAA4B;QACpC,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;YAC3C,MAAM,IAAI,SAAS,CAAC,uCAAuC,CAAC,CAAC;QAC/D,CAAC;QACD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,aAAa;QACX,MAAM,QAAQ,GAAwB;YACpC,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;QACF,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,QAAQ,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC;QAC7C,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QAC3D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;OAOG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACvD,CAAC;CACF;AAnED,0CAmEC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Root container for a manifest — collects all components and serializes them to JSON.
|
|
3
|
+
*
|
|
4
|
+
* You would normally create one `ManifestBuilder` at the top of your manifest file,
|
|
5
|
+
* then pass it as the scope to all top-level components (categories, custom objects,
|
|
6
|
+
* functions, apps, SDUI pages). Each component auto-registers on construction; there
|
|
7
|
+
* is no separate add or register call.
|
|
8
|
+
*
|
|
9
|
+
* After defining all components, call `preview()` to emit the manifest as a
|
|
10
|
+
* pretty-printed JSON string, or `buildManifest()` to get the plain object.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const manifest = new ManifestBuilder({
|
|
15
|
+
* key: 'gym_membership_management',
|
|
16
|
+
* name: 'Gym Membership Management',
|
|
17
|
+
* description: 'Members, trainers, schedules, and check-in',
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* const category = new Category(manifest, { apiName: 'gym__c', name: 'Gym' });
|
|
21
|
+
* const memberObj = new CustomObject(manifest, { apiName: 'gym_member__c', name: 'Member', category });
|
|
22
|
+
* // ... define fields, rules, list views, etc. ...
|
|
23
|
+
*
|
|
24
|
+
* console.log(manifest.preview());
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export class ManifestBuilder {
|
|
28
|
+
/**
|
|
29
|
+
* @param props - Initialization properties.
|
|
30
|
+
* @throws {Error} If `props.key` is empty or missing.
|
|
31
|
+
*/
|
|
32
|
+
constructor(props) {
|
|
33
|
+
this._components = [];
|
|
34
|
+
if (!props.key) {
|
|
35
|
+
throw new Error('key is required');
|
|
36
|
+
}
|
|
37
|
+
this.key = props.key;
|
|
38
|
+
this.name = props.name || props.key;
|
|
39
|
+
this.description = props.description ?? '';
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @internal Scope hook invoked by child constructors. Components enter the
|
|
43
|
+
* manifest here — there is no other path.
|
|
44
|
+
*/
|
|
45
|
+
_register(component) {
|
|
46
|
+
if (typeof component.toDict !== 'function') {
|
|
47
|
+
throw new TypeError('Component must have a toDict() method');
|
|
48
|
+
}
|
|
49
|
+
this._components.push(component);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Returns the manifest as a plain object with `metadata` and a flat `components` array.
|
|
53
|
+
*
|
|
54
|
+
* @returns `{ metadata: { key, name, description? }, components: Record<string, any>[] }`
|
|
55
|
+
*/
|
|
56
|
+
buildManifest() {
|
|
57
|
+
const metadata = {
|
|
58
|
+
key: this.key,
|
|
59
|
+
name: this.name,
|
|
60
|
+
};
|
|
61
|
+
if (this.description) {
|
|
62
|
+
metadata['description'] = this.description;
|
|
63
|
+
}
|
|
64
|
+
const components = this._components.map((c) => c.toDict());
|
|
65
|
+
return { metadata, components };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Returns the flat list of all registered component dicts.
|
|
69
|
+
*
|
|
70
|
+
* @returns An array of wire-format component objects, in registration order.
|
|
71
|
+
*/
|
|
72
|
+
componentsList() {
|
|
73
|
+
return this._components.map((c) => c.toDict());
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Returns the full manifest as a pretty-printed JSON string.
|
|
77
|
+
*
|
|
78
|
+
* Typically used as the final line of a manifest file to emit the output:
|
|
79
|
+
* `console.log(manifest.preview())`.
|
|
80
|
+
*
|
|
81
|
+
* @returns Indented JSON string of the complete manifest.
|
|
82
|
+
*/
|
|
83
|
+
preview() {
|
|
84
|
+
return JSON.stringify(this.buildManifest(), null, 2);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=manifest-builder.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-builder.mjs","sourceRoot":"","sources":["../../src/lib/manifest/manifest-builder.ts"],"names":[],"mappings":"AA8CA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,eAAe;IAM1B;;;OAGG;IACH,YAAY,KAA2B;QANtB,gBAAW,GAAwB,EAAE,CAAC;QAOrD,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;QACrC,CAAC;QACD,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,GAAG,CAAC;QACpC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,SAA4B;QACpC,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;YAC3C,MAAM,IAAI,SAAS,CAAC,uCAAuC,CAAC,CAAC;QAC/D,CAAC;QACD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,aAAa;QACX,MAAM,QAAQ,GAAwB;YACpC,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;QACF,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,QAAQ,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC;QAC7C,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QAC3D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;OAOG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACvD,CAAC;CACF"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { FunctionRuntime } from "./_helpers.mjs";
|
|
2
|
+
import type { ManifestScope } from "./manifest-builder.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Initialization properties for {@link ManifestFunction}.
|
|
5
|
+
*/
|
|
6
|
+
export interface ManifestFunctionProps {
|
|
7
|
+
/**
|
|
8
|
+
* Unique identifier for this function (e.g. `'gym_today_schedule_fn'`).
|
|
9
|
+
*
|
|
10
|
+
* Required.
|
|
11
|
+
*/
|
|
12
|
+
apiName: string;
|
|
13
|
+
/**
|
|
14
|
+
* Display name shown in the Rippling UI.
|
|
15
|
+
*
|
|
16
|
+
* Required.
|
|
17
|
+
*/
|
|
18
|
+
name: string;
|
|
19
|
+
/**
|
|
20
|
+
* TypeScript handler source code. Must export an `onRipplingEvent` function.
|
|
21
|
+
*
|
|
22
|
+
* Optional. @default `''`
|
|
23
|
+
*/
|
|
24
|
+
code?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Human-readable description of what this function does.
|
|
27
|
+
*
|
|
28
|
+
* Optional. @default `''`
|
|
29
|
+
*/
|
|
30
|
+
description?: string;
|
|
31
|
+
/**
|
|
32
|
+
* NPM package dependencies as a `{ packageName: versionRange }` map
|
|
33
|
+
* (e.g. `{ '@rippling/rippling-sdk': '^0.2.0' }`).
|
|
34
|
+
*
|
|
35
|
+
* Optional. @default null
|
|
36
|
+
*/
|
|
37
|
+
dependencies?: Record<string, string>;
|
|
38
|
+
/**
|
|
39
|
+
* Raw deployment options object. Prefer `runtime` for the common case.
|
|
40
|
+
*
|
|
41
|
+
* Optional. @default null
|
|
42
|
+
*/
|
|
43
|
+
deploymentOptions?: Record<string, any>;
|
|
44
|
+
/**
|
|
45
|
+
* Deployment runtime shorthand. Sets `deploymentOptions.runtime` and is merged
|
|
46
|
+
* with any explicit `deploymentOptions`. One of `'cloudflare-js'` | `'lambda-deno'`
|
|
47
|
+
* | `'lambda-python'`.
|
|
48
|
+
*
|
|
49
|
+
* Optional.
|
|
50
|
+
*/
|
|
51
|
+
runtime?: FunctionRuntime;
|
|
52
|
+
/**
|
|
53
|
+
* Outbound domain allowlist. Requests to domains not in this list will be blocked.
|
|
54
|
+
*
|
|
55
|
+
* Optional. @default null
|
|
56
|
+
*/
|
|
57
|
+
allowedDomains?: string[];
|
|
58
|
+
/**
|
|
59
|
+
* Whether this function runs asynchronously (fire-and-forget).
|
|
60
|
+
*
|
|
61
|
+
* Optional. @default `false`
|
|
62
|
+
*/
|
|
63
|
+
isAsync?: boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Defines a serverless function and registers it with the manifest.
|
|
67
|
+
*
|
|
68
|
+
* A `ManifestFunction` packages TypeScript handler code that runs on Rippling's
|
|
69
|
+
* serverless infrastructure. Functions are the backing implementation for
|
|
70
|
+
* {@link SduiPage} surfaces. The handler must export `onRipplingEvent`.
|
|
71
|
+
*
|
|
72
|
+
* This class is named `ManifestFunction` to avoid collision with the JavaScript
|
|
73
|
+
* built-in `Function`. It is also re-exported as `Function` from the barrel for
|
|
74
|
+
* convenience.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* const todayScheduleFn = new ManifestFunction(manifest, {
|
|
79
|
+
* apiName: 'gym_today_schedule_fn',
|
|
80
|
+
* name: 'Today\'s schedule (SDUI)',
|
|
81
|
+
* description: 'Searchable grid of class sessions',
|
|
82
|
+
* runtime: 'lambda-deno',
|
|
83
|
+
* code: handlerSource,
|
|
84
|
+
* dependencies: {
|
|
85
|
+
* '@rippling/rippling-sdk': '^0.2.0-alpha.33',
|
|
86
|
+
* '@rippling/sdui-builder': '^0.1.0',
|
|
87
|
+
* },
|
|
88
|
+
* isAsync: false,
|
|
89
|
+
* });
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @see {@link SduiPage} — wraps a `ManifestFunction` as a navigable UI surface.
|
|
93
|
+
*/
|
|
94
|
+
export declare class ManifestFunction {
|
|
95
|
+
private readonly _apiName;
|
|
96
|
+
private readonly _name;
|
|
97
|
+
private readonly _code;
|
|
98
|
+
private readonly _description;
|
|
99
|
+
private readonly _dependencies;
|
|
100
|
+
private readonly _deploymentOptions;
|
|
101
|
+
private readonly _allowedDomains;
|
|
102
|
+
private readonly _isAsync;
|
|
103
|
+
/**
|
|
104
|
+
* @param scope - The manifest to register this function with.
|
|
105
|
+
* @param props - Initialization properties.
|
|
106
|
+
*/
|
|
107
|
+
constructor(scope: ManifestScope, props: ManifestFunctionProps);
|
|
108
|
+
/**
|
|
109
|
+
* Returns the api_name of this function (e.g. `'gym_today_schedule_fn'`).
|
|
110
|
+
*/
|
|
111
|
+
getApiName(): string;
|
|
112
|
+
/**
|
|
113
|
+
* Serializes this function to the wire format consumed by the manifest install endpoint.
|
|
114
|
+
*
|
|
115
|
+
* @returns A plain object with `type: 'FUNCTION'`. Empty or unset optional fields are omitted.
|
|
116
|
+
*/
|
|
117
|
+
toDict(): Record<string, any>;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=manifest-function.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-function.d.mts","sourceRoot":"","sources":["../../src/lib/manifest/manifest-function.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,eAAe,EAAE;OACxB,KAAK,EAAE,aAAa,EAAE;AAE7B;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACxC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqC;IACnE,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAkC;IACrE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAuB;IACvD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IAEnC;;;OAGG;gBACS,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,qBAAqB;IAe9D;;OAEG;IACH,UAAU,IAAI,MAAM;IAIpB;;;;OAIG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAc9B"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { FunctionRuntime } from "./_helpers.js";
|
|
2
|
+
import type { ManifestScope } from "./manifest-builder.js";
|
|
3
|
+
/**
|
|
4
|
+
* Initialization properties for {@link ManifestFunction}.
|
|
5
|
+
*/
|
|
6
|
+
export interface ManifestFunctionProps {
|
|
7
|
+
/**
|
|
8
|
+
* Unique identifier for this function (e.g. `'gym_today_schedule_fn'`).
|
|
9
|
+
*
|
|
10
|
+
* Required.
|
|
11
|
+
*/
|
|
12
|
+
apiName: string;
|
|
13
|
+
/**
|
|
14
|
+
* Display name shown in the Rippling UI.
|
|
15
|
+
*
|
|
16
|
+
* Required.
|
|
17
|
+
*/
|
|
18
|
+
name: string;
|
|
19
|
+
/**
|
|
20
|
+
* TypeScript handler source code. Must export an `onRipplingEvent` function.
|
|
21
|
+
*
|
|
22
|
+
* Optional. @default `''`
|
|
23
|
+
*/
|
|
24
|
+
code?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Human-readable description of what this function does.
|
|
27
|
+
*
|
|
28
|
+
* Optional. @default `''`
|
|
29
|
+
*/
|
|
30
|
+
description?: string;
|
|
31
|
+
/**
|
|
32
|
+
* NPM package dependencies as a `{ packageName: versionRange }` map
|
|
33
|
+
* (e.g. `{ '@rippling/rippling-sdk': '^0.2.0' }`).
|
|
34
|
+
*
|
|
35
|
+
* Optional. @default null
|
|
36
|
+
*/
|
|
37
|
+
dependencies?: Record<string, string>;
|
|
38
|
+
/**
|
|
39
|
+
* Raw deployment options object. Prefer `runtime` for the common case.
|
|
40
|
+
*
|
|
41
|
+
* Optional. @default null
|
|
42
|
+
*/
|
|
43
|
+
deploymentOptions?: Record<string, any>;
|
|
44
|
+
/**
|
|
45
|
+
* Deployment runtime shorthand. Sets `deploymentOptions.runtime` and is merged
|
|
46
|
+
* with any explicit `deploymentOptions`. One of `'cloudflare-js'` | `'lambda-deno'`
|
|
47
|
+
* | `'lambda-python'`.
|
|
48
|
+
*
|
|
49
|
+
* Optional.
|
|
50
|
+
*/
|
|
51
|
+
runtime?: FunctionRuntime;
|
|
52
|
+
/**
|
|
53
|
+
* Outbound domain allowlist. Requests to domains not in this list will be blocked.
|
|
54
|
+
*
|
|
55
|
+
* Optional. @default null
|
|
56
|
+
*/
|
|
57
|
+
allowedDomains?: string[];
|
|
58
|
+
/**
|
|
59
|
+
* Whether this function runs asynchronously (fire-and-forget).
|
|
60
|
+
*
|
|
61
|
+
* Optional. @default `false`
|
|
62
|
+
*/
|
|
63
|
+
isAsync?: boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Defines a serverless function and registers it with the manifest.
|
|
67
|
+
*
|
|
68
|
+
* A `ManifestFunction` packages TypeScript handler code that runs on Rippling's
|
|
69
|
+
* serverless infrastructure. Functions are the backing implementation for
|
|
70
|
+
* {@link SduiPage} surfaces. The handler must export `onRipplingEvent`.
|
|
71
|
+
*
|
|
72
|
+
* This class is named `ManifestFunction` to avoid collision with the JavaScript
|
|
73
|
+
* built-in `Function`. It is also re-exported as `Function` from the barrel for
|
|
74
|
+
* convenience.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* const todayScheduleFn = new ManifestFunction(manifest, {
|
|
79
|
+
* apiName: 'gym_today_schedule_fn',
|
|
80
|
+
* name: 'Today\'s schedule (SDUI)',
|
|
81
|
+
* description: 'Searchable grid of class sessions',
|
|
82
|
+
* runtime: 'lambda-deno',
|
|
83
|
+
* code: handlerSource,
|
|
84
|
+
* dependencies: {
|
|
85
|
+
* '@rippling/rippling-sdk': '^0.2.0-alpha.33',
|
|
86
|
+
* '@rippling/sdui-builder': '^0.1.0',
|
|
87
|
+
* },
|
|
88
|
+
* isAsync: false,
|
|
89
|
+
* });
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @see {@link SduiPage} — wraps a `ManifestFunction` as a navigable UI surface.
|
|
93
|
+
*/
|
|
94
|
+
export declare class ManifestFunction {
|
|
95
|
+
private readonly _apiName;
|
|
96
|
+
private readonly _name;
|
|
97
|
+
private readonly _code;
|
|
98
|
+
private readonly _description;
|
|
99
|
+
private readonly _dependencies;
|
|
100
|
+
private readonly _deploymentOptions;
|
|
101
|
+
private readonly _allowedDomains;
|
|
102
|
+
private readonly _isAsync;
|
|
103
|
+
/**
|
|
104
|
+
* @param scope - The manifest to register this function with.
|
|
105
|
+
* @param props - Initialization properties.
|
|
106
|
+
*/
|
|
107
|
+
constructor(scope: ManifestScope, props: ManifestFunctionProps);
|
|
108
|
+
/**
|
|
109
|
+
* Returns the api_name of this function (e.g. `'gym_today_schedule_fn'`).
|
|
110
|
+
*/
|
|
111
|
+
getApiName(): string;
|
|
112
|
+
/**
|
|
113
|
+
* Serializes this function to the wire format consumed by the manifest install endpoint.
|
|
114
|
+
*
|
|
115
|
+
* @returns A plain object with `type: 'FUNCTION'`. Empty or unset optional fields are omitted.
|
|
116
|
+
*/
|
|
117
|
+
toDict(): Record<string, any>;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=manifest-function.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-function.d.ts","sourceRoot":"","sources":["../../src/lib/manifest/manifest-function.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,eAAe,EAAE;OACxB,KAAK,EAAE,aAAa,EAAE;AAE7B;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACxC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqC;IACnE,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAkC;IACrE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAuB;IACvD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IAEnC;;;OAGG;gBACS,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,qBAAqB;IAe9D;;OAEG;IACH,UAAU,IAAI,MAAM;IAIpB;;;;OAIG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAc9B"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ManifestFunction = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Defines a serverless function and registers it with the manifest.
|
|
6
|
+
*
|
|
7
|
+
* A `ManifestFunction` packages TypeScript handler code that runs on Rippling's
|
|
8
|
+
* serverless infrastructure. Functions are the backing implementation for
|
|
9
|
+
* {@link SduiPage} surfaces. The handler must export `onRipplingEvent`.
|
|
10
|
+
*
|
|
11
|
+
* This class is named `ManifestFunction` to avoid collision with the JavaScript
|
|
12
|
+
* built-in `Function`. It is also re-exported as `Function` from the barrel for
|
|
13
|
+
* convenience.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const todayScheduleFn = new ManifestFunction(manifest, {
|
|
18
|
+
* apiName: 'gym_today_schedule_fn',
|
|
19
|
+
* name: 'Today\'s schedule (SDUI)',
|
|
20
|
+
* description: 'Searchable grid of class sessions',
|
|
21
|
+
* runtime: 'lambda-deno',
|
|
22
|
+
* code: handlerSource,
|
|
23
|
+
* dependencies: {
|
|
24
|
+
* '@rippling/rippling-sdk': '^0.2.0-alpha.33',
|
|
25
|
+
* '@rippling/sdui-builder': '^0.1.0',
|
|
26
|
+
* },
|
|
27
|
+
* isAsync: false,
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @see {@link SduiPage} — wraps a `ManifestFunction` as a navigable UI surface.
|
|
32
|
+
*/
|
|
33
|
+
class ManifestFunction {
|
|
34
|
+
/**
|
|
35
|
+
* @param scope - The manifest to register this function with.
|
|
36
|
+
* @param props - Initialization properties.
|
|
37
|
+
*/
|
|
38
|
+
constructor(scope, props) {
|
|
39
|
+
this._apiName = props.apiName;
|
|
40
|
+
this._name = props.name;
|
|
41
|
+
this._code = props.code ?? '';
|
|
42
|
+
this._description = props.description ?? '';
|
|
43
|
+
this._dependencies = props.dependencies;
|
|
44
|
+
this._deploymentOptions = props.deploymentOptions;
|
|
45
|
+
if (props.runtime) {
|
|
46
|
+
this._deploymentOptions = { ...(this._deploymentOptions ?? {}), runtime: props.runtime };
|
|
47
|
+
}
|
|
48
|
+
this._allowedDomains = props.allowedDomains;
|
|
49
|
+
this._isAsync = props.isAsync ?? false;
|
|
50
|
+
scope._register(this);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Returns the api_name of this function (e.g. `'gym_today_schedule_fn'`).
|
|
54
|
+
*/
|
|
55
|
+
getApiName() {
|
|
56
|
+
return this._apiName;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Serializes this function to the wire format consumed by the manifest install endpoint.
|
|
60
|
+
*
|
|
61
|
+
* @returns A plain object with `type: 'FUNCTION'`. Empty or unset optional fields are omitted.
|
|
62
|
+
*/
|
|
63
|
+
toDict() {
|
|
64
|
+
const component = {
|
|
65
|
+
type: 'FUNCTION',
|
|
66
|
+
name: this._name,
|
|
67
|
+
api_name: this._apiName,
|
|
68
|
+
};
|
|
69
|
+
if (this._description)
|
|
70
|
+
component['description'] = this._description;
|
|
71
|
+
if (this._code)
|
|
72
|
+
component['code_draft'] = this._code;
|
|
73
|
+
if (this._dependencies != null)
|
|
74
|
+
component['dependencies'] = this._dependencies;
|
|
75
|
+
if (this._deploymentOptions != null)
|
|
76
|
+
component['deployment_options'] = this._deploymentOptions;
|
|
77
|
+
if (this._allowedDomains != null)
|
|
78
|
+
component['allowed_domains'] = this._allowedDomains;
|
|
79
|
+
if (this._isAsync)
|
|
80
|
+
component['is_async'] = true;
|
|
81
|
+
return component;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.ManifestFunction = ManifestFunction;
|
|
85
|
+
//# sourceMappingURL=manifest-function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-function.js","sourceRoot":"","sources":["../../src/lib/manifest/manifest-function.ts"],"names":[],"mappings":";;;AAkEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAa,gBAAgB;IAU3B;;;OAGG;IACH,YAAY,KAAoB,EAAE,KAA4B;QAC5D,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC;QAC5C,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,YAAY,CAAC;QACxC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC,iBAAiB,CAAC;QAClD,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YAClB,IAAI,CAAC,kBAAkB,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,kBAAkB,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;QAC3F,CAAC;QACD,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,cAAc,CAAC;QAC5C,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC;QACvC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACH,MAAM;QACJ,MAAM,SAAS,GAAwB;YACrC,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;QACF,IAAI,IAAI,CAAC,YAAY;YAAE,SAAS,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC;QACpE,IAAI,IAAI,CAAC,KAAK;YAAE,SAAS,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QACrD,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI;YAAE,SAAS,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC;QAC/E,IAAI,IAAI,CAAC,kBAAkB,IAAI,IAAI;YAAE,SAAS,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC;QAC/F,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI;YAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC;QACtF,IAAI,IAAI,CAAC,QAAQ;YAAE,SAAS,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;QAChD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAvDD,4CAuDC"}
|