@amityco/ts-sdk 7.2.0 → 7.2.1-3663404.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/.env +26 -26
- package/dist/@types/core/events.d.ts +4 -0
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/model.d.ts +4 -0
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +45 -1
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/file.d.ts +1 -20
- package/dist/@types/domains/file.d.ts.map +1 -1
- package/dist/@types/domains/notification.d.ts +78 -0
- package/dist/@types/domains/notification.d.ts.map +1 -0
- package/dist/@types/domains/post.d.ts +4 -0
- package/dist/@types/domains/post.d.ts.map +1 -1
- package/dist/@types/index.d.ts +1 -0
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/core/events.d.ts +3 -3
- package/dist/core/events.d.ts.map +1 -1
- package/dist/core/model/idResolvers.d.ts.map +1 -1
- package/dist/core/model/index.d.ts.map +1 -1
- package/dist/fileRepository/api/index.d.ts +1 -0
- package/dist/fileRepository/api/index.d.ts.map +1 -1
- package/dist/fileRepository/api/updateAltText.d.ts +17 -0
- package/dist/fileRepository/api/updateAltText.d.ts.map +1 -0
- package/dist/fileRepository/api/uploadImage.d.ts +2 -1
- package/dist/fileRepository/api/uploadImage.d.ts.map +1 -1
- package/dist/index.cjs.js +526 -50
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +509 -34
- package/dist/index.umd.js +4 -4
- package/dist/notificationTray/api/index.d.ts +3 -0
- package/dist/notificationTray/api/index.d.ts.map +1 -0
- package/dist/notificationTray/api/markItemsSeen.d.ts +16 -0
- package/dist/notificationTray/api/markItemsSeen.d.ts.map +1 -0
- package/dist/notificationTray/api/markTraySeen.d.ts +19 -0
- package/dist/notificationTray/api/markTraySeen.d.ts.map +1 -0
- package/dist/notificationTray/events/index.d.ts +2 -0
- package/dist/notificationTray/events/index.d.ts.map +1 -0
- package/dist/notificationTray/events/onNotificationTraySeenUpdated.d.ts +17 -0
- package/dist/notificationTray/events/onNotificationTraySeenUpdated.d.ts.map +1 -0
- package/dist/notificationTray/index.d.ts +4 -0
- package/dist/notificationTray/index.d.ts.map +1 -0
- package/dist/notificationTray/internalApi/getNotificationTraySeen.d.ts +30 -0
- package/dist/notificationTray/internalApi/getNotificationTraySeen.d.ts.map +1 -0
- package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts +13 -0
- package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts.map +1 -0
- package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts +9 -0
- package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts.map +1 -0
- package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts +9 -0
- package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts.map +1 -0
- package/dist/notificationTray/observers/getNotificationTrayItems.d.ts +12 -0
- package/dist/notificationTray/observers/getNotificationTrayItems.d.ts.map +1 -0
- package/dist/notificationTray/observers/getNotificationTraySeen.d.ts +20 -0
- package/dist/notificationTray/observers/getNotificationTraySeen.d.ts.map +1 -0
- package/dist/notificationTray/observers/index.d.ts +3 -0
- package/dist/notificationTray/observers/index.d.ts.map +1 -0
- package/dist/notificationTray/utils/prepareNotificationTrayItemsPayload.d.ts +2 -0
- package/dist/notificationTray/utils/prepareNotificationTrayItemsPayload.d.ts.map +1 -0
- package/dist/utils/linkedObject/index.d.ts +1 -0
- package/dist/utils/linkedObject/index.d.ts.map +1 -1
- package/dist/utils/linkedObject/notificationTrayLinkedObject.d.ts +2 -0
- package/dist/utils/linkedObject/notificationTrayLinkedObject.d.ts.map +1 -0
- package/dist/utils/linkedObject/postLinkedObject.d.ts.map +1 -1
- package/dist/utils/postTypePredicate.d.ts +4 -0
- package/dist/utils/postTypePredicate.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/@types/core/events.ts +5 -0
- package/src/@types/core/model.ts +6 -0
- package/src/@types/core/payload.ts +52 -1
- package/src/@types/domains/file.ts +1 -21
- package/src/@types/domains/notification.ts +94 -0
- package/src/@types/domains/post.ts +4 -0
- package/src/@types/index.ts +1 -0
- package/src/core/model/idResolvers.ts +3 -0
- package/src/core/model/index.ts +2 -0
- package/src/fileRepository/api/index.ts +1 -0
- package/src/fileRepository/api/updateAltText.ts +39 -0
- package/src/fileRepository/api/uploadImage.ts +22 -3
- package/src/index.ts +2 -0
- package/src/notificationTray/api/index.ts +2 -0
- package/src/notificationTray/api/markItemsSeen.ts +62 -0
- package/src/notificationTray/api/markTraySeen.ts +65 -0
- package/src/notificationTray/events/index.ts +1 -0
- package/src/notificationTray/events/onNotificationTraySeenUpdated.ts +36 -0
- package/src/notificationTray/index.ts +3 -0
- package/src/notificationTray/internalApi/getNotificationTraySeen.ts +80 -0
- package/src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.ts +96 -0
- package/src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.ts +31 -0
- package/src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.ts +68 -0
- package/src/notificationTray/observers/getNotificationTrayItems.ts +44 -0
- package/src/notificationTray/observers/getNotificationTraySeen.ts +60 -0
- package/src/notificationTray/observers/index.ts +2 -0
- package/src/notificationTray/utils/prepareNotificationTrayItemsPayload.ts +12 -0
- package/src/utils/linkedObject/index.ts +2 -0
- package/src/utils/linkedObject/notificationTrayLinkedObject.ts +19 -0
- package/src/utils/linkedObject/postLinkedObject.ts +29 -0
- package/src/utils/postTypePredicate.ts +27 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
4
|
+
* const updated = await notificationTray.markItemsSeen()
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
* Updates an {@link Amity.NotificationItemSeen}
|
|
8
|
+
*
|
|
9
|
+
* @param trayItems[] that include id and lastTraySeenAt, The ID of the {@link Amity.NotificationItemSeen} to edit
|
|
10
|
+
* @returns the updated {@link Amity.NotificationItemSeen} object
|
|
11
|
+
*
|
|
12
|
+
* @category NotificationItemSeen API
|
|
13
|
+
* @async
|
|
14
|
+
*/
|
|
15
|
+
export declare const markItemsSeen: (trayItems: Amity.QueryNotificationItemSeen[]) => Promise<void>;
|
|
16
|
+
//# sourceMappingURL=markItemsSeen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markItemsSeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/api/markItemsSeen.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,cAAqB,MAAM,yBAAyB,EAAE,kBAuC/E,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
4
|
+
* const updated = await notificationTray.markTraySeen({
|
|
5
|
+
* lastSeenAt: Amity.timestamp,
|
|
6
|
+
* })
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
9
|
+
* Updates an {@link Amity.NotificationTraySeen}
|
|
10
|
+
*
|
|
11
|
+
* @param userId The ID of the {@link Amity.NotificationTraySeen} to edit
|
|
12
|
+
* @param lastSeenAt The patch data to apply
|
|
13
|
+
* @returns the updated {@link Amity.NotificationTraySeen} object
|
|
14
|
+
*
|
|
15
|
+
* @category Post API
|
|
16
|
+
* @async
|
|
17
|
+
*/
|
|
18
|
+
export declare const markTraySeen: (lastSeenAt: Amity.timestamp) => Promise<Amity.Cached<Amity.NotificationTraySeenUpdatedPayload>>;
|
|
19
|
+
//# sourceMappingURL=markTraySeen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markTraySeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/api/markTraySeen.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,YAAY,eACX,MAAM,SAAS,KAC1B,QAAQ,MAAM,MAAM,CAAC,MAAM,kCAAkC,CAAC,CAqChE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { onNotificationTraySeenUpdated } from '@amityco/ts-sdk'
|
|
4
|
+
* const dispose = onNotificationTraySeenUpdated(data => {
|
|
5
|
+
* // ...
|
|
6
|
+
* })
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
9
|
+
* Fired when an {@link Amity.NotificationTraySeen} has been updated
|
|
10
|
+
*
|
|
11
|
+
* @param callback The function to call when the event was fired
|
|
12
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
13
|
+
*
|
|
14
|
+
* @category NotificationTraySeen Events
|
|
15
|
+
*/
|
|
16
|
+
export declare const onNotificationTraySeenUpdated: (callback: Amity.Listener<Amity.InternalNotificationTraySeen>) => Amity.Unsubscriber;
|
|
17
|
+
//# sourceMappingURL=onNotificationTraySeenUpdated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onNotificationTraySeenUpdated.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/events/onNotificationTraySeenUpdated.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,6BAA6B,aAC9B,MAAM,QAAQ,CAAC,MAAM,4BAA4B,CAAC,KAC3D,MAAM,YAeR,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notificationTray/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
4
|
+
* const notificationTraySeen = await notificationTray.getNotificationTraySeen()
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* @returns A page of {@link Amity.NotificationTraySeen} objects
|
|
9
|
+
*
|
|
10
|
+
* @category NotificationTray API
|
|
11
|
+
* @async
|
|
12
|
+
* */
|
|
13
|
+
export declare const getNotificationTraySeen: {
|
|
14
|
+
(): Promise<Amity.Cached<Amity.InternalNotificationTraySeen>>;
|
|
15
|
+
/**
|
|
16
|
+
* ```js
|
|
17
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
18
|
+
* const notificationTraySeen = await notificationTray.getNotificationTraySeen.locally()
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Queries a paginable list of {@link Amity.NotificationTraySeen} objects from cache
|
|
22
|
+
*
|
|
23
|
+
* @returns A page of {@link Amity.NotificationTraySeen} objects
|
|
24
|
+
*
|
|
25
|
+
* @category NotificationTray API
|
|
26
|
+
* @async
|
|
27
|
+
* */
|
|
28
|
+
locally(): Amity.Cached<Amity.InternalNotificationTraySeen> | undefined;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=getNotificationTraySeen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNotificationTraySeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/internalApi/getNotificationTraySeen.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;KAWK;AACL,eAAO,MAAM,uBAAuB;QAAa,QAC/C,MAAM,MAAM,CAAC,MAAM,4BAA4B,CAAC,CACjD;IA+BD;;;;;;;;;;;;SAYK;eAED,MAAM,MAAM,CAAC,MAAM,4BAA4B,CAAC,GAChD,SAAS;CAlBZ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NotificationTrayItemsPaginationController } from './NotificationTrayItemsPaginationController';
|
|
2
|
+
import { LiveCollectionController } from '~/core/liveCollection/LiveCollectionController';
|
|
3
|
+
export declare class NotificationTrayItemsLiveCollectionController extends LiveCollectionController<'notificationTrayItem', Amity.NotificationTrayItemLiveCollection, Amity.NotificationTrayItem, NotificationTrayItemsPaginationController> {
|
|
4
|
+
private queryStreamController;
|
|
5
|
+
private query;
|
|
6
|
+
constructor(query: Amity.NotificationTrayItemLiveCollection, callback: Amity.LiveCollectionCallback<Amity.NotificationTrayItem>);
|
|
7
|
+
protected setup(): void;
|
|
8
|
+
protected persistModel(queryPayload: Amity.NotificationTrayPayload & Amity.Pagination): Promise<void>;
|
|
9
|
+
protected persistQueryStream({ response, direction, refresh, }: Amity.LiveCollectionPersistQueryStreamParams<'notificationTrayItem'>): void;
|
|
10
|
+
startSubscription(): Amity.Unsubscriber[];
|
|
11
|
+
notifyChange({ origin, loading, error }: Amity.LiveCollectionNotifyParams): void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=NotificationTrayItemsLiveCollectionController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationTrayItemsLiveCollectionController.d.ts","sourceRoot":"","sources":["../../../../src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yCAAyC,EAAE,MAAM,6CAA6C,CAAC;AAExG,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAK1F,qBAAa,6CAA8C,SAAQ,wBAAwB,CACzF,sBAAsB,EACtB,KAAK,CAAC,kCAAkC,EACxC,KAAK,CAAC,oBAAoB,EAC1B,yCAAyC,CAC1C;IACC,OAAO,CAAC,qBAAqB,CAA6C;IAE1E,OAAO,CAAC,KAAK,CAA2C;gBAGtD,KAAK,EAAE,KAAK,CAAC,kCAAkC,EAC/C,QAAQ,EAAE,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,oBAAoB,CAAC;IAoBpE,SAAS,CAAC,KAAK;cAYC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC,uBAAuB,GAAG,KAAK,CAAC,UAAU;IAI3F,SAAS,CAAC,kBAAkB,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,KAAK,CAAC,sCAAsC,CAAC,sBAAsB,CAAC;IAKvE,iBAAiB;IAIjB,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,0BAA0B;CAyB1E"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PaginationController } from '~/core/liveCollection/PaginationController';
|
|
2
|
+
/**
|
|
3
|
+
* TODO: handle cache receive cache option, and cache policy
|
|
4
|
+
* TODO: check if querybyIds is supported
|
|
5
|
+
*/
|
|
6
|
+
export declare class NotificationTrayItemsPaginationController extends PaginationController<'notificationTrayItem', Amity.NotificationTrayItemLiveCollection> {
|
|
7
|
+
getRequest(queryParams: Amity.NotificationTrayItemLiveCollection, token: string | undefined): Promise<Amity.NotificationTrayPayload & Amity.Pagination>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=NotificationTrayItemsPaginationController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationTrayItemsPaginationController.d.ts","sourceRoot":"","sources":["../../../../src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAGlF;;;GAGG;AACH,qBAAa,yCAA0C,SAAQ,oBAAoB,CACjF,sBAAsB,EACtB,KAAK,CAAC,kCAAkC,CACzC;IACO,UAAU,CACd,WAAW,EAAE,KAAK,CAAC,kCAAkC,EACrD,KAAK,EAAE,MAAM,GAAG,SAAS;CAiB5B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { QueryStreamController } from '~/core/liveCollection/QueryStreamController';
|
|
2
|
+
export declare class NotificationTrayItemsQuerystreamController extends QueryStreamController<Amity.NotificationTrayPayload, Amity.NotificationTrayItemLiveCollection> {
|
|
3
|
+
private notifyChange;
|
|
4
|
+
private preparePayload;
|
|
5
|
+
constructor(query: Amity.NotificationTrayItemLiveCollection, cacheKey: string[], notifyChange: (params: Amity.LiveCollectionNotifyParams) => void, preparePayload: (response: Amity.NotificationTrayPayload) => Amity.ProcessedNotificationTrayPayload);
|
|
6
|
+
saveToMainDB(response: Amity.NotificationTrayPayload): Promise<void>;
|
|
7
|
+
appendToQueryStream(response: Amity.NotificationTrayPayload & Partial<Amity.Pagination>, direction: Amity.LiveCollectionPageDirection, refresh?: boolean): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=NotificationTrayItemsQuerystreamController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationTrayItemsQuerystreamController.d.ts","sourceRoot":"","sources":["../../../../src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAMpF,qBAAa,0CAA2C,SAAQ,qBAAqB,CACnF,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,kCAAkC,CACzC;IACC,OAAO,CAAC,YAAY,CAAqD;IAEzE,OAAO,CAAC,cAAc,CAEsB;gBAG1C,KAAK,EAAE,KAAK,CAAC,kCAAkC,EAC/C,QAAQ,EAAE,MAAM,EAAE,EAClB,YAAY,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,0BAA0B,KAAK,IAAI,EAChE,cAAc,EAAE,CACd,QAAQ,EAAE,KAAK,CAAC,uBAAuB,KACpC,KAAK,CAAC,gCAAgC;IAOvC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,uBAAuB;IAW1D,mBAAmB,CACjB,QAAQ,EAAE,KAAK,CAAC,uBAAuB,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,EACnE,SAAS,EAAE,KAAK,CAAC,2BAA2B,EAC5C,OAAO,UAAQ;CAwBlB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get notification tray items for a notification tray page
|
|
3
|
+
*
|
|
4
|
+
* @param params the limit query parameters
|
|
5
|
+
* @param callback the callback to be called when the notification tray items are updated
|
|
6
|
+
* @returns items in the notification tray
|
|
7
|
+
*
|
|
8
|
+
* @category Notification tray items Live Collection
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export declare const getNotificationTrayItems: (params: Amity.LiveCollectionParams<Amity.NotificationTrayItemLiveCollection>, callback: Amity.LiveCollectionCallback<Amity.NotificationTrayItem>, config?: Amity.LiveCollectionConfig) => () => void;
|
|
12
|
+
//# sourceMappingURL=getNotificationTrayItems.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNotificationTrayItems.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/observers/getNotificationTrayItems.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,WAC3B,MAAM,oBAAoB,CAAC,MAAM,kCAAkC,CAAC,YAClE,MAAM,sBAAsB,CAAC,MAAM,oBAAoB,CAAC,WACzD,MAAM,oBAAoB,eAyBpC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { notificationTray } from '@amityco/ts-sdk';
|
|
4
|
+
*
|
|
5
|
+
* let notificationTraySeen;
|
|
6
|
+
*
|
|
7
|
+
* const unsubscribe = getNotificationTraySeen(response => {
|
|
8
|
+
* notificationTraySeen = response.data;
|
|
9
|
+
* });
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Observe all mutation on a given {@link Amity.NotificationTraySeen}
|
|
13
|
+
*
|
|
14
|
+
* @param callback the function to call when new data are available
|
|
15
|
+
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the message
|
|
16
|
+
*
|
|
17
|
+
* @category NotificationTraySeen Live Object
|
|
18
|
+
*/
|
|
19
|
+
export declare const getNotificationTraySeen: (callback: Amity.LiveObjectCallback<Amity.NotificationTraySeen>) => Amity.Unsubscriber;
|
|
20
|
+
//# sourceMappingURL=getNotificationTraySeen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNotificationTraySeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/observers/getNotificationTraySeen.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,uBAAuB,aACxB,MAAM,kBAAkB,CAAC,MAAM,oBAAoB,CAAC,KAC7D,MAAM,YA6BR,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/observers/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareNotificationTrayItemsPayload.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/utils/prepareNotificationTrayItemsPayload.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mCAAmC,eAClC,MAAM,uBAAuB,KACxC,MAAM,gCAOR,CAAC"}
|
|
@@ -11,5 +11,6 @@ export declare const LinkedObject: {
|
|
|
11
11
|
reactor: (reactor: Amity.InternalReactor) => Amity.Reactor;
|
|
12
12
|
channel: (channel: Amity.InternalChannel<any>) => Amity.Channel<any>;
|
|
13
13
|
pinnedPost: (pinnedPost: Amity.RawPin) => Amity.PinnedPost;
|
|
14
|
+
notificationTray: (noti: Amity.RawNotificationTrayItem) => Amity.NotificationTrayItem;
|
|
14
15
|
};
|
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/index.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;CAcxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notificationTrayLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/notificationTrayLinkedObject.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,4BAA4B,SACjC,MAAM,4BAA4B,KACvC,MAAM,oBAWR,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/postLinkedObject.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"postLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/postLinkedObject.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,SAAU,MAAM,YAAY,KAAG,MAAM,IA6DjE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function isAmityImagePost(post: Amity.InternalPost): post is Amity.Post<'image'>;
|
|
2
|
+
export declare function isAmityFilePost(post: Amity.InternalPost): post is Amity.Post<'file'>;
|
|
3
|
+
export declare function isAmityVideoPost(post: Amity.InternalPost): post is Amity.Post<'video'>;
|
|
4
|
+
//# sourceMappingURL=postTypePredicate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postTypePredicate.d.ts","sourceRoot":"","sources":["../../src/utils/postTypePredicate.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAOtF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAOpF;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAQtF"}
|
package/package.json
CHANGED
|
@@ -256,6 +256,11 @@ declare global {
|
|
|
256
256
|
'local.story.error': Amity.StoryPayload;
|
|
257
257
|
'local.story.reload': { referenceIds: Amity.Story['referenceId'][] };
|
|
258
258
|
|
|
259
|
+
'local.notificationTraySeen.updated': Amity.InternalNotificationTraySeen;
|
|
260
|
+
'local.notificationTrayItem.updated': {
|
|
261
|
+
notificationTrayItems: Amity.InternalNotificationTrayItem[];
|
|
262
|
+
};
|
|
263
|
+
|
|
259
264
|
sessionStateChange: Amity.SessionStates;
|
|
260
265
|
// used by accessTokenExpiryWatcher
|
|
261
266
|
tokenExpired: Amity.SessionStates.TOKEN_EXPIRED;
|
package/src/@types/core/model.ts
CHANGED
|
@@ -57,6 +57,9 @@ declare global {
|
|
|
57
57
|
|
|
58
58
|
pinTarget: Amity.InternalPinTarget;
|
|
59
59
|
pin: Amity.InternalPin;
|
|
60
|
+
|
|
61
|
+
notificationTrayItem: Amity.InternalNotificationTrayItem;
|
|
62
|
+
notificationTraySeen: Amity.InternalNotificationTraySeen;
|
|
60
63
|
};
|
|
61
64
|
|
|
62
65
|
type Model = ValueOf<Models>;
|
|
@@ -118,6 +121,9 @@ declare global {
|
|
|
118
121
|
|
|
119
122
|
pinTarget: Pick<Amity.InternalPinTarget, 'targetId'>;
|
|
120
123
|
pin: Pick<Amity.InternalPin, 'placement' | 'referenceId'>;
|
|
124
|
+
|
|
125
|
+
notificationTrayItem: Pick<Amity.InternalNotificationTrayItem, '_id'>;
|
|
126
|
+
notificationTraySeen: Pick<Amity.InternalNotificationTraySeen, 'userId'>;
|
|
121
127
|
};
|
|
122
128
|
}
|
|
123
129
|
}
|
|
@@ -26,6 +26,7 @@ declare global {
|
|
|
26
26
|
blockUser: Amity.BlockedUserPayload;
|
|
27
27
|
semanticSearchPost: Amity.SemanticSearchPostPayload;
|
|
28
28
|
semanticSearchCommunity: Amity.SemanticSearchCommunityPayload;
|
|
29
|
+
notificationTrayItem: Amity.NotificationTrayPayload;
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
type UserPayload = {
|
|
@@ -54,7 +55,29 @@ declare global {
|
|
|
54
55
|
|
|
55
56
|
// API-FIX: backend should return a payload like { files: Amity.File<T>[] }
|
|
56
57
|
type CreateFilePayload<T extends Amity.FileType = any> = Amity.File<T>[];
|
|
57
|
-
|
|
58
|
+
|
|
59
|
+
type VideoFileExtraPayload = {
|
|
60
|
+
feedType: Amity.ContentFeedType;
|
|
61
|
+
status: Amity.VideoTranscodingStatus;
|
|
62
|
+
videoUrl?: { [name in Amity.VideoResolution]?: string } | null;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
type FilePayload<T extends Amity.FileType = any> = {
|
|
66
|
+
fileId: string;
|
|
67
|
+
type: T;
|
|
68
|
+
altText?: string;
|
|
69
|
+
fileUrl: string;
|
|
70
|
+
attributes: {
|
|
71
|
+
name: string;
|
|
72
|
+
extension: string;
|
|
73
|
+
size: string;
|
|
74
|
+
mimeType: string;
|
|
75
|
+
metadata: Amity.MetadataFor<T>;
|
|
76
|
+
};
|
|
77
|
+
accessType: Amity.FileAccessType;
|
|
78
|
+
} & (T extends 'video' ? Amity.VideoFileExtraPayload : unknown) &
|
|
79
|
+
Amity.Timestamps &
|
|
80
|
+
Amity.SoftDelete;
|
|
58
81
|
|
|
59
82
|
type RolePayload = {
|
|
60
83
|
roles: Amity.Role[];
|
|
@@ -378,6 +401,34 @@ declare global {
|
|
|
378
401
|
reactions: Amity.InternalReactor[];
|
|
379
402
|
} & Amity.StoryPayload;
|
|
380
403
|
|
|
404
|
+
type NotificationTrayPayload = {
|
|
405
|
+
notificationTrayItems: Amity.RawNotificationTrayItem[];
|
|
406
|
+
users: Amity.RawUser[];
|
|
407
|
+
files?: Amity.File[];
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
type ProcessedNotificationTrayPayload = Omit<
|
|
411
|
+
NotificationTrayPayload,
|
|
412
|
+
'notificationTrayItems' | 'users'
|
|
413
|
+
> & {
|
|
414
|
+
notificationTrayItems: Amity.InternalNotificationTrayItem[];
|
|
415
|
+
users: Amity.InternalUser[];
|
|
416
|
+
files?: Amity.File[];
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
type NotificationTraySeenPayload = {
|
|
420
|
+
lastTraySeenAt: Amity.timestamp;
|
|
421
|
+
lastTrayOccurredAt: Amity.timestamp;
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
type NotificationTraySeenUpdatedPayload = {
|
|
425
|
+
lastSeenAt: Amity.timestamp;
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
type NotificationItemSeenPayload = {
|
|
429
|
+
trayItems: { id: string; lastSeenAt: Amity.timestamp }[];
|
|
430
|
+
};
|
|
431
|
+
|
|
381
432
|
/**
|
|
382
433
|
* Items that extend from `Amity.PostPayload`
|
|
383
434
|
* - communities: `Amity.RawCommunity` -> `Amity.Community` (Added Marker Service related props)
|
|
@@ -63,26 +63,6 @@ declare global {
|
|
|
63
63
|
? VideoMetadata
|
|
64
64
|
: never;
|
|
65
65
|
|
|
66
|
-
type
|
|
67
|
-
feedType: Amity.ContentFeedType;
|
|
68
|
-
status: VideoTranscodingStatus;
|
|
69
|
-
videoUrl?: { [name in VideoResolution]?: string } | null;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
type File<T extends FileType = any> = {
|
|
73
|
-
fileId: string;
|
|
74
|
-
type: T;
|
|
75
|
-
fileUrl: string;
|
|
76
|
-
attributes: {
|
|
77
|
-
name: string;
|
|
78
|
-
extension: string;
|
|
79
|
-
size: string;
|
|
80
|
-
mimeType: string;
|
|
81
|
-
metadata: MetadataFor<T>;
|
|
82
|
-
};
|
|
83
|
-
accessType: FileAccessType;
|
|
84
|
-
} & (T extends 'video' ? VideoFileExtraPayload : unknown) &
|
|
85
|
-
Amity.Timestamps &
|
|
86
|
-
Amity.SoftDelete;
|
|
66
|
+
type File<T extends FileType = any> = Amity.FilePayload<T>;
|
|
87
67
|
}
|
|
88
68
|
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
namespace Amity {
|
|
5
|
+
const enum TrayItemCategoryType {
|
|
6
|
+
POST_MENTION = 'mention_in_post',
|
|
7
|
+
COMMENT_MENTION = 'mention_in_comment',
|
|
8
|
+
REPLY_MENTION = 'mention_in_reply',
|
|
9
|
+
POLL_MENTION = 'mention_in_poll',
|
|
10
|
+
POST_REACT = 'reaction_on_post',
|
|
11
|
+
COMMENT_REACT = 'reaction_on_comment',
|
|
12
|
+
REPLY_REACT = 'reaction_on_reply',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const enum TrayAction {
|
|
16
|
+
POST = 'post',
|
|
17
|
+
POLL = 'poll',
|
|
18
|
+
COMMENT = 'comment',
|
|
19
|
+
REACTION = 'reaction',
|
|
20
|
+
MENTION = 'mention',
|
|
21
|
+
REPLY = 'reply',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type RawNotificationTrayItem = {
|
|
25
|
+
_id: string;
|
|
26
|
+
lastSeenAt: Amity.timestamp;
|
|
27
|
+
lastOccurredAt: Amity.timestamp;
|
|
28
|
+
actors: {
|
|
29
|
+
_id: string;
|
|
30
|
+
publicId: string;
|
|
31
|
+
lastActedAt: Amity.timestamp;
|
|
32
|
+
}[];
|
|
33
|
+
actorsCount: number;
|
|
34
|
+
trayItemCategory?: TrayItemCategoryType;
|
|
35
|
+
targetId: string;
|
|
36
|
+
targetType: string;
|
|
37
|
+
referenceId?: string;
|
|
38
|
+
referenceType?: string;
|
|
39
|
+
actionType: TrayAction;
|
|
40
|
+
actionReferenceId?: string;
|
|
41
|
+
parentId?: string;
|
|
42
|
+
text: string;
|
|
43
|
+
templatedText: string;
|
|
44
|
+
daySegment: Amity.timestamp;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
type InternalNotificationTrayItem = RawNotificationTrayItem;
|
|
48
|
+
|
|
49
|
+
type QueryNotificationTrayItem = {
|
|
50
|
+
token?: Amity.Token;
|
|
51
|
+
limit?: Amity.PageLimit['limit'];
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
type NotificationTrayItemLiveCollection = Amity.LiveCollectionParams<
|
|
55
|
+
Omit<QueryNotificationTrayItem, 'limit'>
|
|
56
|
+
>;
|
|
57
|
+
|
|
58
|
+
type NotificationTrayItemLiveCollectionCache = Amity.LiveCollectionCache<
|
|
59
|
+
Amity.InternalNotificationTrayItem['_id'],
|
|
60
|
+
Pick<QueryNotificationTrayItem, 'limit'>
|
|
61
|
+
>;
|
|
62
|
+
|
|
63
|
+
type NotificationTrayItem = Amity.InternalNotificationTrayItem & {
|
|
64
|
+
isSeen: boolean;
|
|
65
|
+
isRecent: boolean;
|
|
66
|
+
users: Amity.User[];
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
type RawNotificationTraySeen = {
|
|
70
|
+
lastTraySeenAt: Amity.timestamp;
|
|
71
|
+
lastTrayOccurredAt: Amity.timestamp;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
type RawNotificationTraySeenUpdated = {
|
|
75
|
+
lastTraySeenAt: Amity.timestamp;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
type InternalNotificationTraySeen = RawNotificationTraySeen & {
|
|
79
|
+
userId: string;
|
|
80
|
+
isSeen: boolean;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
type NotificationTraySeen = RawNotificationTraySeen & { isSeen: boolean };
|
|
84
|
+
|
|
85
|
+
type RawNotificationItemSeen = {
|
|
86
|
+
lastSeenAt: Amity.timestamp;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
type QueryNotificationItemSeen = {
|
|
90
|
+
id: string;
|
|
91
|
+
lastSeenAt: Amity.timestamp;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -61,6 +61,10 @@ declare global {
|
|
|
61
61
|
analytics: {
|
|
62
62
|
markAsViewed: () => void;
|
|
63
63
|
};
|
|
64
|
+
getImageInfo: () => Amity.File<'image'> | undefined;
|
|
65
|
+
getVideoInfo: () => Amity.File<'video'> | undefined;
|
|
66
|
+
getVideoThumbnailInfo: () => Amity.File<'image'> | undefined;
|
|
67
|
+
getFileInfo: () => Amity.File<'file'> | undefined;
|
|
64
68
|
};
|
|
65
69
|
|
|
66
70
|
type Post<T extends PostContentType = any> = Amity.InternalPost<T> & Amity.PostLinkObject;
|
package/src/@types/index.ts
CHANGED
|
@@ -61,6 +61,9 @@ const idResolvers: Resolvers = {
|
|
|
61
61
|
|
|
62
62
|
pin: ({ placement, referenceId }) => `${placement}#${referenceId}`,
|
|
63
63
|
pinTarget: ({ targetId }) => targetId,
|
|
64
|
+
|
|
65
|
+
notificationTrayItem: ({ _id }) => _id,
|
|
66
|
+
notificationTraySeen: ({ userId }) => userId,
|
|
64
67
|
};
|
|
65
68
|
|
|
66
69
|
/**
|
package/src/core/model/index.ts
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
2
|
+
import { getActiveClient } from '~/client';
|
|
3
|
+
|
|
4
|
+
/* begin_public_function
|
|
5
|
+
id: file.update.altText
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* ```js
|
|
9
|
+
* import { FileRepository } from '@amityco/ts-sdk'
|
|
10
|
+
* const updated = await FileRepository.updateAltText(fileId, altText)
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Updates an {@link Amity.File<'image'>['altText']}.
|
|
14
|
+
*
|
|
15
|
+
* @param fileId The ID of the {@link Amity.File<'image'>} to edit
|
|
16
|
+
* @param altText The new alt text for the {@link Amity.File<'image'>}
|
|
17
|
+
* @returns the updated {@link Amity.File<'image'>} object
|
|
18
|
+
*
|
|
19
|
+
* @category File API
|
|
20
|
+
* @async
|
|
21
|
+
*/
|
|
22
|
+
export const updateAltText = async (
|
|
23
|
+
fileId: Amity.File['fileId'],
|
|
24
|
+
altText: string,
|
|
25
|
+
): Promise<boolean> => {
|
|
26
|
+
const client = getActiveClient();
|
|
27
|
+
client.log('file/updateAltText', altText);
|
|
28
|
+
|
|
29
|
+
const { data } = await client.http.put<Amity.FilePayload<'image'>>(`/api/v3/files/${fileId}`, {
|
|
30
|
+
altText,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const cachedAt = client.cache && Date.now();
|
|
34
|
+
|
|
35
|
+
if (client.cache) ingestInCache({ files: [data] }, { cachedAt });
|
|
36
|
+
|
|
37
|
+
return true;
|
|
38
|
+
};
|
|
39
|
+
/* end_public_function */
|