codika 3.1.0 → 3.2.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/cli/commands/config/set.js +1 -1
- package/dist/cli/commands/config/set.js.map +1 -1
- package/dist/cli/commands/get/index.d.ts +1 -0
- package/dist/cli/commands/get/index.d.ts.map +1 -1
- package/dist/cli/commands/get/index.js +3 -0
- package/dist/cli/commands/get/index.js.map +1 -1
- package/dist/cli/commands/get/instance.d.ts +9 -0
- package/dist/cli/commands/get/instance.d.ts.map +1 -0
- package/dist/cli/commands/get/instance.js +173 -0
- package/dist/cli/commands/get/instance.js.map +1 -0
- package/dist/cli/commands/organization/create-key.d.ts +8 -0
- package/dist/cli/commands/organization/create-key.d.ts.map +1 -0
- package/dist/cli/commands/organization/create-key.js +124 -0
- package/dist/cli/commands/organization/create-key.js.map +1 -0
- package/dist/cli/commands/organization/create.d.ts +8 -0
- package/dist/cli/commands/organization/create.d.ts.map +1 -0
- package/dist/cli/commands/organization/create.js +122 -0
- package/dist/cli/commands/organization/create.js.map +1 -0
- package/dist/cli/commands/organization/index.d.ts +12 -0
- package/dist/cli/commands/organization/index.d.ts.map +1 -0
- package/dist/cli/commands/organization/index.js +17 -0
- package/dist/cli/commands/organization/index.js.map +1 -0
- package/dist/cli/commands/use.d.ts.map +1 -1
- package/dist/cli/commands/use.js +4 -2
- package/dist/cli/commands/use.js.map +1 -1
- package/dist/cli/commands/whoami.d.ts.map +1 -1
- package/dist/cli/commands/whoami.js +6 -4
- package/dist/cli/commands/whoami.js.map +1 -1
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +4 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/templates/config-template.js +1 -1
- package/dist/cli/templates/workflow-templates.d.ts +1 -1
- package/dist/cli/templates/workflow-templates.js +1 -1
- package/dist/cli/templates/workflow-templates.js.map +1 -1
- package/dist/types/process-types.d.ts +1 -1
- package/dist/types/process-types.d.ts.map +1 -1
- package/dist/utils/config.d.ts +4 -1
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +16 -1
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/get-instance-client.d.ts +53 -0
- package/dist/utils/get-instance-client.d.ts.map +1 -0
- package/dist/utils/get-instance-client.js +52 -0
- package/dist/utils/get-instance-client.js.map +1 -0
- package/dist/utils/org-api-key-client.d.ts +78 -0
- package/dist/utils/org-api-key-client.d.ts.map +1 -0
- package/dist/utils/org-api-key-client.js +62 -0
- package/dist/utils/org-api-key-client.js.map +1 -0
- package/dist/utils/organization-client.d.ts +80 -0
- package/dist/utils/organization-client.d.ts.map +1 -0
- package/dist/utils/organization-client.js +78 -0
- package/dist/utils/organization-client.js.map +1 -0
- package/dist/utils/skills-client.js +2 -2
- package/dist/utils/skills-client.js.map +1 -1
- package/dist/validation/use-case-scripts/index.d.ts +2 -0
- package/dist/validation/use-case-scripts/index.d.ts.map +1 -1
- package/dist/validation/use-case-scripts/index.js +6 -0
- package/dist/validation/use-case-scripts/index.js.map +1 -1
- package/dist/validation/use-case-scripts/input-schema-format.d.ts +19 -0
- package/dist/validation/use-case-scripts/input-schema-format.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/input-schema-format.js +116 -0
- package/dist/validation/use-case-scripts/input-schema-format.js.map +1 -0
- package/dist/validation/use-case-scripts/schedule-trigger-fields.d.ts +22 -0
- package/dist/validation/use-case-scripts/schedule-trigger-fields.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/schedule-trigger-fields.js +140 -0
- package/dist/validation/use-case-scripts/schedule-trigger-fields.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Organization API Key Client
|
|
3
|
+
* HTTP client for creating organization API keys on the Codika platform
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Options for creating an organization API key
|
|
7
|
+
*/
|
|
8
|
+
export interface CreateOrganizationApiKeyOptions {
|
|
9
|
+
/** Organization ID to create the key for */
|
|
10
|
+
organizationId: string;
|
|
11
|
+
/** Key name */
|
|
12
|
+
name: string;
|
|
13
|
+
/** Optional description */
|
|
14
|
+
description?: string;
|
|
15
|
+
/** Scopes to grant (e.g. ['deploy:use-case', 'projects:create']) */
|
|
16
|
+
scopes: string[];
|
|
17
|
+
/** Optional expiry in days */
|
|
18
|
+
expiresInDays?: number;
|
|
19
|
+
/** API URL for the createOrganizationApiKeyPublic endpoint */
|
|
20
|
+
apiUrl: string;
|
|
21
|
+
/** API key (admin or personal key) */
|
|
22
|
+
apiKey: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Success response from organization API key creation
|
|
26
|
+
*/
|
|
27
|
+
export interface CreateOrganizationApiKeySuccessResponse {
|
|
28
|
+
success: true;
|
|
29
|
+
data: {
|
|
30
|
+
keyId: string;
|
|
31
|
+
apiKey: string;
|
|
32
|
+
keyPrefix: string;
|
|
33
|
+
name: string;
|
|
34
|
+
scopes: string[];
|
|
35
|
+
createdAt: string;
|
|
36
|
+
expiresAt?: string;
|
|
37
|
+
};
|
|
38
|
+
requestId: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Error response from organization API key creation
|
|
42
|
+
*/
|
|
43
|
+
export interface CreateOrganizationApiKeyErrorResponse {
|
|
44
|
+
success: false;
|
|
45
|
+
error: {
|
|
46
|
+
message: string;
|
|
47
|
+
};
|
|
48
|
+
requestId: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Combined response type
|
|
52
|
+
*/
|
|
53
|
+
export type CreateOrganizationApiKeyResponse = CreateOrganizationApiKeySuccessResponse | CreateOrganizationApiKeyErrorResponse;
|
|
54
|
+
/**
|
|
55
|
+
* Type guard for success response
|
|
56
|
+
*/
|
|
57
|
+
export declare function isCreateOrganizationApiKeySuccess(response: CreateOrganizationApiKeyResponse): response is CreateOrganizationApiKeySuccessResponse;
|
|
58
|
+
/**
|
|
59
|
+
* Type guard for error response
|
|
60
|
+
*/
|
|
61
|
+
export declare function isCreateOrganizationApiKeyError(response: CreateOrganizationApiKeyResponse): response is CreateOrganizationApiKeyErrorResponse;
|
|
62
|
+
/**
|
|
63
|
+
* Create an organization API key on the Codika platform
|
|
64
|
+
*
|
|
65
|
+
* @param options - Key creation options
|
|
66
|
+
* @returns Key creation result
|
|
67
|
+
*/
|
|
68
|
+
export declare function createOrganizationApiKey(options: CreateOrganizationApiKeyOptions): Promise<CreateOrganizationApiKeyResponse>;
|
|
69
|
+
/**
|
|
70
|
+
* Create an organization API key and throw on error
|
|
71
|
+
* Convenience function for when you want exceptions on failure
|
|
72
|
+
*
|
|
73
|
+
* @param options - Key creation options
|
|
74
|
+
* @returns Success response with key details
|
|
75
|
+
* @throws Error if creation fails
|
|
76
|
+
*/
|
|
77
|
+
export declare function createOrganizationApiKeyOrThrow(options: CreateOrganizationApiKeyOptions): Promise<CreateOrganizationApiKeySuccessResponse>;
|
|
78
|
+
//# sourceMappingURL=org-api-key-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-api-key-client.d.ts","sourceRoot":"","sources":["../../src/utils/org-api-key-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,4CAA4C;IAC5C,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe;IACf,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,8BAA8B;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,uCAAuC;IACtD,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,qCAAqC;IACpD,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,gCAAgC,GACxC,uCAAuC,GACvC,qCAAqC,CAAC;AAE1C;;GAEG;AACH,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,gCAAgC,GACzC,QAAQ,IAAI,uCAAuC,CAErD;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,gCAAgC,GACzC,QAAQ,IAAI,qCAAqC,CAEnD;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,gCAAgC,CAAC,CAqC3C;AAED;;;;;;;GAOG;AACH,wBAAsB,+BAA+B,CACnD,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,uCAAuC,CAAC,CAUlD"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Organization API Key Client
|
|
3
|
+
* HTTP client for creating organization API keys on the Codika platform
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Type guard for success response
|
|
7
|
+
*/
|
|
8
|
+
export function isCreateOrganizationApiKeySuccess(response) {
|
|
9
|
+
return response.success === true;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Type guard for error response
|
|
13
|
+
*/
|
|
14
|
+
export function isCreateOrganizationApiKeyError(response) {
|
|
15
|
+
return response.success === false;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Create an organization API key on the Codika platform
|
|
19
|
+
*
|
|
20
|
+
* @param options - Key creation options
|
|
21
|
+
* @returns Key creation result
|
|
22
|
+
*/
|
|
23
|
+
export async function createOrganizationApiKey(options) {
|
|
24
|
+
const { organizationId, name, description, scopes, expiresInDays, apiKey, apiUrl, } = options;
|
|
25
|
+
const requestBody = {
|
|
26
|
+
organizationId,
|
|
27
|
+
name,
|
|
28
|
+
scopes,
|
|
29
|
+
};
|
|
30
|
+
if (description) {
|
|
31
|
+
requestBody.description = description;
|
|
32
|
+
}
|
|
33
|
+
if (expiresInDays !== undefined) {
|
|
34
|
+
requestBody.expiresInDays = expiresInDays;
|
|
35
|
+
}
|
|
36
|
+
const response = await fetch(apiUrl, {
|
|
37
|
+
method: 'POST',
|
|
38
|
+
headers: {
|
|
39
|
+
'Content-Type': 'application/json',
|
|
40
|
+
'X-Process-Manager-Key': apiKey,
|
|
41
|
+
},
|
|
42
|
+
body: JSON.stringify(requestBody),
|
|
43
|
+
});
|
|
44
|
+
const result = (await response.json());
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create an organization API key and throw on error
|
|
49
|
+
* Convenience function for when you want exceptions on failure
|
|
50
|
+
*
|
|
51
|
+
* @param options - Key creation options
|
|
52
|
+
* @returns Success response with key details
|
|
53
|
+
* @throws Error if creation fails
|
|
54
|
+
*/
|
|
55
|
+
export async function createOrganizationApiKeyOrThrow(options) {
|
|
56
|
+
const result = await createOrganizationApiKey(options);
|
|
57
|
+
if (isCreateOrganizationApiKeyError(result)) {
|
|
58
|
+
throw new Error(`Organization API key creation failed: ${result.error.message}`);
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=org-api-key-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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AI,+BAA+B,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CACb,yCAAyC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAChE,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Organization Client
|
|
3
|
+
* HTTP client for creating organizations on the Codika platform via API key
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Options for creating an organization
|
|
7
|
+
*/
|
|
8
|
+
export interface CreateOrganizationOptions {
|
|
9
|
+
/** Organization name */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Optional description */
|
|
12
|
+
description?: string;
|
|
13
|
+
/** Optional organization size */
|
|
14
|
+
size?: string;
|
|
15
|
+
/** Optional logo URL (existing HTTPS URL) */
|
|
16
|
+
logoUrl?: string;
|
|
17
|
+
/** Optional logo as base64-encoded string (uploaded to platform storage by the API) */
|
|
18
|
+
logoBase64?: string;
|
|
19
|
+
/** MIME type of the base64 logo (defaults to image/png) */
|
|
20
|
+
logoMimeType?: string;
|
|
21
|
+
/** Optional self-hosted n8n base URL */
|
|
22
|
+
n8nBaseUrl?: string;
|
|
23
|
+
/** Optional self-hosted n8n API key */
|
|
24
|
+
n8nApiKey?: string;
|
|
25
|
+
/** Whether to store credential copies (self-hosted n8n only) */
|
|
26
|
+
storeCredentialCopy?: boolean;
|
|
27
|
+
/** API URL for the createOrganizationViaApiKey endpoint */
|
|
28
|
+
apiUrl: string;
|
|
29
|
+
/** API key (organization API key or admin key) */
|
|
30
|
+
apiKey: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Success response from organization creation
|
|
34
|
+
*/
|
|
35
|
+
export interface CreateOrganizationSuccessResponse {
|
|
36
|
+
success: true;
|
|
37
|
+
data: {
|
|
38
|
+
organizationId: string;
|
|
39
|
+
};
|
|
40
|
+
requestId: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Error response from organization creation
|
|
44
|
+
*/
|
|
45
|
+
export interface CreateOrganizationErrorResponse {
|
|
46
|
+
success: false;
|
|
47
|
+
error: {
|
|
48
|
+
message: string;
|
|
49
|
+
};
|
|
50
|
+
requestId: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Combined response type
|
|
54
|
+
*/
|
|
55
|
+
export type CreateOrganizationResponse = CreateOrganizationSuccessResponse | CreateOrganizationErrorResponse;
|
|
56
|
+
/**
|
|
57
|
+
* Type guard for success response
|
|
58
|
+
*/
|
|
59
|
+
export declare function isCreateOrganizationSuccess(response: CreateOrganizationResponse): response is CreateOrganizationSuccessResponse;
|
|
60
|
+
/**
|
|
61
|
+
* Type guard for error response
|
|
62
|
+
*/
|
|
63
|
+
export declare function isCreateOrganizationError(response: CreateOrganizationResponse): response is CreateOrganizationErrorResponse;
|
|
64
|
+
/**
|
|
65
|
+
* Create an organization on the Codika platform
|
|
66
|
+
*
|
|
67
|
+
* @param options - Organization creation options
|
|
68
|
+
* @returns Organization creation result
|
|
69
|
+
*/
|
|
70
|
+
export declare function createOrganization(options: CreateOrganizationOptions): Promise<CreateOrganizationResponse>;
|
|
71
|
+
/**
|
|
72
|
+
* Create an organization and throw on error
|
|
73
|
+
* Convenience function for when you want exceptions on failure
|
|
74
|
+
*
|
|
75
|
+
* @param options - Organization creation options
|
|
76
|
+
* @returns Success response with organization ID
|
|
77
|
+
* @throws Error if creation fails
|
|
78
|
+
*/
|
|
79
|
+
export declare function createOrganizationOrThrow(options: CreateOrganizationOptions): Promise<CreateOrganizationSuccessResponse>;
|
|
80
|
+
//# sourceMappingURL=organization-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization-client.d.ts","sourceRoot":"","sources":["../../src/utils/organization-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,wBAAwB;IACxB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;;;GAOG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,iCAAiC,CAAC,CAU5C"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Organization Client
|
|
3
|
+
* HTTP client for creating organizations on the Codika platform via API key
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Type guard for success response
|
|
7
|
+
*/
|
|
8
|
+
export function isCreateOrganizationSuccess(response) {
|
|
9
|
+
return response.success === true;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Type guard for error response
|
|
13
|
+
*/
|
|
14
|
+
export function isCreateOrganizationError(response) {
|
|
15
|
+
return response.success === false;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Create an organization on the Codika platform
|
|
19
|
+
*
|
|
20
|
+
* @param options - Organization creation options
|
|
21
|
+
* @returns Organization creation result
|
|
22
|
+
*/
|
|
23
|
+
export async function createOrganization(options) {
|
|
24
|
+
const { name, description, size, logoUrl, logoBase64, logoMimeType, n8nBaseUrl, n8nApiKey, storeCredentialCopy, apiKey, apiUrl, } = options;
|
|
25
|
+
const requestBody = {
|
|
26
|
+
name,
|
|
27
|
+
};
|
|
28
|
+
if (description) {
|
|
29
|
+
requestBody.description = description;
|
|
30
|
+
}
|
|
31
|
+
if (size) {
|
|
32
|
+
requestBody.size = size;
|
|
33
|
+
}
|
|
34
|
+
if (logoUrl) {
|
|
35
|
+
requestBody.logoUrl = logoUrl;
|
|
36
|
+
}
|
|
37
|
+
if (logoBase64) {
|
|
38
|
+
requestBody.logoBase64 = logoBase64;
|
|
39
|
+
if (logoMimeType) {
|
|
40
|
+
requestBody.logoMimeType = logoMimeType;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (n8nBaseUrl) {
|
|
44
|
+
requestBody.n8nBaseUrl = n8nBaseUrl;
|
|
45
|
+
}
|
|
46
|
+
if (n8nApiKey) {
|
|
47
|
+
requestBody.n8nApiKey = n8nApiKey;
|
|
48
|
+
}
|
|
49
|
+
if (storeCredentialCopy !== undefined) {
|
|
50
|
+
requestBody.storeCredentialCopy = storeCredentialCopy;
|
|
51
|
+
}
|
|
52
|
+
const response = await fetch(apiUrl, {
|
|
53
|
+
method: 'POST',
|
|
54
|
+
headers: {
|
|
55
|
+
'Content-Type': 'application/json',
|
|
56
|
+
'X-Process-Manager-Key': apiKey,
|
|
57
|
+
},
|
|
58
|
+
body: JSON.stringify(requestBody),
|
|
59
|
+
});
|
|
60
|
+
const result = (await response.json());
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Create an organization and throw on error
|
|
65
|
+
* Convenience function for when you want exceptions on failure
|
|
66
|
+
*
|
|
67
|
+
* @param options - Organization creation options
|
|
68
|
+
* @returns Success response with organization ID
|
|
69
|
+
* @throws Error if creation fails
|
|
70
|
+
*/
|
|
71
|
+
export async function createOrganizationOrThrow(options) {
|
|
72
|
+
const result = await createOrganization(options);
|
|
73
|
+
if (isCreateOrganizationError(result)) {
|
|
74
|
+
throw new Error(`Organization creation failed: ${result.error.message}`);
|
|
75
|
+
}
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=organization-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization-client.js","sourceRoot":"","sources":["../../src/utils/organization-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2DH;;GAEG;AACH,MAAM,UAAU,2BAA2B,CACzC,QAAoC;IAEpC,OAAO,QAAQ,CAAC,OAAO,KAAK,IAAI,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAAoC;IAEpC,OAAO,QAAQ,CAAC,OAAO,KAAK,KAAK,CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,OAAkC;IAElC,MAAM,EACJ,IAAI,E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CAAC,KAAK,UAAU,yBAAyB,CAC7C,OAAkC;IAElC,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAEjD,IAAI,yBAAyB,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CACb,iCAAiC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CACxD,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
export async function fetchSkills(options) {
|
|
11
11
|
const { processInstanceId, apiUrl, apiKey } = options;
|
|
12
12
|
const url = `${apiUrl}/${processInstanceId}`;
|
|
13
|
-
// Use X-Process-Manager-Key for org keys (cko_/cka_), X-API-Key for instance keys (ck_)
|
|
14
|
-
const headerName = apiKey.startsWith('ck_') && !apiKey.startsWith('cko_') && !apiKey.startsWith('cka_')
|
|
13
|
+
// Use X-Process-Manager-Key for org keys (cko_/cka_/ckp_), X-API-Key for instance keys (ck_)
|
|
14
|
+
const headerName = apiKey.startsWith('ck_') && !apiKey.startsWith('cko_') && !apiKey.startsWith('cka_') && !apiKey.startsWith('ckp_')
|
|
15
15
|
? 'X-API-Key'
|
|
16
16
|
: 'X-Process-Manager-Key';
|
|
17
17
|
const response = await fetch(url, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills-client.js","sourceRoot":"","sources":["../../src/utils/skills-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA+BH;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAA2B;IAC3D,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEtD,MAAM,GAAG,GAAG,GAAG,MAAM,IAAI,iBAAiB,EAAE,CAAC;IAE7C,
|
|
1
|
+
{"version":3,"file":"skills-client.js","sourceRoot":"","sources":["../../src/utils/skills-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA+BH;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAA2B;IAC3D,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEtD,MAAM,GAAG,GAAG,GAAG,MAAM,IAAI,iBAAiB,EAAE,CAAC;IAE7C,6FAA6F;IAC7F,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;QACnI,CAAC,CAAC,WAAW;QACb,CAAC,CAAC,uBAAuB,CAAC;IAE5B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAChC,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACP,CAAC,UAAU,CAAC,EAAE,MAAM;SACrB;KACF,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAwB,CAAC;IAC9D,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAA6B;IAE7B,OAAO,QAAQ,CAAC,OAAO,KAAK,IAAI,CAAC;AACnC,CAAC"}
|
|
@@ -24,4 +24,6 @@ export { checkTriggerTypeConsistency } from './trigger-type-consistency.js';
|
|
|
24
24
|
export { checkTriggerTypes } from './trigger-types.js';
|
|
25
25
|
export { checkSkillConsistency } from './skill-consistency.js';
|
|
26
26
|
export { checkCustomIntegrationSchema } from './custom-integration-schema.js';
|
|
27
|
+
export { checkInputSchemaFormat } from './input-schema-format.js';
|
|
28
|
+
export { checkScheduleTriggerFields } from './schedule-trigger-fields.js';
|
|
27
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/validation/use-case-scripts/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/validation/use-case-scripts/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAgBjD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,aAAa,EAezC,CAAC;AAGF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -16,6 +16,8 @@ import { checkTriggerTypeConsistency } from './trigger-type-consistency.js';
|
|
|
16
16
|
import { checkTriggerTypes } from './trigger-types.js';
|
|
17
17
|
import { checkSkillConsistency } from './skill-consistency.js';
|
|
18
18
|
import { checkCustomIntegrationSchema } from './custom-integration-schema.js';
|
|
19
|
+
import { checkInputSchemaFormat } from './input-schema-format.js';
|
|
20
|
+
import { checkScheduleTriggerFields } from './schedule-trigger-fields.js';
|
|
19
21
|
/**
|
|
20
22
|
* All use-case scripts to run during validation
|
|
21
23
|
*
|
|
@@ -35,6 +37,8 @@ export const useCaseScripts = [
|
|
|
35
37
|
checkTriggerTypes,
|
|
36
38
|
checkSkillConsistency,
|
|
37
39
|
checkCustomIntegrationSchema,
|
|
40
|
+
checkInputSchemaFormat,
|
|
41
|
+
checkScheduleTriggerFields,
|
|
38
42
|
];
|
|
39
43
|
// Re-export individual scripts
|
|
40
44
|
export { checkConfigExports } from './config-exports.js';
|
|
@@ -49,4 +53,6 @@ export { checkTriggerTypeConsistency } from './trigger-type-consistency.js';
|
|
|
49
53
|
export { checkTriggerTypes } from './trigger-types.js';
|
|
50
54
|
export { checkSkillConsistency } from './skill-consistency.js';
|
|
51
55
|
export { checkCustomIntegrationSchema } from './custom-integration-schema.js';
|
|
56
|
+
export { checkInputSchemaFormat } from './input-schema-format.js';
|
|
57
|
+
export { checkScheduleTriggerFields } from './schedule-trigger-fields.js';
|
|
52
58
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/validation/use-case-scripts/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,8B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c,GAAoB;IAC7C,kBAAkB;IAClB,oBAAoB;IACpB,gBAAgB;IAChB,0BAA0B;IAC1B,wBAAwB;IACxB,2BAA2B;IAC3B,2BAA2B;IAC3B,qBAAqB;IACrB,2BAA2B;IAC3B,iBAAiB;IACjB,qBAAqB;IACrB,4BAA4B;IAC5B,sBAAsB;IACtB,0BAA0B;CAC3B,CAAC;AAEF,+BAA+B;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Script: INPUT-SCHEMA-FORMAT
|
|
3
|
+
*
|
|
4
|
+
* Validates that inputSchema fields in HTTP and subworkflow triggers use the
|
|
5
|
+
* `key` property (not the legacy `name` property).
|
|
6
|
+
*
|
|
7
|
+
* The SubworkflowInput interface was migrated from `name` to `key` for
|
|
8
|
+
* consistency with FormFieldBase and other schema types. This rule catches
|
|
9
|
+
* configs that still use the old `name` property.
|
|
10
|
+
*/
|
|
11
|
+
import type { Finding, RuleMetadata } from '../types.js';
|
|
12
|
+
export declare const RULE_ID = "INPUT-SCHEMA-FORMAT";
|
|
13
|
+
export declare const metadata: RuleMetadata;
|
|
14
|
+
/**
|
|
15
|
+
* Check that inputSchema fields use `key` instead of legacy `name`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function checkInputSchemaFormat(useCasePath: string): Promise<Finding[]>;
|
|
18
|
+
export default checkInputSchemaFormat;
|
|
19
|
+
//# sourceMappingURL=input-schema-format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-schema-format.d.ts","sourceRoot":"","sources":["../../../src/validation/use-case-scripts/input-schema-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,eAAO,MAAM,OAAO,wBAAwB,CAAC;AAE7C,eAAO,MAAM,QAAQ,EAAE,YAWtB,CAAC;AAiDF;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAqDpF;AAED,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Script: INPUT-SCHEMA-FORMAT
|
|
3
|
+
*
|
|
4
|
+
* Validates that inputSchema fields in HTTP and subworkflow triggers use the
|
|
5
|
+
* `key` property (not the legacy `name` property).
|
|
6
|
+
*
|
|
7
|
+
* The SubworkflowInput interface was migrated from `name` to `key` for
|
|
8
|
+
* consistency with FormFieldBase and other schema types. This rule catches
|
|
9
|
+
* configs that still use the old `name` property.
|
|
10
|
+
*/
|
|
11
|
+
import { existsSync, readFileSync } from 'fs';
|
|
12
|
+
import { join } from 'path';
|
|
13
|
+
export const RULE_ID = 'INPUT-SCHEMA-FORMAT';
|
|
14
|
+
export const metadata = {
|
|
15
|
+
id: RULE_ID,
|
|
16
|
+
name: 'input_schema_format',
|
|
17
|
+
severity: 'should',
|
|
18
|
+
description: 'inputSchema fields must use `key` instead of `name`',
|
|
19
|
+
details: 'SubworkflowInput and HTTP trigger inputSchema fields should use `key: string` ' +
|
|
20
|
+
'instead of the legacy `name: string` property. Update each field object from ' +
|
|
21
|
+
'`{ name: "x", type: "string" }` to `{ key: "x", type: "string" }`.',
|
|
22
|
+
fixable: false,
|
|
23
|
+
category: 'schema',
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Find inputSchema array ranges in the config content.
|
|
27
|
+
* Returns line ranges (1-based) for each inputSchema: [...] block.
|
|
28
|
+
*/
|
|
29
|
+
function findInputSchemaRanges(content) {
|
|
30
|
+
const ranges = [];
|
|
31
|
+
const lines = content.split('\n');
|
|
32
|
+
for (let i = 0; i < lines.length; i++) {
|
|
33
|
+
const line = lines[i];
|
|
34
|
+
// Match inputSchema: [ or inputSchema: [{ inline
|
|
35
|
+
if (!/inputSchema\s*:\s*\[/.test(line))
|
|
36
|
+
continue;
|
|
37
|
+
// Track bracket depth to find the end of this array
|
|
38
|
+
let depth = 0;
|
|
39
|
+
let foundOpen = false;
|
|
40
|
+
let end = i;
|
|
41
|
+
for (let j = i; j < lines.length; j++) {
|
|
42
|
+
for (const ch of lines[j]) {
|
|
43
|
+
if (ch === '[') {
|
|
44
|
+
depth++;
|
|
45
|
+
foundOpen = true;
|
|
46
|
+
}
|
|
47
|
+
else if (ch === ']') {
|
|
48
|
+
depth--;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (foundOpen && depth <= 0) {
|
|
52
|
+
end = j;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
ranges.push({ start: i + 1, end: end + 1 }); // 1-based
|
|
57
|
+
}
|
|
58
|
+
return ranges;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Check if a line number falls within any inputSchema range
|
|
62
|
+
*/
|
|
63
|
+
function isInInputSchemaContext(line, ranges) {
|
|
64
|
+
return ranges.some(r => line >= r.start && line <= r.end);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Check that inputSchema fields use `key` instead of legacy `name`.
|
|
68
|
+
*/
|
|
69
|
+
export async function checkInputSchemaFormat(useCasePath) {
|
|
70
|
+
const findings = [];
|
|
71
|
+
const configPath = join(useCasePath, 'config.ts');
|
|
72
|
+
if (!existsSync(configPath)) {
|
|
73
|
+
return findings;
|
|
74
|
+
}
|
|
75
|
+
let content;
|
|
76
|
+
try {
|
|
77
|
+
content = readFileSync(configPath, 'utf-8');
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return findings;
|
|
81
|
+
}
|
|
82
|
+
const inputSchemaRanges = findInputSchemaRanges(content);
|
|
83
|
+
if (inputSchemaRanges.length === 0) {
|
|
84
|
+
return findings;
|
|
85
|
+
}
|
|
86
|
+
const lines = content.split('\n');
|
|
87
|
+
for (let i = 0; i < lines.length; i++) {
|
|
88
|
+
const lineNum = i + 1;
|
|
89
|
+
const line = lines[i];
|
|
90
|
+
// Only check inside inputSchema contexts
|
|
91
|
+
if (!isInInputSchemaContext(lineNum, inputSchemaRanges))
|
|
92
|
+
continue;
|
|
93
|
+
// Detect `name:` property usage (field identifier, not a string value)
|
|
94
|
+
// Match patterns like: name: 'x', name: "x", name: `x`
|
|
95
|
+
const nameMatch = line.match(/\bname\s*:\s*['"`]/);
|
|
96
|
+
if (!nameMatch)
|
|
97
|
+
continue;
|
|
98
|
+
// Extract the value for the error message
|
|
99
|
+
const valueMatch = line.match(/\bname\s*:\s*['"`]([^'"`]*)['"`]/);
|
|
100
|
+
const fieldValue = valueMatch ? valueMatch[1] : '(unknown)';
|
|
101
|
+
findings.push({
|
|
102
|
+
rule: RULE_ID,
|
|
103
|
+
severity: 'should',
|
|
104
|
+
path: configPath,
|
|
105
|
+
message: `inputSchema field uses legacy "name" property instead of "key" (line ${lineNum}, field: "${fieldValue}")`,
|
|
106
|
+
raw_details: `The inputSchema field on line ${lineNum} uses \`name: "${fieldValue}"\` which is the legacy format.\n\n` +
|
|
107
|
+
`Change it to \`key: "${fieldValue}"\` to match the current SubworkflowInput interface.\n\n` +
|
|
108
|
+
`Before: { name: "${fieldValue}", type: "string" }\n` +
|
|
109
|
+
`After: { key: "${fieldValue}", type: "string" }`,
|
|
110
|
+
line: lineNum,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
return findings;
|
|
114
|
+
}
|
|
115
|
+
export default checkInputSchemaFormat;
|
|
116
|
+
//# sourceMappingURL=input-schema-format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-schema-format.js","sourceRoot":"","sources":["../../../src/validation/use-case-scripts/input-schema-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,MAAM,CAAC,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAE7C,MAAM,CAAC,MAAM,QAAQ,GAAiB;IACpC,EAAE,EAAE,OAAO;IACX,IAAI,EAAE,qBAAqB;IAC3B,QAAQ,EAAE,QAAQ;IAClB,WAAW,EAAE,qDAAqD;IAClE,OAAO,EACL,gFAAgF;QAChF,+EAA+E;QAC/E,oEAAoE;IACtE,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,QAAQ;CACnB,CAAC;AAEF;;;GAGG;AACH,SAAS,qBAAqB,CAAC,OAAe;IAC5C,MAAM,MAAM,GAAqC,EAAE,CAAC;IACpD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAElC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,C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EAAE,OAAO;YACb,QAAQ,EAAE,QAAQ;YAClB,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,wEAAwE,OAAO,aAAa,UAAU,IAAI;YACnH,WAAW,EACT,iCAAiC,OAAO,kBAAkB,UAAU,qCAAqC;gBACzG,wBAAwB,UAAU,0DAA0D;gBAC5F,oBAAoB,UAAU,uBAAuB;gBACrD,mBAAmB,UAAU,qBAAqB;YACpD,IAAI,EAAE,OAAO;SACd,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SCHEDULE-TRIGGER-FIELDS Validation Script
|
|
3
|
+
*
|
|
4
|
+
* Validates that schedule triggers in config.ts have all required fields:
|
|
5
|
+
* - cronExpression: the cron schedule
|
|
6
|
+
* - timezone: IANA timezone (e.g., 'Europe/Brussels')
|
|
7
|
+
* - humanReadable: plain English schedule description (e.g., 'Every 5 minutes')
|
|
8
|
+
* - manualTriggerUrl: webhook URL for manual/dashboard-triggered runs
|
|
9
|
+
*
|
|
10
|
+
* These fields are required by the deployment API but were not previously
|
|
11
|
+
* validated by the CLI, causing confusing deployment failures after
|
|
12
|
+
* successful verification.
|
|
13
|
+
*/
|
|
14
|
+
import type { Finding, RuleMetadata } from '../types.js';
|
|
15
|
+
export declare const RULE_ID = "SCHEDULE-TRIGGER-FIELDS";
|
|
16
|
+
export declare const metadata: RuleMetadata;
|
|
17
|
+
/**
|
|
18
|
+
* Validates that all schedule triggers have required fields.
|
|
19
|
+
*/
|
|
20
|
+
export declare function checkScheduleTriggerFields(useCasePath: string): Promise<Finding[]>;
|
|
21
|
+
export default checkScheduleTriggerFields;
|
|
22
|
+
//# sourceMappingURL=schedule-trigger-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-trigger-fields.d.ts","sourceRoot":"","sources":["../../../src/validation/use-case-scripts/schedule-trigger-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,eAAO,MAAM,OAAO,4BAA4B,CAAC;AAEjD,eAAO,MAAM,QAAQ,EAAE,YAUtB,CAAC;AAoFF;;GAEG;AACH,wBAAsB,0BAA0B,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAwDxF;AAED,eAAe,0BAA0B,CAAC"}
|