@gravity-platform/cloudinary 1.1.1
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 +83 -0
- package/dist/CloudinaryFileContent/node/executor.d.ts +12 -0
- package/dist/CloudinaryFileContent/node/executor.d.ts.map +1 -0
- package/dist/CloudinaryFileContent/node/executor.js +53 -0
- package/dist/CloudinaryFileContent/node/executor.js.map +1 -0
- package/dist/CloudinaryFileContent/node/index.d.ts +10 -0
- package/dist/CloudinaryFileContent/node/index.d.ts.map +1 -0
- package/dist/CloudinaryFileContent/node/index.js +74 -0
- package/dist/CloudinaryFileContent/node/index.js.map +1 -0
- package/dist/CloudinaryFileContent/service/getFileContent.d.ts +10 -0
- package/dist/CloudinaryFileContent/service/getFileContent.d.ts.map +1 -0
- package/dist/CloudinaryFileContent/service/getFileContent.js +89 -0
- package/dist/CloudinaryFileContent/service/getFileContent.js.map +1 -0
- package/dist/CloudinaryFileContent/util/types.d.ts +29 -0
- package/dist/CloudinaryFileContent/util/types.d.ts.map +1 -0
- package/dist/CloudinaryFileContent/util/types.js +6 -0
- package/dist/CloudinaryFileContent/util/types.js.map +1 -0
- package/dist/CloudinaryFiles/node/executor.d.ts +12 -0
- package/dist/CloudinaryFiles/node/executor.d.ts.map +1 -0
- package/dist/CloudinaryFiles/node/executor.js +54 -0
- package/dist/CloudinaryFiles/node/executor.js.map +1 -0
- package/dist/CloudinaryFiles/node/index.d.ts +10 -0
- package/dist/CloudinaryFiles/node/index.d.ts.map +1 -0
- package/dist/CloudinaryFiles/node/index.js +94 -0
- package/dist/CloudinaryFiles/node/index.js.map +1 -0
- package/dist/CloudinaryFiles/service/listFiles.d.ts +14 -0
- package/dist/CloudinaryFiles/service/listFiles.d.ts.map +1 -0
- package/dist/CloudinaryFiles/service/listFiles.js +85 -0
- package/dist/CloudinaryFiles/service/listFiles.js.map +1 -0
- package/dist/CloudinaryFiles/util/types.d.ts +40 -0
- package/dist/CloudinaryFiles/util/types.d.ts.map +1 -0
- package/dist/CloudinaryFiles/util/types.js +6 -0
- package/dist/CloudinaryFiles/util/types.js.map +1 -0
- package/dist/CloudinaryUpload/node/executor.d.ts +18 -0
- package/dist/CloudinaryUpload/node/executor.d.ts.map +1 -0
- package/dist/CloudinaryUpload/node/executor.js +62 -0
- package/dist/CloudinaryUpload/node/executor.js.map +1 -0
- package/dist/CloudinaryUpload/node/index.d.ts +14 -0
- package/dist/CloudinaryUpload/node/index.d.ts.map +1 -0
- package/dist/CloudinaryUpload/node/index.js +118 -0
- package/dist/CloudinaryUpload/node/index.js.map +1 -0
- package/dist/CloudinaryUpload/service/uploadImage.d.ts +22 -0
- package/dist/CloudinaryUpload/service/uploadImage.d.ts.map +1 -0
- package/dist/CloudinaryUpload/service/uploadImage.js +86 -0
- package/dist/CloudinaryUpload/service/uploadImage.js.map +1 -0
- package/dist/CloudinaryUpload/util/types.d.ts +28 -0
- package/dist/CloudinaryUpload/util/types.d.ts.map +1 -0
- package/dist/CloudinaryUpload/util/types.js +6 -0
- package/dist/CloudinaryUpload/util/types.js.map +1 -0
- package/dist/credentials/index.d.ts +26 -0
- package/dist/credentials/index.d.ts.map +1 -0
- package/dist/credentials/index.js +39 -0
- package/dist/credentials/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +64 -0
- package/dist/index.js.map +1 -0
- package/dist/shared/platform.d.ts +11 -0
- package/dist/shared/platform.d.ts.map +1 -0
- package/dist/shared/platform.js +21 -0
- package/dist/shared/platform.js.map +1 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# @gravityai-dev/cloudinary
|
|
2
|
+
|
|
3
|
+
Cloudinary media management plugin for the Gravity workflow system. Provides nodes for listing files and retrieving file content from Cloudinary.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **CloudinaryFiles**: List files from Cloudinary folders with filtering options
|
|
8
|
+
- **CloudinaryFileContent**: Get file content with transformations and format conversion
|
|
9
|
+
- Full Cloudinary API integration with credential management
|
|
10
|
+
- Support for images, videos, and raw files
|
|
11
|
+
- Built-in transformations and format conversion
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @gravityai-dev/cloudinary
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Nodes
|
|
20
|
+
|
|
21
|
+
### CloudinaryFiles
|
|
22
|
+
|
|
23
|
+
Lists files from a Cloudinary folder with various filtering options.
|
|
24
|
+
|
|
25
|
+
**Inputs:**
|
|
26
|
+
- `signal`: Trigger to start listing files
|
|
27
|
+
|
|
28
|
+
**Outputs:**
|
|
29
|
+
- `files`: Array of Cloudinary file objects
|
|
30
|
+
- `count`: Number of files found
|
|
31
|
+
|
|
32
|
+
**Configuration:**
|
|
33
|
+
- `folder`: Folder path to list files from
|
|
34
|
+
- `maxFiles`: Maximum number of files to return (1-500)
|
|
35
|
+
- `resourceType`: Type of resources (image, video, raw, auto)
|
|
36
|
+
- `tags`: Comma-separated list of tags to filter by
|
|
37
|
+
- `randomSelection`: Randomly select files if more than maxFiles exist
|
|
38
|
+
|
|
39
|
+
### CloudinaryFileContent
|
|
40
|
+
|
|
41
|
+
Gets content and metadata for a specific Cloudinary file with optional transformations.
|
|
42
|
+
|
|
43
|
+
**Inputs:**
|
|
44
|
+
- `file`: Cloudinary file object from CloudinaryFiles or Loop node
|
|
45
|
+
|
|
46
|
+
**Outputs:**
|
|
47
|
+
- `fileContent`: File content with download URL and metadata
|
|
48
|
+
|
|
49
|
+
**Configuration:**
|
|
50
|
+
- `file`: Cloudinary file object with publicId
|
|
51
|
+
- `transformation`: Cloudinary transformation string (e.g., 'w_300,h_300,c_fill')
|
|
52
|
+
- `format`: Output format (jpg, png, webp, etc.)
|
|
53
|
+
|
|
54
|
+
## Credentials
|
|
55
|
+
|
|
56
|
+
Requires Cloudinary credentials with the following fields:
|
|
57
|
+
- `cloud_name`: Your Cloudinary cloud name
|
|
58
|
+
- `api_key`: Your Cloudinary API key
|
|
59
|
+
- `api_secret`: Your Cloudinary API secret
|
|
60
|
+
|
|
61
|
+
## Usage Example
|
|
62
|
+
|
|
63
|
+
1. Add CloudinaryFiles node to list images from a folder
|
|
64
|
+
2. Connect to Loop node to process each file
|
|
65
|
+
3. Use CloudinaryFileContent to get transformed versions
|
|
66
|
+
4. Apply transformations like resizing, format conversion, etc.
|
|
67
|
+
|
|
68
|
+
## Development
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Install dependencies
|
|
72
|
+
npm install
|
|
73
|
+
|
|
74
|
+
# Build the package
|
|
75
|
+
npm run build
|
|
76
|
+
|
|
77
|
+
# Run tests
|
|
78
|
+
npm test
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
MIT
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type NodeExecutionContext } from "@gravity-platform/plugin-base";
|
|
2
|
+
import { CloudinaryFileContentConfig, CloudinaryFileContentOutput } from "../util/types";
|
|
3
|
+
import { PromiseNode } from "../../shared/platform";
|
|
4
|
+
export declare class CloudinaryFileContentExecutor extends PromiseNode<CloudinaryFileContentConfig> {
|
|
5
|
+
constructor();
|
|
6
|
+
protected executeNode(inputs: Record<string, any>, config: CloudinaryFileContentConfig, context: NodeExecutionContext): Promise<CloudinaryFileContentOutput>;
|
|
7
|
+
/**
|
|
8
|
+
* Build credential context from execution context
|
|
9
|
+
*/
|
|
10
|
+
private buildCredentialContext;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/CloudinaryFileContent/node/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAEzF,OAAO,EAAE,WAAW,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,qBAAa,6BAA8B,SAAQ,WAAW,CAAC,2BAA2B,CAAC;;cAKzE,WAAW,CACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,MAAM,EAAE,2BAA2B,EACnC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,2BAA2B,CAAC;IAkCvC;;OAEG;IACH,OAAO,CAAC,sBAAsB;CAW/B"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudinaryFileContentExecutor = void 0;
|
|
4
|
+
const getFileContent_1 = require("../service/getFileContent");
|
|
5
|
+
const platform_1 = require("../../shared/platform");
|
|
6
|
+
const NODE_TYPE = "CloudinaryFileContent";
|
|
7
|
+
class CloudinaryFileContentExecutor extends platform_1.PromiseNode {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(NODE_TYPE);
|
|
10
|
+
}
|
|
11
|
+
async executeNode(inputs, config, context) {
|
|
12
|
+
const logger = (0, platform_1.createLogger)("CloudinaryFileContent");
|
|
13
|
+
// Build credential context for service
|
|
14
|
+
const credentialContext = this.buildCredentialContext(context);
|
|
15
|
+
try {
|
|
16
|
+
const result = await (0, getFileContent_1.getCloudinaryFileContent)(config, credentialContext.credentials?.cloudinaryCredential, logger);
|
|
17
|
+
logger.info("CloudinaryFileContent execution completed", {
|
|
18
|
+
publicId: config.file?.public_id,
|
|
19
|
+
format: result.format,
|
|
20
|
+
hasTransformation: !!result.transformation
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
__outputs: {
|
|
24
|
+
fileContent: result
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
logger.error("CloudinaryFileContent execution failed", {
|
|
30
|
+
error: error.message,
|
|
31
|
+
code: error.code,
|
|
32
|
+
stack: error.stack,
|
|
33
|
+
});
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Build credential context from execution context
|
|
39
|
+
*/
|
|
40
|
+
buildCredentialContext(context) {
|
|
41
|
+
return {
|
|
42
|
+
credentials: {
|
|
43
|
+
cloudinaryCredential: context.credentials?.cloudinaryCredential || {},
|
|
44
|
+
},
|
|
45
|
+
nodeType: NODE_TYPE,
|
|
46
|
+
workflowId: context.workflow?.id || "",
|
|
47
|
+
executionId: context.executionId || "",
|
|
48
|
+
nodeId: context.nodeId || "",
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.CloudinaryFileContentExecutor = CloudinaryFileContentExecutor;
|
|
53
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/CloudinaryFileContent/node/executor.ts"],"names":[],"mappings":";;;AAEA,8DAAqE;AACrE,oDAAkE;AAClE,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAE1C,MAAa,6BAA8B,SAAQ,sBAAwC;IACzF;QACE,KAAK,CAAC,SAAS,CAAC,CAAC;IACnB,CAAC;IAES,KAAK,CAAC,WAAW,CACzB,MAA2B,EAC3B,MAAmC,EACnC,OAA6B;QAE7B,MAAM,MAAM,GAAG,IAAA,uBAAY,EAAC,uBAAuB,CAAC,CAAC;QAErD,uCAAuC;QACvC,MAAM,iBAAiB,GAAG,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAE/D,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAA,yCAAwB,EAC3C,MAAM,EACN,iBAAiB,CAAC,WAAW,EAAE,oBAAoB,EACnD,MAAM,CACP,CAAC;YAEF,MAAM,CAAC,IAAI,CAAC,2CAA2C,EAAE;gBACvD,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,SAAS;gBAChC,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,iBAAiB,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc;aAC3C,CAAC,CAAC;YAEH,OAAO;gBACL,SAAS,EAAE;oBACT,WAAW,EAAE,MAAM;iBACpB;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,CAAC,KAAK,CAAC,wCAAwC,EAAE;gBACrD,KAAK,EAAE,KAAK,CAAC,OAAO;gBACpB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,KAAK,EAAE,KAAK,CAAC,KAAK;aACnB,CAAC,CAAC;YACH,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;OAEG;IACK,sBAAsB,CAAC,OAA6B;QAC1D,OAAO;YACL,WAAW,EAAE;gBACX,oBAAoB,EAAE,OAAO,CAAC,WAAW,EAAE,oBAAoB,IAAI,EAAE;aACtE;YACD,QAAQ,EAAE,SAAS;YACnB,UAAU,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE;YACtC,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,EAAE;YACtC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;SAC7B,CAAC;IACJ,CAAC;CACF;AAzDD,sEAyDC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type EnhancedNodeDefinition } from "@gravity-platform/plugin-base";
|
|
2
|
+
import { CloudinaryFileContentExecutor } from "./executor";
|
|
3
|
+
export declare const NODE_TYPE = "CloudinaryFileContent";
|
|
4
|
+
declare function createNodeDefinition(): EnhancedNodeDefinition;
|
|
5
|
+
export declare const CloudinaryFileContentNode: {
|
|
6
|
+
definition: any;
|
|
7
|
+
executor: typeof CloudinaryFileContentExecutor;
|
|
8
|
+
};
|
|
9
|
+
export { createNodeDefinition };
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/CloudinaryFileContent/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACrG,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAE3D,eAAO,MAAM,SAAS,0BAA0B,CAAC;AAEjD,iBAAS,oBAAoB,IAAI,sBAAsB,CA6DtD;AAID,eAAO,MAAM,yBAAyB;;;CAGrC,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudinaryFileContentNode = exports.NODE_TYPE = void 0;
|
|
4
|
+
exports.createNodeDefinition = createNodeDefinition;
|
|
5
|
+
const plugin_base_1 = require("@gravity-platform/plugin-base");
|
|
6
|
+
const executor_1 = require("./executor");
|
|
7
|
+
exports.NODE_TYPE = "CloudinaryFileContent";
|
|
8
|
+
function createNodeDefinition() {
|
|
9
|
+
const { NodeInputType } = (0, plugin_base_1.getPlatformDependencies)();
|
|
10
|
+
return {
|
|
11
|
+
packageVersion: "1.1.0",
|
|
12
|
+
type: exports.NODE_TYPE,
|
|
13
|
+
name: "Cloudinary File Content",
|
|
14
|
+
description: "Get content and metadata for a Cloudinary file",
|
|
15
|
+
category: "storage",
|
|
16
|
+
logoUrl: "https://res.cloudinary.com/sonik/image/upload/v1754502687/gravity/icons/cloudinary_logo.png",
|
|
17
|
+
color: "#3448C5", // Cloudinary Blue
|
|
18
|
+
inputs: [
|
|
19
|
+
{
|
|
20
|
+
name: "file",
|
|
21
|
+
type: NodeInputType.OBJECT,
|
|
22
|
+
description: "Cloudinary file object from CloudinaryFiles or Loop node",
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
outputs: [
|
|
26
|
+
{
|
|
27
|
+
name: "fileContent",
|
|
28
|
+
type: NodeInputType.OBJECT,
|
|
29
|
+
description: "File content with download URL and metadata",
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
configSchema: {
|
|
33
|
+
type: "object",
|
|
34
|
+
properties: {
|
|
35
|
+
file: {
|
|
36
|
+
type: "object",
|
|
37
|
+
title: "File Object",
|
|
38
|
+
description: "Cloudinary file object with publicId",
|
|
39
|
+
default: "",
|
|
40
|
+
"ui:field": "template",
|
|
41
|
+
},
|
|
42
|
+
transformation: {
|
|
43
|
+
type: "string",
|
|
44
|
+
title: "Transformation",
|
|
45
|
+
description: "Cloudinary transformation string (e.g., 'w_300,h_300,c_fill')",
|
|
46
|
+
default: "",
|
|
47
|
+
"ui:placeholder": "e.g., w_300,h_300,c_fill,g_face",
|
|
48
|
+
"ui:help": "See Cloudinary transformation reference for options",
|
|
49
|
+
},
|
|
50
|
+
format: {
|
|
51
|
+
type: "string",
|
|
52
|
+
title: "Output Format",
|
|
53
|
+
description: "Convert to a different format (e.g., 'jpg', 'png', 'webp')",
|
|
54
|
+
default: "jpg",
|
|
55
|
+
"ui:placeholder": "e.g., jpg, png, webp",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
credentials: [
|
|
60
|
+
{
|
|
61
|
+
name: "cloudinaryCredential",
|
|
62
|
+
required: true,
|
|
63
|
+
displayName: "Cloudinary",
|
|
64
|
+
description: "Cloudinary credentials for media access",
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const definition = createNodeDefinition();
|
|
70
|
+
exports.CloudinaryFileContentNode = {
|
|
71
|
+
definition,
|
|
72
|
+
executor: executor_1.CloudinaryFileContentExecutor,
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/CloudinaryFileContent/node/index.ts"],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E,IAAI,EAAE,sBAAsB;gBAC5B,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,YAAY;gBACzB,WAAW,EAAE,yCAAyC;aACvD;SACF;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,GAAG,oBAAoB,EAAE,CAAC;AAE7B,QAAA,yBAAyB,GAAG;IACvC,UAAU;IACV,QAAQ,EAAE,wCAA6B;CACxC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudinary file content retrieval service
|
|
3
|
+
*/
|
|
4
|
+
import { CloudinaryFileContentConfig, CloudinaryFileContentServiceOutput } from '../util/types';
|
|
5
|
+
import { CloudinaryCredentials } from '../../CloudinaryFiles/service/listFiles';
|
|
6
|
+
/**
|
|
7
|
+
* Get file content and metadata from Cloudinary
|
|
8
|
+
*/
|
|
9
|
+
export declare function getCloudinaryFileContent(config: CloudinaryFileContentConfig, credentials: CloudinaryCredentials, logger: any): Promise<CloudinaryFileContentServiceOutput>;
|
|
10
|
+
//# sourceMappingURL=getFileContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFileContent.d.ts","sourceRoot":"","sources":["../../../src/CloudinaryFileContent/service/getFileContent.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,2BAA2B,EAAE,kCAAkC,EAAE,MAAM,eAAe,CAAC;AAChG,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAEhF;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,2BAA2B,EACnC,WAAW,EAAE,qBAAqB,EAClC,MAAM,EAAE,GAAG,GACV,OAAO,CAAC,kCAAkC,CAAC,CAyF7C"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Cloudinary file content retrieval service
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getCloudinaryFileContent = getCloudinaryFileContent;
|
|
7
|
+
const cloudinary_1 = require("cloudinary");
|
|
8
|
+
/**
|
|
9
|
+
* Get file content and metadata from Cloudinary
|
|
10
|
+
*/
|
|
11
|
+
async function getCloudinaryFileContent(config, credentials, logger) {
|
|
12
|
+
if (!credentials || !credentials.cloud_name || !credentials.api_key || !credentials.api_secret) {
|
|
13
|
+
throw new Error('Invalid Cloudinary credentials: missing cloud_name, api_key, or api_secret');
|
|
14
|
+
}
|
|
15
|
+
if (!config.file || !config.file.public_id) {
|
|
16
|
+
throw new Error('File object with public_id is required');
|
|
17
|
+
}
|
|
18
|
+
// Configure Cloudinary
|
|
19
|
+
cloudinary_1.v2.config({
|
|
20
|
+
cloud_name: credentials.cloud_name,
|
|
21
|
+
api_key: credentials.api_key,
|
|
22
|
+
api_secret: credentials.api_secret,
|
|
23
|
+
secure: true
|
|
24
|
+
});
|
|
25
|
+
try {
|
|
26
|
+
logger.info('Getting Cloudinary file content', {
|
|
27
|
+
publicId: config.file.public_id,
|
|
28
|
+
transformation: config.transformation,
|
|
29
|
+
format: config.format
|
|
30
|
+
});
|
|
31
|
+
// Get detailed resource information
|
|
32
|
+
const resource = await cloudinary_1.v2.api.resource(config.file.public_id, {
|
|
33
|
+
resource_type: config.file.resource_type || 'image'
|
|
34
|
+
});
|
|
35
|
+
// Build transformation string
|
|
36
|
+
let transformationString = '';
|
|
37
|
+
if (config.transformation) {
|
|
38
|
+
transformationString += config.transformation;
|
|
39
|
+
}
|
|
40
|
+
if (config.format) {
|
|
41
|
+
transformationString += transformationString ? `,f_${config.format}` : `f_${config.format}`;
|
|
42
|
+
}
|
|
43
|
+
// Generate URLs with transformations
|
|
44
|
+
let url = resource.url;
|
|
45
|
+
let secure_url = resource.secure_url;
|
|
46
|
+
let downloadUrl = resource.secure_url;
|
|
47
|
+
if (transformationString) {
|
|
48
|
+
// Apply transformations to URLs
|
|
49
|
+
url = cloudinary_1.v2.url(config.file.public_id, {
|
|
50
|
+
transformation: transformationString,
|
|
51
|
+
resource_type: config.file.resource_type || 'image'
|
|
52
|
+
});
|
|
53
|
+
secure_url = cloudinary_1.v2.url(config.file.public_id, {
|
|
54
|
+
transformation: transformationString,
|
|
55
|
+
resource_type: config.file.resource_type || 'image',
|
|
56
|
+
secure: true
|
|
57
|
+
});
|
|
58
|
+
downloadUrl = secure_url;
|
|
59
|
+
}
|
|
60
|
+
const result = {
|
|
61
|
+
public_id: resource.public_id,
|
|
62
|
+
url,
|
|
63
|
+
secure_url,
|
|
64
|
+
downloadUrl,
|
|
65
|
+
format: config.format || resource.format,
|
|
66
|
+
width: resource.width,
|
|
67
|
+
height: resource.height,
|
|
68
|
+
bytes: resource.bytes,
|
|
69
|
+
resource_type: resource.resource_type,
|
|
70
|
+
created_at: resource.created_at,
|
|
71
|
+
universalId: config.file.universalId,
|
|
72
|
+
transformation: transformationString || undefined
|
|
73
|
+
};
|
|
74
|
+
logger.info('Successfully retrieved Cloudinary file content', {
|
|
75
|
+
publicId: config.file.public_id,
|
|
76
|
+
format: result.format,
|
|
77
|
+
hasTransformation: !!transformationString
|
|
78
|
+
});
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
logger.error('Failed to get Cloudinary file content', {
|
|
83
|
+
publicId: config.file?.public_id,
|
|
84
|
+
error: error instanceof Error ? error.message : String(error)
|
|
85
|
+
});
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=getFileContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFileContent.js","sourceRoot":"","sources":["../../../src/CloudinaryFileContent/service/getFileContent.ts"],"names":[],"mappings":";AAAA;;GAEG;;AASH,4DA6FC;AApGD,2CAA8C;AAI9C;;GAEG;AACI,KAAK,UAAU,wBAAwB,CAC5C,MAAmC,EACnC,WAAkC,EAClC,MAAW;IAGX,IAAI,CAAC,WAAW,IAAI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AC,MAAM;YACrB,iBAAiB,EAAE,CAAC,CAAC,oBAAoB;SAC1C,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,uCAAuC,EAAE;YACpD,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,SAAS;YAChC,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9D,CAAC,CAAC;QACH,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for CloudinaryFileContent node
|
|
3
|
+
*/
|
|
4
|
+
import { CloudinaryResource } from "../../CloudinaryFiles/util/types";
|
|
5
|
+
export interface CloudinaryFileContentConfig {
|
|
6
|
+
file?: CloudinaryResource;
|
|
7
|
+
transformation?: string;
|
|
8
|
+
format?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CloudinaryFileContentServiceOutput {
|
|
11
|
+
public_id: string;
|
|
12
|
+
url: string;
|
|
13
|
+
secure_url: string;
|
|
14
|
+
downloadUrl: string;
|
|
15
|
+
format: string;
|
|
16
|
+
width?: number;
|
|
17
|
+
height?: number;
|
|
18
|
+
bytes: number;
|
|
19
|
+
resource_type: string;
|
|
20
|
+
created_at: string;
|
|
21
|
+
universalId?: string;
|
|
22
|
+
transformation?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface CloudinaryFileContentOutput {
|
|
25
|
+
__outputs: {
|
|
26
|
+
fileContent: CloudinaryFileContentServiceOutput;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/CloudinaryFileContent/util/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,MAAM,WAAW,2BAA2B;IAC1C,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kCAAkC;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE;QACT,WAAW,EAAE,kCAAkC,CAAC;KACjD,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/CloudinaryFileContent/util/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type NodeExecutionContext } from "@gravity-platform/plugin-base";
|
|
2
|
+
import { CloudinaryFilesConfig, CloudinaryFilesOutput } from "../util/types";
|
|
3
|
+
import { PromiseNode } from "../../shared/platform";
|
|
4
|
+
export declare class CloudinaryFilesExecutor extends PromiseNode<CloudinaryFilesConfig> {
|
|
5
|
+
constructor();
|
|
6
|
+
protected executeNode(inputs: Record<string, any>, config: CloudinaryFilesConfig, context: NodeExecutionContext): Promise<CloudinaryFilesOutput>;
|
|
7
|
+
/**
|
|
8
|
+
* Build credential context from execution context
|
|
9
|
+
*/
|
|
10
|
+
private buildCredentialContext;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/CloudinaryFiles/node/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE7E,OAAO,EAAE,WAAW,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,qBAAa,uBAAwB,SAAQ,WAAW,CAAC,qBAAqB,CAAC;;cAK7D,WAAW,CACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAmCjC;;OAEG;IACH,OAAO,CAAC,sBAAsB;CAW/B"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudinaryFilesExecutor = void 0;
|
|
4
|
+
const listFiles_1 = require("../service/listFiles");
|
|
5
|
+
const platform_1 = require("../../shared/platform");
|
|
6
|
+
const NODE_TYPE = "CloudinaryFiles";
|
|
7
|
+
class CloudinaryFilesExecutor extends platform_1.PromiseNode {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(NODE_TYPE);
|
|
10
|
+
}
|
|
11
|
+
async executeNode(inputs, config, context) {
|
|
12
|
+
const logger = (0, platform_1.createLogger)("CloudinaryFiles");
|
|
13
|
+
// Build credential context for service
|
|
14
|
+
const credentialContext = this.buildCredentialContext(context);
|
|
15
|
+
try {
|
|
16
|
+
const result = await (0, listFiles_1.listCloudinaryFiles)(config, credentialContext.credentials?.cloudinaryCredential, logger);
|
|
17
|
+
logger.info("CloudinaryFiles execution completed", {
|
|
18
|
+
filesFound: result.count,
|
|
19
|
+
folder: config.folder,
|
|
20
|
+
resourceType: config.resourceType
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
__outputs: {
|
|
24
|
+
files: result.files,
|
|
25
|
+
count: result.count
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
logger.error("CloudinaryFiles execution failed", {
|
|
31
|
+
error: error.message,
|
|
32
|
+
code: error.code,
|
|
33
|
+
stack: error.stack,
|
|
34
|
+
});
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Build credential context from execution context
|
|
40
|
+
*/
|
|
41
|
+
buildCredentialContext(context) {
|
|
42
|
+
return {
|
|
43
|
+
credentials: {
|
|
44
|
+
cloudinaryCredential: context.credentials?.cloudinaryCredential || {},
|
|
45
|
+
},
|
|
46
|
+
nodeType: NODE_TYPE,
|
|
47
|
+
workflowId: context.workflow?.id || "",
|
|
48
|
+
executionId: context.executionId || "",
|
|
49
|
+
nodeId: context.nodeId || "",
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.CloudinaryFilesExecutor = CloudinaryFilesExecutor;
|
|
54
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/CloudinaryFiles/node/executor.ts"],"names":[],"mappings":";;;AAEA,oDAA2D;AAC3D,oDAAkE;AAClE,MAAM,SAAS,GAAG,iBAAiB,CAAC;AAEpC,MAAa,uBAAwB,SAAQ,sBAAkC;IAC7E;QACE,KAAK,CAAC,SAAS,CAAC,CAAC;IACnB,CAAC;IAES,KAAK,CAAC,WAAW,CACzB,MAA2B,EAC3B,MAA6B,EAC7B,OAA6B;QAE7B,MAAM,MAAM,GAAG,IAAA,uBAAY,EAAC,iBAA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-platform/plugin-base";
|
|
2
|
+
import { CloudinaryFilesExecutor } from "./executor";
|
|
3
|
+
export declare const NODE_TYPE = "CloudinaryFiles";
|
|
4
|
+
declare function createNodeDefinition(): EnhancedNodeDefinition;
|
|
5
|
+
export declare const CloudinaryFilesNode: {
|
|
6
|
+
definition: any;
|
|
7
|
+
executor: typeof CloudinaryFilesExecutor;
|
|
8
|
+
};
|
|
9
|
+
export { createNodeDefinition };
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/CloudinaryFiles/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACrG,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAErD,eAAO,MAAM,SAAS,oBAAoB,CAAC;AAE3C,iBAAS,oBAAoB,IAAI,sBAAsB,CAiFtD;AAID,eAAO,MAAM,mBAAmB;;;CAG/B,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudinaryFilesNode = exports.NODE_TYPE = void 0;
|
|
4
|
+
exports.createNodeDefinition = createNodeDefinition;
|
|
5
|
+
const plugin_base_1 = require("@gravity-platform/plugin-base");
|
|
6
|
+
const executor_1 = require("./executor");
|
|
7
|
+
exports.NODE_TYPE = "CloudinaryFiles";
|
|
8
|
+
function createNodeDefinition() {
|
|
9
|
+
const { NodeInputType } = (0, plugin_base_1.getPlatformDependencies)();
|
|
10
|
+
return {
|
|
11
|
+
packageVersion: "1.1.0",
|
|
12
|
+
type: exports.NODE_TYPE,
|
|
13
|
+
name: "Cloudinary Files",
|
|
14
|
+
description: "List files from a Cloudinary folder",
|
|
15
|
+
category: "storage",
|
|
16
|
+
logoUrl: "https://res.cloudinary.com/sonik/image/upload/v1754502687/gravity/icons/cloudinary_logo.png",
|
|
17
|
+
color: "#3448C5", // Cloudinary Blue
|
|
18
|
+
inputs: [
|
|
19
|
+
{
|
|
20
|
+
name: "signal",
|
|
21
|
+
type: NodeInputType.OBJECT,
|
|
22
|
+
description: "Trigger to start listing files",
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
outputs: [
|
|
26
|
+
{
|
|
27
|
+
name: "files",
|
|
28
|
+
type: NodeInputType.ARRAY,
|
|
29
|
+
description: "Array of Cloudinary file objects",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "count",
|
|
33
|
+
type: NodeInputType.NUMBER,
|
|
34
|
+
description: "Number of files found",
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
configSchema: {
|
|
38
|
+
type: "object",
|
|
39
|
+
properties: {
|
|
40
|
+
folder: {
|
|
41
|
+
type: "string",
|
|
42
|
+
title: "Folder Path",
|
|
43
|
+
description: "Folder path to list files from (leave empty for root)",
|
|
44
|
+
default: "",
|
|
45
|
+
"ui:placeholder": "e.g., products/images",
|
|
46
|
+
},
|
|
47
|
+
maxFiles: {
|
|
48
|
+
type: "number",
|
|
49
|
+
title: "Max Files",
|
|
50
|
+
description: "Maximum number of files to return (1-500)",
|
|
51
|
+
default: 100,
|
|
52
|
+
minimum: 1,
|
|
53
|
+
maximum: 500,
|
|
54
|
+
},
|
|
55
|
+
resourceType: {
|
|
56
|
+
type: "string",
|
|
57
|
+
title: "Resource Type",
|
|
58
|
+
description: "Type of resources to list",
|
|
59
|
+
default: "image",
|
|
60
|
+
enum: ["image", "video", "raw", "auto"],
|
|
61
|
+
enumNames: ["Images", "Videos", "Raw Files", "All Types"],
|
|
62
|
+
},
|
|
63
|
+
tags: {
|
|
64
|
+
type: "string",
|
|
65
|
+
title: "Tags",
|
|
66
|
+
description: "Comma-separated list of tags to filter by",
|
|
67
|
+
default: "",
|
|
68
|
+
"ui:placeholder": "e.g., product,featured",
|
|
69
|
+
},
|
|
70
|
+
randomSelection: {
|
|
71
|
+
type: "boolean",
|
|
72
|
+
title: "Random Selection",
|
|
73
|
+
description: "Randomly select files if more than maxFiles exist",
|
|
74
|
+
default: false,
|
|
75
|
+
"ui:widget": "toggle",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
credentials: [
|
|
80
|
+
{
|
|
81
|
+
name: "cloudinaryCredential",
|
|
82
|
+
required: true,
|
|
83
|
+
displayName: "Cloudinary",
|
|
84
|
+
description: "Cloudinary credentials for media access",
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const definition = createNodeDefinition();
|
|
90
|
+
exports.CloudinaryFilesNode = {
|
|
91
|
+
definition,
|
|
92
|
+
executor: executor_1.CloudinaryFilesExecutor,
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/CloudinaryFiles/node/index.ts"],"names":[],"mappings":";;;AA+FS,oDAAoB;AA/F7B,+DAAqG;AACrG,yCAAqD;AAExC,QAAA,SAAS,GAAG,iBAAiB,CAAC;AAE3C,SAAS,oBAAoB;IAC3B,MAAM,EAAE,aAAa,EAAE,GAAG,IAAA,qCAAuB,GAAE,CAAC;IAEpD,OAAO;QACL,cAAc,EAAE,OAAO;QACvB,IAAI,EAAE,iBAAS;QACf,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,qCAAqC;QAClD,QAAQ,EAAE,SAAS;QACnB,OAAO,EAAE,6FAA6F;QACtG,KAAK,EAAE,SAAS,EAAE,kBAAkB;QACpC,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,aAAa,CAAC,MAAM;gBAC1B,WAAW,EAAE,gCAAgC;aAC9C;SACF;QACD,OAAO,EAAE;YACP;gBACE,IAAI,E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5B,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,YAAY;gBACzB,WAAW,EAAE,yCAAyC;aACvD;SACF;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,GAAG,oBAAoB,EAAE,CAAC;AAE7B,QAAA,mBAAmB,GAAG;IACjC,UAAU;IACV,QAAQ,EAAE,kCAAuB;CAClC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudinary file listing service
|
|
3
|
+
*/
|
|
4
|
+
import { CloudinaryFilesConfig, CloudinaryFilesServiceOutput } from '../util/types';
|
|
5
|
+
export interface CloudinaryCredentials {
|
|
6
|
+
cloud_name: string;
|
|
7
|
+
api_key: string;
|
|
8
|
+
api_secret: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* List files from Cloudinary
|
|
12
|
+
*/
|
|
13
|
+
export declare function listCloudinaryFiles(config: CloudinaryFilesConfig, credentials: CloudinaryCredentials, logger: any): Promise<CloudinaryFilesServiceOutput>;
|
|
14
|
+
//# sourceMappingURL=listFiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listFiles.d.ts","sourceRoot":"","sources":["../../../src/CloudinaryFiles/service/listFiles.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,qBAAqB,EAAsB,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAGxG,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAWD;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,qBAAqB,EAC7B,WAAW,EAAE,qBAAqB,EAClC,MAAM,EAAE,GAAG,GACV,OAAO,CAAC,4BAA4B,CAAC,CA0EvC"}
|