@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/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,7 @@
1
+ export declare const envConfig: {
2
+ readonly env: string | undefined;
3
+ readonly baseUrl: string | undefined;
4
+ readonly apiKey: string | undefined;
5
+ readonly username: string | undefined;
6
+ readonly password: string | undefined;
7
+ };
@@ -0,0 +1,4 @@
1
+ export declare const EXIT_FAILURE = 1;
2
+ export declare const ARGS_OFFSET = 2;
3
+ export declare const FLAG_PREFIX = "--";
4
+ export declare const NEGATIVE_FLAG_PREFIX = "--no-";
@@ -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,4 @@
1
+ export declare const DOCUMENT_PATH_SEPARATOR = ".";
2
+ export declare const DOCUMENT_VALUE_KEY_SEPARATOR = ":";
3
+ export declare const DOCUMENT_MAX_ALIAS_DEPTH = 20;
4
+ export declare const DOCUMENT_ALIAS_VALUE_GROUP = 1;
@@ -0,0 +1,4 @@
1
+ export declare const httpHeaders: {
2
+ readonly authorization: "authorization";
3
+ readonly apiKey: "x-api-key";
4
+ };
@@ -0,0 +1,6 @@
1
+ export declare const regularExpressions: {
2
+ readonly trailingSlashes: RegExp;
3
+ readonly leadingSlashes: RegExp;
4
+ readonly kebabSegment: RegExp;
5
+ readonly dtcgAlias: RegExp;
6
+ };
@@ -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,6 @@
1
+ import { ConfigTypes } from '../types/config.types';
2
+ export default class ConfigResolver {
3
+ static withDefaults(config: ConfigTypes.Config): ConfigTypes.Resolved;
4
+ static toBaseUrl(config: ConfigTypes.Config): string;
5
+ private static validateAuth;
6
+ }
@@ -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
+ }