Skip to content

Commit

Permalink
chore: removed lerna, fixed versions
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinries committed Oct 11, 2023
1 parent f329df0 commit a59e266
Show file tree
Hide file tree
Showing 32 changed files with 10,039 additions and 18,673 deletions.
7 changes: 1 addition & 6 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ module.exports = {
testEnvironment: 'node',
displayName: '@weave-js/lock-store',
testMatch: ['<rootDir>/packages/lock-stores/lock-store/**/?(*.)+(spec|test).[jt]s?(x)']
},
// {
// testEnvironment: 'node',
// displayName: '@weave-js/lock-store-mongodb',
// testMatch: ['<rootDir>/packages/lock-stores/lock-store-adapters/mongo-db/**/?(*.)+(spec|test).[jt]s?(x)']
// }
}
]
};
31 changes: 0 additions & 31 deletions lerna.json

This file was deleted.

3 changes: 3 additions & 0 deletions misc/development/test.withDataNestedResponse.data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "Walter white"
}
5 changes: 5 additions & 0 deletions misc/development/test.withDataNestedResponse.meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"user": {
"_id": "s213123eadslalkfjlsdlfk"
}
}
94 changes: 84 additions & 10 deletions misc/development/tracing.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const { createInMemoryCache } = require('../../packages/cache/redis/node_modules/@weave-js/core/lib/cache/adapters');
const { createBroker } = require('../../packages/core/core/lib');
const repl = require('../../packages/core/repl/lib/index');
const { createZipkinExporter } = require('../../packages/tracing-adapters/zipkin/lib/index');
Expand All @@ -8,25 +7,80 @@ const app = createBroker({
logger: {
enabled: true
},
cache: {
enabled: true,
adapter: createInMemoryCache()
},
// cache: {
// enabled: false,
// adapter: createInMemoryCache()
// },
tracing: {
enabled: true,
collectors: [
createZipkinExporter()
],
samplingRate: 1
defaultTags: {
environment: 'development'
},
samplingRate: 1,
actions: {
meta: true,
tags: {
'default-action-tag': 'default-action-tag-value'
}
}
}
});

app.createService({
name: 'test',
actions: {
hello: {
tracing: {
spanName: 'Keven'
},
async handler (context) {
const span1 = context.startSpan('do some fancy stuff');
await new Promise((resolve) => {
setTimeout(async () => {
resolve();
}, 20);
});

await context.call('greater.hello');
context.finishSpan(span1);

context.emit('hello.sent');
return context.call('greater.hello');
return false;
}
},
withData: {
params: {
name: 'string'
},
tracing: {
tags: {
response: true
}
},
async handler (context) {
console.log(context.data.name);
return context.data.name;
}
},
withDataNestedResponse: {
params: {
name: 'string'
},
tracing: {
tags: {
response: ['timestamps', 'name', 'user._id'],
meta: true
}
},
async handler (context) {
console.log(context.data.name);
return {
name: context.data.name,
timestamp: Date.now()
};
}
}
}
Expand All @@ -35,8 +89,15 @@ app.createService({
app.createService({
name: 'greater',
actions: {
hello (context) {
return 'text from test2';
hello: {
tracing: {
tags: {
response: true
}
},
handler (context) {
return 'text from test2';
}
},
goodbye: {
cache: {
Expand All @@ -59,7 +120,20 @@ app.createService({
events: {
async 'hello.sent' (context) {
await context.call('greater.goodbye');
await this.actions.hello();

const span2 = context.startSpan('calling here API', {
tags: {
query: 'Las Vegas'
}
});
await new Promise((resolve) => {
setTimeout(async () => {
resolve();
}, 3000);
});
context.finishSpan(span2);

await this.actions.hello({}, { parentContext: context });
}
}
});
Expand Down
Loading

0 comments on commit a59e266

Please sign in to comment.