@uzum-tech/design-tokens-resolver 0.0.0-stage → 1.0.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/README.md +641 -2
- package/lib/cli.cjs +810 -0
- package/lib/cli.d.ts +1 -0
- package/lib/client/design.client.d.ts +7 -0
- package/lib/client/http.client.d.ts +13 -0
- package/lib/config/env.config.d.ts +7 -0
- package/lib/constants/cli.constants.d.ts +4 -0
- package/lib/constants/design.constants.d.ts +25 -0
- package/lib/constants/document.constants.d.ts +4 -0
- package/lib/constants/http.constants.d.ts +4 -0
- package/lib/constants/regular-expressions.constants.d.ts +6 -0
- package/lib/core/config-file.resolver.d.ts +9 -0
- package/lib/core/config.resolver.d.ts +6 -0
- package/lib/core/design-tokens-resolver.d.ts +12 -0
- package/lib/errors/resolver.error.d.ts +9 -0
- package/lib/index.cjs +755 -0
- package/lib/index.d.ts +15 -0
- package/lib/index.mjs +726 -0
- package/lib/mappers/cli.mapper.d.ts +7 -0
- package/lib/mappers/document.mapper.d.ts +12 -0
- package/lib/mappers/lock.mapper.d.ts +6 -0
- package/lib/mappers/resolve.mapper.d.ts +6 -0
- package/lib/types/config.types.d.ts +50 -0
- package/lib/types/document.types.d.ts +65 -0
- package/lib/types/error.types.d.ts +17 -0
- package/lib/types/http.types.d.ts +8 -0
- package/lib/types/index.d.ts +6 -0
- package/lib/types/release.types.d.ts +31 -0
- package/lib/types/resolve.types.d.ts +41 -0
- package/lib/utils/args.utils.d.ts +9 -0
- package/lib/utils/file.utils.d.ts +3 -0
- package/lib/utils/hash.utils.d.ts +3 -0
- package/lib/utils/resolve.utils.d.ts +6 -0
- package/lib/utils/url.utils.d.ts +4 -0
- package/package.json +78 -4
package/lib/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReleaseTypes } from '../types/release.types';
|
|
2
|
+
import HttpClient from './http.client';
|
|
3
|
+
export default class DesignClient extends HttpClient {
|
|
4
|
+
getRelease(version: string): Promise<ReleaseTypes.Release>;
|
|
5
|
+
getChannel(slug: string): Promise<ReleaseTypes.Channel>;
|
|
6
|
+
getDocument(version: string): Promise<string>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ConfigTypes } from '../types/config.types';
|
|
2
|
+
import { ErrorTypes } from '../types/error.types';
|
|
3
|
+
export default class HttpClient {
|
|
4
|
+
protected readonly config: ConfigTypes.Resolved;
|
|
5
|
+
constructor(config: ConfigTypes.Resolved);
|
|
6
|
+
private static isRetryable;
|
|
7
|
+
private static wait;
|
|
8
|
+
protected getJson<T>(path: string, notFoundCode: ErrorTypes.Code): Promise<T>;
|
|
9
|
+
protected request(path: string, notFoundCode?: ErrorTypes.Code): Promise<Response>;
|
|
10
|
+
private sendWithRetries;
|
|
11
|
+
private send;
|
|
12
|
+
private toHeaders;
|
|
13
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const designPaths: {
|
|
2
|
+
readonly release: "/dynamic/design/admin/token-releases/details";
|
|
3
|
+
readonly releasePayload: "/dynamic/design/admin/token-release-payloads/details";
|
|
4
|
+
readonly channel: "/dynamic/design/admin/token-channels/details";
|
|
5
|
+
};
|
|
6
|
+
export declare const engineBaseUrls: {
|
|
7
|
+
readonly local: "http://localhost:3003/api/v1";
|
|
8
|
+
readonly development: "https://esb-data-engine-int-dev.kapitalbank.uz/api/v1";
|
|
9
|
+
readonly production: "https://data-engine-int.kapitalbank.uz/api/v1";
|
|
10
|
+
};
|
|
11
|
+
export declare const designConfigFiles: readonly ["design-tokens.config.mjs", "design-tokens.config.js", "design-tokens.config.cjs", "design-tokens.config.json"];
|
|
12
|
+
export declare const JSON_CONFIG_SUFFIX = ".json";
|
|
13
|
+
export declare const designDefaults: {
|
|
14
|
+
readonly env: "production";
|
|
15
|
+
readonly requestTimeoutInMs: 30000;
|
|
16
|
+
readonly retryCount: 2;
|
|
17
|
+
readonly retryDelayInMs: 500;
|
|
18
|
+
readonly fileName: "tokens.json";
|
|
19
|
+
readonly lockFileName: "tokens.lock.json";
|
|
20
|
+
readonly authEnvHint: string;
|
|
21
|
+
};
|
|
22
|
+
export declare const JSON_INDENT = 2;
|
|
23
|
+
export declare const LINE_BREAK = "\n";
|
|
24
|
+
export declare const HASH_ALGORITHM = "sha256";
|
|
25
|
+
export declare const HASH_ENCODING = "hex";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ConfigTypes } from '../types/config.types';
|
|
2
|
+
export default class ConfigFileResolver {
|
|
3
|
+
static load(startPath: string): Promise<ConfigTypes.LoadedFile | null>;
|
|
4
|
+
static find(startPath: string): string | null;
|
|
5
|
+
private static findIn;
|
|
6
|
+
private static read;
|
|
7
|
+
private static readJson;
|
|
8
|
+
private static readModule;
|
|
9
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ConfigTypes } from '../types/config.types';
|
|
2
|
+
import { ResolveTypes } from '../types/resolve.types';
|
|
3
|
+
export default class DesignTokensResolver {
|
|
4
|
+
private readonly client;
|
|
5
|
+
private readonly config;
|
|
6
|
+
constructor(config: ConfigTypes.Config);
|
|
7
|
+
private static checkIntegrity;
|
|
8
|
+
getSource(): ResolveTypes.Source;
|
|
9
|
+
resolveVersion(target: ResolveTypes.Target): Promise<string>;
|
|
10
|
+
fetchVerified(target: ResolveTypes.Target): Promise<ResolveTypes.Verified>;
|
|
11
|
+
resolve(request: ResolveTypes.Request): Promise<ResolveTypes.Result>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ErrorTypes } from '../types/error.types';
|
|
2
|
+
import { HttpTypes } from '../types/http.types';
|
|
3
|
+
export default class ResolverError extends Error {
|
|
4
|
+
readonly code: ErrorTypes.Code;
|
|
5
|
+
readonly statusCode?: HttpTypes.Status;
|
|
6
|
+
readonly body?: unknown;
|
|
7
|
+
constructor(message: string, options: ErrorTypes.Options);
|
|
8
|
+
static is(error: unknown, code?: ErrorTypes.Code): error is ResolverError;
|
|
9
|
+
}
|