@nzz/q-cli 1.10.3 → 2.0.0-beta.10
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 +22 -313
- package/dist/createCustomCodeItem.js +70 -0
- package/dist/enums.js +6 -0
- package/dist/index.js +80 -0
- package/dist/interfaces.js +1 -0
- package/dist/newCustomCode.js +107 -0
- package/dist/updateItem.js +140 -0
- package/dist/utils.js +88 -0
- package/package.json +29 -36
- package/.nvmrc +0 -1
- package/.travis.yml +0 -17
- package/.vscode/launch.json +0 -36
- package/.vscode/settings.json +0 -5
- package/LICENSE +0 -21
- package/bin/commands/bootstrap.js +0 -68
- package/bin/commands/qItem/configStore.js +0 -144
- package/bin/commands/qItem/copyItem/copyItem.js +0 -103
- package/bin/commands/qItem/copyItem/copySchema.json +0 -37
- package/bin/commands/qItem/createCustomCodeItem/createCustomCodeItem.js +0 -81
- package/bin/commands/qItem/createCustomCodeItem/schema.json +0 -41
- package/bin/commands/qItem/helpers.js +0 -102
- package/bin/commands/qItem/itemService.js +0 -310
- package/bin/commands/qItem/resourcesService.js +0 -148
- package/bin/commands/qItem/schemaService.js +0 -65
- package/bin/commands/qItem/updateItem/updateItem.js +0 -64
- package/bin/commands/server.js +0 -80
- package/bin/q.js +0 -213
- package/dev-server/config/default.js +0 -51
- package/dev-server/public/favicon.ico +0 -0
- package/dev-server/public/style.css +0 -64
- package/dev-server/routes/dev-view.js +0 -52
- package/dev-server/routes/file.js +0 -10
- package/dev-server/routes/rendering-info.js +0 -130
- package/dev-server/routes/routes.js +0 -6
- package/dev-server/routes/tool-default.js +0 -108
- package/dev-server/server-plugins.js +0 -1
- package/dev-server/server.js +0 -18
- package/dev-server/views/index.html +0 -184
- package/skeletons/custom-code-skeleton/.nvmrc +0 -1
- package/skeletons/custom-code-skeleton/.vscode/settings.json +0 -5
- package/skeletons/custom-code-skeleton/README.md +0 -26
- package/skeletons/custom-code-skeleton/index.d.ts +0 -3
- package/skeletons/custom-code-skeleton/package-lock.json +0 -7355
- package/skeletons/custom-code-skeleton/package.json +0 -46
- package/skeletons/custom-code-skeleton/q.config.json +0 -60
- package/skeletons/custom-code-skeleton/rollup.config.js +0 -185
- package/skeletons/custom-code-skeleton/src/App.scss +0 -5
- package/skeletons/custom-code-skeleton/src/App.svelte +0 -7
- package/skeletons/custom-code-skeleton/src/enums.ts +0 -0
- package/skeletons/custom-code-skeleton/src/interfaces.ts +0 -0
- package/skeletons/custom-code-skeleton/src/main-prod.ts +0 -4
- package/skeletons/custom-code-skeleton/src/main.scss +0 -1
- package/skeletons/custom-code-skeleton/src/main.ts +0 -18
- package/skeletons/custom-code-skeleton/tsconfig.json +0 -16
- package/skeletons/et-utils-package-skeleton/.nvmrc +0 -1
- package/skeletons/et-utils-package-skeleton/README.md +0 -12
- package/skeletons/et-utils-package-skeleton/jest.config.ts +0 -17
- package/skeletons/et-utils-package-skeleton/package-lock.json +0 -3969
- package/skeletons/et-utils-package-skeleton/package.json +0 -40
- package/skeletons/et-utils-package-skeleton/scripts/package-fixup.sh +0 -13
- package/skeletons/et-utils-package-skeleton/src/Service.ts +0 -8
- package/skeletons/et-utils-package-skeleton/src/index.ts +0 -4
- package/skeletons/et-utils-package-skeleton/test/Service.spec.ts +0 -10
- package/skeletons/et-utils-package-skeleton/test/tsconfig.json +0 -8
- package/skeletons/et-utils-package-skeleton/tsconfig-base.json +0 -10
- package/skeletons/et-utils-package-skeleton/tsconfig-cjs.json +0 -8
- package/skeletons/et-utils-package-skeleton/tsconfig.json +0 -8
- package/skeletons/server-skeleton/.nvmrc +0 -1
- package/skeletons/server-skeleton/Dockerfile +0 -19
- package/skeletons/server-skeleton/auth/routes.js +0 -85
- package/skeletons/server-skeleton/auth/strategyOptions.js +0 -28
- package/skeletons/server-skeleton/config/base.js +0 -45
- package/skeletons/server-skeleton/config/db.js +0 -6
- package/skeletons/server-skeleton/config/editor.js +0 -105
- package/skeletons/server-skeleton/config/rendering-info.js +0 -70
- package/skeletons/server-skeleton/config/screenshot.js +0 -80
- package/skeletons/server-skeleton/config/targets.js +0 -31
- package/skeletons/server-skeleton/config/tools.js +0 -65
- package/skeletons/server-skeleton/files/favicon.png +0 -0
- package/skeletons/server-skeleton/files/system.js +0 -3612
- package/skeletons/server-skeleton/index.js +0 -106
- package/skeletons/server-skeleton/package-lock.json +0 -1825
- package/skeletons/server-skeleton/package.json +0 -29
- package/skeletons/tool-skeleton/.dockerignore +0 -1
- package/skeletons/tool-skeleton/.nvmrc +0 -1
- package/skeletons/tool-skeleton/.travis.yml +0 -26
- package/skeletons/tool-skeleton/.vscode/settings.json +0 -5
- package/skeletons/tool-skeleton/Dockerfile +0 -19
- package/skeletons/tool-skeleton/LICENSE +0 -20
- package/skeletons/tool-skeleton/README.md +0 -104
- package/skeletons/tool-skeleton/index.js +0 -32
- package/skeletons/tool-skeleton/package-lock.json +0 -10108
- package/skeletons/tool-skeleton/package.json +0 -45
- package/skeletons/tool-skeleton/resources/display-options-schema.json +0 -11
- package/skeletons/tool-skeleton/resources/fixtures/data/basic.json +0 -4
- package/skeletons/tool-skeleton/resources/locales/de/translation.json +0 -1
- package/skeletons/tool-skeleton/resources/locales/en/translation.json +0 -1
- package/skeletons/tool-skeleton/resources/locales/fr/translation.json +0 -1
- package/skeletons/tool-skeleton/resources/schema.json +0 -16
- package/skeletons/tool-skeleton/rollup.config.js +0 -75
- package/skeletons/tool-skeleton/routes/fixtures/data.js +0 -15
- package/skeletons/tool-skeleton/routes/health.js +0 -10
- package/skeletons/tool-skeleton/routes/locales.js +0 -21
- package/skeletons/tool-skeleton/routes/rendering-info/web.js +0 -97
- package/skeletons/tool-skeleton/routes/routes.js +0 -8
- package/skeletons/tool-skeleton/routes/schema.js +0 -19
- package/skeletons/tool-skeleton/routes/script.js +0 -17
- package/skeletons/tool-skeleton/routes/stylesheet.js +0 -17
- package/skeletons/tool-skeleton/sass.config.js +0 -66
- package/skeletons/tool-skeleton/scripts_src/default.js +0 -3
- package/skeletons/tool-skeleton/styles_src/_variables.scss +0 -1
- package/skeletons/tool-skeleton/styles_src/main.scss +0 -2
- package/skeletons/tool-skeleton/test/e2e-tests.js +0 -162
- package/skeletons/tool-skeleton/views/dynamic/YourTool.scss +0 -5
- package/skeletons/tool-skeleton/views/dynamic/YourTool.svelte +0 -19
- package/skeletons/tool-skeleton/views/static/App.scss +0 -5
- package/skeletons/tool-skeleton/views/static/App.svelte +0 -21
- package/skeletons/tool-skeleton/views/static/components/Footer.svelte +0 -31
- package/skeletons/tool-skeleton/views/static/components/Header.svelte +0 -7
- package/skeletons/toolv2-skeleton/.husky/pre-commit +0 -6
- package/skeletons/toolv2-skeleton/.nvmrc +0 -1
- package/skeletons/toolv2-skeleton/.prettierrc.cjs +0 -15
- package/skeletons/toolv2-skeleton/.travis.yml +0 -30
- package/skeletons/toolv2-skeleton/.vscode/settings.json +0 -6
- package/skeletons/toolv2-skeleton/Dockerfile +0 -19
- package/skeletons/toolv2-skeleton/LICENSE +0 -21
- package/skeletons/toolv2-skeleton/README.md +0 -99
- package/skeletons/toolv2-skeleton/dev.js +0 -7
- package/skeletons/toolv2-skeleton/index.js +0 -39
- package/skeletons/toolv2-skeleton/jest.config.ts +0 -39
- package/skeletons/toolv2-skeleton/nodemon.json +0 -4
- package/skeletons/toolv2-skeleton/package-lock.json +0 -21382
- package/skeletons/toolv2-skeleton/package.json +0 -80
- package/skeletons/toolv2-skeleton/resources/display-options-schema.json +0 -11
- package/skeletons/toolv2-skeleton/resources/locales/de/translation.json +0 -8
- package/skeletons/toolv2-skeleton/resources/locales/en/translation.json +0 -10
- package/skeletons/toolv2-skeleton/resources/locales/fr/translation.json +0 -10
- package/skeletons/toolv2-skeleton/resources/schema.json +0 -66
- package/skeletons/toolv2-skeleton/rollup.config.js +0 -48
- package/skeletons/toolv2-skeleton/scripts/postinstall.sh +0 -5
- package/skeletons/toolv2-skeleton/src/.eslintrc.cjs +0 -52
- package/skeletons/toolv2-skeleton/src/components/Main.spec.ts +0 -15
- package/skeletons/toolv2-skeleton/src/components/Main.svelte +0 -32
- package/skeletons/toolv2-skeleton/src/enums.ts +0 -11
- package/skeletons/toolv2-skeleton/src/helpers/fixture-generators.ts +0 -38
- package/skeletons/toolv2-skeleton/src/helpers/toolRuntimeConfig.ts +0 -15
- package/skeletons/toolv2-skeleton/src/interfaces.ts +0 -82
- package/skeletons/toolv2-skeleton/src/modules.d.ts +0 -8
- package/skeletons/toolv2-skeleton/src/routes/dynamic-schemas/exampleDynamicSchema.ts +0 -49
- package/skeletons/toolv2-skeleton/src/routes/dynamic-schemas/index.ts +0 -5
- package/skeletons/toolv2-skeleton/src/routes/health.ts +0 -14
- package/skeletons/toolv2-skeleton/src/routes/locales.ts +0 -31
- package/skeletons/toolv2-skeleton/src/routes/notifications/exampleNotification.ts +0 -46
- package/skeletons/toolv2-skeleton/src/routes/option-availability.ts +0 -27
- package/skeletons/toolv2-skeleton/src/routes/rendering-info/web.ts +0 -150
- package/skeletons/toolv2-skeleton/src/routes/routes.ts +0 -21
- package/skeletons/toolv2-skeleton/src/routes/schema.ts +0 -21
- package/skeletons/toolv2-skeleton/src/routes/stylesheet.ts +0 -31
- package/skeletons/toolv2-skeleton/src/styles/main.scss +0 -6
- package/skeletons/toolv2-skeleton/svelte.config.cjs +0 -6
- package/skeletons/toolv2-skeleton/tasks/compileStyleFiles.cjs +0 -101
- package/skeletons/toolv2-skeleton/tests/e2e-tests.spec.ts +0 -158
- package/skeletons/toolv2-skeleton/tests/helpers.ts +0 -21
- package/skeletons/toolv2-skeleton/tsconfig.json +0 -48
- /package/{bin/commands/qItem/updateItem → dist/assets}/updateSchema.json +0 -0
@@ -1,40 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "@nzz/et-utils-<package-name>",
|
3
|
-
"version": "1.0.0",
|
4
|
-
"description": "<package-description>",
|
5
|
-
"repository": {
|
6
|
-
"type": "git",
|
7
|
-
"url": "git+https://github.com/nzzdev/ed-tech-utilities.git",
|
8
|
-
"directory": "<package-name>"
|
9
|
-
},
|
10
|
-
"scripts": {
|
11
|
-
"prepublishOnly": "npm run test && npm run clean && npm run buildMjs && npm run buildCjs && ./scripts/package-fixup.sh",
|
12
|
-
"clean": "rimraf dist",
|
13
|
-
"buildMjs": "tsc -p tsconfig.json",
|
14
|
-
"buildCjs": "tsc -p tsconfig-cjs.json",
|
15
|
-
"start": "npm run buildMjs -- -w",
|
16
|
-
"test": "jest --config jest.config.ts"
|
17
|
-
},
|
18
|
-
"main": "dist/cjs/index.js",
|
19
|
-
"module": "dist/mjs/index.js",
|
20
|
-
"exports": {
|
21
|
-
".": {
|
22
|
-
"import": "./dist/mjs/index.js",
|
23
|
-
"require": "./dist/cjs/index.js"
|
24
|
-
}
|
25
|
-
},
|
26
|
-
"publishConfig": {
|
27
|
-
"access": "public"
|
28
|
-
},
|
29
|
-
"devDependencies": {
|
30
|
-
"@types/jest": "^27.5.1",
|
31
|
-
"@types/node": "^16.11.36",
|
32
|
-
"jest": "^28.1.0",
|
33
|
-
"rimraf": "^3.0.2",
|
34
|
-
"ts-jest": "^28.0.3",
|
35
|
-
"ts-node": "^10.8.0",
|
36
|
-
"typescript": "^4.6.4"
|
37
|
-
},
|
38
|
-
"author": "<author-name>",
|
39
|
-
"license": "MIT"
|
40
|
-
}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import { someFunction } from "../src";
|
2
|
-
|
3
|
-
describe("Service", () => {
|
4
|
-
it("should return the konami cheatcode", () => {
|
5
|
-
const result = someFunction();
|
6
|
-
const expectedResult = "Up, Up, Down, Down, Left, Right, Left, Right, B, A";
|
7
|
-
|
8
|
-
expect(result).toEqual(expectedResult);
|
9
|
-
});
|
10
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
14
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# Use following version of node alpine as the base image
|
2
|
-
FROM node:14-alpine
|
3
|
-
|
4
|
-
# Set work directory for run/cmd
|
5
|
-
WORKDIR /app
|
6
|
-
|
7
|
-
# Copy package.json and package-lock.json into work directory and install dependencies
|
8
|
-
COPY package.json /app/package.json
|
9
|
-
COPY package-lock.json /app/package-lock.json
|
10
|
-
RUN npm install --production
|
11
|
-
|
12
|
-
# Copy everthing else in work directory
|
13
|
-
COPY . /app
|
14
|
-
|
15
|
-
# Expose server port
|
16
|
-
EXPOSE 3001
|
17
|
-
|
18
|
-
# Run node
|
19
|
-
CMD node index.js
|
@@ -1,85 +0,0 @@
|
|
1
|
-
const Joi = require("joi");
|
2
|
-
const Boom = require("@hapi/boom");
|
3
|
-
|
4
|
-
module.exports = [
|
5
|
-
{
|
6
|
-
path: "/authenticate",
|
7
|
-
method: "POST",
|
8
|
-
options: {
|
9
|
-
validate: {
|
10
|
-
payload: {
|
11
|
-
username: Joi.string().required(),
|
12
|
-
password: Joi.string().required(),
|
13
|
-
},
|
14
|
-
},
|
15
|
-
},
|
16
|
-
handler: async (request, h) => {
|
17
|
-
if (
|
18
|
-
request.payload.username === "demo-user" ||
|
19
|
-
request.payload.username === "demo-expert" ||
|
20
|
-
request.payload.username === "demo-poweruser"
|
21
|
-
) {
|
22
|
-
return {
|
23
|
-
access_token: request.payload.username,
|
24
|
-
};
|
25
|
-
}
|
26
|
-
},
|
27
|
-
},
|
28
|
-
{
|
29
|
-
path: "/user",
|
30
|
-
method: "GET",
|
31
|
-
config: {
|
32
|
-
auth: "q-auth",
|
33
|
-
},
|
34
|
-
handler: (request, h) => {
|
35
|
-
if (!request.auth.isAuthenticated) {
|
36
|
-
throw Boom.unauthorized();
|
37
|
-
}
|
38
|
-
|
39
|
-
const user = {
|
40
|
-
username: request.auth.credentials.name,
|
41
|
-
department: "Politics",
|
42
|
-
publication: "pub1",
|
43
|
-
initials: "🤖",
|
44
|
-
};
|
45
|
-
|
46
|
-
if (
|
47
|
-
user.username === "demo-expert" ||
|
48
|
-
user.username === "demo-poweruser"
|
49
|
-
) {
|
50
|
-
user.roles = [
|
51
|
-
"expert-election-executive",
|
52
|
-
"expert-election-votes",
|
53
|
-
"expert-election-seats",
|
54
|
-
"expert-map",
|
55
|
-
"expert-chart",
|
56
|
-
"expert-coalition-calculation",
|
57
|
-
];
|
58
|
-
}
|
59
|
-
|
60
|
-
if (user.username === "demo-poweruser") {
|
61
|
-
user.roles.push("poweruser");
|
62
|
-
}
|
63
|
-
|
64
|
-
return user;
|
65
|
-
},
|
66
|
-
},
|
67
|
-
{
|
68
|
-
path: "/user",
|
69
|
-
method: "PUT",
|
70
|
-
config: {
|
71
|
-
auth: "q-auth",
|
72
|
-
validate: {
|
73
|
-
payload: {
|
74
|
-
username: Joi.string().required(),
|
75
|
-
},
|
76
|
-
options: {
|
77
|
-
allowUnknown: true,
|
78
|
-
},
|
79
|
-
},
|
80
|
-
},
|
81
|
-
handler: async (request, h) => {
|
82
|
-
return "ok";
|
83
|
-
},
|
84
|
-
},
|
85
|
-
];
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
allowQueryToken: false, // optional, true by default
|
3
|
-
allowMultipleHeaders: false, // optional, false by default
|
4
|
-
accessTokenName: "access_token", // optional, 'access_token' by default
|
5
|
-
validate: async function (request, token, h) {
|
6
|
-
const user = {};
|
7
|
-
|
8
|
-
if (token.includes("demo-user")) {
|
9
|
-
user.name = "demo-user";
|
10
|
-
} else if (token.includes("demo-expert")) {
|
11
|
-
user.name = "demo-expert";
|
12
|
-
} else if (token.includes("demo-poweruser")) {
|
13
|
-
user.name = "demo-poweruser";
|
14
|
-
} else {
|
15
|
-
return {
|
16
|
-
isValid: false,
|
17
|
-
};
|
18
|
-
}
|
19
|
-
|
20
|
-
user.token = token;
|
21
|
-
user.email = user.name + "@q.tools";
|
22
|
-
|
23
|
-
return {
|
24
|
-
isValid: true,
|
25
|
-
credentials: user,
|
26
|
-
};
|
27
|
-
},
|
28
|
-
};
|
@@ -1,45 +0,0 @@
|
|
1
|
-
const Confidence = require("confidence");
|
2
|
-
|
3
|
-
const base = {
|
4
|
-
cache: {
|
5
|
-
cacheControl: {
|
6
|
-
// these are the default cache-control headers used for the tool-default route in case a tool is not responding with it's own directives.
|
7
|
-
public: true,
|
8
|
-
maxAge: {
|
9
|
-
$filter: "env",
|
10
|
-
local: 1,
|
11
|
-
$default: 60
|
12
|
-
},
|
13
|
-
sMaxAge: {
|
14
|
-
$filter: "env",
|
15
|
-
local: 1,
|
16
|
-
$default: 60
|
17
|
-
},
|
18
|
-
staleWhileRevalidate: {
|
19
|
-
// this is just for the CDN, it will serve maximum 24 hours old content while revalidating in the background
|
20
|
-
$filter: "env",
|
21
|
-
local: 1,
|
22
|
-
$default: 60 * 60 * 24
|
23
|
-
},
|
24
|
-
staleIfError: {
|
25
|
-
// this is just for the CDN, it will serve maximum 7 days old content if the backend is not running
|
26
|
-
$filter: "env",
|
27
|
-
local: 1,
|
28
|
-
$default: 60 * 60 * 24 * 7
|
29
|
-
}
|
30
|
-
}
|
31
|
-
}
|
32
|
-
};
|
33
|
-
|
34
|
-
const env = process.env.APP_ENV || "local";
|
35
|
-
const store = new Confidence.Store(base);
|
36
|
-
|
37
|
-
module.exports.get = (key, criteria = {}) => {
|
38
|
-
criteria = Object.assign({ env: env }, criteria);
|
39
|
-
return store.get(key, criteria);
|
40
|
-
};
|
41
|
-
|
42
|
-
module.exports.meta = (key, criteria = {}) => {
|
43
|
-
criteria = Object.assign({ env: env }, criteria);
|
44
|
-
return store.meta(key, criteria);
|
45
|
-
};
|
@@ -1,105 +0,0 @@
|
|
1
|
-
const Confidence = require("confidence");
|
2
|
-
|
3
|
-
const editorConfig = {
|
4
|
-
auth: {
|
5
|
-
type: "token"
|
6
|
-
},
|
7
|
-
languages: [
|
8
|
-
{
|
9
|
-
key: "en",
|
10
|
-
label: "en"
|
11
|
-
},
|
12
|
-
{
|
13
|
-
key: "de",
|
14
|
-
label: "de"
|
15
|
-
},
|
16
|
-
{
|
17
|
-
key: "fr",
|
18
|
-
label: "fr"
|
19
|
-
}
|
20
|
-
],
|
21
|
-
departments: ["Economics", "Politics"],
|
22
|
-
publications: [
|
23
|
-
{
|
24
|
-
key: "pub1",
|
25
|
-
label: "Publication 1",
|
26
|
-
previewTarget: "target1"
|
27
|
-
}
|
28
|
-
],
|
29
|
-
lowNewItems: {
|
30
|
-
threshold: 1,
|
31
|
-
days: 365
|
32
|
-
},
|
33
|
-
itemList: {
|
34
|
-
itemsPerLoad: 18
|
35
|
-
},
|
36
|
-
help: {
|
37
|
-
intro: "This is the Q editor. Just click around to learn how it works.",
|
38
|
-
faq: [
|
39
|
-
{
|
40
|
-
question: "What is Q?",
|
41
|
-
answer:
|
42
|
-
"Q is a browser-based toolbox that allows reporters and editors to create simple graphics and interactive elements for their stories."
|
43
|
-
}
|
44
|
-
]
|
45
|
-
},
|
46
|
-
stylesheets: [
|
47
|
-
{
|
48
|
-
// Roboto is used in Q editor
|
49
|
-
url: "https://fonts.googleapis.com/css?family=Roboto:400,700&subset=latin"
|
50
|
-
}
|
51
|
-
// if needed add some stylesheets here for preview, e.g. font-faces which do not work in ShadowRoot
|
52
|
-
],
|
53
|
-
uiBehavior: {
|
54
|
-
useItemDialogToActivate: false
|
55
|
-
},
|
56
|
-
eastereggs: {
|
57
|
-
sounds: {
|
58
|
-
m: "",
|
59
|
-
q: "",
|
60
|
-
bondTheme: ""
|
61
|
-
}
|
62
|
-
},
|
63
|
-
previewSizes: {
|
64
|
-
small: {
|
65
|
-
value: 290,
|
66
|
-
min_height: 568,
|
67
|
-
label_locales: {
|
68
|
-
de: "Mobile",
|
69
|
-
en: "Mobile",
|
70
|
-
fr: "Mobile"
|
71
|
-
}
|
72
|
-
},
|
73
|
-
medium: {
|
74
|
-
value: 560,
|
75
|
-
min_height: 768,
|
76
|
-
label_locales: {
|
77
|
-
de: "Artikelbreite",
|
78
|
-
en: "Content",
|
79
|
-
fr: "Content"
|
80
|
-
}
|
81
|
-
},
|
82
|
-
large: {
|
83
|
-
value: 800,
|
84
|
-
min_height: 768,
|
85
|
-
label_locales: {
|
86
|
-
de: "Volle Breite",
|
87
|
-
en: "Full",
|
88
|
-
fr: "Complet"
|
89
|
-
}
|
90
|
-
}
|
91
|
-
}
|
92
|
-
};
|
93
|
-
|
94
|
-
const env = process.env.APP_ENV || "local";
|
95
|
-
const store = new Confidence.Store(editorConfig);
|
96
|
-
|
97
|
-
module.exports.get = (key, criteria = {}) => {
|
98
|
-
criteria = Object.assign({ env: env }, criteria);
|
99
|
-
return store.get(key, criteria);
|
100
|
-
};
|
101
|
-
|
102
|
-
module.exports.meta = (key, criteria = {}) => {
|
103
|
-
criteria = Object.assign({ env: env }, criteria);
|
104
|
-
return store.meta(key, criteria);
|
105
|
-
};
|
@@ -1,70 +0,0 @@
|
|
1
|
-
const Confidence = require("confidence");
|
2
|
-
|
3
|
-
const renderingInfoConfig = {
|
4
|
-
cache: {
|
5
|
-
cacheControl: {
|
6
|
-
// these are the default cache-control headers in case a tool is not responding with it's own directives.
|
7
|
-
maxAge: {
|
8
|
-
$filter: "env",
|
9
|
-
local: 1,
|
10
|
-
$default: 60
|
11
|
-
},
|
12
|
-
sMaxAge: {
|
13
|
-
$filter: "env",
|
14
|
-
local: 1,
|
15
|
-
$default: 60
|
16
|
-
},
|
17
|
-
staleWhileRevalidate: {
|
18
|
-
// this is just for the CDN, it will serve maximum 24 hours old content while revalidating in the background
|
19
|
-
$filter: "env",
|
20
|
-
local: 1,
|
21
|
-
$default: 60 * 60 * 24
|
22
|
-
},
|
23
|
-
staleIfError: {
|
24
|
-
// this is just for the CDN, it will serve maximum 7 days old content if the backend is not running
|
25
|
-
$filter: "env",
|
26
|
-
local: 1,
|
27
|
-
$default: 60 * 60 * 24 * 7
|
28
|
-
}
|
29
|
-
}
|
30
|
-
},
|
31
|
-
toolRuntimeConfig: {
|
32
|
-
toolBaseUrl: {
|
33
|
-
$filter: "env",
|
34
|
-
local: {
|
35
|
-
protocol: "http",
|
36
|
-
host: "localhost:3001",
|
37
|
-
path: {
|
38
|
-
$filter: "tool",
|
39
|
-
default: undefined,
|
40
|
-
chart: "/tools/chart"
|
41
|
-
}
|
42
|
-
},
|
43
|
-
staging: {
|
44
|
-
protocol: "https",
|
45
|
-
host: "q-staging.example.com"
|
46
|
-
},
|
47
|
-
production: {
|
48
|
-
protocol: "https",
|
49
|
-
host: "q.example.com"
|
50
|
-
},
|
51
|
-
playground: {
|
52
|
-
protocol: "https",
|
53
|
-
host: "q-playground.example.com"
|
54
|
-
}
|
55
|
-
}
|
56
|
-
}
|
57
|
-
};
|
58
|
-
|
59
|
-
const env = process.env.APP_ENV || "local";
|
60
|
-
const store = new Confidence.Store(renderingInfoConfig);
|
61
|
-
|
62
|
-
module.exports.get = (key, criteria = {}) => {
|
63
|
-
criteria = Object.assign({ env: env }, criteria);
|
64
|
-
return store.get(key, criteria);
|
65
|
-
};
|
66
|
-
|
67
|
-
module.exports.meta = (key, criteria = {}) => {
|
68
|
-
criteria = Object.assign({ env: env }, criteria);
|
69
|
-
return store.meta(key, criteria);
|
70
|
-
};
|
@@ -1,80 +0,0 @@
|
|
1
|
-
const Confidence = require("confidence");
|
2
|
-
|
3
|
-
// used in screenshot plugin
|
4
|
-
function resolvePath(resource, env) {
|
5
|
-
if (!resource.url && resource.path) {
|
6
|
-
resource.url = `${process.env.Q_SERVER_BASE_URL}${resource.path}`;
|
7
|
-
}
|
8
|
-
delete resource.path;
|
9
|
-
return resource;
|
10
|
-
}
|
11
|
-
|
12
|
-
const screenshot = {
|
13
|
-
getScripts: function(renderingInfo) {
|
14
|
-
const scripts = [];
|
15
|
-
if (
|
16
|
-
renderingInfo.loaderConfig &&
|
17
|
-
renderingInfo.loaderConfig.loadSystemJs === "full"
|
18
|
-
) {
|
19
|
-
scripts.push({ url: `${process.env.Q_SERVER_BASE_URL}/files/system.js` });
|
20
|
-
}
|
21
|
-
if (renderingInfo.scripts && Array.isArray(renderingInfo.scripts)) {
|
22
|
-
for (let script of renderingInfo.scripts) {
|
23
|
-
script = resolvePath(script);
|
24
|
-
scripts.push(script);
|
25
|
-
}
|
26
|
-
}
|
27
|
-
return scripts;
|
28
|
-
},
|
29
|
-
getStylesheets: function(renderingInfo) {
|
30
|
-
const stylesheets = [];
|
31
|
-
if (renderingInfo.stylesheets && Array.isArray(renderingInfo.stylesheets)) {
|
32
|
-
for (let stylesheet of renderingInfo.stylesheets) {
|
33
|
-
stylesheet = resolvePath(stylesheet);
|
34
|
-
stylesheets.push(stylesheet);
|
35
|
-
}
|
36
|
-
}
|
37
|
-
return stylesheets;
|
38
|
-
},
|
39
|
-
cache: {
|
40
|
-
cacheControl: {
|
41
|
-
// these cache control directives are sent in the cache-control header of the response to screenshot api
|
42
|
-
maxAge: {
|
43
|
-
$filter: "env",
|
44
|
-
local: 1,
|
45
|
-
$default: 60
|
46
|
-
},
|
47
|
-
sMaxAge: {
|
48
|
-
// this is just for the CDN, it will mark screenshots as stale after 24 hours. we use keycdn plugin to purge it on item.update
|
49
|
-
$filter: "env",
|
50
|
-
local: 1,
|
51
|
-
$default: 60 * 60 * 24
|
52
|
-
},
|
53
|
-
staleWhileRevalidate: {
|
54
|
-
// this is just for the CDN, it will serve maximum 7 days old content while revalidating in the background
|
55
|
-
$filter: "env",
|
56
|
-
local: 1,
|
57
|
-
$default: 60 * 60 * 24 * 7
|
58
|
-
},
|
59
|
-
staleIfError: {
|
60
|
-
// this is just for the CDN, it will serve maximum 7 days old content if the backend is responding with an error
|
61
|
-
$filter: "env",
|
62
|
-
local: 1,
|
63
|
-
$default: 60 * 60 * 24 * 7
|
64
|
-
}
|
65
|
-
}
|
66
|
-
}
|
67
|
-
};
|
68
|
-
|
69
|
-
const env = process.env.APP_ENV || "local";
|
70
|
-
const store = new Confidence.Store(screenshot);
|
71
|
-
|
72
|
-
module.exports.get = (key, criteria = {}) => {
|
73
|
-
criteria = Object.assign({ env: env }, criteria);
|
74
|
-
return store.get(key, criteria);
|
75
|
-
};
|
76
|
-
|
77
|
-
module.exports.meta = (key, criteria = {}) => {
|
78
|
-
criteria = Object.assign({ env: env }, criteria);
|
79
|
-
return store.meta(key, criteria);
|
80
|
-
};
|
@@ -1,31 +0,0 @@
|
|
1
|
-
const Confidence = require("confidence");
|
2
|
-
|
3
|
-
const targets = {
|
4
|
-
target1: {
|
5
|
-
label: "Target 1",
|
6
|
-
type: "web",
|
7
|
-
context: {
|
8
|
-
stylesheets: [
|
9
|
-
{
|
10
|
-
url: "https://example.com/stylesheet-for-preview.css"
|
11
|
-
}
|
12
|
-
],
|
13
|
-
background: {
|
14
|
-
color: "white"
|
15
|
-
}
|
16
|
-
}
|
17
|
-
}
|
18
|
-
};
|
19
|
-
|
20
|
-
const env = process.env.APP_ENV || "local";
|
21
|
-
const store = new Confidence.Store(targets);
|
22
|
-
|
23
|
-
module.exports.get = (key, criteria = {}) => {
|
24
|
-
criteria = Object.assign({ env: env }, criteria);
|
25
|
-
return store.get(key, criteria);
|
26
|
-
};
|
27
|
-
|
28
|
-
module.exports.meta = (key, criteria = {}) => {
|
29
|
-
criteria = Object.assign({ env: env }, criteria);
|
30
|
-
return store.meta(key, criteria);
|
31
|
-
};
|
@@ -1,65 +0,0 @@
|
|
1
|
-
const Confidence = require("confidence");
|
2
|
-
|
3
|
-
const tool1_editor_config = {
|
4
|
-
label_locales: {
|
5
|
-
de: "Beispiel-Tool",
|
6
|
-
en: "example tool"
|
7
|
-
},
|
8
|
-
icon:
|
9
|
-
'<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><g fill="#000" fill-rule="evenodd"><path d="M5.706 30.294a.996.996 0 0 1-1.412 0l-2.588-2.588a.995.995 0 0 1 0-1.412L19 9l4 4L5.706 30.294zM11 7l4 4-4 4-4-4H5c-1.112 0-2.632-.632-3.41-1.41L1 9 0 6l1-1 3 3 4-4-3-3 1-1 3 1 .59.59C10.366 2.366 11 3.894 11 5v2zM21 25l-4-4 4-4 4 4h2c1.112 0 2.632.632 3.41 1.41L31 23l1 3-1 1-3-3-4 4 3 3-1 1-3-1-.59-.59C21.634 29.634 21 28.106 21 27v-2zM19 1h4l9 9-5 5L16 4z"/></g></svg>'
|
10
|
-
};
|
11
|
-
|
12
|
-
const tools = {
|
13
|
-
$filter: "env",
|
14
|
-
local: {
|
15
|
-
tool1: {
|
16
|
-
// tool name
|
17
|
-
baseUrl: "http://localhost:3000",
|
18
|
-
editor: tool1_editor_config,
|
19
|
-
endpoint: {
|
20
|
-
$filter: "target",
|
21
|
-
$default: false,
|
22
|
-
target1: {
|
23
|
-
// target name
|
24
|
-
path: "/rendering-info/web",
|
25
|
-
additionalRenderingInfo: {
|
26
|
-
// if needed you can add tool specific stylesheets here, delete otherwise
|
27
|
-
// further scripts can be added in a similar manner too
|
28
|
-
stylesheets: [
|
29
|
-
{
|
30
|
-
url: "https://example.com/tool-specific-stylesheet.css" // add some url to a stylesheet here
|
31
|
-
},
|
32
|
-
{
|
33
|
-
content: "h2, p {color: darkgray}" // add some css here
|
34
|
-
}
|
35
|
-
]
|
36
|
-
},
|
37
|
-
toolRuntimeConfig: {
|
38
|
-
// if needed add further properties here which the tool needs at runtime
|
39
|
-
}
|
40
|
-
},
|
41
|
-
target2: {
|
42
|
-
url: "https://some-other-service.example.com/rendering-info" // you can use a url to use an external service providing the rendering information
|
43
|
-
}
|
44
|
-
}
|
45
|
-
}
|
46
|
-
}
|
47
|
-
};
|
48
|
-
|
49
|
-
const env = process.env.APP_ENV || "local";
|
50
|
-
const store = new Confidence.Store(tools);
|
51
|
-
|
52
|
-
module.exports.get = (key, criteria = {}) => {
|
53
|
-
criteria = Object.assign({ env: env }, criteria);
|
54
|
-
return store.get(key, criteria);
|
55
|
-
};
|
56
|
-
|
57
|
-
module.exports.load = async function() {
|
58
|
-
// if needed you could add further async loaded configs here
|
59
|
-
store.load(tools);
|
60
|
-
};
|
61
|
-
|
62
|
-
module.exports.meta = (key, criteria = {}) => {
|
63
|
-
criteria = Object.assign({ env: env }, criteria);
|
64
|
-
return store.meta(key, criteria);
|
65
|
-
};
|
Binary file
|