backend-test-tools 1.0.4 → 1.0.6

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.
Files changed (54) hide show
  1. package/README.md +0 -34
  2. package/dist/factory/factory.js +0 -1
  3. package/dist/factory/factory.js.map +1 -1
  4. package/dist/factory/factory.types.d.ts +1 -8
  5. package/dist/factory/factory.types.js.map +1 -1
  6. package/dist/factory/workers/index.d.ts +0 -4
  7. package/dist/factory/workers/index.js +0 -44
  8. package/dist/factory/workers/index.js.map +1 -1
  9. package/dist/factory/workers/user.js +1 -22
  10. package/dist/factory/workers/user.js.map +1 -1
  11. package/dist/factory/workers/user.types.d.ts +0 -34
  12. package/dist/factory/workers/user.types.js.map +1 -1
  13. package/dist/generators/index.d.ts +0 -2
  14. package/dist/generators/index.js +0 -22
  15. package/dist/generators/index.js.map +1 -1
  16. package/dist/utils/index.d.ts +0 -1
  17. package/dist/utils/index.js +0 -11
  18. package/dist/utils/index.js.map +1 -1
  19. package/package.json +2 -2
  20. package/src/factory/factory.ts +8 -9
  21. package/src/factory/factory.types.ts +0 -9
  22. package/src/factory/workers/index.ts +0 -4
  23. package/src/factory/workers/user.ts +0 -22
  24. package/src/factory/workers/user.types.ts +0 -34
  25. package/src/generators/index.ts +0 -2
  26. package/src/utils/index.ts +0 -1
  27. package/dist/factory/workers/connection.d.ts +0 -3
  28. package/dist/factory/workers/connection.js +0 -25
  29. package/dist/factory/workers/connection.js.map +0 -1
  30. package/dist/factory/workers/connection.types.d.ts +0 -28
  31. package/dist/factory/workers/connection.types.js +0 -2
  32. package/dist/factory/workers/connection.types.js.map +0 -1
  33. package/dist/factory/workers/organization.d.ts +0 -3
  34. package/dist/factory/workers/organization.js +0 -36
  35. package/dist/factory/workers/organization.js.map +0 -1
  36. package/dist/factory/workers/organization.types.d.ts +0 -51
  37. package/dist/factory/workers/organization.types.js +0 -2
  38. package/dist/factory/workers/organization.types.js.map +0 -1
  39. package/dist/generators/generateChatId.d.ts +0 -2
  40. package/dist/generators/generateChatId.js +0 -13
  41. package/dist/generators/generateChatId.js.map +0 -1
  42. package/dist/generators/generateRegId.d.ts +0 -4
  43. package/dist/generators/generateRegId.js +0 -14
  44. package/dist/generators/generateRegId.js.map +0 -1
  45. package/dist/utils/getAdminApiBearer.d.ts +0 -2
  46. package/dist/utils/getAdminApiBearer.js +0 -19
  47. package/dist/utils/getAdminApiBearer.js.map +0 -1
  48. package/src/factory/workers/connection.ts +0 -22
  49. package/src/factory/workers/connection.types.ts +0 -29
  50. package/src/factory/workers/organization.ts +0 -35
  51. package/src/factory/workers/organization.types.ts +0 -53
  52. package/src/generators/generateChatId.ts +0 -6
  53. package/src/generators/generateRegId.ts +0 -9
  54. package/src/utils/getAdminApiBearer.ts +0 -17
package/README.md CHANGED
@@ -10,9 +10,7 @@ Tools to be used by the Node backend services for testing purpose.
10
10
  - [Access token](#access-token)
11
11
  - [Social provider](#social-provider)
12
12
  - [Auth0 ID](#auth0-id)
13
- - [Chat ID](#chat-id)
14
13
  - [Locale](#locale)
15
- - [RegId](#regid)
16
14
  - [RSA Key Pair](#rsa-key-pair)
17
15
  - [User public key](#user-public-key)
18
16
  - [User encrypted private key](#user-encrypted-private-key)
@@ -20,9 +18,6 @@ Tools to be used by the Node backend services for testing purpose.
20
18
  - [Factory](#factory)
21
19
  - [Build](#build)
22
20
  - [Models](#models)
23
- - [Connection](#connection)
24
- - [Identity](#identity)
25
- - [Organization](#organization)
26
21
  - [User](#user)
27
22
  - [Utilities](#utilities)
28
23
  - [TLS](#tls)
@@ -71,15 +66,6 @@ const auth0Id = generateAuth0UserId(full)
71
66
 
72
67
  - **full** (Boolean): prefix the provider name to the ID to create a full auth0 ID also known as externalID. (default: false)
73
68
 
74
- ### Chat ID
75
-
76
- Get a random BlackBerry Spark chat ID
77
-
78
- ```javascript
79
- import {generateChatId} from 'backend-test-tools'
80
- const chatId = generateChatId()
81
- ```
82
-
83
69
  ### Locale
84
70
 
85
71
  Get a random locale from the ones available.
@@ -89,15 +75,6 @@ import {generateLocale} from 'backend-test-tools'
89
75
  const locale = generateLocale()
90
76
  ```
91
77
 
92
- ### RegId
93
-
94
- Get a random Blackberry Spark regId.
95
-
96
- ```javascript
97
- import {generateRegId} from 'backend-test-tools'
98
- const regId = generateRegId()
99
- ```
100
-
101
78
  ### RSA Key Pair
102
79
 
103
80
  Get RSA key pair and save to certs folder.
@@ -182,13 +159,6 @@ import {factory} from 'backend-test-tools'
182
159
  const model = factory.build('identity')
183
160
  ```
184
161
 
185
- #### Organization
186
-
187
- ```javascript
188
- import {factory} from 'backend-test-tools'
189
- const model = factory.build('organization')
190
- ```
191
-
192
162
  #### User
193
163
 
194
164
  ```javascript
@@ -196,8 +166,6 @@ import {factory} from 'backend-test-tools'
196
166
  const buildOptions = {
197
167
  firstName: John,
198
168
  lastName: Doe,
199
- organizationId: '51f0ac7a-4b79-485f-9a0f-a0eb7a5d8aa8',
200
- admin: false,
201
169
  member: false,
202
170
  moreRandom: false
203
171
  }
@@ -206,8 +174,6 @@ const model = factory.build('user', undefined, buildOptions)
206
174
 
207
175
  - **firstName**: First name of the user, will also define all the variations of name.
208
176
  - **lastName**: Last name of the user, will also define all the variations of name.
209
- - **organizationId**: Id of the organization to which the user is related. Will define the date at which he joined.
210
- - **admin**: User is admin of the organization.
211
177
  - **member**: User is a member of the organization.
212
178
  - **moreRandom**: Adds randomness to unique fields to avoid collisions when building a large number of objects.
213
179
 
@@ -7,7 +7,6 @@ exports.factory = void 0;
7
7
  var _crypto = require("crypto");
8
8
  var _workers = require("./workers");
9
9
  const modelsMap = {
10
- connection: _workers.connectionFactoryWorker,
11
10
  user: _workers.userFactoryWorker
12
11
  };
13
12
  const factory = exports.factory = {
@@ -1 +1 @@
1
- {"version":3,"file":"factory.js","names":["_crypto","require","_workers","modelsMap","connection","connectionFactoryWorker","user","userFactoryWorker","factory","exports","build","name","attributes","buildOptions","Object","keys","includes","Error","worker","instance","id","randomUUID","buildMany","count","instances","i","push"],"sources":["../../src/factory/factory.ts"],"sourcesContent":["import {randomUUID} from 'crypto';\nimport {\n FactoryModel,\n FactoryBuildOptions,\n FactoryModelOverride,\n FactoryReturnType,\n ModelsMap,\n} from './factory.types';\nimport {connectionFactoryWorker, userFactoryWorker} from './workers';\n\nconst modelsMap: ModelsMap = {\n connection: connectionFactoryWorker,\n user: userFactoryWorker,\n};\n\nexport const factory = {\n /**\n * Build an object according to a defined model\n */\n build: function <T extends FactoryModel>(\n name: T,\n attributes: FactoryModelOverride<T> = {},\n buildOptions: FactoryBuildOptions<T> = {},\n ): FactoryReturnType<T> {\n if (!Object.keys(modelsMap).includes(name)) throw new Error(`Factory: unknown model \"${name}\"`);\n const worker = modelsMap[name];\n const instance = worker(buildOptions);\n return {\n id: randomUUID(),\n ...instance,\n ...attributes,\n };\n },\n\n /**\n * Build multiple objects according to a defined model\n */\n buildMany: function <T extends FactoryModel>(\n name: T,\n count: number,\n attributes: FactoryModelOverride<T> = {},\n buildOptions: FactoryBuildOptions<T> = {},\n ): Array<FactoryReturnType<T>> {\n const instances: Array<FactoryReturnType<T>> = [];\n for (let i = 0; i < count; i++) {\n instances.push(this.build(name, attributes, buildOptions));\n }\n return instances;\n },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAQA,IAAAC,QAAA,GAAAD,OAAA;AAEA,MAAME,SAAoB,GAAG;EAC3BC,UAAU,EAAEC,gCAAuB;EACnCC,IAAI,EAAEC;AACR,CAAC;AAEM,MAAMC,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG;EACrB;AACF;AACA;EACEE,KAAK,EAAE,SAAAA,CACLC,IAAO,EACPC,UAAmC,GAAG,CAAC,CAAC,EACxCC,YAAoC,GAAG,CAAC,CAAC,EACnB;IACtB,IAAI,CAACC,MAAM,CAACC,IAAI,CAACZ,SAAS,CAAC,CAACa,QAAQ,CAACL,IAAI,CAAC,EAAE,MAAM,IAAIM,KAAK,CAAC,2BAA2BN,IAAI,GAAG,CAAC;IAC/F,MAAMO,MAAM,GAAGf,SAAS,CAACQ,IAAI,CAAC;IAC9B,MAAMQ,QAAQ,GAAGD,MAAM,CAACL,YAAY,CAAC;IACrC,OAAO;MACLO,EAAE,EAAE,IAAAC,kBAAU,EAAC,CAAC;MAChB,GAAGF,QAAQ;MACX,GAAGP;IACL,CAAC;EACH,CAAC;EAED;AACF;AACA;EACEU,SAAS,EAAE,SAAAA,CACTX,IAAO,EACPY,KAAa,EACbX,UAAmC,GAAG,CAAC,CAAC,EACxCC,YAAoC,GAAG,CAAC,CAAC,EACZ;IAC7B,MAAMW,SAAsC,GAAG,EAAE;IACjD,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,KAAK,EAAEE,CAAC,EAAE,EAAE;MAC9BD,SAAS,CAACE,IAAI,CAAC,IAAI,CAAChB,KAAK,CAACC,IAAI,EAAEC,UAAU,EAAEC,YAAY,CAAC,CAAC;IAC5D;IACA,OAAOW,SAAS;EAClB;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"factory.js","names":["_crypto","require","_workers","modelsMap","user","userFactoryWorker","factory","exports","build","name","attributes","buildOptions","Object","keys","includes","Error","worker","instance","id","randomUUID","buildMany","count","instances","i","push"],"sources":["../../src/factory/factory.ts"],"sourcesContent":["import { randomUUID } from 'crypto';\nimport {\n FactoryModel,\n FactoryBuildOptions,\n FactoryModelOverride,\n FactoryReturnType,\n ModelsMap\n} from './factory.types';\nimport { userFactoryWorker } from './workers';\n\nconst modelsMap: ModelsMap = {\n user: userFactoryWorker\n};\n\nexport const factory = {\n /**\n * Build an object according to a defined model\n */\n build: function <T extends FactoryModel>(\n name: T,\n attributes: FactoryModelOverride<T> = {},\n buildOptions: FactoryBuildOptions<T> = {}\n ): FactoryReturnType<T> {\n if (!Object.keys(modelsMap).includes(name)) throw new Error(`Factory: unknown model \"${name}\"`);\n const worker = modelsMap[name];\n const instance = worker(buildOptions);\n return {\n id: randomUUID(),\n ...instance,\n ...attributes\n };\n },\n\n /**\n * Build multiple objects according to a defined model\n */\n buildMany: function <T extends FactoryModel>(\n name: T,\n count: number,\n attributes: FactoryModelOverride<T> = {},\n buildOptions: FactoryBuildOptions<T> = {}\n ): Array<FactoryReturnType<T>> {\n const instances: Array<FactoryReturnType<T>> = [];\n for (let i = 0; i < count; i++) {\n instances.push(this.build(name, attributes, buildOptions));\n }\n return instances;\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAQA,IAAAC,QAAA,GAAAD,OAAA;AAEA,MAAME,SAAoB,GAAG;EAC3BC,IAAI,EAAEC;AACR,CAAC;AAEM,MAAMC,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG;EACrB;AACF;AACA;EACEE,KAAK,EAAE,SAAAA,CACLC,IAAO,EACPC,UAAmC,GAAG,CAAC,CAAC,EACxCC,YAAoC,GAAG,CAAC,CAAC,EACnB;IACtB,IAAI,CAACC,MAAM,CAACC,IAAI,CAACV,SAAS,CAAC,CAACW,QAAQ,CAACL,IAAI,CAAC,EAAE,MAAM,IAAIM,KAAK,CAAC,2BAA2BN,IAAI,GAAG,CAAC;IAC/F,MAAMO,MAAM,GAAGb,SAAS,CAACM,IAAI,CAAC;IAC9B,MAAMQ,QAAQ,GAAGD,MAAM,CAACL,YAAY,CAAC;IACrC,OAAO;MACLO,EAAE,EAAE,IAAAC,kBAAU,EAAC,CAAC;MAChB,GAAGF,QAAQ;MACX,GAAGP;IACL,CAAC;EACH,CAAC;EAED;AACF;AACA;EACEU,SAAS,EAAE,SAAAA,CACTX,IAAO,EACPY,KAAa,EACbX,UAAmC,GAAG,CAAC,CAAC,EACxCC,YAAoC,GAAG,CAAC,CAAC,EACZ;IAC7B,MAAMW,SAAsC,GAAG,EAAE;IACjD,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,KAAK,EAAEE,CAAC,EAAE,EAAE;MAC9BD,SAAS,CAACE,IAAI,CAAC,IAAI,CAAChB,KAAK,CAACC,IAAI,EAAEC,UAAU,EAAEC,YAAY,CAAC,CAAC;IAC5D;IACA,OAAOW,SAAS;EAClB;AACF,CAAC","ignoreList":[]}
@@ -1,12 +1,5 @@
1
- import { ConnectionModel, ConnectionBuildOptions, UserModel, UserBuildOptions } from './workers';
1
+ import { UserModel, UserBuildOptions } from './workers';
2
2
  type FactoryTyping = {
3
- /** Mapping for the connection model */
4
- connection: {
5
- /** Options for the connection model */
6
- options: ConnectionBuildOptions;
7
- /** Return type for the connection model */
8
- return: ConnectionModel;
9
- };
10
3
  /** Mapping for the user model */
11
4
  user: {
12
5
  /** Options for the user model */
@@ -1 +1 @@
1
- {"version":3,"file":"factory.types.js","names":[],"sources":["../../src/factory/factory.types.ts"],"sourcesContent":["import {\n ConnectionModel,\n ConnectionBuildOptions,\n UserModel,\n UserBuildOptions,\n} from './workers';\n\ntype FactoryTyping = {\n /** Mapping for the connection model */\n connection: {\n /** Options for the connection model */\n options: ConnectionBuildOptions;\n /** Return type for the connection model */\n return: ConnectionModel;\n };\n /** Mapping for the user model */\n user: {\n /** Options for the user model */\n options: UserBuildOptions;\n /** Return type for the user model */\n return: UserModel;\n };\n};\n\nexport type FactoryModel = keyof FactoryTyping;\n\nexport type FactoryModelOverride<T extends FactoryModel> = Partial<FactoryTyping[T]['return']> & {\n /** Id of the model */\n id?: string;\n};\n\nexport type FactoryBuildOptions<T extends FactoryModel> = FactoryTyping[T]['options'];\n\nexport type FactoryReturnType<T extends FactoryModel> = FactoryTyping[T]['return'] & {\n /** Id of the model */\n id: string;\n};\n\nexport type ModelsMap = {\n [T in FactoryModel]: (buildOptions: FactoryTyping[T]['options']) => FactoryTyping[T]['return'];\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"factory.types.js","names":[],"sources":["../../src/factory/factory.types.ts"],"sourcesContent":["import {\n UserModel,\n UserBuildOptions,\n} from './workers';\n\ntype FactoryTyping = {\n /** Mapping for the user model */\n user: {\n /** Options for the user model */\n options: UserBuildOptions;\n /** Return type for the user model */\n return: UserModel;\n };\n};\n\nexport type FactoryModel = keyof FactoryTyping;\n\nexport type FactoryModelOverride<T extends FactoryModel> = Partial<FactoryTyping[T]['return']> & {\n /** Id of the model */\n id?: string;\n};\n\nexport type FactoryBuildOptions<T extends FactoryModel> = FactoryTyping[T]['options'];\n\nexport type FactoryReturnType<T extends FactoryModel> = FactoryTyping[T]['return'] & {\n /** Id of the model */\n id: string;\n};\n\nexport type ModelsMap = {\n [T in FactoryModel]: (buildOptions: FactoryTyping[T]['options']) => FactoryTyping[T]['return'];\n};\n"],"mappings":"","ignoreList":[]}
@@ -1,6 +1,2 @@
1
1
  export * from './user';
2
2
  export * from './user.types';
3
- export * from './connection';
4
- export * from './connection.types';
5
- export * from './organization';
6
- export * from './organization.types';
@@ -25,48 +25,4 @@ Object.keys(_user2).forEach(function (key) {
25
25
  }
26
26
  });
27
27
  });
28
- var _connection = require("./connection");
29
- Object.keys(_connection).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _connection[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _connection[key];
36
- }
37
- });
38
- });
39
- var _connection2 = require("./connection.types");
40
- Object.keys(_connection2).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _connection2[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function () {
46
- return _connection2[key];
47
- }
48
- });
49
- });
50
- var _organization = require("./organization");
51
- Object.keys(_organization).forEach(function (key) {
52
- if (key === "default" || key === "__esModule") return;
53
- if (key in exports && exports[key] === _organization[key]) return;
54
- Object.defineProperty(exports, key, {
55
- enumerable: true,
56
- get: function () {
57
- return _organization[key];
58
- }
59
- });
60
- });
61
- var _organization2 = require("./organization.types");
62
- Object.keys(_organization2).forEach(function (key) {
63
- if (key === "default" || key === "__esModule") return;
64
- if (key in exports && exports[key] === _organization2[key]) return;
65
- Object.defineProperty(exports, key, {
66
- enumerable: true,
67
- get: function () {
68
- return _organization2[key];
69
- }
70
- });
71
- });
72
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_user","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_user2","_connection","_connection2","_organization","_organization2"],"sources":["../../../src/factory/workers/index.ts"],"sourcesContent":["export * from './user';\nexport * from './user.types';\nexport * from './connection';\nexport * from './connection.types';\nexport * from './organization';\nexport * from './organization.types';\n"],"mappings":";;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,MAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,MAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,MAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,MAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,WAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,WAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAA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AAAT,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_user","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_user2"],"sources":["../../../src/factory/workers/index.ts"],"sourcesContent":["export * from './user';\nexport * from './user.types';\n"],"mappings":";;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,MAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,MAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,MAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,MAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.userFactoryWorker = userFactoryWorker;
7
- var _crypto = require("crypto");
8
7
  var _faker = require("@faker-js/faker");
9
8
  var _generators = require("../../generators");
10
9
  /**
@@ -17,36 +16,16 @@ function userFactoryWorker(buildOptions = {}) {
17
16
  firstName,
18
17
  lastName
19
18
  });
20
- const userName = _faker.faker.internet.userName({
21
- firstName,
22
- lastName
23
- });
24
19
  const random = Math.random().toString(36).substring(7);
25
20
  return {
26
21
  firstName,
27
22
  lastName,
28
- firstNameLastName: `${firstName}${lastName}`,
29
- firstNameSpaceLastName: `${firstName} ${lastName}`,
30
- lastNameFirstName: `${lastName}${firstName}`,
31
- lastNameSpaceFirstName: `${lastName} ${firstName}`,
32
23
  displayName: `${firstName} ${lastName}`,
33
24
  casualName: `${firstName}`,
34
25
  formalName: `${firstName}`,
35
26
  email: buildOptions.moreRandom ? `${random}${email}` : email,
36
- username: buildOptions.moreRandom ? `${random}${userName}` : userName,
37
- regId: (0, _generators.generateRegId)(),
38
27
  locale: (0, _generators.generateLocale)(),
39
- pictureUrl: _faker.faker.image.avatar(),
40
- linkId: (0, _crypto.randomUUID)(),
41
- bbId: (0, _crypto.randomUUID)(),
42
- bbEncrypted: (0, _generators.generateBbEncrypted)(),
43
- signKeyEncrypted: (0, _generators.generateSignKeyEncrypted)(),
44
- signKeyPub: (0, _generators.generateSignKeyPub)(),
45
- autoConnect: true,
46
- searchable: true,
47
- enableUrlScan: true,
48
- enableMessageTranslation: true,
49
- emailVisibility: true
28
+ pictureUrl: _faker.faker.image.avatar()
50
29
  };
51
30
  }
52
31
  //# sourceMappingURL=user.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"user.js","names":["_crypto","require","_faker","_generators","userFactoryWorker","buildOptions","firstName","faker","person","lastName","email","internet","userName","random","Math","toString","substring","firstNameLastName","firstNameSpaceLastName","lastNameFirstName","lastNameSpaceFirstName","displayName","casualName","formalName","moreRandom","username","regId","generateRegId","locale","generateLocale","pictureUrl","image","avatar","linkId","randomUUID","bbId","bbEncrypted","generateBbEncrypted","signKeyEncrypted","generateSignKeyEncrypted","signKeyPub","generateSignKeyPub","autoConnect","searchable","enableUrlScan","enableMessageTranslation","emailVisibility"],"sources":["../../../src/factory/workers/user.ts"],"sourcesContent":["import { randomUUID } from 'crypto';\nimport { faker } from '@faker-js/faker';\nimport { UserModel, UserBuildOptions } from './user.types';\nimport {\n generateRegId,\n generateLocale,\n generateSignKeyPub,\n generateSignKeyEncrypted,\n generateBbEncrypted\n} from 'generators';\n\n/**\n * Create a random user\n */\nexport function userFactoryWorker(\n buildOptions: UserBuildOptions = {}\n): UserModel {\n const firstName = buildOptions.firstName ?? faker.person.firstName();\n const lastName = buildOptions.lastName ?? faker.person.lastName();\n const email = faker.internet.email({ firstName, lastName });\n const userName = faker.internet.userName({ firstName, lastName });\n const random = Math.random().toString(36).substring(7);\n return {\n firstName,\n lastName,\n firstNameLastName: `${firstName}${lastName}`,\n firstNameSpaceLastName: `${firstName} ${lastName}`,\n lastNameFirstName: `${lastName}${firstName}`,\n lastNameSpaceFirstName: `${lastName} ${firstName}`,\n displayName: `${firstName} ${lastName}`,\n casualName: `${firstName}`,\n formalName: `${firstName}`,\n email: buildOptions.moreRandom ? `${random}${email}` : email,\n username: buildOptions.moreRandom ? `${random}${userName}` : userName,\n regId: generateRegId(),\n locale: generateLocale(),\n pictureUrl: faker.image.avatar(),\n linkId: randomUUID(),\n bbId: randomUUID(),\n bbEncrypted: generateBbEncrypted(),\n signKeyEncrypted: generateSignKeyEncrypted(),\n signKeyPub: generateSignKeyPub(),\n autoConnect: true,\n searchable: true,\n enableUrlScan: true,\n enableMessageTranslation: true,\n emailVisibility: true\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAQA;AACA;AACA;AACO,SAASG,iBAAiBA,CAC/BC,YAA8B,GAAG,CAAC,CAAC,EACxB;EACX,MAAMC,SAAS,GAAGD,YAAY,CAACC,SAAS,IAAIC,YAAK,CAACC,MAAM,CAACF,SAAS,CAAC,CAAC;EACpE,MAAMG,QAAQ,GAAGJ,YAAY,CAACI,QAAQ,IAAIF,YAAK,CAACC,MAAM,CAACC,QAAQ,CAAC,CAAC;EACjE,MAAMC,KAAK,GAAGH,YAAK,CAACI,QAAQ,CAACD,KAAK,CAAC;IAAEJ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AC;IAChCC,WAAW,EAAE,IAAI;IACjBC,UAAU,EAAE,IAAI;IAChBC,aAAa,EAAE,IAAI;IACnBC,wBAAwB,EAAE,IAAI;IAC9BC,eAAe,EAAE;EACnB,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"user.js","names":["_faker","require","_generators","userFactoryWorker","buildOptions","firstName","faker","person","lastName","email","internet","random","Math","toString","substring","displayName","casualName","formalName","moreRandom","locale","generateLocale","pictureUrl","image","avatar"],"sources":["../../../src/factory/workers/user.ts"],"sourcesContent":["import { faker } from '@faker-js/faker';\nimport { UserModel, UserBuildOptions } from './user.types';\nimport {\n generateLocale,\n} from 'generators';\n\n/**\n * Create a random user\n */\nexport function userFactoryWorker(\n buildOptions: UserBuildOptions = {}\n): UserModel {\n const firstName = buildOptions.firstName ?? faker.person.firstName();\n const lastName = buildOptions.lastName ?? faker.person.lastName();\n const email = faker.internet.email({ firstName, lastName });\n const random = Math.random().toString(36).substring(7);\n return {\n firstName,\n lastName,\n displayName: `${firstName} ${lastName}`,\n casualName: `${firstName}`,\n formalName: `${firstName}`,\n email: buildOptions.moreRandom ? `${random}${email}` : email,\n locale: generateLocale(),\n pictureUrl: faker.image.avatar(),\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAIA;AACA;AACA;AACO,SAASE,iBAAiBA,CAC/BC,YAA8B,GAAG,CAAC,CAAC,EACxB;EACX,MAAMC,SAAS,GAAGD,YAAY,CAACC,SAAS,IAAIC,YAAK,CAACC,MAAM,CAACF,SAAS,CAAC,CAAC;EACpE,MAAMG,QAAQ,GAAGJ,YAAY,CAACI,QAAQ,IAAIF,YAAK,CAACC,MAAM,CAACC,QAAQ,CAAC,CAAC;EACjE,MAAMC,KAAK,GAAGH,YAAK,CAACI,QAAQ,CAACD,KAAK,CAAC;IAAEJ,SAAS;IAAEG;EAAS,CAAC,CAAC;EAC3D,MAAMG,MAAM,GAAGC,IAAI,CAACD,MAAM,CAAC,CAAC,CAACE,QAAQ,CAAC,EAAE,CAAC,CAACC,SAAS,CAAC,CAAC,CAAC;EACtD,OAAO;IACLT,SAAS;IACTG,QAAQ;IACRO,WAAW,EAAE,GAAGV,SAAS,IAAIG,QAAQ,EAAE;IACvCQ,UAAU,EAAE,GAAGX,SAAS,EAAE;IAC1BY,UAAU,EAAE,GAAGZ,SAAS,EAAE;IAC1BI,KAAK,EAAEL,YAAY,CAACc,UAAU,GAAG,GAAGP,MAAM,GAAGF,KAAK,EAAE,GAAGA,KAAK;IAC5DU,MAAM,EAAE,IAAAC,0BAAc,EAAC,CAAC;IACxBC,UAAU,EAAEf,YAAK,CAACgB,KAAK,CAACC,MAAM,CAAC;EACjC,CAAC;AACH","ignoreList":[]}
@@ -4,14 +4,6 @@ export interface UserModel {
4
4
  firstName: string;
5
5
  /** User's last name */
6
6
  lastName: string;
7
- /** @deprecated */
8
- firstNameLastName: string;
9
- /** @deprecated */
10
- firstNameSpaceLastName: string;
11
- /** @deprecated */
12
- lastNameFirstName: string;
13
- /** @deprecated */
14
- lastNameSpaceFirstName: string;
15
7
  /** User's regular display name */
16
8
  displayName: string;
17
9
  /** User's casual display name */
@@ -20,34 +12,10 @@ export interface UserModel {
20
12
  formalName: string;
21
13
  /** User's email address */
22
14
  email: string;
23
- /** @deprecated User's username */
24
- username: string;
25
- /** User's RegId */
26
- regId: string;
27
15
  /** User's locale */
28
16
  locale: string;
29
17
  /** URL opf the user's avatar */
30
18
  pictureUrl: string;
31
- /** User's ID for QR codes */
32
- linkId: string;
33
- /** User's BlackBerry ID */
34
- bbId: string;
35
- /** User's BlackBerry encrypted key */
36
- bbEncrypted: string;
37
- /** User's signature keys */
38
- signKeyEncrypted: string;
39
- /** User's public key */
40
- signKeyPub: string;
41
- /** Enables auto-acceptance of contact requests */
42
- autoConnect: boolean;
43
- /** Is the user searchable publicly */
44
- searchable: boolean;
45
- /** Is URL scanning enabled for the user */
46
- enableUrlScan: boolean;
47
- /** Is message translation enabled for the user */
48
- enableMessageTranslation: boolean;
49
- /** Is the user's email visible publicly */
50
- emailVisibility: boolean;
51
19
  }
52
20
  /** User template build options */
53
21
  export interface UserBuildOptions {
@@ -55,8 +23,6 @@ export interface UserBuildOptions {
55
23
  firstName?: string;
56
24
  /** User's last name */
57
25
  lastName?: string;
58
- /** Admin status of the user in his organization */
59
- admin?: boolean;
60
26
  /** Membership status of the user in his organization */
61
27
  member?: boolean;
62
28
  /** Add randomness to avoid collisions when generating a large number of entities */
@@ -1 +1 @@
1
- {"version":3,"file":"user.types.js","names":[],"sources":["../../../src/factory/workers/user.types.ts"],"sourcesContent":["/** User model template */\nexport interface UserModel {\n /** User's first name */\n firstName: string;\n /** User's last name */\n lastName: string;\n /** @deprecated */\n firstNameLastName: string;\n /** @deprecated */\n firstNameSpaceLastName: string;\n /** @deprecated */\n lastNameFirstName: string;\n /** @deprecated */\n lastNameSpaceFirstName: string;\n /** User's regular display name */\n displayName: string;\n /** User's casual display name */\n casualName: string;\n /** User's formal display name */\n formalName: string;\n /** User's email address */\n email: string;\n /** @deprecated User's username */\n username: string;\n /** User's RegId */\n regId: string;\n /** User's locale */\n locale: string;\n /** URL opf the user's avatar */\n pictureUrl: string;\n /** User's ID for QR codes */\n linkId: string;\n /** User's BlackBerry ID */\n bbId: string;\n /** User's BlackBerry encrypted key */\n bbEncrypted: string;\n /** User's signature keys */\n signKeyEncrypted: string;\n /** User's public key */\n signKeyPub: string;\n /** Enables auto-acceptance of contact requests */\n autoConnect: boolean;\n /** Is the user searchable publicly */\n searchable: boolean;\n /** Is URL scanning enabled for the user */\n enableUrlScan: boolean;\n /** Is message translation enabled for the user */\n enableMessageTranslation: boolean;\n /** Is the user's email visible publicly */\n emailVisibility: boolean;\n}\n\n/** User template build options */\nexport interface UserBuildOptions {\n /** User's first name */\n firstName?: string;\n /** User's last name */\n lastName?: string;\n /** Admin status of the user in his organization */\n admin?: boolean;\n /** Membership status of the user in his organization */\n member?: boolean;\n /** Add randomness to avoid collisions when generating a large number of entities */\n moreRandom?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"user.types.js","names":[],"sources":["../../../src/factory/workers/user.types.ts"],"sourcesContent":["/** User model template */\nexport interface UserModel {\n /** User's first name */\n firstName: string;\n /** User's last name */\n lastName: string;\n /** User's regular display name */\n displayName: string;\n /** User's casual display name */\n casualName: string;\n /** User's formal display name */\n formalName: string;\n /** User's email address */\n email: string;\n /** User's locale */\n locale: string;\n /** URL opf the user's avatar */\n pictureUrl: string;\n}\n\n/** User template build options */\nexport interface UserBuildOptions {\n /** User's first name */\n firstName?: string;\n /** User's last name */\n lastName?: string;\n /** Membership status of the user in his organization */\n member?: boolean;\n /** Add randomness to avoid collisions when generating a large number of entities */\n moreRandom?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
@@ -2,8 +2,6 @@ export * from './generateAccessToken';
2
2
  export * from './generateImageBuffer';
3
3
  export * from './generateKeyPair';
4
4
  export * from './generateLocale';
5
- export * from './generateRegId';
6
5
  export * from './generateRsaKeyPair';
7
6
  export * from './generateUserCrypto';
8
- export * from './generateChatId';
9
7
  export * from './generateEcdsaKeyPair';
@@ -47,17 +47,6 @@ Object.keys(_generateLocale).forEach(function (key) {
47
47
  }
48
48
  });
49
49
  });
50
- var _generateRegId = require("./generateRegId");
51
- Object.keys(_generateRegId).forEach(function (key) {
52
- if (key === "default" || key === "__esModule") return;
53
- if (key in exports && exports[key] === _generateRegId[key]) return;
54
- Object.defineProperty(exports, key, {
55
- enumerable: true,
56
- get: function () {
57
- return _generateRegId[key];
58
- }
59
- });
60
- });
61
50
  var _generateRsaKeyPair = require("./generateRsaKeyPair");
62
51
  Object.keys(_generateRsaKeyPair).forEach(function (key) {
63
52
  if (key === "default" || key === "__esModule") return;
@@ -80,17 +69,6 @@ Object.keys(_generateUserCrypto).forEach(function (key) {
80
69
  }
81
70
  });
82
71
  });
83
- var _generateChatId = require("./generateChatId");
84
- Object.keys(_generateChatId).forEach(function (key) {
85
- if (key === "default" || key === "__esModule") return;
86
- if (key in exports && exports[key] === _generateChatId[key]) return;
87
- Object.defineProperty(exports, key, {
88
- enumerable: true,
89
- get: function () {
90
- return _generateChatId[key];
91
- }
92
- });
93
- });
94
72
  var _generateEcdsaKeyPair = require("./generateEcdsaKeyPair");
95
73
  Object.keys(_generateEcdsaKeyPair).forEach(function (key) {
96
74
  if (key === "default" || key === "__esModule") return;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_generateAccessToken","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_generateImageBuffer","_generateKeyPair","_generateLocale","_generateRegId","_generateRsaKeyPair","_generateUserCrypto","_generateChatId","_generateEcdsaKeyPair"],"sources":["../../src/generators/index.ts"],"sourcesContent":["export * from './generateAccessToken';\nexport * from './generateImageBuffer';\nexport * from './generateKeyPair';\nexport * from './generateLocale';\nexport * from './generateRegId';\nexport * from './generateRsaKeyPair';\nexport * from './generateUserCrypto';\nexport * from './generateChatId';\nexport * from './generateEcdsaKeyPair';\n"],"mappings":";;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,oBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,oBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,oBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,oBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,oBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,oB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AAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAY,qBAAA,CAAAZ,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAQ,qBAAA,CAAAZ,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_generateAccessToken","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_generateImageBuffer","_generateKeyPair","_generateLocale","_generateRsaKeyPair","_generateUserCrypto","_generateEcdsaKeyPair"],"sources":["../../src/generators/index.ts"],"sourcesContent":["export * from './generateAccessToken';\nexport * from './generateImageBuffer';\nexport * from './generateKeyPair';\nexport * from './generateLocale';\nexport * from './generateRsaKeyPair';\nexport * from './generateUserCrypto';\nexport * from './generateEcdsaKeyPair';\n"],"mappings":";;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,oBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,oBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,oBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,oBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,oBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,oBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAA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,IAAA,CAAAW,mBAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAS,mBAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAK,mBAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,qBAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,qBAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAU,qBAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAM,qBAAA,CAAAV,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -3,4 +3,3 @@ export * from './tlsRequest';
3
3
  export * from './generateCerts';
4
4
  export * from './jwtRequest';
5
5
  export * from './staticRequest';
6
- export * from './getAdminApiBearer';
@@ -58,15 +58,4 @@ Object.keys(_staticRequest).forEach(function (key) {
58
58
  }
59
59
  });
60
60
  });
61
- var _getAdminApiBearer = require("./getAdminApiBearer");
62
- Object.keys(_getAdminApiBearer).forEach(function (key) {
63
- if (key === "default" || key === "__esModule") return;
64
- if (key in exports && exports[key] === _getAdminApiBearer[key]) return;
65
- Object.defineProperty(exports, key, {
66
- enumerable: true,
67
- get: function () {
68
- return _getAdminApiBearer[key];
69
- }
70
- });
71
- });
72
61
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_getBearer","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_tlsRequest","_generateCerts","_jwtRequest","_staticRequest","_getAdminApiBearer"],"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './getBearer';\nexport * from './tlsRequest';\nexport * from './generateCerts';\nexport * from './jwtRequest';\nexport * from './staticRequest';\nexport * from './getAdminApiBearer';\n"],"mappings":";;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,UAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,UAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,UAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,WAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,WAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,WAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,WAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,cAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,cAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,cAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,cAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,WAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,WAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,WAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,WAAA,CAAAP,GAAA;IAAA;EAAA;AAAA;AACA,IAAAQ,cAAA,GAAAZ,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,cAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,cAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,cAAA,CAAAR,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,kBAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,kBAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAS,kBAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAK,kBAAA,CAAAT,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_getBearer","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_tlsRequest","_generateCerts","_jwtRequest","_staticRequest"],"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './getBearer';\nexport * from './tlsRequest';\nexport * from './generateCerts';\nexport * from './jwtRequest';\nexport * from './staticRequest';\n"],"mappings":";;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,UAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,UAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,UAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,WAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,WAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,WAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,WAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,cAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,cAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,cAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,cAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,WAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,WAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,WAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,WAAA,CAAAP,GAAA;IAAA;EAAA;AAAA;AACA,IAAAQ,cAAA,GAAAZ,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,cAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,cAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,cAAA,CAAAR,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backend-test-tools",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Node test tools",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -15,7 +15,7 @@
15
15
  "url": "git+https://github.com/prakashmahendran/backend-test-tools.git"
16
16
  },
17
17
  "author": "Ram",
18
- "license": "UNLICENSED",
18
+ "license": "MIT",
19
19
  "bugs": {
20
20
  "url": "https://github.com/prakashmahendran/backend-test-tools/issues"
21
21
  },
@@ -1,16 +1,15 @@
1
- import {randomUUID} from 'crypto';
1
+ import { randomUUID } from 'crypto';
2
2
  import {
3
3
  FactoryModel,
4
4
  FactoryBuildOptions,
5
5
  FactoryModelOverride,
6
6
  FactoryReturnType,
7
- ModelsMap,
7
+ ModelsMap
8
8
  } from './factory.types';
9
- import {connectionFactoryWorker, userFactoryWorker} from './workers';
9
+ import { userFactoryWorker } from './workers';
10
10
 
11
11
  const modelsMap: ModelsMap = {
12
- connection: connectionFactoryWorker,
13
- user: userFactoryWorker,
12
+ user: userFactoryWorker
14
13
  };
15
14
 
16
15
  export const factory = {
@@ -20,7 +19,7 @@ export const factory = {
20
19
  build: function <T extends FactoryModel>(
21
20
  name: T,
22
21
  attributes: FactoryModelOverride<T> = {},
23
- buildOptions: FactoryBuildOptions<T> = {},
22
+ buildOptions: FactoryBuildOptions<T> = {}
24
23
  ): FactoryReturnType<T> {
25
24
  if (!Object.keys(modelsMap).includes(name)) throw new Error(`Factory: unknown model "${name}"`);
26
25
  const worker = modelsMap[name];
@@ -28,7 +27,7 @@ export const factory = {
28
27
  return {
29
28
  id: randomUUID(),
30
29
  ...instance,
31
- ...attributes,
30
+ ...attributes
32
31
  };
33
32
  },
34
33
 
@@ -39,12 +38,12 @@ export const factory = {
39
38
  name: T,
40
39
  count: number,
41
40
  attributes: FactoryModelOverride<T> = {},
42
- buildOptions: FactoryBuildOptions<T> = {},
41
+ buildOptions: FactoryBuildOptions<T> = {}
43
42
  ): Array<FactoryReturnType<T>> {
44
43
  const instances: Array<FactoryReturnType<T>> = [];
45
44
  for (let i = 0; i < count; i++) {
46
45
  instances.push(this.build(name, attributes, buildOptions));
47
46
  }
48
47
  return instances;
49
- },
48
+ }
50
49
  };
@@ -1,18 +1,9 @@
1
1
  import {
2
- ConnectionModel,
3
- ConnectionBuildOptions,
4
2
  UserModel,
5
3
  UserBuildOptions,
6
4
  } from './workers';
7
5
 
8
6
  type FactoryTyping = {
9
- /** Mapping for the connection model */
10
- connection: {
11
- /** Options for the connection model */
12
- options: ConnectionBuildOptions;
13
- /** Return type for the connection model */
14
- return: ConnectionModel;
15
- };
16
7
  /** Mapping for the user model */
17
8
  user: {
18
9
  /** Options for the user model */
@@ -1,6 +1,2 @@
1
1
  export * from './user';
2
2
  export * from './user.types';
3
- export * from './connection';
4
- export * from './connection.types';
5
- export * from './organization';
6
- export * from './organization.types';
@@ -1,12 +1,7 @@
1
- import { randomUUID } from 'crypto';
2
1
  import { faker } from '@faker-js/faker';
3
2
  import { UserModel, UserBuildOptions } from './user.types';
4
3
  import {
5
- generateRegId,
6
4
  generateLocale,
7
- generateSignKeyPub,
8
- generateSignKeyEncrypted,
9
- generateBbEncrypted
10
5
  } from 'generators';
11
6
 
12
7
  /**
@@ -18,32 +13,15 @@ export function userFactoryWorker(
18
13
  const firstName = buildOptions.firstName ?? faker.person.firstName();
19
14
  const lastName = buildOptions.lastName ?? faker.person.lastName();
20
15
  const email = faker.internet.email({ firstName, lastName });
21
- const userName = faker.internet.userName({ firstName, lastName });
22
16
  const random = Math.random().toString(36).substring(7);
23
17
  return {
24
18
  firstName,
25
19
  lastName,
26
- firstNameLastName: `${firstName}${lastName}`,
27
- firstNameSpaceLastName: `${firstName} ${lastName}`,
28
- lastNameFirstName: `${lastName}${firstName}`,
29
- lastNameSpaceFirstName: `${lastName} ${firstName}`,
30
20
  displayName: `${firstName} ${lastName}`,
31
21
  casualName: `${firstName}`,
32
22
  formalName: `${firstName}`,
33
23
  email: buildOptions.moreRandom ? `${random}${email}` : email,
34
- username: buildOptions.moreRandom ? `${random}${userName}` : userName,
35
- regId: generateRegId(),
36
24
  locale: generateLocale(),
37
25
  pictureUrl: faker.image.avatar(),
38
- linkId: randomUUID(),
39
- bbId: randomUUID(),
40
- bbEncrypted: generateBbEncrypted(),
41
- signKeyEncrypted: generateSignKeyEncrypted(),
42
- signKeyPub: generateSignKeyPub(),
43
- autoConnect: true,
44
- searchable: true,
45
- enableUrlScan: true,
46
- enableMessageTranslation: true,
47
- emailVisibility: true
48
26
  };
49
27
  }
@@ -4,14 +4,6 @@ export interface UserModel {
4
4
  firstName: string;
5
5
  /** User's last name */
6
6
  lastName: string;
7
- /** @deprecated */
8
- firstNameLastName: string;
9
- /** @deprecated */
10
- firstNameSpaceLastName: string;
11
- /** @deprecated */
12
- lastNameFirstName: string;
13
- /** @deprecated */
14
- lastNameSpaceFirstName: string;
15
7
  /** User's regular display name */
16
8
  displayName: string;
17
9
  /** User's casual display name */
@@ -20,34 +12,10 @@ export interface UserModel {
20
12
  formalName: string;
21
13
  /** User's email address */
22
14
  email: string;
23
- /** @deprecated User's username */
24
- username: string;
25
- /** User's RegId */
26
- regId: string;
27
15
  /** User's locale */
28
16
  locale: string;
29
17
  /** URL opf the user's avatar */
30
18
  pictureUrl: string;
31
- /** User's ID for QR codes */
32
- linkId: string;
33
- /** User's BlackBerry ID */
34
- bbId: string;
35
- /** User's BlackBerry encrypted key */
36
- bbEncrypted: string;
37
- /** User's signature keys */
38
- signKeyEncrypted: string;
39
- /** User's public key */
40
- signKeyPub: string;
41
- /** Enables auto-acceptance of contact requests */
42
- autoConnect: boolean;
43
- /** Is the user searchable publicly */
44
- searchable: boolean;
45
- /** Is URL scanning enabled for the user */
46
- enableUrlScan: boolean;
47
- /** Is message translation enabled for the user */
48
- enableMessageTranslation: boolean;
49
- /** Is the user's email visible publicly */
50
- emailVisibility: boolean;
51
19
  }
52
20
 
53
21
  /** User template build options */
@@ -56,8 +24,6 @@ export interface UserBuildOptions {
56
24
  firstName?: string;
57
25
  /** User's last name */
58
26
  lastName?: string;
59
- /** Admin status of the user in his organization */
60
- admin?: boolean;
61
27
  /** Membership status of the user in his organization */
62
28
  member?: boolean;
63
29
  /** Add randomness to avoid collisions when generating a large number of entities */
@@ -2,8 +2,6 @@ export * from './generateAccessToken';
2
2
  export * from './generateImageBuffer';
3
3
  export * from './generateKeyPair';
4
4
  export * from './generateLocale';
5
- export * from './generateRegId';
6
5
  export * from './generateRsaKeyPair';
7
6
  export * from './generateUserCrypto';
8
- export * from './generateChatId';
9
7
  export * from './generateEcdsaKeyPair';
@@ -3,4 +3,3 @@ export * from './tlsRequest';
3
3
  export * from './generateCerts';
4
4
  export * from './jwtRequest';
5
5
  export * from './staticRequest';
6
- export * from './getAdminApiBearer';
@@ -1,3 +0,0 @@
1
- import { ConnectionBuildOptions, ConnectionModel } from './connection.types';
2
- /** Create a random connection */
3
- export declare function connectionFactoryWorker(buildOptions?: ConnectionBuildOptions): ConnectionModel;
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.connectionFactoryWorker = connectionFactoryWorker;
7
- var _crypto = require("crypto");
8
- var _faker = require("@faker-js/faker");
9
- /** Create a random connection */
10
- function connectionFactoryWorker(buildOptions = {}) {
11
- const accepted = buildOptions.accepted ?? true;
12
- const blocked = buildOptions.blocked ?? false;
13
- return {
14
- ownerId: (0, _crypto.randomUUID)(),
15
- otherUserId: (0, _crypto.randomUUID)(),
16
- accepted,
17
- acceptedAt: accepted ? _faker.faker.date.recent() : undefined,
18
- blocked,
19
- blockedAt: blocked ? _faker.faker.date.recent() : undefined,
20
- initiator: true,
21
- message: _faker.faker.lorem.sentence(),
22
- note: _faker.faker.lorem.sentence()
23
- };
24
- }
25
- //# sourceMappingURL=connection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connection.js","names":["_crypto","require","_faker","connectionFactoryWorker","buildOptions","accepted","blocked","ownerId","randomUUID","otherUserId","acceptedAt","faker","date","recent","undefined","blockedAt","initiator","message","lorem","sentence","note"],"sources":["../../../src/factory/workers/connection.ts"],"sourcesContent":["import {randomUUID} from 'crypto';\nimport { faker } from '@faker-js/faker';\nimport {ConnectionBuildOptions, ConnectionModel} from './connection.types';\n\n/** Create a random connection */\nexport function connectionFactoryWorker(\n buildOptions: ConnectionBuildOptions = {},\n): ConnectionModel {\n const accepted = buildOptions.accepted ?? true;\n const blocked = buildOptions.blocked ?? false;\n return {\n ownerId: randomUUID(),\n otherUserId: randomUUID(),\n accepted,\n acceptedAt: accepted ? faker.date.recent() : undefined,\n blocked,\n blockedAt: blocked ? faker.date.recent() : undefined,\n initiator: true,\n message: faker.lorem.sentence(),\n note: faker.lorem.sentence(),\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGA;AACO,SAASE,uBAAuBA,CACrCC,YAAoC,GAAG,CAAC,CAAC,EACxB;EACjB,MAAMC,QAAQ,GAAGD,YAAY,CAACC,QAAQ,IAAI,IAAI;EAC9C,MAAMC,OAAO,GAAGF,YAAY,CAACE,OAAO,IAAI,KAAK;EAC7C,OAAO;IACLC,OAAO,EAAE,IAAAC,kBAAU,EAAC,CAAC;IACrBC,WAAW,EAAE,IAAAD,kBAAU,EAAC,CAAC;IACzBH,QAAQ;IACRK,UAAU,EAAEL,QAAQ,GAAGM,YAAK,CAACC,IAAI,CAACC,MAAM,CAAC,CAAC,GAAGC,SAAS;IACtDR,OAAO;IACPS,SAAS,EAAET,OAAO,GAAGK,YAAK,CAACC,IAAI,CAACC,MAAM,CAAC,CAAC,GAAGC,SAAS;IACpDE,SAAS,EAAE,IAAI;IACfC,OAAO,EAAEN,YAAK,CAACO,KAAK,CAACC,QAAQ,CAAC,CAAC;IAC/BC,IAAI,EAAET,YAAK,CAACO,KAAK,CAACC,QAAQ,CAAC;EAC7B,CAAC;AACH","ignoreList":[]}
@@ -1,28 +0,0 @@
1
- /** Connection base model */
2
- export interface ConnectionModel {
3
- /** Owner of the connection */
4
- ownerId: string;
5
- /** USer with which the owner is connected */
6
- otherUserId: string;
7
- /** Wether the connection is accepted or not */
8
- accepted: boolean;
9
- /** Date at which the connection was accepted */
10
- acceptedAt?: Date;
11
- /** Wether the owner did block the other user */
12
- blocked: boolean;
13
- /** Date at which the connection was blocked */
14
- blockedAt?: Date;
15
- /** Did the owner initiate the connection */
16
- initiator: boolean;
17
- /** Message sent to the other user with the connection */
18
- message: string;
19
- /** Private note the user has on the connection */
20
- note: string;
21
- }
22
- /** Build options for connections */
23
- export interface ConnectionBuildOptions {
24
- /** Wether the connection is accepted or not */
25
- accepted?: boolean;
26
- /** Wether the owner did block the other user */
27
- blocked?: boolean;
28
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=connection.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connection.types.js","names":[],"sources":["../../../src/factory/workers/connection.types.ts"],"sourcesContent":["/** Connection base model */\nexport interface ConnectionModel {\n /** Owner of the connection */\n ownerId: string;\n /** USer with which the owner is connected */\n otherUserId: string;\n /** Wether the connection is accepted or not */\n accepted: boolean;\n /** Date at which the connection was accepted */\n acceptedAt?: Date;\n /** Wether the owner did block the other user */\n blocked: boolean;\n /** Date at which the connection was blocked */\n blockedAt?: Date;\n /** Did the owner initiate the connection */\n initiator: boolean;\n /** Message sent to the other user with the connection */\n message: string;\n /** Private note the user has on the connection */\n note: string;\n}\n\n/** Build options for connections */\nexport interface ConnectionBuildOptions {\n /** Wether the connection is accepted or not */\n accepted?: boolean;\n /** Wether the owner did block the other user */\n blocked?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- import { OrganizationModel } from './organization.types';
2
- /** Create a random organization */
3
- export declare function organizationFactoryWorker(): OrganizationModel;
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.organizationFactoryWorker = organizationFactoryWorker;
7
- var _faker = require("@faker-js/faker");
8
- /** Create a random organization */
9
- function organizationFactoryWorker() {
10
- return {
11
- name: _faker.faker.company.name(),
12
- territory: _faker.faker.address.countryCode(),
13
- description: _faker.faker.company.catchPhrase(),
14
- contactInfo: _faker.faker.address.streetAddress(),
15
- productsInfo: _faker.faker.company.catchPhrase(),
16
- avatarUrl: _faker.faker.internet.url(),
17
- coverUrl: _faker.faker.internet.url(),
18
- membersVisible: _faker.faker.datatype.boolean(),
19
- searchable: _faker.faker.datatype.boolean(),
20
- activities: [{
21
- id: _faker.faker.string.uuid(),
22
- translationKey: _faker.faker.lorem.word()
23
- }],
24
- members: [{
25
- id: _faker.faker.string.uuid(),
26
- organizationId: _faker.faker.string.uuid(),
27
- userId: _faker.faker.string.uuid(),
28
- requested: _faker.faker.datatype.boolean(),
29
- requestedAt: _faker.faker.date.recent(),
30
- invited: _faker.faker.datatype.boolean(),
31
- invitedAt: _faker.faker.date.recent(),
32
- admin: _faker.faker.datatype.boolean()
33
- }]
34
- };
35
- }
36
- //# sourceMappingURL=organization.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"organization.js","names":["_faker","require","organizationFactoryWorker","name","faker","company","territory","address","countryCode","description","catchPhrase","contactInfo","streetAddress","productsInfo","avatarUrl","internet","url","coverUrl","membersVisible","datatype","boolean","searchable","activities","id","string","uuid","translationKey","lorem","word","members","organizationId","userId","requested","requestedAt","date","recent","invited","invitedAt","admin"],"sources":["../../../src/factory/workers/organization.ts"],"sourcesContent":["import { faker } from '@faker-js/faker';\nimport {OrganizationModel} from './organization.types';\n\n/** Create a random organization */\nexport function organizationFactoryWorker(): OrganizationModel {\n return {\n name: faker.company.name(),\n territory: faker.address.countryCode(),\n description: faker.company.catchPhrase(),\n contactInfo: faker.address.streetAddress(),\n productsInfo: faker.company.catchPhrase(),\n avatarUrl: faker.internet.url(),\n coverUrl: faker.internet.url(),\n membersVisible: faker.datatype.boolean(),\n searchable: faker.datatype.boolean(),\n activities: [\n {\n id: faker.string.uuid(),\n translationKey: faker.lorem.word(),\n },\n ],\n members: [\n {\n id: faker.string.uuid(),\n organizationId: faker.string.uuid(),\n userId: faker.string.uuid(),\n requested: faker.datatype.boolean(),\n requestedAt: faker.date.recent(),\n invited: faker.datatype.boolean(),\n invitedAt: faker.date.recent(),\n admin: faker.datatype.boolean(),\n },\n ],\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA;AACO,SAASC,yBAAyBA,CAAA,EAAsB;EAC7D,OAAO;IACLC,IAAI,EAAEC,YAAK,CAACC,OAAO,CAACF,IAAI,CAAC,CAAC;IAC1BG,SAAS,EAAEF,YAAK,CAACG,OAAO,CAACC,WAAW,CAAC,CAAC;IACtCC,WAAW,EAAEL,YAAK,CAACC,OAAO,CAACK,WAAW,CAAC,CAAC;IACxCC,WAAW,EAAEP,YAAK,CAACG,OAAO,CAACK,aAAa,CAAC,CAAC;IAC1CC,YAAY,EAAET,YAAK,CAACC,OAAO,CAACK,WAAW,CAAC,CAAC;IACzCI,SAAS,EAAEV,YAAK,CAACW,QAAQ,CAACC,GAAG,CAAC,CAAC;IAC/BC,QAAQ,EAAEb,YAAK,CAACW,QAAQ,CAACC,GAAG,CAAC,CAAC;IAC9BE,cAAc,EAAEd,YAAK,CAACe,QAAQ,CAACC,OAAO,CAAC,CAAC;IACxCC,UAAU,EAAEjB,YAAK,CAACe,QAAQ,CAACC,OAAO,CAAC,CAAC;IACpCE,UAAU,EAAE,CACV;MACEC,EAAE,EAAEnB,YAAK,CAACoB,MAAM,CAACC,IAAI,CAAC,CAAC;MACvBC,cAAc,EAAEtB,YAAK,CAACuB,KAAK,CAACC,IAAI,CAAC;IACnC,CAAC,CACF;IACDC,OAAO,EAAE,CACP;MACEN,EAAE,EAAEnB,YAAK,CAACoB,MAAM,CAACC,IAAI,CAAC,CAAC;MACvBK,cAAc,EAAE1B,YAAK,CAACoB,MAAM,CAACC,IAAI,CAAC,CAAC;MACnCM,MAAM,EAAE3B,YAAK,CAACoB,MAAM,CAACC,IAAI,CAAC,CAAC;MAC3BO,SAAS,EAAE5B,YAAK,CAACe,QAAQ,CAACC,OAAO,CAAC,CAAC;MACnCa,WAAW,EAAE7B,YAAK,CAAC8B,IAAI,CAACC,MAAM,CAAC,CAAC;MAChCC,OAAO,EAAEhC,YAAK,CAACe,QAAQ,CAACC,OAAO,CAAC,CAAC;MACjCiB,SAAS,EAAEjC,YAAK,CAAC8B,IAAI,CAACC,MAAM,CAAC,CAAC;MAC9BG,KAAK,EAAElC,YAAK,CAACe,QAAQ,CAACC,OAAO,CAAC;IAChC,CAAC;EAEL,CAAC;AACH","ignoreList":[]}
@@ -1,51 +0,0 @@
1
- /** Organization base model */
2
- export interface OrganizationModel {
3
- /** Name of the organization */
4
- name: string;
5
- /** ISO Code of the territory in which the organization is located */
6
- territory: string;
7
- /** Description of the organization */
8
- description: string;
9
- /** Contact information of the organization */
10
- contactInfo: string;
11
- /** Product information fo the organization */
12
- productsInfo: string;
13
- /** URL of the organization avatar */
14
- avatarUrl: string;
15
- /** URL of the organization cover picture */
16
- coverUrl: string;
17
- /** Indicates if organization members are visible publicly */
18
- membersVisible: boolean;
19
- /** Indicates if organization is searchable publicly */
20
- searchable: boolean;
21
- /** List of activities that the organization has */
22
- activities: Array<OrganizationActivityModel>;
23
- /** List of organization members */
24
- members: Array<OrganizationMemberModel>;
25
- }
26
- /** Organization activity template */
27
- export interface OrganizationActivityModel {
28
- /** ID of the activity */
29
- id: string;
30
- /** Translation key to display the activity name */
31
- translationKey: string;
32
- }
33
- /** Organization member */
34
- export interface OrganizationMemberModel {
35
- /** ID of the membership */
36
- id: string;
37
- /** ID of the organization on which the user has membership */
38
- organizationId: string;
39
- /** ID of the user */
40
- userId: string;
41
- /** Did the user accept/request to join the organization */
42
- requested: boolean;
43
- /** Time at which the user accepted/requested to join the organization */
44
- requestedAt: Date;
45
- /** Did the user get accepted/invited by an organization admin */
46
- invited: boolean;
47
- /** Time at which the user got accepted/invited by an organization admin */
48
- invitedAt: Date;
49
- /** Is the user an admin of the organization */
50
- admin: boolean;
51
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=organization.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"organization.types.js","names":[],"sources":["../../../src/factory/workers/organization.types.ts"],"sourcesContent":["/** Organization base model */\nexport interface OrganizationModel {\n /** Name of the organization */\n name: string;\n /** ISO Code of the territory in which the organization is located */\n territory: string;\n /** Description of the organization */\n description: string;\n /** Contact information of the organization */\n contactInfo: string;\n /** Product information fo the organization */\n productsInfo: string;\n /** URL of the organization avatar */\n avatarUrl: string;\n /** URL of the organization cover picture */\n coverUrl: string;\n /** Indicates if organization members are visible publicly */\n membersVisible: boolean;\n /** Indicates if organization is searchable publicly */\n searchable: boolean;\n /** List of activities that the organization has */\n activities: Array<OrganizationActivityModel>;\n /** List of organization members */\n members: Array<OrganizationMemberModel>;\n}\n\n/** Organization activity template */\nexport interface OrganizationActivityModel {\n /** ID of the activity */\n id: string;\n /** Translation key to display the activity name */\n translationKey: string;\n}\n\n/** Organization member */\nexport interface OrganizationMemberModel {\n /** ID of the membership */\n id: string;\n /** ID of the organization on which the user has membership */\n organizationId: string;\n /** ID of the user */\n userId: string;\n /** Did the user accept/request to join the organization */\n requested: boolean;\n /** Time at which the user accepted/requested to join the organization */\n requestedAt: Date;\n /** Did the user get accepted/invited by an organization admin */\n invited: boolean;\n /** Time at which the user got accepted/invited by an organization admin */\n invitedAt: Date;\n /** Is the user an admin of the organization */\n admin: boolean;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- /** Generate a BlackBerry Spark chatId */
2
- export declare function generateChatId(): string;
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.generateChatId = generateChatId;
8
- var _crypto = _interopRequireDefault(require("crypto"));
9
- /** Generate a BlackBerry Spark chatId */
10
- function generateChatId() {
11
- return `${_crypto.default.randomBytes(20).toString('hex')}.1`;
12
- }
13
- //# sourceMappingURL=generateChatId.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generateChatId.js","names":["_crypto","_interopRequireDefault","require","generateChatId","crypto","randomBytes","toString"],"sources":["../../src/generators/generateChatId.ts"],"sourcesContent":["import crypto from 'crypto';\n\n/** Generate a BlackBerry Spark chatId */\nexport function generateChatId(): string {\n return `${crypto.randomBytes(20).toString('hex')}.1`;\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA;AACO,SAASC,cAAcA,CAAA,EAAW;EACvC,OAAO,GAAGC,eAAM,CAACC,WAAW,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,KAAK,CAAC,IAAI;AACtD","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- /**
2
- * Generates a regID like BBM Spark would
3
- */
4
- export declare function generateRegId(): string;
@@ -1,14 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.generateRegId = generateRegId;
7
- /**
8
- * Generates a regID like BBM Spark would
9
- */
10
- function generateRegId() {
11
- const length = 18;
12
- return Math.floor(Math.random() * Math.pow(10, length)).toString().padStart(length, '0');
13
- }
14
- //# sourceMappingURL=generateRegId.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generateRegId.js","names":["generateRegId","length","Math","floor","random","pow","toString","padStart"],"sources":["../../src/generators/generateRegId.ts"],"sourcesContent":["/**\n * Generates a regID like BBM Spark would\n */\nexport function generateRegId(): string {\n const length = 18;\n return Math.floor(Math.random() * Math.pow(10, length))\n .toString()\n .padStart(length, '0');\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACO,SAASA,aAAaA,CAAA,EAAW;EACtC,MAAMC,MAAM,GAAG,EAAE;EACjB,OAAOC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,MAAM,CAAC,CAAC,GAAGF,IAAI,CAACG,GAAG,CAAC,EAAE,EAAEJ,MAAM,CAAC,CAAC,CACpDK,QAAQ,CAAC,CAAC,CACVC,QAAQ,CAACN,MAAM,EAAE,GAAG,CAAC;AAC1B","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- /** Generate Admin api Bearer Token authorization header */
2
- export declare function getAdminApiBearer(email: string, payload?: {}): string;
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getAdminApiBearer = getAdminApiBearer;
7
- var _faker = require("@faker-js/faker");
8
- var _generators = require("../generators");
9
- /** Generate Admin api Bearer Token authorization header */
10
- function getAdminApiBearer(email, payload = {}) {
11
- return `Bearer ${(0, _generators.generateAccessToken)(email, {
12
- audience: process.env.ADMIN_API_ACCESS_TOKEN_AUDIENCE,
13
- issuer: process.env.ADMIN_API_PUBLIC_URL
14
- }, {
15
- per: [_faker.faker.lorem.word(), _faker.faker.lorem.word()],
16
- ...payload
17
- })}`;
18
- }
19
- //# sourceMappingURL=getAdminApiBearer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getAdminApiBearer.js","names":["_faker","require","_generators","getAdminApiBearer","email","payload","generateAccessToken","audience","process","env","ADMIN_API_ACCESS_TOKEN_AUDIENCE","issuer","ADMIN_API_PUBLIC_URL","per","faker","lorem","word"],"sources":["../../src/utils/getAdminApiBearer.ts"],"sourcesContent":["import { faker } from '@faker-js/faker';\nimport {generateAccessToken} from 'generators';\n\n/** Generate Admin api Bearer Token authorization header */\nexport function getAdminApiBearer(email: string, payload = {}): string {\n return `Bearer ${generateAccessToken(\n email,\n {\n audience: process.env.ADMIN_API_ACCESS_TOKEN_AUDIENCE,\n issuer: process.env.ADMIN_API_PUBLIC_URL,\n },\n {\n per: [faker.lorem.word(), faker.lorem.word()],\n ...payload,\n },\n )}`;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA;AACO,SAASE,iBAAiBA,CAACC,KAAa,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAU;EACrE,OAAO,UAAU,IAAAC,+BAAmB,EAClCF,KAAK,EACL;IACEG,QAAQ,EAAEC,OAAO,CAACC,GAAG,CAACC,+BAA+B;IACrDC,MAAM,EAAEH,OAAO,CAACC,GAAG,CAACG;EACtB,CAAC,EACD;IACEC,GAAG,EAAE,CAACC,YAAK,CAACC,KAAK,CAACC,IAAI,CAAC,CAAC,EAAEF,YAAK,CAACC,KAAK,CAACC,IAAI,CAAC,CAAC,CAAC;IAC7C,GAAGX;EACL,CACF,CAAC,EAAE;AACL","ignoreList":[]}
@@ -1,22 +0,0 @@
1
- import {randomUUID} from 'crypto';
2
- import { faker } from '@faker-js/faker';
3
- import {ConnectionBuildOptions, ConnectionModel} from './connection.types';
4
-
5
- /** Create a random connection */
6
- export function connectionFactoryWorker(
7
- buildOptions: ConnectionBuildOptions = {},
8
- ): ConnectionModel {
9
- const accepted = buildOptions.accepted ?? true;
10
- const blocked = buildOptions.blocked ?? false;
11
- return {
12
- ownerId: randomUUID(),
13
- otherUserId: randomUUID(),
14
- accepted,
15
- acceptedAt: accepted ? faker.date.recent() : undefined,
16
- blocked,
17
- blockedAt: blocked ? faker.date.recent() : undefined,
18
- initiator: true,
19
- message: faker.lorem.sentence(),
20
- note: faker.lorem.sentence(),
21
- };
22
- }
@@ -1,29 +0,0 @@
1
- /** Connection base model */
2
- export interface ConnectionModel {
3
- /** Owner of the connection */
4
- ownerId: string;
5
- /** USer with which the owner is connected */
6
- otherUserId: string;
7
- /** Wether the connection is accepted or not */
8
- accepted: boolean;
9
- /** Date at which the connection was accepted */
10
- acceptedAt?: Date;
11
- /** Wether the owner did block the other user */
12
- blocked: boolean;
13
- /** Date at which the connection was blocked */
14
- blockedAt?: Date;
15
- /** Did the owner initiate the connection */
16
- initiator: boolean;
17
- /** Message sent to the other user with the connection */
18
- message: string;
19
- /** Private note the user has on the connection */
20
- note: string;
21
- }
22
-
23
- /** Build options for connections */
24
- export interface ConnectionBuildOptions {
25
- /** Wether the connection is accepted or not */
26
- accepted?: boolean;
27
- /** Wether the owner did block the other user */
28
- blocked?: boolean;
29
- }
@@ -1,35 +0,0 @@
1
- import { faker } from '@faker-js/faker';
2
- import {OrganizationModel} from './organization.types';
3
-
4
- /** Create a random organization */
5
- export function organizationFactoryWorker(): OrganizationModel {
6
- return {
7
- name: faker.company.name(),
8
- territory: faker.address.countryCode(),
9
- description: faker.company.catchPhrase(),
10
- contactInfo: faker.address.streetAddress(),
11
- productsInfo: faker.company.catchPhrase(),
12
- avatarUrl: faker.internet.url(),
13
- coverUrl: faker.internet.url(),
14
- membersVisible: faker.datatype.boolean(),
15
- searchable: faker.datatype.boolean(),
16
- activities: [
17
- {
18
- id: faker.string.uuid(),
19
- translationKey: faker.lorem.word(),
20
- },
21
- ],
22
- members: [
23
- {
24
- id: faker.string.uuid(),
25
- organizationId: faker.string.uuid(),
26
- userId: faker.string.uuid(),
27
- requested: faker.datatype.boolean(),
28
- requestedAt: faker.date.recent(),
29
- invited: faker.datatype.boolean(),
30
- invitedAt: faker.date.recent(),
31
- admin: faker.datatype.boolean(),
32
- },
33
- ],
34
- };
35
- }
@@ -1,53 +0,0 @@
1
- /** Organization base model */
2
- export interface OrganizationModel {
3
- /** Name of the organization */
4
- name: string;
5
- /** ISO Code of the territory in which the organization is located */
6
- territory: string;
7
- /** Description of the organization */
8
- description: string;
9
- /** Contact information of the organization */
10
- contactInfo: string;
11
- /** Product information fo the organization */
12
- productsInfo: string;
13
- /** URL of the organization avatar */
14
- avatarUrl: string;
15
- /** URL of the organization cover picture */
16
- coverUrl: string;
17
- /** Indicates if organization members are visible publicly */
18
- membersVisible: boolean;
19
- /** Indicates if organization is searchable publicly */
20
- searchable: boolean;
21
- /** List of activities that the organization has */
22
- activities: Array<OrganizationActivityModel>;
23
- /** List of organization members */
24
- members: Array<OrganizationMemberModel>;
25
- }
26
-
27
- /** Organization activity template */
28
- export interface OrganizationActivityModel {
29
- /** ID of the activity */
30
- id: string;
31
- /** Translation key to display the activity name */
32
- translationKey: string;
33
- }
34
-
35
- /** Organization member */
36
- export interface OrganizationMemberModel {
37
- /** ID of the membership */
38
- id: string;
39
- /** ID of the organization on which the user has membership */
40
- organizationId: string;
41
- /** ID of the user */
42
- userId: string;
43
- /** Did the user accept/request to join the organization */
44
- requested: boolean;
45
- /** Time at which the user accepted/requested to join the organization */
46
- requestedAt: Date;
47
- /** Did the user get accepted/invited by an organization admin */
48
- invited: boolean;
49
- /** Time at which the user got accepted/invited by an organization admin */
50
- invitedAt: Date;
51
- /** Is the user an admin of the organization */
52
- admin: boolean;
53
- }
@@ -1,6 +0,0 @@
1
- import crypto from 'crypto';
2
-
3
- /** Generate a BlackBerry Spark chatId */
4
- export function generateChatId(): string {
5
- return `${crypto.randomBytes(20).toString('hex')}.1`;
6
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Generates a regID like BBM Spark would
3
- */
4
- export function generateRegId(): string {
5
- const length = 18;
6
- return Math.floor(Math.random() * Math.pow(10, length))
7
- .toString()
8
- .padStart(length, '0');
9
- }
@@ -1,17 +0,0 @@
1
- import { faker } from '@faker-js/faker';
2
- import {generateAccessToken} from 'generators';
3
-
4
- /** Generate Admin api Bearer Token authorization header */
5
- export function getAdminApiBearer(email: string, payload = {}): string {
6
- return `Bearer ${generateAccessToken(
7
- email,
8
- {
9
- audience: process.env.ADMIN_API_ACCESS_TOKEN_AUDIENCE,
10
- issuer: process.env.ADMIN_API_PUBLIC_URL,
11
- },
12
- {
13
- per: [faker.lorem.word(), faker.lorem.word()],
14
- ...payload,
15
- },
16
- )}`;
17
- }