@sw-tsdk/plugin-connector 3.13.1 → 3.13.2-next.3dfd44a
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 +18 -18
- package/lib/commands/connector/build.js +168 -44
- package/lib/commands/connector/build.js.map +1 -1
- package/lib/commands/connector/sign.js +108 -12
- package/lib/commands/connector/sign.js.map +1 -1
- package/lib/commands/connector/validate.js +110 -10
- package/lib/commands/connector/validate.js.map +1 -1
- package/lib/commands/migrator/convert.d.ts +3 -0
- package/lib/commands/migrator/convert.js +201 -20
- package/lib/commands/migrator/convert.js.map +1 -1
- package/lib/templates/migrator-runners/plugin_override.txt +76 -4
- package/lib/templates/migrator-runners/runner_override.txt +30 -0
- package/lib/templates/migrator-runners/script_override.txt +77 -5
- package/lib/templates/swimlane/__init__.py +18 -0
- package/lib/templates/swimlane/core/__init__.py +0 -0
- package/lib/templates/swimlane/core/adapters/__init__.py +10 -0
- package/lib/templates/swimlane/core/adapters/app.py +59 -0
- package/lib/templates/swimlane/core/adapters/app_revision.py +49 -0
- package/lib/templates/swimlane/core/adapters/helper.py +84 -0
- package/lib/templates/swimlane/core/adapters/record.py +468 -0
- package/lib/templates/swimlane/core/adapters/record_revision.py +43 -0
- package/lib/templates/swimlane/core/adapters/report.py +65 -0
- package/lib/templates/swimlane/core/adapters/task.py +58 -0
- package/lib/templates/swimlane/core/adapters/usergroup.py +183 -0
- package/lib/templates/swimlane/core/bulk.py +48 -0
- package/lib/templates/swimlane/core/cache.py +165 -0
- package/lib/templates/swimlane/core/client.py +466 -0
- package/lib/templates/swimlane/core/cursor.py +100 -0
- package/lib/templates/swimlane/core/fields/__init__.py +46 -0
- package/lib/templates/swimlane/core/fields/attachment.py +82 -0
- package/lib/templates/swimlane/core/fields/base/__init__.py +15 -0
- package/lib/templates/swimlane/core/fields/base/cursor.py +90 -0
- package/lib/templates/swimlane/core/fields/base/field.py +149 -0
- package/lib/templates/swimlane/core/fields/base/multiselect.py +116 -0
- package/lib/templates/swimlane/core/fields/comment.py +48 -0
- package/lib/templates/swimlane/core/fields/datetime.py +112 -0
- package/lib/templates/swimlane/core/fields/history.py +28 -0
- package/lib/templates/swimlane/core/fields/list.py +266 -0
- package/lib/templates/swimlane/core/fields/number.py +38 -0
- package/lib/templates/swimlane/core/fields/reference.py +169 -0
- package/lib/templates/swimlane/core/fields/text.py +30 -0
- package/lib/templates/swimlane/core/fields/tracking.py +10 -0
- package/lib/templates/swimlane/core/fields/usergroup.py +137 -0
- package/lib/templates/swimlane/core/fields/valueslist.py +70 -0
- package/lib/templates/swimlane/core/resolver.py +46 -0
- package/lib/templates/swimlane/core/resources/__init__.py +0 -0
- package/lib/templates/swimlane/core/resources/app.py +136 -0
- package/lib/templates/swimlane/core/resources/app_revision.py +43 -0
- package/lib/templates/swimlane/core/resources/attachment.py +64 -0
- package/lib/templates/swimlane/core/resources/base.py +55 -0
- package/lib/templates/swimlane/core/resources/comment.py +33 -0
- package/lib/templates/swimlane/core/resources/record.py +499 -0
- package/lib/templates/swimlane/core/resources/record_revision.py +44 -0
- package/lib/templates/swimlane/core/resources/report.py +259 -0
- package/lib/templates/swimlane/core/resources/revision_base.py +69 -0
- package/lib/templates/swimlane/core/resources/task.py +16 -0
- package/lib/templates/swimlane/core/resources/usergroup.py +166 -0
- package/lib/templates/swimlane/core/search.py +31 -0
- package/lib/templates/swimlane/core/wrappedsession.py +12 -0
- package/lib/templates/swimlane/exceptions.py +191 -0
- package/lib/templates/swimlane/utils/__init__.py +132 -0
- package/lib/templates/swimlane/utils/date_validator.py +4 -0
- package/lib/templates/swimlane/utils/list_validator.py +7 -0
- package/lib/templates/swimlane/utils/str_validator.py +10 -0
- package/lib/templates/swimlane/utils/version.py +101 -0
- package/lib/transformers/base-transformer.js +61 -14
- package/lib/transformers/base-transformer.js.map +1 -1
- package/lib/transformers/connector-generator.d.ts +104 -2
- package/lib/transformers/connector-generator.js +1234 -51
- package/lib/transformers/connector-generator.js.map +1 -1
- package/lib/types/migrator-types.d.ts +22 -0
- package/lib/types/migrator-types.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +6 -6
|
@@ -1,15 +1,117 @@
|
|
|
1
1
|
import { AppTasks, ConnectorMigrationConfig, TransformationResult } from '../types/migrator-types';
|
|
2
|
+
/** Application info from export (applicationInfo.json); used to resolve record field types. */
|
|
3
|
+
export interface ApplicationInfo {
|
|
4
|
+
name?: string;
|
|
5
|
+
fields?: ApplicationField[];
|
|
6
|
+
}
|
|
7
|
+
export interface ApplicationField {
|
|
8
|
+
id?: string;
|
|
9
|
+
key?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
fieldType?: string;
|
|
12
|
+
selectionType?: string;
|
|
13
|
+
controlType?: string;
|
|
14
|
+
inputType?: string;
|
|
15
|
+
}
|
|
2
16
|
export declare class ConnectorGenerator {
|
|
3
|
-
static
|
|
17
|
+
private static readonly ACTION_DESCRIPTION_MAX_LENGTH;
|
|
18
|
+
private static truncateActionDescription;
|
|
19
|
+
/**
|
|
20
|
+
* For inputs with Type "record", resolve ValueType from applicationInfo.fields (field id = input.Value).
|
|
21
|
+
* Call after transform() so action YAML and temp_inputs get correct types.
|
|
22
|
+
*/
|
|
23
|
+
static patchRecordInputTypes(transformationResult: TransformationResult, applicationInfo: ApplicationInfo | null): void;
|
|
24
|
+
/**
|
|
25
|
+
* For outputs that map to date fields (by Value = field id in applicationInfo), compute which keys need
|
|
26
|
+
* conversion to ISO8601 and the timetype/format for each. Sets transformationResult.outputDateConversions.
|
|
27
|
+
* Uses the application denoted by each output block's ApplicationId (same level as Mappings) when present,
|
|
28
|
+
* otherwise the current application (taskApplicationId).
|
|
29
|
+
* - DataFormat "Standard" -> no conversion.
|
|
30
|
+
* - DataFormat "Unix EPOCH" -> timetype = UnixEpochUnit (seconds or milliseconds).
|
|
31
|
+
* - DataFormat "custom" -> timetype = customDataFormat.
|
|
32
|
+
* - Otherwise -> timetype = DataFormat (treat as custom format string).
|
|
33
|
+
*/
|
|
34
|
+
static patchOutputDateConversions(transformationResult: TransformationResult, applicationInfoMap: Record<string, ApplicationInfo> | null, currentApplicationId: string | undefined): void;
|
|
35
|
+
/**
|
|
36
|
+
* Initializes a forked plugin (copy base code, requirements, asset).
|
|
37
|
+
* Returns the set of runner-excluded package names that were skipped (e.g. ssdeep) so runner.sh can be updated.
|
|
38
|
+
*/
|
|
39
|
+
static initializeForkedPlugin(transformedExport: TransformationResult, fromDirectory: string, toDirectory: string): Promise<Set<string>>;
|
|
4
40
|
static generateLogo(toDirectory: string): Promise<void>;
|
|
5
41
|
static generateBaseStructure(toDirectory: string): Promise<void>;
|
|
6
42
|
static generateRunnerOverride(toDirectory: string): Promise<void>;
|
|
7
43
|
static generateAction(transformedExport: TransformationResult, toDirectory: string): Promise<void>;
|
|
8
44
|
private static generateAsset;
|
|
45
|
+
/**
|
|
46
|
+
* Adds asset parameters from task input mappings to a separate input asset file.
|
|
47
|
+
* Creates input_asset.yaml to avoid overwriting existing asset.yaml from forked plugins.
|
|
48
|
+
*/
|
|
49
|
+
static addAssetParameters(toDirectory: string, assetParameters: {
|
|
50
|
+
Key: string;
|
|
51
|
+
Type: string;
|
|
52
|
+
Example?: any;
|
|
53
|
+
SubValue?: string;
|
|
54
|
+
}[], applicationName?: string): Promise<void>;
|
|
9
55
|
private static extractZip;
|
|
10
|
-
static
|
|
56
|
+
static addExtractedImportsToRequirements(toDirectory: string, taskImports: Set<string>): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Appends forked plugin dependencies to requirements.txt.
|
|
59
|
+
* Returns the set of package names that were excluded but need runner.sh (e.g. ssdeep).
|
|
60
|
+
*/
|
|
61
|
+
static generateRequirements(fromDirectory: string, toDirectory: string, packageName: string): Promise<Set<string>>;
|
|
62
|
+
/**
|
|
63
|
+
* Resolves version conflicts by taking the highest version requirement.
|
|
64
|
+
* Handles common cases like ==, >=, <=, >, < constraints.
|
|
65
|
+
*/
|
|
66
|
+
private static resolveVersionConflict;
|
|
67
|
+
/**
|
|
68
|
+
* Compares two version arrays (e.g., [2, 5, 0] vs [2, 4, 1]).
|
|
69
|
+
* Returns: positive if v1 > v2, negative if v1 < v2, 0 if equal.
|
|
70
|
+
*/
|
|
71
|
+
private static compareVersions;
|
|
72
|
+
/**
|
|
73
|
+
* Deduplicates requirements.txt and resolves version conflicts.
|
|
74
|
+
* When multiple versions of the same package are specified, keeps the highest version.
|
|
75
|
+
*/
|
|
76
|
+
static deduplicateRequirements(toDirectory: string): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Creates compile.sh in the connector root if swimbundle_utils was found in requirements.
|
|
79
|
+
* This handles the special case where swimbundle_utils needs to be installed separately.
|
|
80
|
+
*/
|
|
81
|
+
static generateCompileScript(toDirectory: string): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Creates runner.sh in the connector root with apt/pip installs for optional system deps:
|
|
84
|
+
* - wkhtmltopdf when connector uses sw_swimlane_email
|
|
85
|
+
* - ssdeep (apt + pip install --user) when needsSsdeep (e.g. from task imports; ssdeep is excluded from requirements.txt)
|
|
86
|
+
*/
|
|
87
|
+
static generateRunnerScript(toDirectory: string, usesSwimlaneEmail: boolean, needsSsdeep: boolean): Promise<void>;
|
|
11
88
|
private static createBaseCode;
|
|
89
|
+
/**
|
|
90
|
+
* Patch sw_swimlane_email __init__.py execute() to use system wkhtmltoimage and Config instead of pkg_resources/chmod.
|
|
91
|
+
* Matches the block after "def execute(self):" containing:
|
|
92
|
+
* f = pkg_resources.resource_filename(__name__, "__packages/wkhtmltoimage") # ...
|
|
93
|
+
* c = Config(f)
|
|
94
|
+
* st = os.stat(f)
|
|
95
|
+
* os.chmod(f, st.st_mode | stat.S_IEXEC) # ...
|
|
96
|
+
*/
|
|
97
|
+
private static patchSwimlaneEmailInit;
|
|
98
|
+
private static copyDirectoryRecursive;
|
|
12
99
|
private static getBaseCodePath;
|
|
100
|
+
/**
|
|
101
|
+
* Build Python snippet to rebuild inputs from YAML-defined keys (empty per type) then merge asset then inputs.
|
|
102
|
+
* Only includes keys where the task InputMapping has an associated Type and Value.
|
|
103
|
+
* Placeholder # INPUTS_MERGE_HERE in templates is replaced with this.
|
|
104
|
+
* @param includeAttachmentBlock - when true (script_override only), include attachment conversion and dict handling; when false (plugin_override), only temp_inputs merge.
|
|
105
|
+
*/
|
|
106
|
+
private static defaultPyValue;
|
|
107
|
+
private static buildInputsMergeSnippet;
|
|
108
|
+
private static readonly INPUTS_MERGE_PLACEHOLDER;
|
|
109
|
+
private static readonly OUTPUT_DATE_CONVERSIONS_PLACEHOLDER;
|
|
110
|
+
private static readonly TASK_EXECUTE_REQUEST_CALL;
|
|
111
|
+
private static readonly TASK_EXECUTE_WEBHOOK_CALL;
|
|
112
|
+
private static replaceTaskExecuteRequestCall;
|
|
113
|
+
/** Build Python dict literal for OUTPUT_DATE_CONVERSIONS (key -> timetype/format). */
|
|
114
|
+
private static buildOutputDateConversionsDict;
|
|
13
115
|
private static getActionContentFork;
|
|
14
116
|
private static getActionContentScript;
|
|
15
117
|
static generateActionConfig(transformationResult: TransformationResult, toDirectory: string): Promise<boolean>;
|