@reyaxyz/common 0.44.0 → 0.45.0
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/dist/decorators/index.js +18 -0
- package/dist/decorators/index.js.map +1 -0
- package/dist/decorators/logger.js +20 -0
- package/dist/decorators/logger.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/rest/helpers/constants.js +3 -0
- package/dist/rest/helpers/constants.js.map +1 -1
- package/dist/types/decorators/index.d.ts +2 -0
- package/dist/types/decorators/index.d.ts.map +1 -0
- package/dist/types/decorators/logger.d.ts +5 -0
- package/dist/types/decorators/logger.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/rest/helpers/constants.d.ts +1 -0
- package/dist/types/rest/helpers/constants.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/decorators/index.ts +1 -0
- package/src/decorators/logger.ts +20 -0
- package/src/index.ts +1 -0
- package/src/rest/helpers/constants.ts +4 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./logger"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB","sourcesContent":["export * from './logger';\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Logger = void 0;
|
|
4
|
+
function Logger(logPrefix) {
|
|
5
|
+
return function (target, propertyKey, descriptor) {
|
|
6
|
+
var originalMethod = descriptor.value;
|
|
7
|
+
descriptor.value = function () {
|
|
8
|
+
var args = [];
|
|
9
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10
|
+
args[_i] = arguments[_i];
|
|
11
|
+
}
|
|
12
|
+
if (this.loggingEnabled) {
|
|
13
|
+
console.log("[".concat(logPrefix, "]: called with args: "), args);
|
|
14
|
+
}
|
|
15
|
+
return originalMethod.apply(this, args);
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
exports.Logger = Logger;
|
|
20
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"/","sources":["decorators/logger.ts"],"names":[],"mappings":";;;AAIA,SAAgB,MAAM,CAAC,SAAiB;IACtC,OAAO,UACL,MAAc,EACd,WAA4B,EAC5B,UAA8B;QAE9B,IAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,CAAC,KAAK,GAAG;YAAU,cAAgB;iBAAhB,UAAgB,EAAhB,qBAAgB,EAAhB,IAAgB;gBAAhB,yBAAgB;;YAC3C,IAAK,IAAiB,CAAC,cAAc,EAAE,CAAC;gBACtC,OAAO,CAAC,GAAG,CAAC,WAAI,SAAS,0BAAuB,EAAE,IAAI,CAAC,CAAC;YAC1D,CAAC;YACD,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1C,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAfD,wBAeC","sourcesContent":["export interface Loggable {\n loggingEnabled: boolean;\n}\n\nexport function Logger(logPrefix: string) {\n return function (\n target: object,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ) {\n const originalMethod = descriptor.value;\n\n descriptor.value = function (...args: never[]) {\n if ((this as Loggable).loggingEnabled) {\n console.log(`[${logPrefix}]: called with args: `, args);\n }\n return originalMethod.apply(this, args);\n };\n };\n}\n"]}
|
package/dist/index.js
CHANGED
|
@@ -20,4 +20,5 @@ __exportStar(require("./utils"), exports);
|
|
|
20
20
|
__exportStar(require("./services"), exports);
|
|
21
21
|
__exportStar(require("./modules"), exports);
|
|
22
22
|
__exportStar(require("./rest"), exports);
|
|
23
|
+
__exportStar(require("./decorators"), exports);
|
|
23
24
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,6CAA2B;AAC3B,0CAAwB;AACxB,6CAA2B;AAC3B,4CAA0B;AAC1B,yCAAuB","sourcesContent":["export * from './types';\nexport * from './commands';\nexport * from './utils';\nexport * from './services';\nexport * from './modules';\nexport * from './rest';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,6CAA2B;AAC3B,0CAAwB;AACxB,6CAA2B;AAC3B,4CAA0B;AAC1B,yCAAuB;AACvB,+CAA6B","sourcesContent":["export * from './types';\nexport * from './commands';\nexport * from './utils';\nexport * from './services';\nexport * from './modules';\nexport * from './rest';\nexport * from './decorators';\n"]}
|
|
@@ -14,6 +14,7 @@ exports.API_CLIENT_CONFIGS = {
|
|
|
14
14
|
clientId: 'LTBKa25VWkpjaEtSMzRGVEZaYmU6MTpjaQ',
|
|
15
15
|
redirectURI: 'https://m8mjgmqmte.eu-central-1.awsapprunner.com/api/twitter/share',
|
|
16
16
|
},
|
|
17
|
+
logging: true,
|
|
17
18
|
},
|
|
18
19
|
production: {
|
|
19
20
|
chain: types_1.ReyaChainId.reyaNetwork,
|
|
@@ -24,6 +25,7 @@ exports.API_CLIENT_CONFIGS = {
|
|
|
24
25
|
clientId: 'LTBKa25VWkpjaEtSMzRGVEZaYmU6MTpjaQ',
|
|
25
26
|
redirectURI: 'https://mtducb79rf.eu-central-1.awsapprunner.com/api/twitter/share',
|
|
26
27
|
},
|
|
28
|
+
logging: false,
|
|
27
29
|
},
|
|
28
30
|
test: {
|
|
29
31
|
chain: types_1.ReyaChainId.reyaCronos,
|
|
@@ -34,6 +36,7 @@ exports.API_CLIENT_CONFIGS = {
|
|
|
34
36
|
clientId: 'LTBKa25VWkpjaEtSMzRGVEZaYmU6MTpjaQ',
|
|
35
37
|
redirectURI: 'https://m8mjgmqmte.eu-central-1.awsapprunner.com/api/twitter/share',
|
|
36
38
|
},
|
|
39
|
+
logging: true,
|
|
37
40
|
},
|
|
38
41
|
};
|
|
39
42
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"/","sources":["rest/helpers/constants.ts"],"names":[],"mappings":";;;AAAA,qCAA0C;AAC1C,qCAA0C;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"/","sources":["rest/helpers/constants.ts"],"names":[],"mappings":";;;AAAA,qCAA0C;AAC1C,qCAA0C;AAe7B,QAAA,kBAAkB,GAA8C;IAC3E,KAAK,EAAE;QACL,KAAK,EAAE,mBAAW,CAAC,UAAU;QAC7B,WAAW,EAAE,uBAAuB;QACpC,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,mBAAW;QACpB,2DAA2D;QAC3D,OAAO,EAAE;YACP,QAAQ,EAAE,oCAAoC;YAC9C,WAAW,EACT,oEAAoE;SACvE;QACD,OAAO,EAAE,IAAI;KACd;IACD,UAAU,EAAE;QACV,KAAK,EAAE,mBAAW,CAAC,WAAW;QAC9B,WAAW,EAAE,sBAAsB;QACnC,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,mBAAW;QACpB,OAAO,EAAE;YACP,QAAQ,EAAE,oCAAoC;YAC9C,WAAW,EACT,oEAAoE;SACvE;QACD,OAAO,EAAE,KAAK;KACf;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,mBAAW,CAAC,UAAU;QAC7B,WAAW,EAAE,kDAAkD;QAC/D,WAAW,EAAE,MAAM;QACnB,OAAO,EAAE,mBAAW;QACpB,OAAO,EAAE;YACP,QAAQ,EAAE,oCAAoC;YAC9C,WAAW,EACT,oEAAoE;SACvE;QACD,OAAO,EAAE,IAAI;KACd;CACF,CAAC","sourcesContent":["import { API_TIMEOUT } from '../../utils';\nimport { ReyaChainId } from '../../types';\n\ntype ServiceEnvironment = 'production' | 'test' | 'local';\nexport interface ServiceConfig {\n chain: ReyaChainId;\n apiEndpoint: string;\n environment: ServiceEnvironment; // Configuration for SDK, such as base URL for the REST API\n timeout: number; // Optional timeout for API requests\n twitter: {\n clientId: string;\n redirectURI: string;\n };\n logging: boolean;\n}\n\nexport const API_CLIENT_CONFIGS: Record<ServiceEnvironment, ServiceConfig> = {\n local: {\n chain: ReyaChainId.reyaCronos,\n apiEndpoint: 'http://localhost:3000',\n environment: 'local',\n timeout: API_TIMEOUT,\n // todo: change to production creds when new app is created\n twitter: {\n clientId: 'LTBKa25VWkpjaEtSMzRGVEZaYmU6MTpjaQ',\n redirectURI:\n 'https://m8mjgmqmte.eu-central-1.awsapprunner.com/api/twitter/share',\n },\n logging: true,\n },\n production: {\n chain: ReyaChainId.reyaNetwork,\n apiEndpoint: 'https://api.reya.xyz',\n environment: 'production',\n timeout: API_TIMEOUT,\n twitter: {\n clientId: 'LTBKa25VWkpjaEtSMzRGVEZaYmU6MTpjaQ',\n redirectURI:\n 'https://mtducb79rf.eu-central-1.awsapprunner.com/api/twitter/share',\n },\n logging: false,\n },\n test: {\n chain: ReyaChainId.reyaCronos,\n apiEndpoint: 'https://m8mjgmqmte.eu-central-1.awsapprunner.com',\n environment: 'test',\n timeout: API_TIMEOUT,\n twitter: {\n clientId: 'LTBKa25VWkpjaEtSMzRGVEZaYmU6MTpjaQ',\n redirectURI:\n 'https://m8mjgmqmte.eu-central-1.awsapprunner.com/api/twitter/share',\n },\n logging: true,\n },\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"/","sources":["decorators/logger.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,MAAM,CAAC,SAAS,EAAE,MAAM,YAE5B,MAAM,eACD,MAAM,GAAG,MAAM,cAChB,kBAAkB,UAWjC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"/","sources":["rest/helpers/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,KAAK,kBAAkB,GAAG,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAC1D,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,WAAW,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,kBAAkB,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"/","sources":["rest/helpers/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,KAAK,kBAAkB,GAAG,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAC1D,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,WAAW,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,kBAAkB,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAsCxE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
43
43
|
},
|
|
44
44
|
"packageManager": "pnpm@8.10.4",
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "450faab59074149c97db18a8d3330b5e1a9c73d7"
|
|
46
46
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './logger';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface Loggable {
|
|
2
|
+
loggingEnabled: boolean;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function Logger(logPrefix: string) {
|
|
6
|
+
return function (
|
|
7
|
+
target: object,
|
|
8
|
+
propertyKey: string | symbol,
|
|
9
|
+
descriptor: PropertyDescriptor,
|
|
10
|
+
) {
|
|
11
|
+
const originalMethod = descriptor.value;
|
|
12
|
+
|
|
13
|
+
descriptor.value = function (...args: never[]) {
|
|
14
|
+
if ((this as Loggable).loggingEnabled) {
|
|
15
|
+
console.log(`[${logPrefix}]: called with args: `, args);
|
|
16
|
+
}
|
|
17
|
+
return originalMethod.apply(this, args);
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ export interface ServiceConfig {
|
|
|
11
11
|
clientId: string;
|
|
12
12
|
redirectURI: string;
|
|
13
13
|
};
|
|
14
|
+
logging: boolean;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export const API_CLIENT_CONFIGS: Record<ServiceEnvironment, ServiceConfig> = {
|
|
@@ -25,6 +26,7 @@ export const API_CLIENT_CONFIGS: Record<ServiceEnvironment, ServiceConfig> = {
|
|
|
25
26
|
redirectURI:
|
|
26
27
|
'https://m8mjgmqmte.eu-central-1.awsapprunner.com/api/twitter/share',
|
|
27
28
|
},
|
|
29
|
+
logging: true,
|
|
28
30
|
},
|
|
29
31
|
production: {
|
|
30
32
|
chain: ReyaChainId.reyaNetwork,
|
|
@@ -36,6 +38,7 @@ export const API_CLIENT_CONFIGS: Record<ServiceEnvironment, ServiceConfig> = {
|
|
|
36
38
|
redirectURI:
|
|
37
39
|
'https://mtducb79rf.eu-central-1.awsapprunner.com/api/twitter/share',
|
|
38
40
|
},
|
|
41
|
+
logging: false,
|
|
39
42
|
},
|
|
40
43
|
test: {
|
|
41
44
|
chain: ReyaChainId.reyaCronos,
|
|
@@ -47,5 +50,6 @@ export const API_CLIENT_CONFIGS: Record<ServiceEnvironment, ServiceConfig> = {
|
|
|
47
50
|
redirectURI:
|
|
48
51
|
'https://m8mjgmqmte.eu-central-1.awsapprunner.com/api/twitter/share',
|
|
49
52
|
},
|
|
53
|
+
logging: true,
|
|
50
54
|
},
|
|
51
55
|
};
|