diff --git a/.gitignore b/.gitignore index e9a64d5f5d..e55253b113 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ node_modules lerna-debug npm-debug .DS_Store +/dist # Logs logs diff --git a/examples/basic-auth-hook.js b/examples/basic-auth-hook.js index 54984b0b4f..269b4164fe 100644 --- a/examples/basic-auth-hook.js +++ b/examples/basic-auth-hook.js @@ -3,7 +3,7 @@ 'use strict'; const auth = require('basic-auth'); -const { User } = require('../lib/server-impl.js'); +const { User } = require('../dist/lib/server-impl.js'); function basicAuthentication(app) { app.use('/api/admin/', (req, res, next) => { diff --git a/examples/basic-auth-unleash.js b/examples/basic-auth-unleash.js index 61b08e8fba..49536a503f 100644 --- a/examples/basic-auth-unleash.js +++ b/examples/basic-auth-unleash.js @@ -1,7 +1,7 @@ 'use strict'; // const unleash = require('unleash-server'); -const unleash = require('../lib/server-impl.js'); +const unleash = require('../dist/lib/server-impl.js'); const basicAuth = require('./basic-auth-hook'); diff --git a/examples/client-auth-unleash.js b/examples/client-auth-unleash.js index 2c7d6c597e..9c2a1a345f 100644 --- a/examples/client-auth-unleash.js +++ b/examples/client-auth-unleash.js @@ -1,7 +1,7 @@ 'use strict'; // const unleash = require('unleash-server'); -const unleash = require('../lib/server-impl.js'); +const unleash = require('../dist/lib/server-impl.js'); // You typically will not hard-code this value in your code! const sharedSecret = '12312Random'; diff --git a/examples/express-parent-app.js b/examples/express-parent-app.js index bd637f1bff..d41ab056ca 100644 --- a/examples/express-parent-app.js +++ b/examples/express-parent-app.js @@ -3,7 +3,7 @@ 'use strict'; const express = require('express'); -const unleash = require('../lib/server-impl.js'); +const unleash = require('../dist/lib/server-impl.js'); const app = express(); unleash diff --git a/examples/google-auth-hook.js b/examples/google-auth-hook.js index 4203606e09..120772a9b2 100644 --- a/examples/google-auth-hook.js +++ b/examples/google-auth-hook.js @@ -24,7 +24,7 @@ const GoogleOAuth2Strategy = require('@passport-next/passport-google-oauth2') .Strategy; // const { User, AuthenticationRequired } = require('unleash-server'); -const { User, AuthenticationRequired } = require('../lib/server-impl.js'); +const { User, AuthenticationRequired } = require('../dist/lib/server-impl.js'); passport.use( new GoogleOAuth2Strategy( diff --git a/examples/google-auth-unleash.js b/examples/google-auth-unleash.js index 122891f222..0e1ba899f7 100644 --- a/examples/google-auth-unleash.js +++ b/examples/google-auth-unleash.js @@ -1,7 +1,7 @@ 'use strict'; // const unleash = require('unleash-server'); -const unleash = require('../lib/server-impl.js'); +const unleash = require('../dist/lib/server-impl.js'); const enableGoogleOauth = require('./google-auth-hook'); diff --git a/examples/keycloak-auth-hook.js b/examples/keycloak-auth-hook.js index 2cc0e02bfa..7a379a9c45 100644 --- a/examples/keycloak-auth-hook.js +++ b/examples/keycloak-auth-hook.js @@ -21,7 +21,7 @@ const KeycloakStrategy = require('@exlinc/keycloak-passport'); const passport = require('passport'); // const { User, AuthenticationRequired } = require('unleash-server'); -const { User, AuthenticationRequired } = require('../lib/server-impl.js'); +const { User, AuthenticationRequired } = require('../dist/lib/server-impl.js'); const host = process.env.AUTH_HOST; const realm = process.env.AUTH_REALM; diff --git a/examples/keycloak-auth-unleash.js b/examples/keycloak-auth-unleash.js index 28e5597317..9efc7ffab3 100644 --- a/examples/keycloak-auth-unleash.js +++ b/examples/keycloak-auth-unleash.js @@ -1,7 +1,7 @@ 'use strict'; // const unleash = require('unleash-server'); -const unleash = require('../lib/server-impl.js'); +const unleash = require('../dist/lib/server-impl.js'); const enableKeycloak = require('./keycloak-auth-hook'); diff --git a/package.json b/package.json index 090270ba41..4454f1d254 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "unleash-server", "description": "Unleash is an enterprise ready feature toggles service. It provides different strategies for handling feature toggles.", - "version": "3.11.2", + "version": "3.11.3-next.1", "keywords": [ "unleash", "feature toggle", @@ -9,12 +9,8 @@ "toggle" ], "files": [ - "lib", - "docs", - "bin", - "migrations", - "server.js", - "migrator.js" + "dist", + "docs" ], "repository": { "type": "git", @@ -27,17 +23,20 @@ "node": ">=12" }, "license": "Apache-2.0", - "main": "./lib/server-impl.js", + "main": "./dist/lib/server-impl.js", "bin": { - "unleash": "bin/unleash.js" + "unleash": "./dist/bin/unleash.js" }, "scripts": { - "start": "node server.js", + "start": "node ./dist/server.js", "start:google": "node examples/google-auth-unleash.js", - "start:dev": "NODE_ENV=development supervisor --ignore ./node_modules/,website server-dev.js", - "db-migrate": "db-migrate", - "lint": "eslint .", - "test": "NODE_ENV=test PORT=4243 ava", + "start:dev": "NODE_ENV=development supervisor --ignore ./node_modules/,website ./dist/server-dev.js", + "db-migrate": "db-migrate --migrations-dir ./src/migrations", + "lint": "eslint ./src", + "build:watch": "tsc -w", + "build": "tsc", + "prepare": "yarn run build", + "test": "yarn build && NODE_ENV=test PORT=4243 ava", "test:docker": "./scripts/docker-postgres.sh", "test:watch": "yarn test --watch", "test:coverage": "nyc --reporter=lcov yarn test", @@ -46,15 +45,22 @@ "nyc": { "all": true, "include": [ - "bin/**/*.js", - "lib/**/*.js" - ] + "dist/**/*.js" + ], + "exclude": [ + "dist/bin", + "dist/migrations" + ], + "exclude-after-remap": false }, "ava": { "files": [ + "./dist/**/*.test.js", + "!src/**/*", "!**/helpers/**/*", "!**/fixtures/**/*" - ] + ], + "snapshotDir": "snapshots" }, "dependencies": { "async": "^3.1.0", @@ -87,6 +93,7 @@ "prom-client": "^13.1.0", "response-time": "^2.3.2", "serve-favicon": "^2.5.0", + "typescript": "^4.1.5", "unleash-frontend": "3.11.4", "yargs": "^16.0.3" }, diff --git a/snapshots/dist/lib/addons/slack.test.js.md b/snapshots/dist/lib/addons/slack.test.js.md new file mode 100644 index 0000000000..6cf55b999a --- /dev/null +++ b/snapshots/dist/lib/addons/slack.test.js.md @@ -0,0 +1,11 @@ +# Snapshot report for `dist/lib/addons/slack.test.js` + +The actual snapshot is saved in `slack.test.js.snap`. + +Generated by [AVA](https://avajs.dev). + +## Should call slack webhook + +> Snapshot 1 + + '{"username":"Unleash","icon_emoji":":unleash:","text":"some@user.com created feature toggle \\n*Enabled*: no | *Type*: undefined | *Project*: undefined\\n*Activation strategies*: ```- name: default\\n```","channel":"#undefined","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/#/features/strategies/some-toggle"}]}]}' diff --git a/lib/addons/slack.test.js.snap b/snapshots/dist/lib/addons/slack.test.js.snap similarity index 100% rename from lib/addons/slack.test.js.snap rename to snapshots/dist/lib/addons/slack.test.js.snap diff --git a/lib/addons/slack.test.js.md b/snapshots/src/lib/addons/slack.test.js.md similarity index 92% rename from lib/addons/slack.test.js.md rename to snapshots/src/lib/addons/slack.test.js.md index e7c767a452..f1e237a0b7 100644 --- a/lib/addons/slack.test.js.md +++ b/snapshots/src/lib/addons/slack.test.js.md @@ -1,4 +1,4 @@ -# Snapshot report for `lib/addons/slack.test.js` +# Snapshot report for `src/lib/addons/slack.test.js` The actual snapshot is saved in `slack.test.js.snap`. diff --git a/snapshots/src/lib/addons/slack.test.js.snap b/snapshots/src/lib/addons/slack.test.js.snap new file mode 100644 index 0000000000..0b80da9cf3 Binary files /dev/null and b/snapshots/src/lib/addons/slack.test.js.snap differ diff --git a/bin/unleash.js b/src/bin/unleash.js similarity index 100% rename from bin/unleash.js rename to src/bin/unleash.js diff --git a/lib/addons/addon-schema.js b/src/lib/addons/addon-schema.js similarity index 100% rename from lib/addons/addon-schema.js rename to src/lib/addons/addon-schema.js diff --git a/lib/addons/addon.js b/src/lib/addons/addon.js similarity index 100% rename from lib/addons/addon.js rename to src/lib/addons/addon.js diff --git a/lib/addons/index.js b/src/lib/addons/index.js similarity index 100% rename from lib/addons/index.js rename to src/lib/addons/index.js diff --git a/lib/addons/jira-comment-definition.js b/src/lib/addons/jira-comment-definition.js similarity index 100% rename from lib/addons/jira-comment-definition.js rename to src/lib/addons/jira-comment-definition.js diff --git a/lib/addons/jira-comment.js b/src/lib/addons/jira-comment.js similarity index 100% rename from lib/addons/jira-comment.js rename to src/lib/addons/jira-comment.js diff --git a/lib/addons/jira-comment.test.js b/src/lib/addons/jira-comment.test.js similarity index 100% rename from lib/addons/jira-comment.test.js rename to src/lib/addons/jira-comment.test.js diff --git a/lib/addons/slack-definition.js b/src/lib/addons/slack-definition.js similarity index 100% rename from lib/addons/slack-definition.js rename to src/lib/addons/slack-definition.js diff --git a/lib/addons/slack.js b/src/lib/addons/slack.js similarity index 100% rename from lib/addons/slack.js rename to src/lib/addons/slack.js diff --git a/lib/addons/slack.test.js b/src/lib/addons/slack.test.js similarity index 100% rename from lib/addons/slack.test.js rename to src/lib/addons/slack.test.js diff --git a/lib/addons/webhook-definition.js b/src/lib/addons/webhook-definition.js similarity index 100% rename from lib/addons/webhook-definition.js rename to src/lib/addons/webhook-definition.js diff --git a/lib/addons/webhook.js b/src/lib/addons/webhook.js similarity index 100% rename from lib/addons/webhook.js rename to src/lib/addons/webhook.js diff --git a/lib/addons/webhook.test.js b/src/lib/addons/webhook.test.js similarity index 100% rename from lib/addons/webhook.test.js rename to src/lib/addons/webhook.test.js diff --git a/lib/app.js b/src/lib/app.js similarity index 100% rename from lib/app.js rename to src/lib/app.js diff --git a/lib/app.test.js b/src/lib/app.test.js similarity index 100% rename from lib/app.test.js rename to src/lib/app.test.js diff --git a/lib/authentication-required.js b/src/lib/authentication-required.js similarity index 100% rename from lib/authentication-required.js rename to src/lib/authentication-required.js diff --git a/lib/db/addon-store.js b/src/lib/db/addon-store.js similarity index 100% rename from lib/db/addon-store.js rename to src/lib/db/addon-store.js diff --git a/lib/db/client-applications-store.js b/src/lib/db/client-applications-store.js similarity index 100% rename from lib/db/client-applications-store.js rename to src/lib/db/client-applications-store.js diff --git a/lib/db/client-instance-store.js b/src/lib/db/client-instance-store.js similarity index 100% rename from lib/db/client-instance-store.js rename to src/lib/db/client-instance-store.js diff --git a/lib/db/client-metrics-db.js b/src/lib/db/client-metrics-db.js similarity index 100% rename from lib/db/client-metrics-db.js rename to src/lib/db/client-metrics-db.js diff --git a/lib/db/client-metrics-store.js b/src/lib/db/client-metrics-store.js similarity index 100% rename from lib/db/client-metrics-store.js rename to src/lib/db/client-metrics-store.js diff --git a/lib/db/client-metrics-store.test.js b/src/lib/db/client-metrics-store.test.js similarity index 100% rename from lib/db/client-metrics-store.test.js rename to src/lib/db/client-metrics-store.test.js diff --git a/lib/db/context-field-store.js b/src/lib/db/context-field-store.js similarity index 100% rename from lib/db/context-field-store.js rename to src/lib/db/context-field-store.js diff --git a/lib/db/db-pool.js b/src/lib/db/db-pool.js similarity index 100% rename from lib/db/db-pool.js rename to src/lib/db/db-pool.js diff --git a/lib/db/event-store.js b/src/lib/db/event-store.js similarity index 100% rename from lib/db/event-store.js rename to src/lib/db/event-store.js diff --git a/lib/db/feature-toggle-store.js b/src/lib/db/feature-toggle-store.js similarity index 100% rename from lib/db/feature-toggle-store.js rename to src/lib/db/feature-toggle-store.js diff --git a/lib/db/feature-type-store.js b/src/lib/db/feature-type-store.js similarity index 100% rename from lib/db/feature-type-store.js rename to src/lib/db/feature-type-store.js diff --git a/lib/db/index.js b/src/lib/db/index.js similarity index 100% rename from lib/db/index.js rename to src/lib/db/index.js diff --git a/lib/db/project-store.js b/src/lib/db/project-store.js similarity index 100% rename from lib/db/project-store.js rename to src/lib/db/project-store.js diff --git a/lib/db/setting-store.js b/src/lib/db/setting-store.js similarity index 100% rename from lib/db/setting-store.js rename to src/lib/db/setting-store.js diff --git a/lib/db/strategy-store.js b/src/lib/db/strategy-store.js similarity index 100% rename from lib/db/strategy-store.js rename to src/lib/db/strategy-store.js diff --git a/lib/db/tag-store.js b/src/lib/db/tag-store.js similarity index 100% rename from lib/db/tag-store.js rename to src/lib/db/tag-store.js diff --git a/lib/db/tag-type-store.js b/src/lib/db/tag-type-store.js similarity index 100% rename from lib/db/tag-type-store.js rename to src/lib/db/tag-type-store.js diff --git a/lib/db/user-store.js b/src/lib/db/user-store.js similarity index 100% rename from lib/db/user-store.js rename to src/lib/db/user-store.js diff --git a/lib/error/db-error.js b/src/lib/error/db-error.js similarity index 100% rename from lib/error/db-error.js rename to src/lib/error/db-error.js diff --git a/lib/error/feature-has-tag-error.js b/src/lib/error/feature-has-tag-error.js similarity index 100% rename from lib/error/feature-has-tag-error.js rename to src/lib/error/feature-has-tag-error.js diff --git a/lib/error/invalid-operation-error.js b/src/lib/error/invalid-operation-error.js similarity index 100% rename from lib/error/invalid-operation-error.js rename to src/lib/error/invalid-operation-error.js diff --git a/lib/error/name-exists-error.js b/src/lib/error/name-exists-error.js similarity index 100% rename from lib/error/name-exists-error.js rename to src/lib/error/name-exists-error.js diff --git a/lib/error/notfound-error.js b/src/lib/error/notfound-error.js similarity index 100% rename from lib/error/notfound-error.js rename to src/lib/error/notfound-error.js diff --git a/lib/event-differ.js b/src/lib/event-differ.js similarity index 100% rename from lib/event-differ.js rename to src/lib/event-differ.js diff --git a/lib/event-differ.test.js b/src/lib/event-differ.test.js similarity index 100% rename from lib/event-differ.test.js rename to src/lib/event-differ.test.js diff --git a/lib/event-hook.js b/src/lib/event-hook.js similarity index 100% rename from lib/event-hook.js rename to src/lib/event-hook.js diff --git a/lib/event-hook.test.js b/src/lib/event-hook.test.js similarity index 100% rename from lib/event-hook.test.js rename to src/lib/event-hook.test.js diff --git a/lib/event-type.js b/src/lib/event-type.js similarity index 100% rename from lib/event-type.js rename to src/lib/event-type.js diff --git a/lib/events.js b/src/lib/events.js similarity index 100% rename from lib/events.js rename to src/lib/events.js diff --git a/lib/extract-user.js b/src/lib/extract-user.js similarity index 100% rename from lib/extract-user.js rename to src/lib/extract-user.js diff --git a/lib/logger.js b/src/lib/logger.js similarity index 100% rename from lib/logger.js rename to src/lib/logger.js diff --git a/lib/logger.test.js b/src/lib/logger.test.js similarity index 100% rename from lib/logger.test.js rename to src/lib/logger.test.js diff --git a/lib/metrics-helper.js b/src/lib/metrics-helper.js similarity index 100% rename from lib/metrics-helper.js rename to src/lib/metrics-helper.js diff --git a/lib/metrics.js b/src/lib/metrics.js similarity index 100% rename from lib/metrics.js rename to src/lib/metrics.js diff --git a/lib/metrics.test.js b/src/lib/metrics.test.js similarity index 100% rename from lib/metrics.test.js rename to src/lib/metrics.test.js diff --git a/lib/middleware/content_type_checker.js b/src/lib/middleware/content_type_checker.js similarity index 100% rename from lib/middleware/content_type_checker.js rename to src/lib/middleware/content_type_checker.js diff --git a/lib/middleware/content_type_checker.test.js b/src/lib/middleware/content_type_checker.test.js similarity index 100% rename from lib/middleware/content_type_checker.test.js rename to src/lib/middleware/content_type_checker.test.js diff --git a/lib/middleware/no-authentication.js b/src/lib/middleware/no-authentication.js similarity index 100% rename from lib/middleware/no-authentication.js rename to src/lib/middleware/no-authentication.js diff --git a/lib/middleware/no-authentication.test.js b/src/lib/middleware/no-authentication.test.js similarity index 100% rename from lib/middleware/no-authentication.test.js rename to src/lib/middleware/no-authentication.test.js diff --git a/lib/middleware/permission-checker.js b/src/lib/middleware/permission-checker.js similarity index 100% rename from lib/middleware/permission-checker.js rename to src/lib/middleware/permission-checker.js diff --git a/lib/middleware/permission-checker.test.js b/src/lib/middleware/permission-checker.test.js similarity index 100% rename from lib/middleware/permission-checker.test.js rename to src/lib/middleware/permission-checker.test.js diff --git a/lib/middleware/request-logger.js b/src/lib/middleware/request-logger.js similarity index 100% rename from lib/middleware/request-logger.js rename to src/lib/middleware/request-logger.js diff --git a/lib/middleware/response-time.js b/src/lib/middleware/response-time.js similarity index 100% rename from lib/middleware/response-time.js rename to src/lib/middleware/response-time.js diff --git a/lib/middleware/secure-headers.js b/src/lib/middleware/secure-headers.js similarity index 100% rename from lib/middleware/secure-headers.js rename to src/lib/middleware/secure-headers.js diff --git a/lib/middleware/session.js b/src/lib/middleware/session.js similarity index 100% rename from lib/middleware/session.js rename to src/lib/middleware/session.js diff --git a/lib/middleware/simple-authentication.js b/src/lib/middleware/simple-authentication.js similarity index 100% rename from lib/middleware/simple-authentication.js rename to src/lib/middleware/simple-authentication.js diff --git a/lib/missing-permission.js b/src/lib/missing-permission.js similarity index 100% rename from lib/missing-permission.js rename to src/lib/missing-permission.js diff --git a/lib/options.js b/src/lib/options.js similarity index 100% rename from lib/options.js rename to src/lib/options.js diff --git a/lib/options.test.js b/src/lib/options.test.js similarity index 100% rename from lib/options.test.js rename to src/lib/options.test.js diff --git a/lib/permissions.js b/src/lib/permissions.js similarity index 100% rename from lib/permissions.js rename to src/lib/permissions.js diff --git a/lib/routes/admin-api/addon.js b/src/lib/routes/admin-api/addon.js similarity index 100% rename from lib/routes/admin-api/addon.js rename to src/lib/routes/admin-api/addon.js diff --git a/lib/routes/admin-api/api-def.json b/src/lib/routes/admin-api/api-def.json similarity index 100% rename from lib/routes/admin-api/api-def.json rename to src/lib/routes/admin-api/api-def.json diff --git a/lib/routes/admin-api/archive.js b/src/lib/routes/admin-api/archive.js similarity index 100% rename from lib/routes/admin-api/archive.js rename to src/lib/routes/admin-api/archive.js diff --git a/lib/routes/admin-api/archive.test.js b/src/lib/routes/admin-api/archive.test.js similarity index 100% rename from lib/routes/admin-api/archive.test.js rename to src/lib/routes/admin-api/archive.test.js diff --git a/lib/routes/admin-api/config.js b/src/lib/routes/admin-api/config.js similarity index 100% rename from lib/routes/admin-api/config.js rename to src/lib/routes/admin-api/config.js diff --git a/lib/routes/admin-api/config.test.js b/src/lib/routes/admin-api/config.test.js similarity index 100% rename from lib/routes/admin-api/config.test.js rename to src/lib/routes/admin-api/config.test.js diff --git a/lib/routes/admin-api/context.js b/src/lib/routes/admin-api/context.js similarity index 100% rename from lib/routes/admin-api/context.js rename to src/lib/routes/admin-api/context.js diff --git a/lib/routes/admin-api/context.test.js b/src/lib/routes/admin-api/context.test.js similarity index 100% rename from lib/routes/admin-api/context.test.js rename to src/lib/routes/admin-api/context.test.js diff --git a/lib/routes/admin-api/event.js b/src/lib/routes/admin-api/event.js similarity index 100% rename from lib/routes/admin-api/event.js rename to src/lib/routes/admin-api/event.js diff --git a/lib/routes/admin-api/events.test.js b/src/lib/routes/admin-api/events.test.js similarity index 100% rename from lib/routes/admin-api/events.test.js rename to src/lib/routes/admin-api/events.test.js diff --git a/lib/routes/admin-api/feature-type.js b/src/lib/routes/admin-api/feature-type.js similarity index 100% rename from lib/routes/admin-api/feature-type.js rename to src/lib/routes/admin-api/feature-type.js diff --git a/lib/routes/admin-api/feature.js b/src/lib/routes/admin-api/feature.js similarity index 100% rename from lib/routes/admin-api/feature.js rename to src/lib/routes/admin-api/feature.js diff --git a/lib/routes/admin-api/feature.test.js b/src/lib/routes/admin-api/feature.test.js similarity index 100% rename from lib/routes/admin-api/feature.test.js rename to src/lib/routes/admin-api/feature.test.js diff --git a/lib/routes/admin-api/index.js b/src/lib/routes/admin-api/index.js similarity index 100% rename from lib/routes/admin-api/index.js rename to src/lib/routes/admin-api/index.js diff --git a/lib/routes/admin-api/metrics.js b/src/lib/routes/admin-api/metrics.js similarity index 100% rename from lib/routes/admin-api/metrics.js rename to src/lib/routes/admin-api/metrics.js diff --git a/lib/routes/admin-api/metrics.test.js b/src/lib/routes/admin-api/metrics.test.js similarity index 100% rename from lib/routes/admin-api/metrics.test.js rename to src/lib/routes/admin-api/metrics.test.js diff --git a/lib/routes/admin-api/state.js b/src/lib/routes/admin-api/state.js similarity index 100% rename from lib/routes/admin-api/state.js rename to src/lib/routes/admin-api/state.js diff --git a/lib/routes/admin-api/strategy.js b/src/lib/routes/admin-api/strategy.js similarity index 100% rename from lib/routes/admin-api/strategy.js rename to src/lib/routes/admin-api/strategy.js diff --git a/lib/routes/admin-api/strategy.test.js b/src/lib/routes/admin-api/strategy.test.js similarity index 100% rename from lib/routes/admin-api/strategy.test.js rename to src/lib/routes/admin-api/strategy.test.js diff --git a/lib/routes/admin-api/tag-type.js b/src/lib/routes/admin-api/tag-type.js similarity index 100% rename from lib/routes/admin-api/tag-type.js rename to src/lib/routes/admin-api/tag-type.js diff --git a/lib/routes/admin-api/tag.js b/src/lib/routes/admin-api/tag.js similarity index 100% rename from lib/routes/admin-api/tag.js rename to src/lib/routes/admin-api/tag.js diff --git a/lib/routes/admin-api/tag.test.js b/src/lib/routes/admin-api/tag.test.js similarity index 100% rename from lib/routes/admin-api/tag.test.js rename to src/lib/routes/admin-api/tag.test.js diff --git a/lib/routes/admin-api/user.js b/src/lib/routes/admin-api/user.js similarity index 100% rename from lib/routes/admin-api/user.js rename to src/lib/routes/admin-api/user.js diff --git a/lib/routes/admin-api/user.test.js b/src/lib/routes/admin-api/user.test.js similarity index 100% rename from lib/routes/admin-api/user.test.js rename to src/lib/routes/admin-api/user.test.js diff --git a/lib/routes/admin-api/util.js b/src/lib/routes/admin-api/util.js similarity index 100% rename from lib/routes/admin-api/util.js rename to src/lib/routes/admin-api/util.js diff --git a/lib/routes/api-def.js b/src/lib/routes/api-def.js similarity index 100% rename from lib/routes/api-def.js rename to src/lib/routes/api-def.js diff --git a/lib/routes/backstage.js b/src/lib/routes/backstage.js similarity index 100% rename from lib/routes/backstage.js rename to src/lib/routes/backstage.js diff --git a/lib/routes/backstage.test.js b/src/lib/routes/backstage.test.js similarity index 100% rename from lib/routes/backstage.test.js rename to src/lib/routes/backstage.test.js diff --git a/lib/routes/client-api/api-def.json b/src/lib/routes/client-api/api-def.json similarity index 100% rename from lib/routes/client-api/api-def.json rename to src/lib/routes/client-api/api-def.json diff --git a/lib/routes/client-api/feature.js b/src/lib/routes/client-api/feature.js similarity index 100% rename from lib/routes/client-api/feature.js rename to src/lib/routes/client-api/feature.js diff --git a/lib/routes/client-api/feature.test.js b/src/lib/routes/client-api/feature.test.js similarity index 100% rename from lib/routes/client-api/feature.test.js rename to src/lib/routes/client-api/feature.test.js diff --git a/lib/routes/client-api/index.js b/src/lib/routes/client-api/index.js similarity index 100% rename from lib/routes/client-api/index.js rename to src/lib/routes/client-api/index.js diff --git a/lib/routes/client-api/metrics.js b/src/lib/routes/client-api/metrics.js similarity index 100% rename from lib/routes/client-api/metrics.js rename to src/lib/routes/client-api/metrics.js diff --git a/lib/routes/client-api/metrics.test.js b/src/lib/routes/client-api/metrics.test.js similarity index 100% rename from lib/routes/client-api/metrics.test.js rename to src/lib/routes/client-api/metrics.test.js diff --git a/lib/routes/client-api/register.js b/src/lib/routes/client-api/register.js similarity index 100% rename from lib/routes/client-api/register.js rename to src/lib/routes/client-api/register.js diff --git a/lib/routes/client-api/register.test.js b/src/lib/routes/client-api/register.test.js similarity index 100% rename from lib/routes/client-api/register.test.js rename to src/lib/routes/client-api/register.test.js diff --git a/lib/routes/controller.js b/src/lib/routes/controller.js similarity index 100% rename from lib/routes/controller.js rename to src/lib/routes/controller.js diff --git a/lib/routes/health-check.js b/src/lib/routes/health-check.js similarity index 100% rename from lib/routes/health-check.js rename to src/lib/routes/health-check.js diff --git a/lib/routes/health-check.test.js b/src/lib/routes/health-check.test.js similarity index 100% rename from lib/routes/health-check.test.js rename to src/lib/routes/health-check.test.js diff --git a/lib/routes/index.js b/src/lib/routes/index.js similarity index 100% rename from lib/routes/index.js rename to src/lib/routes/index.js diff --git a/lib/routes/index.test.js b/src/lib/routes/index.test.js similarity index 100% rename from lib/routes/index.test.js rename to src/lib/routes/index.test.js diff --git a/lib/routes/logout.js b/src/lib/routes/logout.js similarity index 100% rename from lib/routes/logout.js rename to src/lib/routes/logout.js diff --git a/lib/routes/logout.test.js b/src/lib/routes/logout.test.js similarity index 100% rename from lib/routes/logout.test.js rename to src/lib/routes/logout.test.js diff --git a/lib/server-impl.js b/src/lib/server-impl.js similarity index 100% rename from lib/server-impl.js rename to src/lib/server-impl.js diff --git a/lib/server-impl.test.js b/src/lib/server-impl.test.js similarity index 100% rename from lib/server-impl.test.js rename to src/lib/server-impl.test.js diff --git a/lib/services/addon-schema.js b/src/lib/services/addon-schema.js similarity index 100% rename from lib/services/addon-schema.js rename to src/lib/services/addon-schema.js diff --git a/lib/services/addon-service.js b/src/lib/services/addon-service.js similarity index 100% rename from lib/services/addon-service.js rename to src/lib/services/addon-service.js diff --git a/lib/services/addon-service.test.js b/src/lib/services/addon-service.test.js similarity index 100% rename from lib/services/addon-service.test.js rename to src/lib/services/addon-service.test.js diff --git a/lib/services/client-metrics/client-metrics-schema.js b/src/lib/services/client-metrics/client-metrics-schema.js similarity index 100% rename from lib/services/client-metrics/client-metrics-schema.js rename to src/lib/services/client-metrics/client-metrics-schema.js diff --git a/lib/services/client-metrics/client-metrics.test.js b/src/lib/services/client-metrics/client-metrics.test.js similarity index 100% rename from lib/services/client-metrics/client-metrics.test.js rename to src/lib/services/client-metrics/client-metrics.test.js diff --git a/lib/services/client-metrics/index.js b/src/lib/services/client-metrics/index.js similarity index 100% rename from lib/services/client-metrics/index.js rename to src/lib/services/client-metrics/index.js diff --git a/lib/services/client-metrics/list.js b/src/lib/services/client-metrics/list.js similarity index 100% rename from lib/services/client-metrics/list.js rename to src/lib/services/client-metrics/list.js diff --git a/lib/services/client-metrics/list.test.js b/src/lib/services/client-metrics/list.test.js similarity index 100% rename from lib/services/client-metrics/list.test.js rename to src/lib/services/client-metrics/list.test.js diff --git a/lib/services/client-metrics/metrics-schema.js b/src/lib/services/client-metrics/metrics-schema.js similarity index 100% rename from lib/services/client-metrics/metrics-schema.js rename to src/lib/services/client-metrics/metrics-schema.js diff --git a/lib/services/client-metrics/projection.js b/src/lib/services/client-metrics/projection.js similarity index 100% rename from lib/services/client-metrics/projection.js rename to src/lib/services/client-metrics/projection.js diff --git a/lib/services/client-metrics/projection.test.js b/src/lib/services/client-metrics/projection.test.js similarity index 100% rename from lib/services/client-metrics/projection.test.js rename to src/lib/services/client-metrics/projection.test.js diff --git a/lib/services/client-metrics/register-schema.js b/src/lib/services/client-metrics/register-schema.js similarity index 100% rename from lib/services/client-metrics/register-schema.js rename to src/lib/services/client-metrics/register-schema.js diff --git a/lib/services/client-metrics/ttl-list.js b/src/lib/services/client-metrics/ttl-list.js similarity index 100% rename from lib/services/client-metrics/ttl-list.js rename to src/lib/services/client-metrics/ttl-list.js diff --git a/lib/services/client-metrics/ttl-list.test.js b/src/lib/services/client-metrics/ttl-list.test.js similarity index 100% rename from lib/services/client-metrics/ttl-list.test.js rename to src/lib/services/client-metrics/ttl-list.test.js diff --git a/lib/services/context-schema.js b/src/lib/services/context-schema.js similarity index 100% rename from lib/services/context-schema.js rename to src/lib/services/context-schema.js diff --git a/lib/services/context-service.js b/src/lib/services/context-service.js similarity index 100% rename from lib/services/context-service.js rename to src/lib/services/context-service.js diff --git a/lib/services/feature-schema.js b/src/lib/services/feature-schema.js similarity index 100% rename from lib/services/feature-schema.js rename to src/lib/services/feature-schema.js diff --git a/lib/services/feature-schema.test.js b/src/lib/services/feature-schema.test.js similarity index 100% rename from lib/services/feature-schema.test.js rename to src/lib/services/feature-schema.test.js diff --git a/lib/services/feature-toggle-service.js b/src/lib/services/feature-toggle-service.js similarity index 100% rename from lib/services/feature-toggle-service.js rename to src/lib/services/feature-toggle-service.js diff --git a/lib/services/index.js b/src/lib/services/index.js similarity index 100% rename from lib/services/index.js rename to src/lib/services/index.js diff --git a/lib/services/project-schema.js b/src/lib/services/project-schema.js similarity index 100% rename from lib/services/project-schema.js rename to src/lib/services/project-schema.js diff --git a/lib/services/project-service.js b/src/lib/services/project-service.js similarity index 100% rename from lib/services/project-service.js rename to src/lib/services/project-service.js diff --git a/lib/services/state-schema.js b/src/lib/services/state-schema.js similarity index 100% rename from lib/services/state-schema.js rename to src/lib/services/state-schema.js diff --git a/lib/services/state-service.js b/src/lib/services/state-service.js similarity index 100% rename from lib/services/state-service.js rename to src/lib/services/state-service.js diff --git a/lib/services/state-service.test.js b/src/lib/services/state-service.test.js similarity index 100% rename from lib/services/state-service.test.js rename to src/lib/services/state-service.test.js diff --git a/lib/services/state-util.js b/src/lib/services/state-util.js similarity index 100% rename from lib/services/state-util.js rename to src/lib/services/state-util.js diff --git a/lib/services/strategy-schema.js b/src/lib/services/strategy-schema.js similarity index 100% rename from lib/services/strategy-schema.js rename to src/lib/services/strategy-schema.js diff --git a/lib/services/strategy-service.js b/src/lib/services/strategy-service.js similarity index 100% rename from lib/services/strategy-service.js rename to src/lib/services/strategy-service.js diff --git a/lib/services/tag-schema.js b/src/lib/services/tag-schema.js similarity index 100% rename from lib/services/tag-schema.js rename to src/lib/services/tag-schema.js diff --git a/lib/services/tag-schema.test.js b/src/lib/services/tag-schema.test.js similarity index 100% rename from lib/services/tag-schema.test.js rename to src/lib/services/tag-schema.test.js diff --git a/lib/services/tag-service.js b/src/lib/services/tag-service.js similarity index 100% rename from lib/services/tag-service.js rename to src/lib/services/tag-service.js diff --git a/lib/services/tag-type-schema.js b/src/lib/services/tag-type-schema.js similarity index 100% rename from lib/services/tag-type-schema.js rename to src/lib/services/tag-type-schema.js diff --git a/lib/services/tag-type-schema.test.js b/src/lib/services/tag-type-schema.test.js similarity index 100% rename from lib/services/tag-type-schema.test.js rename to src/lib/services/tag-type-schema.test.js diff --git a/lib/services/tag-type-service.js b/src/lib/services/tag-type-service.js similarity index 100% rename from lib/services/tag-type-service.js rename to src/lib/services/tag-type-service.js diff --git a/lib/timer.js b/src/lib/timer.js similarity index 100% rename from lib/timer.js rename to src/lib/timer.js diff --git a/lib/timer.test.js b/src/lib/timer.test.js similarity index 100% rename from lib/timer.test.js rename to src/lib/timer.test.js diff --git a/lib/user.js b/src/lib/user.js similarity index 100% rename from lib/user.js rename to src/lib/user.js diff --git a/lib/user.test.js b/src/lib/user.test.js similarity index 100% rename from lib/user.test.js rename to src/lib/user.test.js diff --git a/lib/util/version.js b/src/lib/util/version.js similarity index 100% rename from lib/util/version.js rename to src/lib/util/version.js diff --git a/migrations/20141020151056-initial-schema.js b/src/migrations/20141020151056-initial-schema.js similarity index 100% rename from migrations/20141020151056-initial-schema.js rename to src/migrations/20141020151056-initial-schema.js diff --git a/migrations/20141110144153-add-description-to-features.js b/src/migrations/20141110144153-add-description-to-features.js similarity index 100% rename from migrations/20141110144153-add-description-to-features.js rename to src/migrations/20141110144153-add-description-to-features.js diff --git a/migrations/20141117200435-add-parameters-template-to-strategies.js b/src/migrations/20141117200435-add-parameters-template-to-strategies.js similarity index 100% rename from migrations/20141117200435-add-parameters-template-to-strategies.js rename to src/migrations/20141117200435-add-parameters-template-to-strategies.js diff --git a/migrations/20141117202209-insert-default-strategy.js b/src/migrations/20141117202209-insert-default-strategy.js similarity index 100% rename from migrations/20141117202209-insert-default-strategy.js rename to src/migrations/20141117202209-insert-default-strategy.js diff --git a/migrations/20141118071458-default-strategy-event.js b/src/migrations/20141118071458-default-strategy-event.js similarity index 100% rename from migrations/20141118071458-default-strategy-event.js rename to src/migrations/20141118071458-default-strategy-event.js diff --git a/migrations/20141215210141-005-archived-flag-to-features.js b/src/migrations/20141215210141-005-archived-flag-to-features.js similarity index 100% rename from migrations/20141215210141-005-archived-flag-to-features.js rename to src/migrations/20141215210141-005-archived-flag-to-features.js diff --git a/migrations/20150210152531-006-rename-eventtype.js b/src/migrations/20150210152531-006-rename-eventtype.js similarity index 100% rename from migrations/20150210152531-006-rename-eventtype.js rename to src/migrations/20150210152531-006-rename-eventtype.js diff --git a/migrations/20160618193924-add-strategies-to-features.js b/src/migrations/20160618193924-add-strategies-to-features.js similarity index 100% rename from migrations/20160618193924-add-strategies-to-features.js rename to src/migrations/20160618193924-add-strategies-to-features.js diff --git a/migrations/20161027134128-create-metrics.js b/src/migrations/20161027134128-create-metrics.js similarity index 100% rename from migrations/20161027134128-create-metrics.js rename to src/migrations/20161027134128-create-metrics.js diff --git a/migrations/20161104074441-create-client-instances.js b/src/migrations/20161104074441-create-client-instances.js similarity index 100% rename from migrations/20161104074441-create-client-instances.js rename to src/migrations/20161104074441-create-client-instances.js diff --git a/migrations/20161205203516-create-client-applications.js b/src/migrations/20161205203516-create-client-applications.js similarity index 100% rename from migrations/20161205203516-create-client-applications.js rename to src/migrations/20161205203516-create-client-applications.js diff --git a/migrations/20161212101749-better-strategy-parameter-definitions.js b/src/migrations/20161212101749-better-strategy-parameter-definitions.js similarity index 100% rename from migrations/20161212101749-better-strategy-parameter-definitions.js rename to src/migrations/20161212101749-better-strategy-parameter-definitions.js diff --git a/migrations/20170211085502-built-in-strategies.js b/src/migrations/20170211085502-built-in-strategies.js similarity index 100% rename from migrations/20170211085502-built-in-strategies.js rename to src/migrations/20170211085502-built-in-strategies.js diff --git a/migrations/20170211090541-add-default-strategies.js b/src/migrations/20170211090541-add-default-strategies.js similarity index 100% rename from migrations/20170211090541-add-default-strategies.js rename to src/migrations/20170211090541-add-default-strategies.js diff --git a/migrations/20170306233934-timestamp-with-tz.js b/src/migrations/20170306233934-timestamp-with-tz.js similarity index 100% rename from migrations/20170306233934-timestamp-with-tz.js rename to src/migrations/20170306233934-timestamp-with-tz.js diff --git a/migrations/20170628205541-add-sdk-version-to-client-instances.js b/src/migrations/20170628205541-add-sdk-version-to-client-instances.js similarity index 100% rename from migrations/20170628205541-add-sdk-version-to-client-instances.js rename to src/migrations/20170628205541-add-sdk-version-to-client-instances.js diff --git a/migrations/20190123204125-add-variants-to-features.js b/src/migrations/20190123204125-add-variants-to-features.js similarity index 100% rename from migrations/20190123204125-add-variants-to-features.js rename to src/migrations/20190123204125-add-variants-to-features.js diff --git a/migrations/20191023184858-flexible-rollout-strategy.js b/src/migrations/20191023184858-flexible-rollout-strategy.js similarity index 100% rename from migrations/20191023184858-flexible-rollout-strategy.js rename to src/migrations/20191023184858-flexible-rollout-strategy.js diff --git a/migrations/20200102184820-create-context-fields.js b/src/migrations/20200102184820-create-context-fields.js similarity index 100% rename from migrations/20200102184820-create-context-fields.js rename to src/migrations/20200102184820-create-context-fields.js diff --git a/migrations/20200227202711-settings.js b/src/migrations/20200227202711-settings.js similarity index 100% rename from migrations/20200227202711-settings.js rename to src/migrations/20200227202711-settings.js diff --git a/migrations/20200329191251-settings-secret.js b/src/migrations/20200329191251-settings-secret.js similarity index 100% rename from migrations/20200329191251-settings-secret.js rename to src/migrations/20200329191251-settings-secret.js diff --git a/migrations/20200416201319-create-users.js b/src/migrations/20200416201319-create-users.js similarity index 100% rename from migrations/20200416201319-create-users.js rename to src/migrations/20200416201319-create-users.js diff --git a/migrations/20200429175747-users-settings.js b/src/migrations/20200429175747-users-settings.js similarity index 100% rename from migrations/20200429175747-users-settings.js rename to src/migrations/20200429175747-users-settings.js diff --git a/migrations/20200805091409-add-feature-toggle-type.js b/src/migrations/20200805091409-add-feature-toggle-type.js similarity index 100% rename from migrations/20200805091409-add-feature-toggle-type.js rename to src/migrations/20200805091409-add-feature-toggle-type.js diff --git a/migrations/20200805094311-add-feature-type-to-features.js b/src/migrations/20200805094311-add-feature-type-to-features.js similarity index 100% rename from migrations/20200805094311-add-feature-type-to-features.js rename to src/migrations/20200805094311-add-feature-type-to-features.js diff --git a/migrations/20200806091734-add-stale-flag-to-features.js b/src/migrations/20200806091734-add-stale-flag-to-features.js similarity index 100% rename from migrations/20200806091734-add-stale-flag-to-features.js rename to src/migrations/20200806091734-add-stale-flag-to-features.js diff --git a/migrations/20200810200901-add-created-at-to-feature-types.js b/src/migrations/20200810200901-add-created-at-to-feature-types.js similarity index 100% rename from migrations/20200810200901-add-created-at-to-feature-types.js rename to src/migrations/20200810200901-add-created-at-to-feature-types.js diff --git a/migrations/20200928194947-add-projects.js b/src/migrations/20200928194947-add-projects.js similarity index 100% rename from migrations/20200928194947-add-projects.js rename to src/migrations/20200928194947-add-projects.js diff --git a/migrations/20200928195238-add-project-id-to-features.js b/src/migrations/20200928195238-add-project-id-to-features.js similarity index 100% rename from migrations/20200928195238-add-project-id-to-features.js rename to src/migrations/20200928195238-add-project-id-to-features.js diff --git a/migrations/20201216140726-add-last-seen-to-features.js b/src/migrations/20201216140726-add-last-seen-to-features.js similarity index 100% rename from migrations/20201216140726-add-last-seen-to-features.js rename to src/migrations/20201216140726-add-last-seen-to-features.js diff --git a/migrations/20210105083014-add-tag-and-tag-types.js b/src/migrations/20210105083014-add-tag-and-tag-types.js similarity index 100% rename from migrations/20210105083014-add-tag-and-tag-types.js rename to src/migrations/20210105083014-add-tag-and-tag-types.js diff --git a/migrations/20210119084617-add-addon-table.js b/src/migrations/20210119084617-add-addon-table.js similarity index 100% rename from migrations/20210119084617-add-addon-table.js rename to src/migrations/20210119084617-add-addon-table.js diff --git a/migrations/20210121115438-add-deprecated-column-to-strategies.js b/src/migrations/20210121115438-add-deprecated-column-to-strategies.js similarity index 100% rename from migrations/20210121115438-add-deprecated-column-to-strategies.js rename to src/migrations/20210121115438-add-deprecated-column-to-strategies.js diff --git a/migrations/20210127094440-add-tags-column-to-events.js b/src/migrations/20210127094440-add-tags-column-to-events.js similarity index 100% rename from migrations/20210127094440-add-tags-column-to-events.js rename to src/migrations/20210127094440-add-tags-column-to-events.js diff --git a/migrations/20210208203708-add-stickiness-to-context.js b/src/migrations/20210208203708-add-stickiness-to-context.js similarity index 100% rename from migrations/20210208203708-add-stickiness-to-context.js rename to src/migrations/20210208203708-add-stickiness-to-context.js diff --git a/migrations/default-strategies.json b/src/migrations/default-strategies.json similarity index 100% rename from migrations/default-strategies.json rename to src/migrations/default-strategies.json diff --git a/migrations/flexible-rollout-strategy.json b/src/migrations/flexible-rollout-strategy.json similarity index 100% rename from migrations/flexible-rollout-strategy.json rename to src/migrations/flexible-rollout-strategy.json diff --git a/migrator.js b/src/migrator.js similarity index 100% rename from migrator.js rename to src/migrator.js diff --git a/server-dev.js b/src/server-dev.ts similarity index 84% rename from server-dev.js rename to src/server-dev.ts index ca971bfea5..5fd0268baa 100644 --- a/server-dev.js +++ b/src/server-dev.ts @@ -1,6 +1,6 @@ 'use strict'; -const unleash = require('./lib/server-impl'); +import unleash from './lib/server-impl'; unleash.start({ db: { diff --git a/server.js b/src/server.js similarity index 100% rename from server.js rename to src/server.js diff --git a/test/e2e/api/admin/addon.e2e.test.js b/src/test/e2e/api/admin/addon.e2e.test.js similarity index 100% rename from test/e2e/api/admin/addon.e2e.test.js rename to src/test/e2e/api/admin/addon.e2e.test.js diff --git a/test/e2e/api/admin/context.e2e.test.js b/src/test/e2e/api/admin/context.e2e.test.js similarity index 100% rename from test/e2e/api/admin/context.e2e.test.js rename to src/test/e2e/api/admin/context.e2e.test.js diff --git a/test/e2e/api/admin/event.e2e.test.js b/src/test/e2e/api/admin/event.e2e.test.js similarity index 100% rename from test/e2e/api/admin/event.e2e.test.js rename to src/test/e2e/api/admin/event.e2e.test.js diff --git a/test/e2e/api/admin/feature-archive.e2e.test.js b/src/test/e2e/api/admin/feature-archive.e2e.test.js similarity index 100% rename from test/e2e/api/admin/feature-archive.e2e.test.js rename to src/test/e2e/api/admin/feature-archive.e2e.test.js diff --git a/test/e2e/api/admin/feature.auth.e2e.test.js b/src/test/e2e/api/admin/feature.auth.e2e.test.js similarity index 100% rename from test/e2e/api/admin/feature.auth.e2e.test.js rename to src/test/e2e/api/admin/feature.auth.e2e.test.js diff --git a/test/e2e/api/admin/feature.custom-auth.e2e.test.js b/src/test/e2e/api/admin/feature.custom-auth.e2e.test.js similarity index 100% rename from test/e2e/api/admin/feature.custom-auth.e2e.test.js rename to src/test/e2e/api/admin/feature.custom-auth.e2e.test.js diff --git a/test/e2e/api/admin/feature.e2e.test.js b/src/test/e2e/api/admin/feature.e2e.test.js similarity index 100% rename from test/e2e/api/admin/feature.e2e.test.js rename to src/test/e2e/api/admin/feature.e2e.test.js diff --git a/test/e2e/api/admin/metrics.e2e.test.js b/src/test/e2e/api/admin/metrics.e2e.test.js similarity index 100% rename from test/e2e/api/admin/metrics.e2e.test.js rename to src/test/e2e/api/admin/metrics.e2e.test.js diff --git a/test/e2e/api/admin/state.e2e.test.js b/src/test/e2e/api/admin/state.e2e.test.js similarity index 95% rename from test/e2e/api/admin/state.e2e.test.js rename to src/test/e2e/api/admin/state.e2e.test.js index 86b9452c8b..7cd8dd9a4d 100644 --- a/test/e2e/api/admin/state.e2e.test.js +++ b/src/test/e2e/api/admin/state.e2e.test.js @@ -81,7 +81,7 @@ test.serial('imports strategies and features from json file', async t => { const request = await setupApp(stores); return request .post('/api/admin/state/import') - .attach('file', 'test/examples/import.json') + .attach('file', 'src/test/examples/import.json') .expect(202); }); @@ -90,6 +90,6 @@ test.serial('imports strategies and features from yaml file', async t => { const request = await setupApp(stores); return request .post('/api/admin/state/import') - .attach('file', 'test/examples/import.yml') + .attach('file', 'src/test/examples/import.yml') .expect(202); }); diff --git a/test/e2e/api/admin/strategy.e2e.test.js b/src/test/e2e/api/admin/strategy.e2e.test.js similarity index 100% rename from test/e2e/api/admin/strategy.e2e.test.js rename to src/test/e2e/api/admin/strategy.e2e.test.js diff --git a/test/e2e/api/admin/tag-types.e2e.test.js b/src/test/e2e/api/admin/tag-types.e2e.test.js similarity index 100% rename from test/e2e/api/admin/tag-types.e2e.test.js rename to src/test/e2e/api/admin/tag-types.e2e.test.js diff --git a/test/e2e/api/admin/tags.e2e.test.js b/src/test/e2e/api/admin/tags.e2e.test.js similarity index 100% rename from test/e2e/api/admin/tags.e2e.test.js rename to src/test/e2e/api/admin/tags.e2e.test.js diff --git a/test/e2e/api/client/feature.e2e.test.js b/src/test/e2e/api/client/feature.e2e.test.js similarity index 100% rename from test/e2e/api/client/feature.e2e.test.js rename to src/test/e2e/api/client/feature.e2e.test.js diff --git a/test/e2e/api/client/metrics.e2e.test.js b/src/test/e2e/api/client/metrics.e2e.test.js similarity index 100% rename from test/e2e/api/client/metrics.e2e.test.js rename to src/test/e2e/api/client/metrics.e2e.test.js diff --git a/test/e2e/health.e2e.test.js b/src/test/e2e/health.e2e.test.js similarity index 100% rename from test/e2e/health.e2e.test.js rename to src/test/e2e/health.e2e.test.js diff --git a/test/e2e/helpers/database-config.js b/src/test/e2e/helpers/database-config.js similarity index 100% rename from test/e2e/helpers/database-config.js rename to src/test/e2e/helpers/database-config.js diff --git a/test/e2e/helpers/database-init.js b/src/test/e2e/helpers/database-init.js similarity index 100% rename from test/e2e/helpers/database-init.js rename to src/test/e2e/helpers/database-init.js diff --git a/test/e2e/helpers/database.json b/src/test/e2e/helpers/database.json similarity index 100% rename from test/e2e/helpers/database.json rename to src/test/e2e/helpers/database.json diff --git a/test/e2e/helpers/test-helper.js b/src/test/e2e/helpers/test-helper.js similarity index 97% rename from test/e2e/helpers/test-helper.js rename to src/test/e2e/helpers/test-helper.js index d8e75fa1b0..c98da85af0 100644 --- a/test/e2e/helpers/test-helper.js +++ b/src/test/e2e/helpers/test-helper.js @@ -1,7 +1,7 @@ 'use strict'; process.env.NODE_ENV = 'test'; - +/* eslint-disable-next-line */ const supertest = require('supertest'); const { EventEmitter } = require('events'); diff --git a/test/e2e/services/project-service.e2e.test.js b/src/test/e2e/services/project-service.e2e.test.js similarity index 100% rename from test/e2e/services/project-service.e2e.test.js rename to src/test/e2e/services/project-service.e2e.test.js diff --git a/test/e2e/stores/project-store.e2e.test.js b/src/test/e2e/stores/project-store.e2e.test.js similarity index 100% rename from test/e2e/stores/project-store.e2e.test.js rename to src/test/e2e/stores/project-store.e2e.test.js diff --git a/test/e2e/stores/setting-store.e2e.test.js b/src/test/e2e/stores/setting-store.e2e.test.js similarity index 100% rename from test/e2e/stores/setting-store.e2e.test.js rename to src/test/e2e/stores/setting-store.e2e.test.js diff --git a/test/e2e/stores/user-store.e2e.test.js b/src/test/e2e/stores/user-store.e2e.test.js similarity index 100% rename from test/e2e/stores/user-store.e2e.test.js rename to src/test/e2e/stores/user-store.e2e.test.js diff --git a/test/examples/client-metrics.json b/src/test/examples/client-metrics.json similarity index 100% rename from test/examples/client-metrics.json rename to src/test/examples/client-metrics.json diff --git a/test/examples/client-register.json b/src/test/examples/client-register.json similarity index 100% rename from test/examples/client-register.json rename to src/test/examples/client-register.json diff --git a/test/examples/import.json b/src/test/examples/import.json similarity index 100% rename from test/examples/import.json rename to src/test/examples/import.json diff --git a/test/examples/import.yml b/src/test/examples/import.yml similarity index 100% rename from test/examples/import.yml rename to src/test/examples/import.yml diff --git a/test/fixtures/fake-addon-store.js b/src/test/fixtures/fake-addon-store.js similarity index 100% rename from test/fixtures/fake-addon-store.js rename to src/test/fixtures/fake-addon-store.js diff --git a/test/fixtures/fake-client-applications-store.js b/src/test/fixtures/fake-client-applications-store.js similarity index 100% rename from test/fixtures/fake-client-applications-store.js rename to src/test/fixtures/fake-client-applications-store.js diff --git a/test/fixtures/fake-client-instance-store.js b/src/test/fixtures/fake-client-instance-store.js similarity index 100% rename from test/fixtures/fake-client-instance-store.js rename to src/test/fixtures/fake-client-instance-store.js diff --git a/test/fixtures/fake-context-store.js b/src/test/fixtures/fake-context-store.js similarity index 100% rename from test/fixtures/fake-context-store.js rename to src/test/fixtures/fake-context-store.js diff --git a/test/fixtures/fake-event-store.js b/src/test/fixtures/fake-event-store.js similarity index 87% rename from test/fixtures/fake-event-store.js rename to src/test/fixtures/fake-event-store.js index 83d67dd3b0..a5153960b3 100644 --- a/test/fixtures/fake-event-store.js +++ b/src/test/fixtures/fake-event-store.js @@ -20,6 +20,4 @@ class EventStore extends EventEmitter { } } -module.exports = () => { - return new EventStore(); -}; +module.exports = EventStore; diff --git a/test/fixtures/fake-feature-toggle-store.js b/src/test/fixtures/fake-feature-toggle-store.js similarity index 100% rename from test/fixtures/fake-feature-toggle-store.js rename to src/test/fixtures/fake-feature-toggle-store.js diff --git a/test/fixtures/fake-metrics-store.js b/src/test/fixtures/fake-metrics-store.js similarity index 100% rename from test/fixtures/fake-metrics-store.js rename to src/test/fixtures/fake-metrics-store.js diff --git a/test/fixtures/fake-setting-store.js b/src/test/fixtures/fake-setting-store.js similarity index 100% rename from test/fixtures/fake-setting-store.js rename to src/test/fixtures/fake-setting-store.js diff --git a/test/fixtures/fake-strategies-store.js b/src/test/fixtures/fake-strategies-store.js similarity index 100% rename from test/fixtures/fake-strategies-store.js rename to src/test/fixtures/fake-strategies-store.js diff --git a/test/fixtures/fake-tag-store.js b/src/test/fixtures/fake-tag-store.js similarity index 100% rename from test/fixtures/fake-tag-store.js rename to src/test/fixtures/fake-tag-store.js diff --git a/test/fixtures/fake-tag-type-store.js b/src/test/fixtures/fake-tag-type-store.js similarity index 100% rename from test/fixtures/fake-tag-type-store.js rename to src/test/fixtures/fake-tag-type-store.js diff --git a/test/fixtures/no-logger.js b/src/test/fixtures/no-logger.js similarity index 100% rename from test/fixtures/no-logger.js rename to src/test/fixtures/no-logger.js diff --git a/test/fixtures/permissions.js b/src/test/fixtures/permissions.js similarity index 100% rename from test/fixtures/permissions.js rename to src/test/fixtures/permissions.js diff --git a/test/fixtures/store.js b/src/test/fixtures/store.js similarity index 93% rename from test/fixtures/store.js rename to src/test/fixtures/store.js index 632ab990e5..d3212ea20e 100644 --- a/test/fixtures/store.js +++ b/src/test/fixtures/store.js @@ -6,7 +6,7 @@ const clientApplicationsStore = require('./fake-client-applications-store'); const featureToggleStore = require('./fake-feature-toggle-store'); const tagStore = require('./fake-tag-store'); const tagTypeStore = require('./fake-tag-type-store'); -const eventStore = require('./fake-event-store'); +const EventStore = require('./fake-event-store'); const strategyStore = require('./fake-strategies-store'); const contextFieldStore = require('./fake-context-store'); const settingStore = require('./fake-setting-store'); @@ -28,7 +28,7 @@ module.exports = { featureToggleStore: featureToggleStore(), tagStore: tagStore(), tagTypeStore: tagTypeStore(), - eventStore: eventStore(), + eventStore: new EventStore(), strategyStore: strategyStore(), contextFieldStore: contextFieldStore(), settingStore: settingStore(), diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000000..c9fe4b0032 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,83 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ + "target": "es2019" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */, + "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */, + "lib": [ + "es6" + ] /* Specify library files to be included in the compilation. */, + "allowJs": true /* Allow javascript files to be compiled. */, + // "checkJs": true, /* Report errors in .js files. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + "declaration": true /* Generates corresponding '.d.ts' file. */, + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + "outDir": "./dist" /* Redirect output structure to the directory. */, + "rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */, + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + /* Strict Type-Checking Options */ + // "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + /* Source Map Options */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + "sourceMap": true, + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + /* Advanced Options */ + "resolveJsonModule": true /* Include modules imported with '.json' extension */, + "skipLibCheck": true /* Skip type checking of declaration files. */, + "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + }, + "exclude": [ + "bin", + "docs", + "examples", + "migrations", + "node_modules", + "lib", + "website", + "test", + "test/fixtures", + "src/binver-dev.js", + "server.js", + "dist", + "snapshots", + "coverage" + ] +} diff --git a/yarn.lock b/yarn.lock index 6f22ee4e1d..01ef85cffd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6024,6 +6024,11 @@ typedarray@^0.0.6: resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= +typescript@^4.1.5: + version "4.1.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.5.tgz#123a3b214aaff3be32926f0d8f1f6e704eb89a72" + integrity sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA== + unc-path-regex@^0.1.2: version "0.1.2" resolved "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz"