Skip to content
This repository was archived by the owner on Aug 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/lcid-npm-1.0.0-02d845072b-e8c7a4db07.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/y18n-npm-3.2.2-f9b6b42101-6154fd7544.zip
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion platforms/makhno/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"moment": "^2.29.2",
"mongodb": "^4.3.1",
"nacl-signature": "^1.0.0",
"nconf": "^0.8.5",
"nconf": "^0.11.3",
"node-fetch": "^2.6.7",
"tweetnacl": "^0.14.5"
},
Expand Down
3 changes: 1 addition & 2 deletions platforms/tktrex/backend/config/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
"htmls": "htmls",
"metadata": "metadata",
"full": "full",
"directives": "directives",
"emails": "emails2",
"experiments": "experiments"
"experiments": "experiments2"
},

"mongoHost": "localhost",
Expand Down
6 changes: 6 additions & 0 deletions platforms/tktrex/backend/config/trexstats.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,11 @@
"selector": { }
}
]
},
{
"name": "experiments",
"column": "experiments2",
"timevar": "when",
"variables": [{ "name": "total", "selector": {} }]
}]
}
6 changes: 3 additions & 3 deletions platforms/tktrex/backend/lib/experiments.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const mongo3 = require('./mongo3');

async function pickDirective(experimentId) {
const mongoc = await mongo3.clientConnect({ concurrency: 1 });
const rb = await mongo3.readOne(mongoc, nconf.get('schema').directives, {
const rb = await mongo3.readOne(mongoc, nconf.get('schema').experiments, {
experimentId,
});
await mongoc.close();
Expand All @@ -25,7 +25,7 @@ async function registerDirective(directives) {
directives,
});
const mongoc = await mongo3.clientConnect({ concurrency: 1 });
const exist = await mongo3.readOne(mongoc, nconf.get('schema').directives, {
const exist = await mongo3.readOne(mongoc, nconf.get('schema').experiments, {
experimentId,
});

Expand All @@ -46,7 +46,7 @@ async function registerDirective(directives) {

/* else, we don't had such data, hence */
debug('Registering new experiment %s: %j', experimentId, directives);
await mongo3.writeOne(mongoc, nconf.get('schema').directives, {
await mongo3.writeOne(mongoc, nconf.get('schema').experiments, {
when: new Date(),
directives,
experimentId,
Expand Down
3 changes: 2 additions & 1 deletion platforms/tktrex/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"lint": "eslint ./",
"test": "jest",
"coc": "DEBUG=* ts-node bin/count-o-clock.js",
"tto:watch": "key=fuffa DEBUG=\"*,-express:*,-body-parser:*,-send\" ts-node-dev -r tsconfig-paths/register --respawn --transpile-only bin/observatory",
"tto:start": "DEBUG=\"*,-express:*,-body-parser:*,-send\" ts-node bin/observatory",
"watch": "key=fuffa DEBUG=\"*,-express:*,-body-parser:*,-send\" ts-node-dev -r tsconfig-paths/register --respawn --transpile-only bin/server",
Expand All @@ -32,7 +33,7 @@
"moment": "^2.29.2",
"mongodb": "^4.3.1",
"nacl-signature": "^1.0.0",
"nconf": "^0.8.5",
"nconf": "^0.11.3",
"node-fetch": "^2.6.7",
"nodemon": "^1.19.4",
"tweetnacl": "^0.14.5"
Expand Down
2 changes: 1 addition & 1 deletion platforms/tktrex/backend/routes/__tests__/personal.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('Events', () => {
appTest = await GetTest();
await appTest.mongo3.insertMany(
appTest.mongo,
appTest.config.get('schema').directives,
appTest.config.get('schema').experiments,
[experiment]
);
});
Expand Down
2 changes: 1 addition & 1 deletion platforms/tktrex/backend/routes/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async function getPublic(req) {
// TODO this API can also be cached with the same logic of statistics
const publicDirectives = await mongo3.readLimit(
mongoc,
nconf.get('schema').directives,
nconf.get('schema').experiments,
{}, // TODO { visibility: 'public' },
{ when: -1 },
20,
Expand Down
2 changes: 1 addition & 1 deletion platforms/tktrex/backend/routes/experiments.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ async function list(req) {

const configured = await mongo3.readLimit(
mongoc,
nconf.get('schema').directives,
nconf.get('schema').experiments,
filter,
{ when: -1 },
MAX,
Expand Down
24 changes: 12 additions & 12 deletions platforms/tktrex/backend/scripts/build-indexes.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
ret = db.metadata2.createIndex({id: 1}, {unique: true }); checkret('metadata id', ret);
ret = db.metadata2.createIndex({videoId: 1}); checkret('metadata videoId', ret);
ret = db.metadata2.createIndex({"sections.videos.videoId": 1}); checkret('metadata sections.videos.href', ret);
ret = db.metadata2.createIndex({authorName: 1}); checkret('metadata authorName', ret);
ret = db.metadata2.createIndex({publicKey: 1}); checkret('metadata publicKey', ret);
ret = db.metadata2.createIndex({savingTime: -1}); checkret('metadata savingTime', ret);
ret = db.metadata2.createIndex({type: -1}); checkret('metadata type', ret);
ret = db.metadata.createIndex({id: 1}, {unique: true }); checkret('metadata id', ret);
ret = db.metadata.createIndex({videoId: 1}); checkret('metadata videoId', ret);
ret = db.metadata.createIndex({"sections.videos.videoId": 1}); checkret('metadata sections.videos.href', ret);
ret = db.metadata.createIndex({authorName: 1}); checkret('metadata authorName', ret);
ret = db.metadata.createIndex({publicKey: 1}); checkret('metadata publicKey', ret);
ret = db.metadata.createIndex({savingTime: -1}); checkret('metadata savingTime', ret);
ret = db.metadata.createIndex({type: -1}); checkret('metadata type', ret);

ret = db.supporters.createIndex({ publicKey: 1 }, { unique: true }); checkret('supporters publicKey:', ret);

ret = db.experiments2.createIndex({ experimentId: -1, unique: true });
checkret('experiments2 experimentId', ret);
ret = db.experiments2.createIndex({ when: -1 });
checkret('experiments2 when', ret);

ret = db.htmls.createIndex({ id: 1 }, { unique: true} ); checkret('htmls id', ret);
ret = db.htmls.createIndex({ savingTime: -1 }); checkret('htmls savingTime', ret);
ret = db.htmls.createIndex({ publicKey: -1 }); checkret('htmls publicKey', ret);
ret = db.htmls.createIndex({ metadataId: -1 }); checkret('htmls metadataId', ret);
ret = db.htmls.createIndex({ processed: 1 }); checkret('htmls processed', ret);

ret = db.retrieved.createIndex({ videoId: 1 }, { unique: true} ); checkret('retrieved videoId', ret);
ret = db.retrieved.createIndex({ when: -1 }); checkret('retrieved when', ret);

ret = db.categories.createIndex({ videoId: 1 }, { unique: true} ); checkret('categories videoId', ret);
ret = db.categories.createIndex({ when: -1 }); checkret('categories when', ret);

function checkret(info, retval) {
retval.info = info;
Expand Down
3 changes: 1 addition & 2 deletions platforms/yttrex/backend/config/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"answers": "answers",
"recommendations": "recommendations",
"ytvids": "ytvids",
"experiments": "experiments",
"directives": "directives",
"experiments": "experiments2",
"emails": "emails",
"tokens": "tokens",
"creators": "creators",
Expand Down
12 changes: 9 additions & 3 deletions platforms/yttrex/backend/config/trexstats.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
},
{
"name": "experiment",
"selector": { "type": "video", "experiment": { "$exists": true } }
"selector": { "type": "video", "experimentId": { "$exists": true } }
}
]
},
Expand Down Expand Up @@ -129,7 +129,7 @@
},
{
"name": "experiment",
"selector": { "experiment": { "$exists": true }, "type": "search" }
"selector": { "experimentId": { "$exists": true }, "type": "search" }
}
]
},
Expand All @@ -145,10 +145,16 @@
{ "name": "home", "selector": { "nature.type": "home" } },
{
"name": "experiment",
"selector": { "experiment": { "$exists": true } }
"selector": { "experimentId": { "$exists": true } }
}
]
},
{
"name": "experiments",
"column": "experiments2",
"timevar": "when",
"variables": [{ "name": "total", "selector": {} }]
},
{
"name": "creators",
"column": "creators",
Expand Down
6 changes: 3 additions & 3 deletions platforms/yttrex/backend/lib/automo.js
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ async function registerDirective(directives, directiveType) {
directives,
});
const mongoc = await mongo3.clientConnect({ concurrency: 1 });
const exist = await mongo3.readOne(mongoc, nconf.get('schema').directives, {
const exist = await mongo3.readOne(mongoc, nconf.get('schema').experiments, {
experimentId,
});

Expand All @@ -845,7 +845,7 @@ async function registerDirective(directives, directiveType) {
}

/* else, we don't had such data, hence */
await mongo3.writeOne(mongoc, nconf.get('schema').directives, {
await mongo3.writeOne(mongoc, nconf.get('schema').experiments, {
when: new Date(),
directiveType,
directives,
Expand All @@ -858,7 +858,7 @@ async function registerDirective(directives, directiveType) {

async function pickDirective(experimentId) {
const mongoc = await mongo3.clientConnect({ concurrency: 1 });
const rb = await mongo3.readOne(mongoc, nconf.get('schema').directives, {
const rb = await mongo3.readOne(mongoc, nconf.get('schema').experiments, {
experimentId,
});
await mongoc.close();
Expand Down
2 changes: 1 addition & 1 deletion platforms/yttrex/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"moment": "^2.29.2",
"mongodb": "^4.3.1",
"nacl-signature": "^1.0.0",
"nconf": "^0.8.5",
"nconf": "^0.11.3",
"node-fetch": "^2.6.7",
"numeral": "^2.0.6",
"ts-endpoint": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion platforms/yttrex/backend/routes/__tests__/personal.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Events', () => {
appTest = await GetTest();
await appTest.mongo3.insertMany(
appTest.mongo,
appTest.config.get('schema').directives,
appTest.config.get('schema').experiments,
[experiment]
);
});
Expand Down
2 changes: 1 addition & 1 deletion platforms/yttrex/backend/routes/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ async function getPublic(req) {

const publicDirectives = await mongo3.readLimit(
mongoc,
nconf.get('schema').directives,
nconf.get('schema').experiments,
filter,
{ when: -1 },
20,
Expand Down
6 changes: 3 additions & 3 deletions platforms/yttrex/backend/routes/experiments.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ async function list(req) {

const configured = await mongo3.readLimit(
mongoc,
nconf.get('schema').directives,
nconf.get('schema').experiments,
filter,
{ when: -1 },
options.amount,
Expand All @@ -264,7 +264,7 @@ async function list(req) {

const total = await mongo3.count(
mongoc,
nconf.get('schema').directives,
nconf.get('schema').experiments,
filter
);

Expand Down Expand Up @@ -327,7 +327,7 @@ async function emergency(req) {
const experimentId = params.getString(req, 'experimentId', true);
const directive = await mongo3.readOne(
mongoc,
nconf.get('schema').directives,
nconf.get('schema').experiments,
{
experimentId,
directiveType: 'comparison',
Expand Down
31 changes: 15 additions & 16 deletions platforms/yttrex/backend/scripts/build-indexes.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ checkret('errors id', ret);
ret = db.errors.createIndex({ when: -1 });
checkret('errors when', ret);


ret = db.ads.createIndex({ metadataId: 1 });
checkret('ads metadataId', ret);
ret = db.ads.createIndex({ savingTime: -1 });
checkret('ads savingTime', ret);
ret = db.ads.createIndex({ id: 1 }, { unique: true });
checkret('ads id', ret);

ret = db.experiments2.createIndex({ experimentId: -1, unique: true });
checkret('experiments2 experimentId', ret);
ret = db.experiments2.createIndex({ when: -1 });
checkret('experiments2 when', ret);


/* below this the collections are for youchoose */
ret = db.recommendations.createIndex({ urlId: 1 }, { unique: true });
checkret('recommendations urlId', ret);
ret = db.recommendations.createIndex({ when: -1 });
Expand All @@ -62,16 +77,6 @@ checkret('ytvids videoId', ret);
ret = db.ytvids.createIndex({ creatorId: -1 });
checkret('ytvids creatorId', ret);

ret = db.directives.createIndex({ experimentId: -1 }, { unique: true });
checkret('directives experimentId', ret);

ret = db.experiments.createIndex({ experimentId: -1 });
checkret('experiments experimentId', ret);
ret = db.experiments.createIndex({ publicKey: -1 });
checkret('experiments publicKey', ret);
ret = db.experiments.createIndex({ testTime: -1 });
checkret('experiments testTime', ret);

ret = db.tokens.createIndex({ channelId: 1 }, { unique: true });
checkret('tokens unique channelId', ret);
ret = db.tokens.createIndex({ verificationToken: 1 });
Expand All @@ -87,12 +92,6 @@ checkret('creators channelId', ret);
ret = db.creators.createIndex({ accessToken: 1 });
checkret('creators accessToken', ret);

ret = db.ads.createIndex({ metadataId: 1 });
checkret('ads metadataId', ret);
ret = db.ads.createIndex({ savingTime: -1 });
checkret('ads savingTime', ret);
ret = db.ads.createIndex({ id: 1 }, { unique: true });
checkret('ads id', ret);

function checkret(info, retval) {
retval.info = info;
Expand Down
Loading