Skip to content

Commit b8bdc05

Browse files
Merge branch 'master' into feature/validate-webhook-message-code-example
2 parents 7775cf7 + e8e4043 commit b8bdc05

File tree

164 files changed

+6254
-2520
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+6254
-2520
lines changed

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
config/*
2+
public/*
3+
node_modules/*
4+
test/*

.eslintrc.json

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"commonjs": true,
5+
"es2021": true
6+
},
7+
"overrides": [
8+
],
9+
"parserOptions": {
10+
"ecmaVersion": "latest"
11+
},
12+
"rules": {
13+
"arrow-spacing": [1, { "before": true, "after": true }],
14+
"block-spacing": [1, "always"],
15+
"brace-style": [1, "1tbs", { "allowSingleLine": true }],
16+
"comma-spacing": [1, { "before": false, "after": true }],
17+
"comma-style": [1, "last"],
18+
"dot-location": [1, "property"],
19+
"eol-last": 1,
20+
"eqeqeq": [1, "always", {"null": "ignore"}],
21+
"key-spacing": [1, { "beforeColon": false, "afterColon": true }],
22+
"no-cond-assign": 1,
23+
"no-const-assign": 1,
24+
"no-debugger": 1,
25+
"no-delete-var": 1,
26+
"no-dupe-args": 1,
27+
"no-dupe-class-members": 1,
28+
"no-dupe-keys": 1,
29+
"no-duplicate-case": 1,
30+
"no-empty-character-class": 1,
31+
"no-labels": 1,
32+
"no-ex-assign": 1,
33+
"no-extra-boolean-cast": 1,
34+
"no-extra-parens": [1, "functions"],
35+
"no-fallthrough": 1,
36+
"no-floating-decimal": 1,
37+
"no-func-assign": 1,
38+
"no-implied-eval": 1,
39+
"no-inner-declarations": [1, "functions"],
40+
"no-invalid-regexp": 1,
41+
"no-irregular-whitespace": 1,
42+
"no-label-var": 1,
43+
"no-lone-blocks": 1,
44+
"no-mixed-spaces-and-tabs": 1,
45+
"no-multi-spaces": 1,
46+
"no-multi-str": 1,
47+
"no-multiple-empty-lines": [1, { "max": 2 }],
48+
"no-native-reassign": 1,
49+
"no-negated-in-lhs": 1,
50+
"no-new": 1,
51+
"no-new-func": 1,
52+
"no-new-require": 1,
53+
"no-new-wrappers": 1,
54+
"no-obj-calls": 1,
55+
"no-octal": 1,
56+
"no-octal-escape": 1,
57+
"no-return-assign": 1,
58+
"no-self-compare": 1,
59+
"no-sequences": 1,
60+
"no-shadow-restricted-names": 1,
61+
"no-spaced-func": 1,
62+
"no-sparse-arrays": 1,
63+
"no-throw-literal": 1,
64+
"no-trailing-spaces": 1,
65+
"no-undef-init": 1,
66+
"no-unexpected-multiline": 1,
67+
"no-unneeded-ternary": [1, { "defaultAssignment": false }],
68+
"no-unreachable": 1,
69+
"no-useless-call": 1,
70+
"no-with": 1,
71+
"one-var": [1, { "initialized": "never" }],
72+
"quotes": [1, "single", "avoid-escape"],
73+
"quote-props": [1, "as-needed"],
74+
"semi": [1, "always"],
75+
"semi-spacing": [1, { "before": false, "after": false }],
76+
"keyword-spacing": [1, { "before": true, "after": true }],
77+
"space-before-function-paren": [1, {
78+
"anonymous": "never",
79+
"named": "never",
80+
"asyncArrow": "always"
81+
}],
82+
"space-in-parens": [1, "never"],
83+
"space-infix-ops": 1,
84+
"space-unary-ops": [1, { "words": true, "nonwords": false }],
85+
"yoda": [1, "never"]
86+
}
87+
}

.github/workflows/node.js.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ jobs:
3131
npm cache clean --force
3232
npm cache verify
3333
npm install
34+
35+
- name: Run linter
36+
run: npm run lint
3437

3538
- name: Run build
3639
run: npm run build --if-present

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM --platform=linux/amd64 node:16-buster-slim
2+
3+
ARG UID=34251
4+
ARG GID=34251
5+
ARG USERNAME=ds
6+
ARG GROUPNAME=ds
7+
ARG USERSHELL=/bin/bash
8+
9+
RUN groupadd --system ${GROUPNAME} -g ${GID} && \
10+
useradd --create-home --shell ${USERSHELL} --system --no-log-init -g ${GROUPNAME} -u ${UID} ${USERNAME}
11+
12+
WORKDIR /home/${USERNAME}
13+
14+
COPY package.json package-lock.json ./
15+
RUN npm install
16+
17+
COPY . .
18+
19+
20+
RUN chown -R ${USERNAME}:${GROUPNAME} /home/${USERNAME}/
21+
USER ${USERNAME}
22+
23+
EXPOSE 3000
24+
25+
CMD ["npm", "start"]

azure-pipelines.yml

Lines changed: 97 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,112 @@
22
# Start with a minimal pipeline that you can customize to build and deploy your code.
33
# Add steps that build, run tests, deploy, and more:
44
# https://aka.ms/yaml
5+
resources:
6+
repositories:
7+
- repository: launcher-automation
8+
type: github
9+
name: docusign/launcher-automation
10+
ref: main
11+
endpoint: launcherAutomationServiceConnection
512

6-
trigger:
13+
pr:
714
- master
8-
9-
# pool:
10-
# vmImage: ubuntu-latest
15+
- releases/*
1116

1217
pool:
13-
name: defualt
18+
name: launcher-automation-pool
1419

1520
steps:
1621
- script: echo Hello, world!
1722
displayName: 'Run a one-line script'
23+
- checkout: self
24+
- checkout: launcher-automation
25+
26+
- script: dir $(Build.SourcesDirectory)
27+
28+
- task: DownloadSecureFile@1
29+
name: node_dockerfile
30+
displayName: 'download Dockerfile'
31+
inputs:
32+
secureFile: 'node.Dockerfile'
33+
34+
- script: |
35+
echo "place node.Dockerfile"
36+
echo $(node_dockerfile.secureFilePath)
37+
cp $(node_Dockerfile.secureFilePath) code-examples-node-private/Dockerfile
38+
displayName: 'place Dockerfile'
39+
40+
- script: |
41+
allure –-version
42+
java --version
43+
javac --version
44+
mvn --version
45+
docker --version
46+
47+
- task: DownloadSecureFile@1
48+
name: tests_config_properties
49+
displayName: 'download config.properties'
50+
inputs:
51+
secureFile: 'tests_config.properties'
52+
53+
54+
- script: |
55+
echo "place config.properties"
56+
echo $(tests_config_properties.secureFilePath)
57+
cp $(tests_config_properties.secureFilePath) launcher-automation/src/main/resources/config.properties
58+
displayName: 'place config.properties'
59+
60+
- task: DownloadSecureFile@1
61+
name: node_appsettings
62+
displayName: 'download appsettings.json'
63+
inputs:
64+
secureFile: 'node_appsettings.json'
65+
66+
67+
- script: |
68+
echo "place appsettings.json"
69+
cp $(node_appsettings.secureFilePath) code-examples-node-private/config/appsettings.json
70+
displayName: 'place appsettings.json'
71+
72+
73+
- task: DownloadSecureFile@1
74+
name: node_private_key
75+
displayName: 'download private.key'
76+
inputs:
77+
secureFile: 'private.key'
1878

19-
# - script: |
20-
# echo Add other tasks to build, test, and deploy your project.
21-
# echo See https://aka.ms/yaml
22-
# displayName: 'Run a multi-line script'
2379

2480
- script: |
25-
allure –-version
26-
java --version
27-
javac --version
28-
mvn --version
29-
docker --version
81+
echo "place private.key"
82+
cp $(node_private_key.secureFilePath) code-examples-node-private/config/private.key
83+
displayName: 'place private.key'
84+
85+
- script: dir $(Build.SourcesDirectory)
86+
87+
- script: dir $(Build.SourcesDirectory)/code-examples-node-private
88+
89+
- script: dir $(Build.SourcesDirectory)/code-examples-node-private/config
3090

91+
- task: Docker@2
92+
displayName: Build node image
93+
inputs:
94+
command: build
95+
repository: 'launcher-automation-node'
96+
dockerfile: '$(Build.SourcesDirectory)/code-examples-node-private/Dockerfile'
97+
buildContext: '$(Build.SourcesDirectory)/code-examples-node-private '
98+
tags: |
99+
latest
100+
101+
- script: |
102+
docker run -p 3000:3000 -d launcher-automation-node:latest
103+
displayName: 'start node app'
104+
105+
- script: |
106+
cd launcher-automation
107+
mvn clean test -DsuiteXmlFile="node_suite.xml"
108+
displayName: 'Node app tests'
109+
110+
- script: |
111+
docker stop $(docker ps -a -q)
112+
docker rm $(docker ps -a -q)
113+
displayName: 'stop node app'

embeddedSigning.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* @author DocuSign
55
*/
66

7-
const fs = require("fs-extra");
8-
const docusign = require("docusign-esign");
7+
const fs = require('fs-extra');
8+
const docusign = require('docusign-esign');
99

1010
/**
1111
* This function does the work of creating the envelope and the
@@ -21,9 +21,9 @@ const sendEnvelopeForEmbeddedSigning = async (args) => {
2121
//ds-snippet-start:eSign1Step3
2222
let dsApiClient = new docusign.ApiClient();
2323
dsApiClient.setBasePath(args.basePath);
24-
dsApiClient.addDefaultHeader("Authorization", "Bearer " + args.accessToken);
25-
let envelopesApi = new docusign.EnvelopesApi(dsApiClient),
26-
results = null;
24+
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);
25+
let envelopesApi = new docusign.EnvelopesApi(dsApiClient);
26+
let results = null;
2727

2828
// Step 1. Make the envelope request body
2929
let envelope = makeEnvelope(args.envelopeArgs);
@@ -65,7 +65,7 @@ function makeEnvelope(args) {
6565
// args.signerEmail
6666
// args.signerName
6767
// args.signerClientId
68-
// docFile
68+
// docFile
6969

7070
// document 1 (pdf) has tag /sn1/
7171
//
@@ -79,15 +79,15 @@ function makeEnvelope(args) {
7979

8080
// create the envelope definition
8181
let env = new docusign.EnvelopeDefinition();
82-
env.emailSubject = "Please sign this document";
82+
env.emailSubject = 'Please sign this document';
8383

8484
// add the documents
85-
let doc1 = new docusign.Document(),
86-
doc1b64 = Buffer.from(docPdfBytes).toString("base64");
85+
let doc1 = new docusign.Document();
86+
let doc1b64 = Buffer.from(docPdfBytes).toString('base64');
8787
doc1.documentBase64 = doc1b64;
88-
doc1.name = "Lorem Ipsum"; // can be different from actual file name
89-
doc1.fileExtension = "pdf";
90-
doc1.documentId = "3";
88+
doc1.name = 'Lorem Ipsum'; // can be different from actual file name
89+
doc1.fileExtension = 'pdf';
90+
doc1.documentId = '3';
9191

9292
// The order in the docs array determines the order in the envelope
9393
env.documents = [doc1];
@@ -108,10 +108,10 @@ function makeEnvelope(args) {
108108
// The DocuSign platform seaches throughout your envelope's
109109
// documents for matching anchor strings.
110110
let signHere1 = docusign.SignHere.constructFromObject({
111-
anchorString: "/sn1/",
112-
anchorYOffset: "10",
113-
anchorUnits: "pixels",
114-
anchorXOffset: "20",
111+
anchorString: '/sn1/',
112+
anchorYOffset: '10',
113+
anchorUnits: 'pixels',
114+
anchorXOffset: '20',
115115
});
116116
// Tabs are set per recipient / signer
117117
let signer1Tabs = docusign.Tabs.constructFromObject({
@@ -127,7 +127,7 @@ function makeEnvelope(args) {
127127

128128
// Request that the envelope be sent by setting |status| to "sent".
129129
// To request that the envelope be created as a draft, set to "created"
130-
env.status = "sent";
130+
env.status = 'sent';
131131

132132
return env;
133133
}
@@ -151,12 +151,12 @@ function makeRecipientViewRequest(args) {
151151
// the DocuSign signing. It's usually better to use
152152
// the session mechanism of your web framework. Query parameters
153153
// can be changed/spoofed very easily.
154-
viewRequest.returnUrl = args.dsReturnUrl + "?state=123";
154+
viewRequest.returnUrl = args.dsReturnUrl + '?state=123';
155155

156156
// How has your app authenticated the user? In addition to your app's
157157
// authentication, you can include authenticate steps from DocuSign.
158158
// Eg, SMS authentication
159-
viewRequest.authenticationMethod = "none";
159+
viewRequest.authenticationMethod = 'none';
160160

161161
// Recipient information must match embedded recipient info
162162
// we used to create the envelope.

0 commit comments

Comments
 (0)