@living-architecture/riviere-cli 0.2.2 → 0.2.4
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/bin.js +24428 -0
- package/dist/index.js +24444 -7
- package/package.json +5 -5
- package/dist/cli.d.ts +0 -8
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -65
- package/dist/command-test-fixtures.d.ts +0 -110
- package/dist/command-test-fixtures.d.ts.map +0 -1
- package/dist/command-test-fixtures.js +0 -184
- package/dist/commands/builder/add-component.d.ts +0 -4
- package/dist/commands/builder/add-component.d.ts.map +0 -1
- package/dist/commands/builder/add-component.js +0 -204
- package/dist/commands/builder/add-domain.d.ts +0 -3
- package/dist/commands/builder/add-domain.d.ts.map +0 -1
- package/dist/commands/builder/add-domain.js +0 -56
- package/dist/commands/builder/add-source.d.ts +0 -3
- package/dist/commands/builder/add-source.d.ts.map +0 -1
- package/dist/commands/builder/add-source.js +0 -28
- package/dist/commands/builder/check-consistency.d.ts +0 -3
- package/dist/commands/builder/check-consistency.d.ts.map +0 -1
- package/dist/commands/builder/check-consistency.js +0 -27
- package/dist/commands/builder/component-checklist.d.ts +0 -3
- package/dist/commands/builder/component-checklist.d.ts.map +0 -1
- package/dist/commands/builder/component-checklist.js +0 -43
- package/dist/commands/builder/component-summary.d.ts +0 -3
- package/dist/commands/builder/component-summary.d.ts.map +0 -1
- package/dist/commands/builder/component-summary.js +0 -23
- package/dist/commands/builder/enrich.d.ts +0 -3
- package/dist/commands/builder/enrich.d.ts.map +0 -1
- package/dist/commands/builder/enrich.js +0 -85
- package/dist/commands/builder/finalize.d.ts +0 -3
- package/dist/commands/builder/finalize.d.ts.map +0 -1
- package/dist/commands/builder/finalize.js +0 -37
- package/dist/commands/builder/init.d.ts +0 -3
- package/dist/commands/builder/init.d.ts.map +0 -1
- package/dist/commands/builder/init.js +0 -100
- package/dist/commands/builder/link-external.d.ts +0 -3
- package/dist/commands/builder/link-external.d.ts.map +0 -1
- package/dist/commands/builder/link-external.js +0 -70
- package/dist/commands/builder/link-http.d.ts +0 -3
- package/dist/commands/builder/link-http.d.ts.map +0 -1
- package/dist/commands/builder/link-http.js +0 -130
- package/dist/commands/builder/link-infrastructure.d.ts +0 -7
- package/dist/commands/builder/link-infrastructure.d.ts.map +0 -1
- package/dist/commands/builder/link-infrastructure.js +0 -41
- package/dist/commands/builder/link.d.ts +0 -3
- package/dist/commands/builder/link.d.ts.map +0 -1
- package/dist/commands/builder/link.js +0 -73
- package/dist/commands/builder/validate.d.ts +0 -3
- package/dist/commands/builder/validate.d.ts.map +0 -1
- package/dist/commands/builder/validate.js +0 -29
- package/dist/commands/query/component-output.d.ts +0 -9
- package/dist/commands/query/component-output.d.ts.map +0 -1
- package/dist/commands/query/component-output.js +0 -8
- package/dist/commands/query/components.d.ts +0 -3
- package/dist/commands/query/components.d.ts.map +0 -1
- package/dist/commands/query/components.js +0 -45
- package/dist/commands/query/domains.d.ts +0 -3
- package/dist/commands/query/domains.d.ts.map +0 -1
- package/dist/commands/query/domains.js +0 -22
- package/dist/commands/query/entry-points.d.ts +0 -3
- package/dist/commands/query/entry-points.d.ts.map +0 -1
- package/dist/commands/query/entry-points.js +0 -22
- package/dist/commands/query/load-graph.d.ts +0 -16
- package/dist/commands/query/load-graph.d.ts.map +0 -1
- package/dist/commands/query/load-graph.js +0 -50
- package/dist/commands/query/orphans.d.ts +0 -3
- package/dist/commands/query/orphans.d.ts.map +0 -1
- package/dist/commands/query/orphans.js +0 -22
- package/dist/commands/query/search.d.ts +0 -3
- package/dist/commands/query/search.d.ts.map +0 -1
- package/dist/commands/query/search.js +0 -25
- package/dist/commands/query/trace.d.ts +0 -3
- package/dist/commands/query/trace.d.ts.map +0 -1
- package/dist/commands/query/trace.js +0 -41
- package/dist/component-types.d.ts +0 -15
- package/dist/component-types.d.ts.map +0 -1
- package/dist/component-types.js +0 -39
- package/dist/error-codes.d.ts +0 -15
- package/dist/error-codes.d.ts.map +0 -1
- package/dist/error-codes.js +0 -15
- package/dist/file-existence.d.ts +0 -2
- package/dist/file-existence.d.ts.map +0 -1
- package/dist/file-existence.js +0 -16
- package/dist/graph-path.d.ts +0 -3
- package/dist/graph-path.d.ts.map +0 -1
- package/dist/graph-path.js +0 -8
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +0 -1
- package/dist/output.d.ts +0 -17
- package/dist/output.d.ts.map +0 -1
- package/dist/output.js +0 -7
- package/dist/validation.d.ts +0 -12
- package/dist/validation.d.ts.map +0 -1
- package/dist/validation.js +0 -51
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const VALID_COMPONENT_TYPES: readonly ["UI", "API", "UseCase", "DomainOp", "Event", "EventHandler", "Custom"];
|
|
2
|
-
export type ComponentTypeFlag = (typeof VALID_COMPONENT_TYPES)[number];
|
|
3
|
-
export declare function isValidComponentType(value: string): value is ComponentTypeFlag;
|
|
4
|
-
export declare function normalizeToSchemaComponentType(value: string): ComponentTypeFlag;
|
|
5
|
-
export declare function normalizeComponentType(value: string): string;
|
|
6
|
-
export declare const VALID_SYSTEM_TYPES: readonly ["domain", "bff", "ui", "other"];
|
|
7
|
-
export type SystemTypeFlag = (typeof VALID_SYSTEM_TYPES)[number];
|
|
8
|
-
export declare function isValidSystemType(value: string): value is SystemTypeFlag;
|
|
9
|
-
export declare const VALID_API_TYPES: readonly ["REST", "GraphQL", "other"];
|
|
10
|
-
export type ApiTypeFlag = (typeof VALID_API_TYPES)[number];
|
|
11
|
-
export declare function isValidApiType(value: string): value is ApiTypeFlag;
|
|
12
|
-
export declare const VALID_LINK_TYPES: readonly ["sync", "async"];
|
|
13
|
-
export type LinkType = (typeof VALID_LINK_TYPES)[number];
|
|
14
|
-
export declare function isValidLinkType(value: string): value is LinkType;
|
|
15
|
-
//# sourceMappingURL=component-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-types.d.ts","sourceRoot":"","sources":["../src/component-types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,kFAAmF,CAAC;AACtH,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,iBAAiB,CAE9E;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAQ/E;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAe5D;AAED,eAAO,MAAM,kBAAkB,2CAA4C,CAAC;AAC5E,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,cAAc,CAExE;AAED,eAAO,MAAM,eAAe,uCAAwC,CAAC;AACrE,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,WAAW,CAElE;AAED,eAAO,MAAM,gBAAgB,4BAA6B,CAAC;AAC3D,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,QAAQ,CAEhE"}
|
package/dist/component-types.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export const VALID_COMPONENT_TYPES = ['UI', 'API', 'UseCase', 'DomainOp', 'Event', 'EventHandler', 'Custom'];
|
|
2
|
-
export function isValidComponentType(value) {
|
|
3
|
-
return VALID_COMPONENT_TYPES.some((t) => t.toLowerCase() === value.toLowerCase());
|
|
4
|
-
}
|
|
5
|
-
export function normalizeToSchemaComponentType(value) {
|
|
6
|
-
const found = VALID_COMPONENT_TYPES.find((t) => t.toLowerCase() === value.toLowerCase());
|
|
7
|
-
if (found === undefined) {
|
|
8
|
-
throw new Error(`Expected valid ComponentType. Got: ${value}. Valid types: ${VALID_COMPONENT_TYPES.join(', ')}`);
|
|
9
|
-
}
|
|
10
|
-
return found;
|
|
11
|
-
}
|
|
12
|
-
export function normalizeComponentType(value) {
|
|
13
|
-
const typeMap = {
|
|
14
|
-
ui: 'ui',
|
|
15
|
-
api: 'api',
|
|
16
|
-
usecase: 'usecase',
|
|
17
|
-
domainop: 'domainop',
|
|
18
|
-
event: 'event',
|
|
19
|
-
eventhandler: 'eventhandler',
|
|
20
|
-
custom: 'custom',
|
|
21
|
-
};
|
|
22
|
-
const normalized = typeMap[value.toLowerCase()];
|
|
23
|
-
if (normalized === undefined) {
|
|
24
|
-
throw new Error(`Invalid component type: ${value}. Valid types: ${Object.keys(typeMap).join(', ')}`);
|
|
25
|
-
}
|
|
26
|
-
return normalized;
|
|
27
|
-
}
|
|
28
|
-
export const VALID_SYSTEM_TYPES = ['domain', 'bff', 'ui', 'other'];
|
|
29
|
-
export function isValidSystemType(value) {
|
|
30
|
-
return VALID_SYSTEM_TYPES.some((t) => t === value);
|
|
31
|
-
}
|
|
32
|
-
export const VALID_API_TYPES = ['REST', 'GraphQL', 'other'];
|
|
33
|
-
export function isValidApiType(value) {
|
|
34
|
-
return VALID_API_TYPES.some((t) => t.toLowerCase() === value.toLowerCase());
|
|
35
|
-
}
|
|
36
|
-
export const VALID_LINK_TYPES = ['sync', 'async'];
|
|
37
|
-
export function isValidLinkType(value) {
|
|
38
|
-
return VALID_LINK_TYPES.some((t) => t === value);
|
|
39
|
-
}
|
package/dist/error-codes.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare enum CliErrorCode {
|
|
2
|
-
GraphNotFound = "GRAPH_NOT_FOUND",
|
|
3
|
-
ComponentNotFound = "COMPONENT_NOT_FOUND",
|
|
4
|
-
DomainNotFound = "DOMAIN_NOT_FOUND",
|
|
5
|
-
CustomTypeNotFound = "CUSTOM_TYPE_NOT_FOUND",
|
|
6
|
-
DuplicateComponent = "DUPLICATE_COMPONENT",
|
|
7
|
-
DuplicateDomain = "DUPLICATE_DOMAIN",
|
|
8
|
-
InvalidLink = "INVALID_LINK",
|
|
9
|
-
InvalidComponentType = "INVALID_COMPONENT_TYPE",
|
|
10
|
-
ValidationError = "VALIDATION_ERROR",
|
|
11
|
-
GraphCorrupted = "GRAPH_CORRUPTED",
|
|
12
|
-
GraphExists = "GRAPH_EXISTS",
|
|
13
|
-
AmbiguousApiMatch = "AMBIGUOUS_API_MATCH"
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=error-codes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY;IACtB,aAAa,oBAAoB;IACjC,iBAAiB,wBAAwB;IACzC,cAAc,qBAAqB;IACnC,kBAAkB,0BAA0B;IAC5C,kBAAkB,wBAAwB;IAC1C,eAAe,qBAAqB;IACpC,WAAW,iBAAiB;IAC5B,oBAAoB,2BAA2B;IAC/C,eAAe,qBAAqB;IACpC,cAAc,oBAAoB;IAClC,WAAW,iBAAiB;IAC5B,iBAAiB,wBAAwB;CAC1C"}
|
package/dist/error-codes.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export var CliErrorCode;
|
|
2
|
-
(function (CliErrorCode) {
|
|
3
|
-
CliErrorCode["GraphNotFound"] = "GRAPH_NOT_FOUND";
|
|
4
|
-
CliErrorCode["ComponentNotFound"] = "COMPONENT_NOT_FOUND";
|
|
5
|
-
CliErrorCode["DomainNotFound"] = "DOMAIN_NOT_FOUND";
|
|
6
|
-
CliErrorCode["CustomTypeNotFound"] = "CUSTOM_TYPE_NOT_FOUND";
|
|
7
|
-
CliErrorCode["DuplicateComponent"] = "DUPLICATE_COMPONENT";
|
|
8
|
-
CliErrorCode["DuplicateDomain"] = "DUPLICATE_DOMAIN";
|
|
9
|
-
CliErrorCode["InvalidLink"] = "INVALID_LINK";
|
|
10
|
-
CliErrorCode["InvalidComponentType"] = "INVALID_COMPONENT_TYPE";
|
|
11
|
-
CliErrorCode["ValidationError"] = "VALIDATION_ERROR";
|
|
12
|
-
CliErrorCode["GraphCorrupted"] = "GRAPH_CORRUPTED";
|
|
13
|
-
CliErrorCode["GraphExists"] = "GRAPH_EXISTS";
|
|
14
|
-
CliErrorCode["AmbiguousApiMatch"] = "AMBIGUOUS_API_MATCH";
|
|
15
|
-
})(CliErrorCode || (CliErrorCode = {}));
|
package/dist/file-existence.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-existence.d.ts","sourceRoot":"","sources":["../src/file-existence.ts"],"names":[],"mappings":"AAUA,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAU/D"}
|
package/dist/file-existence.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { access } from 'node:fs/promises';
|
|
2
|
-
function isNodeError(error) {
|
|
3
|
-
return error instanceof Error && 'code' in error;
|
|
4
|
-
}
|
|
5
|
-
export async function fileExists(path) {
|
|
6
|
-
try {
|
|
7
|
-
await access(path);
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
catch (error) {
|
|
11
|
-
if (isNodeError(error) && error.code === 'ENOENT') {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
throw error;
|
|
15
|
-
}
|
|
16
|
-
}
|
package/dist/graph-path.d.ts
DELETED
package/dist/graph-path.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph-path.d.ts","sourceRoot":"","sources":["../src/graph-path.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,wBAAgB,8BAA8B,IAAI,MAAM,CAEvD"}
|
package/dist/graph-path.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
|
-
const DEFAULT_GRAPH_PATH = '.riviere/graph.json';
|
|
3
|
-
export function resolveGraphPath(customPath) {
|
|
4
|
-
return customPath ?? join(process.cwd(), DEFAULT_GRAPH_PATH);
|
|
5
|
-
}
|
|
6
|
-
export function getDefaultGraphPathDescription() {
|
|
7
|
-
return `Custom graph file path (default: ${DEFAULT_GRAPH_PATH})`;
|
|
8
|
-
}
|
package/dist/index.d.ts
DELETED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC"}
|
package/dist/output.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { CliErrorCode } from './error-codes';
|
|
2
|
-
export interface SuccessOutput<T> {
|
|
3
|
-
success: true;
|
|
4
|
-
data: T;
|
|
5
|
-
warnings: string[];
|
|
6
|
-
}
|
|
7
|
-
export interface ErrorOutput {
|
|
8
|
-
success: false;
|
|
9
|
-
error: {
|
|
10
|
-
code: string;
|
|
11
|
-
message: string;
|
|
12
|
-
suggestions: string[];
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export declare function formatSuccess<T>(data: T, warnings?: string[]): SuccessOutput<T>;
|
|
16
|
-
export declare function formatError(code: CliErrorCode, message: string, suggestions?: string[]): ErrorOutput;
|
|
17
|
-
//# sourceMappingURL=output.d.ts.map
|
package/dist/output.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,CAAC,CAAC;IACR,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB,CAAC;CACH;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,GAAE,MAAM,EAAO,GAAG,aAAa,CAAC,CAAC,CAAC,CAEnF;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,MAAM,EACf,WAAW,GAAE,MAAM,EAAO,GACzB,WAAW,CAEb"}
|
package/dist/output.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CliErrorCode } from './error-codes';
|
|
2
|
-
export function formatSuccess(data, warnings = []) {
|
|
3
|
-
return { success: true, data, warnings };
|
|
4
|
-
}
|
|
5
|
-
export function formatError(code, message, suggestions = []) {
|
|
6
|
-
return { success: false, error: { code, message, suggestions } };
|
|
7
|
-
}
|
package/dist/validation.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { HttpMethod } from '@living-architecture/riviere-schema';
|
|
2
|
-
export interface ValidationResult {
|
|
3
|
-
valid: boolean;
|
|
4
|
-
errorJson?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare function validateComponentType(componentType: string): ValidationResult;
|
|
7
|
-
export declare function validateLinkType(linkType: string | undefined): ValidationResult;
|
|
8
|
-
export declare function validateSystemType(systemType: string): ValidationResult;
|
|
9
|
-
export declare const VALID_HTTP_METHODS: readonly HttpMethod[];
|
|
10
|
-
export declare function isValidHttpMethod(value: string): value is HttpMethod;
|
|
11
|
-
export declare function validateHttpMethod(method: string | undefined): ValidationResult;
|
|
12
|
-
//# sourceMappingURL=validation.d.ts.map
|
package/dist/validation.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAYtE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,gBAAgB,CAa7E;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,gBAAgB,CAa/E;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAavE;AAED,eAAO,MAAM,kBAAkB,EAAE,SAAS,UAAU,EAAiE,CAAC;AAEtH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,UAAU,CAEpE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,gBAAgB,CAa/E"}
|
package/dist/validation.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { isValidComponentType, isValidLinkType, isValidSystemType, VALID_COMPONENT_TYPES, VALID_LINK_TYPES, VALID_SYSTEM_TYPES, } from './component-types';
|
|
2
|
-
import { formatError } from './output';
|
|
3
|
-
import { CliErrorCode } from './error-codes';
|
|
4
|
-
export function validateComponentType(componentType) {
|
|
5
|
-
if (isValidComponentType(componentType)) {
|
|
6
|
-
return { valid: true };
|
|
7
|
-
}
|
|
8
|
-
return {
|
|
9
|
-
valid: false,
|
|
10
|
-
errorJson: JSON.stringify(formatError(CliErrorCode.ValidationError, `Invalid component type: ${componentType}`, [
|
|
11
|
-
`Valid types: ${VALID_COMPONENT_TYPES.join(', ')}`,
|
|
12
|
-
])),
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export function validateLinkType(linkType) {
|
|
16
|
-
if (linkType === undefined || isValidLinkType(linkType)) {
|
|
17
|
-
return { valid: true };
|
|
18
|
-
}
|
|
19
|
-
return {
|
|
20
|
-
valid: false,
|
|
21
|
-
errorJson: JSON.stringify(formatError(CliErrorCode.ValidationError, `Invalid link type: ${linkType}`, [
|
|
22
|
-
`Valid types: ${VALID_LINK_TYPES.join(', ')}`,
|
|
23
|
-
])),
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export function validateSystemType(systemType) {
|
|
27
|
-
if (isValidSystemType(systemType)) {
|
|
28
|
-
return { valid: true };
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
valid: false,
|
|
32
|
-
errorJson: JSON.stringify(formatError(CliErrorCode.ValidationError, `Invalid system type: ${systemType}`, [
|
|
33
|
-
`Valid types: ${VALID_SYSTEM_TYPES.join(', ')}`,
|
|
34
|
-
])),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export const VALID_HTTP_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'];
|
|
38
|
-
export function isValidHttpMethod(value) {
|
|
39
|
-
return VALID_HTTP_METHODS.some((m) => m === value.toUpperCase());
|
|
40
|
-
}
|
|
41
|
-
export function validateHttpMethod(method) {
|
|
42
|
-
if (method === undefined || isValidHttpMethod(method)) {
|
|
43
|
-
return { valid: true };
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
valid: false,
|
|
47
|
-
errorJson: JSON.stringify(formatError(CliErrorCode.ValidationError, `Invalid HTTP method: ${method}`, [
|
|
48
|
-
`Valid methods: ${VALID_HTTP_METHODS.join(', ')}`,
|
|
49
|
-
])),
|
|
50
|
-
};
|
|
51
|
-
}
|