@amityco/ts-sdk 7.11.1-6905f391.0 → 7.11.1-8ca038e4.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/dist/@types/core/transport.d.ts +0 -3
- package/dist/@types/core/transport.d.ts.map +1 -1
- package/dist/eventRepository/api/index.d.ts +0 -1
- package/dist/eventRepository/api/index.d.ts.map +1 -1
- package/dist/eventRepository/index.d.ts +0 -2
- package/dist/eventRepository/index.d.ts.map +1 -1
- package/dist/eventRepository/utils/index.d.ts +0 -1
- package/dist/eventRepository/utils/index.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -198
- package/dist/index.esm.js +1 -198
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
- package/dist/eventRepository/api/deleteEvent.d.ts +0 -15
- package/dist/eventRepository/api/deleteEvent.d.ts.map +0 -1
- package/dist/eventRepository/events/index.d.ts +0 -4
- package/dist/eventRepository/events/index.d.ts.map +0 -1
- package/dist/eventRepository/events/onEventCreated.d.ts +0 -17
- package/dist/eventRepository/events/onEventCreated.d.ts.map +0 -1
- package/dist/eventRepository/events/onEventDeleted.d.ts +0 -17
- package/dist/eventRepository/events/onEventDeleted.d.ts.map +0 -1
- package/dist/eventRepository/events/onEventUpdated.d.ts +0 -17
- package/dist/eventRepository/events/onEventUpdated.d.ts.map +0 -1
- package/dist/eventRepository/internalApi/getEvent.d.ts +0 -32
- package/dist/eventRepository/internalApi/getEvent.d.ts.map +0 -1
- package/dist/eventRepository/internalApi/index.d.ts +0 -2
- package/dist/eventRepository/internalApi/index.d.ts.map +0 -1
- package/dist/eventRepository/observers/getEvent.d.ts +0 -21
- package/dist/eventRepository/observers/getEvent.d.ts.map +0 -1
- package/dist/eventRepository/observers/index.d.ts +0 -2
- package/dist/eventRepository/observers/index.d.ts.map +0 -1
- package/dist/eventRepository/utils/createEventEventSubscriber.d.ts +0 -2
- package/dist/eventRepository/utils/createEventEventSubscriber.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../src/@types/core/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,eAAe,CAAC,CAAC,IAAI;YACxB,MAAM,EAAE,SAAS,CAAC;YAClB,IAAI,EAAE,CAAC,CAAC;SACT,CAAC;QAEF,KAAK,YAAY,GAAG;YAClB,MAAM,EAAE,MAAM,CAAC;YACf,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC;SACzB,CAAC;QAEF,KAAK,aAAa,GAAG;YACnB,MAAM,EAAE,OAAO,CAAC;YAChB,OAAO,EAAE,MAAM,CAAC;YAChB,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC;SACzB,CAAC;QAEF,KAAK,
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../src/@types/core/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,eAAe,CAAC,CAAC,IAAI;YACxB,MAAM,EAAE,SAAS,CAAC;YAClB,IAAI,EAAE,CAAC,CAAC;SACT,CAAC;QAEF,KAAK,YAAY,GAAG;YAClB,MAAM,EAAE,MAAM,CAAC;YACf,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC;SACzB,CAAC;QAEF,KAAK,aAAa,GAAG;YACnB,MAAM,EAAE,OAAO,CAAC;YAChB,OAAO,EAAE,MAAM,CAAC;YAChB,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC;SACzB,CAAC;QAEF,KAAK,QAAQ,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,GAAG,YAAY,GAAG,aAAa,CAAC;QAErE,KAAK,KAAK,GAAG,MAAM,CAAC;QAEpB,KAAK,UAAU,GAAG;YAChB,MAAM,EAAE;gBACN,QAAQ,CAAC,EAAE,KAAK,CAAC;gBACjB,IAAI,CAAC,EAAE,KAAK,CAAC;aACd,CAAC;SACH,CAAC;QAEF,KAAK,UAAU,GAAG;YAChB,OAAO,EAAE,CAAC,MAAM,EAAE;gBAAE,WAAW,EAAE,MAAM,CAAC;gBAAC,MAAM,EAAE,MAAM,CAAA;aAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;YAC5E,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;YAChC,IAAI,SAAS,IAAI,OAAO,CAAC;YACzB,EAAE,EAAE,CAAC,CAAC,SAAS,MAAM,KAAK,CAAC,UAAU,EACnC,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,KAC5C,IAAI,CAAC;YACV,IAAI,EAAE,CAAC,CAAC,SAAS,MAAM,KAAK,CAAC,UAAU,EACrC,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,KAC5C,IAAI,CAAC;YACV,GAAG,EAAE,CAAC,CAAC,SAAS,MAAM,KAAK,CAAC,UAAU,EACpC,KAAK,EAAE,CAAC,EACR,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,KAC7C,IAAI,CAAC;YACV,kBAAkB,EAAE,MAAM,IAAI,CAAC;YAC/B,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,KAAK,CAAC,YAAY,CAAC;YAC7F,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;SACtC,CAAC;KACH;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/eventRepository/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/eventRepository/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/eventRepository/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/eventRepository/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/eventRepository/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/eventRepository/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -30341,26 +30341,6 @@ const prepareEventPayload = (rawPayload) => {
|
|
|
30341
30341
|
return Object.assign(Object.assign({}, rawPayload), { users: rawPayload.users.map(convertRawUserToInternalUser) });
|
|
30342
30342
|
};
|
|
30343
30343
|
|
|
30344
|
-
const createEventEventSubscriber = (event, callback) => {
|
|
30345
|
-
const client = getActiveClient();
|
|
30346
|
-
const filter = (payload) => {
|
|
30347
|
-
const unpackedPayload = prepareEventPayload(payload);
|
|
30348
|
-
if (!client.cache) {
|
|
30349
|
-
callback(unpackedPayload.events[0]);
|
|
30350
|
-
}
|
|
30351
|
-
else {
|
|
30352
|
-
ingestInCache(unpackedPayload);
|
|
30353
|
-
const event = pullFromCache([
|
|
30354
|
-
'event',
|
|
30355
|
-
'get',
|
|
30356
|
-
unpackedPayload.events[0].eventId,
|
|
30357
|
-
]);
|
|
30358
|
-
callback(event.data);
|
|
30359
|
-
}
|
|
30360
|
-
};
|
|
30361
|
-
return createEventSubscriber(client, event, event, filter);
|
|
30362
|
-
};
|
|
30363
|
-
|
|
30364
30344
|
/* begin_public_function
|
|
30365
30345
|
id: event.create
|
|
30366
30346
|
*/
|
|
@@ -30428,187 +30408,10 @@ const updateEvent = async (eventId, bundle) => {
|
|
|
30428
30408
|
};
|
|
30429
30409
|
/* end_public_function */
|
|
30430
30410
|
|
|
30431
|
-
/* begin_public_function
|
|
30432
|
-
id: event.get
|
|
30433
|
-
*/
|
|
30434
|
-
/**
|
|
30435
|
-
* ```js
|
|
30436
|
-
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30437
|
-
* const event = await EventRepository.getEvent(eventId)
|
|
30438
|
-
* ```
|
|
30439
|
-
*
|
|
30440
|
-
* Fetches a {@link Amity.Event} object
|
|
30441
|
-
*
|
|
30442
|
-
* @param eventId the ID of the {@link Amity.Event} to fetch
|
|
30443
|
-
* @returns the associated {@link Amity.Event} object
|
|
30444
|
-
*
|
|
30445
|
-
* @category Event API
|
|
30446
|
-
* @async
|
|
30447
|
-
*/
|
|
30448
|
-
const getEvent$1 = async (eventId) => {
|
|
30449
|
-
const client = getActiveClient();
|
|
30450
|
-
client.log('event/getEvent', eventId);
|
|
30451
|
-
const { data: payload } = await client.http.get(`/api/v3/events/${eventId}`);
|
|
30452
|
-
const data = prepareEventPayload(payload);
|
|
30453
|
-
const cachedAt = client.cache && Date.now();
|
|
30454
|
-
if (client.cache)
|
|
30455
|
-
ingestInCache(data, { cachedAt });
|
|
30456
|
-
return {
|
|
30457
|
-
data: data.events.find(event => event.eventId === eventId),
|
|
30458
|
-
cachedAt,
|
|
30459
|
-
};
|
|
30460
|
-
};
|
|
30461
|
-
/* end_public_function */
|
|
30462
|
-
/**
|
|
30463
|
-
* ```js
|
|
30464
|
-
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30465
|
-
* const event = EventRepository.getEvent.locally(eventId)
|
|
30466
|
-
* ```
|
|
30467
|
-
*
|
|
30468
|
-
* Fetches a {@link Amity.Event} object in cache
|
|
30469
|
-
*
|
|
30470
|
-
* @param eventId the ID of the {@link Amity.Event} to fetch
|
|
30471
|
-
* @returns the associated {@link Amity.Event} object
|
|
30472
|
-
*
|
|
30473
|
-
* @category Event API
|
|
30474
|
-
*/
|
|
30475
|
-
getEvent$1.locally = (eventId) => {
|
|
30476
|
-
const client = getActiveClient();
|
|
30477
|
-
client.log('event/getEvent.locally', eventId);
|
|
30478
|
-
if (!client.cache)
|
|
30479
|
-
return;
|
|
30480
|
-
const cache = pullFromCache(['event', 'get', eventId]);
|
|
30481
|
-
if (!cache)
|
|
30482
|
-
return;
|
|
30483
|
-
return {
|
|
30484
|
-
data: cache.data,
|
|
30485
|
-
cachedAt: cache.cachedAt,
|
|
30486
|
-
};
|
|
30487
|
-
};
|
|
30488
|
-
|
|
30489
|
-
/* begin_public_function
|
|
30490
|
-
id: event.delete
|
|
30491
|
-
*/
|
|
30492
|
-
/**
|
|
30493
|
-
* ```js
|
|
30494
|
-
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30495
|
-
* const { success } = await EventRepository.deleteEvent(eventId)
|
|
30496
|
-
* ```
|
|
30497
|
-
*
|
|
30498
|
-
* Deletes a {@link Amity.Event}
|
|
30499
|
-
*
|
|
30500
|
-
* @param eventId The {@link Amity.Event} ID to delete
|
|
30501
|
-
*
|
|
30502
|
-
* @category Event API
|
|
30503
|
-
* @async
|
|
30504
|
-
*/
|
|
30505
|
-
const deleteEvent = async (eventId) => {
|
|
30506
|
-
const client = getActiveClient();
|
|
30507
|
-
client.log('event/deleteEvent', eventId);
|
|
30508
|
-
const event = await getEvent$1(eventId);
|
|
30509
|
-
await client.http.delete(`/api/v3/events/${eventId}`);
|
|
30510
|
-
const deletedEvent = Object.assign(Object.assign({}, event.data), { isDeleted: true });
|
|
30511
|
-
upsertInCache(['event', 'get', eventId], deletedEvent);
|
|
30512
|
-
fireEvent('event.deleted', {
|
|
30513
|
-
users: [],
|
|
30514
|
-
files: [],
|
|
30515
|
-
communities: [],
|
|
30516
|
-
videoStreamings: [],
|
|
30517
|
-
events: [deletedEvent],
|
|
30518
|
-
discussionCommunities: [],
|
|
30519
|
-
});
|
|
30520
|
-
};
|
|
30521
|
-
/* end_public_function */
|
|
30522
|
-
|
|
30523
|
-
/**
|
|
30524
|
-
* ```js
|
|
30525
|
-
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30526
|
-
* const dispose = EventRepository.onEventCreated(event => {
|
|
30527
|
-
* // ...
|
|
30528
|
-
* })
|
|
30529
|
-
* ```
|
|
30530
|
-
*
|
|
30531
|
-
* Fired when a {@link Amity.Event} has been created
|
|
30532
|
-
*
|
|
30533
|
-
* @param callback The function to call when the event was fired
|
|
30534
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
30535
|
-
*
|
|
30536
|
-
* @category Event Events
|
|
30537
|
-
*/
|
|
30538
|
-
const onEventCreated = (callback) => createEventEventSubscriber('event.created', callback);
|
|
30539
|
-
|
|
30540
|
-
/**
|
|
30541
|
-
* ```js
|
|
30542
|
-
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30543
|
-
* const dispose = EventRepository.onEventUpdated(event => {
|
|
30544
|
-
* // ...
|
|
30545
|
-
* })
|
|
30546
|
-
* ```
|
|
30547
|
-
*
|
|
30548
|
-
* Fired when a {@link Amity.Event} has been updated
|
|
30549
|
-
*
|
|
30550
|
-
* @param callback The function to call when the event was fired
|
|
30551
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
30552
|
-
*
|
|
30553
|
-
* @category Event Events
|
|
30554
|
-
*/
|
|
30555
|
-
const onEventUpdated = (callback) => createEventEventSubscriber('event.updated', callback);
|
|
30556
|
-
|
|
30557
|
-
/**
|
|
30558
|
-
* ```js
|
|
30559
|
-
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30560
|
-
* const dispose = EventRepository.onEventDeleted(event => {
|
|
30561
|
-
* // ...
|
|
30562
|
-
* })
|
|
30563
|
-
* ```
|
|
30564
|
-
*
|
|
30565
|
-
* Fired when a {@link Amity.Event} has been deleted
|
|
30566
|
-
*
|
|
30567
|
-
* @param callback The function to call when the event was fired
|
|
30568
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
30569
|
-
*
|
|
30570
|
-
* @category Event Events
|
|
30571
|
-
*/
|
|
30572
|
-
const onEventDeleted = (callback) => createEventEventSubscriber('event.deleted', callback);
|
|
30573
|
-
|
|
30574
|
-
/* begin_public_function
|
|
30575
|
-
id: event.get
|
|
30576
|
-
*/
|
|
30577
|
-
/**
|
|
30578
|
-
* ```js
|
|
30579
|
-
* import { EventRepository } from '@amityco/ts-sdk';
|
|
30580
|
-
*
|
|
30581
|
-
* let event;
|
|
30582
|
-
*
|
|
30583
|
-
* const unsubscribe = EventRepository.getEvent(eventId, response => {
|
|
30584
|
-
* event = response.data;
|
|
30585
|
-
* });
|
|
30586
|
-
* ```
|
|
30587
|
-
*
|
|
30588
|
-
* Observe all mutation on a given {@link Amity.Event}
|
|
30589
|
-
*
|
|
30590
|
-
* @param eventId the ID of the event to observe
|
|
30591
|
-
* @param callback the function to call when new snapshot of event are available
|
|
30592
|
-
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the event
|
|
30593
|
-
*
|
|
30594
|
-
* @category Event Live Object
|
|
30595
|
-
*/
|
|
30596
|
-
const getEvent = (eventId, callback) => {
|
|
30597
|
-
return liveObject(eventId, callback, 'eventId', getEvent$1, [onEventCreated, onEventUpdated, onEventDeleted], {
|
|
30598
|
-
callbackDataSelector: (data) => (data ? eventLinkedObject(data) : data),
|
|
30599
|
-
});
|
|
30600
|
-
};
|
|
30601
|
-
/* end_public_function */
|
|
30602
|
-
|
|
30603
30411
|
var index = /*#__PURE__*/Object.freeze({
|
|
30604
30412
|
__proto__: null,
|
|
30605
30413
|
createEvent: createEvent,
|
|
30606
|
-
updateEvent: updateEvent
|
|
30607
|
-
deleteEvent: deleteEvent,
|
|
30608
|
-
onEventCreated: onEventCreated,
|
|
30609
|
-
onEventUpdated: onEventUpdated,
|
|
30610
|
-
onEventDeleted: onEventDeleted,
|
|
30611
|
-
getEvent: getEvent
|
|
30414
|
+
updateEvent: updateEvent
|
|
30612
30415
|
});
|
|
30613
30416
|
|
|
30614
30417
|
exports.API_REGIONS = API_REGIONS;
|
package/dist/index.esm.js
CHANGED
|
@@ -46433,26 +46433,6 @@ const prepareEventPayload = (rawPayload) => {
|
|
|
46433
46433
|
return Object.assign(Object.assign({}, rawPayload), { users: rawPayload.users.map(convertRawUserToInternalUser) });
|
|
46434
46434
|
};
|
|
46435
46435
|
|
|
46436
|
-
const createEventEventSubscriber = (event, callback) => {
|
|
46437
|
-
const client = getActiveClient();
|
|
46438
|
-
const filter = (payload) => {
|
|
46439
|
-
const unpackedPayload = prepareEventPayload(payload);
|
|
46440
|
-
if (!client.cache) {
|
|
46441
|
-
callback(unpackedPayload.events[0]);
|
|
46442
|
-
}
|
|
46443
|
-
else {
|
|
46444
|
-
ingestInCache(unpackedPayload);
|
|
46445
|
-
const event = pullFromCache([
|
|
46446
|
-
'event',
|
|
46447
|
-
'get',
|
|
46448
|
-
unpackedPayload.events[0].eventId,
|
|
46449
|
-
]);
|
|
46450
|
-
callback(event.data);
|
|
46451
|
-
}
|
|
46452
|
-
};
|
|
46453
|
-
return createEventSubscriber(client, event, event, filter);
|
|
46454
|
-
};
|
|
46455
|
-
|
|
46456
46436
|
/* begin_public_function
|
|
46457
46437
|
id: event.create
|
|
46458
46438
|
*/
|
|
@@ -46520,187 +46500,10 @@ const updateEvent = async (eventId, bundle) => {
|
|
|
46520
46500
|
};
|
|
46521
46501
|
/* end_public_function */
|
|
46522
46502
|
|
|
46523
|
-
/* begin_public_function
|
|
46524
|
-
id: event.get
|
|
46525
|
-
*/
|
|
46526
|
-
/**
|
|
46527
|
-
* ```js
|
|
46528
|
-
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46529
|
-
* const event = await EventRepository.getEvent(eventId)
|
|
46530
|
-
* ```
|
|
46531
|
-
*
|
|
46532
|
-
* Fetches a {@link Amity.Event} object
|
|
46533
|
-
*
|
|
46534
|
-
* @param eventId the ID of the {@link Amity.Event} to fetch
|
|
46535
|
-
* @returns the associated {@link Amity.Event} object
|
|
46536
|
-
*
|
|
46537
|
-
* @category Event API
|
|
46538
|
-
* @async
|
|
46539
|
-
*/
|
|
46540
|
-
const getEvent$1 = async (eventId) => {
|
|
46541
|
-
const client = getActiveClient();
|
|
46542
|
-
client.log('event/getEvent', eventId);
|
|
46543
|
-
const { data: payload } = await client.http.get(`/api/v3/events/${eventId}`);
|
|
46544
|
-
const data = prepareEventPayload(payload);
|
|
46545
|
-
const cachedAt = client.cache && Date.now();
|
|
46546
|
-
if (client.cache)
|
|
46547
|
-
ingestInCache(data, { cachedAt });
|
|
46548
|
-
return {
|
|
46549
|
-
data: data.events.find(event => event.eventId === eventId),
|
|
46550
|
-
cachedAt,
|
|
46551
|
-
};
|
|
46552
|
-
};
|
|
46553
|
-
/* end_public_function */
|
|
46554
|
-
/**
|
|
46555
|
-
* ```js
|
|
46556
|
-
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46557
|
-
* const event = EventRepository.getEvent.locally(eventId)
|
|
46558
|
-
* ```
|
|
46559
|
-
*
|
|
46560
|
-
* Fetches a {@link Amity.Event} object in cache
|
|
46561
|
-
*
|
|
46562
|
-
* @param eventId the ID of the {@link Amity.Event} to fetch
|
|
46563
|
-
* @returns the associated {@link Amity.Event} object
|
|
46564
|
-
*
|
|
46565
|
-
* @category Event API
|
|
46566
|
-
*/
|
|
46567
|
-
getEvent$1.locally = (eventId) => {
|
|
46568
|
-
const client = getActiveClient();
|
|
46569
|
-
client.log('event/getEvent.locally', eventId);
|
|
46570
|
-
if (!client.cache)
|
|
46571
|
-
return;
|
|
46572
|
-
const cache = pullFromCache(['event', 'get', eventId]);
|
|
46573
|
-
if (!cache)
|
|
46574
|
-
return;
|
|
46575
|
-
return {
|
|
46576
|
-
data: cache.data,
|
|
46577
|
-
cachedAt: cache.cachedAt,
|
|
46578
|
-
};
|
|
46579
|
-
};
|
|
46580
|
-
|
|
46581
|
-
/* begin_public_function
|
|
46582
|
-
id: event.delete
|
|
46583
|
-
*/
|
|
46584
|
-
/**
|
|
46585
|
-
* ```js
|
|
46586
|
-
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46587
|
-
* const { success } = await EventRepository.deleteEvent(eventId)
|
|
46588
|
-
* ```
|
|
46589
|
-
*
|
|
46590
|
-
* Deletes a {@link Amity.Event}
|
|
46591
|
-
*
|
|
46592
|
-
* @param eventId The {@link Amity.Event} ID to delete
|
|
46593
|
-
*
|
|
46594
|
-
* @category Event API
|
|
46595
|
-
* @async
|
|
46596
|
-
*/
|
|
46597
|
-
const deleteEvent = async (eventId) => {
|
|
46598
|
-
const client = getActiveClient();
|
|
46599
|
-
client.log('event/deleteEvent', eventId);
|
|
46600
|
-
const event = await getEvent$1(eventId);
|
|
46601
|
-
await client.http.delete(`/api/v3/events/${eventId}`);
|
|
46602
|
-
const deletedEvent = Object.assign(Object.assign({}, event.data), { isDeleted: true });
|
|
46603
|
-
upsertInCache(['event', 'get', eventId], deletedEvent);
|
|
46604
|
-
fireEvent('event.deleted', {
|
|
46605
|
-
users: [],
|
|
46606
|
-
files: [],
|
|
46607
|
-
communities: [],
|
|
46608
|
-
videoStreamings: [],
|
|
46609
|
-
events: [deletedEvent],
|
|
46610
|
-
discussionCommunities: [],
|
|
46611
|
-
});
|
|
46612
|
-
};
|
|
46613
|
-
/* end_public_function */
|
|
46614
|
-
|
|
46615
|
-
/**
|
|
46616
|
-
* ```js
|
|
46617
|
-
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46618
|
-
* const dispose = EventRepository.onEventCreated(event => {
|
|
46619
|
-
* // ...
|
|
46620
|
-
* })
|
|
46621
|
-
* ```
|
|
46622
|
-
*
|
|
46623
|
-
* Fired when a {@link Amity.Event} has been created
|
|
46624
|
-
*
|
|
46625
|
-
* @param callback The function to call when the event was fired
|
|
46626
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
46627
|
-
*
|
|
46628
|
-
* @category Event Events
|
|
46629
|
-
*/
|
|
46630
|
-
const onEventCreated = (callback) => createEventEventSubscriber('event.created', callback);
|
|
46631
|
-
|
|
46632
|
-
/**
|
|
46633
|
-
* ```js
|
|
46634
|
-
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46635
|
-
* const dispose = EventRepository.onEventUpdated(event => {
|
|
46636
|
-
* // ...
|
|
46637
|
-
* })
|
|
46638
|
-
* ```
|
|
46639
|
-
*
|
|
46640
|
-
* Fired when a {@link Amity.Event} has been updated
|
|
46641
|
-
*
|
|
46642
|
-
* @param callback The function to call when the event was fired
|
|
46643
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
46644
|
-
*
|
|
46645
|
-
* @category Event Events
|
|
46646
|
-
*/
|
|
46647
|
-
const onEventUpdated = (callback) => createEventEventSubscriber('event.updated', callback);
|
|
46648
|
-
|
|
46649
|
-
/**
|
|
46650
|
-
* ```js
|
|
46651
|
-
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46652
|
-
* const dispose = EventRepository.onEventDeleted(event => {
|
|
46653
|
-
* // ...
|
|
46654
|
-
* })
|
|
46655
|
-
* ```
|
|
46656
|
-
*
|
|
46657
|
-
* Fired when a {@link Amity.Event} has been deleted
|
|
46658
|
-
*
|
|
46659
|
-
* @param callback The function to call when the event was fired
|
|
46660
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
46661
|
-
*
|
|
46662
|
-
* @category Event Events
|
|
46663
|
-
*/
|
|
46664
|
-
const onEventDeleted = (callback) => createEventEventSubscriber('event.deleted', callback);
|
|
46665
|
-
|
|
46666
|
-
/* begin_public_function
|
|
46667
|
-
id: event.get
|
|
46668
|
-
*/
|
|
46669
|
-
/**
|
|
46670
|
-
* ```js
|
|
46671
|
-
* import { EventRepository } from '@amityco/ts-sdk';
|
|
46672
|
-
*
|
|
46673
|
-
* let event;
|
|
46674
|
-
*
|
|
46675
|
-
* const unsubscribe = EventRepository.getEvent(eventId, response => {
|
|
46676
|
-
* event = response.data;
|
|
46677
|
-
* });
|
|
46678
|
-
* ```
|
|
46679
|
-
*
|
|
46680
|
-
* Observe all mutation on a given {@link Amity.Event}
|
|
46681
|
-
*
|
|
46682
|
-
* @param eventId the ID of the event to observe
|
|
46683
|
-
* @param callback the function to call when new snapshot of event are available
|
|
46684
|
-
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the event
|
|
46685
|
-
*
|
|
46686
|
-
* @category Event Live Object
|
|
46687
|
-
*/
|
|
46688
|
-
const getEvent = (eventId, callback) => {
|
|
46689
|
-
return liveObject(eventId, callback, 'eventId', getEvent$1, [onEventCreated, onEventUpdated, onEventDeleted], {
|
|
46690
|
-
callbackDataSelector: (data) => (data ? eventLinkedObject(data) : data),
|
|
46691
|
-
});
|
|
46692
|
-
};
|
|
46693
|
-
/* end_public_function */
|
|
46694
|
-
|
|
46695
46503
|
var index = /*#__PURE__*/Object.freeze({
|
|
46696
46504
|
__proto__: null,
|
|
46697
46505
|
createEvent: createEvent,
|
|
46698
|
-
updateEvent: updateEvent
|
|
46699
|
-
deleteEvent: deleteEvent,
|
|
46700
|
-
onEventCreated: onEventCreated,
|
|
46701
|
-
onEventUpdated: onEventUpdated,
|
|
46702
|
-
onEventDeleted: onEventDeleted,
|
|
46703
|
-
getEvent: getEvent
|
|
46506
|
+
updateEvent: updateEvent
|
|
46704
46507
|
});
|
|
46705
46508
|
|
|
46706
46509
|
export { API_REGIONS, index$4 as AdRepository, AmityEventOriginType, AmityEventStatus, AmityEventType, index$c as CategoryRepository, index$g as ChannelRepository, index$p as Client, index$b as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$d as CommunityRepository, ContentFeedType, ContentFlagReasonEnum, DefaultCommunityPostSetting, index as EventRepository, FeedDataTypeEnum, index$a as FeedRepository, FeedSortByEnum, FeedSourceEnum, FileAccessTypeEnum, index$m as FileRepository, FileType, GET_WATCHER_URLS, index$2 as InvitationRepository, InvitationSortByEnum, InvitationStatusEnum, InvitationTypeEnum, JoinRequestStatusEnum, JoinResultStatusEnum, index$1 as LiveReactionRepository, index$6 as LiveStreamPlayer, MembershipAcceptanceTypeEnum, MessageContentType, index$k as MessageRepository, index$7 as PollRepository, PostContentType, index$9 as PostRepository, PostStructureType, index$l as ReactionRepository, index$5 as StoryRepository, index$8 as StreamRepository, index$j as SubChannelRepository, SubscriptionLevels, index$n as UserRepository, UserTypeEnum, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveReactionTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index$3 as notificationTray, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, wipeCache };
|