@microsoft/teams.common 0.2.7

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 (92) hide show
  1. package/README.md +36 -0
  2. package/dist/events/event-emitter.d.mts +20 -0
  3. package/dist/events/event-emitter.d.ts +20 -0
  4. package/dist/events/event-emitter.js +38 -0
  5. package/dist/events/event-emitter.js.map +1 -0
  6. package/dist/events/event-emitter.mjs +36 -0
  7. package/dist/events/event-emitter.mjs.map +1 -0
  8. package/dist/events/index.d.mts +1 -0
  9. package/dist/events/index.d.ts +1 -0
  10. package/dist/events/index.js +14 -0
  11. package/dist/events/index.js.map +1 -0
  12. package/dist/events/index.mjs +3 -0
  13. package/dist/events/index.mjs.map +1 -0
  14. package/dist/http/client.d.mts +83 -0
  15. package/dist/http/client.d.ts +83 -0
  16. package/dist/http/client.js +159 -0
  17. package/dist/http/client.js.map +1 -0
  18. package/dist/http/client.mjs +153 -0
  19. package/dist/http/client.mjs.map +1 -0
  20. package/dist/http/index.d.mts +5 -0
  21. package/dist/http/index.d.ts +5 -0
  22. package/dist/http/index.js +28 -0
  23. package/dist/http/index.js.map +1 -0
  24. package/dist/http/index.mjs +5 -0
  25. package/dist/http/index.mjs.map +1 -0
  26. package/dist/http/interceptor.d.mts +53 -0
  27. package/dist/http/interceptor.d.ts +53 -0
  28. package/dist/http/interceptor.js +4 -0
  29. package/dist/http/interceptor.js.map +1 -0
  30. package/dist/http/interceptor.mjs +3 -0
  31. package/dist/http/interceptor.mjs.map +1 -0
  32. package/dist/http/token.d.mts +9 -0
  33. package/dist/http/token.d.ts +9 -0
  34. package/dist/http/token.js +4 -0
  35. package/dist/http/token.js.map +1 -0
  36. package/dist/http/token.mjs +3 -0
  37. package/dist/http/token.mjs.map +1 -0
  38. package/dist/index.d.mts +10 -0
  39. package/dist/index.d.ts +10 -0
  40. package/dist/index.js +35 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/index.mjs +6 -0
  43. package/dist/index.mjs.map +1 -0
  44. package/dist/logging/ansi.d.mts +34 -0
  45. package/dist/logging/ansi.d.ts +34 -0
  46. package/dist/logging/ansi.js +39 -0
  47. package/dist/logging/ansi.js.map +1 -0
  48. package/dist/logging/ansi.mjs +37 -0
  49. package/dist/logging/ansi.mjs.map +1 -0
  50. package/dist/logging/console.d.mts +18 -0
  51. package/dist/logging/console.d.ts +18 -0
  52. package/dist/logging/console.js +91 -0
  53. package/dist/logging/console.js.map +1 -0
  54. package/dist/logging/console.mjs +89 -0
  55. package/dist/logging/console.mjs.map +1 -0
  56. package/dist/logging/index.d.mts +3 -0
  57. package/dist/logging/index.d.ts +3 -0
  58. package/dist/logging/index.js +28 -0
  59. package/dist/logging/index.js.map +1 -0
  60. package/dist/logging/index.mjs +5 -0
  61. package/dist/logging/index.mjs.map +1 -0
  62. package/dist/logging/logger.d.mts +45 -0
  63. package/dist/logging/logger.d.ts +45 -0
  64. package/dist/logging/logger.js +4 -0
  65. package/dist/logging/logger.js.map +1 -0
  66. package/dist/logging/logger.mjs +3 -0
  67. package/dist/logging/logger.mjs.map +1 -0
  68. package/dist/logging/string.d.mts +36 -0
  69. package/dist/logging/string.d.ts +36 -0
  70. package/dist/logging/string.js +121 -0
  71. package/dist/logging/string.js.map +1 -0
  72. package/dist/logging/string.mjs +119 -0
  73. package/dist/logging/string.mjs.map +1 -0
  74. package/dist/storage/index.d.mts +2 -0
  75. package/dist/storage/index.d.ts +2 -0
  76. package/dist/storage/index.js +21 -0
  77. package/dist/storage/index.js.map +1 -0
  78. package/dist/storage/index.mjs +4 -0
  79. package/dist/storage/index.mjs.map +1 -0
  80. package/dist/storage/local-storage.d.mts +23 -0
  81. package/dist/storage/local-storage.d.ts +23 -0
  82. package/dist/storage/local-storage.js +69 -0
  83. package/dist/storage/local-storage.js.map +1 -0
  84. package/dist/storage/local-storage.mjs +67 -0
  85. package/dist/storage/local-storage.mjs.map +1 -0
  86. package/dist/storage/storage.d.mts +22 -0
  87. package/dist/storage/storage.d.ts +22 -0
  88. package/dist/storage/storage.js +4 -0
  89. package/dist/storage/storage.js.map +1 -0
  90. package/dist/storage/storage.mjs +3 -0
  91. package/dist/storage/storage.mjs.map +1 -0
  92. package/package.json +91 -0
@@ -0,0 +1,153 @@
1
+ import axios from 'axios';
2
+ import { ConsoleLogger } from '../logging';
3
+
4
+ class Client {
5
+ token;
6
+ name;
7
+ options;
8
+ log;
9
+ http;
10
+ seq = 0;
11
+ interceptors;
12
+ constructor(options = {}) {
13
+ this.options = options;
14
+ this.name = options.name || "http";
15
+ this.token = options.token;
16
+ this.log = options.logger || new ConsoleLogger(this.name);
17
+ this.interceptors = /* @__PURE__ */ new Map();
18
+ this.http = axios.create({
19
+ baseURL: options.baseUrl,
20
+ timeout: options.timeout,
21
+ headers: options.headers
22
+ });
23
+ for (const interceptor of options.interceptors || []) {
24
+ this.use(interceptor);
25
+ }
26
+ }
27
+ async get(url, config) {
28
+ return this.http.get(url, await this.withConfig(config));
29
+ }
30
+ async post(url, data, config) {
31
+ return this.http.post(url, data, await this.withConfig(config));
32
+ }
33
+ async put(url, data, config) {
34
+ return this.http.put(url, data, await this.withConfig(config));
35
+ }
36
+ async patch(url, data, config) {
37
+ return this.http.patch(url, data, await this.withConfig(config));
38
+ }
39
+ async delete(url, config) {
40
+ return this.http.delete(url, await this.withConfig(config));
41
+ }
42
+ async request(config) {
43
+ return this.http.request(await this.withConfig(config));
44
+ }
45
+ /**
46
+ * Register an interceptor to use
47
+ * as middleware for the request/response/error
48
+ */
49
+ use(interceptor) {
50
+ const id = ++this.seq;
51
+ let requestId = void 0;
52
+ let responseId = void 0;
53
+ if (interceptor.request) {
54
+ requestId = this.http.interceptors.request.use(
55
+ /* istanbul ignore next */
56
+ (config) => {
57
+ return interceptor.request({ config, log: this.log });
58
+ },
59
+ /* istanbul ignore next */
60
+ (error) => {
61
+ if (!interceptor.error) return error;
62
+ return interceptor.error({ error, log: this.log });
63
+ }
64
+ );
65
+ }
66
+ if (interceptor.response) {
67
+ responseId = this.http.interceptors.response.use(
68
+ /* istanbul ignore next */
69
+ (res) => {
70
+ return interceptor.response({ res, log: this.log });
71
+ },
72
+ /* istanbul ignore next */
73
+ (error) => {
74
+ if (!interceptor.error) return error;
75
+ return interceptor.error({ error, log: this.log });
76
+ }
77
+ );
78
+ }
79
+ this.interceptors.set(id, {
80
+ requestId,
81
+ responseId,
82
+ interceptor
83
+ });
84
+ return id;
85
+ }
86
+ /**
87
+ * Eject an interceptor
88
+ */
89
+ eject(id) {
90
+ const registry = this.interceptors.get(id);
91
+ if (!registry) return;
92
+ if (registry.requestId) {
93
+ this.http.interceptors.request.eject(registry.requestId);
94
+ }
95
+ if (registry.responseId) {
96
+ this.http.interceptors.response.eject(registry.responseId);
97
+ }
98
+ this.interceptors.delete(id);
99
+ }
100
+ /**
101
+ * Clear (Eject) all interceptors
102
+ */
103
+ clear() {
104
+ for (const id of this.interceptors.keys()) {
105
+ this.eject(id);
106
+ }
107
+ }
108
+ /**
109
+ * Create a copy of the client
110
+ */
111
+ clone(options) {
112
+ return new Client({
113
+ ...this.options,
114
+ ...options,
115
+ headers: {
116
+ ...this.options.headers,
117
+ ...options?.headers
118
+ },
119
+ interceptors: [...Array.from(this.interceptors.values()).map((i) => i.interceptor)]
120
+ });
121
+ }
122
+ async withConfig(config = {}) {
123
+ let token = config.token || this.token;
124
+ if (config.token) {
125
+ delete config.token;
126
+ }
127
+ if (this.options.headers) {
128
+ if (!config.headers) {
129
+ config.headers = {};
130
+ }
131
+ for (const key in this.options.headers) {
132
+ config.headers[key] = this.options.headers[key];
133
+ }
134
+ }
135
+ if (token) {
136
+ if (!config.headers) {
137
+ config.headers = {};
138
+ }
139
+ if (typeof token === "function") {
140
+ token = await token(config);
141
+ }
142
+ if (token && typeof token === "object") {
143
+ token = token.toString();
144
+ }
145
+ config.headers["Authorization"] = `Bearer ${token}`;
146
+ }
147
+ return config;
148
+ }
149
+ }
150
+
151
+ export { Client };
152
+ //# sourceMappingURL=client.mjs.map
153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AAY,EAAA;AAC/B,QAAQ,KAAA,GAAA,MAAM,MAAM,MAAM,CAAA;AAAA;AAG5B,MAAI,IAAA,KAAA,IAAS,OAAO,KAAA,KAAU,QAAU,EAAA;AACtC,QAAA,KAAA,GAAQ,MAAM,QAAS,EAAA;AAAA;AAGzB,MAAA,MAAA,CAAO,OAAQ,CAAA,eAAe,CAAI,GAAA,CAAA,OAAA,EAAU,KAAK,CAAA,CAAA;AAAA;AAGnD,IAAO,OAAA,MAAA;AAAA;AAEX","file":"client.mjs","sourcesContent":["import axios, {\n AxiosInstance,\n AxiosResponse,\n AxiosRequestConfig,\n RawAxiosRequestHeaders,\n} from 'axios';\n\nimport { ConsoleLogger, ILogger } from '../logging';\n\nimport { Interceptor } from './interceptor';\nimport { Token } from './token';\n\nexport type ClientOptions = {\n /**\n * The client name\n */\n readonly name?: string;\n\n /**\n * The authorization token to use\n */\n readonly token?: Token;\n\n /**\n *: ILogger instance to use\n */\n readonly logger?: ILogger;\n\n /**\n * The baseUrl to prefix all client requests with\n */\n readonly baseUrl?: string;\n\n /**\n * Default request timeout (ms)\n */\n readonly timeout?: number;\n\n /**\n * Default headers\n */\n readonly headers?: RawAxiosRequestHeaders;\n\n /**\n * Default interceptors to register\n */\n readonly interceptors?: Array<Interceptor>;\n};\n\nexport type RequestConfig<D = any> = AxiosRequestConfig<D> & {\n /**\n * If provided, this token will be used instead of\n * the default token provided in the `ClientOptions`\n */\n token?: Token;\n};\n\ntype InterceptorRegistry = {\n readonly requestId?: number;\n readonly responseId?: number;\n readonly interceptor: Interceptor;\n};\n\nexport class Client {\n token?: Token;\n readonly name: string;\n\n protected options: ClientOptions;\n protected log: ILogger;\n protected http: AxiosInstance;\n protected seq: number = 0;\n protected interceptors: Map<number, InterceptorRegistry>;\n\n constructor(options: ClientOptions = {}) {\n this.options = options;\n this.name = options.name || 'http';\n this.token = options.token;\n this.log = options.logger || new ConsoleLogger(this.name);\n this.interceptors = new Map<number, InterceptorRegistry>();\n this.http = axios.create({\n baseURL: options.baseUrl,\n timeout: options.timeout,\n headers: options.headers,\n });\n\n for (const interceptor of options.interceptors || []) {\n this.use(interceptor);\n }\n }\n\n async get<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: RequestConfig<D>) {\n return this.http.get<T, R, D>(url, await this.withConfig(config));\n }\n\n async post<T = any, R = AxiosResponse<T>, D = any>(\n url: string,\n data?: D,\n config?: RequestConfig<D>\n ) {\n return this.http.post<T, R, D>(url, data, await this.withConfig(config));\n }\n\n async put<T = any, R = AxiosResponse<T>, D = any>(\n url: string,\n data?: D,\n config?: RequestConfig<D>\n ) {\n return this.http.put<T, R, D>(url, data, await this.withConfig(config));\n }\n\n async patch<T = any, R = AxiosResponse<T>, D = any>(\n url: string,\n data?: D,\n config?: RequestConfig<D>\n ) {\n return this.http.patch<T, R, D>(url, data, await this.withConfig(config));\n }\n\n async delete<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: RequestConfig<D>) {\n return this.http.delete<T, R, D>(url, await this.withConfig(config));\n }\n\n async request<T = any, R = AxiosResponse<T>, D = any>(config: RequestConfig<D>) {\n return this.http.request<T, R, D>(await this.withConfig(config));\n }\n\n /**\n * Register an interceptor to use\n * as middleware for the request/response/error\n */\n use(interceptor: Interceptor) {\n const id = ++this.seq;\n let requestId: number | undefined = undefined;\n let responseId: number | undefined = undefined;\n\n if (interceptor.request) {\n requestId = this.http.interceptors.request.use(\n /* istanbul ignore next */\n (config) => {\n return interceptor.request!({ config, log: this.log });\n },\n /* istanbul ignore next */\n (error: any) => {\n if (!interceptor.error) return error;\n return interceptor.error({ error, log: this.log });\n }\n );\n }\n\n if (interceptor.response) {\n responseId = this.http.interceptors.response.use(\n /* istanbul ignore next */\n (res) => {\n return interceptor.response!({ res, log: this.log });\n },\n /* istanbul ignore next */\n (error: any) => {\n if (!interceptor.error) return error;\n return interceptor.error({ error, log: this.log });\n }\n );\n }\n\n this.interceptors.set(id, {\n requestId,\n responseId,\n interceptor,\n });\n\n return id;\n }\n\n /**\n * Eject an interceptor\n */\n eject(id: number) {\n const registry = this.interceptors.get(id);\n\n if (!registry) return;\n\n if (registry.requestId) {\n this.http.interceptors.request.eject(registry.requestId);\n }\n\n if (registry.responseId) {\n this.http.interceptors.response.eject(registry.responseId);\n }\n\n this.interceptors.delete(id);\n }\n\n /**\n * Clear (Eject) all interceptors\n */\n clear() {\n for (const id of this.interceptors.keys()) {\n this.eject(id);\n }\n }\n\n /**\n * Create a copy of the client\n */\n clone(options?: ClientOptions) {\n return new Client({\n ...this.options,\n ...options,\n headers: {\n ...this.options.headers,\n ...options?.headers,\n },\n interceptors: [...Array.from(this.interceptors.values()).map((i) => i.interceptor)],\n });\n }\n\n protected async withConfig(config: RequestConfig = {}) {\n let token = config.token || this.token;\n\n if (config.token) {\n delete config.token;\n }\n\n if (this.options.headers) {\n if (!config.headers) {\n config.headers = {};\n }\n\n for (const key in this.options.headers) {\n config.headers[key] = this.options.headers[key];\n }\n }\n\n if (token) {\n if (!config.headers) {\n config.headers = {};\n }\n\n if (typeof token === 'function') {\n token = await token(config);\n }\n\n if (token && typeof token === 'object') {\n token = token.toString();\n }\n\n config.headers['Authorization'] = `Bearer ${token}`;\n }\n\n return config;\n }\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export { Client, ClientOptions, RequestConfig } from './client.mjs';
2
+ export { ErrorContext, ErrorInterceptor, Interceptor, RequestContext, RequestInterceptor, ResponseContext, ResponseInterceptor } from './interceptor.mjs';
3
+ export { StringLike, Token, TokenFactory } from './token.mjs';
4
+ import 'axios';
5
+ import '../logging/logger.mjs';
@@ -0,0 +1,5 @@
1
+ export { Client, ClientOptions, RequestConfig } from './client.js';
2
+ export { ErrorContext, ErrorInterceptor, Interceptor, RequestContext, RequestInterceptor, ResponseContext, ResponseInterceptor } from './interceptor.js';
3
+ export { StringLike, Token, TokenFactory } from './token.js';
4
+ import 'axios';
5
+ import '../logging/logger.js';
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ var client = require('./client');
4
+ var interceptor = require('./interceptor');
5
+ var token = require('./token');
6
+
7
+
8
+
9
+ Object.keys(client).forEach(function (k) {
10
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
11
+ enumerable: true,
12
+ get: function () { return client[k]; }
13
+ });
14
+ });
15
+ Object.keys(interceptor).forEach(function (k) {
16
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
17
+ enumerable: true,
18
+ get: function () { return interceptor[k]; }
19
+ });
20
+ });
21
+ Object.keys(token).forEach(function (k) {
22
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
23
+ enumerable: true,
24
+ get: function () { return token[k]; }
25
+ });
26
+ });
27
+ //# sourceMappingURL=index.js.map
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
@@ -0,0 +1,5 @@
1
+ export * from './client';
2
+ export * from './interceptor';
3
+ export * from './token';
4
+ //# sourceMappingURL=index.mjs.map
5
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs","sourcesContent":[]}
@@ -0,0 +1,53 @@
1
+ import { AxiosInterceptorOptions, InternalAxiosRequestConfig, AxiosResponse } from 'axios';
2
+ import { ILogger } from '../logging/logger.mjs';
3
+
4
+ type Interceptor = {
5
+ options?: AxiosInterceptorOptions;
6
+ request?: RequestInterceptor;
7
+ response?: ResponseInterceptor;
8
+ error?: ErrorInterceptor;
9
+ };
10
+ type ErrorContext<T = any> = {
11
+ /**
12
+ * The error
13
+ */
14
+ readonly error: T;
15
+ /**
16
+ * The clients logger instance
17
+ */
18
+ readonly log: ILogger;
19
+ };
20
+ /**
21
+ * A method called to intercept a request that failed
22
+ */
23
+ type ErrorInterceptor<T = any> = (ctx: ErrorContext<T>) => any;
24
+ type RequestContext<D = any> = {
25
+ /**
26
+ * The outgoing request config
27
+ */
28
+ readonly config: InternalAxiosRequestConfig<D>;
29
+ /**
30
+ * The clients logger instance
31
+ */
32
+ readonly log: ILogger;
33
+ };
34
+ /**
35
+ * A method called to intercept a successful request
36
+ */
37
+ type RequestInterceptor<D = any> = (ctx: RequestContext<D>) => InternalAxiosRequestConfig | Promise<InternalAxiosRequestConfig>;
38
+ type ResponseContext<T = any, D = any> = {
39
+ /**
40
+ * The response
41
+ */
42
+ readonly res: AxiosResponse<T, D>;
43
+ /**
44
+ * The clients logger instance
45
+ */
46
+ readonly log: ILogger;
47
+ };
48
+ /**
49
+ * A method called to intercept a successful response
50
+ */
51
+ type ResponseInterceptor<T = any, D = any> = (ctx: ResponseContext<T, D>) => AxiosResponse | Promise<AxiosResponse>;
52
+
53
+ export type { ErrorContext, ErrorInterceptor, Interceptor, RequestContext, RequestInterceptor, ResponseContext, ResponseInterceptor };
@@ -0,0 +1,53 @@
1
+ import { AxiosInterceptorOptions, InternalAxiosRequestConfig, AxiosResponse } from 'axios';
2
+ import { ILogger } from '../logging/logger.js';
3
+
4
+ type Interceptor = {
5
+ options?: AxiosInterceptorOptions;
6
+ request?: RequestInterceptor;
7
+ response?: ResponseInterceptor;
8
+ error?: ErrorInterceptor;
9
+ };
10
+ type ErrorContext<T = any> = {
11
+ /**
12
+ * The error
13
+ */
14
+ readonly error: T;
15
+ /**
16
+ * The clients logger instance
17
+ */
18
+ readonly log: ILogger;
19
+ };
20
+ /**
21
+ * A method called to intercept a request that failed
22
+ */
23
+ type ErrorInterceptor<T = any> = (ctx: ErrorContext<T>) => any;
24
+ type RequestContext<D = any> = {
25
+ /**
26
+ * The outgoing request config
27
+ */
28
+ readonly config: InternalAxiosRequestConfig<D>;
29
+ /**
30
+ * The clients logger instance
31
+ */
32
+ readonly log: ILogger;
33
+ };
34
+ /**
35
+ * A method called to intercept a successful request
36
+ */
37
+ type RequestInterceptor<D = any> = (ctx: RequestContext<D>) => InternalAxiosRequestConfig | Promise<InternalAxiosRequestConfig>;
38
+ type ResponseContext<T = any, D = any> = {
39
+ /**
40
+ * The response
41
+ */
42
+ readonly res: AxiosResponse<T, D>;
43
+ /**
44
+ * The clients logger instance
45
+ */
46
+ readonly log: ILogger;
47
+ };
48
+ /**
49
+ * A method called to intercept a successful response
50
+ */
51
+ type ResponseInterceptor<T = any, D = any> = (ctx: ResponseContext<T, D>) => AxiosResponse | Promise<AxiosResponse>;
52
+
53
+ export type { ErrorContext, ErrorInterceptor, Interceptor, RequestContext, RequestInterceptor, ResponseContext, ResponseInterceptor };
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ //# sourceMappingURL=interceptor.js.map
4
+ //# sourceMappingURL=interceptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"interceptor.js"}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=interceptor.mjs.map
3
+ //# sourceMappingURL=interceptor.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"interceptor.mjs"}
@@ -0,0 +1,9 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+
3
+ type StringLike = {
4
+ toString(): string;
5
+ };
6
+ type TokenFactory = (config: AxiosRequestConfig) => string | StringLike | undefined | Promise<string | StringLike | undefined>;
7
+ type Token = string | StringLike | TokenFactory;
8
+
9
+ export type { StringLike, Token, TokenFactory };
@@ -0,0 +1,9 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+
3
+ type StringLike = {
4
+ toString(): string;
5
+ };
6
+ type TokenFactory = (config: AxiosRequestConfig) => string | StringLike | undefined | Promise<string | StringLike | undefined>;
7
+ type Token = string | StringLike | TokenFactory;
8
+
9
+ export type { StringLike, Token, TokenFactory };
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ //# sourceMappingURL=token.js.map
4
+ //# sourceMappingURL=token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"token.js"}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=token.mjs.map
3
+ //# sourceMappingURL=token.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"token.mjs"}
@@ -0,0 +1,10 @@
1
+ export { EventEmitter, EventHandler, IEventEmitter } from './events/event-emitter.mjs';
2
+ export { Client, ClientOptions, RequestConfig } from './http/client.mjs';
3
+ export { ErrorContext, ErrorInterceptor, Interceptor, RequestContext, RequestInterceptor, ResponseContext, ResponseInterceptor } from './http/interceptor.mjs';
4
+ export { StringLike, Token, TokenFactory } from './http/token.mjs';
5
+ export { ConsoleLogger } from './logging/console.mjs';
6
+ export { ILogger, ILoggerOptions, LogLevel } from './logging/logger.mjs';
7
+ export { String } from './logging/string.mjs';
8
+ export { IListStorage, IStorage } from './storage/storage.mjs';
9
+ export { LocalStorage, LocalStorageOptions } from './storage/local-storage.mjs';
10
+ import 'axios';
@@ -0,0 +1,10 @@
1
+ export { EventEmitter, EventHandler, IEventEmitter } from './events/event-emitter.js';
2
+ export { Client, ClientOptions, RequestConfig } from './http/client.js';
3
+ export { ErrorContext, ErrorInterceptor, Interceptor, RequestContext, RequestInterceptor, ResponseContext, ResponseInterceptor } from './http/interceptor.js';
4
+ export { StringLike, Token, TokenFactory } from './http/token.js';
5
+ export { ConsoleLogger } from './logging/console.js';
6
+ export { ILogger, ILoggerOptions, LogLevel } from './logging/logger.js';
7
+ export { String } from './logging/string.js';
8
+ export { IListStorage, IStorage } from './storage/storage.js';
9
+ export { LocalStorage, LocalStorageOptions } from './storage/local-storage.js';
10
+ import 'axios';
package/dist/index.js ADDED
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ var events = require('./events');
4
+ var http = require('./http');
5
+ var logging = require('./logging');
6
+ var storage = require('./storage');
7
+
8
+
9
+
10
+ Object.keys(events).forEach(function (k) {
11
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
12
+ enumerable: true,
13
+ get: function () { return events[k]; }
14
+ });
15
+ });
16
+ Object.keys(http).forEach(function (k) {
17
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
18
+ enumerable: true,
19
+ get: function () { return http[k]; }
20
+ });
21
+ });
22
+ Object.keys(logging).forEach(function (k) {
23
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
24
+ enumerable: true,
25
+ get: function () { return logging[k]; }
26
+ });
27
+ });
28
+ Object.keys(storage).forEach(function (k) {
29
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
30
+ enumerable: true,
31
+ get: function () { return storage[k]; }
32
+ });
33
+ });
34
+ //# sourceMappingURL=index.js.map
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
package/dist/index.mjs ADDED
@@ -0,0 +1,6 @@
1
+ export * from './events';
2
+ export * from './http';
3
+ export * from './logging';
4
+ export * from './storage';
5
+ //# sourceMappingURL=index.mjs.map
6
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs","sourcesContent":[]}
@@ -0,0 +1,34 @@
1
+ declare enum ANSI {
2
+ Reset = "\u001B[0m",
3
+ Bold = "\u001B[1m",
4
+ BoldReset = "\u001B[22m",
5
+ Italic = "\u001B[3m",
6
+ ItalicReset = "\u001B[23m",
7
+ Underline = "\u001B[4m",
8
+ UnderlineReset = "\u001B[24m",
9
+ Strike = "\u001B[9m",
10
+ StrikeReset = "\u001B[29m",
11
+ ForegroundReset = "\u001B[0m",
12
+ BackgroundReset = "\u001B[0m",
13
+ ForegroundBlack = "\u001B[30m",
14
+ BackgroundBlack = "\u001B[40m",
15
+ ForegroundRed = "\u001B[31m",
16
+ BackgroundRed = "\u001B[41m",
17
+ ForegroundGreen = "\u001B[32m",
18
+ BackgroundGreen = "\u001B[42m",
19
+ ForegroundYellow = "\u001B[33m",
20
+ BackgroundYellow = "\u001B[43m",
21
+ ForegroundBlue = "\u001B[34m",
22
+ BackgroundBlue = "\u001B[44m",
23
+ ForegroundMagenta = "\u001B[35m",
24
+ BackgroundMagenta = "\u001B[45m",
25
+ ForegroundCyan = "\u001B[36m",
26
+ BackgroundCyan = "\u001B[46m",
27
+ ForegroundWhite = "\u001B[37m",
28
+ BackgroundWhite = "\u001B[47m",
29
+ ForegroundGray = "\u001B[90m",
30
+ ForegroundDefault = "\u001B[39m",
31
+ BackgroundDefault = "\u001B[49m"
32
+ }
33
+
34
+ export { ANSI };
@@ -0,0 +1,34 @@
1
+ declare enum ANSI {
2
+ Reset = "\u001B[0m",
3
+ Bold = "\u001B[1m",
4
+ BoldReset = "\u001B[22m",
5
+ Italic = "\u001B[3m",
6
+ ItalicReset = "\u001B[23m",
7
+ Underline = "\u001B[4m",
8
+ UnderlineReset = "\u001B[24m",
9
+ Strike = "\u001B[9m",
10
+ StrikeReset = "\u001B[29m",
11
+ ForegroundReset = "\u001B[0m",
12
+ BackgroundReset = "\u001B[0m",
13
+ ForegroundBlack = "\u001B[30m",
14
+ BackgroundBlack = "\u001B[40m",
15
+ ForegroundRed = "\u001B[31m",
16
+ BackgroundRed = "\u001B[41m",
17
+ ForegroundGreen = "\u001B[32m",
18
+ BackgroundGreen = "\u001B[42m",
19
+ ForegroundYellow = "\u001B[33m",
20
+ BackgroundYellow = "\u001B[43m",
21
+ ForegroundBlue = "\u001B[34m",
22
+ BackgroundBlue = "\u001B[44m",
23
+ ForegroundMagenta = "\u001B[35m",
24
+ BackgroundMagenta = "\u001B[45m",
25
+ ForegroundCyan = "\u001B[36m",
26
+ BackgroundCyan = "\u001B[46m",
27
+ ForegroundWhite = "\u001B[37m",
28
+ BackgroundWhite = "\u001B[47m",
29
+ ForegroundGray = "\u001B[90m",
30
+ ForegroundDefault = "\u001B[39m",
31
+ BackgroundDefault = "\u001B[49m"
32
+ }
33
+
34
+ export { ANSI };
@@ -0,0 +1,39 @@
1
+ 'use strict';
2
+
3
+ var ANSI = /* @__PURE__ */ ((ANSI2) => {
4
+ ANSI2["Reset"] = "\x1B[0m";
5
+ ANSI2["Bold"] = "\x1B[1m";
6
+ ANSI2["BoldReset"] = "\x1B[22m";
7
+ ANSI2["Italic"] = "\x1B[3m";
8
+ ANSI2["ItalicReset"] = "\x1B[23m";
9
+ ANSI2["Underline"] = "\x1B[4m";
10
+ ANSI2["UnderlineReset"] = "\x1B[24m";
11
+ ANSI2["Strike"] = "\x1B[9m";
12
+ ANSI2["StrikeReset"] = "\x1B[29m";
13
+ ANSI2["ForegroundReset"] = "\x1B[0m";
14
+ ANSI2["BackgroundReset"] = "\x1B[0m";
15
+ ANSI2["ForegroundBlack"] = "\x1B[30m";
16
+ ANSI2["BackgroundBlack"] = "\x1B[40m";
17
+ ANSI2["ForegroundRed"] = "\x1B[31m";
18
+ ANSI2["BackgroundRed"] = "\x1B[41m";
19
+ ANSI2["ForegroundGreen"] = "\x1B[32m";
20
+ ANSI2["BackgroundGreen"] = "\x1B[42m";
21
+ ANSI2["ForegroundYellow"] = "\x1B[33m";
22
+ ANSI2["BackgroundYellow"] = "\x1B[43m";
23
+ ANSI2["ForegroundBlue"] = "\x1B[34m";
24
+ ANSI2["BackgroundBlue"] = "\x1B[44m";
25
+ ANSI2["ForegroundMagenta"] = "\x1B[35m";
26
+ ANSI2["BackgroundMagenta"] = "\x1B[45m";
27
+ ANSI2["ForegroundCyan"] = "\x1B[36m";
28
+ ANSI2["BackgroundCyan"] = "\x1B[46m";
29
+ ANSI2["ForegroundWhite"] = "\x1B[37m";
30
+ ANSI2["BackgroundWhite"] = "\x1B[47m";
31
+ ANSI2["ForegroundGray"] = "\x1B[90m";
32
+ ANSI2["ForegroundDefault"] = "\x1B[39m";
33
+ ANSI2["BackgroundDefault"] = "\x1B[49m";
34
+ return ANSI2;
35
+ })(ANSI || {});
36
+
37
+ exports.ANSI = ANSI;
38
+ //# sourceMappingURL=ansi.js.map
39
+ //# sourceMappingURL=ansi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/logging/ansi.ts"],"names":["ANSI"],"mappings":";;AAAY,IAAA,IAAA,qBAAAA,KAAL,KAAA;AACL,EAAAA,MAAA,OAAQ,CAAA,GAAA,SAAA;AAER,EAAAA,MAAA,MAAO,CAAA,GAAA,SAAA;AACP,EAAAA,MAAA,WAAY,CAAA,GAAA,UAAA;AACZ,EAAAA,MAAA,QAAS,CAAA,GAAA,SAAA;AACT,EAAAA,MAAA,aAAc,CAAA,GAAA,UAAA;AACd,EAAAA,MAAA,WAAY,CAAA,GAAA,SAAA;AACZ,EAAAA,MAAA,gBAAiB,CAAA,GAAA,UAAA;AACjB,EAAAA,MAAA,QAAS,CAAA,GAAA,SAAA;AACT,EAAAA,MAAA,aAAc,CAAA,GAAA,UAAA;AAEd,EAAAA,MAAA,iBAAkB,CAAA,GAAA,SAAA;AAClB,EAAAA,MAAA,iBAAkB,CAAA,GAAA,SAAA;AAClB,EAAAA,MAAA,iBAAkB,CAAA,GAAA,UAAA;AAClB,EAAAA,MAAA,iBAAkB,CAAA,GAAA,UAAA;AAClB,EAAAA,MAAA,eAAgB,CAAA,GAAA,UAAA;AAChB,EAAAA,MAAA,eAAgB,CAAA,GAAA,UAAA;AAChB,EAAAA,MAAA,iBAAkB,CAAA,GAAA,UAAA;AAClB,EAAAA,MAAA,iBAAkB,CAAA,GAAA,UAAA;AAClB,EAAAA,MAAA,kBAAmB,CAAA,GAAA,UAAA;AACnB,EAAAA,MAAA,kBAAmB,CAAA,GAAA,UAAA;AACnB,EAAAA,MAAA,gBAAiB,CAAA,GAAA,UAAA;AACjB,EAAAA,MAAA,gBAAiB,CAAA,GAAA,UAAA;AACjB,EAAAA,MAAA,mBAAoB,CAAA,GAAA,UAAA;AACpB,EAAAA,MAAA,mBAAoB,CAAA,GAAA,UAAA;AACpB,EAAAA,MAAA,gBAAiB,CAAA,GAAA,UAAA;AACjB,EAAAA,MAAA,gBAAiB,CAAA,GAAA,UAAA;AACjB,EAAAA,MAAA,iBAAkB,CAAA,GAAA,UAAA;AAClB,EAAAA,MAAA,iBAAkB,CAAA,GAAA,UAAA;AAClB,EAAAA,MAAA,gBAAiB,CAAA,GAAA,UAAA;AACjB,EAAAA,MAAA,mBAAoB,CAAA,GAAA,UAAA;AACpB,EAAAA,MAAA,mBAAoB,CAAA,GAAA,UAAA;AAhCV,EAAAA,OAAAA,KAAAA;AAAA,CAAA,EAAA,IAAA,IAAA,EAAA","file":"ansi.js","sourcesContent":["export enum ANSI {\n Reset = '\\x1b[0m',\n\n Bold = '\\x1b[1m',\n BoldReset = '\\x1b[22m',\n Italic = '\\x1b[3m',\n ItalicReset = '\\x1b[23m',\n Underline = '\\x1b[4m',\n UnderlineReset = '\\x1b[24m',\n Strike = '\\x1b[9m',\n StrikeReset = '\\x1b[29m',\n\n ForegroundReset = '\\x1b[0m',\n BackgroundReset = '\\x1b[0m',\n ForegroundBlack = '\\x1b[30m',\n BackgroundBlack = '\\x1b[40m',\n ForegroundRed = '\\x1b[31m',\n BackgroundRed = '\\x1b[41m',\n ForegroundGreen = '\\x1b[32m',\n BackgroundGreen = '\\x1b[42m',\n ForegroundYellow = '\\x1b[33m',\n BackgroundYellow = '\\x1b[43m',\n ForegroundBlue = '\\x1b[34m',\n BackgroundBlue = '\\x1b[44m',\n ForegroundMagenta = '\\x1b[35m',\n BackgroundMagenta = '\\x1b[45m',\n ForegroundCyan = '\\x1b[36m',\n BackgroundCyan = '\\x1b[46m',\n ForegroundWhite = '\\x1b[37m',\n BackgroundWhite = '\\x1b[47m',\n ForegroundGray = '\\x1b[90m',\n ForegroundDefault = '\\x1b[39m',\n BackgroundDefault = '\\x1b[49m',\n}\n"]}
@@ -0,0 +1,37 @@
1
+ var ANSI = /* @__PURE__ */ ((ANSI2) => {
2
+ ANSI2["Reset"] = "\x1B[0m";
3
+ ANSI2["Bold"] = "\x1B[1m";
4
+ ANSI2["BoldReset"] = "\x1B[22m";
5
+ ANSI2["Italic"] = "\x1B[3m";
6
+ ANSI2["ItalicReset"] = "\x1B[23m";
7
+ ANSI2["Underline"] = "\x1B[4m";
8
+ ANSI2["UnderlineReset"] = "\x1B[24m";
9
+ ANSI2["Strike"] = "\x1B[9m";
10
+ ANSI2["StrikeReset"] = "\x1B[29m";
11
+ ANSI2["ForegroundReset"] = "\x1B[0m";
12
+ ANSI2["BackgroundReset"] = "\x1B[0m";
13
+ ANSI2["ForegroundBlack"] = "\x1B[30m";
14
+ ANSI2["BackgroundBlack"] = "\x1B[40m";
15
+ ANSI2["ForegroundRed"] = "\x1B[31m";
16
+ ANSI2["BackgroundRed"] = "\x1B[41m";
17
+ ANSI2["ForegroundGreen"] = "\x1B[32m";
18
+ ANSI2["BackgroundGreen"] = "\x1B[42m";
19
+ ANSI2["ForegroundYellow"] = "\x1B[33m";
20
+ ANSI2["BackgroundYellow"] = "\x1B[43m";
21
+ ANSI2["ForegroundBlue"] = "\x1B[34m";
22
+ ANSI2["BackgroundBlue"] = "\x1B[44m";
23
+ ANSI2["ForegroundMagenta"] = "\x1B[35m";
24
+ ANSI2["BackgroundMagenta"] = "\x1B[45m";
25
+ ANSI2["ForegroundCyan"] = "\x1B[36m";
26
+ ANSI2["BackgroundCyan"] = "\x1B[46m";
27
+ ANSI2["ForegroundWhite"] = "\x1B[37m";
28
+ ANSI2["BackgroundWhite"] = "\x1B[47m";
29
+ ANSI2["ForegroundGray"] = "\x1B[90m";
30
+ ANSI2["ForegroundDefault"] = "\x1B[39m";
31
+ ANSI2["BackgroundDefault"] = "\x1B[49m";
32
+ return ANSI2;
33
+ })(ANSI || {});
34
+
35
+ export { ANSI };
36
+ //# sourceMappingURL=ansi.mjs.map
37
+ //# sourceMappingURL=ansi.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/logging/ansi.ts"],"names":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A,iBAAkB,CAAA,GAAA,UAAA;AAClB,EAAAA,MAAA,gBAAiB,CAAA,GAAA,UAAA;AACjB,EAAAA,MAAA,mBAAoB,CAAA,GAAA,UAAA;AACpB,EAAAA,MAAA,mBAAoB,CAAA,GAAA,UAAA;AAhCV,EAAAA,OAAAA,KAAAA;AAAA,CAAA,EAAA,IAAA,IAAA,EAAA","file":"ansi.mjs","sourcesContent":["export enum ANSI {\n Reset = '\\x1b[0m',\n\n Bold = '\\x1b[1m',\n BoldReset = '\\x1b[22m',\n Italic = '\\x1b[3m',\n ItalicReset = '\\x1b[23m',\n Underline = '\\x1b[4m',\n UnderlineReset = '\\x1b[24m',\n Strike = '\\x1b[9m',\n StrikeReset = '\\x1b[29m',\n\n ForegroundReset = '\\x1b[0m',\n BackgroundReset = '\\x1b[0m',\n ForegroundBlack = '\\x1b[30m',\n BackgroundBlack = '\\x1b[40m',\n ForegroundRed = '\\x1b[31m',\n BackgroundRed = '\\x1b[41m',\n ForegroundGreen = '\\x1b[32m',\n BackgroundGreen = '\\x1b[42m',\n ForegroundYellow = '\\x1b[33m',\n BackgroundYellow = '\\x1b[43m',\n ForegroundBlue = '\\x1b[34m',\n BackgroundBlue = '\\x1b[44m',\n ForegroundMagenta = '\\x1b[35m',\n BackgroundMagenta = '\\x1b[45m',\n ForegroundCyan = '\\x1b[36m',\n BackgroundCyan = '\\x1b[46m',\n ForegroundWhite = '\\x1b[37m',\n BackgroundWhite = '\\x1b[47m',\n ForegroundGray = '\\x1b[90m',\n ForegroundDefault = '\\x1b[39m',\n BackgroundDefault = '\\x1b[49m',\n}\n"]}