@omni-co/embed 0.13.0 → 0.14.0

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/README.md CHANGED
@@ -210,6 +210,9 @@ type EmbedSsoDashboardProps = {
210
210
  */
211
211
  mode?: EmbedSessionMode;
212
212
 
213
+ // Optional object that determines the model permissions for the embed user.
214
+ modelRoles?: Record<string, EmbedConnectionRoles>;
215
+
213
216
  // Required name of the external user.
214
217
  name: string;
215
218
 
@@ -353,6 +356,9 @@ type EmbedSsoWorkbookProps = {
353
356
  */
354
357
  mode?: EmbedSessionMode;
355
358
 
359
+ // Optional object that determines the model permissions for the embed user.
360
+ modelRoles?: Record<string, EmbedConnectionRoles>;
361
+
356
362
  // Required name of the external user.
357
363
  name: string;
358
364
 
@@ -488,6 +494,9 @@ type EmbedSsoContentDiscoveryProps = {
488
494
  */
489
495
  mode?: EmbedSessionMode;
490
496
 
497
+ // Optional object that determines the model permissions for the embed user.
498
+ modelRoles?: Record<string, EmbedConnectionRoles>;
499
+
491
500
  // Required name of the external user.
492
501
  name: string;
493
502
 
@@ -655,6 +664,9 @@ type CreateSessionTokenProps = {
655
664
  */
656
665
  mode?: EmbedSessionMode;
657
666
 
667
+ // Optional object that determines the model permissions for the embed user.
668
+ modelRoles?: Record<string, EmbedConnectionRoles>;
669
+
658
670
  // Required name of the external user.
659
671
  name: string;
660
672
 
package/lib/cjs/embed.js CHANGED
@@ -54,7 +54,7 @@ const validateProps = (props) => {
54
54
  };
55
55
  const embedSsoContent = async (props) => {
56
56
  validateProps(props);
57
- let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, domain, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, externalId, filterSearchParam, groups: rawGroups, host, linkAccess, mode, name, nonce, organizationName, preserveEntityFolderContentRole, prefersDark, port, secret, theme, uiSettings: rawUiSettings, userAttributes: rawUserAttributes, } = props;
57
+ let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, domain, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, externalId, filterSearchParam, groups: rawGroups, host, linkAccess, mode, modelRoles: rawModelRoles, name, nonce, organizationName, preserveEntityFolderContentRole, prefersDark, port, secret, theme, uiSettings: rawUiSettings, userAttributes: rawUserAttributes, } = props;
58
58
  // Handle defaults
59
59
  nonce = nonce !== null && nonce !== void 0 ? nonce : (await (0, random_str_1.random32ByteString)());
60
60
  const uiSettings = rawUiSettings && JSON.stringify(rawUiSettings);
@@ -62,6 +62,7 @@ const embedSsoContent = async (props) => {
62
62
  const customTheme = rawCustomTheme && JSON.stringify(rawCustomTheme);
63
63
  const connectionRoles = rawConnectionRoles && JSON.stringify(rawConnectionRoles);
64
64
  const groups = rawGroups && JSON.stringify(rawGroups);
65
+ const modelRoles = rawModelRoles && JSON.stringify(rawModelRoles);
65
66
  const url = createEmbedRequestUrl({
66
67
  domain,
67
68
  host,
@@ -93,6 +94,7 @@ const embedSsoContent = async (props) => {
93
94
  groups,
94
95
  linkAccess,
95
96
  mode,
97
+ modelRoles,
96
98
  prefersDark,
97
99
  preserveEntityFolderContentRole,
98
100
  theme,
@@ -119,6 +121,7 @@ const embedSsoContent = async (props) => {
119
121
  connectionRoles &&
120
122
  url.searchParams.append("connectionRoles", connectionRoles);
121
123
  mode && url.searchParams.append("mode", mode);
124
+ modelRoles && url.searchParams.append("modelRoles", modelRoles);
122
125
  entityFolderContentRole &&
123
126
  url.searchParams.append("entityFolderContentRole", entityFolderContentRole);
124
127
  entityFolderGroupContentRole &&
@@ -86,6 +86,10 @@ type SignatureProps = {
86
86
  * The mode of the embedded content.
87
87
  */
88
88
  mode?: string;
89
+ /**
90
+ * The model roles to be associated with the embed user. Expected to be a stringified JSON object.
91
+ */
92
+ modelRoles?: string;
89
93
  /**
90
94
  * Whether the user prefers light, dark, or system theme.
91
95
  */
@@ -131,6 +135,6 @@ type SignSessionRedemptionProps = Pick<SignatureProps, "nonce" | "prefersDark" |
131
135
  */
132
136
  export declare const signSessionRedemption: ({ requestUrl, nonce, sessionId, secret, prefersDark, theme, }: SignSessionRedemptionProps) => string;
133
137
  export declare const TEST_ONLY: {
134
- generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, prefersDark, preserveEntityFolderContentRole, theme, uiSettings, userAttributes, }: Omit<SignatureProps, "secret">) => string;
138
+ generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, modelRoles, prefersDark, preserveEntityFolderContentRole, theme, uiSettings, userAttributes, }: Omit<SignatureProps, "secret">) => string;
135
139
  };
136
140
  export {};
@@ -17,7 +17,7 @@ const generateStringForSignature = ({
17
17
  // Required parameters
18
18
  loginUrl, contentPath, externalId, name, nonce,
19
19
  // Optional parameters
20
- accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, prefersDark, preserveEntityFolderContentRole, theme, uiSettings, userAttributes, }) => {
20
+ accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, modelRoles, prefersDark, preserveEntityFolderContentRole, theme, uiSettings, userAttributes, }) => {
21
21
  // We create a map of optional params and convert it to an array
22
22
  // to ensure that the order of the optional params is alphabetical and consistent.
23
23
  const optionalParamsMap = {
@@ -35,6 +35,7 @@ accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityF
35
35
  ...(groups && { groups }),
36
36
  ...(linkAccess && { linkAccess }),
37
37
  ...(mode && { mode }),
38
+ ...(modelRoles && { modelRoles }),
38
39
  ...(prefersDark && { prefersDark }),
39
40
  ...(preserveEntityFolderContentRole !== undefined && {
40
41
  preserveEntityFolderContentRole: preserveEntityFolderContentRole.toString(),
@@ -47,6 +47,11 @@ type EmbedSsoBaseProps = {
47
47
  * Object values should be connection roles.
48
48
  */
49
49
  connectionRoles?: Record<string, EmbedConnectionRoles>;
50
+ /**
51
+ * Optional model roles setting. Object keys should be model IDs from the embedded Omni instance.
52
+ * Object values should be connection roles.
53
+ */
54
+ modelRoles?: Record<string, EmbedConnectionRoles>;
50
55
  /**
51
56
  * Optional mode setting that determines whether the entire application should be embedded or a single piece of content.
52
57
  *
@@ -254,16 +259,23 @@ export type EmbedSsoContentProps = EmbedSsoBaseProps & EmbedSsoDashboardOnlyProp
254
259
  export type EmbedSsoDashboardProps = EmbedSsoBaseProps & EmbedSsoDashboardOnlyProps & EmbedContentIdProp;
255
260
  export type EmbedSsoWorkbookProps = EmbedSsoBaseProps & EmbedContentIdProp;
256
261
  export type EmbedSsoContentDiscoveryProps = EmbedSsoBaseProps & {
262
+ /**
263
+ * Path name of the content discovery page to embed.
264
+ */
265
+ path: string;
266
+ } & ({
257
267
  /**
258
268
  * Required connection roles object. Object keys should be connection IDs from the embedded Omni instance.
259
269
  * Object values should be connection roles.
260
270
  */
261
271
  connectionRoles: Record<string, EmbedConnectionRoles>;
272
+ } | {
262
273
  /**
263
- * Path name of the content discovery page to embed.
274
+ * Required model roles object. Object keys should be connection IDs from the embedded Omni instance.
275
+ * Object values should be connection roles.
264
276
  */
265
- path: string;
266
- };
277
+ modelRoles: Record<string, EmbedConnectionRoles>;
278
+ });
267
279
  export type CreateSessionTokenProps = Omit<EmbedSsoContentProps, "prefersDark" | "theme" | "secret" | "nonce"> & {
268
280
  apiKey: string;
269
281
  } & HostProps;
package/lib/esm/embed.js CHANGED
@@ -51,7 +51,7 @@ const validateProps = (props) => {
51
51
  };
52
52
  const embedSsoContent = async (props) => {
53
53
  validateProps(props);
54
- let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, domain, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, externalId, filterSearchParam, groups: rawGroups, host, linkAccess, mode, name, nonce, organizationName, preserveEntityFolderContentRole, prefersDark, port, secret, theme, uiSettings: rawUiSettings, userAttributes: rawUserAttributes, } = props;
54
+ let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, domain, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, externalId, filterSearchParam, groups: rawGroups, host, linkAccess, mode, modelRoles: rawModelRoles, name, nonce, organizationName, preserveEntityFolderContentRole, prefersDark, port, secret, theme, uiSettings: rawUiSettings, userAttributes: rawUserAttributes, } = props;
55
55
  // Handle defaults
56
56
  nonce = nonce !== null && nonce !== void 0 ? nonce : (await random32ByteString());
57
57
  const uiSettings = rawUiSettings && JSON.stringify(rawUiSettings);
@@ -59,6 +59,7 @@ const embedSsoContent = async (props) => {
59
59
  const customTheme = rawCustomTheme && JSON.stringify(rawCustomTheme);
60
60
  const connectionRoles = rawConnectionRoles && JSON.stringify(rawConnectionRoles);
61
61
  const groups = rawGroups && JSON.stringify(rawGroups);
62
+ const modelRoles = rawModelRoles && JSON.stringify(rawModelRoles);
62
63
  const url = createEmbedRequestUrl({
63
64
  domain,
64
65
  host,
@@ -90,6 +91,7 @@ const embedSsoContent = async (props) => {
90
91
  groups,
91
92
  linkAccess,
92
93
  mode,
94
+ modelRoles,
93
95
  prefersDark,
94
96
  preserveEntityFolderContentRole,
95
97
  theme,
@@ -116,6 +118,7 @@ const embedSsoContent = async (props) => {
116
118
  connectionRoles &&
117
119
  url.searchParams.append("connectionRoles", connectionRoles);
118
120
  mode && url.searchParams.append("mode", mode);
121
+ modelRoles && url.searchParams.append("modelRoles", modelRoles);
119
122
  entityFolderContentRole &&
120
123
  url.searchParams.append("entityFolderContentRole", entityFolderContentRole);
121
124
  entityFolderGroupContentRole &&
@@ -86,6 +86,10 @@ type SignatureProps = {
86
86
  * The mode of the embedded content.
87
87
  */
88
88
  mode?: string;
89
+ /**
90
+ * The model roles to be associated with the embed user. Expected to be a stringified JSON object.
91
+ */
92
+ modelRoles?: string;
89
93
  /**
90
94
  * Whether the user prefers light, dark, or system theme.
91
95
  */
@@ -131,6 +135,6 @@ type SignSessionRedemptionProps = Pick<SignatureProps, "nonce" | "prefersDark" |
131
135
  */
132
136
  export declare const signSessionRedemption: ({ requestUrl, nonce, sessionId, secret, prefersDark, theme, }: SignSessionRedemptionProps) => string;
133
137
  export declare const TEST_ONLY: {
134
- generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, prefersDark, preserveEntityFolderContentRole, theme, uiSettings, userAttributes, }: Omit<SignatureProps, "secret">) => string;
138
+ generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, modelRoles, prefersDark, preserveEntityFolderContentRole, theme, uiSettings, userAttributes, }: Omit<SignatureProps, "secret">) => string;
135
139
  };
136
140
  export {};
@@ -10,7 +10,7 @@ const generateStringForSignature = ({
10
10
  // Required parameters
11
11
  loginUrl, contentPath, externalId, name, nonce,
12
12
  // Optional parameters
13
- accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, prefersDark, preserveEntityFolderContentRole, theme, uiSettings, userAttributes, }) => {
13
+ accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, modelRoles, prefersDark, preserveEntityFolderContentRole, theme, uiSettings, userAttributes, }) => {
14
14
  // We create a map of optional params and convert it to an array
15
15
  // to ensure that the order of the optional params is alphabetical and consistent.
16
16
  const optionalParamsMap = {
@@ -28,6 +28,7 @@ accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityF
28
28
  ...(groups && { groups }),
29
29
  ...(linkAccess && { linkAccess }),
30
30
  ...(mode && { mode }),
31
+ ...(modelRoles && { modelRoles }),
31
32
  ...(prefersDark && { prefersDark }),
32
33
  ...(preserveEntityFolderContentRole !== undefined && {
33
34
  preserveEntityFolderContentRole: preserveEntityFolderContentRole.toString(),
@@ -47,6 +47,11 @@ type EmbedSsoBaseProps = {
47
47
  * Object values should be connection roles.
48
48
  */
49
49
  connectionRoles?: Record<string, EmbedConnectionRoles>;
50
+ /**
51
+ * Optional model roles setting. Object keys should be model IDs from the embedded Omni instance.
52
+ * Object values should be connection roles.
53
+ */
54
+ modelRoles?: Record<string, EmbedConnectionRoles>;
50
55
  /**
51
56
  * Optional mode setting that determines whether the entire application should be embedded or a single piece of content.
52
57
  *
@@ -254,16 +259,23 @@ export type EmbedSsoContentProps = EmbedSsoBaseProps & EmbedSsoDashboardOnlyProp
254
259
  export type EmbedSsoDashboardProps = EmbedSsoBaseProps & EmbedSsoDashboardOnlyProps & EmbedContentIdProp;
255
260
  export type EmbedSsoWorkbookProps = EmbedSsoBaseProps & EmbedContentIdProp;
256
261
  export type EmbedSsoContentDiscoveryProps = EmbedSsoBaseProps & {
262
+ /**
263
+ * Path name of the content discovery page to embed.
264
+ */
265
+ path: string;
266
+ } & ({
257
267
  /**
258
268
  * Required connection roles object. Object keys should be connection IDs from the embedded Omni instance.
259
269
  * Object values should be connection roles.
260
270
  */
261
271
  connectionRoles: Record<string, EmbedConnectionRoles>;
272
+ } | {
262
273
  /**
263
- * Path name of the content discovery page to embed.
274
+ * Required model roles object. Object keys should be connection IDs from the embedded Omni instance.
275
+ * Object values should be connection roles.
264
276
  */
265
- path: string;
266
- };
277
+ modelRoles: Record<string, EmbedConnectionRoles>;
278
+ });
267
279
  export type CreateSessionTokenProps = Omit<EmbedSsoContentProps, "prefersDark" | "theme" | "secret" | "nonce"> & {
268
280
  apiKey: string;
269
281
  } & HostProps;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.13.0",
2
+ "version": "0.14.0",
3
3
  "license": "MIT",
4
4
  "name": "@omni-co/embed",
5
5
  "author": "Nate Agrin <nate@exploreomni.com>",