@transloadit/node 4.2.0 → 4.3.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 +58 -0
- package/dist/Transloadit.d.ts +19 -0
- package/dist/Transloadit.d.ts.map +1 -1
- package/dist/Transloadit.js +22 -0
- package/dist/Transloadit.js.map +1 -1
- package/dist/alphalib/assembly-linter.d.ts +123 -0
- package/dist/alphalib/assembly-linter.d.ts.map +1 -0
- package/dist/alphalib/assembly-linter.js +1142 -0
- package/dist/alphalib/assembly-linter.js.map +1 -0
- package/dist/alphalib/assembly-linter.lang.en.d.ts +87 -0
- package/dist/alphalib/assembly-linter.lang.en.d.ts.map +1 -0
- package/dist/alphalib/assembly-linter.lang.en.js +326 -0
- package/dist/alphalib/assembly-linter.lang.en.js.map +1 -0
- package/dist/alphalib/object.d.ts +20 -0
- package/dist/alphalib/object.d.ts.map +1 -0
- package/dist/alphalib/object.js +23 -0
- package/dist/alphalib/object.js.map +1 -0
- package/dist/alphalib/stepParsing.d.ts +93 -0
- package/dist/alphalib/stepParsing.d.ts.map +1 -0
- package/dist/alphalib/stepParsing.js +1154 -0
- package/dist/alphalib/stepParsing.js.map +1 -0
- package/dist/alphalib/templateMerge.d.ts +4 -0
- package/dist/alphalib/templateMerge.d.ts.map +1 -0
- package/dist/alphalib/templateMerge.js +22 -0
- package/dist/alphalib/templateMerge.js.map +1 -0
- package/dist/cli/commands/assemblies.d.ts +20 -1
- package/dist/cli/commands/assemblies.d.ts.map +1 -1
- package/dist/cli/commands/assemblies.js +137 -2
- package/dist/cli/commands/assemblies.js.map +1 -1
- package/dist/cli/commands/auth.d.ts.map +1 -1
- package/dist/cli/commands/auth.js +19 -19
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +2 -1
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/docs/assemblyLintingExamples.d.ts +2 -0
- package/dist/cli/docs/assemblyLintingExamples.d.ts.map +1 -0
- package/dist/cli/docs/assemblyLintingExamples.js +10 -0
- package/dist/cli/docs/assemblyLintingExamples.js.map +1 -0
- package/dist/cli/helpers.d.ts +11 -0
- package/dist/cli/helpers.d.ts.map +1 -1
- package/dist/cli/helpers.js +29 -0
- package/dist/cli/helpers.js.map +1 -1
- package/dist/lintAssemblyInput.d.ts +10 -0
- package/dist/lintAssemblyInput.d.ts.map +1 -0
- package/dist/lintAssemblyInput.js +73 -0
- package/dist/lintAssemblyInput.js.map +1 -0
- package/dist/lintAssemblyInstructions.d.ts +29 -0
- package/dist/lintAssemblyInstructions.d.ts.map +1 -0
- package/dist/lintAssemblyInstructions.js +33 -0
- package/dist/lintAssemblyInstructions.js.map +1 -0
- package/package.json +5 -2
- package/src/Transloadit.ts +39 -0
- package/src/alphalib/assembly-linter.lang.en.ts +393 -0
- package/src/alphalib/assembly-linter.ts +1475 -0
- package/src/alphalib/object.ts +27 -0
- package/src/alphalib/stepParsing.ts +1465 -0
- package/src/alphalib/templateMerge.ts +32 -0
- package/src/alphalib/typings/json-to-ast.d.ts +34 -0
- package/src/cli/commands/assemblies.ts +161 -2
- package/src/cli/commands/auth.ts +19 -22
- package/src/cli/commands/index.ts +2 -0
- package/src/cli/docs/assemblyLintingExamples.ts +9 -0
- package/src/cli/helpers.ts +50 -0
- package/src/lintAssemblyInput.ts +89 -0
- package/src/lintAssemblyInstructions.ts +72 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { AssemblyInstructionsInput, StepInput, StepInputWithUse } from './types/template.ts';
|
|
2
|
+
import type { ZodIssueWithContext } from './zodParseWithContext.ts';
|
|
3
|
+
export type NoUseRobot = '/upload/handle' | '/google/import' | '/dropbox/import' | '/supabase/import' | '/swift/import' | '/backblaze/import' | '/ftp/import' | '/cloudfiles/import' | '/cloudflare/import' | '/digitalocean/import' | '/http/import' | '/s3/import' | '/azure/import' | '/minio/import' | '/wasabi/import' | '/edgly/deliver' | '/tlcdn/deliver' | '/sftp/import';
|
|
4
|
+
export type StepInputWithoutUse = Omit<StepInput, 'use'> & {
|
|
5
|
+
robot: NoUseRobot;
|
|
6
|
+
};
|
|
7
|
+
export declare function doesRobotSupportUse(robot: string): robot is Exclude<StepInput['robot'], NoUseRobot>;
|
|
8
|
+
export declare function doesStepRobotSupportUse(step: StepInput): step is StepInputWithUse;
|
|
9
|
+
export interface ParsedTemplateField {
|
|
10
|
+
mostCommonExampleValue: FieldOccurrence['exampleValues'][number];
|
|
11
|
+
fieldName: string;
|
|
12
|
+
value?: string;
|
|
13
|
+
occurrences: FieldOccurrence[];
|
|
14
|
+
}
|
|
15
|
+
export interface FieldOccurrence {
|
|
16
|
+
errors: string[];
|
|
17
|
+
exampleValues: (string | number | boolean)[];
|
|
18
|
+
leader: string;
|
|
19
|
+
paramName: string;
|
|
20
|
+
path: (number | string)[];
|
|
21
|
+
requiresDenoEval: boolean;
|
|
22
|
+
rName: string;
|
|
23
|
+
stepName: string;
|
|
24
|
+
trailer: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ValidationError {
|
|
27
|
+
stepName: string;
|
|
28
|
+
robotName: string;
|
|
29
|
+
paramName: string;
|
|
30
|
+
fieldNames: string[];
|
|
31
|
+
message: string;
|
|
32
|
+
value: unknown;
|
|
33
|
+
}
|
|
34
|
+
export interface Recommendation {
|
|
35
|
+
id: string;
|
|
36
|
+
robotName: string;
|
|
37
|
+
description: string;
|
|
38
|
+
applyFunction: (content: string) => string;
|
|
39
|
+
iconSrc: string;
|
|
40
|
+
}
|
|
41
|
+
export interface InterpolatedTemplateError {
|
|
42
|
+
stepName: string;
|
|
43
|
+
robotName: string;
|
|
44
|
+
paramName: string;
|
|
45
|
+
fieldNames: string[];
|
|
46
|
+
message: string;
|
|
47
|
+
value: unknown;
|
|
48
|
+
}
|
|
49
|
+
export declare function nonSignedSmartCDNUrl(argWorkspaceSlug: string, argTemplateSlug: string, argInputField: string, params?: Record<string, string | number>): string;
|
|
50
|
+
export declare function simplifyUse(step: StepInput): StepInput;
|
|
51
|
+
export declare function getLastUsedStepName(step: StepInput): string | undefined;
|
|
52
|
+
export declare function addUseReference(step: StepInput, newName: string, opts?: {
|
|
53
|
+
leading?: boolean;
|
|
54
|
+
silent?: boolean;
|
|
55
|
+
}): StepInput;
|
|
56
|
+
export declare function renameUseReferences(step: StepInput, oldName: string, newName: string): StepInput;
|
|
57
|
+
export declare function removeUseReference(step: StepInput, nameToRemove: string): StepInput;
|
|
58
|
+
interface ParseSafeTemplateOpts {
|
|
59
|
+
silent?: boolean;
|
|
60
|
+
}
|
|
61
|
+
export declare const getIndentation: (templateContent: string) => string;
|
|
62
|
+
export declare class StepParsingError extends Error {
|
|
63
|
+
zodIssuesWithContext: ZodIssueWithContext[];
|
|
64
|
+
humanReadable: string;
|
|
65
|
+
constructor(message: string, zodIssuesWithContext: ZodIssueWithContext[], humanReadable: string);
|
|
66
|
+
}
|
|
67
|
+
export declare const parseSafeTemplate: (templateContent: string, opts?: ParseSafeTemplateOpts) => [StepParsingError, null] | [null, AssemblyInstructionsInput, string];
|
|
68
|
+
export declare function botNeedsInput(robotName: string, stepName?: string, step?: StepInput): boolean;
|
|
69
|
+
export declare function getFirstStepNameThatDoesNotNeedInput(templateContent: string, excludeBots?: string[]): string;
|
|
70
|
+
export declare const hasRobot: (templateContent: string, rName: string | RegExp, silent?: boolean) => boolean;
|
|
71
|
+
export declare const doesContentRequireUpload: (templateContent: string, opts?: {
|
|
72
|
+
silent: boolean;
|
|
73
|
+
}) => boolean;
|
|
74
|
+
export declare const canAssemblyJustRun: (templateContent: string) => boolean;
|
|
75
|
+
export declare function addOptimizeRobots(templateContent: string): string;
|
|
76
|
+
export declare function removeRobots(templateContent: string, robots?: string[] | RegExp): string;
|
|
77
|
+
export declare function removeFileServeRobots(templateContent: string): string;
|
|
78
|
+
export declare function removeUploading(templateContent: string): string;
|
|
79
|
+
export declare function getRobotList(templateContent: string): string[];
|
|
80
|
+
export declare function addStorageRobot(content: string): string;
|
|
81
|
+
export declare function addFilePreviewRobot(templateContent: string): string;
|
|
82
|
+
export declare function getRecommendations(templateContent: string, silent?: boolean): Recommendation[];
|
|
83
|
+
export declare function addFileServeRobot(templateContent: string): string;
|
|
84
|
+
export declare function addUploadHandleRobot(templateContent: string): string;
|
|
85
|
+
export declare function addImportRobot(templateContent: string): string;
|
|
86
|
+
export declare function addFieldsInput(templateContent: string): string;
|
|
87
|
+
export declare function extractFieldNamesFromTemplate(templateContent: string): ParsedTemplateField[];
|
|
88
|
+
export declare function interpolateFieldsInTemplate(templateContent: string, allFields: ParsedTemplateField[], opts?: {
|
|
89
|
+
silent: boolean;
|
|
90
|
+
}): AssemblyInstructionsInput;
|
|
91
|
+
export declare function validateInterpolatedTemplate(template: AssemblyInstructionsInput, fieldsWithValues: ParsedTemplateField[], fieldNameToValidate?: string): ValidationError[];
|
|
92
|
+
export {};
|
|
93
|
+
//# sourceMappingURL=stepParsing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepParsing.d.ts","sourceRoot":"","sources":["../../src/alphalib/stepParsing.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,yBAAyB,EACzB,SAAS,EACT,gBAAgB,EAEjB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAUnE,MAAM,MAAM,UAAU,GAClB,gBAAgB,GAChB,gBAAgB,GAChB,iBAAiB,GACjB,kBAAkB,GAClB,eAAe,GACf,mBAAmB,GACnB,aAAa,GACb,oBAAoB,GACpB,oBAAoB,GACpB,sBAAsB,GACtB,cAAc,GACd,YAAY,GACZ,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,cAAc,CAAA;AAElB,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,GAAG;IACzD,KAAK,EAAE,UAAU,CAAA;CAClB,CAAA;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