@almatar/branding 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +2 -2
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/readme.md +10 -10
package/lib/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import ContextNamespace from './lib/Storage';
|
|
2
2
|
import MultiTenant from './lib/TenantModel/Mongoose/MultiTenant';
|
|
3
|
-
import
|
|
3
|
+
import TenantMongooseModule from './lib/TenantModel/NestMongoose/TenantMongooseModule';
|
|
4
4
|
import TenantRequest from './lib/request/TenantRequest';
|
|
5
5
|
import AlmatarBranding from "./lib/AlmatarBranding";
|
|
6
6
|
declare const _default: {
|
|
7
7
|
ContextNamespace: typeof ContextNamespace;
|
|
8
8
|
MultiTenant: typeof MultiTenant;
|
|
9
|
-
|
|
9
|
+
TenantMongooseModule: typeof TenantMongooseModule;
|
|
10
10
|
TenantRequest: typeof TenantRequest;
|
|
11
11
|
AlmatarBranding: typeof AlmatarBranding;
|
|
12
12
|
};
|
package/lib/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var AlmatarBranding_1 = require("./lib/AlmatarBranding");
|
|
|
7
7
|
module.exports = {
|
|
8
8
|
ContextNamespace: Storage_1.default,
|
|
9
9
|
MultiTenant: MultiTenant_1.default,
|
|
10
|
-
|
|
10
|
+
TenantMongooseModule: TenantMongooseModule_1.default,
|
|
11
11
|
TenantRequest: TenantRequest_1.default,
|
|
12
12
|
AlmatarBranding: AlmatarBranding_1.default
|
|
13
13
|
};
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -10,7 +10,7 @@ this package make microservice able to handle different brands
|
|
|
10
10
|
|
|
11
11
|
save brand on any request using the package middleware in main.ts file
|
|
12
12
|
```
|
|
13
|
-
import { ContextNamespace } from 'almatar
|
|
13
|
+
import { ContextNamespace } from '@almatar/branding';
|
|
14
14
|
|
|
15
15
|
app.use(ContextNamespace.bindENamespace);
|
|
16
16
|
app.use(ContextNamespace.setEBrand);
|
|
@@ -18,14 +18,14 @@ app.use(ContextNamespace.setEBrand);
|
|
|
18
18
|
|
|
19
19
|
### build mongoose model
|
|
20
20
|
|
|
21
|
-
`import {
|
|
21
|
+
`import { TenantMongooseModule } from '@almatar/branding';` instead of `import {MongooseModule} from '@nestjs/mongoose';`
|
|
22
22
|
|
|
23
23
|
```
|
|
24
|
-
import {
|
|
24
|
+
import { TenantMongooseModule } from '@almatar/branding';
|
|
25
25
|
|
|
26
26
|
@Module({
|
|
27
27
|
imports: [
|
|
28
|
-
|
|
28
|
+
TenantMongooseModule.forFeature([{name: 'Test', schema: TestSchema}]),
|
|
29
29
|
],
|
|
30
30
|
controllers: [TestController],
|
|
31
31
|
providers: [
|
|
@@ -48,7 +48,7 @@ example: `await this.Test.find({ id: '123' }).exec()`
|
|
|
48
48
|
save brand on each request by using the package middleware in pre functions on each route
|
|
49
49
|
|
|
50
50
|
```
|
|
51
|
-
import { ContextNamespace } from 'almatar
|
|
51
|
+
import { ContextNamespace } from '@almatar/branding';
|
|
52
52
|
|
|
53
53
|
// configs
|
|
54
54
|
|
|
@@ -69,7 +69,7 @@ handler: (request, reply) => {
|
|
|
69
69
|
### build mongoose model
|
|
70
70
|
|
|
71
71
|
```
|
|
72
|
-
import { MultiTenant } from 'almatar
|
|
72
|
+
import { MultiTenant } from '@almatar/branding';
|
|
73
73
|
const mongoose = require('mongoose');
|
|
74
74
|
|
|
75
75
|
const TestSchema = new mongoose.Schema(
|
|
@@ -105,7 +105,7 @@ Test({ skipBrand: true }).count({}, callback);
|
|
|
105
105
|
### to keep the context in multiple callbacks
|
|
106
106
|
|
|
107
107
|
```
|
|
108
|
-
import { ContextNamespace } from 'almatar
|
|
108
|
+
import { ContextNamespace } from '@almatar/branding';
|
|
109
109
|
|
|
110
110
|
const ns = ContextNamespace.getNamespace();
|
|
111
111
|
async.waterfall(
|
|
@@ -124,12 +124,12 @@ async.waterfall(
|
|
|
124
124
|
### Send request With brand header
|
|
125
125
|
|
|
126
126
|
```
|
|
127
|
-
import {
|
|
127
|
+
import { TenantRequest } from '@almatar/branding';
|
|
128
128
|
|
|
129
129
|
const reqOptions = {
|
|
130
130
|
url: `${BASEURL}/test`
|
|
131
131
|
};
|
|
132
|
-
|
|
132
|
+
TenantRequest.request(reqOptions, (error, response, body) => {
|
|
133
133
|
console.log(body);
|
|
134
134
|
});
|
|
135
135
|
```
|
|
@@ -137,7 +137,7 @@ MultiTenantRequest.request(reqOptions, (error, response, body) => {
|
|
|
137
137
|
### Setup Branding Package
|
|
138
138
|
|
|
139
139
|
```
|
|
140
|
-
import { AlmatarBranding } from 'almatar
|
|
140
|
+
import { AlmatarBranding } from '@almatar/branding';
|
|
141
141
|
|
|
142
142
|
AlmatarBranding.setup({
|
|
143
143
|
employeeAuthService: config.EMPLOYEE_AUTH_SERVICE
|