{"_id":"@adobe-csc/photoshop","name":"@adobe-csc/photoshop","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@adobe-csc/photoshop","version":"0.0.1","main":"./dist/index.js","type":"module","scripts":{"build":"tsc","test":"vitest run test"},"dependencies":{"@adobe-csc/jsonata-client":"*"},"author":{"name":"Marcel Boucher"},"license":"MIT","_id":"@adobe-csc/photoshop@0.0.1","gitHead":"21972e5978f9e718464553cbc68f29894b4d855f","types":"./dist/index.d.ts","description":"A collection of PSD Document Manifest operations thatprovide the ability to get relevant information about the document useful for automation tasks. This library is powered by [Jsonata](https://docs.jsonata.org/overview.html)","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-Bl5oTQz7FwdHKHG7nBOxFWcKXvKj3/FbXqOoNe7yzOJxgQF4HUsvqWKfk08VY/OZ+RfeGg3xdx6tLcwUzWoPzg==","shasum":"b10b1d2a1e2661365d5c3ca14401b5d453da90dd","tarball":"https://registry.npmjs.org/@adobe-csc/photoshop/-/photoshop-0.0.1.tgz","fileCount":14,"unpackedSize":95482,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDVqYbFuz+kTYbOB60zW+VXD2eYqsTSQF9CSH8BSPD1IQIhAJge5q7XYxiEgcLdQZZEY/NnfS3USZ99EpUU3OuQI/6l"}]},"_npmUser":{"name":"mboucher-adobe","email":"mboucher@adobe.com"},"directories":{},"maintainers":[{"name":"whatwork","email":"wehopkin@adobe.com"},{"name":"gclement","email":"gclement@adobe.com"},{"name":"mboucher-adobe","email":"mboucher@adobe.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/photoshop_0.0.1_1739709146902_0.49617272581679317"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-16T12:32:26.806Z","0.0.1":"2025-02-16T12:32:27.126Z","modified":"2025-02-16T12:32:27.469Z"},"maintainers":[{"name":"whatwork","email":"wehopkin@adobe.com"},{"name":"gclement","email":"gclement@adobe.com"},{"name":"mboucher-adobe","email":"mboucher@adobe.com"}],"description":"A collection of PSD Document Manifest operations thatprovide the ability to get relevant information about the document useful for automation tasks. This library is powered by [Jsonata](https://docs.jsonata.org/overview.html)","author":{"name":"Marcel Boucher"},"license":"MIT","readme":"# Photoshop Manifest Client\n\nA collection of PSD Document Manifest operations thatprovide the ability to get relevant information about the document useful for automation tasks. This library is powered by [Jsonata](https://docs.jsonata.org/overview.html)\n\n## READ FIRST\n\nThis library is developped based on a naming convention of the Adobe Photoshop layer names. All dynamic / replaceable layer names are expected to be in the following format:\n\n```\n{{layerName}}\n```\n\nThe libray will treat all layers (text, smart objects, artboards, etc) that follow this naming convention as dynamic layers.\n\n## Using this library\n\n- Install the package using `npm install @adobe-csc/photoshop`\n- Create an instance of the manifest client by passing a valid Photoshop document `manifest` object to the constructor.\n\n## Get the PSD Document Manifest\n\nFollow the steps documented in the Firefly Services PS API:\nhttps://developer.adobe.com/firefly-services/docs/photoshop/api/photoshop_getManifest/\n\n### Initialize the library using the following code snippet:\n\n```(typescript)\nimport { ManifestClient } from '@adobe-csc/photoshop';\nconst  manifest: DocumentManifest = {/* manifest object */}\nconst manifestClient = new ManifestClient(manifest);\n```\n\n### Get all artboards\n\n```(typescript)\nconst artboards:Array<Layer> = await manifestClient.getArtboards();\n```\n\n### Get all replaceable text layers\n\n```(typescript)\nconst layers:Array<Layer> = await manifestClient.getVariableTextLayers();\n```\n\n### Replace text in all replaceable text layers\n\nThe JSON data is expected to be an `Array<TextLayerContentReplacement>`.\n\nHere is an example:\n\n```(typescript)\nconst jsonData:Array<TextLayerContentReplacement> = [\n    {\n        \"LayerName\":{\n            \"text\":{\n                \"contents:\"new text\"\n            }\n        }\n    }\n]\n```\n\nThen pass the JSON data to the `replaceTextLayerContent` method.\n\n```(typescript)\nconst layers:Array<Layer> = await manifestClient.replaceTextLayerContent(jsonData);\n```\n\n### Get all replaceable smart objects\n\n```(typescript)\nconst layers:Array<Layer> = await manifestClient.getVariableSmartObjects();\n```\n\n### Replace smart object with a presignedUrl\n\nThe JSON data is expected to be an `Array<SmartObjectReplacement>`.\n\nHere is an example:\n\n```(typescript)\nconst jsonData:Array<SmartObjectReplacement> = [\n    {\n        background: {\n            href: \"https://example.com/image.jpg\",\n            storage: \"external\",\n        }\n    }\n]\n```\n\nThen pass the JSON data to the `replaceTextLayerContent` method.\n\n```(typescript)\nconst layers:Array<Layer> = await manifestClient.replaceSmartObjects(jsonData);\n```\n\n## Unit Testing\n\n- Run `npm run test` from the root of this package folder.\n\n## JSONATA Expressions\n\nThe jsonata expressions used in this library are available as text files here: `./src/jsonata`\n\n## Local Development Setup\n\n- Clone the mono repo\n- Install the dependencies using `npm install`\n- Run the tests using `npm test`\n","readmeFilename":"README.MD"}