mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Update notification object to match the updated examples
This commit is contained in:
@@ -3,7 +3,7 @@ export const CONTEXT_NOTIFICATION = 'https://www.w3.org/ns/solid/notification/v1
|
||||
|
||||
/**
|
||||
* The minimally expected fields for a Notification
|
||||
* as defined in https://solidproject.org/TR/notifications-protocol#notification-data-model.
|
||||
* as defined in https://solidproject.org/TR/2022/notifications-protocol-20221231#data-model.
|
||||
*/
|
||||
export interface Notification {
|
||||
'@context': [
|
||||
@@ -12,11 +12,9 @@ export interface Notification {
|
||||
...string[],
|
||||
];
|
||||
id: string;
|
||||
type: string[];
|
||||
object: {
|
||||
id: string;
|
||||
type: string[];
|
||||
};
|
||||
type: string;
|
||||
object: string;
|
||||
state?: string;
|
||||
target?: string | string[];
|
||||
published: string;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getETag } from '../../../storage/Conditions';
|
||||
import type { ResourceStore } from '../../../storage/ResourceStore';
|
||||
import { NotImplementedHttpError } from '../../../util/errors/NotImplementedHttpError';
|
||||
import { AS, RDF } from '../../../util/Vocabularies';
|
||||
import { AS } from '../../../util/Vocabularies';
|
||||
import type { Notification } from '../Notification';
|
||||
import { CONTEXT_ACTIVITYSTREAMS, CONTEXT_NOTIFICATION } from '../Notification';
|
||||
import type { NotificationHandlerInput } from '../NotificationHandler';
|
||||
@@ -37,11 +37,8 @@ export class ActivityNotificationGenerator extends NotificationGenerator {
|
||||
CONTEXT_NOTIFICATION,
|
||||
],
|
||||
id: `urn:${Date.now()}:${topic.path}`,
|
||||
type: [ activity!.value.slice(AS.namespace.length) ],
|
||||
object: {
|
||||
id: topic.path,
|
||||
type: representation.metadata.getAll(RDF.terms.type).map((term): string => term.value),
|
||||
},
|
||||
type: activity!.value.slice(AS.namespace.length),
|
||||
object: topic.path,
|
||||
state,
|
||||
published: new Date().toISOString(),
|
||||
};
|
||||
|
||||
@@ -24,11 +24,8 @@ export class DeleteNotificationGenerator extends NotificationGenerator {
|
||||
CONTEXT_NOTIFICATION,
|
||||
],
|
||||
id: `urn:${Date.now()}:${topic.path}`,
|
||||
type: [ 'Delete' ],
|
||||
object: {
|
||||
id: topic.path,
|
||||
type: [],
|
||||
},
|
||||
type: 'Delete',
|
||||
object: topic.path,
|
||||
published: new Date().toISOString(),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user