@vertesia/common 0.68.0 → 0.70.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.
Files changed (51) hide show
  1. package/lib/cjs/access-control.js +1 -0
  2. package/lib/cjs/access-control.js.map +1 -1
  3. package/lib/cjs/apikey.js.map +1 -1
  4. package/lib/cjs/{plugin.js → apps.js} +1 -1
  5. package/lib/cjs/apps.js.map +1 -0
  6. package/lib/cjs/index.js +1 -1
  7. package/lib/cjs/index.js.map +1 -1
  8. package/lib/cjs/project.js +2 -0
  9. package/lib/cjs/project.js.map +1 -1
  10. package/lib/cjs/user.js +2 -1
  11. package/lib/cjs/user.js.map +1 -1
  12. package/lib/esm/access-control.js +1 -0
  13. package/lib/esm/access-control.js.map +1 -1
  14. package/lib/esm/apikey.js.map +1 -1
  15. package/lib/esm/apps.js +2 -0
  16. package/lib/esm/apps.js.map +1 -0
  17. package/lib/esm/index.js +1 -1
  18. package/lib/esm/index.js.map +1 -1
  19. package/lib/esm/project.js +2 -0
  20. package/lib/esm/project.js.map +1 -1
  21. package/lib/esm/user.js +1 -0
  22. package/lib/esm/user.js.map +1 -1
  23. package/lib/tsconfig.tsbuildinfo +1 -1
  24. package/lib/types/access-control.d.ts +1 -0
  25. package/lib/types/access-control.d.ts.map +1 -1
  26. package/lib/types/apikey.d.ts +14 -0
  27. package/lib/types/apikey.d.ts.map +1 -1
  28. package/lib/types/apps.d.ts +71 -0
  29. package/lib/types/apps.d.ts.map +1 -0
  30. package/lib/types/index.d.ts +1 -1
  31. package/lib/types/index.d.ts.map +1 -1
  32. package/lib/types/project.d.ts +3 -1
  33. package/lib/types/project.d.ts.map +1 -1
  34. package/lib/types/user.d.ts +1 -0
  35. package/lib/types/user.d.ts.map +1 -1
  36. package/lib/vertesia-common.js +1 -1
  37. package/lib/vertesia-common.js.map +1 -1
  38. package/package.json +4 -3
  39. package/src/access-control.ts +1 -0
  40. package/src/apikey.ts +16 -0
  41. package/src/apps.ts +85 -0
  42. package/src/index.ts +1 -2
  43. package/src/project.ts +2 -0
  44. package/src/user.ts +1 -0
  45. package/tsconfig.dist.json +20 -0
  46. package/lib/cjs/plugin.js.map +0 -1
  47. package/lib/esm/plugin.js +0 -2
  48. package/lib/esm/plugin.js.map +0 -1
  49. package/lib/types/plugin.d.ts +0 -54
  50. package/lib/types/plugin.d.ts.map +0 -1
  51. package/src/plugin.ts +0 -58
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@vertesia/common",
3
- "version": "0.68.0",
3
+ "version": "0.70.0",
4
4
  "type": "module",
5
5
  "types": "./lib/types/index.d.ts",
6
6
  "files": [
7
7
  "lib",
8
- "src"
8
+ "src",
9
+ "tsconfig.dist.json"
9
10
  ],
10
11
  "exports": {
11
12
  "types": "./lib/types/index.d.ts",
@@ -26,7 +27,7 @@
26
27
  "dependencies": {
27
28
  "ajv": "^8.16.0",
28
29
  "json-schema": "^0.4.0",
29
- "@llumiverse/common": "0.20.0"
30
+ "@llumiverse/common": "0.21.0"
30
31
  },
31
32
  "ts_dual_module": {
32
33
  "outDir": "lib"
@@ -27,6 +27,7 @@ export enum Permission {
27
27
  api_key_delete = "api_key:delete",
28
28
 
29
29
  account_read = "account:read",
30
+ account_write = "account:write",
30
31
  account_admin = "account:admin",
31
32
  manage_billing = "account:billing",
32
33
  account_member = "account:member",
package/src/apikey.ts CHANGED
@@ -57,9 +57,25 @@ export interface AuthTokenPayload {
57
57
  project?: ProjectRef;
58
58
  project_roles?: ProjectRoles[];
59
59
 
60
+ /**
61
+ * The roles of the user in the application it has access
62
+ * The key is the unique app name (kebab-case) and the value a list of roles.
63
+ */
64
+ apps_roles: Record<string, string[]>,
65
+
60
66
  /** groups */
61
67
  groups?: UserGroupRef[]; //group ids
62
68
 
69
+ /**
70
+ * API endpoints information to be used with this token.
71
+ * Either a n API domain like 'api.vertesia.io' | 'api-preview.vertesia.io' | 'api-staging.vertesia.io' | 'local'
72
+ * or explicit studio and store URLs.
73
+ */
74
+ endpoints?: string | {
75
+ studio: string,
76
+ store: string
77
+ }
78
+
63
79
  iss: string; //issuer
64
80
  aud: string; //audience
65
81
  exp: number; //expires in (EPOC seconds)
package/src/apps.ts ADDED
@@ -0,0 +1,85 @@
1
+
2
+ export interface AppRef {
3
+ id: string;
4
+ name: string;
5
+ }
6
+
7
+ export interface AppUIConfig {
8
+ /**
9
+ * The source URL of the app. The src can be a template which contain
10
+ * a variable named `buildId` which will be replaced with the current build id.
11
+ * For example: `/plugins/vertesia-review-center-${buildId}`
12
+ */
13
+ src: string;
14
+ /**
15
+ * Whether the app should be loaded as part of the host layout
16
+ * or in a new tab.
17
+ */
18
+ external?: boolean;
19
+ }
20
+
21
+ export interface AppManifestData {
22
+ /**
23
+ * The name of the app, used as the id in the system.
24
+ * Must be in kebab case (e.g. my-app).
25
+ */
26
+ name: string;
27
+
28
+ /**
29
+ * Which account is ownning the app.
30
+ * The property is defined only for customer apps.
31
+ * THis is always undefined for vertesia apps.
32
+ */
33
+ account?: string;
34
+
35
+ /**
36
+ * Whether the app is private to the owner account.
37
+ * If true the account property must be defined.
38
+ */
39
+ private?: boolean;
40
+
41
+ title: string;
42
+ description: string;
43
+ publisher: string;
44
+
45
+ /**
46
+ * A svg icon for the app.
47
+ */
48
+ icon?: string;
49
+
50
+ status: "beta" | "stable" | "deprecated" | "hidden"
51
+
52
+ ui?: AppUIConfig
53
+
54
+ /**
55
+ * A list of tool collections endpoints to be used by this app.
56
+ * A tools collection endpoint is an URL which may end with a `?import` query string.
57
+ * If the `?import` query string is used the tool will be imported as a javascript module and not executed through a POST on the collections endpoint.
58
+ */
59
+ tool_collections?: string[]
60
+ }
61
+ export interface AppManifest extends AppManifestData {
62
+ id: string;
63
+ created_at: string;
64
+ updated_at: string;
65
+ }
66
+
67
+ export interface AppInstallation {
68
+ id: string;
69
+ project: string; // the project where the app is installed
70
+ manifest: string; // the app manifest
71
+ settings?: Record<string, any>; // settings for the app installation
72
+ created_at: string;
73
+ updated_at: string;
74
+ }
75
+
76
+ export interface AppInstallationWithManifest extends Omit<AppInstallation, 'manifest'> {
77
+ manifest: AppManifest; // the app manifest data
78
+ }
79
+
80
+ export interface AppInstallationPayload {
81
+ app_id: string,
82
+ settings?: Record<string, any>
83
+ }
84
+
85
+ export type AppInstallationKind = 'ui' | 'tools' | 'all';
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './access-control.js';
2
2
  export * from './analytics.js';
3
3
  export * from './apikey.js';
4
+ export * from './apps.js';
4
5
  export * from './common.js';
5
6
  export * from './environment.js';
6
7
  export * from "./facets.js";
@@ -12,7 +13,6 @@ export * from './json.js';
12
13
  export * from './meters.js';
13
14
  export * from './model_utility.js';
14
15
  export * from './payload.js';
15
- export * from "./plugin.js";
16
16
  export * from "./Progress.js";
17
17
  export * from './project.js';
18
18
  export * from './prompt.js';
@@ -26,4 +26,3 @@ export * from './transient-tokens.js';
26
26
  export * from './user.js';
27
27
  export * from './utils/auth.js';
28
28
  export * from './utils/schemas.js';
29
-
package/src/project.ts CHANGED
@@ -17,6 +17,8 @@ export enum ProjectRoles {
17
17
  reader = "reader", // can only read (browse)
18
18
  billing = "billing", // can only manage billings
19
19
  member = "member", // can only access, but no specific permissions
20
+ app_user = "app_user", // can access and perform read/write operations in the context of an app
21
+ app_reader = "app_reader", // can access and perform read operations in the context of an app
20
22
  }
21
23
 
22
24
  export function isRoleIncludedIn(role: string, includingRole: string) {
package/src/user.ts CHANGED
@@ -81,6 +81,7 @@ export interface AccountRef {
81
81
  }
82
82
  export const AccountRefPopulate = "id name";
83
83
 
84
+ export const AppRefPopulate = "id name";
84
85
 
85
86
  export interface InviteUserRequestPayload {
86
87
  email: string;
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "declaration": true,
5
+ "declarationMap": true,
6
+ "jsx": "react-jsx",
7
+ "target": "ES2022",
8
+ "module": "ESNext",
9
+ "moduleResolution": "Bundler",
10
+ "rootDir": "./src",
11
+ "outDir": "./lib"
12
+ },
13
+ "include": [
14
+ "src"
15
+ ],
16
+ "exclude": [
17
+ "**/*.test.*",
18
+ "**/*.spec.*"
19
+ ]
20
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":""}
package/lib/esm/plugin.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":""}
@@ -1,54 +0,0 @@
1
- import { JSONObject, ToolDefinition, ToolUse } from "@llumiverse/common";
2
- import { AsyncConversationExecutionPayload } from "./interaction.js";
3
- import { WorkflowExecutionBaseParams } from "./store/index.js";
4
- /**
5
- * A vertesia plugin manifest
6
- */
7
- export interface PluginManifest<MetaT = any> {
8
- id: string;
9
- /**
10
- * The kind of the plugin.
11
- */
12
- kind: "ui" | "tool";
13
- /**
14
- * A metadata field which can be used for each kind of plugin to store additional data
15
- */
16
- metadata?: MetaT;
17
- src: string;
18
- name: string;
19
- version: string;
20
- publisher: string;
21
- title?: string;
22
- description?: string;
23
- icon?: string;
24
- /**
25
- * Whether the plugin should be loaded as part of the host layout
26
- * or in a new tab.
27
- * If external is true, the plugin must manage itself the global layout of the page.
28
- * It will be loaded in a new tab.
29
- * If external is false the plugin will be loaded as a page of the host application and it will share the same layout.
30
- * Default is false.
31
- * This is only usefull for UI plugins.
32
- */
33
- external?: boolean;
34
- /**
35
- * The default is "beta".
36
- */
37
- status?: "beta" | "stable" | "deprecated" | "hidden";
38
- }
39
- export interface UIPluginManifest extends PluginManifest {
40
- kind: "ui";
41
- metadata: never;
42
- }
43
- export interface ToolPluginManifest extends PluginManifest {
44
- kind: "tool";
45
- /**
46
- * The definitions of the exported tools
47
- */
48
- metadata: ToolDefinition[];
49
- }
50
- export interface PluginToolContext<ParamsT = JSONObject> {
51
- payload: WorkflowExecutionBaseParams<AsyncConversationExecutionPayload>;
52
- tool_use: ToolUse<ParamsT>;
53
- plugin: string;
54
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,iCAAiC,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,KAAK,GAAG,GAAG;IACvC,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,YAAY,GAAG,QAAQ,CAAC;CACxD;AAED,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACpD,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,KAAK,CAAC;CACnB;AAED,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACtD,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB,CAAC,OAAO,GAAG,UAAU;IACnD,OAAO,EAAE,2BAA2B,CAAC,iCAAiC,CAAC,CAAC;IACxE,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;CAClB"}
package/src/plugin.ts DELETED
@@ -1,58 +0,0 @@
1
- import { JSONObject, ToolDefinition, ToolUse } from "@llumiverse/common";
2
- import { AsyncConversationExecutionPayload } from "./interaction.js";
3
- import { WorkflowExecutionBaseParams } from "./store/index.js";
4
-
5
- /**
6
- * A vertesia plugin manifest
7
- */
8
- export interface PluginManifest<MetaT = any> {
9
- id: string;
10
- /**
11
- * The kind of the plugin.
12
- */
13
- kind: "ui" | "tool";
14
- /**
15
- * A metadata field which can be used for each kind of plugin to store additional data
16
- */
17
- metadata?: MetaT;
18
- src: string;
19
- name: string;
20
- version: string;
21
- publisher: string;
22
- title?: string;
23
- description?: string;
24
- icon?: string;
25
- /**
26
- * Whether the plugin should be loaded as part of the host layout
27
- * or in a new tab.
28
- * If external is true, the plugin must manage itself the global layout of the page.
29
- * It will be loaded in a new tab.
30
- * If external is false the plugin will be loaded as a page of the host application and it will share the same layout.
31
- * Default is false.
32
- * This is only usefull for UI plugins.
33
- */
34
- external?: boolean;
35
- /**
36
- * The default is "beta".
37
- */
38
- status?: "beta" | "stable" | "deprecated" | "hidden";
39
- }
40
-
41
- export interface UIPluginManifest extends PluginManifest {
42
- kind: "ui";
43
- metadata: never;
44
- }
45
-
46
- export interface ToolPluginManifest extends PluginManifest {
47
- kind: "tool";
48
- /**
49
- * The definitions of the exported tools
50
- */
51
- metadata: ToolDefinition[];
52
- }
53
-
54
- export interface PluginToolContext<ParamsT = JSONObject> {
55
- payload: WorkflowExecutionBaseParams<AsyncConversationExecutionPayload>;
56
- tool_use: ToolUse<ParamsT>; //params?
57
- plugin: string; // plugin id
58
- }