Skip to content

Commit 54e5094

Browse files
author
Dom Fernandez
committed
reference app impl
1 parent 2107fea commit 54e5094

Some content is hidden

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

83 files changed

+16930
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ web_modules/
7878
.env.test.local
7979
.env.production.local
8080
.env.local
81+
development.env
82+
production.env
8183

8284
# parcel-bundler cache (https://parceljs.org/)
8385
.cache

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"printWidth": 150,
3+
"tabWidth": 2,
4+
"singleQuote": true,
5+
"trailingComma": "all",
6+
"semi": true,
7+
"arrowParens": "avoid"
8+
}
9+

Containerfile

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Global arguments
2+
ARG BASE_IMAGE=node:lts-alpine
3+
ARG APP_DIR=/usr/src/app
4+
ARG UID=1000
5+
ARG GID=1000
6+
ARG PORT=3000
7+
8+
# Base stage
9+
FROM ${BASE_IMAGE} AS base
10+
ARG APP_DIR
11+
ARG UID
12+
ARG GID
13+
ARG PORT
14+
15+
RUN mkdir -p ${APP_DIR} && \
16+
chown -R ${UID}:${GID} ${APP_DIR}
17+
18+
USER ${UID}:${GID}
19+
20+
WORKDIR ${APP_DIR}
21+
22+
ENV PORT=${PORT}
23+
EXPOSE ${PORT}
24+
25+
COPY --chown=${UID}:${GID} package.json .
26+
27+
# Dependencies stage
28+
FROM base AS dependencies
29+
ARG APP_DIR
30+
31+
RUN npm install && \
32+
npm cache clean --force && \
33+
touch ${APP_DIR}/production.env && \
34+
touch ${APP_DIR}/development.env
35+
36+
ENV PATH=${APP_DIR}/node_modules/.bin:$PATH
37+
38+
# Development stage
39+
FROM dependencies AS development
40+
ARG UID
41+
ARG GID
42+
43+
ENV NODE_ENV=development
44+
45+
COPY --chown=${UID}:${GID} . .
46+
47+
CMD ["npm", "run", "dev"]
48+
49+
# Build stage
50+
FROM dependencies AS build
51+
ARG UID
52+
ARG GID
53+
54+
COPY --chown=${UID}:${GID} . .
55+
56+
RUN npm run build
57+
58+
# Production stage
59+
FROM dependencies AS production
60+
ARG UID
61+
ARG GID
62+
ARG APP_DIR
63+
64+
ENV NODE_ENV=production
65+
66+
COPY --chown=${UID}:${GID} ./public ./public
67+
COPY --chown=${UID}:${GID} ./views ./views
68+
COPY --chown=${UID}:${GID} --from=build ${APP_DIR}/dist ./dist
69+
70+
CMD ["node", "./dist", "--env=production"]

Dockerfile

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Global arguments
2+
ARG BASE_IMAGE=node:lts-alpine
3+
ARG APP_DIR=/usr/src/app
4+
ARG UID=1000
5+
ARG GID=1000
6+
ARG PORT=3000
7+
8+
# Base stage
9+
FROM ${BASE_IMAGE} AS base
10+
ARG APP_DIR
11+
ARG UID
12+
ARG GID
13+
ARG PORT
14+
15+
RUN mkdir -p ${APP_DIR} && \
16+
chown -R ${UID}:${GID} ${APP_DIR}
17+
18+
USER ${UID}:${GID}
19+
20+
WORKDIR ${APP_DIR}
21+
22+
ENV PORT=${PORT}
23+
EXPOSE ${PORT}
24+
25+
# Dependencies stage
26+
FROM base AS dependencies
27+
ARG APP_DIR
28+
29+
RUN --mount=type=bind,source=./package.json,target=${APP_DIR}/package.json \
30+
--mount=type=cache,target=${APP_DIR}/.npm,uid=$UID,gid=$GID,mode=0755,sharing=locked \
31+
npm install && \
32+
touch ${APP_DIR}/production.env && \
33+
touch ${APP_DIR}/development.env
34+
35+
ENV PATH=${APP_DIR}/node_modules/.bin:$PATH
36+
37+
# Development stage
38+
FROM dependencies AS development
39+
ARG UID
40+
ARG GID
41+
42+
ENV NODE_ENV=development
43+
44+
COPY --chown=${UID}:${GID} . .
45+
46+
CMD ["npm", "run", "dev"]
47+
48+
# Build stage
49+
FROM dependencies AS build
50+
ARG UID
51+
ARG GID
52+
53+
COPY --chown=${UID}:${GID} . .
54+
55+
RUN npm run build
56+
57+
# Production stage
58+
FROM dependencies AS production
59+
ARG UID
60+
ARG GID
61+
ARG APP_DIR
62+
63+
ENV NODE_ENV=production
64+
65+
COPY --chown=${UID}:${GID} package.json .
66+
COPY --chown=${UID}:${GID} ./public ./public
67+
COPY --chown=${UID}:${GID} ./views ./views
68+
COPY --chown=${UID}:${GID} --from=build ${APP_DIR}/dist ./dist
69+
70+
CMD ["node", "./dist", "--env=production"]

example.development.env

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## THIS IS A TEMPLATE FILE ##
2+
## COPY BELOW CONTENT TO development.env ##
3+
4+
NODE_ENV=development
5+
JWT_SECRET_KEY=1aed...
6+
OAUTH_CLIENT_ID=6f22...
7+
OAUTH_CLIENT_SECRET=29av...
8+
AUTHORIZATION_CODE=7905...
9+
PORT=3000

example.production.env

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## THIS IS A TEMPLATE FILE ##
2+
## COPY BELOW CONTENT TO production.env ##
3+
4+
NODE_ENV=production
5+
JWT_SECRET_KEY=1aed...
6+
OAUTH_CLIENT_ID=6f22...
7+
OAUTH_CLIENT_SECRET=29av...
8+
AUTHORIZATION_CODE=7905...
9+
PORT=3000

jest.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/** @type {import('ts-jest').JestConfigWithTsJest} **/
2+
module.exports = {
3+
testEnvironment: "node",
4+
transform: {
5+
"^.+.tsx?$": ["ts-jest",{}],
6+
},
7+
};

manifest.json

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"name": "Connected Fields App",
3+
"description": {
4+
"short": "App for Connected Fields",
5+
"long": "This app is designed to allow users to use connected fields extensions"
6+
},
7+
"termsOfServiceUrl": "https://www.johndoe.com/tos",
8+
"privacyUrl": "https://www.johndoe.com/privacy-security",
9+
"supportUrl": "https://www.johndoe.com/support",
10+
"publisher": {
11+
"name": "John Doe",
12+
"email": "[email protected]",
13+
"phone": "800-867-5309",
14+
"website": "https://www.johndoe.com"
15+
},
16+
"connections": [
17+
{
18+
"name": "authentication",
19+
"description": "Secure connection to the connected fields proxy",
20+
"type": "oauth2",
21+
"params": {
22+
"provider": "CUSTOM",
23+
"clientId": "<CLIENT_ID>",
24+
"clientSecret": "<CLIENT_SECRET>",
25+
"scopes": [],
26+
"customConfig": {
27+
"authorizationMethod": "header",
28+
"authorizationParams": {
29+
"prompt": "consent",
30+
"access_type": "offline"
31+
},
32+
"authorizationUrl": "<PROXY_BASE_URL>/api/oauth/consent",
33+
"requiredScopes": [],
34+
"scopeSeparator": " ",
35+
"tokenUrl": "<PROXY_BASE_URL>/api/oauth/token",
36+
"refreshScopes": []
37+
}
38+
}
39+
}
40+
],
41+
"icon": {
42+
"data": "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABQVBMVEUAAAD/AACAAP//gID/VVX/Zmb/SUn/VVX/XV3/VVVLAP//S0v/UVFOAP//Tk7/VVX/UFD/VVX/U1P/UVGTIKb/U1NPAP//U1P/UFBLAP+HG7n/UVH/VFT/UVH/UVH/U1P/UVH/U1P/UVH/U1P/UlL/UVH/U1NNAP//UVH/UVH/UVFNAP//UlL/UlL/UlL/UlJLAP//UlL/UlL/U1MTAD5KGBheHx9HFhZGFhZFFhb/UlJMGRk+ExNNGBg8ExP/UlL/UlJAFBT/U1P/UlL/U1P/UlL/UlL/UlL/UlLZRkb/UlL/UlL/UlL/UlJDAOLiSUn/UlL/UlJEAOf/U1NGAO3/UlL/UVFHAPH/UlL/UlLxTU1MAP//UlIAAABMAP//UlL/UlJMAP8AAAD/UlL/UlIAAABMAP/9UVH+UlL/UlL///8T+Es2AAAAZXRSTlMAAQICAwUHCQsMEREWGhoeICQlJigoKiswM0JCRkhVVlhiZWlqd3h7h4qNj5OcoqWprK+2wMDAwcLDxMXIyMnKy8zMzc/T1tfd4uLk5ebo6Onq6+7v7/Hz8/T19vf5+fn6+/z8/hoS1SAAAAABYktHRGolYpUOAAABQElEQVRYw+3Wx1YCQRBG4TJjxBwxY8CAOWfBnBXMCqI1Wu//Am5cyDQ9Pe2/cTF339+qTlUTKU1kRNPD5VZ8sJEMVYuhRLTCE6gTY2fREgwQWW0AAbmJgIC894GAZLtBQNJNICDJMhCQIRS4rwEBiaFAOgQC0o8CcyjwXAkC0kXFrR35dR65e/QAhmnacXXO7nKLemCK3swA84J+MZDjB+A1HXDsE+Al3Sj5BXhZsxV8A7zyBQK8Xki4tQB4p4BwagPw5qcCbFsBvKEAs3ZATpnqUTuAL9xADwqEQeCAQGAMBdpBYJdAoBcE9kpBIEIYMEkYsB/CgKuff9ZfgZM2goBEPSFANlZOWiBlBDLxll+3VAGc+RcP4ONwZiD/Y+N4dJdydd1cpFxzx6paCoAACIB/CzxZAVUqMGIhvI6r778B8fsX3rztq9YAAAAASUVORK5CYII=",
43+
"mediaType": "image/png"
44+
},
45+
"screenshots": [],
46+
"extensions": [
47+
{
48+
"name": "My Connected Fields Extension",
49+
"description": "Used to verify and autofill agreements with custom data models",
50+
"template": "ConnectedFields.Version1.ConnectedFields",
51+
"actionReferences": [
52+
"My Verify Action",
53+
"My GetTypeNames Action",
54+
"My GetTypeDefinitions Action"
55+
]
56+
}
57+
],
58+
"actions": [
59+
{
60+
"name": "My Verify Action",
61+
"description": "This is a description of my verify action",
62+
"template": "ConnectedFields.Version1.Verify",
63+
"connectionsReference": "authentication",
64+
"params": {
65+
"uri": "<PROXY_BASE_URL>/api/verify"
66+
}
67+
},
68+
{
69+
"name": "My GetTypeNames Action",
70+
"description": "This is a description of my GetTypeNames action",
71+
"template": "DataIO.Version6.GetTypeNames",
72+
"connectionsReference": "authentication",
73+
"params": {
74+
"uri": "<PROXY_BASE_URL>/api/getTypeNames"
75+
}
76+
},
77+
{
78+
"name": "My GetTypeDefinitions Action",
79+
"description": "This is a description of my GetTypeDefinitions action",
80+
"template": "DataIO.Version6.GetTypeDefinitions",
81+
"connectionsReference": "authentication",
82+
"params": {
83+
"uri": "<PROXY_BASE_URL>/api/getTypeDefinitions"
84+
}
85+
}
86+
],
87+
"publicationRegions": [
88+
"US"
89+
],
90+
"distribution": "PUBLIC"
91+
}

0 commit comments

Comments
 (0)