@forge/bridge 5.7.1-next.1 → 5.8.0-next.10

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/CHANGELOG.md CHANGED
@@ -1,5 +1,64 @@
1
1
  # @forge/bridge
2
2
 
3
+ ## 5.8.0-next.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [d00ef59]
8
+ - @forge/manifest@11.0.0-next.6
9
+
10
+ ## 5.8.0-next.9
11
+
12
+ ### Minor Changes
13
+
14
+ - 617c3d9: Add base64 support to upload bridge method
15
+
16
+ ## 5.8.0-next.8
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [f0a5a03]
21
+ - @forge/manifest@11.0.0-next.5
22
+
23
+ ## 5.8.0-next.7
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies [3228cf0]
28
+ - @forge/manifest@11.0.0-next.4
29
+
30
+ ## 5.8.0-next.6
31
+
32
+ ### Minor Changes
33
+
34
+ - a4bccb7: Export FOS bridge methods and fixing bugs
35
+
36
+ ## 5.8.0-next.5
37
+
38
+ ### Minor Changes
39
+
40
+ - 08fbb0a: Add rovo.open bridge method that opens rovo chat
41
+
42
+ ## 5.8.0-next.4
43
+
44
+ ### Patch Changes
45
+
46
+ - Updated dependencies [78efec7]
47
+ - @forge/manifest@11.0.0-next.3
48
+
49
+ ## 5.8.0-next.3
50
+
51
+ ### Patch Changes
52
+
53
+ - Updated dependencies [260eb24]
54
+ - @forge/manifest@11.0.0-next.2
55
+
56
+ ## 5.8.0-next.2
57
+
58
+ ### Minor Changes
59
+
60
+ - 1d129f0: Allow objects in event payloads. The object must be JSON-serializable.
61
+
3
62
  ## 5.7.1-next.1
4
63
 
5
64
  ### Patch Changes
package/out/index.d.ts CHANGED
@@ -8,7 +8,9 @@ export * from './fetch';
8
8
  export * from './flag';
9
9
  export * from './events';
10
10
  export * from './realtime';
11
+ export * from './rovo';
11
12
  export * as i18n from './i18n';
13
+ export * from './object-store';
12
14
  export { type FullContext } from './types';
13
15
  export * from './featureFlags';
14
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,cAAc,gBAAgB,CAAC"}
package/out/index.js CHANGED
@@ -13,5 +13,7 @@ tslib_1.__exportStar(require("./fetch"), exports);
13
13
  tslib_1.__exportStar(require("./flag"), exports);
14
14
  tslib_1.__exportStar(require("./events"), exports);
15
15
  tslib_1.__exportStar(require("./realtime"), exports);
16
+ tslib_1.__exportStar(require("./rovo"), exports);
16
17
  exports.i18n = tslib_1.__importStar(require("./i18n"));
18
+ tslib_1.__exportStar(require("./object-store"), exports);
17
19
  tslib_1.__exportStar(require("./featureFlags"), exports);
@@ -2,4 +2,4 @@ export declare const deleteObjects: ({ functionKey, keys }: {
2
2
  functionKey: string;
3
3
  keys: string[];
4
4
  }) => Promise<void>;
5
- //# sourceMappingURL=delete.d.ts.map
5
+ //# sourceMappingURL=deleteObjects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteObjects.d.ts","sourceRoot":"","sources":["../../src/object-store/deleteObjects.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,aAAa;iBAAgD,MAAM;UAAQ,MAAM,EAAE;MAAK,QAAQ,IAAI,CAchH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './objectStore';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/object-store/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./objectStore"), exports);
@@ -0,0 +1,19 @@
1
+ export declare const objectStore: {
2
+ upload: ({ functionKey, objects }: {
3
+ functionKey: string;
4
+ objects: import("./types").UploadObject[];
5
+ }) => Promise<import("./types").UploadResult[]>;
6
+ download: ({ functionKey, keys }: {
7
+ functionKey: string;
8
+ keys: string[];
9
+ }) => Promise<import("./types").DownloadResult[]>;
10
+ getMetadata: ({ functionKey, keys }: {
11
+ functionKey: string;
12
+ keys: string[];
13
+ }) => Promise<import("./types").GetMetadataResult[]>;
14
+ deleteObjects: ({ functionKey, keys }: {
15
+ functionKey: string;
16
+ keys: string[];
17
+ }) => Promise<void>;
18
+ };
19
+ //# sourceMappingURL=objectStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objectStore.d.ts","sourceRoot":"","sources":["../../src/object-store/objectStore.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;CAKvB,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.objectStore = void 0;
4
+ const upload_1 = require("./upload");
5
+ const deleteObjects_1 = require("./deleteObjects");
6
+ const download_1 = require("./download");
7
+ const getMetadata_1 = require("./getMetadata");
8
+ exports.objectStore = {
9
+ upload: upload_1.upload,
10
+ download: download_1.download,
11
+ getMetadata: getMetadata_1.getMetadata,
12
+ deleteObjects: deleteObjects_1.deleteObjects
13
+ };
@@ -3,6 +3,11 @@ export declare type ObjectMetadata = {
3
3
  checksum: string;
4
4
  checksumType: string;
5
5
  };
6
+ export declare type Base64Object = {
7
+ data: string;
8
+ mimeType?: string;
9
+ };
10
+ export declare type UploadObject = Blob | Base64Object;
6
11
  export declare type FileMetadata = ObjectMetadata & {
7
12
  key: string;
8
13
  ttlSeconds?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/object-store/types.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,oBAAY,YAAY,GAAG,cAAc,GAAG;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,oBAAY,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,oBAAY,cAAc,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,oBAAY,mBAAmB,GAAG;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC;CAC7B,CAAC;AAEF,oBAAY,kBAAkB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAE3D,oBAAY,iBAAiB,GAAG;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/object-store/types.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,oBAAY,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,oBAAY,YAAY,GAAG,IAAI,GAAG,YAAY,CAAC;AAE/C,oBAAY,YAAY,GAAG,cAAc,GAAG;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,oBAAY,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,oBAAY,cAAc,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,oBAAY,mBAAmB,GAAG;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC;CAC7B,CAAC;AAEF,oBAAY,kBAAkB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAE3D,oBAAY,iBAAiB,GAAG;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC"}
@@ -1,6 +1,6 @@
1
- import type { UploadResult } from './types';
1
+ import type { UploadResult, UploadObject } from './types';
2
2
  export declare const upload: ({ functionKey, objects }: {
3
3
  functionKey: string;
4
- objects: Blob[];
4
+ objects: UploadObject[];
5
5
  }) => Promise<UploadResult[]>;
6
6
  //# sourceMappingURL=upload.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/object-store/upload.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuC,YAAY,EAAE,MAAM,SAAS,CAAC;AA8BjF,eAAO,MAAM,MAAM;iBAIJ,MAAM;aACV,IAAI,EAAE;MACb,QAAQ,YAAY,EAAE,CAkEzB,CAAC"}
1
+ {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/object-store/upload.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuC,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA4C/F,eAAO,MAAM,MAAM;iBAIJ,MAAM;aACV,YAAY,EAAE;MACrB,QAAQ,YAAY,EAAE,CAuFzB,CAAC"}
@@ -3,13 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.upload = void 0;
4
4
  const invoke_1 = require("../invoke");
5
5
  const errors_1 = require("../errors");
6
+ const base64ToBlob = (base64, mimeType) => {
7
+ const byteCharacters = atob(base64);
8
+ const byteNumbers = new Array(byteCharacters.length);
9
+ for (let i = 0; i < byteCharacters.length; i++) {
10
+ byteNumbers[i] = byteCharacters.charCodeAt(i);
11
+ }
12
+ const byteArray = new Uint8Array(byteNumbers);
13
+ return new Blob([byteArray], { type: mimeType || 'application/octet-stream' });
14
+ };
6
15
  const getObjectMetadata = async (blob) => {
7
16
  const length = blob.size;
8
17
  const arrayBuffer = await blob.arrayBuffer();
9
18
  const hashBuffer = await crypto.subtle.digest('SHA-256', arrayBuffer);
10
- const hashArray = Array.from(new Uint8Array(hashBuffer));
11
- const checksum = hashArray.map((b) => b.toString(16).padStart(2, '0')).join('');
12
- const checksumType = 'SHA-256';
19
+ const hashArray = new Uint8Array(hashBuffer);
20
+ const checksum = btoa(String.fromCharCode(...hashArray));
21
+ const checksumType = 'SHA256';
13
22
  return {
14
23
  length,
15
24
  checksum,
@@ -23,7 +32,22 @@ const upload = async ({ functionKey, objects }) => {
23
32
  if (!Array.isArray(objects) || objects.length === 0) {
24
33
  throw new errors_1.BridgeAPIError('objects array is required and must not be empty');
25
34
  }
26
- const allObjectMetadata = await Promise.all(objects.map((obj) => getObjectMetadata(obj)));
35
+ const blobs = objects.map((obj, index) => {
36
+ if (obj instanceof Blob) {
37
+ return obj;
38
+ }
39
+ const isBase64Object = obj && typeof obj === 'object' && 'data' in obj && typeof obj.data === 'string';
40
+ if (!isBase64Object) {
41
+ throw new errors_1.BridgeAPIError(`Invalid object type at index ${index}. Only Blob or Base64Object (with data string and optional mimeType) are accepted.`);
42
+ }
43
+ try {
44
+ return base64ToBlob(obj.data, obj.mimeType);
45
+ }
46
+ catch (e) {
47
+ throw new errors_1.BridgeAPIError(`Invalid base64 data at index ${index}. The data string must be valid base64 encoded.`);
48
+ }
49
+ });
50
+ const allObjectMetadata = await Promise.all(blobs.map((blob) => getObjectMetadata(blob)));
27
51
  const presignedURLsToObjectMetadata = (await (0, invoke_1.invoke)(functionKey, {
28
52
  allObjectMetadata
29
53
  }));
@@ -31,7 +55,7 @@ const upload = async ({ functionKey, objects }) => {
31
55
  throw new errors_1.BridgeAPIError('Invalid response from functionKey');
32
56
  }
33
57
  const checksumToBlobMap = new Map();
34
- objects.forEach((blob, index) => {
58
+ blobs.forEach((blob, index) => {
35
59
  const metadata = allObjectMetadata[index];
36
60
  checksumToBlobMap.set(metadata.checksum, blob);
37
61
  });
@@ -17,10 +17,10 @@ interface Subscription {
17
17
  unsubscribe: () => Promise<void>;
18
18
  }
19
19
  export declare const realtime: {
20
- publish: (channel: string, payload: any, options?: PublishOptions) => Promise<PublishResult>;
21
- subscribe: (channel: string, callback: (payload?: any) => any, options?: SubscriptionOptions) => Promise<Subscription>;
22
- publishGlobal: (channel: string, payload: any, options?: PublishOptions) => Promise<PublishResult>;
23
- subscribeGlobal: (channel: string, callback: (payload?: any) => any, options?: SubscriptionOptions) => Promise<Subscription>;
20
+ publish: <T extends Record<string, unknown>>(channel: string, payload: string | T, options?: PublishOptions) => Promise<PublishResult>;
21
+ subscribe: (channel: string, callback: <T_1 extends Record<string, unknown>>(payload: string | T_1, error?: Error) => any, options?: SubscriptionOptions) => Promise<Subscription>;
22
+ publishGlobal: <T_2 extends Record<string, unknown>>(channel: string, payload: string | T_2, options?: PublishOptions) => Promise<PublishResult>;
23
+ subscribeGlobal: (channel: string, callback: <T_3 extends Record<string, unknown>>(payload: string | T_3, error?: Error) => any, options?: SubscriptionOptions) => Promise<Subscription>;
24
24
  };
25
25
  export {};
26
26
  //# sourceMappingURL=realtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"realtime.d.ts","sourceRoot":"","sources":["../../src/realtime/realtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,cAAc,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,cAAc,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,UAAU,YAAY;IACpB,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC;AAiCD,eAAO,MAAM,QAAQ;uBA7BK,MAAM,WAAW,GAAG,YAAY,cAAc,KAAG,QAAQ,aAAa,CAAC;yBAKtF,MAAM,uBACM,GAAG,KAAK,GAAG,YACtB,mBAAmB,KAC5B,QAAQ,YAAY,CAAC;6BAIQ,MAAM,WAAW,GAAG,YAAY,cAAc,KAAG,QAAQ,aAAa,CAAC;+BAK5F,MAAM,uBACM,GAAG,KAAK,GAAG,YACtB,mBAAmB,KAC5B,QAAQ,YAAY,CAAC;CAcvB,CAAC"}
1
+ {"version":3,"file":"realtime.d.ts","sourceRoot":"","sources":["../../src/realtime/realtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,cAAc,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,cAAc,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,UAAU,YAAY;IACpB,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC;AA6CD,eAAO,MAAM,QAAQ;0DAxCV,MAAM,iCAEL,cAAc,KACvB,QAAQ,aAAa,CAAC;yBAKd,MAAM,iFAC4D,KAAK,KAAK,GAAG,YAC9E,mBAAmB,KAC5B,QAAQ,YAAY,CAAC;kEASb,MAAM,mCAEL,cAAc,KACvB,QAAQ,aAAa,CAAC;+BAKd,MAAM,iFAC4D,KAAK,KAAK,GAAG,YAC9E,mBAAmB,KAC5B,QAAQ,YAAY,CAAC;CAcvB,CAAC"}
@@ -7,7 +7,11 @@ const publish = (channel, payload, options) => {
7
7
  return callBridge('publishRealtimeChannel', { channelName: channel, eventPayload: payload, options });
8
8
  };
9
9
  const subscribe = (channel, callback, options) => {
10
- return callBridge('subscribeRealtimeChannel', { channelName: channel, onEvent: callback, options });
10
+ return callBridge('subscribeRealtimeChannel', {
11
+ channelName: channel,
12
+ onEvent: callback,
13
+ options
14
+ });
11
15
  };
12
16
  const publishGlobal = (channel, payload, options) => {
13
17
  return callBridge('publishRealtimeChannel', { channelName: channel, eventPayload: payload, options, isGlobal: true });
@@ -0,0 +1,2 @@
1
+ export * from './rovo';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rovo/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./rovo"), exports);
@@ -0,0 +1,4 @@
1
+ import { OpenRovoPayload } from './types';
2
+ export declare const OPEN_ROVO_BRIDGE_ERROR_MESSAGE = "Unable to open Rovo Chat due to usage in an unsupported product. Only Confluence, Jira and some Jira Service Management modules are supported at this point. See https://developer.atlassian.com/platform/forge/apis-reference/ui-api-bridge/rovo/";
3
+ export declare const open: (openRovoPayload: OpenRovoPayload) => Promise<void>;
4
+ //# sourceMappingURL=open.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../../src/rovo/open.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAO1C,eAAO,MAAM,8BAA8B,uPAC2M,CAAC;AA6BvP,eAAO,MAAM,IAAI,oBAA2B,eAAe,kBAiB1D,CAAC"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.open = exports.OPEN_ROVO_BRIDGE_ERROR_MESSAGE = void 0;
4
+ const bridge_1 = require("../bridge");
5
+ const errors_1 = require("../errors");
6
+ const MAX_AGENT_LENGTH = 30;
7
+ const callBridge = (0, bridge_1.getCallBridge)();
8
+ exports.OPEN_ROVO_BRIDGE_ERROR_MESSAGE = 'Unable to open Rovo Chat due to usage in an unsupported product. Only Confluence, Jira and some Jira Service Management modules are supported at this point. See https://developer.atlassian.com/platform/forge/apis-reference/ui-api-bridge/rovo/';
9
+ const transformRovoPayload = (openRovoPayload) => {
10
+ switch (openRovoPayload.type) {
11
+ case 'forge':
12
+ return {
13
+ agentName: openRovoPayload.agentName,
14
+ agentKey: openRovoPayload.agentKey,
15
+ agentAppId: openRovoPayload.agentAppId,
16
+ prompt: openRovoPayload.prompt
17
+ };
18
+ case 'atlassian':
19
+ return {
20
+ agentName: openRovoPayload.agentName,
21
+ prompt: openRovoPayload.prompt
22
+ };
23
+ default:
24
+ return { prompt: openRovoPayload.prompt };
25
+ }
26
+ };
27
+ const open = async (openRovoPayload) => {
28
+ if (openRovoPayload.type === 'forge') {
29
+ if (openRovoPayload.agentName.length > MAX_AGENT_LENGTH) {
30
+ throw new Error('rovo agent name too long');
31
+ }
32
+ if (openRovoPayload.agentKey.length > MAX_AGENT_LENGTH) {
33
+ throw new Error('rovo agent key too long');
34
+ }
35
+ }
36
+ const rovoArgs = transformRovoPayload(openRovoPayload);
37
+ const success = await callBridge('openRovo', rovoArgs);
38
+ if (success === false) {
39
+ throw new errors_1.BridgeAPIError(exports.OPEN_ROVO_BRIDGE_ERROR_MESSAGE);
40
+ }
41
+ };
42
+ exports.open = open;
@@ -0,0 +1,4 @@
1
+ export declare const rovo: {
2
+ open: (openRovoPayload: import("./types").OpenRovoPayload) => Promise<void>;
3
+ };
4
+ //# sourceMappingURL=rovo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rovo.d.ts","sourceRoot":"","sources":["../../src/rovo/rovo.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,IAAI;;CAEhB,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rovo = void 0;
4
+ const open_1 = require("./open");
5
+ exports.rovo = {
6
+ open: open_1.open
7
+ };
@@ -0,0 +1,19 @@
1
+ declare type ForgeAgentPayload = {
2
+ type: 'forge';
3
+ agentAppId: string;
4
+ agentKey: string;
5
+ agentName: string;
6
+ prompt?: string;
7
+ };
8
+ declare type AtlassianAgentPayload = {
9
+ type: 'atlassian';
10
+ agentName: string;
11
+ prompt?: string;
12
+ };
13
+ declare type DefaultAgentPayload = {
14
+ type: 'default';
15
+ prompt?: string;
16
+ };
17
+ export declare type OpenRovoPayload = ForgeAgentPayload | AtlassianAgentPayload | DefaultAgentPayload;
18
+ export {};
19
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/rovo/types.ts"],"names":[],"mappings":"AAAA,aAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,aAAK,qBAAqB,GAAG;IAC3B,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,aAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,eAAe,GAAG,iBAAiB,GAAG,qBAAqB,GAAG,mBAAmB,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/bridge",
3
- "version": "5.7.1-next.1",
3
+ "version": "5.8.0-next.10",
4
4
  "description": "Forge bridge API for custom UI apps",
5
5
  "author": "Atlassian",
6
6
  "license": "SEE LICENSE IN LICENSE.txt",
@@ -18,7 +18,7 @@
18
18
  "@forge/resolver": "1.7.1",
19
19
  "@statsig/js-client": "3.18.2",
20
20
  "@types/history": "^4.7.11",
21
- "@forge/manifest": "11.0.0-next.1"
21
+ "@forge/manifest": "11.0.0-next.6"
22
22
  },
23
23
  "devDependencies": {
24
24
  "history": "5.3.0",
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/object-store/delete.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,aAAa;iBAAgD,MAAM;UAAQ,MAAM,EAAE;MAAK,QAAQ,IAAI,CAchH,CAAC"}