- Saved searches
- Use saved searches to filter your results more quickly
- License
- adobe/target-nodejs-sdk
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- Build Cloud Native Code
- Integrated
- Serverless
- Flexible
- Server Not Required
- Extend Adobe Solutions
- Secure and easy to manage
- Embedded Adobe API
- Automatic Scaling
- Code in Javascript, run in node.js
- Continuous Integration and Deployment
- Powered by OpenWhisk
- This package has been deprecated
- adobe-node
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
License
adobe/target-nodejs-sdk
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
- @adobe/target-decisioning-engine@1.9.3 - @adobe/target-nodejs-sdk@2.4.3
Git stats
Files
Failed to load latest commit information.
README.md
The Adobe Target Node.js SDK uses the Target Delivery API to retrieve and deliver personalized experiences. Furthermore, the Node.js SDK helps manage integrations with Experience Cloud solutions using the Experience Cloud Identity library (ECID).
All currently maintained versions of Node.js are supported (including LTS versions), see Node.js Releases.
Older Node.js releases may likely work too, but are not officially supported.
To get started with Target Node.js SDK, just add it as a dependency by installing from NPM:
npm i @adobe/target-nodejs-sdk -P
Please take a look at our documentation to learn how to use the Node.js SDK.
Check out our Contribution guidelines as well as Code of Conduct prior to contributing to Target Node.js SDK development.
- To build the project: npm run build
- To run the unit tests: npm test
- To generate code coverage after running the tests: npm run coverage
Production dependencies include:
< "@adobe-mcid/visitor-js-server": < "version": "2.0.0", "license": "Adobe Proprietary license" > >
Delivery API Client generation
The SDK depends on Target Open API. It uses Open API and the Open API generator to generate the low level HTTP client.
To be able to use Target Open API for code generation, we are leveraging Git subtree.
To refresh the local target-openapi subtree, use the command:
$ git subtree pull --prefix openapi git@github.com:adobe/target-openapi.git main --squash
The openapi-generator tool is located in the codegeneration directory, but there is no need to invoke it directly. Everything is wrapped in an npm command (execute from project root):
Build Cloud Native Code
Runtime, part of App Builder, brings your code to the cloud.
Integrated
As the foundation of App Builder, it is integrated with Adobe I/O events and offers easy, secure, fast access to Adobe APIs.
Serverless
Based on OpenWhisk and node.js, Adobe I/O Runtime runs any JavaScript code on Adobe’s infrastructure.
Flexible
Deploy actions using the Command Line Interface (AIO CLI) or REST APIs, enabling rapid development and continuous integration and deployment.
Server Not Required
Adobe I/O Runtime is Adobe’s serverless platform. Deploy custom code to respond to events and execute functions in the cloud — no server required.
Run cloud-native code to bring Adobe services together with APIs. Functions run in close proximity to content and data stored in other Adobe solutions.
Extend Adobe Solutions
Put a custom UI experience around your Runtime actions with App Builder or build a microservice.
Built on I/O Runtime and I/O Events, App Builder is a complete cloud native framework to extend the functionality of Adobe Experience Manager & Commerce solutions.
Secure and easy to manage
Get API authorization and user access control out of the box. Gain productivity and developer convenience with our framework of front and back-end tools.
Embedded Adobe API
Gain direct use of Adobe’s APIs and services. Easily access your content and data stored in Adobe’s Cloud Platform. Run code in response to Adobe I/O Events.
Automatic Scaling
Write your code, we manage the rest. Adobe I/O Runtime automatically scales based on requests, keeping performance high and costs low.
Code in Javascript, run in node.js
Use what you know and love: Javascript and node.js. Use npm and test locally. There’s no need to learn a whole new framework
Continuous Integration and Deployment
Use Git for an integrated deployment workflow so you don’t have to push code manually. Increase software quality and velocity of delivery
Powered by OpenWhisk
Based on Apache OpenWhisk, Adobe I/O Runtime is backed by a large open source community focused on improving cloud technology.
This package has been deprecated
Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
adobe-node
Control Adobe applications — such as Photoshop, Animate, Illustrator, InDesign — from node. Run JavaScript to remotely — from the command line — create, modify or export document content. This module can be used to automate the workflow by creating an action chain that can be executed without user intervention.
More information about writing scripts for Adobe applications:
Method | Arguments | Description |
---|---|---|
init | — | Initializes the AdobeApp instance/ starts Adobe Event Listener. |
on | event: string, callback: (message: BroadcastMessage) => void | Adds an event handler function to listen to an event so that when that event occurs, the callback will be triggered. |
runScript | script: string, options?: Options | Runs custom JavaScript |
selectDocument | document: string | Brings selected document to the front of the screen. |
saveDocument | . documents: string[] | Saves changes. |
saveAsDocument | document: string, saveAs: string, options: object | Saves the document in a specific format and location. Optionally you can specify the save options appropriate to the format. For more information on these options, see the script documentation for the selected Adobe product. |
openDocument | . documents: string[] | Opens documents. |
closeDocument | . documents: string[] | Closes documents. |
saveAndCloseDocument | . documents: string[] | Saves changes and closes the documents. |
newDocument | options?: NewDocumentOptions | Creates document. |
open | — | Opens the Adobe application. |
close | — | Closes the Adobe application. |
dispose | — | Closes Adobe Event Listener and rest of the AdobeApp components. |
Method | Type | Description |
---|---|---|
app | AdobeAppConfig | Adobe application config |
host | string | Domain name of the server. |
port | number | Port number on which the server is listening. |
appTimeout | number | Time after which the application process will close. Useful when the application freezes. By default — 0 — this option is off. |
jsPath | string | Location of the javaScript files. Default path is «./js» |
Method | Type | Description |
---|---|---|
name | AdobeAppName | Adobe application name. eg. AdobeAppName.Photoshop |
path | string | Path to the Adobe’s app executable file. |
adobeScriptsPath | string | Location of the Scripts directory of the selected Adobe app. |
Property | Type | Description |
---|---|---|
command | string | Command name |
stdout | string | Standard output |
stderr | string | Standard error |
Property | Type | Description |
---|---|---|
title | string | Name of the document |
width | number | Document width |
height | number | Document height |
. | any | + other custom, optional properties |
Event | Description |
---|---|
JS script file name | the event for a specific function called by the runScript() method |
AdobeAppEvent.OpenApp | — |
AdobeAppEvent.CloseApp | — |
AdobeAppEvent.NewDocument | — |
AdobeAppEvent.OpenDocument | — |
AdobeAppEvent.CloseDocument | — |
AdobeAppEvent.SelectDocument | — |
AdobeAppEvent.SaveDocument | — |
AdobeAppEvent.SaveAsDocument | — |
AdobeAppEvent.SaveAndCloseDocument | — |
import < newAdobeApp, AdobeAppName, AdobeAppEvent, AdobeApp, BroadcastMessage >from "adobe-node"; const sleep = (duration: number) => new Promise(resolve => < setTimeout(resolve, duration) >); const main = async () => < const app: AdobeApp = newAdobeApp(< app: < name: AdobeAppName.Photoshop, path: '/Applications/Adobe Photoshop CC 2019/Adobe Photoshop CC 2019.app/Contents/MacOS/Adobe Photoshop CC 2019', adobeScriptsPath: '/Applications/Adobe Photoshop CC 2019/Presets/Scripts' >, host: 'localhost', port: 5000 >); app.on(AdobeAppEvent.OpenApp, () => < console.log(`The Adobe App is open`); >) .on(AdobeAppEvent.NewDocument, () => < console.log(`The document has been created`); >) .on(AdobeAppEvent.OpenDocument, (data: any) => < console.log(`The document has been opened`); >) .on(AdobeAppEvent.CloseDocument, () => < console.log(`The document has been closed`); >) .on(AdobeAppEvent.CloseApp, () => < console.log(`The Adobe App has been closed`); >) .on("test_script", (message: BroadcastMessage) => < console.log(`Testing custom script - $`); >); app.init(); await app.open(); await app.openDocument('/test1.psd'); await sleep(2000); await app.closeDocument('/test1.psd'); await sleep(2000); await app.close(); app.dispose(); > main();
In Adobe applications you can run scripts in JSFL (Adobe Animate) and JSX (Photoshop, Illustrator etc.)
One of the features of this module is the ability to run a custom scripts written in javaScript .
There are a few things to explain, first of all this is the script template triggered in the selected Adobe application.
var ___> = (function() < var __stderr; var __stdout; try < > __stdout = > > catch (e) < __stderr = e; >finally < > > >)();
Texts between > are replaced with values prepared for a specific event/command. The javaScript code is pasted in the > placeholder.
As you can see > / JS code is assigned to the __stdout variable, this means that your javaScript code must be included in the IIFE function and it must also return a value — even if the logic doesn’t require it — which will be passed in to the event.
Running script without any arguments
. await app.runScript('/some_custom_script.js'); .
Running script with arguments
. await app.runScript('/some_custom_script.js', < title: "New Document", width: 1024, height: 768 >); .
The arguments/ options used in the runScript() method are pasted in the > placeholder.
These vars are also available in the IIFE .
Here is an example of a generated script file that runs in Adobe app.
var ___new_document = (function() < var __stderr; var __stdout; try < var title = "New Document"; var width = 1024; var height = 768; __stdout = (function()< var doc = app.documents.add(width, height, 72, title, NewDocumentMode.RGB, DocumentFill.TRANSPARENT, 1); return true; >()); > catch (e) < __stderr = e; >finally < app.system("adobe-broadcast --host='localhost' --port=5000 --msg=''"); > >)();
The generated adobe scripts files — jsx / jsfl — are saved in the location specified in the adobeScriptsPath configuration.
- API selectDocument()
- API saveAsDocument()
- API saveAndCloseDocument()
- Build-in scripts (currently only for Photoshop and Animate)
- adobe-node/scripts/photoshop|animate|illustrator|indesign|after_effects|acrobat/open_document.js
- adobe-node/scripts/photoshop|animate|illustrator|indesign|after_effects|acrobat/new_document.js
- adobe-node/scripts/photoshop|animate|illustrator|indesign|after_effects|acrobat/save_document.js
- adobe-node/scripts/photoshop|animate|illustrator|indesign|after_effects|acrobat/save_as_document.js
- adobe-node/scripts/photoshop|animate|illustrator|indesign|after_effects|acrobat/close_document.js
- adobe-node/scripts/photoshop|animate|illustrator|indesign|after_effects|acrobat/save_and_close_document.js
- adobe-node/scripts/photoshop|animate|illustrator|indesign|after_effects|acrobat/select_document.js
- API saveDocument() — removed optional argument saveAs , saving multiple documents in one call.
If the Adobe application does not start, try to:
sudo chown "/Applications/Adobe Photoshop CC 2019/Presets/Scripts/"
- It is also possible that you will need to change user config to enable custom scripts. For example, for Photoshop, add WarnRunningScripts 0 to the PSUserConfig.txt file in the Photoshop settings folder and restart Photoshop.
If any of the built-in functions does not work as you expected, you can write these functions yourself and run them via the runScript() method.
Feel free to contribute. If you have any ideas, requests just leave a message.
I’m not using Adobe applications, so it may happen that one of the built-in scripts does not work properly or is not optimal. I wrote it based on available resources. If you find an error or you think the script should be written in a different way. Let me know or even better implement your solution and I will add it.
Copyright (c) 2019 Radoslaw Kamysz