openvibers/openvibe.search Commits
Search: the hosting catalog is an index owner (host) (#45)
Changes
@@@ -45,8 +45,8 @@ function parseZones(v) {const DEFAULT_EVENT_OWNERS = ['wiki', 'blog', 'news', 'reviews', 'deals', 'coupons', 'trade','community', 'live', 'media', 'codes', 'games', 'tools', 'sources',// Record products (openvibe-publishing/search-feed, contracts 0.128.0): job listings, rental listings, help-- // articles, item definitions and quests.-- 'work', 'rent', 'help', 'inventory', 'quest'];++ // articles, item definitions and quests; the hosting catalog's plans and providers (contracts 0.145.0).++ 'work', 'rent', 'help', 'inventory', 'quest', 'host'];function load(env = process.env) {const nodeEnv = env.NODE_ENV || 'development';@@@ -120,16 +120,17 @@ t('unknown owners, subject mismatches and invalid documents are refused', asyncassert.strictEqual((await search('sigmaword')).length, 0);});--t('the record products are accepted owners: a Work job, a Rent listing, a Help article, an Inventory definition and a Quest', async () => {++t('the record products are accepted owners: a Work job, a Rent listing, a Help article, an Inventory definition, a Quest and a Host catalog plan', async () => {const docs = [doc({ owner: 'work', type: 'job', id: 'job_0123456789abcdefghjkmnpqrs', canonical_url: 'https://openvibe.work/jobs/job_0123456789abcdefghjkmnpqrs', title: 'Backend engineer recordsword', authorship: 'imported' }),doc({ owner: 'rent', type: 'listing', id: 'rnt_01JAB2C3D4E5F6G7H8J9K0MNPQ', canonical_url: 'https://openvibe.rent/listings/rnt_01JAB2C3D4E5F6G7H8J9K0MNPQ', title: 'Room near the park recordsword' }),doc({ owner: 'help', type: 'article', id: 'openvibe.live:how-do-i-go-live', canonical_url: 'https://openvibe.help/a/openvibe.live/how-do-i-go-live', title: 'How do I go live recordsword' }),doc({ owner: 'inventory', type: 'definition', id: 'itd_01JAB2C3D4E5F6G7H8J9K0MNPQ', canonical_url: 'https://openvibe.inventory/definitions/itd_01JAB2C3D4E5F6G7H8J9K0MNPQ', title: 'Fire Name recordsword' }),doc({ owner: 'quest', type: 'quest', id: 'go-live', canonical_url: 'https://openvibe.quest/quests/go-live', title: 'Go live once recordsword' }),++ doc({ owner: 'host', type: 'plan', id: 'hpl_01M4PJ8C3ZNPWVVZM9N5XXH45J', canonical_url: 'https://openvibe.host/catalog/plans/hpl_01M4PJ8C3ZNPWVVZM9N5XXH45J', title: 'Linode Nanode 1GB recordsword', authorship: 'imported' }),];for (const d of docs) assert.strictEqual((await deliver(svc.base, indexEvent(d))).body.outcome, 'applied', d.owner);-- assert.deepStrictEqual((await search('recordsword')).map((r) => r.owner).sort(), ['help', 'inventory', 'quest', 'rent', 'work']);++ assert.deepStrictEqual((await search('recordsword')).map((r) => r.owner).sort(), ['help', 'host', 'inventory', 'quest', 'rent', 'work']);});t('events that are not index documents are acknowledged and ignored', async () => {
@@ -45,8 +45,8 @@ function parseZones(v) {
@@ -45,8 +45,8 @@ function parseZones(v) {
const DEFAULT_EVENT_OWNERS = ['wiki', 'blog', 'news', 'reviews', 'deals', 'coupons', 'trade',
const DEFAULT_EVENT_OWNERS = ['wiki', 'blog', 'news', 'reviews', 'deals', 'coupons', 'trade',
'community', 'live', 'media', 'codes', 'games', 'tools', 'sources',
'community', 'live', 'media', 'codes', 'games', 'tools', 'sources',
// Record products (openvibe-publishing/search-feed, contracts 0.128.0): job listings, rental listings, help
// Record products (openvibe-publishing/search-feed, contracts 0.128.0): job listings, rental listings, help
- // articles, item definitions and quests.
- 'work', 'rent', 'help', 'inventory', 'quest'];
+ // articles, item definitions and quests; the hosting catalog's plans and providers (contracts 0.145.0).
+ 'work', 'rent', 'help', 'inventory', 'quest', 'host'];
function load(env = process.env) {
function load(env = process.env) {
const nodeEnv = env.NODE_ENV || 'development';
const nodeEnv = env.NODE_ENV || 'development';
@@ -120,16 +120,17 @@ t('unknown owners, subject mismatches and invalid documents are refused', async
@@ -120,16 +120,17 @@ t('unknown owners, subject mismatches and invalid documents are refused', async
assert.strictEqual((await search('sigmaword')).length, 0);
assert.strictEqual((await search('sigmaword')).length, 0);
});
});
-t('the record products are accepted owners: a Work job, a Rent listing, a Help article, an Inventory definition and a Quest', async () => {
+t('the record products are accepted owners: a Work job, a Rent listing, a Help article, an Inventory definition, a Quest and a Host catalog plan', async () => {
const docs = [
const docs = [
doc({ owner: 'work', type: 'job', id: 'job_0123456789abcdefghjkmnpqrs', canonical_url: 'https://openvibe.work/jobs/job_0123456789abcdefghjkmnpqrs', title: 'Backend engineer recordsword', authorship: 'imported' }),
doc({ owner: 'work', type: 'job', id: 'job_0123456789abcdefghjkmnpqrs', canonical_url: 'https://openvibe.work/jobs/job_0123456789abcdefghjkmnpqrs', title: 'Backend engineer recordsword', authorship: 'imported' }),
doc({ owner: 'rent', type: 'listing', id: 'rnt_01JAB2C3D4E5F6G7H8J9K0MNPQ', canonical_url: 'https://openvibe.rent/listings/rnt_01JAB2C3D4E5F6G7H8J9K0MNPQ', title: 'Room near the park recordsword' }),
doc({ owner: 'rent', type: 'listing', id: 'rnt_01JAB2C3D4E5F6G7H8J9K0MNPQ', canonical_url: 'https://openvibe.rent/listings/rnt_01JAB2C3D4E5F6G7H8J9K0MNPQ', title: 'Room near the park recordsword' }),
doc({ owner: 'help', type: 'article', id: 'openvibe.live:how-do-i-go-live', canonical_url: 'https://openvibe.help/a/openvibe.live/how-do-i-go-live', title: 'How do I go live recordsword' }),
doc({ owner: 'help', type: 'article', id: 'openvibe.live:how-do-i-go-live', canonical_url: 'https://openvibe.help/a/openvibe.live/how-do-i-go-live', title: 'How do I go live recordsword' }),
doc({ owner: 'inventory', type: 'definition', id: 'itd_01JAB2C3D4E5F6G7H8J9K0MNPQ', canonical_url: 'https://openvibe.inventory/definitions/itd_01JAB2C3D4E5F6G7H8J9K0MNPQ', title: 'Fire Name recordsword' }),
doc({ owner: 'inventory', type: 'definition', id: 'itd_01JAB2C3D4E5F6G7H8J9K0MNPQ', canonical_url: 'https://openvibe.inventory/definitions/itd_01JAB2C3D4E5F6G7H8J9K0MNPQ', title: 'Fire Name recordsword' }),
doc({ owner: 'quest', type: 'quest', id: 'go-live', canonical_url: 'https://openvibe.quest/quests/go-live', title: 'Go live once recordsword' }),
doc({ owner: 'quest', type: 'quest', id: 'go-live', canonical_url: 'https://openvibe.quest/quests/go-live', title: 'Go live once recordsword' }),
+ doc({ owner: 'host', type: 'plan', id: 'hpl_01M4PJ8C3ZNPWVVZM9N5XXH45J', canonical_url: 'https://openvibe.host/catalog/plans/hpl_01M4PJ8C3ZNPWVVZM9N5XXH45J', title: 'Linode Nanode 1GB recordsword', authorship: 'imported' }),
];
];
for (const d of docs) assert.strictEqual((await deliver(svc.base, indexEvent(d))).body.outcome, 'applied', d.owner);
for (const d of docs) assert.strictEqual((await deliver(svc.base, indexEvent(d))).body.outcome, 'applied', d.owner);
- assert.deepStrictEqual((await search('recordsword')).map((r) => r.owner).sort(), ['help', 'inventory', 'quest', 'rent', 'work']);
+ assert.deepStrictEqual((await search('recordsword')).map((r) => r.owner).sort(), ['help', 'host', 'inventory', 'quest', 'rent', 'work']);
});
});
t('events that are not index documents are acknowledged and ignored', async () => {
t('events that are not index documents are acknowledged and ignored', async () => {