Compare commits

...

2 Commits

Author SHA1 Message Date
Michael Puckett 82ff297f50 v0.4.58 2023-11-01 13:43:48 -04:00
Michael Puckett 3f56d71ca6 Finish foundCollection 2023-11-01 13:43:01 -04:00
13 changed files with 112 additions and 91 deletions

View File

@ -2,5 +2,5 @@
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"useNx": true,
"useWorkspaces": true,
"version": "0.4.57"
"version": "0.4.58"
}

10
package-lock.json generated
View File

@ -12366,7 +12366,7 @@
},
"packages/endpoints": {
"name": "@activity-kit/endpoints",
"version": "0.4.57",
"version": "0.4.58",
"license": "MIT",
"dependencies": {
"@activity-kit/core": "^0.4.57",
@ -12391,10 +12391,10 @@
},
"packages/express-middleware": {
"name": "@activity-kit/express-middleware",
"version": "0.4.57",
"version": "0.4.58",
"license": "MIT",
"dependencies": {
"@activity-kit/endpoints": "^0.4.57",
"@activity-kit/endpoints": "^0.4.58",
"@activity-kit/types": "^0.4.57",
"@activity-kit/utilities": "^0.4.57",
"express": "^4.18.2",
@ -12410,10 +12410,10 @@
},
"packages/plugin-groups": {
"name": "@activity-kit/plugin-groups",
"version": "0.4.57",
"version": "0.4.58",
"license": "MIT",
"dependencies": {
"@activity-kit/endpoints": "^0.4.57",
"@activity-kit/endpoints": "^0.4.58",
"@activity-kit/types": "^0.4.57",
"@activity-kit/utilities": "^0.4.57",
"cheerio": "^1.0.0-rc.12",

View File

@ -0,0 +1,4 @@
import * as AP from '@activity-kit/types';
import { Result } from '../types';
import { EntityGetEndpoint } from '.';
export declare function handleFoundCollection(this: EntityGetEndpoint, entity: AP.EitherCollectionPage, render: (entity: AP.Entity) => Promise<string>): Promise<Result>;

View File

@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleFoundCollection = void 0;
async function handleFoundCollection(entity, render) {
return this.handleFoundEntity(entity, render);
}
exports.handleFoundCollection = handleFoundCollection;
//# sourceMappingURL=handleFoundCollection.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"handleFoundCollection.js","sourceRoot":"","sources":["../../src/entity/handleFoundCollection.ts"],"names":[],"mappings":";;;AAKO,KAAK,UAAU,qBAAqB,CAEzC,MAA+B,EAC/B,MAA8C;IAE9C,OAAO,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAChD,CAAC;AAND,sDAMC"}

View File

@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.handleFoundCollectionPage = void 0;
const AP = __importStar(require("@activity-kit/types"));
const type_utilities_1 = require("@activity-kit/type-utilities");
const utilities_1 = require("@activity-kit/utilities");
// TODO: Move to config.
const ITEMS_PER_COLLECTION_PAGE = 50;
async function handleFoundCollectionPage(entity, render) {
@ -35,13 +36,19 @@ async function handleFoundCollectionPage(entity, render) {
const currentPage = page ? Number(page) : 1;
const firstItemIndex = (currentPage - 1) * ITEMS_PER_COLLECTION_PAGE;
const startIndex = firstItemIndex + 1;
const limitedItems = getCollectionItems(entity).slice(firstItemIndex, firstItemIndex + ITEMS_PER_COLLECTION_PAGE);
const collection = await this.core.queryById(new URL(pageParts[0]));
type_utilities_1.assert.isApCollection(collection);
const collectionItems = getCollectionItems(collection);
const lastPageIndex = Math.ceil(collectionItems.length / ITEMS_PER_COLLECTION_PAGE);
const limitedItems = collectionItems.slice(firstItemIndex, firstItemIndex + ITEMS_PER_COLLECTION_PAGE);
const items = expandItems(limitedItems);
const collectionId = (0, utilities_1.getId)(collection);
type_utilities_1.assert.exists(collectionId);
const collectionPage = {
...entity,
id: getPageUrl(currentPage),
url: getPageUrl(currentPage),
partOf: baseUrl,
partOf: collectionId,
first: getPageUrl(1),
last: getPageUrl(lastPageIndex),
...(currentPage > 1
@ -55,7 +62,7 @@ async function handleFoundCollectionPage(entity, render) {
}
: null),
};
if (isOrderedCollection) {
if (type_utilities_1.guard.isApType(collection, AP.CollectionTypes.ORDERED_COLLECTION)) {
const orderedCollectionPageEntity = {
...collectionPage,
type: AP.CollectionPageTypes.ORDERED_COLLECTION_PAGE,
@ -73,22 +80,27 @@ async function handleFoundCollectionPage(entity, render) {
}
exports.handleFoundCollectionPage = handleFoundCollectionPage;
function expandItems(objects) {
return objects.map((object) => {
if (type_utilities_1.guard.isApLink(object)) {
return objects
.map((object) => {
if (type_utilities_1.guard.isApType(object, AP.LinkTypes.LINK)) {
return object;
}
if (type_utilities_1.guard.isApMention(object)) {
if (type_utilities_1.guard.isApType(object, AP.LinkTypes.MENTION)) {
return object;
}
if (type_utilities_1.guard.isApObject(object)) {
return {
...object,
id: getId(object),
url: new URL(getId(object)),
};
if (type_utilities_1.guard.isApCoreObject(object)) {
const id = (0, utilities_1.getId)(object);
if (type_utilities_1.guard.exists(id)) {
return {
...object,
id,
url: id,
};
}
}
return object;
});
})
.filter(type_utilities_1.guard.isApEntity);
}
function getCollectionItems(collection) {
if (type_utilities_1.guard.isArray(collection.orderedItems)) {
@ -99,22 +111,4 @@ function getCollectionItems(collection) {
}
return [];
}
function foo() {
const items = [];
for (const item of limitedItems) {
if (type_utilities_1.guard.isApTransitiveActivity(item)) {
const objectId = getId(item.object);
if (objectId) {
const object = await this.core.findEntityById(objectId);
if (object) {
item.object = object;
}
}
}
if (type_utilities_1.guard.isApEntity(item)) {
items.push(item);
}
}
return items;
}
//# sourceMappingURL=handleFoundCollectionPage.js.map

View File

@ -1 +1 @@
{"version":3,"file":"handleFoundCollectionPage.js","sourceRoot":"","sources":["../../src/entity/handleFoundCollectionPage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAA0C;AAC1C,iEAAqD;AAKrD,wBAAwB;AACxB,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAE9B,KAAK,UAAU,yBAAyB,CAE7C,MAA+B,EAC/B,MAA8C;IAE9C,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE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O;oBACL,GAAG,MAAM;oBACT,EAAE;oBACF,GAAG,EAAE,EAAE;iBACR,CAAC;aACH;SACF;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;SACD,MAAM,CAAC,sBAAK,CAAC,UAAU,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,kBAAkB,CAAC,UAA+B;IACzD,IAAI,sBAAK,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE;QAC1C,OAAO,UAAU,CAAC,YAAY,CAAC;KAChC;IAED,IAAI,sBAAK,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QACnC,OAAO,UAAU,CAAC,KAAK,CAAC;KACzB;IAED,OAAO,EAAE,CAAC;AACZ,CAAC"}

View File

@ -2,6 +2,7 @@
import { CoreLibrary } from '@activity-kit/core';
import { handleNotFound } from './handleNotFound';
import { handleFoundEntity } from './handleFoundEntity';
import { handleFoundCollection } from './handleFoundCollection';
import { handleFoundCollectionPage } from './handleFoundCollectionPage';
import { respond } from './respond';
export declare class EntityGetEndpoint {
@ -14,7 +15,7 @@ export declare class EntityGetEndpoint {
});
protected handleNotFound: typeof handleNotFound;
protected handleFoundEntity: typeof handleFoundEntity;
protected handleFoundCollection: any;
protected handleFoundCollection: typeof handleFoundCollection;
protected handleFoundCollectionPage: typeof handleFoundCollectionPage;
respond: typeof respond;
}

View File

@ -1,6 +1,6 @@
{
"name": "@activity-kit/endpoints",
"version": "0.4.57",
"version": "0.4.58",
"description": "> TODO: description",
"author": "Michael Puckett <michaelcpuckett@gmail.com>",
"homepage": "",

View File

@ -0,0 +1,12 @@
import * as AP from '@activity-kit/types';
import { Result } from '../types';
import { EntityGetEndpoint } from '.';
export async function handleFoundCollection(
this: EntityGetEndpoint,
entity: AP.EitherCollectionPage,
render: (entity: AP.Entity) => Promise<string>,
): Promise<Result> {
return this.handleFoundEntity(entity, render);
}

View File

@ -1,5 +1,6 @@
import * as AP from '@activity-kit/types';
import { guard } from '@activity-kit/type-utilities';
import { assert, guard } from '@activity-kit/type-utilities';
import { getId } from '@activity-kit/utilities';
import { Result } from '../types';
import { EntityGetEndpoint } from '.';
@ -23,18 +24,31 @@ export async function handleFoundCollectionPage(
const firstItemIndex = (currentPage - 1) * ITEMS_PER_COLLECTION_PAGE;
const startIndex = firstItemIndex + 1;
const limitedItems = getCollectionItems(entity).slice(
const collection = await this.core.queryById(new URL(pageParts[0]));
assert.isApCollection(collection);
const collectionItems = getCollectionItems(collection);
const lastPageIndex = Math.ceil(
collectionItems.length / ITEMS_PER_COLLECTION_PAGE,
);
const limitedItems = collectionItems.slice(
firstItemIndex,
firstItemIndex + ITEMS_PER_COLLECTION_PAGE,
);
const items = expandItems(limitedItems);
const collectionId = getId(collection);
assert.exists(collectionId);
const collectionPage = {
...entity,
id: getPageUrl(currentPage),
url: getPageUrl(currentPage),
partOf: baseUrl,
partOf: collectionId,
first: getPageUrl(1),
last: getPageUrl(lastPageIndex),
...(currentPage > 1
@ -49,7 +63,12 @@ export async function handleFoundCollectionPage(
: null),
};
if (isOrderedCollection) {
if (
guard.isApType<AP.OrderedCollection>(
collection,
AP.CollectionTypes.ORDERED_COLLECTION,
)
) {
const orderedCollectionPageEntity: AP.OrderedCollectionPage = {
...collectionPage,
type: AP.CollectionPageTypes.ORDERED_COLLECTION_PAGE,
@ -71,26 +90,32 @@ export async function handleFoundCollectionPage(
function expandItems(
objects: Array<unknown>,
): Array<AP.Object | AP.Link | AP.Mention> {
return objects.map((object) => {
if (guard.isApLink(object)) {
): Array<AP.CoreObject | AP.Link | AP.Mention> {
return objects
.map((object) => {
if (guard.isApType<AP.Link>(object, AP.LinkTypes.LINK)) {
return object;
}
if (guard.isApType<AP.Mention>(object, AP.LinkTypes.MENTION)) {
return object;
}
if (guard.isApCoreObject(object)) {
const id = getId(object);
if (guard.exists(id)) {
return {
...object,
id,
url: id,
};
}
}
return object;
}
if (guard.isApMention(object)) {
return object;
}
if (guard.isApObject(object)) {
return {
...object,
id: getId(object),
url: new URL(getId(object)),
};
}
return object;
});
})
.filter(guard.isApEntity);
}
function getCollectionItems(collection: AP.EitherCollection) {
@ -104,27 +129,3 @@ function getCollectionItems(collection: AP.EitherCollection) {
return [];
}
function foo() {
const items: AP.Entity[] = [];
for (const item of limitedItems) {
if (guard.isApTransitiveActivity(item)) {
const objectId = getId(item.object);
if (objectId) {
const object = await this.core.findEntityById(objectId);
if (object) {
item.object = object;
}
}
}
if (guard.isApEntity(item)) {
items.push(item);
}
}
return items;
}

View File

@ -1,6 +1,6 @@
{
"name": "@activity-kit/express-middleware",
"version": "0.4.57",
"version": "0.4.58",
"description": "> TODO: description",
"author": "Michael Puckett <michaelcpuckett@gmail.com>",
"homepage": "",
@ -28,7 +28,7 @@
"lint": "eslint src/**/*.ts"
},
"dependencies": {
"@activity-kit/endpoints": "^0.4.57",
"@activity-kit/endpoints": "^0.4.58",
"@activity-kit/types": "^0.4.57",
"@activity-kit/utilities": "^0.4.57",
"express": "^4.18.2",

View File

@ -1,6 +1,6 @@
{
"name": "@activity-kit/plugin-groups",
"version": "0.4.57",
"version": "0.4.58",
"description": "> TODO: description",
"author": "Michael Puckett <michael@puckett.contact>",
"homepage": "https://github.com/michaelcpuckett/activitypub-core#readme",
@ -33,7 +33,7 @@
"typescript": "^5.0.4"
},
"dependencies": {
"@activity-kit/endpoints": "^0.4.57",
"@activity-kit/endpoints": "^0.4.58",
"@activity-kit/types": "^0.4.57",
"@activity-kit/utilities": "^0.4.57",
"cheerio": "^1.0.0-rc.12",